@realsee/five 6.4.0-alpha.8 → 6.4.0-alpha.9
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/classes/five.Five.html +6 -6
- package/docs/classes/five.Model.html +2 -2
- package/docs/interfaces/five.Tile3dLayerOptions.html +1 -1
- package/docs/types/five.ModelMaterialValues.html +1 -1
- package/docs/types/five.Models.html +5 -5
- package/five/index.d.ts +1 -1
- package/five/index.js +46 -46
- package/five/index.mjs +2013 -1991
- 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/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 +24 -24
- 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/umd/five.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
3
|
* @realsee/five
|
|
4
|
-
* Generated: 1/
|
|
5
|
-
* Version: 6.4.0-alpha.
|
|
4
|
+
* Generated: 1/8/2025
|
|
5
|
+
* Version: 6.4.0-alpha.9
|
|
6
6
|
* Terms:
|
|
7
7
|
* Realsee SDK License Agreement
|
|
8
8
|
* Update: July 28, 2021
|
|
@@ -339,7 +339,7 @@
|
|
|
339
339
|
*
|
|
340
340
|
* https://code.google.com/p/crypto-js/wiki/License
|
|
341
341
|
* PART: ext/cryptojs
|
|
342
|
-
*/var KJUR={},CryptoJS=CryptoJS||function(n,t){var e={},r=e.lib={},o=r.Base=function(){function v(){}return{extend:function(g){v.prototype=this;var h=new v;return g&&h.mixIn(g),h.hasOwnProperty("init")||(h.init=function(){h.$super.init.apply(this,arguments)}),h.init.prototype=h,h.$super=this,h},create:function(){var g=this.extend();return g.init.apply(g,arguments),g},init:function(){},mixIn:function(g){for(var h in g)g.hasOwnProperty(h)&&(this[h]=g[h]);g.hasOwnProperty("toString")&&(this.toString=g.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),s=r.WordArray=o.extend({init:function(v,g){v=this.words=v||[],g!=t?this.sigBytes=g:this.sigBytes=v.length*4},toString:function(v){return(v||l).stringify(this)},concat:function(v){var g=this.words,h=v.words,m=this.sigBytes,y=v.sigBytes;if(this.clamp(),m%4)for(var A=0;A<y;A++){var E=h[A>>>2]>>>24-A%4*8&255;g[m+A>>>2]|=E<<24-(m+A)%4*8}else for(var A=0;A<y;A+=4)g[m+A>>>2]=h[A>>>2];return this.sigBytes+=y,this},clamp:function(){var v=this.words,g=this.sigBytes;v[g>>>2]&=4294967295<<32-g%4*8,v.length=n.ceil(g/4)},clone:function(){var v=o.clone.call(this);return v.words=this.words.slice(0),v},random:function(v){for(var g=[],h=0;h<v;h+=4)g.push(n.random()*4294967296|0);return new s.init(g,v)}}),u=e.enc={},l=u.Hex={stringify:function(v){for(var g=v.words,h=v.sigBytes,m=[],y=0;y<h;y++){var A=g[y>>>2]>>>24-y%4*8&255;m.push((A>>>4).toString(16)),m.push((A&15).toString(16))}return m.join("")},parse:function(v){for(var g=v.length,h=[],m=0;m<g;m+=2)h[m>>>3]|=parseInt(v.substr(m,2),16)<<24-m%8*4;return new s.init(h,g/2)}},c=u.Latin1={stringify:function(v){for(var g=v.words,h=v.sigBytes,m=[],y=0;y<h;y++){var A=g[y>>>2]>>>24-y%4*8&255;m.push(String.fromCharCode(A))}return m.join("")},parse:function(v){for(var g=v.length,h=[],m=0;m<g;m++)h[m>>>2]|=(v.charCodeAt(m)&255)<<24-m%4*8;return new s.init(h,g)}},f=u.Utf8={stringify:function(v){try{return decodeURIComponent(escape(c.stringify(v)))}catch(g){throw new Error("Malformed UTF-8 data")}},parse:function(v){return c.parse(unescape(encodeURIComponent(v)))}},d=r.BufferedBlockAlgorithm=o.extend({reset:function(){this._data=new s.init,this._nDataBytes=0},_append:function(v){typeof v=="string"&&(v=f.parse(v)),this._data.concat(v),this._nDataBytes+=v.sigBytes},_process:function(v){var g=this._data,h=g.words,m=g.sigBytes,y=this.blockSize,A=y*4,E=m/A;v?E=n.ceil(E):E=n.max((E|0)-this._minBufferSize,0);var b=E*y,T=n.min(b*4,m);if(b){for(var _=0;_<b;_+=y)this._doProcessBlock(h,_);var R=h.splice(0,b);g.sigBytes-=T}return new s.init(R,T)},clone:function(){var v=o.clone.call(this);return v._data=this._data.clone(),v},_minBufferSize:0});r.Hasher=d.extend({cfg:o.extend(),init:function(v){this.cfg=this.cfg.extend(v),this.reset()},reset:function(){d.reset.call(this),this._doReset()},update:function(v){return this._append(v),this._process(),this},finalize:function(v){v&&this._append(v);var g=this._doFinalize();return g},blockSize:512/32,_createHelper:function(v){return function(g,h){return new v.init(h).finalize(g)}},_createHmacHelper:function(v){return function(g,h){return new p.HMAC.init(v,h).finalize(g)}}});var p=e.algo={};return e}(Math);(function(n){for(var t=CryptoJS,g=t.lib,e=g.WordArray,r=g.Hasher,g=t.algo,o=[],s=[],u=function(m){return 4294967296*(m-(m|0))|0},l=2,c=0;64>c;){var f;e:{f=l;for(var d=n.sqrt(f),p=2;p<=d;p++)if(!(f%p)){f=!1;break e}f=!0}f&&(8>c&&(o[c]=u(n.pow(l,.5))),s[c]=u(n.pow(l,1/3)),c++),l++}var v=[],g=g.SHA256=r.extend({_doReset:function(){this._hash=new e.init(o.slice(0))},_doProcessBlock:function(h,m){for(var y=this._hash.words,A=y[0],E=y[1],b=y[2],T=y[3],_=y[4],R=y[5],S=y[6],M=y[7],B=0;64>B;B++){if(16>B)v[B]=h[m+B]|0;else{var H=v[B-15],w=v[B-2];v[B]=((H<<25|H>>>7)^(H<<14|H>>>18)^H>>>3)+v[B-7]+((w<<15|w>>>17)^(w<<13|w>>>19)^w>>>10)+v[B-16]}H=M+((_<<26|_>>>6)^(_<<21|_>>>11)^(_<<7|_>>>25))+(_&R^~_&S)+s[B]+v[B],w=((A<<30|A>>>2)^(A<<19|A>>>13)^(A<<10|A>>>22))+(A&E^A&b^E&b),M=S,S=R,R=_,_=T+H|0,T=b,b=E,E=A,A=H+w|0}y[0]=y[0]+A|0,y[1]=y[1]+E|0,y[2]=y[2]+b|0,y[3]=y[3]+T|0,y[4]=y[4]+_|0,y[5]=y[5]+R|0,y[6]=y[6]+S|0,y[7]=y[7]+M|0},_doFinalize:function(){var h=this._data,m=h.words,y=8*this._nDataBytes,A=8*h.sigBytes;return m[A>>>5]|=128<<24-A%32,m[(A+64>>>9<<4)+14]=n.floor(y/4294967296),m[(A+64>>>9<<4)+15]=y,h.sigBytes=4*m.length,this._process(),this._hash},clone:function(){var h=r.clone.call(this);return h._hash=this._hash.clone(),h}});t.SHA256=r._createHelper(g),t.HmacSHA256=r._createHmacHelper(g)})(Math),CryptoJS.lib.Cipher||function(n){var g=CryptoJS,t=g.lib,e=t.Base,r=t.WordArray,o=t.BufferedBlockAlgorithm,s=g.enc.Base64,u=g.algo.EvpKDF,l=t.Cipher=o.extend({cfg:e.extend(),createEncryptor:function(m,y){return this.create(this._ENC_XFORM_MODE,m,y)},createDecryptor:function(m,y){return this.create(this._DEC_XFORM_MODE,m,y)},init:function(m,y,A){this.cfg=this.cfg.extend(A),this._xformMode=m,this._key=y,this.reset()},reset:function(){o.reset.call(this),this._doReset()},process:function(m){return this._append(m),this._process()},finalize:function(m){return m&&this._append(m),this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(m){return{encrypt:function(y,A,E){return(typeof A=="string"?h:v).encrypt(m,y,A,E)},decrypt:function(y,A,E){return(typeof A=="string"?h:v).decrypt(m,y,A,E)}}}});t.StreamCipher=l.extend({_doFinalize:function(){return this._process(!0)},blockSize:1});var p=g.mode={},c=function(m,y,A){var E=this._iv;E?this._iv=n:E=this._prevBlock;for(var b=0;b<A;b++)m[y+b]^=E[b]},f=(t.BlockCipherMode=e.extend({createEncryptor:function(m,y){return this.Encryptor.create(m,y)},createDecryptor:function(m,y){return this.Decryptor.create(m,y)},init:function(m,y){this._cipher=m,this._iv=y}})).extend();f.Encryptor=f.extend({processBlock:function(m,y){var A=this._cipher,E=A.blockSize;c.call(this,m,y,E),A.encryptBlock(m,y),this._prevBlock=m.slice(y,y+E)}}),f.Decryptor=f.extend({processBlock:function(m,y){var A=this._cipher,E=A.blockSize,b=m.slice(y,y+E);A.decryptBlock(m,y),c.call(this,m,y,E),this._prevBlock=b}}),p=p.CBC=f,f=(g.pad={}).Pkcs7={pad:function(m,y){for(var A=4*y,A=A-m.sigBytes%A,E=A<<24|A<<16|A<<8|A,b=[],T=0;T<A;T+=4)b.push(E);A=r.create(b,A),m.concat(A)},unpad:function(m){m.sigBytes-=m.words[m.sigBytes-1>>>2]&255}},t.BlockCipher=l.extend({cfg:l.cfg.extend({mode:p,padding:f}),reset:function(){l.reset.call(this);var y=this.cfg,m=y.iv,y=y.mode;if(this._xformMode==this._ENC_XFORM_MODE)var A=y.createEncryptor;else A=y.createDecryptor,this._minBufferSize=1;this._mode=A.call(y,this,m&&m.words)},_doProcessBlock:function(m,y){this._mode.processBlock(m,y)},_doFinalize:function(){var m=this.cfg.padding;if(this._xformMode==this._ENC_XFORM_MODE){m.pad(this._data,this.blockSize);var y=this._process(!0)}else y=this._process(!0),m.unpad(y);return y},blockSize:4});var d=t.CipherParams=e.extend({init:function(m){this.mixIn(m)},toString:function(m){return(m||this.formatter).stringify(this)}}),p=(g.format={}).OpenSSL={stringify:function(m){var y=m.ciphertext;return m=m.salt,(m?r.create([1398893684,1701076831]).concat(m).concat(y):y).toString(s)},parse:function(m){m=s.parse(m);var y=m.words;if(y[0]==1398893684&&y[1]==1701076831){var A=r.create(y.slice(2,4));y.splice(0,4),m.sigBytes-=16}return d.create({ciphertext:m,salt:A})}},v=t.SerializableCipher=e.extend({cfg:e.extend({format:p}),encrypt:function(m,y,A,E){E=this.cfg.extend(E);var b=m.createEncryptor(A,E);return y=b.finalize(y),b=b.cfg,d.create({ciphertext:y,key:A,iv:b.iv,algorithm:m,mode:b.mode,padding:b.padding,blockSize:m.blockSize,formatter:E.format})},decrypt:function(m,y,A,E){return E=this.cfg.extend(E),y=this._parse(y,E.format),m.createDecryptor(A,E).finalize(y.ciphertext)},_parse:function(m,y){return typeof m=="string"?y.parse(m,this):m}}),g=(g.kdf={}).OpenSSL={execute:function(m,y,A,E){return E||(E=r.random(8)),m=u.create({keySize:y+A}).compute(m,E),A=r.create(m.words.slice(y),4*A),m.sigBytes=4*y,d.create({key:m,iv:A,salt:E})}},h=t.PasswordBasedCipher=v.extend({cfg:v.cfg.extend({kdf:g}),encrypt:function(m,y,A,E){return E=this.cfg.extend(E),A=E.kdf.execute(A,m.keySize,m.ivSize),E.iv=A.iv,m=v.encrypt.call(this,m,y,A.key,E),m.mixIn(A),m},decrypt:function(m,y,A,E){return E=this.cfg.extend(E),y=this._parse(y,E.format),A=E.kdf.execute(A,m.keySize,m.ivSize,y.salt),E.iv=A.iv,v.decrypt.call(this,m,y,A.key,E)}})}(),function(){for(var n=CryptoJS,t=n.lib.BlockCipher,R=n.algo,e=[],r=[],o=[],s=[],u=[],l=[],c=[],f=[],d=[],p=[],v=[],g=0;256>g;g++)v[g]=128>g?g<<1:g<<1^283;for(var h=0,m=0,g=0;256>g;g++){var y=m^m<<1^m<<2^m<<3^m<<4,y=y>>>8^y&255^99;e[h]=y,r[y]=h;var A=v[h],E=v[A],b=v[E],T=257*v[y]^16843008*y;o[h]=T<<24|T>>>8,s[h]=T<<16|T>>>16,u[h]=T<<8|T>>>24,l[h]=T,T=16843009*b^65537*E^257*A^16843008*h,c[y]=T<<24|T>>>8,f[y]=T<<16|T>>>16,d[y]=T<<8|T>>>24,p[y]=T,h?(h=A^v[v[v[b^A]]],m^=v[v[m]]):h=m=1}var _=[0,1,2,4,8,16,32,64,128,27,54],R=R.AES=t.extend({_doReset:function(){for(var B=this._key,S=B.words,M=B.sigBytes/4,B=4*((this._nRounds=M+6)+1),H=this._keySchedule=[],w=0;w<B;w++)if(w<M)H[w]=S[w];else{var C=H[w-1];w%M?6<M&&w%M==4&&(C=e[C>>>24]<<24|e[C>>>16&255]<<16|e[C>>>8&255]<<8|e[C&255]):(C=C<<8|C>>>24,C=e[C>>>24]<<24|e[C>>>16&255]<<16|e[C>>>8&255]<<8|e[C&255],C^=_[w/M|0]<<24),H[w]=H[w-M]^C}for(S=this._invKeySchedule=[],M=0;M<B;M++)w=B-M,C=M%4?H[w]:H[w-4],S[M]=4>M||4>=w?C:c[e[C>>>24]]^f[e[C>>>16&255]]^d[e[C>>>8&255]]^p[e[C&255]]},encryptBlock:function(S,M){this._doCryptBlock(S,M,this._keySchedule,o,s,u,l,e)},decryptBlock:function(S,M){var B=S[M+1];S[M+1]=S[M+3],S[M+3]=B,this._doCryptBlock(S,M,this._invKeySchedule,c,f,d,p,r),B=S[M+1],S[M+1]=S[M+3],S[M+3]=B},_doCryptBlock:function(S,M,B,H,w,C,L,I){for(var F=this._nRounds,G=S[M]^B[0],J=S[M+1]^B[1],X=S[M+2]^B[2],q=S[M+3]^B[3],k=4,N=1;N<F;N++)var D=H[G>>>24]^w[J>>>16&255]^C[X>>>8&255]^L[q&255]^B[k++],U=H[J>>>24]^w[X>>>16&255]^C[q>>>8&255]^L[G&255]^B[k++],Q=H[X>>>24]^w[q>>>16&255]^C[G>>>8&255]^L[J&255]^B[k++],q=H[q>>>24]^w[G>>>16&255]^C[J>>>8&255]^L[X&255]^B[k++],G=D,J=U,X=Q;D=(I[G>>>24]<<24|I[J>>>16&255]<<16|I[X>>>8&255]<<8|I[q&255])^B[k++],U=(I[J>>>24]<<24|I[X>>>16&255]<<16|I[q>>>8&255]<<8|I[G&255])^B[k++],Q=(I[X>>>24]<<24|I[q>>>16&255]<<16|I[G>>>8&255]<<8|I[J&255])^B[k++],q=(I[q>>>24]<<24|I[G>>>16&255]<<16|I[J>>>8&255]<<8|I[X&255])^B[k++],S[M]=D,S[M+1]=U,S[M+2]=Q,S[M+3]=q},keySize:8});n.AES=t._createHelper(R)}();/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/
|
|
342
|
+
*/var KJUR={},CryptoJS=CryptoJS||function(n,t){var e={},r=e.lib={},o=r.Base=function(){function v(){}return{extend:function(g){v.prototype=this;var h=new v;return g&&h.mixIn(g),h.hasOwnProperty("init")||(h.init=function(){h.$super.init.apply(this,arguments)}),h.init.prototype=h,h.$super=this,h},create:function(){var g=this.extend();return g.init.apply(g,arguments),g},init:function(){},mixIn:function(g){for(var h in g)g.hasOwnProperty(h)&&(this[h]=g[h]);g.hasOwnProperty("toString")&&(this.toString=g.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),s=r.WordArray=o.extend({init:function(v,g){v=this.words=v||[],g!=t?this.sigBytes=g:this.sigBytes=v.length*4},toString:function(v){return(v||l).stringify(this)},concat:function(v){var g=this.words,h=v.words,m=this.sigBytes,y=v.sigBytes;if(this.clamp(),m%4)for(var A=0;A<y;A++){var E=h[A>>>2]>>>24-A%4*8&255;g[m+A>>>2]|=E<<24-(m+A)%4*8}else for(var A=0;A<y;A+=4)g[m+A>>>2]=h[A>>>2];return this.sigBytes+=y,this},clamp:function(){var v=this.words,g=this.sigBytes;v[g>>>2]&=4294967295<<32-g%4*8,v.length=n.ceil(g/4)},clone:function(){var v=o.clone.call(this);return v.words=this.words.slice(0),v},random:function(v){for(var g=[],h=0;h<v;h+=4)g.push(n.random()*4294967296|0);return new s.init(g,v)}}),u=e.enc={},l=u.Hex={stringify:function(v){for(var g=v.words,h=v.sigBytes,m=[],y=0;y<h;y++){var A=g[y>>>2]>>>24-y%4*8&255;m.push((A>>>4).toString(16)),m.push((A&15).toString(16))}return m.join("")},parse:function(v){for(var g=v.length,h=[],m=0;m<g;m+=2)h[m>>>3]|=parseInt(v.substr(m,2),16)<<24-m%8*4;return new s.init(h,g/2)}},c=u.Latin1={stringify:function(v){for(var g=v.words,h=v.sigBytes,m=[],y=0;y<h;y++){var A=g[y>>>2]>>>24-y%4*8&255;m.push(String.fromCharCode(A))}return m.join("")},parse:function(v){for(var g=v.length,h=[],m=0;m<g;m++)h[m>>>2]|=(v.charCodeAt(m)&255)<<24-m%4*8;return new s.init(h,g)}},f=u.Utf8={stringify:function(v){try{return decodeURIComponent(escape(c.stringify(v)))}catch(g){throw new Error("Malformed UTF-8 data")}},parse:function(v){return c.parse(unescape(encodeURIComponent(v)))}},d=r.BufferedBlockAlgorithm=o.extend({reset:function(){this._data=new s.init,this._nDataBytes=0},_append:function(v){typeof v=="string"&&(v=f.parse(v)),this._data.concat(v),this._nDataBytes+=v.sigBytes},_process:function(v){var g=this._data,h=g.words,m=g.sigBytes,y=this.blockSize,A=y*4,E=m/A;v?E=n.ceil(E):E=n.max((E|0)-this._minBufferSize,0);var b=E*y,T=n.min(b*4,m);if(b){for(var _=0;_<b;_+=y)this._doProcessBlock(h,_);var R=h.splice(0,b);g.sigBytes-=T}return new s.init(R,T)},clone:function(){var v=o.clone.call(this);return v._data=this._data.clone(),v},_minBufferSize:0});r.Hasher=d.extend({cfg:o.extend(),init:function(v){this.cfg=this.cfg.extend(v),this.reset()},reset:function(){d.reset.call(this),this._doReset()},update:function(v){return this._append(v),this._process(),this},finalize:function(v){v&&this._append(v);var g=this._doFinalize();return g},blockSize:512/32,_createHelper:function(v){return function(g,h){return new v.init(h).finalize(g)}},_createHmacHelper:function(v){return function(g,h){return new p.HMAC.init(v,h).finalize(g)}}});var p=e.algo={};return e}(Math);(function(n){for(var t=CryptoJS,g=t.lib,e=g.WordArray,r=g.Hasher,g=t.algo,o=[],s=[],u=function(m){return 4294967296*(m-(m|0))|0},l=2,c=0;64>c;){var f;e:{f=l;for(var d=n.sqrt(f),p=2;p<=d;p++)if(!(f%p)){f=!1;break e}f=!0}f&&(8>c&&(o[c]=u(n.pow(l,.5))),s[c]=u(n.pow(l,1/3)),c++),l++}var v=[],g=g.SHA256=r.extend({_doReset:function(){this._hash=new e.init(o.slice(0))},_doProcessBlock:function(h,m){for(var y=this._hash.words,A=y[0],E=y[1],b=y[2],T=y[3],_=y[4],R=y[5],S=y[6],M=y[7],B=0;64>B;B++){if(16>B)v[B]=h[m+B]|0;else{var H=v[B-15],w=v[B-2];v[B]=((H<<25|H>>>7)^(H<<14|H>>>18)^H>>>3)+v[B-7]+((w<<15|w>>>17)^(w<<13|w>>>19)^w>>>10)+v[B-16]}H=M+((_<<26|_>>>6)^(_<<21|_>>>11)^(_<<7|_>>>25))+(_&R^~_&S)+s[B]+v[B],w=((A<<30|A>>>2)^(A<<19|A>>>13)^(A<<10|A>>>22))+(A&E^A&b^E&b),M=S,S=R,R=_,_=T+H|0,T=b,b=E,E=A,A=H+w|0}y[0]=y[0]+A|0,y[1]=y[1]+E|0,y[2]=y[2]+b|0,y[3]=y[3]+T|0,y[4]=y[4]+_|0,y[5]=y[5]+R|0,y[6]=y[6]+S|0,y[7]=y[7]+M|0},_doFinalize:function(){var h=this._data,m=h.words,y=8*this._nDataBytes,A=8*h.sigBytes;return m[A>>>5]|=128<<24-A%32,m[(A+64>>>9<<4)+14]=n.floor(y/4294967296),m[(A+64>>>9<<4)+15]=y,h.sigBytes=4*m.length,this._process(),this._hash},clone:function(){var h=r.clone.call(this);return h._hash=this._hash.clone(),h}});t.SHA256=r._createHelper(g),t.HmacSHA256=r._createHmacHelper(g)})(Math),CryptoJS.lib.Cipher||function(n){var g=CryptoJS,t=g.lib,e=t.Base,r=t.WordArray,o=t.BufferedBlockAlgorithm,s=g.enc.Base64,u=g.algo.EvpKDF,l=t.Cipher=o.extend({cfg:e.extend(),createEncryptor:function(m,y){return this.create(this._ENC_XFORM_MODE,m,y)},createDecryptor:function(m,y){return this.create(this._DEC_XFORM_MODE,m,y)},init:function(m,y,A){this.cfg=this.cfg.extend(A),this._xformMode=m,this._key=y,this.reset()},reset:function(){o.reset.call(this),this._doReset()},process:function(m){return this._append(m),this._process()},finalize:function(m){return m&&this._append(m),this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(m){return{encrypt:function(y,A,E){return(typeof A=="string"?h:v).encrypt(m,y,A,E)},decrypt:function(y,A,E){return(typeof A=="string"?h:v).decrypt(m,y,A,E)}}}});t.StreamCipher=l.extend({_doFinalize:function(){return this._process(!0)},blockSize:1});var p=g.mode={},c=function(m,y,A){var E=this._iv;E?this._iv=n:E=this._prevBlock;for(var b=0;b<A;b++)m[y+b]^=E[b]},f=(t.BlockCipherMode=e.extend({createEncryptor:function(m,y){return this.Encryptor.create(m,y)},createDecryptor:function(m,y){return this.Decryptor.create(m,y)},init:function(m,y){this._cipher=m,this._iv=y}})).extend();f.Encryptor=f.extend({processBlock:function(m,y){var A=this._cipher,E=A.blockSize;c.call(this,m,y,E),A.encryptBlock(m,y),this._prevBlock=m.slice(y,y+E)}}),f.Decryptor=f.extend({processBlock:function(m,y){var A=this._cipher,E=A.blockSize,b=m.slice(y,y+E);A.decryptBlock(m,y),c.call(this,m,y,E),this._prevBlock=b}}),p=p.CBC=f,f=(g.pad={}).Pkcs7={pad:function(m,y){for(var A=4*y,A=A-m.sigBytes%A,E=A<<24|A<<16|A<<8|A,b=[],T=0;T<A;T+=4)b.push(E);A=r.create(b,A),m.concat(A)},unpad:function(m){m.sigBytes-=m.words[m.sigBytes-1>>>2]&255}},t.BlockCipher=l.extend({cfg:l.cfg.extend({mode:p,padding:f}),reset:function(){l.reset.call(this);var y=this.cfg,m=y.iv,y=y.mode;if(this._xformMode==this._ENC_XFORM_MODE)var A=y.createEncryptor;else A=y.createDecryptor,this._minBufferSize=1;this._mode=A.call(y,this,m&&m.words)},_doProcessBlock:function(m,y){this._mode.processBlock(m,y)},_doFinalize:function(){var m=this.cfg.padding;if(this._xformMode==this._ENC_XFORM_MODE){m.pad(this._data,this.blockSize);var y=this._process(!0)}else y=this._process(!0),m.unpad(y);return y},blockSize:4});var d=t.CipherParams=e.extend({init:function(m){this.mixIn(m)},toString:function(m){return(m||this.formatter).stringify(this)}}),p=(g.format={}).OpenSSL={stringify:function(m){var y=m.ciphertext;return m=m.salt,(m?r.create([1398893684,1701076831]).concat(m).concat(y):y).toString(s)},parse:function(m){m=s.parse(m);var y=m.words;if(y[0]==1398893684&&y[1]==1701076831){var A=r.create(y.slice(2,4));y.splice(0,4),m.sigBytes-=16}return d.create({ciphertext:m,salt:A})}},v=t.SerializableCipher=e.extend({cfg:e.extend({format:p}),encrypt:function(m,y,A,E){E=this.cfg.extend(E);var b=m.createEncryptor(A,E);return y=b.finalize(y),b=b.cfg,d.create({ciphertext:y,key:A,iv:b.iv,algorithm:m,mode:b.mode,padding:b.padding,blockSize:m.blockSize,formatter:E.format})},decrypt:function(m,y,A,E){return E=this.cfg.extend(E),y=this._parse(y,E.format),m.createDecryptor(A,E).finalize(y.ciphertext)},_parse:function(m,y){return typeof m=="string"?y.parse(m,this):m}}),g=(g.kdf={}).OpenSSL={execute:function(m,y,A,E){return E||(E=r.random(8)),m=u.create({keySize:y+A}).compute(m,E),A=r.create(m.words.slice(y),4*A),m.sigBytes=4*y,d.create({key:m,iv:A,salt:E})}},h=t.PasswordBasedCipher=v.extend({cfg:v.cfg.extend({kdf:g}),encrypt:function(m,y,A,E){return E=this.cfg.extend(E),A=E.kdf.execute(A,m.keySize,m.ivSize),E.iv=A.iv,m=v.encrypt.call(this,m,y,A.key,E),m.mixIn(A),m},decrypt:function(m,y,A,E){return E=this.cfg.extend(E),y=this._parse(y,E.format),A=E.kdf.execute(A,m.keySize,m.ivSize,y.salt),E.iv=A.iv,v.decrypt.call(this,m,y,A.key,E)}})}(),function(){for(var n=CryptoJS,t=n.lib.BlockCipher,R=n.algo,e=[],r=[],o=[],s=[],u=[],l=[],c=[],f=[],d=[],p=[],v=[],g=0;256>g;g++)v[g]=128>g?g<<1:g<<1^283;for(var h=0,m=0,g=0;256>g;g++){var y=m^m<<1^m<<2^m<<3^m<<4,y=y>>>8^y&255^99;e[h]=y,r[y]=h;var A=v[h],E=v[A],b=v[E],T=257*v[y]^16843008*y;o[h]=T<<24|T>>>8,s[h]=T<<16|T>>>16,u[h]=T<<8|T>>>24,l[h]=T,T=16843009*b^65537*E^257*A^16843008*h,c[y]=T<<24|T>>>8,f[y]=T<<16|T>>>16,d[y]=T<<8|T>>>24,p[y]=T,h?(h=A^v[v[v[b^A]]],m^=v[v[m]]):h=m=1}var _=[0,1,2,4,8,16,32,64,128,27,54],R=R.AES=t.extend({_doReset:function(){for(var B=this._key,S=B.words,M=B.sigBytes/4,B=4*((this._nRounds=M+6)+1),H=this._keySchedule=[],w=0;w<B;w++)if(w<M)H[w]=S[w];else{var C=H[w-1];w%M?6<M&&w%M==4&&(C=e[C>>>24]<<24|e[C>>>16&255]<<16|e[C>>>8&255]<<8|e[C&255]):(C=C<<8|C>>>24,C=e[C>>>24]<<24|e[C>>>16&255]<<16|e[C>>>8&255]<<8|e[C&255],C^=_[w/M|0]<<24),H[w]=H[w-M]^C}for(S=this._invKeySchedule=[],M=0;M<B;M++)w=B-M,C=M%4?H[w]:H[w-4],S[M]=4>M||4>=w?C:c[e[C>>>24]]^f[e[C>>>16&255]]^d[e[C>>>8&255]]^p[e[C&255]]},encryptBlock:function(S,M){this._doCryptBlock(S,M,this._keySchedule,o,s,u,l,e)},decryptBlock:function(S,M){var B=S[M+1];S[M+1]=S[M+3],S[M+3]=B,this._doCryptBlock(S,M,this._invKeySchedule,c,f,d,p,r),B=S[M+1],S[M+1]=S[M+3],S[M+3]=B},_doCryptBlock:function(S,M,B,H,w,C,L,I){for(var F=this._nRounds,q=S[M]^B[0],K=S[M+1]^B[1],j=S[M+2]^B[2],G=S[M+3]^B[3],k=4,N=1;N<F;N++)var D=H[q>>>24]^w[K>>>16&255]^C[j>>>8&255]^L[G&255]^B[k++],U=H[K>>>24]^w[j>>>16&255]^C[G>>>8&255]^L[q&255]^B[k++],z=H[j>>>24]^w[G>>>16&255]^C[q>>>8&255]^L[K&255]^B[k++],G=H[G>>>24]^w[q>>>16&255]^C[K>>>8&255]^L[j&255]^B[k++],q=D,K=U,j=z;D=(I[q>>>24]<<24|I[K>>>16&255]<<16|I[j>>>8&255]<<8|I[G&255])^B[k++],U=(I[K>>>24]<<24|I[j>>>16&255]<<16|I[G>>>8&255]<<8|I[q&255])^B[k++],z=(I[j>>>24]<<24|I[G>>>16&255]<<16|I[q>>>8&255]<<8|I[K&255])^B[k++],G=(I[G>>>24]<<24|I[q>>>16&255]<<16|I[K>>>8&255]<<8|I[j&255])^B[k++],S[M]=D,S[M+1]=U,S[M+2]=z,S[M+3]=G},keySize:8});n.AES=t._createHelper(R)}();/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/
|
|
343
343
|
*/var dbits;function BigInteger(n,t,e){n!=null&&(typeof n=="number"?this.fromNumber(n,t,e):t==null&&typeof n!="string"?this.fromString(n,256):this.fromString(n,t))}function nbi(){return new BigInteger(null)}function am1(n,t,e,r,o,s){for(;--s>=0;){var u=t*this[n++]+e[r]+o;o=Math.floor(u/67108864),e[r++]=u&67108863}return o}function am2(n,t,e,r,o,s){for(var u=t&32767,l=t>>15;--s>=0;){var c=this[n]&32767,f=this[n++]>>15,d=l*c+f*u;c=u*c+((d&32767)<<15)+e[r]+(o&1073741823),o=(c>>>30)+(d>>>15)+l*f+(o>>>30),e[r++]=c&1073741823}return o}function am3(n,t,e,r,o,s){for(var u=t&16383,l=t>>14;--s>=0;){var c=this[n]&16383,f=this[n++]>>14,d=l*c+f*u;c=u*c+((d&16383)<<14)+e[r]+o,o=(c>>28)+(d>>14)+l*f,e[r++]=c&268435455}return o}typeof navigator!="undefined"&&navigator.appName=="Microsoft Internet Explorer"?(BigInteger.prototype.am=am2,dbits=30):typeof navigator!="undefined"&&navigator.appName!="Netscape"?(BigInteger.prototype.am=am1,dbits=26):(BigInteger.prototype.am=am3,dbits=28),BigInteger.prototype.DB=dbits,BigInteger.prototype.DM=(1<<dbits)-1,BigInteger.prototype.DV=1<<dbits;var BI_FP=52;BigInteger.prototype.FV=Math.pow(2,BI_FP),BigInteger.prototype.F1=BI_FP-dbits,BigInteger.prototype.F2=2*dbits-BI_FP;var BI_RM="0123456789abcdefghijklmnopqrstuvwxyz",BI_RC=new Array,rr,vv;for(rr=48,vv=0;vv<=9;++vv)BI_RC[rr++]=vv;for(rr=97,vv=10;vv<36;++vv)BI_RC[rr++]=vv;for(rr=65,vv=10;vv<36;++vv)BI_RC[rr++]=vv;function int2char(n){return BI_RM.charAt(n)}function intAt(n,t){var e=BI_RC[n.charCodeAt(t)];return e==null?-1:e}function bnpCopyTo(n){for(var t=this.t-1;t>=0;--t)n[t]=this[t];n.t=this.t,n.s=this.s}function bnpFromInt(n){this.t=1,this.s=n<0?-1:0,n>0?this[0]=n:n<-1?this[0]=n+this.DV:this.t=0}function nbv(n){var t=nbi();return t.fromInt(n),t}function bnpFromString(n,t){var e;if(t==16)e=4;else if(t==8)e=3;else if(t==256)e=8;else if(t==2)e=1;else if(t==32)e=5;else if(t==4)e=2;else{this.fromRadix(n,t);return}this.t=0,this.s=0;for(var r=n.length,o=!1,s=0;--r>=0;){var u=e==8?n[r]&255:intAt(n,r);if(u<0){n.charAt(r)=="-"&&(o=!0);continue}o=!1,s==0?this[this.t++]=u:s+e>this.DB?(this[this.t-1]|=(u&(1<<this.DB-s)-1)<<s,this[this.t++]=u>>this.DB-s):this[this.t-1]|=u<<s,s+=e,s>=this.DB&&(s-=this.DB)}e==8&&n[0]&128&&(this.s=-1,s>0&&(this[this.t-1]|=(1<<this.DB-s)-1<<s)),this.clamp(),o&&BigInteger.ZERO.subTo(this,this)}function bnpClamp(){for(var n=this.s&this.DM;this.t>0&&this[this.t-1]==n;)--this.t}function bnToString(n){if(this.s<0)return"-"+this.negate().toString(n);var t;if(n==16)t=4;else if(n==8)t=3;else if(n==2)t=1;else if(n==32)t=5;else if(n==4)t=2;else return this.toRadix(n);var e=(1<<t)-1,r,o=!1,s="",u=this.t,l=this.DB-u*this.DB%t;if(u-- >0)for(l<this.DB&&(r=this[u]>>l)>0&&(o=!0,s=int2char(r));u>=0;)l<t?(r=(this[u]&(1<<l)-1)<<t-l,r|=this[--u]>>(l+=this.DB-t)):(r=this[u]>>(l-=t)&e,l<=0&&(l+=this.DB,--u)),r>0&&(o=!0),o&&(s+=int2char(r));return o?s:"0"}function bnNegate(){var n=nbi();return BigInteger.ZERO.subTo(this,n),n}function bnAbs(){return this.s<0?this.negate():this}function bnCompareTo(n){var t=this.s-n.s;if(t!=0)return t;var e=this.t;if(t=e-n.t,t!=0)return this.s<0?-t:t;for(;--e>=0;)if((t=this[e]-n[e])!=0)return t;return 0}function nbits(n){var t=1,e;return(e=n>>>16)!=0&&(n=e,t+=16),(e=n>>8)!=0&&(n=e,t+=8),(e=n>>4)!=0&&(n=e,t+=4),(e=n>>2)!=0&&(n=e,t+=2),(e=n>>1)!=0&&(n=e,t+=1),t}function bnBitLength(){return this.t<=0?0:this.DB*(this.t-1)+nbits(this[this.t-1]^this.s&this.DM)}function bnpDLShiftTo(n,t){var e;for(e=this.t-1;e>=0;--e)t[e+n]=this[e];for(e=n-1;e>=0;--e)t[e]=0;t.t=this.t+n,t.s=this.s}function bnpDRShiftTo(n,t){for(var e=n;e<this.t;++e)t[e-n]=this[e];t.t=Math.max(this.t-n,0),t.s=this.s}function bnpLShiftTo(n,t){var e=n%this.DB,r=this.DB-e,o=(1<<r)-1,s=Math.floor(n/this.DB),u=this.s<<e&this.DM,l;for(l=this.t-1;l>=0;--l)t[l+s+1]=this[l]>>r|u,u=(this[l]&o)<<e;for(l=s-1;l>=0;--l)t[l]=0;t[s]=u,t.t=this.t+s+1,t.s=this.s,t.clamp()}function bnpRShiftTo(n,t){t.s=this.s;var e=Math.floor(n/this.DB);if(e>=this.t){t.t=0;return}var r=n%this.DB,o=this.DB-r,s=(1<<r)-1;t[0]=this[e]>>r;for(var u=e+1;u<this.t;++u)t[u-e-1]|=(this[u]&s)<<o,t[u-e]=this[u]>>r;r>0&&(t[this.t-e-1]|=(this.s&s)<<o),t.t=this.t-e,t.clamp()}function bnpSubTo(n,t){for(var e=0,r=0,o=Math.min(n.t,this.t);e<o;)r+=this[e]-n[e],t[e++]=r&this.DM,r>>=this.DB;if(n.t<this.t){for(r-=n.s;e<this.t;)r+=this[e],t[e++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;e<n.t;)r-=n[e],t[e++]=r&this.DM,r>>=this.DB;r-=n.s}t.s=r<0?-1:0,r<-1?t[e++]=this.DV+r:r>0&&(t[e++]=r),t.t=e,t.clamp()}function bnpMultiplyTo(n,t){var e=this.abs(),r=n.abs(),o=e.t;for(t.t=o+r.t;--o>=0;)t[o]=0;for(o=0;o<r.t;++o)t[o+e.t]=e.am(0,r[o],t,o,0,e.t);t.s=0,t.clamp(),this.s!=n.s&&BigInteger.ZERO.subTo(t,t)}function bnpSquareTo(n){for(var t=this.abs(),e=n.t=2*t.t;--e>=0;)n[e]=0;for(e=0;e<t.t-1;++e){var r=t.am(e,t[e],n,2*e,0,1);(n[e+t.t]+=t.am(e+1,2*t[e],n,2*e+1,r,t.t-e-1))>=t.DV&&(n[e+t.t]-=t.DV,n[e+t.t+1]=1)}n.t>0&&(n[n.t-1]+=t.am(e,t[e],n,2*e,0,1)),n.s=0,n.clamp()}function bnpDivRemTo(n,t,e){var r=n.abs();if(!(r.t<=0)){var o=this.abs();if(o.t<r.t){t!=null&&t.fromInt(0),e!=null&&this.copyTo(e);return}e==null&&(e=nbi());var s=nbi(),u=this.s,l=n.s,c=this.DB-nbits(r[r.t-1]);c>0?(r.lShiftTo(c,s),o.lShiftTo(c,e)):(r.copyTo(s),o.copyTo(e));var f=s.t,d=s[f-1];if(d!=0){var p=d*(1<<this.F1)+(f>1?s[f-2]>>this.F2:0),v=this.FV/p,g=(1<<this.F1)/p,h=1<<this.F2,m=e.t,y=m-f,A=t==null?nbi():t;for(s.dlShiftTo(y,A),e.compareTo(A)>=0&&(e[e.t++]=1,e.subTo(A,e)),BigInteger.ONE.dlShiftTo(f,A),A.subTo(s,s);s.t<f;)s[s.t++]=0;for(;--y>=0;){var E=e[--m]==d?this.DM:Math.floor(e[m]*v+(e[m-1]+h)*g);if((e[m]+=s.am(0,E,e,y,0,f))<E)for(s.dlShiftTo(y,A),e.subTo(A,e);e[m]<--E;)e.subTo(A,e)}t!=null&&(e.drShiftTo(f,t),u!=l&&BigInteger.ZERO.subTo(t,t)),e.t=f,e.clamp(),c>0&&e.rShiftTo(c,e),u<0&&BigInteger.ZERO.subTo(e,e)}}}function bnMod(n){var t=nbi();return this.abs().divRemTo(n,null,t),this.s<0&&t.compareTo(BigInteger.ZERO)>0&&n.subTo(t,t),t}function Classic(n){this.m=n}function cConvert(n){return n.s<0||n.compareTo(this.m)>=0?n.mod(this.m):n}function cRevert(n){return n}function cReduce(n){n.divRemTo(this.m,null,n)}function cMulTo(n,t,e){n.multiplyTo(t,e),this.reduce(e)}function cSqrTo(n,t){n.squareTo(t),this.reduce(t)}Classic.prototype.convert=cConvert,Classic.prototype.revert=cRevert,Classic.prototype.reduce=cReduce,Classic.prototype.mulTo=cMulTo,Classic.prototype.sqrTo=cSqrTo;function bnpInvDigit(){if(this.t<1)return 0;var n=this[0];if(!(n&1))return 0;var t=n&3;return t=t*(2-(n&15)*t)&15,t=t*(2-(n&255)*t)&255,t=t*(2-((n&65535)*t&65535))&65535,t=t*(2-n*t%this.DV)%this.DV,t>0?this.DV-t:-t}function Montgomery(n){this.m=n,this.mp=n.invDigit(),this.mpl=this.mp&32767,this.mph=this.mp>>15,this.um=(1<<n.DB-15)-1,this.mt2=2*n.t}function montConvert(n){var t=nbi();return n.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),n.s<0&&t.compareTo(BigInteger.ZERO)>0&&this.m.subTo(t,t),t}function montRevert(n){var t=nbi();return n.copyTo(t),this.reduce(t),t}function montReduce(n){for(;n.t<=this.mt2;)n[n.t++]=0;for(var t=0;t<this.m.t;++t){var e=n[t]&32767,r=e*this.mpl+((e*this.mph+(n[t]>>15)*this.mpl&this.um)<<15)&n.DM;for(e=t+this.m.t,n[e]+=this.m.am(0,r,n,t,0,this.m.t);n[e]>=n.DV;)n[e]-=n.DV,n[++e]++}n.clamp(),n.drShiftTo(this.m.t,n),n.compareTo(this.m)>=0&&n.subTo(this.m,n)}function montSqrTo(n,t){n.squareTo(t),this.reduce(t)}function montMulTo(n,t,e){n.multiplyTo(t,e),this.reduce(e)}Montgomery.prototype.convert=montConvert,Montgomery.prototype.revert=montRevert,Montgomery.prototype.reduce=montReduce,Montgomery.prototype.mulTo=montMulTo,Montgomery.prototype.sqrTo=montSqrTo;function bnpIsEven(){return(this.t>0?this[0]&1:this.s)==0}function bnpExp(n,t){if(n>4294967295||n<1)return BigInteger.ONE;var e=nbi(),r=nbi(),o=t.convert(this),s=nbits(n)-1;for(o.copyTo(e);--s>=0;)if(t.sqrTo(e,r),(n&1<<s)>0)t.mulTo(r,o,e);else{var u=e;e=r,r=u}return t.revert(e)}function bnModPowInt(n,t){var e;return n<256||t.isEven()?e=new Classic(t):e=new Montgomery(t),this.exp(n,e)}BigInteger.prototype.copyTo=bnpCopyTo,BigInteger.prototype.fromInt=bnpFromInt,BigInteger.prototype.fromString=bnpFromString,BigInteger.prototype.clamp=bnpClamp,BigInteger.prototype.dlShiftTo=bnpDLShiftTo,BigInteger.prototype.drShiftTo=bnpDRShiftTo,BigInteger.prototype.lShiftTo=bnpLShiftTo,BigInteger.prototype.rShiftTo=bnpRShiftTo,BigInteger.prototype.subTo=bnpSubTo,BigInteger.prototype.multiplyTo=bnpMultiplyTo,BigInteger.prototype.squareTo=bnpSquareTo,BigInteger.prototype.divRemTo=bnpDivRemTo,BigInteger.prototype.invDigit=bnpInvDigit,BigInteger.prototype.isEven=bnpIsEven,BigInteger.prototype.exp=bnpExp,BigInteger.prototype.toString=bnToString,BigInteger.prototype.negate=bnNegate,BigInteger.prototype.abs=bnAbs,BigInteger.prototype.compareTo=bnCompareTo,BigInteger.prototype.bitLength=bnBitLength,BigInteger.prototype.mod=bnMod,BigInteger.prototype.modPowInt=bnModPowInt,BigInteger.ZERO=nbv(0),BigInteger.ONE=nbv(1);/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/ */function bnIntValue(){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];if(this.t==0)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]}function bnpChunkSize(n){return Math.floor(Math.LN2*this.DB/Math.log(n))}function bnSigNum(){return this.s<0?-1:this.t<=0||this.t==1&&this[0]<=0?0:1}function bnpToRadix(n){if(n==null&&(n=10),this.signum()==0||n<2||n>36)return"0";var t=this.chunkSize(n),e=Math.pow(n,t),r=nbv(e),o=nbi(),s=nbi(),u="";for(this.divRemTo(r,o,s);o.signum()>0;)u=(e+s.intValue()).toString(n).substr(1)+u,o.divRemTo(r,o,s);return s.intValue().toString(n)+u}BigInteger.prototype.chunkSize=bnpChunkSize,BigInteger.prototype.toRadix=bnpToRadix,BigInteger.prototype.intValue=bnIntValue,BigInteger.prototype.signum=bnSigNum;/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/ */var b64map="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",b64pad="=";function hex2b64(n){var t,e,r="";for(t=0;t+3<=n.length;t+=3)e=parseInt(n.substring(t,t+3),16),r+=b64map.charAt(e>>6)+b64map.charAt(e&63);for(t+1==n.length?(e=parseInt(n.substring(t,t+1),16),r+=b64map.charAt(e<<2)):t+2==n.length&&(e=parseInt(n.substring(t,t+2),16),r+=b64map.charAt(e>>2)+b64map.charAt((e&3)<<4));(r.length&3)>0;)r+=b64pad;return r}function b64tohex(n){var t="",e,r=0,o,s;for(e=0;e<n.length&&n.charAt(e)!=b64pad;++e)s=b64map.indexOf(n.charAt(e)),!(s<0)&&(r==0?(t+=int2char(s>>2),o=s&3,r=1):r==1?(t+=int2char(o<<2|s>>4),o=s&15,r=2):r==2?(t+=int2char(o),t+=int2char(s>>2),o=s&3,r=3):(t+=int2char(o<<2|s>>4),t+=int2char(s&15),r=0));return r==1&&(t+=int2char(o<<2)),t}/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/ */function parseBigInt(n,t){return new BigInteger(n,t)}function pkcs1pad2(n,t){if(t<n.length+11)throw"Message too long for RSA";for(var e=new Array,r=n.length-1;r>=0&&t>0;){var o=n.charCodeAt(r--);o<128?e[--t]=o:o>127&&o<2048?(e[--t]=o&63|128,e[--t]=o>>6|192):(e[--t]=o&63|128,e[--t]=o>>6&63|128,e[--t]=o>>12|224)}e[--t]=0;for(var s=new SecureRandom,u=new Array;t>2;){for(u[0]=0;u[0]==0;)s.nextBytes(u);e[--t]=u[0]}return e[--t]=2,e[--t]=0,new BigInteger(e)}function oaep_mgf1_arr(n,t,e){for(var r="",o=0;r.length<t;)r+=e(String.fromCharCode.apply(String,n.concat([(o&4278190080)>>24,(o&16711680)>>16,(o&65280)>>8,o&255]))),o+=1;return r}function oaep_pad(n,t,e,r){var o=KJUR.crypto.MessageDigest,s=KJUR.crypto.Util,u=null;if(e||(e="sha1"),typeof e=="string"&&(u=o.getCanonicalAlgName(e),r=o.getHashLength(u),e=function(m){return hextorstr(s.hashHex(rstrtohex(m),u))}),n.length+2*r+2>t)throw"Message too long for RSA";var l="",c;for(c=0;c<t-n.length-2*r-2;c+=1)l+="\0";var f=e("")+l+""+n,d=new Array(r);new SecureRandom().nextBytes(d);var p=oaep_mgf1_arr(d,f.length,e),v=[];for(c=0;c<f.length;c+=1)v[c]=f.charCodeAt(c)^p.charCodeAt(c);var g=oaep_mgf1_arr(v,d.length,e),h=[0];for(c=0;c<d.length;c+=1)h[c+1]=d[c]^g.charCodeAt(c);return new BigInteger(h.concat(v))}function RSAKey(){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 RSASetPublic(n,t){if(this.isPublic=!0,this.isPrivate=!1,typeof n!="string")this.n=n,this.e=t;else if(n!=null&&t!=null&&n.length>0&&t.length>0)this.n=parseBigInt(n,16),this.e=parseInt(t,16);else throw"Invalid RSA public key"}function RSADoPublic(n){return n.modPowInt(this.e,this.n)}function RSAEncrypt(n){var t=pkcs1pad2(n,this.n.bitLength()+7>>3);if(t==null)return null;var e=this.doPublic(t);if(e==null)return null;var r=e.toString(16);return r.length&1?"0"+r:r}function RSAEncryptOAEP(n,t,e){var r=oaep_pad(n,this.n.bitLength()+7>>3,t,e);if(r==null)return null;var o=this.doPublic(r);if(o==null)return null;var s=o.toString(16);return s.length&1?"0"+s:s}RSAKey.prototype.doPublic=RSADoPublic,RSAKey.prototype.setPublic=RSASetPublic,RSAKey.prototype.encrypt=RSAEncrypt,RSAKey.prototype.encryptOAEP=RSAEncryptOAEP,RSAKey.prototype.type="RSA";/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/ */function pkcs1unpad2(n,t){for(var e=n.toByteArray(),r=0;r<e.length&&e[r]==0;)++r;if(e.length-r!=t-1||e[r]!=2)return null;for(++r;e[r]!=0;)if(++r>=e.length)return null;for(var o="";++r<e.length;){var s=e[r]&255;s<128?o+=String.fromCharCode(s):s>191&&s<224?(o+=String.fromCharCode((s&31)<<6|e[r+1]&63),++r):(o+=String.fromCharCode((s&15)<<12|(e[r+1]&63)<<6|e[r+2]&63),r+=2)}return o}function oaep_mgf1_str(n,t,e){for(var r="",o=0;r.length<t;)r+=e(n+String.fromCharCode.apply(String,[(o&4278190080)>>24,(o&16711680)>>16,(o&65280)>>8,o&255])),o+=1;return r}function oaep_unpad(n,t,e,r){var o=KJUR.crypto.MessageDigest,s=KJUR.crypto.Util,u=null;e||(e="sha1"),typeof e=="string"&&(u=o.getCanonicalAlgName(e),r=o.getHashLength(u),e=function(y){return hextorstr(s.hashHex(rstrtohex(y),u))}),n=n.toByteArray();var p;for(p=0;p<n.length;p+=1)n[p]&=255;for(;n.length<t;)n.unshift(0);if(n=String.fromCharCode.apply(String,n),n.length<2*r+2)throw"Cipher too short";var l=n.substr(1,r),c=n.substr(r+1),f=oaep_mgf1_str(c,r,e),d=[],p;for(p=0;p<l.length;p+=1)d[p]=l.charCodeAt(p)^f.charCodeAt(p);var v=oaep_mgf1_str(String.fromCharCode.apply(String,d),n.length-r,e),g=[];for(p=0;p<c.length;p+=1)g[p]=c.charCodeAt(p)^v.charCodeAt(p);if(g=String.fromCharCode.apply(String,g),g.substr(0,r)!==e(""))throw"Hash mismatch";g=g.substr(r);var h=g.indexOf(""),m=h!=-1?g.substr(0,h).lastIndexOf("\0"):-1;if(m+1!=h)throw"Malformed data";return g.substr(h+1)}function RSASetPrivate(n,t,e){if(this.isPrivate=!0,typeof n!="string")this.n=n,this.e=t,this.d=e;else if(n!=null&&t!=null&&n.length>0&&t.length>0)this.n=parseBigInt(n,16),this.e=parseInt(t,16),this.d=parseBigInt(e,16);else throw"Invalid RSA private key"}function RSASetPrivateEx(n,t,e,r,o,s,u,l){if(this.isPrivate=!0,this.isPublic=!1,n==null)throw"RSASetPrivateEx N == null";if(t==null)throw"RSASetPrivateEx E == null";if(n.length==0)throw"RSASetPrivateEx N.length == 0";if(t.length==0)throw"RSASetPrivateEx E.length == 0";if(n!=null&&t!=null&&n.length>0&&t.length>0)this.n=parseBigInt(n,16),this.e=parseInt(t,16),this.d=parseBigInt(e,16),this.p=parseBigInt(r,16),this.q=parseBigInt(o,16),this.dmp1=parseBigInt(s,16),this.dmq1=parseBigInt(u,16),this.coeff=parseBigInt(l,16);else throw"Invalid RSA private key in RSASetPrivateEx"}function RSADoPrivate(n){if(this.p==null||this.q==null)return n.modPow(this.d,this.n);for(var t=n.mod(this.p).modPow(this.dmp1,this.p),e=n.mod(this.q).modPow(this.dmq1,this.q);t.compareTo(e)<0;)t=t.add(this.p);return t.subtract(e).multiply(this.coeff).mod(this.p).multiply(this.q).add(e)}function RSADecrypt(n){if(n.length!=Math.ceil(this.n.bitLength()/4))throw new Error("wrong ctext length");var t=parseBigInt(n,16),e=this.doPrivate(t);return e==null?null:pkcs1unpad2(e,this.n.bitLength()+7>>3)}function RSADecryptOAEP(n,t,e){if(n.length!=Math.ceil(this.n.bitLength()/4))throw new Error("wrong ctext length");var r=parseBigInt(n,16),o=this.doPrivate(r);return o==null?null:oaep_unpad(o,this.n.bitLength()+7>>3,t,e)}RSAKey.prototype.doPrivate=RSADoPrivate,RSAKey.prototype.setPrivate=RSASetPrivate,RSAKey.prototype.setPrivateEx=RSASetPrivateEx,RSAKey.prototype.decrypt=RSADecrypt,RSAKey.prototype.decryptOAEP=RSADecryptOAEP,(typeof KJUR.lang=="undefined"||!KJUR.lang)&&(KJUR.lang={}),KJUR.lang.String=function(){};function b64utob64(n){return n.length%4==2?n=n+"==":n.length%4==3&&(n=n+"="),n=n.replace(/-/g,"+"),n=n.replace(/_/g,"/"),n}function b64utohex(n){return b64tohex(b64utob64(n))}function hextoutf8(n){return decodeURIComponent(hextouricmp(n))}function hextorstr(n){for(var t="",e=0;e<n.length-1;e+=2)t+=String.fromCharCode(parseInt(n.substr(e,2),16));return t}function rstrtohex(n){for(var t="",e=0;e<n.length;e++)t+=("0"+n.charCodeAt(e).toString(16)).slice(-2);return t}function hextob64(n){return hex2b64(n)}function hextob64nl(n){var t=hextob64(n),e=t.replace(/(.{64})/g,`$1\r
|
|
344
344
|
`);return e=e.replace(/\r\n$/,""),e}function b64nltohex(n){var t=n.replace(/[^0-9A-Za-z\/+=]*/g,""),e=b64tohex(t);return e}function hextopem(n,t){var e=hextob64nl(n);return"-----BEGIN "+t+`-----\r
|
|
345
345
|
`+e+`\r
|
|
@@ -359,12 +359,12 @@
|
|
|
359
359
|
`,B+=`\r
|
|
360
360
|
`,B+=M,B+=`\r
|
|
361
361
|
-----END `+h+` PRIVATE KEY-----\r
|
|
362
|
-
`,B},parseHexOfEncryptedPKCS8:function(h){var m=ASN1HEX,y=m.getChildIdx,A=m.getV,E={},b=y(h,0);if(b.length!=2)throw"malformed format: SEQUENCE(0).items != 2: "+b.length;E.ciphertext=A(h,b[1]);var T=y(h,b[0]);if(T.length!=2)throw"malformed format: SEQUENCE(0.0).items != 2: "+T.length;if(A(h,T[0])!="2a864886f70d01050d")throw"this only supports pkcs5PBES2";var _=y(h,T[1]);if(T.length!=2)throw"malformed format: SEQUENCE(0.0.1).items != 2: "+_.length;var R=y(h,_[1]);if(R.length!=2)throw"malformed format: SEQUENCE(0.0.1.1).items != 2: "+R.length;if(A(h,R[0])!="2a864886f70d0307")throw"this only supports TripleDES";E.encryptionSchemeAlg="TripleDES",E.encryptionSchemeIV=A(h,R[1]);var S=y(h,_[0]);if(S.length!=2)throw"malformed format: SEQUENCE(0.0.1.0).items != 2: "+S.length;if(A(h,S[0])!="2a864886f70d01050c")throw"this only supports pkcs5PBKDF2";var M=y(h,S[1]);if(M.length<2)throw"malformed format: SEQUENCE(0.0.1.0.1).items < 2: "+M.length;E.pbkdf2Salt=A(h,M[0]);var B=A(h,M[1]);try{E.pbkdf2Iter=parseInt(B,16)}catch(H){throw"malformed format pbkdf2Iter: "+B}return E},getPBKDF2KeyHexFromParam:function(h,m){var y=CryptoJS.enc.Hex.parse(h.pbkdf2Salt),A=h.pbkdf2Iter,E=CryptoJS.PBKDF2(m,y,{keySize:192/32,iterations:A}),b=CryptoJS.enc.Hex.stringify(E);return b},_getPlainPKCS8HexFromEncryptedPKCS8PEM:function(h,m){var y=pemtohex(h,"ENCRYPTED PRIVATE KEY"),A=this.parseHexOfEncryptedPKCS8(y),E=KEYUTIL.getPBKDF2KeyHexFromParam(A,m),b={};b.ciphertext=CryptoJS.enc.Hex.parse(A.ciphertext);var T=CryptoJS.enc.Hex.parse(E),_=CryptoJS.enc.Hex.parse(A.encryptionSchemeIV),R=CryptoJS.TripleDES.decrypt(b,T,{iv:_}),S=CryptoJS.enc.Hex.stringify(R);return S},getKeyFromEncryptedPKCS8PEM:function(h,m){var y=this._getPlainPKCS8HexFromEncryptedPKCS8PEM(h,m),A=this.getKeyFromPlainPrivatePKCS8Hex(y);return A},parsePlainPrivatePKCS8Hex:function(h){var m=ASN1HEX,y=m.getChildIdx,A=m.getV,E={};if(E.algparam=null,h.substr(0,2)!="30")throw new Error("malformed plain PKCS8 private key(code:001)");var b=y(h,0);if(b.length<3)throw new Error("malformed plain PKCS8 private key(code:002)");if(h.substr(b[1],2)!="30")throw new Error("malformed PKCS8 private key(code:003)");var T=y(h,b[1]);if(T.length!=2)throw new Error("malformed PKCS8 private key(code:004)");if(h.substr(T[0],2)!="06")throw new Error("malformed PKCS8 private key(code:005)");if(E.algoid=A(h,T[0]),h.substr(T[1],2)=="06"&&(E.algparam=A(h,T[1])),h.substr(b[2],2)!="04")throw new Error("malformed PKCS8 private key(code:006)");return E.keyidx=m.getVidx(h,b[2]),E},getKeyFromPlainPrivatePKCS8PEM:function(h){var m=pemtohex(h,"PRIVATE KEY"),y=this.getKeyFromPlainPrivatePKCS8Hex(m);return y},getKeyFromPlainPrivatePKCS8Hex:function(h){var m=this.parsePlainPrivatePKCS8Hex(h),y;if(m.algoid=="2a864886f70d010101")y=new RSAKey;else if(KJUR.crypto.DSA&&m.algoid=="2a8648ce380401")y=new KJUR.crypto.DSA;else if(KJUR.crypto.ECDSA&&m.algoid=="2a8648ce3d0201")y=new KJUR.crypto.ECDSA;else throw"unsupported private key algorithm";return y.readPKCS8PrvKeyHex(h),y},_getKeyFromPublicPKCS8Hex:function(h){var m,y=ASN1HEX.getVbyList(h,0,[0,0],"06");if(y==="2a864886f70d010101")m=new RSAKey;else if(KJUR.crypto.DSA&&y==="2a8648ce380401")m=new KJUR.crypto.DSA;else if(KJUR.crypto.ECDSA&&y==="2a8648ce3d0201")m=new KJUR.crypto.ECDSA;else throw"unsupported PKCS#8 public key hex";return m.readPKCS8PubKeyHex(h),m},parsePublicRawRSAKeyHex:function(h){var m=ASN1HEX,y=m.getChildIdx,A=m.getV,E={};if(h.substr(0,2)!="30")throw"malformed RSA key(code:001)";var b=y(h,0);if(b.length!=2)throw"malformed RSA key(code:002)";if(h.substr(b[0],2)!="02")throw"malformed RSA key(code:003)";if(E.n=A(h,b[0]),h.substr(b[1],2)!="02")throw"malformed RSA key(code:004)";return E.e=A(h,b[1]),E},parsePublicPKCS8Hex:function(h){var m=ASN1HEX,y=m.getChildIdx,A=m.getV,E={};E.algparam=null;var b=y(h,0);if(b.length!=2)throw"outer DERSequence shall have 2 elements: "+b.length;var T=b[0];if(h.substr(T,2)!="30")throw"malformed PKCS8 public key(code:001)";var _=y(h,T);if(_.length!=2)throw"malformed PKCS8 public key(code:002)";if(h.substr(_[0],2)!="06")throw"malformed PKCS8 public key(code:003)";if(E.algoid=A(h,_[0]),h.substr(_[1],2)=="06"?E.algparam=A(h,_[1]):h.substr(_[1],2)=="30"&&(E.algparam={},E.algparam.p=m.getVbyList(h,_[1],[0],"02"),E.algparam.q=m.getVbyList(h,_[1],[1],"02"),E.algparam.g=m.getVbyList(h,_[1],[2],"02")),h.substr(b[1],2)!="03")throw"malformed PKCS8 public key(code:004)";return E.key=A(h,b[1]).substr(2),E}}}();KEYUTIL.getKey=function(n,t,e){var r=ASN1HEX,o=r.getChildIdx;r.getV;var s=r.getVbyList,u=KJUR.crypto,l=u.ECDSA,c=u.DSA,f=RSAKey,d=pemtohex,p=KEYUTIL;if(typeof f!="undefined"&&n instanceof f||typeof l!="undefined"&&n instanceof l||typeof c!="undefined"&&n instanceof c)return n;if(n.curve!==void 0&&n.xy!==void 0&&n.d===void 0)return new l({pub:n.xy,curve:n.curve});if(n.curve!==void 0&&n.d!==void 0)return new l({prv:n.d,curve:n.curve});if(n.kty===void 0&&n.n!==void 0&&n.e!==void 0&&n.d===void 0){var v=new f;return v.setPublic(n.n,n.e),v}if(n.kty===void 0&&n.n!==void 0&&n.e!==void 0&&n.d!==void 0&&n.p!==void 0&&n.q!==void 0&&n.dp!==void 0&&n.dq!==void 0&&n.co!==void 0&&n.qi===void 0){var v=new f;return v.setPrivateEx(n.n,n.e,n.d,n.p,n.q,n.dp,n.dq,n.co),v}if(n.kty===void 0&&n.n!==void 0&&n.e!==void 0&&n.d!==void 0&&n.p===void 0){var v=new f;return v.setPrivate(n.n,n.e,n.d),v}if(n.p!==void 0&&n.q!==void 0&&n.g!==void 0&&n.y!==void 0&&n.x===void 0){var v=new c;return v.setPublic(n.p,n.q,n.g,n.y),v}if(n.p!==void 0&&n.q!==void 0&&n.g!==void 0&&n.y!==void 0&&n.x!==void 0){var v=new c;return v.setPrivate(n.p,n.q,n.g,n.y,n.x),v}if(n.kty==="RSA"&&n.n!==void 0&&n.e!==void 0&&n.d===void 0){var v=new f;return v.setPublic(b64utohex(n.n),b64utohex(n.e)),v}if(n.kty==="RSA"&&n.n!==void 0&&n.e!==void 0&&n.d!==void 0&&n.p!==void 0&&n.q!==void 0&&n.dp!==void 0&&n.dq!==void 0&&n.qi!==void 0){var v=new f;return v.setPrivateEx(b64utohex(n.n),b64utohex(n.e),b64utohex(n.d),b64utohex(n.p),b64utohex(n.q),b64utohex(n.dp),b64utohex(n.dq),b64utohex(n.qi)),v}if(n.kty==="RSA"&&n.n!==void 0&&n.e!==void 0&&n.d!==void 0){var v=new f;return v.setPrivate(b64utohex(n.n),b64utohex(n.e),b64utohex(n.d)),v}if(n.kty==="EC"&&n.crv!==void 0&&n.x!==void 0&&n.y!==void 0&&n.d===void 0){var g=new l({curve:n.crv}),h=g.ecparams.keylen/4,m=("0000000000"+b64utohex(n.x)).slice(-h),y=("0000000000"+b64utohex(n.y)).slice(-h),A="04"+m+y;return g.setPublicKeyHex(A),g}if(n.kty==="EC"&&n.crv!==void 0&&n.x!==void 0&&n.y!==void 0&&n.d!==void 0){var g=new l({curve:n.crv}),h=g.ecparams.keylen/4,m=("0000000000"+b64utohex(n.x)).slice(-h),y=("0000000000"+b64utohex(n.y)).slice(-h),A="04"+m+y,E=("0000000000"+b64utohex(n.d)).slice(-h);return g.setPublicKeyHex(A),g.setPrivateKeyHex(E),g}if(e==="pkcs5prv"){var b=n,r=ASN1HEX,T,v;if(T=o(b,0),T.length===9)v=new f,v.readPKCS5PrvKeyHex(b);else if(T.length===6)v=new c,v.readPKCS5PrvKeyHex(b);else if(T.length>2&&b.substr(T[1],2)==="04")v=new l,v.readPKCS5PrvKeyHex(b);else throw"unsupported PKCS#1/5 hexadecimal key";return v}if(e==="pkcs8prv"){var v=p.getKeyFromPlainPrivatePKCS8Hex(n);return v}if(e==="pkcs8pub")return p._getKeyFromPublicPKCS8Hex(n);if(e==="x509pub")return X509.getPublicKeyFromCertHex(n);if(n.indexOf("-END CERTIFICATE-",0)!=-1||n.indexOf("-END X509 CERTIFICATE-",0)!=-1||n.indexOf("-END TRUSTED CERTIFICATE-",0)!=-1)return X509.getPublicKeyFromCertPEM(n);if(n.indexOf("-END PUBLIC KEY-")!=-1){var _=pemtohex(n,"PUBLIC KEY");return p._getKeyFromPublicPKCS8Hex(_)}if(n.indexOf("-END RSA PRIVATE KEY-")!=-1&&n.indexOf("4,ENCRYPTED")==-1){var R=d(n,"RSA PRIVATE KEY");return p.getKey(R,null,"pkcs5prv")}if(n.indexOf("-END DSA PRIVATE KEY-")!=-1&&n.indexOf("4,ENCRYPTED")==-1){var S=d(n,"DSA PRIVATE KEY"),M=s(S,0,[1],"02"),B=s(S,0,[2],"02"),H=s(S,0,[3],"02"),w=s(S,0,[4],"02"),C=s(S,0,[5],"02"),v=new c;return v.setPrivate(new BigInteger(M,16),new BigInteger(B,16),new BigInteger(H,16),new BigInteger(w,16),new BigInteger(C,16)),v}if(n.indexOf("-END EC PRIVATE KEY-")!=-1&&n.indexOf("4,ENCRYPTED")==-1){var R=d(n,"EC PRIVATE KEY");return p.getKey(R,null,"pkcs5prv")}if(n.indexOf("-END PRIVATE KEY-")!=-1)return p.getKeyFromPlainPrivatePKCS8PEM(n);if(n.indexOf("-END RSA PRIVATE KEY-")!=-1&&n.indexOf("4,ENCRYPTED")!=-1){var L=p.getDecryptedKeyHex(n,t),I=new RSAKey;return I.readPKCS5PrvKeyHex(L),I}if(n.indexOf("-END EC PRIVATE KEY-")!=-1&&n.indexOf("4,ENCRYPTED")!=-1){var S=p.getDecryptedKeyHex(n,t),v=s(S,0,[1],"04"),F=s(S,0,[2,0],"06"),k=s(S,0,[3,0],"03").substr(2),N="";if(KJUR.crypto.OID.oidhex2name[F]!==void 0)N=KJUR.crypto.OID.oidhex2name[F];else throw"undefined OID(hex) in KJUR.crypto.OID: "+F;var g=new l({curve:N});return g.setPublicKeyHex(k),g.setPrivateKeyHex(v),g.isPublic=!1,g}if(n.indexOf("-END DSA PRIVATE KEY-")!=-1&&n.indexOf("4,ENCRYPTED")!=-1){var S=p.getDecryptedKeyHex(n,t),M=s(S,0,[1],"02"),B=s(S,0,[2],"02"),H=s(S,0,[3],"02"),w=s(S,0,[4],"02"),C=s(S,0,[5],"02"),v=new c;return v.setPrivate(new BigInteger(M,16),new BigInteger(B,16),new BigInteger(H,16),new BigInteger(w,16),new BigInteger(C,16)),v}if(n.indexOf("-END ENCRYPTED PRIVATE KEY-")!=-1)return p.getKeyFromEncryptedPKCS8PEM(n,t);throw new Error("not supported argument")},(typeof KJUR.asn1=="undefined"||!KJUR.asn1)&&(KJUR.asn1={}),KJUR.asn1.ASN1Util={},KJUR.asn1.ASN1Util.oidHexToInt=function(n){for(var o="",t=parseInt(n.substr(0,2),16),e=Math.floor(t/40),r=t%40,o=e+"."+r,s="",u=2;u<n.length;u+=2){var l=parseInt(n.substr(u,2),16),c=("00000000"+l.toString(2)).slice(-8);if(s=s+c.substr(1,7),c.substr(0,1)=="0"){var f=new BigInteger(s,2);o=o+"."+f.toString(10),s=""}}return o};var ASN1HEX=new function(){};ASN1HEX.getLblen=function(n,t){if(n.substr(t+2,1)!="8")return 1;var e=parseInt(n.substr(t+3,1));return e==0?-1:0<e&&e<10?e+1:-2},ASN1HEX.getL=function(n,t){var e=ASN1HEX.getLblen(n,t);return e<1?"":n.substr(t+2,e*2)},ASN1HEX.getVblen=function(n,t){var e,r;return e=ASN1HEX.getL(n,t),e==""?-1:(e.substr(0,1)==="8"?r=new BigInteger(e.substr(2),16):r=new BigInteger(e,16),r.intValue())},ASN1HEX.getVidx=function(n,t){var e=ASN1HEX.getLblen(n,t);return e<0?e:t+(e+1)*2},ASN1HEX.getV=function(n,t){var e=ASN1HEX.getVidx(n,t),r=ASN1HEX.getVblen(n,t);return n.substr(e,r*2)},ASN1HEX.getTLV=function(n,t){return n.substr(t,2)+ASN1HEX.getL(n,t)+ASN1HEX.getV(n,t)},ASN1HEX.getTLVblen=function(n,t){return 2+ASN1HEX.getLblen(n,t)*2+ASN1HEX.getVblen(n,t)*2},ASN1HEX.getNextSiblingIdx=function(n,t){var e=ASN1HEX.getVidx(n,t),r=ASN1HEX.getVblen(n,t);return e+r*2},ASN1HEX.getChildIdx=function(n,t){var e=ASN1HEX,r=[],o,s,u;o=e.getVidx(n,t),s=e.getVblen(n,t)*2,n.substr(t,2)=="03"&&(o+=2,s-=2),u=0;for(var l=o;u<=s;){var c=e.getTLVblen(n,l);if(u+=c,u<=s&&r.push(l),l+=c,u>=s)break}return r},ASN1HEX.getNthChildIdx=function(n,t,e){var r=ASN1HEX.getChildIdx(n,t);return r[e]},ASN1HEX.getIdxbyList=function(n,t,e,r){var o=ASN1HEX,s,u;return e.length==0?r!==void 0&&n.substr(t,2)!==r?-1:t:(s=e.shift(),u=o.getChildIdx(n,t),s>=u.length?-1:o.getIdxbyList(n,u[s],e,r))},ASN1HEX.getIdxbyListEx=function(n,t,e,r){var o=ASN1HEX,s,u;if(e.length==0)return r!==void 0&&n.substr(t,2)!==r?-1:t;s=e.shift(),u=o.getChildIdx(n,t);for(var l=0,c=0;c<u.length;c++){var f=n.substr(u[c],2);if(typeof s=="number"&&!o.isContextTag(f)&&l==s||typeof s=="string"&&o.isContextTag(f,s))return o.getIdxbyListEx(n,u[c],e,r);o.isContextTag(f)||l++}return-1},ASN1HEX.getTLVbyList=function(n,t,e,r){var o=ASN1HEX,s=o.getIdxbyList(n,t,e,r);return s==-1||s>=n.length?null:o.getTLV(n,s)},ASN1HEX.getTLVbyListEx=function(n,t,e,r){var o=ASN1HEX,s=o.getIdxbyListEx(n,t,e,r);return s==-1?null:o.getTLV(n,s)},ASN1HEX.getVbyList=function(n,t,e,r,o){var s=ASN1HEX,u,l;return u=s.getIdxbyList(n,t,e,r),u==-1||u>=n.length?null:(l=s.getV(n,u),o===!0&&(l=l.substr(2)),l)},ASN1HEX.getVbyListEx=function(n,t,e,r,o){var s=ASN1HEX,u,l;return u=s.getIdxbyListEx(n,t,e,r),u==-1?null:(l=s.getV(n,u),n.substr(u,2)=="03"&&o!==!1&&(l=l.substr(2)),l)},ASN1HEX.getInt=function(n,t,e){e==null&&(e=-1);try{var r=n.substr(t,2);if(r!="02"&&r!="03")return e;var o=ASN1HEX.getV(n,t);return r=="02"?parseInt(o,16):bitstrtoint(o)}catch(s){return e}},ASN1HEX.getOID=function(n,t,e){e==null&&(e=null);try{if(n.substr(t,2)!="06")return e;var r=ASN1HEX.getV(n,t);return hextooid(r)}catch(o){return e}},ASN1HEX.getOIDName=function(n,t,e){e==null&&(e=null);try{var r=ASN1HEX.getOID(n,t,e);if(r==e)return e;var o=KJUR.asn1.x509.OID.oid2name(r);return o==""?r:o}catch(s){return e}},ASN1HEX.getString=function(n,t,e){e==null&&(e=null);try{var r=ASN1HEX.getV(n,t);return hextorstr(r)}catch(o){return e}},ASN1HEX.hextooidstr=function(n){var t=function(p,v){return p.length>=v?p:new Array(v-p.length+1).join("0")+p},e=[],r=n.substr(0,2),o=parseInt(r,16);e[0]=new String(Math.floor(o/40)),e[1]=new String(o%40);for(var s=n.substr(2),u=[],l=0;l<s.length/2;l++)u.push(parseInt(s.substr(l*2,2),16));for(var c=[],f="",l=0;l<u.length;l++)u[l]&128?f=f+t((u[l]&127).toString(2),7):(f=f+t((u[l]&127).toString(2),7),c.push(new String(parseInt(f,2))),f="");var d=e.join(".");return c.length>0&&(d=d+"."+c.join(".")),d},ASN1HEX.isContextTag=function(n,t){n=n.toLowerCase();var e,r;try{e=parseInt(n,16)}catch(s){return-1}if(t===void 0)return(e&192)==128;try{var o=t.match(/^\[[0-9]+\]$/);return o==null||(r=parseInt(t.substr(1,t.length-1),10),r>31)?!1:(e&192)==128&&(e&31)==r}catch(s){return!1}},ASN1HEX.isASN1HEX=function(n){var t=ASN1HEX;if(n.length%2==1)return!1;var e=t.getVblen(n,0),r=n.substr(0,2),o=t.getL(n,0),s=n.length-r.length-o.length;return s==e*2},ASN1HEX.checkStrictDER=function(n,t,e,r,o){var s=ASN1HEX;if(e===void 0){if(typeof n!="string")throw new Error("not hex string");if(n=n.toLowerCase(),!KJUR.lang.String.isHex(n))throw new Error("not hex string");e=n.length,r=n.length/2,r<128?o=1:o=Math.ceil(r.toString(16))+1}var u=s.getL(n,t);if(u.length>o*2)throw new Error("L of TLV too long: idx="+t);var l=s.getVblen(n,t);if(l>r)throw new Error("value of L too long than hex: idx="+t);var c=s.getTLV(n,t),f=c.length-2-s.getL(n,t).length;if(f!==l*2)throw new Error("V string length and L's value not the same:"+f+"/"+l*2);if(t===0&&n.length!=c.length)throw new Error("total length and TLV length unmatch:"+n.length+"!="+c.length);var d=n.substr(t,2);if(d==="02"){var p=s.getVidx(n,t);if(n.substr(p,2)=="00"&&n.charCodeAt(p+2)<56)throw new Error("not least zeros for DER INTEGER")}if(parseInt(d,16)&32){for(var v=s.getVblen(n,t),g=0,h=s.getChildIdx(n,t),m=0;m<h.length;m++){var y=s.getTLV(n,h[m]);g+=y.length,s.checkStrictDER(n,h[m],e,r,o)}if(v*2!=g)throw new Error("sum of children's TLV length and L unmatch: "+v*2+"!="+g)}},ASN1HEX.oidname=function(n){var t=KJUR.asn1;KJUR.lang.String.isHex(n)&&(n=t.ASN1Util.oidHexToInt(n));var e=t.x509.OID.oid2name(n);return e===""&&(e=n),e},(typeof KJUR.asn1=="undefined"||!KJUR.asn1)&&(KJUR.asn1={}),(typeof KJUR.asn1.x509=="undefined"||!KJUR.asn1.x509)&&(KJUR.asn1.x509={}),KJUR.asn1.x509.AlgorithmIdentifier={},KJUR.asn1.x509.AlgorithmIdentifier.PSSNAME2ASN1TLV={SHAwithRSAandMGF1:"300d06092a864886f70d01010a3000",SHA256withRSAandMGF1:"303d06092a864886f70d01010a3030a00d300b0609608648016503040201a11a301806092a864886f70d010108300b0609608648016503040201a203020120",SHA384withRSAandMGF1:"303d06092a864886f70d01010a3030a00d300b0609608648016503040202a11a301806092a864886f70d010108300b0609608648016503040202a203020130",SHA512withRSAandMGF1:"303d06092a864886f70d01010a3030a00d300b0609608648016503040203a11a301806092a864886f70d010108300b0609608648016503040203a203020140"},KJUR.asn1.x509.OID=new function(n){this.atype2oidList={CN:"2.5.4.3",L:"2.5.4.7",ST:"2.5.4.8",O:"2.5.4.10",OU:"2.5.4.11",C:"2.5.4.6",STREET:"2.5.4.9",DC:"0.9.2342.19200300.100.1.25",UID:"0.9.2342.19200300.100.1.1",SN:"2.5.4.4",T:"2.5.4.12",DN:"2.5.4.49",E:"1.2.840.113549.1.9.1",description:"2.5.4.13",businessCategory:"2.5.4.15",postalCode:"2.5.4.17",serialNumber:"2.5.4.5",uniqueIdentifier:"2.5.4.45",organizationIdentifier:"2.5.4.97",jurisdictionOfIncorporationL:"1.3.6.1.4.1.311.60.2.1.1",jurisdictionOfIncorporationSP:"1.3.6.1.4.1.311.60.2.1.2",jurisdictionOfIncorporationC:"1.3.6.1.4.1.311.60.2.1.3"},this.name2oidList={sha1:"1.3.14.3.2.26",sha256:"2.16.840.1.101.3.4.2.1",sha384:"2.16.840.1.101.3.4.2.2",sha512:"2.16.840.1.101.3.4.2.3",sha224:"2.16.840.1.101.3.4.2.4",md5:"1.2.840.113549.2.5",md2:"1.3.14.7.2.2.1",ripemd160:"1.3.36.3.2.1",MD2withRSA:"1.2.840.113549.1.1.2",MD4withRSA:"1.2.840.113549.1.1.3",MD5withRSA:"1.2.840.113549.1.1.4",SHA1withRSA:"1.2.840.113549.1.1.5","pkcs1-MGF":"1.2.840.113549.1.1.8",rsaPSS:"1.2.840.113549.1.1.10",SHA224withRSA:"1.2.840.113549.1.1.14",SHA256withRSA:"1.2.840.113549.1.1.11",SHA384withRSA:"1.2.840.113549.1.1.12",SHA512withRSA:"1.2.840.113549.1.1.13",SHA1withECDSA:"1.2.840.10045.4.1",SHA224withECDSA:"1.2.840.10045.4.3.1",SHA256withECDSA:"1.2.840.10045.4.3.2",SHA384withECDSA:"1.2.840.10045.4.3.3",SHA512withECDSA:"1.2.840.10045.4.3.4",dsa:"1.2.840.10040.4.1",SHA1withDSA:"1.2.840.10040.4.3",SHA224withDSA:"2.16.840.1.101.3.4.3.1",SHA256withDSA:"2.16.840.1.101.3.4.3.2",rsaEncryption:"1.2.840.113549.1.1.1",commonName:"2.5.4.3",countryName:"2.5.4.6",localityName:"2.5.4.7",stateOrProvinceName:"2.5.4.8",streetAddress:"2.5.4.9",organizationName:"2.5.4.10",organizationalUnitName:"2.5.4.11",domainComponent:"0.9.2342.19200300.100.1.25",userId:"0.9.2342.19200300.100.1.1",surname:"2.5.4.4",givenName:"2.5.4.42",title:"2.5.4.12",distinguishedName:"2.5.4.49",emailAddress:"1.2.840.113549.1.9.1",description:"2.5.4.13",businessCategory:"2.5.4.15",postalCode:"2.5.4.17",uniqueIdentifier:"2.5.4.45",organizationIdentifier:"2.5.4.97",jurisdictionOfIncorporationL:"1.3.6.1.4.1.311.60.2.1.1",jurisdictionOfIncorporationSP:"1.3.6.1.4.1.311.60.2.1.2",jurisdictionOfIncorporationC:"1.3.6.1.4.1.311.60.2.1.3",subjectDirectoryAttributes:"2.5.29.9",subjectKeyIdentifier:"2.5.29.14",keyUsage:"2.5.29.15",subjectAltName:"2.5.29.17",issuerAltName:"2.5.29.18",basicConstraints:"2.5.29.19",cRLNumber:"2.5.29.20",cRLReason:"2.5.29.21",nameConstraints:"2.5.29.30",cRLDistributionPoints:"2.5.29.31",certificatePolicies:"2.5.29.32",anyPolicy:"2.5.29.32.0",authorityKeyIdentifier:"2.5.29.35",policyConstraints:"2.5.29.36",extKeyUsage:"2.5.29.37",authorityInfoAccess:"1.3.6.1.5.5.7.1.1",ocsp:"1.3.6.1.5.5.7.48.1",ocspBasic:"1.3.6.1.5.5.7.48.1.1",ocspNonce:"1.3.6.1.5.5.7.48.1.2",ocspNoCheck:"1.3.6.1.5.5.7.48.1.5",caIssuers:"1.3.6.1.5.5.7.48.2",anyExtendedKeyUsage:"2.5.29.37.0",serverAuth:"1.3.6.1.5.5.7.3.1",clientAuth:"1.3.6.1.5.5.7.3.2",codeSigning:"1.3.6.1.5.5.7.3.3",emailProtection:"1.3.6.1.5.5.7.3.4",timeStamping:"1.3.6.1.5.5.7.3.8",ocspSigning:"1.3.6.1.5.5.7.3.9",dateOfBirth:"1.3.6.1.5.5.7.9.1",placeOfBirth:"1.3.6.1.5.5.7.9.2",gender:"1.3.6.1.5.5.7.9.3",countryOfCitizenship:"1.3.6.1.5.5.7.9.4",countryOfResidence:"1.3.6.1.5.5.7.9.5",ecPublicKey:"1.2.840.10045.2.1","P-256":"1.2.840.10045.3.1.7",secp256r1:"1.2.840.10045.3.1.7",secp256k1:"1.3.132.0.10",secp384r1:"1.3.132.0.34",pkcs5PBES2:"1.2.840.113549.1.5.13",pkcs5PBKDF2:"1.2.840.113549.1.5.12","des-EDE3-CBC":"1.2.840.113549.3.7",data:"1.2.840.113549.1.7.1","signed-data":"1.2.840.113549.1.7.2","enveloped-data":"1.2.840.113549.1.7.3","digested-data":"1.2.840.113549.1.7.5","encrypted-data":"1.2.840.113549.1.7.6","authenticated-data":"1.2.840.113549.1.9.16.1.2",tstinfo:"1.2.840.113549.1.9.16.1.4",signingCertificate:"1.2.840.113549.1.9.16.2.12",timeStampToken:"1.2.840.113549.1.9.16.2.14",signaturePolicyIdentifier:"1.2.840.113549.1.9.16.2.15",etsArchiveTimeStamp:"1.2.840.113549.1.9.16.2.27",signingCertificateV2:"1.2.840.113549.1.9.16.2.47",etsArchiveTimeStampV2:"1.2.840.113549.1.9.16.2.48",extensionRequest:"1.2.840.113549.1.9.14",contentType:"1.2.840.113549.1.9.3",messageDigest:"1.2.840.113549.1.9.4",signingTime:"1.2.840.113549.1.9.5",counterSignature:"1.2.840.113549.1.9.6",archiveTimeStampV3:"0.4.0.1733.2.4",pdfRevocationInfoArchival:"1.2.840.113583.1.1.8",adobeTimeStamp:"1.2.840.113583.1.1.9.1"},this.objCache={},this.name2obj=function(t){if(typeof this.objCache[t]!="undefined")return this.objCache[t];if(typeof this.name2oidList[t]=="undefined")throw"Name of ObjectIdentifier not defined: "+t;var e=this.name2oidList[t],r=new KJUR.asn1.DERObjectIdentifier({oid:e});return this.objCache[t]=r,r},this.atype2obj=function(t){if(this.objCache[t]!==void 0)return this.objCache[t];var e;if(t.match(/^\d+\.\d+\.[0-9.]+$/))e=t;else if(this.atype2oidList[t]!==void 0)e=this.atype2oidList[t];else if(this.name2oidList[t]!==void 0)e=this.name2oidList[t];else throw"AttributeType name undefined: "+t;var r=new KJUR.asn1.DERObjectIdentifier({oid:e});return this.objCache[t]=r,r}},KJUR.asn1.x509.OID.oid2name=function(n){var t=KJUR.asn1.x509.OID.name2oidList;for(var e in t)if(t[e]==n)return e;return""},KJUR.asn1.x509.OID.oid2atype=function(n){var t=KJUR.asn1.x509.OID.atype2oidList;for(var e in t)if(t[e]==n)return e;return n},KJUR.asn1.x509.OID.name2oid=function(n){if(n.match(/^[0-9.]+$/))return n;var t=KJUR.asn1.x509.OID.name2oidList;return t[n]===void 0?"":t[n]},RSAKey.getPosArrayOfChildrenFromHex=function(n){return ASN1HEX.getChildIdx(n,0)},RSAKey.getHexValueArrayOfChildrenFromHex=function(n){var t=ASN1HEX,e=t.getV,v=RSAKey.getPosArrayOfChildrenFromHex(n),r=e(n,v[0]),o=e(n,v[1]),s=e(n,v[2]),u=e(n,v[3]),l=e(n,v[4]),c=e(n,v[5]),f=e(n,v[6]),d=e(n,v[7]),p=e(n,v[8]),v=new Array;return v.push(r,o,s,u,l,c,f,d,p),v},RSAKey.prototype.readPrivateKeyFromPEMString=function(n){var t=pemtohex(n),e=RSAKey.getHexValueArrayOfChildrenFromHex(t);this.setPrivateEx(e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])},RSAKey.prototype.readPKCS5PrvKeyHex=function(n){var t=RSAKey.getHexValueArrayOfChildrenFromHex(n);this.setPrivateEx(t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8])},RSAKey.prototype.readPKCS8PrvKeyHex=function(n){var t,e,r,o,s,u,l,c,f=ASN1HEX,d=f.getVbyListEx;if(f.isASN1HEX(n)===!1)throw new Error("not ASN.1 hex string");try{t=d(n,0,[2,0,1],"02"),e=d(n,0,[2,0,2],"02"),r=d(n,0,[2,0,3],"02"),o=d(n,0,[2,0,4],"02"),s=d(n,0,[2,0,5],"02"),u=d(n,0,[2,0,6],"02"),l=d(n,0,[2,0,7],"02"),c=d(n,0,[2,0,8],"02")}catch(p){throw new Error("malformed PKCS#8 plain RSA private key")}this.setPrivateEx(t,e,r,o,s,u,l,c)},RSAKey.prototype.readPKCS5PubKeyHex=function(n){var t=ASN1HEX,e=t.getV;if(t.isASN1HEX(n)===!1)throw new Error("keyHex is not ASN.1 hex string");var r=t.getChildIdx(n,0);if(r.length!==2||n.substr(r[0],2)!=="02"||n.substr(r[1],2)!=="02")throw new Error("wrong hex for PKCS#5 public key");var o=e(n,r[0]),s=e(n,r[1]);this.setPublic(o,s)},RSAKey.prototype.readPKCS8PubKeyHex=function(n){var t=ASN1HEX;if(t.isASN1HEX(n)===!1)throw new Error("not ASN.1 hex string");if(t.getTLVbyListEx(n,0,[0,0])!=="06092a864886f70d010101")throw new Error("not PKCS8 RSA public key");var e=t.getTLVbyListEx(n,0,[1,0]);this.readPKCS5PubKeyHex(e)},RSAKey.prototype.readCertPubKeyHex=function(n,t){var e,r;e=new X509,e.readCertHex(n),r=e.getPublicKeyHex(),this.readPKCS8PubKeyHex(r)};function _rsasign_getAlgNameAndHashFromHexDisgestInfo(n){for(var t in KJUR.crypto.Util.DIGESTINFOHEAD){var e=KJUR.crypto.Util.DIGESTINFOHEAD[t],r=e.length;if(n.substring(0,r)==e){var o=[t,n.substring(r)];return o}}return[]}RSAKey.prototype.verify=function(n,t){if(t=t.toLowerCase(),t.match(/^[0-9a-f]+$/)==null)return!1;var e=parseBigInt(t,16),r=this.n.bitLength();if(e.bitLength()>r)return!1;var o=this.doPublic(e),s=o.toString(16);if(s.length+3!=r/4)return!1;var u=s.replace(/^1f+00/,""),l=_rsasign_getAlgNameAndHashFromHexDisgestInfo(u);if(l.length==0)return!1;var c=l[0],f=l[1],d=function(v){return KJUR.crypto.Util.hashString(v,c)},p=d(n);return f==p},RSAKey.prototype.verifyWithMessageHash=function(n,t){if(t.length!=Math.ceil(this.n.bitLength()/4))return!1;var e=parseBigInt(t,16);if(e.bitLength()>this.n.bitLength())return 0;var r=this.doPublic(e),o=r.toString(16).replace(/^1f+00/,""),s=_rsasign_getAlgNameAndHashFromHexDisgestInfo(o);if(s.length==0)return!1;s[0];var u=s[1];return u==n},RSAKey.prototype.verifyPSS=function(n,t,e,r){var o=function(u){return KJUR.crypto.Util.hashHex(u,e)},s=o(rstrtohex(n));return r===void 0&&(r=-1),this.verifyWithMessageHashPSS(s,t,e,r)},RSAKey.prototype.verifyWithMessageHashPSS=function(n,t,e,r){if(t.length!=Math.ceil(this.n.bitLength()/4))return!1;var o=new BigInteger(t,16),s=function(E){return KJUR.crypto.Util.hashHex(E,e)},u=hextorstr(n),l=u.length,c=this.n.bitLength()-1,f=Math.ceil(c/8),d;if(r===-1||r===void 0)r=l;else if(r===-2)r=f-l-2;else if(r<-2)throw new Error("invalid salt length");if(f<l+r+2)throw new Error("data too long");var p=this.doPublic(o).toByteArray();for(d=0;d<p.length;d+=1)p[d]&=255;for(;p.length<f;)p.unshift(0);if(p[f-1]!==188)throw new Error("encoded message does not end in 0xbc");p=String.fromCharCode.apply(String,p);var v=p.substr(0,f-l-1),g=p.substr(v.length,l),h=65280>>8*f-c&255;if(v.charCodeAt(0)&h)throw new Error("bits beyond keysize not zero");var m=pss_mgf1_str(g,v.length,s),y=[];for(d=0;d<v.length;d+=1)y[d]=v.charCodeAt(d)^m.charCodeAt(d);y[0]&=~h;var A=f-l-r-2;for(d=0;d<A;d+=1)if(y[d]!==0)throw new Error("leftmost octets not zero");if(y[A]!==1)throw new Error("0x01 marker not found");return g===hextorstr(s(rstrtohex("\0\0\0\0\0\0\0\0"+u+String.fromCharCode.apply(String,y.slice(-r)))))},RSAKey.SALT_LEN_HLEN=-1,RSAKey.SALT_LEN_MAX=-2,RSAKey.SALT_LEN_RECOVER=-2;function X509(n){var t=ASN1HEX,e=t.getChildIdx,r=t.getV,o=t.getTLV,s=t.getVbyList,u=t.getVbyListEx,l=t.getTLVbyList,c=t.getTLVbyListEx,f=t.getIdxbyList,d=t.getIdxbyListEx,p=t.getVidx,v=t.getInt,g=t.oidname,h=t.hextooidstr,m=pemtohex,y;try{y=KJUR.asn1.x509.AlgorithmIdentifier.PSSNAME2ASN1TLV}catch(A){}this.HEX2STAG={"0c":"utf8",13:"prn",16:"ia5","1a":"vis","1e":"bmp"},this.hex=null,this.version=0,this.foffset=0,this.aExtInfo=null,this.getVersion=function(){if(this.hex===null||this.version!==0)return this.version;var A=l(this.hex,0,[0,0]);if(A.substr(0,2)=="a0"){var E=l(A,0,[0]),b=v(E,0);if(b<0||2<b)throw new Error("malformed version field");return this.version=b+1,this.version}else return this.version=1,this.foffset=-1,1},this.getSerialNumberHex=function(){return u(this.hex,0,[0,0],"02")},this.getSignatureAlgorithmField=function(){var A=c(this.hex,0,[0,1]);return this.getAlgorithmIdentifierName(A)},this.getAlgorithmIdentifierName=function(A){for(var E in y)if(A===y[E])return E;return g(u(A,0,[0],"06"))},this.getIssuer=function(){return this.getX500Name(this.getIssuerHex())},this.getIssuerHex=function(){return l(this.hex,0,[0,3+this.foffset],"30")},this.getIssuerString=function(){var A=this.getIssuer();return A.str},this.getSubject=function(){return this.getX500Name(this.getSubjectHex())},this.getSubjectHex=function(){return l(this.hex,0,[0,5+this.foffset],"30")},this.getSubjectString=function(){var A=this.getSubject();return A.str},this.getNotBefore=function(){var A=s(this.hex,0,[0,4+this.foffset,0]);return A=A.replace(/(..)/g,"%$1"),A=decodeURIComponent(A),A},this.getNotAfter=function(){var A=s(this.hex,0,[0,4+this.foffset,1]);return A=A.replace(/(..)/g,"%$1"),A=decodeURIComponent(A),A},this.getPublicKeyHex=function(){return t.getTLVbyList(this.hex,0,[0,6+this.foffset],"30")},this.getPublicKeyIdx=function(){return f(this.hex,0,[0,6+this.foffset],"30")},this.getPublicKeyContentIdx=function(){var A=this.getPublicKeyIdx();return f(this.hex,A,[1,0],"30")},this.getPublicKey=function(){return KEYUTIL.getKey(this.getPublicKeyHex(),null,"pkcs8pub")},this.getSignatureAlgorithmName=function(){var A=l(this.hex,0,[1],"30");return this.getAlgorithmIdentifierName(A)},this.getSignatureValueHex=function(){return s(this.hex,0,[2],"03",!0)},this.verifySignature=function(A){var E=this.getSignatureAlgorithmField(),b=this.getSignatureValueHex(),T=l(this.hex,0,[0],"30"),_=new KJUR.crypto.Signature({alg:E});return _.init(A),_.updateHex(T),_.verify(b)},this.parseExt=function(A){var E,b,T;if(A===void 0){if(T=this.hex,this.version!==3)return-1;E=f(T,0,[0,7,0],"30"),b=e(T,E)}else{T=pemtohex(A);var _=f(T,0,[0,3,0,0],"06");if(r(T,_)!="2a864886f70d01090e"){this.aExtInfo=new Array;return}E=f(T,0,[0,3,0,1,0],"30"),b=e(T,E),this.hex=T}this.aExtInfo=new Array;for(var R=0;R<b.length;R++){var S={};S.critical=!1;var M=e(T,b[R]),B=0;M.length===3&&(S.critical=!0,B=1),S.oid=t.hextooidstr(s(T,b[R],[0],"06"));var H=f(T,b[R],[1+B]);S.vidx=p(T,H),this.aExtInfo.push(S)}},this.getExtInfo=function(A){var E=this.aExtInfo,b=A;if(A.match(/^[0-9.]+$/)||(b=KJUR.asn1.x509.OID.name2oid(A)),b!==""){for(var T=0;T<E.length;T++)if(E[T].oid===b)return E[T]}},this.getExtBasicConstraints=function(A,E){if(A===void 0&&E===void 0){var b=this.getExtInfo("basicConstraints");if(b===void 0)return;A=o(this.hex,b.vidx),E=b.critical}var T={extname:"basicConstraints"};if(E&&(T.critical=!0),A==="3000")return T;if(A==="30030101ff")return T.cA=!0,T;if(A.substr(0,12)==="30060101ff02"){var _=r(A,10),R=parseInt(_,16);return T.cA=!0,T.pathLen=R,T}throw new Error("hExtV parse error: "+A)},this.getExtKeyUsage=function(A,E){if(A===void 0&&E===void 0){var b=this.getExtInfo("keyUsage");if(b===void 0)return;A=o(this.hex,b.vidx),E=b.critical}var T={extname:"keyUsage"};return E&&(T.critical=!0),T.names=this.getExtKeyUsageString(A).split(","),T},this.getExtKeyUsageBin=function(A){if(A===void 0){var E=this.getExtInfo("keyUsage");if(E===void 0)return"";A=o(this.hex,E.vidx)}if(A.length!=8&&A.length!=10)throw new Error("malformed key usage value: "+A);var b="000000000000000"+parseInt(A.substr(6),16).toString(2);return A.length==8&&(b=b.slice(-8)),A.length==10&&(b=b.slice(-16)),b=b.replace(/0+$/,""),b==""&&(b="0"),b},this.getExtKeyUsageString=function(A){for(var E=this.getExtKeyUsageBin(A),b=new Array,T=0;T<E.length;T++)E.substr(T,1)=="1"&&b.push(X509.KEYUSAGE_NAME[T]);return b.join(",")},this.getExtSubjectKeyIdentifier=function(A,E){if(A===void 0&&E===void 0){var b=this.getExtInfo("subjectKeyIdentifier");if(b===void 0)return;A=o(this.hex,b.vidx),E=b.critical}var T={extname:"subjectKeyIdentifier"};E&&(T.critical=!0);var _=r(A,0);return T.kid={hex:_},T},this.getExtAuthorityKeyIdentifier=function(A,E){if(A===void 0&&E===void 0){var b=this.getExtInfo("authorityKeyIdentifier");if(b===void 0)return;A=o(this.hex,b.vidx),E=b.critical}var T={extname:"authorityKeyIdentifier"};E&&(T.critical=!0);for(var _=e(A,0),R=0;R<_.length;R++){var S=A.substr(_[R],2);if(S==="80"&&(T.kid={hex:r(A,_[R])}),S==="a1"){var M=o(A,_[R]),B=this.getGeneralNames(M);T.issuer=B[0].dn}S==="82"&&(T.sn={hex:r(A,_[R])})}return T},this.getExtExtKeyUsage=function(A,E){if(A===void 0&&E===void 0){var b=this.getExtInfo("extKeyUsage");if(b===void 0)return;A=o(this.hex,b.vidx),E=b.critical}var T={extname:"extKeyUsage",array:[]};E&&(T.critical=!0);for(var _=e(A,0),R=0;R<_.length;R++)T.array.push(g(r(A,_[R])));return T},this.getExtExtKeyUsageName=function(){var A=this.getExtInfo("extKeyUsage");if(A===void 0)return A;var E=new Array,b=o(this.hex,A.vidx);if(b==="")return E;for(var T=e(b,0),_=0;_<T.length;_++)E.push(g(r(b,T[_])));return E},this.getExtSubjectAltName=function(A,E){if(A===void 0&&E===void 0){var b=this.getExtInfo("subjectAltName");if(b===void 0)return;A=o(this.hex,b.vidx),E=b.critical}var T={extname:"subjectAltName",array:[]};return E&&(T.critical=!0),T.array=this.getGeneralNames(A),T},this.getExtIssuerAltName=function(A,E){if(A===void 0&&E===void 0){var b=this.getExtInfo("issuerAltName");if(b===void 0)return;A=o(this.hex,b.vidx),E=b.critical}var T={extname:"issuerAltName",array:[]};return E&&(T.critical=!0),T.array=this.getGeneralNames(A),T},this.getGeneralNames=function(A){for(var E=e(A,0),b=[],T=0;T<E.length;T++){var _=this.getGeneralName(o(A,E[T]));_!==void 0&&b.push(_)}return b},this.getGeneralName=function(A){var E=A.substr(0,2),b=r(A,0),T=hextorstr(b);if(E=="81")return{rfc822:T};if(E=="82")return{dns:T};if(E=="86")return{uri:T};if(E=="87")return{ip:hextoip(b)};if(E=="a4")return{dn:this.getX500Name(b)}},this.getExtSubjectAltName2=function(){var A,E,b,T=this.getExtInfo("subjectAltName");if(T===void 0)return T;for(var _=new Array,R=o(this.hex,T.vidx),S=e(R,0),M=0;M<S.length;M++)b=R.substr(S[M],2),A=r(R,S[M]),b==="81"&&(E=hextoutf8(A),_.push(["MAIL",E])),b==="82"&&(E=hextoutf8(A),_.push(["DNS",E])),b==="84"&&(E=X509.hex2dn(A,0),_.push(["DN",E])),b==="86"&&(E=hextoutf8(A),_.push(["URI",E])),b==="87"&&(E=hextoip(A),_.push(["IP",E]));return _},this.getExtCRLDistributionPoints=function(A,E){if(A===void 0&&E===void 0){var b=this.getExtInfo("cRLDistributionPoints");if(b===void 0)return;A=o(this.hex,b.vidx),E=b.critical}var T={extname:"cRLDistributionPoints",array:[]};E&&(T.critical=!0);for(var _=e(A,0),R=0;R<_.length;R++){var S=o(A,_[R]);T.array.push(this.getDistributionPoint(S))}return T},this.getDistributionPoint=function(A){for(var E={},b=e(A,0),T=0;T<b.length;T++){var _=A.substr(b[T],2),R=o(A,b[T]);_=="a0"&&(E.dpname=this.getDistributionPointName(R))}return E},this.getDistributionPointName=function(A){for(var E={},b=e(A,0),T=0;T<b.length;T++){var _=A.substr(b[T],2),R=o(A,b[T]);_=="a0"&&(E.full=this.getGeneralNames(R))}return E},this.getExtCRLDistributionPointsURI=function(){var A=this.getExtInfo("cRLDistributionPoints");if(A===void 0)return A;for(var E=new Array,b=e(this.hex,A.vidx),T=0;T<b.length;T++)try{var _=s(this.hex,b[T],[0,0,0],"86"),R=hextoutf8(_);E.push(R)}catch(S){}return E},this.getExtAIAInfo=function(){var A=this.getExtInfo("authorityInfoAccess");if(A===void 0)return A;for(var E={ocsp:[],caissuer:[]},b=e(this.hex,A.vidx),T=0;T<b.length;T++){var _=s(this.hex,b[T],[0],"06"),R=s(this.hex,b[T],[1],"86");_==="2b06010505073001"&&E.ocsp.push(hextoutf8(R)),_==="2b06010505073002"&&E.caissuer.push(hextoutf8(R))}return E},this.getExtAuthorityInfoAccess=function(A,E){if(A===void 0&&E===void 0){var b=this.getExtInfo("authorityInfoAccess");if(b===void 0)return;A=o(this.hex,b.vidx),E=b.critical}var T={extname:"authorityInfoAccess",array:[]};E&&(T.critical=!0);for(var _=e(A,0),R=0;R<_.length;R++){var S=u(A,_[R],[0],"06"),M=s(A,_[R],[1],"86"),B=hextoutf8(M);if(S=="2b06010505073001")T.array.push({ocsp:B});else if(S=="2b06010505073002")T.array.push({caissuer:B});else throw new Error("unknown method: "+S)}return T},this.getExtCertificatePolicies=function(A,E){if(A===void 0&&E===void 0){var b=this.getExtInfo("certificatePolicies");if(b===void 0)return;A=o(this.hex,b.vidx),E=b.critical}var T={extname:"certificatePolicies",array:[]};E&&(T.critical=!0);for(var _=e(A,0),R=0;R<_.length;R++){var S=o(A,_[R]),M=this.getPolicyInformation(S);T.array.push(M)}return T},this.getPolicyInformation=function(A){var E={},b=s(A,0,[0],"06");E.policyoid=g(b);var T=d(A,0,[1],"30");if(T!=-1){E.array=[];for(var _=e(A,T),R=0;R<_.length;R++){var S=o(A,_[R]),M=this.getPolicyQualifierInfo(S);E.array.push(M)}}return E},this.getPolicyQualifierInfo=function(A){var E={},b=s(A,0,[0],"06");if(b==="2b06010505070201"){var T=u(A,0,[1],"16");E.cps=hextorstr(T)}else if(b==="2b06010505070202"){var _=l(A,0,[1],"30");E.unotice=this.getUserNotice(_)}return E},this.getUserNotice=function(A){for(var E={},b=e(A,0),T=0;T<b.length;T++){var _=o(A,b[T]);_.substr(0,2)!="30"&&(E.exptext=this.getDisplayText(_))}return E},this.getDisplayText=function(A){var E={"0c":"utf8",16:"ia5","1a":"vis","1e":"bmp"},b={};return b.type=E[A.substr(0,2)],b.str=hextorstr(r(A,0)),b},this.getExtCRLNumber=function(A,E){var b={extname:"cRLNumber"};if(E&&(b.critical=!0),A.substr(0,2)=="02")return b.num={hex:r(A,0)},b;throw new Error("hExtV parse error: "+A)},this.getExtCRLReason=function(A,E){var b={extname:"cRLReason"};if(E&&(b.critical=!0),A.substr(0,2)=="0a")return b.code=parseInt(r(A,0),16),b;throw new Error("hExtV parse error: "+A)},this.getExtOcspNonce=function(A,E){var b={extname:"ocspNonce"};E&&(b.critical=!0);var T=r(A,0);return b.hex=T,b},this.getExtOcspNoCheck=function(A,E){var b={extname:"ocspNoCheck"};return E&&(b.critical=!0),b},this.getExtAdobeTimeStamp=function(A,E){if(A===void 0&&E===void 0){var b=this.getExtInfo("adobeTimeStamp");if(b===void 0)return;A=o(this.hex,b.vidx),E=b.critical}var T={extname:"adobeTimeStamp"};E&&(T.critical=!0);var _=e(A,0);if(_.length>1){var R=o(A,_[1]),S=this.getGeneralName(R);S.uri!=null&&(T.uri=S.uri)}if(_.length>2){var M=o(A,_[2]);M=="0101ff"&&(T.reqauth=!0),M=="010100"&&(T.reqauth=!1)}return T},this.getX500NameRule=function(A){for(var E=null,b=[],T=0;T<A.length;T++)for(var _=A[T],R=0;R<_.length;R++)b.push(_[R]);for(var T=0;T<b.length;T++){var S=b[T],M=S.ds,B=S.value,H=S.type;if(M!="prn"&&M!="utf8"&&M!="ia5")return"mixed";if(M=="ia5"){if(H!="CN")return"mixed";if(KJUR.lang.String.isMail(B))continue;return"mixed"}if(H=="C"){if(M=="prn")continue;return"mixed"}if(E==null)E=M;else if(E!==M)return"mixed"}return E==null?"prn":E},this.getX500Name=function(A){var E=this.getX500NameArray(A),b=this.dnarraytostr(E);return{array:E,str:b}},this.getX500NameArray=function(A){for(var E=[],b=e(A,0),T=0;T<b.length;T++)E.push(this.getRDN(o(A,b[T])));return E},this.getRDN=function(A){for(var E=[],b=e(A,0),T=0;T<b.length;T++)E.push(this.getAttrTypeAndValue(o(A,b[T])));return E},this.getAttrTypeAndValue=function(A){var E={type:null,value:null,ds:null},b=e(A,0),T=s(A,b[0],[],"06"),_=s(A,b[1],[]),R=KJUR.asn1.ASN1Util.oidHexToInt(T);return E.type=KJUR.asn1.x509.OID.oid2atype(R),E.ds=this.HEX2STAG[A.substr(b[1],2)],E.ds!="bmp"?E.value=hextoutf8(_):E.value=ucs2hextoutf8(_),E},this.readCertPEM=function(A){this.readCertHex(m(A))},this.readCertHex=function(A){this.hex=A,this.getVersion();try{f(this.hex,0,[0,7],"a3"),this.parseExt()}catch(E){}},this.getParam=function(){var A={};return A.version=this.getVersion(),A.serial={hex:this.getSerialNumberHex()},A.sigalg=this.getSignatureAlgorithmField(),A.issuer=this.getIssuer(),A.notbefore=this.getNotBefore(),A.notafter=this.getNotAfter(),A.subject=this.getSubject(),A.sbjpubkey=hextopem(this.getPublicKeyHex(),"PUBLIC KEY"),this.aExtInfo.length>0&&(A.ext=this.getExtParamArray()),A.sighex=this.getSignatureValueHex(),A},this.getExtParamArray=function(A){if(A==null){var E=d(this.hex,0,[0,"[3]"]);E!=-1&&(A=c(this.hex,0,[0,"[3]",0],"30"))}for(var b=[],T=e(A,0),_=0;_<T.length;_++){var R=o(A,T[_]),S=this.getExtParam(R);S!=null&&b.push(S)}return b},this.getExtParam=function(A){var E=e(A,0),b=E.length;if(b!=2&&b!=3)throw new Error("wrong number elements in Extension: "+b+" "+A);var T=h(s(A,0,[0],"06")),_=!1;b==3&&l(A,0,[1])=="0101ff"&&(_=!0);var R=l(A,0,[b-1,0]),S=void 0;if(T=="2.5.29.14"?S=this.getExtSubjectKeyIdentifier(R,_):T=="2.5.29.15"?S=this.getExtKeyUsage(R,_):T=="2.5.29.17"?S=this.getExtSubjectAltName(R,_):T=="2.5.29.18"?S=this.getExtIssuerAltName(R,_):T=="2.5.29.19"?S=this.getExtBasicConstraints(R,_):T=="2.5.29.31"?S=this.getExtCRLDistributionPoints(R,_):T=="2.5.29.32"?S=this.getExtCertificatePolicies(R,_):T=="2.5.29.35"?S=this.getExtAuthorityKeyIdentifier(R,_):T=="2.5.29.37"?S=this.getExtExtKeyUsage(R,_):T=="1.3.6.1.5.5.7.1.1"?S=this.getExtAuthorityInfoAccess(R,_):T=="2.5.29.20"?S=this.getExtCRLNumber(R,_):T=="2.5.29.21"?S=this.getExtCRLReason(R,_):T=="1.3.6.1.5.5.7.48.1.2"?S=this.getExtOcspNonce(R,_):T=="1.3.6.1.5.5.7.48.1.5"?S=this.getExtOcspNoCheck(R,_):T=="1.2.840.113583.1.1.9.1"&&(S=this.getExtAdobeTimeStamp(R,_)),S!=null)return S;var M={extname:T,extn:R};return _&&(M.critical=!0),M},this.findExt=function(A,E){for(var b=0;b<A.length;b++)if(A[b].extname==E)return A[b];return null},this.dnarraytostr=function(A){function E(T){return T.map(function(_){return b(_).replace(/\+/,"\\+")}).join("+")}function b(T){return T.type+"="+T.value}return"/"+A.map(function(T){return E(T).replace(/\//,"\\/")}).join("/")},this.getInfo=function(){var A=function(D){var U=JSON.stringify(D.array).replace(/[\[\]\{\}\"]/g,"");return U},E=function(D){for(var U="",Q=D.array,q=0;q<Q.length;q++){var G=Q[q];if(U+=" policy oid: "+G.policyoid+`
|
|
363
|
-
`,
|
|
364
|
-
`)}}return U},b=function(D){for(var U="",
|
|
365
|
-
`)}catch(
|
|
366
|
-
`)}catch(
|
|
367
|
-
`),
|
|
362
|
+
`,B},parseHexOfEncryptedPKCS8:function(h){var m=ASN1HEX,y=m.getChildIdx,A=m.getV,E={},b=y(h,0);if(b.length!=2)throw"malformed format: SEQUENCE(0).items != 2: "+b.length;E.ciphertext=A(h,b[1]);var T=y(h,b[0]);if(T.length!=2)throw"malformed format: SEQUENCE(0.0).items != 2: "+T.length;if(A(h,T[0])!="2a864886f70d01050d")throw"this only supports pkcs5PBES2";var _=y(h,T[1]);if(T.length!=2)throw"malformed format: SEQUENCE(0.0.1).items != 2: "+_.length;var R=y(h,_[1]);if(R.length!=2)throw"malformed format: SEQUENCE(0.0.1.1).items != 2: "+R.length;if(A(h,R[0])!="2a864886f70d0307")throw"this only supports TripleDES";E.encryptionSchemeAlg="TripleDES",E.encryptionSchemeIV=A(h,R[1]);var S=y(h,_[0]);if(S.length!=2)throw"malformed format: SEQUENCE(0.0.1.0).items != 2: "+S.length;if(A(h,S[0])!="2a864886f70d01050c")throw"this only supports pkcs5PBKDF2";var M=y(h,S[1]);if(M.length<2)throw"malformed format: SEQUENCE(0.0.1.0.1).items < 2: "+M.length;E.pbkdf2Salt=A(h,M[0]);var B=A(h,M[1]);try{E.pbkdf2Iter=parseInt(B,16)}catch(H){throw"malformed format pbkdf2Iter: "+B}return E},getPBKDF2KeyHexFromParam:function(h,m){var y=CryptoJS.enc.Hex.parse(h.pbkdf2Salt),A=h.pbkdf2Iter,E=CryptoJS.PBKDF2(m,y,{keySize:192/32,iterations:A}),b=CryptoJS.enc.Hex.stringify(E);return b},_getPlainPKCS8HexFromEncryptedPKCS8PEM:function(h,m){var y=pemtohex(h,"ENCRYPTED PRIVATE KEY"),A=this.parseHexOfEncryptedPKCS8(y),E=KEYUTIL.getPBKDF2KeyHexFromParam(A,m),b={};b.ciphertext=CryptoJS.enc.Hex.parse(A.ciphertext);var T=CryptoJS.enc.Hex.parse(E),_=CryptoJS.enc.Hex.parse(A.encryptionSchemeIV),R=CryptoJS.TripleDES.decrypt(b,T,{iv:_}),S=CryptoJS.enc.Hex.stringify(R);return S},getKeyFromEncryptedPKCS8PEM:function(h,m){var y=this._getPlainPKCS8HexFromEncryptedPKCS8PEM(h,m),A=this.getKeyFromPlainPrivatePKCS8Hex(y);return A},parsePlainPrivatePKCS8Hex:function(h){var m=ASN1HEX,y=m.getChildIdx,A=m.getV,E={};if(E.algparam=null,h.substr(0,2)!="30")throw new Error("malformed plain PKCS8 private key(code:001)");var b=y(h,0);if(b.length<3)throw new Error("malformed plain PKCS8 private key(code:002)");if(h.substr(b[1],2)!="30")throw new Error("malformed PKCS8 private key(code:003)");var T=y(h,b[1]);if(T.length!=2)throw new Error("malformed PKCS8 private key(code:004)");if(h.substr(T[0],2)!="06")throw new Error("malformed PKCS8 private key(code:005)");if(E.algoid=A(h,T[0]),h.substr(T[1],2)=="06"&&(E.algparam=A(h,T[1])),h.substr(b[2],2)!="04")throw new Error("malformed PKCS8 private key(code:006)");return E.keyidx=m.getVidx(h,b[2]),E},getKeyFromPlainPrivatePKCS8PEM:function(h){var m=pemtohex(h,"PRIVATE KEY"),y=this.getKeyFromPlainPrivatePKCS8Hex(m);return y},getKeyFromPlainPrivatePKCS8Hex:function(h){var m=this.parsePlainPrivatePKCS8Hex(h),y;if(m.algoid=="2a864886f70d010101")y=new RSAKey;else if(KJUR.crypto.DSA&&m.algoid=="2a8648ce380401")y=new KJUR.crypto.DSA;else if(KJUR.crypto.ECDSA&&m.algoid=="2a8648ce3d0201")y=new KJUR.crypto.ECDSA;else throw"unsupported private key algorithm";return y.readPKCS8PrvKeyHex(h),y},_getKeyFromPublicPKCS8Hex:function(h){var m,y=ASN1HEX.getVbyList(h,0,[0,0],"06");if(y==="2a864886f70d010101")m=new RSAKey;else if(KJUR.crypto.DSA&&y==="2a8648ce380401")m=new KJUR.crypto.DSA;else if(KJUR.crypto.ECDSA&&y==="2a8648ce3d0201")m=new KJUR.crypto.ECDSA;else throw"unsupported PKCS#8 public key hex";return m.readPKCS8PubKeyHex(h),m},parsePublicRawRSAKeyHex:function(h){var m=ASN1HEX,y=m.getChildIdx,A=m.getV,E={};if(h.substr(0,2)!="30")throw"malformed RSA key(code:001)";var b=y(h,0);if(b.length!=2)throw"malformed RSA key(code:002)";if(h.substr(b[0],2)!="02")throw"malformed RSA key(code:003)";if(E.n=A(h,b[0]),h.substr(b[1],2)!="02")throw"malformed RSA key(code:004)";return E.e=A(h,b[1]),E},parsePublicPKCS8Hex:function(h){var m=ASN1HEX,y=m.getChildIdx,A=m.getV,E={};E.algparam=null;var b=y(h,0);if(b.length!=2)throw"outer DERSequence shall have 2 elements: "+b.length;var T=b[0];if(h.substr(T,2)!="30")throw"malformed PKCS8 public key(code:001)";var _=y(h,T);if(_.length!=2)throw"malformed PKCS8 public key(code:002)";if(h.substr(_[0],2)!="06")throw"malformed PKCS8 public key(code:003)";if(E.algoid=A(h,_[0]),h.substr(_[1],2)=="06"?E.algparam=A(h,_[1]):h.substr(_[1],2)=="30"&&(E.algparam={},E.algparam.p=m.getVbyList(h,_[1],[0],"02"),E.algparam.q=m.getVbyList(h,_[1],[1],"02"),E.algparam.g=m.getVbyList(h,_[1],[2],"02")),h.substr(b[1],2)!="03")throw"malformed PKCS8 public key(code:004)";return E.key=A(h,b[1]).substr(2),E}}}();KEYUTIL.getKey=function(n,t,e){var r=ASN1HEX,o=r.getChildIdx;r.getV;var s=r.getVbyList,u=KJUR.crypto,l=u.ECDSA,c=u.DSA,f=RSAKey,d=pemtohex,p=KEYUTIL;if(typeof f!="undefined"&&n instanceof f||typeof l!="undefined"&&n instanceof l||typeof c!="undefined"&&n instanceof c)return n;if(n.curve!==void 0&&n.xy!==void 0&&n.d===void 0)return new l({pub:n.xy,curve:n.curve});if(n.curve!==void 0&&n.d!==void 0)return new l({prv:n.d,curve:n.curve});if(n.kty===void 0&&n.n!==void 0&&n.e!==void 0&&n.d===void 0){var v=new f;return v.setPublic(n.n,n.e),v}if(n.kty===void 0&&n.n!==void 0&&n.e!==void 0&&n.d!==void 0&&n.p!==void 0&&n.q!==void 0&&n.dp!==void 0&&n.dq!==void 0&&n.co!==void 0&&n.qi===void 0){var v=new f;return v.setPrivateEx(n.n,n.e,n.d,n.p,n.q,n.dp,n.dq,n.co),v}if(n.kty===void 0&&n.n!==void 0&&n.e!==void 0&&n.d!==void 0&&n.p===void 0){var v=new f;return v.setPrivate(n.n,n.e,n.d),v}if(n.p!==void 0&&n.q!==void 0&&n.g!==void 0&&n.y!==void 0&&n.x===void 0){var v=new c;return v.setPublic(n.p,n.q,n.g,n.y),v}if(n.p!==void 0&&n.q!==void 0&&n.g!==void 0&&n.y!==void 0&&n.x!==void 0){var v=new c;return v.setPrivate(n.p,n.q,n.g,n.y,n.x),v}if(n.kty==="RSA"&&n.n!==void 0&&n.e!==void 0&&n.d===void 0){var v=new f;return v.setPublic(b64utohex(n.n),b64utohex(n.e)),v}if(n.kty==="RSA"&&n.n!==void 0&&n.e!==void 0&&n.d!==void 0&&n.p!==void 0&&n.q!==void 0&&n.dp!==void 0&&n.dq!==void 0&&n.qi!==void 0){var v=new f;return v.setPrivateEx(b64utohex(n.n),b64utohex(n.e),b64utohex(n.d),b64utohex(n.p),b64utohex(n.q),b64utohex(n.dp),b64utohex(n.dq),b64utohex(n.qi)),v}if(n.kty==="RSA"&&n.n!==void 0&&n.e!==void 0&&n.d!==void 0){var v=new f;return v.setPrivate(b64utohex(n.n),b64utohex(n.e),b64utohex(n.d)),v}if(n.kty==="EC"&&n.crv!==void 0&&n.x!==void 0&&n.y!==void 0&&n.d===void 0){var g=new l({curve:n.crv}),h=g.ecparams.keylen/4,m=("0000000000"+b64utohex(n.x)).slice(-h),y=("0000000000"+b64utohex(n.y)).slice(-h),A="04"+m+y;return g.setPublicKeyHex(A),g}if(n.kty==="EC"&&n.crv!==void 0&&n.x!==void 0&&n.y!==void 0&&n.d!==void 0){var g=new l({curve:n.crv}),h=g.ecparams.keylen/4,m=("0000000000"+b64utohex(n.x)).slice(-h),y=("0000000000"+b64utohex(n.y)).slice(-h),A="04"+m+y,E=("0000000000"+b64utohex(n.d)).slice(-h);return g.setPublicKeyHex(A),g.setPrivateKeyHex(E),g}if(e==="pkcs5prv"){var b=n,r=ASN1HEX,T,v;if(T=o(b,0),T.length===9)v=new f,v.readPKCS5PrvKeyHex(b);else if(T.length===6)v=new c,v.readPKCS5PrvKeyHex(b);else if(T.length>2&&b.substr(T[1],2)==="04")v=new l,v.readPKCS5PrvKeyHex(b);else throw"unsupported PKCS#1/5 hexadecimal key";return v}if(e==="pkcs8prv"){var v=p.getKeyFromPlainPrivatePKCS8Hex(n);return v}if(e==="pkcs8pub")return p._getKeyFromPublicPKCS8Hex(n);if(e==="x509pub")return X509.getPublicKeyFromCertHex(n);if(n.indexOf("-END CERTIFICATE-",0)!=-1||n.indexOf("-END X509 CERTIFICATE-",0)!=-1||n.indexOf("-END TRUSTED CERTIFICATE-",0)!=-1)return X509.getPublicKeyFromCertPEM(n);if(n.indexOf("-END PUBLIC KEY-")!=-1){var _=pemtohex(n,"PUBLIC KEY");return p._getKeyFromPublicPKCS8Hex(_)}if(n.indexOf("-END RSA PRIVATE KEY-")!=-1&&n.indexOf("4,ENCRYPTED")==-1){var R=d(n,"RSA PRIVATE KEY");return p.getKey(R,null,"pkcs5prv")}if(n.indexOf("-END DSA PRIVATE KEY-")!=-1&&n.indexOf("4,ENCRYPTED")==-1){var S=d(n,"DSA PRIVATE KEY"),M=s(S,0,[1],"02"),B=s(S,0,[2],"02"),H=s(S,0,[3],"02"),w=s(S,0,[4],"02"),C=s(S,0,[5],"02"),v=new c;return v.setPrivate(new BigInteger(M,16),new BigInteger(B,16),new BigInteger(H,16),new BigInteger(w,16),new BigInteger(C,16)),v}if(n.indexOf("-END EC PRIVATE KEY-")!=-1&&n.indexOf("4,ENCRYPTED")==-1){var R=d(n,"EC PRIVATE KEY");return p.getKey(R,null,"pkcs5prv")}if(n.indexOf("-END PRIVATE KEY-")!=-1)return p.getKeyFromPlainPrivatePKCS8PEM(n);if(n.indexOf("-END RSA PRIVATE KEY-")!=-1&&n.indexOf("4,ENCRYPTED")!=-1){var L=p.getDecryptedKeyHex(n,t),I=new RSAKey;return I.readPKCS5PrvKeyHex(L),I}if(n.indexOf("-END EC PRIVATE KEY-")!=-1&&n.indexOf("4,ENCRYPTED")!=-1){var S=p.getDecryptedKeyHex(n,t),v=s(S,0,[1],"04"),F=s(S,0,[2,0],"06"),k=s(S,0,[3,0],"03").substr(2),N="";if(KJUR.crypto.OID.oidhex2name[F]!==void 0)N=KJUR.crypto.OID.oidhex2name[F];else throw"undefined OID(hex) in KJUR.crypto.OID: "+F;var g=new l({curve:N});return g.setPublicKeyHex(k),g.setPrivateKeyHex(v),g.isPublic=!1,g}if(n.indexOf("-END DSA PRIVATE KEY-")!=-1&&n.indexOf("4,ENCRYPTED")!=-1){var S=p.getDecryptedKeyHex(n,t),M=s(S,0,[1],"02"),B=s(S,0,[2],"02"),H=s(S,0,[3],"02"),w=s(S,0,[4],"02"),C=s(S,0,[5],"02"),v=new c;return v.setPrivate(new BigInteger(M,16),new BigInteger(B,16),new BigInteger(H,16),new BigInteger(w,16),new BigInteger(C,16)),v}if(n.indexOf("-END ENCRYPTED PRIVATE KEY-")!=-1)return p.getKeyFromEncryptedPKCS8PEM(n,t);throw new Error("not supported argument")},(typeof KJUR.asn1=="undefined"||!KJUR.asn1)&&(KJUR.asn1={}),KJUR.asn1.ASN1Util={},KJUR.asn1.ASN1Util.oidHexToInt=function(n){for(var o="",t=parseInt(n.substr(0,2),16),e=Math.floor(t/40),r=t%40,o=e+"."+r,s="",u=2;u<n.length;u+=2){var l=parseInt(n.substr(u,2),16),c=("00000000"+l.toString(2)).slice(-8);if(s=s+c.substr(1,7),c.substr(0,1)=="0"){var f=new BigInteger(s,2);o=o+"."+f.toString(10),s=""}}return o};var ASN1HEX=new function(){};ASN1HEX.getLblen=function(n,t){if(n.substr(t+2,1)!="8")return 1;var e=parseInt(n.substr(t+3,1));return e==0?-1:0<e&&e<10?e+1:-2},ASN1HEX.getL=function(n,t){var e=ASN1HEX.getLblen(n,t);return e<1?"":n.substr(t+2,e*2)},ASN1HEX.getVblen=function(n,t){var e,r;return e=ASN1HEX.getL(n,t),e==""?-1:(e.substr(0,1)==="8"?r=new BigInteger(e.substr(2),16):r=new BigInteger(e,16),r.intValue())},ASN1HEX.getVidx=function(n,t){var e=ASN1HEX.getLblen(n,t);return e<0?e:t+(e+1)*2},ASN1HEX.getV=function(n,t){var e=ASN1HEX.getVidx(n,t),r=ASN1HEX.getVblen(n,t);return n.substr(e,r*2)},ASN1HEX.getTLV=function(n,t){return n.substr(t,2)+ASN1HEX.getL(n,t)+ASN1HEX.getV(n,t)},ASN1HEX.getTLVblen=function(n,t){return 2+ASN1HEX.getLblen(n,t)*2+ASN1HEX.getVblen(n,t)*2},ASN1HEX.getNextSiblingIdx=function(n,t){var e=ASN1HEX.getVidx(n,t),r=ASN1HEX.getVblen(n,t);return e+r*2},ASN1HEX.getChildIdx=function(n,t){var e=ASN1HEX,r=[],o,s,u;o=e.getVidx(n,t),s=e.getVblen(n,t)*2,n.substr(t,2)=="03"&&(o+=2,s-=2),u=0;for(var l=o;u<=s;){var c=e.getTLVblen(n,l);if(u+=c,u<=s&&r.push(l),l+=c,u>=s)break}return r},ASN1HEX.getNthChildIdx=function(n,t,e){var r=ASN1HEX.getChildIdx(n,t);return r[e]},ASN1HEX.getIdxbyList=function(n,t,e,r){var o=ASN1HEX,s,u;return e.length==0?r!==void 0&&n.substr(t,2)!==r?-1:t:(s=e.shift(),u=o.getChildIdx(n,t),s>=u.length?-1:o.getIdxbyList(n,u[s],e,r))},ASN1HEX.getIdxbyListEx=function(n,t,e,r){var o=ASN1HEX,s,u;if(e.length==0)return r!==void 0&&n.substr(t,2)!==r?-1:t;s=e.shift(),u=o.getChildIdx(n,t);for(var l=0,c=0;c<u.length;c++){var f=n.substr(u[c],2);if(typeof s=="number"&&!o.isContextTag(f)&&l==s||typeof s=="string"&&o.isContextTag(f,s))return o.getIdxbyListEx(n,u[c],e,r);o.isContextTag(f)||l++}return-1},ASN1HEX.getTLVbyList=function(n,t,e,r){var o=ASN1HEX,s=o.getIdxbyList(n,t,e,r);return s==-1||s>=n.length?null:o.getTLV(n,s)},ASN1HEX.getTLVbyListEx=function(n,t,e,r){var o=ASN1HEX,s=o.getIdxbyListEx(n,t,e,r);return s==-1?null:o.getTLV(n,s)},ASN1HEX.getVbyList=function(n,t,e,r,o){var s=ASN1HEX,u,l;return u=s.getIdxbyList(n,t,e,r),u==-1||u>=n.length?null:(l=s.getV(n,u),o===!0&&(l=l.substr(2)),l)},ASN1HEX.getVbyListEx=function(n,t,e,r,o){var s=ASN1HEX,u,l;return u=s.getIdxbyListEx(n,t,e,r),u==-1?null:(l=s.getV(n,u),n.substr(u,2)=="03"&&o!==!1&&(l=l.substr(2)),l)},ASN1HEX.getInt=function(n,t,e){e==null&&(e=-1);try{var r=n.substr(t,2);if(r!="02"&&r!="03")return e;var o=ASN1HEX.getV(n,t);return r=="02"?parseInt(o,16):bitstrtoint(o)}catch(s){return e}},ASN1HEX.getOID=function(n,t,e){e==null&&(e=null);try{if(n.substr(t,2)!="06")return e;var r=ASN1HEX.getV(n,t);return hextooid(r)}catch(o){return e}},ASN1HEX.getOIDName=function(n,t,e){e==null&&(e=null);try{var r=ASN1HEX.getOID(n,t,e);if(r==e)return e;var o=KJUR.asn1.x509.OID.oid2name(r);return o==""?r:o}catch(s){return e}},ASN1HEX.getString=function(n,t,e){e==null&&(e=null);try{var r=ASN1HEX.getV(n,t);return hextorstr(r)}catch(o){return e}},ASN1HEX.hextooidstr=function(n){var t=function(p,v){return p.length>=v?p:new Array(v-p.length+1).join("0")+p},e=[],r=n.substr(0,2),o=parseInt(r,16);e[0]=new String(Math.floor(o/40)),e[1]=new String(o%40);for(var s=n.substr(2),u=[],l=0;l<s.length/2;l++)u.push(parseInt(s.substr(l*2,2),16));for(var c=[],f="",l=0;l<u.length;l++)u[l]&128?f=f+t((u[l]&127).toString(2),7):(f=f+t((u[l]&127).toString(2),7),c.push(new String(parseInt(f,2))),f="");var d=e.join(".");return c.length>0&&(d=d+"."+c.join(".")),d},ASN1HEX.isContextTag=function(n,t){n=n.toLowerCase();var e,r;try{e=parseInt(n,16)}catch(s){return-1}if(t===void 0)return(e&192)==128;try{var o=t.match(/^\[[0-9]+\]$/);return o==null||(r=parseInt(t.substr(1,t.length-1),10),r>31)?!1:(e&192)==128&&(e&31)==r}catch(s){return!1}},ASN1HEX.isASN1HEX=function(n){var t=ASN1HEX;if(n.length%2==1)return!1;var e=t.getVblen(n,0),r=n.substr(0,2),o=t.getL(n,0),s=n.length-r.length-o.length;return s==e*2},ASN1HEX.checkStrictDER=function(n,t,e,r,o){var s=ASN1HEX;if(e===void 0){if(typeof n!="string")throw new Error("not hex string");if(n=n.toLowerCase(),!KJUR.lang.String.isHex(n))throw new Error("not hex string");e=n.length,r=n.length/2,r<128?o=1:o=Math.ceil(r.toString(16))+1}var u=s.getL(n,t);if(u.length>o*2)throw new Error("L of TLV too long: idx="+t);var l=s.getVblen(n,t);if(l>r)throw new Error("value of L too long than hex: idx="+t);var c=s.getTLV(n,t),f=c.length-2-s.getL(n,t).length;if(f!==l*2)throw new Error("V string length and L's value not the same:"+f+"/"+l*2);if(t===0&&n.length!=c.length)throw new Error("total length and TLV length unmatch:"+n.length+"!="+c.length);var d=n.substr(t,2);if(d==="02"){var p=s.getVidx(n,t);if(n.substr(p,2)=="00"&&n.charCodeAt(p+2)<56)throw new Error("not least zeros for DER INTEGER")}if(parseInt(d,16)&32){for(var v=s.getVblen(n,t),g=0,h=s.getChildIdx(n,t),m=0;m<h.length;m++){var y=s.getTLV(n,h[m]);g+=y.length,s.checkStrictDER(n,h[m],e,r,o)}if(v*2!=g)throw new Error("sum of children's TLV length and L unmatch: "+v*2+"!="+g)}},ASN1HEX.oidname=function(n){var t=KJUR.asn1;KJUR.lang.String.isHex(n)&&(n=t.ASN1Util.oidHexToInt(n));var e=t.x509.OID.oid2name(n);return e===""&&(e=n),e},(typeof KJUR.asn1=="undefined"||!KJUR.asn1)&&(KJUR.asn1={}),(typeof KJUR.asn1.x509=="undefined"||!KJUR.asn1.x509)&&(KJUR.asn1.x509={}),KJUR.asn1.x509.AlgorithmIdentifier={},KJUR.asn1.x509.AlgorithmIdentifier.PSSNAME2ASN1TLV={SHAwithRSAandMGF1:"300d06092a864886f70d01010a3000",SHA256withRSAandMGF1:"303d06092a864886f70d01010a3030a00d300b0609608648016503040201a11a301806092a864886f70d010108300b0609608648016503040201a203020120",SHA384withRSAandMGF1:"303d06092a864886f70d01010a3030a00d300b0609608648016503040202a11a301806092a864886f70d010108300b0609608648016503040202a203020130",SHA512withRSAandMGF1:"303d06092a864886f70d01010a3030a00d300b0609608648016503040203a11a301806092a864886f70d010108300b0609608648016503040203a203020140"},KJUR.asn1.x509.OID=new function(n){this.atype2oidList={CN:"2.5.4.3",L:"2.5.4.7",ST:"2.5.4.8",O:"2.5.4.10",OU:"2.5.4.11",C:"2.5.4.6",STREET:"2.5.4.9",DC:"0.9.2342.19200300.100.1.25",UID:"0.9.2342.19200300.100.1.1",SN:"2.5.4.4",T:"2.5.4.12",DN:"2.5.4.49",E:"1.2.840.113549.1.9.1",description:"2.5.4.13",businessCategory:"2.5.4.15",postalCode:"2.5.4.17",serialNumber:"2.5.4.5",uniqueIdentifier:"2.5.4.45",organizationIdentifier:"2.5.4.97",jurisdictionOfIncorporationL:"1.3.6.1.4.1.311.60.2.1.1",jurisdictionOfIncorporationSP:"1.3.6.1.4.1.311.60.2.1.2",jurisdictionOfIncorporationC:"1.3.6.1.4.1.311.60.2.1.3"},this.name2oidList={sha1:"1.3.14.3.2.26",sha256:"2.16.840.1.101.3.4.2.1",sha384:"2.16.840.1.101.3.4.2.2",sha512:"2.16.840.1.101.3.4.2.3",sha224:"2.16.840.1.101.3.4.2.4",md5:"1.2.840.113549.2.5",md2:"1.3.14.7.2.2.1",ripemd160:"1.3.36.3.2.1",MD2withRSA:"1.2.840.113549.1.1.2",MD4withRSA:"1.2.840.113549.1.1.3",MD5withRSA:"1.2.840.113549.1.1.4",SHA1withRSA:"1.2.840.113549.1.1.5","pkcs1-MGF":"1.2.840.113549.1.1.8",rsaPSS:"1.2.840.113549.1.1.10",SHA224withRSA:"1.2.840.113549.1.1.14",SHA256withRSA:"1.2.840.113549.1.1.11",SHA384withRSA:"1.2.840.113549.1.1.12",SHA512withRSA:"1.2.840.113549.1.1.13",SHA1withECDSA:"1.2.840.10045.4.1",SHA224withECDSA:"1.2.840.10045.4.3.1",SHA256withECDSA:"1.2.840.10045.4.3.2",SHA384withECDSA:"1.2.840.10045.4.3.3",SHA512withECDSA:"1.2.840.10045.4.3.4",dsa:"1.2.840.10040.4.1",SHA1withDSA:"1.2.840.10040.4.3",SHA224withDSA:"2.16.840.1.101.3.4.3.1",SHA256withDSA:"2.16.840.1.101.3.4.3.2",rsaEncryption:"1.2.840.113549.1.1.1",commonName:"2.5.4.3",countryName:"2.5.4.6",localityName:"2.5.4.7",stateOrProvinceName:"2.5.4.8",streetAddress:"2.5.4.9",organizationName:"2.5.4.10",organizationalUnitName:"2.5.4.11",domainComponent:"0.9.2342.19200300.100.1.25",userId:"0.9.2342.19200300.100.1.1",surname:"2.5.4.4",givenName:"2.5.4.42",title:"2.5.4.12",distinguishedName:"2.5.4.49",emailAddress:"1.2.840.113549.1.9.1",description:"2.5.4.13",businessCategory:"2.5.4.15",postalCode:"2.5.4.17",uniqueIdentifier:"2.5.4.45",organizationIdentifier:"2.5.4.97",jurisdictionOfIncorporationL:"1.3.6.1.4.1.311.60.2.1.1",jurisdictionOfIncorporationSP:"1.3.6.1.4.1.311.60.2.1.2",jurisdictionOfIncorporationC:"1.3.6.1.4.1.311.60.2.1.3",subjectDirectoryAttributes:"2.5.29.9",subjectKeyIdentifier:"2.5.29.14",keyUsage:"2.5.29.15",subjectAltName:"2.5.29.17",issuerAltName:"2.5.29.18",basicConstraints:"2.5.29.19",cRLNumber:"2.5.29.20",cRLReason:"2.5.29.21",nameConstraints:"2.5.29.30",cRLDistributionPoints:"2.5.29.31",certificatePolicies:"2.5.29.32",anyPolicy:"2.5.29.32.0",authorityKeyIdentifier:"2.5.29.35",policyConstraints:"2.5.29.36",extKeyUsage:"2.5.29.37",authorityInfoAccess:"1.3.6.1.5.5.7.1.1",ocsp:"1.3.6.1.5.5.7.48.1",ocspBasic:"1.3.6.1.5.5.7.48.1.1",ocspNonce:"1.3.6.1.5.5.7.48.1.2",ocspNoCheck:"1.3.6.1.5.5.7.48.1.5",caIssuers:"1.3.6.1.5.5.7.48.2",anyExtendedKeyUsage:"2.5.29.37.0",serverAuth:"1.3.6.1.5.5.7.3.1",clientAuth:"1.3.6.1.5.5.7.3.2",codeSigning:"1.3.6.1.5.5.7.3.3",emailProtection:"1.3.6.1.5.5.7.3.4",timeStamping:"1.3.6.1.5.5.7.3.8",ocspSigning:"1.3.6.1.5.5.7.3.9",dateOfBirth:"1.3.6.1.5.5.7.9.1",placeOfBirth:"1.3.6.1.5.5.7.9.2",gender:"1.3.6.1.5.5.7.9.3",countryOfCitizenship:"1.3.6.1.5.5.7.9.4",countryOfResidence:"1.3.6.1.5.5.7.9.5",ecPublicKey:"1.2.840.10045.2.1","P-256":"1.2.840.10045.3.1.7",secp256r1:"1.2.840.10045.3.1.7",secp256k1:"1.3.132.0.10",secp384r1:"1.3.132.0.34",pkcs5PBES2:"1.2.840.113549.1.5.13",pkcs5PBKDF2:"1.2.840.113549.1.5.12","des-EDE3-CBC":"1.2.840.113549.3.7",data:"1.2.840.113549.1.7.1","signed-data":"1.2.840.113549.1.7.2","enveloped-data":"1.2.840.113549.1.7.3","digested-data":"1.2.840.113549.1.7.5","encrypted-data":"1.2.840.113549.1.7.6","authenticated-data":"1.2.840.113549.1.9.16.1.2",tstinfo:"1.2.840.113549.1.9.16.1.4",signingCertificate:"1.2.840.113549.1.9.16.2.12",timeStampToken:"1.2.840.113549.1.9.16.2.14",signaturePolicyIdentifier:"1.2.840.113549.1.9.16.2.15",etsArchiveTimeStamp:"1.2.840.113549.1.9.16.2.27",signingCertificateV2:"1.2.840.113549.1.9.16.2.47",etsArchiveTimeStampV2:"1.2.840.113549.1.9.16.2.48",extensionRequest:"1.2.840.113549.1.9.14",contentType:"1.2.840.113549.1.9.3",messageDigest:"1.2.840.113549.1.9.4",signingTime:"1.2.840.113549.1.9.5",counterSignature:"1.2.840.113549.1.9.6",archiveTimeStampV3:"0.4.0.1733.2.4",pdfRevocationInfoArchival:"1.2.840.113583.1.1.8",adobeTimeStamp:"1.2.840.113583.1.1.9.1"},this.objCache={},this.name2obj=function(t){if(typeof this.objCache[t]!="undefined")return this.objCache[t];if(typeof this.name2oidList[t]=="undefined")throw"Name of ObjectIdentifier not defined: "+t;var e=this.name2oidList[t],r=new KJUR.asn1.DERObjectIdentifier({oid:e});return this.objCache[t]=r,r},this.atype2obj=function(t){if(this.objCache[t]!==void 0)return this.objCache[t];var e;if(t.match(/^\d+\.\d+\.[0-9.]+$/))e=t;else if(this.atype2oidList[t]!==void 0)e=this.atype2oidList[t];else if(this.name2oidList[t]!==void 0)e=this.name2oidList[t];else throw"AttributeType name undefined: "+t;var r=new KJUR.asn1.DERObjectIdentifier({oid:e});return this.objCache[t]=r,r}},KJUR.asn1.x509.OID.oid2name=function(n){var t=KJUR.asn1.x509.OID.name2oidList;for(var e in t)if(t[e]==n)return e;return""},KJUR.asn1.x509.OID.oid2atype=function(n){var t=KJUR.asn1.x509.OID.atype2oidList;for(var e in t)if(t[e]==n)return e;return n},KJUR.asn1.x509.OID.name2oid=function(n){if(n.match(/^[0-9.]+$/))return n;var t=KJUR.asn1.x509.OID.name2oidList;return t[n]===void 0?"":t[n]},RSAKey.getPosArrayOfChildrenFromHex=function(n){return ASN1HEX.getChildIdx(n,0)},RSAKey.getHexValueArrayOfChildrenFromHex=function(n){var t=ASN1HEX,e=t.getV,v=RSAKey.getPosArrayOfChildrenFromHex(n),r=e(n,v[0]),o=e(n,v[1]),s=e(n,v[2]),u=e(n,v[3]),l=e(n,v[4]),c=e(n,v[5]),f=e(n,v[6]),d=e(n,v[7]),p=e(n,v[8]),v=new Array;return v.push(r,o,s,u,l,c,f,d,p),v},RSAKey.prototype.readPrivateKeyFromPEMString=function(n){var t=pemtohex(n),e=RSAKey.getHexValueArrayOfChildrenFromHex(t);this.setPrivateEx(e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])},RSAKey.prototype.readPKCS5PrvKeyHex=function(n){var t=RSAKey.getHexValueArrayOfChildrenFromHex(n);this.setPrivateEx(t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8])},RSAKey.prototype.readPKCS8PrvKeyHex=function(n){var t,e,r,o,s,u,l,c,f=ASN1HEX,d=f.getVbyListEx;if(f.isASN1HEX(n)===!1)throw new Error("not ASN.1 hex string");try{t=d(n,0,[2,0,1],"02"),e=d(n,0,[2,0,2],"02"),r=d(n,0,[2,0,3],"02"),o=d(n,0,[2,0,4],"02"),s=d(n,0,[2,0,5],"02"),u=d(n,0,[2,0,6],"02"),l=d(n,0,[2,0,7],"02"),c=d(n,0,[2,0,8],"02")}catch(p){throw new Error("malformed PKCS#8 plain RSA private key")}this.setPrivateEx(t,e,r,o,s,u,l,c)},RSAKey.prototype.readPKCS5PubKeyHex=function(n){var t=ASN1HEX,e=t.getV;if(t.isASN1HEX(n)===!1)throw new Error("keyHex is not ASN.1 hex string");var r=t.getChildIdx(n,0);if(r.length!==2||n.substr(r[0],2)!=="02"||n.substr(r[1],2)!=="02")throw new Error("wrong hex for PKCS#5 public key");var o=e(n,r[0]),s=e(n,r[1]);this.setPublic(o,s)},RSAKey.prototype.readPKCS8PubKeyHex=function(n){var t=ASN1HEX;if(t.isASN1HEX(n)===!1)throw new Error("not ASN.1 hex string");if(t.getTLVbyListEx(n,0,[0,0])!=="06092a864886f70d010101")throw new Error("not PKCS8 RSA public key");var e=t.getTLVbyListEx(n,0,[1,0]);this.readPKCS5PubKeyHex(e)},RSAKey.prototype.readCertPubKeyHex=function(n,t){var e,r;e=new X509,e.readCertHex(n),r=e.getPublicKeyHex(),this.readPKCS8PubKeyHex(r)};function _rsasign_getAlgNameAndHashFromHexDisgestInfo(n){for(var t in KJUR.crypto.Util.DIGESTINFOHEAD){var e=KJUR.crypto.Util.DIGESTINFOHEAD[t],r=e.length;if(n.substring(0,r)==e){var o=[t,n.substring(r)];return o}}return[]}RSAKey.prototype.verify=function(n,t){if(t=t.toLowerCase(),t.match(/^[0-9a-f]+$/)==null)return!1;var e=parseBigInt(t,16),r=this.n.bitLength();if(e.bitLength()>r)return!1;var o=this.doPublic(e),s=o.toString(16);if(s.length+3!=r/4)return!1;var u=s.replace(/^1f+00/,""),l=_rsasign_getAlgNameAndHashFromHexDisgestInfo(u);if(l.length==0)return!1;var c=l[0],f=l[1],d=function(v){return KJUR.crypto.Util.hashString(v,c)},p=d(n);return f==p},RSAKey.prototype.verifyWithMessageHash=function(n,t){if(t.length!=Math.ceil(this.n.bitLength()/4))return!1;var e=parseBigInt(t,16);if(e.bitLength()>this.n.bitLength())return 0;var r=this.doPublic(e),o=r.toString(16).replace(/^1f+00/,""),s=_rsasign_getAlgNameAndHashFromHexDisgestInfo(o);if(s.length==0)return!1;s[0];var u=s[1];return u==n},RSAKey.prototype.verifyPSS=function(n,t,e,r){var o=function(u){return KJUR.crypto.Util.hashHex(u,e)},s=o(rstrtohex(n));return r===void 0&&(r=-1),this.verifyWithMessageHashPSS(s,t,e,r)},RSAKey.prototype.verifyWithMessageHashPSS=function(n,t,e,r){if(t.length!=Math.ceil(this.n.bitLength()/4))return!1;var o=new BigInteger(t,16),s=function(E){return KJUR.crypto.Util.hashHex(E,e)},u=hextorstr(n),l=u.length,c=this.n.bitLength()-1,f=Math.ceil(c/8),d;if(r===-1||r===void 0)r=l;else if(r===-2)r=f-l-2;else if(r<-2)throw new Error("invalid salt length");if(f<l+r+2)throw new Error("data too long");var p=this.doPublic(o).toByteArray();for(d=0;d<p.length;d+=1)p[d]&=255;for(;p.length<f;)p.unshift(0);if(p[f-1]!==188)throw new Error("encoded message does not end in 0xbc");p=String.fromCharCode.apply(String,p);var v=p.substr(0,f-l-1),g=p.substr(v.length,l),h=65280>>8*f-c&255;if(v.charCodeAt(0)&h)throw new Error("bits beyond keysize not zero");var m=pss_mgf1_str(g,v.length,s),y=[];for(d=0;d<v.length;d+=1)y[d]=v.charCodeAt(d)^m.charCodeAt(d);y[0]&=~h;var A=f-l-r-2;for(d=0;d<A;d+=1)if(y[d]!==0)throw new Error("leftmost octets not zero");if(y[A]!==1)throw new Error("0x01 marker not found");return g===hextorstr(s(rstrtohex("\0\0\0\0\0\0\0\0"+u+String.fromCharCode.apply(String,y.slice(-r)))))},RSAKey.SALT_LEN_HLEN=-1,RSAKey.SALT_LEN_MAX=-2,RSAKey.SALT_LEN_RECOVER=-2;function X509(n){var t=ASN1HEX,e=t.getChildIdx,r=t.getV,o=t.getTLV,s=t.getVbyList,u=t.getVbyListEx,l=t.getTLVbyList,c=t.getTLVbyListEx,f=t.getIdxbyList,d=t.getIdxbyListEx,p=t.getVidx,v=t.getInt,g=t.oidname,h=t.hextooidstr,m=pemtohex,y;try{y=KJUR.asn1.x509.AlgorithmIdentifier.PSSNAME2ASN1TLV}catch(A){}this.HEX2STAG={"0c":"utf8",13:"prn",16:"ia5","1a":"vis","1e":"bmp"},this.hex=null,this.version=0,this.foffset=0,this.aExtInfo=null,this.getVersion=function(){if(this.hex===null||this.version!==0)return this.version;var A=l(this.hex,0,[0,0]);if(A.substr(0,2)=="a0"){var E=l(A,0,[0]),b=v(E,0);if(b<0||2<b)throw new Error("malformed version field");return this.version=b+1,this.version}else return this.version=1,this.foffset=-1,1},this.getSerialNumberHex=function(){return u(this.hex,0,[0,0],"02")},this.getSignatureAlgorithmField=function(){var A=c(this.hex,0,[0,1]);return this.getAlgorithmIdentifierName(A)},this.getAlgorithmIdentifierName=function(A){for(var E in y)if(A===y[E])return E;return g(u(A,0,[0],"06"))},this.getIssuer=function(){return this.getX500Name(this.getIssuerHex())},this.getIssuerHex=function(){return l(this.hex,0,[0,3+this.foffset],"30")},this.getIssuerString=function(){var A=this.getIssuer();return A.str},this.getSubject=function(){return this.getX500Name(this.getSubjectHex())},this.getSubjectHex=function(){return l(this.hex,0,[0,5+this.foffset],"30")},this.getSubjectString=function(){var A=this.getSubject();return A.str},this.getNotBefore=function(){var A=s(this.hex,0,[0,4+this.foffset,0]);return A=A.replace(/(..)/g,"%$1"),A=decodeURIComponent(A),A},this.getNotAfter=function(){var A=s(this.hex,0,[0,4+this.foffset,1]);return A=A.replace(/(..)/g,"%$1"),A=decodeURIComponent(A),A},this.getPublicKeyHex=function(){return t.getTLVbyList(this.hex,0,[0,6+this.foffset],"30")},this.getPublicKeyIdx=function(){return f(this.hex,0,[0,6+this.foffset],"30")},this.getPublicKeyContentIdx=function(){var A=this.getPublicKeyIdx();return f(this.hex,A,[1,0],"30")},this.getPublicKey=function(){return KEYUTIL.getKey(this.getPublicKeyHex(),null,"pkcs8pub")},this.getSignatureAlgorithmName=function(){var A=l(this.hex,0,[1],"30");return this.getAlgorithmIdentifierName(A)},this.getSignatureValueHex=function(){return s(this.hex,0,[2],"03",!0)},this.verifySignature=function(A){var E=this.getSignatureAlgorithmField(),b=this.getSignatureValueHex(),T=l(this.hex,0,[0],"30"),_=new KJUR.crypto.Signature({alg:E});return _.init(A),_.updateHex(T),_.verify(b)},this.parseExt=function(A){var E,b,T;if(A===void 0){if(T=this.hex,this.version!==3)return-1;E=f(T,0,[0,7,0],"30"),b=e(T,E)}else{T=pemtohex(A);var _=f(T,0,[0,3,0,0],"06");if(r(T,_)!="2a864886f70d01090e"){this.aExtInfo=new Array;return}E=f(T,0,[0,3,0,1,0],"30"),b=e(T,E),this.hex=T}this.aExtInfo=new Array;for(var R=0;R<b.length;R++){var S={};S.critical=!1;var M=e(T,b[R]),B=0;M.length===3&&(S.critical=!0,B=1),S.oid=t.hextooidstr(s(T,b[R],[0],"06"));var H=f(T,b[R],[1+B]);S.vidx=p(T,H),this.aExtInfo.push(S)}},this.getExtInfo=function(A){var E=this.aExtInfo,b=A;if(A.match(/^[0-9.]+$/)||(b=KJUR.asn1.x509.OID.name2oid(A)),b!==""){for(var T=0;T<E.length;T++)if(E[T].oid===b)return E[T]}},this.getExtBasicConstraints=function(A,E){if(A===void 0&&E===void 0){var b=this.getExtInfo("basicConstraints");if(b===void 0)return;A=o(this.hex,b.vidx),E=b.critical}var T={extname:"basicConstraints"};if(E&&(T.critical=!0),A==="3000")return T;if(A==="30030101ff")return T.cA=!0,T;if(A.substr(0,12)==="30060101ff02"){var _=r(A,10),R=parseInt(_,16);return T.cA=!0,T.pathLen=R,T}throw new Error("hExtV parse error: "+A)},this.getExtKeyUsage=function(A,E){if(A===void 0&&E===void 0){var b=this.getExtInfo("keyUsage");if(b===void 0)return;A=o(this.hex,b.vidx),E=b.critical}var T={extname:"keyUsage"};return E&&(T.critical=!0),T.names=this.getExtKeyUsageString(A).split(","),T},this.getExtKeyUsageBin=function(A){if(A===void 0){var E=this.getExtInfo("keyUsage");if(E===void 0)return"";A=o(this.hex,E.vidx)}if(A.length!=8&&A.length!=10)throw new Error("malformed key usage value: "+A);var b="000000000000000"+parseInt(A.substr(6),16).toString(2);return A.length==8&&(b=b.slice(-8)),A.length==10&&(b=b.slice(-16)),b=b.replace(/0+$/,""),b==""&&(b="0"),b},this.getExtKeyUsageString=function(A){for(var E=this.getExtKeyUsageBin(A),b=new Array,T=0;T<E.length;T++)E.substr(T,1)=="1"&&b.push(X509.KEYUSAGE_NAME[T]);return b.join(",")},this.getExtSubjectKeyIdentifier=function(A,E){if(A===void 0&&E===void 0){var b=this.getExtInfo("subjectKeyIdentifier");if(b===void 0)return;A=o(this.hex,b.vidx),E=b.critical}var T={extname:"subjectKeyIdentifier"};E&&(T.critical=!0);var _=r(A,0);return T.kid={hex:_},T},this.getExtAuthorityKeyIdentifier=function(A,E){if(A===void 0&&E===void 0){var b=this.getExtInfo("authorityKeyIdentifier");if(b===void 0)return;A=o(this.hex,b.vidx),E=b.critical}var T={extname:"authorityKeyIdentifier"};E&&(T.critical=!0);for(var _=e(A,0),R=0;R<_.length;R++){var S=A.substr(_[R],2);if(S==="80"&&(T.kid={hex:r(A,_[R])}),S==="a1"){var M=o(A,_[R]),B=this.getGeneralNames(M);T.issuer=B[0].dn}S==="82"&&(T.sn={hex:r(A,_[R])})}return T},this.getExtExtKeyUsage=function(A,E){if(A===void 0&&E===void 0){var b=this.getExtInfo("extKeyUsage");if(b===void 0)return;A=o(this.hex,b.vidx),E=b.critical}var T={extname:"extKeyUsage",array:[]};E&&(T.critical=!0);for(var _=e(A,0),R=0;R<_.length;R++)T.array.push(g(r(A,_[R])));return T},this.getExtExtKeyUsageName=function(){var A=this.getExtInfo("extKeyUsage");if(A===void 0)return A;var E=new Array,b=o(this.hex,A.vidx);if(b==="")return E;for(var T=e(b,0),_=0;_<T.length;_++)E.push(g(r(b,T[_])));return E},this.getExtSubjectAltName=function(A,E){if(A===void 0&&E===void 0){var b=this.getExtInfo("subjectAltName");if(b===void 0)return;A=o(this.hex,b.vidx),E=b.critical}var T={extname:"subjectAltName",array:[]};return E&&(T.critical=!0),T.array=this.getGeneralNames(A),T},this.getExtIssuerAltName=function(A,E){if(A===void 0&&E===void 0){var b=this.getExtInfo("issuerAltName");if(b===void 0)return;A=o(this.hex,b.vidx),E=b.critical}var T={extname:"issuerAltName",array:[]};return E&&(T.critical=!0),T.array=this.getGeneralNames(A),T},this.getGeneralNames=function(A){for(var E=e(A,0),b=[],T=0;T<E.length;T++){var _=this.getGeneralName(o(A,E[T]));_!==void 0&&b.push(_)}return b},this.getGeneralName=function(A){var E=A.substr(0,2),b=r(A,0),T=hextorstr(b);if(E=="81")return{rfc822:T};if(E=="82")return{dns:T};if(E=="86")return{uri:T};if(E=="87")return{ip:hextoip(b)};if(E=="a4")return{dn:this.getX500Name(b)}},this.getExtSubjectAltName2=function(){var A,E,b,T=this.getExtInfo("subjectAltName");if(T===void 0)return T;for(var _=new Array,R=o(this.hex,T.vidx),S=e(R,0),M=0;M<S.length;M++)b=R.substr(S[M],2),A=r(R,S[M]),b==="81"&&(E=hextoutf8(A),_.push(["MAIL",E])),b==="82"&&(E=hextoutf8(A),_.push(["DNS",E])),b==="84"&&(E=X509.hex2dn(A,0),_.push(["DN",E])),b==="86"&&(E=hextoutf8(A),_.push(["URI",E])),b==="87"&&(E=hextoip(A),_.push(["IP",E]));return _},this.getExtCRLDistributionPoints=function(A,E){if(A===void 0&&E===void 0){var b=this.getExtInfo("cRLDistributionPoints");if(b===void 0)return;A=o(this.hex,b.vidx),E=b.critical}var T={extname:"cRLDistributionPoints",array:[]};E&&(T.critical=!0);for(var _=e(A,0),R=0;R<_.length;R++){var S=o(A,_[R]);T.array.push(this.getDistributionPoint(S))}return T},this.getDistributionPoint=function(A){for(var E={},b=e(A,0),T=0;T<b.length;T++){var _=A.substr(b[T],2),R=o(A,b[T]);_=="a0"&&(E.dpname=this.getDistributionPointName(R))}return E},this.getDistributionPointName=function(A){for(var E={},b=e(A,0),T=0;T<b.length;T++){var _=A.substr(b[T],2),R=o(A,b[T]);_=="a0"&&(E.full=this.getGeneralNames(R))}return E},this.getExtCRLDistributionPointsURI=function(){var A=this.getExtInfo("cRLDistributionPoints");if(A===void 0)return A;for(var E=new Array,b=e(this.hex,A.vidx),T=0;T<b.length;T++)try{var _=s(this.hex,b[T],[0,0,0],"86"),R=hextoutf8(_);E.push(R)}catch(S){}return E},this.getExtAIAInfo=function(){var A=this.getExtInfo("authorityInfoAccess");if(A===void 0)return A;for(var E={ocsp:[],caissuer:[]},b=e(this.hex,A.vidx),T=0;T<b.length;T++){var _=s(this.hex,b[T],[0],"06"),R=s(this.hex,b[T],[1],"86");_==="2b06010505073001"&&E.ocsp.push(hextoutf8(R)),_==="2b06010505073002"&&E.caissuer.push(hextoutf8(R))}return E},this.getExtAuthorityInfoAccess=function(A,E){if(A===void 0&&E===void 0){var b=this.getExtInfo("authorityInfoAccess");if(b===void 0)return;A=o(this.hex,b.vidx),E=b.critical}var T={extname:"authorityInfoAccess",array:[]};E&&(T.critical=!0);for(var _=e(A,0),R=0;R<_.length;R++){var S=u(A,_[R],[0],"06"),M=s(A,_[R],[1],"86"),B=hextoutf8(M);if(S=="2b06010505073001")T.array.push({ocsp:B});else if(S=="2b06010505073002")T.array.push({caissuer:B});else throw new Error("unknown method: "+S)}return T},this.getExtCertificatePolicies=function(A,E){if(A===void 0&&E===void 0){var b=this.getExtInfo("certificatePolicies");if(b===void 0)return;A=o(this.hex,b.vidx),E=b.critical}var T={extname:"certificatePolicies",array:[]};E&&(T.critical=!0);for(var _=e(A,0),R=0;R<_.length;R++){var S=o(A,_[R]),M=this.getPolicyInformation(S);T.array.push(M)}return T},this.getPolicyInformation=function(A){var E={},b=s(A,0,[0],"06");E.policyoid=g(b);var T=d(A,0,[1],"30");if(T!=-1){E.array=[];for(var _=e(A,T),R=0;R<_.length;R++){var S=o(A,_[R]),M=this.getPolicyQualifierInfo(S);E.array.push(M)}}return E},this.getPolicyQualifierInfo=function(A){var E={},b=s(A,0,[0],"06");if(b==="2b06010505070201"){var T=u(A,0,[1],"16");E.cps=hextorstr(T)}else if(b==="2b06010505070202"){var _=l(A,0,[1],"30");E.unotice=this.getUserNotice(_)}return E},this.getUserNotice=function(A){for(var E={},b=e(A,0),T=0;T<b.length;T++){var _=o(A,b[T]);_.substr(0,2)!="30"&&(E.exptext=this.getDisplayText(_))}return E},this.getDisplayText=function(A){var E={"0c":"utf8",16:"ia5","1a":"vis","1e":"bmp"},b={};return b.type=E[A.substr(0,2)],b.str=hextorstr(r(A,0)),b},this.getExtCRLNumber=function(A,E){var b={extname:"cRLNumber"};if(E&&(b.critical=!0),A.substr(0,2)=="02")return b.num={hex:r(A,0)},b;throw new Error("hExtV parse error: "+A)},this.getExtCRLReason=function(A,E){var b={extname:"cRLReason"};if(E&&(b.critical=!0),A.substr(0,2)=="0a")return b.code=parseInt(r(A,0),16),b;throw new Error("hExtV parse error: "+A)},this.getExtOcspNonce=function(A,E){var b={extname:"ocspNonce"};E&&(b.critical=!0);var T=r(A,0);return b.hex=T,b},this.getExtOcspNoCheck=function(A,E){var b={extname:"ocspNoCheck"};return E&&(b.critical=!0),b},this.getExtAdobeTimeStamp=function(A,E){if(A===void 0&&E===void 0){var b=this.getExtInfo("adobeTimeStamp");if(b===void 0)return;A=o(this.hex,b.vidx),E=b.critical}var T={extname:"adobeTimeStamp"};E&&(T.critical=!0);var _=e(A,0);if(_.length>1){var R=o(A,_[1]),S=this.getGeneralName(R);S.uri!=null&&(T.uri=S.uri)}if(_.length>2){var M=o(A,_[2]);M=="0101ff"&&(T.reqauth=!0),M=="010100"&&(T.reqauth=!1)}return T},this.getX500NameRule=function(A){for(var E=null,b=[],T=0;T<A.length;T++)for(var _=A[T],R=0;R<_.length;R++)b.push(_[R]);for(var T=0;T<b.length;T++){var S=b[T],M=S.ds,B=S.value,H=S.type;if(M!="prn"&&M!="utf8"&&M!="ia5")return"mixed";if(M=="ia5"){if(H!="CN")return"mixed";if(KJUR.lang.String.isMail(B))continue;return"mixed"}if(H=="C"){if(M=="prn")continue;return"mixed"}if(E==null)E=M;else if(E!==M)return"mixed"}return E==null?"prn":E},this.getX500Name=function(A){var E=this.getX500NameArray(A),b=this.dnarraytostr(E);return{array:E,str:b}},this.getX500NameArray=function(A){for(var E=[],b=e(A,0),T=0;T<b.length;T++)E.push(this.getRDN(o(A,b[T])));return E},this.getRDN=function(A){for(var E=[],b=e(A,0),T=0;T<b.length;T++)E.push(this.getAttrTypeAndValue(o(A,b[T])));return E},this.getAttrTypeAndValue=function(A){var E={type:null,value:null,ds:null},b=e(A,0),T=s(A,b[0],[],"06"),_=s(A,b[1],[]),R=KJUR.asn1.ASN1Util.oidHexToInt(T);return E.type=KJUR.asn1.x509.OID.oid2atype(R),E.ds=this.HEX2STAG[A.substr(b[1],2)],E.ds!="bmp"?E.value=hextoutf8(_):E.value=ucs2hextoutf8(_),E},this.readCertPEM=function(A){this.readCertHex(m(A))},this.readCertHex=function(A){this.hex=A,this.getVersion();try{f(this.hex,0,[0,7],"a3"),this.parseExt()}catch(E){}},this.getParam=function(){var A={};return A.version=this.getVersion(),A.serial={hex:this.getSerialNumberHex()},A.sigalg=this.getSignatureAlgorithmField(),A.issuer=this.getIssuer(),A.notbefore=this.getNotBefore(),A.notafter=this.getNotAfter(),A.subject=this.getSubject(),A.sbjpubkey=hextopem(this.getPublicKeyHex(),"PUBLIC KEY"),this.aExtInfo.length>0&&(A.ext=this.getExtParamArray()),A.sighex=this.getSignatureValueHex(),A},this.getExtParamArray=function(A){if(A==null){var E=d(this.hex,0,[0,"[3]"]);E!=-1&&(A=c(this.hex,0,[0,"[3]",0],"30"))}for(var b=[],T=e(A,0),_=0;_<T.length;_++){var R=o(A,T[_]),S=this.getExtParam(R);S!=null&&b.push(S)}return b},this.getExtParam=function(A){var E=e(A,0),b=E.length;if(b!=2&&b!=3)throw new Error("wrong number elements in Extension: "+b+" "+A);var T=h(s(A,0,[0],"06")),_=!1;b==3&&l(A,0,[1])=="0101ff"&&(_=!0);var R=l(A,0,[b-1,0]),S=void 0;if(T=="2.5.29.14"?S=this.getExtSubjectKeyIdentifier(R,_):T=="2.5.29.15"?S=this.getExtKeyUsage(R,_):T=="2.5.29.17"?S=this.getExtSubjectAltName(R,_):T=="2.5.29.18"?S=this.getExtIssuerAltName(R,_):T=="2.5.29.19"?S=this.getExtBasicConstraints(R,_):T=="2.5.29.31"?S=this.getExtCRLDistributionPoints(R,_):T=="2.5.29.32"?S=this.getExtCertificatePolicies(R,_):T=="2.5.29.35"?S=this.getExtAuthorityKeyIdentifier(R,_):T=="2.5.29.37"?S=this.getExtExtKeyUsage(R,_):T=="1.3.6.1.5.5.7.1.1"?S=this.getExtAuthorityInfoAccess(R,_):T=="2.5.29.20"?S=this.getExtCRLNumber(R,_):T=="2.5.29.21"?S=this.getExtCRLReason(R,_):T=="1.3.6.1.5.5.7.48.1.2"?S=this.getExtOcspNonce(R,_):T=="1.3.6.1.5.5.7.48.1.5"?S=this.getExtOcspNoCheck(R,_):T=="1.2.840.113583.1.1.9.1"&&(S=this.getExtAdobeTimeStamp(R,_)),S!=null)return S;var M={extname:T,extn:R};return _&&(M.critical=!0),M},this.findExt=function(A,E){for(var b=0;b<A.length;b++)if(A[b].extname==E)return A[b];return null},this.dnarraytostr=function(A){function E(T){return T.map(function(_){return b(_).replace(/\+/,"\\+")}).join("+")}function b(T){return T.type+"="+T.value}return"/"+A.map(function(T){return E(T).replace(/\//,"\\/")}).join("/")},this.getInfo=function(){var A=function(D){var U=JSON.stringify(D.array).replace(/[\[\]\{\}\"]/g,"");return U},E=function(D){for(var U="",z=D.array,G=0;G<z.length;G++){var q=z[G];if(U+=" policy oid: "+q.policyoid+`
|
|
363
|
+
`,q.array!==void 0)for(var K=0;K<q.array.length;K++){var j=q.array[K];j.cps!==void 0&&(U+=" cps: "+j.cps+`
|
|
364
|
+
`)}}return U},b=function(D){for(var U="",z=D.array,G=0;G<z.length;G++){var q=z[G];try{q.dpname.full[0].uri!==void 0&&(U+=" "+q.dpname.full[0].uri+`
|
|
365
|
+
`)}catch(K){}try{q.dname.full[0].dn.hex!==void 0&&(U+=" "+X509.hex2dn(q.dpname.full[0].dn.hex)+`
|
|
366
|
+
`)}catch(K){}}return U},T=function(D){for(var U="",z=D.array,G=0;G<z.length;G++){var q=z[G];q.caissuer!==void 0&&(U+=" caissuer: "+q.caissuer+`
|
|
367
|
+
`),q.ocsp!==void 0&&(U+=" ocsp: "+q.ocsp+`
|
|
368
368
|
`)}return U},_,R,S;if(_=`Basic Fields
|
|
369
369
|
`,_+=" serial number: "+this.getSerialNumberHex()+`
|
|
370
370
|
`,_+=" signature algorithm: "+this.getSignatureAlgorithmField()+`
|
|
@@ -388,7 +388,7 @@
|
|
|
388
388
|
`}else if(H==="cRLDistributionPoints"){var k=this.getExtCRLDistributionPoints();_+=b(k)}else if(H==="authorityInfoAccess"){var N=this.getExtAuthorityInfoAccess();_+=T(N)}else H==="certificatePolicies"&&(_+=E(this.getExtCertificatePolicies()))}}return _+="signature algorithm: "+this.getSignatureAlgorithmName()+`
|
|
389
389
|
`,_+="signature: "+this.getSignatureValueHex().substr(0,16)+`...
|
|
390
390
|
`,_},typeof n=="string"&&(n.indexOf("-----BEGIN")!=-1?this.readCertPEM(n):KJUR.lang.String.isHex(n)&&this.readCertHex(n))}X509.hex2dn=function(n,t){t===void 0&&(t=0);var e=new X509;ASN1HEX.getTLV(n,t);var r=e.getX500Name(n);return r.str},X509.hex2rdn=function(n,t){if(t===void 0&&(t=0),n.substr(t,2)!=="31")throw new Error("malformed RDN");for(var e=new Array,r=ASN1HEX.getChildIdx(n,t),o=0;o<r.length;o++)e.push(X509.hex2attrTypeValue(n,r[o]));return e=e.map(function(s){return s.replace("+","\\+")}),e.join("+")},X509.hex2attrTypeValue=function(n,t){var e=ASN1HEX,r=e.getV;if(t===void 0&&(t=0),n.substr(t,2)!=="30")throw new Error("malformed attribute type and value");var o=e.getChildIdx(n,t);o.length!==2||n.substr(o[0],2);var s=r(n,o[0]),u=KJUR.asn1.ASN1Util.oidHexToInt(s),l=KJUR.asn1.x509.OID.oid2atype(u),c=r(n,o[1]),f=hextorstr(c);return l+"="+f},X509.getPublicKeyFromCertHex=function(n){var t=new X509;return t.readCertHex(n),t.getPublicKey()},X509.getPublicKeyFromCertPEM=function(n){var t=new X509;return t.readCertPEM(n),t.getPublicKey()},X509.getPublicKeyInfoPropOfCertPEM=function(n){var t=ASN1HEX,e=t.getVbyList,r={},o,s;return r.algparam=null,o=new X509,o.readCertPEM(n),s=o.getPublicKeyHex(),r.keyhex=e(s,0,[1],"03").substr(2),r.algoid=e(s,0,[0,0],"06"),r.algoid==="2a8648ce3d0201"&&(r.algparam=e(s,0,[0,1],"06")),r},X509.KEYUSAGE_NAME=["digitalSignature","nonRepudiation","keyEncipherment","dataEncipherment","keyAgreement","keyCertSign","cRLSign","encipherOnly","decipherOnly"];function sha256(n){return CryptoJS.SHA256(n).toString()}var certificates=[function(){var n=new X509;return n.readCertPEM(function(){var t=113,e=126,r=0,o="";return arguments[r].split(o).map(function(s){return s.charCodeAt(r)>e?s:String.fromCharCode((s.charCodeAt(r)+t)%e)}).join(o)}(":::::ORTV[-PR_aVSVPNaR:::::ZVVS@ PPNErtNVONtVWNZR}@]nU\0ZaZN=TP`\0T`Vo@Q^ROPbNZVTSZ^P^fQc^^TRWQawR^ZNATN>bRPNU^zc}nzyg R^ZNATN>bROU^zc}nzyg R]ZN=TN>bRPtTn?bf?FZ_NQtfQc^^YQNq`gdSp?cyZ^P^fQc^^QQNWQ^aRvZPNTP`\0T`Vo@Q^RWN_fapzFqSFwfbOndSnzyuYz[oaNrS=\x07\\QN>Z N\\Q^B[QqnS=\b\\QN>Zwp\\Q^B[QqnZVTSZ^P^fQc^^TRWQawR^ZNATN>bRPNU^zc}nzyg R^ZNATN>bROU^zc}nzyg R]ZN=TN>bRPtTn?bf?FZ_NQtfQc^^YQNq`gdSp?cyZ^P^fQc^^QQNWQ^aRvZPNTP`\0T`Vo@Q^RWN_fapzFqSFwfbOndSnzyuYz[oaPPNvVQ^fWX|gVup[N^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[rEU?x\bf>V OUwY=>X[\\E`tW[8}VwpF\x07BQcnrPF}yUtd8<Doe_\b[oOVU\x07ep@pYY\0cegY{r ?\bAbq?ff8}UaXoN_D]_X_8yozYFT`N{`\\{zvu?\bDWT}=_<\x07StX Nx\x07\0\b \0aT=c@ucnWfR[vf>RFxAFV}{N`dN^\\<eawBPxx}quT=|{T_R@Fp^Y<ZevRsWaZ]V CVrRVtAAc[ Qp|d|tqoQ=T|XX =u\\N8XNCx\\aU>wz X<e@Vc?dy\\|^FEq|=p`pBdF@bs^d<]vp\\^TZ P\bZ\b\\YNNSZ_\\w^|TsD8db _ Y\\o^Cw>Z\0x\\^aN]wWf\bA} C^d_{\x07ZC@\by]gY@E BFY?OsaqbDcVgQbZeFc ovtucxnq|<TnuyXRveYFOegCpAs{YTe|>bE<OXsSqCBWD_SVepfvCCUg]z ZvQ[\0s|U>pFz\b=OwT``fNJJ:::::R[Q-PR_aVSVPNaR:::::")),n}()];function getCertificateBySubjectHex(n,t){for(var e=0,r=t;e<r.length;e++){var o=r[e];if(o.getSubjectHex()===n)return o}}function verifyCertificate_(n,t){var e=n.getIssuerHex();if(e===n.getSubjectHex())return n.verifySignature(n.getPublicKey());var r=getCertificateBySubjectHex(e,t);return!r||n.verifySignature(r.getPublicKey())===!1?!1:verifyCertificate_(r,t)}function verifyCertificate(n){var t=n.getIssuerHex();return t===n.getSubjectHex()?!1:verifyCertificate_(n,certificates)}function addCertificate(n){var t=new X509;typeof n=="string"?t.readCertPEM(n):t.readCertHex(n.hex);var e=verifyCertificate(t);return certificates.push(t),e}function verifyMessage(n,t,e){var r=new X509;if(typeof e=="string"?r.readCertPEM(e):r.readCertHex(e.hex),verifyCertificate(r)===!1)return!1;var o=new RSAKey;return o.readCertPubKeyHex(r.hex,6),!!o.verify(n,b64tohex(t))}addCertificate(function(){var t=113,e=126,r=0,o="";return arguments[r].split(o).map(function(s){return s.charCodeAt(r)>e?s:String.fromCharCode((s.charCodeAt(r)+t)%e)}).join(o)}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Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])},extendStatics(n,t)};function __extends(n,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");extendStatics(n,t);function e(){this.constructor=n}n.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}var __assign=function(){return __assign=Object.assign||function(t){for(var e,r=1,o=arguments.length;r<o;r++){e=arguments[r];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(t[s]=e[s])}return t},__assign.apply(this,arguments)};function __decorate(n,t,e,r){var o=arguments.length,s=o<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,r);else for(var l=n.length-1;l>=0;l--)(u=n[l])&&(s=(o<3?u(s):o>3?u(t,e,s):u(t,e))||s);return o>3&&s&&Object.defineProperty(t,e,s),s}function __metadata(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)}function __awaiter(n,t,e,r){function o(s){return s instanceof e?s:new e(function(u){u(s)})}return new(e||(e=Promise))(function(s,u){function l(d){try{f(r.next(d))}catch(p){u(p)}}function c(d){try{f(r.throw(d))}catch(p){u(p)}}function f(d){d.done?s(d.value):o(d.value).then(l,c)}f((r=r.apply(n,t||[])).next())})}function __generator(n,t){var e={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},r,o,s,u=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return u.next=l(0),u.throw=l(1),u.return=l(2),typeof Symbol=="function"&&(u[Symbol.iterator]=function(){return this}),u;function l(f){return function(d){return c([f,d])}}function c(f){if(r)throw new TypeError("Generator is already executing.");for(;u&&(u=0,f[0]&&(e=0)),e;)try{if(r=1,o&&(s=f[0]&2?o.return:f[0]?o.throw||((s=o.return)&&s.call(o),0):o.next)&&!(s=s.call(o,f[1])).done)return s;switch(o=0,s&&(f=[f[0]&2,s.value]),f[0]){case 0:case 1:s=f;break;case 4:return e.label++,{value:f[1],done:!1};case 5:e.label++,o=f[1],f=[0];continue;case 7:f=e.ops.pop(),e.trys.pop();continue;default:if(s=e.trys,!(s=s.length>0&&s[s.length-1])&&(f[0]===6||f[0]===2)){e=0;continue}if(f[0]===3&&(!s||f[1]>s[0]&&f[1]<s[3])){e.label=f[1];break}if(f[0]===6&&e.label<s[1]){e.label=s[1],s=f;break}if(s&&e.label<s[2]){e.label=s[2],e.ops.push(f);break}s[2]&&e.ops.pop(),e.trys.pop();continue}f=t.call(n,e)}catch(d){f=[6,d],o=0}finally{r=s=0}if(f[0]&5)throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}}function __spreadArray(n,t,e){if(e||arguments.length===2)for(var r=0,o=t.length,s;r<o;r++)(s||!(r in t))&&(s||(s=Array.prototype.slice.call(t,0,r)),s[r]=t[r]);return n.concat(s||Array.prototype.slice.call(t))}typeof SuppressedError=="function"&&SuppressedError;function createSymbol(n){return typeof Symbol=="undefined"?"$Symbol<".concat(n,">$"):Symbol(n)}var EVENT_SYMBOL=createSymbol("$$FIVE_EVENT$$");function __generateEventIfNotExisted(n){return n[EVENT_SYMBOL]||(n[EVENT_SYMBOL]={}),n[EVENT_SYMBOL]}function __removeEvents(n){n[EVENT_SYMBOL]&&delete n[EVENT_SYMBOL]}var Subscribe=function(){function n(){}return n.prototype.hasListener=function(t){var e=__generateEventIfNotExisted(this);return e&&e[t]&&e[t].callbacks.length>0},n.prototype.on=function(t,e,r){var o=this,s=__generateEventIfNotExisted(this);return s[t]||(s[t]={callbacks:[]}),s[t].callbacks.push([e,r||!1]),function(){return o.off(t,e)}},n.prototype.once=function(t,e){return this.on(t,e,!0)},n.prototype.off=function(t,e){if(t===void 0){__removeEvents(this);return}var r=__generateEventIfNotExisted(this);if(r[t]||(r[t]={callbacks:[]}),e===void 0){r[t].callbacks.length=0;return}for(var o=0;o<r[t].callbacks.length&&r[t].callbacks[o][0]!==e;o++);o<r[t].callbacks.length&&r[t].callbacks.splice(o,1)},n.prototype.emit=function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];var o=!1,s=__generateEventIfNotExisted(this);s[t]||(s[t]={callbacks:[]});for(var u=s[t].callbacks.slice(),l=0,c=u;l<c.length;l++){var f=c[l],d=f[0],p=f[1],v=p===void 0?!1:p,g=d.apply(void 0,e);v&&this.off(t,d),g===!1&&(o=!0)}return o},n.prototype.waitUntil=function(t,e){var r=this;return new Promise(function(o){var s=r.on(t,function(){for(var u=[],l=0;l<arguments.length;l++)u[l]=arguments[l];(!e||e.apply(void 0,u)!==!1)&&(o(u),s())})})},n}();function noop$1(){}var start=typeof performance!="undefined"&&typeof performance.timing!="undefined"?performance.timing.navigationStart:Date.now(),now=typeof performance!="undefined"?function(){return start+performance.now()}:function(){return Date.now()};function deepFreeze(n){Object.freeze(n);var t=typeof n=="function",e=Object.prototype.hasOwnProperty;return Object.getOwnPropertyNames(n).forEach(function(r){e.call(n,r)&&(!t||r!=="caller"&&r!=="callee"&&r!=="arguments")&&n[r]!==null&&(typeof n[r]=="object"||typeof n[r]=="function")&&!Object.isFrozen(n[r])&&deepFreeze(n[r])}),n}var domainRegex=/^([^.]+)(\.([^.]+))*$/;function match(n,t){if(n==="*")return!0;var e=n.split(".").reverse(),r=t.split(".").reverse();if(e.length<=1)return n===t;for(var o=0;o<e.length;o++)if(e[o]!==r[o])return!1;return!0}function isIPDomain(n){return/^(([1-9]?\d|1\d\d|2[0-4]\d|25[0-5])(\.(?!$)|$)){4}$/.test(n)}function matchDomain(n,t){return domainRegex.test(n)&&domainRegex.test(t)&&match(n,t)}var JSONP_REGEXPS=[/\.([0-9a-z]+)\.jsonp([\?\#].*)?$/i,/jsonp_([0-9a-z]+)([\?\#].*)?$/i],BUILDIN_ALLOW_HOST=deepFreeze(JSON.parse(function(){var t=113,e=126,r=0,o="";return arguments[r].split(o).map(function(s){return s.charCodeAt(r)>e?s:String.fromCharCode((s.charCodeAt(r)+t)%e)}).join(o)}("h/y|pnyu|/9/xr;p|z/9/yvn{wvn;p|z/9/rnyrr;p|z/9/rnyrr;p{/9/rnyrr;w}/9/uv;p|z/9/uv;p{/9/rnyrr;p{/9/rnyrr;p|z/9/ywpq{;p|z/9/rnyrr:pq{;p|z/9/rnyrr:pq{;p{/9/rnyrr;nv/9/;p{/9/pq{;p{/9/pnyp{|qr;vr/j"))),NetworkProxyError=function(n){__extends(t,n);function t(e,r,o){return n.call(this,"[NETWORK]: request proxy error(type: ".concat(r,", reason: ").concat(o,"): ").concat(e))||this}return t}(Error),NetworkResponseError=function(n){__extends(t,n);function t(e,r,o){var s=n.call(this,"[NETWORK]: response error(type: ".concat(r,", status: ").concat(o,"): ").concat(e))||this;return s.httpStatus=o,s}return t}(Error);(function(n){__extends(t,n);function t(e,r){return n.call(this,"[NETWORK]: request abort(type: ".concat(r,"): ").concat(e))||this}return t})(Error);var NetworkTimeoutError=function(n){__extends(t,n);function t(e,r,o){return n.call(this,"[NETWORK]: request timeout(type: ".concat(r,", timeout: ").concat(o,"ms): ").concat(e))||this}return t}(Error),NetworkFirbiddenError=function(n){__extends(t,n);function t(e,r,o){return n.call(this,"[NETWORK]: request forbidden(type: ".concat(r,", reason: ").concat(o,"): ").concat(e))||this}return t}(Error);function parseHeaders(n){if(!n)return{};for(var t={},e=n.trim().split(`
|
|
391
|
-
`),r=0;r<e.length;r++){var o=e[r],s=o.indexOf(":"),u=o.slice(0,s).trim().toLowerCase(),l=o.slice(s+1).trim();l&&(t[u]?t[u]+=", "+l:t[u]=l)}return t}function matchJsonpFunctionName(n){for(var t=0,e=JSONP_REGEXPS;t<e.length;t++){var r=e[t],o=n.match(r);if(o)return"jsonp_"+o[1]}return null}function isJsonpSource(n){return matchJsonpFunctionName(n)!==null}function getProtocol(n){var t=n.match(/^([0-9a-z]+\:)\/\/(([^:/?#]*)(?::[0-9]+)?)/);return t?t[1]:location.protocol}function hostnameFromURL(n){if(/^blob\:/i.test(n))return"blob:";if(/^data\:/i.test(n))return"data:";var t=n.match(/^[0-9a-z]+\:\/\/(([^:/?#]*)(?::[0-9]+)?)/i);return t?t[2]:location.hostname}var NetworkSubscribe=function(n){__extends(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t}(Subscribe);function ajax(n,t,e,r,o){t===void 0&&(t={}),e===void 0&&(e=noop$1),r===void 0&&(r=noop$1),o===void 0&&(o=noop$1);var s=now(),u=n;return Promise.resolve().then(function(){return t.requestProxy?t.requestProxy(n):n}).then(function(l){return/^https\:/.test(location.href)&&/^http\:/.test(l)?(console.warn("The page at '".concat(location.href,"' was loaded over HTTPS, but requested an insecure element '").concat(l,"'. This request was automatically upgraded to HTTPS")),l.replace(/^http\:/,"https:")):l}).catch(function(l){var c,f=matchJsonpFunctionName(n),d=f?"Script":"XMLHttpRequest",p=new NetworkProxyError(u,d,l&&l.message?String(l.message):String(l));return(c=t.networkSubscribe)===null||c===void 0||c.emit("network",n,d,"proxy-error",p.message),Promise.reject(p)}).then(function(l){return new Promise(function(c,f){var d,p=t.allowHosts?BUILDIN_ALLOW_HOST.concat(t.allowHosts):BUILDIN_ALLOW_HOST.slice(),v=hostnameFromURL(l),g=matchJsonpFunctionName(l);if(location.hostname.length!==0&&!isIPDomain(location.hostname)&&BUILDIN_ALLOW_HOST.filter(function(L){return matchDomain(L,location.hostname)}).length===0&&!isIPDomain(v)&&p.filter(function(L){return matchDomain(L,v)}).length===0){var h=g?"Script":"XMLHttpRequest",m=new NetworkFirbiddenError(l,h,"request host(".concat(v,") is not allowed"));r(m),f(m),(d=t.networkSubscribe)===null||d===void 0||d.emit("network",l,h,"forbidden",m.message);return}if(g){var y=window,A=null,E=!1,b=document.createElement("script"),T=function(){var L;if(A=null,E!==!0){E=!0;var I=new NetworkTimeoutError(l,"Script",t.timeout||NaN);r(I),f(I),(L=t.networkSubscribe)===null||L===void 0||L.emit("network",l,"Script","timeout",I.message)}},_=function(L){var I,F,k=now(),N=k-s;if(delete y[g],b.parentNode&&b.parentNode.removeChild(b),A!==null&&(window.clearTimeout(A),A=null),E!==!0){if(L.indexOf("data:")!==0){var D=new NetworkResponseError(l,"Script",500);r(D),f(D),(I=t.networkSubscribe)===null||I===void 0||I.emit("network",l,"Script","error",D.message);return}var U=L.split(","),Q=(U[0].match(/:(.*?);/)||[])[1],q=U[1];if(t.responseType==="arraybuffer"||t.responseType==="blob"){for(var G=atob(U[1]),J=G.length,X=new Uint8Array(J),W=0;W<J;W++)X[W]=G.charCodeAt(W);t.responseType==="arraybuffer"?q=X.buffer:q=new Blob([X],{type:Q})}var j={},te={body:q,meta:{origin:u,source:l,requestTime:s,responseTime:k,costs:N,headers:j}};e(te),c(te),(F=t.networkSubscribe)===null||F===void 0||F.emit("network",l,"Script","ok",JSON.stringify(te.meta)),E=!0}};y[g]=_,b.src=l,document.body.appendChild(b),typeof t.timeout=="number"&&(A=window.setTimeout(T,t.timeout))}else{var R=!1,S=new XMLHttpRequest,M=function(){S&&(S.removeEventListener("timeout",B,!1),S.removeEventListener("progress",H,!1),S.removeEventListener("load",w,!1),S.removeEventListener("error",C,!1)),S=null,M=noop$1},B=function(){var L;if(R!==!0){R=!0,M();var I=new NetworkTimeoutError(l,"XMLHttpRequest",t.timeout||NaN);r(I),f(I),(L=t.networkSubscribe)===null||L===void 0||L.emit("network",l,"XMLHttpRequest","timeout",I.message)}},H=function(L){R!==!0&&L.lengthComputable&&(L.total<=0||o(L.loaded/L.total))},w=function(L){var I;if(R!==!0){var F=this.status;if(F===0||F>=200&&F<400){R=!0,M();var k=now(),N=k-s,D=parseHeaders(this.getAllResponseHeaders()),U=L.total,Q={body:this.response,meta:{origin:u,source:l,requestTime:s,responseTime:k,costs:N,headers:D,size:U}};e(Q),c(Q),(I=t.networkSubscribe)===null||I===void 0||I.emit("network",l,"XMLHttpRequest","ok",JSON.stringify(Q.meta))}else C.call(this)}},C=function(){var L;if(R!==!0){R=!0,M();var I=new NetworkResponseError(l,"XMLHttpRequest",this.status);r(I),f(I),(L=t.networkSubscribe)===null||L===void 0||L.emit("network",l,"XMLHttpRequest","error",I.message)}};S.addEventListener("timeout",B,!1),S.addEventListener("progress",H,!1),S.addEventListener("load",w,!1),S.addEventListener("error",C,!1),t.responseType&&(S.responseType=t.responseType),typeof t.timeout=="number"&&(S.timeout=t.timeout),S.open("GET",l,!0),S.send(null)}})})}var preloadCache={};function preload(n,t){t===void 0&&(t={});var e=now(),r=n;return Promise.resolve().then(function(){return t.requestProxy?t.requestProxy(n):n}).then(function(o){return/^https\:/.test(location.href)&&/^http\:/.test(o)?(console.warn("The page at '".concat(location.href,"' was loaded over HTTPS, but requested an insecure element '").concat(o,"'. This request was automatically upgraded to HTTPS")),o.replace(/^http\:/,"https:")):o}).catch(function(o){var s,u=new NetworkProxyError(r,"Link",o&&o.message?String(o.message):String(o));return(s=t.networkSubscribe)===null||s===void 0||s.emit("network",n,"Link","proxy-error",u.message),Promise.reject(u)}).then(function(o){return o in preloadCache?preloadCache[o]:preloadCache[o]=new Promise(function(s,u){var l,c=t.allowHosts?BUILDIN_ALLOW_HOST.concat(t.allowHosts):BUILDIN_ALLOW_HOST.slice(),f=hostnameFromURL(o);if(location.hostname.length!==0&&!isIPDomain(location.hostname)&&BUILDIN_ALLOW_HOST.filter(function(m){return matchDomain(m,location.hostname)}).length===0&&!isIPDomain(f)&&c.filter(function(m){return matchDomain(m,f)}).length===0){var d=new NetworkFirbiddenError(o,"Link","request host(".concat(f,") is not allowed"));u(d),(l=t.networkSubscribe)===null||l===void 0||l.emit("network",o,"Link","forbidden",d.message);return}var p=document.createElement("link"),v=!1,g=null;p.onload=function(m){var y;if(g!==null&&(clearTimeout(g),g=null),v!==!0){v=!0,s();var A=now(),E=A-e,b={},T={origin:r,source:o,requestTime:e,responseTime:A,costs:E,headers:b};(y=t.networkSubscribe)===null||y===void 0||y.emit("network",o,"Link","preload",JSON.stringify(T))}},p.onerror=function(m){var y;if(g!==null&&(clearTimeout(g),g=null),v!==!0){v=!0;var A=new NetworkResponseError(o,"Link",0);u(A),(y=t.networkSubscribe)===null||y===void 0||y.emit("network",o,"Link","error",A.message)}},typeof t.timeout=="number"&&(g=window.setTimeout(function(){var m;if(g=null,v!==!0){v=!0,s();var y=now(),A=y-e,E={},b={origin:r,source:o,requestTime:e,responseTime:y,costs:A,headers:E};(m=t.networkSubscribe)===null||m===void 0||m.emit("network",o,"Link","timeout",JSON.stringify(b))}},t.timeout)),p.rel=p.relList&&p.relList.supports("prefetch")?"prefetch":"preload",p.as="fetch",p.crossOrigin="",p.fetchPriority="high",p.href=o;var h=document.head||document.getElementsByTagName("head")[0];h&&h.appendChild(p)})})}function loadImage(n,t,e,r,o,s){t===void 0&&(t={}),e===void 0&&(e=noop$1),r===void 0&&(r=noop$1),o===void 0&&(o=noop$1);var u=now(),l=n;return Promise.resolve().then(function(){return t.requestProxy?t.requestProxy(n):n}).then(function(c){return/^https\:/.test(location.href)&&/^http\:/.test(c)?(console.warn("The page at '".concat(location.href,"' was loaded over HTTPS, but requested an insecure element '").concat(c,"'. This request was automatically upgraded to HTTPS")),c.replace(/^http\:/,"https:")):c}).catch(function(c){var f,d=new NetworkProxyError(l,"Image",c&&c.message?String(c.message):String(c));return(f=t.networkSubscribe)===null||f===void 0||f.emit("network",n,"Image","proxy-error",d.message),Promise.reject(d)}).then(function(c){return new Promise(function(f,d){var p,v=t.allowHosts?BUILDIN_ALLOW_HOST.concat(t.allowHosts):BUILDIN_ALLOW_HOST.slice(),g=hostnameFromURL(c);if(location.hostname.length!==0&&!isIPDomain(location.hostname)&&BUILDIN_ALLOW_HOST.filter(function(T){return matchDomain(T,location.hostname)}).length===0&&!isIPDomain(g)&&v.filter(function(T){return matchDomain(T,g)}).length===0){var h=new NetworkFirbiddenError(c,"Image","request host(".concat(g,") is not allowed"));r(h),d(h),(p=t.networkSubscribe)===null||p===void 0||p.emit("network",c,"Image","forbidden",h.message);return}var m=s!=null?s:new Image,y=!1,A=null,E=function(){var T;if(m.onload=noop$1,m.onerror=noop$1,A!==null&&(clearTimeout(A),A=null),y!==!0){var _=now(),R={headers:{},origin:l,source:c,requestTime:u,responseTime:_,costs:_-u};y=!0;var S={body:m,meta:R};o(1),e(S),f(S),(T=t.networkSubscribe)===null||T===void 0||T.emit("network",c,"Image","ok",JSON.stringify(S.meta))}},b=function(){var T;if(m.onload=noop$1,m.onerror=noop$1,A!==null&&(clearTimeout(A),A=null),y!==!0){y=!0;var _=new NetworkResponseError(c,"Image",0);r(_),d(_),(T=t.networkSubscribe)===null||T===void 0||T.emit("network",c,"Image","ok",_.message)}};typeof t.timeout=="number"&&(A=window.setTimeout(function(){var T;if(m.onload=noop$1,m.onerror=noop$1,A=null,y!==!0){y=!0;var _=new NetworkTimeoutError(c,"Image",t.timeout);r(_),d(_),(T=t.networkSubscribe)===null||T===void 0||T.emit("network",c,"Image","timeout",_.message)}},t.timeout)),m.onload=E,m.onerror=b,o(0),m.src=c})})}var Fetcher=function(){function n(t){t===void 0&&(t={}),this.options=Object.freeze(t),this.options.allowHosts&&Object.freeze(this.options.allowHosts)}return n.prototype.ajax=function(t,e,r,o,s){var u;e===void 0&&(e={}),r===void 0&&(r=noop$1),o===void 0&&(o=noop$1),s===void 0&&(s=noop$1);var l=this.options,c={responseType:e.responseType,timeout:(u=e.timeout)!==null&&u!==void 0?u:l.timeout,get allowHosts(){var f;return(f=e.allowHosts)!==null&&f!==void 0?f:l.allowHosts},get requestProxy(){var f;return(f=e.requestProxy)!==null&&f!==void 0?f:l.requestProxy},get networkSubscribe(){var f;return(f=e.networkSubscribe)!==null&&f!==void 0?f:l.networkSubscribe}};return ajax(t,c,r,o,s)},n.prototype.loadImage=function(t,e,r,o,s,u){var l;e===void 0&&(e={}),r===void 0&&(r=noop$1),o===void 0&&(o=noop$1),s===void 0&&(s=noop$1);var c=this.options,f={timeout:(l=e.timeout)!==null&&l!==void 0?l:c.timeout,get allowHosts(){var d;return(d=e.allowHosts)!==null&&d!==void 0?d:c.allowHosts},get requestProxy(){var d;return(d=e.requestProxy)!==null&&d!==void 0?d:c.requestProxy},get networkSubscribe(){var d;return(d=e.networkSubscribe)!==null&&d!==void 0?d:c.networkSubscribe}};return loadImage(t,f,r,o,s,u)},n.prototype.preload=function(t,e){var r;e===void 0&&(e={});var o=this.options,s={timeout:(r=e.timeout)!==null&&r!==void 0?r:o.timeout,get allowHosts(){var u;return(u=e.allowHosts)!==null&&u!==void 0?u:o.allowHosts},get requestProxy(){var u;return(u=e.requestProxy)!==null&&u!==void 0?u:o.requestProxy},get networkSubscribe(){var u;return(u=e.networkSubscribe)!==null&&u!==void 0?u:o.networkSubscribe}};return preload(t,s)},n}(),internalFetcher=new Fetcher;function clamp$1(n,t,e){return n<t?t:n>e?e:n}var windowSTOContext=function(){var n=now();return{requestAnimationFrame:function(t){var e=now(),r=clamp$1(16+(e-n),16,33),o=setTimeout(function(){t(e+r)},r);return n=e+r,o},cancelAnimationFrame:function(t){return clearTimeout(t)}}}(),windowRAFContext=function(){if(typeof window!="undefined"){var n=window;if(n.requestAnimationFrame)return{requestAnimationFrame:n.requestAnimationFrame.bind(n),cancelAnimationFrame:n.cancelAnimationFrame.bind(n)};if(n.mozRequestAnimationFrame)return{requestAnimationFrame:n.mozRequestAnimationFrame.bind(n),cancelAnimationFrame:n.mozCancelAnimationFrame.bind(n)};if(n.webkitRequestAnimationFrame)return{requestAnimationFrame:n.webkitRequestAnimationFrame.bind(n),cancelAnimationFrame:n.webkitCancelAnimationFrame.bind(n)};if(n.msRequestAnimationFrame)return{requestAnimationFrame:n.msRequestAnimationFrame.bind(n),cancelAnimationFrame:n.msCancelAnimationFrame.bind(n)}}return windowSTOContext}(),DEFAULT_ORDER=5,deviceFrameTime=16,AnimationFrameLoop=function(){function n(){this.loopType="raf",this.frames=[],this.isAnimating=!1,this.context=null;var t=now();this.loop=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];if(this.isAnimating!==!1){var o=now(),s=o-t;t=o,deviceFrameTime=s;for(var u=0;u<this.frames.length;u++){var l=this.frames[u];if(l.delay>0){l.delay=l.delay-1;continue}try{l.callback.apply(l,__spreadArray([o,s],e,!1))}catch(c){console.error(c)}l.once&&(this.frames.splice(u,1),u--)}this.requestId=this.requestAnimationFrame(this.loop)}}.bind(this),this.start()}return Object.defineProperty(n,"shared",{get:function(){return this.sharedInstance||(this.sharedInstance=new n),this.sharedInstance},enumerable:!1,configurable:!0}),n.getFrameTime=function(){return deviceFrameTime},n.prototype.start=function(){this.isAnimating!==!0&&(this.isAnimating=!0,this.requestId=this.requestAnimationFrame(this.loop))},n.prototype.stop=function(){this.isAnimating=!1,this.cancelAnimationFrame(this.requestId)},n.prototype.setContext=function(t){t!==this.context&&(this.stop(),this.context=t,this.start())},n.prototype.getContext=function(){return this.context},n.prototype.setLoopType=function(t){t!==this.loopType&&(this.stop(),this.loopType=t,this.start())},n.prototype.getLoopType=function(){return this.loopType},n.prototype.requestAnimationFrame=function(t){if(this.context)return this.context.requestAnimationFrame(t);if(this.loopType==="raf")return windowRAFContext.requestAnimationFrame(t);if(this.loopType==="sto")return windowSTOContext.requestAnimationFrame(t)},n.prototype.cancelAnimationFrame=function(t){if(this.context)this.context.cancelAnimationFrame(t);else if(this.loopType==="raf")windowRAFContext.cancelAnimationFrame(t);else if(this.loopType==="sto")return windowSTOContext.cancelAnimationFrame(t)},n.prototype.remove=function(t){var e=this.frames.indexOf(t);e>=0&&this.frames.splice(e,1)},n.prototype.add=function(t,e,r,o){var s=this;e===void 0&&(e=!1),r===void 0&&(r=0),o===void 0&&(o=DEFAULT_ORDER);for(var u={callback:t,once:e,delay:r,order:o},l=this.frames.length;--l>=0;)if(this.frames[l].order<=o){this.frames.splice(l+1,0,u);break}return l<0&&this.frames.unshift(u),function(){return s.remove(u)}},n.prototype.clear=function(){this.frames.length=0},n}(),DEFAULT_IMAGE_URL_MAPPINGS={"vrlab-public.ljcdn.com":{type:"tencentCloud",pano:["vrlab-image1.ljcdn.com","vrlab-image2.ljcdn.com"],texture:["vrlab-image3.ljcdn.com"],tile:["vr-tile-1.realsee-cdn.cn","vr-tile-2.realsee-cdn.cn"],model:["vr-model-1.realsee-cdn.cn","vr-model-2.realsee-cdn.cn"],default:["vrlab-image4.ljcdn.com"]},"vr-public.realsee-cdn.cn":{type:"tencentCloud",pano:["vr-image-1.realsee-cdn.cn","vr-image-2.realsee-cdn.cn"],texture:["vr-image-3.realsee-cdn.cn"],tile:["vr-tile-1.realsee-cdn.cn","vr-tile-2.realsee-cdn.cn"],model:["vr-model-1.realsee-cdn.cn","vr-model-2.realsee-cdn.cn"],default:["vr-image-4.realsee-cdn.cn"]},"vr-public.rscdn.cn":{type:"tencentCloud",pano:["vr-image-1.rscdn.cn","vr-image-2.rscdn.cn"],texture:["vr-image-3.rscdn.cn"],tile:["vr-tile-1.rscdn.cn","vr-tile-2.rscdn.cn"],model:["vr-model-1.rscdn.cn","vr-model-2.rscdn.cn"],default:["vr-image-4.rscdn.cn"]},"mars-public.realsee-cdn.cn":{type:"aliyun",pano:["mars-image-1.realsee-cdn.cn","mars-image-2.realsee-cdn.cn"],texture:["mars-image-3.realsee-cdn.cn"],tile:["mars-tile-1.realsee-cdn.cn","mars-tile-2.realsee-cdn.cn"],model:["mars-model-1.realsee-cdn.cn","mars-model-2.realsee-cdn.cn"],default:["mars-image-4.realsee-cdn.cn"]},"global-public.realsee-cdn.com":{type:"tencentCloud",pano:["global-image-1.realsee-cdn.com","global-image-2.realsee-cdn.com"],texture:["global-image-3.realsee-cdn.com"],tile:["global-tile-1.realsee-cdn.com","global-tile-2.realsee-cdn.com"],model:["global-model-1.realsee-cdn.com","global-model-2.realsee-cdn.com"],default:["global-image-4.realsee-cdn.com"]},"earth-ga-public.realsee-cdn.cn":{type:"tencentCloud",pano:["earth-ga-image-1.realsee-cdn.cn","earth-ga-image-2.realsee-cdn.cn"],texture:["earth-ga-image-3.realsee-cdn.cn"],tile:["earth-ga-tile-1.realsee-cdn.cn","earth-ga-tile-2.realsee-cdn.cn"],model:["earth-ga-model-1.realsee-cdn.cn","earth-ga-model-2.realsee-cdn.cn"],default:["earth-ga-image-4.realsee-cdn.cn"]},"test-vr-public.realsee-cdn.com":{type:"tencentCloud",pano:["test-vr-image.realsee-cdn.com","test-vr-image.realsee-cdn.com"],texture:["test-vr-image.realsee-cdn.com"],tile:["test-vr-image.realsee-cdn.com","test-vr-image.realsee-cdn.com"],model:["test-vr-image.realsee-cdn.com","test-vr-image.realsee-cdn.com"],default:["test-vr-image.realsee-cdn.com"]},"test-vr-public.realsee-cdn.cn":{type:"tencentCloud",pano:["test-vr-image.realsee-cdn.cn","test-vr-image.realsee-cdn.cn"],texture:["test-vr-image.realsee-cdn.cn"],tile:["test-vr-image.realsee-cdn.cn","test-vr-image.realsee-cdn.cn"],model:["test-vr-image.realsee-cdn.cn","test-vr-image.realsee-cdn.cn"],default:["test-vr-image.realsee-cdn.cn"]}},URL_DOMAIN_REGEX=/^https?\:\/\/?([^\/]+)/;function getDomain(n){var t=n.match(URL_DOMAIN_REGEX);return t===null?null:t[1]}function replaceDomain(n,t){return n.replace(URL_DOMAIN_REGEX,function(e,r){return e.slice(0,e.length-r.length)+t})}function route(n,t,e){var r=t.split("."),o=r[0],s=r.slice(1);if(o==="texture")return replaceDomain(n,e.texture[0]);if(o==="pano"||o==="pano_luminance"){s[0];var u=s[1];switch(u){case"front":case"left":case"up":return replaceDomain(n,e.pano[0]);case"down":case"right":case"back":return replaceDomain(n,e.pano[1])}}else if(o==="pano_tile"||o==="pano_tile_luminance"){s[0],s[1];var l=s[2],c=s[3],f=s[4],d=Math.pow(2,Number(l))*Number(c)+Number(f);if(!isNaN(d))return replaceDomain(n,e.tile[d%2])}else if(o==="model"){var p=s[0],d=Number(p);if(!isNaN(d))return replaceDomain(n,e.model[d%2])}return replaceDomain(n,e.default[0])}var tencentCloudImageProcesser=function(n,t){var e,r=n.split("?")[0],o=r.split(".").pop();if(o==="jpeg"&&(o="jpg"),o!=="png"&&o!=="jpg")return n;var s="";if(t.format!==void 0&&t.format!==o&&(s+="/format/".concat(t.format)),t.cut!==void 0&&(s+="/cut/".concat(t.cut[2],"x").concat(t.cut[3],"x").concat(t.cut[0],"x").concat(t.cut[1])),t.quality!==void 0){var u=(e=t.format)!==null&&e!==void 0?e:o;u&&["jpg","webp","tpg","heif","avif"].indexOf(u)>=0&&(s+="/quality/".concat(t.quality))}if(t.size!==void 0){var l=n.match(/\/cube_(\d+)\//),c=l?Number(l[1]):NaN;c!==Number(t.size)&&(s+="/thumbnail/".concat(t.size,"x"))}return t.sharpen!==void 0&&(s+="/sharpen/".concat(t.sharpen)),s.length&&(s="?imageMogr2"+s),r+s},aliyunOOSImageProcesser=function(n,t){var e,r=n.split("?")[0],o=r.split(".").pop();if(o==="jpeg"&&(o="jpg"),o!=="png"&&o!=="jpg")return n;var s="",u=[],l=t.format,c=t.quality,f=t.size;if(l!==void 0&&l!==o&&u.push("format,".concat(l==="heif"?"heic":l)),t.cut!==void 0){var d=t.cut,p=d[0],v=d[1],g=d[2],h=d[3];u.push("crop,x_".concat(p,",y_").concat(v,",w_").concat(g,",h_").concat(h,",g_nw"))}if(c!==void 0&&c!==100){var m=(e=t.format)!==null&&e!==void 0?e:o;m&&["jpg","webp"].indexOf(m)>=0&&u.push("quality,Q_".concat(c))}return f&&f!==2048&&u.push("resize,w_".concat(f)),t.sharpen!==void 0&&u.push("sharpen,".concat(t.sharpen)),u.length&&(s="?x-oss-process=image/"+u.join("/")),r+s},MAX_SAFE_INTEGER=9007199254740991;function formatNumber(n){var t=Math.round(n);return Math.abs(t-n)<.001?t:Math.floor(n)}function formatOptions(n){return n=Object.assign({},n),n.size!==void 0&&(n.size=formatNumber(clamp$1(n.size,0,MAX_SAFE_INTEGER))),n.quality!==void 0&&(n.quality=formatNumber(clamp$1(n.quality,0,100))),n.cut!==void 0&&(n.cut=[formatNumber(clamp$1(n.cut[0],0,MAX_SAFE_INTEGER)),formatNumber(clamp$1(n.cut[1],0,MAX_SAFE_INTEGER)),formatNumber(clamp$1(n.cut[2],0,MAX_SAFE_INTEGER)),formatNumber(clamp$1(n.cut[3],0,MAX_SAFE_INTEGER))]),n.sharpen!==void 0&&(n.sharpen=formatNumber(clamp$1(n.sharpen,0,MAX_SAFE_INTEGER))),n}function imageURL(n,t){var e=__assign(__assign({},DEFAULT_IMAGE_URL_MAPPINGS),t.mappings),r=getDomain(n);if(r===null)return n;t=formatOptions(t);var o=e[r];return o?(n=route(n,t.key,o),/\.basis(\?|$)/.test(n)&&(n=n.replace(/\.basis(\?|$)/,".jpg$1")),o.type==="tencentCloud"?tencentCloudImageProcesser(n,t):o.type==="aliyun"?aliyunOOSImageProcesser(n,t):n):n}function applyImageURLOptions(n,t,e){t===void 0&&(t=imageURL);var r=t(n,e);if(r===n&&e.cut)throw new Error("ImageURL: cut option not applied.");return r}var IMAGE_SIZE_REG=/\/cube_(\d+)\//;function getImageSizeFromURL(n){var t=n.match(IMAGE_SIZE_REG);return t?Number(t[1]):null}function replaceImageSize(n,t){return n.replace(IMAGE_SIZE_REG,"/cube_".concat(t,"/"))}var webp="data:image/webp;base64,UklGRiQAAABXRUJQVlA4IBgAAAAwAQCdASoCAAIAAUAmJaQAA3AA/vz0AAA=",avif="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAAGhbWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAsaWxvYwAAAABEAAACAAEAAAABAAAB3gAAABkAAgAAAAEAAAHJAAAAFQAAAEJpaW5mAAAAAAACAAAAGmluZmUCAAAAAAEAAGF2MDFDb2xvcgAAAAAaaW5mZQIAAAAAAgAAYXYwMUFscGhhAAAAABppcmVmAAAAAAAAAA5hdXhsAAIAAQABAAAA12lwcnAAAACxaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIAAoAAAAAUaXNwZQAAAAAAAAACAAAAAgAAAA5waXhpAAAAAAEIAAAADGF2MUOBABwAAAAAOGF1eEMAAAAAdXJuOm1wZWc6bXBlZ0I6Y2ljcDpzeXN0ZW1zOmF1eGlsaWFyeTphbHBoYQAAAAAeaXBtYQAAAAAAAAACAAEEAQKDBAACBAUGhwgAAAA2bWRhdBIACgQYADLVMgsWQBhhIAQqrNj/+BIACgUYADLEoDIOFkADDDDCQAACDaqCCb4=",heif="data:image/heif;base64,AAAAGGZ0eXBoZWljAAAAAG1pZjFoZWljAAABL21ldGEAAAAAAAAAIWhkbHIAAAAAAAAAAHBpY3QAAAAAAAAAAAAAAAAAAAAADnBpdG0AAAAAAAEAAAAjaWluZgAAAAAAAQAAABVpbmZlAgAAAAABAABodmMxAAAAAK9pcHJwAAAAkmlwY28AAAB2aHZjQwEBYAAAAAAAAAAAAADwAPz9+PgAACcDoAABAB5AAQwG//8BYAAAAwAAAwAAAwAAAwAAAwAAreTLgSChAAEAI0IBBwFgAAADAAADAAADAAADAAADAAChInJJlreTLySZNdggogABAAdEAcA98DMkAAAAFGlzcGUAAAAAAAAAAgAAAAIAAAAVaXBtYQAAAAAAAAABAAECgQIAAAAiaWxvYwAAAABEQAABAAEAAAAAAU8AAQAAAAAAAAAOAAAAFm1kYXQAAAAKJgGvLvkQwuWM4A==";function checkImage(n){return new Promise(function(t){var e=new Image,r=setTimeout(function(){e.onload=e.onerror=function(){},clearTimeout(r),t(!1)},100);e.onload=e.onerror=function(){e.onload=e.onerror=function(){},clearTimeout(r),t(e.height===2)},e.src=n})}var imageSupportCache=null;function imageSupport(){return imageSupportCache||(imageSupportCache=Promise.all([checkImage(webp),checkImage(avif),checkImage(heif)]).then(function(n){return{webp:n[0],avif:n[1],heif:n[2]}}))}var PANO_ID_REG=/^(.*)\[(\d+)\]$/;function panoStringify(n){if(!isNaN(n.panoIndex)&&isFinite(n.panoIndex))return"".concat(n.workCode,"[").concat(n.panoIndex,"]");throw new Error("Invalid Pano")}function panoParse(n){var t=n.match(PANO_ID_REG);if(t){t[0];var e=t[1],r=t[2],o=Math.floor(Number(r));if(!isNaN(o)&&isFinite(o))return{workCode:e,panoIndex:o}}throw new Error("Invalid PanoId")}function panoEqual(n,t){return panoStringify(n)===panoStringify(t)}function isPanoId(n){return typeof n=="string"&&PANO_ID_REG.test(n)}var PBMGroup=function(n){__extends(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t}(THREE__namespace.Group),PBMMesh=function(n){__extends(t,n);function t(e,r){return n.call(this,e,r)||this}return t.prototype.update=function(e,r,o,s){for(var u=0,l=this.material;u<l.length;u++){var c=l[u];c.update(e,r,o)}},t}(THREE__namespace.Mesh),PBMSkinnedMesh=function(n){__extends(t,n);function t(e,r,o){return n.call(this,e,r,o)||this}return t.prototype.update=function(e,r,o,s){for(var u=0,l=this.material;u<l.length;u++){var c=l[u];c.update(e,r,o)}},t}(THREE__namespace.SkinnedMesh);function jsonStableStrinfiy_(n,t){t===void 0&&(t=!1);var e=typeof n;if(e==="string")return JSON.stringify(n);if(n===!0)return"true";if(n===!1)return"false";if(n===null)return"null";if(n instanceof Array){for(var r="[",o=n.length-1,s=0;s<o;s++)r+=jsonStableStrinfiy_(n[s],!1)+",";return o>-1&&(r+=jsonStableStrinfiy_(n[s],!1)),r+"]"}if(n instanceof Object){if(typeof n.toJSON=="function")return jsonStableStrinfiy_(n.toJSON(),t);for(var u=Object.keys(n).sort(),l=u.length,r="",s=0;s<l;){var c=u[s],f=jsonStableStrinfiy_(n[c],!0);f!==void 0&&(s&&r!==""&&(r+=","),r+=JSON.stringify(c)+":"+f),s++}return"{"+r+"}"}switch(e){case"function":return JSON.stringify(n.toString());case"undefined":return t?void 0:null;case"number":return n;default:return isFinite(n)?n:null}}function jsonHash(n){return"hash::".concat(jsonStableStrinfiy_(n,!1))}var CustomShader=function(){function n(t){var e,r,o,s,u,l,c,f,d,p,v,g,h,m,y,A;this.uniforms=(e=t.uniforms)!==null&&e!==void 0?e:{},this.defines=(r=t.defines)!==null&&r!==void 0?r:{},this.type=t.type,this.vertex={mainBefore:(s=(o=t.vertex)===null||o===void 0?void 0:o.mainBefore)!==null&&s!==void 0?s:"",mainStart:(l=(u=t.vertex)===null||u===void 0?void 0:u.mainStart)!==null&&l!==void 0?l:"",mainEnd:(f=(c=t.vertex)===null||c===void 0?void 0:c.mainEnd)!==null&&f!==void 0?f:""},this.fragment={mainBefore:(p=(d=t.fragment)===null||d===void 0?void 0:d.mainBefore)!==null&&p!==void 0?p:"",mainStart:(g=(v=t.fragment)===null||v===void 0?void 0:v.mainStart)!==null&&g!==void 0?g:"",mainModelColor:(m=(h=t.fragment)===null||h===void 0?void 0:h.mainModelColor)!==null&&m!==void 0?m:"",mainEnd:(A=(y=t.fragment)===null||y===void 0?void 0:y.mainEnd)!==null&&A!==void 0?A:""}}return n.prototype.getHash=function(){return jsonHash({vertex:this.vertex,fragment:this.fragment,defines:this.defines})},n.prototype.onBeforeCompile=function(t,e){},n}(),gradientTexture=function(){return typeof document!="undefined"?new THREE__namespace.TextureLoader().load("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAgAAAAABCAYAAACouxZ2AAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAACAKADAAQAAAABAAAAAQAAAAB7UD0+AAACA0lEQVRIDXWUW3YjIQxEwdnV/GT/q8kO3FO3pAJst3PSAaR6Cbszf//9XeMxxpjXmI+pVXudp2s6PC4dqHff9e6D7/PZLy46xQvG+sZvrfK8xgXUeq85yINe9bdmtOK1+kun5vjgq58a+eZPna9jvmjiserqG/+Whathvo3L3WhV89L9sXI/m18z2uene9ap/ftsuT9WZxoHXzW56/fpj8l7+tTw7P011NdpqnY19sRsfuHMA9u8oZWfDz4+fra/dfG1V60ydZ7qba1g7UNAeK0JP7ydD7/OqH6wO2f7HTq+B/lbL9qsB3/N1/UzR81XfPzw4tp5OPvRneacteq8Xo0xR3vuv/kPz0KtX0Nhg0eHuaNXdWI3X/ld427h++vzyp99V6VPrzWFhbv4ayay4oFecm198MmUXN/mL+x7npq/uJXBGb/MTw4+t+SvbLoTZnUW5uHhz7nWcTxT73OwXV7cxT9wbBf/0LnDBgcnHmtPLYba32Hp808sMy1u88yhr58n70/v4xX92GSN19l/2UsqGmiH94Hpxjcs+DO/ccpIVNVp62PUWXu//ur1GQy1Cf+GZ13rtNYN1po3/NI79fGXibHkq4z25xvV2pW3szpneXsW8SsreTe/NIPrtXMnH7wPf+LEN6tqhUVHj3XKD/72p9eafCeYB3zuonnbv7yqP8d/o4K6gRb1wbYAAAAASUVORK5CYII="):new THREE__namespace.Texture}();gradientTexture.minFilter=THREE__namespace.NearestFilter,gradientTexture.magFilter=THREE__namespace.NearestFilter,gradientTexture.wrapS=THREE__namespace.RepeatWrapping,gradientTexture.wrapT=THREE__namespace.RepeatWrapping;var defaultPbmParameters={customShaders:[],pano0:null,pano1:null,floorStyle:"OPACITY",colorStyle:"RGB",constantColor:new THREE__namespace.Vector3(.6,.6,.6),shownFloorIndex:-1,modelAlpha:1,opacity:1,progress:0,transition:"FADE",clippers:null,brightness:1,useEDL:!1,useHQWeight:!1,useHQDepth:!1,pointSize:"ATTENUATION",pointBack:"DARK",pointShape:"CIRCLE",pointScale:.03,pointMaxPixel:40,pointMinPixel:1,gradientTexture,colorSaturation:0,colorBrightness:0};function isEqualClipperParameters(n,t){var e=n!=null?n:[],r=t!=null?t:[];if(r.length!==e.length)return!1;for(var o=0;o<r.length;o++)if(!e[o].clippingBoxMatrix.equals(r[o].clippingBoxMatrix)||e[o].floorIndex!==r[o].floorIndex)return!1;return!0}function isEqualPBMPanoPicture(n,t){return n&&t?n.luminanceMap===t.luminanceMap&&n.map===t.map&&n.zoom===t.zoom&&n.matrix.equals(t.matrix):!n&&!t}function updatePBMParameters(n,t){var e=!1;for(var r in t)if(t[r]!==void 0)switch(r){case"clippers":isEqualClipperParameters(n[r],t[r])||(n[r]=t[r],e=!0);break;case"pano0":case"pano1":isEqualPBMPanoPicture(n[r],t[r])||(n[r]=t[r],e=!0);break;default:n[r]!==t[r]&&(n[r]=t[r],e=!0);break}return e}function mixNumber(n,t,e){return n+(t-n)*e}function value(n,t,e,r){var o=(t*e+2*n)/Math.pow(e,3),s=-(2*t*e+3*n)/Math.pow(e,2),u=t,l=n;return o*Math.pow(r,3)+s*Math.pow(r,2)+u*r+l}function velocity(n,t,e,r){var o=(t*e+2*n)/Math.pow(e,3),s=-(2*t*e+3*n)/Math.pow(e,2),u=t;return 3*o*Math.pow(r,2)+2*s*r+u}function mixCircle(n,t,e,r){var o=r[1]-r[0];return n=circleValue(n,r),t=circleValue(t,r),t-n>o/2?mixNumber(n+o,t,e):n-t>o/2?mixNumber(n-o,t,e):mixNumber(n,t,e)}function circleValue(n,t){var e=t[1]-t[0];return n<t[0]?circleValue(n+e,t):n>=t[1]?circleValue(n-e,t):n}function mixValue(n,t,e,r){return r?mixCircle(n,t,e,r):mixNumber(n,t,e)}function toNumber(n){var t=Number(n);return isNaN(t)||!isFinite(t)?0:t}var Motion=function(){function n(t){this.config={},this.progress=1,this.ended=!0,this.value={},this.startTime=now(),this.startVelocity=0,this.duration=0,this.keyframes=[];for(var e in t){var r=t[e];typeof r=="object"?(this.value[e]=toNumber(r.value),this.config[e]={circle:r.circle}):(this.value[e]=toNumber(r),this.config[e]={circle:!1})}this.keyframes=[{progress:0,value:__assign({},this.value)},{progress:1,value:__assign({},this.value)}]}return n.prototype.getProgress=function(t){var e=t-this.startTime;return e<0?0:e>=this.duration?1:1-value(1,this.startVelocity,this.duration,e)},n.prototype.getValue=function(t){for(var e=1;e<this.keyframes.length;e++)if(this.keyframes[e].progress>t){var r=this.keyframes[e-1],o=this.keyframes[e],s={};for(var u in this.config){var l=(t-r.progress)/(o.progress-r.progress);s[u]=mixValue(r.value[u],o.value[u],l,this.config[u].circle)}return s}return __assign({},this.keyframes[this.keyframes.length-1].value)},n.prototype.getProgressVelocity=function(t){var e=t-this.startTime;return e>=this.duration?0:velocity(1,this.startVelocity,this.duration,e)},n.prototype.update=function(t){return this.ended?!0:(this.progress=Math.min(1,Math.max(0,this.progress,this.getProgress(t))),this.value=this.getValue(this.progress),this.ended=this.progress>=1,this.ended&&this.callbacks&&(this.callbacks[0](),this.callbacks=void 0),this.ended)},n.prototype.getKeyFrameSegment=function(t){for(var e=this.getProgress(t),r=1;r<this.keyframes.length;r++)if(this.keyframes[r].progress>e)return[this.keyframes[r-1],this.keyframes[r]];return[this.keyframes[this.keyframes.length-2],this.keyframes[this.keyframes.length-1]]},n.prototype.getTargetKeyframe=function(){return this.keyframes[this.keyframes.length-1]},n.prototype.set=function(t,e,r,o){var s;r===void 0&&(r=0),isNaN(e)&&(e=0),isNaN(r)&&(r=0),o=o!=null?o:now();var u=this.getProgress(o),l=this.getValue(u),c={};for(var f in this.config)c[f]=(s=t[f])!==null&&s!==void 0?s:l[f];var d=[{progress:0,value:l},{progress:1,value:c}];return this.setKeyframes(d,e,r,o)},n.prototype.setKeyframes=function(t,e,r,o){var s=this;if(r===void 0&&(r=0),t.length<2)throw new Error("keyframes invalid.");return isNaN(e)&&(e=0),isNaN(r)&&(r=0),this.callbacks&&(this.callbacks[1](new Error("motion aborted.")),this.callbacks=void 0),new Promise(function(u,l){o=o!=null?o:now(),s.progress=0,s.ended=!1,s.startTime=o,s.startVelocity=r,s.keyframes=t,s.duration=e,e===0?(s.progress=1,s.value=__assign({},t[t.length-1].value)):s.value=__assign({},t[0].value),s.callbacks=[u,l]})},n.prototype.dispose=function(){this.callbacks&&(this.callbacks[1](new Error("motion dispose.")),this.callbacks=void 0)},n}(),APPEAR_ANIMATION_DURATION=500;function easeInOutSine(n){return-(Math.cos(Math.PI*n)-1)/2}var PBMPointCloud=function(n){__extends(t,n);function t(e,r){var o=n.call(this,e,r)||this;return o.appearMotion=new Motion({appear:0}),o}return t.prototype.update=function(e,r,o,s){var u,l;if(this.material.update(e,r,o),s&&s.refine==="ADD"&&s.tileset.rootMeta.pntsOrder==="RANDOM"){var c=this.geometry,f=this.appearMotion,d=o.visible&&s.state.selectedFrameNumber===s.tileset.frameNumber,p=s.tileset.maxScreenSpaceError,v=s.state.screenSpaceError,g=(l=(u=s.parent)===null||u===void 0?void 0:u.state.screenSpaceError)!==null&&l!==void 0?l:v,h=1;if(s.levelOfContent>s.tileset.minLevelOfDetail&&g!==v&&(h=(g-p)/(g-v)),h=clamp$1(h,0,1),h=easeInOutSine(h),d){var m=1;f.getTargetKeyframe().value.appear!==m&&f.set({appear:m},APPEAR_ANIMATION_DURATION).catch(noop$1)}else{var m=0;f.getTargetKeyframe().value.appear!==m&&f.set({appear:m},0).catch(noop$1)}f.ended!==!0&&f.update(r.time);var y=c.index?c.index.count:c.attributes.position?c.attributes.position.count:1/0,A=Math.floor(y*h*f.value.appear);c.drawRange.count!==A&&(this.geometry.setDrawRange(0,A),o.needsRender=!0)}},t}(THREE__namespace.Points),scratchMaterialSet=new Set,PBMContainer=function(n){__extends(t,n);function t(){var e=n.call(this)||this;return e.needsRender=!0,e.pbmMaterialParametersVersion=0,e.materialParameters=__assign({},defaultPbmParameters),e}return t.prototype.getMaterial=function(){return __assign({},this.materialParameters)},t.prototype.setMaterial=function(e){var r=this;Object.assign(this.materialParameters,e),scratchMaterialSet.clear(),this.traverse(function(o){if(o instanceof PBMMesh)for(var s=0,u=o.material;s<u.length;s++){var l=u[s];scratchMaterialSet.has(l)||(Object.assign(l,r.materialParameters),scratchMaterialSet.add(l))}o instanceof PBMPointCloud&&(scratchMaterialSet.has(o.material)||(Object.assign(o.material,r.materialParameters),scratchMaterialSet.add(o.material)))}),scratchMaterialSet.clear(),this.needsRender=!0},t}(THREE__namespace.Group),FACE_ORDER$1=["right","left","up","down","front","back"];function getBox(n,t,e,r){var o=new THREE__namespace.Box3;switch(n){case"up":o.min.y=.5,o.max.y=.5,o.min.x=+t-.5,o.max.x=+t-.5+r,o.min.z=-e+.5-r,o.max.z=-e+.5;break;case"down":o.min.y=-.5,o.max.y=-.5,o.min.x=+t-.5,o.max.x=+t-.5+r,o.min.z=+e-.5,o.max.z=+e-.5+r;break;case"left":o.min.x=-.5,o.max.x=-.5,o.min.z=-t+.5-r,o.max.z=-t+.5,o.min.y=-e+.5-r,o.max.y=-e+.5;break;case"right":o.min.x=.5,o.max.x=.5,o.min.z=+t-.5,o.max.z=+t-.5+r,o.min.y=-e+.5-r,o.max.y=-e+.5;break;case"front":o.min.z=-.5,o.max.z=-.5,o.min.x=+t-.5,o.max.x=+t-.5+r,o.min.y=-e+.5-r,o.max.y=-e+.5;break;case"back":o.min.z=.5,o.max.z=.5,o.min.x=-t+.5-r,o.max.x=-t+.5,o.min.y=-e+.5-r,o.max.y=-e+.5;break}return o.applyMatrix4(new THREE__namespace.Matrix4().makeRotationY(Math.PI))}var createChildren=function(n,t){if(!(n.level>=t))for(var e=n.level+1,r=n.size/2,o=[new THREE__namespace.Vector2(n.position.x,n.position.y),new THREE__namespace.Vector2(n.position.x+r,n.position.y),new THREE__namespace.Vector2(n.position.x,n.position.y+r),new THREE__namespace.Vector2(n.position.x+r,n.position.y+r)],s=0,u=o;s<u.length;s++){var l=u[s],c={face:n.face,level:e,size:r,position:l,box:getBox(n.face,l.x,l.y,r),parent:n,children:[]};n.children.push(c),createChildren(c,t)}};function createTileCubeNode(n,t){var e={level:0,face:n,position:new THREE__namespace.Vector2(0,0),size:1,box:getBox(n,0,0,1),parent:null,children:[]};return createChildren(e,t),e}function createTileCubeTree(n){var t=FACE_ORDER$1.map(function(e){return createTileCubeNode(e,n)});return{children:t}}function traverseTileCubeNode(n,t){for(var e=0,r=n.children;e<r.length;e++){var o=r[e],s=t(o);s!==!1&&traverseTileCubeNode(o,t)}}var CUBE_GEOMETRY=new THREE__namespace.BoxBufferGeometry(1,1,1,1,1);CUBE_GEOMETRY.deleteAttribute("uv"),CUBE_GEOMETRY.deleteAttribute("normal"),CUBE_GEOMETRY.groups=[],CUBE_GEOMETRY.scale(-1,1,1);var CUBE_VERTEX_SHADER=`
|
|
391
|
+
`),r=0;r<e.length;r++){var o=e[r],s=o.indexOf(":"),u=o.slice(0,s).trim().toLowerCase(),l=o.slice(s+1).trim();l&&(t[u]?t[u]+=", "+l:t[u]=l)}return t}function matchJsonpFunctionName(n){for(var t=0,e=JSONP_REGEXPS;t<e.length;t++){var r=e[t],o=n.match(r);if(o)return"jsonp_"+o[1]}return null}function isJsonpSource(n){return matchJsonpFunctionName(n)!==null}function getProtocol(n){var t=n.match(/^([0-9a-z]+\:)\/\/(([^:/?#]*)(?::[0-9]+)?)/);return t?t[1]:location.protocol}function hostnameFromURL(n){if(/^blob\:/i.test(n))return"blob:";if(/^data\:/i.test(n))return"data:";var t=n.match(/^[0-9a-z]+\:\/\/(([^:/?#]*)(?::[0-9]+)?)/i);return t?t[2]:location.hostname}var NetworkSubscribe=function(n){__extends(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t}(Subscribe);function ajax(n,t,e,r,o){t===void 0&&(t={}),e===void 0&&(e=noop$1),r===void 0&&(r=noop$1),o===void 0&&(o=noop$1);var s=now(),u=n;return Promise.resolve().then(function(){return t.requestProxy?t.requestProxy(n):n}).then(function(l){return/^https\:/.test(location.href)&&/^http\:/.test(l)?(console.warn("The page at '".concat(location.href,"' was loaded over HTTPS, but requested an insecure element '").concat(l,"'. This request was automatically upgraded to HTTPS")),l.replace(/^http\:/,"https:")):l}).catch(function(l){var c,f=matchJsonpFunctionName(n),d=f?"Script":"XMLHttpRequest",p=new NetworkProxyError(u,d,l&&l.message?String(l.message):String(l));return(c=t.networkSubscribe)===null||c===void 0||c.emit("network",n,d,"proxy-error",p.message),Promise.reject(p)}).then(function(l){return new Promise(function(c,f){var d,p=t.allowHosts?BUILDIN_ALLOW_HOST.concat(t.allowHosts):BUILDIN_ALLOW_HOST.slice(),v=hostnameFromURL(l),g=matchJsonpFunctionName(l);if(location.hostname.length!==0&&!isIPDomain(location.hostname)&&BUILDIN_ALLOW_HOST.filter(function(L){return matchDomain(L,location.hostname)}).length===0&&!isIPDomain(v)&&p.filter(function(L){return matchDomain(L,v)}).length===0){var h=g?"Script":"XMLHttpRequest",m=new NetworkFirbiddenError(l,h,"request host(".concat(v,") is not allowed"));r(m),f(m),(d=t.networkSubscribe)===null||d===void 0||d.emit("network",l,h,"forbidden",m.message);return}if(g){var y=window,A=null,E=!1,b=document.createElement("script"),T=function(){var L;if(A=null,E!==!0){E=!0;var I=new NetworkTimeoutError(l,"Script",t.timeout||NaN);r(I),f(I),(L=t.networkSubscribe)===null||L===void 0||L.emit("network",l,"Script","timeout",I.message)}},_=function(L){var I,F,k=now(),N=k-s;if(delete y[g],b.parentNode&&b.parentNode.removeChild(b),A!==null&&(window.clearTimeout(A),A=null),E!==!0){if(L.indexOf("data:")!==0){var D=new NetworkResponseError(l,"Script",500);r(D),f(D),(I=t.networkSubscribe)===null||I===void 0||I.emit("network",l,"Script","error",D.message);return}var U=L.split(","),z=(U[0].match(/:(.*?);/)||[])[1],G=U[1];if(t.responseType==="arraybuffer"||t.responseType==="blob"){for(var q=atob(U[1]),K=q.length,j=new Uint8Array(K),W=0;W<K;W++)j[W]=q.charCodeAt(W);t.responseType==="arraybuffer"?G=j.buffer:G=new Blob([j],{type:z})}var X={},ee={body:G,meta:{origin:u,source:l,requestTime:s,responseTime:k,costs:N,headers:X}};e(ee),c(ee),(F=t.networkSubscribe)===null||F===void 0||F.emit("network",l,"Script","ok",JSON.stringify(ee.meta)),E=!0}};y[g]=_,b.src=l,document.body.appendChild(b),typeof t.timeout=="number"&&(A=window.setTimeout(T,t.timeout))}else{var R=!1,S=new XMLHttpRequest,M=function(){S&&(S.removeEventListener("timeout",B,!1),S.removeEventListener("progress",H,!1),S.removeEventListener("load",w,!1),S.removeEventListener("error",C,!1)),S=null,M=noop$1},B=function(){var L;if(R!==!0){R=!0,M();var I=new NetworkTimeoutError(l,"XMLHttpRequest",t.timeout||NaN);r(I),f(I),(L=t.networkSubscribe)===null||L===void 0||L.emit("network",l,"XMLHttpRequest","timeout",I.message)}},H=function(L){R!==!0&&L.lengthComputable&&(L.total<=0||o(L.loaded/L.total))},w=function(L){var I;if(R!==!0){var F=this.status;if(F===0||F>=200&&F<400){R=!0,M();var k=now(),N=k-s,D=parseHeaders(this.getAllResponseHeaders()),U=L.total,z={body:this.response,meta:{origin:u,source:l,requestTime:s,responseTime:k,costs:N,headers:D,size:U}};e(z),c(z),(I=t.networkSubscribe)===null||I===void 0||I.emit("network",l,"XMLHttpRequest","ok",JSON.stringify(z.meta))}else C.call(this)}},C=function(){var L;if(R!==!0){R=!0,M();var I=new NetworkResponseError(l,"XMLHttpRequest",this.status);r(I),f(I),(L=t.networkSubscribe)===null||L===void 0||L.emit("network",l,"XMLHttpRequest","error",I.message)}};S.addEventListener("timeout",B,!1),S.addEventListener("progress",H,!1),S.addEventListener("load",w,!1),S.addEventListener("error",C,!1),t.responseType&&(S.responseType=t.responseType),typeof t.timeout=="number"&&(S.timeout=t.timeout),S.open("GET",l,!0),S.send(null)}})})}var preloadCache={};function preload(n,t){t===void 0&&(t={});var e=now(),r=n;return Promise.resolve().then(function(){return t.requestProxy?t.requestProxy(n):n}).then(function(o){return/^https\:/.test(location.href)&&/^http\:/.test(o)?(console.warn("The page at '".concat(location.href,"' was loaded over HTTPS, but requested an insecure element '").concat(o,"'. This request was automatically upgraded to HTTPS")),o.replace(/^http\:/,"https:")):o}).catch(function(o){var s,u=new NetworkProxyError(r,"Link",o&&o.message?String(o.message):String(o));return(s=t.networkSubscribe)===null||s===void 0||s.emit("network",n,"Link","proxy-error",u.message),Promise.reject(u)}).then(function(o){return o in preloadCache?preloadCache[o]:preloadCache[o]=new Promise(function(s,u){var l,c=t.allowHosts?BUILDIN_ALLOW_HOST.concat(t.allowHosts):BUILDIN_ALLOW_HOST.slice(),f=hostnameFromURL(o);if(location.hostname.length!==0&&!isIPDomain(location.hostname)&&BUILDIN_ALLOW_HOST.filter(function(m){return matchDomain(m,location.hostname)}).length===0&&!isIPDomain(f)&&c.filter(function(m){return matchDomain(m,f)}).length===0){var d=new NetworkFirbiddenError(o,"Link","request host(".concat(f,") is not allowed"));u(d),(l=t.networkSubscribe)===null||l===void 0||l.emit("network",o,"Link","forbidden",d.message);return}var p=document.createElement("link"),v=!1,g=null;p.onload=function(m){var y;if(g!==null&&(clearTimeout(g),g=null),v!==!0){v=!0,s();var A=now(),E=A-e,b={},T={origin:r,source:o,requestTime:e,responseTime:A,costs:E,headers:b};(y=t.networkSubscribe)===null||y===void 0||y.emit("network",o,"Link","preload",JSON.stringify(T))}},p.onerror=function(m){var y;if(g!==null&&(clearTimeout(g),g=null),v!==!0){v=!0;var A=new NetworkResponseError(o,"Link",0);u(A),(y=t.networkSubscribe)===null||y===void 0||y.emit("network",o,"Link","error",A.message)}},typeof t.timeout=="number"&&(g=window.setTimeout(function(){var m;if(g=null,v!==!0){v=!0,s();var y=now(),A=y-e,E={},b={origin:r,source:o,requestTime:e,responseTime:y,costs:A,headers:E};(m=t.networkSubscribe)===null||m===void 0||m.emit("network",o,"Link","timeout",JSON.stringify(b))}},t.timeout)),p.rel=p.relList&&p.relList.supports("prefetch")?"prefetch":"preload",p.as="fetch",p.crossOrigin="",p.fetchPriority="high",p.href=o;var h=document.head||document.getElementsByTagName("head")[0];h&&h.appendChild(p)})})}function loadImage(n,t,e,r,o,s){t===void 0&&(t={}),e===void 0&&(e=noop$1),r===void 0&&(r=noop$1),o===void 0&&(o=noop$1);var u=now(),l=n;return Promise.resolve().then(function(){return t.requestProxy?t.requestProxy(n):n}).then(function(c){return/^https\:/.test(location.href)&&/^http\:/.test(c)?(console.warn("The page at '".concat(location.href,"' was loaded over HTTPS, but requested an insecure element '").concat(c,"'. This request was automatically upgraded to HTTPS")),c.replace(/^http\:/,"https:")):c}).catch(function(c){var f,d=new NetworkProxyError(l,"Image",c&&c.message?String(c.message):String(c));return(f=t.networkSubscribe)===null||f===void 0||f.emit("network",n,"Image","proxy-error",d.message),Promise.reject(d)}).then(function(c){return new Promise(function(f,d){var p,v=t.allowHosts?BUILDIN_ALLOW_HOST.concat(t.allowHosts):BUILDIN_ALLOW_HOST.slice(),g=hostnameFromURL(c);if(location.hostname.length!==0&&!isIPDomain(location.hostname)&&BUILDIN_ALLOW_HOST.filter(function(T){return matchDomain(T,location.hostname)}).length===0&&!isIPDomain(g)&&v.filter(function(T){return matchDomain(T,g)}).length===0){var h=new NetworkFirbiddenError(c,"Image","request host(".concat(g,") is not allowed"));r(h),d(h),(p=t.networkSubscribe)===null||p===void 0||p.emit("network",c,"Image","forbidden",h.message);return}var m=s!=null?s:new Image,y=!1,A=null,E=function(){var T;if(m.onload=noop$1,m.onerror=noop$1,A!==null&&(clearTimeout(A),A=null),y!==!0){var _=now(),R={headers:{},origin:l,source:c,requestTime:u,responseTime:_,costs:_-u};y=!0;var S={body:m,meta:R};o(1),e(S),f(S),(T=t.networkSubscribe)===null||T===void 0||T.emit("network",c,"Image","ok",JSON.stringify(S.meta))}},b=function(){var T;if(m.onload=noop$1,m.onerror=noop$1,A!==null&&(clearTimeout(A),A=null),y!==!0){y=!0;var _=new NetworkResponseError(c,"Image",0);r(_),d(_),(T=t.networkSubscribe)===null||T===void 0||T.emit("network",c,"Image","ok",_.message)}};typeof t.timeout=="number"&&(A=window.setTimeout(function(){var T;if(m.onload=noop$1,m.onerror=noop$1,A=null,y!==!0){y=!0;var _=new NetworkTimeoutError(c,"Image",t.timeout);r(_),d(_),(T=t.networkSubscribe)===null||T===void 0||T.emit("network",c,"Image","timeout",_.message)}},t.timeout)),m.onload=E,m.onerror=b,o(0),m.src=c})})}var Fetcher=function(){function n(t){t===void 0&&(t={}),this.options=Object.freeze(t),this.options.allowHosts&&Object.freeze(this.options.allowHosts)}return n.prototype.ajax=function(t,e,r,o,s){var u;e===void 0&&(e={}),r===void 0&&(r=noop$1),o===void 0&&(o=noop$1),s===void 0&&(s=noop$1);var l=this.options,c={responseType:e.responseType,timeout:(u=e.timeout)!==null&&u!==void 0?u:l.timeout,get allowHosts(){var f;return(f=e.allowHosts)!==null&&f!==void 0?f:l.allowHosts},get requestProxy(){var f;return(f=e.requestProxy)!==null&&f!==void 0?f:l.requestProxy},get networkSubscribe(){var f;return(f=e.networkSubscribe)!==null&&f!==void 0?f:l.networkSubscribe}};return ajax(t,c,r,o,s)},n.prototype.loadImage=function(t,e,r,o,s,u){var l;e===void 0&&(e={}),r===void 0&&(r=noop$1),o===void 0&&(o=noop$1),s===void 0&&(s=noop$1);var c=this.options,f={timeout:(l=e.timeout)!==null&&l!==void 0?l:c.timeout,get allowHosts(){var d;return(d=e.allowHosts)!==null&&d!==void 0?d:c.allowHosts},get requestProxy(){var d;return(d=e.requestProxy)!==null&&d!==void 0?d:c.requestProxy},get networkSubscribe(){var d;return(d=e.networkSubscribe)!==null&&d!==void 0?d:c.networkSubscribe}};return loadImage(t,f,r,o,s,u)},n.prototype.preload=function(t,e){var r;e===void 0&&(e={});var o=this.options,s={timeout:(r=e.timeout)!==null&&r!==void 0?r:o.timeout,get allowHosts(){var u;return(u=e.allowHosts)!==null&&u!==void 0?u:o.allowHosts},get requestProxy(){var u;return(u=e.requestProxy)!==null&&u!==void 0?u:o.requestProxy},get networkSubscribe(){var u;return(u=e.networkSubscribe)!==null&&u!==void 0?u:o.networkSubscribe}};return preload(t,s)},n}(),internalFetcher=new Fetcher;function clamp$1(n,t,e){return n<t?t:n>e?e:n}var windowSTOContext=function(){var n=now();return{requestAnimationFrame:function(t){var e=now(),r=clamp$1(16+(e-n),16,33),o=setTimeout(function(){t(e+r)},r);return n=e+r,o},cancelAnimationFrame:function(t){return clearTimeout(t)}}}(),windowRAFContext=function(){if(typeof window!="undefined"){var n=window;if(n.requestAnimationFrame)return{requestAnimationFrame:n.requestAnimationFrame.bind(n),cancelAnimationFrame:n.cancelAnimationFrame.bind(n)};if(n.mozRequestAnimationFrame)return{requestAnimationFrame:n.mozRequestAnimationFrame.bind(n),cancelAnimationFrame:n.mozCancelAnimationFrame.bind(n)};if(n.webkitRequestAnimationFrame)return{requestAnimationFrame:n.webkitRequestAnimationFrame.bind(n),cancelAnimationFrame:n.webkitCancelAnimationFrame.bind(n)};if(n.msRequestAnimationFrame)return{requestAnimationFrame:n.msRequestAnimationFrame.bind(n),cancelAnimationFrame:n.msCancelAnimationFrame.bind(n)}}return windowSTOContext}(),DEFAULT_ORDER=5,deviceFrameTime=16,AnimationFrameLoop=function(){function n(){this.loopType="raf",this.frames=[],this.isAnimating=!1,this.context=null;var t=now();this.loop=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];if(this.isAnimating!==!1){var o=now(),s=o-t;t=o,deviceFrameTime=s;for(var u=0;u<this.frames.length;u++){var l=this.frames[u];if(l.delay>0){l.delay=l.delay-1;continue}try{l.callback.apply(l,__spreadArray([o,s],e,!1))}catch(c){console.error(c)}l.once&&(this.frames.splice(u,1),u--)}this.requestId=this.requestAnimationFrame(this.loop)}}.bind(this),this.start()}return Object.defineProperty(n,"shared",{get:function(){return this.sharedInstance||(this.sharedInstance=new n),this.sharedInstance},enumerable:!1,configurable:!0}),n.getFrameTime=function(){return deviceFrameTime},n.prototype.start=function(){this.isAnimating!==!0&&(this.isAnimating=!0,this.requestId=this.requestAnimationFrame(this.loop))},n.prototype.stop=function(){this.isAnimating=!1,this.cancelAnimationFrame(this.requestId)},n.prototype.setContext=function(t){t!==this.context&&(this.stop(),this.context=t,this.start())},n.prototype.getContext=function(){return this.context},n.prototype.setLoopType=function(t){t!==this.loopType&&(this.stop(),this.loopType=t,this.start())},n.prototype.getLoopType=function(){return this.loopType},n.prototype.requestAnimationFrame=function(t){if(this.context)return this.context.requestAnimationFrame(t);if(this.loopType==="raf")return windowRAFContext.requestAnimationFrame(t);if(this.loopType==="sto")return windowSTOContext.requestAnimationFrame(t)},n.prototype.cancelAnimationFrame=function(t){if(this.context)this.context.cancelAnimationFrame(t);else if(this.loopType==="raf")windowRAFContext.cancelAnimationFrame(t);else if(this.loopType==="sto")return windowSTOContext.cancelAnimationFrame(t)},n.prototype.remove=function(t){var e=this.frames.indexOf(t);e>=0&&this.frames.splice(e,1)},n.prototype.add=function(t,e,r,o){var s=this;e===void 0&&(e=!1),r===void 0&&(r=0),o===void 0&&(o=DEFAULT_ORDER);for(var u={callback:t,once:e,delay:r,order:o},l=this.frames.length;--l>=0;)if(this.frames[l].order<=o){this.frames.splice(l+1,0,u);break}return l<0&&this.frames.unshift(u),function(){return s.remove(u)}},n.prototype.clear=function(){this.frames.length=0},n}(),DEFAULT_IMAGE_URL_MAPPINGS={"vrlab-public.ljcdn.com":{type:"tencentCloud",pano:["vrlab-image1.ljcdn.com","vrlab-image2.ljcdn.com"],texture:["vrlab-image3.ljcdn.com"],tile:["vr-tile-1.realsee-cdn.cn","vr-tile-2.realsee-cdn.cn"],model:["vr-model-1.realsee-cdn.cn","vr-model-2.realsee-cdn.cn"],default:["vrlab-image4.ljcdn.com"]},"vr-public.realsee-cdn.cn":{type:"tencentCloud",pano:["vr-image-1.realsee-cdn.cn","vr-image-2.realsee-cdn.cn"],texture:["vr-image-3.realsee-cdn.cn"],tile:["vr-tile-1.realsee-cdn.cn","vr-tile-2.realsee-cdn.cn"],model:["vr-model-1.realsee-cdn.cn","vr-model-2.realsee-cdn.cn"],default:["vr-image-4.realsee-cdn.cn"]},"vr-public.rscdn.cn":{type:"tencentCloud",pano:["vr-image-1.rscdn.cn","vr-image-2.rscdn.cn"],texture:["vr-image-3.rscdn.cn"],tile:["vr-tile-1.rscdn.cn","vr-tile-2.rscdn.cn"],model:["vr-model-1.rscdn.cn","vr-model-2.rscdn.cn"],default:["vr-image-4.rscdn.cn"]},"mars-public.realsee-cdn.cn":{type:"aliyun",pano:["mars-image-1.realsee-cdn.cn","mars-image-2.realsee-cdn.cn"],texture:["mars-image-3.realsee-cdn.cn"],tile:["mars-tile-1.realsee-cdn.cn","mars-tile-2.realsee-cdn.cn"],model:["mars-model-1.realsee-cdn.cn","mars-model-2.realsee-cdn.cn"],default:["mars-image-4.realsee-cdn.cn"]},"global-public.realsee-cdn.com":{type:"tencentCloud",pano:["global-image-1.realsee-cdn.com","global-image-2.realsee-cdn.com"],texture:["global-image-3.realsee-cdn.com"],tile:["global-tile-1.realsee-cdn.com","global-tile-2.realsee-cdn.com"],model:["global-model-1.realsee-cdn.com","global-model-2.realsee-cdn.com"],default:["global-image-4.realsee-cdn.com"]},"earth-ga-public.realsee-cdn.cn":{type:"tencentCloud",pano:["earth-ga-image-1.realsee-cdn.cn","earth-ga-image-2.realsee-cdn.cn"],texture:["earth-ga-image-3.realsee-cdn.cn"],tile:["earth-ga-tile-1.realsee-cdn.cn","earth-ga-tile-2.realsee-cdn.cn"],model:["earth-ga-model-1.realsee-cdn.cn","earth-ga-model-2.realsee-cdn.cn"],default:["earth-ga-image-4.realsee-cdn.cn"]},"test-vr-public.realsee-cdn.com":{type:"tencentCloud",pano:["test-vr-image.realsee-cdn.com","test-vr-image.realsee-cdn.com"],texture:["test-vr-image.realsee-cdn.com"],tile:["test-vr-image.realsee-cdn.com","test-vr-image.realsee-cdn.com"],model:["test-vr-image.realsee-cdn.com","test-vr-image.realsee-cdn.com"],default:["test-vr-image.realsee-cdn.com"]},"test-vr-public.realsee-cdn.cn":{type:"tencentCloud",pano:["test-vr-image.realsee-cdn.cn","test-vr-image.realsee-cdn.cn"],texture:["test-vr-image.realsee-cdn.cn"],tile:["test-vr-image.realsee-cdn.cn","test-vr-image.realsee-cdn.cn"],model:["test-vr-image.realsee-cdn.cn","test-vr-image.realsee-cdn.cn"],default:["test-vr-image.realsee-cdn.cn"]}},URL_DOMAIN_REGEX=/^https?\:\/\/?([^\/]+)/;function getDomain(n){var t=n.match(URL_DOMAIN_REGEX);return t===null?null:t[1]}function replaceDomain(n,t){return n.replace(URL_DOMAIN_REGEX,function(e,r){return e.slice(0,e.length-r.length)+t})}function route(n,t,e){var r=t.split("."),o=r[0],s=r.slice(1);if(o==="texture")return replaceDomain(n,e.texture[0]);if(o==="pano"||o==="pano_luminance"){s[0];var u=s[1];switch(u){case"front":case"left":case"up":return replaceDomain(n,e.pano[0]);case"down":case"right":case"back":return replaceDomain(n,e.pano[1])}}else if(o==="pano_tile"||o==="pano_tile_luminance"){s[0],s[1];var l=s[2],c=s[3],f=s[4],d=Math.pow(2,Number(l))*Number(c)+Number(f);if(!isNaN(d))return replaceDomain(n,e.tile[d%2])}else if(o==="model"){var p=s[0],d=Number(p);if(!isNaN(d))return replaceDomain(n,e.model[d%2])}return replaceDomain(n,e.default[0])}var tencentCloudImageProcesser=function(n,t){var e,r=n.split("?")[0],o=r.split(".").pop();if(o==="jpeg"&&(o="jpg"),o!=="png"&&o!=="jpg")return n;var s="";if(t.format!==void 0&&t.format!==o&&(s+="/format/".concat(t.format)),t.cut!==void 0&&(s+="/cut/".concat(t.cut[2],"x").concat(t.cut[3],"x").concat(t.cut[0],"x").concat(t.cut[1])),t.quality!==void 0){var u=(e=t.format)!==null&&e!==void 0?e:o;u&&["jpg","webp","tpg","heif","avif"].indexOf(u)>=0&&(s+="/quality/".concat(t.quality))}if(t.size!==void 0){var l=n.match(/\/cube_(\d+)\//),c=l?Number(l[1]):NaN;c!==Number(t.size)&&(s+="/thumbnail/".concat(t.size,"x"))}return t.sharpen!==void 0&&(s+="/sharpen/".concat(t.sharpen)),s.length&&(s="?imageMogr2"+s),r+s},aliyunOOSImageProcesser=function(n,t){var e,r=n.split("?")[0],o=r.split(".").pop();if(o==="jpeg"&&(o="jpg"),o!=="png"&&o!=="jpg")return n;var s="",u=[],l=t.format,c=t.quality,f=t.size;if(l!==void 0&&l!==o&&u.push("format,".concat(l==="heif"?"heic":l)),t.cut!==void 0){var d=t.cut,p=d[0],v=d[1],g=d[2],h=d[3];u.push("crop,x_".concat(p,",y_").concat(v,",w_").concat(g,",h_").concat(h,",g_nw"))}if(c!==void 0&&c!==100){var m=(e=t.format)!==null&&e!==void 0?e:o;m&&["jpg","webp"].indexOf(m)>=0&&u.push("quality,Q_".concat(c))}return f&&f!==2048&&u.push("resize,w_".concat(f)),t.sharpen!==void 0&&u.push("sharpen,".concat(t.sharpen)),u.length&&(s="?x-oss-process=image/"+u.join("/")),r+s},MAX_SAFE_INTEGER=9007199254740991;function formatNumber(n){var t=Math.round(n);return Math.abs(t-n)<.001?t:Math.floor(n)}function formatOptions(n){return n=Object.assign({},n),n.size!==void 0&&(n.size=formatNumber(clamp$1(n.size,0,MAX_SAFE_INTEGER))),n.quality!==void 0&&(n.quality=formatNumber(clamp$1(n.quality,0,100))),n.cut!==void 0&&(n.cut=[formatNumber(clamp$1(n.cut[0],0,MAX_SAFE_INTEGER)),formatNumber(clamp$1(n.cut[1],0,MAX_SAFE_INTEGER)),formatNumber(clamp$1(n.cut[2],0,MAX_SAFE_INTEGER)),formatNumber(clamp$1(n.cut[3],0,MAX_SAFE_INTEGER))]),n.sharpen!==void 0&&(n.sharpen=formatNumber(clamp$1(n.sharpen,0,MAX_SAFE_INTEGER))),n}function imageURL(n,t){var e=__assign(__assign({},DEFAULT_IMAGE_URL_MAPPINGS),t.mappings),r=getDomain(n);if(r===null)return n;t=formatOptions(t);var o=e[r];return o?(n=route(n,t.key,o),/\.basis(\?|$)/.test(n)&&(n=n.replace(/\.basis(\?|$)/,".jpg$1")),o.type==="tencentCloud"?tencentCloudImageProcesser(n,t):o.type==="aliyun"?aliyunOOSImageProcesser(n,t):n):n}function applyImageURLOptions(n,t,e){t===void 0&&(t=imageURL);var r=t(n,e);if(r===n&&e.cut)throw new Error("ImageURL: cut option not applied.");return r}var IMAGE_SIZE_REG=/\/cube_(\d+)\//;function getImageSizeFromURL(n){var t=n.match(IMAGE_SIZE_REG);return t?Number(t[1]):null}function replaceImageSize(n,t){return n.replace(IMAGE_SIZE_REG,"/cube_".concat(t,"/"))}var webp="data:image/webp;base64,UklGRiQAAABXRUJQVlA4IBgAAAAwAQCdASoCAAIAAUAmJaQAA3AA/vz0AAA=",avif="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAAGhbWV0YQAAAAAAAAAoaG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checkImage(n){return new Promise(function(t){var e=new Image,r=setTimeout(function(){e.onload=e.onerror=function(){},clearTimeout(r),t(!1)},100);e.onload=e.onerror=function(){e.onload=e.onerror=function(){},clearTimeout(r),t(e.height===2)},e.src=n})}var imageSupportCache=null;function imageSupport(){return imageSupportCache||(imageSupportCache=Promise.all([checkImage(webp),checkImage(avif),checkImage(heif)]).then(function(n){return{webp:n[0],avif:n[1],heif:n[2]}}))}var PANO_ID_REG=/^(.*)\[(\d+)\]$/;function panoStringify(n){if(!isNaN(n.panoIndex)&&isFinite(n.panoIndex))return"".concat(n.workCode,"[").concat(n.panoIndex,"]");throw new Error("Invalid Pano")}function panoParse(n){var t=n.match(PANO_ID_REG);if(t){t[0];var e=t[1],r=t[2],o=Math.floor(Number(r));if(!isNaN(o)&&isFinite(o))return{workCode:e,panoIndex:o}}throw new Error("Invalid PanoId")}function panoEqual(n,t){return panoStringify(n)===panoStringify(t)}function isPanoId(n){return typeof n=="string"&&PANO_ID_REG.test(n)}var PBMGroup=function(n){__extends(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t}(THREE__namespace.Group),PBMMesh=function(n){__extends(t,n);function t(e,r){return n.call(this,e,r)||this}return t.prototype.update=function(e,r,o,s){for(var u=0,l=this.material;u<l.length;u++){var c=l[u];c.update(e,r,o)}},t}(THREE__namespace.Mesh),PBMSkinnedMesh=function(n){__extends(t,n);function t(e,r,o){return n.call(this,e,r,o)||this}return t.prototype.update=function(e,r,o,s){for(var u=0,l=this.material;u<l.length;u++){var c=l[u];c.update(e,r,o)}},t}(THREE__namespace.SkinnedMesh);function jsonStableStrinfiy_(n,t){t===void 0&&(t=!1);var e=typeof n;if(e==="string")return JSON.stringify(n);if(n===!0)return"true";if(n===!1)return"false";if(n===null)return"null";if(n instanceof Array){for(var r="[",o=n.length-1,s=0;s<o;s++)r+=jsonStableStrinfiy_(n[s],!1)+",";return o>-1&&(r+=jsonStableStrinfiy_(n[s],!1)),r+"]"}if(n instanceof Object){if(typeof n.toJSON=="function")return jsonStableStrinfiy_(n.toJSON(),t);for(var u=Object.keys(n).sort(),l=u.length,r="",s=0;s<l;){var c=u[s],f=jsonStableStrinfiy_(n[c],!0);f!==void 0&&(s&&r!==""&&(r+=","),r+=JSON.stringify(c)+":"+f),s++}return"{"+r+"}"}switch(e){case"function":return JSON.stringify(n.toString());case"undefined":return t?void 0:null;case"number":return n;default:return isFinite(n)?n:null}}function jsonHash(n){return"hash::".concat(jsonStableStrinfiy_(n,!1))}var CustomShader=function(){function n(t){var e,r,o,s,u,l,c,f,d,p,v,g,h,m,y,A;this.uniforms=(e=t.uniforms)!==null&&e!==void 0?e:{},this.defines=(r=t.defines)!==null&&r!==void 0?r:{},this.type=t.type,this.vertex={mainBefore:(s=(o=t.vertex)===null||o===void 0?void 0:o.mainBefore)!==null&&s!==void 0?s:"",mainStart:(l=(u=t.vertex)===null||u===void 0?void 0:u.mainStart)!==null&&l!==void 0?l:"",mainEnd:(f=(c=t.vertex)===null||c===void 0?void 0:c.mainEnd)!==null&&f!==void 0?f:""},this.fragment={mainBefore:(p=(d=t.fragment)===null||d===void 0?void 0:d.mainBefore)!==null&&p!==void 0?p:"",mainStart:(g=(v=t.fragment)===null||v===void 0?void 0:v.mainStart)!==null&&g!==void 0?g:"",mainModelColor:(m=(h=t.fragment)===null||h===void 0?void 0:h.mainModelColor)!==null&&m!==void 0?m:"",mainEnd:(A=(y=t.fragment)===null||y===void 0?void 0:y.mainEnd)!==null&&A!==void 0?A:""}}return n.prototype.getHash=function(){return jsonHash({vertex:this.vertex,fragment:this.fragment,defines:this.defines})},n.prototype.onBeforeCompile=function(t,e){},n}(),gradientTexture=function(){return typeof document!="undefined"?new THREE__namespace.TextureLoader().load("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAgAAAAABCAYAAACouxZ2AAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAACAKADAAQAAAABAAAAAQAAAAB7UD0+AAACA0lEQVRIDXWUW3YjIQxEwdnV/GT/q8kO3FO3pAJst3PSAaR6Cbszf//9XeMxxpjXmI+pVXudp2s6PC4dqHff9e6D7/PZLy46xQvG+sZvrfK8xgXUeq85yINe9bdmtOK1+kun5vjgq58a+eZPna9jvmjiserqG/+Whathvo3L3WhV89L9sXI/m18z2uene9ap/ftsuT9WZxoHXzW56/fpj8l7+tTw7P011NdpqnY19sRsfuHMA9u8oZWfDz4+fra/dfG1V60ydZ7qba1g7UNAeK0JP7ydD7/OqH6wO2f7HTq+B/lbL9qsB3/N1/UzR81XfPzw4tp5OPvRneacteq8Xo0xR3vuv/kPz0KtX0Nhg0eHuaNXdWI3X/ld427h++vzyp99V6VPrzWFhbv4ayay4oFecm198MmUXN/mL+x7npq/uJXBGb/MTw4+t+SvbLoTZnUW5uHhz7nWcTxT73OwXV7cxT9wbBf/0LnDBgcnHmtPLYba32Hp808sMy1u88yhr58n70/v4xX92GSN19l/2UsqGmiH94Hpxjcs+DO/ccpIVNVp62PUWXu//ur1GQy1Cf+GZ13rtNYN1po3/NI79fGXibHkq4z25xvV2pW3szpneXsW8SsreTe/NIPrtXMnH7wPf+LEN6tqhUVHj3XKD/72p9eafCeYB3zuonnbv7yqP8d/o4K6gRb1wbYAAAAASUVORK5CYII="):new THREE__namespace.Texture}();gradientTexture.minFilter=THREE__namespace.NearestFilter,gradientTexture.magFilter=THREE__namespace.NearestFilter,gradientTexture.wrapS=THREE__namespace.RepeatWrapping,gradientTexture.wrapT=THREE__namespace.RepeatWrapping;var defaultPbmParameters={customShaders:[],pano0:null,pano1:null,floorStyle:"OPACITY",colorStyle:"RGB",constantColor:new THREE__namespace.Vector3(.6,.6,.6),shownFloorIndex:-1,modelAlpha:1,opacity:1,progress:0,transition:"FADE",clippers:null,brightness:1,useEDL:!1,useHQWeight:!1,useHQDepth:!1,pointSize:"ATTENUATION",pointBack:"DARK",pointShape:"CIRCLE",pointScale:.03,pointMaxPixel:40,pointMinPixel:1,gradientTexture,colorSaturation:0,colorBrightness:0};function isEqualClipperParameters(n,t){var e=n!=null?n:[],r=t!=null?t:[];if(r.length!==e.length)return!1;for(var o=0;o<r.length;o++)if(!e[o].clippingBoxMatrix.equals(r[o].clippingBoxMatrix)||e[o].floorIndex!==r[o].floorIndex)return!1;return!0}function isEqualPBMPanoPicture(n,t){return n&&t?n.luminanceMap===t.luminanceMap&&n.map===t.map&&n.zoom===t.zoom&&n.matrix.equals(t.matrix):!n&&!t}function updatePBMParameters(n,t){var e=!1;for(var r in t)if(t[r]!==void 0)switch(r){case"clippers":isEqualClipperParameters(n[r],t[r])||(n[r]=t[r],e=!0);break;case"pano0":case"pano1":isEqualPBMPanoPicture(n[r],t[r])||(n[r]=t[r],e=!0);break;default:n[r]!==t[r]&&(n[r]=t[r],e=!0);break}return e}function mixNumber(n,t,e){return n+(t-n)*e}function value(n,t,e,r){var o=(t*e+2*n)/Math.pow(e,3),s=-(2*t*e+3*n)/Math.pow(e,2),u=t,l=n;return o*Math.pow(r,3)+s*Math.pow(r,2)+u*r+l}function velocity(n,t,e,r){var o=(t*e+2*n)/Math.pow(e,3),s=-(2*t*e+3*n)/Math.pow(e,2),u=t;return 3*o*Math.pow(r,2)+2*s*r+u}function mixCircle(n,t,e,r){var o=r[1]-r[0];return n=circleValue(n,r),t=circleValue(t,r),t-n>o/2?mixNumber(n+o,t,e):n-t>o/2?mixNumber(n-o,t,e):mixNumber(n,t,e)}function circleValue(n,t){var e=t[1]-t[0];return n<t[0]?circleValue(n+e,t):n>=t[1]?circleValue(n-e,t):n}function mixValue(n,t,e,r){return r?mixCircle(n,t,e,r):mixNumber(n,t,e)}function toNumber(n){var t=Number(n);return isNaN(t)||!isFinite(t)?0:t}var Motion=function(){function n(t){this.config={},this.progress=1,this.ended=!0,this.value={},this.startTime=now(),this.startVelocity=0,this.duration=0,this.keyframes=[];for(var e in t){var r=t[e];typeof r=="object"?(this.value[e]=toNumber(r.value),this.config[e]={circle:r.circle}):(this.value[e]=toNumber(r),this.config[e]={circle:!1})}this.keyframes=[{progress:0,value:__assign({},this.value)},{progress:1,value:__assign({},this.value)}]}return n.prototype.getProgress=function(t){var e=t-this.startTime;return e<0?0:e>=this.duration?1:1-value(1,this.startVelocity,this.duration,e)},n.prototype.getValue=function(t){for(var e=1;e<this.keyframes.length;e++)if(this.keyframes[e].progress>t){var r=this.keyframes[e-1],o=this.keyframes[e],s={};for(var u in this.config){var l=(t-r.progress)/(o.progress-r.progress);s[u]=mixValue(r.value[u],o.value[u],l,this.config[u].circle)}return s}return __assign({},this.keyframes[this.keyframes.length-1].value)},n.prototype.getProgressVelocity=function(t){var e=t-this.startTime;return e>=this.duration?0:velocity(1,this.startVelocity,this.duration,e)},n.prototype.update=function(t){return this.ended?!0:(this.progress=Math.min(1,Math.max(0,this.progress,this.getProgress(t))),this.value=this.getValue(this.progress),this.ended=this.progress>=1,this.ended&&this.callbacks&&(this.callbacks[0](),this.callbacks=void 0),this.ended)},n.prototype.getKeyFrameSegment=function(t){for(var e=this.getProgress(t),r=1;r<this.keyframes.length;r++)if(this.keyframes[r].progress>e)return[this.keyframes[r-1],this.keyframes[r]];return[this.keyframes[this.keyframes.length-2],this.keyframes[this.keyframes.length-1]]},n.prototype.getTargetKeyframe=function(){return this.keyframes[this.keyframes.length-1]},n.prototype.set=function(t,e,r,o){var s;r===void 0&&(r=0),isNaN(e)&&(e=0),isNaN(r)&&(r=0),o=o!=null?o:now();var u=this.getProgress(o),l=this.getValue(u),c={};for(var f in this.config)c[f]=(s=t[f])!==null&&s!==void 0?s:l[f];var d=[{progress:0,value:l},{progress:1,value:c}];return this.setKeyframes(d,e,r,o)},n.prototype.setKeyframes=function(t,e,r,o){var s=this;if(r===void 0&&(r=0),t.length<2)throw new Error("keyframes invalid.");return isNaN(e)&&(e=0),isNaN(r)&&(r=0),this.callbacks&&(this.callbacks[1](new Error("motion aborted.")),this.callbacks=void 0),new Promise(function(u,l){o=o!=null?o:now(),s.progress=0,s.ended=!1,s.startTime=o,s.startVelocity=r,s.keyframes=t,s.duration=e,e===0?(s.progress=1,s.value=__assign({},t[t.length-1].value)):s.value=__assign({},t[0].value),s.callbacks=[u,l]})},n.prototype.dispose=function(){this.callbacks&&(this.callbacks[1](new Error("motion dispose.")),this.callbacks=void 0)},n}(),APPEAR_ANIMATION_DURATION=500;function easeInOutSine(n){return-(Math.cos(Math.PI*n)-1)/2}var PBMPointCloud=function(n){__extends(t,n);function t(e,r){var o=n.call(this,e,r)||this;return o.appearMotion=new Motion({appear:0}),o}return t.prototype.update=function(e,r,o,s){var u,l;if(this.material.update(e,r,o),s&&s.refine==="ADD"&&s.tileset.rootMeta.pntsOrder==="RANDOM"){var c=this.geometry,f=this.appearMotion,d=o.visible&&s.state.selectedFrameNumber===s.tileset.frameNumber,p=s.tileset.maxScreenSpaceError,v=s.state.screenSpaceError,g=(l=(u=s.parent)===null||u===void 0?void 0:u.state.screenSpaceError)!==null&&l!==void 0?l:v,h=1;if(s.levelOfContent>s.tileset.minLevelOfDetail&&g!==v&&(h=(g-p)/(g-v)),h=clamp$1(h,0,1),h=easeInOutSine(h),d){var m=1;f.getTargetKeyframe().value.appear!==m&&f.set({appear:m},APPEAR_ANIMATION_DURATION).catch(noop$1)}else{var m=0;f.getTargetKeyframe().value.appear!==m&&f.set({appear:m},0).catch(noop$1)}f.ended!==!0&&f.update(r.time);var y=c.index?c.index.count:c.attributes.position?c.attributes.position.count:1/0,A=Math.floor(y*h*f.value.appear);c.drawRange.count!==A&&(this.geometry.setDrawRange(0,A),o.needsRender=!0)}},t}(THREE__namespace.Points),scratchMaterialSet=new Set,PBMContainer=function(n){__extends(t,n);function t(){var e=n.call(this)||this;return e.needsRender=!0,e.pbmMaterialParametersVersion=0,e.materialParameters=__assign({},defaultPbmParameters),e}return t.prototype.getMaterial=function(){return __assign({},this.materialParameters)},t.prototype.setMaterial=function(e){var r=this;Object.assign(this.materialParameters,e),scratchMaterialSet.clear(),this.traverse(function(o){if(o instanceof PBMMesh)for(var s=0,u=o.material;s<u.length;s++){var l=u[s];scratchMaterialSet.has(l)||(Object.assign(l,r.materialParameters),scratchMaterialSet.add(l))}o instanceof PBMPointCloud&&(scratchMaterialSet.has(o.material)||(Object.assign(o.material,r.materialParameters),scratchMaterialSet.add(o.material)))}),scratchMaterialSet.clear(),this.needsRender=!0},t}(THREE__namespace.Group),FACE_ORDER$1=["right","left","up","down","front","back"];function getBox(n,t,e,r){var o=new THREE__namespace.Box3;switch(n){case"up":o.min.y=.5,o.max.y=.5,o.min.x=+t-.5,o.max.x=+t-.5+r,o.min.z=-e+.5-r,o.max.z=-e+.5;break;case"down":o.min.y=-.5,o.max.y=-.5,o.min.x=+t-.5,o.max.x=+t-.5+r,o.min.z=+e-.5,o.max.z=+e-.5+r;break;case"left":o.min.x=-.5,o.max.x=-.5,o.min.z=-t+.5-r,o.max.z=-t+.5,o.min.y=-e+.5-r,o.max.y=-e+.5;break;case"right":o.min.x=.5,o.max.x=.5,o.min.z=+t-.5,o.max.z=+t-.5+r,o.min.y=-e+.5-r,o.max.y=-e+.5;break;case"front":o.min.z=-.5,o.max.z=-.5,o.min.x=+t-.5,o.max.x=+t-.5+r,o.min.y=-e+.5-r,o.max.y=-e+.5;break;case"back":o.min.z=.5,o.max.z=.5,o.min.x=-t+.5-r,o.max.x=-t+.5,o.min.y=-e+.5-r,o.max.y=-e+.5;break}return o.applyMatrix4(new THREE__namespace.Matrix4().makeRotationY(Math.PI))}var createChildren=function(n,t){if(!(n.level>=t))for(var e=n.level+1,r=n.size/2,o=[new THREE__namespace.Vector2(n.position.x,n.position.y),new THREE__namespace.Vector2(n.position.x+r,n.position.y),new THREE__namespace.Vector2(n.position.x,n.position.y+r),new THREE__namespace.Vector2(n.position.x+r,n.position.y+r)],s=0,u=o;s<u.length;s++){var l=u[s],c={face:n.face,level:e,size:r,position:l,box:getBox(n.face,l.x,l.y,r),parent:n,children:[]};n.children.push(c),createChildren(c,t)}};function createTileCubeNode(n,t){var e={level:0,face:n,position:new THREE__namespace.Vector2(0,0),size:1,box:getBox(n,0,0,1),parent:null,children:[]};return createChildren(e,t),e}function createTileCubeTree(n){var t=FACE_ORDER$1.map(function(e){return createTileCubeNode(e,n)});return{children:t}}function traverseTileCubeNode(n,t){for(var e=0,r=n.children;e<r.length;e++){var o=r[e],s=t(o);s!==!1&&traverseTileCubeNode(o,t)}}var CUBE_GEOMETRY=new THREE__namespace.BoxBufferGeometry(1,1,1,1,1);CUBE_GEOMETRY.deleteAttribute("uv"),CUBE_GEOMETRY.deleteAttribute("normal"),CUBE_GEOMETRY.groups=[],CUBE_GEOMETRY.scale(-1,1,1);var CUBE_VERTEX_SHADER=`
|
|
392
392
|
varying vec3 worldPosition;
|
|
393
393
|
void main() {
|
|
394
394
|
vec4 transform = vec4(position, 1.0);
|
|
@@ -414,7 +414,7 @@ varying vec2 vUv;
|
|
|
414
414
|
void main() {
|
|
415
415
|
gl_FragColor = texture2D(map, vUv);
|
|
416
416
|
}
|
|
417
|
-
`,cacheMaterials=[],cameraPX=new THREE__namespace.PerspectiveCamera(90,1,.1,2);cameraPX.up.set(0,-1,0),cameraPX.lookAt(new THREE__namespace.Vector3(1,0,0)),cameraPX.updateMatrix(),cameraPX.matrixAutoUpdate=!1;var cameraNX=new THREE__namespace.PerspectiveCamera(90,1,.1,2);cameraNX.up.set(0,-1,0),cameraNX.lookAt(new THREE__namespace.Vector3(-1,0,0)),cameraNX.updateMatrix(),cameraNX.matrixAutoUpdate=!1;var cameraPY=new THREE__namespace.PerspectiveCamera(90,1,.1,2);cameraPY.up.set(0,0,1),cameraPY.lookAt(new THREE__namespace.Vector3(0,1,0)),cameraPY.updateMatrix(),cameraPY.matrixAutoUpdate=!1;var cameraNY=new THREE__namespace.PerspectiveCamera(90,1,.1,2);cameraNY.up.set(0,0,-1),cameraNY.lookAt(new THREE__namespace.Vector3(0,-1,0)),cameraNY.updateMatrix(),cameraNY.matrixAutoUpdate=!1;var cameraPZ=new THREE__namespace.PerspectiveCamera(90,1,.1,2);cameraPZ.up.set(0,-1,0),cameraPZ.lookAt(new THREE__namespace.Vector3(0,0,1)),cameraPZ.updateMatrix(),cameraPZ.matrixAutoUpdate=!1;var cameraNZ=new THREE__namespace.PerspectiveCamera(90,1,.1,2);cameraNZ.up.set(0,-1,0),cameraNZ.lookAt(new THREE__namespace.Vector3(0,0,-1)),cameraNZ.updateMatrix(),cameraNZ.matrixAutoUpdate=!1;var FACES={front:{camera:cameraPZ,index:4},back:{camera:cameraNZ,index:5},up:{camera:cameraPY,index:2},down:{camera:cameraNY,index:3},left:{camera:cameraNX,index:1},right:{camera:cameraPX,index:0}};function getMaterial(){var n=cacheMaterials.pop();return n||new THREE__namespace.ShaderMaterial({uniforms:{map:{value:null},flipY:{value:0}},vertexShader:PLANE_VERTEX_SHADER,fragmentShader:PLANE_FRAGMENT_SHADER,depthTest:!1,depthWrite:!1,stencilWrite:!1,blending:THREE__namespace.NoBlending,lights:!1,toneMapped:!1,fog:!1})}function releaseMaterial(n){n.uniforms.map.value=null,cacheMaterials.push(n)}function renderTexturesToCubeRenderTarget(n,t,e){var r=new THREE__namespace.Scene;r.matrixAutoUpdate=!1;var o=new THREE__namespace.Group;o.scale.set(1,1,-1),r.add(o);for(var s=[],u=new Set,l=0,c=n;l<c.length;l++){var f=c[l];u.add(f.face);var d=getMaterial();s.push(d),d.uniforms.map.value=f.texture,d.uniforms.flipY.value=f.flipY?1:0;var p=new THREE__namespace.Group,v=new THREE__namespace.Mesh(PLAME_GEOMETRY,d);v.position.set(f.position.x+f.size.x/2-.5,1-(f.position.y+f.size.y/2)-.5,-.5),v.scale.set(f.size.x,f.size.y,1),p.quaternion.copy(QUATERNION[f.face]),p.add(v),o.add(p)}var g=e.autoClear,h=e.sortObjects,m=e.xr.enabled,y=t.texture.generateMipmaps;e.autoClear=!1,e.sortObjects=!1,e.xr.enabled=!1,t.texture.generateMipmaps=!1;var A=e.getRenderTarget(),E=0;u.forEach(function(_){++E===u.size&&(t.texture.generateMipmaps=y),e.setRenderTarget(t,FACES[_].index),e.render(r,FACES[_].camera)}),e.setRenderTarget(A),e.autoClear=g,e.sortObjects=h,e.xr.enabled=m;for(var b=0,T=s;b<T.length;b++){var d=T[b];releaseMaterial(d)}}var canUseNativeImageBitmap=function(){return!1}();function createImageBitmapLikeImage(n){n===void 0&&(n={});var t=Object.assign(document.createElementNS("http://www.w3.org/1999/xhtml","img"),{crossOrigin:"",close:function(){n.onClose&&n.onClose.call(this),this.onerror=this.onload=this.close=noop$1,this.removeAttribute("src")}});return t}function createImageBitmapLike(n){return new Promise(function(t,e){var r=URL.createObjectURL(n),o=createImageBitmapLikeImage({onClose:function(){this.src===r&&URL.revokeObjectURL(r)}});o.onload=function(){o.src===r&&URL.revokeObjectURL(r),o.onload=o.onerror=noop$1,setTimeout(function(){t(o)},10)},o.onerror=function(){var s=o.src;o.onload=o.onerror=noop$1,o.close(),e(new Error("image load error: ".concat(s)))},o.decoding="async",o.src=r})}var canvasPool=[];function createCanvas(n,t){var e=canvasPool.shift();if(e)return e.width=n,e.height=t,e;var r=Object.assign(document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),{close:function(){r.close=noop$1,canvasPool.push(r)}});return r}function poolImageToTexture(n,t){if(t&&(n.width>t.width||n.height>t.height)){var e=createCanvas(Math.min(n.width,t.width),Math.min(n.height,t.height)),r=e.getContext("2d");r.clearRect(0,0,e.width,e.height),r.drawImage(n,0,0,e.width,e.height),n.close();var o=new THREE__namespace.Texture(e);o.needsUpdate=!0,o.flipY=!0;var s=o.dispose;return o.dispose=function(){e.close(),s.call(o),o.dispose=s},o}else{var u=new THREE__namespace.Texture(n);u.needsUpdate=!0,typeof ImageBitmap!="undefined"&&n instanceof ImageBitmap?u.flipY=!1:u.flipY=!0;var l=u.dispose;return u.dispose=function(){n.close(),l.call(u),u.dispose=l},u}}function poolImagesToCubeTexture(n){var t=new THREE__namespace.CubeTexture(n);t.needsUpdate=!0,t.flipY=!1;var e=t.dispose;return t.dispose=function(){for(var r=0,o=n;r<o.length;r++){var s=o[r];s.close()}e.call(t),t.dispose=e},t}var sharedSortVector3$1=new THREE__namespace.Vector3,FACE_ORDER=["right","left","up","down","front","back"],TileCubeTextureTarget=function(){function n(t,e,r,o,s){this.tileTree=e,this.tileSources=r,this.options=o,this.renderer=s,this.name="",this.needsRender=!1,this.maxRequest=n.DEFAULT_MAX_REQUEST,this.disposed=!1,this.loadedCubeNodes=new Set,this.loadingCubeNodes=new Set,this.drawedCubeNodes=new Set,this.baseCubeTexture=null,this._cubeRenderTarget=null,this.prepareToRender=[],this.baseCubeTexture=t}return Object.defineProperty(n.prototype,"cubeRenderTarget",{get:function(){return this._cubeRenderTarget},set:function(t){var e,r,o,s,u,l;if(t===null)throw new Error("cannot set cubeRenderTarget to null.");t.width!==this.options.textureSize&&t.setSize(this.options.textureSize,this.options.textureSize),t.texture.format=(e=this.options.format)!==null&&e!==void 0?e:THREE__namespace.RGBAFormat,t.texture.minFilter=(r=this.options.minFilter)!==null&&r!==void 0?r:THREE__namespace.LinearFilter,t.texture.magFilter=(o=this.options.magFilter)!==null&&o!==void 0?o:THREE__namespace.LinearFilter,t.texture.wrapS=(s=this.options.wrapS)!==null&&s!==void 0?s:THREE__namespace.ClampToEdgeWrapping,t.texture.wrapT=(u=this.options.wrapT)!==null&&u!==void 0?u:THREE__namespace.ClampToEdgeWrapping,t.texture.generateMipmaps=(l=this.options.generateMipmaps)!==null&&l!==void 0?l:!0,this.baseCubeTexture&&(renderCubeTextureToCubeRenderTarget(this.baseCubeTexture,t,this.renderer),this.baseCubeTexture.dispose(),this.baseCubeTexture=null),this._cubeRenderTarget&&renderCubeTextureToCubeRenderTarget(this._cubeRenderTarget.texture,t,this.renderer),this._cubeRenderTarget=t},enumerable:!1,configurable:!0}),n.prototype.requestTile=function(t){var e=this,r,o,s,u,l,c,f=this.tileSources.filter(function(m){return m.level===t.level})[0];if(!f)return this.loadedCubeNodes.add(t),this.prepareToRender.push({node:t,texture:null}),!1;var d=f.size,p=Math.pow(2,t.level)*t.position.y,v=Math.pow(2,t.level)*t.position.x,g="".concat(((s=(o=(r=this.options.imageURL)===null||r===void 0?void 0:r.options)===null||o===void 0?void 0:o.key)!==null&&s!==void 0?s:"pano.0").replace(/^pano/,"pano_tile"),".").concat(t.face,".").concat(t.level,".").concat(p,".").concat(v),h=__assign(__assign({},(l=(u=this.options.imageURL)===null||u===void 0?void 0:u.options)!==null&&l!==void 0?l:{key:"unknown"}),{key:g,size:f.scale>=1?void 0:d*t.size*f.scale,quality:void 0,cut:[d*t.position.x,d*t.position.y,d*t.size,d*t.size]});return this.loadingCubeNodes.add(t),this.options.textureLoader.loadTexture(f[t.face],{imageURL:{transform:(c=this.options.imageURL)===null||c===void 0?void 0:c.transform,options:__assign({},h)},format:THREE__namespace.RGBAFormat,timeout:this.options.timeout,magFilter:this.options.magFilter,minFilter:this.options.minFilter,fetcher:this.options.fetcher}).then(function(m){if(e.disposed){m.body.dispose();return}e.prepareToRender.push({node:t,texture:m.body}),e.loadedCubeNodes.add(t)}).catch(noop$1).then(function(){e.disposed||e.loadingCubeNodes.delete(t)}),!0},n.prototype.update=function(t,e){var r=this;if(!this.disposed){var o=t.planes[5].normal,s=Math.max(this.maxRequest-this.loadingCubeNodes.size,0),u=[];traverseTileCubeNode(this.tileTree,function(m){if(m.level>e||!t.intersectsBox(m.box))return!1;!r.loadedCubeNodes.has(m)&&!r.loadingCubeNodes.has(m)&&u.push(m)}),u.sort(function(m,y){return m.level!==y.level?m.level-y.level:m.box.getCenter(sharedSortVector3$1).angleTo(o)-y.box.getCenter(sharedSortVector3$1).angleTo(o)});for(var l=0,c=u;l<c.length;l++){var f=c[l];if(s<=0)break;var d=this.requestTile(f);d&&s--}if(this.cubeRenderTarget&&this.prepareToRender.length){this.prepareToRender.sort(function(m,y){return m.node.level-y.node.level});for(var p=[],v=0;v<this.prepareToRender.length;v++){var g=this.prepareToRender[v],f=g.node,h=g.texture;(f.parent===null||this.drawedCubeNodes.has(f.parent))&&(this.drawedCubeNodes.add(f),h&&p.push({face:f.face,position:f.position,size:new THREE__namespace.Vector2(f.size,f.size),texture:h,flipY:!h.flipY}),this.prepareToRender.splice(v,1),v--)}p.length&&(renderTexturesToCubeRenderTarget(p,this.cubeRenderTarget,this.renderer),this.needsRender=!0)}}},Object.defineProperty(n.prototype,"tilePending",{get:function(){return this.loadingCubeNodes.size},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"texture",{get:function(){if(!this._cubeRenderTarget)throw new Error("cubeRenderTarget never set.");return this._cubeRenderTarget.texture},enumerable:!1,configurable:!0}),n.prototype.dispose=function(){if(!this.disposed){this.disposed=!0,this.baseCubeTexture&&(this.baseCubeTexture.dispose(),this.baseCubeTexture=null),this.loadingCubeNodes.clear(),this.loadedCubeNodes.clear();for(var t=0,e=this.prepareToRender;t<e.length;t++){var r=e[t];r.texture&&r.texture.dispose()}this.prepareToRender.length=0}},n.DEFAULT_MAX_REQUEST=3,n}(),TextureLoader=function(){function n(){}return n.prototype.loadTexture=function(t,e,r,o,s,u){var l,c,f,d,p,v,g;r===void 0&&(r=noop$1),o===void 0&&(o=noop$1),s===void 0&&(s=noop$1);var h={};typeof e.flipY!="undefined"&&(h.flipY=e.flipY),typeof e.format!="undefined"&&(h.format=e.format),typeof e.encoding!="undefined"&&(h.encoding=e.encoding),h.generateMipmaps=(l=e.generateMipmaps)!==null&&l!==void 0?l:!1,h.minFilter=(c=e.minFilter)!==null&&c!==void 0?c:THREE__namespace.LinearFilter,h.magFilter=(f=e.magFilter)!==null&&f!==void 0?f:THREE__namespace.LinearFilter;var m=(p=(d=e.imageURL)===null||d===void 0?void 0:d.options)!==null&&p!==void 0?p:{key:"unknown"};t=applyImageURLOptions(t,(v=e.imageURL)===null||v===void 0?void 0:v.transform,m);var y=getProtocol(t),A=(g=e.viaAjax)!==null&&g!==void 0?g:canUseNativeImageBitmap,E=isJsonpSource(t),b=/^https?:/.test(y);if(E?A=!0:b||(A=!1),A){var T=null,_="blob";return e.fetcher.ajax(t,{timeout:e.timeout,responseType:_},void 0,void 0,s).then(function(M){return createImageBitmapLike(M.body)}).then(function(M){return poolImageToTexture(M,e.maxSize)}).then(function(M){return Object.assign(M,h),M}).then(function(M){var B={meta:T,body:M};return r(B),B}).catch(function(M){return o(M),Promise.reject(M)})}else{var R=null,S;return Promise.resolve().then(function(){return createImageBitmapLikeImage()}).then(function(M){return S=M,e.fetcher.loadImage(t,{timeout:e.timeout},void 0,void 0,s,M)}).then(function(M){return R=M.meta,poolImageToTexture(M.body,e.maxSize)}).then(function(M){return Object.assign(M,h),M}).then(function(M){var B={meta:R,body:M};return r(B),B}).catch(function(M){return S&&S.close(),o(M),Promise.reject(M)})}},n.prototype.loadCubeTexture=function(t,e,r,o,s,u){var l,c,f,d,p,v,g;r===void 0&&(r=noop$1),o===void 0&&(o=noop$1),s===void 0&&(s=noop$1);var h={};typeof e.format!="undefined"&&(h.format=e.format),h.generateMipmaps=(l=e.generateMipmaps)!==null&&l!==void 0?l:!1,h.minFilter=(c=e.minFilter)!==null&&c!==void 0?c:THREE__namespace.LinearFilter,h.magFilter=(f=e.magFilter)!==null&&f!==void 0?f:THREE__namespace.LinearFilter;for(var m=[t[FACE_ORDER[0]],t[FACE_ORDER[1]],t[FACE_ORDER[2]],t[FACE_ORDER[3]],t[FACE_ORDER[4]],t[FACE_ORDER[5]]],y=[],A=[0,0,0,0,0,0],E=[],b=function(_){var R=(p=(d=e.imageURL)===null||d===void 0?void 0:d.options)!==null&&p!==void 0?p:{key:"unknown"},S=applyImageURLOptions(m[_],(v=e.imageURL)===null||v===void 0?void 0:v.transform,__assign(__assign({},R),{key:R.key+"."+FACE_ORDER[_]})),M=getProtocol(S),B=function(k){A[_]=k,s(A.reduce(function(N,D){return N+D},0)/6)},H=(g=e.viaAjax)!==null&&g!==void 0?g:!1,w=/^https?:$/.test(M),C=isJsonpSource(S);if(C?H=!0:w||(H=!1),H){var L="blob",I=e.fetcher.ajax(S,{timeout:e.timeout,responseType:L},void 0,void 0,B).then(function(k){return E[_]=k.meta,createImageBitmapLike(k.body)});y.push(I)}else{var F,I=Promise.resolve().then(function(){return createImageBitmapLikeImage()}).then(function(N){return F=N,e.fetcher.loadImage(S,{timeout:e.timeout},void 0,void 0,B,N)}).then(function(N){return E[_]=N.meta,N.body}).catch(function(N){return F&&F.close(),Promise.reject(N)});y.push(I)}},T=0;T<6;T++)b(T);return Promise.all(y).then(function(_){return poolImagesToCubeTexture(_)}).then(function(_){return Object.assign(_,__assign({encoding:THREE__namespace.sRGBEncoding},h)),_}).then(function(_){var R={body:_,meta:E};return r(R),R}).catch(function(_){for(var R=0,S=y;R<S.length;R++){var M=S[R];M.then(function(B){return B.close()}).catch(noop$1)}return o(_),Promise.reject(_)})},n.prototype.loadTiledCubeTexture=function(t,e,r,o,s,u,l){var c=this;return o===void 0&&(o=noop$1),s===void 0&&(s=noop$1),u===void 0&&(u=noop$1),new Promise(function(f,d){var p,v;c.loadCubeTexture(t,{imageURL:{transform:(p=r.imageURL)===null||p===void 0?void 0:p.transform,options:(v=r.imageURL)===null||v===void 0?void 0:v.options},format:THREE__namespace.RGBAFormat,viaAjax:r.viaAjax,timeout:r.timeout,fetcher:r.fetcher,magFilter:r.magFilter,minFilter:r.minFilter,generateMipmaps:r.generateMipmaps},function(g){var h,m=g.meta,y=g.body,A=(h=r.tileMaxLevel)!==null&&h!==void 0?h:2,E=Math.max(1024*A,512),b=createTileCubeTree(A),T=new TileCubeTextureTarget(y,b,e,{textureSize:E,textureLoader:c,imageURL:r.imageURL,magFilter:r.magFilter,minFilter:r.minFilter,generateMipmaps:r.generateMipmaps,timeout:r.timeout,fetcher:r.fetcher},l),_={meta:m,body:T};o(_),f(_)},function(g){s(g),d(g)},u,l).catch(noop$1)})},n}();const meshNoneVertexShader=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=113,o=126,s=0,u="";return t[s].split(u).map(function(l){return l.charCodeAt(s)>o?l:String.fromCharCode((l.charCodeAt(s)+r)%o)}).join(u)}("n\bv{t-rpA-d|yq]|vv|{Hn\bv{t-rp@-PnzrnQvrpv|{H0v{pyqr-Ip|zz|{K0v{pyqr-Iz|}untrl}nlrr\x07K0v{pyqr-Ixv{{v{tl}nlrr\x07K0v{pyqr-Iy|tqr}uosl}nlrr\x07K0v{pyqr-Ipyv}}v{tl}yn{rl}nlrr\x07KZNV[lORS\\_R|vq-znv{56-\n--ZNV[l`aN_a--0v{pyqr-Ixv{onrlrr\x07K--0v{pyqr-Iortv{lrr\x07K--0v{pyqr-Iz|}untrlrr\x07K--0v{pyqr-Ixv{{v{tlrr\x07K--0v{pyqr-I}|wrplrr\x07K--0v{pyqr-Iy|tqr}uoslrr\x07K--0v{pyqr-Ipyv}}v{tl}yn{rlrr\x07K--d|yq]|vv|{-J-rpA5n{s|zrq9->;=6H--0vsqrs-b`RlV[`aN[PV[T----d|yq]|vv|{-J-v{n{prZnv\x07-7-d|yq]|vv|{H--0r{qvs--d|yq]|vv|{-J-z|qryZnv\x07-7-d|yq]|vv|{H--zn@-pnzrn_|nv|{Znv\x07-J-zn@5vrZnv\x07h=jh=j9-vrZnv\x07h>jh=j9-vrZnv\x07h?jh=j9-vrZnv\x07h=jh>j9-vrZnv\x07h>jh>j9-vrZnv\x07h?jh>j9-vrZnv\x07h=jh?j9-vrZnv\x07h>jh?j9-vrZnv\x07h?jh?j6H--PnzrnQvrpv|{-J-{|znyv r5pnzrn_|nv|{Znv\x07-7-rp@5=;=9-=;=9-:>;=66H--0v{pyqr-I|yq}|lrr\x07K--0v{pyqr-Is|tlrr\x07K--ZNV[lR[Q\f"),meshNoneFragmentShader=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=113,o=126,s=0,u="";return t[s].split(u).map(function(l){return l.charCodeAt(s)>o?l:String.fromCharCode((l.charCodeAt(s)+r)%o)}).join(u)}("0qrsv{r-OYNPXlP\\Y\\_-rpA5=;=EC9-=;>=C9-=;>AF9->;=6{vs|z-nz}yrPor-}n{|=lzn}H{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vv|{;\x07\b -:-}n{|>lznv\x07h@j;\x07\b 6H--}n{|>a|crr\x07-J- ||zcrp|5PnzrnQvrpv|{9-}n{|>a|crr\x079-}n{|>l ||z6H--}n{|>a|crr\x07-J-}n{|>a|crr\x07-7-zn@5}n{|>lznv\x076H--rpA-}n{|P|y|H--rpA-}n{|=P|y|-J-r\x07rPor5}n{|=lzn}9-}n{|=a|crr\x076H--rpA-}n{|>P|y|-J-r\x07rPor5}n{|>lzn}9-}n{|>a|crr\x076H--0vs-qrsv{rq5b`RlYbZV[N[PR6----}n{|=P|y|;n-J->;=-:-r\x07rPor5}n{|=lyzv{n{prZn}9-}n{|=a|crr\x076;H----}n{|>P|y|;n-J->;=-:-r\x07rPor5}n{|>lyzv{n{prZn}9-}n{|>a|crr\x076;H--0r{qvs--0vs-qrsv{rq5b`RlOYNPXla_N[`VaV\\[6----sy|n-oynpx]|tr-J-np|5:?;=-7-}|tr-8->;=6H----}n{|P|y|-J-zv\x075}n{|=P|y|9-OYNPXlP\\Y\\_9-zv{5>;=9-oynpx]|tr66H----}n{|P|y|-J-zv\x075}n{|P|y|9-}n{|>P|y|9-zn\x075=;=9-oynpx]|tr-:-]V-8->;=66H--0ryvs-qrsv{rq5b`Rl`]_RNQla_N[`VaV\\[6----rp?-prr{Pr{rP||q-J-r|yv|{-7-}v\x07ry_nv|-<-?;=H----sy|n-n{vv|{_nqv-J-qvn{pr5rp?5=;=9-=;=69-prr{Pr{rP||q6-7->;?H----sy|n-n{vv|{]|tr-J--qvn{pr5tylSntP||q;\x07\b9-prr{Pr{rP||q6-<-n{vv|{_nqvH----}n{|P|y|-J-zv\x075}n{|=P|y|9-}n{|>P|y|9-z||ur}5=;=9-=;?9-}|tr-:-n{vv|{]|tr66H--0ryr----}n{|P|y|-J-zv\x075}n{|=P|y|9-}n{|>P|y|9-}|tr6H--0r{qvs--tylSntP|y|-J-zv\x075}n{|P|y|9-rpA5}n{|P|y|;to9-=;=69-pynz}5z|qryNy}un-7-@=;=9-=;=9->;=66H--<<-JJJJJJJJJJJJJJJJ--ZNV[lZ\\QRYlP\\Y\\_--0v{pyqr-Is|tlsntzr{K--0v{pyqr-I}rzyv}yvrqlny}unlsntzr{K--0v{pyqr-Iqvurv{tlsntzr{K--ZNV[lR[Q\f"),meshBasicVertexShader=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=113,o=126,s=0,u="";return t[s].split(u).map(function(l){return l.charCodeAt(s)>o?l:String.fromCharCode((l.charCodeAt(s)+r)%o)}).join(u)}("0vs-qrsv{rq5b`RlRQY6--n\bv{t-sy|n-Y|tQr}uH0r{qvs0vs-qrsv{rq5b`RlcR_aRelZN_X6--nvor-sy|n-znxH0r{qvsn\bv{t-sy|n-V_||sZnxHn\bv{t-rpA-d|yq]|vv|{Hn\bv{t-rp@-PnzrnQvrpv|{Hn\bv{t-rp@-cvr]|vv|{H0v{pyqr-Ip|zz|{K0v{pyqr-Il}nlrr\x07K0v{pyqr-I?l}nlrr\x07K0v{pyqr-Ir{zn}l}nlrr\x07K0v{pyqr-Ip|y|l}nlrr\x07K0v{pyqr-Is|tl}nlrr\x07K0v{pyqr-Iz|}untrl}nlrr\x07K0v{pyqr-Ixv{{v{tl}nlrr\x07K0v{pyqr-Iy|tqr}uosl}nlrr\x07K0v{pyqr-Ipyv}}v{tl}yn{rl}nlrr\x07KZNV[lORS\\_R|vq-znv{56-\n--ZNV[l`aN_a--0v{pyqr-Ilrr\x07K--0v{pyqr-I?lrr\x07K--0v{pyqr-Ip|y|lrr\x07K--0v{pyqr-Ixv{onrlrr\x07K--0vsqrs-b`RlR[cZN]--0v{pyqr-Iortv{{|znylrr\x07K--0v{pyqr-Iz|}u{|znylrr\x07K--0v{pyqr-Ixv{{|znylrr\x07K--0v{pyqr-Iqrsny{|znylrr\x07K--0r{qvs--0v{pyqr-Iortv{lrr\x07K--0v{pyqr-Iz|}untrlrr\x07K--0v{pyqr-Ixv{{v{tlrr\x07K--0v{pyqr-I}|wrplrr\x07K--0v{pyqr-Iy|tqr}uoslrr\x07K--0v{pyqr-Ipyv}}v{tl}yn{rlrr\x07K--cvr]|vv|{-J-:z]|vv|{;\x07\b H--d|yq]|vv|{-J-rpA5n{s|zrq9->;=6H--0vsqrs-b`RlV[`aN[PV[T----d|yq]|vv|{-J-v{n{prZnv\x07-7-d|yq]|vv|{H--0r{qvs--d|yq]|vv|{-J-z|qryZnv\x07-7-d|yq]|vv|{H--zn@-pnzrn_|nv|{Znv\x07-J-zn@5vrZnv\x07h=jh=j9-vrZnv\x07h>jh=j9-vrZnv\x07h?jh=j9-vrZnv\x07h=jh>j9-vrZnv\x07h>jh>j9-vrZnv\x07h?jh>j9-vrZnv\x07h=jh?j9-vrZnv\x07h>jh?j9-vrZnv\x07h?jh?j6H--PnzrnQvrpv|{-J-{|znyv r5pnzrn_|nv|{Znv\x07-7-rp@5=;=9-=;=9-:>;=66H--0vs-qrsv{rq5b`RlRQY6----Y|tQr}u-J-y|t?5:z]|vv|{; 6H--0r{qvs--V_||sZnx-J-=;=H--0vs-qrsv{rq5b`RlcR_aRelZN_X6----V_||sZnx-J-r}5no5znx-:->;=69-=;>6H--0r{qvs--0v{pyqr-I|yq}|lrr\x07K--0v{pyqr-Ir{zn}lrr\x07K--0v{pyqr-Is|tlrr\x07K--ZNV[lR[Q\f"),meshBasicFragmentShader=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=113,o=126,s=0,u="";return t[s].split(u).map(function(l){return l.charCodeAt(s)>o?l:String.fromCharCode((l.charCodeAt(s)+r)%o)}).join(u)}("0qrsv{r-OYNPXlP\\Y\\_-rpA5=;=EC9-=;>=C9-=;>AF9->;=6{vs|z-sy|n-sy||H{vs|z-nz}yrPor-}n{|=lzn}H{vs|z-znA-}n{|=lznv\x07H{vs|z-sy|n-}n{|=l ||zH0vs-qrsv{rq5b`RlYbZV[N[PR6--{vs|z-nz}yrPor-}n{|=lyzv{n{prZn}H0r{qvs{vs|z-nz}yrPor-}n{|>lzn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qr-Iporllrsyrpv|{lsntzr{K0v{pyqr-Is|tl}nlsntzr{K0v{pyqr-I}rpynzn}l}nlsntzr{K0v{pyqr-Iy|tqr}uosl}nlsntzr{K0v{pyqr-Ipyv}}v{tl}yn{rl}nlsntzr{Krp@- ||zcrp|5rp@-qvrpv|{9-rp@-rp|9-sy|n- ||z6-\n--sy|n-urn-J-q|5qvrpv|{9-rp|6H--rp@-q-J-qvrpv|{-7-urnH--rp@-}-J-rp|-:-qH--rp@-\0-J-}-7- ||zH--r{-{|znyv r5q-8-\x006H\frp@-to?u5rp@-p6-\n----rpA-X-J-rpA5=;=9-:>;=-<-@;=9-?;=-<-@;=9-:>;=6H----rpA-}-J-zv\x075rpA5p;ot9-X; 69-rpA5p;to9-X;\x07\b69-r}5p;o9-p;t66H----rpA-\0-J-zv\x075rpA5};\x07\b9-p;69-rpA5p;9-};\b \x0769-r}5};\x079-p;66H----sy|n-q-J-\0;\x07-:-zv{5\0;9-\0;\b6H----sy|n-r-J->;=r:>=H----r{-rp@5no5\0; -8-5\0;-:-\0;\b6-<-5C;=-7-q-8-r669-q-<-5\0;\x07-8-r69-\0;\x076H\frp@-u?to5rp@-p6-\n----rpA-X-J-rpA5>;=9-?;=-<-@;=9->;=-<-@;=9-@;=6H----rp@-}-J-no5snp5p;\x07\x07\x07-8-X;\x07\b 6-7-C;=-:-X;6H----r{-p; -7-zv\x075X;\x07\x07\x079-pynz}5}-:-X;\x07\x07\x079-=;=9->;=69-p;\b6H\frp@-trP|y|O\bUrvtu5nz}yr?Q-tnqvr{ar\x07r9-rpA-d|yq]|vv|{6-\n--sy|n--J-5d|yq]|vv|{;\b-:-z|qryO|{qv{tZv{;\b6-<-5z|qryO|{qv{tZn\x07;\b-:-z|qryO|{qv{tZv{;\b6H--r{-r\x07r?Q5tnqvr{ar\x07r9-rp?59-=;B66;toH\fZNV[lORS\\_R|vq-znv{56-\n--ZNV[l`aN_a--<<-JJJ-顶部裁切-JJJ--sy|n-||sP]|tr-J-}|5pynz}5:PnzrnQvrpv|{;\b9-=;=9->;=69-@;=6H--vs-5----V_||sZnx-K-=;B-33----d|yq]|vv|{;\b-K-z|qryO|{qv{tZn\x07;\b-:-||sP]|tr-7-5z|qryO|{qv{tZn\x07;\b-:-z|qryO|{qv{tZv{;\b6--6-\n----qvpnqH--\f--<<-JJJJJJJJJJJJJJ--<<-JJJ-前置裁切计算-JJJ--0vs-[bZlPYV]]R_`-K-=----o||y-pyv}}rqH----rpA-pyv}}r]|vv|{H----0}ntzn-{|yyly||}ln----s|-5-v{-v-J-=H-v-I-[bZlPYV]]R_`H-v-88-6-\n------pyv}}r]|vv|{-J-pyv}}rh-v-j;znv\x07V{rr-7-d|yq]|vv|{H------pyv}}rq-J-5pyv}}rh-v-j;sy||V{qr\x07-I-=;=-\v\v-no5sy||-:-pyv}}rh-v-j;sy||V{qr\x076-I->;=6H------pyv}}rq-J-pyv}}rq-33-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--------qvpnqH------\f----\f----0}ntzn-{|yyly||}lr{q--0r{qvs--<<-JJJJJJJJJJJJJJJJJJ--0v{pyqr-Ipyv}}v{tl}yn{rlsntzr{K--rpA-qvssrP|y|-J-rpA5-qvssr9-|}npv\b-6H--<<-JJJ-高度色-JJJ--0vs-qrsv{rq5b`RlP\\Y\\_lNYaVabQR6----qvssrP|y|;to-J-trP|y|O\bUrvtu5tnqvr{ar\x07r9-d|yq]|vv|{6H--0r{qvs--<<-JJJJJJJJJJJ--<<-JJJ-纯色-JJJ--0vs-qrsv{rq5b`RlP\\Y\\_lP\\[`aN[a6----qvssrP|y|;to-J-p|{n{P|y|H--0r{qvs--<<-JJJJJJJJJJJ--0v{pyqr-Iy|tqr}uoslsntzr{K--0v{pyqr-Izn}lsntzr{K--0v{pyqr-Ip|y|lsntzr{K--0v{pyqr-Iny}unzn}lsntzr{K--0v{pyqr-Iny}unrlsntzr{K--0v{pyqr-I}rpynzn}lsntzr{K--_rsyrprqYvtu-rsyrprqYvtu-J-_rsyrprqYvtu5-rp@5-=;=-69-rp@5-=;=-69-rp@5-=;=-69-rp@5-=;=-6-6H--<<-nppzynv|{-5onxrq-v{qvrp-yvtuv{t-|{y\b6--0vsqrs-b`RlYVTUaZN]----rpA-yvtuZn}ar\x07ryJ-r\x07r?Q5-yvtuZn}9-b?-6H----rsyrprqYvtu;v{qvrpQvssr-8J-yvtuZn}ar\x07rya|Yv{rn5-yvtuZn}ar\x07ry-6;to-7-yvtuZn}V{r{v\bH--0ryr----rsyrprqYvtu;v{qvrpQvssr-8J-rp@5->;=-6H--0r{qvs--<<-z|qynv|{--0v{pyqr-In|zn}lsntzr{K--rsyrprqYvtu;v{qvrpQvssr-7J-qvssrP|y|;toH--rp@-|t|v{tYvtu-J-rsyrprqYvtu;v{qvrpQvssrH--0v{pyqr-Ir{zn}lsntzr{K--tylSntP|y|-J-rpA5-|t|v{tYvtu9-qvssrP|y|;n-6H--<<-JJJ-楼层显示-JJJ--sy|n-sy||\\}npv\b-J->;=H--vs-5u|{Sy||V{qr\x07-K-:=;=>-33-no5sy||-:-u|{Sy||V{qr\x076-K-=;FF6-\n----sy||\\}npv\b-J-=;?-7-zv{55>;=-8-PnzrnQvrpv|{;\b69->;=6H--\f--tylSntP|y|;n-J-tylSntP|y|;n-7-sy||\\}npv\b-7-ovtu{rH--<<-JJJJJJJJJJJJJJ--ZNV[lZ\\QRYlP\\Y\\_--<<色调映射-色彩空间转换--0v{pyqr-I|{rzn}}v{tlsntzr{K--0v{pyqr-Ir{p|qv{tlsntzr{K--<<-JJJ-颜色增益调整-JJJ--rp@-toP|y|-J-tylSntP|y|;toH--rp@-uP|y|-J-to?u5toP|y|6H--uP|y|;\b-8J-p|y|`nnv|{H--uP|y|; -8J-p|y|Ovtu{rH--tylSntP|y|;to-J-u?to5uP|y|6H--<<-JJJ-全景图-JJJ--rp@-}n{|=a|crr\x07-J-{|znyv r5d|yq]|vv|{;\x07\b -:-}n{|=lznv\x07h@j;\x07\b 6H--}n{|=a|crr\x07-J- ||zcrp|5PnzrnQvrpv|{9-}n{|=a|crr\x079-}n{|=l ||z6H--}n{|=a|crr\x07-J-}n{|=a|crr\x07-7-zn@5}n{|=lznv\x076H--rp@-}n{|>a|crr\x07-J-{|znyv r5d|yq]|vv|{;\x07\b -:-}n{|>lznv\x07h@j;\x07\b 6H--}n{|>a|crr\x07-J- ||zcrp|5PnzrnQvrpv|{9-}n{|>a|crr\x079-}n{|>l ||z6H--}n{|>a|crr\x07-J-}n{|>a|crr\x07-7-zn@5}n{|>lznv\x076H--rpA-}n{|P|y|H--rpA-}n{|=P|y|-J-r\x07rPor5}n{|=lzn}9-}n{|=a|crr\x076H--rpA-}n{|>P|y|-J-r\x07rPor5}n{|>lzn}9-}n{|>a|crr\x076H--0vs-qrsv{rq5b`RlYbZV[N[PR6----}n{|=P|y|;n-J->;=-:-r\x07rPor5}n{|=lyzv{n{prZn}9-}n{|=a|crr\x076;H----}n{|>P|y|;n-J->;=-:-r\x07rPor5}n{|>lyzv{n{prZn}9-}n{|>a|crr\x076;H--0r{qvs--0vs-qrsv{rq5b`RlOYNPXla_N[`VaV\\[6----sy|n-oynpx]|tr-J-np|5:?;=-7-}|tr-8->;=6H----}n{|P|y|-J-zv\x075}n{|=P|y|9-OYNPXlP\\Y\\_9-zv{5>;=9-oynpx]|tr66H----}n{|P|y|-J-zv\x075}n{|P|y|9-}n{|>P|y|9-zn\x075=;=9-oynpx]|tr-:-]V-8->;=66H--0ryvs-qrsv{rq5b`Rl`]_RNQla_N[`VaV\\[6----rp?-prr{Pr{rP||q-J-r|yv|{-7-}v\x07ry_nv|-<-?;=H----sy|n-n{vv|{_nqv-J-qvn{pr5rp?5=;=9-=;=69-prr{Pr{rP||q6-7->;?H----sy|n-n{vv|{]|tr-J-qvn{pr5tylSntP||q;\x07\b9-prr{Pr{rP||q6-<-n{vv|{_nqvH----}n{|P|y|-J-zv\x075}n{|=P|y|9-}n{|>P|y|9-z||ur}5=;=9-=;?9-}|tr-:-n{vv|{]|tr66H--0ryr----}n{|P|y|-J-zv\x075}n{|=P|y|9-}n{|>P|y|9-}|tr6H--0r{qvs--tylSntP|y|-J-zv\x075}n{|P|y|9-tylSntP|y|9-z|qryNy}un6H--<<-JJJJJJJJJJJJJ--0v{pyqr-Is|tlsntzr{K--0v{pyqr-I}rzyv}yvrqlny}unlsntzr{K--0v{pyqr-Iqvurv{tlsntzr{K--0vs-qrsv{rq5b`RlRQY6----tylSntP|y|;n-J-Y|tQr}uH--0r{qvs--ZNV[lR[Q\f"),meshPhongVertexShader=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=113,o=126,s=0,u="";return t[s].split(u).map(function(l){return l.charCodeAt(s)>o?l:String.fromCharCode((l.charCodeAt(s)+r)%o)}).join(u)}("0qrsv{r-]U\\[T0vs-qrsv{rq5b`RlRQY6--n\bv{t-sy|n-Y|tQr}uH0r{qvs0vs-qrsv{rq5b`RlcR_aRelZN_X6--nvor-sy|n-znxH0r{qvsn\bv{t-sy|n-V_||sZnxHn\bv{t-rpA-d|yq]|vv|{Hn\bv{t-rp@-PnzrnQvrpv|{Hn\bv{t-rp@-cvr]|vv|{H0vs{qrs-SYNal`UNQRQ--n\bv{t-rp@-[|znyH0r{qvs0v{pyqr-Ip|zz|{K0v{pyqr-Il}nlrr\x07K0v{pyqr-I?l}nlrr\x07K0v{pyqr-Iqv}ynprzr{zn}l}nlrr\x07K0v{pyqr-Ir{zn}l}nlrr\x07K0v{pyqr-Ip|y|l}nlrr\x07K0v{pyqr-Is|tl}nlrr\x07K0v{pyqr-Iz|}untrl}nlrr\x07K0v{pyqr-Ixv{{v{tl}nlrr\x07K0v{pyqr-Iunq|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||sZnx-J-=;=H--0vs-qrsv{rq5b`RlcR_aRelZN_X6----V_||sZnx-J-r}5no5znx-:->;=69-=;>6H--0r{qvs--0v{pyqr-I|yq}|lrr\x07K--0v{pyqr-Ir{zn}lrr\x07K--0v{pyqr-Iunq|zn}lrr\x07K--0v{pyqr-Is|tlrr\x07K--ZNV[lR[Q\f"),meshPhongFragmentShader=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=113,o=126,s=0,u="";return t[s].split(u).map(function(l){return l.charCodeAt(s)>o?l:String.fromCharCode((l.charCodeAt(s)+r)%o)}).join(u)}("0qrsv{r-]U\\[T0qrsv{r-OYNPXlP\\Y\\_-rpA5=;=EC9-=;>=C9-=;>AF9->;=6{vs|z-sy|n-sy||H{vs|z-nz}yrPor-}n{|=lzn}H{vs|z-znA-}n{|=lznv\x07H{vs|z-sy|n-}n{|=l ||zH0vs-qrsv{rq5b`RlYbZV[N[PR6--{vs|z-nz}yrPor-}n{|=lyzv{n{prZn}H0r{qvs{vs|z-nz}yrPor-}n{|>lzn}H{vs|z-znA-}n{|>lznv\x07H{vs|z-sy|n-}n{|>l ||zH0vs-qrsv{rq5b`RlYbZV[N[PR6--{vs|z-nz}yrPor-}n{|>lyzv{n{prZn}H0r{qvs{vs|z-sy|n-z|qryNy}unH{vs|z-sy|n-}|trH0vs-qrsv{rq5b`RlP\\Y\\_lP\\[`aN[a6--{vs|z-rp@-p|{n{P|y|H0r{qvs0vs-qrsv{rq5b`RlP\\Y\\_lNYaVabQR6--{vs|z-nz}yr?Q-tnqvr{ar\x07rH0r{qvsp-Pyv}}r-\n--znA-znv\x07V{rrH--sy|n-sy||V{qr\x07H\fH0vs-[bZlPYV]]R_`-K-=--{vs|z-Pyv}}r-pyv}}rh[bZlPYV]]R_`jH0r{qvs0vs-qrsv{rq5b`RlRQY6--n\bv{t-sy|n-Y|tQr}uH0r{qvsn\bv{t-rpA-d|yq]|vv|{Hn\bv{t-rp@-PnzrnQvrpv|{Hn\bv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5rp@-p6-\n----rpA-X-J-rpA5=;=9-:>;=-<-@;=9-?;=-<-@;=9-:>;=6H----rpA-}-J-zv\x075rpA5p;ot9-X; 69-rpA5p;to9-X;\x07\b69-r}5p;o9-p;t66H----rpA-\0-J-zv\x075rpA5};\x07\b9-p;69-rpA5p;9-};\b \x0769-r}5};\x079-p;66H----sy|n-q-J-\0;\x07-:-zv{5\0;9-\0;\b6H----sy|n-r-J->;=r:>=H----r{-rp@5no5\0; -8-5\0;-:-\0;\b6-<-5C;=-7-q-8-r669-q-<-5\0;\x07-8-r69-\0;\x076H\frp@-u?to5rp@-p6-\n----rpA-X-J-rpA5>;=9-?;=-<-@;=9->;=-<-@;=9-@;=6H----rp@-}-J-no5snp5p;\x07\x07\x07-8-X;\x07\b 6-7-C;=-:-X;6H----r{-p; -7-zv\x075X;\x07\x07\x079-pynz}5}-:-X;\x07\x07\x079-=;=9->;=69-p;\b6H\frp@-trP|y|O\bUrvtu5nz}yr?Q-tnqvr{ar\x07r9-rpA-d|yq]|vv|{6-\n--sy|n--J-5d|yq]|vv|{;\b-:-z|qryO|{qv{tZv{;\b6-<-5z|qryO|{qv{tZn\x07;\b-:-z|qryO|{qv{tZv{;\b6H--r{-r\x07r?Q5tnqvr{ar\x07r9-rp?59-=;B66;toH\fZNV[lORS\\_R|vq-znv{56-\n--ZNV[l`aN_a--<<-JJJ-顶部裁切-JJJ--sy|n-||sP]|tr-J-}|5pynz}5:PnzrnQvrpv|{;\b9-=;=9->;=69-@;=6H--vs-5----V_||sZnx-K-=;B-33----d|yq]|vv|{;\b-K-z|qryO|{qv{tZn\x07;\b-:-||sP]|tr-7-5z|qryO|{qv{tZn\x07;\b-:-z|qryO|{qv{tZv{;\b6--6-\n----qvpnqH--\f--<<-JJJJJJJJJJJJJJ--<<-JJJ-前置裁切计算-JJJ--0vs-[bZlPYV]]R_`-K-=----o||y-pyv}}rqH----rpA-pyv}}r]|vv|{H----0}ntzn-{|yyly||}ln----s|-5-v{-v-J-=H-v-I-[bZlPYV]]R_`H-v-88-6-\n------pyv}}r]|vv|{-J-pyv}}rh-v-j;znv\x07V{rr-7-d|yq]|vv|{H------pyv}}rq-J-5pyv}}rh-v-j;sy||V{qr\x07-I-=;=-\v\v-no5sy||-:-pyv}}rh-v-j;sy||V{qr\x076-I->;=6H------pyv}}rq-J-pyv}}rq-33-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--------qvpnqH------\f----\f----0}ntzn-{|yyly||}lr{q--0r{qvs--<<-JJJJJJJJJJJJJJJJ--0v{pyqr-Ipyv}}v{tl}yn{rlsntzr{K--rpA-qvssrP|y|-J-rpA5-qvssr9-|}npv\b-6H--<<-JJJ-高度色-JJJ--0vs-qrsv{rq5b`RlP\\Y\\_lNYaVabQR6----qvssrP|y|;to-J-trP|y|O\bUrvtu5tnqvr{ar\x07r9-d|yq]|vv|{6H--0r{qvs--<<-JJJJJJJJJJJ--<<-JJJ-纯色-JJJ--0vs-qrsv{rq5b`RlP\\Y\\_lP\\[`aN[a6----qvssrP|y|;to-J-p|{n{P|y|H--0r{qvs--<<-JJJJJJJJJJJ--_rsyrprqYvtu-rsyrprqYvtu-J-_rsyrprqYvtu5-rp@5-=;=-69-rp@5-=;=-69-rp@5-=;=-69-rp@5-=;=-6-6H--rp@-|nyRzvvr_nqvn{pr-J-rzvvrH--0v{pyqr-Iy|tqr}uoslsntzr{K--0v{pyqr-Izn}lsntzr{K--0v{pyqr-Ip|y|lsntzr{K--0v{pyqr-Iny}unzn}lsntzr{K--0v{pyqr-Iny}unrlsntzr{K--0v{pyqr-I}rpynzn}lsntzr{K--0v{pyqr-I{|znylsntzr{lortv{K--0v{pyqr-I{|znylsntzr{lzn}K--0v{pyqr-Irzvvrzn}lsntzr{K--<<-nppzynv|{--0v{pyqr-Iyvtul}u|{tlsntzr{K--0v{pyqr-Iyvtulsntzr{lortv{K--0v{pyqr-Iyvtulsntzr{lzn}K--0v{pyqr-Iyvtulsntzr{lr{qK--<<-z|qynv|{--0v{pyqr-In|zn}lsntzr{K--rp@-|t|v{tYvtu-J-rsyrprqYvtu;qvrpQvssr-8-rsyrprqYvtu;v{qvrpQvssr-8-rsyrprqYvtu;qvrp`}rpyn-8-rsyrprqYvtu;v{qvrp`}rpyn-8-|nyRzvvr_nqvn{prH--0v{pyqr-Ir{zn}lsntzr{K--tylSntP|y|-J-rpA5-|t|v{tYvtu9-qvssrP|y|;n-6H--<<-JJJ-楼层显示-JJJ--sy|n-sy||\\}npv\b-J->;=H--vs-5u|{Sy||V{qr\x07-K-:=;=>-33-no5sy||-:-u|{Sy||V{qr\x076-K-=;FF6-\n----sy||\\}npv\b-J-=;?-7-zv{55>;=-8-PnzrnQvrpv|{;\b69->;=6H--\f--tylSntP|y|;n-J-tylSntP|y|;n-7-sy||\\}npv\b-7-ovtu{rH--<<-JJJJJJJJJJJJJJ--ZNV[lZ\\QRYlP\\Y\\_--<<色调映射-色彩空间转换--0v{pyqr-I|{rzn}}v{tlsntzr{K--0v{pyqr-Ir{p|qv{tlsntzr{K--<<-JJJ-颜色增益调整-JJJ--rp@-toP|y|-J-tylSntP|y|;toH--rp@-uP|y|-J-to?u5toP|y|6H--uP|y|;\b-8J-p|y|`nnv|{H--uP|y|; -8J-p|y|Ovtu{rH--tylSntP|y|;to-J-u?to5uP|y|6H--<<-JJJ-全景图-JJJ--rp@-}n{|=a|crr\x07-J-{|znyv r5d|yq]|vv|{;\x07\b -:-}n{|=lznv\x07h@j;\x07\b 6H--}n{|=a|crr\x07-J- ||zcrp|5PnzrnQvrpv|{9-}n{|=a|crr\x079-}n{|=l ||z6H--}n{|=a|crr\x07-J-}n{|=a|crr\x07-7-zn@5}n{|=lznv\x076H--rp@-}n{|>a|crr\x07-J-{|znyv r5d|yq]|vv|{;\x07\b -:-}n{|>lznv\x07h@j;\x07\b 6H--}n{|>a|crr\x07-J- ||zcrp|5PnzrnQvrpv|{9-}n{|>a|crr\x079-}n{|>l ||z6H--}n{|>a|crr\x07-J-}n{|>a|crr\x07-7-zn@5}n{|>lznv\x076H--rpA-}n{|P|y|H--rpA-}n{|=P|y|-J-r\x07rPor5}n{|=lzn}9-}n{|=a|crr\x076H--rpA-}n{|>P|y|-J-r\x07rPor5}n{|>lzn}9-}n{|>a|crr\x076H--0vs-qrsv{rq5b`RlYbZV[N[PR6----}n{|=P|y|;n-J->;=-:-r\x07rPor5}n{|=lyzv{n{prZn}9-}n{|=a|crr\x076;H----}n{|>P|y|;n-J->;=-:-r\x07rPor5}n{|>lyzv{n{prZn}9-}n{|>a|crr\x076;H--0r{qvs--0vs-qrsv{rq5b`RlOYNPXla_N[`VaV\\[6----sy|n-oynpx]|tr-J-np|5:?;=-7-}|tr-8->;=6H----}n{|P|y|-J-zv\x075}n{|=P|y|9-OYNPXlP\\Y\\_9-zv{5>;=9-oynpx]|tr66H----}n{|P|y|-J-zv\x075}n{|P|y|9-}n{|>P|y|9-zn\x075=;=9-oynpx]|tr-:-]V-8->;=66H--0ryvs-qrsv{rq5b`Rl`]_RNQla_N[`VaV\\[6----rp?-prr{Pr{rP||q-J-r|yv|{-7-}v\x07ry_nv|-<-?;=H----sy|n-n{vv|{_nqv-J-qvn{pr5rp?5=;=9-=;=69-prr{Pr{rP||q6-7->;?H----sy|n-n{vv|{]|tr-J-qvn{pr5tylSntP||q;\x07\b9-prr{Pr{rP||q6-<-n{vv|{_nqvH----}n{|P|y|-J-zv\x075}n{|=P|y|9-}n{|>P|y|9-z||ur}5=;=9-=;?9-}|tr-:-n{vv|{]|tr66H--0ryr----}n{|P|y|-J-zv\x075}n{|=P|y|9-}n{|>P|y|9-}|tr6H--0r{qvs--tylSntP|y|-J-zv\x075}n{|P|y|9-tylSntP|y|9-z|qryNy}un6H--<<-JJJJJJJJJJJJJJ--0v{pyqr-Is|tlsntzr{K--0v{pyqr-I}rzyv}yvrqlny}unlsntzr{K--0v{pyqr-Iqvurv{tlsntzr{K--0vs-qrsv{rq5b`RlRQY6----tylSntP|y|;n-J-Y|tQr}uH--0r{qvs--ZNV[lR[Q\f");var pbmUniforms$1={modelAlpha:new THREE__namespace.Uniform(0),progress:new THREE__namespace.Uniform(0),pano0_map:new THREE__namespace.Uniform(null),pano0_luminanceMap:new THREE__namespace.Uniform(null),pano0_matrix:new THREE__namespace.Uniform(new THREE__namespace.Matrix4),pano0_zoom:new THREE__namespace.Uniform(1),pano1_map:new THREE__namespace.Uniform(null),pano1_luminanceMap:new THREE__namespace.Uniform(null),pano1_matrix:new THREE__namespace.Uniform(new THREE__namespace.Matrix4),pano1_zoom:new THREE__namespace.Uniform(1),gradientTexture:new THREE__namespace.Uniform(null),clippers:new THREE__namespace.Uniform([]),shownFloorIndex:new THREE__namespace.Uniform(-1),constantColor:new THREE__namespace.Uniform(new THREE__namespace.Vector3),geometricError:new THREE__namespace.Uniform(0),pixelRatio:new THREE__namespace.Uniform(1),resolution:new THREE__namespace.Uniform(new THREE__namespace.Vector2(512,512)),floor:new THREE__namespace.Uniform(0),brightness:new THREE__namespace.Uniform(1),modelBoundingMin:new THREE__namespace.Uniform(new THREE__namespace.Vector3),modelBoundingMax:new THREE__namespace.Uniform(new THREE__namespace.Vector3),colorSaturation:new THREE__namespace.Uniform(0),colorBrightness:new THREE__namespace.Uniform(0)},shaderLib={none:{vertexShader:meshNoneVertexShader,fragmentShader:meshNoneFragmentShader,uniforms:THREE__namespace.UniformsUtils.merge([pbmUniforms$1,{opacity:{value:1}},THREE__namespace.UniformsLib.fog]),lights:!1,clipping:!1},basic:{vertexShader:meshBasicVertexShader,fragmentShader:meshBasicFragmentShader,uniforms:THREE__namespace.UniformsUtils.merge([pbmUniforms$1,THREE__namespace.ShaderLib.basic.uniforms]),lights:!1,clipping:!0},phong:{vertexShader:meshPhongVertexShader,fragmentShader:meshPhongFragmentShader,uniforms:THREE__namespace.UniformsUtils.merge([pbmUniforms$1,THREE__namespace.ShaderLib.phong.uniforms]),lights:!0,clipping:!0}},PBMMeshMaterial=function(n){__extends(t,n);function t(e,r){e===void 0&&(e="basic"),r===void 0&&(r={});var o=this,s,u,l,c,f,d,p,v,g,h,m,y,A,E,b,T,_,R,S,M,B,H,w,C,L,I=shaderLib[e];o=n.call(this,{vertexShader:I.vertexShader,fragmentShader:I.fragmentShader,uniforms:THREE__namespace.UniformsUtils.clone(I.uniforms),lights:I.lights,clipping:I.clipping,defines:{USE_COLOR_CONSTANT:!1,USE_COLOR_ALTITUDE:!1,USE_EDL:!1,USE_HQ_WEIGHT:!1,USE_HQ_DEPTH:!1,NUM_CLIPPING_BOX:!1,USE_CLIPFLOOR:!1,USE_VERTEX_MARK:!1,USE_LUMINANCE:!1,USE_BLACK_TRANSITION:!1,USE_SPREAD_TRANSITION:!1,USE_POINT_NORMAL:!1,USE_POINT_CIRCLE:!1,USE_POINT_ADAPTIVE_SIZE:!1,USE_POINT_COLOR_ALTITUDE:!1}})||this,o.shaderType=e,o.color=new THREE__namespace.Color(16777215),o.map=null,o.lightMap=null,o.lightMapIntensity=1,o.aoMap=null,o.aoMapIntensity=1,o.specularMap=null,o.specular=new THREE__namespace.Color(1118481),o.alphaMap=null,o.envMap=null,o.reflectivity=1,o.refractionRatio=.98,o.emissiveMap=null,o.emissive=new THREE__namespace.Color(0),o.emissiveIntensity=1,o.bumpMap=null,o.bumpScale=1,o.normalMap=null,o.normalMapType=THREE__namespace.TangentSpaceNormalMap,o.normalScale=new THREE__namespace.Vector2(1,1),o.displacementMap=null,o.displacementScale=1,o.displacementBias=0,o.shininess=30;var F,k=null,N=null;return Object.defineProperties(o,{pano0:{get:function(){return k},set:function(D){if(k!==D){k=D,D===null?(this.uniforms.pano0_map.value=null,this.uniforms.pano0_luminanceMap.value=null,this.uniforms.pano0_matrix.value.identity(),this.uniforms.pano0_zoom.value=1):(this.uniforms.pano0_map.value=D.map instanceof TileCubeTextureTarget?D.map.texture:D.map,this.uniforms.pano0_luminanceMap.value=D.luminanceMap instanceof TileCubeTextureTarget?D.luminanceMap.texture:D.luminanceMap,this.uniforms.pano0_matrix.value.copy(D.matrix),this.uniforms.pano0_zoom.value=D.zoom);var U=this.uniforms.pano0_luminanceMap.value!==null&&this.uniforms.pano1_luminanceMap.value!==null,Q=this.defines.USE_LUMINANCE;Q!==U&&(this.defines.USE_LUMINANCE=U,this.needsUpdate=!0)}}},pano1:{get:function(){return N},set:function(D){if(N!==D){N=D,D===null?(this.uniforms.pano1_map.value=null,this.uniforms.pano1_luminanceMap.value=null,this.uniforms.pano1_matrix.value.identity(),this.uniforms.pano1_zoom.value=1):(this.uniforms.pano1_map.value=D.map instanceof TileCubeTextureTarget?D.map.texture:D.map,this.uniforms.pano1_luminanceMap.value=D.luminanceMap instanceof TileCubeTextureTarget?D.luminanceMap.texture:D.luminanceMap,this.uniforms.pano1_matrix.value.copy(D.matrix),this.uniforms.pano1_zoom.value=D.zoom);var U=this.uniforms.pano0_luminanceMap.value!==null&&this.uniforms.pano1_luminanceMap.value!==null,Q=this.defines.USE_LUMINANCE;Q!==U&&(this.defines.USE_LUMINANCE=U,this.needsUpdate=!0)}}},modelAlpha:{get:function(){return this.uniforms.modelAlpha.value},set:function(D){this.uniforms.modelAlpha.value=D}},progress:{get:function(){return this.uniforms.progress.value},set:function(D){this.uniforms.progress.value=D}},transition:{get:function(){return this.defines.USE_BLACK_TRANSITION?"BLACK":this.defines.USE_SPREAD_TRANSITION?"SPREAD":"FADE"},set:function(D){var U=this.defines.USE_BLACK_TRANSITION,Q=this.defines.USE_SPREAD_TRANSITION;this.defines.USE_BLACK_TRANSITION=!1,this.defines.USE_SPREAD_TRANSITION=!1,this.defines["USE_".concat(D,"_TRANSITION")]=!0;var q=!1;U!==this.defines.USE_BLACK_TRANSITION&&(q=!0),Q!==this.defines.USE_SPREAD_TRANSITION&&(q=!0),q&&(this.needsUpdate=!0)}},colorStyle:{get:function(){return this.defines.USE_COLOR_CONSTANT?"CONSTANT":this.defines.USE_COLOR_ALTITUDE?"ALTITUDE":"RGB"},set:function(D){var U=D==="CONSTANT",Q=D==="ALTITUDE";this.defines.USE_COLOR_CONSTANT!==U&&(this.defines.USE_COLOR_CONSTANT=U,this.needsUpdate=!0),this.defines.USE_COLOR_ALTITUDE!==Q&&(this.defines.USE_COLOR_ALTITUDE=Q,this.needsUpdate=!0)}},constantColor:{get:function(){return this.uniforms.constantColor.value},set:function(D){this.uniforms.constantColor.value=D}},opacity:{get:function(){return this.uniforms.opacity.value},set:function(D){this.uniforms.opacity.value=D}},shownFloorIndex:{get:function(){return this.uniforms.shownFloorIndex.value},set:function(D){this.uniforms.shownFloorIndex.value=D}},gradientTexture:{get:function(){return this.uniforms.gradientTexture.value},set:function(D){this.uniforms.gradientTexture.value=D}},brightness:{get:function(){return this.uniforms.brightness.value},set:function(D){this.uniforms.brightness.value=D}},clippers:{get:function(){return F},set:function(D){F!==D&&(F=D,this.uniforms.clippers.value=(F||[]).map(function(U){var Q=typeof U.floorIndex=="number"?U.floorIndex:-1,q=new THREE__namespace.Matrix4().getInverse(U.clippingBoxMatrix);return{matrixInverse:q,floorIndex:Q}}),this.needsUpdate=!0)}},useEDL:{get:function(){return this.defines.USE_EDL},set:function(D){D!==this.defines.USE_EDL&&(this.defines.USE_EDL=D,this.needsUpdate=!0)}},useHQWeight:{get:function(){return this.defines.USE_HQ_WEIGHT},set:function(D){D!==this.defines.USE_HQ_WEIGHT&&(this.defines.USE_HQ_WEIGHT=D,this.needsUpdate=!0)}},useHQDepth:{get:function(){return this.defines.USE_HQ_DEPTH},set:function(D){D!==this.defines.USE_HQ_DEPTH&&(this.defines.USE_HQ_DEPTH=D,this.needsUpdate=!0)}},floor:{get:function(){return this.uniforms.floor.value},set:function(D){this.uniforms.floor.value=D}},colorSaturation:{get:function(){return this.uniforms.colorSaturation.value},set:function(D){this.uniforms.colorSaturation.value=D}},colorBrightness:{get:function(){return this.uniforms.colorBrightness.value},set:function(D){this.uniforms.colorBrightness.value=D}}}),o.pano0=(s=r.pano0)!==null&&s!==void 0?s:defaultPbmParameters.pano0,o.pano1=(u=r.pano1)!==null&&u!==void 0?u:defaultPbmParameters.pano1,o.modelAlpha=(l=r.modelAlpha)!==null&&l!==void 0?l:defaultPbmParameters.modelAlpha,o.progress=(c=r.progress)!==null&&c!==void 0?c:defaultPbmParameters.progress,o.transition=(f=r.transition)!==null&&f!==void 0?f:defaultPbmParameters.transition,o.constantColor=(d=r.constantColor)!==null&&d!==void 0?d:defaultPbmParameters.constantColor,o.opacity=(p=r.opacity)!==null&&p!==void 0?p:defaultPbmParameters.opacity,o.floorStyle=(v=r.floorStyle)!==null&&v!==void 0?v:defaultPbmParameters.floorStyle,o.shownFloorIndex=(g=r.shownFloorIndex)!==null&&g!==void 0?g:defaultPbmParameters.shownFloorIndex,o.clippers=(h=r.clippers)!==null&&h!==void 0?h:defaultPbmParameters.clippers,o.useEDL=(m=r.useEDL)!==null&&m!==void 0?m:defaultPbmParameters.useEDL,o.useHQWeight=(y=r.useHQWeight)!==null&&y!==void 0?y:defaultPbmParameters.useHQWeight,o.useHQDepth=(A=r.useHQDepth)!==null&&A!==void 0?A:defaultPbmParameters.useHQDepth,o.pointSize=(E=r.pointSize)!==null&&E!==void 0?E:defaultPbmParameters.pointSize,o.colorStyle=(b=r.colorStyle)!==null&&b!==void 0?b:defaultPbmParameters.colorStyle,o.pointShape=(T=r.pointShape)!==null&&T!==void 0?T:defaultPbmParameters.pointShape,o.pointScale=(_=r.pointScale)!==null&&_!==void 0?_:defaultPbmParameters.pointScale,o.pointBack=(R=r.pointBack)!==null&&R!==void 0?R:defaultPbmParameters.pointBack,o.pointMinPixel=(S=r.pointMinPixel)!==null&&S!==void 0?S:defaultPbmParameters.pointMinPixel,o.pointMaxPixel=(M=r.pointMaxPixel)!==null&&M!==void 0?M:defaultPbmParameters.pointMaxPixel,o.gradientTexture=(B=r.gradientTexture)!==null&&B!==void 0?B:defaultPbmParameters.gradientTexture,o.brightness=(H=r.brightness)!==null&&H!==void 0?H:defaultPbmParameters.brightness,o.colorSaturation=(w=r.colorSaturation)!==null&&w!==void 0?w:defaultPbmParameters.colorSaturation,o.colorBrightness=(C=r.colorBrightness)!==null&&C!==void 0?C:defaultPbmParameters.colorBrightness,o.customShaders=(L=r.customShaders)!==null&&L!==void 0?L:defaultPbmParameters.customShaders,o.customShaderHash="",o.customShaderUniforms={},o.customShaderDefines={},o.floor=0,o.transparent=!1,o}return t.prototype.onBeforeCompile=function(e,r){var o=this,s,u,l=this.customShaders.filter(function(y){return y.type.includes(o.shaderType)}),c=l.reduce(function(y,A){return y+A.vertex.mainBefore},""),f=l.reduce(function(y,A){return y+A.vertex.mainStart},""),d=l.reduce(function(y,A){return y+A.vertex.mainEnd},""),p=l.reduce(function(y,A){return y+A.fragment.mainBefore},""),v=l.reduce(function(y,A){return y+A.fragment.mainStart},""),g=l.reduce(function(y,A){return y+A.fragment.mainModelColor},""),h=l.reduce(function(y,A){return y+A.fragment.mainEnd},"");e.vertexShader=e.vertexShader.replace(/MAIN_BEFORE/g,c),e.fragmentShader=e.fragmentShader.replace(/MAIN_BEFORE/g,p),e.vertexShader=e.vertexShader.replace(/MAIN_START/g,f),e.fragmentShader=e.fragmentShader.replace(/MAIN_START/g,v),e.vertexShader=e.vertexShader.replace(/MAIN_END/g,d),e.fragmentShader=e.fragmentShader.replace(/MAIN_END/g,h),e.fragmentShader=e.fragmentShader.replace(/MAIN_MODEL_COLOR/g,g);var m=String((u=(s=this.clippers)===null||s===void 0?void 0:s.length)!==null&&u!==void 0?u:0);e.vertexShader=e.vertexShader.replace(/NUM_CLIPPERS/g,m),e.fragmentShader=e.fragmentShader.replace(/NUM_CLIPPERS/g,m),l.forEach(function(y){y.onBeforeCompile(e,r)})},t.prototype.refreshUniforms=function(e){var r,o,s=this.uniforms;s.diffuse&&s.diffuse.value.copy(this.color),s.opacity&&(s.opacity.value=this.opacity),s.color&&s.diffuse.value.copy(this.color),s.emissive&&s.emissive.value.copy(this.emissive).multiplyScalar(this.emissiveIntensity),s.map&&(s.map.value=this.map),s.alphaMap&&(s.alphaMap.value=this.alphaMap),s.specularMap&&(s.specularMap.value=this.specularMap),s.envMap&&(s.envMap.value=this.envMap,s.flipEnvMap.value=!((r=this.envMap)===null||r===void 0)&&r.isCubeTexture?-1:1,s.reflectivity.value=this.reflectivity,s.refractionRatio.value=this.refractionRatio,s.maxMipLevel.value=this.envMap&&(o=e==null?void 0:e.properties.get(this.envMap).__maxMipLevel)!==null&&o!==void 0?o:0),s.lightMap&&(s.lightMap.value=this.lightMap,s.lightMapIntensity.value=this.lightMapIntensity),s.aoMap&&(s.aoMap.value=this.aoMap,s.aoMapIntensity.value=this.aoMapIntensity),s.specular&&s.specular.value.copy(this.specular),s.shininess&&(s.shininess.value=Math.max(this.shininess,1e-4)),s.emissiveMap&&(s.emissiveMap.value=this.emissiveMap),s.bumpMap&&(s.bumpMap.value=this.bumpMap,s.bumpScale.value=this.bumpScale,this.side===THREE__namespace.BackSide&&(s.bumpScale.value*=-1)),s.normalMap&&(s.normalMap.value=this.normalMap,s.normalScale.value.copy(this.normalScale),this.side===THREE__namespace.BackSide&&s.normalScale.value.negate()),s.displacementMap&&(s.displacementMap.value=this.displacementMap,s.displacementScale.value=this.displacementScale,s.displacementBias.value=this.displacementBias);var u;this.map?u=this.map:this.specularMap?u=this.specularMap:this.displacementMap?u=this.displacementMap:this.normalMap?u=this.normalMap:this.bumpMap?u=this.bumpMap:this.alphaMap?u=this.alphaMap:this.emissiveMap&&(u=this.emissiveMap),u!==void 0&&(u.matrixAutoUpdate===!0&&u.updateMatrix(),s.uvTransform.value.copy(u.matrix));var l;this.aoMap?l=this.aoMap:this.lightMap&&(l=this.lightMap),l!==void 0&&(l.matrixAutoUpdate===!0&&l.updateMatrix(),s.uv2Transform.value.copy(l.matrix))},t.prototype.update=function(e,r,o){var s="".concat(o.id,":").concat(o.materialVersion);s!==this.syncModelVersion&&(Object.assign(this,o.getMaterial()),this.syncModelVersion=s);var u=this.customShaders.map(function(A){return A.getHash()}).join("");this.customShaderHash!==u&&(this.customShaderHash=u,this.needsUpdate=!0);for(var l=this.customShaders.reduce(function(A,E){return Object.assign(A,E.defines)},{}),c=Object.keys(this.customShaderDefines),f=0,d=c;f<d.length;f++){var p=d[f];delete this.defines[p]}this.customShaderDefines=l,Object.assign(this.defines,this.customShaderDefines);for(var v=this.customShaders.reduce(function(A,E){return Object.assign(A,E.uniforms)},{}),g=Object.keys(this.customShaderUniforms),h=0,m=g;h<m.length;h++){var y=m[h];delete this.uniforms[y]}this.customShaderUniforms=v,Object.assign(this.uniforms,this.customShaderUniforms),this.visible=!0,this.refreshUniforms(e),this.shaderType==="none"?(this.depthWrite=!1,this.transparent=!0):(this.transparent=!1,this.depthWrite=!0,this.shownFloorIndex>-1&&(this.transparent=this.shownFloorIndex!==this.floor),this.opacity<1&&(this.transparent=!0),this.alphaMap&&(this.transparent=!0),this.brightness<1&&(this.transparent=!0),this.transparent&&(this.depthWrite=!1),this.floorStyle==="VISIBILITY"&&this.shownFloorIndex!==-1&&this.floor!==this.shownFloorIndex&&(this.visible=!1)),this.uniforms.pixelRatio.value=r.pixelRatio,this.uniforms.resolution.value.copy(r.resolution),this.uniforms.modelBoundingMax.value.copy(o.bounding.max),this.uniforms.modelBoundingMin.value.copy(o.bounding.min)},t.prototype.copy=function(e){return n.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.specular.copy(e.specular),this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.emissiveMap=e.emissiveMap,this.emissive.copy(e.emissive),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.shininess=e.shininess,this.customShaders=e.customShaders,this.pano0=e.pano0,this.pano1=e.pano1,this.modelAlpha=e.modelAlpha,this.progress=e.progress,this.transition=e.transition,this.opacity=e.opacity,this.floorStyle=e.floorStyle,this.colorStyle=e.colorStyle,this.constantColor=e.constantColor,this.shownFloorIndex=e.shownFloorIndex,this.brightness=e.brightness,this.clippers=e.clippers,this.useEDL=e.useEDL,this.useHQWeight=e.useHQWeight,this.useHQDepth=e.useHQDepth,this.pointSize=e.pointSize,this.pointShape=e.pointShape,this.pointScale=e.pointScale,this.pointBack=e.pointBack,this.pointMinPixel=e.pointMinPixel,this.pointMaxPixel=e.pointMaxPixel,this.gradientTexture=e.gradientTexture,this.floor=e.floor,this.colorSaturation=e.colorSaturation,this.colorBrightness=e.colorBrightness,this.refreshUniforms(),this},t.prototype.clone=function(){return new this.constructor(this.shaderType).copy(this)},t}(THREE__namespace.ShaderMaterial);const pointCloudFragmentShader=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=113,o=126,s=0,u="";return t[s].split(u).map(function(l){return l.charCodeAt(s)>o?l:String.fromCharCode((l.charCodeAt(s)+r)%o)}).join(u)}("{vs|z-sy|n-sy||H0vs-qrsv{rq5b`Rl]\\V[al[\\_ZNY6--n\bv{t-rp@-[|znyH0r{qvs0vs-qrsv{rq5b`RlRQY6--n\bv{t-sy|n-Y|tQr}uH0r{qvsp-Pyv}}r-\n--znA-znv\x07V{rrH--sy|n-sy||V{qr\x07H\fH0vs-[bZlPYV]]R_`-K-=--{vs|z-Pyv}}r-pyv}}rh[bZlPYV]]R_`jH0r{qvsn\bv{t-rpA-d|yq]|vv|{Hn\bv{t-rp@-PnzrnQvrpv|{Hn\bv{t-rp@-P|y|Hn\bv{t-sy|n-]|v{`v rH{vs|z-sy|n-|}npv\bH{vs|z-sy|n-z|qryNy}unH{vs|z-sy|n-u|{Sy||V{qr\x07H<<u调整{vs|z-sy|n-p|y|`nnv|{H{vs|z-sy|n-p|y|Ovtu{rH0v{pyqr-Ip|zz|{K0v{pyqr-Is|tl}nlsntzr{K0v{pyqr-Iy|tqr}uosl}nlsntzr{K0v{pyqr-Ipyv}}v{tl}yn{rl}nlsntzr{Krp@-nqwP|y|arz}rnr5rp@-p|y|9-sy|n-rz}rnr6\n----<<-将色温范围从-:>;=-到->;=-映射到实际的色温范围----sy|n-rz}-J-5rz}rnr-8->;=6-7-B===;=H-<<-范围从-=-到->====----<<-计算色温系数----sy|n-lsnp|9-tlsnp|9-olsnp|H----vs-5rz}-IJ-CC==;=6-\n--------lsnp|-J->;=H--------tlsnp|-J-=;@F==E>BDEDCF=>FC=DEA-7-y|t5rz}-<->==;=6-:-=;C@>EA>AA@DEEC?DAB=FEH--------olsnp|-J-rz}-IJ->F==;=-L-=;=-G-=;BA@?=CDEF>>=>FC=DEA@-7-y|t5rz}-<->==;=-:->=;=6-:->;>FC?BA=EF>AH----\f-ryr-\n--------lsnp|-J->;?F?F@C>EC=C?DAB=FE=A-7-}|5rz}-<->==;=-:-C=;=9-:=;>@@?=ADBF?6H--------tlsnp|-J->;>?FEF=EC=EFB?FA>>DCB-7-}|5rz}-<->==;=-:-C=;=9-:=;=DBB>AEAF?6H--------olsnp|-J->;=H----\f----<<-调整颜色----rp@-nqwrqP|y|H----nqwrqP|y|;-J-pynz}5p|y|;-7-lsnp|9-=;=9->;=6H----nqwrqP|y|;t-J-pynz}5p|y|;t-7-tlsnp|9-=;=9->;=6H----nqwrqP|y|;o-J-pynz}5p|y|;o-7-olsnp|9-=;=9->;=6H----r{-nqwrqP|y|H\frp@-to?u5rp@-p6-\n----rpA-X-J-rpA5=;=9-:>;=-<-@;=9-?;=-<-@;=9-:>;=6H----rpA-}-J-zv\x075rpA5p;ot9-X; 69-rpA5p;to9-X;\x07\b69-r}5p;o9-p;t66H----rpA-\0-J-zv\x075rpA5};\x07\b9-p;69-rpA5p;9-};\b \x0769-r}5};\x079-p;66H----sy|n-q-J-\0;\x07-:-zv{5\0;9-\0;\b6H----sy|n-r-J->;=r:>=H----r{-rp@5no5\0; -8-5\0;-:-\0;\b6-<-5C;=-7-q-8-r669-q-<-5\0;\x07-8-r69-\0;\x076H\frp@-u?to5rp@-p6-\n----rpA-X-J-rpA5>;=9-?;=-<-@;=9->;=-<-@;=9-@;=6H----rp@-}-J-no5snp5p;\x07\x07\x07-8-X;\x07\b 6-7-C;=-:-X;6H----r{-p; -7-zv\x075X;\x07\x07\x079-pynz}5}-:-X;\x07\x07\x079-=;=9->;=69-p;\b6H\fZNV[lORS\\_R|vq-znv{56-\n--ZNV[l`aN_a--<<-JJJ-点大小剔除-JJJ--vs-5]|v{`v r-I-=;==>6-\n----qvpnqH--\f--<<-JJJ-前置裁切计算-JJJ--0vs-[bZlPYV]]R_`-K-=----o||y-pyv}}rqH----rpA-pyv}}r]|vv|{H----0}ntzn-{|yyly||}ln----s|-5-v{-v-J-=H-v-I-[bZlPYV]]R_`H-v-88-6-\n------pyv}}r]|vv|{-J-pyv}}rh-v-j;znv\x07V{rr-7-d|yq]|vv|{H------pyv}}rq-J-5pyv}}rh-v-j;sy||V{qr\x07-I-=;=-\v\v-no5sy||-:-pyv}}rh-v-j;sy||V{qr\x076-I->;=6H------pyv}}rq-J-pyv}}rq-33-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--------qvpnqH------\f----\f----0}ntzn-{|yyly||}lr{q--0r{qvs--<<-JJJJJJJJJJJJJJJJ--<<-JJJ-形状裁切-JJJ--0vs-qrsv{rq5b`Rl]\\V[al`UN]RlPV_PYR6----sy|n--J-?;=-7-tyl]|v{P||q;\x07-:->;=H----sy|n--J-?;=-7-tyl]|v{P||q;\b-:->;=H----sy|n-pp-J-7-8-7H----vs-5]|v{`v r-K-@;=-33-pp-K->;=6-\n------qvpnqH----\f--0r{qvs--<<-JJJJJJJJJJJJJ--0v{pyqr-Ipyv}}v{tl}yn{rlsntzr{K--0v{pyqr-Iy|tqr}uoslsntzr{K--<<-JJJ-颜色-JJJ--rpA-sv{nyP|y|-J-_TOa|Yv{rn5rpA5P|y|9-|}npv\b66H--0vs-qrsv{rq5b`Rl]\\V[al[\\_ZNY6----0vs-qrsv{rq5b`Rl]\\V[alONPXlUVQQR[6------rp@-pnzrnQvrpv|{-J-{|znyv r5pnzrn]|vv|{-:-d|yq]|vv|{;\x07\b 6H------vs-5q|5pnzrnQvrpv|{9-[|zny6-I-=;=6-\n--------qvpnqH------\f----0ryvs-qrsv{rq5b`Rl]\\V[alONPXlQN_X6------rp@-pnzrnQvrpv|{-J-{|znyv r5pnzrn]|vv|{-:-d|yq]|vv|{;\x07\b 6H------vs-5q|5pnzrnQvrpv|{9-[|zny6-I-=;=6-\n--------sv{nyP|y|;\x07\b -J-sv{nyP|y|;\x07\b -7-=;EH------\f----0r{qvs--0r{qvs--tylSntP|y|-J-sv{nyP|y|H--<<-JJJJJJJJJJJ--<<-JJJ-楼层显示-JJJ--sy|n-sy||\\}npv\b-J->;=H--vs-5u|{Sy||V{qr\x07-K-:=;=>-33-no5sy||-:-u|{Sy||V{qr\x076-K-=;FF6-\n----sy||\\}npv\b-J-=;>-7-zv{55>;=-8-PnzrnQvrpv|{;\b69->;=6H--\f--tylSntP|y|;n-J-tylSntP|y|;n-7-sy||\\}npv\bH--<<-JJJJJJJJJJJJJJ--tylSntP|y|;n-J-tylSntP|y|;n-7-z|qryNy}unH--ZNV[lZ\\QRYlP\\Y\\_--0v{pyqr-I|{rzn}}v{tlsntzr{K--0v{pyqr-Ir{p|qv{tlsntzr{K--<<-JJJ-颜色增益调整-JJJ--rp@-toP|y|-J-tylSntP|y|;toH--rp@-uP|y|-J-to?u5toP|y|6H--uP|y|;\b-8J-p|y|`nnv|{H--uP|y|; -8J-p|y|Ovtu{rH--tylSntP|y|;to-J-u?to5uP|y|6H--0v{pyqr-Is|tlsntzr{K--0v{pyqr-I}rzyv}yvrqlny}unlsntzr{K--0vs-qrsv{rq5b`RlRQY6----tylSntP|y|;n-J-Y|tQr}uH--0r{qvs--0vs-qrsv{rq5b`RlU^ldRVTUa6----sy|n-qvn{pr-J-?;=-7-yr{tu5tyl]|v{P||q;\x07\b-:-=;B6H----sy|n-rvtu-J-zn\x075=;=9->;=-:-qvn{pr6H----rvtu-J-}|5rvtu9->;B6H----tylSntP|y|;n-J-rvtuH----tylSntP|y|;\x07\b -J-tylSntP|y|;\x07\b -7-rvtuH--0r{qvs--ZNV[lR[Q\f"),pointCloudVertexShader=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=113,o=126,s=0,u="";return t[s].split(u).map(function(l){return l.charCodeAt(s)>o?l:String.fromCharCode((l.charCodeAt(s)+r)%o)}).join(u)}("nvor-rp@-p|y|H0vs-qrsv{rq5b`RlP\\Y\\_lP\\[`aN[a6--{vs|z-rp@-p|{n{P|y|H0r{qvs0vs-qrsv{rq5b`RlP\\Y\\_lNYaVabQR6--{vs|z-nz}yr?Q-tnqvr{ar\x07rH0r{qvs0vs-qrsv{rq5b`RlRQY6--n\bv{t-sy|n-Y|tQr}uH0r{qvs{vs|z-rp?-r|yv|{H{vs|z-sy|n-}v\x07ry_nv|H{vs|z-sy|n-}|v{`pnyrH{vs|z-sy|n-}|v{Zv{]v\x07ryH{vs|z-sy|n-}|v{Zn\x07]v\x07ryH{vs|z-sy|n-|}npv\bH{vs|z-sy|n-tr|zrvpR|H{vs|z-rp@-z|qryO|{qv{tZn\x07H{vs|z-rp@-z|qryO|{qv{tZv{Hn\bv{t-rpA-d|yq]|vv|{H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-}|wSnp|H----sy|n-|vtv{nyQr}u-J-tyl]|vv|{;H----sy|n-nqwrqQr}u-J-|vtv{nyQr}u-8-=;>H----sy|n-nqw-J-nqwrqQr}u-<-|vtv{nyQr}uH----z]|vv|{;\x07\b -J-z]|vv|{;\x07\b -7-nqwH----tyl]|vv|{-J-}|wrpv|{Znv\x07-7-z]|vv|{H--0r{qvs--0v{pyqr-I|yq}|lrr\x07K--0v{pyqr-Is|tlrr\x07K--ZNV[lR[Q\f");var pbmUniforms=Object.assign({pointScale:new THREE__namespace.Uniform(1),pointMinPixel:new THREE__namespace.Uniform(1),pointMaxPixel:new THREE__namespace.Uniform(1),opacity:new THREE__namespace.Uniform(1),gradientTexture:new THREE__namespace.Uniform(null),modelAlpha:new THREE__namespace.Uniform(0),clippers:new THREE__namespace.Uniform([]),shownFloorIndex:new THREE__namespace.Uniform(-1),constantColor:new THREE__namespace.Uniform(new THREE__namespace.Vector3),geometricError:new THREE__namespace.Uniform(0),pixelRatio:new THREE__namespace.Uniform(1),resolution:new THREE__namespace.Uniform(new THREE__namespace.Vector2(512,512)),floor:new THREE__namespace.Uniform(0),brightness:new THREE__namespace.Uniform(1),modelBoundingMin:new THREE__namespace.Uniform(new THREE__namespace.Vector3),modelBoundingMax:new THREE__namespace.Uniform(new THREE__namespace.Vector3),colorSaturation:new THREE__namespace.Uniform(0),colorBrightness:new THREE__namespace.Uniform(0)},THREE__namespace.UniformsUtils.clone(THREE__namespace.UniformsLib.fog)),PBMPointCloudMaterial=function(n){__extends(t,n);function t(e){e===void 0&&(e={});var r,o,s,u,l,c,f,d,p,v,g,h,m,y,A,E,b,T,_,R,S,M,B,H,w,C=n.call(this,{vertexShader:pointCloudVertexShader,fragmentShader:pointCloudFragmentShader,uniforms:THREE__namespace.UniformsUtils.clone(pbmUniforms),lights:!1,clipping:!0,defines:{USE_COLOR_CONSTANT:!1,USE_COLOR_ALTITUDE:!1,USE_EDL:!1,USE_HQ_WEIGHT:!1,USE_HQ_DEPTH:!1,NUM_CLIPPING_BOX:!1,USE_CLIPFLOOR:!1,USE_VERTEX_MARK:!1,USE_MAP:!0,USE_UV:!0,USE_LUMINANCE:!1,USE_BLACK_TRANSITION:!1,USE_POINT_NORMAL:!1,USE_POINT_SHAPE_CIRCLE:!1,USE_POINT_SIZE_ATTENUATION:!1,USE_POINT_SIZE_GEOMETRIC:!1,USE_POINT_BACK_HIDDEN:!1,USE_POINT_BACK_DARK:!1}})||this,L;return C.customShaderHash="",C.customShaderUniforms={},C.customShaderDefines={},Object.defineProperties(C,{constantColor:{get:function(){return this.uniforms.constantColor.value},set:function(I){this.uniforms.constantColor.value=I}},opacity:{get:function(){return this.uniforms.opacity.value},set:function(I){this.uniforms.opacity.value=I}},modelAlpha:{get:function(){return this.uniforms.modelAlpha.value},set:function(I){this.uniforms.modelAlpha.value=I}},shownFloorIndex:{get:function(){return this.uniforms.shownFloorIndex.value},set:function(I){this.uniforms.shownFloorIndex.value=I}},clippers:{get:function(){return L},set:function(I){L!==I&&(L=I,this.uniforms.clippers.value=(L||[]).map(function(F){var k=typeof F.floorIndex=="number"?F.floorIndex:-1,N=new THREE__namespace.Matrix4().getInverse(F.clippingBoxMatrix);return{matrixInverse:N,floorIndex:k}}),this.needsUpdate=!0)}},colorStyle:{get:function(){return this.defines.USE_COLOR_CONSTANT?"CONSTANT":this.defines.USE_COLOR_ALTITUDE?"ALTITUDE":"RGB"},set:function(I){var F=I==="CONSTANT",k=I==="ALTITUDE";this.defines.USE_COLOR_CONSTANT!==F&&(this.defines.USE_COLOR_CONSTANT=F,this.needsUpdate=!0),this.defines.USE_COLOR_ALTITUDE!==k&&(this.defines.USE_COLOR_ALTITUDE=k,this.needsUpdate=!0)}},pointSize:{get:function(){return this.defines.USE_POINT_SIZE_GEOMETRIC===!0?"GEOMETRIC":this.defines.USE_POINT_SIZE_ATTENUATION===!0?"ATTENUATION":"FIXED"},set:function(I){var F=I==="ATTENUATION",k=I==="GEOMETRIC";this.defines.USE_POINT_SIZE_GEOMETRIC!==k&&(this.defines.USE_POINT_SIZE_GEOMETRIC=k,this.needsUpdate=!0),this.defines.USE_POINT_SIZE_ATTENUATION!==F&&(this.defines.USE_POINT_SIZE_ATTENUATION=F,this.needsUpdate=!0)}},pointShape:{get:function(){return this.defines.USE_POINT_SHAPE_CIRCLE===!0?"CIRCLE":"SQUARE"},set:function(I){var F=I==="CIRCLE";this.defines.USE_POINT_SHAPE_CIRCLE!==F&&(this.defines.USE_POINT_SHAPE_CIRCLE=F,this.needsUpdate=!0)}},pointScale:{get:function(){return this.uniforms.pointScale.value},set:function(I){this.uniforms.pointScale.value=I}},pointBack:{get:function(){return this.defines.USE_POINT_BACK_HIDDEN===!0?"HIDDEN":this.defines.USE_POINT_BACK_DARK===!0?"DARK":"VISIBLE"},set:function(I){var F=I==="HIDDEN",k=I==="DARK";this.defines.USE_POINT_BACK_HIDDEN!==F&&(this.defines.USE_POINT_BACK_HIDDEN=F,this.needsUpdate=!0),this.defines.USE_POINT_BACK_DARK!==k&&(this.defines.USE_POINT_BACK_DARK=k,this.needsUpdate=!0)}},pointMinPixel:{get:function(){return this.uniforms.pointMinPixel.value},set:function(I){this.uniforms.pointMinPixel.value=I}},pointMaxPixel:{get:function(){return this.uniforms.pointMaxPixel.value},set:function(I){this.uniforms.pointMaxPixel.value=I}},useEDL:{get:function(){return this.defines.USE_EDL},set:function(I){I!==this.defines.USE_EDL&&(this.defines.USE_EDL=I,this.needsUpdate=!0)}},useHQWeight:{get:function(){return this.defines.USE_HQ_WEIGHT},set:function(I){I!==this.defines.USE_HQ_WEIGHT&&(this.defines.USE_HQ_WEIGHT=I,this.needsUpdate=!0)}},useHQDepth:{get:function(){return this.defines.USE_HQ_DEPTH},set:function(I){I!==this.defines.USE_HQ_DEPTH&&(this.defines.USE_HQ_DEPTH=I,this.needsUpdate=!0)}},gradientTexture:{get:function(){return this.uniforms.gradientTexture.value},set:function(I){this.uniforms.gradientTexture.value=I}},floor:{get:function(){return this.uniforms.floor.value},set:function(I){this.uniforms.floor.value=I}},brightness:{get:function(){return this.uniforms.brightness.value},set:function(I){this.uniforms.brightness.value=I}},colorSaturation:{get:function(){return this.uniforms.colorSaturation.value},set:function(I){this.uniforms.colorSaturation.value=I}},colorBrightness:{get:function(){return this.uniforms.colorBrightness.value},set:function(I){this.uniforms.colorBrightness.value=I}}}),C.pano0=(r=e.pano0)!==null&&r!==void 0?r:defaultPbmParameters.pano0,C.pano1=(o=e.pano1)!==null&&o!==void 0?o:defaultPbmParameters.pano1,C.modelAlpha=(s=e.modelAlpha)!==null&&s!==void 0?s:defaultPbmParameters.modelAlpha,C.progress=(u=e.progress)!==null&&u!==void 0?u:defaultPbmParameters.progress,C.transition=(l=e.transition)!==null&&l!==void 0?l:defaultPbmParameters.transition,C.colorStyle=(c=e.colorStyle)!==null&&c!==void 0?c:defaultPbmParameters.colorStyle,C.constantColor=(f=e.constantColor)!==null&&f!==void 0?f:defaultPbmParameters.constantColor,C.opacity=(d=e.opacity)!==null&&d!==void 0?d:defaultPbmParameters.opacity,C.floorStyle=(p=e.floorStyle)!==null&&p!==void 0?p:defaultPbmParameters.floorStyle,C.shownFloorIndex=(v=e.shownFloorIndex)!==null&&v!==void 0?v:defaultPbmParameters.shownFloorIndex,C.clippers=(g=e.clippers)!==null&&g!==void 0?g:defaultPbmParameters.clippers,C.useEDL=(h=e.useEDL)!==null&&h!==void 0?h:defaultPbmParameters.useEDL,C.useHQWeight=(m=e.useHQWeight)!==null&&m!==void 0?m:defaultPbmParameters.useHQWeight,C.useHQDepth=(y=e.useHQDepth)!==null&&y!==void 0?y:defaultPbmParameters.useHQDepth,C.pointShape=(A=e.pointShape)!==null&&A!==void 0?A:defaultPbmParameters.pointShape,C.pointSize=(E=e.pointSize)!==null&&E!==void 0?E:defaultPbmParameters.pointSize,C.pointScale=(b=e.pointScale)!==null&&b!==void 0?b:defaultPbmParameters.pointScale,C.pointBack=(T=e.pointBack)!==null&&T!==void 0?T:defaultPbmParameters.pointBack,C.pointMinPixel=(_=e.pointMinPixel)!==null&&_!==void 0?_:defaultPbmParameters.pointMinPixel,C.pointMaxPixel=(R=e.pointMaxPixel)!==null&&R!==void 0?R:defaultPbmParameters.pointMaxPixel,C.gradientTexture=(S=e.gradientTexture)!==null&&S!==void 0?S:defaultPbmParameters.gradientTexture,C.brightness=(M=e.brightness)!==null&&M!==void 0?M:defaultPbmParameters.brightness,C.colorSaturation=(B=e.colorSaturation)!==null&&B!==void 0?B:defaultPbmParameters.colorSaturation,C.colorBrightness=(H=e.colorBrightness)!==null&&H!==void 0?H:defaultPbmParameters.colorBrightness,C.customShaders=(w=e.customShaders)!==null&&w!==void 0?w:defaultPbmParameters.customShaders,C.customShaderHash="",C.floor=0,C.transparent=!0,C}return t.prototype.onBeforeCompile=function(e,r){var o,s,u=this.customShaders.filter(function(m){return m.type.includes("pointcloud")}),l=u.reduce(function(m,y){return m+y.vertex.mainBefore},""),c=u.reduce(function(m,y){return m+y.vertex.mainStart},""),f=u.reduce(function(m,y){return m+y.vertex.mainEnd},""),d=u.reduce(function(m,y){return m+y.fragment.mainBefore},""),p=u.reduce(function(m,y){return m+y.fragment.mainStart},""),v=u.reduce(function(m,y){return m+y.fragment.mainModelColor},""),g=u.reduce(function(m,y){return m+y.fragment.mainEnd},"");e.vertexShader=e.vertexShader.replace(/MAIN_BEFORE/g,l),e.fragmentShader=e.fragmentShader.replace(/MAIN_BEFORE/g,d),e.vertexShader=e.vertexShader.replace(/MAIN_START/g,c),e.fragmentShader=e.fragmentShader.replace(/MAIN_START/g,p),e.vertexShader=e.vertexShader.replace(/MAIN_END/g,f),e.fragmentShader=e.fragmentShader.replace(/MAIN_END/g,g),e.fragmentShader=e.fragmentShader.replace(/MAIN_MODEL_COLOR/g,v);var h=String((s=(o=this.clippers)===null||o===void 0?void 0:o.length)!==null&&s!==void 0?s:0);e.vertexShader=e.vertexShader.replace(/NUM_CLIPPERS/g,h),e.fragmentShader=e.fragmentShader.replace(/NUM_CLIPPERS/g,h),u.forEach(function(m){m.onBeforeCompile(e,r)})},t.prototype.update=function(e,r,o){var s="".concat(o.id,":").concat(o.materialVersion);s!==this.syncModelVersion&&(Object.assign(this,o.getMaterial()),this.syncModelVersion=s);var u=this.customShaders.map(function(A){return A.getHash()}).join("");this.customShaderHash!==u&&(this.customShaderHash=u,this.needsUpdate=!0);for(var l=this.customShaders.reduce(function(A,E){return Object.assign(A,E.defines)},{}),c=Object.keys(this.customShaderDefines),f=0,d=c;f<d.length;f++){var p=d[f];delete this.defines[p]}this.customShaderDefines=l,Object.assign(this.defines,this.customShaderDefines);for(var v=this.customShaders.reduce(function(A,E){return Object.assign(A,E.uniforms)},{}),g=Object.keys(this.customShaderUniforms),h=0,m=g;h<m.length;h++){var y=m[h];delete this.uniforms[y]}this.customShaderUniforms=v,Object.assign(this.uniforms,this.customShaderUniforms),this.visible=!0,this.transparent=!1,this.shownFloorIndex>-1&&(this.transparent=this.shownFloorIndex!==this.floor),this.modelAlpha<1&&(this.transparent=!0),this.opacity<1&&(this.transparent=!0),this.brightness<1&&(this.transparent=!0),this.depthWrite=!0,this.depthTest=!0,this.useEDL&&(this.transparent=!1),this.useHQWeight?(this.depthWrite=!1,this.blending=THREE__namespace.CustomBlending,this.blendSrc=THREE__namespace.SrcAlphaFactor,this.blendSrcAlpha=THREE__namespace.SrcAlphaFactor,this.blendDst=THREE__namespace.OneFactor,this.blendDstAlpha=THREE__namespace.OneFactor):(this.blending=THREE__namespace.NormalBlending,this.blendDst=THREE__namespace.OneMinusSrcAlphaFactor,this.blendEquation=THREE__namespace.AddEquation,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null),this.floorStyle==="VISIBILITY"&&this.shownFloorIndex!==-1&&this.floor!==this.shownFloorIndex&&(this.visible=!1),this.uniforms.pixelRatio.value=r.pixelRatio,this.uniforms.resolution.value.copy(r.resolution),this.uniforms.modelBoundingMax.value.copy(o.bounding.max),this.uniforms.modelBoundingMin.value.copy(o.bounding.min)},t.prototype.copy=function(e){return n.prototype.copy.call(this,this),this.customShaders=e.customShaders,this.pano0=e.pano0,this.pano1=e.pano1,this.progress=e.progress,this.transition=e.transition,this.floorStyle=e.floorStyle,this.shownFloorIndex=e.shownFloorIndex,this.brightness=e.brightness,this.clippers=e.clippers,this.constantColor=e.constantColor,this.modelAlpha=e.modelAlpha,this.useEDL=e.useEDL,this.useHQWeight=e.useHQWeight,this.useHQDepth=e.useHQDepth,this.colorStyle=e.colorStyle,this.pointSize=e.pointSize,this.pointShape=e.pointShape,this.pointScale=e.pointScale,this.pointBack=e.pointBack,this.pointMinPixel=e.pointMinPixel,this.pointMaxPixel=e.pointMaxPixel,this.gradientTexture=e.gradientTexture,this.colorSaturation=e.colorSaturation,this.colorBrightness=e.colorBrightness,this},t}(THREE__namespace.ShaderMaterial),InternalWebGLRenderer=function(n){__extends(t,n);function t(e){var r=e.preserveDrawingBuffer,o=r===void 0?!0:r,s=e.premultipliedAlpha,u=s===void 0?!0:s,l=e.stencil,c=l===void 0?!0:l,f=e.backgroundColor,d=f===void 0?1579548:f,p=e.backgroundAlpha,v=p===void 0?1:p,g=e.pixelRatio,h=g===void 0?1:g,m=e.antialias,y=m===void 0?!1:m,A=e.webgl2,E=e.logarithmicDepthBuffer,b=e.precision,T=e.powerPreference,_=this,R={antialias:y,alpha:!0,depth:!0,preserveDrawingBuffer:o,stencil:c,premultipliedAlpha:u,powerPreference:T},S={logarithmicDepthBuffer:E,precision:b};if(A){var M=document.createElement("canvas"),B=M.getContext("webgl2",R);B?_=n.call(this,__assign(__assign(__assign({},R),S),{antialias:!0,canvas:M,context:B}))||this:(console.error("error occurred when getting webgl2 canvas context, mybe webgl2 not support, fallback to webgl."),_=n.call(this,__assign(__assign({},R),S))||this)}else _=n.call(this,__assign(__assign({},R),S))||this;return _.setPixelRatio(h),_.setClearColor(d,v),_.outputEncoding=THREE__namespace.sRGBEncoding,_.autoClear=!0,_}return t}(THREE__namespace.WebGLRenderer),Scene=function(n){__extends(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t.prototype.add=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return n.prototype.add.apply(this,e)},t.prototype.remove=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return n.prototype.remove.apply(this,e)},t}(THREE__namespace.Scene);function coordinatesToVector(n,t){var e=Math.abs(Math.cos(n.latitude)),r=-Math.sin(n.longitude)*e,o=-Math.sin(n.latitude),s=-Math.cos(n.longitude)*e;return t?t.set(r,o,s):new THREE__namespace.Vector3(r,o,s)}var DEFAULT_ASPECT=1,DEFAULT_NEAR=.1,DEFAULT_FAR=2e3,TAU$2=Math.PI*2,PI_2=Math.PI/2;function formatRad$1(n){return n>0&&n<=TAU$2?n:(n%TAU$2+TAU$2)%TAU$2}function matrixLerp(n,t,e,r){e=Math.pow(e,4);for(var o=0;o<16;o++)r.elements[o]=n.elements[o]+(t.elements[o]-n.elements[o])*e;return r}var Camera=function(n){__extends(t,n);function t(e,r,o,s,u,l,c){r===void 0&&(r=DEFAULT_ASPECT),o===void 0&&(o=DEFAULT_NEAR),s===void 0&&(s=DEFAULT_FAR),u===void 0&&(u=new THREE__namespace.Vector2),l===void 0&&(l=new THREE__namespace.Vector2(512,512)),c===void 0&&(c=1);var f=n.call(this)||this;f.fov=e,f.aspect=r,f.near=o,f.far=s,f.perspToOrtho=u,f.resolution=l,f.pixelRatio=c,f.time=0,f.needsRender=!0,f.refineModel=!0,f.pose={longitude:0,latitude:0,fov:e,distance:0,offset:new THREE__namespace.Vector3},f.computePose(),f.perspectiveCamera=new THREE__namespace.PerspectiveCamera(f.fov,f.aspect,.001,f.far);var d=Math.max(f.orthoDistance,.01)*Math.tan(.5*f.fov/180*Math.PI),p=-.5*f.aspect*2*d;return f.orthographicCamera=new THREE__namespace.OrthographicCamera(p,-p,d,-d,.001,f.far),f.computeProjectionMatrix(),f.lastValues={position:f.position.clone(),quaternion:f.quaternion.clone(),scale:f.scale.clone(),fov:f.fov,aspect:f.aspect,near:f.near,far:f.far,orthoDistance:f.orthoDistance,perspToOrtho:f.perspToOrtho.clone()},f.type=f.perspToOrtho.x<1?"PerspectiveCamera":"OrthographicCamera",f.autoNearFar=!0,f}return Object.defineProperty(t.prototype,"orthoDistance",{get:function(){return this.pose.distance>1?this.pose.distance:1+(this.pose.distance-1)*this.perspToOrtho.x},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"zoom",{get:function(){return this.type==="OrthographicCamera"?this.orthographicCamera.zoom:this.type==="PerspectiveCamera"?this.perspectiveCamera.zoom:1},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"top",{get:function(){return this.type==="OrthographicCamera"?this.orthographicCamera.top:0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"bottom",{get:function(){return this.type==="OrthographicCamera"?this.orthographicCamera.bottom:0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"left",{get:function(){return this.type==="OrthographicCamera"?this.orthographicCamera.left:0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"right",{get:function(){return this.type==="OrthographicCamera"?this.orthographicCamera.right:0},enumerable:!1,configurable:!0}),t.prototype.getDirection=function(e){return coordinatesToVector(this.pose,e)},t.prototype.computePose=function(e){e===void 0&&(e=0),this.updateMatrix();var r=this.matrix.elements;return this.pose.latitude=Math.asin(clamp$1(r[9],-1,1)),Math.abs(r[9])<.9999999?this.pose.longitude=formatRad$1(Math.atan2(r[8],r[10])):this.pose.longitude=formatRad$1(Math.atan2(-r[2],r[0])),this.pose.fov=this.fov,this.pose.distance=e,this.pose.offset=new THREE__namespace.Vector3(-r[8],-r[9],-r[10]).setLength(this.pose.distance).add(this.position),this},t.prototype.setFromPose=function(e){var r,o,s,u,l,c=formatRad$1((r=e.longitude)!==null&&r!==void 0?r:this.pose.longitude),f=Math.max(-PI_2+1e-4,Math.min(PI_2-1e-4,(o=e.latitude)!==null&&o!==void 0?o:this.pose.latitude)),d=(s=e.fov)!==null&&s!==void 0?s:this.pose.fov,p=(u=e.distance)!==null&&u!==void 0?u:this.pose.distance,v=(l=e.offset)!==null&&l!==void 0?l:this.pose.offset,g=coordinatesToVector({longitude:c,latitude:f}).normalize();return this.position.set(0,0,0),this.lookAt(g),this.position.add(v).sub(g.clone().setLength(p)),this.fov!==d&&(this.fov=d,this.updateProjectionMatrix()),this.updateMatrixWorld(!0),this.pose.longitude=c,this.pose.latitude=f,this.pose.fov=d,this.pose.distance=p,this.pose.offset.copy(v),this.needsRender=!0,this},t.prototype.copyPose=function(){return{longitude:this.pose.longitude,latitude:this.pose.latitude,fov:this.pose.fov,distance:this.pose.distance,offset:this.pose.offset.clone()}},t.prototype.computeProjectionMatrix=function(){matrixLerp(this.orthographicCamera.projectionMatrix,this.perspectiveCamera.projectionMatrix,1-this.perspToOrtho.x,this.projectionMatrix),this.projectionMatrixInverse.getInverse(this.projectionMatrix),this.needsRender=!0},t.prototype.setViewOffset=function(e,r,o,s,u,l){this.perspectiveCamera.setViewOffset(e,r,o,s,u,l),this.orthographicCamera.setViewOffset(e,r,o,s,u,l),this.computeProjectionMatrix()},t.prototype.clearViewOffset=function(){this.perspectiveCamera.clearViewOffset(),this.orthographicCamera.clearViewOffset(),this.computeProjectionMatrix()},t.prototype.updateProjectionMatrix=function(){this.perspectiveCamera.updateProjectionMatrix(),this.orthographicCamera.updateProjectionMatrix(),this.computeProjectionMatrix()},Object.defineProperty(t.prototype,"perspectiveProjectionMatrix",{get:function(){return this.perspectiveCamera.projectionMatrix},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"perspectiveProjectionMatrixInverse",{get:function(){return this.perspectiveCamera.projectionMatrixInverse},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"orthographicProjectionMatrix",{get:function(){return this.orthographicCamera.projectionMatrix},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"orthographicProjectionMatrixInverse",{get:function(){return this.orthographicCamera.projectionMatrixInverse},enumerable:!1,configurable:!0}),t.prototype.updateTime=function(e){this.time=e;var r=!1;if((this.lastValues.fov!==this.fov||this.lastValues.near!==this.near||this.lastValues.far!==this.far||this.lastValues.aspect!==this.aspect)&&(this.perspectiveCamera.fov=this.fov,this.perspectiveCamera.near=this.near,this.perspectiveCamera.far=this.far,this.perspectiveCamera.aspect=this.aspect,this.perspectiveCamera.updateProjectionMatrix(),r=!0),!this.lastValues.position.equals(this.position)||!this.lastValues.quaternion.equals(this.quaternion)||!this.lastValues.scale.equals(this.scale)||!this.lastValues.perspToOrtho.equals(this.perspToOrtho)||this.lastValues.fov!==this.fov||this.lastValues.near!==this.near||this.lastValues.far!==this.far||this.lastValues.orthoDistance!==this.orthoDistance||this.lastValues.aspect!==this.aspect){var o=Math.max(this.orthoDistance,.01)*Math.tan(.5*this.fov/180*Math.PI),s=-.5*this.aspect*2*o;this.orthographicCamera.left=s,this.orthographicCamera.right=-s,this.orthographicCamera.top=o,this.orthographicCamera.bottom=-o,this.orthographicCamera.near=this.near,this.orthographicCamera.far=this.far,this.orthographicCamera.updateProjectionMatrix(),r=!0}r&&this.computeProjectionMatrix(),this.lastValues.position.copy(this.position),this.lastValues.quaternion.copy(this.quaternion),this.lastValues.scale.copy(this.scale),this.lastValues.fov=this.fov,this.lastValues.aspect=this.aspect,this.lastValues.near=this.near,this.lastValues.far=this.far,this.lastValues.orthoDistance=this.orthoDistance,this.lastValues.perspToOrtho.copy(this.perspToOrtho),this.type=this.perspToOrtho.x<1?"PerspectiveCamera":"OrthographicCamera"},Object.defineProperty(t.prototype,"isPerspectiveCamera",{get:function(){return this.perspToOrtho.x<1},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isOrthographicCamera",{get:function(){return this.perspToOrtho.x>=1},enumerable:!1,configurable:!0}),t.prototype.copy=function(e,r){return n.prototype.copy.call(this,e,r),this.fov=e.fov,this.aspect=e.aspect,this.near=e.near,this.far=e.far,this.perspToOrtho.copy(e.perspToOrtho),this.updateTime(now()),this},t}(THREE__namespace.Camera),VolumePlaneIntersect;(function(n){n[n.Outside=-1]="Outside",n[n.Intersecting=0]="Intersecting",n[n.Inside=1]="Inside"})(VolumePlaneIntersect||(VolumePlaneIntersect={}));var EPSILON$2=1e-6,scratchVector=new THREE__namespace.Vector3,scratchMatrix4$4=new THREE__namespace.Matrix4,scratchXAxis=new THREE__namespace.Vector3,scratchYAxis=new THREE__namespace.Vector3,scratchZAxis=new THREE__namespace.Vector3,scratchSize=new THREE__namespace.Vector3,scratchBox3=new THREE__namespace.Box3,scratchSphere$1=new THREE__namespace.Sphere,scratchMatrix4Inverse$1=new THREE__namespace.Matrix4,scratchRay$1=new THREE__namespace.Ray,scratchObject3D=new THREE__namespace.Object3D,scratchFrustum=new THREE__namespace.Frustum;function quaternionFromMatrix3(n,t){var e=n.elements;return t.setFromRotationMatrix(scratchMatrix4$4.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1)),t}var CullingVolume=function(){function n(t){t===void 0&&(t=[]),this.planes=t}return Object.defineProperty(n,"MASK_OUTSIDE",{get:function(){return 4294967295},enumerable:!1,configurable:!0}),Object.defineProperty(n,"MASK_INSIDE",{get:function(){return 0},enumerable:!1,configurable:!0}),Object.defineProperty(n,"MASK_INDETERMINATE",{get:function(){return 2147483647},enumerable:!1,configurable:!0}),n.prototype.setFromFrustum=function(t){return this.planes=t.planes.map(function(e){return e.clone()}),this},n.prototype.setFromCamera=function(t){return scratchMatrix4$4.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),scratchFrustum.setFromProjectionMatrix(scratchMatrix4$4),this.setFromFrustum(scratchFrustum),this},n.prototype.applyMatrix4=function(t){for(var e=0,r=this.planes;e<r.length;e++){var o=r[e];o.applyMatrix4(t)}},n.prototype.copy=function(t){return this.planes=t.planes.map(function(e){return e.clone()}),this},n.prototype.clone=function(){return new n().copy(this)},n.prototype.computeVisibility=function(t){for(var e=VolumePlaneIntersect.Inside,r=0,o=this.planes;r<o.length;r++){var s=o[r],u=t.intersectPlane(s);switch(u){case VolumePlaneIntersect.Outside:return VolumePlaneIntersect.Outside;case VolumePlaneIntersect.Intersecting:e=VolumePlaneIntersect.Intersecting;break}}return e},n.prototype.computeVisibilityWithPlaneMask=function(t,e){if(e===n.MASK_OUTSIDE||e===n.MASK_INSIDE)return e;for(var r=n.MASK_INSIDE,o=Math.min(32,this.planes.length),s=0;s<o;++s){var u=1<<s;if(e&u){var l=this.planes[s],c=t.intersectPlane(l);if(c===VolumePlaneIntersect.Outside)return n.MASK_OUTSIDE;c===VolumePlaneIntersect.Intersecting&&(r|=u)}}return r},n}(),BoxBoundingVolume=function(){function n(){this.type="box",this.center=new THREE__namespace.Vector3,this.halfSize=new THREE__namespace.Vector3,this.rotation=new THREE__namespace.Matrix3}return n.prototype.fromJson=function(t){var e=t.box;this.center.set(e[0],e[1],e[2]);var r=e[3],o=e[4],s=e[5],u=e[6],l=e[7],c=e[8],f=e[9],d=e[10],p=e[11],v=Math.sqrt(r*r+o*o+s*s),g=Math.sqrt(u*u+l*l+c*c),h=Math.sqrt(f*f+d*d+p*p);this.halfSize.set(v,g,h);var m=this.halfSize.toArray().reduce(function(y,A){return y+A},0);return(isNaN(m)||m<=0)&&this.halfSize.setScalar(EPSILON$2),this.rotation.fromArray([r/v,o/v,s/v,u/g,l/g,c/g,f/h,d/h,p/h]),isNaN(this.rotation.toArray().reduce(function(y,A){return y+A},0))&&this.rotation.identity(),this},n.prototype.toJson=function(){return this.rotation.extractBasis(scratchXAxis,scratchYAxis,scratchZAxis),{box:__spreadArray(__spreadArray(__spreadArray(__spreadArray([],this.center.toArray(),!0),scratchXAxis.multiplyScalar(this.halfSize.x).toArray(),!0),scratchYAxis.multiplyScalar(this.halfSize.y).toArray(),!0),scratchZAxis.multiplyScalar(this.halfSize.z).toArray(),!0)}},n.prototype.copy=function(t){return this.center.copy(t.center),this.halfSize.copy(t.halfSize),this.rotation.copy(t.rotation),this},n.prototype.clone=function(){return new n().copy(this)},n.prototype.applyMatrix4=function(t){return scratchObject3D.position.copy(this.center),quaternionFromMatrix3(this.rotation,scratchObject3D.quaternion),scratchObject3D.scale.copy(this.halfSize),scratchObject3D.matrix.compose(scratchObject3D.position,scratchObject3D.quaternion,scratchObject3D.scale),scratchObject3D.matrix.premultiply(t),scratchObject3D.matrix.decompose(scratchObject3D.position,scratchObject3D.quaternion,scratchObject3D.scale),this.center.copy(scratchObject3D.position),this.rotation.setFromMatrix4(scratchMatrix4$4.makeRotationFromQuaternion(scratchObject3D.quaternion)),this.halfSize.copy(scratchObject3D.scale),this},n.prototype.getCenter=function(t){return t.copy(this.center)},n.prototype.distanceSquaredToPoint=function(t){var e=this.rotation.elements,r=t.x-this.center.x,o=t.y-this.center.y,s=t.z-this.center.z,u=0,l;return l=r*e[0]+o*e[1]+s*e[2],l<0&&(l=-l),l-=this.halfSize.x,l>0&&(u+=l*l),l=r*e[3]+o*e[4]+s*e[5],l<0&&(l=-l),l-=this.halfSize.y,l>0&&(u+=l*l),l=r*e[6]+o*e[7]+s*e[8],l<0&&(l=-l),l-=this.halfSize.z,l>0&&(u+=l*l),u},n.prototype.distanceToPoint=function(t){return Math.sqrt(this.distanceSquaredToPoint(t))},n.prototype.distanceToPlane=function(t){var e=t.projectPoint(this.center,new THREE__namespace.Vector3);return this.distanceToPoint(e)},n.prototype.getBoundingBox=function(t){return t.makeEmpty(),this.rotation.extractBasis(scratchXAxis,scratchYAxis,scratchZAxis),scratchXAxis.setLength(this.halfSize.x),scratchYAxis.setLength(this.halfSize.y),scratchZAxis.setLength(this.halfSize.z),t.expandByPoint(scratchVector.copy(this.center).add(scratchXAxis)),t.expandByPoint(scratchVector.copy(this.center).sub(scratchXAxis)),t.expandByPoint(scratchVector.copy(this.center).add(scratchYAxis)),t.expandByPoint(scratchVector.copy(this.center).sub(scratchYAxis)),t.expandByPoint(scratchVector.copy(this.center).add(scratchZAxis)),t.expandByPoint(scratchVector.copy(this.center).sub(scratchZAxis)),t},n.prototype.toGeometry=function(){var t=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]),e=new Float32Array(8*3);scratchVector.set(this.halfSize.x,this.halfSize.y,this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,0),scratchVector.set(-this.halfSize.x,this.halfSize.y,this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,3),scratchVector.set(-this.halfSize.x,-this.halfSize.y,this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,6),scratchVector.set(this.halfSize.x,-this.halfSize.y,this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,9),scratchVector.set(this.halfSize.x,this.halfSize.y,-this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,12),scratchVector.set(-this.halfSize.x,this.halfSize.y,-this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,15),scratchVector.set(-this.halfSize.x,-this.halfSize.y,-this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,18),scratchVector.set(this.halfSize.x,-this.halfSize.y,-this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,21);var r=new THREE__namespace.BufferGeometry;return r.setIndex(new THREE__namespace.BufferAttribute(t,1)),r.setAttribute("position",new THREE__namespace.BufferAttribute(e,3)),r.computeBoundingBox(),r.computeBoundingSphere(),r},n.prototype.intersectPlane=function(t){var e=this.center,r=t.normal,o=this.rotation.elements,s=this.halfSize,u=r.x,l=r.y,c=r.z,f=Math.abs(u*o[0]*s.x+l*o[1]*s.x+c*o[2]*s.x)+Math.abs(u*o[3]*s.y+l*o[4]*s.y+c*o[5]*s.y)+Math.abs(u*o[6]*s.z+l*o[7]*s.z+c*o[8]*s.z),d=r.dot(e)+t.constant;return d<=-f?VolumePlaneIntersect.Outside:d>=f?VolumePlaneIntersect.Inside:VolumePlaneIntersect.Intersecting},n.prototype.intersectRay=function(t,e){if(scratchSize.copy(this.halfSize).multiplyScalar(2),scratchBox3.setFromCenterAndSize(scratchVector.set(0,0,0),scratchSize),this.rotation.extractBasis(scratchXAxis,scratchYAxis,scratchZAxis),scratchMatrix4$4.makeBasis(scratchXAxis,scratchYAxis,scratchZAxis),scratchMatrix4$4.setPosition(this.center),scratchMatrix4Inverse$1.getInverse(scratchMatrix4$4),scratchRay$1.copy(t).applyMatrix4(scratchMatrix4Inverse$1),scratchBox3.containsPoint(scratchRay$1.origin))return!0;var r=scratchRay$1.intersectBox(scratchBox3,scratchVector);return r?e!==void 0?r.applyMatrix4(scratchMatrix4$4).distanceTo(t.origin)<e:!0:!1},n}(),SphereBoundingVolume=function(){function n(){this.type="sphere",this.center=new THREE__namespace.Vector3,this.radius=-1}return n.prototype.fromJson=function(t){var e=t.sphere;return this.center.set(e[0],e[1],e[2]),this.radius=Math.max(e[3],EPSILON$2),this},n.prototype.toJson=function(){return{sphere:__spreadArray(__spreadArray([],this.center.toArray(),!0),[this.radius],!1)}},n.prototype.copy=function(t){return this.center.copy(t.center),this.radius=t.radius,this},n.prototype.clone=function(){return new n().copy(this)},n.prototype.getBoundingBox=function(t){return t.setFromCenterAndSize(this.center,scratchSize.set(1,1,1).multiplyScalar(this.radius*2)),t},n.prototype.toGeometry=function(){for(var t=32,e=new Float32Array(t*3*2*2),r=0;r<=t;r++){var o=0;o=r/t*Math.PI*2,e[r*6+0]=this.center.x+Math.cos(o)*this.radius,e[r*6+1]=this.center.y+Math.sin(o)*this.radius,e[r*6+2]=this.center.z+0,o=(r+1)/t*Math.PI*2,e[r*6+3]=this.center.x+Math.cos(o)*this.radius,e[r*6+4]=this.center.y+Math.sin(o)*this.radius,e[r*6+5]=this.center.z+0}for(var r=t;r<=t*2;r++){var o=0;o=r/t*Math.PI*2,e[r*6+0]=this.center.x+Math.cos(o)*this.radius,e[r*6+1]=this.center.y+0,e[r*6+2]=this.center.z+Math.sin(o)*this.radius,o=(r+1)/t*Math.PI*2,e[r*6+3]=this.center.x+Math.cos(o)*this.radius,e[r*6+4]=this.center.y+0,e[r*6+5]=this.center.z+Math.sin(o)*this.radius}var s=new THREE__namespace.BufferGeometry;return s.setAttribute("position",new THREE__namespace.BufferAttribute(e,3)),s.computeBoundingBox(),s.computeBoundingSphere(),s},n.prototype.applyMatrix4=function(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this},n.prototype.getCenter=function(t){return t.copy(this.center)},n.prototype.distanceSquaredToPoint=function(t){var e=this.distanceToPoint(t);return e*e},n.prototype.distanceToPoint=function(t){var e=this.center.distanceTo(t)-this.radius;return e<=0?0:e},n.prototype.distanceToPlane=function(t){var e=Math.abs(t.distanceToPoint(this.center));return Math.max(0,e-this.radius)},n.prototype.intersectPlane=function(t){var e=this.center,r=this.radius,o=t.normal,s=o.dot(e)+t.constant;return s<-r?VolumePlaneIntersect.Outside:s<r?VolumePlaneIntersect.Intersecting:VolumePlaneIntersect.Inside},n.prototype.intersectRay=function(t,e){if(scratchSphere$1.set(this.center,this.radius),scratchSphere$1.containsPoint(t.origin))return!0;var r=t.intersectSphere(scratchSphere$1,scratchVector);return r?e!==void 0?t.origin.distanceTo(r)<e:!0:!1},n}(),RegionBoundingVolume=function(){function n(){throw this.type="regin",this.west=0,this.south=0,this.east=0,this.north=0,this.minHeight=0,this.maxHeight=0,new Error("Region bounding volume not supported.")}return n.prototype.fromJson=function(t){var e=t.region;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},n.prototype.toJson=function(){return{region:[this.west,this.south,this.east,this.north,this.minHeight,this.maxHeight]}},n.prototype.copy=function(t){return this.west=t.west,this.south=t.south,this.east=t.east,this.north=t.north,this.minHeight=t.minHeight,this.maxHeight=t.maxHeight,this},n.prototype.clone=function(){return new n().copy(this)},n.prototype.getBoundingBox=function(t){throw new Error("not implemented")},n.prototype.toGeometry=function(){throw new Error("not implemented")},n.prototype.applyMatrix4=function(t){throw new Error("not implemented")},n.prototype.getCenter=function(t){throw new Error("not implemented")},n.prototype.distanceToPoint=function(t){throw new Error("not implemented")},n.prototype.distanceSquaredToPoint=function(t){throw new Error("not implemented")},n.prototype.distanceToPlane=function(t){throw new Error("not implemented")},n.prototype.intersectPlane=function(t){throw new Error("not implemented")},n.prototype.intersectRay=function(t){throw new Error("not implemented")},n}();function isBoundingVolume(n){return n instanceof BoxBoundingVolume||n instanceof SphereBoundingVolume||n instanceof RegionBoundingVolume}function makeBoundingVolume(n){if("box"in n)return new BoxBoundingVolume().fromJson(n);if("sphere"in n)return new SphereBoundingVolume().fromJson(n);if("region"in n)return new RegionBoundingVolume().fromJson(n);throw new Error("BoundingVolume ".concat(JSON.stringify(n)," never suppored."))}var debugMaterials=[4821759,8191922,16637280,16739958,5822969,376977,16747077,9259235,14514687].map(function(n){return new THREE__namespace.LineBasicMaterial({color:n,depthWrite:!1,depthTest:!1,transparent:!0})}),debugBoxGeometry=function(){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]),t=new Float32Array(8*3);scratchVector.set(1,1,1).toArray(t,0),scratchVector.set(-1,1,1).toArray(t,3),scratchVector.set(-1,-1,1).toArray(t,6),scratchVector.set(1,-1,1).toArray(t,9),scratchVector.set(1,1,-1).toArray(t,12),scratchVector.set(-1,1,-1).toArray(t,15),scratchVector.set(-1,-1,-1).toArray(t,18),scratchVector.set(1,-1,-1).toArray(t,21);var e=new THREE__namespace.BufferGeometry;return e.setIndex(new THREE__namespace.BufferAttribute(n,1)),e.setAttribute("position",new THREE__namespace.BufferAttribute(t,3)),e.computeBoundingBox(),e.computeBoundingSphere(),e}(),debugSphereGeometry=function(){for(var n=32,t=new Float32Array(n*3*2*2),e=0;e<=n;e++){var r=0;r=e/n*Math.PI*2,t[e*6+0]=Math.cos(r),t[e*6+1]=Math.sin(r),t[e*6+2]=0,r=(e+1)/n*Math.PI*2,t[e*6+3]=Math.cos(r),t[e*6+4]=Math.sin(r),t[e*6+5]=0}for(var e=n;e<=n*2;e++){var r=0;r=e/n*Math.PI*2,t[e*6+0]=Math.cos(r),t[e*6+1]=0,t[e*6+2]=Math.sin(r),r=(e+1)/n*Math.PI*2,t[e*6+3]=Math.cos(r),t[e*6+4]=0,t[e*6+5]=Math.sin(r)}var o=new THREE__namespace.BufferGeometry;return o.setAttribute("position",new THREE__namespace.BufferAttribute(t,3)),o.computeBoundingBox(),o.computeBoundingSphere(),o}();function createDebugBoundingMesh(n,t){if(n instanceof BoxBoundingVolume){var e=new THREE__namespace.LineSegments(debugBoxGeometry,debugMaterials[Math.min(t,debugMaterials.length-1)]);return e.position.copy(n.center),quaternionFromMatrix3(n.rotation,e.quaternion),e.scale.set(n.halfSize.x,n.halfSize.y,n.halfSize.z),e.matrix.compose(e.position,e.quaternion,e.scale),e}else if(n instanceof SphereBoundingVolume){var e=new THREE__namespace.LineSegments(debugSphereGeometry,debugMaterials[Math.min(t,debugMaterials.length-1)]);return e.position.copy(n.center),e.scale.set(n.radius,n.radius,n.radius),e.matrix.compose(e.position,e.quaternion,e.scale),e}throw new Error("never")}var scratchVector3$4=new THREE__namespace.Vector3,Tile=function(){function n(t,e,r,o){var s=this,u,l,c,f;this.parent=null,this.contentParent=null,this.floor=0,this.id=t,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=o!=null?o:null,this.contentParent=o?o.hasRenderContent?o:o.contentParent:null,this.level=this.parent?this.parent.level+1:0,this.tileset=r,this.refine=(u=e.refine)!==null&&u!==void 0?u:this.parent?this.parent.refine:"REPLACE",this.transform=new THREE__namespace.Matrix4,e.transform&&this.transform.fromArray(e.transform),this.parent&&this.transform.premultiply(this.parent.transform),typeof e.geometricError=="number"?this.geometricError=e.geometricError*this.transform.getMaxScaleOnAxis():this.geometricError=(c=(l=this.parent)===null||l===void 0?void 0:l.geometricError)!==null&&c!==void 0?c:0,e.content&&e.content.uri?(this.content={uri:e.content.uri,loadState:"UNLOADED",loadStateUpdateTime:now(),loadfailRetryDelay:0,byteLength:0},e.content.group!==void 0&&(this.content.group=e.content.group),e.content.boundingVolume&&(this.content.boundingVolume=makeBoundingVolume(e.content.boundingVolume).applyMatrix4(this.transform)),/\.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=this.levelOfContent+1),e.boundingVolume&&(this.boundingVolume=makeBoundingVolume(e.boundingVolume).applyMatrix4(this.transform)),e.viewerRequestVolume&&(this.viewerRequestVolume=makeBoundingVolume(e.viewerRequestVolume).applyMatrix4(this.transform)),this.extras=(f=e.extras)!==null&&f!==void 0?f:{},typeof this.extras.floor!="number"&&o&&typeof o.extras.floor=="number"&&(this.extras.floor=o.extras.floor),typeof this.extras.floor=="number"&&(this.floor=this.extras.floor,this.tileset.floorLength=Math.max(this.tileset.floorLength,this.floor+1)),this.boundingVolume&&(this.boundingVolumeDebugObject=createDebugBoundingMesh(this.boundingVolume,this.levelOfContent)),e.children?this.children=e.children.map(function(d,p){return new n("".concat(s.id,".").concat(p),d,r,s)}):this.children=[]}return n.prototype.traverse=function(t){t(this);for(var e=0,r=this.children;e<r.length;e++){var o=r[e];o.traverse(t)}},n.prototype.updateState=function(t){this.state.frameNumber=t.frameNumber;var e=this.tileset.transformIsIdentity?null:this.tileset.transform;if(this.boundingVolume){var r=e?this.boundingVolume.clone().applyMatrix4(e):this.boundingVolume;if(t.camera.type==="OrthographicCamera"){var o=new THREE__namespace.Plane().setFromNormalAndCoplanarPoint(t.camera.direction,t.camera.position);this.state.distanceToCamera=r.distanceToPlane(o)}else this.state.distanceToCamera=r.distanceToPoint(t.camera.position);var s=r.getCenter(scratchVector3$4).sub(t.camera.position);this.state.centerZDepth=t.camera.direction.dot(s),this.state.centerScreenY=t.camera.up.dot(s);var u=this.parent?this.parent.state.visibilityPlaneMask:CullingVolume.MASK_INDETERMINATE;this.state.visibilityPlaneMask=t.cullingVolume.computeVisibilityWithPlaneMask(r,u),this.state.visible=this.state.visibilityPlaneMask!==CullingVolume.MASK_OUTSIDE}else this.state.distanceToCamera=0,this.state.centerZDepth=0,this.state.visibilityPlaneMask=CullingVolume.MASK_INDETERMINATE,this.state.visible=!0;if(this.levelOfContent<=t.minLevelOfDetail&&(this.state.visible=!0),this.viewerRequestVolume){var l=e?this.viewerRequestVolume.clone().applyMatrix4(e):this.viewerRequestVolume;this.state.inRequestVolume=l.distanceSquaredToPoint(t.camera.position)<=0}else this.state.inRequestVolume=!0;this.state.screenSpaceError=this.getScreenSpaceError(t,this.state.distanceToCamera,!1)},Object.defineProperty(n.prototype,"selected",{get:function(){return this.state.selectedFrameNumber===this.tileset.frameNumber},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"hasChildren",{get:function(){return this.children.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"siblingIndex",{get:function(){var t,e;return(e=(t=this.parent)===null||t===void 0?void 0:t.children.indexOf(this))!==null&&e!==void 0?e:0},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"hasTilesetContent",{get:function(){return this.children.length>0&&this.type==="TILESET"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"hasRenderContent",{get:function(){return this.type==="SCENEGRAPH"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"contentAvailable",{get:function(){var t;return this.hasRenderContent&&((t=this.content)===null||t===void 0?void 0:t.loadState)==="READY"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"hasUnloadedContent",{get:function(){var t;return((t=this.content)===null||t===void 0?void 0:t.loadState)==="UNLOADED"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"hasEmptyContent",{get:function(){return this.type==="EMPTY"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"contentReady",{get:function(){var t;return((t=this.content)===null||t===void 0?void 0:t.loadState)==="READY"||this.hasEmptyContent},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"contentByteLength",{get:function(){return this.content?this.content.byteLength:0},enumerable:!1,configurable:!0}),n.prototype.getScreenSpaceError=function(t,e,r){var o=this.tileset.transformIsIdentity?1:this.tileset.transform.getMaxScaleOnAxis(),s=this.parent?this.parent.geometricError:this.tileset.geometricError,u=o*(r?s:this.geometricError);if(u===0)return 0;var l=Math.max(e,.001),c=u*t.height/(l*t.sseDenominator);return c},n.prototype.getPriority=function(){var t=this.refine==="ADD"||this.tileset.skipLevelOfDetail;if(t&&!this.state.visible||this.tileset.frameNumber-this.state.touchedFrameNumber>=1)return-1;var e=this.parent,r=e&&(!t||this.state.screenSpaceError===0),o=r?e.state.screenSpaceError:this.state.screenSpaceError,s=this.tileset.root?this.tileset.root.state.screenSpaceError:0,u=Math.max(s-o,0);return u},n}(),priorityCache=new Map;function getPriority(n,t){if(t&&t.has(n))return t.get(n);var e=n.refine==="ADD"||n.tileset.skipLevelOfDetail,r=n.parent,o=r&&(!e||n.state.screenSpaceError===0),s=o?r.state.screenSpaceError:n.state.screenSpaceError,u=n.tileset.root?n.tileset.root.state.screenSpaceError:0,l=Math.max(u-s,0);return t&&t.set(n,l),l}var TileRequestScheduler=function(){function n(t,e){this.tileset=t,this.options=e,this.activeRequests=0,this.requestQueue=[]}return n.prototype.reset=function(){for(var t=0,e=this.requestQueue;t<e.length;t++){var r=e[t];this.options.onTileSkip&&this.options.onTileSkip(r.tile)}this.requestQueue.length=0},n.prototype.update=function(t,e,r){for(var o=this,s=r.time,u=this.requestQueue,l=new Set(t),c=0;c<u.length;c++){var f=u[c];if(l.has(f.tile)){l.delete(f.tile);continue}f.status==="WAITING"&&(u.splice(c,1),c--,this.options.onTileSkip&&this.options.onTileSkip(f.tile))}l.size>0&&(l.forEach(function(A){u.push({tile:A,status:"WAITING",time:s,error:null})}),l.clear());for(var d=this.tileset.maxRequests,c=0;c<u.length&&d>0;c++){var f=u[c];if(f.status==="DONE")f.error!==null?this.options.onTileError&&this.options.onTileError(f.tile,f.error):(d--,f.tile.content&&(f.tile.content.loadState="READY"),this.options.onTileLoad&&this.options.onTileLoad(f.tile)),u.splice(c,1),c--;else if(f.status==="PENDING"&&s-f.time<1e3)break}switch(priorityCache.clear(),e){case"SCREEN_SPACE_ERROR":{u.sort(function(A,E){if(A.tile.state.requestedFrameNumber!==E.tile.state.requestedFrameNumber)return E.tile.state.requestedFrameNumber-A.tile.state.requestedFrameNumber;if(A.tile.state.requestedFrameNumber===r.frameNumber){var b=getPriority(A.tile,priorityCache),T=getPriority(E.tile,priorityCache);return b-T}else return A.tile.level!==E.tile.level?A.tile.level-E.tile.level:A.tile.state.distanceToCamera-E.tile.state.distanceToCamera});break}case"SCREEN_VERTICAL":{u.sort(function(A,E){return A.tile.state.requestedFrameNumber!==E.tile.state.requestedFrameNumber?E.tile.state.requestedFrameNumber-A.tile.state.requestedFrameNumber:A.tile.state.requestedFrameNumber===r.frameNumber?A.tile.state.centerScreenY!==E.tile.state.centerScreenY?A.tile.state.centerScreenY-E.tile.state.centerScreenY:A.tile.state.centerZDepth!==E.tile.state.centerZDepth?A.tile.state.centerZDepth-E.tile.state.centerZDepth:A.tile.level!==E.tile.level?A.tile.level-E.tile.level:A.tile.state.distanceToCamera-E.tile.state.distanceToCamera:A.tile.level!==E.tile.level?A.tile.level-E.tile.level:A.tile.state.distanceToCamera-E.tile.state.distanceToCamera});break}case"SCREEN_LEVEL_VERTICAL":{u.sort(function(A,E){return A.tile.state.requestedFrameNumber!==E.tile.state.requestedFrameNumber?E.tile.state.requestedFrameNumber-A.tile.state.requestedFrameNumber:A.tile.state.requestedFrameNumber===r.frameNumber?A.tile.level!==E.tile.level?A.tile.level-E.tile.level:A.tile.state.centerScreenY!==E.tile.state.centerScreenY?A.tile.state.centerScreenY-E.tile.state.centerScreenY:A.tile.state.centerZDepth!==E.tile.state.centerZDepth?A.tile.state.centerZDepth-E.tile.state.centerZDepth:A.tile.state.distanceToCamera-E.tile.state.distanceToCamera:A.tile.level!==E.tile.level?A.tile.level-E.tile.level:A.tile.state.distanceToCamera-E.tile.state.distanceToCamera});break}}if(d=Math.max(this.tileset.maxRequests-this.activeRequests,0),!this.tileset.skipLevelOfDetail)for(var p=0,v=u.length,c=0;c<v;c++){var g=u[c].tile;if(g.hasTilesetContent||g.contentParent===null||g.contentParent.state.selectedFrameNumber===this.tileset.frameNumber){var h=u.splice(c,1);u.splice.apply(u,__spreadArray([p++,0],h,!1))}}for(var m=function(A){var E=u[A];E.status==="WAITING"&&(d--,E.status="PENDING",E.time=s,y.activeRequests++,y.tileset.options.tileLoader(E.tile).catch(function(b){E.error=b}).then(function(){E.status="DONE",E.tile.content&&E.tile.content.loadState==="READY"&&(E.tile.content.loadState="LOADING"),o.activeRequests--}))},y=this,c=0;c<u.length&&d>0;c++)m(c)},n}(),CacheNode=function(){function n(t,e,r){this.item=t,this.previous=e,this.next=r}return n}(),CacheNodeList=function(){function n(){this.head=null,this.tail=null,this._length=0}return Object.defineProperty(n.prototype,"length",{get:function(){return this._length},enumerable:!1,configurable:!0}),n.prototype.add=function(t){var e=new CacheNode(t,this.tail,null);return this.tail?(this.tail.next=e,this.tail=e):(this.head=e,this.tail=e),this._length++,e},n.prototype.remove=function(t){t.previous&&t.next?(t.previous.next=t.next,t.next.previous=t.previous):t.previous?(t.previous.next=null,this.tail=t.previous):t.next?(t.next.previous=null,this.head=t.next):(this.head=null,this.tail=null),t.next=null,t.previous=null,this._length--},n.prototype.splice=function(t,e){t!==e&&(this.remove(e),this.insert(t,e))},n.prototype.insert=function(t,e){var r=t.next;t.next=e,this.tail===t?this.tail=e:r.previous=e,e.next=r,e.previous=t,this._length++},n.prototype.toArray=function(){for(var t=[],e=this.head;e;)t.push(e),e=e.next;return t},n}(),TileCache=function(){function n(t){t===void 0&&(t={}),this.options=t,this.cacheNodeMap=new Map,this.list=new CacheNodeList,this.sentinel=this.list.add("sentinel")}return n.prototype.reset=function(){this.list.tail&&this.list.splice(this.list.tail,this.sentinel)},n.prototype.touchTile=function(t){var e=this.cacheNodeMap.get(t);e&&this.list.splice(this.sentinel,e)},n.prototype.loadTile=function(t){if(!this.cacheNodeMap.has(t)){var e=this.list.add(t);this.cacheNodeMap.set(t,e),this.options.onTileLoad&&this.options.onTileLoad(t)}},n.prototype.unloadTile=function(t){var e=this.cacheNodeMap.get(t);e&&(this.list.remove(e),this.cacheNodeMap.delete(t),this.options.onTileUnload&&this.options.onTileUnload(t))},n.prototype.unloadTiles=function(t){for(var e=this.list.head;e!==this.sentinel&&t();){var r=e.item;e=e.next,this.unloadTile(r)}},n.prototype.toArray=function(){for(var t=[],e=0,r=this.list.toArray();e<r.length;e++){var o=r[e];o.item!=="sentinel"&&t.push(o.item)}return t},n}(),ManagedArray=function(){function n(){this.map=new Map,this.array=[],this._length=0}return Object.defineProperty(n.prototype,"length",{get:function(){return this._length},enumerable:!1,configurable:!0}),n.prototype.get=function(t){return this.array[t]},n.prototype.set=function(t,e){t>=this.length&&(this._length=t+1),this.map.has(this.array[t])&&this.map.delete(this.array[t]),this.array[t]=e,this.map.set(e,t)},n.prototype.delete=function(t){var e=this.map.get(t);e!==void 0&&e>=0&&(this.array.splice(e,1),this.map.delete(t),this._length--)},n.prototype.push=function(t){if(!this.map.has(t)){var e=this._length++;this.array[e]=t,this.map.set(t,e)}},n.prototype.pop=function(){var t=this.array[--this._length];return this.map.delete(t),this.array[this._length]=void 0,t},n.prototype.reset=function(){this.array=[],this.map=new Map,this._length=0},n.prototype.find=function(t){return this.map.has(t)},n.prototype.peek=function(){return this.array[this._length-1]},n}(),TilesetBaseTraverser=function(){function n(t){this.tileset=t,this._canSelectTile=!0,this._loadAllTilesTraversalStack=new ManagedArray,this.root=null}return n.prototype.traverse=function(t,e,r){this.root=t,this.reset()},n.prototype.reset=function(){this._loadAllTilesTraversalStack.reset(),this.tileset.hasMixedContent=!1,this.tileset.needsRefinedTiles.clear(),this.tileset.requestedTiles.length=0,this.tileset.selectedTiles.length=0},n.prototype.updateTile=function(t,e){this.updateTileVisibility(t,e),t.state.shouldSelect=!1,t.state.finalResolution=!0},n.prototype.selectTile=function(t,e){var r=t.contentAvailable&&this._canSelectTile;r&&t.state.selectedFrameNumber<e.frameNumber&&(t.state.selectedFrameNumber=e.frameNumber,this.tileset.selectedTiles.push(t),this.tileset.needsRefinedTiles.add(t))},n.prototype.loadTile=function(t,e){t.state.requestedFrameNumber<e.frameNumber&&(t.state.requestedFrameNumber=e.frameNumber,t.content&&(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.tileset.requestedTiles.push(t))),this.tileset.needsRefinedTiles.add(t)},n.prototype.touchTile=function(t,e){this.tileset.cache.touchTile(t),t.state.touchedFrameNumber=e.frameNumber},n.prototype.canTraverse=function(t,e){return!t.state.inRequestVolume||t.levelOfContent>=e.maxLevelOfDetail||t.children.length===0?!1:t.levelOfContent<=e.minLevelOfDetail||t.hasTilesetContent?!0:t.state.screenSpaceError>this.tileset.maxScreenSpaceError},n.prototype.updateTileVisibility=function(t,e){if(t.updateState(e),!(!t.state.visible||!t.state.inRequestVolume)){var r=t.children.length>0;if(t.hasTilesetContent&&r){var o=t.children[0];this.updateTileVisibility(o,e),t.state.visible=o.state.visible;return}if(this.meetsScreenSpaceErrorEarly(t,e)){t.state.visible=!1;return}var s=t.refine==="REPLACE";if(s&&r&&!this.anyChildrenVisible(t,e)){t.state.visible=!1;return}}},n.prototype.anyChildrenVisible=function(t,e){for(var r=!1,o=t.children,s=0,u=o;s<u.length;s++){var l=u[s];l.updateState(e),r=r||l.state.visible}return r},n.prototype.meetsScreenSpaceErrorEarly=function(t,e){var r=t.parent;return!r||r.refine!=="ADD"||r.levelOfContent<e.minLevelOfDetail?!1:r.levelOfContent>e.maxLevelOfDetail?!0:t.getScreenSpaceError(e,t.state.distanceToCamera,!0)<this.tileset.maxScreenSpaceError},n.prototype.sortTilesByDistanceToCamera=function(t){t.sort(function(e,r){return r.state.distanceToCamera===0&&e.state.distanceToCamera===0?r.state.centerZDepth-e.state.centerZDepth:r.state.distanceToCamera-e.state.distanceToCamera})},n.prototype.loadAllTiles=function(t,e){var r=this._loadAllTilesTraversalStack;for(r.push(t);r.length>0;){var o=r.pop();o.content&&o.content.loadState==="UNLOADED"&&o.state.requestedFrameNumber<e.frameNumber&&this.tileset.requestedTiles.push(o),this.touchTile(o,e);for(var s=0,u=o.children;s<u.length;s++){var l=u[s];r.push(l)}}},n}(),TilesetNormalTraverser=function(n){__extends(t,n);function t(e){var r=n.call(this,e)||this;return r.tileset=e,r._traversalStack=new ManagedArray,r._emptyTraversalStack=new ManagedArray,r}return t.prototype.traverse=function(e,r,o){o===void 0&&(o=[]),n.prototype.traverse.call(this,e,r,o);for(var s=0,u=o;s<u.length;s++){var l=u[s];this._traversalStack.reset(),this._emptyTraversalStack.reset(),l.camera.refine&&(this._canSelectTile=l.camera.visible,this.updateTile(e,l),this.executeTraversal(e,l))}this._traversalStack.reset(),this._emptyTraversalStack.reset(),r.camera.refine&&(this._canSelectTile=r.camera.visible,this.updateTile(e,r),this.executeTraversal(e,r)),this.tileset.loadAll&&this.loadAllTiles(e,r)},t.prototype.reset=function(){n.prototype.reset.call(this),this._traversalStack.reset(),this._emptyTraversalStack.reset()},t.prototype.executeTraversal=function(e,r){var o=this._traversalStack;for(e.state.visible&&e.state.inRequestVolume&&o.push(e);o.length>0;){var s=o.pop(),u=s.parent,l=!u||u.state.shouldRefine,c=!1;this.canTraverse(s,r)&&(c=this.updateAndPushChildren(s,r,o)&&l);var f=!c&&l;s.hasRenderContent?s.refine==="ADD"?(this.loadTile(s,r),this.selectDesiredTile(s,r)):s.refine==="REPLACE"&&(this.loadTile(s,r),f&&this.selectDesiredTile(s,r)):(this.loadTile(s,r),f&&this.selectDesiredTile(s,r)),this.touchTile(s,r),s.state.shouldRefine=c}},t.prototype.updateAndPushChildren=function(e,r,o){for(var s=e.children,u=0,l=s;u<l.length;u++){var c=l[u];this.updateTile(c,r)}this.sortTilesByDistanceToCamera(s);for(var f=e.refine==="REPLACE"&&!this.tileset.skipLevelOfDetail,d=!1,p=!0,v=0,g=s;v<g.length;v++){var c=g[v];if(c.levelOfContent<=r.minLevelOfDetail||c.state.visible&&c.state.inRequestVolume?(o.find(c)&&o.delete(c),o.push(c),d===!1&&(d=!0)):(f||this.tileset.loadSiblings)&&(this.loadTile(c,r),this.touchTile(c,r)),f){var h=void 0;c.state.inRequestVolume?c.hasRenderContent?h=c.contentAvailable:h=this.executeEmptyTraversal(c,r):h=!1,p=p&&h}}return d||(p=!1),p},t.prototype.selectDesiredTile=function(e,r){e.contentAvailable&&n.prototype.selectTile.call(this,e,r)},t.prototype.executeEmptyTraversal=function(e,r){var o=!0,s=this._emptyTraversalStack;for(s.push(e);s.length>0&&o;){var u=s.pop(),l=!u.hasRenderContent&&this.canTraverse(u,r);if(!l&&!u.contentAvailable&&(o=!1),this.updateTile(u,r),u.state.visible||(this.loadTile(u,r),this.touchTile(u,r)),l)for(var c=u.children,f=0,d=c;f<d.length;f++){var p=d[f];s.find(p)&&s.delete(p),s.push(p)}}return o},t}(TilesetBaseTraverser),TilesetSkipTraverser=function(n){__extends(t,n);function t(e){var r=n.call(this,e)||this;return r.tileset=e,r.baseScreenSpaceError=1024,r.skipScreenSpaceErrorFactor=16,r.skipLevels=1,r._traversalStack=new ManagedArray,r._descendantTraversalStack=new ManagedArray,r._selectionTraversalStack=new ManagedArray,r._selectionTraversalancestorStack=new ManagedArray,r}return t.prototype.traverse=function(e,r,o){o===void 0&&(o=[]),n.prototype.traverse.call(this,e,r,o);for(var s=0,u=o;s<u.length;s++){var l=u[s];this._traversalStack.reset(),l.camera.refine&&(this._canSelectTile=l.camera.visible,this.updateTile(e,l),this.executeTraversal(e,l),this.traverseAndSelect(e,l))}this.tileset.hasMixedContent=!1,this._traversalStack.reset(),this._descendantTraversalStack.reset(),this._selectionTraversalStack.reset(),this._selectionTraversalancestorStack.reset(),r.camera.refine&&(this._canSelectTile=r.camera.visible,this.updateTile(e,r),this.executeTraversal(e,r),this.traverseAndSelect(e,r)),this.tileset.loadAll&&this.loadAllTiles(e,r)},t.prototype.reset=function(){n.prototype.reset.call(this),this._traversalStack.reset(),this._descendantTraversalStack.reset(),this._selectionTraversalStack.reset(),this._selectionTraversalancestorStack.reset()},t.prototype.executeTraversal=function(e,r){var o=this._traversalStack;for(e.state.visible&&e.state.inRequestVolume&&o.push(e);o.length>0;){var s=o.pop();this.updateTileAncestorContentLinks(s,r);var u=s.parent,l=!u||u.state.shouldRefine,c=!1;this.canTraverse(s,r)&&(c=this.updateAndPushChildren(s,r,o)&&l);var f=!c&&l;s.hasRenderContent?s.refine==="ADD"?(this.loadTile(s,r),this.selectDesiredTile(s,r)):s.refine==="REPLACE"&&(this.inBaseTraversal(s,this.baseScreenSpaceError)?(this.loadTile(s,r),f&&this.selectDesiredTile(s,r)):f?(this.loadTile(s,r),this.selectDesiredTile(s,r)):this.reachedSkippingThreshold(s)&&this.loadTile(s,r)):(this.loadTile(s,r),f&&this.selectDesiredTile(s,r)),this.touchTile(s,r),s.state.shouldRefine=c}},t.prototype.updateAndPushChildren=function(e,r,o){for(var s=e.children,u=0,l=s;u<l.length;u++){var c=l[u];this.updateTile(c,r)}this.sortTilesByDistanceToCamera(s);for(var f=!1,d=0,p=s;d<p.length;d++){var c=p[d];c.levelOfContent<=r.minLevelOfDetail||c.state.visible&&c.state.inRequestVolume?(o.push(c),f===!1&&(f=!0)):this.tileset.loadSiblings&&(this.loadTile(c,r),this.touchTile(c,r))}return f},t.prototype.selectDesiredTile=function(e,r){var o=e.contentAvailable?e:e.state.ancestorWithContentAvailable;o&&(o.state.shouldSelect=!0),e.contentAvailable||this.selectDescendants(e,r)},t.prototype.selectDescendants=function(e,r){var o=this._descendantTraversalStack;for(o.push(e);o.length>0;)for(var s=o.pop(),u=s.children,l=0,c=u;l<c.length;l++){var f=c[l];f.state.visible&&(f.contentAvailable?(this.updateTile(f,r),this.touchTile(f,r),this.selectTile(f,r)):o.push(f))}},t.prototype.reachedSkippingThreshold=function(e){var r=e.state.ancestorWithContent,o=r!==null&&e.state.screenSpaceError<r.state.screenSpaceError/this.skipScreenSpaceErrorFactor&&e.levelOfContent>r.levelOfContent+this.skipLevels;return o},t.prototype.updateTileAncestorContentLinks=function(e,r){e.state.ancestorWithContent=null,e.state.ancestorWithContentAvailable=null;var o=e.parent;if(o){var s=!(o.hasRenderContent&&o.hasUnloadedContent)||o.state.requestedFrameNumber===r.frameNumber;e.state.ancestorWithContent=s?o:o.state.ancestorWithContent,e.state.ancestorWithContentAvailable=o.contentAvailable?o:o.state.ancestorWithContentAvailable}},t.prototype.inBaseTraversal=function(e,r){return e.state.ancestorWithContent?e.parent&&e.state.screenSpaceError===0?e.parent.state.screenSpaceError>r:e.state.screenSpaceError>r:!0},t.prototype.traverseAndSelect=function(e,r){var o=this._selectionTraversalStack,s=this._selectionTraversalancestorStack,u;for(o.push(e);o.length>0||s.length>0;){if(s.length>0){var l=s.peek();if(l.state.stackLength===o.length){s.pop(),l!==u&&(l.state.finalResolution=!1),this.selectTile(l,r);continue}}var c=o.pop();if(c){var f=this.canTraverse(c,r);if(c.state.shouldSelect)if(c.refine==="ADD")this.selectTile(c,r);else{if(c.state.selectionDepth=s.length,c.state.selectionDepth>0&&(c.tileset.hasMixedContent=!0),u=c,!f){this.selectTile(c,r);continue}s.push(c),c.state.stackLength=o.length}if(f)for(var d=0,p=c.children;d<p.length;d++){var v=p[d];v.state.visible&&o.push(v)}}}},t}(TilesetBaseTraverser),TilesetMostDetailTraverser=function(n){__extends(t,n);function t(e){var r=n.call(this,e)||this;return r.tileset=e,r._traversalStack=new ManagedArray,r}return t.prototype.canTraverse=function(e,r){return!(!e.state.inRequestVolume||e.levelOfContent>=r.maxLevelOfDetail||e.children.length===0)},t.prototype.traverse=function(e,r,o){n.prototype.traverse.call(this,e,r,[]),this._traversalStack.reset(),e.updateState(r);for(var s=0,u=o;s<u.length;s++){var l=u[s];this._traversalStack.reset(),l.camera.refine&&(this._canSelectTile=l.camera.visible,e.updateState(l),this.executeTraversal(e,l))}this._traversalStack.reset(),r.camera.refine&&(this._canSelectTile=r.camera.visible,e.updateState(r),this.executeTraversal(e,r)),this.tileset.loadAll&&this.loadAllTiles(e,r)},t.prototype.reset=function(){n.prototype.reset.call(this),this._traversalStack.reset()},t.prototype.executeTraversal=function(e,r){var o=this._traversalStack;for(o.push(e);o.length>0;){var s=o.pop(),u=s.refine==="ADD",l=s.refine==="REPLACE",c=this.canTraverse(s,r);c&&this.updateAndPushChildren(s,r,o),(u||l&&!c)&&(this.loadTile(s,r),this.touchTile(s,r),this.selectDesiredTile(s,r))}},t.prototype.updateAndPushChildren=function(e,r,o){for(var s=e.children,u=0;u<s.length;++u){var l=s[u];l.updateState(r),l.state.visible&&o.push(l)}},t.prototype.selectDesiredTile=function(e,r){e.contentAvailable&&n.prototype.selectTile.call(this,e,r)},t}(TilesetBaseTraverser),Trajectory=function(){function n(t,e,r){this.index=t,this.name=e.name,this.visible=!1,this.tileset=r,this.transform=new THREE__namespace.Matrix4,e.transform&&this.transform.fromArray(e.transform),this.transform.premultiply(this.tileset.root.transform),this.content={uri:e.file,byteLength:0,loadState:"UNLOADED",loadStateUpdateTime:now(),loadfailRetryDelay:0,data:void 0}}return n}(),identityMatrix4=new THREE__namespace.Matrix4,Tileset=function(){function n(t,e,r){var o=this,s,u,l,c,f,d,p,v,g;if(this.id=t,this.transform=new THREE__namespace.Matrix4,this.transformIsIdentity=!0,this.hasMixedContent=!1,this.url=(s=r.url)!==null&&s!==void 0?s:"",this.referer=(u=r.referer)!==null&&u!==void 0?u:"",this.asset={version:e.asset.version,tilesetVersion:e.asset.tilesetVersion||"",gltfUpAxis:(l=e.asset.gltfUpAxis)!==null&&l!==void 0?l:"Y",overview:e.asset.overview,trajectories:(f=(c=e.asset.trajectories)===null||c===void 0?void 0:c.list)!==null&&f!==void 0?f:[],extras:e.asset.extras},this.rootMeta=(d=e.rootMeta)!==null&&d!==void 0?d:{},this.pointLength=(p=this.rootMeta.numTotalPoints)!==null&&p!==void 0?p:1/0,this.floorLength=(v=this.rootMeta.numFloors)!==null&&v!==void 0?v:1,this.properties=(g=e.properties)!==null&&g!==void 0?g:{},this.options=r,this.maxMemoryUsage=n.DEFAULT_MAX_MEMORY_USAGE,this.maxScreenSpaceError=n.DEFAULT_MAX_SCREEN_SPACE_ERROR,this.skipLevelOfDetail=n.DEFAULT_SKIP_LEVEL_OF_DETAIL,this.mostDetail=n.DEFAULT_MOST_DETAIL,this.loadSiblings=n.DEFAULT_LOAD_SIBLINGS,this.loadAll=n.DEFAULT_LOAD_ALL,this.maxRequests=n.DEFAULT_MAX_REQUESTS,this.tileRequestOrder=n.DEFAULT_REQUEST_ORDER,this.requestedTiles=[],this.selectedTiles=[],this.unloadTiles=[],this.needsRefinedTiles=new Set,this.selectedTrajectories=[],this.normalTraverser=new TilesetNormalTraverser(this),this.skipTraverser=new TilesetSkipTraverser(this),this.mostDetailTraverser=new TilesetMostDetailTraverser(this),this.cache=new TileCache({onTileLoad:function(y){o.memoryUsageInBytes+=y.contentByteLength},onTileUnload:function(y){o.memoryUsageInBytes-=y.contentByteLength,o.unloadTiles.push(y)}}),this.requestScheduler=new TileRequestScheduler(this,{onTileSkip:function(y){},onTileLoad:function(y){var A;!((A=y.content)===null||A===void 0)&&A.data&&(o.loadedTiles.add(y),o.cache.loadTile(y)),o.options.onTileLoad(y)},onTileError:function(y,A){o.options.onTileError(y,A)}}),this.frameNumber=0,this.maxLevelOfDetail=0,this.minLevelOfDetail=0,this.loadedTiles=new Set,this.memoryUsageInBytes=0,this.root=new Tile("".concat(this.id,".0"),e.root,this),this.geometricError=e.geometricError,this.trajectories=[],this.asset.trajectories)for(var h=0;h<this.asset.trajectories.length;h++){var m=new Trajectory(h,this.asset.trajectories[h],this);this.trajectories.push(m)}}return Object.defineProperty(n.prototype,"traverser",{get:function(){return this.mostDetail?this.mostDetailTraverser:this.skipLevelOfDetail?this.skipTraverser:this.normalTraverser},enumerable:!1,configurable:!0}),n.prototype.reset=function(){for(var t=this,e=[this.root],r;r=e.pop();){for(var o=0,s=r.children.length;o<s;o++)e.push(r.children[o]);this.cache.unloadTile(r)}for(var u=function(){var d=l.unloadTiles.pop();d&&(l.loadedTiles.delete(d),l.memoryUsageInBytes-=d.contentByteLength,l.options.tileUnloader(d).catch(function(){}).then(function(){t.options.onTileUnload&&t.options.onTileUnload(d)}))},l=this;this.unloadTiles.length;)u();this.cache.reset(),this.traverser.reset(),this.requestScheduler.reset(),this.loadedTiles.clear();for(var c=function(){var d=f.trajectories.pop();d&&f.options.trajectoryUnloader(d).catch(function(){}).then(function(){t.options.onTrajectoryUnload&&t.options.onTrajectoryUnload(d)})},f=this;this.trajectories.length;)c()},n.prototype.update=function(t,e){var r=this,o;e===void 0&&(e=[]),this.frameNumber=t.frameNumber,this.minLevelOfDetail=t.minLevelOfDetail,this.maxLevelOfDetail=t.maxLevelOfDetail,this.transformIsIdentity=this.transform.equals(identityMatrix4),this.traverser.traverse(this.root,t,e),this.cache.unloadTiles(function(){var v=r.memoryUsageInBytes>r.maxMemoryUsage*1024*1024;return v}),this.requestScheduler.update(this.requestedTiles,this.tileRequestOrder,t);for(var s=function(){var v=u.unloadTiles.pop();v&&(u.loadedTiles.delete(v),u.options.tileUnloader(v).catch(function(){}).then(function(){r.options.onTileUnload&&r.options.onTileUnload(v)}))},u=this;this.unloadTiles.length;)s();this.selectedTrajectories.length=0;for(var l=function(v){v.visible===!0&&v.content.loadState==="READY"&&(!((o=v.content.data)===null||o===void 0)&&o.object)?c.selectedTrajectories.push(v):v.visible===!0&&(v.content.loadState==="FAILED"&&t.time-v.content.loadStateUpdateTime>v.content.loadfailRetryDelay&&(v.content.loadState="UNLOADED",v.content.loadStateUpdateTime=t.time),v.content.loadState==="UNLOADED"&&c.options.trajectoryLoader(v).then(function(){r.options.onTrajectoryLoad(v)}).catch(function(g){r.options.onTrajectoryError(v,g)}))},c=this,f=0,d=this.trajectories;f<d.length;f++){var p=d[f];l(p)}},n.DEFAULT_MAX_MEMORY_USAGE=16,n.DEFAULT_MAX_SCREEN_SPACE_ERROR=4,n.DEFAULT_SKIP_LEVEL_OF_DETAIL=!1,n.DEFAULT_MOST_DETAIL=!1,n.DEFAULT_LOAD_SIBLINGS=!1,n.DEFAULT_LOAD_ALL=!1,n.DEFAULT_MAX_REQUESTS=6,n.DEFAULT_REQUEST_ORDER="SCREEN_SPACE_ERROR",n}(),BVHObject=function(){function n(t,e){this.position=t,this.indices=e}return n.prototype.getPositionCount=function(){var t,e,r=this.indices,o=this.position;return r?r.array.length/((t=r.stride)!==null&&t!==void 0?t:1):o.array.length/((e=o.stride)!==null&&e!==void 0?e:3)},n.prototype.getPositionByIndex=function(t,e){var r,o,s,u,l=this.indices,c=this.position,f=t;if(l){var d=l.array,p=(r=l.stride)!==null&&r!==void 0?r:1,v=(o=l.offset)!==null&&o!==void 0?o:0;f=d[t*p+v]}var g=c.array,h=(s=c.stride)!==null&&s!==void 0?s:3,m=(u=c.offset)!==null&&u!==void 0?u:0;return f=f*h+m,e.x=g[f],e.y=g[f+1],e.z=g[f+2],e},n.prototype.createTree=function(t,e,r){throw new Error("not implemented")},n.prototype.trianglesInSphere=function(t,e){throw new Error("not implemented")},n.prototype.intersectRay=function(t,e,r,o){throw new Error("not implemented")},n}(),BVHNode=function(){function n(t,e,r,o,s){this.id=t,this.extents=e,this.startIndex=r,this.endIndex=o,this.deepth=s}return n}(),BYTES_PER_NODE=6*4+4+4+2+2;function packBVHNode(n,t){for(var e=new ArrayBuffer(t*BYTES_PER_NODE),r=new Float32Array(e),o=new Uint32Array(e),s=new Uint16Array(e),u=[n],l,c;l=u.pop();)c=l.id*BYTES_PER_NODE/4,r[c]=l.extents[0],r[c+1]=l.extents[1],r[c+2]=l.extents[2],r[c+3]=l.extents[3],r[c+4]=l.extents[4],r[c+5]=l.extents[5],o[c+6]=l.startIndex,o[c+7]=l.endIndex,c=l.id*BYTES_PER_NODE/2,l.node0&&(s[c+16]=l.node0.id,u.push(l.node0)),l.node1&&(s[c+17]=l.node1.id,u.push(l.node1));return e}function intersectNodeBox(n,t,e,r,o,s,u,l,c){c===void 0&&(c=0),e=e-c,r=r-c,o=o-c,s=s+c,u=u+c,l=l+c;var f=0,d=0,p=0,v=0,g=0,h=0;return t.x>=0?(f=(e-n.x)*t.x,d=(s-n.x)*t.x):(f=(s-n.x)*t.x,d=(e-n.x)*t.x),t.y>=0?(p=(r-n.y)*t.y,v=(u-n.y)*t.y):(p=(u-n.y)*t.y,v=(r-n.y)*t.y),!(f>v||p>d||(p>f&&(f=p),v<d&&(d=v),t.z>=0?(g=(o-n.z)*t.z,h=(l-n.z)*t.z):(g=(l-n.z)*t.z,h=(o-n.z)*t.z),f>h||g>d)||(g>f&&(f=g),h<d&&(d=h),d<0))}var BVHVector3=function(){function n(t,e,r){this.x=t,this.y=e,this.z=r}return n.prototype.copy=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},n.prototype.set=function(t,e,r){return this.x=t,this.y=e,this.z=r,this},n.prototype.fromArray=function(t,e){return e===void 0&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this},n.prototype.toArray=function(t,e){return t===void 0&&(t=[]),e===void 0&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t},n.prototype.add=function(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this},n.prototype.multiplyScalar=function(t){return this.x*=t,this.y*=t,this.z*=t,this},n.prototype.subVectors=function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this},n.prototype.addScaledVector=function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this},n.prototype.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z},n.prototype.cross=function(t){var e=this.x,r=this.y,o=this.z;return this.x=r*t.z-o*t.y,this.y=o*t.x-e*t.z,this.z=e*t.y-r*t.x,this},n.prototype.crossVectors=function(t,e){var r=t.x,o=t.y,s=t.z,u=e.x,l=e.y,c=e.z;return this.x=o*c-s*l,this.y=s*u-r*c,this.z=r*l-o*u,this},n.prototype.distanceTo=function(t){return Math.sqrt(this.distanceToSquared(t))},n.prototype.distanceToSquared=function(t){var e=this.x-t.x,r=this.y-t.y,o=this.z-t.z;return e*e+r*r+o*o},n.prototype.clone=function(){return new n(this.x,this.y,this.z)},n}(),BVHIntersect=function(){function n(t,e,r){this.triangle=t,this.intersectionPoint=e,this.index=r}return n}(),EPSILON$1=1e-6,scratchVector3$3=new BVHVector3(0,0,0),scratchVector3A=new BVHVector3(0,0,0),scratchVector3B=new BVHVector3(0,0,0),scratchVector3C=new BVHVector3(0,0,0),BVHMesh=function(n){__extends(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t.prototype.createTree=function(e,r,o){r=Math.min(r,16);var s=this.getPositionCount()/3,u=s>65535?new Uint32Array(s):new Uint16Array(s),l=new Float32Array(s*6),c=[],f=0,d=-1;if(o)for(var p=0,v=0,g=0,h=void 0,m=void 0,y=void 0,A=void 0,E=void 0,b=void 0,T=void 0;p<s;p+=1,v+=3,g+=6)u[p]=p,this.getPositionByIndex(v,scratchVector3A),this.getPositionByIndex(v+1,scratchVector3B),this.getPositionByIndex(v+2,scratchVector3C),h=A=scratchVector3A.x,T=scratchVector3B.x,T<h&&(h=T),T>A&&(A=T),T=scratchVector3C.x,T<h&&(h=T),T>A&&(A=T),m=E=scratchVector3A.y,T=scratchVector3B.y,T<m&&(m=T),T>E&&(E=T),T=scratchVector3C.y,T<m&&(m=T),T>E&&(E=T),y=b=scratchVector3A.z,T=scratchVector3B.z,T<y&&(y=T),T>b&&(b=T),T=scratchVector3C.z,T<y&&(y=T),T>b&&(b=T),l[g]=h,l[g+1]=m,l[g+2]=y,l[g+3]=A,l[g+4]=E,l[g+5]=b;else{for(var _=1/0,R=1/0,S=1/0,M=-1/0,B=-1/0,H=-1/0,p=0,v=0,g=0,h=void 0,m=void 0,y=void 0,A=void 0,E=void 0,b=void 0,T=void 0;p<s;p+=1,v+=3,g+=6)u[p]=p,this.getPositionByIndex(v,scratchVector3A),this.getPositionByIndex(v+1,scratchVector3B),this.getPositionByIndex(v+2,scratchVector3C),h=A=scratchVector3A.x,T=scratchVector3B.x,T<h&&(h=T),T>A&&(A=T),T=scratchVector3C.x,T<h&&(h=T),T>A&&(A=T),m=E=scratchVector3A.y,T=scratchVector3B.y,T<m&&(m=T),T>E&&(E=T),T=scratchVector3C.y,T<m&&(m=T),T>E&&(E=T),y=b=scratchVector3A.z,T=scratchVector3B.z,T<y&&(y=T),T>b&&(b=T),T=scratchVector3C.z,T<y&&(y=T),T>b&&(b=T),l[g]=h,l[g+1]=m,l[g+2]=y,l[g+3]=A,l[g+4]=E,l[g+5]=b,h<_&&(_=h),A>M&&(M=A),m<R&&(R=m),E>B&&(B=E),y<S&&(S=y),b>H&&(H=b);o=[_,R,S,M,B,H]}var w=new BVHNode(++d,o,0,s,0);c[f++]=w;var C=[],L=[0,1,2],I=function(k,N){return C[N]-C[k]};function F(k){var N=k.startIndex,D=k.endIndex,U=k.extents;C[0]=U[3]-U[0],C[1]=U[4]-U[1],C[2]=U[5]-U[2],L.sort(I);for(var Q=0;Q<3;Q++){for(var q=L[Q],G=U[q]+U[q+3],J=N,X=D-1,W=-1,j=void 0;J<=X;)W===-1?(j=u[J],l[j*6+q]+l[j*6+q+3]<G?J++:W=j):(j=u[X],l[j*6+q]+l[j*6+q+3]>=G||(u[J]=j,u[X]=W,W=-1,J++),X--);if(J>N&&J<D){var te=new BVHNode(++d,calcExtents(u,l,N,J,EPSILON$1),N,J,k.deepth+1);te.deepth<r&&te.endIndex-te.startIndex>e&&(c[f++]=te);var $=new BVHNode(++d,calcExtents(u,l,J,D,EPSILON$1),J,D,k.deepth+1);$.deepth<r&&$.endIndex-$.startIndex>e&&(c[f++]=$),k.node0=te,k.node1=$,k.startIndex=0,k.endIndex=0;break}}}for(;f;)F(c[--f]);return this.offsetArray=u,this.rootNodePacked=packBVHNode(w,d+1),c.length=0,this},t.prototype.trianglesInSphere=function(e,r){for(var o=this.offsetArray,s=this.rootNodePacked,u=new Float32Array(s),l=new Uint32Array(s),c=new Uint16Array(s),f=[0],d=[],p,v,g,h;(p=f.pop())!==void 0;){h=p*BYTES_PER_NODE/4;var m=clamp(e.x,u[h],u[h+3])-e.x,y=clamp(e.y,u[h+1],u[h+4])-e.y,A=clamp(e.z,u[h+2],u[h+5])-e.z;if(m*m+y*y+A*A<=r*r){for(var E=l[h+6];E<l[h+7];E++)d.push(o[E]);h=p*BYTES_PER_NODE/2,v=c[h+16],g=c[h+17],v&&f.push(v),g&&f.push(g)}}for(var b=d.length,T=new Float32Array(b*9),E=0;E<b;E++){var _=d[E];this.getPositionByIndex(_,scratchVector3$3),T[E*9]=scratchVector3$3.x,T[E*9+1]=scratchVector3$3.y,T[E*9+2]=scratchVector3$3.z,this.getPositionByIndex(_+1,scratchVector3$3),T[E*9+3]=scratchVector3$3.x,T[E*9+4]=scratchVector3$3.y,T[E*9+5]=scratchVector3$3.z,this.getPositionByIndex(_+2,scratchVector3$3),T[E*9+6]=scratchVector3$3.x,T[E*9+7]=scratchVector3$3.y,T[E*9+8]=scratchVector3$3.z}return T},t.prototype.intersectRay=function(e,r,o,s){for(var u=this.offsetArray,l=this.rootNodePacked,c=new Float32Array(l),f=new Uint32Array(l),d=new Uint16Array(l),p=new BVHVector3(1/r.x,1/r.y,1/r.z),v=[0],g,h,m,y;(g=v.pop())!==void 0;)if(y=g*BYTES_PER_NODE/4,intersectNodeBox(e,p,c[y],c[y+1],c[y+2],c[y+3],c[y+4],c[y+5])){for(var A=f[y+6],E=f[y+7],b=void 0,T=void 0,_=void 0,R=e.x,S=e.y,M=e.z,B=r.x,H=r.y,w=r.z,C=void 0,L=void 0,I=void 0,F=void 0,k=void 0,N=void 0,D=void 0,U=void 0,Q=void 0,q=void 0,G=void 0,J=void 0,X=void 0,W=void 0,j=void 0,te=void 0,$=void 0,ne=void 0,ie=void 0,oe=void 0,Z=void 0,de=void 0,he=void 0,fe=void 0,Te=void 0,ce=void 0,ge=void 0;A<E;A++){if(b=u[A],T=b*3,this.getPositionByIndex(T,scratchVector3$3),C=scratchVector3$3.x,L=scratchVector3$3.y,I=scratchVector3$3.z,this.getPositionByIndex(T+1,scratchVector3$3),F=scratchVector3$3.x,k=scratchVector3$3.y,N=scratchVector3$3.z,this.getPositionByIndex(T+2,scratchVector3$3),D=scratchVector3$3.x,U=scratchVector3$3.y,Q=scratchVector3$3.z,q=F-C,G=k-L,J=N-I,X=D-C,W=U-L,j=Q-I,te=G*j-J*W,$=J*X-q*j,ne=q*W-G*X,he=B*te+H*$+w*ne,he>0)de=1;else if(he<0)de=-1,he=-he;else continue;ie=R-C,oe=S-L,Z=M-I,fe=de*(B*(oe*j-Z*W)+H*(Z*X-ie*j)+w*(ie*W-oe*X)),!(fe<0)&&(Te=de*(B*(G*Z-J*oe)+H*(J*ie-q*Z)+w*(q*oe-G*ie)),!(Te<0)&&(fe+Te>he||(ce=-de*(ie*te+oe*$+Z*ne),!(ce<0)&&(ge=ce/he,s.push(new BVHIntersect([C,L,I,F,k,N,D,U,Q],[R+B*ge,S+H*ge,M+w*ge],b))))))}y=g*BYTES_PER_NODE/2,h=d[y+16],m=d[y+17],h&&v.push(h),m&&v.push(m)}return s},t}(BVHObject);function clamp(n,t,e){return n<t?t:n>e?e:n}function calcExtents(n,t,e,r,o){if(e>=r)return[0,0,0,0,0,0];for(var s=1/0,u=1/0,l=1/0,c=-1/0,f=-1/0,d=-1/0,p=e,v=void 0,g=void 0;p<r;p++)v=n[p]*6,g=t[v],g<s&&(s=g),g=t[v+1],g<u&&(u=g),g=t[v+2],g<l&&(l=g),g=t[v+3],g>c&&(c=g),g=t[v+4],g>f&&(f=g),g=t[v+5],g>d&&(d=g);return[s-o,u-o,l-o,c+o,f+o,d+o]}var EPSILON=1e-6,ORDER_AXISES=["x","y","z"],scratchVector3$2=new BVHVector3(0,0,0),BVHPoints=function(n){__extends(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t.prototype.createTree=function(e,r,o){r=Math.min(r,16);var s=this.getPositionByIndex.bind(this),u=this.getPositionCount(),l=u>65535?new Uint32Array(u):new Uint16Array(u),c=[],f=0,d=-1;if(o)for(var p=0;p<u;p+=1)l[p]=p;else{s(0,scratchVector3$2);for(var v=scratchVector3$2.x,g=scratchVector3$2.y,h=scratchVector3$2.z,m=v,y=g,A=h,p=0,E=void 0,b=void 0,T=void 0;p<u;p+=1)l[p]=p,s(p,scratchVector3$2),E=scratchVector3$2.x,b=scratchVector3$2.y,T=scratchVector3$2.z,E<v?v=E:E>m&&(m=E),b<g?g=b:b>y&&(y=b),T<h?h=T:T>A&&(A=T);o=[v,g,h,m,y,A]}var _=new BVHNode(++d,o,0,u,0);c[f++]=_;var R=[],S=[0,1,2],M=function(H,w){return R[w]-R[H]};function B(H){var w=H.startIndex,C=H.endIndex,L=H.extents;R[0]=L[3]-L[0],R[1]=L[4]-L[1],R[2]=L[5]-L[2];for(var I=S.sort(M)[0],F=ORDER_AXISES[I],k=(L[I]+L[I+3])/2,N=w,D=C-1,U=-1,Q;N<=D;)U===-1?(Q=l[N],s(Q,scratchVector3$2),scratchVector3$2[F]<k?N++:U=Q):(Q=l[D],s(Q,scratchVector3$2),scratchVector3$2[F]>=k||(l[N]=Q,l[D]=U,U=-1,N++),D--);if(N>w){var q=L.slice();q[I+3]=k+EPSILON;var G=new BVHNode(++d,q,w,N,H.deepth+1);G.deepth<r&&G.endIndex-G.startIndex>e&&(c[f++]=G),H.node0=G}if(C>N){var J=L.slice();J[I]=k-EPSILON;var X=new BVHNode(++d,J,N,C,H.deepth+1);X.deepth<r&&X.endIndex-X.startIndex>e&&(c[f++]=X),H.node1=X}H.startIndex=0,H.endIndex=0}for(;f;)B(c[--f]);return this.offsetArray=l,this.rootNodePacked=packBVHNode(_,d+1),c.length=0,this},t.prototype.intersectRay=function(e,r,o,s){for(var u=this.offsetArray,l=this.rootNodePacked,c=new Float32Array(l),f=new Uint32Array(l),d=new Uint16Array(l),p=o*o,v=new BVHVector3(1/r.x,1/r.y,1/r.z),g=[0],h,m,y,A;(h=g.pop())!==void 0;)if(A=h*BYTES_PER_NODE/4,intersectNodeBox(e,v,c[A],c[A+1],c[A+2],c[A+3],c[A+4],c[A+5],o)){for(var E=f[A+6],b=f[A+7],T=void 0,_=void 0,R=void 0,S=void 0,M=void 0,B=void 0,H=void 0,w=void 0,C=void 0,L=void 0,I=void 0,F=void 0;E<b;E++)T=u[E],this.getPositionByIndex(T,scratchVector3$2),_=scratchVector3$2.x,R=scratchVector3$2.y,S=scratchVector3$2.z,M=e.x,B=e.y,H=e.z,w=r.x,C=r.y,L=r.z,I=w*(_-M)+C*(R-B)+L*(S-H),I>0&&(M+=w*I,B+=C*I,H+=L*I),w=_-M,C=R-B,L=S-H,I=w*w+C*C+L*L,I<=p&&s.push(new BVHIntersect([_,R,S,_,R,S,_,R,S],[M,B,H],T));A=h*BYTES_PER_NODE/2,m=d[A+16],y=d[A+17],m&&g.push(m),y&&g.push(y)}return s},t}(BVHObject);const encodedJs$1="KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO3ZhciBlcj1mdW5jdGlvbihlLHIpe3JldHVybiBlcj1PYmplY3Quc2V0UHJvdG90eXBlT2Z8fHtfX3Byb3RvX186W119aW5zdGFuY2VvZiBBcnJheSYmZnVuY3Rpb24odCxvKXt0Ll9fcHJvdG9fXz1vfXx8ZnVuY3Rpb24odCxvKXtmb3IodmFyIGYgaW4gbylPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwobyxmKSYmKHRbZl09b1tmXSl9LGVyKGUscil9O2Z1bmN0aW9uIGhyKGUscil7aWYodHlwZW9mIHIhPSJmdW5jdGlvbiImJnIhPT1udWxsKXRocm93IG5ldyBUeXBlRXJyb3IoIkNsY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IGNyKGUscix0LG8sZixkLHYsbixzKXtzPT09dm9pZCAwJiYocz0wKSx0PXQtcyxvPW8tcyxmPWYtcyxkPWQrcyx2PXYrcyxuPW4rczt2YXIgdT0wLHc9MCx5PTAscD0wLGE9MCxoPTA7cmV0dXJuIHIueD49MD8odT0odC1lLngpKnIueCx3PShkLWUueCkqci54KToodT0oZC1lLngpKnIueCx3PSh0LWUueCkqci54KSxyLnk+PTA/KHk9KG8tZS55KSpyLnkscD0odi1lLnkpKnIueSk6KHk9KHYtZS55KSpyLnkscD0oby1lLnkpKnIueSksISh1PnB8fHk+d3x8KHk+dSYmKHU9eSkscDx3JiYodz1wKSxyLno+PTA/KGE9KGYtZS56KSpyLnosaD0obi1lLnopKnIueik6KGE9KG4tZS56KSpyLnosaD0oZi1lLnopKnIueiksdT5ofHxhPncpfHwoYT51JiYodT1hKSxoPHcmJih3PWgpLHc8MCkpfXZhciBZPWZ1bmN0aW9uKCl7ZnVuY3Rpb24gZShyLHQsbyl7dGhpcy54PXIsdGhpcy55PXQsdGhpcy56PW99cmV0dXJuIGUucHJvdG90eXBlLmNvcHk9ZnVuY3Rpb24ocil7cmV0dXJuIHRoaXMueD1yLngsdGhpcy55PXIueSx0aGlzLno9ci56LHRoaXN9LGUucHJvdG90eXBlLnNldD1mdW5jdGlvbihyLHQsbyl7cmV0dXJuIHRoaXMueD1yLHRoaXMueT10LHRoaXMuej1vLHRoaXN9LGUucHJvdG90eXBlLmZyb21BcnJheT1mdW5jdGlvbihyLHQpe3JldHVybiB0PT09dm9pZCAwJiYodD0wKSx0aGlzLng9clt0XSx0aGlzLnk9clt0KzFdLHRoaXMuej1yW3QrMl0sdGhpc30sZS5wcm90b3R5cGUudG9BcnJheT1mdW5jdGlvbihyLHQpe3JldHVybiByPT09dm9pZCAwJiYocj1bXSksdD09PXZvaWQgMCYmKHQ9MCksclt0XT10aGlzLngsclt0KzFdPXRoaXMueSxyW3QrMl09dGhpcy56LHJ9LGUucHJvdG90eXBlLmFkZD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5idWZmZXIpfXU9cy5pbmRpY2VzLHUmJnUuYnVmZmVyIGluc3RhbmNlb2YgQXJyYXlCdWZmZXImJm8uYWRkKHUuYnVmZmVyKSx1PXMub2Zmc2V0QXJyYXksdSYmdS5idWZmZXIgaW5zdGFuY2VvZiBBcnJheUJ1ZmZlciYmby5hZGQodS5idWZmZXIpLG8uYWRkKHMucm9vdE5vZGVQYWNrZWQpfXJldHVybntvdXRwdXQ6dCx0cmFuc2ZlcjpBcnJheS5mcm9tKG8pfX0pfSl9KSgpOwo=",decodeBase64$1=n=>Uint8Array.from(atob(n),t=>t.charCodeAt(0)),blob$2=typeof self!="undefined"&&self.Blob&&new Blob([decodeBase64$1(encodedJs$1)],{type:"text/javascript;charset=utf-8"});function WorkerWrapper$1(n){let t;try{if(t=blob$2&&(self.URL||self.webkitURL).createObjectURL(blob$2),!t)throw"";const e=new Worker(t,{name:n==null?void 0:n.name});return e.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),e}catch(e){return new Worker("data:text/javascript;base64,"+encodedJs$1,{name:n==null?void 0:n.name})}finally{t&&(self.URL||self.webkitURL).revokeObjectURL(t)}}var WorkerPool$1=function(){function n(t,e){this.pool=e,this.workerCreator=t,this.queue=[],this.workers=[],this.workersResolver=[],this.workerStatus=0}return n.prototype.initWorker=function(t){if(this.workerCreator&&!this.workers[t]){var e=this.workerCreator();e.addEventListener("message",this.onMessage.bind(this,t)),this.workers[t]=e}},n.prototype.getIdleWorker=function(){for(var t=0;t<this.pool;t++)if(!(this.workerStatus&1<<t))return t;return-1},n.prototype.onMessage=function(t,e){var r=this.workersResolver[t],o=r.resolve,s=r.reject;if(e.data&&"$$error"in e.data?s(e.data.$$error):o(e.data),this.queue.length){var u=this.queue.shift(),l=u.resolve,c=u.reject,f=u.input,d=u.transfer;this.workersResolver[t]={resolve:l,reject:c},this.workers[t].postMessage(f,d)}else this.workerStatus^=1<<t},n.prototype.postMessage=function(t,e){var r=this;return e===void 0&&(e=[]),new Promise(function(o,s){var u=r.getIdleWorker();u!==-1?(r.initWorker(u),r.workerStatus|=1<<u,r.workersResolver[u]={resolve:o,reject:s},r.workers[u].postMessage(t,e)):r.queue.push({resolve:o,reject:s,input:t,transfer:e})})},n.prototype.dispose=function(){this.workers.forEach(function(t){return t.terminate()}),this.workersResolver.length=0,this.workers.length=0,this.queue.length=0,this.workerStatus=0},n}(),bvhWorkerPool=new WorkerPool$1(function(){return new WorkerWrapper$1},4),bvhMeshMap=new Map,scratchRay=new THREE__namespace.Ray,scratchNormalMatrix=new THREE__namespace.Matrix3,scratchInverseMatrix=new THREE__namespace.Matrix4,scratchIntersectionFaceA=new THREE__namespace.Vector3,scratchIntersectionFaceB=new THREE__namespace.Vector3,scratchIntersectionFaceC=new THREE__namespace.Vector3,scratchIntersectionTriangle=new THREE__namespace.Triangle;function raycastMesh(n,t,e,r){var o,s=n.matrixWorld;scratchInverseMatrix.getInverse(s),scratchRay.copy(e.ray).applyMatrix4(scratchInverseMatrix);for(var u=t.intersectRay(scratchRay.origin,scratchRay.direction,0,[]),l=n.geometry,c=n.material,f=l.groups,d=l.index,p=0,v=u.length;p<v;p++){var g=u[p],h=g.triangle,m=g.index,y=g.intersectionPoint,A=new THREE__namespace.Vector3(y[0],y[1],y[2]).applyMatrix4(s),E=e.ray.origin.distanceTo(A);if(!(E<e.near||E>e.far)){var b=void 0;if(Array.isArray(c)){if(f)for(var T=m*3,_=0,R=f;_<R.length;_++){var S=R[_];if(T>=S.start&&T-S.start<S.count){b=c[(o=S.materialIndex)!==null&&o!==void 0?o:0];break}}}else b=c;if(b){var M=scratchIntersectionTriangle.set(scratchIntersectionFaceA.set(h[0],h[1],h[2]).applyMatrix4(s),scratchIntersectionFaceB.set(h[3],h[4],h[5]).applyMatrix4(s),scratchIntersectionFaceC.set(h[6],h[7],h[8]).applyMatrix4(s)).getNormal(new THREE__namespace.Vector3),B=m*3,H=new THREE__namespace.Face3(d?d.array[B]:B,d?d.array[B+1]:B+1,d?d.array[B+2]:B+2,M),w=e.ray.direction.dot(M);b.side===THREE__namespace.FrontSide&&w>=0||b.side===THREE__namespace.BackSide&&w<=0||r.push({distance:E,object:n,face:H,point:A,distanceToRay:0,faceIndex:m})}}}}function raycastPoints(n,t,e,r){var o,s,u=n.matrixWorld;scratchNormalMatrix.getNormalMatrix(u),scratchInverseMatrix.getInverse(u);var l=((s=(o=e.params.Points)===null||o===void 0?void 0:o.threshold)!==null&&s!==void 0?s:1)*scratchInverseMatrix.getMaxScaleOnAxis();scratchRay.copy(e.ray).applyMatrix4(scratchInverseMatrix);for(var c=t.intersectRay(scratchRay.origin,scratchRay.direction,l,[]),f=n.geometry,d=f.index,p=f.getAttribute("normal"),v=0,g=c.length;v<g;v++){var h=c[v],m=h.triangle,y=h.index,A=h.intersectionPoint,E=new THREE__namespace.Vector3(A[0],A[1],A[2]).applyMatrix4(u),b=e.ray.origin.distanceTo(E);if(!(b<e.near||b>e.far)){var T=scratchIntersectionFaceA.set(m[0],m[1],m[2]).applyMatrix4(u),_=d?d.array[y]:y,R=void 0;if(p instanceof THREE__namespace.BufferAttribute){var S=new THREE__namespace.Vector3().fromBufferAttribute(p,_).applyNormalMatrix(scratchNormalMatrix);R=new THREE__namespace.Face3(_,_,_,S)}r.push({distance:b,object:n,face:R,point:E,distanceToRay:E.distanceTo(T),index:y})}}}var BVH_MESH_PROP="__bvh_mesh__",originMeshRaycast=THREE__namespace.Mesh.prototype.raycast;function overrideMeshRaycast(n,t){var e=getBvhTreeForMesh(this);e?raycastMesh(this,e,n,t):originMeshRaycast.call(this,n,t)}function getBvhTreeForMesh(n){var t=n[BVH_MESH_PROP];return t instanceof BVHMesh,t}function bindBvhTreeForMesh(n,t){var e;Object.assign(n,(e={},e[BVH_MESH_PROP]=t,e.raycast=overrideMeshRaycast,e))}var BVH_POINTS_PROP="__bvh_points__",originPointsRaycast=THREE__namespace.Points.prototype.raycast;function overridePointsRaycast(n,t){var e=getBvhTreeForPoints(this);e?raycastPoints(this,e,n,t):originPointsRaycast.call(this,n,t)}function getBvhTreeForPoints(n){var t=n[BVH_POINTS_PROP];return t instanceof BVHPoints,t}function bindBvhTreeForPoints(n,t){var e;Object.assign(n,(e={},e[BVH_POINTS_PROP]=t,e.raycast=overridePointsRaycast,e))}function generateBvhTree(n,t,e,r){var o=[];return n.traverse(function(s){(s instanceof THREE__namespace.Mesh||s instanceof THREE__namespace.Points)&&s.geometry instanceof THREE__namespace.BufferGeometry&&o.push(s)}),Promise.resolve().then(function(){for(var s=[],u=new Set,l=null,c=0;c<o.length;c++){var f=o[c],d=f.geometry;if(d instanceof THREE__namespace.BufferGeometry){var p=void 0;if(f instanceof THREE__namespace.Mesh?p="mesh":f instanceof THREE__namespace.Points&&(p="points"),!!p){var v=d.boundingBox,g=v?[v.min.x,v.min.y,v.min.z,v.max.x,v.max.y,v.max.z]:void 0,h={};for(var m in d.attributes){var y=d.attributes[m];y instanceof THREE__namespace.InterleavedBufferAttribute?(h[m]={array:y.data.array,stride:y.data.stride,offset:y.offset},l=y.data.array,l&&l.buffer instanceof ArrayBuffer&&u.add(l.buffer)):(h[m]={array:y.array},l=y.array,l&&l.buffer instanceof ArrayBuffer&&u.add(l.buffer))}var A=void 0,E=d.getIndex();E&&(E instanceof THREE__namespace.InterleavedBufferAttribute?(A={array:E.data.array,stride:E.data.stride,offset:E.offset},l=E.data.array,l&&l.buffer instanceof ArrayBuffer&&u.add(l.buffer)):(A={array:E.array},l=E.array,l&&l.buffer instanceof ArrayBuffer&&u.add(l.buffer)));var b={type:p,attributes:h,indices:A,maxItemPerNode:e,maxTreeDepth:r,extents:g};s.push(b)}}}return bvhWorkerPool.postMessage(s,Array.from(u))}).then(function(s){for(var u=0;u<o.length;u++){var l=o[u],c=l.geometry,f=s[u];if(c instanceof THREE__namespace.BufferGeometry){for(var d in f.attributes){var p=f.attributes[d].array,v=c.attributes[d];v instanceof THREE__namespace.InterleavedBufferAttribute?v.data.array=p:v.array=p}var g=c.getIndex();if(g&&f.indices){var p=f.indices.array;g instanceof THREE__namespace.InterleavedBufferAttribute?g.data.array=p:g.array=p}if(l instanceof THREE__namespace.Mesh){var h=new BVHMesh(f.attributes.position,f.indices);h.offsetArray=f.offsetArray,h.rootNodePacked=f.rootNodePacked,bindBvhTreeForMesh(l,h)}else if(l instanceof THREE__namespace.Points){var h=new BVHPoints(f.attributes.position,f.indices);h.offsetArray=f.offsetArray,h.rootNodePacked=f.rootNodePacked,bindBvhTreeForPoints(l,h)}}}return n})}var TileNode=function(n){__extends(t,n);function t(e,r,o){o===void 0&&(o=noop$1);var s=n.call(this)||this;return s.contentObject=r,s.name=e,s.materials=[],s.pbmObjects=[],s.disposers=[o],s.add(r),r.traverse(function(u){var l;if(u instanceof THREE__namespace.Mesh||u instanceof THREE__namespace.Points){var c=u.material;Array.isArray(c)?(l=s.materials).push.apply(l,c):s.materials.push(c)}(u instanceof PBMMesh||u instanceof PBMPointCloud)&&s.pbmObjects.push(u)}),s}return t.prototype.generateBvhTree=function(){return generateBvhTree(this,!0,200,10)},t.prototype.intersectRaycaster=function(e,r,o){r===void 0&&(r=!0),o===void 0&&(o=[]);for(var s=this.children.slice(),u,l=[];u=s.pop();)if(u.visible){u.raycast(e,l);for(var c=0,f=u.children.length;c<f;c++)s.push(u.children[c])}return l.forEach(function(d){var p=0;if((d.object instanceof PBMMesh||d.object instanceof PBMPointCloud)&&d.face){var v=Array.isArray(d.object.material)?d.object.material[d.face.materialIndex]:d.object.material;v&&(p=v.floor)}d.floor=p}),r&&l.sort(function(d,p){return d.distance-p.distance}),o.push.apply(o,l),o},t.prototype.update=function(e,r,o,s){for(var u=0,l=this.pbmObjects;u<l.length;u++){var c=l[u];c.update(e,r,o,s)}},t.prototype.dispose=function(){for(var e=0,r=this.disposers;e<r.length;e++){var o=r[e];o()}this.disposers.length=0,this.pbmObjects.length=0},t.prototype.clone=function(){return new t(this.name,this.contentObject.clone())},t}(THREE__namespace.Object3D);function pathJoin(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];var e=[];n=n.map(function(l){return(l!=null?l:"").trim()}).filter(function(l){return l.length>0&&!/^\/+$/.test(l)});for(var r=0;r<n.length;r++){var o=r===0,s=r===n.length-1,u=n[r];o||(u=u.replace(/^\.\//,"").replace(/^\/+/,"")),s||(u=u.replace(/\/+$/,"")),e.push(u)}return e.join("/")}function normalizeURL(n){var t,e=/^(http\:|https\:|file\:)?\/\/[^/]/.exec(n);if(!e)return n;var r=e[1]||"",o=n.slice(r.length+2),s=o.indexOf("#");s>=0&&(n.slice(s),o=n.slice(0,s));var u=o.indexOf("?");u>=0&&(n.slice(u),o=n.slice(0,u));for(var l=o.split("/"),c=l.shift(),f=(t=l.pop())!==null&&t!==void 0?t:"",d=[],p=0,v=l;p<v.length;p++){var g=v[p];if(!(g===""||g===".")){if(g===".."){d.pop();continue}d.push(g)}}return r+"//"+c+"/"+d.join("/")+"/"+f}function isAbsoluteURL(n){return n.indexOf("//")===0||/^[0-9a-z]+\:/i.test(n)}function normalizeTileHeader(n,t,e){var r;if(n.content){var o=(r=n.content.uri)!==null&&r!==void 0?r:n.content.url;typeof o=="string"&&!isAbsoluteURL(o)&&(n.content.uri=normalizeURL(pathJoin(t,o)))}if(n.transform){for(var s=!1,u=0;u<16;u++){var l=n.transform[u];if(typeof l!="number"||isNaN(l)||!isFinite(l)){s=!0;break}}if(n.transform[15]===0&&(s=!0),s)throw new Error("Invalid Tile Transform: "+JSON.stringify(n.transform))}if(n.children)for(var c=0,f=n.children;c<f.length;c++){var d=f[c];normalizeTileHeader(d,t)}return n}function normalizeTilesetHeader(n,t){if(n.asset||(n.asset={}),n.rootMeta||(n.rootMeta={}),n.rootMeta.taskParameters||(n.rootMeta.taskParameters={}),n.asset.overview){var e=n.asset.overview;isAbsoluteURL(e.imageFile)||(e.imageFile=normalizeURL(pathJoin(t,e.imageFile))),isAbsoluteURL(e.worldFile)||(e.worldFile=normalizeURL(pathJoin(t,e.worldFile)))}if(n.asset.trajectories)for(var r=0;r<n.asset.trajectories.list.length;r++){var o=n.asset.trajectories.list[r];o.file=normalizeURL(pathJoin(t,o.file))}return normalizeTileHeader(n.root,t),n}function initTextures(n,t,e){for(var r,o,s=Promise.resolve(),u=n.slice(),l=function(){for(var c=[],f=0,d=void 0;d=u.shift();){c.push(d);var p=((r=d.image)===null||r===void 0?void 0:r.width)*((o=d.image)===null||o===void 0?void 0:o.height);if(!isNaN(p)&&isFinite(p)&&(f+=p),f>=e)break}s=s.then(function(){return new Promise(function(v){AnimationFrameLoop.shared.add(function(){for(var g=0,h=c;g<h.length;g++){var m=h[g];t.initTexture(m)}v()},!0)})}).catch(function(){})};u.length>0;)l();return s}function appendSearch(n,t){if(t===void 0&&(t=""),(t[0]==="?"||t[0]==="&")&&(t=t.slice(1)),!t)return n;var e=n.indexOf("#"),r="";return e>=0&&(r=n.slice(e),n=n.slice(0,e)),(n[n.length-1]==="?"||n[n.length-1]==="&")&&(n=n.slice(0,-1)),n.indexOf("?")>=0?"".concat(n,"&").concat(t).concat(r):"".concat(n,"?").concat(t).concat(r)}var SIZEOF_UINT32$1=4;function parseHeader$1(n,t,e){var r=new DataView(t);if(n.magic=r.getUint32(e,!0),e+=SIZEOF_UINT32$1,n.version=r.getUint32(e,!0),e+=SIZEOF_UINT32$1,n.byteLength=r.getUint32(e,!0),e+=SIZEOF_UINT32$1,n.version!==1)throw new Error("3D Tile Version ".concat(n.version," not supported"));return e}var _a$4,GL_TYPE;(function(n){n[n.BYTE=5120]="BYTE",n[n.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",n[n.SHORT=5122]="SHORT",n[n.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",n[n.INT=5124]="INT",n[n.UNSIGNED_INT=5125]="UNSIGNED_INT",n[n.FLOAT=5126]="FLOAT",n[n.DOUBLE=5130]="DOUBLE"})(GL_TYPE||(GL_TYPE={}));var GL_TYPE_TO_ARRAY_TYPE=(_a$4={},_a$4[GL_TYPE.DOUBLE]=Float64Array,_a$4[GL_TYPE.FLOAT]=Float32Array,_a$4[GL_TYPE.UNSIGNED_SHORT]=Uint16Array,_a$4[GL_TYPE.UNSIGNED_INT]=Uint32Array,_a$4[GL_TYPE.UNSIGNED_BYTE]=Uint8Array,_a$4[GL_TYPE.BYTE]=Int8Array,_a$4[GL_TYPE.SHORT]=Int16Array,_a$4[GL_TYPE.INT]=Int32Array,_a$4),NAME_TO_GL_TYPE={DOUBLE:GL_TYPE.DOUBLE,FLOAT:GL_TYPE.FLOAT,UNSIGNED_SHORT:GL_TYPE.UNSIGNED_SHORT,UNSIGNED_INT:GL_TYPE.UNSIGNED_INT,UNSIGNED_BYTE:GL_TYPE.UNSIGNED_BYTE,BYTE:GL_TYPE.BYTE,SHORT:GL_TYPE.SHORT,INT:GL_TYPE.INT};function getArrayType(n){var t=GL_TYPE_TO_ARRAY_TYPE[n];if(!t)throw new Error("Failed to convert GL type");return t}function getByteSize(n){var t=getArrayType(n);return t.BYTES_PER_ELEMENT}function createTypedArray(n,t,e,r){e===void 0&&(e=0);var o=getArrayType(n);if(e%getByteSize(n)!==0){var s=r?t.slice(e,e+r*getByteSize(n)):t.slice(e);return new o(s)}else return new o(t,e,r!=null?r:(t.byteLength-e)/getByteSize(n))}function glTypeFromName(n){var t=NAME_TO_GL_TYPE[n];if(!t)throw new Error("Failed to convert GL type");return t}var FeatureTable=function(){function n(t,e){this.featuresLength=0,this.cachedTypedArrays={},this.json=t,this.buffer=e;var r=this.getGlobalProperty("POINTS_LENGTH",GL_TYPE.UNSIGNED_INT,1);r&&r.length&&(this.featuresLength=r[0])}return n.prototype.getExtension=function(t){return this.json.extensions&&this.json.extensions[t]},n.prototype.hasProperty=function(t){return!!this.json[t]},n.prototype.getGlobalProperty=function(t,e,r){var o=this.json[t];if(typeof o=="number"){var s=getArrayType(e);return new s([o])}else if(Array.isArray(o)){var s=getArrayType(e);return new s(o)}else if(o&&Number.isFinite(o.byteOffset))return this.getTypedArrayFromBinary(t,e,r,1,o.byteOffset);return null},n.prototype.getPropertyArray=function(t,e,r){var o=this.json[t];return o&&Number.isFinite(o.byteOffset)?("componentType"in o&&(e=glTypeFromName(o.componentType)),this.getTypedArrayFromBinary(t,e,r,this.featuresLength,o.byteOffset)):this.getTypedArrayFromArray(t,e,o)},n.prototype.getProperty=function(t,e,r,o,s){var u=this.json[t];if(!u)return null;var l=this.getPropertyArray(t,e,r);if(r===1)return s[0]=l[o],s;for(var c=0;c<r;++c)s[c]=l[r*o+c];return s},n.prototype.getTypedArrayFromBinary=function(t,e,r,o,s){var u=this.cachedTypedArrays,l=u[t];return l||(l=createTypedArray(e,this.buffer.buffer,this.buffer.byteOffset+s,o*r),u[t]=l),l},n.prototype.getTypedArrayFromArray=function(t,e,r){var o=this.cachedTypedArrays,s=o[t];return s||(s=createTypedArray(e,r),o[t]=s),s},n}(),SIZEOF_UINT32=4,DEPRECATION_WARNING="b3dm tile in legacy format.";function getStringFromArrayBuffer(n,t,e){var r=new TextDecoder("utf8"),o=new Uint8Array(n,t,e),s=r.decode(o);return s}function parseTable(n,t,e){return e=parseTablesHeader(n,t,e),e=parseFeatureTable(n,t,e),e=parseBatchTable(n,t,e),e}function parseTablesHeader(n,t,e){var r=new DataView(t),o=0;n.header=n.header||{};var s=r.getUint32(e,!0);e+=SIZEOF_UINT32;var u=r.getUint32(e,!0);e+=SIZEOF_UINT32;var l=r.getUint32(e,!0);e+=SIZEOF_UINT32;var c=r.getUint32(e,!0);return e+=SIZEOF_UINT32,l>=570425344?(e-=SIZEOF_UINT32*2,o=s,l=u,c=0,s=0,u=0,console.warn(DEPRECATION_WARNING)):c>=570425344&&(e-=SIZEOF_UINT32,o=l,l=s,c=u,s=0,u=0,console.warn(DEPRECATION_WARNING)),n.header.featureTableJsonByteLength=s,n.header.featureTableBinaryByteLength=u,n.header.batchTableJsonByteLength=l,n.header.batchTableBinaryByteLength=c,n.header.batchLength=o,e}function parseFeatureTable(n,t,e){var r=n.header||{},o=r.featureTableJsonByteLength,s=r.featureTableBinaryByteLength,u=r.batchLength;if(n.featureTableJson={BATCH_LENGTH:u||0},o&&o>0){var l=getStringFromArrayBuffer(t,e,o);n.featureTableJson=JSON.parse(l)}e+=o||0,n.featureTableBinary=new Uint8Array(t,e,s),e+=s||0,n.rtcCenter=[0,0,0];var c=new FeatureTable(n.featureTableJson,n.featureTableBinary);if(Array.isArray(c.json.RTC_CENTER)){var f=c.json.RTC_CENTER;n.rtcCenter[0]=f[0],n.rtcCenter[1]=f[1],n.rtcCenter[2]=f[2]}else{var f=c.getGlobalProperty("RTC_CENTER",GL_TYPE.FLOAT,3);f&&(n.rtcCenter[0]=f[0],n.rtcCenter[1]=f[1],n.rtcCenter[2]=f[2])}return e}function parseBatchTable(n,t,e){var r=n.header||{},o=r.batchTableJsonByteLength,s=r.batchTableBinaryByteLength;if(o&&o>0){var u=getStringFromArrayBuffer(t,e,o);n.batchTableJson=JSON.parse(u),e+=o,s&&s>0&&(n.batchTableBinary=new Uint8Array(t,e,s),n.batchTableBinary=new Uint8Array(n.batchTableBinary),e+=s)}return e}function sliceArrayBuffer(n,t,e){var r=e!==void 0?new Uint8Array(n).subarray(t,t+e):new Uint8Array(n).subarray(t),o=new Uint8Array(r);return o.buffer}function parseGlTFArrayBuffer(n,t,e){var r=n.byteLength-e;if(r===0)throw new Error("glTF byte length must be greater than 0.");return e%4!==0&&console.warn("".concat(n.type,": embedded glb is not aligned to a 4-byte boundary.")),n.gltfArrayBuffer=sliceArrayBuffer(t,e,r),n.byteLength}function decodeText(n){if(typeof TextDecoder!="undefined")return new TextDecoder().decode(n);for(var t="",e=0,r=n.length;e<r;e++)t+=String.fromCharCode(n[e]);try{return decodeURIComponent(escape(t))}catch(o){return t}}var WEBGL_CONSTANTS={FLOAT:5126,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,LINEAR:9729,REPEAT:10497,SAMPLER_2D:35678,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123},WEBGL_COMPONENT_TYPES={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},WEBGL_FILTERS={9728:THREE__namespace.NearestFilter,9729:THREE__namespace.LinearFilter,9984:THREE__namespace.NearestMipmapNearestFilter,9985:THREE__namespace.LinearMipmapNearestFilter,9986:THREE__namespace.NearestMipmapLinearFilter,9987:THREE__namespace.LinearMipmapLinearFilter},WEBGL_WRAPPINGS={33071:THREE__namespace.ClampToEdgeWrapping,33648:THREE__namespace.MirroredRepeatWrapping,10497:THREE__namespace.RepeatWrapping},WEBGL_TYPE_SIZES={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},ATTRIBUTES={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv2",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},PATH_PROPERTIES={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},INTERPOLATION={CUBICSPLINE:void 0,LINEAR:THREE__namespace.InterpolateLinear,STEP:THREE__namespace.InterpolateDiscrete},ALPHA_MODES={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function values(n){var t=[];for(var e in n)t.push(n[e]);return t}function composeDsiposeSet(n){var t=Array.from(n);return function(){for(var e=0,r=t;e<r.length;e++){var o=r[e];typeof o.dispose=="function"&&o.dispose(),typeof o.close=="function"&&o.close()}}}var Parser=function(){function n(t,e,r){this.json=t,this.extensions=e,this.options=r,this.cache=new Map,this.disposeSet=new Set,this.textureSet=new Set,this.nodeNamesUsed={}}return n.prototype.dispose=function(){this.cache.clear(),this.disposeSet.forEach(function(t){typeof t.dispose=="function"&&t.dispose(),typeof t.close=="function"&&t.close()}),this.disposeSet.clear(),this.textureSet.clear(),this.extensions={},this.json={asset:{version:"unknown"}}},n.prototype.markDefs=function(){for(var t=this.json.nodes||[],e=this.json.skins||[],r=this.json.meshes||[],o=0,s=e.length;o<s;o++)for(var u=e[o].joints,l=0,c=u.length;l<c;l++)t[u[l]].isBone=!0;for(var f=0,d=t.length;f<d;f++){var p=t[f];p.mesh!==void 0&&p.skin!==void 0&&(r[p.mesh].isSkinnedMesh=!0)}},n.prototype.parse=function(){var t=this,e=this.json,r=this.extensions;this.markDefs();for(var o=0,s=values(r);o<s.length;o++){var u=s[o];u.markDefs(this)}return Promise.all(values(r).map(function(l){return l.prepare(t)})).then(function(){var l,c,f;return Promise.all([Promise.all(((l=e.scenes)!==null&&l!==void 0?l:[]).map(function(d,p){return t.loadScene(p)})),Promise.all(((c=e.animations)!==null&&c!==void 0?c:[]).map(function(d,p){return t.loadAnimation(p)})),Promise.all(((f=e.cameras)!==null&&f!==void 0?f:[]).map(function(d,p){return t.loadCamera(p)}))])}).then(function(l){var c=l[0],f=l[1],d=l[2],p={json:e,scene:c[e.scene||0],scenes:c,animations:f,cameras:d,textures:[],dispose:noop$1};return p}).then(function(l){return Promise.all(values(r).map(function(c){return c.emitResult(l,t)})).then(function(){return l})}).then(function(l){var c=Array.from(t.textureSet),f=composeDsiposeSet(t.disposeSet);return Object.assign(l,{textures:c,dispose:f}),t.textureSet.clear(),t.disposeSet.clear(),t.dispose(),l})},n.prototype.loadCamera=function(t){var e="camera:"+t,r=this.cache.get(e);if(r)return r;for(var o=null,s=0,u=values(this.extensions);s<u.length;s++){var l=u[s];if(o=l.loadCamera(t,this),o)break}if(!o){var c=void 0,f=this.json.cameras[t],d=f[f.type];d?f.type==="perspective"?c=new THREE__namespace.PerspectiveCamera(THREE__namespace.MathUtils.radToDeg(d.yfov),d.aspectRatio||1,d.znear||1,d.zfar||2e6):f.type==="orthographic"?c=new THREE__namespace.OrthographicCamera(-d.xmag,d.xmag,d.ymag,-d.ymag,d.znear,d.zfar):(console.warn("glTF: Invalid camera type ".concat(f.type,".")),c=new THREE__namespace.Camera):(console.warn("glTF: Missing camera parameters."),c=new THREE__namespace.Camera),f.name&&(c.name=this.createUniqueName(f.name)),o=Promise.resolve(c)}return this.cache.set(e,o),o},n.prototype.loadSkin=function(t){var e="animation:"+t,r=this.cache.get(e);if(r)return r;var o,s=this.json.skins[t],u={joints:s.joints};return s.inverseBindMatrices===void 0?o=Promise.resolve(u):o=this.loadAccessor(s.inverseBindMatrices).then(function(l){return l&&(u.inverseBindMatrices=l),u}),this.cache.set(e,o),o},n.prototype.loadAnimation=function(t){var e="animation:"+t,r=this.cache.get(e);if(r)return r;for(var o=null,s=0,u=values(this.extensions);s<u.length;s++){var l=u[s];if(o=l.loadAnimation(t,this),o)break}if(!o){for(var c=this.json,f=c.animations[t],d=[],p=[],v=[],g=[],h=[],m=0,y=f.channels.length;m<y;m++){var A=f.channels[m],E=f.samplers[A.sampler],b=A.target,T=b.node!==void 0?b.node:b.id,_=f.parameters!==void 0?f.parameters[E.input]:E.input,R=f.parameters!==void 0?f.parameters[E.output]:E.output;d.push(this.loadNode(T)),p.push(this.loadAccessor(_)),v.push(this.loadAccessor(R)),g.push(E),h.push(b)}o=Promise.all([Promise.all(d),Promise.all(p),Promise.all(v),Promise.all(g),Promise.all(h)]).then(function(S){for(var M=S[0],B=S[1],H=S[2],w=S[3],C=S[4],L=[],I=function(D,U){var Q=M[D],q=B[D],G=H[D],J=w[D],X=C[D];if(Q===void 0)return"continue";Q.updateMatrix(),Q.matrixAutoUpdate=!0;var W=void 0;switch(PATH_PROPERTIES[X.path]){case PATH_PROPERTIES.weights:W=THREE__namespace.NumberKeyframeTrack;break;case PATH_PROPERTIES.rotation:W=THREE__namespace.QuaternionKeyframeTrack;break;case PATH_PROPERTIES.position:case PATH_PROPERTIES.scale:default:W=THREE__namespace.VectorKeyframeTrack;break}var j=Q.name?Q.name:Q.uuid,te=J.interpolation!==void 0?INTERPOLATION[J.interpolation]:THREE__namespace.InterpolateLinear,$=[];PATH_PROPERTIES[X.path]===PATH_PROPERTIES.weights?Q.traverse(function(fe){fe.morphTargetInfluences&&$.push(fe.name?fe.name:fe.uuid)}):$.push(j);var ne=G.array;if(G.normalized){for(var ie=getNormalizedComponentScale(ne.constructor),oe=new Float32Array(ne.length),Z=0,de=ne.length;Z<de;Z++)oe[Z]=ne[Z]*ie;ne=oe}for(var Z=0,de=$.length;Z<de;Z++){var he=new W($[Z]+"."+PATH_PROPERTIES[X.path],q.array,ne,te);L.push(he)}},F=0,k=M.length;F<k;F++)I(F);var N=f.name?f.name:"animation_"+t;return new THREE__namespace.AnimationClip(N,void 0,L)})}return this.cache.set(e,o),o},n.prototype.loadBuffer=function(t){var e=this.json.buffers[t];if(e.type&&e.type!=="arraybuffer")throw new Error("glTF: "+e.type+" buffer type is not supported.");var r="buffer:"+t,o=this.cache.get(r);if(o)return o;for(var s=null,u=0,l=values(this.extensions);u<l.length;u++){var c=l[u];if(s=c.loadBuffer(t,this),s)break}if(!s){var f=this.json.buffers[t];s=this.options.fetcher.ajax(this.resolveResouce(f.uri),{responseType:"arraybuffer"}).then(function(d){return d.body})}return this.cache.set(r,s),s},n.prototype.loadBufferView=function(t){var e="bufferView:"+t,r=this.cache.get(e);if(r)return r;for(var o=null,s=0,u=values(this.extensions);s<u.length;s++){var l=u[s];if(o=l.loadBufferView(t,this),o)break}if(!o){var c=this.json.bufferViews[t];o=this.loadBuffer(c.buffer).then(function(f){var d=c.byteLength||0,p=c.byteOffset||0;return f.slice(p,p+d)})}return this.cache.set(e,o),o},n.prototype.loadAccessor=function(t){var e=this,r="accessor:"+t,o=this.cache.get(r);if(o)return o;var s=null;if(!s){var u=this.json.accessors[t];if(u.bufferView===void 0&&u.sparse===void 0)s=Promise.resolve(null);else{var l=[];u.bufferView!==void 0?l.push(this.loadBufferView(u.bufferView)):l.push(Promise.resolve(null)),u.sparse!==void 0&&(l.push(this.loadBufferView(u.sparse.indices.bufferView)),l.push(this.loadBufferView(u.sparse.values.bufferView))),s=Promise.all(l).then(function(c){var f=c[0],d=WEBGL_TYPE_SIZES[u.type],p=WEBGL_COMPONENT_TYPES[u.componentType],v=p.BYTES_PER_ELEMENT,g=v*d,h=u.byteOffset||0,m=u.bufferView!==void 0?e.json.bufferViews[u.bufferView].byteStride:void 0,y=u.normalized===!0,A,E;if(m&&m!==g){var b=Math.floor(h/m),T="InterleavedBuffer:"+u.bufferView+":"+u.componentType+":"+b+":"+u.count,_=e.cache.get(T);_||(A=new p(f,b*m,u.count*m/v),_=new THREE__namespace.InterleavedBuffer(A,m/v),e.cache.set(T,_)),E=new THREE__namespace.InterleavedBufferAttribute(_,d,h%m/v,y)}else f===null?A=new p(u.count*d):A=new p(f,h,u.count*d),E=new THREE__namespace.BufferAttribute(A,d,y);if(u.sparse!==void 0){var R=WEBGL_TYPE_SIZES.SCALAR,S=WEBGL_COMPONENT_TYPES[u.sparse.indices.componentType],M=u.sparse.indices.byteOffset||0,B=u.sparse.values.byteOffset||0,H=new S(c[1],M,u.sparse.count*R),w=new p(c[2],B,u.sparse.count*d);f!==null&&(E=new THREE__namespace.BufferAttribute(E.array.slice(),E.itemSize,E.normalized));for(var C=0,L=H.length;C<L;C++){var I=H[C];if(E.setX(I,w[C*d]),d>=2&&E.setY(I,w[C*d+1]),d>=3&&E.setZ(I,w[C*d+2]),d>=4&&E.setW(I,w[C*d+3]),d>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return E})}}return this.cache.set(r,s),s},n.prototype.createPrimitiveKey=function(t){for(var e=0,r=values(this.extensions);e<r.length;e++){var o=r[e],s=o.createPrimitiveKey(t,this);if(s)return s}for(var u="",l=Object.keys(t.attributes).sort(),c=0,f=l.length;c<f;c++)u+=l[c]+":"+t.attributes[l[c]]+";";return t.indices+":"+u+":"+t.mode},n.prototype.loadGeometry=function(t){for(var e=this,r=null,o=0,s=values(this.extensions);o<s.length;o++){var u=s[o];if(r=u.loadGeometry(t,this),r)break}return r||(r=this.addGeometryPrimitiveAttributes(new THREE__namespace.BufferGeometry,t)),r=r.then(function(l){return e.disposeSet.add(l),l}),r},n.prototype.loadImage=function(t){for(var e=this,r=null,o=0,s=values(this.extensions);o<s.length;o++){var u=s[o];if(r=u.loadImage(t,this),r)break}if(!r){var l=this.json.images[t];if(l.bufferView!==void 0){var c=this.json.bufferViews[l.bufferView];r=this.loadBuffer(c.buffer).then(function(d){var p=c.byteOffset||0,v=c.byteLength||0,g=new Uint8Array(d,p,v),h=new Blob([g],{type:l.mimeType});return createImageBitmapLike(h)})}else if(l.uri){var f=this.resolveResouce(l.uri);r=this.options.fetcher.loadImage(f,{},void 0,void 0,void 0,createImageBitmapLikeImage()).then(function(d){return d.body})}else throw new Error("glTF: Invalid image defs.")}return r=r.then(function(d){return e.disposeSet.add(d),d}),r},n.prototype.loadMaterialAsMeshStandardMaterial=function(t){var e=this,r=[],o=new THREE__namespace.MeshStandardMaterial;if(o.color=new THREE__namespace.Color(1,1,1),o.opacity=1,Object.keys(t.attributes).filter(function(d){return ATTRIBUTES[d]==="color"}).length>0&&(o.vertexColors=!0),Object.keys(t.attributes).filter(function(d){return ATTRIBUTES[d]==="normal"}).length===0&&(o.flatShading=!0),Object.keys(t.attributes).filter(function(d){return ATTRIBUTES[d]==="tangent"}).length===0&&(o.normalScale&&(o.normalScale.y*=-1),o.clearcoatNormalScale&&(o.clearcoatNormalScale.y*=-1)),t.material!==void 0){var s=this.json.materials[t.material];s.name&&(o.name=s.name);var u=s.pbrMetallicRoughness||{};if(Array.isArray(u.baseColorFactor)){var l=u.baseColorFactor;o.color.fromArray(l),o.opacity=l[3]}u.baseColorTexture!==void 0&&r.push(this.createMaterialTexture(u.baseColorTexture).then(function(d){d.encoding=THREE__namespace.sRGBEncoding,o.map=d,e.disposeSet.add(d)})),o.metalness=u.metallicFactor!==void 0?u.metallicFactor:1,o.roughness=u.roughnessFactor!==void 0?u.roughnessFactor:1,u.metallicRoughnessTexture!==void 0&&r.push(this.createMaterialTexture(u.metallicRoughnessTexture).then(function(d){d.encoding=THREE__namespace.sRGBEncoding,o.metalnessMap=d,o.roughnessMap=d,e.disposeSet.add(d)})),s.doubleSided===!0&&(o.side=THREE__namespace.DoubleSide);var c=s.alphaMode||ALPHA_MODES.OPAQUE;if(c===ALPHA_MODES.BLEND?(o.transparent=!0,o.depthWrite=!1):(o.transparent=!1,c===ALPHA_MODES.MASK&&(o.alphaTest=s.alphaCutoff!==void 0?s.alphaCutoff:.5)),s.normalTexture!==void 0&&(r.push(this.createMaterialTexture(s.normalTexture).then(function(d){o.normalMap=d,e.disposeSet.add(d)})),o.normalScale=new THREE__namespace.Vector2(1,1),s.normalTexture.scale!==void 0)){var f=s.normalTexture.scale;o.normalScale.set(f,f)}s.occlusionTexture!==void 0&&(r.push(this.createMaterialTexture(s.occlusionTexture).then(function(d){o.aoMap=d,e.disposeSet.add(d)})),s.occlusionTexture.strength!==void 0&&(o.aoMapIntensity=s.occlusionTexture.strength)),s.emissiveFactor!==void 0&&(o.emissive=new THREE__namespace.Color().fromArray(s.emissiveFactor)),s.emissiveTexture!==void 0&&r.push(this.createMaterialTexture(s.emissiveTexture).then(function(d){o.emissiveMap=d,e.disposeSet.add(d)}))}return this.disposeSet.add(o),Promise.all(r).then(function(){return o})},n.prototype.loadMaterialAsLineBasicMaterial=function(t){var e=[],r=new THREE__namespace.LineBasicMaterial;if(r.color=new THREE__namespace.Color(1,1,1),r.opacity=1,Object.keys(t.attributes).filter(function(c){return ATTRIBUTES[c]==="color"}).length>0&&(r.vertexColors=!0),Object.keys(t.attributes).filter(function(c){return ATTRIBUTES[c]==="tangent"}).length===0&&(r.normalScale&&(r.normalScale.y*=-1),r.clearcoatNormalScale&&(r.clearcoatNormalScale.y*=-1)),t.material!==void 0){var o=this.json.materials[t.material];o.name&&(r.name=o.name);var s=o.pbrMetallicRoughness||{};if(Array.isArray(s.baseColorFactor)){var u=s.baseColorFactor;r.color.fromArray(u),r.opacity=u[3]}o.doubleSided===!0&&(r.side=THREE__namespace.DoubleSide);var l=o.alphaMode||ALPHA_MODES.OPAQUE;l===ALPHA_MODES.BLEND?(r.transparent=!0,r.depthWrite=!1):(r.transparent=!1,l===ALPHA_MODES.MASK&&(r.alphaTest=o.alphaCutoff!==void 0?o.alphaCutoff:.5))}return this.disposeSet.add(r),Promise.all(e).then(function(){return r})},n.prototype.loadMaterialAsPointsMaterial=function(t){var e=this,r=[],o=new THREE__namespace.PointsMaterial;if(o.color=new THREE__namespace.Color(1,1,1),o.opacity=1,o.sizeAttenuation=!1,Object.keys(t.attributes).filter(function(f){return ATTRIBUTES[f]==="color"}).length>0&&(o.vertexColors=!0),Object.keys(t.attributes).filter(function(f){return ATTRIBUTES[f]==="tangent"}).length===0&&(o.normalScale&&(o.normalScale.y*=-1),o.clearcoatNormalScale&&(o.clearcoatNormalScale.y*=-1)),t.material!==void 0){var s=this.json.materials[t.material];s.name&&(o.name=s.name);var u=s.pbrMetallicRoughness||{};if(Array.isArray(u.baseColorFactor)){var l=u.baseColorFactor;o.color.fromArray(l),o.opacity=l[3]}u.baseColorTexture!==void 0&&r.push(this.createMaterialTexture(u.baseColorTexture).then(function(f){f.encoding=THREE__namespace.sRGBEncoding,o.map=f,e.disposeSet.add(f)})),s.doubleSided===!0&&(o.side=THREE__namespace.DoubleSide);var c=s.alphaMode||ALPHA_MODES.OPAQUE;c===ALPHA_MODES.BLEND?(o.transparent=!0,o.depthWrite=!1):(o.transparent=!1,c===ALPHA_MODES.MASK&&(o.alphaTest=s.alphaCutoff!==void 0?s.alphaCutoff:.5))}return this.disposeSet.add(o),Promise.all(r).then(function(){return o})},n.prototype.loadMaterial=function(t){var e,r=(e=t.mode)!==null&&e!==void 0?e:WEBGL_CONSTANTS.TRIANGLES,o="material:"+this.createPrimitiveKey(t),s=this.cache.get(o);if(s)return s;for(var u=null,l=0,c=values(this.extensions);l<c.length;l++){var f=c[l];if(u=f.loadMaterial(t,this),u)break}if(r===WEBGL_CONSTANTS.TRIANGLES||r===WEBGL_CONSTANTS.TRIANGLE_STRIP||r===WEBGL_CONSTANTS.TRIANGLE_FAN)u=this.loadMaterialAsMeshStandardMaterial(t);else if(r===WEBGL_CONSTANTS.LINES||r===WEBGL_CONSTANTS.LINE_STRIP||r===WEBGL_CONSTANTS.LINE_LOOP)u=this.loadMaterialAsLineBasicMaterial(t);else if(r===WEBGL_CONSTANTS.POINTS)u=this.loadMaterialAsPointsMaterial(t);else throw new Error("glTF: Primitive mode unsupported: "+r);return this.cache.set(o,u),u},n.prototype.loadTexture=function(t){var e=this,r="texture:"+t,o=this.cache.get(r);if(o)return o;for(var s=null,u=0,l=values(this.extensions);u<l.length;u++){var c=l[u];if(s=c.loadTexture(t,this),s)break}if(!s){var f=this.json.textures[t];s=this.loadImage(f.source).then(function(d){var p=new THREE__namespace.Texture(d);p.needsUpdate=!0,p.flipY=!1,f.name&&(p.name=f.name);var v=e.json.samplers||{},g=v[f.sampler]||{};return p.magFilter=WEBGL_FILTERS[g.magFilter]||THREE__namespace.LinearFilter,p.minFilter=WEBGL_FILTERS[g.minFilter]||THREE__namespace.LinearMipmapLinearFilter,p.wrapS=WEBGL_WRAPPINGS[g.wrapS]||THREE__namespace.RepeatWrapping,p.wrapT=WEBGL_WRAPPINGS[g.wrapT]||THREE__namespace.RepeatWrapping,p.onUpdate=function(){d.close()},p})}return s=s.then(function(d){return e.disposeSet.add(d),d}),this.cache.set(r,s),s},n.prototype.loadMesh=function(t){for(var e=this,r=null,o=0,s=values(this.extensions);o<s.length;o++){var u=s[o];if(r=u.loadMesh(t,this),r)break}if(!r){var l=this.json.meshes[t],c=l.primitives,f=Promise.all(c.map(function(p){return e.loadGeometry(p)})),d=Promise.all(c.map(function(p){return e.loadMaterial(p)}));r=Promise.all([f,d]).then(function(p){for(var v=p[0],g=p[1],h=[],m=0;m<c.length;m++){var y=c[m],A=v[m],E=g[m],b=y.mode||WEBGL_CONSTANTS.TRIANGLES,T=void 0;if(b===WEBGL_CONSTANTS.TRIANGLES||b===WEBGL_CONSTANTS.TRIANGLE_STRIP||b===WEBGL_CONSTANTS.TRIANGLE_FAN)if(b===WEBGL_CONSTANTS.TRIANGLE_STRIP?A=e.toGeometryTrianglesDrawMode(A,THREE__namespace.TriangleStripDrawMode):b===WEBGL_CONSTANTS.TRIANGLE_FAN&&(A=e.toGeometryTrianglesDrawMode(A,THREE__namespace.TriangleFanDrawMode)),e.disposeSet.add(A),l.isSkinnedMesh){var _=new THREE__namespace.SkinnedMesh(A,E);A.attributes.skinWeight.normalized||_.normalizeSkinWeights(),T=_}else T=new THREE__namespace.Mesh(A,E);else if(b===WEBGL_CONSTANTS.POINTS)T=new THREE__namespace.Points(A,E);else if(b===WEBGL_CONSTANTS.LINES)T=new THREE__namespace.LineSegments(A,E);else if(b===WEBGL_CONSTANTS.LINE_STRIP)T=new THREE__namespace.Line(A,E);else if(b===WEBGL_CONSTANTS.LINE_LOOP)T=new THREE__namespace.LineLoop(A,E);else throw new Error("glTF: Primitive mode unsupported: "+b);if(Object.keys(A.morphAttributes).length>0){if(l.weights!==void 0)for(var R=0,S=l.weights.length;R<S;R++)T.morphTargetInfluences[R]=l.weights[R];if(l.extras&&Array.isArray(l.extras.targetNames)){var M=l.extras.targetNames;if(T.morphTargetInfluences.length===M.length){T.morphTargetDictionary={};for(var R=0,S=M.length;R<S;R++)T.morphTargetDictionary[M[R]]=R}else console.warn("glTF: Invalid extras.targetNames length. Ignoring names.")}}T.name=e.createUniqueName(l.name||"mesh_"+t),h.push(T)}if(h.length===1)return h[0];for(var B=new THREE__namespace.Group,H=0,w=h;H<w.length;H++){var T=w[H];B.add(T)}return B})}return r},n.prototype.loadNodeAttachments=function(t){for(var e=[],r=0,o=values(this.extensions);r<o.length;r++){var s=o[r],u=s.loadNodeAttachments(t,this);u&&e.push(u)}return e},n.prototype.loadNode=function(t){var e="node:"+t,r=this.cache.get(e);if(r)return r;var o=this.json,s=o.nodes[t],u=s.name?this.createUniqueName(s.name):"",l=[];s.mesh!==void 0&&l.push(this.loadMesh(s.mesh).then(function(v){if(s.weights!==void 0){var g=s.weights;v.traverse(function(h){if(h instanceof THREE__namespace.Mesh||h instanceof THREE__namespace.Line||h instanceof THREE__namespace.Points)for(var m=0,y=g.length;m<y;m++)h.morphTargetInfluences[m]=g[m]})}return v})),s.camera!==void 0&&l.push(this.loadCamera(s.camera));for(var c=this.loadNodeAttachments(t),f=0,d=c;f<d.length;f++){var p=d[f];l.push(p)}return Promise.all(l).then(function(v){var g;if(s.isBone===!0?g=new THREE__namespace.Bone:v.length>1?g=new THREE__namespace.Group:v.length===1?g=v[0]:g=new THREE__namespace.Object3D,g!==v[0])for(var h=0,m=v.length;h<m;h++)g.add(v[h]);if(s.name&&(g.name=u),s.matrix!==void 0){var y=new THREE__namespace.Matrix4;y.fromArray(s.matrix),g.applyMatrix4(y)}else s.translation!==void 0&&g.position.fromArray(s.translation),s.rotation!==void 0&&g.quaternion.fromArray(s.rotation),s.scale!==void 0&&g.scale.fromArray(s.scale);return g})},n.prototype.loadScene=function(t){var e=this.json,r=e.scenes[t],o=new THREE__namespace.Group;r.name&&(o.name=this.createUniqueName(r.name));for(var s=r.nodes||[],u=[],l=0,c=s.length;l<c;l++)u.push(this.buildNodeHierarchy(s[l],o));return Promise.all(u).then(function(){return o})},n.prototype.createMaterialTexture=function(t){var e=this;return this.loadTexture(t.index).then(function(r){for(var o=0,s=values(e.extensions);o<s.length;o++){var u=s[o],l=u.extendTexture(r,t,e);l&&(r=l,e.disposeSet.add(r))}return e.textureSet.add(r),r})},n.prototype.addGeometryPrimitiveAttributes=function(t,e){var r=this,o=e.attributes,s=[],u=function(_){var R=ATTRIBUTES[_]||_.toLowerCase();if(R in t.attributes)return"continue";s.push(l.loadAccessor(o[_]).then(function(S){S&&t.setAttribute(R,S)}))},l=this;for(var c in o)u(c);e.indices!==void 0&&!t.index&&s.push(this.loadAccessor(e.indices).then(function(_){_&&t.setIndex(_)}));var f=new THREE__namespace.Box3;if(o.POSITION!==void 0){var d=this.json.accessors[o.POSITION],p=d.min,v=d.max;if(p!==void 0&&v!==void 0){if(f.set(new THREE__namespace.Vector3(p[0],p[1],p[2]),new THREE__namespace.Vector3(v[0],v[1],v[2])),d.normalized){var g=getNormalizedComponentScale(WEBGL_COMPONENT_TYPES[d.componentType]);f.min.multiplyScalar(g),f.max.multiplyScalar(g)}}else console.warn("glTF: Missing min/max properties for accessor POSITION.")}var h=e.targets;if(h!==void 0){for(var m=new THREE__namespace.Vector3,y=new THREE__namespace.Vector3,A=0,E=h.length;A<E;A++){var b=h[A];if(b.POSITION!==void 0){var d=this.json.accessors[b.POSITION],p=d.min,v=d.max;if(p!==void 0&&v!==void 0){if(y.setX(Math.max(Math.abs(p[0]),Math.abs(v[0]))),y.setY(Math.max(Math.abs(p[1]),Math.abs(v[1]))),y.setZ(Math.max(Math.abs(p[2]),Math.abs(v[2]))),d.normalized){var g=getNormalizedComponentScale(WEBGL_COMPONENT_TYPES[d.componentType]);y.multiplyScalar(g)}m.max(y)}else console.warn("glTF: Missing min/max properties for accessor POSITION.")}}f.expandByVector(m)}t.boundingBox=f;var T=new THREE__namespace.Sphere;return f.getCenter(T.center),T.radius=f.min.distanceTo(f.max)/2,t.boundingSphere=T,Promise.all(s).then(function(){if(t.attributes.uv&&!t.attributes.uv2&&r.options.copyUV2&&t.setAttribute("uv2",t.attributes.uv),e.targets){for(var _=!1,R=!1,S=0,M=e.targets.length;S<M;S++){var B=e.targets[S];if(B.POSITION!==void 0&&(_=!0),B.NORMAL!==void 0&&(R=!0),_&&R)break}if(!_&&!R)return t;var H=[];t.morphTargetsRelative=!0;for(var w=function(C,L){var I=e.targets[C];_?H.push(r.loadAccessor(I.POSITION).then(function(F){F&&(t.morphAttributes.position[C]=F)})):t.morphAttributes.position[C]=t.attributes.position,R?H.push(r.loadAccessor(I.NORMAL).then(function(F){F&&(t.morphAttributes.normal[C]=F)})):t.morphAttributes.normal[C]=t.attributes.normal},S=0,M=e.targets.length;S<M;S++)w(S,M);return Promise.all(H).then(function(){return t})}else return t})},n.prototype.buildNodeHierarchy=function(t,e){var r=this,o=this.json.nodes[t];return this.loadNode(t).then(function(s){if(o.skin===void 0)return s;var u;return r.loadSkin(o.skin).then(function(l){u=l;for(var c=[],f=0,d=u.joints.length;f<d;f++)c.push(r.loadNode(u.joints[f]));return Promise.all(c)}).then(function(l){return s.traverse(function(c){if(c instanceof THREE__namespace.SkinnedMesh){for(var f=[],d=[],p=0,v=l.length;p<v;p++){var g=l[p];if(g instanceof THREE__namespace.Bone){f.push(g);var h=new THREE__namespace.Matrix4;u.inverseBindMatrices!==void 0&&h.fromArray(u.inverseBindMatrices.array,p*16),d.push(h)}else console.warn('glTF: Joint "%s" could not be found.',u.joints[p])}c.bind(new THREE__namespace.Skeleton(f,d),c.matrixWorld)}}),s})}).then(function(s){e.add(s);var u=[];if(o.children)for(var l=o.children,c=0,f=l.length;c<f;c++){var d=l[c];u.push(r.buildNodeHierarchy(d,s))}return Promise.all(u).then(function(){return s})})},n.prototype.createUniqueName=function(t){for(var e=THREE__namespace.PropertyBinding.sanitizeNodeName(t||""),r=e,o=1;this.nodeNamesUsed[r];++o)r=e+"_"+o;return this.nodeNamesUsed[r]=!0,r},n.prototype.resolveResouce=function(t){return pathJoin(this.options.resourcePath,appendSearch(t,this.options.search))},n.prototype.toGeometryTrianglesDrawMode=function(t,e){var r=t.getIndex();if(r===null){var o=[],s=t.getAttribute("position");if(s!==void 0){for(var u=0;u<s.count;u++)o.push(u);t.setIndex(o),r=t.getIndex()}}if(r===null)return console.error("glTF: Undefined position attribute. Processing not possible."),t;var l=r.count-2,c=[];if(e===THREE__namespace.TriangleFanDrawMode)for(var u=1;u<=l;u++)c.push(r.getX(0)),c.push(r.getX(u)),c.push(r.getX(u+1));else for(var u=0;u<l;u++)u%2===0?(c.push(r.getX(u)),c.push(r.getX(u+1)),c.push(r.getX(u+2))):(c.push(r.getX(u+2)),c.push(r.getX(u+1)),c.push(r.getX(u)));c.length/3!==l&&console.error("glTF: Unable to generate correct amount of triangles.");var f=t.clone();return f.setIndex(c),this.disposeSet.add(f),f},n}();function getNormalizedComponentScale(n){switch(n){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("glTF: Unsupported normalized accessor component type.")}}var BaseExtension=function(){function n(){}return n.prototype.markDefs=function(t){},n.prototype.prepare=function(t){},n.prototype.emitResult=function(t,e){},n.prototype.createPrimitiveKey=function(t,e){},n.prototype.extendTexture=function(t,e,r){return null},n.prototype.loadBuffer=function(t,e){return null},n.prototype.loadBufferView=function(t,e){return null},n.prototype.loadImage=function(t,e){return null},n.prototype.loadTexture=function(t,e){return null},n.prototype.loadGeometry=function(t,e){return null},n.prototype.loadMaterial=function(t,e){return null},n.prototype.loadMesh=function(t,e){return null},n.prototype.loadNodeAttachments=function(t,e){return null},n.prototype.loadCamera=function(t,e){return null},n.prototype.loadAnimation=function(t,e){return null},n}(),KHR_binary_glTF=function(n){__extends(t,n);function t(){var e=n.call(this)||this;return e.header={magic:"",version:0,length:0},e.content="",e.body=null,e}return t.getMagic=function(e){return decodeText(new Uint8Array(e.slice(0,4)))},t.prototype.loadGlbBinary=function(e){var r=new DataView(e,0,t.HEADER_LENGTH);if(this.header={magic:t.getMagic(e),version:r.getUint32(4,!0),length:r.getUint32(8,!0)},this.header.magic!==t.HEADER_MAGIC)throw new Error("glTF:KHR_binary_glTF: Unsupported.");if(this.header.version<2)throw new Error("glTF:KHR_binary_glTF: Legacy binary file detected.");for(var o=new DataView(e,t.HEADER_LENGTH),s=0,u=null,l=null;s<o.byteLength;){var c=o.getUint32(s,!0);if(s+=4,c!==0){var f=o.getUint32(s,!0);if(s+=4,f===t.CHUNK_TYPES.JSON){var d=new Uint8Array(e,t.HEADER_LENGTH+s,c);u=decodeText(d)}else if(f===t.CHUNK_TYPES.BIN){var p=t.HEADER_LENGTH+s;l=e.slice(p,p+c)}s+=c}}if(u===null)throw new Error("glTF:KHR_binary_glTF: JSON content not found.");this.content=u,this.body=l},t.prototype.loadBuffer=function(e,r){var o=r.json.buffers[e];return o.uri===void 0&&e===0&&this.body?Promise.resolve(this.body):null},t.prototype.clear=function(){this.body=null,this.content=""},t.HEADER_MAGIC="glTF",t.HEADER_LENGTH=12,t.CHUNK_TYPES={JSON:1313821514,BIN:5130562},t}(BaseExtension),defaultDecoderPath="https://vr-public.realsee-cdn.cn/release/static/image/release/five/resource/draco/1.5.6/",defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"},Draco=function(){function n(){this.decoderPath=defaultDecoderPath,this.decoderConfig={},this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL=""}return n.prototype.setDecoderPath=function(t){this.decoderPath=t},n.prototype.setDecoderConfig=function(t){return this.decoderConfig=t,this},n.prototype.setWorkerLimit=function(t){return this.workerLimit=t,this},n.prototype.decodeDracoFile=function(t,e,r,o){var s={attributeIDs:r||defaultAttributeIDs,attributeTypes:o||defaultAttributeTypes,useUniqueIDs:!!r};this.decodeGeometry(t,s).then(e)},n.prototype.decodeGeometry=function(t,e){var r=this;e===void 0&&(e={attributeIDs:defaultAttributeIDs,attributeTypes:defaultAttributeTypes,useUniqueIDs:!1});for(var o in e.attributeTypes){var s=e.attributeTypes[o];s.BYTES_PER_ELEMENT!==void 0&&(e.attributeTypes[o]=s.name)}var u,l=this.workerNextTaskID++,c=t.byteLength,f=this._getWorker(l,c).then(function(d){return u=d,new Promise(function(p,v){u._callbacks[l]={resolve:p,reject:v},u.postMessage({type:"decode",id:l,taskConfig:e,buffer:t},[t])})}).then(function(d){return r._createGeometry(d.geometry)});return f.catch(function(){return!0}).then(function(){u&&l&&r._releaseTask(u,l)}),f},n.prototype._createGeometry=function(t){var e=new THREE__namespace.BufferGeometry;t.index&&e.setIndex(new THREE__namespace.BufferAttribute(t.index.array,1));for(var r=0;r<t.attributes.length;r++){var o=t.attributes[r],s=o.name,u=o.array,l=o.itemSize,c=!(u instanceof Float32Array||u instanceof Float64Array);e.setAttribute(s,new THREE__namespace.BufferAttribute(u,l,c))}return e},n.prototype._initDecoder=function(){var t=this;if(this.decoderPending)return this.decoderPending;var e=typeof WebAssembly!="object"||this.decoderConfig.type==="js";if(e){var r=ajax(this.decoderPath+"draco_decoder.js",{responseType:"text"}).then(function(s){return s.body});this.decoderPending=r.then(function(s){var u=["/* draco decoder */",s,"","/* worker */",DRACOWorker].join(`
|
|
417
|
+
`,cacheMaterials=[],cameraPX=new THREE__namespace.PerspectiveCamera(90,1,.1,2);cameraPX.up.set(0,-1,0),cameraPX.lookAt(new THREE__namespace.Vector3(1,0,0)),cameraPX.updateMatrix(),cameraPX.matrixAutoUpdate=!1;var cameraNX=new THREE__namespace.PerspectiveCamera(90,1,.1,2);cameraNX.up.set(0,-1,0),cameraNX.lookAt(new THREE__namespace.Vector3(-1,0,0)),cameraNX.updateMatrix(),cameraNX.matrixAutoUpdate=!1;var cameraPY=new THREE__namespace.PerspectiveCamera(90,1,.1,2);cameraPY.up.set(0,0,1),cameraPY.lookAt(new THREE__namespace.Vector3(0,1,0)),cameraPY.updateMatrix(),cameraPY.matrixAutoUpdate=!1;var cameraNY=new THREE__namespace.PerspectiveCamera(90,1,.1,2);cameraNY.up.set(0,0,-1),cameraNY.lookAt(new THREE__namespace.Vector3(0,-1,0)),cameraNY.updateMatrix(),cameraNY.matrixAutoUpdate=!1;var cameraPZ=new THREE__namespace.PerspectiveCamera(90,1,.1,2);cameraPZ.up.set(0,-1,0),cameraPZ.lookAt(new THREE__namespace.Vector3(0,0,1)),cameraPZ.updateMatrix(),cameraPZ.matrixAutoUpdate=!1;var cameraNZ=new THREE__namespace.PerspectiveCamera(90,1,.1,2);cameraNZ.up.set(0,-1,0),cameraNZ.lookAt(new THREE__namespace.Vector3(0,0,-1)),cameraNZ.updateMatrix(),cameraNZ.matrixAutoUpdate=!1;var FACES={front:{camera:cameraPZ,index:4},back:{camera:cameraNZ,index:5},up:{camera:cameraPY,index:2},down:{camera:cameraNY,index:3},left:{camera:cameraNX,index:1},right:{camera:cameraPX,index:0}};function getMaterial(){var n=cacheMaterials.pop();return n||new THREE__namespace.ShaderMaterial({uniforms:{map:{value:null},flipY:{value:0}},vertexShader:PLANE_VERTEX_SHADER,fragmentShader:PLANE_FRAGMENT_SHADER,depthTest:!1,depthWrite:!1,stencilWrite:!1,blending:THREE__namespace.NoBlending,lights:!1,toneMapped:!1,fog:!1})}function releaseMaterial(n){n.uniforms.map.value=null,cacheMaterials.push(n)}function renderTexturesToCubeRenderTarget(n,t,e){var r=new THREE__namespace.Scene;r.matrixAutoUpdate=!1;var o=new THREE__namespace.Group;o.scale.set(1,1,-1),r.add(o);for(var s=[],u=new Set,l=0,c=n;l<c.length;l++){var f=c[l];u.add(f.face);var d=getMaterial();s.push(d),d.uniforms.map.value=f.texture,d.uniforms.flipY.value=f.flipY?1:0;var p=new THREE__namespace.Group,v=new THREE__namespace.Mesh(PLAME_GEOMETRY,d);v.position.set(f.position.x+f.size.x/2-.5,1-(f.position.y+f.size.y/2)-.5,-.5),v.scale.set(f.size.x,f.size.y,1),p.quaternion.copy(QUATERNION[f.face]),p.add(v),o.add(p)}var g=e.autoClear,h=e.sortObjects,m=e.xr.enabled,y=t.texture.generateMipmaps;e.autoClear=!1,e.sortObjects=!1,e.xr.enabled=!1,t.texture.generateMipmaps=!1;var A=e.getRenderTarget(),E=0;u.forEach(function(_){++E===u.size&&(t.texture.generateMipmaps=y),e.setRenderTarget(t,FACES[_].index),e.render(r,FACES[_].camera)}),e.setRenderTarget(A),e.autoClear=g,e.sortObjects=h,e.xr.enabled=m;for(var b=0,T=s;b<T.length;b++){var d=T[b];releaseMaterial(d)}}var canUseNativeImageBitmap=function(){return!1}();function createImageBitmapLikeImage(n){n===void 0&&(n={});var t=Object.assign(document.createElementNS("http://www.w3.org/1999/xhtml","img"),{crossOrigin:"",close:function(){n.onClose&&n.onClose.call(this),this.onerror=this.onload=this.close=noop$1,this.removeAttribute("src")}});return t}function createImageBitmapLike(n){return new Promise(function(t,e){var r=URL.createObjectURL(n),o=createImageBitmapLikeImage({onClose:function(){this.src===r&&URL.revokeObjectURL(r)}});o.onload=function(){o.src===r&&URL.revokeObjectURL(r),o.onload=o.onerror=noop$1,setTimeout(function(){t(o)},10)},o.onerror=function(){var s=o.src;o.onload=o.onerror=noop$1,o.close(),e(new Error("image load error: ".concat(s)))},o.decoding="async",o.src=r})}var canvasPool=[];function createCanvas(n,t){var e=canvasPool.shift();if(e)return e.width=n,e.height=t,e;var r=Object.assign(document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),{close:function(){r.close=noop$1,canvasPool.push(r)}});return r}function poolImageToTexture(n,t){if(t&&(n.width>t.width||n.height>t.height)){var e=createCanvas(Math.min(n.width,t.width),Math.min(n.height,t.height)),r=e.getContext("2d");r.clearRect(0,0,e.width,e.height),r.drawImage(n,0,0,e.width,e.height),n.close();var o=new THREE__namespace.Texture(e);o.needsUpdate=!0,o.flipY=!0;var s=o.dispose;return o.dispose=function(){e.close(),s.call(o),o.dispose=s},o}else{var u=new THREE__namespace.Texture(n);u.needsUpdate=!0,typeof ImageBitmap!="undefined"&&n instanceof ImageBitmap?u.flipY=!1:u.flipY=!0;var l=u.dispose;return u.dispose=function(){n.close(),l.call(u),u.dispose=l},u}}function poolImagesToCubeTexture(n){var t=new THREE__namespace.CubeTexture(n);t.needsUpdate=!0,t.flipY=!1;var e=t.dispose;return t.dispose=function(){for(var r=0,o=n;r<o.length;r++){var s=o[r];s.close()}e.call(t),t.dispose=e},t}var sharedSortVector3$1=new THREE__namespace.Vector3,FACE_ORDER=["right","left","up","down","front","back"],TileCubeTextureTarget=function(){function n(t,e,r,o,s){this.tileTree=e,this.tileSources=r,this.options=o,this.renderer=s,this.name="",this.needsRender=!1,this.maxRequest=n.DEFAULT_MAX_REQUEST,this.disposed=!1,this.loadedCubeNodes=new Set,this.loadingCubeNodes=new Set,this.drawedCubeNodes=new Set,this.baseCubeTexture=null,this._cubeRenderTarget=null,this.prepareToRender=[],this.baseCubeTexture=t}return Object.defineProperty(n.prototype,"cubeRenderTarget",{get:function(){return this._cubeRenderTarget},set:function(t){var e,r,o,s,u,l;if(t===null)throw new Error("cannot set cubeRenderTarget to null.");t.width!==this.options.textureSize&&t.setSize(this.options.textureSize,this.options.textureSize),t.texture.format=(e=this.options.format)!==null&&e!==void 0?e:THREE__namespace.RGBAFormat,t.texture.minFilter=(r=this.options.minFilter)!==null&&r!==void 0?r:THREE__namespace.LinearFilter,t.texture.magFilter=(o=this.options.magFilter)!==null&&o!==void 0?o:THREE__namespace.LinearFilter,t.texture.wrapS=(s=this.options.wrapS)!==null&&s!==void 0?s:THREE__namespace.ClampToEdgeWrapping,t.texture.wrapT=(u=this.options.wrapT)!==null&&u!==void 0?u:THREE__namespace.ClampToEdgeWrapping,t.texture.generateMipmaps=(l=this.options.generateMipmaps)!==null&&l!==void 0?l:!0,this.baseCubeTexture&&(renderCubeTextureToCubeRenderTarget(this.baseCubeTexture,t,this.renderer),this.baseCubeTexture.dispose(),this.baseCubeTexture=null),this._cubeRenderTarget&&renderCubeTextureToCubeRenderTarget(this._cubeRenderTarget.texture,t,this.renderer),this._cubeRenderTarget=t},enumerable:!1,configurable:!0}),n.prototype.requestTile=function(t){var e=this,r,o,s,u,l,c,f=this.tileSources.filter(function(m){return m.level===t.level})[0];if(!f)return this.loadedCubeNodes.add(t),this.prepareToRender.push({node:t,texture:null}),!1;var d=f.size,p=Math.pow(2,t.level)*t.position.y,v=Math.pow(2,t.level)*t.position.x,g="".concat(((s=(o=(r=this.options.imageURL)===null||r===void 0?void 0:r.options)===null||o===void 0?void 0:o.key)!==null&&s!==void 0?s:"pano.0").replace(/^pano/,"pano_tile"),".").concat(t.face,".").concat(t.level,".").concat(p,".").concat(v),h=__assign(__assign({},(l=(u=this.options.imageURL)===null||u===void 0?void 0:u.options)!==null&&l!==void 0?l:{key:"unknown"}),{key:g,size:f.scale>=1?void 0:d*t.size*f.scale,quality:void 0,cut:[d*t.position.x,d*t.position.y,d*t.size,d*t.size]});return this.loadingCubeNodes.add(t),this.options.textureLoader.loadTexture(f[t.face],{imageURL:{transform:(c=this.options.imageURL)===null||c===void 0?void 0:c.transform,options:__assign({},h)},format:THREE__namespace.RGBAFormat,timeout:this.options.timeout,magFilter:this.options.magFilter,minFilter:this.options.minFilter,fetcher:this.options.fetcher}).then(function(m){if(e.disposed){m.body.dispose();return}e.prepareToRender.push({node:t,texture:m.body}),e.loadedCubeNodes.add(t)}).catch(noop$1).then(function(){e.disposed||e.loadingCubeNodes.delete(t)}),!0},n.prototype.update=function(t,e){var r=this;if(!this.disposed){var o=t.planes[5].normal,s=Math.max(this.maxRequest-this.loadingCubeNodes.size,0),u=[];traverseTileCubeNode(this.tileTree,function(m){if(m.level>e||!t.intersectsBox(m.box))return!1;!r.loadedCubeNodes.has(m)&&!r.loadingCubeNodes.has(m)&&u.push(m)}),u.sort(function(m,y){return m.level!==y.level?m.level-y.level:m.box.getCenter(sharedSortVector3$1).angleTo(o)-y.box.getCenter(sharedSortVector3$1).angleTo(o)});for(var l=0,c=u;l<c.length;l++){var f=c[l];if(s<=0)break;var d=this.requestTile(f);d&&s--}if(this.cubeRenderTarget&&this.prepareToRender.length){this.prepareToRender.sort(function(m,y){return m.node.level-y.node.level});for(var p=[],v=0;v<this.prepareToRender.length;v++){var g=this.prepareToRender[v],f=g.node,h=g.texture;(f.parent===null||this.drawedCubeNodes.has(f.parent))&&(this.drawedCubeNodes.add(f),h&&p.push({face:f.face,position:f.position,size:new THREE__namespace.Vector2(f.size,f.size),texture:h,flipY:!h.flipY}),this.prepareToRender.splice(v,1),v--)}p.length&&(renderTexturesToCubeRenderTarget(p,this.cubeRenderTarget,this.renderer),this.needsRender=!0)}}},Object.defineProperty(n.prototype,"tilePending",{get:function(){return this.loadingCubeNodes.size},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"texture",{get:function(){if(!this._cubeRenderTarget)throw new Error("cubeRenderTarget never set.");return this._cubeRenderTarget.texture},enumerable:!1,configurable:!0}),n.prototype.dispose=function(){if(!this.disposed){this.disposed=!0,this.baseCubeTexture&&(this.baseCubeTexture.dispose(),this.baseCubeTexture=null),this.loadingCubeNodes.clear(),this.loadedCubeNodes.clear();for(var t=0,e=this.prepareToRender;t<e.length;t++){var r=e[t];r.texture&&r.texture.dispose()}this.prepareToRender.length=0}},n.DEFAULT_MAX_REQUEST=3,n}(),TextureLoader=function(){function n(){}return n.prototype.loadTexture=function(t,e,r,o,s,u){var l,c,f,d,p,v,g;r===void 0&&(r=noop$1),o===void 0&&(o=noop$1),s===void 0&&(s=noop$1);var h={};typeof e.flipY!="undefined"&&(h.flipY=e.flipY),typeof e.format!="undefined"&&(h.format=e.format),typeof e.encoding!="undefined"&&(h.encoding=e.encoding),h.generateMipmaps=(l=e.generateMipmaps)!==null&&l!==void 0?l:!1,h.minFilter=(c=e.minFilter)!==null&&c!==void 0?c:THREE__namespace.LinearFilter,h.magFilter=(f=e.magFilter)!==null&&f!==void 0?f:THREE__namespace.LinearFilter;var m=(p=(d=e.imageURL)===null||d===void 0?void 0:d.options)!==null&&p!==void 0?p:{key:"unknown"};t=applyImageURLOptions(t,(v=e.imageURL)===null||v===void 0?void 0:v.transform,m);var y=getProtocol(t),A=(g=e.viaAjax)!==null&&g!==void 0?g:canUseNativeImageBitmap,E=isJsonpSource(t),b=/^https?:/.test(y);if(E?A=!0:b||(A=!1),A){var T=null,_="blob";return e.fetcher.ajax(t,{timeout:e.timeout,responseType:_},void 0,void 0,s).then(function(M){return createImageBitmapLike(M.body)}).then(function(M){return poolImageToTexture(M,e.maxSize)}).then(function(M){return Object.assign(M,h),M}).then(function(M){var B={meta:T,body:M};return r(B),B}).catch(function(M){return o(M),Promise.reject(M)})}else{var R=null,S;return Promise.resolve().then(function(){return createImageBitmapLikeImage()}).then(function(M){return S=M,e.fetcher.loadImage(t,{timeout:e.timeout},void 0,void 0,s,M)}).then(function(M){return R=M.meta,poolImageToTexture(M.body,e.maxSize)}).then(function(M){return Object.assign(M,h),M}).then(function(M){var B={meta:R,body:M};return r(B),B}).catch(function(M){return S&&S.close(),o(M),Promise.reject(M)})}},n.prototype.loadCubeTexture=function(t,e,r,o,s,u){var l,c,f,d,p,v,g;r===void 0&&(r=noop$1),o===void 0&&(o=noop$1),s===void 0&&(s=noop$1);var h={};typeof e.format!="undefined"&&(h.format=e.format),h.generateMipmaps=(l=e.generateMipmaps)!==null&&l!==void 0?l:!1,h.minFilter=(c=e.minFilter)!==null&&c!==void 0?c:THREE__namespace.LinearFilter,h.magFilter=(f=e.magFilter)!==null&&f!==void 0?f:THREE__namespace.LinearFilter;for(var m=[t[FACE_ORDER[0]],t[FACE_ORDER[1]],t[FACE_ORDER[2]],t[FACE_ORDER[3]],t[FACE_ORDER[4]],t[FACE_ORDER[5]]],y=[],A=[0,0,0,0,0,0],E=[],b=function(_){var R=(p=(d=e.imageURL)===null||d===void 0?void 0:d.options)!==null&&p!==void 0?p:{key:"unknown"},S=applyImageURLOptions(m[_],(v=e.imageURL)===null||v===void 0?void 0:v.transform,__assign(__assign({},R),{key:R.key+"."+FACE_ORDER[_]})),M=getProtocol(S),B=function(k){A[_]=k,s(A.reduce(function(N,D){return N+D},0)/6)},H=(g=e.viaAjax)!==null&&g!==void 0?g:!1,w=/^https?:$/.test(M),C=isJsonpSource(S);if(C?H=!0:w||(H=!1),H){var L="blob",I=e.fetcher.ajax(S,{timeout:e.timeout,responseType:L},void 0,void 0,B).then(function(k){return E[_]=k.meta,createImageBitmapLike(k.body)});y.push(I)}else{var F,I=Promise.resolve().then(function(){return createImageBitmapLikeImage()}).then(function(N){return F=N,e.fetcher.loadImage(S,{timeout:e.timeout},void 0,void 0,B,N)}).then(function(N){return E[_]=N.meta,N.body}).catch(function(N){return F&&F.close(),Promise.reject(N)});y.push(I)}},T=0;T<6;T++)b(T);return Promise.all(y).then(function(_){return poolImagesToCubeTexture(_)}).then(function(_){return Object.assign(_,__assign({encoding:THREE__namespace.sRGBEncoding},h)),_}).then(function(_){var R={body:_,meta:E};return r(R),R}).catch(function(_){for(var R=0,S=y;R<S.length;R++){var M=S[R];M.then(function(B){return B.close()}).catch(noop$1)}return o(_),Promise.reject(_)})},n.prototype.loadTiledCubeTexture=function(t,e,r,o,s,u,l){var c=this;return o===void 0&&(o=noop$1),s===void 0&&(s=noop$1),u===void 0&&(u=noop$1),new Promise(function(f,d){var p,v;c.loadCubeTexture(t,{imageURL:{transform:(p=r.imageURL)===null||p===void 0?void 0:p.transform,options:(v=r.imageURL)===null||v===void 0?void 0:v.options},format:THREE__namespace.RGBAFormat,viaAjax:r.viaAjax,timeout:r.timeout,fetcher:r.fetcher,magFilter:r.magFilter,minFilter:r.minFilter,generateMipmaps:r.generateMipmaps},function(g){var h,m=g.meta,y=g.body,A=(h=r.tileMaxLevel)!==null&&h!==void 0?h:2,E=Math.max(1024*A,512),b=createTileCubeTree(A),T=new TileCubeTextureTarget(y,b,e,{textureSize:E,textureLoader:c,imageURL:r.imageURL,magFilter:r.magFilter,minFilter:r.minFilter,generateMipmaps:r.generateMipmaps,timeout:r.timeout,fetcher:r.fetcher},l),_={meta:m,body:T};o(_),f(_)},function(g){s(g),d(g)},u,l).catch(noop$1)})},n}();const meshNoneVertexShader=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=113,o=126,s=0,u="";return t[s].split(u).map(function(l){return l.charCodeAt(s)>o?l:String.fromCharCode((l.charCodeAt(s)+r)%o)}).join(u)}("n\bv{t-rpA-d|yq]|vv|{Hn\bv{t-rp@-PnzrnQvrpv|{H0v{pyqr-Ip|zz|{K0v{pyqr-Iz|}untrl}nlrr\x07K0v{pyqr-Ixv{{v{tl}nlrr\x07K0v{pyqr-Iy|tqr}uosl}nlrr\x07K0v{pyqr-Ipyv}}v{tl}yn{rl}nlrr\x07KZNV[lORS\\_R|vq-znv{56-\n--ZNV[l`aN_a--0v{pyqr-Ixv{onrlrr\x07K--0v{pyqr-Iortv{lrr\x07K--0v{pyqr-Iz|}untrlrr\x07K--0v{pyqr-Ixv{{v{tlrr\x07K--0v{pyqr-I}|wrplrr\x07K--0v{pyqr-Iy|tqr}uoslrr\x07K--0v{pyqr-Ipyv}}v{tl}yn{rlrr\x07K--d|yq]|vv|{-J-rpA5n{s|zrq9->;=6H--0vsqrs-b`RlV[`aN[PV[T----d|yq]|vv|{-J-v{n{prZnv\x07-7-d|yq]|vv|{H--0r{qvs--d|yq]|vv|{-J-z|qryZnv\x07-7-d|yq]|vv|{H--zn@-pnzrn_|nv|{Znv\x07-J-zn@5vrZnv\x07h=jh=j9-vrZnv\x07h>jh=j9-vrZnv\x07h?jh=j9-vrZnv\x07h=jh>j9-vrZnv\x07h>jh>j9-vrZnv\x07h?jh>j9-vrZnv\x07h=jh?j9-vrZnv\x07h>jh?j9-vrZnv\x07h?jh?j6H--PnzrnQvrpv|{-J-{|znyv r5pnzrn_|nv|{Znv\x07-7-rp@5=;=9-=;=9-:>;=66H--0v{pyqr-I|yq}|lrr\x07K--0v{pyqr-Is|tlrr\x07K--ZNV[lR[Q\f"),meshNoneFragmentShader=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=113,o=126,s=0,u="";return t[s].split(u).map(function(l){return l.charCodeAt(s)>o?l:String.fromCharCode((l.charCodeAt(s)+r)%o)}).join(u)}("0qrsv{r-OYNPXlP\\Y\\_-rpA5=;=EC9-=;>=C9-=;>AF9->;=6{vs|z-nz}yrPor-}n{|=lzn}H{vs|z-znA-}n{|=lznv\x07H{vs|z-sy|n-}n{|=l ||zH0vs-qrsv{rq5b`RlYbZV[N[PR6--{vs|z-nz}yrPor-}n{|=lyzv{n{prZn}H0r{qvs{vs|z-nz}yrPor-}n{|>lzn}H{vs|z-znA-}n{|>lznv\x07H{vs|z-sy|n-}n{|>l ||zH0vs-qrsv{rq5b`RlYbZV[N[PR6--{vs|z-nz}yrPor-}n{|>lyzv{n{prZn}H0r{qvs{vs|z-sy|n-z|qryNy}unH{vs|z-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-qrsv{rq5b`RlYbZV[N[PR6----}n{|=P|y|;n-J->;=-:-r\x07rPor5}n{|=lyzv{n{prZn}9-}n{|=a|crr\x076;H----}n{|>P|y|;n-J->;=-:-r\x07rPor5}n{|>lyzv{n{prZn}9-}n{|>a|crr\x076;H--0r{qvs--0vs-qrsv{rq5b`RlOYNPXla_N[`VaV\\[6----sy|n-oynpx]|tr-J-np|5:?;=-7-}|tr-8->;=6H----}n{|P|y|-J-zv\x075}n{|=P|y|9-OYNPXlP\\Y\\_9-zv{5>;=9-oynpx]|tr66H----}n{|P|y|-J-zv\x075}n{|P|y|9-}n{|>P|y|9-zn\x075=;=9-oynpx]|tr-:-]V-8->;=66H--0ryvs-qrsv{rq5b`Rl`]_RNQla_N[`VaV\\[6----rp?-prr{Pr{rP||q-J-r|yv|{-7-}v\x07ry_nv|-<-?;=H----sy|n-n{vv|{_nqv-J-qvn{pr5rp?5=;=9-=;=69-prr{Pr{rP||q6-7->;?H----sy|n-n{vv|{]|tr-J--qvn{pr5tylSntP||q;\x07\b9-prr{Pr{rP||q6-<-n{vv|{_nqvH----}n{|P|y|-J-zv\x075}n{|=P|y|9-}n{|>P|y|9-z||ur}5=;=9-=;?9-}|tr-:-n{vv|{]|tr66H--0ryr----}n{|P|y|-J-zv\x075}n{|=P|y|9-}n{|>P|y|9-}|tr6H--0r{qvs--tylSntP|y|-J-zv\x075}n{|P|y|9-rpA5}n{|P|y|;to9-=;=69-pynz}5z|qryNy}un-7-@=;=9-=;=9->;=66H--<<-JJJJJJJJJJJJJJJJ--ZNV[lZ\\QRYlP\\Y\\_--0v{pyqr-Is|tlsntzr{K--0v{pyqr-I}rzyv}yvrqlny}unlsntzr{K--0v{pyqr-Iqvurv{tlsntzr{K--ZNV[lR[Q\f"),meshBasicVertexShader=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=113,o=126,s=0,u="";return t[s].split(u).map(function(l){return l.charCodeAt(s)>o?l:String.fromCharCode((l.charCodeAt(s)+r)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=jh=j9-vrZnv\x07h>jh=j9-vrZnv\x07h?jh=j9-vrZnv\x07h=jh>j9-vrZnv\x07h>jh>j9-vrZnv\x07h?jh>j9-vrZnv\x07h=jh?j9-vrZnv\x07h>jh?j9-vrZnv\x07h?jh?j6H--PnzrnQvrpv|{-J-{|znyv r5pnzrn_|nv|{Znv\x07-7-rp@5=;=9-=;=9-:>;=66H--0vs-qrsv{rq5b`RlRQY6----Y|tQr}u-J-y|t?5:z]|vv|{; 6H--0r{qvs--V_||sZnx-J-=;=H--0vs-qrsv{rq5b`RlcR_aRelZN_X6----V_||sZnx-J-r}5no5znx-:->;=69-=;>6H--0r{qvs--0v{pyqr-I|yq}|lrr\x07K--0v{pyqr-Ir{zn}lrr\x07K--0v{pyqr-Is|tlrr\x07K--ZNV[lR[Q\f"),meshBasicFragmentShader=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=113,o=126,s=0,u="";return t[s].split(u).map(function(l){return l.charCodeAt(s)>o?l:String.fromCharCode((l.charCodeAt(s)+r)%o)}).join(u)}("0qrsv{r-OYNPXlP\\Y\\_-rpA5=;=EC9-=;>=C9-=;>AF9->;=6{vs|z-sy|n-sy||H{vs|z-nz}yrPor-}n{|=lzn}H{vs|z-znA-}n{|=lznv\x07H{vs|z-sy|n-}n{|=l ||zH0vs-qrsv{rq5b`RlYbZV[N[PR6--{vs|z-nz}yrPor-}n{|=lyzv{n{prZn}H0r{qvs{vs|z-nz}yrPor-}n{|>lzn}H{vs|z-znA-}n{|>lznv\x07H{vs|z-sy|n-}n{|>l ||zH0vs-qrsv{rq5b`RlYbZV[N[PR6--{vs|z-nz}yrPor-}n{|>lyzv{n{prZn}H0r{qvs{vs|z-sy|n-z|qryNy}unH{vs|z-sy|n-}|trH0vs-qrsv{rq5b`RlP\\Y\\_lP\\[`aN[a6--{vs|z-rp@-p|{n{P|y|H0r{qvs0vs-qrsv{rq5b`RlP\\Y\\_lNYaVabQR6--{vs|z-nz}yr?Q-tnqvr{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zH--r{-{|znyv r5q-8-\x006H\frp@-to?u5rp@-p6-\n----rpA-X-J-rpA5=;=9-:>;=-<-@;=9-?;=-<-@;=9-:>;=6H----rpA-}-J-zv\x075rpA5p;ot9-X; 69-rpA5p;to9-X;\x07\b69-r}5p;o9-p;t66H----rpA-\0-J-zv\x075rpA5};\x07\b9-p;69-rpA5p;9-};\b \x0769-r}5};\x079-p;66H----sy|n-q-J-\0;\x07-:-zv{5\0;9-\0;\b6H----sy|n-r-J->;=r:>=H----r{-rp@5no5\0; -8-5\0;-:-\0;\b6-<-5C;=-7-q-8-r669-q-<-5\0;\x07-8-r69-\0;\x076H\frp@-u?to5rp@-p6-\n----rpA-X-J-rpA5>;=9-?;=-<-@;=9->;=-<-@;=9-@;=6H----rp@-}-J-no5snp5p;\x07\x07\x07-8-X;\x07\b 6-7-C;=-:-X;6H----r{-p; -7-zv\x075X;\x07\x07\x079-pynz}5}-:-X;\x07\x07\x079-=;=9->;=69-p;\b6H\frp@-trP|y|O\bUrvtu5nz}yr?Q-tnqvr{ar\x07r9-rpA-d|yq]|vv|{6-\n--sy|n--J-5d|yq]|vv|{;\b-:-z|qryO|{qv{tZv{;\b6-<-5z|qryO|{qv{tZn\x07;\b-:-z|qryO|{qv{tZv{;\b6H--r{-r\x07r?Q5tnqvr{ar\x07r9-rp?59-=;B66;toH\fZNV[lORS\\_R|vq-znv{56-\n--ZNV[l`aN_a--<<-JJJ-顶部裁切-JJJ--sy|n-||sP]|tr-J-}|5pynz}5:PnzrnQvrpv|{;\b9-=;=9->;=69-@;=6H--vs-5----V_||sZnx-K-=;B-33----d|yq]|vv|{;\b-K-z|qryO|{qv{tZn\x07;\b-:-||sP]|tr-7-5z|qryO|{qv{tZn\x07;\b-:-z|qryO|{qv{tZv{;\b6--6-\n----qvpnqH--\f--<<-JJJJJJJJJJJJJJ--<<-JJJ-前置裁切计算-JJJ--0vs-[bZlPYV]]R_`-K-=----o||y-pyv}}rqH----rpA-pyv}}r]|vv|{H----0}ntzn-{|yyly||}ln----s|-5-v{-v-J-=H-v-I-[bZlPYV]]R_`H-v-88-6-\n------pyv}}r]|vv|{-J-pyv}}rh-v-j;znv\x07V{rr-7-d|yq]|vv|{H------pyv}}rq-J-5pyv}}rh-v-j;sy||V{qr\x07-I-=;=-\v\v-no5sy||-:-pyv}}rh-v-j;sy||V{qr\x076-I->;=6H------pyv}}rq-J-pyv}}rq-33-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--------qvpnqH------\f----\f----0}ntzn-{|yyly||}lr{q--0r{qvs--<<-JJJJJJJJJJJJJJJJJJ--0v{pyqr-Ipyv}}v{tl}yn{rlsntzr{K--rpA-qvssrP|y|-J-rpA5-qvssr9-|}npv\b-6H--<<-JJJ-高度色-JJJ--0vs-qrsv{rq5b`RlP\\Y\\_lNYaVabQR6----qvssrP|y|;to-J-trP|y|O\bUrvtu5tnqvr{ar\x07r9-d|yq]|vv|{6H--0r{qvs--<<-JJJJJJJJJJJ--<<-JJJ-纯色-JJJ--0vs-qrsv{rq5b`RlP\\Y\\_lP\\[`aN[a6----qvssrP|y|;to-J-p|{n{P|y|H--0r{qvs--<<-JJJJJJJJJJJ--0v{pyqr-Iy|tqr}uoslsntzr{K--0v{pyqr-Izn}lsntzr{K--0v{pyqr-Ip|y|lsntzr{K--0v{pyqr-Iny}unzn}lsntzr{K--0v{pyqr-Iny}unrlsntzr{K--0v{pyqr-I}rpynzn}lsntzr{K--_rsyrprqYvtu-rsyrprqYvtu-J-_rsyrprqYvtu5-rp@5-=;=-69-rp@5-=;=-69-rp@5-=;=-69-rp@5-=;=-6-6H--<<-nppzynv|{-5onxrq-v{qvrp-yvtuv{t-|{y\b6--0vsqrs-b`RlYVTUaZN]----rpA-yvtuZn}ar\x07ryJ-r\x07r?Q5-yvtuZn}9-b?-6H----rsyrprqYvtu;v{qvrpQvssr-8J-yvtuZn}ar\x07rya|Yv{rn5-yvtuZn}ar\x07ry-6;to-7-yvtuZn}V{r{v\bH--0ryr----rsyrprqYvtu;v{qvrpQvssr-8J-rp@5->;=-6H--0r{qvs--<<-z|qynv|{--0v{pyqr-In|zn}lsntzr{K--rsyrprqYvtu;v{qvrpQvssr-7J-qvssrP|y|;toH--rp@-|t|v{tYvtu-J-rsyrprqYvtu;v{qvrpQvssrH--0v{pyqr-Ir{zn}lsntzr{K--tylSntP|y|-J-rpA5-|t|v{tYvtu9-qvssrP|y|;n-6H--<<-JJJ-楼层显示-JJJ--sy|n-sy||\\}npv\b-J->;=H--vs-5u|{Sy||V{qr\x07-K-:=;=>-33-no5sy||-:-u|{Sy||V{qr\x076-K-=;FF6-\n----sy||\\}npv\b-J-=;?-7-zv{55>;=-8-PnzrnQvrpv|{;\b69->;=6H--\f--tylSntP|y|;n-J-tylSntP|y|;n-7-sy||\\}npv\b-7-ovtu{rH--<<-JJJJJJJJJJJJJJ--ZNV[lZ\\QRYlP\\Y\\_--<<色调映射-色彩空间转换--0v{pyqr-I|{rzn}}v{tlsntzr{K--0v{pyqr-Ir{p|qv{tlsntzr{K--<<-JJJ-颜色增益调整-JJJ--rp@-toP|y|-J-tylSntP|y|;toH--rp@-uP|y|-J-to?u5toP|y|6H--uP|y|;\b-8J-p|y|`nnv|{H--uP|y|; -8J-p|y|Ovtu{rH--tylSntP|y|;to-J-u?to5uP|y|6H--<<-JJJ-全景图-JJJ--rp@-}n{|=a|crr\x07-J-{|znyv r5d|yq]|vv|{;\x07\b -:-}n{|=lznv\x07h@j;\x07\b 6H--}n{|=a|crr\x07-J- ||zcrp|5PnzrnQvrpv|{9-}n{|=a|crr\x079-}n{|=l ||z6H--}n{|=a|crr\x07-J-}n{|=a|crr\x07-7-zn@5}n{|=lznv\x076H--rp@-}n{|>a|crr\x07-J-{|znyv r5d|yq]|vv|{;\x07\b -:-}n{|>lznv\x07h@j;\x07\b 6H--}n{|>a|crr\x07-J- ||zcrp|5PnzrnQvrpv|{9-}n{|>a|crr\x079-}n{|>l ||z6H--}n{|>a|crr\x07-J-}n{|>a|crr\x07-7-zn@5}n{|>lznv\x076H--rpA-}n{|P|y|H--rpA-}n{|=P|y|-J-r\x07rPor5}n{|=lzn}9-}n{|=a|crr\x076H--rpA-}n{|>P|y|-J-r\x07rPor5}n{|>lzn}9-}n{|>a|crr\x076H--0vs-qrsv{rq5b`RlYbZV[N[PR6----}n{|=P|y|;n-J->;=-:-r\x07rPor5}n{|=lyzv{n{prZn}9-}n{|=a|crr\x076;H----}n{|>P|y|;n-J->;=-:-r\x07rPor5}n{|>lyzv{n{prZn}9-}n{|>a|crr\x076;H--0r{qvs--0vs-qrsv{rq5b`RlOYNPXla_N[`VaV\\[6----sy|n-oynpx]|tr-J-np|5:?;=-7-}|tr-8->;=6H----}n{|P|y|-J-zv\x075}n{|=P|y|9-OYNPXlP\\Y\\_9-zv{5>;=9-oynpx]|tr66H----}n{|P|y|-J-zv\x075}n{|P|y|9-}n{|>P|y|9-zn\x075=;=9-oynpx]|tr-:-]V-8->;=66H--0ryvs-qrsv{rq5b`Rl`]_RNQla_N[`VaV\\[6----rp?-prr{Pr{rP||q-J-r|yv|{-7-}v\x07ry_nv|-<-?;=H----sy|n-n{vv|{_nqv-J-qvn{pr5rp?5=;=9-=;=69-prr{Pr{rP||q6-7->;?H----sy|n-n{vv|{]|tr-J-qvn{pr5tylSntP||q;\x07\b9-prr{Pr{rP||q6-<-n{vv|{_nqvH----}n{|P|y|-J-zv\x075}n{|=P|y|9-}n{|>P|y|9-z||ur}5=;=9-=;?9-}|tr-:-n{vv|{]|tr66H--0ryr----}n{|P|y|-J-zv\x075}n{|=P|y|9-}n{|>P|y|9-}|tr6H--0r{qvs--tylSntP|y|-J-zv\x075}n{|P|y|9-tylSntP|y|9-z|qryNy}un6H--<<-JJJJJJJJJJJJJ--0v{pyqr-Is|tlsntzr{K--0v{pyqr-I}rzyv}yvrqlny}unlsntzr{K--0v{pyqr-Iqvurv{tlsntzr{K--0vs-qrsv{rq5b`RlRQY6----tylSntP|y|;n-J-Y|tQr}uH--0r{qvs--ZNV[lR[Q\f"),meshPhongVertexShader=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=113,o=126,s=0,u="";return t[s].split(u).map(function(l){return l.charCodeAt(s)>o?l:String.fromCharCode((l.charCodeAt(s)+r)%o)}).join(u)}("0qrsv{r-]U\\[T0vs-qrsv{rq5b`RlRQY6--n\bv{t-sy|n-Y|tQr}uH0r{qvs0vs-qrsv{rq5b`RlcR_aRelZN_X6--nvor-sy|n-znxH0r{qvsn\bv{t-sy|n-V_||sZnxHn\bv{t-rpA-d|yq]|vv|{Hn\bv{t-rp@-PnzrnQvrpv|{Hn\bv{t-rp@-cvr]|vv|{H0vs{qrs-SYNal`UNQRQ--n\bv{t-rp@-[|znyH0r{qvs0v{pyqr-Ip|zz|{K0v{pyqr-Il}nlrr\x07K0v{pyqr-I?l}nlrr\x07K0v{pyqr-Iqv}ynprzr{zn}l}nlrr\x07K0v{pyqr-Ir{zn}l}nlrr\x07K0v{pyqr-Ip|y|l}nlrr\x07K0v{pyqr-Is|tl}nlrr\x07K0v{pyqr-Iz|}untrl}nlrr\x07K0v{pyqr-Ixv{{v{tl}nlrr\x07K0v{pyqr-Iunq|zn}l}nlrr\x07K0v{pyqr-Iy|tqr}uosl}nlrr\x07K0v{pyqr-Ipyv}}v{tl}yn{rl}nlrr\x07KZNV[lORS\\_R|vq-znv{56-\n--ZNV[l`aN_a--0v{pyqr-Ilrr\x07K--0v{pyqr-I?lrr\x07K--0v{pyqr-Ip|y|lrr\x07K--0v{pyqr-Iortv{{|znylrr\x07K--0v{pyqr-Iz|}u{|znylrr\x07K--0v{pyqr-Ixv{onrlrr\x07K--0v{pyqr-Ixv{{|znylrr\x07K--0v{pyqr-Iqrsny{|znylrr\x07K0vs{qrs-SYNal`UNQRQ-<<-[|zny-p|z}rq-vu-qrvnvr-ur{-SYNal`UNQRQ--[|zny-J-{|znyv r5-n{s|zrq[|zny-6H0r{qvs--0v{pyqr-Iortv{lrr\x07K--0v{pyqr-Iz|}untrlrr\x07K--0v{pyqr-Ixv{{v{tlrr\x07K--0v{pyqr-Iqv}ynprzr{zn}lrr\x07K--0v{pyqr-I}|wrplrr\x07K--0v{pyqr-Iy|tqr}uoslrr\x07K--0v{pyqr-Ipyv}}v{tl}yn{rlrr\x07K--cvr]|vv|{-J-:-z]|vv|{;\x07\b H--d|yq]|vv|{-J-rpA5n{s|zrq9->;=6H--0vsqrs-b`RlV[`aN[PV[T----d|yq]|vv|{-J-v{n{prZnv\x07-7-d|yq]|vv|{H--0r{qvs--d|yq]|vv|{-J-z|qryZnv\x07-7-d|yq]|vv|{H--zn@-pnzrn_|nv|{Znv\x07-J-zn@5vrZnv\x07h=jh=j9-vrZnv\x07h>jh=j9-vrZnv\x07h?jh=j9-vrZnv\x07h=jh>j9-vrZnv\x07h>jh>j9-vrZnv\x07h?jh>j9-vrZnv\x07h=jh?j9-vrZnv\x07h>jh?j9-vrZnv\x07h?jh?j6H--PnzrnQvrpv|{-J-{|znyv r5pnzrn_|nv|{Znv\x07-7-rp@5=;=9-=;=9-:>;=66H--0vs-qrsv{rq5b`RlRQY6----Y|tQr}u-J-y|t?5:z]|vv|{; 6H--0r{qvs--V_||sZnx-J-=;=H--0vs-qrsv{rq5b`RlcR_aRelZN_X6----V_||sZnx-J-r}5no5znx-:->;=69-=;>6H--0r{qvs--0v{pyqr-I|yq}|lrr\x07K--0v{pyqr-Ir{zn}lrr\x07K--0v{pyqr-Iunq|zn}lrr\x07K--0v{pyqr-Is|tlrr\x07K--ZNV[lR[Q\f"),meshPhongFragmentShader=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=113,o=126,s=0,u="";return t[s].split(u).map(function(l){return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C;=-7-q-8-r669-q-<-5\0;\x07-8-r69-\0;\x076H\frp@-u?to5rp@-p6-\n----rpA-X-J-rpA5>;=9-?;=-<-@;=9->;=-<-@;=9-@;=6H----rp@-}-J-no5snp5p;\x07\x07\x07-8-X;\x07\b 6-7-C;=-:-X;6H----r{-p; -7-zv\x075X;\x07\x07\x079-pynz}5}-:-X;\x07\x07\x079-=;=9->;=69-p;\b6H\frp@-trP|y|O\bUrvtu5nz}yr?Q-tnqvr{ar\x07r9-rpA-d|yq]|vv|{6-\n--sy|n--J-5d|yq]|vv|{;\b-:-z|qryO|{qv{tZv{;\b6-<-5z|qryO|{qv{tZn\x07;\b-:-z|qryO|{qv{tZv{;\b6H--r{-r\x07r?Q5tnqvr{ar\x07r9-rp?59-=;B66;toH\fZNV[lORS\\_R|vq-znv{56-\n--ZNV[l`aN_a--<<-JJJ-顶部裁切-JJJ--sy|n-||sP]|tr-J-}|5pynz}5:PnzrnQvrpv|{;\b9-=;=9->;=69-@;=6H--vs-5----V_||sZnx-K-=;B-33----d|yq]|vv|{;\b-K-z|qryO|{qv{tZn\x07;\b-:-||sP]|tr-7-5z|qryO|{qv{tZn\x07;\b-:-z|qryO|{qv{tZv{;\b6--6-\n----qvpnqH--\f--<<-JJJJJJJJJJJJJJ--<<-JJJ-前置裁切计算-JJJ--0vs-[bZlPYV]]R_`-K-=----o||y-pyv}}rqH----rpA-pyv}}r]|vv|{H----0}ntzn-{|yyly||}ln----s|-5-v{-v-J-=H-v-I-[bZlPYV]]R_`H-v-88-6-\n------pyv}}r]|vv|{-J-pyv}}rh-v-j;znv\x07V{rr-7-d|yq]|vv|{H------pyv}}rq-J-5pyv}}rh-v-j;sy||V{qr\x07-I-=;=-\v\v-no5sy||-:-pyv}}rh-v-j;sy||V{qr\x076-I->;=6H------pyv}}rq-J-pyv}}rq-33-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--------qvpnqH------\f----\f----0}ntzn-{|yyly||}lr{q--0r{qvs--<<-JJJJJJJJJJJJJJJJ--0v{pyqr-Ipyv}}v{tl}yn{rlsntzr{K--rpA-qvssrP|y|-J-rpA5-qvssr9-|}npv\b-6H--<<-JJJ-高度色-JJJ--0vs-qrsv{rq5b`RlP\\Y\\_lNYaVabQR6----qvssrP|y|;to-J-trP|y|O\bUrvtu5tnqvr{ar\x07r9-d|yq]|vv|{6H--0r{qvs--<<-JJJJJJJJJJJ--<<-JJJ-纯色-JJJ--0vs-qrsv{rq5b`RlP\\Y\\_lP\\[`aN[a6----qvssrP|y|;to-J-p|{n{P|y|H--0r{qvs--<<-JJJJJJJJJJJ--_rsyrprqYvtu-rsyrprqYvtu-J-_rsyrprqYvtu5-rp@5-=;=-69-rp@5-=;=-69-rp@5-=;=-69-rp@5-=;=-6-6H--rp@-|nyRzvvr_nqvn{pr-J-rzvvrH--0v{pyqr-Iy|tqr}uoslsntzr{K--0v{pyqr-Izn}lsntzr{K--0v{pyqr-Ip|y|lsntzr{K--0v{pyqr-Iny}unzn}lsntzr{K--0v{pyqr-Iny}unrlsntzr{K--0v{pyqr-I}rpynzn}lsntzr{K--0v{pyqr-I{|znylsntzr{lortv{K--0v{pyqr-I{|znylsntzr{lzn}K--0v{pyqr-Irzvvrzn}lsntzr{K--<<-nppzynv|{--0v{pyqr-Iyvtul}u|{tlsntzr{K--0v{pyqr-Iyvtulsntzr{lortv{K--0v{pyqr-Iyvtulsntzr{lzn}K--0v{pyqr-Iyvtulsntzr{lr{qK--<<-z|qynv|{--0v{pyqr-In|zn}lsntzr{K--rp@-|t|v{tYvtu-J-rsyrprqYvtu;qvrpQvssr-8-rsyrprqYvtu;v{qvrpQvssr-8-rsyrprqYvtu;qvrp`}rpyn-8-rsyrprqYvtu;v{qvrp`}rpyn-8-|nyRzvvr_nqvn{prH--0v{pyqr-Ir{zn}lsntzr{K--tylSntP|y|-J-rpA5-|t|v{tYvtu9-qvssrP|y|;n-6H--<<-JJJ-楼层显示-JJJ--sy|n-sy||\\}npv\b-J->;=H--vs-5u|{Sy||V{qr\x07-K-:=;=>-33-no5sy||-:-u|{Sy||V{qr\x076-K-=;FF6-\n----sy||\\}npv\b-J-=;?-7-zv{55>;=-8-PnzrnQvrpv|{;\b69->;=6H--\f--tylSntP|y|;n-J-tylSntP|y|;n-7-sy||\\}npv\b-7-ovtu{rH--<<-JJJJJJJJJJJJJJ--ZNV[lZ\\QRYlP\\Y\\_--<<色调映射-色彩空间转换--0v{pyqr-I|{rzn}}v{tlsntzr{K--0v{pyqr-Ir{p|qv{tlsntzr{K--<<-JJJ-颜色增益调整-JJJ--rp@-toP|y|-J-tylSntP|y|;toH--rp@-uP|y|-J-to?u5toP|y|6H--uP|y|;\b-8J-p|y|`nnv|{H--uP|y|; -8J-p|y|Ovtu{rH--tylSntP|y|;to-J-u?to5uP|y|6H--<<-JJJ-全景图-JJJ--rp@-}n{|=a|crr\x07-J-{|znyv r5d|yq]|vv|{;\x07\b -:-}n{|=lznv\x07h@j;\x07\b 6H--}n{|=a|crr\x07-J- ||zcrp|5PnzrnQvrpv|{9-}n{|=a|crr\x079-}n{|=l ||z6H--}n{|=a|crr\x07-J-}n{|=a|crr\x07-7-zn@5}n{|=lznv\x076H--rp@-}n{|>a|crr\x07-J-{|znyv r5d|yq]|vv|{;\x07\b -:-}n{|>lznv\x07h@j;\x07\b 6H--}n{|>a|crr\x07-J- ||zcrp|5PnzrnQvrpv|{9-}n{|>a|crr\x079-}n{|>l ||z6H--}n{|>a|crr\x07-J-}n{|>a|crr\x07-7-zn@5}n{|>lznv\x076H--rpA-}n{|P|y|H--rpA-}n{|=P|y|-J-r\x07rPor5}n{|=lzn}9-}n{|=a|crr\x076H--rpA-}n{|>P|y|-J-r\x07rPor5}n{|>lzn}9-}n{|>a|crr\x076H--0vs-qrsv{rq5b`RlYbZV[N[PR6----}n{|=P|y|;n-J->;=-:-r\x07rPor5}n{|=lyzv{n{prZn}9-}n{|=a|crr\x076;H----}n{|>P|y|;n-J->;=-:-r\x07rPor5}n{|>lyzv{n{prZn}9-}n{|>a|crr\x076;H--0r{qvs--0vs-qrsv{rq5b`RlOYNPXla_N[`VaV\\[6----sy|n-oynpx]|tr-J-np|5:?;=-7-}|tr-8->;=6H----}n{|P|y|-J-zv\x075}n{|=P|y|9-OYNPXlP\\Y\\_9-zv{5>;=9-oynpx]|tr66H----}n{|P|y|-J-zv\x075}n{|P|y|9-}n{|>P|y|9-zn\x075=;=9-oynpx]|tr-:-]V-8->;=66H--0ryvs-qrsv{rq5b`Rl`]_RNQla_N[`VaV\\[6----rp?-prr{Pr{rP||q-J-r|yv|{-7-}v\x07ry_nv|-<-?;=H----sy|n-n{vv|{_nqv-J-qvn{pr5rp?5=;=9-=;=69-prr{Pr{rP||q6-7->;?H----sy|n-n{vv|{]|tr-J-qvn{pr5tylSntP||q;\x07\b9-prr{Pr{rP||q6-<-n{vv|{_nqvH----}n{|P|y|-J-zv\x075}n{|=P|y|9-}n{|>P|y|9-z||ur}5=;=9-=;?9-}|tr-:-n{vv|{]|tr66H--0ryr----}n{|P|y|-J-zv\x075}n{|=P|y|9-}n{|>P|y|9-}|tr6H--0r{qvs--tylSntP|y|-J-zv\x075}n{|P|y|9-tylSntP|y|9-z|qryNy}un6H--<<-JJJJJJJJJJJJJJ--0v{pyqr-Is|tlsntzr{K--0v{pyqr-I}rzyv}yvrqlny}unlsntzr{K--0v{pyqr-Iqvurv{tlsntzr{K--0vs-qrsv{rq5b`RlRQY6----tylSntP|y|;n-J-Y|tQr}uH--0r{qvs--ZNV[lR[Q\f");var pbmUniforms$1={modelAlpha:new THREE__namespace.Uniform(0),progress:new THREE__namespace.Uniform(0),pano0_map:new THREE__namespace.Uniform(null),pano0_luminanceMap:new THREE__namespace.Uniform(null),pano0_matrix:new THREE__namespace.Uniform(new THREE__namespace.Matrix4),pano0_zoom:new THREE__namespace.Uniform(1),pano1_map:new THREE__namespace.Uniform(null),pano1_luminanceMap:new THREE__namespace.Uniform(null),pano1_matrix:new THREE__namespace.Uniform(new THREE__namespace.Matrix4),pano1_zoom:new THREE__namespace.Uniform(1),gradientTexture:new THREE__namespace.Uniform(null),clippers:new THREE__namespace.Uniform([]),shownFloorIndex:new THREE__namespace.Uniform(-1),constantColor:new THREE__namespace.Uniform(new THREE__namespace.Vector3),geometricError:new THREE__namespace.Uniform(0),pixelRatio:new THREE__namespace.Uniform(1),resolution:new THREE__namespace.Uniform(new THREE__namespace.Vector2(512,512)),floor:new THREE__namespace.Uniform(0),brightness:new THREE__namespace.Uniform(1),modelBoundingMin:new THREE__namespace.Uniform(new THREE__namespace.Vector3),modelBoundingMax:new THREE__namespace.Uniform(new THREE__namespace.Vector3),colorSaturation:new THREE__namespace.Uniform(0),colorBrightness:new THREE__namespace.Uniform(0)},shaderLib={none:{vertexShader:meshNoneVertexShader,fragmentShader:meshNoneFragmentShader,uniforms:THREE__namespace.UniformsUtils.merge([pbmUniforms$1,{opacity:{value:1}},THREE__namespace.UniformsLib.fog]),lights:!1,clipping:!1},basic:{vertexShader:meshBasicVertexShader,fragmentShader:meshBasicFragmentShader,uniforms:THREE__namespace.UniformsUtils.merge([pbmUniforms$1,THREE__namespace.ShaderLib.basic.uniforms]),lights:!1,clipping:!0},phong:{vertexShader:meshPhongVertexShader,fragmentShader:meshPhongFragmentShader,uniforms:THREE__namespace.UniformsUtils.merge([pbmUniforms$1,THREE__namespace.ShaderLib.phong.uniforms]),lights:!0,clipping:!0}},PBMMeshMaterial=function(n){__extends(t,n);function t(e,r){e===void 0&&(e="basic"),r===void 0&&(r={});var o=this,s,u,l,c,f,d,p,v,g,h,m,y,A,E,b,T,_,R,S,M,B,H,w,C,L,I=shaderLib[e];o=n.call(this,{vertexShader:I.vertexShader,fragmentShader:I.fragmentShader,uniforms:THREE__namespace.UniformsUtils.clone(I.uniforms),lights:I.lights,clipping:I.clipping,defines:{USE_COLOR_CONSTANT:!1,USE_COLOR_ALTITUDE:!1,USE_EDL:!1,USE_HQ_WEIGHT:!1,USE_HQ_DEPTH:!1,NUM_CLIPPING_BOX:!1,USE_CLIPFLOOR:!1,USE_VERTEX_MARK:!1,USE_LUMINANCE:!1,USE_BLACK_TRANSITION:!1,USE_SPREAD_TRANSITION:!1,USE_POINT_NORMAL:!1,USE_POINT_CIRCLE:!1,USE_POINT_ADAPTIVE_SIZE:!1,USE_POINT_COLOR_ALTITUDE:!1}})||this,o.shaderType=e,o.color=new THREE__namespace.Color(16777215),o.map=null,o.lightMap=null,o.lightMapIntensity=1,o.aoMap=null,o.aoMapIntensity=1,o.specularMap=null,o.specular=new THREE__namespace.Color(1118481),o.alphaMap=null,o.envMap=null,o.reflectivity=1,o.refractionRatio=.98,o.emissiveMap=null,o.emissive=new THREE__namespace.Color(0),o.emissiveIntensity=1,o.bumpMap=null,o.bumpScale=1,o.normalMap=null,o.normalMapType=THREE__namespace.TangentSpaceNormalMap,o.normalScale=new THREE__namespace.Vector2(1,1),o.displacementMap=null,o.displacementScale=1,o.displacementBias=0,o.shininess=30;var F,k=null,N=null;return Object.defineProperties(o,{pano0:{get:function(){return k},set:function(D){if(k!==D){k=D,D===null?(this.uniforms.pano0_map.value=null,this.uniforms.pano0_luminanceMap.value=null,this.uniforms.pano0_matrix.value.identity(),this.uniforms.pano0_zoom.value=1):(this.uniforms.pano0_map.value=D.map instanceof TileCubeTextureTarget?D.map.texture:D.map,this.uniforms.pano0_luminanceMap.value=D.luminanceMap instanceof TileCubeTextureTarget?D.luminanceMap.texture:D.luminanceMap,this.uniforms.pano0_matrix.value.copy(D.matrix),this.uniforms.pano0_zoom.value=D.zoom);var U=this.uniforms.pano0_luminanceMap.value!==null&&this.uniforms.pano1_luminanceMap.value!==null,z=this.defines.USE_LUMINANCE;z!==U&&(this.defines.USE_LUMINANCE=U,this.needsUpdate=!0)}}},pano1:{get:function(){return N},set:function(D){if(N!==D){N=D,D===null?(this.uniforms.pano1_map.value=null,this.uniforms.pano1_luminanceMap.value=null,this.uniforms.pano1_matrix.value.identity(),this.uniforms.pano1_zoom.value=1):(this.uniforms.pano1_map.value=D.map instanceof TileCubeTextureTarget?D.map.texture:D.map,this.uniforms.pano1_luminanceMap.value=D.luminanceMap instanceof TileCubeTextureTarget?D.luminanceMap.texture:D.luminanceMap,this.uniforms.pano1_matrix.value.copy(D.matrix),this.uniforms.pano1_zoom.value=D.zoom);var U=this.uniforms.pano0_luminanceMap.value!==null&&this.uniforms.pano1_luminanceMap.value!==null,z=this.defines.USE_LUMINANCE;z!==U&&(this.defines.USE_LUMINANCE=U,this.needsUpdate=!0)}}},modelAlpha:{get:function(){return this.uniforms.modelAlpha.value},set:function(D){this.uniforms.modelAlpha.value=D}},progress:{get:function(){return this.uniforms.progress.value},set:function(D){this.uniforms.progress.value=D}},transition:{get:function(){return this.defines.USE_BLACK_TRANSITION?"BLACK":this.defines.USE_SPREAD_TRANSITION?"SPREAD":"FADE"},set:function(D){var U=this.defines.USE_BLACK_TRANSITION,z=this.defines.USE_SPREAD_TRANSITION;this.defines.USE_BLACK_TRANSITION=!1,this.defines.USE_SPREAD_TRANSITION=!1,this.defines["USE_".concat(D,"_TRANSITION")]=!0;var G=!1;U!==this.defines.USE_BLACK_TRANSITION&&(G=!0),z!==this.defines.USE_SPREAD_TRANSITION&&(G=!0),G&&(this.needsUpdate=!0)}},colorStyle:{get:function(){return this.defines.USE_COLOR_CONSTANT?"CONSTANT":this.defines.USE_COLOR_ALTITUDE?"ALTITUDE":"RGB"},set:function(D){var U=D==="CONSTANT",z=D==="ALTITUDE";this.defines.USE_COLOR_CONSTANT!==U&&(this.defines.USE_COLOR_CONSTANT=U,this.needsUpdate=!0),this.defines.USE_COLOR_ALTITUDE!==z&&(this.defines.USE_COLOR_ALTITUDE=z,this.needsUpdate=!0)}},constantColor:{get:function(){return this.uniforms.constantColor.value},set:function(D){this.uniforms.constantColor.value=D}},opacity:{get:function(){return this.uniforms.opacity.value},set:function(D){this.uniforms.opacity.value=D}},shownFloorIndex:{get:function(){return this.uniforms.shownFloorIndex.value},set:function(D){this.uniforms.shownFloorIndex.value=D}},gradientTexture:{get:function(){return this.uniforms.gradientTexture.value},set:function(D){this.uniforms.gradientTexture.value=D}},brightness:{get:function(){return this.uniforms.brightness.value},set:function(D){this.uniforms.brightness.value=D}},clippers:{get:function(){return F},set:function(D){F!==D&&(F=D,this.uniforms.clippers.value=(F||[]).map(function(U){var z=typeof U.floorIndex=="number"?U.floorIndex:-1,G=new THREE__namespace.Matrix4().getInverse(U.clippingBoxMatrix);return{matrixInverse:G,floorIndex:z}}),this.needsUpdate=!0)}},useEDL:{get:function(){return this.defines.USE_EDL},set:function(D){D!==this.defines.USE_EDL&&(this.defines.USE_EDL=D,this.needsUpdate=!0)}},useHQWeight:{get:function(){return this.defines.USE_HQ_WEIGHT},set:function(D){D!==this.defines.USE_HQ_WEIGHT&&(this.defines.USE_HQ_WEIGHT=D,this.needsUpdate=!0)}},useHQDepth:{get:function(){return this.defines.USE_HQ_DEPTH},set:function(D){D!==this.defines.USE_HQ_DEPTH&&(this.defines.USE_HQ_DEPTH=D,this.needsUpdate=!0)}},floor:{get:function(){return this.uniforms.floor.value},set:function(D){this.uniforms.floor.value=D}},colorSaturation:{get:function(){return this.uniforms.colorSaturation.value},set:function(D){this.uniforms.colorSaturation.value=D}},colorBrightness:{get:function(){return this.uniforms.colorBrightness.value},set:function(D){this.uniforms.colorBrightness.value=D}}}),o.pano0=(s=r.pano0)!==null&&s!==void 0?s:defaultPbmParameters.pano0,o.pano1=(u=r.pano1)!==null&&u!==void 0?u:defaultPbmParameters.pano1,o.modelAlpha=(l=r.modelAlpha)!==null&&l!==void 0?l:defaultPbmParameters.modelAlpha,o.progress=(c=r.progress)!==null&&c!==void 0?c:defaultPbmParameters.progress,o.transition=(f=r.transition)!==null&&f!==void 0?f:defaultPbmParameters.transition,o.constantColor=(d=r.constantColor)!==null&&d!==void 0?d:defaultPbmParameters.constantColor,o.opacity=(p=r.opacity)!==null&&p!==void 0?p:defaultPbmParameters.opacity,o.floorStyle=(v=r.floorStyle)!==null&&v!==void 0?v:defaultPbmParameters.floorStyle,o.shownFloorIndex=(g=r.shownFloorIndex)!==null&&g!==void 0?g:defaultPbmParameters.shownFloorIndex,o.clippers=(h=r.clippers)!==null&&h!==void 0?h:defaultPbmParameters.clippers,o.useEDL=(m=r.useEDL)!==null&&m!==void 0?m:defaultPbmParameters.useEDL,o.useHQWeight=(y=r.useHQWeight)!==null&&y!==void 0?y:defaultPbmParameters.useHQWeight,o.useHQDepth=(A=r.useHQDepth)!==null&&A!==void 0?A:defaultPbmParameters.useHQDepth,o.pointSize=(E=r.pointSize)!==null&&E!==void 0?E:defaultPbmParameters.pointSize,o.colorStyle=(b=r.colorStyle)!==null&&b!==void 0?b:defaultPbmParameters.colorStyle,o.pointShape=(T=r.pointShape)!==null&&T!==void 0?T:defaultPbmParameters.pointShape,o.pointScale=(_=r.pointScale)!==null&&_!==void 0?_:defaultPbmParameters.pointScale,o.pointBack=(R=r.pointBack)!==null&&R!==void 0?R:defaultPbmParameters.pointBack,o.pointMinPixel=(S=r.pointMinPixel)!==null&&S!==void 0?S:defaultPbmParameters.pointMinPixel,o.pointMaxPixel=(M=r.pointMaxPixel)!==null&&M!==void 0?M:defaultPbmParameters.pointMaxPixel,o.gradientTexture=(B=r.gradientTexture)!==null&&B!==void 0?B:defaultPbmParameters.gradientTexture,o.brightness=(H=r.brightness)!==null&&H!==void 0?H:defaultPbmParameters.brightness,o.colorSaturation=(w=r.colorSaturation)!==null&&w!==void 0?w:defaultPbmParameters.colorSaturation,o.colorBrightness=(C=r.colorBrightness)!==null&&C!==void 0?C:defaultPbmParameters.colorBrightness,o.customShaders=(L=r.customShaders)!==null&&L!==void 0?L:defaultPbmParameters.customShaders,o.customShaderHash="",o.customShaderUniforms={},o.customShaderDefines={},o.floor=0,o.transparent=!1,o}return t.prototype.onBeforeCompile=function(e,r){var o=this,s,u,l=this.customShaders.filter(function(y){return y.type.includes(o.shaderType)}),c=l.reduce(function(y,A){return y+A.vertex.mainBefore},""),f=l.reduce(function(y,A){return y+A.vertex.mainStart},""),d=l.reduce(function(y,A){return y+A.vertex.mainEnd},""),p=l.reduce(function(y,A){return y+A.fragment.mainBefore},""),v=l.reduce(function(y,A){return y+A.fragment.mainStart},""),g=l.reduce(function(y,A){return y+A.fragment.mainModelColor},""),h=l.reduce(function(y,A){return y+A.fragment.mainEnd},"");e.vertexShader=e.vertexShader.replace(/MAIN_BEFORE/g,c),e.fragmentShader=e.fragmentShader.replace(/MAIN_BEFORE/g,p),e.vertexShader=e.vertexShader.replace(/MAIN_START/g,f),e.fragmentShader=e.fragmentShader.replace(/MAIN_START/g,v),e.vertexShader=e.vertexShader.replace(/MAIN_END/g,d),e.fragmentShader=e.fragmentShader.replace(/MAIN_END/g,h),e.fragmentShader=e.fragmentShader.replace(/MAIN_MODEL_COLOR/g,g);var m=String((u=(s=this.clippers)===null||s===void 0?void 0:s.length)!==null&&u!==void 0?u:0);e.vertexShader=e.vertexShader.replace(/NUM_CLIPPERS/g,m),e.fragmentShader=e.fragmentShader.replace(/NUM_CLIPPERS/g,m),l.forEach(function(y){y.onBeforeCompile(e,r)})},t.prototype.refreshUniforms=function(e){var r,o,s=this.uniforms;s.diffuse&&s.diffuse.value.copy(this.color),s.opacity&&(s.opacity.value=this.opacity),s.color&&s.diffuse.value.copy(this.color),s.emissive&&s.emissive.value.copy(this.emissive).multiplyScalar(this.emissiveIntensity),s.map&&(s.map.value=this.map),s.alphaMap&&(s.alphaMap.value=this.alphaMap),s.specularMap&&(s.specularMap.value=this.specularMap),s.envMap&&(s.envMap.value=this.envMap,s.flipEnvMap.value=!((r=this.envMap)===null||r===void 0)&&r.isCubeTexture?-1:1,s.reflectivity.value=this.reflectivity,s.refractionRatio.value=this.refractionRatio,s.maxMipLevel.value=this.envMap&&(o=e==null?void 0:e.properties.get(this.envMap).__maxMipLevel)!==null&&o!==void 0?o:0),s.lightMap&&(s.lightMap.value=this.lightMap,s.lightMapIntensity.value=this.lightMapIntensity),s.aoMap&&(s.aoMap.value=this.aoMap,s.aoMapIntensity.value=this.aoMapIntensity),s.specular&&s.specular.value.copy(this.specular),s.shininess&&(s.shininess.value=Math.max(this.shininess,1e-4)),s.emissiveMap&&(s.emissiveMap.value=this.emissiveMap),s.bumpMap&&(s.bumpMap.value=this.bumpMap,s.bumpScale.value=this.bumpScale,this.side===THREE__namespace.BackSide&&(s.bumpScale.value*=-1)),s.normalMap&&(s.normalMap.value=this.normalMap,s.normalScale.value.copy(this.normalScale),this.side===THREE__namespace.BackSide&&s.normalScale.value.negate()),s.displacementMap&&(s.displacementMap.value=this.displacementMap,s.displacementScale.value=this.displacementScale,s.displacementBias.value=this.displacementBias);var u;this.map?u=this.map:this.specularMap?u=this.specularMap:this.displacementMap?u=this.displacementMap:this.normalMap?u=this.normalMap:this.bumpMap?u=this.bumpMap:this.alphaMap?u=this.alphaMap:this.emissiveMap&&(u=this.emissiveMap),u!==void 0&&(u.matrixAutoUpdate===!0&&u.updateMatrix(),s.uvTransform.value.copy(u.matrix));var l;this.aoMap?l=this.aoMap:this.lightMap&&(l=this.lightMap),l!==void 0&&(l.matrixAutoUpdate===!0&&l.updateMatrix(),s.uv2Transform.value.copy(l.matrix))},t.prototype.update=function(e,r,o){var s="".concat(o.id,":").concat(o.materialVersion);s!==this.syncModelVersion&&(Object.assign(this,o.getMaterial()),this.syncModelVersion=s);var u=this.customShaders.map(function(A){return A.getHash()}).join("");this.customShaderHash!==u&&(this.customShaderHash=u,this.needsUpdate=!0);for(var l=this.customShaders.reduce(function(A,E){return Object.assign(A,E.defines)},{}),c=Object.keys(this.customShaderDefines),f=0,d=c;f<d.length;f++){var p=d[f];delete this.defines[p]}this.customShaderDefines=l,Object.assign(this.defines,this.customShaderDefines);for(var v=this.customShaders.reduce(function(A,E){return Object.assign(A,E.uniforms)},{}),g=Object.keys(this.customShaderUniforms),h=0,m=g;h<m.length;h++){var y=m[h];delete this.uniforms[y]}this.customShaderUniforms=v,Object.assign(this.uniforms,this.customShaderUniforms),this.visible=!0,this.refreshUniforms(e),this.shaderType==="none"?(this.depthWrite=!1,this.transparent=!0):(this.transparent=!1,this.depthWrite=!0,this.shownFloorIndex>-1&&(this.transparent=this.shownFloorIndex!==this.floor),this.opacity<1&&(this.transparent=!0),this.alphaMap&&(this.transparent=!0),this.brightness<1&&(this.transparent=!0),this.transparent&&(this.depthWrite=!1),this.floorStyle==="VISIBILITY"&&this.shownFloorIndex!==-1&&this.floor!==this.shownFloorIndex&&(this.visible=!1)),this.uniforms.pixelRatio.value=r.pixelRatio,this.uniforms.resolution.value.copy(r.resolution),this.uniforms.modelBoundingMax.value.copy(o.bounding.max),this.uniforms.modelBoundingMin.value.copy(o.bounding.min)},t.prototype.copy=function(e){return n.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.specular.copy(e.specular),this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.emissiveMap=e.emissiveMap,this.emissive.copy(e.emissive),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.shininess=e.shininess,this.customShaders=e.customShaders,this.pano0=e.pano0,this.pano1=e.pano1,this.modelAlpha=e.modelAlpha,this.progress=e.progress,this.transition=e.transition,this.opacity=e.opacity,this.floorStyle=e.floorStyle,this.colorStyle=e.colorStyle,this.constantColor=e.constantColor,this.shownFloorIndex=e.shownFloorIndex,this.brightness=e.brightness,this.clippers=e.clippers,this.useEDL=e.useEDL,this.useHQWeight=e.useHQWeight,this.useHQDepth=e.useHQDepth,this.pointSize=e.pointSize,this.pointShape=e.pointShape,this.pointScale=e.pointScale,this.pointBack=e.pointBack,this.pointMinPixel=e.pointMinPixel,this.pointMaxPixel=e.pointMaxPixel,this.gradientTexture=e.gradientTexture,this.floor=e.floor,this.colorSaturation=e.colorSaturation,this.colorBrightness=e.colorBrightness,this.refreshUniforms(),this},t.prototype.clone=function(){return new this.constructor(this.shaderType).copy(this)},t}(THREE__namespace.ShaderMaterial);const pointCloudFragmentShader=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=113,o=126,s=0,u="";return t[s].split(u).map(function(l){return l.charCodeAt(s)>o?l:String.fromCharCode((l.charCodeAt(s)+r)%o)}).join(u)}("{vs|z-sy|n-sy||H0vs-qrsv{rq5b`Rl]\\V[al[\\_ZNY6--n\bv{t-rp@-[|znyH0r{qvs0vs-qrsv{rq5b`RlRQY6--n\bv{t-sy|n-Y|tQr}uH0r{qvsp-Pyv}}r-\n--znA-znv\x07V{rrH--sy|n-sy||V{qr\x07H\fH0vs-[bZlPYV]]R_`-K-=--{vs|z-Pyv}}r-pyv}}rh[bZlPYV]]R_`jH0r{qvsn\bv{t-rpA-d|yq]|vv|{Hn\bv{t-rp@-PnzrnQvrpv|{Hn\bv{t-rp@-P|y|Hn\bv{t-sy|n-]|v{`v rH{vs|z-sy|n-|}npv\bH{vs|z-sy|n-z|qryNy}unH{vs|z-sy|n-u|{Sy||V{qr\x07H<<u调整{vs|z-sy|n-p|y|`nnv|{H{vs|z-sy|n-p|y|Ovtu{rH0v{pyqr-Ip|zz|{K0v{pyqr-Is|tl}nlsntzr{K0v{pyqr-Iy|tqr}uosl}nlsntzr{K0v{pyqr-Ipyv}}v{tl}yn{rl}nlsntzr{Krp@-nqwP|y|arz}rnr5rp@-p|y|9-sy|n-rz}rnr6\n----<<-将色温范围从-:>;=-到->;=-映射到实际的色温范围----sy|n-rz}-J-5rz}rnr-8->;=6-7-B===;=H-<<-范围从-=-到->====----<<-计算色温系数----sy|n-lsnp|9-tlsnp|9-olsnp|H----vs-5rz}-IJ-CC==;=6-\n--------lsnp|-J->;=H--------tlsnp|-J-=;@F==E>BDEDCF=>FC=DEA-7-y|t5rz}-<->==;=6-:-=;C@>EA>AA@DEEC?DAB=FEH--------olsnp|-J-rz}-IJ->F==;=-L-=;=-G-=;BA@?=CDEF>>=>FC=DEA@-7-y|t5rz}-<->==;=-:->=;=6-:->;>FC?BA=EF>AH----\f-ryr-\n--------lsnp|-J->;?F?F@C>EC=C?DAB=FE=A-7-}|5rz}-<->==;=-:-C=;=9-:=;>@@?=ADBF?6H--------tlsnp|-J->;>?FEF=EC=EFB?FA>>DCB-7-}|5rz}-<->==;=-:-C=;=9-:=;=DBB>AEAF?6H--------olsnp|-J->;=H----\f----<<-调整颜色----rp@-nqwrqP|y|H----nqwrqP|y|;-J-pynz}5p|y|;-7-lsnp|9-=;=9->;=6H----nqwrqP|y|;t-J-pynz}5p|y|;t-7-tlsnp|9-=;=9->;=6H----nqwrqP|y|;o-J-pynz}5p|y|;o-7-olsnp|9-=;=9->;=6H----r{-nqwrqP|y|H\frp@-to?u5rp@-p6-\n----rpA-X-J-rpA5=;=9-:>;=-<-@;=9-?;=-<-@;=9-:>;=6H----rpA-}-J-zv\x075rpA5p;ot9-X; 69-rpA5p;to9-X;\x07\b69-r}5p;o9-p;t66H----rpA-\0-J-zv\x075rpA5};\x07\b9-p;69-rpA5p;9-};\b \x0769-r}5};\x079-p;66H----sy|n-q-J-\0;\x07-:-zv{5\0;9-\0;\b6H----sy|n-r-J->;=r:>=H----r{-rp@5no5\0; -8-5\0;-:-\0;\b6-<-5C;=-7-q-8-r669-q-<-5\0;\x07-8-r69-\0;\x076H\frp@-u?to5rp@-p6-\n----rpA-X-J-rpA5>;=9-?;=-<-@;=9->;=-<-@;=9-@;=6H----rp@-}-J-no5snp5p;\x07\x07\x07-8-X;\x07\b 6-7-C;=-:-X;6H----r{-p; -7-zv\x075X;\x07\x07\x079-pynz}5}-:-X;\x07\x07\x079-=;=9->;=69-p;\b6H\fZNV[lORS\\_R|vq-znv{56-\n--ZNV[l`aN_a--<<-JJJ-点大小剔除-JJJ--vs-5]|v{`v r-I-=;==>6-\n----qvpnqH--\f--<<-JJJ-前置裁切计算-JJJ--0vs-[bZlPYV]]R_`-K-=----o||y-pyv}}rqH----rpA-pyv}}r]|vv|{H----0}ntzn-{|yyly||}ln----s|-5-v{-v-J-=H-v-I-[bZlPYV]]R_`H-v-88-6-\n------pyv}}r]|vv|{-J-pyv}}rh-v-j;znv\x07V{rr-7-d|yq]|vv|{H------pyv}}rq-J-5pyv}}rh-v-j;sy||V{qr\x07-I-=;=-\v\v-no5sy||-:-pyv}}rh-v-j;sy||V{qr\x076-I->;=6H------pyv}}rq-J-pyv}}rq-33-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--------qvpnqH------\f----\f----0}ntzn-{|yyly||}lr{q--0r{qvs--<<-JJJJJJJJJJJJJJJJ--<<-JJJ-形状裁切-JJJ--0vs-qrsv{rq5b`Rl]\\V[al`UN]RlPV_PYR6----sy|n--J-?;=-7-tyl]|v{P||q;\x07-:->;=H----sy|n--J-?;=-7-tyl]|v{P||q;\b-:->;=H----sy|n-pp-J-7-8-7H----vs-5]|v{`v r-K-@;=-33-pp-K->;=6-\n------qvpnqH----\f--0r{qvs--<<-JJJJJJJJJJJJJ--0v{pyqr-Ipyv}}v{tl}yn{rlsntzr{K--0v{pyqr-Iy|tqr}uoslsntzr{K--<<-JJJ-颜色-JJJ--rpA-sv{nyP|y|-J-_TOa|Yv{rn5rpA5P|y|9-|}npv\b66H--0vs-qrsv{rq5b`Rl]\\V[al[\\_ZNY6----0vs-qrsv{rq5b`Rl]\\V[alONPXlUVQQR[6------rp@-pnzrnQvrpv|{-J-{|znyv r5pnzrn]|vv|{-:-d|yq]|vv|{;\x07\b 6H------vs-5q|5pnzrnQvrpv|{9-[|zny6-I-=;=6-\n--------qvpnqH------\f----0ryvs-qrsv{rq5b`Rl]\\V[alONPXlQN_X6------rp@-pnzrnQvrpv|{-J-{|znyv r5pnzrn]|vv|{-:-d|yq]|vv|{;\x07\b 6H------vs-5q|5pnzrnQvrpv|{9-[|zny6-I-=;=6-\n--------sv{nyP|y|;\x07\b -J-sv{nyP|y|;\x07\b -7-=;EH------\f----0r{qvs--0r{qvs--tylSntP|y|-J-sv{nyP|y|H--<<-JJJJJJJJJJJ--<<-JJJ-楼层显示-JJJ--sy|n-sy||\\}npv\b-J->;=H--vs-5u|{Sy||V{qr\x07-K-:=;=>-33-no5sy||-:-u|{Sy||V{qr\x076-K-=;FF6-\n----sy||\\}npv\b-J-=;>-7-zv{55>;=-8-PnzrnQvrpv|{;\b69->;=6H--\f--tylSntP|y|;n-J-tylSntP|y|;n-7-sy||\\}npv\bH--<<-JJJJJJJJJJJJJJ--tylSntP|y|;n-J-tylSntP|y|;n-7-z|qryNy}unH--ZNV[lZ\\QRYlP\\Y\\_--0v{pyqr-I|{rzn}}v{tlsntzr{K--0v{pyqr-Ir{p|qv{tlsntzr{K--<<-JJJ-颜色增益调整-JJJ--rp@-toP|y|-J-tylSntP|y|;toH--rp@-uP|y|-J-to?u5toP|y|6H--uP|y|;\b-8J-p|y|`nnv|{H--uP|y|; -8J-p|y|Ovtu{rH--tylSntP|y|;to-J-u?to5uP|y|6H--0v{pyqr-Is|tlsntzr{K--0v{pyqr-I}rzyv}yvrqlny}unlsntzr{K--0vs-qrsv{rq5b`RlRQY6----tylSntP|y|;n-J-Y|tQr}uH--0r{qvs--0vs-qrsv{rq5b`RlU^ldRVTUa6----sy|n-qvn{pr-J-?;=-7-yr{tu5tyl]|v{P||q;\x07\b-:-=;B6H----sy|n-rvtu-J-zn\x075=;=9->;=-:-qvn{pr6H----rvtu-J-}|5rvtu9->;B6H----tylSntP|y|;n-J-rvtuH----tylSntP|y|;\x07\b -J-tylSntP|y|;\x07\b -7-rvtuH--0r{qvs--ZNV[lR[Q\f"),pointCloudVertexShader=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=113,o=126,s=0,u="";return t[s].split(u).map(function(l){return l.charCodeAt(s)>o?l:String.fromCharCode((l.charCodeAt(s)+r)%o)}).join(u)}("nvor-rp@-p|y|H0vs-qrsv{rq5b`RlP\\Y\\_lP\\[`aN[a6--{vs|z-rp@-p|{n{P|y|H0r{qvs0vs-qrsv{rq5b`RlP\\Y\\_lNYaVabQR6--{vs|z-nz}yr?Q-tnqvr{ar\x07rH0r{qvs0vs-qrsv{rq5b`RlRQY6--n\bv{t-sy|n-Y|tQr}uH0r{qvs{vs|z-rp?-r|yv|{H{vs|z-sy|n-}v\x07ry_nv|H{vs|z-sy|n-}|v{`pnyrH{vs|z-sy|n-}|v{Zv{]v\x07ryH{vs|z-sy|n-}|v{Zn\x07]v\x07ryH{vs|z-sy|n-|}npv\bH{vs|z-sy|n-tr|zrvpR|H{vs|z-rp@-z|qryO|{qv{tZn\x07H{vs|z-rp@-z|qryO|{qv{tZv{Hn\bv{t-rpA-d|yq]|vv|{Hn\bv{t-rp@-PnzrnQvrpv|{Hn\bv{t-rp@-P|y|Hn\bv{t-sy|n-]|v{`v rH0vs-qrsv{rq5b`Rl]\\V[al[\\_ZNY6--n\bv{t-rp@-[|znyH0r{qvs0v{pyqr-Ip|zz|{K0v{pyqr-Is|tl}nlrr\x07K0v{pyqr-Iz|}untrl}nlrr\x07K0v{pyqr-Iy|tqr}uosl}nlrr\x07K0v{pyqr-Ipyv}}v{tl}yn{rl}nlrr\x07Krp@-trP|y|O\bUrvtu5nz}yr?Q-tnqvr{ar\x07r9-rpA-d|yq]|vv|{6-\n--sy|n--J-5d|yq]|vv|{;\b-:-z|qryO|{qv{tZv{;\b6-<-5z|qryO|{qv{tZn\x07;\b-:-z|qryO|{qv{tZv{;\b6H--r{-r\x07r?Q5tnqvr{ar\x07r9-rp?59-=;B66;toH\fZNV[lORS\\_R|vq-znv{56-\n--ZNV[l`aN_a--0v{pyqr-Iortv{lrr\x07K--d|yq]|vv|{-J-rpA5n{s|zrq9->;=6H--0vsqrs-b`RlV[`aN[PV[T----d|yq]|vv|{-J-v{n{prZnv\x07-7-d|yq]|vv|{H--0r{qvs--d|yq]|vv|{-J-z|qryZnv\x07-7-d|yq]|vv|{H--rpA-z]|vv|{-J-vrZnv\x07-7-d|yq]|vv|{H--tyl]|vv|{-J-}|wrpv|{Znv\x07-7-z]|vv|{H--0v{pyqr-Iy|tqr}uoslrr\x07K--0v{pyqr-Ipyv}}v{tl}yn{rlrr\x07K--zn@-pnzrn_|nv|{Znv\x07-J-zn@5vrZnv\x07h=jh=j9-vrZnv\x07h>jh=j9-vrZnv\x07h?jh=j9-vrZnv\x07h=jh>j9-vrZnv\x07h>jh>j9-vrZnv\x07h?jh>j9-vrZnv\x07h=jh?j9-vrZnv\x07h>jh?j9-vrZnv\x07h?jh?j6H--PnzrnQvrpv|{-J-{|znyv r5pnzrn_|nv|{Znv\x07-7-rp@5=;=9-=;=9-:>;=66H--<<传递nvor的p|y|到s里使用--<<动态调整}|v{`v r--sy|n-rny]|v{`v r-J-}|v{`pnyr-7-}v\x07ry_nv|H--0vs-qrsv{rq5b`Rl]\\V[al`VgRlTR\\ZRa_VP6----rny]|v{`v r-7J-tr|zrvpR|H----sy|n-urvtu-J->;=-<-}|wrpv|{Znv\x07h>jh>j-7-zv\x075>;=9-:z]|vv|{; 9-:}|wrpv|{Znv\x07h?jh@j6-7-?;=H----rny]|v{`v r-J-r|yv|{;\b-7-rny]|v{`v r-<-urvtuH--0ryvs-qrsv{rq5b`Rl]\\V[al`VgRlNaaR[bNaV\\[6----sy|n-urvtu-J->;=-<-}|wrpv|{Znv\x07h>jh>j-7-zv\x075>;=9-:z]|vv|{; 9-:}|wrpv|{Znv\x07h?jh@j6-7-?;=H----rny]|v{`v r-J-r|yv|{;\b-7-rny]|v{`v r-<-urvtuH--0r{qvs--tyl]|v{`v r-J-pynz}5rny]|v{`v r9-}|v{Zv{]v\x07ry-7-}v\x07ry_nv|9-}|v{Zn\x07]v\x07ry-7-}v\x07ry_nv|6H--]|v{`v r-J-tyl]|v{`v rH--P|y|-J-p|y|H--<<-JJJ-高度色-JJJ--0vs-qrsv{rq5b`RlP\\Y\\_lNYaVabQR6----P|y|-J-trP|y|O\bUrvtu5tnqvr{ar\x07r9-d|yq]|vv|{6H--0r{qvs--<<-JJJJJJJJJJJ--<<-JJJ-纯色-JJJ--0vs-qrsv{rq5b`RlP\\Y\\_lP\\[`aN[a6----P|y|-J-p|{n{P|y|H--0r{qvs--<<-JJJJJJJJJJJ--0vs-qrsv{rq5b`Rl]\\V[al[\\_ZNY6----[|zny-J-{|znyv r5zn@5z|qryZnv\x076-7-{|zny6H--0r{qvs--0vs-qrsv{rq5b`RlRQY6----Y|tQr}u-J-y|t?5:z]|vv|{; 6H--0r{qvs--0vs-qrsv{rq5b`RlU^lQR]aU6----<<-sy|n-}|wSnp|-J-:=;B-7-r|yv|{;\b-<-5n{5s|-<-?;=6-7-z]|vv|{; 6H----<<-sy|n-_nqv-J-rny]|v{`v r-<-}|wSnp|H----sy|n-|vtv{nyQr}u-J-tyl]|vv|{;H----sy|n-nqwrqQr}u-J-|vtv{nyQr}u-8-=;>H----sy|n-nqw-J-nqwrqQr}u-<-|vtv{nyQr}uH----z]|vv|{;\x07\b -J-z]|vv|{;\x07\b -7-nqwH----tyl]|vv|{-J-}|wrpv|{Znv\x07-7-z]|vv|{H--0r{qvs--0v{pyqr-I|yq}|lrr\x07K--0v{pyqr-Is|tlrr\x07K--ZNV[lR[Q\f");var pbmUniforms=Object.assign({pointScale:new THREE__namespace.Uniform(1),pointMinPixel:new THREE__namespace.Uniform(1),pointMaxPixel:new THREE__namespace.Uniform(1),opacity:new THREE__namespace.Uniform(1),gradientTexture:new THREE__namespace.Uniform(null),modelAlpha:new THREE__namespace.Uniform(0),clippers:new THREE__namespace.Uniform([]),shownFloorIndex:new THREE__namespace.Uniform(-1),constantColor:new THREE__namespace.Uniform(new THREE__namespace.Vector3),geometricError:new THREE__namespace.Uniform(0),pixelRatio:new THREE__namespace.Uniform(1),resolution:new THREE__namespace.Uniform(new THREE__namespace.Vector2(512,512)),floor:new THREE__namespace.Uniform(0),brightness:new THREE__namespace.Uniform(1),modelBoundingMin:new THREE__namespace.Uniform(new THREE__namespace.Vector3),modelBoundingMax:new THREE__namespace.Uniform(new THREE__namespace.Vector3),colorSaturation:new THREE__namespace.Uniform(0),colorBrightness:new THREE__namespace.Uniform(0)},THREE__namespace.UniformsUtils.clone(THREE__namespace.UniformsLib.fog)),PBMPointCloudMaterial=function(n){__extends(t,n);function t(e){e===void 0&&(e={});var r,o,s,u,l,c,f,d,p,v,g,h,m,y,A,E,b,T,_,R,S,M,B,H,w,C=n.call(this,{vertexShader:pointCloudVertexShader,fragmentShader:pointCloudFragmentShader,uniforms:THREE__namespace.UniformsUtils.clone(pbmUniforms),lights:!1,clipping:!0,defines:{USE_COLOR_CONSTANT:!1,USE_COLOR_ALTITUDE:!1,USE_EDL:!1,USE_HQ_WEIGHT:!1,USE_HQ_DEPTH:!1,NUM_CLIPPING_BOX:!1,USE_CLIPFLOOR:!1,USE_VERTEX_MARK:!1,USE_MAP:!0,USE_UV:!0,USE_LUMINANCE:!1,USE_BLACK_TRANSITION:!1,USE_POINT_NORMAL:!1,USE_POINT_SHAPE_CIRCLE:!1,USE_POINT_SIZE_ATTENUATION:!1,USE_POINT_SIZE_GEOMETRIC:!1,USE_POINT_BACK_HIDDEN:!1,USE_POINT_BACK_DARK:!1}})||this,L;return C.customShaderHash="",C.customShaderUniforms={},C.customShaderDefines={},Object.defineProperties(C,{constantColor:{get:function(){return this.uniforms.constantColor.value},set:function(I){this.uniforms.constantColor.value=I}},opacity:{get:function(){return this.uniforms.opacity.value},set:function(I){this.uniforms.opacity.value=I}},modelAlpha:{get:function(){return this.uniforms.modelAlpha.value},set:function(I){this.uniforms.modelAlpha.value=I}},shownFloorIndex:{get:function(){return this.uniforms.shownFloorIndex.value},set:function(I){this.uniforms.shownFloorIndex.value=I}},clippers:{get:function(){return L},set:function(I){L!==I&&(L=I,this.uniforms.clippers.value=(L||[]).map(function(F){var k=typeof F.floorIndex=="number"?F.floorIndex:-1,N=new THREE__namespace.Matrix4().getInverse(F.clippingBoxMatrix);return{matrixInverse:N,floorIndex:k}}),this.needsUpdate=!0)}},colorStyle:{get:function(){return this.defines.USE_COLOR_CONSTANT?"CONSTANT":this.defines.USE_COLOR_ALTITUDE?"ALTITUDE":"RGB"},set:function(I){var F=I==="CONSTANT",k=I==="ALTITUDE";this.defines.USE_COLOR_CONSTANT!==F&&(this.defines.USE_COLOR_CONSTANT=F,this.needsUpdate=!0),this.defines.USE_COLOR_ALTITUDE!==k&&(this.defines.USE_COLOR_ALTITUDE=k,this.needsUpdate=!0)}},pointSize:{get:function(){return this.defines.USE_POINT_SIZE_GEOMETRIC===!0?"GEOMETRIC":this.defines.USE_POINT_SIZE_ATTENUATION===!0?"ATTENUATION":"FIXED"},set:function(I){var F=I==="ATTENUATION",k=I==="GEOMETRIC";this.defines.USE_POINT_SIZE_GEOMETRIC!==k&&(this.defines.USE_POINT_SIZE_GEOMETRIC=k,this.needsUpdate=!0),this.defines.USE_POINT_SIZE_ATTENUATION!==F&&(this.defines.USE_POINT_SIZE_ATTENUATION=F,this.needsUpdate=!0)}},pointShape:{get:function(){return this.defines.USE_POINT_SHAPE_CIRCLE===!0?"CIRCLE":"SQUARE"},set:function(I){var F=I==="CIRCLE";this.defines.USE_POINT_SHAPE_CIRCLE!==F&&(this.defines.USE_POINT_SHAPE_CIRCLE=F,this.needsUpdate=!0)}},pointScale:{get:function(){return this.uniforms.pointScale.value},set:function(I){this.uniforms.pointScale.value=I}},pointBack:{get:function(){return this.defines.USE_POINT_BACK_HIDDEN===!0?"HIDDEN":this.defines.USE_POINT_BACK_DARK===!0?"DARK":"VISIBLE"},set:function(I){var F=I==="HIDDEN",k=I==="DARK";this.defines.USE_POINT_BACK_HIDDEN!==F&&(this.defines.USE_POINT_BACK_HIDDEN=F,this.needsUpdate=!0),this.defines.USE_POINT_BACK_DARK!==k&&(this.defines.USE_POINT_BACK_DARK=k,this.needsUpdate=!0)}},pointMinPixel:{get:function(){return this.uniforms.pointMinPixel.value},set:function(I){this.uniforms.pointMinPixel.value=I}},pointMaxPixel:{get:function(){return this.uniforms.pointMaxPixel.value},set:function(I){this.uniforms.pointMaxPixel.value=I}},useEDL:{get:function(){return this.defines.USE_EDL},set:function(I){I!==this.defines.USE_EDL&&(this.defines.USE_EDL=I,this.needsUpdate=!0)}},useHQWeight:{get:function(){return this.defines.USE_HQ_WEIGHT},set:function(I){I!==this.defines.USE_HQ_WEIGHT&&(this.defines.USE_HQ_WEIGHT=I,this.needsUpdate=!0)}},useHQDepth:{get:function(){return this.defines.USE_HQ_DEPTH},set:function(I){I!==this.defines.USE_HQ_DEPTH&&(this.defines.USE_HQ_DEPTH=I,this.needsUpdate=!0)}},gradientTexture:{get:function(){return this.uniforms.gradientTexture.value},set:function(I){this.uniforms.gradientTexture.value=I}},floor:{get:function(){return this.uniforms.floor.value},set:function(I){this.uniforms.floor.value=I}},brightness:{get:function(){return this.uniforms.brightness.value},set:function(I){this.uniforms.brightness.value=I}},colorSaturation:{get:function(){return this.uniforms.colorSaturation.value},set:function(I){this.uniforms.colorSaturation.value=I}},colorBrightness:{get:function(){return this.uniforms.colorBrightness.value},set:function(I){this.uniforms.colorBrightness.value=I}}}),C.pano0=(r=e.pano0)!==null&&r!==void 0?r:defaultPbmParameters.pano0,C.pano1=(o=e.pano1)!==null&&o!==void 0?o:defaultPbmParameters.pano1,C.modelAlpha=(s=e.modelAlpha)!==null&&s!==void 0?s:defaultPbmParameters.modelAlpha,C.progress=(u=e.progress)!==null&&u!==void 0?u:defaultPbmParameters.progress,C.transition=(l=e.transition)!==null&&l!==void 0?l:defaultPbmParameters.transition,C.colorStyle=(c=e.colorStyle)!==null&&c!==void 0?c:defaultPbmParameters.colorStyle,C.constantColor=(f=e.constantColor)!==null&&f!==void 0?f:defaultPbmParameters.constantColor,C.opacity=(d=e.opacity)!==null&&d!==void 0?d:defaultPbmParameters.opacity,C.floorStyle=(p=e.floorStyle)!==null&&p!==void 0?p:defaultPbmParameters.floorStyle,C.shownFloorIndex=(v=e.shownFloorIndex)!==null&&v!==void 0?v:defaultPbmParameters.shownFloorIndex,C.clippers=(g=e.clippers)!==null&&g!==void 0?g:defaultPbmParameters.clippers,C.useEDL=(h=e.useEDL)!==null&&h!==void 0?h:defaultPbmParameters.useEDL,C.useHQWeight=(m=e.useHQWeight)!==null&&m!==void 0?m:defaultPbmParameters.useHQWeight,C.useHQDepth=(y=e.useHQDepth)!==null&&y!==void 0?y:defaultPbmParameters.useHQDepth,C.pointShape=(A=e.pointShape)!==null&&A!==void 0?A:defaultPbmParameters.pointShape,C.pointSize=(E=e.pointSize)!==null&&E!==void 0?E:defaultPbmParameters.pointSize,C.pointScale=(b=e.pointScale)!==null&&b!==void 0?b:defaultPbmParameters.pointScale,C.pointBack=(T=e.pointBack)!==null&&T!==void 0?T:defaultPbmParameters.pointBack,C.pointMinPixel=(_=e.pointMinPixel)!==null&&_!==void 0?_:defaultPbmParameters.pointMinPixel,C.pointMaxPixel=(R=e.pointMaxPixel)!==null&&R!==void 0?R:defaultPbmParameters.pointMaxPixel,C.gradientTexture=(S=e.gradientTexture)!==null&&S!==void 0?S:defaultPbmParameters.gradientTexture,C.brightness=(M=e.brightness)!==null&&M!==void 0?M:defaultPbmParameters.brightness,C.colorSaturation=(B=e.colorSaturation)!==null&&B!==void 0?B:defaultPbmParameters.colorSaturation,C.colorBrightness=(H=e.colorBrightness)!==null&&H!==void 0?H:defaultPbmParameters.colorBrightness,C.customShaders=(w=e.customShaders)!==null&&w!==void 0?w:defaultPbmParameters.customShaders,C.customShaderHash="",C.floor=0,C.transparent=!0,C}return t.prototype.onBeforeCompile=function(e,r){var o,s,u=this.customShaders.filter(function(m){return m.type.includes("pointcloud")}),l=u.reduce(function(m,y){return m+y.vertex.mainBefore},""),c=u.reduce(function(m,y){return m+y.vertex.mainStart},""),f=u.reduce(function(m,y){return m+y.vertex.mainEnd},""),d=u.reduce(function(m,y){return m+y.fragment.mainBefore},""),p=u.reduce(function(m,y){return m+y.fragment.mainStart},""),v=u.reduce(function(m,y){return m+y.fragment.mainModelColor},""),g=u.reduce(function(m,y){return m+y.fragment.mainEnd},"");e.vertexShader=e.vertexShader.replace(/MAIN_BEFORE/g,l),e.fragmentShader=e.fragmentShader.replace(/MAIN_BEFORE/g,d),e.vertexShader=e.vertexShader.replace(/MAIN_START/g,c),e.fragmentShader=e.fragmentShader.replace(/MAIN_START/g,p),e.vertexShader=e.vertexShader.replace(/MAIN_END/g,f),e.fragmentShader=e.fragmentShader.replace(/MAIN_END/g,g),e.fragmentShader=e.fragmentShader.replace(/MAIN_MODEL_COLOR/g,v);var h=String((s=(o=this.clippers)===null||o===void 0?void 0:o.length)!==null&&s!==void 0?s:0);e.vertexShader=e.vertexShader.replace(/NUM_CLIPPERS/g,h),e.fragmentShader=e.fragmentShader.replace(/NUM_CLIPPERS/g,h),u.forEach(function(m){m.onBeforeCompile(e,r)})},t.prototype.update=function(e,r,o){var s="".concat(o.id,":").concat(o.materialVersion);s!==this.syncModelVersion&&(Object.assign(this,o.getMaterial()),this.syncModelVersion=s);var u=this.customShaders.map(function(A){return A.getHash()}).join("");this.customShaderHash!==u&&(this.customShaderHash=u,this.needsUpdate=!0);for(var l=this.customShaders.reduce(function(A,E){return Object.assign(A,E.defines)},{}),c=Object.keys(this.customShaderDefines),f=0,d=c;f<d.length;f++){var p=d[f];delete this.defines[p]}this.customShaderDefines=l,Object.assign(this.defines,this.customShaderDefines);for(var v=this.customShaders.reduce(function(A,E){return Object.assign(A,E.uniforms)},{}),g=Object.keys(this.customShaderUniforms),h=0,m=g;h<m.length;h++){var y=m[h];delete this.uniforms[y]}this.customShaderUniforms=v,Object.assign(this.uniforms,this.customShaderUniforms),this.visible=!0,this.transparent=!1,this.shownFloorIndex>-1&&(this.transparent=this.shownFloorIndex!==this.floor),this.modelAlpha<1&&(this.transparent=!0),this.opacity<1&&(this.transparent=!0),this.brightness<1&&(this.transparent=!0),this.depthWrite=!0,this.depthTest=!0,this.useEDL&&(this.transparent=!1),this.useHQWeight?(this.depthWrite=!1,this.blending=THREE__namespace.CustomBlending,this.blendSrc=THREE__namespace.SrcAlphaFactor,this.blendSrcAlpha=THREE__namespace.SrcAlphaFactor,this.blendDst=THREE__namespace.OneFactor,this.blendDstAlpha=THREE__namespace.OneFactor):(this.blending=THREE__namespace.NormalBlending,this.blendDst=THREE__namespace.OneMinusSrcAlphaFactor,this.blendEquation=THREE__namespace.AddEquation,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null),this.floorStyle==="VISIBILITY"&&this.shownFloorIndex!==-1&&this.floor!==this.shownFloorIndex&&(this.visible=!1),this.uniforms.pixelRatio.value=r.pixelRatio,this.uniforms.resolution.value.copy(r.resolution),this.uniforms.modelBoundingMax.value.copy(o.bounding.max),this.uniforms.modelBoundingMin.value.copy(o.bounding.min)},t.prototype.copy=function(e){return n.prototype.copy.call(this,this),this.customShaders=e.customShaders,this.pano0=e.pano0,this.pano1=e.pano1,this.progress=e.progress,this.transition=e.transition,this.floorStyle=e.floorStyle,this.shownFloorIndex=e.shownFloorIndex,this.brightness=e.brightness,this.clippers=e.clippers,this.constantColor=e.constantColor,this.modelAlpha=e.modelAlpha,this.useEDL=e.useEDL,this.useHQWeight=e.useHQWeight,this.useHQDepth=e.useHQDepth,this.colorStyle=e.colorStyle,this.pointSize=e.pointSize,this.pointShape=e.pointShape,this.pointScale=e.pointScale,this.pointBack=e.pointBack,this.pointMinPixel=e.pointMinPixel,this.pointMaxPixel=e.pointMaxPixel,this.gradientTexture=e.gradientTexture,this.colorSaturation=e.colorSaturation,this.colorBrightness=e.colorBrightness,this},t}(THREE__namespace.ShaderMaterial),InternalWebGLRenderer=function(n){__extends(t,n);function t(e){var r=e.preserveDrawingBuffer,o=r===void 0?!0:r,s=e.premultipliedAlpha,u=s===void 0?!0:s,l=e.stencil,c=l===void 0?!0:l,f=e.backgroundColor,d=f===void 0?1579548:f,p=e.backgroundAlpha,v=p===void 0?1:p,g=e.pixelRatio,h=g===void 0?1:g,m=e.antialias,y=m===void 0?!1:m,A=e.webgl2,E=e.logarithmicDepthBuffer,b=e.precision,T=e.powerPreference,_=this,R={antialias:y,alpha:!0,depth:!0,preserveDrawingBuffer:o,stencil:c,premultipliedAlpha:u,powerPreference:T},S={logarithmicDepthBuffer:E,precision:b};if(A){var M=document.createElement("canvas"),B=M.getContext("webgl2",R);B?_=n.call(this,__assign(__assign(__assign({},R),S),{antialias:!0,canvas:M,context:B}))||this:(console.error("error occurred when getting webgl2 canvas context, mybe webgl2 not support, fallback to webgl."),_=n.call(this,__assign(__assign({},R),S))||this)}else _=n.call(this,__assign(__assign({},R),S))||this;return _.setPixelRatio(h),_.setClearColor(d,v),_.outputEncoding=THREE__namespace.sRGBEncoding,_.autoClear=!0,_}return t}(THREE__namespace.WebGLRenderer),Scene=function(n){__extends(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t.prototype.add=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return n.prototype.add.apply(this,e)},t.prototype.remove=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return n.prototype.remove.apply(this,e)},t}(THREE__namespace.Scene);function coordinatesToVector(n,t){var e=Math.abs(Math.cos(n.latitude)),r=-Math.sin(n.longitude)*e,o=-Math.sin(n.latitude),s=-Math.cos(n.longitude)*e;return t?t.set(r,o,s):new THREE__namespace.Vector3(r,o,s)}var DEFAULT_ASPECT=1,DEFAULT_NEAR=.1,DEFAULT_FAR=2e3,TAU$2=Math.PI*2,PI_2=Math.PI/2;function formatRad$1(n){return n>0&&n<=TAU$2?n:(n%TAU$2+TAU$2)%TAU$2}function matrixLerp(n,t,e,r){e=Math.pow(e,4);for(var o=0;o<16;o++)r.elements[o]=n.elements[o]+(t.elements[o]-n.elements[o])*e;return r}var Camera=function(n){__extends(t,n);function t(e,r,o,s,u,l,c){r===void 0&&(r=DEFAULT_ASPECT),o===void 0&&(o=DEFAULT_NEAR),s===void 0&&(s=DEFAULT_FAR),u===void 0&&(u=new THREE__namespace.Vector2),l===void 0&&(l=new THREE__namespace.Vector2(512,512)),c===void 0&&(c=1);var f=n.call(this)||this;f.fov=e,f.aspect=r,f.near=o,f.far=s,f.perspToOrtho=u,f.resolution=l,f.pixelRatio=c,f.time=0,f.needsRender=!0,f.refineModel=!0,f.pose={longitude:0,latitude:0,fov:e,distance:0,offset:new THREE__namespace.Vector3},f.computePose(),f.perspectiveCamera=new THREE__namespace.PerspectiveCamera(f.fov,f.aspect,.001,f.far);var d=Math.max(f.orthoDistance,.01)*Math.tan(.5*f.fov/180*Math.PI),p=-.5*f.aspect*2*d;return f.orthographicCamera=new THREE__namespace.OrthographicCamera(p,-p,d,-d,.001,f.far),f.computeProjectionMatrix(),f.lastValues={position:f.position.clone(),quaternion:f.quaternion.clone(),scale:f.scale.clone(),fov:f.fov,aspect:f.aspect,near:f.near,far:f.far,orthoDistance:f.orthoDistance,perspToOrtho:f.perspToOrtho.clone()},f.type=f.perspToOrtho.x<1?"PerspectiveCamera":"OrthographicCamera",f.autoNearFar=!0,f}return Object.defineProperty(t.prototype,"orthoDistance",{get:function(){return this.pose.distance>1?this.pose.distance:1+(this.pose.distance-1)*this.perspToOrtho.x},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"zoom",{get:function(){return this.type==="OrthographicCamera"?this.orthographicCamera.zoom:this.type==="PerspectiveCamera"?this.perspectiveCamera.zoom:1},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"top",{get:function(){return this.type==="OrthographicCamera"?this.orthographicCamera.top:0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"bottom",{get:function(){return this.type==="OrthographicCamera"?this.orthographicCamera.bottom:0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"left",{get:function(){return this.type==="OrthographicCamera"?this.orthographicCamera.left:0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"right",{get:function(){return this.type==="OrthographicCamera"?this.orthographicCamera.right:0},enumerable:!1,configurable:!0}),t.prototype.getDirection=function(e){return coordinatesToVector(this.pose,e)},t.prototype.computePose=function(e){e===void 0&&(e=0),this.updateMatrix();var r=this.matrix.elements;return this.pose.latitude=Math.asin(clamp$1(r[9],-1,1)),Math.abs(r[9])<.9999999?this.pose.longitude=formatRad$1(Math.atan2(r[8],r[10])):this.pose.longitude=formatRad$1(Math.atan2(-r[2],r[0])),this.pose.fov=this.fov,this.pose.distance=e,this.pose.offset=new THREE__namespace.Vector3(-r[8],-r[9],-r[10]).setLength(this.pose.distance).add(this.position),this},t.prototype.setFromPose=function(e){var r,o,s,u,l,c=formatRad$1((r=e.longitude)!==null&&r!==void 0?r:this.pose.longitude),f=Math.max(-PI_2+1e-4,Math.min(PI_2-1e-4,(o=e.latitude)!==null&&o!==void 0?o:this.pose.latitude)),d=(s=e.fov)!==null&&s!==void 0?s:this.pose.fov,p=(u=e.distance)!==null&&u!==void 0?u:this.pose.distance,v=(l=e.offset)!==null&&l!==void 0?l:this.pose.offset,g=coordinatesToVector({longitude:c,latitude:f}).normalize();return this.position.set(0,0,0),this.lookAt(g),this.position.add(v).sub(g.clone().setLength(p)),this.fov!==d&&(this.fov=d,this.updateProjectionMatrix()),this.updateMatrixWorld(!0),this.pose.longitude=c,this.pose.latitude=f,this.pose.fov=d,this.pose.distance=p,this.pose.offset.copy(v),this.needsRender=!0,this},t.prototype.copyPose=function(){return{longitude:this.pose.longitude,latitude:this.pose.latitude,fov:this.pose.fov,distance:this.pose.distance,offset:this.pose.offset.clone()}},t.prototype.computeProjectionMatrix=function(){matrixLerp(this.orthographicCamera.projectionMatrix,this.perspectiveCamera.projectionMatrix,1-this.perspToOrtho.x,this.projectionMatrix),this.projectionMatrixInverse.getInverse(this.projectionMatrix),this.needsRender=!0},t.prototype.setViewOffset=function(e,r,o,s,u,l){this.perspectiveCamera.setViewOffset(e,r,o,s,u,l),this.orthographicCamera.setViewOffset(e,r,o,s,u,l),this.computeProjectionMatrix()},t.prototype.clearViewOffset=function(){this.perspectiveCamera.clearViewOffset(),this.orthographicCamera.clearViewOffset(),this.computeProjectionMatrix()},t.prototype.updateProjectionMatrix=function(){this.perspectiveCamera.updateProjectionMatrix(),this.orthographicCamera.updateProjectionMatrix(),this.computeProjectionMatrix()},Object.defineProperty(t.prototype,"perspectiveProjectionMatrix",{get:function(){return this.perspectiveCamera.projectionMatrix},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"perspectiveProjectionMatrixInverse",{get:function(){return this.perspectiveCamera.projectionMatrixInverse},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"orthographicProjectionMatrix",{get:function(){return this.orthographicCamera.projectionMatrix},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"orthographicProjectionMatrixInverse",{get:function(){return this.orthographicCamera.projectionMatrixInverse},enumerable:!1,configurable:!0}),t.prototype.updateTime=function(e){this.time=e;var r=!1;if((this.lastValues.fov!==this.fov||this.lastValues.near!==this.near||this.lastValues.far!==this.far||this.lastValues.aspect!==this.aspect)&&(this.perspectiveCamera.fov=this.fov,this.perspectiveCamera.near=this.near,this.perspectiveCamera.far=this.far,this.perspectiveCamera.aspect=this.aspect,this.perspectiveCamera.updateProjectionMatrix(),r=!0),!this.lastValues.position.equals(this.position)||!this.lastValues.quaternion.equals(this.quaternion)||!this.lastValues.scale.equals(this.scale)||!this.lastValues.perspToOrtho.equals(this.perspToOrtho)||this.lastValues.fov!==this.fov||this.lastValues.near!==this.near||this.lastValues.far!==this.far||this.lastValues.orthoDistance!==this.orthoDistance||this.lastValues.aspect!==this.aspect){var o=Math.max(this.orthoDistance,.01)*Math.tan(.5*this.fov/180*Math.PI),s=-.5*this.aspect*2*o;this.orthographicCamera.left=s,this.orthographicCamera.right=-s,this.orthographicCamera.top=o,this.orthographicCamera.bottom=-o,this.orthographicCamera.near=this.near,this.orthographicCamera.far=this.far,this.orthographicCamera.updateProjectionMatrix(),r=!0}r&&this.computeProjectionMatrix(),this.lastValues.position.copy(this.position),this.lastValues.quaternion.copy(this.quaternion),this.lastValues.scale.copy(this.scale),this.lastValues.fov=this.fov,this.lastValues.aspect=this.aspect,this.lastValues.near=this.near,this.lastValues.far=this.far,this.lastValues.orthoDistance=this.orthoDistance,this.lastValues.perspToOrtho.copy(this.perspToOrtho),this.type=this.perspToOrtho.x<1?"PerspectiveCamera":"OrthographicCamera"},Object.defineProperty(t.prototype,"isPerspectiveCamera",{get:function(){return this.perspToOrtho.x<1},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isOrthographicCamera",{get:function(){return this.perspToOrtho.x>=1},enumerable:!1,configurable:!0}),t.prototype.copy=function(e,r){return n.prototype.copy.call(this,e,r),this.fov=e.fov,this.aspect=e.aspect,this.near=e.near,this.far=e.far,this.perspToOrtho.copy(e.perspToOrtho),this.updateTime(now()),this},t}(THREE__namespace.Camera),VolumePlaneIntersect;(function(n){n[n.Outside=-1]="Outside",n[n.Intersecting=0]="Intersecting",n[n.Inside=1]="Inside"})(VolumePlaneIntersect||(VolumePlaneIntersect={}));var EPSILON$2=1e-6,scratchVector=new THREE__namespace.Vector3,scratchMatrix4$4=new THREE__namespace.Matrix4,scratchXAxis=new THREE__namespace.Vector3,scratchYAxis=new THREE__namespace.Vector3,scratchZAxis=new THREE__namespace.Vector3,scratchSize=new THREE__namespace.Vector3,scratchBox3=new THREE__namespace.Box3,scratchSphere$1=new THREE__namespace.Sphere,scratchMatrix4Inverse$1=new THREE__namespace.Matrix4,scratchRay$1=new THREE__namespace.Ray,scratchObject3D=new THREE__namespace.Object3D,scratchFrustum=new THREE__namespace.Frustum;function quaternionFromMatrix3(n,t){var e=n.elements;return t.setFromRotationMatrix(scratchMatrix4$4.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1)),t}var CullingVolume=function(){function n(t){t===void 0&&(t=[]),this.planes=t}return Object.defineProperty(n,"MASK_OUTSIDE",{get:function(){return 4294967295},enumerable:!1,configurable:!0}),Object.defineProperty(n,"MASK_INSIDE",{get:function(){return 0},enumerable:!1,configurable:!0}),Object.defineProperty(n,"MASK_INDETERMINATE",{get:function(){return 2147483647},enumerable:!1,configurable:!0}),n.prototype.setFromFrustum=function(t){return this.planes=t.planes.map(function(e){return e.clone()}),this},n.prototype.setFromCamera=function(t){return scratchMatrix4$4.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),scratchFrustum.setFromProjectionMatrix(scratchMatrix4$4),this.setFromFrustum(scratchFrustum),this},n.prototype.applyMatrix4=function(t){for(var e=0,r=this.planes;e<r.length;e++){var o=r[e];o.applyMatrix4(t)}},n.prototype.copy=function(t){return this.planes=t.planes.map(function(e){return e.clone()}),this},n.prototype.clone=function(){return new n().copy(this)},n.prototype.computeVisibility=function(t){for(var e=VolumePlaneIntersect.Inside,r=0,o=this.planes;r<o.length;r++){var s=o[r],u=t.intersectPlane(s);switch(u){case VolumePlaneIntersect.Outside:return VolumePlaneIntersect.Outside;case VolumePlaneIntersect.Intersecting:e=VolumePlaneIntersect.Intersecting;break}}return e},n.prototype.computeVisibilityWithPlaneMask=function(t,e){if(e===n.MASK_OUTSIDE||e===n.MASK_INSIDE)return e;for(var r=n.MASK_INSIDE,o=Math.min(32,this.planes.length),s=0;s<o;++s){var u=1<<s;if(e&u){var l=this.planes[s],c=t.intersectPlane(l);if(c===VolumePlaneIntersect.Outside)return n.MASK_OUTSIDE;c===VolumePlaneIntersect.Intersecting&&(r|=u)}}return r},n}(),BoxBoundingVolume=function(){function n(){this.type="box",this.center=new THREE__namespace.Vector3,this.halfSize=new THREE__namespace.Vector3,this.rotation=new THREE__namespace.Matrix3}return n.prototype.fromJson=function(t){var e=t.box;this.center.set(e[0],e[1],e[2]);var r=e[3],o=e[4],s=e[5],u=e[6],l=e[7],c=e[8],f=e[9],d=e[10],p=e[11],v=Math.sqrt(r*r+o*o+s*s),g=Math.sqrt(u*u+l*l+c*c),h=Math.sqrt(f*f+d*d+p*p);this.halfSize.set(v,g,h);var m=this.halfSize.toArray().reduce(function(y,A){return y+A},0);return(isNaN(m)||m<=0)&&this.halfSize.setScalar(EPSILON$2),this.rotation.fromArray([r/v,o/v,s/v,u/g,l/g,c/g,f/h,d/h,p/h]),isNaN(this.rotation.toArray().reduce(function(y,A){return y+A},0))&&this.rotation.identity(),this},n.prototype.toJson=function(){return this.rotation.extractBasis(scratchXAxis,scratchYAxis,scratchZAxis),{box:__spreadArray(__spreadArray(__spreadArray(__spreadArray([],this.center.toArray(),!0),scratchXAxis.multiplyScalar(this.halfSize.x).toArray(),!0),scratchYAxis.multiplyScalar(this.halfSize.y).toArray(),!0),scratchZAxis.multiplyScalar(this.halfSize.z).toArray(),!0)}},n.prototype.copy=function(t){return this.center.copy(t.center),this.halfSize.copy(t.halfSize),this.rotation.copy(t.rotation),this},n.prototype.clone=function(){return new n().copy(this)},n.prototype.applyMatrix4=function(t){return scratchObject3D.position.copy(this.center),quaternionFromMatrix3(this.rotation,scratchObject3D.quaternion),scratchObject3D.scale.copy(this.halfSize),scratchObject3D.matrix.compose(scratchObject3D.position,scratchObject3D.quaternion,scratchObject3D.scale),scratchObject3D.matrix.premultiply(t),scratchObject3D.matrix.decompose(scratchObject3D.position,scratchObject3D.quaternion,scratchObject3D.scale),this.center.copy(scratchObject3D.position),this.rotation.setFromMatrix4(scratchMatrix4$4.makeRotationFromQuaternion(scratchObject3D.quaternion)),this.halfSize.copy(scratchObject3D.scale),this},n.prototype.getCenter=function(t){return t.copy(this.center)},n.prototype.distanceSquaredToPoint=function(t){var e=this.rotation.elements,r=t.x-this.center.x,o=t.y-this.center.y,s=t.z-this.center.z,u=0,l;return l=r*e[0]+o*e[1]+s*e[2],l<0&&(l=-l),l-=this.halfSize.x,l>0&&(u+=l*l),l=r*e[3]+o*e[4]+s*e[5],l<0&&(l=-l),l-=this.halfSize.y,l>0&&(u+=l*l),l=r*e[6]+o*e[7]+s*e[8],l<0&&(l=-l),l-=this.halfSize.z,l>0&&(u+=l*l),u},n.prototype.distanceToPoint=function(t){return Math.sqrt(this.distanceSquaredToPoint(t))},n.prototype.distanceToPlane=function(t){var e=t.projectPoint(this.center,new THREE__namespace.Vector3);return this.distanceToPoint(e)},n.prototype.getBoundingBox=function(t){return t.makeEmpty(),this.rotation.extractBasis(scratchXAxis,scratchYAxis,scratchZAxis),scratchXAxis.setLength(this.halfSize.x),scratchYAxis.setLength(this.halfSize.y),scratchZAxis.setLength(this.halfSize.z),t.expandByPoint(scratchVector.copy(this.center).add(scratchXAxis)),t.expandByPoint(scratchVector.copy(this.center).sub(scratchXAxis)),t.expandByPoint(scratchVector.copy(this.center).add(scratchYAxis)),t.expandByPoint(scratchVector.copy(this.center).sub(scratchYAxis)),t.expandByPoint(scratchVector.copy(this.center).add(scratchZAxis)),t.expandByPoint(scratchVector.copy(this.center).sub(scratchZAxis)),t},n.prototype.toGeometry=function(){var t=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]),e=new Float32Array(8*3);scratchVector.set(this.halfSize.x,this.halfSize.y,this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,0),scratchVector.set(-this.halfSize.x,this.halfSize.y,this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,3),scratchVector.set(-this.halfSize.x,-this.halfSize.y,this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,6),scratchVector.set(this.halfSize.x,-this.halfSize.y,this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,9),scratchVector.set(this.halfSize.x,this.halfSize.y,-this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,12),scratchVector.set(-this.halfSize.x,this.halfSize.y,-this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,15),scratchVector.set(-this.halfSize.x,-this.halfSize.y,-this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,18),scratchVector.set(this.halfSize.x,-this.halfSize.y,-this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,21);var r=new THREE__namespace.BufferGeometry;return r.setIndex(new THREE__namespace.BufferAttribute(t,1)),r.setAttribute("position",new THREE__namespace.BufferAttribute(e,3)),r.computeBoundingBox(),r.computeBoundingSphere(),r},n.prototype.intersectPlane=function(t){var e=this.center,r=t.normal,o=this.rotation.elements,s=this.halfSize,u=r.x,l=r.y,c=r.z,f=Math.abs(u*o[0]*s.x+l*o[1]*s.x+c*o[2]*s.x)+Math.abs(u*o[3]*s.y+l*o[4]*s.y+c*o[5]*s.y)+Math.abs(u*o[6]*s.z+l*o[7]*s.z+c*o[8]*s.z),d=r.dot(e)+t.constant;return d<=-f?VolumePlaneIntersect.Outside:d>=f?VolumePlaneIntersect.Inside:VolumePlaneIntersect.Intersecting},n.prototype.intersectRay=function(t,e){if(scratchSize.copy(this.halfSize).multiplyScalar(2),scratchBox3.setFromCenterAndSize(scratchVector.set(0,0,0),scratchSize),this.rotation.extractBasis(scratchXAxis,scratchYAxis,scratchZAxis),scratchMatrix4$4.makeBasis(scratchXAxis,scratchYAxis,scratchZAxis),scratchMatrix4$4.setPosition(this.center),scratchMatrix4Inverse$1.getInverse(scratchMatrix4$4),scratchRay$1.copy(t).applyMatrix4(scratchMatrix4Inverse$1),scratchBox3.containsPoint(scratchRay$1.origin))return!0;var r=scratchRay$1.intersectBox(scratchBox3,scratchVector);return r?e!==void 0?r.applyMatrix4(scratchMatrix4$4).distanceTo(t.origin)<e:!0:!1},n}(),SphereBoundingVolume=function(){function n(){this.type="sphere",this.center=new THREE__namespace.Vector3,this.radius=-1}return n.prototype.fromJson=function(t){var e=t.sphere;return this.center.set(e[0],e[1],e[2]),this.radius=Math.max(e[3],EPSILON$2),this},n.prototype.toJson=function(){return{sphere:__spreadArray(__spreadArray([],this.center.toArray(),!0),[this.radius],!1)}},n.prototype.copy=function(t){return this.center.copy(t.center),this.radius=t.radius,this},n.prototype.clone=function(){return new n().copy(this)},n.prototype.getBoundingBox=function(t){return t.setFromCenterAndSize(this.center,scratchSize.set(1,1,1).multiplyScalar(this.radius*2)),t},n.prototype.toGeometry=function(){for(var t=32,e=new Float32Array(t*3*2*2),r=0;r<=t;r++){var o=0;o=r/t*Math.PI*2,e[r*6+0]=this.center.x+Math.cos(o)*this.radius,e[r*6+1]=this.center.y+Math.sin(o)*this.radius,e[r*6+2]=this.center.z+0,o=(r+1)/t*Math.PI*2,e[r*6+3]=this.center.x+Math.cos(o)*this.radius,e[r*6+4]=this.center.y+Math.sin(o)*this.radius,e[r*6+5]=this.center.z+0}for(var r=t;r<=t*2;r++){var o=0;o=r/t*Math.PI*2,e[r*6+0]=this.center.x+Math.cos(o)*this.radius,e[r*6+1]=this.center.y+0,e[r*6+2]=this.center.z+Math.sin(o)*this.radius,o=(r+1)/t*Math.PI*2,e[r*6+3]=this.center.x+Math.cos(o)*this.radius,e[r*6+4]=this.center.y+0,e[r*6+5]=this.center.z+Math.sin(o)*this.radius}var s=new THREE__namespace.BufferGeometry;return s.setAttribute("position",new THREE__namespace.BufferAttribute(e,3)),s.computeBoundingBox(),s.computeBoundingSphere(),s},n.prototype.applyMatrix4=function(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this},n.prototype.getCenter=function(t){return t.copy(this.center)},n.prototype.distanceSquaredToPoint=function(t){var e=this.distanceToPoint(t);return e*e},n.prototype.distanceToPoint=function(t){var e=this.center.distanceTo(t)-this.radius;return e<=0?0:e},n.prototype.distanceToPlane=function(t){var e=Math.abs(t.distanceToPoint(this.center));return Math.max(0,e-this.radius)},n.prototype.intersectPlane=function(t){var e=this.center,r=this.radius,o=t.normal,s=o.dot(e)+t.constant;return s<-r?VolumePlaneIntersect.Outside:s<r?VolumePlaneIntersect.Intersecting:VolumePlaneIntersect.Inside},n.prototype.intersectRay=function(t,e){if(scratchSphere$1.set(this.center,this.radius),scratchSphere$1.containsPoint(t.origin))return!0;var r=t.intersectSphere(scratchSphere$1,scratchVector);return r?e!==void 0?t.origin.distanceTo(r)<e:!0:!1},n}(),RegionBoundingVolume=function(){function n(){throw this.type="regin",this.west=0,this.south=0,this.east=0,this.north=0,this.minHeight=0,this.maxHeight=0,new Error("Region bounding volume not supported.")}return n.prototype.fromJson=function(t){var e=t.region;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},n.prototype.toJson=function(){return{region:[this.west,this.south,this.east,this.north,this.minHeight,this.maxHeight]}},n.prototype.copy=function(t){return this.west=t.west,this.south=t.south,this.east=t.east,this.north=t.north,this.minHeight=t.minHeight,this.maxHeight=t.maxHeight,this},n.prototype.clone=function(){return new n().copy(this)},n.prototype.getBoundingBox=function(t){throw new Error("not implemented")},n.prototype.toGeometry=function(){throw new Error("not implemented")},n.prototype.applyMatrix4=function(t){throw new Error("not implemented")},n.prototype.getCenter=function(t){throw new Error("not implemented")},n.prototype.distanceToPoint=function(t){throw new Error("not implemented")},n.prototype.distanceSquaredToPoint=function(t){throw new Error("not implemented")},n.prototype.distanceToPlane=function(t){throw new Error("not implemented")},n.prototype.intersectPlane=function(t){throw new Error("not implemented")},n.prototype.intersectRay=function(t){throw new Error("not implemented")},n}();function isBoundingVolume(n){return n instanceof BoxBoundingVolume||n instanceof SphereBoundingVolume||n instanceof RegionBoundingVolume}function makeBoundingVolume(n){if("box"in n)return new BoxBoundingVolume().fromJson(n);if("sphere"in n)return new SphereBoundingVolume().fromJson(n);if("region"in n)return new RegionBoundingVolume().fromJson(n);throw new Error("BoundingVolume ".concat(JSON.stringify(n)," never suppored."))}var debugMaterials=[4821759,8191922,16637280,16739958,5822969,376977,16747077,9259235,14514687].map(function(n){return new THREE__namespace.LineBasicMaterial({color:n,depthWrite:!1,depthTest:!1,transparent:!0})}),debugBoxGeometry=function(){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]),t=new Float32Array(8*3);scratchVector.set(1,1,1).toArray(t,0),scratchVector.set(-1,1,1).toArray(t,3),scratchVector.set(-1,-1,1).toArray(t,6),scratchVector.set(1,-1,1).toArray(t,9),scratchVector.set(1,1,-1).toArray(t,12),scratchVector.set(-1,1,-1).toArray(t,15),scratchVector.set(-1,-1,-1).toArray(t,18),scratchVector.set(1,-1,-1).toArray(t,21);var e=new THREE__namespace.BufferGeometry;return e.setIndex(new THREE__namespace.BufferAttribute(n,1)),e.setAttribute("position",new THREE__namespace.BufferAttribute(t,3)),e.computeBoundingBox(),e.computeBoundingSphere(),e}(),debugSphereGeometry=function(){for(var n=32,t=new Float32Array(n*3*2*2),e=0;e<=n;e++){var r=0;r=e/n*Math.PI*2,t[e*6+0]=Math.cos(r),t[e*6+1]=Math.sin(r),t[e*6+2]=0,r=(e+1)/n*Math.PI*2,t[e*6+3]=Math.cos(r),t[e*6+4]=Math.sin(r),t[e*6+5]=0}for(var e=n;e<=n*2;e++){var r=0;r=e/n*Math.PI*2,t[e*6+0]=Math.cos(r),t[e*6+1]=0,t[e*6+2]=Math.sin(r),r=(e+1)/n*Math.PI*2,t[e*6+3]=Math.cos(r),t[e*6+4]=0,t[e*6+5]=Math.sin(r)}var o=new THREE__namespace.BufferGeometry;return o.setAttribute("position",new THREE__namespace.BufferAttribute(t,3)),o.computeBoundingBox(),o.computeBoundingSphere(),o}();function createDebugBoundingMesh(n,t){if(n instanceof BoxBoundingVolume){var e=new THREE__namespace.LineSegments(debugBoxGeometry,debugMaterials[Math.min(t,debugMaterials.length-1)]);return e.position.copy(n.center),quaternionFromMatrix3(n.rotation,e.quaternion),e.scale.set(n.halfSize.x,n.halfSize.y,n.halfSize.z),e.matrix.compose(e.position,e.quaternion,e.scale),e}else if(n instanceof SphereBoundingVolume){var e=new THREE__namespace.LineSegments(debugSphereGeometry,debugMaterials[Math.min(t,debugMaterials.length-1)]);return e.position.copy(n.center),e.scale.set(n.radius,n.radius,n.radius),e.matrix.compose(e.position,e.quaternion,e.scale),e}throw new Error("never")}var scratchVector3$4=new THREE__namespace.Vector3,Tile=function(){function n(t,e,r,o){var s=this,u,l,c,f;this.parent=null,this.contentParent=null,this.floor=0,this.id=t,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=o!=null?o:null,this.contentParent=o?o.hasRenderContent?o:o.contentParent:null,this.level=this.parent?this.parent.level+1:0,this.tileset=r,this.refine=(u=e.refine)!==null&&u!==void 0?u:this.parent?this.parent.refine:"REPLACE",this.transform=new THREE__namespace.Matrix4,e.transform&&this.transform.fromArray(e.transform),this.parent&&this.transform.premultiply(this.parent.transform),typeof e.geometricError=="number"?this.geometricError=e.geometricError*this.transform.getMaxScaleOnAxis():this.geometricError=(c=(l=this.parent)===null||l===void 0?void 0:l.geometricError)!==null&&c!==void 0?c:0,e.content&&e.content.uri?(this.content={uri:e.content.uri,loadState:"UNLOADED",loadStateUpdateTime:now(),loadfailRetryDelay:0,byteLength:0},e.content.group!==void 0&&(this.content.group=e.content.group),e.content.boundingVolume&&(this.content.boundingVolume=makeBoundingVolume(e.content.boundingVolume).applyMatrix4(this.transform)),/\.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=this.levelOfContent+1),e.boundingVolume&&(this.boundingVolume=makeBoundingVolume(e.boundingVolume).applyMatrix4(this.transform)),e.viewerRequestVolume&&(this.viewerRequestVolume=makeBoundingVolume(e.viewerRequestVolume).applyMatrix4(this.transform)),this.extras=(f=e.extras)!==null&&f!==void 0?f:{},typeof this.extras.floor!="number"&&o&&typeof o.extras.floor=="number"&&(this.extras.floor=o.extras.floor),typeof this.extras.floor=="number"&&(this.floor=this.extras.floor,this.tileset.floorLength=Math.max(this.tileset.floorLength,this.floor+1)),this.boundingVolume&&(this.boundingVolumeDebugObject=createDebugBoundingMesh(this.boundingVolume,this.levelOfContent)),e.children?this.children=e.children.map(function(d,p){return new n("".concat(s.id,".").concat(p),d,r,s)}):this.children=[]}return n.prototype.traverse=function(t){t(this);for(var e=0,r=this.children;e<r.length;e++){var o=r[e];o.traverse(t)}},n.prototype.updateState=function(t){this.state.frameNumber=t.frameNumber;var e=this.tileset.transformIsIdentity?null:this.tileset.transform;if(this.boundingVolume){var r=e?this.boundingVolume.clone().applyMatrix4(e):this.boundingVolume;if(t.camera.type==="OrthographicCamera"){var o=new THREE__namespace.Plane().setFromNormalAndCoplanarPoint(t.camera.direction,t.camera.position);this.state.distanceToCamera=r.distanceToPlane(o)}else this.state.distanceToCamera=r.distanceToPoint(t.camera.position);var s=r.getCenter(scratchVector3$4).sub(t.camera.position);this.state.centerZDepth=t.camera.direction.dot(s),this.state.centerScreenY=t.camera.up.dot(s);var u=this.parent?this.parent.state.visibilityPlaneMask:CullingVolume.MASK_INDETERMINATE;this.state.visibilityPlaneMask=t.cullingVolume.computeVisibilityWithPlaneMask(r,u),this.state.visible=this.state.visibilityPlaneMask!==CullingVolume.MASK_OUTSIDE}else this.state.distanceToCamera=0,this.state.centerZDepth=0,this.state.visibilityPlaneMask=CullingVolume.MASK_INDETERMINATE,this.state.visible=!0;if(this.levelOfContent<=t.minLevelOfDetail&&(this.state.visible=!0),this.viewerRequestVolume){var l=e?this.viewerRequestVolume.clone().applyMatrix4(e):this.viewerRequestVolume;this.state.inRequestVolume=l.distanceSquaredToPoint(t.camera.position)<=0}else this.state.inRequestVolume=!0;this.state.screenSpaceError=this.getScreenSpaceError(t,this.state.distanceToCamera,!1)},Object.defineProperty(n.prototype,"selected",{get:function(){return this.state.selectedFrameNumber===this.tileset.frameNumber},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"hasChildren",{get:function(){return this.children.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"siblingIndex",{get:function(){var t,e;return(e=(t=this.parent)===null||t===void 0?void 0:t.children.indexOf(this))!==null&&e!==void 0?e:0},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"hasTilesetContent",{get:function(){return this.children.length>0&&this.type==="TILESET"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"hasRenderContent",{get:function(){return this.type==="SCENEGRAPH"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"contentAvailable",{get:function(){var t;return this.hasRenderContent&&((t=this.content)===null||t===void 0?void 0:t.loadState)==="READY"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"hasUnloadedContent",{get:function(){var t;return((t=this.content)===null||t===void 0?void 0:t.loadState)==="UNLOADED"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"hasEmptyContent",{get:function(){return this.type==="EMPTY"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"contentReady",{get:function(){var t;return((t=this.content)===null||t===void 0?void 0:t.loadState)==="READY"||this.hasEmptyContent},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"contentByteLength",{get:function(){return this.content?this.content.byteLength:0},enumerable:!1,configurable:!0}),n.prototype.getScreenSpaceError=function(t,e,r){var o=this.tileset.transformIsIdentity?1:this.tileset.transform.getMaxScaleOnAxis(),s=this.parent?this.parent.geometricError:this.tileset.geometricError,u=o*(r?s:this.geometricError);if(u===0)return 0;var l=Math.max(e,.001),c=u*t.height/(l*t.sseDenominator);return c},n.prototype.getPriority=function(){var t=this.refine==="ADD"||this.tileset.skipLevelOfDetail;if(t&&!this.state.visible||this.tileset.frameNumber-this.state.touchedFrameNumber>=1)return-1;var e=this.parent,r=e&&(!t||this.state.screenSpaceError===0),o=r?e.state.screenSpaceError:this.state.screenSpaceError,s=this.tileset.root?this.tileset.root.state.screenSpaceError:0,u=Math.max(s-o,0);return u},n}(),priorityCache=new Map;function getPriority(n,t){if(t&&t.has(n))return t.get(n);var e=n.refine==="ADD"||n.tileset.skipLevelOfDetail,r=n.parent,o=r&&(!e||n.state.screenSpaceError===0),s=o?r.state.screenSpaceError:n.state.screenSpaceError,u=n.tileset.root?n.tileset.root.state.screenSpaceError:0,l=Math.max(u-s,0);return t&&t.set(n,l),l}var TileRequestScheduler=function(){function n(t,e){this.tileset=t,this.options=e,this.activeRequests=0,this.requestQueue=[]}return n.prototype.reset=function(){for(var t=0,e=this.requestQueue;t<e.length;t++){var r=e[t];this.options.onTileSkip&&this.options.onTileSkip(r.tile)}this.requestQueue.length=0},n.prototype.update=function(t,e,r){for(var o=this,s=r.time,u=this.requestQueue,l=new Set(t),c=0;c<u.length;c++){var f=u[c];if(l.has(f.tile)){l.delete(f.tile);continue}f.status==="WAITING"&&(u.splice(c,1),c--,this.options.onTileSkip&&this.options.onTileSkip(f.tile))}l.size>0&&(l.forEach(function(A){u.push({tile:A,status:"WAITING",time:s,error:null})}),l.clear());for(var d=this.tileset.maxRequests,c=0;c<u.length&&d>0;c++){var f=u[c];if(f.status==="DONE")f.error!==null?this.options.onTileError&&this.options.onTileError(f.tile,f.error):(d--,f.tile.content&&(f.tile.content.loadState="READY"),this.options.onTileLoad&&this.options.onTileLoad(f.tile)),u.splice(c,1),c--;else if(f.status==="PENDING"&&s-f.time<1e3)break}switch(priorityCache.clear(),e){case"SCREEN_SPACE_ERROR":{u.sort(function(A,E){if(A.tile.state.requestedFrameNumber!==E.tile.state.requestedFrameNumber)return E.tile.state.requestedFrameNumber-A.tile.state.requestedFrameNumber;if(A.tile.state.requestedFrameNumber===r.frameNumber){var b=getPriority(A.tile,priorityCache),T=getPriority(E.tile,priorityCache);return b-T}else return A.tile.level!==E.tile.level?A.tile.level-E.tile.level:A.tile.state.distanceToCamera-E.tile.state.distanceToCamera});break}case"SCREEN_VERTICAL":{u.sort(function(A,E){return A.tile.state.requestedFrameNumber!==E.tile.state.requestedFrameNumber?E.tile.state.requestedFrameNumber-A.tile.state.requestedFrameNumber:A.tile.state.requestedFrameNumber===r.frameNumber?A.tile.state.centerScreenY!==E.tile.state.centerScreenY?A.tile.state.centerScreenY-E.tile.state.centerScreenY:A.tile.state.centerZDepth!==E.tile.state.centerZDepth?A.tile.state.centerZDepth-E.tile.state.centerZDepth:A.tile.level!==E.tile.level?A.tile.level-E.tile.level:A.tile.state.distanceToCamera-E.tile.state.distanceToCamera:A.tile.level!==E.tile.level?A.tile.level-E.tile.level:A.tile.state.distanceToCamera-E.tile.state.distanceToCamera});break}case"SCREEN_LEVEL_VERTICAL":{u.sort(function(A,E){return A.tile.state.requestedFrameNumber!==E.tile.state.requestedFrameNumber?E.tile.state.requestedFrameNumber-A.tile.state.requestedFrameNumber:A.tile.state.requestedFrameNumber===r.frameNumber?A.tile.level!==E.tile.level?A.tile.level-E.tile.level:A.tile.state.centerScreenY!==E.tile.state.centerScreenY?A.tile.state.centerScreenY-E.tile.state.centerScreenY:A.tile.state.centerZDepth!==E.tile.state.centerZDepth?A.tile.state.centerZDepth-E.tile.state.centerZDepth:A.tile.state.distanceToCamera-E.tile.state.distanceToCamera:A.tile.level!==E.tile.level?A.tile.level-E.tile.level:A.tile.state.distanceToCamera-E.tile.state.distanceToCamera});break}}if(d=Math.max(this.tileset.maxRequests-this.activeRequests,0),!this.tileset.skipLevelOfDetail)for(var p=0,v=u.length,c=0;c<v;c++){var g=u[c].tile;if(g.hasTilesetContent||g.contentParent===null||g.contentParent.state.selectedFrameNumber===this.tileset.frameNumber){var h=u.splice(c,1);u.splice.apply(u,__spreadArray([p++,0],h,!1))}}for(var m=function(A){var E=u[A];E.status==="WAITING"&&(d--,E.status="PENDING",E.time=s,y.activeRequests++,y.tileset.options.tileLoader(E.tile).catch(function(b){E.error=b}).then(function(){E.status="DONE",E.tile.content&&E.tile.content.loadState==="READY"&&(E.tile.content.loadState="LOADING"),o.activeRequests--}))},y=this,c=0;c<u.length&&d>0;c++)m(c)},n}(),CacheNode=function(){function n(t,e,r){this.item=t,this.previous=e,this.next=r}return n}(),CacheNodeList=function(){function n(){this.head=null,this.tail=null,this._length=0}return Object.defineProperty(n.prototype,"length",{get:function(){return this._length},enumerable:!1,configurable:!0}),n.prototype.add=function(t){var e=new CacheNode(t,this.tail,null);return this.tail?(this.tail.next=e,this.tail=e):(this.head=e,this.tail=e),this._length++,e},n.prototype.remove=function(t){t.previous&&t.next?(t.previous.next=t.next,t.next.previous=t.previous):t.previous?(t.previous.next=null,this.tail=t.previous):t.next?(t.next.previous=null,this.head=t.next):(this.head=null,this.tail=null),t.next=null,t.previous=null,this._length--},n.prototype.splice=function(t,e){t!==e&&(this.remove(e),this.insert(t,e))},n.prototype.insert=function(t,e){var r=t.next;t.next=e,this.tail===t?this.tail=e:r.previous=e,e.next=r,e.previous=t,this._length++},n.prototype.toArray=function(){for(var t=[],e=this.head;e;)t.push(e),e=e.next;return t},n}(),TileCache=function(){function n(t){t===void 0&&(t={}),this.options=t,this.cacheNodeMap=new Map,this.list=new CacheNodeList,this.sentinel=this.list.add("sentinel")}return n.prototype.reset=function(){this.list.tail&&this.list.splice(this.list.tail,this.sentinel)},n.prototype.touchTile=function(t){var e=this.cacheNodeMap.get(t);e&&this.list.splice(this.sentinel,e)},n.prototype.loadTile=function(t){if(!this.cacheNodeMap.has(t)){var e=this.list.add(t);this.cacheNodeMap.set(t,e),this.options.onTileLoad&&this.options.onTileLoad(t)}},n.prototype.unloadTile=function(t){var e=this.cacheNodeMap.get(t);e&&(this.list.remove(e),this.cacheNodeMap.delete(t),this.options.onTileUnload&&this.options.onTileUnload(t))},n.prototype.unloadTiles=function(t){for(var e=this.list.head;e!==this.sentinel&&t();){var r=e.item;e=e.next,this.unloadTile(r)}},n.prototype.toArray=function(){for(var t=[],e=0,r=this.list.toArray();e<r.length;e++){var o=r[e];o.item!=="sentinel"&&t.push(o.item)}return t},n}(),ManagedArray=function(){function n(){this.map=new Map,this.array=[],this._length=0}return Object.defineProperty(n.prototype,"length",{get:function(){return this._length},enumerable:!1,configurable:!0}),n.prototype.get=function(t){return this.array[t]},n.prototype.set=function(t,e){t>=this.length&&(this._length=t+1),this.map.has(this.array[t])&&this.map.delete(this.array[t]),this.array[t]=e,this.map.set(e,t)},n.prototype.delete=function(t){var e=this.map.get(t);e!==void 0&&e>=0&&(this.array.splice(e,1),this.map.delete(t),this._length--)},n.prototype.push=function(t){if(!this.map.has(t)){var e=this._length++;this.array[e]=t,this.map.set(t,e)}},n.prototype.pop=function(){var t=this.array[--this._length];return this.map.delete(t),this.array[this._length]=void 0,t},n.prototype.reset=function(){this.array=[],this.map=new Map,this._length=0},n.prototype.find=function(t){return this.map.has(t)},n.prototype.peek=function(){return this.array[this._length-1]},n}(),TilesetBaseTraverser=function(){function n(t){this.tileset=t,this._canSelectTile=!0,this._loadAllTilesTraversalStack=new ManagedArray,this.root=null}return n.prototype.traverse=function(t,e,r){this.root=t,this.reset()},n.prototype.reset=function(){this._loadAllTilesTraversalStack.reset(),this.tileset.hasMixedContent=!1,this.tileset.needsRefinedTiles.clear(),this.tileset.requestedTiles.length=0,this.tileset.selectedTiles.length=0},n.prototype.updateTile=function(t,e){this.updateTileVisibility(t,e),t.state.shouldSelect=!1,t.state.finalResolution=!0},n.prototype.selectTile=function(t,e){var r=t.contentAvailable&&this._canSelectTile;r&&t.state.selectedFrameNumber<e.frameNumber&&(t.state.selectedFrameNumber=e.frameNumber,this.tileset.selectedTiles.push(t),this.tileset.needsRefinedTiles.add(t))},n.prototype.loadTile=function(t,e){t.state.requestedFrameNumber<e.frameNumber&&(t.state.requestedFrameNumber=e.frameNumber,t.content&&(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.tileset.requestedTiles.push(t))),this.tileset.needsRefinedTiles.add(t)},n.prototype.touchTile=function(t,e){this.tileset.cache.touchTile(t),t.state.touchedFrameNumber=e.frameNumber},n.prototype.canTraverse=function(t,e){return!t.state.inRequestVolume||t.levelOfContent>=e.maxLevelOfDetail||t.children.length===0?!1:t.levelOfContent<=e.minLevelOfDetail||t.hasTilesetContent?!0:t.state.screenSpaceError>this.tileset.maxScreenSpaceError},n.prototype.updateTileVisibility=function(t,e){if(t.updateState(e),!(!t.state.visible||!t.state.inRequestVolume)){var r=t.children.length>0;if(t.hasTilesetContent&&r){var o=t.children[0];this.updateTileVisibility(o,e),t.state.visible=o.state.visible;return}if(this.meetsScreenSpaceErrorEarly(t,e)){t.state.visible=!1;return}var s=t.refine==="REPLACE";if(s&&r&&!this.anyChildrenVisible(t,e)){t.state.visible=!1;return}}},n.prototype.anyChildrenVisible=function(t,e){for(var r=!1,o=t.children,s=0,u=o;s<u.length;s++){var l=u[s];l.updateState(e),r=r||l.state.visible}return r},n.prototype.meetsScreenSpaceErrorEarly=function(t,e){var r=t.parent;return!r||r.refine!=="ADD"||r.levelOfContent<e.minLevelOfDetail?!1:r.levelOfContent>e.maxLevelOfDetail?!0:t.getScreenSpaceError(e,t.state.distanceToCamera,!0)<this.tileset.maxScreenSpaceError},n.prototype.sortTilesByDistanceToCamera=function(t){t.sort(function(e,r){return r.state.distanceToCamera===0&&e.state.distanceToCamera===0?r.state.centerZDepth-e.state.centerZDepth:r.state.distanceToCamera-e.state.distanceToCamera})},n.prototype.loadAllTiles=function(t,e){var r=this._loadAllTilesTraversalStack;for(r.push(t);r.length>0;){var o=r.pop();o.content&&o.content.loadState==="UNLOADED"&&o.state.requestedFrameNumber<e.frameNumber&&this.tileset.requestedTiles.push(o),this.touchTile(o,e);for(var s=0,u=o.children;s<u.length;s++){var l=u[s];r.push(l)}}},n}(),TilesetNormalTraverser=function(n){__extends(t,n);function t(e){var r=n.call(this,e)||this;return r.tileset=e,r._traversalStack=new ManagedArray,r._emptyTraversalStack=new ManagedArray,r}return t.prototype.traverse=function(e,r,o){o===void 0&&(o=[]),n.prototype.traverse.call(this,e,r,o);for(var s=0,u=o;s<u.length;s++){var l=u[s];this._traversalStack.reset(),this._emptyTraversalStack.reset(),l.camera.refine&&(this._canSelectTile=l.camera.visible,this.updateTile(e,l),this.executeTraversal(e,l))}this._traversalStack.reset(),this._emptyTraversalStack.reset(),r.camera.refine&&(this._canSelectTile=r.camera.visible,this.updateTile(e,r),this.executeTraversal(e,r)),this.tileset.loadAll&&this.loadAllTiles(e,r)},t.prototype.reset=function(){n.prototype.reset.call(this),this._traversalStack.reset(),this._emptyTraversalStack.reset()},t.prototype.executeTraversal=function(e,r){var o=this._traversalStack;for(e.state.visible&&e.state.inRequestVolume&&o.push(e);o.length>0;){var s=o.pop(),u=s.parent,l=!u||u.state.shouldRefine,c=!1;this.canTraverse(s,r)&&(c=this.updateAndPushChildren(s,r,o)&&l);var f=!c&&l;s.hasRenderContent?s.refine==="ADD"?(this.loadTile(s,r),this.selectDesiredTile(s,r)):s.refine==="REPLACE"&&(this.loadTile(s,r),f&&this.selectDesiredTile(s,r)):(this.loadTile(s,r),f&&this.selectDesiredTile(s,r)),this.touchTile(s,r),s.state.shouldRefine=c}},t.prototype.updateAndPushChildren=function(e,r,o){for(var s=e.children,u=0,l=s;u<l.length;u++){var c=l[u];this.updateTile(c,r)}this.sortTilesByDistanceToCamera(s);for(var f=e.refine==="REPLACE"&&!this.tileset.skipLevelOfDetail,d=!1,p=!0,v=0,g=s;v<g.length;v++){var c=g[v];if(c.levelOfContent<=r.minLevelOfDetail||c.state.visible&&c.state.inRequestVolume?(o.find(c)&&o.delete(c),o.push(c),d===!1&&(d=!0)):(f||this.tileset.loadSiblings)&&(this.loadTile(c,r),this.touchTile(c,r)),f){var h=void 0;c.state.inRequestVolume?c.hasRenderContent?h=c.contentAvailable:h=this.executeEmptyTraversal(c,r):h=!1,p=p&&h}}return d||(p=!1),p},t.prototype.selectDesiredTile=function(e,r){e.contentAvailable&&n.prototype.selectTile.call(this,e,r)},t.prototype.executeEmptyTraversal=function(e,r){var o=!0,s=this._emptyTraversalStack;for(s.push(e);s.length>0&&o;){var u=s.pop(),l=!u.hasRenderContent&&this.canTraverse(u,r);if(!l&&!u.contentAvailable&&(o=!1),this.updateTile(u,r),u.state.visible||(this.loadTile(u,r),this.touchTile(u,r)),l)for(var c=u.children,f=0,d=c;f<d.length;f++){var p=d[f];s.find(p)&&s.delete(p),s.push(p)}}return o},t}(TilesetBaseTraverser),TilesetSkipTraverser=function(n){__extends(t,n);function t(e){var r=n.call(this,e)||this;return r.tileset=e,r.baseScreenSpaceError=1024,r.skipScreenSpaceErrorFactor=16,r.skipLevels=1,r._traversalStack=new ManagedArray,r._descendantTraversalStack=new ManagedArray,r._selectionTraversalStack=new ManagedArray,r._selectionTraversalancestorStack=new ManagedArray,r}return t.prototype.traverse=function(e,r,o){o===void 0&&(o=[]),n.prototype.traverse.call(this,e,r,o);for(var s=0,u=o;s<u.length;s++){var l=u[s];this._traversalStack.reset(),l.camera.refine&&(this._canSelectTile=l.camera.visible,this.updateTile(e,l),this.executeTraversal(e,l),this.traverseAndSelect(e,l))}this.tileset.hasMixedContent=!1,this._traversalStack.reset(),this._descendantTraversalStack.reset(),this._selectionTraversalStack.reset(),this._selectionTraversalancestorStack.reset(),r.camera.refine&&(this._canSelectTile=r.camera.visible,this.updateTile(e,r),this.executeTraversal(e,r),this.traverseAndSelect(e,r)),this.tileset.loadAll&&this.loadAllTiles(e,r)},t.prototype.reset=function(){n.prototype.reset.call(this),this._traversalStack.reset(),this._descendantTraversalStack.reset(),this._selectionTraversalStack.reset(),this._selectionTraversalancestorStack.reset()},t.prototype.executeTraversal=function(e,r){var o=this._traversalStack;for(e.state.visible&&e.state.inRequestVolume&&o.push(e);o.length>0;){var s=o.pop();this.updateTileAncestorContentLinks(s,r);var u=s.parent,l=!u||u.state.shouldRefine,c=!1;this.canTraverse(s,r)&&(c=this.updateAndPushChildren(s,r,o)&&l);var f=!c&&l;s.hasRenderContent?s.refine==="ADD"?(this.loadTile(s,r),this.selectDesiredTile(s,r)):s.refine==="REPLACE"&&(this.inBaseTraversal(s,this.baseScreenSpaceError)?(this.loadTile(s,r),f&&this.selectDesiredTile(s,r)):f?(this.loadTile(s,r),this.selectDesiredTile(s,r)):this.reachedSkippingThreshold(s)&&this.loadTile(s,r)):(this.loadTile(s,r),f&&this.selectDesiredTile(s,r)),this.touchTile(s,r),s.state.shouldRefine=c}},t.prototype.updateAndPushChildren=function(e,r,o){for(var s=e.children,u=0,l=s;u<l.length;u++){var c=l[u];this.updateTile(c,r)}this.sortTilesByDistanceToCamera(s);for(var f=!1,d=0,p=s;d<p.length;d++){var c=p[d];c.levelOfContent<=r.minLevelOfDetail||c.state.visible&&c.state.inRequestVolume?(o.push(c),f===!1&&(f=!0)):this.tileset.loadSiblings&&(this.loadTile(c,r),this.touchTile(c,r))}return f},t.prototype.selectDesiredTile=function(e,r){var o=e.contentAvailable?e:e.state.ancestorWithContentAvailable;o&&(o.state.shouldSelect=!0),e.contentAvailable||this.selectDescendants(e,r)},t.prototype.selectDescendants=function(e,r){var o=this._descendantTraversalStack;for(o.push(e);o.length>0;)for(var s=o.pop(),u=s.children,l=0,c=u;l<c.length;l++){var f=c[l];f.state.visible&&(f.contentAvailable?(this.updateTile(f,r),this.touchTile(f,r),this.selectTile(f,r)):o.push(f))}},t.prototype.reachedSkippingThreshold=function(e){var r=e.state.ancestorWithContent,o=r!==null&&e.state.screenSpaceError<r.state.screenSpaceError/this.skipScreenSpaceErrorFactor&&e.levelOfContent>r.levelOfContent+this.skipLevels;return o},t.prototype.updateTileAncestorContentLinks=function(e,r){e.state.ancestorWithContent=null,e.state.ancestorWithContentAvailable=null;var o=e.parent;if(o){var s=!(o.hasRenderContent&&o.hasUnloadedContent)||o.state.requestedFrameNumber===r.frameNumber;e.state.ancestorWithContent=s?o:o.state.ancestorWithContent,e.state.ancestorWithContentAvailable=o.contentAvailable?o:o.state.ancestorWithContentAvailable}},t.prototype.inBaseTraversal=function(e,r){return e.state.ancestorWithContent?e.parent&&e.state.screenSpaceError===0?e.parent.state.screenSpaceError>r:e.state.screenSpaceError>r:!0},t.prototype.traverseAndSelect=function(e,r){var o=this._selectionTraversalStack,s=this._selectionTraversalancestorStack,u;for(o.push(e);o.length>0||s.length>0;){if(s.length>0){var l=s.peek();if(l.state.stackLength===o.length){s.pop(),l!==u&&(l.state.finalResolution=!1),this.selectTile(l,r);continue}}var c=o.pop();if(c){var f=this.canTraverse(c,r);if(c.state.shouldSelect)if(c.refine==="ADD")this.selectTile(c,r);else{if(c.state.selectionDepth=s.length,c.state.selectionDepth>0&&(c.tileset.hasMixedContent=!0),u=c,!f){this.selectTile(c,r);continue}s.push(c),c.state.stackLength=o.length}if(f)for(var d=0,p=c.children;d<p.length;d++){var v=p[d];v.state.visible&&o.push(v)}}}},t}(TilesetBaseTraverser),TilesetMostDetailTraverser=function(n){__extends(t,n);function t(e){var r=n.call(this,e)||this;return r.tileset=e,r._traversalStack=new ManagedArray,r}return t.prototype.canTraverse=function(e,r){return!(!e.state.inRequestVolume||e.levelOfContent>=r.maxLevelOfDetail||e.children.length===0)},t.prototype.traverse=function(e,r,o){n.prototype.traverse.call(this,e,r,[]),this._traversalStack.reset(),e.updateState(r);for(var s=0,u=o;s<u.length;s++){var l=u[s];this._traversalStack.reset(),l.camera.refine&&(this._canSelectTile=l.camera.visible,e.updateState(l),this.executeTraversal(e,l))}this._traversalStack.reset(),r.camera.refine&&(this._canSelectTile=r.camera.visible,e.updateState(r),this.executeTraversal(e,r)),this.tileset.loadAll&&this.loadAllTiles(e,r)},t.prototype.reset=function(){n.prototype.reset.call(this),this._traversalStack.reset()},t.prototype.executeTraversal=function(e,r){var o=this._traversalStack;for(o.push(e);o.length>0;){var s=o.pop(),u=s.refine==="ADD",l=s.refine==="REPLACE",c=this.canTraverse(s,r);c&&this.updateAndPushChildren(s,r,o),(u||l&&!c)&&(this.loadTile(s,r),this.touchTile(s,r),this.selectDesiredTile(s,r))}},t.prototype.updateAndPushChildren=function(e,r,o){for(var s=e.children,u=0;u<s.length;++u){var l=s[u];l.updateState(r),l.state.visible&&o.push(l)}},t.prototype.selectDesiredTile=function(e,r){e.contentAvailable&&n.prototype.selectTile.call(this,e,r)},t}(TilesetBaseTraverser),Trajectory=function(){function n(t,e,r){this.index=t,this.name=e.name,this.visible=!1,this.tileset=r,this.transform=new THREE__namespace.Matrix4,e.transform&&this.transform.fromArray(e.transform),this.transform.premultiply(this.tileset.root.transform),this.content={uri:e.file,byteLength:0,loadState:"UNLOADED",loadStateUpdateTime:now(),loadfailRetryDelay:0,data:void 0}}return n}(),identityMatrix4=new THREE__namespace.Matrix4,Tileset=function(){function n(t,e,r){var o=this,s,u,l,c,f,d,p,v,g;if(this.id=t,this.transform=new THREE__namespace.Matrix4,this.transformIsIdentity=!0,this.hasMixedContent=!1,this.url=(s=r.url)!==null&&s!==void 0?s:"",this.referer=(u=r.referer)!==null&&u!==void 0?u:"",this.asset={version:e.asset.version,tilesetVersion:e.asset.tilesetVersion||"",gltfUpAxis:(l=e.asset.gltfUpAxis)!==null&&l!==void 0?l:"Y",overview:e.asset.overview,trajectories:(f=(c=e.asset.trajectories)===null||c===void 0?void 0:c.list)!==null&&f!==void 0?f:[],extras:e.asset.extras},this.rootMeta=(d=e.rootMeta)!==null&&d!==void 0?d:{},this.pointLength=(p=this.rootMeta.numTotalPoints)!==null&&p!==void 0?p:1/0,this.floorLength=(v=this.rootMeta.numFloors)!==null&&v!==void 0?v:1,this.properties=(g=e.properties)!==null&&g!==void 0?g:{},this.options=r,this.maxMemoryUsage=n.DEFAULT_MAX_MEMORY_USAGE,this.maxScreenSpaceError=n.DEFAULT_MAX_SCREEN_SPACE_ERROR,this.skipLevelOfDetail=n.DEFAULT_SKIP_LEVEL_OF_DETAIL,this.mostDetail=n.DEFAULT_MOST_DETAIL,this.loadSiblings=n.DEFAULT_LOAD_SIBLINGS,this.loadAll=n.DEFAULT_LOAD_ALL,this.maxRequests=n.DEFAULT_MAX_REQUESTS,this.tileRequestOrder=n.DEFAULT_REQUEST_ORDER,this.requestedTiles=[],this.selectedTiles=[],this.unloadTiles=[],this.needsRefinedTiles=new Set,this.selectedTrajectories=[],this.normalTraverser=new TilesetNormalTraverser(this),this.skipTraverser=new TilesetSkipTraverser(this),this.mostDetailTraverser=new TilesetMostDetailTraverser(this),this.cache=new TileCache({onTileLoad:function(y){o.memoryUsageInBytes+=y.contentByteLength},onTileUnload:function(y){o.memoryUsageInBytes-=y.contentByteLength,o.unloadTiles.push(y)}}),this.requestScheduler=new TileRequestScheduler(this,{onTileSkip:function(y){},onTileLoad:function(y){var A;!((A=y.content)===null||A===void 0)&&A.data&&(o.loadedTiles.add(y),o.cache.loadTile(y)),o.options.onTileLoad(y)},onTileError:function(y,A){o.options.onTileError(y,A)}}),this.frameNumber=0,this.maxLevelOfDetail=0,this.minLevelOfDetail=0,this.loadedTiles=new Set,this.memoryUsageInBytes=0,this.root=new Tile("".concat(this.id,".0"),e.root,this),this.geometricError=e.geometricError,this.trajectories=[],this.asset.trajectories)for(var h=0;h<this.asset.trajectories.length;h++){var m=new Trajectory(h,this.asset.trajectories[h],this);this.trajectories.push(m)}}return Object.defineProperty(n.prototype,"traverser",{get:function(){return this.mostDetail?this.mostDetailTraverser:this.skipLevelOfDetail?this.skipTraverser:this.normalTraverser},enumerable:!1,configurable:!0}),n.prototype.reset=function(){for(var t=this,e=[this.root],r;r=e.pop();){for(var o=0,s=r.children.length;o<s;o++)e.push(r.children[o]);this.cache.unloadTile(r)}for(var u=function(){var d=l.unloadTiles.pop();d&&(l.loadedTiles.delete(d),l.memoryUsageInBytes-=d.contentByteLength,l.options.tileUnloader(d).catch(function(){}).then(function(){t.options.onTileUnload&&t.options.onTileUnload(d)}))},l=this;this.unloadTiles.length;)u();this.cache.reset(),this.traverser.reset(),this.requestScheduler.reset(),this.loadedTiles.clear();for(var c=function(){var d=f.trajectories.pop();d&&f.options.trajectoryUnloader(d).catch(function(){}).then(function(){t.options.onTrajectoryUnload&&t.options.onTrajectoryUnload(d)})},f=this;this.trajectories.length;)c()},n.prototype.update=function(t,e){var r=this,o;e===void 0&&(e=[]),this.frameNumber=t.frameNumber,this.minLevelOfDetail=t.minLevelOfDetail,this.maxLevelOfDetail=t.maxLevelOfDetail,this.transformIsIdentity=this.transform.equals(identityMatrix4),this.traverser.traverse(this.root,t,e),this.cache.unloadTiles(function(){var v=r.memoryUsageInBytes>r.maxMemoryUsage*1024*1024;return v}),this.requestScheduler.update(this.requestedTiles,this.tileRequestOrder,t);for(var s=function(){var v=u.unloadTiles.pop();v&&(u.loadedTiles.delete(v),u.options.tileUnloader(v).catch(function(){}).then(function(){r.options.onTileUnload&&r.options.onTileUnload(v)}))},u=this;this.unloadTiles.length;)s();this.selectedTrajectories.length=0;for(var l=function(v){v.visible===!0&&v.content.loadState==="READY"&&(!((o=v.content.data)===null||o===void 0)&&o.object)?c.selectedTrajectories.push(v):v.visible===!0&&(v.content.loadState==="FAILED"&&t.time-v.content.loadStateUpdateTime>v.content.loadfailRetryDelay&&(v.content.loadState="UNLOADED",v.content.loadStateUpdateTime=t.time),v.content.loadState==="UNLOADED"&&c.options.trajectoryLoader(v).then(function(){r.options.onTrajectoryLoad(v)}).catch(function(g){r.options.onTrajectoryError(v,g)}))},c=this,f=0,d=this.trajectories;f<d.length;f++){var p=d[f];l(p)}},n.DEFAULT_MAX_MEMORY_USAGE=16,n.DEFAULT_MAX_SCREEN_SPACE_ERROR=4,n.DEFAULT_SKIP_LEVEL_OF_DETAIL=!1,n.DEFAULT_MOST_DETAIL=!1,n.DEFAULT_LOAD_SIBLINGS=!1,n.DEFAULT_LOAD_ALL=!1,n.DEFAULT_MAX_REQUESTS=6,n.DEFAULT_REQUEST_ORDER="SCREEN_SPACE_ERROR",n}(),BVHObject=function(){function n(t,e){this.position=t,this.indices=e}return n.prototype.getPositionCount=function(){var t,e,r=this.indices,o=this.position;return r?r.array.length/((t=r.stride)!==null&&t!==void 0?t:1):o.array.length/((e=o.stride)!==null&&e!==void 0?e:3)},n.prototype.getPositionByIndex=function(t,e){var r,o,s,u,l=this.indices,c=this.position,f=t;if(l){var d=l.array,p=(r=l.stride)!==null&&r!==void 0?r:1,v=(o=l.offset)!==null&&o!==void 0?o:0;f=d[t*p+v]}var g=c.array,h=(s=c.stride)!==null&&s!==void 0?s:3,m=(u=c.offset)!==null&&u!==void 0?u:0;return f=f*h+m,e.x=g[f],e.y=g[f+1],e.z=g[f+2],e},n.prototype.createTree=function(t,e,r){throw new Error("not implemented")},n.prototype.trianglesInSphere=function(t,e){throw new Error("not implemented")},n.prototype.intersectRay=function(t,e,r,o){throw new Error("not implemented")},n}(),BVHNode=function(){function n(t,e,r,o,s){this.id=t,this.extents=e,this.startIndex=r,this.endIndex=o,this.deepth=s}return n}(),BYTES_PER_NODE=6*4+4+4+2+2;function packBVHNode(n,t){for(var e=new ArrayBuffer(t*BYTES_PER_NODE),r=new Float32Array(e),o=new Uint32Array(e),s=new Uint16Array(e),u=[n],l,c;l=u.pop();)c=l.id*BYTES_PER_NODE/4,r[c]=l.extents[0],r[c+1]=l.extents[1],r[c+2]=l.extents[2],r[c+3]=l.extents[3],r[c+4]=l.extents[4],r[c+5]=l.extents[5],o[c+6]=l.startIndex,o[c+7]=l.endIndex,c=l.id*BYTES_PER_NODE/2,l.node0&&(s[c+16]=l.node0.id,u.push(l.node0)),l.node1&&(s[c+17]=l.node1.id,u.push(l.node1));return e}function intersectNodeBox(n,t,e,r,o,s,u,l,c){c===void 0&&(c=0),e=e-c,r=r-c,o=o-c,s=s+c,u=u+c,l=l+c;var f=0,d=0,p=0,v=0,g=0,h=0;return t.x>=0?(f=(e-n.x)*t.x,d=(s-n.x)*t.x):(f=(s-n.x)*t.x,d=(e-n.x)*t.x),t.y>=0?(p=(r-n.y)*t.y,v=(u-n.y)*t.y):(p=(u-n.y)*t.y,v=(r-n.y)*t.y),!(f>v||p>d||(p>f&&(f=p),v<d&&(d=v),t.z>=0?(g=(o-n.z)*t.z,h=(l-n.z)*t.z):(g=(l-n.z)*t.z,h=(o-n.z)*t.z),f>h||g>d)||(g>f&&(f=g),h<d&&(d=h),d<0))}var BVHVector3=function(){function n(t,e,r){this.x=t,this.y=e,this.z=r}return n.prototype.copy=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},n.prototype.set=function(t,e,r){return this.x=t,this.y=e,this.z=r,this},n.prototype.fromArray=function(t,e){return e===void 0&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this},n.prototype.toArray=function(t,e){return t===void 0&&(t=[]),e===void 0&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t},n.prototype.add=function(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this},n.prototype.multiplyScalar=function(t){return this.x*=t,this.y*=t,this.z*=t,this},n.prototype.subVectors=function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this},n.prototype.addScaledVector=function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this},n.prototype.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z},n.prototype.cross=function(t){var e=this.x,r=this.y,o=this.z;return this.x=r*t.z-o*t.y,this.y=o*t.x-e*t.z,this.z=e*t.y-r*t.x,this},n.prototype.crossVectors=function(t,e){var r=t.x,o=t.y,s=t.z,u=e.x,l=e.y,c=e.z;return this.x=o*c-s*l,this.y=s*u-r*c,this.z=r*l-o*u,this},n.prototype.distanceTo=function(t){return Math.sqrt(this.distanceToSquared(t))},n.prototype.distanceToSquared=function(t){var e=this.x-t.x,r=this.y-t.y,o=this.z-t.z;return e*e+r*r+o*o},n.prototype.clone=function(){return new n(this.x,this.y,this.z)},n}(),BVHIntersect=function(){function n(t,e,r){this.triangle=t,this.intersectionPoint=e,this.index=r}return n}(),EPSILON$1=1e-6,scratchVector3$3=new BVHVector3(0,0,0),scratchVector3A=new BVHVector3(0,0,0),scratchVector3B=new BVHVector3(0,0,0),scratchVector3C=new BVHVector3(0,0,0),BVHMesh=function(n){__extends(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t.prototype.createTree=function(e,r,o){r=Math.min(r,16);var s=this.getPositionCount()/3,u=s>65535?new Uint32Array(s):new Uint16Array(s),l=new Float32Array(s*6),c=[],f=0,d=-1;if(o)for(var p=0,v=0,g=0,h=void 0,m=void 0,y=void 0,A=void 0,E=void 0,b=void 0,T=void 0;p<s;p+=1,v+=3,g+=6)u[p]=p,this.getPositionByIndex(v,scratchVector3A),this.getPositionByIndex(v+1,scratchVector3B),this.getPositionByIndex(v+2,scratchVector3C),h=A=scratchVector3A.x,T=scratchVector3B.x,T<h&&(h=T),T>A&&(A=T),T=scratchVector3C.x,T<h&&(h=T),T>A&&(A=T),m=E=scratchVector3A.y,T=scratchVector3B.y,T<m&&(m=T),T>E&&(E=T),T=scratchVector3C.y,T<m&&(m=T),T>E&&(E=T),y=b=scratchVector3A.z,T=scratchVector3B.z,T<y&&(y=T),T>b&&(b=T),T=scratchVector3C.z,T<y&&(y=T),T>b&&(b=T),l[g]=h,l[g+1]=m,l[g+2]=y,l[g+3]=A,l[g+4]=E,l[g+5]=b;else{for(var _=1/0,R=1/0,S=1/0,M=-1/0,B=-1/0,H=-1/0,p=0,v=0,g=0,h=void 0,m=void 0,y=void 0,A=void 0,E=void 0,b=void 0,T=void 0;p<s;p+=1,v+=3,g+=6)u[p]=p,this.getPositionByIndex(v,scratchVector3A),this.getPositionByIndex(v+1,scratchVector3B),this.getPositionByIndex(v+2,scratchVector3C),h=A=scratchVector3A.x,T=scratchVector3B.x,T<h&&(h=T),T>A&&(A=T),T=scratchVector3C.x,T<h&&(h=T),T>A&&(A=T),m=E=scratchVector3A.y,T=scratchVector3B.y,T<m&&(m=T),T>E&&(E=T),T=scratchVector3C.y,T<m&&(m=T),T>E&&(E=T),y=b=scratchVector3A.z,T=scratchVector3B.z,T<y&&(y=T),T>b&&(b=T),T=scratchVector3C.z,T<y&&(y=T),T>b&&(b=T),l[g]=h,l[g+1]=m,l[g+2]=y,l[g+3]=A,l[g+4]=E,l[g+5]=b,h<_&&(_=h),A>M&&(M=A),m<R&&(R=m),E>B&&(B=E),y<S&&(S=y),b>H&&(H=b);o=[_,R,S,M,B,H]}var w=new BVHNode(++d,o,0,s,0);c[f++]=w;var C=[],L=[0,1,2],I=function(k,N){return C[N]-C[k]};function F(k){var N=k.startIndex,D=k.endIndex,U=k.extents;C[0]=U[3]-U[0],C[1]=U[4]-U[1],C[2]=U[5]-U[2],L.sort(I);for(var z=0;z<3;z++){for(var G=L[z],q=U[G]+U[G+3],K=N,j=D-1,W=-1,X=void 0;K<=j;)W===-1?(X=u[K],l[X*6+G]+l[X*6+G+3]<q?K++:W=X):(X=u[j],l[X*6+G]+l[X*6+G+3]>=q||(u[K]=X,u[j]=W,W=-1,K++),j--);if(K>N&&K<D){var ee=new BVHNode(++d,calcExtents(u,l,N,K,EPSILON$1),N,K,k.deepth+1);ee.deepth<r&&ee.endIndex-ee.startIndex>e&&(c[f++]=ee);var $=new BVHNode(++d,calcExtents(u,l,K,D,EPSILON$1),K,D,k.deepth+1);$.deepth<r&&$.endIndex-$.startIndex>e&&(c[f++]=$),k.node0=ee,k.node1=$,k.startIndex=0,k.endIndex=0;break}}}for(;f;)F(c[--f]);return this.offsetArray=u,this.rootNodePacked=packBVHNode(w,d+1),c.length=0,this},t.prototype.trianglesInSphere=function(e,r){for(var o=this.offsetArray,s=this.rootNodePacked,u=new Float32Array(s),l=new Uint32Array(s),c=new Uint16Array(s),f=[0],d=[],p,v,g,h;(p=f.pop())!==void 0;){h=p*BYTES_PER_NODE/4;var m=clamp(e.x,u[h],u[h+3])-e.x,y=clamp(e.y,u[h+1],u[h+4])-e.y,A=clamp(e.z,u[h+2],u[h+5])-e.z;if(m*m+y*y+A*A<=r*r){for(var E=l[h+6];E<l[h+7];E++)d.push(o[E]);h=p*BYTES_PER_NODE/2,v=c[h+16],g=c[h+17],v&&f.push(v),g&&f.push(g)}}for(var b=d.length,T=new Float32Array(b*9),E=0;E<b;E++){var _=d[E];this.getPositionByIndex(_,scratchVector3$3),T[E*9]=scratchVector3$3.x,T[E*9+1]=scratchVector3$3.y,T[E*9+2]=scratchVector3$3.z,this.getPositionByIndex(_+1,scratchVector3$3),T[E*9+3]=scratchVector3$3.x,T[E*9+4]=scratchVector3$3.y,T[E*9+5]=scratchVector3$3.z,this.getPositionByIndex(_+2,scratchVector3$3),T[E*9+6]=scratchVector3$3.x,T[E*9+7]=scratchVector3$3.y,T[E*9+8]=scratchVector3$3.z}return T},t.prototype.intersectRay=function(e,r,o,s){for(var u=this.offsetArray,l=this.rootNodePacked,c=new Float32Array(l),f=new Uint32Array(l),d=new Uint16Array(l),p=new BVHVector3(1/r.x,1/r.y,1/r.z),v=[0],g,h,m,y;(g=v.pop())!==void 0;)if(y=g*BYTES_PER_NODE/4,intersectNodeBox(e,p,c[y],c[y+1],c[y+2],c[y+3],c[y+4],c[y+5])){for(var A=f[y+6],E=f[y+7],b=void 0,T=void 0,_=void 0,R=e.x,S=e.y,M=e.z,B=r.x,H=r.y,w=r.z,C=void 0,L=void 0,I=void 0,F=void 0,k=void 0,N=void 0,D=void 0,U=void 0,z=void 0,G=void 0,q=void 0,K=void 0,j=void 0,W=void 0,X=void 0,ee=void 0,$=void 0,re=void 0,ie=void 0,se=void 0,ae=void 0,fe=void 0,ne=void 0,pe=void 0,_e=void 0,me=void 0,xe=void 0;A<E;A++){if(b=u[A],T=b*3,this.getPositionByIndex(T,scratchVector3$3),C=scratchVector3$3.x,L=scratchVector3$3.y,I=scratchVector3$3.z,this.getPositionByIndex(T+1,scratchVector3$3),F=scratchVector3$3.x,k=scratchVector3$3.y,N=scratchVector3$3.z,this.getPositionByIndex(T+2,scratchVector3$3),D=scratchVector3$3.x,U=scratchVector3$3.y,z=scratchVector3$3.z,G=F-C,q=k-L,K=N-I,j=D-C,W=U-L,X=z-I,ee=q*X-K*W,$=K*j-G*X,re=G*W-q*j,ne=B*ee+H*$+w*re,ne>0)fe=1;else if(ne<0)fe=-1,ne=-ne;else continue;ie=R-C,se=S-L,ae=M-I,pe=fe*(B*(se*X-ae*W)+H*(ae*j-ie*X)+w*(ie*W-se*j)),!(pe<0)&&(_e=fe*(B*(q*ae-K*se)+H*(K*ie-G*ae)+w*(G*se-q*ie)),!(_e<0)&&(pe+_e>ne||(me=-fe*(ie*ee+se*$+ae*re),!(me<0)&&(xe=me/ne,s.push(new BVHIntersect([C,L,I,F,k,N,D,U,z],[R+B*xe,S+H*xe,M+w*xe],b))))))}y=g*BYTES_PER_NODE/2,h=d[y+16],m=d[y+17],h&&v.push(h),m&&v.push(m)}return s},t}(BVHObject);function clamp(n,t,e){return n<t?t:n>e?e:n}function calcExtents(n,t,e,r,o){if(e>=r)return[0,0,0,0,0,0];for(var s=1/0,u=1/0,l=1/0,c=-1/0,f=-1/0,d=-1/0,p=e,v=void 0,g=void 0;p<r;p++)v=n[p]*6,g=t[v],g<s&&(s=g),g=t[v+1],g<u&&(u=g),g=t[v+2],g<l&&(l=g),g=t[v+3],g>c&&(c=g),g=t[v+4],g>f&&(f=g),g=t[v+5],g>d&&(d=g);return[s-o,u-o,l-o,c+o,f+o,d+o]}var EPSILON=1e-6,ORDER_AXISES=["x","y","z"],scratchVector3$2=new BVHVector3(0,0,0),BVHPoints=function(n){__extends(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t.prototype.createTree=function(e,r,o){r=Math.min(r,16);var s=this.getPositionByIndex.bind(this),u=this.getPositionCount(),l=u>65535?new Uint32Array(u):new Uint16Array(u),c=[],f=0,d=-1;if(o)for(var p=0;p<u;p+=1)l[p]=p;else{s(0,scratchVector3$2);for(var v=scratchVector3$2.x,g=scratchVector3$2.y,h=scratchVector3$2.z,m=v,y=g,A=h,p=0,E=void 0,b=void 0,T=void 0;p<u;p+=1)l[p]=p,s(p,scratchVector3$2),E=scratchVector3$2.x,b=scratchVector3$2.y,T=scratchVector3$2.z,E<v?v=E:E>m&&(m=E),b<g?g=b:b>y&&(y=b),T<h?h=T:T>A&&(A=T);o=[v,g,h,m,y,A]}var _=new BVHNode(++d,o,0,u,0);c[f++]=_;var R=[],S=[0,1,2],M=function(H,w){return R[w]-R[H]};function B(H){var w=H.startIndex,C=H.endIndex,L=H.extents;R[0]=L[3]-L[0],R[1]=L[4]-L[1],R[2]=L[5]-L[2];for(var I=S.sort(M)[0],F=ORDER_AXISES[I],k=(L[I]+L[I+3])/2,N=w,D=C-1,U=-1,z;N<=D;)U===-1?(z=l[N],s(z,scratchVector3$2),scratchVector3$2[F]<k?N++:U=z):(z=l[D],s(z,scratchVector3$2),scratchVector3$2[F]>=k||(l[N]=z,l[D]=U,U=-1,N++),D--);if(N>w){var G=L.slice();G[I+3]=k+EPSILON;var q=new BVHNode(++d,G,w,N,H.deepth+1);q.deepth<r&&q.endIndex-q.startIndex>e&&(c[f++]=q),H.node0=q}if(C>N){var K=L.slice();K[I]=k-EPSILON;var j=new BVHNode(++d,K,N,C,H.deepth+1);j.deepth<r&&j.endIndex-j.startIndex>e&&(c[f++]=j),H.node1=j}H.startIndex=0,H.endIndex=0}for(;f;)B(c[--f]);return this.offsetArray=l,this.rootNodePacked=packBVHNode(_,d+1),c.length=0,this},t.prototype.intersectRay=function(e,r,o,s){for(var u=this.offsetArray,l=this.rootNodePacked,c=new Float32Array(l),f=new Uint32Array(l),d=new Uint16Array(l),p=o*o,v=new BVHVector3(1/r.x,1/r.y,1/r.z),g=[0],h,m,y,A;(h=g.pop())!==void 0;)if(A=h*BYTES_PER_NODE/4,intersectNodeBox(e,v,c[A],c[A+1],c[A+2],c[A+3],c[A+4],c[A+5],o)){for(var E=f[A+6],b=f[A+7],T=void 0,_=void 0,R=void 0,S=void 0,M=void 0,B=void 0,H=void 0,w=void 0,C=void 0,L=void 0,I=void 0,F=void 0;E<b;E++)T=u[E],this.getPositionByIndex(T,scratchVector3$2),_=scratchVector3$2.x,R=scratchVector3$2.y,S=scratchVector3$2.z,M=e.x,B=e.y,H=e.z,w=r.x,C=r.y,L=r.z,I=w*(_-M)+C*(R-B)+L*(S-H),I>0&&(M+=w*I,B+=C*I,H+=L*I),w=_-M,C=R-B,L=S-H,I=w*w+C*C+L*L,I<=p&&s.push(new BVHIntersect([_,R,S,_,R,S,_,R,S],[M,B,H],T));A=h*BYTES_PER_NODE/2,m=d[A+16],y=d[A+17],m&&g.push(m),y&&g.push(y)}return s},t}(BVHObject);const encodedJs$1="KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO3ZhciBlcj1mdW5jdGlvbihlLHIpe3JldHVybiBlcj1PYmplY3Quc2V0UHJvdG90eXBlT2Z8fHtfX3Byb3RvX186W119aW5zdGFuY2VvZiBBcnJheSYmZnVuY3Rpb24odCxvKXt0Ll9fcHJvdG9fXz1vfXx8ZnVuY3Rpb24odCxvKXtmb3IodmFyIGYgaW4gbylPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwobyxmKSYmKHRbZl09b1tmXSl9LGVyKGUscil9O2Z1bmN0aW9uIGhyKGUscil7aWYodHlwZW9mIHIhPSJmdW5jdGlvbiImJnIhPT1udWxsKXRocm93IG5ldyBUeXBlRXJyb3IoIkNsYXNzIGV4dGVuZHMgdmFsdWUgIitTdHJpbmcocikrIiBpcyBub3QgYSBjb25zdHJ1Y3RvciBvciBudWxsIik7ZXIoZSxyKTtmdW5jdGlvbiB0KCl7dGhpcy5jb25zdHJ1Y3Rvcj1lfWUucHJvdG90eXBlPXI9PT1udWxsP09iamVjdC5jcmVhdGUocik6KHQucHJvdG90eXBlPXIucHJvdG90eXBlLG5ldyB0KX10eXBlb2YgU3VwcHJlc3NlZEVycm9yPT0iZnVuY3Rpb24iJiZTdXBwcmVzc2VkRXJy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eBase64$1=n=>Uint8Array.from(atob(n),t=>t.charCodeAt(0)),blob$2=typeof self!="undefined"&&self.Blob&&new Blob([decodeBase64$1(encodedJs$1)],{type:"text/javascript;charset=utf-8"});function WorkerWrapper$1(n){let t;try{if(t=blob$2&&(self.URL||self.webkitURL).createObjectURL(blob$2),!t)throw"";const e=new Worker(t,{name:n==null?void 0:n.name});return e.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),e}catch(e){return new Worker("data:text/javascript;base64,"+encodedJs$1,{name:n==null?void 0:n.name})}finally{t&&(self.URL||self.webkitURL).revokeObjectURL(t)}}var WorkerPool$1=function(){function n(t,e){this.pool=e,this.workerCreator=t,this.queue=[],this.workers=[],this.workersResolver=[],this.workerStatus=0}return n.prototype.initWorker=function(t){if(this.workerCreator&&!this.workers[t]){var e=this.workerCreator();e.addEventListener("message",this.onMessage.bind(this,t)),this.workers[t]=e}},n.prototype.getIdleWorker=function(){for(var t=0;t<this.pool;t++)if(!(this.workerStatus&1<<t))return t;return-1},n.prototype.onMessage=function(t,e){var r=this.workersResolver[t],o=r.resolve,s=r.reject;if(e.data&&"$$error"in e.data?s(e.data.$$error):o(e.data),this.queue.length){var u=this.queue.shift(),l=u.resolve,c=u.reject,f=u.input,d=u.transfer;this.workersResolver[t]={resolve:l,reject:c},this.workers[t].postMessage(f,d)}else this.workerStatus^=1<<t},n.prototype.postMessage=function(t,e){var r=this;return e===void 0&&(e=[]),new Promise(function(o,s){var u=r.getIdleWorker();u!==-1?(r.initWorker(u),r.workerStatus|=1<<u,r.workersResolver[u]={resolve:o,reject:s},r.workers[u].postMessage(t,e)):r.queue.push({resolve:o,reject:s,input:t,transfer:e})})},n.prototype.dispose=function(){this.workers.forEach(function(t){return t.terminate()}),this.workersResolver.length=0,this.workers.length=0,this.queue.length=0,this.workerStatus=0},n}(),bvhWorkerPool=new WorkerPool$1(function(){return new WorkerWrapper$1},4),bvhMeshMap=new Map,scratchRay=new THREE__namespace.Ray,scratchNormalMatrix=new THREE__namespace.Matrix3,scratchInverseMatrix=new THREE__namespace.Matrix4,scratchIntersectionFaceA=new THREE__namespace.Vector3,scratchIntersectionFaceB=new THREE__namespace.Vector3,scratchIntersectionFaceC=new THREE__namespace.Vector3,scratchIntersectionTriangle=new THREE__namespace.Triangle;function raycastMesh(n,t,e,r){var o,s=n.matrixWorld;scratchInverseMatrix.getInverse(s),scratchRay.copy(e.ray).applyMatrix4(scratchInverseMatrix);for(var u=t.intersectRay(scratchRay.origin,scratchRay.direction,0,[]),l=n.geometry,c=n.material,f=l.groups,d=l.index,p=0,v=u.length;p<v;p++){var g=u[p],h=g.triangle,m=g.index,y=g.intersectionPoint,A=new THREE__namespace.Vector3(y[0],y[1],y[2]).applyMatrix4(s),E=e.ray.origin.distanceTo(A);if(!(E<e.near||E>e.far)){var b=void 0;if(Array.isArray(c)){if(f)for(var T=m*3,_=0,R=f;_<R.length;_++){var S=R[_];if(T>=S.start&&T-S.start<S.count){b=c[(o=S.materialIndex)!==null&&o!==void 0?o:0];break}}}else b=c;if(b){var M=scratchIntersectionTriangle.set(scratchIntersectionFaceA.set(h[0],h[1],h[2]).applyMatrix4(s),scratchIntersectionFaceB.set(h[3],h[4],h[5]).applyMatrix4(s),scratchIntersectionFaceC.set(h[6],h[7],h[8]).applyMatrix4(s)).getNormal(new THREE__namespace.Vector3),B=m*3,H=new THREE__namespace.Face3(d?d.array[B]:B,d?d.array[B+1]:B+1,d?d.array[B+2]:B+2,M),w=e.ray.direction.dot(M);b.side===THREE__namespace.FrontSide&&w>=0||b.side===THREE__namespace.BackSide&&w<=0||r.push({distance:E,object:n,face:H,point:A,distanceToRay:0,faceIndex:m})}}}}function raycastPoints(n,t,e,r){var o,s,u=n.matrixWorld;scratchNormalMatrix.getNormalMatrix(u),scratchInverseMatrix.getInverse(u);var l=((s=(o=e.params.Points)===null||o===void 0?void 0:o.threshold)!==null&&s!==void 0?s:1)*scratchInverseMatrix.getMaxScaleOnAxis();scratchRay.copy(e.ray).applyMatrix4(scratchInverseMatrix);for(var c=t.intersectRay(scratchRay.origin,scratchRay.direction,l,[]),f=n.geometry,d=f.index,p=f.getAttribute("normal"),v=0,g=c.length;v<g;v++){var h=c[v],m=h.triangle,y=h.index,A=h.intersectionPoint,E=new THREE__namespace.Vector3(A[0],A[1],A[2]).applyMatrix4(u),b=e.ray.origin.distanceTo(E);if(!(b<e.near||b>e.far)){var T=scratchIntersectionFaceA.set(m[0],m[1],m[2]).applyMatrix4(u),_=d?d.array[y]:y,R=void 0;if(p instanceof THREE__namespace.BufferAttribute){var S=new THREE__namespace.Vector3().fromBufferAttribute(p,_).applyNormalMatrix(scratchNormalMatrix);R=new THREE__namespace.Face3(_,_,_,S)}r.push({distance:b,object:n,face:R,point:E,distanceToRay:E.distanceTo(T),index:y})}}}var BVH_MESH_PROP="__bvh_mesh__",originMeshRaycast=THREE__namespace.Mesh.prototype.raycast;function overrideMeshRaycast(n,t){var e=getBvhTreeForMesh(this);e?raycastMesh(this,e,n,t):originMeshRaycast.call(this,n,t)}function getBvhTreeForMesh(n){var t=n[BVH_MESH_PROP];return t instanceof BVHMesh,t}function bindBvhTreeForMesh(n,t){var e;Object.assign(n,(e={},e[BVH_MESH_PROP]=t,e.raycast=overrideMeshRaycast,e))}var BVH_POINTS_PROP="__bvh_points__",originPointsRaycast=THREE__namespace.Points.prototype.raycast;function overridePointsRaycast(n,t){var e=getBvhTreeForPoints(this);e?raycastPoints(this,e,n,t):originPointsRaycast.call(this,n,t)}function getBvhTreeForPoints(n){var t=n[BVH_POINTS_PROP];return t instanceof BVHPoints,t}function bindBvhTreeForPoints(n,t){var e;Object.assign(n,(e={},e[BVH_POINTS_PROP]=t,e.raycast=overridePointsRaycast,e))}function generateBvhTree(n,t,e,r){var o=[];return n.traverse(function(s){(s instanceof THREE__namespace.Mesh||s instanceof THREE__namespace.Points)&&s.geometry instanceof THREE__namespace.BufferGeometry&&o.push(s)}),Promise.resolve().then(function(){for(var s=[],u=new Set,l=null,c=0;c<o.length;c++){var f=o[c],d=f.geometry;if(d instanceof THREE__namespace.BufferGeometry){var p=void 0;if(f instanceof THREE__namespace.Mesh?p="mesh":f instanceof THREE__namespace.Points&&(p="points"),!!p){var v=d.boundingBox,g=v?[v.min.x,v.min.y,v.min.z,v.max.x,v.max.y,v.max.z]:void 0,h={};for(var m in d.attributes){var y=d.attributes[m];y instanceof THREE__namespace.InterleavedBufferAttribute?(h[m]={array:y.data.array,stride:y.data.stride,offset:y.offset},l=y.data.array,l&&l.buffer instanceof ArrayBuffer&&u.add(l.buffer)):(h[m]={array:y.array},l=y.array,l&&l.buffer instanceof ArrayBuffer&&u.add(l.buffer))}var A=void 0,E=d.getIndex();E&&(E instanceof THREE__namespace.InterleavedBufferAttribute?(A={array:E.data.array,stride:E.data.stride,offset:E.offset},l=E.data.array,l&&l.buffer instanceof ArrayBuffer&&u.add(l.buffer)):(A={array:E.array},l=E.array,l&&l.buffer instanceof ArrayBuffer&&u.add(l.buffer)));var b={type:p,attributes:h,indices:A,maxItemPerNode:e,maxTreeDepth:r,extents:g};s.push(b)}}}return bvhWorkerPool.postMessage(s,Array.from(u))}).then(function(s){for(var u=0;u<o.length;u++){var l=o[u],c=l.geometry,f=s[u];if(c instanceof THREE__namespace.BufferGeometry){for(var d in f.attributes){var p=f.attributes[d].array,v=c.attributes[d];v instanceof THREE__namespace.InterleavedBufferAttribute?v.data.array=p:v.array=p}var g=c.getIndex();if(g&&f.indices){var p=f.indices.array;g instanceof THREE__namespace.InterleavedBufferAttribute?g.data.array=p:g.array=p}if(l instanceof THREE__namespace.Mesh){var h=new BVHMesh(f.attributes.position,f.indices);h.offsetArray=f.offsetArray,h.rootNodePacked=f.rootNodePacked,bindBvhTreeForMesh(l,h)}else if(l instanceof THREE__namespace.Points){var h=new BVHPoints(f.attributes.position,f.indices);h.offsetArray=f.offsetArray,h.rootNodePacked=f.rootNodePacked,bindBvhTreeForPoints(l,h)}}}return n})}var TileNode=function(n){__extends(t,n);function t(e,r,o){o===void 0&&(o=noop$1);var s=n.call(this)||this;return s.contentObject=r,s.name=e,s.materials=[],s.pbmObjects=[],s.disposers=[o],s.add(r),r.traverse(function(u){var l;if(u instanceof THREE__namespace.Mesh||u instanceof THREE__namespace.Points){var c=u.material;Array.isArray(c)?(l=s.materials).push.apply(l,c):s.materials.push(c)}(u instanceof PBMMesh||u instanceof PBMPointCloud)&&s.pbmObjects.push(u)}),s}return t.prototype.generateBvhTree=function(){return generateBvhTree(this,!0,200,10)},t.prototype.intersectRaycaster=function(e,r,o){r===void 0&&(r=!0),o===void 0&&(o=[]);for(var s=this.children.slice(),u,l=[];u=s.pop();)if(u.visible){u.raycast(e,l);for(var c=0,f=u.children.length;c<f;c++)s.push(u.children[c])}return l.forEach(function(d){var p=0;if((d.object instanceof PBMMesh||d.object instanceof PBMPointCloud)&&d.face){var v=Array.isArray(d.object.material)?d.object.material[d.face.materialIndex]:d.object.material;v&&(p=v.floor)}d.floor=p}),r&&l.sort(function(d,p){return d.distance-p.distance}),o.push.apply(o,l),o},t.prototype.update=function(e,r,o,s){for(var u=0,l=this.pbmObjects;u<l.length;u++){var c=l[u];c.update(e,r,o,s)}},t.prototype.dispose=function(){for(var e=0,r=this.disposers;e<r.length;e++){var o=r[e];o()}this.disposers.length=0,this.pbmObjects.length=0},t.prototype.clone=function(){return new t(this.name,this.contentObject.clone())},t}(THREE__namespace.Object3D);function pathJoin(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];var e=[];n=n.map(function(l){return(l!=null?l:"").trim()}).filter(function(l){return l.length>0&&!/^\/+$/.test(l)});for(var r=0;r<n.length;r++){var o=r===0,s=r===n.length-1,u=n[r];o||(u=u.replace(/^\.\//,"").replace(/^\/+/,"")),s||(u=u.replace(/\/+$/,"")),e.push(u)}return e.join("/")}function normalizeURL(n){var t,e=/^(http\:|https\:|file\:)?\/\/[^/]/.exec(n);if(!e)return n;var r=e[1]||"",o=n.slice(r.length+2),s=o.indexOf("#");s>=0&&(n.slice(s),o=n.slice(0,s));var u=o.indexOf("?");u>=0&&(n.slice(u),o=n.slice(0,u));for(var l=o.split("/"),c=l.shift(),f=(t=l.pop())!==null&&t!==void 0?t:"",d=[],p=0,v=l;p<v.length;p++){var g=v[p];if(!(g===""||g===".")){if(g===".."){d.pop();continue}d.push(g)}}return r+"//"+c+"/"+d.join("/")+"/"+f}function isAbsoluteURL(n){return n.indexOf("//")===0||/^[0-9a-z]+\:/i.test(n)}function normalizeTileHeader(n,t,e){var r;if(n.content){var o=(r=n.content.uri)!==null&&r!==void 0?r:n.content.url;typeof o=="string"&&!isAbsoluteURL(o)&&(n.content.uri=normalizeURL(pathJoin(t,o)))}if(n.transform){for(var s=!1,u=0;u<16;u++){var l=n.transform[u];if(typeof l!="number"||isNaN(l)||!isFinite(l)){s=!0;break}}if(n.transform[15]===0&&(s=!0),s)throw new Error("Invalid Tile Transform: "+JSON.stringify(n.transform))}if(n.children)for(var c=0,f=n.children;c<f.length;c++){var d=f[c];normalizeTileHeader(d,t)}return n}function normalizeTilesetHeader(n,t){if(n.asset||(n.asset={}),n.rootMeta||(n.rootMeta={}),n.rootMeta.taskParameters||(n.rootMeta.taskParameters={}),n.asset.overview){var e=n.asset.overview;isAbsoluteURL(e.imageFile)||(e.imageFile=normalizeURL(pathJoin(t,e.imageFile))),isAbsoluteURL(e.worldFile)||(e.worldFile=normalizeURL(pathJoin(t,e.worldFile)))}if(n.asset.trajectories)for(var r=0;r<n.asset.trajectories.list.length;r++){var o=n.asset.trajectories.list[r];o.file=normalizeURL(pathJoin(t,o.file))}return normalizeTileHeader(n.root,t),n}function initTextures(n,t,e){for(var r,o,s=Promise.resolve(),u=n.slice(),l=function(){for(var c=[],f=0,d=void 0;d=u.shift();){c.push(d);var p=((r=d.image)===null||r===void 0?void 0:r.width)*((o=d.image)===null||o===void 0?void 0:o.height);if(!isNaN(p)&&isFinite(p)&&(f+=p),f>=e)break}s=s.then(function(){return new Promise(function(v){AnimationFrameLoop.shared.add(function(){for(var g=0,h=c;g<h.length;g++){var m=h[g];t.initTexture(m)}v()},!0)})}).catch(function(){})};u.length>0;)l();return s}function appendSearch(n,t){if(t===void 0&&(t=""),(t[0]==="?"||t[0]==="&")&&(t=t.slice(1)),!t)return n;var e=n.indexOf("#"),r="";return e>=0&&(r=n.slice(e),n=n.slice(0,e)),(n[n.length-1]==="?"||n[n.length-1]==="&")&&(n=n.slice(0,-1)),n.indexOf("?")>=0?"".concat(n,"&").concat(t).concat(r):"".concat(n,"?").concat(t).concat(r)}var SIZEOF_UINT32$1=4;function parseHeader$1(n,t,e){var r=new DataView(t);if(n.magic=r.getUint32(e,!0),e+=SIZEOF_UINT32$1,n.version=r.getUint32(e,!0),e+=SIZEOF_UINT32$1,n.byteLength=r.getUint32(e,!0),e+=SIZEOF_UINT32$1,n.version!==1)throw new Error("3D Tile Version ".concat(n.version," not supported"));return e}var _a$4,GL_TYPE;(function(n){n[n.BYTE=5120]="BYTE",n[n.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",n[n.SHORT=5122]="SHORT",n[n.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",n[n.INT=5124]="INT",n[n.UNSIGNED_INT=5125]="UNSIGNED_INT",n[n.FLOAT=5126]="FLOAT",n[n.DOUBLE=5130]="DOUBLE"})(GL_TYPE||(GL_TYPE={}));var GL_TYPE_TO_ARRAY_TYPE=(_a$4={},_a$4[GL_TYPE.DOUBLE]=Float64Array,_a$4[GL_TYPE.FLOAT]=Float32Array,_a$4[GL_TYPE.UNSIGNED_SHORT]=Uint16Array,_a$4[GL_TYPE.UNSIGNED_INT]=Uint32Array,_a$4[GL_TYPE.UNSIGNED_BYTE]=Uint8Array,_a$4[GL_TYPE.BYTE]=Int8Array,_a$4[GL_TYPE.SHORT]=Int16Array,_a$4[GL_TYPE.INT]=Int32Array,_a$4),NAME_TO_GL_TYPE={DOUBLE:GL_TYPE.DOUBLE,FLOAT:GL_TYPE.FLOAT,UNSIGNED_SHORT:GL_TYPE.UNSIGNED_SHORT,UNSIGNED_INT:GL_TYPE.UNSIGNED_INT,UNSIGNED_BYTE:GL_TYPE.UNSIGNED_BYTE,BYTE:GL_TYPE.BYTE,SHORT:GL_TYPE.SHORT,INT:GL_TYPE.INT};function getArrayType(n){var t=GL_TYPE_TO_ARRAY_TYPE[n];if(!t)throw new Error("Failed to convert GL type");return t}function getByteSize(n){var t=getArrayType(n);return t.BYTES_PER_ELEMENT}function createTypedArray(n,t,e,r){e===void 0&&(e=0);var o=getArrayType(n);if(e%getByteSize(n)!==0){var s=r?t.slice(e,e+r*getByteSize(n)):t.slice(e);return new o(s)}else return new o(t,e,r!=null?r:(t.byteLength-e)/getByteSize(n))}function glTypeFromName(n){var t=NAME_TO_GL_TYPE[n];if(!t)throw new Error("Failed to convert GL type");return t}var FeatureTable=function(){function n(t,e){this.featuresLength=0,this.cachedTypedArrays={},this.json=t,this.buffer=e;var r=this.getGlobalProperty("POINTS_LENGTH",GL_TYPE.UNSIGNED_INT,1);r&&r.length&&(this.featuresLength=r[0])}return n.prototype.getExtension=function(t){return this.json.extensions&&this.json.extensions[t]},n.prototype.hasProperty=function(t){return!!this.json[t]},n.prototype.getGlobalProperty=function(t,e,r){var o=this.json[t];if(typeof o=="number"){var s=getArrayType(e);return new s([o])}else if(Array.isArray(o)){var s=getArrayType(e);return new s(o)}else if(o&&Number.isFinite(o.byteOffset))return this.getTypedArrayFromBinary(t,e,r,1,o.byteOffset);return null},n.prototype.getPropertyArray=function(t,e,r){var o=this.json[t];return o&&Number.isFinite(o.byteOffset)?("componentType"in o&&(e=glTypeFromName(o.componentType)),this.getTypedArrayFromBinary(t,e,r,this.featuresLength,o.byteOffset)):this.getTypedArrayFromArray(t,e,o)},n.prototype.getProperty=function(t,e,r,o,s){var u=this.json[t];if(!u)return null;var l=this.getPropertyArray(t,e,r);if(r===1)return s[0]=l[o],s;for(var c=0;c<r;++c)s[c]=l[r*o+c];return s},n.prototype.getTypedArrayFromBinary=function(t,e,r,o,s){var u=this.cachedTypedArrays,l=u[t];return l||(l=createTypedArray(e,this.buffer.buffer,this.buffer.byteOffset+s,o*r),u[t]=l),l},n.prototype.getTypedArrayFromArray=function(t,e,r){var o=this.cachedTypedArrays,s=o[t];return s||(s=createTypedArray(e,r),o[t]=s),s},n}(),SIZEOF_UINT32=4,DEPRECATION_WARNING="b3dm tile in legacy format.";function getStringFromArrayBuffer(n,t,e){var r=new TextDecoder("utf8"),o=new Uint8Array(n,t,e),s=r.decode(o);return s}function parseTable(n,t,e){return e=parseTablesHeader(n,t,e),e=parseFeatureTable(n,t,e),e=parseBatchTable(n,t,e),e}function parseTablesHeader(n,t,e){var r=new DataView(t),o=0;n.header=n.header||{};var s=r.getUint32(e,!0);e+=SIZEOF_UINT32;var u=r.getUint32(e,!0);e+=SIZEOF_UINT32;var l=r.getUint32(e,!0);e+=SIZEOF_UINT32;var c=r.getUint32(e,!0);return e+=SIZEOF_UINT32,l>=570425344?(e-=SIZEOF_UINT32*2,o=s,l=u,c=0,s=0,u=0,console.warn(DEPRECATION_WARNING)):c>=570425344&&(e-=SIZEOF_UINT32,o=l,l=s,c=u,s=0,u=0,console.warn(DEPRECATION_WARNING)),n.header.featureTableJsonByteLength=s,n.header.featureTableBinaryByteLength=u,n.header.batchTableJsonByteLength=l,n.header.batchTableBinaryByteLength=c,n.header.batchLength=o,e}function parseFeatureTable(n,t,e){var r=n.header||{},o=r.featureTableJsonByteLength,s=r.featureTableBinaryByteLength,u=r.batchLength;if(n.featureTableJson={BATCH_LENGTH:u||0},o&&o>0){var l=getStringFromArrayBuffer(t,e,o);n.featureTableJson=JSON.parse(l)}e+=o||0,n.featureTableBinary=new Uint8Array(t,e,s),e+=s||0,n.rtcCenter=[0,0,0];var c=new FeatureTable(n.featureTableJson,n.featureTableBinary);if(Array.isArray(c.json.RTC_CENTER)){var f=c.json.RTC_CENTER;n.rtcCenter[0]=f[0],n.rtcCenter[1]=f[1],n.rtcCenter[2]=f[2]}else{var f=c.getGlobalProperty("RTC_CENTER",GL_TYPE.FLOAT,3);f&&(n.rtcCenter[0]=f[0],n.rtcCenter[1]=f[1],n.rtcCenter[2]=f[2])}return e}function parseBatchTable(n,t,e){var r=n.header||{},o=r.batchTableJsonByteLength,s=r.batchTableBinaryByteLength;if(o&&o>0){var u=getStringFromArrayBuffer(t,e,o);n.batchTableJson=JSON.parse(u),e+=o,s&&s>0&&(n.batchTableBinary=new Uint8Array(t,e,s),n.batchTableBinary=new Uint8Array(n.batchTableBinary),e+=s)}return e}function sliceArrayBuffer(n,t,e){var r=e!==void 0?new Uint8Array(n).subarray(t,t+e):new Uint8Array(n).subarray(t),o=new Uint8Array(r);return o.buffer}function parseGlTFArrayBuffer(n,t,e){var r=n.byteLength-e;if(r===0)throw new Error("glTF byte length must be greater than 0.");return e%4!==0&&console.warn("".concat(n.type,": embedded glb is not aligned to a 4-byte boundary.")),n.gltfArrayBuffer=sliceArrayBuffer(t,e,r),n.byteLength}function decodeText(n){if(typeof TextDecoder!="undefined")return new TextDecoder().decode(n);for(var t="",e=0,r=n.length;e<r;e++)t+=String.fromCharCode(n[e]);try{return decodeURIComponent(escape(t))}catch(o){return t}}var WEBGL_CONSTANTS={FLOAT:5126,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,LINEAR:9729,REPEAT:10497,SAMPLER_2D:35678,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123},WEBGL_COMPONENT_TYPES={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},WEBGL_FILTERS={9728:THREE__namespace.NearestFilter,9729:THREE__namespace.LinearFilter,9984:THREE__namespace.NearestMipmapNearestFilter,9985:THREE__namespace.LinearMipmapNearestFilter,9986:THREE__namespace.NearestMipmapLinearFilter,9987:THREE__namespace.LinearMipmapLinearFilter},WEBGL_WRAPPINGS={33071:THREE__namespace.ClampToEdgeWrapping,33648:THREE__namespace.MirroredRepeatWrapping,10497:THREE__namespace.RepeatWrapping},WEBGL_TYPE_SIZES={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},ATTRIBUTES={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv2",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},PATH_PROPERTIES={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},INTERPOLATION={CUBICSPLINE:void 0,LINEAR:THREE__namespace.InterpolateLinear,STEP:THREE__namespace.InterpolateDiscrete},ALPHA_MODES={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function values(n){var t=[];for(var e in n)t.push(n[e]);return t}function composeDsiposeSet(n){var t=Array.from(n);return function(){for(var e=0,r=t;e<r.length;e++){var o=r[e];typeof o.dispose=="function"&&o.dispose(),typeof o.close=="function"&&o.close()}}}var Parser=function(){function n(t,e,r){this.json=t,this.extensions=e,this.options=r,this.cache=new Map,this.disposeSet=new Set,this.textureSet=new Set,this.nodeNamesUsed={}}return n.prototype.dispose=function(){this.cache.clear(),this.disposeSet.forEach(function(t){typeof t.dispose=="function"&&t.dispose(),typeof t.close=="function"&&t.close()}),this.disposeSet.clear(),this.textureSet.clear(),this.extensions={},this.json={asset:{version:"unknown"}}},n.prototype.markDefs=function(){for(var t=this.json.nodes||[],e=this.json.skins||[],r=this.json.meshes||[],o=0,s=e.length;o<s;o++)for(var u=e[o].joints,l=0,c=u.length;l<c;l++)t[u[l]].isBone=!0;for(var f=0,d=t.length;f<d;f++){var p=t[f];p.mesh!==void 0&&p.skin!==void 0&&(r[p.mesh].isSkinnedMesh=!0)}},n.prototype.parse=function(){var t=this,e=this.json,r=this.extensions;this.markDefs();for(var o=0,s=values(r);o<s.length;o++){var u=s[o];u.markDefs(this)}return Promise.all(values(r).map(function(l){return l.prepare(t)})).then(function(){var l,c,f;return Promise.all([Promise.all(((l=e.scenes)!==null&&l!==void 0?l:[]).map(function(d,p){return t.loadScene(p)})),Promise.all(((c=e.animations)!==null&&c!==void 0?c:[]).map(function(d,p){return t.loadAnimation(p)})),Promise.all(((f=e.cameras)!==null&&f!==void 0?f:[]).map(function(d,p){return t.loadCamera(p)}))])}).then(function(l){var c=l[0],f=l[1],d=l[2],p={json:e,scene:c[e.scene||0],scenes:c,animations:f,cameras:d,textures:[],dispose:noop$1};return p}).then(function(l){return Promise.all(values(r).map(function(c){return c.emitResult(l,t)})).then(function(){return l})}).then(function(l){var c=Array.from(t.textureSet),f=composeDsiposeSet(t.disposeSet);return Object.assign(l,{textures:c,dispose:f}),t.textureSet.clear(),t.disposeSet.clear(),t.dispose(),l})},n.prototype.loadCamera=function(t){var e="camera:"+t,r=this.cache.get(e);if(r)return r;for(var o=null,s=0,u=values(this.extensions);s<u.length;s++){var l=u[s];if(o=l.loadCamera(t,this),o)break}if(!o){var c=void 0,f=this.json.cameras[t],d=f[f.type];d?f.type==="perspective"?c=new THREE__namespace.PerspectiveCamera(THREE__namespace.MathUtils.radToDeg(d.yfov),d.aspectRatio||1,d.znear||1,d.zfar||2e6):f.type==="orthographic"?c=new THREE__namespace.OrthographicCamera(-d.xmag,d.xmag,d.ymag,-d.ymag,d.znear,d.zfar):(console.warn("glTF: Invalid camera type ".concat(f.type,".")),c=new THREE__namespace.Camera):(console.warn("glTF: Missing camera parameters."),c=new THREE__namespace.Camera),f.name&&(c.name=this.createUniqueName(f.name)),o=Promise.resolve(c)}return this.cache.set(e,o),o},n.prototype.loadSkin=function(t){var e="animation:"+t,r=this.cache.get(e);if(r)return r;var o,s=this.json.skins[t],u={joints:s.joints};return s.inverseBindMatrices===void 0?o=Promise.resolve(u):o=this.loadAccessor(s.inverseBindMatrices).then(function(l){return l&&(u.inverseBindMatrices=l),u}),this.cache.set(e,o),o},n.prototype.loadAnimation=function(t){var e="animation:"+t,r=this.cache.get(e);if(r)return r;for(var o=null,s=0,u=values(this.extensions);s<u.length;s++){var l=u[s];if(o=l.loadAnimation(t,this),o)break}if(!o){for(var c=this.json,f=c.animations[t],d=[],p=[],v=[],g=[],h=[],m=0,y=f.channels.length;m<y;m++){var A=f.channels[m],E=f.samplers[A.sampler],b=A.target,T=b.node!==void 0?b.node:b.id,_=f.parameters!==void 0?f.parameters[E.input]:E.input,R=f.parameters!==void 0?f.parameters[E.output]:E.output;d.push(this.loadNode(T)),p.push(this.loadAccessor(_)),v.push(this.loadAccessor(R)),g.push(E),h.push(b)}o=Promise.all([Promise.all(d),Promise.all(p),Promise.all(v),Promise.all(g),Promise.all(h)]).then(function(S){for(var M=S[0],B=S[1],H=S[2],w=S[3],C=S[4],L=[],I=function(D,U){var z=M[D],G=B[D],q=H[D],K=w[D],j=C[D];if(z===void 0)return"continue";z.updateMatrix(),z.matrixAutoUpdate=!0;var W=void 0;switch(PATH_PROPERTIES[j.path]){case PATH_PROPERTIES.weights:W=THREE__namespace.NumberKeyframeTrack;break;case PATH_PROPERTIES.rotation:W=THREE__namespace.QuaternionKeyframeTrack;break;case PATH_PROPERTIES.position:case PATH_PROPERTIES.scale:default:W=THREE__namespace.VectorKeyframeTrack;break}var X=z.name?z.name:z.uuid,ee=K.interpolation!==void 0?INTERPOLATION[K.interpolation]:THREE__namespace.InterpolateLinear,$=[];PATH_PROPERTIES[j.path]===PATH_PROPERTIES.weights?z.traverse(function(pe){pe.morphTargetInfluences&&$.push(pe.name?pe.name:pe.uuid)}):$.push(X);var re=q.array;if(q.normalized){for(var ie=getNormalizedComponentScale(re.constructor),se=new Float32Array(re.length),ae=0,fe=re.length;ae<fe;ae++)se[ae]=re[ae]*ie;re=se}for(var ae=0,fe=$.length;ae<fe;ae++){var ne=new W($[ae]+"."+PATH_PROPERTIES[j.path],G.array,re,ee);L.push(ne)}},F=0,k=M.length;F<k;F++)I(F);var N=f.name?f.name:"animation_"+t;return new THREE__namespace.AnimationClip(N,void 0,L)})}return this.cache.set(e,o),o},n.prototype.loadBuffer=function(t){var e=this.json.buffers[t];if(e.type&&e.type!=="arraybuffer")throw new Error("glTF: "+e.type+" buffer type is not supported.");var r="buffer:"+t,o=this.cache.get(r);if(o)return o;for(var s=null,u=0,l=values(this.extensions);u<l.length;u++){var c=l[u];if(s=c.loadBuffer(t,this),s)break}if(!s){var f=this.json.buffers[t];s=this.options.fetcher.ajax(this.resolveResouce(f.uri),{responseType:"arraybuffer"}).then(function(d){return d.body})}return this.cache.set(r,s),s},n.prototype.loadBufferView=function(t){var e="bufferView:"+t,r=this.cache.get(e);if(r)return r;for(var o=null,s=0,u=values(this.extensions);s<u.length;s++){var l=u[s];if(o=l.loadBufferView(t,this),o)break}if(!o){var c=this.json.bufferViews[t];o=this.loadBuffer(c.buffer).then(function(f){var d=c.byteLength||0,p=c.byteOffset||0;return f.slice(p,p+d)})}return this.cache.set(e,o),o},n.prototype.loadAccessor=function(t){var e=this,r="accessor:"+t,o=this.cache.get(r);if(o)return o;var s=null;if(!s){var u=this.json.accessors[t];if(u.bufferView===void 0&&u.sparse===void 0)s=Promise.resolve(null);else{var l=[];u.bufferView!==void 0?l.push(this.loadBufferView(u.bufferView)):l.push(Promise.resolve(null)),u.sparse!==void 0&&(l.push(this.loadBufferView(u.sparse.indices.bufferView)),l.push(this.loadBufferView(u.sparse.values.bufferView))),s=Promise.all(l).then(function(c){var f=c[0],d=WEBGL_TYPE_SIZES[u.type],p=WEBGL_COMPONENT_TYPES[u.componentType],v=p.BYTES_PER_ELEMENT,g=v*d,h=u.byteOffset||0,m=u.bufferView!==void 0?e.json.bufferViews[u.bufferView].byteStride:void 0,y=u.normalized===!0,A,E;if(m&&m!==g){var b=Math.floor(h/m),T="InterleavedBuffer:"+u.bufferView+":"+u.componentType+":"+b+":"+u.count,_=e.cache.get(T);_||(A=new p(f,b*m,u.count*m/v),_=new THREE__namespace.InterleavedBuffer(A,m/v),e.cache.set(T,_)),E=new THREE__namespace.InterleavedBufferAttribute(_,d,h%m/v,y)}else f===null?A=new p(u.count*d):A=new p(f,h,u.count*d),E=new THREE__namespace.BufferAttribute(A,d,y);if(u.sparse!==void 0){var R=WEBGL_TYPE_SIZES.SCALAR,S=WEBGL_COMPONENT_TYPES[u.sparse.indices.componentType],M=u.sparse.indices.byteOffset||0,B=u.sparse.values.byteOffset||0,H=new S(c[1],M,u.sparse.count*R),w=new p(c[2],B,u.sparse.count*d);f!==null&&(E=new THREE__namespace.BufferAttribute(E.array.slice(),E.itemSize,E.normalized));for(var C=0,L=H.length;C<L;C++){var I=H[C];if(E.setX(I,w[C*d]),d>=2&&E.setY(I,w[C*d+1]),d>=3&&E.setZ(I,w[C*d+2]),d>=4&&E.setW(I,w[C*d+3]),d>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return E})}}return this.cache.set(r,s),s},n.prototype.createPrimitiveKey=function(t){for(var e=0,r=values(this.extensions);e<r.length;e++){var o=r[e],s=o.createPrimitiveKey(t,this);if(s)return s}for(var u="",l=Object.keys(t.attributes).sort(),c=0,f=l.length;c<f;c++)u+=l[c]+":"+t.attributes[l[c]]+";";return t.indices+":"+u+":"+t.mode},n.prototype.loadGeometry=function(t){for(var e=this,r=null,o=0,s=values(this.extensions);o<s.length;o++){var u=s[o];if(r=u.loadGeometry(t,this),r)break}return r||(r=this.addGeometryPrimitiveAttributes(new THREE__namespace.BufferGeometry,t)),r=r.then(function(l){return e.disposeSet.add(l),l}),r},n.prototype.loadImage=function(t){for(var e=this,r=null,o=0,s=values(this.extensions);o<s.length;o++){var u=s[o];if(r=u.loadImage(t,this),r)break}if(!r){var l=this.json.images[t];if(l.bufferView!==void 0){var c=this.json.bufferViews[l.bufferView];r=this.loadBuffer(c.buffer).then(function(d){var p=c.byteOffset||0,v=c.byteLength||0,g=new Uint8Array(d,p,v),h=new Blob([g],{type:l.mimeType});return createImageBitmapLike(h)})}else if(l.uri){var f=this.resolveResouce(l.uri);r=this.options.fetcher.loadImage(f,{},void 0,void 0,void 0,createImageBitmapLikeImage()).then(function(d){return d.body})}else throw new Error("glTF: Invalid image defs.")}return r=r.then(function(d){return e.disposeSet.add(d),d}),r},n.prototype.loadMaterialAsMeshStandardMaterial=function(t){var e=this,r=[],o=new THREE__namespace.MeshStandardMaterial;if(o.color=new THREE__namespace.Color(1,1,1),o.opacity=1,Object.keys(t.attributes).filter(function(d){return ATTRIBUTES[d]==="color"}).length>0&&(o.vertexColors=!0),Object.keys(t.attributes).filter(function(d){return ATTRIBUTES[d]==="normal"}).length===0&&(o.flatShading=!0),Object.keys(t.attributes).filter(function(d){return ATTRIBUTES[d]==="tangent"}).length===0&&(o.normalScale&&(o.normalScale.y*=-1),o.clearcoatNormalScale&&(o.clearcoatNormalScale.y*=-1)),t.material!==void 0){var s=this.json.materials[t.material];s.name&&(o.name=s.name);var u=s.pbrMetallicRoughness||{};if(Array.isArray(u.baseColorFactor)){var l=u.baseColorFactor;o.color.fromArray(l),o.opacity=l[3]}u.baseColorTexture!==void 0&&r.push(this.createMaterialTexture(u.baseColorTexture).then(function(d){d.encoding=THREE__namespace.sRGBEncoding,o.map=d,e.disposeSet.add(d)})),o.metalness=u.metallicFactor!==void 0?u.metallicFactor:1,o.roughness=u.roughnessFactor!==void 0?u.roughnessFactor:1,u.metallicRoughnessTexture!==void 0&&r.push(this.createMaterialTexture(u.metallicRoughnessTexture).then(function(d){d.encoding=THREE__namespace.sRGBEncoding,o.metalnessMap=d,o.roughnessMap=d,e.disposeSet.add(d)})),s.doubleSided===!0&&(o.side=THREE__namespace.DoubleSide);var c=s.alphaMode||ALPHA_MODES.OPAQUE;if(c===ALPHA_MODES.BLEND?(o.transparent=!0,o.depthWrite=!1):(o.transparent=!1,c===ALPHA_MODES.MASK&&(o.alphaTest=s.alphaCutoff!==void 0?s.alphaCutoff:.5)),s.normalTexture!==void 0&&(r.push(this.createMaterialTexture(s.normalTexture).then(function(d){o.normalMap=d,e.disposeSet.add(d)})),o.normalScale=new THREE__namespace.Vector2(1,1),s.normalTexture.scale!==void 0)){var f=s.normalTexture.scale;o.normalScale.set(f,f)}s.occlusionTexture!==void 0&&(r.push(this.createMaterialTexture(s.occlusionTexture).then(function(d){o.aoMap=d,e.disposeSet.add(d)})),s.occlusionTexture.strength!==void 0&&(o.aoMapIntensity=s.occlusionTexture.strength)),s.emissiveFactor!==void 0&&(o.emissive=new THREE__namespace.Color().fromArray(s.emissiveFactor)),s.emissiveTexture!==void 0&&r.push(this.createMaterialTexture(s.emissiveTexture).then(function(d){o.emissiveMap=d,e.disposeSet.add(d)}))}return this.disposeSet.add(o),Promise.all(r).then(function(){return o})},n.prototype.loadMaterialAsLineBasicMaterial=function(t){var e=[],r=new THREE__namespace.LineBasicMaterial;if(r.color=new THREE__namespace.Color(1,1,1),r.opacity=1,Object.keys(t.attributes).filter(function(c){return ATTRIBUTES[c]==="color"}).length>0&&(r.vertexColors=!0),Object.keys(t.attributes).filter(function(c){return ATTRIBUTES[c]==="tangent"}).length===0&&(r.normalScale&&(r.normalScale.y*=-1),r.clearcoatNormalScale&&(r.clearcoatNormalScale.y*=-1)),t.material!==void 0){var o=this.json.materials[t.material];o.name&&(r.name=o.name);var s=o.pbrMetallicRoughness||{};if(Array.isArray(s.baseColorFactor)){var u=s.baseColorFactor;r.color.fromArray(u),r.opacity=u[3]}o.doubleSided===!0&&(r.side=THREE__namespace.DoubleSide);var l=o.alphaMode||ALPHA_MODES.OPAQUE;l===ALPHA_MODES.BLEND?(r.transparent=!0,r.depthWrite=!1):(r.transparent=!1,l===ALPHA_MODES.MASK&&(r.alphaTest=o.alphaCutoff!==void 0?o.alphaCutoff:.5))}return this.disposeSet.add(r),Promise.all(e).then(function(){return r})},n.prototype.loadMaterialAsPointsMaterial=function(t){var e=this,r=[],o=new THREE__namespace.PointsMaterial;if(o.color=new THREE__namespace.Color(1,1,1),o.opacity=1,o.sizeAttenuation=!1,Object.keys(t.attributes).filter(function(f){return ATTRIBUTES[f]==="color"}).length>0&&(o.vertexColors=!0),Object.keys(t.attributes).filter(function(f){return ATTRIBUTES[f]==="tangent"}).length===0&&(o.normalScale&&(o.normalScale.y*=-1),o.clearcoatNormalScale&&(o.clearcoatNormalScale.y*=-1)),t.material!==void 0){var s=this.json.materials[t.material];s.name&&(o.name=s.name);var u=s.pbrMetallicRoughness||{};if(Array.isArray(u.baseColorFactor)){var l=u.baseColorFactor;o.color.fromArray(l),o.opacity=l[3]}u.baseColorTexture!==void 0&&r.push(this.createMaterialTexture(u.baseColorTexture).then(function(f){f.encoding=THREE__namespace.sRGBEncoding,o.map=f,e.disposeSet.add(f)})),s.doubleSided===!0&&(o.side=THREE__namespace.DoubleSide);var c=s.alphaMode||ALPHA_MODES.OPAQUE;c===ALPHA_MODES.BLEND?(o.transparent=!0,o.depthWrite=!1):(o.transparent=!1,c===ALPHA_MODES.MASK&&(o.alphaTest=s.alphaCutoff!==void 0?s.alphaCutoff:.5))}return this.disposeSet.add(o),Promise.all(r).then(function(){return o})},n.prototype.loadMaterial=function(t){var e,r=(e=t.mode)!==null&&e!==void 0?e:WEBGL_CONSTANTS.TRIANGLES,o="material:"+this.createPrimitiveKey(t),s=this.cache.get(o);if(s)return s;for(var u=null,l=0,c=values(this.extensions);l<c.length;l++){var f=c[l];if(u=f.loadMaterial(t,this),u)break}if(r===WEBGL_CONSTANTS.TRIANGLES||r===WEBGL_CONSTANTS.TRIANGLE_STRIP||r===WEBGL_CONSTANTS.TRIANGLE_FAN)u=this.loadMaterialAsMeshStandardMaterial(t);else if(r===WEBGL_CONSTANTS.LINES||r===WEBGL_CONSTANTS.LINE_STRIP||r===WEBGL_CONSTANTS.LINE_LOOP)u=this.loadMaterialAsLineBasicMaterial(t);else if(r===WEBGL_CONSTANTS.POINTS)u=this.loadMaterialAsPointsMaterial(t);else throw new Error("glTF: Primitive mode unsupported: "+r);return this.cache.set(o,u),u},n.prototype.loadTexture=function(t){var e=this,r="texture:"+t,o=this.cache.get(r);if(o)return o;for(var s=null,u=0,l=values(this.extensions);u<l.length;u++){var c=l[u];if(s=c.loadTexture(t,this),s)break}if(!s){var f=this.json.textures[t];s=this.loadImage(f.source).then(function(d){var p=new THREE__namespace.Texture(d);p.needsUpdate=!0,p.flipY=!1,f.name&&(p.name=f.name);var v=e.json.samplers||{},g=v[f.sampler]||{};return p.magFilter=WEBGL_FILTERS[g.magFilter]||THREE__namespace.LinearFilter,p.minFilter=WEBGL_FILTERS[g.minFilter]||THREE__namespace.LinearMipmapLinearFilter,p.wrapS=WEBGL_WRAPPINGS[g.wrapS]||THREE__namespace.RepeatWrapping,p.wrapT=WEBGL_WRAPPINGS[g.wrapT]||THREE__namespace.RepeatWrapping,p.onUpdate=function(){d.close()},p})}return s=s.then(function(d){return e.disposeSet.add(d),d}),this.cache.set(r,s),s},n.prototype.loadMesh=function(t){for(var e=this,r=null,o=0,s=values(this.extensions);o<s.length;o++){var u=s[o];if(r=u.loadMesh(t,this),r)break}if(!r){var l=this.json.meshes[t],c=l.primitives,f=Promise.all(c.map(function(p){return e.loadGeometry(p)})),d=Promise.all(c.map(function(p){return e.loadMaterial(p)}));r=Promise.all([f,d]).then(function(p){for(var v=p[0],g=p[1],h=[],m=0;m<c.length;m++){var y=c[m],A=v[m],E=g[m],b=y.mode||WEBGL_CONSTANTS.TRIANGLES,T=void 0;if(b===WEBGL_CONSTANTS.TRIANGLES||b===WEBGL_CONSTANTS.TRIANGLE_STRIP||b===WEBGL_CONSTANTS.TRIANGLE_FAN)if(b===WEBGL_CONSTANTS.TRIANGLE_STRIP?A=e.toGeometryTrianglesDrawMode(A,THREE__namespace.TriangleStripDrawMode):b===WEBGL_CONSTANTS.TRIANGLE_FAN&&(A=e.toGeometryTrianglesDrawMode(A,THREE__namespace.TriangleFanDrawMode)),e.disposeSet.add(A),l.isSkinnedMesh){var _=new THREE__namespace.SkinnedMesh(A,E);A.attributes.skinWeight.normalized||_.normalizeSkinWeights(),T=_}else T=new THREE__namespace.Mesh(A,E);else if(b===WEBGL_CONSTANTS.POINTS)T=new THREE__namespace.Points(A,E);else if(b===WEBGL_CONSTANTS.LINES)T=new THREE__namespace.LineSegments(A,E);else if(b===WEBGL_CONSTANTS.LINE_STRIP)T=new THREE__namespace.Line(A,E);else if(b===WEBGL_CONSTANTS.LINE_LOOP)T=new THREE__namespace.LineLoop(A,E);else throw new Error("glTF: Primitive mode unsupported: "+b);if(Object.keys(A.morphAttributes).length>0){if(l.weights!==void 0)for(var R=0,S=l.weights.length;R<S;R++)T.morphTargetInfluences[R]=l.weights[R];if(l.extras&&Array.isArray(l.extras.targetNames)){var M=l.extras.targetNames;if(T.morphTargetInfluences.length===M.length){T.morphTargetDictionary={};for(var R=0,S=M.length;R<S;R++)T.morphTargetDictionary[M[R]]=R}else console.warn("glTF: Invalid extras.targetNames length. Ignoring names.")}}T.name=e.createUniqueName(l.name||"mesh_"+t),h.push(T)}if(h.length===1)return h[0];for(var B=new THREE__namespace.Group,H=0,w=h;H<w.length;H++){var T=w[H];B.add(T)}return B})}return r},n.prototype.loadNodeAttachments=function(t){for(var e=[],r=0,o=values(this.extensions);r<o.length;r++){var s=o[r],u=s.loadNodeAttachments(t,this);u&&e.push(u)}return e},n.prototype.loadNode=function(t){var e="node:"+t,r=this.cache.get(e);if(r)return r;var o=this.json,s=o.nodes[t],u=s.name?this.createUniqueName(s.name):"",l=[];s.mesh!==void 0&&l.push(this.loadMesh(s.mesh).then(function(v){if(s.weights!==void 0){var g=s.weights;v.traverse(function(h){if(h instanceof THREE__namespace.Mesh||h instanceof THREE__namespace.Line||h instanceof THREE__namespace.Points)for(var m=0,y=g.length;m<y;m++)h.morphTargetInfluences[m]=g[m]})}return v})),s.camera!==void 0&&l.push(this.loadCamera(s.camera));for(var c=this.loadNodeAttachments(t),f=0,d=c;f<d.length;f++){var p=d[f];l.push(p)}return Promise.all(l).then(function(v){var g;if(s.isBone===!0?g=new THREE__namespace.Bone:v.length>1?g=new THREE__namespace.Group:v.length===1?g=v[0]:g=new THREE__namespace.Object3D,g!==v[0])for(var h=0,m=v.length;h<m;h++)g.add(v[h]);if(s.name&&(g.name=u),s.matrix!==void 0){var y=new THREE__namespace.Matrix4;y.fromArray(s.matrix),g.applyMatrix4(y)}else s.translation!==void 0&&g.position.fromArray(s.translation),s.rotation!==void 0&&g.quaternion.fromArray(s.rotation),s.scale!==void 0&&g.scale.fromArray(s.scale);return g})},n.prototype.loadScene=function(t){var e=this.json,r=e.scenes[t],o=new THREE__namespace.Group;r.name&&(o.name=this.createUniqueName(r.name));for(var s=r.nodes||[],u=[],l=0,c=s.length;l<c;l++)u.push(this.buildNodeHierarchy(s[l],o));return Promise.all(u).then(function(){return o})},n.prototype.createMaterialTexture=function(t){var e=this;return this.loadTexture(t.index).then(function(r){for(var o=0,s=values(e.extensions);o<s.length;o++){var u=s[o],l=u.extendTexture(r,t,e);l&&(r=l,e.disposeSet.add(r))}return e.textureSet.add(r),r})},n.prototype.addGeometryPrimitiveAttributes=function(t,e){var r=this,o=e.attributes,s=[],u=function(_){var R=ATTRIBUTES[_]||_.toLowerCase();if(R in t.attributes)return"continue";s.push(l.loadAccessor(o[_]).then(function(S){S&&t.setAttribute(R,S)}))},l=this;for(var c in o)u(c);e.indices!==void 0&&!t.index&&s.push(this.loadAccessor(e.indices).then(function(_){_&&t.setIndex(_)}));var f=new THREE__namespace.Box3;if(o.POSITION!==void 0){var d=this.json.accessors[o.POSITION],p=d.min,v=d.max;if(p!==void 0&&v!==void 0){if(f.set(new THREE__namespace.Vector3(p[0],p[1],p[2]),new THREE__namespace.Vector3(v[0],v[1],v[2])),d.normalized){var g=getNormalizedComponentScale(WEBGL_COMPONENT_TYPES[d.componentType]);f.min.multiplyScalar(g),f.max.multiplyScalar(g)}}else console.warn("glTF: Missing min/max properties for accessor POSITION.")}var h=e.targets;if(h!==void 0){for(var m=new THREE__namespace.Vector3,y=new THREE__namespace.Vector3,A=0,E=h.length;A<E;A++){var b=h[A];if(b.POSITION!==void 0){var d=this.json.accessors[b.POSITION],p=d.min,v=d.max;if(p!==void 0&&v!==void 0){if(y.setX(Math.max(Math.abs(p[0]),Math.abs(v[0]))),y.setY(Math.max(Math.abs(p[1]),Math.abs(v[1]))),y.setZ(Math.max(Math.abs(p[2]),Math.abs(v[2]))),d.normalized){var g=getNormalizedComponentScale(WEBGL_COMPONENT_TYPES[d.componentType]);y.multiplyScalar(g)}m.max(y)}else console.warn("glTF: Missing min/max properties for accessor POSITION.")}}f.expandByVector(m)}t.boundingBox=f;var T=new THREE__namespace.Sphere;return f.getCenter(T.center),T.radius=f.min.distanceTo(f.max)/2,t.boundingSphere=T,Promise.all(s).then(function(){if(t.attributes.uv&&!t.attributes.uv2&&r.options.copyUV2&&t.setAttribute("uv2",t.attributes.uv),e.targets){for(var _=!1,R=!1,S=0,M=e.targets.length;S<M;S++){var B=e.targets[S];if(B.POSITION!==void 0&&(_=!0),B.NORMAL!==void 0&&(R=!0),_&&R)break}if(!_&&!R)return t;var H=[];t.morphTargetsRelative=!0;for(var w=function(C,L){var I=e.targets[C];_?H.push(r.loadAccessor(I.POSITION).then(function(F){F&&(t.morphAttributes.position[C]=F)})):t.morphAttributes.position[C]=t.attributes.position,R?H.push(r.loadAccessor(I.NORMAL).then(function(F){F&&(t.morphAttributes.normal[C]=F)})):t.morphAttributes.normal[C]=t.attributes.normal},S=0,M=e.targets.length;S<M;S++)w(S,M);return Promise.all(H).then(function(){return t})}else return t})},n.prototype.buildNodeHierarchy=function(t,e){var r=this,o=this.json.nodes[t];return this.loadNode(t).then(function(s){if(o.skin===void 0)return s;var u;return r.loadSkin(o.skin).then(function(l){u=l;for(var c=[],f=0,d=u.joints.length;f<d;f++)c.push(r.loadNode(u.joints[f]));return Promise.all(c)}).then(function(l){return s.traverse(function(c){if(c instanceof THREE__namespace.SkinnedMesh){for(var f=[],d=[],p=0,v=l.length;p<v;p++){var g=l[p];if(g instanceof THREE__namespace.Bone){f.push(g);var h=new THREE__namespace.Matrix4;u.inverseBindMatrices!==void 0&&h.fromArray(u.inverseBindMatrices.array,p*16),d.push(h)}else console.warn('glTF: Joint "%s" could not be found.',u.joints[p])}c.bind(new THREE__namespace.Skeleton(f,d),c.matrixWorld)}}),s})}).then(function(s){e.add(s);var u=[];if(o.children)for(var l=o.children,c=0,f=l.length;c<f;c++){var d=l[c];u.push(r.buildNodeHierarchy(d,s))}return Promise.all(u).then(function(){return s})})},n.prototype.createUniqueName=function(t){for(var e=THREE__namespace.PropertyBinding.sanitizeNodeName(t||""),r=e,o=1;this.nodeNamesUsed[r];++o)r=e+"_"+o;return this.nodeNamesUsed[r]=!0,r},n.prototype.resolveResouce=function(t){return pathJoin(this.options.resourcePath,appendSearch(t,this.options.search))},n.prototype.toGeometryTrianglesDrawMode=function(t,e){var r=t.getIndex();if(r===null){var o=[],s=t.getAttribute("position");if(s!==void 0){for(var u=0;u<s.count;u++)o.push(u);t.setIndex(o),r=t.getIndex()}}if(r===null)return console.error("glTF: Undefined position attribute. Processing not possible."),t;var l=r.count-2,c=[];if(e===THREE__namespace.TriangleFanDrawMode)for(var u=1;u<=l;u++)c.push(r.getX(0)),c.push(r.getX(u)),c.push(r.getX(u+1));else for(var u=0;u<l;u++)u%2===0?(c.push(r.getX(u)),c.push(r.getX(u+1)),c.push(r.getX(u+2))):(c.push(r.getX(u+2)),c.push(r.getX(u+1)),c.push(r.getX(u)));c.length/3!==l&&console.error("glTF: Unable to generate correct amount of triangles.");var f=t.clone();return f.setIndex(c),this.disposeSet.add(f),f},n}();function getNormalizedComponentScale(n){switch(n){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("glTF: Unsupported normalized accessor component type.")}}var BaseExtension=function(){function n(){}return n.prototype.markDefs=function(t){},n.prototype.prepare=function(t){},n.prototype.emitResult=function(t,e){},n.prototype.createPrimitiveKey=function(t,e){},n.prototype.extendTexture=function(t,e,r){return null},n.prototype.loadBuffer=function(t,e){return null},n.prototype.loadBufferView=function(t,e){return null},n.prototype.loadImage=function(t,e){return null},n.prototype.loadTexture=function(t,e){return null},n.prototype.loadGeometry=function(t,e){return null},n.prototype.loadMaterial=function(t,e){return null},n.prototype.loadMesh=function(t,e){return null},n.prototype.loadNodeAttachments=function(t,e){return null},n.prototype.loadCamera=function(t,e){return null},n.prototype.loadAnimation=function(t,e){return null},n}(),KHR_binary_glTF=function(n){__extends(t,n);function t(){var e=n.call(this)||this;return e.header={magic:"",version:0,length:0},e.content="",e.body=null,e}return t.getMagic=function(e){return decodeText(new Uint8Array(e.slice(0,4)))},t.prototype.loadGlbBinary=function(e){var r=new DataView(e,0,t.HEADER_LENGTH);if(this.header={magic:t.getMagic(e),version:r.getUint32(4,!0),length:r.getUint32(8,!0)},this.header.magic!==t.HEADER_MAGIC)throw new Error("glTF:KHR_binary_glTF: Unsupported.");if(this.header.version<2)throw new Error("glTF:KHR_binary_glTF: Legacy binary file detected.");for(var o=new DataView(e,t.HEADER_LENGTH),s=0,u=null,l=null;s<o.byteLength;){var c=o.getUint32(s,!0);if(s+=4,c!==0){var f=o.getUint32(s,!0);if(s+=4,f===t.CHUNK_TYPES.JSON){var d=new Uint8Array(e,t.HEADER_LENGTH+s,c);u=decodeText(d)}else if(f===t.CHUNK_TYPES.BIN){var p=t.HEADER_LENGTH+s;l=e.slice(p,p+c)}s+=c}}if(u===null)throw new Error("glTF:KHR_binary_glTF: JSON content not found.");this.content=u,this.body=l},t.prototype.loadBuffer=function(e,r){var o=r.json.buffers[e];return o.uri===void 0&&e===0&&this.body?Promise.resolve(this.body):null},t.prototype.clear=function(){this.body=null,this.content=""},t.HEADER_MAGIC="glTF",t.HEADER_LENGTH=12,t.CHUNK_TYPES={JSON:1313821514,BIN:5130562},t}(BaseExtension),defaultDecoderPath="https://vr-public.realsee-cdn.cn/release/static/image/release/five/resource/draco/1.5.6/",defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"},Draco=function(){function n(){this.decoderPath=defaultDecoderPath,this.decoderConfig={},this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL=""}return n.prototype.setDecoderPath=function(t){this.decoderPath=t},n.prototype.setDecoderConfig=function(t){return this.decoderConfig=t,this},n.prototype.setWorkerLimit=function(t){return this.workerLimit=t,this},n.prototype.decodeDracoFile=function(t,e,r,o){var s={attributeIDs:r||defaultAttributeIDs,attributeTypes:o||defaultAttributeTypes,useUniqueIDs:!!r};this.decodeGeometry(t,s).then(e)},n.prototype.decodeGeometry=function(t,e){var r=this;e===void 0&&(e={attributeIDs:defaultAttributeIDs,attributeTypes:defaultAttributeTypes,useUniqueIDs:!1});for(var o in e.attributeTypes){var s=e.attributeTypes[o];s.BYTES_PER_ELEMENT!==void 0&&(e.attributeTypes[o]=s.name)}var u,l=this.workerNextTaskID++,c=t.byteLength,f=this._getWorker(l,c).then(function(d){return u=d,new Promise(function(p,v){u._callbacks[l]={resolve:p,reject:v},u.postMessage({type:"decode",id:l,taskConfig:e,buffer:t},[t])})}).then(function(d){return r._createGeometry(d.geometry)});return f.catch(function(){return!0}).then(function(){u&&l&&r._releaseTask(u,l)}),f},n.prototype._createGeometry=function(t){var e=new THREE__namespace.BufferGeometry;t.index&&e.setIndex(new THREE__namespace.BufferAttribute(t.index.array,1));for(var r=0;r<t.attributes.length;r++){var o=t.attributes[r],s=o.name,u=o.array,l=o.itemSize,c=!(u instanceof Float32Array||u instanceof Float64Array);e.setAttribute(s,new THREE__namespace.BufferAttribute(u,l,c))}return e},n.prototype._initDecoder=function(){var t=this;if(this.decoderPending)return this.decoderPending;var e=typeof WebAssembly!="object"||this.decoderConfig.type==="js";if(e){var r=ajax(this.decoderPath+"draco_decoder.js",{responseType:"text"}).then(function(s){return s.body});this.decoderPending=r.then(function(s){var u=["/* draco decoder */",s,"","/* worker */",DRACOWorker].join(`
|
|
418
418
|
`);t.workerSourceURL=URL.createObjectURL(new Blob([u]))})}else{var r=ajax(this.decoderPath+"draco_wasm_wrapper.js",{responseType:"text"}).then(function(u){return u.body}),o=ajax(this.decoderPath+"draco_decoder.wasm",{responseType:"arraybuffer"}).then(function(u){return u.body});this.decoderPending=Promise.all([r,o]).then(function(u){var l=u[0],c=u[1];t.decoderConfig.wasmBinary=c;var f=["/* draco decoder */",l,"","/* worker */",DRACOWorker].join(`
|
|
419
419
|
`);t.workerSourceURL=URL.createObjectURL(new Blob([f]))})}return this.decoderPending},n.prototype._getWorker=function(t,e){var r=this;return this._initDecoder().then(function(){if(r.workerPool.length<r.workerLimit){var o=new Worker(r.workerSourceURL);o._callbacks={},o._taskCosts={},o._taskLoad=0,o.postMessage({type:"init",decoderConfig:r.decoderConfig}),o.onmessage=function(u){var l=u.data;switch(l.type){case"decode":o._callbacks[l.id].resolve(l);break;case"error":o._callbacks[l.id].reject(l);break;default:console.error('DRACO: Unexpected message, "'+l.type+'"')}},r.workerPool.push(o)}else r.workerPool.sort(function(u,l){return u._taskLoad>l._taskLoad?-1:1});var s=r.workerPool[r.workerPool.length-1];return s._taskCosts[t]=e,s._taskLoad+=e,s})},n.prototype._releaseTask=function(t,e){t._taskLoad-=t._taskCosts[e],delete t._callbacks[e],delete t._taskCosts[e]},n.prototype.dispose=function(){for(var t=0;t<this.workerPool.length;++t)this.workerPool[t].terminate();return this.workerPool.length=0,this},n}(),draco=new Draco,DRACOWorker=`
|
|
420
420
|
let decoderConfig;
|
|
@@ -925,13 +925,13 @@ self.onmessage = function(event) {
|
|
|
925
925
|
}
|
|
926
926
|
postMessage({ id: packet.id, error: "type never matched." });
|
|
927
927
|
};
|
|
928
|
-
`),support=typeof Worker!="undefined"&&typeof Blob!="undefined",lzmaWorkerURL="";if(support)try{var blob=new Blob([lzmaWorkerSource],{type:"text/javascript"});lzmaWorkerURL=URL.createObjectURL(blob)}catch(n){}var LZMAWorker=function(){function n(){var t=this;if(!support)throw new Error("LZMAWorker cannot work in this broswer.");this.callCounter=0,this.requests={};var e=this.worker=new Worker(lzmaWorkerURL);e.onmessage=function(r){var o=r.data,s=o.id,u=o.result,l=o.error,c=t.getKey(s);t.requests[c]&&(l?t.requests[c](new Error(l)):t.requests[c](null,u),delete t.requests[c])},e.onerror=function(r){return console.error(r)}}return n.prototype.getKey=function(t){return"key_"+String(t)},n.prototype.decompress=function(t,e){var r=++this.callCounter;this.requests[this.getKey(r)]=e,this.worker.postMessage({type:"decompress",id:r,data:t},[t.buffer])},n.prototype.terminate=function(){this.worker.terminate()},n.support=support,n}();function readUint32(n){return Array.prototype.reduce.call(n,function(t,e,r){return t|e<<r*8},0)}function binaryArrays(n){for(var t=[],e=n.length,r=function(u){var l={data:n[u],offset:0,readByte:function(){return this.data[this.offset++]}},c=l.data.length,f={data:[],offset:0,writeByte:function(p){var v=Math.floor(this.offset/c);this.data[v]||(this.data[v]=new Uint8Array(c)),this.data[v][this.offset%c]=p,this.offset++}};LZMA.decompressFile(l,f),o=new Uint8Array(f.offset);for(var d=0;d<f.offset;d++)o[d]=f.data[Math.floor(d/c)][d%c];t.push(o)},o,s=0;s<e;s++)r(s);return t}function binaryArraysWithWorker(n){for(var t=[],e=n.length,r=function(s){t.push(new Promise(function(u,l){var c=new LZMAWorker;c.decompress(n[s],function(f,d){if(c.terminate(),f)return l(f);u(d)})}))},o=0;o<e;o++)r(o);return Promise.all(t)}function lzma(n){var t=new Uint8Array(n),e=readUint32(t.slice(0,4));if(e>10)return Promise.reject(new Error("LZMA got too many sub chunks."));for(var r=[],o=[],s=4+e*4,u=0;u<e;u++)o[u]=readUint32(t.slice(4+u*4,8+u*4)),u===e-1?r[u]=t.subarray(s,s+o[u]):r[u]=t.slice(s,s+o[u]),s+=o[u];return LZMAWorker.support?binaryArraysWithWorker(r):Promise.resolve(binaryArrays(r))}var dequeuing=!1,queue=[];function dequeue(n){if(n===void 0&&(n=!1),!(!n&&dequeuing)){dequeuing=!0;var t=queue.shift();if(t){try{t()}catch(e){}AnimationFrameLoop.shared.add(function(){return dequeue(!0)},!0,2,-100)}else dequeuing=!1}}function delay(n){return new Promise(function(t,e){var r=function(){try{t(n())}catch(o){e(o)}};queue.push(r),AnimationFrameLoop.shared.add(function(){return dequeue()},!0,2,-100)})}function pick(n,t){for(var e={},r=0,o=t;r<o.length;r++){var s=o[r];s in n&&(e[s]=n[s])}return e}function omit(n,t){for(var e=__assign({},n),r=0,o=t;r<o.length;r++){var s=o[r];s in e&&delete e[s]}return e}var commonjsGlobal=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{},indexMinimal={},minimal$1={},aspromise=asPromise;function asPromise(n,t){for(var e=new Array(arguments.length-1),r=0,o=2,s=!0;o<arguments.length;)e[r++]=arguments[o++];return new Promise(function(l,c){e[r]=function(d){if(s)if(s=!1,d)c(d);else{for(var p=new Array(arguments.length-1),v=0;v<p.length;)p[v++]=arguments[v];l.apply(null,p)}};try{n.apply(t||null,e)}catch(f){s&&(s=!1,c(f))}})}var base64$1={};(function(n){var t=n;t.length=function(l){var c=l.length;if(!c)return 0;for(var f=0;--c%4>1&&l.charAt(c)==="=";)++f;return Math.ceil(l.length*3)/4-f};for(var e=new Array(64),r=new Array(123),o=0;o<64;)r[e[o]=o<26?o+65:o<52?o+71:o<62?o-4:o-59|43]=o++;t.encode=function(l,c,f){for(var d=null,p=[],v=0,g=0,h;c<f;){var m=l[c++];switch(g){case 0:p[v++]=e[m>>2],h=(m&3)<<4,g=1;break;case 1:p[v++]=e[h|m>>4],h=(m&15)<<2,g=2;break;case 2:p[v++]=e[h|m>>6],p[v++]=e[m&63],g=0;break}v>8191&&((d||(d=[])).push(String.fromCharCode.apply(String,p)),v=0)}return g&&(p[v++]=e[h],p[v++]=61,g===1&&(p[v++]=61)),d?(v&&d.push(String.fromCharCode.apply(String,p.slice(0,v))),d.join("")):String.fromCharCode.apply(String,p.slice(0,v))};var s="invalid encoding";t.decode=function(l,c,f){for(var d=f,p=0,v,g=0;g<l.length;){var h=l.charCodeAt(g++);if(h===61&&p>1)break;if((h=r[h])===void 0)throw Error(s);switch(p){case 0:v=h,p=1;break;case 1:c[f++]=v<<2|(h&48)>>4,v=h,p=2;break;case 2:c[f++]=(v&15)<<4|(h&60)>>2,v=h,p=3;break;case 3:c[f++]=(v&3)<<6|h,p=0;break}}if(p===1)throw Error(s);return f-d},t.test=function(l){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(l)}})(base64$1);var eventemitter=EventEmitter;function EventEmitter(){this._listeners={}}EventEmitter.prototype.on=function(t,e,r){return(this._listeners[t]||(this._listeners[t]=[])).push({fn:e,ctx:r||this}),this},EventEmitter.prototype.off=function(t,e){if(t===void 0)this._listeners={};else if(e===void 0)this._listeners[t]=[];else for(var r=this._listeners[t],o=0;o<r.length;)r[o].fn===e?r.splice(o,1):++o;return this},EventEmitter.prototype.emit=function(t){var e=this._listeners[t];if(e){for(var r=[],o=1;o<arguments.length;)r.push(arguments[o++]);for(o=0;o<e.length;)e[o].fn.apply(e[o++].ctx,r)}return this};var float=factory(factory);function factory(n){return typeof Float32Array!="undefined"?function(){var t=new Float32Array([-0]),e=new Uint8Array(t.buffer),r=e[3]===128;function o(c,f,d){t[0]=c,f[d]=e[0],f[d+1]=e[1],f[d+2]=e[2],f[d+3]=e[3]}function s(c,f,d){t[0]=c,f[d]=e[3],f[d+1]=e[2],f[d+2]=e[1],f[d+3]=e[0]}n.writeFloatLE=r?o:s,n.writeFloatBE=r?s:o;function u(c,f){return e[0]=c[f],e[1]=c[f+1],e[2]=c[f+2],e[3]=c[f+3],t[0]}function l(c,f){return e[3]=c[f],e[2]=c[f+1],e[1]=c[f+2],e[0]=c[f+3],t[0]}n.readFloatLE=r?u:l,n.readFloatBE=r?l:u}():function(){function t(r,o,s,u){var l=o<0?1:0;if(l&&(o=-o),o===0)r(1/o>0?0:2147483648,s,u);else if(isNaN(o))r(2143289344,s,u);else if(o>34028234663852886e22)r((l<<31|2139095040)>>>0,s,u);else if(o<11754943508222875e-54)r((l<<31|Math.round(o/1401298464324817e-60))>>>0,s,u);else{var c=Math.floor(Math.log(o)/Math.LN2),f=Math.round(o*Math.pow(2,-c)*8388608)&8388607;r((l<<31|c+127<<23|f)>>>0,s,u)}}n.writeFloatLE=t.bind(null,writeUintLE),n.writeFloatBE=t.bind(null,writeUintBE);function e(r,o,s){var u=r(o,s),l=(u>>31)*2+1,c=u>>>23&255,f=u&8388607;return c===255?f?NaN:l*(1/0):c===0?l*1401298464324817e-60*f:l*Math.pow(2,c-150)*(f+8388608)}n.readFloatLE=e.bind(null,readUintLE),n.readFloatBE=e.bind(null,readUintBE)}(),typeof Float64Array!="undefined"?function(){var t=new Float64Array([-0]),e=new Uint8Array(t.buffer),r=e[7]===128;function o(c,f,d){t[0]=c,f[d]=e[0],f[d+1]=e[1],f[d+2]=e[2],f[d+3]=e[3],f[d+4]=e[4],f[d+5]=e[5],f[d+6]=e[6],f[d+7]=e[7]}function s(c,f,d){t[0]=c,f[d]=e[7],f[d+1]=e[6],f[d+2]=e[5],f[d+3]=e[4],f[d+4]=e[3],f[d+5]=e[2],f[d+6]=e[1],f[d+7]=e[0]}n.writeDoubleLE=r?o:s,n.writeDoubleBE=r?s:o;function u(c,f){return e[0]=c[f],e[1]=c[f+1],e[2]=c[f+2],e[3]=c[f+3],e[4]=c[f+4],e[5]=c[f+5],e[6]=c[f+6],e[7]=c[f+7],t[0]}function l(c,f){return e[7]=c[f],e[6]=c[f+1],e[5]=c[f+2],e[4]=c[f+3],e[3]=c[f+4],e[2]=c[f+5],e[1]=c[f+6],e[0]=c[f+7],t[0]}n.readDoubleLE=r?u:l,n.readDoubleBE=r?l:u}():function(){function t(r,o,s,u,l,c){var f=u<0?1:0;if(f&&(u=-u),u===0)r(0,l,c+o),r(1/u>0?0:2147483648,l,c+s);else if(isNaN(u))r(0,l,c+o),r(2146959360,l,c+s);else if(u>17976931348623157e292)r(0,l,c+o),r((f<<31|2146435072)>>>0,l,c+s);else{var d;if(u<22250738585072014e-324)d=u/5e-324,r(d>>>0,l,c+o),r((f<<31|d/4294967296)>>>0,l,c+s);else{var p=Math.floor(Math.log(u)/Math.LN2);p===1024&&(p=1023),d=u*Math.pow(2,-p),r(d*4503599627370496>>>0,l,c+o),r((f<<31|p+1023<<20|d*1048576&1048575)>>>0,l,c+s)}}}n.writeDoubleLE=t.bind(null,writeUintLE,0,4),n.writeDoubleBE=t.bind(null,writeUintBE,4,0);function e(r,o,s,u,l){var c=r(u,l+o),f=r(u,l+s),d=(f>>31)*2+1,p=f>>>20&2047,v=4294967296*(f&1048575)+c;return p===2047?v?NaN:d*(1/0):p===0?d*5e-324*v:d*Math.pow(2,p-1075)*(v+4503599627370496)}n.readDoubleLE=e.bind(null,readUintLE,0,4),n.readDoubleBE=e.bind(null,readUintBE,4,0)}(),n}function writeUintLE(n,t,e){t[e]=n&255,t[e+1]=n>>>8&255,t[e+2]=n>>>16&255,t[e+3]=n>>>24}function writeUintBE(n,t,e){t[e]=n>>>24,t[e+1]=n>>>16&255,t[e+2]=n>>>8&255,t[e+3]=n&255}function readUintLE(n,t){return(n[t]|n[t+1]<<8|n[t+2]<<16|n[t+3]<<24)>>>0}function readUintBE(n,t){return(n[t]<<24|n[t+1]<<16|n[t+2]<<8|n[t+3])>>>0}var inquire_1=inquire;function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(n){}return null}var utf8$2={};(function(n){var t=n;t.length=function(r){for(var o=0,s=0,u=0;u<r.length;++u)s=r.charCodeAt(u),s<128?o+=1:s<2048?o+=2:(s&64512)===55296&&(r.charCodeAt(u+1)&64512)===56320?(++u,o+=4):o+=3;return o},t.read=function(r,o,s){var u=s-o;if(u<1)return"";for(var l=null,c=[],f=0,d;o<s;)d=r[o++],d<128?c[f++]=d:d>191&&d<224?c[f++]=(d&31)<<6|r[o++]&63:d>239&&d<365?(d=((d&7)<<18|(r[o++]&63)<<12|(r[o++]&63)<<6|r[o++]&63)-65536,c[f++]=55296+(d>>10),c[f++]=56320+(d&1023)):c[f++]=(d&15)<<12|(r[o++]&63)<<6|r[o++]&63,f>8191&&((l||(l=[])).push(String.fromCharCode.apply(String,c)),f=0);return l?(f&&l.push(String.fromCharCode.apply(String,c.slice(0,f))),l.join("")):String.fromCharCode.apply(String,c.slice(0,f))},t.write=function(r,o,s){for(var u=s,l,c,f=0;f<r.length;++f)l=r.charCodeAt(f),l<128?o[s++]=l:l<2048?(o[s++]=l>>6|192,o[s++]=l&63|128):(l&64512)===55296&&((c=r.charCodeAt(f+1))&64512)===56320?(l=65536+((l&1023)<<10)+(c&1023),++f,o[s++]=l>>18|240,o[s++]=l>>12&63|128,o[s++]=l>>6&63|128,o[s++]=l&63|128):(o[s++]=l>>12|224,o[s++]=l>>6&63|128,o[s++]=l&63|128);return s-u}})(utf8$2);var pool_1=pool;function pool(n,t,e){var r=e||8192,o=r>>>1,s=null,u=r;return function(c){if(c<1||c>o)return n(c);u+c>r&&(s=n(r),u=0);var f=t.call(s,u,u+=c);return u&7&&(u=(u|7)+1),f}}var longbits,hasRequiredLongbits;function requireLongbits(){if(hasRequiredLongbits)return longbits;hasRequiredLongbits=1,longbits=t;var n=requireMinimal();function t(s,u){this.lo=s>>>0,this.hi=u>>>0}var e=t.zero=new t(0,0);e.toNumber=function(){return 0},e.zzEncode=e.zzDecode=function(){return this},e.length=function(){return 1};var r=t.zeroHash="\0\0\0\0\0\0\0\0";t.fromNumber=function(u){if(u===0)return e;var l=u<0;l&&(u=-u);var c=u>>>0,f=(u-c)/4294967296>>>0;return l&&(f=~f>>>0,c=~c>>>0,++c>4294967295&&(c=0,++f>4294967295&&(f=0))),new t(c,f)},t.from=function(u){if(typeof u=="number")return t.fromNumber(u);if(n.isString(u))if(n.Long)u=n.Long.fromString(u);else return t.fromNumber(parseInt(u,10));return u.low||u.high?new t(u.low>>>0,u.high>>>0):e},t.prototype.toNumber=function(u){if(!u&&this.hi>>>31){var l=~this.lo+1>>>0,c=~this.hi>>>0;return l||(c=c+1>>>0),-(l+c*4294967296)}return this.lo+this.hi*4294967296},t.prototype.toLong=function(u){return n.Long?new n.Long(this.lo|0,this.hi|0,!!u):{low:this.lo|0,high:this.hi|0,unsigned:!!u}};var o=String.prototype.charCodeAt;return t.fromHash=function(u){return u===r?e:new t((o.call(u,0)|o.call(u,1)<<8|o.call(u,2)<<16|o.call(u,3)<<24)>>>0,(o.call(u,4)|o.call(u,5)<<8|o.call(u,6)<<16|o.call(u,7)<<24)>>>0)},t.prototype.toHash=function(){return String.fromCharCode(this.lo&255,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,this.hi&255,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},t.prototype.zzEncode=function(){var u=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^u)>>>0,this.lo=(this.lo<<1^u)>>>0,this},t.prototype.zzDecode=function(){var u=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^u)>>>0,this.hi=(this.hi>>>1^u)>>>0,this},t.prototype.length=function(){var u=this.lo,l=(this.lo>>>28|this.hi<<4)>>>0,c=this.hi>>>24;return c===0?l===0?u<16384?u<128?1:2:u<2097152?3:4:l<16384?l<128?5:6:l<2097152?7:8:c<128?9:10},longbits}var hasRequiredMinimal;function requireMinimal(){return hasRequiredMinimal||(hasRequiredMinimal=1,function(n){var t=n;t.asPromise=aspromise,t.base64=base64$1,t.EventEmitter=eventemitter,t.float=float,t.inquire=inquire_1,t.utf8=utf8$2,t.pool=pool_1,t.LongBits=requireLongbits(),t.isNode=!!(typeof commonjsGlobal!="undefined"&&commonjsGlobal&&commonjsGlobal.process&&commonjsGlobal.process.versions&&commonjsGlobal.process.versions.node),t.global=t.isNode&&commonjsGlobal||typeof window!="undefined"&&window||typeof self!="undefined"&&self||commonjsGlobal,t.emptyArray=Object.freeze?Object.freeze([]):[],t.emptyObject=Object.freeze?Object.freeze({}):{},t.isInteger=Number.isInteger||function(s){return typeof s=="number"&&isFinite(s)&&Math.floor(s)===s},t.isString=function(s){return typeof s=="string"||s instanceof String},t.isObject=function(s){return s&&typeof s=="object"},t.isset=t.isSet=function(s,u){var l=s[u];return l!=null&&s.hasOwnProperty(u)?typeof l!="object"||(Array.isArray(l)?l.length:Object.keys(l).length)>0:!1},t.Buffer=function(){try{var o=t.inquire("buffer").Buffer;return o.prototype.utf8Write?o:null}catch(s){return null}}(),t._Buffer_from=null,t._Buffer_allocUnsafe=null,t.newBuffer=function(s){return typeof s=="number"?t.Buffer?t._Buffer_allocUnsafe(s):new t.Array(s):t.Buffer?t._Buffer_from(s):typeof Uint8Array=="undefined"?s:new Uint8Array(s)},t.Array=typeof Uint8Array!="undefined"?Uint8Array:Array,t.Long=t.global.dcodeIO&&t.global.dcodeIO.Long||t.global.Long||t.inquire("long"),t.key2Re=/^true|false|0|1$/,t.key32Re=/^-?(?:0|[1-9][0-9]*)$/,t.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,t.longToHash=function(s){return s?t.LongBits.from(s).toHash():t.LongBits.zeroHash},t.longFromHash=function(s,u){var l=t.LongBits.fromHash(s);return t.Long?t.Long.fromBits(l.lo,l.hi,u):l.toNumber(!!u)};function e(o,s,u){for(var l=Object.keys(s),c=0;c<l.length;++c)(o[l[c]]===void 0||!u)&&(o[l[c]]=s[l[c]]);return o}t.merge=e,t.lcFirst=function(s){return s.charAt(0).toLowerCase()+s.substring(1)};function r(o){function s(u,l){if(!(this instanceof s))return new s(u,l);Object.defineProperty(this,"message",{get:function(){return u}}),Error.captureStackTrace?Error.captureStackTrace(this,s):Object.defineProperty(this,"stack",{value:new Error().stack||""}),l&&e(this,l)}return s.prototype=Object.create(Error.prototype,{constructor:{value:s,writable:!0,enumerable:!1,configurable:!0},name:{get:function(){return o},set:void 0,enumerable:!1,configurable:!0},toString:{value:function(){return this.name+": "+this.message},writable:!0,enumerable:!1,configurable:!0}}),s}t.newError=r,t.ProtocolError=r("ProtocolError"),t.oneOfGetter=function(s){for(var u={},l=0;l<s.length;++l)u[s[l]]=1;return function(){for(var c=Object.keys(this),f=c.length-1;f>-1;--f)if(u[c[f]]===1&&this[c[f]]!==void 0&&this[c[f]]!==null)return c[f]}},t.oneOfSetter=function(s){return function(u){for(var l=0;l<s.length;++l)s[l]!==u&&delete this[s[l]]}},t.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},t._configure=function(){var o=t.Buffer;if(!o){t._Buffer_from=t._Buffer_allocUnsafe=null;return}t._Buffer_from=o.from!==Uint8Array.from&&o.from||function(u,l){return new o(u,l)},t._Buffer_allocUnsafe=o.allocUnsafe||function(u){return new o(u)}}}(minimal$1)),minimal$1}var writer=Writer$1,util$4=requireMinimal(),BufferWriter$1,LongBits$1=util$4.LongBits,base64=util$4.base64,utf8$1=util$4.utf8;function Op(n,t,e){this.fn=n,this.len=t,this.next=void 0,this.val=e}function noop(){}function State(n){this.head=n.head,this.tail=n.tail,this.len=n.len,this.next=n.states}function Writer$1(){this.len=0,this.head=new Op(noop,0,0),this.tail=this.head,this.states=null}var create$1=function n(){return util$4.Buffer?function(){return(Writer$1.create=function(){return new BufferWriter$1})()}:function(){return new Writer$1}};Writer$1.create=create$1(),Writer$1.alloc=function n(t){return new util$4.Array(t)},util$4.Array!==Array&&(Writer$1.alloc=util$4.pool(Writer$1.alloc,util$4.Array.prototype.subarray)),Writer$1.prototype._push=function n(t,e,r){return this.tail=this.tail.next=new Op(t,e,r),this.len+=e,this};function writeByte(n,t,e){t[e]=n&255}function writeVarint32(n,t,e){for(;n>127;)t[e++]=n&127|128,n>>>=7;t[e]=n}function VarintOp(n,t){this.len=n,this.next=void 0,this.val=t}VarintOp.prototype=Object.create(Op.prototype),VarintOp.prototype.fn=writeVarint32,Writer$1.prototype.uint32=function n(t){return this.len+=(this.tail=this.tail.next=new VarintOp((t=t>>>0)<128?1:t<16384?2:t<2097152?3:t<268435456?4:5,t)).len,this},Writer$1.prototype.int32=function n(t){return t<0?this._push(writeVarint64,10,LongBits$1.fromNumber(t)):this.uint32(t)},Writer$1.prototype.sint32=function n(t){return this.uint32((t<<1^t>>31)>>>0)};function writeVarint64(n,t,e){for(;n.hi;)t[e++]=n.lo&127|128,n.lo=(n.lo>>>7|n.hi<<25)>>>0,n.hi>>>=7;for(;n.lo>127;)t[e++]=n.lo&127|128,n.lo=n.lo>>>7;t[e++]=n.lo}Writer$1.prototype.uint64=function n(t){var e=LongBits$1.from(t);return this._push(writeVarint64,e.length(),e)},Writer$1.prototype.int64=Writer$1.prototype.uint64,Writer$1.prototype.sint64=function n(t){var e=LongBits$1.from(t).zzEncode();return this._push(writeVarint64,e.length(),e)},Writer$1.prototype.bool=function n(t){return this._push(writeByte,1,t?1:0)};function writeFixed32(n,t,e){t[e]=n&255,t[e+1]=n>>>8&255,t[e+2]=n>>>16&255,t[e+3]=n>>>24}Writer$1.prototype.fixed32=function n(t){return this._push(writeFixed32,4,t>>>0)},Writer$1.prototype.sfixed32=Writer$1.prototype.fixed32,Writer$1.prototype.fixed64=function n(t){var e=LongBits$1.from(t);return this._push(writeFixed32,4,e.lo)._push(writeFixed32,4,e.hi)},Writer$1.prototype.sfixed64=Writer$1.prototype.fixed64,Writer$1.prototype.float=function n(t){return this._push(util$4.float.writeFloatLE,4,t)},Writer$1.prototype.double=function n(t){return this._push(util$4.float.writeDoubleLE,8,t)};var writeBytes=util$4.Array.prototype.set?function n(t,e,r){e.set(t,r)}:function n(t,e,r){for(var o=0;o<t.length;++o)e[r+o]=t[o]};Writer$1.prototype.bytes=function n(t){var e=t.length>>>0;if(!e)return this._push(writeByte,1,0);if(util$4.isString(t)){var r=Writer$1.alloc(e=base64.length(t));base64.decode(t,r,0),t=r}return this.uint32(e)._push(writeBytes,e,t)},Writer$1.prototype.string=function n(t){var e=utf8$1.length(t);return e?this.uint32(e)._push(utf8$1.write,e,t):this._push(writeByte,1,0)},Writer$1.prototype.fork=function n(){return this.states=new State(this),this.head=this.tail=new Op(noop,0,0),this.len=0,this},Writer$1.prototype.reset=function n(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new Op(noop,0,0),this.len=0),this},Writer$1.prototype.ldelim=function n(){var t=this.head,e=this.tail,r=this.len;return this.reset().uint32(r),r&&(this.tail.next=t.next,this.tail=e,this.len+=r),this},Writer$1.prototype.finish=function n(){for(var t=this.head.next,e=this.constructor.alloc(this.len),r=0;t;)t.fn(t.val,e,r),r+=t.len,t=t.next;return e},Writer$1._configure=function(n){BufferWriter$1=n,Writer$1.create=create$1(),BufferWriter$1._configure()};var writer_buffer=BufferWriter,Writer=writer;(BufferWriter.prototype=Object.create(Writer.prototype)).constructor=BufferWriter;var util$3=requireMinimal();function BufferWriter(){Writer.call(this)}BufferWriter._configure=function(){BufferWriter.alloc=util$3._Buffer_allocUnsafe,BufferWriter.writeBytesBuffer=util$3.Buffer&&util$3.Buffer.prototype instanceof Uint8Array&&util$3.Buffer.prototype.set.name==="set"?function(t,e,r){e.set(t,r)}:function(t,e,r){if(t.copy)t.copy(e,r,0,t.length);else for(var o=0;o<t.length;)e[r++]=t[o++]}},BufferWriter.prototype.bytes=function n(t){util$3.isString(t)&&(t=util$3._Buffer_from(t,"base64"));var e=t.length>>>0;return this.uint32(e),e&&this._push(BufferWriter.writeBytesBuffer,e,t),this};function writeStringBuffer(n,t,e){n.length<40?util$3.utf8.write(n,t,e):t.utf8Write?t.utf8Write(n,e):t.write(n,e)}BufferWriter.prototype.string=function n(t){var e=util$3.Buffer.byteLength(t);return this.uint32(e),e&&this._push(writeStringBuffer,e,t),this},BufferWriter._configure();var reader=Reader$1,util$2=requireMinimal(),BufferReader$1,LongBits=util$2.LongBits,utf8=util$2.utf8;function indexOutOfRange(n,t){return RangeError("index out of range: "+n.pos+" + "+(t||1)+" > "+n.len)}function Reader$1(n){this.buf=n,this.pos=0,this.len=n.length}var create_array=typeof Uint8Array!="undefined"?function n(t){if(t instanceof Uint8Array||Array.isArray(t))return new Reader$1(t);throw Error("illegal buffer")}:function n(t){if(Array.isArray(t))return new Reader$1(t);throw Error("illegal buffer")},create=function n(){return util$2.Buffer?function(e){return(Reader$1.create=function(o){return util$2.Buffer.isBuffer(o)?new BufferReader$1(o):create_array(o)})(e)}:create_array};Reader$1.create=create(),Reader$1.prototype._slice=util$2.Array.prototype.subarray||util$2.Array.prototype.slice,Reader$1.prototype.uint32=function n(){var t=4294967295;return function(){if(t=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(t=(t|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(t=(t|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(t=(t|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(t=(t|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return t;if((this.pos+=5)>this.len)throw this.pos=this.len,indexOutOfRange(this,10);return t}}(),Reader$1.prototype.int32=function n(){return this.uint32()|0},Reader$1.prototype.sint32=function n(){var t=this.uint32();return t>>>1^-(t&1)|0};function readLongVarint(){var n=new LongBits(0,0),t=0;if(this.len-this.pos>4){for(;t<4;++t)if(n.lo=(n.lo|(this.buf[this.pos]&127)<<t*7)>>>0,this.buf[this.pos++]<128)return n;if(n.lo=(n.lo|(this.buf[this.pos]&127)<<28)>>>0,n.hi=(n.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return n;t=0}else{for(;t<3;++t){if(this.pos>=this.len)throw indexOutOfRange(this);if(n.lo=(n.lo|(this.buf[this.pos]&127)<<t*7)>>>0,this.buf[this.pos++]<128)return n}return n.lo=(n.lo|(this.buf[this.pos++]&127)<<t*7)>>>0,n}if(this.len-this.pos>4){for(;t<5;++t)if(n.hi=(n.hi|(this.buf[this.pos]&127)<<t*7+3)>>>0,this.buf[this.pos++]<128)return n}else for(;t<5;++t){if(this.pos>=this.len)throw indexOutOfRange(this);if(n.hi=(n.hi|(this.buf[this.pos]&127)<<t*7+3)>>>0,this.buf[this.pos++]<128)return n}throw Error("invalid varint encoding")}Reader$1.prototype.bool=function n(){return this.uint32()!==0};function readFixed32_end(n,t){return(n[t-4]|n[t-3]<<8|n[t-2]<<16|n[t-1]<<24)>>>0}Reader$1.prototype.fixed32=function n(){if(this.pos+4>this.len)throw indexOutOfRange(this,4);return readFixed32_end(this.buf,this.pos+=4)},Reader$1.prototype.sfixed32=function n(){if(this.pos+4>this.len)throw indexOutOfRange(this,4);return readFixed32_end(this.buf,this.pos+=4)|0};function readFixed64(){if(this.pos+8>this.len)throw indexOutOfRange(this,8);return new LongBits(readFixed32_end(this.buf,this.pos+=4),readFixed32_end(this.buf,this.pos+=4))}Reader$1.prototype.float=function n(){if(this.pos+4>this.len)throw indexOutOfRange(this,4);var t=util$2.float.readFloatLE(this.buf,this.pos);return this.pos+=4,t},Reader$1.prototype.double=function n(){if(this.pos+8>this.len)throw indexOutOfRange(this,4);var t=util$2.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,t},Reader$1.prototype.bytes=function n(){var t=this.uint32(),e=this.pos,r=this.pos+t;if(r>this.len)throw indexOutOfRange(this,t);if(this.pos+=t,Array.isArray(this.buf))return this.buf.slice(e,r);if(e===r){var o=util$2.Buffer;return o?o.alloc(0):new this.buf.constructor(0)}return this._slice.call(this.buf,e,r)},Reader$1.prototype.string=function n(){var t=this.bytes();return utf8.read(t,0,t.length)},Reader$1.prototype.skip=function n(t){if(typeof t=="number"){if(this.pos+t>this.len)throw indexOutOfRange(this,t);this.pos+=t}else do if(this.pos>=this.len)throw indexOutOfRange(this);while(this.buf[this.pos++]&128);return this},Reader$1.prototype.skipType=function(n){switch(n){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(n=this.uint32()&7)!==4;)this.skipType(n);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+n+" at offset "+this.pos)}return this},Reader$1._configure=function(n){BufferReader$1=n,Reader$1.create=create(),BufferReader$1._configure();var t=util$2.Long?"toLong":"toNumber";util$2.merge(Reader$1.prototype,{int64:function(){return readLongVarint.call(this)[t](!1)},uint64:function(){return readLongVarint.call(this)[t](!0)},sint64:function(){return readLongVarint.call(this).zzDecode()[t](!1)},fixed64:function(){return readFixed64.call(this)[t](!0)},sfixed64:function(){return readFixed64.call(this)[t](!1)}})};var reader_buffer=BufferReader,Reader=reader;(BufferReader.prototype=Object.create(Reader.prototype)).constructor=BufferReader;var util$1=requireMinimal();function BufferReader(n){Reader.call(this,n)}BufferReader._configure=function(){util$1.Buffer&&(BufferReader.prototype._slice=util$1.Buffer.prototype.slice)},BufferReader.prototype.string=function n(){var t=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+t,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+t,this.len))},BufferReader._configure();var rpc={},service=Service,util=requireMinimal();(Service.prototype=Object.create(util.EventEmitter.prototype)).constructor=Service;function Service(n,t,e){if(typeof n!="function")throw TypeError("rpcImpl must be a function");util.EventEmitter.call(this),this.rpcImpl=n,this.requestDelimited=!!t,this.responseDelimited=!!e}Service.prototype.rpcCall=function n(t,e,r,o,s){if(!o)throw TypeError("request must be specified");var u=this;if(!s)return util.asPromise(n,u,t,e,r,o);if(!u.rpcImpl){setTimeout(function(){s(Error("already ended"))},0);return}try{return u.rpcImpl(t,e[u.requestDelimited?"encodeDelimited":"encode"](o).finish(),function(c,f){if(c)return u.emit("error",c,t),s(c);if(f===null){u.end(!0);return}if(!(f instanceof r))try{f=r[u.responseDelimited?"decodeDelimited":"decode"](f)}catch(d){return u.emit("error",d,t),s(d)}return u.emit("data",f,t),s(null,f)})}catch(l){u.emit("error",l,t),setTimeout(function(){s(l)},0);return}},Service.prototype.end=function n(t){return this.rpcImpl&&(t||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this},function(n){var t=n;t.Service=service}(rpc);var roots={};(function(n){var t=n;t.build="minimal",t.Writer=writer,t.BufferWriter=writer_buffer,t.Reader=reader,t.BufferReader=reader_buffer,t.util=requireMinimal(),t.rpc=rpc,t.roots=roots,t.configure=e;function e(){t.util._configure(),t.Writer._configure(t.BufferWriter),t.Reader._configure(t.BufferReader)}e()})(indexMinimal);var minimal=indexMinimal;const $Reader$1=minimal.Reader,$util$1=minimal.util,$root$1=minimal.roots["@REALSEE/FIVE:five/loaders/model/parsers/protobuf/pbm.proto"]||(minimal.roots["@REALSEE/FIVE:five/loaders/model/parsers/protobuf/pbm.proto"]={}),Model$2=$root$1.Model=(()=>{function n(t){if(this.chunks=[],t)for(let e=Object.keys(t),r=0;r<e.length;++r)t[e[r]]!=null&&(this[e[r]]=t[e[r]])}return n.prototype.chunks=$util$1.emptyArray,n.prototype.createAt=$util$1.Long?$util$1.Long.fromBits(0,0,!0):0,n.prototype.description="",n.decode=function(e,r){e instanceof $Reader$1||(e=$Reader$1.create(e));let o=r===void 0?e.len:e.pos+r,s=new $root$1.Model;for(;e.pos<o;){let u=e.uint32();switch(u>>>3){case 1:{s.chunks&&s.chunks.length||(s.chunks=[]),s.chunks.push($root$1.Chunk.decode(e,e.uint32()));break}case 2:{s.createAt=e.uint64();break}case 3:{s.description=e.string();break}default:e.skipType(u&7);break}}return s},n.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/Model"},n})();$root$1.Chunk=(()=>{function n(t){if(t)for(let e=Object.keys(t),r=0;r<e.length;++r)t[e[r]]!=null&&(this[e[r]]=t[e[r]])}return n.prototype.vertices=null,n.prototype.faces=null,n.prototype.name="",n.prototype.texture="",n.decode=function(e,r){e instanceof $Reader$1||(e=$Reader$1.create(e));let o=r===void 0?e.len:e.pos+r,s=new $root$1.Chunk;for(;e.pos<o;){let u=e.uint32();switch(u>>>3){case 1:{s.vertices=$root$1.Vertices.decode(e,e.uint32());break}case 2:{s.faces=$root$1.Faces.decode(e,e.uint32());break}case 3:{s.name=e.string();break}case 4:{s.texture=e.string();break}default:e.skipType(u&7);break}}if(!s.hasOwnProperty("vertices"))throw $util$1.ProtocolError("missing required 'vertices'",{instance:s});if(!s.hasOwnProperty("faces"))throw $util$1.ProtocolError("missing required 'faces'",{instance:s});if(!s.hasOwnProperty("name"))throw $util$1.ProtocolError("missing required 'name'",{instance:s});return s},n.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/Chunk"},n})(),$root$1.Vertices=(()=>{function n(t){if(this.xyz=[],this.uvs=[],this.marks=[],t)for(let e=Object.keys(t),r=0;r<e.length;++r)t[e[r]]!=null&&(this[e[r]]=t[e[r]])}return n.prototype.xyz=$util$1.emptyArray,n.prototype.uvs=$util$1.emptyArray,n.prototype.marks=$util$1.emptyArray,n.decode=function(e,r){e instanceof $Reader$1||(e=$Reader$1.create(e));let o=r===void 0?e.len:e.pos+r,s=new $root$1.Vertices;for(;e.pos<o;){let u=e.uint32();switch(u>>>3){case 1:{if(s.xyz&&s.xyz.length||(s.xyz=[]),(u&7)===2){let l=e.uint32()+e.pos;for(;e.pos<l;)s.xyz.push(e.float())}else s.xyz.push(e.float());break}case 2:{if(s.uvs&&s.uvs.length||(s.uvs=[]),(u&7)===2){let l=e.uint32()+e.pos;for(;e.pos<l;)s.uvs.push(e.float())}else s.uvs.push(e.float());break}case 3:{if(s.marks&&s.marks.length||(s.marks=[]),(u&7)===2){let l=e.uint32()+e.pos;for(;e.pos<l;)s.marks.push(e.int32())}else s.marks.push(e.int32());break}default:e.skipType(u&7);break}}return s},n.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/Vertices"},n})(),$root$1.Faces=(()=>{function n(t){if(this.indices=[],this.normals=[],t)for(let e=Object.keys(t),r=0;r<e.length;++r)t[e[r]]!=null&&(this[e[r]]=t[e[r]])}return n.prototype.indices=$util$1.emptyArray,n.prototype.normals=$util$1.emptyArray,n.decode=function(e,r){e instanceof $Reader$1||(e=$Reader$1.create(e));let o=r===void 0?e.len:e.pos+r,s=new $root$1.Faces;for(;e.pos<o;){let u=e.uint32();switch(u>>>3){case 1:{if(s.indices&&s.indices.length||(s.indices=[]),(u&7)===2){let l=e.uint32()+e.pos;for(;e.pos<l;)s.indices.push(e.uint32())}else s.indices.push(e.uint32());break}case 2:{if(s.normals&&s.normals.length||(s.normals=[]),(u&7)===2){let l=e.uint32()+e.pos;for(;e.pos<l;)s.normals.push(e.float())}else s.normals.push(e.float());break}default:e.skipType(u&7);break}}return s},n.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/Faces"},n})(),$root$1.VertexMark=(()=>{const n={},t=Object.create(n);return t[n[0]="VERTEX_MARK_UNSPECIFIED"]=0,t[n[1]="VERTEX_MARK_ROOF"]=1,t})();function loadPbm(n,t){var e,r,o,s;t===void 0&&(t={});var u=(e=t.fetcher)!==null&&e!==void 0?e:new Fetcher({allowHosts:["*"]}),l={byteLength:0},c=autoRestImageOptionsByTextureLength((r=t.textureOptions)!==null&&r!==void 0?r:{},(s=(o=t.textureArray)===null||o===void 0?void 0:o.length)!==null&&s!==void 0?s:0),f={};if(t.textureArray)for(var d=0,p=t.textureArray;d<p.length;d++){var v=p[d];f[v]=loadTexture$1(v,c,u)}return Promise.resolve().then(function(){return u.ajax(n,{responseType:"arraybuffer"})}).then(function(g){return l.byteLength=g.body.byteLength,delay(function(){var h=new Uint8Array(g.body);return Model$2.decode(h)})}).then(function(g){return delay(function(){var h,m;return parse$4(g,(h=t.textureBaseUri)!==null&&h!==void 0?h:function(){var y=n.lastIndexOf("/");if(y>=0){var A=n.slice(0,y)+"/";return/\/model\/$/.test(A)&&(A=A.replace(/\/model\/$/,"/materials/")),A}return""}(),((m=t.textureArray)!==null&&m!==void 0?m:[]).slice(),c,f,u)})}).then(function(g){var h=new THREE__namespace.Group;h.matrixAutoUpdate=!1,h.matrix.compose(h.position,h.quaternion,h.scale),h.name=n;for(var m=0,y=g.objects;m<y.length;m++){var A=y[m];h.add(A)}return{type:"pbm",upAxis:"Z",uri:n,byteLength:l.byteLength,scene:h,textures:g.textures,dispose:function(){return g.dispose()}}})}function parseFloorName(n){var t=n.match(/(group|floor)-?(\d+)/);return t?parseInt(t[2],10):0}function parseChunkName(n){var t=n.match(/(chunk)-?(\d+)/);return t?parseInt(t[2],10):0}function parseSubName(n){var t=n.match(/(sub)-?(\d+)/);return t?parseInt(t[2],10):0}function chunkOrder(n){var t=parseFloorName(n.name),e=parseChunkName(n.name),r=parseSubName(n.name);return t*1e6+e*1e3+r}function parsePBMModel(n){for(var t,e,r,o=typeof n.createAt=="number"?n.createAt:0,s=(t=n.description)!==null&&t!==void 0?t:"",u=[],l=!0,c=!0,f=0,d=n.chunks;f<d.length;f++){var p=d[f];if(!p.vertices.marks||p.vertices.marks.length===0){c=!1;break}}for(var v=0,g=n.chunks;v<g.length;v++){var p=g[v];if(!p.faces.normals||p.faces.normals.length===0){l=!1;break}}for(var h=n.chunks.sort(function(he,fe){return chunkOrder(he)-chunkOrder(fe)}),m=[],y=0,A=h;y<A.length;y++){var p=A[y],E=parseFloorName(p.name);m[E]||(m[E]=[]),m[E].push(p)}for(var b=0;b<m.length;b++){var T=m[b];if(T)if(l){for(var _=0,R=0;R<T.length;R++){var p=T[R];_+=p.faces.indices.length}for(var S=new Float32Array(_*3),M=new Float32Array(_*2),B=new Float32Array(_*3),H=c?new Float32Array(_):void 0,w=[],C=[1/0,1/0,1/0,-1/0,-1/0,-1/0],L=0,I=0;I<T.length;I++){for(var F=[1/0,1/0,1/0,-1/0,-1/0,-1/0],p=T[I],k=p.vertices.xyz,N=p.vertices.uvs,D=p.faces.indices,U=p.faces.normals,Q=p.vertices.marks,q=D.length,R=0;R<q;R++){var G=D[R],J=S[L*3+R*3]=k[G*3],X=S[L*3+R*3+1]=k[G*3+1],W=S[L*3+R*3+2]=k[G*3+2];H&&(H[L+R]=Q[G]),M[L*2+R*2]=N[G*2],M[L*2+R*2+1]=N[G*2+1];var j=Math.floor(R/3)*3;B[L*3+R*3]=U[j],B[L*3+R*3+1]=U[j+1],B[L*3+R*3+2]=U[j+2],J<F[0]&&(F[0]=J),X<F[1]&&(F[1]=X),W<F[2]&&(F[2]=W),J>F[3]&&(F[3]=J),X>F[4]&&(F[4]=X),W>F[5]&&(F[5]=W)}F[0]<C[0]&&(C[0]=F[0]),F[1]<C[1]&&(C[1]=F[1]),F[2]<C[2]&&(C[2]=F[2]),F[3]>C[3]&&(C[3]=F[3]),F[4]>C[4]&&(C[4]=F[4]),F[5]>C[5]&&(C[5]=F[5]),w.push({materialIndex:I,name:p.name,chunkName:parseChunkName(p.name),start:L,count:p.faces.indices.length,texture:(e=p.texture)!==null&&e!==void 0?e:void 0}),L+=q}var te={createAt:o,description:s,vertices:S,uvs:M,normals:B,masks:H,indices:null,floorIndex:b,groups:w,extents:C};u.push(te)}else{for(var _=0,$=0,R=0;R<T.length;R++){var p=T[R];$+=p.vertices.xyz.length/3,_+=p.faces.indices.length}for(var S=new Float32Array($*3),M=new Float32Array($*2),B=void 0,ne=new Float32Array($),ie=new Uint32Array(_),H=c?new Float32Array(_):void 0,w=[],C=[1/0,1/0,1/0,-1/0,-1/0,-1/0],oe=0,L=0,I=0;I<T.length;I++){for(var F=[1/0,1/0,1/0,-1/0,-1/0,-1/0],p=T[I],k=p.vertices.xyz,Z=p.vertices.marks,N=p.vertices.uvs,D=p.faces.indices,de=k.length/3,q=D.length,R=0;R<de;R++){var J=S[L*3+R*3]=k[R*3],X=S[L*3+R*3+1]=k[R*3+1],W=S[L*3+R*3+2]=k[R*3+2];H&&(H[L+R]=Z[R]),M[L*2+R*2]=N[R*2],M[L*2+R*2+1]=N[R*2+1],ne[L+R]=b,J<F[0]&&(F[0]=J),X<F[1]&&(F[1]=X),W<F[2]&&(F[2]=W),J>F[3]&&(F[3]=J),X>F[4]&&(F[4]=X),W>F[5]&&(F[5]=W)}F[0]<C[0]&&(C[0]=F[0]),F[1]<C[1]&&(C[1]=F[1]),F[2]<C[2]&&(C[2]=F[2]),F[3]>C[3]&&(C[3]=F[3]),F[4]>C[4]&&(C[4]=F[4]),F[5]>C[5]&&(C[5]=F[5]);for(var R=0;R<q;R++)ie[oe+R]=L+D[R];w.push({materialIndex:I,name:p.name,chunkName:parseChunkName(p.name),start:oe,count:p.faces.indices.length,texture:(r=p.texture)!==null&&r!==void 0?r:void 0}),L+=de,oe+=q}var te={createAt:o,description:s,vertices:S,uvs:M,normals:B,masks:H,indices:ie,floorIndex:b,groups:w,extents:C};u.push(te)}}return u}function loadTexture$1(n,t,e){var r=__assign({key:"texture.pbm"},pick(t,["format","quality","size","sharpen","mappings"])),o=new TextureLoader,s=o.loadTexture(n,{imageURL:{transform:t.transform,options:r},encoding:THREE__namespace.sRGBEncoding,wrapS:THREE__namespace.ClampToEdgeWrapping,wrapT:THREE__namespace.ClampToEdgeWrapping,minFilter:THREE__namespace.LinearFilter,maxSize:typeof r.size=="number"?new THREE__namespace.Vector2(r.size,r.size):void 0,fetcher:e}).then(function(u){var l=u.body;return l.needsUpdate=!0,l});return Object.assign(s,{url:n,textureOptions:t})}function parse$4(n,t,e,r,o,s){o===void 0&&(o={});for(var u=parsePBMModel(n),l=0,c="",f=[],d={},p=new Set,v=0,g=u;v<g.length;v++){var h=g[v],m=h.createAt,y=h.description,A=h.vertices,E=h.masks,b=h.uvs,T=h.normals,_=h.indices,R=h.floorIndex,S=h.groups,M=h.extents,B=new THREE__namespace.Box3;B.min.x=M[0],B.min.y=M[1],B.min.z=M[2],B.max.x=M[3],B.max.y=M[4],B.max.z=M[5];var H=new THREE__namespace.BufferGeometry;H.setAttribute("position",new THREE__namespace.BufferAttribute(A,3)),H.setAttribute("uv",new THREE__namespace.BufferAttribute(b,2)),T&&H.setAttribute("normal",new THREE__namespace.BufferAttribute(T,3)),E&&H.setAttribute("mask",new THREE__namespace.BufferAttribute(E,1)),_&&H.setIndex(new THREE__namespace.BufferAttribute(_,1)),H.boundingBox=B,H.boundingSphere=B.getBoundingSphere(new THREE__namespace.Sphere);for(var w=0,C=S;w<C.length;w++){var L=C[w];H.addGroup(L.start,L.count,L.materialIndex)}p.add(H);for(var I=[],F=0,k=S;F<k.length;F++){var L=k[F],N=e[L.chunkName]||(L.texture?pathJoin(t||"",L.texture):void 0),D=new PBMMeshMaterial("basic");D.floor=R,H.attributes.normal===void 0&&(D.flatShading=!0),H.attributes.mask&&(D.defines.USE_VERTEX_MARK=!0),I.push(D),N?d[N]?d[N].push(D):d[N]=[D]:D.color=new THREE__namespace.Color(16777215),p.add(D),D.refreshUniforms()}var U=new PBMMesh(H,I);U.name="model_floor_"+R,U.userData.createAt=m,U.userData.description=y,U.matrix.compose(U.position,U.quaternion,U.scale),U.matrixAutoUpdate=!1,U.frustumCulled=!1,l=m,c=y,f.push(U)}var Q=function(q){q=autoRestImageOptionsByTextureLength(q,e.length);for(var G=[],J=function(te){var $=null;te in o&&($=o[te]),$||($=loadTexture$1(te,q,s)),G.push($.then(function(ne){for(var ie=0,oe=d[te];ie<oe.length;ie++){var Z=oe[ie];Z.map&&(p.delete(Z.map),Z.map.dispose()),Z.map=ne,Z.refreshUniforms(),p.add(ne)}return ne}).catch(function(){for(var ne=0,ie=d[te];ne<ie.length;ne++){var oe=ie[ne];oe.map&&(p.delete(oe.map),oe.map.dispose()),oe.map=null,oe.color=new THREE__namespace.Color(16777215),oe.refreshUniforms()}return null}))},X=0,W=Object.keys(d);X<W.length;X++){var j=W[X];J(j)}for(var j in o)delete o[j];return Promise.all(G).then(function(te){return te.filter(function($){return $})})};return Q(r).then(function(q){return{createAt:l,description:c,objects:f,textures:q,dispose:function(){p.forEach(function(G){G.dispose()}),p.clear()}}})}function autoRestImageOptionsByTextureLength(n,t){return n=Object.assign({},n),n.autoResize!==!1&&(t>96?n.size=Math.min(n.size||1/0,100):t>48?n.size=Math.min(n.size||1/0,200):t>24?n.size=Math.min(n.size||1/0,400):t>22?n.size=Math.min(n.size||1/0,800):t>5&&(n.size=Math.min(n.size||1/0,1024))),n}function loadAt3d(n,t){var e,r,o,s;t===void 0&&(t={});var u=(e=t.fetcher)!==null&&e!==void 0?e:new Fetcher({allowHosts:["*"]}),l={byteLength:0},c=autoRestImageOptionsByTextureLength((r=t.textureOptions)!==null&&r!==void 0?r:{},(s=(o=t.textureArray)===null||o===void 0?void 0:o.length)!==null&&s!==void 0?s:0),f={};if(t.textureArray)for(var d=0,p=t.textureArray;d<p.length;d++){var v=p[d];f[v]=loadTexture$1(v,c,u)}return Promise.resolve().then(function(){return u.ajax(n,{responseType:"arraybuffer"})}).then(function(g){return lzma(g.body)}).then(function(g){return delay(function(){for(var h,m={chunks:[],createAt:void 0,description:void 0},y=0,A=g;y<A.length;y++){var E=A[y],b=Model$2.decode(E);b.chunks.length&&((h=m.chunks).push.apply(h,b.chunks),m.createAt=b.createAt,m.description=b.description)}return m})}).then(function(g){return delay(function(){var h,m,y;return parse$4(g,(h=t.textureBaseUri)!==null&&h!==void 0?h:function(){var A=n.lastIndexOf("/");if(A>=0){var E=n.slice(0,A)+"/";return/\/model\/$/.test(E)&&(E=E.replace(/\/model\/$/,"/materials/")),E}return""}(),((m=t.textureArray)!==null&&m!==void 0?m:[]).slice(),(y=t.textureOptions)!==null&&y!==void 0?y:{},f,u)})}).then(function(g){var h=new THREE__namespace.Group;h.name=n;for(var m=0,y=g.objects;m<y.length;m++){var A=y[m];h.add(A)}return{type:"at3d",upAxis:"Z",uri:n,byteLength:l.byteLength,scene:h,textures:g.textures,dispose:function(){return g.dispose()}}})}const $Reader=minimal.Reader,$util=minimal.util,$root=minimal.roots["@REALSEE/FIVE:five/loaders/model/parsers/protobuf/dome.proto"]||(minimal.roots["@REALSEE/FIVE:five/loaders/model/parsers/protobuf/dome.proto"]={}),Model$1=$root.Model=(()=>{function n(t){if(this.meshes=[],t)for(let e=Object.keys(t),r=0;r<e.length;++r)t[e[r]]!=null&&(this[e[r]]=t[e[r]])}return n.prototype.meshes=$util.emptyArray,n.decode=function(e,r){e instanceof $Reader||(e=$Reader.create(e));let o=r===void 0?e.len:e.pos+r,s=new $root.Model;for(;e.pos<o;){let u=e.uint32();switch(u>>>3){case 1:{s.meshes&&s.meshes.length||(s.meshes=[]),s.meshes.push($root.Mesh.decode(e,e.uint32()));break}default:e.skipType(u&7);break}}return s},n.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/Model"},n})();$root.Mesh=(()=>{function n(t){if(this.chunks=[],this.matrix=[],t)for(let e=Object.keys(t),r=0;r<e.length;++r)t[e[r]]!=null&&(this[e[r]]=t[e[r]])}return n.prototype.name="",n.prototype.chunks=$util.emptyArray,n.prototype.matrix=$util.emptyArray,n.decode=function(e,r){e instanceof $Reader||(e=$Reader.create(e));let o=r===void 0?e.len:e.pos+r,s=new $root.Mesh;for(;e.pos<o;){let u=e.uint32();switch(u>>>3){case 1:{s.name=e.string();break}case 2:{s.chunks&&s.chunks.length||(s.chunks=[]),s.chunks.push($root.Chunk.decode(e,e.uint32()));break}case 3:{s.matrix&&s.matrix.length||(s.matrix=[]),s.matrix.push($root.Matrix.decode(e,e.uint32()));break}default:e.skipType(u&7);break}}if(!s.hasOwnProperty("name"))throw $util.ProtocolError("missing required 'name'",{instance:s});return s},n.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/Mesh"},n})(),$root.Matrix=(()=>{function n(t){if(this.elements=[],t)for(let e=Object.keys(t),r=0;r<e.length;++r)t[e[r]]!=null&&(this[e[r]]=t[e[r]])}return n.prototype.elements=$util.emptyArray,n.decode=function(e,r){e instanceof $Reader||(e=$Reader.create(e));let o=r===void 0?e.len:e.pos+r,s=new $root.Matrix;for(;e.pos<o;){let u=e.uint32();switch(u>>>3){case 1:{if(s.elements&&s.elements.length||(s.elements=[]),(u&7)===2){let l=e.uint32()+e.pos;for(;e.pos<l;)s.elements.push(e.float())}else s.elements.push(e.float());break}default:e.skipType(u&7);break}}return s},n.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/Matrix"},n})(),$root.Chunk=(()=>{function n(t){if(this.material=[],t)for(let e=Object.keys(t),r=0;r<e.length;++r)t[e[r]]!=null&&(this[e[r]]=t[e[r]])}return n.prototype.geometry=null,n.prototype.material=$util.emptyArray,n.decode=function(e,r){e instanceof $Reader||(e=$Reader.create(e));let o=r===void 0?e.len:e.pos+r,s=new $root.Chunk;for(;e.pos<o;){let u=e.uint32();switch(u>>>3){case 2:{s.geometry=$root.Geometry.decode(e,e.uint32());break}case 3:{s.material&&s.material.length||(s.material=[]),s.material.push($root.Material.decode(e,e.uint32()));break}default:e.skipType(u&7);break}}if(!s.hasOwnProperty("geometry"))throw $util.ProtocolError("missing required 'geometry'",{instance:s});return s},n.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/Chunk"},n})(),$root.Geometry=(()=>{function n(t){if(this.groups=[],t)for(let e=Object.keys(t),r=0;r<e.length;++r)t[e[r]]!=null&&(this[e[r]]=t[e[r]])}return n.prototype.position=null,n.prototype.uv=null,n.prototype.uv2=null,n.prototype.normal=null,n.prototype.groups=$util.emptyArray,n.decode=function(e,r){e instanceof $Reader||(e=$Reader.create(e));let o=r===void 0?e.len:e.pos+r,s=new $root.Geometry;for(;e.pos<o;){let u=e.uint32();switch(u>>>3){case 1:{s.position=$root.Position.decode(e,e.uint32());break}case 2:{s.uv=$root.UV.decode(e,e.uint32());break}case 3:{s.uv2=$root.UV.decode(e,e.uint32());break}case 4:{s.normal=$root.Normal.decode(e,e.uint32());break}case 5:{s.groups&&s.groups.length||(s.groups=[]),s.groups.push($root.Group.decode(e,e.uint32()));break}default:e.skipType(u&7);break}}if(!s.hasOwnProperty("position"))throw $util.ProtocolError("missing required 'position'",{instance:s});if(!s.hasOwnProperty("normal"))throw $util.ProtocolError("missing required 'normal'",{instance:s});return s},n.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/Geometry"},n})(),$root.Position=(()=>{function n(t){if(this.array=[],t)for(let e=Object.keys(t),r=0;r<e.length;++r)t[e[r]]!=null&&(this[e[r]]=t[e[r]])}return n.prototype.array=$util.emptyArray,n.decode=function(e,r){e instanceof $Reader||(e=$Reader.create(e));let o=r===void 0?e.len:e.pos+r,s=new $root.Position;for(;e.pos<o;){let u=e.uint32();switch(u>>>3){case 1:{if(s.array&&s.array.length||(s.array=[]),(u&7)===2){let l=e.uint32()+e.pos;for(;e.pos<l;)s.array.push(e.float())}else s.array.push(e.float());break}default:e.skipType(u&7);break}}return s},n.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/Position"},n})(),$root.UV=(()=>{function n(t){if(this.array=[],t)for(let e=Object.keys(t),r=0;r<e.length;++r)t[e[r]]!=null&&(this[e[r]]=t[e[r]])}return n.prototype.array=$util.emptyArray,n.decode=function(e,r){e instanceof $Reader||(e=$Reader.create(e));let o=r===void 0?e.len:e.pos+r,s=new $root.UV;for(;e.pos<o;){let u=e.uint32();switch(u>>>3){case 1:{if(s.array&&s.array.length||(s.array=[]),(u&7)===2){let l=e.uint32()+e.pos;for(;e.pos<l;)s.array.push(e.float())}else s.array.push(e.float());break}default:e.skipType(u&7);break}}return s},n.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/UV"},n})(),$root.Normal=(()=>{function n(t){if(this.array=[],t)for(let e=Object.keys(t),r=0;r<e.length;++r)t[e[r]]!=null&&(this[e[r]]=t[e[r]])}return n.prototype.array=$util.emptyArray,n.decode=function(e,r){e instanceof $Reader||(e=$Reader.create(e));let o=r===void 0?e.len:e.pos+r,s=new $root.Normal;for(;e.pos<o;){let u=e.uint32();switch(u>>>3){case 1:{if(s.array&&s.array.length||(s.array=[]),(u&7)===2){let l=e.uint32()+e.pos;for(;e.pos<l;)s.array.push(e.float())}else s.array.push(e.float());break}default:e.skipType(u&7);break}}return s},n.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/Normal"},n})(),$root.Group=(()=>{function n(t){if(t)for(let e=Object.keys(t),r=0;r<e.length;++r)t[e[r]]!=null&&(this[e[r]]=t[e[r]])}return n.prototype.start=0,n.prototype.count=0,n.prototype.materialIndex=0,n.decode=function(e,r){e instanceof $Reader||(e=$Reader.create(e));let o=r===void 0?e.len:e.pos+r,s=new $root.Group;for(;e.pos<o;){let u=e.uint32();switch(u>>>3){case 1:{s.start=e.uint32();break}case 2:{s.count=e.uint32();break}case 3:{s.materialIndex=e.uint32();break}default:e.skipType(u&7);break}}if(!s.hasOwnProperty("start"))throw $util.ProtocolError("missing required 'start'",{instance:s});if(!s.hasOwnProperty("count"))throw $util.ProtocolError("missing required 'count'",{instance:s});if(!s.hasOwnProperty("materialIndex"))throw $util.ProtocolError("missing required 'materialIndex'",{instance:s});return s},n.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/Group"},n})(),$root.Material=(()=>{function n(t){if(t)for(let e=Object.keys(t),r=0;r<e.length;++r)t[e[r]]!=null&&(this[e[r]]=t[e[r]])}return n.prototype.kd=null,n.prototype.ks=null,n.prototype.ke=null,n.prototype.mapkd="",n.prototype.mapks="",n.prototype.mapke="",n.prototype.norm="",n.prototype.mapbump="",n.prototype.bump="",n.prototype.mapd="",n.prototype.ns=0,n.prototype.d=0,n.prototype.tr=0,n.prototype.mapkdrepeat="",n.decode=function(e,r){e instanceof $Reader||(e=$Reader.create(e));let o=r===void 0?e.len:e.pos+r,s=new $root.Material;for(;e.pos<o;){let u=e.uint32();switch(u>>>3){case 1:{s.kd=$root.Color.decode(e,e.uint32());break}case 2:{s.ks=$root.Color.decode(e,e.uint32());break}case 3:{s.ke=$root.Color.decode(e,e.uint32());break}case 4:{s.mapkd=e.string();break}case 5:{s.mapks=e.string();break}case 6:{s.mapke=e.string();break}case 7:{s.norm=e.string();break}case 8:{s.mapbump=e.string();break}case 9:{s.bump=e.string();break}case 10:{s.mapd=e.string();break}case 11:{s.ns=e.float();break}case 12:{s.d=e.float();break}case 13:{s.tr=e.float();break}case 14:{s.mapkdrepeat=e.string();break}default:e.skipType(u&7);break}}return s},n.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/Material"},n})(),$root.Color=(()=>{function n(t){if(this.rgb=[],t)for(let e=Object.keys(t),r=0;r<e.length;++r)t[e[r]]!=null&&(this[e[r]]=t[e[r]])}return n.prototype.rgb=$util.emptyArray,n.decode=function(e,r){e instanceof $Reader||(e=$Reader.create(e));let o=r===void 0?e.len:e.pos+r,s=new $root.Color;for(;e.pos<o;){let u=e.uint32();switch(u>>>3){case 1:{if(s.rgb&&s.rgb.length||(s.rgb=[]),(u&7)===2){let l=e.uint32()+e.pos;for(;e.pos<l;)s.rgb.push(e.float())}else s.rgb.push(e.float());break}default:e.skipType(u&7);break}}return s},n.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/Color"},n})();var ROTATE_X_MATRIX$5=new THREE__namespace.Matrix4().fromArray([1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1]);function loadDome(n,t){var e;t===void 0&&(t={});var r=(e=t.fetcher)!==null&&e!==void 0?e:new Fetcher({allowHosts:["*"]}),o={byteLength:0};return Promise.resolve().then(function(){return r.ajax(n,{responseType:"arraybuffer"})}).then(function(s){var u;return o.byteLength=s.body.byteLength,parse$3(new Uint8Array(s.body),t.textureBaseUri||"",(u=t.textureOptions)!==null&&u!==void 0?u:{},r)}).then(function(s){var u=new THREE__namespace.Group;u.matrixAutoUpdate=!1,u.applyMatrix4(ROTATE_X_MATRIX$5),u.matrix.compose(u.position,u.quaternion,u.scale),u.name=n;for(var l=0,c=s.objects;l<c.length;l++){var f=c[l];u.add(f)}return{type:"dome",upAxis:"Z",uri:n,byteLength:o.byteLength,scene:u,textures:s.textures,dispose:function(){return s.dispose()}}})}function flipBufferGeometryNormals(n){for(var t=[0,0,0],e=0;e<n.attributes.normal.array.length/9;e++)t[0]=n.attributes.normal.array[e*9],t[1]=n.attributes.normal.array[e*9+1],t[2]=n.attributes.normal.array[e*9+2],n.attributes.normal.array[e*9]=n.attributes.normal.array[e*9+6],n.attributes.normal.array[e*9+1]=n.attributes.normal.array[e*9+7],n.attributes.normal.array[e*9+2]=n.attributes.normal.array[e*9+8],n.attributes.normal.array[e*9+6]=t[0],n.attributes.normal.array[e*9+7]=t[1],n.attributes.normal.array[e*9+8]=t[2];for(var e=0;e<n.attributes.position.array.length/9;e++)t[0]=n.attributes.position.array[e*9],t[1]=n.attributes.position.array[e*9+1],t[2]=n.attributes.position.array[e*9+2],n.attributes.position.array[e*9]=n.attributes.position.array[e*9+6],n.attributes.position.array[e*9+1]=n.attributes.position.array[e*9+7],n.attributes.position.array[e*9+2]=n.attributes.position.array[e*9+8],n.attributes.position.array[e*9+6]=t[0],n.attributes.position.array[e*9+7]=t[1],n.attributes.position.array[e*9+8]=t[2];for(var e=0;e<n.attributes.uv.array.length/6;e++)t[0]=n.attributes.uv.array[e*6],t[1]=n.attributes.uv.array[e*6+1],n.attributes.uv.array[e*6]=n.attributes.uv.array[e*6+4],n.attributes.uv.array[e*6+1]=n.attributes.uv.array[e*6+5],n.attributes.uv.array[e*6+4]=t[0],n.attributes.uv.array[e*6+5]=t[1];n.attributes.normal.needsUpdate=!0,n.attributes.position.needsUpdate=!0,n.attributes.uv.needsUpdate=!0}function parseGeometry(n){var t=n.position,e=n.normal,r=n.uv,o=n.uv2,s=n.groups,u=new THREE__namespace.BufferGeometry;u.setAttribute("position",new THREE__namespace.BufferAttribute(new Float32Array(t.array),3)),e&&u.setAttribute("normal",new THREE__namespace.BufferAttribute(new Float32Array(e.array),3)),r&&u.setAttribute("uv",new THREE__namespace.BufferAttribute(new Float32Array(r.array),2)),o&&u.setAttribute("uv2",new THREE__namespace.BufferAttribute(new Float32Array(o.array),2));for(var l=0,c=s;l<c.length;l++){var f=c[l];u.addGroup(f.start,f.count,f.materialIndex)}return u}function loadTexture(n,t,e,r,o,s,u){if(u.hasOwnProperty(n))return u[n];n=n.split("?")[0],isAbsoluteURL(n)||(n=pathJoin(t,n)),n=n.replace(/\/\/vrlab-image\d*.ljcdn.com\//,"//vrlab-public.ljcdn.com/"),n.indexOf("//")===0&&(n="https:"+n);var l=__assign({key:"texture.dome",size:64},pick(e,["quality","format","sharpen","mappings"])),c=u[n]=o.loadTexture(n,{imageURL:{transform:e.transform,options:l},wrapS:THREE__namespace.RepeatWrapping,wrapT:THREE__namespace.RepeatWrapping,fetcher:s}).then(function(f){var d=f.body;return r&&d.repeat.copy(r),d.needsUpdate=!0,d.updateMatrix(),d});return c}function parseMaterial(n,t,e,r,o,s,u,l){var c=[],f=new PBMMeshMaterial("phong");if(u.add(f),n.kd&&(f.color=new THREE__namespace.Color().fromArray(n.kd.rgb).convertLinearToSRGB()),n.mapkd){var d=null;if(n.mapkdrepeat){var p=n.mapkdrepeat.split(/\s+/).map(function(m){return Number(m)}),v=p[0],g=p[1];d=new THREE__namespace.Vector2(v,g)}c.push(loadTexture(n.mapkd,t,e,d,r,o,s).then(function(m){m.encoding=THREE__namespace.sRGBEncoding,f.map=m,u.add(m),l.add(m),f.needsUpdate=!0}).catch(noop$1))}if(n.ks&&(f.specular=new THREE__namespace.Color().fromArray(n.ks.rgb).convertLinearToSRGB()),n.mapks&&c.push(loadTexture(n.mapks,t,e,null,r,o,s).then(function(m){f.specularMap=m,u.add(m),l.add(m)}).catch(noop$1)),n.ke&&(f.emissive=new THREE__namespace.Color().fromArray(n.ke.rgb).convertLinearToSRGB()),n.mapke&&c.push(loadTexture(n.mapke,t,e,null,r,o,s).then(function(m){m.encoding=THREE__namespace.sRGBEncoding,f.emissiveMap=m,u.add(m),l.add(m)}).catch(noop$1)),n.norm&&c.push(loadTexture(n.norm,t,e,null,r,o,s).then(function(m){f.normalMap=m,u.add(m),l.add(m)}).catch(noop$1)),n.mapbump&&c.push(loadTexture(n.mapbump,t,e,null,r,o,s).then(function(m){f.bumpMap=m,u.add(m),l.add(m)}).catch(noop$1)),n.bump&&c.push(loadTexture(n.bump,t,e,null,r,o,s).then(function(m){f.bumpMap=m,u.add(m),l.add(m)}).catch(noop$1)),typeof n.ns=="number"&&(f.shininess=n.ns),typeof n.d=="number"){var h=n.d;h>0&&h<1&&(f.opacity=h)}return f.floor=0,f.refreshUniforms(),{material:f,textureReady:Promise.all(c).then(noop$1)}}function fromProtoBuf(n){return Model$1.decode(n).meshes}function parse$3(n,t,e,r){for(var o=[],s=[],u=new Set,l=fromProtoBuf(n),c=new TextureLoader,f=new THREE__namespace.Matrix4,d=new THREE__namespace.Vector3,p=new THREE__namespace.Quaternion,v=new THREE__namespace.Vector3,g={},h=new Set,m=0,y=l;m<y.length;m++){var A=y[m],E=A.name,b=A.chunks,T=A.matrix;if(!(E==="Ceiling"||E==="CeilingDrop"))for(var _=0,R=T;_<R.length;_++){var S=R[_];f.elements=S.elements;for(var M=new THREE__namespace.Group,B=0;B<b.length;B++){var H=parseGeometry(b[B].geometry);H.applyMatrix4(f),f.decompose(d,p,v),v.x*v.y*v.z<0&&H.attributes.normal&&H.attributes.position&&H.attributes.uv&&flipBufferGeometryNormals(H),u.add(H);for(var w=[],C=0,L=b[B].material;C<L.length;C++){var I=L[C],F=parseMaterial(I,t||"",e,c,r,g,u,h),k=F.material,N=F.textureReady;s.push(N),w.push(k)}var D=new PBMMesh(H,w);D.name="chunk_"+B,D.matrix.compose(D.position,D.quaternion,D.scale),D.matrixAutoUpdate=!1,D.frustumCulled=!1,M.add(D)}M.name=E,o.push(M)}}return Promise.all(s).catch(noop$1).then(function(){return{createAt:0,description:"",objects:o,textures:Array.from(h),dispose:function(){u.forEach(function(U){U.dispose()}),u.clear()}}})}var ROTATE_X_MATRIX$4=new THREE__namespace.Matrix4().fromArray([1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1]);function loadDomez(n,t){var e;t===void 0&&(t={});var r=(e=t.fetcher)!==null&&e!==void 0?e:new Fetcher({allowHosts:["*"]}),o={byteLength:0};return Promise.resolve().then(function(){return r.ajax(n,{responseType:"arraybuffer"})}).then(function(s){return o.byteLength=s.body.byteLength,lzma(s.body)}).then(function(s){var u=s.reduce(function(f,d){return f+d.length},0),l=new Uint8Array(u),c=0;return s.forEach(function(f){l.set(f,c),c+=f.length}),l}).then(function(s){var u;return parse$3(s,t.textureBaseUri||"",(u=t.textureOptions)!==null&&u!==void 0?u:{},r)}).then(function(s){var u=new THREE__namespace.Group;u.matrixAutoUpdate=!1,u.applyMatrix4(ROTATE_X_MATRIX$4),u.matrix.compose(u.position,u.quaternion,u.scale),u.name=n;for(var l=0,c=s.objects;l<c.length;l++){var f=c[l];u.add(f)}return{type:"domez",upAxis:"Z",uri:n,byteLength:o.byteLength,scene:u,textures:s.textures,dispose:function(){return s.dispose()}}})}var ROTATE_X_MATRIX$3=new THREE__namespace.Matrix4().fromArray([1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1]);function loadGlb(n,t){var e,r;t===void 0&&(t={});var o=(e=t.upAxis)!==null&&e!==void 0?e:"Y",s=(r=t.fetcher)!==null&&r!==void 0?r:new Fetcher({allowHosts:["*"]}),u=0;return Promise.resolve().then(function(){return s.ajax(n,{responseType:"arraybuffer"}).then(function(l){return u=l.body.byteLength,l.body})}).then(function(l){var c;return parseGltf(l,{copyUV2:!1,addonExtensions:["PBM_mesh"],resourcePath:n.slice(0,n.lastIndexOf("/")+1),search:(c=n.split("?")[1])!==null&&c!==void 0?c:"",fetcher:s})}).then(function(l){var c=new THREE__namespace.Matrix4;if(o==="Y"&&c.premultiply(ROTATE_X_MATRIX$3),l.CESIUM_RTC){var f=new THREE__namespace.Matrix4().setPosition(l.CESIUM_RTC.center);c.premultiply(f)}var d=l.scene;return d.applyMatrix4(c),{type:"glb",upAxis:"Z",uri:n,byteLength:u,scene:d,textures:l.textures,dispose:function(){return l.dispose()}}})}var ROTATE_X_MATRIX$2=new THREE__namespace.Matrix4().fromArray([1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1]),scratchColor=new THREE__namespace.Color;function loadPly(n,t){var e,r;t===void 0&&(t={});var o=(e=t.upAxis)!==null&&e!==void 0?e:"Z",s=(r=t.fetcher)!==null&&r!==void 0?r:new Fetcher({allowHosts:["*"]}),u=0;return Promise.resolve().then(function(){return s.ajax(n,{responseType:"arraybuffer"}).then(function(l){return u=l.body.byteLength,l.body})}).then(function(l){var c,f;return parsePly(l,{propertyNameMapping:(c=t.propertyNameMapping)!==null&&c!==void 0?c:{},customPropertyMapping:(f=t.customPropertyMapping)!==null&&f!==void 0?f:{}})}).then(function(l){var c=l.geometry;switch(t.type){case"geometry":{var f=c;return o==="Y"&&f.applyMatrix4(ROTATE_X_MATRIX$2),{type:"ply",upAxis:"Z",uri:n,byteLength:u,scene:f,meta:{},textures:[],dispose:function(){c.dispose()}}}case"mesh":{var d="color"in c.attributes,p=new THREE__namespace.MeshBasicMaterial({vertexColors:d}),f=new THREE__namespace.Mesh(c,p);return o==="Y"&&f.applyMatrix4(ROTATE_X_MATRIX$2),{type:"ply",upAxis:"Z",uri:n,byteLength:u,scene:f,meta:{},textures:[],dispose:function(){c.dispose(),p.dispose()}}}case"line":{var d="color"in c.attributes,v=new THREE__namespace.LineBasicMaterial({vertexColors:d}),f=new THREE__namespace.Line(c,v);return f.computeLineDistances(),o==="Y"&&f.applyMatrix4(ROTATE_X_MATRIX$2),{type:"ply",upAxis:"Z",uri:n,byteLength:u,scene:f,meta:{},textures:[],dispose:function(){c.dispose(),v.dispose()}}}case"points":{var g=new THREE__namespace.PointsMaterial({}),f=new THREE__namespace.Points(c,g);return o==="Y"&&f.applyMatrix4(ROTATE_X_MATRIX$2),{type:"ply",upAxis:"Z",uri:n,byteLength:u,scene:f,meta:{},textures:[],dispose:function(){c.dispose(),g.dispose()}}}case"pbmPointCloud":{var h=new PBMPointCloudMaterial,f=new PBMPointCloud(c,h);return o==="Y"&&f.applyMatrix4(ROTATE_X_MATRIX$2),{type:"ply",upAxis:"Z",uri:n,byteLength:u,scene:f,meta:{},textures:[],dispose:function(){c.dispose(),h.dispose()}}}}throw new Error("Invalid Type: ".concat(t.type))})}function parsePly(n,t){var e=new Uint8Array(n),r=extractHeaderText(e),o=r.headerText,s=r.headerLength,u=parseHeader(o,s,t);if(u.format==="ascii"){var l=new TextDecoder().decode(e);return{header:u,geometry:parseASCII(l,u,t)}}else return{header:u,geometry:parseBinary(n,u,t)}}function makePlyElementProperty(n,t){var e={name:"",type:n[0]};return e.type==="list"?(e.name=n[3],e.countType=n[1],e.itemType=n[2]):e.name=n[1],e.name in t.propertyNameMapping&&(e.name=t.propertyNameMapping[e.name]),e}function parseHeader(n,t,e){t===void 0&&(t=0);var r=/^ply([\s\S]*)end_header(\r\n|\r|\n)/,o="",s=r.exec(n);s!==null&&(o=s[1]);for(var u={format:"",version:"",comments:[],elements:[],headerLength:t,objInfo:""},l=o.split(/\r\n|\r|\n/),c=null,f=0;f<l.length;f++){var d=l[f];if(d=d.trim(),d!==""){var p=d.split(/\s+/),v=p.shift();switch(d=p.join(" "),v){case"format":u.format=p[0],u.version=p[1];break;case"comment":u.comments.push(d);break;case"element":c&&u.elements.push(c),c={name:p[0],count:parseInt(p[1]),properties:[]};break;case"property":c&&c.properties.push(makePlyElementProperty(p,e));break;case"obj_info":u.objInfo=d;break;default:console.log("unhandled",v,p)}}}return c&&u.elements.push(c),u}function parseASCIINumber(n,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(n);case"float":case"double":case"float32":case"float64":return parseFloat(n);default:throw new Error("unspport type: "+t)}}function parseASCIIElement(n,t){for(var e={},r=0;r<n.length;r++){if(t.empty())return null;if(n[r].type==="list"){for(var o=[],s=parseASCIINumber(t.next(),n[r].countType),u=0;u<s;u++){if(t.empty())return null;o.push(parseASCIINumber(t.next(),n[r].itemType))}e[n[r].name]=o}else e[n[r].name]=parseASCIINumber(t.next(),n[r].type)}return e}function createBuffer(n){for(var t={indices:[],vertices:[],normals:[],uvs:[],faceVertexUvs:[],colors:[],faceVertexColors:[]},e=0,r=Object.keys(n.customPropertyMapping);e<r.length;e++){var o=r[e];t[o]=[]}return t}function mapElementAttributes(n){var t=n.map(function(r){return r.name});function e(r){for(var o=0,s=r.length;o<s;o++){var u=r[o];if(t.includes(u))return u}return null}return{attrX:e(["x","px","posx"])||"x",attrY:e(["y","py","posy"])||"y",attrZ:e(["z","pz","posz"])||"z",attrNX:e(["nx","normalx"]),attrNY:e(["ny","normaly"]),attrNZ:e(["nz","normalz"]),attrS:e(["s","u","texture_u","tx"]),attrT:e(["t","v","texture_v","ty"]),attrR:e(["red","diffuse_red","r","diffuse_r"]),attrG:e(["green","diffuse_green","g","diffuse_g"]),attrB:e(["blue","diffuse_blue","b","diffuse_b"])}}function parseASCII(n,t,e){var r=createBuffer(e),o=/end_header\s+(\S[\s\S]*\S|\S)\s*$/,s,u=null;(u=o.exec(n))!==null?s=u[1].split(/\s+/):s=[];var l=new ArrayStream(s);e:for(var c=0;c<t.elements.length;c++)for(var f=t.elements[c],d=mapElementAttributes(f.properties),p=0;p<f.count;p++){var v=parseASCIIElement(f.properties,l);if(!v)break e;handleElement(r,f.name,v,d,e)}return postProcess(r,e)}function postProcess(n,t){var e=new THREE__namespace.BufferGeometry;n.indices.length>0&&e.setIndex(n.indices),e.setAttribute("position",new THREE__namespace.Float32BufferAttribute(n.vertices,3)),n.normals.length>0&&e.setAttribute("normal",new THREE__namespace.Float32BufferAttribute(n.normals,3)),n.uvs.length>0&&e.setAttribute("uv",new THREE__namespace.Float32BufferAttribute(n.uvs,2)),n.colors.length>0&&e.setAttribute("color",new THREE__namespace.Float32BufferAttribute(n.colors,3)),(n.faceVertexUvs.length>0||n.faceVertexColors.length>0)&&(e=e.toNonIndexed(),n.faceVertexUvs.length>0&&e.setAttribute("uv",new THREE__namespace.Float32BufferAttribute(n.faceVertexUvs,2)),n.faceVertexColors.length>0&&e.setAttribute("color",new THREE__namespace.Float32BufferAttribute(n.faceVertexColors,3)));for(var r=0,o=Object.keys(t.customPropertyMapping);r<o.length;r++){var s=o[r];if(n[s].length>0){var u=t.customPropertyMapping[s],l=u.itemType,c=u.itemNames,f=u.normalized,d=c.length,p=void 0;switch(l){case"float32":p=new THREE__namespace.Float32BufferAttribute(n[s],d,f);break;case"uint32":p=new THREE__namespace.Uint32BufferAttribute(n[s],d,f);break;case"int32":p=new THREE__namespace.Int32BufferAttribute(n[s],d,f);break;case"uint16":p=new THREE__namespace.Uint16BufferAttribute(n[s],d,f);break;case"int16":p=new THREE__namespace.Int16BufferAttribute(n[s],d,f);break;case"uint8":p=new THREE__namespace.Uint8BufferAttribute(n[s],d,f);break;case"int8":p=new THREE__namespace.Int8BufferAttribute(n[s],d,f);break;default:p=new THREE__namespace.Float32BufferAttribute(n[s],d,f);break}e.setAttribute(s,p)}}return e.computeBoundingSphere(),e}function handleElement(n,t,e,r,o){if(t==="vertex"){r.attrX!==null&&r.attrY!==null&&r.attrZ!==null&&n.vertices.push(e[r.attrX],e[r.attrY],e[r.attrZ]),r.attrNX!==null&&r.attrNY!==null&&r.attrNZ!==null&&n.normals.push(e[r.attrNX],e[r.attrNY],e[r.attrNZ]),r.attrS!==null&&r.attrT!==null&&n.uvs.push(e[r.attrS],e[r.attrT]),r.attrR!==null&&r.attrG!==null&&r.attrB!==null&&(scratchColor.setRGB(e[r.attrR]/255,e[r.attrG]/255,e[r.attrB]/255),n.colors.push(scratchColor.r,scratchColor.g,scratchColor.b));for(var s=0,u=Object.keys(o.customPropertyMapping);s<u.length;s++)for(var l=u[s],c=0,f=o.customPropertyMapping[l].itemNames;c<f.length;c++){var d=f[c];n[l].push(e[d])}}else if(t==="face"){var p=e.vertex_indices||e.vertex_index,v=e.texcoord;p.length===3?(n.indices.push(p[0],p[1],p[2]),v&&v.length===6&&(n.faceVertexUvs.push(v[0],v[1]),n.faceVertexUvs.push(v[2],v[3]),n.faceVertexUvs.push(v[4],v[5]))):p.length===4&&(n.indices.push(p[0],p[1],p[3]),n.indices.push(p[1],p[2],p[3])),r.attrR!==null&&r.attrG!==null&&r.attrB!==null&&(scratchColor.setRGB(e[r.attrR]/255,e[r.attrG]/255,e[r.attrB]/255),n.faceVertexColors.push(scratchColor.r,scratchColor.g,scratchColor.b),n.faceVertexColors.push(scratchColor.r,scratchColor.g,scratchColor.b),n.faceVertexColors.push(scratchColor.r,scratchColor.g,scratchColor.b))}}function binaryReadElement(n,t){for(var e={},r=0,o=0;o<t.length;o++){var s=t[o],u=s.valueReader;if(s.type==="list"){var l=[],c=s.countReader.read(n+r);r+=s.countReader.size;for(var f=0;f<c;f++)l.push(u.read(n+r)),r+=u.size;e[s.name]=l}else e[s.name]=u.read(n+r),r+=u.size}return[e,r]}function setPropertyBinaryReaders(n,t,e){function r(l,c,f){switch(c){case"int8":case"char":return{read:function(d){return l.getInt8(d)},size:1};case"uint8":case"uchar":return{read:function(d){return l.getUint8(d)},size:1};case"int16":case"short":return{read:function(d){return l.getInt16(d,f)},size:2};case"uint16":case"ushort":return{read:function(d){return l.getUint16(d,f)},size:2};case"int32":case"int":return{read:function(d){return l.getInt32(d,f)},size:4};case"uint32":case"uint":return{read:function(d){return l.getUint32(d,f)},size:4};case"float32":case"float":return{read:function(d){return l.getFloat32(d,f)},size:4};case"float64":case"double":return{read:function(d){return l.getFloat64(d,f)},size:8};default:throw new Error("not support type: "+c)}}for(var o=0,s=n.length;o<s;o++){var u=n[o];u.type==="list"?(u.countReader=r(t,u.countType,e),u.valueReader=r(t,u.itemType,e)):u.valueReader=r(t,u.type,e)}}function parseBinary(n,t,e){for(var r=createBuffer(e),o=t.format==="binary_little_endian",s=new DataView(n,t.headerLength),u,l=0,c=0;c<t.elements.length;c++){var f=t.elements[c],d=f.properties,p=mapElementAttributes(d);setPropertyBinaryReaders(d,s,o);for(var v=0;v<f.count;v++){u=binaryReadElement(l,d),l+=u[1];var g=u[0];handleElement(r,f.name,g,p,e)}}return postProcess(r,e)}function extractHeaderText(n){var t=0,e=!0,r="",o=[],s=new TextDecoder().decode(n.subarray(0,5)),u=/^ply\r\n/.test(s);do{var l=String.fromCharCode(n[t++]);l!==`
|
|
928
|
+
`),support=typeof Worker!="undefined"&&typeof Blob!="undefined",lzmaWorkerURL="";if(support)try{var blob=new Blob([lzmaWorkerSource],{type:"text/javascript"});lzmaWorkerURL=URL.createObjectURL(blob)}catch(n){}var LZMAWorker=function(){function n(){var t=this;if(!support)throw new Error("LZMAWorker cannot work in this broswer.");this.callCounter=0,this.requests={};var e=this.worker=new Worker(lzmaWorkerURL);e.onmessage=function(r){var o=r.data,s=o.id,u=o.result,l=o.error,c=t.getKey(s);t.requests[c]&&(l?t.requests[c](new Error(l)):t.requests[c](null,u),delete t.requests[c])},e.onerror=function(r){return console.error(r)}}return n.prototype.getKey=function(t){return"key_"+String(t)},n.prototype.decompress=function(t,e){var r=++this.callCounter;this.requests[this.getKey(r)]=e,this.worker.postMessage({type:"decompress",id:r,data:t},[t.buffer])},n.prototype.terminate=function(){this.worker.terminate()},n.support=support,n}();function readUint32(n){return Array.prototype.reduce.call(n,function(t,e,r){return t|e<<r*8},0)}function binaryArrays(n){for(var t=[],e=n.length,r=function(u){var l={data:n[u],offset:0,readByte:function(){return this.data[this.offset++]}},c=l.data.length,f={data:[],offset:0,writeByte:function(p){var v=Math.floor(this.offset/c);this.data[v]||(this.data[v]=new Uint8Array(c)),this.data[v][this.offset%c]=p,this.offset++}};LZMA.decompressFile(l,f),o=new Uint8Array(f.offset);for(var d=0;d<f.offset;d++)o[d]=f.data[Math.floor(d/c)][d%c];t.push(o)},o,s=0;s<e;s++)r(s);return t}function binaryArraysWithWorker(n){for(var t=[],e=n.length,r=function(s){t.push(new Promise(function(u,l){var c=new LZMAWorker;c.decompress(n[s],function(f,d){if(c.terminate(),f)return l(f);u(d)})}))},o=0;o<e;o++)r(o);return Promise.all(t)}function lzma(n){var t=new Uint8Array(n),e=readUint32(t.slice(0,4));if(e>10)return Promise.reject(new Error("LZMA got too many sub chunks."));for(var r=[],o=[],s=4+e*4,u=0;u<e;u++)o[u]=readUint32(t.slice(4+u*4,8+u*4)),u===e-1?r[u]=t.subarray(s,s+o[u]):r[u]=t.slice(s,s+o[u]),s+=o[u];return LZMAWorker.support?binaryArraysWithWorker(r):Promise.resolve(binaryArrays(r))}var dequeuing=!1,queue=[];function dequeue(n){if(n===void 0&&(n=!1),!(!n&&dequeuing)){dequeuing=!0;var t=queue.shift();if(t){try{t()}catch(e){}AnimationFrameLoop.shared.add(function(){return dequeue(!0)},!0,2,-100)}else dequeuing=!1}}function delay(n){return new Promise(function(t,e){var r=function(){try{t(n())}catch(o){e(o)}};queue.push(r),AnimationFrameLoop.shared.add(function(){return dequeue()},!0,2,-100)})}function pick(n,t){for(var e={},r=0,o=t;r<o.length;r++){var s=o[r];s in n&&(e[s]=n[s])}return e}function omit(n,t){for(var e=__assign({},n),r=0,o=t;r<o.length;r++){var s=o[r];s in e&&delete e[s]}return e}var commonjsGlobal=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{},indexMinimal={},minimal$1={},aspromise=asPromise;function asPromise(n,t){for(var e=new Array(arguments.length-1),r=0,o=2,s=!0;o<arguments.length;)e[r++]=arguments[o++];return new Promise(function(l,c){e[r]=function(d){if(s)if(s=!1,d)c(d);else{for(var p=new Array(arguments.length-1),v=0;v<p.length;)p[v++]=arguments[v];l.apply(null,p)}};try{n.apply(t||null,e)}catch(f){s&&(s=!1,c(f))}})}var base64$1={};(function(n){var t=n;t.length=function(l){var c=l.length;if(!c)return 0;for(var f=0;--c%4>1&&l.charAt(c)==="=";)++f;return Math.ceil(l.length*3)/4-f};for(var e=new Array(64),r=new Array(123),o=0;o<64;)r[e[o]=o<26?o+65:o<52?o+71:o<62?o-4:o-59|43]=o++;t.encode=function(l,c,f){for(var d=null,p=[],v=0,g=0,h;c<f;){var m=l[c++];switch(g){case 0:p[v++]=e[m>>2],h=(m&3)<<4,g=1;break;case 1:p[v++]=e[h|m>>4],h=(m&15)<<2,g=2;break;case 2:p[v++]=e[h|m>>6],p[v++]=e[m&63],g=0;break}v>8191&&((d||(d=[])).push(String.fromCharCode.apply(String,p)),v=0)}return g&&(p[v++]=e[h],p[v++]=61,g===1&&(p[v++]=61)),d?(v&&d.push(String.fromCharCode.apply(String,p.slice(0,v))),d.join("")):String.fromCharCode.apply(String,p.slice(0,v))};var s="invalid encoding";t.decode=function(l,c,f){for(var d=f,p=0,v,g=0;g<l.length;){var h=l.charCodeAt(g++);if(h===61&&p>1)break;if((h=r[h])===void 0)throw Error(s);switch(p){case 0:v=h,p=1;break;case 1:c[f++]=v<<2|(h&48)>>4,v=h,p=2;break;case 2:c[f++]=(v&15)<<4|(h&60)>>2,v=h,p=3;break;case 3:c[f++]=(v&3)<<6|h,p=0;break}}if(p===1)throw Error(s);return f-d},t.test=function(l){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(l)}})(base64$1);var eventemitter=EventEmitter;function EventEmitter(){this._listeners={}}EventEmitter.prototype.on=function(t,e,r){return(this._listeners[t]||(this._listeners[t]=[])).push({fn:e,ctx:r||this}),this},EventEmitter.prototype.off=function(t,e){if(t===void 0)this._listeners={};else if(e===void 0)this._listeners[t]=[];else for(var r=this._listeners[t],o=0;o<r.length;)r[o].fn===e?r.splice(o,1):++o;return this},EventEmitter.prototype.emit=function(t){var e=this._listeners[t];if(e){for(var r=[],o=1;o<arguments.length;)r.push(arguments[o++]);for(o=0;o<e.length;)e[o].fn.apply(e[o++].ctx,r)}return this};var float=factory(factory);function factory(n){return typeof Float32Array!="undefined"?function(){var t=new Float32Array([-0]),e=new Uint8Array(t.buffer),r=e[3]===128;function o(c,f,d){t[0]=c,f[d]=e[0],f[d+1]=e[1],f[d+2]=e[2],f[d+3]=e[3]}function s(c,f,d){t[0]=c,f[d]=e[3],f[d+1]=e[2],f[d+2]=e[1],f[d+3]=e[0]}n.writeFloatLE=r?o:s,n.writeFloatBE=r?s:o;function u(c,f){return e[0]=c[f],e[1]=c[f+1],e[2]=c[f+2],e[3]=c[f+3],t[0]}function l(c,f){return e[3]=c[f],e[2]=c[f+1],e[1]=c[f+2],e[0]=c[f+3],t[0]}n.readFloatLE=r?u:l,n.readFloatBE=r?l:u}():function(){function t(r,o,s,u){var l=o<0?1:0;if(l&&(o=-o),o===0)r(1/o>0?0:2147483648,s,u);else if(isNaN(o))r(2143289344,s,u);else if(o>34028234663852886e22)r((l<<31|2139095040)>>>0,s,u);else if(o<11754943508222875e-54)r((l<<31|Math.round(o/1401298464324817e-60))>>>0,s,u);else{var c=Math.floor(Math.log(o)/Math.LN2),f=Math.round(o*Math.pow(2,-c)*8388608)&8388607;r((l<<31|c+127<<23|f)>>>0,s,u)}}n.writeFloatLE=t.bind(null,writeUintLE),n.writeFloatBE=t.bind(null,writeUintBE);function e(r,o,s){var u=r(o,s),l=(u>>31)*2+1,c=u>>>23&255,f=u&8388607;return c===255?f?NaN:l*(1/0):c===0?l*1401298464324817e-60*f:l*Math.pow(2,c-150)*(f+8388608)}n.readFloatLE=e.bind(null,readUintLE),n.readFloatBE=e.bind(null,readUintBE)}(),typeof Float64Array!="undefined"?function(){var t=new Float64Array([-0]),e=new Uint8Array(t.buffer),r=e[7]===128;function o(c,f,d){t[0]=c,f[d]=e[0],f[d+1]=e[1],f[d+2]=e[2],f[d+3]=e[3],f[d+4]=e[4],f[d+5]=e[5],f[d+6]=e[6],f[d+7]=e[7]}function s(c,f,d){t[0]=c,f[d]=e[7],f[d+1]=e[6],f[d+2]=e[5],f[d+3]=e[4],f[d+4]=e[3],f[d+5]=e[2],f[d+6]=e[1],f[d+7]=e[0]}n.writeDoubleLE=r?o:s,n.writeDoubleBE=r?s:o;function u(c,f){return e[0]=c[f],e[1]=c[f+1],e[2]=c[f+2],e[3]=c[f+3],e[4]=c[f+4],e[5]=c[f+5],e[6]=c[f+6],e[7]=c[f+7],t[0]}function l(c,f){return e[7]=c[f],e[6]=c[f+1],e[5]=c[f+2],e[4]=c[f+3],e[3]=c[f+4],e[2]=c[f+5],e[1]=c[f+6],e[0]=c[f+7],t[0]}n.readDoubleLE=r?u:l,n.readDoubleBE=r?l:u}():function(){function t(r,o,s,u,l,c){var f=u<0?1:0;if(f&&(u=-u),u===0)r(0,l,c+o),r(1/u>0?0:2147483648,l,c+s);else if(isNaN(u))r(0,l,c+o),r(2146959360,l,c+s);else if(u>17976931348623157e292)r(0,l,c+o),r((f<<31|2146435072)>>>0,l,c+s);else{var d;if(u<22250738585072014e-324)d=u/5e-324,r(d>>>0,l,c+o),r((f<<31|d/4294967296)>>>0,l,c+s);else{var p=Math.floor(Math.log(u)/Math.LN2);p===1024&&(p=1023),d=u*Math.pow(2,-p),r(d*4503599627370496>>>0,l,c+o),r((f<<31|p+1023<<20|d*1048576&1048575)>>>0,l,c+s)}}}n.writeDoubleLE=t.bind(null,writeUintLE,0,4),n.writeDoubleBE=t.bind(null,writeUintBE,4,0);function e(r,o,s,u,l){var c=r(u,l+o),f=r(u,l+s),d=(f>>31)*2+1,p=f>>>20&2047,v=4294967296*(f&1048575)+c;return p===2047?v?NaN:d*(1/0):p===0?d*5e-324*v:d*Math.pow(2,p-1075)*(v+4503599627370496)}n.readDoubleLE=e.bind(null,readUintLE,0,4),n.readDoubleBE=e.bind(null,readUintBE,4,0)}(),n}function writeUintLE(n,t,e){t[e]=n&255,t[e+1]=n>>>8&255,t[e+2]=n>>>16&255,t[e+3]=n>>>24}function writeUintBE(n,t,e){t[e]=n>>>24,t[e+1]=n>>>16&255,t[e+2]=n>>>8&255,t[e+3]=n&255}function readUintLE(n,t){return(n[t]|n[t+1]<<8|n[t+2]<<16|n[t+3]<<24)>>>0}function readUintBE(n,t){return(n[t]<<24|n[t+1]<<16|n[t+2]<<8|n[t+3])>>>0}var inquire_1=inquire;function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(n){}return null}var utf8$2={};(function(n){var t=n;t.length=function(r){for(var o=0,s=0,u=0;u<r.length;++u)s=r.charCodeAt(u),s<128?o+=1:s<2048?o+=2:(s&64512)===55296&&(r.charCodeAt(u+1)&64512)===56320?(++u,o+=4):o+=3;return o},t.read=function(r,o,s){var u=s-o;if(u<1)return"";for(var l=null,c=[],f=0,d;o<s;)d=r[o++],d<128?c[f++]=d:d>191&&d<224?c[f++]=(d&31)<<6|r[o++]&63:d>239&&d<365?(d=((d&7)<<18|(r[o++]&63)<<12|(r[o++]&63)<<6|r[o++]&63)-65536,c[f++]=55296+(d>>10),c[f++]=56320+(d&1023)):c[f++]=(d&15)<<12|(r[o++]&63)<<6|r[o++]&63,f>8191&&((l||(l=[])).push(String.fromCharCode.apply(String,c)),f=0);return l?(f&&l.push(String.fromCharCode.apply(String,c.slice(0,f))),l.join("")):String.fromCharCode.apply(String,c.slice(0,f))},t.write=function(r,o,s){for(var u=s,l,c,f=0;f<r.length;++f)l=r.charCodeAt(f),l<128?o[s++]=l:l<2048?(o[s++]=l>>6|192,o[s++]=l&63|128):(l&64512)===55296&&((c=r.charCodeAt(f+1))&64512)===56320?(l=65536+((l&1023)<<10)+(c&1023),++f,o[s++]=l>>18|240,o[s++]=l>>12&63|128,o[s++]=l>>6&63|128,o[s++]=l&63|128):(o[s++]=l>>12|224,o[s++]=l>>6&63|128,o[s++]=l&63|128);return s-u}})(utf8$2);var pool_1=pool;function pool(n,t,e){var r=e||8192,o=r>>>1,s=null,u=r;return function(c){if(c<1||c>o)return n(c);u+c>r&&(s=n(r),u=0);var f=t.call(s,u,u+=c);return u&7&&(u=(u|7)+1),f}}var longbits,hasRequiredLongbits;function requireLongbits(){if(hasRequiredLongbits)return longbits;hasRequiredLongbits=1,longbits=t;var n=requireMinimal();function t(s,u){this.lo=s>>>0,this.hi=u>>>0}var e=t.zero=new t(0,0);e.toNumber=function(){return 0},e.zzEncode=e.zzDecode=function(){return this},e.length=function(){return 1};var r=t.zeroHash="\0\0\0\0\0\0\0\0";t.fromNumber=function(u){if(u===0)return e;var l=u<0;l&&(u=-u);var c=u>>>0,f=(u-c)/4294967296>>>0;return l&&(f=~f>>>0,c=~c>>>0,++c>4294967295&&(c=0,++f>4294967295&&(f=0))),new t(c,f)},t.from=function(u){if(typeof u=="number")return t.fromNumber(u);if(n.isString(u))if(n.Long)u=n.Long.fromString(u);else return t.fromNumber(parseInt(u,10));return u.low||u.high?new t(u.low>>>0,u.high>>>0):e},t.prototype.toNumber=function(u){if(!u&&this.hi>>>31){var l=~this.lo+1>>>0,c=~this.hi>>>0;return l||(c=c+1>>>0),-(l+c*4294967296)}return this.lo+this.hi*4294967296},t.prototype.toLong=function(u){return n.Long?new n.Long(this.lo|0,this.hi|0,!!u):{low:this.lo|0,high:this.hi|0,unsigned:!!u}};var o=String.prototype.charCodeAt;return t.fromHash=function(u){return u===r?e:new t((o.call(u,0)|o.call(u,1)<<8|o.call(u,2)<<16|o.call(u,3)<<24)>>>0,(o.call(u,4)|o.call(u,5)<<8|o.call(u,6)<<16|o.call(u,7)<<24)>>>0)},t.prototype.toHash=function(){return String.fromCharCode(this.lo&255,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,this.hi&255,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},t.prototype.zzEncode=function(){var u=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^u)>>>0,this.lo=(this.lo<<1^u)>>>0,this},t.prototype.zzDecode=function(){var u=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^u)>>>0,this.hi=(this.hi>>>1^u)>>>0,this},t.prototype.length=function(){var u=this.lo,l=(this.lo>>>28|this.hi<<4)>>>0,c=this.hi>>>24;return c===0?l===0?u<16384?u<128?1:2:u<2097152?3:4:l<16384?l<128?5:6:l<2097152?7:8:c<128?9:10},longbits}var hasRequiredMinimal;function requireMinimal(){return hasRequiredMinimal||(hasRequiredMinimal=1,function(n){var t=n;t.asPromise=aspromise,t.base64=base64$1,t.EventEmitter=eventemitter,t.float=float,t.inquire=inquire_1,t.utf8=utf8$2,t.pool=pool_1,t.LongBits=requireLongbits(),t.isNode=!!(typeof commonjsGlobal!="undefined"&&commonjsGlobal&&commonjsGlobal.process&&commonjsGlobal.process.versions&&commonjsGlobal.process.versions.node),t.global=t.isNode&&commonjsGlobal||typeof window!="undefined"&&window||typeof self!="undefined"&&self||commonjsGlobal,t.emptyArray=Object.freeze?Object.freeze([]):[],t.emptyObject=Object.freeze?Object.freeze({}):{},t.isInteger=Number.isInteger||function(s){return typeof s=="number"&&isFinite(s)&&Math.floor(s)===s},t.isString=function(s){return typeof s=="string"||s instanceof String},t.isObject=function(s){return s&&typeof s=="object"},t.isset=t.isSet=function(s,u){var l=s[u];return l!=null&&s.hasOwnProperty(u)?typeof l!="object"||(Array.isArray(l)?l.length:Object.keys(l).length)>0:!1},t.Buffer=function(){try{var o=t.inquire("buffer").Buffer;return o.prototype.utf8Write?o:null}catch(s){return null}}(),t._Buffer_from=null,t._Buffer_allocUnsafe=null,t.newBuffer=function(s){return typeof s=="number"?t.Buffer?t._Buffer_allocUnsafe(s):new t.Array(s):t.Buffer?t._Buffer_from(s):typeof Uint8Array=="undefined"?s:new Uint8Array(s)},t.Array=typeof Uint8Array!="undefined"?Uint8Array:Array,t.Long=t.global.dcodeIO&&t.global.dcodeIO.Long||t.global.Long||t.inquire("long"),t.key2Re=/^true|false|0|1$/,t.key32Re=/^-?(?:0|[1-9][0-9]*)$/,t.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,t.longToHash=function(s){return s?t.LongBits.from(s).toHash():t.LongBits.zeroHash},t.longFromHash=function(s,u){var l=t.LongBits.fromHash(s);return t.Long?t.Long.fromBits(l.lo,l.hi,u):l.toNumber(!!u)};function e(o,s,u){for(var l=Object.keys(s),c=0;c<l.length;++c)(o[l[c]]===void 0||!u)&&(o[l[c]]=s[l[c]]);return o}t.merge=e,t.lcFirst=function(s){return s.charAt(0).toLowerCase()+s.substring(1)};function r(o){function s(u,l){if(!(this instanceof s))return new s(u,l);Object.defineProperty(this,"message",{get:function(){return u}}),Error.captureStackTrace?Error.captureStackTrace(this,s):Object.defineProperty(this,"stack",{value:new Error().stack||""}),l&&e(this,l)}return s.prototype=Object.create(Error.prototype,{constructor:{value:s,writable:!0,enumerable:!1,configurable:!0},name:{get:function(){return o},set:void 0,enumerable:!1,configurable:!0},toString:{value:function(){return this.name+": "+this.message},writable:!0,enumerable:!1,configurable:!0}}),s}t.newError=r,t.ProtocolError=r("ProtocolError"),t.oneOfGetter=function(s){for(var u={},l=0;l<s.length;++l)u[s[l]]=1;return function(){for(var c=Object.keys(this),f=c.length-1;f>-1;--f)if(u[c[f]]===1&&this[c[f]]!==void 0&&this[c[f]]!==null)return c[f]}},t.oneOfSetter=function(s){return function(u){for(var l=0;l<s.length;++l)s[l]!==u&&delete this[s[l]]}},t.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},t._configure=function(){var o=t.Buffer;if(!o){t._Buffer_from=t._Buffer_allocUnsafe=null;return}t._Buffer_from=o.from!==Uint8Array.from&&o.from||function(u,l){return new o(u,l)},t._Buffer_allocUnsafe=o.allocUnsafe||function(u){return new o(u)}}}(minimal$1)),minimal$1}var writer=Writer$1,util$4=requireMinimal(),BufferWriter$1,LongBits$1=util$4.LongBits,base64=util$4.base64,utf8$1=util$4.utf8;function Op(n,t,e){this.fn=n,this.len=t,this.next=void 0,this.val=e}function noop(){}function State(n){this.head=n.head,this.tail=n.tail,this.len=n.len,this.next=n.states}function Writer$1(){this.len=0,this.head=new Op(noop,0,0),this.tail=this.head,this.states=null}var create$1=function n(){return util$4.Buffer?function(){return(Writer$1.create=function(){return new BufferWriter$1})()}:function(){return new Writer$1}};Writer$1.create=create$1(),Writer$1.alloc=function n(t){return new util$4.Array(t)},util$4.Array!==Array&&(Writer$1.alloc=util$4.pool(Writer$1.alloc,util$4.Array.prototype.subarray)),Writer$1.prototype._push=function n(t,e,r){return this.tail=this.tail.next=new Op(t,e,r),this.len+=e,this};function writeByte(n,t,e){t[e]=n&255}function writeVarint32(n,t,e){for(;n>127;)t[e++]=n&127|128,n>>>=7;t[e]=n}function VarintOp(n,t){this.len=n,this.next=void 0,this.val=t}VarintOp.prototype=Object.create(Op.prototype),VarintOp.prototype.fn=writeVarint32,Writer$1.prototype.uint32=function n(t){return this.len+=(this.tail=this.tail.next=new VarintOp((t=t>>>0)<128?1:t<16384?2:t<2097152?3:t<268435456?4:5,t)).len,this},Writer$1.prototype.int32=function n(t){return t<0?this._push(writeVarint64,10,LongBits$1.fromNumber(t)):this.uint32(t)},Writer$1.prototype.sint32=function n(t){return this.uint32((t<<1^t>>31)>>>0)};function writeVarint64(n,t,e){for(;n.hi;)t[e++]=n.lo&127|128,n.lo=(n.lo>>>7|n.hi<<25)>>>0,n.hi>>>=7;for(;n.lo>127;)t[e++]=n.lo&127|128,n.lo=n.lo>>>7;t[e++]=n.lo}Writer$1.prototype.uint64=function n(t){var e=LongBits$1.from(t);return this._push(writeVarint64,e.length(),e)},Writer$1.prototype.int64=Writer$1.prototype.uint64,Writer$1.prototype.sint64=function n(t){var e=LongBits$1.from(t).zzEncode();return this._push(writeVarint64,e.length(),e)},Writer$1.prototype.bool=function n(t){return this._push(writeByte,1,t?1:0)};function writeFixed32(n,t,e){t[e]=n&255,t[e+1]=n>>>8&255,t[e+2]=n>>>16&255,t[e+3]=n>>>24}Writer$1.prototype.fixed32=function n(t){return this._push(writeFixed32,4,t>>>0)},Writer$1.prototype.sfixed32=Writer$1.prototype.fixed32,Writer$1.prototype.fixed64=function n(t){var e=LongBits$1.from(t);return this._push(writeFixed32,4,e.lo)._push(writeFixed32,4,e.hi)},Writer$1.prototype.sfixed64=Writer$1.prototype.fixed64,Writer$1.prototype.float=function n(t){return this._push(util$4.float.writeFloatLE,4,t)},Writer$1.prototype.double=function n(t){return this._push(util$4.float.writeDoubleLE,8,t)};var writeBytes=util$4.Array.prototype.set?function n(t,e,r){e.set(t,r)}:function n(t,e,r){for(var o=0;o<t.length;++o)e[r+o]=t[o]};Writer$1.prototype.bytes=function n(t){var e=t.length>>>0;if(!e)return this._push(writeByte,1,0);if(util$4.isString(t)){var r=Writer$1.alloc(e=base64.length(t));base64.decode(t,r,0),t=r}return this.uint32(e)._push(writeBytes,e,t)},Writer$1.prototype.string=function n(t){var e=utf8$1.length(t);return e?this.uint32(e)._push(utf8$1.write,e,t):this._push(writeByte,1,0)},Writer$1.prototype.fork=function n(){return this.states=new State(this),this.head=this.tail=new Op(noop,0,0),this.len=0,this},Writer$1.prototype.reset=function n(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new Op(noop,0,0),this.len=0),this},Writer$1.prototype.ldelim=function n(){var t=this.head,e=this.tail,r=this.len;return this.reset().uint32(r),r&&(this.tail.next=t.next,this.tail=e,this.len+=r),this},Writer$1.prototype.finish=function n(){for(var t=this.head.next,e=this.constructor.alloc(this.len),r=0;t;)t.fn(t.val,e,r),r+=t.len,t=t.next;return e},Writer$1._configure=function(n){BufferWriter$1=n,Writer$1.create=create$1(),BufferWriter$1._configure()};var writer_buffer=BufferWriter,Writer=writer;(BufferWriter.prototype=Object.create(Writer.prototype)).constructor=BufferWriter;var util$3=requireMinimal();function BufferWriter(){Writer.call(this)}BufferWriter._configure=function(){BufferWriter.alloc=util$3._Buffer_allocUnsafe,BufferWriter.writeBytesBuffer=util$3.Buffer&&util$3.Buffer.prototype instanceof Uint8Array&&util$3.Buffer.prototype.set.name==="set"?function(t,e,r){e.set(t,r)}:function(t,e,r){if(t.copy)t.copy(e,r,0,t.length);else for(var o=0;o<t.length;)e[r++]=t[o++]}},BufferWriter.prototype.bytes=function n(t){util$3.isString(t)&&(t=util$3._Buffer_from(t,"base64"));var e=t.length>>>0;return this.uint32(e),e&&this._push(BufferWriter.writeBytesBuffer,e,t),this};function writeStringBuffer(n,t,e){n.length<40?util$3.utf8.write(n,t,e):t.utf8Write?t.utf8Write(n,e):t.write(n,e)}BufferWriter.prototype.string=function n(t){var e=util$3.Buffer.byteLength(t);return this.uint32(e),e&&this._push(writeStringBuffer,e,t),this},BufferWriter._configure();var reader=Reader$1,util$2=requireMinimal(),BufferReader$1,LongBits=util$2.LongBits,utf8=util$2.utf8;function indexOutOfRange(n,t){return RangeError("index out of range: "+n.pos+" + "+(t||1)+" > "+n.len)}function Reader$1(n){this.buf=n,this.pos=0,this.len=n.length}var create_array=typeof Uint8Array!="undefined"?function n(t){if(t instanceof Uint8Array||Array.isArray(t))return new Reader$1(t);throw Error("illegal buffer")}:function n(t){if(Array.isArray(t))return new Reader$1(t);throw Error("illegal buffer")},create=function n(){return util$2.Buffer?function(e){return(Reader$1.create=function(o){return util$2.Buffer.isBuffer(o)?new BufferReader$1(o):create_array(o)})(e)}:create_array};Reader$1.create=create(),Reader$1.prototype._slice=util$2.Array.prototype.subarray||util$2.Array.prototype.slice,Reader$1.prototype.uint32=function n(){var t=4294967295;return function(){if(t=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(t=(t|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(t=(t|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(t=(t|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(t=(t|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return t;if((this.pos+=5)>this.len)throw this.pos=this.len,indexOutOfRange(this,10);return t}}(),Reader$1.prototype.int32=function n(){return this.uint32()|0},Reader$1.prototype.sint32=function n(){var t=this.uint32();return t>>>1^-(t&1)|0};function readLongVarint(){var n=new LongBits(0,0),t=0;if(this.len-this.pos>4){for(;t<4;++t)if(n.lo=(n.lo|(this.buf[this.pos]&127)<<t*7)>>>0,this.buf[this.pos++]<128)return n;if(n.lo=(n.lo|(this.buf[this.pos]&127)<<28)>>>0,n.hi=(n.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return n;t=0}else{for(;t<3;++t){if(this.pos>=this.len)throw indexOutOfRange(this);if(n.lo=(n.lo|(this.buf[this.pos]&127)<<t*7)>>>0,this.buf[this.pos++]<128)return n}return n.lo=(n.lo|(this.buf[this.pos++]&127)<<t*7)>>>0,n}if(this.len-this.pos>4){for(;t<5;++t)if(n.hi=(n.hi|(this.buf[this.pos]&127)<<t*7+3)>>>0,this.buf[this.pos++]<128)return n}else for(;t<5;++t){if(this.pos>=this.len)throw indexOutOfRange(this);if(n.hi=(n.hi|(this.buf[this.pos]&127)<<t*7+3)>>>0,this.buf[this.pos++]<128)return n}throw Error("invalid varint encoding")}Reader$1.prototype.bool=function n(){return this.uint32()!==0};function readFixed32_end(n,t){return(n[t-4]|n[t-3]<<8|n[t-2]<<16|n[t-1]<<24)>>>0}Reader$1.prototype.fixed32=function n(){if(this.pos+4>this.len)throw indexOutOfRange(this,4);return readFixed32_end(this.buf,this.pos+=4)},Reader$1.prototype.sfixed32=function n(){if(this.pos+4>this.len)throw indexOutOfRange(this,4);return readFixed32_end(this.buf,this.pos+=4)|0};function readFixed64(){if(this.pos+8>this.len)throw indexOutOfRange(this,8);return new LongBits(readFixed32_end(this.buf,this.pos+=4),readFixed32_end(this.buf,this.pos+=4))}Reader$1.prototype.float=function n(){if(this.pos+4>this.len)throw indexOutOfRange(this,4);var t=util$2.float.readFloatLE(this.buf,this.pos);return this.pos+=4,t},Reader$1.prototype.double=function n(){if(this.pos+8>this.len)throw indexOutOfRange(this,4);var t=util$2.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,t},Reader$1.prototype.bytes=function n(){var t=this.uint32(),e=this.pos,r=this.pos+t;if(r>this.len)throw indexOutOfRange(this,t);if(this.pos+=t,Array.isArray(this.buf))return this.buf.slice(e,r);if(e===r){var o=util$2.Buffer;return o?o.alloc(0):new this.buf.constructor(0)}return this._slice.call(this.buf,e,r)},Reader$1.prototype.string=function n(){var t=this.bytes();return utf8.read(t,0,t.length)},Reader$1.prototype.skip=function n(t){if(typeof t=="number"){if(this.pos+t>this.len)throw indexOutOfRange(this,t);this.pos+=t}else do if(this.pos>=this.len)throw indexOutOfRange(this);while(this.buf[this.pos++]&128);return this},Reader$1.prototype.skipType=function(n){switch(n){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(n=this.uint32()&7)!==4;)this.skipType(n);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+n+" at offset "+this.pos)}return this},Reader$1._configure=function(n){BufferReader$1=n,Reader$1.create=create(),BufferReader$1._configure();var t=util$2.Long?"toLong":"toNumber";util$2.merge(Reader$1.prototype,{int64:function(){return readLongVarint.call(this)[t](!1)},uint64:function(){return readLongVarint.call(this)[t](!0)},sint64:function(){return readLongVarint.call(this).zzDecode()[t](!1)},fixed64:function(){return readFixed64.call(this)[t](!0)},sfixed64:function(){return readFixed64.call(this)[t](!1)}})};var reader_buffer=BufferReader,Reader=reader;(BufferReader.prototype=Object.create(Reader.prototype)).constructor=BufferReader;var util$1=requireMinimal();function BufferReader(n){Reader.call(this,n)}BufferReader._configure=function(){util$1.Buffer&&(BufferReader.prototype._slice=util$1.Buffer.prototype.slice)},BufferReader.prototype.string=function n(){var t=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+t,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+t,this.len))},BufferReader._configure();var rpc={},service=Service,util=requireMinimal();(Service.prototype=Object.create(util.EventEmitter.prototype)).constructor=Service;function Service(n,t,e){if(typeof n!="function")throw TypeError("rpcImpl must be a function");util.EventEmitter.call(this),this.rpcImpl=n,this.requestDelimited=!!t,this.responseDelimited=!!e}Service.prototype.rpcCall=function n(t,e,r,o,s){if(!o)throw TypeError("request must be specified");var u=this;if(!s)return util.asPromise(n,u,t,e,r,o);if(!u.rpcImpl){setTimeout(function(){s(Error("already ended"))},0);return}try{return u.rpcImpl(t,e[u.requestDelimited?"encodeDelimited":"encode"](o).finish(),function(c,f){if(c)return u.emit("error",c,t),s(c);if(f===null){u.end(!0);return}if(!(f instanceof r))try{f=r[u.responseDelimited?"decodeDelimited":"decode"](f)}catch(d){return u.emit("error",d,t),s(d)}return u.emit("data",f,t),s(null,f)})}catch(l){u.emit("error",l,t),setTimeout(function(){s(l)},0);return}},Service.prototype.end=function n(t){return this.rpcImpl&&(t||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this},function(n){var t=n;t.Service=service}(rpc);var roots={};(function(n){var t=n;t.build="minimal",t.Writer=writer,t.BufferWriter=writer_buffer,t.Reader=reader,t.BufferReader=reader_buffer,t.util=requireMinimal(),t.rpc=rpc,t.roots=roots,t.configure=e;function e(){t.util._configure(),t.Writer._configure(t.BufferWriter),t.Reader._configure(t.BufferReader)}e()})(indexMinimal);var minimal=indexMinimal;const $Reader$1=minimal.Reader,$util$1=minimal.util,$root$1=minimal.roots["@REALSEE/FIVE:five/loaders/model/parsers/protobuf/pbm.proto"]||(minimal.roots["@REALSEE/FIVE:five/loaders/model/parsers/protobuf/pbm.proto"]={}),Model$2=$root$1.Model=(()=>{function n(t){if(this.chunks=[],t)for(let e=Object.keys(t),r=0;r<e.length;++r)t[e[r]]!=null&&(this[e[r]]=t[e[r]])}return n.prototype.chunks=$util$1.emptyArray,n.prototype.createAt=$util$1.Long?$util$1.Long.fromBits(0,0,!0):0,n.prototype.description="",n.decode=function(e,r){e instanceof $Reader$1||(e=$Reader$1.create(e));let o=r===void 0?e.len:e.pos+r,s=new $root$1.Model;for(;e.pos<o;){let u=e.uint32();switch(u>>>3){case 1:{s.chunks&&s.chunks.length||(s.chunks=[]),s.chunks.push($root$1.Chunk.decode(e,e.uint32()));break}case 2:{s.createAt=e.uint64();break}case 3:{s.description=e.string();break}default:e.skipType(u&7);break}}return s},n.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/Model"},n})();$root$1.Chunk=(()=>{function n(t){if(t)for(let e=Object.keys(t),r=0;r<e.length;++r)t[e[r]]!=null&&(this[e[r]]=t[e[r]])}return n.prototype.vertices=null,n.prototype.faces=null,n.prototype.name="",n.prototype.texture="",n.decode=function(e,r){e instanceof $Reader$1||(e=$Reader$1.create(e));let o=r===void 0?e.len:e.pos+r,s=new $root$1.Chunk;for(;e.pos<o;){let u=e.uint32();switch(u>>>3){case 1:{s.vertices=$root$1.Vertices.decode(e,e.uint32());break}case 2:{s.faces=$root$1.Faces.decode(e,e.uint32());break}case 3:{s.name=e.string();break}case 4:{s.texture=e.string();break}default:e.skipType(u&7);break}}if(!s.hasOwnProperty("vertices"))throw $util$1.ProtocolError("missing required 'vertices'",{instance:s});if(!s.hasOwnProperty("faces"))throw $util$1.ProtocolError("missing required 'faces'",{instance:s});if(!s.hasOwnProperty("name"))throw $util$1.ProtocolError("missing required 'name'",{instance:s});return s},n.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/Chunk"},n})(),$root$1.Vertices=(()=>{function n(t){if(this.xyz=[],this.uvs=[],this.marks=[],t)for(let e=Object.keys(t),r=0;r<e.length;++r)t[e[r]]!=null&&(this[e[r]]=t[e[r]])}return n.prototype.xyz=$util$1.emptyArray,n.prototype.uvs=$util$1.emptyArray,n.prototype.marks=$util$1.emptyArray,n.decode=function(e,r){e instanceof $Reader$1||(e=$Reader$1.create(e));let o=r===void 0?e.len:e.pos+r,s=new $root$1.Vertices;for(;e.pos<o;){let u=e.uint32();switch(u>>>3){case 1:{if(s.xyz&&s.xyz.length||(s.xyz=[]),(u&7)===2){let l=e.uint32()+e.pos;for(;e.pos<l;)s.xyz.push(e.float())}else s.xyz.push(e.float());break}case 2:{if(s.uvs&&s.uvs.length||(s.uvs=[]),(u&7)===2){let l=e.uint32()+e.pos;for(;e.pos<l;)s.uvs.push(e.float())}else s.uvs.push(e.float());break}case 3:{if(s.marks&&s.marks.length||(s.marks=[]),(u&7)===2){let l=e.uint32()+e.pos;for(;e.pos<l;)s.marks.push(e.int32())}else s.marks.push(e.int32());break}default:e.skipType(u&7);break}}return s},n.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/Vertices"},n})(),$root$1.Faces=(()=>{function n(t){if(this.indices=[],this.normals=[],t)for(let e=Object.keys(t),r=0;r<e.length;++r)t[e[r]]!=null&&(this[e[r]]=t[e[r]])}return n.prototype.indices=$util$1.emptyArray,n.prototype.normals=$util$1.emptyArray,n.decode=function(e,r){e instanceof $Reader$1||(e=$Reader$1.create(e));let o=r===void 0?e.len:e.pos+r,s=new $root$1.Faces;for(;e.pos<o;){let u=e.uint32();switch(u>>>3){case 1:{if(s.indices&&s.indices.length||(s.indices=[]),(u&7)===2){let l=e.uint32()+e.pos;for(;e.pos<l;)s.indices.push(e.uint32())}else s.indices.push(e.uint32());break}case 2:{if(s.normals&&s.normals.length||(s.normals=[]),(u&7)===2){let l=e.uint32()+e.pos;for(;e.pos<l;)s.normals.push(e.float())}else s.normals.push(e.float());break}default:e.skipType(u&7);break}}return s},n.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/Faces"},n})(),$root$1.VertexMark=(()=>{const n={},t=Object.create(n);return t[n[0]="VERTEX_MARK_UNSPECIFIED"]=0,t[n[1]="VERTEX_MARK_ROOF"]=1,t})();function loadPbm(n,t){var e,r,o,s;t===void 0&&(t={});var u=(e=t.fetcher)!==null&&e!==void 0?e:new Fetcher({allowHosts:["*"]}),l={byteLength:0},c=autoRestImageOptionsByTextureLength((r=t.textureOptions)!==null&&r!==void 0?r:{},(s=(o=t.textureArray)===null||o===void 0?void 0:o.length)!==null&&s!==void 0?s:0),f={};if(t.textureArray)for(var d=0,p=t.textureArray;d<p.length;d++){var v=p[d];f[v]=loadTexture$1(v,c,u)}return Promise.resolve().then(function(){return u.ajax(n,{responseType:"arraybuffer"})}).then(function(g){return l.byteLength=g.body.byteLength,delay(function(){var h=new Uint8Array(g.body);return Model$2.decode(h)})}).then(function(g){return delay(function(){var h,m;return parse$4(g,(h=t.textureBaseUri)!==null&&h!==void 0?h:function(){var y=n.lastIndexOf("/");if(y>=0){var A=n.slice(0,y)+"/";return/\/model\/$/.test(A)&&(A=A.replace(/\/model\/$/,"/materials/")),A}return""}(),((m=t.textureArray)!==null&&m!==void 0?m:[]).slice(),c,f,u)})}).then(function(g){var h=new THREE__namespace.Group;h.matrixAutoUpdate=!1,h.matrix.compose(h.position,h.quaternion,h.scale),h.name=n;for(var m=0,y=g.objects;m<y.length;m++){var A=y[m];h.add(A)}return{type:"pbm",upAxis:"Z",uri:n,byteLength:l.byteLength,scene:h,textures:g.textures,dispose:function(){return g.dispose()}}})}function parseFloorName(n){var t=n.match(/(group|floor)-?(\d+)/);return t?parseInt(t[2],10):0}function parseChunkName(n){var t=n.match(/(chunk)-?(\d+)/);return t?parseInt(t[2],10):0}function parseSubName(n){var t=n.match(/(sub)-?(\d+)/);return t?parseInt(t[2],10):0}function chunkOrder(n){var t=parseFloorName(n.name),e=parseChunkName(n.name),r=parseSubName(n.name);return t*1e6+e*1e3+r}function parsePBMModel(n){for(var t,e,r,o=typeof n.createAt=="number"?n.createAt:0,s=(t=n.description)!==null&&t!==void 0?t:"",u=[],l=!0,c=!0,f=0,d=n.chunks;f<d.length;f++){var p=d[f];if(!p.vertices.marks||p.vertices.marks.length===0){c=!1;break}}for(var v=0,g=n.chunks;v<g.length;v++){var p=g[v];if(!p.faces.normals||p.faces.normals.length===0){l=!1;break}}for(var h=n.chunks.sort(function(ne,pe){return chunkOrder(ne)-chunkOrder(pe)}),m=[],y=0,A=h;y<A.length;y++){var p=A[y],E=parseFloorName(p.name);m[E]||(m[E]=[]),m[E].push(p)}for(var b=0;b<m.length;b++){var T=m[b];if(T)if(l){for(var _=0,R=0;R<T.length;R++){var p=T[R];_+=p.faces.indices.length}for(var S=new Float32Array(_*3),M=new Float32Array(_*2),B=new Float32Array(_*3),H=c?new Float32Array(_):void 0,w=[],C=[1/0,1/0,1/0,-1/0,-1/0,-1/0],L=0,I=0;I<T.length;I++){for(var F=[1/0,1/0,1/0,-1/0,-1/0,-1/0],p=T[I],k=p.vertices.xyz,N=p.vertices.uvs,D=p.faces.indices,U=p.faces.normals,z=p.vertices.marks,G=D.length,R=0;R<G;R++){var q=D[R],K=S[L*3+R*3]=k[q*3],j=S[L*3+R*3+1]=k[q*3+1],W=S[L*3+R*3+2]=k[q*3+2];H&&(H[L+R]=z[q]),M[L*2+R*2]=N[q*2],M[L*2+R*2+1]=N[q*2+1];var X=Math.floor(R/3)*3;B[L*3+R*3]=U[X],B[L*3+R*3+1]=U[X+1],B[L*3+R*3+2]=U[X+2],K<F[0]&&(F[0]=K),j<F[1]&&(F[1]=j),W<F[2]&&(F[2]=W),K>F[3]&&(F[3]=K),j>F[4]&&(F[4]=j),W>F[5]&&(F[5]=W)}F[0]<C[0]&&(C[0]=F[0]),F[1]<C[1]&&(C[1]=F[1]),F[2]<C[2]&&(C[2]=F[2]),F[3]>C[3]&&(C[3]=F[3]),F[4]>C[4]&&(C[4]=F[4]),F[5]>C[5]&&(C[5]=F[5]),w.push({materialIndex:I,name:p.name,chunkName:parseChunkName(p.name),start:L,count:p.faces.indices.length,texture:(e=p.texture)!==null&&e!==void 0?e:void 0}),L+=G}var ee={createAt:o,description:s,vertices:S,uvs:M,normals:B,masks:H,indices:null,floorIndex:b,groups:w,extents:C};u.push(ee)}else{for(var _=0,$=0,R=0;R<T.length;R++){var p=T[R];$+=p.vertices.xyz.length/3,_+=p.faces.indices.length}for(var S=new Float32Array($*3),M=new Float32Array($*2),B=void 0,re=new Float32Array($),ie=new Uint32Array(_),H=c?new Float32Array(_):void 0,w=[],C=[1/0,1/0,1/0,-1/0,-1/0,-1/0],se=0,L=0,I=0;I<T.length;I++){for(var F=[1/0,1/0,1/0,-1/0,-1/0,-1/0],p=T[I],k=p.vertices.xyz,ae=p.vertices.marks,N=p.vertices.uvs,D=p.faces.indices,fe=k.length/3,G=D.length,R=0;R<fe;R++){var K=S[L*3+R*3]=k[R*3],j=S[L*3+R*3+1]=k[R*3+1],W=S[L*3+R*3+2]=k[R*3+2];H&&(H[L+R]=ae[R]),M[L*2+R*2]=N[R*2],M[L*2+R*2+1]=N[R*2+1],re[L+R]=b,K<F[0]&&(F[0]=K),j<F[1]&&(F[1]=j),W<F[2]&&(F[2]=W),K>F[3]&&(F[3]=K),j>F[4]&&(F[4]=j),W>F[5]&&(F[5]=W)}F[0]<C[0]&&(C[0]=F[0]),F[1]<C[1]&&(C[1]=F[1]),F[2]<C[2]&&(C[2]=F[2]),F[3]>C[3]&&(C[3]=F[3]),F[4]>C[4]&&(C[4]=F[4]),F[5]>C[5]&&(C[5]=F[5]);for(var R=0;R<G;R++)ie[se+R]=L+D[R];w.push({materialIndex:I,name:p.name,chunkName:parseChunkName(p.name),start:se,count:p.faces.indices.length,texture:(r=p.texture)!==null&&r!==void 0?r:void 0}),L+=fe,se+=G}var ee={createAt:o,description:s,vertices:S,uvs:M,normals:B,masks:H,indices:ie,floorIndex:b,groups:w,extents:C};u.push(ee)}}return u}function loadTexture$1(n,t,e){var r=__assign({key:"texture.pbm"},pick(t,["format","quality","size","sharpen","mappings"])),o=new TextureLoader,s=o.loadTexture(n,{imageURL:{transform:t.transform,options:r},encoding:THREE__namespace.sRGBEncoding,wrapS:THREE__namespace.ClampToEdgeWrapping,wrapT:THREE__namespace.ClampToEdgeWrapping,minFilter:THREE__namespace.LinearFilter,maxSize:typeof r.size=="number"?new THREE__namespace.Vector2(r.size,r.size):void 0,fetcher:e}).then(function(u){var l=u.body;return l.needsUpdate=!0,l});return Object.assign(s,{url:n,textureOptions:t})}function parse$4(n,t,e,r,o,s){o===void 0&&(o={});for(var u=parsePBMModel(n),l=0,c="",f=[],d={},p=new Set,v=0,g=u;v<g.length;v++){var h=g[v],m=h.createAt,y=h.description,A=h.vertices,E=h.masks,b=h.uvs,T=h.normals,_=h.indices,R=h.floorIndex,S=h.groups,M=h.extents,B=new THREE__namespace.Box3;B.min.x=M[0],B.min.y=M[1],B.min.z=M[2],B.max.x=M[3],B.max.y=M[4],B.max.z=M[5];var H=new THREE__namespace.BufferGeometry;H.setAttribute("position",new THREE__namespace.BufferAttribute(A,3)),H.setAttribute("uv",new THREE__namespace.BufferAttribute(b,2)),T&&H.setAttribute("normal",new THREE__namespace.BufferAttribute(T,3)),E&&H.setAttribute("mask",new THREE__namespace.BufferAttribute(E,1)),_&&H.setIndex(new THREE__namespace.BufferAttribute(_,1)),H.boundingBox=B,H.boundingSphere=B.getBoundingSphere(new THREE__namespace.Sphere);for(var w=0,C=S;w<C.length;w++){var L=C[w];H.addGroup(L.start,L.count,L.materialIndex)}p.add(H);for(var I=[],F=0,k=S;F<k.length;F++){var L=k[F],N=e[L.chunkName]||(L.texture?pathJoin(t||"",L.texture):void 0),D=new PBMMeshMaterial("basic");D.floor=R,H.attributes.normal===void 0&&(D.flatShading=!0),H.attributes.mask&&(D.defines.USE_VERTEX_MARK=!0),I.push(D),N?d[N]?d[N].push(D):d[N]=[D]:D.color=new THREE__namespace.Color(16777215),p.add(D),D.refreshUniforms()}var U=new PBMMesh(H,I);U.name="model_floor_"+R,U.userData.createAt=m,U.userData.description=y,U.matrix.compose(U.position,U.quaternion,U.scale),U.matrixAutoUpdate=!1,U.frustumCulled=!1,l=m,c=y,f.push(U)}var z=function(G){G=autoRestImageOptionsByTextureLength(G,e.length);for(var q=[],K=function(ee){var $=null;ee in o&&($=o[ee]),$||($=loadTexture$1(ee,G,s)),q.push($.then(function(re){for(var ie=0,se=d[ee];ie<se.length;ie++){var ae=se[ie];ae.map&&(p.delete(ae.map),ae.map.dispose()),ae.map=re,ae.refreshUniforms(),p.add(re)}return re}).catch(function(){for(var re=0,ie=d[ee];re<ie.length;re++){var se=ie[re];se.map&&(p.delete(se.map),se.map.dispose()),se.map=null,se.color=new THREE__namespace.Color(16777215),se.refreshUniforms()}return null}))},j=0,W=Object.keys(d);j<W.length;j++){var X=W[j];K(X)}for(var X in o)delete o[X];return Promise.all(q).then(function(ee){return ee.filter(function($){return $})})};return z(r).then(function(G){return{createAt:l,description:c,objects:f,textures:G,dispose:function(){p.forEach(function(q){q.dispose()}),p.clear()}}})}function autoRestImageOptionsByTextureLength(n,t){return n=Object.assign({},n),n.autoResize!==!1&&(t>96?n.size=Math.min(n.size||1/0,100):t>48?n.size=Math.min(n.size||1/0,200):t>24?n.size=Math.min(n.size||1/0,400):t>22?n.size=Math.min(n.size||1/0,800):t>5&&(n.size=Math.min(n.size||1/0,1024))),n}function loadAt3d(n,t){var e,r,o,s;t===void 0&&(t={});var u=(e=t.fetcher)!==null&&e!==void 0?e:new Fetcher({allowHosts:["*"]}),l={byteLength:0},c=autoRestImageOptionsByTextureLength((r=t.textureOptions)!==null&&r!==void 0?r:{},(s=(o=t.textureArray)===null||o===void 0?void 0:o.length)!==null&&s!==void 0?s:0),f={};if(t.textureArray)for(var d=0,p=t.textureArray;d<p.length;d++){var v=p[d];f[v]=loadTexture$1(v,c,u)}return Promise.resolve().then(function(){return u.ajax(n,{responseType:"arraybuffer"})}).then(function(g){return lzma(g.body)}).then(function(g){return delay(function(){for(var h,m={chunks:[],createAt:void 0,description:void 0},y=0,A=g;y<A.length;y++){var E=A[y],b=Model$2.decode(E);b.chunks.length&&((h=m.chunks).push.apply(h,b.chunks),m.createAt=b.createAt,m.description=b.description)}return m})}).then(function(g){return delay(function(){var h,m,y;return parse$4(g,(h=t.textureBaseUri)!==null&&h!==void 0?h:function(){var A=n.lastIndexOf("/");if(A>=0){var E=n.slice(0,A)+"/";return/\/model\/$/.test(E)&&(E=E.replace(/\/model\/$/,"/materials/")),E}return""}(),((m=t.textureArray)!==null&&m!==void 0?m:[]).slice(),(y=t.textureOptions)!==null&&y!==void 0?y:{},f,u)})}).then(function(g){var h=new THREE__namespace.Group;h.name=n;for(var m=0,y=g.objects;m<y.length;m++){var A=y[m];h.add(A)}return{type:"at3d",upAxis:"Z",uri:n,byteLength:l.byteLength,scene:h,textures:g.textures,dispose:function(){return g.dispose()}}})}const $Reader=minimal.Reader,$util=minimal.util,$root=minimal.roots["@REALSEE/FIVE:five/loaders/model/parsers/protobuf/dome.proto"]||(minimal.roots["@REALSEE/FIVE:five/loaders/model/parsers/protobuf/dome.proto"]={}),Model$1=$root.Model=(()=>{function n(t){if(this.meshes=[],t)for(let e=Object.keys(t),r=0;r<e.length;++r)t[e[r]]!=null&&(this[e[r]]=t[e[r]])}return n.prototype.meshes=$util.emptyArray,n.decode=function(e,r){e instanceof $Reader||(e=$Reader.create(e));let o=r===void 0?e.len:e.pos+r,s=new $root.Model;for(;e.pos<o;){let u=e.uint32();switch(u>>>3){case 1:{s.meshes&&s.meshes.length||(s.meshes=[]),s.meshes.push($root.Mesh.decode(e,e.uint32()));break}default:e.skipType(u&7);break}}return s},n.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/Model"},n})();$root.Mesh=(()=>{function n(t){if(this.chunks=[],this.matrix=[],t)for(let e=Object.keys(t),r=0;r<e.length;++r)t[e[r]]!=null&&(this[e[r]]=t[e[r]])}return n.prototype.name="",n.prototype.chunks=$util.emptyArray,n.prototype.matrix=$util.emptyArray,n.decode=function(e,r){e instanceof $Reader||(e=$Reader.create(e));let o=r===void 0?e.len:e.pos+r,s=new $root.Mesh;for(;e.pos<o;){let u=e.uint32();switch(u>>>3){case 1:{s.name=e.string();break}case 2:{s.chunks&&s.chunks.length||(s.chunks=[]),s.chunks.push($root.Chunk.decode(e,e.uint32()));break}case 3:{s.matrix&&s.matrix.length||(s.matrix=[]),s.matrix.push($root.Matrix.decode(e,e.uint32()));break}default:e.skipType(u&7);break}}if(!s.hasOwnProperty("name"))throw $util.ProtocolError("missing required 'name'",{instance:s});return s},n.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/Mesh"},n})(),$root.Matrix=(()=>{function n(t){if(this.elements=[],t)for(let e=Object.keys(t),r=0;r<e.length;++r)t[e[r]]!=null&&(this[e[r]]=t[e[r]])}return n.prototype.elements=$util.emptyArray,n.decode=function(e,r){e instanceof $Reader||(e=$Reader.create(e));let o=r===void 0?e.len:e.pos+r,s=new $root.Matrix;for(;e.pos<o;){let u=e.uint32();switch(u>>>3){case 1:{if(s.elements&&s.elements.length||(s.elements=[]),(u&7)===2){let l=e.uint32()+e.pos;for(;e.pos<l;)s.elements.push(e.float())}else s.elements.push(e.float());break}default:e.skipType(u&7);break}}return s},n.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/Matrix"},n})(),$root.Chunk=(()=>{function n(t){if(this.material=[],t)for(let e=Object.keys(t),r=0;r<e.length;++r)t[e[r]]!=null&&(this[e[r]]=t[e[r]])}return n.prototype.geometry=null,n.prototype.material=$util.emptyArray,n.decode=function(e,r){e instanceof $Reader||(e=$Reader.create(e));let o=r===void 0?e.len:e.pos+r,s=new $root.Chunk;for(;e.pos<o;){let u=e.uint32();switch(u>>>3){case 2:{s.geometry=$root.Geometry.decode(e,e.uint32());break}case 3:{s.material&&s.material.length||(s.material=[]),s.material.push($root.Material.decode(e,e.uint32()));break}default:e.skipType(u&7);break}}if(!s.hasOwnProperty("geometry"))throw $util.ProtocolError("missing required 'geometry'",{instance:s});return s},n.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/Chunk"},n})(),$root.Geometry=(()=>{function n(t){if(this.groups=[],t)for(let e=Object.keys(t),r=0;r<e.length;++r)t[e[r]]!=null&&(this[e[r]]=t[e[r]])}return n.prototype.position=null,n.prototype.uv=null,n.prototype.uv2=null,n.prototype.normal=null,n.prototype.groups=$util.emptyArray,n.decode=function(e,r){e instanceof $Reader||(e=$Reader.create(e));let o=r===void 0?e.len:e.pos+r,s=new $root.Geometry;for(;e.pos<o;){let u=e.uint32();switch(u>>>3){case 1:{s.position=$root.Position.decode(e,e.uint32());break}case 2:{s.uv=$root.UV.decode(e,e.uint32());break}case 3:{s.uv2=$root.UV.decode(e,e.uint32());break}case 4:{s.normal=$root.Normal.decode(e,e.uint32());break}case 5:{s.groups&&s.groups.length||(s.groups=[]),s.groups.push($root.Group.decode(e,e.uint32()));break}default:e.skipType(u&7);break}}if(!s.hasOwnProperty("position"))throw $util.ProtocolError("missing required 'position'",{instance:s});if(!s.hasOwnProperty("normal"))throw $util.ProtocolError("missing required 'normal'",{instance:s});return s},n.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/Geometry"},n})(),$root.Position=(()=>{function n(t){if(this.array=[],t)for(let e=Object.keys(t),r=0;r<e.length;++r)t[e[r]]!=null&&(this[e[r]]=t[e[r]])}return n.prototype.array=$util.emptyArray,n.decode=function(e,r){e instanceof $Reader||(e=$Reader.create(e));let o=r===void 0?e.len:e.pos+r,s=new $root.Position;for(;e.pos<o;){let u=e.uint32();switch(u>>>3){case 1:{if(s.array&&s.array.length||(s.array=[]),(u&7)===2){let l=e.uint32()+e.pos;for(;e.pos<l;)s.array.push(e.float())}else s.array.push(e.float());break}default:e.skipType(u&7);break}}return s},n.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/Position"},n})(),$root.UV=(()=>{function n(t){if(this.array=[],t)for(let e=Object.keys(t),r=0;r<e.length;++r)t[e[r]]!=null&&(this[e[r]]=t[e[r]])}return n.prototype.array=$util.emptyArray,n.decode=function(e,r){e instanceof $Reader||(e=$Reader.create(e));let o=r===void 0?e.len:e.pos+r,s=new $root.UV;for(;e.pos<o;){let u=e.uint32();switch(u>>>3){case 1:{if(s.array&&s.array.length||(s.array=[]),(u&7)===2){let l=e.uint32()+e.pos;for(;e.pos<l;)s.array.push(e.float())}else s.array.push(e.float());break}default:e.skipType(u&7);break}}return s},n.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/UV"},n})(),$root.Normal=(()=>{function n(t){if(this.array=[],t)for(let e=Object.keys(t),r=0;r<e.length;++r)t[e[r]]!=null&&(this[e[r]]=t[e[r]])}return n.prototype.array=$util.emptyArray,n.decode=function(e,r){e instanceof $Reader||(e=$Reader.create(e));let o=r===void 0?e.len:e.pos+r,s=new $root.Normal;for(;e.pos<o;){let u=e.uint32();switch(u>>>3){case 1:{if(s.array&&s.array.length||(s.array=[]),(u&7)===2){let l=e.uint32()+e.pos;for(;e.pos<l;)s.array.push(e.float())}else s.array.push(e.float());break}default:e.skipType(u&7);break}}return s},n.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/Normal"},n})(),$root.Group=(()=>{function n(t){if(t)for(let e=Object.keys(t),r=0;r<e.length;++r)t[e[r]]!=null&&(this[e[r]]=t[e[r]])}return n.prototype.start=0,n.prototype.count=0,n.prototype.materialIndex=0,n.decode=function(e,r){e instanceof $Reader||(e=$Reader.create(e));let o=r===void 0?e.len:e.pos+r,s=new $root.Group;for(;e.pos<o;){let u=e.uint32();switch(u>>>3){case 1:{s.start=e.uint32();break}case 2:{s.count=e.uint32();break}case 3:{s.materialIndex=e.uint32();break}default:e.skipType(u&7);break}}if(!s.hasOwnProperty("start"))throw $util.ProtocolError("missing required 'start'",{instance:s});if(!s.hasOwnProperty("count"))throw $util.ProtocolError("missing required 'count'",{instance:s});if(!s.hasOwnProperty("materialIndex"))throw $util.ProtocolError("missing required 'materialIndex'",{instance:s});return s},n.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/Group"},n})(),$root.Material=(()=>{function n(t){if(t)for(let e=Object.keys(t),r=0;r<e.length;++r)t[e[r]]!=null&&(this[e[r]]=t[e[r]])}return n.prototype.kd=null,n.prototype.ks=null,n.prototype.ke=null,n.prototype.mapkd="",n.prototype.mapks="",n.prototype.mapke="",n.prototype.norm="",n.prototype.mapbump="",n.prototype.bump="",n.prototype.mapd="",n.prototype.ns=0,n.prototype.d=0,n.prototype.tr=0,n.prototype.mapkdrepeat="",n.decode=function(e,r){e instanceof $Reader||(e=$Reader.create(e));let o=r===void 0?e.len:e.pos+r,s=new $root.Material;for(;e.pos<o;){let u=e.uint32();switch(u>>>3){case 1:{s.kd=$root.Color.decode(e,e.uint32());break}case 2:{s.ks=$root.Color.decode(e,e.uint32());break}case 3:{s.ke=$root.Color.decode(e,e.uint32());break}case 4:{s.mapkd=e.string();break}case 5:{s.mapks=e.string();break}case 6:{s.mapke=e.string();break}case 7:{s.norm=e.string();break}case 8:{s.mapbump=e.string();break}case 9:{s.bump=e.string();break}case 10:{s.mapd=e.string();break}case 11:{s.ns=e.float();break}case 12:{s.d=e.float();break}case 13:{s.tr=e.float();break}case 14:{s.mapkdrepeat=e.string();break}default:e.skipType(u&7);break}}return s},n.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/Material"},n})(),$root.Color=(()=>{function n(t){if(this.rgb=[],t)for(let e=Object.keys(t),r=0;r<e.length;++r)t[e[r]]!=null&&(this[e[r]]=t[e[r]])}return n.prototype.rgb=$util.emptyArray,n.decode=function(e,r){e instanceof $Reader||(e=$Reader.create(e));let o=r===void 0?e.len:e.pos+r,s=new $root.Color;for(;e.pos<o;){let u=e.uint32();switch(u>>>3){case 1:{if(s.rgb&&s.rgb.length||(s.rgb=[]),(u&7)===2){let l=e.uint32()+e.pos;for(;e.pos<l;)s.rgb.push(e.float())}else s.rgb.push(e.float());break}default:e.skipType(u&7);break}}return s},n.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/Color"},n})();var ROTATE_X_MATRIX$5=new THREE__namespace.Matrix4().fromArray([1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1]);function loadDome(n,t){var e;t===void 0&&(t={});var r=(e=t.fetcher)!==null&&e!==void 0?e:new Fetcher({allowHosts:["*"]}),o={byteLength:0};return Promise.resolve().then(function(){return r.ajax(n,{responseType:"arraybuffer"})}).then(function(s){var u;return o.byteLength=s.body.byteLength,parse$3(new Uint8Array(s.body),t.textureBaseUri||"",(u=t.textureOptions)!==null&&u!==void 0?u:{},r)}).then(function(s){var u=new THREE__namespace.Group;u.matrixAutoUpdate=!1,u.applyMatrix4(ROTATE_X_MATRIX$5),u.matrix.compose(u.position,u.quaternion,u.scale),u.name=n;for(var l=0,c=s.objects;l<c.length;l++){var f=c[l];u.add(f)}return{type:"dome",upAxis:"Z",uri:n,byteLength:o.byteLength,scene:u,textures:s.textures,dispose:function(){return s.dispose()}}})}function flipBufferGeometryNormals(n){for(var t=[0,0,0],e=0;e<n.attributes.normal.array.length/9;e++)t[0]=n.attributes.normal.array[e*9],t[1]=n.attributes.normal.array[e*9+1],t[2]=n.attributes.normal.array[e*9+2],n.attributes.normal.array[e*9]=n.attributes.normal.array[e*9+6],n.attributes.normal.array[e*9+1]=n.attributes.normal.array[e*9+7],n.attributes.normal.array[e*9+2]=n.attributes.normal.array[e*9+8],n.attributes.normal.array[e*9+6]=t[0],n.attributes.normal.array[e*9+7]=t[1],n.attributes.normal.array[e*9+8]=t[2];for(var e=0;e<n.attributes.position.array.length/9;e++)t[0]=n.attributes.position.array[e*9],t[1]=n.attributes.position.array[e*9+1],t[2]=n.attributes.position.array[e*9+2],n.attributes.position.array[e*9]=n.attributes.position.array[e*9+6],n.attributes.position.array[e*9+1]=n.attributes.position.array[e*9+7],n.attributes.position.array[e*9+2]=n.attributes.position.array[e*9+8],n.attributes.position.array[e*9+6]=t[0],n.attributes.position.array[e*9+7]=t[1],n.attributes.position.array[e*9+8]=t[2];for(var e=0;e<n.attributes.uv.array.length/6;e++)t[0]=n.attributes.uv.array[e*6],t[1]=n.attributes.uv.array[e*6+1],n.attributes.uv.array[e*6]=n.attributes.uv.array[e*6+4],n.attributes.uv.array[e*6+1]=n.attributes.uv.array[e*6+5],n.attributes.uv.array[e*6+4]=t[0],n.attributes.uv.array[e*6+5]=t[1];n.attributes.normal.needsUpdate=!0,n.attributes.position.needsUpdate=!0,n.attributes.uv.needsUpdate=!0}function parseGeometry(n){var t=n.position,e=n.normal,r=n.uv,o=n.uv2,s=n.groups,u=new THREE__namespace.BufferGeometry;u.setAttribute("position",new THREE__namespace.BufferAttribute(new Float32Array(t.array),3)),e&&u.setAttribute("normal",new THREE__namespace.BufferAttribute(new Float32Array(e.array),3)),r&&u.setAttribute("uv",new THREE__namespace.BufferAttribute(new Float32Array(r.array),2)),o&&u.setAttribute("uv2",new THREE__namespace.BufferAttribute(new Float32Array(o.array),2));for(var l=0,c=s;l<c.length;l++){var f=c[l];u.addGroup(f.start,f.count,f.materialIndex)}return u}function loadTexture(n,t,e,r,o,s,u){if(u.hasOwnProperty(n))return u[n];n=n.split("?")[0],isAbsoluteURL(n)||(n=pathJoin(t,n)),n=n.replace(/\/\/vrlab-image\d*.ljcdn.com\//,"//vrlab-public.ljcdn.com/"),n.indexOf("//")===0&&(n="https:"+n);var l=__assign({key:"texture.dome",size:64},pick(e,["quality","format","sharpen","mappings"])),c=u[n]=o.loadTexture(n,{imageURL:{transform:e.transform,options:l},wrapS:THREE__namespace.RepeatWrapping,wrapT:THREE__namespace.RepeatWrapping,fetcher:s}).then(function(f){var d=f.body;return r&&d.repeat.copy(r),d.needsUpdate=!0,d.updateMatrix(),d});return c}function parseMaterial(n,t,e,r,o,s,u,l){var c=[],f=new PBMMeshMaterial("phong");if(u.add(f),n.kd&&(f.color=new THREE__namespace.Color().fromArray(n.kd.rgb).convertLinearToSRGB()),n.mapkd){var d=null;if(n.mapkdrepeat){var p=n.mapkdrepeat.split(/\s+/).map(function(m){return Number(m)}),v=p[0],g=p[1];d=new THREE__namespace.Vector2(v,g)}c.push(loadTexture(n.mapkd,t,e,d,r,o,s).then(function(m){m.encoding=THREE__namespace.sRGBEncoding,f.map=m,u.add(m),l.add(m),f.needsUpdate=!0}).catch(noop$1))}if(n.ks&&(f.specular=new THREE__namespace.Color().fromArray(n.ks.rgb).convertLinearToSRGB()),n.mapks&&c.push(loadTexture(n.mapks,t,e,null,r,o,s).then(function(m){f.specularMap=m,u.add(m),l.add(m)}).catch(noop$1)),n.ke&&(f.emissive=new THREE__namespace.Color().fromArray(n.ke.rgb).convertLinearToSRGB()),n.mapke&&c.push(loadTexture(n.mapke,t,e,null,r,o,s).then(function(m){m.encoding=THREE__namespace.sRGBEncoding,f.emissiveMap=m,u.add(m),l.add(m)}).catch(noop$1)),n.norm&&c.push(loadTexture(n.norm,t,e,null,r,o,s).then(function(m){f.normalMap=m,u.add(m),l.add(m)}).catch(noop$1)),n.mapbump&&c.push(loadTexture(n.mapbump,t,e,null,r,o,s).then(function(m){f.bumpMap=m,u.add(m),l.add(m)}).catch(noop$1)),n.bump&&c.push(loadTexture(n.bump,t,e,null,r,o,s).then(function(m){f.bumpMap=m,u.add(m),l.add(m)}).catch(noop$1)),typeof n.ns=="number"&&(f.shininess=n.ns),typeof n.d=="number"){var h=n.d;h>0&&h<1&&(f.opacity=h)}return f.floor=0,f.refreshUniforms(),{material:f,textureReady:Promise.all(c).then(noop$1)}}function fromProtoBuf(n){return Model$1.decode(n).meshes}function parse$3(n,t,e,r){for(var o=[],s=[],u=new Set,l=fromProtoBuf(n),c=new TextureLoader,f=new THREE__namespace.Matrix4,d=new THREE__namespace.Vector3,p=new THREE__namespace.Quaternion,v=new THREE__namespace.Vector3,g={},h=new Set,m=0,y=l;m<y.length;m++){var A=y[m],E=A.name,b=A.chunks,T=A.matrix;if(!(E==="Ceiling"||E==="CeilingDrop"))for(var _=0,R=T;_<R.length;_++){var S=R[_];f.elements=S.elements;for(var M=new THREE__namespace.Group,B=0;B<b.length;B++){var H=parseGeometry(b[B].geometry);H.applyMatrix4(f),f.decompose(d,p,v),v.x*v.y*v.z<0&&H.attributes.normal&&H.attributes.position&&H.attributes.uv&&flipBufferGeometryNormals(H),u.add(H);for(var w=[],C=0,L=b[B].material;C<L.length;C++){var I=L[C],F=parseMaterial(I,t||"",e,c,r,g,u,h),k=F.material,N=F.textureReady;s.push(N),w.push(k)}var D=new PBMMesh(H,w);D.name="chunk_"+B,D.matrix.compose(D.position,D.quaternion,D.scale),D.matrixAutoUpdate=!1,D.frustumCulled=!1,M.add(D)}M.name=E,o.push(M)}}return Promise.all(s).catch(noop$1).then(function(){return{createAt:0,description:"",objects:o,textures:Array.from(h),dispose:function(){u.forEach(function(U){U.dispose()}),u.clear()}}})}var ROTATE_X_MATRIX$4=new THREE__namespace.Matrix4().fromArray([1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1]);function loadDomez(n,t){var e;t===void 0&&(t={});var r=(e=t.fetcher)!==null&&e!==void 0?e:new Fetcher({allowHosts:["*"]}),o={byteLength:0};return Promise.resolve().then(function(){return r.ajax(n,{responseType:"arraybuffer"})}).then(function(s){return o.byteLength=s.body.byteLength,lzma(s.body)}).then(function(s){var u=s.reduce(function(f,d){return f+d.length},0),l=new Uint8Array(u),c=0;return s.forEach(function(f){l.set(f,c),c+=f.length}),l}).then(function(s){var u;return parse$3(s,t.textureBaseUri||"",(u=t.textureOptions)!==null&&u!==void 0?u:{},r)}).then(function(s){var u=new THREE__namespace.Group;u.matrixAutoUpdate=!1,u.applyMatrix4(ROTATE_X_MATRIX$4),u.matrix.compose(u.position,u.quaternion,u.scale),u.name=n;for(var l=0,c=s.objects;l<c.length;l++){var f=c[l];u.add(f)}return{type:"domez",upAxis:"Z",uri:n,byteLength:o.byteLength,scene:u,textures:s.textures,dispose:function(){return s.dispose()}}})}var ROTATE_X_MATRIX$3=new THREE__namespace.Matrix4().fromArray([1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1]);function loadGlb(n,t){var e,r;t===void 0&&(t={});var o=(e=t.upAxis)!==null&&e!==void 0?e:"Y",s=(r=t.fetcher)!==null&&r!==void 0?r:new Fetcher({allowHosts:["*"]}),u=0;return Promise.resolve().then(function(){return s.ajax(n,{responseType:"arraybuffer"}).then(function(l){return u=l.body.byteLength,l.body})}).then(function(l){var c;return parseGltf(l,{copyUV2:!1,addonExtensions:["PBM_mesh"],resourcePath:n.slice(0,n.lastIndexOf("/")+1),search:(c=n.split("?")[1])!==null&&c!==void 0?c:"",fetcher:s})}).then(function(l){var c=new THREE__namespace.Matrix4;if(o==="Y"&&c.premultiply(ROTATE_X_MATRIX$3),l.CESIUM_RTC){var f=new THREE__namespace.Matrix4().setPosition(l.CESIUM_RTC.center);c.premultiply(f)}var d=l.scene;return d.applyMatrix4(c),{type:"glb",upAxis:"Z",uri:n,byteLength:u,scene:d,textures:l.textures,dispose:function(){return l.dispose()}}})}var ROTATE_X_MATRIX$2=new THREE__namespace.Matrix4().fromArray([1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1]),scratchColor=new THREE__namespace.Color;function loadPly(n,t){var e,r;t===void 0&&(t={});var o=(e=t.upAxis)!==null&&e!==void 0?e:"Z",s=(r=t.fetcher)!==null&&r!==void 0?r:new Fetcher({allowHosts:["*"]}),u=0;return Promise.resolve().then(function(){return s.ajax(n,{responseType:"arraybuffer"}).then(function(l){return u=l.body.byteLength,l.body})}).then(function(l){var c,f;return parsePly(l,{propertyNameMapping:(c=t.propertyNameMapping)!==null&&c!==void 0?c:{},customPropertyMapping:(f=t.customPropertyMapping)!==null&&f!==void 0?f:{}})}).then(function(l){var c=l.geometry;switch(t.type){case"geometry":{var f=c;return o==="Y"&&f.applyMatrix4(ROTATE_X_MATRIX$2),{type:"ply",upAxis:"Z",uri:n,byteLength:u,scene:f,meta:{},textures:[],dispose:function(){c.dispose()}}}case"mesh":{var d="color"in c.attributes,p=new THREE__namespace.MeshBasicMaterial({vertexColors:d}),f=new THREE__namespace.Mesh(c,p);return o==="Y"&&f.applyMatrix4(ROTATE_X_MATRIX$2),{type:"ply",upAxis:"Z",uri:n,byteLength:u,scene:f,meta:{},textures:[],dispose:function(){c.dispose(),p.dispose()}}}case"line":{var d="color"in c.attributes,v=new THREE__namespace.LineBasicMaterial({vertexColors:d}),f=new THREE__namespace.Line(c,v);return f.computeLineDistances(),o==="Y"&&f.applyMatrix4(ROTATE_X_MATRIX$2),{type:"ply",upAxis:"Z",uri:n,byteLength:u,scene:f,meta:{},textures:[],dispose:function(){c.dispose(),v.dispose()}}}case"points":{var g=new THREE__namespace.PointsMaterial({}),f=new THREE__namespace.Points(c,g);return o==="Y"&&f.applyMatrix4(ROTATE_X_MATRIX$2),{type:"ply",upAxis:"Z",uri:n,byteLength:u,scene:f,meta:{},textures:[],dispose:function(){c.dispose(),g.dispose()}}}case"pbmPointCloud":{var h=new PBMPointCloudMaterial,f=new PBMPointCloud(c,h);return o==="Y"&&f.applyMatrix4(ROTATE_X_MATRIX$2),{type:"ply",upAxis:"Z",uri:n,byteLength:u,scene:f,meta:{},textures:[],dispose:function(){c.dispose(),h.dispose()}}}}throw new Error("Invalid Type: ".concat(t.type))})}function parsePly(n,t){var e=new Uint8Array(n),r=extractHeaderText(e),o=r.headerText,s=r.headerLength,u=parseHeader(o,s,t);if(u.format==="ascii"){var l=new TextDecoder().decode(e);return{header:u,geometry:parseASCII(l,u,t)}}else return{header:u,geometry:parseBinary(n,u,t)}}function makePlyElementProperty(n,t){var e={name:"",type:n[0]};return e.type==="list"?(e.name=n[3],e.countType=n[1],e.itemType=n[2]):e.name=n[1],e.name in t.propertyNameMapping&&(e.name=t.propertyNameMapping[e.name]),e}function parseHeader(n,t,e){t===void 0&&(t=0);var r=/^ply([\s\S]*)end_header(\r\n|\r|\n)/,o="",s=r.exec(n);s!==null&&(o=s[1]);for(var u={format:"",version:"",comments:[],elements:[],headerLength:t,objInfo:""},l=o.split(/\r\n|\r|\n/),c=null,f=0;f<l.length;f++){var d=l[f];if(d=d.trim(),d!==""){var p=d.split(/\s+/),v=p.shift();switch(d=p.join(" "),v){case"format":u.format=p[0],u.version=p[1];break;case"comment":u.comments.push(d);break;case"element":c&&u.elements.push(c),c={name:p[0],count:parseInt(p[1]),properties:[]};break;case"property":c&&c.properties.push(makePlyElementProperty(p,e));break;case"obj_info":u.objInfo=d;break;default:console.log("unhandled",v,p)}}}return c&&u.elements.push(c),u}function parseASCIINumber(n,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(n);case"float":case"double":case"float32":case"float64":return parseFloat(n);default:throw new Error("unspport type: "+t)}}function parseASCIIElement(n,t){for(var e={},r=0;r<n.length;r++){if(t.empty())return null;if(n[r].type==="list"){for(var o=[],s=parseASCIINumber(t.next(),n[r].countType),u=0;u<s;u++){if(t.empty())return null;o.push(parseASCIINumber(t.next(),n[r].itemType))}e[n[r].name]=o}else e[n[r].name]=parseASCIINumber(t.next(),n[r].type)}return e}function createBuffer(n){for(var t={indices:[],vertices:[],normals:[],uvs:[],faceVertexUvs:[],colors:[],faceVertexColors:[]},e=0,r=Object.keys(n.customPropertyMapping);e<r.length;e++){var o=r[e];t[o]=[]}return t}function mapElementAttributes(n){var t=n.map(function(r){return r.name});function e(r){for(var o=0,s=r.length;o<s;o++){var u=r[o];if(t.includes(u))return u}return null}return{attrX:e(["x","px","posx"])||"x",attrY:e(["y","py","posy"])||"y",attrZ:e(["z","pz","posz"])||"z",attrNX:e(["nx","normalx"]),attrNY:e(["ny","normaly"]),attrNZ:e(["nz","normalz"]),attrS:e(["s","u","texture_u","tx"]),attrT:e(["t","v","texture_v","ty"]),attrR:e(["red","diffuse_red","r","diffuse_r"]),attrG:e(["green","diffuse_green","g","diffuse_g"]),attrB:e(["blue","diffuse_blue","b","diffuse_b"])}}function parseASCII(n,t,e){var r=createBuffer(e),o=/end_header\s+(\S[\s\S]*\S|\S)\s*$/,s,u=null;(u=o.exec(n))!==null?s=u[1].split(/\s+/):s=[];var l=new ArrayStream(s);e:for(var c=0;c<t.elements.length;c++)for(var f=t.elements[c],d=mapElementAttributes(f.properties),p=0;p<f.count;p++){var v=parseASCIIElement(f.properties,l);if(!v)break e;handleElement(r,f.name,v,d,e)}return postProcess(r,e)}function postProcess(n,t){var e=new THREE__namespace.BufferGeometry;n.indices.length>0&&e.setIndex(n.indices),e.setAttribute("position",new THREE__namespace.Float32BufferAttribute(n.vertices,3)),n.normals.length>0&&e.setAttribute("normal",new THREE__namespace.Float32BufferAttribute(n.normals,3)),n.uvs.length>0&&e.setAttribute("uv",new THREE__namespace.Float32BufferAttribute(n.uvs,2)),n.colors.length>0&&e.setAttribute("color",new THREE__namespace.Float32BufferAttribute(n.colors,3)),(n.faceVertexUvs.length>0||n.faceVertexColors.length>0)&&(e=e.toNonIndexed(),n.faceVertexUvs.length>0&&e.setAttribute("uv",new THREE__namespace.Float32BufferAttribute(n.faceVertexUvs,2)),n.faceVertexColors.length>0&&e.setAttribute("color",new THREE__namespace.Float32BufferAttribute(n.faceVertexColors,3)));for(var r=0,o=Object.keys(t.customPropertyMapping);r<o.length;r++){var s=o[r];if(n[s].length>0){var u=t.customPropertyMapping[s],l=u.itemType,c=u.itemNames,f=u.normalized,d=c.length,p=void 0;switch(l){case"float32":p=new THREE__namespace.Float32BufferAttribute(n[s],d,f);break;case"uint32":p=new THREE__namespace.Uint32BufferAttribute(n[s],d,f);break;case"int32":p=new THREE__namespace.Int32BufferAttribute(n[s],d,f);break;case"uint16":p=new THREE__namespace.Uint16BufferAttribute(n[s],d,f);break;case"int16":p=new THREE__namespace.Int16BufferAttribute(n[s],d,f);break;case"uint8":p=new THREE__namespace.Uint8BufferAttribute(n[s],d,f);break;case"int8":p=new THREE__namespace.Int8BufferAttribute(n[s],d,f);break;default:p=new THREE__namespace.Float32BufferAttribute(n[s],d,f);break}e.setAttribute(s,p)}}return e.computeBoundingSphere(),e}function handleElement(n,t,e,r,o){if(t==="vertex"){r.attrX!==null&&r.attrY!==null&&r.attrZ!==null&&n.vertices.push(e[r.attrX],e[r.attrY],e[r.attrZ]),r.attrNX!==null&&r.attrNY!==null&&r.attrNZ!==null&&n.normals.push(e[r.attrNX],e[r.attrNY],e[r.attrNZ]),r.attrS!==null&&r.attrT!==null&&n.uvs.push(e[r.attrS],e[r.attrT]),r.attrR!==null&&r.attrG!==null&&r.attrB!==null&&(scratchColor.setRGB(e[r.attrR]/255,e[r.attrG]/255,e[r.attrB]/255),n.colors.push(scratchColor.r,scratchColor.g,scratchColor.b));for(var s=0,u=Object.keys(o.customPropertyMapping);s<u.length;s++)for(var l=u[s],c=0,f=o.customPropertyMapping[l].itemNames;c<f.length;c++){var d=f[c];n[l].push(e[d])}}else if(t==="face"){var p=e.vertex_indices||e.vertex_index,v=e.texcoord;p.length===3?(n.indices.push(p[0],p[1],p[2]),v&&v.length===6&&(n.faceVertexUvs.push(v[0],v[1]),n.faceVertexUvs.push(v[2],v[3]),n.faceVertexUvs.push(v[4],v[5]))):p.length===4&&(n.indices.push(p[0],p[1],p[3]),n.indices.push(p[1],p[2],p[3])),r.attrR!==null&&r.attrG!==null&&r.attrB!==null&&(scratchColor.setRGB(e[r.attrR]/255,e[r.attrG]/255,e[r.attrB]/255),n.faceVertexColors.push(scratchColor.r,scratchColor.g,scratchColor.b),n.faceVertexColors.push(scratchColor.r,scratchColor.g,scratchColor.b),n.faceVertexColors.push(scratchColor.r,scratchColor.g,scratchColor.b))}}function binaryReadElement(n,t){for(var e={},r=0,o=0;o<t.length;o++){var s=t[o],u=s.valueReader;if(s.type==="list"){var l=[],c=s.countReader.read(n+r);r+=s.countReader.size;for(var f=0;f<c;f++)l.push(u.read(n+r)),r+=u.size;e[s.name]=l}else e[s.name]=u.read(n+r),r+=u.size}return[e,r]}function setPropertyBinaryReaders(n,t,e){function r(l,c,f){switch(c){case"int8":case"char":return{read:function(d){return l.getInt8(d)},size:1};case"uint8":case"uchar":return{read:function(d){return l.getUint8(d)},size:1};case"int16":case"short":return{read:function(d){return l.getInt16(d,f)},size:2};case"uint16":case"ushort":return{read:function(d){return l.getUint16(d,f)},size:2};case"int32":case"int":return{read:function(d){return l.getInt32(d,f)},size:4};case"uint32":case"uint":return{read:function(d){return l.getUint32(d,f)},size:4};case"float32":case"float":return{read:function(d){return l.getFloat32(d,f)},size:4};case"float64":case"double":return{read:function(d){return l.getFloat64(d,f)},size:8};default:throw new Error("not support type: "+c)}}for(var o=0,s=n.length;o<s;o++){var u=n[o];u.type==="list"?(u.countReader=r(t,u.countType,e),u.valueReader=r(t,u.itemType,e)):u.valueReader=r(t,u.type,e)}}function parseBinary(n,t,e){for(var r=createBuffer(e),o=t.format==="binary_little_endian",s=new DataView(n,t.headerLength),u,l=0,c=0;c<t.elements.length;c++){var f=t.elements[c],d=f.properties,p=mapElementAttributes(d);setPropertyBinaryReaders(d,s,o);for(var v=0;v<f.count;v++){u=binaryReadElement(l,d),l+=u[1];var g=u[0];handleElement(r,f.name,g,p,e)}}return postProcess(r,e)}function extractHeaderText(n){var t=0,e=!0,r="",o=[],s=new TextDecoder().decode(n.subarray(0,5)),u=/^ply\r\n/.test(s);do{var l=String.fromCharCode(n[t++]);l!==`
|
|
929
929
|
`&&l!=="\r"?r+=l:(r==="end_header"&&(e=!1),r!==""&&(o.push(r),r=""))}while(e&&t<n.length);return u===!0&&t++,{headerText:o.join("\r")+"\r",headerLength:t}}var ArrayStream=function(){function n(t){this.arr=t,this.i=0}return n.prototype.empty=function(){return this.i>=this.arr.length},n.prototype.next=function(){return this.arr[this.i++]},n}(),ROTATE_X_MATRIX$1=new THREE__namespace.Matrix4().fromArray([1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1]),_object_pattern=/^[og]\s*(.+)?/,_material_library_pattern=/^mtllib /,_material_use_pattern=/^usemtl /,_map_use_pattern=/^usemap /,_face_vertex_data_separator_pattern=/\s+/,_color=new THREE__namespace.Color,ObjState=function(){function n(){this.objects=[],this.vertices=[],this.normals=[],this.colors=[],this.uvs=[],this.materials={},this.materialLibraries=[],this.startObject("",!1)}return n.prototype.startObject=function(t,e){if(this.object&&this.object.fromDeclaration===!1){this.object.name=t,this.object.fromDeclaration=e!==!1;return}var r=this.object&&typeof this.object.currentMaterial=="function"?this.object.currentMaterial():void 0;if(this.object&&typeof this.object._finalize=="function"&&this.object._finalize(!0),this.object={name:t||"",fromDeclaration:e!==!1,geometry:{vertices:[],hasNormal:!0,normals:[],hasColor:!0,colors:[],hasUV:!0,uvs:[],index:[],indexMap:{}},materials:[],smooth:!0,startMaterial:function(s,u){var l,c,f=this._finalize(!1);f&&(f.inherited||((l=f.groupCount)!==null&&l!==void 0?l:0)<=0)&&this.materials.splice((c=f.index)!==null&&c!==void 0?c:0,1);var d={index:this.materials.length,name:s||"",mtllib:Array.isArray(u)&&u.length>0?u[u.length-1]:"",smooth:f!==void 0?f.smooth:this.smooth,groupStart:f!==void 0?f.groupEnd:0,groupEnd:-1,groupCount:-1,inherited:!1,clone:function(p){var v={index:typeof p=="number"?p:this.index,name:this.name,mtllib:this.mtllib,smooth:this.smooth,groupStart:0,groupEnd:-1,groupCount:-1,inherited:!1,clone:function(){return this}};return v.clone=this.clone.bind(v),v}};return this.materials.push(d),d},currentMaterial:function(){if(this.materials.length>0)return this.materials[this.materials.length-1]},_finalize:function(s){var u,l,c=this.currentMaterial();if(c&&c.groupEnd===-1&&(c.groupEnd=this.geometry.index.length,c.groupCount=c.groupEnd-((u=c.groupStart)!==null&&u!==void 0?u:0),c.inherited=!1),s&&this.materials.length>1)for(var f=this.materials.length-1;f>=0;f--)((l=this.materials[f].groupCount)!==null&&l!==void 0?l:0)<=0&&this.materials.splice(f,1);return s&&this.materials.length===0&&this.materials.push({name:"",smooth:this.smooth}),c}},r&&r.name&&typeof r.clone=="function"){var o=r.clone(0);o.inherited=!0,this.object.materials.push(o)}this.objects.push(this.object)},n.prototype.finalize=function(){this.object&&typeof this.object._finalize=="function"&&this.object._finalize(!0)},n.prototype.parseVertexIndex=function(t,e){var r=parseInt(t,10);return(r>=0?r-1:r+e/3)*3},n.prototype.parseNormalIndex=function(t,e){var r=parseInt(t,10);return(r>=0?r-1:r+e/3)*3},n.prototype.parseUVIndex=function(t,e){var r=parseInt(t,10);return(r>=0?r-1:r+e/2)*2},n.prototype.addFace=function(t,e,r,o,s,u,l,c,f){var d=this.object.geometry,p=this.vertices.length,v=this.normals.length,g=this.uvs.length,h=this.parseVertexIndex(t,p),m=this.parseVertexIndex(e,p),y=this.parseVertexIndex(r,p),A=l!==void 0?this.parseNormalIndex(l,v):void 0,E=c!==void 0?this.parseNormalIndex(c,v):void 0,b=f!==void 0?this.parseNormalIndex(f,v):void 0,T=o!==void 0?this.parseUVIndex(o,g):void 0,_=s!==void 0?this.parseUVIndex(s,g):void 0,R=u!==void 0?this.parseUVIndex(u,g):void 0;(d.hasNormal===!0&&A===void 0||E===void 0||b===void 0)&&(d.hasNormal=!1),(d.hasUV===!0&&T===void 0||_===void 0||R===void 0)&&(d.hasUV=!1);var S=[h,T,A].join(":"),M=d.indexMap[S];M===void 0&&(M=d.vertices.length/3,d.indexMap[S]=M,d.vertices.push(this.vertices[h+0],this.vertices[h+1],this.vertices[h+2]),d.hasColor&&(this.colors[h]===void 0?d.hasColor=!1:d.colors.push(this.colors[h+0],this.colors[h+1],this.colors[h+2])),d.hasNormal&&d.normals.push(this.normals[h+0],this.normals[h+1],this.normals[h+2]),d.hasUV&&d.uvs.push(this.uvs[T+0],this.uvs[T+1])),d.index.push(M);var B=[m,_,E].join(":"),H=d.indexMap[B];H===void 0&&(H=d.vertices.length/3,d.indexMap[B]=H,d.vertices.push(this.vertices[m+0],this.vertices[m+1],this.vertices[m+2]),d.hasColor&&(this.colors[m]===void 0?d.hasColor=!1:d.colors.push(this.colors[m+0],this.colors[m+1],this.colors[m+2])),d.hasNormal&&d.normals.push(this.normals[m+0],this.normals[m+1],this.normals[m+2]),d.hasUV&&d.uvs.push(this.uvs[_+0],this.uvs[_+1])),d.index.push(H);var w=[y,R,b].join(":"),C=d.indexMap[w];C===void 0&&(C=d.vertices.length/3,d.indexMap[w]=C,d.vertices.push(this.vertices[y+0],this.vertices[y+1],this.vertices[y+2]),d.hasColor&&(this.colors[y]===void 0?d.hasColor=!1:d.colors.push(this.colors[y+0],this.colors[y+1],this.colors[y+2])),d.hasNormal&&d.normals.push(this.normals[y+0],this.normals[y+1],this.normals[y+2]),d.hasUV&&d.uvs.push(this.uvs[R+0],this.uvs[R+1])),d.index.push(C)},n}();function parseObj(n){var t=new ObjState;n.indexOf(`\r
|
|
930
930
|
`)!==-1&&(n=n.replace(/\r\n/g,`
|
|
931
931
|
`)),n.indexOf(`\\
|
|
932
932
|
`)!==-1&&(n=n.replace(/\\\n/g,""));for(var e=n.split(`
|
|
933
933
|
`),r=[],o=0,s=e.length;o<s;o++){var u=e[o].trimStart();if(u.length!==0){var l=u.charAt(0);if(l!=="#"){if(l==="v"){var c=u.split(_face_vertex_data_separator_pattern);switch(c[0]){case"v":t.vertices.push(parseFloat(c[1]),parseFloat(c[2]),parseFloat(c[3])),c.length>=7?(_color.setRGB(parseFloat(c[4]),parseFloat(c[5]),parseFloat(c[6])),_color.convertSRGBToLinear(),t.colors.push(_color.r,_color.g,_color.b)):t.colors.push(void 0,void 0,void 0);break;case"vn":t.normals.push(parseFloat(c[1]),parseFloat(c[2]),parseFloat(c[3]));break;case"vt":t.uvs.push(parseFloat(c[1]),parseFloat(c[2]));break}}else if(l==="f"){for(var f=u.slice(1).trim(),d=f.split(_face_vertex_data_separator_pattern),p=[],v=0,g=d.length;v<g;v++){var h=d[v];if(h.length>0){var m=h.split("/");p.push(m)}}for(var y=p[0],v=1,g=p.length-1;v<g;v++){var A=p[v],E=p[v+1];t.addFace(y[0],A[0],E[0],y[1],A[1],E[1],y[2],A[2],E[2])}}else if(l!=="l"){if(l!=="p")if((r=_object_pattern.exec(u))!==null){var b=(" "+r[0].slice(1).trim()).slice(1);t.startObject(b)}else if(_material_use_pattern.test(u))t.object.startMaterial(u.substring(7).trim(),t.materialLibraries);else if(_material_library_pattern.test(u))t.materialLibraries.push(u.substring(7).trim());else if(_map_use_pattern.test(u))console.warn('THREE.OBJLoader: Rendering identifier "usemap" not supported. Textures must be defined in MTL files.');else if(l==="s"){if(r=u.split(" "),r.length>1){var T=r[1].trim().toLowerCase();t.object.smooth=T!=="0"&&T!=="off"}else t.object.smooth=!0;var _=t.object.currentMaterial();_&&(_.smooth=t.object.smooth)}else{if(u==="\0")continue;console.warn('THREE.OBJLoader: Unexpected line: "'+u+'"')}}}}}return t.finalize(),t}function parseMtl(n,t,e){for(var r=new TextureLoader,o=t.split(`
|
|
934
|
-
`),s={name:""},u=/\s+/,l={},c=0;c<o.length;c++){var f=o[c];if(f=f.trim(),!(f.length===0||f.charAt(0)==="#")){var d=f.indexOf(" "),p=d>=0?f.substring(0,d):f;p=p.toLowerCase();var v=d>=0?f.substring(d+1):"";if(v=v.trim(),p==="newmtl")s={name:v},l[v]=s;else if(p==="ka"||p==="kd"||p==="ks"||p==="ke"){var g=v.split(u,3);s[p]=[parseFloat(g[0]),parseFloat(g[1]),parseFloat(g[2])]}else(p==="map_kd"||p==="map_ks"||p==="map_ke"||p==="norm"||p==="map_bump"||p==="bump"||p==="map_d"||p==="ns"||p==="d"||p==="tr")&&(s[p]=v)}}function h(y){var A={url:"",scale:new THREE__namespace.Vector2(1,1),offset:new THREE__namespace.Vector2(0,0),bumpScale:1},E=y.split(/\s+/),b;return b=E.indexOf("-bm"),b>=0&&(A.bumpScale=parseFloat(E[b+1]),E.splice(b,2)),b=E.indexOf("-s"),b>=0&&(A.scale.set(parseFloat(E[b+1]),parseFloat(E[b+2])),E.splice(b,4)),b=E.indexOf("-o"),b>=0&&(A.offset.set(parseFloat(E[b+1]),parseFloat(E[b+2])),E.splice(b,4)),A.url=E.join(" ").trim(),A}function m(y,A,E){var b=h(E),T=pathJoin(e.path,b.url);return r.loadTexture(T,{fetcher:e.fetcher,encoding:A==="map"||A==="emissiveMap"?THREE__namespace.sRGBEncoding:THREE__namespace.LinearEncoding,minFilter:THREE__namespace.LinearFilter,magFilter:THREE__namespace.LinearFilter,wrapS:THREE__namespace.RepeatWrapping,wrapT:THREE__namespace.RepeatWrapping}).then(function(_){var R=_.body;return R.repeat.copy(b.scale),R.offset.copy(b.offset),y.bumpScale=b.bumpScale,y[A]=R,R})}return{name:n,create:function(y){var A=new PBMMeshMaterial(e.materialType),E=[],b=l[y];if(b){if(b.kd!==void 0&&A.color.fromArray(b.kd),b.ks!==void 0&&A.specular.fromArray(b.ks),b.ke!==void 0&&A.emissive.fromArray(b.ke),b.map_kd!==void 0&&E.push(m(A,"map",b.map_kd)),b.map_ks!==void 0&&E.push(m(A,"specularMap",b.map_ks)),b.map_ke!==void 0&&E.push(m(A,"emissiveMap",b.map_ke)),b.norm!==void 0&&E.push(m(A,"normalMap",b.norm)),b.map_bump!==void 0&&E.push(m(A,"bumpMap",b.map_bump)),b.bump!==void 0&&E.push(m(A,"bumpMap",b.bump)),b.map_d!==void 0&&E.push(m(A,"alphaMap",b.map_d)),b.ns!==void 0&&(A.shininess=parseFloat(b.ns)),b.d!==void 0){var T=parseFloat(b.d);T<1&&(A.opacity=T,A.transparent=!0)}if(b.tr!==void 0){var T=parseFloat(b.tr);T>0&&(A.opacity=1-T,A.transparent=!0)}}var _=Promise.all(E).then(function(R){return A.refreshUniforms(),R});return[A,_]}}}function build(n,t){for(var e,r,o=[],s=[],u=new THREE__namespace.Group,l=function(d,p){var v=n.objects[d],g=v.geometry,h=v.materials,m=!1;if(g.vertices.length===0)return"continue";var y=new THREE__namespace.BufferGeometry;s.push(function(){return y.dispose()}),y.setAttribute("position",new THREE__namespace.BufferAttribute(new Float32Array(g.vertices),3)),g.normals.length>0&&y.setAttribute("normal",new THREE__namespace.BufferAttribute(new Float32Array(g.normals),3)),g.colors.length>0&&(m=!0,y.setAttribute("color",new THREE__namespace.BufferAttribute(new Float32Array(g.colors),3))),g.uvs.length>0&&y.setAttribute("uv",new THREE__namespace.BufferAttribute(new Float32Array(g.uvs),2)),g.index.length>0&&y.setIndex(new THREE__namespace.BufferAttribute(new Uint32Array(g.index),1)),y.computeBoundingBox(),y.computeBoundingSphere();for(var A=[],E=function(S,M){var B=h[S],H=B.name+"_"+B.smooth+"_"+m,w=n.materials[H];if(!w){for(var C=null,L=0,I=t;L<I.length;L++){var F=I[L],k=F.name,N=F.create;k===B.mtllib&&(C=N(B.name))}if(!C){var D=new PBMMeshMaterial;D.refreshUniforms(),C=[D,Promise.resolve([])]}w=C[0],w.name=B.name,w.flatShading=!(B.smooth||y.attributes.normal),w.vertexColors=m,n.materials[H]=w;var U=C[1];o.push(U),s.push(function(){return w.dispose()})}A.push(w)},b=0,T=h.length;b<T;b++)E(b);for(var b=0,T=h.length;b<T;b++){var _=h[b];y.addGroup((e=_.groupStart)!==null&&e!==void 0?e:0,(r=_.groupCount)!==null&&r!==void 0?r:0,b)}var R=new PBMMesh(y,A);R.name=v.name,u.add(R)},c=0,f=n.objects.length;c<f;c++)l(c);return Promise.all(o).then(function(d){for(var p=[],v=0,g=d;v<g.length;v++){var h=g[v];p=p.concat(h)}return{scene:u,textures:p,dispose:function(){return s.forEach(function(m){return m()})}}})}function loadObj(n,t){var e,r,o;t===void 0&&(t={});var s=(e=t.upAxis)!==null&&e!==void 0?e:"Z",u=(r=t.materialType)!==null&&r!==void 0?r:"basic",l=(o=t.fetcher)!==null&&o!==void 0?o:new Fetcher({allowHosts:["*"]}),c=n.slice(0,n.lastIndexOf("/")+1),f=0,d;return Promise.resolve().then(function(){return l.ajax(n,{responseType:"arraybuffer"})}).then(function(p){f=p.body.byteLength;var v=new TextDecoder;return v.decode(p.body)}).then(function(p){return d=parseObj(p),Promise.all(d.materialLibraries.map(function(v){var g=pathJoin(c,v),h=g.slice(0,g.lastIndexOf("/")+1);return l.ajax(g,{responseType:"text"}).then(function(m){return parseMtl(v,m.body,{path:h,materialType:u,fetcher:l})})}))}).then(function(p){return build(d,p)}).then(function(p){var v=new THREE__namespace.Matrix4;return s==="Y"&&v.premultiply(ROTATE_X_MATRIX$1),p.scene.applyMatrix4(v),{type:"obj",upAxis:"Z",uri:n,byteLength:f,scene:p.scene,textures:p.textures,dispose:function(){return p.dispose()}}})}var u8=Uint8Array,u16=Uint16Array,i32=Int32Array,fleb=new u8([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]),fdeb=new u8([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]),clim=new u8([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),freb=function(n,t){for(var e=new u16(31),r=0;r<31;++r)e[r]=t+=1<<n[r-1];for(var o=new i32(e[30]),r=1;r<30;++r)for(var s=e[r];s<e[r+1];++s)o[s]=s-e[r]<<5|r;return{b:e,r:o}},_a$3=freb(fleb,2),fl=_a$3.b,revfl=_a$3.r;fl[28]=258,revfl[258]=28;for(var _b=freb(fdeb,0),fd=_b.b,rev=new u16(32768),i=0;i<32768;++i){var x=(i&43690)>>1|(i&21845)<<1;x=(x&52428)>>2|(x&13107)<<2,x=(x&61680)>>4|(x&3855)<<4,rev[i]=((x&65280)>>8|(x&255)<<8)>>1}for(var hMap=function(n,t,e){for(var r=n.length,o=0,s=new u16(t);o<r;++o)n[o]&&++s[n[o]-1];var u=new u16(t);for(o=1;o<t;++o)u[o]=u[o-1]+s[o-1]<<1;var l;if(e){l=new u16(1<<t);var c=15-t;for(o=0;o<r;++o)if(n[o])for(var f=o<<4|n[o],d=t-n[o],p=u[n[o]-1]++<<d,v=p|(1<<d)-1;p<=v;++p)l[rev[p]>>c]=f}else for(l=new u16(r),o=0;o<r;++o)n[o]&&(l[o]=rev[u[n[o]-1]++]>>15-n[o]);return l},flt=new u8(288),i=0;i<144;++i)flt[i]=8;for(var i=144;i<256;++i)flt[i]=9;for(var i=256;i<280;++i)flt[i]=7;for(var i=280;i<288;++i)flt[i]=8;for(var fdt=new u8(32),i=0;i<32;++i)fdt[i]=5;var flrm=hMap(flt,9,1),fdrm=hMap(fdt,5,1),max=function(n){for(var t=n[0],e=1;e<n.length;++e)n[e]>t&&(t=n[e]);return t},bits=function(n,t,e){var r=t/8|0;return(n[r]|n[r+1]<<8)>>(t&7)&e},bits16=function(n,t){var e=t/8|0;return(n[e]|n[e+1]<<8|n[e+2]<<16)>>(t&7)},shft=function(n){return(n+7)/8|0},slc=function(n,t,e){return(t==null||t<0)&&(t=0),(e==null||e>n.length)&&(e=n.length),new u8(n.subarray(t,e))},ec=["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"],err=function(n,t,e){var r=new Error(t||ec[n]);if(r.code=n,Error.captureStackTrace&&Error.captureStackTrace(r,err),!e)throw r;return r},inflt=function(n,t,e,r){var o=n.length,s=r?r.length:0;if(!o||t.f&&!t.l)return e||new u8(0);var u=!e,l=u||t.i!=2,c=t.i;u&&(e=new u8(o*3));var f=function(oe){var Z=e.length;if(oe>Z){var de=new u8(Math.max(Z*2,oe));de.set(e),e=de}},d=t.f||0,p=t.p||0,v=t.b||0,g=t.l,h=t.d,m=t.m,y=t.n,A=o*8;do{if(!g){d=bits(n,p,1);var E=bits(n,p+1,3);if(p+=3,E)if(E==1)g=flrm,h=fdrm,m=9,y=5;else if(E==2){var R=bits(n,p,31)+257,S=bits(n,p+10,15)+4,M=R+bits(n,p+5,31)+1;p+=14;for(var B=new u8(M),H=new u8(19),w=0;w<S;++w)H[clim[w]]=bits(n,p+w*3,7);p+=S*3;for(var C=max(H),L=(1<<C)-1,I=hMap(H,C,1),w=0;w<M;){var F=I[bits(n,p,L)];p+=F&15;var b=F>>4;if(b<16)B[w++]=b;else{var k=0,N=0;for(b==16?(N=3+bits(n,p,3),p+=2,k=B[w-1]):b==17?(N=3+bits(n,p,7),p+=3):b==18&&(N=11+bits(n,p,127),p+=7);N--;)B[w++]=k}}var D=B.subarray(0,R),U=B.subarray(R);m=max(D),y=max(U),g=hMap(D,m,1),h=hMap(U,y,1)}else err(1);else{var b=shft(p)+4,T=n[b-4]|n[b-3]<<8,_=b+T;if(_>o){c&&err(0);break}l&&f(v+T),e.set(n.subarray(b,_),v),t.b=v+=T,t.p=p=_*8,t.f=d;continue}if(p>A){c&&err(0);break}}l&&f(v+131072);for(var Q=(1<<m)-1,q=(1<<y)-1,G=p;;G=p){var k=g[bits16(n,p)&Q],J=k>>4;if(p+=k&15,p>A){c&&err(0);break}if(k||err(2),J<256)e[v++]=J;else if(J==256){G=p,g=null;break}else{var X=J-254;if(J>264){var w=J-257,W=fleb[w];X=bits(n,p,(1<<W)-1)+fl[w],p+=W}var j=h[bits16(n,p)&q],te=j>>4;j||err(3),p+=j&15;var U=fd[te];if(te>3){var W=fdeb[te];U+=bits16(n,p)&(1<<W)-1,p+=W}if(p>A){c&&err(0);break}l&&f(v+131072);var $=v+X;if(v<U){var ne=s-U,ie=Math.min(U,$);for(ne+v<0&&err(3);v<ie;++v)e[v]=r[ne+v]}for(;v<$;++v)e[v]=e[v-U]}}t.l=g,t.p=G,t.b=v,t.f=d,g&&(d=1,t.m=m,t.d=h,t.n=y)}while(!d);return v!=e.length&&u?slc(e,0,v):e.subarray(0,v)},et=new u8(0),b2=function(n,t){return n[t]|n[t+1]<<8},b4=function(n,t){return(n[t]|n[t+1]<<8|n[t+2]<<16|n[t+3]<<24)>>>0},b8=function(n,t){return b4(n,t)+b4(n,t+4)*4294967296},zls=function(n,t){return((n[0]&15)!=8||n[0]>>4>7||(n[0]<<8|n[1])%31)&&err(6,"invalid zlib data"),(n[1]>>5&1)==+!t&&err(6,"invalid zlib data: "+(n[1]&32?"need":"unexpected")+" dictionary"),(n[1]>>3&4)+2};function inflateSync(n,t){return inflt(n,{i:2},t&&t.out,t&&t.dictionary)}function unzlibSync(n,t){return inflt(n.subarray(zls(n,t),-4),{i:2},t,t)}var td=typeof TextDecoder!="undefined"&&new TextDecoder,tds=0;try{td.decode(et,{stream:!0}),tds=1}catch(n){}var dutf8=function(n){for(var t="",e=0;;){var r=n[e++],o=(r>127)+(r>223)+(r>239);if(e+o>n.length)return{s:t,r:slc(n,e-1)};o?o==3?(r=((r&15)<<18|(n[e++]&63)<<12|(n[e++]&63)<<6|n[e++]&63)-65536,t+=String.fromCharCode(55296|r>>10,56320|r&1023)):o&1?t+=String.fromCharCode((r&31)<<6|n[e++]&63):t+=String.fromCharCode((r&15)<<12|(n[e++]&63)<<6|n[e++]&63):t+=String.fromCharCode(r)}};function strFromU8(n,t){if(t){for(var e="",r=0;r<n.length;r+=16384)e+=String.fromCharCode.apply(null,n.subarray(r,r+16384));return e}else{if(td)return td.decode(n);var o=dutf8(n),s=o.s,e=o.r;return e.length&&err(8),s}}var slzh=function(n,t){return t+30+b2(n,t+26)+b2(n,t+28)},zh=function(n,t,e){var r=b2(n,t+28),o=strFromU8(n.subarray(t+46,t+46+r),!(b2(n,t+8)&2048)),s=t+46+r,u=b4(n,t+20),l=e&&u==4294967295?z64e(n,s):[u,b4(n,t+24),b4(n,t+42)],c=l[0],f=l[1],d=l[2];return[b2(n,t+10),c,f,o,s+b2(n,t+30)+b2(n,t+32),d]},z64e=function(n,t){for(;b2(n,t)!=1;t+=4+b2(n,t+2));return[b8(n,t+12),b8(n,t+4),b8(n,t+20)]};function unzipSync(n,t){for(var e={},r=n.length-22;b4(n,r)!=101010256;--r)(!r||n.length-r>65558)&&err(13);var o=b2(n,r+8);if(!o)return{};var s=b4(n,r+16),u=s==4294967295||o==65535;if(u){var l=b4(n,r-12);u=b4(n,l)==101075792,u&&(o=b4(n,l+32),s=b4(n,l+48))}for(var c=0;c<o;++c){var f=zh(n,s,u),d=f[0],p=f[1],v=f[2],g=f[3],h=f[4],m=f[5],y=slzh(n,m);s=h,d?d==8?e[g]=inflateSync(n.subarray(y,y+p),{out:new u8(v)}):err(14,"unknown compression type "+d):e[g]=slc(n,y,y+p)}return e}var ROTATE_X_MATRIX=new THREE__namespace.Matrix4().fromArray([1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1]);function loadFbx(n,t){var e;t===void 0&&(t={});var r=(e=t.fetcher)!==null&&e!==void 0?e:new Fetcher({allowHosts:["*"]}),o=0;return Promise.resolve().then(function(){return r.ajax(n,{responseType:"arraybuffer"}).then(function(s){return o=s.body.byteLength,s.body})}).then(function(s){var u;return parse$2(s,{materialType:t.materialType,resourcePath:n.slice(0,n.lastIndexOf("/")+1),search:(u=n.split("?")[1])!==null&&u!==void 0?u:"",fetcher:r})}).then(function(s){var u=s.scene,l=s.unitScale/100,c=new THREE__namespace.Matrix4;return c.makeScale(l,l,l),s.upAxis==="Y"&&c.premultiply(ROTATE_X_MATRIX),u.applyMatrix4(c),{type:"fbx",upAxis:"Z",uri:n,byteLength:o,scene:u,textures:s.textures,dispose:function(){return s.dispose()}}})}function parse$2(n,t){var e;if(isFbxFormatBinary(n))e=new BinaryParser().parse(n);else{var r=convertArrayBufferToString(n);if(!isFbxFormatASCII(r))throw new Error("THREE.FBXLoader: Unknown format.");if(getFbxVersion(r)<7e3)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+getFbxVersion(r));e=new TextParser().parse(r)}return new FBXTreeParser(t).parse(e)}var FBXTreeParser=function(){function n(t){var e,r,o;this.materialType=(e=t.materialType)!==null&&e!==void 0?e:"phong",this.resourcePath=(r=t.resourcePath)!==null&&r!==void 0?r:"",this.search=(o=t.search)!==null&&o!==void 0?o:"",this.fetcher=t.fetcher}return n.prototype.parse=function(t){var e,r,o,s,u,l,c=this.parseConnections(t),f=new THREE__namespace.Group,d=[],p=this.parseImages(t),v=this.parseTextures(t,p,c,d),g=this.parseMaterials(t,v,c),h=this.parseDeformers(t,c),m=new GeometryParser().parse(t,h,c);this.parseScene(t,h,m,g,c,f);var y=(r=(e=t.GlobalSettings.UpAxis)===null||e===void 0?void 0:e.value)!==null&&r!==void 0?r:1,A=(s=(o=t.GlobalSettings.FrontAxis)===null||o===void 0?void 0:o.value)!==null&&s!==void 0?s:2,E=(l=(u=t.GlobalSettings.UnitScaleFactor)===null||u===void 0?void 0:u.value)!==null&&l!==void 0?l:1,b;if(t.GlobalSettings.AmbientColor){var T=t.GlobalSettings.AmbientColor.value,_=T[0],R=T[1],S=T[2];if(_!==0||R!==0||S!==0){var M=new THREE__namespace.Color().setRGB(_,R,S);b=new THREE__namespace.AmbientLight(M,1)}}return Promise.all(d).then(function(B){return{scene:f,textures:B,ambientLight:b,upAxis:["X","Y","Z"][y],frontAxis:["X","Y","Z"][A],unitScale:E,dispose:function(){B.forEach(function(H){return H.dispose()}),g.forEach(function(H){return H.dispose()}),m.forEach(function(H){return H.dispose()})}}})},n.prototype.parseConnections=function(t){var e=new Map;if("Connections"in t){var r=t.Connections.connections;r.forEach(function(o){var s=o[0],u=o[1],l=o[2];e.has(s)||e.set(s,{parents:[],children:[]});var c={ID:u,relationship:l};e.get(s).parents.push(c),e.has(u)||e.set(u,{parents:[],children:[]});var f={ID:s,relationship:l};e.get(u).children.push(f)})}return e},n.prototype.parseImages=function(t){var e={},r={};if("Video"in t.Objects){var o=t.Objects.Video;for(var s in o){var u=o[s],l=parseInt(s);if(e[l]=u.RelativeFilename||u.Filename,"Content"in u){var c=u.Content instanceof ArrayBuffer&&u.Content.byteLength>0,f=typeof u.Content=="string"&&u.Content!=="";if(c||f){var d=this.parseImage(o[s]);r[u.RelativeFilename||u.Filename]=d}}}}for(var l in e){var p=e[l];r[p]!==void 0?e[l]=r[p]:e[l]=e[l].split("\\").pop()}return e},n.prototype.parseImage=function(t){var e=t.Content,r=t.RelativeFilename||t.Filename,o=r.slice(r.lastIndexOf(".")+1).toLowerCase(),s;switch(o){case"bmp":s="image/bmp";break;case"jpg":case"jpeg":s="image/jpeg";break;case"png":s="image/png";break;case"tif":s="image/tiff";break;case"tga":s="image/tga";break;default:return}if(typeof e=="string")return"data:"+s+";base64,"+e;var u=new Uint8Array(e);return window.URL.createObjectURL(new Blob([u],{type:s}))},n.prototype.parseTextures=function(t,e,r,o){var s=new Map;if("Texture"in t.Objects){var u=t.Objects.Texture;for(var l in u){var c=this.parseTexture(u[l],e,r,o);s.set(parseInt(l),c)}}return s},n.prototype.parseTexture=function(t,e,r,o){var s=this.loadTexture(t,e,r,o);s.ID=t.id,s.name=t.attrName;var u=t.WrapModeU,l=t.WrapModeV,c=u!==void 0?u.value:0,f=l!==void 0?l.value:0;if(s.wrapS=c===0?THREE__namespace.RepeatWrapping:THREE__namespace.ClampToEdgeWrapping,s.wrapT=f===0?THREE__namespace.RepeatWrapping:THREE__namespace.ClampToEdgeWrapping,t.Scaling){var d=t.Scaling.value;s.repeat.x=d[0],s.repeat.y=d[1]}if(t.Translation){var d=t.Translation.value;s.offset.x=d[0],s.offset.y=d[1]}return s},n.prototype.loadTexture=function(t,e,r,o){var s=r.get(t.id).children,u="";s!==void 0&&s.length>0&&e[s[0].ID]!==void 0&&(u=e[s[0].ID]),u=pathJoin(this.resourcePath,appendSearch(u,this.search));var l=Object.assign(new THREE__namespace.Texture,{ID:0}),c;c=this.fetcher.loadImage(u,{},void 0,void 0,void 0,createImageBitmapLikeImage()).then(function(d){return d.body});var f=c.then(function(d){return l.image=d,l.needsUpdate=!0,l});return o.push(f),l},n.prototype.parseMaterials=function(t,e,r){var o=new Map;if("Material"in t.Objects){var s=t.Objects.Material;for(var u in s){var l=this.parseMaterial(t,s[u],e,r);l!==null&&o.set(parseInt(u),l)}}return o},n.prototype.parseMaterial=function(t,e,r,o){var s=e.id;e.attrName;var u=e.ShadingModel;if(typeof u=="object"&&(u=u.value),u=u.toLowerCase(),!o.has(s))return null;var l=new PBMMeshMaterial(this.materialType);e.BumpFactor&&(l.bumpScale=e.BumpFactor.value),e.Diffuse?l.color=new THREE__namespace.Color().fromArray(e.Diffuse.value):e.DiffuseColor&&(e.DiffuseColor.type==="Color"||e.DiffuseColor.type==="ColorRGB")&&(l.color=new THREE__namespace.Color().fromArray(e.DiffuseColor.value)),e.DisplacementFactor&&(l.displacementScale=e.DisplacementFactor.value),e.Emissive?l.emissive=new THREE__namespace.Color().fromArray(e.Emissive.value):e.EmissiveColor&&(e.EmissiveColor.type==="Color"||e.EmissiveColor.type==="ColorRGB")&&(l.emissive=new THREE__namespace.Color().fromArray(e.EmissiveColor.value)),e.EmissiveFactor&&(l.emissiveIntensity=parseFloat(e.EmissiveFactor.value));var c=1-(e.TransparencyFactor?parseFloat(e.TransparencyFactor.value):0);(c===1||c===0)&&(c=e.Opacity?parseFloat(e.Opacity.value):null,c===null&&(c=1-(e.TransparentColor?parseFloat(e.TransparentColor.value[0]):0))),l.opacity=c,l.opacity<1&&(l.transparent=!0),e.ReflectionFactor&&(l.reflectivity=e.ReflectionFactor.value),e.Shininess&&(l.shininess=e.Shininess.value),e.Specular?l.specular=new THREE__namespace.Color().fromArray(e.Specular.value):e.SpecularColor&&e.SpecularColor.type==="Color"&&(l.specular=new THREE__namespace.Color().fromArray(e.SpecularColor.value));var f=this;return o.get(s).children.forEach(function(d){var p=d.relationship;switch(p){case"Bump":l.bumpMap=f.getTexture(t,r,d.ID,o);break;case"Maya|TEX_ao_map":l.aoMap=f.getTexture(t,r,d.ID,o);break;case"DiffuseColor":case"Maya|TEX_color_map":l.map=f.getTexture(t,r,d.ID,o),l.map!==void 0&&(l.map.encoding=THREE__namespace.sRGBEncoding);break;case"DisplacementColor":l.displacementMap=f.getTexture(t,r,d.ID,o);break;case"EmissiveColor":l.emissiveMap=f.getTexture(t,r,d.ID,o),l.emissiveMap!==void 0&&(l.emissiveMap.encoding=THREE__namespace.sRGBEncoding);break;case"NormalMap":case"Maya|TEX_normal_map":l.normalMap=f.getTexture(t,r,d.ID,o);break;case"ReflectionColor":l.envMap=f.getTexture(t,r,d.ID,o),l.envMap!==void 0&&(l.envMap.mapping=THREE__namespace.EquirectangularReflectionMapping,l.envMap.encoding=THREE__namespace.sRGBEncoding);break;case"SpecularColor":l.specularMap=f.getTexture(t,r,d.ID,o),l.specularMap!==void 0&&(l.specularMap.encoding=THREE__namespace.sRGBEncoding);break;case"TransparentColor":case"TransparencyFactor":l.alphaMap=f.getTexture(t,r,d.ID,o),l.transparent=!0;break;case"AmbientColor":case"ShininessExponent":case"SpecularFactor":case"VectorDisplacementColor":default:console.warn("THREE.FBXLoader: %s map is not supported in three.js, skipping texture.",p);break}}),l.refreshUniforms(),l},n.prototype.getTexture=function(t,e,r,o){return t.Objects.LayeredTexture&&r in t.Objects.LayeredTexture&&(console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."),r=o.get(r).children[0].ID),e.get(r)},n.prototype.parseDeformers=function(t,e){var r={},o={};if("Deformer"in t.Objects){var s=t.Objects.Deformer;for(var u in s){var l=s[u],c=e.get(parseInt(u));if(l.attrType==="Skin"){var f=this.parseSkeleton(c,s);f.ID=u,c.parents.length>1&&console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."),f.geometryID=c.parents[0].ID,r[u]=f}else if(l.attrType==="BlendShape"){var d={id:u};d.rawTargets=this.parseMorphTargets(c,s,e),d.id=u,c.parents.length>1&&console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."),o[u]=d}}}return{skeletons:r,morphTargets:o}},n.prototype.parseSkeleton=function(t,e){var r=[];return t.children.forEach(function(o){var s=e[o.ID];if(s.attrType==="Cluster"){var u={ID:o.ID,indices:[],weights:[],transformLink:new THREE__namespace.Matrix4().fromArray(s.TransformLink.a)};s.Indexes&&(u.indices=s.Indexes.a,u.weights=s.Weights.a),r.push(u)}}),{ID:"",geometryID:0,rawBones:r,bones:[]}},n.prototype.parseMorphTargets=function(t,e,r){for(var o=[],s=0;s<t.children.length;s++){var u=t.children[s],l=e[u.ID],c={name:l.attrName,initialWeight:l.DeformPercent,id:l.id,fullWeights:l.FullWeights.a,geoID:0};if(l.attrType!=="BlendShapeChannel")return;c.geoID=r.get(parseInt(u.ID)).children.filter(function(f){return f.relationship===void 0})[0].ID,o.push(c)}return o},n.prototype.parseScene=function(t,e,r,o,s,u){var l=this.parseModels(t,e.skeletons,r,o,s),c=t.Objects.Model,f=this;l.forEach(function(p){var v=c[p.ID];f.setLookAtProperties(t,p,v,s,u);var g=s.get(p.ID).parents;g.forEach(function(h){var m=l.get(h.ID);m!==void 0&&m.add(p)}),p.parent===null&&u.add(p)}),this.bindSkeleton(t,e.skeletons,r,l,s),u.traverse(function(p){if(p.userData.transformData){p.parent&&(p.userData.transformData.parentMatrix=p.parent.matrix,p.userData.transformData.parentMatrixWorld=p.parent.matrixWorld);var v=generateTransform(p.userData.transformData);p.applyMatrix4(v),p.updateWorldMatrix(!0,!0)}});var d=new AnimationParser().parse(t,s,u);u.children.length===1&&u.children[0]instanceof THREE__namespace.Group&&(u.children[0].animations=d,u=u.children[0]),u.animations=d},n.prototype.parseModels=function(t,e,r,o,s){var u=new Map,l=t.Objects.Model;for(var c in l){var f=parseInt(c),d=l[c],p=s.get(f),v=this.buildSkeleton(p,e,f,d.attrName);if(!v){switch(d.attrType){case"Camera":v=this.createCamera(t,p);break;case"Light":v=this.createLight(t,p);break;case"Mesh":v=this.createMesh(p,r,o);break;case"NurbsCurve":case"LimbNode":case"Root":v=new THREE__namespace.Bone;break;case"Null":default:v=new THREE__namespace.Group;break}v.name=d.attrName?THREE__namespace.PropertyBinding.sanitizeNodeName(d.attrName):"",v.userData.originalName=d.attrName,v.ID=f}this.getTransformData(v,d),u.set(f,v)}return u},n.prototype.buildSkeleton=function(t,e,r,o){var s=null;return t.parents.forEach(function(u){var l=function(f){var d=e[f];d.rawBones.forEach(function(p,v){if(p.ID===u.ID){var g=s;s=new THREE__namespace.Bone,s.matrixWorld.copy(p.transformLink),s.name=o?THREE__namespace.PropertyBinding.sanitizeNodeName(o):"",s.userData.originalName=o,s.ID=r,d.bones[v]=s,g!==null&&s.add(g)}})};for(var c in e)l(c)}),s},n.prototype.createCamera=function(t,e){var r,o;if(e.children.forEach(function(g){var h=t.Objects.NodeAttribute[g.ID];h!==void 0&&(o=h)}),o===void 0)r=new THREE__namespace.Object3D;else{var s=0;o.CameraProjectionType!==void 0&&o.CameraProjectionType.value===1&&(s=1);var u=1;o.NearPlane!==void 0&&(u=o.NearPlane.value/1e3);var l=1e3;o.FarPlane!==void 0&&(l=o.FarPlane.value/1e3);var c=window.innerWidth,f=window.innerHeight;o.AspectWidth!==void 0&&o.AspectHeight!==void 0&&(c=o.AspectWidth.value,f=o.AspectHeight.value);var d=c/f,p=45;o.FieldOfView!==void 0&&(p=o.FieldOfView.value);var v=o.FocalLength?o.FocalLength.value:null;switch(s){case 0:r=new THREE__namespace.PerspectiveCamera(p,d,u,l),v!==null&&r.setFocalLength(v);break;case 1:console.warn("THREE.FBXLoader: Orthographic cameras not supported yet."),r=new THREE__namespace.Object3D;break;default:console.warn("THREE.FBXLoader: Unknown camera type "+s+"."),r=new THREE__namespace.Object3D;break}}return r},n.prototype.createLight=function(t,e){var r,o;if(e.children.forEach(function(v){var g=t.Objects.NodeAttribute[v.ID];g!==void 0&&(o=g)}),o===void 0)r=new THREE__namespace.Object3D;else{var s=void 0;o.LightType===void 0?s=0:s=o.LightType.value;var u=new THREE__namespace.Color(16777215);o.Color!==void 0&&(u=new THREE__namespace.Color().fromArray(o.Color.value));var l=o.Intensity===void 0?1:o.Intensity.value/100;o.CastLightOnObject!==void 0&&o.CastLightOnObject.value===0&&(l=0);var c=0;o.FarAttenuationEnd!==void 0&&(o.EnableFarAttenuation!==void 0&&o.EnableFarAttenuation.value===0?c=0:c=o.FarAttenuationEnd.value);var f=1;switch(s){case 0:r=new THREE__namespace.PointLight(u,l,c,f);break;case 1:r=new THREE__namespace.DirectionalLight(u,l);break;case 2:var d=Math.PI/3;o.InnerAngle!==void 0&&(d=THREE__namespace.MathUtils.degToRad(o.InnerAngle.value));var p=0;o.OuterAngle!==void 0&&(p=THREE__namespace.MathUtils.degToRad(o.OuterAngle.value),p=Math.max(p,1)),r=new THREE__namespace.SpotLight(u,l,c,d,p,f);break;default:console.warn("THREE.FBXLoader: Unknown light type "+o.LightType.value+", defaulting to a PointLight."),r=new THREE__namespace.PointLight(u,l);break}o.CastShadows!==void 0&&o.CastShadows.value===1&&(r.castShadow=!0)}return r},n.prototype.createMesh=function(t,e,r){var o,s=null,u=[];if(t.children.forEach(function(c){e.has(c.ID)&&(s=e.get(c.ID)),r.has(c.ID)&&u.push(r.get(c.ID))}),u.length===0){var l=new PBMMeshMaterial(this.materialType);l.color=new THREE__namespace.Color(13421772),u.push(l)}return"color"in s.attributes&&u.forEach(function(c){c.vertexColors=!0}),(!s.groups||s.groups.length===0)&&s.addGroup(0,s.index?s.index.count:s.attributes.position.count,0),s.FBX_Deformer?(o=new PBMSkinnedMesh(s,u),o.normalizeSkinWeights()):o=new PBMMesh(s,u),o},n.prototype.createCurve=function(t,e){var r=t.children.reduce(function(s,u){return e.has(u.ID)&&(s=e.get(u.ID)),s},null),o=new THREE__namespace.LineBasicMaterial({name:"",color:3342591,linewidth:1});return new THREE__namespace.Line(r,o)},n.prototype.getTransformData=function(t,e){var r={};e.InheritType&&(r.inheritType=parseInt(e.InheritType.value)),e.RotationOrder?r.eulerOrder=getEulerOrder(e.RotationOrder.value):r.eulerOrder=getEulerOrder(0),e.Lcl_Translation&&(r.translation=e.Lcl_Translation.value),e.PreRotation&&(r.preRotation=e.PreRotation.value),e.Lcl_Rotation&&(r.rotation=e.Lcl_Rotation.value),e.PostRotation&&(r.postRotation=e.PostRotation.value),e.Lcl_Scaling&&(r.scale=e.Lcl_Scaling.value),e.ScalingOffset&&(r.scalingOffset=e.ScalingOffset.value),e.ScalingPivot&&(r.scalingPivot=e.ScalingPivot.value),e.RotationOffset&&(r.rotationOffset=e.RotationOffset.value),e.RotationPivot&&(r.rotationPivot=e.RotationPivot.value),t.userData.transformData=r},n.prototype.setLookAtProperties=function(t,e,r,o,s){if("LookAtProperty"in r){var u=o.get(e.ID).children;u.forEach(function(l){if(l.relationship==="LookAtProperty"){var c=t.Objects.Model[l.ID];if(c.Lcl_Translation){var f=c.Lcl_Translation.value;"target"in e&&e.target instanceof THREE__namespace.Object3D?(e.target.position.fromArray(f),s.add(e.target)):e.lookAt(new THREE__namespace.Vector3().fromArray(f))}}})}},n.prototype.bindSkeleton=function(t,e,r,o,s){var u=this.parsePoseNodes(t),l=function(f){var d=e[f],p=s.get(parseInt(d.ID)).parents;p.forEach(function(v){if(r.has(v.ID)){var g=v.ID,h=s.get(g);h.parents.forEach(function(m){if(o.has(m.ID)){var y=o.get(m.ID);y instanceof THREE__namespace.SkinnedMesh&&y.bind(new THREE__namespace.Skeleton(d.bones),u[m.ID])}})}})};for(var c in e)l(c)},n.prototype.parsePoseNodes=function(t){var e={};if(t.Objects.Pose){var r=t.Objects.Pose;for(var o in r)if(r[o].attrType==="BindPose"&&r[o].NbPoseNodes>0){var s=r[o].PoseNode;Array.isArray(s)?s.forEach(function(u){e[u.Node]=new THREE__namespace.Matrix4().fromArray(u.Matrix.a)}):e[s.Node]=new THREE__namespace.Matrix4().fromArray(s.Matrix.a)}}return e},n}(),GeometryParser=function(){function n(){this.negativeMaterialIndices=!1}return n.prototype.parse=function(t,e,r){var o=new Map;if("Geometry"in t.Objects){var s=t.Objects.Geometry;for(var u in s){var l=r.get(parseInt(u)),c=this.parseGeometry(t,l,s[u],e);o.set(parseInt(u),c)}}return this.negativeMaterialIndices===!0&&console.warn("THREE.FBXLoader: The FBX file contains invalid (negative) material indices. The asset might not render as expected."),o},n.prototype.parseGeometry=function(t,e,r,o){switch(r.attrType){case"Mesh":return this.parseMeshGeometry(t,e,r,o);case"NurbsCurve":return this.parseNurbsGeometry(r)}},n.prototype.parseMeshGeometry=function(t,e,r,o){var s=o.skeletons,u=[],l=e.parents.map(function(v){return t.Objects.Model[v.ID]});if(l.length!==0){var c=e.children.reduce(function(v,g){return s[g.ID]!==void 0&&(v=s[g.ID]),v},null);e.children.forEach(function(v){o.morphTargets[v.ID]!==void 0&&u.push(o.morphTargets[v.ID])});var f=l[0],d={};f.RotationOrder&&(d.eulerOrder=getEulerOrder(f.RotationOrder.value)),f.InheritType&&(d.inheritType=parseInt(f.InheritType.value)),f.GeometricTranslation&&(d.translation=f.GeometricTranslation.value),f.GeometricRotation&&(d.rotation=f.GeometricRotation.value),f.GeometricScaling&&(d.scale=f.GeometricScaling.value);var p=generateTransform(d);return this.genGeometry(t,r,c,u,p)}},n.prototype.genGeometry=function(t,e,r,o,s){var u=new THREE__namespace.BufferGeometry;e.attrName&&(u.name=e.attrName);var l=this.parseGeoNode(e,r),c=this.genBuffers(l),f=new THREE__namespace.Float32BufferAttribute(c.vertex,3);if(f.applyMatrix4(s),u.setAttribute("position",f),c.colors.length>0&&u.setAttribute("color",new THREE__namespace.Float32BufferAttribute(c.colors,3)),r&&(u.setAttribute("skinIndex",new THREE__namespace.Uint16BufferAttribute(c.weightsIndices,4)),u.setAttribute("skinWeight",new THREE__namespace.Float32BufferAttribute(c.vertexWeights,4)),u.FBX_Deformer=r),c.normal.length>0){var d=new THREE__namespace.Matrix3().getNormalMatrix(s),p=new THREE__namespace.Float32BufferAttribute(c.normal,3);p.applyNormalMatrix(d),u.setAttribute("normal",p)}if(c.uvs.forEach(function(y,A){var E=A===0?"uv":"uv".concat(A+1);u.setAttribute(E,new THREE__namespace.Float32BufferAttribute(c.uvs[A],2))}),l.material&&l.material.mappingType!=="AllSame"){var v=c.materialIndex[0],g=0;if(c.materialIndex.forEach(function(y,A){y!==v&&(u.addGroup(g,A-g,v),v=y,g=A)}),u.groups.length>0){var h=u.groups[u.groups.length-1],m=h.start+h.count;m!==c.materialIndex.length&&u.addGroup(m,c.materialIndex.length-m,v)}u.groups.length===0&&u.addGroup(0,c.materialIndex.length,c.materialIndex[0])}return this.addMorphTargets(t,u,e,o,s),u},n.prototype.parseGeoNode=function(t,e){var r={};if(r.vertexPositions=t.Vertices!==void 0?t.Vertices.a:[],r.vertexIndices=t.PolygonVertexIndex!==void 0?t.PolygonVertexIndex.a:[],t.LayerElementColor&&(r.color=this.parseVertexColors(t.LayerElementColor[0])),t.LayerElementMaterial&&(r.material=this.parseMaterialIndices(t.LayerElementMaterial[0])),t.LayerElementNormal&&(r.normal=this.parseNormals(t.LayerElementNormal[0])),t.LayerElementUV){r.uv=[];for(var o=0;t.LayerElementUV[o];)t.LayerElementUV[o].UV&&r.uv.push(this.parseUVs(t.LayerElementUV[o])),o++}return r.weightTable={},e!==null&&(r.skeleton=e,e.rawBones.forEach(function(s,u){s.indices.forEach(function(l,c){r.weightTable[l]===void 0&&(r.weightTable[l]=[]),r.weightTable[l].push({id:u,weight:s.weights[c]})})})),r},n.prototype.genBuffers=function(t){var e={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[],vertexWeights:[],weightsIndices:[]},r=0,o=0,s=!1,u=[],l=[],c=[],f=[],d=[],p=[],v=this;return t.vertexIndices.forEach(function(g,h){var m=0,y=!1;g<0&&(g=g^-1,y=!0);var A=[],E=[];if(u.push(g*3,g*3+1,g*3+2),t.color){var b=getData(h,r,g,t.color);c.push(b[0],b[1],b[2])}if(t.skeleton){if(t.weightTable[g]!==void 0&&t.weightTable[g].forEach(function(S){E.push(S.weight),A.push(S.id)}),E.length>4){s||(console.warn("THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."),s=!0);var T=[0,0,0,0],_=[0,0,0,0];E.forEach(function(S,M){var B=S,H=A[M];_.forEach(function(w,C,L){if(B>w){L[C]=B,B=w;var I=T[C];T[C]=H,H=I}})}),A=T,E=_}for(;E.length<4;)E.push(0),A.push(0);for(var R=0;R<4;++R)d.push(E[R]),p.push(A[R])}if(t.normal){var b=getData(h,r,g,t.normal);l.push(b[0],b[1],b[2])}t.material&&t.material.mappingType!=="AllSame"&&(m=getData(h,r,g,t.material)[0],m<0&&(v.negativeMaterialIndices=!0,m=0)),t.uv&&t.uv.forEach(function(S,M){var B=getData(h,r,g,S);f[M]===void 0&&(f[M]=[]),f[M].push(B[0]),f[M].push(B[1])}),o++,y&&(v.genFace(e,t,u,m,l,c,f,d,p,o),r++,o=0,u=[],l=[],c=[],f=[],d=[],p=[])}),e},n.prototype.getNormalNewell=function(t){for(var e=new THREE__namespace.Vector3(0,0,0),r=0;r<t.length;r++){var o=t[r],s=t[(r+1)%t.length];e.x+=(o.y-s.y)*(o.z+s.z),e.y+=(o.z-s.z)*(o.x+s.x),e.z+=(o.x-s.x)*(o.y+s.y)}return e.normalize(),e},n.prototype.getNormalTangentAndBitangent=function(t){var e=this.getNormalNewell(t),r=Math.abs(e.z)>.5?new THREE__namespace.Vector3(0,1,0):new THREE__namespace.Vector3(0,0,1),o=r.cross(e).normalize(),s=e.clone().cross(o).normalize();return{normal:e,tangent:o,bitangent:s}},n.prototype.flattenVertex=function(t,e,r){return new THREE__namespace.Vector2(t.dot(e),t.dot(r))},n.prototype.genFace=function(t,e,r,o,s,u,l,c,f,d){var p;if(d>3){for(var v=[],g=e.baseVertexPositions||e.vertexPositions,h=0;h<r.length;h+=3)v.push(new THREE__namespace.Vector3(g[r[h]],g[r[h+1]],g[r[h+2]]));for(var m=this.getNormalTangentAndBitangent(v),y=m.tangent,A=m.bitangent,E=[],b=0,T=v;b<T.length;b++){var _=T[b];E.push(this.flattenVertex(_,y,A))}p=THREE__namespace.ShapeUtils.triangulateShape(E,[])}else p=[[0,1,2]];for(var R=function(L,I,F){t.vertex.push(e.vertexPositions[r[L*3]]),t.vertex.push(e.vertexPositions[r[L*3+1]]),t.vertex.push(e.vertexPositions[r[L*3+2]]),t.vertex.push(e.vertexPositions[r[I*3]]),t.vertex.push(e.vertexPositions[r[I*3+1]]),t.vertex.push(e.vertexPositions[r[I*3+2]]),t.vertex.push(e.vertexPositions[r[F*3]]),t.vertex.push(e.vertexPositions[r[F*3+1]]),t.vertex.push(e.vertexPositions[r[F*3+2]]),e.skeleton&&(t.vertexWeights.push(c[L*4]),t.vertexWeights.push(c[L*4+1]),t.vertexWeights.push(c[L*4+2]),t.vertexWeights.push(c[L*4+3]),t.vertexWeights.push(c[I*4]),t.vertexWeights.push(c[I*4+1]),t.vertexWeights.push(c[I*4+2]),t.vertexWeights.push(c[I*4+3]),t.vertexWeights.push(c[F*4]),t.vertexWeights.push(c[F*4+1]),t.vertexWeights.push(c[F*4+2]),t.vertexWeights.push(c[F*4+3]),t.weightsIndices.push(f[L*4]),t.weightsIndices.push(f[L*4+1]),t.weightsIndices.push(f[L*4+2]),t.weightsIndices.push(f[L*4+3]),t.weightsIndices.push(f[I*4]),t.weightsIndices.push(f[I*4+1]),t.weightsIndices.push(f[I*4+2]),t.weightsIndices.push(f[I*4+3]),t.weightsIndices.push(f[F*4]),t.weightsIndices.push(f[F*4+1]),t.weightsIndices.push(f[F*4+2]),t.weightsIndices.push(f[F*4+3])),e.color&&(t.colors.push(u[L*3]),t.colors.push(u[L*3+1]),t.colors.push(u[L*3+2]),t.colors.push(u[I*3]),t.colors.push(u[I*3+1]),t.colors.push(u[I*3+2]),t.colors.push(u[F*3]),t.colors.push(u[F*3+1]),t.colors.push(u[F*3+2])),e.material&&e.material.mappingType!=="AllSame"&&(t.materialIndex.push(o),t.materialIndex.push(o),t.materialIndex.push(o)),e.normal&&(t.normal.push(s[L*3]),t.normal.push(s[L*3+1]),t.normal.push(s[L*3+2]),t.normal.push(s[I*3]),t.normal.push(s[I*3+1]),t.normal.push(s[I*3+2]),t.normal.push(s[F*3]),t.normal.push(s[F*3+1]),t.normal.push(s[F*3+2])),e.uv&&e.uv.forEach(function(k,N){t.uvs[N]===void 0&&(t.uvs[N]=[]),t.uvs[N].push(l[N][L*2]),t.uvs[N].push(l[N][L*2+1]),t.uvs[N].push(l[N][I*2]),t.uvs[N].push(l[N][I*2+1]),t.uvs[N].push(l[N][F*2]),t.uvs[N].push(l[N][F*2+1])})},S=0,M=p;S<M.length;S++){var B=M[S],H=B[0],w=B[1],C=B[2];R(H,w,C)}},n.prototype.addMorphTargets=function(t,e,r,o,s){if(o.length!==0){e.morphTargetsRelative=!0,e.morphAttributes.position=[];var u=this;o.forEach(function(l){l.rawTargets.forEach(function(c){var f=t.Objects.Geometry[c.geoID];f!==void 0&&u.genMorphGeometry(e,r,f,s,c.name)})})}},n.prototype.genMorphGeometry=function(t,e,r,o,s){for(var u=e.Vertices!==void 0?e.Vertices.a:[],l=e.PolygonVertexIndex!==void 0?e.PolygonVertexIndex.a:[],c=r.Vertices!==void 0?r.Vertices.a:[],f=r.Indexes?r.Indexes.a:[],d=t.attributes.position.count*3,p=new Float32Array(d),v=0;v<f.length;v++){var g=f[v]*3;p[g]=c[v*3],p[g+1]=c[v*3+1],p[g+2]=c[v*3+2]}var h={vertexIndices:l,vertexPositions:p,baseVertexPositions:u},m=this.genBuffers(h),y=new THREE__namespace.Float32BufferAttribute(m.vertex,3);y.name=s||r.attrName,y.applyMatrix4(o),t.morphAttributes.position.push(y)},n.prototype.parseNormals=function(t){var e=t.MappingInformationType,r=t.ReferenceInformationType,o=t.Normals.a,s=[];return r==="IndexToDirect"&&(t.NormalIndex?s=t.NormalIndex.a:t.NormalsIndex&&(s=t.NormalsIndex.a)),{dataSize:3,buffer:o,indices:s,mappingType:e,referenceType:r}},n.prototype.parseUVs=function(t){var e=t.MappingInformationType,r=t.ReferenceInformationType,o=t.UV.a,s=[];return r==="IndexToDirect"&&(s=t.UVIndex.a),{dataSize:2,buffer:o,indices:s,mappingType:e,referenceType:r}},n.prototype.parseVertexColors=function(t){var e=t.MappingInformationType,r=t.ReferenceInformationType,o=t.Colors.a,s=[];r==="IndexToDirect"&&(s=t.ColorIndex.a);for(var u=0,l=new THREE__namespace.Color;u<o.length;u+=4)l.fromArray(o,u),l.toArray(o,u);return{dataSize:4,buffer:o,indices:s,mappingType:e,referenceType:r}},n.prototype.parseMaterialIndices=function(t){var e=t.MappingInformationType,r=t.ReferenceInformationType;if(e==="NoMappingInformation")return{dataSize:1,buffer:[0],indices:[0],mappingType:"AllSame",referenceType:r};for(var o=t.Materials.a,s=[],u=0;u<o.length;++u)s.push(u);return{dataSize:1,buffer:o,indices:s,mappingType:e,referenceType:r}},n.prototype.parseNurbsGeometry=function(t){var e=parseInt(t.Order);if(isNaN(e))return console.error("THREE.FBXLoader: Invalid Order %s given for geometry ID: %s",t.Order,t.id),new THREE__namespace.BufferGeometry;for(var r=e-1,o=t.KnotVector.a,s=[],u=t.Points.a,l=0,c=u.length;l<c;l+=4)s.push(new THREE__namespace.Vector4().fromArray(u,l));var f,d;if(t.Form==="Closed")s.push(s[0]);else if(t.Form==="Periodic"){f=r,d=o.length-1-f;for(var l=0;l<r;++l)s.push(s[l])}var p=new NURBSCurve(r,o,s,f,d),v=p.getPoints(s.length*12);return new THREE__namespace.BufferGeometry().setFromPoints(v)},n}(),AnimationParser=function(){function n(){}return n.prototype.parse=function(t,e,r){var o=[],s=this.parseClips(t,e,r);if(s!==void 0)for(var u in s){var l=s[u],c=this.addClip(l,r);o.push(c)}return o},n.prototype.parseClips=function(t,e,r){if(t.Objects.AnimationCurve!==void 0){var o=this.parseAnimationCurveNodes(t);this.parseAnimationCurves(t,o,e);var s=this.parseAnimationLayers(t,o,e,r),u=this.parseAnimStacks(t,s,e);return u}},n.prototype.parseAnimationCurveNodes=function(t){var e=t.Objects.AnimationCurveNode,r=new Map;for(var o in e){var s=e[o];if(s.attrName.match(/S|R|T|DeformPercent/)!==null){var u={id:s.id,attr:s.attrName,curves:{}};r.set(u.id,u)}}return r},n.prototype.parseAnimationCurves=function(t,e,r){var o=t.Objects.AnimationCurve;for(var s in o){var u={id:o[s].id,times:o[s].KeyTime.a.map(convertFBXTimeToSeconds),values:o[s].KeyValueFloat.a},l=r.get(u.id);if(l!==void 0){var c=l.parents[0].ID,f=l.parents[0].relationship,d=e.get(c);d&&(f.match(/X/)?d.curves.x=u:f.match(/Y/)?d.curves.y=u:f.match(/Z/)?d.curves.z=u:f.match(/DeformPercent/)&&e.has(c)&&(d.curves.morph=u))}}},n.prototype.parseAnimationLayers=function(t,e,r,o){var s=t.Objects.AnimationLayer,u=new Map,l=function(f){var d=[],p=r.get(parseInt(f));if(p!==void 0){var v=p.children;v.forEach(function(g,h){if(e.has(g.ID)){var m=e.get(g.ID);if(m.curves.x!==void 0||m.curves.y!==void 0||m.curves.z!==void 0){if(d[h]===void 0){var y=r.get(g.ID).parents.filter(function(M){return M.relationship!==void 0})[0].ID;if(y!==void 0){var A=t.Objects.Model[y.toString()];if(A===void 0){console.warn("THREE.FBXLoader: Encountered a unused curve.",g);return}var E={modelName:A.attrName?THREE__namespace.PropertyBinding.sanitizeNodeName(A.attrName):"",ID:A.id,initialPosition:[0,0,0],initialRotation:[0,0,0],initialScale:[1,1,1],transform:new THREE__namespace.Matrix4,eulerOrder:"",preRotation:[0,0,0],postRotation:[0,0,0]};o.traverse(function(M){M.ID===A.id&&(E.transform=M.matrix,M.userData.transformData&&(E.eulerOrder=M.userData.transformData.eulerOrder))}),E.transform||(E.transform=new THREE__namespace.Matrix4),A.PreRotation&&(E.preRotation=A.PreRotation.value),A.PostRotation&&(E.postRotation=A.PostRotation.value),d[h]=E}}d[h]&&(d[h][m.attr]=m)}else if(m.curves.morph!==void 0){if(d[h]===void 0){var b=r.get(g.ID).parents.filter(function(B){return B.relationship!==void 0})[0].ID,T=r.get(b).parents[0].ID,_=r.get(T).parents[0].ID,y=r.get(_).parents[0].ID,R=t.Objects.Model[y],S={modelName:R.attrName?THREE__namespace.PropertyBinding.sanitizeNodeName(R.attrName):"",morphName:t.Objects.Deformer[b].attrName};d[h]=S}d[h][m.attr]=m}}}),u.set(parseInt(f),d)}};for(var c in s)l(c);return u},n.prototype.parseAnimStacks=function(t,e,r){var o=t.Objects.AnimationStack,s={};for(var u in o){var l=r.get(parseInt(u)).children;l.length>1&&console.warn("THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers.");var c=e.get(l[0].ID);s[u]={name:o[u].attrName,layer:c}}return s},n.prototype.addClip=function(t,e){var r=[],o=this;return t.layer.forEach(function(s){r=r.concat(o.generateTracks(s,e))}),new THREE__namespace.AnimationClip(t.name,-1,r)},n.prototype.generateTracks=function(t,e){var r=[],o=new THREE__namespace.Vector3,s=new THREE__namespace.Vector3;t.transform&&t.transform.decompose(o,new THREE__namespace.Quaternion,s);var u=o.toArray(),l=s.toArray();if(t.T!==void 0&&Object.keys(t.T.curves).length>0){var c=this.generateVectorTrack(t.modelName,t.T.curves,u,"position");c!==void 0&&r.push(c)}if(t.R!==void 0&&Object.keys(t.R.curves).length>0){var f=this.generateRotationTrack(t.modelName,t.R.curves,t.preRotation,t.postRotation,t.eulerOrder);f!==void 0&&r.push(f)}if(t.S!==void 0&&Object.keys(t.S.curves).length>0){var d=this.generateVectorTrack(t.modelName,t.S.curves,l,"scale");d!==void 0&&r.push(d)}if(t.DeformPercent!==void 0){var p=this.generateMorphTrack(t,e);p!==void 0&&r.push(p)}return r},n.prototype.generateVectorTrack=function(t,e,r,o){var s=this.getTimesForAllAxes(e),u=this.getKeyframeTrackValues(s,e,r);return new THREE__namespace.VectorKeyframeTrack(t+"."+o,s,u)},n.prototype.generateRotationTrack=function(t,e,r,o,s){var u,l;if(e.x!==void 0&&e.y!==void 0&&e.z!==void 0){var c=this.interpolateRotations(e.x,e.y,e.z,s);u=c[0],l=c[1]}var f=getEulerOrder(0),d=new THREE__namespace.Quaternion,p=new THREE__namespace.Quaternion;r!==void 0&&(r=r.map(THREE__namespace.MathUtils.degToRad),r.push(f),d.setFromEuler(new THREE__namespace.Euler().fromArray(r))),o!==void 0&&(o=o.map(THREE__namespace.MathUtils.degToRad),o.push(f),p.setFromEuler(new THREE__namespace.Euler().fromArray(o)),p.inverse());var v=new THREE__namespace.Quaternion,g=new THREE__namespace.Euler,h=[];if(!l||!u)return new THREE__namespace.QuaternionKeyframeTrack(t+".quaternion",[0],[0]);for(var m=0;m<l.length;m+=3){if(g.set(l[m],l[m+1],l[m+2],s),v.setFromEuler(g),v.premultiply(d),v.multiply(p),m>2){var y=new THREE__namespace.Quaternion().fromArray(h,(m-3)/3*4);y.dot(v)<0&&v.set(-v.x,-v.y,-v.z,-v.w)}v.toArray(h,m/3*4)}return new THREE__namespace.QuaternionKeyframeTrack(t+".quaternion",u,h)},n.prototype.generateMorphTrack=function(t,e){var r=t.DeformPercent.curves.morph,o=r.values.map(function(u){return u/100}),s=e.getObjectByName(t.modelName).morphTargetDictionary[t.morphName];return new THREE__namespace.NumberKeyframeTrack(t.modelName+".morphTargetInfluences["+s+"]",r.times,o)},n.prototype.getTimesForAllAxes=function(t){var e=[];if(t.x!==void 0&&(e=e.concat(t.x.times)),t.y!==void 0&&(e=e.concat(t.y.times)),t.z!==void 0&&(e=e.concat(t.z.times)),e=e.sort(function(l,c){return l-c}),e.length>1){for(var r=1,o=e[0],s=1;s<e.length;s++){var u=e[s];u!==o&&(e[r]=u,o=u,r++)}e=e.slice(0,r)}return e},n.prototype.getKeyframeTrackValues=function(t,e,r){var o=r,s=[],u=-1,l=-1,c=-1;return t.forEach(function(f){if(e.x&&(u=e.x.times.indexOf(f)),e.y&&(l=e.y.times.indexOf(f)),e.z&&(c=e.z.times.indexOf(f)),u!==-1){var d=e.x.values[u];s.push(d),o[0]=d}else s.push(o[0]);if(l!==-1){var p=e.y.values[l];s.push(p),o[1]=p}else s.push(o[1]);if(c!==-1){var v=e.z.values[c];s.push(v),o[2]=v}else s.push(o[2])}),s},n.prototype.interpolateRotations=function(t,e,r,o){var s=[],u=[];s.push(t.times[0]),u.push(THREE__namespace.MathUtils.degToRad(t.values[0])),u.push(THREE__namespace.MathUtils.degToRad(e.values[0])),u.push(THREE__namespace.MathUtils.degToRad(r.values[0]));for(var l=1;l<t.values.length;l++){var c=[t.values[l-1],e.values[l-1],r.values[l-1]];if(!(isNaN(c[0])||isNaN(c[1])||isNaN(c[2]))){var f=c.map(THREE__namespace.MathUtils.degToRad),d=[t.values[l],e.values[l],r.values[l]];if(!(isNaN(d[0])||isNaN(d[1])||isNaN(d[2]))){d.map(THREE__namespace.MathUtils.degToRad);var p=[d[0]-c[0],d[1]-c[1],d[2]-c[2]],v=[Math.abs(p[0]),Math.abs(p[1]),Math.abs(p[2])];if(v[0]>=180||v[1]>=180||v[2]>=180){var g=Math.max.apply(Math,v),h=g/180,m=new THREE__namespace.Euler(f[0],f[1],f[2],o),y=new THREE__namespace.Euler(f[0],f[1],f[2],o),A=new THREE__namespace.Quaternion().setFromEuler(m),E=new THREE__namespace.Quaternion().setFromEuler(y);A.dot(E)&&E.set(-E.x,-E.y,-E.z,-E.w);for(var b=t.times[l-1],T=t.times[l]-b,_=new THREE__namespace.Quaternion,R=new THREE__namespace.Euler,S=0;S<1;S+=1/h)_.copy(A.clone().slerp(E.clone(),S)),s.push(b+S*T),R.setFromQuaternion(_,o),u.push(R.x),u.push(R.y),u.push(R.z)}else s.push(t.times[l]),u.push(THREE__namespace.MathUtils.degToRad(t.values[l])),u.push(THREE__namespace.MathUtils.degToRad(e.values[l])),u.push(THREE__namespace.MathUtils.degToRad(r.values[l]))}}}return[s,u]},n}(),TextParser=function(){function n(){this.allNodes=new FBXTree,this.nodeStack=[],this.currentIndent=0,this.currentPropName=""}return n.prototype.getPrevNode=function(){return this.nodeStack[this.currentIndent-2]},n.prototype.getCurrentNode=function(){return this.nodeStack[this.currentIndent-1]},n.prototype.getCurrentProp=function(){return this.currentProp},n.prototype.pushStack=function(t){this.nodeStack.push(t),this.currentIndent+=1},n.prototype.popStack=function(){this.nodeStack.pop(),this.currentIndent-=1},n.prototype.setCurrentProp=function(t,e){this.currentProp=t,this.currentPropName=e},n.prototype.parse=function(t){this.currentIndent=0,this.allNodes=new FBXTree,this.nodeStack=[],this.currentProp=[],this.currentPropName="";var e=this,r=t.split(/[\r\n]+/);return r.forEach(function(o,s){var u=o.match(/^[\s\t]*;/),l=o.match(/^[\s\t]*$/);if(!(u||l)){var c=o.match("^\\t{"+e.currentIndent+"}(\\w+):(.*){"),f=o.match("^\\t{"+e.currentIndent+"}(\\w+):[\\s\\t\\r\\n](.*)"),d=o.match("^\\t{"+(e.currentIndent-1)+"}}");c?e.parseNodeBegin(o,c):f?e.parseNodeProperty(o,f,r[++s]):d?e.popStack():o.match(/^[^\s\t}]/)&&e.parseNodePropertyContinued(o)}}),this.allNodes},n.prototype.parseNodeBegin=function(t,e){var r=e[1].trim().replace(/^"/,"").replace(/"$/,""),o=e[2].split(",").map(function(c){return c.trim().replace(/^"/,"").replace(/"$/,"")}),s={name:r},u=this.parseNodeAttr(o),l=this.getCurrentNode();this.currentIndent===0?this.allNodes.add(r,s):r in l?(r==="PoseNode"?l.PoseNode.push(s):l[r].id!==void 0&&(l[r]={},l[r][l[r].id]=l[r]),u.id!==""&&(l[r][u.id]=s)):typeof u.id=="number"?(l[r]={},l[r][u.id]=s):r!=="Properties70"&&(r==="PoseNode"?l[r]=[s]:l[r]=s),typeof u.id=="number"&&(s.id=u.id),u.name!==""&&(s.attrName=u.name),u.type!==""&&(s.attrType=u.type),this.pushStack(s)},n.prototype.parseNodeAttr=function(t){var e=t[0];t[0]!==""&&(e=parseInt(t[0]),isNaN(e)&&(e=t[0]));var r="",o="";return t.length>1&&(r=t[1].replace(/^(\w+)::/,""),o=t[2]),{id:e,name:r,type:o}},n.prototype.parseNodeProperty=function(t,e,r){var o=e[1].replace(/^"/,"").replace(/"$/,"").trim(),s=e[2].replace(/^"/,"").replace(/"$/,"").trim();o==="Content"&&s===","&&(s=r.replace(/"/g,"").replace(/,$/,"").trim());var u=this.getCurrentNode(),l=u.name;if(l==="Properties70"){this.parseNodeSpecialProperty(t,o,s);return}if(o==="C"){var c=s.split(",").slice(1),f=parseInt(c[0]),d=parseInt(c[1]),p=s.split(",").slice(3);p=p.map(function(v){return v.trim().replace(/^"/,"")}),o="connections",s=[f,d],append(s,p),u[o]===void 0&&(u[o]=[])}o==="Node"&&(u.id=s),o in u&&Array.isArray(u[o])?u[o].push(s):o!=="a"?u[o]=s:u.a=s,this.setCurrentProp(u,o),o==="a"&&s.slice(-1)!==","&&(u.a=parseNumberArray(s))},n.prototype.parseNodePropertyContinued=function(t){var e=this.getCurrentNode();e.a+=t,t.slice(-1)!==","&&(e.a=parseNumberArray(e.a))},n.prototype.parseNodeSpecialProperty=function(t,e,r){var o=r.split('",').map(function(d){return d.trim().replace(/^\"/,"").replace(/\s/,"_")}),s=o[0],u=o[1],l=o[2],c=o[3],f=o[4];switch(u){case"int":case"enum":case"bool":case"ULongLong":case"double":case"Number":case"FieldOfView":f=parseFloat(f);break;case"Color":case"ColorRGB":case"Vector3D":case"Lcl_Translation":case"Lcl_Rotation":case"Lcl_Scaling":f=parseNumberArray(f);break}this.getPrevNode()[s]={type:u,type2:l,flag:c,value:f},this.setCurrentProp(this.getPrevNode(),s)},n}(),BinaryParser=function(){function n(){}return n.prototype.parse=function(t){var e=new BinaryReader(t);e.skip(23);var r=e.getUint32();if(r<6400)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+r);for(var o=new FBXTree;!this.endOfContent(e);){var s=this.parseNode(e,r);s!==null&&o.add(s.name,s)}return o},n.prototype.endOfContent=function(t){return t.size()%16===0?(t.getOffset()+160+16&-16)>=t.size():t.getOffset()+160+16>=t.size()},n.prototype.parseNode=function(t,e){var r={},o=e>=7500?t.getUint64():t.getUint32(),s=e>=7500?t.getUint64():t.getUint32();e>=7500?t.getUint64():t.getUint32();var u=t.getUint8(),l=t.getString(u);if(o===0)return null;for(var c=[],f=0;f<s;f++)c.push(this.parseProperty(t));var d=c.length>0?c[0]:"",p=c.length>1?c[1]:"",v=c.length>2?c[2]:"";for(r.singleProperty=s===1&&t.getOffset()===o;o>t.getOffset();){var g=this.parseNode(t,e);g!==null&&this.parseSubNode(l,r,g)}return r.propertyList=c,typeof d=="number"&&(r.id=d),p!==""&&(r.attrName=p),v!==""&&(r.attrType=v),l!==""&&(r.name=l),r},n.prototype.parseSubNode=function(t,e,r){if(r.singleProperty===!0){var o=r.propertyList[0];Array.isArray(o)?(e[r.name]=r,r.a=o):e[r.name]=o}else if(t==="Connections"&&r.name==="C"){var s=[];r.propertyList.forEach(function(v,g){g!==0&&s.push(v)}),e.connections===void 0&&(e.connections=[]),e.connections.push(s)}else if(r.name==="Properties70"){var u=Object.keys(r);u.forEach(function(v){e[v]=r[v]})}else if(t==="Properties70"&&r.name==="P"){var l=r.propertyList[0],c=r.propertyList[1],f=r.propertyList[2],d=r.propertyList[3],p=void 0;l.indexOf("Lcl ")===0&&(l=l.replace("Lcl ","Lcl_")),c.indexOf("Lcl ")===0&&(c=c.replace("Lcl ","Lcl_")),c==="Color"||c==="ColorRGB"||c==="Vector"||c==="Vector3D"||c.indexOf("Lcl_")===0?p=[r.propertyList[4],r.propertyList[5],r.propertyList[6]]:p=r.propertyList[4],e[l]={type:c,type2:f,flag:d,value:p}}else e[r.name]===void 0?typeof r.id=="number"?(e[r.name]={},e[r.name][r.id]=r):e[r.name]=r:r.name==="PoseNode"?(Array.isArray(e[r.name])||(e[r.name]=[e[r.name]]),e[r.name].push(r)):e[r.name][r.id]===void 0&&(e[r.name][r.id]=r)},n.prototype.parseProperty=function(t){var e=t.getString(1),r;switch(e){case"C":return t.getBoolean();case"D":return t.getFloat64();case"F":return t.getFloat32();case"I":return t.getInt32();case"L":return t.getInt64();case"R":return r=t.getUint32(),t.getArrayBuffer(r);case"S":return r=t.getUint32(),t.getString(r);case"Y":return t.getInt16();case"b":case"c":case"d":case"f":case"i":case"l":var o=t.getUint32(),s=t.getUint32(),u=t.getUint32();if(s===0)switch(e){case"b":case"c":return t.getBooleanArray(o);case"d":return t.getFloat64Array(o);case"f":return t.getFloat32Array(o);case"i":return t.getInt32Array(o);case"l":return t.getInt64Array(o)}var l=unzlibSync(new Uint8Array(t.getArrayBuffer(u))),c=new BinaryReader(l.buffer);switch(e){case"b":case"c":return c.getBooleanArray(o);case"d":return c.getFloat64Array(o);case"f":return c.getFloat32Array(o);case"i":return c.getInt32Array(o);case"l":return c.getInt64Array(o)}break;default:throw new Error("THREE.FBXLoader: Unknown property type "+e)}},n}(),BinaryReader=function(){function n(t,e){this.dv=new DataView(t),this.offset=0,this.littleEndian=e!==void 0?e:!0,this._textDecoder=new TextDecoder}return n.prototype.getOffset=function(){return this.offset},n.prototype.size=function(){return this.dv.buffer.byteLength},n.prototype.skip=function(t){this.offset+=t},n.prototype.getBoolean=function(){return(this.getUint8()&1)===1},n.prototype.getBooleanArray=function(t){for(var e=[],r=0;r<t;r++)e.push(this.getBoolean());return e},n.prototype.getUint8=function(){var t=this.dv.getUint8(this.offset);return this.offset+=1,t},n.prototype.getInt16=function(){var t=this.dv.getInt16(this.offset,this.littleEndian);return this.offset+=2,t},n.prototype.getInt32=function(){var t=this.dv.getInt32(this.offset,this.littleEndian);return this.offset+=4,t},n.prototype.getInt32Array=function(t){for(var e=[],r=0;r<t;r++)e.push(this.getInt32());return e},n.prototype.getUint32=function(){var t=this.dv.getUint32(this.offset,this.littleEndian);return this.offset+=4,t},n.prototype.getInt64=function(){var t,e;return this.littleEndian?(t=this.getUint32(),e=this.getUint32()):(e=this.getUint32(),t=this.getUint32()),e&2147483648?(e=~e&4294967295,t=~t&4294967295,t===4294967295&&(e=e+1&4294967295),t=t+1&4294967295,-(e*4294967296+t)):e*4294967296+t},n.prototype.getInt64Array=function(t){for(var e=[],r=0;r<t;r++)e.push(this.getInt64());return e},n.prototype.getUint64=function(){var t,e;return this.littleEndian?(t=this.getUint32(),e=this.getUint32()):(e=this.getUint32(),t=this.getUint32()),e*4294967296+t},n.prototype.getFloat32=function(){var t=this.dv.getFloat32(this.offset,this.littleEndian);return this.offset+=4,t},n.prototype.getFloat32Array=function(t){for(var e=[],r=0;r<t;r++)e.push(this.getFloat32());return e},n.prototype.getFloat64=function(){var t=this.dv.getFloat64(this.offset,this.littleEndian);return this.offset+=8,t},n.prototype.getFloat64Array=function(t){for(var e=[],r=0;r<t;r++)e.push(this.getFloat64());return e},n.prototype.getArrayBuffer=function(t){var e=this.dv.buffer.slice(this.offset,this.offset+t);return this.offset+=t,e},n.prototype.getString=function(t){var e=this.offset,r=new Uint8Array(this.dv.buffer,e,t);this.skip(t);var o=r.indexOf(0);return o>=0&&(r=new Uint8Array(this.dv.buffer,e,o)),this._textDecoder.decode(r)},n}(),FBXTree=function(){function n(){this.Connections={connections:[]},this.Objects={Model:{},NodeAttribute:{},Geometry:{}},this.GlobalSettings={}}return n.prototype.add=function(t,e){this[t]=e},n}();function isFbxFormatBinary(n){var t="Kaydara FBX Binary \0";return n.byteLength>=t.length&&t===convertArrayBufferToString(n,0,t.length)}function isFbxFormatASCII(n){var t=["K","a","y","d","a","r","a","\\","F","B","X","\\","B","i","n","a","r","y","\\","\\"],e=0;function r(u){var l=n[u-1];return n=n.slice(e+u),e++,l}for(var o=0;o<t.length;++o){var s=r(1);if(s===t[o])return!1}return!0}function getFbxVersion(n){var t=/FBXVersion: (\d+)/,e=n.match(t);if(e){var r=parseInt(e[1]);return r}throw new Error("THREE.FBXLoader: Cannot find the version number for the file given.")}function convertFBXTimeToSeconds(n){return n/46186158e3}var dataArray=[];function getData(n,t,e,r){var o;switch(r.mappingType){case"ByPolygonVertex":o=n;break;case"ByPolygon":o=t;break;case"ByVertice":o=e;break;case"AllSame":o=r.indices[0];break;default:console.warn("THREE.FBXLoader: unknown attribute mapping type "+r.mappingType),o=0}r.referenceType==="IndexToDirect"&&(o=r.indices[o]);var s=o*r.dataSize,u=s+r.dataSize;return slice(dataArray,r.buffer,s,u)}var tempEuler=new THREE__namespace.Euler,tempVec=new THREE__namespace.Vector3;function generateTransform(n){var t=new THREE__namespace.Matrix4,e=new THREE__namespace.Matrix4,r=new THREE__namespace.Matrix4,o=new THREE__namespace.Matrix4,s=new THREE__namespace.Matrix4,u=new THREE__namespace.Matrix4,l=new THREE__namespace.Matrix4,c=new THREE__namespace.Matrix4,f=new THREE__namespace.Matrix4,d=new THREE__namespace.Matrix4,p=new THREE__namespace.Matrix4,v=new THREE__namespace.Matrix4,g=n.inheritType?n.inheritType:0;n.translation&&t.setPosition(tempVec.fromArray(n.translation));var h=getEulerOrder(0);if(n.preRotation){var m=n.preRotation.map(THREE__namespace.MathUtils.degToRad);m.push(h),e.makeRotationFromEuler(tempEuler.fromArray(m))}if(n.rotation){var m=n.rotation.map(THREE__namespace.MathUtils.degToRad);m.push(n.eulerOrder||h),r.makeRotationFromEuler(tempEuler.fromArray(m))}if(n.postRotation){var m=n.postRotation.map(THREE__namespace.MathUtils.degToRad);m.push(h),o.makeRotationFromEuler(tempEuler.fromArray(m)),o.copy(new THREE__namespace.Matrix4().getInverse(o))}n.scale&&s.scale(tempVec.fromArray(n.scale)),n.scalingOffset&&l.setPosition(tempVec.fromArray(n.scalingOffset)),n.scalingPivot&&u.setPosition(tempVec.fromArray(n.scalingPivot)),n.rotationOffset&&c.setPosition(tempVec.fromArray(n.rotationOffset)),n.rotationPivot&&f.setPosition(tempVec.fromArray(n.rotationPivot)),n.parentMatrixWorld&&(p.copy(n.parentMatrix),d.copy(n.parentMatrixWorld));var y=e.clone().multiply(r).multiply(o),A=new THREE__namespace.Matrix4;A.extractRotation(d);var E=new THREE__namespace.Matrix4;E.copyPosition(d);var b=new THREE__namespace.Matrix4().getInverse(E).multiply(d),T=new THREE__namespace.Matrix4().getInverse(A).multiply(b),_=s,R=new THREE__namespace.Matrix4;if(g===0)R.copy(A).multiply(y).multiply(T).multiply(_);else if(g===1)R.copy(A).multiply(T).multiply(y).multiply(_);else{var S=new THREE__namespace.Matrix4().scale(new THREE__namespace.Vector3().setFromMatrixScale(p)),M=new THREE__namespace.Matrix4().getInverse(S),B=T.clone().multiply(M);R.copy(A).multiply(y).multiply(B).multiply(_)}var H=new THREE__namespace.Matrix4().getInverse(f),w=new THREE__namespace.Matrix4().getInverse(u),C=t.clone().multiply(c).multiply(f).multiply(e).multiply(r).multiply(o).multiply(H).multiply(l).multiply(u).multiply(s).multiply(w),L=new THREE__namespace.Matrix4().copyPosition(C),I=d.clone().multiply(L);return v.copyPosition(I),C=v.clone().multiply(R),C.premultiply(new THREE__namespace.Matrix4().getInverse(d)),C}function getEulerOrder(n){n=n||0;var t=["ZYX","YZX","XZY","ZXY","YXZ","XYZ"];return n===6?(console.warn("THREE.FBXLoader: unsupported Euler Order: Spherical XYZ. Animations and rotations may be incorrect."),t[0]):t[n]}function parseNumberArray(n){var t=n.split(",").map(function(e){return parseFloat(e)});return t}function convertArrayBufferToString(n,t,e){return t===void 0&&(t=0),e===void 0&&(e=n.byteLength),new TextDecoder().decode(new Uint8Array(n,t,e))}function append(n,t){for(var e=0,r=n.length,o=t.length;e<o;e++,r++)n[r]=t[e]}function slice(n,t,e,r){for(var o=e,s=0;o<r;o++,s++)n[s]=t[o];return n}var NURBSCurve=function(n){__extends(t,n);function t(e,r,o,s,u){var l=n.call(this)||this,c=r?r.length-1:0,f=o?o.length:0;l.degree=e,l.knots=r,l.controlPoints=[],l.startKnot=s||0,l.endKnot=u||c;for(var d=0;d<f;++d){var p=o[d];l.controlPoints[d]=new THREE__namespace.Vector4(p.x,p.y,p.z,p.w)}return l}return t.prototype.getPoint=function(e,r){r===void 0&&(r=new THREE__namespace.Vector3);var o=r,s=this.knots[this.startKnot]+e*(this.knots[this.endKnot]-this.knots[this.startKnot]),u=calcBSplinePoint(this.degree,this.knots,this.controlPoints,s);return u.w!==1&&u.divideScalar(u.w),o.set(u.x,u.y,u.z)},t.prototype.getTangent=function(e,r){r===void 0&&(r=new THREE__namespace.Vector3);var o=r,s=this.knots[0]+e*(this.knots[this.knots.length-1]-this.knots[0]),u=calcNURBSDerivatives(this.degree,this.knots,this.controlPoints,s,1);return o.copy(u[1]).normalize(),o},t.prototype.toJSON=function(){var e=n.prototype.toJSON.call(this);return e.degree=this.degree,e.knots=__spreadArray([],this.knots,!0),e.controlPoints=this.controlPoints.map(function(r){return r.toArray()}),e.startKnot=this.startKnot,e.endKnot=this.endKnot,e},t.prototype.fromJSON=function(e){return n.prototype.fromJSON.call(this,e),this.degree=e.degree,this.knots=__spreadArray([],e.knots,!0),this.controlPoints=e.controlPoints.map(function(r){return new THREE__namespace.Vector4(r[0],r[1],r[2],r[3])}),this.startKnot=e.startKnot,this.endKnot=e.endKnot,this},t}(THREE__namespace.Curve);function findSpan(n,t,e){var r=e.length-n-1;if(t>=e[r])return r-1;if(t<=e[n])return n;for(var o=n,s=r,u=Math.floor((o+s)/2);t<e[u]||t>=e[u+1];)t<e[u]?s=u:o=u,u=Math.floor((o+s)/2);return u}function calcBasisFunctions(n,t,e,r){var o=[],s=[],u=[];o[0]=1;for(var l=1;l<=e;++l){s[l]=t-r[n+1-l],u[l]=r[n+l]-t;for(var c=0,f=0;f<l;++f){var d=u[f+1],p=s[l-f],v=o[f]/(d+p);o[f]=c+d*v,c=p*v}o[l]=c}return o}function calcBSplinePoint(n,t,e,r){for(var o=findSpan(n,r,t),s=calcBasisFunctions(o,r,n,t),u=new THREE__namespace.Vector4(0,0,0,0),l=0;l<=n;++l){var c=e[o-n+l],f=s[l],d=c.w*f;u.x+=c.x*d,u.y+=c.y*d,u.z+=c.z*d,u.w+=c.w*f}return u}function calcBasisFunctionDerivatives(n,t,e,r,o){for(var s=[],u=0;u<=e;++u)s[u]=0;for(var l=[],u=0;u<=r;++u)l[u]=s.slice(0);for(var c=[],u=0;u<=e;++u)c[u]=s.slice(0);c[0][0]=1;for(var f=s.slice(0),d=s.slice(0),p=1;p<=e;++p){f[p]=t-o[n+1-p],d[p]=o[n+p]-t;for(var v=0,g=0;g<p;++g){var h=d[g+1],m=f[p-g];c[p][g]=h+m;var y=c[g][p-1]/c[p][g];c[g][p]=v+h*y,v=m*y}c[p][p]=v}for(var p=0;p<=e;++p)l[0][p]=c[p][e];for(var A=0;A<=e;++A){for(var E=0,b=1,T=[],u=0;u<=e;++u)T[u]=s.slice(0);T[0][0]=1;for(var _=1;_<=r;++_){var R=0,S=A-_,M=e-_;A>=_&&(T[b][0]=T[E][0]/c[M+1][S],R=T[b][0]*c[S][M]);for(var B=S>=-1?1:-S,H=A-1<=M?_-1:e-A,w=B;w<=H;++w)T[b][w]=(T[E][w]-T[E][w-1])/c[M+1][S+w],R+=T[b][w]*c[S+w][M];A<=M&&(T[b][_]=-T[E][_-1]/c[M+1][A],R+=T[b][_]*c[A][M]),l[_][A]=R;var p=E;E=b,b=p}}for(var C=e,_=1;_<=r;++_){for(var p=0;p<=e;++p)l[_][p]*=C;C*=e-_}return l}function calcBSplineDerivatives(n,t,e,r,o){for(var s=o<n?o:n,u=[],l=findSpan(n,r,t),c=calcBasisFunctionDerivatives(l,r,n,s,t),f=[],d=0;d<e.length;++d){var p=e[d].clone(),v=p.w;p.x*=v,p.y*=v,p.z*=v,f[d]=p}for(var g=0;g<=s;++g){for(var p=f[l-n].clone().multiplyScalar(c[g][0]),h=1;h<=n;++h)p.add(f[l-n+h].clone().multiplyScalar(c[g][h]));u[g]=p}for(var g=s+1;g<=o+1;++g)u[g]=new THREE__namespace.Vector4(0,0,0);return u}function calcKoverI(n,t){for(var e=1,r=2;r<=n;++r)e*=r;for(var o=1,r=2;r<=t;++r)o*=r;for(var r=2;r<=n-t;++r)o*=r;return e/o}function calcRationalCurveDerivatives(n){for(var t=n.length,e=[],r=[],o=0;o<t;++o){var s=n[o];e[o]=new THREE__namespace.Vector3(s.x,s.y,s.z),r[o]=s.w}for(var u=[],l=0;l<t;++l){for(var c=e[l].clone(),o=1;o<=l;++o)c.sub(u[l-o].clone().multiplyScalar(calcKoverI(l,o)*r[o]));u[l]=c.divideScalar(r[0])}return u}function calcNURBSDerivatives(n,t,e,r,o){var s=calcBSplineDerivatives(n,t,e,r,o);return calcRationalCurveDerivatives(s)}var _vector=new THREE__namespace.Vector3;function getPointArray(n,t){switch(t){case"D":return new Float64Array(n);case"F":return new Float32Array(n);case"L":return new Int32Array(n);case"I":return new Int16Array(n);default:return new Uint8Array(n)}}function loadX3p(n,t){var e;t===void 0&&(t={});var r=(e=t.fetcher)!==null&&e!==void 0?e:new Fetcher({allowHosts:["*"]}),o={byteLength:0};return Promise.resolve().then(function(){return r.ajax(n,{responseType:"arraybuffer"})}).then(function(s){var u;return o.byteLength=s.body.byteLength,parse$1(new Uint8Array(s.body),{materialType:t.materialType,color:t.color,resourcePath:n.slice(0,n.lastIndexOf("/")+1),search:(u=n.split("?")[1])!==null&&u!==void 0?u:"",fetcher:r})}).then(function(s){var u=new THREE__namespace.Group;return u.matrixAutoUpdate=!1,u.matrix.compose(u.position,u.quaternion,u.scale),u.name=n,u.add(s.object),{type:"x3p",upAxis:"Z",uri:n,byteLength:o.byteLength,scene:u,textures:[],dispose:function(){return s.dispose()}}})}function parse$1(n,t){for(var e,r,o,s,u,l,c,f,d,p,v,g,h,m,y,A,E,b,T,_,R,S,M,B,H,w,C,L,I,F,k,N,D,U,Q,q,G,J,X,W,j,te,$,ne,ie,oe,Z,de,he,fe,Te,ce,ge,ee,re,z=unzipSync(n),Re="",ve=null,me=0,we=Object.keys(z);me<we.length;me++){var ye=we[me];/(^|\/)main\.xml$/i.test(ye)&&(ve=z[ye],Re=ye.slice(0,ye.lastIndexOf("/")+1))}if(!ve)throw new Error("X3p: main.xml not found.");if(typeof DOMParser=="undefined")throw new Error("X3p: DOMParser not found.");var be=(e=t.materialType)!==null&&e!==void 0?e:"phong",pe=(r=t.color)!==null&&r!==void 0?r:new THREE__namespace.Color(10066329),ae=new DOMParser,ue=decodeText(ve),Se=ae.parseFromString(ue,"text/xml"),le=Se.querySelector("Record1 Axes"),Ie={x:{type:(u=(s=(o=le==null?void 0:le.querySelector("CX AxisType"))===null||o===void 0?void 0:o.textContent)===null||s===void 0?void 0:s.toUpperCase())!==null&&u!==void 0?u:"I",dataType:(f=(c=(l=le==null?void 0:le.querySelector("CX DataType"))===null||l===void 0?void 0:l.textContent)===null||c===void 0?void 0:c.toUpperCase())!==null&&f!==void 0?f:"D",increment:Number((p=(d=le==null?void 0:le.querySelector("CX Increment"))===null||d===void 0?void 0:d.textContent)!==null&&p!==void 0?p:"1"),offset:Number((g=(v=le==null?void 0:le.querySelector("CX Offset"))===null||v===void 0?void 0:v.textContent)!==null&&g!==void 0?g:"0")},y:{type:(y=(m=(h=le==null?void 0:le.querySelector("CY AxisType"))===null||h===void 0?void 0:h.textContent)===null||m===void 0?void 0:m.toUpperCase())!==null&&y!==void 0?y:"I",dataType:(b=(E=(A=le==null?void 0:le.querySelector("CY DataType"))===null||A===void 0?void 0:A.textContent)===null||E===void 0?void 0:E.toUpperCase())!==null&&b!==void 0?b:"D",increment:Number((_=(T=le==null?void 0:le.querySelector("CY Increment"))===null||T===void 0?void 0:T.textContent)!==null&&_!==void 0?_:"1"),offset:Number((S=(R=le==null?void 0:le.querySelector("CY Offset"))===null||R===void 0?void 0:R.textContent)!==null&&S!==void 0?S:"0")},z:{type:(H=(B=(M=le==null?void 0:le.querySelector("CZ AxisType"))===null||M===void 0?void 0:M.textContent)===null||B===void 0?void 0:B.toUpperCase())!==null&&H!==void 0?H:"A",dataType:(L=(C=(w=le==null?void 0:le.querySelector("CZ DataType"))===null||w===void 0?void 0:w.textContent)===null||C===void 0?void 0:C.toUpperCase())!==null&&L!==void 0?L:"D",increment:Number((F=(I=le==null?void 0:le.querySelector("CZ Increment"))===null||I===void 0?void 0:I.textContent)!==null&&F!==void 0?F:"1"),offset:Number((N=(k=le==null?void 0:le.querySelector("CZ Offset"))===null||k===void 0?void 0:k.textContent)!==null&&N!==void 0?N:"0")}},Ye=null,Ae=Se.querySelector("Record1 Axes Rotation");Ae&&(Ye=new THREE__namespace.Matrix3,Ye.set(Number((U=(D=Ae.querySelector("r11"))===null||D===void 0?void 0:D.textContent)!==null&&U!==void 0?U:0),Number((q=(Q=Ae.querySelector("r12"))===null||Q===void 0?void 0:Q.textContent)!==null&&q!==void 0?q:0),Number((J=(G=Ae.querySelector("r13"))===null||G===void 0?void 0:G.textContent)!==null&&J!==void 0?J:0),Number((W=(X=Ae.querySelector("r21"))===null||X===void 0?void 0:X.textContent)!==null&&W!==void 0?W:0),Number((te=(j=Ae.querySelector("r22"))===null||j===void 0?void 0:j.textContent)!==null&&te!==void 0?te:0),Number((ne=($=Ae.querySelector("r23"))===null||$===void 0?void 0:$.textContent)!==null&&ne!==void 0?ne:0),Number((oe=(ie=Ae.querySelector("r31"))===null||ie===void 0?void 0:ie.textContent)!==null&&oe!==void 0?oe:0),Number((de=(Z=Ae.querySelector("r32"))===null||Z===void 0?void 0:Z.textContent)!==null&&de!==void 0?de:0),Number((fe=(he=Ae.querySelector("r33"))===null||he===void 0?void 0:he.textContent)!==null&&fe!==void 0?fe:0)));var Ce=(Te=Se.querySelector("Record3 DataLink PointDataLink"))===null||Te===void 0?void 0:Te.textContent;if(typeof Ce!="string")throw new Error("X3p: PointDataLink not found.");Ce=pathJoin(Re,Ce);var Oe=z[Ce];if(!Oe)throw new Error("X3p: ".concat(Oe," not found."));for(var $e=getPointArray(Oe.buffer,Ie.z.dataType),pt=Number((ge=(ce=Se.querySelector("Record3 MatrixDimension SizeX"))===null||ce===void 0?void 0:ce.textContent)!==null&&ge!==void 0?ge:"0"),tt=Number((re=(ee=Se.querySelector("Record3 MatrixDimension SizeY"))===null||ee===void 0?void 0:ee.textContent)!==null&&re!==void 0?re:"0"),Ne=Math.floor(pt-1),qe=Math.floor(tt-1),Ve=Ne+1,Ge=qe+1,Ke=new Float32Array(Ve*Ge*3),Je=new Float32Array(Ve*Ge*2),Pe=new Uint32Array(Ne*qe*6),xe=new THREE__namespace.Box3,Be=0;Be<Ge;Be++)for(var De=Be*Ie.y.increment+Ie.y.offset,He=0;He<Ve;He++){var Ue=Be*Ve+He,Ze=He*Ie.x.increment+Ie.x.offset,ze=$e[Ue],rt=!isNaN(ze),ot=rt?ze:NaN;_vector.set(Ze,-De,ot),Ye&&_vector.applyMatrix3(Ye),rt&&xe.expandByPoint(_vector),Ke[Ue*3+0]=_vector.x,Ke[Ue*3+1]=_vector.y,Ke[Ue*3+2]=_vector.z,Je[Ue*2+0]=He/Ne,Je[Ue*2+1]=1-Be/qe}for(var Be=0;Be<qe;Be++)for(var He=0;He<Ne;He++){var ht=He+Ve*Be,st=He+Ve*(Be+1),ct=He+1+Ve*(Be+1),je=He+1+Ve*Be,Me=(Be*Ne+He)*6;Pe[Me+0]=ht,Pe[Me+1]=st,Pe[Me+2]=je,Pe[Me+3]=st,Pe[Me+4]=ct,Pe[Me+5]=je}var _e=new THREE__namespace.BufferGeometry;_e.setAttribute("position",new THREE__namespace.BufferAttribute(Ke,3)),_e.setAttribute("uv",new THREE__namespace.BufferAttribute(Je,2)),_e.setIndex(new THREE__namespace.BufferAttribute(Pe,1)),(!_e.groups||_e.groups.length===0)&&_e.addGroup(0,_e.index?_e.index.count:_e.attributes.position.count,0),_e.boundingBox=xe;var Le=new PBMMeshMaterial(be);Le.flatShading=!0,Le.color.copy(pe),Le.refreshUniforms();var Qe=new PBMMesh(_e,[Le]);return{object:Qe,dispose:function(){_e.dispose(),Le.dispose()}}}var scratchMatrix4$3=new THREE__namespace.Matrix4,MAX_RETRY_DELAY$1=5e3,RETRY_DELAY_STEP$1=1e3;function attachTileAttributes(n,t){n.name=t.id;var e=t.tileset.properties.floorInfo;n.traverse(function(r){if("floor"in t.extras){if(r instanceof THREE__namespace.Mesh||r instanceof THREE__namespace.Points)for(var o=Array.isArray(r.material)?r.material:r.material?[r.material]:[],s=0,u=o;s<u.length;s++){var l=u[s];(l instanceof PBMMeshMaterial||l instanceof PBMPointCloudMaterial)&&(l.floor=t.extras.floor)}}else if(!(r instanceof PBMPointCloud)){if(r instanceof PBMMesh&&e){for(var c=new THREE__namespace.Box3().expandByObject(r),f=c.getCenter(new THREE__namespace.Vector3),d=0,p=0;p<e.length;p++){var v=e[p],g=v.ground,h=v.height;if(f.y<g+h){d=p;break}}t.floor=d,t.tileset.floorLength=Math.max(t.tileset.floorLength,t.floor+1),r.material.forEach(function(m){return m.floor=d})}}})}function loadTileContent(n,t){if(!n.content)return Promise.resolve(n);var e=n.content,r=appendSearch(e.uri,t.search);if(n.type==="TILESET"){var o=imageURL(r,{key:"model.".concat(n.siblingIndex)});return e.loadState="LOADING",e.loadStateUpdateTime=now(),t.fetcher.ajax(o,{responseType:"text"}).then(function(s){return s.body}).then(function(s){var u=r.slice(0,r.lastIndexOf("/")+1);return normalizeTilesetHeader(JSON.parse(s),u)}).then(function(s){e.loadState="READY",e.loadStateUpdateTime=now(),e.loadfailRetryDelay=0,n.children.length===0&&(n.children=[new Tile("".concat(n.id,".0"),s.root,n.tileset,n)])}).then(function(){return n}).catch(function(s){return e.loadState="FAILED",e.loadStateUpdateTime=now(),e.loadfailRetryDelay=Math.min(e.loadfailRetryDelay+1e3,5e3),Promise.reject(s)})}if(n.type==="SCENEGRAPH")return e.loadState="LOADING",e.loadStateUpdateTime=now(),Promise.resolve().then(function(){var s,u,l,c,f,d,p,v,g,h,m="",y=r.split("#"),A=y[0],E=y[1],b=(E||A).split("?")[0].match(/\.([0-9a-zA-Z]+)$/);if(b&&(m=b[1]),m==="b3dm"){var T=imageURL(r,{key:"model.".concat(n.siblingIndex)});return loadB3dm(T,{upAxis:n.tileset.asset.gltfUpAxis,fetcher:t.fetcher}).then(function(_){return _.scene.applyMatrix4(n.transform),_.scene.updateWorldMatrix(!1,!0),_.scene.matrixAutoUpdate=!1,attachTileAttributes(_.scene,n),_})}if(m==="pnts"){var T=imageURL(r,{key:"model.".concat(n.siblingIndex)});return loadPnts(T,{computeBoundingBox:!1,fetcher:t.fetcher}).then(function(R){if(R.scene.applyMatrix4(n.transform),R.scene.updateWorldMatrix(!1,!0),R.scene.matrixAutoUpdate=!1,n.boundingVolume){var S=n.boundingVolume;R.scene.traverse(function(M){if(M instanceof PBMPointCloud){scratchMatrix4$3.getInverse(M.matrixWorld);var B=new THREE__namespace.Box3;S.getBoundingBox(B),B.applyMatrix4(scratchMatrix4$3),M.geometry.boundingBox=B}})}return attachTileAttributes(R.scene,n),R})}if(m==="glb"){var T=imageURL(r,{key:"model.".concat(n.siblingIndex)});return loadGlb(T,{upAxis:n.tileset.asset.gltfUpAxis,fetcher:t.fetcher}).then(function(R){return R.scene.applyMatrix4(n.transform),R.scene.updateWorldMatrix(!1,!0),R.scene.matrixAutoUpdate=!1,attachTileAttributes(R.scene,n),R})}if(m==="at3d"){var T=n.extras.at3d?r:imageURL(r,{key:"model.".concat(n.siblingIndex)});return loadAt3d(T,{textureBaseUri:(s=n.extras.at3d)===null||s===void 0?void 0:s.textureBaseUri,textureArray:(u=n.extras.at3d)===null||u===void 0?void 0:u.textureArray,textureOptions:(l=n.extras.at3d)===null||l===void 0?void 0:l.textureOptions,fetcher:t.fetcher}).then(function(R){return R.scene.applyMatrix4(n.transform),R.scene.updateWorldMatrix(!1,!0),R.scene.matrixAutoUpdate=!1,R})}if(m==="pbm"){var T=n.extras.pbm?r:imageURL(r,{key:"model.".concat(n.siblingIndex)});return loadPbm(T,{textureBaseUri:(c=n.extras.pbm)===null||c===void 0?void 0:c.textureBaseUri,textureArray:(f=n.extras.pbm)===null||f===void 0?void 0:f.textureArray,textureOptions:(d=n.extras.pbm)===null||d===void 0?void 0:d.textureOptions,fetcher:t.fetcher}).then(function(R){return R.scene.applyMatrix4(n.transform),R.scene.updateWorldMatrix(!1,!0),R.scene.matrixAutoUpdate=!1,R})}if(m==="dome"){var T=n.extras.dome?r:imageURL(r,{key:"model.".concat(n.siblingIndex)});return loadDome(T,{textureBaseUri:(p=n.extras.dome)===null||p===void 0?void 0:p.textureBaseUri,textureOptions:(v=n.extras.dome)===null||v===void 0?void 0:v.textureOptions,fetcher:t.fetcher}).then(function(R){return R.scene.applyMatrix4(n.transform),R.scene.updateWorldMatrix(!1,!0),R.scene.matrixAutoUpdate=!1,R})}if(m==="domez"){var T=n.extras.domez?r:imageURL(r,{key:"model.".concat(n.siblingIndex)});return loadDomez(T,{textureBaseUri:(g=n.extras.domez)===null||g===void 0?void 0:g.textureBaseUri,textureOptions:(h=n.extras.domez)===null||h===void 0?void 0:h.textureOptions,fetcher:t.fetcher}).then(function(R){return R.scene.applyMatrix4(n.transform),R.scene.updateWorldMatrix(!1,!0),R.scene.matrixAutoUpdate=!1,R})}if(m==="ply"){var T=n.extras.ply?r:imageURL(r,{key:"model.".concat(n.siblingIndex)});return loadPly(T,{type:"pbmPointCloud",upAxis:"Z",fetcher:t.fetcher}).then(function(R){return R.scene.applyMatrix4(n.transform),R.scene.updateWorldMatrix(!1,!0),R.scene.matrixAutoUpdate=!1,R})}if(m==="obj"){var T=n.extras.obj?r:imageURL(r,{key:"model.".concat(n.siblingIndex)});return loadObj(T,{upAxis:"Z",fetcher:t.fetcher}).then(function(R){return R.scene.applyMatrix4(n.transform),R.scene.updateWorldMatrix(!1,!0),R.scene.matrixAutoUpdate=!1,R})}if(m==="fbx"){var T=n.extras.obj?r:imageURL(r,{key:"model.".concat(n.siblingIndex)});return loadFbx(T,{fetcher:t.fetcher}).then(function(R){return R.scene.applyMatrix4(n.transform),R.scene.updateWorldMatrix(!1,!0),R.scene.matrixAutoUpdate=!1,R})}if(m==="x3p"){var T=n.extras.x3p?r:imageURL(r,{key:"model.".concat(n.siblingIndex)});return loadX3p(T,{fetcher:t.fetcher}).then(function(R){return R.scene.applyMatrix4(n.transform),R.scene.updateWorldMatrix(!1,!0),R.scene.matrixAutoUpdate=!1,R})}throw new Error("Invalid Tile content: ".concat(r))}).then(function(s){s.scene.traverse(function(l){if(l instanceof PBMPointCloud)l.material.uniforms.geometricError.value=n.geometricError;else if(l instanceof PBMMesh)for(var c=0,f=l.material;c<f.length;c++){var d=f[c];d.uniforms.geometricError.value=n.geometricError}});var u={type:s.type,uri:s.uri,byteLength:s.byteLength,object:new TileNode(n.id,s.scene,s.dispose)};return Promise.resolve().then(function(){return Promise.all([u.object.generateBvhTree(),t.renderer&&s.textures.length<16?initTextures(s.textures,t.renderer,1024*1024):null])}).then(function(){return e.loadState="READY",e.loadStateUpdateTime=now(),e.loadfailRetryDelay=0,e.byteLength=u.byteLength,e.data=u,n}).catch(function(l){return unloadTileContent(n),Promise.reject(l)})}).catch(function(s){return e.loadState="FAILED",e.loadStateUpdateTime=now(),s instanceof NetworkResponseError&&s.httpStatus===0||s instanceof NetworkTimeoutError||s instanceof NetworkProxyError?e.loadfailRetryDelay=clamp$1(e.loadfailRetryDelay+RETRY_DELAY_STEP$1,RETRY_DELAY_STEP$1,MAX_RETRY_DELAY$1):e.loadfailRetryDelay=1/0,Promise.reject(s)});throw new Error("Invalid Tile type: ".concat(n.type))}function unloadTileContent(n){n.content&&(n.content.data&&n.content.data.object.dispose(),n.content.data=void 0,n.content.loadState="UNLOADED",n.content.loadStateUpdateTime=now(),n.content.byteLength=0)}var TrajectoryNode=function(n){__extends(t,n);function t(e,r,o){o===void 0&&(o=noop$1);var s=n.call(this)||this;return s.name=e,s.contentObject=r,s.name=e,s.add(r),s.disposers=[o],s}return t.prototype.update=function(e,r,o){var s=this.contentObject.material[2];s.uniforms.dashOffset.value=(s.uniforms.dashOffset.value-.003)%(s.uniforms.dashSize.value.x+s.uniforms.dashSize.value.y),o.needsRender=!0},t.prototype.dispose=function(){for(var e=0,r=this.disposers;e<r.length;e++){var o=r[e];o()}this.disposers.length=0},t.prototype.clone=function(){return new t(this.name,this.contentObject.clone())},t}(THREE__namespace.Object3D),MAX_RETRY_DELAY=5e3,RETRY_DELAY_STEP=1e3,TRAJECTOR_PIPE_SHADER={vertexShader:`
|
|
934
|
+
`),s={name:""},u=/\s+/,l={},c=0;c<o.length;c++){var f=o[c];if(f=f.trim(),!(f.length===0||f.charAt(0)==="#")){var d=f.indexOf(" "),p=d>=0?f.substring(0,d):f;p=p.toLowerCase();var v=d>=0?f.substring(d+1):"";if(v=v.trim(),p==="newmtl")s={name:v},l[v]=s;else if(p==="ka"||p==="kd"||p==="ks"||p==="ke"){var g=v.split(u,3);s[p]=[parseFloat(g[0]),parseFloat(g[1]),parseFloat(g[2])]}else(p==="map_kd"||p==="map_ks"||p==="map_ke"||p==="norm"||p==="map_bump"||p==="bump"||p==="map_d"||p==="ns"||p==="d"||p==="tr")&&(s[p]=v)}}function h(y){var A={url:"",scale:new THREE__namespace.Vector2(1,1),offset:new THREE__namespace.Vector2(0,0),bumpScale:1},E=y.split(/\s+/),b;return b=E.indexOf("-bm"),b>=0&&(A.bumpScale=parseFloat(E[b+1]),E.splice(b,2)),b=E.indexOf("-s"),b>=0&&(A.scale.set(parseFloat(E[b+1]),parseFloat(E[b+2])),E.splice(b,4)),b=E.indexOf("-o"),b>=0&&(A.offset.set(parseFloat(E[b+1]),parseFloat(E[b+2])),E.splice(b,4)),A.url=E.join(" ").trim(),A}function m(y,A,E){var b=h(E),T=pathJoin(e.path,b.url);return r.loadTexture(T,{fetcher:e.fetcher,encoding:A==="map"||A==="emissiveMap"?THREE__namespace.sRGBEncoding:THREE__namespace.LinearEncoding,minFilter:THREE__namespace.LinearFilter,magFilter:THREE__namespace.LinearFilter,wrapS:THREE__namespace.RepeatWrapping,wrapT:THREE__namespace.RepeatWrapping}).then(function(_){var R=_.body;return R.repeat.copy(b.scale),R.offset.copy(b.offset),y.bumpScale=b.bumpScale,y[A]=R,R})}return{name:n,create:function(y){var A=new PBMMeshMaterial(e.materialType),E=[],b=l[y];if(b){if(b.kd!==void 0&&A.color.fromArray(b.kd),b.ks!==void 0&&A.specular.fromArray(b.ks),b.ke!==void 0&&A.emissive.fromArray(b.ke),b.map_kd!==void 0&&E.push(m(A,"map",b.map_kd)),b.map_ks!==void 0&&E.push(m(A,"specularMap",b.map_ks)),b.map_ke!==void 0&&E.push(m(A,"emissiveMap",b.map_ke)),b.norm!==void 0&&E.push(m(A,"normalMap",b.norm)),b.map_bump!==void 0&&E.push(m(A,"bumpMap",b.map_bump)),b.bump!==void 0&&E.push(m(A,"bumpMap",b.bump)),b.map_d!==void 0&&E.push(m(A,"alphaMap",b.map_d)),b.ns!==void 0&&(A.shininess=parseFloat(b.ns)),b.d!==void 0){var T=parseFloat(b.d);T<1&&(A.opacity=T,A.transparent=!0)}if(b.tr!==void 0){var T=parseFloat(b.tr);T>0&&(A.opacity=1-T,A.transparent=!0)}}var _=Promise.all(E).then(function(R){return A.refreshUniforms(),R});return[A,_]}}}function build(n,t){for(var e,r,o=[],s=[],u=new THREE__namespace.Group,l=function(d,p){var v=n.objects[d],g=v.geometry,h=v.materials,m=!1;if(g.vertices.length===0)return"continue";var y=new THREE__namespace.BufferGeometry;s.push(function(){return y.dispose()}),y.setAttribute("position",new THREE__namespace.BufferAttribute(new Float32Array(g.vertices),3)),g.normals.length>0&&y.setAttribute("normal",new THREE__namespace.BufferAttribute(new Float32Array(g.normals),3)),g.colors.length>0&&(m=!0,y.setAttribute("color",new THREE__namespace.BufferAttribute(new Float32Array(g.colors),3))),g.uvs.length>0&&y.setAttribute("uv",new THREE__namespace.BufferAttribute(new Float32Array(g.uvs),2)),g.index.length>0&&y.setIndex(new THREE__namespace.BufferAttribute(new Uint32Array(g.index),1)),y.computeBoundingBox(),y.computeBoundingSphere();for(var A=[],E=function(S,M){var B=h[S],H=B.name+"_"+B.smooth+"_"+m,w=n.materials[H];if(!w){for(var C=null,L=0,I=t;L<I.length;L++){var F=I[L],k=F.name,N=F.create;k===B.mtllib&&(C=N(B.name))}if(!C){var D=new PBMMeshMaterial;D.refreshUniforms(),C=[D,Promise.resolve([])]}w=C[0],w.name=B.name,w.flatShading=!(B.smooth||y.attributes.normal),w.vertexColors=m,n.materials[H]=w;var U=C[1];o.push(U),s.push(function(){return w.dispose()})}A.push(w)},b=0,T=h.length;b<T;b++)E(b);for(var b=0,T=h.length;b<T;b++){var _=h[b];y.addGroup((e=_.groupStart)!==null&&e!==void 0?e:0,(r=_.groupCount)!==null&&r!==void 0?r:0,b)}var R=new PBMMesh(y,A);R.name=v.name,u.add(R)},c=0,f=n.objects.length;c<f;c++)l(c);return Promise.all(o).then(function(d){for(var p=[],v=0,g=d;v<g.length;v++){var h=g[v];p=p.concat(h)}return{scene:u,textures:p,dispose:function(){return s.forEach(function(m){return m()})}}})}function loadObj(n,t){var e,r,o;t===void 0&&(t={});var s=(e=t.upAxis)!==null&&e!==void 0?e:"Z",u=(r=t.materialType)!==null&&r!==void 0?r:"basic",l=(o=t.fetcher)!==null&&o!==void 0?o:new Fetcher({allowHosts:["*"]}),c=n.slice(0,n.lastIndexOf("/")+1),f=0,d;return Promise.resolve().then(function(){return l.ajax(n,{responseType:"arraybuffer"})}).then(function(p){f=p.body.byteLength;var v=new TextDecoder;return v.decode(p.body)}).then(function(p){return d=parseObj(p),Promise.all(d.materialLibraries.map(function(v){var g=pathJoin(c,v),h=g.slice(0,g.lastIndexOf("/")+1);return l.ajax(g,{responseType:"text"}).then(function(m){return parseMtl(v,m.body,{path:h,materialType:u,fetcher:l})})}))}).then(function(p){return build(d,p)}).then(function(p){var v=new THREE__namespace.Matrix4;return s==="Y"&&v.premultiply(ROTATE_X_MATRIX$1),p.scene.applyMatrix4(v),{type:"obj",upAxis:"Z",uri:n,byteLength:f,scene:p.scene,textures:p.textures,dispose:function(){return p.dispose()}}})}var u8=Uint8Array,u16=Uint16Array,i32=Int32Array,fleb=new u8([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]),fdeb=new u8([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]),clim=new u8([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),freb=function(n,t){for(var e=new u16(31),r=0;r<31;++r)e[r]=t+=1<<n[r-1];for(var o=new i32(e[30]),r=1;r<30;++r)for(var s=e[r];s<e[r+1];++s)o[s]=s-e[r]<<5|r;return{b:e,r:o}},_a$3=freb(fleb,2),fl=_a$3.b,revfl=_a$3.r;fl[28]=258,revfl[258]=28;for(var _b=freb(fdeb,0),fd=_b.b,rev=new u16(32768),i=0;i<32768;++i){var x=(i&43690)>>1|(i&21845)<<1;x=(x&52428)>>2|(x&13107)<<2,x=(x&61680)>>4|(x&3855)<<4,rev[i]=((x&65280)>>8|(x&255)<<8)>>1}for(var hMap=function(n,t,e){for(var r=n.length,o=0,s=new u16(t);o<r;++o)n[o]&&++s[n[o]-1];var u=new u16(t);for(o=1;o<t;++o)u[o]=u[o-1]+s[o-1]<<1;var l;if(e){l=new u16(1<<t);var c=15-t;for(o=0;o<r;++o)if(n[o])for(var f=o<<4|n[o],d=t-n[o],p=u[n[o]-1]++<<d,v=p|(1<<d)-1;p<=v;++p)l[rev[p]>>c]=f}else for(l=new u16(r),o=0;o<r;++o)n[o]&&(l[o]=rev[u[n[o]-1]++]>>15-n[o]);return l},flt=new u8(288),i=0;i<144;++i)flt[i]=8;for(var i=144;i<256;++i)flt[i]=9;for(var i=256;i<280;++i)flt[i]=7;for(var i=280;i<288;++i)flt[i]=8;for(var fdt=new u8(32),i=0;i<32;++i)fdt[i]=5;var flrm=hMap(flt,9,1),fdrm=hMap(fdt,5,1),max=function(n){for(var t=n[0],e=1;e<n.length;++e)n[e]>t&&(t=n[e]);return t},bits=function(n,t,e){var r=t/8|0;return(n[r]|n[r+1]<<8)>>(t&7)&e},bits16=function(n,t){var e=t/8|0;return(n[e]|n[e+1]<<8|n[e+2]<<16)>>(t&7)},shft=function(n){return(n+7)/8|0},slc=function(n,t,e){return(t==null||t<0)&&(t=0),(e==null||e>n.length)&&(e=n.length),new u8(n.subarray(t,e))},ec=["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"],err=function(n,t,e){var r=new Error(t||ec[n]);if(r.code=n,Error.captureStackTrace&&Error.captureStackTrace(r,err),!e)throw r;return r},inflt=function(n,t,e,r){var o=n.length,s=r?r.length:0;if(!o||t.f&&!t.l)return e||new u8(0);var u=!e,l=u||t.i!=2,c=t.i;u&&(e=new u8(o*3));var f=function(se){var ae=e.length;if(se>ae){var fe=new u8(Math.max(ae*2,se));fe.set(e),e=fe}},d=t.f||0,p=t.p||0,v=t.b||0,g=t.l,h=t.d,m=t.m,y=t.n,A=o*8;do{if(!g){d=bits(n,p,1);var E=bits(n,p+1,3);if(p+=3,E)if(E==1)g=flrm,h=fdrm,m=9,y=5;else if(E==2){var R=bits(n,p,31)+257,S=bits(n,p+10,15)+4,M=R+bits(n,p+5,31)+1;p+=14;for(var B=new u8(M),H=new u8(19),w=0;w<S;++w)H[clim[w]]=bits(n,p+w*3,7);p+=S*3;for(var C=max(H),L=(1<<C)-1,I=hMap(H,C,1),w=0;w<M;){var F=I[bits(n,p,L)];p+=F&15;var b=F>>4;if(b<16)B[w++]=b;else{var k=0,N=0;for(b==16?(N=3+bits(n,p,3),p+=2,k=B[w-1]):b==17?(N=3+bits(n,p,7),p+=3):b==18&&(N=11+bits(n,p,127),p+=7);N--;)B[w++]=k}}var D=B.subarray(0,R),U=B.subarray(R);m=max(D),y=max(U),g=hMap(D,m,1),h=hMap(U,y,1)}else err(1);else{var b=shft(p)+4,T=n[b-4]|n[b-3]<<8,_=b+T;if(_>o){c&&err(0);break}l&&f(v+T),e.set(n.subarray(b,_),v),t.b=v+=T,t.p=p=_*8,t.f=d;continue}if(p>A){c&&err(0);break}}l&&f(v+131072);for(var z=(1<<m)-1,G=(1<<y)-1,q=p;;q=p){var k=g[bits16(n,p)&z],K=k>>4;if(p+=k&15,p>A){c&&err(0);break}if(k||err(2),K<256)e[v++]=K;else if(K==256){q=p,g=null;break}else{var j=K-254;if(K>264){var w=K-257,W=fleb[w];j=bits(n,p,(1<<W)-1)+fl[w],p+=W}var X=h[bits16(n,p)&G],ee=X>>4;X||err(3),p+=X&15;var U=fd[ee];if(ee>3){var W=fdeb[ee];U+=bits16(n,p)&(1<<W)-1,p+=W}if(p>A){c&&err(0);break}l&&f(v+131072);var $=v+j;if(v<U){var re=s-U,ie=Math.min(U,$);for(re+v<0&&err(3);v<ie;++v)e[v]=r[re+v]}for(;v<$;++v)e[v]=e[v-U]}}t.l=g,t.p=q,t.b=v,t.f=d,g&&(d=1,t.m=m,t.d=h,t.n=y)}while(!d);return v!=e.length&&u?slc(e,0,v):e.subarray(0,v)},et=new u8(0),b2=function(n,t){return n[t]|n[t+1]<<8},b4=function(n,t){return(n[t]|n[t+1]<<8|n[t+2]<<16|n[t+3]<<24)>>>0},b8=function(n,t){return b4(n,t)+b4(n,t+4)*4294967296},zls=function(n,t){return((n[0]&15)!=8||n[0]>>4>7||(n[0]<<8|n[1])%31)&&err(6,"invalid zlib data"),(n[1]>>5&1)==+!t&&err(6,"invalid zlib data: "+(n[1]&32?"need":"unexpected")+" dictionary"),(n[1]>>3&4)+2};function inflateSync(n,t){return inflt(n,{i:2},t&&t.out,t&&t.dictionary)}function unzlibSync(n,t){return inflt(n.subarray(zls(n,t),-4),{i:2},t,t)}var td=typeof TextDecoder!="undefined"&&new TextDecoder,tds=0;try{td.decode(et,{stream:!0}),tds=1}catch(n){}var dutf8=function(n){for(var t="",e=0;;){var r=n[e++],o=(r>127)+(r>223)+(r>239);if(e+o>n.length)return{s:t,r:slc(n,e-1)};o?o==3?(r=((r&15)<<18|(n[e++]&63)<<12|(n[e++]&63)<<6|n[e++]&63)-65536,t+=String.fromCharCode(55296|r>>10,56320|r&1023)):o&1?t+=String.fromCharCode((r&31)<<6|n[e++]&63):t+=String.fromCharCode((r&15)<<12|(n[e++]&63)<<6|n[e++]&63):t+=String.fromCharCode(r)}};function strFromU8(n,t){if(t){for(var e="",r=0;r<n.length;r+=16384)e+=String.fromCharCode.apply(null,n.subarray(r,r+16384));return e}else{if(td)return td.decode(n);var o=dutf8(n),s=o.s,e=o.r;return e.length&&err(8),s}}var slzh=function(n,t){return t+30+b2(n,t+26)+b2(n,t+28)},zh=function(n,t,e){var r=b2(n,t+28),o=strFromU8(n.subarray(t+46,t+46+r),!(b2(n,t+8)&2048)),s=t+46+r,u=b4(n,t+20),l=e&&u==4294967295?z64e(n,s):[u,b4(n,t+24),b4(n,t+42)],c=l[0],f=l[1],d=l[2];return[b2(n,t+10),c,f,o,s+b2(n,t+30)+b2(n,t+32),d]},z64e=function(n,t){for(;b2(n,t)!=1;t+=4+b2(n,t+2));return[b8(n,t+12),b8(n,t+4),b8(n,t+20)]};function unzipSync(n,t){for(var e={},r=n.length-22;b4(n,r)!=101010256;--r)(!r||n.length-r>65558)&&err(13);var o=b2(n,r+8);if(!o)return{};var s=b4(n,r+16),u=s==4294967295||o==65535;if(u){var l=b4(n,r-12);u=b4(n,l)==101075792,u&&(o=b4(n,l+32),s=b4(n,l+48))}for(var c=0;c<o;++c){var f=zh(n,s,u),d=f[0],p=f[1],v=f[2],g=f[3],h=f[4],m=f[5],y=slzh(n,m);s=h,d?d==8?e[g]=inflateSync(n.subarray(y,y+p),{out:new u8(v)}):err(14,"unknown compression type "+d):e[g]=slc(n,y,y+p)}return e}var ROTATE_X_MATRIX=new THREE__namespace.Matrix4().fromArray([1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1]);function loadFbx(n,t){var e;t===void 0&&(t={});var r=(e=t.fetcher)!==null&&e!==void 0?e:new Fetcher({allowHosts:["*"]}),o=0;return Promise.resolve().then(function(){return r.ajax(n,{responseType:"arraybuffer"}).then(function(s){return o=s.body.byteLength,s.body})}).then(function(s){var u;return parse$2(s,{materialType:t.materialType,resourcePath:n.slice(0,n.lastIndexOf("/")+1),search:(u=n.split("?")[1])!==null&&u!==void 0?u:"",fetcher:r})}).then(function(s){var u=s.scene,l=s.unitScale/100,c=new THREE__namespace.Matrix4;return c.makeScale(l,l,l),s.upAxis==="Y"&&c.premultiply(ROTATE_X_MATRIX),u.applyMatrix4(c),{type:"fbx",upAxis:"Z",uri:n,byteLength:o,scene:u,textures:s.textures,dispose:function(){return s.dispose()}}})}function parse$2(n,t){var e;if(isFbxFormatBinary(n))e=new BinaryParser().parse(n);else{var r=convertArrayBufferToString(n);if(!isFbxFormatASCII(r))throw new Error("THREE.FBXLoader: Unknown format.");if(getFbxVersion(r)<7e3)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+getFbxVersion(r));e=new TextParser().parse(r)}return new FBXTreeParser(t).parse(e)}var FBXTreeParser=function(){function n(t){var e,r,o;this.materialType=(e=t.materialType)!==null&&e!==void 0?e:"phong",this.resourcePath=(r=t.resourcePath)!==null&&r!==void 0?r:"",this.search=(o=t.search)!==null&&o!==void 0?o:"",this.fetcher=t.fetcher}return n.prototype.parse=function(t){var e,r,o,s,u,l,c=this.parseConnections(t),f=new THREE__namespace.Group,d=[],p=this.parseImages(t),v=this.parseTextures(t,p,c,d),g=this.parseMaterials(t,v,c),h=this.parseDeformers(t,c),m=new GeometryParser().parse(t,h,c);this.parseScene(t,h,m,g,c,f);var y=(r=(e=t.GlobalSettings.UpAxis)===null||e===void 0?void 0:e.value)!==null&&r!==void 0?r:1,A=(s=(o=t.GlobalSettings.FrontAxis)===null||o===void 0?void 0:o.value)!==null&&s!==void 0?s:2,E=(l=(u=t.GlobalSettings.UnitScaleFactor)===null||u===void 0?void 0:u.value)!==null&&l!==void 0?l:1,b;if(t.GlobalSettings.AmbientColor){var T=t.GlobalSettings.AmbientColor.value,_=T[0],R=T[1],S=T[2];if(_!==0||R!==0||S!==0){var M=new THREE__namespace.Color().setRGB(_,R,S);b=new THREE__namespace.AmbientLight(M,1)}}return Promise.all(d).then(function(B){return{scene:f,textures:B,ambientLight:b,upAxis:["X","Y","Z"][y],frontAxis:["X","Y","Z"][A],unitScale:E,dispose:function(){B.forEach(function(H){return H.dispose()}),g.forEach(function(H){return H.dispose()}),m.forEach(function(H){return H.dispose()})}}})},n.prototype.parseConnections=function(t){var e=new Map;if("Connections"in t){var r=t.Connections.connections;r.forEach(function(o){var s=o[0],u=o[1],l=o[2];e.has(s)||e.set(s,{parents:[],children:[]});var c={ID:u,relationship:l};e.get(s).parents.push(c),e.has(u)||e.set(u,{parents:[],children:[]});var f={ID:s,relationship:l};e.get(u).children.push(f)})}return e},n.prototype.parseImages=function(t){var e={},r={};if("Video"in t.Objects){var o=t.Objects.Video;for(var s in o){var u=o[s],l=parseInt(s);if(e[l]=u.RelativeFilename||u.Filename,"Content"in u){var c=u.Content instanceof ArrayBuffer&&u.Content.byteLength>0,f=typeof u.Content=="string"&&u.Content!=="";if(c||f){var d=this.parseImage(o[s]);r[u.RelativeFilename||u.Filename]=d}}}}for(var l in e){var p=e[l];r[p]!==void 0?e[l]=r[p]:e[l]=e[l].split("\\").pop()}return e},n.prototype.parseImage=function(t){var e=t.Content,r=t.RelativeFilename||t.Filename,o=r.slice(r.lastIndexOf(".")+1).toLowerCase(),s;switch(o){case"bmp":s="image/bmp";break;case"jpg":case"jpeg":s="image/jpeg";break;case"png":s="image/png";break;case"tif":s="image/tiff";break;case"tga":s="image/tga";break;default:return}if(typeof e=="string")return"data:"+s+";base64,"+e;var u=new Uint8Array(e);return window.URL.createObjectURL(new Blob([u],{type:s}))},n.prototype.parseTextures=function(t,e,r,o){var s=new Map;if("Texture"in t.Objects){var u=t.Objects.Texture;for(var l in u){var c=this.parseTexture(u[l],e,r,o);s.set(parseInt(l),c)}}return s},n.prototype.parseTexture=function(t,e,r,o){var s=this.loadTexture(t,e,r,o);s.ID=t.id,s.name=t.attrName;var u=t.WrapModeU,l=t.WrapModeV,c=u!==void 0?u.value:0,f=l!==void 0?l.value:0;if(s.wrapS=c===0?THREE__namespace.RepeatWrapping:THREE__namespace.ClampToEdgeWrapping,s.wrapT=f===0?THREE__namespace.RepeatWrapping:THREE__namespace.ClampToEdgeWrapping,t.Scaling){var d=t.Scaling.value;s.repeat.x=d[0],s.repeat.y=d[1]}if(t.Translation){var d=t.Translation.value;s.offset.x=d[0],s.offset.y=d[1]}return s},n.prototype.loadTexture=function(t,e,r,o){var s=r.get(t.id).children,u="";s!==void 0&&s.length>0&&e[s[0].ID]!==void 0&&(u=e[s[0].ID]),u=pathJoin(this.resourcePath,appendSearch(u,this.search));var l=Object.assign(new THREE__namespace.Texture,{ID:0}),c;c=this.fetcher.loadImage(u,{},void 0,void 0,void 0,createImageBitmapLikeImage()).then(function(d){return d.body});var f=c.then(function(d){return l.image=d,l.needsUpdate=!0,l});return o.push(f),l},n.prototype.parseMaterials=function(t,e,r){var o=new Map;if("Material"in t.Objects){var s=t.Objects.Material;for(var u in s){var l=this.parseMaterial(t,s[u],e,r);l!==null&&o.set(parseInt(u),l)}}return o},n.prototype.parseMaterial=function(t,e,r,o){var s=e.id;e.attrName;var u=e.ShadingModel;if(typeof u=="object"&&(u=u.value),u=u.toLowerCase(),!o.has(s))return null;var l=new PBMMeshMaterial(this.materialType);e.BumpFactor&&(l.bumpScale=e.BumpFactor.value),e.Diffuse?l.color=new THREE__namespace.Color().fromArray(e.Diffuse.value):e.DiffuseColor&&(e.DiffuseColor.type==="Color"||e.DiffuseColor.type==="ColorRGB")&&(l.color=new THREE__namespace.Color().fromArray(e.DiffuseColor.value)),e.DisplacementFactor&&(l.displacementScale=e.DisplacementFactor.value),e.Emissive?l.emissive=new THREE__namespace.Color().fromArray(e.Emissive.value):e.EmissiveColor&&(e.EmissiveColor.type==="Color"||e.EmissiveColor.type==="ColorRGB")&&(l.emissive=new THREE__namespace.Color().fromArray(e.EmissiveColor.value)),e.EmissiveFactor&&(l.emissiveIntensity=parseFloat(e.EmissiveFactor.value));var c=1-(e.TransparencyFactor?parseFloat(e.TransparencyFactor.value):0);(c===1||c===0)&&(c=e.Opacity?parseFloat(e.Opacity.value):null,c===null&&(c=1-(e.TransparentColor?parseFloat(e.TransparentColor.value[0]):0))),l.opacity=c,l.opacity<1&&(l.transparent=!0),e.ReflectionFactor&&(l.reflectivity=e.ReflectionFactor.value),e.Shininess&&(l.shininess=e.Shininess.value),e.Specular?l.specular=new THREE__namespace.Color().fromArray(e.Specular.value):e.SpecularColor&&e.SpecularColor.type==="Color"&&(l.specular=new THREE__namespace.Color().fromArray(e.SpecularColor.value));var f=this;return o.get(s).children.forEach(function(d){var p=d.relationship;switch(p){case"Bump":l.bumpMap=f.getTexture(t,r,d.ID,o);break;case"Maya|TEX_ao_map":l.aoMap=f.getTexture(t,r,d.ID,o);break;case"DiffuseColor":case"Maya|TEX_color_map":l.map=f.getTexture(t,r,d.ID,o),l.map!==void 0&&(l.map.encoding=THREE__namespace.sRGBEncoding);break;case"DisplacementColor":l.displacementMap=f.getTexture(t,r,d.ID,o);break;case"EmissiveColor":l.emissiveMap=f.getTexture(t,r,d.ID,o),l.emissiveMap!==void 0&&(l.emissiveMap.encoding=THREE__namespace.sRGBEncoding);break;case"NormalMap":case"Maya|TEX_normal_map":l.normalMap=f.getTexture(t,r,d.ID,o);break;case"ReflectionColor":l.envMap=f.getTexture(t,r,d.ID,o),l.envMap!==void 0&&(l.envMap.mapping=THREE__namespace.EquirectangularReflectionMapping,l.envMap.encoding=THREE__namespace.sRGBEncoding);break;case"SpecularColor":l.specularMap=f.getTexture(t,r,d.ID,o),l.specularMap!==void 0&&(l.specularMap.encoding=THREE__namespace.sRGBEncoding);break;case"TransparentColor":case"TransparencyFactor":l.alphaMap=f.getTexture(t,r,d.ID,o),l.transparent=!0;break;case"AmbientColor":case"ShininessExponent":case"SpecularFactor":case"VectorDisplacementColor":default:console.warn("THREE.FBXLoader: %s map is not supported in three.js, skipping texture.",p);break}}),l.refreshUniforms(),l},n.prototype.getTexture=function(t,e,r,o){return t.Objects.LayeredTexture&&r in t.Objects.LayeredTexture&&(console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."),r=o.get(r).children[0].ID),e.get(r)},n.prototype.parseDeformers=function(t,e){var r={},o={};if("Deformer"in t.Objects){var s=t.Objects.Deformer;for(var u in s){var l=s[u],c=e.get(parseInt(u));if(l.attrType==="Skin"){var f=this.parseSkeleton(c,s);f.ID=u,c.parents.length>1&&console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."),f.geometryID=c.parents[0].ID,r[u]=f}else if(l.attrType==="BlendShape"){var d={id:u};d.rawTargets=this.parseMorphTargets(c,s,e),d.id=u,c.parents.length>1&&console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."),o[u]=d}}}return{skeletons:r,morphTargets:o}},n.prototype.parseSkeleton=function(t,e){var r=[];return t.children.forEach(function(o){var s=e[o.ID];if(s.attrType==="Cluster"){var u={ID:o.ID,indices:[],weights:[],transformLink:new THREE__namespace.Matrix4().fromArray(s.TransformLink.a)};s.Indexes&&(u.indices=s.Indexes.a,u.weights=s.Weights.a),r.push(u)}}),{ID:"",geometryID:0,rawBones:r,bones:[]}},n.prototype.parseMorphTargets=function(t,e,r){for(var o=[],s=0;s<t.children.length;s++){var u=t.children[s],l=e[u.ID],c={name:l.attrName,initialWeight:l.DeformPercent,id:l.id,fullWeights:l.FullWeights.a,geoID:0};if(l.attrType!=="BlendShapeChannel")return;c.geoID=r.get(parseInt(u.ID)).children.filter(function(f){return f.relationship===void 0})[0].ID,o.push(c)}return o},n.prototype.parseScene=function(t,e,r,o,s,u){var l=this.parseModels(t,e.skeletons,r,o,s),c=t.Objects.Model,f=this;l.forEach(function(p){var v=c[p.ID];f.setLookAtProperties(t,p,v,s,u);var g=s.get(p.ID).parents;g.forEach(function(h){var m=l.get(h.ID);m!==void 0&&m.add(p)}),p.parent===null&&u.add(p)}),this.bindSkeleton(t,e.skeletons,r,l,s),u.traverse(function(p){if(p.userData.transformData){p.parent&&(p.userData.transformData.parentMatrix=p.parent.matrix,p.userData.transformData.parentMatrixWorld=p.parent.matrixWorld);var v=generateTransform(p.userData.transformData);p.applyMatrix4(v),p.updateWorldMatrix(!0,!0)}});var d=new AnimationParser().parse(t,s,u);u.children.length===1&&u.children[0]instanceof THREE__namespace.Group&&(u.children[0].animations=d,u=u.children[0]),u.animations=d},n.prototype.parseModels=function(t,e,r,o,s){var u=new Map,l=t.Objects.Model;for(var c in l){var f=parseInt(c),d=l[c],p=s.get(f),v=this.buildSkeleton(p,e,f,d.attrName);if(!v){switch(d.attrType){case"Camera":v=this.createCamera(t,p);break;case"Light":v=this.createLight(t,p);break;case"Mesh":v=this.createMesh(p,r,o);break;case"NurbsCurve":case"LimbNode":case"Root":v=new THREE__namespace.Bone;break;case"Null":default:v=new THREE__namespace.Group;break}v.name=d.attrName?THREE__namespace.PropertyBinding.sanitizeNodeName(d.attrName):"",v.userData.originalName=d.attrName,v.ID=f}this.getTransformData(v,d),u.set(f,v)}return u},n.prototype.buildSkeleton=function(t,e,r,o){var s=null;return t.parents.forEach(function(u){var l=function(f){var d=e[f];d.rawBones.forEach(function(p,v){if(p.ID===u.ID){var g=s;s=new THREE__namespace.Bone,s.matrixWorld.copy(p.transformLink),s.name=o?THREE__namespace.PropertyBinding.sanitizeNodeName(o):"",s.userData.originalName=o,s.ID=r,d.bones[v]=s,g!==null&&s.add(g)}})};for(var c in e)l(c)}),s},n.prototype.createCamera=function(t,e){var r,o;if(e.children.forEach(function(g){var h=t.Objects.NodeAttribute[g.ID];h!==void 0&&(o=h)}),o===void 0)r=new THREE__namespace.Object3D;else{var s=0;o.CameraProjectionType!==void 0&&o.CameraProjectionType.value===1&&(s=1);var u=1;o.NearPlane!==void 0&&(u=o.NearPlane.value/1e3);var l=1e3;o.FarPlane!==void 0&&(l=o.FarPlane.value/1e3);var c=window.innerWidth,f=window.innerHeight;o.AspectWidth!==void 0&&o.AspectHeight!==void 0&&(c=o.AspectWidth.value,f=o.AspectHeight.value);var d=c/f,p=45;o.FieldOfView!==void 0&&(p=o.FieldOfView.value);var v=o.FocalLength?o.FocalLength.value:null;switch(s){case 0:r=new THREE__namespace.PerspectiveCamera(p,d,u,l),v!==null&&r.setFocalLength(v);break;case 1:console.warn("THREE.FBXLoader: Orthographic cameras not supported yet."),r=new THREE__namespace.Object3D;break;default:console.warn("THREE.FBXLoader: Unknown camera type "+s+"."),r=new THREE__namespace.Object3D;break}}return r},n.prototype.createLight=function(t,e){var r,o;if(e.children.forEach(function(v){var g=t.Objects.NodeAttribute[v.ID];g!==void 0&&(o=g)}),o===void 0)r=new THREE__namespace.Object3D;else{var s=void 0;o.LightType===void 0?s=0:s=o.LightType.value;var u=new THREE__namespace.Color(16777215);o.Color!==void 0&&(u=new THREE__namespace.Color().fromArray(o.Color.value));var l=o.Intensity===void 0?1:o.Intensity.value/100;o.CastLightOnObject!==void 0&&o.CastLightOnObject.value===0&&(l=0);var c=0;o.FarAttenuationEnd!==void 0&&(o.EnableFarAttenuation!==void 0&&o.EnableFarAttenuation.value===0?c=0:c=o.FarAttenuationEnd.value);var f=1;switch(s){case 0:r=new THREE__namespace.PointLight(u,l,c,f);break;case 1:r=new THREE__namespace.DirectionalLight(u,l);break;case 2:var d=Math.PI/3;o.InnerAngle!==void 0&&(d=THREE__namespace.MathUtils.degToRad(o.InnerAngle.value));var p=0;o.OuterAngle!==void 0&&(p=THREE__namespace.MathUtils.degToRad(o.OuterAngle.value),p=Math.max(p,1)),r=new THREE__namespace.SpotLight(u,l,c,d,p,f);break;default:console.warn("THREE.FBXLoader: Unknown light type "+o.LightType.value+", defaulting to a PointLight."),r=new THREE__namespace.PointLight(u,l);break}o.CastShadows!==void 0&&o.CastShadows.value===1&&(r.castShadow=!0)}return r},n.prototype.createMesh=function(t,e,r){var o,s=null,u=[];if(t.children.forEach(function(c){e.has(c.ID)&&(s=e.get(c.ID)),r.has(c.ID)&&u.push(r.get(c.ID))}),u.length===0){var l=new PBMMeshMaterial(this.materialType);l.color=new THREE__namespace.Color(13421772),u.push(l)}return"color"in s.attributes&&u.forEach(function(c){c.vertexColors=!0}),(!s.groups||s.groups.length===0)&&s.addGroup(0,s.index?s.index.count:s.attributes.position.count,0),s.FBX_Deformer?(o=new PBMSkinnedMesh(s,u),o.normalizeSkinWeights()):o=new PBMMesh(s,u),o},n.prototype.createCurve=function(t,e){var r=t.children.reduce(function(s,u){return e.has(u.ID)&&(s=e.get(u.ID)),s},null),o=new THREE__namespace.LineBasicMaterial({name:"",color:3342591,linewidth:1});return new THREE__namespace.Line(r,o)},n.prototype.getTransformData=function(t,e){var r={};e.InheritType&&(r.inheritType=parseInt(e.InheritType.value)),e.RotationOrder?r.eulerOrder=getEulerOrder(e.RotationOrder.value):r.eulerOrder=getEulerOrder(0),e.Lcl_Translation&&(r.translation=e.Lcl_Translation.value),e.PreRotation&&(r.preRotation=e.PreRotation.value),e.Lcl_Rotation&&(r.rotation=e.Lcl_Rotation.value),e.PostRotation&&(r.postRotation=e.PostRotation.value),e.Lcl_Scaling&&(r.scale=e.Lcl_Scaling.value),e.ScalingOffset&&(r.scalingOffset=e.ScalingOffset.value),e.ScalingPivot&&(r.scalingPivot=e.ScalingPivot.value),e.RotationOffset&&(r.rotationOffset=e.RotationOffset.value),e.RotationPivot&&(r.rotationPivot=e.RotationPivot.value),t.userData.transformData=r},n.prototype.setLookAtProperties=function(t,e,r,o,s){if("LookAtProperty"in r){var u=o.get(e.ID).children;u.forEach(function(l){if(l.relationship==="LookAtProperty"){var c=t.Objects.Model[l.ID];if(c.Lcl_Translation){var f=c.Lcl_Translation.value;"target"in e&&e.target instanceof THREE__namespace.Object3D?(e.target.position.fromArray(f),s.add(e.target)):e.lookAt(new THREE__namespace.Vector3().fromArray(f))}}})}},n.prototype.bindSkeleton=function(t,e,r,o,s){var u=this.parsePoseNodes(t),l=function(f){var d=e[f],p=s.get(parseInt(d.ID)).parents;p.forEach(function(v){if(r.has(v.ID)){var g=v.ID,h=s.get(g);h.parents.forEach(function(m){if(o.has(m.ID)){var y=o.get(m.ID);y instanceof THREE__namespace.SkinnedMesh&&y.bind(new THREE__namespace.Skeleton(d.bones),u[m.ID])}})}})};for(var c in e)l(c)},n.prototype.parsePoseNodes=function(t){var e={};if(t.Objects.Pose){var r=t.Objects.Pose;for(var o in r)if(r[o].attrType==="BindPose"&&r[o].NbPoseNodes>0){var s=r[o].PoseNode;Array.isArray(s)?s.forEach(function(u){e[u.Node]=new THREE__namespace.Matrix4().fromArray(u.Matrix.a)}):e[s.Node]=new THREE__namespace.Matrix4().fromArray(s.Matrix.a)}}return e},n}(),GeometryParser=function(){function n(){this.negativeMaterialIndices=!1}return n.prototype.parse=function(t,e,r){var o=new Map;if("Geometry"in t.Objects){var s=t.Objects.Geometry;for(var u in s){var l=r.get(parseInt(u)),c=this.parseGeometry(t,l,s[u],e);o.set(parseInt(u),c)}}return this.negativeMaterialIndices===!0&&console.warn("THREE.FBXLoader: The FBX file contains invalid (negative) material indices. The asset might not render as expected."),o},n.prototype.parseGeometry=function(t,e,r,o){switch(r.attrType){case"Mesh":return this.parseMeshGeometry(t,e,r,o);case"NurbsCurve":return this.parseNurbsGeometry(r)}},n.prototype.parseMeshGeometry=function(t,e,r,o){var s=o.skeletons,u=[],l=e.parents.map(function(v){return t.Objects.Model[v.ID]});if(l.length!==0){var c=e.children.reduce(function(v,g){return s[g.ID]!==void 0&&(v=s[g.ID]),v},null);e.children.forEach(function(v){o.morphTargets[v.ID]!==void 0&&u.push(o.morphTargets[v.ID])});var f=l[0],d={};f.RotationOrder&&(d.eulerOrder=getEulerOrder(f.RotationOrder.value)),f.InheritType&&(d.inheritType=parseInt(f.InheritType.value)),f.GeometricTranslation&&(d.translation=f.GeometricTranslation.value),f.GeometricRotation&&(d.rotation=f.GeometricRotation.value),f.GeometricScaling&&(d.scale=f.GeometricScaling.value);var p=generateTransform(d);return this.genGeometry(t,r,c,u,p)}},n.prototype.genGeometry=function(t,e,r,o,s){var u=new THREE__namespace.BufferGeometry;e.attrName&&(u.name=e.attrName);var l=this.parseGeoNode(e,r),c=this.genBuffers(l),f=new THREE__namespace.Float32BufferAttribute(c.vertex,3);if(f.applyMatrix4(s),u.setAttribute("position",f),c.colors.length>0&&u.setAttribute("color",new THREE__namespace.Float32BufferAttribute(c.colors,3)),r&&(u.setAttribute("skinIndex",new THREE__namespace.Uint16BufferAttribute(c.weightsIndices,4)),u.setAttribute("skinWeight",new THREE__namespace.Float32BufferAttribute(c.vertexWeights,4)),u.FBX_Deformer=r),c.normal.length>0){var d=new THREE__namespace.Matrix3().getNormalMatrix(s),p=new THREE__namespace.Float32BufferAttribute(c.normal,3);p.applyNormalMatrix(d),u.setAttribute("normal",p)}if(c.uvs.forEach(function(y,A){var E=A===0?"uv":"uv".concat(A+1);u.setAttribute(E,new THREE__namespace.Float32BufferAttribute(c.uvs[A],2))}),l.material&&l.material.mappingType!=="AllSame"){var v=c.materialIndex[0],g=0;if(c.materialIndex.forEach(function(y,A){y!==v&&(u.addGroup(g,A-g,v),v=y,g=A)}),u.groups.length>0){var h=u.groups[u.groups.length-1],m=h.start+h.count;m!==c.materialIndex.length&&u.addGroup(m,c.materialIndex.length-m,v)}u.groups.length===0&&u.addGroup(0,c.materialIndex.length,c.materialIndex[0])}return this.addMorphTargets(t,u,e,o,s),u},n.prototype.parseGeoNode=function(t,e){var r={};if(r.vertexPositions=t.Vertices!==void 0?t.Vertices.a:[],r.vertexIndices=t.PolygonVertexIndex!==void 0?t.PolygonVertexIndex.a:[],t.LayerElementColor&&(r.color=this.parseVertexColors(t.LayerElementColor[0])),t.LayerElementMaterial&&(r.material=this.parseMaterialIndices(t.LayerElementMaterial[0])),t.LayerElementNormal&&(r.normal=this.parseNormals(t.LayerElementNormal[0])),t.LayerElementUV){r.uv=[];for(var o=0;t.LayerElementUV[o];)t.LayerElementUV[o].UV&&r.uv.push(this.parseUVs(t.LayerElementUV[o])),o++}return r.weightTable={},e!==null&&(r.skeleton=e,e.rawBones.forEach(function(s,u){s.indices.forEach(function(l,c){r.weightTable[l]===void 0&&(r.weightTable[l]=[]),r.weightTable[l].push({id:u,weight:s.weights[c]})})})),r},n.prototype.genBuffers=function(t){var e={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[],vertexWeights:[],weightsIndices:[]},r=0,o=0,s=!1,u=[],l=[],c=[],f=[],d=[],p=[],v=this;return t.vertexIndices.forEach(function(g,h){var m=0,y=!1;g<0&&(g=g^-1,y=!0);var A=[],E=[];if(u.push(g*3,g*3+1,g*3+2),t.color){var b=getData(h,r,g,t.color);c.push(b[0],b[1],b[2])}if(t.skeleton){if(t.weightTable[g]!==void 0&&t.weightTable[g].forEach(function(S){E.push(S.weight),A.push(S.id)}),E.length>4){s||(console.warn("THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."),s=!0);var T=[0,0,0,0],_=[0,0,0,0];E.forEach(function(S,M){var B=S,H=A[M];_.forEach(function(w,C,L){if(B>w){L[C]=B,B=w;var I=T[C];T[C]=H,H=I}})}),A=T,E=_}for(;E.length<4;)E.push(0),A.push(0);for(var R=0;R<4;++R)d.push(E[R]),p.push(A[R])}if(t.normal){var b=getData(h,r,g,t.normal);l.push(b[0],b[1],b[2])}t.material&&t.material.mappingType!=="AllSame"&&(m=getData(h,r,g,t.material)[0],m<0&&(v.negativeMaterialIndices=!0,m=0)),t.uv&&t.uv.forEach(function(S,M){var B=getData(h,r,g,S);f[M]===void 0&&(f[M]=[]),f[M].push(B[0]),f[M].push(B[1])}),o++,y&&(v.genFace(e,t,u,m,l,c,f,d,p,o),r++,o=0,u=[],l=[],c=[],f=[],d=[],p=[])}),e},n.prototype.getNormalNewell=function(t){for(var e=new THREE__namespace.Vector3(0,0,0),r=0;r<t.length;r++){var o=t[r],s=t[(r+1)%t.length];e.x+=(o.y-s.y)*(o.z+s.z),e.y+=(o.z-s.z)*(o.x+s.x),e.z+=(o.x-s.x)*(o.y+s.y)}return e.normalize(),e},n.prototype.getNormalTangentAndBitangent=function(t){var e=this.getNormalNewell(t),r=Math.abs(e.z)>.5?new THREE__namespace.Vector3(0,1,0):new THREE__namespace.Vector3(0,0,1),o=r.cross(e).normalize(),s=e.clone().cross(o).normalize();return{normal:e,tangent:o,bitangent:s}},n.prototype.flattenVertex=function(t,e,r){return new THREE__namespace.Vector2(t.dot(e),t.dot(r))},n.prototype.genFace=function(t,e,r,o,s,u,l,c,f,d){var p;if(d>3){for(var v=[],g=e.baseVertexPositions||e.vertexPositions,h=0;h<r.length;h+=3)v.push(new THREE__namespace.Vector3(g[r[h]],g[r[h+1]],g[r[h+2]]));for(var m=this.getNormalTangentAndBitangent(v),y=m.tangent,A=m.bitangent,E=[],b=0,T=v;b<T.length;b++){var _=T[b];E.push(this.flattenVertex(_,y,A))}p=THREE__namespace.ShapeUtils.triangulateShape(E,[])}else p=[[0,1,2]];for(var R=function(L,I,F){t.vertex.push(e.vertexPositions[r[L*3]]),t.vertex.push(e.vertexPositions[r[L*3+1]]),t.vertex.push(e.vertexPositions[r[L*3+2]]),t.vertex.push(e.vertexPositions[r[I*3]]),t.vertex.push(e.vertexPositions[r[I*3+1]]),t.vertex.push(e.vertexPositions[r[I*3+2]]),t.vertex.push(e.vertexPositions[r[F*3]]),t.vertex.push(e.vertexPositions[r[F*3+1]]),t.vertex.push(e.vertexPositions[r[F*3+2]]),e.skeleton&&(t.vertexWeights.push(c[L*4]),t.vertexWeights.push(c[L*4+1]),t.vertexWeights.push(c[L*4+2]),t.vertexWeights.push(c[L*4+3]),t.vertexWeights.push(c[I*4]),t.vertexWeights.push(c[I*4+1]),t.vertexWeights.push(c[I*4+2]),t.vertexWeights.push(c[I*4+3]),t.vertexWeights.push(c[F*4]),t.vertexWeights.push(c[F*4+1]),t.vertexWeights.push(c[F*4+2]),t.vertexWeights.push(c[F*4+3]),t.weightsIndices.push(f[L*4]),t.weightsIndices.push(f[L*4+1]),t.weightsIndices.push(f[L*4+2]),t.weightsIndices.push(f[L*4+3]),t.weightsIndices.push(f[I*4]),t.weightsIndices.push(f[I*4+1]),t.weightsIndices.push(f[I*4+2]),t.weightsIndices.push(f[I*4+3]),t.weightsIndices.push(f[F*4]),t.weightsIndices.push(f[F*4+1]),t.weightsIndices.push(f[F*4+2]),t.weightsIndices.push(f[F*4+3])),e.color&&(t.colors.push(u[L*3]),t.colors.push(u[L*3+1]),t.colors.push(u[L*3+2]),t.colors.push(u[I*3]),t.colors.push(u[I*3+1]),t.colors.push(u[I*3+2]),t.colors.push(u[F*3]),t.colors.push(u[F*3+1]),t.colors.push(u[F*3+2])),e.material&&e.material.mappingType!=="AllSame"&&(t.materialIndex.push(o),t.materialIndex.push(o),t.materialIndex.push(o)),e.normal&&(t.normal.push(s[L*3]),t.normal.push(s[L*3+1]),t.normal.push(s[L*3+2]),t.normal.push(s[I*3]),t.normal.push(s[I*3+1]),t.normal.push(s[I*3+2]),t.normal.push(s[F*3]),t.normal.push(s[F*3+1]),t.normal.push(s[F*3+2])),e.uv&&e.uv.forEach(function(k,N){t.uvs[N]===void 0&&(t.uvs[N]=[]),t.uvs[N].push(l[N][L*2]),t.uvs[N].push(l[N][L*2+1]),t.uvs[N].push(l[N][I*2]),t.uvs[N].push(l[N][I*2+1]),t.uvs[N].push(l[N][F*2]),t.uvs[N].push(l[N][F*2+1])})},S=0,M=p;S<M.length;S++){var B=M[S],H=B[0],w=B[1],C=B[2];R(H,w,C)}},n.prototype.addMorphTargets=function(t,e,r,o,s){if(o.length!==0){e.morphTargetsRelative=!0,e.morphAttributes.position=[];var u=this;o.forEach(function(l){l.rawTargets.forEach(function(c){var f=t.Objects.Geometry[c.geoID];f!==void 0&&u.genMorphGeometry(e,r,f,s,c.name)})})}},n.prototype.genMorphGeometry=function(t,e,r,o,s){for(var u=e.Vertices!==void 0?e.Vertices.a:[],l=e.PolygonVertexIndex!==void 0?e.PolygonVertexIndex.a:[],c=r.Vertices!==void 0?r.Vertices.a:[],f=r.Indexes?r.Indexes.a:[],d=t.attributes.position.count*3,p=new Float32Array(d),v=0;v<f.length;v++){var g=f[v]*3;p[g]=c[v*3],p[g+1]=c[v*3+1],p[g+2]=c[v*3+2]}var h={vertexIndices:l,vertexPositions:p,baseVertexPositions:u},m=this.genBuffers(h),y=new THREE__namespace.Float32BufferAttribute(m.vertex,3);y.name=s||r.attrName,y.applyMatrix4(o),t.morphAttributes.position.push(y)},n.prototype.parseNormals=function(t){var e=t.MappingInformationType,r=t.ReferenceInformationType,o=t.Normals.a,s=[];return r==="IndexToDirect"&&(t.NormalIndex?s=t.NormalIndex.a:t.NormalsIndex&&(s=t.NormalsIndex.a)),{dataSize:3,buffer:o,indices:s,mappingType:e,referenceType:r}},n.prototype.parseUVs=function(t){var e=t.MappingInformationType,r=t.ReferenceInformationType,o=t.UV.a,s=[];return r==="IndexToDirect"&&(s=t.UVIndex.a),{dataSize:2,buffer:o,indices:s,mappingType:e,referenceType:r}},n.prototype.parseVertexColors=function(t){var e=t.MappingInformationType,r=t.ReferenceInformationType,o=t.Colors.a,s=[];r==="IndexToDirect"&&(s=t.ColorIndex.a);for(var u=0,l=new THREE__namespace.Color;u<o.length;u+=4)l.fromArray(o,u),l.toArray(o,u);return{dataSize:4,buffer:o,indices:s,mappingType:e,referenceType:r}},n.prototype.parseMaterialIndices=function(t){var e=t.MappingInformationType,r=t.ReferenceInformationType;if(e==="NoMappingInformation")return{dataSize:1,buffer:[0],indices:[0],mappingType:"AllSame",referenceType:r};for(var o=t.Materials.a,s=[],u=0;u<o.length;++u)s.push(u);return{dataSize:1,buffer:o,indices:s,mappingType:e,referenceType:r}},n.prototype.parseNurbsGeometry=function(t){var e=parseInt(t.Order);if(isNaN(e))return console.error("THREE.FBXLoader: Invalid Order %s given for geometry ID: %s",t.Order,t.id),new THREE__namespace.BufferGeometry;for(var r=e-1,o=t.KnotVector.a,s=[],u=t.Points.a,l=0,c=u.length;l<c;l+=4)s.push(new THREE__namespace.Vector4().fromArray(u,l));var f,d;if(t.Form==="Closed")s.push(s[0]);else if(t.Form==="Periodic"){f=r,d=o.length-1-f;for(var l=0;l<r;++l)s.push(s[l])}var p=new NURBSCurve(r,o,s,f,d),v=p.getPoints(s.length*12);return new THREE__namespace.BufferGeometry().setFromPoints(v)},n}(),AnimationParser=function(){function n(){}return n.prototype.parse=function(t,e,r){var o=[],s=this.parseClips(t,e,r);if(s!==void 0)for(var u in s){var l=s[u],c=this.addClip(l,r);o.push(c)}return o},n.prototype.parseClips=function(t,e,r){if(t.Objects.AnimationCurve!==void 0){var o=this.parseAnimationCurveNodes(t);this.parseAnimationCurves(t,o,e);var s=this.parseAnimationLayers(t,o,e,r),u=this.parseAnimStacks(t,s,e);return u}},n.prototype.parseAnimationCurveNodes=function(t){var e=t.Objects.AnimationCurveNode,r=new Map;for(var o in e){var s=e[o];if(s.attrName.match(/S|R|T|DeformPercent/)!==null){var u={id:s.id,attr:s.attrName,curves:{}};r.set(u.id,u)}}return r},n.prototype.parseAnimationCurves=function(t,e,r){var o=t.Objects.AnimationCurve;for(var s in o){var u={id:o[s].id,times:o[s].KeyTime.a.map(convertFBXTimeToSeconds),values:o[s].KeyValueFloat.a},l=r.get(u.id);if(l!==void 0){var c=l.parents[0].ID,f=l.parents[0].relationship,d=e.get(c);d&&(f.match(/X/)?d.curves.x=u:f.match(/Y/)?d.curves.y=u:f.match(/Z/)?d.curves.z=u:f.match(/DeformPercent/)&&e.has(c)&&(d.curves.morph=u))}}},n.prototype.parseAnimationLayers=function(t,e,r,o){var s=t.Objects.AnimationLayer,u=new Map,l=function(f){var d=[],p=r.get(parseInt(f));if(p!==void 0){var v=p.children;v.forEach(function(g,h){if(e.has(g.ID)){var m=e.get(g.ID);if(m.curves.x!==void 0||m.curves.y!==void 0||m.curves.z!==void 0){if(d[h]===void 0){var y=r.get(g.ID).parents.filter(function(M){return M.relationship!==void 0})[0].ID;if(y!==void 0){var A=t.Objects.Model[y.toString()];if(A===void 0){console.warn("THREE.FBXLoader: Encountered a unused curve.",g);return}var E={modelName:A.attrName?THREE__namespace.PropertyBinding.sanitizeNodeName(A.attrName):"",ID:A.id,initialPosition:[0,0,0],initialRotation:[0,0,0],initialScale:[1,1,1],transform:new THREE__namespace.Matrix4,eulerOrder:"",preRotation:[0,0,0],postRotation:[0,0,0]};o.traverse(function(M){M.ID===A.id&&(E.transform=M.matrix,M.userData.transformData&&(E.eulerOrder=M.userData.transformData.eulerOrder))}),E.transform||(E.transform=new THREE__namespace.Matrix4),A.PreRotation&&(E.preRotation=A.PreRotation.value),A.PostRotation&&(E.postRotation=A.PostRotation.value),d[h]=E}}d[h]&&(d[h][m.attr]=m)}else if(m.curves.morph!==void 0){if(d[h]===void 0){var b=r.get(g.ID).parents.filter(function(B){return B.relationship!==void 0})[0].ID,T=r.get(b).parents[0].ID,_=r.get(T).parents[0].ID,y=r.get(_).parents[0].ID,R=t.Objects.Model[y],S={modelName:R.attrName?THREE__namespace.PropertyBinding.sanitizeNodeName(R.attrName):"",morphName:t.Objects.Deformer[b].attrName};d[h]=S}d[h][m.attr]=m}}}),u.set(parseInt(f),d)}};for(var c in s)l(c);return u},n.prototype.parseAnimStacks=function(t,e,r){var o=t.Objects.AnimationStack,s={};for(var u in o){var l=r.get(parseInt(u)).children;l.length>1&&console.warn("THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers.");var c=e.get(l[0].ID);s[u]={name:o[u].attrName,layer:c}}return s},n.prototype.addClip=function(t,e){var r=[],o=this;return t.layer.forEach(function(s){r=r.concat(o.generateTracks(s,e))}),new THREE__namespace.AnimationClip(t.name,-1,r)},n.prototype.generateTracks=function(t,e){var r=[],o=new THREE__namespace.Vector3,s=new THREE__namespace.Vector3;t.transform&&t.transform.decompose(o,new THREE__namespace.Quaternion,s);var u=o.toArray(),l=s.toArray();if(t.T!==void 0&&Object.keys(t.T.curves).length>0){var c=this.generateVectorTrack(t.modelName,t.T.curves,u,"position");c!==void 0&&r.push(c)}if(t.R!==void 0&&Object.keys(t.R.curves).length>0){var f=this.generateRotationTrack(t.modelName,t.R.curves,t.preRotation,t.postRotation,t.eulerOrder);f!==void 0&&r.push(f)}if(t.S!==void 0&&Object.keys(t.S.curves).length>0){var d=this.generateVectorTrack(t.modelName,t.S.curves,l,"scale");d!==void 0&&r.push(d)}if(t.DeformPercent!==void 0){var p=this.generateMorphTrack(t,e);p!==void 0&&r.push(p)}return r},n.prototype.generateVectorTrack=function(t,e,r,o){var s=this.getTimesForAllAxes(e),u=this.getKeyframeTrackValues(s,e,r);return new THREE__namespace.VectorKeyframeTrack(t+"."+o,s,u)},n.prototype.generateRotationTrack=function(t,e,r,o,s){var u,l;if(e.x!==void 0&&e.y!==void 0&&e.z!==void 0){var c=this.interpolateRotations(e.x,e.y,e.z,s);u=c[0],l=c[1]}var f=getEulerOrder(0),d=new THREE__namespace.Quaternion,p=new THREE__namespace.Quaternion;r!==void 0&&(r=r.map(THREE__namespace.MathUtils.degToRad),r.push(f),d.setFromEuler(new THREE__namespace.Euler().fromArray(r))),o!==void 0&&(o=o.map(THREE__namespace.MathUtils.degToRad),o.push(f),p.setFromEuler(new THREE__namespace.Euler().fromArray(o)),p.inverse());var v=new THREE__namespace.Quaternion,g=new THREE__namespace.Euler,h=[];if(!l||!u)return new THREE__namespace.QuaternionKeyframeTrack(t+".quaternion",[0],[0]);for(var m=0;m<l.length;m+=3){if(g.set(l[m],l[m+1],l[m+2],s),v.setFromEuler(g),v.premultiply(d),v.multiply(p),m>2){var y=new THREE__namespace.Quaternion().fromArray(h,(m-3)/3*4);y.dot(v)<0&&v.set(-v.x,-v.y,-v.z,-v.w)}v.toArray(h,m/3*4)}return new THREE__namespace.QuaternionKeyframeTrack(t+".quaternion",u,h)},n.prototype.generateMorphTrack=function(t,e){var r=t.DeformPercent.curves.morph,o=r.values.map(function(u){return u/100}),s=e.getObjectByName(t.modelName).morphTargetDictionary[t.morphName];return new THREE__namespace.NumberKeyframeTrack(t.modelName+".morphTargetInfluences["+s+"]",r.times,o)},n.prototype.getTimesForAllAxes=function(t){var e=[];if(t.x!==void 0&&(e=e.concat(t.x.times)),t.y!==void 0&&(e=e.concat(t.y.times)),t.z!==void 0&&(e=e.concat(t.z.times)),e=e.sort(function(l,c){return l-c}),e.length>1){for(var r=1,o=e[0],s=1;s<e.length;s++){var u=e[s];u!==o&&(e[r]=u,o=u,r++)}e=e.slice(0,r)}return e},n.prototype.getKeyframeTrackValues=function(t,e,r){var o=r,s=[],u=-1,l=-1,c=-1;return t.forEach(function(f){if(e.x&&(u=e.x.times.indexOf(f)),e.y&&(l=e.y.times.indexOf(f)),e.z&&(c=e.z.times.indexOf(f)),u!==-1){var d=e.x.values[u];s.push(d),o[0]=d}else s.push(o[0]);if(l!==-1){var p=e.y.values[l];s.push(p),o[1]=p}else s.push(o[1]);if(c!==-1){var v=e.z.values[c];s.push(v),o[2]=v}else s.push(o[2])}),s},n.prototype.interpolateRotations=function(t,e,r,o){var s=[],u=[];s.push(t.times[0]),u.push(THREE__namespace.MathUtils.degToRad(t.values[0])),u.push(THREE__namespace.MathUtils.degToRad(e.values[0])),u.push(THREE__namespace.MathUtils.degToRad(r.values[0]));for(var l=1;l<t.values.length;l++){var c=[t.values[l-1],e.values[l-1],r.values[l-1]];if(!(isNaN(c[0])||isNaN(c[1])||isNaN(c[2]))){var f=c.map(THREE__namespace.MathUtils.degToRad),d=[t.values[l],e.values[l],r.values[l]];if(!(isNaN(d[0])||isNaN(d[1])||isNaN(d[2]))){d.map(THREE__namespace.MathUtils.degToRad);var p=[d[0]-c[0],d[1]-c[1],d[2]-c[2]],v=[Math.abs(p[0]),Math.abs(p[1]),Math.abs(p[2])];if(v[0]>=180||v[1]>=180||v[2]>=180){var g=Math.max.apply(Math,v),h=g/180,m=new THREE__namespace.Euler(f[0],f[1],f[2],o),y=new THREE__namespace.Euler(f[0],f[1],f[2],o),A=new THREE__namespace.Quaternion().setFromEuler(m),E=new THREE__namespace.Quaternion().setFromEuler(y);A.dot(E)&&E.set(-E.x,-E.y,-E.z,-E.w);for(var b=t.times[l-1],T=t.times[l]-b,_=new THREE__namespace.Quaternion,R=new THREE__namespace.Euler,S=0;S<1;S+=1/h)_.copy(A.clone().slerp(E.clone(),S)),s.push(b+S*T),R.setFromQuaternion(_,o),u.push(R.x),u.push(R.y),u.push(R.z)}else s.push(t.times[l]),u.push(THREE__namespace.MathUtils.degToRad(t.values[l])),u.push(THREE__namespace.MathUtils.degToRad(e.values[l])),u.push(THREE__namespace.MathUtils.degToRad(r.values[l]))}}}return[s,u]},n}(),TextParser=function(){function n(){this.allNodes=new FBXTree,this.nodeStack=[],this.currentIndent=0,this.currentPropName=""}return n.prototype.getPrevNode=function(){return this.nodeStack[this.currentIndent-2]},n.prototype.getCurrentNode=function(){return this.nodeStack[this.currentIndent-1]},n.prototype.getCurrentProp=function(){return this.currentProp},n.prototype.pushStack=function(t){this.nodeStack.push(t),this.currentIndent+=1},n.prototype.popStack=function(){this.nodeStack.pop(),this.currentIndent-=1},n.prototype.setCurrentProp=function(t,e){this.currentProp=t,this.currentPropName=e},n.prototype.parse=function(t){this.currentIndent=0,this.allNodes=new FBXTree,this.nodeStack=[],this.currentProp=[],this.currentPropName="";var e=this,r=t.split(/[\r\n]+/);return r.forEach(function(o,s){var u=o.match(/^[\s\t]*;/),l=o.match(/^[\s\t]*$/);if(!(u||l)){var c=o.match("^\\t{"+e.currentIndent+"}(\\w+):(.*){"),f=o.match("^\\t{"+e.currentIndent+"}(\\w+):[\\s\\t\\r\\n](.*)"),d=o.match("^\\t{"+(e.currentIndent-1)+"}}");c?e.parseNodeBegin(o,c):f?e.parseNodeProperty(o,f,r[++s]):d?e.popStack():o.match(/^[^\s\t}]/)&&e.parseNodePropertyContinued(o)}}),this.allNodes},n.prototype.parseNodeBegin=function(t,e){var r=e[1].trim().replace(/^"/,"").replace(/"$/,""),o=e[2].split(",").map(function(c){return c.trim().replace(/^"/,"").replace(/"$/,"")}),s={name:r},u=this.parseNodeAttr(o),l=this.getCurrentNode();this.currentIndent===0?this.allNodes.add(r,s):r in l?(r==="PoseNode"?l.PoseNode.push(s):l[r].id!==void 0&&(l[r]={},l[r][l[r].id]=l[r]),u.id!==""&&(l[r][u.id]=s)):typeof u.id=="number"?(l[r]={},l[r][u.id]=s):r!=="Properties70"&&(r==="PoseNode"?l[r]=[s]:l[r]=s),typeof u.id=="number"&&(s.id=u.id),u.name!==""&&(s.attrName=u.name),u.type!==""&&(s.attrType=u.type),this.pushStack(s)},n.prototype.parseNodeAttr=function(t){var e=t[0];t[0]!==""&&(e=parseInt(t[0]),isNaN(e)&&(e=t[0]));var r="",o="";return t.length>1&&(r=t[1].replace(/^(\w+)::/,""),o=t[2]),{id:e,name:r,type:o}},n.prototype.parseNodeProperty=function(t,e,r){var o=e[1].replace(/^"/,"").replace(/"$/,"").trim(),s=e[2].replace(/^"/,"").replace(/"$/,"").trim();o==="Content"&&s===","&&(s=r.replace(/"/g,"").replace(/,$/,"").trim());var u=this.getCurrentNode(),l=u.name;if(l==="Properties70"){this.parseNodeSpecialProperty(t,o,s);return}if(o==="C"){var c=s.split(",").slice(1),f=parseInt(c[0]),d=parseInt(c[1]),p=s.split(",").slice(3);p=p.map(function(v){return v.trim().replace(/^"/,"")}),o="connections",s=[f,d],append(s,p),u[o]===void 0&&(u[o]=[])}o==="Node"&&(u.id=s),o in u&&Array.isArray(u[o])?u[o].push(s):o!=="a"?u[o]=s:u.a=s,this.setCurrentProp(u,o),o==="a"&&s.slice(-1)!==","&&(u.a=parseNumberArray(s))},n.prototype.parseNodePropertyContinued=function(t){var e=this.getCurrentNode();e.a+=t,t.slice(-1)!==","&&(e.a=parseNumberArray(e.a))},n.prototype.parseNodeSpecialProperty=function(t,e,r){var o=r.split('",').map(function(d){return d.trim().replace(/^\"/,"").replace(/\s/,"_")}),s=o[0],u=o[1],l=o[2],c=o[3],f=o[4];switch(u){case"int":case"enum":case"bool":case"ULongLong":case"double":case"Number":case"FieldOfView":f=parseFloat(f);break;case"Color":case"ColorRGB":case"Vector3D":case"Lcl_Translation":case"Lcl_Rotation":case"Lcl_Scaling":f=parseNumberArray(f);break}this.getPrevNode()[s]={type:u,type2:l,flag:c,value:f},this.setCurrentProp(this.getPrevNode(),s)},n}(),BinaryParser=function(){function n(){}return n.prototype.parse=function(t){var e=new BinaryReader(t);e.skip(23);var r=e.getUint32();if(r<6400)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+r);for(var o=new FBXTree;!this.endOfContent(e);){var s=this.parseNode(e,r);s!==null&&o.add(s.name,s)}return o},n.prototype.endOfContent=function(t){return t.size()%16===0?(t.getOffset()+160+16&-16)>=t.size():t.getOffset()+160+16>=t.size()},n.prototype.parseNode=function(t,e){var r={},o=e>=7500?t.getUint64():t.getUint32(),s=e>=7500?t.getUint64():t.getUint32();e>=7500?t.getUint64():t.getUint32();var u=t.getUint8(),l=t.getString(u);if(o===0)return null;for(var c=[],f=0;f<s;f++)c.push(this.parseProperty(t));var d=c.length>0?c[0]:"",p=c.length>1?c[1]:"",v=c.length>2?c[2]:"";for(r.singleProperty=s===1&&t.getOffset()===o;o>t.getOffset();){var g=this.parseNode(t,e);g!==null&&this.parseSubNode(l,r,g)}return r.propertyList=c,typeof d=="number"&&(r.id=d),p!==""&&(r.attrName=p),v!==""&&(r.attrType=v),l!==""&&(r.name=l),r},n.prototype.parseSubNode=function(t,e,r){if(r.singleProperty===!0){var o=r.propertyList[0];Array.isArray(o)?(e[r.name]=r,r.a=o):e[r.name]=o}else if(t==="Connections"&&r.name==="C"){var s=[];r.propertyList.forEach(function(v,g){g!==0&&s.push(v)}),e.connections===void 0&&(e.connections=[]),e.connections.push(s)}else if(r.name==="Properties70"){var u=Object.keys(r);u.forEach(function(v){e[v]=r[v]})}else if(t==="Properties70"&&r.name==="P"){var l=r.propertyList[0],c=r.propertyList[1],f=r.propertyList[2],d=r.propertyList[3],p=void 0;l.indexOf("Lcl ")===0&&(l=l.replace("Lcl ","Lcl_")),c.indexOf("Lcl ")===0&&(c=c.replace("Lcl ","Lcl_")),c==="Color"||c==="ColorRGB"||c==="Vector"||c==="Vector3D"||c.indexOf("Lcl_")===0?p=[r.propertyList[4],r.propertyList[5],r.propertyList[6]]:p=r.propertyList[4],e[l]={type:c,type2:f,flag:d,value:p}}else e[r.name]===void 0?typeof r.id=="number"?(e[r.name]={},e[r.name][r.id]=r):e[r.name]=r:r.name==="PoseNode"?(Array.isArray(e[r.name])||(e[r.name]=[e[r.name]]),e[r.name].push(r)):e[r.name][r.id]===void 0&&(e[r.name][r.id]=r)},n.prototype.parseProperty=function(t){var e=t.getString(1),r;switch(e){case"C":return t.getBoolean();case"D":return t.getFloat64();case"F":return t.getFloat32();case"I":return t.getInt32();case"L":return t.getInt64();case"R":return r=t.getUint32(),t.getArrayBuffer(r);case"S":return r=t.getUint32(),t.getString(r);case"Y":return t.getInt16();case"b":case"c":case"d":case"f":case"i":case"l":var o=t.getUint32(),s=t.getUint32(),u=t.getUint32();if(s===0)switch(e){case"b":case"c":return t.getBooleanArray(o);case"d":return t.getFloat64Array(o);case"f":return t.getFloat32Array(o);case"i":return t.getInt32Array(o);case"l":return t.getInt64Array(o)}var l=unzlibSync(new Uint8Array(t.getArrayBuffer(u))),c=new BinaryReader(l.buffer);switch(e){case"b":case"c":return c.getBooleanArray(o);case"d":return c.getFloat64Array(o);case"f":return c.getFloat32Array(o);case"i":return c.getInt32Array(o);case"l":return c.getInt64Array(o)}break;default:throw new Error("THREE.FBXLoader: Unknown property type "+e)}},n}(),BinaryReader=function(){function n(t,e){this.dv=new DataView(t),this.offset=0,this.littleEndian=e!==void 0?e:!0,this._textDecoder=new TextDecoder}return n.prototype.getOffset=function(){return this.offset},n.prototype.size=function(){return this.dv.buffer.byteLength},n.prototype.skip=function(t){this.offset+=t},n.prototype.getBoolean=function(){return(this.getUint8()&1)===1},n.prototype.getBooleanArray=function(t){for(var e=[],r=0;r<t;r++)e.push(this.getBoolean());return e},n.prototype.getUint8=function(){var t=this.dv.getUint8(this.offset);return this.offset+=1,t},n.prototype.getInt16=function(){var t=this.dv.getInt16(this.offset,this.littleEndian);return this.offset+=2,t},n.prototype.getInt32=function(){var t=this.dv.getInt32(this.offset,this.littleEndian);return this.offset+=4,t},n.prototype.getInt32Array=function(t){for(var e=[],r=0;r<t;r++)e.push(this.getInt32());return e},n.prototype.getUint32=function(){var t=this.dv.getUint32(this.offset,this.littleEndian);return this.offset+=4,t},n.prototype.getInt64=function(){var t,e;return this.littleEndian?(t=this.getUint32(),e=this.getUint32()):(e=this.getUint32(),t=this.getUint32()),e&2147483648?(e=~e&4294967295,t=~t&4294967295,t===4294967295&&(e=e+1&4294967295),t=t+1&4294967295,-(e*4294967296+t)):e*4294967296+t},n.prototype.getInt64Array=function(t){for(var e=[],r=0;r<t;r++)e.push(this.getInt64());return e},n.prototype.getUint64=function(){var t,e;return this.littleEndian?(t=this.getUint32(),e=this.getUint32()):(e=this.getUint32(),t=this.getUint32()),e*4294967296+t},n.prototype.getFloat32=function(){var t=this.dv.getFloat32(this.offset,this.littleEndian);return this.offset+=4,t},n.prototype.getFloat32Array=function(t){for(var e=[],r=0;r<t;r++)e.push(this.getFloat32());return e},n.prototype.getFloat64=function(){var t=this.dv.getFloat64(this.offset,this.littleEndian);return this.offset+=8,t},n.prototype.getFloat64Array=function(t){for(var e=[],r=0;r<t;r++)e.push(this.getFloat64());return e},n.prototype.getArrayBuffer=function(t){var e=this.dv.buffer.slice(this.offset,this.offset+t);return this.offset+=t,e},n.prototype.getString=function(t){var e=this.offset,r=new Uint8Array(this.dv.buffer,e,t);this.skip(t);var o=r.indexOf(0);return o>=0&&(r=new Uint8Array(this.dv.buffer,e,o)),this._textDecoder.decode(r)},n}(),FBXTree=function(){function n(){this.Connections={connections:[]},this.Objects={Model:{},NodeAttribute:{},Geometry:{}},this.GlobalSettings={}}return n.prototype.add=function(t,e){this[t]=e},n}();function isFbxFormatBinary(n){var t="Kaydara FBX Binary \0";return n.byteLength>=t.length&&t===convertArrayBufferToString(n,0,t.length)}function isFbxFormatASCII(n){var t=["K","a","y","d","a","r","a","\\","F","B","X","\\","B","i","n","a","r","y","\\","\\"],e=0;function r(u){var l=n[u-1];return n=n.slice(e+u),e++,l}for(var o=0;o<t.length;++o){var s=r(1);if(s===t[o])return!1}return!0}function getFbxVersion(n){var t=/FBXVersion: (\d+)/,e=n.match(t);if(e){var r=parseInt(e[1]);return r}throw new Error("THREE.FBXLoader: Cannot find the version number for the file given.")}function convertFBXTimeToSeconds(n){return n/46186158e3}var dataArray=[];function getData(n,t,e,r){var o;switch(r.mappingType){case"ByPolygonVertex":o=n;break;case"ByPolygon":o=t;break;case"ByVertice":o=e;break;case"AllSame":o=r.indices[0];break;default:console.warn("THREE.FBXLoader: unknown attribute mapping type "+r.mappingType),o=0}r.referenceType==="IndexToDirect"&&(o=r.indices[o]);var s=o*r.dataSize,u=s+r.dataSize;return slice(dataArray,r.buffer,s,u)}var tempEuler=new THREE__namespace.Euler,tempVec=new THREE__namespace.Vector3;function generateTransform(n){var t=new THREE__namespace.Matrix4,e=new THREE__namespace.Matrix4,r=new THREE__namespace.Matrix4,o=new THREE__namespace.Matrix4,s=new THREE__namespace.Matrix4,u=new THREE__namespace.Matrix4,l=new THREE__namespace.Matrix4,c=new THREE__namespace.Matrix4,f=new THREE__namespace.Matrix4,d=new THREE__namespace.Matrix4,p=new THREE__namespace.Matrix4,v=new THREE__namespace.Matrix4,g=n.inheritType?n.inheritType:0;n.translation&&t.setPosition(tempVec.fromArray(n.translation));var h=getEulerOrder(0);if(n.preRotation){var m=n.preRotation.map(THREE__namespace.MathUtils.degToRad);m.push(h),e.makeRotationFromEuler(tempEuler.fromArray(m))}if(n.rotation){var m=n.rotation.map(THREE__namespace.MathUtils.degToRad);m.push(n.eulerOrder||h),r.makeRotationFromEuler(tempEuler.fromArray(m))}if(n.postRotation){var m=n.postRotation.map(THREE__namespace.MathUtils.degToRad);m.push(h),o.makeRotationFromEuler(tempEuler.fromArray(m)),o.copy(new THREE__namespace.Matrix4().getInverse(o))}n.scale&&s.scale(tempVec.fromArray(n.scale)),n.scalingOffset&&l.setPosition(tempVec.fromArray(n.scalingOffset)),n.scalingPivot&&u.setPosition(tempVec.fromArray(n.scalingPivot)),n.rotationOffset&&c.setPosition(tempVec.fromArray(n.rotationOffset)),n.rotationPivot&&f.setPosition(tempVec.fromArray(n.rotationPivot)),n.parentMatrixWorld&&(p.copy(n.parentMatrix),d.copy(n.parentMatrixWorld));var y=e.clone().multiply(r).multiply(o),A=new THREE__namespace.Matrix4;A.extractRotation(d);var E=new THREE__namespace.Matrix4;E.copyPosition(d);var b=new THREE__namespace.Matrix4().getInverse(E).multiply(d),T=new THREE__namespace.Matrix4().getInverse(A).multiply(b),_=s,R=new THREE__namespace.Matrix4;if(g===0)R.copy(A).multiply(y).multiply(T).multiply(_);else if(g===1)R.copy(A).multiply(T).multiply(y).multiply(_);else{var S=new THREE__namespace.Matrix4().scale(new THREE__namespace.Vector3().setFromMatrixScale(p)),M=new THREE__namespace.Matrix4().getInverse(S),B=T.clone().multiply(M);R.copy(A).multiply(y).multiply(B).multiply(_)}var H=new THREE__namespace.Matrix4().getInverse(f),w=new THREE__namespace.Matrix4().getInverse(u),C=t.clone().multiply(c).multiply(f).multiply(e).multiply(r).multiply(o).multiply(H).multiply(l).multiply(u).multiply(s).multiply(w),L=new THREE__namespace.Matrix4().copyPosition(C),I=d.clone().multiply(L);return v.copyPosition(I),C=v.clone().multiply(R),C.premultiply(new THREE__namespace.Matrix4().getInverse(d)),C}function getEulerOrder(n){n=n||0;var t=["ZYX","YZX","XZY","ZXY","YXZ","XYZ"];return n===6?(console.warn("THREE.FBXLoader: unsupported Euler Order: Spherical XYZ. Animations and rotations may be incorrect."),t[0]):t[n]}function parseNumberArray(n){var t=n.split(",").map(function(e){return parseFloat(e)});return t}function convertArrayBufferToString(n,t,e){return t===void 0&&(t=0),e===void 0&&(e=n.byteLength),new TextDecoder().decode(new Uint8Array(n,t,e))}function append(n,t){for(var e=0,r=n.length,o=t.length;e<o;e++,r++)n[r]=t[e]}function slice(n,t,e,r){for(var o=e,s=0;o<r;o++,s++)n[s]=t[o];return n}var NURBSCurve=function(n){__extends(t,n);function t(e,r,o,s,u){var l=n.call(this)||this,c=r?r.length-1:0,f=o?o.length:0;l.degree=e,l.knots=r,l.controlPoints=[],l.startKnot=s||0,l.endKnot=u||c;for(var d=0;d<f;++d){var p=o[d];l.controlPoints[d]=new THREE__namespace.Vector4(p.x,p.y,p.z,p.w)}return l}return t.prototype.getPoint=function(e,r){r===void 0&&(r=new THREE__namespace.Vector3);var o=r,s=this.knots[this.startKnot]+e*(this.knots[this.endKnot]-this.knots[this.startKnot]),u=calcBSplinePoint(this.degree,this.knots,this.controlPoints,s);return u.w!==1&&u.divideScalar(u.w),o.set(u.x,u.y,u.z)},t.prototype.getTangent=function(e,r){r===void 0&&(r=new THREE__namespace.Vector3);var o=r,s=this.knots[0]+e*(this.knots[this.knots.length-1]-this.knots[0]),u=calcNURBSDerivatives(this.degree,this.knots,this.controlPoints,s,1);return o.copy(u[1]).normalize(),o},t.prototype.toJSON=function(){var e=n.prototype.toJSON.call(this);return e.degree=this.degree,e.knots=__spreadArray([],this.knots,!0),e.controlPoints=this.controlPoints.map(function(r){return r.toArray()}),e.startKnot=this.startKnot,e.endKnot=this.endKnot,e},t.prototype.fromJSON=function(e){return n.prototype.fromJSON.call(this,e),this.degree=e.degree,this.knots=__spreadArray([],e.knots,!0),this.controlPoints=e.controlPoints.map(function(r){return new THREE__namespace.Vector4(r[0],r[1],r[2],r[3])}),this.startKnot=e.startKnot,this.endKnot=e.endKnot,this},t}(THREE__namespace.Curve);function findSpan(n,t,e){var r=e.length-n-1;if(t>=e[r])return r-1;if(t<=e[n])return n;for(var o=n,s=r,u=Math.floor((o+s)/2);t<e[u]||t>=e[u+1];)t<e[u]?s=u:o=u,u=Math.floor((o+s)/2);return u}function calcBasisFunctions(n,t,e,r){var o=[],s=[],u=[];o[0]=1;for(var l=1;l<=e;++l){s[l]=t-r[n+1-l],u[l]=r[n+l]-t;for(var c=0,f=0;f<l;++f){var d=u[f+1],p=s[l-f],v=o[f]/(d+p);o[f]=c+d*v,c=p*v}o[l]=c}return o}function calcBSplinePoint(n,t,e,r){for(var o=findSpan(n,r,t),s=calcBasisFunctions(o,r,n,t),u=new THREE__namespace.Vector4(0,0,0,0),l=0;l<=n;++l){var c=e[o-n+l],f=s[l],d=c.w*f;u.x+=c.x*d,u.y+=c.y*d,u.z+=c.z*d,u.w+=c.w*f}return u}function calcBasisFunctionDerivatives(n,t,e,r,o){for(var s=[],u=0;u<=e;++u)s[u]=0;for(var l=[],u=0;u<=r;++u)l[u]=s.slice(0);for(var c=[],u=0;u<=e;++u)c[u]=s.slice(0);c[0][0]=1;for(var f=s.slice(0),d=s.slice(0),p=1;p<=e;++p){f[p]=t-o[n+1-p],d[p]=o[n+p]-t;for(var v=0,g=0;g<p;++g){var h=d[g+1],m=f[p-g];c[p][g]=h+m;var y=c[g][p-1]/c[p][g];c[g][p]=v+h*y,v=m*y}c[p][p]=v}for(var p=0;p<=e;++p)l[0][p]=c[p][e];for(var A=0;A<=e;++A){for(var E=0,b=1,T=[],u=0;u<=e;++u)T[u]=s.slice(0);T[0][0]=1;for(var _=1;_<=r;++_){var R=0,S=A-_,M=e-_;A>=_&&(T[b][0]=T[E][0]/c[M+1][S],R=T[b][0]*c[S][M]);for(var B=S>=-1?1:-S,H=A-1<=M?_-1:e-A,w=B;w<=H;++w)T[b][w]=(T[E][w]-T[E][w-1])/c[M+1][S+w],R+=T[b][w]*c[S+w][M];A<=M&&(T[b][_]=-T[E][_-1]/c[M+1][A],R+=T[b][_]*c[A][M]),l[_][A]=R;var p=E;E=b,b=p}}for(var C=e,_=1;_<=r;++_){for(var p=0;p<=e;++p)l[_][p]*=C;C*=e-_}return l}function calcBSplineDerivatives(n,t,e,r,o){for(var s=o<n?o:n,u=[],l=findSpan(n,r,t),c=calcBasisFunctionDerivatives(l,r,n,s,t),f=[],d=0;d<e.length;++d){var p=e[d].clone(),v=p.w;p.x*=v,p.y*=v,p.z*=v,f[d]=p}for(var g=0;g<=s;++g){for(var p=f[l-n].clone().multiplyScalar(c[g][0]),h=1;h<=n;++h)p.add(f[l-n+h].clone().multiplyScalar(c[g][h]));u[g]=p}for(var g=s+1;g<=o+1;++g)u[g]=new THREE__namespace.Vector4(0,0,0);return u}function calcKoverI(n,t){for(var e=1,r=2;r<=n;++r)e*=r;for(var o=1,r=2;r<=t;++r)o*=r;for(var r=2;r<=n-t;++r)o*=r;return e/o}function calcRationalCurveDerivatives(n){for(var t=n.length,e=[],r=[],o=0;o<t;++o){var s=n[o];e[o]=new THREE__namespace.Vector3(s.x,s.y,s.z),r[o]=s.w}for(var u=[],l=0;l<t;++l){for(var c=e[l].clone(),o=1;o<=l;++o)c.sub(u[l-o].clone().multiplyScalar(calcKoverI(l,o)*r[o]));u[l]=c.divideScalar(r[0])}return u}function calcNURBSDerivatives(n,t,e,r,o){var s=calcBSplineDerivatives(n,t,e,r,o);return calcRationalCurveDerivatives(s)}var _vector=new THREE__namespace.Vector3;function getPointArray(n,t){switch(t){case"D":return new Float64Array(n);case"F":return new Float32Array(n);case"L":return new Int32Array(n);case"I":return new Int16Array(n);default:return new Uint8Array(n)}}function loadX3p(n,t){var e;t===void 0&&(t={});var r=(e=t.fetcher)!==null&&e!==void 0?e:new Fetcher({allowHosts:["*"]}),o={byteLength:0};return Promise.resolve().then(function(){return r.ajax(n,{responseType:"arraybuffer"})}).then(function(s){var u;return o.byteLength=s.body.byteLength,parse$1(new Uint8Array(s.body),{materialType:t.materialType,color:t.color,resourcePath:n.slice(0,n.lastIndexOf("/")+1),search:(u=n.split("?")[1])!==null&&u!==void 0?u:"",fetcher:r})}).then(function(s){var u=new THREE__namespace.Group;return u.matrixAutoUpdate=!1,u.matrix.compose(u.position,u.quaternion,u.scale),u.name=n,u.add(s.object),{type:"x3p",upAxis:"Z",uri:n,byteLength:o.byteLength,scene:u,textures:[],dispose:function(){return s.dispose()}}})}function parse$1(n,t){for(var e,r,o,s,u,l,c,f,d,p,v,g,h,m,y,A,E,b,T,_,R,S,M,B,H,w,C,L,I,F,k,N,D,U,z,G,q,K,j,W,X,ee,$,re,ie,se,ae,fe,ne,pe,_e,me,xe,Z,te,Q=unzipSync(n),be="",ye=null,Ae=0,Me=Object.keys(Q);Ae<Me.length;Ae++){var ge=Me[Ae];/(^|\/)main\.xml$/i.test(ge)&&(ye=Q[ge],be=ge.slice(0,ge.lastIndexOf("/")+1))}if(!ye)throw new Error("X3p: main.xml not found.");if(typeof DOMParser=="undefined")throw new Error("X3p: DOMParser not found.");var he=(e=t.materialType)!==null&&e!==void 0?e:"phong",de=(r=t.color)!==null&&r!==void 0?r:new THREE__namespace.Color(10066329),ce=new DOMParser,le=decodeText(ye),we=ce.parseFromString(le,"text/xml"),ue=we.querySelector("Record1 Axes"),ve={x:{type:(u=(s=(o=ue==null?void 0:ue.querySelector("CX AxisType"))===null||o===void 0?void 0:o.textContent)===null||s===void 0?void 0:s.toUpperCase())!==null&&u!==void 0?u:"I",dataType:(f=(c=(l=ue==null?void 0:ue.querySelector("CX DataType"))===null||l===void 0?void 0:l.textContent)===null||c===void 0?void 0:c.toUpperCase())!==null&&f!==void 0?f:"D",increment:Number((p=(d=ue==null?void 0:ue.querySelector("CX Increment"))===null||d===void 0?void 0:d.textContent)!==null&&p!==void 0?p:"1"),offset:Number((g=(v=ue==null?void 0:ue.querySelector("CX Offset"))===null||v===void 0?void 0:v.textContent)!==null&&g!==void 0?g:"0")},y:{type:(y=(m=(h=ue==null?void 0:ue.querySelector("CY AxisType"))===null||h===void 0?void 0:h.textContent)===null||m===void 0?void 0:m.toUpperCase())!==null&&y!==void 0?y:"I",dataType:(b=(E=(A=ue==null?void 0:ue.querySelector("CY DataType"))===null||A===void 0?void 0:A.textContent)===null||E===void 0?void 0:E.toUpperCase())!==null&&b!==void 0?b:"D",increment:Number((_=(T=ue==null?void 0:ue.querySelector("CY Increment"))===null||T===void 0?void 0:T.textContent)!==null&&_!==void 0?_:"1"),offset:Number((S=(R=ue==null?void 0:ue.querySelector("CY Offset"))===null||R===void 0?void 0:R.textContent)!==null&&S!==void 0?S:"0")},z:{type:(H=(B=(M=ue==null?void 0:ue.querySelector("CZ AxisType"))===null||M===void 0?void 0:M.textContent)===null||B===void 0?void 0:B.toUpperCase())!==null&&H!==void 0?H:"A",dataType:(L=(C=(w=ue==null?void 0:ue.querySelector("CZ DataType"))===null||w===void 0?void 0:w.textContent)===null||C===void 0?void 0:C.toUpperCase())!==null&&L!==void 0?L:"D",increment:Number((F=(I=ue==null?void 0:ue.querySelector("CZ Increment"))===null||I===void 0?void 0:I.textContent)!==null&&F!==void 0?F:"1"),offset:Number((N=(k=ue==null?void 0:ue.querySelector("CZ Offset"))===null||k===void 0?void 0:k.textContent)!==null&&N!==void 0?N:"0")}},qe=null,Ee=we.querySelector("Record1 Axes Rotation");Ee&&(qe=new THREE__namespace.Matrix3,qe.set(Number((U=(D=Ee.querySelector("r11"))===null||D===void 0?void 0:D.textContent)!==null&&U!==void 0?U:0),Number((G=(z=Ee.querySelector("r12"))===null||z===void 0?void 0:z.textContent)!==null&&G!==void 0?G:0),Number((K=(q=Ee.querySelector("r13"))===null||q===void 0?void 0:q.textContent)!==null&&K!==void 0?K:0),Number((W=(j=Ee.querySelector("r21"))===null||j===void 0?void 0:j.textContent)!==null&&W!==void 0?W:0),Number((ee=(X=Ee.querySelector("r22"))===null||X===void 0?void 0:X.textContent)!==null&&ee!==void 0?ee:0),Number((re=($=Ee.querySelector("r23"))===null||$===void 0?void 0:$.textContent)!==null&&re!==void 0?re:0),Number((se=(ie=Ee.querySelector("r31"))===null||ie===void 0?void 0:ie.textContent)!==null&&se!==void 0?se:0),Number((fe=(ae=Ee.querySelector("r32"))===null||ae===void 0?void 0:ae.textContent)!==null&&fe!==void 0?fe:0),Number((pe=(ne=Ee.querySelector("r33"))===null||ne===void 0?void 0:ne.textContent)!==null&&pe!==void 0?pe:0)));var Ie=(_e=we.querySelector("Record3 DataLink PointDataLink"))===null||_e===void 0?void 0:_e.textContent;if(typeof Ie!="string")throw new Error("X3p: PointDataLink not found.");Ie=pathJoin(be,Ie);var Oe=Q[Ie];if(!Oe)throw new Error("X3p: ".concat(Oe," not found."));for(var $e=getPointArray(Oe.buffer,ve.z.dataType),pt=Number((xe=(me=we.querySelector("Record3 MatrixDimension SizeX"))===null||me===void 0?void 0:me.textContent)!==null&&xe!==void 0?xe:"0"),tt=Number((te=(Z=we.querySelector("Record3 MatrixDimension SizeY"))===null||Z===void 0?void 0:Z.textContent)!==null&&te!==void 0?te:"0"),Ne=Math.floor(pt-1),Ge=Math.floor(tt-1),Ve=Ne+1,Ke=Ge+1,Je=new Float32Array(Ve*Ke*3),Xe=new Float32Array(Ve*Ke*2),Pe=new Uint32Array(Ne*Ge*6),Se=new THREE__namespace.Box3,Be=0;Be<Ke;Be++)for(var De=Be*ve.y.increment+ve.y.offset,He=0;He<Ve;He++){var Ue=Be*Ve+He,Ye=He*ve.x.increment+ve.x.offset,ze=$e[Ue],rt=!isNaN(ze),ot=rt?ze:NaN;_vector.set(Ye,-De,ot),qe&&_vector.applyMatrix3(qe),rt&&Se.expandByPoint(_vector),Je[Ue*3+0]=_vector.x,Je[Ue*3+1]=_vector.y,Je[Ue*3+2]=_vector.z,Xe[Ue*2+0]=He/Ne,Xe[Ue*2+1]=1-Be/Ge}for(var Be=0;Be<Ge;Be++)for(var He=0;He<Ne;He++){var ht=He+Ve*Be,st=He+Ve*(Be+1),ct=He+1+Ve*(Be+1),We=He+1+Ve*Be,Ce=(Be*Ne+He)*6;Pe[Ce+0]=ht,Pe[Ce+1]=st,Pe[Ce+2]=We,Pe[Ce+3]=st,Pe[Ce+4]=ct,Pe[Ce+5]=We}var Re=new THREE__namespace.BufferGeometry;Re.setAttribute("position",new THREE__namespace.BufferAttribute(Je,3)),Re.setAttribute("uv",new THREE__namespace.BufferAttribute(Xe,2)),Re.setIndex(new THREE__namespace.BufferAttribute(Pe,1)),(!Re.groups||Re.groups.length===0)&&Re.addGroup(0,Re.index?Re.index.count:Re.attributes.position.count,0),Re.boundingBox=Se;var Le=new PBMMeshMaterial(he);Le.flatShading=!0,Le.color.copy(de),Le.refreshUniforms();var Qe=new PBMMesh(Re,[Le]);return{object:Qe,dispose:function(){Re.dispose(),Le.dispose()}}}var scratchMatrix4$3=new THREE__namespace.Matrix4,MAX_RETRY_DELAY$1=5e3,RETRY_DELAY_STEP$1=1e3;function attachTileAttributes(n,t){n.name=t.id;var e=t.tileset.properties.floorInfo;n.traverse(function(r){if("floor"in t.extras){if(r instanceof THREE__namespace.Mesh||r instanceof THREE__namespace.Points)for(var o=Array.isArray(r.material)?r.material:r.material?[r.material]:[],s=0,u=o;s<u.length;s++){var l=u[s];(l instanceof PBMMeshMaterial||l instanceof PBMPointCloudMaterial)&&(l.floor=t.extras.floor)}}else if(!(r instanceof PBMPointCloud)){if(r instanceof PBMMesh&&e){for(var c=new THREE__namespace.Box3().expandByObject(r),f=c.getCenter(new THREE__namespace.Vector3),d=0,p=0;p<e.length;p++){var v=e[p],g=v.ground,h=v.height;if(f.y<g+h){d=p;break}}t.floor=d,t.tileset.floorLength=Math.max(t.tileset.floorLength,t.floor+1),r.material.forEach(function(m){return m.floor=d})}}})}function loadTileContent(n,t){if(!n.content)return Promise.resolve(n);var e=n.content,r=appendSearch(e.uri,t.search);if(n.type==="TILESET"){var o=imageURL(r,{key:"model.".concat(n.siblingIndex)});return e.loadState="LOADING",e.loadStateUpdateTime=now(),t.fetcher.ajax(o,{responseType:"text"}).then(function(s){return s.body}).then(function(s){var u=r.slice(0,r.lastIndexOf("/")+1);return normalizeTilesetHeader(JSON.parse(s),u)}).then(function(s){e.loadState="READY",e.loadStateUpdateTime=now(),e.loadfailRetryDelay=0,n.children.length===0&&(n.children=[new Tile("".concat(n.id,".0"),s.root,n.tileset,n)])}).then(function(){return n}).catch(function(s){return e.loadState="FAILED",e.loadStateUpdateTime=now(),e.loadfailRetryDelay=Math.min(e.loadfailRetryDelay+1e3,5e3),Promise.reject(s)})}if(n.type==="SCENEGRAPH")return e.loadState="LOADING",e.loadStateUpdateTime=now(),Promise.resolve().then(function(){var s,u,l,c,f,d,p,v,g,h,m="",y=r.split("#"),A=y[0],E=y[1],b=(E||A).split("?")[0].match(/\.([0-9a-zA-Z]+)$/);if(b&&(m=b[1]),m==="b3dm"){var T=imageURL(r,{key:"model.".concat(n.siblingIndex)});return loadB3dm(T,{upAxis:n.tileset.asset.gltfUpAxis,fetcher:t.fetcher}).then(function(_){return _.scene.applyMatrix4(n.transform),_.scene.updateWorldMatrix(!1,!0),_.scene.matrixAutoUpdate=!1,attachTileAttributes(_.scene,n),_})}if(m==="pnts"){var T=imageURL(r,{key:"model.".concat(n.siblingIndex)});return loadPnts(T,{computeBoundingBox:!1,fetcher:t.fetcher}).then(function(R){if(R.scene.applyMatrix4(n.transform),R.scene.updateWorldMatrix(!1,!0),R.scene.matrixAutoUpdate=!1,n.boundingVolume){var S=n.boundingVolume;R.scene.traverse(function(M){if(M instanceof PBMPointCloud){scratchMatrix4$3.getInverse(M.matrixWorld);var B=new THREE__namespace.Box3;S.getBoundingBox(B),B.applyMatrix4(scratchMatrix4$3),M.geometry.boundingBox=B}})}return attachTileAttributes(R.scene,n),R})}if(m==="glb"){var T=imageURL(r,{key:"model.".concat(n.siblingIndex)});return loadGlb(T,{upAxis:n.tileset.asset.gltfUpAxis,fetcher:t.fetcher}).then(function(R){return R.scene.applyMatrix4(n.transform),R.scene.updateWorldMatrix(!1,!0),R.scene.matrixAutoUpdate=!1,attachTileAttributes(R.scene,n),R})}if(m==="at3d"){var T=n.extras.at3d?r:imageURL(r,{key:"model.".concat(n.siblingIndex)});return loadAt3d(T,{textureBaseUri:(s=n.extras.at3d)===null||s===void 0?void 0:s.textureBaseUri,textureArray:(u=n.extras.at3d)===null||u===void 0?void 0:u.textureArray,textureOptions:(l=n.extras.at3d)===null||l===void 0?void 0:l.textureOptions,fetcher:t.fetcher}).then(function(R){return R.scene.applyMatrix4(n.transform),R.scene.updateWorldMatrix(!1,!0),R.scene.matrixAutoUpdate=!1,R})}if(m==="pbm"){var T=n.extras.pbm?r:imageURL(r,{key:"model.".concat(n.siblingIndex)});return loadPbm(T,{textureBaseUri:(c=n.extras.pbm)===null||c===void 0?void 0:c.textureBaseUri,textureArray:(f=n.extras.pbm)===null||f===void 0?void 0:f.textureArray,textureOptions:(d=n.extras.pbm)===null||d===void 0?void 0:d.textureOptions,fetcher:t.fetcher}).then(function(R){return R.scene.applyMatrix4(n.transform),R.scene.updateWorldMatrix(!1,!0),R.scene.matrixAutoUpdate=!1,R})}if(m==="dome"){var T=n.extras.dome?r:imageURL(r,{key:"model.".concat(n.siblingIndex)});return loadDome(T,{textureBaseUri:(p=n.extras.dome)===null||p===void 0?void 0:p.textureBaseUri,textureOptions:(v=n.extras.dome)===null||v===void 0?void 0:v.textureOptions,fetcher:t.fetcher}).then(function(R){return R.scene.applyMatrix4(n.transform),R.scene.updateWorldMatrix(!1,!0),R.scene.matrixAutoUpdate=!1,R})}if(m==="domez"){var T=n.extras.domez?r:imageURL(r,{key:"model.".concat(n.siblingIndex)});return loadDomez(T,{textureBaseUri:(g=n.extras.domez)===null||g===void 0?void 0:g.textureBaseUri,textureOptions:(h=n.extras.domez)===null||h===void 0?void 0:h.textureOptions,fetcher:t.fetcher}).then(function(R){return R.scene.applyMatrix4(n.transform),R.scene.updateWorldMatrix(!1,!0),R.scene.matrixAutoUpdate=!1,R})}if(m==="ply"){var T=n.extras.ply?r:imageURL(r,{key:"model.".concat(n.siblingIndex)});return loadPly(T,{type:"pbmPointCloud",upAxis:"Z",fetcher:t.fetcher}).then(function(R){return R.scene.applyMatrix4(n.transform),R.scene.updateWorldMatrix(!1,!0),R.scene.matrixAutoUpdate=!1,R})}if(m==="obj"){var T=n.extras.obj?r:imageURL(r,{key:"model.".concat(n.siblingIndex)});return loadObj(T,{upAxis:"Z",fetcher:t.fetcher}).then(function(R){return R.scene.applyMatrix4(n.transform),R.scene.updateWorldMatrix(!1,!0),R.scene.matrixAutoUpdate=!1,R})}if(m==="fbx"){var T=n.extras.obj?r:imageURL(r,{key:"model.".concat(n.siblingIndex)});return loadFbx(T,{fetcher:t.fetcher}).then(function(R){return R.scene.applyMatrix4(n.transform),R.scene.updateWorldMatrix(!1,!0),R.scene.matrixAutoUpdate=!1,R})}if(m==="x3p"){var T=n.extras.x3p?r:imageURL(r,{key:"model.".concat(n.siblingIndex)});return loadX3p(T,{fetcher:t.fetcher}).then(function(R){return R.scene.applyMatrix4(n.transform),R.scene.updateWorldMatrix(!1,!0),R.scene.matrixAutoUpdate=!1,R})}throw new Error("Invalid Tile content: ".concat(r))}).then(function(s){s.scene.traverse(function(l){if(l instanceof PBMPointCloud)l.material.uniforms.geometricError.value=n.geometricError;else if(l instanceof PBMMesh)for(var c=0,f=l.material;c<f.length;c++){var d=f[c];d.uniforms.geometricError.value=n.geometricError}});var u={type:s.type,uri:s.uri,byteLength:s.byteLength,object:new TileNode(n.id,s.scene,s.dispose)};return Promise.resolve().then(function(){return Promise.all([u.object.generateBvhTree(),t.renderer&&s.textures.length<16?initTextures(s.textures,t.renderer,1024*1024):null])}).then(function(){return e.loadState="READY",e.loadStateUpdateTime=now(),e.loadfailRetryDelay=0,e.byteLength=u.byteLength,e.data=u,n}).catch(function(l){return unloadTileContent(n),Promise.reject(l)})}).catch(function(s){return e.loadState="FAILED",e.loadStateUpdateTime=now(),s instanceof NetworkResponseError&&s.httpStatus===0||s instanceof NetworkTimeoutError||s instanceof NetworkProxyError?e.loadfailRetryDelay=clamp$1(e.loadfailRetryDelay+RETRY_DELAY_STEP$1,RETRY_DELAY_STEP$1,MAX_RETRY_DELAY$1):e.loadfailRetryDelay=1/0,Promise.reject(s)});throw new Error("Invalid Tile type: ".concat(n.type))}function unloadTileContent(n){n.content&&(n.content.data&&n.content.data.object.dispose(),n.content.data=void 0,n.content.loadState="UNLOADED",n.content.loadStateUpdateTime=now(),n.content.byteLength=0)}var TrajectoryNode=function(n){__extends(t,n);function t(e,r,o){o===void 0&&(o=noop$1);var s=n.call(this)||this;return s.name=e,s.contentObject=r,s.name=e,s.add(r),s.disposers=[o],s}return t.prototype.update=function(e,r,o){var s=this.contentObject.material[2];s.uniforms.dashOffset.value=(s.uniforms.dashOffset.value-.003)%(s.uniforms.dashSize.value.x+s.uniforms.dashSize.value.y),o.needsRender=!0},t.prototype.dispose=function(){for(var e=0,r=this.disposers;e<r.length;e++){var o=r[e];o()}this.disposers.length=0},t.prototype.clone=function(){return new t(this.name,this.contentObject.clone())},t}(THREE__namespace.Object3D),MAX_RETRY_DELAY=5e3,RETRY_DELAY_STEP=1e3,TRAJECTOR_PIPE_SHADER={vertexShader:`
|
|
935
935
|
varying vec2 vUv;
|
|
936
936
|
uniform float displacementScalar;
|
|
937
937
|
#include <common>
|
|
@@ -1033,11 +1033,11 @@ void main() {
|
|
|
1033
1033
|
#include <fog_fragment>
|
|
1034
1034
|
#include <premultiplied_alpha_fragment>
|
|
1035
1035
|
}
|
|
1036
|
-
`,uniforms:{diffuse:{value:new THREE__namespace.Color},opacity:{value:1},displacementScalar:{value:0}}};function createPipeBufferGeometry(n,t,e,r){for(var o=new Float32Array((e+1)*(r+1)*3),s=new Float32Array((e+1)*(r+1)*3),u=new Float32Array((e+1)*(r+1)*2),l=new Uint32Array(e*r*6),c=n.computeFrenetFrames(e),f=new THREE__namespace.Vector3,d=new THREE__namespace.Vector3,p=new THREE__namespace.Vector2,v=new THREE__namespace.Vector3,g=0;g<=e;g++){v=n.getPointAt(g/e,v);for(var h=c.normals[g],m=c.binormals[g],y=0;y<=r;y++){var A=g*(r+1)+y,E=y/r*Math.PI*2,b=Math.sin(E),T=-Math.cos(E);d.x=T*h.x+b*m.x,d.y=T*h.y+b*m.y,d.z=T*h.z+b*m.z,d.normalize(),d.toArray(s,A*3),f.x=v.x+t*d.x,f.y=v.y+t*d.y,f.z=v.z+t*d.z,f.toArray(o,A*3),p.x=g/e,p.y=y/r,p.toArray(u,A*2)}}for(var g=0;g<e;g++)for(var y=0;y<r;y++){var _=(g*r+y)*6,R=(r+1)*g+y,S=(r+1)*(g+1)+y,M=(r+1)*(g+1)+(y+1),B=(r+1)*g+(y+1);l[_]=R,l[_+1]=S,l[_+2]=B,l[_+3]=S,l[_+4]=M,l[_+5]=B}var H=new THREE__namespace.BufferGeometry;return H.setIndex(new THREE__namespace.BufferAttribute(l,1)),H.setAttribute("position",new THREE__namespace.BufferAttribute(o,3)),H.setAttribute("normal",new THREE__namespace.BufferAttribute(s,3)),H.setAttribute("uv",new THREE__namespace.BufferAttribute(u,2)),H}function parseTrajectoryObject(n,t){for(var e=new THREE__namespace.Color(0).convertSRGBToLinear(),r=new THREE__namespace.Color(52949).convertSRGBToLinear(),o=new THREE__namespace.Color(3370495).convertSRGBToLinear(),s=new THREE__namespace.Color(16777215).convertSRGBToLinear(),u=0,l=new THREE__namespace.CurvePath,c=n.length,f=3;f<c;f+=3){var d=new THREE__namespace.Vector3().fromArray(n,f-3),p=new THREE__namespace.Vector3().fromArray(n,f);u+=d.distanceTo(p);var v=new THREE__namespace.LineCurve3(d,p);l.add(v)}var g=.03,h=Math.ceil(u*100),m=6,y=createPipeBufferGeometry(l,g,h,m);y.clearGroups(),y.addGroup(0,y.index?y.index.count:y.attributes.position.count,0),y.addGroup(0,y.index?y.index.count:y.attributes.position.count,1),y.addGroup(0,y.index?y.index.count:y.attributes.position.count,2);var A=new THREE__namespace.ShaderMaterial({vertexShader:TRAJECTOR_PIPE_SHADER.vertexShader,fragmentShader:TRAJECTOR_PIPE_SHADER.fragmentShader,uniforms:THREE__namespace.UniformsUtils.clone(TRAJECTOR_PIPE_SHADER.uniforms),side:THREE__namespace.BackSide});A.uniforms.totalLength.value=u,A.uniforms.diffuse.value=e,A.uniforms.diffuse2.value=e,A.uniforms.opacity.value=.5,A.transparent=!0;var E=new THREE__namespace.ShaderMaterial({vertexShader:TRAJECTOR_PIPE_SHADER.vertexShader,fragmentShader:TRAJECTOR_PIPE_SHADER.fragmentShader,uniforms:THREE__namespace.UniformsUtils.clone(TRAJECTOR_PIPE_SHADER.uniforms),side:THREE__namespace.BackSide});E.uniforms.totalLength.value=u,E.uniforms.displacementScalar.value=-.01,E.uniforms.diffuse.value=r,E.uniforms.diffuse2.value=o;var b=new THREE__namespace.ShaderMaterial({vertexShader:TRAJECTOR_PIPE_SHADER.vertexShader,fragmentShader:TRAJECTOR_PIPE_SHADER.fragmentShader,uniforms:THREE__namespace.UniformsUtils.clone(TRAJECTOR_PIPE_SHADER.uniforms),side:THREE__namespace.DoubleSide});b.uniforms.totalLength.value=u,b.uniforms.displacementScalar.value=-.026,b.uniforms.dashSize.value=new THREE__namespace.Vector2(.06,.09),b.uniforms.diffuse.value=s,b.uniforms.diffuse2.value=s;var T=new THREE__namespace.Mesh(y,[A,E,b]),_=.08,R=24,S=new THREE__namespace.SphereBufferGeometry(_,R,R);S.clearGroups(),S.addGroup(0,y.index?y.index.count:y.attributes.position.count,0),S.addGroup(0,y.index?y.index.count:y.attributes.position.count,1);var M=new THREE__namespace.ShaderMaterial({vertexShader:TRAJECTOR_SPHERE_SHADER.vertexShader,fragmentShader:TRAJECTOR_SPHERE_SHADER.fragmentShader,uniforms:THREE__namespace.UniformsUtils.clone(TRAJECTOR_SPHERE_SHADER.uniforms),side:THREE__namespace.BackSide});M.uniforms.diffuse.value=e,M.uniforms.opacity.value=.5,M.transparent=!0;var B=new THREE__namespace.ShaderMaterial({vertexShader:TRAJECTOR_SPHERE_SHADER.vertexShader,fragmentShader:TRAJECTOR_SPHERE_SHADER.fragmentShader,uniforms:THREE__namespace.UniformsUtils.clone(TRAJECTOR_SPHERE_SHADER.uniforms),side:THREE__namespace.FrontSide});B.uniforms.displacementScalar.value=-.01,B.uniforms.diffuse.value=r;var H=new THREE__namespace.Mesh(S,[M,B]);H.position.fromArray(n,0),T.add(H);var w=new THREE__namespace.ShaderMaterial({vertexShader:TRAJECTOR_SPHERE_SHADER.vertexShader,fragmentShader:TRAJECTOR_SPHERE_SHADER.fragmentShader,uniforms:THREE__namespace.UniformsUtils.clone(TRAJECTOR_SPHERE_SHADER.uniforms),side:THREE__namespace.FrontSide});w.uniforms.displacementScalar.value=-.01,w.uniforms.diffuse.value=o;var C=new THREE__namespace.Mesh(S,[M,w]);return C.position.fromArray(n,n.length-3),T.add(C),{scene:T,dispose:function(){y.dispose(),A.dispose(),E.dispose(),b.dispose(),S.dispose(),M.dispose(),B.dispose(),w.dispose()}}}function loadTrajectory(n,t){var e=n.name,r=appendSearch(n.content.uri,t.search),o=imageURL(r,{key:"model.0"});return n.content.loadState="LOADING",n.content.loadStateUpdateTime=now(),loadPly(o,{type:"geometry",customPropertyMapping:{time:{itemType:"uint32",itemNames:["time_milisec"]}},fetcher:t.fetcher}).then(function(s){var u,l,c,f,d=(l=(u=s.scene.attributes)===null||u===void 0?void 0:u.time.array)!==null&&l!==void 0?l:[],p=(f=(c=s.scene.attributes)===null||c===void 0?void 0:c.position.array)!==null&&f!==void 0?f:[],v=s.byteLength,g=parseTrajectoryObject(p);g.scene.applyMatrix4(n.transform),g.scene.updateWorldMatrix(!1,!0),g.scene.matrixAutoUpdate=!1;var h=new TrajectoryNode(e,g.scene);return n.content.data={uri:o,byteLength:v,positionArray:p,timeArray:d,object:h},n.content.byteLength=v,n.content.loadState="READY",n.content.loadStateUpdateTime=now(),n}).catch(function(s){return n.content.data=void 0,n.content.loadState="FAILED",n.content.loadStateUpdateTime=now(),s instanceof NetworkResponseError&&s.httpStatus===0||s instanceof NetworkTimeoutError||s instanceof NetworkProxyError?n.content.loadfailRetryDelay=clamp$1(n.content.loadfailRetryDelay+RETRY_DELAY_STEP,RETRY_DELAY_STEP,MAX_RETRY_DELAY):n.content.loadfailRetryDelay=1/0,Promise.reject(s)})}function unloadTrajectory(n){n.content&&(n.content.data&&n.content.data.object.dispose(),n.content.data=void 0,n.content.loadState="UNLOADED",n.content.loadStateUpdateTime=now(),n.content.byteLength=0)}var scratchVector3$1=new THREE__namespace.Vector3,scratchMatrix3=new THREE__namespace.Matrix3,scratchMatrix4$2=new THREE__namespace.Matrix4,a=6378137,invF=298.257223563;function ecefToLla(n){for(var t=a-a/invF,e=(a*a-t*t)/(a*a),r=Math.sqrt(n.x*n.x+n.y*n.y),o=1e-12,s=1e3,u=0,l=Math.atan2(n.z,r),c=0;u++<s;){var f=Math.sin(l),d=a/Math.sqrt(1-e*f*f);c=r/Math.cos(l)-d;var p=Math.atan2(n.z/(d*(1-e)+c),r/(d+c));if(isNaN(p))break;var v=Math.abs(p-l);if(v<o)break;l=p}return n.set(l,Math.atan2(n.y,n.x),c)}function llaToEcef(n){var t=n.x,e=n.y,r=n.z,o=a-a/invF,s=(a*a-o*o)/(a*a),u=Math.sin(t),l=Math.cos(t),c=Math.sin(e),f=Math.cos(e),d=a/Math.sqrt(1-s*u*u),p=(d+r)*l*f,v=(d+r)*l*c,g=(o*o/(a*a)*d+r)*u;return n.set(p,v,g)}function getEcefToEnuMatrix(n,t){var e=ecefToLla(scratchVector3$1.copy(n)),r=e.x,o=e.y,s=e.z,u=Math.sin(r),l=Math.sin(o),c=Math.cos(r),f=Math.cos(o);t.fromArray([-l,-u*f,c*f,0,+f,-u*l,c*l,0,0,c,u,0,0,0,0,1]);var d=scratchMatrix3.setFromMatrix4(t),p=scratchVector3$1.copy(n).applyMatrix3(d).multiplyScalar(-1);t.setPosition(p);var v=scratchMatrix4$2.fromArray([1,0,0,0,0,1,0,0,0,0,1,0,0,0,s,1]);return t.premultiply(v),t}var StencilConstants={TILE_MASK:128,SKIP_LOD_MASK:112,SKIP_LOD_BIT_SHIFT:4,CLASSIFICATION_MASK:15},SKIP_BACKFACE_MATERIAL=function(){var n=new THREE__namespace.MeshBasicMaterial;return n.side=THREE__namespace.BackSide,n.color.setHex(16711935),n.colorWrite=!1,n.stencilWrite=!0,n.polygonOffset=!0,n.polygonOffsetFactor=2,n.polygonOffsetUnits=2,n.stencilRef=StencilConstants.TILE_MASK,n.stencilFunc=THREE__namespace.AlwaysStencilFunc,n.stencilFuncMask=StencilConstants.TILE_MASK,n.stencilZPass=THREE__namespace.ReplaceStencilOp,n.stencilWriteMask=StencilConstants.TILE_MASK,n}(),SKIP_BACKFACE_TRANSPARENT_MATERIAL=function(){var n=new THREE__namespace.MeshBasicMaterial;return n.visible=!1,n}(),CLEAR_STENCIL_GEOMETRY=new THREE__namespace.BufferGeometry,CLEAR_STENCIL_MATERIAL=new THREE__namespace.MeshBasicMaterial,Tile3DModel=function(n){__extends(t,n);function t(e,r,o){var s,u,l,c=n.call(this)||this;return c.modelIndex=0,c.renderObjects=[],c.backfaceObjects=[],c.debugObjects=[],c.tileObjects=[],c.debug="none",c.name=o.name,c.type=o.type,c.upAxis=o.upAxis,c.model=e,c.fetcher=o.fetcher,c.search=(s=o.search)!==null&&s!==void 0?s:"",c.groundHeight=o.groundHeight,c.coordinateTransform=o.coordinateTransform,c.boundingBox=new THREE__namespace.Box3,c.minLevelOfDetail=t.DEFAULT_MIN_LEVEL_OF_DETAIL,c.maxLevelOfDetail=t.DEFAULT_MAX_LEVEL_OF_DETAIL,c.panoramaMaxLevelOfDetail=t.DEFAULT_MIN_LEVEL_OF_DETAIL,c.needsRefined=!0,c.refined=!1,c.refineProgress=[0,0],c.loaded=!1,c.modelsLoaded=!1,c.disposed=!1,c.needsRender=!0,c.lastRenderHash="",c.matrixAutoUpdate=!1,c.cacheCameras=[],c.clearStencilObject=new THREE__namespace.Mesh(CLEAR_STENCIL_GEOMETRY,CLEAR_STENCIL_MATERIAL),c.clearStencilObject.frustumCulled=!1,c.clearStencilObject.onAfterRender=function(f){return f.clearStencil()},c.tileset=new Tileset((l=(u=c.model.work)===null||u===void 0?void 0:u.workCode)!==null&&l!==void 0?l:"",r,{referer:o.referer,tileLoader:function(f){return c.loadContent(f)},tileUnloader:function(f){return c.unloadContent(f)},onTileLoad:function(){},onTileUnload:function(f){},onTileError:function(f,d){o.onError&&o.onError(Object.assign(d,{error:d})),console.error("Tile error",f.id,d)},trajectoryLoader:function(f){return c.loadTrajectory(f)},trajectoryUnloader:function(f){return c.unloadTrajectory(f)},onTrajectoryLoad:function(){},onTrajectoryUnload:function(f){},onTrajectoryError:function(f,d){o.onError&&o.onError(Object.assign(d,{error:d})),console.error("Trajectory error",f,d)}}),c.tileset.root.boundingVolume&&c.tileset.root.boundingVolume.getBoundingBox(c.boundingBox),c}return t.prototype.getRecommendProps=function(e){var r,o,s;e===void 0&&(e={});var u,l,c,f=128;e.powerPreference==="high"&&(f=512);var d=typeof this.tileset.rootMeta.creationTime=="string";if(d){var p=typeof this.tileset.rootMeta.numTotalPoints=="number"&&this.tileset.rootMeta.numTotalPoints>0;if(p){c=4,e.powerPreference==="high"&&(c=2),u=c/1.6;var v=0;if(((r=this.tileset.rootMeta.taskParameters)===null||r===void 0?void 0:r.point_homogenization)==="1"&&(!((o=this.tileset.rootMeta.taskParameters)===null||o===void 0)&&o.homo_point_density)){var g=Number((s=this.tileset.rootMeta.taskParameters)===null||s===void 0?void 0:s.homo_point_density);isFinite(g)&&!isNaN(g)&&(v=g)}v<=0&&(v=.02),l=v*1.4}else c=5,e.powerPreference==="high"&&(c=4),u=1,l=.03}else c=6,u=1,l=.03,this.name==="aerophoto"?(c=12,e.powerPreference==="high"&&(c=10)):this.tileset.asset.extras&&typeof this.tileset.asset.extras.name=="string"&&/^matterport\b/i.test(this.tileset.asset.extras.name)&&(c=5,e.powerPreference==="high"&&(c=4));return{pointScale:l,pointMinPixel:u,maxScreenSpaceError:c,maxMemoryUsage:f}},t.prototype.getRenderHash=function(){return jsonHash([this.tileset.id,this.tileset.skipLevelOfDetail,this.tileset.selectedTiles.map(function(e){return e.id}),this.tileset.selectedTrajectories.map(function(e){return e.index}),this.debug])},Object.defineProperty(t.prototype,"maxMemoryUsage",{get:function(){return this.tileset.maxMemoryUsage},set:function(e){this.tileset.maxMemoryUsage=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"maxRequests",{get:function(){return this.tileset.maxRequests},set:function(e){this.tileset.maxRequests=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"requestOrder",{get:function(){return this.tileset.tileRequestOrder},set:function(e){this.tileset.tileRequestOrder=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"skipLevelOfDetail",{get:function(){return this.tileset.skipLevelOfDetail},set:function(e){this.tileset.skipLevelOfDetail=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"mostDetail",{get:function(){return this.tileset.mostDetail},set:function(e){this.tileset.mostDetail=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"loadSiblings",{get:function(){return this.tileset.loadSiblings},set:function(e){this.tileset.loadSiblings=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"loadAll",{get:function(){return this.tileset.loadAll},set:function(e){this.tileset.loadAll=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"maxScreenSpaceError",{get:function(){return this.tileset.maxScreenSpaceError},set:function(e){this.tileset.maxScreenSpaceError=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"trajectories",{get:function(){return this.tileset.trajectories},enumerable:!1,configurable:!0}),t.prototype.localToEnu=function(e){return e.applyMatrix4(this.coordinateTransform.localToEnuMatrix)},t.prototype.enuToLocal=function(e){return e.applyMatrix4(this.coordinateTransform.enuToLocalMatrix)},t.prototype.localToEcef=function(e){return e.applyMatrix4(this.coordinateTransform.localToEcefMatrix)},t.prototype.ecefToLocal=function(e){return e.applyMatrix4(this.coordinateTransform.ecefToLocalMatrix)},t.prototype.localToLla=function(e){return ecefToLla(this.localToEcef(e))},t.prototype.llaToLocal=function(e){return this.ecefToLocal(llaToEcef(e))},t.prototype.worldToEnu=function(e){return this.localToEnu(this.worldToLocal(e))},t.prototype.enuToWorld=function(e){return this.localToWorld(this.enuToLocal(e))},t.prototype.worldToEcef=function(e){return this.localToEcef(this.worldToLocal(e))},t.prototype.ecefToWorld=function(e){return this.localToWorld(this.ecefToLocal(e))},t.prototype.worldToLla=function(e){return this.localToLla(this.worldToLocal(e))},t.prototype.llaToWorld=function(e){return this.localToWorld(this.llaToLocal(e))},t.prototype.loadContent=function(e){var r=this;return loadTileContent(e,{fetcher:this.fetcher,search:this.search,renderer:this.renderer}).then(function(o){e.type==="SCENEGRAPH"&&(r.disposed||!e.content?unloadTileContent(e):e.content.data&&r.boundingBox.expandByObject(e.content.data.object))})},t.prototype.unloadContent=function(e){return unloadTileContent(e),Promise.resolve()},t.prototype.loadAllTilesets=function(){var e=this,r=function(o){var s=[];return e.tileset.root.traverse(function(u){var l;u.type==="TILESET"&&((l=u.content)===null||l===void 0?void 0:l.loadState)!=="READY"&&s.push(u)}),Promise.all(s.map(function(u){return e.loadContent(u).then(function(){return r()})})).then(function(){})};return r(this.tileset.root)},t.prototype.loadTrajectory=function(e){var r=this;return loadTrajectory(e,{fetcher:this.fetcher,search:this.search,renderer:this.renderer}).then(function(o){r.disposed&&unloadTrajectory(o)})},t.prototype.unloadTrajectory=function(e){return unloadTrajectory(e),Promise.resolve()},t.prototype.intersectRaycaster=function(e,r,o){var s=this;r===void 0&&(r=!0),o===void 0&&(o=[]);for(var u=[this.tileset.root],l=this.tileset.transform,c=this.tileset.transformIsIdentity,f,d=[];f=u.pop();){var p=void 0;if(f.boundingVolume){var v=c?f.boundingVolume:f.boundingVolume.clone().applyMatrix4(l);p=v.intersectRay(e.ray,e.far)}else p=!0;if(p){for(var g=0,h=f.children.length;g<h;g++)u.push(f.children[g]);f.selected&&f.content&&f.content.data&&f.content.data.object.visible&&f.content.data.object.intersectRaycaster(e,!1,d)}}return this.model.shownFloorIndex>=0&&(d=d.filter(function(m){return m.floor===s.model.shownFloorIndex})),r&&d.sort(function(m,y){return m.distance-y.distance}),d.map(function(m){m.model=s.model,m.viewLayer=s.viewLayer}),o.push.apply(o,d),o},t.prototype.cloneSkipBackfaceObject=function(e){var r;e instanceof THREE__namespace.Mesh?r=new THREE__namespace.Mesh(e.geometry,Array.isArray(e.material)?e.material.map(function(l){return l.transparent?SKIP_BACKFACE_TRANSPARENT_MATERIAL:SKIP_BACKFACE_MATERIAL}):e.material&&e.material.transparent?SKIP_BACKFACE_TRANSPARENT_MATERIAL:SKIP_BACKFACE_MATERIAL):e instanceof THREE__namespace.Group?r=new THREE__namespace.Group:r=new THREE__namespace.Object3D,r.copy(e,!1);for(var o=0,s=e.children;o<s.length;o++){var u=s[o];r.add(this.cloneSkipBackfaceObject(u))}return r},t.prototype.update=function(e,r,o){var s,u,l,c=this,f,d,p;this.renderObjects.length=0,this.backfaceObjects.length=0,this.debugObjects.length=0,this.tileObjects.length=0,this.renderer=e,this.updateMatrixWorld(!0),this.tileset.transform.equals(this.matrixWorld)||this.tileset.transform.copy(this.matrixWorld),this.tileset.cache.reset();var v=this.tileset.frameNumber+1,g=this.maxLevelOfDetail;(o==="Panorama"||o==="VRPanorama"||o==="XRPanorama")&&(g=this.panoramaMaxLevelOfDetail),g=Math.max(g,0);var h=Math.min(this.minLevelOfDetail,g);(!this.visible||!this.loaded||!this.modelsLoaded)&&(g=Math.max(h,0));var m={time:now(),camera:{type:r.type,position:new THREE__namespace.Vector3().copy(r.position),direction:r.getDirection(new THREE__namespace.Vector3),near:r.near,far:r.far,up:new THREE__namespace.Vector3().copy(r.up).applyQuaternion(r.quaternion),visible:r.visible,refine:r.refineModel},minLevelOfDetail:h,maxLevelOfDetail:g,height:r.resolution.height,pixelRatio:r.pixelRatio,frameNumber:v,sseDenominator:2*Math.tan(.5*r.fov/180*Math.PI),cullingVolume:new CullingVolume().setFromCamera(r)},y=this.cacheCameras.map(function(j){return __assign(__assign({},m),{camera:{type:r.type,position:new THREE__namespace.Vector3().copy(j.position),direction:j.getWorldDirection(new THREE__namespace.Vector3),near:r.near,far:r.far,up:new THREE__namespace.Vector3().copy(j.up),visible:j.visible,refine:!0},cullingVolume:new CullingVolume().setFromCamera(j)})});this.needsRefined&&this.tileset.update(m,y),this.refined=!0,this.refineProgress[0]=0,this.refineProgress[1]=0,this.tileset.needsRefinedTiles.forEach(function(j){if(c.refineProgress[1]++,j.content){var te=j.content.loadState;if(te==="UNLOADED"||te==="LOADING"){c.refined=!1;return}}c.refineProgress[0]++}),this.loaded===!1&&this.needsRefined&&(this.loaded=!0,this.tileset.needsRefinedTiles.forEach(function(j){if(c.loaded!==!1){if(c.tileset.skipLevelOfDetail){if(j.state.finalResolution&&j.content){var te=j.state.ancestorWithContentAvailable,$=te&&te.content?te.content:j.content,ne=$.loadState;(ne==="UNLOADED"||ne==="LOADING")&&(c.loaded=!1)}}else if(j.state.visible&&j.content&&j.levelOfContent<=0){var ne=j.content.loadState;(ne==="UNLOADED"||ne==="LOADING")&&(c.loaded=!1)}}}),this.loaded===!0&&(this.refined=!1,this.refineProgress[1]++)),this.remove.apply(this,this.children),this.tileset.skipLevelOfDetail||this.tileset.selectedTiles.sort(function(j,te){return j.floor!==te.floor?j.floor-te.floor:j.levelOfContent!==te.levelOfContent?te.levelOfContent-j.levelOfContent:j.state.distanceToCamera!==te.state.distanceToCamera?j.state.distanceToCamera-te.state.distanceToCamera:j.state.centerZDepth-te.state.centerZDepth}),this.debug==="root-bounding-volume"&&this.tileset.root.boundingVolumeDebugObject&&this.debugObjects.push(this.tileset.root.boundingVolumeDebugObject);for(var A=0,E=this.tileset.selectedTiles;A<E.length;A++){var b=E[A];this.debug==="selected-bounding-volume"&&b.boundingVolumeDebugObject&&this.debugObjects.push(b.boundingVolumeDebugObject);var T=(d=(f=b.content)===null||f===void 0?void 0:f.data)===null||d===void 0?void 0:d.object;if(T){if(T.update(e,r,this.model,b),this.tileset.hasMixedContent&&this.tileset.skipLevelOfDetail){if(!b.state.finalResolution){var _=this.cloneSkipBackfaceObject(T);this.backfaceObjects.push(_)}for(var R=b.state.selectionDepth,S=StencilConstants.TILE_MASK|R<<StencilConstants.SKIP_LOD_BIT_SHIFT,M=THREE__namespace.GreaterEqualStencilFunc,B=StencilConstants.SKIP_LOD_MASK,H=THREE__namespace.ReplaceStencilOp,w=StencilConstants.TILE_MASK|StencilConstants.SKIP_LOD_MASK,C=0,L=T.materials;C<L.length;C++){var I=L[C];I.stencilWrite=!0,I.stencilRef=S,I.stencilFunc=M,I.stencilFuncMask=B,I.stencilZPass=H,I.stencilWriteMask=w}}else for(var F=0,k=T.materials;F<k.length;F++){var I=k[F];I.stencilWrite=!1,I.stencilRef=StencilConstants.TILE_MASK,I.stencilFunc=THREE__namespace.AlwaysStencilFunc,I.stencilFuncMask=StencilConstants.TILE_MASK,I.stencilZPass=THREE__namespace.ReplaceStencilOp,I.stencilWriteMask=StencilConstants.TILE_MASK}this.tileObjects.push(T)}}this.tileset.skipLevelOfDetail&&this.backfaceObjects.length&&(s=this.renderObjects).push.apply(s,this.backfaceObjects),this.tileObjects.length&&(u=this.renderObjects).push.apply(u,this.tileObjects),this.tileset.skipLevelOfDetail&&this.renderObjects.push(this.clearStencilObject);for(var N=0,D=this.tileset.selectedTrajectories;N<D.length;N++){var U=D[N],Q=(p=U.content.data)===null||p===void 0?void 0:p.object;Q&&(Q.update(e,r,this.model),this.renderObjects.push(Q))}this.debug&&(l=this.renderObjects).push.apply(l,this.debugObjects);for(var q=this.modelIndex*1e4,G=function(j){var te=J.renderObjects[j],$=j+q;te.traverse(function(ne){(ne instanceof THREE__namespace.Mesh||ne instanceof THREE__namespace.Line||ne instanceof THREE__namespace.Points)&&(ne.renderOrder=$)}),J.add(te)},J=this,X=0;X<this.renderObjects.length;X++)G(X);var W=this.getRenderHash();this.lastRenderHash!==W&&(this.needsRender=!0,this.lastRenderHash=W)},t.prototype.dispose=function(){this.disposed=!0,this.viewLayer=void 0,this.tileset.reset(),this.remove.apply(this,this.children),this.refineProgress[0]=0,this.refineProgress[1]=0,this.refined=!1,this.loaded=!1},t.DEFAULT_MIN_LEVEL_OF_DETAIL=0,t.DEFAULT_MAX_LEVEL_OF_DETAIL=20,t.DEFAULT_MAX_MEMORY_USAGE=16,t.DEFAULT_MAX_SCREEN_SPACE_ERROR=Tileset.DEFAULT_MAX_SCREEN_SPACE_ERROR,t.DEFAULT_SKIP_LEVEL_OF_DETAIL=Tileset.DEFAULT_SKIP_LEVEL_OF_DETAIL,t.DEFAULT_MOST_DETAIL=Tileset.DEFAULT_MOST_DETAIL,t.DEFAULT_LOAD_SIBLINGS=Tileset.DEFAULT_LOAD_SIBLINGS,t.DEFAULT_LOAD_ALL=Tileset.DEFAULT_LOAD_ALL,t.DEFAULT_MAX_REQUESTS=Tileset.DEFAULT_MAX_REQUESTS,t.DEFAULT_REQUEST_ORDER=Tileset.DEFAULT_REQUEST_ORDER,t}(THREE__namespace.Object3D);function headingToLongitude(n){return-((n-.25)*360+90)/180*Math.PI}function equal(n,t){if(n===t)return!0;if(n&&t&&typeof n=="object"&&typeof t=="object"){if(n.constructor!==t.constructor)return!1;var e,r,o;if(Array.isArray(n)){if(e=n.length,e!=t.length)return!1;for(r=e;r--!==0;)if(!equal(n[r],t[r]))return!1;return!0}if(n.constructor===RegExp)return n.source===t.source&&n.flags===t.flags;if(n.valueOf!==Object.prototype.valueOf)return n.valueOf()===t.valueOf();if(n.toString!==Object.prototype.toString)return n.toString()===t.toString();if(o=Object.keys(n),e=o.length,e!==Object.keys(t).length)return!1;for(r=e;r--!==0;)if(!Object.prototype.hasOwnProperty.call(t,o[r]))return!1;for(r=e;r--!==0;){var s=o[r];if(!equal(n[s],t[s]))return!1}return!0}return n!==n&&t!==t}function isNumber(n){return typeof n=="number"}var error_invalid_input=function(){return new Error("Invalid input.")},error_invalid_certificate=function(){return new Error("Invalid certificate.")},error_invalid_signature=function(){return new Error("Invalid signature.")},error_date_expired=function(n){return new Error("date(".concat(n.toString(),") expired."))},error_host_not_allowed=function(n){return new Error("host(".concat(JSON.stringify(n),") is not allowed."))};function ObjectOmit(n,t){for(var e={},r=0,o=Object.keys(n);r<o.length;r++){var s=o[r];t.indexOf(s)===-1&&(e[s]=n[s])}return e}function jsonStableNoneNumberStrinfiy_(n,t){t===void 0&&(t=!1);var e=typeof n;if(e==="string")return JSON.stringify(n);if(n===!0)return"true";if(n===!1)return"false";if(n===null)return"null";if(n instanceof Array){for(var r="[",o=n.length-1,s=0;s<o;s++)r+=jsonStableNoneNumberStrinfiy_(n[s],!1)+",";return o>-1&&(r+=jsonStableNoneNumberStrinfiy_(n[s],!1)),r+"]"}if(n instanceof Object){if(typeof n.toJSON=="function")return jsonStableNoneNumberStrinfiy_(n.toJSON(),t);for(var u=Object.keys(n).sort(),l=u.length,r="",s=0;s<l;){var c=u[s],f=jsonStableNoneNumberStrinfiy_(n[c],!0);f!==void 0&&(s&&r!==""&&(r+=","),r+=JSON.stringify(c)+":"+f),s++}return"{"+r+"}"}switch(e){case"function":case"undefined":return t?void 0:null;case"number":return 0;default:return isFinite(n)?n:null}}function jsonStableNoneNumberStrinfiy(n){return String(jsonStableNoneNumberStrinfiy_(n,!1))}function verify(n){var t,e,r;if(Array.isArray(n)){var o=void 0,s,u;if(n.length<=0)return error_invalid_input();for(var l=function(_){var R=verify(n[_]);if(R instanceof Error)return{value:R};if(!o)o=R.issuer;else if(o!==R.issuer)return{value:error_invalid_certificate()};s?R.expire.getTime()<s.getTime()&&(s=R.expire):s=R.expire,u?u=u.filter(function(S){return R.allowHosts.indexOf(S)!==-1}):u=R.allowHosts},c=0;c<n.length;c++){var f=l(c);if(typeof f=="object")return f.value}return deepFreeze({issuer:o,expire:s,allowHosts:u})}var d=JSON.parse(n),p=typeof location!="undefined"?location.hostname:"",v=Date.now();if(typeof d!="object")return error_invalid_input();var g=new Date(typeof d.expire_at=="string"&&/^\d+$/.test(d.expire_at)?Number(d.expire_at):d.expire_at),h=Array.isArray(d.allow_hosts)?d.allow_hosts:[];if(p.length===0||isIPDomain(p)||BUILDIN_ALLOW_HOST.filter(function(_){return matchDomain(_,p)}).length>0){var m=String((t=d.certificate)!==null&&t!==void 0?t:"");if(m){var y=new X509;return y.readCertPEM(m),deepFreeze({issuer:y.getSubjectString(),expire:g,allowHosts:h})}return deepFreeze({issuer:"none",expire:g,allowHosts:h})}var A=String((e=d.certificate)!==null&&e!==void 0?e:"");if(!A)return error_invalid_certificate();var E=new X509;E.readCertPEM(A);var b=String((r=d._signature)!==null&&r!==void 0?r:"");if(!b)return error_invalid_signature();var T=jsonStableNoneNumberStrinfiy(ObjectOmit(d,["_signature"]));return verifyMessage(T,b,E)===!1?error_invalid_signature():v<g.getTime()?h.filter(function(_){return matchDomain(_,p)}).length===0?error_host_not_allowed(p):deepFreeze({issuer:E.getSubjectString(),expire:g,allowHosts:h}):error_date_expired(g)}var scratchMatrix4$1=new THREE__namespace.Matrix4,workRawMapping=new WeakMap,needsUpdateWorkCodeSet=new Set,Work=function(){function n(t,e){this.name="",this.workCode="",this.expire=new Date,this.allowHosts=[],this.initial={work:this},this.observers=[],this.issuer="none",this.raw={works:[""],options:""},this.transform=new THREE__namespace.Matrix4;{var r=this;this.options={get transform(){return r.transform},set transform(s){r.transform.copy(s)}}}var o=parse(t,e,this);if(o instanceof Error)throw new Error("[PARSE FAILED]: "+o.message+`
|
|
1036
|
+
`,uniforms:{diffuse:{value:new THREE__namespace.Color},opacity:{value:1},displacementScalar:{value:0}}};function createPipeBufferGeometry(n,t,e,r){for(var o=new Float32Array((e+1)*(r+1)*3),s=new Float32Array((e+1)*(r+1)*3),u=new Float32Array((e+1)*(r+1)*2),l=new Uint32Array(e*r*6),c=n.computeFrenetFrames(e),f=new THREE__namespace.Vector3,d=new THREE__namespace.Vector3,p=new THREE__namespace.Vector2,v=new THREE__namespace.Vector3,g=0;g<=e;g++){v=n.getPointAt(g/e,v);for(var h=c.normals[g],m=c.binormals[g],y=0;y<=r;y++){var A=g*(r+1)+y,E=y/r*Math.PI*2,b=Math.sin(E),T=-Math.cos(E);d.x=T*h.x+b*m.x,d.y=T*h.y+b*m.y,d.z=T*h.z+b*m.z,d.normalize(),d.toArray(s,A*3),f.x=v.x+t*d.x,f.y=v.y+t*d.y,f.z=v.z+t*d.z,f.toArray(o,A*3),p.x=g/e,p.y=y/r,p.toArray(u,A*2)}}for(var g=0;g<e;g++)for(var y=0;y<r;y++){var _=(g*r+y)*6,R=(r+1)*g+y,S=(r+1)*(g+1)+y,M=(r+1)*(g+1)+(y+1),B=(r+1)*g+(y+1);l[_]=R,l[_+1]=S,l[_+2]=B,l[_+3]=S,l[_+4]=M,l[_+5]=B}var H=new THREE__namespace.BufferGeometry;return H.setIndex(new THREE__namespace.BufferAttribute(l,1)),H.setAttribute("position",new THREE__namespace.BufferAttribute(o,3)),H.setAttribute("normal",new THREE__namespace.BufferAttribute(s,3)),H.setAttribute("uv",new THREE__namespace.BufferAttribute(u,2)),H}function parseTrajectoryObject(n,t){for(var e=new THREE__namespace.Color(0).convertSRGBToLinear(),r=new THREE__namespace.Color(52949).convertSRGBToLinear(),o=new THREE__namespace.Color(3370495).convertSRGBToLinear(),s=new THREE__namespace.Color(16777215).convertSRGBToLinear(),u=0,l=new THREE__namespace.CurvePath,c=n.length,f=3;f<c;f+=3){var d=new THREE__namespace.Vector3().fromArray(n,f-3),p=new THREE__namespace.Vector3().fromArray(n,f);u+=d.distanceTo(p);var v=new THREE__namespace.LineCurve3(d,p);l.add(v)}var g=.03,h=Math.ceil(u*100),m=6,y=createPipeBufferGeometry(l,g,h,m);y.clearGroups(),y.addGroup(0,y.index?y.index.count:y.attributes.position.count,0),y.addGroup(0,y.index?y.index.count:y.attributes.position.count,1),y.addGroup(0,y.index?y.index.count:y.attributes.position.count,2);var A=new THREE__namespace.ShaderMaterial({vertexShader:TRAJECTOR_PIPE_SHADER.vertexShader,fragmentShader:TRAJECTOR_PIPE_SHADER.fragmentShader,uniforms:THREE__namespace.UniformsUtils.clone(TRAJECTOR_PIPE_SHADER.uniforms),side:THREE__namespace.BackSide});A.uniforms.totalLength.value=u,A.uniforms.diffuse.value=e,A.uniforms.diffuse2.value=e,A.uniforms.opacity.value=.5,A.transparent=!0;var E=new THREE__namespace.ShaderMaterial({vertexShader:TRAJECTOR_PIPE_SHADER.vertexShader,fragmentShader:TRAJECTOR_PIPE_SHADER.fragmentShader,uniforms:THREE__namespace.UniformsUtils.clone(TRAJECTOR_PIPE_SHADER.uniforms),side:THREE__namespace.BackSide});E.uniforms.totalLength.value=u,E.uniforms.displacementScalar.value=-.01,E.uniforms.diffuse.value=r,E.uniforms.diffuse2.value=o;var b=new THREE__namespace.ShaderMaterial({vertexShader:TRAJECTOR_PIPE_SHADER.vertexShader,fragmentShader:TRAJECTOR_PIPE_SHADER.fragmentShader,uniforms:THREE__namespace.UniformsUtils.clone(TRAJECTOR_PIPE_SHADER.uniforms),side:THREE__namespace.DoubleSide});b.uniforms.totalLength.value=u,b.uniforms.displacementScalar.value=-.026,b.uniforms.dashSize.value=new THREE__namespace.Vector2(.06,.09),b.uniforms.diffuse.value=s,b.uniforms.diffuse2.value=s;var T=new THREE__namespace.Mesh(y,[A,E,b]),_=.08,R=24,S=new THREE__namespace.SphereBufferGeometry(_,R,R);S.clearGroups(),S.addGroup(0,y.index?y.index.count:y.attributes.position.count,0),S.addGroup(0,y.index?y.index.count:y.attributes.position.count,1);var M=new THREE__namespace.ShaderMaterial({vertexShader:TRAJECTOR_SPHERE_SHADER.vertexShader,fragmentShader:TRAJECTOR_SPHERE_SHADER.fragmentShader,uniforms:THREE__namespace.UniformsUtils.clone(TRAJECTOR_SPHERE_SHADER.uniforms),side:THREE__namespace.BackSide});M.uniforms.diffuse.value=e,M.uniforms.opacity.value=.5,M.transparent=!0;var B=new THREE__namespace.ShaderMaterial({vertexShader:TRAJECTOR_SPHERE_SHADER.vertexShader,fragmentShader:TRAJECTOR_SPHERE_SHADER.fragmentShader,uniforms:THREE__namespace.UniformsUtils.clone(TRAJECTOR_SPHERE_SHADER.uniforms),side:THREE__namespace.FrontSide});B.uniforms.displacementScalar.value=-.01,B.uniforms.diffuse.value=r;var H=new THREE__namespace.Mesh(S,[M,B]);H.position.fromArray(n,0),T.add(H);var w=new THREE__namespace.ShaderMaterial({vertexShader:TRAJECTOR_SPHERE_SHADER.vertexShader,fragmentShader:TRAJECTOR_SPHERE_SHADER.fragmentShader,uniforms:THREE__namespace.UniformsUtils.clone(TRAJECTOR_SPHERE_SHADER.uniforms),side:THREE__namespace.FrontSide});w.uniforms.displacementScalar.value=-.01,w.uniforms.diffuse.value=o;var C=new THREE__namespace.Mesh(S,[M,w]);return C.position.fromArray(n,n.length-3),T.add(C),{scene:T,dispose:function(){y.dispose(),A.dispose(),E.dispose(),b.dispose(),S.dispose(),M.dispose(),B.dispose(),w.dispose()}}}function loadTrajectory(n,t){var e=n.name,r=appendSearch(n.content.uri,t.search),o=imageURL(r,{key:"model.0"});return n.content.loadState="LOADING",n.content.loadStateUpdateTime=now(),loadPly(o,{type:"geometry",customPropertyMapping:{time:{itemType:"uint32",itemNames:["time_milisec"]}},fetcher:t.fetcher}).then(function(s){var u,l,c,f,d=(l=(u=s.scene.attributes)===null||u===void 0?void 0:u.time.array)!==null&&l!==void 0?l:[],p=(f=(c=s.scene.attributes)===null||c===void 0?void 0:c.position.array)!==null&&f!==void 0?f:[],v=s.byteLength,g=parseTrajectoryObject(p);g.scene.applyMatrix4(n.transform),g.scene.updateWorldMatrix(!1,!0),g.scene.matrixAutoUpdate=!1;var h=new TrajectoryNode(e,g.scene);return n.content.data={uri:o,byteLength:v,positionArray:p,timeArray:d,object:h},n.content.byteLength=v,n.content.loadState="READY",n.content.loadStateUpdateTime=now(),n}).catch(function(s){return n.content.data=void 0,n.content.loadState="FAILED",n.content.loadStateUpdateTime=now(),s instanceof NetworkResponseError&&s.httpStatus===0||s instanceof NetworkTimeoutError||s instanceof NetworkProxyError?n.content.loadfailRetryDelay=clamp$1(n.content.loadfailRetryDelay+RETRY_DELAY_STEP,RETRY_DELAY_STEP,MAX_RETRY_DELAY):n.content.loadfailRetryDelay=1/0,Promise.reject(s)})}function unloadTrajectory(n){n.content&&(n.content.data&&n.content.data.object.dispose(),n.content.data=void 0,n.content.loadState="UNLOADED",n.content.loadStateUpdateTime=now(),n.content.byteLength=0)}var scratchVector3$1=new THREE__namespace.Vector3,scratchMatrix3=new THREE__namespace.Matrix3,scratchMatrix4$2=new THREE__namespace.Matrix4,a=6378137,invF=298.257223563;function ecefToLla(n){for(var t=a-a/invF,e=(a*a-t*t)/(a*a),r=Math.sqrt(n.x*n.x+n.y*n.y),o=1e-12,s=1e3,u=0,l=Math.atan2(n.z,r),c=0;u++<s;){var f=Math.sin(l),d=a/Math.sqrt(1-e*f*f);c=r/Math.cos(l)-d;var p=Math.atan2(n.z/(d*(1-e)+c),r/(d+c));if(isNaN(p))break;var v=Math.abs(p-l);if(v<o)break;l=p}return n.set(l,Math.atan2(n.y,n.x),c)}function llaToEcef(n){var t=n.x,e=n.y,r=n.z,o=a-a/invF,s=(a*a-o*o)/(a*a),u=Math.sin(t),l=Math.cos(t),c=Math.sin(e),f=Math.cos(e),d=a/Math.sqrt(1-s*u*u),p=(d+r)*l*f,v=(d+r)*l*c,g=(o*o/(a*a)*d+r)*u;return n.set(p,v,g)}function getEcefToEnuMatrix(n,t){var e=ecefToLla(scratchVector3$1.copy(n)),r=e.x,o=e.y,s=e.z,u=Math.sin(r),l=Math.sin(o),c=Math.cos(r),f=Math.cos(o);t.fromArray([-l,-u*f,c*f,0,+f,-u*l,c*l,0,0,c,u,0,0,0,0,1]);var d=scratchMatrix3.setFromMatrix4(t),p=scratchVector3$1.copy(n).applyMatrix3(d).multiplyScalar(-1);t.setPosition(p);var v=scratchMatrix4$2.fromArray([1,0,0,0,0,1,0,0,0,0,1,0,0,0,s,1]);return t.premultiply(v),t}var StencilConstants={TILE_MASK:128,SKIP_LOD_MASK:112,SKIP_LOD_BIT_SHIFT:4,CLASSIFICATION_MASK:15},SKIP_BACKFACE_MATERIAL=function(){var n=new THREE__namespace.MeshBasicMaterial;return n.side=THREE__namespace.BackSide,n.color.setHex(16711935),n.colorWrite=!1,n.stencilWrite=!0,n.polygonOffset=!0,n.polygonOffsetFactor=2,n.polygonOffsetUnits=2,n.stencilRef=StencilConstants.TILE_MASK,n.stencilFunc=THREE__namespace.AlwaysStencilFunc,n.stencilFuncMask=StencilConstants.TILE_MASK,n.stencilZPass=THREE__namespace.ReplaceStencilOp,n.stencilWriteMask=StencilConstants.TILE_MASK,n}(),SKIP_BACKFACE_TRANSPARENT_MATERIAL=function(){var n=new THREE__namespace.MeshBasicMaterial;return n.visible=!1,n}(),CLEAR_STENCIL_GEOMETRY=new THREE__namespace.BufferGeometry,CLEAR_STENCIL_MATERIAL=new THREE__namespace.MeshBasicMaterial,Tile3DModel=function(n){__extends(t,n);function t(e,r,o){var s,u,l,c=n.call(this)||this;return c.modelIndex=0,c.renderObjects=[],c.backfaceObjects=[],c.debugObjects=[],c.tileObjects=[],c.debug="none",c.name=o.name,c.type=o.type,c.upAxis=o.upAxis,c.model=e,c.fetcher=o.fetcher,c.search=(s=o.search)!==null&&s!==void 0?s:"",c.groundHeight=o.groundHeight,c.coordinateTransform=o.coordinateTransform,c.boundingBox=new THREE__namespace.Box3,c.minLevelOfDetail=t.DEFAULT_MIN_LEVEL_OF_DETAIL,c.maxLevelOfDetail=t.DEFAULT_MAX_LEVEL_OF_DETAIL,c.panoramaMaxLevelOfDetail=t.DEFAULT_MIN_LEVEL_OF_DETAIL,c.needsRefined=!0,c.refined=!1,c.refineProgress=[0,0],c.loaded=!1,c.modelsLoaded=!1,c.disposed=!1,c.needsRender=!0,c.lastRenderHash="",c.matrixAutoUpdate=!1,c.cacheCameras=[],c.clearStencilObject=new THREE__namespace.Mesh(CLEAR_STENCIL_GEOMETRY,CLEAR_STENCIL_MATERIAL),c.clearStencilObject.frustumCulled=!1,c.clearStencilObject.onAfterRender=function(f){return f.clearStencil()},c.tileset=new Tileset((l=(u=c.model.work)===null||u===void 0?void 0:u.workCode)!==null&&l!==void 0?l:"",r,{referer:o.referer,tileLoader:function(f){return c.loadContent(f)},tileUnloader:function(f){return c.unloadContent(f)},onTileLoad:function(){},onTileUnload:function(f){},onTileError:function(f,d){o.onError&&o.onError(Object.assign(d,{error:d})),console.error("Tile error",f.id,d)},trajectoryLoader:function(f){return c.loadTrajectory(f)},trajectoryUnloader:function(f){return c.unloadTrajectory(f)},onTrajectoryLoad:function(){},onTrajectoryUnload:function(f){},onTrajectoryError:function(f,d){o.onError&&o.onError(Object.assign(d,{error:d})),console.error("Trajectory error",f,d)}}),c.tileset.root.boundingVolume&&c.tileset.root.boundingVolume.getBoundingBox(c.boundingBox),c}return t.prototype.getRecommendProps=function(e){var r,o,s;e===void 0&&(e={});var u,l,c,f=128;e.powerPreference==="high"&&(f=512);var d=typeof this.tileset.rootMeta.creationTime=="string";if(d){var p=typeof this.tileset.rootMeta.numTotalPoints=="number"&&this.tileset.rootMeta.numTotalPoints>0;if(p){c=4,e.powerPreference==="high"&&(c=2),u=c/1.6;var v=0;if(((r=this.tileset.rootMeta.taskParameters)===null||r===void 0?void 0:r.point_homogenization)==="1"&&(!((o=this.tileset.rootMeta.taskParameters)===null||o===void 0)&&o.homo_point_density)){var g=Number((s=this.tileset.rootMeta.taskParameters)===null||s===void 0?void 0:s.homo_point_density);isFinite(g)&&!isNaN(g)&&(v=g)}v<=0&&(v=.02),l=v*1.4}else c=5,e.powerPreference==="high"&&(c=4),u=1,l=.03}else c=6,u=1,l=.03,this.name==="aerophoto"?(c=12,e.powerPreference==="high"&&(c=10)):this.tileset.asset.extras&&typeof this.tileset.asset.extras.name=="string"&&/^matterport\b/i.test(this.tileset.asset.extras.name)&&(c=5,e.powerPreference==="high"&&(c=4));return{pointScale:l,pointMinPixel:u,maxScreenSpaceError:c,maxMemoryUsage:f}},t.prototype.getRenderHash=function(){return jsonHash([this.tileset.id,this.tileset.skipLevelOfDetail,this.tileset.selectedTiles.map(function(e){return e.id}),this.tileset.selectedTrajectories.map(function(e){return e.index}),this.debug])},Object.defineProperty(t.prototype,"maxMemoryUsage",{get:function(){return this.tileset.maxMemoryUsage},set:function(e){this.tileset.maxMemoryUsage=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"maxRequests",{get:function(){return this.tileset.maxRequests},set:function(e){this.tileset.maxRequests=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"requestOrder",{get:function(){return this.tileset.tileRequestOrder},set:function(e){this.tileset.tileRequestOrder=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"skipLevelOfDetail",{get:function(){return this.tileset.skipLevelOfDetail},set:function(e){this.tileset.skipLevelOfDetail=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"mostDetail",{get:function(){return this.tileset.mostDetail},set:function(e){this.tileset.mostDetail=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"loadSiblings",{get:function(){return this.tileset.loadSiblings},set:function(e){this.tileset.loadSiblings=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"loadAll",{get:function(){return this.tileset.loadAll},set:function(e){this.tileset.loadAll=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"maxScreenSpaceError",{get:function(){return this.tileset.maxScreenSpaceError},set:function(e){this.tileset.maxScreenSpaceError=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"trajectories",{get:function(){return this.tileset.trajectories},enumerable:!1,configurable:!0}),t.prototype.localToEnu=function(e){return e.applyMatrix4(this.coordinateTransform.localToEnuMatrix)},t.prototype.enuToLocal=function(e){return e.applyMatrix4(this.coordinateTransform.enuToLocalMatrix)},t.prototype.localToEcef=function(e){return e.applyMatrix4(this.coordinateTransform.localToEcefMatrix)},t.prototype.ecefToLocal=function(e){return e.applyMatrix4(this.coordinateTransform.ecefToLocalMatrix)},t.prototype.localToLla=function(e){return ecefToLla(this.localToEcef(e))},t.prototype.llaToLocal=function(e){return this.ecefToLocal(llaToEcef(e))},t.prototype.worldToEnu=function(e){return this.localToEnu(this.worldToLocal(e))},t.prototype.enuToWorld=function(e){return this.localToWorld(this.enuToLocal(e))},t.prototype.worldToEcef=function(e){return this.localToEcef(this.worldToLocal(e))},t.prototype.ecefToWorld=function(e){return this.localToWorld(this.ecefToLocal(e))},t.prototype.worldToLla=function(e){return this.localToLla(this.worldToLocal(e))},t.prototype.llaToWorld=function(e){return this.localToWorld(this.llaToLocal(e))},t.prototype.loadContent=function(e){var r=this;return loadTileContent(e,{fetcher:this.fetcher,search:this.search,renderer:this.renderer}).then(function(o){e.type==="SCENEGRAPH"&&(r.disposed||!e.content?unloadTileContent(e):e.content.data&&r.boundingBox.expandByObject(e.content.data.object))})},t.prototype.unloadContent=function(e){return unloadTileContent(e),Promise.resolve()},t.prototype.loadAllTilesets=function(){var e=this,r=function(o){var s=[];return e.tileset.root.traverse(function(u){var l;u.type==="TILESET"&&((l=u.content)===null||l===void 0?void 0:l.loadState)!=="READY"&&s.push(u)}),Promise.all(s.map(function(u){return e.loadContent(u).then(function(){return r()})})).then(function(){})};return r(this.tileset.root)},t.prototype.loadTrajectory=function(e){var r=this;return loadTrajectory(e,{fetcher:this.fetcher,search:this.search,renderer:this.renderer}).then(function(o){r.disposed&&unloadTrajectory(o)})},t.prototype.unloadTrajectory=function(e){return unloadTrajectory(e),Promise.resolve()},t.prototype.intersectRaycaster=function(e,r,o){var s=this;r===void 0&&(r=!0),o===void 0&&(o=[]);for(var u=[this.tileset.root],l=this.tileset.transform,c=this.tileset.transformIsIdentity,f,d=[];f=u.pop();){var p=void 0;if(f.boundingVolume){var v=c?f.boundingVolume:f.boundingVolume.clone().applyMatrix4(l);p=v.intersectRay(e.ray,e.far)}else p=!0;if(p){for(var g=0,h=f.children.length;g<h;g++)u.push(f.children[g]);f.selected&&f.content&&f.content.data&&f.content.data.object.visible&&f.content.data.object.intersectRaycaster(e,!1,d)}}return this.model.shownFloorIndex>=0&&(d=d.filter(function(m){return m.floor===s.model.shownFloorIndex})),r&&d.sort(function(m,y){return m.distance-y.distance}),d.map(function(m){m.model=s.model,m.viewLayer=s.viewLayer}),o.push.apply(o,d),o},t.prototype.cloneSkipBackfaceObject=function(e){var r;e instanceof THREE__namespace.Mesh?r=new THREE__namespace.Mesh(e.geometry,Array.isArray(e.material)?e.material.map(function(l){return l.transparent?SKIP_BACKFACE_TRANSPARENT_MATERIAL:SKIP_BACKFACE_MATERIAL}):e.material&&e.material.transparent?SKIP_BACKFACE_TRANSPARENT_MATERIAL:SKIP_BACKFACE_MATERIAL):e instanceof THREE__namespace.Group?r=new THREE__namespace.Group:r=new THREE__namespace.Object3D,r.copy(e,!1);for(var o=0,s=e.children;o<s.length;o++){var u=s[o];r.add(this.cloneSkipBackfaceObject(u))}return r},t.prototype.update=function(e,r,o){var s,u,l,c=this,f,d,p;this.renderObjects.length=0,this.backfaceObjects.length=0,this.debugObjects.length=0,this.tileObjects.length=0,this.renderer=e,this.updateMatrixWorld(!0),this.tileset.transform.equals(this.matrixWorld)||this.tileset.transform.copy(this.matrixWorld),this.tileset.cache.reset();var v=this.tileset.frameNumber+1,g=this.maxLevelOfDetail;(o==="Panorama"||o==="VRPanorama"||o==="XRPanorama")&&(g=this.panoramaMaxLevelOfDetail),g=Math.max(g,0);var h=Math.min(this.minLevelOfDetail,g);(!this.visible||!this.loaded||!this.modelsLoaded)&&(g=Math.max(h,0));var m={time:now(),camera:{type:r.type,position:new THREE__namespace.Vector3().copy(r.position),direction:r.getDirection(new THREE__namespace.Vector3),near:r.near,far:r.far,up:new THREE__namespace.Vector3().copy(r.up).applyQuaternion(r.quaternion),visible:r.visible,refine:r.refineModel},minLevelOfDetail:h,maxLevelOfDetail:g,height:r.resolution.height,pixelRatio:r.pixelRatio,frameNumber:v,sseDenominator:2*Math.tan(.5*r.fov/180*Math.PI),cullingVolume:new CullingVolume().setFromCamera(r)},y=this.cacheCameras.map(function(X){return __assign(__assign({},m),{camera:{type:r.type,position:new THREE__namespace.Vector3().copy(X.position),direction:X.getWorldDirection(new THREE__namespace.Vector3),near:r.near,far:r.far,up:new THREE__namespace.Vector3().copy(X.up),visible:X.visible,refine:!0},cullingVolume:new CullingVolume().setFromCamera(X)})});this.needsRefined&&this.tileset.update(m,y),this.refined=!0,this.refineProgress[0]=0,this.refineProgress[1]=0,this.tileset.needsRefinedTiles.forEach(function(X){if(c.refineProgress[1]++,X.content){var ee=X.content.loadState;if(ee==="UNLOADED"||ee==="LOADING"){c.refined=!1;return}}c.refineProgress[0]++}),this.loaded===!1&&this.needsRefined&&(this.loaded=!0,this.tileset.needsRefinedTiles.forEach(function(X){if(c.loaded!==!1){if(c.tileset.skipLevelOfDetail){if(X.state.finalResolution&&X.content){var ee=X.state.ancestorWithContentAvailable,$=ee&&ee.content?ee.content:X.content,re=$.loadState;(re==="UNLOADED"||re==="LOADING")&&(c.loaded=!1)}}else if(X.state.visible&&X.content&&X.levelOfContent<=0){var re=X.content.loadState;(re==="UNLOADED"||re==="LOADING")&&(c.loaded=!1)}}}),this.loaded===!0&&(this.refined=!1,this.refineProgress[1]++)),this.remove.apply(this,this.children),this.tileset.skipLevelOfDetail||this.tileset.selectedTiles.sort(function(X,ee){return X.floor!==ee.floor?X.floor-ee.floor:X.levelOfContent!==ee.levelOfContent?ee.levelOfContent-X.levelOfContent:X.state.distanceToCamera!==ee.state.distanceToCamera?X.state.distanceToCamera-ee.state.distanceToCamera:X.state.centerZDepth-ee.state.centerZDepth}),this.debug==="root-bounding-volume"&&this.tileset.root.boundingVolumeDebugObject&&this.debugObjects.push(this.tileset.root.boundingVolumeDebugObject);for(var A=0,E=this.tileset.selectedTiles;A<E.length;A++){var b=E[A];this.debug==="selected-bounding-volume"&&b.boundingVolumeDebugObject&&this.debugObjects.push(b.boundingVolumeDebugObject);var T=(d=(f=b.content)===null||f===void 0?void 0:f.data)===null||d===void 0?void 0:d.object;if(T){if(T.update(e,r,this.model,b),this.tileset.hasMixedContent&&this.tileset.skipLevelOfDetail){if(!b.state.finalResolution){var _=this.cloneSkipBackfaceObject(T);this.backfaceObjects.push(_)}for(var R=b.state.selectionDepth,S=StencilConstants.TILE_MASK|R<<StencilConstants.SKIP_LOD_BIT_SHIFT,M=THREE__namespace.GreaterEqualStencilFunc,B=StencilConstants.SKIP_LOD_MASK,H=THREE__namespace.ReplaceStencilOp,w=StencilConstants.TILE_MASK|StencilConstants.SKIP_LOD_MASK,C=0,L=T.materials;C<L.length;C++){var I=L[C];I.stencilWrite=!0,I.stencilRef=S,I.stencilFunc=M,I.stencilFuncMask=B,I.stencilZPass=H,I.stencilWriteMask=w}}else for(var F=0,k=T.materials;F<k.length;F++){var I=k[F];I.stencilWrite=!1,I.stencilRef=StencilConstants.TILE_MASK,I.stencilFunc=THREE__namespace.AlwaysStencilFunc,I.stencilFuncMask=StencilConstants.TILE_MASK,I.stencilZPass=THREE__namespace.ReplaceStencilOp,I.stencilWriteMask=StencilConstants.TILE_MASK}this.tileObjects.push(T)}}this.tileset.skipLevelOfDetail&&this.backfaceObjects.length&&(s=this.renderObjects).push.apply(s,this.backfaceObjects),this.tileObjects.length&&(u=this.renderObjects).push.apply(u,this.tileObjects),this.tileset.skipLevelOfDetail&&this.renderObjects.push(this.clearStencilObject);for(var N=0,D=this.tileset.selectedTrajectories;N<D.length;N++){var U=D[N],z=(p=U.content.data)===null||p===void 0?void 0:p.object;z&&(z.update(e,r,this.model),this.renderObjects.push(z))}this.debug&&(l=this.renderObjects).push.apply(l,this.debugObjects);for(var G=this.modelIndex*1e4,q=function(X){var ee=K.renderObjects[X],$=X+G;ee.traverse(function(re){(re instanceof THREE__namespace.Mesh||re instanceof THREE__namespace.Line||re instanceof THREE__namespace.Points)&&(re.renderOrder=$)}),K.add(ee)},K=this,j=0;j<this.renderObjects.length;j++)q(j);var W=this.getRenderHash();this.lastRenderHash!==W&&(this.needsRender=!0,this.lastRenderHash=W)},t.prototype.dispose=function(){this.disposed=!0,this.viewLayer=void 0,this.tileset.reset(),this.remove.apply(this,this.children),this.refineProgress[0]=0,this.refineProgress[1]=0,this.refined=!1,this.loaded=!1},t.DEFAULT_MIN_LEVEL_OF_DETAIL=0,t.DEFAULT_MAX_LEVEL_OF_DETAIL=20,t.DEFAULT_MAX_MEMORY_USAGE=16,t.DEFAULT_MAX_SCREEN_SPACE_ERROR=Tileset.DEFAULT_MAX_SCREEN_SPACE_ERROR,t.DEFAULT_SKIP_LEVEL_OF_DETAIL=Tileset.DEFAULT_SKIP_LEVEL_OF_DETAIL,t.DEFAULT_MOST_DETAIL=Tileset.DEFAULT_MOST_DETAIL,t.DEFAULT_LOAD_SIBLINGS=Tileset.DEFAULT_LOAD_SIBLINGS,t.DEFAULT_LOAD_ALL=Tileset.DEFAULT_LOAD_ALL,t.DEFAULT_MAX_REQUESTS=Tileset.DEFAULT_MAX_REQUESTS,t.DEFAULT_REQUEST_ORDER=Tileset.DEFAULT_REQUEST_ORDER,t}(THREE__namespace.Object3D);function headingToLongitude(n){return-((n-.25)*360+90)/180*Math.PI}function equal(n,t){if(n===t)return!0;if(n&&t&&typeof n=="object"&&typeof t=="object"){if(n.constructor!==t.constructor)return!1;var e,r,o;if(Array.isArray(n)){if(e=n.length,e!=t.length)return!1;for(r=e;r--!==0;)if(!equal(n[r],t[r]))return!1;return!0}if(n.constructor===RegExp)return n.source===t.source&&n.flags===t.flags;if(n.valueOf!==Object.prototype.valueOf)return n.valueOf()===t.valueOf();if(n.toString!==Object.prototype.toString)return n.toString()===t.toString();if(o=Object.keys(n),e=o.length,e!==Object.keys(t).length)return!1;for(r=e;r--!==0;)if(!Object.prototype.hasOwnProperty.call(t,o[r]))return!1;for(r=e;r--!==0;){var s=o[r];if(!equal(n[s],t[s]))return!1}return!0}return n!==n&&t!==t}function isNumber(n){return typeof n=="number"}var error_invalid_input=function(){return new Error("Invalid input.")},error_invalid_certificate=function(){return new Error("Invalid certificate.")},error_invalid_signature=function(){return new Error("Invalid signature.")},error_date_expired=function(n){return new Error("date(".concat(n.toString(),") expired."))},error_host_not_allowed=function(n){return new Error("host(".concat(JSON.stringify(n),") is not allowed."))};function ObjectOmit(n,t){for(var e={},r=0,o=Object.keys(n);r<o.length;r++){var s=o[r];t.indexOf(s)===-1&&(e[s]=n[s])}return e}function jsonStableNoneNumberStrinfiy_(n,t){t===void 0&&(t=!1);var e=typeof n;if(e==="string")return JSON.stringify(n);if(n===!0)return"true";if(n===!1)return"false";if(n===null)return"null";if(n instanceof Array){for(var r="[",o=n.length-1,s=0;s<o;s++)r+=jsonStableNoneNumberStrinfiy_(n[s],!1)+",";return o>-1&&(r+=jsonStableNoneNumberStrinfiy_(n[s],!1)),r+"]"}if(n instanceof Object){if(typeof n.toJSON=="function")return jsonStableNoneNumberStrinfiy_(n.toJSON(),t);for(var u=Object.keys(n).sort(),l=u.length,r="",s=0;s<l;){var c=u[s],f=jsonStableNoneNumberStrinfiy_(n[c],!0);f!==void 0&&(s&&r!==""&&(r+=","),r+=JSON.stringify(c)+":"+f),s++}return"{"+r+"}"}switch(e){case"function":case"undefined":return t?void 0:null;case"number":return 0;default:return isFinite(n)?n:null}}function jsonStableNoneNumberStrinfiy(n){return String(jsonStableNoneNumberStrinfiy_(n,!1))}function verify(n){var t,e,r;if(Array.isArray(n)){var o=void 0,s,u;if(n.length<=0)return error_invalid_input();for(var l=function(_){var R=verify(n[_]);if(R instanceof Error)return{value:R};if(!o)o=R.issuer;else if(o!==R.issuer)return{value:error_invalid_certificate()};s?R.expire.getTime()<s.getTime()&&(s=R.expire):s=R.expire,u?u=u.filter(function(S){return R.allowHosts.indexOf(S)!==-1}):u=R.allowHosts},c=0;c<n.length;c++){var f=l(c);if(typeof f=="object")return f.value}return deepFreeze({issuer:o,expire:s,allowHosts:u})}var d=JSON.parse(n),p=typeof location!="undefined"?location.hostname:"",v=Date.now();if(typeof d!="object")return error_invalid_input();var g=new Date(typeof d.expire_at=="string"&&/^\d+$/.test(d.expire_at)?Number(d.expire_at):d.expire_at),h=Array.isArray(d.allow_hosts)?d.allow_hosts:[];if(p.length===0||isIPDomain(p)||BUILDIN_ALLOW_HOST.filter(function(_){return matchDomain(_,p)}).length>0){var m=String((t=d.certificate)!==null&&t!==void 0?t:"");if(m){var y=new X509;return y.readCertPEM(m),deepFreeze({issuer:y.getSubjectString(),expire:g,allowHosts:h})}return deepFreeze({issuer:"none",expire:g,allowHosts:h})}var A=String((e=d.certificate)!==null&&e!==void 0?e:"");if(!A)return error_invalid_certificate();var E=new X509;E.readCertPEM(A);var b=String((r=d._signature)!==null&&r!==void 0?r:"");if(!b)return error_invalid_signature();var T=jsonStableNoneNumberStrinfiy(ObjectOmit(d,["_signature"]));return verifyMessage(T,b,E)===!1?error_invalid_signature():v<g.getTime()?h.filter(function(_){return matchDomain(_,p)}).length===0?error_host_not_allowed(p):deepFreeze({issuer:E.getSubjectString(),expire:g,allowHosts:h}):error_date_expired(g)}var scratchMatrix4$1=new THREE__namespace.Matrix4,workRawMapping=new WeakMap,needsUpdateWorkCodeSet=new Set,Work=function(){function n(t,e){this.name="",this.workCode="",this.expire=new Date,this.allowHosts=[],this.initial={work:this},this.observers=[],this.issuer="none",this.raw={works:[""],options:""},this.transform=new THREE__namespace.Matrix4;{var r=this;this.options={get transform(){return r.transform},set transform(s){r.transform.copy(s)}}}var o=parse(t,e,this);if(o instanceof Error)throw new Error("[PARSE FAILED]: "+o.message+`
|
|
1037
1037
|
Error work input:
|
|
1038
|
-
`+JSON.stringify(t))}return n.prototype.toJSON=function(){return this.raw},n.parse=parseWork,n}();function getType(n){return n==null?"null":Array.isArray(n)?"array":typeof n=="object"?"dict":"value"}function deepMerge(n,t){var e=getType(n),r=getType(t);if(r==="null")return n;if(r==="value")return t;if(r!==e)return JSON.parse(JSON.stringify(t));if(r==="array")for(var o=0;o<t.length;o++)n[o]=deepMerge(n[o],t[o]);else if(r==="dict")for(var s in t)n[s]=deepMerge(n[s],t[s]);return n}function startWithString(n,t){return n.indexOf(t)===0}function urlWithParseOptions(n,t,e,r){var o,s=t;if(r.jsonp===!0){s=t.replace(/([\?\#].*)?$/i,"");var u=sha256("".concat(s)).slice(0,7);s="".concat(s,".").concat(u,".jsonp")}if(r.shortPath===!0){var l=s.replace(n,"").split("."),c=(o=l.shift())!==null&&o!==void 0?o:"",f=l.join(".");s=pathJoin(n,sha256(c))+(f?"."+f:"")}var d=s.replace(n,"");return r.baseURL&&(s=pathJoin(r.baseURL,d)),r.traverseResource&&r.traverseResource({origin:t,absolute:s,relative:d,type:e}),s}function panoURL(n,t,e,r,o){var s=e;return isAbsoluteURL(e)||(t&&(t=pathJoin(t,String(r))),s=pathJoin(t,s)),isAbsoluteURL(s)||(s=pathJoin(n,s)),startWithString(s,n)||console.warn("".concat(s," is not start with base_url(").concat(n,").")),urlWithParseOptions(n,s,"panorama",o)}function fileURL(n,t,e){var r=t;return isAbsoluteURL(r)||(r=pathJoin(n,t)),startWithString(r,n)||console.warn("".concat(r," is not start with base_url(").concat(n,").")),urlWithParseOptions(n,r,"model",e)}function textureURL$1(n,t,e,r){var o=t;return isAbsoluteURL(o)||(o=pathJoin(e,o)),isAbsoluteURL(o)||(o=pathJoin(n,o)),startWithString(o,n)||console.warn("".concat(o," is not start with base_url(").concat(n,").")),urlWithParseOptions(n,o,"texture",r)}var getTileLevel=function(n){for(var t=10;t>=0;t--){var e=512*Math.pow(2,t);if(e<=n)return t}return null},sortTile=function(n){n=n.slice().sort(function(u,l){return u.level-l.level});for(var t=[],e=0,r=n;e<r.length;e++){var o=r[e];if(t.length===0){t.push(o);continue}var s=t[t.length-1];if(o.level>s.level){t.push(o);continue}if(o.size>s.size){t[t.length-1]=o;continue}}return t};function parse(n,t,e){for(var r,o,s,u,l,c,f,d,p,v,g,h,m,y,A,E,b,T,_,R=JSON.stringify(t),S=[],M=0,B=[].concat(n);M<B.length;M++){var H=B[M];H instanceof Work?S.push.apply(S,H.raw.works):typeof H=="string"?S.push(H):S.push(JSON.stringify(H))}var w=verify(S);if(w instanceof Error)return w;Array.isArray(t.transform)?e.transform.fromArray(t.transform):t.transform&&e.transform.copy(t.transform),n=S.map(function(ee){return JSON.parse(ee)}).reduce(function(ee,re){return deepMerge(ee,re)}),Object.defineProperty(e,"raw",{configurable:!1,get:function(){return{works:S,options:R}}});{var C;if(t.workCode&&(typeof t.workCode=="string"?C=t.workCode:typeof t.workCode=="function"&&(C=t.workCode(n))),typeof C=="undefined"&&(C=String(n.resource_code||n.basic_code||n.vr_code||n.code||n.project_id||n.work_code||n.workCode)),typeof C=="undefined")return new Error("WorkCode never matched.");Object.defineProperty(e,"workCode",{configurable:!1,get:function(){return C}})}{var L=String(n.name);Object.defineProperty(e,"name",{configurable:!1,get:function(){return L}})}if(w instanceof Error)return w;Object.defineProperty(e,"issuer",{configurable:!1,get:function(){return w.issuer}}),Object.defineProperty(e,"expire",{configurable:!1,get:function(){return w.expire}}),Object.defineProperty(e,"allowHosts",{configurable:!1,get:function(){return w.allowHosts}});var I=(r=n.base_url)!==null&&r!==void 0?r:"";if(I&&I[I.length-1]!=="/"&&(I+="/"),w instanceof Error)return w;if(n.model){var F={work:e,layers:[]},k;n.model.file?k=fileURL(I,n.model.file,t):n.model.file_url&&(k=fileURL(I,n.model.file_url,t)),Object.defineProperty(F,"file",{configurable:!1,get:function(){return k}});var N;n.model.textureBase?N=textureURL$1(I,"",n.model.textureBase,t):n.model.material_base_url?N=textureURL$1(I,"",n.model.material_base_url,t):F.file&&(N=F.file.split("/").slice(0,-1).join("/").replace("/model/","/materials/")),Object.defineProperty(F,"textureBase",{configurable:!1,get:function(){return N}});var D;Array.isArray(n.model.textures)?(D=n.model.textures.map(function(ee){var re,z;return textureURL$1(I,ee,(z=(re=n.model.textureBase)!==null&&re!==void 0?re:n.model.material_base_url)!==null&&z!==void 0?z:"",t)}),Object.freeze(D)):Array.isArray(n.model.material_textures)&&(D=n.model.material_textures.map(function(ee){var re,z;return textureURL$1(I,ee,(z=(re=n.model.textureBase)!==null&&re!==void 0?re:n.model.material_base_url)!==null&&z!==void 0?z:"",t)}),Object.freeze(D)),Object.defineProperty(F,"textures",{configurable:!1,get:function(){return D}});var U=[];if(Array.isArray(n.model.tiles))for(var Q=0,q=n.model.tiles;Q<q.length;Q++){var G=q[Q];G&&(G.tileset||G.tileset_url)&&U.push(Object.freeze({type:(o=G.type)!==null&&o!==void 0?o:"mesh",name:(s=G.name)!==null&&s!==void 0?s:"",upAxis:(l=(u=G.upAxis)!==null&&u!==void 0?u:G.up_axis)!==null&&l!==void 0?l:"-Y",tileset:fileURL(I,G.tileset||G.tileset_url,t)}))}else n.model.tiles&&(n.model.tiles.tileset||n.model.tiles.tileset_url)&&U.push(Object.freeze({type:(c=n.model.tiles.type)!==null&&c!==void 0?c:"mesh",name:(f=n.model.tiles.name)!==null&&f!==void 0?f:"lod",upAxis:(p=(d=n.model.tiles.upAxis)!==null&&d!==void 0?d:n.model.tiles.up_axis)!==null&&p!==void 0?p:"-Y",tileset:fileURL(I,n.model.tiles.tileset||n.model.tiles.tileset_url,t)}));if(Array.isArray(n.model.layers))for(var J=0,X=n.model.layers;J<X.length;J++){var W=X[J];W&&(W.tileset||W.tileset_url)&&U.push(Object.freeze({type:(v=W.type)!==null&&v!==void 0?v:"mesh",name:(g=W.name)!==null&&g!==void 0?g:"",upAxis:(h=W.upAxis)!==null&&h!==void 0?h:W.up_axis,tileset:fileURL(I,W.tileset||W.tileset_url,t)}))}Object.freeze(U),Object.defineProperty(F,"layers",{configurable:!1,get:function(){return U}}),Object.defineProperty(e,"model",{configurable:!1,get:function(){if(F.file||F.layers.length)return F}})}if(w instanceof Error)return w;var j=new Set,te=new Set;{var $=[];if(n.observers&&Array.isArray(n.observers)){var ne=[];n.panorama&&(Array.isArray(n.panorama)?ne=n.panorama:Array.isArray(n.panorama.list)?ne=n.panorama.list:Array.isArray(n.panorama.info)&&(ne=n.panorama.info));for(var ie=function(ee){var re={},z=n.observers[ee];if(!z)return"break";var Re=ne[ee];if(!Re)return"break";z=Object.assign({},z,Re,{active:z.active!==!1&&Re.active!==!1}),Object.defineProperty(re,"work",{configurable:!1,get:function(){return e}}),Object.defineProperty(re,"index",{configurable:!1,get:function(){return ee}}),te.add(ee),Object.defineProperty(re,"panoIndex",{configurable:!1,get:function(){return ee}});var ve=panoStringify({workCode:e.workCode,panoIndex:ee});j.add(ve),Object.defineProperty(re,"panoId",{configurable:!1,get:function(){return ve}});var me=Object.freeze({workCode:e.workCode,panoIndex:ee});Object.defineProperty(re,"pano",{configurable:!1,get:function(){return me}});var we=z.active!==!1;Object.defineProperty(re,"active",{configurable:!1,get:function(){return we}});var ye=z.loadable===!0;Object.defineProperty(re,"loadable",{configurable:!1,get:function(){return ye}});var be=z.derived_id;Object.defineProperty(re,"derivedId",{configurable:!1,get:function(){return be}});var pe=z.derived_id_str;Object.defineProperty(re,"derivedIdStr",{configurable:!1,get:function(){return pe}});var ae=(T=(E=(y=(m=n.panorama)===null||m===void 0?void 0:m.pano_high_cube_base_url)!==null&&y!==void 0?y:(A=n.panorama)===null||A===void 0?void 0:A.pano_cube_base_url)!==null&&E!==void 0?E:(b=n.panorama)===null||b===void 0?void 0:b.base_url)!==null&&T!==void 0?T:"",ue={up:panoURL(I,ae,z.images?z.images.up:z.up,ee,t),down:panoURL(I,ae,z.images?z.images.down:z.down,ee,t),right:panoURL(I,ae,z.images?z.images.right:z.right,ee,t),left:panoURL(I,ae,z.images?z.images.left:z.left,ee,t),front:panoURL(I,ae,z.images?z.images.front:z.front,ee,t),back:panoURL(I,ae,z.images?z.images.back:z.back,ee,t)};if(z.size_list)ue.sizeList=z.size_list.slice();else{var Se=getImageSizeFromURL(ue.up);if(Se&&(ue.sizeList=[Se],z.tiles))for(var le=z.tiles.slice().sort(function(_e,Le){return _e-Le}).map(function(_e){return 512*Math.pow(2,_e)}),Ie=0,Ye=le;Ie<Ye.length;Ie++){var Ae=Ye[Ie];Ae>Se&&ue.sizeList.push(Ae)}}var Ce=z.images?z.images.luminance:z.luminance;Ce&&(ue.luminance=Object.freeze({up:panoURL(I,ae,Ce.up,ee,t),down:panoURL(I,ae,Ce.down,ee,t),right:panoURL(I,ae,Ce.right,ee,t),left:panoURL(I,ae,Ce.left,ee,t),front:panoURL(I,ae,Ce.front,ee,t),back:panoURL(I,ae,Ce.back,ee,t)}));var Oe=void 0;if(z.images)Oe=z.images.tiles;else if(Array.isArray(z.size_list)){var $e=z.size_list.slice().sort(function(_e,Le){return _e-Le});if($e[0]){var pt=getTileLevel($e[0]);if(pt)for(var tt=pt-1;tt>=0;tt--)$e.unshift(512*Math.pow(2,tt));Oe=$e}}else Array.isArray(z.tiles)&&(Oe=z.tiles.slice(),typeof Oe[0]=="number"&&(Oe=Oe.sort(function(_e,Le){return _e-Le}).map(function(_e){return 512*Math.pow(2,_e)})));if(Oe){for(var Ne=[],qe=0,Ve=Oe;qe<Ve.length;qe++){var Ae=Ve[qe];if(typeof Ae=="number"){var Ge=getTileLevel(Ae);if(typeof Ge!="number")continue;var Ke=getImageSizeFromURL(ue.front);if(!Ke)continue;if(Ae>Ke){var Je=replaceImageSize(ue.up,Ae),Pe=replaceImageSize(ue.down,Ae),xe=replaceImageSize(ue.right,Ae),Be=replaceImageSize(ue.left,Ae),De=replaceImageSize(ue.front,Ae),He=replaceImageSize(ue.back,Ae);Ne.push(Object.freeze({level:Ge,size:Ae,scale:1,up:Je,down:Pe,right:xe,left:Be,front:De,back:He}))}else{var Je=ue.up,Pe=ue.down,xe=ue.right,Be=ue.left,De=ue.front,He=ue.back;Ne.push(Object.freeze({level:Ge,size:Ke,scale:Ae/Ke,up:Je,down:Pe,right:xe,left:Be,front:De,back:He}))}}else{var Ge=Ae.level;if(typeof Ge!="number")continue;var Se=Ae.size;if(typeof Se!="number")continue;var Je=panoURL(I,ae,Ae.up,ee,t),Pe=panoURL(I,ae,Ae.down,ee,t),xe=panoURL(I,ae,Ae.right,ee,t),Be=panoURL(I,ae,Ae.left,ee,t),De=panoURL(I,ae,Ae.front,ee,t),He=panoURL(I,ae,Ae.back,ee,t);Ne.push(Object.freeze({level:Ge,size:Se,scale:(_=Ae.scale)!==null&&_!==void 0?_:1,up:Je,down:Pe,right:xe,left:Be,front:De,back:He}))}}Ne=sortTile(Ne),Object.freeze(Ne),Object.defineProperty(ue,"tiles",{configurable:!1,get:function(){return Ne}})}Object.freeze(ue),Object.defineProperty(re,"images",{configurable:!1,get:function(){return ue}});var Ue=new THREE__namespace.Vector3;if(z.position instanceof THREE__namespace.Vector3)Ue.copy(z.position);else if(Array.isArray(z.position))Ue.fromArray(z.position);else return"break";Object.freeze(Ue),Object.defineProperty(re,"position",{configurable:!1,get:function(){return Ue}});var Ze=new THREE__namespace.Vector3;if(z.standingPosition instanceof THREE__namespace.Vector3)Ze.copy(z.standingPosition);else if(Array.isArray(z.standingPosition))Ze.fromArray(z.standingPosition);else if(z.standing_position instanceof THREE__namespace.Vector3)Ze.copy(z.standing_position);else if(Array.isArray(z.standing_position))Ze.fromArray(z.standing_position);else return"break";Object.freeze(Ze),Object.defineProperty(re,"standingPosition",{configurable:!1,get:function(){return Ze}});var ze=new THREE__namespace.Quaternion;if(z.quaternion instanceof THREE__namespace.Quaternion)ze.copy(z.quaternion);else if(Array.isArray(z.quaternion))ze.fromArray(z.quaternion);else if(z.quaternion){var rt=z.quaternion,ot=rt.x,ht=rt.y,st=rt.z,ct=rt.w;ze.set(ot,ht,st,ct)}else return"break";Object.freeze(ze),Object.defineProperty(re,"quaternion",{configurable:!1,get:function(){return ze}});var je=0;isNumber(z.floorIndex)?je=z.floorIndex:isNumber(z.floor_index)?je=z.floor_index:isNumber(z.floor)&&(je=z.floor),Object.defineProperty(re,"floorIndex",{configurable:!1,get:function(){return je}});var Me;z.video&&(Me={},typeof z.video.source=="string"&&(Me.source=z.video.source),z.video.matrix instanceof THREE__namespace.Matrix4?Me.matrix=z.video.matrix.clone():Array.isArray(z.video.matrix)&&(Me.matrix=new THREE__namespace.Matrix4().fromArray(z.video.matrix)),z.video.size instanceof THREE__namespace.Vector2?Me.size=z.video.size.clone():Array.isArray(z.video.size)&&(Me.size=new THREE__namespace.Vector2().fromArray(z.video.size)),Me.source&&Me.matrix&&Me.size&&(re.video=Me)),Object.freeze(Me),Object.defineProperty(re,"video",{configurable:!1,get:function(){return Me}}),Array.isArray(z.accessibleNodes)?(re.accessibleNodes=z.accessibleNodes.slice(),re.accessibleIds=z.accessibleNodes.map(function(_e){return panoStringify({workCode:e.workCode,panoIndex:_e})})):Array.isArray(z.accessible_nodes)&&(re.accessibleNodes=z.accessible_nodes.slice(),re.accessibleIds=z.accessible_nodes.map(function(_e){return panoStringify({workCode:e.workCode,panoIndex:_e})})),Array.isArray(z.visibleNodes)?(re.visibleNodes=z.visibleNodes.slice(),re.visibleIds=z.visibleNodes.map(function(_e){return panoStringify({workCode:e.workCode,panoIndex:_e})})):Array.isArray(z.visible_nodes)&&(re.visibleNodes=z.visible_nodes.slice(),re.visibleIds=z.visible_nodes.map(function(_e){return panoStringify({workCode:e.workCode,panoIndex:_e})})),$[ee]=re},oe=0;oe<n.observers.length;oe++){var Z=ie(oe);if(Z==="break")break}}for(var de=function(ee){if(ee.accessibleIds){var Re=ee.accessibleIds.filter(function(ae){return j.has(ae)});Object.freeze(Re),Object.defineProperty(ee,"accessibleIds",{configurable:!1,get:function(){return Re}})}else{for(var re=[],z=0;z<$.length;z++)$[z]!==ee&&(Math.abs($[z].position.y-ee.position.y)>3||$[z].position.distanceTo(ee.position)>10||re.push($[z].panoId));Object.freeze(re),Object.defineProperty(ee,"accessibleIds",{configurable:!1,get:function(){return re}})}if(ee.accessibleNodes){var me=ee.accessibleNodes.filter(function(ae){return te.has(ae)});Object.freeze(me),Object.defineProperty(ee,"accessibleNodes",{configurable:!1,get:function(){return me}})}else{for(var ve=[],z=0;z<$.length;z++)$[z]!==ee&&(Math.abs($[z].position.y-ee.position.y)>3||$[z].position.distanceTo(ee.position)>10||ve.push($[z].panoIndex));Object.freeze(ve),Object.defineProperty(ee,"accessibleNodes",{configurable:!1,get:function(){return ve}})}if(ee.visibleIds){var ye=ee.visibleIds.filter(function(ae){return j.has(ae)});Object.freeze(ye),Object.defineProperty(ee,"visibleIds",{configurable:!1,get:function(){return ye}})}else{var we=ee.accessibleIds.slice();Object.freeze(we),Object.defineProperty(ee,"visibleIds",{configurable:!1,get:function(){return we}})}if(ee.visibleNodes){var pe=ee.visibleNodes.filter(function(ae){return te.has(ae)});Object.freeze(pe),Object.defineProperty(ee,"visibleNodes",{configurable:!1,get:function(){return pe}})}else{var be=ee.accessibleNodes.slice();Object.freeze(be),Object.defineProperty(ee,"visibleNodes",{configurable:!1,get:function(){return be}})}},he=0,fe=$;he<fe.length;he++){var Te=fe[he];de(Te)}Object.freeze($),Object.defineProperty(e,"observers",{configurable:!1,get:function(){return $}})}if(w instanceof Error)return w;if(n.initial){if((n.initial.mode==="Panorama"&&e.observers.length===0||n.initial.mode==="Floorplan"||n.initial.mode==="Topview"||n.initial.mode==="Model"||n.initial.mode==="Mapview"||n.initial.mode==="DepthPanorama")&&(e.initial.mode=n.initial.mode),isNumber(n.initial.latitude)&&(e.initial.latitude=n.initial.latitude),isNumber(n.initial.longitude)?e.initial.longitude=n.initial.longitude:isNumber(n.initial.heading)&&(e.initial.longitude=headingToLongitude(n.initial.heading)),isNumber(n.initial.fov)&&(e.initial.fov=n.initial.fov),e.observers.length>0){var ce=void 0;isNumber(n.initial.panoIndex)?ce=n.initial.panoIndex:isNumber(n.initial.pano_index)?ce=n.initial.pano_index:isNumber(n.initial.pano)&&(ce=n.initial.pano),typeof ce=="number"&&(ce=clamp$1(ce,0,e.observers.length-1),e.initial.panoIndex=ce)}if(isNumber(n.initial.distance)&&(e.initial.distance=n.initial.distance),Array.isArray(n.initial.offset)){var ge=[0,0,0].map(function(ee,re){var z=Number(n.initial.offset[re]);return isNaN(z)||!isFinite(z)?0:z});e.initial.offset=new THREE__namespace.Vector3().fromArray(ge)}!e.initial.mode&&typeof e.initial.panoIndex=="number"&&(e.initial.mode="Panorama")}return w instanceof Error?w:(workRawMapping.set(e,{works:S,options:R}),e)}function parseWork(n,t){typeof n=="string"&&n.trim()[0]==="{"&&(n=JSON.parse(n));var e=workRawMapping.get(n);if(e){if(t&&!equal(JSON.parse(e.options),t))throw new Error("[PARSE FAILED]: work is parsed with different options.");return n}else try{return new Work(n,t!=null?t:{})}catch(r){throw new Error("[PARSE FAILED]: "+r.message+`
|
|
1038
|
+
`+JSON.stringify(t))}return n.prototype.toJSON=function(){return this.raw},n.parse=parseWork,n}();function getType(n){return n==null?"null":Array.isArray(n)?"array":typeof n=="object"?"dict":"value"}function deepMerge(n,t){var e=getType(n),r=getType(t);if(r==="null")return n;if(r==="value")return t;if(r!==e)return JSON.parse(JSON.stringify(t));if(r==="array")for(var o=0;o<t.length;o++)n[o]=deepMerge(n[o],t[o]);else if(r==="dict")for(var s in t)n[s]=deepMerge(n[s],t[s]);return n}function startWithString(n,t){return n.indexOf(t)===0}function urlWithParseOptions(n,t,e,r){var o,s=t;if(r.jsonp===!0){s=t.replace(/([\?\#].*)?$/i,"");var u=sha256("".concat(s)).slice(0,7);s="".concat(s,".").concat(u,".jsonp")}if(r.shortPath===!0){var l=s.replace(n,"").split("."),c=(o=l.shift())!==null&&o!==void 0?o:"",f=l.join(".");s=pathJoin(n,sha256(c))+(f?"."+f:"")}var d=s.replace(n,"");return r.baseURL&&(s=pathJoin(r.baseURL,d)),r.traverseResource&&r.traverseResource({origin:t,absolute:s,relative:d,type:e}),s}function panoURL(n,t,e,r,o){var s=e;return isAbsoluteURL(e)||(t&&(t=pathJoin(t,String(r))),s=pathJoin(t,s)),isAbsoluteURL(s)||(s=pathJoin(n,s)),startWithString(s,n)||console.warn("".concat(s," is not start with base_url(").concat(n,").")),urlWithParseOptions(n,s,"panorama",o)}function fileURL(n,t,e){var r=t;return isAbsoluteURL(r)||(r=pathJoin(n,t)),startWithString(r,n)||console.warn("".concat(r," is not start with base_url(").concat(n,").")),urlWithParseOptions(n,r,"model",e)}function textureURL$1(n,t,e,r){var o=t;return isAbsoluteURL(o)||(o=pathJoin(e,o)),isAbsoluteURL(o)||(o=pathJoin(n,o)),startWithString(o,n)||console.warn("".concat(o," is not start with base_url(").concat(n,").")),urlWithParseOptions(n,o,"texture",r)}var getTileLevel=function(n){for(var t=10;t>=0;t--){var e=512*Math.pow(2,t);if(e<=n)return t}return null},sortTile=function(n){n=n.slice().sort(function(u,l){return u.level-l.level});for(var t=[],e=0,r=n;e<r.length;e++){var o=r[e];if(t.length===0){t.push(o);continue}var s=t[t.length-1];if(o.level>s.level){t.push(o);continue}if(o.size>s.size){t[t.length-1]=o;continue}}return t};function parse(n,t,e){for(var r,o,s,u,l,c,f,d,p,v,g,h,m,y,A,E,b,T,_,R=JSON.stringify(t),S=[],M=0,B=[].concat(n);M<B.length;M++){var H=B[M];H instanceof Work?S.push.apply(S,H.raw.works):typeof H=="string"?S.push(H):S.push(JSON.stringify(H))}var w=verify(S);if(w instanceof Error)return w;Array.isArray(t.transform)?e.transform.fromArray(t.transform):t.transform&&e.transform.copy(t.transform),n=S.map(function(Z){return JSON.parse(Z)}).reduce(function(Z,te){return deepMerge(Z,te)}),Object.defineProperty(e,"raw",{configurable:!1,get:function(){return{works:S,options:R}}});{var C;if(t.workCode&&(typeof t.workCode=="string"?C=t.workCode:typeof t.workCode=="function"&&(C=t.workCode(n))),typeof C=="undefined"&&(C=String(n.resource_code||n.basic_code||n.vr_code||n.code||n.project_id||n.work_code||n.workCode)),typeof C=="undefined")return new Error("WorkCode never matched.");Object.defineProperty(e,"workCode",{configurable:!1,get:function(){return C}})}{var L=String(n.name);Object.defineProperty(e,"name",{configurable:!1,get:function(){return L}})}if(w instanceof Error)return w;Object.defineProperty(e,"issuer",{configurable:!1,get:function(){return w.issuer}}),Object.defineProperty(e,"expire",{configurable:!1,get:function(){return w.expire}}),Object.defineProperty(e,"allowHosts",{configurable:!1,get:function(){return w.allowHosts}});var I=(r=n.base_url)!==null&&r!==void 0?r:"";if(I&&I[I.length-1]!=="/"&&(I+="/"),w instanceof Error)return w;if(n.model){var F={work:e,layers:[]},k;n.model.file?k=fileURL(I,n.model.file,t):n.model.file_url&&(k=fileURL(I,n.model.file_url,t)),Object.defineProperty(F,"file",{configurable:!1,get:function(){return k}});var N;n.model.textureBase?N=textureURL$1(I,"",n.model.textureBase,t):n.model.material_base_url?N=textureURL$1(I,"",n.model.material_base_url,t):F.file&&(N=F.file.split("/").slice(0,-1).join("/").replace("/model/","/materials/")),Object.defineProperty(F,"textureBase",{configurable:!1,get:function(){return N}});var D;Array.isArray(n.model.textures)?(D=n.model.textures.map(function(Z){var te,Q;return textureURL$1(I,Z,(Q=(te=n.model.textureBase)!==null&&te!==void 0?te:n.model.material_base_url)!==null&&Q!==void 0?Q:"",t)}),Object.freeze(D)):Array.isArray(n.model.material_textures)&&(D=n.model.material_textures.map(function(Z){var te,Q;return textureURL$1(I,Z,(Q=(te=n.model.textureBase)!==null&&te!==void 0?te:n.model.material_base_url)!==null&&Q!==void 0?Q:"",t)}),Object.freeze(D)),Object.defineProperty(F,"textures",{configurable:!1,get:function(){return D}});var U=[];if(Array.isArray(n.model.tiles))for(var z=0,G=n.model.tiles;z<G.length;z++){var q=G[z];q&&(q.tileset||q.tileset_url)&&U.push(Object.freeze({type:(o=q.type)!==null&&o!==void 0?o:"mesh",name:(s=q.name)!==null&&s!==void 0?s:"",upAxis:(l=(u=q.upAxis)!==null&&u!==void 0?u:q.up_axis)!==null&&l!==void 0?l:"-Y",tileset:fileURL(I,q.tileset||q.tileset_url,t)}))}else n.model.tiles&&(n.model.tiles.tileset||n.model.tiles.tileset_url)&&U.push(Object.freeze({type:(c=n.model.tiles.type)!==null&&c!==void 0?c:"mesh",name:(f=n.model.tiles.name)!==null&&f!==void 0?f:"lod",upAxis:(p=(d=n.model.tiles.upAxis)!==null&&d!==void 0?d:n.model.tiles.up_axis)!==null&&p!==void 0?p:"-Y",tileset:fileURL(I,n.model.tiles.tileset||n.model.tiles.tileset_url,t)}));if(Array.isArray(n.model.layers))for(var K=0,j=n.model.layers;K<j.length;K++){var W=j[K];W&&(W.tileset||W.tileset_url)&&U.push(Object.freeze({type:(v=W.type)!==null&&v!==void 0?v:"mesh",name:(g=W.name)!==null&&g!==void 0?g:"",upAxis:(h=W.upAxis)!==null&&h!==void 0?h:W.up_axis,tileset:fileURL(I,W.tileset||W.tileset_url,t)}))}Object.freeze(U),Object.defineProperty(F,"layers",{configurable:!1,get:function(){return U}}),Object.defineProperty(e,"model",{configurable:!1,get:function(){if(F.file||F.layers.length)return F}})}if(w instanceof Error)return w;var X=new Set,ee=new Set;{var $=[];if(n.observers&&Array.isArray(n.observers)){var re=[];n.panorama&&(Array.isArray(n.panorama)?re=n.panorama:Array.isArray(n.panorama.list)?re=n.panorama.list:Array.isArray(n.panorama.info)&&(re=n.panorama.info));for(var ie=function(Z){var te={},Q=n.observers[Z];if(!Q)return"break";var be=re[Z];if(!be)return"break";Q=Object.assign({},Q,be,{active:Q.active!==!1&&be.active!==!1}),Object.defineProperty(te,"work",{configurable:!1,get:function(){return e}}),Object.defineProperty(te,"index",{configurable:!1,get:function(){return Z}}),ee.add(Z),Object.defineProperty(te,"panoIndex",{configurable:!1,get:function(){return Z}});var ye=panoStringify({workCode:e.workCode,panoIndex:Z});X.add(ye),Object.defineProperty(te,"panoId",{configurable:!1,get:function(){return ye}});var Ae=Object.freeze({workCode:e.workCode,panoIndex:Z});Object.defineProperty(te,"pano",{configurable:!1,get:function(){return Ae}});var Me=Q.active!==!1;Object.defineProperty(te,"active",{configurable:!1,get:function(){return Me}});var ge=Q.loadable===!0;Object.defineProperty(te,"loadable",{configurable:!1,get:function(){return ge}});var he=Q.derived_id;Object.defineProperty(te,"derivedId",{configurable:!1,get:function(){return he}});var de=Q.derived_id_str;Object.defineProperty(te,"derivedIdStr",{configurable:!1,get:function(){return de}});var ce=(T=(E=(y=(m=n.panorama)===null||m===void 0?void 0:m.pano_high_cube_base_url)!==null&&y!==void 0?y:(A=n.panorama)===null||A===void 0?void 0:A.pano_cube_base_url)!==null&&E!==void 0?E:(b=n.panorama)===null||b===void 0?void 0:b.base_url)!==null&&T!==void 0?T:"",le={up:panoURL(I,ce,Q.images?Q.images.up:Q.up,Z,t),down:panoURL(I,ce,Q.images?Q.images.down:Q.down,Z,t),right:panoURL(I,ce,Q.images?Q.images.right:Q.right,Z,t),left:panoURL(I,ce,Q.images?Q.images.left:Q.left,Z,t),front:panoURL(I,ce,Q.images?Q.images.front:Q.front,Z,t),back:panoURL(I,ce,Q.images?Q.images.back:Q.back,Z,t)};if(Q.size_list)le.sizeList=Q.size_list.slice();else{var we=getImageSizeFromURL(le.up);if(we&&(le.sizeList=[we],Q.tiles))for(var ue=Q.tiles.slice().sort(function(Re,Le){return Re-Le}).map(function(Re){return 512*Math.pow(2,Re)}),ve=0,qe=ue;ve<qe.length;ve++){var Ee=qe[ve];Ee>we&&le.sizeList.push(Ee)}}var Ie=Q.images?Q.images.luminance:Q.luminance;Ie&&(le.luminance=Object.freeze({up:panoURL(I,ce,Ie.up,Z,t),down:panoURL(I,ce,Ie.down,Z,t),right:panoURL(I,ce,Ie.right,Z,t),left:panoURL(I,ce,Ie.left,Z,t),front:panoURL(I,ce,Ie.front,Z,t),back:panoURL(I,ce,Ie.back,Z,t)}));var Oe=void 0;if(Q.images)Oe=Q.images.tiles;else if(Array.isArray(Q.size_list)){var $e=Q.size_list.slice().sort(function(Re,Le){return Re-Le});if($e[0]){var pt=getTileLevel($e[0]);if(pt)for(var tt=pt-1;tt>=0;tt--)$e.unshift(512*Math.pow(2,tt));Oe=$e}}else Array.isArray(Q.tiles)&&(Oe=Q.tiles.slice(),typeof Oe[0]=="number"&&(Oe=Oe.sort(function(Re,Le){return Re-Le}).map(function(Re){return 512*Math.pow(2,Re)})));if(Oe){for(var Ne=[],Ge=0,Ve=Oe;Ge<Ve.length;Ge++){var Ee=Ve[Ge];if(typeof Ee=="number"){var Ke=getTileLevel(Ee);if(typeof Ke!="number")continue;var Je=getImageSizeFromURL(le.front);if(!Je)continue;if(Ee>Je){var Xe=replaceImageSize(le.up,Ee),Pe=replaceImageSize(le.down,Ee),Se=replaceImageSize(le.right,Ee),Be=replaceImageSize(le.left,Ee),De=replaceImageSize(le.front,Ee),He=replaceImageSize(le.back,Ee);Ne.push(Object.freeze({level:Ke,size:Ee,scale:1,up:Xe,down:Pe,right:Se,left:Be,front:De,back:He}))}else{var Xe=le.up,Pe=le.down,Se=le.right,Be=le.left,De=le.front,He=le.back;Ne.push(Object.freeze({level:Ke,size:Je,scale:Ee/Je,up:Xe,down:Pe,right:Se,left:Be,front:De,back:He}))}}else{var Ke=Ee.level;if(typeof Ke!="number")continue;var we=Ee.size;if(typeof we!="number")continue;var Xe=panoURL(I,ce,Ee.up,Z,t),Pe=panoURL(I,ce,Ee.down,Z,t),Se=panoURL(I,ce,Ee.right,Z,t),Be=panoURL(I,ce,Ee.left,Z,t),De=panoURL(I,ce,Ee.front,Z,t),He=panoURL(I,ce,Ee.back,Z,t);Ne.push(Object.freeze({level:Ke,size:we,scale:(_=Ee.scale)!==null&&_!==void 0?_:1,up:Xe,down:Pe,right:Se,left:Be,front:De,back:He}))}}Ne=sortTile(Ne),Object.freeze(Ne),Object.defineProperty(le,"tiles",{configurable:!1,get:function(){return Ne}})}Object.freeze(le),Object.defineProperty(te,"images",{configurable:!1,get:function(){return le}});var Ue=new THREE__namespace.Vector3;if(Q.position instanceof THREE__namespace.Vector3)Ue.copy(Q.position);else if(Array.isArray(Q.position))Ue.fromArray(Q.position);else return"break";Object.freeze(Ue),Object.defineProperty(te,"position",{configurable:!1,get:function(){return Ue}});var Ye=new THREE__namespace.Vector3;if(Q.standingPosition instanceof THREE__namespace.Vector3)Ye.copy(Q.standingPosition);else if(Array.isArray(Q.standingPosition))Ye.fromArray(Q.standingPosition);else if(Q.standing_position instanceof THREE__namespace.Vector3)Ye.copy(Q.standing_position);else if(Array.isArray(Q.standing_position))Ye.fromArray(Q.standing_position);else return"break";Object.freeze(Ye),Object.defineProperty(te,"standingPosition",{configurable:!1,get:function(){return Ye}});var ze=new THREE__namespace.Quaternion;if(Q.quaternion instanceof THREE__namespace.Quaternion)ze.copy(Q.quaternion);else if(Array.isArray(Q.quaternion))ze.fromArray(Q.quaternion);else if(Q.quaternion){var rt=Q.quaternion,ot=rt.x,ht=rt.y,st=rt.z,ct=rt.w;ze.set(ot,ht,st,ct)}else return"break";Object.freeze(ze),Object.defineProperty(te,"quaternion",{configurable:!1,get:function(){return ze}});var We=0;isNumber(Q.floorIndex)?We=Q.floorIndex:isNumber(Q.floor_index)?We=Q.floor_index:isNumber(Q.floor)&&(We=Q.floor),Object.defineProperty(te,"floorIndex",{configurable:!1,get:function(){return We}});var Ce;Q.video&&(Ce={},typeof Q.video.source=="string"&&(Ce.source=Q.video.source),Q.video.matrix instanceof THREE__namespace.Matrix4?Ce.matrix=Q.video.matrix.clone():Array.isArray(Q.video.matrix)&&(Ce.matrix=new THREE__namespace.Matrix4().fromArray(Q.video.matrix)),Q.video.size instanceof THREE__namespace.Vector2?Ce.size=Q.video.size.clone():Array.isArray(Q.video.size)&&(Ce.size=new THREE__namespace.Vector2().fromArray(Q.video.size)),Ce.source&&Ce.matrix&&Ce.size&&(te.video=Ce)),Object.freeze(Ce),Object.defineProperty(te,"video",{configurable:!1,get:function(){return Ce}}),Array.isArray(Q.accessibleNodes)?(te.accessibleNodes=Q.accessibleNodes.slice(),te.accessibleIds=Q.accessibleNodes.map(function(Re){return panoStringify({workCode:e.workCode,panoIndex:Re})})):Array.isArray(Q.accessible_nodes)&&(te.accessibleNodes=Q.accessible_nodes.slice(),te.accessibleIds=Q.accessible_nodes.map(function(Re){return panoStringify({workCode:e.workCode,panoIndex:Re})})),Array.isArray(Q.visibleNodes)?(te.visibleNodes=Q.visibleNodes.slice(),te.visibleIds=Q.visibleNodes.map(function(Re){return panoStringify({workCode:e.workCode,panoIndex:Re})})):Array.isArray(Q.visible_nodes)&&(te.visibleNodes=Q.visible_nodes.slice(),te.visibleIds=Q.visible_nodes.map(function(Re){return panoStringify({workCode:e.workCode,panoIndex:Re})})),$[Z]=te},se=0;se<n.observers.length;se++){var ae=ie(se);if(ae==="break")break}}for(var fe=function(Z){if(Z.accessibleIds){var be=Z.accessibleIds.filter(function(ce){return X.has(ce)});Object.freeze(be),Object.defineProperty(Z,"accessibleIds",{configurable:!1,get:function(){return be}})}else{for(var te=[],Q=0;Q<$.length;Q++)$[Q]!==Z&&(Math.abs($[Q].position.y-Z.position.y)>3||$[Q].position.distanceTo(Z.position)>10||te.push($[Q].panoId));Object.freeze(te),Object.defineProperty(Z,"accessibleIds",{configurable:!1,get:function(){return te}})}if(Z.accessibleNodes){var Ae=Z.accessibleNodes.filter(function(ce){return ee.has(ce)});Object.freeze(Ae),Object.defineProperty(Z,"accessibleNodes",{configurable:!1,get:function(){return Ae}})}else{for(var ye=[],Q=0;Q<$.length;Q++)$[Q]!==Z&&(Math.abs($[Q].position.y-Z.position.y)>3||$[Q].position.distanceTo(Z.position)>10||ye.push($[Q].panoIndex));Object.freeze(ye),Object.defineProperty(Z,"accessibleNodes",{configurable:!1,get:function(){return ye}})}if(Z.visibleIds){var ge=Z.visibleIds.filter(function(ce){return X.has(ce)});Object.freeze(ge),Object.defineProperty(Z,"visibleIds",{configurable:!1,get:function(){return ge}})}else{var Me=Z.accessibleIds.slice();Object.freeze(Me),Object.defineProperty(Z,"visibleIds",{configurable:!1,get:function(){return Me}})}if(Z.visibleNodes){var de=Z.visibleNodes.filter(function(ce){return ee.has(ce)});Object.freeze(de),Object.defineProperty(Z,"visibleNodes",{configurable:!1,get:function(){return de}})}else{var he=Z.accessibleNodes.slice();Object.freeze(he),Object.defineProperty(Z,"visibleNodes",{configurable:!1,get:function(){return he}})}},ne=0,pe=$;ne<pe.length;ne++){var _e=pe[ne];fe(_e)}Object.freeze($),Object.defineProperty(e,"observers",{configurable:!1,get:function(){return $}})}if(w instanceof Error)return w;if(n.initial){if((n.initial.mode==="Panorama"&&e.observers.length===0||n.initial.mode==="Floorplan"||n.initial.mode==="Topview"||n.initial.mode==="Model"||n.initial.mode==="Mapview"||n.initial.mode==="DepthPanorama")&&(e.initial.mode=n.initial.mode),isNumber(n.initial.latitude)&&(e.initial.latitude=n.initial.latitude),isNumber(n.initial.longitude)?e.initial.longitude=n.initial.longitude:isNumber(n.initial.heading)&&(e.initial.longitude=headingToLongitude(n.initial.heading)),isNumber(n.initial.fov)&&(e.initial.fov=n.initial.fov),e.observers.length>0){var me=void 0;isNumber(n.initial.panoIndex)?me=n.initial.panoIndex:isNumber(n.initial.pano_index)?me=n.initial.pano_index:isNumber(n.initial.pano)&&(me=n.initial.pano),typeof me=="number"&&(me=clamp$1(me,0,e.observers.length-1),e.initial.panoIndex=me)}if(isNumber(n.initial.distance)&&(e.initial.distance=n.initial.distance),Array.isArray(n.initial.offset)){var xe=[0,0,0].map(function(Z,te){var Q=Number(n.initial.offset[te]);return isNaN(Q)||!isFinite(Q)?0:Q});e.initial.offset=new THREE__namespace.Vector3().fromArray(xe)}!e.initial.mode&&typeof e.initial.panoIndex=="number"&&(e.initial.mode="Panorama")}return w instanceof Error?w:(workRawMapping.set(e,{works:S,options:R}),e)}function parseWork(n,t){typeof n=="string"&&n.trim()[0]==="{"&&(n=JSON.parse(n));var e=workRawMapping.get(n);if(e){if(t&&!equal(JSON.parse(e.options),t))throw new Error("[PARSE FAILED]: work is parsed with different options.");return n}else try{return new Work(n,t!=null?t:{})}catch(r){throw new Error("[PARSE FAILED]: "+r.message+`
|
|
1039
1039
|
Error work input:
|
|
1040
|
-
`+JSON.stringify(n))}}function createWorks(n){for(var t={},e=[],r={},o=0,s=n;o<s.length;o++){var u=s[o],l=t[u.workCode];l||(l=t[u.workCode]=new THREE__namespace.Matrix4().copy(u.transform));for(var c=0,f=u.observers;c<f.length;c++){var d=f[c],p={isResolved:!0,active:d.active,accessibleIds:d.accessibleIds,visibleIds:d.visibleIds,accessibleNodes:d.accessibleNodes,visibleNodes:d.visibleNodes,floorIndex:d.floorIndex,images:d.images,index:d.index,panoIndex:d.panoIndex,loadable:d.loadable,panoId:d.panoId,pano:d.pano,work:d.work,derivedId:d.derivedId,video:d.video,position:new THREE__namespace.Vector3().copy(d.position).applyMatrix4(l),standingPosition:new THREE__namespace.Vector3().copy(d.standingPosition).applyMatrix4(l),quaternion:new THREE__namespace.Quaternion().setFromRotationMatrix(scratchMatrix4$1.makeRotationFromQuaternion(d.quaternion).premultiply(l))};Object.freeze(p),e.push(p),r[p.panoId]=p}}Object.freeze(e);for(var v=n.slice(),g={},h=0,m=v;h<m.length;h++){var u=m[h];g[u.workCode]=u}return Object.freeze(Object.assign(v,{get initial(){return v.length>0?v[0].initial:{work:{}}},get resolvedObservers(){return e},getWork:function(y){return g[y]},getResolvedObserver:function(y){var A,E;return isPanoId(y)?r[y]:typeof y=="number"?r[panoStringify({workCode:(E=(A=n[0])===null||A===void 0?void 0:A.workCode)!==null&&E!==void 0?E:"",panoIndex:y})]:r[panoStringify(y)]},update:function(){for(var y=0,A=v;y<A.length;y++){var E=A[y],b=E.transform,T=t[E.workCode];T?T.equals(b)||(T.copy(b),needsUpdateWorkCodeSet.add(E.workCode)):(t[E.workCode]=new THREE__namespace.Matrix4().copy(b),needsUpdateWorkCodeSet.add(E.workCode))}if(needsUpdateWorkCodeSet.size>0){for(var _=0,R=e;_<R.length;_++){var S=R[_];if(needsUpdateWorkCodeSet.has(S.work.workCode)){var M=S.work.observers[S.index],B=S.work.transform;S.position.copy(M.position).applyMatrix4(B),S.standingPosition.copy(M.standingPosition).applyMatrix4(B),S.quaternion.setFromRotationMatrix(scratchMatrix4$1.makeRotationFromQuaternion(M.quaternion).premultiply(B))}}needsUpdateWorkCodeSet.clear()}}}))}var fetcherMap=new Map;function getFetcher(n){var t=fetcherMap.get(n);if(t)return t;throw new Error("fetcher never registered.")}function registerFetcher(n,t){return fetcherMap.set(n,t)}var BufferGeometryUtils={computeTangents:function(n){var t=n.index,e=n.attributes;if(t===null||e.position===void 0||e.normal===void 0||e.uv===void 0){console.warn("THREE.BufferGeometry: Missing required attributes (index, position, normal or uv) in BufferGeometry.computeTangents()");return}var r=t.array,o=e.position.array,s=e.normal.array,u=e.uv.array,l=o.length/3;e.tangent===void 0&&n.setAttribute("tangent",new THREE__namespace.BufferAttribute(new Float32Array(4*l),4));for(var c=e.tangent.array,f=[],d=[],p=0;p<l;p++)f[p]=new THREE__namespace.Vector3,d[p]=new THREE__namespace.Vector3;var v=new THREE__namespace.Vector3,g=new THREE__namespace.Vector3,h=new THREE__namespace.Vector3,m=new THREE__namespace.Vector2,y=new THREE__namespace.Vector2,A=new THREE__namespace.Vector2,E=new THREE__namespace.Vector3,b=new THREE__namespace.Vector3;function T(Q,q,G){v.fromArray(o,Q*3),g.fromArray(o,q*3),h.fromArray(o,G*3),m.fromArray(u,Q*2),y.fromArray(u,q*2),A.fromArray(u,G*2);var J=g.x-v.x,X=h.x-v.x,W=g.y-v.y,j=h.y-v.y,te=g.z-v.z,$=h.z-v.z,ne=y.x-m.x,ie=A.x-m.x,oe=y.y-m.y,Z=A.y-m.y,de=1/(ne*Z-ie*oe);E.set((Z*J-oe*X)*de,(Z*W-oe*j)*de,(Z*te-oe*$)*de),b.set((ne*X-ie*J)*de,(ne*j-ie*W)*de,(ne*$-ie*te)*de),f[Q].add(E),f[q].add(E),f[G].add(E),d[Q].add(b),d[q].add(b),d[G].add(b)}var _=n.groups;_.length===0&&(_=[{start:0,count:r.length}]);for(var p=0,R=_.length;p<R;++p)for(var S=_[p],M=S.start,B=S.count,H=M,w=M+B;H<w;H+=3)T(r[H+0],r[H+1],r[H+2]);var C=new THREE__namespace.Vector3,L=new THREE__namespace.Vector3,I=new THREE__namespace.Vector3,F=new THREE__namespace.Vector3,k,N,D;function U(Q){I.fromArray(s,Q*3),F.copy(I),N=f[Q],C.copy(N),C.sub(I.multiplyScalar(I.dot(N))).normalize(),L.crossVectors(F,N),D=L.dot(d[Q]),k=D<0?-1:1,c[Q*4]=C.x,c[Q*4+1]=C.y,c[Q*4+2]=C.z,c[Q*4+3]=k}for(var p=0,R=_.length;p<R;++p)for(var S=_[p],M=S.start,B=S.count,H=M,w=M+B;H<w;H+=3)U(r[H+0]),U(r[H+1]),U(r[H+2])},mergeBufferGeometries:function(n,t){for(var e=n[0].index!==null,r=new Set(Object.keys(n[0].attributes)),o=new Set(Object.keys(n[0].morphAttributes)),s={},u={},l=new THREE__namespace.BufferGeometry,c=0,f=0;f<n.length;++f){var d=n[f];if(e!==(d.index!==null))return null;for(var p in d.attributes){if(!r.has(p))return null;s[p]===void 0&&(s[p]=[]),s[p].push(d.attributes[p])}for(var p in d.morphAttributes){if(!o.has(p))return null;u[p]===void 0&&(u[p]=[]),u[p].push(d.morphAttributes[p])}if(l.userData.mergedUserData=l.userData.mergedUserData||[],l.userData.mergedUserData.push(d.userData),t){var v;if(e)v=d.index.count;else if(d.attributes.position!==void 0)v=d.attributes.position.count;else return null;l.addGroup(c,v,f),c+=v}}if(e){for(var g=0,h=[],f=0;f<n.length;++f){for(var m=n[f].index,y=0;y<m.count;++y)h.push(m.getX(y)+g);g+=n[f].attributes.position.count}l.setIndex(h)}for(var p in s){var A=this.mergeBufferAttributes(s[p]);if(!A)return null;l.setAttribute(p,A)}for(var p in u){var E=u[p][0].length;if(E===0)break;l.morphAttributes=l.morphAttributes||{},l.morphAttributes[p]=[];for(var f=0;f<E;++f){for(var b=[],y=0;y<u[p].length;++y)b.push(u[p][y][f]);var T=this.mergeBufferAttributes(b);if(!T)return null;l.morphAttributes[p].push(T)}}return l},mergeBufferAttributes:function(n){for(var t,e,r,o=0,s=0;s<n.length;++s){var u=n[s];if(u.isInterleavedBufferAttribute||(t===void 0&&(t=u.array.constructor),t!==u.array.constructor)||(e===void 0&&(e=u.itemSize),e!==u.itemSize)||(r===void 0&&(r=u.normalized),r!==u.normalized))return null;o+=u.array.length}for(var l=new t(o),c=0,s=0;s<n.length;++s)l.set(n[s].array,c),c+=n[s].array.length;return new THREE__namespace.BufferAttribute(l,e,r)},interleaveAttributes:function(n){for(var t,e=0,r=0,o=0,s=n.length;o<s;++o){var u=n[o];if(t===void 0&&(t=u.array.constructor),t!==u.array.constructor)return console.warn("AttributeBuffers of different types cannot be interleaved"),null;e+=u.array.length,r+=u.itemSize}for(var l=new THREE__namespace.InterleavedBuffer(new t(e),r),c=0,f=[],d=["getX","getY","getZ","getW"],p=["setX","setY","setZ","setW"],v=0,s=n.length;v<s;v++){var u=n[v],g=u.itemSize,h=u.count,m=new THREE__namespace.InterleavedBufferAttribute(l,g,c,u.normalized);f.push(m),c+=g;for(var y=0;y<h;y++)for(var A=0;A<g;A++)m[p[A]](y,u[d[A]](y))}return f},estimateBytesUsed:function(n){var t=0;for(var e in n.attributes){var r=n.getAttribute(e);t+=r.count*r.itemSize*r.array.BYTES_PER_ELEMENT}var o=n.getIndex();return t+=o?o.count*o.itemSize*o.array.BYTES_PER_ELEMENT:0,t},mergeVertices:function(n,t){t===void 0&&(t=1e-4),t=Math.max(t,Number.EPSILON);for(var e={},r=n.getIndex(),o=n.getAttribute("position"),s=r?r.count:o.count,u=0,l=Object.keys(n.attributes),c={},f={},d=[],p=["getX","getY","getZ","getW"],v=0,g=l.length;v<g;v++){var h=l[v];c[h]=[];var m=n.morphAttributes[h];m&&(f[h]=new Array(m.length).fill().map(function(){return[]}))}for(var y=Math.log10(1/t),A=Math.pow(10,y),v=0;v<s;v++){for(var E=r?r.getX(v):v,b="",T=0,g=l.length;T<g;T++)for(var h=l[T],_=n.getAttribute(h),R=_.itemSize,S=0;S<R;S++)b+="".concat(~~(_[p[S]](E)*A),",");if(b in e)d.push(e[b]);else{for(var T=0,g=l.length;T<g;T++)for(var h=l[T],_=n.getAttribute(h),m=n.morphAttributes[h],R=_.itemSize,M=c[h],B=f[h],S=0;S<R;S++){var H=p[S];if(M.push(_[H](E)),m)for(var w=0,C=m.length;w<C;w++)B[w].push(m[w][H](E))}e[b]=u,d.push(u),u++}}for(var L=n.clone(),v=0,g=l.length;v<g;v++){var h=l[v],I=n.getAttribute(h),F=new I.array.constructor(c[h]),_=new THREE__namespace.BufferAttribute(F,I.itemSize,I.normalized);if(L.setAttribute(h,_),h in f)for(var T=0;T<f[h].length;T++){var k=n.morphAttributes[h][T],F=new k.array.constructor(f[h][T]),N=new THREE__namespace.BufferAttribute(F,k.itemSize,k.normalized);L.morphAttributes[h][T]=N}}return L.setIndex(d),L}};function isThirdPersonMode(n){switch(n){case"Floorplan":return!0;case"Mapview":return!0;default:return!1}}function isFristPersonMode(n){switch(n){case"Panorama":return!0;case"VRPanorama":return!0;case"XRPanorama":return!0;case"Model":return!0;default:return!1}}var scratchVector3=new THREE__namespace.Vector3,scratchSphere=new THREE__namespace.Sphere,scratchMatrix4=new THREE__namespace.Matrix4,scratchMatrix4Inverse=new THREE__namespace.Matrix4,scratchBoundingBox=new THREE__namespace.Box3,ROTATE_X_90_MATRIX=new THREE__namespace.Matrix4().fromArray([1,0,0,0,0,0,-1,0,0,1,0,0,0,0,0,1]),ROTATE_X_90_MATRIX_INVERSE=new THREE__namespace.Matrix4().fromArray([1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1]),DEFAULT_BOUNDING=new THREE__namespace.Box3(new THREE__namespace.Vector3(-.5,-.5,-.5),new THREE__namespace.Vector3(.5,.5,.5));function getEcefToEnuMatrixFromUpAxis(n,t,e){switch(n){case"Z":break;case"Y":e.copy(ROTATE_X_90_MATRIX_INVERSE);break;case"-Y":e.copy(ROTATE_X_90_MATRIX);break;case"WGS84":case"GCJ02":case"BD09":getEcefToEnuMatrix(t,e);break;default:e.identity();break}return e}function getExt(n){var t=/([0-9a-z\.\_\-]+)([\?\#].*)?$/i.exec(n);if(t){var e=String(t[1]).trim().split(".").slice(1).reverse()[0];if(e)return e}return""}var ModelViewLayer=function(){function n(t,e){this.scene=t,this.error=e,t.viewLayer=this}return Object.defineProperty(n.prototype,"name",{get:function(){return this.scene.name},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"type",{get:function(){return this.scene.type},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"upAxis",{get:function(){return this.scene.upAxis},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"groundHeight",{get:function(){return this.scene.groundHeight},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"model",{get:function(){return this.scene.model},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"coordinates",{get:function(){scratchVector3.setScalar(0);var t=this.scene.localToLla(scratchVector3),e=t.x,r=t.y;return[e,r].map(function(o){return(o/Math.PI*180).toFixed(6)}).join(",")},enumerable:!1,configurable:!0}),n.prototype.getTransformMatrix4=function(t){return t===void 0&&(t=new THREE__namespace.Matrix4),t.copy(this.scene.coordinateTransform.ecefToLocalMatrix),this.scene&&t.premultiply(this.scene.matrixWorld),t},n.prototype.coordinatesToWorldPoint=function(t){var e=new THREE__namespace.Vector3(t.latitude,t.longitude,t.altitude);return this.scene.llaToWorld(e)},n.prototype.worldPointToCoordinates=function(t){return scratchVector3.copy(t),this.scene.worldToLla(scratchVector3),{latitude:scratchVector3.x,longitude:scratchVector3.y,altitude:scratchVector3.z}},n}(),Model=function(n){__extends(t,n);function t(e){e===void 0&&(e={});var r,o,s,u=n.call(this)||this;return u.name="",u.onError=(r=e.onError)!==null&&r!==void 0?r:noop$1,u.onShownFloorChange=(o=e.onShownFloorChange)!==null&&o!==void 0?o:noop$1,u.onLoad=(s=e.onLoad)!==null&&s!==void 0?s:noop$1,u.work=null,u.viewLayers=[],u.bounding=new THREE__namespace.Box3(new THREE__namespace.Vector3,new THREE__namespace.Vector3),u.floorLength=0,u.textureOptions={},u.refined=!1,u.refineProgress=[0,0],u.loaded=!1,u.matrixAutoUpdate=!1,u.needsRender=!0,u.autoRefine=!0,u.materialVersion=0,u.materialParameters=__assign({},defaultPbmParameters),u.cacheCameras=[],u.disposed=!1,u}return Object.defineProperty(t.prototype,"empty",{get:function(){return this.viewLayers.length===0},enumerable:!1,configurable:!0}),t.prototype.getMaterial=function(){return __assign({},this.materialParameters)},t.prototype.setMaterial=function(e){var r=this.materialParameters.shownFloorIndex,o=updatePBMParameters(this.materialParameters,e);if(o){var s=this.materialParameters.shownFloorIndex;r!==s&&this.onShownFloorChange(s),this.materialVersion++,this.needsRender=!0}},Object.defineProperty(t.prototype,"brightness",{get:function(){return this.materialParameters.brightness},set:function(e){this.setMaterial({brightness:typeof e=="number"?e:1})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"shownFloorIndex",{get:function(){return this.materialParameters.shownFloorIndex},set:function(e){this.setMaterial({shownFloorIndex:e})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"shownFloor",{get:function(){return this.shownFloorIndex===-1?null:this.shownFloorIndex},set:function(e){this.shownFloorIndex=e===null?-1:e},enumerable:!1,configurable:!0}),t.prototype.show=function(e){this.shownFloor=e!=null?e:null},Object.defineProperty(t.prototype,"clippers",{get:function(){return this.materialParameters.clippers},set:function(e){this.setMaterial({clippers:e})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"customShaders",{get:function(){return this.materialParameters.customShaders},set:function(e){this.setMaterial({customShaders:e})},enumerable:!1,configurable:!0}),t.prototype.getEdgesBySphere=function(e,r){r===void 0&&(r=30/180*Math.PI);for(var o=Math.cos(r),s=[],u=0,l=this.children;u<l.length;u++){var c=l[u];c instanceof Tile3DModel&&c.tileset.selectedTiles.forEach(function(f){var d,p,v;if(!(f.boundingVolume&&f.boundingVolume.distanceToPoint(e.center)>e.radius)){var g=(p=(d=f.content)===null||d===void 0?void 0:d.data)===null||p===void 0?void 0:p.object;if(g&&g.visible){var h=[];if(g.traverseVisible(function(G){if(G instanceof THREE__namespace.Mesh){var J=bvhMeshMap.get(G);if(J){scratchMatrix4.copy(G.matrixWorld),scratchMatrix4Inverse.getInverse(scratchMatrix4),scratchSphere.copy(e).applyMatrix4(scratchMatrix4Inverse);var X=J.trianglesInSphere(scratchSphere.center,scratchSphere.radius),W=new THREE__namespace.BufferGeometry;W.setAttribute("position",new THREE__namespace.BufferAttribute(X,3)),W.applyMatrix4(G.matrixWorld),W=BufferGeometryUtils.mergeVertices(W,.01),h.push(W)}}}),h.length===0)return;for(var m=["a","b","c"],y=BufferGeometryUtils.mergeBufferGeometries(h,!1),A=y.getAttribute("position").array,E=((v=y.getIndex())===null||v===void 0?void 0:v.array)||[],b=[],T=[],_=0,R=A.length;_<R;_+=3){var S=new THREE__namespace.Vector3(A[_],A[_+1],A[_+2]);b.push(S)}for(var _=0,R=E.length;_<R;_+=3){var M=E[_],B=E[_+1],H=E[_+2],w=new THREE__namespace.Vector3().crossVectors(b[B].clone().sub(b[M]),b[H].clone().sub(b[M])).normalize();T.push({a:M,b:B,c:H,normal:w})}for(var C={},_=0,R=T.length;_<R;_++)for(var L=T[_],I=0;I<3;I++){var F=L[m[I]],k=L[m[(I+1)%3]],N=[Math.min(F,k),Math.max(F,k)],D=N[0]+"-"+N[1];C[D]===void 0?C[D]={index1:N[0],index2:N[1],face1:_}:C[D].face2=_}for(var D in C){var U=C[D];if(U.face2===void 0||T[U.face1].normal.dot(T[U.face2].normal)<=o){var Q=b[U.index1],q=b[U.index2];s.push(new THREE__namespace.Line3(Q,q))}}b.length=0,T.length=0}}})}return s},t.prototype.intersectRaycaster=function(e,r,o){r===void 0&&(r=null),o===void 0&&(o=!0);for(var s=[],u=0,l=this.children.length;u<l;u++){var c=this.children[u];c.visible&&c instanceof Tile3DModel&&c.intersectRaycaster(e,!1,s)}return r!=null&&(s=s.filter(function(f){return f.floor===r})),this.getMaterial().pointBack==="HIDDEN"&&(s=s.filter(function(f){return!(f.object instanceof PBMPointCloud&&f.face&&f.face.normal.angleTo(e.ray.direction)<Math.PI/2)})),o&&s.sort(function(f,d){return f.distance-d.distance}),s},t.prototype.load=function(e,r){var o,s=this,u,l,c,f;if(r===void 0&&(r={}),this.work=e,this.name=this.work.workCode,!e.model)return Promise.resolve();for(var d=e.model,p=0,v=0,g=e.observers;v<g.length;v++){var h=g[v];p=Math.max(p,h.floorIndex)}this.floorLength=p+1;for(var m=!1,y=[],A=function(J){var X=J.tileset,W=J.upAxis,j=J.name,te=J.type;te==="mesh"&&(m=!0);var $=X.split("#"),ne=$[0],ie=$[1],oe=(u=(ie||ne).split("?")[1])!==null&&u!==void 0?u:"",Z=typeof r["3d-tiles"]=="function"?r["3d-tiles"](J):(l=r["3d-tiles"])!==null&&l!==void 0?l:{},de=getFetcher(e).ajax(X,{responseType:"text"}).then(function(he){var fe,Te=X?X.slice(0,X.lastIndexOf("/")+1):"",ce=normalizeTilesetHeader(JSON.parse(he.body),Te),ge=ce.root,ee=ce.rootMeta,re=ee===void 0?{}:ee;re.upAxis&&re.upAxis!==W&&(W=re.upAxis),"lodVersion"in ce&&(W="-Y","floorInfo"in ce&&(ce.properties=ce.properties||{},ce.properties.floorInfo=ce.floorInfo.map(function(ue){return{ground:-ue.ground,height:ue.height}}),delete ce.floorInfo),ce.asset.tilesetVersion=String(ce.lodVersion),delete ce.lodVersion);var z=ge.boundingVolume?makeBoundingVolume(ge.boundingVolume):void 0;z&&ge.transform&&z.applyMatrix4(scratchMatrix4.fromArray(ge.transform));var Re=null,ve=new THREE__namespace.Matrix4,me=new THREE__namespace.Matrix4;re.coordinate?(Re=re.coordinate.ground_height,ve.fromArray(re.coordinate.pose_ecef_to_enu),me.fromArray(re.coordinate.pose_enu_to_ecef)):(z?z.getCenter(scratchVector3):scratchVector3.setScalar(0),getEcefToEnuMatrixFromUpAxis(W,scratchVector3,ve),me.getInverse(ve));var we=new THREE__namespace.Matrix4().copy(ROTATE_X_90_MATRIX),ye=new THREE__namespace.Matrix4().copy(ROTATE_X_90_MATRIX_INVERSE),be=new THREE__namespace.Matrix4().premultiply(ve).premultiply(we),pe=new THREE__namespace.Matrix4().getInverse(be);ce.root={refine:(fe=ge.refine)!==null&&fe!==void 0?fe:"REPLACE",geometricError:ge.geometricError,transform:be.toArray(),boundingVolume:z?z.toJson():void 0,viewerRequestVolume:isBoundingVolume(Z.viewerRequestVolume)?Z.viewerRequestVolume.toJson():Z.viewerRequestVolume,children:[ge]};var ae=new Tile3DModel(s,ce,{name:j,type:te,upAxis:W,url:X,referer:X,search:oe,fetcher:getFetcher(e),groundHeight:Re,coordinateTransform:{localToEnuMatrix:ye,enuToLocalMatrix:we,enuToEcefMatrix:me,ecefToEnuMatrix:ve,localToEcefMatrix:pe,ecefToLocalMatrix:be}});return ae.matrix.copy(e.transform),ae.matrix.decompose(ae.position,ae.quaternion,ae.scale),ae.matrixWorldNeedsUpdate=!0,Object.assign(ae.maxMemoryUsage,ae.getRecommendProps()),typeof Z.debug!="undefined"&&(ae.debug=Z.debug),typeof Z.minLevelOfDetail!="undefined"&&(ae.minLevelOfDetail=Z.minLevelOfDetail),typeof Z.maxLevelOfDetail!="undefined"&&(ae.maxLevelOfDetail=Z.maxLevelOfDetail),typeof Z.skipLevelOfDetail!="undefined"&&(ae.skipLevelOfDetail=Z.skipLevelOfDetail),typeof Z.mostDetail!="undefined"&&(ae.mostDetail=Z.mostDetail),typeof Z.loadSiblings!="undefined"&&(ae.loadSiblings=Z.loadSiblings),typeof Z.loadAll!="undefined"&&(ae.loadAll=Z.loadAll),typeof Z.maxMemoryUsage!="undefined"&&(ae.maxMemoryUsage=Z.maxMemoryUsage),typeof Z.maxRequests!="undefined"&&(ae.maxRequests=Z.maxRequests),typeof Z.requestOrder!="undefined"&&(ae.requestOrder=Z.requestOrder),typeof Z.maxScreenSpaceError!="undefined"&&(ae.maxScreenSpaceError=Z.maxScreenSpaceError),(Z.showLayers===!1||Array.isArray(Z.showLayers)&&Z.showLayers.indexOf(j)===-1)&&(ae.visible=!1),new ModelViewLayer(ae,null)});y.push(de.catch(function(he){s.onError(he);var fe=new THREE__namespace.Matrix4,Te=new THREE__namespace.Matrix4,ce=new THREE__namespace.Matrix4().copy(ROTATE_X_90_MATRIX),ge=new THREE__namespace.Matrix4().copy(ROTATE_X_90_MATRIX_INVERSE),ee=new THREE__namespace.Matrix4().premultiply(fe).premultiply(ce),re=new THREE__namespace.Matrix4().getInverse(ee),z=X?X.slice(0,X.lastIndexOf("/")+1):"",Re=normalizeTilesetHeader({asset:{version:"0.0"},geometricError:0,viewerRequestVolume:isBoundingVolume(Z.viewerRequestVolume)?Z.viewerRequestVolume.toJson():Z.viewerRequestVolume,root:{geometricError:0}},z),ve=new Tile3DModel(s,Re,{name:j,type:te,upAxis:W,url:X,referer:X,search:oe,fetcher:getFetcher(e),groundHeight:null,coordinateTransform:{localToEnuMatrix:ge,enuToLocalMatrix:ce,enuToEcefMatrix:Te,ecefToEnuMatrix:fe,localToEcefMatrix:re,ecefToLocalMatrix:ee},onError:s.onError});return ve.matrix.copy(e.transform),ve.matrix.decompose(ve.position,ve.quaternion,ve.scale),ve.matrixWorldNeedsUpdate=!0,(Z.showLayers===!1||Array.isArray(Z.showLayers)&&Z.showLayers.indexOf(j)===-1)&&(ve.visible=!1),new ModelViewLayer(ve,he)}))},E=0,b=d.layers;E<b.length;E++){var T=b[E];A(T)}if(!m&&d.file){var _=d.file,R=d.textureBase,S=d.textures,M="fallback",B="mesh",H="Z",w="",T={name:M,type:B,upAxis:H,tileset:w},C=typeof r["3d-tiles"]=="function"?r["3d-tiles"](T):(c=r["3d-tiles"])!==null&&c!==void 0?c:{},L=getExt(_)||"at3d",I=new THREE__namespace.Matrix4,F=new THREE__namespace.Matrix4,k=new THREE__namespace.Matrix4().copy(ROTATE_X_90_MATRIX),N=new THREE__namespace.Matrix4().copy(ROTATE_X_90_MATRIX_INVERSE);getEcefToEnuMatrixFromUpAxis(H,scratchVector3.setScalar(0),I),F.getInverse(I);var D=new THREE__namespace.Matrix4().premultiply(I).premultiply(k),U=new THREE__namespace.Matrix4().getInverse(D),Q=normalizeTilesetHeader({asset:{gltfUpAxis:"Z",version:"0.0"},geometricError:0,root:{refine:"REPLACE",geometricError:0,transform:D.toArray(),viewerRequestVolume:isBoundingVolume(C.viewerRequestVolume)?C.viewerRequestVolume.toJson():C.viewerRequestVolume,content:{uri:_},extras:(o={},o[L]={textureBaseUri:R,textureArray:S,textureOptions:(f=r.textureOptions)!==null&&f!==void 0?f:{}},o)}},""),q=new Tile3DModel(this,Q,{name:M,type:B,upAxis:H,url:w,referer:_,fetcher:getFetcher(e),groundHeight:null,coordinateTransform:{localToEnuMatrix:N,enuToLocalMatrix:k,enuToEcefMatrix:F,ecefToEnuMatrix:I,localToEcefMatrix:U,ecefToLocalMatrix:D},onError:this.onError});q.matrix.copy(e.transform),q.matrix.decompose(q.position,q.quaternion,q.scale),q.matrixWorldNeedsUpdate=!0,(C.showLayers===!1||Array.isArray(C.showLayers)&&C.showLayers.indexOf(M)===-1)&&(q.visible=!1);var G=new ModelViewLayer(q,null);y.push(Promise.resolve(G))}return Promise.all(y).then(function(J){for(var X=0,W=J;X<W.length;X++){var j=W[X];if(s.disposed){j.scene.dispose();continue}s.viewLayers.push(j),s.add(j.scene)}})},t.prototype.update=function(e,r,o){if(this.children.length){var s=this.loaded;this.refined=this.work!==null,this.refineProgress[0]=0,this.refineProgress[1]=0,this.loaded=this.work!==null;for(var u=0,l=this.viewLayers;u<l.length;u++){var c=l[u],f=c.scene;f&&(this.work&&(f.cacheCameras=this.cacheCameras,this.autoRefine===!1?f.needsRefined=!1:isFristPersonMode(o)?f.needsRefined=this.materialParameters.modelAlpha===0||this.materialParameters.modelAlpha===1:f.needsRefined=!0,this.work.transform.equals(f.matrix)||(f.matrix.copy(this.work.transform),f.matrix.decompose(f.position,f.quaternion,f.scale),f.matrixWorldNeedsUpdate=!0)),f.update(e,r,o),f.needsRender===!0&&(f.needsRender=!1,this.needsRender=!0),f.refined===!1&&(this.refined=!1),this.refineProgress[0]+=f.refineProgress[0],this.refineProgress[1]+=f.refineProgress[1],f.loaded===!1&&(this.loaded=!1))}this.bounding.makeEmpty();for(var d=0,p=this.viewLayers;d<p.length;d++){var c=p[d],f=c.scene;f&&(f.boundingBox.isEmpty()||(scratchBoundingBox.copy(f.boundingBox).applyMatrix4(f.matrix),this.bounding.union(scratchBoundingBox)))}this.bounding.isEmpty()&&this.bounding.copy(DEFAULT_BOUNDING),s===!1&&this.loaded===!0&&this.onLoad()}else this.work&&!this.work.model?(this.refined=!0,this.refineProgress[0]=0,this.refineProgress[1]=0,this.loaded=!0):(this.refined=!1,this.refineProgress[0]=0,this.refineProgress[1]=0,this.loaded=!1),this.bounding.set(new THREE__namespace.Vector3,new THREE__namespace.Vector3)},t.prototype.dispose=function(){this.disposed=!0;for(var e;e=this.children[0];)e instanceof Tile3DModel&&e.dispose(),this.remove(e)},t}(THREE__namespace.Object3D);function createModels(){var n=new THREE__namespace.Box3,t=omit(defaultPbmParameters,["clippers","shownFloorIndex","brightness","customShaders"]),e=Object.assign([],{bounding:n,needsRender:!1,refined:!1,refineProgress:[0,0],loaded:!1,materialVersion:0,cacheCameras:[],autoUpdate:!0,intersectRaycaster:function(r,o,s){s===void 0&&(s=!0);var u;if(e.length===1)u=e[0].intersectRaycaster(r,o,s);else if(e.length===0)u=[];else{u=[];for(var l=0,c=e;l<c.length;l++){var f=c[l];if(f.visible){var d=f.intersectRaycaster(r,o,!1);d.length&&u.push.apply(u,d)}}s&&u.sort(function(p,v){return p.distance-v.distance})}return u},setMaterial:function(r){var o=updatePBMParameters(t,r);o&&(e.materialVersion++,e.needsRender=!0)},getMaterial:function(){return __assign({},t)},resetBrightness:function(){for(var r=0,o=e;r<o.length;r++){var s=o[r];s.setMaterial({brightness:1})}},update:function(r,o,s){e.refined=e.length>0,e.loaded=e.length>0,e.refineProgress[0]=0,e.refineProgress[1]=0,n.makeEmpty();for(var u=0,l=e.cacheCameras;u<l.length;u++){var c=l[u];c.updateMatrixWorld(!0),c.updateProjectionMatrix()}for(var f=0,d=0,p=e;d<p.length;d++){for(var v=p[d],g=0,h=v.viewLayers;g<h.length;g++){var m=h[g];m.scene.modelIndex=f++}v.setMaterial(t),v.cacheCameras=e.cacheCameras,v.autoRefine=this.autoUpdate,v.update(r,o,s),v.needsRender===!0&&(e.needsRender=!0,v.needsRender=!1),v.refined===!1&&(e.refined=!1),e.refineProgress[0]+=v.refineProgress[0],e.refineProgress[1]+=v.refineProgress[1],v.loaded===!1&&(e.loaded=!1),n.union(v.bounding)}for(var y=0,A=e;y<A.length;y++)for(var v=A[y],E=0,b=v.viewLayers;E<b.length;E++){var m=b[E];m.scene.modelsLoaded=e.loaded}n.isEmpty()&&n.copy(DEFAULT_BOUNDING)}});return e}var easeOut$2=function(n){return n*(2-n)},sharedGeometry2$2=function(){var n=new Float32Array([-.18,0,-.18,.18,0,-.18,-.18,0,.18,.18,0,.18]),t=new Float32Array([1,0,0,0,1,1,0,1]),e=new Uint8Array([0,2,1,2,3,1]),r=new THREE__namespace.BufferGeometry;return r.setAttribute("position",new THREE__namespace.BufferAttribute(n,3)),r.setAttribute("uv",new THREE__namespace.BufferAttribute(t,2)),r.setIndex(new THREE__namespace.BufferAttribute(e,1)),r}(),vertexShader$4=`
|
|
1040
|
+
`+JSON.stringify(n))}}function createWorks(n){for(var t={},e=[],r={},o=0,s=n;o<s.length;o++){var u=s[o],l=t[u.workCode];l||(l=t[u.workCode]=new THREE__namespace.Matrix4().copy(u.transform));for(var c=0,f=u.observers;c<f.length;c++){var d=f[c],p={isResolved:!0,active:d.active,accessibleIds:d.accessibleIds,visibleIds:d.visibleIds,accessibleNodes:d.accessibleNodes,visibleNodes:d.visibleNodes,floorIndex:d.floorIndex,images:d.images,index:d.index,panoIndex:d.panoIndex,loadable:d.loadable,panoId:d.panoId,pano:d.pano,work:d.work,derivedId:d.derivedId,video:d.video,position:new THREE__namespace.Vector3().copy(d.position).applyMatrix4(l),standingPosition:new THREE__namespace.Vector3().copy(d.standingPosition).applyMatrix4(l),quaternion:new THREE__namespace.Quaternion().setFromRotationMatrix(scratchMatrix4$1.makeRotationFromQuaternion(d.quaternion).premultiply(l))};Object.freeze(p),e.push(p),r[p.panoId]=p}}Object.freeze(e);for(var v=n.slice(),g={},h=0,m=v;h<m.length;h++){var u=m[h];g[u.workCode]=u}return Object.freeze(Object.assign(v,{get initial(){return v.length>0?v[0].initial:{work:{}}},get resolvedObservers(){return e},getWork:function(y){return g[y]},getResolvedObserver:function(y){var A,E;return isPanoId(y)?r[y]:typeof y=="number"?r[panoStringify({workCode:(E=(A=n[0])===null||A===void 0?void 0:A.workCode)!==null&&E!==void 0?E:"",panoIndex:y})]:r[panoStringify(y)]},update:function(){for(var y=0,A=v;y<A.length;y++){var E=A[y],b=E.transform,T=t[E.workCode];T?T.equals(b)||(T.copy(b),needsUpdateWorkCodeSet.add(E.workCode)):(t[E.workCode]=new THREE__namespace.Matrix4().copy(b),needsUpdateWorkCodeSet.add(E.workCode))}if(needsUpdateWorkCodeSet.size>0){for(var _=0,R=e;_<R.length;_++){var S=R[_];if(needsUpdateWorkCodeSet.has(S.work.workCode)){var M=S.work.observers[S.index],B=S.work.transform;S.position.copy(M.position).applyMatrix4(B),S.standingPosition.copy(M.standingPosition).applyMatrix4(B),S.quaternion.setFromRotationMatrix(scratchMatrix4$1.makeRotationFromQuaternion(M.quaternion).premultiply(B))}}needsUpdateWorkCodeSet.clear()}}}))}var fetcherMap=new Map;function getFetcher(n){var t=fetcherMap.get(n);if(t)return t;throw new Error("fetcher never registered.")}function registerFetcher(n,t){return fetcherMap.set(n,t)}var BufferGeometryUtils={computeTangents:function(n){var t=n.index,e=n.attributes;if(t===null||e.position===void 0||e.normal===void 0||e.uv===void 0){console.warn("THREE.BufferGeometry: Missing required attributes (index, position, normal or uv) in BufferGeometry.computeTangents()");return}var r=t.array,o=e.position.array,s=e.normal.array,u=e.uv.array,l=o.length/3;e.tangent===void 0&&n.setAttribute("tangent",new THREE__namespace.BufferAttribute(new Float32Array(4*l),4));for(var c=e.tangent.array,f=[],d=[],p=0;p<l;p++)f[p]=new THREE__namespace.Vector3,d[p]=new THREE__namespace.Vector3;var v=new THREE__namespace.Vector3,g=new THREE__namespace.Vector3,h=new THREE__namespace.Vector3,m=new THREE__namespace.Vector2,y=new THREE__namespace.Vector2,A=new THREE__namespace.Vector2,E=new THREE__namespace.Vector3,b=new THREE__namespace.Vector3;function T(z,G,q){v.fromArray(o,z*3),g.fromArray(o,G*3),h.fromArray(o,q*3),m.fromArray(u,z*2),y.fromArray(u,G*2),A.fromArray(u,q*2);var K=g.x-v.x,j=h.x-v.x,W=g.y-v.y,X=h.y-v.y,ee=g.z-v.z,$=h.z-v.z,re=y.x-m.x,ie=A.x-m.x,se=y.y-m.y,ae=A.y-m.y,fe=1/(re*ae-ie*se);E.set((ae*K-se*j)*fe,(ae*W-se*X)*fe,(ae*ee-se*$)*fe),b.set((re*j-ie*K)*fe,(re*X-ie*W)*fe,(re*$-ie*ee)*fe),f[z].add(E),f[G].add(E),f[q].add(E),d[z].add(b),d[G].add(b),d[q].add(b)}var _=n.groups;_.length===0&&(_=[{start:0,count:r.length}]);for(var p=0,R=_.length;p<R;++p)for(var S=_[p],M=S.start,B=S.count,H=M,w=M+B;H<w;H+=3)T(r[H+0],r[H+1],r[H+2]);var C=new THREE__namespace.Vector3,L=new THREE__namespace.Vector3,I=new THREE__namespace.Vector3,F=new THREE__namespace.Vector3,k,N,D;function U(z){I.fromArray(s,z*3),F.copy(I),N=f[z],C.copy(N),C.sub(I.multiplyScalar(I.dot(N))).normalize(),L.crossVectors(F,N),D=L.dot(d[z]),k=D<0?-1:1,c[z*4]=C.x,c[z*4+1]=C.y,c[z*4+2]=C.z,c[z*4+3]=k}for(var p=0,R=_.length;p<R;++p)for(var S=_[p],M=S.start,B=S.count,H=M,w=M+B;H<w;H+=3)U(r[H+0]),U(r[H+1]),U(r[H+2])},mergeBufferGeometries:function(n,t){for(var e=n[0].index!==null,r=new Set(Object.keys(n[0].attributes)),o=new Set(Object.keys(n[0].morphAttributes)),s={},u={},l=new THREE__namespace.BufferGeometry,c=0,f=0;f<n.length;++f){var d=n[f];if(e!==(d.index!==null))return null;for(var p in d.attributes){if(!r.has(p))return null;s[p]===void 0&&(s[p]=[]),s[p].push(d.attributes[p])}for(var p in d.morphAttributes){if(!o.has(p))return null;u[p]===void 0&&(u[p]=[]),u[p].push(d.morphAttributes[p])}if(l.userData.mergedUserData=l.userData.mergedUserData||[],l.userData.mergedUserData.push(d.userData),t){var v;if(e)v=d.index.count;else if(d.attributes.position!==void 0)v=d.attributes.position.count;else return null;l.addGroup(c,v,f),c+=v}}if(e){for(var g=0,h=[],f=0;f<n.length;++f){for(var m=n[f].index,y=0;y<m.count;++y)h.push(m.getX(y)+g);g+=n[f].attributes.position.count}l.setIndex(h)}for(var p in s){var A=this.mergeBufferAttributes(s[p]);if(!A)return null;l.setAttribute(p,A)}for(var p in u){var E=u[p][0].length;if(E===0)break;l.morphAttributes=l.morphAttributes||{},l.morphAttributes[p]=[];for(var f=0;f<E;++f){for(var b=[],y=0;y<u[p].length;++y)b.push(u[p][y][f]);var T=this.mergeBufferAttributes(b);if(!T)return null;l.morphAttributes[p].push(T)}}return l},mergeBufferAttributes:function(n){for(var t,e,r,o=0,s=0;s<n.length;++s){var u=n[s];if(u.isInterleavedBufferAttribute||(t===void 0&&(t=u.array.constructor),t!==u.array.constructor)||(e===void 0&&(e=u.itemSize),e!==u.itemSize)||(r===void 0&&(r=u.normalized),r!==u.normalized))return null;o+=u.array.length}for(var l=new t(o),c=0,s=0;s<n.length;++s)l.set(n[s].array,c),c+=n[s].array.length;return new THREE__namespace.BufferAttribute(l,e,r)},interleaveAttributes:function(n){for(var t,e=0,r=0,o=0,s=n.length;o<s;++o){var u=n[o];if(t===void 0&&(t=u.array.constructor),t!==u.array.constructor)return console.warn("AttributeBuffers of different types cannot be interleaved"),null;e+=u.array.length,r+=u.itemSize}for(var l=new THREE__namespace.InterleavedBuffer(new t(e),r),c=0,f=[],d=["getX","getY","getZ","getW"],p=["setX","setY","setZ","setW"],v=0,s=n.length;v<s;v++){var u=n[v],g=u.itemSize,h=u.count,m=new THREE__namespace.InterleavedBufferAttribute(l,g,c,u.normalized);f.push(m),c+=g;for(var y=0;y<h;y++)for(var A=0;A<g;A++)m[p[A]](y,u[d[A]](y))}return f},estimateBytesUsed:function(n){var t=0;for(var e in n.attributes){var r=n.getAttribute(e);t+=r.count*r.itemSize*r.array.BYTES_PER_ELEMENT}var o=n.getIndex();return t+=o?o.count*o.itemSize*o.array.BYTES_PER_ELEMENT:0,t},mergeVertices:function(n,t){t===void 0&&(t=1e-4),t=Math.max(t,Number.EPSILON);for(var e={},r=n.getIndex(),o=n.getAttribute("position"),s=r?r.count:o.count,u=0,l=Object.keys(n.attributes),c={},f={},d=[],p=["getX","getY","getZ","getW"],v=0,g=l.length;v<g;v++){var h=l[v];c[h]=[];var m=n.morphAttributes[h];m&&(f[h]=new Array(m.length).fill().map(function(){return[]}))}for(var y=Math.log10(1/t),A=Math.pow(10,y),v=0;v<s;v++){for(var E=r?r.getX(v):v,b="",T=0,g=l.length;T<g;T++)for(var h=l[T],_=n.getAttribute(h),R=_.itemSize,S=0;S<R;S++)b+="".concat(~~(_[p[S]](E)*A),",");if(b in e)d.push(e[b]);else{for(var T=0,g=l.length;T<g;T++)for(var h=l[T],_=n.getAttribute(h),m=n.morphAttributes[h],R=_.itemSize,M=c[h],B=f[h],S=0;S<R;S++){var H=p[S];if(M.push(_[H](E)),m)for(var w=0,C=m.length;w<C;w++)B[w].push(m[w][H](E))}e[b]=u,d.push(u),u++}}for(var L=n.clone(),v=0,g=l.length;v<g;v++){var h=l[v],I=n.getAttribute(h),F=new I.array.constructor(c[h]),_=new THREE__namespace.BufferAttribute(F,I.itemSize,I.normalized);if(L.setAttribute(h,_),h in f)for(var T=0;T<f[h].length;T++){var k=n.morphAttributes[h][T],F=new k.array.constructor(f[h][T]),N=new THREE__namespace.BufferAttribute(F,k.itemSize,k.normalized);L.morphAttributes[h][T]=N}}return L.setIndex(d),L}};function isThirdPersonMode(n){switch(n){case"Floorplan":return!0;case"Mapview":return!0;default:return!1}}function isFristPersonMode(n){switch(n){case"Panorama":return!0;case"VRPanorama":return!0;case"XRPanorama":return!0;case"Model":return!0;default:return!1}}var scratchVector3=new THREE__namespace.Vector3,scratchSphere=new THREE__namespace.Sphere,scratchMatrix4=new THREE__namespace.Matrix4,scratchMatrix4Inverse=new THREE__namespace.Matrix4,scratchBoundingBox=new THREE__namespace.Box3,ROTATE_X_90_MATRIX=new THREE__namespace.Matrix4().fromArray([1,0,0,0,0,0,-1,0,0,1,0,0,0,0,0,1]),ROTATE_X_90_MATRIX_INVERSE=new THREE__namespace.Matrix4().fromArray([1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1]),DEFAULT_BOUNDING=new THREE__namespace.Box3(new THREE__namespace.Vector3(-.5,-.5,-.5),new THREE__namespace.Vector3(.5,.5,.5));function getEcefToEnuMatrixFromUpAxis(n,t,e){switch(n){case"Z":break;case"Y":e.copy(ROTATE_X_90_MATRIX_INVERSE);break;case"-Y":e.copy(ROTATE_X_90_MATRIX);break;case"WGS84":case"GCJ02":case"BD09":getEcefToEnuMatrix(t,e);break;default:e.identity();break}return e}function getExt(n){var t=/([0-9a-z\.\_\-]+)([\?\#].*)?$/i.exec(n);if(t){var e=String(t[1]).trim().split(".").slice(1).reverse()[0];if(e)return e}return""}var ModelViewLayer=function(){function n(t,e){this.scene=t,this.error=e,t.viewLayer=this}return Object.defineProperty(n.prototype,"name",{get:function(){return this.scene.name},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"type",{get:function(){return this.scene.type},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"upAxis",{get:function(){return this.scene.upAxis},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"groundHeight",{get:function(){return this.scene.groundHeight},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"model",{get:function(){return this.scene.model},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"coordinates",{get:function(){scratchVector3.setScalar(0);var t=this.scene.localToLla(scratchVector3),e=t.x,r=t.y;return[e,r].map(function(o){return(o/Math.PI*180).toFixed(6)}).join(",")},enumerable:!1,configurable:!0}),n.prototype.getTransformMatrix4=function(t){return t===void 0&&(t=new THREE__namespace.Matrix4),t.copy(this.scene.coordinateTransform.ecefToLocalMatrix),this.scene&&t.premultiply(this.scene.matrixWorld),t},n.prototype.coordinatesToWorldPoint=function(t){var e=new THREE__namespace.Vector3(t.latitude,t.longitude,t.altitude);return this.scene.llaToWorld(e)},n.prototype.worldPointToCoordinates=function(t){return scratchVector3.copy(t),this.scene.worldToLla(scratchVector3),{latitude:scratchVector3.x,longitude:scratchVector3.y,altitude:scratchVector3.z}},n}(),Model=function(n){__extends(t,n);function t(e){e===void 0&&(e={});var r,o,s,u=n.call(this)||this;return u.name="",u.onError=(r=e.onError)!==null&&r!==void 0?r:noop$1,u.onShownFloorChange=(o=e.onShownFloorChange)!==null&&o!==void 0?o:noop$1,u.onLoad=(s=e.onLoad)!==null&&s!==void 0?s:noop$1,u.work=null,u.viewLayers=[],u.bounding=new THREE__namespace.Box3(new THREE__namespace.Vector3,new THREE__namespace.Vector3),u.floorLength=0,u.textureOptions={},u.refined=!1,u.refineProgress=[0,0],u.loaded=!1,u.matrixAutoUpdate=!1,u.needsRender=!0,u.autoRefine=!0,u.materialVersion=0,u.materialParameters=__assign({},defaultPbmParameters),u.cacheCameras=[],u.disposed=!1,u}return Object.defineProperty(t.prototype,"empty",{get:function(){return this.viewLayers.length===0},enumerable:!1,configurable:!0}),t.prototype.getMaterial=function(){return __assign({},this.materialParameters)},t.prototype.setMaterial=function(e){var r=this.materialParameters.shownFloorIndex,o=updatePBMParameters(this.materialParameters,e);if(o){var s=this.materialParameters.shownFloorIndex;r!==s&&this.onShownFloorChange(s),this.materialVersion++,this.needsRender=!0}},Object.defineProperty(t.prototype,"brightness",{get:function(){return this.materialParameters.brightness},set:function(e){this.setMaterial({brightness:typeof e=="number"?e:1})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"shownFloorIndex",{get:function(){return this.materialParameters.shownFloorIndex},set:function(e){this.setMaterial({shownFloorIndex:e})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"shownFloor",{get:function(){return this.shownFloorIndex===-1?null:this.shownFloorIndex},set:function(e){this.shownFloorIndex=e===null?-1:e},enumerable:!1,configurable:!0}),t.prototype.show=function(e){this.shownFloor=e!=null?e:null},Object.defineProperty(t.prototype,"clippers",{get:function(){return this.materialParameters.clippers},set:function(e){this.setMaterial({clippers:e})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"customShaders",{get:function(){return this.materialParameters.customShaders},set:function(e){this.setMaterial({customShaders:e})},enumerable:!1,configurable:!0}),t.prototype.getEdgesBySphere=function(e,r){r===void 0&&(r=30/180*Math.PI);for(var o=Math.cos(r),s=[],u=0,l=this.children;u<l.length;u++){var c=l[u];c instanceof Tile3DModel&&c.tileset.selectedTiles.forEach(function(f){var d,p,v;if(!(f.boundingVolume&&f.boundingVolume.distanceToPoint(e.center)>e.radius)){var g=(p=(d=f.content)===null||d===void 0?void 0:d.data)===null||p===void 0?void 0:p.object;if(g&&g.visible){var h=[];if(g.traverseVisible(function(q){if(q instanceof THREE__namespace.Mesh){var K=bvhMeshMap.get(q);if(K){scratchMatrix4.copy(q.matrixWorld),scratchMatrix4Inverse.getInverse(scratchMatrix4),scratchSphere.copy(e).applyMatrix4(scratchMatrix4Inverse);var j=K.trianglesInSphere(scratchSphere.center,scratchSphere.radius),W=new THREE__namespace.BufferGeometry;W.setAttribute("position",new THREE__namespace.BufferAttribute(j,3)),W.applyMatrix4(q.matrixWorld),W=BufferGeometryUtils.mergeVertices(W,.01),h.push(W)}}}),h.length===0)return;for(var m=["a","b","c"],y=BufferGeometryUtils.mergeBufferGeometries(h,!1),A=y.getAttribute("position").array,E=((v=y.getIndex())===null||v===void 0?void 0:v.array)||[],b=[],T=[],_=0,R=A.length;_<R;_+=3){var S=new THREE__namespace.Vector3(A[_],A[_+1],A[_+2]);b.push(S)}for(var _=0,R=E.length;_<R;_+=3){var M=E[_],B=E[_+1],H=E[_+2],w=new THREE__namespace.Vector3().crossVectors(b[B].clone().sub(b[M]),b[H].clone().sub(b[M])).normalize();T.push({a:M,b:B,c:H,normal:w})}for(var C={},_=0,R=T.length;_<R;_++)for(var L=T[_],I=0;I<3;I++){var F=L[m[I]],k=L[m[(I+1)%3]],N=[Math.min(F,k),Math.max(F,k)],D=N[0]+"-"+N[1];C[D]===void 0?C[D]={index1:N[0],index2:N[1],face1:_}:C[D].face2=_}for(var D in C){var U=C[D];if(U.face2===void 0||T[U.face1].normal.dot(T[U.face2].normal)<=o){var z=b[U.index1],G=b[U.index2];s.push(new THREE__namespace.Line3(z,G))}}b.length=0,T.length=0}}})}return s},t.prototype.intersectRaycaster=function(e,r,o){r===void 0&&(r=null),o===void 0&&(o=!0);for(var s=[],u=0,l=this.children.length;u<l;u++){var c=this.children[u];c.visible&&c instanceof Tile3DModel&&c.intersectRaycaster(e,!1,s)}return r!=null&&(s=s.filter(function(f){return f.floor===r})),this.getMaterial().pointBack==="HIDDEN"&&(s=s.filter(function(f){return!(f.object instanceof PBMPointCloud&&f.face&&f.face.normal.angleTo(e.ray.direction)<Math.PI/2)})),o&&s.sort(function(f,d){return f.distance-d.distance}),s},t.prototype.load=function(e,r){var o,s=this,u,l,c,f;if(r===void 0&&(r={}),this.work=e,this.name=this.work.workCode,!e.model)return Promise.resolve();for(var d=e.model,p=0,v=0,g=e.observers;v<g.length;v++){var h=g[v];p=Math.max(p,h.floorIndex)}this.floorLength=p+1;for(var m=!1,y=[],A=function(W){var X=W.tileset,ee=W.upAxis,$=W.name,re=W.type;re==="mesh"&&(m=!0);var ie=X.split("#"),se=ie[0],ae=ie[1],fe=(u=(ae||se).split("?")[1])!==null&&u!==void 0?u:"",ne=typeof r["3d-tiles"]=="function"?r["3d-tiles"](W):(l=r["3d-tiles"])!==null&&l!==void 0?l:{},pe=getFetcher(e).ajax(X,{responseType:"text"}).then(function(_e){var me,xe=X?X.slice(0,X.lastIndexOf("/")+1):"",Z=normalizeTilesetHeader(JSON.parse(_e.body),xe),te=Z.root,Q=Z.rootMeta,be=Q===void 0?{}:Q;be.upAxis&&be.upAxis!==ee&&(ee=be.upAxis),"lodVersion"in Z&&(ee="-Y","floorInfo"in Z&&(Z.properties=Z.properties||{},Z.properties.floorInfo=Z.floorInfo.map(function(qe){return{ground:-qe.ground,height:qe.height}}),delete Z.floorInfo),Z.asset.tilesetVersion=String(Z.lodVersion),delete Z.lodVersion);var ye=te.boundingVolume?makeBoundingVolume(te.boundingVolume):void 0;ye&&te.transform&&ye.applyMatrix4(scratchMatrix4.fromArray(te.transform));var Ae=null,Me=new THREE__namespace.Matrix4,ge=new THREE__namespace.Matrix4;be.coordinate?(Ae=be.coordinate.ground_height,Me.fromArray(be.coordinate.pose_ecef_to_enu),ge.fromArray(be.coordinate.pose_enu_to_ecef)):(ye?ye.getCenter(scratchVector3):scratchVector3.setScalar(0),getEcefToEnuMatrixFromUpAxis(ee,scratchVector3,Me),ge.getInverse(Me));var he=new THREE__namespace.Matrix4().copy(ROTATE_X_90_MATRIX),de=new THREE__namespace.Matrix4().copy(ROTATE_X_90_MATRIX_INVERSE),ce=new THREE__namespace.Matrix4().premultiply(Me).premultiply(he),le=new THREE__namespace.Matrix4().getInverse(ce),we;if(ne.viewerRequestVolume){var ue=isBoundingVolume(ne.viewerRequestVolume)?ne.viewerRequestVolume:makeBoundingVolume(ne.viewerRequestVolume);ue.applyMatrix4(le),we=ue.toJson()}Z.root={refine:(me=te.refine)!==null&&me!==void 0?me:"REPLACE",geometricError:te.geometricError,transform:ce.toArray(),boundingVolume:ye?ye.toJson():void 0,viewerRequestVolume:we,children:[te]};var ve=new Tile3DModel(s,Z,{name:$,type:re,upAxis:ee,url:X,referer:X,search:fe,fetcher:getFetcher(e),groundHeight:Ae,coordinateTransform:{localToEnuMatrix:de,enuToLocalMatrix:he,enuToEcefMatrix:ge,ecefToEnuMatrix:Me,localToEcefMatrix:le,ecefToLocalMatrix:ce}});return ve.matrix.copy(e.transform),ve.matrix.decompose(ve.position,ve.quaternion,ve.scale),ve.matrixWorldNeedsUpdate=!0,Object.assign(ve.maxMemoryUsage,ve.getRecommendProps()),typeof ne.debug!="undefined"&&(ve.debug=ne.debug),typeof ne.minLevelOfDetail!="undefined"&&(ve.minLevelOfDetail=ne.minLevelOfDetail),typeof ne.maxLevelOfDetail!="undefined"&&(ve.maxLevelOfDetail=ne.maxLevelOfDetail),typeof ne.skipLevelOfDetail!="undefined"&&(ve.skipLevelOfDetail=ne.skipLevelOfDetail),typeof ne.mostDetail!="undefined"&&(ve.mostDetail=ne.mostDetail),typeof ne.loadSiblings!="undefined"&&(ve.loadSiblings=ne.loadSiblings),typeof ne.loadAll!="undefined"&&(ve.loadAll=ne.loadAll),typeof ne.maxMemoryUsage!="undefined"&&(ve.maxMemoryUsage=ne.maxMemoryUsage),typeof ne.maxRequests!="undefined"&&(ve.maxRequests=ne.maxRequests),typeof ne.requestOrder!="undefined"&&(ve.requestOrder=ne.requestOrder),typeof ne.maxScreenSpaceError!="undefined"&&(ve.maxScreenSpaceError=ne.maxScreenSpaceError),(ne.showLayers===!1||Array.isArray(ne.showLayers)&&ne.showLayers.indexOf($)===-1)&&(ve.visible=!1),new ModelViewLayer(ve,null)});y.push(pe.catch(function(_e){s.onError(_e);var me=new THREE__namespace.Matrix4,xe=new THREE__namespace.Matrix4,Z=new THREE__namespace.Matrix4().copy(ROTATE_X_90_MATRIX),te=new THREE__namespace.Matrix4().copy(ROTATE_X_90_MATRIX_INVERSE),Q=new THREE__namespace.Matrix4().premultiply(me).premultiply(Z),be=new THREE__namespace.Matrix4().getInverse(Q),ye=X?X.slice(0,X.lastIndexOf("/")+1):"",Ae;if(ne.viewerRequestVolume){var Me=isBoundingVolume(ne.viewerRequestVolume)?ne.viewerRequestVolume:makeBoundingVolume(ne.viewerRequestVolume);Me.applyMatrix4(be),Ae=Me.toJson()}var ge=normalizeTilesetHeader({asset:{version:"0.0"},geometricError:0,viewerRequestVolume:Ae,root:{geometricError:0}},ye),he=new Tile3DModel(s,ge,{name:$,type:re,upAxis:ee,url:X,referer:X,search:fe,fetcher:getFetcher(e),groundHeight:null,coordinateTransform:{localToEnuMatrix:te,enuToLocalMatrix:Z,enuToEcefMatrix:xe,ecefToEnuMatrix:me,localToEcefMatrix:be,ecefToLocalMatrix:Q},onError:s.onError});return he.matrix.copy(e.transform),he.matrix.decompose(he.position,he.quaternion,he.scale),he.matrixWorldNeedsUpdate=!0,(ne.showLayers===!1||Array.isArray(ne.showLayers)&&ne.showLayers.indexOf($)===-1)&&(he.visible=!1),new ModelViewLayer(he,_e)}))},E=0,b=d.layers;E<b.length;E++){var T=b[E];A(T)}if(!m&&d.file){var _=d.file,R=d.textureBase,S=d.textures,M="fallback",B="mesh",H="Z",w="",T={name:M,type:B,upAxis:H,tileset:w},C=typeof r["3d-tiles"]=="function"?r["3d-tiles"](T):(c=r["3d-tiles"])!==null&&c!==void 0?c:{},L=getExt(_)||"at3d",I=new THREE__namespace.Matrix4,F=new THREE__namespace.Matrix4,k=new THREE__namespace.Matrix4().copy(ROTATE_X_90_MATRIX),N=new THREE__namespace.Matrix4().copy(ROTATE_X_90_MATRIX_INVERSE);getEcefToEnuMatrixFromUpAxis(H,scratchVector3.setScalar(0),I),F.getInverse(I);var D=new THREE__namespace.Matrix4().premultiply(I).premultiply(k),U=new THREE__namespace.Matrix4().getInverse(D),z=void 0;if(C.viewerRequestVolume){var G=isBoundingVolume(C.viewerRequestVolume)?C.viewerRequestVolume:makeBoundingVolume(C.viewerRequestVolume);G.applyMatrix4(U),z=G.toJson()}var q=normalizeTilesetHeader({asset:{gltfUpAxis:"Z",version:"0.0"},geometricError:0,root:{refine:"REPLACE",geometricError:0,transform:D.toArray(),viewerRequestVolume:z,content:{uri:_},extras:(o={},o[L]={textureBaseUri:R,textureArray:S,textureOptions:(f=r.textureOptions)!==null&&f!==void 0?f:{}},o)}},""),K=new Tile3DModel(this,q,{name:M,type:B,upAxis:H,url:w,referer:_,fetcher:getFetcher(e),groundHeight:null,coordinateTransform:{localToEnuMatrix:N,enuToLocalMatrix:k,enuToEcefMatrix:F,ecefToEnuMatrix:I,localToEcefMatrix:U,ecefToLocalMatrix:D},onError:this.onError});K.matrix.copy(e.transform),K.matrix.decompose(K.position,K.quaternion,K.scale),K.matrixWorldNeedsUpdate=!0,(C.showLayers===!1||Array.isArray(C.showLayers)&&C.showLayers.indexOf(M)===-1)&&(K.visible=!1);var j=new ModelViewLayer(K,null);y.push(Promise.resolve(j))}return Promise.all(y).then(function(W){for(var X=0,ee=W;X<ee.length;X++){var $=ee[X];if(s.disposed){$.scene.dispose();continue}s.viewLayers.push($),s.add($.scene)}})},t.prototype.update=function(e,r,o){if(this.children.length){var s=this.loaded;this.refined=this.work!==null,this.refineProgress[0]=0,this.refineProgress[1]=0,this.loaded=this.work!==null;for(var u=0,l=this.viewLayers;u<l.length;u++){var c=l[u],f=c.scene;f&&(this.work&&(f.cacheCameras=this.cacheCameras,this.autoRefine===!1?f.needsRefined=!1:isFristPersonMode(o)?f.needsRefined=this.materialParameters.modelAlpha===0||this.materialParameters.modelAlpha===1:f.needsRefined=!0,this.work.transform.equals(f.matrix)||(f.matrix.copy(this.work.transform),f.matrix.decompose(f.position,f.quaternion,f.scale),f.matrixWorldNeedsUpdate=!0)),f.update(e,r,o),f.needsRender===!0&&(f.needsRender=!1,this.needsRender=!0),f.refined===!1&&(this.refined=!1),this.refineProgress[0]+=f.refineProgress[0],this.refineProgress[1]+=f.refineProgress[1],f.loaded===!1&&(this.loaded=!1))}this.bounding.makeEmpty();for(var d=0,p=this.viewLayers;d<p.length;d++){var c=p[d],f=c.scene;f&&(f.boundingBox.isEmpty()||(scratchBoundingBox.copy(f.boundingBox).applyMatrix4(f.matrix),this.bounding.union(scratchBoundingBox)))}this.bounding.isEmpty()&&this.bounding.copy(DEFAULT_BOUNDING),s===!1&&this.loaded===!0&&this.onLoad()}else this.work&&!this.work.model?(this.refined=!0,this.refineProgress[0]=0,this.refineProgress[1]=0,this.loaded=!0):(this.refined=!1,this.refineProgress[0]=0,this.refineProgress[1]=0,this.loaded=!1),this.bounding.set(new THREE__namespace.Vector3,new THREE__namespace.Vector3)},t.prototype.dispose=function(){this.disposed=!0;for(var e;e=this.children[0];)e instanceof Tile3DModel&&e.dispose(),this.remove(e)},t}(THREE__namespace.Object3D);function createModels(){var n=new THREE__namespace.Box3,t=omit(defaultPbmParameters,["clippers","shownFloorIndex","brightness","customShaders"]),e=Object.assign([],{bounding:n,needsRender:!1,refined:!1,refineProgress:[0,0],loaded:!1,materialVersion:0,cacheCameras:[],autoUpdate:!0,intersectRaycaster:function(r,o,s){s===void 0&&(s=!0);var u;if(e.length===1)u=e[0].intersectRaycaster(r,o,s);else if(e.length===0)u=[];else{u=[];for(var l=0,c=e;l<c.length;l++){var f=c[l];if(f.visible){var d=f.intersectRaycaster(r,o,!1);d.length&&u.push.apply(u,d)}}s&&u.sort(function(p,v){return p.distance-v.distance})}return u},setMaterial:function(r){var o=updatePBMParameters(t,r);o&&(e.materialVersion++,e.needsRender=!0)},getMaterial:function(){return __assign({},t)},resetBrightness:function(){for(var r=0,o=e;r<o.length;r++){var s=o[r];s.setMaterial({brightness:1})}},update:function(r,o,s){e.refined=e.length>0,e.loaded=e.length>0,e.refineProgress[0]=0,e.refineProgress[1]=0,n.makeEmpty();for(var u=0,l=e.cacheCameras;u<l.length;u++){var c=l[u];c.updateMatrixWorld(!0),c.updateProjectionMatrix()}for(var f=0,d=0,p=e;d<p.length;d++){for(var v=p[d],g=0,h=v.viewLayers;g<h.length;g++){var m=h[g];m.scene.modelIndex=f++}v.setMaterial(t),v.cacheCameras=e.cacheCameras,v.autoRefine=this.autoUpdate,v.update(r,o,s),v.needsRender===!0&&(e.needsRender=!0,v.needsRender=!1),v.refined===!1&&(e.refined=!1),e.refineProgress[0]+=v.refineProgress[0],e.refineProgress[1]+=v.refineProgress[1],v.loaded===!1&&(e.loaded=!1),n.union(v.bounding)}for(var y=0,A=e;y<A.length;y++)for(var v=A[y],E=0,b=v.viewLayers;E<b.length;E++){var m=b[E];m.scene.modelsLoaded=e.loaded}n.isEmpty()&&n.copy(DEFAULT_BOUNDING)}});return e}var easeOut$2=function(n){return n*(2-n)},sharedGeometry2$2=function(){var n=new Float32Array([-.18,0,-.18,.18,0,-.18,-.18,0,.18,.18,0,.18]),t=new Float32Array([1,0,0,0,1,1,0,1]),e=new Uint8Array([0,2,1,2,3,1]),r=new THREE__namespace.BufferGeometry;return r.setAttribute("position",new THREE__namespace.BufferAttribute(n,3)),r.setAttribute("uv",new THREE__namespace.BufferAttribute(t,2)),r.setIndex(new THREE__namespace.BufferAttribute(e,1)),r}(),vertexShader$4=`
|
|
1041
1041
|
varying vec2 vUv;
|
|
1042
1042
|
#include <common>
|
|
1043
1043
|
#include <logdepthbuf_pars_vertex>
|
|
@@ -1431,9 +1431,9 @@ void main() {
|
|
|
1431
1431
|
* http://hammerjs.github.io/
|
|
1432
1432
|
*
|
|
1433
1433
|
* Copyright (c) 2016 Jorik Tangelder;
|
|
1434
|
-
* Licensed under the MIT license */var Hammer=function(n,t,e,r){var o=["","webkit","Moz","MS","ms","o"],s=t.createElement?t.createElement("div"):r,u="function",l=Math.round,c=Math.abs,f=Date.now;function d(P,O,V){return setTimeout(E(P,V),O)}function p(P,O,V){return Array.isArray(P)?(v(P,V[O],V),!0):!1}function v(P,O,V){var
|
|
1434
|
+
* Licensed under the MIT license */var Hammer=function(n,t,e,r){var o=["","webkit","Moz","MS","ms","o"],s=t.createElement?t.createElement("div"):r,u="function",l=Math.round,c=Math.abs,f=Date.now;function d(P,O,V){return setTimeout(E(P,V),O)}function p(P,O,V){return Array.isArray(P)?(v(P,V[O],V),!0):!1}function v(P,O,V){var J;if(P)if(P.forEach)P.forEach(O,V);else if(P.length!==r)for(J=0;J<P.length;)O.call(V,P[J],J,P),J++;else for(J in P)P.hasOwnProperty(J)&&O.call(V,P[J],J,P)}function g(P,O,V){var J="DEPRECATED METHOD: "+O+`
|
|
1435
1435
|
`+V+` AT
|
|
1436
|
-
`;return function(){var Y=new Error("get-stack-trace"),se=Y&&Y.stack?Y.stack.replace(/^[^\(]+?[\n$]/gm,"").replace(/^\s+at\s+/gm,"").replace(/^Object.<anonymous>\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",Ee=n.console&&(n.console.warn||n.console.log);return Ee&&Ee.call(n.console,K,se),P.apply(this,arguments)}}var h;typeof Object.assign!="function"?h=function(O){if(O===r||O===null)throw new TypeError("Cannot convert undefined or null to object");for(var V=Object(O),K=1;K<arguments.length;K++){var Y=arguments[K];if(Y!==r&&Y!==null)for(var se in Y)Y.hasOwnProperty(se)&&(V[se]=Y[se])}return V}:h=Object.assign;var m=g(function(O,V,K){for(var Y=Object.keys(V),se=0;se<Y.length;)(!K||K&&O[Y[se]]===r)&&(O[Y[se]]=V[Y[se]]),se++;return O},"extend","Use `assign`."),y=g(function(O,V){return m(O,V,!0)},"merge","Use `assign`.");function A(P,O,V){var K=O.prototype,Y;Y=P.prototype=Object.create(K),Y.constructor=P,Y._super=K,V&&h(Y,V)}function E(P,O){return function(){return P.apply(O,arguments)}}function b(P,O){return typeof P==u?P.apply(O&&O[0]||r,O):P}function T(P,O){return P===r?O:P}function _(P,O,V){v(B(O),function(K){P.addEventListener(K,V,!1)})}function R(P,O,V){v(B(O),function(K){P.removeEventListener(K,V,!1)})}function S(P,O){for(;P;){if(P==O)return!0;P=P.parentNode}return!1}function M(P,O){return P.indexOf(O)>-1}function B(P){return P.trim().split(/\s+/g)}function H(P,O,V){if(P.indexOf&&!V)return P.indexOf(O);for(var K=0;K<P.length;){if(V&&P[K][V]==O||!V&&P[K]===O)return K;K++}return-1}function w(P){return Array.prototype.slice.call(P,0)}function C(P,O,V){for(var K=[],Y=[],se=0;se<P.length;){var Ee=P[se][O];H(Y,Ee)<0&&K.push(P[se]),Y[se]=Ee,se++}return K=K.sort(function(We,Fe){return We[O]>Fe[O]}),K}function L(P,O){for(var V,K,Y=O[0].toUpperCase()+O.slice(1),se=0;se<o.length;){if(V=o[se],K=V?V+Y:O,K in P)return K;se++}return r}var I=1;function F(){return I++}function k(P){var O=P.ownerDocument||P;return O.defaultView||O.parentWindow||n}var N=/mobile|tablet|ip(ad|hone|od)|android/i,D="ontouchstart"in n,U=L(n,"PointerEvent")!==r,Q=D&&N.test(navigator.userAgent),q="touch",G="pen",J="mouse",X="kinect",W=25,j=1,te=2,$=4,ne=8,ie=1,oe=2,Z=4,de=8,he=16,fe=oe|Z,Te=de|he,ce=fe|Te,ge=["x","y"],ee=["clientX","clientY"];function re(P,O){var V=this;this.manager=P,this.callback=O,this.element=P.element,this.target=P.options.inputTarget,this.domHandler=function(K){b(P.options.enable,[P])&&V.handler(K)},this.init()}re.prototype={handler:function(){},init:function(){this.evEl&&_(this.element,this.evEl,this.domHandler),this.evTarget&&_(this.target,this.evTarget,this.domHandler),this.evWin&&_(k(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&R(this.element,this.evEl,this.domHandler),this.evTarget&&R(this.target,this.evTarget,this.domHandler),this.evWin&&R(k(this.element),this.evWin,this.domHandler)}};function z(P){var O,V=P.options.inputClass;return V?O=V:U?O=qe:Q?O=De:D?O=ze:O=Oe,new O(P,Re)}function Re(P,O,V){var K=V.pointers.length,Y=V.changedPointers.length,se=O&j&&K-Y===0,Ee=O&($|ne)&&K-Y===0;V.isFirst=!!se,V.isFinal=!!Ee,se&&(P.session={}),V.eventType=O,ve(P,V),P.emit("hammer.input",V),P.recognize(V),P.session.prevInput=V}function ve(P,O){var V=P.session,K=O.pointers,Y=K.length;V.firstInput||(V.firstInput=ye(O)),Y>1&&!V.firstMultiple?V.firstMultiple=ye(O):Y===1&&(V.firstMultiple=!1);var se=V.firstInput,Ee=V.firstMultiple,ke=Ee?Ee.center:se.center,We=O.center=be(K);O.timeStamp=f(),O.deltaTime=O.timeStamp-se.timeStamp,O.angle=Se(ke,We),O.distance=ue(ke,We),me(V,O),O.offsetDirection=ae(O.deltaX,O.deltaY);var Fe=pe(O.deltaTime,O.deltaX,O.deltaY);O.overallVelocityX=Fe.x,O.overallVelocityY=Fe.y,O.overallVelocity=c(Fe.x)>c(Fe.y)?Fe.x:Fe.y,O.scale=Ee?Ie(Ee.pointers,K):1,O.rotation=Ee?le(Ee.pointers,K):0,O.maxPointers=V.prevInput?O.pointers.length>V.prevInput.maxPointers?O.pointers.length:V.prevInput.maxPointers:O.pointers.length,we(V,O);var lt=P.element;S(O.srcEvent.target,lt)&&(lt=O.srcEvent.target),O.target=lt}function me(P,O){var V=O.center,K=P.offsetDelta||{},Y=P.prevDelta||{},se=P.prevInput||{};(O.eventType===j||se.eventType===$)&&(Y=P.prevDelta={x:se.deltaX||0,y:se.deltaY||0},K=P.offsetDelta={x:V.x,y:V.y}),O.deltaX=Y.x+(V.x-K.x),O.deltaY=Y.y+(V.y-K.y)}function we(P,O){var V=P.lastInterval||O,K=O.timeStamp-V.timeStamp,Y,se,Ee,ke;if(O.eventType!=ne&&(K>W||V.velocity===r)){var We=O.deltaX-V.deltaX,Fe=O.deltaY-V.deltaY,lt=pe(K,We,Fe);se=lt.x,Ee=lt.y,Y=c(lt.x)>c(lt.y)?lt.x:lt.y,ke=ae(We,Fe),P.lastInterval=O}else Y=V.velocity,se=V.velocityX,Ee=V.velocityY,ke=V.direction;O.velocity=Y,O.velocityX=se,O.velocityY=Ee,O.direction=ke}function ye(P){for(var O=[],V=0;V<P.pointers.length;)O[V]={clientX:l(P.pointers[V].clientX),clientY:l(P.pointers[V].clientY)},V++;return{timeStamp:f(),pointers:O,center:be(O),deltaX:P.deltaX,deltaY:P.deltaY}}function be(P){var O=P.length;if(O===1)return{x:l(P[0].clientX),y:l(P[0].clientY)};for(var V=0,K=0,Y=0;Y<O;)V+=P[Y].clientX,K+=P[Y].clientY,Y++;return{x:l(V/O),y:l(K/O)}}function pe(P,O,V){return{x:O/P||0,y:V/P||0}}function ae(P,O){return P===O?ie:c(P)>=c(O)?P<0?oe:Z:O<0?de:he}function ue(P,O,V){V||(V=ge);var K=O[V[0]]-P[V[0]],Y=O[V[1]]-P[V[1]];return Math.sqrt(K*K+Y*Y)}function Se(P,O,V){V||(V=ge);var K=O[V[0]]-P[V[0]],Y=O[V[1]]-P[V[1]];return Math.atan2(Y,K)*180/Math.PI}function le(P,O){return Se(O[1],O[0],ee)+Se(P[1],P[0],ee)}function Ie(P,O){return ue(O[0],O[1],ee)/ue(P[0],P[1],ee)}var Ye={mousedown:j,mousemove:te,mouseup:$},Ae="mousedown",Ce="mousemove mouseup";function Oe(){this.evEl=Ae,this.evWin=Ce,this.pressed=!1,re.apply(this,arguments)}A(Oe,re,{handler:function(O){var V=Ye[O.type];V&j&&(O.button===0||O.button===2)&&(this.pressed=!0),V&te&&O.which!==1&&(V=$),this.pressed&&(V&$&&(this.pressed=!1),this.callback(this.manager,V,{pointers:[O],changedPointers:[O],pointerType:J,srcEvent:O}))}});var $e={pointerdown:j,pointermove:te,pointerup:$,pointercancel:ne,pointerout:ne},pt={2:q,3:G,4:J,5:X},tt="pointerdown",Ne="pointermove pointerup pointercancel";n.MSPointerEvent&&!n.PointerEvent&&(tt="MSPointerDown",Ne="MSPointerMove MSPointerUp MSPointerCancel");function qe(){this.evEl=tt,this.evWin=Ne,re.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}A(qe,re,{handler:function(O){var V=this.store,K=!1,Y=!1,se=O.type.toLowerCase().replace("ms",""),Ee=$e[se],ke=pt[O.pointerType]||O.pointerType,We=ke==q,Fe=H(V,O.pointerId,"pointerId");Ee&j&&(O.button===0||O.button===2||We)?Fe<0&&(V.push(O),Fe=V.length-1):Ee&($|ne)?K=!0:!We&&O.buttons===0&&(K=!0,Y=!0,Ee=$e.pointerup),!(Fe<0)&&(Y||(V[Fe]=O),this.callback(this.manager,Ee,{pointers:V,changedPointers:[O],pointerType:ke,srcEvent:V[Fe]}),K&&V.splice(Fe,1))}});var Ve={touchstart:j,touchmove:te,touchend:$,touchcancel:ne},Ge="touchstart",Ke="touchstart touchmove touchend touchcancel";function Je(){this.evTarget=Ge,this.evWin=Ke,this.started=!1,re.apply(this,arguments)}A(Je,re,{handler:function(O){var V=Ve[O.type];if(V===j&&(this.started=!0),!!this.started){var K=Pe.call(this,O,V);V&($|ne)&&K[0].length-K[1].length===0&&(this.started=!1),this.callback(this.manager,V,{pointers:K[0],changedPointers:K[1],pointerType:q,srcEvent:O})}}});function Pe(P,O){var V=w(P.touches),K=w(P.changedTouches);return O&($|ne)&&(V=C(V.concat(K),"identifier")),[V,K]}var xe={touchstart:j,touchmove:te,touchend:$,touchcancel:ne},Be="touchstart touchmove touchend touchcancel";function De(){this.evTarget=Be,this.targetIds={},re.apply(this,arguments)}A(De,re,{handler:function(O){var V=xe[O.type],K=He.call(this,O,V);K&&this.callback(this.manager,V,{pointers:K[0],changedPointers:K[1],pointerType:q,srcEvent:O})}});function He(P,O){var V=w(P.touches),K=this.targetIds;if(O&(j|te)&&V.length===1)return K[V[0].identifier]=!0,[V,V];var Y,se,Ee=w(P.changedTouches),ke=[],We=this.target;if(se=V.filter(function(Fe){return S(Fe.target,We)}),O===j)for(Y=0;Y<se.length;)K[se[Y].identifier]=!0,Y++;for(Y=0;Y<Ee.length;)K[Ee[Y].identifier]&&ke.push(Ee[Y]),O&($|ne)&&delete K[Ee[Y].identifier],Y++;if(ke.length)return[C(se.concat(ke),"identifier"),ke]}var Ue=2500,Ze=25;function ze(){re.apply(this,arguments);var P=E(this.handler,this);this.touch=new De(this.manager,P),this.mouse=new Oe(this.manager,P),this.primaryTouch=null,this.lastTouches=[]}A(ze,re,{handler:function(O,V,K){var Y=K.pointerType==q,se=K.pointerType==J;if(!(se&&K.sourceCapabilities&&K.sourceCapabilities.firesTouchEvents)){if(Y)rt.call(this,V,K);else if(se&&ht.call(this,K))return;this.callback(O,V,K)}},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});function rt(P,O){P&j?(this.primaryTouch=O.changedPointers[0].identifier,ot.call(this,O)):P&($|ne)&&ot.call(this,O)}function ot(P){var O=P.changedPointers[0];if(O.identifier===this.primaryTouch){var V={x:O.clientX,y:O.clientY};this.lastTouches.push(V);var K=this.lastTouches,Y=function(){var se=K.indexOf(V);se>-1&&K.splice(se,1)};setTimeout(Y,Ue)}}function ht(P){for(var O=P.srcEvent.clientX,V=P.srcEvent.clientY,K=0;K<this.lastTouches.length;K++){var Y=this.lastTouches[K],se=Math.abs(O-Y.x),Ee=Math.abs(V-Y.y);if(se<=Ze&&Ee<=Ze)return!0}return!1}var st=s?L(s.style,"touchAction"):r,ct=st!==r,je="compute",Me="auto",_e="manipulation",Le="none",Qe="pan-x",Xe="pan-y",at=Lt();function vt(P,O){this.manager=P,this.set(O)}vt.prototype={set:function(P){P==je&&(P=this.compute()),ct&&this.manager.element.style&&at[P]&&(this.manager.element.style[st]=P),this.actions=P.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var P=[];return v(this.manager.recognizers,function(O){b(O.options.enable,[O])&&(P=P.concat(O.getTouchAction()))}),At(P.join(" "))},preventDefaults:function(P){var O=P.srcEvent,V=P.offsetDirection;if(this.manager.session.prevented){O.preventDefault();return}var K=this.actions,Y=M(K,Le)&&!at[Le],se=M(K,Xe)&&!at[Xe],Ee=M(K,Qe)&&!at[Qe];if(Y){var ke=P.pointers.length===1,We=P.distance<2,Fe=P.deltaTime<250;if(ke&&We&&Fe)return}if(!(Ee&&se)&&(Y||se&&V&fe||Ee&&V&Te))return this.preventSrc(O)},preventSrc:function(P){this.manager.session.prevented=!0,P.preventDefault()}};function At(P){if(M(P,Le))return Le;var O=M(P,Qe),V=M(P,Xe);return O&&V?Le:O||V?O?Qe:Xe:M(P,_e)?_e:Me}function Lt(){if(!ct)return!1;var P={},O=n.CSS&&n.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach(function(V){P[V]=O?n.CSS.supports("touch-action",V):!0}),P}var bt=1,nt=2,gt=4,mt=8,ft=mt,Et=16,ut=32;function dt(P){this.options=h({},this.defaults,P||{}),this.id=F(),this.manager=null,this.options.enable=T(this.options.enable,!0),this.state=bt,this.simultaneous={},this.requireFail=[]}dt.prototype={defaults:{},set:function(P){return h(this.options,P),this.manager&&this.manager.touchAction.update(),this},recognizeWith:function(P){if(p(P,"recognizeWith",this))return this;var O=this.simultaneous;return P=Tt(P,this),O[P.id]||(O[P.id]=P,P.recognizeWith(this)),this},dropRecognizeWith:function(P){return p(P,"dropRecognizeWith",this)?this:(P=Tt(P,this),delete this.simultaneous[P.id],this)},requireFailure:function(P){if(p(P,"requireFailure",this))return this;var O=this.requireFail;return P=Tt(P,this),H(O,P)===-1&&(O.push(P),P.requireFailure(this)),this},dropRequireFailure:function(P){if(p(P,"dropRequireFailure",this))return this;P=Tt(P,this);var O=H(this.requireFail,P);return O>-1&&this.requireFail.splice(O,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(P){return!!this.simultaneous[P.id]},emit:function(P){var O=this,V=this.state;function K(Y){O.manager.emit(Y,P)}V<mt&&K(O.options.event+It(V)),K(O.options.event),P.additionalEvent&&K(P.additionalEvent),V>=mt&&K(O.options.event+It(V))},tryEmit:function(P){if(this.canEmit())return this.emit(P);this.state=ut},canEmit:function(){for(var P=0;P<this.requireFail.length;){if(!(this.requireFail[P].state&(ut|bt)))return!1;P++}return!0},recognize:function(P){var O=h({},P);if(!b(this.options.enable,[this,O])){this.reset(),this.state=ut;return}this.state&(ft|Et|ut)&&(this.state=bt),this.state=this.process(O),this.state&(nt|gt|mt|Et)&&this.tryEmit(O)},process:function(P){},getTouchAction:function(){},reset:function(){}};function It(P){return P&Et?"cancel":P&mt?"end":P>?"move":P&nt?"start":""}function Pt(P){return P==he?"down":P==de?"up":P==oe?"left":P==Z?"right":""}function Tt(P,O){var V=O.manager;return V?V.get(P):P}function it(){dt.apply(this,arguments)}A(it,dt,{defaults:{pointers:1},attrTest:function(P){var O=this.options.pointers;return O===0||P.pointers.length===O},process:function(P){var O=this.state,V=P.eventType,K=O&(nt|gt),Y=this.attrTest(P);return K&&(V&ne||!Y)?O|Et:K||Y?V&$?O|mt:O&nt?O|gt:nt:ut}});function _t(){it.apply(this,arguments),this.pX=null,this.pY=null}A(_t,it,{defaults:{event:"pan",threshold:10,pointers:1,direction:ce},getTouchAction:function(){var P=this.options.direction,O=[];return P&fe&&O.push(Xe),P&Te&&O.push(Qe),O},directionTest:function(P){var O=this.options,V=!0,K=P.distance,Y=P.direction,se=P.deltaX,Ee=P.deltaY;return Y&O.direction||(O.direction&fe?(Y=se===0?ie:se<0?oe:Z,V=se!=this.pX,K=Math.abs(P.deltaX)):(Y=Ee===0?ie:Ee<0?de:he,V=Ee!=this.pY,K=Math.abs(P.deltaY))),P.direction=Y,V&&K>O.threshold&&Y&O.direction},attrTest:function(P){return it.prototype.attrTest.call(this,P)&&(this.state&nt||!(this.state&nt)&&this.directionTest(P))},emit:function(P){this.pX=P.deltaX,this.pY=P.deltaY;var O=Pt(P.direction);O&&(P.additionalEvent=this.options.event+O),this._super.emit.call(this,P)}});function xt(){it.apply(this,arguments)}A(xt,it,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[Le]},attrTest:function(P){return this._super.attrTest.call(this,P)&&(Math.abs(P.scale-1)>this.options.threshold||this.state&nt)},emit:function(P){if(P.scale!==1){var O=P.scale<1?"in":"out";P.additionalEvent=this.options.event+O}this._super.emit.call(this,P)}});function St(){dt.apply(this,arguments),this._timer=null,this._input=null}A(St,dt,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[Me]},process:function(P){var O=this.options,V=P.pointers.length===O.pointers,K=P.distance<O.threshold,Y=P.deltaTime>O.time;if(this._input=P,!K||!V||P.eventType&($|ne)&&!Y)this.reset();else if(P.eventType&j)this.reset(),this._timer=d(function(){this.state=ft,this.tryEmit()},O.time,this);else if(P.eventType&$)return ft;return ut},reset:function(){clearTimeout(this._timer)},emit:function(P){this.state===ft&&(P&&P.eventType&$?this.manager.emit(this.options.event+"up",P):(this._input.timeStamp=f(),this.manager.emit(this.options.event,this._input)))}});function wt(){it.apply(this,arguments)}A(wt,it,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[Le]},attrTest:function(P){return this._super.attrTest.call(this,P)&&(Math.abs(P.rotation)>this.options.threshold||this.state&nt)}});function Mt(){it.apply(this,arguments)}A(Mt,it,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:fe|Te,pointers:1},getTouchAction:function(){return _t.prototype.getTouchAction.call(this)},attrTest:function(P){var O=this.options.direction,V;return O&(fe|Te)?V=P.overallVelocity:O&fe?V=P.overallVelocityX:O&Te&&(V=P.overallVelocityY),this._super.attrTest.call(this,P)&&O&P.offsetDirection&&P.distance>this.options.threshold&&P.maxPointers==this.options.pointers&&c(V)>this.options.velocity&&P.eventType&$},emit:function(P){var O=Pt(P.offsetDirection);O&&this.manager.emit(this.options.event+O,P),this.manager.emit(this.options.event,P)}});function Rt(){dt.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}A(Rt,dt,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[_e]},process:function(P){var O=this.options,V=P.pointers.length===O.pointers,K=P.distance<O.threshold,Y=P.deltaTime<O.time;if(this.reset(),P.eventType&j&&this.count===0)return this.failTimeout();if(K&&Y&&V){if(P.eventType!=$)return this.failTimeout();var se=this.pTime?P.timeStamp-this.pTime<O.interval:!0,Ee=!this.pCenter||ue(this.pCenter,P.center)<O.posThreshold;this.pTime=P.timeStamp,this.pCenter=P.center,!Ee||!se?this.count=1:this.count+=1,this._input=P;var ke=this.count%O.taps;if(ke===0)return this.hasRequireFailures()?(this._timer=d(function(){this.state=ft,this.tryEmit()},O.interval,this),nt):ft}return ut},failTimeout:function(){return this._timer=d(function(){this.state=ut},this.options.interval,this),ut},reset:function(){clearTimeout(this._timer)},emit:function(){this.state==ft&&(this._input.tapCount=this.count,this.manager.emit(this.options.event,this._input))}});function yt(P,O){return O=O||{},O.recognizers=T(O.recognizers,yt.defaults.preset),new Ct(P,O)}yt.VERSION="2.0.7",yt.defaults={domEvents:!1,touchAction:je,enable:!0,inputTarget:null,inputClass:null,preset:[[wt,{enable:!1}],[xt,{enable:!1},["rotate"]],[Mt,{direction:fe}],[_t,{direction:fe},["swipe"]],[Rt],[Rt,{event:"doubletap",taps:2},["tap"]],[St]],cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}};var Ft=1,Bt=2;function Ct(P,O){this.options=h({},yt.defaults,O||{}),this.options.inputTarget=this.options.inputTarget||P,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=P,this.input=z(this),this.touchAction=new vt(this,this.options.touchAction),Ht(this,!0),v(this.options.recognizers,function(V){var K=this.add(new V[0](V[1]));V[2]&&K.recognizeWith(V[2]),V[3]&&K.requireFailure(V[3])},this)}Ct.prototype={set:function(P){return h(this.options,P),P.touchAction&&this.touchAction.update(),P.inputTarget&&(this.input.destroy(),this.input.target=P.inputTarget,this.input.init()),this},stop:function(P){this.session.stopped=P?Bt:Ft},recognize:function(P){var O=this.session;if(!O.stopped){this.touchAction.preventDefaults(P);var V,K=this.recognizers,Y=O.curRecognizer;(!Y||Y&&Y.state&ft)&&(Y=O.curRecognizer=null);for(var se=0;se<K.length;)V=K[se],O.stopped!==Bt&&(!Y||V==Y||V.canRecognizeWith(Y))?V.recognize(P):V.reset(),!Y&&V.state&(nt|gt|mt)&&(Y=O.curRecognizer=V),se++}},get:function(P){if(P instanceof dt)return P;for(var O=this.recognizers,V=0;V<O.length;V++)if(O[V].options.event==P)return O[V];return null},add:function(P){if(p(P,"add",this))return this;var O=this.get(P.options.event);return O&&this.remove(O),this.recognizers.push(P),P.manager=this,this.touchAction.update(),P},remove:function(P){if(p(P,"remove",this))return this;if(P=this.get(P),P){var O=this.recognizers,V=H(O,P);V!==-1&&(O.splice(V,1),this.touchAction.update())}return this},on:function(P,O){if(P!==r&&O!==r){var V=this.handlers;return v(B(P),function(K){V[K]=V[K]||[],V[K].push(O)}),this}},off:function(P,O){if(P!==r){var V=this.handlers;return v(B(P),function(K){O?V[K]&&V[K].splice(H(V[K],O),1):delete V[K]}),this}},emit:function(P,O){this.options.domEvents&&Ot(P,O);var V=this.handlers[P]&&this.handlers[P].slice();if(!(!V||!V.length)){O.type=P,O.preventDefault=function(){O.srcEvent.preventDefault()};for(var K=0;K<V.length;)V[K](O),K++}},destroy:function(){this.element&&Ht(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}};function Ht(P,O){var V=P.element;if(V.style){var K;v(P.options.cssProps,function(Y,se){K=L(V.style,se),O?(P.oldCssProps[K]=V.style[K],V.style[K]=Y):V.style[K]=P.oldCssProps[K]||""}),O||(P.oldCssProps={})}}function Ot(P,O){var V=t.createEvent("Event");V.initEvent(P,!0,!0),V.gesture=O,O.target.dispatchEvent(V)}return h(yt,{INPUT_START:j,INPUT_MOVE:te,INPUT_END:$,INPUT_CANCEL:ne,STATE_POSSIBLE:bt,STATE_BEGAN:nt,STATE_CHANGED:gt,STATE_ENDED:mt,STATE_RECOGNIZED:ft,STATE_CANCELLED:Et,STATE_FAILED:ut,DIRECTION_NONE:ie,DIRECTION_LEFT:oe,DIRECTION_RIGHT:Z,DIRECTION_UP:de,DIRECTION_DOWN:he,DIRECTION_HORIZONTAL:fe,DIRECTION_VERTICAL:Te,DIRECTION_ALL:ce,Manager:Ct,Input:re,TouchAction:vt,TouchInput:De,MouseInput:Oe,PointerEventInput:qe,TouchMouseInput:ze,SingleTouchInput:Je,Recognizer:dt,AttrRecognizer:it,Tap:Rt,Pan:_t,Swipe:Mt,Pinch:xt,Rotate:wt,Press:St,on:_,off:R,each:v,merge:y,extend:m,assign:h,inherit:A,bindFn:E,prefixed:L}),yt}(typeof window!="undefined"?window:{},typeof document!="undefined"?document:{});function calculateThreeMouse(n,t,e){var r=t.getBoundingClientRect(),o=r.top,s=r.left,u=r.width,l=r.height;return e&&(s=s+u*e.left,o=o+l*(1-e.bottom-e.height),u=u*e.width,l=l*e.height),new THREE__namespace.Vector2((n.x-s)/u*2-1,-(n.y-o)/l*2+1)}var camera$2=new THREE__namespace.OrthographicCamera(-1,1,1,-1,0,1),geometry$5=new THREE__namespace.BufferGeometry;geometry$5.setAttribute("position",new THREE__namespace.Float32BufferAttribute([-1,3,0,-1,-1,0,3,-1,0],3)),geometry$5.setAttribute("uv",new THREE__namespace.Float32BufferAttribute([0,2,0,0,2,0],2));var mesh$4=new THREE__namespace.Mesh(geometry$5),scene$2=new THREE__namespace.Scene;scene$2.add(mesh$4);var DEFAULT_VERTEX_SHADER=`
|
|
1436
|
+
`;return function(){var Y=new Error("get-stack-trace"),oe=Y&&Y.stack?Y.stack.replace(/^[^\(]+?[\n$]/gm,"").replace(/^\s+at\s+/gm,"").replace(/^Object.<anonymous>\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",Te=n.console&&(n.console.warn||n.console.log);return Te&&Te.call(n.console,J,oe),P.apply(this,arguments)}}var h;typeof Object.assign!="function"?h=function(O){if(O===r||O===null)throw new TypeError("Cannot convert undefined or null to object");for(var V=Object(O),J=1;J<arguments.length;J++){var Y=arguments[J];if(Y!==r&&Y!==null)for(var oe in Y)Y.hasOwnProperty(oe)&&(V[oe]=Y[oe])}return V}:h=Object.assign;var m=g(function(O,V,J){for(var Y=Object.keys(V),oe=0;oe<Y.length;)(!J||J&&O[Y[oe]]===r)&&(O[Y[oe]]=V[Y[oe]]),oe++;return O},"extend","Use `assign`."),y=g(function(O,V){return m(O,V,!0)},"merge","Use `assign`.");function A(P,O,V){var J=O.prototype,Y;Y=P.prototype=Object.create(J),Y.constructor=P,Y._super=J,V&&h(Y,V)}function E(P,O){return function(){return P.apply(O,arguments)}}function b(P,O){return typeof P==u?P.apply(O&&O[0]||r,O):P}function T(P,O){return P===r?O:P}function _(P,O,V){v(B(O),function(J){P.addEventListener(J,V,!1)})}function R(P,O,V){v(B(O),function(J){P.removeEventListener(J,V,!1)})}function S(P,O){for(;P;){if(P==O)return!0;P=P.parentNode}return!1}function M(P,O){return P.indexOf(O)>-1}function B(P){return P.trim().split(/\s+/g)}function H(P,O,V){if(P.indexOf&&!V)return P.indexOf(O);for(var J=0;J<P.length;){if(V&&P[J][V]==O||!V&&P[J]===O)return J;J++}return-1}function w(P){return Array.prototype.slice.call(P,0)}function C(P,O,V){for(var J=[],Y=[],oe=0;oe<P.length;){var Te=P[oe][O];H(Y,Te)<0&&J.push(P[oe]),Y[oe]=Te,oe++}return J=J.sort(function(Ze,Fe){return Ze[O]>Fe[O]}),J}function L(P,O){for(var V,J,Y=O[0].toUpperCase()+O.slice(1),oe=0;oe<o.length;){if(V=o[oe],J=V?V+Y:O,J in P)return J;oe++}return r}var I=1;function F(){return I++}function k(P){var O=P.ownerDocument||P;return O.defaultView||O.parentWindow||n}var N=/mobile|tablet|ip(ad|hone|od)|android/i,D="ontouchstart"in n,U=L(n,"PointerEvent")!==r,z=D&&N.test(navigator.userAgent),G="touch",q="pen",K="mouse",j="kinect",W=25,X=1,ee=2,$=4,re=8,ie=1,se=2,ae=4,fe=8,ne=16,pe=se|ae,_e=fe|ne,me=pe|_e,xe=["x","y"],Z=["clientX","clientY"];function te(P,O){var V=this;this.manager=P,this.callback=O,this.element=P.element,this.target=P.options.inputTarget,this.domHandler=function(J){b(P.options.enable,[P])&&V.handler(J)},this.init()}te.prototype={handler:function(){},init:function(){this.evEl&&_(this.element,this.evEl,this.domHandler),this.evTarget&&_(this.target,this.evTarget,this.domHandler),this.evWin&&_(k(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&R(this.element,this.evEl,this.domHandler),this.evTarget&&R(this.target,this.evTarget,this.domHandler),this.evWin&&R(k(this.element),this.evWin,this.domHandler)}};function Q(P){var O,V=P.options.inputClass;return V?O=V:U?O=Ge:z?O=De:D?O=ze:O=Oe,new O(P,be)}function be(P,O,V){var J=V.pointers.length,Y=V.changedPointers.length,oe=O&X&&J-Y===0,Te=O&($|re)&&J-Y===0;V.isFirst=!!oe,V.isFinal=!!Te,oe&&(P.session={}),V.eventType=O,ye(P,V),P.emit("hammer.input",V),P.recognize(V),P.session.prevInput=V}function ye(P,O){var V=P.session,J=O.pointers,Y=J.length;V.firstInput||(V.firstInput=ge(O)),Y>1&&!V.firstMultiple?V.firstMultiple=ge(O):Y===1&&(V.firstMultiple=!1);var oe=V.firstInput,Te=V.firstMultiple,ke=Te?Te.center:oe.center,Ze=O.center=he(J);O.timeStamp=f(),O.deltaTime=O.timeStamp-oe.timeStamp,O.angle=we(ke,Ze),O.distance=le(ke,Ze),Ae(V,O),O.offsetDirection=ce(O.deltaX,O.deltaY);var Fe=de(O.deltaTime,O.deltaX,O.deltaY);O.overallVelocityX=Fe.x,O.overallVelocityY=Fe.y,O.overallVelocity=c(Fe.x)>c(Fe.y)?Fe.x:Fe.y,O.scale=Te?ve(Te.pointers,J):1,O.rotation=Te?ue(Te.pointers,J):0,O.maxPointers=V.prevInput?O.pointers.length>V.prevInput.maxPointers?O.pointers.length:V.prevInput.maxPointers:O.pointers.length,Me(V,O);var lt=P.element;S(O.srcEvent.target,lt)&&(lt=O.srcEvent.target),O.target=lt}function Ae(P,O){var V=O.center,J=P.offsetDelta||{},Y=P.prevDelta||{},oe=P.prevInput||{};(O.eventType===X||oe.eventType===$)&&(Y=P.prevDelta={x:oe.deltaX||0,y:oe.deltaY||0},J=P.offsetDelta={x:V.x,y:V.y}),O.deltaX=Y.x+(V.x-J.x),O.deltaY=Y.y+(V.y-J.y)}function Me(P,O){var V=P.lastInterval||O,J=O.timeStamp-V.timeStamp,Y,oe,Te,ke;if(O.eventType!=re&&(J>W||V.velocity===r)){var Ze=O.deltaX-V.deltaX,Fe=O.deltaY-V.deltaY,lt=de(J,Ze,Fe);oe=lt.x,Te=lt.y,Y=c(lt.x)>c(lt.y)?lt.x:lt.y,ke=ce(Ze,Fe),P.lastInterval=O}else Y=V.velocity,oe=V.velocityX,Te=V.velocityY,ke=V.direction;O.velocity=Y,O.velocityX=oe,O.velocityY=Te,O.direction=ke}function ge(P){for(var O=[],V=0;V<P.pointers.length;)O[V]={clientX:l(P.pointers[V].clientX),clientY:l(P.pointers[V].clientY)},V++;return{timeStamp:f(),pointers:O,center:he(O),deltaX:P.deltaX,deltaY:P.deltaY}}function he(P){var O=P.length;if(O===1)return{x:l(P[0].clientX),y:l(P[0].clientY)};for(var V=0,J=0,Y=0;Y<O;)V+=P[Y].clientX,J+=P[Y].clientY,Y++;return{x:l(V/O),y:l(J/O)}}function de(P,O,V){return{x:O/P||0,y:V/P||0}}function ce(P,O){return P===O?ie:c(P)>=c(O)?P<0?se:ae:O<0?fe:ne}function le(P,O,V){V||(V=xe);var J=O[V[0]]-P[V[0]],Y=O[V[1]]-P[V[1]];return Math.sqrt(J*J+Y*Y)}function we(P,O,V){V||(V=xe);var J=O[V[0]]-P[V[0]],Y=O[V[1]]-P[V[1]];return Math.atan2(Y,J)*180/Math.PI}function ue(P,O){return we(O[1],O[0],Z)+we(P[1],P[0],Z)}function ve(P,O){return le(O[0],O[1],Z)/le(P[0],P[1],Z)}var qe={mousedown:X,mousemove:ee,mouseup:$},Ee="mousedown",Ie="mousemove mouseup";function Oe(){this.evEl=Ee,this.evWin=Ie,this.pressed=!1,te.apply(this,arguments)}A(Oe,te,{handler:function(O){var V=qe[O.type];V&X&&(O.button===0||O.button===2)&&(this.pressed=!0),V&ee&&O.which!==1&&(V=$),this.pressed&&(V&$&&(this.pressed=!1),this.callback(this.manager,V,{pointers:[O],changedPointers:[O],pointerType:K,srcEvent:O}))}});var $e={pointerdown:X,pointermove:ee,pointerup:$,pointercancel:re,pointerout:re},pt={2:G,3:q,4:K,5:j},tt="pointerdown",Ne="pointermove pointerup pointercancel";n.MSPointerEvent&&!n.PointerEvent&&(tt="MSPointerDown",Ne="MSPointerMove MSPointerUp MSPointerCancel");function Ge(){this.evEl=tt,this.evWin=Ne,te.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}A(Ge,te,{handler:function(O){var V=this.store,J=!1,Y=!1,oe=O.type.toLowerCase().replace("ms",""),Te=$e[oe],ke=pt[O.pointerType]||O.pointerType,Ze=ke==G,Fe=H(V,O.pointerId,"pointerId");Te&X&&(O.button===0||O.button===2||Ze)?Fe<0&&(V.push(O),Fe=V.length-1):Te&($|re)?J=!0:!Ze&&O.buttons===0&&(J=!0,Y=!0,Te=$e.pointerup),!(Fe<0)&&(Y||(V[Fe]=O),this.callback(this.manager,Te,{pointers:V,changedPointers:[O],pointerType:ke,srcEvent:V[Fe]}),J&&V.splice(Fe,1))}});var Ve={touchstart:X,touchmove:ee,touchend:$,touchcancel:re},Ke="touchstart",Je="touchstart touchmove touchend touchcancel";function Xe(){this.evTarget=Ke,this.evWin=Je,this.started=!1,te.apply(this,arguments)}A(Xe,te,{handler:function(O){var V=Ve[O.type];if(V===X&&(this.started=!0),!!this.started){var J=Pe.call(this,O,V);V&($|re)&&J[0].length-J[1].length===0&&(this.started=!1),this.callback(this.manager,V,{pointers:J[0],changedPointers:J[1],pointerType:G,srcEvent:O})}}});function Pe(P,O){var V=w(P.touches),J=w(P.changedTouches);return O&($|re)&&(V=C(V.concat(J),"identifier")),[V,J]}var Se={touchstart:X,touchmove:ee,touchend:$,touchcancel:re},Be="touchstart touchmove touchend touchcancel";function De(){this.evTarget=Be,this.targetIds={},te.apply(this,arguments)}A(De,te,{handler:function(O){var V=Se[O.type],J=He.call(this,O,V);J&&this.callback(this.manager,V,{pointers:J[0],changedPointers:J[1],pointerType:G,srcEvent:O})}});function He(P,O){var V=w(P.touches),J=this.targetIds;if(O&(X|ee)&&V.length===1)return J[V[0].identifier]=!0,[V,V];var Y,oe,Te=w(P.changedTouches),ke=[],Ze=this.target;if(oe=V.filter(function(Fe){return S(Fe.target,Ze)}),O===X)for(Y=0;Y<oe.length;)J[oe[Y].identifier]=!0,Y++;for(Y=0;Y<Te.length;)J[Te[Y].identifier]&&ke.push(Te[Y]),O&($|re)&&delete J[Te[Y].identifier],Y++;if(ke.length)return[C(oe.concat(ke),"identifier"),ke]}var Ue=2500,Ye=25;function ze(){te.apply(this,arguments);var P=E(this.handler,this);this.touch=new De(this.manager,P),this.mouse=new Oe(this.manager,P),this.primaryTouch=null,this.lastTouches=[]}A(ze,te,{handler:function(O,V,J){var Y=J.pointerType==G,oe=J.pointerType==K;if(!(oe&&J.sourceCapabilities&&J.sourceCapabilities.firesTouchEvents)){if(Y)rt.call(this,V,J);else if(oe&&ht.call(this,J))return;this.callback(O,V,J)}},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});function rt(P,O){P&X?(this.primaryTouch=O.changedPointers[0].identifier,ot.call(this,O)):P&($|re)&&ot.call(this,O)}function ot(P){var O=P.changedPointers[0];if(O.identifier===this.primaryTouch){var V={x:O.clientX,y:O.clientY};this.lastTouches.push(V);var J=this.lastTouches,Y=function(){var oe=J.indexOf(V);oe>-1&&J.splice(oe,1)};setTimeout(Y,Ue)}}function ht(P){for(var O=P.srcEvent.clientX,V=P.srcEvent.clientY,J=0;J<this.lastTouches.length;J++){var Y=this.lastTouches[J],oe=Math.abs(O-Y.x),Te=Math.abs(V-Y.y);if(oe<=Ye&&Te<=Ye)return!0}return!1}var st=s?L(s.style,"touchAction"):r,ct=st!==r,We="compute",Ce="auto",Re="manipulation",Le="none",Qe="pan-x",je="pan-y",at=Lt();function vt(P,O){this.manager=P,this.set(O)}vt.prototype={set:function(P){P==We&&(P=this.compute()),ct&&this.manager.element.style&&at[P]&&(this.manager.element.style[st]=P),this.actions=P.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var P=[];return v(this.manager.recognizers,function(O){b(O.options.enable,[O])&&(P=P.concat(O.getTouchAction()))}),At(P.join(" "))},preventDefaults:function(P){var O=P.srcEvent,V=P.offsetDirection;if(this.manager.session.prevented){O.preventDefault();return}var J=this.actions,Y=M(J,Le)&&!at[Le],oe=M(J,je)&&!at[je],Te=M(J,Qe)&&!at[Qe];if(Y){var ke=P.pointers.length===1,Ze=P.distance<2,Fe=P.deltaTime<250;if(ke&&Ze&&Fe)return}if(!(Te&&oe)&&(Y||oe&&V&pe||Te&&V&_e))return this.preventSrc(O)},preventSrc:function(P){this.manager.session.prevented=!0,P.preventDefault()}};function At(P){if(M(P,Le))return Le;var O=M(P,Qe),V=M(P,je);return O&&V?Le:O||V?O?Qe:je:M(P,Re)?Re:Ce}function Lt(){if(!ct)return!1;var P={},O=n.CSS&&n.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach(function(V){P[V]=O?n.CSS.supports("touch-action",V):!0}),P}var bt=1,nt=2,gt=4,mt=8,ft=mt,Et=16,ut=32;function dt(P){this.options=h({},this.defaults,P||{}),this.id=F(),this.manager=null,this.options.enable=T(this.options.enable,!0),this.state=bt,this.simultaneous={},this.requireFail=[]}dt.prototype={defaults:{},set:function(P){return h(this.options,P),this.manager&&this.manager.touchAction.update(),this},recognizeWith:function(P){if(p(P,"recognizeWith",this))return this;var O=this.simultaneous;return P=Tt(P,this),O[P.id]||(O[P.id]=P,P.recognizeWith(this)),this},dropRecognizeWith:function(P){return p(P,"dropRecognizeWith",this)?this:(P=Tt(P,this),delete this.simultaneous[P.id],this)},requireFailure:function(P){if(p(P,"requireFailure",this))return this;var O=this.requireFail;return P=Tt(P,this),H(O,P)===-1&&(O.push(P),P.requireFailure(this)),this},dropRequireFailure:function(P){if(p(P,"dropRequireFailure",this))return this;P=Tt(P,this);var O=H(this.requireFail,P);return O>-1&&this.requireFail.splice(O,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(P){return!!this.simultaneous[P.id]},emit:function(P){var O=this,V=this.state;function J(Y){O.manager.emit(Y,P)}V<mt&&J(O.options.event+It(V)),J(O.options.event),P.additionalEvent&&J(P.additionalEvent),V>=mt&&J(O.options.event+It(V))},tryEmit:function(P){if(this.canEmit())return this.emit(P);this.state=ut},canEmit:function(){for(var P=0;P<this.requireFail.length;){if(!(this.requireFail[P].state&(ut|bt)))return!1;P++}return!0},recognize:function(P){var O=h({},P);if(!b(this.options.enable,[this,O])){this.reset(),this.state=ut;return}this.state&(ft|Et|ut)&&(this.state=bt),this.state=this.process(O),this.state&(nt|gt|mt|Et)&&this.tryEmit(O)},process:function(P){},getTouchAction:function(){},reset:function(){}};function It(P){return P&Et?"cancel":P&mt?"end":P>?"move":P&nt?"start":""}function Pt(P){return P==ne?"down":P==fe?"up":P==se?"left":P==ae?"right":""}function Tt(P,O){var V=O.manager;return V?V.get(P):P}function it(){dt.apply(this,arguments)}A(it,dt,{defaults:{pointers:1},attrTest:function(P){var O=this.options.pointers;return O===0||P.pointers.length===O},process:function(P){var O=this.state,V=P.eventType,J=O&(nt|gt),Y=this.attrTest(P);return J&&(V&re||!Y)?O|Et:J||Y?V&$?O|mt:O&nt?O|gt:nt:ut}});function _t(){it.apply(this,arguments),this.pX=null,this.pY=null}A(_t,it,{defaults:{event:"pan",threshold:10,pointers:1,direction:me},getTouchAction:function(){var P=this.options.direction,O=[];return P&pe&&O.push(je),P&_e&&O.push(Qe),O},directionTest:function(P){var O=this.options,V=!0,J=P.distance,Y=P.direction,oe=P.deltaX,Te=P.deltaY;return Y&O.direction||(O.direction&pe?(Y=oe===0?ie:oe<0?se:ae,V=oe!=this.pX,J=Math.abs(P.deltaX)):(Y=Te===0?ie:Te<0?fe:ne,V=Te!=this.pY,J=Math.abs(P.deltaY))),P.direction=Y,V&&J>O.threshold&&Y&O.direction},attrTest:function(P){return it.prototype.attrTest.call(this,P)&&(this.state&nt||!(this.state&nt)&&this.directionTest(P))},emit:function(P){this.pX=P.deltaX,this.pY=P.deltaY;var O=Pt(P.direction);O&&(P.additionalEvent=this.options.event+O),this._super.emit.call(this,P)}});function xt(){it.apply(this,arguments)}A(xt,it,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[Le]},attrTest:function(P){return this._super.attrTest.call(this,P)&&(Math.abs(P.scale-1)>this.options.threshold||this.state&nt)},emit:function(P){if(P.scale!==1){var O=P.scale<1?"in":"out";P.additionalEvent=this.options.event+O}this._super.emit.call(this,P)}});function St(){dt.apply(this,arguments),this._timer=null,this._input=null}A(St,dt,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[Ce]},process:function(P){var O=this.options,V=P.pointers.length===O.pointers,J=P.distance<O.threshold,Y=P.deltaTime>O.time;if(this._input=P,!J||!V||P.eventType&($|re)&&!Y)this.reset();else if(P.eventType&X)this.reset(),this._timer=d(function(){this.state=ft,this.tryEmit()},O.time,this);else if(P.eventType&$)return ft;return ut},reset:function(){clearTimeout(this._timer)},emit:function(P){this.state===ft&&(P&&P.eventType&$?this.manager.emit(this.options.event+"up",P):(this._input.timeStamp=f(),this.manager.emit(this.options.event,this._input)))}});function wt(){it.apply(this,arguments)}A(wt,it,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[Le]},attrTest:function(P){return this._super.attrTest.call(this,P)&&(Math.abs(P.rotation)>this.options.threshold||this.state&nt)}});function Mt(){it.apply(this,arguments)}A(Mt,it,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:pe|_e,pointers:1},getTouchAction:function(){return _t.prototype.getTouchAction.call(this)},attrTest:function(P){var O=this.options.direction,V;return O&(pe|_e)?V=P.overallVelocity:O&pe?V=P.overallVelocityX:O&_e&&(V=P.overallVelocityY),this._super.attrTest.call(this,P)&&O&P.offsetDirection&&P.distance>this.options.threshold&&P.maxPointers==this.options.pointers&&c(V)>this.options.velocity&&P.eventType&$},emit:function(P){var O=Pt(P.offsetDirection);O&&this.manager.emit(this.options.event+O,P),this.manager.emit(this.options.event,P)}});function Rt(){dt.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}A(Rt,dt,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[Re]},process:function(P){var O=this.options,V=P.pointers.length===O.pointers,J=P.distance<O.threshold,Y=P.deltaTime<O.time;if(this.reset(),P.eventType&X&&this.count===0)return this.failTimeout();if(J&&Y&&V){if(P.eventType!=$)return this.failTimeout();var oe=this.pTime?P.timeStamp-this.pTime<O.interval:!0,Te=!this.pCenter||le(this.pCenter,P.center)<O.posThreshold;this.pTime=P.timeStamp,this.pCenter=P.center,!Te||!oe?this.count=1:this.count+=1,this._input=P;var ke=this.count%O.taps;if(ke===0)return this.hasRequireFailures()?(this._timer=d(function(){this.state=ft,this.tryEmit()},O.interval,this),nt):ft}return ut},failTimeout:function(){return this._timer=d(function(){this.state=ut},this.options.interval,this),ut},reset:function(){clearTimeout(this._timer)},emit:function(){this.state==ft&&(this._input.tapCount=this.count,this.manager.emit(this.options.event,this._input))}});function yt(P,O){return O=O||{},O.recognizers=T(O.recognizers,yt.defaults.preset),new Ct(P,O)}yt.VERSION="2.0.7",yt.defaults={domEvents:!1,touchAction:We,enable:!0,inputTarget:null,inputClass:null,preset:[[wt,{enable:!1}],[xt,{enable:!1},["rotate"]],[Mt,{direction:pe}],[_t,{direction:pe},["swipe"]],[Rt],[Rt,{event:"doubletap",taps:2},["tap"]],[St]],cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}};var Ft=1,Bt=2;function Ct(P,O){this.options=h({},yt.defaults,O||{}),this.options.inputTarget=this.options.inputTarget||P,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=P,this.input=Q(this),this.touchAction=new vt(this,this.options.touchAction),Ht(this,!0),v(this.options.recognizers,function(V){var J=this.add(new V[0](V[1]));V[2]&&J.recognizeWith(V[2]),V[3]&&J.requireFailure(V[3])},this)}Ct.prototype={set:function(P){return h(this.options,P),P.touchAction&&this.touchAction.update(),P.inputTarget&&(this.input.destroy(),this.input.target=P.inputTarget,this.input.init()),this},stop:function(P){this.session.stopped=P?Bt:Ft},recognize:function(P){var O=this.session;if(!O.stopped){this.touchAction.preventDefaults(P);var V,J=this.recognizers,Y=O.curRecognizer;(!Y||Y&&Y.state&ft)&&(Y=O.curRecognizer=null);for(var oe=0;oe<J.length;)V=J[oe],O.stopped!==Bt&&(!Y||V==Y||V.canRecognizeWith(Y))?V.recognize(P):V.reset(),!Y&&V.state&(nt|gt|mt)&&(Y=O.curRecognizer=V),oe++}},get:function(P){if(P instanceof dt)return P;for(var O=this.recognizers,V=0;V<O.length;V++)if(O[V].options.event==P)return O[V];return null},add:function(P){if(p(P,"add",this))return this;var O=this.get(P.options.event);return O&&this.remove(O),this.recognizers.push(P),P.manager=this,this.touchAction.update(),P},remove:function(P){if(p(P,"remove",this))return this;if(P=this.get(P),P){var O=this.recognizers,V=H(O,P);V!==-1&&(O.splice(V,1),this.touchAction.update())}return this},on:function(P,O){if(P!==r&&O!==r){var V=this.handlers;return v(B(P),function(J){V[J]=V[J]||[],V[J].push(O)}),this}},off:function(P,O){if(P!==r){var V=this.handlers;return v(B(P),function(J){O?V[J]&&V[J].splice(H(V[J],O),1):delete V[J]}),this}},emit:function(P,O){this.options.domEvents&&Ot(P,O);var V=this.handlers[P]&&this.handlers[P].slice();if(!(!V||!V.length)){O.type=P,O.preventDefault=function(){O.srcEvent.preventDefault()};for(var J=0;J<V.length;)V[J](O),J++}},destroy:function(){this.element&&Ht(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}};function Ht(P,O){var V=P.element;if(V.style){var J;v(P.options.cssProps,function(Y,oe){J=L(V.style,oe),O?(P.oldCssProps[J]=V.style[J],V.style[J]=Y):V.style[J]=P.oldCssProps[J]||""}),O||(P.oldCssProps={})}}function Ot(P,O){var V=t.createEvent("Event");V.initEvent(P,!0,!0),V.gesture=O,O.target.dispatchEvent(V)}return h(yt,{INPUT_START:X,INPUT_MOVE:ee,INPUT_END:$,INPUT_CANCEL:re,STATE_POSSIBLE:bt,STATE_BEGAN:nt,STATE_CHANGED:gt,STATE_ENDED:mt,STATE_RECOGNIZED:ft,STATE_CANCELLED:Et,STATE_FAILED:ut,DIRECTION_NONE:ie,DIRECTION_LEFT:se,DIRECTION_RIGHT:ae,DIRECTION_UP:fe,DIRECTION_DOWN:ne,DIRECTION_HORIZONTAL:pe,DIRECTION_VERTICAL:_e,DIRECTION_ALL:me,Manager:Ct,Input:te,TouchAction:vt,TouchInput:De,MouseInput:Oe,PointerEventInput:Ge,TouchMouseInput:ze,SingleTouchInput:Xe,Recognizer:dt,AttrRecognizer:it,Tap:Rt,Pan:_t,Swipe:Mt,Pinch:xt,Rotate:wt,Press:St,on:_,off:R,each:v,merge:y,extend:m,assign:h,inherit:A,bindFn:E,prefixed:L}),yt}(typeof window!="undefined"?window:{},typeof document!="undefined"?document:{});function calculateThreeMouse(n,t,e){var r=t.getBoundingClientRect(),o=r.top,s=r.left,u=r.width,l=r.height;return e&&(s=s+u*e.left,o=o+l*(1-e.bottom-e.height),u=u*e.width,l=l*e.height),new THREE__namespace.Vector2((n.x-s)/u*2-1,-(n.y-o)/l*2+1)}var camera$2=new THREE__namespace.OrthographicCamera(-1,1,1,-1,0,1),geometry$5=new THREE__namespace.BufferGeometry;geometry$5.setAttribute("position",new THREE__namespace.Float32BufferAttribute([-1,3,0,-1,-1,0,3,-1,0],3)),geometry$5.setAttribute("uv",new THREE__namespace.Float32BufferAttribute([0,2,0,0,2,0],2));var mesh$4=new THREE__namespace.Mesh(geometry$5),scene$2=new THREE__namespace.Scene;scene$2.add(mesh$4);var DEFAULT_VERTEX_SHADER=`
|
|
1437
1437
|
varying vec2 vUv;
|
|
1438
1438
|
void main() {
|
|
1439
1439
|
vUv = uv;
|
|
@@ -1474,7 +1474,7 @@ void main() {
|
|
|
1474
1474
|
|
|
1475
1475
|
gl_Position = projectionMatrix * mvPosition;
|
|
1476
1476
|
}
|
|
1477
|
-
`,camera$1=new THREE__namespace.OrthographicCamera(-1,1,1,-1,0,1),geometry$4=new THREE__namespace.BufferGeometry;geometry$4.setAttribute("position",new THREE__namespace.Float32BufferAttribute([-1,3,0,-1,-1,0,3,-1,0],3)),geometry$4.setAttribute("uv",new THREE__namespace.Float32BufferAttribute([0,2,0,0,2,0],2));var noneMaterial=new THREE__namespace.MeshBasicMaterial,mesh$3=new THREE__namespace.Mesh(geometry$4,noneMaterial),scene$1=new THREE__namespace.Scene;scene$1.add(mesh$3);var DepthCopyPass=function(){function n(t){this.renderer=t,this.material=new THREE__namespace.ShaderMaterial({vertexShader:VERTEX,fragmentShader:FRAGMENT$1,uniforms:Object.assign({depthBuffer:new THREE__namespace.Uniform(null)}),blending:THREE__namespace.NoBlending,depthWrite:!0,depthTest:!0}),this.renderer.getContext()&&this.renderer.getContext()instanceof WebGLRenderingContext&&(this.material.extensions.fragDepth=!0)}return n.prototype.render=function(t,e){var r=this.renderer.getRenderTarget();this.material.uniforms.depthBuffer.value=t,mesh$3.material=this.material,this.renderer.setRenderTarget(e||null),this.renderer.render(scene$1,camera$1),this.renderer.setRenderTarget(r),mesh$3.material=noneMaterial},n.prototype.dispose=function(){this.material.dispose()},n}(),sharedVector2$1=new THREE__namespace.Vector2,BaseController=function(n){__extends(t,n);function t(e){var r,o,s,u,l,c,f=n.call(this)||this,d=t.parseArgs(e);f.mode="",f.pending=new Set,f.userAction=d.initial.userAction,f.destroyed=!1,f.ident=d.ident,f.scene=d.scene,f.xrCustomObjectsScene=d.xrCustomObjectsScene,f.helper=d.helper,f.boundingMesh=d.boundingMesh,f.camera=d.camera,f.renderer=d.renderer,f.scissor=d.scissor,f.element=d.element,f.models=d.models,f.enableWheel=d.enableWheel,f.enableIOSEDR=(r=d.enableIOSEDR)!==null&&r!==void 0?r:!1,f.enableEDL=(o=d.enableEDL)!==null&&o!==void 0?o:!0,f.enableHQ=(s=d.enableHQ)!==null&&s!==void 0?s:!0,f.works=d.works,f.imageOptions=d.imageOptions,f.videoTexture=d.videoTexture,f.extraElements=d.extraElements,f.initial=d.initial,f.currentPano=typeof f.initial.state.panoIndex=="number"?{workCode:(c=(u=f.initial.state.workCode)!==null&&u!==void 0?u:(l=d.works[0])===null||l===void 0?void 0:l.workCode)!==null&&c!==void 0?c:"",panoIndex:f.initial.state.panoIndex}:{workCode:f.initial.currentState.workCode,panoIndex:f.initial.currentState.panoIndex},f.needsRender=!0,f.modelSceneNeedsRender=!0,f.cameraMotion=new Motion({longitude:{value:f.camera.pose.longitude,circle:[0,Math.PI*2]},latitude:f.camera.pose.latitude,fov:f.camera.pose.fov}),f.inMomentumMovement=null,f.eventUnbinds=[d.element].concat(d.extraElements||[]).map(function(v){return f.bindEvents(v)}),f.pending.add("init-animation"),f.initAnimationReady=new Promise(function(v){AnimationFrameLoop.shared.add(function(){f.initAnimation().then(function(){f.pending.delete("init-animation"),v()})},!0)}),f.initAnimationIsReady=!1,f.initAnimationReady.then(function(){return f.initAnimationIsReady=!0}),f.modelScene=d.modelScene;var p=new THREE__namespace.Vector2;return f.renderer.getDrawingBufferSize(p),f.modelRenderTarget=d.modelRenderTarget,f.copyPass=new CopyPass(f.renderer),f.depthCopyPass=new DepthCopyPass(f.renderer),f.screenBuffers=[],f.lastPostProcessingType=null,f}return t.parseArgs=function(e){return e instanceof t?e:__assign({},e)},t.initAnimationEndState=function(e){var r,o,s,u,l,c,f,d,p=this.parseArgs(e),v=p.initial,g=v.state,h=v.currentState,m=typeof g.panoIndex=="number"?{workCode:(s=(r=g.workCode)!==null&&r!==void 0?r:(o=p.works[0])===null||o===void 0?void 0:o.workCode)!==null&&s!==void 0?s:"",panoIndex:g.panoIndex}:{workCode:h.workCode,panoIndex:h.panoIndex};return __assign(__assign({},m),{mode:"",longitude:(u=g.longitude)!==null&&u!==void 0?u:h.longitude,latitude:(l=g.latitude)!==null&&l!==void 0?l:h.latitude,fov:(c=g.fov)!==null&&c!==void 0?c:h.fov,offset:(f=g.offset)!==null&&f!==void 0?f:h.offset,distance:(d=g.distance)!==null&&d!==void 0?d:h.distance})},t.prototype.destroy=function(){var e;this.stopMomentumMovement(),this.destroyed=!0,this.off(),this.cameraMotion.dispose();for(var r=0,o=this.eventUnbinds;r<o.length;r++){var s=o[r];s()}this.copyEffect&&(this.copyEffect.dispose(),delete this.copyEffect),delete this.panState,(e=this.pressState)===null||e===void 0||e.stop(),delete this.pressState},t.prototype.isReady=function(){return this.inMomentumMovement===null&&this.pending.size===0&&this.cameraMotion.ended===!0},t.prototype.bindExtraElement=function(e){for(var r=0,o=this.eventUnbinds;r<o.length;r++){var s=o[r];if(s.element===e)return}this.eventUnbinds.push(this.bindEvents(e))},t.prototype.unbindExtraElement=function(e){for(var r=[],o=0,s=this.eventUnbinds;o<s.length;o++){var u=s[o];u.element===e?u():r.push(u)}this.eventUnbinds=r},t.prototype.updateRenderSize=function(e){this.needsRender=!0,this.modelSceneNeedsRender=!0,this.modelRenderTarget.setSize(e.x,e.y),this.screenBuffers.forEach(function(r){r.setSize(e.x,e.y)})},t.prototype.updateModel=function(e){this.needsRender=!0,this.modelSceneNeedsRender=!0},t.prototype.updateWork=function(e,r,o,s){return this.works=e,this.userAction=s,!1},t.prototype.updateTime=function(e,r){if(!this.destroyed){var o={};this.cameraMotion.ended&&(this.cameraMotion.update(e),o.longitude=this.cameraMotion.value.longitude,o.latitude=this.cameraMotion.value.latitude,o.fov=this.cameraMotion.value.fov),isEmptyObject(o)&&this.setCamera(o)}},t.prototype.render=function(e,r){var o=this.renderer.getRenderTarget();this.updateScreenBuffer(r),e&&(this.renderer.setRenderTarget(this.modelRenderTarget),this.renderer.render(this.modelScene,this.camera)),this.depthCopyPass.render(this.modelRenderTarget.depthTexture,o),this.renderer.autoClearDepth=!1,this.renderer.autoClearColor=!0,this.copyPass.render(this.modelRenderTarget,o),this.renderer.setRenderTarget(o),this.renderer.autoClearColor=!1,this.renderer.autoClearDepth=!1,this.renderer.render(this.scene,this.camera),this.renderer.autoClearColor=!0,this.renderer.autoClearDepth=!0},t.prototype.postProcessing=function(e,r){this.destroyed},t.prototype.updateCamera=function(e,r,o){var s=this;return this.initAnimationReady.then(function(){s.userAction=o,s.stopMomentumMovement();var u={};return e.longitude!==void 0&&(u.longitude=e.longitude),e.latitude!==void 0&&(u.latitude=e.latitude),e.fov!==void 0&&(u.fov=e.fov),s.cameraMotion.set(u,r).catch(noop$1)})},t.prototype.updateCameraWithKeyframes=function(e,r,o){var s=this;return this.initAnimationReady.then(function(){s.userAction=o,s.stopMomentumMovement();for(var u=[],l=0,c=e;l<c.length;l++){var f=c[l];u.push({key:f.key,progress:f.progress,value:{longitude:f.value.longitude,latitude:f.value.latitude,fov:f.value.fov}})}return s.cameraMotion.setKeyframes(u,r)})},t.prototype.getTargetState=function(){var e=this.cameraMotion.getKeyFrameSegment(now())[1];return __assign(__assign({},this.currentPano),{mode:this.mode,longitude:e.value.longitude,latitude:e.value.latitude,fov:e.value.fov,offset:this.camera.pose.offset.clone(),distance:this.camera.pose.distance})},t.prototype.initAnimation=function(){var e=this.initial;e.state,e.currentState,e.duration;var r=e.userAction,o=t.initAnimationEndState(this);return this.userAction=r,this.emit("initAnimation.start",createEvent("initAnimation.start",{state:o,userAction:this.userAction})),this.emit("initAnimation.end",createEvent("initAnimation.end",{state:o,userAction:this.userAction})),Promise.resolve()},t.prototype.setCamera=function(e){var r,o,s,u,l;e===void 0&&(e={});var c=(r=e.longitude)!==null&&r!==void 0?r:this.camera.pose.longitude,f=(o=e.latitude)!==null&&o!==void 0?o:this.camera.pose.latitude,d=(s=e.fov)!==null&&s!==void 0?s:this.camera.pose.fov,p=(u=e.distance)!==null&&u!==void 0?u:this.camera.pose.distance,v=(l=e.offset)!==null&&l!==void 0?l:this.camera.pose.offset,g=notSimilarValue(c,this.camera.pose.longitude,Math.PI*2)||notSimilarValue(f,this.camera.pose.latitude),h=notSimilarValue(d,this.camera.pose.fov),m=notSimilarValue(p,this.camera.pose.distance),y=notSimilarVector3(v,this.camera.pose.offset);(h||g||y||m)&&(this.camera.setFromPose({longitude:c,latitude:f,fov:d,distance:p,offset:v}),this.emit("camera.update",createEvent("camera.update",{userAction:this.userAction,state:__assign(__assign({},this.currentPano),{mode:this.mode,longitude:c,latitude:f,fov:d,offset:v,distance:p})})),this.needsRender=!0,this.modelSceneNeedsRender=!0)},t.prototype.stopMomentumMovement=function(){if(this.inMomentumMovement&&this.inMomentumMovement.event&&!this.inMomentumMovement.event.defaultPrevented&&!this.inMomentumMovement.event.isFinal){var e=createEvent("gesture.momentum",__assign(__assign({},this.inMomentumMovement.event),{isFirst:!1,isFinal:!0}));this.emit("gesture.momentum",e)}this.inMomentumMovement=null},t.prototype.onPanGesture=function(e){this.stopMomentumMovement(),this.emit("gesture.pan",e)},t.prototype.onTapGesture=function(e){this.stopMomentumMovement(),this.emit("gesture.tap",e)},t.prototype.onDblTapGesture=function(e){this.stopMomentumMovement(),this.emit("gesture.dbltap",e),!e.defaultPrevented&&(e.type="gesture.tap",this.onTapGesture(e))},t.prototype.onPressGesture=function(e){this.stopMomentumMovement(),this.emit("gesture.press",e)},t.prototype.onPinchGesture=function(e){this.stopMomentumMovement(),this.emit("gesture.pinch",e)},t.prototype.onMouseWheel=function(e){this.stopMomentumMovement(),this.emit("gesture.mousewheel",e)},t.prototype.onMouseMove=function(e){this.stopMomentumMovement(),this.emit("gesture.mousemove",e)},t.prototype.relativeClientPosition=function(e){return calculateThreeMouse(e,this.element,this.scissor)},t.prototype.bindEvents=function(e){var r=this,o=function(w){var C=calculateThreeMouse(w,r.element,r.scissor);return!(Math.abs(C.x)>1||Math.abs(C.y)>1)},s=new Hammer.Manager(e),u=function(w){var C=w.session;return C.firstInput||null},l=new Hammer.Pan({threshold:10,pointers:0}),c=new Hammer.Tap({interval:410}),f=new Hammer.Pinch({threshold:0,pointers:2});s.add([l,c,f]),s.on("panstart pan",function(w){var C=u(s);if(!(C&&!o(C.center))){var L=createEvent("gesture.pan",{target:w.target,pointerType:w.pointerType,srcEvent:w.srcEvent,pointers:w.pointers.map(function(I){var F=r.relativeClientPosition(I),k=new THREE__namespace.Raycaster;return k.params.Points={threshold:.1},k.setFromCamera(F,r.camera),{x:I.x,y:I.y,delta:0,buttons:0,coords:F,raycaster:k}}),isFirst:w.isFirst,isFinal:w.isFinal,scale:w.scale,center:function(I){var F=r.relativeClientPosition(I),k=new THREE__namespace.Raycaster;return k.params.Points={threshold:.1},k.setFromCamera(F,r.camera),{x:I.x,y:I.y,delta:0,buttons:0,coords:F,raycaster:k}}(w.center),velocityX:w.velocityX,velocityY:w.velocityY,overallVelocityX:w.overallVelocityX,overallVelocityY:w.overallVelocityY,userAction:!0,state:__assign(__assign({mode:r.mode},r.currentPano),clonePose(r.camera.pose))});r.onPanGesture(L),b()}}),s.on("tap",function(w){if(!(w.pointerType==="mouse"&&w.srcEvent.button!==0)){var C=u(s);if(!(C&&!o(C.center))){var L=createEvent("gesture.tap",{target:w.target,pointerType:w.pointerType,srcEvent:w.srcEvent,pointers:w.pointers.map(function(I){var F=r.relativeClientPosition(I),k=new THREE__namespace.Raycaster;return k.params.Points={threshold:.1},k.setFromCamera(F,r.camera),{x:I.x,y:I.y,delta:0,buttons:0,coords:F,raycaster:k}}),isFirst:!0,isFinal:!0,scale:w.scale,center:function(I){var F=r.relativeClientPosition(I),k=new THREE__namespace.Raycaster;return k.params.Points={threshold:.1},k.setFromCamera(F,r.camera),{x:I.x,y:I.y,delta:0,buttons:0,coords:F,raycaster:k}}(w.center),velocityX:w.velocityX,velocityY:w.velocityY,overallVelocityX:w.overallVelocityX,overallVelocityY:w.overallVelocityY,userAction:!0,state:__assign(__assign({mode:r.mode},r.currentPano),clonePose(r.camera.pose))});r.onTapGesture(L),b()}}}),s.on("pinchstart pinch pinchend",function(w){var C=u(s);if(!(C&&!o(C.center))){var L=createEvent("gesture.pinch",{target:w.target,pointerType:w.pointerType,srcEvent:w.srcEvent,pointers:w.pointers.map(function(I){var F,k=r.relativeClientPosition(I),N=new THREE__namespace.Raycaster;return N.params.Points={threshold:.1},N.setFromCamera(k,r.camera),{x:I.x,y:I.y,delta:(F=I.delta)!==null&&F!==void 0?F:0,buttons:0,coords:k,raycaster:N}}),isFirst:w.type==="pinchstart",isFinal:w.type==="pinchend",scale:w.scale,center:function(I){var F=r.relativeClientPosition(I),k=new THREE__namespace.Raycaster;return k.params.Points={threshold:.1},k.setFromCamera(F,r.camera),{x:I.x,y:I.y,delta:0,buttons:0,coords:F,raycaster:k}}(w.center),velocityX:w.velocityX,velocityY:w.velocityY,overallVelocityX:w.overallVelocityX,overallVelocityY:w.overallVelocityY,userAction:!0,state:__assign(__assign({mode:r.mode},r.currentPano),clonePose(r.camera.pose))});r.onPinchGesture(L),b()}}),s.on("dbltap",function(w){if(!(w.pointerType==="mouse"&&w.srcEvent.button!==0)){var C=u(s);if(!(C&&!o(C.center))){var L=createEvent("gesture.dbltap",{target:w.target,pointerType:w.pointerType,srcEvent:w.srcEvent,pointers:w.pointers.map(function(I){var F=r.relativeClientPosition(I),k=new THREE__namespace.Raycaster;return k.params.Points={threshold:.1},k.setFromCamera(F,r.camera),{x:I.x,y:I.y,delta:0,buttons:0,coords:F,raycaster:k}}),isFirst:!0,isFinal:!0,scale:w.scale,center:function(I){var F=r.relativeClientPosition(I),k=new THREE__namespace.Raycaster;return k.params.Points={threshold:.1},k.setFromCamera(F,r.camera),{x:I.x,y:I.y,delta:0,buttons:0,coords:F,raycaster:k}}(w.center),velocityX:w.velocityX,velocityY:w.velocityY,overallVelocityX:w.overallVelocityX,overallVelocityY:w.overallVelocityY,userAction:!0,state:__assign(__assign({mode:r.mode},r.currentPano),clonePose(r.camera.pose))});r.onDblTapGesture(L),b()}}});var d=null,p=null,v=function(w,C,L){var I={x:L.clientX,y:L.clientY},F=r.relativeClientPosition(I),k=new THREE__namespace.Raycaster;k.params.Points={threshold:.1},k.setFromCamera(F,r.camera);var N=__assign(__assign({},I),{coords:F,raycaster:k,buttons:L.buttons,delta:0}),D=w==="pinchend"?C:C-L.deltaY/280,U=createEvent("gesture.pinch",{target:L.target,pointerType:"mouse",srcEvent:L,pointers:[__assign({},N)],isFirst:w==="pinchstart",isFinal:w==="pinchend",scale:clamp$1(D,.1,10),center:__assign({},N),velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0,userAction:!0,state:__assign(__assign({mode:r.mode},r.currentPano),clonePose(r.camera.pose))});return U},g=function(w){var C,L={x:w.clientX,y:w.clientY};if(o(L)){if(w.preventDefault(),w.ctrlKey){var I=(C=d==null?void 0:d.prevEvent.scale)!==null&&C!==void 0?C:1,F=v(d?"pinch":"pinchstart",I,w);d===null?d={firstEvent:F,prevEvent:F}:d.prevEvent=F,r.onPinchGesture(F),p!==null&&window.clearTimeout(p),p=window.setTimeout(function(){var G;p=null;var J=(G=d==null?void 0:d.prevEvent.scale)!==null&&G!==void 0?G:1,X=v("pinchend",J,w);d=null,r.onPinchGesture(X)},200)}else{var k=(Math.abs(w.deltaY)>Math.abs(w.deltaX)?w.deltaY:w.deltaX)/-60,N=r.mouseWheelState!==void 0,D={x:w.clientX,y:w.clientY},U=r.relativeClientPosition(D),Q=new THREE__namespace.Raycaster;Q.params.Points={threshold:.1},Q.setFromCamera(U,r.camera);var q=__assign(__assign({},D),{coords:U,raycaster:Q,buttons:w.buttons,delta:k}),F=createEvent("gesture.mousewheel",{target:w.target,pointerType:"mouse",srcEvent:w,pointers:[__assign({},q)],isFirst:N,isFinal:!1,scale:0,center:__assign({},q),velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0,userAction:!0,state:__assign(__assign({mode:r.mode},r.currentPano),clonePose(r.camera.pose))});r.onMouseWheel(F),r.mouseWheelState&&clearTimeout(r.mouseWheelState.timer),r.mouseWheelState={timer:setTimeout(function(){delete r.mouseWheelState;var J=createEvent("gesture.mousewheel",{target:w.target,pointerType:"mouse",srcEvent:w,pointers:[__assign(__assign({},q),{delta:0})],isFirst:!1,isFinal:!0,scale:0,center:__assign(__assign({},q),{delta:0}),velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0,userAction:!0,state:__assign(__assign({mode:r.mode},r.currentPano),clonePose(r.camera.pose))});r.onMouseWheel(J)},100)}}b()}},h=function(w){if(!isMobile){if(!o({x:w.clientX,y:w.clientY})){m();return}var C=!1;r.mouseMoveState||(C=!0);var L={x:w.clientX,y:w.clientY},I=r.relativeClientPosition(L),F=new THREE__namespace.Raycaster;F.params.Points={threshold:.1},F.setFromCamera(I,r.camera);var k=__assign(__assign({},L),{coords:I,raycaster:F,buttons:w.buttons,delta:0}),N=createEvent("gesture.mousemove",{target:w.target,pointerType:"mouse",srcEvent:w,pointers:[__assign({},k)],isFirst:C,isFinal:!1,scale:0,center:__assign({},k),velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0,userAction:!0,state:__assign(__assign({mode:r.mode},r.currentPano),clonePose(r.camera.pose))});r.mouseMoveState={timeStamp:now(),event:N},r.onMouseMove(N),r.pressState&&Math.abs(w.clientX-r.pressState.event.center.y)>10&&Math.abs(w.clientY-r.pressState.event.center.y)>10&&b()}},m=function(){if(r.mouseMoveState){var w=createEvent(r.mouseMoveState.event.type,__assign(__assign({},r.mouseMoveState.event),{isFinal:!0}));delete r.mouseMoveState,r.onMouseMove(w)}b()},y=function(w){if(!o(w.center)){b();return}var C=!1;r.pressState||(C=!0,r.pressState={event:w,timeStamp:now(),stop:noop$1});var L=now()-r.pressState.timeStamp,I=createEvent(r.pressState.event.type,__assign(__assign({},r.pressState.event),{isFirst:C,isFinal:!1,center:__assign(__assign({},r.pressState.event.center),{delta:L}),pointers:r.pressState.event.pointers.map(function(F){return __assign(__assign({},F),{delta:L})})}));r.onPressGesture(I),r.pressState&&(r.pressState.stop=AnimationFrameLoop.shared.add(function(F){y(w)},!0,1))},A=function(w){if(b(),!(w.touches.length>1||w.changedTouches.length<=0)){var C={x:w.changedTouches[0].clientX,y:w.changedTouches[0].clientY},L=r.relativeClientPosition(C),I=new THREE__namespace.Raycaster;I.params.Points={threshold:.1},I.setFromCamera(L,r.camera);var F=__assign(__assign({},C),{coords:L,raycaster:I,buttons:0,delta:0}),k=createEvent("gesture.press",{target:w.target,pointerType:"touch",srcEvent:w,pointers:[__assign({},F)],isFirst:!1,isFinal:!1,scale:0,center:F,velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0,userAction:!0,state:__assign(__assign({mode:r.mode},r.currentPano),clonePose(r.camera.pose))});y(k)}},E=function(w){b();var C={x:w.clientX,y:w.clientY},L=r.relativeClientPosition(C),I=new THREE__namespace.Raycaster;I.params.Points={threshold:.1},I.setFromCamera(L,r.camera);var F=__assign(__assign({},C),{coords:L,raycaster:I,buttons:w.buttons,delta:0}),k=createEvent("gesture.press",{target:w.target,pointerType:"mouse",srcEvent:w,pointers:[__assign({},F)],isFirst:!1,isFinal:!1,scale:0,center:F,velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0,userAction:!0,state:__assign(__assign({mode:r.mode},r.currentPano),clonePose(r.camera.pose))});y(k)},b=function(){var w;if(r.pressState){var C=now()-r.pressState.timeStamp,L=createEvent(r.pressState.event.type,__assign(__assign({},r.pressState.event),{center:__assign(__assign({},r.pressState.event.center),{delta:C}),isFirst:!1,isFinal:!0,pointers:r.pressState.event.pointers.map(function(I){return __assign(__assign({},I),{delta:C})})}));r.onPressGesture(L),(w=r.pressState)===null||w===void 0||w.stop(),delete r.pressState}},T=null,_=function(w){var C,L=!1,I=!1;switch(w.type){case"gesturestart":L=!0;break;case"gestureend":I=!0;break}var F={x:w.clientX,y:w.clientY},k=r.relativeClientPosition(F),N=new THREE__namespace.Raycaster;N.params.Points={threshold:.1},N.setFromCamera(k,r.camera);var D=__assign(__assign({},F),{coords:k,raycaster:N,buttons:0,delta:0}),U=createEvent("gesture.pinch",{target:w.target,pointerType:"mouse",srcEvent:w,pointers:[__assign({},D)],isFirst:L,isFinal:I,scale:(C=w.scale)!==null&&C!==void 0?C:1,center:__assign({},D),velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0,userAction:!0,state:__assign(__assign({mode:r.mode},r.currentPano),clonePose(r.camera.pose))});return U},R=function(w){if(w.preventDefault(),!isMobile){var C=_(w);T={firstEvent:C};var L=T.firstEvent;L&&!o(L.center)||r.onPinchGesture(C)}},S=function(w){if(w.preventDefault(),!isMobile&&T){var C=_(w),L=T.firstEvent;L&&!o(L.center)||r.onPinchGesture(C)}},M=function(w){if(w.preventDefault(),!isMobile&&T){var C=_(w),L=T.firstEvent;T=null,!(L&&!o(L.center))&&r.onPinchGesture(C)}},B=function(w){if(w&&typeof w.preventDefault=="function"&&w.currentTarget===e&&w.preventDefault(),typeof getSelection=="function"){var C=getSelection();C&&C.focusNode&&(C.removeAllRanges&&C.removeAllRanges(),C.empty&&C.empty())}};this.enableWheel&&e.addEventListener("wheel",g,{passive:!1}),e.addEventListener("mousemove",h,!1),e.addEventListener("mouseout",m,!1),e.addEventListener("touchstart",A,{passive:!0}),e.addEventListener("touchend",b,!1),e.addEventListener("touchcancel",b,!1),e.addEventListener("mousedown",E,!1),e.addEventListener("mouseup",b,!1),e.addEventListener("gesturestart",R,{passive:!1}),e.addEventListener("gesturechange",S,{passive:!1}),e.addEventListener("gestureend",M,{passive:!1}),e.addEventListener("touchstart",B,{passive:!1}),e.addEventListener("contextmenu",B,!1);var H=function(){s.destroy(),e.removeEventListener("wheel",g,!1),e.removeEventListener("mousemove",h,!1),e.removeEventListener("mouseout",m,!1),e.removeEventListener("touchstart",A,!1),e.removeEventListener("touchend",b,!1),e.removeEventListener("touchcancel",b,!1),e.removeEventListener("mousedown",E,!1),e.removeEventListener("mouseup",b,!1),e.removeEventListener("gesturestart",R,!1),e.removeEventListener("gesturechange",S,!1),e.removeEventListener("gestureend",M,!1),e.removeEventListener("touchstart",B,!1),e.removeEventListener("contextmenu",B,!1)};return Object.assign(H,{element:e})},t.prototype.preloadPano=function(e,r){var o=this;r===void 0&&(r=noop$1);var s=this.works.getResolvedObserver(e);if(!s)return Promise.resolve();var u=["right","left","up","down","front","back"];return Promise.all(u.map(function(l){var c=__assign({key:"pano.".concat(panoStringify(e),".").concat(l)},pick(o.imageOptions,["size","format","quality","mappings"])),f=s.images[l],d=applyImageURLOptions(f,o.imageOptions.transform,c);return getFetcher(s.work).preload(d,{timeout:500})})).then(function(){return r(e),e})},t.prototype.updateScreenBuffer=function(e){var r,o,s,u,l,c;if(this.lastPostProcessingType!==e)if(this.lastPostProcessingType=e,e==="luminance"){if(this.screenBuffers.length===0){var f=this.renderer.getDrawingBufferSize(sharedVector2$1);this.screenBuffers=[new THREE__namespace.WebGLRenderTarget(f.x,f.y,{generateMipmaps:!1,encoding:(o=(r=this.renderer)===null||r===void 0?void 0:r.outputEncoding)!==null&&o!==void 0?o:THREE__namespace.sRGBEncoding}),this.modelRenderTarget]}}else if(e==="edl"){if(this.screenBuffers.length===0){var f=this.renderer.getDrawingBufferSize(sharedVector2$1);this.screenBuffers=[new THREE__namespace.WebGLRenderTarget(f.x,f.y,{generateMipmaps:!1,encoding:(u=(s=this.renderer)===null||s===void 0?void 0:s.outputEncoding)!==null&&u!==void 0?u:THREE__namespace.sRGBEncoding,minFilter:THREE__namespace.NearestFilter,magFilter:THREE__namespace.NearestFilter,format:THREE__namespace.RGBAFormat,type:THREE__namespace.FloatType}),this.modelRenderTarget]}this.models.setMaterial({useEDL:!0})}else if(e==="hq"){if(this.screenBuffers.length===0){var f=this.renderer.getDrawingBufferSize(sharedVector2$1),d=new THREE__namespace.WebGLRenderTarget(f.x,f.y,{generateMipmaps:!1,minFilter:THREE__namespace.NearestFilter,magFilter:THREE__namespace.NearestFilter,format:THREE__namespace.RGBAFormat,type:THREE__namespace.FloatType,depthTexture:new THREE__namespace.DepthTexture(f.x,f.y,THREE__namespace.UnsignedIntType)});d.depthTexture.format=THREE__namespace.DepthFormat,d.depthBuffer=!0;var p=new THREE__namespace.WebGLRenderTarget(f.x,f.y,{generateMipmaps:!1,encoding:(c=(l=this.renderer)===null||l===void 0?void 0:l.outputEncoding)!==null&&c!==void 0?c:THREE__namespace.sRGBEncoding,minFilter:THREE__namespace.NearestFilter,magFilter:THREE__namespace.NearestFilter,format:THREE__namespace.RGBAFormat,type:THREE__namespace.FloatType,depthTexture:d.depthTexture});this.screenBuffers=[d,p,this.modelRenderTarget]}this.models.setMaterial({useHQDepth:!0,useHQWeight:!1,pointShape:"CIRCLE"})}else this.screenBuffers&&(this.screenBuffers.forEach(function(v){v.dispose()}),this.screenBuffers=[]),this.models.setMaterial({useEDL:!1,useHQDepth:!1,useHQWeight:!1})},t}(Subscribe),FloorplanController=function(n){__extends(t,n);function t(e){var r=this,o,s=t.parseArgs(e);return r=n.call(this,s)||this,r.mode="Floorplan",r.defaultLongitude=s.defaultLongitude,r.defaultLatitude=s.defaultLatitude,r.defaultFov=s.defaultFov,r.maxFov=s.maxFov,r.minFov=s.minFov,r.maxLatitude=s.maxLatitude,r.minLatitude=s.minLatitude,r.modelInScreen=s.modelInScreen,r.locationMotion=new Motion({x:r.camera.pose.offset.x,y:r.camera.pose.offset.y,z:r.camera.pose.offset.z,distance:r.camera.pose.distance}),r.modelAlphaMotion=new Motion({modelAlpha:(o=r.models.getMaterial().modelAlpha)!==null&&o!==void 0?o:0}),r.perspToOrthoMotion=new Motion({perspToOrtho:r.camera.perspToOrtho.x}),r.currentTapId=null,r.intersectMeshCreator=s.intersectMeshCreator,r.intersectMesh=r.intersectMeshCreator(),r.intersectMesh.name="intersect",r.intersectMesh.visible=!1,r.helper.add(r.intersectMesh),r}return t.distanceFromModel=function(e,r,o){var s=e.bounding,u=Math.pow(Math.pow(s.max.x-s.min.x+1,2)+Math.pow(s.max.y-s.min.y+1,2)+Math.pow(s.max.z-s.min.z+1,2),1/2),l=u/2/Math.tan(Math.PI*r/360);return o<1&&(l=l/o),isNaN(l)?u:l},t.parseArgs=function(e){var r,o,s,u,l,c,f,d,p;if(e instanceof t)return e;var v=n.parseArgs.call(this,e);return __assign(__assign({},v),{defaultLongitude:(r=e.defaultLongitude)!==null&&r!==void 0?r:Math.PI/4,defaultLatitude:(o=e.defaultLatitude)!==null&&o!==void 0?o:Math.PI/4,defaultFov:(s=e.defaultFov)!==null&&s!==void 0?s:80,maxFov:(u=e.maxFov)!==null&&u!==void 0?u:120,minFov:(l=e.minFov)!==null&&l!==void 0?l:20,maxLatitude:(c=e.maxLatitude)!==null&&c!==void 0?c:+Math.PI/2,minLatitude:(f=e.minLatitude)!==null&&f!==void 0?f:-Math.PI/2,modelInScreen:(d=e.modelInScreen)!==null&&d!==void 0?d:"boundingbox-center",intersectMeshCreator:(p=e.intersectMeshCreator)!==null&&p!==void 0?p:function(){return new IntersectMesh}})},t.initAnimationEndState=function(e){var r,o,s,u,l,c,f,d=this.parseArgs(e),p=e.initial,v=p.state,g=p.currentState,h=typeof v.panoIndex=="number"?{workCode:(s=(r=v.workCode)!==null&&r!==void 0?r:(o=d.works[0])===null||o===void 0?void 0:o.workCode)!==null&&s!==void 0?s:"",panoIndex:v.panoIndex}:{workCode:g.workCode,panoIndex:g.panoIndex},m=__assign(__assign({},h),{mode:"Floorplan",longitude:(u=v.longitude)!==null&&u!==void 0?u:isThirdPersonMode(g.mode)?g.longitude:d.defaultLongitude,latitude:clamp$1((l=v.latitude)!==null&&l!==void 0?l:g.mode==="Floorplan"?g.latitude:d.defaultLatitude,d.minLatitude,d.maxLatitude),fov:(c=v.fov)!==null&&c!==void 0?c:d.defaultFov,offset:v.offset?v.offset.clone():e.models.bounding.getCenter(new THREE__namespace.Vector3),distance:(f=v.distance)!==null&&f!==void 0?f:t.distanceFromModel(d.models,d.defaultFov,d.camera.aspect)});return m},t.prototype.destroy=function(){n.prototype.destroy.call(this),this.locationMotion.dispose(),delete this.panState,this.intersectMesh.dispose(),this.helper.remove(this.intersectMesh)},t.prototype.isReady=function(){return this.locationMotion.ended===!1?!1:n.prototype.isReady.call(this)},t.prototype.updateWork=function(e,r,o,s){var u;return this.works=e,this.updateCamera(r,(u=o.duration)!==null&&u!==void 0?u:0,s),!0},t.prototype.updateModel=function(e){n.prototype.updateModel.call(this,e);var r=e.bounding.getCenter(new THREE__namespace.Vector3),o=t.distanceFromModel(e,this.defaultFov,this.camera.aspect);this.updateCamera({offset:r,distance:o},0,!0)},t.prototype.updateCamera=function(e,r,o){var s=this;return this.initAnimationReady.then(function(){s.userAction=o,s.stopMomentumMovement();var u={},l={};return e.distance!==void 0&&(u.distance=e.distance),e.offset!==void 0&&(u.x=e.offset.x,u.y=e.offset.y,u.z=e.offset.z),e.longitude!==void 0&&(l.longitude=e.longitude),e.latitude!==void 0&&(l.latitude=e.latitude),e.fov!==void 0&&(l.fov=e.fov),s.locationMotion.set(u,r).catch(noop$1),s.cameraMotion.set(l,r).catch(noop$1)})},t.prototype.updateCameraWithKeyframes=function(e,r,o){var s=this;return this.initAnimationReady.then(function(){s.userAction=o,s.stopMomentumMovement();for(var u=[],l=[],c=0,f=e;c<f.length;c++){var d=f[c];u.push({key:d.key,progress:d.progress,value:{distance:d.value.distance,x:d.value.offset.x,y:d.value.offset.x,z:d.value.offset.x}}),l.push({key:d.key,progress:d.progress,value:{longitude:d.value.longitude,latitude:d.value.latitude,fov:d.value.fov}})}return s.locationMotion.setKeyframes(u,r).catch(noop$1),s.cameraMotion.setKeyframes(e,r)})},t.prototype.updateTime=function(e,r){if(!this.destroyed){var o={},s={};this.modelAlphaMotion.ended||(this.modelAlphaMotion.update(e),o.modelAlpha=this.modelAlphaMotion.value.modelAlpha),this.perspToOrthoMotion.ended||(this.perspToOrthoMotion.update(e),this.camera.perspToOrtho.setScalar(clamp$1(this.perspToOrthoMotion.value.perspToOrtho,0,1))),this.locationMotion.ended||(this.locationMotion.update(e),s.distance=this.locationMotion.value.distance,s.offset=new THREE__namespace.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z)),this.cameraMotion.ended||(this.cameraMotion.update(e),s.longitude=this.cameraMotion.value.longitude,s.latitude=this.cameraMotion.value.latitude,s.fov=this.cameraMotion.value.fov),isEmptyObject(o)||this.models.setMaterial(o),isEmptyObject(s)||this.setCamera(s)}},t.prototype.getTargetState=function(){var e=this.cameraMotion.getKeyFrameSegment(now())[1],r=this.locationMotion.getKeyFrameSegment(now())[1];return __assign(__assign({},this.currentPano),{mode:this.mode,longitude:e.value.longitude,latitude:e.value.latitude,fov:e.value.fov,offset:new THREE__namespace.Vector3(r.value.x,r.value.y,r.value.z),distance:r.value.distance})},t.prototype.initAnimation=function(){var e=this;return this.destroyed?Promise.resolve():new Promise(function(r){var o=e.initial;o.state,o.currentState;var s=o.duration,u=o.userAction;e.userAction=u;var l=t.initAnimationEndState(e),c=pick(l,["longitude","latitude","fov"]),f={x:l.offset.x,y:l.offset.y,z:l.offset.z,distance:l.distance},d={modelAlpha:1},p={perspToOrtho:0};e.emit("initAnimation.start",createEvent("initAnimation.start",{state:l,userAction:e.userAction})),e.modelAlphaMotion.set(d,s/3).catch(noop$1),e.perspToOrthoMotion.set(p,s).catch(noop$1),e.cameraMotion.set(c,s).catch(noop$1),e.locationMotion.set(f,s).then(function(){e.emit("initAnimation.end",createEvent("initAnimation.end",{state:l,userAction:e.userAction}))},function(v){var g=__assign(__assign(__assign({},e.currentPano),{mode:e.mode}),clonePose(e.camera.pose));e.emit("initAnimation.end",createEvent("initAnimation.end",{state:g,userAction:e.userAction}))}).then(function(){r()})})},t.prototype.updateRenderSize=function(e){this.needsRender=!0,this.modelSceneNeedsRender=!0,this.screenBuffers.forEach(function(r){r.setSize(e.x,e.y)})},t.prototype.getForwardObserverOrNot=function(e){var r=this,o=this.models.intersectRaycaster(e)[0];if(!o)return null;var s=this.works.resolvedObservers.filter(function(f){for(var d,p=0,v=r.models;p<v.length;p++){var g=v[p];if(g.visible&&((d=g.work)===null||d===void 0?void 0:d.workCode)===f.work.workCode)return!0}return!1}),u=arrayMin(s,function(f){return f.standingPosition.distanceTo(o.point)},!0),l=u[0],c=u[1];return l&&c<10?l:null},t.prototype.coordinatesForOffset=function(e){var r=this.renderer.getSize(new THREE__namespace.Vector2);return{longitude:-2*e.x/(r.x*this.scissor.width),latitude:2*e.y/(r.y*this.scissor.height)}},t.prototype.requestMomentumMovement=function(e,r,o,s){var u=this;if(this.inMomentumMovement!==null){for(var l=__assign({},o),c={longitude:0,latitude:0},f=0;f<s;f++)l.longitude*=.996,l.latitude*=.996*.998,c.longitude+=l.longitude,c.latitude+=l.latitude;var d=formatRad(this.cameraMotion.value.longitude+c.longitude),p=clamp$1(this.cameraMotion.value.latitude+c.latitude,this.minLatitude,this.maxLatitude),v=__assign(__assign({},this.currentPano),{mode:this.mode,longitude:d,latitude:p,fov:this.cameraMotion.value.fov,offset:this.camera.pose.offset.clone(),distance:this.camera.pose.distance}),g=!(l.longitude>1e-4||l.longitude<-1e-4||l.latitude>1e-4||l.latitude<-1e-4),h=createEvent("gesture.momentum",__assign(__assign({},e),{isFirst:r,isFinal:g,state:v}));if(this.inMomentumMovement.event=h,this.emit("gesture.momentum",h),e.defaultPrevented){this.inMomentumMovement=null;return}this.inMomentumMovement&&(this.cameraMotion.set({longitude:d,latitude:p},0).catch(noop$1),g?this.inMomentumMovement=null:AnimationFrameLoop.shared.add(function(m,y){u.requestMomentumMovement(e,!1,l,y|0)},!0,1))}},t.prototype.onPanGesture=function(e){this.userAction=e.userAction,this.stopMomentumMovement(),this.hideIntersectMesh();var r=this.panState,o=e.pointers.length;if(e.isFinal?delete this.panState:this.panState={pointerLength:o,x:e.center.x,y:e.center.y},!(typeof r=="undefined"||r.pointerLength!==o)){var s={x:e.center.x-r.x,y:e.center.y-r.y},u=this.relativeClientPosition(e.center),l=this.camera.pose.latitude<Math.PI/6||u.y<0?1:-1;s.x*=l;var c=this.coordinatesForOffset(s),f=formatRad(this.cameraMotion.value.longitude+c.longitude),d=clamp$1(this.cameraMotion.value.latitude+c.latitude,this.minLatitude,this.maxLatitude);this.camera.aspect<1&&Math.abs(e.overallVelocityX)>.2&&Math.atan2(Math.abs(e.overallVelocityY),Math.abs(e.overallVelocityX))<Math.PI/6.923&&(d=this.cameraMotion.value.latitude);var p=__assign(__assign({},this.currentPano),{mode:this.mode,longitude:f,latitude:d,fov:this.camera.pose.fov,offset:this.camera.pose.offset,distance:this.camera.pose.distance});if(e.state=p,this.emit("gesture.pan",e),!e.defaultPrevented&&(this.cameraMotion.set({longitude:p.longitude,latitude:p.latitude},0).catch(noop$1),e.isFinal)){var v=e.velocityX*l,g=e.velocityY;this.inMomentumMovement={uuid:createUuid()},this.requestMomentumMovement(e,!0,this.coordinatesForOffset({x:v,y:g}),0)}}},t.prototype.onPinchGesture=function(e){var r;if(this.initAnimationIsReady){this.userAction=e.userAction,this.stopMomentumMovement();var o=(r=this.pinchState)===null||r===void 0?void 0:r.fov;if(e.isFirst){this.pinchState={x:e.center.x,y:e.center.y,fov:this.cameraMotion.value.fov};return}if(e.isFinal&&(delete this.panState,delete this.pinchState),typeof o!="undefined"){var s=clamp$1(o/e.scale,this.minFov,this.maxFov);e.state.fov=s,this.emit("gesture.pinch",e),!e.defaultPrevented&&(this.cameraMotion.set({fov:s},0).catch(noop$1),this.onPanGesture(e))}}},t.prototype.onMouseMove=function(e){var r,o;if(this.intersectMesh.parent&&!this.panState){if(this.emit("gesture.mousemove",e),e.defaultPrevented){this.hideIntersectMesh();return}var s=e.center.raycaster;if(e.isFinal&&this.intersectMesh.parent&&this.intersectMesh.visible===!0){this.hideIntersectMesh();return}var u=this.models.intersectRaycaster(s)[0],l=createEvent("intersect.update",{raycaster:s,intersection:u!=null?u:null,object:this.intersectMesh});if(this.emit("intersect.update",l),l.defaultPrevented){this.hideIntersectMesh();return}if(u){var c=(o=(r=u.face)===null||r===void 0?void 0:r.normal)!==null&&o!==void 0?o:new THREE__namespace.Vector3().copy(s.ray.direction).multiplyScalar(-1),f=c.clone(),d=u.point.clone();this.intersectMesh.position.copy(d);var p=s.ray.origin.distanceTo(d),v=2*Math.tan(.5*this.camera.fov/180*Math.PI),g=Math.max(p*v/10,1);this.intersectMesh.scale.set(g,g,g);var h=d.clone().add(f);if(this.intersectMesh.lookAt(h),Math.abs(c.y)>.99){var m=this.camera.position.clone().sub(d);this.intersectMesh.rotation.z=-Math.atan2(m.z,m.x)}this.intersectMesh.visible=!0,this.needsRender=!0}else this.hideIntersectMesh()}},t.prototype.onMouseWheel=function(e){if(this.initAnimationIsReady){this.userAction=e.userAction,this.stopMomentumMovement();var r=this,o=r.minFov,s=r.maxFov,u=clamp$1(this.camera.fov-e.center.delta,o,s);e.state.fov=u,this.emit("gesture.mousewheel",e),!e.defaultPrevented&&this.cameraMotion.set({fov:u},0).catch(noop$1)}},t.prototype.onTapGesture=function(e){var r=this;this.userAction=!0,this.stopMomentumMovement();var o=e.center.raycaster,s=this.getForwardObserverOrNot(o);if(!s)this.emit("gesture.tap",e);else{var u={longitude:this.camera.pose.longitude,latitude:0},l=__assign(__assign({},e.state),{mode:"Panorama",workCode:s.pano.workCode,panoIndex:s.pano.panoIndex,longitude:u.longitude,latitude:u.latitude,offset:s?s.position.clone():new THREE__namespace.Vector3,distance:0});if(e.state=l,this.emit("gesture.tap",e),!e.defaultPrevented&&(this.emit("pano.select",createEvent("pano.select",{prevPano:this.currentPano,state:l,userAction:e.userAction,options:u,progress:0,error:null})),s&&s.active)){var c=this.currentTapId=createUuid();this.preloadPano(s.pano).then(function(f){r.currentTapId===c&&r.emit("pano.request",createEvent("pano.request",{userAction:!0,prevPano:r.currentPano,progress:0,state:l,options:u,error:null}))})}}},t.prototype.onDblTapGesture=function(e){this.userAction=e.userAction,this.stopMomentumMovement();var r=this.cameraMotion.value.fov,o=this.minFov-r<r-this.defaultFov?this.minFov:this.defaultFov;e.state.fov=o,this.emit("gesture.dbltap",e),!e.defaultPrevented&&(this.cameraMotion.set({fov:o},360).catch(noop$1),this.hideIntersectMesh())},t.prototype.hideIntersectMesh=function(){this.intersectMesh.visible=!1,this.needsRender=!0},t}(BaseController),TopviewController=function(n){__extends(t,n);function t(e){var r=this,o=t.parseArgs(e);return r=n.call(this,o)||this,r.mode="Topview",r}return t.parseArgs=function(e){if(e instanceof t)return e;var r=__assign(__assign({},e),{defaultLongitude:0,defaultLatitude:Math.PI/2});return n.parseArgs.call(this,r)},t.initAnimationEndState=function(e){var r=this.parseArgs(e),o=n.initAnimationEndState.call(this,r);return __assign(__assign({},o),{longitude:r.defaultLongitude,latitude:r.defaultLatitude,mode:"Topview"})},t.prototype.updateModel=function(e){this.needsRender=!0,this.modelSceneNeedsRender=!0;var r=this.models.bounding.getCenter(new THREE__namespace.Vector3);this.locationMotion.set({x:r.x,y:r.y,z:r.z,distance:FloorplanController.distanceFromModel(this.models,this.defaultFov,this.camera.aspect)},0).catch(noop$1)},t.prototype.updateCamera=function(e,r,o){var s=this;return this.initAnimationReady.then(function(){s.userAction=o,s.stopMomentumMovement();var u={},l={};return e.distance!==void 0&&(u.distance=e.distance),e.offset!==void 0&&(u.x=e.offset.x,u.y=e.offset.y,u.z=e.offset.z),e.longitude!==void 0&&(l.longitude=e.longitude),e.latitude!==void 0&&(l.latitude=e.latitude),e.fov!==void 0&&(l.fov=e.fov),s.locationMotion.set(u,r).catch(noop$1),s.cameraMotion.set(l,r).catch(noop$1)})},t.prototype.updateCameraWithKeyframes=function(e,r,o){var s=this;return this.initAnimationReady.then(function(){s.userAction=o,s.stopMomentumMovement();for(var u=[],l=[],c=0,f=e;c<f.length;c++){var d=f[c];u.push({key:d.key,progress:d.progress,value:{distance:d.value.distance,x:d.value.offset.x,y:d.value.offset.y,z:d.value.offset.z}}),l.push({key:d.key,progress:d.progress,value:{longitude:d.value.longitude,latitude:d.value.latitude,fov:d.value.fov}})}return s.locationMotion.setKeyframes(u,r).catch(noop$1),s.cameraMotion.setKeyframes(e,r)})},t.prototype.initAnimation=function(){var e=this;return this.destroyed?Promise.resolve():new Promise(function(r){var o=e.initial;o.state,o.currentState;var s=o.duration,u=o.userAction;e.userAction=u;var l=t.initAnimationEndState(e),c={longitude:l.longitude,latitude:l.latitude,fov:l.fov},f={x:l.offset.x,y:l.offset.y,z:l.offset.z,distance:l.distance},d={modelAlpha:1},p={perspToOrtho:1};e.emit("initAnimation.start",createEvent("initAnimation.start",{state:l,userAction:e.userAction})),e.modelAlphaMotion.set(d,s/3).catch(noop$1),e.perspToOrthoMotion.set(p,s).catch(noop$1),e.cameraMotion.set(c,s).catch(noop$1),e.locationMotion.set(f,s).then(function(){e.emit("initAnimation.end",createEvent("initAnimation.end",{state:l,userAction:e.userAction}))},function(v){var g=__assign(__assign(__assign({},e.currentPano),{mode:e.mode}),clonePose(e.camera.pose));e.emit("initAnimation.end",createEvent("initAnimation.end",{state:g,userAction:e.userAction}))}).then(function(){r()})})},t.prototype.requestMomentumMovement=function(){this.inMomentumMovement=null},t.prototype.onPanGesture=function(e){this.userAction=e.userAction,this.stopMomentumMovement();var r=this.panState,o=e.pointers.length;if(e.isFinal?delete this.panState:this.panState={pointerLength:o,x:e.center.x,y:e.center.y},!(typeof r=="undefined"||r.pointerLength!==o)){var s={x:e.center.x-r.x,y:e.center.y-r.y},u=new THREE__namespace.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z),l=this.locationMotion.value.distance;l*=Math.tan(this.cameraMotion.value.fov/2*Math.PI/180);var c=this.renderer.getSize(new THREE__namespace.Vector2),f=2*s.x*l/c.y,d=2*s.y*l/c.y,p=new THREE__namespace.Vector3;p.setFromMatrixColumn(this.camera.matrix,0),p.multiplyScalar(-f),u.add(p),p.setFromMatrixColumn(this.camera.matrix,1),p.multiplyScalar(d),u.add(p),this.modelInScreen==="boundingbox-center"&&u.clamp(this.models.bounding.min,this.models.bounding.max);var v=__assign(__assign({},this.currentPano),{mode:this.mode,longitude:0,latitude:Math.PI/2,fov:this.cameraMotion.value.fov,offset:u,distance:this.locationMotion.value.distance});e.state=v,this.emit("gesture.pan",e),!e.defaultPrevented&&this.locationMotion.set({x:u.x,y:u.y,z:u.z},0).catch(noop$1)}},t.prototype.onPinchGesture=function(e){var r;if(this.initAnimationIsReady){this.userAction=e.userAction,this.stopMomentumMovement();var o=(r=this.pinchState)===null||r===void 0?void 0:r.fov;if(e.isFirst){this.pinchState={x:e.center.x,y:e.center.y,fov:this.cameraMotion.value.fov};return}if(e.isFinal&&delete this.pinchState,typeof o!="undefined"){var s=clamp$1(o/e.scale,this.minFov,this.maxFov);e.state.fov=s,this.emit("gesture.pinch",e),!e.defaultPrevented&&(this.cameraMotion.set({fov:s},0).catch(noop$1),e.type="gesture.pan",this.onPanGesture(e))}}},t.prototype.onMouseWheel=function(e){if(this.initAnimationIsReady){this.userAction=e.userAction,this.stopMomentumMovement();var r=clamp$1(this.cameraMotion.value.fov-e.center.delta,this.minFov,this.maxFov);e.state.fov=r,this.emit("gesture.mousewheel",e),!e.defaultPrevented&&this.cameraMotion.set({fov:r},0).catch(noop$1)}},t}(FloorplanController),PanoramaLikeController=function(n){__extends(t,n);function t(e){var r=this,o=t.parseArgs(e);return r=n.call(this,o)||this,r.mode="PanoramaLike",r.defaultLatitude=o.defaultLatitude,r.defaultFov=o.defaultFov,r.maxFov=o.maxFov,r.minFov=o.minFov,r.maxLatitude=o.maxLatitude,r.minLatitude=o.minLatitude,r.moveSpeed=o.moveSpeed,r.intersectMeshCreator=o.intersectMeshCreator,r.intersectMesh=r.intersectMeshCreator(),r.intersectMesh.name="intersect",r.intersectMesh.visible=!1,r.helper.add(r.intersectMesh),r}return t.parseArgs=function(e){var r,o,s,u,l,c,f,d;if(e instanceof t)return e;var p=n.parseArgs.call(this,e);return __assign(__assign({},p),{defaultLatitude:(r=e.defaultLatitude)!==null&&r!==void 0?r:0,defaultFov:(o=e.defaultFov)!==null&&o!==void 0?o:90,maxFov:(s=e.maxFov)!==null&&s!==void 0?s:120,minFov:(u=e.minFov)!==null&&u!==void 0?u:20,maxLatitude:(l=e.maxLatitude)!==null&&l!==void 0?l:+Math.PI/2,minLatitude:(c=e.minLatitude)!==null&&c!==void 0?c:-Math.PI/2,moveSpeed:(f=e.moveSpeed)!==null&&f!==void 0?f:3.4,intersectMeshCreator:(d=e.intersectMeshCreator)!==null&&d!==void 0?d:function(){return new IntersectMesh}})},t.initAnimationEndState=function(e){var r,o,s,u,l,c,f=this.parseArgs(e),d=f.works,p=e.initial,v=p.state,g=p.currentState,h=typeof v.panoIndex=="number"?{workCode:(s=(r=v.workCode)!==null&&r!==void 0?r:(o=f.works[0])===null||o===void 0?void 0:o.workCode)!==null&&s!==void 0?s:"",panoIndex:v.panoIndex}:{workCode:g.workCode,panoIndex:g.panoIndex},m=d.getResolvedObserver(h),y=(u=v.longitude)!==null&&u!==void 0?u:g.longitude,A=clamp$1((l=v.latitude)!==null&&l!==void 0?l:isFristPersonMode(g.mode)?g.latitude:f.defaultLatitude,f.minLatitude,f.maxLatitude),E=clamp$1((c=v.fov)!==null&&c!==void 0?c:isFristPersonMode(g.mode)?g.fov:f.defaultFov,f.minFov,f.maxFov),b=m?m.position.clone():new THREE__namespace.Vector3;return{workCode:h.workCode,panoIndex:h.panoIndex,mode:"PanoramaLike",longitude:y,latitude:A,fov:E,offset:b,distance:0}},t.prototype.destroy=function(){n.prototype.destroy.call(this),this.intersectMesh&&(this.helper.remove(this.intersectMesh),this.intersectMesh.dispose()),delete this.panState},t.prototype.isReady=function(){return this.panState||this.pinchState?!1:n.prototype.isReady.call(this)},t.prototype.calculateMovingDuration=function(e,r){switch(typeof e){case"function":return e(r,this.moveSpeed);case"number":return e;case"string":return Number(e);default:return clamp$1(r,2,5)/this.moveSpeed*1e3}},t.prototype.hideIntersectMesh=function(){this.intersectMesh.visible=!1,this.needsRender=!0},t.prototype.coordinatesForOffset=function(e){var r=this.cameraMotion.value.fov,o=this.camera.aspect,s=this.renderer.getSize(new THREE__namespace.Vector2);return{longitude:2*e.x/(s.x*this.scissor.width)*r/95*o,latitude:-2*e.y/(s.y*this.scissor.height)*r/95}},t.prototype.cameraBounce=function(){var e=this.cameraMotion.value,r=e.longitude,o=e.latitude,s=e.fov,u=[{progress:0,value:{longitude:r,latitude:o,fov:s}},{progress:.5,value:{longitude:r,latitude:o,fov:s*.98}},{progress:1,value:{longitude:r,latitude:o,fov:s}}];this.cameraMotion.setKeyframes(u,500).catch(noop$1)},t.prototype.requestMomentumMovement=function(e,r,o,s){var u=this;if(this.inMomentumMovement!==null){for(var l=__assign({},o),c={longitude:0,latitude:0},f=0;f<s;f++)l.longitude*=.996,l.latitude*=.996*.99,c.longitude+=l.longitude,c.latitude+=l.latitude;var d=formatRad(this.cameraMotion.value.longitude+c.longitude),p=clamp$1(this.cameraMotion.value.latitude+c.latitude,this.minLatitude,this.maxLatitude),v=__assign(__assign({},this.currentPano),{mode:this.mode,longitude:d,latitude:p,fov:this.cameraMotion.value.fov,offset:this.camera.pose.offset.clone(),distance:this.camera.pose.distance}),g=!(l.longitude>1e-4||l.longitude<-1e-4||l.latitude>1e-4||l.latitude<-1e-4),h=createEvent("gesture.momentum",__assign(__assign({},e),{isFirst:r,isFinal:g,state:v}));if(this.inMomentumMovement.event=h,this.emit("gesture.momentum",h),e.defaultPrevented){this.inMomentumMovement=null;return}this.inMomentumMovement&&(this.cameraMotion.set({longitude:d,latitude:p},0).catch(noop$1),g?this.inMomentumMovement=null:AnimationFrameLoop.shared.add(function(m,y){u.requestMomentumMovement(e,!1,l,y|0)},!0,1))}},t.prototype.onPanGesture=function(e){this.userAction=e.userAction,this.stopMomentumMovement(),this.hideIntersectMesh();var r=this.panState,o=e.pointers.length;if(e.isFinal?delete this.panState:this.panState={pointerLength:o,x:e.center.x,y:e.center.y},!(typeof r=="undefined"||r.pointerLength!==o)){var s={x:e.center.x-r.x,y:e.center.y-r.y},u=this.coordinatesForOffset(s),l=formatRad(this.cameraMotion.value.longitude+u.longitude),c=clamp$1(this.cameraMotion.value.latitude+u.latitude,this.minLatitude,this.maxLatitude);this.camera.aspect<1&&Math.abs(e.overallVelocityX)>.2&&Math.atan2(Math.abs(e.overallVelocityY),Math.abs(e.overallVelocityX))<Math.PI/6.923&&(c=this.cameraMotion.value.latitude);var f=__assign(__assign({},this.currentPano),{mode:this.mode,longitude:l,latitude:c,fov:this.cameraMotion.value.fov,offset:this.camera.pose.offset.clone(),distance:this.camera.pose.distance});if(e.state=f,this.emit("gesture.pan",e),!e.defaultPrevented){var d={longitude:f.longitude,latitude:f.latitude,fov:f.fov};if(this.cameraMotion.set(d,0).catch(noop$1),e.isFinal){var p=e.velocityX,v=e.velocityY*.6;Math.abs(v)>.5&&Math.abs(p)<.5&&(p=0),this.inMomentumMovement={uuid:createUuid()},this.requestMomentumMovement(e,!0,this.coordinatesForOffset({x:p,y:v}),0)}}}},t.prototype.onPinchGesture=function(e){var r;this.userAction=e.userAction,this.stopMomentumMovement();var o=(r=this.pinchState)===null||r===void 0?void 0:r.fov,s=e.scale;if(e.isFirst){this.pinchState={x:e.center.x,y:e.center.y,fov:this.cameraMotion.value.fov};return}if(e.isFinal&&delete this.pinchState,typeof o!="undefined"){var u=clamp$1(o/s,this.minFov,this.maxFov);e.state.fov=u,this.emit("gesture.pinch",e),!e.defaultPrevented&&(this.cameraMotion.set({fov:u},0).catch(noop$1),e.type="gesture.pan",this.onPanGesture(e))}},t.prototype.onMouseWheel=function(e){this.userAction=e.userAction,this.stopMomentumMovement();var r=clamp$1(this.cameraMotion.value.fov-e.center.delta,this.minFov,this.maxFov);e.state.fov=r,this.emit("gesture.mousewheel",e),!e.defaultPrevented&&(this.cameraMotion.set({fov:r},0).catch(noop$1),this.onMouseMove(e))},t.prototype.onMouseMove=function(e){var r,o;if(this.intersectMesh.parent&&!this.panState&&(this.emit("gesture.mousemove",e),!e.defaultPrevented)){var s=e.center.raycaster;if(e.isFinal&&this.intersectMesh.parent){this.hideIntersectMesh();return}var u=this.models.intersectRaycaster(s)[0],l=createEvent("intersect.update",{raycaster:s,intersection:u!=null?u:null,object:this.intersectMesh});if(this.emit("intersect.update",l),l.defaultPrevented){this.hideIntersectMesh();return}if(u){var c=(o=(r=u.face)===null||r===void 0?void 0:r.normal)!==null&&o!==void 0?o:new THREE__namespace.Vector3().copy(s.ray.direction).multiplyScalar(-1),f=c.clone(),d=u.point.clone();this.intersectMesh.position.copy(d);var p=d.clone().add(f);if(this.intersectMesh.lookAt(p),Math.abs(c.y)>.99){var v=this.camera.position.clone().sub(d);this.intersectMesh.rotation.z=-Math.atan2(v.z,v.x)}this.intersectMesh.visible=!0,this.needsRender=!0}else this.hideIntersectMesh()}},t.prototype.onDblTapGesture=function(e){this.userAction=e.userAction,this.stopMomentumMovement();var r=this.cameraMotion.value.fov,o=2,s=this.works.getResolvedObserver(this.currentPano);if(s){var u=s.images.tiles;u&&u.length&&(o=Math.max.apply(Math,u.map(function(f){return f.level})))}var l=Math.max(40-o*5,this.minFov,5),c=l-r<r-this.defaultFov?l:this.defaultFov;e.state.fov=c,this.emit("gesture.dbltap",e),!e.defaultPrevented&&(this.cameraMotion.set({fov:c},360).catch(noop$1),this.hideIntersectMesh())},t}(BaseController),blankVideo="data:video/mp4;base64,AAAAHGZ0eXBNNFYgAAACAGlzb21pc28yYXZjMQAAAAhmcmVlAAAGF21kYXTeBAAAbGliZmFhYyAxLjI4AABCAJMgBDIARwAAArEGBf//rdxF6b3m2Ui3lizYINkj7u94MjY0IC0gY29yZSAxNDIgcjIgOTU2YzhkOCAtIEguMjY0L01QRUctNCBBVkMgY29kZWMgLSBDb3B5bGVmdCAyMDAzLTIwMTQgLSBodHRwOi8vd3d3LnZpZGVvbGFuLm9yZy94MjY0Lmh0bWwgLSBvcHRpb25zOiBjYWJhYz0wIHJlZj0zIGRlYmxvY2s9MTowOjAgYW5hbHlzZT0weDE6MHgxMTEgbWU9aGV4IHN1Ym1lPTcgcHN5PTEgcHN5X3JkPTEuMDA6MC4wMCBtaXhlZF9yZWY9MSBtZV9yYW5nZT0xNiBjaHJvbWFfbWU9MSB0cmVsbGlzPTEgOHg4ZGN0PTAgY3FtPTAgZGVhZHpvbmU9MjEsMTEgZmFzdF9wc2tpcD0xIGNocm9tYV9xcF9vZmZzZXQ9LTIgdGhyZWFkcz02IGxvb2thaGVhZF90aHJlYWRzPTEgc2xpY2VkX3RocmVhZHM9MCBucj0wIGRlY2ltYXRlPTEgaW50ZXJsYWNlZD0wIGJsdXJheV9j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mNTUuMzMuMTAw",result;function canplayVideo(){return result||(result=new Promise(function(n){var t,e=document.createElement("video");e.muted=!0,e.src=blankVideo,e.addEventListener("timeupdate",function r(){e.removeEventListener("timeupdate",r,!1),clearTimeout(t);var o=document.createElement("canvas");o.width=o.height=1;var s=o.getContext("2d");if(!s){n(!1);return}s.drawImage(e,0,0,1,1);var u=s.getImageData(0,0,1,1).data;u[3]>10?n(!0):n(!1)},!1),e.addEventListener("canplay",function r(){e.removeEventListener("canplay",r,!1),e.play()},!1),t=window.setTimeout(function(){return n(!1)},1e3)}))}var FRAGMENT=`
|
|
1477
|
+
`,camera$1=new THREE__namespace.OrthographicCamera(-1,1,1,-1,0,1),geometry$4=new THREE__namespace.BufferGeometry;geometry$4.setAttribute("position",new THREE__namespace.Float32BufferAttribute([-1,3,0,-1,-1,0,3,-1,0],3)),geometry$4.setAttribute("uv",new THREE__namespace.Float32BufferAttribute([0,2,0,0,2,0],2));var noneMaterial=new THREE__namespace.MeshBasicMaterial,mesh$3=new THREE__namespace.Mesh(geometry$4,noneMaterial),scene$1=new THREE__namespace.Scene;scene$1.add(mesh$3);var DepthCopyPass=function(){function n(t){this.renderer=t,this.material=new THREE__namespace.ShaderMaterial({vertexShader:VERTEX,fragmentShader:FRAGMENT$1,uniforms:Object.assign({depthBuffer:new THREE__namespace.Uniform(null)}),blending:THREE__namespace.NoBlending,depthWrite:!0,depthTest:!0}),this.renderer.getContext()&&this.renderer.getContext()instanceof WebGLRenderingContext&&(this.material.extensions.fragDepth=!0)}return n.prototype.render=function(t,e){var r=this.renderer.getRenderTarget();this.material.uniforms.depthBuffer.value=t,mesh$3.material=this.material,this.renderer.setRenderTarget(e||null),this.renderer.render(scene$1,camera$1),this.renderer.setRenderTarget(r),mesh$3.material=noneMaterial},n.prototype.dispose=function(){this.material.dispose()},n}(),sharedVector2$1=new THREE__namespace.Vector2,BaseController=function(n){__extends(t,n);function t(e){var r,o,s,u,l,c,f=n.call(this)||this,d=t.parseArgs(e);f.mode="",f.pending=new Set,f.userAction=d.initial.userAction,f.destroyed=!1,f.ident=d.ident,f.scene=d.scene,f.xrCustomObjectsScene=d.xrCustomObjectsScene,f.helper=d.helper,f.boundingMesh=d.boundingMesh,f.camera=d.camera,f.renderer=d.renderer,f.scissor=d.scissor,f.element=d.element,f.models=d.models,f.enableWheel=d.enableWheel,f.enableIOSEDR=(r=d.enableIOSEDR)!==null&&r!==void 0?r:!1,f.enableEDL=(o=d.enableEDL)!==null&&o!==void 0?o:!0,f.enableHQ=(s=d.enableHQ)!==null&&s!==void 0?s:!0,f.works=d.works,f.imageOptions=d.imageOptions,f.videoTexture=d.videoTexture,f.extraElements=d.extraElements,f.initial=d.initial,f.currentPano=typeof f.initial.state.panoIndex=="number"?{workCode:(c=(u=f.initial.state.workCode)!==null&&u!==void 0?u:(l=d.works[0])===null||l===void 0?void 0:l.workCode)!==null&&c!==void 0?c:"",panoIndex:f.initial.state.panoIndex}:{workCode:f.initial.currentState.workCode,panoIndex:f.initial.currentState.panoIndex},f.needsRender=!0,f.modelSceneNeedsRender=!0,f.cameraMotion=new Motion({longitude:{value:f.camera.pose.longitude,circle:[0,Math.PI*2]},latitude:f.camera.pose.latitude,fov:f.camera.pose.fov}),f.inMomentumMovement=null,f.eventUnbinds=[d.element].concat(d.extraElements||[]).map(function(v){return f.bindEvents(v)}),f.pending.add("init-animation"),f.initAnimationReady=new Promise(function(v){AnimationFrameLoop.shared.add(function(){f.initAnimation().then(function(){f.pending.delete("init-animation"),v()})},!0)}),f.initAnimationIsReady=!1,f.initAnimationReady.then(function(){return f.initAnimationIsReady=!0}),f.modelScene=d.modelScene;var p=new THREE__namespace.Vector2;return f.renderer.getDrawingBufferSize(p),f.modelRenderTarget=d.modelRenderTarget,f.copyPass=new CopyPass(f.renderer),f.depthCopyPass=new DepthCopyPass(f.renderer),f.screenBuffers=[],f.lastPostProcessingType=null,f}return t.parseArgs=function(e){return e instanceof t?e:__assign({},e)},t.initAnimationEndState=function(e){var r,o,s,u,l,c,f,d,p=this.parseArgs(e),v=p.initial,g=v.state,h=v.currentState,m=typeof g.panoIndex=="number"?{workCode:(s=(r=g.workCode)!==null&&r!==void 0?r:(o=p.works[0])===null||o===void 0?void 0:o.workCode)!==null&&s!==void 0?s:"",panoIndex:g.panoIndex}:{workCode:h.workCode,panoIndex:h.panoIndex};return __assign(__assign({},m),{mode:"",longitude:(u=g.longitude)!==null&&u!==void 0?u:h.longitude,latitude:(l=g.latitude)!==null&&l!==void 0?l:h.latitude,fov:(c=g.fov)!==null&&c!==void 0?c:h.fov,offset:(f=g.offset)!==null&&f!==void 0?f:h.offset,distance:(d=g.distance)!==null&&d!==void 0?d:h.distance})},t.prototype.destroy=function(){var e;this.stopMomentumMovement(),this.destroyed=!0,this.off(),this.cameraMotion.dispose();for(var r=0,o=this.eventUnbinds;r<o.length;r++){var s=o[r];s()}this.copyEffect&&(this.copyEffect.dispose(),delete this.copyEffect),delete this.panState,(e=this.pressState)===null||e===void 0||e.stop(),delete this.pressState},t.prototype.isReady=function(){return this.inMomentumMovement===null&&this.pending.size===0&&this.cameraMotion.ended===!0},t.prototype.bindExtraElement=function(e){for(var r=0,o=this.eventUnbinds;r<o.length;r++){var s=o[r];if(s.element===e)return}this.eventUnbinds.push(this.bindEvents(e))},t.prototype.unbindExtraElement=function(e){for(var r=[],o=0,s=this.eventUnbinds;o<s.length;o++){var u=s[o];u.element===e?u():r.push(u)}this.eventUnbinds=r},t.prototype.updateRenderSize=function(e){this.needsRender=!0,this.modelSceneNeedsRender=!0,this.modelRenderTarget.setSize(e.x,e.y),this.screenBuffers.forEach(function(r){r.setSize(e.x,e.y)})},t.prototype.updateModel=function(e){this.needsRender=!0,this.modelSceneNeedsRender=!0},t.prototype.updateWork=function(e,r,o,s){return this.works=e,this.userAction=s,!1},t.prototype.updateTime=function(e,r){if(!this.destroyed){var o={};this.cameraMotion.ended&&(this.cameraMotion.update(e),o.longitude=this.cameraMotion.value.longitude,o.latitude=this.cameraMotion.value.latitude,o.fov=this.cameraMotion.value.fov),isEmptyObject(o)&&this.setCamera(o)}},t.prototype.render=function(e,r){var o=this.renderer.getRenderTarget();this.updateScreenBuffer(r),e&&(this.renderer.setRenderTarget(this.modelRenderTarget),this.renderer.render(this.modelScene,this.camera)),this.depthCopyPass.render(this.modelRenderTarget.depthTexture,o),this.renderer.autoClearDepth=!1,this.renderer.autoClearColor=!0,this.copyPass.render(this.modelRenderTarget,o),this.renderer.setRenderTarget(o),this.renderer.autoClearColor=!1,this.renderer.autoClearDepth=!1,this.renderer.render(this.scene,this.camera),this.renderer.autoClearColor=!0,this.renderer.autoClearDepth=!0},t.prototype.postProcessing=function(e,r){this.destroyed},t.prototype.updateCamera=function(e,r,o){var s=this;return this.initAnimationReady.then(function(){s.userAction=o,s.stopMomentumMovement();var u={};return e.longitude!==void 0&&(u.longitude=e.longitude),e.latitude!==void 0&&(u.latitude=e.latitude),e.fov!==void 0&&(u.fov=e.fov),s.cameraMotion.set(u,r).catch(noop$1)})},t.prototype.updateCameraWithKeyframes=function(e,r,o){var s=this;return this.initAnimationReady.then(function(){s.userAction=o,s.stopMomentumMovement();for(var u=[],l=0,c=e;l<c.length;l++){var f=c[l];u.push({key:f.key,progress:f.progress,value:{longitude:f.value.longitude,latitude:f.value.latitude,fov:f.value.fov}})}return s.cameraMotion.setKeyframes(u,r)})},t.prototype.getTargetState=function(){var e=this.cameraMotion.getKeyFrameSegment(now())[1];return __assign(__assign({},this.currentPano),{mode:this.mode,longitude:e.value.longitude,latitude:e.value.latitude,fov:e.value.fov,offset:this.camera.pose.offset.clone(),distance:this.camera.pose.distance})},t.prototype.initAnimation=function(){var e=this.initial;e.state,e.currentState,e.duration;var r=e.userAction,o=t.initAnimationEndState(this);return this.userAction=r,this.emit("initAnimation.start",createEvent("initAnimation.start",{state:o,userAction:this.userAction})),this.emit("initAnimation.end",createEvent("initAnimation.end",{state:o,userAction:this.userAction})),Promise.resolve()},t.prototype.setCamera=function(e){var r,o,s,u,l;e===void 0&&(e={});var c=(r=e.longitude)!==null&&r!==void 0?r:this.camera.pose.longitude,f=(o=e.latitude)!==null&&o!==void 0?o:this.camera.pose.latitude,d=(s=e.fov)!==null&&s!==void 0?s:this.camera.pose.fov,p=(u=e.distance)!==null&&u!==void 0?u:this.camera.pose.distance,v=(l=e.offset)!==null&&l!==void 0?l:this.camera.pose.offset,g=notSimilarValue(c,this.camera.pose.longitude,Math.PI*2)||notSimilarValue(f,this.camera.pose.latitude),h=notSimilarValue(d,this.camera.pose.fov),m=notSimilarValue(p,this.camera.pose.distance),y=notSimilarVector3(v,this.camera.pose.offset);(h||g||y||m)&&(this.camera.setFromPose({longitude:c,latitude:f,fov:d,distance:p,offset:v}),this.emit("camera.update",createEvent("camera.update",{userAction:this.userAction,state:__assign(__assign({},this.currentPano),{mode:this.mode,longitude:c,latitude:f,fov:d,offset:v,distance:p})})),this.needsRender=!0,this.modelSceneNeedsRender=!0)},t.prototype.stopMomentumMovement=function(){if(this.inMomentumMovement&&this.inMomentumMovement.event&&!this.inMomentumMovement.event.defaultPrevented&&!this.inMomentumMovement.event.isFinal){var e=createEvent("gesture.momentum",__assign(__assign({},this.inMomentumMovement.event),{isFirst:!1,isFinal:!0}));this.emit("gesture.momentum",e)}this.inMomentumMovement=null},t.prototype.onPanGesture=function(e){this.stopMomentumMovement(),this.emit("gesture.pan",e)},t.prototype.onTapGesture=function(e){this.stopMomentumMovement(),this.emit("gesture.tap",e)},t.prototype.onDblTapGesture=function(e){this.stopMomentumMovement(),this.emit("gesture.dbltap",e),!e.defaultPrevented&&(e.type="gesture.tap",this.onTapGesture(e))},t.prototype.onPressGesture=function(e){this.stopMomentumMovement(),this.emit("gesture.press",e)},t.prototype.onPinchGesture=function(e){this.stopMomentumMovement(),this.emit("gesture.pinch",e)},t.prototype.onMouseWheel=function(e){this.stopMomentumMovement(),this.emit("gesture.mousewheel",e)},t.prototype.onMouseMove=function(e){this.stopMomentumMovement(),this.emit("gesture.mousemove",e)},t.prototype.relativeClientPosition=function(e){return calculateThreeMouse(e,this.element,this.scissor)},t.prototype.bindEvents=function(e){var r=this,o=function(w){var C=calculateThreeMouse(w,r.element,r.scissor);return!(Math.abs(C.x)>1||Math.abs(C.y)>1)},s=new Hammer.Manager(e),u=function(w){var C=w.session;return C.firstInput||null},l=new Hammer.Pan({threshold:10,pointers:0}),c=new Hammer.Tap({interval:410}),f=new Hammer.Pinch({threshold:0,pointers:2});s.add([l,c,f]),s.on("panstart pan",function(w){var C=u(s);if(!(C&&!o(C.center))){var L=createEvent("gesture.pan",{target:w.target,pointerType:w.pointerType,srcEvent:w.srcEvent,pointers:w.pointers.map(function(I){var F=r.relativeClientPosition(I),k=new THREE__namespace.Raycaster;return k.params.Points={threshold:.1},k.setFromCamera(F,r.camera),{x:I.x,y:I.y,delta:0,buttons:0,coords:F,raycaster:k}}),isFirst:w.isFirst,isFinal:w.isFinal,scale:w.scale,center:function(I){var F=r.relativeClientPosition(I),k=new THREE__namespace.Raycaster;return k.params.Points={threshold:.1},k.setFromCamera(F,r.camera),{x:I.x,y:I.y,delta:0,buttons:0,coords:F,raycaster:k}}(w.center),velocityX:w.velocityX,velocityY:w.velocityY,overallVelocityX:w.overallVelocityX,overallVelocityY:w.overallVelocityY,userAction:!0,state:__assign(__assign({mode:r.mode},r.currentPano),clonePose(r.camera.pose))});r.onPanGesture(L),b()}}),s.on("tap",function(w){if(!(w.pointerType==="mouse"&&w.srcEvent.button!==0)){var C=u(s);if(!(C&&!o(C.center))){var L=createEvent("gesture.tap",{target:w.target,pointerType:w.pointerType,srcEvent:w.srcEvent,pointers:w.pointers.map(function(I){var F=r.relativeClientPosition(I),k=new THREE__namespace.Raycaster;return k.params.Points={threshold:.1},k.setFromCamera(F,r.camera),{x:I.x,y:I.y,delta:0,buttons:0,coords:F,raycaster:k}}),isFirst:!0,isFinal:!0,scale:w.scale,center:function(I){var F=r.relativeClientPosition(I),k=new THREE__namespace.Raycaster;return k.params.Points={threshold:.1},k.setFromCamera(F,r.camera),{x:I.x,y:I.y,delta:0,buttons:0,coords:F,raycaster:k}}(w.center),velocityX:w.velocityX,velocityY:w.velocityY,overallVelocityX:w.overallVelocityX,overallVelocityY:w.overallVelocityY,userAction:!0,state:__assign(__assign({mode:r.mode},r.currentPano),clonePose(r.camera.pose))});r.onTapGesture(L),b()}}}),s.on("pinchstart pinch pinchend",function(w){var C=u(s);if(!(C&&!o(C.center))){var L=createEvent("gesture.pinch",{target:w.target,pointerType:w.pointerType,srcEvent:w.srcEvent,pointers:w.pointers.map(function(I){var F,k=r.relativeClientPosition(I),N=new THREE__namespace.Raycaster;return N.params.Points={threshold:.1},N.setFromCamera(k,r.camera),{x:I.x,y:I.y,delta:(F=I.delta)!==null&&F!==void 0?F:0,buttons:0,coords:k,raycaster:N}}),isFirst:w.type==="pinchstart",isFinal:w.type==="pinchend",scale:w.scale,center:function(I){var F=r.relativeClientPosition(I),k=new THREE__namespace.Raycaster;return k.params.Points={threshold:.1},k.setFromCamera(F,r.camera),{x:I.x,y:I.y,delta:0,buttons:0,coords:F,raycaster:k}}(w.center),velocityX:w.velocityX,velocityY:w.velocityY,overallVelocityX:w.overallVelocityX,overallVelocityY:w.overallVelocityY,userAction:!0,state:__assign(__assign({mode:r.mode},r.currentPano),clonePose(r.camera.pose))});r.onPinchGesture(L),b()}}),s.on("dbltap",function(w){if(!(w.pointerType==="mouse"&&w.srcEvent.button!==0)){var C=u(s);if(!(C&&!o(C.center))){var L=createEvent("gesture.dbltap",{target:w.target,pointerType:w.pointerType,srcEvent:w.srcEvent,pointers:w.pointers.map(function(I){var F=r.relativeClientPosition(I),k=new THREE__namespace.Raycaster;return k.params.Points={threshold:.1},k.setFromCamera(F,r.camera),{x:I.x,y:I.y,delta:0,buttons:0,coords:F,raycaster:k}}),isFirst:!0,isFinal:!0,scale:w.scale,center:function(I){var F=r.relativeClientPosition(I),k=new THREE__namespace.Raycaster;return k.params.Points={threshold:.1},k.setFromCamera(F,r.camera),{x:I.x,y:I.y,delta:0,buttons:0,coords:F,raycaster:k}}(w.center),velocityX:w.velocityX,velocityY:w.velocityY,overallVelocityX:w.overallVelocityX,overallVelocityY:w.overallVelocityY,userAction:!0,state:__assign(__assign({mode:r.mode},r.currentPano),clonePose(r.camera.pose))});r.onDblTapGesture(L),b()}}});var d=null,p=null,v=function(w,C,L){var I={x:L.clientX,y:L.clientY},F=r.relativeClientPosition(I),k=new THREE__namespace.Raycaster;k.params.Points={threshold:.1},k.setFromCamera(F,r.camera);var N=__assign(__assign({},I),{coords:F,raycaster:k,buttons:L.buttons,delta:0}),D=w==="pinchend"?C:C-L.deltaY/280,U=createEvent("gesture.pinch",{target:L.target,pointerType:"mouse",srcEvent:L,pointers:[__assign({},N)],isFirst:w==="pinchstart",isFinal:w==="pinchend",scale:clamp$1(D,.1,10),center:__assign({},N),velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0,userAction:!0,state:__assign(__assign({mode:r.mode},r.currentPano),clonePose(r.camera.pose))});return U},g=function(w){var C,L={x:w.clientX,y:w.clientY};if(o(L)){if(w.preventDefault(),w.ctrlKey){var I=(C=d==null?void 0:d.prevEvent.scale)!==null&&C!==void 0?C:1,F=v(d?"pinch":"pinchstart",I,w);d===null?d={firstEvent:F,prevEvent:F}:d.prevEvent=F,r.onPinchGesture(F),p!==null&&window.clearTimeout(p),p=window.setTimeout(function(){var q;p=null;var K=(q=d==null?void 0:d.prevEvent.scale)!==null&&q!==void 0?q:1,j=v("pinchend",K,w);d=null,r.onPinchGesture(j)},200)}else{var k=(Math.abs(w.deltaY)>Math.abs(w.deltaX)?w.deltaY:w.deltaX)/-60,N=r.mouseWheelState!==void 0,D={x:w.clientX,y:w.clientY},U=r.relativeClientPosition(D),z=new THREE__namespace.Raycaster;z.params.Points={threshold:.1},z.setFromCamera(U,r.camera);var G=__assign(__assign({},D),{coords:U,raycaster:z,buttons:w.buttons,delta:k}),F=createEvent("gesture.mousewheel",{target:w.target,pointerType:"mouse",srcEvent:w,pointers:[__assign({},G)],isFirst:N,isFinal:!1,scale:0,center:__assign({},G),velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0,userAction:!0,state:__assign(__assign({mode:r.mode},r.currentPano),clonePose(r.camera.pose))});r.onMouseWheel(F),r.mouseWheelState&&clearTimeout(r.mouseWheelState.timer),r.mouseWheelState={timer:setTimeout(function(){delete r.mouseWheelState;var K=createEvent("gesture.mousewheel",{target:w.target,pointerType:"mouse",srcEvent:w,pointers:[__assign(__assign({},G),{delta:0})],isFirst:!1,isFinal:!0,scale:0,center:__assign(__assign({},G),{delta:0}),velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0,userAction:!0,state:__assign(__assign({mode:r.mode},r.currentPano),clonePose(r.camera.pose))});r.onMouseWheel(K)},100)}}b()}},h=function(w){if(!isMobile){if(!o({x:w.clientX,y:w.clientY})){m();return}var C=!1;r.mouseMoveState||(C=!0);var L={x:w.clientX,y:w.clientY},I=r.relativeClientPosition(L),F=new THREE__namespace.Raycaster;F.params.Points={threshold:.1},F.setFromCamera(I,r.camera);var k=__assign(__assign({},L),{coords:I,raycaster:F,buttons:w.buttons,delta:0}),N=createEvent("gesture.mousemove",{target:w.target,pointerType:"mouse",srcEvent:w,pointers:[__assign({},k)],isFirst:C,isFinal:!1,scale:0,center:__assign({},k),velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0,userAction:!0,state:__assign(__assign({mode:r.mode},r.currentPano),clonePose(r.camera.pose))});r.mouseMoveState={timeStamp:now(),event:N},r.onMouseMove(N),r.pressState&&Math.abs(w.clientX-r.pressState.event.center.y)>10&&Math.abs(w.clientY-r.pressState.event.center.y)>10&&b()}},m=function(){if(r.mouseMoveState){var w=createEvent(r.mouseMoveState.event.type,__assign(__assign({},r.mouseMoveState.event),{isFinal:!0}));delete r.mouseMoveState,r.onMouseMove(w)}b()},y=function(w){if(!o(w.center)){b();return}var C=!1;r.pressState||(C=!0,r.pressState={event:w,timeStamp:now(),stop:noop$1});var L=now()-r.pressState.timeStamp,I=createEvent(r.pressState.event.type,__assign(__assign({},r.pressState.event),{isFirst:C,isFinal:!1,center:__assign(__assign({},r.pressState.event.center),{delta:L}),pointers:r.pressState.event.pointers.map(function(F){return __assign(__assign({},F),{delta:L})})}));r.onPressGesture(I),r.pressState&&(r.pressState.stop=AnimationFrameLoop.shared.add(function(F){y(w)},!0,1))},A=function(w){if(b(),!(w.touches.length>1||w.changedTouches.length<=0)){var C={x:w.changedTouches[0].clientX,y:w.changedTouches[0].clientY},L=r.relativeClientPosition(C),I=new THREE__namespace.Raycaster;I.params.Points={threshold:.1},I.setFromCamera(L,r.camera);var F=__assign(__assign({},C),{coords:L,raycaster:I,buttons:0,delta:0}),k=createEvent("gesture.press",{target:w.target,pointerType:"touch",srcEvent:w,pointers:[__assign({},F)],isFirst:!1,isFinal:!1,scale:0,center:F,velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0,userAction:!0,state:__assign(__assign({mode:r.mode},r.currentPano),clonePose(r.camera.pose))});y(k)}},E=function(w){b();var C={x:w.clientX,y:w.clientY},L=r.relativeClientPosition(C),I=new THREE__namespace.Raycaster;I.params.Points={threshold:.1},I.setFromCamera(L,r.camera);var F=__assign(__assign({},C),{coords:L,raycaster:I,buttons:w.buttons,delta:0}),k=createEvent("gesture.press",{target:w.target,pointerType:"mouse",srcEvent:w,pointers:[__assign({},F)],isFirst:!1,isFinal:!1,scale:0,center:F,velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0,userAction:!0,state:__assign(__assign({mode:r.mode},r.currentPano),clonePose(r.camera.pose))});y(k)},b=function(){var w;if(r.pressState){var C=now()-r.pressState.timeStamp,L=createEvent(r.pressState.event.type,__assign(__assign({},r.pressState.event),{center:__assign(__assign({},r.pressState.event.center),{delta:C}),isFirst:!1,isFinal:!0,pointers:r.pressState.event.pointers.map(function(I){return __assign(__assign({},I),{delta:C})})}));r.onPressGesture(L),(w=r.pressState)===null||w===void 0||w.stop(),delete r.pressState}},T=null,_=function(w){var C,L=!1,I=!1;switch(w.type){case"gesturestart":L=!0;break;case"gestureend":I=!0;break}var F={x:w.clientX,y:w.clientY},k=r.relativeClientPosition(F),N=new THREE__namespace.Raycaster;N.params.Points={threshold:.1},N.setFromCamera(k,r.camera);var D=__assign(__assign({},F),{coords:k,raycaster:N,buttons:0,delta:0}),U=createEvent("gesture.pinch",{target:w.target,pointerType:"mouse",srcEvent:w,pointers:[__assign({},D)],isFirst:L,isFinal:I,scale:(C=w.scale)!==null&&C!==void 0?C:1,center:__assign({},D),velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0,userAction:!0,state:__assign(__assign({mode:r.mode},r.currentPano),clonePose(r.camera.pose))});return U},R=function(w){if(w.preventDefault(),!isMobile){var C=_(w);T={firstEvent:C};var L=T.firstEvent;L&&!o(L.center)||r.onPinchGesture(C)}},S=function(w){if(w.preventDefault(),!isMobile&&T){var C=_(w),L=T.firstEvent;L&&!o(L.center)||r.onPinchGesture(C)}},M=function(w){if(w.preventDefault(),!isMobile&&T){var C=_(w),L=T.firstEvent;T=null,!(L&&!o(L.center))&&r.onPinchGesture(C)}},B=function(w){if(w&&typeof w.preventDefault=="function"&&w.currentTarget===e&&w.preventDefault(),typeof getSelection=="function"){var C=getSelection();C&&C.focusNode&&(C.removeAllRanges&&C.removeAllRanges(),C.empty&&C.empty())}};this.enableWheel&&e.addEventListener("wheel",g,{passive:!1}),e.addEventListener("mousemove",h,!1),e.addEventListener("mouseout",m,!1),e.addEventListener("touchstart",A,{passive:!0}),e.addEventListener("touchend",b,!1),e.addEventListener("touchcancel",b,!1),e.addEventListener("mousedown",E,!1),e.addEventListener("mouseup",b,!1),e.addEventListener("gesturestart",R,{passive:!1}),e.addEventListener("gesturechange",S,{passive:!1}),e.addEventListener("gestureend",M,{passive:!1}),e.addEventListener("touchstart",B,{passive:!1}),e.addEventListener("contextmenu",B,!1);var H=function(){s.destroy(),e.removeEventListener("wheel",g,!1),e.removeEventListener("mousemove",h,!1),e.removeEventListener("mouseout",m,!1),e.removeEventListener("touchstart",A,!1),e.removeEventListener("touchend",b,!1),e.removeEventListener("touchcancel",b,!1),e.removeEventListener("mousedown",E,!1),e.removeEventListener("mouseup",b,!1),e.removeEventListener("gesturestart",R,!1),e.removeEventListener("gesturechange",S,!1),e.removeEventListener("gestureend",M,!1),e.removeEventListener("touchstart",B,!1),e.removeEventListener("contextmenu",B,!1)};return Object.assign(H,{element:e})},t.prototype.preloadPano=function(e,r){var o=this;r===void 0&&(r=noop$1);var s=this.works.getResolvedObserver(e);if(!s)return Promise.resolve();var u=["right","left","up","down","front","back"];return Promise.all(u.map(function(l){var c=__assign({key:"pano.".concat(panoStringify(e),".").concat(l)},pick(o.imageOptions,["size","format","quality","mappings"])),f=s.images[l],d=applyImageURLOptions(f,o.imageOptions.transform,c);return getFetcher(s.work).preload(d,{timeout:500})})).then(function(){return r(e),e})},t.prototype.updateScreenBuffer=function(e){var r,o,s,u,l,c;if(this.lastPostProcessingType!==e)if(this.lastPostProcessingType=e,e==="luminance"){if(this.screenBuffers.length===0){var f=this.renderer.getDrawingBufferSize(sharedVector2$1);this.screenBuffers=[new THREE__namespace.WebGLRenderTarget(f.x,f.y,{generateMipmaps:!1,encoding:(o=(r=this.renderer)===null||r===void 0?void 0:r.outputEncoding)!==null&&o!==void 0?o:THREE__namespace.sRGBEncoding}),this.modelRenderTarget]}}else if(e==="edl"){if(this.screenBuffers.length===0){var f=this.renderer.getDrawingBufferSize(sharedVector2$1);this.screenBuffers=[new THREE__namespace.WebGLRenderTarget(f.x,f.y,{generateMipmaps:!1,encoding:(u=(s=this.renderer)===null||s===void 0?void 0:s.outputEncoding)!==null&&u!==void 0?u:THREE__namespace.sRGBEncoding,minFilter:THREE__namespace.NearestFilter,magFilter:THREE__namespace.NearestFilter,format:THREE__namespace.RGBAFormat,type:THREE__namespace.FloatType}),this.modelRenderTarget]}this.models.setMaterial({useEDL:!0})}else if(e==="hq"){if(this.screenBuffers.length===0){var f=this.renderer.getDrawingBufferSize(sharedVector2$1),d=new THREE__namespace.WebGLRenderTarget(f.x,f.y,{generateMipmaps:!1,minFilter:THREE__namespace.NearestFilter,magFilter:THREE__namespace.NearestFilter,format:THREE__namespace.RGBAFormat,type:THREE__namespace.FloatType,depthTexture:new THREE__namespace.DepthTexture(f.x,f.y,THREE__namespace.UnsignedIntType)});d.depthTexture.format=THREE__namespace.DepthFormat,d.depthBuffer=!0;var p=new THREE__namespace.WebGLRenderTarget(f.x,f.y,{generateMipmaps:!1,encoding:(c=(l=this.renderer)===null||l===void 0?void 0:l.outputEncoding)!==null&&c!==void 0?c:THREE__namespace.sRGBEncoding,minFilter:THREE__namespace.NearestFilter,magFilter:THREE__namespace.NearestFilter,format:THREE__namespace.RGBAFormat,type:THREE__namespace.FloatType,depthTexture:d.depthTexture});this.screenBuffers=[d,p,this.modelRenderTarget]}this.models.setMaterial({useHQDepth:!0,useHQWeight:!1,pointShape:"CIRCLE"})}else this.screenBuffers&&(this.screenBuffers.forEach(function(v){v.dispose()}),this.screenBuffers=[]),this.models.setMaterial({useEDL:!1,useHQDepth:!1,useHQWeight:!1})},t}(Subscribe),FloorplanController=function(n){__extends(t,n);function t(e){var r=this,o,s=t.parseArgs(e);return r=n.call(this,s)||this,r.mode="Floorplan",r.defaultLongitude=s.defaultLongitude,r.defaultLatitude=s.defaultLatitude,r.defaultFov=s.defaultFov,r.maxFov=s.maxFov,r.minFov=s.minFov,r.maxLatitude=s.maxLatitude,r.minLatitude=s.minLatitude,r.modelInScreen=s.modelInScreen,r.locationMotion=new Motion({x:r.camera.pose.offset.x,y:r.camera.pose.offset.y,z:r.camera.pose.offset.z,distance:r.camera.pose.distance}),r.modelAlphaMotion=new Motion({modelAlpha:(o=r.models.getMaterial().modelAlpha)!==null&&o!==void 0?o:0}),r.perspToOrthoMotion=new Motion({perspToOrtho:r.camera.perspToOrtho.x}),r.currentTapId=null,r.intersectMeshCreator=s.intersectMeshCreator,r.intersectMesh=r.intersectMeshCreator(),r.intersectMesh.name="intersect",r.intersectMesh.visible=!1,r.helper.add(r.intersectMesh),r}return t.distanceFromModel=function(e,r,o){var s=e.bounding,u=Math.pow(Math.pow(s.max.x-s.min.x+1,2)+Math.pow(s.max.y-s.min.y+1,2)+Math.pow(s.max.z-s.min.z+1,2),1/2),l=u/2/Math.tan(Math.PI*r/360);return o<1&&(l=l/o),isNaN(l)?u:l},t.parseArgs=function(e){var r,o,s,u,l,c,f,d,p;if(e instanceof t)return e;var v=n.parseArgs.call(this,e);return __assign(__assign({},v),{defaultLongitude:(r=e.defaultLongitude)!==null&&r!==void 0?r:Math.PI/4,defaultLatitude:(o=e.defaultLatitude)!==null&&o!==void 0?o:Math.PI/4,defaultFov:(s=e.defaultFov)!==null&&s!==void 0?s:80,maxFov:(u=e.maxFov)!==null&&u!==void 0?u:120,minFov:(l=e.minFov)!==null&&l!==void 0?l:20,maxLatitude:(c=e.maxLatitude)!==null&&c!==void 0?c:+Math.PI/2,minLatitude:(f=e.minLatitude)!==null&&f!==void 0?f:-Math.PI/2,modelInScreen:(d=e.modelInScreen)!==null&&d!==void 0?d:"boundingbox-center",intersectMeshCreator:(p=e.intersectMeshCreator)!==null&&p!==void 0?p:function(){return new IntersectMesh}})},t.initAnimationEndState=function(e){var r,o,s,u,l,c,f,d=this.parseArgs(e),p=e.initial,v=p.state,g=p.currentState,h=typeof v.panoIndex=="number"?{workCode:(s=(r=v.workCode)!==null&&r!==void 0?r:(o=d.works[0])===null||o===void 0?void 0:o.workCode)!==null&&s!==void 0?s:"",panoIndex:v.panoIndex}:{workCode:g.workCode,panoIndex:g.panoIndex},m=__assign(__assign({},h),{mode:"Floorplan",longitude:(u=v.longitude)!==null&&u!==void 0?u:isThirdPersonMode(g.mode)?g.longitude:d.defaultLongitude,latitude:clamp$1((l=v.latitude)!==null&&l!==void 0?l:g.mode==="Floorplan"?g.latitude:d.defaultLatitude,d.minLatitude,d.maxLatitude),fov:(c=v.fov)!==null&&c!==void 0?c:d.defaultFov,offset:v.offset?v.offset.clone():e.models.bounding.getCenter(new THREE__namespace.Vector3),distance:(f=v.distance)!==null&&f!==void 0?f:t.distanceFromModel(d.models,d.defaultFov,d.camera.aspect)});return m},t.prototype.destroy=function(){n.prototype.destroy.call(this),this.locationMotion.dispose(),delete this.panState,this.intersectMesh.dispose(),this.helper.remove(this.intersectMesh)},t.prototype.isReady=function(){return this.locationMotion.ended===!1?!1:n.prototype.isReady.call(this)},t.prototype.updateWork=function(e,r,o,s){var u;return this.works=e,this.updateCamera(r,(u=o.duration)!==null&&u!==void 0?u:0,s),!0},t.prototype.updateModel=function(e){n.prototype.updateModel.call(this,e);var r=e.bounding.getCenter(new THREE__namespace.Vector3),o=t.distanceFromModel(e,this.defaultFov,this.camera.aspect);this.updateCamera({offset:r,distance:o},0,!0)},t.prototype.updateCamera=function(e,r,o){var s=this;return this.initAnimationReady.then(function(){s.userAction=o,s.stopMomentumMovement();var u={},l={};return e.distance!==void 0&&(u.distance=e.distance),e.offset!==void 0&&(u.x=e.offset.x,u.y=e.offset.y,u.z=e.offset.z),e.longitude!==void 0&&(l.longitude=e.longitude),e.latitude!==void 0&&(l.latitude=e.latitude),e.fov!==void 0&&(l.fov=e.fov),s.locationMotion.set(u,r).catch(noop$1),s.cameraMotion.set(l,r).catch(noop$1)})},t.prototype.updateCameraWithKeyframes=function(e,r,o){var s=this;return this.initAnimationReady.then(function(){s.userAction=o,s.stopMomentumMovement();for(var u=[],l=[],c=0,f=e;c<f.length;c++){var d=f[c];u.push({key:d.key,progress:d.progress,value:{distance:d.value.distance,x:d.value.offset.x,y:d.value.offset.x,z:d.value.offset.x}}),l.push({key:d.key,progress:d.progress,value:{longitude:d.value.longitude,latitude:d.value.latitude,fov:d.value.fov}})}return s.locationMotion.setKeyframes(u,r).catch(noop$1),s.cameraMotion.setKeyframes(e,r)})},t.prototype.updateTime=function(e,r){if(!this.destroyed){var o={},s={};this.modelAlphaMotion.ended||(this.modelAlphaMotion.update(e),o.modelAlpha=this.modelAlphaMotion.value.modelAlpha),this.perspToOrthoMotion.ended||(this.perspToOrthoMotion.update(e),this.camera.perspToOrtho.setScalar(clamp$1(this.perspToOrthoMotion.value.perspToOrtho,0,1))),this.locationMotion.ended||(this.locationMotion.update(e),s.distance=this.locationMotion.value.distance,s.offset=new THREE__namespace.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z)),this.cameraMotion.ended||(this.cameraMotion.update(e),s.longitude=this.cameraMotion.value.longitude,s.latitude=this.cameraMotion.value.latitude,s.fov=this.cameraMotion.value.fov),isEmptyObject(o)||this.models.setMaterial(o),isEmptyObject(s)||this.setCamera(s)}},t.prototype.getTargetState=function(){var e=this.cameraMotion.getKeyFrameSegment(now())[1],r=this.locationMotion.getKeyFrameSegment(now())[1];return __assign(__assign({},this.currentPano),{mode:this.mode,longitude:e.value.longitude,latitude:e.value.latitude,fov:e.value.fov,offset:new THREE__namespace.Vector3(r.value.x,r.value.y,r.value.z),distance:r.value.distance})},t.prototype.initAnimation=function(){var e=this;return this.destroyed?Promise.resolve():new Promise(function(r){var o=e.initial;o.state,o.currentState;var s=o.duration,u=o.userAction;e.userAction=u;var l=t.initAnimationEndState(e),c=pick(l,["longitude","latitude","fov"]),f={x:l.offset.x,y:l.offset.y,z:l.offset.z,distance:l.distance},d={modelAlpha:1},p={perspToOrtho:0};e.emit("initAnimation.start",createEvent("initAnimation.start",{state:l,userAction:e.userAction})),e.modelAlphaMotion.set(d,s/3).catch(noop$1),e.perspToOrthoMotion.set(p,s).catch(noop$1),e.cameraMotion.set(c,s).catch(noop$1),e.locationMotion.set(f,s).then(function(){e.emit("initAnimation.end",createEvent("initAnimation.end",{state:l,userAction:e.userAction}))},function(v){var g=__assign(__assign(__assign({},e.currentPano),{mode:e.mode}),clonePose(e.camera.pose));e.emit("initAnimation.end",createEvent("initAnimation.end",{state:g,userAction:e.userAction}))}).then(function(){r()})})},t.prototype.updateRenderSize=function(e){this.needsRender=!0,this.modelSceneNeedsRender=!0,this.screenBuffers.forEach(function(r){r.setSize(e.x,e.y)})},t.prototype.getForwardObserverOrNot=function(e){var r=this,o=this.models.intersectRaycaster(e)[0];if(!o)return null;var s=this.works.resolvedObservers.filter(function(f){for(var d,p=0,v=r.models;p<v.length;p++){var g=v[p];if(g.visible&&((d=g.work)===null||d===void 0?void 0:d.workCode)===f.work.workCode)return!0}return!1}),u=arrayMin(s,function(f){return f.standingPosition.distanceTo(o.point)},!0),l=u[0],c=u[1];return l&&c<10?l:null},t.prototype.coordinatesForOffset=function(e){var r=this.renderer.getSize(new THREE__namespace.Vector2);return{longitude:-2*e.x/(r.x*this.scissor.width),latitude:2*e.y/(r.y*this.scissor.height)}},t.prototype.requestMomentumMovement=function(e,r,o,s){var u=this;if(this.inMomentumMovement!==null){for(var l=__assign({},o),c={longitude:0,latitude:0},f=0;f<s;f++)l.longitude*=.996,l.latitude*=.996*.998,c.longitude+=l.longitude,c.latitude+=l.latitude;var d=formatRad(this.cameraMotion.value.longitude+c.longitude),p=clamp$1(this.cameraMotion.value.latitude+c.latitude,this.minLatitude,this.maxLatitude),v=__assign(__assign({},this.currentPano),{mode:this.mode,longitude:d,latitude:p,fov:this.cameraMotion.value.fov,offset:this.camera.pose.offset.clone(),distance:this.camera.pose.distance}),g=!(l.longitude>1e-4||l.longitude<-1e-4||l.latitude>1e-4||l.latitude<-1e-4),h=createEvent("gesture.momentum",__assign(__assign({},e),{isFirst:r,isFinal:g,state:v}));if(this.inMomentumMovement.event=h,this.emit("gesture.momentum",h),e.defaultPrevented){this.inMomentumMovement=null;return}this.inMomentumMovement&&(this.cameraMotion.set({longitude:d,latitude:p},0).catch(noop$1),g?this.inMomentumMovement=null:AnimationFrameLoop.shared.add(function(m,y){u.requestMomentumMovement(e,!1,l,y|0)},!0,1))}},t.prototype.onPanGesture=function(e){this.userAction=e.userAction,this.stopMomentumMovement(),this.hideIntersectMesh();var r=this.panState,o=e.pointers.length;if(e.isFinal?delete this.panState:this.panState={pointerLength:o,x:e.center.x,y:e.center.y},!(typeof r=="undefined"||r.pointerLength!==o)){var s={x:e.center.x-r.x,y:e.center.y-r.y},u=this.relativeClientPosition(e.center),l=this.camera.pose.latitude<Math.PI/6||u.y<0?1:-1;s.x*=l;var c=this.coordinatesForOffset(s),f=formatRad(this.cameraMotion.value.longitude+c.longitude),d=clamp$1(this.cameraMotion.value.latitude+c.latitude,this.minLatitude,this.maxLatitude);this.camera.aspect<1&&Math.abs(e.overallVelocityX)>.2&&Math.atan2(Math.abs(e.overallVelocityY),Math.abs(e.overallVelocityX))<Math.PI/6.923&&(d=this.cameraMotion.value.latitude);var p=__assign(__assign({},this.currentPano),{mode:this.mode,longitude:f,latitude:d,fov:this.camera.pose.fov,offset:this.camera.pose.offset,distance:this.camera.pose.distance});if(e.state=p,this.emit("gesture.pan",e),!e.defaultPrevented&&(this.cameraMotion.set({longitude:p.longitude,latitude:p.latitude},0).catch(noop$1),e.isFinal)){var v=e.velocityX*l,g=e.velocityY;this.inMomentumMovement={uuid:createUuid()},this.requestMomentumMovement(e,!0,this.coordinatesForOffset({x:v,y:g}),0)}}},t.prototype.onPinchGesture=function(e){var r;if(this.initAnimationIsReady){this.userAction=e.userAction,this.stopMomentumMovement();var o=(r=this.pinchState)===null||r===void 0?void 0:r.fov;if(e.isFirst){this.pinchState={x:e.center.x,y:e.center.y,fov:this.cameraMotion.value.fov};return}if(e.isFinal&&(delete this.panState,delete this.pinchState),typeof o!="undefined"){var s=clamp$1(o/e.scale,this.minFov,this.maxFov);e.state.fov=s,this.emit("gesture.pinch",e),!e.defaultPrevented&&(this.cameraMotion.set({fov:s},0).catch(noop$1),this.onPanGesture(e))}}},t.prototype.onMouseMove=function(e){var r,o;if(this.intersectMesh.parent&&!this.panState){if(this.emit("gesture.mousemove",e),e.defaultPrevented){this.hideIntersectMesh();return}var s=e.center.raycaster;if(e.isFinal&&this.intersectMesh.parent&&this.intersectMesh.visible===!0){this.hideIntersectMesh();return}var u=this.models.intersectRaycaster(s)[0],l=createEvent("intersect.update",{raycaster:s,intersection:u!=null?u:null,object:this.intersectMesh});if(this.emit("intersect.update",l),l.defaultPrevented){this.hideIntersectMesh();return}if(u){var c=(o=(r=u.face)===null||r===void 0?void 0:r.normal)!==null&&o!==void 0?o:new THREE__namespace.Vector3().copy(s.ray.direction).multiplyScalar(-1),f=c.clone(),d=u.point.clone();this.intersectMesh.position.copy(d);var p=s.ray.origin.distanceTo(d),v=2*Math.tan(.5*this.camera.fov/180*Math.PI),g=Math.max(p*v/10,1);this.intersectMesh.scale.set(g,g,g);var h=d.clone().add(f);if(this.intersectMesh.lookAt(h),Math.abs(c.y)>.99){var m=this.camera.position.clone().sub(d);this.intersectMesh.rotation.z=-Math.atan2(m.z,m.x)}this.intersectMesh.visible=!0,this.needsRender=!0}else this.hideIntersectMesh()}},t.prototype.onMouseWheel=function(e){if(this.initAnimationIsReady){this.userAction=e.userAction,this.stopMomentumMovement();var r=this,o=r.minFov,s=r.maxFov,u=clamp$1(this.camera.fov-e.center.delta,o,s);e.state.fov=u,this.emit("gesture.mousewheel",e),!e.defaultPrevented&&this.cameraMotion.set({fov:u},0).catch(noop$1)}},t.prototype.onTapGesture=function(e){var r=this;this.userAction=!0,this.stopMomentumMovement();var o=e.center.raycaster,s=this.getForwardObserverOrNot(o);if(!s)this.emit("gesture.tap",e);else{var u={longitude:this.camera.pose.longitude,latitude:0},l=__assign(__assign({},e.state),{mode:"Panorama",workCode:s.pano.workCode,panoIndex:s.pano.panoIndex,longitude:u.longitude,latitude:u.latitude,offset:s?s.position.clone():new THREE__namespace.Vector3,distance:0});if(e.state=l,this.emit("gesture.tap",e),!e.defaultPrevented&&(this.emit("pano.select",createEvent("pano.select",{prevPano:this.currentPano,state:l,userAction:e.userAction,options:u,progress:0,error:null})),s&&s.active)){var c=this.currentTapId=createUuid();this.preloadPano(s.pano).then(function(f){r.currentTapId===c&&r.emit("pano.request",createEvent("pano.request",{userAction:!0,prevPano:r.currentPano,progress:0,state:l,options:u,error:null}))})}}},t.prototype.onDblTapGesture=function(e){this.userAction=e.userAction,this.stopMomentumMovement();var r=this.cameraMotion.value.fov,o=this.minFov-r<r-this.defaultFov?this.minFov:this.defaultFov;e.state.fov=o,this.emit("gesture.dbltap",e),!e.defaultPrevented&&(this.cameraMotion.set({fov:o},360).catch(noop$1),this.hideIntersectMesh())},t.prototype.hideIntersectMesh=function(){this.intersectMesh.visible=!1,this.needsRender=!0},t}(BaseController),TopviewController=function(n){__extends(t,n);function t(e){var r=this,o=t.parseArgs(e);return r=n.call(this,o)||this,r.mode="Topview",r}return t.parseArgs=function(e){if(e instanceof t)return e;var r=__assign(__assign({},e),{defaultLongitude:0,defaultLatitude:Math.PI/2});return n.parseArgs.call(this,r)},t.initAnimationEndState=function(e){var r=this.parseArgs(e),o=n.initAnimationEndState.call(this,r);return __assign(__assign({},o),{longitude:r.defaultLongitude,latitude:r.defaultLatitude,mode:"Topview"})},t.prototype.updateModel=function(e){this.needsRender=!0,this.modelSceneNeedsRender=!0;var r=this.models.bounding.getCenter(new THREE__namespace.Vector3);this.locationMotion.set({x:r.x,y:r.y,z:r.z,distance:FloorplanController.distanceFromModel(this.models,this.defaultFov,this.camera.aspect)},0).catch(noop$1)},t.prototype.updateCamera=function(e,r,o){var s=this;return this.initAnimationReady.then(function(){s.userAction=o,s.stopMomentumMovement();var u={},l={};return e.distance!==void 0&&(u.distance=e.distance),e.offset!==void 0&&(u.x=e.offset.x,u.y=e.offset.y,u.z=e.offset.z),e.longitude!==void 0&&(l.longitude=e.longitude),e.latitude!==void 0&&(l.latitude=e.latitude),e.fov!==void 0&&(l.fov=e.fov),s.locationMotion.set(u,r).catch(noop$1),s.cameraMotion.set(l,r).catch(noop$1)})},t.prototype.updateCameraWithKeyframes=function(e,r,o){var s=this;return this.initAnimationReady.then(function(){s.userAction=o,s.stopMomentumMovement();for(var u=[],l=[],c=0,f=e;c<f.length;c++){var d=f[c];u.push({key:d.key,progress:d.progress,value:{distance:d.value.distance,x:d.value.offset.x,y:d.value.offset.y,z:d.value.offset.z}}),l.push({key:d.key,progress:d.progress,value:{longitude:d.value.longitude,latitude:d.value.latitude,fov:d.value.fov}})}return s.locationMotion.setKeyframes(u,r).catch(noop$1),s.cameraMotion.setKeyframes(e,r)})},t.prototype.initAnimation=function(){var e=this;return this.destroyed?Promise.resolve():new Promise(function(r){var o=e.initial;o.state,o.currentState;var s=o.duration,u=o.userAction;e.userAction=u;var l=t.initAnimationEndState(e),c={longitude:l.longitude,latitude:l.latitude,fov:l.fov},f={x:l.offset.x,y:l.offset.y,z:l.offset.z,distance:l.distance},d={modelAlpha:1},p={perspToOrtho:1};e.emit("initAnimation.start",createEvent("initAnimation.start",{state:l,userAction:e.userAction})),e.modelAlphaMotion.set(d,s/3).catch(noop$1),e.perspToOrthoMotion.set(p,s).catch(noop$1),e.cameraMotion.set(c,s).catch(noop$1),e.locationMotion.set(f,s).then(function(){e.emit("initAnimation.end",createEvent("initAnimation.end",{state:l,userAction:e.userAction}))},function(v){var g=__assign(__assign(__assign({},e.currentPano),{mode:e.mode}),clonePose(e.camera.pose));e.emit("initAnimation.end",createEvent("initAnimation.end",{state:g,userAction:e.userAction}))}).then(function(){r()})})},t.prototype.requestMomentumMovement=function(){this.inMomentumMovement=null},t.prototype.onPanGesture=function(e){this.userAction=e.userAction,this.stopMomentumMovement();var r=this.panState,o=e.pointers.length;if(e.isFinal?delete this.panState:this.panState={pointerLength:o,x:e.center.x,y:e.center.y},!(typeof r=="undefined"||r.pointerLength!==o)){var s={x:e.center.x-r.x,y:e.center.y-r.y},u=new THREE__namespace.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z),l=this.locationMotion.value.distance;l*=Math.tan(this.cameraMotion.value.fov/2*Math.PI/180);var c=this.renderer.getSize(new THREE__namespace.Vector2),f=2*s.x*l/c.y,d=2*s.y*l/c.y,p=new THREE__namespace.Vector3;p.setFromMatrixColumn(this.camera.matrix,0),p.multiplyScalar(-f),u.add(p),p.setFromMatrixColumn(this.camera.matrix,1),p.multiplyScalar(d),u.add(p),this.modelInScreen==="boundingbox-center"&&u.clamp(this.models.bounding.min,this.models.bounding.max);var v=__assign(__assign({},this.currentPano),{mode:this.mode,longitude:0,latitude:Math.PI/2,fov:this.cameraMotion.value.fov,offset:u,distance:this.locationMotion.value.distance});e.state=v,this.emit("gesture.pan",e),!e.defaultPrevented&&this.locationMotion.set({x:u.x,y:u.y,z:u.z},0).catch(noop$1)}},t.prototype.onPinchGesture=function(e){var r;if(this.initAnimationIsReady){this.userAction=e.userAction,this.stopMomentumMovement();var o=(r=this.pinchState)===null||r===void 0?void 0:r.fov;if(e.isFirst){this.pinchState={x:e.center.x,y:e.center.y,fov:this.cameraMotion.value.fov};return}if(e.isFinal&&delete this.pinchState,typeof o!="undefined"){var s=clamp$1(o/e.scale,this.minFov,this.maxFov);e.state.fov=s,this.emit("gesture.pinch",e),!e.defaultPrevented&&(this.cameraMotion.set({fov:s},0).catch(noop$1),e.type="gesture.pan",this.onPanGesture(e))}}},t.prototype.onMouseWheel=function(e){if(this.initAnimationIsReady){this.userAction=e.userAction,this.stopMomentumMovement();var r=clamp$1(this.cameraMotion.value.fov-e.center.delta,this.minFov,this.maxFov);e.state.fov=r,this.emit("gesture.mousewheel",e),!e.defaultPrevented&&this.cameraMotion.set({fov:r},0).catch(noop$1)}},t}(FloorplanController),PanoramaLikeController=function(n){__extends(t,n);function t(e){var r=this,o=t.parseArgs(e);return r=n.call(this,o)||this,r.mode="PanoramaLike",r.defaultLatitude=o.defaultLatitude,r.defaultFov=o.defaultFov,r.maxFov=o.maxFov,r.minFov=o.minFov,r.maxLatitude=o.maxLatitude,r.minLatitude=o.minLatitude,r.moveSpeed=o.moveSpeed,r.intersectMeshCreator=o.intersectMeshCreator,r.intersectMesh=r.intersectMeshCreator(),r.intersectMesh.name="intersect",r.intersectMesh.visible=!1,r.helper.add(r.intersectMesh),r}return t.parseArgs=function(e){var r,o,s,u,l,c,f,d;if(e instanceof t)return e;var p=n.parseArgs.call(this,e);return __assign(__assign({},p),{defaultLatitude:(r=e.defaultLatitude)!==null&&r!==void 0?r:0,defaultFov:(o=e.defaultFov)!==null&&o!==void 0?o:90,maxFov:(s=e.maxFov)!==null&&s!==void 0?s:120,minFov:(u=e.minFov)!==null&&u!==void 0?u:20,maxLatitude:(l=e.maxLatitude)!==null&&l!==void 0?l:+Math.PI/2,minLatitude:(c=e.minLatitude)!==null&&c!==void 0?c:-Math.PI/2,moveSpeed:(f=e.moveSpeed)!==null&&f!==void 0?f:3.4,intersectMeshCreator:(d=e.intersectMeshCreator)!==null&&d!==void 0?d:function(){return new IntersectMesh}})},t.initAnimationEndState=function(e){var r,o,s,u,l,c,f=this.parseArgs(e),d=f.works,p=e.initial,v=p.state,g=p.currentState,h=typeof v.panoIndex=="number"?{workCode:(s=(r=v.workCode)!==null&&r!==void 0?r:(o=f.works[0])===null||o===void 0?void 0:o.workCode)!==null&&s!==void 0?s:"",panoIndex:v.panoIndex}:{workCode:g.workCode,panoIndex:g.panoIndex},m=d.getResolvedObserver(h),y=(u=v.longitude)!==null&&u!==void 0?u:g.longitude,A=clamp$1((l=v.latitude)!==null&&l!==void 0?l:isFristPersonMode(g.mode)?g.latitude:f.defaultLatitude,f.minLatitude,f.maxLatitude),E=clamp$1((c=v.fov)!==null&&c!==void 0?c:isFristPersonMode(g.mode)?g.fov:f.defaultFov,f.minFov,f.maxFov),b=m?m.position.clone():new THREE__namespace.Vector3;return{workCode:h.workCode,panoIndex:h.panoIndex,mode:"PanoramaLike",longitude:y,latitude:A,fov:E,offset:b,distance:0}},t.prototype.destroy=function(){n.prototype.destroy.call(this),this.intersectMesh&&(this.helper.remove(this.intersectMesh),this.intersectMesh.dispose()),delete this.panState},t.prototype.isReady=function(){return this.panState||this.pinchState?!1:n.prototype.isReady.call(this)},t.prototype.calculateMovingDuration=function(e,r){switch(typeof e){case"function":return e(r,this.moveSpeed);case"number":return e;case"string":return Number(e);default:return clamp$1(r,2,5)/this.moveSpeed*1e3}},t.prototype.hideIntersectMesh=function(){this.intersectMesh.visible=!1,this.needsRender=!0},t.prototype.coordinatesForOffset=function(e){var r=this.cameraMotion.value.fov,o=this.camera.aspect,s=this.renderer.getSize(new THREE__namespace.Vector2);return{longitude:2*e.x/(s.x*this.scissor.width)*r/95*o,latitude:-2*e.y/(s.y*this.scissor.height)*r/95}},t.prototype.cameraBounce=function(){var e=this.cameraMotion.value,r=e.longitude,o=e.latitude,s=e.fov,u=[{progress:0,value:{longitude:r,latitude:o,fov:s}},{progress:.5,value:{longitude:r,latitude:o,fov:s*.98}},{progress:1,value:{longitude:r,latitude:o,fov:s}}];this.cameraMotion.setKeyframes(u,500).catch(noop$1)},t.prototype.requestMomentumMovement=function(e,r,o,s){var u=this;if(this.inMomentumMovement!==null){for(var l=__assign({},o),c={longitude:0,latitude:0},f=0;f<s;f++)l.longitude*=.996,l.latitude*=.996*.99,c.longitude+=l.longitude,c.latitude+=l.latitude;var d=formatRad(this.cameraMotion.value.longitude+c.longitude),p=clamp$1(this.cameraMotion.value.latitude+c.latitude,this.minLatitude,this.maxLatitude),v=__assign(__assign({},this.currentPano),{mode:this.mode,longitude:d,latitude:p,fov:this.cameraMotion.value.fov,offset:this.camera.pose.offset.clone(),distance:this.camera.pose.distance}),g=!(l.longitude>1e-4||l.longitude<-1e-4||l.latitude>1e-4||l.latitude<-1e-4),h=createEvent("gesture.momentum",__assign(__assign({},e),{isFirst:r,isFinal:g,state:v}));if(this.inMomentumMovement.event=h,this.emit("gesture.momentum",h),e.defaultPrevented){this.inMomentumMovement=null;return}this.inMomentumMovement&&(this.cameraMotion.set({longitude:d,latitude:p},0).catch(noop$1),g?this.inMomentumMovement=null:AnimationFrameLoop.shared.add(function(m,y){u.requestMomentumMovement(e,!1,l,y|0)},!0,1))}},t.prototype.onPanGesture=function(e){this.userAction=e.userAction,this.stopMomentumMovement(),this.hideIntersectMesh();var r=this.panState,o=e.pointers.length;if(e.isFinal?delete this.panState:this.panState={pointerLength:o,x:e.center.x,y:e.center.y},!(typeof r=="undefined"||r.pointerLength!==o)){var s={x:e.center.x-r.x,y:e.center.y-r.y},u=this.coordinatesForOffset(s),l=formatRad(this.cameraMotion.value.longitude+u.longitude),c=clamp$1(this.cameraMotion.value.latitude+u.latitude,this.minLatitude,this.maxLatitude);this.camera.aspect<1&&Math.abs(e.overallVelocityX)>.2&&Math.atan2(Math.abs(e.overallVelocityY),Math.abs(e.overallVelocityX))<Math.PI/6.923&&(c=this.cameraMotion.value.latitude);var f=__assign(__assign({},this.currentPano),{mode:this.mode,longitude:l,latitude:c,fov:this.cameraMotion.value.fov,offset:this.camera.pose.offset.clone(),distance:this.camera.pose.distance});if(e.state=f,this.emit("gesture.pan",e),!e.defaultPrevented){var d={longitude:f.longitude,latitude:f.latitude,fov:f.fov};if(this.cameraMotion.set(d,0).catch(noop$1),e.isFinal){var p=e.velocityX,v=e.velocityY*.6;Math.abs(v)>.5&&Math.abs(p)<.5&&(p=0),this.inMomentumMovement={uuid:createUuid()},this.requestMomentumMovement(e,!0,this.coordinatesForOffset({x:p,y:v}),0)}}}},t.prototype.onPinchGesture=function(e){var r;this.userAction=e.userAction,this.stopMomentumMovement();var o=(r=this.pinchState)===null||r===void 0?void 0:r.fov,s=e.scale;if(e.isFirst){this.pinchState={x:e.center.x,y:e.center.y,fov:this.cameraMotion.value.fov};return}if(e.isFinal&&delete this.pinchState,typeof o!="undefined"){var u=clamp$1(o/s,this.minFov,this.maxFov);e.state.fov=u,this.emit("gesture.pinch",e),!e.defaultPrevented&&(this.cameraMotion.set({fov:u},0).catch(noop$1),e.type="gesture.pan",this.onPanGesture(e))}},t.prototype.onMouseWheel=function(e){this.userAction=e.userAction,this.stopMomentumMovement();var r=clamp$1(this.cameraMotion.value.fov-e.center.delta,this.minFov,this.maxFov);e.state.fov=r,this.emit("gesture.mousewheel",e),!e.defaultPrevented&&(this.cameraMotion.set({fov:r},0).catch(noop$1),this.onMouseMove(e))},t.prototype.onMouseMove=function(e){var r,o;if(this.intersectMesh.parent&&!this.panState&&(this.emit("gesture.mousemove",e),!e.defaultPrevented)){var s=e.center.raycaster;if(e.isFinal&&this.intersectMesh.parent){this.hideIntersectMesh();return}var u=this.models.intersectRaycaster(s)[0],l=createEvent("intersect.update",{raycaster:s,intersection:u!=null?u:null,object:this.intersectMesh});if(this.emit("intersect.update",l),l.defaultPrevented){this.hideIntersectMesh();return}if(u){var c=(o=(r=u.face)===null||r===void 0?void 0:r.normal)!==null&&o!==void 0?o:new THREE__namespace.Vector3().copy(s.ray.direction).multiplyScalar(-1),f=c.clone(),d=u.point.clone();this.intersectMesh.position.copy(d);var p=d.clone().add(f);if(this.intersectMesh.lookAt(p),Math.abs(c.y)>.99){var v=this.camera.position.clone().sub(d);this.intersectMesh.rotation.z=-Math.atan2(v.z,v.x)}this.intersectMesh.visible=!0,this.needsRender=!0}else this.hideIntersectMesh()}},t.prototype.onDblTapGesture=function(e){this.userAction=e.userAction,this.stopMomentumMovement();var r=this.cameraMotion.value.fov,o=2,s=this.works.getResolvedObserver(this.currentPano);if(s){var u=s.images.tiles;u&&u.length&&(o=Math.max.apply(Math,u.map(function(f){return f.level})))}var l=Math.max(40-o*5,this.minFov,5),c=l-r<r-this.defaultFov?l:this.defaultFov;e.state.fov=c,this.emit("gesture.dbltap",e),!e.defaultPrevented&&(this.cameraMotion.set({fov:c},360).catch(noop$1),this.hideIntersectMesh())},t}(BaseController),blankVideo="data:video/mp4;base64,AAAAHGZ0eXBNNFYgAAACAGlzb21pc28yYXZjMQAAAAhmcmVlAAAGF21kYXTeBAAAbGliZmFhYyAxLjI4AABCAJMgBDIARwAAArEGBf//rdxF6b3m2Ui3lizYINkj7u94MjY0IC0gY29yZSAxNDIgcjIgOTU2YzhkOCAtIEguMjY0L01QRUctNCBBVkMgY29kZWMgLSBDb3B5bGVmdCAyMDAzLTIwMTQgLSBodHRwOi8vd3d3LnZpZGVvbGFuLm9yZy94MjY0Lmh0bWwgLSBvcHRpb25zOiBjYWJhYz0wIHJlZj0zIGRlYmxvY2s9MTowOjAgYW5hbHlzZT0weDE6MHgxMTEgbWU9aGV4I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AAAAkAAACMc3RjbwAAAAAAAAAfAAAALAAAA1UAAANyAAADhgAAA6IAAAO+AAAD0QAAA+0AAAQAAAAEHAAABC8AAARLAAAEZwAABHoAAASWAAAEqQAABMUAAATYAAAE9AAABRAAAAUjAAAFPwAABVIAAAVuAAAFgQAABZ0AAAWwAAAFzAAABegAAAX7AAAGFwAAAGJ1ZHRhAAAAWm1ldGEAAAAAAAAAIWhkbHIAAAAAAAAAAG1kaXJhcHBsAAAAAAAAAAAAAAAALWlsc3QAAAAlqXRvbwAAAB1kYXRhAAAAAQAAAABMYXZmNTUuMzMuMTAw",result;function canplayVideo(){return result||(result=new Promise(function(n){var t,e=document.createElement("video");e.muted=!0,e.src=blankVideo,e.addEventListener("timeupdate",function r(){e.removeEventListener("timeupdate",r,!1),clearTimeout(t);var o=document.createElement("canvas");o.width=o.height=1;var s=o.getContext("2d");if(!s){n(!1);return}s.drawImage(e,0,0,1,1);var u=s.getImageData(0,0,1,1).data;u[3]>10?n(!0):n(!1)},!1),e.addEventListener("canplay",function r(){e.removeEventListener("canplay",r,!1),e.play()},!1),t=window.setTimeout(function(){return n(!1)},1e3)}))}var FRAGMENT=`
|
|
1478
1478
|
#include <common>
|
|
1479
1479
|
uniform sampler2D inputBuffer;
|
|
1480
1480
|
uniform float scale;
|
|
@@ -1558,7 +1558,7 @@ void main() {
|
|
|
1558
1558
|
gl_FragColor.a = 1.0 - texture2D(luminanceMap, vUv).r;
|
|
1559
1559
|
#endif
|
|
1560
1560
|
}
|
|
1561
|
-
`,TileMaterial=function(n){__extends(t,n);function t(){var e=n.call(this,{uniforms:{map:{value:null},luminanceMap:{value:null},flipY:{value:1},level:{value:0}},vertexShader:TILE_MATERIAL_VERTEX_SHADER,fragmentShader:TILE_MATERIAL_FRAGMENT_SHADER})||this;return e.depthTest=!1,e.depthWrite=!1,e.blending=THREE__namespace.NoBlending,e.map=e.uniforms.map.value,e.luminanceMap=e.uniforms.luminanceMap.value,e.flipY=!!e.uniforms.flipY.value,e.level=e.uniforms.level.value,Object.defineProperties(e,{map:{get:function(){return this.uniforms.map.value},set:function(r){this.uniforms.map.value=r}},luminanceMap:{get:function(){return this.uniforms.luminanceMap.value},set:function(r){this.uniforms.luminanceMap.value=r,this.defines.USE_LUMINANCE=r!==null,this.needsUpdate=!0}},flipY:{get:function(){return this.uniforms.flipY.value===1},set:function(r){this.uniforms.flipY.value=r?1:0}},level:{get:function(){return this.uniforms.level.value},set:function(r){this.uniforms.level.value=r}}}),e}return t}(THREE__namespace.ShaderMaterial),TileMesh=function(n){__extends(t,n);function t(e,r){var o=n.call(this,geometry$3,new TileMaterial)||this;return e.box.getCenter(o.position),o.quaternion.multiplyQuaternions(new THREE__namespace.Quaternion().setFromAxisAngle(new THREE__namespace.Vector3(0,1,0),-Math.PI),TILE_QUATERNION[e.face]),o.scale.setScalar(e.size),o.node=e,o.name="tiling:tile",o.material.visible=!1,o.activeTime=-1,o.disposed=!1,o.needsRender=!1,o.frustumCulled=!1,r.then(function(s){var u=s[0],l=s[1];o.disposed?(u.dispose(),l==null||l.dispose()):(o.material.map=u,o.material.luminanceMap=l,o.material.flipY=!!u.flipY,o.material.level=e.level,o.material.needsUpdate=!0,o.material.visible=!0,o.needsRender=!0)}).catch(noop$1),o}return t.prototype.updateTime=function(e){},t.prototype.dispose=function(){var e;this.disposed=!0,this.material.map&&(this.material.map.dispose(),(e=this.material.luminanceMap)===null||e===void 0||e.dispose()),this.material.dispose()},t}(THREE__namespace.Mesh),TilingObject3D=function(n){__extends(t,n);function t(){var e=n.call(this)||this;return e.needsRender=!1,e.name="tiling",e}return t}(THREE__namespace.Group),Tiling=function(){function n(t,e,r){this.disposed=!1,this.textureLoader=new TextureLoader,this.minLevel=e,this.level=0,this.panoId="[0]",this.maxRequest=n.DEFAULT_MAX_REQUEST,this.pedding=0,this.tileTree=createTileCubeTree(this.minLevel),this.tileMeshes=new Map,this.resource=[],this.luminance=null,this.imageOptions=r,this.fetcher=t,this.object=new TilingObject3D,this.object.renderOrder=-3}return n.prototype.setFetcher=function(t){this.fetcher=t},n.prototype.cleanup=function(){var t=this;this.tileMeshes.forEach(function(e){e.dispose(),t.object.remove(e),t.object.needsRender=!0}),this.tileMeshes.clear()},n.prototype.setRotation=function(t){this.disposed||this.object.quaternion.equals(t)||(this.object.quaternion.copy(t),this.object.needsRender=!0)},n.prototype.setPosition=function(t){this.disposed||this.object.position.equals(t)||(this.object.position.copy(t),this.object.needsRender=!0)},n.prototype.setResource=function(t,e){var r,o;if(!this.disposed&&!(this.resource===t&&this.luminance===e)){this.cleanup(),this.resource=t;var s=(o=(r=t.slice().sort(function(u,l){return l.level-u.level})[0])===null||r===void 0?void 0:r.level)!==null&&o!==void 0?o:0;this.tileTree=createTileCubeTree(s),this.luminance=e,this.object.needsRender=!0}},n.prototype.update=function(t,e,r){var o=this;if(!this.disposed){this.level=e;var s=t.planes[5].normal,u=[];e>=this.minLevel&&traverseTileCubeNode(this.tileTree,function(E){if(!(E.level<o.minLevel)){if(E.level>e||!t.intersectsBox(E.box))return!1;u.push(E)}}),u.sort(function(E,b){return E.level!==b.level?E.level-b.level:E.box.getCenter(sharedSortVector3).angleTo(s)-b.box.getCenter(sharedSortVector3).angleTo(s)});for(var l=new Set,c=function(E){var b=f.resource.filter(function(
|
|
1561
|
+
`,TileMaterial=function(n){__extends(t,n);function t(){var e=n.call(this,{uniforms:{map:{value:null},luminanceMap:{value:null},flipY:{value:1},level:{value:0}},vertexShader:TILE_MATERIAL_VERTEX_SHADER,fragmentShader:TILE_MATERIAL_FRAGMENT_SHADER})||this;return e.depthTest=!1,e.depthWrite=!1,e.blending=THREE__namespace.NoBlending,e.map=e.uniforms.map.value,e.luminanceMap=e.uniforms.luminanceMap.value,e.flipY=!!e.uniforms.flipY.value,e.level=e.uniforms.level.value,Object.defineProperties(e,{map:{get:function(){return this.uniforms.map.value},set:function(r){this.uniforms.map.value=r}},luminanceMap:{get:function(){return this.uniforms.luminanceMap.value},set:function(r){this.uniforms.luminanceMap.value=r,this.defines.USE_LUMINANCE=r!==null,this.needsUpdate=!0}},flipY:{get:function(){return this.uniforms.flipY.value===1},set:function(r){this.uniforms.flipY.value=r?1:0}},level:{get:function(){return this.uniforms.level.value},set:function(r){this.uniforms.level.value=r}}}),e}return t}(THREE__namespace.ShaderMaterial),TileMesh=function(n){__extends(t,n);function t(e,r){var o=n.call(this,geometry$3,new TileMaterial)||this;return e.box.getCenter(o.position),o.quaternion.multiplyQuaternions(new THREE__namespace.Quaternion().setFromAxisAngle(new THREE__namespace.Vector3(0,1,0),-Math.PI),TILE_QUATERNION[e.face]),o.scale.setScalar(e.size),o.node=e,o.name="tiling:tile",o.material.visible=!1,o.activeTime=-1,o.disposed=!1,o.needsRender=!1,o.frustumCulled=!1,r.then(function(s){var u=s[0],l=s[1];o.disposed?(u.dispose(),l==null||l.dispose()):(o.material.map=u,o.material.luminanceMap=l,o.material.flipY=!!u.flipY,o.material.level=e.level,o.material.needsUpdate=!0,o.material.visible=!0,o.needsRender=!0)}).catch(noop$1),o}return t.prototype.updateTime=function(e){},t.prototype.dispose=function(){var e;this.disposed=!0,this.material.map&&(this.material.map.dispose(),(e=this.material.luminanceMap)===null||e===void 0||e.dispose()),this.material.dispose()},t}(THREE__namespace.Mesh),TilingObject3D=function(n){__extends(t,n);function t(){var e=n.call(this)||this;return e.needsRender=!1,e.name="tiling",e}return t}(THREE__namespace.Group),Tiling=function(){function n(t,e,r){this.disposed=!1,this.textureLoader=new TextureLoader,this.minLevel=e,this.level=0,this.panoId="[0]",this.maxRequest=n.DEFAULT_MAX_REQUEST,this.pedding=0,this.tileTree=createTileCubeTree(this.minLevel),this.tileMeshes=new Map,this.resource=[],this.luminance=null,this.imageOptions=r,this.fetcher=t,this.object=new TilingObject3D,this.object.renderOrder=-3}return n.prototype.setFetcher=function(t){this.fetcher=t},n.prototype.cleanup=function(){var t=this;this.tileMeshes.forEach(function(e){e.dispose(),t.object.remove(e),t.object.needsRender=!0}),this.tileMeshes.clear()},n.prototype.setRotation=function(t){this.disposed||this.object.quaternion.equals(t)||(this.object.quaternion.copy(t),this.object.needsRender=!0)},n.prototype.setPosition=function(t){this.disposed||this.object.position.equals(t)||(this.object.position.copy(t),this.object.needsRender=!0)},n.prototype.setResource=function(t,e){var r,o;if(!this.disposed&&!(this.resource===t&&this.luminance===e)){this.cleanup(),this.resource=t;var s=(o=(r=t.slice().sort(function(u,l){return l.level-u.level})[0])===null||r===void 0?void 0:r.level)!==null&&o!==void 0?o:0;this.tileTree=createTileCubeTree(s),this.luminance=e,this.object.needsRender=!0}},n.prototype.update=function(t,e,r){var o=this;if(!this.disposed){this.level=e;var s=t.planes[5].normal,u=[];e>=this.minLevel&&traverseTileCubeNode(this.tileTree,function(E){if(!(E.level<o.minLevel)){if(E.level>e||!t.intersectsBox(E.box))return!1;u.push(E)}}),u.sort(function(E,b){return E.level!==b.level?E.level-b.level:E.box.getCenter(sharedSortVector3).angleTo(s)-b.box.getCenter(sharedSortVector3).angleTo(s)});for(var l=new Set,c=function(E){var b=f.resource.filter(function(G){return G.level===E.level})[0];if(!b)return"continue";if(l.add(E),f.tileMeshes.has(E))return f.tileMeshes.get(E).activeTime=r,"continue";if(f.pedding>=f.maxRequest)return"continue";var T=b.size,_=f.imageOptions.transform,R=Math.pow(2,E.level)*E.position.y,S=Math.pow(2,E.level)*E.position.x,M="".concat(f.panoId,".").concat(E.face,".").concat(E.level,".").concat(R,".").concat(S),B=__assign(__assign({key:"pano_tile.".concat(M)},pick(f.imageOptions,["format","size","quality","sharpen","mappings"])),{size:b.scale>=1?void 0:T*E.size*b.scale,cut:[T*E.position.x,T*E.position.y,T*E.size,T*E.size]}),H=f.textureLoader.loadTexture(b[E.face],{imageURL:{transform:_,options:B},minFilter:THREE__namespace.LinearFilter,magFilter:THREE__namespace.LinearFilter,generateMipmaps:!1,fetcher:f.fetcher}).then(function(G){return G.body}),w=null;if(f.luminance){var C=f.luminance[E.face],L=C.match(/\/cube_(\d+)\//),I=L?Number(L[1]):!1;if(I!==!1){var F=b.size*b.scale/2,k=F*E.size,N=I<F?C.replace(/\/cube_(\d+)\//,"cube_"+F):C,D=__assign(__assign({},B),{size:I*E.size===k?void 0:k,cut:[I*E.position.x,I*E.position.y,I*E.size,I*E.size],key:"pano_tile_luminance.".concat(M)});w=f.textureLoader.loadTexture(N,{imageURL:{transform:f.imageOptions.transform,options:D},minFilter:THREE__namespace.LinearFilter,magFilter:THREE__namespace.LinearFilter,fetcher:f.fetcher}).then(function(G){return G.body}).catch(function(){return null})}}f.pedding++;var U=Promise.all([H,w]).then(function(G){return o.pedding--,G},function(G){return o.pedding--,Promise.reject(G)}),z=new TileMesh(E,U);z.name="tiling:tile-".concat(M),z.activeTime=r,z.renderOrder=E.level,f.tileMeshes.set(E,z),f.object.needsRender=!0,f.object.add(z)},f=this,d=0,p=u;d<p.length;d++){var v=p[d];c(v)}var g=[];this.tileMeshes.forEach(function(E,b){l.has(b)||g.push(b),E.visible=b.level<=e});for(var h=g.sort(function(E,b){var T,_,R,S;return((_=(T=o.tileMeshes.get(b))===null||T===void 0?void 0:T.activeTime)!==null&&_!==void 0?_:0)-((S=(R=o.tileMeshes.get(E))===null||R===void 0?void 0:R.activeTime)!==null&&S!==void 0?S:0)}).slice(Math.max(0,MAX_TILE_COUNT-l.size)),m=0,y=h;m<y.length;m++){var v=y[m],A=this.tileMeshes.get(v);A&&(A.dispose(),this.object.remove(A),this.object.needsRender=!0),this.tileMeshes.delete(v)}}},n.prototype.dispose=function(){this.cleanup(),this.resource=[],this.disposed=!0},n.DEFAULT_MAX_REQUEST=3,n}(),vertices$1=new Float32Array([-1,1,1,-1,1,-1,-1,-1,1,-1,-1,-1,1,1,-1,1,1,1,1,-1,-1,1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,-1,1,-1,-1,1,1,-1,-1,-1,-1,-1,1,1,1,-1,1,1,1,-1,1,-1,-1,1,-1,1,-1,1,1,-1,-1,-1,-1,1,-1,-1]),index$1=new Uint8Array([0,2,1,2,3,1,4,6,5,6,7,5,8,10,9,10,11,9,12,14,13,14,15,13,16,18,17,18,19,17,20,22,21,22,23,21]),sharedGeometry$1=new THREE__namespace.BufferGeometry;sharedGeometry$1.setAttribute("position",new THREE__namespace.BufferAttribute(vertices$1,3)),sharedGeometry$1.setIndex(new THREE__namespace.BufferAttribute(index$1,1));var PANO_VIDEO_MATERIAL_VERTEX_SHADER=`
|
|
1562
1562
|
#if defined(USE_PANO_VIDEO)
|
|
1563
1563
|
varying vec3 worldPosition;
|
|
1564
1564
|
#endif
|
|
@@ -1593,7 +1593,7 @@ void main() {
|
|
|
1593
1593
|
gl_FragColor = vec4(videoColor.rgb, match * blendAlpha * alpha);
|
|
1594
1594
|
#endif
|
|
1595
1595
|
}
|
|
1596
|
-
`,PanoVideo=function(){function n(){this.material=new THREE__namespace.ShaderMaterial({vertexShader:PANO_VIDEO_MATERIAL_VERTEX_SHADER,fragmentShader:PANO_VIDEO_TILE_MATERIAL_FRAGMENT_SHADER,uniforms:{size:new THREE__namespace.Uniform(null),matrix:new THREE__namespace.Uniform(null),alpha:new THREE__namespace.Uniform(null),map:new THREE__namespace.Uniform(null)},depthTest:!1,depthWrite:!1,defines:{USE_PANO_VIDEO:!1},blending:THREE__namespace.CustomBlending,blendSrc:THREE__namespace.SrcAlphaFactor,blendDst:THREE__namespace.OneMinusSrcAlphaFactor,blendSrcAlpha:THREE__namespace.OneFactor,blendDstAlpha:THREE__namespace.OneMinusSrcAlphaFactor}),this.object=new THREE__namespace.Mesh(sharedGeometry$1,this.material),this.object.visible=!1,this.object.renderOrder=-1,this.object.frustumCulled=!1,this.object.name="pano-video",this.alphaMotion=new Motion({alpha:0})}return n.prototype.setMaterial=function(t){t?(this.material.uniforms.size.value=t.size,this.material.uniforms.matrix.value=t.matrix,this.material.uniforms.map.value=t.map,this.alphaMotion.set({alpha:t.alpha},500).catch(noop$1),this.material.uniforms.alpha.value=t.alpha):(this.material.uniforms.size.value=null,this.material.uniforms.matrix.value=null,this.material.uniforms.map.value=null,this.alphaMotion.set({alpha:0},0).catch(noop$1));var e=t!==null,r=this.material.defines.USE_PANO_VIDEO;e!==r&&(this.material.defines.USE_PANO_VIDEO=e,this.material.needsUpdate=!0,this.object.visible=t!==null)},n.prototype.updateTime=function(t){this.alphaMotion.ended||(this.alphaMotion.update(t),this.material.uniforms.alpha.value=this.alphaMotion.value.alpha)},n.prototype.dispose=function(){this.material.dispose()},n}(),ROTATE_Y_PI_MATRIX$1=new THREE__namespace.Matrix4().makeRotationAxis(new THREE__namespace.Vector3(0,1,0),Math.PI),PANO_TEXTURE_SCALE$1=new THREE__namespace.Vector3(-1,1,1),CubeRenderTargetPool=function(){function n(t){t===void 0&&(t=0),this.width=t,this.pool=[]}return Object.defineProperty(n.prototype,"size",{get:function(){return this.pool.length},enumerable:!1,configurable:!0}),n.prototype.create=function(){return new THREE__namespace.WebGLCubeRenderTarget(this.width,{stencilBuffer:!1,depthBuffer:!1})},n.prototype.pop=function(){var t=this.pool.pop();return t||this.create()},n.prototype.push=function(t){this.pool.indexOf(t)===-1&&this.pool.push(t)},n.prototype.clear=function(){for(var t=0,e=this.pool;t<e.length;t++){var r=e[t];r.dispose()}this.pool.length=0},n}(),PanoramaController=function(n){__extends(t,n);function t(e){var r=this,o,s,u,l,c=t.parseArgs(e);r=n.call(this,c)||this,r.TILED_CUBE_TEXTURE_LEVEL=2,r.mode="Panorama",r.tileLevel=0,r.initAnimationed=!1,r.maxAccessibleDistance=c.maxAccessibleDistance,r.panoTapTriggerRadius=c.panoTapTriggerRadius,r.panoCircleMeshCreator=c.panoCircleMeshCreator,r.tileLevelForFov=c.tileLevelForFov,r.tileMaxRequest=c.tileMaxRequest,r.luminanceAdaptiveEffectEnable=c.luminanceAdaptiveEffectEnable,r.luminanceAdaptiveEffect=new LuminanceAdaptiveEffect(r.renderer,r.modelScene,r.camera,r.models),r.colorCubeRenderTargetPool=new CubeRenderTargetPool,r.luminanceCubeRenderTargetPool=new CubeRenderTargetPool;var f=r.models.getMaterial()||{},d=f.pano0,p=f.pano1;d&&(p==null?void 0:p.map)!==d.map&&(r.models.setMaterial({pano0:p}),d.map.dispose(),d.map instanceof TileCubeTextureTarget&&d.map.cubeRenderTarget&&r.colorCubeRenderTargetPool.push(d.map.cubeRenderTarget),d.luminanceMap&&(d.luminanceMap.dispose(),d.luminanceMap instanceof TileCubeTextureTarget&&d.luminanceMap.cubeRenderTarget&&r.luminanceCubeRenderTargetPool.push(d.luminanceMap.cubeRenderTarget)));for(var v=r.colorCubeRenderTargetPool.size;v<2;v++){var g=Math.max(1024*r.TILED_CUBE_TEXTURE_LEVEL,512),h=r.colorCubeRenderTargetPool.create();h.setSize(g,g),renderCubeTextureToCubeRenderTarget(null,h,r.renderer),r.colorCubeRenderTargetPool.push(h)}r.panoMeshes={},r.updatePanoMeshes(),r.locationMotion=new Motion({count:0,distance:r.camera.pose.distance}),r.modelAlphaMotion=new Motion({modelAlpha:(s=(o=r.models.getMaterial())===null||o===void 0?void 0:o.modelAlpha)!==null&&s!==void 0?s:0}),r.perspToOrthoMotion=new Motion({perspToOrtho:r.camera.perspToOrtho.x}),r.panoResources={},r.panoResources[r.locationMotion.keyframes[0].key=r.locationMotion.keyframes[1].key=createUuid()]={panoId:panoStringify(r.currentPano),panoPicture:(l=(u=r.models.getMaterial())===null||u===void 0?void 0:u.pano1)!==null&&l!==void 0?l:null,position:r.camera.pose.offset.clone(),effect:"fly",fixCameraTransform:new THREE__namespace.Matrix4};var m=r.works.getResolvedObserver(r.currentPano);return r.textureLoader=new TextureLoader,r.tiling=new Tiling(m?getFetcher(m.work):internalFetcher,r.TILED_CUBE_TEXTURE_LEVEL+1,r.imageOptions),r.scene.add(r.tiling.object),r.panoVideo=new PanoVideo,r.scene.add(r.panoVideo.object),r}return t.parseArgs=function(e){var r,o,s,u,l,c;if(e instanceof t)return e;var f=n.parseArgs.call(this,e);return __assign(__assign({},f),{maxAccessibleDistance:(r=e.maxAccessibleDistance)!==null&&r!==void 0?r:5,panoTapTriggerRadius:(o=e.panoTapTriggerRadius)!==null&&o!==void 0?o:.5,panoCircleMeshCreator:(s=e.panoCircleMeshCreator)!==null&&s!==void 0?s:function(d){return new PanoCircleMesh},tileLevelForFov:(u=e.tileLevelForFov)!==null&&u!==void 0?u:function(d,p){var v=function(A){return A/Math.PI*180},g=function(A){return A/180*Math.PI},h=p.height/2/Math.tan(g(d/2)),m=p.width>p.height?d:v(Math.atan(Math.tan(g(d/2))*(p.width/p.height))*2);m*=.9;var y=h*(Math.tan(g(m/2))-Math.tan(g(m/2-1)));return y>80?5:y>60?4:y>40?3:y>18?2:y>12?1:0},tileMaxRequest:(l=e.tileMaxRequest)!==null&&l!==void 0?l:3,luminanceAdaptiveEffectEnable:(c=e.luminanceAdaptiveEffectEnable)!==null&&c!==void 0?c:!0})},t.initAnimationEndState=function(e){var r=this.parseArgs(e),o=n.initAnimationEndState.call(this,r);return __assign(__assign({},o),{mode:"Panorama"})},t.prototype.destroy=function(){var e,r;if(n.prototype.destroy.call(this),this.scene.remove(this.tiling.object),this.tiling.dispose(),this.locationMotion.dispose(),this.colorCubeRenderTargetPool.clear(),this.luminanceCubeRenderTargetPool.clear(),delete this.pendingTextureTask,this.panoMeshes)for(var o=Object.keys(this.panoMeshes),s=0,u=o;s<u.length;s++){var l=u[s],c=this.panoMeshes[l];this.helper.remove(c),c.dispose(),delete this.panoMeshes[l]}var f=this.videoTexture.image;f.pause(),f.oncanplay=function(){},f.ontimeupdate=function(){},this.scene.remove(this.panoVideo.object),this.panoVideo.setMaterial(null),this.panoVideo.dispose();for(var d=(e=this.models.getMaterial())!==null&&e!==void 0?e:{},p=d.pano0,v=d.pano1,g=0,h=Object.keys(this.panoResources);g<h.length;g++){var m=h[g],y=this.panoResources[m];if(y.panoPicture){var A=y.panoPicture.map;A&&A!==(p==null?void 0:p.map)&&A!==(v==null?void 0:v.map)&&(A.dispose(),(r=y.panoPicture.luminanceMap)===null||r===void 0||r.dispose(),y.panoPicture=null)}delete this.panoResources[m]}this.luminanceAdaptiveEffect.dispose()},t.prototype.isReady=function(){return this.locationMotion.ended!==!0?!1:n.prototype.isReady.call(this)},t.prototype.isTileReady=function(){var e,r,o,s=this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[this.locationMotion.keyframes.length-1]),u=((e=s.panoPicture)===null||e===void 0?void 0:e.map)instanceof TileCubeTextureTarget&&(o=(r=s.panoPicture)===null||r===void 0?void 0:r.map.tilePending)!==null&&o!==void 0?o:0,l=this.tiling.pedding;return this.initAnimationed&&u<=0&&l<=0},t.prototype.updateWork=function(e,r,o,s){var u=this;this.userAction=s,this.works=e;var l=t.initAnimationEndState(__assign(__assign({},this),{initial:{currentState:__assign(__assign({},this.currentPano),this.camera.pose),duration:o.duration,effect:o.effect,state:r,userAction:s}})),c={workCode:l.workCode,panoIndex:l.panoIndex},f=this.works.getWork(c.workCode);return this.tiling.setFetcher(f?getFetcher(f):internalFetcher),this.tiling.cleanup(),this.initAnimationed=!1,this.hideIntersectMesh(),this.updatePanoMeshes(),this.moveToPano(c,{effect:o.effect,duration:o.duration,longitude:r.longitude,latitude:r.latitude,fov:r.fov,moveEndCallback:function(){u.initAnimationed=!0},moveCancelCallback:function(){u.initAnimationed=!0}},s),!0},t.prototype.updateModel=function(e){this.models=e,this.updatePanoMeshes()},t.prototype.updateTime=function(e,r){var o=this,s,u,l,c,f,d,p,v,g,h;if(!this.destroyed){var m={},y={},A=this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[0]),E=this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[this.locationMotion.keyframes.length-1]),b=!1;if(this.cameraMotion.ended===!1&&(this.cameraMotion.update(e),y.longitude=this.cameraMotion.value.longitude,y.latitude=this.cameraMotion.value.latitude,y.fov=this.cameraMotion.value.fov),this.modelAlphaMotion.ended===!1&&(this.modelAlphaMotion.update(e),m.modelAlpha=this.modelAlphaMotion.value.modelAlpha),this.perspToOrthoMotion.ended===!1&&(this.perspToOrthoMotion.update(e),this.camera.perspToOrtho.setScalar(clamp$1(this.perspToOrthoMotion.value.perspToOrtho,0,1))),this.locationMotion.ended===!1){this.locationMotion.update(e);var T=this.locationMotion.getKeyFrameSegment(e),_=T[0],R=T[1],S=this.panoResourceFromLocationMotionKeyframe(_),M=this.panoResourceFromLocationMotionKeyframe(R),B=new THREE__namespace.Vector3().copy(S.position),H=new THREE__namespace.Vector3().copy(M.position),w=this.locationMotion.value.count-R.value.count+1;m.progress=w,M.panoPicture&&(w<1?S.panoPicture&&(m.pano0=S.panoPicture):m.pano0=M.panoPicture,m.pano1=M.panoPicture),M.effect==="montage"?m.transition="BLACK":M.effect==="spread"?m.transition="SPREAD":m.transition="FADE",(M.effect==="zoomin"||M.effect==="zoomout")&&(m.progress=Math.pow(w,3)),w<1&&M.effect!=="fly"&&(m.pano0&&S.panoPicture&&(m.pano0={map:m.pano0.map,zoom:m.pano0.zoom,luminanceMap:m.pano0.luminanceMap,matrix:S.panoPicture.matrix.clone().premultiply(S.fixCameraTransform).setPosition(M.position)}),B.copy(H),b=!0),y.distance=this.locationMotion.value.distance,y.offset=new THREE__namespace.Vector3(B.x+(H.x-B.x)*w,B.y+(H.y-B.y)*w,B.z+(H.z-B.z)*w);for(var C=[],L=[],I=0,F=this.locationMotion.keyframes;I<F.length;I++){var k=F[I],N=k.key,D=k.progress;N!==void 0&&(C.push(N),D>this.locationMotion.progress&&L.push(N))}for(var U=0,Q=Object.keys(this.panoResources);U<Q.length;U++){var q=Q[U];if(!(L.indexOf(q)>=0)){var G=this.panoResources[q];if(G.panoPicture){var J=G.panoPicture.map,X=G.panoPicture.luminanceMap;if(J){if(J===((s=m.pano0)===null||s===void 0?void 0:s.map)||J===((u=m.pano1)===null||u===void 0?void 0:u.map))continue;J instanceof TileCubeTextureTarget&&J.cubeRenderTarget&&this.colorCubeRenderTargetPool.push(J.cubeRenderTarget),J.dispose(),X&&(X instanceof TileCubeTextureTarget&&X.cubeRenderTarget&&this.luminanceCubeRenderTargetPool.push(X.cubeRenderTarget),X.dispose()),G.panoPicture=null}}C.indexOf(q)>=0||delete this.panoResources[q]}}this.currentPano=panoParse(M.panoId),this.emit("pano.moving",createEvent("pano.moving",{userAction:this.userAction,prevPano:panoParse(A.panoId),state:__assign(__assign(__assign(__assign({},panoParse(E.panoId)),{mode:this.mode}),clonePose(this.camera.pose)),y),options:{},progress:this.locationMotion.progress,error:null}))}isEmptyObject(m)===!1&&(!((l=m.pano0)===null||l===void 0)&&l.map&&m.pano0.map instanceof TileCubeTextureTarget&&!m.pano0.map.cubeRenderTarget&&(m.pano0.map.cubeRenderTarget=this.colorCubeRenderTargetPool.pop()),!((c=m.pano0)===null||c===void 0)&&c.luminanceMap&&m.pano0.luminanceMap instanceof TileCubeTextureTarget&&!m.pano0.luminanceMap.cubeRenderTarget&&(m.pano0.luminanceMap.cubeRenderTarget=this.luminanceCubeRenderTargetPool.pop()),!((f=m.pano1)===null||f===void 0)&&f.map&&m.pano1.map instanceof TileCubeTextureTarget&&!m.pano1.map.cubeRenderTarget&&(m.pano1.map.cubeRenderTarget=this.colorCubeRenderTargetPool.pop()),!((d=m.pano1)===null||d===void 0)&&d.luminanceMap&&m.pano1.luminanceMap instanceof TileCubeTextureTarget&&!m.pano1.luminanceMap.cubeRenderTarget&&(m.pano1.luminanceMap.cubeRenderTarget=this.luminanceCubeRenderTargetPool.pop()),this.models.setMaterial(m)),isEmptyObject(y)===!1&&this.setCamera(y);var W=this.works.getResolvedObserver(this.currentPano),j=this.locationMotion.ended?this.getForwardObserverOrNot():null;if(this.camera.pose.distance>.1||b)for(var te=0,$=Object.keys(this.panoMeshes);te<$.length;te++){var ne=$[te],ie=this.panoMeshes[ne];ie.setOpacity(0),ie.setCurrent(!1),ie.updateTime&&ie.updateTime(e,r),ie.visible=!1}else if(W){var oe=arrayMin(W.visibleIds,function(be){var pe=o.works.getResolvedObserver(be);return pe?W.standingPosition.distanceTo(pe.standingPosition):1/0},!0),Z=oe[1];Z=clamp$1(Z,2.5,1/0);for(var de=W.visibleIds.concat(panoStringify(this.currentPano)),he=this.camera.getDirection(new THREE__namespace.Vector3),fe=0,Te=Object.keys(this.panoMeshes);fe<Te.length;fe++){var ne=Te[fe],ie=this.panoMeshes[ne],ce=this.works.getResolvedObserver(ne);if(de.indexOf(ne)===-1)ie.setCurrent(!1),ie.setOpacity(0);else if(!ce)ie.setCurrent(!1),ie.setOpacity(0);else if(!ce.loadable&&!ce.active)ie.setCurrent(!1),ie.setOpacity(0);else{var ge=ie.position.clone().setY(this.camera.position.y).distanceTo(this.camera.position);ie.setCurrent(!ie.loading&&ie.progress===0&&j!==null&&j.panoId===ne),ie.setOpacity(ge<.01?0:clamp$1(Z/ge*1.2,.4,.85));var ee=this.camera.position.clone().setY(ie.position.y),re=new THREE__namespace.Vector3().copy(ie.position).sub(ee).normalize();if(ne===panoStringify(this.currentPano)){var z=clamp$1((.5-ee.distanceTo(ie.position))/.5,0,1);re.multiplyScalar(1-z).add(he.clone().multiplyScalar(z))}re.length()>0&&ie.quaternion.setFromEuler(new THREE__namespace.Euler(0,Math.atan2(re.x,re.z),0))}ie.updateTime&&ie.updateTime(e,r)}}var Re=this.tileLevel=function(){if(o.tileLevelForFov===!1)return 0;var be=o.renderer.getDrawingBufferSize(new THREE__namespace.Vector2);be.width*=o.scissor.width,be.height*=o.scissor.height;var pe=E.panoId,ae=o.works.getResolvedObserver(pe),ue=o.imageOptions.size;if(typeof ue=="undefined"&&ae){var Se=ae.images.up.match(/\/cube_(\d+)\//);Se&&(ue=Number(Se[1]))}typeof ue=="undefined"&&(ue=2048);var le=0;ue>=1024&&(le=1),ue>=2048&&(le=2),ue>=4096&&(le=3),ue>=8192&&(le=4);var Ie=o.tileLevelForFov(o.camera.fov,be);return Ie>le?Ie:0}(),ve=function(){var be=o.camera.quaternion.clone(),pe=o.works.getResolvedObserver(E.panoId),ae=pe!=null?pe:W;ae&&be.premultiply(ae.quaternion.clone().inverse());var ue=new THREE__namespace.Matrix4().makeRotationFromQuaternion(be),Se=new THREE__namespace.Matrix4().getInverse(ue),le=new THREE__namespace.Frustum().setFromProjectionMatrix(new THREE__namespace.Matrix4().multiplyMatrices(o.camera.projectionMatrix,Se));return le}();E.panoId===panoStringify(this.currentPano)&&(((p=E.panoPicture)===null||p===void 0?void 0:p.map)instanceof TileCubeTextureTarget&&(E.panoPicture.map.maxRequest=this.tileMaxRequest,E.panoPicture.map.update(ve,Re),E.panoPicture.map.needsRender===!0&&(E.panoPicture.map.needsRender=!1,this.needsRender=!0,this.modelSceneNeedsRender=!0)),((v=E.panoPicture)===null||v===void 0?void 0:v.luminanceMap)instanceof TileCubeTextureTarget&&(E.panoPicture.luminanceMap.maxRequest=this.tileMaxRequest,E.panoPicture.luminanceMap.update(ve,Re),E.panoPicture.luminanceMap.needsRender===!0&&(E.panoPicture.luminanceMap.needsRender=!1,this.needsRender=!0,this.modelSceneNeedsRender=!0)));{var me=this.tiling.object.visible;if(this.initAnimationed){var we=E.panoId,ye=this.works.getResolvedObserver(we);ye?isSimilarVector3(this.camera.position,ye.position)&&this.locationMotion.ended?(this.tiling.object.visible=!0,this.tiling.panoId!==we&&this.tiling.cleanup(),this.tiling.panoId=we,this.tiling.setResource((h=(g=ye.images)===null||g===void 0?void 0:g.tiles)!==null&&h!==void 0?h:[],this.enableIOSEDR&&ye.images.luminance?ye.images.luminance:null),this.tiling.setFetcher(getFetcher(ye.work)),this.tiling.setRotation(ye.quaternion),this.tiling.setPosition(ye.position),this.tiling.maxRequest=this.tileMaxRequest,Re>this.TILED_CUBE_TEXTURE_LEVEL?this.tiling.update(ve,Re,e):this.tiling.update(ve,0,e)):this.tiling.object.visible=!1:this.tiling.object.visible=!1}else this.tiling.object.visible=!1;me!==this.tiling.object.visible&&(this.tiling.object.needsRender=!0,this.modelSceneNeedsRender=!0)}this.panoVideo.object.position.copy(this.camera.position),this.panoVideo.updateTime(e),this.intersectMesh.scale.setScalar(clamp$1(this.cameraMotion.value.fov/45,0,1))}},t.prototype.render=function(e,r){var o=this.renderer.getRenderTarget(),s=this.works.getResolvedObserver(this.currentPano);s&&s.video&&(this.needsRender=!0,this.modelSceneNeedsRender=!0),this.updateScreenBuffer(r),e&&(r==="luminance"?(this.luminanceAdaptiveEffect.enable=this.luminanceAdaptiveEffectEnable,this.luminanceAdaptiveEffect.render(this.screenBuffers)):(this.renderer.setRenderTarget(this.modelRenderTarget),this.renderer.render(this.modelScene,this.camera))),this.depthCopyPass.render(this.modelRenderTarget.depthTexture,o),this.renderer.autoClearDepth=!1,this.renderer.autoClearColor=!0,this.copyPass.render(this.modelRenderTarget,o),this.renderer.setRenderTarget(o),this.renderer.autoClearColor=!1,this.renderer.autoClearDepth=!1,this.renderer.render(this.scene,this.camera),this.renderer.autoClearColor=!0,this.renderer.autoClearDepth=!0},t.prototype.postProcessing=function(e,r){if(!this.destroyed&&r==="luminance")return this.luminanceAdaptiveEffect||(this.luminanceAdaptiveEffect=new LuminanceAdaptiveEffect(this.renderer,this.scene,this.camera,this.models),this.luminanceAdaptiveEffect.enable=this.luminanceAdaptiveEffectEnable),this.luminanceAdaptiveEffect.render(e)},t.prototype.getTargetState=function(){var e=this.cameraMotion.getKeyFrameSegment(now())[1],r=this.locationMotion.getKeyFrameSegment(now())[1],o=this.panoResourceFromLocationMotionKeyframe(r),s=this.works.getResolvedObserver(o.panoId);return{workCode:s?s.work.workCode:this.currentPano.workCode,panoIndex:s?s.panoIndex:this.currentPano.panoIndex,mode:this.mode,longitude:e.value.longitude,latitude:e.value.latitude,fov:e.value.fov,offset:s?s.position.clone():this.camera.position.clone(),distance:this.locationMotion.value.distance}},t.prototype.moveToPano=function(e,r,o){var s=this,u,l,c,f,d=(u=r.effect)!==null&&u!==void 0?u:"fly";this.userAction=o,this.stopMomentumMovement();var p=this.works.getResolvedObserver(e);if(!p)throw new Error("Invalid PanoId ".concat(JSON.stringify(e)));var v=getImageSizeFromURL(p.images.up),g=this.imageOptions.size;typeof g=="undefined"&&p&&v&&(g=Number(v)),typeof g=="undefined"&&(g=2048);var h=this.imageOptions.transform,m=__assign({key:"pano.".concat(p.panoId)},pick(this.imageOptions,["format","size","quality","sharpen","mappings"])),y=p.images,A=(c=(l=p.images.tiles)===null||l===void 0?void 0:l.filter(function(F){return F.size>g}))!==null&&c!==void 0?c:null,E=h,b={key:"pano_luminance.".concat(p.panoId),size:m.size?m.size/2:void 0},T=this.enableIOSEDR&&p.images.luminance?p.images.luminance:null,_=function(){if(!p.images.tiles||!T)return null;var F=getImageSizeFromURL(T.up);return F?A==null?void 0:A.map(function(k){var N=k.size*k.scale/2;return F<N?{level:k.level,size:N,scale:1,back:replaceImageSize(T.back,N),front:replaceImageSize(T.front,N),left:replaceImageSize(T.left,N),right:replaceImageSize(T.right,N),up:replaceImageSize(T.up,N),down:replaceImageSize(T.down,N)}:{level:k.level,size:F,scale:N/F,back:T.back,front:T.front,left:T.left,right:T.right,up:T.up,down:T.down}}):null}(),R="pano:"+jsonHash([y,m,h]);if(this.pendingTextureTask){if(this.pendingTextureTask.hash===R)return;var S=this.pendingTextureTask.panoId;(f=this.panoMeshes[S])===null||f===void 0||f.setProgress(0),this.emit("pano.texture.abort",createEvent("pano.texture.abort",{error:null,progress:0,meta:null,pano:p.pano}))}var M="move-to-pano-"+p.panoId;this.pending.add(M);var B=this.models.getMaterial()||{},H=B.pano0,w=B.pano1,C;if(H&&H.map.name===R&&H.luminanceMap!==null===this.enableIOSEDR?C=H:(w==null?void 0:w.map.name)===R&&w.luminanceMap!==null===this.enableIOSEDR&&(C=w),C){var L={panoId:p.panoId,effect:d,panoPicture:{zoom:1,map:C.map,luminanceMap:C.luminanceMap,matrix:new THREE__namespace.Matrix4().compose(p.position,p.quaternion,PANO_TEXTURE_SCALE$1)},position:p.position.clone(),fixCameraTransform:new THREE__namespace.Matrix4};AnimationFrameLoop.shared.add(function(){s.pending.delete(M),s.doMoveToPano(p.pano,L,r)},!0,1);return}this.pendingTextureTask={panoId:p.panoId,hash:R,onLoad:function(F,k){var N;if(s.pending.delete(M),s.destroyed)F.body.dispose();else{F.body.name=R;var D={panoId:p.panoId,effect:d,panoPicture:{zoom:1,map:F.body,luminanceMap:(N=k==null?void 0:k.body)!==null&&N!==void 0?N:null,matrix:new THREE__namespace.Matrix4().compose(p.position,p.quaternion,PANO_TEXTURE_SCALE$1)},position:p.position.clone(),fixCameraTransform:new THREE__namespace.Matrix4};s.doMoveToPano(p.pano,D,r)}},onError:function(F){s.pending.delete(M);var k=__assign(__assign(__assign({},p.pano),{mode:s.mode}),clonePose(s.camera.pose));s.emit("pano.error",createEvent("pano.error",{error:F,userAction:s.userAction,options:r,prevPano:s.currentPano,progress:0,state:k})),s.emit("pano.cancel",createEvent("pano.cancel",{error:F,userAction:s.userAction,options:r,prevPano:s.currentPano,progress:0,state:k})),s.emit("error",F),r.moveCancelCallback&&r.moveCancelCallback()}};var I=this.panoMeshes[p.panoId];I&&I.tap&&I.tap(),Promise.all([this.tileLevelForFov&&A&&A.length?this.textureLoader.loadTiledCubeTexture(y,A,{tileMaxLevel:this.TILED_CUBE_TEXTURE_LEVEL,imageURL:{transform:h,options:m},minFilter:THREE__namespace.LinearFilter,magFilter:THREE__namespace.LinearFilter,generateMipmaps:!1,format:THREE__namespace.RGBAFormat,viaAjax:!0,fetcher:getFetcher(p.work)},void 0,void 0,function(F){var k,N;s.emit("pano.texture.progress",createEvent("pano.texture.progress",{error:null,progress:F,meta:null,pano:p.pano})),((k=s.pendingTextureTask)===null||k===void 0?void 0:k.hash)===R&&((N=s.panoMeshes[p.panoId])===null||N===void 0||N.setProgress(F))},this.renderer):this.textureLoader.loadCubeTexture(y,{imageURL:{transform:h,options:m},format:THREE__namespace.RGBAFormat,viaAjax:!0,fetcher:getFetcher(p.work)},void 0,void 0,function(F){var k,N;s.emit("pano.texture.progress",createEvent("pano.texture.progress",{error:null,progress:F,meta:null,pano:p.pano})),((k=s.pendingTextureTask)===null||k===void 0?void 0:k.hash)===R&&((N=s.panoMeshes[p.panoId])===null||N===void 0||N.setProgress(F))},this.renderer),T?this.tileLevelForFov&&_&&_.length?this.textureLoader.loadTiledCubeTexture(T,_,{tileMaxLevel:this.TILED_CUBE_TEXTURE_LEVEL,imageURL:{transform:E,options:b},minFilter:THREE__namespace.LinearFilter,magFilter:THREE__namespace.LinearFilter,generateMipmaps:!1,fetcher:getFetcher(p.work)},void 0,void 0,void 0,this.renderer).catch(function(){return null}):this.textureLoader.loadCubeTexture(T,{imageURL:{transform:E,options:b},fetcher:getFetcher(p.work)},void 0,void 0,void 0,this.renderer).catch(function(){return null}):Promise.resolve(null)]).then(function(F){var k,N,D=F[0],U=F[1];((k=s.pendingTextureTask)===null||k===void 0?void 0:k.hash)===R?(s.pendingTextureTask.onLoad(D,U),(N=s.panoMeshes[p.panoId])===null||N===void 0||N.setProgress(0),delete s.pendingTextureTask,s.emit("pano.texture.success",createEvent("pano.texture.success",{error:null,progress:1,meta:D.meta,pano:p.pano}))):(D.body.dispose(),U==null||U.body.dispose())}).catch(function(F){var k,N;((k=s.pendingTextureTask)===null||k===void 0?void 0:k.hash)===R&&(s.pendingTextureTask.onError(F),(N=s.panoMeshes[p.panoId])===null||N===void 0||N.setProgress(0),delete s.pendingTextureTask,s.emit("pano.texture.error",createEvent("pano.texture.error",{error:F,progress:0,meta:null,pano:p.pano})),s.emit("error",F))}),this.emit("pano.texture.load",createEvent("pano.texture.load",{error:null,progress:0,meta:null,pano:p.pano}))},t.prototype.initAnimation=function(){var e=this;return this.destroyed?Promise.resolve():new Promise(function(r){var o=e.initial,s=o.duration,u=o.effect,l=o.userAction;e.userAction=l;var c=t.initAnimationEndState(e),f={workCode:c.workCode,panoIndex:c.panoIndex},d={modelAlpha:0},p={perspToOrtho:0},v=!1;e.moveToPano(f,{longitude:c.longitude,latitude:c.latitude,fov:c.fov,effect:u,duration:s,moveStartCallback:function(g){v=!0,e.perspToOrthoMotion.set(p,s).catch(noop$1),e.modelAlphaMotion.setKeyframes([{progress:0,value:__assign({},e.modelAlphaMotion.value)},{progress:.6,value:__assign({},e.modelAlphaMotion.value)},{progress:1,value:d}],s).catch(noop$1),e.emit("initAnimation.start",createEvent("initAnimation.start",{state:g,userAction:e.userAction}))},moveEndCallback:function(g){e.emit("initAnimation.end",createEvent("initAnimation.end",{state:g,userAction:e.userAction})),e.initAnimationed=!0,r()},moveCancelCallback:function(){var g=__assign(__assign(__assign({},f),{mode:e.mode}),clonePose(e.camera.pose));v===!1&&e.emit("initAnimation.start",createEvent("initAnimation.start",{state:g,userAction:e.userAction})),e.emit("initAnimation.end",createEvent("initAnimation.end",{state:g,userAction:e.userAction})),e.initAnimationed=!0,r()}},l)})},t.prototype.panoResourceFromLocationMotionKeyframe=function(e){return this.panoResources[e.key]},t.prototype.locationMotionKeyframesLength=function(e){for(var r=0,o=1;o<e.length;o++){var s=this.panoResourceFromLocationMotionKeyframe(e[o-1]).position,u=this.panoResourceFromLocationMotionKeyframe(e[o]).position,l=s.distanceTo(u)*(e[o].value.count-e[o-1].value.count);r+=l}return r},t.prototype.updatePanoMeshes=function(){for(var e=this,r={},o=Object.keys(this.panoMeshes),s=0,u=o;s<u.length;s++){var l=u[s],c=this.panoMeshes[l];r[l]=c,delete this.panoMeshes[l]}for(var f=1,d={},p=function(R){var S=arrayMin(R.accessibleIds,function(B){var H=e.works.getResolvedObserver(B);if(!H)return 1/0;var w=H.standingPosition.distanceTo(R.standingPosition);return clamp$1(w,1,1/0)},!0),M=S[1];d[R.panoId]===void 0&&(d[R.panoId]=M)},v=0,g=this.works.resolvedObservers;v<g.length;v++){var h=g[v];p(h)}var m=Object.keys(d).map(function(R){return d[R]});if(m.length){var y=m.reduce(function(R,S){return R+S},0)/m.length;f=clamp$1(y*.6,1,3)}for(var A=0,E=this.works.resolvedObservers;A<E.length;A++){var h=E[A],c=void 0;r[h.panoId]?(c=r[h.panoId],c.loading===!0&&h.loadable===!1&&c.setLoading(!1),delete r[h.panoId]):(c=this.panoCircleMeshCreator(h.pano),c.name="PanoCircleMesh_"+h.panoId,this.helper.add(c)),c.scale.set(f,1,f),c.position.copy(h.standingPosition),this.panoMeshes[h.panoId]=c}for(var b=0,T=Object.keys(r);b<T.length;b++){var _=T[b];this.helper.remove(r[_]),r[_].dispose(),delete r[_]}},t.prototype.doMoveToPano=function(e,r,o){var s=this,u,l,c,f,d,p,v,g,h,m,y;o===void 0&&(o={});var A=now(),E=createUuid();this.tiling.cleanup(),this.panoResources[E]=r;var b=1,T,_,R;if(this.locationMotion.ended){var S=this.locationMotion.getKeyFrameSegment(A);S[0];var M=S[1],B=this.locationMotion.value,H=((u=this.panoResourceFromLocationMotionKeyframe(M))!==null&&u!==void 0?u:this.camera).position,w=r.position;T=Math.max(H.distanceTo(w),b),_=[{key:M.key,progress:0,value:__assign(__assign({},B),{count:0})},{key:E,progress:1,value:{distance:0,count:1}}],R=0}else{var C=this.locationMotion.getKeyFrameSegment(A),L=C[0],M=C[1],B=this.locationMotion.value,I=this.panoResourceFromLocationMotionKeyframe(L).position,H=this.panoResourceFromLocationMotionKeyframe(M).position,w=r.position,F=M.value.count-B.count,k=Math.max(I.distanceTo(H),b)*F,N=Math.max(H.distanceTo(w),b);T=k+N,_=[{key:L.key,progress:0,value:__assign({},B)},{key:M.key,progress:k/T,value:M.value},{key:E,progress:1,value:{count:M.value.count+1,distance:0}}];var D=this.locationMotionKeyframesLength(this.locationMotion.keyframes),U=this.locationMotionKeyframesLength(_);D===0||D===0?R=0:R=this.locationMotion.getProgressVelocity(A)*D/U}var Q=r.effect==="instant"?0:this.calculateMovingDuration(o.duration,r.effect==="fly"?T:0),q={longitude:o.longitude,latitude:o.latitude,fov:o.fov},G=__assign(__assign({},e),{mode:this.mode,longitude:(l=q.longitude)!==null&&l!==void 0?l:this.camera.pose.longitude,latitude:(c=q.latitude)!==null&&c!==void 0?c:this.camera.pose.latitude,fov:(f=q.fov)!==null&&f!==void 0?f:this.camera.pose.fov,offset:r.position.clone(),distance:this.camera.pose.distance}),J=this.currentPano;if(this.emit("pano.moveTo",createEvent("pano.moveTo",{options:o,prevPano:J,progress:0,state:G,userAction:this.userAction,error:null})),o.moveStartCallback&&o.moveStartCallback(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=noop$1,this.videoTexture.needsUpdate=!0),this.panoVideo.setMaterial(null),r.effect==="fly")this.cameraMotion.set(q,Q).catch(noop$1);else{var X=coordinatesToVector({longitude:this.cameraMotion.value.longitude,latitude:this.cameraMotion.value.latitude}),W=coordinatesToVector({longitude:(d=q.longitude)!==null&&d!==void 0?d:this.cameraMotion.value.longitude,latitude:(p=q.latitude)!==null&&p!==void 0?p:this.cameraMotion.value.latitude}),j=new THREE__namespace.Object3D;j.lookAt(X);var te=new THREE__namespace.Matrix4().makeRotationFromQuaternion(j.quaternion);j.lookAt(W);var $=new THREE__namespace.Matrix4().makeRotationFromQuaternion(j.quaternion),ne=new THREE__namespace.Matrix4().getInverse(te).premultiply($),ie=this.cameraMotion.value.fov,oe=(v=q.fov)!==null&&v!==void 0?v:this.cameraMotion.value.fov,Z=1;r.effect==="zoomin"?Z=1.5:r.effect==="zoomout"&&(Z=.4);for(var de=clamp$1(oe*Z,1,170),he=0;he<_.length-1;he++){var fe=_[he].key;if(fe){var Te=this.panoResources[fe];Te&&(Te.fixCameraTransform.copy(ne),Te.panoPicture&&(Te.panoPicture.zoom=Math.tan(ie/2/180*Math.PI)/Math.tan(de/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:(g=q.longitude)!==null&&g!==void 0?g:this.cameraMotion.value.longitude,latitude:(h=q.latitude)!==null&&h!==void 0?h:this.cameraMotion.value.latitude,fov:de}},{progress:1,value:{longitude:(m=q.longitude)!==null&&m!==void 0?m:this.cameraMotion.value.longitude,latitude:(y=q.latitude)!==null&&y!==void 0?y:this.cameraMotion.value.latitude,fov:oe}}],Q).catch(noop$1)}var ce=this.locationMotion.setKeyframes(_,Q,R);ce.then(function(){for(var ge,ee,re=0,z=s.models;re<z.length;re++){var Re=z[re];Re.show()}var ve=__assign(__assign({},e),{mode:s.mode,longitude:s.camera.pose.longitude,latitude:s.camera.pose.latitude,fov:s.camera.pose.fov,offset:s.camera.pose.offset.clone(),distance:s.camera.pose.distance});s.emit("pano.arrived",createEvent("pano.arrived",{options:o,prevPano:J,progress:1,state:ve,userAction:s.userAction,error:null})),o.moveEndCallback&&o.moveEndCallback(ve);var me=s.works.getResolvedObserver(e);if(me&&me.video&&s.videoTexture&&s.videoTexture.image instanceof HTMLVideoElement){var we=ROTATE_Y_PI_MATRIX$1.clone().multiply((ee=(ge=s.models.getMaterial().pano1)===null||ge===void 0?void 0:ge.matrix)!==null&&ee!==void 0?ee:new THREE__namespace.Matrix4).multiply(me.video.matrix),ye={map:s.videoTexture,size:me.video.size,matrix:we,alpha:1},be=createUuid(),pe=s.videoTexture.image;pe.setAttribute("uuid",be),canplayVideo().then(function(ae){ae&&me.video&&pe.getAttribute("uuid")===be&&(pe.oncanplay=function(){pe.oncanplay=noop$1,pe.play()},pe.ontimeupdate=function(){pe.currentTime>.5&&(pe.ontimeupdate=noop$1,s.panoVideo.setMaterial(ye))},pe.src=me.video.source)}).catch(function(){pe.removeAttribute("uuid")})}},function(){s.emit("pano.cancel",createEvent("pano.cancel",{options:o,prevPano:J,progress:0,state:G,userAction:s.userAction,error:null})),o.moveCancelCallback&&o.moveCancelCallback()})},t.prototype.getForwardObserverOrNot=function(e){var r=this,o=this.works.getResolvedObserver(this.currentPano);if(!o)return null;var s=e!=null?e:new THREE__namespace.Raycaster(this.camera.position.clone(),this.camera.getDirection(new THREE__namespace.Vector3));s.params.Points={threshold:.1};var u=o.standingPosition.clone();if(o.position.distanceTo(s.ray.origin)>1){var l=this.models.intersectRaycaster(new THREE__namespace.Raycaster(s.ray.origin,new THREE__namespace.Vector3(0,-1,0)))[0];l&&l.distance<=2?u.copy(l.point):u.copy(s.ray.origin).add(new THREE__namespace.Vector3(0,-1.5,0))}var c=this.models.intersectRaycaster(s)[0],f=c?c.point:s.ray.origin.clone().add(s.ray.direction.clone().normalize().multiplyScalar(3)),d=f.clone().sub(u).normalize();if(d.length()===0)return null;for(var p=o.accessibleIds.filter(function(_){if(_===panoStringify(r.currentPano))return!1;var R=r.works.getResolvedObserver(_);if(!R)return!1;var S=R.standingPosition.clone().project(r.camera);return Math.abs(S.z)>1||Math.abs(S.x)>1||Math.abs(S.y)>1?!1:R.loadable||R.active}),v=p.slice().sort(function(_,R){var S=r.works.getResolvedObserver(_).standingPosition.clone().distanceTo(u),M=r.works.getResolvedObserver(R).standingPosition.clone().distanceTo(u);return S-M}),g=0,h=[Math.PI/8,Math.PI/6,Math.PI/4,Math.PI/3];g<h.length;g++)for(var m=h[g],y=0,A=v;y<A.length;y++){var E=A[y],b=this.works.getResolvedObserver(E);if(b){var T=b.standingPosition.clone().sub(u);if(T&&T.length()!==0&&d.angleTo(T)<m)return b}}return null},t.prototype.onTapGesture=function(e){var r=this,o;if(this.userAction=e.userAction,this.stopMomentumMovement(),!!this.initAnimationed){if(!this.locationMotion.ended){var s=this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[this.locationMotion.keyframes.length-1]);if(s.panoId!==panoStringify(this.currentPano))return}var u=e.center.raycaster,l=this.camera.getDirection(new THREE__namespace.Vector3).setY(0),c=null,f=this.works.getResolvedObserver(this.currentPano);if(f){var d=f.accessibleIds.filter(function(U){if(U===panoStringify(r.currentPano))return!1;var Q=r.works.getResolvedObserver(U);return!Q||Q.position.distanceTo(r.camera.position)>r.maxAccessibleDistance?!1:Q.loadable||Q.active}),p=this.models.intersectRaycaster(u)[0];if(p){var v=arrayMin(d,function(U){var Q=r.works.getResolvedObserver(U);if(!Q)return 1/0;var q=Q.standingPosition.clone();return q.distanceTo(p.point)},!0),g=v[0],h=v[1];g&&h<this.panoTapTriggerRadius&&(c=(o=this.works.getResolvedObserver(g))!==null&&o!==void 0?o:null)}c||(c=this.getForwardObserverOrNot(u));for(var m=0,y=this.locationMotion.keyframes;m<y.length;m++){var A=y[m],E=this.panoResourceFromLocationMotionKeyframe(A);if(!(A.progress<this.locationMotion.progress)&&c&&E.panoId===c.panoId){c=null;break}}if(!c)this.emit("gesture.tap",e),e.defaultPrevented||this.locationMotion.ended===!0&&this.cameraBounce();else{for(var b={},T=Math.PI/6,_=Math.PI/12,R=c.position.clone().setY(0).sub(f.position.clone().setY(0)).normalize(),S=[],M=[],B=[],H=0,w=c.accessibleIds;H<w.length;H++){var g=w[H],C=panoParse(g);if(!(panoEqual(C,this.currentPano)||panoEqual(C,c.pano))){var L=this.works.getResolvedObserver(g);if(L){var I=L.position.clone().sub(c.position).setY(0);R.angleTo(I)<T&&B.push(I)}}}var F=B.length>0?B:__spreadArray(__spreadArray([],S,!0),M,!0),k=F.slice().sort(function(U,Q){return U.angleTo(R)-Q.angleTo(R)})[0];k&&k.angleTo(l)>_&&(b.longitude=Math.atan2(-k.x,-k.z)),this.cameraMotion.value.latitude<-Math.PI/4&&(b.latitude=clamp$1(0,this.minLatitude,this.maxLatitude));var N=__assign({},e.state);if(N.workCode=c.pano.workCode,N.panoIndex=c.pano.panoIndex,b.longitude!==void 0&&(N.longitude=b.longitude),b.latitude!==void 0&&(N.latitude=b.latitude),b.fov!==void 0&&(N.fov=b.fov),N.distance=0,N.offset=c.position.clone(),e.state=N,this.emit("gesture.tap",e),!e.defaultPrevented){if(this.emit("pano.select",createEvent("pano.select",{prevPano:this.currentPano,state:N,userAction:e.userAction,options:b,progress:0,error:null})),c&&!c.active){var D=c.panoId;this.panoMeshes[D]&&(this.panoMeshes[D].setDisabled(!1),this.panoMeshes[D].setLoading(!0))}c&&c.active&&this.emit("pano.request",createEvent("pano.request",{userAction:e.userAction,prevPano:this.currentPano,progress:0,state:N,options:b,error:null}))}}}}},t}(PanoramaLikeController),DEG_TO_RAD=Math.PI/180,RAD_TO_DEG=180/Math.PI,MIN_TIMESTEP=.001,MAX_TIMESTEP=1,isIOS=function(){var n=typeof navigator!="undefined"&&/iPad|iPhone|iPod/.test(navigator.platform);return function(){return n}}(),isSafari=function(){var n=typeof navigator!="undefined"&&/^((?!chrome|android).)*safari/i.test(navigator.userAgent);return function(){return n}}(),isFirefoxAndroid=function(){var n=typeof navigator!="undefined"&&navigator.userAgent.indexOf("Firefox")!==-1&&navigator.userAgent.indexOf("Android")!==-1;return function(){return n}}(),getChromeVersion=function(){var n=typeof navigator!="undefined"?navigator.userAgent.match(/.*Chrome\/([0-9]+)/):null,t=n?parseInt(n[1],10):null;return function(){return t}}(),isChromeWithoutDeviceMotion=function(){var n=!1;if(getChromeVersion()===65){var t=typeof navigator!="undefined"?navigator.userAgent.match(/.*Chrome\/([0-9\.]*)/):null;if(t){var e=t[1].split(".");e[0],e[1];var r=e[2],o=e[3];n=parseInt(r,10)===3325&&parseInt(o,10)<148}}return function(){return n}}(),isSafariWithoutDeviceMotion=function(){var n=isIOS()&&isSafari()&&typeof navigator!="undefined"&&navigator.userAgent.indexOf("13_4")!==-1;return function(){return n}}(),isR7=function(){var n=typeof navigator!="undefined"&&navigator.userAgent.indexOf("R7 Build")!==-1;return function(){return n}}();function isLandscapeMode(){var n=typeof window!="undefined"&&(window.orientation==90||window.orientation==-90);return isR7()?!n:n}function isTimestampDeltaValid(n){return!(isNaN(n)||n<=MIN_TIMESTEP||n>MAX_TIMESTEP)}function getQuaternionAngle(n){if(n.w>1)return 0;var t=2*Math.acos(n.w);return t}var warnOnce=function(){var n={};return function(t,e){n[t]===void 0&&(console.warn("cardboard: "+e),n[t]=!0)}}();function getOriginFromUrl(n){var t,e=n.indexOf("://");e!==-1?t=e+3:t=0;var r=n.indexOf("/",t);return r===-1&&(r=n.length),n.substring(0,r)}function isInsideCrossOriginIFrame(){if(typeof window=="undefined"||typeof document=="undefined")return!1;var n=window.self!==window.top,t=getOriginFromUrl(document.referrer),e=getOriginFromUrl(window.location.href);return n&&t!==e}var updateEyeViewMatrices=function(){function n(r,o,s){var u=o?o[0]:0,l=o?o[1]:0,c=o?o[2]:0,f=o?o[3]:1,d=u+u,p=l+l,v=c+c,g=u*d,h=u*p,m=u*v,y=l*p,A=l*v,E=c*v,b=f*d,T=f*p,_=f*v;return r[0]=1-(y+E),r[1]=h+_,r[2]=m-T,r[3]=0,r[4]=h-_,r[5]=1-(g+E),r[6]=A+b,r[7]=0,r[8]=m+T,r[9]=A-b,r[10]=1-(g+y),r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function t(r,o,s){var u=s[0],l=s[1],c=s[2],f,d,p,v,g,h,m,y,A,E,b,T;return o===r?(r[12]=o[0]*u+o[4]*l+o[8]*c+o[12],r[13]=o[1]*u+o[5]*l+o[9]*c+o[13],r[14]=o[2]*u+o[6]*l+o[10]*c+o[14],r[15]=o[3]*u+o[7]*l+o[11]*c+o[15]):(f=o[0],d=o[1],p=o[2],v=o[3],g=o[4],h=o[5],m=o[6],y=o[7],A=o[8],E=o[9],b=o[10],T=o[11],r[0]=f,r[1]=d,r[2]=p,r[3]=v,r[4]=g,r[5]=h,r[6]=m,r[7]=y,r[8]=A,r[9]=E,r[10]=b,r[11]=T,r[12]=f*u+g*l+A*c+o[12],r[13]=d*u+h*l+E*c+o[13],r[14]=p*u+m*l+b*c+o[14],r[15]=v*u+y*l+T*c+o[15]),r}function e(r,o){var s=o[0],u=o[1],l=o[2],c=o[3],f=o[4],d=o[5],p=o[6],v=o[7],g=o[8],h=o[9],m=o[10],y=o[11],A=o[12],E=o[13],b=o[14],T=o[15],_=s*d-u*f,R=s*p-l*f,S=s*v-c*f,M=u*p-l*d,B=u*v-c*d,H=l*v-c*p,w=g*E-h*A,C=g*b-m*A,L=g*T-y*A,I=h*b-m*E,F=h*T-y*E,k=m*T-y*b,N=_*k-R*F+S*I+M*L-B*C+H*w;return N?(N=1/N,r[0]=(d*k-p*F+v*I)*N,r[1]=(l*F-u*k-c*I)*N,r[2]=(E*H-b*B+T*M)*N,r[3]=(m*B-h*H-y*M)*N,r[4]=(p*L-f*k-v*C)*N,r[5]=(s*k-l*L+c*C)*N,r[6]=(b*S-A*H-T*R)*N,r[7]=(g*H-m*S+y*R)*N,r[8]=(f*F-d*L+v*w)*N,r[9]=(u*L-s*F-c*w)*N,r[10]=(A*B-E*S+T*_)*N,r[11]=(h*S-g*B-y*_)*N,r[12]=(d*C-f*I-p*w)*N,r[13]=(s*I-u*C+l*w)*N,r[14]=(E*R-A*M-b*_)*N,r[15]=(g*M-h*R+m*_)*N,r):null}return function(r,o,s){n(r,o),s&&t(r,r,s),e(r,r)}}(),SensorSample=function(){function n(t,e){t===void 0&&(t=new THREE__namespace.Vector3),e===void 0&&(e=0),this.sample=t,this.timestampS=e}return n.prototype.set=function(t,e){this.sample=t,this.timestampS=e},n.prototype.copy=function(t){this.set(t.sample,t.timestampS)},n}(),ComplementaryFilter=function(){function n(t,e){this.kFilter=t,this.isDebug=e,this.currentAccelMeasurement=new SensorSample,this.currentGyroMeasurement=new SensorSample,this.previousGyroMeasurement=new SensorSample,isIOS()?this.filterQ=new THREE__namespace.Quaternion(-1,0,0,1):this.filterQ=new THREE__namespace.Quaternion(1,0,0,1),this.previousFilterQ=new THREE__namespace.Quaternion,this.previousFilterQ.copy(this.filterQ),this.accelQ=new THREE__namespace.Quaternion,this.isOrientationInitialized=!1,this.estimatedGravity=new THREE__namespace.Vector3,this.measuredGravity=new THREE__namespace.Vector3,this.gyroIntegralQ=new THREE__namespace.Quaternion}return n.prototype.addAccelMeasurement=function(t,e){this.currentAccelMeasurement.set(t,e)},n.prototype.addGyroMeasurement=function(t,e){this.currentGyroMeasurement.set(t,e);var r=e-this.previousGyroMeasurement.timestampS;isTimestampDeltaValid(r)&&this.run_(),this.previousGyroMeasurement.copy(this.currentGyroMeasurement)},n.prototype.getOrientation=function(){return this.filterQ},n.prototype.run_=function(){if(!this.isOrientationInitialized){this.accelQ=this.accelToQuaternion_(this.currentAccelMeasurement.sample),this.previousFilterQ.copy(this.accelQ),this.isOrientationInitialized=!0;return}var t=this.currentGyroMeasurement.timestampS-this.previousGyroMeasurement.timestampS,e=this.gyroToQuaternionDelta_(this.currentGyroMeasurement.sample,t);this.gyroIntegralQ.multiply(e),this.filterQ.copy(this.previousFilterQ),this.filterQ.multiply(e);var r=new THREE__namespace.Quaternion;r.copy(this.filterQ),r.inverse(),this.estimatedGravity.set(0,0,-1),this.estimatedGravity.applyQuaternion(r),this.estimatedGravity.normalize(),this.measuredGravity.copy(this.currentAccelMeasurement.sample),this.measuredGravity.normalize();var o=new THREE__namespace.Quaternion;o.setFromUnitVectors(this.estimatedGravity,this.measuredGravity),o.inverse(),this.isDebug&&console.log("Delta: %d deg, G_est: (%s, %s, %s), G_meas: (%s, %s, %s)",RAD_TO_DEG*getQuaternionAngle(o),this.estimatedGravity.x.toFixed(1),this.estimatedGravity.y.toFixed(1),this.estimatedGravity.z.toFixed(1),this.measuredGravity.x.toFixed(1),this.measuredGravity.y.toFixed(1),this.measuredGravity.z.toFixed(1));var s=new THREE__namespace.Quaternion;s.copy(this.filterQ),s.multiply(o),this.filterQ.slerp(s,1-this.kFilter),this.previousFilterQ.copy(this.filterQ)},n.prototype.accelToQuaternion_=function(t){var e=new THREE__namespace.Vector3;e.copy(t),e.normalize();var r=new THREE__namespace.Quaternion;return r.setFromUnitVectors(new THREE__namespace.Vector3(0,0,-1),e),r.inverse(),r},n.prototype.gyroToQuaternionDelta_=function(t,e){var r=new THREE__namespace.Quaternion,o=new THREE__namespace.Vector3;return o.copy(t),o.normalize(),r.setFromAxisAngle(o,t.length()*e),r},n}(),PosePredictor=function(){function n(t,e){this.predictionTimeS=t,this.isDebug=e,this.previousQ=new THREE__namespace.Quaternion,this.previousTimestampS=null,this.deltaQ=new THREE__namespace.Quaternion,this.outQ=new THREE__namespace.Quaternion}return n.prototype.getPrediction=function(t,e,r){if(!this.previousTimestampS)return this.previousQ.copy(t),this.previousTimestampS=r,t;var o=new THREE__namespace.Vector3;o.copy(e),o.normalize();var s=e.length();if(s<DEG_TO_RAD*20)return this.isDebug&&console.log("Moving slowly, at %s deg/s: no prediction",(RAD_TO_DEG*s).toFixed(1)),this.outQ.copy(t),this.previousQ.copy(t),this.outQ;var u=s*this.predictionTimeS;return this.deltaQ.setFromAxisAngle(o,u),this.outQ.copy(this.previousQ),this.outQ.multiply(this.deltaQ),this.previousQ.copy(t),this.previousTimestampS=r,this.outQ},n}(),Distortion=function(){function n(t){this.coefficients=t}return n.prototype.distortInverse=function(t){for(var e=0,r=1,o=t-this.distort(e);Math.abs(r-e)>1e-4;){var s=t-this.distort(r),u=r-s*((r-e)/(s-o));e=r,r=u,o=s}return r},n.prototype.distort=function(t){for(var e=t*t,r=0,o=0;o<this.coefficients.length;o++)r=e*(r+this.coefficients[o]);return(r+1)*t},n}(),Pose=function(){function n(){this.angularAcceleration=null,this.angularVelocity=null,this.linearAcceleration=null,this.linearVelocity=null,this.orientation=null,this.position=null}return n}(),FieldOfView=function(){function n(){this.leftDegrees=0,this.rightDegrees=0,this.upDegrees=0,this.downDegrees=0}return n}(),Sensor=function(){function n(t,e,r,o){this.viewer={id:"CardboardV1",label:"Cardboard I/O 2014",fov:40,interLensDistance:.06,baselineLensDistance:.035,screenLensDistance:.042,distortionCoefficients:[.441,.156],inverseCoefficients:[-.4410035,.42756155,-.4804439,.5460139,-.58821183,.5733938,-.48303202,.33299083,-.17573841,.0651772,-.01488963,.001559834]},this.device={widthMeters:.11,heightMeters:.062,bevelMeters:.004},this.depthNear=.01,this.depthFar=1e4,this.yawOnly=r,this.accelerometer=new THREE__namespace.Vector3,this.gyroscope=new THREE__namespace.Vector3,this.filter=new ComplementaryFilter(t,o),this.posePredictor=new PosePredictor(e,o),this.isFirefoxAndroid=isFirefoxAndroid(),this.isIOS=isIOS();var s=getChromeVersion();this.isDeviceMotionInRadians=!this.isIOS&&s!==null&&s<66,this.isWithoutDeviceMotion=isChromeWithoutDeviceMotion()||isSafariWithoutDeviceMotion(),this.filterToWorldQ=new THREE__namespace.Quaternion,isIOS()?this.filterToWorldQ.setFromAxisAngle(new THREE__namespace.Vector3(1,0,0),Math.PI/2):this.filterToWorldQ.setFromAxisAngle(new THREE__namespace.Vector3(1,0,0),-Math.PI/2),this.inverseWorldToScreenQ=new THREE__namespace.Quaternion,this.worldToScreenQ=new THREE__namespace.Quaternion,this.originalPoseAdjustQ=new THREE__namespace.Quaternion;var u=typeof window!="undefined"?-window.orientation*Math.PI/180:0;this.originalPoseAdjustQ.setFromAxisAngle(new THREE__namespace.Vector3(0,0,1),u),this.setScreenTransform_(),isLandscapeMode()&&this.filterToWorldQ.multiply(this.inverseWorldToScreenQ),this.resetQ=new THREE__namespace.Quaternion,this.orientationOut_=new Float32Array(4),this.previousTimestampS=Date.now()}return n.prototype.getPosition=function(){return null},n.prototype.getOrientation=function(){var t;if(this.isWithoutDeviceMotion&&this._deviceOrientationQ){this.deviceOrientationFixQ=this.deviceOrientationFixQ||function(){var s=new THREE__namespace.Quaternion().setFromAxisAngle(new THREE__namespace.Vector3(0,0,-1),0),u=new THREE__namespace.Quaternion;return typeof window!="undefined"&&window.orientation===-90?u.setFromAxisAngle(new THREE__namespace.Vector3(0,1,0),Math.PI/-2):u.setFromAxisAngle(new THREE__namespace.Vector3(0,1,0),Math.PI/2),s.multiply(u)}(),this.deviceOrientationFilterToWorldQ=this.deviceOrientationFilterToWorldQ||function(){var s=new THREE__namespace.Quaternion;return s.setFromAxisAngle(new THREE__namespace.Vector3(1,0,0),-Math.PI/2),s}(),t=this._deviceOrientationQ;var e=new THREE__namespace.Quaternion;return e.copy(t),e.multiply(this.deviceOrientationFilterToWorldQ),e.multiply(this.resetQ),e.multiply(this.worldToScreenQ),e.multiplyQuaternions(this.deviceOrientationFixQ,e),this.yawOnly&&(e.x=0,e.z=0,e.normalize()),this.orientationOut_[0]=e.x,this.orientationOut_[1]=e.y,this.orientationOut_[2]=e.z,this.orientationOut_[3]=e.w,this.orientationOut_}else{var r=this.filter.getOrientation();t=this.posePredictor.getPrediction(r,this.gyroscope,this.previousTimestampS)}var o=new THREE__namespace.Quaternion;return o.copy(this.filterToWorldQ),o.multiply(this.resetQ),o.multiply(t),o.multiply(this.worldToScreenQ),this.yawOnly&&(o.x=0,o.z=0,o.normalize()),this.orientationOut_[0]=o.x,this.orientationOut_[1]=o.y,this.orientationOut_[2]=o.z,this.orientationOut_[3]=o.w,this.orientationOut_},n.prototype.getPose=function(){var t=new Pose;return t.orientation=this.getOrientation(),t},n.prototype.resetPose=function(){this.resetQ.copy(this.filter.getOrientation()),this.resetQ.x=0,this.resetQ.y=0,this.resetQ.z*=-1,this.resetQ.normalize(),isLandscapeMode()&&this.resetQ.multiply(this.inverseWorldToScreenQ),this.resetQ.multiply(this.originalPoseAdjustQ)},n.prototype.getFrameData=function(t){var e=this.getOrientation(),r=this.getEyeOffset(),o=this.getEyeProjectionMatrix();return t.pose.angularAcceleration=null,t.pose.angularVelocity=null,t.pose.linearAcceleration=null,t.pose.linearVelocity=null,t.pose.orientation=e,t.pose.position=null,t.timestamp=this.previousTimestampS,t.leftProjectionMatrix.set(o.left),t.rightProjectionMatrix.set(o.right),updateEyeViewMatrices(t.leftViewMatrix,e,r.left),updateEyeViewMatrices(t.rightViewMatrix,e,r.right),t},n.prototype.start=function(){if(typeof window=="undefined")return function(){};var t=this.onDeviceMotion_.bind(this),e=this.onOrientationChange_.bind(this),r=this.onMessage_.bind(this),o=this.onDeviceOrientation_.bind(this);return isIOS()&&isInsideCrossOriginIFrame()&&window.addEventListener("message",r),window.addEventListener("orientationchange",e),this.isWithoutDeviceMotion?window.addEventListener("deviceorientation",o):window.addEventListener("devicemotion",t),function(){window.removeEventListener("devicemotion",t),window.removeEventListener("deviceorientation",e),window.removeEventListener("orientationchange",e),window.removeEventListener("message",r)}},n.prototype.getEyeOffset=function(){return{left:[-this.viewer.interLensDistance*.5,0,0],right:[this.viewer.interLensDistance*.5,0,0]}},n.prototype.getEyeProjectionMatrix=function(){var t=this.getEyeFieldOfView(),e=this.depthNear,r=this.depthFar,o={left:[],right:[]};{var s=t.left.upDegrees*DEG_TO_RAD,u=t.left.downDegrees*DEG_TO_RAD,l=t.left.leftDegrees*DEG_TO_RAD,c=t.left.rightDegrees*DEG_TO_RAD,f=2/(l+c),d=2/(s+u);o.left[0]=f,o.left[1]=0,o.left[2]=0,o.left[3]=0,o.left[4]=0,o.left[5]=d,o.left[6]=0,o.left[7]=0,o.left[8]=-((l-c)*f*.5),o.left[9]=(s-u)*d*.5,o.left[10]=r/(e-r),o.left[11]=-1,o.left[12]=0,o.left[13]=0,o.left[14]=r*e/(e-r),o.left[15]=0}{var s=t.right.upDegrees*DEG_TO_RAD,u=t.right.downDegrees*DEG_TO_RAD,l=t.right.leftDegrees*DEG_TO_RAD,c=t.right.rightDegrees*DEG_TO_RAD,f=2/(l+c),d=2/(s+u);o.right[0]=f,o.right[1]=0,o.right[2]=0,o.right[3]=0,o.right[4]=0,o.right[5]=d,o.right[6]=0,o.right[7]=0,o.right[8]=-((l-c)*f*.5),o.right[9]=(s-u)*d*.5,o.right[10]=r/(e-r),o.right[11]=-1,o.right[12]=0,o.right[13]=0,o.right[14]=r*e/(e-r),o.right[15]=0}return o},n.prototype.getEyeFieldOfView=function(){var t=this.viewer,e=this.device,r=new Distortion(t.distortionCoefficients),o=t.screenLensDistance,s=(e.widthMeters-t.interLensDistance)/2,u=t.interLensDistance/2,l=t.baselineLensDistance-e.bevelMeters,c=e.heightMeters-l,f=RAD_TO_DEG*Math.atan(r.distort(s/o)),d=RAD_TO_DEG*Math.atan(r.distort(u/o)),p=RAD_TO_DEG*Math.atan(r.distort(l/o)),v=RAD_TO_DEG*Math.atan(r.distort(c/o)),g=new FieldOfView,h=new FieldOfView;return g.leftDegrees=Math.min(f,t.fov),g.rightDegrees=Math.min(d,t.fov),g.downDegrees=Math.min(p,t.fov),g.upDegrees=Math.min(v,t.fov),h.leftDegrees=g.rightDegrees,h.rightDegrees=g.leftDegrees,h.upDegrees=g.upDegrees,h.downDegrees=g.downDegrees,{left:g,right:h}},n.prototype.onDeviceOrientation_=function(t){this._deviceOrientationQ=this._deviceOrientationQ||new THREE__namespace.Quaternion;var e=t.alpha,r=t.beta,o=t.gamma;e=(e||0)*Math.PI/180,r=(r||0)*Math.PI/180,o=(o||0)*Math.PI/180,this._deviceOrientationQ.setFromEuler(new THREE__namespace.Euler(e,r,-o,"YXZ"))},n.prototype.onDeviceMotion_=function(t){this.updateDeviceMotion_(t)},n.prototype.updateDeviceMotion_=function(t){var e=t.accelerationIncludingGravity,r=t.rotationRate,o=t.timeStamp/1e3,s=o-this.previousTimestampS;if(s<0){warnOnce("fusion-pose-sensor:invalid:non-monotonic","Invalid timestamps detected: non-monotonic timestamp from devicemotion"),this.previousTimestampS=o;return}else if(s<=MIN_TIMESTEP||s>MAX_TIMESTEP){warnOnce("fusion-pose-sensor:invalid:outside-threshold","Invalid timestamps detected: Timestamp from devicemotion outside expected range."),this.previousTimestampS=o;return}e&&(this.accelerometer.set(-e.x,-e.y,-e.z),r&&(isR7()?this.gyroscope.set(-r.beta,r.alpha,r.gamma):this.gyroscope.set(r.alpha,r.beta,r.gamma),this.isDeviceMotionInRadians||this.gyroscope.multiplyScalar(Math.PI/180),this.filter.addGyroMeasurement(this.gyroscope,o)),this.filter.addAccelMeasurement(this.accelerometer,o)),this.previousTimestampS=o},n.prototype.onOrientationChange_=function(){this.setScreenTransform_()},n.prototype.onMessage_=function(t){var e=t.data;if(!(!e||!e.type)){var r=e.type.toLowerCase();r==="devicemotion"&&this.updateDeviceMotion_(e.deviceMotionEvent)}},n.prototype.setScreenTransform_=function(){this.worldToScreenQ.set(0,0,0,1);var t=typeof window!="undefined"?window.orientation:0;switch(t){case 0:break;case 90:this.worldToScreenQ.setFromAxisAngle(new THREE__namespace.Vector3(0,0,1),-Math.PI/2);break;case-90:this.worldToScreenQ.setFromAxisAngle(new THREE__namespace.Vector3(0,0,1),Math.PI/2);break}this.inverseWorldToScreenQ.copy(this.worldToScreenQ),this.inverseWorldToScreenQ.inverse()},n}(),defaultLeftBounds=[0,0,.5,1],defaultRightBounds=[.5,0,.5,1],Cardboard=function(){function n(t){var e=this;this.renderer=t,this.sensor=new Sensor(.98,.04,!1,!1),this.scale=1,this.cameraL=new THREE__namespace.PerspectiveCamera,this.cameraR=new THREE__namespace.PerspectiveCamera;var r=this.sensor.start();this.dispose=function(){var o=e.renderer.getSize(new THREE__namespace.Vector2);e.renderer.setScissor(0,0,o.width,o.height),e.renderer.setViewport(0,0,o.width,o.height),e.renderer.setScissorTest(!1),r()}}return n.prototype.render=function(t,e){var r=this.renderer.getSize(new THREE__namespace.Vector2);if(r.width>r.height){var o=t.autoUpdate;o&&(t.updateMatrixWorld(),t.autoUpdate=!1);var s={x:Math.round(r.width*defaultLeftBounds[0]),y:Math.round(r.height*defaultLeftBounds[1]),width:Math.round(r.width*defaultLeftBounds[2]),height:Math.round(r.height*defaultLeftBounds[3])},u={x:Math.round(r.width*defaultRightBounds[0]),y:Math.round(r.height*defaultRightBounds[1]),width:Math.round(r.width*defaultRightBounds[2]),height:Math.round(r.height*defaultRightBounds[3])};this.renderer.setScissorTest(!0),this.renderer.autoClear&&this.renderer.clear(),e.parent===null&&e.updateMatrixWorld(),e.matrixWorld.decompose(this.cameraL.position,this.cameraL.quaternion,this.cameraL.scale),e.matrixWorld.decompose(this.cameraR.position,this.cameraR.quaternion,this.cameraR.scale);var l=this.sensor.getEyeOffset();this.cameraL.translateOnAxis(new THREE__namespace.Vector3().fromArray(l.left),this.scale),this.cameraR.translateOnAxis(new THREE__namespace.Vector3().fromArray(l.right),this.scale);var c=this.sensor.getEyeProjectionMatrix();this.cameraL.projectionMatrix.elements=c.left.slice(),this.cameraR.projectionMatrix.elements=c.right.slice(),this.renderer.setViewport(s.x,s.y,s.width,s.height),this.renderer.setScissor(s.x,s.y,s.width,s.height),this.renderer.render(t,this.cameraL),this.renderer.setViewport(u.x,u.y,u.width,u.height),this.renderer.setScissor(u.x,u.y,u.width,u.height),this.renderer.render(t,this.cameraR),this.renderer.setViewport(0,0,r.width,r.height),this.renderer.setScissor(0,0,r.width,r.height),this.renderer.setScissorTest(!1),o&&(t.autoUpdate=!0)}else this.renderer.render(t,e)},n.prototype.dispose=function(){},n}();const cardboard="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASwAAADqCAMAAAAvZYhaAAAC/VBMVEUAAAD///99fX37+/v5+fn29vbx8fHv7+/Nzc3o6Ojq6urh4eHU1NTR0dGDg4Pl5eWSkpLHx8fj4+Pe3t7X19fAwMDZ2dnCwsKrq6uioqLb29uNjY2enp67u7t5eXmAgIC2traWlpa5ubnKysqmpqZycnKHh4eurq6ysrKKioqDg4Pd3d12dnb9/f1vb2/s7OxlZWXz8/OoqKiZmZlpaWmbm5teXl7W1tbJycnExMRiYmJsbGywsLCPj49aWlq9vb1UVFRYWFhra2t+fn7t7e1RUVFOTk6Dg4OAgICCgoKKioqEhISIiIhqamqCgoKIiIiQkJCIiIiWlpawsLBmZmaAgICenp6Li4uBgYGTk5OMjIyVlZWFhYWCgoKvr6+Ojo59fX2SkpKvr6+Ojo6QkJCurq6BgYGxsbF8fHx4eHitra2enp6srKyJiYmurq54eHj5+fl+fn57e3v////5+fnS0tLAwMCVlZWwsLCurq5QUFCtra2EhISUlJSwsLCUlJSUlJSlpaWVlZW3t7diYmLAwMCFhYV3d3f///+tra3///9XV1eampqnp6d8fHz///////9VVVVlZWVtbW3+/v5SUlKcnJytra28vLzGxsbR0dHX19doaGiWlpafn5/Hx8ezs7Nzc3Nubm7AwMCIiIjj4+NTU1P29vZbW1vl5eVkZGTMzMxYWFjq6upfX1/k5OT////4+PjV1dWkpKRoaGj4+Pizs7Pm5ubAwMCfn5+vr6+urq4wMDCxsbG2tra5ubliYmIuLi6zs7NHR0empqY0NDRCQkKqqqo5OTmoqKg7OztfX19dXV1oaGikpKRkZGStra0hISE/Pz89PT0pKSlmZmZJSUlERERbW1s2NjZVVVUmJia7u7uEhIRXV1dZWVlLS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4iCf4qxGrc7QwiiAW61PiaAFPLlfZC/7H6RV6H97MEDcFN1W9/WifBy0NcwDofmTXiE9NqCRqDO0CpFM40MV6oFou1C1ibRatHjGDahVtJgkZE0w5QqXJoQVko1y3Wpc0lGPOBaceJBA1ql93NSfHyCD9Uil512j97HfnM7/Ea8Wn96UkNQpV2U6V0tUAaXW7jNwYswYxdL94y7VqSoKFhWiMDXnUBaHBwoQT9Prx4Szm3TyRodLupoMJHH5LyK+9es8+l/CKvDytukQQND8FSlFIOreGM0/omiATVapVo12xd0jhExKW5294RAc40RVoftY47cd2LKtMOFwkajzuAeVOlIhfJeKahLyiWJRhLr3Ai2BVzQYKG4lLYXfg8HCSI33a2nTH5OaVWmzYHJGhsdLmDuN2exAonBTzZIuzEUS+ec0ZMBQn+Ea5KlXNI4C/UAO/k6hKwBptJgn8fgmVckgFXML9YEEFLUKMvlqAp0eWyDEAL65dLqyWo6RekTZ2XNCsD6rgpTK/4p3WcrrPH1ghWJGhONC3JoGAkRHH1JKjpNEcCxOV2I8MWyiUJqNVajSVodgiWcVMVLVeSS1ATCZoc88qjVKlSc3kSLJ5c5V6rTZQAcVkGbBeuOkgCgq2CBM3MoFwGr1tvim2aMpZZqyBBc3N1UF2GX90j9SQJKCBB83OfYAcNVjFcSrvzo95WOShB83Ody5V24fqzO0nAUSzB/89Nph38VqmuOa3gticJOP9fApuHTDt4nFJ7AXdPC0lg8/gq8y5XapSrgpUgbQ0JpF5u97hS1fOC26nlJJA8Yd41Sg3fU4dtRQkKeXSN3jo4Qqm0397OmyZOGatoDrScBIWM3DFn5kXi1ZyqRSUoZtKOa1vWKArztqgEnhIHty4f9/btuEstKwGkxf+XuCT5CbTFnFRuxktuAAAAAElFTkSuQmCC";var _a,LOCALE={zh:{TITLE:"眼镜模式",HIT:"请将手机横屏放入 VR 眼镜中"},en:{TITLE:"GLASSES MODE",HIT:"Please put the mobile phone horizontally into the VR glasses."},ja:{TITLE:"メガネモード",HIT:"携帯電話をVRメガネに水平に入れてください。"}},TEXT=typeof navigator!="undefined"&&(_a=LOCALE[navigator.language.split("-")[0]])!==null&&_a!==void 0?_a:LOCALE.zh,CONTENTS=`
|
|
1596
|
+
`,PanoVideo=function(){function n(){this.material=new THREE__namespace.ShaderMaterial({vertexShader:PANO_VIDEO_MATERIAL_VERTEX_SHADER,fragmentShader:PANO_VIDEO_TILE_MATERIAL_FRAGMENT_SHADER,uniforms:{size:new THREE__namespace.Uniform(null),matrix:new THREE__namespace.Uniform(null),alpha:new THREE__namespace.Uniform(null),map:new THREE__namespace.Uniform(null)},depthTest:!1,depthWrite:!1,defines:{USE_PANO_VIDEO:!1},blending:THREE__namespace.CustomBlending,blendSrc:THREE__namespace.SrcAlphaFactor,blendDst:THREE__namespace.OneMinusSrcAlphaFactor,blendSrcAlpha:THREE__namespace.OneFactor,blendDstAlpha:THREE__namespace.OneMinusSrcAlphaFactor}),this.object=new THREE__namespace.Mesh(sharedGeometry$1,this.material),this.object.visible=!1,this.object.renderOrder=-1,this.object.frustumCulled=!1,this.object.name="pano-video",this.alphaMotion=new Motion({alpha:0})}return n.prototype.setMaterial=function(t){t?(this.material.uniforms.size.value=t.size,this.material.uniforms.matrix.value=t.matrix,this.material.uniforms.map.value=t.map,this.alphaMotion.set({alpha:t.alpha},500).catch(noop$1),this.material.uniforms.alpha.value=t.alpha):(this.material.uniforms.size.value=null,this.material.uniforms.matrix.value=null,this.material.uniforms.map.value=null,this.alphaMotion.set({alpha:0},0).catch(noop$1));var e=t!==null,r=this.material.defines.USE_PANO_VIDEO;e!==r&&(this.material.defines.USE_PANO_VIDEO=e,this.material.needsUpdate=!0,this.object.visible=t!==null)},n.prototype.updateTime=function(t){this.alphaMotion.ended||(this.alphaMotion.update(t),this.material.uniforms.alpha.value=this.alphaMotion.value.alpha)},n.prototype.dispose=function(){this.material.dispose()},n}(),ROTATE_Y_PI_MATRIX$1=new THREE__namespace.Matrix4().makeRotationAxis(new THREE__namespace.Vector3(0,1,0),Math.PI),PANO_TEXTURE_SCALE$1=new THREE__namespace.Vector3(-1,1,1),CubeRenderTargetPool=function(){function n(t){t===void 0&&(t=0),this.width=t,this.pool=[]}return Object.defineProperty(n.prototype,"size",{get:function(){return this.pool.length},enumerable:!1,configurable:!0}),n.prototype.create=function(){return new THREE__namespace.WebGLCubeRenderTarget(this.width,{stencilBuffer:!1,depthBuffer:!1})},n.prototype.pop=function(){var t=this.pool.pop();return t||this.create()},n.prototype.push=function(t){this.pool.indexOf(t)===-1&&this.pool.push(t)},n.prototype.clear=function(){for(var t=0,e=this.pool;t<e.length;t++){var r=e[t];r.dispose()}this.pool.length=0},n}(),PanoramaController=function(n){__extends(t,n);function t(e){var r=this,o,s,u,l,c=t.parseArgs(e);r=n.call(this,c)||this,r.TILED_CUBE_TEXTURE_LEVEL=2,r.mode="Panorama",r.tileLevel=0,r.initAnimationed=!1,r.maxAccessibleDistance=c.maxAccessibleDistance,r.panoTapTriggerRadius=c.panoTapTriggerRadius,r.panoCircleMeshCreator=c.panoCircleMeshCreator,r.tileLevelForFov=c.tileLevelForFov,r.tileMaxRequest=c.tileMaxRequest,r.luminanceAdaptiveEffectEnable=c.luminanceAdaptiveEffectEnable,r.luminanceAdaptiveEffect=new LuminanceAdaptiveEffect(r.renderer,r.modelScene,r.camera,r.models),r.colorCubeRenderTargetPool=new CubeRenderTargetPool,r.luminanceCubeRenderTargetPool=new CubeRenderTargetPool;var f=r.models.getMaterial()||{},d=f.pano0,p=f.pano1;d&&(p==null?void 0:p.map)!==d.map&&(r.models.setMaterial({pano0:p}),d.map.dispose(),d.map instanceof TileCubeTextureTarget&&d.map.cubeRenderTarget&&r.colorCubeRenderTargetPool.push(d.map.cubeRenderTarget),d.luminanceMap&&(d.luminanceMap.dispose(),d.luminanceMap instanceof TileCubeTextureTarget&&d.luminanceMap.cubeRenderTarget&&r.luminanceCubeRenderTargetPool.push(d.luminanceMap.cubeRenderTarget)));for(var v=r.colorCubeRenderTargetPool.size;v<2;v++){var g=Math.max(1024*r.TILED_CUBE_TEXTURE_LEVEL,512),h=r.colorCubeRenderTargetPool.create();h.setSize(g,g),renderCubeTextureToCubeRenderTarget(null,h,r.renderer),r.colorCubeRenderTargetPool.push(h)}r.panoMeshes={},r.updatePanoMeshes(),r.locationMotion=new Motion({count:0,distance:r.camera.pose.distance}),r.modelAlphaMotion=new Motion({modelAlpha:(s=(o=r.models.getMaterial())===null||o===void 0?void 0:o.modelAlpha)!==null&&s!==void 0?s:0}),r.perspToOrthoMotion=new Motion({perspToOrtho:r.camera.perspToOrtho.x}),r.panoResources={},r.panoResources[r.locationMotion.keyframes[0].key=r.locationMotion.keyframes[1].key=createUuid()]={panoId:panoStringify(r.currentPano),panoPicture:(l=(u=r.models.getMaterial())===null||u===void 0?void 0:u.pano1)!==null&&l!==void 0?l:null,position:r.camera.pose.offset.clone(),effect:"fly",fixCameraTransform:new THREE__namespace.Matrix4};var m=r.works.getResolvedObserver(r.currentPano);return r.textureLoader=new TextureLoader,r.tiling=new Tiling(m?getFetcher(m.work):internalFetcher,r.TILED_CUBE_TEXTURE_LEVEL+1,r.imageOptions),r.scene.add(r.tiling.object),r.panoVideo=new PanoVideo,r.scene.add(r.panoVideo.object),r}return t.parseArgs=function(e){var r,o,s,u,l,c;if(e instanceof t)return e;var f=n.parseArgs.call(this,e);return __assign(__assign({},f),{maxAccessibleDistance:(r=e.maxAccessibleDistance)!==null&&r!==void 0?r:5,panoTapTriggerRadius:(o=e.panoTapTriggerRadius)!==null&&o!==void 0?o:.5,panoCircleMeshCreator:(s=e.panoCircleMeshCreator)!==null&&s!==void 0?s:function(d){return new PanoCircleMesh},tileLevelForFov:(u=e.tileLevelForFov)!==null&&u!==void 0?u:function(d,p){var v=function(A){return A/Math.PI*180},g=function(A){return A/180*Math.PI},h=p.height/2/Math.tan(g(d/2)),m=p.width>p.height?d:v(Math.atan(Math.tan(g(d/2))*(p.width/p.height))*2);m*=.9;var y=h*(Math.tan(g(m/2))-Math.tan(g(m/2-1)));return y>80?5:y>60?4:y>40?3:y>18?2:y>12?1:0},tileMaxRequest:(l=e.tileMaxRequest)!==null&&l!==void 0?l:3,luminanceAdaptiveEffectEnable:(c=e.luminanceAdaptiveEffectEnable)!==null&&c!==void 0?c:!0})},t.initAnimationEndState=function(e){var r=this.parseArgs(e),o=n.initAnimationEndState.call(this,r);return __assign(__assign({},o),{mode:"Panorama"})},t.prototype.destroy=function(){var e,r;if(n.prototype.destroy.call(this),this.scene.remove(this.tiling.object),this.tiling.dispose(),this.locationMotion.dispose(),this.colorCubeRenderTargetPool.clear(),this.luminanceCubeRenderTargetPool.clear(),delete this.pendingTextureTask,this.panoMeshes)for(var o=Object.keys(this.panoMeshes),s=0,u=o;s<u.length;s++){var l=u[s],c=this.panoMeshes[l];this.helper.remove(c),c.dispose(),delete this.panoMeshes[l]}var f=this.videoTexture.image;f.pause(),f.oncanplay=function(){},f.ontimeupdate=function(){},this.scene.remove(this.panoVideo.object),this.panoVideo.setMaterial(null),this.panoVideo.dispose();for(var d=(e=this.models.getMaterial())!==null&&e!==void 0?e:{},p=d.pano0,v=d.pano1,g=0,h=Object.keys(this.panoResources);g<h.length;g++){var m=h[g],y=this.panoResources[m];if(y.panoPicture){var A=y.panoPicture.map;A&&A!==(p==null?void 0:p.map)&&A!==(v==null?void 0:v.map)&&(A.dispose(),(r=y.panoPicture.luminanceMap)===null||r===void 0||r.dispose(),y.panoPicture=null)}delete this.panoResources[m]}this.luminanceAdaptiveEffect.dispose()},t.prototype.isReady=function(){return this.locationMotion.ended!==!0?!1:n.prototype.isReady.call(this)},t.prototype.isTileReady=function(){var e,r,o,s=this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[this.locationMotion.keyframes.length-1]),u=((e=s.panoPicture)===null||e===void 0?void 0:e.map)instanceof TileCubeTextureTarget&&(o=(r=s.panoPicture)===null||r===void 0?void 0:r.map.tilePending)!==null&&o!==void 0?o:0,l=this.tiling.pedding;return this.initAnimationed&&u<=0&&l<=0},t.prototype.updateWork=function(e,r,o,s){var u=this;this.userAction=s,this.works=e;var l=t.initAnimationEndState(__assign(__assign({},this),{initial:{currentState:__assign(__assign({},this.currentPano),this.camera.pose),duration:o.duration,effect:o.effect,state:r,userAction:s}})),c={workCode:l.workCode,panoIndex:l.panoIndex},f=this.works.getWork(c.workCode);return this.tiling.setFetcher(f?getFetcher(f):internalFetcher),this.tiling.cleanup(),this.initAnimationed=!1,this.hideIntersectMesh(),this.updatePanoMeshes(),this.moveToPano(c,{effect:o.effect,duration:o.duration,longitude:r.longitude,latitude:r.latitude,fov:r.fov,moveEndCallback:function(){u.initAnimationed=!0},moveCancelCallback:function(){u.initAnimationed=!0}},s),!0},t.prototype.updateModel=function(e){this.models=e,this.updatePanoMeshes()},t.prototype.updateTime=function(e,r){var o=this,s,u,l,c,f,d,p,v,g,h;if(!this.destroyed){var m={},y={},A=this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[0]),E=this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[this.locationMotion.keyframes.length-1]),b=!1;if(this.cameraMotion.ended===!1&&(this.cameraMotion.update(e),y.longitude=this.cameraMotion.value.longitude,y.latitude=this.cameraMotion.value.latitude,y.fov=this.cameraMotion.value.fov),this.modelAlphaMotion.ended===!1&&(this.modelAlphaMotion.update(e),m.modelAlpha=this.modelAlphaMotion.value.modelAlpha),this.perspToOrthoMotion.ended===!1&&(this.perspToOrthoMotion.update(e),this.camera.perspToOrtho.setScalar(clamp$1(this.perspToOrthoMotion.value.perspToOrtho,0,1))),this.locationMotion.ended===!1){this.locationMotion.update(e);var T=this.locationMotion.getKeyFrameSegment(e),_=T[0],R=T[1],S=this.panoResourceFromLocationMotionKeyframe(_),M=this.panoResourceFromLocationMotionKeyframe(R),B=new THREE__namespace.Vector3().copy(S.position),H=new THREE__namespace.Vector3().copy(M.position),w=this.locationMotion.value.count-R.value.count+1;m.progress=w,M.panoPicture&&(w<1?S.panoPicture&&(m.pano0=S.panoPicture):m.pano0=M.panoPicture,m.pano1=M.panoPicture),M.effect==="montage"?m.transition="BLACK":M.effect==="spread"?m.transition="SPREAD":m.transition="FADE",(M.effect==="zoomin"||M.effect==="zoomout")&&(m.progress=Math.pow(w,3)),w<1&&M.effect!=="fly"&&(m.pano0&&S.panoPicture&&(m.pano0={map:m.pano0.map,zoom:m.pano0.zoom,luminanceMap:m.pano0.luminanceMap,matrix:S.panoPicture.matrix.clone().premultiply(S.fixCameraTransform).setPosition(M.position)}),B.copy(H),b=!0),y.distance=this.locationMotion.value.distance,y.offset=new THREE__namespace.Vector3(B.x+(H.x-B.x)*w,B.y+(H.y-B.y)*w,B.z+(H.z-B.z)*w);for(var C=[],L=[],I=0,F=this.locationMotion.keyframes;I<F.length;I++){var k=F[I],N=k.key,D=k.progress;N!==void 0&&(C.push(N),D>this.locationMotion.progress&&L.push(N))}for(var U=0,z=Object.keys(this.panoResources);U<z.length;U++){var G=z[U];if(!(L.indexOf(G)>=0)){var q=this.panoResources[G];if(q.panoPicture){var K=q.panoPicture.map,j=q.panoPicture.luminanceMap;if(K){if(K===((s=m.pano0)===null||s===void 0?void 0:s.map)||K===((u=m.pano1)===null||u===void 0?void 0:u.map))continue;K instanceof TileCubeTextureTarget&&K.cubeRenderTarget&&this.colorCubeRenderTargetPool.push(K.cubeRenderTarget),K.dispose(),j&&(j instanceof TileCubeTextureTarget&&j.cubeRenderTarget&&this.luminanceCubeRenderTargetPool.push(j.cubeRenderTarget),j.dispose()),q.panoPicture=null}}C.indexOf(G)>=0||delete this.panoResources[G]}}this.currentPano=panoParse(M.panoId),this.emit("pano.moving",createEvent("pano.moving",{userAction:this.userAction,prevPano:panoParse(A.panoId),state:__assign(__assign(__assign(__assign({},panoParse(E.panoId)),{mode:this.mode}),clonePose(this.camera.pose)),y),options:{},progress:this.locationMotion.progress,error:null}))}isEmptyObject(m)===!1&&(!((l=m.pano0)===null||l===void 0)&&l.map&&m.pano0.map instanceof TileCubeTextureTarget&&!m.pano0.map.cubeRenderTarget&&(m.pano0.map.cubeRenderTarget=this.colorCubeRenderTargetPool.pop()),!((c=m.pano0)===null||c===void 0)&&c.luminanceMap&&m.pano0.luminanceMap instanceof TileCubeTextureTarget&&!m.pano0.luminanceMap.cubeRenderTarget&&(m.pano0.luminanceMap.cubeRenderTarget=this.luminanceCubeRenderTargetPool.pop()),!((f=m.pano1)===null||f===void 0)&&f.map&&m.pano1.map instanceof TileCubeTextureTarget&&!m.pano1.map.cubeRenderTarget&&(m.pano1.map.cubeRenderTarget=this.colorCubeRenderTargetPool.pop()),!((d=m.pano1)===null||d===void 0)&&d.luminanceMap&&m.pano1.luminanceMap instanceof TileCubeTextureTarget&&!m.pano1.luminanceMap.cubeRenderTarget&&(m.pano1.luminanceMap.cubeRenderTarget=this.luminanceCubeRenderTargetPool.pop()),this.models.setMaterial(m)),isEmptyObject(y)===!1&&this.setCamera(y);var W=this.works.getResolvedObserver(this.currentPano),X=this.locationMotion.ended?this.getForwardObserverOrNot():null;if(this.camera.pose.distance>.1||b)for(var ee=0,$=Object.keys(this.panoMeshes);ee<$.length;ee++){var re=$[ee],ie=this.panoMeshes[re];ie.setOpacity(0),ie.setCurrent(!1),ie.updateTime&&ie.updateTime(e,r),ie.visible=!1}else if(W){var se=arrayMin(W.visibleIds,function(he){var de=o.works.getResolvedObserver(he);return de?W.standingPosition.distanceTo(de.standingPosition):1/0},!0),ae=se[1];ae=clamp$1(ae,2.5,1/0);for(var fe=W.visibleIds.concat(panoStringify(this.currentPano)),ne=this.camera.getDirection(new THREE__namespace.Vector3),pe=0,_e=Object.keys(this.panoMeshes);pe<_e.length;pe++){var re=_e[pe],ie=this.panoMeshes[re],me=this.works.getResolvedObserver(re);if(fe.indexOf(re)===-1)ie.setCurrent(!1),ie.setOpacity(0);else if(!me)ie.setCurrent(!1),ie.setOpacity(0);else if(!me.loadable&&!me.active)ie.setCurrent(!1),ie.setOpacity(0);else{var xe=ie.position.clone().setY(this.camera.position.y).distanceTo(this.camera.position);ie.setCurrent(!ie.loading&&ie.progress===0&&X!==null&&X.panoId===re),ie.setOpacity(xe<.01?0:clamp$1(ae/xe*1.2,.4,.85));var Z=this.camera.position.clone().setY(ie.position.y),te=new THREE__namespace.Vector3().copy(ie.position).sub(Z).normalize();if(re===panoStringify(this.currentPano)){var Q=clamp$1((.5-Z.distanceTo(ie.position))/.5,0,1);te.multiplyScalar(1-Q).add(ne.clone().multiplyScalar(Q))}te.length()>0&&ie.quaternion.setFromEuler(new THREE__namespace.Euler(0,Math.atan2(te.x,te.z),0))}ie.updateTime&&ie.updateTime(e,r)}}var be=this.tileLevel=function(){if(o.tileLevelForFov===!1)return 0;var he=o.renderer.getDrawingBufferSize(new THREE__namespace.Vector2);he.width*=o.scissor.width,he.height*=o.scissor.height;var de=E.panoId,ce=o.works.getResolvedObserver(de),le=o.imageOptions.size;if(typeof le=="undefined"&&ce){var we=ce.images.up.match(/\/cube_(\d+)\//);we&&(le=Number(we[1]))}typeof le=="undefined"&&(le=2048);var ue=0;le>=1024&&(ue=1),le>=2048&&(ue=2),le>=4096&&(ue=3),le>=8192&&(ue=4);var ve=o.tileLevelForFov(o.camera.fov,he);return ve>ue?ve:0}(),ye=function(){var he=o.camera.quaternion.clone(),de=o.works.getResolvedObserver(E.panoId),ce=de!=null?de:W;ce&&he.premultiply(ce.quaternion.clone().inverse());var le=new THREE__namespace.Matrix4().makeRotationFromQuaternion(he),we=new THREE__namespace.Matrix4().getInverse(le),ue=new THREE__namespace.Frustum().setFromProjectionMatrix(new THREE__namespace.Matrix4().multiplyMatrices(o.camera.projectionMatrix,we));return ue}();E.panoId===panoStringify(this.currentPano)&&(((p=E.panoPicture)===null||p===void 0?void 0:p.map)instanceof TileCubeTextureTarget&&(E.panoPicture.map.maxRequest=this.tileMaxRequest,E.panoPicture.map.update(ye,be),E.panoPicture.map.needsRender===!0&&(E.panoPicture.map.needsRender=!1,this.needsRender=!0,this.modelSceneNeedsRender=!0)),((v=E.panoPicture)===null||v===void 0?void 0:v.luminanceMap)instanceof TileCubeTextureTarget&&(E.panoPicture.luminanceMap.maxRequest=this.tileMaxRequest,E.panoPicture.luminanceMap.update(ye,be),E.panoPicture.luminanceMap.needsRender===!0&&(E.panoPicture.luminanceMap.needsRender=!1,this.needsRender=!0,this.modelSceneNeedsRender=!0)));{var Ae=this.tiling.object.visible;if(this.initAnimationed){var Me=E.panoId,ge=this.works.getResolvedObserver(Me);ge?isSimilarVector3(this.camera.position,ge.position)&&this.locationMotion.ended?(this.tiling.object.visible=!0,this.tiling.panoId!==Me&&this.tiling.cleanup(),this.tiling.panoId=Me,this.tiling.setResource((h=(g=ge.images)===null||g===void 0?void 0:g.tiles)!==null&&h!==void 0?h:[],this.enableIOSEDR&&ge.images.luminance?ge.images.luminance:null),this.tiling.setFetcher(getFetcher(ge.work)),this.tiling.setRotation(ge.quaternion),this.tiling.setPosition(ge.position),this.tiling.maxRequest=this.tileMaxRequest,be>this.TILED_CUBE_TEXTURE_LEVEL?this.tiling.update(ye,be,e):this.tiling.update(ye,0,e)):this.tiling.object.visible=!1:this.tiling.object.visible=!1}else this.tiling.object.visible=!1;Ae!==this.tiling.object.visible&&(this.tiling.object.needsRender=!0,this.modelSceneNeedsRender=!0)}this.panoVideo.object.position.copy(this.camera.position),this.panoVideo.updateTime(e),this.intersectMesh.scale.setScalar(clamp$1(this.cameraMotion.value.fov/45,0,1))}},t.prototype.render=function(e,r){var o=this.renderer.getRenderTarget(),s=this.works.getResolvedObserver(this.currentPano);s&&s.video&&(this.needsRender=!0,this.modelSceneNeedsRender=!0),this.updateScreenBuffer(r),e&&(r==="luminance"?(this.luminanceAdaptiveEffect.enable=this.luminanceAdaptiveEffectEnable,this.luminanceAdaptiveEffect.render(this.screenBuffers)):(this.renderer.setRenderTarget(this.modelRenderTarget),this.renderer.render(this.modelScene,this.camera))),this.depthCopyPass.render(this.modelRenderTarget.depthTexture,o),this.renderer.autoClearDepth=!1,this.renderer.autoClearColor=!0,this.copyPass.render(this.modelRenderTarget,o),this.renderer.setRenderTarget(o),this.renderer.autoClearColor=!1,this.renderer.autoClearDepth=!1,this.renderer.render(this.scene,this.camera),this.renderer.autoClearColor=!0,this.renderer.autoClearDepth=!0},t.prototype.postProcessing=function(e,r){if(!this.destroyed&&r==="luminance")return this.luminanceAdaptiveEffect||(this.luminanceAdaptiveEffect=new LuminanceAdaptiveEffect(this.renderer,this.scene,this.camera,this.models),this.luminanceAdaptiveEffect.enable=this.luminanceAdaptiveEffectEnable),this.luminanceAdaptiveEffect.render(e)},t.prototype.getTargetState=function(){var e=this.cameraMotion.getKeyFrameSegment(now())[1],r=this.locationMotion.getKeyFrameSegment(now())[1],o=this.panoResourceFromLocationMotionKeyframe(r),s=this.works.getResolvedObserver(o.panoId);return{workCode:s?s.work.workCode:this.currentPano.workCode,panoIndex:s?s.panoIndex:this.currentPano.panoIndex,mode:this.mode,longitude:e.value.longitude,latitude:e.value.latitude,fov:e.value.fov,offset:s?s.position.clone():this.camera.position.clone(),distance:this.locationMotion.value.distance}},t.prototype.moveToPano=function(e,r,o){var s=this,u,l,c,f,d=(u=r.effect)!==null&&u!==void 0?u:"fly";this.userAction=o,this.stopMomentumMovement();var p=this.works.getResolvedObserver(e);if(!p)throw new Error("Invalid PanoId ".concat(JSON.stringify(e)));var v=getImageSizeFromURL(p.images.up),g=this.imageOptions.size;typeof g=="undefined"&&p&&v&&(g=Number(v)),typeof g=="undefined"&&(g=2048);var h=this.imageOptions.transform,m=__assign({key:"pano.".concat(p.panoId)},pick(this.imageOptions,["format","size","quality","sharpen","mappings"])),y=p.images,A=(c=(l=p.images.tiles)===null||l===void 0?void 0:l.filter(function(F){return F.size>g}))!==null&&c!==void 0?c:null,E=h,b={key:"pano_luminance.".concat(p.panoId),size:m.size?m.size/2:void 0},T=this.enableIOSEDR&&p.images.luminance?p.images.luminance:null,_=function(){if(!p.images.tiles||!T)return null;var F=getImageSizeFromURL(T.up);return F?A==null?void 0:A.map(function(k){var N=k.size*k.scale/2;return F<N?{level:k.level,size:N,scale:1,back:replaceImageSize(T.back,N),front:replaceImageSize(T.front,N),left:replaceImageSize(T.left,N),right:replaceImageSize(T.right,N),up:replaceImageSize(T.up,N),down:replaceImageSize(T.down,N)}:{level:k.level,size:F,scale:N/F,back:T.back,front:T.front,left:T.left,right:T.right,up:T.up,down:T.down}}):null}(),R="pano:"+jsonHash([y,m,h]);if(this.pendingTextureTask){if(this.pendingTextureTask.hash===R)return;var S=this.pendingTextureTask.panoId;(f=this.panoMeshes[S])===null||f===void 0||f.setProgress(0),this.emit("pano.texture.abort",createEvent("pano.texture.abort",{error:null,progress:0,meta:null,pano:p.pano}))}var M="move-to-pano-"+p.panoId;this.pending.add(M);var B=this.models.getMaterial()||{},H=B.pano0,w=B.pano1,C;if(H&&H.map.name===R&&H.luminanceMap!==null===this.enableIOSEDR?C=H:(w==null?void 0:w.map.name)===R&&w.luminanceMap!==null===this.enableIOSEDR&&(C=w),C){var L={panoId:p.panoId,effect:d,panoPicture:{zoom:1,map:C.map,luminanceMap:C.luminanceMap,matrix:new THREE__namespace.Matrix4().compose(p.position,p.quaternion,PANO_TEXTURE_SCALE$1)},position:p.position.clone(),fixCameraTransform:new THREE__namespace.Matrix4};AnimationFrameLoop.shared.add(function(){s.pending.delete(M),s.doMoveToPano(p.pano,L,r)},!0,1);return}this.pendingTextureTask={panoId:p.panoId,hash:R,onLoad:function(F,k){var N;if(s.pending.delete(M),s.destroyed)F.body.dispose();else{F.body.name=R;var D={panoId:p.panoId,effect:d,panoPicture:{zoom:1,map:F.body,luminanceMap:(N=k==null?void 0:k.body)!==null&&N!==void 0?N:null,matrix:new THREE__namespace.Matrix4().compose(p.position,p.quaternion,PANO_TEXTURE_SCALE$1)},position:p.position.clone(),fixCameraTransform:new THREE__namespace.Matrix4};s.doMoveToPano(p.pano,D,r)}},onError:function(F){s.pending.delete(M);var k=__assign(__assign(__assign({},p.pano),{mode:s.mode}),clonePose(s.camera.pose));s.emit("pano.error",createEvent("pano.error",{error:F,userAction:s.userAction,options:r,prevPano:s.currentPano,progress:0,state:k})),s.emit("pano.cancel",createEvent("pano.cancel",{error:F,userAction:s.userAction,options:r,prevPano:s.currentPano,progress:0,state:k})),s.emit("error",F),r.moveCancelCallback&&r.moveCancelCallback()}};var I=this.panoMeshes[p.panoId];I&&I.tap&&I.tap(),Promise.all([this.tileLevelForFov&&A&&A.length?this.textureLoader.loadTiledCubeTexture(y,A,{tileMaxLevel:this.TILED_CUBE_TEXTURE_LEVEL,imageURL:{transform:h,options:m},minFilter:THREE__namespace.LinearFilter,magFilter:THREE__namespace.LinearFilter,generateMipmaps:!1,format:THREE__namespace.RGBAFormat,viaAjax:!0,fetcher:getFetcher(p.work)},void 0,void 0,function(F){var k,N;s.emit("pano.texture.progress",createEvent("pano.texture.progress",{error:null,progress:F,meta:null,pano:p.pano})),((k=s.pendingTextureTask)===null||k===void 0?void 0:k.hash)===R&&((N=s.panoMeshes[p.panoId])===null||N===void 0||N.setProgress(F))},this.renderer):this.textureLoader.loadCubeTexture(y,{imageURL:{transform:h,options:m},format:THREE__namespace.RGBAFormat,viaAjax:!0,fetcher:getFetcher(p.work)},void 0,void 0,function(F){var k,N;s.emit("pano.texture.progress",createEvent("pano.texture.progress",{error:null,progress:F,meta:null,pano:p.pano})),((k=s.pendingTextureTask)===null||k===void 0?void 0:k.hash)===R&&((N=s.panoMeshes[p.panoId])===null||N===void 0||N.setProgress(F))},this.renderer),T?this.tileLevelForFov&&_&&_.length?this.textureLoader.loadTiledCubeTexture(T,_,{tileMaxLevel:this.TILED_CUBE_TEXTURE_LEVEL,imageURL:{transform:E,options:b},minFilter:THREE__namespace.LinearFilter,magFilter:THREE__namespace.LinearFilter,generateMipmaps:!1,fetcher:getFetcher(p.work)},void 0,void 0,void 0,this.renderer).catch(function(){return null}):this.textureLoader.loadCubeTexture(T,{imageURL:{transform:E,options:b},fetcher:getFetcher(p.work)},void 0,void 0,void 0,this.renderer).catch(function(){return null}):Promise.resolve(null)]).then(function(F){var k,N,D=F[0],U=F[1];((k=s.pendingTextureTask)===null||k===void 0?void 0:k.hash)===R?(s.pendingTextureTask.onLoad(D,U),(N=s.panoMeshes[p.panoId])===null||N===void 0||N.setProgress(0),delete s.pendingTextureTask,s.emit("pano.texture.success",createEvent("pano.texture.success",{error:null,progress:1,meta:D.meta,pano:p.pano}))):(D.body.dispose(),U==null||U.body.dispose())}).catch(function(F){var k,N;((k=s.pendingTextureTask)===null||k===void 0?void 0:k.hash)===R&&(s.pendingTextureTask.onError(F),(N=s.panoMeshes[p.panoId])===null||N===void 0||N.setProgress(0),delete s.pendingTextureTask,s.emit("pano.texture.error",createEvent("pano.texture.error",{error:F,progress:0,meta:null,pano:p.pano})),s.emit("error",F))}),this.emit("pano.texture.load",createEvent("pano.texture.load",{error:null,progress:0,meta:null,pano:p.pano}))},t.prototype.initAnimation=function(){var e=this;return this.destroyed?Promise.resolve():new Promise(function(r){var o=e.initial,s=o.duration,u=o.effect,l=o.userAction;e.userAction=l;var c=t.initAnimationEndState(e),f={workCode:c.workCode,panoIndex:c.panoIndex},d={modelAlpha:0},p={perspToOrtho:0},v=!1;e.moveToPano(f,{longitude:c.longitude,latitude:c.latitude,fov:c.fov,effect:u,duration:s,moveStartCallback:function(g){v=!0,e.perspToOrthoMotion.set(p,s).catch(noop$1),e.modelAlphaMotion.setKeyframes([{progress:0,value:__assign({},e.modelAlphaMotion.value)},{progress:.6,value:__assign({},e.modelAlphaMotion.value)},{progress:1,value:d}],s).catch(noop$1),e.emit("initAnimation.start",createEvent("initAnimation.start",{state:g,userAction:e.userAction}))},moveEndCallback:function(g){e.emit("initAnimation.end",createEvent("initAnimation.end",{state:g,userAction:e.userAction})),e.initAnimationed=!0,r()},moveCancelCallback:function(){var g=__assign(__assign(__assign({},f),{mode:e.mode}),clonePose(e.camera.pose));v===!1&&e.emit("initAnimation.start",createEvent("initAnimation.start",{state:g,userAction:e.userAction})),e.emit("initAnimation.end",createEvent("initAnimation.end",{state:g,userAction:e.userAction})),e.initAnimationed=!0,r()}},l)})},t.prototype.panoResourceFromLocationMotionKeyframe=function(e){return this.panoResources[e.key]},t.prototype.locationMotionKeyframesLength=function(e){for(var r=0,o=1;o<e.length;o++){var s=this.panoResourceFromLocationMotionKeyframe(e[o-1]).position,u=this.panoResourceFromLocationMotionKeyframe(e[o]).position,l=s.distanceTo(u)*(e[o].value.count-e[o-1].value.count);r+=l}return r},t.prototype.updatePanoMeshes=function(){for(var e=this,r={},o=Object.keys(this.panoMeshes),s=0,u=o;s<u.length;s++){var l=u[s],c=this.panoMeshes[l];r[l]=c,delete this.panoMeshes[l]}for(var f=1,d={},p=function(R){var S=arrayMin(R.accessibleIds,function(B){var H=e.works.getResolvedObserver(B);if(!H)return 1/0;var w=H.standingPosition.distanceTo(R.standingPosition);return clamp$1(w,1,1/0)},!0),M=S[1];d[R.panoId]===void 0&&(d[R.panoId]=M)},v=0,g=this.works.resolvedObservers;v<g.length;v++){var h=g[v];p(h)}var m=Object.keys(d).map(function(R){return d[R]});if(m.length){var y=m.reduce(function(R,S){return R+S},0)/m.length;f=clamp$1(y*.6,1,3)}for(var A=0,E=this.works.resolvedObservers;A<E.length;A++){var h=E[A],c=void 0;r[h.panoId]?(c=r[h.panoId],c.loading===!0&&h.loadable===!1&&c.setLoading(!1),delete r[h.panoId]):(c=this.panoCircleMeshCreator(h.pano),c.name="PanoCircleMesh_"+h.panoId,this.helper.add(c)),c.scale.set(f,1,f),c.position.copy(h.standingPosition),this.panoMeshes[h.panoId]=c}for(var b=0,T=Object.keys(r);b<T.length;b++){var _=T[b];this.helper.remove(r[_]),r[_].dispose(),delete r[_]}},t.prototype.doMoveToPano=function(e,r,o){var s=this,u,l,c,f,d,p,v,g,h,m,y;o===void 0&&(o={});var A=now(),E=createUuid();this.tiling.cleanup(),this.panoResources[E]=r;var b=1,T,_,R;if(this.locationMotion.ended){var S=this.locationMotion.getKeyFrameSegment(A);S[0];var M=S[1],B=this.locationMotion.value,H=((u=this.panoResourceFromLocationMotionKeyframe(M))!==null&&u!==void 0?u:this.camera).position,w=r.position;T=Math.max(H.distanceTo(w),b),_=[{key:M.key,progress:0,value:__assign(__assign({},B),{count:0})},{key:E,progress:1,value:{distance:0,count:1}}],R=0}else{var C=this.locationMotion.getKeyFrameSegment(A),L=C[0],M=C[1],B=this.locationMotion.value,I=this.panoResourceFromLocationMotionKeyframe(L).position,H=this.panoResourceFromLocationMotionKeyframe(M).position,w=r.position,F=M.value.count-B.count,k=Math.max(I.distanceTo(H),b)*F,N=Math.max(H.distanceTo(w),b);T=k+N,_=[{key:L.key,progress:0,value:__assign({},B)},{key:M.key,progress:k/T,value:M.value},{key:E,progress:1,value:{count:M.value.count+1,distance:0}}];var D=this.locationMotionKeyframesLength(this.locationMotion.keyframes),U=this.locationMotionKeyframesLength(_);D===0||D===0?R=0:R=this.locationMotion.getProgressVelocity(A)*D/U}var z=r.effect==="instant"?0:this.calculateMovingDuration(o.duration,r.effect==="fly"?T:0),G={longitude:o.longitude,latitude:o.latitude,fov:o.fov},q=__assign(__assign({},e),{mode:this.mode,longitude:(l=G.longitude)!==null&&l!==void 0?l:this.camera.pose.longitude,latitude:(c=G.latitude)!==null&&c!==void 0?c:this.camera.pose.latitude,fov:(f=G.fov)!==null&&f!==void 0?f:this.camera.pose.fov,offset:r.position.clone(),distance:this.camera.pose.distance}),K=this.currentPano;if(this.emit("pano.moveTo",createEvent("pano.moveTo",{options:o,prevPano:K,progress:0,state:q,userAction:this.userAction,error:null})),o.moveStartCallback&&o.moveStartCallback(q),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=noop$1,this.videoTexture.needsUpdate=!0),this.panoVideo.setMaterial(null),r.effect==="fly")this.cameraMotion.set(G,z).catch(noop$1);else{var j=coordinatesToVector({longitude:this.cameraMotion.value.longitude,latitude:this.cameraMotion.value.latitude}),W=coordinatesToVector({longitude:(d=G.longitude)!==null&&d!==void 0?d:this.cameraMotion.value.longitude,latitude:(p=G.latitude)!==null&&p!==void 0?p:this.cameraMotion.value.latitude}),X=new THREE__namespace.Object3D;X.lookAt(j);var ee=new THREE__namespace.Matrix4().makeRotationFromQuaternion(X.quaternion);X.lookAt(W);var $=new THREE__namespace.Matrix4().makeRotationFromQuaternion(X.quaternion),re=new THREE__namespace.Matrix4().getInverse(ee).premultiply($),ie=this.cameraMotion.value.fov,se=(v=G.fov)!==null&&v!==void 0?v:this.cameraMotion.value.fov,ae=1;r.effect==="zoomin"?ae=1.5:r.effect==="zoomout"&&(ae=.4);for(var fe=clamp$1(se*ae,1,170),ne=0;ne<_.length-1;ne++){var pe=_[ne].key;if(pe){var _e=this.panoResources[pe];_e&&(_e.fixCameraTransform.copy(re),_e.panoPicture&&(_e.panoPicture.zoom=Math.tan(ie/2/180*Math.PI)/Math.tan(fe/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:(g=G.longitude)!==null&&g!==void 0?g:this.cameraMotion.value.longitude,latitude:(h=G.latitude)!==null&&h!==void 0?h:this.cameraMotion.value.latitude,fov:fe}},{progress:1,value:{longitude:(m=G.longitude)!==null&&m!==void 0?m:this.cameraMotion.value.longitude,latitude:(y=G.latitude)!==null&&y!==void 0?y:this.cameraMotion.value.latitude,fov:se}}],z).catch(noop$1)}var me=this.locationMotion.setKeyframes(_,z,R);me.then(function(){for(var xe,Z,te=0,Q=s.models;te<Q.length;te++){var be=Q[te];be.show()}var ye=__assign(__assign({},e),{mode:s.mode,longitude:s.camera.pose.longitude,latitude:s.camera.pose.latitude,fov:s.camera.pose.fov,offset:s.camera.pose.offset.clone(),distance:s.camera.pose.distance});s.emit("pano.arrived",createEvent("pano.arrived",{options:o,prevPano:K,progress:1,state:ye,userAction:s.userAction,error:null})),o.moveEndCallback&&o.moveEndCallback(ye);var Ae=s.works.getResolvedObserver(e);if(Ae&&Ae.video&&s.videoTexture&&s.videoTexture.image instanceof HTMLVideoElement){var Me=ROTATE_Y_PI_MATRIX$1.clone().multiply((Z=(xe=s.models.getMaterial().pano1)===null||xe===void 0?void 0:xe.matrix)!==null&&Z!==void 0?Z:new THREE__namespace.Matrix4).multiply(Ae.video.matrix),ge={map:s.videoTexture,size:Ae.video.size,matrix:Me,alpha:1},he=createUuid(),de=s.videoTexture.image;de.setAttribute("uuid",he),canplayVideo().then(function(ce){ce&&Ae.video&&de.getAttribute("uuid")===he&&(de.oncanplay=function(){de.oncanplay=noop$1,de.play()},de.ontimeupdate=function(){de.currentTime>.5&&(de.ontimeupdate=noop$1,s.panoVideo.setMaterial(ge))},de.src=Ae.video.source)}).catch(function(){de.removeAttribute("uuid")})}},function(){s.emit("pano.cancel",createEvent("pano.cancel",{options:o,prevPano:K,progress:0,state:q,userAction:s.userAction,error:null})),o.moveCancelCallback&&o.moveCancelCallback()})},t.prototype.getForwardObserverOrNot=function(e){var r=this,o=this.works.getResolvedObserver(this.currentPano);if(!o)return null;var s=e!=null?e:new THREE__namespace.Raycaster(this.camera.position.clone(),this.camera.getDirection(new THREE__namespace.Vector3));s.params.Points={threshold:.1};var u=o.standingPosition.clone();if(o.position.distanceTo(s.ray.origin)>1){var l=this.models.intersectRaycaster(new THREE__namespace.Raycaster(s.ray.origin,new THREE__namespace.Vector3(0,-1,0)))[0];l&&l.distance<=2?u.copy(l.point):u.copy(s.ray.origin).add(new THREE__namespace.Vector3(0,-1.5,0))}var c=this.models.intersectRaycaster(s)[0],f=c?c.point:s.ray.origin.clone().add(s.ray.direction.clone().normalize().multiplyScalar(3)),d=f.clone().sub(u).normalize();if(d.length()===0)return null;for(var p=o.accessibleIds.filter(function(_){if(_===panoStringify(r.currentPano))return!1;var R=r.works.getResolvedObserver(_);if(!R)return!1;var S=R.standingPosition.clone().project(r.camera);return Math.abs(S.z)>1||Math.abs(S.x)>1||Math.abs(S.y)>1?!1:R.loadable||R.active}),v=p.slice().sort(function(_,R){var S=r.works.getResolvedObserver(_).standingPosition.clone().distanceTo(u),M=r.works.getResolvedObserver(R).standingPosition.clone().distanceTo(u);return S-M}),g=0,h=[Math.PI/8,Math.PI/6,Math.PI/4,Math.PI/3];g<h.length;g++)for(var m=h[g],y=0,A=v;y<A.length;y++){var E=A[y],b=this.works.getResolvedObserver(E);if(b){var T=b.standingPosition.clone().sub(u);if(T&&T.length()!==0&&d.angleTo(T)<m)return b}}return null},t.prototype.onTapGesture=function(e){var r=this,o;if(this.userAction=e.userAction,this.stopMomentumMovement(),!!this.initAnimationed){if(!this.locationMotion.ended){var s=this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[this.locationMotion.keyframes.length-1]);if(s.panoId!==panoStringify(this.currentPano))return}var u=e.center.raycaster,l=this.camera.getDirection(new THREE__namespace.Vector3).setY(0),c=null,f=this.works.getResolvedObserver(this.currentPano);if(f){var d=f.accessibleIds.filter(function(U){if(U===panoStringify(r.currentPano))return!1;var z=r.works.getResolvedObserver(U);return!z||z.position.distanceTo(r.camera.position)>r.maxAccessibleDistance?!1:z.loadable||z.active}),p=this.models.intersectRaycaster(u)[0];if(p){var v=arrayMin(d,function(U){var z=r.works.getResolvedObserver(U);if(!z)return 1/0;var G=z.standingPosition.clone();return G.distanceTo(p.point)},!0),g=v[0],h=v[1];g&&h<this.panoTapTriggerRadius&&(c=(o=this.works.getResolvedObserver(g))!==null&&o!==void 0?o:null)}c||(c=this.getForwardObserverOrNot(u));for(var m=0,y=this.locationMotion.keyframes;m<y.length;m++){var A=y[m],E=this.panoResourceFromLocationMotionKeyframe(A);if(!(A.progress<this.locationMotion.progress)&&c&&E.panoId===c.panoId){c=null;break}}if(!c)this.emit("gesture.tap",e),e.defaultPrevented||this.locationMotion.ended===!0&&this.cameraBounce();else{for(var b={},T=Math.PI/6,_=Math.PI/12,R=c.position.clone().setY(0).sub(f.position.clone().setY(0)).normalize(),S=[],M=[],B=[],H=0,w=c.accessibleIds;H<w.length;H++){var g=w[H],C=panoParse(g);if(!(panoEqual(C,this.currentPano)||panoEqual(C,c.pano))){var L=this.works.getResolvedObserver(g);if(L){var I=L.position.clone().sub(c.position).setY(0);R.angleTo(I)<T&&B.push(I)}}}var F=B.length>0?B:__spreadArray(__spreadArray([],S,!0),M,!0),k=F.slice().sort(function(U,z){return U.angleTo(R)-z.angleTo(R)})[0];k&&k.angleTo(l)>_&&(b.longitude=Math.atan2(-k.x,-k.z)),this.cameraMotion.value.latitude<-Math.PI/4&&(b.latitude=clamp$1(0,this.minLatitude,this.maxLatitude));var N=__assign({},e.state);if(N.workCode=c.pano.workCode,N.panoIndex=c.pano.panoIndex,b.longitude!==void 0&&(N.longitude=b.longitude),b.latitude!==void 0&&(N.latitude=b.latitude),b.fov!==void 0&&(N.fov=b.fov),N.distance=0,N.offset=c.position.clone(),e.state=N,this.emit("gesture.tap",e),!e.defaultPrevented){if(this.emit("pano.select",createEvent("pano.select",{prevPano:this.currentPano,state:N,userAction:e.userAction,options:b,progress:0,error:null})),c&&!c.active){var D=c.panoId;this.panoMeshes[D]&&(this.panoMeshes[D].setDisabled(!1),this.panoMeshes[D].setLoading(!0))}c&&c.active&&this.emit("pano.request",createEvent("pano.request",{userAction:e.userAction,prevPano:this.currentPano,progress:0,state:N,options:b,error:null}))}}}}},t}(PanoramaLikeController),DEG_TO_RAD=Math.PI/180,RAD_TO_DEG=180/Math.PI,MIN_TIMESTEP=.001,MAX_TIMESTEP=1,isIOS=function(){var n=typeof navigator!="undefined"&&/iPad|iPhone|iPod/.test(navigator.platform);return function(){return n}}(),isSafari=function(){var n=typeof navigator!="undefined"&&/^((?!chrome|android).)*safari/i.test(navigator.userAgent);return function(){return n}}(),isFirefoxAndroid=function(){var n=typeof navigator!="undefined"&&navigator.userAgent.indexOf("Firefox")!==-1&&navigator.userAgent.indexOf("Android")!==-1;return function(){return n}}(),getChromeVersion=function(){var n=typeof navigator!="undefined"?navigator.userAgent.match(/.*Chrome\/([0-9]+)/):null,t=n?parseInt(n[1],10):null;return function(){return t}}(),isChromeWithoutDeviceMotion=function(){var n=!1;if(getChromeVersion()===65){var t=typeof navigator!="undefined"?navigator.userAgent.match(/.*Chrome\/([0-9\.]*)/):null;if(t){var e=t[1].split(".");e[0],e[1];var r=e[2],o=e[3];n=parseInt(r,10)===3325&&parseInt(o,10)<148}}return function(){return n}}(),isSafariWithoutDeviceMotion=function(){var n=isIOS()&&isSafari()&&typeof navigator!="undefined"&&navigator.userAgent.indexOf("13_4")!==-1;return function(){return n}}(),isR7=function(){var n=typeof navigator!="undefined"&&navigator.userAgent.indexOf("R7 Build")!==-1;return function(){return n}}();function isLandscapeMode(){var n=typeof window!="undefined"&&(window.orientation==90||window.orientation==-90);return isR7()?!n:n}function isTimestampDeltaValid(n){return!(isNaN(n)||n<=MIN_TIMESTEP||n>MAX_TIMESTEP)}function getQuaternionAngle(n){if(n.w>1)return 0;var t=2*Math.acos(n.w);return t}var warnOnce=function(){var n={};return function(t,e){n[t]===void 0&&(console.warn("cardboard: "+e),n[t]=!0)}}();function getOriginFromUrl(n){var t,e=n.indexOf("://");e!==-1?t=e+3:t=0;var r=n.indexOf("/",t);return r===-1&&(r=n.length),n.substring(0,r)}function isInsideCrossOriginIFrame(){if(typeof window=="undefined"||typeof document=="undefined")return!1;var n=window.self!==window.top,t=getOriginFromUrl(document.referrer),e=getOriginFromUrl(window.location.href);return n&&t!==e}var updateEyeViewMatrices=function(){function n(r,o,s){var u=o?o[0]:0,l=o?o[1]:0,c=o?o[2]:0,f=o?o[3]:1,d=u+u,p=l+l,v=c+c,g=u*d,h=u*p,m=u*v,y=l*p,A=l*v,E=c*v,b=f*d,T=f*p,_=f*v;return r[0]=1-(y+E),r[1]=h+_,r[2]=m-T,r[3]=0,r[4]=h-_,r[5]=1-(g+E),r[6]=A+b,r[7]=0,r[8]=m+T,r[9]=A-b,r[10]=1-(g+y),r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function t(r,o,s){var u=s[0],l=s[1],c=s[2],f,d,p,v,g,h,m,y,A,E,b,T;return o===r?(r[12]=o[0]*u+o[4]*l+o[8]*c+o[12],r[13]=o[1]*u+o[5]*l+o[9]*c+o[13],r[14]=o[2]*u+o[6]*l+o[10]*c+o[14],r[15]=o[3]*u+o[7]*l+o[11]*c+o[15]):(f=o[0],d=o[1],p=o[2],v=o[3],g=o[4],h=o[5],m=o[6],y=o[7],A=o[8],E=o[9],b=o[10],T=o[11],r[0]=f,r[1]=d,r[2]=p,r[3]=v,r[4]=g,r[5]=h,r[6]=m,r[7]=y,r[8]=A,r[9]=E,r[10]=b,r[11]=T,r[12]=f*u+g*l+A*c+o[12],r[13]=d*u+h*l+E*c+o[13],r[14]=p*u+m*l+b*c+o[14],r[15]=v*u+y*l+T*c+o[15]),r}function e(r,o){var s=o[0],u=o[1],l=o[2],c=o[3],f=o[4],d=o[5],p=o[6],v=o[7],g=o[8],h=o[9],m=o[10],y=o[11],A=o[12],E=o[13],b=o[14],T=o[15],_=s*d-u*f,R=s*p-l*f,S=s*v-c*f,M=u*p-l*d,B=u*v-c*d,H=l*v-c*p,w=g*E-h*A,C=g*b-m*A,L=g*T-y*A,I=h*b-m*E,F=h*T-y*E,k=m*T-y*b,N=_*k-R*F+S*I+M*L-B*C+H*w;return N?(N=1/N,r[0]=(d*k-p*F+v*I)*N,r[1]=(l*F-u*k-c*I)*N,r[2]=(E*H-b*B+T*M)*N,r[3]=(m*B-h*H-y*M)*N,r[4]=(p*L-f*k-v*C)*N,r[5]=(s*k-l*L+c*C)*N,r[6]=(b*S-A*H-T*R)*N,r[7]=(g*H-m*S+y*R)*N,r[8]=(f*F-d*L+v*w)*N,r[9]=(u*L-s*F-c*w)*N,r[10]=(A*B-E*S+T*_)*N,r[11]=(h*S-g*B-y*_)*N,r[12]=(d*C-f*I-p*w)*N,r[13]=(s*I-u*C+l*w)*N,r[14]=(E*R-A*M-b*_)*N,r[15]=(g*M-h*R+m*_)*N,r):null}return function(r,o,s){n(r,o),s&&t(r,r,s),e(r,r)}}(),SensorSample=function(){function n(t,e){t===void 0&&(t=new THREE__namespace.Vector3),e===void 0&&(e=0),this.sample=t,this.timestampS=e}return n.prototype.set=function(t,e){this.sample=t,this.timestampS=e},n.prototype.copy=function(t){this.set(t.sample,t.timestampS)},n}(),ComplementaryFilter=function(){function n(t,e){this.kFilter=t,this.isDebug=e,this.currentAccelMeasurement=new SensorSample,this.currentGyroMeasurement=new SensorSample,this.previousGyroMeasurement=new SensorSample,isIOS()?this.filterQ=new THREE__namespace.Quaternion(-1,0,0,1):this.filterQ=new THREE__namespace.Quaternion(1,0,0,1),this.previousFilterQ=new THREE__namespace.Quaternion,this.previousFilterQ.copy(this.filterQ),this.accelQ=new THREE__namespace.Quaternion,this.isOrientationInitialized=!1,this.estimatedGravity=new THREE__namespace.Vector3,this.measuredGravity=new THREE__namespace.Vector3,this.gyroIntegralQ=new THREE__namespace.Quaternion}return n.prototype.addAccelMeasurement=function(t,e){this.currentAccelMeasurement.set(t,e)},n.prototype.addGyroMeasurement=function(t,e){this.currentGyroMeasurement.set(t,e);var r=e-this.previousGyroMeasurement.timestampS;isTimestampDeltaValid(r)&&this.run_(),this.previousGyroMeasurement.copy(this.currentGyroMeasurement)},n.prototype.getOrientation=function(){return this.filterQ},n.prototype.run_=function(){if(!this.isOrientationInitialized){this.accelQ=this.accelToQuaternion_(this.currentAccelMeasurement.sample),this.previousFilterQ.copy(this.accelQ),this.isOrientationInitialized=!0;return}var t=this.currentGyroMeasurement.timestampS-this.previousGyroMeasurement.timestampS,e=this.gyroToQuaternionDelta_(this.currentGyroMeasurement.sample,t);this.gyroIntegralQ.multiply(e),this.filterQ.copy(this.previousFilterQ),this.filterQ.multiply(e);var r=new THREE__namespace.Quaternion;r.copy(this.filterQ),r.inverse(),this.estimatedGravity.set(0,0,-1),this.estimatedGravity.applyQuaternion(r),this.estimatedGravity.normalize(),this.measuredGravity.copy(this.currentAccelMeasurement.sample),this.measuredGravity.normalize();var o=new THREE__namespace.Quaternion;o.setFromUnitVectors(this.estimatedGravity,this.measuredGravity),o.inverse(),this.isDebug&&console.log("Delta: %d deg, G_est: (%s, %s, %s), G_meas: (%s, %s, %s)",RAD_TO_DEG*getQuaternionAngle(o),this.estimatedGravity.x.toFixed(1),this.estimatedGravity.y.toFixed(1),this.estimatedGravity.z.toFixed(1),this.measuredGravity.x.toFixed(1),this.measuredGravity.y.toFixed(1),this.measuredGravity.z.toFixed(1));var s=new THREE__namespace.Quaternion;s.copy(this.filterQ),s.multiply(o),this.filterQ.slerp(s,1-this.kFilter),this.previousFilterQ.copy(this.filterQ)},n.prototype.accelToQuaternion_=function(t){var e=new THREE__namespace.Vector3;e.copy(t),e.normalize();var r=new THREE__namespace.Quaternion;return r.setFromUnitVectors(new THREE__namespace.Vector3(0,0,-1),e),r.inverse(),r},n.prototype.gyroToQuaternionDelta_=function(t,e){var r=new THREE__namespace.Quaternion,o=new THREE__namespace.Vector3;return o.copy(t),o.normalize(),r.setFromAxisAngle(o,t.length()*e),r},n}(),PosePredictor=function(){function n(t,e){this.predictionTimeS=t,this.isDebug=e,this.previousQ=new THREE__namespace.Quaternion,this.previousTimestampS=null,this.deltaQ=new THREE__namespace.Quaternion,this.outQ=new THREE__namespace.Quaternion}return n.prototype.getPrediction=function(t,e,r){if(!this.previousTimestampS)return this.previousQ.copy(t),this.previousTimestampS=r,t;var o=new THREE__namespace.Vector3;o.copy(e),o.normalize();var s=e.length();if(s<DEG_TO_RAD*20)return this.isDebug&&console.log("Moving slowly, at %s deg/s: no prediction",(RAD_TO_DEG*s).toFixed(1)),this.outQ.copy(t),this.previousQ.copy(t),this.outQ;var u=s*this.predictionTimeS;return this.deltaQ.setFromAxisAngle(o,u),this.outQ.copy(this.previousQ),this.outQ.multiply(this.deltaQ),this.previousQ.copy(t),this.previousTimestampS=r,this.outQ},n}(),Distortion=function(){function n(t){this.coefficients=t}return n.prototype.distortInverse=function(t){for(var e=0,r=1,o=t-this.distort(e);Math.abs(r-e)>1e-4;){var s=t-this.distort(r),u=r-s*((r-e)/(s-o));e=r,r=u,o=s}return r},n.prototype.distort=function(t){for(var e=t*t,r=0,o=0;o<this.coefficients.length;o++)r=e*(r+this.coefficients[o]);return(r+1)*t},n}(),Pose=function(){function n(){this.angularAcceleration=null,this.angularVelocity=null,this.linearAcceleration=null,this.linearVelocity=null,this.orientation=null,this.position=null}return n}(),FieldOfView=function(){function n(){this.leftDegrees=0,this.rightDegrees=0,this.upDegrees=0,this.downDegrees=0}return n}(),Sensor=function(){function n(t,e,r,o){this.viewer={id:"CardboardV1",label:"Cardboard I/O 2014",fov:40,interLensDistance:.06,baselineLensDistance:.035,screenLensDistance:.042,distortionCoefficients:[.441,.156],inverseCoefficients:[-.4410035,.42756155,-.4804439,.5460139,-.58821183,.5733938,-.48303202,.33299083,-.17573841,.0651772,-.01488963,.001559834]},this.device={widthMeters:.11,heightMeters:.062,bevelMeters:.004},this.depthNear=.01,this.depthFar=1e4,this.yawOnly=r,this.accelerometer=new THREE__namespace.Vector3,this.gyroscope=new THREE__namespace.Vector3,this.filter=new ComplementaryFilter(t,o),this.posePredictor=new PosePredictor(e,o),this.isFirefoxAndroid=isFirefoxAndroid(),this.isIOS=isIOS();var s=getChromeVersion();this.isDeviceMotionInRadians=!this.isIOS&&s!==null&&s<66,this.isWithoutDeviceMotion=isChromeWithoutDeviceMotion()||isSafariWithoutDeviceMotion(),this.filterToWorldQ=new THREE__namespace.Quaternion,isIOS()?this.filterToWorldQ.setFromAxisAngle(new THREE__namespace.Vector3(1,0,0),Math.PI/2):this.filterToWorldQ.setFromAxisAngle(new THREE__namespace.Vector3(1,0,0),-Math.PI/2),this.inverseWorldToScreenQ=new THREE__namespace.Quaternion,this.worldToScreenQ=new THREE__namespace.Quaternion,this.originalPoseAdjustQ=new THREE__namespace.Quaternion;var u=typeof window!="undefined"?-window.orientation*Math.PI/180:0;this.originalPoseAdjustQ.setFromAxisAngle(new THREE__namespace.Vector3(0,0,1),u),this.setScreenTransform_(),isLandscapeMode()&&this.filterToWorldQ.multiply(this.inverseWorldToScreenQ),this.resetQ=new THREE__namespace.Quaternion,this.orientationOut_=new Float32Array(4),this.previousTimestampS=Date.now()}return n.prototype.getPosition=function(){return null},n.prototype.getOrientation=function(){var t;if(this.isWithoutDeviceMotion&&this._deviceOrientationQ){this.deviceOrientationFixQ=this.deviceOrientationFixQ||function(){var s=new THREE__namespace.Quaternion().setFromAxisAngle(new THREE__namespace.Vector3(0,0,-1),0),u=new THREE__namespace.Quaternion;return typeof window!="undefined"&&window.orientation===-90?u.setFromAxisAngle(new THREE__namespace.Vector3(0,1,0),Math.PI/-2):u.setFromAxisAngle(new THREE__namespace.Vector3(0,1,0),Math.PI/2),s.multiply(u)}(),this.deviceOrientationFilterToWorldQ=this.deviceOrientationFilterToWorldQ||function(){var s=new THREE__namespace.Quaternion;return s.setFromAxisAngle(new THREE__namespace.Vector3(1,0,0),-Math.PI/2),s}(),t=this._deviceOrientationQ;var e=new THREE__namespace.Quaternion;return e.copy(t),e.multiply(this.deviceOrientationFilterToWorldQ),e.multiply(this.resetQ),e.multiply(this.worldToScreenQ),e.multiplyQuaternions(this.deviceOrientationFixQ,e),this.yawOnly&&(e.x=0,e.z=0,e.normalize()),this.orientationOut_[0]=e.x,this.orientationOut_[1]=e.y,this.orientationOut_[2]=e.z,this.orientationOut_[3]=e.w,this.orientationOut_}else{var r=this.filter.getOrientation();t=this.posePredictor.getPrediction(r,this.gyroscope,this.previousTimestampS)}var o=new THREE__namespace.Quaternion;return o.copy(this.filterToWorldQ),o.multiply(this.resetQ),o.multiply(t),o.multiply(this.worldToScreenQ),this.yawOnly&&(o.x=0,o.z=0,o.normalize()),this.orientationOut_[0]=o.x,this.orientationOut_[1]=o.y,this.orientationOut_[2]=o.z,this.orientationOut_[3]=o.w,this.orientationOut_},n.prototype.getPose=function(){var t=new Pose;return t.orientation=this.getOrientation(),t},n.prototype.resetPose=function(){this.resetQ.copy(this.filter.getOrientation()),this.resetQ.x=0,this.resetQ.y=0,this.resetQ.z*=-1,this.resetQ.normalize(),isLandscapeMode()&&this.resetQ.multiply(this.inverseWorldToScreenQ),this.resetQ.multiply(this.originalPoseAdjustQ)},n.prototype.getFrameData=function(t){var e=this.getOrientation(),r=this.getEyeOffset(),o=this.getEyeProjectionMatrix();return t.pose.angularAcceleration=null,t.pose.angularVelocity=null,t.pose.linearAcceleration=null,t.pose.linearVelocity=null,t.pose.orientation=e,t.pose.position=null,t.timestamp=this.previousTimestampS,t.leftProjectionMatrix.set(o.left),t.rightProjectionMatrix.set(o.right),updateEyeViewMatrices(t.leftViewMatrix,e,r.left),updateEyeViewMatrices(t.rightViewMatrix,e,r.right),t},n.prototype.start=function(){if(typeof window=="undefined")return function(){};var t=this.onDeviceMotion_.bind(this),e=this.onOrientationChange_.bind(this),r=this.onMessage_.bind(this),o=this.onDeviceOrientation_.bind(this);return isIOS()&&isInsideCrossOriginIFrame()&&window.addEventListener("message",r),window.addEventListener("orientationchange",e),this.isWithoutDeviceMotion?window.addEventListener("deviceorientation",o):window.addEventListener("devicemotion",t),function(){window.removeEventListener("devicemotion",t),window.removeEventListener("deviceorientation",e),window.removeEventListener("orientationchange",e),window.removeEventListener("message",r)}},n.prototype.getEyeOffset=function(){return{left:[-this.viewer.interLensDistance*.5,0,0],right:[this.viewer.interLensDistance*.5,0,0]}},n.prototype.getEyeProjectionMatrix=function(){var t=this.getEyeFieldOfView(),e=this.depthNear,r=this.depthFar,o={left:[],right:[]};{var s=t.left.upDegrees*DEG_TO_RAD,u=t.left.downDegrees*DEG_TO_RAD,l=t.left.leftDegrees*DEG_TO_RAD,c=t.left.rightDegrees*DEG_TO_RAD,f=2/(l+c),d=2/(s+u);o.left[0]=f,o.left[1]=0,o.left[2]=0,o.left[3]=0,o.left[4]=0,o.left[5]=d,o.left[6]=0,o.left[7]=0,o.left[8]=-((l-c)*f*.5),o.left[9]=(s-u)*d*.5,o.left[10]=r/(e-r),o.left[11]=-1,o.left[12]=0,o.left[13]=0,o.left[14]=r*e/(e-r),o.left[15]=0}{var s=t.right.upDegrees*DEG_TO_RAD,u=t.right.downDegrees*DEG_TO_RAD,l=t.right.leftDegrees*DEG_TO_RAD,c=t.right.rightDegrees*DEG_TO_RAD,f=2/(l+c),d=2/(s+u);o.right[0]=f,o.right[1]=0,o.right[2]=0,o.right[3]=0,o.right[4]=0,o.right[5]=d,o.right[6]=0,o.right[7]=0,o.right[8]=-((l-c)*f*.5),o.right[9]=(s-u)*d*.5,o.right[10]=r/(e-r),o.right[11]=-1,o.right[12]=0,o.right[13]=0,o.right[14]=r*e/(e-r),o.right[15]=0}return o},n.prototype.getEyeFieldOfView=function(){var t=this.viewer,e=this.device,r=new Distortion(t.distortionCoefficients),o=t.screenLensDistance,s=(e.widthMeters-t.interLensDistance)/2,u=t.interLensDistance/2,l=t.baselineLensDistance-e.bevelMeters,c=e.heightMeters-l,f=RAD_TO_DEG*Math.atan(r.distort(s/o)),d=RAD_TO_DEG*Math.atan(r.distort(u/o)),p=RAD_TO_DEG*Math.atan(r.distort(l/o)),v=RAD_TO_DEG*Math.atan(r.distort(c/o)),g=new FieldOfView,h=new FieldOfView;return g.leftDegrees=Math.min(f,t.fov),g.rightDegrees=Math.min(d,t.fov),g.downDegrees=Math.min(p,t.fov),g.upDegrees=Math.min(v,t.fov),h.leftDegrees=g.rightDegrees,h.rightDegrees=g.leftDegrees,h.upDegrees=g.upDegrees,h.downDegrees=g.downDegrees,{left:g,right:h}},n.prototype.onDeviceOrientation_=function(t){this._deviceOrientationQ=this._deviceOrientationQ||new THREE__namespace.Quaternion;var e=t.alpha,r=t.beta,o=t.gamma;e=(e||0)*Math.PI/180,r=(r||0)*Math.PI/180,o=(o||0)*Math.PI/180,this._deviceOrientationQ.setFromEuler(new THREE__namespace.Euler(e,r,-o,"YXZ"))},n.prototype.onDeviceMotion_=function(t){this.updateDeviceMotion_(t)},n.prototype.updateDeviceMotion_=function(t){var e=t.accelerationIncludingGravity,r=t.rotationRate,o=t.timeStamp/1e3,s=o-this.previousTimestampS;if(s<0){warnOnce("fusion-pose-sensor:invalid:non-monotonic","Invalid timestamps detected: non-monotonic timestamp from devicemotion"),this.previousTimestampS=o;return}else if(s<=MIN_TIMESTEP||s>MAX_TIMESTEP){warnOnce("fusion-pose-sensor:invalid:outside-threshold","Invalid timestamps detected: Timestamp from devicemotion outside expected range."),this.previousTimestampS=o;return}e&&(this.accelerometer.set(-e.x,-e.y,-e.z),r&&(isR7()?this.gyroscope.set(-r.beta,r.alpha,r.gamma):this.gyroscope.set(r.alpha,r.beta,r.gamma),this.isDeviceMotionInRadians||this.gyroscope.multiplyScalar(Math.PI/180),this.filter.addGyroMeasurement(this.gyroscope,o)),this.filter.addAccelMeasurement(this.accelerometer,o)),this.previousTimestampS=o},n.prototype.onOrientationChange_=function(){this.setScreenTransform_()},n.prototype.onMessage_=function(t){var e=t.data;if(!(!e||!e.type)){var r=e.type.toLowerCase();r==="devicemotion"&&this.updateDeviceMotion_(e.deviceMotionEvent)}},n.prototype.setScreenTransform_=function(){this.worldToScreenQ.set(0,0,0,1);var t=typeof window!="undefined"?window.orientation:0;switch(t){case 0:break;case 90:this.worldToScreenQ.setFromAxisAngle(new THREE__namespace.Vector3(0,0,1),-Math.PI/2);break;case-90:this.worldToScreenQ.setFromAxisAngle(new THREE__namespace.Vector3(0,0,1),Math.PI/2);break}this.inverseWorldToScreenQ.copy(this.worldToScreenQ),this.inverseWorldToScreenQ.inverse()},n}(),defaultLeftBounds=[0,0,.5,1],defaultRightBounds=[.5,0,.5,1],Cardboard=function(){function n(t){var e=this;this.renderer=t,this.sensor=new Sensor(.98,.04,!1,!1),this.scale=1,this.cameraL=new THREE__namespace.PerspectiveCamera,this.cameraR=new THREE__namespace.PerspectiveCamera;var r=this.sensor.start();this.dispose=function(){var o=e.renderer.getSize(new THREE__namespace.Vector2);e.renderer.setScissor(0,0,o.width,o.height),e.renderer.setViewport(0,0,o.width,o.height),e.renderer.setScissorTest(!1),r()}}return n.prototype.render=function(t,e){var r=this.renderer.getSize(new THREE__namespace.Vector2);if(r.width>r.height){var o=t.autoUpdate;o&&(t.updateMatrixWorld(),t.autoUpdate=!1);var s={x:Math.round(r.width*defaultLeftBounds[0]),y:Math.round(r.height*defaultLeftBounds[1]),width:Math.round(r.width*defaultLeftBounds[2]),height:Math.round(r.height*defaultLeftBounds[3])},u={x:Math.round(r.width*defaultRightBounds[0]),y:Math.round(r.height*defaultRightBounds[1]),width:Math.round(r.width*defaultRightBounds[2]),height:Math.round(r.height*defaultRightBounds[3])};this.renderer.setScissorTest(!0),this.renderer.autoClear&&this.renderer.clear(),e.parent===null&&e.updateMatrixWorld(),e.matrixWorld.decompose(this.cameraL.position,this.cameraL.quaternion,this.cameraL.scale),e.matrixWorld.decompose(this.cameraR.position,this.cameraR.quaternion,this.cameraR.scale);var l=this.sensor.getEyeOffset();this.cameraL.translateOnAxis(new THREE__namespace.Vector3().fromArray(l.left),this.scale),this.cameraR.translateOnAxis(new THREE__namespace.Vector3().fromArray(l.right),this.scale);var c=this.sensor.getEyeProjectionMatrix();this.cameraL.projectionMatrix.elements=c.left.slice(),this.cameraR.projectionMatrix.elements=c.right.slice(),this.renderer.setViewport(s.x,s.y,s.width,s.height),this.renderer.setScissor(s.x,s.y,s.width,s.height),this.renderer.render(t,this.cameraL),this.renderer.setViewport(u.x,u.y,u.width,u.height),this.renderer.setScissor(u.x,u.y,u.width,u.height),this.renderer.render(t,this.cameraR),this.renderer.setViewport(0,0,r.width,r.height),this.renderer.setScissor(0,0,r.width,r.height),this.renderer.setScissorTest(!1),o&&(t.autoUpdate=!0)}else this.renderer.render(t,e)},n.prototype.dispose=function(){},n}();const cardboard="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASwAAADqCAMAAAAvZYhaAAAC/VBMVEUAAAD///99fX37+/v5+fn29vbx8fHv7+/Nzc3o6Ojq6urh4eHU1NTR0dGDg4Pl5eWSkpLHx8fj4+Pe3t7X19fAwMDZ2dnCwsKrq6uioqLb29uNjY2enp67u7t5eXmAgIC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ahLyiWJRhLr3Ai2BVzQYKG4lLYXfg8HCSI33a2nTH5OaVWmzYHJGhsdLmDuN2exAonBTzZIuzEUS+ec0ZMBQn+Ea5KlXNI4C/UAO/k6hKwBptJgn8fgmVckgFXML9YEEFLUKMvlqAp0eWyDEAL65dLqyWo6RekTZ2XNCsD6rgpTK/4p3WcrrPH1ghWJGhONC3JoGAkRHH1JKjpNEcCxOV2I8MWyiUJqNVajSVodgiWcVMVLVeSS1ATCZoc88qjVKlSc3kSLJ5c5V6rTZQAcVkGbBeuOkgCgq2CBM3MoFwGr1tvim2aMpZZqyBBc3N1UF2GX90j9SQJKCBB83OfYAcNVjFcSrvzo95WOShB83Ody5V24fqzO0nAUSzB/89Nph38VqmuOa3gticJOP9fApuHTDt4nFJ7AXdPC0lg8/gq8y5XapSrgpUgbQ0JpF5u97hS1fOC26nlJJA8Yd41Sg3fU4dtRQkKeXSN3jo4Qqm0397OmyZOGatoDrScBIWM3DFn5kXi1ZyqRSUoZtKOa1vWKArztqgEnhIHty4f9/btuEstKwGkxf+XuCT5CbTFnFRuxktuAAAAAElFTkSuQmCC";var _a,LOCALE={zh:{TITLE:"眼镜模式",HIT:"请将手机横屏放入 VR 眼镜中"},en:{TITLE:"GLASSES MODE",HIT:"Please put the mobile phone horizontally into the VR glasses."},ja:{TITLE:"メガネモード",HIT:"携帯電話をVRメガネに水平に入れてください。"}},TEXT=typeof navigator!="undefined"&&(_a=LOCALE[navigator.language.split("-")[0]])!==null&&_a!==void 0?_a:LOCALE.zh,CONTENTS=`
|
|
1597
1597
|
<style>
|
|
1598
1598
|
.$id {
|
|
1599
1599
|
all: initial;
|
|
@@ -1954,7 +1954,7 @@ void main() {
|
|
|
1954
1954
|
|
|
1955
1955
|
gl_FragColor = vec4(gl_FragColor.rgb, gl_FragColor.a * opacity * outside * inside);
|
|
1956
1956
|
}
|
|
1957
|
-
`,PanoSphereMesh=function(n){__extends(t,n);function t(){var e=n.call(this)||this;e.progress=0,e.opacity=0,e.loading=!1,e.current=!1,e.disabled=!1,e.currentMotion=new Motion({ringScale:1.1,ringOpacity:0,circleFade:0,circleOpacity:.85,circleScale:1}),e.opacityMotion=new Motion({opacity:0}),e.loadingMotion=new Motion({opacity:0}),e.disableMotion=new Motion({opacity:0});var r={blending:THREE__namespace.CustomBlending,blendSrc:THREE__namespace.SrcAlphaFactor,blendDst:THREE__namespace.OneMinusSrcAlphaFactor,blendSrcAlpha:THREE__namespace.OneFactor,blendDstAlpha:THREE__namespace.OneMinusSrcAlphaFactor,depthWrite:!1,transparent:!0};return e.hitTestMesh=new THREE__namespace.Mesh(sharedGeometry,new THREE__namespace.MeshBasicMaterial(__assign(__assign({},r),{color:0,opacity:0}))),e.hitTestMesh.scale.set(1.5,1.5,1.5),e.ringMesh=new THREE__namespace.Mesh(sharedGeometry,new THREE__namespace.ShaderMaterial(__assign(__assign({},r),{vertexShader:ringVertexShader,fragmentShader:ringFragmentShader,uniforms:{opacity:{value:0}}}))),e.panoMesh=new THREE__namespace.Mesh(sharedGeometry,new THREE__namespace.ShaderMaterial(__assign(__assign({},r),{vertexShader,fragmentShader,uniforms:{circleScale:{value:1.1},circleFade:{value:0},circleOpacity:{value:.5},loadingAngle:{value:0},loadingOpacity:{value:0},opacity:{value:0},disable:{value:0}}}))),e.add(e.hitTestMesh),e.add(e.ringMesh),e.add(e.panoMesh),e.renderOrder=1e4,e.needsRender=!0,e}return t.prototype.setProgress=function(e){this.progress=e,this.setLoading(e>0)},t.prototype.setOpacity=function(e){this.opacity!==e&&(this.opacity=e=clamp$1(e,0,1),this.opacityMotion.set({opacity:e},30).catch(noop$1))},t.prototype.setCurrent=function(e){if(this.current!==e){if(e){var r=[{progress:0,value:{ringScale:2,ringOpacity:0,circleFade:0,circleOpacity:.85,circleScale:1}},{progress:.05,value:{ringScale:1,ringOpacity:1,circleFade:0,circleOpacity:.85,circleScale:1}},{progress:.15,value:{ringScale:1.2,ringOpacity:1,circleFade:0,circleOpacity:.85,circleScale:1}},{progress:.25,value:{ringScale:1.1,ringOpacity:1,circleFade:0,circleOpacity:.85,circleScale:1}},{progress:.8,value:{ringScale:1.1,ringOpacity:1,circleFade:1,circleOpacity:.85,circleScale:1}},{progress:.9,value:{ringScale:1.1,ringOpacity:1,circleFade:1,circleOpacity:.65,circleScale:.8}},{progress:.92,value:{ringScale:1.1,ringOpacity:1,circleFade:1,circleOpacity:.65,circleScale:.8}},{progress:1,value:{ringScale:1.1,ringOpacity:1,circleFade:1,circleOpacity:.85,circleScale:1.1}}];this.currentMotion.setKeyframes(r,1500).catch(noop$1)}else{var r=[{progress:0,value:__assign({},this.currentMotion.value)},{progress:1,value:{ringScale:1.1,ringOpacity:0,circleFade:0,circleOpacity:.85,circleScale:1}}];this.currentMotion.setKeyframes(r,200).catch(noop$1)}this.current=e}},t.prototype.setLoading=function(e){this.loading!==e&&(e?this.loadingMotion.setKeyframes([{progress:0,value:{opacity:0}},{progress:.3,value:{opacity:0}},{progress:1,value:{opacity:.8}}],500).catch(noop$1):this.loadingMotion.set({opacity:0},0).catch(noop$1),this.loading=e,this.disabled===!0&&this.setDisabled(!1),this.needsRender=!0)},t.prototype.setDisabled=function(e){this.disabled!==e&&(this.disabled=e,this.loading===!0&&this.setLoading(!1),this.disableMotion.set({opacity:e?1:0},300).catch(noop$1),this.needsRender=!0)},t.prototype.tap=function(){return Promise.resolve()},t.prototype.updateTime=function(e,r){this.opacityMotion.update(e),this.currentMotion.update(e),this.loadingMotion.update(e);var o=this.opacityMotion.value.opacity;this.visible=o!==0;var s=this.currentMotion.value,u=s.ringScale,l=s.ringOpacity,c=s.circleFade,f=s.circleOpacity,d=s.circleScale;this.ringMesh.scale.set(u,1,u),this.ringMesh.material.uniforms.opacity.value=l*o,this.panoMesh.material.uniforms.opacity.value=o,this.panoMesh.material.uniforms.circleOpacity.value=f,this.panoMesh.material.uniforms.circleScale.value=d,this.panoMesh.material.uniforms.circleFade.value=c,this.panoMesh.material.uniforms.loadingOpacity.value=this.loadingMotion.value.opacity,this.panoMesh.material.uniforms.disable.value=this.disableMotion.value.opacity,this.panoMesh.material.uniforms.loadingAngle.value=e/120%(Math.PI*2),this.needsRender=!0},t.prototype.dispose=function(){this.hitTestMesh.material.dispose(),this.ringMesh.material.dispose(),this.panoMesh.material.dispose()},t}(THREE__namespace.Object3D),ACTIVE_TO_CURRENT_DELAY=1500,VRPanoramaController=function(n){__extends(t,n);function t(e){var r=this,o=t.parseArgs(e);r=n.call(this,o)||this,r.mode="VRPanorama",r.cardboard=new Cardboard(r.renderer);var s=createHelper();r.helperElement=s;var u=new Hammer(s);return r.element.parentNode&&(r.element.parentNode.insertBefore(s,r.element),r.setHelperElementSize(),u.on("tap",function(){return r.emit("vr.requestExit",createEvent("vr.requestExit",{}))})),r.destroyHelper=function(){u.destroy(),s.parentNode&&s.parentNode.removeChild(s),delete r.helperElement},r}return t.parseArgs=function(e){if(e instanceof t)return e;var r=__assign(__assign({},e),{maxLatitude:Math.PI/2,minLatitude:-Math.PI/2});return n.parseArgs.call(this,r)},t.initAnimationEndState=function(e){var r=this.parseArgs(e),o=n.initAnimationEndState.call(this,r);return __assign(__assign({},o),{mode:"VRPanorama"})},t.prototype.destroy=function(){n.prototype.destroy.call(this),this.cardboard.dispose(),this.destroyHelper();for(var e=Object.keys(this.panoMeshes),r=0,o=e;r<o.length;r++){var s=o[r],u=this.panoMeshes[s];this.helper.remove(u),u.dispose(),delete this.panoMeshes[s]}},t.prototype.isReady=function(){return!1},t.prototype.updateRenderSize=function(){this.needsRender=!0,this.modelSceneNeedsRender=!0,this.setHelperElementSize()},t.prototype.updateCamera=function(e,r,o){return Promise.resolve()},t.prototype.updateCameraWithKeyframes=function(e,r,o){return Promise.resolve()},t.prototype.updatePanoMeshesVisible=function(){for(var e=this.works.getResolvedObserver(this.currentPano),r=(e?e.visibleIds:[]).concat(panoStringify(this.currentPano)),o=0,s=this.works.resolvedObservers;o<s.length;o++){var u=s[o],l=this.panoMeshes[u.panoId];l&&(r.indexOf(u.panoId)>=0?l.parent!==this.helper&&this.helper.add(l):l.parent===this.helper&&(this.helper.remove(l),l.setOpacity(0)))}},t.prototype.updatePanoMeshes=function(){for(var e=Object.keys(this.panoMeshes),r=0,o=e;r<o.length;r++){var s=o[r],u=this.panoMeshes[s];this.helper.remove(u),u.dispose(),delete this.panoMeshes[s]}for(var l=0,c=this.works.resolvedObservers;l<c.length;l++){var f=c[l],d=f.panoId,p=new PanoSphereMesh;p.name="panoSphere_".concat(d),p.position.copy(f.position),p.needsRender=!0,this.panoMeshes[d]=p}this.updatePanoMeshesVisible()},t.prototype.updateTime=function(e,r){var o=this,s,u,l,c,f,d,p,v,g,h;if(!this.destroyed){var m=this.currentPano;this.userAction=!0,this.needsRender=!0,this.modelSceneNeedsRender=!0;var y={},A={},E=this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[0]),b=this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[this.locationMotion.keyframes.length-1]),T=!1;if(this.modelAlphaMotion.ended===!1&&(this.modelAlphaMotion.update(e),y.modelAlpha=this.modelAlphaMotion.value.modelAlpha),this.perspToOrthoMotion.ended===!1&&(this.perspToOrthoMotion.update(e),this.camera.perspToOrtho.setScalar(clamp$1(this.perspToOrthoMotion.value.perspToOrtho,0,1))),this.locationMotion.ended===!1){this.locationMotion.update(e);var _=this.locationMotion.getKeyFrameSegment(e),R=_[0],S=_[1],M=this.panoResourceFromLocationMotionKeyframe(R),B=this.panoResourceFromLocationMotionKeyframe(S),H=M.position,w=B.position,C=this.locationMotion.value.count-S.value.count+1;y.progress=C,B.panoPicture&&(C<1?M.panoPicture&&(y.pano0=M.panoPicture):y.pano0=B.panoPicture,y.pano1=B.panoPicture),B.effect==="montage"?y.transition="BLACK":B.effect==="spread"?y.transition="SPREAD":y.transition="FADE",(B.effect==="zoomin"||B.effect==="zoomout")&&(y.progress=Math.pow(C,3)),C<1&&B.effect!=="fly"&&(y.pano0&&M.panoPicture&&(y.pano0={map:y.pano0.map,zoom:y.pano0.zoom,luminanceMap:y.pano0.luminanceMap,matrix:M.panoPicture.matrix.clone().premultiply(M.fixCameraTransform).setPosition(B.position)}),H.copy(w),T=!0),A.distance=this.locationMotion.value.distance,A.offset=new THREE__namespace.Vector3(H.x+(w.x-H.x)*C,H.y+(w.y-H.y)*C,H.z+(w.z-H.z)*C);for(var L=[],I=[],F=0,k=this.locationMotion.keyframes;F<k.length;F++){var N=k[F],D=N.key,U=N.progress;D!==void 0&&(L.push(D),U>this.locationMotion.progress&&I.push(D))}for(var Q=0,q=Object.keys(this.panoResources);Q<q.length;Q++){var G=q[Q];if(!(I.indexOf(G)>=0)){var J=this.panoResources[G];if(J.panoPicture){var X=J.panoPicture.map,W=J.panoPicture.luminanceMap;if(X){if(X===((s=y.pano0)===null||s===void 0?void 0:s.map)||X===((u=y.pano1)===null||u===void 0?void 0:u.map))continue;X instanceof TileCubeTextureTarget&&X.cubeRenderTarget&&this.colorCubeRenderTargetPool.push(X.cubeRenderTarget),X.dispose(),W&&(W instanceof TileCubeTextureTarget&&W.cubeRenderTarget&&this.luminanceCubeRenderTargetPool.push(W.cubeRenderTarget),W.dispose()),J.panoPicture=null}}L.indexOf(G)>=0||delete this.panoResources[G]}}this.currentPano=panoParse(B.panoId),this.emit("pano.moving",createEvent("pano.moving",{userAction:this.userAction,prevPano:panoParse(E.panoId),state:__assign(__assign(__assign(__assign({},panoParse(b.panoId)),{mode:this.mode}),clonePose(this.camera.pose)),A),options:{},progress:this.locationMotion.progress,error:null}))}isEmptyObject(y)===!1&&(!((l=y.pano0)===null||l===void 0)&&l.map&&y.pano0.map instanceof TileCubeTextureTarget&&!y.pano0.map.cubeRenderTarget&&(y.pano0.map.cubeRenderTarget=this.colorCubeRenderTargetPool.pop()),!((c=y.pano0)===null||c===void 0)&&c.luminanceMap&&y.pano0.luminanceMap instanceof TileCubeTextureTarget&&!y.pano0.luminanceMap.cubeRenderTarget&&(y.pano0.luminanceMap.cubeRenderTarget=this.luminanceCubeRenderTargetPool.pop()),!((f=y.pano1)===null||f===void 0)&&f.map&&y.pano1.map instanceof TileCubeTextureTarget&&!y.pano1.map.cubeRenderTarget&&(y.pano1.map.cubeRenderTarget=this.colorCubeRenderTargetPool.pop()),!((d=y.pano1)===null||d===void 0)&&d.luminanceMap&&y.pano1.luminanceMap instanceof TileCubeTextureTarget&&!y.pano1.luminanceMap.cubeRenderTarget&&(y.pano1.luminanceMap.cubeRenderTarget=this.luminanceCubeRenderTargetPool.pop()),this.models.setMaterial(y)),A.offset&&this.camera.position.copy(A.offset),panoEqual(this.currentPano,m)&&this.updatePanoMeshesVisible();var j=this.camera.pose.longitude,te=this.camera.pose.latitude;this.camera.quaternion.fromArray(this.cardboard.sensor.getOrientation()),this.camera.computePose();var $=this.works.getResolvedObserver(this.currentPano);if(this.camera.pose.distance>.1||T)for(var ne=0,ie=Object.keys(this.panoMeshes);ne<ie.length;ne++){var oe=ie[ne],Z=this.panoMeshes[oe];Z.setOpacity(0),Z.updateTime&&Z.updateTime(e,r),Z.visible=!1}else if($)for(var de=$.visibleIds.concat(panoStringify(this.currentPano)),he=0,fe=de;he<fe.length;he++){var oe=fe[he],Te=panoParse(oe),ce=this.works.getResolvedObserver(Te);if(ce){var Z=this.panoMeshes[oe];if(!ce.loadable&&!ce.active){Z.setOpacity(0);continue}var ge=Z.position.clone().setY(this.camera.position.y).distanceTo(this.camera.position);ge<.05?Z.setOpacity(0):Z.setOpacity(clamp$1(1.5/ge,0,1)),panoEqual(this.currentPano,Te)&&Z.setOpacity(0),Z.lookAt(this.camera.position)}}if(this.locationMotion.ended)for(var ee=this.intersect(e),re=0,z=this.works.resolvedObservers;re<z.length;re++){var ce=z[re],Z=this.panoMeshes[ce.panoId];Z&&(Z.setCurrent(Z===ee),Z.updateTime&&Z.updateTime(e,r))}(j!==this.camera.pose.longitude||te!==this.camera.pose.latitude)&&(this.cameraMotion.set(pick(this.camera.pose,["longitude","latitude"]),0).catch(noop$1),this.emit("camera.update",createEvent("camera.update",{userAction:!0,state:__assign(__assign(__assign({},this.currentPano),{mode:this.mode}),clonePose(this.camera.pose))})));var Re=this.tileLevel=function(){if(o.tileLevelForFov===!1)return 0;var be=o.renderer.getDrawingBufferSize(new THREE__namespace.Vector2);be.width*=o.scissor.width,be.height*=o.scissor.height;var pe=b.panoId,ae=o.works.getResolvedObserver(pe),ue=o.imageOptions.size;if(typeof ue=="undefined"&&ae){var Se=ae.images.up.match(/\/cube_(\d+)\//);Se&&(ue=Number(Se[1]))}typeof ue=="undefined"&&(ue=2048);var le=0;ue>=1024&&(le=1),ue>=2048&&(le=2),ue>=4096&&(le=3),ue>=8192&&(le=4);var Ie=o.tileLevelForFov(o.camera.fov,be);return Ie>le?Ie:0}(),ve=function(){var be=o.camera.quaternion.clone(),pe=o.works.getResolvedObserver(b.panoId),ae=pe!=null?pe:$;ae&&be.premultiply(ae.quaternion.clone().inverse());var ue=new THREE__namespace.Matrix4().makeRotationFromQuaternion(be),Se=new THREE__namespace.Matrix4().getInverse(ue),le=new THREE__namespace.Frustum().setFromProjectionMatrix(new THREE__namespace.Matrix4().multiplyMatrices(o.camera.projectionMatrix,Se));return le}();b.panoId===panoStringify(this.currentPano)&&(((p=b.panoPicture)===null||p===void 0?void 0:p.map)instanceof TileCubeTextureTarget&&(b.panoPicture.map.maxRequest=this.tileMaxRequest,b.panoPicture.map.update(ve,Re),b.panoPicture.map.needsRender===!0&&(b.panoPicture.map.needsRender=!1,this.needsRender=!0,this.modelSceneNeedsRender=!0)),((v=b.panoPicture)===null||v===void 0?void 0:v.luminanceMap)instanceof TileCubeTextureTarget&&(b.panoPicture.luminanceMap.maxRequest=this.tileMaxRequest,b.panoPicture.luminanceMap.update(ve,Re),b.panoPicture.luminanceMap.needsRender===!0&&(b.panoPicture.luminanceMap.needsRender=!1,this.needsRender=!0,this.modelSceneNeedsRender=!0)));{var me=this.tiling.object.visible;if(this.initAnimationed){var we=b.panoId,ye=this.works.getResolvedObserver(we);ye?isSimilarVector3(this.camera.position,ye.position)&&this.locationMotion.ended?(this.tiling.object.visible=!0,this.tiling.panoId!==we&&this.tiling.cleanup(),this.tiling.panoId=we,this.tiling.setResource((h=(g=ye.images)===null||g===void 0?void 0:g.tiles)!==null&&h!==void 0?h:[],this.enableIOSEDR&&ye.images.luminance?ye.images.luminance:null),this.tiling.setFetcher(getFetcher(ye.work)),this.tiling.setRotation(ye.quaternion),this.tiling.setPosition(ye.position),this.tiling.maxRequest=this.tileMaxRequest,Re>this.TILED_CUBE_TEXTURE_LEVEL?this.tiling.update(ve,Re,e):this.tiling.update(ve,0,e)):this.tiling.object.visible=!1:this.tiling.object.visible=!1}else this.tiling.object.visible=!1;me!==this.tiling.object.visible&&(this.tiling.object.needsRender=!0,this.modelSceneNeedsRender=!0)}this.panoVideo.object.position.copy(this.camera.position),this.panoVideo.updateTime(e)}},t.prototype.render=function(){this.cardboard.render(this.modelScene,this.camera),this.renderer.autoClear=!1,this.cardboard.render(this.scene,this.camera),this.renderer.autoClear=!0},t.prototype.setCamera=function(e){},t.prototype.destroyHelper=function(){},t.prototype.setHelperElementSize=function(){if(this.helperElement){var e=new THREE__namespace.Vector2(this.element.offsetWidth,this.element.offsetHeight),r=e.x*this.scissor.left,o=e.y*(1-this.scissor.bottom-this.scissor.height),s=e.x*this.scissor.width,u=e.y*this.scissor.height;this.helperElement.style.marginLeft=r+"px",this.helperElement.style.marginTop=o+"px",this.helperElement.style.width=s+"px",this.helperElement.style.height=u+"px"}},t.prototype.intersect=function(e){var r,o;if(this.locationMotion.ended===!1){this.intersectMesh.visible=!1,delete this.activePanoMesh,delete this.activeTime;return}if(this.activePanoMesh&&this.activeTime&&e-this.activeTime>ACTIVE_TO_CURRENT_DELAY){for(var s=this.activePanoMesh,u=Object.keys(this.panoMeshes),l=null,c=0,f=u;c<f.length;c++){var d=f[c];if(this.panoMeshes[d]===s){l=d;break}}return l!==null&&this.moveToPano(panoParse(l),{},!0),delete this.activePanoMesh,delete this.activeTime,s}var p=this.camera.getDirection(new THREE__namespace.Vector3),v=new THREE__namespace.Raycaster(this.camera.position,p);v.params.Points={threshold:.1};for(var g=void 0,h=[],m=this.works.getResolvedObserver(this.currentPano),y=m?m.visibleIds:[],A=0,E=y;A<E.length;A++){var l=E[A],b=this.panoMeshes[l],T=v.intersectObject((r=b.hitTestMesh)!==null&&r!==void 0?r:b,!0)[0];T&&h.push({panoMesh:b,intersection:__assign({floor:(o=m==null?void 0:m.floorIndex)!==null&&o!==void 0?o:0},T)})}var _=h.sort(function(H,w){return H.intersection.distance-w.intersection.distance})[0];_?(g=_.intersection,this.activePanoMesh!==_.panoMesh&&(this.activePanoMesh=_.panoMesh,this.activeTime=e),this.intersectMesh.position.copy(_.panoMesh.position),this.intersectMesh.lookAt(this.camera.position)):(this.activePanoMesh=void 0,this.activeTime=void 0),g||(g=this.models.intersectRaycaster(v)[0]);var R=createEvent("intersect.update",{raycaster:v,intersection:g!=null?g:null,object:this.intersectMesh});if(this.emit("intersect.update",R),R.defaultPrevented){this.hideIntersectMesh();return}if(g&&g.face){var S=g.face.normal,M=new THREE__namespace.Quaternion;M.setFromUnitVectors(new THREE__namespace.Vector3(0,0,1),S),this.intersectMesh.quaternion.copy(M);var B=g.point.clone();this.intersectMesh.position.copy(B),_?this.intersectMesh.visible=!1:this.intersectMesh.visible=!0}else this.intersectMesh.visible=!1;return _==null?void 0:_.panoMesh},t.prototype.onPanGesture=function(){},t.prototype.onTapGesture=function(){},t.prototype.onPinchGesture=function(){},t.prototype.onMouseMove=function(){},t.prototype.onMouseOut=function(){},t}(PanoramaController),HUMAN_EYE_POSITION=new THREE__namespace.Vector3(0,1.6,0),ModelController=function(n){__extends(t,n);function t(e){var r=this,o,s=t.parseArgs(e);return r=n.call(this,s)||this,r.mode="Model",r.locationMotion=new Motion({x:r.camera.pose.offset.x,y:r.camera.pose.offset.y,z:r.camera.pose.offset.z,distance:r.camera.pose.distance}),r.modelAlphaMotion=new Motion({modelAlpha:(o=r.models.getMaterial().modelAlpha)!==null&&o!==void 0?o:0}),r.perspToOrthoMotion=new Motion({perspToOrtho:r.camera.perspToOrtho.x}),r}return t.parseArgs=function(e){return e instanceof t?e:n.parseArgs.call(this,e)},t.initAnimationEndState=function(e){var r,o,s,u,l,c,f=this.parseArgs(e),d=f.works,p=e.initial,v=p.state,g=p.currentState,h=typeof v.panoIndex=="number"?{workCode:(s=(r=v.workCode)!==null&&r!==void 0?r:(o=f.works[0])===null||o===void 0?void 0:o.workCode)!==null&&s!==void 0?s:"",panoIndex:v.panoIndex}:{workCode:g.workCode,panoIndex:g.panoIndex},m=d.getResolvedObserver(h),y=(u=v.longitude)!==null&&u!==void 0?u:g.longitude,A=clamp$1((l=v.latitude)!==null&&l!==void 0?l:!m||isFristPersonMode(g.mode)?g.latitude:f.defaultLatitude,f.minLatitude,f.maxLatitude),E=clamp$1((c=v.fov)!==null&&c!==void 0?c:!m||isFristPersonMode(g.mode)?g.fov:f.defaultFov,f.minFov,f.maxFov),b=new THREE__namespace.Vector3;if(f.initial.state.offset)b.copy(f.initial.state.offset);else if(m)b.copy(m.position);else{var T=coordinatesToVector(g).setLength(g.distance);b.copy(f.initial.currentState.offset).sub(T)}return{workCode:h.workCode,panoIndex:h.panoIndex,mode:"Model",longitude:y,latitude:A,fov:E,offset:b,distance:0}},t.prototype.destroy=function(){n.prototype.destroy.call(this),this.locationMotion.dispose()},t.prototype.isReady=function(){return this.locationMotion.ended===!1?!1:n.prototype.isReady.call(this)},t.prototype.updateWork=function(e,r,o,s){this.works=e;var u=t.initAnimationEndState(__assign(__assign({},this),{initial:{currentState:__assign(__assign({},this.currentPano),this.camera.pose),duration:o.duration,effect:o.effect,state:r,userAction:s}}));return this.hideIntersectMesh(),this.moveToPosition(u.offset,{duration:0,longitude:u.longitude,latitude:u.latitude,fov:u.fov},s),!0},t.prototype.updateCamera=function(e,r,o){var s=this;return this.initAnimationReady.then(function(){s.userAction=o,s.stopMomentumMovement();var u={},l={};return u.distance=0,e.offset!==void 0&&(u.x=e.offset.x,u.y=e.offset.y,u.z=e.offset.z),e.longitude!==void 0&&(l.longitude=e.longitude),e.latitude!==void 0&&(l.latitude=e.latitude),e.fov!==void 0&&(l.fov=e.fov),s.locationMotion.set(u,r).catch(noop$1),s.cameraMotion.set(l,r).catch(noop$1)})},t.prototype.updateCameraWithKeyframes=function(e,r,o){var s=this;return this.initAnimationReady.then(function(){s.userAction=o,s.stopMomentumMovement();for(var u=[],l=[],c=0,f=e;c<f.length;c++){var d=f[c];u.push({key:d.key,progress:d.progress,value:{distance:0,x:d.value.offset.x,y:d.value.offset.x,z:d.value.offset.x}}),l.push({key:d.key,progress:d.progress,value:{longitude:d.value.longitude,latitude:d.value.latitude,fov:d.value.fov}})}return s.locationMotion.setKeyframes(u,r).catch(noop$1),s.cameraMotion.setKeyframes(e,r)})},t.prototype.updateTime=function(e,r){if(!this.destroyed){var o={},s={};if(this.modelAlphaMotion.ended||(this.modelAlphaMotion.update(e),o.modelAlpha=this.modelAlphaMotion.value.modelAlpha),this.perspToOrthoMotion.ended||(this.perspToOrthoMotion.update(e),this.camera.perspToOrtho.setScalar(clamp$1(this.perspToOrthoMotion.value.perspToOrtho,0,1))),!this.locationMotion.ended){this.locationMotion.update(e),s.distance=this.locationMotion.value.distance,s.offset=new THREE__namespace.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z);var u=new THREE__namespace.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z),l=this.works.resolvedObservers,c=arrayMin(l,function(f){return f.position.distanceTo(u)});this.currentPano=c?{workCode:c.work.workCode,panoIndex:c.panoIndex}:{workCode:"",panoIndex:0}}this.cameraMotion.ended||(this.cameraMotion.update(e),s.longitude=this.cameraMotion.value.longitude,s.latitude=this.cameraMotion.value.latitude,s.fov=this.cameraMotion.value.fov),isEmptyObject(o)||this.models.setMaterial(o),isEmptyObject(s)||this.setCamera(s)}},t.prototype.initAnimation=function(){var e=this;return this.destroyed?Promise.resolve():new Promise(function(r){var o=e.initial;o.state,o.currentState;var s=o.duration,u=o.userAction;e.userAction=u;var l=t.initAnimationEndState(e),c={modelAlpha:1},f={perspToOrtho:0},d={longitude:l.longitude,latitude:l.latitude,fov:l.fov,duration:s,moveStartCallback:function(p){e.perspToOrthoMotion.set(f,s).catch(noop$1),e.modelAlphaMotion.set(c,s).catch(noop$1),e.emit("initAnimation.start",createEvent("initAnimation.start",{state:p,userAction:e.userAction}))},moveEndCallback:function(p){e.emit("initAnimation.end",createEvent("initAnimation.end",{state:p,userAction:e.userAction})),r()},moveCancelCallback:function(){var p=e.currentPano,v=__assign(__assign({},p),{mode:e.mode,longitude:e.camera.pose.longitude,latitude:e.camera.pose.latitude,fov:e.camera.pose.fov,offset:e.camera.pose.offset.clone(),distance:e.camera.pose.distance});e.emit("initAnimation.end",createEvent("initAnimation.end",{state:v,userAction:e.userAction})),r()}};e.moveToPosition(l.offset,d,u)})},t.prototype.getTargetState=function(){var e=this.cameraMotion.getKeyFrameSegment(now())[1],r=this.locationMotion.getKeyFrameSegment(now())[1];return __assign(__assign({},this.currentPano),{mode:this.mode,longitude:e.value.longitude,latitude:e.value.latitude,fov:e.value.fov,offset:new THREE__namespace.Vector3(r.value.x,r.value.y,r.value.z),distance:r.value.distance})},t.prototype.moveToPano=function(e,r,o){r===void 0&&(r={});var s=this.works.getResolvedObserver(e);s&&this.moveToPosition(s.position,r,o)},t.prototype.moveToPosition=function(e,r,o){var s=this,u,l,c;r===void 0&&(r={}),this.userAction=o,this.stopMomentumMovement();for(var f=now(),d=new THREE__namespace.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z),p=d.distanceTo(e),v=this.locationMotion.getProgressVelocity(f),g=0,h=1;h<this.locationMotion.keyframes.length;h++){var m=this.locationMotion.keyframes[h-1].value,y=m.x,A=m.y,E=m.z,b=this.locationMotion.keyframes[h].value,T=b.x,_=b.y,R=b.z;g+=Math.sqrt(Math.pow(T-y,2)+Math.pow(_-A,2)+Math.pow(R-E,2))}var S=p===0?0:v*g/p,M=this.calculateMovingDuration(r.duration,p),B={x:e.x,y:e.y,z:e.z,distance:0},H={longitude:r.longitude,latitude:r.latitude,fov:r.fov},w=this.works.resolvedObservers,C=arrayMin(w,function(k){return k.position.distanceTo(d)}),L=C?{workCode:C.work.workCode,panoIndex:C.panoIndex}:{workCode:"",panoIndex:0},I=__assign(__assign({},L),{mode:this.mode,longitude:(u=H.longitude)!==null&&u!==void 0?u:this.camera.pose.longitude,latitude:(l=H.latitude)!==null&&l!==void 0?l:this.camera.pose.latitude,fov:(c=H.fov)!==null&&c!==void 0?c:this.camera.pose.fov,offset:e.clone(),distance:0}),F=this.currentPano;this.emit("pano.moveTo",createEvent("pano.moveTo",{options:r,prevPano:F,progress:0,state:I,userAction:this.userAction,error:null})),r.moveStartCallback&&r.moveStartCallback(I),this.cameraMotion.set(H,M).catch(noop$1),this.locationMotion.set(B,M,S).then(function(){for(var k=0,N=s.models;k<N.length;k++){var D=N[k];D.show()}var U=__assign(__assign(__assign({},L),{mode:s.mode}),clonePose(s.camera.pose));s.emit("pano.arrived",createEvent("pano.arrived",{options:r,prevPano:F,progress:0,state:U,userAction:s.userAction,error:null})),r.moveEndCallback&&r.moveEndCallback(U)},function(){r.moveCancelCallback&&r.moveCancelCallback(),s.emit("pano.cancel",createEvent("pano.cancel",{options:r,prevPano:F,progress:0,state:I,userAction:s.userAction,error:null}))})},t.prototype.onTapGesture=function(e){var r=e.center.raycaster;this.stopMomentumMovement();var o=this.models.intersectRaycaster(r)[0];if(o&&o.face){var s=o.face.normal,u=o.point;if(new THREE__namespace.Vector3(0,1,0).angleTo(s)>Math.PI/3){var l=s.clone().setLength(.3).add(u);r.set(l,new THREE__namespace.Vector3(0,-1,0)),o=this.models.intersectRaycaster(r)[0]}}if(o){var c=new THREE__namespace.Vector3().copy(o.point).add(HUMAN_EYE_POSITION),f=this.works.resolvedObservers,d=arrayMin(f,function(g){return g.position.distanceTo(c)},!0),p=d[0],v=d[1];p&&v<5&&(c.y=p.position.y),e.state.offset.copy(c),e.state.distance=0,this.emit("gesture.tap",e),e.defaultPrevented||this.moveToPosition(c,{},!0)}else this.emit("gesture.tap",e),e.defaultPrevented||this.cameraBounce()},t}(PanoramaLikeController);const edlVertexShader=function n(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=113,o=126,s=0,u="";return t[s].split(u).map(function(l){return l.charCodeAt(s)>o?l:String.fromCharCode((l.charCodeAt(s)+r)%o)}).join(u)}(`}rpvv|{-zrqvz}-sy|nH}rpvv|{-zrqvz}-v{Hnvor-rp@-}|vv|{Hnvor-rp?-H{vs|z-znA-}|wrpv|{Znv\x07H{vs|z-znA-z|qrycvrZnv\x07Hn\bv{t-rp?-bH|vq-znv{56-
|
|
1957
|
+
`,PanoSphereMesh=function(n){__extends(t,n);function t(){var e=n.call(this)||this;e.progress=0,e.opacity=0,e.loading=!1,e.current=!1,e.disabled=!1,e.currentMotion=new Motion({ringScale:1.1,ringOpacity:0,circleFade:0,circleOpacity:.85,circleScale:1}),e.opacityMotion=new Motion({opacity:0}),e.loadingMotion=new Motion({opacity:0}),e.disableMotion=new Motion({opacity:0});var r={blending:THREE__namespace.CustomBlending,blendSrc:THREE__namespace.SrcAlphaFactor,blendDst:THREE__namespace.OneMinusSrcAlphaFactor,blendSrcAlpha:THREE__namespace.OneFactor,blendDstAlpha:THREE__namespace.OneMinusSrcAlphaFactor,depthWrite:!1,transparent:!0};return e.hitTestMesh=new THREE__namespace.Mesh(sharedGeometry,new THREE__namespace.MeshBasicMaterial(__assign(__assign({},r),{color:0,opacity:0}))),e.hitTestMesh.scale.set(1.5,1.5,1.5),e.ringMesh=new THREE__namespace.Mesh(sharedGeometry,new THREE__namespace.ShaderMaterial(__assign(__assign({},r),{vertexShader:ringVertexShader,fragmentShader:ringFragmentShader,uniforms:{opacity:{value:0}}}))),e.panoMesh=new THREE__namespace.Mesh(sharedGeometry,new THREE__namespace.ShaderMaterial(__assign(__assign({},r),{vertexShader,fragmentShader,uniforms:{circleScale:{value:1.1},circleFade:{value:0},circleOpacity:{value:.5},loadingAngle:{value:0},loadingOpacity:{value:0},opacity:{value:0},disable:{value:0}}}))),e.add(e.hitTestMesh),e.add(e.ringMesh),e.add(e.panoMesh),e.renderOrder=1e4,e.needsRender=!0,e}return t.prototype.setProgress=function(e){this.progress=e,this.setLoading(e>0)},t.prototype.setOpacity=function(e){this.opacity!==e&&(this.opacity=e=clamp$1(e,0,1),this.opacityMotion.set({opacity:e},30).catch(noop$1))},t.prototype.setCurrent=function(e){if(this.current!==e){if(e){var r=[{progress:0,value:{ringScale:2,ringOpacity:0,circleFade:0,circleOpacity:.85,circleScale:1}},{progress:.05,value:{ringScale:1,ringOpacity:1,circleFade:0,circleOpacity:.85,circleScale:1}},{progress:.15,value:{ringScale:1.2,ringOpacity:1,circleFade:0,circleOpacity:.85,circleScale:1}},{progress:.25,value:{ringScale:1.1,ringOpacity:1,circleFade:0,circleOpacity:.85,circleScale:1}},{progress:.8,value:{ringScale:1.1,ringOpacity:1,circleFade:1,circleOpacity:.85,circleScale:1}},{progress:.9,value:{ringScale:1.1,ringOpacity:1,circleFade:1,circleOpacity:.65,circleScale:.8}},{progress:.92,value:{ringScale:1.1,ringOpacity:1,circleFade:1,circleOpacity:.65,circleScale:.8}},{progress:1,value:{ringScale:1.1,ringOpacity:1,circleFade:1,circleOpacity:.85,circleScale:1.1}}];this.currentMotion.setKeyframes(r,1500).catch(noop$1)}else{var r=[{progress:0,value:__assign({},this.currentMotion.value)},{progress:1,value:{ringScale:1.1,ringOpacity:0,circleFade:0,circleOpacity:.85,circleScale:1}}];this.currentMotion.setKeyframes(r,200).catch(noop$1)}this.current=e}},t.prototype.setLoading=function(e){this.loading!==e&&(e?this.loadingMotion.setKeyframes([{progress:0,value:{opacity:0}},{progress:.3,value:{opacity:0}},{progress:1,value:{opacity:.8}}],500).catch(noop$1):this.loadingMotion.set({opacity:0},0).catch(noop$1),this.loading=e,this.disabled===!0&&this.setDisabled(!1),this.needsRender=!0)},t.prototype.setDisabled=function(e){this.disabled!==e&&(this.disabled=e,this.loading===!0&&this.setLoading(!1),this.disableMotion.set({opacity:e?1:0},300).catch(noop$1),this.needsRender=!0)},t.prototype.tap=function(){return Promise.resolve()},t.prototype.updateTime=function(e,r){this.opacityMotion.update(e),this.currentMotion.update(e),this.loadingMotion.update(e);var o=this.opacityMotion.value.opacity;this.visible=o!==0;var s=this.currentMotion.value,u=s.ringScale,l=s.ringOpacity,c=s.circleFade,f=s.circleOpacity,d=s.circleScale;this.ringMesh.scale.set(u,1,u),this.ringMesh.material.uniforms.opacity.value=l*o,this.panoMesh.material.uniforms.opacity.value=o,this.panoMesh.material.uniforms.circleOpacity.value=f,this.panoMesh.material.uniforms.circleScale.value=d,this.panoMesh.material.uniforms.circleFade.value=c,this.panoMesh.material.uniforms.loadingOpacity.value=this.loadingMotion.value.opacity,this.panoMesh.material.uniforms.disable.value=this.disableMotion.value.opacity,this.panoMesh.material.uniforms.loadingAngle.value=e/120%(Math.PI*2),this.needsRender=!0},t.prototype.dispose=function(){this.hitTestMesh.material.dispose(),this.ringMesh.material.dispose(),this.panoMesh.material.dispose()},t}(THREE__namespace.Object3D),ACTIVE_TO_CURRENT_DELAY=1500,VRPanoramaController=function(n){__extends(t,n);function t(e){var r=this,o=t.parseArgs(e);r=n.call(this,o)||this,r.mode="VRPanorama",r.cardboard=new Cardboard(r.renderer);var s=createHelper();r.helperElement=s;var u=new Hammer(s);return r.element.parentNode&&(r.element.parentNode.insertBefore(s,r.element),r.setHelperElementSize(),u.on("tap",function(){return r.emit("vr.requestExit",createEvent("vr.requestExit",{}))})),r.destroyHelper=function(){u.destroy(),s.parentNode&&s.parentNode.removeChild(s),delete r.helperElement},r}return t.parseArgs=function(e){if(e instanceof t)return e;var r=__assign(__assign({},e),{maxLatitude:Math.PI/2,minLatitude:-Math.PI/2});return n.parseArgs.call(this,r)},t.initAnimationEndState=function(e){var r=this.parseArgs(e),o=n.initAnimationEndState.call(this,r);return __assign(__assign({},o),{mode:"VRPanorama"})},t.prototype.destroy=function(){n.prototype.destroy.call(this),this.cardboard.dispose(),this.destroyHelper();for(var e=Object.keys(this.panoMeshes),r=0,o=e;r<o.length;r++){var s=o[r],u=this.panoMeshes[s];this.helper.remove(u),u.dispose(),delete this.panoMeshes[s]}},t.prototype.isReady=function(){return!1},t.prototype.updateRenderSize=function(){this.needsRender=!0,this.modelSceneNeedsRender=!0,this.setHelperElementSize()},t.prototype.updateCamera=function(e,r,o){return Promise.resolve()},t.prototype.updateCameraWithKeyframes=function(e,r,o){return Promise.resolve()},t.prototype.updatePanoMeshesVisible=function(){for(var e=this.works.getResolvedObserver(this.currentPano),r=(e?e.visibleIds:[]).concat(panoStringify(this.currentPano)),o=0,s=this.works.resolvedObservers;o<s.length;o++){var u=s[o],l=this.panoMeshes[u.panoId];l&&(r.indexOf(u.panoId)>=0?l.parent!==this.helper&&this.helper.add(l):l.parent===this.helper&&(this.helper.remove(l),l.setOpacity(0)))}},t.prototype.updatePanoMeshes=function(){for(var e=Object.keys(this.panoMeshes),r=0,o=e;r<o.length;r++){var s=o[r],u=this.panoMeshes[s];this.helper.remove(u),u.dispose(),delete this.panoMeshes[s]}for(var l=0,c=this.works.resolvedObservers;l<c.length;l++){var f=c[l],d=f.panoId,p=new PanoSphereMesh;p.name="panoSphere_".concat(d),p.position.copy(f.position),p.needsRender=!0,this.panoMeshes[d]=p}this.updatePanoMeshesVisible()},t.prototype.updateTime=function(e,r){var o=this,s,u,l,c,f,d,p,v,g,h;if(!this.destroyed){var m=this.currentPano;this.userAction=!0,this.needsRender=!0,this.modelSceneNeedsRender=!0;var y={},A={},E=this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[0]),b=this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[this.locationMotion.keyframes.length-1]),T=!1;if(this.modelAlphaMotion.ended===!1&&(this.modelAlphaMotion.update(e),y.modelAlpha=this.modelAlphaMotion.value.modelAlpha),this.perspToOrthoMotion.ended===!1&&(this.perspToOrthoMotion.update(e),this.camera.perspToOrtho.setScalar(clamp$1(this.perspToOrthoMotion.value.perspToOrtho,0,1))),this.locationMotion.ended===!1){this.locationMotion.update(e);var _=this.locationMotion.getKeyFrameSegment(e),R=_[0],S=_[1],M=this.panoResourceFromLocationMotionKeyframe(R),B=this.panoResourceFromLocationMotionKeyframe(S),H=M.position,w=B.position,C=this.locationMotion.value.count-S.value.count+1;y.progress=C,B.panoPicture&&(C<1?M.panoPicture&&(y.pano0=M.panoPicture):y.pano0=B.panoPicture,y.pano1=B.panoPicture),B.effect==="montage"?y.transition="BLACK":B.effect==="spread"?y.transition="SPREAD":y.transition="FADE",(B.effect==="zoomin"||B.effect==="zoomout")&&(y.progress=Math.pow(C,3)),C<1&&B.effect!=="fly"&&(y.pano0&&M.panoPicture&&(y.pano0={map:y.pano0.map,zoom:y.pano0.zoom,luminanceMap:y.pano0.luminanceMap,matrix:M.panoPicture.matrix.clone().premultiply(M.fixCameraTransform).setPosition(B.position)}),H.copy(w),T=!0),A.distance=this.locationMotion.value.distance,A.offset=new THREE__namespace.Vector3(H.x+(w.x-H.x)*C,H.y+(w.y-H.y)*C,H.z+(w.z-H.z)*C);for(var L=[],I=[],F=0,k=this.locationMotion.keyframes;F<k.length;F++){var N=k[F],D=N.key,U=N.progress;D!==void 0&&(L.push(D),U>this.locationMotion.progress&&I.push(D))}for(var z=0,G=Object.keys(this.panoResources);z<G.length;z++){var q=G[z];if(!(I.indexOf(q)>=0)){var K=this.panoResources[q];if(K.panoPicture){var j=K.panoPicture.map,W=K.panoPicture.luminanceMap;if(j){if(j===((s=y.pano0)===null||s===void 0?void 0:s.map)||j===((u=y.pano1)===null||u===void 0?void 0:u.map))continue;j instanceof TileCubeTextureTarget&&j.cubeRenderTarget&&this.colorCubeRenderTargetPool.push(j.cubeRenderTarget),j.dispose(),W&&(W instanceof TileCubeTextureTarget&&W.cubeRenderTarget&&this.luminanceCubeRenderTargetPool.push(W.cubeRenderTarget),W.dispose()),K.panoPicture=null}}L.indexOf(q)>=0||delete this.panoResources[q]}}this.currentPano=panoParse(B.panoId),this.emit("pano.moving",createEvent("pano.moving",{userAction:this.userAction,prevPano:panoParse(E.panoId),state:__assign(__assign(__assign(__assign({},panoParse(b.panoId)),{mode:this.mode}),clonePose(this.camera.pose)),A),options:{},progress:this.locationMotion.progress,error:null}))}isEmptyObject(y)===!1&&(!((l=y.pano0)===null||l===void 0)&&l.map&&y.pano0.map instanceof TileCubeTextureTarget&&!y.pano0.map.cubeRenderTarget&&(y.pano0.map.cubeRenderTarget=this.colorCubeRenderTargetPool.pop()),!((c=y.pano0)===null||c===void 0)&&c.luminanceMap&&y.pano0.luminanceMap instanceof TileCubeTextureTarget&&!y.pano0.luminanceMap.cubeRenderTarget&&(y.pano0.luminanceMap.cubeRenderTarget=this.luminanceCubeRenderTargetPool.pop()),!((f=y.pano1)===null||f===void 0)&&f.map&&y.pano1.map instanceof TileCubeTextureTarget&&!y.pano1.map.cubeRenderTarget&&(y.pano1.map.cubeRenderTarget=this.colorCubeRenderTargetPool.pop()),!((d=y.pano1)===null||d===void 0)&&d.luminanceMap&&y.pano1.luminanceMap instanceof TileCubeTextureTarget&&!y.pano1.luminanceMap.cubeRenderTarget&&(y.pano1.luminanceMap.cubeRenderTarget=this.luminanceCubeRenderTargetPool.pop()),this.models.setMaterial(y)),A.offset&&this.camera.position.copy(A.offset),panoEqual(this.currentPano,m)&&this.updatePanoMeshesVisible();var X=this.camera.pose.longitude,ee=this.camera.pose.latitude;this.camera.quaternion.fromArray(this.cardboard.sensor.getOrientation()),this.camera.computePose();var $=this.works.getResolvedObserver(this.currentPano);if(this.camera.pose.distance>.1||T)for(var re=0,ie=Object.keys(this.panoMeshes);re<ie.length;re++){var se=ie[re],ae=this.panoMeshes[se];ae.setOpacity(0),ae.updateTime&&ae.updateTime(e,r),ae.visible=!1}else if($)for(var fe=$.visibleIds.concat(panoStringify(this.currentPano)),ne=0,pe=fe;ne<pe.length;ne++){var se=pe[ne],_e=panoParse(se),me=this.works.getResolvedObserver(_e);if(me){var ae=this.panoMeshes[se];if(!me.loadable&&!me.active){ae.setOpacity(0);continue}var xe=ae.position.clone().setY(this.camera.position.y).distanceTo(this.camera.position);xe<.05?ae.setOpacity(0):ae.setOpacity(clamp$1(1.5/xe,0,1)),panoEqual(this.currentPano,_e)&&ae.setOpacity(0),ae.lookAt(this.camera.position)}}if(this.locationMotion.ended)for(var Z=this.intersect(e),te=0,Q=this.works.resolvedObservers;te<Q.length;te++){var me=Q[te],ae=this.panoMeshes[me.panoId];ae&&(ae.setCurrent(ae===Z),ae.updateTime&&ae.updateTime(e,r))}(X!==this.camera.pose.longitude||ee!==this.camera.pose.latitude)&&(this.cameraMotion.set(pick(this.camera.pose,["longitude","latitude"]),0).catch(noop$1),this.emit("camera.update",createEvent("camera.update",{userAction:!0,state:__assign(__assign(__assign({},this.currentPano),{mode:this.mode}),clonePose(this.camera.pose))})));var be=this.tileLevel=function(){if(o.tileLevelForFov===!1)return 0;var he=o.renderer.getDrawingBufferSize(new THREE__namespace.Vector2);he.width*=o.scissor.width,he.height*=o.scissor.height;var de=b.panoId,ce=o.works.getResolvedObserver(de),le=o.imageOptions.size;if(typeof le=="undefined"&&ce){var we=ce.images.up.match(/\/cube_(\d+)\//);we&&(le=Number(we[1]))}typeof le=="undefined"&&(le=2048);var ue=0;le>=1024&&(ue=1),le>=2048&&(ue=2),le>=4096&&(ue=3),le>=8192&&(ue=4);var ve=o.tileLevelForFov(o.camera.fov,he);return ve>ue?ve:0}(),ye=function(){var he=o.camera.quaternion.clone(),de=o.works.getResolvedObserver(b.panoId),ce=de!=null?de:$;ce&&he.premultiply(ce.quaternion.clone().inverse());var le=new THREE__namespace.Matrix4().makeRotationFromQuaternion(he),we=new THREE__namespace.Matrix4().getInverse(le),ue=new THREE__namespace.Frustum().setFromProjectionMatrix(new THREE__namespace.Matrix4().multiplyMatrices(o.camera.projectionMatrix,we));return ue}();b.panoId===panoStringify(this.currentPano)&&(((p=b.panoPicture)===null||p===void 0?void 0:p.map)instanceof TileCubeTextureTarget&&(b.panoPicture.map.maxRequest=this.tileMaxRequest,b.panoPicture.map.update(ye,be),b.panoPicture.map.needsRender===!0&&(b.panoPicture.map.needsRender=!1,this.needsRender=!0,this.modelSceneNeedsRender=!0)),((v=b.panoPicture)===null||v===void 0?void 0:v.luminanceMap)instanceof TileCubeTextureTarget&&(b.panoPicture.luminanceMap.maxRequest=this.tileMaxRequest,b.panoPicture.luminanceMap.update(ye,be),b.panoPicture.luminanceMap.needsRender===!0&&(b.panoPicture.luminanceMap.needsRender=!1,this.needsRender=!0,this.modelSceneNeedsRender=!0)));{var Ae=this.tiling.object.visible;if(this.initAnimationed){var Me=b.panoId,ge=this.works.getResolvedObserver(Me);ge?isSimilarVector3(this.camera.position,ge.position)&&this.locationMotion.ended?(this.tiling.object.visible=!0,this.tiling.panoId!==Me&&this.tiling.cleanup(),this.tiling.panoId=Me,this.tiling.setResource((h=(g=ge.images)===null||g===void 0?void 0:g.tiles)!==null&&h!==void 0?h:[],this.enableIOSEDR&&ge.images.luminance?ge.images.luminance:null),this.tiling.setFetcher(getFetcher(ge.work)),this.tiling.setRotation(ge.quaternion),this.tiling.setPosition(ge.position),this.tiling.maxRequest=this.tileMaxRequest,be>this.TILED_CUBE_TEXTURE_LEVEL?this.tiling.update(ye,be,e):this.tiling.update(ye,0,e)):this.tiling.object.visible=!1:this.tiling.object.visible=!1}else this.tiling.object.visible=!1;Ae!==this.tiling.object.visible&&(this.tiling.object.needsRender=!0,this.modelSceneNeedsRender=!0)}this.panoVideo.object.position.copy(this.camera.position),this.panoVideo.updateTime(e)}},t.prototype.render=function(){this.cardboard.render(this.modelScene,this.camera),this.renderer.autoClear=!1,this.cardboard.render(this.scene,this.camera),this.renderer.autoClear=!0},t.prototype.setCamera=function(e){},t.prototype.destroyHelper=function(){},t.prototype.setHelperElementSize=function(){if(this.helperElement){var e=new THREE__namespace.Vector2(this.element.offsetWidth,this.element.offsetHeight),r=e.x*this.scissor.left,o=e.y*(1-this.scissor.bottom-this.scissor.height),s=e.x*this.scissor.width,u=e.y*this.scissor.height;this.helperElement.style.marginLeft=r+"px",this.helperElement.style.marginTop=o+"px",this.helperElement.style.width=s+"px",this.helperElement.style.height=u+"px"}},t.prototype.intersect=function(e){var r,o;if(this.locationMotion.ended===!1){this.intersectMesh.visible=!1,delete this.activePanoMesh,delete this.activeTime;return}if(this.activePanoMesh&&this.activeTime&&e-this.activeTime>ACTIVE_TO_CURRENT_DELAY){for(var s=this.activePanoMesh,u=Object.keys(this.panoMeshes),l=null,c=0,f=u;c<f.length;c++){var d=f[c];if(this.panoMeshes[d]===s){l=d;break}}return l!==null&&this.moveToPano(panoParse(l),{},!0),delete this.activePanoMesh,delete this.activeTime,s}var p=this.camera.getDirection(new THREE__namespace.Vector3),v=new THREE__namespace.Raycaster(this.camera.position,p);v.params.Points={threshold:.1};for(var g=void 0,h=[],m=this.works.getResolvedObserver(this.currentPano),y=m?m.visibleIds:[],A=0,E=y;A<E.length;A++){var l=E[A],b=this.panoMeshes[l],T=v.intersectObject((r=b.hitTestMesh)!==null&&r!==void 0?r:b,!0)[0];T&&h.push({panoMesh:b,intersection:__assign({floor:(o=m==null?void 0:m.floorIndex)!==null&&o!==void 0?o:0},T)})}var _=h.sort(function(H,w){return H.intersection.distance-w.intersection.distance})[0];_?(g=_.intersection,this.activePanoMesh!==_.panoMesh&&(this.activePanoMesh=_.panoMesh,this.activeTime=e),this.intersectMesh.position.copy(_.panoMesh.position),this.intersectMesh.lookAt(this.camera.position)):(this.activePanoMesh=void 0,this.activeTime=void 0),g||(g=this.models.intersectRaycaster(v)[0]);var R=createEvent("intersect.update",{raycaster:v,intersection:g!=null?g:null,object:this.intersectMesh});if(this.emit("intersect.update",R),R.defaultPrevented){this.hideIntersectMesh();return}if(g&&g.face){var S=g.face.normal,M=new THREE__namespace.Quaternion;M.setFromUnitVectors(new THREE__namespace.Vector3(0,0,1),S),this.intersectMesh.quaternion.copy(M);var B=g.point.clone();this.intersectMesh.position.copy(B),_?this.intersectMesh.visible=!1:this.intersectMesh.visible=!0}else this.intersectMesh.visible=!1;return _==null?void 0:_.panoMesh},t.prototype.onPanGesture=function(){},t.prototype.onTapGesture=function(){},t.prototype.onPinchGesture=function(){},t.prototype.onMouseMove=function(){},t.prototype.onMouseOut=function(){},t}(PanoramaController),HUMAN_EYE_POSITION=new THREE__namespace.Vector3(0,1.6,0),ModelController=function(n){__extends(t,n);function t(e){var r=this,o,s=t.parseArgs(e);return r=n.call(this,s)||this,r.mode="Model",r.locationMotion=new Motion({x:r.camera.pose.offset.x,y:r.camera.pose.offset.y,z:r.camera.pose.offset.z,distance:r.camera.pose.distance}),r.modelAlphaMotion=new Motion({modelAlpha:(o=r.models.getMaterial().modelAlpha)!==null&&o!==void 0?o:0}),r.perspToOrthoMotion=new Motion({perspToOrtho:r.camera.perspToOrtho.x}),r}return t.parseArgs=function(e){return e instanceof t?e:n.parseArgs.call(this,e)},t.initAnimationEndState=function(e){var r,o,s,u,l,c,f=this.parseArgs(e),d=f.works,p=e.initial,v=p.state,g=p.currentState,h=typeof v.panoIndex=="number"?{workCode:(s=(r=v.workCode)!==null&&r!==void 0?r:(o=f.works[0])===null||o===void 0?void 0:o.workCode)!==null&&s!==void 0?s:"",panoIndex:v.panoIndex}:{workCode:g.workCode,panoIndex:g.panoIndex},m=d.getResolvedObserver(h),y=(u=v.longitude)!==null&&u!==void 0?u:g.longitude,A=clamp$1((l=v.latitude)!==null&&l!==void 0?l:!m||isFristPersonMode(g.mode)?g.latitude:f.defaultLatitude,f.minLatitude,f.maxLatitude),E=clamp$1((c=v.fov)!==null&&c!==void 0?c:!m||isFristPersonMode(g.mode)?g.fov:f.defaultFov,f.minFov,f.maxFov),b=new THREE__namespace.Vector3;if(f.initial.state.offset)b.copy(f.initial.state.offset);else if(m)b.copy(m.position);else{var T=coordinatesToVector(g).setLength(g.distance);b.copy(f.initial.currentState.offset).sub(T)}return{workCode:h.workCode,panoIndex:h.panoIndex,mode:"Model",longitude:y,latitude:A,fov:E,offset:b,distance:0}},t.prototype.destroy=function(){n.prototype.destroy.call(this),this.locationMotion.dispose()},t.prototype.isReady=function(){return this.locationMotion.ended===!1?!1:n.prototype.isReady.call(this)},t.prototype.updateWork=function(e,r,o,s){this.works=e;var u=t.initAnimationEndState(__assign(__assign({},this),{initial:{currentState:__assign(__assign({},this.currentPano),this.camera.pose),duration:o.duration,effect:o.effect,state:r,userAction:s}}));return this.hideIntersectMesh(),this.moveToPosition(u.offset,{duration:0,longitude:u.longitude,latitude:u.latitude,fov:u.fov},s),!0},t.prototype.updateCamera=function(e,r,o){var s=this;return this.initAnimationReady.then(function(){s.userAction=o,s.stopMomentumMovement();var u={},l={};return u.distance=0,e.offset!==void 0&&(u.x=e.offset.x,u.y=e.offset.y,u.z=e.offset.z),e.longitude!==void 0&&(l.longitude=e.longitude),e.latitude!==void 0&&(l.latitude=e.latitude),e.fov!==void 0&&(l.fov=e.fov),s.locationMotion.set(u,r).catch(noop$1),s.cameraMotion.set(l,r).catch(noop$1)})},t.prototype.updateCameraWithKeyframes=function(e,r,o){var s=this;return this.initAnimationReady.then(function(){s.userAction=o,s.stopMomentumMovement();for(var u=[],l=[],c=0,f=e;c<f.length;c++){var d=f[c];u.push({key:d.key,progress:d.progress,value:{distance:0,x:d.value.offset.x,y:d.value.offset.x,z:d.value.offset.x}}),l.push({key:d.key,progress:d.progress,value:{longitude:d.value.longitude,latitude:d.value.latitude,fov:d.value.fov}})}return s.locationMotion.setKeyframes(u,r).catch(noop$1),s.cameraMotion.setKeyframes(e,r)})},t.prototype.updateTime=function(e,r){if(!this.destroyed){var o={},s={};if(this.modelAlphaMotion.ended||(this.modelAlphaMotion.update(e),o.modelAlpha=this.modelAlphaMotion.value.modelAlpha),this.perspToOrthoMotion.ended||(this.perspToOrthoMotion.update(e),this.camera.perspToOrtho.setScalar(clamp$1(this.perspToOrthoMotion.value.perspToOrtho,0,1))),!this.locationMotion.ended){this.locationMotion.update(e),s.distance=this.locationMotion.value.distance,s.offset=new THREE__namespace.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z);var u=new THREE__namespace.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z),l=this.works.resolvedObservers,c=arrayMin(l,function(f){return f.position.distanceTo(u)});this.currentPano=c?{workCode:c.work.workCode,panoIndex:c.panoIndex}:{workCode:"",panoIndex:0}}this.cameraMotion.ended||(this.cameraMotion.update(e),s.longitude=this.cameraMotion.value.longitude,s.latitude=this.cameraMotion.value.latitude,s.fov=this.cameraMotion.value.fov),isEmptyObject(o)||this.models.setMaterial(o),isEmptyObject(s)||this.setCamera(s)}},t.prototype.initAnimation=function(){var e=this;return this.destroyed?Promise.resolve():new Promise(function(r){var o=e.initial;o.state,o.currentState;var s=o.duration,u=o.userAction;e.userAction=u;var l=t.initAnimationEndState(e),c={modelAlpha:1},f={perspToOrtho:0},d={longitude:l.longitude,latitude:l.latitude,fov:l.fov,duration:s,moveStartCallback:function(p){e.perspToOrthoMotion.set(f,s).catch(noop$1),e.modelAlphaMotion.set(c,s).catch(noop$1),e.emit("initAnimation.start",createEvent("initAnimation.start",{state:p,userAction:e.userAction}))},moveEndCallback:function(p){e.emit("initAnimation.end",createEvent("initAnimation.end",{state:p,userAction:e.userAction})),r()},moveCancelCallback:function(){var p=e.currentPano,v=__assign(__assign({},p),{mode:e.mode,longitude:e.camera.pose.longitude,latitude:e.camera.pose.latitude,fov:e.camera.pose.fov,offset:e.camera.pose.offset.clone(),distance:e.camera.pose.distance});e.emit("initAnimation.end",createEvent("initAnimation.end",{state:v,userAction:e.userAction})),r()}};e.moveToPosition(l.offset,d,u)})},t.prototype.getTargetState=function(){var e=this.cameraMotion.getKeyFrameSegment(now())[1],r=this.locationMotion.getKeyFrameSegment(now())[1];return __assign(__assign({},this.currentPano),{mode:this.mode,longitude:e.value.longitude,latitude:e.value.latitude,fov:e.value.fov,offset:new THREE__namespace.Vector3(r.value.x,r.value.y,r.value.z),distance:r.value.distance})},t.prototype.moveToPano=function(e,r,o){r===void 0&&(r={});var s=this.works.getResolvedObserver(e);s&&this.moveToPosition(s.position,r,o)},t.prototype.moveToPosition=function(e,r,o){var s=this,u,l,c;r===void 0&&(r={}),this.userAction=o,this.stopMomentumMovement();for(var f=now(),d=new THREE__namespace.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z),p=d.distanceTo(e),v=this.locationMotion.getProgressVelocity(f),g=0,h=1;h<this.locationMotion.keyframes.length;h++){var m=this.locationMotion.keyframes[h-1].value,y=m.x,A=m.y,E=m.z,b=this.locationMotion.keyframes[h].value,T=b.x,_=b.y,R=b.z;g+=Math.sqrt(Math.pow(T-y,2)+Math.pow(_-A,2)+Math.pow(R-E,2))}var S=p===0?0:v*g/p,M=this.calculateMovingDuration(r.duration,p),B={x:e.x,y:e.y,z:e.z,distance:0},H={longitude:r.longitude,latitude:r.latitude,fov:r.fov},w=this.works.resolvedObservers,C=arrayMin(w,function(k){return k.position.distanceTo(d)}),L=C?{workCode:C.work.workCode,panoIndex:C.panoIndex}:{workCode:"",panoIndex:0},I=__assign(__assign({},L),{mode:this.mode,longitude:(u=H.longitude)!==null&&u!==void 0?u:this.camera.pose.longitude,latitude:(l=H.latitude)!==null&&l!==void 0?l:this.camera.pose.latitude,fov:(c=H.fov)!==null&&c!==void 0?c:this.camera.pose.fov,offset:e.clone(),distance:0}),F=this.currentPano;this.emit("pano.moveTo",createEvent("pano.moveTo",{options:r,prevPano:F,progress:0,state:I,userAction:this.userAction,error:null})),r.moveStartCallback&&r.moveStartCallback(I),this.cameraMotion.set(H,M).catch(noop$1),this.locationMotion.set(B,M,S).then(function(){for(var k=0,N=s.models;k<N.length;k++){var D=N[k];D.show()}var U=__assign(__assign(__assign({},L),{mode:s.mode}),clonePose(s.camera.pose));s.emit("pano.arrived",createEvent("pano.arrived",{options:r,prevPano:F,progress:0,state:U,userAction:s.userAction,error:null})),r.moveEndCallback&&r.moveEndCallback(U)},function(){r.moveCancelCallback&&r.moveCancelCallback(),s.emit("pano.cancel",createEvent("pano.cancel",{options:r,prevPano:F,progress:0,state:I,userAction:s.userAction,error:null}))})},t.prototype.onTapGesture=function(e){var r=e.center.raycaster;this.stopMomentumMovement();var o=this.models.intersectRaycaster(r)[0];if(o&&o.face){var s=o.face.normal,u=o.point;if(new THREE__namespace.Vector3(0,1,0).angleTo(s)>Math.PI/3){var l=s.clone().setLength(.3).add(u);r.set(l,new THREE__namespace.Vector3(0,-1,0)),o=this.models.intersectRaycaster(r)[0]}}if(o){var c=new THREE__namespace.Vector3().copy(o.point).add(HUMAN_EYE_POSITION),f=this.works.resolvedObservers,d=arrayMin(f,function(g){return g.position.distanceTo(c)},!0),p=d[0],v=d[1];p&&v<5&&(c.y=p.position.y),e.state.offset.copy(c),e.state.distance=0,this.emit("gesture.tap",e),e.defaultPrevented||this.moveToPosition(c,{},!0)}else this.emit("gesture.tap",e),e.defaultPrevented||this.cameraBounce()},t}(PanoramaLikeController);const edlVertexShader=function n(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=113,o=126,s=0,u="";return t[s].split(u).map(function(l){return l.charCodeAt(s)>o?l:String.fromCharCode((l.charCodeAt(s)+r)%o)}).join(u)}(`}rpvv|{-zrqvz}-sy|nH}rpvv|{-zrqvz}-v{Hnvor-rp@-}|vv|{Hnvor-rp?-H{vs|z-znA-}|wrpv|{Znv\x07H{vs|z-znA-z|qrycvrZnv\x07Hn\bv{t-rp?-bH|vq-znv{56-
|
|
1958
1958
|
b-J-HrpA-z]|vv|{-J-z|qrycvrZnv\x07-7-rpA5}|vv|{9>;=6Htyl]|vv|{-J-}|wrpv|{Znv\x07-7-z]|vv|{H\f`),edlFragmentShader=function n(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=113,o=126,s=0,u="";return t[s].split(u).map(function(l){return l.charCodeAt(s)>o?l:String.fromCharCode((l.charCodeAt(s)+r)%o)}).join(u)}(`0r\x07r{v|{-TYlRealsntlqr}u-G-r{noyr<<<<-nqn}rq-s|z-ur-RQY-unqr-p|qr-s|z-Puvvn{-O|pur{\b-v{-py|q-p|z}nrG<<-u}G<<tvuo;p|z<py|qp|z}nr<{x<rr<znr<}ytv{<\0RQY<unqr<RQY<<}rpvv|{-zrqvz}-sy|nH}rpvv|{-zrqvz}-v{H{vs|z-sy|n-prr{dvquH{vs|z-sy|n-prr{UrvtuH{vs|z-rp?-{rvtuo|h[RVTUO\\b_lP\\b[ajH{vs|z-sy|n-rqy\`r{tuH{vs|z-sy|n-nqvH{vs|z-sy|n-|}npv\bH{vs|z-sy|n-[rnH{vs|z-sy|n-SnH{vs|z-znA-]|wH{vs|z-nz}yr?Q-RQYP|y|Hn\bv{t-rp?-bHsy|n-r}|{r5sy|n-qr}u6
|
|
1959
1959
|
--rp?-_nqv-J-nqv-<-rp?5prr{dvqu9-prr{Urvtu6H--sy|n-z-J-=;=H--s|5v{-v-J-=H-v-I-[RVTUO\\b_lP\\b[aH-v886
|
|
1960
1960
|
----rp?-[rvtuo|-J-b-8-_nqv-7-{rvtuo|hvjH----sy|n-{rvtuo|Qr}u-J-r\x07r?Q5RQYP|y|9-[rvtuo|6;nH----{rvtuo|Qr}u-J-5{rvtuo|Qr}u-JJ->;=6-L-=;=-G-{rvtuo|Qr}uH----vs5{rvtuo|Qr}u-.J-=;=6
|
|
@@ -2166,7 +2166,7 @@ void main() {
|
|
|
2166
2166
|
#include <premultiplied_alpha_fragment>
|
|
2167
2167
|
|
|
2168
2168
|
}
|
|
2169
|
-
`},LineMaterial=function(n){__extends(t,n);function t(e){var r=n.call(this,{uniforms:THREE__namespace.UniformsUtils.clone(lineShader.uniforms),vertexShader:lineShader.vertexShader,fragmentShader:lineShader.fragmentShader,clipping:!0})||this;return r.type="LineMaterial",r.dashed=!1,Object.defineProperties(r,{color:{enumerable:!0,get:function(){return this.uniforms.diffuse.value},set:function(o){this.uniforms.diffuse.value=o}},linewidth:{enumerable:!0,get:function(){return this.uniforms.linewidth.value},set:function(o){this.uniforms.linewidth.value=o}},dashScale:{enumerable:!0,get:function(){return this.uniforms.dashScale.value},set:function(o){this.uniforms.dashScale.value=o}},dashSize:{enumerable:!0,get:function(){return this.uniforms.dashSize.value},set:function(o){this.uniforms.dashSize.value=o}},gapSize:{enumerable:!0,get:function(){return this.uniforms.gapSize.value},set:function(o){this.uniforms.gapSize.value=o}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(o){this.uniforms.opacity.value=o}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(o){this.uniforms.resolution.value.copy(o)}}}),r.setValues(e),r}return t}(THREE__namespace.ShaderMaterial);Object.assign(LineMaterial.prototype,{isLineMaterial:!0});var LineSegments2=function(n){__extends(t,n);function t(e,r){var o=n.call(this)||this;return o.type="LineSegments2",o.geometry=e!==void 0?e:new LineSegmentsGeometry,o.material=r!==void 0?r:new LineMaterial({color:Math.random()*16777215}),o}return t.prototype.computeLineDistances=function(){for(var e=this.geometry,r=e.attributes.instanceStart,o=e.attributes.instanceEnd,s=new Float32Array(2*r.count),u=new THREE__namespace.Vector3,l=new THREE__namespace.Vector3,c=0,f=0,d=r.count;c<d;c++,f+=2)u.fromBufferAttribute(r,c),l.fromBufferAttribute(o,c),s[f]=f===0?0:s[f-1],s[f+1]=s[f]+u.distanceTo(l);var p=new THREE__namespace.InstancedInterleavedBuffer(s,2,1);return e.setAttribute("instanceDistanceStart",new THREE__namespace.InterleavedBufferAttribute(p,1,0)),e.setAttribute("instanceDistanceEnd",new THREE__namespace.InterleavedBufferAttribute(p,1,1)),this},t.prototype.raycast=function(e,r){e.camera===null&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2.');var o=e.ray,s=e.camera,u=s.projectionMatrix,l=this.geometry,c=this.material,f=c.resolution,d=c.linewidth,p=l.attributes.instanceStart,v=l.attributes.instanceEnd,g=new THREE__namespace.Vector4,h=new THREE__namespace.Vector4,m=new THREE__namespace.Vector4,y=new THREE__namespace.Vector3,A=new THREE__namespace.Matrix4,E=new THREE__namespace.Line3,b=new THREE__namespace.Vector3;o.at(1,m),m.w=1,m.applyMatrix4(s.matrixWorldInverse),m.applyMatrix4(u),m.multiplyScalar(1/m.w),m.x*=f.x/2,m.y*=f.y/2,m.z=0,y.copy(m);var T=this.matrixWorld;A.multiplyMatrices(s.matrixWorldInverse,T);for(var _=0,R=p.count;_<R;_++){g.fromBufferAttribute(p,_),h.fromBufferAttribute(v,_),g.w=1,h.w=1,g.applyMatrix4(A),h.applyMatrix4(A),g.applyMatrix4(u),h.applyMatrix4(u),g.multiplyScalar(1/g.w),h.multiplyScalar(1/h.w);var S=g.z<-1&&h.z<-1,M=g.z>1&&h.z>1;if(!(S||M)){g.x*=f.x/2,g.y*=f.y/2,h.x*=f.x/2,h.y*=f.y/2,E.start.copy(g),E.start.z=0,E.end.copy(h),E.end.z=0;var B=E.closestPointToPointParameter(y,!0);E.at(B,b);var H=THREE__namespace.MathUtils.lerp(g.z,h.z,B),w=H>=-1&&H<=1,C=y.distanceTo(b)<d*.5;if(w&&C){E.start.fromBufferAttribute(p,_),E.end.fromBufferAttribute(v,_),E.start.applyMatrix4(T),E.end.applyMatrix4(T);var L=new THREE__namespace.Vector3,I=new THREE__namespace.Vector3;o.distanceSqToSegment(E.start,E.end,I,L),r.push({point:I,pointOnLine:L,distance:o.origin.distanceTo(I),object:this,faceIndex:_})}}}},t}(THREE__namespace.Mesh);Object.assign(LineSegments2.prototype,{isLineSegments2:!0});var Line2=function(n){__extends(t,n);function t(e,r){var o=n.call(this,e,r)||this;return o.type="Line2",o}return t}(LineSegments2);Object.assign(Line2.prototype,{isLine2:!0});var LineGeometry=function(n){__extends(t,n);function t(){var e=n.call(this)||this;return e.type="LineGeometry",e}return t.prototype.setPositions=function(e){for(var r=e.length-3,o=new Float32Array(2*r),s=0;s<r;s+=3)o[2*s]=e[s],o[2*s+1]=e[s+1],o[2*s+2]=e[s+2],o[2*s+3]=e[s+3],o[2*s+4]=e[s+4],o[2*s+5]=e[s+5];return n.prototype.setPositions.call(this,o),this},t.prototype.setColors=function(e){for(var r=e.length-3,o=new Float32Array(2*r),s=0;s<r;s+=3)o[2*s]=e[s],o[2*s+1]=e[s+1],o[2*s+2]=e[s+2],o[2*s+3]=e[s+3],o[2*s+4]=e[s+4],o[2*s+5]=e[s+5];return n.prototype.setColors.call(this,o),this},t.prototype.fromLine=function(e){var r=e.geometry;if(r instanceof THREE__namespace.Geometry){var o=new THREE__namespace.BufferGeometry().fromGeometry(r);this.setPositions(o.attributes.position.array)}else r instanceof THREE__namespace.BufferGeometry&&this.setPositions(r.attributes.position.array);return this},t.prototype.copy=function(){return this},t}(LineSegmentsGeometry);Object.assign(LineGeometry.prototype,{isLineGeometry:!0});var circleImageURL="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAAZiS0dEAAAAAAAA+UO7fwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sHDgwCEMBJZu0AAAAdaVRYdENvbW1lbnQAAAAAAENyZWF0ZWQgd2l0aCBHSU1QZC5lBwAABM5JREFUWMO1V0tPG2cUPZ4Hxh6DazIOrjFNqJs0FIMqWFgWQkatsmvVbtggKlSVRVf5AWz4AWz4AUSKEChll19QJYSXkECuhFxsHjEhxCYm+DWGMZ5HF72DJq4bAzFXurI0M/I5997v3u9cC65vTJVn2lX/xHINQOYSBLTLEuIuCWw4Z3IGAEvf6ASmVHjNzHCXBG4A0AjACsAOwEbO0nsFQBnAGYASAIl+ZRMR7SolMEdsByD09fV5R0ZGgg8ePPjW5/N1iqLYpuu6RZblciKR2I9Go69evnwZnZ+fjwI4IS8AKBIRzeQfJWCANwKwh0KhtrGxsYehUOin1tbW+zzP23ietzY2NnIAoGmaLsuyUiqVyvl8XtrY2NiamZn589mzZxsAUgCOAeQAnFI2tI+VxIjaAeDzoaGh7xYWFuZOTk6OZVk+12uYqqq6JEnn0Wg0OT4+/geAXwGEAdw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YimxERiBwG10sxjgvEZBE0UpE6vxj+0Ct5bTaXthgEhRmja8QWNkkPGsuIpfdjpkK+cZUWTC0KredVmtD/gdlSl6EG4AMvQAAAABJRU5ErkJggg==",DEFAULT_COLOR=14467195,POINT_SIZE=8,DEFAULT_LINEWIDTH=2,DEFAULT_DASHSCALE=20,sharedCircleTexture=null,FiveLine=function(n){__extends(t,n);function t(e,r){e===void 0&&(e=new THREE__namespace.Vector3),r===void 0&&(r=new THREE__namespace.Vector3);var o=n.call(this)||this;o.type="FiveLine",o.needsRender=!0;var s=new LineGeometry,u=new LineMaterial({color:DEFAULT_COLOR,linewidth:DEFAULT_LINEWIDTH,dashScale:DEFAULT_DASHSCALE,dashed:!1});o.line=new Line2(s,u);var l=new THREE__namespace.BufferGeometry,c=new THREE__namespace.PointsMaterial({color:DEFAULT_COLOR,size:POINT_SIZE,map:sharedCircleTexture||(sharedCircleTexture=new THREE__namespace.TextureLoader().load(circleImageURL)),sizeAttenuation:!1,transparent:!0});return o.points=new THREE__namespace.Points(l,c),o.points.renderOrder=11,o.points.frustumCulled=!1,o.setPoints(e,r),o.add(o.line,o.points),o}return Object.defineProperty(t,"version",{get:function(){return"6.4.0-alpha.8"},enumerable:!1,configurable:!0}),t.prototype.setPoints=function(e,r){var o=[].concat(e.toArray(),r.toArray());this.points.geometry.setAttribute("position",new THREE__namespace.BufferAttribute(new Float32Array(o),3)),this.line.geometry.setPositions(o),this.line.computeLineDistances(),this.needsRender=!0},t.prototype.getPoints=function(){var e=this.points.geometry.attributes.position.array;return[new THREE__namespace.Vector3(e[0],e[1],e[2]),new THREE__namespace.Vector3(e[3],e[4],e[5])]},t.prototype.setMaterial=function(e){var r=this.line.material;for(var o in e)if(e.hasOwnProperty(o)){var s=e[o];o==="dashed"?(r.dashed=s,s?r.defines.USE_DASH="":delete r.defines.USE_DASH,r.needsUpdate=!0):r[o]=e[o]}this.needsRender=!0},t.prototype.setResolution=function(e,r){var o=this.line.material.resolution;(o.x!==e||o.y!==r)&&(o.set(e,r),this.needsRender=!0)},t}(THREE__namespace.Object3D);Object.assign(FiveLine.prototype,{isFiveLine:!0});var Constants={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 fetchJsonFile(n){return __awaiter(this,void 0,void 0,function(){var t;return __generator(this,function(e){switch(e.label){case 0:return[4,fetch(n)];case 1:if(t=e.sent(),t.ok)return[2,t.json()];throw new Error(t.statusText)}})})}function fetchProfilesList(n){return __awaiter(this,void 0,void 0,function(){var t,e;return __generator(this,function(r){switch(r.label){case 0:if(!n)throw new Error("No basePath supplied");return t="profilesList.json",[4,fetchJsonFile("".concat(n,"/").concat(t))];case 1:return e=r.sent(),[2,e]}})})}function fetchProfile(n,t){return __awaiter(this,arguments,void 0,function(e,r,o,s){var u,l,c,f,d,p;return o===void 0&&(o=null),s===void 0&&(s=!0),__generator(this,function(v){switch(v.label){case 0:if(!e)throw new Error("No xrInputSource supplied");if(!r)throw new Error("No basePath supplied");return[4,fetchProfilesList(r)];case 1:if(u=v.sent(),e.profiles.some(function(g){var h=u[g];return h&&(l={profileId:g,profilePath:"".concat(r,"/").concat(h.path),deprecated:!!h.deprecated}),!!l}),!l){if(!o)throw new Error("No matching profile name found");if(c=u[o],!c)throw new Error('No matching profile name found and default profile "'.concat(o,'" missing.'));l={profileId:o,profilePath:"".concat(r,"/").concat(c.path),deprecated:!!c.deprecated}}return[4,fetchJsonFile(l.profilePath)];case 2:if(f=v.sent(),s){if(p=void 0,p=f.layouts[e.handedness],!p)throw new Error("No matching handedness, ".concat(e.handedness,", in profile ").concat(l.profileId));p.assetPath&&(d=l.profilePath.replace("profile.json",p.assetPath))}return[2,{profile:f,assetPath:d}]}})})}var defaultComponentValues={xAxis:0,yAxis:0,button:0,state:Constants.ComponentState.DEFAULT};function normalizeAxes(n,t){n===void 0&&(n=0),t===void 0&&(t=0);var e=n,r=t,o=Math.sqrt(n*n+t*t);if(o>1){var s=Math.atan2(t,n);e=Math.cos(s),r=Math.sin(s)}var u={normalizedXAxis:e*.5+.5,normalizedYAxis:r*.5+.5};return u}var VisualResponse=function(){function n(t){this.componentProperty=t.componentProperty,this.states=t.states,this.valueNodeName=t.valueNodeName,this.valueNodeProperty=t.valueNodeProperty,this.valueNodeProperty===Constants.VisualResponseProperty.TRANSFORM&&(this.minNodeName=t.minNodeName,this.maxNodeName=t.maxNodeName),this.value=0,this.updateFromComponent(defaultComponentValues)}return n.prototype.updateFromComponent=function(t){var e=t.xAxis,r=t.yAxis,o=t.button,s=t.state,u=normalizeAxes(e,r),l=u.normalizedXAxis,c=u.normalizedYAxis;switch(this.componentProperty){case Constants.ComponentProperty.X_AXIS:this.value=this.states.includes(s)?l:.5;break;case Constants.ComponentProperty.Y_AXIS:this.value=this.states.includes(s)?c:.5;break;case Constants.ComponentProperty.BUTTON:this.value=this.states.includes(s)?o:0;break;case Constants.ComponentProperty.STATE:this.valueNodeProperty===Constants.VisualResponseProperty.VISIBILITY?this.value=this.states.includes(s):this.value=this.states.includes(s)?1:0;break;default:throw new Error("Unexpected visualResponse componentProperty ".concat(this.componentProperty))}},n}(),Component=function(){function n(t,e){var r=this;if(!t||!e||!e.visualResponses||!e.gamepadIndices||Object.keys(e.gamepadIndices).length===0)throw new Error("Invalid arguments supplied");this.id=t,this.type=e.type,this.rootNodeName=e.rootNodeName,this.touchPointNodeName=e.touchPointNodeName,this.visualResponses={},Object.keys(e.visualResponses).forEach(function(o){var s=new VisualResponse(e.visualResponses[o]);r.visualResponses[o]=s}),this.gamepadIndices=Object.assign({},e.gamepadIndices),this.values={state:Constants.ComponentState.DEFAULT,button:this.gamepadIndices.button!==void 0?0:void 0,xAxis:this.gamepadIndices.xAxis!==void 0?0:void 0,yAxis:this.gamepadIndices.yAxis!==void 0?0:void 0}}return Object.defineProperty(n.prototype,"data",{get:function(){var t=__assign({id:this.id},this.values);return t},enumerable:!1,configurable:!0}),n.prototype.updateFromGamepad=function(t){var e=this;if(this.values.state=Constants.ComponentState.DEFAULT,this.gamepadIndices.button!==void 0&&t.buttons.length>this.gamepadIndices.button){var r=t.buttons[this.gamepadIndices.button];this.values.button=r.value,this.values.button=this.values.button<0?0:this.values.button,this.values.button=this.values.button>1?1:this.values.button,r.pressed||this.values.button===1?this.values.state=Constants.ComponentState.PRESSED:(r.touched||this.values.button>Constants.ButtonTouchThreshold)&&(this.values.state=Constants.ComponentState.TOUCHED)}this.gamepadIndices.xAxis!==void 0&&t.axes.length>this.gamepadIndices.xAxis&&(this.values.xAxis=t.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===Constants.ComponentState.DEFAULT&&Math.abs(this.values.xAxis)>Constants.AxisTouchThreshold&&(this.values.state=Constants.ComponentState.TOUCHED)),this.gamepadIndices.yAxis!==void 0&&t.axes.length>this.gamepadIndices.yAxis&&(this.values.yAxis=t.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===Constants.ComponentState.DEFAULT&&Math.abs(this.values.yAxis)>Constants.AxisTouchThreshold&&(this.values.state=Constants.ComponentState.TOUCHED)),Object.values(this.visualResponses).forEach(function(o){o.updateFromComponent(e.values)})},n}(),MotionController=function(){function n(t,e,r){var o=this;if(!t)throw new Error("No xrInputSource supplied");if(!e)throw new Error("No profile supplied");this.xrInputSource=t,this.assetUrl=r,this.id=e.profileId,this.layoutDescription=e.layouts[t.handedness],this.components={},Object.keys(this.layoutDescription.components).forEach(function(s){var u=o.layoutDescription.components[s];o.components[s]=new Component(s,u)}),this.updateFromGamepad()}return Object.defineProperty(n.prototype,"gripSpace",{get:function(){return this.xrInputSource.gripSpace},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"targetRaySpace",{get:function(){return this.xrInputSource.targetRaySpace},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"data",{get:function(){var t=[];return Object.values(this.components).forEach(function(e){t.push(e.data)}),t},enumerable:!1,configurable:!0}),n.prototype.updateFromGamepad=function(){var t=this;Object.values(this.components).forEach(function(e){e.updateFromGamepad(t.xrInputSource.gamepad)})},n}(),DEFAULT_PROFILES_PATH="https://cdn.jsdelivr.net/npm/@webxr-input-profiles/assets@1.0/dist/profiles",DEFAULT_PROFILE="generic-trigger",XRControllerModel=function(n){__extends(t,n);function t(){var e=n.call(this)||this;return e.motionController=null,e.envMap=null,e}return t.prototype.setEnvironmentMap=function(e){var r=this;return this.envMap==e?this:(this.envMap=e,this.traverse(function(o){o instanceof THREE__namespace.Mesh&&o.isMesh&&(o.material.envMap=r.envMap,o.material.needsUpdate=!0)}),this)},t.prototype.updateMatrixWorld=function(e){n.prototype.updateMatrixWorld.call(this,e),this.motionController&&(this.motionController.updateFromGamepad(),Object.values(this.motionController.components).forEach(function(r){Object.values(r.visualResponses).forEach(function(o){var s=o.valueNode,u=o.minNode,l=o.maxNode,c=o.value,f=o.valueNodeProperty;s&&(f===Constants.VisualResponseProperty.VISIBILITY?s.visible=c:f===Constants.VisualResponseProperty.TRANSFORM&&(s.quaternion.copy(u.quaternion).slerp(l.quaternion,c),s.position.lerpVectors(u.position,l.position,c)))})}))},t}(THREE.Object3D);function findNodes(n,t){Object.values(n.components).forEach(function(e){var r=e.type,o=e.touchPointNodeName,s=e.visualResponses;if(r===Constants.ComponentType.TOUCHPAD)if(e.touchPointNode=t.getObjectByName(o),e.touchPointNode){var u=new THREE.SphereGeometry(.001),l=new THREE.MeshBasicMaterial({color:255}),c=new THREE.Mesh(u,l);e.touchPointNode.add(c)}else console.warn("Could not find touch dot, ".concat(e.touchPointNodeName,", in touchpad component ").concat(e.id));Object.values(s).forEach(function(f){var d=f.valueNodeName,p=f.minNodeName,v=f.maxNodeName,g=f.valueNodeProperty;if(g===Constants.VisualResponseProperty.TRANSFORM){if(f.minNode=t.getObjectByName(p),f.maxNode=t.getObjectByName(v),!f.minNode){console.warn("Could not find ".concat(p," in the model"));return}if(!f.maxNode){console.warn("Could not find ".concat(v," in the model"));return}}f.valueNode=t.getObjectByName(d),f.valueNode||console.warn("Could not find ".concat(d," in the model"))})})}function addAssetSceneToControllerModel(n,t){findNodes(n.motionController,t),n.envMap&&t.traverse(function(e){e instanceof THREE__namespace.Mesh&&e.isMesh&&(e.material.envMap=n.envMap,e.material.needsUpdate=!0)}),n.add(t)}var XRControllerModelFactory=function(){function n(t){t===void 0&&(t=null),this.gltfLoader=t,this.path=DEFAULT_PROFILES_PATH,this._assetCache={}}return n.prototype.createControllerModel=function(t){var e=this,r=new XRControllerModel,o=null;return t.addEventListener("connected",function(s){var u=s.data;u.targetRayMode!=="tracked-pointer"||!u.gamepad||fetchProfile(u,e.path,DEFAULT_PROFILE).then(function(l){var c=l.profile,f=l.assetPath;r.motionController=new MotionController(u,c,f);var d=e._assetCache[r.motionController.assetUrl];if(d)o=d.scene.clone(),addAssetSceneToControllerModel(r,o);else{if(!e.gltfLoader)throw new Error("GLTFLoader not set.");e.gltfLoader.load(r.motionController.assetUrl,function(p){e._assetCache[r.motionController.assetUrl]=p,o=p.scene.clone(),addAssetSceneToControllerModel(r,o)})}}).catch(function(l){console.warn(l)})}),t.addEventListener("disconnected",function(){r.motionController=null,r.remove(o),o=null}),r},n}();function mapPanoResource(n,t){return n}var CONTROLLER_EVNET_DELTA_TIME=300,ROTATE_Y_PI_MATRIX=new THREE__namespace.Matrix4().makeRotationAxis(new THREE__namespace.Vector3(0,1,0),Math.PI),PANO_TEXTURE_SCALE=new THREE__namespace.Vector3(-1,1,1),XRPanoramaController=function(n){__extends(t,n);function t(e){var r=n.call(this,e)||this;r.xrManager=new XRManager(r.renderer,r.renderer.getContext(),{onSessionStart:function(c){r.emit("xr.session.start",createEvent("xr.session.start",{session:c,machineType:r.xrManager.machineType}))},onSessionEnd:function(){r.emit("xr.session.end",createEvent("xr.session.end",{session:null,machineType:r.xrManager.machineType}))}}),r.xrControllerRay={left:new THREE__namespace.Raycaster,right:new THREE__namespace.Raycaster},r.xrControllerRay.left.params.Points={threshold:.1},r.xrControllerRay.right.params.Points={threshold:.1},r.gazeRay=null,r.pointerLines={left:new FiveLine,right:new FiveLine},r.pointerLines.left.visible=!1,r.pointerLines.right.visible=!0,r.pointerLines.left.setMaterial({color:new THREE__namespace.Vector3(1,1,1)}),r.pointerLines.left.points.material.depthTest=!1,r.pointerLines.right.setMaterial({color:new THREE__namespace.Vector3(1,1,1)}),r.pointerLines.right.points.material.depthTest=!1,r.controllerWrappers=[new THREE__namespace.Group,new THREE__namespace.Group];var o=r.xrManager.getController(0);r.controllerWrappers[0].add(o);var s=r.xrManager.getController(1);r.controllerWrappers[1].add(s);var u=new XRControllerModelFactory;u.gltfLoader={load:function(c,f){internalFetcher.ajax(c,{responseType:"arraybuffer"}).then(function(d){var p;return parseGltf(d.body,{resourcePath:c.slice(0,c.lastIndexOf("/")+1),search:(p=c.split("?")[1])!==null&&p!==void 0?p:"",fetcher:internalFetcher})}).then(function(d){return f(d)})}},(r.xrManager.machineType==="Oculus"||r.xrManager.machineType==="Pico")&&r.scene.add(r.pointerLines.left,r.pointerLines.right,r.controllerWrappers[0],r.controllerWrappers[1]),r.panoResources={},r.panoResources[r.locationMotion.keyframes[0].key=r.locationMotion.keyframes[1].key=createUuid()]={panoId:panoStringify(r.currentPano),leftPanoPicture:null,position:r.camera.pose.offset.clone(),effect:"fade",fixCameraTransform:new THREE__namespace.Matrix4},r.parallaxCameraMatrixs=[];var l=AnimationFrameLoop.shared.getContext();return l?(r.on("xr.session.end",function(){r.scene.remove(r.pointerLines.left,r.pointerLines.right)}),r.xrManager.setSession(l),r.on("xr.session.start",function(){var c=r.xrManager.getControllerGrip(0);c.add(u.createControllerModel(c)),r.controllerWrappers[0].add(c);var f=r.xrManager.getControllerGrip(1);f.add(u.createControllerModel(f)),r.controllerWrappers[1].add(f)}),r.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}},r.xrManager.machineType==="VP"&&r.initHandEvent(),r):(console.error("获取session失败,请退出重试"),r)}return t.parseArgs=function(e){if(e instanceof t)return e;var r=__assign(__assign({},e),{maxLatitude:Math.PI/2,minLatitude:-Math.PI/2});return n.parseArgs.call(this,r)},t.initAnimationEndState=function(e){var r=this.parseArgs(e),o=n.initAnimationEndState.call(this,r);return __assign(__assign({},o),{mode:"XRPanorama"})},t.prototype.moveToPano=function(e,r,o){var s=this,u,l,c,f,d=(u=r.effect)!==null&&u!==void 0?u:"fade";this.userAction=o,this.stopMomentumMovement();var p=this.works.getResolvedObserver(e);if(!p)throw new Error("Invalid PanoIndex");var v=getImageSizeFromURL(p.images.up),g=this.imageOptions.size;typeof g=="undefined"&&p&&v&&(g=Number(v)),typeof g=="undefined"&&(g=2048);var h=this.imageOptions.transform,m=function(w,C){return mapPanoResource(applyImageURLOptions(w,h,C))},y=__assign({key:"pano.".concat(p.panoId)},pick(this.imageOptions,["format","size","quality"])),A=p.images,E=(c=(l=p.images.tiles)===null||l===void 0?void 0:l.filter(function(w){return w.size>g}))!==null&&c!==void 0?c:null,b="pano:"+jsonHash([A,y,h]);if(this.pendingTextureTask){if(this.pendingTextureTask.hash===b)return;var T=this.pendingTextureTask.panoId;(f=this.panoMeshes[T])===null||f===void 0||f.setProgress(0),this.emit("pano.texture.abort",createEvent("pano.texture.abort",{error:null,progress:0,meta:null,pano:p.pano}))}var _=this.models.getMaterial()||{},R=_.pano0,S=_.pano1,M;if((R==null?void 0:R.map.name)===b?M=R:(S==null?void 0:S.map.name)===b&&(M=S),M){var B={panoId:p.panoId,effect:d,leftPanoPicture:{zoom:1,map:M.map,luminanceMap:M.luminanceMap,matrix:new THREE__namespace.Matrix4().compose(p.position,p.quaternion,PANO_TEXTURE_SCALE)},position:p.position.clone(),fixCameraTransform:new THREE__namespace.Matrix4};this.doMoveToPano(p.pano,B,r);return}var H="move-to-pano-"+p.panoId;this.pending.add(H),this.pendingTextureTask={panoId:p.panoId,hash:b,onLoad:function(w){if(s.pending.delete(H),s.destroyed)w.body.dispose();else{w.body.name=b;var C={panoId:p.panoId,effect:d,leftPanoPicture:{zoom:1,map:w.body,luminanceMap:null,matrix:new THREE__namespace.Matrix4().compose(p.position,p.quaternion,PANO_TEXTURE_SCALE)},position:p.position.clone(),fixCameraTransform:new THREE__namespace.Matrix4};s.doMoveToPano(p.pano,C,r)}},onError:function(w){s.pending.delete(H);var C=__assign(__assign(__assign({},p.pano),{mode:s.mode}),clonePose(s.camera.pose));s.emit("pano.error",createEvent("pano.error",{error:w,userAction:s.userAction,options:r,prevPano:s.currentPano,progress:0,state:C})),s.emit("pano.cancel",createEvent("pano.cancel",{error:null,userAction:s.userAction,options:r,prevPano:s.currentPano,progress:0,state:C})),r.moveCancelCallback&&r.moveCancelCallback()}},Promise.all([this.tileLevelForFov&&E&&E.length?this.textureLoader.loadTiledCubeTexture(A,E,{tileMaxLevel:this.TILED_CUBE_TEXTURE_LEVEL,imageURL:{transform:m,options:y},format:THREE__namespace.RGBAFormat,minFilter:THREE__namespace.LinearFilter,magFilter:THREE__namespace.LinearFilter,generateMipmaps:!1,viaAjax:!0,fetcher:getFetcher(p.work)},void 0,void 0,function(w){var C,L;s.emit("pano.texture.progress",createEvent("pano.texture.progress",{error:null,progress:w,meta:null,pano:p.pano})),((C=s.pendingTextureTask)===null||C===void 0?void 0:C.hash)===b&&((L=s.panoMeshes[p.panoId])===null||L===void 0||L.setProgress(w))},this.renderer):this.textureLoader.loadCubeTexture(A,{imageURL:{transform:m,options:y},format:THREE__namespace.RGBAFormat,fetcher:getFetcher(p.work)},void 0,void 0,function(w){var C,L;((C=s.pendingTextureTask)===null||C===void 0?void 0:C.hash)===b&&((L=s.panoMeshes[p.panoId])===null||L===void 0||L.setProgress(w)),s.emit("pano.texture.progress",createEvent("pano.texture.progress",{error:null,progress:w,meta:null,pano:p.pano}))},this.renderer)]).then(function(w){var C,L,I=w[0];((C=s.pendingTextureTask)===null||C===void 0?void 0:C.hash)===b?(s.pendingTextureTask.onLoad(I),(L=s.panoMeshes[p.panoId])===null||L===void 0||L.setProgress(0),delete s.pendingTextureTask,s.emit("pano.texture.success",createEvent("pano.texture.success",{error:null,progress:1,meta:I.meta,pano:p.pano}))):I.body.dispose()}).catch(function(w){var C,L;((C=s.pendingTextureTask)===null||C===void 0?void 0:C.hash)===b&&(s.pendingTextureTask.onError(w),(L=s.panoMeshes[p.panoId])===null||L===void 0||L.setProgress(0),delete s.pendingTextureTask,s.emit("pano.texture.error",createEvent("pano.texture.error",{error:w,progress:0,meta:null,pano:p.pano})),s.emit("error",w))}),this.emit("pano.texture.load",createEvent("pano.texture.load",{error:null,progress:0,meta:null,pano:p.pano}))},t.prototype.doMoveToPano=function(e,r,o){var s=this,u,l,c,f,d,p,v,g,h,m;o===void 0&&(o={});var y=now(),A=createUuid();this.panoResources[A]=r;var E=1,b,T,_;if(this.locationMotion.ended){var R=this.locationMotion.getKeyFrameSegment(y);R[0];var S=R[1],M=this.locationMotion.value,B=this.panoResourceFromLocationMotionKeyframe(S).position,H=r.position;b=Math.max(B.distanceTo(H),E),T=[{key:S.key,progress:0,value:__assign(__assign({},M),{count:0})},{key:A,progress:1,value:{distance:0,count:1}}],_=0}else{var w=this.locationMotion.getKeyFrameSegment(y),C=w[0],S=w[1],M=this.locationMotion.value,L=this.panoResourceFromLocationMotionKeyframe(C).position,B=this.panoResourceFromLocationMotionKeyframe(S).position,H=r.position,I=S.value.count-M.count,F=Math.max(L.distanceTo(B),E)*I,k=Math.max(B.distanceTo(H),E);b=F+k,T=[{key:C.key,progress:0,value:__assign({},M)},{key:S.key,progress:F/b,value:S.value},{key:A,progress:1,value:{count:S.value.count+1,distance:0}}];var N=this.locationMotionKeyframesLength(this.locationMotion.keyframes),D=this.locationMotionKeyframesLength(T);_=this.locationMotion.getProgressVelocity(y)*N/D}var U=r.effect==="instant"?0:this.calculateMovingDuration(o.duration,r.effect==="fly"?b:0),Q={longitude:o.longitude,latitude:o.latitude,fov:o.fov},q=__assign(__assign({},e),{mode:this.mode,longitude:(u=Q.longitude)!==null&&u!==void 0?u:this.camera.pose.longitude,latitude:(l=Q.latitude)!==null&&l!==void 0?l:this.camera.pose.latitude,fov:(c=Q.fov)!==null&&c!==void 0?c:this.camera.pose.fov,offset:r.position.clone(),distance:0}),G=this.currentPano;if(this.emit("pano.moveTo",createEvent("pano.moveTo",{options:o,prevPano:G,progress:0,state:q,userAction:this.userAction,error:null})),o.moveStartCallback&&o.moveStartCallback(q),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=noop$1,this.videoTexture.needsUpdate=!0),this.panoVideo.setMaterial(null),r.effect==="fly")this.cameraMotion.set(Q,U).catch(noop$1);else{var J=coordinatesToVector({longitude:this.cameraMotion.value.longitude,latitude:this.cameraMotion.value.latitude}),X=coordinatesToVector({longitude:(f=Q.longitude)!==null&&f!==void 0?f:this.cameraMotion.value.longitude,latitude:(d=Q.latitude)!==null&&d!==void 0?d:this.cameraMotion.value.latitude}),W=new THREE__namespace.Object3D;W.lookAt(J);var j=new THREE__namespace.Matrix4().makeRotationFromQuaternion(W.quaternion);W.lookAt(X);var te=new THREE__namespace.Matrix4().makeRotationFromQuaternion(W.quaternion),$=new THREE__namespace.Matrix4().getInverse(j).premultiply(te),ne=this.cameraMotion.value.fov,ie=(p=Q.fov)!==null&&p!==void 0?p:this.cameraMotion.value.fov,oe=1;r.effect==="zoomin"?oe=1.5:r.effect==="zoomout"&&(oe=.4);for(var Z=ie*oe,de=0;de<T.length-1;de++){var he=T[de].key;if(he){var fe=this.panoResources[he];fe&&(fe.fixCameraTransform.copy($),fe.leftPanoPicture&&(fe.leftPanoPicture.zoom=Math.tan(ne/2/180*Math.PI)/Math.tan(Z/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:(v=Q.longitude)!==null&&v!==void 0?v:this.cameraMotion.value.longitude,latitude:(g=Q.latitude)!==null&&g!==void 0?g:this.cameraMotion.value.latitude,fov:Z}},{progress:1,value:{longitude:(h=Q.longitude)!==null&&h!==void 0?h:this.cameraMotion.value.longitude,latitude:(m=Q.latitude)!==null&&m!==void 0?m:this.cameraMotion.value.latitude,fov:ie}}],U).catch(noop$1)}var Te=this.locationMotion.setKeyframes(T,U,_);Te.then(function(){for(var ce,ge,ee,re=0,z=s.models;re<z.length;re++){var Re=z[re];Re.show()}var ve=__assign(__assign({},e),{mode:s.mode,longitude:s.camera.pose.longitude,latitude:s.camera.pose.latitude,fov:s.camera.pose.fov,offset:s.camera.pose.offset.clone(),distance:0});s.emit("pano.arrived",createEvent("pano.arrived",{options:o,prevPano:G,progress:1,state:ve,userAction:s.userAction,error:null})),o.moveEndCallback&&o.moveEndCallback(ve);var me=s.works.getResolvedObserver(s.currentPano);if(me&&me.video&&s.videoTexture&&s.videoTexture.image instanceof HTMLVideoElement){var we=ROTATE_Y_PI_MATRIX.clone().multiply((ee=(ge=(ce=s.models.getMaterial())===null||ce===void 0?void 0:ce.pano1)===null||ge===void 0?void 0:ge.matrix)!==null&&ee!==void 0?ee:new THREE__namespace.Matrix4).multiply(me.video.matrix),ye={map:s.videoTexture,size:me.video.size,matrix:we,alpha:1},be=createUuid(),pe=s.videoTexture.image;pe.setAttribute("uuid",be),canplayVideo().then(function(ae){ae&&me.video&&pe.getAttribute("uuid")===be&&(pe.oncanplay=function(){pe.oncanplay=noop$1,pe.play()},pe.ontimeupdate=function(){pe.currentTime>.5&&(pe.ontimeupdate=noop$1,s.panoVideo.setMaterial(ye))},pe.src=me.video.source)}).catch(function(){pe.removeAttribute("uuid")})}},function(){s.emit("pano.cancel",createEvent("pano.cancel",{options:o,prevPano:G,progress:0,state:q,userAction:s.userAction,error:null})),o.moveCancelCallback&&o.moveCancelCallback()})},t.prototype.checkSelectedPano=function(e){var r=this,o,s,u,l;this.stopMomentumMovement();var c=this.camera.getDirection(new THREE__namespace.Vector3).setY(0),f=null,d=this.works.getResolvedObserver(this.currentPano);if(!d)return null;var p=d.accessibleIds.filter(function(X){var W=panoParse(X);if(panoEqual(W,r.currentPano))return!1;var j=r.works.getResolvedObserver(W);return!j||j.position.distanceTo(r.camera.position)>r.maxAccessibleDistance?!1:j.loadable||j.active}),v=this.models.intersectRaycaster(e)[0];if(v){var g=arrayMin(p,function(X){var W=r.works.getResolvedObserver(X);if(!W)return 1/0;var j=W.standingPosition.clone();return j.distanceTo(v.point)},!0),h=g[0],m=g[1];h&&m<this.panoTapTriggerRadius&&(f=(o=this.works.getResolvedObserver(h))!==null&&o!==void 0?o:null)}if(isNil(f)){var y=this.getForwardObserverOrNot(e);y&&(f=y)}for(var A=0,E=this.locationMotion.keyframes;A<E.length;A++){var b=E[A],T=this.panoResourceFromLocationMotionKeyframe(b);if(!(b.progress<this.locationMotion.progress)&&f&&T.panoId===f.panoId){f=null;break}}if(isNil(f))return this.locationMotion.ended===!0&&this.cameraBounce(),null;if(f&&!f.active){var _=f.panoId;this.panoMeshes[_]&&(this.panoMeshes[_].setDisabled(!1),this.panoMeshes[_].setLoading(!0))}var R={};if(f){for(var S=Math.PI/6,M=Math.PI/12,B=new THREE__namespace.Vector3(0,1,0),H=f.position.clone().setY(0).sub(d.position.clone().setY(0)).normalize(),w=H.clone().applyAxisAngle(B,S),C=H.clone().applyAxisAngle(B,-S),L=[],I=[],F=[],k=0,N=f.accessibleIds;k<N.length;k++){var h=N[k],D=panoParse(h);if(!(panoEqual(D,this.currentPano)||panoEqual(D,f.pano))){var U=this.works.getResolvedObserver(h);if(U){var Q=U.position.clone().sub(f.position).setY(0);H.angleTo(Q)<S?F.push(Q):w.angleTo(Q)<S?L.push(Q):C.angleTo(Q)<S&&I.push(Q)}}}var q=F.length>0?F:__spreadArray(__spreadArray([],L,!0),I,!0),G=q.slice().sort(function(X,W){return X.angleTo(H)-W.angleTo(H)})[0];G&&G.angleTo(c)>M&&(R.longitude=Math.atan2(-G.x,-G.z))}this.cameraMotion.value.latitude<-Math.PI/4&&(R.latitude=clamp$1(0,this.minLatitude,this.maxLatitude)),this.cameraMotion.value.fov<60&&(R.fov=this.defaultFov);var J={workCode:f.pano.workCode,panoIndex:f.pano.panoIndex,mode:this.mode,longitude:(s=R.longitude)!==null&&s!==void 0?s:this.camera.pose.longitude,latitude:(u=R.latitude)!==null&&u!==void 0?u:this.camera.pose.latitude,fov:(l=R.fov)!==null&&l!==void 0?l:this.camera.pose.fov,distance:0,offset:f?f.position.clone():new THREE__namespace.Vector3};return this.emit("pano.select",createEvent("pano.select",{prevPano:this.currentPano,state:J,userAction:!0,options:R,progress:0,error:null})),f&&f.active?(this.emit("pano.request",createEvent("pano.request",{userAction:!0,prevPano:this.currentPano,progress:0,state:J,options:R,error:null})),f.pano):null},t.prototype.destroy=function(){n.prototype.destroy.call(this)},t.prototype.isReady=function(){return!1},t.prototype.updateCamera=function(e,r,o){return Promise.resolve()},t.prototype.updateCameraWithKeyframes=function(e,r,o){return Promise.resolve()},t.prototype.updateTime=function(e,r){for(var o=this,s,u,l,c,f,d,p,v,g=[],h=2;h<arguments.length;h++)g[h-2]=arguments[h];this.userAction=!0;var m={},y={},A=this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[0]),E=this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[this.locationMotion.keyframes.length-1]),b=!1;if(this.cameraMotion.ended===!1&&(this.cameraMotion.update(e),y.longitude=this.cameraMotion.value.longitude,y.latitude=this.cameraMotion.value.latitude,y.fov=this.cameraMotion.value.fov),this.modelAlphaMotion.ended===!1&&(this.modelAlphaMotion.update(e),m.modelAlpha=this.modelAlphaMotion.value.modelAlpha),this.perspToOrthoMotion.ended===!1&&(this.perspToOrthoMotion.update(e),this.camera.perspToOrtho.setScalar(clamp$1(this.perspToOrthoMotion.value.perspToOrtho,0,1))),this.locationMotion.ended===!1){this.locationMotion.update(e);var T=this.locationMotion.getKeyFrameSegment(e),_=T[0],R=T[1],S=this.panoResourceFromLocationMotionKeyframe(_),M=this.panoResourceFromLocationMotionKeyframe(R),B=new THREE__namespace.Vector3().copy(S.position),H=new THREE__namespace.Vector3().copy(M.position),w=this.locationMotion.value.count-R.value.count+1;m.progress=w,M.leftPanoPicture&&(w<1?S.leftPanoPicture&&(m.pano0=S.leftPanoPicture):m.pano0=M.leftPanoPicture,m.pano1=M.leftPanoPicture),M.effect==="montage"?m.transition="BLACK":M.effect==="spread"?m.transition="SPREAD":m.transition="FADE",(M.effect==="zoomin"||M.effect==="zoomout")&&(m.progress=Math.pow(w,3)),w<1&&M.effect!=="fly"&&(m.pano0&&S.leftPanoPicture&&(m.pano0={map:m.pano0.map,zoom:m.pano0.zoom,luminanceMap:m.pano0.luminanceMap,matrix:S.leftPanoPicture.matrix.clone().setPosition(M.position)}),B.copy(H),b=!0),y.distance=this.locationMotion.value.distance,y.offset=new THREE__namespace.Vector3(B.x+(H.x-B.x)*w,B.y+(H.y-B.y)*w,B.z+(H.z-B.z)*w);for(var C=[],L=[],I=0,F=this.locationMotion.keyframes;I<F.length;I++){var k=F[I],N=k.key,D=k.progress;N!==void 0&&(C.push(N),D>this.locationMotion.progress&&L.push(N))}for(var U=0,Q=Object.keys(this.panoResources);U<Q.length;U++){var q=Q[U];if(!(L.indexOf(q)>=0)){var G=this.panoResources[q];if(G.leftPanoPicture){var J=G.leftPanoPicture.map;if(J){if(J===((s=m.pano0)===null||s===void 0?void 0:s.map)||J===((u=m.pano1)===null||u===void 0?void 0:u.map))continue;J instanceof TileCubeTextureTarget&&J.cubeRenderTarget&&this.colorCubeRenderTargetPool.push(J.cubeRenderTarget),J.dispose(),G.leftPanoPicture=null}}C.indexOf(q)>=0||delete this.panoResources[q]}}this.currentPano=panoParse(M.panoId),this.emit("pano.moving",createEvent("pano.moving",{userAction:this.userAction,prevPano:panoParse(A.panoId),state:__assign(__assign(__assign(__assign({},panoParse(E.panoId)),{mode:this.mode}),clonePose(this.camera.pose)),y),options:{},progress:this.locationMotion.progress,error:null}))}isEmptyObject(m)===!1&&(!((l=m.pano0)===null||l===void 0)&&l.map&&m.pano0.map instanceof TileCubeTextureTarget&&!m.pano0.map.cubeRenderTarget&&(m.pano0.map.cubeRenderTarget=this.colorCubeRenderTargetPool.pop()),!((c=m.pano1)===null||c===void 0)&&c.map&&m.pano1.map instanceof TileCubeTextureTarget&&!m.pano1.map.cubeRenderTarget&&(m.pano1.map.cubeRenderTarget=this.colorCubeRenderTargetPool.pop()),this.models.setMaterial(m)),isEmptyObject(y)===!1&&this.setCamera(y);var X=this.works.getResolvedObserver(this.currentPano),W=g[1];if(!W){console.error("xrFrame丢失,请重试");return}if(!this.xrManager.session){console.error("session丢失,请重试");return}var j=this.xrManager.referenceSpace;if(j){var te=this.xrManager.cameraVR,$=this.xrManager.cameraL,ne=this.xrManager.cameraR,ie=[$,ne],oe=W.getViewerPose(j),Z=new THREE__namespace.Vector3(0,0,0);if(oe){var de;de=this.xrManager.session.renderState.baseLayer;var he=oe.views;if(!de){console.error("no layer found");return}this.renderer.setFramebuffer(de.framebuffer);var fe=!1;he.length!==te.cameras.length&&(te.cameras.length=0,fe=!0),this.parallaxCameraMatrixs=[];var Te=new THREE__namespace.Vector3,ce=new THREE__namespace.Vector3;new THREE__namespace.Matrix4().fromArray(he[0].transform.matrix).decompose(Te,new THREE__namespace.Quaternion,new THREE__namespace.Vector3),new THREE__namespace.Matrix4().fromArray(he[1].transform.matrix).decompose(ce,new THREE__namespace.Quaternion,new THREE__namespace.Vector3),ce.clone().sub(Te).normalize();var ge=new THREE__namespace.Vector3,ee=new THREE__namespace.Quaternion,re=new THREE__namespace.Vector3;this.camera.matrix.decompose(ge,ee,re);for(var z=0;z<he.length;z++){var Re=he[z],ve=de.getViewport(Re),me=ie[z];me.matrix.fromArray(Re.transform.matrix);var we=new THREE__namespace.Vector3,ye=new THREE__namespace.Quaternion,be=new THREE__namespace.Vector3;me.matrix.decompose(we,ye,be),Z.copy(ge),me.position.copy(ge),me.quaternion.copy(ye),me.scale.copy(be),me.updateMatrix(),me.projectionMatrix.fromArray(Re.projectionMatrix),me.viewport.set(ve.x,ve.y,ve.width,ve.height),fe===!0&&te.cameras.push(me)}if(this.xrManager.session&&this.xrManager.session.inputSources){for(var z=0;z<this.xrManager.session.inputSources.length;z++)if(this.xrManager.session.inputSources[z]&&this.xrManager.session.inputSources[z].targetRayMode==="transient-pointer"){var pe=W.getPose(this.xrManager.session.inputSources[z].targetRaySpace,j);if(pe){var ae=new THREE__namespace.Vector3(0,0,-1).applyQuaternion(pe.transform.orientation),ue=new THREE__namespace.Raycaster(this.camera.position,ae);this.gazeRay=ue}}}if(this.xrManager.machineType==="Oculus"||this.xrManager.machineType==="Pico"){for(var Se=this.xrManager.session.inputSources,z=0;z<Se.length;z++){var le=this.xrManager.controllers[z],Ie=Se[z];if(Ie){le&&le.update(Ie,W,j);var ue=this.xrManager.getController(z),Ye=new THREE__namespace.Vector3(0,1.2,0),Ae=ue.position.clone().add(Z).sub(Ye);Ie.handedness==="left"?this.xrControllerRay.left.set(Ae,new THREE__namespace.Vector3(0,0,-1).applyEuler(ue.rotation)):Ie.handedness==="right"&&this.xrControllerRay.right.set(Ae,new THREE__namespace.Vector3(0,0,-1).applyEuler(ue.rotation)),this.controllerWrappers[z].position.copy(new THREE__namespace.Vector3(0,0,0).add(Z).sub(Ye));var Ce=this.models.intersectRaycaster(this.xrControllerRay.right);if(Ce.length===0&&(Ce=this.xrControllerRay.right.intersectObject(this.boundingMesh,!0).map(function(vt){var At;return __assign({floor:(At=X==null?void 0:X.floorIndex)!==null&&At!==void 0?At:0},vt)})),Ce.length>=1&&Ce[0].face)if(Ie.handedness==="right"){var Oe=this.xrControllerRay.right.intersectObject(this.xrCustomObjectsScene,!0),$e=Ce[0].face.normal,pt=$e.clone(),tt=Ce[0].point.clone();this.intersectMesh.position.copy(tt);var Ne=tt.clone().add(pt);if(this.intersectMesh.lookAt(Ne),Math.abs($e.y)>.99){var qe=this.camera.position.clone().sub(tt);this.intersectMesh.rotation.z=-Math.atan2(qe.z,qe.x)}this.intersectMesh.visible=!0,this.needsRender=!0,Oe.length>0?(this.pointerLines.right.setPoints(Ae,Oe[0].point),this.pointerLines.right.points.visible=!0,this.intersectMesh.visible=!1):(this.pointerLines.right.points.visible=!1,this.pointerLines.right.setPoints(Ae,Ce[0].point));var Ve=Ce[0],Ge=createEvent("intersect.update",{raycaster:(f=this.xrControllerRay.right)!==null&&f!==void 0?f:null,intersection:Ve!=null?Ve:null,object:this.intersectMesh});if(this.emit("intersect.update",Ge),Ge.defaultPrevented){this.hideIntersectMesh();return}}else this.pointerLines.left.setPoints(Ae,Ce[0].point)}}this.updateControllerHelper(Se,e,r)}if(this.camera.pose.distance>.1||b)for(var Ke=0,Je=Object.keys(this.panoMeshes);Ke<Je.length;Ke++){var Pe=Je[Ke],xe=this.panoMeshes[Pe];xe.setOpacity(0),xe.setCurrent(!1),xe.updateTime&&xe.updateTime(e,r),xe.visible=!1}else if(X){var Be=arrayMin(X.visibleIds,function(Xe){var at=o.works.getResolvedObserver(Xe);return at?X.standingPosition.distanceTo(at.standingPosition):1/0},!0),De=Be[1];De=clamp$1(De,2.5,1/0);for(var He=X.visibleIds.concat(panoStringify(this.currentPano)),Ue=this.getForwardObserverOrNot(),Ze=this.camera.getDirection(new THREE__namespace.Vector3),ze=0,rt=Object.keys(this.panoMeshes);ze<rt.length;ze++){var Pe=rt[ze],xe=this.panoMeshes[Pe],ot=this.works.getResolvedObserver(Pe);if(He.indexOf(Pe)===-1)xe.setCurrent(!1),xe.setOpacity(0);else if(!ot)xe.setCurrent(!1),xe.setOpacity(0);else if(!ot.loadable&&!ot.active)xe.setCurrent(!1),xe.setOpacity(0);else{var ht=xe.position.clone().setY(this.camera.position.y).distanceTo(this.camera.position);xe.setCurrent(!xe.loading&&xe.progress===0&&Ue!==null&&Ue.panoId===Pe),xe.setOpacity(ht<.01?0:clamp$1(De/ht*1.2,.65,.98));var st=this.camera.position.clone().setY(xe.position.y),ae=new THREE__namespace.Vector3().copy(xe.position).sub(st).normalize();if(Pe===panoStringify(this.currentPano)){var ct=clamp$1((.5-st.distanceTo(xe.position))/.5,0,1);ae.multiplyScalar(1-ct).add(Ze.clone().multiplyScalar(ct))}ae.length()>0&&xe.quaternion.setFromEuler(new THREE__namespace.Euler(0,Math.atan2(ae.x,ae.z),0))}xe.updateTime&&xe.updateTime(e,r)}}var je=function(){return 4}(),Me=function(){var Xe=new THREE__namespace.PerspectiveCamera;Xe.applyMatrix4(te.matrix),Xe.position.set(0,0,0);var at=o.works.getResolvedObserver(E.panoId),vt=at!=null?at:X;vt&&Xe.quaternion.premultiply(vt.quaternion.clone().inverse()),Xe.updateProjectionMatrix(),Xe.updateMatrixWorld(!0);var At=new THREE__namespace.Frustum().setFromProjectionMatrix(new THREE__namespace.Matrix4().multiplyMatrices(Xe.projectionMatrix,Xe.matrixWorldInverse));return At}();E.panoId===panoStringify(this.currentPano)&&((d=E.leftPanoPicture)===null||d===void 0?void 0:d.map)instanceof TileCubeTextureTarget&&(E.leftPanoPicture.map.maxRequest=this.tileMaxRequest,E.leftPanoPicture.map.update(Me,je),E.leftPanoPicture.map.needsRender===!0&&(this.needsRender=!0,this.modelSceneNeedsRender=!0));{var _e=this.tiling.object.visible;if(this.initAnimationed){var Le=E.panoId,Qe=this.works.getResolvedObserver(Le);Qe?isSimilarVector3(this.camera.position,Qe.position)&&this.locationMotion.ended?(this.tiling.object.visible=!0,this.tiling.panoId!==Le&&this.tiling.cleanup(),this.tiling.panoId=Le,this.tiling.setResource((v=(p=Qe.images)===null||p===void 0?void 0:p.tiles)!==null&&v!==void 0?v:[],this.enableIOSEDR&&Qe.images.luminance?Qe.images.luminance:null),this.tiling.setFetcher(getFetcher(Qe.work)),this.tiling.setRotation(Qe.quaternion),this.tiling.setPosition(Qe.position),this.tiling.maxRequest=this.tileMaxRequest,je>this.TILED_CUBE_TEXTURE_LEVEL?this.tiling.update(Me,je,e):this.tiling.update(Me,0,e)):this.tiling.object.visible=!1:this.tiling.object.visible=!1}else this.tiling.object.visible=!1;_e!==this.tiling.object.visible&&(this.tiling.object.needsRender=!0,this.modelSceneNeedsRender=!0)}this.panoVideo.object.position.copy(this.camera.position),this.panoVideo.updateTime(e)}}},t.prototype.render=function(){var e=this.xrManager.getCamera(this.camera);this.renderer.render(this.modelScene,e),this.renderer.autoClearColor=!1,this.renderer.autoClearDepth=!1,this.renderer.render(this.scene,e),this.renderer.autoClearColor=!0,this.renderer.autoClearDepth=!0},t.prototype.onPanGesture=function(){},t.prototype.onTapGesture=function(){},t.prototype.onPinchGesture=function(){},t.prototype.onMouseMove=function(){},t.prototype.onMouseOut=function(){},t.prototype.panoResourceFromLocationMotionKeyframe=function(e){return this.panoResources[e.key]},t.prototype.updateControllerHelper=function(e,r,o){var s=this.xrControllerRay.left,u=this.xrControllerRay.right;if(!(!e||e.length===0)){for(var l={buttons:{X:!1,Y:!1,LeftTrigger:!1,LeftPinch:!1,A:!1,B:!1,RightTrigger:!1,RightPinch:!1}},c=0;c<e.length;c++){var f=e[c].handedness,d=e[c].gamepad;switch(f){case"left":d.axes&&(this.emitHandleEvent(d.axes[2]===-1,"LeftAxesLeft",r),this.emitHandleEvent(d.axes[2]===1,"LeftAxesRight",r),this.emitHandleEvent(d.axes[3]===-1,"LeftAxesUp",r),this.emitHandleEvent(d.axes[3]===1,"LeftAxesDown",r)),d!=null&&d.buttons&&(d.buttons[4]&&this.emitHandleEvent(d.buttons[4].pressed,"X",r),d.buttons[5]&&this.emitHandleEvent(d.buttons[5].pressed,"Y",r),d.buttons[0]&&this.emitHandleEvent(d.buttons[0].pressed,"LeftTrigger",r),d.buttons[1]&&this.emitHandleEvent(d.buttons[1].pressed,"LeftPinch",r));var p={raycaster:s,axes:{up:d.axes&&d.axes[3]<0?Math.abs(d.axes[3]):0,down:d.axes&&d.axes[3]<0?0:Math.abs(d.axes[3]),left:d.axes&&d.axes[2]<0?Math.abs(d.axes[2]):0,right:d.axes&&d.axes[2]<0?0:Math.abs(d.axes[2])},deltaTime:o};l.buttons.X=d.buttons&&d.buttons[4]?d.buttons[4].pressed:!1,l.buttons.Y=d.buttons&&d.buttons[5]?d==null?void 0:d.buttons[5].pressed:!1,l.buttons.LeftTrigger=d.buttons&&d.buttons[0]?d==null?void 0:d.buttons[0].pressed:!1,l.buttons.LeftPinch=d.buttons&&d.buttons[1]?d==null?void 0:d.buttons[1].pressed:!1,l.left=p;break;case"right":d.axes&&(this.emitHandleEvent(d.axes[2]===-1,"RightAxesLeft",r),this.emitHandleEvent(d.axes[2]===1,"RightAxesRight",r),this.emitHandleEvent(d.axes[3]===-1,"RightAxesUp",r),this.emitHandleEvent(d.axes[3]===1,"RightAxesDown",r)),d.buttons&&(d.buttons[4]&&this.emitHandleEvent(d.buttons[4].pressed,"A",r),d.buttons[5]&&this.emitHandleEvent(d.buttons[5].pressed,"B",r),d.buttons[0]&&this.emitHandleEvent(d.buttons[0].pressed,"RightTrigger",r),d.buttons[1]&&this.emitHandleEvent(d.buttons[1].pressed,"RightPinch",r));var v={raycaster:u,axes:{up:d.axes&&d.axes[3]<0?Math.abs(d.axes[3]):0,down:d.axes&&d.axes[3]<0?0:Math.abs(d.axes[3]),left:d.axes&&d.axes[2]<0?Math.abs(d.axes[2]):0,right:d.axes&&d.axes[2]<0?0:Math.abs(d.axes[2])},deltaTime:o};l.right=v,l.buttons.A=d.buttons&&d.buttons[4]?d==null?void 0:d.buttons[4].pressed:!1,l.buttons.B=d.buttons&&d.buttons[5]?d==null?void 0:d.buttons[5].pressed:!1,l.buttons.RightTrigger=d.buttons&&d.buttons[0]?d==null?void 0:d.buttons[0].pressed:!1,l.buttons.RightPinch=d.buttons&&d.buttons[1]?d==null?void 0:d.buttons[1].pressed:!1;break}}this.emit("xr.controller.update",createEvent("xr.controller.update",l))}},t.prototype.emitHandleEvent=function(e,r,o){var s=this.xrControllerRay.left,u=this.xrControllerRay.right;if(e)if(this.xrHandleState[r].touchStart===!1)this.xrHandleState[r].touchStartTime=o,this.xrHandleState[r].touchStart=!0,this.emit("xr.gesture.buttonDown",createEvent("xr.gesture.buttonDown",{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:r,isFinal:!1,isFirst:!0,controllers:{raycaster:{leftRay:s,rightRay:u}}}));else{var l=o-this.xrHandleState[r].touchStartTime;l>CONTROLLER_EVNET_DELTA_TIME&&this.emit("xr.gesture.press",createEvent("xr.gesture.tap",{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:r,isFinal:!0,isFirst:!0,controllers:{raycaster:{leftRay:s,rightRay:u}}}))}else if(this.xrHandleState[r].touchStart===!0){this.emit("xr.gesture.buttonUp",createEvent("xr.gesture.buttonUp",{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:r,isFinal:!0,isFirst:!1,controllers:{raycaster:{leftRay:s,rightRay:u}}}));var l=o-this.xrHandleState[r].touchStartTime;if(l<=CONTROLLER_EVNET_DELTA_TIME){var c=createEvent("xr.gesture.tap",{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:r,isFinal:!0,isFirst:!1,controllers:{raycaster:{leftRay:s,rightRay:u}}}),f=this.emit("xr.gesture.tap",c);!f&&!c.defaultPrevented&&r==="RightTrigger"&&this.checkSelectedPano(this.xrControllerRay.right)}this.xrHandleState[r].touchStart=!1,this.xrHandleState[r].touchStartTime=0}},t.prototype.initHandEvent=function(){var e=this;if(!this.xrManager.session)throw new Error("初始化失败");this.xrManager.session.addEventListener("select",function(r){e.gazeRay&&e.checkSelectedPano(e.gazeRay)})},t}(PanoramaController),Controllers={Floorplan:FloorplanController,Topview:TopviewController,Panorama:PanoramaController,VRPanorama:VRPanoramaController,Model:ModelController,Mapview:MapviewController,XRPanorama:XRPanoramaController},PROXY_CONTROLLER_EVENT_NAMES=["gesture.pan","gesture.tap","gesture.dbltap","gesture.press","gesture.pinch","gesture.mousewheel","gesture.mousemove","gesture.momentum","initAnimation.start","initAnimation.end","camera.update","intersect.update","pano.select","pano.moveTo","pano.moving","pano.arrived","pano.cancel","pano.error","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"];function initLegacyEvent(n){n.on("initAnimation.start",function(t){n.emit("initAnimationWillStart",t.state.panoIndex,t.state,t.userAction)}),n.on("initAnimation.end",function(t){n.emit("initAnimationEnded",t.state.panoIndex,t.state,t.userAction)}),n.on("gesture.pan",function(t){var e=!1;e=n.emit("wantsGesture","pan",t.pointers,t.isFinal),e&&t.preventDefault(),e=n.emit("wantsPanGesture",t.state,t.isFinal),e&&t.preventDefault(),t.defaultPrevented||(n.emit("gesture","pan",t.pointers,t.isFinal),n.emit("panGesture",t.state,t.isFinal))}),n.on("gesture.tap",function(t){var e=!1;e=n.emit("wantsGesture","tap",t.pointers,t.isFinal),e&&t.preventDefault(),e=n.emit("wantsTapGesture",t.center.raycaster,t.center.coords,t.isFinal),e&&t.preventDefault(),t.defaultPrevented||(n.emit("gesture","tap",t.pointers,t.isFinal),n.emit("tapGesture",t.center.raycaster,t.center.coords,t.isFinal))}),n.on("gesture.dbltap",function(t){var e=!1;e=n.emit("wantsGesture","dbltap",t.pointers,t.isFinal),e&&t.preventDefault(),e=n.emit("wantsDblTapGesture",t.center.raycaster,t.center.coords,t.isFinal),e&&t.preventDefault(),t.defaultPrevented||(n.emit("gesture","dbltap",t.pointers,t.isFinal),n.emit("dblTapGesture",t.center.raycaster,t.center.coords,t.isFinal))}),n.on("gesture.press",function(t){var e=!1;e=n.emit("wantsGesture","press",t.pointers,t.isFinal),e&&t.preventDefault(),e=n.emit("wantsPressGesture",t.center.raycaster,t.center.coords,t.center.delta,t.isFinal),e&&t.preventDefault(),t.defaultPrevented||(n.emit("gesture","press",t.pointers,t.isFinal),n.emit("pressGesture",t.center.raycaster,t.center.coords,t.center.delta,t.isFinal))}),n.on("gesture.pinch",function(t){var e=!1;e=n.emit("wantsGesture","pinch",t.pointers,t.isFinal),e&&t.preventDefault(),e=n.emit("wantsPinchGesture",t.scale,t.state.fov,t.isFinal),e&&t.preventDefault(),t.defaultPrevented||(n.emit("gesture","pinch",t.pointers,t.isFinal),n.emit("pinchGesture",t.scale,t.state.fov,t.isFinal))}),n.on("gesture.mousewheel",function(t){var e=!1;e=n.emit("wantsGesture","mouseWheel",t.pointers,t.isFinal),e&&t.preventDefault(),e=n.emit("wantsMouseWheel",t.center.delta,t.state.fov,t.isFinal),e&&t.preventDefault(),t.defaultPrevented||(n.emit("gesture","mouseWheel",t.pointers,t.isFinal),n.emit("mouseWheel",t.center.delta,t.state.fov,t.isFinal))}),n.on("gesture.mousemove",function(t){var e=!1;e=n.emit("wantsGesture","mouseMove",t.pointers,t.isFinal),e&&t.preventDefault(),t.defaultPrevented||(n.emit("gesture","mouseMove",t.pointers,t.isFinal),e=n.emit("wantsChangeCameraFov",t.state.fov),e&&t.preventDefault())}),n.on("gesture.momentum",function(t){var e=!1;e=n.emit("wantsInteriaPan",t.state),e&&t.preventDefault(),t.defaultPrevented||n.emit("interiaPan",t.state,t.isFinal)}),n.on("camera.update",function(t){n.emit("cameraFovUpdate",t.state.fov,t.userAction),n.emit("cameraDirectionUpdate",t.state,t.userAction);var e=coordinatesToVector(t.state);e.setLength(t.state.distance);var r=t.state.offset.clone().sub(e);n.emit("cameraPositionUpdate",r,t.userAction),n.emit("cameraUpdate",t.state,t.userAction)}),n.on("intersect.update",function(t){if(t.intersection){var e=!1;e=n.emit("wantsShowIntersectionOnModel",t.raycaster),e&&t.preventDefault(),t.defaultPrevented||n.emit("intersectionOnModelUpdate",t.intersection,t.object)}else n.emit("intersectionHidden")}),n.on("pano.request",function(t){var e=n.emit("wantsMoveToPano",t.state.panoIndex,t.options,t.userAction);e||(e=n.emit("wantsToMoveToPano",t.state.panoIndex,t.options,t.userAction)),e&&t.preventDefault(),t.defaultPrevented||n.emit("panoWillLoad",t.state.panoIndex)}),n.on("pano.select",function(t){n.emit("panoSelected",t.state.panoIndex)}),n.on("pano.moveTo",function(t){n.emit("panoLoaded",t.state.panoIndex),n.emit("moveToPano",t.state.panoIndex,t.userAction),n.emit("panoWillArrive",t.state.panoIndex,t.state,t.userAction)}),n.on("pano.moving",function(t){n.emit("movingToPano",t.state.panoIndex,t.prevPano.panoIndex,t.progress)}),n.on("pano.arrived",function(t){n.emit("panoArrived",t.state.panoIndex,t.state,t.userAction)}),n.on("pano.cancel",function(t){n.emit("moveToPanoCanceled",t.state.panoIndex)}),n.on("pano.error",function(t){n.emit("panoLoadError",t.error,t.state.panoIndex)}),n.on("pano.texture.load",function(t){n.emit("textureStartLoad",t.pano.panoIndex)}),n.on("pano.texture.success",function(t){n.emit("textureLoaded",t.pano.panoIndex,t.meta)}),n.on("pano.texture.error",function(t){n.emit("textureError",t.error,t.pano.panoIndex)}),n.on("pano.texture.abort",function(t){n.emit("textureAbort",t.pano.panoIndex)}),n.on("pano.texture.progress",function(t){n.emit("textureLoading",t.progress,t.pano.panoIndex)}),n.on("xr.session.start",function(t){n.emit("webXRSessionStart")}),n.on("xr.session.end",function(t){n.emit("webXRSessionEnd")}),n.on("xr.gesture.tap",function(t){n.emit("webXRControllerEvent","tap",t.buttons,{raycaster:t.controllers.raycaster})}),n.on("xr.gesture.press",function(t){n.emit("webXRControllerEvent","press",t.buttons,{raycaster:t.controllers.raycaster})}),n.on("xr.gesture.buttonUp",function(t){n.emit("webXRControllerEvent","buttonUp",t.buttons,{raycaster:t.controllers.raycaster})}),n.on("xr.gesture.buttonDown",function(t){n.emit("webXRControllerEvent","buttonDown",t.buttons,{raycaster:t.controllers.raycaster})}),n.on("xr.controller.update",function(t){n.emit("webXRControllerRayUpdate",{leftRay:t.left?t.left.raycaster:void 0,rightRay:t.right?t.right.raycaster:void 0}),t.left&&n.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&&n.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})}),n.on("works.request",function(t){n.emit("willLoad",t.input,t.works[0],t.state)}),n.on("works.load",function(t){n.emit("load",t.input,t.works[0],t.state)}),n.on("works.ready",function(t){n.emit("loaded",t.input,t.works[0])}),n.on("state.change",function(t){n.emit("stateChange",t.state,t.userAction)}),n.on("currentState.change",function(t){n.emit("currentStateChange",t.state,t.userAction)}),n.on("state.set",function(t){n.emit("setState",t.state)}),n.on("state.synced",function(t){n.emit("stateSynced",t.state)}),n.on("model.request",function(t){n.emit("modelWillLoad",t.work.model)}),n.on("model.error",function(t){n.emit("modelLoadError",t.error,t.model)}),n.on("model.load",function(t){n.emit("modelLoaded",t.model)}),n.on("model.changeShownFloor",function(t){n.emit("modelShownFloorChange",t.model.shownFloor,t.model.floorLength)}),n.on("render",function(t){n.emit("renderFrame",t.needsRender)}),n.on("mode.change.request",function(t){n.emit("wantsChangeMode",t.mode,t.prevMode)}),n.on("mode.change",function(t){n.emit("modeChange",t.mode,t.prevMode,t.state.panoIndex,t.state,t.userAction)}),n.on("helpers.visible",function(t){n.emit("helpersVisibleChange",t.object.visible)}),n.on("network.resource",function(t){n.emit("network",t.source,t.requestType,t.requestState,t.detail)})}function generateDefaultVideoElement(){if(typeof window!="undefined"){var n=document.createElement("video");n.loop=!0,n.autoplay=!0,n.playsInline=!0,n.muted=!0,n.crossOrigin="";var t=function(){document.removeEventListener("touchstart",t,!1),document.removeEventListener("mousedown",t,!1),n.muted=!1};return document.addEventListener("touchstart",t,!1),document.addEventListener("mousedown",t,!1),n}else return{}}function initLights(n){var t=new THREE__namespace.Group;t.name="internalLights";{var e=new THREE__namespace.DirectionalLight(16777215,.3);e.position.copy(new THREE__namespace.Vector3(1,1,1)),t.add(e)}{var e=new THREE__namespace.DirectionalLight(16777215,.1);e.position.copy(new THREE__namespace.Vector3(-1,-1,-1)),t.add(e)}{var e=new THREE__namespace.DirectionalLight(16777215,.1);t.add(e)}{var e=new THREE__namespace.AmbientLight(16777215,.6);t.add(e)}n.add(t)}function parseKeyValue(n){for(var t,e,r={},o=n.split(/(\;|\,)/),s=0,u=o;s<u.length;s++){var l=u[s],c=l.split("="),f=(t=c[0])===null||t===void 0?void 0:t.trim(),d=(e=c[1])===null||e===void 0?void 0:e.trim();f&&d&&(r[f]=d)}return r}function getViewportScale(){var n;if(typeof document!="undefined")for(var t=document.getElementsByTagName("meta"),e=0;e<t.length;e++){var r=t[e];if(r.getAttribute("name")==="viewport"){var o=parseKeyValue((n=r.getAttribute("content"))!==null&&n!==void 0?n:""),s=Number(o["initial-scale"]);if(!isNaN(s))return s}}return 1}const textureURL="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAV8AAAA/CAQAAADtPwPkAAAR+0lEQVR4AezYg3LEQACH8d1cbdu23Q5qG9G47z/TN/h6tn2b/H+TUTLc7yjcOXV46OUAnUs6EbUp022ZBXc1NhoZYYd7fjDRvdcHAwrlK2QBVJ4sgoqONmY45RUT23sZ6H42F2hK5CtkMbjhZlDmUUcvq1zyieUVyjbE4I1GBfItwxG56YaUZTQwyh4P6NgJ4YYYvCuQb5kOyI03pORjiqe4Lwpq5pt1vJqfUwKWJVbSMYfppYconG+maNNQOWBZuwHTzicGel75NtFOkxr5apmV8cikcko0DrDQs863AeGl0cE0+1xy573m0/wf0cEKW6H7BWtggiMG8sy3oHRDpJMw4NWb6am/bv9znkqEzjd61t5oo5clTrjhwevO75EJRBKSRt745Z16ZEjcM73sccZplBPm8PyTcxZAkSRdHm/acJ0Z3JZhHB0BxqDHgWFZFmm0ZbCw87twI/zc3e/Cz93vPneXtU/WdQS3oTviXdY/q5PsJKfoGuQjZuO/0in1qsj85cuXrxqeAOJpGqdJOqrUutgVl2Qb0BWqp/RE8AWWVB7t2KrIzY2Wx2fWKl7yfswgxqj8lYummYa3hfwF9MuQRmbfQE4ocPDjtUWQ6Tq1M2w7gC2EcrMGtWS6xlpGKEDDcb1vUQ25zT4lrC2s0dU4gFPppKkbeIYr7NMpqjStuFg5rNU9epGyt8PXyfX4DE1bKLhR/1XPxwJhp5DAV67T9ZPwFdovhBMIGUYoRBN4wim6S3eoXVEHXdLgmwY0x6BQnO4xPJ0Ar5OVxhQF0L9UslRM4yaQQfQImnBegi8vhY2A1k6YLlrj61TwDdNQnIISwiPvpD7TwYQTssZXK47vg8y9Gp2nxRcATkozOEmdCeObSt3IIo+xf/00IDRKAaZ89PBTkHqpkA5LagKeNZKlIhqX8RcQ95GHtdY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6kX8tV+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==";var imageSize=[351,63],imageOffset=[20,20],vertices=new Float32Array([-.5,-.5,0,.5,-.5,0,-.5,.5,0,.5,.5,0]),uvs=new Float32Array([0,0,1,0,0,1,1,1]),index=new Uint8Array([0,1,2,1,3,2]),geometry=new THREE__namespace.BufferGeometry;geometry.setAttribute("position",new THREE__namespace.BufferAttribute(vertices,3)),geometry.setAttribute("uv",new THREE__namespace.BufferAttribute(uvs,2)),geometry.setIndex(new THREE__namespace.BufferAttribute(index,1));var material=new THREE__namespace.MeshBasicMaterial({transparent:!0,depthTest:!1,depthWrite:!1,stencilWrite:!1,fog:!1}),mesh=new THREE__namespace.Mesh(geometry,material);mesh.matrixAutoUpdate=!1;var scene=new THREE__namespace.Scene;scene.add(mesh),scene.matrixAutoUpdate=!1;var camera=new THREE__namespace.OrthographicCamera(-.5,.5,.5,-.5,.1,1);camera.position.set(0,0,.5),camera.lookAt(0,0,0),camera.updateMatrixWorld(!0),camera.matrixAutoUpdate=!1;var prevViewport=new THREE__namespace.Vector4,prevScissor=new THREE__namespace.Vector4;function renderPoweredByRealsee(n){if(material.map){var r=n.getViewport(prevViewport),o=n.getScissor(prevScissor),s=n.getScissorTest(),u=n.autoClear,l=o.x+imageOffset[0]/3,c=o.y+imageOffset[1]/3,f=imageSize[0]/3,d=imageSize[1]/3;n.setViewport(l,c,f,d),n.setScissor(l,c,f,d),n.setScissorTest(!0),n.autoClear=!1,n.render(scene,camera),n.setViewport(r),n.setScissor(o),n.setScissorTest(s),n.autoClear=u}else{var t=new THREE__namespace.Texture,e=new Image;e.onload=function(){t.image=e,t.wrapS=THREE__namespace.ClampToEdgeWrapping,t.wrapT=THREE__namespace.ClampToEdgeWrapping,t.minFilter=THREE__namespace.LinearFilter,t.needsUpdate=!0,t.generateMipmaps=!1,material.needsUpdate=!0,e.onload=noop$1},e.src=textureURL,material.map=t}}var DEFAULT_MODE_CHANGE_DURATION=800,DEFAULT_CAMERA_FOV=90,DEFAULT_REQUEST_PROXY=function(n){return n.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/")},sharedVector2=new THREE__namespace.Vector2,sharedSphere=new THREE__namespace.Sphere,sharedFrustum=new THREE__namespace.Frustum,sharedProjScreenMatrix=new THREE__namespace.Matrix4,clockForMixer=new WeakMap,worksMap=new WeakMap,emptyWorks=createWorks([]),Five=function(n){__extends(t,n);function t(e){e===void 0&&(e={});var r,o,s,u,l,c,f,d,p,v,g,h=n.call(this)||this;if(h.ident=createUuid(),typeof window!="undefined"&&(__FIVE_DEBUG__.instances[h.ident]=h),h.renderSwitch01=0,h.currentMode="Mapview",h.pano={workCode:"",panoIndex:0},h.needsRender=!1,h.modelSceneNeedsRender=!1,h.onlyRenderIfNeeds=(r=e.onlyRenderIfNeeds)!==null&&r!==void 0?r:!0,h.imageOptions=__assign({},(o=e.imageOptions)!==null&&o!==void 0?o:{}),h.textureOptions=__assign({},(s=e.textureOptions)!==null&&s!==void 0?s:{}),h.poweredByRealsee=(u=e.poweredByRealsee)!==null&&u!==void 0?u:!0,h.extraElements=[],h.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)},h.fps={testCount:0,testTime:now()},h.info=null,h.modeChangeDuration=(l=e.modeChangeDuration)!==null&&l!==void 0?l:DEFAULT_MODE_CHANGE_DURATION,h.enableWheel=(c=e.enableWheel)!==null&&c!==void 0?c:!0,typeof window!="undefined")if("renderer"in e)e.renderer instanceof InternalWebGLRenderer&&h.throwError(new Error("cannot render a internal renderer")),h.renderer=e.renderer;else try{h.renderer=new InternalWebGLRenderer({preserveDrawingBuffer:e.preserveDrawingBuffer,backgroundColor:e.backgroundColor,backgroundAlpha:e.backgroundAlpha,antialias:e.antialias,webgl2:e.webgl2,logarithmicDepthBuffer:e.logarithmicDepthBuffer,precision:e.precision,powerPreference:e.powerPreference});var m=getViewportScale();h.renderer.setPixelRatio(m===1?window.devicePixelRatio:1),h.renderer.setSize(512,512)}catch(H){H instanceof Error&&h.throwError(H)}h.getPixelsRenderTarget=new THREE__namespace.WebGLRenderTarget(1,1,{encoding:(d=(f=h.renderer)===null||f===void 0?void 0:f.outputEncoding)!==null&&d!==void 0?d:THREE__namespace.sRGBEncoding,generateMipmaps:!1});var y=new THREE__namespace.DepthTexture(1,1);y.generateMipmaps=!1,y.format=THREE__namespace.DepthStencilFormat,y.type=THREE__namespace.UnsignedInt248Type,h.modelRenderTarget=new THREE__namespace.WebGLRenderTarget(1,1,{encoding:(v=(p=h.renderer)===null||p===void 0?void 0:p.outputEncoding)!==null&&v!==void 0?v:THREE__namespace.sRGBEncoding,depthTexture:y,generateMipmaps:!1,depthBuffer:!0,stencilBuffer:!0}),h.scissor=Object.assign({left:0,bottom:0,width:1,height:1},e.scissor),h.camera=new Camera(DEFAULT_CAMERA_FOV),h.scene=new Scene,h.xrCustomObjectsScene=new THREE__namespace.Scene,h.scene.add(h.xrCustomObjectsScene),h.scene.matrixAutoUpdate=!1,h.lastLoadWorkTask=Promise.resolve(),h.requestProxy=(g=e.requestProxy)!==null&&g!==void 0?g:DEFAULT_REQUEST_PROXY,h.networkSubscribe=new NetworkSubscribe,h.networkSubscribe.on("network",function(H,w,C,L){var I;h.emit("network.resource",createEvent("network.resource",{source:H,requestType:w,requestState:C,detail:L})),(I=h.analysis)===null||I===void 0||I.network(h.works,H,w,C,L)}),h.boundingMesh=generateBoundingMesh(new THREE__namespace.Box3(new THREE__namespace.Vector3(-.5,-.5,-.5),new THREE__namespace.Vector3(.5,.5,.5))),h.boundingMesh.name="bounding",h.models=createModels(),h.models.push(new Model),h.lastModels=createModels(),h.lastWorks=createWorks([]),h.readyCallbacks=[],h.syncingState=!1,h.helperGroup=new THREE__namespace.Group,h.helperGroup.name="helper",h.helperGroup.matrixAutoUpdate=!1,h.scene.add(h.helperGroup),h.modelGroup=new THREE__namespace.Group,h.modelGroup.visible=!1,h.modelGroup.name="model",h.modelGroup.matrixAutoUpdate=!1,h.modelScene=new THREE__namespace.Scene,h.modelScene.add(h.modelGroup),h.modelScene.add(h.boundingMesh),h.modelScene.matrixAutoUpdate=!1,h.videoTexture=new THREE__namespace.VideoTexture(e.videoInstance||generateDefaultVideoElement()),initLights(h.scene),initLights(h.modelScene),h.state={mode:h.currentMode,workCode:h.pano.workCode,panoIndex:h.pano.panoIndex,longitude:h.camera.pose.longitude,latitude:h.camera.pose.latitude,fov:h.camera.pose.fov,offset:h.camera.pose.offset.clone(),distance:h.camera.pose.distance},h.stateSynced=!1,h._enablePostProcessing=!1,h._enableIOSEDR=!1,h._enableEDL=!1,h._enableHQ=!1,h.destroyed=!1,h.paused=!0,typeof window!="undefined"&&(e.play!==!1&&h.play(),h.stopAnimationLoop=AnimationFrameLoop.shared.add(function(H,w){for(var C=[],L=2;L<arguments.length;L++)C[L-2]=arguments[L];h.updateTime.apply(h,__spreadArray([H,w],C,!1))},!1,0,10));var A=function(){typeof document!="undefined"&&document.fullscreenElement===null&&h.currentMode==="VRPanorama"&&h.controller.emit("vr.requestExit",createEvent("vr.requestExit",{}))},E=function(){h.needsRender=!0,h.modelSceneNeedsRender=!0};if(typeof document!="undefined"&&document.addEventListener("fullscreenchange",A,!1),h.renderer&&h.renderer.domElement.addEventListener("webglcontextrestored",E,!1),h.removeEventListeners=function(){typeof document!="undefined"&&document.removeEventListener("fullscreenchange",A,!1),h.renderer&&h.renderer.domElement.removeEventListener("webglcontextrestored",E,!1)},h.plugins={},e.plugins&&e.plugins.length)for(var b=0,T=e.plugins;b<T.length;b++){var _=T[b];if(typeof _=="function")_(h);else if(Array.isArray(_)){var R=_[0],S=_[1],M=_[2];if(typeof R=="function"){var B=R(h,M);typeof S=="string"&&(h.plugins[S]?h.throwError(new Error("plugin name ".concat(S," is exists."))):h.plugins[S]=B)}}}return h.gpuPickingRenderTarget=new THREE__namespace.WebGLRenderTarget(1,1,{generateMipmaps:!1}),h.meshReplaceMaterialMap=new Map,h.meshOriginMaterialMap=new Map,initLegacyEvent(h),h.resetController(),h}return Object.defineProperty(t,"version",{get:function(){return"6.4.0-alpha.8"},enumerable:!1,configurable:!0}),Object.defineProperty(t,"dracoPath",{get:function(){return draco.decoderPath},set:function(e){draco.setDecoderPath(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t,"ktx2Path",{get:function(){return ktx2.transcoderPath},set:function(e){ktx2.setTranscoderPath(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"panoIndex",{get:function(){return this.pano.panoIndex},enumerable:!1,configurable:!0}),t.prototype.getGPUPicking=function(e,r,o,s,u){var l=this;if(s===void 0&&(s=1),u===void 0&&(u=new THREE__namespace.Vector3(0,0,0)),!this.renderer)throw new Error("renderer is not initialized.");var c=this.models.getMaterial(),f=c.constantColor,d=c.colorStyle;this.models.setMaterial({colorStyle:"CONSTANT",constantColor:u}),this.scene.traverse(function(h){if(!(!(h instanceof THREE__namespace.Mesh)||h instanceof PBMMesh)){var m=Object.keys(o).filter(function(A){return A===h.uuid})[0];if(m)if(l.meshOriginMaterialMap.set(m,h.material),l.meshReplaceMaterialMap.get(m))h.material=l.meshReplaceMaterialMap.get(m);else{var y=new THREE__namespace.ShaderMaterial({uniforms:{color:{value:o[m]}},vertexShader:`
|
|
2169
|
+
`},LineMaterial=function(n){__extends(t,n);function t(e){var r=n.call(this,{uniforms:THREE__namespace.UniformsUtils.clone(lineShader.uniforms),vertexShader:lineShader.vertexShader,fragmentShader:lineShader.fragmentShader,clipping:!0})||this;return r.type="LineMaterial",r.dashed=!1,Object.defineProperties(r,{color:{enumerable:!0,get:function(){return this.uniforms.diffuse.value},set:function(o){this.uniforms.diffuse.value=o}},linewidth:{enumerable:!0,get:function(){return this.uniforms.linewidth.value},set:function(o){this.uniforms.linewidth.value=o}},dashScale:{enumerable:!0,get:function(){return this.uniforms.dashScale.value},set:function(o){this.uniforms.dashScale.value=o}},dashSize:{enumerable:!0,get:function(){return this.uniforms.dashSize.value},set:function(o){this.uniforms.dashSize.value=o}},gapSize:{enumerable:!0,get:function(){return this.uniforms.gapSize.value},set:function(o){this.uniforms.gapSize.value=o}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(o){this.uniforms.opacity.value=o}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(o){this.uniforms.resolution.value.copy(o)}}}),r.setValues(e),r}return t}(THREE__namespace.ShaderMaterial);Object.assign(LineMaterial.prototype,{isLineMaterial:!0});var LineSegments2=function(n){__extends(t,n);function t(e,r){var o=n.call(this)||this;return o.type="LineSegments2",o.geometry=e!==void 0?e:new LineSegmentsGeometry,o.material=r!==void 0?r:new LineMaterial({color:Math.random()*16777215}),o}return t.prototype.computeLineDistances=function(){for(var e=this.geometry,r=e.attributes.instanceStart,o=e.attributes.instanceEnd,s=new Float32Array(2*r.count),u=new THREE__namespace.Vector3,l=new THREE__namespace.Vector3,c=0,f=0,d=r.count;c<d;c++,f+=2)u.fromBufferAttribute(r,c),l.fromBufferAttribute(o,c),s[f]=f===0?0:s[f-1],s[f+1]=s[f]+u.distanceTo(l);var p=new THREE__namespace.InstancedInterleavedBuffer(s,2,1);return e.setAttribute("instanceDistanceStart",new THREE__namespace.InterleavedBufferAttribute(p,1,0)),e.setAttribute("instanceDistanceEnd",new THREE__namespace.InterleavedBufferAttribute(p,1,1)),this},t.prototype.raycast=function(e,r){e.camera===null&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2.');var o=e.ray,s=e.camera,u=s.projectionMatrix,l=this.geometry,c=this.material,f=c.resolution,d=c.linewidth,p=l.attributes.instanceStart,v=l.attributes.instanceEnd,g=new THREE__namespace.Vector4,h=new THREE__namespace.Vector4,m=new THREE__namespace.Vector4,y=new THREE__namespace.Vector3,A=new THREE__namespace.Matrix4,E=new THREE__namespace.Line3,b=new THREE__namespace.Vector3;o.at(1,m),m.w=1,m.applyMatrix4(s.matrixWorldInverse),m.applyMatrix4(u),m.multiplyScalar(1/m.w),m.x*=f.x/2,m.y*=f.y/2,m.z=0,y.copy(m);var T=this.matrixWorld;A.multiplyMatrices(s.matrixWorldInverse,T);for(var _=0,R=p.count;_<R;_++){g.fromBufferAttribute(p,_),h.fromBufferAttribute(v,_),g.w=1,h.w=1,g.applyMatrix4(A),h.applyMatrix4(A),g.applyMatrix4(u),h.applyMatrix4(u),g.multiplyScalar(1/g.w),h.multiplyScalar(1/h.w);var S=g.z<-1&&h.z<-1,M=g.z>1&&h.z>1;if(!(S||M)){g.x*=f.x/2,g.y*=f.y/2,h.x*=f.x/2,h.y*=f.y/2,E.start.copy(g),E.start.z=0,E.end.copy(h),E.end.z=0;var B=E.closestPointToPointParameter(y,!0);E.at(B,b);var H=THREE__namespace.MathUtils.lerp(g.z,h.z,B),w=H>=-1&&H<=1,C=y.distanceTo(b)<d*.5;if(w&&C){E.start.fromBufferAttribute(p,_),E.end.fromBufferAttribute(v,_),E.start.applyMatrix4(T),E.end.applyMatrix4(T);var L=new THREE__namespace.Vector3,I=new THREE__namespace.Vector3;o.distanceSqToSegment(E.start,E.end,I,L),r.push({point:I,pointOnLine:L,distance:o.origin.distanceTo(I),object:this,faceIndex:_})}}}},t}(THREE__namespace.Mesh);Object.assign(LineSegments2.prototype,{isLineSegments2:!0});var Line2=function(n){__extends(t,n);function t(e,r){var o=n.call(this,e,r)||this;return o.type="Line2",o}return t}(LineSegments2);Object.assign(Line2.prototype,{isLine2:!0});var LineGeometry=function(n){__extends(t,n);function t(){var e=n.call(this)||this;return e.type="LineGeometry",e}return t.prototype.setPositions=function(e){for(var r=e.length-3,o=new Float32Array(2*r),s=0;s<r;s+=3)o[2*s]=e[s],o[2*s+1]=e[s+1],o[2*s+2]=e[s+2],o[2*s+3]=e[s+3],o[2*s+4]=e[s+4],o[2*s+5]=e[s+5];return n.prototype.setPositions.call(this,o),this},t.prototype.setColors=function(e){for(var r=e.length-3,o=new Float32Array(2*r),s=0;s<r;s+=3)o[2*s]=e[s],o[2*s+1]=e[s+1],o[2*s+2]=e[s+2],o[2*s+3]=e[s+3],o[2*s+4]=e[s+4],o[2*s+5]=e[s+5];return n.prototype.setColors.call(this,o),this},t.prototype.fromLine=function(e){var r=e.geometry;if(r instanceof THREE__namespace.Geometry){var o=new THREE__namespace.BufferGeometry().fromGeometry(r);this.setPositions(o.attributes.position.array)}else r instanceof THREE__namespace.BufferGeometry&&this.setPositions(r.attributes.position.array);return this},t.prototype.copy=function(){return this},t}(LineSegmentsGeometry);Object.assign(LineGeometry.prototype,{isLineGeometry:!0});var circleImageURL="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAAZiS0dEAAAAAAAA+UO7fwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sHDgwCEMBJZu0AAAAdaVRYdENvbW1lbnQAAAAAAENyZWF0ZWQgd2l0aCBHSU1QZC5lBwAABM5JREFUWMO1V0tPG2cUPZ4Hxh6DazIOrjFNqJs0FIMqWFgWQkatsmvVbtggKlSVRVf5AWz4AWz4AUSKEChll19QJYSXkECuhFxsHjEhxCYm+DWGMZ5HF72DJq4bAzFXurI0M/I5997v3u9cC65vTJVn2lX/xHINQOYSBLTLEuIuCWw4Z3IGAEvf6ASmVHjNzHCXBG4A0AjACsAOwEbO0nsFQBnAGYASAIl+ZRMR7SolMEdsByD09fV5R0ZGgg8ePPjW5/N1iqLYpuu6RZblciKR2I9Go69evnwZnZ+fjwI4IS8AKBIRzeQfJWCANwKwh0KhtrGxsYehUOin1tbW+zzP23ietzY2NnIAoGmaLsuyUiqVyvl8XtrY2NiamZn589mzZxsAUgCOAeQAnFI2tI+VxIjaAeDzoaGh7xYWFuZOTk6OZVk+12uYqqq6JEnn0Wg0OT4+/geAXwGEAdwDIFJQXC1wO4DWR48e/RCPxxclSSroVzRFUbSDg4P848ePFwH8DuAhkWih83TRQWxFOXgAwvDwcOfo6OhvX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/gdlSl6EG4AMvQAAAABJRU5ErkJggg==",DEFAULT_COLOR=14467195,POINT_SIZE=8,DEFAULT_LINEWIDTH=2,DEFAULT_DASHSCALE=20,sharedCircleTexture=null,FiveLine=function(n){__extends(t,n);function t(e,r){e===void 0&&(e=new THREE__namespace.Vector3),r===void 0&&(r=new THREE__namespace.Vector3);var o=n.call(this)||this;o.type="FiveLine",o.needsRender=!0;var s=new LineGeometry,u=new LineMaterial({color:DEFAULT_COLOR,linewidth:DEFAULT_LINEWIDTH,dashScale:DEFAULT_DASHSCALE,dashed:!1});o.line=new Line2(s,u);var l=new THREE__namespace.BufferGeometry,c=new THREE__namespace.PointsMaterial({color:DEFAULT_COLOR,size:POINT_SIZE,map:sharedCircleTexture||(sharedCircleTexture=new THREE__namespace.TextureLoader().load(circleImageURL)),sizeAttenuation:!1,transparent:!0});return o.points=new THREE__namespace.Points(l,c),o.points.renderOrder=11,o.points.frustumCulled=!1,o.setPoints(e,r),o.add(o.line,o.points),o}return Object.defineProperty(t,"version",{get:function(){return"6.4.0-alpha.9"},enumerable:!1,configurable:!0}),t.prototype.setPoints=function(e,r){var o=[].concat(e.toArray(),r.toArray());this.points.geometry.setAttribute("position",new THREE__namespace.BufferAttribute(new Float32Array(o),3)),this.line.geometry.setPositions(o),this.line.computeLineDistances(),this.needsRender=!0},t.prototype.getPoints=function(){var e=this.points.geometry.attributes.position.array;return[new THREE__namespace.Vector3(e[0],e[1],e[2]),new THREE__namespace.Vector3(e[3],e[4],e[5])]},t.prototype.setMaterial=function(e){var r=this.line.material;for(var o in e)if(e.hasOwnProperty(o)){var s=e[o];o==="dashed"?(r.dashed=s,s?r.defines.USE_DASH="":delete r.defines.USE_DASH,r.needsUpdate=!0):r[o]=e[o]}this.needsRender=!0},t.prototype.setResolution=function(e,r){var o=this.line.material.resolution;(o.x!==e||o.y!==r)&&(o.set(e,r),this.needsRender=!0)},t}(THREE__namespace.Object3D);Object.assign(FiveLine.prototype,{isFiveLine:!0});var Constants={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 fetchJsonFile(n){return __awaiter(this,void 0,void 0,function(){var t;return __generator(this,function(e){switch(e.label){case 0:return[4,fetch(n)];case 1:if(t=e.sent(),t.ok)return[2,t.json()];throw new Error(t.statusText)}})})}function fetchProfilesList(n){return __awaiter(this,void 0,void 0,function(){var t,e;return __generator(this,function(r){switch(r.label){case 0:if(!n)throw new Error("No basePath supplied");return t="profilesList.json",[4,fetchJsonFile("".concat(n,"/").concat(t))];case 1:return e=r.sent(),[2,e]}})})}function fetchProfile(n,t){return __awaiter(this,arguments,void 0,function(e,r,o,s){var u,l,c,f,d,p;return o===void 0&&(o=null),s===void 0&&(s=!0),__generator(this,function(v){switch(v.label){case 0:if(!e)throw new Error("No xrInputSource supplied");if(!r)throw new Error("No basePath supplied");return[4,fetchProfilesList(r)];case 1:if(u=v.sent(),e.profiles.some(function(g){var h=u[g];return h&&(l={profileId:g,profilePath:"".concat(r,"/").concat(h.path),deprecated:!!h.deprecated}),!!l}),!l){if(!o)throw new Error("No matching profile name found");if(c=u[o],!c)throw new Error('No matching profile name found and default profile "'.concat(o,'" missing.'));l={profileId:o,profilePath:"".concat(r,"/").concat(c.path),deprecated:!!c.deprecated}}return[4,fetchJsonFile(l.profilePath)];case 2:if(f=v.sent(),s){if(p=void 0,p=f.layouts[e.handedness],!p)throw new Error("No matching handedness, ".concat(e.handedness,", in profile ").concat(l.profileId));p.assetPath&&(d=l.profilePath.replace("profile.json",p.assetPath))}return[2,{profile:f,assetPath:d}]}})})}var defaultComponentValues={xAxis:0,yAxis:0,button:0,state:Constants.ComponentState.DEFAULT};function normalizeAxes(n,t){n===void 0&&(n=0),t===void 0&&(t=0);var e=n,r=t,o=Math.sqrt(n*n+t*t);if(o>1){var s=Math.atan2(t,n);e=Math.cos(s),r=Math.sin(s)}var u={normalizedXAxis:e*.5+.5,normalizedYAxis:r*.5+.5};return u}var VisualResponse=function(){function n(t){this.componentProperty=t.componentProperty,this.states=t.states,this.valueNodeName=t.valueNodeName,this.valueNodeProperty=t.valueNodeProperty,this.valueNodeProperty===Constants.VisualResponseProperty.TRANSFORM&&(this.minNodeName=t.minNodeName,this.maxNodeName=t.maxNodeName),this.value=0,this.updateFromComponent(defaultComponentValues)}return n.prototype.updateFromComponent=function(t){var e=t.xAxis,r=t.yAxis,o=t.button,s=t.state,u=normalizeAxes(e,r),l=u.normalizedXAxis,c=u.normalizedYAxis;switch(this.componentProperty){case Constants.ComponentProperty.X_AXIS:this.value=this.states.includes(s)?l:.5;break;case Constants.ComponentProperty.Y_AXIS:this.value=this.states.includes(s)?c:.5;break;case Constants.ComponentProperty.BUTTON:this.value=this.states.includes(s)?o:0;break;case Constants.ComponentProperty.STATE:this.valueNodeProperty===Constants.VisualResponseProperty.VISIBILITY?this.value=this.states.includes(s):this.value=this.states.includes(s)?1:0;break;default:throw new Error("Unexpected visualResponse componentProperty ".concat(this.componentProperty))}},n}(),Component=function(){function n(t,e){var r=this;if(!t||!e||!e.visualResponses||!e.gamepadIndices||Object.keys(e.gamepadIndices).length===0)throw new Error("Invalid arguments supplied");this.id=t,this.type=e.type,this.rootNodeName=e.rootNodeName,this.touchPointNodeName=e.touchPointNodeName,this.visualResponses={},Object.keys(e.visualResponses).forEach(function(o){var s=new VisualResponse(e.visualResponses[o]);r.visualResponses[o]=s}),this.gamepadIndices=Object.assign({},e.gamepadIndices),this.values={state:Constants.ComponentState.DEFAULT,button:this.gamepadIndices.button!==void 0?0:void 0,xAxis:this.gamepadIndices.xAxis!==void 0?0:void 0,yAxis:this.gamepadIndices.yAxis!==void 0?0:void 0}}return Object.defineProperty(n.prototype,"data",{get:function(){var t=__assign({id:this.id},this.values);return t},enumerable:!1,configurable:!0}),n.prototype.updateFromGamepad=function(t){var e=this;if(this.values.state=Constants.ComponentState.DEFAULT,this.gamepadIndices.button!==void 0&&t.buttons.length>this.gamepadIndices.button){var r=t.buttons[this.gamepadIndices.button];this.values.button=r.value,this.values.button=this.values.button<0?0:this.values.button,this.values.button=this.values.button>1?1:this.values.button,r.pressed||this.values.button===1?this.values.state=Constants.ComponentState.PRESSED:(r.touched||this.values.button>Constants.ButtonTouchThreshold)&&(this.values.state=Constants.ComponentState.TOUCHED)}this.gamepadIndices.xAxis!==void 0&&t.axes.length>this.gamepadIndices.xAxis&&(this.values.xAxis=t.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===Constants.ComponentState.DEFAULT&&Math.abs(this.values.xAxis)>Constants.AxisTouchThreshold&&(this.values.state=Constants.ComponentState.TOUCHED)),this.gamepadIndices.yAxis!==void 0&&t.axes.length>this.gamepadIndices.yAxis&&(this.values.yAxis=t.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===Constants.ComponentState.DEFAULT&&Math.abs(this.values.yAxis)>Constants.AxisTouchThreshold&&(this.values.state=Constants.ComponentState.TOUCHED)),Object.values(this.visualResponses).forEach(function(o){o.updateFromComponent(e.values)})},n}(),MotionController=function(){function n(t,e,r){var o=this;if(!t)throw new Error("No xrInputSource supplied");if(!e)throw new Error("No profile supplied");this.xrInputSource=t,this.assetUrl=r,this.id=e.profileId,this.layoutDescription=e.layouts[t.handedness],this.components={},Object.keys(this.layoutDescription.components).forEach(function(s){var u=o.layoutDescription.components[s];o.components[s]=new Component(s,u)}),this.updateFromGamepad()}return Object.defineProperty(n.prototype,"gripSpace",{get:function(){return this.xrInputSource.gripSpace},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"targetRaySpace",{get:function(){return this.xrInputSource.targetRaySpace},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"data",{get:function(){var t=[];return Object.values(this.components).forEach(function(e){t.push(e.data)}),t},enumerable:!1,configurable:!0}),n.prototype.updateFromGamepad=function(){var t=this;Object.values(this.components).forEach(function(e){e.updateFromGamepad(t.xrInputSource.gamepad)})},n}(),DEFAULT_PROFILES_PATH="https://cdn.jsdelivr.net/npm/@webxr-input-profiles/assets@1.0/dist/profiles",DEFAULT_PROFILE="generic-trigger",XRControllerModel=function(n){__extends(t,n);function t(){var e=n.call(this)||this;return e.motionController=null,e.envMap=null,e}return t.prototype.setEnvironmentMap=function(e){var r=this;return this.envMap==e?this:(this.envMap=e,this.traverse(function(o){o instanceof THREE__namespace.Mesh&&o.isMesh&&(o.material.envMap=r.envMap,o.material.needsUpdate=!0)}),this)},t.prototype.updateMatrixWorld=function(e){n.prototype.updateMatrixWorld.call(this,e),this.motionController&&(this.motionController.updateFromGamepad(),Object.values(this.motionController.components).forEach(function(r){Object.values(r.visualResponses).forEach(function(o){var s=o.valueNode,u=o.minNode,l=o.maxNode,c=o.value,f=o.valueNodeProperty;s&&(f===Constants.VisualResponseProperty.VISIBILITY?s.visible=c:f===Constants.VisualResponseProperty.TRANSFORM&&(s.quaternion.copy(u.quaternion).slerp(l.quaternion,c),s.position.lerpVectors(u.position,l.position,c)))})}))},t}(THREE.Object3D);function findNodes(n,t){Object.values(n.components).forEach(function(e){var r=e.type,o=e.touchPointNodeName,s=e.visualResponses;if(r===Constants.ComponentType.TOUCHPAD)if(e.touchPointNode=t.getObjectByName(o),e.touchPointNode){var u=new THREE.SphereGeometry(.001),l=new THREE.MeshBasicMaterial({color:255}),c=new THREE.Mesh(u,l);e.touchPointNode.add(c)}else console.warn("Could not find touch dot, ".concat(e.touchPointNodeName,", in touchpad component ").concat(e.id));Object.values(s).forEach(function(f){var d=f.valueNodeName,p=f.minNodeName,v=f.maxNodeName,g=f.valueNodeProperty;if(g===Constants.VisualResponseProperty.TRANSFORM){if(f.minNode=t.getObjectByName(p),f.maxNode=t.getObjectByName(v),!f.minNode){console.warn("Could not find ".concat(p," in the model"));return}if(!f.maxNode){console.warn("Could not find ".concat(v," in the model"));return}}f.valueNode=t.getObjectByName(d),f.valueNode||console.warn("Could not find ".concat(d," in the model"))})})}function addAssetSceneToControllerModel(n,t){findNodes(n.motionController,t),n.envMap&&t.traverse(function(e){e instanceof THREE__namespace.Mesh&&e.isMesh&&(e.material.envMap=n.envMap,e.material.needsUpdate=!0)}),n.add(t)}var XRControllerModelFactory=function(){function n(t){t===void 0&&(t=null),this.gltfLoader=t,this.path=DEFAULT_PROFILES_PATH,this._assetCache={}}return n.prototype.createControllerModel=function(t){var e=this,r=new XRControllerModel,o=null;return t.addEventListener("connected",function(s){var u=s.data;u.targetRayMode!=="tracked-pointer"||!u.gamepad||fetchProfile(u,e.path,DEFAULT_PROFILE).then(function(l){var c=l.profile,f=l.assetPath;r.motionController=new MotionController(u,c,f);var d=e._assetCache[r.motionController.assetUrl];if(d)o=d.scene.clone(),addAssetSceneToControllerModel(r,o);else{if(!e.gltfLoader)throw new Error("GLTFLoader not set.");e.gltfLoader.load(r.motionController.assetUrl,function(p){e._assetCache[r.motionController.assetUrl]=p,o=p.scene.clone(),addAssetSceneToControllerModel(r,o)})}}).catch(function(l){console.warn(l)})}),t.addEventListener("disconnected",function(){r.motionController=null,r.remove(o),o=null}),r},n}();function mapPanoResource(n,t){return n}var CONTROLLER_EVNET_DELTA_TIME=300,ROTATE_Y_PI_MATRIX=new THREE__namespace.Matrix4().makeRotationAxis(new THREE__namespace.Vector3(0,1,0),Math.PI),PANO_TEXTURE_SCALE=new THREE__namespace.Vector3(-1,1,1),XRPanoramaController=function(n){__extends(t,n);function t(e){var r=n.call(this,e)||this;r.xrManager=new XRManager(r.renderer,r.renderer.getContext(),{onSessionStart:function(c){r.emit("xr.session.start",createEvent("xr.session.start",{session:c,machineType:r.xrManager.machineType}))},onSessionEnd:function(){r.emit("xr.session.end",createEvent("xr.session.end",{session:null,machineType:r.xrManager.machineType}))}}),r.xrControllerRay={left:new THREE__namespace.Raycaster,right:new THREE__namespace.Raycaster},r.xrControllerRay.left.params.Points={threshold:.1},r.xrControllerRay.right.params.Points={threshold:.1},r.gazeRay=null,r.pointerLines={left:new FiveLine,right:new FiveLine},r.pointerLines.left.visible=!1,r.pointerLines.right.visible=!0,r.pointerLines.left.setMaterial({color:new THREE__namespace.Vector3(1,1,1)}),r.pointerLines.left.points.material.depthTest=!1,r.pointerLines.right.setMaterial({color:new THREE__namespace.Vector3(1,1,1)}),r.pointerLines.right.points.material.depthTest=!1,r.controllerWrappers=[new THREE__namespace.Group,new THREE__namespace.Group];var o=r.xrManager.getController(0);r.controllerWrappers[0].add(o);var s=r.xrManager.getController(1);r.controllerWrappers[1].add(s);var u=new XRControllerModelFactory;u.gltfLoader={load:function(c,f){internalFetcher.ajax(c,{responseType:"arraybuffer"}).then(function(d){var p;return parseGltf(d.body,{resourcePath:c.slice(0,c.lastIndexOf("/")+1),search:(p=c.split("?")[1])!==null&&p!==void 0?p:"",fetcher:internalFetcher})}).then(function(d){return f(d)})}},(r.xrManager.machineType==="Oculus"||r.xrManager.machineType==="Pico")&&r.scene.add(r.pointerLines.left,r.pointerLines.right,r.controllerWrappers[0],r.controllerWrappers[1]),r.panoResources={},r.panoResources[r.locationMotion.keyframes[0].key=r.locationMotion.keyframes[1].key=createUuid()]={panoId:panoStringify(r.currentPano),leftPanoPicture:null,position:r.camera.pose.offset.clone(),effect:"fade",fixCameraTransform:new THREE__namespace.Matrix4},r.parallaxCameraMatrixs=[];var l=AnimationFrameLoop.shared.getContext();return l?(r.on("xr.session.end",function(){r.scene.remove(r.pointerLines.left,r.pointerLines.right)}),r.xrManager.setSession(l),r.on("xr.session.start",function(){var c=r.xrManager.getControllerGrip(0);c.add(u.createControllerModel(c)),r.controllerWrappers[0].add(c);var f=r.xrManager.getControllerGrip(1);f.add(u.createControllerModel(f)),r.controllerWrappers[1].add(f)}),r.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}},r.xrManager.machineType==="VP"&&r.initHandEvent(),r):(console.error("获取session失败,请退出重试"),r)}return t.parseArgs=function(e){if(e instanceof t)return e;var r=__assign(__assign({},e),{maxLatitude:Math.PI/2,minLatitude:-Math.PI/2});return n.parseArgs.call(this,r)},t.initAnimationEndState=function(e){var r=this.parseArgs(e),o=n.initAnimationEndState.call(this,r);return __assign(__assign({},o),{mode:"XRPanorama"})},t.prototype.moveToPano=function(e,r,o){var s=this,u,l,c,f,d=(u=r.effect)!==null&&u!==void 0?u:"fade";this.userAction=o,this.stopMomentumMovement();var p=this.works.getResolvedObserver(e);if(!p)throw new Error("Invalid PanoIndex");var v=getImageSizeFromURL(p.images.up),g=this.imageOptions.size;typeof g=="undefined"&&p&&v&&(g=Number(v)),typeof g=="undefined"&&(g=2048);var h=this.imageOptions.transform,m=function(w,C){return mapPanoResource(applyImageURLOptions(w,h,C))},y=__assign({key:"pano.".concat(p.panoId)},pick(this.imageOptions,["format","size","quality"])),A=p.images,E=(c=(l=p.images.tiles)===null||l===void 0?void 0:l.filter(function(w){return w.size>g}))!==null&&c!==void 0?c:null,b="pano:"+jsonHash([A,y,h]);if(this.pendingTextureTask){if(this.pendingTextureTask.hash===b)return;var T=this.pendingTextureTask.panoId;(f=this.panoMeshes[T])===null||f===void 0||f.setProgress(0),this.emit("pano.texture.abort",createEvent("pano.texture.abort",{error:null,progress:0,meta:null,pano:p.pano}))}var _=this.models.getMaterial()||{},R=_.pano0,S=_.pano1,M;if((R==null?void 0:R.map.name)===b?M=R:(S==null?void 0:S.map.name)===b&&(M=S),M){var B={panoId:p.panoId,effect:d,leftPanoPicture:{zoom:1,map:M.map,luminanceMap:M.luminanceMap,matrix:new THREE__namespace.Matrix4().compose(p.position,p.quaternion,PANO_TEXTURE_SCALE)},position:p.position.clone(),fixCameraTransform:new THREE__namespace.Matrix4};this.doMoveToPano(p.pano,B,r);return}var H="move-to-pano-"+p.panoId;this.pending.add(H),this.pendingTextureTask={panoId:p.panoId,hash:b,onLoad:function(w){if(s.pending.delete(H),s.destroyed)w.body.dispose();else{w.body.name=b;var C={panoId:p.panoId,effect:d,leftPanoPicture:{zoom:1,map:w.body,luminanceMap:null,matrix:new THREE__namespace.Matrix4().compose(p.position,p.quaternion,PANO_TEXTURE_SCALE)},position:p.position.clone(),fixCameraTransform:new THREE__namespace.Matrix4};s.doMoveToPano(p.pano,C,r)}},onError:function(w){s.pending.delete(H);var C=__assign(__assign(__assign({},p.pano),{mode:s.mode}),clonePose(s.camera.pose));s.emit("pano.error",createEvent("pano.error",{error:w,userAction:s.userAction,options:r,prevPano:s.currentPano,progress:0,state:C})),s.emit("pano.cancel",createEvent("pano.cancel",{error:null,userAction:s.userAction,options:r,prevPano:s.currentPano,progress:0,state:C})),r.moveCancelCallback&&r.moveCancelCallback()}},Promise.all([this.tileLevelForFov&&E&&E.length?this.textureLoader.loadTiledCubeTexture(A,E,{tileMaxLevel:this.TILED_CUBE_TEXTURE_LEVEL,imageURL:{transform:m,options:y},format:THREE__namespace.RGBAFormat,minFilter:THREE__namespace.LinearFilter,magFilter:THREE__namespace.LinearFilter,generateMipmaps:!1,viaAjax:!0,fetcher:getFetcher(p.work)},void 0,void 0,function(w){var C,L;s.emit("pano.texture.progress",createEvent("pano.texture.progress",{error:null,progress:w,meta:null,pano:p.pano})),((C=s.pendingTextureTask)===null||C===void 0?void 0:C.hash)===b&&((L=s.panoMeshes[p.panoId])===null||L===void 0||L.setProgress(w))},this.renderer):this.textureLoader.loadCubeTexture(A,{imageURL:{transform:m,options:y},format:THREE__namespace.RGBAFormat,fetcher:getFetcher(p.work)},void 0,void 0,function(w){var C,L;((C=s.pendingTextureTask)===null||C===void 0?void 0:C.hash)===b&&((L=s.panoMeshes[p.panoId])===null||L===void 0||L.setProgress(w)),s.emit("pano.texture.progress",createEvent("pano.texture.progress",{error:null,progress:w,meta:null,pano:p.pano}))},this.renderer)]).then(function(w){var C,L,I=w[0];((C=s.pendingTextureTask)===null||C===void 0?void 0:C.hash)===b?(s.pendingTextureTask.onLoad(I),(L=s.panoMeshes[p.panoId])===null||L===void 0||L.setProgress(0),delete s.pendingTextureTask,s.emit("pano.texture.success",createEvent("pano.texture.success",{error:null,progress:1,meta:I.meta,pano:p.pano}))):I.body.dispose()}).catch(function(w){var C,L;((C=s.pendingTextureTask)===null||C===void 0?void 0:C.hash)===b&&(s.pendingTextureTask.onError(w),(L=s.panoMeshes[p.panoId])===null||L===void 0||L.setProgress(0),delete s.pendingTextureTask,s.emit("pano.texture.error",createEvent("pano.texture.error",{error:w,progress:0,meta:null,pano:p.pano})),s.emit("error",w))}),this.emit("pano.texture.load",createEvent("pano.texture.load",{error:null,progress:0,meta:null,pano:p.pano}))},t.prototype.doMoveToPano=function(e,r,o){var s=this,u,l,c,f,d,p,v,g,h,m;o===void 0&&(o={});var y=now(),A=createUuid();this.panoResources[A]=r;var E=1,b,T,_;if(this.locationMotion.ended){var R=this.locationMotion.getKeyFrameSegment(y);R[0];var S=R[1],M=this.locationMotion.value,B=this.panoResourceFromLocationMotionKeyframe(S).position,H=r.position;b=Math.max(B.distanceTo(H),E),T=[{key:S.key,progress:0,value:__assign(__assign({},M),{count:0})},{key:A,progress:1,value:{distance:0,count:1}}],_=0}else{var w=this.locationMotion.getKeyFrameSegment(y),C=w[0],S=w[1],M=this.locationMotion.value,L=this.panoResourceFromLocationMotionKeyframe(C).position,B=this.panoResourceFromLocationMotionKeyframe(S).position,H=r.position,I=S.value.count-M.count,F=Math.max(L.distanceTo(B),E)*I,k=Math.max(B.distanceTo(H),E);b=F+k,T=[{key:C.key,progress:0,value:__assign({},M)},{key:S.key,progress:F/b,value:S.value},{key:A,progress:1,value:{count:S.value.count+1,distance:0}}];var N=this.locationMotionKeyframesLength(this.locationMotion.keyframes),D=this.locationMotionKeyframesLength(T);_=this.locationMotion.getProgressVelocity(y)*N/D}var U=r.effect==="instant"?0:this.calculateMovingDuration(o.duration,r.effect==="fly"?b:0),z={longitude:o.longitude,latitude:o.latitude,fov:o.fov},G=__assign(__assign({},e),{mode:this.mode,longitude:(u=z.longitude)!==null&&u!==void 0?u:this.camera.pose.longitude,latitude:(l=z.latitude)!==null&&l!==void 0?l:this.camera.pose.latitude,fov:(c=z.fov)!==null&&c!==void 0?c:this.camera.pose.fov,offset:r.position.clone(),distance:0}),q=this.currentPano;if(this.emit("pano.moveTo",createEvent("pano.moveTo",{options:o,prevPano:q,progress:0,state:G,userAction:this.userAction,error:null})),o.moveStartCallback&&o.moveStartCallback(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=noop$1,this.videoTexture.needsUpdate=!0),this.panoVideo.setMaterial(null),r.effect==="fly")this.cameraMotion.set(z,U).catch(noop$1);else{var K=coordinatesToVector({longitude:this.cameraMotion.value.longitude,latitude:this.cameraMotion.value.latitude}),j=coordinatesToVector({longitude:(f=z.longitude)!==null&&f!==void 0?f:this.cameraMotion.value.longitude,latitude:(d=z.latitude)!==null&&d!==void 0?d:this.cameraMotion.value.latitude}),W=new THREE__namespace.Object3D;W.lookAt(K);var X=new THREE__namespace.Matrix4().makeRotationFromQuaternion(W.quaternion);W.lookAt(j);var ee=new THREE__namespace.Matrix4().makeRotationFromQuaternion(W.quaternion),$=new THREE__namespace.Matrix4().getInverse(X).premultiply(ee),re=this.cameraMotion.value.fov,ie=(p=z.fov)!==null&&p!==void 0?p:this.cameraMotion.value.fov,se=1;r.effect==="zoomin"?se=1.5:r.effect==="zoomout"&&(se=.4);for(var ae=ie*se,fe=0;fe<T.length-1;fe++){var ne=T[fe].key;if(ne){var pe=this.panoResources[ne];pe&&(pe.fixCameraTransform.copy($),pe.leftPanoPicture&&(pe.leftPanoPicture.zoom=Math.tan(re/2/180*Math.PI)/Math.tan(ae/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:(v=z.longitude)!==null&&v!==void 0?v:this.cameraMotion.value.longitude,latitude:(g=z.latitude)!==null&&g!==void 0?g:this.cameraMotion.value.latitude,fov:ae}},{progress:1,value:{longitude:(h=z.longitude)!==null&&h!==void 0?h:this.cameraMotion.value.longitude,latitude:(m=z.latitude)!==null&&m!==void 0?m:this.cameraMotion.value.latitude,fov:ie}}],U).catch(noop$1)}var _e=this.locationMotion.setKeyframes(T,U,_);_e.then(function(){for(var me,xe,Z,te=0,Q=s.models;te<Q.length;te++){var be=Q[te];be.show()}var ye=__assign(__assign({},e),{mode:s.mode,longitude:s.camera.pose.longitude,latitude:s.camera.pose.latitude,fov:s.camera.pose.fov,offset:s.camera.pose.offset.clone(),distance:0});s.emit("pano.arrived",createEvent("pano.arrived",{options:o,prevPano:q,progress:1,state:ye,userAction:s.userAction,error:null})),o.moveEndCallback&&o.moveEndCallback(ye);var Ae=s.works.getResolvedObserver(s.currentPano);if(Ae&&Ae.video&&s.videoTexture&&s.videoTexture.image instanceof HTMLVideoElement){var Me=ROTATE_Y_PI_MATRIX.clone().multiply((Z=(xe=(me=s.models.getMaterial())===null||me===void 0?void 0:me.pano1)===null||xe===void 0?void 0:xe.matrix)!==null&&Z!==void 0?Z:new THREE__namespace.Matrix4).multiply(Ae.video.matrix),ge={map:s.videoTexture,size:Ae.video.size,matrix:Me,alpha:1},he=createUuid(),de=s.videoTexture.image;de.setAttribute("uuid",he),canplayVideo().then(function(ce){ce&&Ae.video&&de.getAttribute("uuid")===he&&(de.oncanplay=function(){de.oncanplay=noop$1,de.play()},de.ontimeupdate=function(){de.currentTime>.5&&(de.ontimeupdate=noop$1,s.panoVideo.setMaterial(ge))},de.src=Ae.video.source)}).catch(function(){de.removeAttribute("uuid")})}},function(){s.emit("pano.cancel",createEvent("pano.cancel",{options:o,prevPano:q,progress:0,state:G,userAction:s.userAction,error:null})),o.moveCancelCallback&&o.moveCancelCallback()})},t.prototype.checkSelectedPano=function(e){var r=this,o,s,u,l;this.stopMomentumMovement();var c=this.camera.getDirection(new THREE__namespace.Vector3).setY(0),f=null,d=this.works.getResolvedObserver(this.currentPano);if(!d)return null;var p=d.accessibleIds.filter(function(j){var W=panoParse(j);if(panoEqual(W,r.currentPano))return!1;var X=r.works.getResolvedObserver(W);return!X||X.position.distanceTo(r.camera.position)>r.maxAccessibleDistance?!1:X.loadable||X.active}),v=this.models.intersectRaycaster(e)[0];if(v){var g=arrayMin(p,function(j){var W=r.works.getResolvedObserver(j);if(!W)return 1/0;var X=W.standingPosition.clone();return X.distanceTo(v.point)},!0),h=g[0],m=g[1];h&&m<this.panoTapTriggerRadius&&(f=(o=this.works.getResolvedObserver(h))!==null&&o!==void 0?o:null)}if(isNil(f)){var y=this.getForwardObserverOrNot(e);y&&(f=y)}for(var A=0,E=this.locationMotion.keyframes;A<E.length;A++){var b=E[A],T=this.panoResourceFromLocationMotionKeyframe(b);if(!(b.progress<this.locationMotion.progress)&&f&&T.panoId===f.panoId){f=null;break}}if(isNil(f))return this.locationMotion.ended===!0&&this.cameraBounce(),null;if(f&&!f.active){var _=f.panoId;this.panoMeshes[_]&&(this.panoMeshes[_].setDisabled(!1),this.panoMeshes[_].setLoading(!0))}var R={};if(f){for(var S=Math.PI/6,M=Math.PI/12,B=new THREE__namespace.Vector3(0,1,0),H=f.position.clone().setY(0).sub(d.position.clone().setY(0)).normalize(),w=H.clone().applyAxisAngle(B,S),C=H.clone().applyAxisAngle(B,-S),L=[],I=[],F=[],k=0,N=f.accessibleIds;k<N.length;k++){var h=N[k],D=panoParse(h);if(!(panoEqual(D,this.currentPano)||panoEqual(D,f.pano))){var U=this.works.getResolvedObserver(h);if(U){var z=U.position.clone().sub(f.position).setY(0);H.angleTo(z)<S?F.push(z):w.angleTo(z)<S?L.push(z):C.angleTo(z)<S&&I.push(z)}}}var G=F.length>0?F:__spreadArray(__spreadArray([],L,!0),I,!0),q=G.slice().sort(function(j,W){return j.angleTo(H)-W.angleTo(H)})[0];q&&q.angleTo(c)>M&&(R.longitude=Math.atan2(-q.x,-q.z))}this.cameraMotion.value.latitude<-Math.PI/4&&(R.latitude=clamp$1(0,this.minLatitude,this.maxLatitude)),this.cameraMotion.value.fov<60&&(R.fov=this.defaultFov);var K={workCode:f.pano.workCode,panoIndex:f.pano.panoIndex,mode:this.mode,longitude:(s=R.longitude)!==null&&s!==void 0?s:this.camera.pose.longitude,latitude:(u=R.latitude)!==null&&u!==void 0?u:this.camera.pose.latitude,fov:(l=R.fov)!==null&&l!==void 0?l:this.camera.pose.fov,distance:0,offset:f?f.position.clone():new THREE__namespace.Vector3};return this.emit("pano.select",createEvent("pano.select",{prevPano:this.currentPano,state:K,userAction:!0,options:R,progress:0,error:null})),f&&f.active?(this.emit("pano.request",createEvent("pano.request",{userAction:!0,prevPano:this.currentPano,progress:0,state:K,options:R,error:null})),f.pano):null},t.prototype.destroy=function(){n.prototype.destroy.call(this)},t.prototype.isReady=function(){return!1},t.prototype.updateCamera=function(e,r,o){return Promise.resolve()},t.prototype.updateCameraWithKeyframes=function(e,r,o){return Promise.resolve()},t.prototype.updateTime=function(e,r){for(var o=this,s,u,l,c,f,d,p,v,g=[],h=2;h<arguments.length;h++)g[h-2]=arguments[h];this.userAction=!0;var m={},y={},A=this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[0]),E=this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[this.locationMotion.keyframes.length-1]),b=!1;if(this.cameraMotion.ended===!1&&(this.cameraMotion.update(e),y.longitude=this.cameraMotion.value.longitude,y.latitude=this.cameraMotion.value.latitude,y.fov=this.cameraMotion.value.fov),this.modelAlphaMotion.ended===!1&&(this.modelAlphaMotion.update(e),m.modelAlpha=this.modelAlphaMotion.value.modelAlpha),this.perspToOrthoMotion.ended===!1&&(this.perspToOrthoMotion.update(e),this.camera.perspToOrtho.setScalar(clamp$1(this.perspToOrthoMotion.value.perspToOrtho,0,1))),this.locationMotion.ended===!1){this.locationMotion.update(e);var T=this.locationMotion.getKeyFrameSegment(e),_=T[0],R=T[1],S=this.panoResourceFromLocationMotionKeyframe(_),M=this.panoResourceFromLocationMotionKeyframe(R),B=new THREE__namespace.Vector3().copy(S.position),H=new THREE__namespace.Vector3().copy(M.position),w=this.locationMotion.value.count-R.value.count+1;m.progress=w,M.leftPanoPicture&&(w<1?S.leftPanoPicture&&(m.pano0=S.leftPanoPicture):m.pano0=M.leftPanoPicture,m.pano1=M.leftPanoPicture),M.effect==="montage"?m.transition="BLACK":M.effect==="spread"?m.transition="SPREAD":m.transition="FADE",(M.effect==="zoomin"||M.effect==="zoomout")&&(m.progress=Math.pow(w,3)),w<1&&M.effect!=="fly"&&(m.pano0&&S.leftPanoPicture&&(m.pano0={map:m.pano0.map,zoom:m.pano0.zoom,luminanceMap:m.pano0.luminanceMap,matrix:S.leftPanoPicture.matrix.clone().setPosition(M.position)}),B.copy(H),b=!0),y.distance=this.locationMotion.value.distance,y.offset=new THREE__namespace.Vector3(B.x+(H.x-B.x)*w,B.y+(H.y-B.y)*w,B.z+(H.z-B.z)*w);for(var C=[],L=[],I=0,F=this.locationMotion.keyframes;I<F.length;I++){var k=F[I],N=k.key,D=k.progress;N!==void 0&&(C.push(N),D>this.locationMotion.progress&&L.push(N))}for(var U=0,z=Object.keys(this.panoResources);U<z.length;U++){var G=z[U];if(!(L.indexOf(G)>=0)){var q=this.panoResources[G];if(q.leftPanoPicture){var K=q.leftPanoPicture.map;if(K){if(K===((s=m.pano0)===null||s===void 0?void 0:s.map)||K===((u=m.pano1)===null||u===void 0?void 0:u.map))continue;K instanceof TileCubeTextureTarget&&K.cubeRenderTarget&&this.colorCubeRenderTargetPool.push(K.cubeRenderTarget),K.dispose(),q.leftPanoPicture=null}}C.indexOf(G)>=0||delete this.panoResources[G]}}this.currentPano=panoParse(M.panoId),this.emit("pano.moving",createEvent("pano.moving",{userAction:this.userAction,prevPano:panoParse(A.panoId),state:__assign(__assign(__assign(__assign({},panoParse(E.panoId)),{mode:this.mode}),clonePose(this.camera.pose)),y),options:{},progress:this.locationMotion.progress,error:null}))}isEmptyObject(m)===!1&&(!((l=m.pano0)===null||l===void 0)&&l.map&&m.pano0.map instanceof TileCubeTextureTarget&&!m.pano0.map.cubeRenderTarget&&(m.pano0.map.cubeRenderTarget=this.colorCubeRenderTargetPool.pop()),!((c=m.pano1)===null||c===void 0)&&c.map&&m.pano1.map instanceof TileCubeTextureTarget&&!m.pano1.map.cubeRenderTarget&&(m.pano1.map.cubeRenderTarget=this.colorCubeRenderTargetPool.pop()),this.models.setMaterial(m)),isEmptyObject(y)===!1&&this.setCamera(y);var j=this.works.getResolvedObserver(this.currentPano),W=g[1];if(!W){console.error("xrFrame丢失,请重试");return}if(!this.xrManager.session){console.error("session丢失,请重试");return}var X=this.xrManager.referenceSpace;if(X){var ee=this.xrManager.cameraVR,$=this.xrManager.cameraL,re=this.xrManager.cameraR,ie=[$,re],se=W.getViewerPose(X),ae=new THREE__namespace.Vector3(0,0,0);if(se){var fe;fe=this.xrManager.session.renderState.baseLayer;var ne=se.views;if(!fe){console.error("no layer found");return}this.renderer.setFramebuffer(fe.framebuffer);var pe=!1;ne.length!==ee.cameras.length&&(ee.cameras.length=0,pe=!0),this.parallaxCameraMatrixs=[];var _e=new THREE__namespace.Vector3,me=new THREE__namespace.Vector3;new THREE__namespace.Matrix4().fromArray(ne[0].transform.matrix).decompose(_e,new THREE__namespace.Quaternion,new THREE__namespace.Vector3),new THREE__namespace.Matrix4().fromArray(ne[1].transform.matrix).decompose(me,new THREE__namespace.Quaternion,new THREE__namespace.Vector3),me.clone().sub(_e).normalize();var xe=new THREE__namespace.Vector3,Z=new THREE__namespace.Quaternion,te=new THREE__namespace.Vector3;this.camera.matrix.decompose(xe,Z,te);for(var Q=0;Q<ne.length;Q++){var be=ne[Q],ye=fe.getViewport(be),Ae=ie[Q];Ae.matrix.fromArray(be.transform.matrix);var Me=new THREE__namespace.Vector3,ge=new THREE__namespace.Quaternion,he=new THREE__namespace.Vector3;Ae.matrix.decompose(Me,ge,he),ae.copy(xe),Ae.position.copy(xe),Ae.quaternion.copy(ge),Ae.scale.copy(he),Ae.updateMatrix(),Ae.projectionMatrix.fromArray(be.projectionMatrix),Ae.viewport.set(ye.x,ye.y,ye.width,ye.height),pe===!0&&ee.cameras.push(Ae)}if(this.xrManager.session&&this.xrManager.session.inputSources){for(var Q=0;Q<this.xrManager.session.inputSources.length;Q++)if(this.xrManager.session.inputSources[Q]&&this.xrManager.session.inputSources[Q].targetRayMode==="transient-pointer"){var de=W.getPose(this.xrManager.session.inputSources[Q].targetRaySpace,X);if(de){var ce=new THREE__namespace.Vector3(0,0,-1).applyQuaternion(de.transform.orientation),le=new THREE__namespace.Raycaster(this.camera.position,ce);this.gazeRay=le}}}if(this.xrManager.machineType==="Oculus"||this.xrManager.machineType==="Pico"){for(var we=this.xrManager.session.inputSources,Q=0;Q<we.length;Q++){var ue=this.xrManager.controllers[Q],ve=we[Q];if(ve){ue&&ue.update(ve,W,X);var le=this.xrManager.getController(Q),qe=new THREE__namespace.Vector3(0,1.2,0),Ee=le.position.clone().add(ae).sub(qe);ve.handedness==="left"?this.xrControllerRay.left.set(Ee,new THREE__namespace.Vector3(0,0,-1).applyEuler(le.rotation)):ve.handedness==="right"&&this.xrControllerRay.right.set(Ee,new THREE__namespace.Vector3(0,0,-1).applyEuler(le.rotation)),this.controllerWrappers[Q].position.copy(new THREE__namespace.Vector3(0,0,0).add(ae).sub(qe));var Ie=this.models.intersectRaycaster(this.xrControllerRay.right);if(Ie.length===0&&(Ie=this.xrControllerRay.right.intersectObject(this.boundingMesh,!0).map(function(vt){var At;return __assign({floor:(At=j==null?void 0:j.floorIndex)!==null&&At!==void 0?At:0},vt)})),Ie.length>=1&&Ie[0].face)if(ve.handedness==="right"){var Oe=this.xrControllerRay.right.intersectObject(this.xrCustomObjectsScene,!0),$e=Ie[0].face.normal,pt=$e.clone(),tt=Ie[0].point.clone();this.intersectMesh.position.copy(tt);var Ne=tt.clone().add(pt);if(this.intersectMesh.lookAt(Ne),Math.abs($e.y)>.99){var Ge=this.camera.position.clone().sub(tt);this.intersectMesh.rotation.z=-Math.atan2(Ge.z,Ge.x)}this.intersectMesh.visible=!0,this.needsRender=!0,Oe.length>0?(this.pointerLines.right.setPoints(Ee,Oe[0].point),this.pointerLines.right.points.visible=!0,this.intersectMesh.visible=!1):(this.pointerLines.right.points.visible=!1,this.pointerLines.right.setPoints(Ee,Ie[0].point));var Ve=Ie[0],Ke=createEvent("intersect.update",{raycaster:(f=this.xrControllerRay.right)!==null&&f!==void 0?f:null,intersection:Ve!=null?Ve:null,object:this.intersectMesh});if(this.emit("intersect.update",Ke),Ke.defaultPrevented){this.hideIntersectMesh();return}}else this.pointerLines.left.setPoints(Ee,Ie[0].point)}}this.updateControllerHelper(we,e,r)}if(this.camera.pose.distance>.1||b)for(var Je=0,Xe=Object.keys(this.panoMeshes);Je<Xe.length;Je++){var Pe=Xe[Je],Se=this.panoMeshes[Pe];Se.setOpacity(0),Se.setCurrent(!1),Se.updateTime&&Se.updateTime(e,r),Se.visible=!1}else if(j){var Be=arrayMin(j.visibleIds,function(je){var at=o.works.getResolvedObserver(je);return at?j.standingPosition.distanceTo(at.standingPosition):1/0},!0),De=Be[1];De=clamp$1(De,2.5,1/0);for(var He=j.visibleIds.concat(panoStringify(this.currentPano)),Ue=this.getForwardObserverOrNot(),Ye=this.camera.getDirection(new THREE__namespace.Vector3),ze=0,rt=Object.keys(this.panoMeshes);ze<rt.length;ze++){var Pe=rt[ze],Se=this.panoMeshes[Pe],ot=this.works.getResolvedObserver(Pe);if(He.indexOf(Pe)===-1)Se.setCurrent(!1),Se.setOpacity(0);else if(!ot)Se.setCurrent(!1),Se.setOpacity(0);else if(!ot.loadable&&!ot.active)Se.setCurrent(!1),Se.setOpacity(0);else{var ht=Se.position.clone().setY(this.camera.position.y).distanceTo(this.camera.position);Se.setCurrent(!Se.loading&&Se.progress===0&&Ue!==null&&Ue.panoId===Pe),Se.setOpacity(ht<.01?0:clamp$1(De/ht*1.2,.65,.98));var st=this.camera.position.clone().setY(Se.position.y),ce=new THREE__namespace.Vector3().copy(Se.position).sub(st).normalize();if(Pe===panoStringify(this.currentPano)){var ct=clamp$1((.5-st.distanceTo(Se.position))/.5,0,1);ce.multiplyScalar(1-ct).add(Ye.clone().multiplyScalar(ct))}ce.length()>0&&Se.quaternion.setFromEuler(new THREE__namespace.Euler(0,Math.atan2(ce.x,ce.z),0))}Se.updateTime&&Se.updateTime(e,r)}}var We=function(){return 4}(),Ce=function(){var je=new THREE__namespace.PerspectiveCamera;je.applyMatrix4(ee.matrix),je.position.set(0,0,0);var at=o.works.getResolvedObserver(E.panoId),vt=at!=null?at:j;vt&&je.quaternion.premultiply(vt.quaternion.clone().inverse()),je.updateProjectionMatrix(),je.updateMatrixWorld(!0);var At=new THREE__namespace.Frustum().setFromProjectionMatrix(new THREE__namespace.Matrix4().multiplyMatrices(je.projectionMatrix,je.matrixWorldInverse));return At}();E.panoId===panoStringify(this.currentPano)&&((d=E.leftPanoPicture)===null||d===void 0?void 0:d.map)instanceof TileCubeTextureTarget&&(E.leftPanoPicture.map.maxRequest=this.tileMaxRequest,E.leftPanoPicture.map.update(Ce,We),E.leftPanoPicture.map.needsRender===!0&&(this.needsRender=!0,this.modelSceneNeedsRender=!0));{var Re=this.tiling.object.visible;if(this.initAnimationed){var Le=E.panoId,Qe=this.works.getResolvedObserver(Le);Qe?isSimilarVector3(this.camera.position,Qe.position)&&this.locationMotion.ended?(this.tiling.object.visible=!0,this.tiling.panoId!==Le&&this.tiling.cleanup(),this.tiling.panoId=Le,this.tiling.setResource((v=(p=Qe.images)===null||p===void 0?void 0:p.tiles)!==null&&v!==void 0?v:[],this.enableIOSEDR&&Qe.images.luminance?Qe.images.luminance:null),this.tiling.setFetcher(getFetcher(Qe.work)),this.tiling.setRotation(Qe.quaternion),this.tiling.setPosition(Qe.position),this.tiling.maxRequest=this.tileMaxRequest,We>this.TILED_CUBE_TEXTURE_LEVEL?this.tiling.update(Ce,We,e):this.tiling.update(Ce,0,e)):this.tiling.object.visible=!1:this.tiling.object.visible=!1}else this.tiling.object.visible=!1;Re!==this.tiling.object.visible&&(this.tiling.object.needsRender=!0,this.modelSceneNeedsRender=!0)}this.panoVideo.object.position.copy(this.camera.position),this.panoVideo.updateTime(e)}}},t.prototype.render=function(){var e=this.xrManager.getCamera(this.camera);this.renderer.render(this.modelScene,e),this.renderer.autoClearColor=!1,this.renderer.autoClearDepth=!1,this.renderer.render(this.scene,e),this.renderer.autoClearColor=!0,this.renderer.autoClearDepth=!0},t.prototype.onPanGesture=function(){},t.prototype.onTapGesture=function(){},t.prototype.onPinchGesture=function(){},t.prototype.onMouseMove=function(){},t.prototype.onMouseOut=function(){},t.prototype.panoResourceFromLocationMotionKeyframe=function(e){return this.panoResources[e.key]},t.prototype.updateControllerHelper=function(e,r,o){var s=this.xrControllerRay.left,u=this.xrControllerRay.right;if(!(!e||e.length===0)){for(var l={buttons:{X:!1,Y:!1,LeftTrigger:!1,LeftPinch:!1,A:!1,B:!1,RightTrigger:!1,RightPinch:!1}},c=0;c<e.length;c++){var f=e[c].handedness,d=e[c].gamepad;switch(f){case"left":d.axes&&(this.emitHandleEvent(d.axes[2]===-1,"LeftAxesLeft",r),this.emitHandleEvent(d.axes[2]===1,"LeftAxesRight",r),this.emitHandleEvent(d.axes[3]===-1,"LeftAxesUp",r),this.emitHandleEvent(d.axes[3]===1,"LeftAxesDown",r)),d!=null&&d.buttons&&(d.buttons[4]&&this.emitHandleEvent(d.buttons[4].pressed,"X",r),d.buttons[5]&&this.emitHandleEvent(d.buttons[5].pressed,"Y",r),d.buttons[0]&&this.emitHandleEvent(d.buttons[0].pressed,"LeftTrigger",r),d.buttons[1]&&this.emitHandleEvent(d.buttons[1].pressed,"LeftPinch",r));var p={raycaster:s,axes:{up:d.axes&&d.axes[3]<0?Math.abs(d.axes[3]):0,down:d.axes&&d.axes[3]<0?0:Math.abs(d.axes[3]),left:d.axes&&d.axes[2]<0?Math.abs(d.axes[2]):0,right:d.axes&&d.axes[2]<0?0:Math.abs(d.axes[2])},deltaTime:o};l.buttons.X=d.buttons&&d.buttons[4]?d.buttons[4].pressed:!1,l.buttons.Y=d.buttons&&d.buttons[5]?d==null?void 0:d.buttons[5].pressed:!1,l.buttons.LeftTrigger=d.buttons&&d.buttons[0]?d==null?void 0:d.buttons[0].pressed:!1,l.buttons.LeftPinch=d.buttons&&d.buttons[1]?d==null?void 0:d.buttons[1].pressed:!1,l.left=p;break;case"right":d.axes&&(this.emitHandleEvent(d.axes[2]===-1,"RightAxesLeft",r),this.emitHandleEvent(d.axes[2]===1,"RightAxesRight",r),this.emitHandleEvent(d.axes[3]===-1,"RightAxesUp",r),this.emitHandleEvent(d.axes[3]===1,"RightAxesDown",r)),d.buttons&&(d.buttons[4]&&this.emitHandleEvent(d.buttons[4].pressed,"A",r),d.buttons[5]&&this.emitHandleEvent(d.buttons[5].pressed,"B",r),d.buttons[0]&&this.emitHandleEvent(d.buttons[0].pressed,"RightTrigger",r),d.buttons[1]&&this.emitHandleEvent(d.buttons[1].pressed,"RightPinch",r));var v={raycaster:u,axes:{up:d.axes&&d.axes[3]<0?Math.abs(d.axes[3]):0,down:d.axes&&d.axes[3]<0?0:Math.abs(d.axes[3]),left:d.axes&&d.axes[2]<0?Math.abs(d.axes[2]):0,right:d.axes&&d.axes[2]<0?0:Math.abs(d.axes[2])},deltaTime:o};l.right=v,l.buttons.A=d.buttons&&d.buttons[4]?d==null?void 0:d.buttons[4].pressed:!1,l.buttons.B=d.buttons&&d.buttons[5]?d==null?void 0:d.buttons[5].pressed:!1,l.buttons.RightTrigger=d.buttons&&d.buttons[0]?d==null?void 0:d.buttons[0].pressed:!1,l.buttons.RightPinch=d.buttons&&d.buttons[1]?d==null?void 0:d.buttons[1].pressed:!1;break}}this.emit("xr.controller.update",createEvent("xr.controller.update",l))}},t.prototype.emitHandleEvent=function(e,r,o){var s=this.xrControllerRay.left,u=this.xrControllerRay.right;if(e)if(this.xrHandleState[r].touchStart===!1)this.xrHandleState[r].touchStartTime=o,this.xrHandleState[r].touchStart=!0,this.emit("xr.gesture.buttonDown",createEvent("xr.gesture.buttonDown",{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:r,isFinal:!1,isFirst:!0,controllers:{raycaster:{leftRay:s,rightRay:u}}}));else{var l=o-this.xrHandleState[r].touchStartTime;l>CONTROLLER_EVNET_DELTA_TIME&&this.emit("xr.gesture.press",createEvent("xr.gesture.tap",{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:r,isFinal:!0,isFirst:!0,controllers:{raycaster:{leftRay:s,rightRay:u}}}))}else if(this.xrHandleState[r].touchStart===!0){this.emit("xr.gesture.buttonUp",createEvent("xr.gesture.buttonUp",{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:r,isFinal:!0,isFirst:!1,controllers:{raycaster:{leftRay:s,rightRay:u}}}));var l=o-this.xrHandleState[r].touchStartTime;if(l<=CONTROLLER_EVNET_DELTA_TIME){var c=createEvent("xr.gesture.tap",{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:r,isFinal:!0,isFirst:!1,controllers:{raycaster:{leftRay:s,rightRay:u}}}),f=this.emit("xr.gesture.tap",c);!f&&!c.defaultPrevented&&r==="RightTrigger"&&this.checkSelectedPano(this.xrControllerRay.right)}this.xrHandleState[r].touchStart=!1,this.xrHandleState[r].touchStartTime=0}},t.prototype.initHandEvent=function(){var e=this;if(!this.xrManager.session)throw new Error("初始化失败");this.xrManager.session.addEventListener("select",function(r){e.gazeRay&&e.checkSelectedPano(e.gazeRay)})},t}(PanoramaController),Controllers={Floorplan:FloorplanController,Topview:TopviewController,Panorama:PanoramaController,VRPanorama:VRPanoramaController,Model:ModelController,Mapview:MapviewController,XRPanorama:XRPanoramaController},PROXY_CONTROLLER_EVENT_NAMES=["gesture.pan","gesture.tap","gesture.dbltap","gesture.press","gesture.pinch","gesture.mousewheel","gesture.mousemove","gesture.momentum","initAnimation.start","initAnimation.end","camera.update","intersect.update","pano.select","pano.moveTo","pano.moving","pano.arrived","pano.cancel","pano.error","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"];function initLegacyEvent(n){n.on("initAnimation.start",function(t){n.emit("initAnimationWillStart",t.state.panoIndex,t.state,t.userAction)}),n.on("initAnimation.end",function(t){n.emit("initAnimationEnded",t.state.panoIndex,t.state,t.userAction)}),n.on("gesture.pan",function(t){var e=!1;e=n.emit("wantsGesture","pan",t.pointers,t.isFinal),e&&t.preventDefault(),e=n.emit("wantsPanGesture",t.state,t.isFinal),e&&t.preventDefault(),t.defaultPrevented||(n.emit("gesture","pan",t.pointers,t.isFinal),n.emit("panGesture",t.state,t.isFinal))}),n.on("gesture.tap",function(t){var e=!1;e=n.emit("wantsGesture","tap",t.pointers,t.isFinal),e&&t.preventDefault(),e=n.emit("wantsTapGesture",t.center.raycaster,t.center.coords,t.isFinal),e&&t.preventDefault(),t.defaultPrevented||(n.emit("gesture","tap",t.pointers,t.isFinal),n.emit("tapGesture",t.center.raycaster,t.center.coords,t.isFinal))}),n.on("gesture.dbltap",function(t){var e=!1;e=n.emit("wantsGesture","dbltap",t.pointers,t.isFinal),e&&t.preventDefault(),e=n.emit("wantsDblTapGesture",t.center.raycaster,t.center.coords,t.isFinal),e&&t.preventDefault(),t.defaultPrevented||(n.emit("gesture","dbltap",t.pointers,t.isFinal),n.emit("dblTapGesture",t.center.raycaster,t.center.coords,t.isFinal))}),n.on("gesture.press",function(t){var e=!1;e=n.emit("wantsGesture","press",t.pointers,t.isFinal),e&&t.preventDefault(),e=n.emit("wantsPressGesture",t.center.raycaster,t.center.coords,t.center.delta,t.isFinal),e&&t.preventDefault(),t.defaultPrevented||(n.emit("gesture","press",t.pointers,t.isFinal),n.emit("pressGesture",t.center.raycaster,t.center.coords,t.center.delta,t.isFinal))}),n.on("gesture.pinch",function(t){var e=!1;e=n.emit("wantsGesture","pinch",t.pointers,t.isFinal),e&&t.preventDefault(),e=n.emit("wantsPinchGesture",t.scale,t.state.fov,t.isFinal),e&&t.preventDefault(),t.defaultPrevented||(n.emit("gesture","pinch",t.pointers,t.isFinal),n.emit("pinchGesture",t.scale,t.state.fov,t.isFinal))}),n.on("gesture.mousewheel",function(t){var e=!1;e=n.emit("wantsGesture","mouseWheel",t.pointers,t.isFinal),e&&t.preventDefault(),e=n.emit("wantsMouseWheel",t.center.delta,t.state.fov,t.isFinal),e&&t.preventDefault(),t.defaultPrevented||(n.emit("gesture","mouseWheel",t.pointers,t.isFinal),n.emit("mouseWheel",t.center.delta,t.state.fov,t.isFinal))}),n.on("gesture.mousemove",function(t){var e=!1;e=n.emit("wantsGesture","mouseMove",t.pointers,t.isFinal),e&&t.preventDefault(),t.defaultPrevented||(n.emit("gesture","mouseMove",t.pointers,t.isFinal),e=n.emit("wantsChangeCameraFov",t.state.fov),e&&t.preventDefault())}),n.on("gesture.momentum",function(t){var e=!1;e=n.emit("wantsInteriaPan",t.state),e&&t.preventDefault(),t.defaultPrevented||n.emit("interiaPan",t.state,t.isFinal)}),n.on("camera.update",function(t){n.emit("cameraFovUpdate",t.state.fov,t.userAction),n.emit("cameraDirectionUpdate",t.state,t.userAction);var e=coordinatesToVector(t.state);e.setLength(t.state.distance);var r=t.state.offset.clone().sub(e);n.emit("cameraPositionUpdate",r,t.userAction),n.emit("cameraUpdate",t.state,t.userAction)}),n.on("intersect.update",function(t){if(t.intersection){var e=!1;e=n.emit("wantsShowIntersectionOnModel",t.raycaster),e&&t.preventDefault(),t.defaultPrevented||n.emit("intersectionOnModelUpdate",t.intersection,t.object)}else n.emit("intersectionHidden")}),n.on("pano.request",function(t){var e=n.emit("wantsMoveToPano",t.state.panoIndex,t.options,t.userAction);e||(e=n.emit("wantsToMoveToPano",t.state.panoIndex,t.options,t.userAction)),e&&t.preventDefault(),t.defaultPrevented||n.emit("panoWillLoad",t.state.panoIndex)}),n.on("pano.select",function(t){n.emit("panoSelected",t.state.panoIndex)}),n.on("pano.moveTo",function(t){n.emit("panoLoaded",t.state.panoIndex),n.emit("moveToPano",t.state.panoIndex,t.userAction),n.emit("panoWillArrive",t.state.panoIndex,t.state,t.userAction)}),n.on("pano.moving",function(t){n.emit("movingToPano",t.state.panoIndex,t.prevPano.panoIndex,t.progress)}),n.on("pano.arrived",function(t){n.emit("panoArrived",t.state.panoIndex,t.state,t.userAction)}),n.on("pano.cancel",function(t){n.emit("moveToPanoCanceled",t.state.panoIndex)}),n.on("pano.error",function(t){n.emit("panoLoadError",t.error,t.state.panoIndex)}),n.on("pano.texture.load",function(t){n.emit("textureStartLoad",t.pano.panoIndex)}),n.on("pano.texture.success",function(t){n.emit("textureLoaded",t.pano.panoIndex,t.meta)}),n.on("pano.texture.error",function(t){n.emit("textureError",t.error,t.pano.panoIndex)}),n.on("pano.texture.abort",function(t){n.emit("textureAbort",t.pano.panoIndex)}),n.on("pano.texture.progress",function(t){n.emit("textureLoading",t.progress,t.pano.panoIndex)}),n.on("xr.session.start",function(t){n.emit("webXRSessionStart")}),n.on("xr.session.end",function(t){n.emit("webXRSessionEnd")}),n.on("xr.gesture.tap",function(t){n.emit("webXRControllerEvent","tap",t.buttons,{raycaster:t.controllers.raycaster})}),n.on("xr.gesture.press",function(t){n.emit("webXRControllerEvent","press",t.buttons,{raycaster:t.controllers.raycaster})}),n.on("xr.gesture.buttonUp",function(t){n.emit("webXRControllerEvent","buttonUp",t.buttons,{raycaster:t.controllers.raycaster})}),n.on("xr.gesture.buttonDown",function(t){n.emit("webXRControllerEvent","buttonDown",t.buttons,{raycaster:t.controllers.raycaster})}),n.on("xr.controller.update",function(t){n.emit("webXRControllerRayUpdate",{leftRay:t.left?t.left.raycaster:void 0,rightRay:t.right?t.right.raycaster:void 0}),t.left&&n.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&&n.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})}),n.on("works.request",function(t){n.emit("willLoad",t.input,t.works[0],t.state)}),n.on("works.load",function(t){n.emit("load",t.input,t.works[0],t.state)}),n.on("works.ready",function(t){n.emit("loaded",t.input,t.works[0])}),n.on("state.change",function(t){n.emit("stateChange",t.state,t.userAction)}),n.on("currentState.change",function(t){n.emit("currentStateChange",t.state,t.userAction)}),n.on("state.set",function(t){n.emit("setState",t.state)}),n.on("state.synced",function(t){n.emit("stateSynced",t.state)}),n.on("model.request",function(t){n.emit("modelWillLoad",t.work.model)}),n.on("model.error",function(t){n.emit("modelLoadError",t.error,t.model)}),n.on("model.load",function(t){n.emit("modelLoaded",t.model)}),n.on("model.changeShownFloor",function(t){n.emit("modelShownFloorChange",t.model.shownFloor,t.model.floorLength)}),n.on("render",function(t){n.emit("renderFrame",t.needsRender)}),n.on("mode.change.request",function(t){n.emit("wantsChangeMode",t.mode,t.prevMode)}),n.on("mode.change",function(t){n.emit("modeChange",t.mode,t.prevMode,t.state.panoIndex,t.state,t.userAction)}),n.on("helpers.visible",function(t){n.emit("helpersVisibleChange",t.object.visible)}),n.on("network.resource",function(t){n.emit("network",t.source,t.requestType,t.requestState,t.detail)})}function generateDefaultVideoElement(){if(typeof window!="undefined"){var n=document.createElement("video");n.loop=!0,n.autoplay=!0,n.playsInline=!0,n.muted=!0,n.crossOrigin="";var t=function(){document.removeEventListener("touchstart",t,!1),document.removeEventListener("mousedown",t,!1),n.muted=!1};return document.addEventListener("touchstart",t,!1),document.addEventListener("mousedown",t,!1),n}else return{}}function initLights(n){var t=new THREE__namespace.Group;t.name="internalLights";{var e=new THREE__namespace.DirectionalLight(16777215,.3);e.position.copy(new THREE__namespace.Vector3(1,1,1)),t.add(e)}{var e=new THREE__namespace.DirectionalLight(16777215,.1);e.position.copy(new THREE__namespace.Vector3(-1,-1,-1)),t.add(e)}{var e=new THREE__namespace.DirectionalLight(16777215,.1);t.add(e)}{var e=new THREE__namespace.AmbientLight(16777215,.6);t.add(e)}n.add(t)}function parseKeyValue(n){for(var t,e,r={},o=n.split(/(\;|\,)/),s=0,u=o;s<u.length;s++){var l=u[s],c=l.split("="),f=(t=c[0])===null||t===void 0?void 0:t.trim(),d=(e=c[1])===null||e===void 0?void 0:e.trim();f&&d&&(r[f]=d)}return r}function getViewportScale(){var n;if(typeof document!="undefined")for(var t=document.getElementsByTagName("meta"),e=0;e<t.length;e++){var r=t[e];if(r.getAttribute("name")==="viewport"){var o=parseKeyValue((n=r.getAttribute("content"))!==null&&n!==void 0?n:""),s=Number(o["initial-scale"]);if(!isNaN(s))return s}}return 1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5ZjkuhI6DMP+J7cTvEtokEx0aPscyddoFJKpSZqV7G1GTxcpmEthpnw5058c6GfwqpwzGOtGjXSJI3FLYhc+O+jSr9aGhPWQlRshS8AticLX7wnsgbXxt6gsWCpRBa0vRGQM8oB9dhmP3QAwFX4c079dJNq6Qi5xbuyTmpPSJ1Ur4UtF7GoTtmUL3zxaWqMU8P/k3cXSQ1EQRjHGdzdHTa4u7tzBs7CedhykNwF2/5jq56iU11db6Lv2yTj8hs3JoiU9sZZp5/62J5v1z9NjrDHaSbnbFMf52sHrDUVaidDxNG0o9+uLjfosfdb3jT5d5j757riJgst9NIZQ2Pn+ySZll80vjI6Wz/hQJG4vPG0L/H6poQch/dW3vL3B0u8jl0HvVj5PvHCElEF8DUAFikVYTcvmfBdDzQlvvMXSV5lP5zrXj/fJ54zuWaeeuoqkW8AwCIaqeTZKkmYrpPwR2eqN9X72W7EG57vU67OBeuMV8KXLUzv93UTTj42tvaFS++GVsc5JRyLSLJ8nzO555hFBmiSRCqMr4GwrcmGkib5xSvcwmzFK6e8s7DMa2xH4YZdZumSOwsVzFeBWdr37tpIhOpSwXqONNgZq/2KgvBt54znHN1HzlljTO4oVD5fb+prNIJXQNL1ofDKQisbPLJDv3jNSLq9OkYBEIihKIj3v7S1TRQCX5Kdl1ZQlol7LF+E++fwirfiq2sf4cTXxc6hzxffPuLEeqSWrPGWMF58TWr5viyJAP5/4EV4KePiaSE8eNRgjDy8/tyRW+FZjhS+2tlovNJovtJovNJ0uhK6Wo64SDdxEbM//KesjwAAAABJRU5ErkJggg==";var imageSize=[351,63],imageOffset=[20,20],vertices=new Float32Array([-.5,-.5,0,.5,-.5,0,-.5,.5,0,.5,.5,0]),uvs=new Float32Array([0,0,1,0,0,1,1,1]),index=new Uint8Array([0,1,2,1,3,2]),geometry=new THREE__namespace.BufferGeometry;geometry.setAttribute("position",new THREE__namespace.BufferAttribute(vertices,3)),geometry.setAttribute("uv",new THREE__namespace.BufferAttribute(uvs,2)),geometry.setIndex(new THREE__namespace.BufferAttribute(index,1));var material=new THREE__namespace.MeshBasicMaterial({transparent:!0,depthTest:!1,depthWrite:!1,stencilWrite:!1,fog:!1}),mesh=new THREE__namespace.Mesh(geometry,material);mesh.matrixAutoUpdate=!1;var scene=new THREE__namespace.Scene;scene.add(mesh),scene.matrixAutoUpdate=!1;var camera=new THREE__namespace.OrthographicCamera(-.5,.5,.5,-.5,.1,1);camera.position.set(0,0,.5),camera.lookAt(0,0,0),camera.updateMatrixWorld(!0),camera.matrixAutoUpdate=!1;var prevViewport=new THREE__namespace.Vector4,prevScissor=new THREE__namespace.Vector4;function renderPoweredByRealsee(n){if(material.map){var r=n.getViewport(prevViewport),o=n.getScissor(prevScissor),s=n.getScissorTest(),u=n.autoClear,l=o.x+imageOffset[0]/3,c=o.y+imageOffset[1]/3,f=imageSize[0]/3,d=imageSize[1]/3;n.setViewport(l,c,f,d),n.setScissor(l,c,f,d),n.setScissorTest(!0),n.autoClear=!1,n.render(scene,camera),n.setViewport(r),n.setScissor(o),n.setScissorTest(s),n.autoClear=u}else{var t=new THREE__namespace.Texture,e=new Image;e.onload=function(){t.image=e,t.wrapS=THREE__namespace.ClampToEdgeWrapping,t.wrapT=THREE__namespace.ClampToEdgeWrapping,t.minFilter=THREE__namespace.LinearFilter,t.needsUpdate=!0,t.generateMipmaps=!1,material.needsUpdate=!0,e.onload=noop$1},e.src=textureURL,material.map=t}}var DEFAULT_MODE_CHANGE_DURATION=800,DEFAULT_CAMERA_FOV=90,DEFAULT_REQUEST_PROXY=function(n){return n.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/")},sharedVector2=new THREE__namespace.Vector2,sharedSphere=new THREE__namespace.Sphere,sharedFrustum=new THREE__namespace.Frustum,sharedProjScreenMatrix=new THREE__namespace.Matrix4,clockForMixer=new WeakMap,worksMap=new WeakMap,emptyWorks=createWorks([]),Five=function(n){__extends(t,n);function t(e){e===void 0&&(e={});var r,o,s,u,l,c,f,d,p,v,g,h=n.call(this)||this;if(h.ident=createUuid(),typeof window!="undefined"&&(__FIVE_DEBUG__.instances[h.ident]=h),h.renderSwitch01=0,h.currentMode="Mapview",h.pano={workCode:"",panoIndex:0},h.needsRender=!1,h.modelSceneNeedsRender=!1,h.onlyRenderIfNeeds=(r=e.onlyRenderIfNeeds)!==null&&r!==void 0?r:!0,h.imageOptions=__assign({},(o=e.imageOptions)!==null&&o!==void 0?o:{}),h.textureOptions=__assign({},(s=e.textureOptions)!==null&&s!==void 0?s:{}),h.poweredByRealsee=(u=e.poweredByRealsee)!==null&&u!==void 0?u:!0,h.extraElements=[],h.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)},h.fps={testCount:0,testTime:now()},h.info=null,h.modeChangeDuration=(l=e.modeChangeDuration)!==null&&l!==void 0?l:DEFAULT_MODE_CHANGE_DURATION,h.enableWheel=(c=e.enableWheel)!==null&&c!==void 0?c:!0,typeof window!="undefined")if("renderer"in e)e.renderer instanceof InternalWebGLRenderer&&h.throwError(new Error("cannot render a internal renderer")),h.renderer=e.renderer;else try{h.renderer=new InternalWebGLRenderer({preserveDrawingBuffer:e.preserveDrawingBuffer,backgroundColor:e.backgroundColor,backgroundAlpha:e.backgroundAlpha,antialias:e.antialias,webgl2:e.webgl2,logarithmicDepthBuffer:e.logarithmicDepthBuffer,precision:e.precision,powerPreference:e.powerPreference});var m=getViewportScale();h.renderer.setPixelRatio(m===1?window.devicePixelRatio:1),h.renderer.setSize(512,512)}catch(H){H instanceof Error&&h.throwError(H)}h.getPixelsRenderTarget=new THREE__namespace.WebGLRenderTarget(1,1,{encoding:(d=(f=h.renderer)===null||f===void 0?void 0:f.outputEncoding)!==null&&d!==void 0?d:THREE__namespace.sRGBEncoding,generateMipmaps:!1});var y=new THREE__namespace.DepthTexture(1,1);y.generateMipmaps=!1,y.format=THREE__namespace.DepthStencilFormat,y.type=THREE__namespace.UnsignedInt248Type,h.modelRenderTarget=new THREE__namespace.WebGLRenderTarget(1,1,{encoding:(v=(p=h.renderer)===null||p===void 0?void 0:p.outputEncoding)!==null&&v!==void 0?v:THREE__namespace.sRGBEncoding,depthTexture:y,generateMipmaps:!1,depthBuffer:!0,stencilBuffer:!0}),h.scissor=Object.assign({left:0,bottom:0,width:1,height:1},e.scissor),h.camera=new Camera(DEFAULT_CAMERA_FOV),h.scene=new Scene,h.xrCustomObjectsScene=new THREE__namespace.Scene,h.scene.add(h.xrCustomObjectsScene),h.scene.matrixAutoUpdate=!1,h.lastLoadWorkTask=Promise.resolve(),h.requestProxy=(g=e.requestProxy)!==null&&g!==void 0?g:DEFAULT_REQUEST_PROXY,h.networkSubscribe=new NetworkSubscribe,h.networkSubscribe.on("network",function(H,w,C,L){var I;h.emit("network.resource",createEvent("network.resource",{source:H,requestType:w,requestState:C,detail:L})),(I=h.analysis)===null||I===void 0||I.network(h.works,H,w,C,L)}),h.boundingMesh=generateBoundingMesh(new THREE__namespace.Box3(new THREE__namespace.Vector3(-.5,-.5,-.5),new THREE__namespace.Vector3(.5,.5,.5))),h.boundingMesh.name="bounding",h.models=createModels(),h.models.push(new Model),h.lastModels=createModels(),h.lastWorks=createWorks([]),h.readyCallbacks=[],h.syncingState=!1,h.helperGroup=new THREE__namespace.Group,h.helperGroup.name="helper",h.helperGroup.matrixAutoUpdate=!1,h.scene.add(h.helperGroup),h.modelGroup=new THREE__namespace.Group,h.modelGroup.visible=!1,h.modelGroup.name="model",h.modelGroup.matrixAutoUpdate=!1,h.modelScene=new THREE__namespace.Scene,h.modelScene.add(h.modelGroup),h.modelScene.add(h.boundingMesh),h.modelScene.matrixAutoUpdate=!1,h.videoTexture=new THREE__namespace.VideoTexture(e.videoInstance||generateDefaultVideoElement()),initLights(h.scene),initLights(h.modelScene),h.state={mode:h.currentMode,workCode:h.pano.workCode,panoIndex:h.pano.panoIndex,longitude:h.camera.pose.longitude,latitude:h.camera.pose.latitude,fov:h.camera.pose.fov,offset:h.camera.pose.offset.clone(),distance:h.camera.pose.distance},h.stateSynced=!1,h._enablePostProcessing=!1,h._enableIOSEDR=!1,h._enableEDL=!1,h._enableHQ=!1,h.destroyed=!1,h.paused=!0,typeof window!="undefined"&&(e.play!==!1&&h.play(),h.stopAnimationLoop=AnimationFrameLoop.shared.add(function(H,w){for(var C=[],L=2;L<arguments.length;L++)C[L-2]=arguments[L];h.updateTime.apply(h,__spreadArray([H,w],C,!1))},!1,0,10));var A=function(){typeof document!="undefined"&&document.fullscreenElement===null&&h.currentMode==="VRPanorama"&&h.controller.emit("vr.requestExit",createEvent("vr.requestExit",{}))},E=function(){h.needsRender=!0,h.modelSceneNeedsRender=!0};if(typeof document!="undefined"&&document.addEventListener("fullscreenchange",A,!1),h.renderer&&h.renderer.domElement.addEventListener("webglcontextrestored",E,!1),h.removeEventListeners=function(){typeof document!="undefined"&&document.removeEventListener("fullscreenchange",A,!1),h.renderer&&h.renderer.domElement.removeEventListener("webglcontextrestored",E,!1)},h.plugins={},e.plugins&&e.plugins.length)for(var b=0,T=e.plugins;b<T.length;b++){var _=T[b];if(typeof _=="function")_(h);else if(Array.isArray(_)){var R=_[0],S=_[1],M=_[2];if(typeof R=="function"){var B=R(h,M);typeof S=="string"&&(h.plugins[S]?h.throwError(new Error("plugin name ".concat(S," is exists."))):h.plugins[S]=B)}}}return h.gpuPickingRenderTarget=new THREE__namespace.WebGLRenderTarget(1,1,{generateMipmaps:!1}),h.meshReplaceMaterialMap=new Map,h.meshOriginMaterialMap=new Map,initLegacyEvent(h),h.resetController(),h}return Object.defineProperty(t,"version",{get:function(){return"6.4.0-alpha.9"},enumerable:!1,configurable:!0}),Object.defineProperty(t,"dracoPath",{get:function(){return draco.decoderPath},set:function(e){draco.setDecoderPath(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t,"ktx2Path",{get:function(){return ktx2.transcoderPath},set:function(e){ktx2.setTranscoderPath(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"panoIndex",{get:function(){return this.pano.panoIndex},enumerable:!1,configurable:!0}),t.prototype.getGPUPicking=function(e,r,o,s,u){var l=this;if(s===void 0&&(s=1),u===void 0&&(u=new THREE__namespace.Vector3(0,0,0)),!this.renderer)throw new Error("renderer is not initialized.");var c=this.models.getMaterial(),f=c.constantColor,d=c.colorStyle;this.models.setMaterial({colorStyle:"CONSTANT",constantColor:u}),this.scene.traverse(function(h){if(!(!(h instanceof THREE__namespace.Mesh)||h instanceof PBMMesh)){var m=Object.keys(o).filter(function(A){return A===h.uuid})[0];if(m)if(l.meshOriginMaterialMap.set(m,h.material),l.meshReplaceMaterialMap.get(m))h.material=l.meshReplaceMaterialMap.get(m);else{var y=new THREE__namespace.ShaderMaterial({uniforms:{color:{value:o[m]}},vertexShader:`
|
|
2170
2170
|
void main() {
|
|
2171
2171
|
vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );
|
|
2172
2172
|
gl_Position = projectionMatrix * mvPosition;
|
|
@@ -2176,4 +2176,4 @@ void main() {
|
|
|
2176
2176
|
void main() {
|
|
2177
2177
|
gl_FragColor = vec4( color, 1.0 );
|
|
2178
2178
|
}
|
|
2179
|
-
`});y.depthTest=h.material.depthTest,y.side=h.material.side,l.meshReplaceMaterialMap.set(m,y),h.material=y}}});var p=this.renderer.getSize(new THREE__namespace.Vector2);this.camera.setViewOffset(p.width,p.height,e*s,r*s,1,1),this.renderer.setRenderTarget(this.gpuPickingRenderTarget),this.render();var v=new Uint8Array(4);this.renderer.readRenderTargetPixels(this.gpuPickingRenderTarget,0,0,1,1,v),this.renderer.setRenderTarget(null),this.camera.clearViewOffset(),this.scene.traverse(function(h){!(h instanceof THREE__namespace.Mesh)||h instanceof PBMMesh||l.meshOriginMaterialMap.get(h.uuid)&&(h.material=l.meshOriginMaterialMap.get(h.uuid))}),this.models.setMaterial({colorStyle:d,constantColor:f});var g=Object.keys(o).filter(function(h){return o[h].equals(new THREE__namespace.Color().setRGB(v[0]/255,v[1]/255,v[2]/255))})[0];return g||!1},t.prototype.dispose=function(){var e,r;if(this.destroyed!==!0){delete __FIVE_DEBUG__.instances[this.ident],this.emit("dispose"),this.destroyed=!0,this.pause(),this.stopAnimationLoop&&(this.stopAnimationLoop(),delete this.stopAnimationLoop),(e=this.renderer)===null||e===void 0||e.setAnimationLoop(null),this.off(),this.networkSubscribe.off(),this.controller&&(this.controller.destroy(),this.controller=void 0);var o=this.getElement();o&&o.parentNode&&o.parentNode.removeChild(o);var s=this.models.getMaterial();s&&(s.pano0&&s.pano0.map.dispose(),s.pano1&&s.pano1.map!==((r=s.pano0)===null||r===void 0?void 0:r.map)&&s.pano1.map.dispose());for(var u=0,l=this.models;u<l.length;u++){var c=l[u];c.dispose()}this.models.length=0,this.models.setMaterial({pano0:null,pano1:null}),this.meshReplaceMaterialMap.forEach(function(f){f.dispose()}),this.meshOriginMaterialMap.forEach(function(f){f.dispose()}),this.renderer instanceof InternalWebGLRenderer&&this.renderer.forceContextLoss&&this.renderer.forceContextLoss()}},t.prototype.setScissor=function(e){var r;if(Object.assign(this.scissor,e),this.controller&&this.controller.updateRenderSize){var o=new THREE__namespace.Vector2;(r=this.renderer)===null||r===void 0||r.getDrawingBufferSize(o),this.controller.updateRenderSize(o)}},Object.defineProperty(t.prototype,"helperVisible",{get:function(){return this.helperGroup.visible},set:function(e){this.helperGroup.visible!==e&&(this.helperGroup.visible=e,this.emit("helpers.visible",createEvent("helpers.visible",{object:this.helperGroup})),this.needsRender=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enableIOSEDR",{get:function(){return this._enableIOSEDR},set:function(e){this._enableIOSEDR!==e&&(this._enableIOSEDR=e,this.currentMode&&this.currentMode==="Panorama"&&this.changeMode(this.currentMode,this.getCurrentState(),0,!1,!0))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"postProcessingType",{get:function(){return this.currentMode==="Panorama"&&this.enableIOSEDR&&this.enablePostProcessing?"luminance":this.currentMode==="Mapview"&&this.enableEDL?"edl":this.currentMode==="Mapview"&&this.enableHQ?"hq":null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enableEDL",{get:function(){return this._enableEDL},set:function(e){if(e===!0&&this.currentMode!==t.Mode.Mapview)throw new Error("只支持Mapview下开启EDL");this._enableEDL!==e&&(this._enableEDL=e,this.boundingMesh.visible=!e,this.needsRender=!0,this.modelSceneNeedsRender=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enableHQ",{get:function(){return this._enableHQ},set:function(e){if(e===!0&&this.currentMode!==t.Mode.Mapview)throw new Error("只支持Mapview下开启HQ");this._enableHQ!==e&&(this._enableHQ=e,this.boundingMesh.visible=!e,this.needsRender=!0,this.modelSceneNeedsRender=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enablePostProcessing",{get:function(){return this._enablePostProcessing},set:function(e){this._enablePostProcessing!==e&&(this._enablePostProcessing=e),this.needsRender=!0,this.modelSceneNeedsRender=!0},enumerable:!1,configurable:!0}),t.prototype.updateConfiguration=function(e,r){r===void 0&&(r=!0);var o=!1;e.panorama&&(Object.assign(this.controllerInits.Panorama,e.panorama),this.currentMode==="Panorama"&&(o=!0)),e.model&&(Object.assign(this.controllerInits.Model,e.model),this.currentMode==="Model"&&(o=!0)),e.floorplan&&(Object.assign(this.controllerInits.Floorplan,e.floorplan),this.currentMode==="Floorplan"&&(o=!0)),e.topview&&(Object.assign(this.controllerInits.Topview,e.topview),this.currentMode==="Topview"&&(o=!0)),e.mapview&&(Object.assign(this.controllerInits.Mapview,e.mapview),this.currentMode==="Mapview"&&(o=!0)),e.vrPanorama&&(Object.assign(this.controllerInits.VRPanorama,e.vrPanorama),this.currentMode==="VRPanorama"&&(o=!0)),e.imageOptions&&(Object.assign(this.imageOptions,e.imageOptions),(this.currentMode==="Panorama"||this.currentMode==="VRPanorama")&&(o=!0)),e.textureOptions&&Object.assign(this.textureOptions,e.textureOptions),r&&o&&this.controller&&this.currentMode&&this.changeMode(this.currentMode,this.getCurrentState(),0,!1,!0)},t.prototype.appendTo=function(e,r){if(r===void 0&&(r={}),!!this.renderer){if(!(this.renderer instanceof InternalWebGLRenderer)){this.throwError(new Error("cannot call appendTo method when render a external renderer"));return}var o=this.getElement();if(o){e.appendChild(o),this.refresh(r);var s=window.getComputedStyle(e).position;s!=="relative"&&s!=="absolute"&&s!=="fixed"&&s!=="sticky"&&(e.style.position="relative")}}},t.prototype.refresh=function(e,r){if(e===void 0&&(e={}),!!this.renderer){var o=this.getElement();if(o){var s=o.parentNode;if(s&&s.nodeName){var u=e.width,l=u===void 0?s.offsetWidth:u,c=e.height,f=c===void 0?s.offsetHeight:c;this.renderer instanceof InternalWebGLRenderer&&(r&&this.renderer.setPixelRatio(r),this.renderer.setSize(l,f))}var d=new THREE__namespace.Vector2;if(this.renderer.getDrawingBufferSize(d),this.controller&&this.controller.updateRenderSize&&this.controller.updateRenderSize(d),this.modelRenderTarget.width!==d.x||this.modelRenderTarget.height!==d.y){this.modelRenderTarget.setSize(d.x,d.y),this.modelRenderTarget.depthTexture.dispose();var p=new THREE__namespace.DepthTexture(d.x,d.y);p.generateMipmaps=!1,p.format=THREE__namespace.DepthStencilFormat,p.type=THREE__namespace.UnsignedInt248Type,this.modelRenderTarget.depthTexture=p,this.modelRenderTarget.depthTexture.needsUpdate=!0}this.needsRender=!0,this.modelSceneNeedsRender=!0,this.render(noop$1,!0)}}},t.prototype.addExtraElement=function(e){var r=this;return this.extraElements.indexOf(e)===-1&&(this.extraElements.push(e),this.controller&&this.controller.bindExtraElement(e)),function(){return r.removeExtraElement(e)}},t.prototype.removeExtraElement=function(e){var r=this.extraElements.indexOf(e);r!==-1&&(this.extraElements.splice(r,1),this.controller&&this.controller.unbindExtraElement(e))},t.prototype.getPose=function(){var e=this.camera.copyPose(),r=e.longitude,o=e.latitude,s=e.fov,u=e.offset,l=e.distance;return{longitude:r,latitude:o,fov:s,offset:u.clone(),distance:l}},t.prototype.getSize=function(e){if(!this.renderer)throw new Error("renderer is not initialized");return this.renderer.getSize(e),e.x*=this.scissor.width,e.y*=this.scissor.height,e},t.prototype.getDrawingBufferSize=function(e){if(!this.renderer)throw new Error("renderer is not initialized");return this.renderer.getDrawingBufferSize(e),e.x*=this.scissor.width,e.y*=this.scissor.height,e},t.prototype.updateCamera=function(e,r,o){if(o===void 0&&(o=!0),!this.controller)throw new Error("controller is not initialized.");return this.controller.updateCamera(e,r,o)},t.prototype.updateCameraWithKeyframes=function(e,r,o){if(o===void 0&&(o=!0),!this.controller)throw new Error("controller is not initialized.");return this.controller.updateCameraWithKeyframes(e,r,o)},t.prototype.getLongitudeAndLatitude=function(){var e=this.getPose(),r=e.longitude,o=e.latitude;return{longitude:r,latitude:o}},t.prototype.getOffset=function(){return this.getPose().offset},t.prototype.getCameraLocal=function(){if(this.pano.workCode&&this.controller&&this.works){var e=this.works.getResolvedObserver(this.pano);if(e){var r=new THREE__namespace.Object3D;return r.position.copy(e.position),r.quaternion.copy(e.quaternion),r.scale.set(1,1,1),r.matrix.compose(r.position,r.quaternion,r.scale),r.matrixAutoUpdate=!1,cameraWorldToLocal(this.camera,r)}}return null},Object.defineProperty(t.prototype,"works",{get:function(){var e=worksMap.get(this);if(!e)return emptyWorks;for(var r=0,o=e;r<o.length;r++){var s=o[r];if(!workRawMapping.has(s))return emptyWorks}return e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"work",{get:function(){return this.works[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"model",{get:function(){return this.models[0]},enumerable:!1,configurable:!0}),t.prototype.load=function(e,r,o,s){var u=this;if(s===void 0&&(s=!0),!this.renderer)throw new Error("renderer is not initialized");var l=this.lastLoadWorkTask.then(function(){return isPromise(e)?e.then(function(c){return u.load_(c,r,o,s)}):u.load_(e,r,o,s)});return this.lastLoadWorkTask=l.catch(function(c){u.throwError(c)}),l},t.prototype.load_=function(e,r,o,s){var u=this,l,c,f,d,p,v,g,h;s===void 0&&(s=!0);var m={};typeof o=="number"?m.duration=o:typeof o=="object"&&Object.assign(m,o),this.works===emptyWorks&&(m.duration===void 0&&(m.duration=0),m.effect===void 0&&(m.effect="instant"));var y=[];if(Array.isArray(e))for(var A=0,E=e;A<E.length;A++){var b=E[A];typeof b!="string"&&"work"in b?y.push(parseWork(b.work,b)):y.push(parseWork(b))}else y.push(parseWork(e));for(var T=createWorks(y),_=function(J){var X=R,W=new Fetcher({allowHosts:J.allowHosts,get requestProxy(){return X.requestProxy},get networkSubscribe(){return X.networkSubscribe}});registerFetcher(J,W)},R=this,S=0,M=T;S<M.length;S++){var B=M[S];_(B)}this.lastWorks=this.works,r===void 0&&(r="inherit"),r==="inherit"&&this.lastWorks.length===0&&(r="initial");var H=T.initial,w=H.work.observers[0],C=w?{workCode:w.work.workCode,panoIndex:w.panoIndex}:{workCode:H.work.workCode,panoIndex:0},L=(l=H.mode)!==null&&l!==void 0?l:w?"Panorama":"Mapview",I={};if(r==="inherit"){L=this.currentMode;var F=T.resolvedObservers[this.panoIndex];F?C={workCode:F.work.workCode,panoIndex:F.panoIndex}:typeof T.initial.panoIndex=="number"?C={workCode:T.initial.work.workCode,panoIndex:T.initial.panoIndex}:(L==="Panorama"||L==="VRPanorama"||L==="XRPanorama")&&(L="Mapview"),I={longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude,fov:this.camera.pose.fov,distance:void 0,offset:void 0}}else if(r==="initial")typeof H.panoIndex=="number"&&(C={workCode:H.work.workCode,panoIndex:H.panoIndex}),H.mode&&(L=H.mode),I={longitude:H.longitude,latitude:H.latitude,fov:H.fov,distance:H.distance,offset:(c=H.offset)===null||c===void 0?void 0:c.clone()};else{if(L=(f=r.mode)!==null&&f!==void 0?f:this.currentMode,typeof r.panoIndex=="number"){var F=T.getResolvedObserver({workCode:(p=(d=r.workCode)!==null&&d!==void 0?d:H.work.workCode)!==null&&p!==void 0?p:"",panoIndex:r.panoIndex});F&&(C={workCode:F.work.workCode,panoIndex:F.panoIndex})}I={longitude:r.longitude,latitude:r.latitude,fov:r.fov,distance:r.distance,offset:r.offset}}var k=__assign(__assign(__assign({},C),{mode:L}),I),N=(v=m.duration)!==null&&v!==void 0?v:this.modeChangeDuration;(L==="Floorplan"||L==="Topview"||L==="Mapview")&&this.currentMode===L&&(N=0);var D="fly";(L==="Panorama"||L==="VRPanorama"||L==="XRPanorama")&&this.currentMode===L&&(D=(g=m.effect)!==null&&g!==void 0?g:"fade"),this.emit("works.request",createEvent("works.request",{input:e,works:T,state:k,userAction:s}));var U=function(){u.modelGroup.visible=!0,u.pano=C;var J=__assign(__assign({initial:{state:k,currentState:u.getCurrentState(),duration:N,effect:D,userAction:s}},u.commonParams()),u.controllerInits[L]),X=Controllers[L].initAnimationEndState(J);if(u.controller&&u.currentMode===L)u.controller.updateWork(T,X,{effect:D,duration:N},s)===!1&&(u.controller.destroy(),u.controller=u.applyController(L,J));else{var W=u.currentMode;if(u.controller)u.controller.destroy();else{var j=Controllers[L].initAnimationEndState(J);u.camera.setFromPose(j),u.emit("camera.update",createEvent("camera.update",{state:u.getCurrentState(),userAction:s}))}u.controller=u.applyController(L,J);var te=createEvent("mode.change",{prevMode:W,mode:L,state:X,userAction:s});u.emit("mode.change",te)}};worksMap.set(this,T),this.updateConfiguration(m,!1);var Q=Promise.resolve();if(L===t.Mode.Floorplan||L===t.Mode.Topview||L===t.Mode.Mapview||L===t.Mode.Model)this.models.loaded===!1&&(this.camera.setFromPose(k),assignPose(this.state,this.camera.pose)),Q=this.loadModel(T,m).then(function(){u.needsRender=!0,u.modelSceneNeedsRender=!0,U(),u.emit("camera.update",createEvent("camera.update",{state:u.getCurrentState(),userAction:s}))});else{U();var q=!1,G=function(){u.works===T&&q===!1&&(u.needsRender=!0,u.modelSceneNeedsRender=!0,u.emit("camera.update",createEvent("camera.update",{state:u.getCurrentState(),userAction:s})),u.loadModel(T,m),q=!0)};this.controller.once("pano.arrived",G),this.controller.once("pano.cancel",G),setTimeout(G,((h=m.duration)!==null&&h!==void 0?h:this.modeChangeDuration)+1e3)}return this.emit("works.load",createEvent("works.load",{input:e,state:this.getCurrentState(),userAction:s,works:T})),Q.then(function(){return u.ready()}).then(function(){var J;u.emit("works.ready",createEvent("works.ready",{input:e,state:u.getCurrentState(),userAction:s,works:T})),(J=u.analysis)===null||J===void 0||J.work(T)})},t.prototype.reset=function(){var e=this,r=this.lastLoadWorkTask.then(function(){return e.reset_()});return this.lastLoadWorkTask=r.catch(function(o){e.throwError(o)}),r},t.prototype.reset_=function(){var e=this;return new Promise(function(r){var o;e.controller&&e.resetController();var s=e.models.getMaterial();s&&(s.pano0&&s.pano0.map.dispose(),s.pano1&&s.pano1.map!==((o=s.pano0)===null||o===void 0?void 0:o.map)&&s.pano1.map.dispose()),e.models.setMaterial({pano0:null,pano1:null,modelAlpha:1}),e.lastModels.setMaterial({pano0:null,pano1:null,modelAlpha:1}),e.renderer&&(e.models.update(e.renderer,e.camera,e.currentMode),e.lastModels.update(e.renderer,e.camera,e.currentMode),e.model&&e.boundingMesh.update(e.renderer,e.camera,e.model));for(var u=0,l=e.models;u<l.length;u++){var c=l[u];e.lastModels.push(c)}if(e.models.length=0,e.lastModels.length>0){for(var f=0,d=e.lastModels;f<d.length;f++){var c=d[f];e.modelGroup.remove(c),c.dispose(),e.needsRender=!0,e.modelSceneNeedsRender=!0}e.lastModels.length=0}e.lastWorks&&delete e.lastWorks,worksMap.delete(e),e.currentMode="Mapview",e.pano={workCode:"",panoIndex:0},e.camera.setFromPose({distance:0,fov:DEFAULT_CAMERA_FOV,longitude:0,latitude:0,offset:new THREE__namespace.Vector3(0,0,0)}),e.state={mode:e.currentMode,workCode:e.pano.workCode,panoIndex:e.pano.panoIndex,longitude:e.camera.pose.longitude,latitude:e.camera.pose.latitude,fov:e.camera.pose.fov,offset:e.camera.pose.offset.clone(),distance:e.camera.pose.distance},e.models.needsRender=!1,e.camera.needsRender=!1,e.needsRender=!1,e.modelSceneNeedsRender=!1,r()})},t.prototype.changeMode=function(e,r,o,s,u){var l=this;return r===void 0&&(r={}),s===void 0&&(s=!0),u===void 0&&(u=!1),new Promise(function(c,f){var d,p,v,g;if(!l.renderer)throw new Error("renderer is not initialized.");r=__assign({},r);var h=0;l.controller&&(typeof o=="number"?h=o:h=(d=o==null?void 0:o.duration)!==null&&d!==void 0?d:l.modeChangeDuration);var m="fly";l.controller&&typeof o=="object"&&o.effect&&(m=o.effect);var y=typeof r.panoIndex=="number"?{workCode:(g=(p=r.workCode)!==null&&p!==void 0?p:(v=l.work)===null||v===void 0?void 0:v.workCode)!==null&&g!==void 0?g:"",panoIndex:r.panoIndex}:l.pano;if(!t.Mode.hasOwnProperty(e)){var A=new Error('mode "'.concat(e,'" is not existed'));l.throwError(A),f(A);return}if((e===t.Mode.Panorama||e===t.Mode.VRPanorama||e===t.Mode.XRPanorama)&&!l.works.getResolvedObserver(y)){var A=new Error("PanoId ".concat(panoStringify(y)," not existed."));l.throwError(A),f(A);return}(e===t.Mode.Floorplan||e===t.Mode.Topview||e===t.Mode.Mapview||e===t.Mode.Model)&&(l.models.loaded||(h=0));var E=l.controller,b=l.currentMode,T=function(){if(l.controller&&l.controller.stopMomentumMovement(),l.controller&&u===!1&&b===e)e===t.Mode.Panorama||e===t.Mode.Model||e===t.Mode.VRPanorama||e===t.Mode.XRPanorama?panoEqual(l.pano,y)&&"moveToPano"in l.controller&&typeof l.controller.moveToPano=="function"?l.controller.moveToPano(y,__assign({duration:h},r),s):l.controller.updateCamera(r,h,s).catch(noop$1):(panoEqual(l.pano,y)||(l.pano=y),l.controller.updateCamera(r,h,s).catch(noop$1));else{var R=__assign(__assign({},r),y),S=__assign(__assign({initial:{state:R,currentState:l.getCurrentState(),duration:h,effect:m,userAction:s}},l.commonParams()),l.controllerInits[e]),M=Controllers[e].initAnimationEndState(S),B=createEvent("mode.change.request",{prevMode:l.currentMode,mode:e,state:M,userAction:s});if(l.emit("mode.change.request",B),!B.defaultPrevented){E&&E.destroy(),l.controller=l.applyController(e,S);var H=createEvent("mode.change",{prevMode:l.currentMode,mode:e,state:M,userAction:s});l.emit("mode.change",H)}}c()};if(e===t.Mode.VRPanorama)l.requestFullscreen(),requestDeviceOrientationPermission().then(function(){return T()}).catch(function(R){R instanceof Error&&(l.exitFullscreen(),l.throwError(R),f(R))});else if(e===t.Mode.XRPanorama){var _=AnimationFrameLoop.shared.getContext();_?_.end():requestXRSessionPermission().then(function(R){AnimationFrameLoop.shared.setContext(R),T()}).catch(function(R){R instanceof Error&&(l.throwError(R),f(R))})}else T()})},t.prototype.getPixels=function(e,r,o,s,u,l,c){if(!this.renderer)throw new Error("renderer is not initialized.");var f=this.renderer.getPixelRatio(),d=this.renderer.getRenderTarget(),p=this.renderer.getSize(new THREE__namespace.Vector2),v=0,g=0,h=1,m=1,y,A,E,b,T;typeof e=="number"?(v=e,typeof r=="number"&&(g=r),typeof o=="number"&&(h=o),typeof s=="number"&&(m=s),y=u,A=l,T=c):(v=e.x,g=e.y,h=e.width,m=e.height,y=e.pixelRatio,A=e.flipY,E=e.helperVisible,b=e.skipPanorama,T=e.buffer),v=Math.ceil(v),g=Math.ceil(g),h=Math.ceil(h),m=Math.ceil(m),y=Math.ceil(y!=null?y:f),A=A!=null?A:!1;var _=this.getPixelsRenderTarget;_.setSize(h*y,m*y),this.renderer.setRenderTarget(_),this.camera.pixelRatio=y,this.camera.resolution.set(h,m),this.camera.setViewOffset(p.width,p.height,v,p.height-g-m,h,m);for(var R=0,S=this.scene.children;R<S.length;R++){var M=S[R];M instanceof THREE__namespace.Object3D&&M.traverseVisible(function(J){J.setResolution&&J.setResolution(h*y/f,m*y/f)})}this.models.autoUpdate=!1;var B=!0,H=0;b&&(this.controller instanceof Controllers.Panorama||this.controller instanceof Controllers.VRPanorama||this.controller instanceof Controllers.XRPanorama)&&(B=this.controller.tiling.object.visible,this.controller.tiling.object.visible=!1,H=this.models.getMaterial().modelAlpha,this.models.setMaterial({modelAlpha:b===!0?1:H}));var w=this.helperVisible;E===!1&&(this.helperVisible=!1),this.models.update(this.renderer,this.camera,this.currentMode),this.controller?(this.controller.updateRenderSize(new THREE__namespace.Vector2(h*y,m*y)),this.controller.render(!0,this.postProcessingType)):(this.renderer.render(this.scene,this.camera),this.renderer.autoClearDepth=!1,this.renderer.autoClearColor=!1,this.renderer.render(this.modelScene,this.camera),this.renderer.autoClearDepth=!0,this.renderer.autoClearColor=!0),this.helperVisible=w,b&&(this.controller instanceof Controllers.Panorama||this.controller instanceof Controllers.VRPanorama||this.controller instanceof Controllers.XRPanorama)&&(this.controller.tiling.object.visible=B,this.models.setMaterial({modelAlpha:H})),this.models.update(this.renderer,this.camera,this.currentMode),this.models.autoUpdate=!0;var C=h*y,L=m*y,I=C*L,F=I*4,k;try{if(T){if(T.length!==F)throw new Error("buffer length is not equals pixels ".concat(F))}else T=new Uint8Array(F);if(this.renderer.readRenderTargetPixels(_,0,0,h*y,m*y,T),A)for(var N=I/2,D=0,U=0,Q=0,q=0;U<N;U++)for(q=(L-Math.floor(U/C)-1)*C+U%C,Q=0;Q<4;Q++)D=T[U*4+Q],T[U*4+Q]=T[q*4+Q],T[q*4+Q]=D}catch(J){k=J}if(this.renderer.setRenderTarget(d),this.controller&&this.controller.updateRenderSize){var G=new THREE__namespace.Vector2;this.renderer.getDrawingBufferSize(G),this.controller.updateRenderSize(G)}if(this.camera.clearViewOffset(),this.camera.pixelRatio=f,this.getSize(this.camera.resolution),this.camera.aspect=this.camera.resolution.width/this.camera.resolution.height,k)throw k;return T},t.prototype.getElement=function(){var e;return(e=this.renderer)===null||e===void 0?void 0:e.domElement},Object.defineProperty(t.prototype,"observers",{get:function(){return this.works.resolvedObservers},enumerable:!1,configurable:!0}),t.prototype.render=function(e,r){var o=this;if(r===void 0&&(r=!1),!this.renderer)return null;if(r){var s=this.renderer.getSize(sharedVector2);this.scene.traverseVisible(function(u){u.setResolution&&u.setResolution(s.x,s.y)})}return this.aroundScissor(function(){o.renderer&&(o.controller?(o.controller.render(o.onlyRenderIfNeeds?o.modelSceneNeedsRender:!0,o.postProcessingType),o.info={memory:__assign({},o.controller.renderer.info.memory),render:__assign({},o.controller.renderer.info.render)}):(o.renderer.render(o.scene,o.camera),o.info={memory:__assign({},o.renderer.info.memory),render:__assign({},o.renderer.info.render)}),o.poweredByRealsee&&o.currentMode!=="VRPanorama"&&o.currentMode!=="XRPanorama"&&o.renderer.getRenderTarget()!==o.getPixelsRenderTarget&&renderPoweredByRealsee(o.renderer)),e&&AnimationFrameLoop.shared.add(e,!0)}),null},t.prototype.updateTime=function(e,r){for(var o,s=this,u=[],l=2;l<arguments.length;l++)u[l-2]=arguments[l];if(!this.destroyed){if(this.works.update(),this.syncingState=this.syncState(e,r),this.controller&&(o=this.controller).updateTime.apply(o,__spreadArray([e,r],u,!1)),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.updateTime(e),this.renderer){ktx2.detectSupport(this.renderer);var c=this.models.loaded,f=this.models.refined;if(this.models.update(this.renderer,this.camera,this.currentMode),this.camera.autoNearFar){var d=this.models.bounding.getBoundingSphere(sharedSphere),p=d.radius*2;d.containsPoint(this.camera.position)||(p=this.camera.position.distanceTo(d.center)+d.radius),p=clamp$1(p,800,5e4),this.camera.far!==p&&(this.camera.far=p);var v=p/1e4;v=clamp$1(v,.03,.1),this.camera.near!==v&&(this.camera.near=v)}if(c===!1&&this.models.loaded===!0&&this.emit("models.load",createEvent("models.load",{models:this.models})),f===!1&&this.models.refined===!0&&this.emit("models.refined",createEvent("models.refined",{models:this.models})),this.models.loaded){for(var g=0,h=this.models;g<h.length;g++){var m=h[g];m.parent!==this.modelGroup&&(this.modelGroup.add(m),this.needsRender=!0,this.modelSceneNeedsRender=!0)}if(this.lastModels.length>0){for(var y=0,A=this.lastModels;y<A.length;y++){var m=A[y];this.modelGroup.remove(m),m.dispose(),this.needsRender=!0,this.modelSceneNeedsRender=!0}this.lastModels.length=0}this.lastWorks&&delete this.lastWorks}this.lastModels.setMaterial(this.models.getMaterial()),this.lastModels.materialVersion=this.models.materialVersion,this.lastModels.update(this.renderer,this.camera,this.currentMode)}this.syncingState=!1;var E=new THREE__namespace.Vector2(512,512),b=new THREE__namespace.Vector2(512,512);this.renderer&&(this.renderer.getSize(E),E.x*=this.scissor.width,E.y*=this.scissor.height,this.renderer.getDrawingBufferSize(b),b.x*=this.scissor.width,b.y*=this.scissor.height);{for(var T=new THREE__namespace.Box3,_=new THREE__namespace.Box3,R=new THREE__namespace.Vector3(4,4,4),S=0,M=this.works.resolvedObservers;S<M.length;S++){var B=M[S];_.setFromCenterAndSize(B.position,R),T.union(_)}if(T.union(this.models.bounding),this.lastWorks)for(var H=0,w=this.lastWorks.resolvedObservers;H<w.length;H++){var B=w[H];_.setFromCenterAndSize(B.position,R),T.union(_)}T.union(this.lastModels.bounding),T.getCenter(this.boundingMesh.position),T.getSize(this.boundingMesh.scale),this.boundingMesh.boundingBox.copy(T),this.renderer&&this.model&&this.boundingMesh.update(this.renderer,this.camera,this.model)}var C=createEvent("render.prepare",{needsRender:!0,info:null});if(this.emit("render.prepare",C),!C.defaultPrevented){var L=[];sharedProjScreenMatrix.multiplyMatrices(this.camera.projectionMatrix,this.camera.matrixWorldInverse),sharedFrustum.setFromProjectionMatrix(sharedProjScreenMatrix);for(var I=0,F=this.scene.children;I<F.length;I++){var k=F[I];k!==this.modelGroup&&k!==this.boundingMesh&&k.traverseVisible(function(G){if(G.setResolution&&G.setResolution(E.x,E.y),G.setTime&&G.setTime(e),G.mixer instanceof THREE__namespace.AnimationMixer){var J=clockForMixer.get(G.mixer);J||(J=new THREE__namespace.Clock,clockForMixer.set(G.mixer,J)),G.mixer.update(J.getDelta())}(G instanceof THREE__namespace.Mesh||G instanceof THREE__namespace.Line||G instanceof THREE__namespace.Points)&&(G instanceof THREE__namespace.ImmediateRenderObject||!G.frustumCulled||sharedFrustum.intersectsObject(G))&&L.push(G)})}if(b.width*b.height>4096*2048?this.renderSwitch01=this.renderSwitch01^1:this.renderSwitch01=0,this.renderer&&this.paused===!1&&this.renderSwitch01===0){var N=void 0;if(this.onlyRenderIfNeeds!==!0)N=this.render();else{if(this.controller&&(this.controller.needsRender===!0&&(this.controller.needsRender=!1,this.needsRender=!0),this.controller.modelSceneNeedsRender===!0&&(this.controller.modelSceneNeedsRender=!1,this.modelSceneNeedsRender=!0)),this.camera.needsRender===!0&&(this.camera.needsRender=!1,this.needsRender=!0,this.modelSceneNeedsRender=!0),this.models.needsRender===!0&&(this.models.needsRender=!1,this.needsRender=!0,this.modelSceneNeedsRender=!0),this.needsRender!==!0)for(var D=0,U=L;D<U.length;D++){var Q=U[D],q=function(G){G.needsRender===!0?(G.needsRender=!1,s.needsRender=!0):G.mixer&&G.mixer.stats.actions.inUse>0&&(s.needsRender=!0)};q(Q),Q.traverseAncestors(q)}(this.needsRender!==!1||this.modelSceneNeedsRender!==!1)&&(N=this.render())}this.needsRender=!1,this.modelSceneNeedsRender=!1,this.hasListener("render")&&this.emit("render",createEvent("render",{needsRender:N!==void 0,info:this.info}))}this.needsRender=!1,this.modelSceneNeedsRender=!1}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)}},t.prototype.pause=function(){this.paused=!0,this.renderer&&this.renderer instanceof InternalWebGLRenderer&&this.renderer.clear(!0,!0,!0)},t.prototype.play=function(){this.needsRender=!0,this.modelSceneNeedsRender=!0,this.paused=!1},t.prototype.moveToPano=function(e,r,o){r===void 0&&(r={}),o===void 0&&(o=!0);var s=this,u=s.controller,l=s.renderer;if(!u)return this.throwError(new Error("controller is not initialized.")),Promise.resolve();if(!l)return this.throwError(new Error("renderer is not initialized.")),Promise.resolve();var c=this.works.getResolvedObserver(e);if(!c)return this.throwError(new Error("pano ".concat(JSON.stringify(e)," not existed."))),Promise.resolve();var f={workCode:c.work.workCode,panoIndex:c.panoIndex};return"moveToPano"in u&&typeof u.moveToPano=="function"?u.moveToPano(f,r,o):c&&(this.pano=f,this.once("initAnimation.start",function(d){r.moveStartCallback&&r.moveStartCallback(d.state)}),this.once("initAnimation.end",function(d){r.moveEndCallback&&r.moveEndCallback(d.state)}),this.changeMode(t.Mode.Panorama,r,{effect:r.effect},o)),this.ready()},t.prototype.preloadPano=function(e,r){var o=this;r===void 0&&(r=noop$1);var s=this.works.getResolvedObserver(e);if(!s)return Promise.reject(new Error("Pano ".concat(JSON.stringify(e)," never found")));var u=["right","left","up","down","front","back"],l=now();return Promise.all(u.map(function(c){var f=__assign({key:"pano.".concat(s.panoId,".").concat(c)},pick(o.imageOptions,["size","format","quality","mappings"])),d=s.images[c],p=o.imageOptions.transform?o.imageOptions.transform(d,f):imageURL(d,f);return getFetcher(s.work).preload(p)})).then(function(){var c=now()-l;return r(c),c})},t.prototype.project2d=function(e,r){if(r===void 0&&(r=!1),!this.renderer)return null;if(this.models.length>0&&r){var o=this.camera.position,s=e.clone().sub(o),u=new THREE__namespace.Raycaster(o,s.clone().normalize());u.params.Points={threshold:.1};var l=this.models.intersectRaycaster(u)[0];if(l&&l.distance+.01<s.length())return null}var c=e.clone().project(this.camera);if(Math.abs(c.z)>1)return null;var f=this.renderer.getSize(new THREE__namespace.Vector2),d=f.x*this.scissor.width,p=f.y*this.scissor.height,v=f.x*this.scissor.left+(c.x+1)/2*d,g=f.y*(1-this.scissor.bottom-this.scissor.height)+(-c.y+1)/2*p;return new THREE__namespace.Vector2(v,g)},t.prototype.getRenderObjects=function(e){sharedProjScreenMatrix.multiplyMatrices(this.camera.projectionMatrix,this.camera.matrixWorldInverse),sharedFrustum.setFromProjectionMatrix(sharedProjScreenMatrix),e||(e=this.scene);var r=[];return e.traverseVisible(function(o){(o instanceof THREE__namespace.Mesh||o instanceof THREE__namespace.Line||o instanceof THREE__namespace.Points)&&(o instanceof THREE__namespace.ImmediateRenderObject||!o.frustumCulled||sharedFrustum.intersectsObject(o))&&r.push(o)}),r},t.prototype.getCurrentState=function(){return __assign(__assign({},this.getPose()),{mode:this.currentMode,workCode:this.pano.workCode,panoIndex:this.pano.panoIndex})},t.prototype.setState=function(e,r,o){var s,u,l,c,f,d,p,v,g,h;r===void 0&&(r=!1),o===void 0&&(o=!0),e=Object.assign({},e),e.offset&&!(e instanceof THREE__namespace.Vector3)&&(e.offset=new THREE__namespace.Vector3(e.offset.x,e.offset.y,e.offset.z));var m;typeof e.panoIndex=="number"&&(e.workCode?m={workCode:e.workCode,panoIndex:e.panoIndex}:m={workCode:(u=(s=this.work)===null||s===void 0?void 0:s.workCode)!==null&&u!==void 0?u:"",panoIndex:e.panoIndex});var y=(l=e.mode)!==null&&l!==void 0?l:this.state.mode,A,E,b,T,_;if(this.controller&&this.controller.stopMomentumMovement(),this.state.mode!==y){if(y==="VRPanorama"){this.changeMode("VRPanorama",void 0,void 0,!0);return}var R={workCode:m==null?void 0:m.workCode,panoIndex:m==null?void 0:m.panoIndex};typeof e.longitude=="number"&&(R.longitude=e.longitude),typeof e.latitude=="number"&&(R.latitude=e.latitude),typeof e.fov=="number"&&(R.fov=e.fov),typeof e.distance=="number"&&(R.distance=e.distance),e.offset instanceof THREE__namespace.Vector3&&(R.offset=e.offset);var S=__assign(__assign({initial:{state:R,currentState:this.getCurrentState(),duration:this.modeChangeDuration,effect:"fly",userAction:!1}},this.commonParams()),this.controllerInits[y]),M=Controllers[y].initAnimationEndState(S);A=M.longitude,E=M.latitude,b=M.fov,T=M.offset,_=M.distance}else A=(c=e.longitude)!==null&&c!==void 0?c:this.state.longitude,E=(f=e.latitude)!==null&&f!==void 0?f:this.state.latitude,b=(d=e.fov)!==null&&d!==void 0?d:this.state.fov,T=(p=e.offset)!==null&&p!==void 0?p:this.state.offset,_=(v=e.distance)!==null&&v!==void 0?v:this.state.distance;var B={workCode:(m!=null?m:this.pano).workCode,panoIndex:(m!=null?m:this.pano).panoIndex,mode:y,longitude:A,latitude:E,fov:b,offset:T,distance:_};this.emit("state.set",createEvent("state.set",{userAction:o,state:B})),stateEqual(this.state,B)||(this.controller&&B.mode==="VRPanorama"&&B.mode!==this.state.mode?(assignState(this.state,B),this.changeMode("VRPanorama")):this.controller&&B.mode==="XRPanorama"&&B.mode!==this.state.mode?(assignState(this.state,B),this.changeMode("XRPanorama")):(assignState(this.state,B),this.controller&&o&&(this.controller.userAction=!1),r&&this.state.mode===B.mode&&(this.syncingState=this.syncState(now(),0,r),this.syncingState&&((g=this.controller)===null||g===void 0||g.updateTime(now(),0),this.syncingState=!1)),this.emit("state.change",createEvent("state.change",{userAction:o,state:this.state})),(h=this.analysis)===null||h===void 0||h.state(this.works,this.state)))},t.prototype.aroundScissor=function(e){if(this.renderer){if(this.state.mode==="XRPanorama"){e();return}var r=new THREE__namespace.Vector2,o=this.scissor.left!==0||this.scissor.bottom!==0||this.scissor.width!==1||this.scissor.height!==1;if(o){this.renderer.getSize(r);var s=Math.floor(r.x*this.scissor.left),u=Math.floor(r.y*this.scissor.bottom),l=Math.floor(r.x*this.scissor.width),c=Math.floor(r.y*this.scissor.height);this.renderer.setViewport(s,u,l,c),this.renderer.setScissor(s,u,l,c),this.renderer.setScissorTest(!0)}e(),o&&(this.renderer.setViewport(0,0,r.x,r.y),this.renderer.setScissor(0,0,r.x,r.y),this.renderer.setScissorTest(!1))}},t.prototype.syncState=function(e,r,o){o===void 0&&(o=!1);var s=this.stateSynced;if(this.stateSynced=!1,!this.controller)return!1;if(this.state.mode!==this.currentMode){var u={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,u,this.modeChangeDuration,this.controller.userAction),!0}if(!this.controller.isReady())return!1;if(this.controller instanceof Controllers.Model){if(notSimilarVector3(this.camera.pose.offset,this.state.offset)){var l={longitude:this.state.longitude,latitude:this.state.latitude,fov:this.state.fov,offset:this.state.offset};return this.controller.moveToPosition(this.state.offset,__assign(__assign({},l),{duration:o?0:void 0}),!1),!0}}else{var c={workCode:this.state.workCode,panoIndex:this.state.panoIndex};if(!panoEqual(c,this.pano)&&"moveToPano"in this.controller&&typeof this.controller.moveToPano=="function"){var l={longitude:this.state.longitude,latitude:this.state.latitude,fov:this.state.fov,offset:this.state.offset,distance:this.state.distance};return this.controller.moveToPano(c,l,!1),!0}}if(this.controller instanceof Controllers.Floorplan||this.controller instanceof Controllers.Topview||this.controller instanceof Controllers.Mapview){var f=1,d=.2,p=.2,v=Math.PI/45,g=o?this.state.fov:stepNumber(this.camera.pose.fov,this.state.fov,f),h=Math.abs(this.camera.pose.distance-this.state.distance),m=h>p*15?h/15:d,y=o?this.state.distance:stepNumber(this.camera.pose.distance,this.state.distance,m),A=this.camera.pose.offset.distanceTo(this.state.offset),E=A>p*15?A/15:p,b=o?new THREE__namespace.Vector3().copy(this.state.offset):stepVector(this.camera.pose.offset,this.state.offset,E),T=o?{longitude:this.state.longitude,latitude:this.state.latitude}:stepCoordinates({longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude},{longitude:this.state.longitude,latitude:this.state.latitude},v),_=T.longitude,R=T.latitude;if(notSimilarValue(g,this.camera.pose.fov)||notSimilarVector3(b,this.camera.pose.offset)||notSimilarValue(y,this.camera.pose.distance)||notSimilarValue(_,this.camera.pose.longitude,Math.PI*2)||notSimilarValue(R,this.camera.pose.latitude)){var S={x:b.x,y:b.y,z:b.z},M={fov:g};return Object.assign(S,{distance:y}),Object.assign(M,{longitude:_,latitude:R}),this.controller.stopMomentumMovement(),this.controller.cameraMotion.set(M,0).catch(noop$1),this.controller.locationMotion.set(S,0).catch(noop$1),!0}}else{var B=1,H=Math.PI/45,g=o?this.state.fov:stepNumber(this.camera.pose.fov,this.state.fov,B),w=o?{longitude:this.state.longitude,latitude:this.state.latitude}:stepCoordinates({longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude},{longitude:this.state.longitude,latitude:this.state.latitude},H),_=w.longitude,R=w.latitude,y=this.state.distance,b=new THREE__namespace.Vector3().copy(this.state.offset);if(notSimilarValue(y,this.camera.pose.distance)&&(this.state.distance=this.camera.pose.distance),notSimilarVector3(b,this.camera.pose.offset)&&(this.state.offset=this.camera.pose.offset.clone()),notSimilarValue(_,this.camera.pose.longitude,Math.PI*2)||notSimilarValue(R,this.camera.pose.latitude)||notSimilarValue(g,this.camera.pose.fov))return this.controller.stopMomentumMovement(),this.controller.cameraMotion.set({longitude:_,latitude:R,fov:g},0).catch(noop$1),!0}if(this.stateSynced=!0,s===!1&&this.emit("state.synced",createEvent("state.synced",{userAction:!1,state:this.state})),this.readyCallbacks.length&&this.stateSynced){var C=this.currentMode,L=C===t.Mode.Floorplan||C===t.Mode.Topview||C===t.Mode.Mapview||C===t.Mode.Model;if(!L||this.models.loaded){var I=this.readyCallbacks.slice();this.readyCallbacks.length=0;for(var F=0,k=I;F<k.length;F++){var N=k[F];this.controller instanceof Controllers.Panorama&&N.tile===!0&&!this.controller.isTileReady()?this.readyCallbacks.push(N):N()}}}return!1},t.prototype.ready=function(e){var r=this;return e===void 0&&(e={}),new Promise(function(o){var s;r.readyCallbacks.push(Object.assign(o,{tile:(s=e.tile)!==null&&s!==void 0?s:!1}))})},t.prototype.requestFullscreen=function(){var e;if(isMobile){var r=(e=this.getElement())===null||e===void 0?void 0:e.parentNode;r&&"requestFullscreen"in r&&typeof document!="undefined"&&document.fullscreenElement===null&&r.requestFullscreen()}},t.prototype.exitFullscreen=function(){typeof document!="undefined"&&document.fullscreenElement&&"exitFullscreen"in document&&document.exitFullscreen()},t.prototype.throwError=function(e){this.hasListener("error")?this.emit("error",e):console.error(e)},t.prototype.loadModel=function(e,r){for(var o=this,s=[],u=function(y){var A=l.models.filter(function(b){var T;return((T=b.work)===null||T===void 0?void 0:T.workCode)===y.workCode})[0];if(A)A.work=y,s.push(A);else{var E=new Model({onError:function(b){o.emit("model.error",createEvent("model.error",{work:y,model:E,error:b})),o.throwError(b)},onShownFloorChange:function(b){o.emit("model.changeShownFloor",createEvent("model.changeShownFloor",{work:y,model:E,error:null}))},onLoad:function(){o.emit("model.load",createEvent("model.load",{work:y,model:E,error:null}))}});s.push(E),l.emit("model.request",createEvent("model.request",{work:y,model:E,error:null})),E.load(y,{textureOptions:l.textureOptions,"3d-tiles":r["3d-tiles"]})}},l=this,c=0,f=e;c<f.length;c++){var d=f[c];u(d)}if(this.models.length>0){for(var p=0,v=this.models;p<v.length;p++){var g=v[p];s.indexOf(g)===-1&&this.lastModels.push(g)}this.models.length=0}for(var h=0,m=s;h<m.length;h++){var g=m[h];this.models.push(g)}return this.renderer&&(this.models.loaded=!1),new Promise(function(y){o.on("models.load",function(){o.controller&&o.controller.updateModel(o.models),y()})})},t.prototype.commonParams=function(){return{ident:this.ident,scene:this.scene,xrCustomObjectsScene:this.xrCustomObjectsScene,helper:this.helperGroup,boundingMesh:this.boundingMesh,camera:this.camera,renderer:this.renderer,scissor:this.scissor,element:this.getElement(),models:this.models,works:this.works,imageOptions:this.imageOptions,enableWheel:this.enableWheel,enableIOSEDR:this._enableIOSEDR,enableEDL:this.enableEDL,enableHQ:this.enableHQ,extraElements:this.extraElements,videoTexture:this.videoTexture,modelScene:this.modelScene,modelRenderTarget:this.modelRenderTarget}},t.prototype.resetController=function(){this.controller&&(this.controller.destroy(),this.controller=void 0);var e="Mapview";this.renderer&&(this.controller=this.applyController(e,__assign(__assign({initial:{state:{distance:10,latitude:Math.PI/4,longitude:Math.PI/4,offset:new THREE__namespace.Vector3(0,0,0)},currentState:this.getCurrentState(),duration:0,effect:"fade",userAction:!0}},this.commonParams()),this.controllerInits[e])))},t.prototype.applyController=function(e,r){var o=this;if(!this.renderer)throw new Error("renderer is not initialized.");e!==t.Mode.Mapview&&(this.enableEDL=!1,this.enableHQ=!1);var s=Controllers[e];this.currentMode=e;for(var u=new s(r),l=function(g){u.on(g,function(){for(var h=[],m=0;m<arguments.length;m++)h[m]=arguments[m];var y=o.emit.apply(o,__spreadArray([g],h,!1));if(y)return!1})},c=0,f=PROXY_CONTROLLER_EVENT_NAMES;c<f.length;c++){var d=f[c];l(d)}{var p=Controllers[e].initAnimationEndState(r),v=r.initial.userAction;stateEqual(this.state,p)||(assignState(this.state,p),this.emit("state.change",createEvent("state.change",{userAction:v,state:this.state}))),this.emit("currentState.change",createEvent("currentState.change",{userAction:v,state:this.getCurrentState()}))}return u.on("camera.update",function(g){var h;if(o.controller){var m=o.controller.getTargetState();g.userAction&&o.syncingState===!1&&o.state.mode===m.mode&&!stateEqual(o.state,m)&&(assignState(o.state,m),o.emit("state.change",createEvent("state.change",{userAction:g.userAction,state:o.state})),(h=o.analysis)===null||h===void 0||h.state(o.works,o.state))}o.emit("currentState.change",createEvent("currentState.change",{userAction:g.userAction,state:o.getCurrentState()}))}),u.on("initAnimation.start",function(g){var h,m=g.state,y=g.userAction;y&&o.state.mode===m.mode&&!stateEqual(o.state,m)&&(assignState(o.state,m),o.emit("state.change",createEvent("state.change",{userAction:y,state:o.state})),(h=o.analysis)===null||h===void 0||h.state(o.works,o.state))}),u.on("initAnimation.end",function(g){var h,m=g.state,y=g.userAction;y&&o.state.mode===m.mode&&!stateEqual(o.state,m)&&(assignState(o.state,m),o.emit("state.change",createEvent("state.change",{userAction:y,state:o.state})),(h=o.analysis)===null||h===void 0||h.state(o.works,o.state))}),u.on("pano.moveTo",function(g){var h,m=g.state,y=g.userAction;o.pano={workCode:m.workCode,panoIndex:m.panoIndex},y&&o.state.mode===m.mode&&!stateEqual(o.state,m)&&(assignState(o.state,m),o.emit("state.change",createEvent("state.change",{userAction:y,state:o.state})),(h=o.analysis)===null||h===void 0||h.state(o.works,o.state))}),u.on("pano.arrived",function(g){var h,m=g.state,y=g.userAction;y&&o.state.mode===m.mode&&!stateEqual(o.state,m)&&(assignState(o.state,m),o.emit("state.change",createEvent("state.change",{userAction:y,state:o.state})),(h=o.analysis)===null||h===void 0||h.state(o.works,o.state))}),u.on("pano.cancel",function(g){var h,m=g.state,y=g.userAction;y&&o.state.mode===m.mode&&!stateEqual(o.state,m)&&(assignState(o.state,m),o.emit("state.change",createEvent("state.change",{userAction:y,state:o.state})),(h=o.analysis)===null||h===void 0||h.state(o.works,o.state))}),u.on("pano.moveTo",function(g){var h=g.userAction;o.emit("currentState.change",createEvent("currentState.change",{userAction:h,state:o.getCurrentState()}))}),u.on("pano.request",function(g){o.emit("pano.request",g),g.defaultPrevented||o.moveToPano(g.state,g.options,g.userAction)}),u.on("vr.requestExit",function(){o.currentMode===t.Mode.VRPanorama&&(o.exitFullscreen(),o.changeMode(t.Mode.Panorama))}),u.on("error",function(g){return o.throwError(g)}),u},t.prototype.removeEventListeners=function(){},t.prototype.getWorkResources=function(e){var r=this,o,s=this.models.find(function(f){return f.work===e}),u=((o=s==null?void 0:s.viewLayers)!==null&&o!==void 0?o:[]).map(function(f){return f.scene});function l(f){var d=/([0-9a-z\.\_\-]+)([\?\#].*)?$/i.exec(f);if(d){var p=String(d[1]).trim().split(".").slice(1).reverse()[0];if(p)return p}return""}function c(f,d){d===void 0&&(d=0);var p=[];if(f.content&&f.content.uri){var v=l(f.content.uri);if(v==="json"){var g=imageURL(f.content.uri,{key:"model.".concat(d)});p.push({url:g,type:"tileset"})}else if(v==="at3d"&&f.extras[v]){var g=f.content.uri;p.push({url:g,type:"model"});for(var h=f.extras[v],m=h.textureArray,y=h.textureOptions,A=0,E=m;A<E.length;A++){var b=E[A],T=__assign({key:"texture.pbm"},pick(y,["format","quality","size","sharpen","mappings"])),_=applyImageURLOptions(b,y==null?void 0:y.transform,T);p.push({url:_,type:"texture"})}}else{var g=imageURL(f.content.uri,{key:"model.".concat(d)});p.push({url:g,type:"model"})}}if(f.children)for(var R=0;R<f.children.length;R++){var S=f.children[R];p.push.apply(p,c(S,R))}return p}return Promise.all(u.map(function(f){return f.loadAllTilesets()})).then(function(){for(var f=[],d=["right","left","up","down","front","back"],p=0,v=e.observers;p<v.length;p++){for(var g=v[p],h=0,m=d;h<m.length;h++){var y=m[h],A=__assign({key:"pano.".concat(panoStringify(g.pano),".").concat(y)},pick(r.imageOptions,["size","format","quality","mappings"])),E=g.images[y],b=applyImageURLOptions(E,r.imageOptions.transform,A);f.push({url:b,type:"pano"})}if(g.images.tiles)for(var T=0,_=g.images.tiles;T<_.length;T++)for(var R=_[T],S=0,M=d;S<M.length;S++)for(var y=M[S],B=R.size,H=Math.pow(2,R.level),w=1/H,C=0;C<H;C++)for(var L=0;L<H;L++){var I="".concat(g.panoId,".").concat(y,".").concat(R.level,".").concat(C,".").concat(L),A=__assign(__assign({key:"pano_tile.".concat(I)},pick(r.imageOptions,["format","size","quality","sharpen","mappings"])),{size:R.scale>=1?void 0:B*w*R.scale,cut:[B*w*L,B*w*C,B*w,B*w]}),b=applyImageURLOptions(R[y],r.imageOptions.transform,A);f.push({url:b,type:"pano_tile"})}}for(var F=0,k=u;F<k.length;F++){var N=k[F];N.tileset.url&&f.push({url:N.tileset.url,type:"model"}),f.push.apply(f,c(N.tileset.root))}return f})},Object.defineProperty(t.prototype,"internalLightsEnabled",{get:function(){var e=this.scene.children.find(function(r){return r.name==="internalLights"});return e?e.visible:!1},set:function(e){var r=this.scene.children.find(function(o){return o.name==="internalLights"});r&&(r.visible=e)},enumerable:!1,configurable:!0}),t.Mode={Panorama:"Panorama",Model:"Model",Floorplan:"Floorplan",Topview:"Topview",Mapview:"Mapview",VRPanorama:"VRPanorama",XRPanorama:"XRPanorama"},t.Line=null,t}(Subscribe),__FIVE_DEBUG__={instances:{},constructor:Five};typeof window!="undefined"&&Object.assign(window,{__FIVE_DEBUG__});var XRButton=function(){function n(){}return n.createButton=function(t){var e=document.createElement("button");function r(){e.style.display="",e.style.cursor="pointer",e.style.left="calc(50% - 50px)",e.style.width="100px",e.textContent="ENTER VR",e.onmouseenter=function(){e.style.opacity="1.0"},e.onmouseleave=function(){e.style.opacity="0.5"},e.onclick=function(){t&&t()}}function o(){e.style.display="",e.style.cursor="auto",e.style.left="calc(50% - 75px)",e.style.width="150px",e.onmouseenter=null,e.onmouseleave=null,e.onclick=null}function s(){o(),e.textContent="VR NOT SUPPORTED"}function u(c){c.style.position="absolute",c.style.bottom="20px",c.style.padding="12px 6px",c.style.border="1px solid #fff",c.style.borderRadius="4px",c.style.background="rgba(0,0,0,0.1)",c.style.color="#fff",c.style.font="normal 13px sans-serif",c.style.textAlign="center",c.style.opacity="0.5",c.style.outline="none",c.style.zIndex="999"}if("xr"in navigator)return e.id="VRButton",e.style.display="none",u(e),navigator.xr.isSessionSupported("immersive-vr").then(function(c){c?r():s()}),e;var l=document.createElement("a");return window.isSecureContext===!1?(l.href=document.location.href.replace(/^http:/,"https:"),l.innerHTML="WEBXR NEEDS HTTPS"):(l.href="https://immersiveweb.dev/",l.innerHTML="WEBXR NOT AVAILABLE"),l.style.left="calc(50% - 90px)",l.style.width="180px",l.style.textDecoration="none",u(l),l},n}();exports.AnimationFrameLoop=AnimationFrameLoop,exports.Camera=Camera,exports.CustomShader=CustomShader,exports.Fetcher=Fetcher,exports.Five=Five,exports.InternalWebGLRenderer=InternalWebGLRenderer,exports.IntersectMesh=IntersectMesh,exports.Model=Model,exports.ModelViewLayer=ModelViewLayer,exports.NetworkSubscribe=NetworkSubscribe,exports.PBMContainer=PBMContainer,exports.PBMGroup=PBMGroup,exports.PBMMesh=PBMMesh,exports.PBMMeshMaterial=PBMMeshMaterial,exports.PBMPointCloud=PBMPointCloud,exports.PBMPointCloudMaterial=PBMPointCloudMaterial,exports.PROXY_CONTROLLER_EVENT_NAMES=PROXY_CONTROLLER_EVENT_NAMES,exports.PanoCircleMesh=PanoCircleMesh,exports.PanoCircleMeshCustom=PanoCircleMeshCustom,exports.PanoCircleMeshSolid=PanoCircleMeshSolid,exports.Scene=Scene,exports.Subscribe=Subscribe,exports.TextureLoader=TextureLoader,exports.Tile=Tile,exports.Tile3DModel=Tile3DModel,exports.TileCache=TileCache,exports.TileCubeTextureTarget=TileCubeTextureTarget,exports.TileNode=TileNode,exports.TileRequestScheduler=TileRequestScheduler,exports.Tileset=Tileset,exports.Trajectory=Trajectory,exports.TrajectoryNode=TrajectoryNode,exports.Work=Work,exports.XRButton=XRButton,exports.defaultImageURLTransform=imageURL,exports.defaultPbmParameters=defaultPbmParameters,exports.getViewportScale=getViewportScale,exports.imageSupport=imageSupport,exports.isPanoId=isPanoId,exports.loadAt3d=loadAt3d,exports.loadB3dm=loadB3dm,exports.loadDome=loadDome,exports.loadDomez=loadDomez,exports.loadFbx=loadFbx,exports.loadGlb=loadGlb,exports.loadPbm=loadPbm,exports.loadPly=loadPly,exports.loadPnts=loadPnts,exports.loadX3p=loadX3p,exports.panoEqual=panoEqual,exports.panoParse=panoParse,exports.panoStringify=panoStringify,exports.parseWork=parseWork,Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"})});
|
|
2179
|
+
`});y.depthTest=h.material.depthTest,y.side=h.material.side,l.meshReplaceMaterialMap.set(m,y),h.material=y}}});var p=this.renderer.getSize(new THREE__namespace.Vector2);this.camera.setViewOffset(p.width,p.height,e*s,r*s,1,1),this.renderer.setRenderTarget(this.gpuPickingRenderTarget),this.render();var v=new Uint8Array(4);this.renderer.readRenderTargetPixels(this.gpuPickingRenderTarget,0,0,1,1,v),this.renderer.setRenderTarget(null),this.camera.clearViewOffset(),this.scene.traverse(function(h){!(h instanceof THREE__namespace.Mesh)||h instanceof PBMMesh||l.meshOriginMaterialMap.get(h.uuid)&&(h.material=l.meshOriginMaterialMap.get(h.uuid))}),this.models.setMaterial({colorStyle:d,constantColor:f});var g=Object.keys(o).filter(function(h){return o[h].equals(new THREE__namespace.Color().setRGB(v[0]/255,v[1]/255,v[2]/255))})[0];return g||!1},t.prototype.dispose=function(){var e,r;if(this.destroyed!==!0){delete __FIVE_DEBUG__.instances[this.ident],this.emit("dispose"),this.destroyed=!0,this.pause(),this.stopAnimationLoop&&(this.stopAnimationLoop(),delete this.stopAnimationLoop),(e=this.renderer)===null||e===void 0||e.setAnimationLoop(null),this.off(),this.networkSubscribe.off(),this.controller&&(this.controller.destroy(),this.controller=void 0);var o=this.getElement();o&&o.parentNode&&o.parentNode.removeChild(o);var s=this.models.getMaterial();s&&(s.pano0&&s.pano0.map.dispose(),s.pano1&&s.pano1.map!==((r=s.pano0)===null||r===void 0?void 0:r.map)&&s.pano1.map.dispose());for(var u=0,l=this.models;u<l.length;u++){var c=l[u];c.dispose()}this.models.length=0,this.models.setMaterial({pano0:null,pano1:null}),this.meshReplaceMaterialMap.forEach(function(f){f.dispose()}),this.meshOriginMaterialMap.forEach(function(f){f.dispose()}),this.renderer instanceof InternalWebGLRenderer&&this.renderer.forceContextLoss&&this.renderer.forceContextLoss()}},t.prototype.setScissor=function(e){var r;if(Object.assign(this.scissor,e),this.controller&&this.controller.updateRenderSize){var o=new THREE__namespace.Vector2;(r=this.renderer)===null||r===void 0||r.getDrawingBufferSize(o),this.controller.updateRenderSize(o)}},Object.defineProperty(t.prototype,"helperVisible",{get:function(){return this.helperGroup.visible},set:function(e){this.helperGroup.visible!==e&&(this.helperGroup.visible=e,this.emit("helpers.visible",createEvent("helpers.visible",{object:this.helperGroup})),this.needsRender=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enableIOSEDR",{get:function(){return this._enableIOSEDR},set:function(e){this._enableIOSEDR!==e&&(this._enableIOSEDR=e,this.currentMode&&this.currentMode==="Panorama"&&this.changeMode(this.currentMode,this.getCurrentState(),0,!1,!0))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"postProcessingType",{get:function(){return this.currentMode==="Panorama"&&this.enableIOSEDR&&this.enablePostProcessing?"luminance":this.currentMode==="Mapview"&&this.enableEDL?"edl":this.currentMode==="Mapview"&&this.enableHQ?"hq":null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enableEDL",{get:function(){return this._enableEDL},set:function(e){if(e===!0&&this.currentMode!==t.Mode.Mapview)throw new Error("只支持Mapview下开启EDL");this._enableEDL!==e&&(this._enableEDL=e,this.boundingMesh.visible=!e,this.needsRender=!0,this.modelSceneNeedsRender=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enableHQ",{get:function(){return this._enableHQ},set:function(e){if(e===!0&&this.currentMode!==t.Mode.Mapview)throw new Error("只支持Mapview下开启HQ");this._enableHQ!==e&&(this._enableHQ=e,this.boundingMesh.visible=!e,this.needsRender=!0,this.modelSceneNeedsRender=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enablePostProcessing",{get:function(){return this._enablePostProcessing},set:function(e){this._enablePostProcessing!==e&&(this._enablePostProcessing=e),this.needsRender=!0,this.modelSceneNeedsRender=!0},enumerable:!1,configurable:!0}),t.prototype.updateConfiguration=function(e,r){r===void 0&&(r=!0);var o=!1;e.panorama&&(Object.assign(this.controllerInits.Panorama,e.panorama),this.currentMode==="Panorama"&&(o=!0)),e.model&&(Object.assign(this.controllerInits.Model,e.model),this.currentMode==="Model"&&(o=!0)),e.floorplan&&(Object.assign(this.controllerInits.Floorplan,e.floorplan),this.currentMode==="Floorplan"&&(o=!0)),e.topview&&(Object.assign(this.controllerInits.Topview,e.topview),this.currentMode==="Topview"&&(o=!0)),e.mapview&&(Object.assign(this.controllerInits.Mapview,e.mapview),this.currentMode==="Mapview"&&(o=!0)),e.vrPanorama&&(Object.assign(this.controllerInits.VRPanorama,e.vrPanorama),this.currentMode==="VRPanorama"&&(o=!0)),e.imageOptions&&(Object.assign(this.imageOptions,e.imageOptions),(this.currentMode==="Panorama"||this.currentMode==="VRPanorama")&&(o=!0)),e.textureOptions&&Object.assign(this.textureOptions,e.textureOptions),r&&o&&this.controller&&this.currentMode&&this.changeMode(this.currentMode,this.getCurrentState(),0,!1,!0)},t.prototype.appendTo=function(e,r){if(r===void 0&&(r={}),!!this.renderer){if(!(this.renderer instanceof InternalWebGLRenderer)){this.throwError(new Error("cannot call appendTo method when render a external renderer"));return}var o=this.getElement();if(o){e.appendChild(o),this.refresh(r);var s=window.getComputedStyle(e).position;s!=="relative"&&s!=="absolute"&&s!=="fixed"&&s!=="sticky"&&(e.style.position="relative")}}},t.prototype.refresh=function(e,r){if(e===void 0&&(e={}),!!this.renderer){var o=this.getElement();if(o){var s=o.parentNode;if(s&&s.nodeName){var u=e.width,l=u===void 0?s.offsetWidth:u,c=e.height,f=c===void 0?s.offsetHeight:c;this.renderer instanceof InternalWebGLRenderer&&(r&&this.renderer.setPixelRatio(r),this.renderer.setSize(l,f))}var d=new THREE__namespace.Vector2;if(this.renderer.getDrawingBufferSize(d),this.controller&&this.controller.updateRenderSize&&this.controller.updateRenderSize(d),this.modelRenderTarget.width!==d.x||this.modelRenderTarget.height!==d.y){this.modelRenderTarget.setSize(d.x,d.y),this.modelRenderTarget.depthTexture.dispose();var p=new THREE__namespace.DepthTexture(d.x,d.y);p.generateMipmaps=!1,p.format=THREE__namespace.DepthStencilFormat,p.type=THREE__namespace.UnsignedInt248Type,this.modelRenderTarget.depthTexture=p,this.modelRenderTarget.depthTexture.needsUpdate=!0}this.needsRender=!0,this.modelSceneNeedsRender=!0,this.render(noop$1,!0)}}},t.prototype.addExtraElement=function(e){var r=this;return this.extraElements.indexOf(e)===-1&&(this.extraElements.push(e),this.controller&&this.controller.bindExtraElement(e)),function(){return r.removeExtraElement(e)}},t.prototype.removeExtraElement=function(e){var r=this.extraElements.indexOf(e);r!==-1&&(this.extraElements.splice(r,1),this.controller&&this.controller.unbindExtraElement(e))},t.prototype.getPose=function(){var e=this.camera.copyPose(),r=e.longitude,o=e.latitude,s=e.fov,u=e.offset,l=e.distance;return{longitude:r,latitude:o,fov:s,offset:u.clone(),distance:l}},t.prototype.getSize=function(e){if(!this.renderer)throw new Error("renderer is not initialized");return this.renderer.getSize(e),e.x*=this.scissor.width,e.y*=this.scissor.height,e},t.prototype.getDrawingBufferSize=function(e){if(!this.renderer)throw new Error("renderer is not initialized");return this.renderer.getDrawingBufferSize(e),e.x*=this.scissor.width,e.y*=this.scissor.height,e},t.prototype.updateCamera=function(e,r,o){if(o===void 0&&(o=!0),!this.controller)throw new Error("controller is not initialized.");return this.controller.updateCamera(e,r,o)},t.prototype.updateCameraWithKeyframes=function(e,r,o){if(o===void 0&&(o=!0),!this.controller)throw new Error("controller is not initialized.");return this.controller.updateCameraWithKeyframes(e,r,o)},t.prototype.getLongitudeAndLatitude=function(){var e=this.getPose(),r=e.longitude,o=e.latitude;return{longitude:r,latitude:o}},t.prototype.getOffset=function(){return this.getPose().offset},t.prototype.getCameraLocal=function(){if(this.pano.workCode&&this.controller&&this.works){var e=this.works.getResolvedObserver(this.pano);if(e){var r=new THREE__namespace.Object3D;return r.position.copy(e.position),r.quaternion.copy(e.quaternion),r.scale.set(1,1,1),r.matrix.compose(r.position,r.quaternion,r.scale),r.matrixAutoUpdate=!1,cameraWorldToLocal(this.camera,r)}}return null},Object.defineProperty(t.prototype,"works",{get:function(){var e=worksMap.get(this);if(!e)return emptyWorks;for(var r=0,o=e;r<o.length;r++){var s=o[r];if(!workRawMapping.has(s))return emptyWorks}return e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"work",{get:function(){return this.works[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"model",{get:function(){return this.models[0]},enumerable:!1,configurable:!0}),t.prototype.load=function(e,r,o,s){var u=this;if(s===void 0&&(s=!0),!this.renderer)throw new Error("renderer is not initialized");var l=this.lastLoadWorkTask.then(function(){return isPromise(e)?e.then(function(c){return u.load_(c,r,o,s)}):u.load_(e,r,o,s)});return this.lastLoadWorkTask=l.catch(function(c){u.throwError(c)}),l},t.prototype.load_=function(e,r,o,s){var u=this,l,c,f,d,p,v,g,h;s===void 0&&(s=!0);var m={};typeof o=="number"?m.duration=o:typeof o=="object"&&Object.assign(m,o),this.works===emptyWorks&&(m.duration===void 0&&(m.duration=0),m.effect===void 0&&(m.effect="instant"));var y=[];if(Array.isArray(e))for(var A=0,E=e;A<E.length;A++){var b=E[A];typeof b!="string"&&"work"in b?y.push(parseWork(b.work,b)):y.push(parseWork(b))}else y.push(parseWork(e));for(var T=createWorks(y),_=function(K){var j=R,W=new Fetcher({allowHosts:K.allowHosts,get requestProxy(){return j.requestProxy},get networkSubscribe(){return j.networkSubscribe}});registerFetcher(K,W)},R=this,S=0,M=T;S<M.length;S++){var B=M[S];_(B)}this.lastWorks=this.works,r===void 0&&(r="inherit"),r==="inherit"&&this.lastWorks.length===0&&(r="initial");var H=T.initial,w=H.work.observers[0],C=w?{workCode:w.work.workCode,panoIndex:w.panoIndex}:{workCode:H.work.workCode,panoIndex:0},L=(l=H.mode)!==null&&l!==void 0?l:w?"Panorama":"Mapview",I={};if(r==="inherit"){L=this.currentMode;var F=T.resolvedObservers[this.panoIndex];F?C={workCode:F.work.workCode,panoIndex:F.panoIndex}:typeof T.initial.panoIndex=="number"?C={workCode:T.initial.work.workCode,panoIndex:T.initial.panoIndex}:(L==="Panorama"||L==="VRPanorama"||L==="XRPanorama")&&(L="Mapview"),I={longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude,fov:this.camera.pose.fov,distance:void 0,offset:void 0}}else if(r==="initial")typeof H.panoIndex=="number"&&(C={workCode:H.work.workCode,panoIndex:H.panoIndex}),H.mode&&(L=H.mode),I={longitude:H.longitude,latitude:H.latitude,fov:H.fov,distance:H.distance,offset:(c=H.offset)===null||c===void 0?void 0:c.clone()};else{if(L=(f=r.mode)!==null&&f!==void 0?f:this.currentMode,typeof r.panoIndex=="number"){var F=T.getResolvedObserver({workCode:(p=(d=r.workCode)!==null&&d!==void 0?d:H.work.workCode)!==null&&p!==void 0?p:"",panoIndex:r.panoIndex});F&&(C={workCode:F.work.workCode,panoIndex:F.panoIndex})}I={longitude:r.longitude,latitude:r.latitude,fov:r.fov,distance:r.distance,offset:r.offset}}var k=__assign(__assign(__assign({},C),{mode:L}),I),N=(v=m.duration)!==null&&v!==void 0?v:this.modeChangeDuration;(L==="Floorplan"||L==="Topview"||L==="Mapview")&&this.currentMode===L&&(N=0);var D="fly";(L==="Panorama"||L==="VRPanorama"||L==="XRPanorama")&&this.currentMode===L&&(D=(g=m.effect)!==null&&g!==void 0?g:"fade"),this.emit("works.request",createEvent("works.request",{input:e,works:T,state:k,userAction:s}));var U=function(){u.modelGroup.visible=!0,u.pano=C;var K=__assign(__assign({initial:{state:k,currentState:u.getCurrentState(),duration:N,effect:D,userAction:s}},u.commonParams()),u.controllerInits[L]),j=Controllers[L].initAnimationEndState(K);if(u.controller&&u.currentMode===L)u.controller.updateWork(T,j,{effect:D,duration:N},s)===!1&&(u.controller.destroy(),u.controller=u.applyController(L,K));else{var W=u.currentMode;if(u.controller)u.controller.destroy();else{var X=Controllers[L].initAnimationEndState(K);u.camera.setFromPose(X),u.emit("camera.update",createEvent("camera.update",{state:u.getCurrentState(),userAction:s}))}u.controller=u.applyController(L,K);var ee=createEvent("mode.change",{prevMode:W,mode:L,state:j,userAction:s});u.emit("mode.change",ee)}};worksMap.set(this,T),this.updateConfiguration(m,!1);var z=Promise.resolve();if(L===t.Mode.Floorplan||L===t.Mode.Topview||L===t.Mode.Mapview||L===t.Mode.Model)this.models.loaded===!1&&(this.camera.setFromPose(k),assignPose(this.state,this.camera.pose)),z=this.loadModel(T,m).then(function(){u.needsRender=!0,u.modelSceneNeedsRender=!0,U(),u.emit("camera.update",createEvent("camera.update",{state:u.getCurrentState(),userAction:s}))});else{U();var G=!1,q=function(){u.works===T&&G===!1&&(u.needsRender=!0,u.modelSceneNeedsRender=!0,u.emit("camera.update",createEvent("camera.update",{state:u.getCurrentState(),userAction:s})),u.loadModel(T,m),G=!0)};this.controller.once("pano.arrived",q),this.controller.once("pano.cancel",q),setTimeout(q,((h=m.duration)!==null&&h!==void 0?h:this.modeChangeDuration)+1e3)}return this.emit("works.load",createEvent("works.load",{input:e,state:this.getCurrentState(),userAction:s,works:T})),z.then(function(){return u.ready()}).then(function(){var K;u.emit("works.ready",createEvent("works.ready",{input:e,state:u.getCurrentState(),userAction:s,works:T})),(K=u.analysis)===null||K===void 0||K.work(T)})},t.prototype.reset=function(){var e=this,r=this.lastLoadWorkTask.then(function(){return e.reset_()});return this.lastLoadWorkTask=r.catch(function(o){e.throwError(o)}),r},t.prototype.reset_=function(){var e=this;return new Promise(function(r){var o;e.controller&&e.resetController();var s=e.models.getMaterial();s&&(s.pano0&&s.pano0.map.dispose(),s.pano1&&s.pano1.map!==((o=s.pano0)===null||o===void 0?void 0:o.map)&&s.pano1.map.dispose()),e.models.setMaterial({pano0:null,pano1:null,modelAlpha:1}),e.lastModels.setMaterial({pano0:null,pano1:null,modelAlpha:1}),e.renderer&&(e.models.update(e.renderer,e.camera,e.currentMode),e.lastModels.update(e.renderer,e.camera,e.currentMode),e.model&&e.boundingMesh.update(e.renderer,e.camera,e.model));for(var u=0,l=e.models;u<l.length;u++){var c=l[u];e.lastModels.push(c)}if(e.models.length=0,e.lastModels.length>0){for(var f=0,d=e.lastModels;f<d.length;f++){var c=d[f];e.modelGroup.remove(c),c.dispose(),e.needsRender=!0,e.modelSceneNeedsRender=!0}e.lastModels.length=0}e.lastWorks&&delete e.lastWorks,worksMap.delete(e),e.currentMode="Mapview",e.pano={workCode:"",panoIndex:0},e.camera.setFromPose({distance:0,fov:DEFAULT_CAMERA_FOV,longitude:0,latitude:0,offset:new THREE__namespace.Vector3(0,0,0)}),e.state={mode:e.currentMode,workCode:e.pano.workCode,panoIndex:e.pano.panoIndex,longitude:e.camera.pose.longitude,latitude:e.camera.pose.latitude,fov:e.camera.pose.fov,offset:e.camera.pose.offset.clone(),distance:e.camera.pose.distance},e.models.needsRender=!1,e.camera.needsRender=!1,e.needsRender=!1,e.modelSceneNeedsRender=!1,r()})},t.prototype.changeMode=function(e,r,o,s,u){var l=this;return r===void 0&&(r={}),s===void 0&&(s=!0),u===void 0&&(u=!1),new Promise(function(c,f){var d,p,v,g;if(!l.renderer)throw new Error("renderer is not initialized.");r=__assign({},r);var h=0;l.controller&&(typeof o=="number"?h=o:h=(d=o==null?void 0:o.duration)!==null&&d!==void 0?d:l.modeChangeDuration);var m="fly";l.controller&&typeof o=="object"&&o.effect&&(m=o.effect);var y=typeof r.panoIndex=="number"?{workCode:(g=(p=r.workCode)!==null&&p!==void 0?p:(v=l.work)===null||v===void 0?void 0:v.workCode)!==null&&g!==void 0?g:"",panoIndex:r.panoIndex}:l.pano;if(!t.Mode.hasOwnProperty(e)){var A=new Error('mode "'.concat(e,'" is not existed'));l.throwError(A),f(A);return}if((e===t.Mode.Panorama||e===t.Mode.VRPanorama||e===t.Mode.XRPanorama)&&!l.works.getResolvedObserver(y)){var A=new Error("PanoId ".concat(panoStringify(y)," not existed."));l.throwError(A),f(A);return}(e===t.Mode.Floorplan||e===t.Mode.Topview||e===t.Mode.Mapview||e===t.Mode.Model)&&(l.models.loaded||(h=0));var E=l.controller,b=l.currentMode,T=function(){if(l.controller&&l.controller.stopMomentumMovement(),l.controller&&u===!1&&b===e)e===t.Mode.Panorama||e===t.Mode.Model||e===t.Mode.VRPanorama||e===t.Mode.XRPanorama?panoEqual(l.pano,y)&&"moveToPano"in l.controller&&typeof l.controller.moveToPano=="function"?l.controller.moveToPano(y,__assign({duration:h},r),s):l.controller.updateCamera(r,h,s).catch(noop$1):(panoEqual(l.pano,y)||(l.pano=y),l.controller.updateCamera(r,h,s).catch(noop$1));else{var R=__assign(__assign({},r),y),S=__assign(__assign({initial:{state:R,currentState:l.getCurrentState(),duration:h,effect:m,userAction:s}},l.commonParams()),l.controllerInits[e]),M=Controllers[e].initAnimationEndState(S),B=createEvent("mode.change.request",{prevMode:l.currentMode,mode:e,state:M,userAction:s});if(l.emit("mode.change.request",B),!B.defaultPrevented){E&&E.destroy(),l.controller=l.applyController(e,S);var H=createEvent("mode.change",{prevMode:l.currentMode,mode:e,state:M,userAction:s});l.emit("mode.change",H)}}c()};if(e===t.Mode.VRPanorama)l.requestFullscreen(),requestDeviceOrientationPermission().then(function(){return T()}).catch(function(R){R instanceof Error&&(l.exitFullscreen(),l.throwError(R),f(R))});else if(e===t.Mode.XRPanorama){var _=AnimationFrameLoop.shared.getContext();_?_.end():requestXRSessionPermission().then(function(R){AnimationFrameLoop.shared.setContext(R),T()}).catch(function(R){R instanceof Error&&(l.throwError(R),f(R))})}else T()})},t.prototype.getPixels=function(e,r,o,s,u,l,c){if(!this.renderer)throw new Error("renderer is not initialized.");var f=this.renderer.getPixelRatio(),d=this.renderer.getRenderTarget(),p=this.renderer.getSize(new THREE__namespace.Vector2),v=0,g=0,h=1,m=1,y,A,E,b,T;typeof e=="number"?(v=e,typeof r=="number"&&(g=r),typeof o=="number"&&(h=o),typeof s=="number"&&(m=s),y=u,A=l,T=c):(v=e.x,g=e.y,h=e.width,m=e.height,y=e.pixelRatio,A=e.flipY,E=e.helperVisible,b=e.skipPanorama,T=e.buffer),v=Math.ceil(v),g=Math.ceil(g),h=Math.ceil(h),m=Math.ceil(m),y=Math.ceil(y!=null?y:f),A=A!=null?A:!1;var _=this.getPixelsRenderTarget;_.setSize(h*y,m*y),this.renderer.setRenderTarget(_),this.camera.pixelRatio=y,this.camera.resolution.set(h,m),this.camera.setViewOffset(p.width,p.height,v,p.height-g-m,h,m);for(var R=0,S=this.scene.children;R<S.length;R++){var M=S[R];M instanceof THREE__namespace.Object3D&&M.traverseVisible(function(K){K.setResolution&&K.setResolution(h*y/f,m*y/f)})}this.models.autoUpdate=!1;var B=!0,H=0;b&&(this.controller instanceof Controllers.Panorama||this.controller instanceof Controllers.VRPanorama||this.controller instanceof Controllers.XRPanorama)&&(B=this.controller.tiling.object.visible,this.controller.tiling.object.visible=!1,H=this.models.getMaterial().modelAlpha,this.models.setMaterial({modelAlpha:b===!0?1:H}));var w=this.helperVisible;E===!1&&(this.helperVisible=!1),this.models.update(this.renderer,this.camera,this.currentMode),this.controller?(this.controller.updateRenderSize(new THREE__namespace.Vector2(h*y,m*y)),this.controller.render(!0,this.postProcessingType)):(this.renderer.render(this.scene,this.camera),this.renderer.autoClearDepth=!1,this.renderer.autoClearColor=!1,this.renderer.render(this.modelScene,this.camera),this.renderer.autoClearDepth=!0,this.renderer.autoClearColor=!0),this.helperVisible=w,b&&(this.controller instanceof Controllers.Panorama||this.controller instanceof Controllers.VRPanorama||this.controller instanceof Controllers.XRPanorama)&&(this.controller.tiling.object.visible=B,this.models.setMaterial({modelAlpha:H})),this.models.update(this.renderer,this.camera,this.currentMode),this.models.autoUpdate=!0;var C=h*y,L=m*y,I=C*L,F=I*4,k;try{if(T){if(T.length!==F)throw new Error("buffer length is not equals pixels ".concat(F))}else T=new Uint8Array(F);if(this.renderer.readRenderTargetPixels(_,0,0,h*y,m*y,T),A)for(var N=I/2,D=0,U=0,z=0,G=0;U<N;U++)for(G=(L-Math.floor(U/C)-1)*C+U%C,z=0;z<4;z++)D=T[U*4+z],T[U*4+z]=T[G*4+z],T[G*4+z]=D}catch(K){k=K}if(this.renderer.setRenderTarget(d),this.controller&&this.controller.updateRenderSize){var q=new THREE__namespace.Vector2;this.renderer.getDrawingBufferSize(q),this.controller.updateRenderSize(q)}if(this.camera.clearViewOffset(),this.camera.pixelRatio=f,this.getSize(this.camera.resolution),this.camera.aspect=this.camera.resolution.width/this.camera.resolution.height,k)throw k;return T},t.prototype.getElement=function(){var e;return(e=this.renderer)===null||e===void 0?void 0:e.domElement},Object.defineProperty(t.prototype,"observers",{get:function(){return this.works.resolvedObservers},enumerable:!1,configurable:!0}),t.prototype.render=function(e,r){var o=this;if(r===void 0&&(r=!1),!this.renderer)return null;if(r){var s=this.renderer.getSize(sharedVector2);this.scene.traverseVisible(function(u){u.setResolution&&u.setResolution(s.x,s.y)})}return this.aroundScissor(function(){o.renderer&&(o.controller?(o.controller.render(o.onlyRenderIfNeeds?o.modelSceneNeedsRender:!0,o.postProcessingType),o.info={memory:__assign({},o.controller.renderer.info.memory),render:__assign({},o.controller.renderer.info.render)}):(o.renderer.render(o.scene,o.camera),o.info={memory:__assign({},o.renderer.info.memory),render:__assign({},o.renderer.info.render)}),o.poweredByRealsee&&o.currentMode!=="VRPanorama"&&o.currentMode!=="XRPanorama"&&o.renderer.getRenderTarget()!==o.getPixelsRenderTarget&&renderPoweredByRealsee(o.renderer)),e&&AnimationFrameLoop.shared.add(e,!0)}),null},t.prototype.updateTime=function(e,r){for(var o,s=this,u=[],l=2;l<arguments.length;l++)u[l-2]=arguments[l];if(!this.destroyed){if(this.works.update(),this.syncingState=this.syncState(e,r),this.controller&&(o=this.controller).updateTime.apply(o,__spreadArray([e,r],u,!1)),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.updateTime(e),this.renderer){ktx2.detectSupport(this.renderer);var c=this.models.loaded,f=this.models.refined;if(this.models.update(this.renderer,this.camera,this.currentMode),this.camera.autoNearFar){var d=this.models.bounding.getBoundingSphere(sharedSphere),p=d.radius*2;d.containsPoint(this.camera.position)||(p=this.camera.position.distanceTo(d.center)+d.radius),p=clamp$1(p,800,5e4),this.camera.far!==p&&(this.camera.far=p);var v=p/1e4;v=clamp$1(v,.03,.1),this.camera.near!==v&&(this.camera.near=v)}if(c===!1&&this.models.loaded===!0&&this.emit("models.load",createEvent("models.load",{models:this.models})),f===!1&&this.models.refined===!0&&this.emit("models.refined",createEvent("models.refined",{models:this.models})),this.models.loaded){for(var g=0,h=this.models;g<h.length;g++){var m=h[g];m.parent!==this.modelGroup&&(this.modelGroup.add(m),this.needsRender=!0,this.modelSceneNeedsRender=!0)}if(this.lastModels.length>0){for(var y=0,A=this.lastModels;y<A.length;y++){var m=A[y];this.modelGroup.remove(m),m.dispose(),this.needsRender=!0,this.modelSceneNeedsRender=!0}this.lastModels.length=0}this.lastWorks&&delete this.lastWorks}this.lastModels.setMaterial(this.models.getMaterial()),this.lastModels.materialVersion=this.models.materialVersion,this.lastModels.update(this.renderer,this.camera,this.currentMode)}this.syncingState=!1;var E=new THREE__namespace.Vector2(512,512),b=new THREE__namespace.Vector2(512,512);this.renderer&&(this.renderer.getSize(E),E.x*=this.scissor.width,E.y*=this.scissor.height,this.renderer.getDrawingBufferSize(b),b.x*=this.scissor.width,b.y*=this.scissor.height);{for(var T=new THREE__namespace.Box3,_=new THREE__namespace.Box3,R=new THREE__namespace.Vector3(4,4,4),S=0,M=this.works.resolvedObservers;S<M.length;S++){var B=M[S];_.setFromCenterAndSize(B.position,R),T.union(_)}if(T.union(this.models.bounding),this.lastWorks)for(var H=0,w=this.lastWorks.resolvedObservers;H<w.length;H++){var B=w[H];_.setFromCenterAndSize(B.position,R),T.union(_)}T.union(this.lastModels.bounding),T.getCenter(this.boundingMesh.position),T.getSize(this.boundingMesh.scale),this.boundingMesh.boundingBox.copy(T),this.renderer&&this.model&&this.boundingMesh.update(this.renderer,this.camera,this.model)}var C=createEvent("render.prepare",{needsRender:!0,info:null});if(this.emit("render.prepare",C),!C.defaultPrevented){var L=[];sharedProjScreenMatrix.multiplyMatrices(this.camera.projectionMatrix,this.camera.matrixWorldInverse),sharedFrustum.setFromProjectionMatrix(sharedProjScreenMatrix);for(var I=0,F=this.scene.children;I<F.length;I++){var k=F[I];k!==this.modelGroup&&k!==this.boundingMesh&&k.traverseVisible(function(q){if(q.setResolution&&q.setResolution(E.x,E.y),q.setTime&&q.setTime(e),q.mixer instanceof THREE__namespace.AnimationMixer){var K=clockForMixer.get(q.mixer);K||(K=new THREE__namespace.Clock,clockForMixer.set(q.mixer,K)),q.mixer.update(K.getDelta())}(q instanceof THREE__namespace.Mesh||q instanceof THREE__namespace.Line||q instanceof THREE__namespace.Points)&&(q instanceof THREE__namespace.ImmediateRenderObject||!q.frustumCulled||sharedFrustum.intersectsObject(q))&&L.push(q)})}if(b.width*b.height>4096*2048?this.renderSwitch01=this.renderSwitch01^1:this.renderSwitch01=0,this.renderer&&this.paused===!1&&this.renderSwitch01===0){var N=void 0;if(this.onlyRenderIfNeeds!==!0)N=this.render();else{if(this.controller&&(this.controller.needsRender===!0&&(this.controller.needsRender=!1,this.needsRender=!0),this.controller.modelSceneNeedsRender===!0&&(this.controller.modelSceneNeedsRender=!1,this.modelSceneNeedsRender=!0)),this.camera.needsRender===!0&&(this.camera.needsRender=!1,this.needsRender=!0,this.modelSceneNeedsRender=!0),this.models.needsRender===!0&&(this.models.needsRender=!1,this.needsRender=!0,this.modelSceneNeedsRender=!0),this.needsRender!==!0)for(var D=0,U=L;D<U.length;D++){var z=U[D],G=function(q){q.needsRender===!0?(q.needsRender=!1,s.needsRender=!0):q.mixer&&q.mixer.stats.actions.inUse>0&&(s.needsRender=!0)};G(z),z.traverseAncestors(G)}(this.needsRender!==!1||this.modelSceneNeedsRender!==!1)&&(N=this.render())}this.needsRender=!1,this.modelSceneNeedsRender=!1,this.hasListener("render")&&this.emit("render",createEvent("render",{needsRender:N!==void 0,info:this.info}))}this.needsRender=!1,this.modelSceneNeedsRender=!1}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)}},t.prototype.pause=function(){this.paused=!0,this.renderer&&this.renderer instanceof InternalWebGLRenderer&&this.renderer.clear(!0,!0,!0)},t.prototype.play=function(){this.needsRender=!0,this.modelSceneNeedsRender=!0,this.paused=!1},t.prototype.moveToPano=function(e,r,o){r===void 0&&(r={}),o===void 0&&(o=!0);var s=this,u=s.controller,l=s.renderer;if(!u)return this.throwError(new Error("controller is not initialized.")),Promise.resolve();if(!l)return this.throwError(new Error("renderer is not initialized.")),Promise.resolve();var c=this.works.getResolvedObserver(e);if(!c)return this.throwError(new Error("pano ".concat(JSON.stringify(e)," not existed."))),Promise.resolve();var f={workCode:c.work.workCode,panoIndex:c.panoIndex};return"moveToPano"in u&&typeof u.moveToPano=="function"?u.moveToPano(f,r,o):c&&(this.pano=f,this.once("initAnimation.start",function(d){r.moveStartCallback&&r.moveStartCallback(d.state)}),this.once("initAnimation.end",function(d){r.moveEndCallback&&r.moveEndCallback(d.state)}),this.changeMode(t.Mode.Panorama,r,{effect:r.effect},o)),this.ready()},t.prototype.preloadPano=function(e,r){var o=this;r===void 0&&(r=noop$1);var s=this.works.getResolvedObserver(e);if(!s)return Promise.reject(new Error("Pano ".concat(JSON.stringify(e)," never found")));var u=["right","left","up","down","front","back"],l=now();return Promise.all(u.map(function(c){var f=__assign({key:"pano.".concat(s.panoId,".").concat(c)},pick(o.imageOptions,["size","format","quality","mappings"])),d=s.images[c],p=o.imageOptions.transform?o.imageOptions.transform(d,f):imageURL(d,f);return getFetcher(s.work).preload(p)})).then(function(){var c=now()-l;return r(c),c})},t.prototype.project2d=function(e,r){if(r===void 0&&(r=!1),!this.renderer)return null;if(this.models.length>0&&r){var o=this.camera.position,s=e.clone().sub(o),u=new THREE__namespace.Raycaster(o,s.clone().normalize());u.params.Points={threshold:.1};var l=this.models.intersectRaycaster(u)[0];if(l&&l.distance+.01<s.length())return null}var c=e.clone().project(this.camera);if(Math.abs(c.z)>1)return null;var f=this.renderer.getSize(new THREE__namespace.Vector2),d=f.x*this.scissor.width,p=f.y*this.scissor.height,v=f.x*this.scissor.left+(c.x+1)/2*d,g=f.y*(1-this.scissor.bottom-this.scissor.height)+(-c.y+1)/2*p;return new THREE__namespace.Vector2(v,g)},t.prototype.getRenderObjects=function(e){sharedProjScreenMatrix.multiplyMatrices(this.camera.projectionMatrix,this.camera.matrixWorldInverse),sharedFrustum.setFromProjectionMatrix(sharedProjScreenMatrix),e||(e=this.scene);var r=[];return e.traverseVisible(function(o){(o instanceof THREE__namespace.Mesh||o instanceof THREE__namespace.Line||o instanceof THREE__namespace.Points)&&(o instanceof THREE__namespace.ImmediateRenderObject||!o.frustumCulled||sharedFrustum.intersectsObject(o))&&r.push(o)}),r},t.prototype.getCurrentState=function(){return __assign(__assign({},this.getPose()),{mode:this.currentMode,workCode:this.pano.workCode,panoIndex:this.pano.panoIndex})},t.prototype.setState=function(e,r,o){var s,u,l,c,f,d,p,v,g,h;r===void 0&&(r=!1),o===void 0&&(o=!0),e=Object.assign({},e),e.offset&&!(e instanceof THREE__namespace.Vector3)&&(e.offset=new THREE__namespace.Vector3(e.offset.x,e.offset.y,e.offset.z));var m;if(typeof e.panoIndex=="number")if(e.workCode)m={workCode:e.workCode,panoIndex:e.panoIndex};else{var y=(u=(s=this.work)===null||s===void 0?void 0:s.workCode)!==null&&u!==void 0?u:"",A=this.state.workCode;this.works.filter(function(C){return C.workCode===A}).length>0&&(y=A),m={workCode:y,panoIndex:e.panoIndex}}var E=(l=e.mode)!==null&&l!==void 0?l:this.state.mode,b,T,_,R,S;if(this.controller&&this.controller.stopMomentumMovement(),this.state.mode!==E){if(E==="VRPanorama"){this.changeMode("VRPanorama",void 0,void 0,!0);return}var M={workCode:m==null?void 0:m.workCode,panoIndex:m==null?void 0:m.panoIndex};typeof e.longitude=="number"&&(M.longitude=e.longitude),typeof e.latitude=="number"&&(M.latitude=e.latitude),typeof e.fov=="number"&&(M.fov=e.fov),typeof e.distance=="number"&&(M.distance=e.distance),e.offset instanceof THREE__namespace.Vector3&&(M.offset=e.offset);var B=__assign(__assign({initial:{state:M,currentState:this.getCurrentState(),duration:this.modeChangeDuration,effect:"fly",userAction:!1}},this.commonParams()),this.controllerInits[E]),H=Controllers[E].initAnimationEndState(B);b=H.longitude,T=H.latitude,_=H.fov,R=H.offset,S=H.distance}else b=(c=e.longitude)!==null&&c!==void 0?c:this.state.longitude,T=(f=e.latitude)!==null&&f!==void 0?f:this.state.latitude,_=(d=e.fov)!==null&&d!==void 0?d:this.state.fov,R=(p=e.offset)!==null&&p!==void 0?p:this.state.offset,S=(v=e.distance)!==null&&v!==void 0?v:this.state.distance;var w={workCode:(m!=null?m:this.pano).workCode,panoIndex:(m!=null?m:this.pano).panoIndex,mode:E,longitude:b,latitude:T,fov:_,offset:R,distance:S};this.emit("state.set",createEvent("state.set",{userAction:o,state:w})),stateEqual(this.state,w)||(this.controller&&w.mode==="VRPanorama"&&w.mode!==this.state.mode?(assignState(this.state,w),this.changeMode("VRPanorama")):this.controller&&w.mode==="XRPanorama"&&w.mode!==this.state.mode?(assignState(this.state,w),this.changeMode("XRPanorama")):(assignState(this.state,w),this.controller&&o&&(this.controller.userAction=!1),r&&this.state.mode===w.mode&&(this.syncingState=this.syncState(now(),0,r),this.syncingState&&((g=this.controller)===null||g===void 0||g.updateTime(now(),0),this.syncingState=!1)),this.emit("state.change",createEvent("state.change",{userAction:o,state:this.state})),(h=this.analysis)===null||h===void 0||h.state(this.works,this.state)))},t.prototype.aroundScissor=function(e){if(this.renderer){if(this.state.mode==="XRPanorama"){e();return}var r=new THREE__namespace.Vector2,o=this.scissor.left!==0||this.scissor.bottom!==0||this.scissor.width!==1||this.scissor.height!==1;if(o){this.renderer.getSize(r);var s=Math.floor(r.x*this.scissor.left),u=Math.floor(r.y*this.scissor.bottom),l=Math.floor(r.x*this.scissor.width),c=Math.floor(r.y*this.scissor.height);this.renderer.setViewport(s,u,l,c),this.renderer.setScissor(s,u,l,c),this.renderer.setScissorTest(!0)}e(),o&&(this.renderer.setViewport(0,0,r.x,r.y),this.renderer.setScissor(0,0,r.x,r.y),this.renderer.setScissorTest(!1))}},t.prototype.syncState=function(e,r,o){o===void 0&&(o=!1);var s=this.stateSynced;if(this.stateSynced=!1,!this.controller)return!1;if(this.state.mode!==this.currentMode){var u={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,u,this.modeChangeDuration,this.controller.userAction),!0}if(!this.controller.isReady())return!1;if(this.controller instanceof Controllers.Model){if(notSimilarVector3(this.camera.pose.offset,this.state.offset)){var l={longitude:this.state.longitude,latitude:this.state.latitude,fov:this.state.fov,offset:this.state.offset};return this.controller.moveToPosition(this.state.offset,__assign(__assign({},l),{duration:o?0:void 0}),!1),!0}}else{var c={workCode:this.state.workCode,panoIndex:this.state.panoIndex};if(!panoEqual(c,this.pano)&&"moveToPano"in this.controller&&typeof this.controller.moveToPano=="function"){var l={longitude:this.state.longitude,latitude:this.state.latitude,fov:this.state.fov,offset:this.state.offset,distance:this.state.distance};return this.controller.moveToPano(c,l,!1),!0}}if(this.controller instanceof Controllers.Floorplan||this.controller instanceof Controllers.Topview||this.controller instanceof Controllers.Mapview){var f=1,d=.2,p=.2,v=Math.PI/45,g=o?this.state.fov:stepNumber(this.camera.pose.fov,this.state.fov,f),h=Math.abs(this.camera.pose.distance-this.state.distance),m=h>p*15?h/15:d,y=o?this.state.distance:stepNumber(this.camera.pose.distance,this.state.distance,m),A=this.camera.pose.offset.distanceTo(this.state.offset),E=A>p*15?A/15:p,b=o?new THREE__namespace.Vector3().copy(this.state.offset):stepVector(this.camera.pose.offset,this.state.offset,E),T=o?{longitude:this.state.longitude,latitude:this.state.latitude}:stepCoordinates({longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude},{longitude:this.state.longitude,latitude:this.state.latitude},v),_=T.longitude,R=T.latitude;if(notSimilarValue(g,this.camera.pose.fov)||notSimilarVector3(b,this.camera.pose.offset)||notSimilarValue(y,this.camera.pose.distance)||notSimilarValue(_,this.camera.pose.longitude,Math.PI*2)||notSimilarValue(R,this.camera.pose.latitude)){var S={x:b.x,y:b.y,z:b.z},M={fov:g};return Object.assign(S,{distance:y}),Object.assign(M,{longitude:_,latitude:R}),this.controller.stopMomentumMovement(),this.controller.cameraMotion.set(M,0).catch(noop$1),this.controller.locationMotion.set(S,0).catch(noop$1),!0}}else{var B=1,H=Math.PI/45,g=o?this.state.fov:stepNumber(this.camera.pose.fov,this.state.fov,B),w=o?{longitude:this.state.longitude,latitude:this.state.latitude}:stepCoordinates({longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude},{longitude:this.state.longitude,latitude:this.state.latitude},H),_=w.longitude,R=w.latitude,y=this.state.distance,b=new THREE__namespace.Vector3().copy(this.state.offset);if(notSimilarValue(y,this.camera.pose.distance)&&(this.state.distance=this.camera.pose.distance),notSimilarVector3(b,this.camera.pose.offset)&&(this.state.offset=this.camera.pose.offset.clone()),notSimilarValue(_,this.camera.pose.longitude,Math.PI*2)||notSimilarValue(R,this.camera.pose.latitude)||notSimilarValue(g,this.camera.pose.fov))return this.controller.stopMomentumMovement(),this.controller.cameraMotion.set({longitude:_,latitude:R,fov:g},0).catch(noop$1),!0}if(this.stateSynced=!0,s===!1&&this.emit("state.synced",createEvent("state.synced",{userAction:!1,state:this.state})),this.readyCallbacks.length&&this.stateSynced){var C=this.currentMode,L=C===t.Mode.Floorplan||C===t.Mode.Topview||C===t.Mode.Mapview||C===t.Mode.Model;if(!L||this.models.loaded){var I=this.readyCallbacks.slice();this.readyCallbacks.length=0;for(var F=0,k=I;F<k.length;F++){var N=k[F];this.controller instanceof Controllers.Panorama&&N.tile===!0&&!this.controller.isTileReady()?this.readyCallbacks.push(N):N()}}}return!1},t.prototype.ready=function(e){var r=this;return e===void 0&&(e={}),new Promise(function(o){var s;r.readyCallbacks.push(Object.assign(o,{tile:(s=e.tile)!==null&&s!==void 0?s:!1}))})},t.prototype.requestFullscreen=function(){var e;if(isMobile){var r=(e=this.getElement())===null||e===void 0?void 0:e.parentNode;r&&"requestFullscreen"in r&&typeof document!="undefined"&&document.fullscreenElement===null&&r.requestFullscreen()}},t.prototype.exitFullscreen=function(){typeof document!="undefined"&&document.fullscreenElement&&"exitFullscreen"in document&&document.exitFullscreen()},t.prototype.throwError=function(e){this.hasListener("error")?this.emit("error",e):console.error(e)},t.prototype.loadModel=function(e,r){for(var o=this,s=[],u=function(y){var A=l.models.filter(function(b){var T;return((T=b.work)===null||T===void 0?void 0:T.workCode)===y.workCode})[0];if(A)A.work=y,s.push(A);else{var E=new Model({onError:function(b){o.emit("model.error",createEvent("model.error",{work:y,model:E,error:b})),o.throwError(b)},onShownFloorChange:function(b){o.emit("model.changeShownFloor",createEvent("model.changeShownFloor",{work:y,model:E,error:null}))},onLoad:function(){o.emit("model.load",createEvent("model.load",{work:y,model:E,error:null}))}});s.push(E),l.emit("model.request",createEvent("model.request",{work:y,model:E,error:null})),E.load(y,{textureOptions:l.textureOptions,"3d-tiles":r["3d-tiles"]})}},l=this,c=0,f=e;c<f.length;c++){var d=f[c];u(d)}if(this.models.length>0){for(var p=0,v=this.models;p<v.length;p++){var g=v[p];s.indexOf(g)===-1&&this.lastModels.push(g)}this.models.length=0}for(var h=0,m=s;h<m.length;h++){var g=m[h];this.models.push(g)}return this.renderer&&(this.models.loaded=!1),new Promise(function(y){o.on("models.load",function(){o.controller&&o.controller.updateModel(o.models),y()})})},t.prototype.commonParams=function(){return{ident:this.ident,scene:this.scene,xrCustomObjectsScene:this.xrCustomObjectsScene,helper:this.helperGroup,boundingMesh:this.boundingMesh,camera:this.camera,renderer:this.renderer,scissor:this.scissor,element:this.getElement(),models:this.models,works:this.works,imageOptions:this.imageOptions,enableWheel:this.enableWheel,enableIOSEDR:this._enableIOSEDR,enableEDL:this.enableEDL,enableHQ:this.enableHQ,extraElements:this.extraElements,videoTexture:this.videoTexture,modelScene:this.modelScene,modelRenderTarget:this.modelRenderTarget}},t.prototype.resetController=function(){this.controller&&(this.controller.destroy(),this.controller=void 0);var e="Mapview";this.renderer&&(this.controller=this.applyController(e,__assign(__assign({initial:{state:{distance:10,latitude:Math.PI/4,longitude:Math.PI/4,offset:new THREE__namespace.Vector3(0,0,0)},currentState:this.getCurrentState(),duration:0,effect:"fade",userAction:!0}},this.commonParams()),this.controllerInits[e])))},t.prototype.applyController=function(e,r){var o=this;if(!this.renderer)throw new Error("renderer is not initialized.");e!==t.Mode.Mapview&&(this.enableEDL=!1,this.enableHQ=!1);var s=Controllers[e];this.currentMode=e;for(var u=new s(r),l=function(g){u.on(g,function(){for(var h=[],m=0;m<arguments.length;m++)h[m]=arguments[m];var y=o.emit.apply(o,__spreadArray([g],h,!1));if(y)return!1})},c=0,f=PROXY_CONTROLLER_EVENT_NAMES;c<f.length;c++){var d=f[c];l(d)}{var p=Controllers[e].initAnimationEndState(r),v=r.initial.userAction;stateEqual(this.state,p)||(assignState(this.state,p),this.emit("state.change",createEvent("state.change",{userAction:v,state:this.state}))),this.emit("currentState.change",createEvent("currentState.change",{userAction:v,state:this.getCurrentState()}))}return u.on("camera.update",function(g){var h;if(o.controller){var m=o.controller.getTargetState();g.userAction&&o.syncingState===!1&&o.state.mode===m.mode&&!stateEqual(o.state,m)&&(assignState(o.state,m),o.emit("state.change",createEvent("state.change",{userAction:g.userAction,state:o.state})),(h=o.analysis)===null||h===void 0||h.state(o.works,o.state))}o.emit("currentState.change",createEvent("currentState.change",{userAction:g.userAction,state:o.getCurrentState()}))}),u.on("initAnimation.start",function(g){var h,m=g.state,y=g.userAction;y&&o.state.mode===m.mode&&!stateEqual(o.state,m)&&(assignState(o.state,m),o.emit("state.change",createEvent("state.change",{userAction:y,state:o.state})),(h=o.analysis)===null||h===void 0||h.state(o.works,o.state))}),u.on("initAnimation.end",function(g){var h,m=g.state,y=g.userAction;y&&o.state.mode===m.mode&&!stateEqual(o.state,m)&&(assignState(o.state,m),o.emit("state.change",createEvent("state.change",{userAction:y,state:o.state})),(h=o.analysis)===null||h===void 0||h.state(o.works,o.state))}),u.on("pano.moveTo",function(g){var h,m=g.state,y=g.userAction;o.pano={workCode:m.workCode,panoIndex:m.panoIndex},y&&o.state.mode===m.mode&&!stateEqual(o.state,m)&&(assignState(o.state,m),o.emit("state.change",createEvent("state.change",{userAction:y,state:o.state})),(h=o.analysis)===null||h===void 0||h.state(o.works,o.state))}),u.on("pano.arrived",function(g){var h,m=g.state,y=g.userAction;y&&o.state.mode===m.mode&&!stateEqual(o.state,m)&&(assignState(o.state,m),o.emit("state.change",createEvent("state.change",{userAction:y,state:o.state})),(h=o.analysis)===null||h===void 0||h.state(o.works,o.state))}),u.on("pano.cancel",function(g){var h,m=g.state,y=g.userAction;y&&o.state.mode===m.mode&&!stateEqual(o.state,m)&&(assignState(o.state,m),o.emit("state.change",createEvent("state.change",{userAction:y,state:o.state})),(h=o.analysis)===null||h===void 0||h.state(o.works,o.state))}),u.on("pano.moveTo",function(g){var h=g.userAction;o.emit("currentState.change",createEvent("currentState.change",{userAction:h,state:o.getCurrentState()}))}),u.on("pano.request",function(g){o.emit("pano.request",g),g.defaultPrevented||o.moveToPano(g.state,g.options,g.userAction)}),u.on("vr.requestExit",function(){o.currentMode===t.Mode.VRPanorama&&(o.exitFullscreen(),o.changeMode(t.Mode.Panorama))}),u.on("error",function(g){return o.throwError(g)}),u},t.prototype.removeEventListeners=function(){},t.prototype.getWorkResources=function(e){var r=this,o,s=this.models.find(function(f){return f.work===e}),u=((o=s==null?void 0:s.viewLayers)!==null&&o!==void 0?o:[]).map(function(f){return f.scene});function l(f){var d=/([0-9a-z\.\_\-]+)([\?\#].*)?$/i.exec(f);if(d){var p=String(d[1]).trim().split(".").slice(1).reverse()[0];if(p)return p}return""}function c(f,d){d===void 0&&(d=0);var p=[];if(f.content&&f.content.uri){var v=l(f.content.uri);if(v==="json"){var g=imageURL(f.content.uri,{key:"model.".concat(d)});p.push({url:g,type:"tileset"})}else if(v==="at3d"&&f.extras[v]){var g=f.content.uri;p.push({url:g,type:"model"});for(var h=f.extras[v],m=h.textureArray,y=h.textureOptions,A=0,E=m;A<E.length;A++){var b=E[A],T=__assign({key:"texture.pbm"},pick(y,["format","quality","size","sharpen","mappings"])),_=applyImageURLOptions(b,y==null?void 0:y.transform,T);p.push({url:_,type:"texture"})}}else{var g=imageURL(f.content.uri,{key:"model.".concat(d)});p.push({url:g,type:"model"})}}if(f.children)for(var R=0;R<f.children.length;R++){var S=f.children[R];p.push.apply(p,c(S,R))}return p}return Promise.all(u.map(function(f){return f.loadAllTilesets()})).then(function(){for(var f=[],d=["right","left","up","down","front","back"],p=0,v=e.observers;p<v.length;p++){for(var g=v[p],h=0,m=d;h<m.length;h++){var y=m[h],A=__assign({key:"pano.".concat(panoStringify(g.pano),".").concat(y)},pick(r.imageOptions,["size","format","quality","mappings"])),E=g.images[y],b=applyImageURLOptions(E,r.imageOptions.transform,A);f.push({url:b,type:"pano"})}if(g.images.tiles)for(var T=0,_=g.images.tiles;T<_.length;T++)for(var R=_[T],S=0,M=d;S<M.length;S++)for(var y=M[S],B=R.size,H=Math.pow(2,R.level),w=1/H,C=0;C<H;C++)for(var L=0;L<H;L++){var I="".concat(g.panoId,".").concat(y,".").concat(R.level,".").concat(C,".").concat(L),A=__assign(__assign({key:"pano_tile.".concat(I)},pick(r.imageOptions,["format","size","quality","sharpen","mappings"])),{size:R.scale>=1?void 0:B*w*R.scale,cut:[B*w*L,B*w*C,B*w,B*w]}),b=applyImageURLOptions(R[y],r.imageOptions.transform,A);f.push({url:b,type:"pano_tile"})}}for(var F=0,k=u;F<k.length;F++){var N=k[F];N.tileset.url&&f.push({url:N.tileset.url,type:"model"}),f.push.apply(f,c(N.tileset.root))}return f})},Object.defineProperty(t.prototype,"internalLightsEnabled",{get:function(){var e=this.scene.children.find(function(r){return r.name==="internalLights"});return e?e.visible:!1},set:function(e){var r=this.scene.children.find(function(o){return o.name==="internalLights"});r&&(r.visible=e)},enumerable:!1,configurable:!0}),t.Mode={Panorama:"Panorama",Model:"Model",Floorplan:"Floorplan",Topview:"Topview",Mapview:"Mapview",VRPanorama:"VRPanorama",XRPanorama:"XRPanorama"},t.Line=null,t}(Subscribe),__FIVE_DEBUG__={instances:{},constructor:Five};typeof window!="undefined"&&Object.assign(window,{__FIVE_DEBUG__});var XRButton=function(){function n(){}return n.createButton=function(t){var e=document.createElement("button");function r(){e.style.display="",e.style.cursor="pointer",e.style.left="calc(50% - 50px)",e.style.width="100px",e.textContent="ENTER VR",e.onmouseenter=function(){e.style.opacity="1.0"},e.onmouseleave=function(){e.style.opacity="0.5"},e.onclick=function(){t&&t()}}function o(){e.style.display="",e.style.cursor="auto",e.style.left="calc(50% - 75px)",e.style.width="150px",e.onmouseenter=null,e.onmouseleave=null,e.onclick=null}function s(){o(),e.textContent="VR NOT SUPPORTED"}function u(c){c.style.position="absolute",c.style.bottom="20px",c.style.padding="12px 6px",c.style.border="1px solid #fff",c.style.borderRadius="4px",c.style.background="rgba(0,0,0,0.1)",c.style.color="#fff",c.style.font="normal 13px sans-serif",c.style.textAlign="center",c.style.opacity="0.5",c.style.outline="none",c.style.zIndex="999"}if("xr"in navigator)return e.id="VRButton",e.style.display="none",u(e),navigator.xr.isSessionSupported("immersive-vr").then(function(c){c?r():s()}),e;var l=document.createElement("a");return window.isSecureContext===!1?(l.href=document.location.href.replace(/^http:/,"https:"),l.innerHTML="WEBXR NEEDS HTTPS"):(l.href="https://immersiveweb.dev/",l.innerHTML="WEBXR NOT AVAILABLE"),l.style.left="calc(50% - 90px)",l.style.width="180px",l.style.textDecoration="none",u(l),l},n}();exports.AnimationFrameLoop=AnimationFrameLoop,exports.Camera=Camera,exports.CustomShader=CustomShader,exports.Fetcher=Fetcher,exports.Five=Five,exports.InternalWebGLRenderer=InternalWebGLRenderer,exports.IntersectMesh=IntersectMesh,exports.Model=Model,exports.ModelViewLayer=ModelViewLayer,exports.NetworkSubscribe=NetworkSubscribe,exports.PBMContainer=PBMContainer,exports.PBMGroup=PBMGroup,exports.PBMMesh=PBMMesh,exports.PBMMeshMaterial=PBMMeshMaterial,exports.PBMPointCloud=PBMPointCloud,exports.PBMPointCloudMaterial=PBMPointCloudMaterial,exports.PROXY_CONTROLLER_EVENT_NAMES=PROXY_CONTROLLER_EVENT_NAMES,exports.PanoCircleMesh=PanoCircleMesh,exports.PanoCircleMeshCustom=PanoCircleMeshCustom,exports.PanoCircleMeshSolid=PanoCircleMeshSolid,exports.Scene=Scene,exports.Subscribe=Subscribe,exports.TextureLoader=TextureLoader,exports.Tile=Tile,exports.Tile3DModel=Tile3DModel,exports.TileCache=TileCache,exports.TileCubeTextureTarget=TileCubeTextureTarget,exports.TileNode=TileNode,exports.TileRequestScheduler=TileRequestScheduler,exports.Tileset=Tileset,exports.Trajectory=Trajectory,exports.TrajectoryNode=TrajectoryNode,exports.Work=Work,exports.XRButton=XRButton,exports.defaultImageURLTransform=imageURL,exports.defaultPbmParameters=defaultPbmParameters,exports.getViewportScale=getViewportScale,exports.imageSupport=imageSupport,exports.isPanoId=isPanoId,exports.loadAt3d=loadAt3d,exports.loadB3dm=loadB3dm,exports.loadDome=loadDome,exports.loadDomez=loadDomez,exports.loadFbx=loadFbx,exports.loadGlb=loadGlb,exports.loadPbm=loadPbm,exports.loadPly=loadPly,exports.loadPnts=loadPnts,exports.loadX3p=loadX3p,exports.panoEqual=panoEqual,exports.panoParse=panoParse,exports.panoStringify=panoStringify,exports.parseWork=parseWork,Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"})});
|