@realsee/five 6.5.1 → 6.5.2
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/five/index.js +24 -24
- package/five/index.mjs +1144 -1127
- 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/work-downloader/index.js +2 -2
- package/work-downloader/index.mjs +2 -2
package/five/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
3
|
* @realsee/five
|
|
4
|
-
* Generated: 8/
|
|
5
|
-
* Version: 6.5.
|
|
4
|
+
* Generated: 2025/8/11
|
|
5
|
+
* Version: 6.5.2
|
|
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 h(){}return{extend:function(g){h.prototype=this;var A=new h;return g&&A.mixIn(g),A.hasOwnProperty("init")||(A.init=function(){A.$super.init.apply(this,arguments)}),A.init.prototype=A,A.$super=this,A},create:function(){var g=this.extend();return g.init.apply(g,arguments),g},init:function(){},mixIn:function(g){for(var A in g)g.hasOwnProperty(A)&&(this[A]=g[A]);g.hasOwnProperty("toString")&&(this.toString=g.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),s=r.WordArray=o.extend({init:function(h,g){h=this.words=h||[],g!=t?this.sigBytes=g:this.sigBytes=h.length*4},toString:function(h){return(h||l).stringify(this)},concat:function(h){var g=this.words,A=h.words,m=this.sigBytes,E=h.sigBytes;if(this.clamp(),m%4)for(var v=0;v<E;v++){var y=A[v>>>2]>>>24-v%4*8&255;g[m+v>>>2]|=y<<24-(m+v)%4*8}else for(var v=0;v<E;v+=4)g[m+v>>>2]=A[v>>>2];return this.sigBytes+=E,this},clamp:function(){var h=this.words,g=this.sigBytes;h[g>>>2]&=4294967295<<32-g%4*8,h.length=n.ceil(g/4)},clone:function(){var h=o.clone.call(this);return h.words=this.words.slice(0),h},random:function(h){for(var g=[],A=0;A<h;A+=4)g.push(n.random()*4294967296|0);return new s.init(g,h)}}),u=e.enc={},l=u.Hex={stringify:function(h){for(var g=h.words,A=h.sigBytes,m=[],E=0;E<A;E++){var v=g[E>>>2]>>>24-E%4*8&255;m.push((v>>>4).toString(16)),m.push((v&15).toString(16))}return m.join("")},parse:function(h){for(var g=h.length,A=[],m=0;m<g;m+=2)A[m>>>3]|=parseInt(h.substr(m,2),16)<<24-m%8*4;return new s.init(A,g/2)}},c=u.Latin1={stringify:function(h){for(var g=h.words,A=h.sigBytes,m=[],E=0;E<A;E++){var v=g[E>>>2]>>>24-E%4*8&255;m.push(String.fromCharCode(v))}return m.join("")},parse:function(h){for(var g=h.length,A=[],m=0;m<g;m++)A[m>>>2]|=(h.charCodeAt(m)&255)<<24-m%4*8;return new s.init(A,g)}},p=u.Utf8={stringify:function(h){try{return decodeURIComponent(escape(c.stringify(h)))}catch(g){throw new Error("Malformed UTF-8 data")}},parse:function(h){return c.parse(unescape(encodeURIComponent(h)))}},f=r.BufferedBlockAlgorithm=o.extend({reset:function(){this._data=new s.init,this._nDataBytes=0},_append:function(h){typeof h=="string"&&(h=p.parse(h)),this._data.concat(h),this._nDataBytes+=h.sigBytes},_process:function(h){var g=this._data,A=g.words,m=g.sigBytes,E=this.blockSize,v=E*4,y=m/v;h?y=n.ceil(y):y=n.max((y|0)-this._minBufferSize,0);var b=y*E,T=n.min(b*4,m);if(b){for(var _=0;_<b;_+=E)this._doProcessBlock(A,_);var S=A.splice(0,b);g.sigBytes-=T}return new s.init(S,T)},clone:function(){var h=o.clone.call(this);return h._data=this._data.clone(),h},_minBufferSize:0});r.Hasher=f.extend({cfg:o.extend(),init:function(h){this.cfg=this.cfg.extend(h),this.reset()},reset:function(){f.reset.call(this),this._doReset()},update:function(h){return this._append(h),this._process(),this},finalize:function(h){h&&this._append(h);var g=this._doFinalize();return g},blockSize:512/32,_createHelper:function(h){return function(g,A){return new h.init(A).finalize(g)}},_createHmacHelper:function(h){return function(g,A){return new d.HMAC.init(h,A).finalize(g)}}});var d=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 p;e:{p=l;for(var f=n.sqrt(p),d=2;d<=f;d++)if(!(p%d)){p=!1;break e}p=!0}p&&(8>c&&(o[c]=u(n.pow(l,.5))),s[c]=u(n.pow(l,1/3)),c++),l++}var h=[],g=g.SHA256=r.extend({_doReset:function(){this._hash=new e.init(o.slice(0))},_doProcessBlock:function(A,m){for(var E=this._hash.words,v=E[0],y=E[1],b=E[2],T=E[3],_=E[4],S=E[5],R=E[6],M=E[7],H=0;64>H;H++){if(16>H)h[H]=A[m+H]|0;else{var B=h[H-15],C=h[H-2];h[H]=((B<<25|B>>>7)^(B<<14|B>>>18)^B>>>3)+h[H-7]+((C<<15|C>>>17)^(C<<13|C>>>19)^C>>>10)+h[H-16]}B=M+((_<<26|_>>>6)^(_<<21|_>>>11)^(_<<7|_>>>25))+(_&S^~_&R)+s[H]+h[H],C=((v<<30|v>>>2)^(v<<19|v>>>13)^(v<<10|v>>>22))+(v&y^v&b^y&b),M=R,R=S,S=_,_=T+B|0,T=b,b=y,y=v,v=B+C|0}E[0]=E[0]+v|0,E[1]=E[1]+y|0,E[2]=E[2]+b|0,E[3]=E[3]+T|0,E[4]=E[4]+_|0,E[5]=E[5]+S|0,E[6]=E[6]+R|0,E[7]=E[7]+M|0},_doFinalize:function(){var A=this._data,m=A.words,E=8*this._nDataBytes,v=8*A.sigBytes;return m[v>>>5]|=128<<24-v%32,m[(v+64>>>9<<4)+14]=n.floor(E/4294967296),m[(v+64>>>9<<4)+15]=E,A.sigBytes=4*m.length,this._process(),this._hash},clone:function(){var A=r.clone.call(this);return A._hash=this._hash.clone(),A}});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,E){return this.create(this._ENC_XFORM_MODE,m,E)},createDecryptor:function(m,E){return this.create(this._DEC_XFORM_MODE,m,E)},init:function(m,E,v){this.cfg=this.cfg.extend(v),this._xformMode=m,this._key=E,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(E,v,y){return(typeof v=="string"?A:h).encrypt(m,E,v,y)},decrypt:function(E,v,y){return(typeof v=="string"?A:h).decrypt(m,E,v,y)}}}});t.StreamCipher=l.extend({_doFinalize:function(){return this._process(!0)},blockSize:1});var d=g.mode={},c=function(m,E,v){var y=this._iv;y?this._iv=n:y=this._prevBlock;for(var b=0;b<v;b++)m[E+b]^=y[b]},p=(t.BlockCipherMode=e.extend({createEncryptor:function(m,E){return this.Encryptor.create(m,E)},createDecryptor:function(m,E){return this.Decryptor.create(m,E)},init:function(m,E){this._cipher=m,this._iv=E}})).extend();p.Encryptor=p.extend({processBlock:function(m,E){var v=this._cipher,y=v.blockSize;c.call(this,m,E,y),v.encryptBlock(m,E),this._prevBlock=m.slice(E,E+y)}}),p.Decryptor=p.extend({processBlock:function(m,E){var v=this._cipher,y=v.blockSize,b=m.slice(E,E+y);v.decryptBlock(m,E),c.call(this,m,E,y),this._prevBlock=b}}),d=d.CBC=p,p=(g.pad={}).Pkcs7={pad:function(m,E){for(var v=4*E,v=v-m.sigBytes%v,y=v<<24|v<<16|v<<8|v,b=[],T=0;T<v;T+=4)b.push(y);v=r.create(b,v),m.concat(v)},unpad:function(m){m.sigBytes-=m.words[m.sigBytes-1>>>2]&255}},t.BlockCipher=l.extend({cfg:l.cfg.extend({mode:d,padding:p}),reset:function(){l.reset.call(this);var E=this.cfg,m=E.iv,E=E.mode;if(this._xformMode==this._ENC_XFORM_MODE)var v=E.createEncryptor;else v=E.createDecryptor,this._minBufferSize=1;this._mode=v.call(E,this,m&&m.words)},_doProcessBlock:function(m,E){this._mode.processBlock(m,E)},_doFinalize:function(){var m=this.cfg.padding;if(this._xformMode==this._ENC_XFORM_MODE){m.pad(this._data,this.blockSize);var E=this._process(!0)}else E=this._process(!0),m.unpad(E);return E},blockSize:4});var f=t.CipherParams=e.extend({init:function(m){this.mixIn(m)},toString:function(m){return(m||this.formatter).stringify(this)}}),d=(g.format={}).OpenSSL={stringify:function(m){var E=m.ciphertext;return m=m.salt,(m?r.create([1398893684,1701076831]).concat(m).concat(E):E).toString(s)},parse:function(m){m=s.parse(m);var E=m.words;if(E[0]==1398893684&&E[1]==1701076831){var v=r.create(E.slice(2,4));E.splice(0,4),m.sigBytes-=16}return f.create({ciphertext:m,salt:v})}},h=t.SerializableCipher=e.extend({cfg:e.extend({format:d}),encrypt:function(m,E,v,y){y=this.cfg.extend(y);var b=m.createEncryptor(v,y);return E=b.finalize(E),b=b.cfg,f.create({ciphertext:E,key:v,iv:b.iv,algorithm:m,mode:b.mode,padding:b.padding,blockSize:m.blockSize,formatter:y.format})},decrypt:function(m,E,v,y){return y=this.cfg.extend(y),E=this._parse(E,y.format),m.createDecryptor(v,y).finalize(E.ciphertext)},_parse:function(m,E){return typeof m=="string"?E.parse(m,this):m}}),g=(g.kdf={}).OpenSSL={execute:function(m,E,v,y){return y||(y=r.random(8)),m=u.create({keySize:E+v}).compute(m,y),v=r.create(m.words.slice(E),4*v),m.sigBytes=4*E,f.create({key:m,iv:v,salt:y})}},A=t.PasswordBasedCipher=h.extend({cfg:h.cfg.extend({kdf:g}),encrypt:function(m,E,v,y){return y=this.cfg.extend(y),v=y.kdf.execute(v,m.keySize,m.ivSize),y.iv=v.iv,m=h.encrypt.call(this,m,E,v.key,y),m.mixIn(v),m},decrypt:function(m,E,v,y){return y=this.cfg.extend(y),E=this._parse(E,y.format),v=y.kdf.execute(v,m.keySize,m.ivSize,E.salt),y.iv=v.iv,h.decrypt.call(this,m,E,v.key,y)}})}();(function(){for(var n=CryptoJS,t=n.lib.BlockCipher,S=n.algo,e=[],r=[],o=[],s=[],u=[],l=[],c=[],p=[],f=[],d=[],h=[],g=0;256>g;g++)h[g]=128>g?g<<1:g<<1^283;for(var A=0,m=0,g=0;256>g;g++){var E=m^m<<1^m<<2^m<<3^m<<4,E=E>>>8^E&255^99;e[A]=E,r[E]=A;var v=h[A],y=h[v],b=h[y],T=257*h[E]^16843008*E;o[A]=T<<24|T>>>8,s[A]=T<<16|T>>>16,u[A]=T<<8|T>>>24,l[A]=T,T=16843009*b^65537*y^257*v^16843008*A,c[E]=T<<24|T>>>8,p[E]=T<<16|T>>>16,f[E]=T<<8|T>>>24,d[E]=T,A?(A=v^h[h[h[b^v]]],m^=h[h[m]]):A=m=1}var _=[0,1,2,4,8,16,32,64,128,27,54],S=S.AES=t.extend({_doReset:function(){for(var H=this._key,R=H.words,M=H.sigBytes/4,H=4*((this._nRounds=M+6)+1),B=this._keySchedule=[],C=0;C<H;C++)if(C<M)B[C]=R[C];else{var w=B[C-1];C%M?6<M&&C%M==4&&(w=e[w>>>24]<<24|e[w>>>16&255]<<16|e[w>>>8&255]<<8|e[w&255]):(w=w<<8|w>>>24,w=e[w>>>24]<<24|e[w>>>16&255]<<16|e[w>>>8&255]<<8|e[w&255],w^=_[C/M|0]<<24),B[C]=B[C-M]^w}for(R=this._invKeySchedule=[],M=0;M<H;M++)C=H-M,w=M%4?B[C]:B[C-4],R[M]=4>M||4>=C?w:c[e[w>>>24]]^p[e[w>>>16&255]]^f[e[w>>>8&255]]^d[e[w&255]]},encryptBlock:function(R,M){this._doCryptBlock(R,M,this._keySchedule,o,s,u,l,e)},decryptBlock:function(R,M){var H=R[M+1];R[M+1]=R[M+3],R[M+3]=H,this._doCryptBlock(R,M,this._invKeySchedule,c,p,f,d,r),H=R[M+1],R[M+1]=R[M+3],R[M+3]=H},_doCryptBlock:function(R,M,H,B,C,w,I,O){for(var L=this._nRounds,q=R[M]^H[0],X=R[M+1]^H[1],Z=R[M+2]^H[2],U=R[M+3]^H[3],N=4,z=1;z<L;z++)var J=B[q>>>24]^C[X>>>16&255]^w[Z>>>8&255]^I[U&255]^H[N++],K=B[X>>>24]^C[Z>>>16&255]^w[U>>>8&255]^I[q&255]^H[N++],Q=B[Z>>>24]^C[U>>>16&255]^w[q>>>8&255]^I[X&255]^H[N++],U=B[U>>>24]^C[q>>>16&255]^w[X>>>8&255]^I[Z&255]^H[N++],q=J,X=K,Z=Q;J=(O[q>>>24]<<24|O[X>>>16&255]<<16|O[Z>>>8&255]<<8|O[U&255])^H[N++],K=(O[X>>>24]<<24|O[Z>>>16&255]<<16|O[U>>>8&255]<<8|O[q&255])^H[N++],Q=(O[Z>>>24]<<24|O[U>>>16&255]<<16|O[q>>>8&255]<<8|O[X&255])^H[N++],U=(O[U>>>24]<<24|O[q>>>16&255]<<16|O[X>>>8&255]<<8|O[Z&255])^H[N++],R[M]=J,R[M+1]=K,R[M+2]=Q,R[M+3]=U},keySize:8});n.AES=t._createHelper(S)})();/*! (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 h(){}return{extend:function(g){h.prototype=this;var A=new h;return g&&A.mixIn(g),A.hasOwnProperty("init")||(A.init=function(){A.$super.init.apply(this,arguments)}),A.init.prototype=A,A.$super=this,A},create:function(){var g=this.extend();return g.init.apply(g,arguments),g},init:function(){},mixIn:function(g){for(var A in g)g.hasOwnProperty(A)&&(this[A]=g[A]);g.hasOwnProperty("toString")&&(this.toString=g.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),s=r.WordArray=o.extend({init:function(h,g){h=this.words=h||[],g!=t?this.sigBytes=g:this.sigBytes=h.length*4},toString:function(h){return(h||l).stringify(this)},concat:function(h){var g=this.words,A=h.words,m=this.sigBytes,E=h.sigBytes;if(this.clamp(),m%4)for(var v=0;v<E;v++){var y=A[v>>>2]>>>24-v%4*8&255;g[m+v>>>2]|=y<<24-(m+v)%4*8}else for(var v=0;v<E;v+=4)g[m+v>>>2]=A[v>>>2];return this.sigBytes+=E,this},clamp:function(){var h=this.words,g=this.sigBytes;h[g>>>2]&=4294967295<<32-g%4*8,h.length=n.ceil(g/4)},clone:function(){var h=o.clone.call(this);return h.words=this.words.slice(0),h},random:function(h){for(var g=[],A=0;A<h;A+=4)g.push(n.random()*4294967296|0);return new s.init(g,h)}}),u=e.enc={},l=u.Hex={stringify:function(h){for(var g=h.words,A=h.sigBytes,m=[],E=0;E<A;E++){var v=g[E>>>2]>>>24-E%4*8&255;m.push((v>>>4).toString(16)),m.push((v&15).toString(16))}return m.join("")},parse:function(h){for(var g=h.length,A=[],m=0;m<g;m+=2)A[m>>>3]|=parseInt(h.substr(m,2),16)<<24-m%8*4;return new s.init(A,g/2)}},c=u.Latin1={stringify:function(h){for(var g=h.words,A=h.sigBytes,m=[],E=0;E<A;E++){var v=g[E>>>2]>>>24-E%4*8&255;m.push(String.fromCharCode(v))}return m.join("")},parse:function(h){for(var g=h.length,A=[],m=0;m<g;m++)A[m>>>2]|=(h.charCodeAt(m)&255)<<24-m%4*8;return new s.init(A,g)}},p=u.Utf8={stringify:function(h){try{return decodeURIComponent(escape(c.stringify(h)))}catch(g){throw new Error("Malformed UTF-8 data")}},parse:function(h){return c.parse(unescape(encodeURIComponent(h)))}},f=r.BufferedBlockAlgorithm=o.extend({reset:function(){this._data=new s.init,this._nDataBytes=0},_append:function(h){typeof h=="string"&&(h=p.parse(h)),this._data.concat(h),this._nDataBytes+=h.sigBytes},_process:function(h){var g=this._data,A=g.words,m=g.sigBytes,E=this.blockSize,v=E*4,y=m/v;h?y=n.ceil(y):y=n.max((y|0)-this._minBufferSize,0);var b=y*E,T=n.min(b*4,m);if(b){for(var _=0;_<b;_+=E)this._doProcessBlock(A,_);var S=A.splice(0,b);g.sigBytes-=T}return new s.init(S,T)},clone:function(){var h=o.clone.call(this);return h._data=this._data.clone(),h},_minBufferSize:0});r.Hasher=f.extend({cfg:o.extend(),init:function(h){this.cfg=this.cfg.extend(h),this.reset()},reset:function(){f.reset.call(this),this._doReset()},update:function(h){return this._append(h),this._process(),this},finalize:function(h){h&&this._append(h);var g=this._doFinalize();return g},blockSize:512/32,_createHelper:function(h){return function(g,A){return new h.init(A).finalize(g)}},_createHmacHelper:function(h){return function(g,A){return new d.HMAC.init(h,A).finalize(g)}}});var d=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 p;e:{p=l;for(var f=n.sqrt(p),d=2;d<=f;d++)if(!(p%d)){p=!1;break e}p=!0}p&&(8>c&&(o[c]=u(n.pow(l,.5))),s[c]=u(n.pow(l,1/3)),c++),l++}var h=[],g=g.SHA256=r.extend({_doReset:function(){this._hash=new e.init(o.slice(0))},_doProcessBlock:function(A,m){for(var E=this._hash.words,v=E[0],y=E[1],b=E[2],T=E[3],_=E[4],S=E[5],R=E[6],M=E[7],H=0;64>H;H++){if(16>H)h[H]=A[m+H]|0;else{var B=h[H-15],C=h[H-2];h[H]=((B<<25|B>>>7)^(B<<14|B>>>18)^B>>>3)+h[H-7]+((C<<15|C>>>17)^(C<<13|C>>>19)^C>>>10)+h[H-16]}B=M+((_<<26|_>>>6)^(_<<21|_>>>11)^(_<<7|_>>>25))+(_&S^~_&R)+s[H]+h[H],C=((v<<30|v>>>2)^(v<<19|v>>>13)^(v<<10|v>>>22))+(v&y^v&b^y&b),M=R,R=S,S=_,_=T+B|0,T=b,b=y,y=v,v=B+C|0}E[0]=E[0]+v|0,E[1]=E[1]+y|0,E[2]=E[2]+b|0,E[3]=E[3]+T|0,E[4]=E[4]+_|0,E[5]=E[5]+S|0,E[6]=E[6]+R|0,E[7]=E[7]+M|0},_doFinalize:function(){var A=this._data,m=A.words,E=8*this._nDataBytes,v=8*A.sigBytes;return m[v>>>5]|=128<<24-v%32,m[(v+64>>>9<<4)+14]=n.floor(E/4294967296),m[(v+64>>>9<<4)+15]=E,A.sigBytes=4*m.length,this._process(),this._hash},clone:function(){var A=r.clone.call(this);return A._hash=this._hash.clone(),A}});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,E){return this.create(this._ENC_XFORM_MODE,m,E)},createDecryptor:function(m,E){return this.create(this._DEC_XFORM_MODE,m,E)},init:function(m,E,v){this.cfg=this.cfg.extend(v),this._xformMode=m,this._key=E,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(E,v,y){return(typeof v=="string"?A:h).encrypt(m,E,v,y)},decrypt:function(E,v,y){return(typeof v=="string"?A:h).decrypt(m,E,v,y)}}}});t.StreamCipher=l.extend({_doFinalize:function(){return this._process(!0)},blockSize:1});var d=g.mode={},c=function(m,E,v){var y=this._iv;y?this._iv=n:y=this._prevBlock;for(var b=0;b<v;b++)m[E+b]^=y[b]},p=(t.BlockCipherMode=e.extend({createEncryptor:function(m,E){return this.Encryptor.create(m,E)},createDecryptor:function(m,E){return this.Decryptor.create(m,E)},init:function(m,E){this._cipher=m,this._iv=E}})).extend();p.Encryptor=p.extend({processBlock:function(m,E){var v=this._cipher,y=v.blockSize;c.call(this,m,E,y),v.encryptBlock(m,E),this._prevBlock=m.slice(E,E+y)}}),p.Decryptor=p.extend({processBlock:function(m,E){var v=this._cipher,y=v.blockSize,b=m.slice(E,E+y);v.decryptBlock(m,E),c.call(this,m,E,y),this._prevBlock=b}}),d=d.CBC=p,p=(g.pad={}).Pkcs7={pad:function(m,E){for(var v=4*E,v=v-m.sigBytes%v,y=v<<24|v<<16|v<<8|v,b=[],T=0;T<v;T+=4)b.push(y);v=r.create(b,v),m.concat(v)},unpad:function(m){m.sigBytes-=m.words[m.sigBytes-1>>>2]&255}},t.BlockCipher=l.extend({cfg:l.cfg.extend({mode:d,padding:p}),reset:function(){l.reset.call(this);var E=this.cfg,m=E.iv,E=E.mode;if(this._xformMode==this._ENC_XFORM_MODE)var v=E.createEncryptor;else v=E.createDecryptor,this._minBufferSize=1;this._mode=v.call(E,this,m&&m.words)},_doProcessBlock:function(m,E){this._mode.processBlock(m,E)},_doFinalize:function(){var m=this.cfg.padding;if(this._xformMode==this._ENC_XFORM_MODE){m.pad(this._data,this.blockSize);var E=this._process(!0)}else E=this._process(!0),m.unpad(E);return E},blockSize:4});var f=t.CipherParams=e.extend({init:function(m){this.mixIn(m)},toString:function(m){return(m||this.formatter).stringify(this)}}),d=(g.format={}).OpenSSL={stringify:function(m){var E=m.ciphertext;return m=m.salt,(m?r.create([1398893684,1701076831]).concat(m).concat(E):E).toString(s)},parse:function(m){m=s.parse(m);var E=m.words;if(E[0]==1398893684&&E[1]==1701076831){var v=r.create(E.slice(2,4));E.splice(0,4),m.sigBytes-=16}return f.create({ciphertext:m,salt:v})}},h=t.SerializableCipher=e.extend({cfg:e.extend({format:d}),encrypt:function(m,E,v,y){y=this.cfg.extend(y);var b=m.createEncryptor(v,y);return E=b.finalize(E),b=b.cfg,f.create({ciphertext:E,key:v,iv:b.iv,algorithm:m,mode:b.mode,padding:b.padding,blockSize:m.blockSize,formatter:y.format})},decrypt:function(m,E,v,y){return y=this.cfg.extend(y),E=this._parse(E,y.format),m.createDecryptor(v,y).finalize(E.ciphertext)},_parse:function(m,E){return typeof m=="string"?E.parse(m,this):m}}),g=(g.kdf={}).OpenSSL={execute:function(m,E,v,y){return y||(y=r.random(8)),m=u.create({keySize:E+v}).compute(m,y),v=r.create(m.words.slice(E),4*v),m.sigBytes=4*E,f.create({key:m,iv:v,salt:y})}},A=t.PasswordBasedCipher=h.extend({cfg:h.cfg.extend({kdf:g}),encrypt:function(m,E,v,y){return y=this.cfg.extend(y),v=y.kdf.execute(v,m.keySize,m.ivSize),y.iv=v.iv,m=h.encrypt.call(this,m,E,v.key,y),m.mixIn(v),m},decrypt:function(m,E,v,y){return y=this.cfg.extend(y),E=this._parse(E,y.format),v=y.kdf.execute(v,m.keySize,m.ivSize,E.salt),y.iv=v.iv,h.decrypt.call(this,m,E,v.key,y)}})}();(function(){for(var n=CryptoJS,t=n.lib.BlockCipher,S=n.algo,e=[],r=[],o=[],s=[],u=[],l=[],c=[],p=[],f=[],d=[],h=[],g=0;256>g;g++)h[g]=128>g?g<<1:g<<1^283;for(var A=0,m=0,g=0;256>g;g++){var E=m^m<<1^m<<2^m<<3^m<<4,E=E>>>8^E&255^99;e[A]=E,r[E]=A;var v=h[A],y=h[v],b=h[y],T=257*h[E]^16843008*E;o[A]=T<<24|T>>>8,s[A]=T<<16|T>>>16,u[A]=T<<8|T>>>24,l[A]=T,T=16843009*b^65537*y^257*v^16843008*A,c[E]=T<<24|T>>>8,p[E]=T<<16|T>>>16,f[E]=T<<8|T>>>24,d[E]=T,A?(A=v^h[h[h[b^v]]],m^=h[h[m]]):A=m=1}var _=[0,1,2,4,8,16,32,64,128,27,54],S=S.AES=t.extend({_doReset:function(){for(var H=this._key,R=H.words,M=H.sigBytes/4,H=4*((this._nRounds=M+6)+1),B=this._keySchedule=[],C=0;C<H;C++)if(C<M)B[C]=R[C];else{var w=B[C-1];C%M?6<M&&C%M==4&&(w=e[w>>>24]<<24|e[w>>>16&255]<<16|e[w>>>8&255]<<8|e[w&255]):(w=w<<8|w>>>24,w=e[w>>>24]<<24|e[w>>>16&255]<<16|e[w>>>8&255]<<8|e[w&255],w^=_[C/M|0]<<24),B[C]=B[C-M]^w}for(R=this._invKeySchedule=[],M=0;M<H;M++)C=H-M,w=M%4?B[C]:B[C-4],R[M]=4>M||4>=C?w:c[e[w>>>24]]^p[e[w>>>16&255]]^f[e[w>>>8&255]]^d[e[w&255]]},encryptBlock:function(R,M){this._doCryptBlock(R,M,this._keySchedule,o,s,u,l,e)},decryptBlock:function(R,M){var H=R[M+1];R[M+1]=R[M+3],R[M+3]=H,this._doCryptBlock(R,M,this._invKeySchedule,c,p,f,d,r),H=R[M+1],R[M+1]=R[M+3],R[M+3]=H},_doCryptBlock:function(R,M,H,B,C,w,I,O){for(var L=this._nRounds,q=R[M]^H[0],K=R[M+1]^H[1],Y=R[M+2]^H[2],U=R[M+3]^H[3],N=4,z=1;z<L;z++)var J=B[q>>>24]^C[K>>>16&255]^w[Y>>>8&255]^I[U&255]^H[N++],G=B[K>>>24]^C[Y>>>16&255]^w[U>>>8&255]^I[q&255]^H[N++],Q=B[Y>>>24]^C[U>>>16&255]^w[q>>>8&255]^I[K&255]^H[N++],U=B[U>>>24]^C[q>>>16&255]^w[K>>>8&255]^I[Y&255]^H[N++],q=J,K=G,Y=Q;J=(O[q>>>24]<<24|O[K>>>16&255]<<16|O[Y>>>8&255]<<8|O[U&255])^H[N++],G=(O[K>>>24]<<24|O[Y>>>16&255]<<16|O[U>>>8&255]<<8|O[q&255])^H[N++],Q=(O[Y>>>24]<<24|O[U>>>16&255]<<16|O[q>>>8&255]<<8|O[K&255])^H[N++],U=(O[U>>>24]<<24|O[q>>>16&255]<<16|O[K>>>8&255]<<8|O[Y&255])^H[N++],R[M]=J,R[M+1]=G,R[M+2]=Q,R[M+3]=U},keySize:8});n.AES=t._createHelper(S)})();/*! (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,p=this[n++]>>15,f=l*c+p*u;c=u*c+((f&32767)<<15)+e[r]+(o&1073741823),o=(c>>>30)+(f>>>15)+l*p+(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,p=this[n++]>>14,f=l*c+p*u;c=u*c+((f&16383)<<14)+e[r]+o,o=(c>>28)+(f>>14)+l*p,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;rr=48;for(vv=0;vv<=9;++vv)BI_RC[rr++]=vv;rr=97;for(vv=10;vv<36;++vv)BI_RC[rr++]=vv;rr=65;for(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 p=s.t,f=s[p-1];if(f!=0){var d=f*(1<<this.F1)+(p>1?s[p-2]>>this.F2:0),h=this.FV/d,g=(1<<this.F1)/d,A=1<<this.F2,m=e.t,E=m-p,v=t==null?nbi():t;for(s.dlShiftTo(E,v),e.compareTo(v)>=0&&(e[e.t++]=1,e.subTo(v,e)),BigInteger.ONE.dlShiftTo(p,v),v.subTo(s,s);s.t<p;)s[s.t++]=0;for(;--E>=0;){var y=e[--m]==f?this.DM:Math.floor(e[m]*h+(e[m-1]+A)*g);if((e[m]+=s.am(0,y,e,E,0,p))<y)for(s.dlShiftTo(E,v),e.subTo(v,e);e[m]<--y;)e.subTo(v,e)}t!=null&&(e.drShiftTo(p,t),u!=l&&BigInteger.ZERO.subTo(t,t)),e.t=p,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 p=e("")+l+""+n,f=new Array(r);new SecureRandom().nextBytes(f);var d=oaep_mgf1_arr(f,p.length,e),h=[];for(c=0;c<p.length;c+=1)h[c]=p.charCodeAt(c)^d.charCodeAt(c);var g=oaep_mgf1_arr(h,f.length,e),A=[0];for(c=0;c<f.length;c+=1)A[c+1]=f[c]^g.charCodeAt(c);return new BigInteger(A.concat(h))}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(E){return hextorstr(s.hashHex(rstrtohex(E),u))}),n=n.toByteArray();var d;for(d=0;d<n.length;d+=1)n[d]&=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),p=oaep_mgf1_str(c,r,e),f=[],d;for(d=0;d<l.length;d+=1)f[d]=l.charCodeAt(d)^p.charCodeAt(d);var h=oaep_mgf1_str(String.fromCharCode.apply(String,f),n.length-r,e),g=[];for(d=0;d<c.length;d+=1)g[d]=c.charCodeAt(d)^h.charCodeAt(d);if(g=String.fromCharCode.apply(String,g),g.substr(0,r)!==e(""))throw"Hash mismatch";g=g.substr(r);var A=g.indexOf(""),m=A!=-1?g.substr(0,A).lastIndexOf("\0"):-1;if(m+1!=A)throw"Malformed data";return g.substr(A+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,13 +359,13 @@
|
|
|
359
359
|
`,H+=`\r
|
|
360
360
|
`,H+=M,H+=`\r
|
|
361
361
|
-----END `+A+` PRIVATE KEY-----\r
|
|
362
|
-
`,H},parseHexOfEncryptedPKCS8:function(A){var m=ASN1HEX,E=m.getChildIdx,v=m.getV,y={},b=E(A,0);if(b.length!=2)throw"malformed format: SEQUENCE(0).items != 2: "+b.length;y.ciphertext=v(A,b[1]);var T=E(A,b[0]);if(T.length!=2)throw"malformed format: SEQUENCE(0.0).items != 2: "+T.length;if(v(A,T[0])!="2a864886f70d01050d")throw"this only supports pkcs5PBES2";var _=E(A,T[1]);if(T.length!=2)throw"malformed format: SEQUENCE(0.0.1).items != 2: "+_.length;var S=E(A,_[1]);if(S.length!=2)throw"malformed format: SEQUENCE(0.0.1.1).items != 2: "+S.length;if(v(A,S[0])!="2a864886f70d0307")throw"this only supports TripleDES";y.encryptionSchemeAlg="TripleDES",y.encryptionSchemeIV=v(A,S[1]);var R=E(A,_[0]);if(R.length!=2)throw"malformed format: SEQUENCE(0.0.1.0).items != 2: "+R.length;if(v(A,R[0])!="2a864886f70d01050c")throw"this only supports pkcs5PBKDF2";var M=E(A,R[1]);if(M.length<2)throw"malformed format: SEQUENCE(0.0.1.0.1).items < 2: "+M.length;y.pbkdf2Salt=v(A,M[0]);var H=v(A,M[1]);try{y.pbkdf2Iter=parseInt(H,16)}catch(B){throw"malformed format pbkdf2Iter: "+H}return y},getPBKDF2KeyHexFromParam:function(A,m){var E=CryptoJS.enc.Hex.parse(A.pbkdf2Salt),v=A.pbkdf2Iter,y=CryptoJS.PBKDF2(m,E,{keySize:192/32,iterations:v}),b=CryptoJS.enc.Hex.stringify(y);return b},_getPlainPKCS8HexFromEncryptedPKCS8PEM:function(A,m){var E=pemtohex(A,"ENCRYPTED PRIVATE KEY"),v=this.parseHexOfEncryptedPKCS8(E),y=KEYUTIL.getPBKDF2KeyHexFromParam(v,m),b={};b.ciphertext=CryptoJS.enc.Hex.parse(v.ciphertext);var T=CryptoJS.enc.Hex.parse(y),_=CryptoJS.enc.Hex.parse(v.encryptionSchemeIV),S=CryptoJS.TripleDES.decrypt(b,T,{iv:_}),R=CryptoJS.enc.Hex.stringify(S);return R},getKeyFromEncryptedPKCS8PEM:function(A,m){var E=this._getPlainPKCS8HexFromEncryptedPKCS8PEM(A,m),v=this.getKeyFromPlainPrivatePKCS8Hex(E);return v},parsePlainPrivatePKCS8Hex:function(A){var m=ASN1HEX,E=m.getChildIdx,v=m.getV,y={};if(y.algparam=null,A.substr(0,2)!="30")throw new Error("malformed plain PKCS8 private key(code:001)");var b=E(A,0);if(b.length<3)throw new Error("malformed plain PKCS8 private key(code:002)");if(A.substr(b[1],2)!="30")throw new Error("malformed PKCS8 private key(code:003)");var T=E(A,b[1]);if(T.length!=2)throw new Error("malformed PKCS8 private key(code:004)");if(A.substr(T[0],2)!="06")throw new Error("malformed PKCS8 private key(code:005)");if(y.algoid=v(A,T[0]),A.substr(T[1],2)=="06"&&(y.algparam=v(A,T[1])),A.substr(b[2],2)!="04")throw new Error("malformed PKCS8 private key(code:006)");return y.keyidx=m.getVidx(A,b[2]),y},getKeyFromPlainPrivatePKCS8PEM:function(A){var m=pemtohex(A,"PRIVATE KEY"),E=this.getKeyFromPlainPrivatePKCS8Hex(m);return E},getKeyFromPlainPrivatePKCS8Hex:function(A){var m=this.parsePlainPrivatePKCS8Hex(A),E;if(m.algoid=="2a864886f70d010101")E=new RSAKey;else if(KJUR.crypto.DSA&&m.algoid=="2a8648ce380401")E=new KJUR.crypto.DSA;else if(KJUR.crypto.ECDSA&&m.algoid=="2a8648ce3d0201")E=new KJUR.crypto.ECDSA;else throw"unsupported private key algorithm";return E.readPKCS8PrvKeyHex(A),E},_getKeyFromPublicPKCS8Hex:function(A){var m,E=ASN1HEX.getVbyList(A,0,[0,0],"06");if(E==="2a864886f70d010101")m=new RSAKey;else if(KJUR.crypto.DSA&&E==="2a8648ce380401")m=new KJUR.crypto.DSA;else if(KJUR.crypto.ECDSA&&E==="2a8648ce3d0201")m=new KJUR.crypto.ECDSA;else throw"unsupported PKCS#8 public key hex";return m.readPKCS8PubKeyHex(A),m},parsePublicRawRSAKeyHex:function(A){var m=ASN1HEX,E=m.getChildIdx,v=m.getV,y={};if(A.substr(0,2)!="30")throw"malformed RSA key(code:001)";var b=E(A,0);if(b.length!=2)throw"malformed RSA key(code:002)";if(A.substr(b[0],2)!="02")throw"malformed RSA key(code:003)";if(y.n=v(A,b[0]),A.substr(b[1],2)!="02")throw"malformed RSA key(code:004)";return y.e=v(A,b[1]),y},parsePublicPKCS8Hex:function(A){var m=ASN1HEX,E=m.getChildIdx,v=m.getV,y={};y.algparam=null;var b=E(A,0);if(b.length!=2)throw"outer DERSequence shall have 2 elements: "+b.length;var T=b[0];if(A.substr(T,2)!="30")throw"malformed PKCS8 public key(code:001)";var _=E(A,T);if(_.length!=2)throw"malformed PKCS8 public key(code:002)";if(A.substr(_[0],2)!="06")throw"malformed PKCS8 public key(code:003)";if(y.algoid=v(A,_[0]),A.substr(_[1],2)=="06"?y.algparam=v(A,_[1]):A.substr(_[1],2)=="30"&&(y.algparam={},y.algparam.p=m.getVbyList(A,_[1],[0],"02"),y.algparam.q=m.getVbyList(A,_[1],[1],"02"),y.algparam.g=m.getVbyList(A,_[1],[2],"02")),A.substr(b[1],2)!="03")throw"malformed PKCS8 public key(code:004)";return y.key=v(A,b[1]).substr(2),y}}}();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,p=RSAKey,f=pemtohex,d=KEYUTIL;if(typeof p!="undefined"&&n instanceof p||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 h=new p;return h.setPublic(n.n,n.e),h}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 h=new p;return h.setPrivateEx(n.n,n.e,n.d,n.p,n.q,n.dp,n.dq,n.co),h}if(n.kty===void 0&&n.n!==void 0&&n.e!==void 0&&n.d!==void 0&&n.p===void 0){var h=new p;return h.setPrivate(n.n,n.e,n.d),h}if(n.p!==void 0&&n.q!==void 0&&n.g!==void 0&&n.y!==void 0&&n.x===void 0){var h=new c;return h.setPublic(n.p,n.q,n.g,n.y),h}if(n.p!==void 0&&n.q!==void 0&&n.g!==void 0&&n.y!==void 0&&n.x!==void 0){var h=new c;return h.setPrivate(n.p,n.q,n.g,n.y,n.x),h}if(n.kty==="RSA"&&n.n!==void 0&&n.e!==void 0&&n.d===void 0){var h=new p;return h.setPublic(b64utohex(n.n),b64utohex(n.e)),h}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 h=new p;return h.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)),h}if(n.kty==="RSA"&&n.n!==void 0&&n.e!==void 0&&n.d!==void 0){var h=new p;return h.setPrivate(b64utohex(n.n),b64utohex(n.e),b64utohex(n.d)),h}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}),A=g.ecparams.keylen/4,m=("0000000000"+b64utohex(n.x)).slice(-A),E=("0000000000"+b64utohex(n.y)).slice(-A),v="04"+m+E;return g.setPublicKeyHex(v),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}),A=g.ecparams.keylen/4,m=("0000000000"+b64utohex(n.x)).slice(-A),E=("0000000000"+b64utohex(n.y)).slice(-A),v="04"+m+E,y=("0000000000"+b64utohex(n.d)).slice(-A);return g.setPublicKeyHex(v),g.setPrivateKeyHex(y),g}if(e==="pkcs5prv"){var b=n,r=ASN1HEX,T,h;if(T=o(b,0),T.length===9)h=new p,h.readPKCS5PrvKeyHex(b);else if(T.length===6)h=new c,h.readPKCS5PrvKeyHex(b);else if(T.length>2&&b.substr(T[1],2)==="04")h=new l,h.readPKCS5PrvKeyHex(b);else throw"unsupported PKCS#1/5 hexadecimal key";return h}if(e==="pkcs8prv"){var h=d.getKeyFromPlainPrivatePKCS8Hex(n);return h}if(e==="pkcs8pub")return d._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 d._getKeyFromPublicPKCS8Hex(_)}if(n.indexOf("-END RSA PRIVATE KEY-")!=-1&&n.indexOf("4,ENCRYPTED")==-1){var S=f(n,"RSA PRIVATE KEY");return d.getKey(S,null,"pkcs5prv")}if(n.indexOf("-END DSA PRIVATE KEY-")!=-1&&n.indexOf("4,ENCRYPTED")==-1){var R=f(n,"DSA PRIVATE KEY"),M=s(R,0,[1],"02"),H=s(R,0,[2],"02"),B=s(R,0,[3],"02"),C=s(R,0,[4],"02"),w=s(R,0,[5],"02"),h=new c;return h.setPrivate(new BigInteger(M,16),new BigInteger(H,16),new BigInteger(B,16),new BigInteger(C,16),new BigInteger(w,16)),h}if(n.indexOf("-END EC PRIVATE KEY-")!=-1&&n.indexOf("4,ENCRYPTED")==-1){var S=f(n,"EC PRIVATE KEY");return d.getKey(S,null,"pkcs5prv")}if(n.indexOf("-END PRIVATE KEY-")!=-1)return d.getKeyFromPlainPrivatePKCS8PEM(n);if(n.indexOf("-END RSA PRIVATE KEY-")!=-1&&n.indexOf("4,ENCRYPTED")!=-1){var I=d.getDecryptedKeyHex(n,t),O=new RSAKey;return O.readPKCS5PrvKeyHex(I),O}if(n.indexOf("-END EC PRIVATE KEY-")!=-1&&n.indexOf("4,ENCRYPTED")!=-1){var R=d.getDecryptedKeyHex(n,t),h=s(R,0,[1],"04"),L=s(R,0,[2,0],"06"),N=s(R,0,[3,0],"03").substr(2),z="";if(KJUR.crypto.OID.oidhex2name[L]!==void 0)z=KJUR.crypto.OID.oidhex2name[L];else throw"undefined OID(hex) in KJUR.crypto.OID: "+L;var g=new l({curve:z});return g.setPublicKeyHex(N),g.setPrivateKeyHex(h),g.isPublic=!1,g}if(n.indexOf("-END DSA PRIVATE KEY-")!=-1&&n.indexOf("4,ENCRYPTED")!=-1){var R=d.getDecryptedKeyHex(n,t),M=s(R,0,[1],"02"),H=s(R,0,[2],"02"),B=s(R,0,[3],"02"),C=s(R,0,[4],"02"),w=s(R,0,[5],"02"),h=new c;return h.setPrivate(new BigInteger(M,16),new BigInteger(H,16),new BigInteger(B,16),new BigInteger(C,16),new BigInteger(w,16)),h}if(n.indexOf("-END ENCRYPTED PRIVATE KEY-")!=-1)return d.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 p=new BigInteger(s,2);o=o+"."+p.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 p=n.substr(u[c],2);if(typeof s=="number"&&!o.isContextTag(p)&&l==s||typeof s=="string"&&o.isContextTag(p,s))return o.getIdxbyListEx(n,u[c],e,r);o.isContextTag(p)||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(d,h){return d.length>=h?d:new Array(h-d.length+1).join("0")+d},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=[],p="",l=0;l<u.length;l++)u[l]&128?p=p+t((u[l]&127).toString(2),7):(p=p+t((u[l]&127).toString(2),7),c.push(new String(parseInt(p,2))),p="");var f=e.join(".");return c.length>0&&(f=f+"."+c.join(".")),f};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),p=c.length-2-s.getL(n,t).length;if(p!==l*2)throw new Error("V string length and L's value not the same:"+p+"/"+l*2);if(t===0&&n.length!=c.length)throw new Error("total length and TLV length unmatch:"+n.length+"!="+c.length);var f=n.substr(t,2);if(f==="02"){var d=s.getVidx(n,t);if(n.substr(d,2)=="00"&&n.charCodeAt(d+2)<56)throw new Error("not least zeros for DER INTEGER")}if(parseInt(f,16)&32){for(var h=s.getVblen(n,t),g=0,A=s.getChildIdx(n,t),m=0;m<A.length;m++){var E=s.getTLV(n,A[m]);g+=E.length,s.checkStrictDER(n,A[m],e,r,o)}if(h*2!=g)throw new Error("sum of children's TLV length and L unmatch: "+h*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,h=RSAKey.getPosArrayOfChildrenFromHex(n),r=e(n,h[0]),o=e(n,h[1]),s=e(n,h[2]),u=e(n,h[3]),l=e(n,h[4]),c=e(n,h[5]),p=e(n,h[6]),f=e(n,h[7]),d=e(n,h[8]),h=new Array;return h.push(r,o,s,u,l,c,p,f,d),h};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,p=ASN1HEX,f=p.getVbyListEx;if(p.isASN1HEX(n)===!1)throw new Error("not ASN.1 hex string");try{t=f(n,0,[2,0,1],"02"),e=f(n,0,[2,0,2],"02"),r=f(n,0,[2,0,3],"02"),o=f(n,0,[2,0,4],"02"),s=f(n,0,[2,0,5],"02"),u=f(n,0,[2,0,6],"02"),l=f(n,0,[2,0,7],"02"),c=f(n,0,[2,0,8],"02")}catch(d){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],p=l[1],f=function(h){return KJUR.crypto.Util.hashString(h,c)},d=f(n);return p==d};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(y){return KJUR.crypto.Util.hashHex(y,e)},u=hextorstr(n),l=u.length,c=this.n.bitLength()-1,p=Math.ceil(c/8),f;if(r===-1||r===void 0)r=l;else if(r===-2)r=p-l-2;else if(r<-2)throw new Error("invalid salt length");if(p<l+r+2)throw new Error("data too long");var d=this.doPublic(o).toByteArray();for(f=0;f<d.length;f+=1)d[f]&=255;for(;d.length<p;)d.unshift(0);if(d[p-1]!==188)throw new Error("encoded message does not end in 0xbc");d=String.fromCharCode.apply(String,d);var h=d.substr(0,p-l-1),g=d.substr(h.length,l),A=65280>>8*p-c&255;if(h.charCodeAt(0)&A)throw new Error("bits beyond keysize not zero");var m=pss_mgf1_str(g,h.length,s),E=[];for(f=0;f<h.length;f+=1)E[f]=h.charCodeAt(f)^m.charCodeAt(f);E[0]&=~A;var v=p-l-r-2;for(f=0;f<v;f+=1)if(E[f]!==0)throw new Error("leftmost octets not zero");if(E[v]!==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,E.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,p=t.getIdxbyList,f=t.getIdxbyListEx,d=t.getVidx,h=t.getInt,g=t.oidname,A=t.hextooidstr,m=pemtohex,E;try{E=KJUR.asn1.x509.AlgorithmIdentifier.PSSNAME2ASN1TLV}catch(v){}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 v=l(this.hex,0,[0,0]);if(v.substr(0,2)=="a0"){var y=l(v,0,[0]),b=h(y,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 v=c(this.hex,0,[0,1]);return this.getAlgorithmIdentifierName(v)},this.getAlgorithmIdentifierName=function(v){for(var y in E)if(v===E[y])return y;return g(u(v,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 v=this.getIssuer();return v.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 v=this.getSubject();return v.str},this.getNotBefore=function(){var v=s(this.hex,0,[0,4+this.foffset,0]);return v=v.replace(/(..)/g,"%$1"),v=decodeURIComponent(v),v},this.getNotAfter=function(){var v=s(this.hex,0,[0,4+this.foffset,1]);return v=v.replace(/(..)/g,"%$1"),v=decodeURIComponent(v),v},this.getPublicKeyHex=function(){return t.getTLVbyList(this.hex,0,[0,6+this.foffset],"30")},this.getPublicKeyIdx=function(){return p(this.hex,0,[0,6+this.foffset],"30")},this.getPublicKeyContentIdx=function(){var v=this.getPublicKeyIdx();return p(this.hex,v,[1,0],"30")},this.getPublicKey=function(){return KEYUTIL.getKey(this.getPublicKeyHex(),null,"pkcs8pub")},this.getSignatureAlgorithmName=function(){var v=l(this.hex,0,[1],"30");return this.getAlgorithmIdentifierName(v)},this.getSignatureValueHex=function(){return s(this.hex,0,[2],"03",!0)},this.verifySignature=function(v){var y=this.getSignatureAlgorithmField(),b=this.getSignatureValueHex(),T=l(this.hex,0,[0],"30"),_=new KJUR.crypto.Signature({alg:y});return _.init(v),_.updateHex(T),_.verify(b)},this.parseExt=function(v){var y,b,T;if(v===void 0){if(T=this.hex,this.version!==3)return-1;y=p(T,0,[0,7,0],"30"),b=e(T,y)}else{T=pemtohex(v);var _=p(T,0,[0,3,0,0],"06");if(r(T,_)!="2a864886f70d01090e"){this.aExtInfo=new Array;return}y=p(T,0,[0,3,0,1,0],"30"),b=e(T,y),this.hex=T}this.aExtInfo=new Array;for(var S=0;S<b.length;S++){var R={};R.critical=!1;var M=e(T,b[S]),H=0;M.length===3&&(R.critical=!0,H=1),R.oid=t.hextooidstr(s(T,b[S],[0],"06"));var B=p(T,b[S],[1+H]);R.vidx=d(T,B),this.aExtInfo.push(R)}},this.getExtInfo=function(v){var y=this.aExtInfo,b=v;if(v.match(/^[0-9.]+$/)||(b=KJUR.asn1.x509.OID.name2oid(v)),b!==""){for(var T=0;T<y.length;T++)if(y[T].oid===b)return y[T]}},this.getExtBasicConstraints=function(v,y){if(v===void 0&&y===void 0){var b=this.getExtInfo("basicConstraints");if(b===void 0)return;v=o(this.hex,b.vidx),y=b.critical}var T={extname:"basicConstraints"};if(y&&(T.critical=!0),v==="3000")return T;if(v==="30030101ff")return T.cA=!0,T;if(v.substr(0,12)==="30060101ff02"){var _=r(v,10),S=parseInt(_,16);return T.cA=!0,T.pathLen=S,T}throw new Error("hExtV parse error: "+v)},this.getExtKeyUsage=function(v,y){if(v===void 0&&y===void 0){var b=this.getExtInfo("keyUsage");if(b===void 0)return;v=o(this.hex,b.vidx),y=b.critical}var T={extname:"keyUsage"};return y&&(T.critical=!0),T.names=this.getExtKeyUsageString(v).split(","),T},this.getExtKeyUsageBin=function(v){if(v===void 0){var y=this.getExtInfo("keyUsage");if(y===void 0)return"";v=o(this.hex,y.vidx)}if(v.length!=8&&v.length!=10)throw new Error("malformed key usage value: "+v);var b="000000000000000"+parseInt(v.substr(6),16).toString(2);return v.length==8&&(b=b.slice(-8)),v.length==10&&(b=b.slice(-16)),b=b.replace(/0+$/,""),b==""&&(b="0"),b},this.getExtKeyUsageString=function(v){for(var y=this.getExtKeyUsageBin(v),b=new Array,T=0;T<y.length;T++)y.substr(T,1)=="1"&&b.push(X509.KEYUSAGE_NAME[T]);return b.join(",")},this.getExtSubjectKeyIdentifier=function(v,y){if(v===void 0&&y===void 0){var b=this.getExtInfo("subjectKeyIdentifier");if(b===void 0)return;v=o(this.hex,b.vidx),y=b.critical}var T={extname:"subjectKeyIdentifier"};y&&(T.critical=!0);var _=r(v,0);return T.kid={hex:_},T},this.getExtAuthorityKeyIdentifier=function(v,y){if(v===void 0&&y===void 0){var b=this.getExtInfo("authorityKeyIdentifier");if(b===void 0)return;v=o(this.hex,b.vidx),y=b.critical}var T={extname:"authorityKeyIdentifier"};y&&(T.critical=!0);for(var _=e(v,0),S=0;S<_.length;S++){var R=v.substr(_[S],2);if(R==="80"&&(T.kid={hex:r(v,_[S])}),R==="a1"){var M=o(v,_[S]),H=this.getGeneralNames(M);T.issuer=H[0].dn}R==="82"&&(T.sn={hex:r(v,_[S])})}return T},this.getExtExtKeyUsage=function(v,y){if(v===void 0&&y===void 0){var b=this.getExtInfo("extKeyUsage");if(b===void 0)return;v=o(this.hex,b.vidx),y=b.critical}var T={extname:"extKeyUsage",array:[]};y&&(T.critical=!0);for(var _=e(v,0),S=0;S<_.length;S++)T.array.push(g(r(v,_[S])));return T},this.getExtExtKeyUsageName=function(){var v=this.getExtInfo("extKeyUsage");if(v===void 0)return v;var y=new Array,b=o(this.hex,v.vidx);if(b==="")return y;for(var T=e(b,0),_=0;_<T.length;_++)y.push(g(r(b,T[_])));return y},this.getExtSubjectAltName=function(v,y){if(v===void 0&&y===void 0){var b=this.getExtInfo("subjectAltName");if(b===void 0)return;v=o(this.hex,b.vidx),y=b.critical}var T={extname:"subjectAltName",array:[]};return y&&(T.critical=!0),T.array=this.getGeneralNames(v),T},this.getExtIssuerAltName=function(v,y){if(v===void 0&&y===void 0){var b=this.getExtInfo("issuerAltName");if(b===void 0)return;v=o(this.hex,b.vidx),y=b.critical}var T={extname:"issuerAltName",array:[]};return y&&(T.critical=!0),T.array=this.getGeneralNames(v),T},this.getGeneralNames=function(v){for(var y=e(v,0),b=[],T=0;T<y.length;T++){var _=this.getGeneralName(o(v,y[T]));_!==void 0&&b.push(_)}return b},this.getGeneralName=function(v){var y=v.substr(0,2),b=r(v,0),T=hextorstr(b);if(y=="81")return{rfc822:T};if(y=="82")return{dns:T};if(y=="86")return{uri:T};if(y=="87")return{ip:hextoip(b)};if(y=="a4")return{dn:this.getX500Name(b)}},this.getExtSubjectAltName2=function(){var v,y,b,T=this.getExtInfo("subjectAltName");if(T===void 0)return T;for(var _=new Array,S=o(this.hex,T.vidx),R=e(S,0),M=0;M<R.length;M++)b=S.substr(R[M],2),v=r(S,R[M]),b==="81"&&(y=hextoutf8(v),_.push(["MAIL",y])),b==="82"&&(y=hextoutf8(v),_.push(["DNS",y])),b==="84"&&(y=X509.hex2dn(v,0),_.push(["DN",y])),b==="86"&&(y=hextoutf8(v),_.push(["URI",y])),b==="87"&&(y=hextoip(v),_.push(["IP",y]));return _},this.getExtCRLDistributionPoints=function(v,y){if(v===void 0&&y===void 0){var b=this.getExtInfo("cRLDistributionPoints");if(b===void 0)return;v=o(this.hex,b.vidx),y=b.critical}var T={extname:"cRLDistributionPoints",array:[]};y&&(T.critical=!0);for(var _=e(v,0),S=0;S<_.length;S++){var R=o(v,_[S]);T.array.push(this.getDistributionPoint(R))}return T},this.getDistributionPoint=function(v){for(var y={},b=e(v,0),T=0;T<b.length;T++){var _=v.substr(b[T],2),S=o(v,b[T]);_=="a0"&&(y.dpname=this.getDistributionPointName(S))}return y},this.getDistributionPointName=function(v){for(var y={},b=e(v,0),T=0;T<b.length;T++){var _=v.substr(b[T],2),S=o(v,b[T]);_=="a0"&&(y.full=this.getGeneralNames(S))}return y},this.getExtCRLDistributionPointsURI=function(){var v=this.getExtInfo("cRLDistributionPoints");if(v===void 0)return v;for(var y=new Array,b=e(this.hex,v.vidx),T=0;T<b.length;T++)try{var _=s(this.hex,b[T],[0,0,0],"86"),S=hextoutf8(_);y.push(S)}catch(R){}return y},this.getExtAIAInfo=function(){var v=this.getExtInfo("authorityInfoAccess");if(v===void 0)return v;for(var y={ocsp:[],caissuer:[]},b=e(this.hex,v.vidx),T=0;T<b.length;T++){var _=s(this.hex,b[T],[0],"06"),S=s(this.hex,b[T],[1],"86");_==="2b06010505073001"&&y.ocsp.push(hextoutf8(S)),_==="2b06010505073002"&&y.caissuer.push(hextoutf8(S))}return y},this.getExtAuthorityInfoAccess=function(v,y){if(v===void 0&&y===void 0){var b=this.getExtInfo("authorityInfoAccess");if(b===void 0)return;v=o(this.hex,b.vidx),y=b.critical}var T={extname:"authorityInfoAccess",array:[]};y&&(T.critical=!0);for(var _=e(v,0),S=0;S<_.length;S++){var R=u(v,_[S],[0],"06"),M=s(v,_[S],[1],"86"),H=hextoutf8(M);if(R=="2b06010505073001")T.array.push({ocsp:H});else if(R=="2b06010505073002")T.array.push({caissuer:H});else throw new Error("unknown method: "+R)}return T},this.getExtCertificatePolicies=function(v,y){if(v===void 0&&y===void 0){var b=this.getExtInfo("certificatePolicies");if(b===void 0)return;v=o(this.hex,b.vidx),y=b.critical}var T={extname:"certificatePolicies",array:[]};y&&(T.critical=!0);for(var _=e(v,0),S=0;S<_.length;S++){var R=o(v,_[S]),M=this.getPolicyInformation(R);T.array.push(M)}return T},this.getPolicyInformation=function(v){var y={},b=s(v,0,[0],"06");y.policyoid=g(b);var T=f(v,0,[1],"30");if(T!=-1){y.array=[];for(var _=e(v,T),S=0;S<_.length;S++){var R=o(v,_[S]),M=this.getPolicyQualifierInfo(R);y.array.push(M)}}return y},this.getPolicyQualifierInfo=function(v){var y={},b=s(v,0,[0],"06");if(b==="2b06010505070201"){var T=u(v,0,[1],"16");y.cps=hextorstr(T)}else if(b==="2b06010505070202"){var _=l(v,0,[1],"30");y.unotice=this.getUserNotice(_)}return y},this.getUserNotice=function(v){for(var y={},b=e(v,0),T=0;T<b.length;T++){var _=o(v,b[T]);_.substr(0,2)!="30"&&(y.exptext=this.getDisplayText(_))}return y},this.getDisplayText=function(v){var y={"0c":"utf8",16:"ia5","1a":"vis","1e":"bmp"},b={};return b.type=y[v.substr(0,2)],b.str=hextorstr(r(v,0)),b},this.getExtCRLNumber=function(v,y){var b={extname:"cRLNumber"};if(y&&(b.critical=!0),v.substr(0,2)=="02")return b.num={hex:r(v,0)},b;throw new Error("hExtV parse error: "+v)},this.getExtCRLReason=function(v,y){var b={extname:"cRLReason"};if(y&&(b.critical=!0),v.substr(0,2)=="0a")return b.code=parseInt(r(v,0),16),b;throw new Error("hExtV parse error: "+v)},this.getExtOcspNonce=function(v,y){var b={extname:"ocspNonce"};y&&(b.critical=!0);var T=r(v,0);return b.hex=T,b},this.getExtOcspNoCheck=function(v,y){var b={extname:"ocspNoCheck"};return y&&(b.critical=!0),b},this.getExtAdobeTimeStamp=function(v,y){if(v===void 0&&y===void 0){var b=this.getExtInfo("adobeTimeStamp");if(b===void 0)return;v=o(this.hex,b.vidx),y=b.critical}var T={extname:"adobeTimeStamp"};y&&(T.critical=!0);var _=e(v,0);if(_.length>1){var S=o(v,_[1]),R=this.getGeneralName(S);R.uri!=null&&(T.uri=R.uri)}if(_.length>2){var M=o(v,_[2]);M=="0101ff"&&(T.reqauth=!0),M=="010100"&&(T.reqauth=!1)}return T},this.getX500NameRule=function(v){for(var y=null,b=[],T=0;T<v.length;T++)for(var _=v[T],S=0;S<_.length;S++)b.push(_[S]);for(var T=0;T<b.length;T++){var R=b[T],M=R.ds,H=R.value,B=R.type;if(M!="prn"&&M!="utf8"&&M!="ia5")return"mixed";if(M=="ia5"){if(B!="CN")return"mixed";if(KJUR.lang.String.isMail(H))continue;return"mixed"}if(B=="C"){if(M=="prn")continue;return"mixed"}if(y==null)y=M;else if(y!==M)return"mixed"}return y==null?"prn":y},this.getX500Name=function(v){var y=this.getX500NameArray(v),b=this.dnarraytostr(y);return{array:y,str:b}},this.getX500NameArray=function(v){for(var y=[],b=e(v,0),T=0;T<b.length;T++)y.push(this.getRDN(o(v,b[T])));return y},this.getRDN=function(v){for(var y=[],b=e(v,0),T=0;T<b.length;T++)y.push(this.getAttrTypeAndValue(o(v,b[T])));return y},this.getAttrTypeAndValue=function(v){var y={type:null,value:null,ds:null},b=e(v,0),T=s(v,b[0],[],"06"),_=s(v,b[1],[]),S=KJUR.asn1.ASN1Util.oidHexToInt(T);return y.type=KJUR.asn1.x509.OID.oid2atype(S),y.ds=this.HEX2STAG[v.substr(b[1],2)],y.ds!="bmp"?y.value=hextoutf8(_):y.value=ucs2hextoutf8(_),y},this.readCertPEM=function(v){this.readCertHex(m(v))},this.readCertHex=function(v){this.hex=v,this.getVersion();try{p(this.hex,0,[0,7],"a3"),this.parseExt()}catch(y){}},this.getParam=function(){var v={};return v.version=this.getVersion(),v.serial={hex:this.getSerialNumberHex()},v.sigalg=this.getSignatureAlgorithmField(),v.issuer=this.getIssuer(),v.notbefore=this.getNotBefore(),v.notafter=this.getNotAfter(),v.subject=this.getSubject(),v.sbjpubkey=hextopem(this.getPublicKeyHex(),"PUBLIC KEY"),this.aExtInfo.length>0&&(v.ext=this.getExtParamArray()),v.sighex=this.getSignatureValueHex(),v},this.getExtParamArray=function(v){if(v==null){var y=f(this.hex,0,[0,"[3]"]);y!=-1&&(v=c(this.hex,0,[0,"[3]",0],"30"))}for(var b=[],T=e(v,0),_=0;_<T.length;_++){var S=o(v,T[_]),R=this.getExtParam(S);R!=null&&b.push(R)}return b},this.getExtParam=function(v){var y=e(v,0),b=y.length;if(b!=2&&b!=3)throw new Error("wrong number elements in Extension: "+b+" "+v);var T=A(s(v,0,[0],"06")),_=!1;b==3&&l(v,0,[1])=="0101ff"&&(_=!0);var S=l(v,0,[b-1,0]),R=void 0;if(T=="2.5.29.14"?R=this.getExtSubjectKeyIdentifier(S,_):T=="2.5.29.15"?R=this.getExtKeyUsage(S,_):T=="2.5.29.17"?R=this.getExtSubjectAltName(S,_):T=="2.5.29.18"?R=this.getExtIssuerAltName(S,_):T=="2.5.29.19"?R=this.getExtBasicConstraints(S,_):T=="2.5.29.31"?R=this.getExtCRLDistributionPoints(S,_):T=="2.5.29.32"?R=this.getExtCertificatePolicies(S,_):T=="2.5.29.35"?R=this.getExtAuthorityKeyIdentifier(S,_):T=="2.5.29.37"?R=this.getExtExtKeyUsage(S,_):T=="1.3.6.1.5.5.7.1.1"?R=this.getExtAuthorityInfoAccess(S,_):T=="2.5.29.20"?R=this.getExtCRLNumber(S,_):T=="2.5.29.21"?R=this.getExtCRLReason(S,_):T=="1.3.6.1.5.5.7.48.1.2"?R=this.getExtOcspNonce(S,_):T=="1.3.6.1.5.5.7.48.1.5"?R=this.getExtOcspNoCheck(S,_):T=="1.2.840.113583.1.1.9.1"&&(R=this.getExtAdobeTimeStamp(S,_)),R!=null)return R;var M={extname:T,extn:S};return _&&(M.critical=!0),M},this.findExt=function(v,y){for(var b=0;b<v.length;b++)if(v[b].extname==y)return v[b];return null},this.dnarraytostr=function(v){function y(T){return T.map(function(_){return b(_).replace(/\+/,"\\+")}).join("+")}function b(T){return T.type+"="+T.value}return"/"+v.map(function(T){return y(T).replace(/\//,"\\/")}).join("/")},this.getInfo=function(){var v=function(J){var K=JSON.stringify(J.array).replace(/[\[\]\{\}\"]/g,"");return K},y=function(J){for(var K="",Q=J.array,U=0;U<Q.length;U++){var q=Q[U];if(K+=" policy oid: "+q.policyoid+`
|
|
363
|
-
`,q.array!==void 0)for(var
|
|
364
|
-
`)}}return
|
|
365
|
-
`)}catch(
|
|
366
|
-
`)}catch(
|
|
367
|
-
`),q.ocsp!==void 0&&(
|
|
368
|
-
`)}return
|
|
362
|
+
`,H},parseHexOfEncryptedPKCS8:function(A){var m=ASN1HEX,E=m.getChildIdx,v=m.getV,y={},b=E(A,0);if(b.length!=2)throw"malformed format: SEQUENCE(0).items != 2: "+b.length;y.ciphertext=v(A,b[1]);var T=E(A,b[0]);if(T.length!=2)throw"malformed format: SEQUENCE(0.0).items != 2: "+T.length;if(v(A,T[0])!="2a864886f70d01050d")throw"this only supports pkcs5PBES2";var _=E(A,T[1]);if(T.length!=2)throw"malformed format: SEQUENCE(0.0.1).items != 2: "+_.length;var S=E(A,_[1]);if(S.length!=2)throw"malformed format: SEQUENCE(0.0.1.1).items != 2: "+S.length;if(v(A,S[0])!="2a864886f70d0307")throw"this only supports TripleDES";y.encryptionSchemeAlg="TripleDES",y.encryptionSchemeIV=v(A,S[1]);var R=E(A,_[0]);if(R.length!=2)throw"malformed format: SEQUENCE(0.0.1.0).items != 2: "+R.length;if(v(A,R[0])!="2a864886f70d01050c")throw"this only supports pkcs5PBKDF2";var M=E(A,R[1]);if(M.length<2)throw"malformed format: SEQUENCE(0.0.1.0.1).items < 2: "+M.length;y.pbkdf2Salt=v(A,M[0]);var H=v(A,M[1]);try{y.pbkdf2Iter=parseInt(H,16)}catch(B){throw"malformed format pbkdf2Iter: "+H}return y},getPBKDF2KeyHexFromParam:function(A,m){var E=CryptoJS.enc.Hex.parse(A.pbkdf2Salt),v=A.pbkdf2Iter,y=CryptoJS.PBKDF2(m,E,{keySize:192/32,iterations:v}),b=CryptoJS.enc.Hex.stringify(y);return b},_getPlainPKCS8HexFromEncryptedPKCS8PEM:function(A,m){var E=pemtohex(A,"ENCRYPTED PRIVATE KEY"),v=this.parseHexOfEncryptedPKCS8(E),y=KEYUTIL.getPBKDF2KeyHexFromParam(v,m),b={};b.ciphertext=CryptoJS.enc.Hex.parse(v.ciphertext);var T=CryptoJS.enc.Hex.parse(y),_=CryptoJS.enc.Hex.parse(v.encryptionSchemeIV),S=CryptoJS.TripleDES.decrypt(b,T,{iv:_}),R=CryptoJS.enc.Hex.stringify(S);return R},getKeyFromEncryptedPKCS8PEM:function(A,m){var E=this._getPlainPKCS8HexFromEncryptedPKCS8PEM(A,m),v=this.getKeyFromPlainPrivatePKCS8Hex(E);return v},parsePlainPrivatePKCS8Hex:function(A){var m=ASN1HEX,E=m.getChildIdx,v=m.getV,y={};if(y.algparam=null,A.substr(0,2)!="30")throw new Error("malformed plain PKCS8 private key(code:001)");var b=E(A,0);if(b.length<3)throw new Error("malformed plain PKCS8 private key(code:002)");if(A.substr(b[1],2)!="30")throw new Error("malformed PKCS8 private key(code:003)");var T=E(A,b[1]);if(T.length!=2)throw new Error("malformed PKCS8 private key(code:004)");if(A.substr(T[0],2)!="06")throw new Error("malformed PKCS8 private key(code:005)");if(y.algoid=v(A,T[0]),A.substr(T[1],2)=="06"&&(y.algparam=v(A,T[1])),A.substr(b[2],2)!="04")throw new Error("malformed PKCS8 private key(code:006)");return y.keyidx=m.getVidx(A,b[2]),y},getKeyFromPlainPrivatePKCS8PEM:function(A){var m=pemtohex(A,"PRIVATE KEY"),E=this.getKeyFromPlainPrivatePKCS8Hex(m);return E},getKeyFromPlainPrivatePKCS8Hex:function(A){var m=this.parsePlainPrivatePKCS8Hex(A),E;if(m.algoid=="2a864886f70d010101")E=new RSAKey;else if(KJUR.crypto.DSA&&m.algoid=="2a8648ce380401")E=new KJUR.crypto.DSA;else if(KJUR.crypto.ECDSA&&m.algoid=="2a8648ce3d0201")E=new KJUR.crypto.ECDSA;else throw"unsupported private key algorithm";return E.readPKCS8PrvKeyHex(A),E},_getKeyFromPublicPKCS8Hex:function(A){var m,E=ASN1HEX.getVbyList(A,0,[0,0],"06");if(E==="2a864886f70d010101")m=new RSAKey;else if(KJUR.crypto.DSA&&E==="2a8648ce380401")m=new KJUR.crypto.DSA;else if(KJUR.crypto.ECDSA&&E==="2a8648ce3d0201")m=new KJUR.crypto.ECDSA;else throw"unsupported PKCS#8 public key hex";return m.readPKCS8PubKeyHex(A),m},parsePublicRawRSAKeyHex:function(A){var m=ASN1HEX,E=m.getChildIdx,v=m.getV,y={};if(A.substr(0,2)!="30")throw"malformed RSA key(code:001)";var b=E(A,0);if(b.length!=2)throw"malformed RSA key(code:002)";if(A.substr(b[0],2)!="02")throw"malformed RSA key(code:003)";if(y.n=v(A,b[0]),A.substr(b[1],2)!="02")throw"malformed RSA key(code:004)";return y.e=v(A,b[1]),y},parsePublicPKCS8Hex:function(A){var m=ASN1HEX,E=m.getChildIdx,v=m.getV,y={};y.algparam=null;var b=E(A,0);if(b.length!=2)throw"outer DERSequence shall have 2 elements: "+b.length;var T=b[0];if(A.substr(T,2)!="30")throw"malformed PKCS8 public key(code:001)";var _=E(A,T);if(_.length!=2)throw"malformed PKCS8 public key(code:002)";if(A.substr(_[0],2)!="06")throw"malformed PKCS8 public key(code:003)";if(y.algoid=v(A,_[0]),A.substr(_[1],2)=="06"?y.algparam=v(A,_[1]):A.substr(_[1],2)=="30"&&(y.algparam={},y.algparam.p=m.getVbyList(A,_[1],[0],"02"),y.algparam.q=m.getVbyList(A,_[1],[1],"02"),y.algparam.g=m.getVbyList(A,_[1],[2],"02")),A.substr(b[1],2)!="03")throw"malformed PKCS8 public key(code:004)";return y.key=v(A,b[1]).substr(2),y}}}();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,p=RSAKey,f=pemtohex,d=KEYUTIL;if(typeof p!="undefined"&&n instanceof p||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 h=new p;return h.setPublic(n.n,n.e),h}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 h=new p;return h.setPrivateEx(n.n,n.e,n.d,n.p,n.q,n.dp,n.dq,n.co),h}if(n.kty===void 0&&n.n!==void 0&&n.e!==void 0&&n.d!==void 0&&n.p===void 0){var h=new p;return h.setPrivate(n.n,n.e,n.d),h}if(n.p!==void 0&&n.q!==void 0&&n.g!==void 0&&n.y!==void 0&&n.x===void 0){var h=new c;return h.setPublic(n.p,n.q,n.g,n.y),h}if(n.p!==void 0&&n.q!==void 0&&n.g!==void 0&&n.y!==void 0&&n.x!==void 0){var h=new c;return h.setPrivate(n.p,n.q,n.g,n.y,n.x),h}if(n.kty==="RSA"&&n.n!==void 0&&n.e!==void 0&&n.d===void 0){var h=new p;return h.setPublic(b64utohex(n.n),b64utohex(n.e)),h}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 h=new p;return h.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)),h}if(n.kty==="RSA"&&n.n!==void 0&&n.e!==void 0&&n.d!==void 0){var h=new p;return h.setPrivate(b64utohex(n.n),b64utohex(n.e),b64utohex(n.d)),h}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}),A=g.ecparams.keylen/4,m=("0000000000"+b64utohex(n.x)).slice(-A),E=("0000000000"+b64utohex(n.y)).slice(-A),v="04"+m+E;return g.setPublicKeyHex(v),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}),A=g.ecparams.keylen/4,m=("0000000000"+b64utohex(n.x)).slice(-A),E=("0000000000"+b64utohex(n.y)).slice(-A),v="04"+m+E,y=("0000000000"+b64utohex(n.d)).slice(-A);return g.setPublicKeyHex(v),g.setPrivateKeyHex(y),g}if(e==="pkcs5prv"){var b=n,r=ASN1HEX,T,h;if(T=o(b,0),T.length===9)h=new p,h.readPKCS5PrvKeyHex(b);else if(T.length===6)h=new c,h.readPKCS5PrvKeyHex(b);else if(T.length>2&&b.substr(T[1],2)==="04")h=new l,h.readPKCS5PrvKeyHex(b);else throw"unsupported PKCS#1/5 hexadecimal key";return h}if(e==="pkcs8prv"){var h=d.getKeyFromPlainPrivatePKCS8Hex(n);return h}if(e==="pkcs8pub")return d._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 d._getKeyFromPublicPKCS8Hex(_)}if(n.indexOf("-END RSA PRIVATE KEY-")!=-1&&n.indexOf("4,ENCRYPTED")==-1){var S=f(n,"RSA PRIVATE KEY");return d.getKey(S,null,"pkcs5prv")}if(n.indexOf("-END DSA PRIVATE KEY-")!=-1&&n.indexOf("4,ENCRYPTED")==-1){var R=f(n,"DSA PRIVATE KEY"),M=s(R,0,[1],"02"),H=s(R,0,[2],"02"),B=s(R,0,[3],"02"),C=s(R,0,[4],"02"),w=s(R,0,[5],"02"),h=new c;return h.setPrivate(new BigInteger(M,16),new BigInteger(H,16),new BigInteger(B,16),new BigInteger(C,16),new BigInteger(w,16)),h}if(n.indexOf("-END EC PRIVATE KEY-")!=-1&&n.indexOf("4,ENCRYPTED")==-1){var S=f(n,"EC PRIVATE KEY");return d.getKey(S,null,"pkcs5prv")}if(n.indexOf("-END PRIVATE KEY-")!=-1)return d.getKeyFromPlainPrivatePKCS8PEM(n);if(n.indexOf("-END RSA PRIVATE KEY-")!=-1&&n.indexOf("4,ENCRYPTED")!=-1){var I=d.getDecryptedKeyHex(n,t),O=new RSAKey;return O.readPKCS5PrvKeyHex(I),O}if(n.indexOf("-END EC PRIVATE KEY-")!=-1&&n.indexOf("4,ENCRYPTED")!=-1){var R=d.getDecryptedKeyHex(n,t),h=s(R,0,[1],"04"),L=s(R,0,[2,0],"06"),N=s(R,0,[3,0],"03").substr(2),z="";if(KJUR.crypto.OID.oidhex2name[L]!==void 0)z=KJUR.crypto.OID.oidhex2name[L];else throw"undefined OID(hex) in KJUR.crypto.OID: "+L;var g=new l({curve:z});return g.setPublicKeyHex(N),g.setPrivateKeyHex(h),g.isPublic=!1,g}if(n.indexOf("-END DSA PRIVATE KEY-")!=-1&&n.indexOf("4,ENCRYPTED")!=-1){var R=d.getDecryptedKeyHex(n,t),M=s(R,0,[1],"02"),H=s(R,0,[2],"02"),B=s(R,0,[3],"02"),C=s(R,0,[4],"02"),w=s(R,0,[5],"02"),h=new c;return h.setPrivate(new BigInteger(M,16),new BigInteger(H,16),new BigInteger(B,16),new BigInteger(C,16),new BigInteger(w,16)),h}if(n.indexOf("-END ENCRYPTED PRIVATE KEY-")!=-1)return d.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 p=new BigInteger(s,2);o=o+"."+p.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 p=n.substr(u[c],2);if(typeof s=="number"&&!o.isContextTag(p)&&l==s||typeof s=="string"&&o.isContextTag(p,s))return o.getIdxbyListEx(n,u[c],e,r);o.isContextTag(p)||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(d,h){return d.length>=h?d:new Array(h-d.length+1).join("0")+d},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=[],p="",l=0;l<u.length;l++)u[l]&128?p=p+t((u[l]&127).toString(2),7):(p=p+t((u[l]&127).toString(2),7),c.push(new String(parseInt(p,2))),p="");var f=e.join(".");return c.length>0&&(f=f+"."+c.join(".")),f};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),p=c.length-2-s.getL(n,t).length;if(p!==l*2)throw new Error("V string length and L's value not the same:"+p+"/"+l*2);if(t===0&&n.length!=c.length)throw new Error("total length and TLV length unmatch:"+n.length+"!="+c.length);var f=n.substr(t,2);if(f==="02"){var d=s.getVidx(n,t);if(n.substr(d,2)=="00"&&n.charCodeAt(d+2)<56)throw new Error("not least zeros for DER INTEGER")}if(parseInt(f,16)&32){for(var h=s.getVblen(n,t),g=0,A=s.getChildIdx(n,t),m=0;m<A.length;m++){var E=s.getTLV(n,A[m]);g+=E.length,s.checkStrictDER(n,A[m],e,r,o)}if(h*2!=g)throw new Error("sum of children's TLV length and L unmatch: "+h*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,h=RSAKey.getPosArrayOfChildrenFromHex(n),r=e(n,h[0]),o=e(n,h[1]),s=e(n,h[2]),u=e(n,h[3]),l=e(n,h[4]),c=e(n,h[5]),p=e(n,h[6]),f=e(n,h[7]),d=e(n,h[8]),h=new Array;return h.push(r,o,s,u,l,c,p,f,d),h};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,p=ASN1HEX,f=p.getVbyListEx;if(p.isASN1HEX(n)===!1)throw new Error("not ASN.1 hex string");try{t=f(n,0,[2,0,1],"02"),e=f(n,0,[2,0,2],"02"),r=f(n,0,[2,0,3],"02"),o=f(n,0,[2,0,4],"02"),s=f(n,0,[2,0,5],"02"),u=f(n,0,[2,0,6],"02"),l=f(n,0,[2,0,7],"02"),c=f(n,0,[2,0,8],"02")}catch(d){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],p=l[1],f=function(h){return KJUR.crypto.Util.hashString(h,c)},d=f(n);return p==d};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(y){return KJUR.crypto.Util.hashHex(y,e)},u=hextorstr(n),l=u.length,c=this.n.bitLength()-1,p=Math.ceil(c/8),f;if(r===-1||r===void 0)r=l;else if(r===-2)r=p-l-2;else if(r<-2)throw new Error("invalid salt length");if(p<l+r+2)throw new Error("data too long");var d=this.doPublic(o).toByteArray();for(f=0;f<d.length;f+=1)d[f]&=255;for(;d.length<p;)d.unshift(0);if(d[p-1]!==188)throw new Error("encoded message does not end in 0xbc");d=String.fromCharCode.apply(String,d);var h=d.substr(0,p-l-1),g=d.substr(h.length,l),A=65280>>8*p-c&255;if(h.charCodeAt(0)&A)throw new Error("bits beyond keysize not zero");var m=pss_mgf1_str(g,h.length,s),E=[];for(f=0;f<h.length;f+=1)E[f]=h.charCodeAt(f)^m.charCodeAt(f);E[0]&=~A;var v=p-l-r-2;for(f=0;f<v;f+=1)if(E[f]!==0)throw new Error("leftmost octets not zero");if(E[v]!==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,E.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,p=t.getIdxbyList,f=t.getIdxbyListEx,d=t.getVidx,h=t.getInt,g=t.oidname,A=t.hextooidstr,m=pemtohex,E;try{E=KJUR.asn1.x509.AlgorithmIdentifier.PSSNAME2ASN1TLV}catch(v){}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 v=l(this.hex,0,[0,0]);if(v.substr(0,2)=="a0"){var y=l(v,0,[0]),b=h(y,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 v=c(this.hex,0,[0,1]);return this.getAlgorithmIdentifierName(v)},this.getAlgorithmIdentifierName=function(v){for(var y in E)if(v===E[y])return y;return g(u(v,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 v=this.getIssuer();return v.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 v=this.getSubject();return v.str},this.getNotBefore=function(){var v=s(this.hex,0,[0,4+this.foffset,0]);return v=v.replace(/(..)/g,"%$1"),v=decodeURIComponent(v),v},this.getNotAfter=function(){var v=s(this.hex,0,[0,4+this.foffset,1]);return v=v.replace(/(..)/g,"%$1"),v=decodeURIComponent(v),v},this.getPublicKeyHex=function(){return t.getTLVbyList(this.hex,0,[0,6+this.foffset],"30")},this.getPublicKeyIdx=function(){return p(this.hex,0,[0,6+this.foffset],"30")},this.getPublicKeyContentIdx=function(){var v=this.getPublicKeyIdx();return p(this.hex,v,[1,0],"30")},this.getPublicKey=function(){return KEYUTIL.getKey(this.getPublicKeyHex(),null,"pkcs8pub")},this.getSignatureAlgorithmName=function(){var v=l(this.hex,0,[1],"30");return this.getAlgorithmIdentifierName(v)},this.getSignatureValueHex=function(){return s(this.hex,0,[2],"03",!0)},this.verifySignature=function(v){var y=this.getSignatureAlgorithmField(),b=this.getSignatureValueHex(),T=l(this.hex,0,[0],"30"),_=new KJUR.crypto.Signature({alg:y});return _.init(v),_.updateHex(T),_.verify(b)},this.parseExt=function(v){var y,b,T;if(v===void 0){if(T=this.hex,this.version!==3)return-1;y=p(T,0,[0,7,0],"30"),b=e(T,y)}else{T=pemtohex(v);var _=p(T,0,[0,3,0,0],"06");if(r(T,_)!="2a864886f70d01090e"){this.aExtInfo=new Array;return}y=p(T,0,[0,3,0,1,0],"30"),b=e(T,y),this.hex=T}this.aExtInfo=new Array;for(var S=0;S<b.length;S++){var R={};R.critical=!1;var M=e(T,b[S]),H=0;M.length===3&&(R.critical=!0,H=1),R.oid=t.hextooidstr(s(T,b[S],[0],"06"));var B=p(T,b[S],[1+H]);R.vidx=d(T,B),this.aExtInfo.push(R)}},this.getExtInfo=function(v){var y=this.aExtInfo,b=v;if(v.match(/^[0-9.]+$/)||(b=KJUR.asn1.x509.OID.name2oid(v)),b!==""){for(var T=0;T<y.length;T++)if(y[T].oid===b)return y[T]}},this.getExtBasicConstraints=function(v,y){if(v===void 0&&y===void 0){var b=this.getExtInfo("basicConstraints");if(b===void 0)return;v=o(this.hex,b.vidx),y=b.critical}var T={extname:"basicConstraints"};if(y&&(T.critical=!0),v==="3000")return T;if(v==="30030101ff")return T.cA=!0,T;if(v.substr(0,12)==="30060101ff02"){var _=r(v,10),S=parseInt(_,16);return T.cA=!0,T.pathLen=S,T}throw new Error("hExtV parse error: "+v)},this.getExtKeyUsage=function(v,y){if(v===void 0&&y===void 0){var b=this.getExtInfo("keyUsage");if(b===void 0)return;v=o(this.hex,b.vidx),y=b.critical}var T={extname:"keyUsage"};return y&&(T.critical=!0),T.names=this.getExtKeyUsageString(v).split(","),T},this.getExtKeyUsageBin=function(v){if(v===void 0){var y=this.getExtInfo("keyUsage");if(y===void 0)return"";v=o(this.hex,y.vidx)}if(v.length!=8&&v.length!=10)throw new Error("malformed key usage value: "+v);var b="000000000000000"+parseInt(v.substr(6),16).toString(2);return v.length==8&&(b=b.slice(-8)),v.length==10&&(b=b.slice(-16)),b=b.replace(/0+$/,""),b==""&&(b="0"),b},this.getExtKeyUsageString=function(v){for(var y=this.getExtKeyUsageBin(v),b=new Array,T=0;T<y.length;T++)y.substr(T,1)=="1"&&b.push(X509.KEYUSAGE_NAME[T]);return b.join(",")},this.getExtSubjectKeyIdentifier=function(v,y){if(v===void 0&&y===void 0){var b=this.getExtInfo("subjectKeyIdentifier");if(b===void 0)return;v=o(this.hex,b.vidx),y=b.critical}var T={extname:"subjectKeyIdentifier"};y&&(T.critical=!0);var _=r(v,0);return T.kid={hex:_},T},this.getExtAuthorityKeyIdentifier=function(v,y){if(v===void 0&&y===void 0){var b=this.getExtInfo("authorityKeyIdentifier");if(b===void 0)return;v=o(this.hex,b.vidx),y=b.critical}var T={extname:"authorityKeyIdentifier"};y&&(T.critical=!0);for(var _=e(v,0),S=0;S<_.length;S++){var R=v.substr(_[S],2);if(R==="80"&&(T.kid={hex:r(v,_[S])}),R==="a1"){var M=o(v,_[S]),H=this.getGeneralNames(M);T.issuer=H[0].dn}R==="82"&&(T.sn={hex:r(v,_[S])})}return T},this.getExtExtKeyUsage=function(v,y){if(v===void 0&&y===void 0){var b=this.getExtInfo("extKeyUsage");if(b===void 0)return;v=o(this.hex,b.vidx),y=b.critical}var T={extname:"extKeyUsage",array:[]};y&&(T.critical=!0);for(var _=e(v,0),S=0;S<_.length;S++)T.array.push(g(r(v,_[S])));return T},this.getExtExtKeyUsageName=function(){var v=this.getExtInfo("extKeyUsage");if(v===void 0)return v;var y=new Array,b=o(this.hex,v.vidx);if(b==="")return y;for(var T=e(b,0),_=0;_<T.length;_++)y.push(g(r(b,T[_])));return y},this.getExtSubjectAltName=function(v,y){if(v===void 0&&y===void 0){var b=this.getExtInfo("subjectAltName");if(b===void 0)return;v=o(this.hex,b.vidx),y=b.critical}var T={extname:"subjectAltName",array:[]};return y&&(T.critical=!0),T.array=this.getGeneralNames(v),T},this.getExtIssuerAltName=function(v,y){if(v===void 0&&y===void 0){var b=this.getExtInfo("issuerAltName");if(b===void 0)return;v=o(this.hex,b.vidx),y=b.critical}var T={extname:"issuerAltName",array:[]};return y&&(T.critical=!0),T.array=this.getGeneralNames(v),T},this.getGeneralNames=function(v){for(var y=e(v,0),b=[],T=0;T<y.length;T++){var _=this.getGeneralName(o(v,y[T]));_!==void 0&&b.push(_)}return b},this.getGeneralName=function(v){var y=v.substr(0,2),b=r(v,0),T=hextorstr(b);if(y=="81")return{rfc822:T};if(y=="82")return{dns:T};if(y=="86")return{uri:T};if(y=="87")return{ip:hextoip(b)};if(y=="a4")return{dn:this.getX500Name(b)}},this.getExtSubjectAltName2=function(){var v,y,b,T=this.getExtInfo("subjectAltName");if(T===void 0)return T;for(var _=new Array,S=o(this.hex,T.vidx),R=e(S,0),M=0;M<R.length;M++)b=S.substr(R[M],2),v=r(S,R[M]),b==="81"&&(y=hextoutf8(v),_.push(["MAIL",y])),b==="82"&&(y=hextoutf8(v),_.push(["DNS",y])),b==="84"&&(y=X509.hex2dn(v,0),_.push(["DN",y])),b==="86"&&(y=hextoutf8(v),_.push(["URI",y])),b==="87"&&(y=hextoip(v),_.push(["IP",y]));return _},this.getExtCRLDistributionPoints=function(v,y){if(v===void 0&&y===void 0){var b=this.getExtInfo("cRLDistributionPoints");if(b===void 0)return;v=o(this.hex,b.vidx),y=b.critical}var T={extname:"cRLDistributionPoints",array:[]};y&&(T.critical=!0);for(var _=e(v,0),S=0;S<_.length;S++){var R=o(v,_[S]);T.array.push(this.getDistributionPoint(R))}return T},this.getDistributionPoint=function(v){for(var y={},b=e(v,0),T=0;T<b.length;T++){var _=v.substr(b[T],2),S=o(v,b[T]);_=="a0"&&(y.dpname=this.getDistributionPointName(S))}return y},this.getDistributionPointName=function(v){for(var y={},b=e(v,0),T=0;T<b.length;T++){var _=v.substr(b[T],2),S=o(v,b[T]);_=="a0"&&(y.full=this.getGeneralNames(S))}return y},this.getExtCRLDistributionPointsURI=function(){var v=this.getExtInfo("cRLDistributionPoints");if(v===void 0)return v;for(var y=new Array,b=e(this.hex,v.vidx),T=0;T<b.length;T++)try{var _=s(this.hex,b[T],[0,0,0],"86"),S=hextoutf8(_);y.push(S)}catch(R){}return y},this.getExtAIAInfo=function(){var v=this.getExtInfo("authorityInfoAccess");if(v===void 0)return v;for(var y={ocsp:[],caissuer:[]},b=e(this.hex,v.vidx),T=0;T<b.length;T++){var _=s(this.hex,b[T],[0],"06"),S=s(this.hex,b[T],[1],"86");_==="2b06010505073001"&&y.ocsp.push(hextoutf8(S)),_==="2b06010505073002"&&y.caissuer.push(hextoutf8(S))}return y},this.getExtAuthorityInfoAccess=function(v,y){if(v===void 0&&y===void 0){var b=this.getExtInfo("authorityInfoAccess");if(b===void 0)return;v=o(this.hex,b.vidx),y=b.critical}var T={extname:"authorityInfoAccess",array:[]};y&&(T.critical=!0);for(var _=e(v,0),S=0;S<_.length;S++){var R=u(v,_[S],[0],"06"),M=s(v,_[S],[1],"86"),H=hextoutf8(M);if(R=="2b06010505073001")T.array.push({ocsp:H});else if(R=="2b06010505073002")T.array.push({caissuer:H});else throw new Error("unknown method: "+R)}return T},this.getExtCertificatePolicies=function(v,y){if(v===void 0&&y===void 0){var b=this.getExtInfo("certificatePolicies");if(b===void 0)return;v=o(this.hex,b.vidx),y=b.critical}var T={extname:"certificatePolicies",array:[]};y&&(T.critical=!0);for(var _=e(v,0),S=0;S<_.length;S++){var R=o(v,_[S]),M=this.getPolicyInformation(R);T.array.push(M)}return T},this.getPolicyInformation=function(v){var y={},b=s(v,0,[0],"06");y.policyoid=g(b);var T=f(v,0,[1],"30");if(T!=-1){y.array=[];for(var _=e(v,T),S=0;S<_.length;S++){var R=o(v,_[S]),M=this.getPolicyQualifierInfo(R);y.array.push(M)}}return y},this.getPolicyQualifierInfo=function(v){var y={},b=s(v,0,[0],"06");if(b==="2b06010505070201"){var T=u(v,0,[1],"16");y.cps=hextorstr(T)}else if(b==="2b06010505070202"){var _=l(v,0,[1],"30");y.unotice=this.getUserNotice(_)}return y},this.getUserNotice=function(v){for(var y={},b=e(v,0),T=0;T<b.length;T++){var _=o(v,b[T]);_.substr(0,2)!="30"&&(y.exptext=this.getDisplayText(_))}return y},this.getDisplayText=function(v){var y={"0c":"utf8",16:"ia5","1a":"vis","1e":"bmp"},b={};return b.type=y[v.substr(0,2)],b.str=hextorstr(r(v,0)),b},this.getExtCRLNumber=function(v,y){var b={extname:"cRLNumber"};if(y&&(b.critical=!0),v.substr(0,2)=="02")return b.num={hex:r(v,0)},b;throw new Error("hExtV parse error: "+v)},this.getExtCRLReason=function(v,y){var b={extname:"cRLReason"};if(y&&(b.critical=!0),v.substr(0,2)=="0a")return b.code=parseInt(r(v,0),16),b;throw new Error("hExtV parse error: "+v)},this.getExtOcspNonce=function(v,y){var b={extname:"ocspNonce"};y&&(b.critical=!0);var T=r(v,0);return b.hex=T,b},this.getExtOcspNoCheck=function(v,y){var b={extname:"ocspNoCheck"};return y&&(b.critical=!0),b},this.getExtAdobeTimeStamp=function(v,y){if(v===void 0&&y===void 0){var b=this.getExtInfo("adobeTimeStamp");if(b===void 0)return;v=o(this.hex,b.vidx),y=b.critical}var T={extname:"adobeTimeStamp"};y&&(T.critical=!0);var _=e(v,0);if(_.length>1){var S=o(v,_[1]),R=this.getGeneralName(S);R.uri!=null&&(T.uri=R.uri)}if(_.length>2){var M=o(v,_[2]);M=="0101ff"&&(T.reqauth=!0),M=="010100"&&(T.reqauth=!1)}return T},this.getX500NameRule=function(v){for(var y=null,b=[],T=0;T<v.length;T++)for(var _=v[T],S=0;S<_.length;S++)b.push(_[S]);for(var T=0;T<b.length;T++){var R=b[T],M=R.ds,H=R.value,B=R.type;if(M!="prn"&&M!="utf8"&&M!="ia5")return"mixed";if(M=="ia5"){if(B!="CN")return"mixed";if(KJUR.lang.String.isMail(H))continue;return"mixed"}if(B=="C"){if(M=="prn")continue;return"mixed"}if(y==null)y=M;else if(y!==M)return"mixed"}return y==null?"prn":y},this.getX500Name=function(v){var y=this.getX500NameArray(v),b=this.dnarraytostr(y);return{array:y,str:b}},this.getX500NameArray=function(v){for(var y=[],b=e(v,0),T=0;T<b.length;T++)y.push(this.getRDN(o(v,b[T])));return y},this.getRDN=function(v){for(var y=[],b=e(v,0),T=0;T<b.length;T++)y.push(this.getAttrTypeAndValue(o(v,b[T])));return y},this.getAttrTypeAndValue=function(v){var y={type:null,value:null,ds:null},b=e(v,0),T=s(v,b[0],[],"06"),_=s(v,b[1],[]),S=KJUR.asn1.ASN1Util.oidHexToInt(T);return y.type=KJUR.asn1.x509.OID.oid2atype(S),y.ds=this.HEX2STAG[v.substr(b[1],2)],y.ds!="bmp"?y.value=hextoutf8(_):y.value=ucs2hextoutf8(_),y},this.readCertPEM=function(v){this.readCertHex(m(v))},this.readCertHex=function(v){this.hex=v,this.getVersion();try{p(this.hex,0,[0,7],"a3"),this.parseExt()}catch(y){}},this.getParam=function(){var v={};return v.version=this.getVersion(),v.serial={hex:this.getSerialNumberHex()},v.sigalg=this.getSignatureAlgorithmField(),v.issuer=this.getIssuer(),v.notbefore=this.getNotBefore(),v.notafter=this.getNotAfter(),v.subject=this.getSubject(),v.sbjpubkey=hextopem(this.getPublicKeyHex(),"PUBLIC KEY"),this.aExtInfo.length>0&&(v.ext=this.getExtParamArray()),v.sighex=this.getSignatureValueHex(),v},this.getExtParamArray=function(v){if(v==null){var y=f(this.hex,0,[0,"[3]"]);y!=-1&&(v=c(this.hex,0,[0,"[3]",0],"30"))}for(var b=[],T=e(v,0),_=0;_<T.length;_++){var S=o(v,T[_]),R=this.getExtParam(S);R!=null&&b.push(R)}return b},this.getExtParam=function(v){var y=e(v,0),b=y.length;if(b!=2&&b!=3)throw new Error("wrong number elements in Extension: "+b+" "+v);var T=A(s(v,0,[0],"06")),_=!1;b==3&&l(v,0,[1])=="0101ff"&&(_=!0);var S=l(v,0,[b-1,0]),R=void 0;if(T=="2.5.29.14"?R=this.getExtSubjectKeyIdentifier(S,_):T=="2.5.29.15"?R=this.getExtKeyUsage(S,_):T=="2.5.29.17"?R=this.getExtSubjectAltName(S,_):T=="2.5.29.18"?R=this.getExtIssuerAltName(S,_):T=="2.5.29.19"?R=this.getExtBasicConstraints(S,_):T=="2.5.29.31"?R=this.getExtCRLDistributionPoints(S,_):T=="2.5.29.32"?R=this.getExtCertificatePolicies(S,_):T=="2.5.29.35"?R=this.getExtAuthorityKeyIdentifier(S,_):T=="2.5.29.37"?R=this.getExtExtKeyUsage(S,_):T=="1.3.6.1.5.5.7.1.1"?R=this.getExtAuthorityInfoAccess(S,_):T=="2.5.29.20"?R=this.getExtCRLNumber(S,_):T=="2.5.29.21"?R=this.getExtCRLReason(S,_):T=="1.3.6.1.5.5.7.48.1.2"?R=this.getExtOcspNonce(S,_):T=="1.3.6.1.5.5.7.48.1.5"?R=this.getExtOcspNoCheck(S,_):T=="1.2.840.113583.1.1.9.1"&&(R=this.getExtAdobeTimeStamp(S,_)),R!=null)return R;var M={extname:T,extn:S};return _&&(M.critical=!0),M},this.findExt=function(v,y){for(var b=0;b<v.length;b++)if(v[b].extname==y)return v[b];return null},this.dnarraytostr=function(v){function y(T){return T.map(function(_){return b(_).replace(/\+/,"\\+")}).join("+")}function b(T){return T.type+"="+T.value}return"/"+v.map(function(T){return y(T).replace(/\//,"\\/")}).join("/")},this.getInfo=function(){var v=function(J){var G=JSON.stringify(J.array).replace(/[\[\]\{\}\"]/g,"");return G},y=function(J){for(var G="",Q=J.array,U=0;U<Q.length;U++){var q=Q[U];if(G+=" policy oid: "+q.policyoid+`
|
|
363
|
+
`,q.array!==void 0)for(var K=0;K<q.array.length;K++){var Y=q.array[K];Y.cps!==void 0&&(G+=" cps: "+Y.cps+`
|
|
364
|
+
`)}}return G},b=function(J){for(var G="",Q=J.array,U=0;U<Q.length;U++){var q=Q[U];try{q.dpname.full[0].uri!==void 0&&(G+=" "+q.dpname.full[0].uri+`
|
|
365
|
+
`)}catch(K){}try{q.dname.full[0].dn.hex!==void 0&&(G+=" "+X509.hex2dn(q.dpname.full[0].dn.hex)+`
|
|
366
|
+
`)}catch(K){}}return G},T=function(J){for(var G="",Q=J.array,U=0;U<Q.length;U++){var q=Q[U];q.caissuer!==void 0&&(G+=" caissuer: "+q.caissuer+`
|
|
367
|
+
`),q.ocsp!==void 0&&(G+=" ocsp: "+q.ocsp+`
|
|
368
|
+
`)}return G},_,S,R;if(_=`Basic Fields
|
|
369
369
|
`,_+=" serial number: "+this.getSerialNumberHex()+`
|
|
370
370
|
`,_+=" signature algorithm: "+this.getSignatureAlgorithmField()+`
|
|
371
371
|
`,_+=" issuer: "+this.getIssuerString()+`
|
|
@@ -394,7 +394,7 @@
|
|
|
394
394
|
`)),v.fragmentShader=v.fragmentShader.replace(/MAIN_START/g,w.map(function(q){return q.fragment.mainStart}).filter(function(q){return!!q}).join(`
|
|
395
395
|
`)),v.fragmentShader=v.fragmentShader.replace(/MAIN_END/g,w.map(function(q){return q.fragment.mainEnd}).filter(function(q){return!!q}).join(`
|
|
396
396
|
`)),v.fragmentShader=v.fragmentShader.replace(/MAIN_MODEL_COLOR/g,w.map(function(q){return q.fragment.mainModelColor}).filter(function(q){return!!q}).join(`
|
|
397
|
-
`));var J=String(r.clippers.length);v.vertexShader=v.vertexShader.replace(/NUM_CLIPPERS/g,J),v.fragmentShader=v.fragmentShader.replace(/NUM_CLIPPERS/g,J);for(var K=0,Q=w;K<Q.length;K++){var U=Q[K];U.onBeforeCompile&&U.onBeforeCompile(v,y)}};var c="";r.onBeforeRender=function(v,y,b,T,_,S){var R=r.shaderType;b instanceof Camera?(l.pixelRatio.value=b.pixelRatio,l.resolution.value.copy(b.resolution)):(l.pixelRatio.value=v.getPixelRatio(),v.getViewport(scratchViewport$2),l.resolution.value.set(scratchViewport$2.width,scratchViewport$2.height));var M=r.customShaders.filter(function(B){return B.type.includes(R)}),H=M.map(function(B){return"".concat(B.id,":").concat(B.version)}).join("|");c!==H&&(c=H,r.needsUpdate=!0)},Object.defineProperty(r,"uniform",{configurable:!1,enumerable:!1,get:function(){return l}});var p=(o=e==null?void 0:e.shaderType)!==null&&o!==void 0?o:"standard";defineProperty(r,"shaderType",{get:function(){return p},set:function(v){p!==v&&(p=v,this.needsUpdate=!0)}});var f=(s=e==null?void 0:e.combine)!==null&&s!==void 0?s:THREE__namespace.MultiplyOperation;defineProperty(r,"combine",{get:function(){return p!=="standard"?f:null},set:function(v){f=v}}),defineProperty(r,"isPBMMeshMaterial",{get:function(){return!0}}),defineProperty(r,"isShaderMaterial",{get:function(){return!0}}),defineProperty(r,"isMeshBasicMaterial",{get:function(){return p==="basic"||p==="none"}}),defineProperty(r,"isMeshPhongMaterial",{get:function(){return p==="phong"}}),defineProperty(r,"isMeshStandardMaterial",{get:function(){return p==="standard"}}),defineProperty(r,"vertexMarks",{get:function(){return!!u.USE_VERTEX_MARK},set:function(v){u.USE_VERTEX_MARK!==v&&(u.USE_VERTEX_MARK=v,this.needsUpdate=!0)}}),defineProperty(r,"colorAlpha",{get:function(){return l.colorAlpha.value},set:function(v){l.colorAlpha.value=v}});var d=null;defineProperty(r,"pano0",{get:function(){return d},set:function(v){d!==v&&(d=v,v===null?l.pano0.value={map:null,matrix:new THREE__namespace.Matrix4,zoom:1}:l.pano0.value={map:v.map,matrix:v.matrix,zoom:v.zoom})}});var h=null;defineProperty(r,"pano1",{get:function(){return h},set:function(v){h!==v&&(h=v,v===null?l.pano1.value={map:null,matrix:new THREE__namespace.Matrix4,zoom:1}:l.pano1.value={map:v.map,matrix:v.matrix,zoom:v.zoom})}});var g=null;defineProperty(r,"pano0Depth",{get:function(){return g},set:function(v){if(g!==v){g=v,v===null?(l.pano0Depth.value.map=null,l.pano0Depth.value.maxDepth=1):(l.pano0Depth.value.map=v.map,l.pano0Depth.value.maxDepth=v.maxDepth);var y=g!==null&&A!==null;u.USE_PANO_DEPTH!==y&&(u.USE_PANO_DEPTH=y,this.needsUpdate=!0)}}});var A=null;defineProperty(r,"pano1Depth",{get:function(){return A},set:function(v){if(A!==v){A=v,v===null?l.pano1Depth.value={map:null,maxDepth:1}:l.pano1Depth.value={map:v.map,maxDepth:v.maxDepth};var y=g!==null&&A!==null;u.USE_PANO_DEPTH!==y&&(u.USE_PANO_DEPTH=y,this.needsUpdate=!0)}}});var m=null;defineProperty(r,"refinedScreen",{get:function(){return m},set:function(v){if(m!==v){m=v;var y;v===null?(y=!1,l.refinedScreen.value={matrixInverse:new THREE__namespace.Matrix4,projectionMatrix:new THREE__namespace.Matrix4,map:null,pano:0,opacity:0}):(y=!0,l.refinedScreen.value={matrixInverse:v.matrixInverse,projectionMatrix:v.projectionMatrix,map:v.map,pano:v.pano,opacity:v.opacity}),u.USE_REFINED_SCREEN!==y&&(u.USE_REFINED_SCREEN=y,this.needsUpdate=!0)}}}),defineProperty(r,"modelAlpha",{get:function(){return l.modelAlpha.value},set:function(v){l.modelAlpha.value=v}}),defineProperty(r,"logDepthAlpha",{get:function(){return l.logDepthAlpha.value},set:function(v){l.logDepthAlpha.value=v}}),defineProperty(r,"progress",{get:function(){return l.progress.value},set:function(v){l.progress.value=v}}),defineProperty(r,"transition",{get:function(){return u.USE_BLACK_TRANSITION?"BLACK":u.USE_SPREAD_TRANSITION?"SPREAD":"FADE"},set:function(v){var y=u.USE_BLACK_TRANSITION,b=u.USE_SPREAD_TRANSITION,T=u.USE_FADE_TRANSITION;u.USE_BLACK_TRANSITION=!1,u.USE_SPREAD_TRANSITION=!1,u.USE_FADE_TRANSITION=!1,u["USE_".concat(v,"_TRANSITION")]=!0;var _=!1;y!==u.USE_BLACK_TRANSITION&&(_=!0),b!==u.USE_SPREAD_TRANSITION&&(_=!0),T!==u.USE_FADE_TRANSITION&&(_=!0),_&&(this.needsUpdate=!0)}}),defineProperty(r,"colorStyle",{get:function(){return u.USE_COLOR_CONSTANT?"CONSTANT":u.USE_COLOR_ALTITUDE?"ALTITUDE":"RGB"},set:function(v){var y=v==="CONSTANT",b=v==="ALTITUDE";u.USE_COLOR_CONSTANT!==y&&(u.USE_COLOR_CONSTANT=y,this.needsUpdate=!0),u.USE_COLOR_ALTITUDE!==b&&(u.USE_COLOR_ALTITUDE=b,this.needsUpdate=!0)}}),defineProperty(r,"constantColor",{get:function(){return l.constantColor.value},set:function(v){l.constantColor.value=v}}),defineProperty(r,"floorIndex",{get:function(){return l.floorIndex.value},set:function(v){l.floorIndex.value=v}}),defineProperty(r,"shownFloorIndex",{get:function(){return l.shownFloorIndex.value},set:function(v){l.shownFloorIndex.value=v}}),defineProperty(r,"floorStyle",{get:function(){return u.USE_FLOOR_STYLE_VISIBILITY?"VISIBILITY":"OPACITY"},set:function(v){var y=v==="VISIBILITY";u.USE_FLOOR_STYLE_VISIBILITY!==y&&(u.USE_FLOOR_STYLE_VISIBILITY=y,this.needsUpdate=!0)}}),defineProperty(r,"gradientTexture",{get:function(){return l.gradientTexture.value},set:function(v){l.gradientTexture.value=v}}),defineProperty(r,"brightness",{get:function(){return l.brightness.value},set:function(v){l.brightness.value=v}});var E=[];return defineProperty(r,"clippers",{get:function(){return E},set:function(v){E!==v&&(E=v,l.clippers.value=E.map(function(y){var b=typeof y.floorIndex=="number"?y.floorIndex:-1,T=new THREE__namespace.Matrix4().getInverse(y.clippingBoxMatrix);return{matrixInverse:T,floorIndex:b}}),this.needsUpdate=!0)}}),defineProperty(r,"colorSaturation",{get:function(){return l.colorSaturation.value},set:function(v){l.colorSaturation.value=v;var y=l.colorSaturation.value!==0||l.colorBrightness.value!==0;u.USE_COLOR_ADJUSTMENT!==y&&(u.USE_COLOR_ADJUSTMENT=y,this.needsUpdate=!0)}}),defineProperty(r,"colorBrightness",{get:function(){return l.colorBrightness.value},set:function(v){l.colorBrightness.value=v;var y=l.colorSaturation.value!==0||l.colorBrightness.value!==0;u.USE_COLOR_ADJUSTMENT!==y&&(u.USE_COLOR_ADJUSTMENT=y,this.needsUpdate=!0)}}),defineProperty(r,"useHQWeight",{get:function(){return u.USE_HQ_WEIGHT},set:function(v){v!==u.USE_HQ_WEIGHT&&(u.USE_HQ_WEIGHT=v,this.needsUpdate=!0)}}),defineProperty(r,"useHQDepth",{get:function(){return u.USE_HQ_DEPTH},set:function(v){v!==u.USE_HQ_DEPTH&&(u.USE_HQ_DEPTH=v,this.needsUpdate=!0)}}),defineProperty(r,"modelBoundingMin",{get:function(){return l.modelBoundingMin.value},set:function(v){l.modelBoundingMin.value=v}}),defineProperty(r,"modelBoundingMax",{get:function(){return l.modelBoundingMax.value},set:function(v){l.modelBoundingMax.value=v}}),typeof e=="object"&&r.setValues(e),r}return t.prototype.copy=function(e){return n.prototype.copy.call(this,e),this.shaderType=e.shaderType,this.vertexMarks=e.vertexMarks,this.vertexTangents=e.vertexColors,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.shininess=e.shininess,this.roughnessMap=e.roughnessMap,this.roughness=e.roughness,this.metalnessMap=e.metalnessMap,this.metalness=e.metalness,this.alphaMap=e.alphaMap,this.combine=e.combine,this.envMap=e.envMap,this.envMapIntensity=e.envMapIntensity,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.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this.customShaders=e.customShaders,this.colorAlpha=e.colorAlpha,this.alphaMode=e.alphaMode,this.pano0=e.pano0,this.pano1=e.pano1,this.modelAlpha=e.modelAlpha,this.logDepthAlpha=e.logDepthAlpha,this.progress=e.progress,this.transition=e.transition,this.colorStyle=e.colorStyle,this.constantColor.copy(e.constantColor),this.floorIndex=e.floorIndex,this.shownFloorIndex=e.shownFloorIndex,this.floorStyle=e.floorStyle,this.gradientTexture=e.gradientTexture,this.brightness=e.brightness,this.clippers=e.clippers,this.colorSaturation=e.colorSaturation,this.colorBrightness=e.colorBrightness,this.useEDL=e.useEDL,this.useHQWeight=e.useHQWeight,this.useHQDepth=e.useHQDepth,this.modelBoundingMin.copy(e.modelBoundingMin),this.modelBoundingMax.copy(e.modelBoundingMax),this},t.prototype.clone=function(){var e=this.constructor;return new e().copy(this)},t.prototype.refreshUniforms=function(){},t}(PBMMaterial),PBMMesh=function(n){__extends(t,n);function t(e,r){var o=n.call(this,e,r)||this;return o.onBeforeRender=function(s,u,l,c,p,f){p instanceof PBMMeshMaterial&&p.onBeforeRender&&p.onBeforeRender(s,u,l,c,o,f)},o}return t}(THREE__namespace.Mesh),PBMSkinnedMesh=function(n){__extends(t,n);function t(e,r,o){var s=n.call(this,e,r,o)||this;return s.onBeforeRender=function(u,l,c,p,f,d){f instanceof PBMMeshMaterial&&f.onBeforeRender&&f.onBeforeRender(u,l,c,p,s,d)},s}return t}(THREE__namespace.SkinnedMesh);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||V{qr\x07H0vs{qrs-SYNal`UNQRQ--n\bv{t-rp@-[|znyH0r{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-sy|n-_||sZnxHn\bv{t-rpA-d|yq]|vv|{Hn\bv{t-rpA-Sv{ny]|vv|{Hn\bv{t-rp@-PnzrnQvrpv|{Hn\bv{t-sy|n-Y|tQr}uHn\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-y|tQr}uNy}unH{vs|z-sy|n-u|{Sy||V{qr\x07H{vs|z-rp@-z|qryO|{qv{tZn\x07H{vs|z-rp@-z|qryO|{qv{tZv{H0v{pyqr-Ip|zz|{K0v{pyqr-Is|tl}nlsntzr{K0v{pyqr-Iy|tqr}uosl}nlsntzr{K0v{pyqr-Ipyv}}v{tl}yn{rl}nlsntzr{KZNV[lORS\\_R|vq-znv{56-\n--ZNV[l`aN_a--<<-JJJ-点-大小-形状-剔除-JJJ--vs-5]|v{`v r-I-=;==>6-\n----qvpnqH--\f--sy|n-}-J-?;=-7-tyl]|v{P||q;\x07-:->;=H--sy|n-}-J-?;=-7-tyl]|v{P||q;\b-:->;=H--sy|n-}-J-}-7-}-8-}-7-}H--<<-JJJ-形状裁切-JJJ--0vs-qrsv{rq5b`Rl]\\V[al`UN]RlPV_PYR6----vs-5]|v{`v r-K-@;=-33-}-K->;=6-\n------qvpnqH----\f--0r{qvs--<<-JJJJJJJJJJJJJ--<<-JJJ-楼层-JJJ--o||y-vPr{Sy||-J-u|{Sy||V{qr\x07-I-:=;=>-\v\v-no5sy||V{qr\x07-:-u|{Sy||V{qr\x076-I-=;FFH--sy|n-sy||\\}npv\b-J->;=H--vs-5.vPr{Sy||6-\n----0vs-qrsv{rq5b`RlSY\\\\_l`afYRlcV`VOVYVaf6------qvpnqH----0r{qvs----sy||\\}npv\b-J-pynz}5=;?-7-zv{55>;=-8-PnzrnQvrpv|{;\b69->;=69-=;=9->;=6H--\f--<<-JJJJJJJJJJJ--<<-JJJ-顶部裁切-JJJ--sy|n-||sP]|tr-J-}|5pynz}5:PnzrnQvrpv|{;\b9-=;=9->;=69-@;=6H--vs-5----_||sZnx-K-=;==>-33----Sv{ny]|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-Sv{ny]|vv|{H------pyv}}rq-J-5pyv}}rh-v-j;sy||V{qr\x07-I-=;=-\v\v-no5sy||V{qr\x07-:-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--0v{pyqr-Iy|tqr}uoslsntzr{K--<<-JJJ-颜色-JJJ--tylSntP|y|-J-rpA5P|y|9-|}npv\b-7-sy||\\}npv\b-7-z|qryNy}un6H--ZNV[lZ\\QRYlP\\Y\\_--0v{pyqr-I|{rzn}}v{tlsntzr{K--0v{pyqr-Ir{p|qv{tlsntzr{K--0v{pyqr-Is|tlsntzr{K--0v{pyqr-I}rzyv}yvrqlny}unlsntzr{K--<<-JJJJ-使用深度表示-ny}un-JJJJ--tylSntP|y|;n-J-zv\x075tylSntP|y|;n9-Y|tQr}u9-y|tQr}uNy}un6H--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-sy|n-lsrnrlvqlznxHn\bv{t-sy|n-_||sZnxH0vs-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{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-rp@-z|qryO|{qv{tZn\x07H{vs|z-rp@-z|qryO|{qv{tZv{H<<u调整{vs|z-sy|n-p|y|`nnv|{H{vs|z-sy|n-p|y|Ovtu{rH<<-边缘增益{vs|z-sy|n-|yv{rTnv{H{vs|z-sy|n-qvn{prTnv{Hn\bv{t-rpA-d|yq]|vv|{Hn\bv{t-rpA-Sv{ny]|vv|{Hn\bv{t-rp@-PnzrnQvrpv|{Hn\bv{t-sy|n-Y|tQr}uHn\bv{t-rp@-P|y|Hn\bv{t-sy|n-]|v{`v rH0vs{qrs-SYNal`UNQRQ--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@-_TOa|Yv{rn5rp@-nyr6-\n--r{-zv\x075----}|5-nyr;to-7-=;FADECD?FEC-8-rp@5-=;=B?>@?D=>A-69-rp@5-?;A-6-69----nyr;to-7-=;=DD@FF@E=E9----rp@5-yraun{R\0ny5-nyr;to9-rp@5-=;=A=AB-6-6-6--6H\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-|yq]|vv|{6-\n--sy|n--J-5|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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s-SYNal`UNQRQ----[|zny-J-{|znyv r5zn@5z|qryZnv\x076-7-{|zny6H--0r{qvs--<<-JJJ-背面渲染-JJJ--0vs{qrs-SYNal`UNQRQ----0vs-qrsv{rq5b`Rl]\\V[alONPXlUVQQR[6------rp@-pnzrnQvrpv|{-J-{|znyv r5pnzrn]|vv|{-:-Sv{ny]|vv|{;\x07\b 6H------vs-5q|5pnzrnQvrpv|{9-[|zny6-I-=;=6-\n--------]|v{`v r-J-=;=H------\f----0ryvs-qrsv{rq5b`Rl]\\V[alONPXlQN_X6------rp@-pnzrnQvrpv|{-J-{|znyv r5pnzrn]|vv|{-:-Sv{ny]|vv|{;\x07\b 6H------vs-5q|5pnzrnQvrpv|{9-[|zny6-I-=;=6-\n--------P|y|;\x07\b -J-P|y|;\x07\b -7-=;EH------\f----0r{qvs--0r{qvs--<<-JJJ-颜色增益调整-JJJ--0vs-qrsv{rq5b`RlP\\Y\\_lNQWb`aZR[a6----rp@-uP|y|-J-to?u5P|y|6H----uP|y|;\b-8J-p|y|`nnv|{H----uP|y|; -8J-p|y|Ovtu{rH----0vs{qrs-SYNal`UNQRQ------rp@-vrQv-J-{|znyv r5v\\u|tn}uvp-L-PnzrnQvrpv|{-G-Sv{ny]|vv|{;\x07\b -:-pnzrn]|vv|{6H------<<-计算边缘增益------sy|n-p|aurn-J-q|5{|znyv r5[|zny69-vrQv6H------sy|n-n{tyr-J-np|5p|aurn6H------sy|n-|yv{rSnp|-J-}|5>;=-:-no5n{tyr-:-]VlUNYS6-<-]VlUNYS9-B;=6H------uP|y|; -8J-|yv{rTnv{-7-|yv{rSnp|H-<<-增加亮度------uP|y|; -J-pynz}5uP|y|; 9-=;=9->;=6H------<<-距离增益------rp@-o|{qv{tPr{r-J-5z|qryO|{qv{tZn\x07-8-z|qryO|{qv{tZv{6-<-?;=H------sy|n-o|{qv{tYr{tu-J-yr{tu5z|qryO|{qv{tZn\x07;\b-:-z|qryO|{qv{tZv{;\b6-7->;BH------sy|n-nrntrQvn{pr-J->=;=H-<<-设定一个平均距离------rp@-pnzrna|]|v{-J-Sv{ny]|vv|{;\x07\b -:-pnzrn]|vv|{H------sy|n-pnzrnO|{qv{tQvn{pr-J-zn\x075=;=9-yr{tu5pnzrn]|vv|{-:-o|{qv{tPr{r6-:-o|{qv{tYr{tu-<-?;=6H------sy|n-pnzrnQvn{pr-J-yr{tu5v\\u|tn}uvp-L-vrQv-7-q|5vrQv9-pnzrna|]|v{6-G-pnzrna|]|v{6-:-pnzrnO|{qv{tQvn{prH------sy|n-qvn{prSnp|-J-pynz}5zn\x075pnzrnQvn{pr-:-nrntrQvn{pr9-=;=6-<-o|{qv{tYr{tu9-=;=9->;=6H------qvn{prSnp|-J-5=;E-:-pynz}5>;=-:-}|5>;=-:-qvn{prSnp|9-@;=69-=;=9->;=66-7->?;=H------uP|y|; -8J-zv\x075uP|y|; -7-qvn{prTnv{-7-qvn{prSnp|9-=;=9-|yv{rSnp|6H-<<-增加透明度------uP|y|; -J-pynz}5uP|y|; 9-=;=9->;=6H----0r{qvs----P|y|-J-zn\x075u?to5uP|y|69-=;=6H--0r{qvs--<<-JJJJJJJJJJJJJJJJJJ--Y|tQr}u-J-y|t?5:z]|vv|{; 6H--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--_||sZnx-J-=;=H--0vs-qrsv{rq5b`RlcR_aRelZN_X6----_||sZnx-J-z||ur}5_\\\\SlZN_X-:-ZN_Xl`aR]9-_\\\\SlZN_X9-lsrnrlvqlznx6H--0r{qvs--0v{pyqr-I|yq}|lrr\x07K--0v{pyqr-Is|tlrr\x07K--ZNV[lR[Q\f");var scratchViewport$1=new THREE__namespace.Vector4,pbmUniforms={pointScale:new Uniform(1),pointMinPixel:new Uniform(1),pointMaxPixel:new Uniform(1),modelAlpha:new Uniform(1),logDepthAlpha:new Uniform(0),gradientTexture:new Uniform(null),clippers:new Uniform([]),shownFloorIndex:new Uniform(-1),constantColor:new Uniform(new THREE__namespace.Vector3),floorIndex:new Uniform(0),brightness:new Uniform(1),colorSaturation:new Uniform(0),colorBrightness:new Uniform(0),outlineGain:new Uniform(0),distanceGain:new Uniform(0),pixelRatio:new Uniform(1),resolution:new Uniform(new THREE__namespace.Vector2(512,512)),modelBoundingMin:new Uniform(new THREE__namespace.Vector3),modelBoundingMax:new Uniform(new THREE__namespace.Vector3)},shaderLib={pointcloud:{vertexShader:pointCloudVertexShader,fragmentShader:pointCloudFragmentShader}},uniformsLib=mergeUniforms({opacity:{value:1}},pbmUniforms),definesLib={USE_VERTEX_MARK:!1,USE_COLOR_CONSTANT:!1,USE_COLOR_ALTITUDE:!1,USE_COLOR_ADJUSTMENT:!1,USE_FLOOR_STYLE_VISIBILITY:!1,USE_POINT_SHAPE_CIRCLE:!1,USE_POINT_SIZE_ATTENUATION:!1,USE_POINT_BACK_HIDDEN:!1,USE_POINT_BACK_DARK:!1,USE_HQ_WEIGHT:!1,USE_HQ_DEPTH:!1},PBMPointCloudMaterial=function(n){__extends(t,n);function t(e){var r=n.call(this)||this;r.shaderType="pointcloud",r.clipping=!0,r.customShaders=[],r.vertexColors=!0,r.type="PBMPointCloudMaterial";var o=Object.assign({},definesLib),s=cloneUniforms(uniformsLib);r.defines=o,r.onBeforeCompile=function(c,p){var f,d,h=r.shaderType;c.vertexShader=shaderLib[h].vertexShader,c.fragmentShader=shaderLib[h].fragmentShader,c.uniforms=s;for(var g=0,A=Object.keys(o);g<A.length;g++){var m=A[g];m in definesLib||delete o[m]}for(var E=0,v=Object.keys(s);E<v.length;E++){var y=v[E];y in uniformsLib||delete s[y]}for(var b=r.customShaders.filter(function(I){return I.type.includes(h)}),T=0,_=b;T<_.length;T++){var S=_[T];for(var R in S.uniforms)R in s||Object.assign(s,(f={},f[R]=S.uniforms[R],f));for(var M in S.defines)M in o||Object.assign(o,(d={},d[M]=S.defines[M],d))}c.vertexShader=c.vertexShader.replace(/MAIN_BEFORE/g,b.map(function(I){return I.vertex.mainBefore}).filter(function(I){return!!I}).join(`
|
|
397
|
+
`));var J=String(r.clippers.length);v.vertexShader=v.vertexShader.replace(/NUM_CLIPPERS/g,J),v.fragmentShader=v.fragmentShader.replace(/NUM_CLIPPERS/g,J);for(var G=0,Q=w;G<Q.length;G++){var U=Q[G];U.onBeforeCompile&&U.onBeforeCompile(v,y)}};var c="";r.onBeforeRender=function(v,y,b,T,_,S){var R=r.shaderType;b instanceof Camera?(l.pixelRatio.value=b.pixelRatio,l.resolution.value.copy(b.resolution)):(l.pixelRatio.value=v.getPixelRatio(),v.getViewport(scratchViewport$2),l.resolution.value.set(scratchViewport$2.width,scratchViewport$2.height));var M=r.customShaders.filter(function(B){return B.type.includes(R)}),H=M.map(function(B){return"".concat(B.id,":").concat(B.version)}).join("|");c!==H&&(c=H,r.needsUpdate=!0)},Object.defineProperty(r,"uniform",{configurable:!1,enumerable:!1,get:function(){return l}});var p=(o=e==null?void 0:e.shaderType)!==null&&o!==void 0?o:"standard";defineProperty(r,"shaderType",{get:function(){return p},set:function(v){p!==v&&(p=v,this.needsUpdate=!0)}});var f=(s=e==null?void 0:e.combine)!==null&&s!==void 0?s:THREE__namespace.MultiplyOperation;defineProperty(r,"combine",{get:function(){return p!=="standard"?f:null},set:function(v){f=v}}),defineProperty(r,"isPBMMeshMaterial",{get:function(){return!0}}),defineProperty(r,"isShaderMaterial",{get:function(){return!0}}),defineProperty(r,"isMeshBasicMaterial",{get:function(){return p==="basic"||p==="none"}}),defineProperty(r,"isMeshPhongMaterial",{get:function(){return p==="phong"}}),defineProperty(r,"isMeshStandardMaterial",{get:function(){return p==="standard"}}),defineProperty(r,"vertexMarks",{get:function(){return!!u.USE_VERTEX_MARK},set:function(v){u.USE_VERTEX_MARK!==v&&(u.USE_VERTEX_MARK=v,this.needsUpdate=!0)}}),defineProperty(r,"colorAlpha",{get:function(){return l.colorAlpha.value},set:function(v){l.colorAlpha.value=v}});var d=null;defineProperty(r,"pano0",{get:function(){return d},set:function(v){d!==v&&(d=v,v===null?l.pano0.value={map:null,matrix:new THREE__namespace.Matrix4,zoom:1}:l.pano0.value={map:v.map,matrix:v.matrix,zoom:v.zoom})}});var h=null;defineProperty(r,"pano1",{get:function(){return h},set:function(v){h!==v&&(h=v,v===null?l.pano1.value={map:null,matrix:new THREE__namespace.Matrix4,zoom:1}:l.pano1.value={map:v.map,matrix:v.matrix,zoom:v.zoom})}});var g=null;defineProperty(r,"pano0Depth",{get:function(){return g},set:function(v){if(g!==v){g=v,v===null?(l.pano0Depth.value.map=null,l.pano0Depth.value.maxDepth=1):(l.pano0Depth.value.map=v.map,l.pano0Depth.value.maxDepth=v.maxDepth);var y=g!==null&&A!==null;u.USE_PANO_DEPTH!==y&&(u.USE_PANO_DEPTH=y,this.needsUpdate=!0)}}});var A=null;defineProperty(r,"pano1Depth",{get:function(){return A},set:function(v){if(A!==v){A=v,v===null?l.pano1Depth.value={map:null,maxDepth:1}:l.pano1Depth.value={map:v.map,maxDepth:v.maxDepth};var y=g!==null&&A!==null;u.USE_PANO_DEPTH!==y&&(u.USE_PANO_DEPTH=y,this.needsUpdate=!0)}}});var m=null;defineProperty(r,"refinedScreen",{get:function(){return m},set:function(v){if(m!==v){m=v;var y;v===null?(y=!1,l.refinedScreen.value={matrixInverse:new THREE__namespace.Matrix4,projectionMatrix:new THREE__namespace.Matrix4,map:null,pano:0,opacity:0}):(y=!0,l.refinedScreen.value={matrixInverse:v.matrixInverse,projectionMatrix:v.projectionMatrix,map:v.map,pano:v.pano,opacity:v.opacity}),u.USE_REFINED_SCREEN!==y&&(u.USE_REFINED_SCREEN=y,this.needsUpdate=!0)}}}),defineProperty(r,"modelAlpha",{get:function(){return l.modelAlpha.value},set:function(v){l.modelAlpha.value=v}}),defineProperty(r,"logDepthAlpha",{get:function(){return l.logDepthAlpha.value},set:function(v){l.logDepthAlpha.value=v}}),defineProperty(r,"progress",{get:function(){return l.progress.value},set:function(v){l.progress.value=v}}),defineProperty(r,"transition",{get:function(){return u.USE_BLACK_TRANSITION?"BLACK":u.USE_SPREAD_TRANSITION?"SPREAD":"FADE"},set:function(v){var y=u.USE_BLACK_TRANSITION,b=u.USE_SPREAD_TRANSITION,T=u.USE_FADE_TRANSITION;u.USE_BLACK_TRANSITION=!1,u.USE_SPREAD_TRANSITION=!1,u.USE_FADE_TRANSITION=!1,u["USE_".concat(v,"_TRANSITION")]=!0;var _=!1;y!==u.USE_BLACK_TRANSITION&&(_=!0),b!==u.USE_SPREAD_TRANSITION&&(_=!0),T!==u.USE_FADE_TRANSITION&&(_=!0),_&&(this.needsUpdate=!0)}}),defineProperty(r,"colorStyle",{get:function(){return u.USE_COLOR_CONSTANT?"CONSTANT":u.USE_COLOR_ALTITUDE?"ALTITUDE":"RGB"},set:function(v){var y=v==="CONSTANT",b=v==="ALTITUDE";u.USE_COLOR_CONSTANT!==y&&(u.USE_COLOR_CONSTANT=y,this.needsUpdate=!0),u.USE_COLOR_ALTITUDE!==b&&(u.USE_COLOR_ALTITUDE=b,this.needsUpdate=!0)}}),defineProperty(r,"constantColor",{get:function(){return l.constantColor.value},set:function(v){l.constantColor.value=v}}),defineProperty(r,"floorIndex",{get:function(){return l.floorIndex.value},set:function(v){l.floorIndex.value=v}}),defineProperty(r,"shownFloorIndex",{get:function(){return l.shownFloorIndex.value},set:function(v){l.shownFloorIndex.value=v}}),defineProperty(r,"floorStyle",{get:function(){return u.USE_FLOOR_STYLE_VISIBILITY?"VISIBILITY":"OPACITY"},set:function(v){var y=v==="VISIBILITY";u.USE_FLOOR_STYLE_VISIBILITY!==y&&(u.USE_FLOOR_STYLE_VISIBILITY=y,this.needsUpdate=!0)}}),defineProperty(r,"gradientTexture",{get:function(){return l.gradientTexture.value},set:function(v){l.gradientTexture.value=v}}),defineProperty(r,"brightness",{get:function(){return l.brightness.value},set:function(v){l.brightness.value=v}});var E=[];return defineProperty(r,"clippers",{get:function(){return E},set:function(v){E!==v&&(E=v,l.clippers.value=E.map(function(y){var b=typeof y.floorIndex=="number"?y.floorIndex:-1,T=new THREE__namespace.Matrix4().getInverse(y.clippingBoxMatrix);return{matrixInverse:T,floorIndex:b}}),this.needsUpdate=!0)}}),defineProperty(r,"colorSaturation",{get:function(){return l.colorSaturation.value},set:function(v){l.colorSaturation.value=v;var y=l.colorSaturation.value!==0||l.colorBrightness.value!==0;u.USE_COLOR_ADJUSTMENT!==y&&(u.USE_COLOR_ADJUSTMENT=y,this.needsUpdate=!0)}}),defineProperty(r,"colorBrightness",{get:function(){return l.colorBrightness.value},set:function(v){l.colorBrightness.value=v;var y=l.colorSaturation.value!==0||l.colorBrightness.value!==0;u.USE_COLOR_ADJUSTMENT!==y&&(u.USE_COLOR_ADJUSTMENT=y,this.needsUpdate=!0)}}),defineProperty(r,"useHQWeight",{get:function(){return u.USE_HQ_WEIGHT},set:function(v){v!==u.USE_HQ_WEIGHT&&(u.USE_HQ_WEIGHT=v,this.needsUpdate=!0)}}),defineProperty(r,"useHQDepth",{get:function(){return u.USE_HQ_DEPTH},set:function(v){v!==u.USE_HQ_DEPTH&&(u.USE_HQ_DEPTH=v,this.needsUpdate=!0)}}),defineProperty(r,"modelBoundingMin",{get:function(){return l.modelBoundingMin.value},set:function(v){l.modelBoundingMin.value=v}}),defineProperty(r,"modelBoundingMax",{get:function(){return l.modelBoundingMax.value},set:function(v){l.modelBoundingMax.value=v}}),typeof e=="object"&&r.setValues(e),r}return t.prototype.copy=function(e){return n.prototype.copy.call(this,e),this.shaderType=e.shaderType,this.vertexMarks=e.vertexMarks,this.vertexTangents=e.vertexColors,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.shininess=e.shininess,this.roughnessMap=e.roughnessMap,this.roughness=e.roughness,this.metalnessMap=e.metalnessMap,this.metalness=e.metalness,this.alphaMap=e.alphaMap,this.combine=e.combine,this.envMap=e.envMap,this.envMapIntensity=e.envMapIntensity,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.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this.customShaders=e.customShaders,this.colorAlpha=e.colorAlpha,this.alphaMode=e.alphaMode,this.pano0=e.pano0,this.pano1=e.pano1,this.modelAlpha=e.modelAlpha,this.logDepthAlpha=e.logDepthAlpha,this.progress=e.progress,this.transition=e.transition,this.colorStyle=e.colorStyle,this.constantColor.copy(e.constantColor),this.floorIndex=e.floorIndex,this.shownFloorIndex=e.shownFloorIndex,this.floorStyle=e.floorStyle,this.gradientTexture=e.gradientTexture,this.brightness=e.brightness,this.clippers=e.clippers,this.colorSaturation=e.colorSaturation,this.colorBrightness=e.colorBrightness,this.useEDL=e.useEDL,this.useHQWeight=e.useHQWeight,this.useHQDepth=e.useHQDepth,this.modelBoundingMin.copy(e.modelBoundingMin),this.modelBoundingMax.copy(e.modelBoundingMax),this},t.prototype.clone=function(){var e=this.constructor;return new e().copy(this)},t.prototype.refreshUniforms=function(){},t}(PBMMaterial),PBMMesh=function(n){__extends(t,n);function t(e,r){var o=n.call(this,e,r)||this;return o.onBeforeRender=function(s,u,l,c,p,f){p instanceof PBMMeshMaterial&&p.onBeforeRender&&p.onBeforeRender(s,u,l,c,o,f)},o}return t}(THREE__namespace.Mesh),PBMSkinnedMesh=function(n){__extends(t,n);function t(e,r,o){var s=n.call(this,e,r,o)||this;return s.onBeforeRender=function(u,l,c,p,f,d){f instanceof PBMMeshMaterial&&f.onBeforeRender&&f.onBeforeRender(u,l,c,p,s,d)},s}return t}(THREE__namespace.SkinnedMesh);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||V{qr\x07H0vs{qrs-SYNal`UNQRQ--n\bv{t-rp@-[|znyH0r{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-sy|n-_||sZnxHn\bv{t-rpA-d|yq]|vv|{Hn\bv{t-rpA-Sv{ny]|vv|{Hn\bv{t-rp@-PnzrnQvrpv|{Hn\bv{t-sy|n-Y|tQr}uHn\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-y|tQr}uNy}unH{vs|z-sy|n-u|{Sy||V{qr\x07H{vs|z-rp@-z|qryO|{qv{tZn\x07H{vs|z-rp@-z|qryO|{qv{tZv{H0v{pyqr-Ip|zz|{K0v{pyqr-Is|tl}nlsntzr{K0v{pyqr-Iy|tqr}uosl}nlsntzr{K0v{pyqr-Ipyv}}v{tl}yn{rl}nlsntzr{KZNV[lORS\\_R|vq-znv{56-\n--ZNV[l`aN_a--<<-JJJ-点-大小-形状-剔除-JJJ--vs-5]|v{`v r-I-=;==>6-\n----qvpnqH--\f--sy|n-}-J-?;=-7-tyl]|v{P||q;\x07-:->;=H--sy|n-}-J-?;=-7-tyl]|v{P||q;\b-:->;=H--sy|n-}-J-}-7-}-8-}-7-}H--<<-JJJ-形状裁切-JJJ--0vs-qrsv{rq5b`Rl]\\V[al`UN]RlPV_PYR6----vs-5]|v{`v r-K-@;=-33-}-K->;=6-\n------qvpnqH----\f--0r{qvs--<<-JJJJJJJJJJJJJ--<<-JJJ-楼层-JJJ--o||y-vPr{Sy||-J-u|{Sy||V{qr\x07-I-:=;=>-\v\v-no5sy||V{qr\x07-:-u|{Sy||V{qr\x076-I-=;FFH--sy|n-sy||\\}npv\b-J->;=H--vs-5.vPr{Sy||6-\n----0vs-qrsv{rq5b`RlSY\\\\_l`afYRlcV`VOVYVaf6------qvpnqH----0r{qvs----sy||\\}npv\b-J-pynz}5=;?-7-zv{55>;=-8-PnzrnQvrpv|{;\b69->;=69-=;=9->;=6H--\f--<<-JJJJJJJJJJJ--<<-JJJ-顶部裁切-JJJ--sy|n-||sP]|tr-J-}|5pynz}5:PnzrnQvrpv|{;\b9-=;=9->;=69-@;=6H--vs-5----_||sZnx-K-=;==>-33----Sv{ny]|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-Sv{ny]|vv|{H------pyv}}rq-J-5pyv}}rh-v-j;sy||V{qr\x07-I-=;=-\v\v-no5sy||V{qr\x07-:-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--0v{pyqr-Iy|tqr}uoslsntzr{K--<<-JJJ-颜色-JJJ--tylSntP|y|-J-rpA5P|y|9-|}npv\b-7-sy||\\}npv\b-7-z|qryNy}un6H--ZNV[lZ\\QRYlP\\Y\\_--0v{pyqr-I|{rzn}}v{tlsntzr{K--0v{pyqr-Ir{p|qv{tlsntzr{K--0v{pyqr-Is|tlsntzr{K--0v{pyqr-I}rzyv}yvrqlny}unlsntzr{K--<<-JJJJ-使用深度表示-ny}un-JJJJ--tylSntP|y|;n-J-zv\x075tylSntP|y|;n9-Y|tQr}u9-y|tQr}uNy}un6H--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-sy|n-lsrnrlvq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-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`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-_TOa|Yv{rn5p|y|6H--<<-JJJ-高度色-JJJ--0vs-qrsv{rq5b`RlP\\Y\\_lNYaVabQR6----P|y|-J-trP|y|O\bUrvtu5tnqvr{ar\x07r9-Sv{ny]|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{qrs-SYNal`UNQRQ----[|zny-J-{|znyv r5zn@5z|qryZnv\x076-7-{|zny6H--0r{qvs--<<-JJJ-背面渲染-JJJ--0vs{qrs-SYNal`UNQRQ----0vs-qrsv{rq5b`Rl]\\V[alONPXlUVQQR[6------rp@-pnzrnQvrpv|{-J-{|znyv r5pnzrn]|vv|{-:-Sv{ny]|vv|{;\x07\b 6H------vs-5q|5pnzrnQvrpv|{9-[|zny6-I-=;=6-\n--------]|v{`v r-J-=;=H------\f----0ryvs-qrsv{rq5b`Rl]\\V[alONPXlQN_X6------rp@-pnzrnQvrpv|{-J-{|znyv r5pnzrn]|vv|{-:-Sv{ny]|vv|{;\x07\b 6H------vs-5q|5pnzrnQvrpv|{9-[|zny6-I-=;=6-\n--------P|y|;\x07\b -J-P|y|;\x07\b -7-=;EH------\f----0r{qvs--0r{qvs--<<-JJJ-颜色增益调整-JJJ--0vs-qrsv{rq5b`RlP\\Y\\_lNQWb`aZR[a6----rp@-uP|y|-J-to?u5P|y|6H----uP|y|;\b-8J-p|y|`nnv|{H----uP|y|; -8J-p|y|Ovtu{rH----0vs{qrs-SYNal`UNQRQ------rp@-vrQv-J-{|znyv r5v\\u|tn}uvp-L-PnzrnQvrpv|{-G-Sv{ny]|vv|{;\x07\b -:-pnzrn]|vv|{6H------<<-计算边缘增益------sy|n-p|aurn-J-q|5{|znyv r5[|zny69-vrQv6H------sy|n-n{tyr-J-np|5p|aurn6H------sy|n-|yv{rSnp|-J-}|5>;=-:-no5n{tyr-:-]VlUNYS6-<-]VlUNYS9-B;=6H------uP|y|; -8J-|yv{rTnv{-7-|yv{rSnp|H-<<-增加亮度------uP|y|; -J-pynz}5uP|y|; 9-=;=9->;=6H------<<-距离增益------rp@-o|{qv{tPr{r-J-5z|qryO|{qv{tZn\x07-8-z|qryO|{qv{tZv{6-<-?;=H------sy|n-o|{qv{tYr{tu-J-yr{tu5z|qryO|{qv{tZn\x07;\b-:-z|qryO|{qv{tZv{;\b6-7->;BH------sy|n-nrntrQvn{pr-J->=;=H-<<-设定一个平均距离------rp@-pnzrna|]|v{-J-Sv{ny]|vv|{;\x07\b -:-pnzrn]|vv|{H------sy|n-pnzrnO|{qv{tQvn{pr-J-zn\x075=;=9-yr{tu5pnzrn]|vv|{-:-o|{qv{tPr{r6-:-o|{qv{tYr{tu-<-?;=6H------sy|n-pnzrnQvn{pr-J-yr{tu5v\\u|tn}uvp-L-vrQv-7-q|5vrQv9-pnzrna|]|v{6-G-pnzrna|]|v{6-:-pnzrnO|{qv{tQvn{prH------sy|n-qvn{prSnp|-J-pynz}5zn\x075pnzrnQvn{pr-:-nrntrQvn{pr9-=;=6-<-o|{qv{tYr{tu9-=;=9->;=6H------qvn{prSnp|-J-5=;E-:-pynz}5>;=-:-}|5>;=-:-qvn{prSnp|9-@;=69-=;=9->;=66-7->?;=H------uP|y|; -8J-zv\x075uP|y|; -7-qvn{prTnv{-7-qvn{prSnp|9-=;=9-|yv{rSnp|6H-<<-增加透明度------uP|y|; -J-pynz}5uP|y|; 9-=;=9->;=6H----0r{qvs----P|y|-J-zn\x075u?to5uP|y|69-=;=6H--0r{qvs--<<-JJJJJJJJJJJJJJJJJJ--Y|tQr}u-J-y|t?5:z]|vv|{; 6H--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--_||sZnx-J-=;=H--0vs-qrsv{rq5b`RlcR_aRelZN_X6----_||sZnx-J-z||ur}5_\\\\SlZN_X-:-ZN_Xl`aR]9-_\\\\SlZN_X9-lsrnrlvqlznx6H--0r{qvs--0v{pyqr-I|yq}|lrr\x07K--0v{pyqr-Is|tlrr\x07K--ZNV[lR[Q\f");var scratchViewport$1=new THREE__namespace.Vector4,pbmUniforms={pointScale:new Uniform(1),pointMinPixel:new Uniform(1),pointMaxPixel:new Uniform(1),modelAlpha:new Uniform(1),logDepthAlpha:new Uniform(0),gradientTexture:new Uniform(null),clippers:new Uniform([]),shownFloorIndex:new Uniform(-1),constantColor:new Uniform(new THREE__namespace.Vector3),floorIndex:new Uniform(0),brightness:new Uniform(1),colorSaturation:new Uniform(0),colorBrightness:new Uniform(0),outlineGain:new Uniform(0),distanceGain:new Uniform(0),pixelRatio:new Uniform(1),resolution:new Uniform(new THREE__namespace.Vector2(512,512)),modelBoundingMin:new Uniform(new THREE__namespace.Vector3),modelBoundingMax:new Uniform(new THREE__namespace.Vector3)},shaderLib={pointcloud:{vertexShader:pointCloudVertexShader,fragmentShader:pointCloudFragmentShader}},uniformsLib=mergeUniforms({opacity:{value:1}},pbmUniforms),definesLib={USE_VERTEX_MARK:!1,USE_COLOR_CONSTANT:!1,USE_COLOR_ALTITUDE:!1,USE_COLOR_ADJUSTMENT:!1,USE_FLOOR_STYLE_VISIBILITY:!1,USE_POINT_SHAPE_CIRCLE:!1,USE_POINT_SIZE_ATTENUATION:!1,USE_POINT_BACK_HIDDEN:!1,USE_POINT_BACK_DARK:!1,USE_HQ_WEIGHT:!1,USE_HQ_DEPTH:!1},PBMPointCloudMaterial=function(n){__extends(t,n);function t(e){var r=n.call(this)||this;r.shaderType="pointcloud",r.clipping=!0,r.customShaders=[],r.vertexColors=!0,r.type="PBMPointCloudMaterial";var o=Object.assign({},definesLib),s=cloneUniforms(uniformsLib);r.defines=o,r.onBeforeCompile=function(c,p){var f,d,h=r.shaderType;c.vertexShader=shaderLib[h].vertexShader,c.fragmentShader=shaderLib[h].fragmentShader,c.uniforms=s;for(var g=0,A=Object.keys(o);g<A.length;g++){var m=A[g];m in definesLib||delete o[m]}for(var E=0,v=Object.keys(s);E<v.length;E++){var y=v[E];y in uniformsLib||delete s[y]}for(var b=r.customShaders.filter(function(I){return I.type.includes(h)}),T=0,_=b;T<_.length;T++){var S=_[T];for(var R in S.uniforms)R in s||Object.assign(s,(f={},f[R]=S.uniforms[R],f));for(var M in S.defines)M in o||Object.assign(o,(d={},d[M]=S.defines[M],d))}c.vertexShader=c.vertexShader.replace(/MAIN_BEFORE/g,b.map(function(I){return I.vertex.mainBefore}).filter(function(I){return!!I}).join(`
|
|
398
398
|
`)),c.vertexShader=c.vertexShader.replace(/MAIN_START/g,b.map(function(I){return I.vertex.mainStart}).filter(function(I){return!!I}).join(`
|
|
399
399
|
`)),c.vertexShader=c.vertexShader.replace(/MAIN_END/g,b.map(function(I){return I.vertex.mainEnd}).filter(function(I){return!!I}).join(`
|
|
400
400
|
`)),c.fragmentShader=c.fragmentShader.replace(/MAIN_BEFORE/g,b.map(function(I){return I.fragment.mainBefore}).filter(function(I){return!!I}).join(`
|
|
@@ -402,7 +402,7 @@
|
|
|
402
402
|
`)),c.fragmentShader=c.fragmentShader.replace(/MAIN_END/g,b.map(function(I){return I.fragment.mainEnd}).filter(function(I){return!!I}).join(`
|
|
403
403
|
`)),c.fragmentShader=c.fragmentShader.replace(/MAIN_MODEL_COLOR/g,b.map(function(I){return I.fragment.mainModelColor}).filter(function(I){return!!I}).join(`
|
|
404
404
|
`));var H=String(r.clippers.length);c.vertexShader=c.vertexShader.replace(/NUM_CLIPPERS/g,H),c.fragmentShader=c.fragmentShader.replace(/NUM_CLIPPERS/g,H);for(var B=0,C=b;B<C.length;B++){var w=C[B];w.onBeforeCompile&&w.onBeforeCompile(c,p)}};var u="";r.onBeforeRender=function(c,p,f,d,h,g){var A=r.shaderType;f instanceof Camera?(s.pixelRatio.value=f.pixelRatio,s.resolution.value.copy(f.resolution)):(s.pixelRatio.value=c.getPixelRatio(),c.getViewport(scratchViewport$1),s.resolution.value.set(scratchViewport$1.width,scratchViewport$1.height));var m=r.customShaders.filter(function(v){return v.type.includes(A)}),E=m.map(function(v){return"".concat(v.id,":").concat(v.version)}).join("|");u!==E&&(u=E,r.needsUpdate=!0)},Object.defineProperty(r,"uniform",{configurable:!1,enumerable:!1,get:function(){return s}}),defineProperty(r,"isPBMPointCloudMaterial",{get:function(){return!0}}),defineProperty(r,"isShaderMaterial",{get:function(){return!0}}),defineProperty(r,"opacity",{get:function(){return s.opacity.value},set:function(c){s.opacity.value=c}}),defineProperty(r,"vertexMarks",{get:function(){return!!o.USE_VERTEX_MARK},set:function(c){o.USE_VERTEX_MARK!==c&&(o.USE_VERTEX_MARK=c,this.needsUpdate=!0)}}),defineProperty(r,"pointScale",{get:function(){return s.pointScale.value},set:function(c){s.pointScale.value=c}}),defineProperty(r,"pointMinPixel",{get:function(){return s.pointMinPixel.value},set:function(c){s.pointMinPixel.value=c}}),defineProperty(r,"pointMaxPixel",{get:function(){return s.pointMinPixel.value},set:function(c){s.pointMaxPixel.value=c}}),defineProperty(r,"pointSize",{get:function(){return this.defines.USE_POINT_SIZE_ATTENUATION===!0?"ATTENUATION":"FIXED"},set:function(c){var p=c==="ATTENUATION";this.defines.USE_POINT_SIZE_ATTENUATION!==p&&(this.defines.USE_POINT_SIZE_ATTENUATION=p,this.needsUpdate=!0)}}),defineProperty(r,"pointShape",{get:function(){return this.defines.USE_POINT_SHAPE_CIRCLE===!0?"CIRCLE":"SQUARE"},set:function(c){var p=c==="CIRCLE";this.defines.USE_POINT_SHAPE_CIRCLE!==p&&(this.defines.USE_POINT_SHAPE_CIRCLE=p,this.needsUpdate=!0)}}),defineProperty(r,"pointBack",{get:function(){return this.defines.USE_POINT_BACK_HIDDEN===!0?"HIDDEN":this.defines.USE_POINT_BACK_DARK===!0?"DARK":"VISIBLE"},set:function(c){var p=c==="HIDDEN",f=c==="DARK";this.defines.USE_POINT_BACK_HIDDEN!==p&&(this.defines.USE_POINT_BACK_HIDDEN=p,this.needsUpdate=!0),this.defines.USE_POINT_BACK_DARK!==f&&(this.defines.USE_POINT_BACK_DARK=f,this.needsUpdate=!0)}}),defineProperty(r,"modelAlpha",{get:function(){return s.modelAlpha.value},set:function(c){s.modelAlpha.value=c}}),defineProperty(r,"logDepthAlpha",{get:function(){return s.logDepthAlpha.value},set:function(c){s.logDepthAlpha.value=c}}),defineProperty(r,"colorStyle",{get:function(){return o.USE_COLOR_CONSTANT?"CONSTANT":o.USE_COLOR_ALTITUDE?"ALTITUDE":"RGB"},set:function(c){var p=c==="CONSTANT",f=c==="ALTITUDE";o.USE_COLOR_CONSTANT!==p&&(o.USE_COLOR_CONSTANT=p,this.needsUpdate=!0),o.USE_COLOR_ALTITUDE!==f&&(o.USE_COLOR_ALTITUDE=f,this.needsUpdate=!0)}}),defineProperty(r,"constantColor",{get:function(){return s.constantColor.value},set:function(c){s.constantColor.value=c}}),defineProperty(r,"floorIndex",{get:function(){return s.floorIndex.value},set:function(c){s.floorIndex.value=c}}),defineProperty(r,"shownFloorIndex",{get:function(){return s.shownFloorIndex.value},set:function(c){s.shownFloorIndex.value=c}}),defineProperty(r,"floorStyle",{get:function(){return o.USE_FLOOR_STYLE_VISIBILITY?"VISIBILITY":"OPACITY"},set:function(c){var p=c==="VISIBILITY";o.USE_FLOOR_STYLE_VISIBILITY!==p&&(o.USE_FLOOR_STYLE_VISIBILITY=p,this.needsUpdate=!0)}}),defineProperty(r,"gradientTexture",{get:function(){return s.gradientTexture.value},set:function(c){s.gradientTexture.value=c}}),defineProperty(r,"brightness",{get:function(){return s.brightness.value},set:function(c){s.brightness.value=c}});var l=[];return defineProperty(r,"clippers",{get:function(){return l},set:function(c){l!==c&&(l=c,s.clippers.value=l.map(function(p){var f=typeof p.floorIndex=="number"?p.floorIndex:-1,d=new THREE__namespace.Matrix4().getInverse(p.clippingBoxMatrix);return{matrixInverse:d,floorIndex:f}}),this.needsUpdate=!0)}}),defineProperty(r,"colorSaturation",{get:function(){return s.colorSaturation.value},set:function(c){s.colorSaturation.value=c;var p=s.colorSaturation.value!==0||s.colorBrightness.value!==0||s.outlineGain.value!==0||s.distanceGain.value!==0;o.USE_COLOR_ADJUSTMENT!==p&&(o.USE_COLOR_ADJUSTMENT=p,this.needsUpdate=!0)}}),defineProperty(r,"colorBrightness",{get:function(){return s.colorBrightness.value},set:function(c){s.colorBrightness.value=c;var p=s.colorSaturation.value!==0||s.colorBrightness.value!==0||s.outlineGain.value!==0||s.distanceGain.value!==0;o.USE_COLOR_ADJUSTMENT!==p&&(o.USE_COLOR_ADJUSTMENT=p,this.needsUpdate=!0)}}),defineProperty(r,"outlineGain",{get:function(){return s.outlineGain.value},set:function(c){s.outlineGain.value=c;var p=s.colorSaturation.value!==0||s.colorBrightness.value!==0||s.outlineGain.value!==0||s.distanceGain.value!==0;o.USE_COLOR_ADJUSTMENT!==p&&(o.USE_COLOR_ADJUSTMENT=p,this.needsUpdate=!0)}}),defineProperty(r,"distanceGain",{get:function(){return s.distanceGain.value},set:function(c){s.distanceGain.value=c;var p=s.colorSaturation.value!==0||s.colorBrightness.value!==0||s.outlineGain.value!==0||s.distanceGain.value!==0;o.USE_COLOR_ADJUSTMENT!==p&&(o.USE_COLOR_ADJUSTMENT=p,this.needsUpdate=!0)}}),defineProperty(r,"useHQWeight",{get:function(){return o.USE_HQ_WEIGHT},set:function(c){c!==o.USE_HQ_WEIGHT&&(o.USE_HQ_WEIGHT=c,this.needsUpdate=!0)}}),defineProperty(r,"useHQDepth",{get:function(){return o.USE_HQ_DEPTH},set:function(c){c!==o.USE_HQ_DEPTH&&(o.USE_HQ_DEPTH=c,this.needsUpdate=!0)}}),defineProperty(r,"modelBoundingMin",{get:function(){return s.modelBoundingMin.value},set:function(c){s.modelBoundingMin.value=c}}),defineProperty(r,"modelBoundingMax",{get:function(){return s.modelBoundingMax.value},set:function(c){s.modelBoundingMax.value=c}}),typeof e=="object"&&r.setValues(e),r}return t.prototype.copy=function(e){return n.prototype.copy.call(this,e),this.pointScale=e.pointScale,this.pointMinPixel=e.pointMinPixel,this.pointMaxPixel=e.pointMaxPixel,this.customShaders=e.customShaders,this.modelAlpha=e.modelAlpha,this.logDepthAlpha=e.logDepthAlpha,this.colorStyle=e.colorStyle,this.constantColor.copy(e.constantColor),this.floorIndex=e.floorIndex,this.shownFloorIndex=e.shownFloorIndex,this.floorStyle=e.floorStyle,this.gradientTexture=e.gradientTexture,this.brightness=e.brightness,this.clippers=e.clippers,this.colorSaturation=e.colorSaturation,this.colorBrightness=e.colorBrightness,this.outlineGain=e.outlineGain,this.distanceGain=e.distanceGain,this.useEDL=e.useEDL,this.useHQWeight=e.useHQWeight,this.useHQDepth=e.useHQDepth,this.modelBoundingMin.copy(e.modelBoundingMin),this.modelBoundingMax.copy(e.modelBoundingMax),this},t.prototype.clone=function(){var e=this.constructor;return new e().copy(this)},t.prototype.refreshUniforms=function(){},t}(PBMMaterial),PBMPointCloud=function(n){__extends(t,n);function t(e,r){var o=n.call(this,e,r)||this;return o.onBeforeRender=function(s,u,l,c,p,f){p instanceof PBMPointCloudMaterial&&p.onBeforeRender&&p.onBeforeRender(s,u,l,c,o,f)},o}return t}(THREE__namespace.Points);const gradientDataURL="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=";function valueEqual(n,t){return n==t}function arrayValueEqual(n,t){if(Array.isArray(n)&&Array.isArray(t)){if(n.length!==t.length)return!1;for(var e=0;e<n.length;e++)if(n[e]!==t[e])return!1;return!0}return n===t}var parameterValueEqualFn={customShaders:arrayValueEqual,castShadow:valueEqual,receiveShadow:valueEqual,vertexMarks:valueEqual,pano0:valueEqual,pano1:valueEqual,pano0Depth:valueEqual,pano1Depth:valueEqual,refinedScreen:valueEqual,modelAlpha:valueEqual,logDepthAlpha:valueEqual,progress:valueEqual,transition:valueEqual,opacity:valueEqual,floorStyle:valueEqual,colorStyle:valueEqual,constantColor:function(n,t){return n instanceof THREE__namespace.Vector3&&t instanceof THREE__namespace.Vector3?n.equals(t):n===t},shownFloorIndex:valueEqual,clippers:arrayValueEqual,brightness:valueEqual,useHQWeight:valueEqual,useHQDepth:valueEqual,pointShape:valueEqual,pointSize:valueEqual,pointBack:valueEqual,pointScale:valueEqual,pointMinPixel:valueEqual,pointMaxPixel:valueEqual,pointAppearAnimation:valueEqual,colorSaturation:valueEqual,colorBrightness:valueEqual,useAddBlend:valueEqual,outlineGain:valueEqual,distanceGain:valueEqual,gradientTexture:valueEqual,minLevelOfDetail:valueEqual,maxLevelOfDetail:valueEqual,minGeometricError:valueEqual,maxGeometricError:valueEqual,panoramaMinGeometricError:valueEqual,skipLevelOfDetail:valueEqual,mostDetail:valueEqual,loadSiblings:valueEqual,cameraCulling:valueEqual,maxMemoryUsage:valueEqual,maxRequests:valueEqual,requestOrder:valueEqual,maxScreenSpaceError:valueEqual,memoryAdjustedOverflow:valueEqual,memoryAdjustedScreenSpaceError:valueEqual,cacheCameras:arrayValueEqual};function assignValue(n,t,e){var r=parameterValueEqualFn[t];if(!r)return!1;Array.isArray(e)&&(e=e.slice());var o=n[t];return r(o,e)?!1:(n[t]=e,!0)}var defaultGradientTexture=function(){var n;return typeof document!="undefined"?n=new THREE__namespace.TextureLoader().load(gradientDataURL):n=new THREE__namespace.Texture,n.minFilter=THREE__namespace.NearestFilter,n.magFilter=THREE__namespace.NearestFilter,n.wrapS=THREE__namespace.RepeatWrapping,n.wrapT=THREE__namespace.RepeatWrapping,n}(),defineConstantColor=Object.freeze(new THREE__namespace.Vector3(.6,.6,.6)),defineClippers=Object.freeze([]),defineCustomShaders=Object.freeze([]),defineCacheCameras=Object.freeze([]),Parameter=function(){function n(t){this.value=Object.create(null),this.id=createUuid(),this.versionNumber=0,t&&this.copy(t);for(var e=function(l){Object.defineProperty(r,l,{get:function(){return this.value[l]}})},r=this,o=0,s=Object.keys(n.createDefault());o<s.length;o++){var u=s[o];e(u)}}return n.createDefault=function(){return{customShaders:defineCustomShaders,castShadow:!1,receiveShadow:!1,vertexMarks:!0,pano0:null,pano1:null,pano0Depth:null,pano1Depth:null,refinedScreen:null,floorStyle:"OPACITY",colorStyle:"RGB",constantColor:defineConstantColor,shownFloorIndex:-1,modelAlpha:1,logDepthAlpha:0,opacity:1,progress:0,transition:"FADE",clippers:defineClippers,brightness:1,useHQWeight:!1,useHQDepth:!1,pointSize:"ATTENUATION",pointBack:"DARK",pointShape:"CIRCLE",pointScale:.02,pointMaxPixel:40,pointMinPixel:0,pointAppearAnimation:!0,gradientTexture:defaultGradientTexture,colorSaturation:0,colorBrightness:0,outlineGain:0,distanceGain:0,useAddBlend:!1,minLevelOfDetail:0,maxLevelOfDetail:20,minGeometricError:0,maxGeometricError:1e4,panoramaMinGeometricError:.03,skipLevelOfDetail:!1,mostDetail:!1,loadSiblings:!1,cameraCulling:!0,maxMemoryUsage:256,maxRequests:6,requestOrder:"SCREEN_SPACE_ERROR",maxScreenSpaceError:4,memoryAdjustedOverflow:4,memoryAdjustedScreenSpaceError:!1,cacheCameras:defineCacheCameras}},n.resolveValue=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];for(var r=__assign({versions:[]},this.createDefault()),o=Object.keys(r),s=0,u=t;s<u.length;s++){var l=u[s],c=l instanceof n?l.version:createUuid();r.versions.push(c);for(var p=0,f=o;p<f.length;p++){var d=f[p],h=l[d];h!==void 0&&(r[d]=h)}}return r},Object.defineProperty(n.prototype,"version",{get:function(){return"".concat(this.id,":").concat(this.versionNumber)},enumerable:!1,configurable:!0}),n.prototype.resolveValue=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return n.resolveValue.apply(n,t.concat(this))},n.prototype.set=function(t,e){var r=!1;if(typeof t=="string"){if(e!==void 0){var o=assignValue(this.value,t,e);o&&(r=!0)}}else for(var s=t,u=Object.keys(s),l=0,c=u;l<c.length;l++){var p=c[l],f=s[p];if(f!==void 0){var o=assignValue(this.value,p,f);o&&(r=!0)}}return r&&this.versionNumber++,this},n.prototype.reset=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];for(var r=!1,o=0,s=t;o<s.length;o++){var u=s[o];this.value!==void 0&&(delete this.value[u],r=!0)}return r&&this.versionNumber++,this},n.prototype.resetAll=function(){for(var t=!1,e=Object.keys(this.value),r=0,o=e;r<o.length;r++){var s=o[r];delete this.value[s],t=!0}return t&&this.versionNumber++,this},n.prototype.copy=function(t){for(var e=!0,r=Object.keys(this.value),o=0,s=r;o<s.length;o++){var u=s[o];delete this.value[u]}r=Object.keys(t);for(var l=0,c=r;l<c.length;l++){var p=c[l],f=t[p];if(f!==void 0){var d=assignValue(this.value,p,f);d&&(e=!0)}}return e&&this.versionNumber++,this},n}(),PBMContainer=function(n){__extends(t,n);function t(){var e=n!==null&&n.apply(this,arguments)||this;return e.parameter=new Parameter,e.needsRender=!0,e}return Object.defineProperty(t.prototype,"materialParameters",{get:function(){return this.parameter.resolveValue()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"pbmMaterialParametersVersion",{get:function(){return this.parameter.resolveValue().versions[0]},enumerable:!1,configurable:!0}),t.prototype.setMaterial=function(e){this.parameter.set(e),this.update(),this.needsRender=!0},t.prototype.getMaterial=function(){return this.parameter.resolveValue()},t.prototype.update=function(){var e=this.parameter.resolveValue();this.traverse(function(r){r instanceof PBMMesh||r instanceof PBMSkinnedMesh?updatePBMMesh$1(r,e):r instanceof PBMPointCloud&&updatePBMPointCloud$1(r,e)})},t}(THREE__namespace.Group);function updatePBMMesh$1(n,t){var e=n.material;n.castShadow=t.castShadow,n.receiveShadow=t.receiveShadow;for(var r=0,o=e;r<o.length;r++){var s=o[r];s.customShaders=t.customShaders,s.pano0=t.pano0,s.pano1=t.pano1,s.pano0Depth=t.pano0Depth,s.pano1Depth=t.pano1Depth,s.refinedScreen=t.refinedScreen,s.modelAlpha=t.modelAlpha,s.logDepthAlpha=t.logDepthAlpha,s.progress=t.progress,s.transition=t.transition,s.opacity=t.opacity,s.floorStyle=t.floorStyle,s.constantColor=t.constantColor,s.shownFloorIndex=t.shownFloorIndex,s.clippers=t.clippers,s.brightness=t.brightness,s.useHQWeight=t.useHQWeight,s.useHQDepth=t.useHQDepth,s.colorSaturation=t.colorSaturation,s.colorBrightness=t.colorBrightness,s.gradientTexture=t.gradientTexture,s.shaderType==="none"?(s.transparent=!0,s.blending=THREE__namespace.NormalBlending,s.blendDst=THREE__namespace.OneMinusSrcAlphaFactor,s.blendEquation=THREE__namespace.AddEquation,s.blendSrcAlpha=null,s.blendDstAlpha=null,s.blendEquationAlpha=null,s.depthWrite=!1,s.depthTest=!0):(s.transparent=s.alphaMode==="BLEND",s.blending=THREE__namespace.NormalBlending,s.blendDst=THREE__namespace.OneMinusSrcAlphaFactor,s.blendEquation=THREE__namespace.AddEquation,s.blendSrcAlpha=null,s.blendDstAlpha=null,s.blendEquationAlpha=null,s.depthWrite=!0,s.depthTest=!0,t.useAddBlend&&(s.depthWrite=!1,s.depthTest=!1,s.blending=THREE__namespace.AdditiveBlending),s.shownFloorIndex>-1&&s.shownFloorIndex!==s.floorIndex&&(s.transparent=!0),s.opacity<1&&(s.transparent=!0),s.alphaMap&&(s.transparent=!0),s.brightness<1&&(s.transparent=!0),s.logDepthAlpha>0?s.transparent=!1:t.useAddBlend&&(s.depthWrite=!1,s.depthTest=!1,s.blending=THREE__namespace.AdditiveBlending))}}function updatePBMPointCloud$1(n,t){var e=[n.material];n.castShadow=t.castShadow,n.receiveShadow=t.receiveShadow;for(var r=0,o=e;r<o.length;r++){var s=o[r];s.customShaders=t.customShaders,s.pointScale=t.pointScale,s.pointMinPixel=t.pointMinPixel,s.pointMaxPixel=t.pointMaxPixel,s.pointSize=t.pointSize,s.pointShape=t.pointShape,s.pointBack=t.pointBack,s.modelAlpha=t.modelAlpha,s.logDepthAlpha=t.logDepthAlpha,s.opacity=t.opacity,s.floorStyle=t.floorStyle,s.constantColor=t.constantColor,s.shownFloorIndex=t.shownFloorIndex,s.clippers=t.clippers,s.brightness=t.brightness,s.useHQWeight=t.useHQWeight,s.useHQDepth=t.useHQDepth,s.colorSaturation=t.colorSaturation,s.colorBrightness=t.colorBrightness,s.outlineGain=t.outlineGain,s.distanceGain=t.distanceGain,s.gradientTexture=t.gradientTexture,s.transparent=!1,s.blending=THREE__namespace.NormalBlending,s.blendDst=THREE__namespace.OneMinusSrcAlphaFactor,s.blendEquation=THREE__namespace.AddEquation,s.blendSrcAlpha=null,s.blendDstAlpha=null,s.blendEquationAlpha=null,s.depthWrite=!0,s.depthTest=!0,s.shownFloorIndex>-1&&(s.transparent=s.shownFloorIndex!==s.floorIndex),s.modelAlpha<1&&(s.transparent=!0),s.opacity<1&&(s.transparent=!0),s.brightness<1&&(s.transparent=!0),s.logDepthAlpha>0?s.transparent=!1:t.useAddBlend&&(s.depthWrite=!1,s.depthTest=!1,s.blending=THREE__namespace.AdditiveBlending),s.useHQWeight&&(s.depthWrite=!1,s.blending=THREE__namespace.CustomBlending,s.blendSrc=THREE__namespace.SrcAlphaFactor,s.blendSrcAlpha=THREE__namespace.SrcAlphaFactor,s.blendDst=THREE__namespace.OneFactor,s.blendDstAlpha=THREE__namespace.OneFactor)}}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]),ROTATE_X_MATRIX_INVERSE=new THREE__namespace.Matrix4().getInverse(ROTATE_X_MATRIX);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 p=c[l],f=p[0],d=p[1],h=d===void 0?!1:d,g=f.apply(void 0,e);h&&this.off(t,f),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(){}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(`
|
|
405
|
-
`),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,p=matchJsonpFunctionName(n),f=p?"Script":"XMLHttpRequest",d=new NetworkProxyError(u,f,l&&l.message?String(l.message):String(l));return(c=t.networkSubscribe)===null||c===void 0||c.emit("network",n,f,"proxy-error",d.message),Promise.reject(d)}).then(function(l){return new Promise(function(c,p){var f,d=t.allowHosts?BUILDIN_ALLOW_HOST.concat(t.allowHosts):BUILDIN_ALLOW_HOST.slice(),h=hostnameFromURL(l),g=matchJsonpFunctionName(l);if(location.hostname.length!==0&&!isIPDomain(location.hostname)&&BUILDIN_ALLOW_HOST.filter(function(I){return matchDomain(I,location.hostname)}).length===0&&!isIPDomain(h)&&d.filter(function(I){return matchDomain(I,h)}).length===0){var A=g?"Script":"XMLHttpRequest",m=new NetworkFirbiddenError(l,A,"request host(".concat(h,") is not allowed"));r(m),p(m),(f=t.networkSubscribe)===null||f===void 0||f.emit("network",l,A,"forbidden",m.message);return}if(g){var E=window,v=null,y=!1,b=document.createElement("script"),T=function(){var I;if(v=null,y!==!0){y=!0;var O=new NetworkTimeoutError(l,"Script",t.timeout||NaN);r(O),p(O),(I=t.networkSubscribe)===null||I===void 0||I.emit("network",l,"Script","timeout",O.message)}},_=function(I){var O,L,N=now(),z=N-s;if(delete E[g],b.parentNode&&b.parentNode.removeChild(b),v!==null&&(window.clearTimeout(v),v=null),y!==!0){if(I.indexOf("data:")!==0){var J=new NetworkResponseError(l,"Script",500);r(J),p(J),(O=t.networkSubscribe)===null||O===void 0||O.emit("network",l,"Script","error",J.message);return}var K=I.split(","),Q=(K[0].match(/:(.*?);/)||[])[1],U=K[1];if(t.responseType==="arraybuffer"||t.responseType==="blob"){for(var q=atob(K[1]),X=q.length,Z=new Uint8Array(X),W=0;W<X;W++)Z[W]=q.charCodeAt(W);t.responseType==="arraybuffer"?U=Z.buffer:U=new Blob([Z],{type:Q})}var G={},ne={body:U,meta:{origin:u,source:l,requestTime:s,responseTime:N,costs:z,headers:G}};e(ne),c(ne),(L=t.networkSubscribe)===null||L===void 0||L.emit("network",l,"Script","ok",JSON.stringify(ne.meta)),y=!0}};E[g]=_,b.src=l,document.body.appendChild(b),typeof t.timeout=="number"&&(v=window.setTimeout(T,t.timeout))}else{var S=!1,R=new XMLHttpRequest,M=function(){R&&(R.removeEventListener("timeout",H,!1),R.removeEventListener("progress",B,!1),R.removeEventListener("load",C,!1),R.removeEventListener("error",w,!1)),R=null,M=noop$1},H=function(){var I;if(S!==!0){S=!0,M();var O=new NetworkTimeoutError(l,"XMLHttpRequest",t.timeout||NaN);r(O),p(O),(I=t.networkSubscribe)===null||I===void 0||I.emit("network",l,"XMLHttpRequest","timeout",O.message)}},B=function(I){S!==!0&&I.lengthComputable&&(I.total<=0||o(I.loaded/I.total))},C=function(I){var O;if(S!==!0){var L=this.status;if(L===0||L>=200&&L<400){S=!0,M();var N=now(),z=N-s,J=parseHeaders(this.getAllResponseHeaders()),K=I.total,Q={body:this.response,meta:{origin:u,source:l,requestTime:s,responseTime:N,costs:z,headers:J,size:K}};e(Q),c(Q),(O=t.networkSubscribe)===null||O===void 0||O.emit("network",l,"XMLHttpRequest","ok",JSON.stringify(Q.meta))}else w.call(this)}},w=function(){var I;if(S!==!0){S=!0,M();var O=new NetworkResponseError(l,"XMLHttpRequest",this.status);r(O),p(O),(I=t.networkSubscribe)===null||I===void 0||I.emit("network",l,"XMLHttpRequest","error",O.message)}};R.addEventListener("timeout",H,!1),R.addEventListener("progress",B,!1),R.addEventListener("load",C,!1),R.addEventListener("error",w,!1),t.responseType&&(R.responseType=t.responseType),typeof t.timeout=="number"&&(R.timeout=t.timeout),R.open("GET",l,!0),R.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(),p=hostnameFromURL(o);if(location.hostname.length!==0&&!isIPDomain(location.hostname)&&BUILDIN_ALLOW_HOST.filter(function(m){return matchDomain(m,location.hostname)}).length===0&&!isIPDomain(p)&&c.filter(function(m){return matchDomain(m,p)}).length===0){var f=new NetworkFirbiddenError(o,"Link","request host(".concat(p,") is not allowed"));u(f),(l=t.networkSubscribe)===null||l===void 0||l.emit("network",o,"Link","forbidden",f.message);return}var d=document.createElement("link"),h=!1,g=null;d.onload=function(m){var E;if(g!==null&&(clearTimeout(g),g=null),h!==!0){h=!0,s();var v=now(),y=v-e,b={},T={origin:r,source:o,requestTime:e,responseTime:v,costs:y,headers:b};(E=t.networkSubscribe)===null||E===void 0||E.emit("network",o,"Link","preload",JSON.stringify(T))}},d.onerror=function(m){var E;if(g!==null&&(clearTimeout(g),g=null),h!==!0){h=!0;var v=new NetworkResponseError(o,"Link",0);u(v),(E=t.networkSubscribe)===null||E===void 0||E.emit("network",o,"Link","error",v.message)}},typeof t.timeout=="number"&&(g=window.setTimeout(function(){var m;if(g=null,h!==!0){h=!0,s();var E=now(),v=E-e,y={},b={origin:r,source:o,requestTime:e,responseTime:E,costs:v,headers:y};(m=t.networkSubscribe)===null||m===void 0||m.emit("network",o,"Link","timeout",JSON.stringify(b))}},t.timeout)),d.rel=d.relList&&d.relList.supports("prefetch")?"prefetch":"preload",d.as="fetch",d.crossOrigin="",d.fetchPriority="high",d.href=o;var A=document.head||document.getElementsByTagName("head")[0];A&&A.appendChild(d)})})}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 p,f=new NetworkProxyError(l,"Image",c&&c.message?String(c.message):String(c));return(p=t.networkSubscribe)===null||p===void 0||p.emit("network",n,"Image","proxy-error",f.message),Promise.reject(f)}).then(function(c){return new Promise(function(p,f){var d,h=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)&&h.filter(function(T){return matchDomain(T,g)}).length===0){var A=new NetworkFirbiddenError(c,"Image","request host(".concat(g,") is not allowed"));r(A),f(A),(d=t.networkSubscribe)===null||d===void 0||d.emit("network",c,"Image","forbidden",A.message);return}var m=s!=null?s:new Image,E=!1,v=null,y=function(){var T;if(m.onload=noop$1,m.onerror=noop$1,v!==null&&(clearTimeout(v),v=null),E!==!0){var _=now(),S={headers:{},origin:l,source:c,requestTime:u,responseTime:_,costs:_-u};E=!0;var R={body:m,meta:S};o(1),e(R),p(R),(T=t.networkSubscribe)===null||T===void 0||T.emit("network",c,"Image","ok",JSON.stringify(R.meta))}},b=function(){var T;if(m.onload=noop$1,m.onerror=noop$1,v!==null&&(clearTimeout(v),v=null),E!==!0){E=!0;var _=new NetworkResponseError(c,"Image",0);r(_),f(_),(T=t.networkSubscribe)===null||T===void 0||T.emit("network",c,"Image","ok",_.message)}};typeof t.timeout=="number"&&(v=window.setTimeout(function(){var T;if(m.onload=noop$1,m.onerror=noop$1,v=null,E!==!0){E=!0;var _=new NetworkTimeoutError(c,"Image",t.timeout);r(_),f(_),(T=t.networkSubscribe)===null||T===void 0||T.emit("network",c,"Image","timeout",_.message)}},t.timeout)),m.onload=y,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 p;return(p=e.allowHosts)!==null&&p!==void 0?p:l.allowHosts},get requestProxy(){var p;return(p=e.requestProxy)!==null&&p!==void 0?p:l.requestProxy},get networkSubscribe(){var p;return(p=e.networkSubscribe)!==null&&p!==void 0?p: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,p={timeout:(l=e.timeout)!==null&&l!==void 0?l:c.timeout,get allowHosts(){var f;return(f=e.allowHosts)!==null&&f!==void 0?f:c.allowHosts},get requestProxy(){var f;return(f=e.requestProxy)!==null&&f!==void 0?f:c.requestProxy},get networkSubscribe(){var f;return(f=e.networkSubscribe)!==null&&f!==void 0?f:c.networkSubscribe}};return loadImage(t,p,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 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}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("/")}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){if(typeof Image=="undefined"){t(!1);return}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 _a$5,supportAvif=!1,supportWebp=!1,supportHeif=!1;imageSupport().then(function(n){supportAvif=n.avif,supportWebp=n.webp,supportHeif=n.heif});var IMAGE_FORMATS=["jpg","jpeg","png","heif","heic","webp","avif"];function isImageExt(n){return IMAGE_FORMATS.indexOf(n)>=0}var 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,e){var r,o,s=(o=(r=t[e])!==null&&r!==void 0?r:t[t.length-1])!==null&&o!==void 0?o:n;return n.replace(URL_DOMAIN_REGEX,function(u,l){return u.slice(0,u.length-l.length)+s})}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"){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"){s[0],s[1];var l=s[2],c=s[3],p=s[4],f=Math.pow(2,Number(l))*Number(c)+Number(p);if(!isNaN(f))return replaceDomain(n,e.tile,f%2)}else if(o==="model"){var d=s[0],f=Number(d);if(!isNaN(f))return replaceDomain(n,e.model,f%2)}return replaceDomain(n,e.default,0)}var tencentCloudImageProcesser=function(n,t){var e=n.split("?")[0],r=e.split(".").pop();if(r==="jpeg"&&(r="jpg"),r==="heif"&&(r="heic"),r&&!isImageExt(r))return n;var o=[],s=t.format,u=t.cut,l=t.quality,c=t.size,p=t.sharpen;if(s==="jpeg"&&(s="jpg"),s==="heif"&&(s="heic"),(!supportAvif&&(s!=null?s:r)==="avif"||!supportWebp&&(s!=null?s:r)==="webp"||!supportHeif&&(s!=null?s:r)==="heic")&&(s="jpg"),s!==void 0&&s!==r&&o.push("format/".concat(s)),u!==void 0&&o.push("cut/".concat(u[2],"x").concat(u[3],"x").concat(u[0],"x").concat(u[1])),l!==void 0){var f=s!=null?s:r;f&&["jpg","webp","heic","avif"].indexOf(f)>=0&&o.push("quality/".concat(l))}if(c!==void 0){var d=n.match(/\/cube_(\d+)\//),h=d?Number(d[1]):NaN;h!==Number(c)&&o.push("thumbnail/".concat(c,"x"))}p!==void 0&&o.push("sharpen/".concat(p));var g="";return o.length&&(g="?imageMogr2/"+o.join("/")),e+g},aliyunOOSImageProcesser=function(n,t){var e=n.split("?")[0],r=e.split(".").pop();if(r==="jpeg"&&(r="jpg"),r==="heif"&&(r="heic"),r&&!isImageExt(r))return n;var o=[],s=t.format,u=t.cut,l=t.quality,c=t.size,p=t.sharpen;if(s==="jpeg"&&(s="jpg"),s==="heif"&&(s="heic"),(!supportAvif&&(s!=null?s:r)==="avif"||!supportWebp&&(s!=null?s:r)==="webp"||!supportHeif&&(s!=null?s:r)==="heic")&&(s="jpg"),s!==void 0&&s!==r&&o.push("format,".concat(s)),u!==void 0){var f=u[0],d=u[1],h=u[2],g=u[3];o.push("crop,x_".concat(f,",y_").concat(d,",w_").concat(h,",h_").concat(g,",g_nw"))}if(l!==void 0&&l!==100){var A=s!=null?s:r;A&&["jpg","webp","heic","avif"].indexOf(A)>=0&&o.push("quality,Q_".concat(l))}c&&c!==2048&&o.push("resize,w_".concat(c)),p!==void 0&&o.push("sharpen,".concat(p));var m="";return o.length&&(m="?x-oss-process=image/"+o.join("/")),e+m},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 log2=(_a$5=Math.log2)!==null&&_a$5!==void 0?_a$5:function(n){return Math.log(n)*Math.LOG2E};function getImageSizeLevel(n){return Math.floor(Math.max(log2(n/512),0))}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 FACE_ORDER$1=["right","left","up","down","front","back"],TextureLoader=function(){function n(){}return n.prototype.loadTexture=function(t,e,r,o,s,u){var l,c,p,f,d,h,g;r===void 0&&(r=noop$1),o===void 0&&(o=noop$1),s===void 0&&(s=noop$1);var A={};typeof e.flipY!="undefined"&&(A.flipY=e.flipY),typeof e.format!="undefined"&&(A.format=e.format),typeof e.encoding!="undefined"&&(A.encoding=e.encoding),A.generateMipmaps=(l=e.generateMipmaps)!==null&&l!==void 0?l:!1,A.minFilter=(c=e.minFilter)!==null&&c!==void 0?c:THREE__namespace.LinearFilter,A.magFilter=(p=e.magFilter)!==null&&p!==void 0?p:THREE__namespace.LinearFilter;var m=(d=(f=e.imageURL)===null||f===void 0?void 0:f.options)!==null&&d!==void 0?d:{key:"unknown"};t=applyImageURLOptions(t,(h=e.imageURL)===null||h===void 0?void 0:h.transform,m);var E=getProtocol(t),v=(g=e.viaAjax)!==null&&g!==void 0?g:canUseNativeImageBitmap,y=isJsonpSource(t),b=/^https?:/.test(E);if(y?v=!0:b||(v=!1),v){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,A),M}).then(function(M){var H={meta:T,body:M};return r(H),H}).catch(function(M){return o(M),Promise.reject(M)})}else{var S=null,R;return Promise.resolve().then(function(){return createImageBitmapLikeImage()}).then(function(M){return R=M,e.fetcher.loadImage(t,{timeout:e.timeout},void 0,void 0,s,M)}).then(function(M){return S=M.meta,poolImageToTexture(M.body,e.maxSize)}).then(function(M){return Object.assign(M,A),M}).then(function(M){var H={meta:S,body:M};return r(H),H}).catch(function(M){return R&&R.close(),o(M),Promise.reject(M)})}},n.prototype.loadCubeTexture=function(t,e,r,o,s,u){var l,c,p,f,d,h,g;r===void 0&&(r=noop$1),o===void 0&&(o=noop$1),s===void 0&&(s=noop$1);var A={};typeof e.format!="undefined"&&(A.format=e.format),A.generateMipmaps=(l=e.generateMipmaps)!==null&&l!==void 0?l:!1,A.minFilter=(c=e.minFilter)!==null&&c!==void 0?c:THREE__namespace.LinearFilter,A.magFilter=(p=e.magFilter)!==null&&p!==void 0?p:THREE__namespace.LinearFilter;for(var m=[t[FACE_ORDER$1[0]],t[FACE_ORDER$1[1]],t[FACE_ORDER$1[2]],t[FACE_ORDER$1[3]],t[FACE_ORDER$1[4]],t[FACE_ORDER$1[5]]],E=[],v=[0,0,0,0,0,0],y=[],b=function(_){var S=(d=(f=e.imageURL)===null||f===void 0?void 0:f.options)!==null&&d!==void 0?d:{key:"unknown"},R=applyImageURLOptions(m[_],(h=e.imageURL)===null||h===void 0?void 0:h.transform,__assign(__assign({},S),{key:S.key+"."+FACE_ORDER$1[_]})),M=getProtocol(R),H=function(N){v[_]=N,s(v.reduce(function(z,J){return z+J},0)/6)},B=(g=e.viaAjax)!==null&&g!==void 0?g:!1,C=/^https?:$/.test(M),w=isJsonpSource(R);if(w?B=!0:C||(B=!1),B){var I="blob",O=e.fetcher.ajax(R,{timeout:e.timeout,responseType:I},void 0,void 0,H).then(function(N){return y[_]=N.meta,createImageBitmapLike(N.body)});E.push(O)}else{var L,O=Promise.resolve().then(function(){return createImageBitmapLikeImage()}).then(function(z){return L=z,e.fetcher.loadImage(R,{timeout:e.timeout},void 0,void 0,H,z)}).then(function(z){return y[_]=z.meta,z.body}).catch(function(z){return L&&L.close(),Promise.reject(z)});E.push(O)}},T=0;T<6;T++)b(T);return Promise.all(E).then(function(_){return poolImagesToCubeTexture(_)}).then(function(_){return Object.assign(_,__assign({encoding:THREE__namespace.sRGBEncoding},A)),_}).then(function(_){var S={body:_,meta:y};return r(S),S}).catch(function(_){for(var S=0,R=E;S<R.length;S++){var M=R[S];M.then(function(H){return H.close()}).catch(noop$1)}return o(_),Promise.reject(_)})},n}(),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}(),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)})}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(f){if(s)if(s=!1,f)c(f);else{for(var d=new Array(arguments.length-1),h=0;h<d.length;)d[h++]=arguments[h];l.apply(null,d)}};try{n.apply(t||null,e)}catch(p){s&&(s=!1,c(p))}})}var base64$1={};(function(n){var t=n;t.length=function(l){var c=l.length;if(!c)return 0;for(var p=0;--c%4>1&&l.charAt(c)==="=";)++p;return Math.ceil(l.length*3)/4-p};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,p){for(var f=null,d=[],h=0,g=0,A;c<p;){var m=l[c++];switch(g){case 0:d[h++]=e[m>>2],A=(m&3)<<4,g=1;break;case 1:d[h++]=e[A|m>>4],A=(m&15)<<2,g=2;break;case 2:d[h++]=e[A|m>>6],d[h++]=e[m&63],g=0;break}h>8191&&((f||(f=[])).push(String.fromCharCode.apply(String,d)),h=0)}return g&&(d[h++]=e[A],d[h++]=61,g===1&&(d[h++]=61)),f?(h&&f.push(String.fromCharCode.apply(String,d.slice(0,h))),f.join("")):String.fromCharCode.apply(String,d.slice(0,h))};var s="invalid encoding";t.decode=function(l,c,p){for(var f=p,d=0,h,g=0;g<l.length;){var A=l.charCodeAt(g++);if(A===61&&d>1)break;if((A=r[A])===void 0)throw Error(s);switch(d){case 0:h=A,d=1;break;case 1:c[p++]=h<<2|(A&48)>>4,h=A,d=2;break;case 2:c[p++]=(h&15)<<4|(A&60)>>2,h=A,d=3;break;case 3:c[p++]=(h&3)<<6|A,d=0;break}}if(d===1)throw Error(s);return p-f},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,p,f){t[0]=c,p[f]=e[0],p[f+1]=e[1],p[f+2]=e[2],p[f+3]=e[3]}function s(c,p,f){t[0]=c,p[f]=e[3],p[f+1]=e[2],p[f+2]=e[1],p[f+3]=e[0]}n.writeFloatLE=r?o:s,n.writeFloatBE=r?s:o;function u(c,p){return e[0]=c[p],e[1]=c[p+1],e[2]=c[p+2],e[3]=c[p+3],t[0]}function l(c,p){return e[3]=c[p],e[2]=c[p+1],e[1]=c[p+2],e[0]=c[p+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),p=Math.round(o*Math.pow(2,-c)*8388608)&8388607;r((l<<31|c+127<<23|p)>>>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,p=u&8388607;return c===255?p?NaN:l*(1/0):c===0?l*1401298464324817e-60*p:l*Math.pow(2,c-150)*(p+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,p,f){t[0]=c,p[f]=e[0],p[f+1]=e[1],p[f+2]=e[2],p[f+3]=e[3],p[f+4]=e[4],p[f+5]=e[5],p[f+6]=e[6],p[f+7]=e[7]}function s(c,p,f){t[0]=c,p[f]=e[7],p[f+1]=e[6],p[f+2]=e[5],p[f+3]=e[4],p[f+4]=e[3],p[f+5]=e[2],p[f+6]=e[1],p[f+7]=e[0]}n.writeDoubleLE=r?o:s,n.writeDoubleBE=r?s:o;function u(c,p){return e[0]=c[p],e[1]=c[p+1],e[2]=c[p+2],e[3]=c[p+3],e[4]=c[p+4],e[5]=c[p+5],e[6]=c[p+6],e[7]=c[p+7],t[0]}function l(c,p){return e[7]=c[p],e[6]=c[p+1],e[5]=c[p+2],e[4]=c[p+3],e[3]=c[p+4],e[2]=c[p+5],e[1]=c[p+6],e[0]=c[p+7],t[0]}n.readDoubleLE=r?u:l,n.readDoubleBE=r?l:u}():function(){function t(r,o,s,u,l,c){var p=u<0?1:0;if(p&&(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((p<<31|2146435072)>>>0,l,c+s);else{var f;if(u<22250738585072014e-324)f=u/5e-324,r(f>>>0,l,c+o),r((p<<31|f/4294967296)>>>0,l,c+s);else{var d=Math.floor(Math.log(u)/Math.LN2);d===1024&&(d=1023),f=u*Math.pow(2,-d),r(f*4503599627370496>>>0,l,c+o),r((p<<31|d+1023<<20|f*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),p=r(u,l+s),f=(p>>31)*2+1,d=p>>>20&2047,h=4294967296*(p&1048575)+c;return d===2047?h?NaN:f*(1/0):d===0?f*5e-324*h:f*Math.pow(2,d-1075)*(h+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=[],p=0,f;o<s;)f=r[o++],f<128?c[p++]=f:f>191&&f<224?c[p++]=(f&31)<<6|r[o++]&63:f>239&&f<365?(f=((f&7)<<18|(r[o++]&63)<<12|(r[o++]&63)<<6|r[o++]&63)-65536,c[p++]=55296+(f>>10),c[p++]=56320+(f&1023)):c[p++]=(f&15)<<12|(r[o++]&63)<<6|r[o++]&63,p>8191&&((l||(l=[])).push(String.fromCharCode.apply(String,c)),p=0);return l?(p&&l.push(String.fromCharCode.apply(String,c.slice(0,p))),l.join("")):String.fromCharCode.apply(String,c.slice(0,p))},t.write=function(r,o,s){for(var u=s,l,c,p=0;p<r.length;++p)l=r.charCodeAt(p),l<128?o[s++]=l:l<2048?(o[s++]=l>>6|192,o[s++]=l&63|128):(l&64512)===55296&&((c=r.charCodeAt(p+1))&64512)===56320?(l=65536+((l&1023)<<10)+(c&1023),++p,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 p=t.call(s,u,u+=c);return u&7&&(u=(u|7)+1),p}}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,p=(u-c)/4294967296>>>0;return l&&(p=~p>>>0,c=~c>>>0,++c>4294967295&&(c=0,++p>4294967295&&(p=0))),new t(c,p)},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),p=c.length-1;p>-1;--p)if(u[c[p]]===1&&this[c[p]]!==void 0&&this[c[p]]!==null)return c[p]}},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,p){if(c)return u.emit("error",c,t),s(c);if(p===null){u.end(!0);return}if(!(p instanceof r))try{p=r[u.responseDelimited?"decodeDelimited":"decode"](p)}catch(f){return u.emit("error",f,t),s(f)}return u.emit("data",p,t),s(null,p)})}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 fixNumber(n){return isNaN(n)||!isFinite(n)?0:n}function getGeometryMemoryUsed(n){var t=0;if(n instanceof THREE__namespace.BufferGeometry){for(var e in n.attributes){var r=n.getAttribute(e),o=4;"BYTES_PER_ELEMENT"in r.array&&typeof r.array.BYTES_PER_ELEMENT=="number"&&(o=r.array.BYTES_PER_ELEMENT),t+=fixNumber(r.count*r.itemSize*o)}var s=n.getIndex();if(s){var o=4;"BYTES_PER_ELEMENT"in s.array&&typeof s.array.BYTES_PER_ELEMENT=="number"&&(o=s.array.BYTES_PER_ELEMENT),t+=fixNumber(s.count*s.itemSize*o)}}else n instanceof THREE__namespace.Geometry&&(t+=fixNumber(n.faces.length*3*3*4),t+=fixNumber(n.faceVertexUvs.length*3*2*4));return t}function makeComputeBlockRectSizeFunction(n,t,e){return function(r,o,s){var u=(r+n-1)/n|0,l=(o+t-1)/t|0;return u*l*e*s}}function makeComputePaddedRectSizeFunction(n,t,e){return function(r,o,s){return(Math.max(r,n)*Math.max(o,t)/e|0)*s}}var compressedTextureFunctions=new Map([[THREE__namespace.RGB_S3TC_DXT1_Format,makeComputeBlockRectSizeFunction(4,4,8)],[THREE__namespace.RGBA_S3TC_DXT1_Format,makeComputeBlockRectSizeFunction(4,4,8)],[THREE__namespace.RGBA_S3TC_DXT3_Format,makeComputeBlockRectSizeFunction(4,4,16)],[THREE__namespace.RGBA_S3TC_DXT5_Format,makeComputeBlockRectSizeFunction(4,4,16)],[THREE__namespace.RGB_ETC1_Format,makeComputeBlockRectSizeFunction(4,4,8)],[THREE__namespace.RGB_PVRTC_4BPPV1_Format,makeComputePaddedRectSizeFunction(8,8,2)],[THREE__namespace.RGBA_PVRTC_4BPPV1_Format,makeComputePaddedRectSizeFunction(8,8,2)],[THREE__namespace.RGB_PVRTC_2BPPV1_Format,makeComputePaddedRectSizeFunction(16,8,4)],[THREE__namespace.RGBA_PVRTC_2BPPV1_Format,makeComputePaddedRectSizeFunction(16,8,4)],[THREE__namespace.RGB_ETC2_Format,makeComputeBlockRectSizeFunction(4,4,8)],[THREE__namespace.RGBA_ETC2_EAC_Format,makeComputeBlockRectSizeFunction(4,4,16)],[THREE__namespace.RGBA_ASTC_4x4_Format,makeComputeBlockRectSizeFunction(4,4,16)],[THREE__namespace.SRGB8_ALPHA8_ASTC_4x4_Format,makeComputeBlockRectSizeFunction(4,4,16)],[THREE__namespace.RGBA_ASTC_5x4_Format,makeComputeBlockRectSizeFunction(5,4,16)],[THREE__namespace.SRGB8_ALPHA8_ASTC_5x4_Format,makeComputeBlockRectSizeFunction(5,4,16)],[THREE__namespace.RGBA_ASTC_5x5_Format,makeComputeBlockRectSizeFunction(5,5,16)],[THREE__namespace.SRGB8_ALPHA8_ASTC_5x5_Format,makeComputeBlockRectSizeFunction(5,5,16)],[THREE__namespace.RGBA_ASTC_6x5_Format,makeComputeBlockRectSizeFunction(6,5,16)],[THREE__namespace.SRGB8_ALPHA8_ASTC_6x5_Format,makeComputeBlockRectSizeFunction(6,5,16)],[THREE__namespace.RGBA_ASTC_6x6_Format,makeComputeBlockRectSizeFunction(6,6,16)],[THREE__namespace.SRGB8_ALPHA8_ASTC_6x6_Format,makeComputeBlockRectSizeFunction(6,6,16)],[THREE__namespace.RGBA_ASTC_8x5_Format,makeComputeBlockRectSizeFunction(8,5,16)],[THREE__namespace.SRGB8_ALPHA8_ASTC_8x5_Format,makeComputeBlockRectSizeFunction(8,5,16)],[THREE__namespace.RGBA_ASTC_8x6_Format,makeComputeBlockRectSizeFunction(8,6,16)],[THREE__namespace.SRGB8_ALPHA8_ASTC_8x6_Format,makeComputeBlockRectSizeFunction(8,6,16)],[THREE__namespace.RGBA_ASTC_8x8_Format,makeComputeBlockRectSizeFunction(8,8,16)],[THREE__namespace.SRGB8_ALPHA8_ASTC_8x8_Format,makeComputeBlockRectSizeFunction(8,8,16)],[THREE__namespace.RGBA_ASTC_10x5_Format,makeComputeBlockRectSizeFunction(10,5,16)],[THREE__namespace.SRGB8_ALPHA8_ASTC_10x5_Format,makeComputeBlockRectSizeFunction(10,5,16)],[THREE__namespace.RGBA_ASTC_10x6_Format,makeComputeBlockRectSizeFunction(10,6,16)],[THREE__namespace.SRGB8_ALPHA8_ASTC_10x6_Format,makeComputeBlockRectSizeFunction(10,6,16)],[THREE__namespace.RGBA_ASTC_10x8_Format,makeComputeBlockRectSizeFunction(10,8,16)],[THREE__namespace.SRGB8_ALPHA8_ASTC_10x8_Format,makeComputeBlockRectSizeFunction(10,8,16)],[THREE__namespace.RGBA_ASTC_10x10_Format,makeComputeBlockRectSizeFunction(10,10,16)],[THREE__namespace.SRGB8_ALPHA8_ASTC_10x10_Format,makeComputeBlockRectSizeFunction(10,10,16)],[THREE__namespace.RGBA_ASTC_12x10_Format,makeComputeBlockRectSizeFunction(12,10,16)],[THREE__namespace.SRGB8_ALPHA8_ASTC_12x10_Format,makeComputeBlockRectSizeFunction(12,10,16)],[THREE__namespace.RGBA_ASTC_12x12_Format,makeComputeBlockRectSizeFunction(12,12,16)],[THREE__namespace.SRGB8_ALPHA8_ASTC_12x12_Format,makeComputeBlockRectSizeFunction(12,12,16)],[THREE__namespace.RGBA_BPTC_Format,makeComputeBlockRectSizeFunction(4,4,16)]]);function getTextureMemoryUsed(n){var t=0,e=1;(n.generateMipmaps===!0||n.mipmaps&&n.mipmaps.length>1)&&(e=1.33);for(var r=n instanceof THREE__namespace.CompressedTexture,o=r?compressedTextureFunctions.get(n.format):void 0,s=[].concat(n.image),u=0,l=s;u<l.length;u++){var c=l[u];if(c)if(c instanceof THREE__namespace.Texture)t+=getTextureMemoryUsed(c);else{var p=c.width,f=p===void 0?1:p,d=c.height,h=d===void 0?1:d,g=c.depth,A=g===void 0?1:g;o?t+=fixNumber(o(f,h,A)*e):t+=fixNumber(f*h*A*4*e)}}return t}var textureSet=new Set,textureNames=["map","alphaMap","bumpMap","normalMap","displacementMap","emissiveMap","specularMap","envMap","flipEnvMap","lightMap","aoMap","gradientMap","metalnessMap","roughnessMap","sheenColorMap","sheenRoughnessMap","clearcoatMap","clearcoatRoughnessMap","clearcoatNormalMap","iridescenceMap","iridescenceThicknessMap","transmissionMap","thicknessMap","anisotropyMap","specularColorMap","specularIntensityMap"];function getMaterialMemoryUsed(n){var t=0;if(textureSet.clear(),n instanceof THREE__namespace.ShaderMaterial)for(var e in n.uniforms){var r=n.uniforms[e],o=r&&r.value&&r.value instanceof THREE__namespace.Texture?r.value:void 0;o instanceof THREE__namespace.Texture&&(textureSet.has(o)||(t=getTextureMemoryUsed(o),textureSet.add(o)))}else for(var s=0,u=textureNames;s<u.length;s++){var l=u[s],o=n[l];o instanceof THREE__namespace.Texture&&(textureSet.has(o)||(t=getTextureMemoryUsed(o),textureSet.add(o)))}return textureSet.clear(),t}var sceneSet=new Set;function getMemoryUsage(n){var t=0;return sceneSet.clear(),n.traverse(function(e){if(e instanceof THREE__namespace.Mesh||e instanceof THREE__namespace.Line||e instanceof THREE__namespace.Points){var r=e.geometry;(r instanceof THREE__namespace.BufferGeometry||r instanceof THREE__namespace.Geometry)&&(sceneSet.has(r)||(t+=getGeometryMemoryUsed(r),sceneSet.add(r)));for(var o=[].concat(e.material),s=0,u=o;s<u.length;s++){var l=u[s];l instanceof THREE__namespace.Material&&(sceneSet.has(l)||(t+=getMaterialMemoryUsed(l),sceneSet.add(l)))}}}),sceneSet.clear(),t}function loadPbm(n,t){var e,r,o,s,u;t===void 0&&(t={});var l=(e=t.upAxis)!==null&&e!==void 0?e:"Z",c=(r=t.fetcher)!==null&&r!==void 0?r:new Fetcher({allowHosts:["*"]}),p={byteLength:0},f=autoRestImageOptionsByTextureLength((o=t.textureOptions)!==null&&o!==void 0?o:{},(u=(s=t.textureArray)===null||s===void 0?void 0:s.length)!==null&&u!==void 0?u:0),d={};if(t.textureArray)for(var h=0,g=t.textureArray;h<g.length;h++){var A=g[h];d[A]=loadTexture$1(A,f,c)}return Promise.resolve().then(function(){return c.ajax(n,{responseType:"arraybuffer"})}).then(function(m){return p.byteLength=m.body.byteLength,delay(function(){var E=new Uint8Array(m.body);return Model$2.decode(E)})}).then(function(m){return delay(function(){var E,v,y;return parse$4(m,(E=t.light)!==null&&E!==void 0?E:!1,(v=t.textureBaseUri)!==null&&v!==void 0?v:function(){var b=n.lastIndexOf("/");if(b>=0){var T=n.slice(0,b)+"/";return/\/model\/$/.test(T)&&(T=T.replace(/\/model\/$/,"/materials/")),T}return""}(),((y=t.textureArray)!==null&&y!==void 0?y:[]).slice(),f,d,c)})}).then(function(m){var E=new THREE__namespace.Group;E.name=n;for(var v=0,y=m.objects;v<y.length;v++){var b=y[v];E.add(b)}return l==="Y"&&E.applyMatrix4(ROTATE_X_MATRIX_INVERSE),{type:"pbm",modelUpAxis:"Z",upAxis:l,uri:n,byteLength:p.byteLength,memoryUsage:getMemoryUsage(E),scene:E,textures:m.textures,animations:[],dispose:function(){return m.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,p=0,f=n.chunks;p<f.length;p++){var d=f[p];if(!d.vertices.marks||d.vertices.marks.length===0){c=!1;break}}for(var h=0,g=n.chunks;h<g.length;h++){var d=g[h];if(!d.faces.normals||d.faces.normals.length===0){l=!1;break}}for(var A=n.chunks.sort(function(se,pe){return chunkOrder(se)-chunkOrder(pe)}),m=[],E=0,v=A;E<v.length;E++){var d=v[E],y=parseFloorName(d.name);m[y]||(m[y]=[]),m[y].push(d)}for(var b=0;b<m.length;b++){var T=m[b];if(T)if(l){for(var _=0,S=0;S<T.length;S++){var d=T[S];_+=d.faces.indices.length}for(var R=new Float32Array(_*3),M=new Float32Array(_*2),H=new Float32Array(_*3),B=c?new Float32Array(_):void 0,C=[],w=[1/0,1/0,1/0,-1/0,-1/0,-1/0],I=0,O=0;O<T.length;O++){for(var L=[1/0,1/0,1/0,-1/0,-1/0,-1/0],d=T[O],N=d.vertices.xyz,z=d.vertices.uvs,J=d.faces.indices,K=d.faces.normals,Q=d.vertices.marks,U=J.length,S=0;S<U;S++){var q=J[S],X=R[I*3+S*3]=N[q*3],Z=R[I*3+S*3+1]=N[q*3+1],W=R[I*3+S*3+2]=N[q*3+2];B&&(B[I+S]=Q[q]),M[I*2+S*2]=z[q*2],M[I*2+S*2+1]=z[q*2+1];var G=Math.floor(S/3)*3;H[I*3+S*3]=K[G],H[I*3+S*3+1]=K[G+1],H[I*3+S*3+2]=K[G+2],X<L[0]&&(L[0]=X),Z<L[1]&&(L[1]=Z),W<L[2]&&(L[2]=W),X>L[3]&&(L[3]=X),Z>L[4]&&(L[4]=Z),W>L[5]&&(L[5]=W)}L[0]<w[0]&&(w[0]=L[0]),L[1]<w[1]&&(w[1]=L[1]),L[2]<w[2]&&(w[2]=L[2]),L[3]>w[3]&&(w[3]=L[3]),L[4]>w[4]&&(w[4]=L[4]),L[5]>w[5]&&(w[5]=L[5]),C.push({materialIndex:O,name:d.name,chunkName:parseChunkName(d.name),start:I,count:d.faces.indices.length,texture:(e=d.texture)!==null&&e!==void 0?e:void 0}),I+=U}var ne={createAt:o,description:s,vertices:R,uvs:M,normals:H,masks:B,indices:null,floorIndex:b,groups:C,extents:w};u.push(ne)}else{for(var _=0,$=0,S=0;S<T.length;S++){var d=T[S];$+=d.vertices.xyz.length/3,_+=d.faces.indices.length}for(var R=new Float32Array($*3),M=new Float32Array($*2),H=void 0,ee=new Float32Array($),re=new Uint32Array(_),B=c?new Float32Array(_):void 0,C=[],w=[1/0,1/0,1/0,-1/0,-1/0,-1/0],le=0,I=0,O=0;O<T.length;O++){for(var L=[1/0,1/0,1/0,-1/0,-1/0,-1/0],d=T[O],N=d.vertices.xyz,ae=d.vertices.marks,z=d.vertices.uvs,J=d.faces.indices,oe=N.length/3,U=J.length,S=0;S<oe;S++){var X=R[I*3+S*3]=N[S*3],Z=R[I*3+S*3+1]=N[S*3+1],W=R[I*3+S*3+2]=N[S*3+2];B&&(B[I+S]=ae[S]),M[I*2+S*2]=z[S*2],M[I*2+S*2+1]=z[S*2+1],ee[I+S]=b,X<L[0]&&(L[0]=X),Z<L[1]&&(L[1]=Z),W<L[2]&&(L[2]=W),X>L[3]&&(L[3]=X),Z>L[4]&&(L[4]=Z),W>L[5]&&(L[5]=W)}L[0]<w[0]&&(w[0]=L[0]),L[1]<w[1]&&(w[1]=L[1]),L[2]<w[2]&&(w[2]=L[2]),L[3]>w[3]&&(w[3]=L[3]),L[4]>w[4]&&(w[4]=L[4]),L[5]>w[5]&&(w[5]=L[5]);for(var S=0;S<U;S++)re[le+S]=I+J[S];C.push({materialIndex:O,name:d.name,chunkName:parseChunkName(d.name),start:le,count:d.faces.indices.length,texture:(r=d.texture)!==null&&r!==void 0?r:void 0}),I+=oe,le+=U}var ne={createAt:o,description:s,vertices:R,uvs:M,normals:H,masks:B,indices:re,floorIndex:b,groups:C,extents:w};u.push(ne)}}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,u){s===void 0&&(s={});for(var l=parsePBMModel(n),c=0,p="",f=[],d={},h=new Set,g=0,A=0,m=l;A<m.length;A++){var E=m[A],v=E.createAt,y=E.description,b=E.vertices,T=E.masks,_=E.uvs,S=E.normals,R=E.indices,M=E.floorIndex,H=E.groups,B=E.extents,C=new THREE__namespace.Box3;C.min.x=B[0],C.min.y=B[1],C.min.z=B[2],C.max.x=B[3],C.max.y=B[4],C.max.z=B[5];var w=new THREE__namespace.BufferGeometry;w.setAttribute("position",new THREE__namespace.BufferAttribute(b,3)),w.setAttribute("uv",new THREE__namespace.BufferAttribute(_,2)),S&&w.setAttribute("normal",new THREE__namespace.BufferAttribute(S,3)),T&&w.setAttribute("_feature_id_rsmask",new THREE__namespace.BufferAttribute(T,1)),R&&w.setIndex(new THREE__namespace.BufferAttribute(R,1)),w.boundingBox=C,w.boundingSphere=C.getBoundingSphere(new THREE__namespace.Sphere);for(var I=0,O=H;I<O.length;I++){var L=O[I];w.addGroup(L.start,L.count,L.materialIndex)}h.add(w);for(var N=[],z=0,J=H;z<J.length;z++){var L=J[z],K=r[L.chunkName]||(L.texture?pathJoin(e||"",L.texture):void 0),Q=new PBMMeshMaterial(t?"phong":"basic");Q.floorIndex=M,w.attributes.normal===void 0&&(Q.flatShading=!0),w.attributes._feature_id_rsmask&&(Q.defines.USE_VERTEX_MARK=!0),N.push(Q),K?(g++,d[K]?d[K].push(Q):d[K]=[Q]):Q.color=new THREE__namespace.Color(16777215),h.add(Q)}var U=new PBMMesh(w,N);U.name="model_floor_"+M,U.userData.createAt=v,U.userData.description=y,U.matrix.compose(U.position,U.quaternion,U.scale),U.matrixAutoUpdate=!1,U.frustumCulled=!1,c=v,p=y,f.push(U)}var q=function(X){X=autoRestImageOptionsByTextureLength(X,g);for(var Z=[],W=function(ee){var re=null;ee in s&&(re=s[ee]),re||(re=loadTexture$1(ee,X,u)),Z.push(re.then(function(le){for(var ae=0,oe=d[ee];ae<oe.length;ae++){var se=oe[ae];se.map&&(h.delete(se.map),se.map.dispose()),se.map=le,h.add(le)}return le}).catch(function(){for(var le=0,ae=d[ee];le<ae.length;le++){var oe=ae[le];oe.map&&(h.delete(oe.map),oe.map.dispose()),oe.map=null,oe.color=new THREE__namespace.Color(16777215)}return null}))},G=0,ne=Object.keys(d);G<ne.length;G++){var $=ne[G];W($)}for(var $ in s)delete s[$];return Promise.all(Z).then(function(ee){return ee.filter(function(re){return re})})};return q(o).then(function(X){return{createAt:c,description:p,objects:f,textures:X,dispose:function(){h.forEach(function(Z){Z.dispose()}),h.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 createLZMA(){var n={};return n.OutWindow=function(){this._windowSize=0},n.OutWindow.prototype.create=function(t){(!this._buffer||this._windowSize!==t)&&(this._buffer=[]),this._windowSize=t,this._pos=0,this._streamPos=0},n.OutWindow.prototype.flush=function(){var t=this._pos-this._streamPos;if(t!==0){for(;t--;)this._stream.writeByte(this._buffer[this._streamPos++]);this._pos>=this._windowSize&&(this._pos=0),this._streamPos=this._pos}},n.OutWindow.prototype.releaseStream=function(){this.flush(),this._stream=null},n.OutWindow.prototype.setStream=function(t){this.releaseStream(),this._stream=t},n.OutWindow.prototype.init=function(t){t||(this._streamPos=0,this._pos=0)},n.OutWindow.prototype.copyBlock=function(t,e){var r=this._pos-t-1;for(r<0&&(r+=this._windowSize);e--;)r>=this._windowSize&&(r=0),this._buffer[this._pos++]=this._buffer[r++],this._pos>=this._windowSize&&this.flush()},n.OutWindow.prototype.putByte=function(t){this._buffer[this._pos++]=t,this._pos>=this._windowSize&&this.flush()},n.OutWindow.prototype.getByte=function(t){var e=this._pos-t-1;return e<0&&(e+=this._windowSize),this._buffer[e]},n.RangeDecoder=function(){},n.RangeDecoder.prototype.setStream=function(t){this._stream=t},n.RangeDecoder.prototype.releaseStream=function(){this._stream=null},n.RangeDecoder.prototype.init=function(){var t=5;for(this._code=0,this._range=-1;t--;)this._code=this._code<<8|this._stream.readByte()},n.RangeDecoder.prototype.decodeDirectBits=function(t){for(var e=0,r=t,o;r--;)this._range>>>=1,o=this._code-this._range>>>31,this._code-=this._range&o-1,e=e<<1|1-o,this._range&4278190080||(this._code=this._code<<8|this._stream.readByte(),this._range<<=8);return e},n.RangeDecoder.prototype.decodeBit=function(t,e){var r=t[e],o=(this._range>>>11)*r;return(this._code^2147483648)<(o^2147483648)?(this._range=o,t[e]+=2048-r>>>5,this._range&4278190080||(this._code=this._code<<8|this._stream.readByte(),this._range<<=8),0):(this._range-=o,this._code-=o,t[e]-=r>>>5,this._range&4278190080||(this._code=this._code<<8|this._stream.readByte(),this._range<<=8),1)},n.initBitModels=function(t,e){for(;e--;)t[e]=1024},n.BitTreeDecoder=function(t){this._models=[],this._numBitLevels=t},n.BitTreeDecoder.prototype.init=function(){n.initBitModels(this._models,1<<this._numBitLevels)},n.BitTreeDecoder.prototype.decode=function(t){for(var e=1,r=this._numBitLevels;r--;)e=e<<1|t.decodeBit(this._models,e);return e-(1<<this._numBitLevels)},n.BitTreeDecoder.prototype.reverseDecode=function(t){for(var e=1,r=0,o=0,s;o<this._numBitLevels;++o)s=t.decodeBit(this._models,e),e=e<<1|s,r|=s<<o;return r},n.reverseDecode2=function(t,e,r,o){for(var s=1,u=0,l=0,c;l<o;++l)c=r.decodeBit(t,e+s),s=s<<1|c,u|=c<<l;return u},n.LenDecoder=function(){this._choice=[],this._lowCoder=[],this._midCoder=[],this._highCoder=new n.BitTreeDecoder(8),this._numPosStates=0},n.LenDecoder.prototype.create=function(t){for(;this._numPosStates<t;++this._numPosStates)this._lowCoder[this._numPosStates]=new n.BitTreeDecoder(3),this._midCoder[this._numPosStates]=new n.BitTreeDecoder(3)},n.LenDecoder.prototype.init=function(){var t=this._numPosStates;for(n.initBitModels(this._choice,2);t--;)this._lowCoder[t].init(),this._midCoder[t].init();this._highCoder.init()},n.LenDecoder.prototype.decode=function(t,e){return t.decodeBit(this._choice,0)===0?this._lowCoder[e].decode(t):t.decodeBit(this._choice,1)===0?8+this._midCoder[e].decode(t):16+this._highCoder.decode(t)},n.Decoder2=function(){this._decoders=[]},n.Decoder2.prototype.init=function(){n.initBitModels(this._decoders,768)},n.Decoder2.prototype.decodeNormal=function(t){var e=1;do e=e<<1|t.decodeBit(this._decoders,e);while(e<256);return e&255},n.Decoder2.prototype.decodeWithMatchByte=function(t,e){var r=1,o,s;do if(o=e>>7&1,e<<=1,s=t.decodeBit(this._decoders,(1+o<<8)+r),r=r<<1|s,o!==s){for(;r<256;)r=r<<1|t.decodeBit(this._decoders,r);break}while(r<256);return r&255},n.LiteralDecoder=function(){},n.LiteralDecoder.prototype.create=function(t,e){var r;if(!(this._coders&&this._numPrevBits===e&&this._numPosBits===t))for(this._numPosBits=t,this._posMask=(1<<t)-1,this._numPrevBits=e,this._coders=[],r=1<<this._numPrevBits+this._numPosBits;r--;)this._coders[r]=new n.Decoder2},n.LiteralDecoder.prototype.init=function(){for(var t=1<<this._numPrevBits+this._numPosBits;t--;)this._coders[t].init()},n.LiteralDecoder.prototype.getDecoder=function(t,e){return this._coders[((t&this._posMask)<<this._numPrevBits)+((e&255)>>>8-this._numPrevBits)]},n.Decoder=function(){this._outWindow=new n.OutWindow,this._rangeDecoder=new n.RangeDecoder,this._isMatchDecoders=[],this._isRepDecoders=[],this._isRepG0Decoders=[],this._isRepG1Decoders=[],this._isRepG2Decoders=[],this._isRep0LongDecoders=[],this._posSlotDecoder=[],this._posDecoders=[],this._posAlignDecoder=new n.BitTreeDecoder(4),this._lenDecoder=new n.LenDecoder,this._repLenDecoder=new n.LenDecoder,this._literalDecoder=new n.LiteralDecoder,this._dictionarySize=-1,this._dictionarySizeCheck=-1,this._posSlotDecoder[0]=new n.BitTreeDecoder(6),this._posSlotDecoder[1]=new n.BitTreeDecoder(6),this._posSlotDecoder[2]=new n.BitTreeDecoder(6),this._posSlotDecoder[3]=new n.BitTreeDecoder(6)},n.Decoder.prototype.setDictionarySize=function(t){return t<0?!1:(this._dictionarySize!==t&&(this._dictionarySize=t,this._dictionarySizeCheck=Math.max(this._dictionarySize,1),this._outWindow.create(Math.max(this._dictionarySizeCheck,4096))),!0)},n.Decoder.prototype.setLcLpPb=function(t,e,r){var o=1<<r;return t>8||e>4||r>4?!1:(this._literalDecoder.create(e,t),this._lenDecoder.create(o),this._repLenDecoder.create(o),this._posStateMask=o-1,!0)},n.Decoder.prototype.init=function(){var t=4;for(this._outWindow.init(!1),n.initBitModels(this._isMatchDecoders,192),n.initBitModels(this._isRep0LongDecoders,192),n.initBitModels(this._isRepDecoders,12),n.initBitModels(this._isRepG0Decoders,12),n.initBitModels(this._isRepG1Decoders,12),n.initBitModels(this._isRepG2Decoders,12),n.initBitModels(this._posDecoders,114),this._literalDecoder.init();t--;)this._posSlotDecoder[t].init();this._lenDecoder.init(),this._repLenDecoder.init(),this._posAlignDecoder.init(),this._rangeDecoder.init()},n.Decoder.prototype.decode=function(t,e,r){var o=0,s=0,u=0,l=0,c=0,p=0,f=0,d,h,g,A,m,E;for(this._rangeDecoder.setStream(t),this._outWindow.setStream(e),this.init();r<0||p<r;)if(d=p&this._posStateMask,this._rangeDecoder.decodeBit(this._isMatchDecoders,(o<<4)+d)===0)h=this._literalDecoder.getDecoder(p++,f),o>=7?f=h.decodeWithMatchByte(this._rangeDecoder,this._outWindow.getByte(s)):f=h.decodeNormal(this._rangeDecoder),this._outWindow.putByte(f),o=o<4?0:o-(o<10?3:6);else{if(this._rangeDecoder.decodeBit(this._isRepDecoders,o)===1)g=0,this._rangeDecoder.decodeBit(this._isRepG0Decoders,o)===0?this._rangeDecoder.decodeBit(this._isRep0LongDecoders,(o<<4)+d)===0&&(o=o<7?9:11,g=1):(this._rangeDecoder.decodeBit(this._isRepG1Decoders,o)===0?A=u:(this._rangeDecoder.decodeBit(this._isRepG2Decoders,o)===0?A=l:(A=c,c=l),l=u),u=s,s=A),g===0&&(g=2+this._repLenDecoder.decode(this._rangeDecoder,d),o=o<7?8:11);else if(c=l,l=u,u=s,g=2+this._lenDecoder.decode(this._rangeDecoder,d),o=o<7?7:10,m=this._posSlotDecoder[g<=5?g-2:3].decode(this._rangeDecoder),m>=4){if(E=(m>>1)-1,s=(2|m&1)<<E,m<14)s+=n.reverseDecode2(this._posDecoders,s-m-1,this._rangeDecoder,E);else if(s+=this._rangeDecoder.decodeDirectBits(E-4)<<4,s+=this._posAlignDecoder.reverseDecode(this._rangeDecoder),s<0){if(s===-1)break;return!1}}else s=m;if(s>=p||s>=this._dictionarySizeCheck)return!1;this._outWindow.copyBlock(s,g),p+=g,f=this._outWindow.getByte(0)}return this._outWindow.flush(),this._outWindow.releaseStream(),this._rangeDecoder.releaseStream(),!0},n.Decoder.prototype.setDecoderProperties=function(t){var e,r,o,s,u;return t.size<5||(e=t.readByte(),r=e%9,e=~~(e/9),o=e%5,s=~~(e/5),!this.setLcLpPb(r,o,s))?!1:(u=t.readByte(),u|=t.readByte()<<8,u|=t.readByte()<<16,u+=t.readByte()*16777216,this.setDictionarySize(u))},n.decompress=function(t,e,r,o){var s=new n.Decoder;if(!s.setDecoderProperties(t))throw"Incorrect stream properties";if(!s.decode(e,r,o))throw"Error in data stream";return!0},n.decompressFile=function(t,e){var r=new n.Decoder,o;if(!r.setDecoderProperties(t))throw"Incorrect stream properties";if(o=t.readByte(),o|=t.readByte()<<8,o|=t.readByte()<<16,o+=t.readByte()*16777216,t.readByte(),t.readByte(),t.readByte(),t.readByte(),!r.decode(t,e,o))throw"Error in data stream";return!0},n}var LZMA=createLZMA();function createWASM(){function n(e){for(var r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=new Uint8Array(256),s=0;s<r.length;s++)o[r.charCodeAt(s)]=s;var u=e.length*.75,l=e.length,c,p=0,f,d,h,g;e[e.length-1]==="="&&(u--,e[e.length-2]==="="&&u--);var A=new ArrayBuffer(u),m=new Uint8Array(A);for(c=0;c<l;c+=4)f=o[e.charCodeAt(c)],d=o[e.charCodeAt(c+1)],h=o[e.charCodeAt(c+2)],g=o[e.charCodeAt(c+3)],m[p++]=f<<2|d>>4,m[p++]=(d&15)<<4|h>>2,m[p++]=(h&3)<<6|g&63;return A}var t="AGFzbQEAAAABSg1gAABgAX8Bf2ACf38Bf2AEf39/fwBgA39/fwBgAX8AYAJ/fwBgA39/fwF/YAR/f39/AX9gAn9/AGABfwF/YAABf2AEf39/fwF/AhsCA2VudgVhYm9ydAADA2VudgZtZW1vcnkCAAEDJiUBAQkKAgoKCwsLCwsAAgoBAgQKAQYFCAoFBQQEBwgCBwwCAQAABAQBcAABBhoFfwFBAAt/AUEAC38BQQALfwFBAAt/AUEACwc9BgZtZW1vcnkCAAV0YWJsZQEABXJlc2V0AA0KbmV3VThBcnJheQAQCnVucGFja1NpemUAFAZkZWNvZGUAIwgBJAkHAQBBAAsBJQqAViVoAQN/IABBgICAgARLBEAACyMBIgEgAEEBIABBAUsbakEHakF4cSICPwAiA0EQdEsEQCADIAIgAWtB//8DakGAgHxxQRB2IgAgAyAAShtAAEEASARAIABAAEEASARAAAsLCyACJAEgAQsbAQF/QQFBICAAQQdqZ2t0EAEiASAANgIAIAELkQMBAX8gAUUEQA8LIABBADoAACAAIAFqQQFrQQA6AAAgAUECTQRADwsgAEEBakEAOgAAIABBAmpBADoAACAAIAFqIgJBAmtBADoAACACQQNrQQA6AAAgAUEGTQRADwsgAEEDakEAOgAAIAAgAWpBBGtBADoAACABQQhNBEAPC0EAIABrQQNxIgIgAGoiAEEANgIAIAEgAmtBfHEiASAAakEEa0EANgIAIAFBCE0EQA8LIABBBGpBADYCACAAQQhqQQA2AgAgACABaiICQQxrQQA2AgAgAkEIa0EANgIAIAFBGE0EQA8LIABBDGpBADYCACAAQRBqQQA2AgAgAEEUakEANgIAIABBGGpBADYCACAAIAFqIgJBHGtBADYCACACQRhrQQA2AgAgAkEUa0EANgIAIAJBEGtBADYCACAAQQRxQRhqIgIgAGohACABIAJrIQEDQCABQSBPBEAgAEIANwMAIABBCGpCADcDACAAQRBqQgA3AwAgAEEYakIANwMAIAFBIGshASAAQSBqIQAMAQsLC1EBA38gAEH+////AEsEQEEAQSBBLUEnEAAACyAAQQJ0IgMQAiECQQgQASIBQQA2AgAgAUEANgIEIAEgAjYCACABIAA2AgQgAkEIaiADEAMgAQtmAQF/IAFB/P///wFLBEBBAEHAAEEXQSIQAAALIAFBAXQiARACIgJBCGogARADIABFBEBBDBABIQALIABBADYCACAAQQA2AgQgAEEANgIIIAAgAjYCACAAQQA2AgQgACABNgIIIAALCgBBDBABIAAQBQsuAQF/QQgQASIBQQA2AgAgAUEANgIEIAEgADYCBCABQQEgASgCBHQQBjYCACABC6EBAQR/QRAQASIBQQA2AgAgAUEANgIEIAFBADYCCCABQQA2AgxBEBAEIQIDQCAAQRBIBEBBAxAHIQMgAigCACAAQQJ0aiADNgIIIABBAWohAAwBCwsgASACNgIEQRAQBCECQQAhAANAIABBEEgEQEEDEAchAyACKAIAIABBAnRqIAM2AgggAEEBaiEADAELCyABIAI2AgggAUEIEAc2AgwgAQs0AQF/QRQQASIAQQA2AgAgAEEAOgAEIABBADYCCCAAQQA2AgwgAEEANgIQIABBDTYCCCAAC0IBAX9BGRABIgBBADYCACAAQQA2AgQgAEEANgIIIABBADY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ACAESBsLIQIgA0EASAR/IAMgBGoiAEEAIABBAEobBSADIgAgBCAAIARIGwshAwNAIAIgA05FBEAgAkEBdCABaiAHaiAFOwEIIAJBAWohAgwBCwsgBgssAQF/AkACQAJAIwRBAWsOAwEBAgALAAtB/////wchAQsgAEGACEEAIAEQFwvBAQECfyAAQQIQBjYCACAAKAIAIgEoAgAgASgCBGpBgAg7AQggACgCACICKAIAIQEgAigCBCABQQJqakGACDsBCCAAKAIMKAIAQQEkBBAYGkEAIQIDQCACQRBIBEAgAiAAKAIEKAIAIgEoAgBBAnZJBH8gAkECdCABaigCCAUACygCAEEBJAQQGBogAiAAKAIIKAIAIgEoAgBBAnZJBH8gAkECdCABaigCCAUACygCAEEBJAQQGBogAkEBaiECDAELCwuHAgEFfyAAIQJBgAYgACgCDCAALQAUanQhAQNAIAMgAUgEQCACKAIgIgQoAgAhBSAEKAIEIANBAXQgBWpqQYAIOwEIIANBAWohAwwBCwsgAiEBQQAhAgNAIAJBBEkEQCACIAEoAiQoAgAiAygCAEECdkkEfyACQQJ0IANqKAIIBQALKAIAQQEkBBAYGiACQQFqIQIMAQsLIAEoAigoAgBBASQEEBgaIAEoAixBASQEEBgaIAAoAjBBASQEEBgaIAAoAjRBASQEEBgaIAAoAjhBASQEEBgaIAAoAjxBASQEEBgaIAAoAkBBASQEEBgaIAAoAkRBASQEEBgaIAAoAkgQGSAAKAJMEBkLyAwBA38DQCABQQNxIAIgAhsEQCAAIgRBAWohACABIgNBAWohASAEIAMtAAA6AAAgAkEBayECDAELCyAAQQNxRQRAA0AgAkEQTwRAIAAgASgCADYCACAAQQRqIAFBBGooAgA2AgAgAEEIaiABQQhqKAIANgIAIABBDGogAUEMaigCADYCACABQRBqIQEgAEEQaiEAIAJBEGshAgwBCwsgAkEIcQRAIAAgASgCADYCACAAQQRqIAFBBGooAgA2AgAgAUEIaiEBIABBCGohAAsgAkEEcQRAIAAgASgCADYCACABQQRqIQEgAEEEaiEACyACQQJxBEAgACABLwEAOwEAI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QBBAUEAQQAQIQsIACMDIAAQIgsWAEG4ASQAIwAkAUGAgIAIJAIQDCQDCwMAAQsLtwEEAEEICxcKAAAAdQBzAGUAIABzAHQAcgBpAGMAdABBIAsdDQAAAH4AbABpAGIALwBhAHIAcgBhAHkALgB0AHMAQcAACzkbAAAAfgBsAGkAYgAvAGkAbgB0AGUAcgBuAGEAbAAvAHQAeQBwAGUAZABhAHIAcgBhAHkALgB0AHMAQYABCzMYAAAAcwByAGMALwBsAHoAbQBhAC8AbAB6AG0AYQAtAGQAZQBjAG8AZABlAHIALgB0AHM=";return n(t)}function decodeLZMA(n,t,e){try{var r={data:t,offset:0,readByte:function(){return this.data[this.offset++]}},o=r.data.length,s={data:[],offset:0,writeByte:function(c){var p=Math.floor(this.offset/o);this.data[p]||(this.data[p]=new Uint8Array(o)),this.data[p][this.offset%o]=c,this.offset++}};n.decompressFile(r,s);for(var u=new Uint8Array(s.offset),l=0;l<s.offset;l++)u[l]=s.data[Math.floor(l/o)][l%o];e(null,u)}catch(c){e(c)}}function decodeLZMAWithWASM(n,t,e){var r=24;try{var o=new WebAssembly.Memory({initial:16}),s=new WebAssembly.Module(n),u=new WebAssembly.Instance(s,{env:{memory:o,abort:function(){e(new Error("webAssembly abort"))}}}),l=u.exports,c=l.newU8Array(t.length),p=new Uint8Array(o.buffer,c+r,t.length);p.set(t);var f=l.decode(c),d=new Uint32Array(o.buffer,f,4),h=d[0],g=d[2],A=d[3];h?e(null,new Uint8Array(o.buffer,A+r,g).slice(0,g)):e(new Error("lzma deocder error"))}catch(m){e(m)}}var lzmaWorkerSource=`
|
|
405
|
+
`),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,p=matchJsonpFunctionName(n),f=p?"Script":"XMLHttpRequest",d=new NetworkProxyError(u,f,l&&l.message?String(l.message):String(l));return(c=t.networkSubscribe)===null||c===void 0||c.emit("network",n,f,"proxy-error",d.message),Promise.reject(d)}).then(function(l){return new Promise(function(c,p){var f,d=t.allowHosts?BUILDIN_ALLOW_HOST.concat(t.allowHosts):BUILDIN_ALLOW_HOST.slice(),h=hostnameFromURL(l),g=matchJsonpFunctionName(l);if(location.hostname.length!==0&&!isIPDomain(location.hostname)&&BUILDIN_ALLOW_HOST.filter(function(I){return matchDomain(I,location.hostname)}).length===0&&!isIPDomain(h)&&d.filter(function(I){return matchDomain(I,h)}).length===0){var A=g?"Script":"XMLHttpRequest",m=new NetworkFirbiddenError(l,A,"request host(".concat(h,") is not allowed"));r(m),p(m),(f=t.networkSubscribe)===null||f===void 0||f.emit("network",l,A,"forbidden",m.message);return}if(g){var E=window,v=null,y=!1,b=document.createElement("script"),T=function(){var I;if(v=null,y!==!0){y=!0;var O=new NetworkTimeoutError(l,"Script",t.timeout||NaN);r(O),p(O),(I=t.networkSubscribe)===null||I===void 0||I.emit("network",l,"Script","timeout",O.message)}},_=function(I){var O,L,N=now(),z=N-s;if(delete E[g],b.parentNode&&b.parentNode.removeChild(b),v!==null&&(window.clearTimeout(v),v=null),y!==!0){if(I.indexOf("data:")!==0){var J=new NetworkResponseError(l,"Script",500);r(J),p(J),(O=t.networkSubscribe)===null||O===void 0||O.emit("network",l,"Script","error",J.message);return}var G=I.split(","),Q=(G[0].match(/:(.*?);/)||[])[1],U=G[1];if(t.responseType==="arraybuffer"||t.responseType==="blob"){for(var q=atob(G[1]),K=q.length,Y=new Uint8Array(K),Z=0;Z<K;Z++)Y[Z]=q.charCodeAt(Z);t.responseType==="arraybuffer"?U=Y.buffer:U=new Blob([Y],{type:Q})}var te={},j={body:U,meta:{origin:u,source:l,requestTime:s,responseTime:N,costs:z,headers:te}};e(j),c(j),(L=t.networkSubscribe)===null||L===void 0||L.emit("network",l,"Script","ok",JSON.stringify(j.meta)),y=!0}};E[g]=_,b.src=l,document.body.appendChild(b),typeof t.timeout=="number"&&(v=window.setTimeout(T,t.timeout))}else{var S=!1,R=new XMLHttpRequest,M=function(){R&&(R.removeEventListener("timeout",H,!1),R.removeEventListener("progress",B,!1),R.removeEventListener("load",C,!1),R.removeEventListener("error",w,!1)),R=null,M=noop$1},H=function(){var I;if(S!==!0){S=!0,M();var O=new NetworkTimeoutError(l,"XMLHttpRequest",t.timeout||NaN);r(O),p(O),(I=t.networkSubscribe)===null||I===void 0||I.emit("network",l,"XMLHttpRequest","timeout",O.message)}},B=function(I){S!==!0&&I.lengthComputable&&(I.total<=0||o(I.loaded/I.total))},C=function(I){var O;if(S!==!0){var L=this.status;if(L===0||L>=200&&L<400){S=!0,M();var N=now(),z=N-s,J=parseHeaders(this.getAllResponseHeaders()),G=I.total,Q={body:this.response,meta:{origin:u,source:l,requestTime:s,responseTime:N,costs:z,headers:J,size:G}};e(Q),c(Q),(O=t.networkSubscribe)===null||O===void 0||O.emit("network",l,"XMLHttpRequest","ok",JSON.stringify(Q.meta))}else w.call(this)}},w=function(){var I;if(S!==!0){S=!0,M();var O=new NetworkResponseError(l,"XMLHttpRequest",this.status);r(O),p(O),(I=t.networkSubscribe)===null||I===void 0||I.emit("network",l,"XMLHttpRequest","error",O.message)}};R.addEventListener("timeout",H,!1),R.addEventListener("progress",B,!1),R.addEventListener("load",C,!1),R.addEventListener("error",w,!1),t.responseType&&(R.responseType=t.responseType),typeof t.timeout=="number"&&(R.timeout=t.timeout),R.open("GET",l,!0),R.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(),p=hostnameFromURL(o);if(location.hostname.length!==0&&!isIPDomain(location.hostname)&&BUILDIN_ALLOW_HOST.filter(function(m){return matchDomain(m,location.hostname)}).length===0&&!isIPDomain(p)&&c.filter(function(m){return matchDomain(m,p)}).length===0){var f=new NetworkFirbiddenError(o,"Link","request host(".concat(p,") is not allowed"));u(f),(l=t.networkSubscribe)===null||l===void 0||l.emit("network",o,"Link","forbidden",f.message);return}var d=document.createElement("link"),h=!1,g=null;d.onload=function(m){var E;if(g!==null&&(clearTimeout(g),g=null),h!==!0){h=!0,s();var v=now(),y=v-e,b={},T={origin:r,source:o,requestTime:e,responseTime:v,costs:y,headers:b};(E=t.networkSubscribe)===null||E===void 0||E.emit("network",o,"Link","preload",JSON.stringify(T))}},d.onerror=function(m){var E;if(g!==null&&(clearTimeout(g),g=null),h!==!0){h=!0;var v=new NetworkResponseError(o,"Link",0);u(v),(E=t.networkSubscribe)===null||E===void 0||E.emit("network",o,"Link","error",v.message)}},typeof t.timeout=="number"&&(g=window.setTimeout(function(){var m;if(g=null,h!==!0){h=!0,s();var E=now(),v=E-e,y={},b={origin:r,source:o,requestTime:e,responseTime:E,costs:v,headers:y};(m=t.networkSubscribe)===null||m===void 0||m.emit("network",o,"Link","timeout",JSON.stringify(b))}},t.timeout)),d.rel=d.relList&&d.relList.supports("prefetch")?"prefetch":"preload",d.as="fetch",d.crossOrigin="",d.fetchPriority="high",d.href=o;var A=document.head||document.getElementsByTagName("head")[0];A&&A.appendChild(d)})})}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 p,f=new NetworkProxyError(l,"Image",c&&c.message?String(c.message):String(c));return(p=t.networkSubscribe)===null||p===void 0||p.emit("network",n,"Image","proxy-error",f.message),Promise.reject(f)}).then(function(c){return new Promise(function(p,f){var d,h=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)&&h.filter(function(T){return matchDomain(T,g)}).length===0){var A=new NetworkFirbiddenError(c,"Image","request host(".concat(g,") is not allowed"));r(A),f(A),(d=t.networkSubscribe)===null||d===void 0||d.emit("network",c,"Image","forbidden",A.message);return}var m=s!=null?s:new Image,E=!1,v=null,y=function(){var T;if(m.onload=noop$1,m.onerror=noop$1,v!==null&&(clearTimeout(v),v=null),E!==!0){var _=now(),S={headers:{},origin:l,source:c,requestTime:u,responseTime:_,costs:_-u};E=!0;var R={body:m,meta:S};o(1),e(R),p(R),(T=t.networkSubscribe)===null||T===void 0||T.emit("network",c,"Image","ok",JSON.stringify(R.meta))}},b=function(){var T;if(m.onload=noop$1,m.onerror=noop$1,v!==null&&(clearTimeout(v),v=null),E!==!0){E=!0;var _=new NetworkResponseError(c,"Image",0);r(_),f(_),(T=t.networkSubscribe)===null||T===void 0||T.emit("network",c,"Image","ok",_.message)}};typeof t.timeout=="number"&&(v=window.setTimeout(function(){var T;if(m.onload=noop$1,m.onerror=noop$1,v=null,E!==!0){E=!0;var _=new NetworkTimeoutError(c,"Image",t.timeout);r(_),f(_),(T=t.networkSubscribe)===null||T===void 0||T.emit("network",c,"Image","timeout",_.message)}},t.timeout)),m.onload=y,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 p;return(p=e.allowHosts)!==null&&p!==void 0?p:l.allowHosts},get requestProxy(){var p;return(p=e.requestProxy)!==null&&p!==void 0?p:l.requestProxy},get networkSubscribe(){var p;return(p=e.networkSubscribe)!==null&&p!==void 0?p: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,p={timeout:(l=e.timeout)!==null&&l!==void 0?l:c.timeout,get allowHosts(){var f;return(f=e.allowHosts)!==null&&f!==void 0?f:c.allowHosts},get requestProxy(){var f;return(f=e.requestProxy)!==null&&f!==void 0?f:c.requestProxy},get networkSubscribe(){var f;return(f=e.networkSubscribe)!==null&&f!==void 0?f:c.networkSubscribe}};return loadImage(t,p,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 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}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("/")}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){if(typeof Image=="undefined"){t(!1);return}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 _a$5,supportAvif=!1,supportWebp=!1,supportHeif=!1;imageSupport().then(function(n){supportAvif=n.avif,supportWebp=n.webp,supportHeif=n.heif});var IMAGE_FORMATS=["jpg","jpeg","png","heif","heic","webp","avif"];function isImageExt(n){return IMAGE_FORMATS.indexOf(n)>=0}var 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,e){var r,o,s=(o=(r=t[e])!==null&&r!==void 0?r:t[t.length-1])!==null&&o!==void 0?o:n;return n.replace(URL_DOMAIN_REGEX,function(u,l){return u.slice(0,u.length-l.length)+s})}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"){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"){s[0],s[1];var l=s[2],c=s[3],p=s[4],f=Math.pow(2,Number(l))*Number(c)+Number(p);if(!isNaN(f))return replaceDomain(n,e.tile,f%2)}else if(o==="model"){var d=s[0],f=Number(d);if(!isNaN(f))return replaceDomain(n,e.model,f%2)}return replaceDomain(n,e.default,0)}var tencentCloudImageProcesser=function(n,t){var e=n.split("?")[0],r=e.split(".").pop();if(r==="jpeg"&&(r="jpg"),r==="heif"&&(r="heic"),r&&!isImageExt(r))return n;var o=[],s=t.format,u=t.cut,l=t.quality,c=t.size,p=t.sharpen;if(s==="jpeg"&&(s="jpg"),s==="heif"&&(s="heic"),(!supportAvif&&(s!=null?s:r)==="avif"||!supportWebp&&(s!=null?s:r)==="webp"||!supportHeif&&(s!=null?s:r)==="heic")&&(s="jpg"),s!==void 0&&s!==r&&o.push("format/".concat(s)),u!==void 0&&o.push("cut/".concat(u[2],"x").concat(u[3],"x").concat(u[0],"x").concat(u[1])),l!==void 0){var f=s!=null?s:r;f&&["jpg","webp","heic","avif"].indexOf(f)>=0&&o.push("quality/".concat(l))}if(c!==void 0){var d=n.match(/\/cube_(\d+)\//),h=d?Number(d[1]):NaN;h!==Number(c)&&o.push("thumbnail/".concat(c,"x"))}p!==void 0&&o.push("sharpen/".concat(p));var g="";return o.length&&(g="?imageMogr2/"+o.join("/")),e+g},aliyunOOSImageProcesser=function(n,t){var e=n.split("?")[0],r=e.split(".").pop();if(r==="jpeg"&&(r="jpg"),r==="heif"&&(r="heic"),r&&!isImageExt(r))return n;var o=[],s=t.format,u=t.cut,l=t.quality,c=t.size,p=t.sharpen;if(s==="jpeg"&&(s="jpg"),s==="heif"&&(s="heic"),(!supportAvif&&(s!=null?s:r)==="avif"||!supportWebp&&(s!=null?s:r)==="webp"||!supportHeif&&(s!=null?s:r)==="heic")&&(s="jpg"),s!==void 0&&s!==r&&o.push("format,".concat(s)),u!==void 0){var f=u[0],d=u[1],h=u[2],g=u[3];o.push("crop,x_".concat(f,",y_").concat(d,",w_").concat(h,",h_").concat(g,",g_nw"))}if(l!==void 0&&l!==100){var A=s!=null?s:r;A&&["jpg","webp","heic","avif"].indexOf(A)>=0&&o.push("quality,Q_".concat(l))}c&&c!==2048&&o.push("resize,w_".concat(c)),p!==void 0&&o.push("sharpen,".concat(p));var m="";return o.length&&(m="?x-oss-process=image/"+o.join("/")),e+m},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 log2=(_a$5=Math.log2)!==null&&_a$5!==void 0?_a$5:function(n){return Math.log(n)*Math.LOG2E};function getImageSizeLevel(n){return Math.floor(Math.max(log2(n/512),0))}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 FACE_ORDER$1=["right","left","up","down","front","back"],TextureLoader=function(){function n(){}return n.prototype.loadTexture=function(t,e,r,o,s,u){var l,c,p,f,d,h,g;r===void 0&&(r=noop$1),o===void 0&&(o=noop$1),s===void 0&&(s=noop$1);var A={};typeof e.flipY!="undefined"&&(A.flipY=e.flipY),typeof e.format!="undefined"&&(A.format=e.format),typeof e.encoding!="undefined"&&(A.encoding=e.encoding),A.generateMipmaps=(l=e.generateMipmaps)!==null&&l!==void 0?l:!1,A.minFilter=(c=e.minFilter)!==null&&c!==void 0?c:THREE__namespace.LinearFilter,A.magFilter=(p=e.magFilter)!==null&&p!==void 0?p:THREE__namespace.LinearFilter;var m=(d=(f=e.imageURL)===null||f===void 0?void 0:f.options)!==null&&d!==void 0?d:{key:"unknown"};t=applyImageURLOptions(t,(h=e.imageURL)===null||h===void 0?void 0:h.transform,m);var E=getProtocol(t),v=(g=e.viaAjax)!==null&&g!==void 0?g:canUseNativeImageBitmap,y=isJsonpSource(t),b=/^https?:/.test(E);if(y?v=!0:b||(v=!1),v){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,A),M}).then(function(M){var H={meta:T,body:M};return r(H),H}).catch(function(M){return o(M),Promise.reject(M)})}else{var S=null,R;return Promise.resolve().then(function(){return createImageBitmapLikeImage()}).then(function(M){return R=M,e.fetcher.loadImage(t,{timeout:e.timeout},void 0,void 0,s,M)}).then(function(M){return S=M.meta,poolImageToTexture(M.body,e.maxSize)}).then(function(M){return Object.assign(M,A),M}).then(function(M){var H={meta:S,body:M};return r(H),H}).catch(function(M){return R&&R.close(),o(M),Promise.reject(M)})}},n.prototype.loadCubeTexture=function(t,e,r,o,s,u){var l,c,p,f,d,h,g;r===void 0&&(r=noop$1),o===void 0&&(o=noop$1),s===void 0&&(s=noop$1);var A={};typeof e.format!="undefined"&&(A.format=e.format),A.generateMipmaps=(l=e.generateMipmaps)!==null&&l!==void 0?l:!1,A.minFilter=(c=e.minFilter)!==null&&c!==void 0?c:THREE__namespace.LinearFilter,A.magFilter=(p=e.magFilter)!==null&&p!==void 0?p:THREE__namespace.LinearFilter;for(var m=[t[FACE_ORDER$1[0]],t[FACE_ORDER$1[1]],t[FACE_ORDER$1[2]],t[FACE_ORDER$1[3]],t[FACE_ORDER$1[4]],t[FACE_ORDER$1[5]]],E=[],v=[0,0,0,0,0,0],y=[],b=function(_){var S=(d=(f=e.imageURL)===null||f===void 0?void 0:f.options)!==null&&d!==void 0?d:{key:"unknown"},R=applyImageURLOptions(m[_],(h=e.imageURL)===null||h===void 0?void 0:h.transform,__assign(__assign({},S),{key:S.key+"."+FACE_ORDER$1[_]})),M=getProtocol(R),H=function(N){v[_]=N,s(v.reduce(function(z,J){return z+J},0)/6)},B=(g=e.viaAjax)!==null&&g!==void 0?g:!1,C=/^https?:$/.test(M),w=isJsonpSource(R);if(w?B=!0:C||(B=!1),B){var I="blob",O=e.fetcher.ajax(R,{timeout:e.timeout,responseType:I},void 0,void 0,H).then(function(N){return y[_]=N.meta,createImageBitmapLike(N.body)});E.push(O)}else{var L,O=Promise.resolve().then(function(){return createImageBitmapLikeImage()}).then(function(z){return L=z,e.fetcher.loadImage(R,{timeout:e.timeout},void 0,void 0,H,z)}).then(function(z){return y[_]=z.meta,z.body}).catch(function(z){return L&&L.close(),Promise.reject(z)});E.push(O)}},T=0;T<6;T++)b(T);return Promise.all(E).then(function(_){return poolImagesToCubeTexture(_)}).then(function(_){return Object.assign(_,__assign({encoding:THREE__namespace.sRGBEncoding},A)),_}).then(function(_){var S={body:_,meta:y};return r(S),S}).catch(function(_){for(var S=0,R=E;S<R.length;S++){var M=R[S];M.then(function(H){return H.close()}).catch(noop$1)}return o(_),Promise.reject(_)})},n}(),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}(),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)})}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(f){if(s)if(s=!1,f)c(f);else{for(var d=new Array(arguments.length-1),h=0;h<d.length;)d[h++]=arguments[h];l.apply(null,d)}};try{n.apply(t||null,e)}catch(p){s&&(s=!1,c(p))}})}var base64$1={};(function(n){var t=n;t.length=function(l){var c=l.length;if(!c)return 0;for(var p=0;--c%4>1&&l.charAt(c)==="=";)++p;return Math.ceil(l.length*3)/4-p};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,p){for(var f=null,d=[],h=0,g=0,A;c<p;){var m=l[c++];switch(g){case 0:d[h++]=e[m>>2],A=(m&3)<<4,g=1;break;case 1:d[h++]=e[A|m>>4],A=(m&15)<<2,g=2;break;case 2:d[h++]=e[A|m>>6],d[h++]=e[m&63],g=0;break}h>8191&&((f||(f=[])).push(String.fromCharCode.apply(String,d)),h=0)}return g&&(d[h++]=e[A],d[h++]=61,g===1&&(d[h++]=61)),f?(h&&f.push(String.fromCharCode.apply(String,d.slice(0,h))),f.join("")):String.fromCharCode.apply(String,d.slice(0,h))};var s="invalid encoding";t.decode=function(l,c,p){for(var f=p,d=0,h,g=0;g<l.length;){var A=l.charCodeAt(g++);if(A===61&&d>1)break;if((A=r[A])===void 0)throw Error(s);switch(d){case 0:h=A,d=1;break;case 1:c[p++]=h<<2|(A&48)>>4,h=A,d=2;break;case 2:c[p++]=(h&15)<<4|(A&60)>>2,h=A,d=3;break;case 3:c[p++]=(h&3)<<6|A,d=0;break}}if(d===1)throw Error(s);return p-f},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,p,f){t[0]=c,p[f]=e[0],p[f+1]=e[1],p[f+2]=e[2],p[f+3]=e[3]}function s(c,p,f){t[0]=c,p[f]=e[3],p[f+1]=e[2],p[f+2]=e[1],p[f+3]=e[0]}n.writeFloatLE=r?o:s,n.writeFloatBE=r?s:o;function u(c,p){return e[0]=c[p],e[1]=c[p+1],e[2]=c[p+2],e[3]=c[p+3],t[0]}function l(c,p){return e[3]=c[p],e[2]=c[p+1],e[1]=c[p+2],e[0]=c[p+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),p=Math.round(o*Math.pow(2,-c)*8388608)&8388607;r((l<<31|c+127<<23|p)>>>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,p=u&8388607;return c===255?p?NaN:l*(1/0):c===0?l*1401298464324817e-60*p:l*Math.pow(2,c-150)*(p+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,p,f){t[0]=c,p[f]=e[0],p[f+1]=e[1],p[f+2]=e[2],p[f+3]=e[3],p[f+4]=e[4],p[f+5]=e[5],p[f+6]=e[6],p[f+7]=e[7]}function s(c,p,f){t[0]=c,p[f]=e[7],p[f+1]=e[6],p[f+2]=e[5],p[f+3]=e[4],p[f+4]=e[3],p[f+5]=e[2],p[f+6]=e[1],p[f+7]=e[0]}n.writeDoubleLE=r?o:s,n.writeDoubleBE=r?s:o;function u(c,p){return e[0]=c[p],e[1]=c[p+1],e[2]=c[p+2],e[3]=c[p+3],e[4]=c[p+4],e[5]=c[p+5],e[6]=c[p+6],e[7]=c[p+7],t[0]}function l(c,p){return e[7]=c[p],e[6]=c[p+1],e[5]=c[p+2],e[4]=c[p+3],e[3]=c[p+4],e[2]=c[p+5],e[1]=c[p+6],e[0]=c[p+7],t[0]}n.readDoubleLE=r?u:l,n.readDoubleBE=r?l:u}():function(){function t(r,o,s,u,l,c){var p=u<0?1:0;if(p&&(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((p<<31|2146435072)>>>0,l,c+s);else{var f;if(u<22250738585072014e-324)f=u/5e-324,r(f>>>0,l,c+o),r((p<<31|f/4294967296)>>>0,l,c+s);else{var d=Math.floor(Math.log(u)/Math.LN2);d===1024&&(d=1023),f=u*Math.pow(2,-d),r(f*4503599627370496>>>0,l,c+o),r((p<<31|d+1023<<20|f*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),p=r(u,l+s),f=(p>>31)*2+1,d=p>>>20&2047,h=4294967296*(p&1048575)+c;return d===2047?h?NaN:f*(1/0):d===0?f*5e-324*h:f*Math.pow(2,d-1075)*(h+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=[],p=0,f;o<s;)f=r[o++],f<128?c[p++]=f:f>191&&f<224?c[p++]=(f&31)<<6|r[o++]&63:f>239&&f<365?(f=((f&7)<<18|(r[o++]&63)<<12|(r[o++]&63)<<6|r[o++]&63)-65536,c[p++]=55296+(f>>10),c[p++]=56320+(f&1023)):c[p++]=(f&15)<<12|(r[o++]&63)<<6|r[o++]&63,p>8191&&((l||(l=[])).push(String.fromCharCode.apply(String,c)),p=0);return l?(p&&l.push(String.fromCharCode.apply(String,c.slice(0,p))),l.join("")):String.fromCharCode.apply(String,c.slice(0,p))},t.write=function(r,o,s){for(var u=s,l,c,p=0;p<r.length;++p)l=r.charCodeAt(p),l<128?o[s++]=l:l<2048?(o[s++]=l>>6|192,o[s++]=l&63|128):(l&64512)===55296&&((c=r.charCodeAt(p+1))&64512)===56320?(l=65536+((l&1023)<<10)+(c&1023),++p,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 p=t.call(s,u,u+=c);return u&7&&(u=(u|7)+1),p}}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,p=(u-c)/4294967296>>>0;return l&&(p=~p>>>0,c=~c>>>0,++c>4294967295&&(c=0,++p>4294967295&&(p=0))),new t(c,p)},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),p=c.length-1;p>-1;--p)if(u[c[p]]===1&&this[c[p]]!==void 0&&this[c[p]]!==null)return c[p]}},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,p){if(c)return u.emit("error",c,t),s(c);if(p===null){u.end(!0);return}if(!(p instanceof r))try{p=r[u.responseDelimited?"decodeDelimited":"decode"](p)}catch(f){return u.emit("error",f,t),s(f)}return u.emit("data",p,t),s(null,p)})}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 fixNumber(n){return isNaN(n)||!isFinite(n)?0:n}function getGeometryMemoryUsed(n){var t=0;if(n instanceof THREE__namespace.BufferGeometry){for(var e in n.attributes){var r=n.getAttribute(e),o=4;"BYTES_PER_ELEMENT"in r.array&&typeof r.array.BYTES_PER_ELEMENT=="number"&&(o=r.array.BYTES_PER_ELEMENT),t+=fixNumber(r.count*r.itemSize*o)}var s=n.getIndex();if(s){var o=4;"BYTES_PER_ELEMENT"in s.array&&typeof s.array.BYTES_PER_ELEMENT=="number"&&(o=s.array.BYTES_PER_ELEMENT),t+=fixNumber(s.count*s.itemSize*o)}}else n instanceof THREE__namespace.Geometry&&(t+=fixNumber(n.faces.length*3*3*4),t+=fixNumber(n.faceVertexUvs.length*3*2*4));return t}function makeComputeBlockRectSizeFunction(n,t,e){return function(r,o,s){var u=(r+n-1)/n|0,l=(o+t-1)/t|0;return u*l*e*s}}function makeComputePaddedRectSizeFunction(n,t,e){return function(r,o,s){return(Math.max(r,n)*Math.max(o,t)/e|0)*s}}var compressedTextureFunctions=new Map([[THREE__namespace.RGB_S3TC_DXT1_Format,makeComputeBlockRectSizeFunction(4,4,8)],[THREE__namespace.RGBA_S3TC_DXT1_Format,makeComputeBlockRectSizeFunction(4,4,8)],[THREE__namespace.RGBA_S3TC_DXT3_Format,makeComputeBlockRectSizeFunction(4,4,16)],[THREE__namespace.RGBA_S3TC_DXT5_Format,makeComputeBlockRectSizeFunction(4,4,16)],[THREE__namespace.RGB_ETC1_Format,makeComputeBlockRectSizeFunction(4,4,8)],[THREE__namespace.RGB_PVRTC_4BPPV1_Format,makeComputePaddedRectSizeFunction(8,8,2)],[THREE__namespace.RGBA_PVRTC_4BPPV1_Format,makeComputePaddedRectSizeFunction(8,8,2)],[THREE__namespace.RGB_PVRTC_2BPPV1_Format,makeComputePaddedRectSizeFunction(16,8,4)],[THREE__namespace.RGBA_PVRTC_2BPPV1_Format,makeComputePaddedRectSizeFunction(16,8,4)],[THREE__namespace.RGB_ETC2_Format,makeComputeBlockRectSizeFunction(4,4,8)],[THREE__namespace.RGBA_ETC2_EAC_Format,makeComputeBlockRectSizeFunction(4,4,16)],[THREE__namespace.RGBA_ASTC_4x4_Format,makeComputeBlockRectSizeFunction(4,4,16)],[THREE__namespace.SRGB8_ALPHA8_ASTC_4x4_Format,makeComputeBlockRectSizeFunction(4,4,16)],[THREE__namespace.RGBA_ASTC_5x4_Format,makeComputeBlockRectSizeFunction(5,4,16)],[THREE__namespace.SRGB8_ALPHA8_ASTC_5x4_Format,makeComputeBlockRectSizeFunction(5,4,16)],[THREE__namespace.RGBA_ASTC_5x5_Format,makeComputeBlockRectSizeFunction(5,5,16)],[THREE__namespace.SRGB8_ALPHA8_ASTC_5x5_Format,makeComputeBlockRectSizeFunction(5,5,16)],[THREE__namespace.RGBA_ASTC_6x5_Format,makeComputeBlockRectSizeFunction(6,5,16)],[THREE__namespace.SRGB8_ALPHA8_ASTC_6x5_Format,makeComputeBlockRectSizeFunction(6,5,16)],[THREE__namespace.RGBA_ASTC_6x6_Format,makeComputeBlockRectSizeFunction(6,6,16)],[THREE__namespace.SRGB8_ALPHA8_ASTC_6x6_Format,makeComputeBlockRectSizeFunction(6,6,16)],[THREE__namespace.RGBA_ASTC_8x5_Format,makeComputeBlockRectSizeFunction(8,5,16)],[THREE__namespace.SRGB8_ALPHA8_ASTC_8x5_Format,makeComputeBlockRectSizeFunction(8,5,16)],[THREE__namespace.RGBA_ASTC_8x6_Format,makeComputeBlockRectSizeFunction(8,6,16)],[THREE__namespace.SRGB8_ALPHA8_ASTC_8x6_Format,makeComputeBlockRectSizeFunction(8,6,16)],[THREE__namespace.RGBA_ASTC_8x8_Format,makeComputeBlockRectSizeFunction(8,8,16)],[THREE__namespace.SRGB8_ALPHA8_ASTC_8x8_Format,makeComputeBlockRectSizeFunction(8,8,16)],[THREE__namespace.RGBA_ASTC_10x5_Format,makeComputeBlockRectSizeFunction(10,5,16)],[THREE__namespace.SRGB8_ALPHA8_ASTC_10x5_Format,makeComputeBlockRectSizeFunction(10,5,16)],[THREE__namespace.RGBA_ASTC_10x6_Format,makeComputeBlockRectSizeFunction(10,6,16)],[THREE__namespace.SRGB8_ALPHA8_ASTC_10x6_Format,makeComputeBlockRectSizeFunction(10,6,16)],[THREE__namespace.RGBA_ASTC_10x8_Format,makeComputeBlockRectSizeFunction(10,8,16)],[THREE__namespace.SRGB8_ALPHA8_ASTC_10x8_Format,makeComputeBlockRectSizeFunction(10,8,16)],[THREE__namespace.RGBA_ASTC_10x10_Format,makeComputeBlockRectSizeFunction(10,10,16)],[THREE__namespace.SRGB8_ALPHA8_ASTC_10x10_Format,makeComputeBlockRectSizeFunction(10,10,16)],[THREE__namespace.RGBA_ASTC_12x10_Format,makeComputeBlockRectSizeFunction(12,10,16)],[THREE__namespace.SRGB8_ALPHA8_ASTC_12x10_Format,makeComputeBlockRectSizeFunction(12,10,16)],[THREE__namespace.RGBA_ASTC_12x12_Format,makeComputeBlockRectSizeFunction(12,12,16)],[THREE__namespace.SRGB8_ALPHA8_ASTC_12x12_Format,makeComputeBlockRectSizeFunction(12,12,16)],[THREE__namespace.RGBA_BPTC_Format,makeComputeBlockRectSizeFunction(4,4,16)]]);function getTextureMemoryUsed(n){var t=0,e=1;(n.generateMipmaps===!0||n.mipmaps&&n.mipmaps.length>1)&&(e=1.33);for(var r=n instanceof THREE__namespace.CompressedTexture,o=r?compressedTextureFunctions.get(n.format):void 0,s=[].concat(n.image),u=0,l=s;u<l.length;u++){var c=l[u];if(c)if(c instanceof THREE__namespace.Texture)t+=getTextureMemoryUsed(c);else{var p=c.width,f=p===void 0?1:p,d=c.height,h=d===void 0?1:d,g=c.depth,A=g===void 0?1:g;o?t+=fixNumber(o(f,h,A)*e):t+=fixNumber(f*h*A*4*e)}}return t}var textureSet=new Set,textureNames=["map","alphaMap","bumpMap","normalMap","displacementMap","emissiveMap","specularMap","envMap","flipEnvMap","lightMap","aoMap","gradientMap","metalnessMap","roughnessMap","sheenColorMap","sheenRoughnessMap","clearcoatMap","clearcoatRoughnessMap","clearcoatNormalMap","iridescenceMap","iridescenceThicknessMap","transmissionMap","thicknessMap","anisotropyMap","specularColorMap","specularIntensityMap"];function getMaterialMemoryUsed(n){var t=0;if(textureSet.clear(),n instanceof THREE__namespace.ShaderMaterial)for(var e in n.uniforms){var r=n.uniforms[e],o=r&&r.value&&r.value instanceof THREE__namespace.Texture?r.value:void 0;o instanceof THREE__namespace.Texture&&(textureSet.has(o)||(t=getTextureMemoryUsed(o),textureSet.add(o)))}else for(var s=0,u=textureNames;s<u.length;s++){var l=u[s],o=n[l];o instanceof THREE__namespace.Texture&&(textureSet.has(o)||(t=getTextureMemoryUsed(o),textureSet.add(o)))}return textureSet.clear(),t}var sceneSet=new Set;function getMemoryUsage(n){var t=0;return sceneSet.clear(),n.traverse(function(e){if(e instanceof THREE__namespace.Mesh||e instanceof THREE__namespace.Line||e instanceof THREE__namespace.Points){var r=e.geometry;(r instanceof THREE__namespace.BufferGeometry||r instanceof THREE__namespace.Geometry)&&(sceneSet.has(r)||(t+=getGeometryMemoryUsed(r),sceneSet.add(r)));for(var o=[].concat(e.material),s=0,u=o;s<u.length;s++){var l=u[s];l instanceof THREE__namespace.Material&&(sceneSet.has(l)||(t+=getMaterialMemoryUsed(l),sceneSet.add(l)))}}}),sceneSet.clear(),t}function loadPbm(n,t){var e,r,o,s,u;t===void 0&&(t={});var l=(e=t.upAxis)!==null&&e!==void 0?e:"Z",c=(r=t.fetcher)!==null&&r!==void 0?r:new Fetcher({allowHosts:["*"]}),p={byteLength:0},f=autoRestImageOptionsByTextureLength((o=t.textureOptions)!==null&&o!==void 0?o:{},(u=(s=t.textureArray)===null||s===void 0?void 0:s.length)!==null&&u!==void 0?u:0),d={};if(t.textureArray)for(var h=0,g=t.textureArray;h<g.length;h++){var A=g[h];d[A]=loadTexture$1(A,f,c)}return Promise.resolve().then(function(){return c.ajax(n,{responseType:"arraybuffer"})}).then(function(m){return p.byteLength=m.body.byteLength,delay(function(){var E=new Uint8Array(m.body);return Model$2.decode(E)})}).then(function(m){return delay(function(){var E,v,y;return parse$4(m,(E=t.light)!==null&&E!==void 0?E:!1,(v=t.textureBaseUri)!==null&&v!==void 0?v:function(){var b=n.lastIndexOf("/");if(b>=0){var T=n.slice(0,b)+"/";return/\/model\/$/.test(T)&&(T=T.replace(/\/model\/$/,"/materials/")),T}return""}(),((y=t.textureArray)!==null&&y!==void 0?y:[]).slice(),f,d,c)})}).then(function(m){var E=new THREE__namespace.Group;E.name=n;for(var v=0,y=m.objects;v<y.length;v++){var b=y[v];E.add(b)}return l==="Y"&&E.applyMatrix4(ROTATE_X_MATRIX_INVERSE),{type:"pbm",modelUpAxis:"Z",upAxis:l,uri:n,byteLength:p.byteLength,memoryUsage:getMemoryUsage(E),scene:E,textures:m.textures,animations:[],dispose:function(){return m.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,p=0,f=n.chunks;p<f.length;p++){var d=f[p];if(!d.vertices.marks||d.vertices.marks.length===0){c=!1;break}}for(var h=0,g=n.chunks;h<g.length;h++){var d=g[h];if(!d.faces.normals||d.faces.normals.length===0){l=!1;break}}for(var A=n.chunks.sort(function(se,ce){return chunkOrder(se)-chunkOrder(ce)}),m=[],E=0,v=A;E<v.length;E++){var d=v[E],y=parseFloorName(d.name);m[y]||(m[y]=[]),m[y].push(d)}for(var b=0;b<m.length;b++){var T=m[b];if(T)if(l){for(var _=0,S=0;S<T.length;S++){var d=T[S];_+=d.faces.indices.length}for(var R=new Float32Array(_*3),M=new Float32Array(_*2),H=new Float32Array(_*3),B=c?new Float32Array(_):void 0,C=[],w=[1/0,1/0,1/0,-1/0,-1/0,-1/0],I=0,O=0;O<T.length;O++){for(var L=[1/0,1/0,1/0,-1/0,-1/0,-1/0],d=T[O],N=d.vertices.xyz,z=d.vertices.uvs,J=d.faces.indices,G=d.faces.normals,Q=d.vertices.marks,U=J.length,S=0;S<U;S++){var q=J[S],K=R[I*3+S*3]=N[q*3],Y=R[I*3+S*3+1]=N[q*3+1],Z=R[I*3+S*3+2]=N[q*3+2];B&&(B[I+S]=Q[q]),M[I*2+S*2]=z[q*2],M[I*2+S*2+1]=z[q*2+1];var te=Math.floor(S/3)*3;H[I*3+S*3]=G[te],H[I*3+S*3+1]=G[te+1],H[I*3+S*3+2]=G[te+2],K<L[0]&&(L[0]=K),Y<L[1]&&(L[1]=Y),Z<L[2]&&(L[2]=Z),K>L[3]&&(L[3]=K),Y>L[4]&&(L[4]=Y),Z>L[5]&&(L[5]=Z)}L[0]<w[0]&&(w[0]=L[0]),L[1]<w[1]&&(w[1]=L[1]),L[2]<w[2]&&(w[2]=L[2]),L[3]>w[3]&&(w[3]=L[3]),L[4]>w[4]&&(w[4]=L[4]),L[5]>w[5]&&(w[5]=L[5]),C.push({materialIndex:O,name:d.name,chunkName:parseChunkName(d.name),start:I,count:d.faces.indices.length,texture:(e=d.texture)!==null&&e!==void 0?e:void 0}),I+=U}var j={createAt:o,description:s,vertices:R,uvs:M,normals:H,masks:B,indices:null,floorIndex:b,groups:C,extents:w};u.push(j)}else{for(var _=0,ee=0,S=0;S<T.length;S++){var d=T[S];ee+=d.vertices.xyz.length/3,_+=d.faces.indices.length}for(var R=new Float32Array(ee*3),M=new Float32Array(ee*2),H=void 0,W=new Float32Array(ee),re=new Uint32Array(_),B=c?new Float32Array(_):void 0,C=[],w=[1/0,1/0,1/0,-1/0,-1/0,-1/0],le=0,I=0,O=0;O<T.length;O++){for(var L=[1/0,1/0,1/0,-1/0,-1/0,-1/0],d=T[O],N=d.vertices.xyz,ae=d.vertices.marks,z=d.vertices.uvs,J=d.faces.indices,oe=N.length/3,U=J.length,S=0;S<oe;S++){var K=R[I*3+S*3]=N[S*3],Y=R[I*3+S*3+1]=N[S*3+1],Z=R[I*3+S*3+2]=N[S*3+2];B&&(B[I+S]=ae[S]),M[I*2+S*2]=z[S*2],M[I*2+S*2+1]=z[S*2+1],W[I+S]=b,K<L[0]&&(L[0]=K),Y<L[1]&&(L[1]=Y),Z<L[2]&&(L[2]=Z),K>L[3]&&(L[3]=K),Y>L[4]&&(L[4]=Y),Z>L[5]&&(L[5]=Z)}L[0]<w[0]&&(w[0]=L[0]),L[1]<w[1]&&(w[1]=L[1]),L[2]<w[2]&&(w[2]=L[2]),L[3]>w[3]&&(w[3]=L[3]),L[4]>w[4]&&(w[4]=L[4]),L[5]>w[5]&&(w[5]=L[5]);for(var S=0;S<U;S++)re[le+S]=I+J[S];C.push({materialIndex:O,name:d.name,chunkName:parseChunkName(d.name),start:le,count:d.faces.indices.length,texture:(r=d.texture)!==null&&r!==void 0?r:void 0}),I+=oe,le+=U}var j={createAt:o,description:s,vertices:R,uvs:M,normals:H,masks:B,indices:re,floorIndex:b,groups:C,extents:w};u.push(j)}}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,u){s===void 0&&(s={});for(var l=parsePBMModel(n),c=0,p="",f=[],d={},h=new Set,g=0,A=0,m=l;A<m.length;A++){var E=m[A],v=E.createAt,y=E.description,b=E.vertices,T=E.masks,_=E.uvs,S=E.normals,R=E.indices,M=E.floorIndex,H=E.groups,B=E.extents,C=new THREE__namespace.Box3;C.min.x=B[0],C.min.y=B[1],C.min.z=B[2],C.max.x=B[3],C.max.y=B[4],C.max.z=B[5];var w=new THREE__namespace.BufferGeometry;w.setAttribute("position",new THREE__namespace.BufferAttribute(b,3)),w.setAttribute("uv",new THREE__namespace.BufferAttribute(_,2)),S&&w.setAttribute("normal",new THREE__namespace.BufferAttribute(S,3)),T&&w.setAttribute("_feature_id_rsmask",new THREE__namespace.BufferAttribute(T,1)),R&&w.setIndex(new THREE__namespace.BufferAttribute(R,1)),w.boundingBox=C,w.boundingSphere=C.getBoundingSphere(new THREE__namespace.Sphere);for(var I=0,O=H;I<O.length;I++){var L=O[I];w.addGroup(L.start,L.count,L.materialIndex)}h.add(w);for(var N=[],z=0,J=H;z<J.length;z++){var L=J[z],G=r[L.chunkName]||(L.texture?pathJoin(e||"",L.texture):void 0),Q=new PBMMeshMaterial(t?"phong":"basic");Q.floorIndex=M,w.attributes.normal===void 0&&(Q.flatShading=!0),w.attributes._feature_id_rsmask&&(Q.defines.USE_VERTEX_MARK=!0),N.push(Q),G?(g++,d[G]?d[G].push(Q):d[G]=[Q]):Q.color=new THREE__namespace.Color(16777215),h.add(Q)}var U=new PBMMesh(w,N);U.name="model_floor_"+M,U.userData.createAt=v,U.userData.description=y,U.matrix.compose(U.position,U.quaternion,U.scale),U.matrixAutoUpdate=!1,U.frustumCulled=!1,c=v,p=y,f.push(U)}var q=function(K){K=autoRestImageOptionsByTextureLength(K,g);for(var Y=[],Z=function(W){var re=null;W in s&&(re=s[W]),re||(re=loadTexture$1(W,K,u)),Y.push(re.then(function(le){for(var ae=0,oe=d[W];ae<oe.length;ae++){var se=oe[ae];se.map&&(h.delete(se.map),se.map.dispose()),se.map=le,h.add(le)}return le}).catch(function(){for(var le=0,ae=d[W];le<ae.length;le++){var oe=ae[le];oe.map&&(h.delete(oe.map),oe.map.dispose()),oe.map=null,oe.color=new THREE__namespace.Color(16777215)}return null}))},te=0,j=Object.keys(d);te<j.length;te++){var ee=j[te];Z(ee)}for(var ee in s)delete s[ee];return Promise.all(Y).then(function(W){return W.filter(function(re){return re})})};return q(o).then(function(K){return{createAt:c,description:p,objects:f,textures:K,dispose:function(){h.forEach(function(Y){Y.dispose()}),h.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 createLZMA(){var n={};return n.OutWindow=function(){this._windowSize=0},n.OutWindow.prototype.create=function(t){(!this._buffer||this._windowSize!==t)&&(this._buffer=[]),this._windowSize=t,this._pos=0,this._streamPos=0},n.OutWindow.prototype.flush=function(){var t=this._pos-this._streamPos;if(t!==0){for(;t--;)this._stream.writeByte(this._buffer[this._streamPos++]);this._pos>=this._windowSize&&(this._pos=0),this._streamPos=this._pos}},n.OutWindow.prototype.releaseStream=function(){this.flush(),this._stream=null},n.OutWindow.prototype.setStream=function(t){this.releaseStream(),this._stream=t},n.OutWindow.prototype.init=function(t){t||(this._streamPos=0,this._pos=0)},n.OutWindow.prototype.copyBlock=function(t,e){var r=this._pos-t-1;for(r<0&&(r+=this._windowSize);e--;)r>=this._windowSize&&(r=0),this._buffer[this._pos++]=this._buffer[r++],this._pos>=this._windowSize&&this.flush()},n.OutWindow.prototype.putByte=function(t){this._buffer[this._pos++]=t,this._pos>=this._windowSize&&this.flush()},n.OutWindow.prototype.getByte=function(t){var e=this._pos-t-1;return e<0&&(e+=this._windowSize),this._buffer[e]},n.RangeDecoder=function(){},n.RangeDecoder.prototype.setStream=function(t){this._stream=t},n.RangeDecoder.prototype.releaseStream=function(){this._stream=null},n.RangeDecoder.prototype.init=function(){var t=5;for(this._code=0,this._range=-1;t--;)this._code=this._code<<8|this._stream.readByte()},n.RangeDecoder.prototype.decodeDirectBits=function(t){for(var e=0,r=t,o;r--;)this._range>>>=1,o=this._code-this._range>>>31,this._code-=this._range&o-1,e=e<<1|1-o,this._range&4278190080||(this._code=this._code<<8|this._stream.readByte(),this._range<<=8);return e},n.RangeDecoder.prototype.decodeBit=function(t,e){var r=t[e],o=(this._range>>>11)*r;return(this._code^2147483648)<(o^2147483648)?(this._range=o,t[e]+=2048-r>>>5,this._range&4278190080||(this._code=this._code<<8|this._stream.readByte(),this._range<<=8),0):(this._range-=o,this._code-=o,t[e]-=r>>>5,this._range&4278190080||(this._code=this._code<<8|this._stream.readByte(),this._range<<=8),1)},n.initBitModels=function(t,e){for(;e--;)t[e]=1024},n.BitTreeDecoder=function(t){this._models=[],this._numBitLevels=t},n.BitTreeDecoder.prototype.init=function(){n.initBitModels(this._models,1<<this._numBitLevels)},n.BitTreeDecoder.prototype.decode=function(t){for(var e=1,r=this._numBitLevels;r--;)e=e<<1|t.decodeBit(this._models,e);return e-(1<<this._numBitLevels)},n.BitTreeDecoder.prototype.reverseDecode=function(t){for(var e=1,r=0,o=0,s;o<this._numBitLevels;++o)s=t.decodeBit(this._models,e),e=e<<1|s,r|=s<<o;return r},n.reverseDecode2=function(t,e,r,o){for(var s=1,u=0,l=0,c;l<o;++l)c=r.decodeBit(t,e+s),s=s<<1|c,u|=c<<l;return u},n.LenDecoder=function(){this._choice=[],this._lowCoder=[],this._midCoder=[],this._highCoder=new n.BitTreeDecoder(8),this._numPosStates=0},n.LenDecoder.prototype.create=function(t){for(;this._numPosStates<t;++this._numPosStates)this._lowCoder[this._numPosStates]=new n.BitTreeDecoder(3),this._midCoder[this._numPosStates]=new n.BitTreeDecoder(3)},n.LenDecoder.prototype.init=function(){var t=this._numPosStates;for(n.initBitModels(this._choice,2);t--;)this._lowCoder[t].init(),this._midCoder[t].init();this._highCoder.init()},n.LenDecoder.prototype.decode=function(t,e){return t.decodeBit(this._choice,0)===0?this._lowCoder[e].decode(t):t.decodeBit(this._choice,1)===0?8+this._midCoder[e].decode(t):16+this._highCoder.decode(t)},n.Decoder2=function(){this._decoders=[]},n.Decoder2.prototype.init=function(){n.initBitModels(this._decoders,768)},n.Decoder2.prototype.decodeNormal=function(t){var e=1;do e=e<<1|t.decodeBit(this._decoders,e);while(e<256);return e&255},n.Decoder2.prototype.decodeWithMatchByte=function(t,e){var r=1,o,s;do if(o=e>>7&1,e<<=1,s=t.decodeBit(this._decoders,(1+o<<8)+r),r=r<<1|s,o!==s){for(;r<256;)r=r<<1|t.decodeBit(this._decoders,r);break}while(r<256);return r&255},n.LiteralDecoder=function(){},n.LiteralDecoder.prototype.create=function(t,e){var r;if(!(this._coders&&this._numPrevBits===e&&this._numPosBits===t))for(this._numPosBits=t,this._posMask=(1<<t)-1,this._numPrevBits=e,this._coders=[],r=1<<this._numPrevBits+this._numPosBits;r--;)this._coders[r]=new n.Decoder2},n.LiteralDecoder.prototype.init=function(){for(var t=1<<this._numPrevBits+this._numPosBits;t--;)this._coders[t].init()},n.LiteralDecoder.prototype.getDecoder=function(t,e){return this._coders[((t&this._posMask)<<this._numPrevBits)+((e&255)>>>8-this._numPrevBits)]},n.Decoder=function(){this._outWindow=new n.OutWindow,this._rangeDecoder=new n.RangeDecoder,this._isMatchDecoders=[],this._isRepDecoders=[],this._isRepG0Decoders=[],this._isRepG1Decoders=[],this._isRepG2Decoders=[],this._isRep0LongDecoders=[],this._posSlotDecoder=[],this._posDecoders=[],this._posAlignDecoder=new n.BitTreeDecoder(4),this._lenDecoder=new n.LenDecoder,this._repLenDecoder=new n.LenDecoder,this._literalDecoder=new n.LiteralDecoder,this._dictionarySize=-1,this._dictionarySizeCheck=-1,this._posSlotDecoder[0]=new n.BitTreeDecoder(6),this._posSlotDecoder[1]=new n.BitTreeDecoder(6),this._posSlotDecoder[2]=new n.BitTreeDecoder(6),this._posSlotDecoder[3]=new n.BitTreeDecoder(6)},n.Decoder.prototype.setDictionarySize=function(t){return t<0?!1:(this._dictionarySize!==t&&(this._dictionarySize=t,this._dictionarySizeCheck=Math.max(this._dictionarySize,1),this._outWindow.create(Math.max(this._dictionarySizeCheck,4096))),!0)},n.Decoder.prototype.setLcLpPb=function(t,e,r){var o=1<<r;return t>8||e>4||r>4?!1:(this._literalDecoder.create(e,t),this._lenDecoder.create(o),this._repLenDecoder.create(o),this._posStateMask=o-1,!0)},n.Decoder.prototype.init=function(){var t=4;for(this._outWindow.init(!1),n.initBitModels(this._isMatchDecoders,192),n.initBitModels(this._isRep0LongDecoders,192),n.initBitModels(this._isRepDecoders,12),n.initBitModels(this._isRepG0Decoders,12),n.initBitModels(this._isRepG1Decoders,12),n.initBitModels(this._isRepG2Decoders,12),n.initBitModels(this._posDecoders,114),this._literalDecoder.init();t--;)this._posSlotDecoder[t].init();this._lenDecoder.init(),this._repLenDecoder.init(),this._posAlignDecoder.init(),this._rangeDecoder.init()},n.Decoder.prototype.decode=function(t,e,r){var o=0,s=0,u=0,l=0,c=0,p=0,f=0,d,h,g,A,m,E;for(this._rangeDecoder.setStream(t),this._outWindow.setStream(e),this.init();r<0||p<r;)if(d=p&this._posStateMask,this._rangeDecoder.decodeBit(this._isMatchDecoders,(o<<4)+d)===0)h=this._literalDecoder.getDecoder(p++,f),o>=7?f=h.decodeWithMatchByte(this._rangeDecoder,this._outWindow.getByte(s)):f=h.decodeNormal(this._rangeDecoder),this._outWindow.putByte(f),o=o<4?0:o-(o<10?3:6);else{if(this._rangeDecoder.decodeBit(this._isRepDecoders,o)===1)g=0,this._rangeDecoder.decodeBit(this._isRepG0Decoders,o)===0?this._rangeDecoder.decodeBit(this._isRep0LongDecoders,(o<<4)+d)===0&&(o=o<7?9:11,g=1):(this._rangeDecoder.decodeBit(this._isRepG1Decoders,o)===0?A=u:(this._rangeDecoder.decodeBit(this._isRepG2Decoders,o)===0?A=l:(A=c,c=l),l=u),u=s,s=A),g===0&&(g=2+this._repLenDecoder.decode(this._rangeDecoder,d),o=o<7?8:11);else if(c=l,l=u,u=s,g=2+this._lenDecoder.decode(this._rangeDecoder,d),o=o<7?7:10,m=this._posSlotDecoder[g<=5?g-2:3].decode(this._rangeDecoder),m>=4){if(E=(m>>1)-1,s=(2|m&1)<<E,m<14)s+=n.reverseDecode2(this._posDecoders,s-m-1,this._rangeDecoder,E);else if(s+=this._rangeDecoder.decodeDirectBits(E-4)<<4,s+=this._posAlignDecoder.reverseDecode(this._rangeDecoder),s<0){if(s===-1)break;return!1}}else s=m;if(s>=p||s>=this._dictionarySizeCheck)return!1;this._outWindow.copyBlock(s,g),p+=g,f=this._outWindow.getByte(0)}return this._outWindow.flush(),this._outWindow.releaseStream(),this._rangeDecoder.releaseStream(),!0},n.Decoder.prototype.setDecoderProperties=function(t){var e,r,o,s,u;return t.size<5||(e=t.readByte(),r=e%9,e=~~(e/9),o=e%5,s=~~(e/5),!this.setLcLpPb(r,o,s))?!1:(u=t.readByte(),u|=t.readByte()<<8,u|=t.readByte()<<16,u+=t.readByte()*16777216,this.setDictionarySize(u))},n.decompress=function(t,e,r,o){var s=new n.Decoder;if(!s.setDecoderProperties(t))throw"Incorrect stream properties";if(!s.decode(e,r,o))throw"Error in data stream";return!0},n.decompressFile=function(t,e){var r=new n.Decoder,o;if(!r.setDecoderProperties(t))throw"Incorrect stream properties";if(o=t.readByte(),o|=t.readByte()<<8,o|=t.readByte()<<16,o+=t.readByte()*16777216,t.readByte(),t.readByte(),t.readByte(),t.readByte(),!r.decode(t,e,o))throw"Error in data stream";return!0},n}var LZMA=createLZMA();function createWASM(){function n(e){for(var r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=new Uint8Array(256),s=0;s<r.length;s++)o[r.charCodeAt(s)]=s;var u=e.length*.75,l=e.length,c,p=0,f,d,h,g;e[e.length-1]==="="&&(u--,e[e.length-2]==="="&&u--);var A=new ArrayBuffer(u),m=new Uint8Array(A);for(c=0;c<l;c+=4)f=o[e.charCodeAt(c)],d=o[e.charCodeAt(c+1)],h=o[e.charCodeAt(c+2)],g=o[e.charCodeAt(c+3)],m[p++]=f<<2|d>>4,m[p++]=(d&15)<<4|h>>2,m[p++]=(h&3)<<6|g&63;return A}var t="AGFzbQEAAAABSg1gAABgAX8Bf2ACf38Bf2AEf39/fwBgA39/fwBgAX8AYAJ/fwBgA39/fwF/YAR/f39/AX9gAn9/AGABfwF/YAABf2AEf39/fwF/AhsCA2VudgVhYm9ydAADA2VudgZtZW1vcnkCAAEDJiUBAQkKAgoKCwsLCwsAAgoBAgQKAQYFCAoFBQQEBwgCBwwCAQAABAQBcAABBhoFfwFBAAt/AUEAC38BQQALfwFBAAt/AUEACwc9BgZtZW1vcnkCAAV0YWJsZQEABXJlc2V0AA0KbmV3VThBcnJheQAQCnVucGFja1NpemUAFAZkZWNvZGUAIwgBJAkHAQBBAAsBJQqAViVoAQN/IABBgICAgARLBEAACyMBIgEgAEEBIABBAUsbakEHakF4cSICPwAiA0EQdEsEQCADIAIgAWtB//8DakGAgHxxQRB2IgAgAyAAShtAAEEASARAIABAAEEASARAAAsLCyACJAEgAQsbAQF/QQFBICAAQQdqZ2t0EAEiASAANgIAIAELkQMBAX8gAUUEQA8LIABBADoAACAAIAFqQQFrQQA6AAAgAUECTQRADwsgAEEBakEAOgAAIABBAmpBADoAACAAIAFqIgJBAmtBADoAACACQQNrQQA6AAAgAUEGTQRADwsgAEEDakEAOgAAIAAgAWpBBGtBADoAACABQQhNBEAPC0EAIABrQQNxIgIgAGoiAEEANgIAIAEgAmtBfHEiASAAakEEa0EANgIAIAFBCE0EQA8LIABBBGpBADYCACAAQQhqQQA2AgAgACABaiICQQxrQQA2AgAgAkEIa0EANgIAIAFBGE0EQA8LIABBDGpBADYCACAAQRBqQQA2AgAgAEEUakEANgIAIABBGGpBADYCACAAIAFqIgJBHGtBADYCACACQRhrQQA2AgAgAkEUa0EANgIAIAJBEGtBADYCACAAQQRxQRhqIgIgAGohACABIAJrIQEDQCABQSBPBEAgAEIANwMAIABBCGpCADcDACAAQRBqQgA3AwAgAEEYakIANwMAIAFBIGshASAAQSBqIQAMAQsLC1EBA38gAEH+////AEsEQEEAQSBBLUEnEAAACyAAQQJ0IgMQAiECQQgQASIBQQA2AgAgAUEANgIEIAEgAjYCACABIAA2AgQgAkEIaiADEAMgAQtmAQF/IAFB/P///wFLBEBBAEHAAEEXQSIQAAALIAFBAXQiARACIgJBCGogARADIABFBEBBDBABIQALIABBADYCACAAQQA2AgQgAEEANgIIIAAgAjYCACAAQQA2AgQgACABNgIIIAALCgBBDBABIAAQBQsuAQF/QQgQASIBQQA2AgAgAUEANgIEIAEgADYCBCABQQEgASgCBHQQBjYCACABC6EBAQR/QRAQASIBQQA2AgAgAUEANgIEIAFBADYCCCABQQA2AgxBEBAEIQIDQCAAQRBIBEBBAxAHIQMgAigCACAAQQJ0aiADNgIIIABBAWohAAwBCwsgASACNgIEQRAQBCECQQAhAANAIABBEEgEQEEDEAchAyACKAIAIABBAnRqIAM2AgggAEEBaiEADAELCyABIAI2AgggAUEIEAc2AgwgAQs0AQF/QRQQASIAQQA2AgAgAEEAOgAEIABBADYCCCAAQQA2AgwgAEEANgIQIABBDTYCCCAAC0IBAX9BGRABIgBBADYCACAAQQA2AgQgAEEANgIIIABBADYCDCAAQQA2AhAgAEEANgIUIABBADoAGCAAQQA2AhAgAAu1AgEEf0HQABABIgBBADoAACAAQQA2AgQgAEEANgIIIABBADYCDCAAQQA2AhAgAEEAOgAUIABBADYCGCAAQQA2AhwgAEEANgIgIABBADYCJCAAQQA2AiggAEEANgIsIABBADYCMCAAQQA2AjQgAEEANgI4IABBADYCPCAAQQA2AkAgAEEANgJEIABBADYCSCAAQQA2AkxBBBAEIQIDQCABQQRIBEBBBhAHIQMgAigCACABQQJ0aiADNgIIIAFBAWohAQwBCwsgACACNgIkIABBBBAHNgIoIABB8wAQBjYCLCAAQcABEAY2AjAgAEEMEAY2AjQgAEEMEAY2AjggAEEMEAY2AjwgAEEMEAY2AkAgAEHAARAGNgJEIAAQCDYCSCAAEAg2AkwgABAJNgIEIAAQCjYCCCAACx8BAX9BCBABIgBBADYCACAAQQA2AgQgABALNgIAIAALCgAjACQBEAwkAwthAQF/IAFB+P///wNLBEBBAEHAAEEXQSIQAAALIAEQAiICQQhqIAEQAyAARQRAQQwQASEACyAAQQA2AgAgAEEANgIEIABBADYCCCAAIAI2AgAgAEEANgIEIAAgATYCCCAACwoAQQwQASAAEA4LBgAgABAPCyoAIAEgACgCCE8EQEEAQcAAQSdBPxAAAAsgACgCBCABIAAoAgBqai0ACAssACABIAAoAghPBEBBAEHAAEEyQT8QAAALIAAoAgQgASAAKAIAamogAjoACAtkAQJ/QQ0QDyECA0AgAUENSARAIAIgASAAIAEQEUH/AXEQEiABQQFqIQEMAQsLQQAhAEEAIQEDQCABQQhIBEAgAiABQQVqEBFB/wFxIAFBA3R0IAByIQAgAUEBaiEBDAELCyAACwYAIAAQEwsnACAAIAEQDzYCCCAAQQA2AgwgACABNgIUIABBADoAGCAAQQA2AgALJAAgACgCCCAAKAIYEBUgAEGABiAAKAIMIAAtABRqdBAGNgIgC5UBAQR/IAEhBSAAIgYoAgAhASAAKAIEIQcgACgCCEEBdiEEIAJBAEgEfyACIARqIgBBACAAQQBKGwUgAiIAIAQgACAESBsLIQIgA0EASAR/IAMgBGoiAEEAIABBAEobBSADIgAgBCAAIARIGwshAwNAIAIgA05FBEAgAkEBdCABaiAHaiAFOwEIIAJBAWohAgwBCwsgBgssAQF/AkACQAJAIwRBAWsOAwEBAgALAAtB/////wchAQsgAEGACEEAIAEQFwvBAQECfyAAQQIQBjYCACAAKAIAIgEoAgAgASgCBGpBgAg7AQggACgCACICKAIAIQEgAigCBCABQQJqakGACDsBCCAAKAIMKAIAQQEkBBAYGkEAIQIDQCACQRBIBEAgAiAAKAIEKAIAIgEoAgBBAnZJBH8gAkECdCABaigCCAUACygCAEEBJAQQGBogAiAAKAIIKAIAIgEoAgBBAnZJBH8gAkECdCABaigCCAUACygCAEEBJAQQGBogAkEBaiECDAELCwuHAgEFfyAAIQJBgAYgACgCDCAALQA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CACIQZBBBAPIgIoAgQgAigCAGogBigCBCAGKAIAai0ACCIDOgAIIANB/wFxQeEBTwRAQQBBgAFBoQFBDBAAAAsgAigCBCACKAIAQQFqaiADQf8BcUEJcCIHOgAIIAIoAgQgAigCAGogA0H/AXFBCW4iAzoACCADQQVwIQUgAigCBCACKAIAQQJqaiADQQVuIgM6AAggAigCBCACKAIAQQNqaiAFOgAIIAQgBzYCDCAEIAM2AhAgBCAFOgAUIARBADYCHEEAIQIDQAJAIAJBBE8NACAEIAQoAhwgBigCBCAGKAIAIAJBAWpqai0ACCACQQN0dHI2AhwgAkEBaiECDAELCyAEIAQoAhw2AhggBCgCGEGAIEkEQCAEQYAgNgIYC0EAIQJBACEFQQAhAwNAAkAgA0EITg0AIAYgA0EFahARQf8BcSIEQf8BRwRAQQEhBQsgBCADQQN0dCACciECIANBAWohAwwBCwsgACgCACAFRToAACAAKAIAKAIEIAE2AgAgACgCABAWAkAgACgCACAFIAIQICIBQQFGDQAgAUEDRwRAIAFBAkYEQCAFBEAgACgCACgCCCgCECACRw0DCwUMAgsLIAAoAgAoAgQtAAQaQQFBACAAKAIAKAIIKAIQIAAoAgAoAggoAgQQIQ8LQQBBAUEAQQAQIQsIACMDIAAQIgsWAEG4ASQAIwAkAUGAgIAIJAIQDCQDCwMAAQsLtwEEAEEICxcKAAAAdQBzAGUAIABzAHQAcgBpAGMAdABBIAsdDQAAAH4AbABpAGIALwBhAHIAcgBhAHkALgB0AHMAQcAACzkbAAAAfgBsAGkAYgAvAGkAbgB0AGUAcgBuAGEAbAAvAHQAeQBwAGUAZABhAHIAcgBhAHkALgB0AHMAQYABCzMYAAAAcwByAGMALwBsAHoAbQBhAC8AbAB6AG0AYQAtAGQAZQBjAG8AZABlAHIALgB0AHM=";return n(t)}function decodeLZMA(n,t,e){try{var r={data:t,offset:0,readByte:function(){return this.data[this.offset++]}},o=r.data.length,s={data:[],offset:0,writeByte:function(c){var p=Math.floor(this.offset/o);this.data[p]||(this.data[p]=new Uint8Array(o)),this.data[p][this.offset%o]=c,this.offset++}};n.decompressFile(r,s);for(var u=new Uint8Array(s.offset),l=0;l<s.offset;l++)u[l]=s.data[Math.floor(l/o)][l%o];e(null,u)}catch(c){e(c)}}function decodeLZMAWithWASM(n,t,e){var r=24;try{var o=new WebAssembly.Memory({initial:16}),s=new WebAssembly.Module(n),u=new WebAssembly.Instance(s,{env:{memory:o,abort:function(){e(new Error("webAssembly abort"))}}}),l=u.exports,c=l.newU8Array(t.length),p=new Uint8Array(o.buffer,c+r,t.length);p.set(t);var f=l.decode(c),d=new Uint32Array(o.buffer,f,4),h=d[0],g=d[2],A=d[3];h?e(null,new Uint8Array(o.buffer,A+r,g).slice(0,g)):e(new Error("lzma deocder error"))}catch(m){e(m)}}var lzmaWorkerSource=`
|
|
406
406
|
var decodeLZMA = (function() {
|
|
407
407
|
var LZMA = (`.concat(createLZMA.toString(),`)();
|
|
408
408
|
return function(data, callback) {
|
|
@@ -447,7 +447,7 @@ self.onmessage = function(event) {
|
|
|
447
447
|
}
|
|
448
448
|
postMessage({ id: packet.id, error: "type never matched." });
|
|
449
449
|
};
|
|
450
|
-
`),support=typeof Worker!="undefined"&&typeof Blob!="undefined",lzmaWorkerURL="";if(support)try{var blob$2=new Blob([lzmaWorkerSource],{type:"text/javascript"});lzmaWorkerURL=URL.createObjectURL(blob$2)}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,p={data:[],offset:0,writeByte:function(d){var h=Math.floor(this.offset/c);this.data[h]||(this.data[h]=new Uint8Array(c)),this.data[h][this.offset%c]=d,this.offset++}};LZMA.decompressFile(l,p),o=new Uint8Array(p.offset);for(var f=0;f<p.offset;f++)o[f]=p.data[Math.floor(f/c)][f%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(p,f){if(c.terminate(),p)return l(p);u(f)})}))},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))}function loadAt3d(n,t){var e,r,o,s,u;t===void 0&&(t={});var l=(e=t.upAxis)!==null&&e!==void 0?e:"Z",c=(r=t.fetcher)!==null&&r!==void 0?r:new Fetcher({allowHosts:["*"]}),p={byteLength:0},f=autoRestImageOptionsByTextureLength((o=t.textureOptions)!==null&&o!==void 0?o:{},(u=(s=t.textureArray)===null||s===void 0?void 0:s.length)!==null&&u!==void 0?u:0),d={};if(t.textureArray)for(var h=0,g=t.textureArray;h<g.length;h++){var A=g[h];d[A]=loadTexture$1(A,f,c)}return Promise.resolve().then(function(){return c.ajax(n,{responseType:"arraybuffer"})}).then(function(m){return lzma(m.body)}).then(function(m){return delay(function(){for(var E,v={chunks:[],createAt:void 0,description:void 0},y=0,b=m;y<b.length;y++){var T=b[y],_=Model$2.decode(T);_.chunks.length&&((E=v.chunks).push.apply(E,_.chunks),v.createAt=_.createAt,v.description=_.description)}return v})}).then(function(m){return delay(function(){var E,v,y,b;return parse$4(m,(E=t.light)!==null&&E!==void 0?E:!1,(v=t.textureBaseUri)!==null&&v!==void 0?v:function(){var T=n.lastIndexOf("/");if(T>=0){var _=n.slice(0,T)+"/";return/\/model\/$/.test(_)&&(_=_.replace(/\/model\/$/,"/materials/")),_}return""}(),((y=t.textureArray)!==null&&y!==void 0?y:[]).slice(),(b=t.textureOptions)!==null&&b!==void 0?b:{},d,c)})}).then(function(m){var E=new THREE__namespace.Group;E.name=n;for(var v=0,y=m.objects;v<y.length;v++){var b=y[v];E.add(b)}return l==="Y"&&E.applyMatrix4(ROTATE_X_MATRIX_INVERSE),{type:"at3d",modelUpAxis:"Z",upAxis:l,uri:n,byteLength:p.byteLength,memoryUsage:getMemoryUsage(E),scene:E,textures:m.textures,animations:[],dispose:function(){return m.dispose()}}})}function isAbsoluteURL(n){return n.indexOf("//")===0||/^[0-9a-z]+\:/i.test(n)}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})();function loadDome(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={byteLength:0};return Promise.resolve().then(function(){return s.ajax(n,{responseType:"arraybuffer"})}).then(function(l){var c,p;return u.byteLength=l.body.byteLength,parse$3(new Uint8Array(l.body),(c=t.light)!==null&&c!==void 0?c:!0,t.textureBaseUri||"",(p=t.textureOptions)!==null&&p!==void 0?p:{},s)}).then(function(l){var c=new THREE__namespace.Group;c.matrixAutoUpdate=!1,o==="Z"&&c.applyMatrix4(ROTATE_X_MATRIX),c.matrix.compose(c.position,c.quaternion,c.scale),c.name=n;for(var p=0,f=l.objects;p<f.length;p++){var d=f[p];c.add(d)}return{type:"dome",modelUpAxis:"Y",upAxis:o,uri:n,byteLength:u.byteLength,memoryUsage:getMemoryUsage(c),scene:c,textures:l.textures,animations:[],dispose:function(){return l.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 p=c[l];u.addGroup(p.start,p.count,p.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(p){var f=p.body;return r&&f.repeat.copy(r),f.needsUpdate=!0,f.updateMatrix(),f});return c}function parseMaterial(n,t,e,r,o,s,u,l,c){var p=[],f=new PBMMeshMaterial(t?"phong":"basic");if(l.add(f),n.kd&&(f.color=new THREE__namespace.Color().fromArray(n.kd.rgb).convertLinearToSRGB()),n.mapkd){var d=null;if(n.mapkdrepeat){var h=n.mapkdrepeat.split(/\s+/).map(function(E){return Number(E)}),g=h[0],A=h[1];d=new THREE__namespace.Vector2(g,A)}p.push(loadTexture(n.mapkd,e,r,d,o,s,u).then(function(E){E.encoding=THREE__namespace.sRGBEncoding,f.map=E,l.add(E),c.add(E),f.needsUpdate=!0}).catch(noop$1))}if(n.ks&&(f.specular=new THREE__namespace.Color().fromArray(n.ks.rgb).convertLinearToSRGB()),n.mapks&&p.push(loadTexture(n.mapks,e,r,null,o,s,u).then(function(E){f.specularMap=E,l.add(E),c.add(E)}).catch(noop$1)),n.ke&&(f.emissive=new THREE__namespace.Color().fromArray(n.ke.rgb).convertLinearToSRGB()),n.mapke&&p.push(loadTexture(n.mapke,e,r,null,o,s,u).then(function(E){E.encoding=THREE__namespace.sRGBEncoding,f.emissiveMap=E,l.add(E),c.add(E)}).catch(noop$1)),n.norm&&p.push(loadTexture(n.norm,e,r,null,o,s,u).then(function(E){f.normalMap=E,l.add(E),c.add(E)}).catch(noop$1)),n.mapbump&&p.push(loadTexture(n.mapbump,e,r,null,o,s,u).then(function(E){f.bumpMap=E,l.add(E),c.add(E)}).catch(noop$1)),n.bump&&p.push(loadTexture(n.bump,e,r,null,o,s,u).then(function(E){f.bumpMap=E,l.add(E),c.add(E)}).catch(noop$1)),typeof n.ns=="number"&&(f.shininess=n.ns),typeof n.d=="number"){var m=n.d;m>0&&m<1&&(f.opacity=m)}return f.floorIndex=0,{material:f,textureReady:Promise.all(p).then(noop$1)}}function fromProtoBuf(n){return Model$1.decode(n).meshes}function parse$3(n,t,e,r,o){for(var s=[],u=[],l=new Set,c=fromProtoBuf(n),p=new TextureLoader,f=new THREE__namespace.Matrix4,d=new THREE__namespace.Vector3,h=new THREE__namespace.Quaternion,g=new THREE__namespace.Vector3,A={},m=new Set,E=0,v=c;E<v.length;E++){var y=v[E],b=y.name,T=y.chunks,_=y.matrix;if(!(b==="Ceiling"||b==="CeilingDrop"))for(var S=0,R=_;S<R.length;S++){var M=R[S];f.elements=M.elements;for(var H=new THREE__namespace.Group,B=0;B<T.length;B++){var C=parseGeometry(T[B].geometry);C.applyMatrix4(f),f.decompose(d,h,g),g.x*g.y*g.z<0&&C.attributes.normal&&C.attributes.position&&C.attributes.uv&&flipBufferGeometryNormals(C),l.add(C);for(var w=[],I=0,O=T[B].material;I<O.length;I++){var L=O[I],N=parseMaterial(L,t,e||"",r,p,o,A,l,m),z=N.material,J=N.textureReady;u.push(J),w.push(z)}var K=new PBMMesh(C,w);K.name="chunk_"+B,K.matrix.compose(K.position,K.quaternion,K.scale),K.matrixAutoUpdate=!1,K.frustumCulled=!1,H.add(K)}H.name=b,s.push(H)}}return Promise.all(u).catch(noop$1).then(function(){return{createAt:0,description:"",objects:s,textures:Array.from(m),dispose:function(){l.forEach(function(Q){Q.dispose()}),l.clear()}}})}function loadDomez(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={byteLength:0};return Promise.resolve().then(function(){return s.ajax(n,{responseType:"arraybuffer"})}).then(function(l){return u.byteLength=l.body.byteLength,lzma(l.body)}).then(function(l){var c=l.reduce(function(d,h){return d+h.length},0),p=new Uint8Array(c),f=0;return l.forEach(function(d){p.set(d,f),f+=d.length}),p}).then(function(l){var c,p;return parse$3(l,(c=t.light)!==null&&c!==void 0?c:!0,t.textureBaseUri||"",(p=t.textureOptions)!==null&&p!==void 0?p:{},s)}).then(function(l){var c=new THREE__namespace.Group;c.matrixAutoUpdate=!1,o==="Z"&&c.applyMatrix4(ROTATE_X_MATRIX),c.matrix.compose(c.position,c.quaternion,c.scale),c.name=n;for(var p=0,f=l.objects;p<f.length;p++){var d=f[p];c.add(d)}return{type:"domez",modelUpAxis:"Y",upAxis:"Z",uri:n,byteLength:u.byteLength,memoryUsage:getMemoryUsage(c),scene:c,textures:l.textures,animations:[],dispose:function(){return l.dispose()}}})}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;var c=new FeatureTable(n.featureTableJson,n.featureTableBinary);if(Array.isArray(c.json.RTC_CENTER)){var p=c.json.RTC_CENTER;n.rtcCenter=[p[0],p[1],p[2]]}else{var p=c.getGlobalProperty("RTC_CENTER",GL_TYPE.FLOAT,3);p&&(n.rtcCenter=[p[0],p[1],p[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",TEXCOORD_2:"uv3",TEXCOORD_3:"uv4",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 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)}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 p=0,f=t.length;p<f;p++){var d=t[p];d.mesh!==void 0&&d.skin!==void 0&&(r[d.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,p;return Promise.all([Promise.all(((l=e.scenes)!==null&&l!==void 0?l:[]).map(function(f,d){return t.loadScene(d)})),Promise.all(((c=e.animations)!==null&&c!==void 0?c:[]).map(function(f,d){return t.loadAnimation(d)})),Promise.all(((p=e.cameras)!==null&&p!==void 0?p:[]).map(function(f,d){return t.loadCamera(d)}))])}).then(function(l){var c=l[0],p=l[1],f=l[2],d={json:e,scene:c[e.scene||0],scenes:c,animations:p,cameras:f,textures:[],dispose:noop$1};return d}).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),p=composeDsiposeSet(t.disposeSet);return Object.assign(l,{textures:c,dispose:p}),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,p=this.json.cameras[t],f=p[p.type];f?p.type==="perspective"?c=new THREE__namespace.PerspectiveCamera(THREE__namespace.MathUtils.radToDeg(f.yfov),f.aspectRatio||1,f.znear||1,f.zfar||2e6):p.type==="orthographic"?c=new THREE__namespace.OrthographicCamera(-f.xmag,f.xmag,f.ymag,-f.ymag,f.znear,f.zfar):(console.warn("glTF: Invalid camera type ".concat(p.type,".")),c=new THREE__namespace.Camera):(console.warn("glTF: Missing camera parameters."),c=new THREE__namespace.Camera),p.name&&(c.name=p.name),o=Promise.resolve(c)}return this.cache.set(e,o),o},n.prototype.loadSkin=function(t){var e="skin:"+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,p=c.animations[t],f=[],d=[],h=[],g=[],A=[],m=0,E=p.channels.length;m<E;m++){var v=p.channels[m],y=p.samplers[v.sampler],b=v.target,T=b.node!==void 0?b.node:b.id,_=p.parameters!==void 0?p.parameters[y.input]:y.input,S=p.parameters!==void 0?p.parameters[y.output]:y.output;f.push(this.loadNode(T)),d.push(this.loadAccessor(_)),h.push(this.loadAccessor(S)),g.push(y),A.push(b)}o=Promise.all([Promise.all(f),Promise.all(d),Promise.all(h),Promise.all(g),Promise.all(A)]).then(function(R){for(var M=R[0],H=R[1],B=R[2],C=R[3],w=R[4],I=[],O=function(J,K){var Q=M[J],U=H[J],q=B[J],X=C[J],Z=w[J];if(Q===void 0)return"continue";Q.updateMatrix(),Q.matrixAutoUpdate=!0;var W=void 0;switch(PATH_PROPERTIES[Z.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 G=Q.name?Q.name:Q.uuid,ne=X.interpolation!==void 0?INTERPOLATION[X.interpolation]:THREE__namespace.InterpolateLinear,$=[];PATH_PROPERTIES[Z.path]===PATH_PROPERTIES.weights?Q.traverse(function(pe){pe.morphTargetInfluences&&$.push(pe.name?pe.name:pe.uuid)}):$.push(G);var ee=q.array;if(q.normalized){for(var re=getNormalizedComponentScale(ee.constructor),le=new Float32Array(ee.length),ae=0,oe=ee.length;ae<oe;ae++)le[ae]=ee[ae]*re;ee=le}for(var ae=0,oe=$.length;ae<oe;ae++){var se=new W($[ae]+"."+PATH_PROPERTIES[Z.path],U.array,ee,ne);I.push(se)}},L=0,N=M.length;L<N;L++)O(L);var z=p.name?p.name:"animation_"+t;return new THREE__namespace.AnimationClip(z,void 0,I)})}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 p=this.json.buffers[t];s=this.options.fetcher.ajax(this.resolveResouce(p.uri),{responseType:"arraybuffer"}).then(function(f){return f.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(p){var f=c.byteLength||0,d=c.byteOffset||0;return p.slice(d,d+f)})}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 p=c[0],f=WEBGL_TYPE_SIZES[u.type],d=WEBGL_COMPONENT_TYPES[u.componentType],h=d.BYTES_PER_ELEMENT,g=h*f,A=u.byteOffset||0,m=u.bufferView!==void 0?e.json.bufferViews[u.bufferView].byteStride:void 0,E=u.normalized===!0,v,y;if(m&&m!==g){var b=Math.floor(A/m),T="InterleavedBuffer:"+u.bufferView+":"+u.componentType+":"+b+":"+u.count,_=e.cache.get(T);_||(v=new d(p,b*m,u.count*m/h),_=new THREE__namespace.InterleavedBuffer(v,m/h),e.cache.set(T,_)),y=new THREE__namespace.InterleavedBufferAttribute(_,f,A%m/h,E)}else p===null?v=new d(u.count*f):v=new d(p,A,u.count*f),y=new THREE__namespace.BufferAttribute(v,f,E);if(u.sparse!==void 0){var S=WEBGL_TYPE_SIZES.SCALAR,R=WEBGL_COMPONENT_TYPES[u.sparse.indices.componentType],M=u.sparse.indices.byteOffset||0,H=u.sparse.values.byteOffset||0,B=new R(c[1],M,u.sparse.count*S),C=new d(c[2],H,u.sparse.count*f);p!==null&&(y=new THREE__namespace.BufferAttribute(y.array.slice(),y.itemSize,y.normalized));for(var w=0,I=B.length;w<I;w++){var O=B[w];if(y.setX(O,C[w*f]),f>=2&&y.setY(O,C[w*f+1]),f>=3&&y.setZ(O,C[w*f+2]),f>=4&&y.setW(O,C[w*f+3]),f>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return y})}}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,p=l.length;c<p;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(f){var d=c.byteOffset||0,h=c.byteLength||0,g=new Uint8Array(f,d,h),A=new Blob([g],{type:l.mimeType});return createImageBitmapLike(A)})}else if(l.uri){var p=this.resolveResouce(l.uri);r=this.options.fetcher.loadImage(p,{},void 0,void 0,void 0,createImageBitmapLikeImage()).then(function(f){return f.body})}else throw new Error("glTF: Invalid image defs.")}return r=r.then(function(f){return e.disposeSet.add(f),f}),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,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)})),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(f){o.metalnessMap=f,o.roughnessMap=f,e.disposeSet.add(f)})),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(f){o.normalMap=f,e.disposeSet.add(f)})),o.normalScale=new THREE__namespace.Vector2(1,1),s.normalTexture.scale!==void 0)){var p=s.normalTexture.scale;o.normalScale.set(p,p)}s.occlusionTexture!==void 0&&(r.push(this.createMaterialTexture(s.occlusionTexture).then(function(f){o.aoMap=f,e.disposeSet.add(f)})),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(f){o.emissiveMap=f,e.disposeSet.add(f)}))}return this.disposeSet.add(o),Promise.all(r).then(function(){return o})},n.prototype.loadMaterialAsMeshBasicMaterial=function(t){var e=this,r=[],o=new THREE__namespace.MeshBasicMaterial;if(o.color=new THREE__namespace.Color(1,1,1),o.opacity=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(p){o.map=p,e.disposeSet.add(p)})),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)),s.occlusionTexture!==void 0&&(r.push(this.createMaterialTexture(s.occlusionTexture).then(function(p){o.aoMap=p,e.disposeSet.add(p)})),s.occlusionTexture.strength!==void 0&&(o.aoMapIntensity=s.occlusionTexture.strength))}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,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,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(p){p.encoding=THREE__namespace.sRGBEncoding,o.map=p,e.disposeSet.add(p)})),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=this,r,o=(r=t.mode)!==null&&r!==void 0?r:WEBGL_CONSTANTS.TRIANGLES,s="material:"+this.createPrimitiveKey(t),u=this.cache.get(s);if(u)return u;for(var l=null,c=0,p=values(this.extensions);c<p.length;c++){var f=p[c];if(l=f.loadMaterial(t,this),l)break}if(!l)if(o===WEBGL_CONSTANTS.TRIANGLES||o===WEBGL_CONSTANTS.TRIANGLE_STRIP||o===WEBGL_CONSTANTS.TRIANGLE_FAN)this.extensions.KHR_materials_unlit?l=this.loadMaterialAsMeshBasicMaterial(t):l=this.loadMaterialAsMeshStandardMaterial(t);else if(o===WEBGL_CONSTANTS.LINES||o===WEBGL_CONSTANTS.LINE_STRIP||o===WEBGL_CONSTANTS.LINE_LOOP)l=this.loadMaterialAsLineBasicMaterial(t);else if(o===WEBGL_CONSTANTS.POINTS)l=this.loadMaterialAsPointsMaterial(t);else throw new Error("glTF: Primitive mode unsupported: "+o);return l=l.then(function(d){return Promise.all(values(e.extensions).map(function(h){return h.extendMaterial(d,t,e)})).then(function(){return d})}),this.cache.set(s,l),l},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 p=this.json.textures[t];s=this.loadImage(p.source).then(function(f){var d=new THREE__namespace.Texture(f);d.needsUpdate=!0,d.flipY=!1,p.name&&(d.name=p.name);var h=e.json.samplers||{},g=h[p.sampler]||{};return d.magFilter=WEBGL_FILTERS[g.magFilter]||THREE__namespace.LinearFilter,d.minFilter=WEBGL_FILTERS[g.minFilter]||THREE__namespace.LinearMipmapLinearFilter,d.wrapS=WEBGL_WRAPPINGS[g.wrapS]||THREE__namespace.RepeatWrapping,d.wrapT=WEBGL_WRAPPINGS[g.wrapT]||THREE__namespace.RepeatWrapping,d.onUpdate=function(){f.close()},d})}return s=s.then(function(f){return e.disposeSet.add(f),f}),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,p=Promise.all(c.map(function(d){return e.loadGeometry(d)})),f=Promise.all(c.map(function(d){return e.loadMaterial(d)}));r=Promise.all([p,f]).then(function(d){for(var h=d[0],g=d[1],A=[],m=0;m<c.length;m++){var E=c[m],v=h[m],y=g[m],b=E.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?v=e.toGeometryTrianglesDrawMode(v,THREE__namespace.TriangleStripDrawMode):b===WEBGL_CONSTANTS.TRIANGLE_FAN&&(v=e.toGeometryTrianglesDrawMode(v,THREE__namespace.TriangleFanDrawMode)),e.disposeSet.add(v),l.isSkinnedMesh){var _=new THREE__namespace.SkinnedMesh(v,y);v.attributes.skinWeight.normalized||_.normalizeSkinWeights(),T=_}else T=new THREE__namespace.Mesh(v,y);else if(b===WEBGL_CONSTANTS.POINTS)T=new THREE__namespace.Points(v,y);else if(b===WEBGL_CONSTANTS.LINES)T=new THREE__namespace.LineSegments(v,y);else if(b===WEBGL_CONSTANTS.LINE_STRIP)T=new THREE__namespace.Line(v,y);else if(b===WEBGL_CONSTANTS.LINE_LOOP)T=new THREE__namespace.LineLoop(v,y);else throw new Error("glTF: Primitive mode unsupported: "+b);if(Object.keys(v.morphAttributes).length>0){if(l.weights!==void 0)for(var S=0,R=l.weights.length;S<R;S++)T.morphTargetInfluences[S]=l.weights[S];if(l.extras&&Array.isArray(l.extras.targetNames)){var M=l.extras.targetNames;if(T.morphTargetInfluences.length===M.length){T.morphTargetDictionary={};for(var S=0,R=M.length;S<R;S++)T.morphTargetDictionary[M[S]]=S}else console.warn("glTF: Invalid extras.targetNames length. Ignoring names.")}}T.name=l.name||"mesh_"+t,h.length>1&&(T.name+="_"+m),e.assignFinalMaterial(T),A.push(T)}if(A.length===1)return A[0];for(var H=new THREE__namespace.Group,B=0,C=A;B<C.length;B++){var T=C[B];H.add(T)}return H})}return r},n.prototype.assignFinalMaterial=function(t){var e=this,r=t.geometry,o=[].concat(t.material),s=r.attributes.tangent!==void 0,u=r.attributes.color!==void 0,l=r.attributes.normal===void 0,c=t instanceof THREE__namespace.SkinnedMesh,p=Object.keys(r.morphAttributes).length>0,f=p&&r.morphAttributes.normal!==void 0;o=o.map(function(d){if(s||u||l||c||p||f){var h="cloned-material:"+d.uuid+":";s&&(h+="vertex-tangents:"),u&&(h+="vertex-colors:"),l&&(h+="flat-shading:"),c&&(h+="skinning:"),p&&(h+="morph-targets:"),f&&(h+="morph-normals:");var g=e.cache.get(h);g||(g=d.clone(),s&&(g.vertexTangents=!0),u&&(g.vertexColors=!0),l&&(g.flatShading=!0),c&&(g.skinning=!0),p&&(g.morphTargets=!0),f&&(g.morphNormals=!0),s&&(g.normalScale&&(g.normalScale.y*=-1),g.clearcoatNormalScale&&(g.clearcoatNormalScale.y*=-1)),e.cache.set(h,g)),d=g}return d}),Array.isArray(t.material)?t.material=o:t.material=o[0]},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.mesh!==void 0&&u.push(this.loadMesh(s.mesh).then(function(h){if(s.weights!==void 0){var g=s.weights;h.traverse(function(A){if(A instanceof THREE__namespace.Mesh||A instanceof THREE__namespace.Line||A instanceof THREE__namespace.Points)for(var m=0,E=g.length;m<E;m++)A.morphTargetInfluences[m]=g[m]})}return h})),s.camera!==void 0&&u.push(this.loadCamera(s.camera));for(var l=this.loadNodeAttachments(t),c=0,p=l;c<p.length;c++){var f=p[c];u.push(f)}var d=Promise.all(u).then(function(h){var g;if(s.isBone===!0?g=new THREE__namespace.Bone:h.length>1?g=new THREE__namespace.Group:h.length===1?g=h[0]:g=new THREE__namespace.Object3D,g!==h[0])for(var A=0,m=h.length;A<m;A++)g.add(h[A]);if(s.name&&(g.userData.name=s.name,g.name=THREE__namespace.PropertyBinding.sanitizeNodeName(s.name)),s.matrix!==void 0){var E=new THREE__namespace.Matrix4;E.fromArray(s.matrix),g.applyMatrix4(E)}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});return this.cache.set(e,d),d},n.prototype.loadScene=function(t){var e=this.json,r=e.scenes[t],o=new THREE__namespace.Group;r.name&&(o.name=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)}return e.textureSet.add(r),e.disposeSet.add(r),r})},n.prototype.addGeometryPrimitiveAttributes=function(t,e){var r=this,o=e.attributes,s=[],u=function(_){var S=ATTRIBUTES[_]||_.toLowerCase();if(S in t.attributes)return"continue";s.push(l.loadAccessor(o[_]).then(function(R){R&&t.setAttribute(S,R)}))},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 p=new THREE__namespace.Box3;if(o.POSITION!==void 0){var f=this.json.accessors[o.POSITION],d=f.min,h=f.max;if(d!==void 0&&h!==void 0){if(p.set(new THREE__namespace.Vector3(d[0],d[1],d[2]),new THREE__namespace.Vector3(h[0],h[1],h[2])),f.normalized){var g=getNormalizedComponentScale(WEBGL_COMPONENT_TYPES[f.componentType]);p.min.multiplyScalar(g),p.max.multiplyScalar(g)}}else console.warn("glTF: Missing min/max properties for accessor POSITION.")}var A=e.targets;if(A!==void 0){for(var m=new THREE__namespace.Vector3,E=new THREE__namespace.Vector3,v=0,y=A.length;v<y;v++){var b=A[v];if(b.POSITION!==void 0){var f=this.json.accessors[b.POSITION],d=f.min,h=f.max;if(d!==void 0&&h!==void 0){if(E.setX(Math.max(Math.abs(d[0]),Math.abs(h[0]))),E.setY(Math.max(Math.abs(d[1]),Math.abs(h[1]))),E.setZ(Math.max(Math.abs(d[2]),Math.abs(h[2]))),f.normalized){var g=getNormalizedComponentScale(WEBGL_COMPONENT_TYPES[f.componentType]);E.multiplyScalar(g)}m.max(E)}else console.warn("glTF: Missing min/max properties for accessor POSITION.")}}p.expandByVector(m)}t.boundingBox=p;var T=new THREE__namespace.Sphere;return p.getCenter(T.center),T.radius=p.min.distanceTo(p.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,S=!1,R=0,M=e.targets.length;R<M;R++){var H=e.targets[R];if(H.POSITION!==void 0&&(_=!0),H.NORMAL!==void 0&&(S=!0),_&&S)break}if(!_&&!S)return t;var B=[];t.morphTargetsRelative=!0;for(var C=function(w,I){var O=e.targets[w];_?B.push(r.loadAccessor(O.POSITION).then(function(L){L&&(t.morphAttributes.position=t.morphAttributes.position||[],t.morphAttributes.position[w]=L)})):t.attributes.position&&(t.morphAttributes.position=t.morphAttributes.position||[],t.morphAttributes.position[w]=t.attributes.position),S?B.push(r.loadAccessor(O.NORMAL).then(function(L){L&&(t.morphAttributes.normal=t.morphAttributes.normal||[],t.morphAttributes.normal[w]=L)})):t.attributes.normal&&(t.morphAttributes.normal=t.morphAttributes.normal||[],t.morphAttributes.normal[w]=t.attributes.normal)},R=0,M=e.targets.length;R<M;R++)C(R,M);return Promise.all(B).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=[],p=0,f=u.joints.length;p<f;p++)c.push(r.loadNode(u.joints[p]));return Promise.all(c)}).then(function(l){return s.traverse(function(c){if(c instanceof THREE__namespace.SkinnedMesh){for(var p=[],f=[],d=0,h=l.length;d<h;d++){var g=l[d];if(g instanceof THREE__namespace.Bone){p.push(g);var A=new THREE__namespace.Matrix4;u.inverseBindMatrices!==void 0&&A.fromArray(u.inverseBindMatrices.array,d*16),f.push(A)}else console.warn('glTF: Joint "%s" could not be found.',u.joints[d])}var m=new THREE__namespace.Skeleton(p,f);c.bind(m,c.matrixWorld)}}),s})}).then(function(s){e.add(s);var u=[];if(o.children)for(var l=o.children,c=0,p=l.length;c<p;c++){var f=l[c];u.push(r.buildNodeHierarchy(f,s))}return Promise.all(u).then(function(){return s})})},n.prototype.resolveResouce=function(t){return/^[a-z]{0,8}\:/i.test(t)?t: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 p=t.clone();return p.setIndex(c),this.disposeSet.add(p),p},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.extendMaterial=function(t,e,r){return Promise.resolve()},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 p=o.getUint32(s,!0);if(s+=4,p===t.CHUNK_TYPES.JSON){var f=new Uint8Array(e,t.HEADER_LENGTH+s,c);u=decodeText(f)}else if(p===t.CHUNK_TYPES.BIN){var d=t.HEADER_LENGTH+s;l=e.slice(d,d+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,p=this._getWorker(l,c).then(function(f){return u=f,new Promise(function(d,h){u._callbacks[l]={resolve:d,reject:h},u.postMessage({type:"decode",id:l,taskConfig:e,buffer:t},[t])})}).then(function(f){return r._createGeometry(f.geometry)});return p.catch(function(){return!0}).then(function(){u&&l&&r._releaseTask(u,l)}),p},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(`
|
|
450
|
+
`),support=typeof Worker!="undefined"&&typeof Blob!="undefined",lzmaWorkerURL="";if(support)try{var blob$2=new Blob([lzmaWorkerSource],{type:"text/javascript"});lzmaWorkerURL=URL.createObjectURL(blob$2)}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,p={data:[],offset:0,writeByte:function(d){var h=Math.floor(this.offset/c);this.data[h]||(this.data[h]=new Uint8Array(c)),this.data[h][this.offset%c]=d,this.offset++}};LZMA.decompressFile(l,p),o=new Uint8Array(p.offset);for(var f=0;f<p.offset;f++)o[f]=p.data[Math.floor(f/c)][f%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(p,f){if(c.terminate(),p)return l(p);u(f)})}))},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))}function loadAt3d(n,t){var e,r,o,s,u;t===void 0&&(t={});var l=(e=t.upAxis)!==null&&e!==void 0?e:"Z",c=(r=t.fetcher)!==null&&r!==void 0?r:new Fetcher({allowHosts:["*"]}),p={byteLength:0},f=autoRestImageOptionsByTextureLength((o=t.textureOptions)!==null&&o!==void 0?o:{},(u=(s=t.textureArray)===null||s===void 0?void 0:s.length)!==null&&u!==void 0?u:0),d={};if(t.textureArray)for(var h=0,g=t.textureArray;h<g.length;h++){var A=g[h];d[A]=loadTexture$1(A,f,c)}return Promise.resolve().then(function(){return c.ajax(n,{responseType:"arraybuffer"})}).then(function(m){return lzma(m.body)}).then(function(m){return delay(function(){for(var E,v={chunks:[],createAt:void 0,description:void 0},y=0,b=m;y<b.length;y++){var T=b[y],_=Model$2.decode(T);_.chunks.length&&((E=v.chunks).push.apply(E,_.chunks),v.createAt=_.createAt,v.description=_.description)}return v})}).then(function(m){return delay(function(){var E,v,y,b;return parse$4(m,(E=t.light)!==null&&E!==void 0?E:!1,(v=t.textureBaseUri)!==null&&v!==void 0?v:function(){var T=n.lastIndexOf("/");if(T>=0){var _=n.slice(0,T)+"/";return/\/model\/$/.test(_)&&(_=_.replace(/\/model\/$/,"/materials/")),_}return""}(),((y=t.textureArray)!==null&&y!==void 0?y:[]).slice(),(b=t.textureOptions)!==null&&b!==void 0?b:{},d,c)})}).then(function(m){var E=new THREE__namespace.Group;E.name=n;for(var v=0,y=m.objects;v<y.length;v++){var b=y[v];E.add(b)}return l==="Y"&&E.applyMatrix4(ROTATE_X_MATRIX_INVERSE),{type:"at3d",modelUpAxis:"Z",upAxis:l,uri:n,byteLength:p.byteLength,memoryUsage:getMemoryUsage(E),scene:E,textures:m.textures,animations:[],dispose:function(){return m.dispose()}}})}function isAbsoluteURL(n){return n.indexOf("//")===0||/^[0-9a-z]+\:/i.test(n)}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})();function loadDome(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={byteLength:0};return Promise.resolve().then(function(){return s.ajax(n,{responseType:"arraybuffer"})}).then(function(l){var c,p;return u.byteLength=l.body.byteLength,parse$3(new Uint8Array(l.body),(c=t.light)!==null&&c!==void 0?c:!0,t.textureBaseUri||"",(p=t.textureOptions)!==null&&p!==void 0?p:{},s)}).then(function(l){var c=new THREE__namespace.Group;c.matrixAutoUpdate=!1,o==="Z"&&c.applyMatrix4(ROTATE_X_MATRIX),c.matrix.compose(c.position,c.quaternion,c.scale),c.name=n;for(var p=0,f=l.objects;p<f.length;p++){var d=f[p];c.add(d)}return{type:"dome",modelUpAxis:"Y",upAxis:o,uri:n,byteLength:u.byteLength,memoryUsage:getMemoryUsage(c),scene:c,textures:l.textures,animations:[],dispose:function(){return l.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 p=c[l];u.addGroup(p.start,p.count,p.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(p){var f=p.body;return r&&f.repeat.copy(r),f.needsUpdate=!0,f.updateMatrix(),f});return c}function parseMaterial(n,t,e,r,o,s,u,l,c){var p=[],f=new PBMMeshMaterial(t?"phong":"basic");if(l.add(f),n.kd&&(f.color=new THREE__namespace.Color().fromArray(n.kd.rgb).convertLinearToSRGB()),n.mapkd){var d=null;if(n.mapkdrepeat){var h=n.mapkdrepeat.split(/\s+/).map(function(E){return Number(E)}),g=h[0],A=h[1];d=new THREE__namespace.Vector2(g,A)}p.push(loadTexture(n.mapkd,e,r,d,o,s,u).then(function(E){E.encoding=THREE__namespace.sRGBEncoding,f.map=E,l.add(E),c.add(E),f.needsUpdate=!0}).catch(noop$1))}if(n.ks&&(f.specular=new THREE__namespace.Color().fromArray(n.ks.rgb).convertLinearToSRGB()),n.mapks&&p.push(loadTexture(n.mapks,e,r,null,o,s,u).then(function(E){f.specularMap=E,l.add(E),c.add(E)}).catch(noop$1)),n.ke&&(f.emissive=new THREE__namespace.Color().fromArray(n.ke.rgb).convertLinearToSRGB()),n.mapke&&p.push(loadTexture(n.mapke,e,r,null,o,s,u).then(function(E){E.encoding=THREE__namespace.sRGBEncoding,f.emissiveMap=E,l.add(E),c.add(E)}).catch(noop$1)),n.norm&&p.push(loadTexture(n.norm,e,r,null,o,s,u).then(function(E){f.normalMap=E,l.add(E),c.add(E)}).catch(noop$1)),n.mapbump&&p.push(loadTexture(n.mapbump,e,r,null,o,s,u).then(function(E){f.bumpMap=E,l.add(E),c.add(E)}).catch(noop$1)),n.bump&&p.push(loadTexture(n.bump,e,r,null,o,s,u).then(function(E){f.bumpMap=E,l.add(E),c.add(E)}).catch(noop$1)),typeof n.ns=="number"&&(f.shininess=n.ns),typeof n.d=="number"){var m=n.d;m>0&&m<1&&(f.opacity=m)}return f.floorIndex=0,{material:f,textureReady:Promise.all(p).then(noop$1)}}function fromProtoBuf(n){return Model$1.decode(n).meshes}function parse$3(n,t,e,r,o){for(var s=[],u=[],l=new Set,c=fromProtoBuf(n),p=new TextureLoader,f=new THREE__namespace.Matrix4,d=new THREE__namespace.Vector3,h=new THREE__namespace.Quaternion,g=new THREE__namespace.Vector3,A={},m=new Set,E=0,v=c;E<v.length;E++){var y=v[E],b=y.name,T=y.chunks,_=y.matrix;if(!(b==="Ceiling"||b==="CeilingDrop"))for(var S=0,R=_;S<R.length;S++){var M=R[S];f.elements=M.elements;for(var H=new THREE__namespace.Group,B=0;B<T.length;B++){var C=parseGeometry(T[B].geometry);C.applyMatrix4(f),f.decompose(d,h,g),g.x*g.y*g.z<0&&C.attributes.normal&&C.attributes.position&&C.attributes.uv&&flipBufferGeometryNormals(C),l.add(C);for(var w=[],I=0,O=T[B].material;I<O.length;I++){var L=O[I],N=parseMaterial(L,t,e||"",r,p,o,A,l,m),z=N.material,J=N.textureReady;u.push(J),w.push(z)}var G=new PBMMesh(C,w);G.name="chunk_"+B,G.matrix.compose(G.position,G.quaternion,G.scale),G.matrixAutoUpdate=!1,G.frustumCulled=!1,H.add(G)}H.name=b,s.push(H)}}return Promise.all(u).catch(noop$1).then(function(){return{createAt:0,description:"",objects:s,textures:Array.from(m),dispose:function(){l.forEach(function(Q){Q.dispose()}),l.clear()}}})}function loadDomez(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={byteLength:0};return Promise.resolve().then(function(){return s.ajax(n,{responseType:"arraybuffer"})}).then(function(l){return u.byteLength=l.body.byteLength,lzma(l.body)}).then(function(l){var c=l.reduce(function(d,h){return d+h.length},0),p=new Uint8Array(c),f=0;return l.forEach(function(d){p.set(d,f),f+=d.length}),p}).then(function(l){var c,p;return parse$3(l,(c=t.light)!==null&&c!==void 0?c:!0,t.textureBaseUri||"",(p=t.textureOptions)!==null&&p!==void 0?p:{},s)}).then(function(l){var c=new THREE__namespace.Group;c.matrixAutoUpdate=!1,o==="Z"&&c.applyMatrix4(ROTATE_X_MATRIX),c.matrix.compose(c.position,c.quaternion,c.scale),c.name=n;for(var p=0,f=l.objects;p<f.length;p++){var d=f[p];c.add(d)}return{type:"domez",modelUpAxis:"Y",upAxis:"Z",uri:n,byteLength:u.byteLength,memoryUsage:getMemoryUsage(c),scene:c,textures:l.textures,animations:[],dispose:function(){return l.dispose()}}})}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;var c=new FeatureTable(n.featureTableJson,n.featureTableBinary);if(Array.isArray(c.json.RTC_CENTER)){var p=c.json.RTC_CENTER;n.rtcCenter=[p[0],p[1],p[2]]}else{var p=c.getGlobalProperty("RTC_CENTER",GL_TYPE.FLOAT,3);p&&(n.rtcCenter=[p[0],p[1],p[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",TEXCOORD_2:"uv3",TEXCOORD_3:"uv4",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 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)}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 p=0,f=t.length;p<f;p++){var d=t[p];d.mesh!==void 0&&d.skin!==void 0&&(r[d.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,p;return Promise.all([Promise.all(((l=e.scenes)!==null&&l!==void 0?l:[]).map(function(f,d){return t.loadScene(d)})),Promise.all(((c=e.animations)!==null&&c!==void 0?c:[]).map(function(f,d){return t.loadAnimation(d)})),Promise.all(((p=e.cameras)!==null&&p!==void 0?p:[]).map(function(f,d){return t.loadCamera(d)}))])}).then(function(l){var c=l[0],p=l[1],f=l[2],d={json:e,scene:c[e.scene||0],scenes:c,animations:p,cameras:f,textures:[],dispose:noop$1};return d}).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),p=composeDsiposeSet(t.disposeSet);return Object.assign(l,{textures:c,dispose:p}),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,p=this.json.cameras[t],f=p[p.type];f?p.type==="perspective"?c=new THREE__namespace.PerspectiveCamera(THREE__namespace.MathUtils.radToDeg(f.yfov),f.aspectRatio||1,f.znear||1,f.zfar||2e6):p.type==="orthographic"?c=new THREE__namespace.OrthographicCamera(-f.xmag,f.xmag,f.ymag,-f.ymag,f.znear,f.zfar):(console.warn("glTF: Invalid camera type ".concat(p.type,".")),c=new THREE__namespace.Camera):(console.warn("glTF: Missing camera parameters."),c=new THREE__namespace.Camera),p.name&&(c.name=p.name),o=Promise.resolve(c)}return this.cache.set(e,o),o},n.prototype.loadSkin=function(t){var e="skin:"+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,p=c.animations[t],f=[],d=[],h=[],g=[],A=[],m=0,E=p.channels.length;m<E;m++){var v=p.channels[m],y=p.samplers[v.sampler],b=v.target,T=b.node!==void 0?b.node:b.id,_=p.parameters!==void 0?p.parameters[y.input]:y.input,S=p.parameters!==void 0?p.parameters[y.output]:y.output;f.push(this.loadNode(T)),d.push(this.loadAccessor(_)),h.push(this.loadAccessor(S)),g.push(y),A.push(b)}o=Promise.all([Promise.all(f),Promise.all(d),Promise.all(h),Promise.all(g),Promise.all(A)]).then(function(R){for(var M=R[0],H=R[1],B=R[2],C=R[3],w=R[4],I=[],O=function(J,G){var Q=M[J],U=H[J],q=B[J],K=C[J],Y=w[J];if(Q===void 0)return"continue";Q.updateMatrix(),Q.matrixAutoUpdate=!0;var Z=void 0;switch(PATH_PROPERTIES[Y.path]){case PATH_PROPERTIES.weights:Z=THREE__namespace.NumberKeyframeTrack;break;case PATH_PROPERTIES.rotation:Z=THREE__namespace.QuaternionKeyframeTrack;break;case PATH_PROPERTIES.position:case PATH_PROPERTIES.scale:default:Z=THREE__namespace.VectorKeyframeTrack;break}var te=Q.name?Q.name:Q.uuid,j=K.interpolation!==void 0?INTERPOLATION[K.interpolation]:THREE__namespace.InterpolateLinear,ee=[];PATH_PROPERTIES[Y.path]===PATH_PROPERTIES.weights?Q.traverse(function(ce){ce.morphTargetInfluences&&ee.push(ce.name?ce.name:ce.uuid)}):ee.push(te);var W=q.array;if(q.normalized){for(var re=getNormalizedComponentScale(W.constructor),le=new Float32Array(W.length),ae=0,oe=W.length;ae<oe;ae++)le[ae]=W[ae]*re;W=le}for(var ae=0,oe=ee.length;ae<oe;ae++){var se=new Z(ee[ae]+"."+PATH_PROPERTIES[Y.path],U.array,W,j);I.push(se)}},L=0,N=M.length;L<N;L++)O(L);var z=p.name?p.name:"animation_"+t;return new THREE__namespace.AnimationClip(z,void 0,I)})}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 p=this.json.buffers[t];s=this.options.fetcher.ajax(this.resolveResouce(p.uri),{responseType:"arraybuffer"}).then(function(f){return f.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(p){var f=c.byteLength||0,d=c.byteOffset||0;return p.slice(d,d+f)})}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 p=c[0],f=WEBGL_TYPE_SIZES[u.type],d=WEBGL_COMPONENT_TYPES[u.componentType],h=d.BYTES_PER_ELEMENT,g=h*f,A=u.byteOffset||0,m=u.bufferView!==void 0?e.json.bufferViews[u.bufferView].byteStride:void 0,E=u.normalized===!0,v,y;if(m&&m!==g){var b=Math.floor(A/m),T="InterleavedBuffer:"+u.bufferView+":"+u.componentType+":"+b+":"+u.count,_=e.cache.get(T);_||(v=new d(p,b*m,u.count*m/h),_=new THREE__namespace.InterleavedBuffer(v,m/h),e.cache.set(T,_)),y=new THREE__namespace.InterleavedBufferAttribute(_,f,A%m/h,E)}else p===null?v=new d(u.count*f):v=new d(p,A,u.count*f),y=new THREE__namespace.BufferAttribute(v,f,E);if(u.sparse!==void 0){var S=WEBGL_TYPE_SIZES.SCALAR,R=WEBGL_COMPONENT_TYPES[u.sparse.indices.componentType],M=u.sparse.indices.byteOffset||0,H=u.sparse.values.byteOffset||0,B=new R(c[1],M,u.sparse.count*S),C=new d(c[2],H,u.sparse.count*f);p!==null&&(y=new THREE__namespace.BufferAttribute(y.array.slice(),y.itemSize,y.normalized));for(var w=0,I=B.length;w<I;w++){var O=B[w];if(y.setX(O,C[w*f]),f>=2&&y.setY(O,C[w*f+1]),f>=3&&y.setZ(O,C[w*f+2]),f>=4&&y.setW(O,C[w*f+3]),f>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return y})}}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,p=l.length;c<p;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(f){var d=c.byteOffset||0,h=c.byteLength||0,g=new Uint8Array(f,d,h),A=new Blob([g],{type:l.mimeType});return createImageBitmapLike(A)})}else if(l.uri){var p=this.resolveResouce(l.uri);r=this.options.fetcher.loadImage(p,{},void 0,void 0,void 0,createImageBitmapLikeImage()).then(function(f){return f.body})}else throw new Error("glTF: Invalid image defs.")}return r=r.then(function(f){return e.disposeSet.add(f),f}),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,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)})),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(f){o.metalnessMap=f,o.roughnessMap=f,e.disposeSet.add(f)})),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(f){o.normalMap=f,e.disposeSet.add(f)})),o.normalScale=new THREE__namespace.Vector2(1,1),s.normalTexture.scale!==void 0)){var p=s.normalTexture.scale;o.normalScale.set(p,p)}s.occlusionTexture!==void 0&&(r.push(this.createMaterialTexture(s.occlusionTexture).then(function(f){o.aoMap=f,e.disposeSet.add(f)})),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(f){o.emissiveMap=f,e.disposeSet.add(f)}))}return this.disposeSet.add(o),Promise.all(r).then(function(){return o})},n.prototype.loadMaterialAsMeshBasicMaterial=function(t){var e=this,r=[],o=new THREE__namespace.MeshBasicMaterial;if(o.color=new THREE__namespace.Color(1,1,1),o.opacity=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(p){o.map=p,e.disposeSet.add(p)})),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)),s.occlusionTexture!==void 0&&(r.push(this.createMaterialTexture(s.occlusionTexture).then(function(p){o.aoMap=p,e.disposeSet.add(p)})),s.occlusionTexture.strength!==void 0&&(o.aoMapIntensity=s.occlusionTexture.strength))}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,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,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(p){p.encoding=THREE__namespace.sRGBEncoding,o.map=p,e.disposeSet.add(p)})),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=this,r,o=(r=t.mode)!==null&&r!==void 0?r:WEBGL_CONSTANTS.TRIANGLES,s="material:"+this.createPrimitiveKey(t),u=this.cache.get(s);if(u)return u;for(var l=null,c=0,p=values(this.extensions);c<p.length;c++){var f=p[c];if(l=f.loadMaterial(t,this),l)break}if(!l)if(o===WEBGL_CONSTANTS.TRIANGLES||o===WEBGL_CONSTANTS.TRIANGLE_STRIP||o===WEBGL_CONSTANTS.TRIANGLE_FAN)this.extensions.KHR_materials_unlit?l=this.loadMaterialAsMeshBasicMaterial(t):l=this.loadMaterialAsMeshStandardMaterial(t);else if(o===WEBGL_CONSTANTS.LINES||o===WEBGL_CONSTANTS.LINE_STRIP||o===WEBGL_CONSTANTS.LINE_LOOP)l=this.loadMaterialAsLineBasicMaterial(t);else if(o===WEBGL_CONSTANTS.POINTS)l=this.loadMaterialAsPointsMaterial(t);else throw new Error("glTF: Primitive mode unsupported: "+o);return l=l.then(function(d){return Promise.all(values(e.extensions).map(function(h){return h.extendMaterial(d,t,e)})).then(function(){return d})}),this.cache.set(s,l),l},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 p=this.json.textures[t];s=this.loadImage(p.source).then(function(f){var d=new THREE__namespace.Texture(f);d.needsUpdate=!0,d.flipY=!1,p.name&&(d.name=p.name);var h=e.json.samplers||{},g=h[p.sampler]||{};return d.magFilter=WEBGL_FILTERS[g.magFilter]||THREE__namespace.LinearFilter,d.minFilter=WEBGL_FILTERS[g.minFilter]||THREE__namespace.LinearMipmapLinearFilter,d.wrapS=WEBGL_WRAPPINGS[g.wrapS]||THREE__namespace.RepeatWrapping,d.wrapT=WEBGL_WRAPPINGS[g.wrapT]||THREE__namespace.RepeatWrapping,d.onUpdate=function(){f.close()},d})}return s=s.then(function(f){return e.disposeSet.add(f),f}),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,p=Promise.all(c.map(function(d){return e.loadGeometry(d)})),f=Promise.all(c.map(function(d){return e.loadMaterial(d)}));r=Promise.all([p,f]).then(function(d){for(var h=d[0],g=d[1],A=[],m=0;m<c.length;m++){var E=c[m],v=h[m],y=g[m],b=E.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?v=e.toGeometryTrianglesDrawMode(v,THREE__namespace.TriangleStripDrawMode):b===WEBGL_CONSTANTS.TRIANGLE_FAN&&(v=e.toGeometryTrianglesDrawMode(v,THREE__namespace.TriangleFanDrawMode)),e.disposeSet.add(v),l.isSkinnedMesh){var _=new THREE__namespace.SkinnedMesh(v,y);v.attributes.skinWeight.normalized||_.normalizeSkinWeights(),T=_}else T=new THREE__namespace.Mesh(v,y);else if(b===WEBGL_CONSTANTS.POINTS)T=new THREE__namespace.Points(v,y);else if(b===WEBGL_CONSTANTS.LINES)T=new THREE__namespace.LineSegments(v,y);else if(b===WEBGL_CONSTANTS.LINE_STRIP)T=new THREE__namespace.Line(v,y);else if(b===WEBGL_CONSTANTS.LINE_LOOP)T=new THREE__namespace.LineLoop(v,y);else throw new Error("glTF: Primitive mode unsupported: "+b);if(Object.keys(v.morphAttributes).length>0){if(l.weights!==void 0)for(var S=0,R=l.weights.length;S<R;S++)T.morphTargetInfluences[S]=l.weights[S];if(l.extras&&Array.isArray(l.extras.targetNames)){var M=l.extras.targetNames;if(T.morphTargetInfluences.length===M.length){T.morphTargetDictionary={};for(var S=0,R=M.length;S<R;S++)T.morphTargetDictionary[M[S]]=S}else console.warn("glTF: Invalid extras.targetNames length. Ignoring names.")}}T.name=l.name||"mesh_"+t,h.length>1&&(T.name+="_"+m),e.assignFinalMaterial(T),A.push(T)}if(A.length===1)return A[0];for(var H=new THREE__namespace.Group,B=0,C=A;B<C.length;B++){var T=C[B];H.add(T)}return H})}return r},n.prototype.assignFinalMaterial=function(t){var e=this,r=t.geometry,o=[].concat(t.material),s=r.attributes.tangent!==void 0,u=r.attributes.color!==void 0,l=r.attributes.normal===void 0,c=t instanceof THREE__namespace.SkinnedMesh,p=Object.keys(r.morphAttributes).length>0,f=p&&r.morphAttributes.normal!==void 0;o=o.map(function(d){if(s||u||l||c||p||f){var h="cloned-material:"+d.uuid+":";s&&(h+="vertex-tangents:"),u&&(h+="vertex-colors:"),l&&(h+="flat-shading:"),c&&(h+="skinning:"),p&&(h+="morph-targets:"),f&&(h+="morph-normals:");var g=e.cache.get(h);g||(g=d.clone(),s&&(g.vertexTangents=!0),u&&(g.vertexColors=!0),l&&(g.flatShading=!0),c&&(g.skinning=!0),p&&(g.morphTargets=!0),f&&(g.morphNormals=!0),s&&(g.normalScale&&(g.normalScale.y*=-1),g.clearcoatNormalScale&&(g.clearcoatNormalScale.y*=-1)),e.cache.set(h,g)),d=g}return d}),Array.isArray(t.material)?t.material=o:t.material=o[0]},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.mesh!==void 0&&u.push(this.loadMesh(s.mesh).then(function(h){if(s.weights!==void 0){var g=s.weights;h.traverse(function(A){if(A instanceof THREE__namespace.Mesh||A instanceof THREE__namespace.Line||A instanceof THREE__namespace.Points)for(var m=0,E=g.length;m<E;m++)A.morphTargetInfluences[m]=g[m]})}return h})),s.camera!==void 0&&u.push(this.loadCamera(s.camera));for(var l=this.loadNodeAttachments(t),c=0,p=l;c<p.length;c++){var f=p[c];u.push(f)}var d=Promise.all(u).then(function(h){var g;if(s.isBone===!0?g=new THREE__namespace.Bone:h.length>1?g=new THREE__namespace.Group:h.length===1?g=h[0]:g=new THREE__namespace.Object3D,g!==h[0])for(var A=0,m=h.length;A<m;A++)g.add(h[A]);if(s.name&&(g.userData.name=s.name,g.name=THREE__namespace.PropertyBinding.sanitizeNodeName(s.name)),s.matrix!==void 0){var E=new THREE__namespace.Matrix4;E.fromArray(s.matrix),g.applyMatrix4(E)}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});return this.cache.set(e,d),d},n.prototype.loadScene=function(t){var e=this.json,r=e.scenes[t],o=new THREE__namespace.Group;r.name&&(o.name=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)}return e.textureSet.add(r),e.disposeSet.add(r),r})},n.prototype.addGeometryPrimitiveAttributes=function(t,e){var r=this,o=e.attributes,s=[],u=function(_){var S=ATTRIBUTES[_]||_.toLowerCase();if(S in t.attributes)return"continue";s.push(l.loadAccessor(o[_]).then(function(R){R&&t.setAttribute(S,R)}))},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 p=new THREE__namespace.Box3;if(o.POSITION!==void 0){var f=this.json.accessors[o.POSITION],d=f.min,h=f.max;if(d!==void 0&&h!==void 0){if(p.set(new THREE__namespace.Vector3(d[0],d[1],d[2]),new THREE__namespace.Vector3(h[0],h[1],h[2])),f.normalized){var g=getNormalizedComponentScale(WEBGL_COMPONENT_TYPES[f.componentType]);p.min.multiplyScalar(g),p.max.multiplyScalar(g)}}else console.warn("glTF: Missing min/max properties for accessor POSITION.")}var A=e.targets;if(A!==void 0){for(var m=new THREE__namespace.Vector3,E=new THREE__namespace.Vector3,v=0,y=A.length;v<y;v++){var b=A[v];if(b.POSITION!==void 0){var f=this.json.accessors[b.POSITION],d=f.min,h=f.max;if(d!==void 0&&h!==void 0){if(E.setX(Math.max(Math.abs(d[0]),Math.abs(h[0]))),E.setY(Math.max(Math.abs(d[1]),Math.abs(h[1]))),E.setZ(Math.max(Math.abs(d[2]),Math.abs(h[2]))),f.normalized){var g=getNormalizedComponentScale(WEBGL_COMPONENT_TYPES[f.componentType]);E.multiplyScalar(g)}m.max(E)}else console.warn("glTF: Missing min/max properties for accessor POSITION.")}}p.expandByVector(m)}t.boundingBox=p;var T=new THREE__namespace.Sphere;return p.getCenter(T.center),T.radius=p.min.distanceTo(p.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,S=!1,R=0,M=e.targets.length;R<M;R++){var H=e.targets[R];if(H.POSITION!==void 0&&(_=!0),H.NORMAL!==void 0&&(S=!0),_&&S)break}if(!_&&!S)return t;var B=[];t.morphTargetsRelative=!0;for(var C=function(w,I){var O=e.targets[w];_?B.push(r.loadAccessor(O.POSITION).then(function(L){L&&(t.morphAttributes.position=t.morphAttributes.position||[],t.morphAttributes.position[w]=L)})):t.attributes.position&&(t.morphAttributes.position=t.morphAttributes.position||[],t.morphAttributes.position[w]=t.attributes.position),S?B.push(r.loadAccessor(O.NORMAL).then(function(L){L&&(t.morphAttributes.normal=t.morphAttributes.normal||[],t.morphAttributes.normal[w]=L)})):t.attributes.normal&&(t.morphAttributes.normal=t.morphAttributes.normal||[],t.morphAttributes.normal[w]=t.attributes.normal)},R=0,M=e.targets.length;R<M;R++)C(R,M);return Promise.all(B).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=[],p=0,f=u.joints.length;p<f;p++)c.push(r.loadNode(u.joints[p]));return Promise.all(c)}).then(function(l){return s.traverse(function(c){if(c instanceof THREE__namespace.SkinnedMesh){for(var p=[],f=[],d=0,h=l.length;d<h;d++){var g=l[d];if(g instanceof THREE__namespace.Bone){p.push(g);var A=new THREE__namespace.Matrix4;u.inverseBindMatrices!==void 0&&A.fromArray(u.inverseBindMatrices.array,d*16),f.push(A)}else console.warn('glTF: Joint "%s" could not be found.',u.joints[d])}var m=new THREE__namespace.Skeleton(p,f);c.bind(m,c.matrixWorld)}}),s})}).then(function(s){e.add(s);var u=[];if(o.children)for(var l=o.children,c=0,p=l.length;c<p;c++){var f=l[c];u.push(r.buildNodeHierarchy(f,s))}return Promise.all(u).then(function(){return s})})},n.prototype.resolveResouce=function(t){return/^[a-z]{0,8}\:/i.test(t)?t: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 p=t.clone();return p.setIndex(c),this.disposeSet.add(p),p},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.extendMaterial=function(t,e,r){return Promise.resolve()},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 p=o.getUint32(s,!0);if(s+=4,p===t.CHUNK_TYPES.JSON){var f=new Uint8Array(e,t.HEADER_LENGTH+s,c);u=decodeText(f)}else if(p===t.CHUNK_TYPES.BIN){var d=t.HEADER_LENGTH+s;l=e.slice(d,d+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,p=this._getWorker(l,c).then(function(f){return u=f,new Promise(function(d,h){u._callbacks[l]={resolve:d,reject:h},u.postMessage({type:"decode",id:l,taskConfig:e,buffer:t},[t])})}).then(function(f){return r._createGeometry(f.geometry)});return p.catch(function(){return!0}).then(function(){u&&l&&r._releaseTask(u,l)}),p},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(`
|
|
451
451
|
`);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 p=["/* draco decoder */",l,"","/* worker */",DRACOWorker].join(`
|
|
452
452
|
`);t.workerSourceURL=URL.createObjectURL(new Blob([p]))})}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=`
|
|
453
453
|
let decoderConfig;
|
|
@@ -914,7 +914,7 @@ self.onmessage = function(event) {
|
|
|
914
914
|
|
|
915
915
|
}
|
|
916
916
|
`,EXTENSION_NAME$5="KHR_texture_basisu",KHR_texture_basisu=function(n){__extends(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t.prototype.loadTexture=function(e,r){var o=r.json.textures[e];if(!o.extensions||!o.extensions[EXTENSION_NAME$5])return null;var s=o.extensions[EXTENSION_NAME$5],u=r.json.images[s.source],l=null;if(u.bufferView!==void 0)l=r.loadBufferView(u.bufferView).then(function(f){return ktx2.parse(f)});else if(u.uri)l=r.options.fetcher.ajax(r.resolveResouce(u.uri),{responseType:"arraybuffer"}).then(function(f){return ktx2.parse(f.body)});else throw new Error("glTF: Invalid image defs.");var c=r.json.samplers||{},p=c[o.sampler]||{};return l=l.then(function(f){return f.magFilter=THREE__namespace.LinearFilter,f.minFilter=THREE__namespace.LinearFilter,f.wrapS=WEBGL_WRAPPINGS[p.wrapS]||THREE__namespace.RepeatWrapping,f.wrapT=WEBGL_WRAPPINGS[p.wrapT]||THREE__namespace.RepeatWrapping,f}),l},t}(BaseExtension),EXTENSION_NAME$4="KHR_texture_transform",KHR_texture_transform=function(n){__extends(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t.prototype.extendTexture=function(e,r,o){var s=r.extensions!==void 0?r.extensions[EXTENSION_NAME$4]:void 0;return s?(s.texCoord!==void 0&&console.warn('glTF: Custom UV sets in "'+EXTENSION_NAME$4+'" extension not yet supported.'),s.offset===void 0&&s.rotation===void 0&&s.scale===void 0||(e=e.clone(),e.needsUpdate=!0,s.offset!==void 0&&e.offset.fromArray(s.offset),s.rotation!==void 0&&(e.rotation=s.rotation),s.scale!==void 0&&e.repeat.fromArray(s.scale)),e):null},t}(BaseExtension),KHR_mesh_quantization=function(n){__extends(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t}(BaseExtension),KHR_materials_unlit=function(n){__extends(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t}(BaseExtension),meshoptDecoder=function(){var n="b9H79Tebbbe8Fv9Gbb9Gvuuuuueu9Giuuub9Geueu9Giuuueuikqbeeedddillviebeoweuec:q;iekr;leDo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbeY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVbdE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbiL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtblK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949Wbol79IV9Rbrq:78Yqdbk:qzezu8Jjjjjbcj;eb9Rgv8Kjjjjbc9:hodnadcefal0mbcuhoaiRbbc:Ge9hmbavaialfgrad9Radz1jjjbhwcj;abad9UhlaicefhodnadTmbalc;WFbGglcjdalcjd6EhDcbhqinaqae9pmeaDaeaq9RaqaDfae6Egkcsfglcl4cifcd4hxdndndndnalc9WGgmTmbcbhPcehsawcjdfhzaohHinaraH9Rax6midnaraHaxfgo9RcK6mbczhlinalgic9Wfglawcj;cbffhOdndndndndnaHalco4fRbbalci4coG4ciGPlbedibkaO9cb83ibaOcwf9cb83ibxikaOaoRblaoRbbgAco4glalciSgCE86bbawcj;cbfaifglcGfaoclfaCfgORbbaAcl4ciGgCaCciSgCE86bbalcVfaOaCfgORbbaAcd4ciGgCaCciSgCE86bbalc7faOaCfgORbbaAciGgAaAciSgAE86bbalctfaOaAfgARbbaoRbegOco4gCaCciSgCE86bbalc91faAaCfgARbbaOcl4ciGgCaCciSgCE86bbalc4faAaCfgARbbaOcd4ciGgCaCciSgCE86bbalc93faAaCfgARbbaOciGgOaOciSgOE86bbalc94faAaOfgARbbaoRbdgOco4gCaCciSgCE86bbalc95faAaCfgARbbaOcl4ciGgCaCciSgCE86bbalc96faAaCfgARbbaOcd4ciGgCaCciSgCE86bbalc97faAaCfgARbbaOciGgOaOciSgOE86bbalc98faAaOfgORbbaoRbigoco4gAaAciSgAE86bbalc99faOaAfgORbbaocl4ciGgAaAciSgAE86bbalc9:faOaAfgORbbaocd4ciGgAaAciSgAE86bbalcufaOaAfglRbbaociGgoaociSgoE86bbalaofhoxdkaOaoRbwaoRbbgAcl4glalcsSgCE86bbawcj;cbfaifglcGfaocwfaCfgORbbaAcsGgAaAcsSgAE86bbalcVfaOaAfgORbbaoRbegAcl4gCaCcsSgCE86bbalc7faOaCfgORbbaAcsGgAaAcsSgAE86bbalctfaOaAfgORbbaoRbdgAcl4gCaCcsSgCE86bbalc91faOaCfgORbbaAcsGgAaAcsSgAE86bbalc4faOaAfgORbbaoRbigAcl4gCaCcsSgCE86bbalc93faOaCfgORbbaAcsGgAaAcsSgAE86bbalc94faOaAfgORbbaoRblgAcl4gCaCcsSgCE86bbalc95faOaCfgORbbaAcsGgAaAcsSgAE86bbalc96faOaAfgORbbaoRbvgAcl4gCaCcsSgCE86bbalc97faOaCfgORbbaAcsGgAaAcsSgAE86bbalc98faOaAfgORbbaoRbogAcl4gCaCcsSgCE86bbalc99faOaCfgORbbaAcsGgAaAcsSgAE86bbalc9:faOaAfgORbbaoRbrgocl4gAaAcsSgAE86bbalcufaOaAfglRbbaocsGgoaocsSgoE86bbalaofhoxekaOao8Pbb83bbaOcwfaocwf8Pbb83bbaoczfhokdnaiam9pmbaiczfhlarao9RcL0mekkaiam6miaoTmidnakTmbawaPfRbbhOawcj;cbfhlazhiakhHinaialRbbgAce4cbaAceG9R7aOfgO86bbaiadfhialcefhlaHcufgHmbkkazcefhzaPcefgPad6hsaohHaPad9hmexvkkcbhoasceGmdxikaoaxad2fhPdnakTmbcbhmcehsawcjdfhCinarao9Rax6miaoTmdaoaxfhoawamfRbbhOawcj;cbfhlaChiakhHinaialRbbgAce4cbaAceG9R7aOfgO86bbaiadfhialcefhlaHcufgHmbkaCcefhCamcefgmad6hsamad9hmbkaPhoxikcbhlcehsinarao9Rax6mdaoTmeaoaxfhoalcefglad6hsadal9hmbkaPhoxdkcbhoasceGTmekc9:hoxikabaqad2fawcjdfakad2z1jjjb8Aawawcjdfakcufad2fadz1jjjb8Aakaqfhqaombkc9:hoxekcbc99arao9Radcaadca0ESEhokavcj;ebf8Kjjjjbaok;xzeHu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnaeci9UgrcHfal0mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecjez:jjjjb8AavcUf9cu83ibavc8Wf9cu83ibavcyf9cu83ibavcaf9cu83ibavcKf9cu83ibavczf9cu83ibav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhodnaeTmbcmcsaDceSEhkcbhxcbhmcbhrcbhicbhlindnaoaq9nmbc9:hoxikdndnawRbbgDc;Ve0mbavc;abfalaDcu7gPcl4fcsGcitfgsydlhzasydbhHdnaDcsGgDak9pmbavaiaPfcsGcdtfydbaxaDEhsaDThDdndnadcd9hmbabarcetfgPaH87ebaPcdfaz87ebaPclfas87ebxekabarcdtfgPaHBdbaPclfazBdbaPcwfasBdbkaxaDfhxavc;abfalcitfgPasBdbaPazBdlavaicdtfasBdbavc;abfalcefcsGglcitfgPaHBdbaPasBdlaiaDfhialcefhlxdkdndnaDcsSmbamaDfaDc987fcefhmxekaocefhDao8SbbgscFeGhPdndnascu9mmbaDhoxekaocvfhoaPcFbGhPcrhsdninaD8SbbgOcFbGastaPVhPaOcu9kmeaDcefhDascrfgsc8J9hmbxdkkaDcefhokaPce4cbaPceG9R7amfhmkdndnadcd9hmbabarcetfgDaH87ebaDcdfaz87ebaDclfam87ebxekabarcdtfgDaHBdbaDclfazBdbaDcwfamBdbkavc;abfalcitfgDamBdbaDazBdlavaicdtfamBdbavc;abfalcefcsGglcitfgDaHBdbaDamBdlaicefhialcefhlxekdnaDcpe0mbaxcefgOavaiaqaDcsGfRbbgscl49RcsGcdtfydbascz6gPEhDavaias9RcsGcdtfydbaOaPfgzascsGgOEhsaOThOdndnadcd9hmbabarcetfgHax87ebaHcdfaD87ebaHclfas87ebxekabarcdtfgHaxBdbaHclfaDBdbaHcwfasBdbkavaicdtfaxBdbavc;abfalcitfgHaDBdbaHaxBdlavaicefgicsGcdtfaDBdbavc;abfalcefcsGcitfgHasBdbaHaDBdlavaiaPfcsGgicdtfasBdbavc;abfalcdfcsGglcitfgDaxBdbaDasBdlalcefhlaiaOfhiazaOfhxxekaxcbaoRbbgHEgAaDc;:eSgDfhzaHcsGhCaHcl4hXdndnaHcs0mbazcefhOxekazhOavaiaX9RcsGcdtfydbhzkdndnaCmbaOcefhxxekaOhxavaiaH9RcsGcdtfydbhOkdndnaDTmbaocefhDxekaocdfhDao8SbegPcFeGhsdnaPcu9kmbaocofhAascFbGhscrhodninaD8SbbgPcFbGaotasVhsaPcu9kmeaDcefhDaocrfgoc8J9hmbkaAhDxekaDcefhDkasce4cbasceG9R7amfgmhAkdndnaXcsSmbaDhsxekaDcefhsaD8SbbgocFeGhPdnaocu9kmbaDcvfhzaPcFbGhPcrhodninas8SbbgDcFbGaotaPVhPaDcu9kmeascefhsaocrfgoc8J9hmbkazhsxekascefhskaPce4cbaPceG9R7amfgmhzkdndnaCcsSmbashoxekascefhoas8SbbgDcFeGhPdnaDcu9kmbascvfhOaPcFbGhPcrhDdninao8SbbgscFbGaDtaPVhPascu9kmeaocefhoaDcrfgDc8J9hmbkaOhoxekaocefhokaPce4cbaPceG9R7amfgmhOkdndnadcd9hmbabarcetfgDaA87ebaDcdfaz87ebaDclfaO87ebxekabarcdtfgDaABdbaDclfazBdbaDcwfaOBdbkavc;abfalcitfgDazBdbaDaABdlavaicdtfaABdbavc;abfalcefcsGcitfgDaOBdbaDazBdlavaicefgicsGcdtfazBdbavc;abfalcdfcsGcitfgDaABdbaDaOBdlavaiaHcz6aXcsSVfgicsGcdtfaOBdbaiaCTaCcsSVfhialcifhlkawcefhwalcsGhlaicsGhiarcifgrae6mbkkcbc99aoaqSEhokavc;aef8Kjjjjbaok:flevu8Jjjjjbcz9Rhvc9:hodnaecvfal0mbcuhoaiRbbc;:eGc;qe9hmbav9cb83iwaicefhraialfc98fhwdnaeTmbdnadcdSmbcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcdtfaic8Etc8F91aicd47avcwfaiceGcdtVgoydbfglBdbaoalBdbaDcefgDae9hmbxdkkcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcetfaic8Etc8F91aicd47avcwfaiceGcdtVgoydbfgl87ebaoalBdbaDcefgDae9hmbkkcbc99arawSEhokaok:Lvoeue99dud99eud99dndnadcl9hmbaeTmeindndnabcdfgd8Sbb:Yab8Sbbgi:Ygl:l:tabcefgv8Sbbgo:Ygr:l:tgwJbb;:9cawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai86bbdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad86bbdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad86bbabclfhbaecufgembxdkkaeTmbindndnabclfgd8Ueb:Yab8Uebgi:Ygl:l:tabcdfgv8Uebgo:Ygr:l:tgwJb;:FSawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai87ebdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad87ebdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad87ebabcwfhbaecufgembkkk;siliui99iue99dnaeTmbcbhiabhlindndnJ;Zl81Zalcof8UebgvciV:Y:vgoal8Ueb:YNgrJb;:FSNJbbbZJbbb:;arJbbbb9GEMgw:lJbbb9p9DTmbaw:OhDxekcjjjj94hDkalclf8Uebhqalcdf8UebhkabavcefciGaiVcetfaD87ebdndnaoak:YNgwJb;:FSNJbbbZJbbb:;awJbbbb9GEMgx:lJbbb9p9DTmbax:Ohkxekcjjjj94hkkabavcdfciGaiVcetfak87ebdndnaoaq:YNgoJb;:FSNJbbbZJbbb:;aoJbbbb9GEMgx:lJbbb9p9DTmbax:Ohqxekcjjjj94hqkabavcufciGaiVcetfaq87ebdndnJbbjZararN:tawawN:taoaoN:tgrJbbbbarJbbbb9GE:rJb;:FSNJbbbZMgr:lJbbb9p9DTmbar:Ohqxekcjjjj94hqkabavciGaiVcetfaq87ebalcwfhlaiclfhiaecufgembkkk9mbdnadcd4ae2gdTmbinababydbgecwtcw91:Yaece91cjjj;8ifcjjj98G::NUdbabclfhbadcufgdmbkkk9teiucbcbydj1jjbgeabcifc98GfgbBdj1jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaik;LeeeudndnaeabVciGTmbabhixekdndnadcz9pmbabhixekabhiinaiaeydbBdbaiclfaeclfydbBdbaicwfaecwfydbBdbaicxfaecxfydbBdbaeczfheaiczfhiadc9Wfgdcs0mbkkadcl6mbinaiaeydbBdbaeclfheaiclfhiadc98fgdci0mbkkdnadTmbinaiaeRbb86bbaicefhiaecefheadcufgdmbkkabk;aeedudndnabciGTmbabhixekaecFeGc:b:c:ew2hldndnadcz9pmbabhixekabhiinaialBdbaicxfalBdbaicwfalBdbaiclfalBdbaiczfhiadc9Wfgdcs0mbkkadcl6mbinaialBdbaiclfhiadc98fgdci0mbkkdnadTmbinaiae86bbaicefhiadcufgdmbkkabkkkebcjwklz9Kbb",t="b9H79TebbbeKl9Gbb9Gvuuuuueu9Giuuub9Geueuikqbbebeedddilve9Weeeviebeoweuec:q;Aekr;leDo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbdY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVblE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtboK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbrL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949Wbwl79IV9RbDq;a9tqlbzik9:evu8Jjjjjbcz9Rhbcbheincbhdcbhiinabcwfadfaicjuaead4ceGglE86bbaialfhiadcefgdcw9hmbkaec:q:yjjbfai86bbaecitc:q1jjbfab8Piw83ibaecefgecjd9hmbkk;d8JlHud97euo978Jjjjjbcj;kb9Rgv8Kjjjjbc9:hodnadcefal0mbcuhoaiRbbc:Ge9hmbavaialfgrad9Rad;8qbbcj;abad9UhoaicefhldnadTmbaoc;WFbGgocjdaocjd6EhwcbhDinaDae9pmeawaeaD9RaDawfae6Egqcsfgoc9WGgkci2hxakcethmaocl4cifcd4hPabaDad2fhscbhzdnincehHalhOcbhAdninaraO9RaP6miavcj;cbfaAak2fhCaOaPfhlcbhidnakc;ab6mbaral9Rc;Gb6mbcbhoinaCaofhidndndndndnaOaoco4fRbbgXciGPlbedibkaipxbbbbbbbbbbbbbbbbpklbxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklbalczfhlkdndndndndnaXcd4ciGPlbedibkaipxbbbbbbbbbbbbbbbbpklzxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklzalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklzalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklzalczfhlkdndndndndnaXcl4ciGPlbedibkaipxbbbbbbbbbbbbbbbbpklaxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklaalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklaalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklaalczfhlkdndndndndnaXco4Plbedibkaipxbbbbbbbbbbbbbbbbpkl8WxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibaXc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spkl8WalclfaYpQbfaXc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibaXc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spkl8WalcwfaYpQbfaXc:q:yjjbfRbbfhlxekaialpbbbpkl8Walczfhlkaoc;abfhiaocjefak0meaihoaral9Rc;Fb0mbkkdndnaiak9pmbaici4hoinaral9RcK6mdaCaifhXdndndndndnaOaico4fRbbaocoG4ciGPlbedibkaXpxbbbbbbbbbbbbbbbbpklbxikaXalpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaXalpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaXalpbbbpklbalczfhlkaocdfhoaiczfgiak6mbkkalTmbaAci6hHalhOaAcefgAclSmdxekkcbhlaHceGmdkdnakTmbavcjdfazfhiavazfpbdbhYcbhXinaiavcj;cbfaXfgopblbgLcep9TaLpxeeeeeeeeeeeeeeeegQp9op9Hp9rgLaoakfpblbg8Acep9Ta8AaQp9op9Hp9rg8ApmbzeHdOiAlCvXoQrLgEaoamfpblbg3cep9Ta3aQp9op9Hp9rg3aoaxfpblbg5cep9Ta5aQp9op9Hp9rg5pmbzeHdOiAlCvXoQrLg8EpmbezHdiOAlvCXorQLgQaQpmbedibedibedibediaYp9UgYp9AdbbaiadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaEa8EpmwDKYqk8AExm35Ps8E8FgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaLa8ApmwKDYq8AkEx3m5P8Es8FgLa3a5pmwKDYq8AkEx3m5P8Es8Fg8ApmbezHdiOAlvCXorQLgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaLa8ApmwDKYqk8AExm35Ps8E8FgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfhiaXczfgXak6mbkkazclfgzad6mbkasavcjdfaqad2;8qbbavavcjdfaqcufad2fad;8qbbaqaDfhDc9:hoalmexikkc9:hoxekcbc99aral9Radcaadca0ESEhokavcj;kbf8Kjjjjbaokwbz:bjjjbk;tzeHu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnaeci9UgrcHfal0mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecje;8kbavcUf9cu83ibavc8Wf9cu83ibavcyf9cu83ibavcaf9cu83ibavcKf9cu83ibavczf9cu83ibav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhodnaeTmbcmcsaDceSEhkcbhxcbhmcbhrcbhicbhlindnaoaq9nmbc9:hoxikdndnawRbbgDc;Ve0mbavc;abfalaDcu7gPcl4fcsGcitfgsydlhzasydbhHdnaDcsGgDak9pmbavaiaPfcsGcdtfydbaxaDEhsaDThDdndnadcd9hmbabarcetfgPaH87ebaPcdfaz87ebaPclfas87ebxekabarcdtfgPaHBdbaPclfazBdbaPcwfasBdbkaxaDfhxavc;abfalcitfgPasBdbaPazBdlavaicdtfasBdbavc;abfalcefcsGglcitfgPaHBdbaPasBdlaiaDfhialcefhlxdkdndnaDcsSmbamaDfaDc987fcefhmxekaocefhDao8SbbgscFeGhPdndnascu9mmbaDhoxekaocvfhoaPcFbGhPcrhsdninaD8SbbgOcFbGastaPVhPaOcu9kmeaDcefhDascrfgsc8J9hmbxdkkaDcefhokaPce4cbaPceG9R7amfhmkdndnadcd9hmbabarcetfgDaH87ebaDcdfaz87ebaDclfam87ebxekabarcdtfgDaHBdbaDclfazBdbaDcwfamBdbkavc;abfalcitfgDamBdbaDazBdlavaicdtfamBdbavc;abfalcefcsGglcitfgDaHBdbaDamBdlaicefhialcefhlxekdnaDcpe0mbaxcefgOavaiaqaDcsGfRbbgscl49RcsGcdtfydbascz6gPEhDavaias9RcsGcdtfydbaOaPfgzascsGgOEhsaOThOdndnadcd9hmbabarcetfgHax87ebaHcdfaD87ebaHclfas87ebxekabarcdtfgHaxBdbaHclfaDBdbaHcwfasBdbkavaicdtfaxBdbavc;abfalcitfgHaDBdbaHaxBdlavaicefgicsGcdtfaDBdbavc;abfalcefcsGcitfgHasBdbaHaDBdlavaiaPfcsGgicdtfasBdbavc;abfalcdfcsGglcitfgDaxBdbaDasBdlalcefhlaiaOfhiazaOfhxxekaxcbaoRbbgHEgAaDc;:eSgDfhzaHcsGhCaHcl4hXdndnaHcs0mbazcefhOxekazhOavaiaX9RcsGcdtfydbhzkdndnaCmbaOcefhxxekaOhxavaiaH9RcsGcdtfydbhOkdndnaDTmbaocefhDxekaocdfhDao8SbegPcFeGhsdnaPcu9kmbaocofhAascFbGhscrhodninaD8SbbgPcFbGaotasVhsaPcu9kmeaDcefhDaocrfgoc8J9hmbkaAhDxekaDcefhDkasce4cbasceG9R7amfgmhAkdndnaXcsSmbaDhsxekaDcefhsaD8SbbgocFeGhPdnaocu9kmbaDcvfhzaPcFbGhPcrhodninas8SbbgDcFbGaotaPVhPaDcu9kmeascefhsaocrfgoc8J9hmbkazhsxekascefhskaPce4cbaPceG9R7amfgmhzkdndnaCcsSmbashoxekascefhoas8SbbgDcFeGhPdnaDcu9kmbascvfhOaPcFbGhPcrhDdninao8SbbgscFbGaDtaPVhPascu9kmeaocefhoaDcrfgDc8J9hmbkaOhoxekaocefhokaPce4cbaPceG9R7amfgmhOkdndnadcd9hmbabarcetfgDaA87ebaDcdfaz87ebaDclfaO87ebxekabarcdtfgDaABdbaDclfazBdbaDcwfaOBdbkavc;abfalcitfgDazBdbaDaABdlavaicdtfaABdbavc;abfalcefcsGcitfgDaOBdbaDazBdlavaicefgicsGcdtfazBdbavc;abfalcdfcsGcitfgDaABdbaDaOBdlavaiaHcz6aXcsSVfgicsGcdtfaOBdbaiaCTaCcsSVfhialcifhlkawcefhwalcsGhlaicsGhiarcifgrae6mbkkcbc99aoaqSEhokavc;aef8Kjjjjbaok:flevu8Jjjjjbcz9Rhvc9:hodnaecvfal0mbcuhoaiRbbc;:eGc;qe9hmbav9cb83iwaicefhraialfc98fhwdnaeTmbdnadcdSmbcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcdtfaic8Etc8F91aicd47avcwfaiceGcdtVgoydbfglBdbaoalBdbaDcefgDae9hmbxdkkcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcetfaic8Etc8F91aicd47avcwfaiceGcdtVgoydbfgl87ebaoalBdbaDcefgDae9hmbkkcbc99arawSEhokaok:wPliuo97eue978Jjjjjbca9Rhiaec98Ghldndnadcl9hmbdnalTmbcbhvabhdinadadpbbbgocKp:RecKp:Sep;6egraocwp:RecKp:Sep;6earp;Geaoczp:RecKp:Sep;6egwp;Gep;Kep;LegDpxbbbbbbbbbbbbbbbbp:2egqarpxbbbjbbbjbbbjbbbjgkp9op9rp;Kegrpxbb;:9cbb;:9cbb;:9cbb;:9cararp;MeaDaDp;Meawaqawakp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFbbbFbbbFbbbFbbbp9oaopxbbbFbbbFbbbFbbbFp9op9qarawp;Meaqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaDawp;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpkbbadczfhdavclfgval6mbkkalae9pmeaipxbbbbbbbbbbbbbbbbgqpklbaiabalcdtfgdaeciGglcdtgv;8qbbdnalTmbaiaipblbgocKp:RecKp:Sep;6egraocwp:RecKp:Sep;6earp;Geaoczp:RecKp:Sep;6egwp;Gep;Kep;LegDaqp:2egqarpxbbbjbbbjbbbjbbbjgkp9op9rp;Kegrpxbb;:9cbb;:9cbb;:9cbb;:9cararp;MeaDaDp;Meawaqawakp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFbbbFbbbFbbbFbbbp9oaopxbbbFbbbFbbbFbbbFp9op9qarawp;Meaqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaDawp;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpklbkadaiav;8qbbskdnalTmbcbhvabhdinadczfgxaxpbbbgopxbbbbbbFFbbbbbbFFgkp9oadpbbbgDaopmlvorxmPsCXQL358E8FpxFubbFubbFubbFubbp9op;6eaDaopmbediwDqkzHOAKY8AEgoczp:Sep;6egrp;Geaoczp:Reczp:Sep;6egwp;Gep;Kep;Legopxb;:FSb;:FSb;:FSb;:FSawaopxbbbbbbbbbbbbbbbbp:2egqawpxbbbjbbbjbbbjbbbjgmp9op9rp;Kegwawp;Meaoaop;Mearaqaramp9op9rp;Kegoaop;Mep;Kep;Kep;Jep;Negrp;Mepxbbn0bbn0bbn0bbn0gqp;Keczp:Reawarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9op9qgwaoarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9ogopmwDKYqk8AExm35Ps8E8Fp9qpkbbadaDakp9oawaopmbezHdiOAlvCXorQLp9qpkbbadcafhdavclfgval6mbkkalae9pmbaiaeciGgvcitgdfcbcaad9R;8kbaiabalcitfglad;8qbbdnavTmbaiaipblzgopxbbbbbbFFbbbbbbFFgkp9oaipblbgDaopmlvorxmPsCXQL358E8FpxFubbFubbFubbFubbp9op;6eaDaopmbediwDqkzHOAKY8AEgoczp:Sep;6egrp;Geaoczp:Reczp:Sep;6egwp;Gep;Kep;Legopxb;:FSb;:FSb;:FSb;:FSawaopxbbbbbbbbbbbbbbbbp:2egqawpxbbbjbbbjbbbjbbbjgmp9op9rp;Kegwawp;Meaoaop;Mearaqaramp9op9rp;Kegoaop;Mep;Kep;Kep;Jep;Negrp;Mepxbbn0bbn0bbn0bbn0gqp;Keczp:Reawarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9op9qgwaoarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9ogopmwDKYqk8AExm35Ps8E8Fp9qpklzaiaDakp9oawaopmbezHdiOAlvCXorQLp9qpklbkalaiad;8qbbkk;4wllue97euv978Jjjjjbc8W9Rhidnaec98GglTmbcbhvabhoinaiaopbbbgraoczfgwpbbbgDpmlvorxmPsCXQL358E8Fgqczp:Segkclp:RepklbaopxbbjZbbjZbbjZbbjZpx;Zl81Z;Zl81Z;Zl81Z;Zl81Zakpxibbbibbbibbbibbbp9qp;6ep;NegkaraDpmbediwDqkzHOAKY8AEgrczp:Reczp:Sep;6ep;MegDaDp;Meakarczp:Sep;6ep;Megxaxp;Meakaqczp:Reczp:Sep;6ep;Megqaqp;Mep;Kep;Kep;Lepxbbbbbbbbbbbbbbbbp:4ep;Jepxb;:FSb;:FSb;:FSb;:FSgkp;Mepxbbn0bbn0bbn0bbn0grp;KepxFFbbFFbbFFbbFFbbgmp9oaxakp;Mearp;Keczp:Rep9qgxaqakp;Mearp;Keczp:ReaDakp;Mearp;Keamp9op9qgkpmbezHdiOAlvCXorQLgrp5baipblbpEb:T:j83ibaocwfarp5eaipblbpEe:T:j83ibawaxakpmwDKYqk8AExm35Ps8E8Fgkp5baipblbpEd:T:j83ibaocKfakp5eaipblbpEi:T:j83ibaocafhoavclfgval6mbkkdnalae9pmbaiaeciGgvcitgofcbcaao9R;8kbaiabalcitfgwao;8qbbdnavTmbaiaipblbgraipblzgDpmlvorxmPsCXQL358E8Fgqczp:Segkclp:RepklaaipxbbjZbbjZbbjZbbjZpx;Zl81Z;Zl81Z;Zl81Z;Zl81Zakpxibbbibbbibbbibbbp9qp;6ep;NegkaraDpmbediwDqkzHOAKY8AEgrczp:Reczp:Sep;6ep;MegDaDp;Meakarczp:Sep;6ep;Megxaxp;Meakaqczp:Reczp:Sep;6ep;Megqaqp;Mep;Kep;Kep;Lepxbbbbbbbbbbbbbbbbp:4ep;Jepxb;:FSb;:FSb;:FSb;:FSgkp;Mepxbbn0bbn0bbn0bbn0grp;KepxFFbbFFbbFFbbFFbbgmp9oaxakp;Mearp;Keczp:Rep9qgxaqakp;Mearp;Keczp:ReaDakp;Mearp;Keamp9op9qgkpmbezHdiOAlvCXorQLgrp5baipblapEb:T:j83ibaiarp5eaipblapEe:T:j83iwaiaxakpmwDKYqk8AExm35Ps8E8Fgkp5baipblapEd:T:j83izaiakp5eaipblapEi:T:j83iKkawaiao;8qbbkk:Pddiue978Jjjjjbc;ab9Rhidnadcd4ae2glc98GgvTmbcbheabhdinadadpbbbgocwp:Recwp:Sep;6eaocep:SepxbbjZbbjZbbjZbbjZp:UepxbbjFbbjFbbjFbbjFp9op;Mepkbbadczfhdaeclfgeav6mbkkdnaval9pmbaialciGgecdtgdVcbc;abad9R;8kbaiabavcdtfgvad;8qbbdnaeTmbaiaipblbgocwp:Recwp:Sep;6eaocep:SepxbbjZbbjZbbjZbbjZp:UepxbbjFbbjFbbjFbbjFp9op;Mepklbkavaiad;8qbbkk9teiucbcbydj1jjbgeabcifc98GfgbBdj1jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaikkkebcjwklz9Tbb",e=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]),r=new Uint8Array([32,0,65,2,1,106,34,33,3,128,11,4,13,64,6,253,10,7,15,116,127,5,8,12,40,16,19,54,20,9,27,255,113,17,42,67,24,23,146,148,18,14,22,45,70,69,56,114,101,21,25,63,75,136,108,28,118,29,73,115]);if(typeof WebAssembly!="object")return{supported:!1};var o=WebAssembly.validate(e)?t:n,s,u=WebAssembly.instantiate(l(o),{}).then(function(v){s=v.instance,s.exports.__wasm_call_ctors()});function l(v){for(var y=new Uint8Array(v.length),b=0;b<v.length;++b){var T=v.charCodeAt(b);y[b]=T>96?T-97:T>64?T-39:T+4}for(var _=0,b=0;b<v.length;++b)y[_++]=y[b]<60?r[y[b]]:(y[b]-60)*64+y[++b];return y.buffer.slice(0,_)}function c(v,y,b,T,_,S){var R=s.exports.sbrk,M=b+3&-4,H=R(M*T),B=R(_.length),C=new Uint8Array(s.exports.memory.buffer);C.set(_,B);var w=v(H,b,T,B,_.length);if(w==0&&S&&S(H,M,T),y.set(C.subarray(H,H+b*T)),R(H-R(0)),w!=0)throw new Error("Malformed buffer data: "+w)}var p={NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},f={ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"},d=[],h=0;function g(v){var y={object:new Worker(v),pending:0,requests:{}};return y.object.onmessage=function(b){var T=b.data;y.pending-=T.count,y.requests[T.id][T.action](T.value),delete y.requests[T.id]},y}function A(v){for(var y="var instance; var ready = WebAssembly.instantiate(new Uint8Array(["+new Uint8Array(l(o))+"]), {}).then(function(result) { instance = result.instance; instance.exports.__wasm_call_ctors(); });self.onmessage = workerProcess;"+c.toString()+E.toString(),b=new Blob([y],{type:"text/javascript"}),T=URL.createObjectURL(b),_=0;_<v;++_)d[_]=g(T);URL.revokeObjectURL(T)}function m(v,y,b,T,_){for(var S=d[0],R=1;R<d.length;++R)d[R].pending<S.pending&&(S=d[R]);return new Promise(function(M,H){var B=new Uint8Array(b),C=h++;S.pending+=v,S.requests[C]={resolve:M,reject:H},S.object.postMessage({id:C,count:v,size:y,source:B,mode:T,filter:_},[B.buffer])})}function E(v){u.then(function(){var y=v.data;try{var b=new Uint8Array(y.count*y.size);c(s.exports[y.mode],b,y.count,y.size,y.source,s.exports[y.filter]),self.postMessage({id:y.id,count:y.count,action:"resolve",value:b},[b.buffer])}catch(T){self.postMessage({id:y.id,count:y.count,action:"reject",value:T})}})}return{ready:u,supported:!0,useWorkers:function(v){A(v)},decodeVertexBuffer:function(v,y,b,T,_){c(s.exports.meshopt_decodeVertexBuffer,v,y,b,T,s.exports[p[_]])},decodeIndexBuffer:function(v,y,b,T){c(s.exports.meshopt_decodeIndexBuffer,v,y,b,T)},decodeIndexSequence:function(v,y,b,T){c(s.exports.meshopt_decodeIndexSequence,v,y,b,T)},decodeGltfBuffer:function(v,y,b,T,_,S){c(s.exports[f[_]],v,y,b,T,s.exports[p[S]])},decodeGltfBufferAsync:function(v,y,b,T,_){return d.length>0?m(v,y,b,f[T],p[_]):u.then(function(){var S=new Uint8Array(v*y);return c(s.exports[f[T]],S,v,y,b,s.exports[p[_]]),S})}}}(),EXTENSION_NAME$3="EXT_meshopt_compression",EXT_meshopt_compression=function(n){__extends(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t.prototype.loadBufferView=function(e,r){var o=r.json,s=o.bufferViews[e];if(s.extensions&&s.extensions[EXTENSION_NAME$3]){var u=s.extensions[EXTENSION_NAME$3],l=r.loadBuffer(u.buffer);if(!meshoptDecoder.supported){if(o.extensionsRequired&&o.extensionsRequired.indexOf(EXTENSION_NAME$3)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return Promise.all([l,meshoptDecoder.ready]).then(function(c){var p=c[0],f=u.byteOffset||0,d=u.byteLength||0,h=u.count,g=u.byteStride,A=new ArrayBuffer(h*g),m=new Uint8Array(p,f,d);return meshoptDecoder.decodeGltfBuffer(new Uint8Array(A),h,g,m,u.mode,u.filter),A})}else return null},t}(BaseExtension),EXTENSION_NAME$2="EXT_texture_webp",EXT_texture_webp=function(n){__extends(t,n);function t(){var e=n!==null&&n.apply(this,arguments)||this;return e.supportsWep=!1,e}return t.prototype.prepare=function(e){var r=this;return imageSupport().then(function(o){r.supportsWep=o.webp})},t.prototype.loadTexture=function(e,r){var o=r.json,s=o.textures[e];if(!s.extensions||!s.extensions[EXTENSION_NAME$2]||!this.supportsWep)return null;var u=s.extensions[EXTENSION_NAME$2];return r.loadImage(u.source).then(function(l){var c=new THREE__namespace.Texture(l);c.needsUpdate=!0,c.flipY=!1,s.name&&(c.name=s.name);var p=r.json.samplers||{},f=p[s.sampler]||{};return c.magFilter=WEBGL_FILTERS[f.magFilter]||THREE__namespace.LinearFilter,c.minFilter=WEBGL_FILTERS[f.minFilter]||THREE__namespace.LinearMipmapLinearFilter,c.wrapS=WEBGL_WRAPPINGS[f.wrapS]||THREE__namespace.RepeatWrapping,c.wrapT=WEBGL_WRAPPINGS[f.wrapT]||THREE__namespace.RepeatWrapping,c.onUpdate=function(){l.close()},c})},t}(BaseExtension),EXTENSION_NAME$1="CESIUM_RTC",CESIUM_RTC=function(n){__extends(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t.prototype.emitResult=function(e,r){if(r.json.extensions[EXTENSION_NAME$1]&&r.json.extensions[EXTENSION_NAME$1].center){var o=r.json.extensions[EXTENSION_NAME$1].center;e.CESIUM_RTC={center:new THREE__namespace.Vector3().fromArray(o)}}},t}(BaseExtension),PBM_mesh=function(n){__extends(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t.prototype.loadMesh=function(e,r){var o=this,s=r.json.meshes[e],u=s.primitives,l=Promise.all(u.map(function(f){return r.loadGeometry(f)})),c=Promise.all(u.map(function(f){return o.loadPBMMaterial(f,r)})),p=Promise.all([l,c]).then(function(f){for(var d=f[0],h=f[1],g=[],A=0;A<u.length;A++){var m=u[A],E=d[A],v=h[A],y=m.mode||WEBGL_CONSTANTS.TRIANGLES,b=void 0;if(y===WEBGL_CONSTANTS.TRIANGLES||y===WEBGL_CONSTANTS.TRIANGLE_STRIP||y===WEBGL_CONSTANTS.TRIANGLE_FAN)if(y===WEBGL_CONSTANTS.TRIANGLE_STRIP?E=r.toGeometryTrianglesDrawMode(E,THREE__namespace.TriangleStripDrawMode):y===WEBGL_CONSTANTS.TRIANGLE_FAN&&(E=r.toGeometryTrianglesDrawMode(E,THREE__namespace.TriangleFanDrawMode)),E.clearGroups(),E.addGroup(0,E.index?E.index.count:E.attributes.position.count,0),r.disposeSet.add(E),s.isSkinnedMesh){var T=new PBMSkinnedMesh(E,[v]);E.attributes.skinWeight.normalized||T.normalizeSkinWeights(),b=T}else b=new PBMMesh(E,[v]);else if(y===WEBGL_CONSTANTS.POINTS)b=new PBMPointCloud(E,v);else throw new Error("glTF: Primitive mode unsupported: "+y);if(Object.keys(E.morphAttributes).length>0){if(s.weights!==void 0)for(var _=0,S=s.weights.length;_<S;_++)b.morphTargetInfluences[_]=s.weights[_];if(s.extras&&Array.isArray(s.extras.targetNames)){var R=s.extras.targetNames;if(b.morphTargetInfluences.length===R.length){b.morphTargetDictionary={};for(var _=0,S=R.length;_<S;_++)b.morphTargetDictionary[R[_]]=_}else console.warn("glTF: Invalid extras.targetNames length. Ignoring names.")}}b.name=s.name||"mesh_"+e,r.assignFinalMaterial(b),g.push(b)}if(g.length===1)return g[0];for(var M=new THREE__namespace.Group,H=0,B=g;H<B.length;H++){var b=B[H];M.add(b)}return M});return p},t.prototype.loadPBMMaterial=function(e,r){var o,s=(o=e.mode)!==null&&o!==void 0?o:WEBGL_CONSTANTS.TRIANGLES,u=null;if(s===WEBGL_CONSTANTS.TRIANGLES||s===WEBGL_CONSTANTS.TRIANGLE_STRIP||s===WEBGL_CONSTANTS.TRIANGLE_FAN)u=this.loadPBMMeshMaterial(e,r);else if(s===WEBGL_CONSTANTS.POINTS)u=this.loadPBMPointCloudMaterial(e,r);else throw new Error("glTF: Primitive mode unsupported: "+s);return u=u.then(function(l){return Promise.all(values(r.extensions).map(function(c){return c.extendMaterial(l,e,r)})).then(function(){return l})}),u},t.prototype.extendTexture=function(e,r,o){return e.minFilter=THREE__namespace.LinearFilter,e.magFilter=THREE__namespace.LinearFilter,e.generateMipmaps=!1,e},t.prototype.loadPBMPointCloudMaterial=function(e,r){var o=new PBMPointCloudMaterial;return r.disposeSet.add(o),Promise.resolve(o)},t.prototype.loadPBMMeshMaterial=function(e,r){var o=[],s=r.extensions.KHR_materials_unlit?"basic":"standard",u=new PBMMeshMaterial(s);if(u.color=new THREE__namespace.Color(1,1,1),u.opacity=1,u.colorAlpha=1,e.material!==void 0){var l=r.json.materials[e.material];l.name&&(u.name=l.name);var c=l.pbrMetallicRoughness||{};if(Array.isArray(c.baseColorFactor)){var p=c.baseColorFactor;u.color=new THREE__namespace.Color().fromArray(p),u.colorAlpha=p[3]}c.baseColorTexture!==void 0&&o.push(r.createMaterialTexture(c.baseColorTexture).then(function(h){r.disposeSet.add(h),h.encoding=THREE__namespace.sRGBEncoding,u.map=h})),u.metalness=c.metallicFactor!==void 0?c.metallicFactor:1,u.roughness=c.roughnessFactor!==void 0?c.roughnessFactor:1,c.metallicRoughnessTexture!==void 0&&o.push(r.createMaterialTexture(c.metallicRoughnessTexture).then(function(h){r.disposeSet.add(h),h.encoding=THREE__namespace.sRGBEncoding,u.roughnessMap=h,u.metalnessMap=h})),l.doubleSided===!0&&(u.side=THREE__namespace.DoubleSide);var f=l.alphaMode||ALPHA_MODES.OPAQUE;if(u.alphaMode="OPAQUE",f===ALPHA_MODES.BLEND?(u.alphaMode="BLEND",u.transparent=!0,u.depthWrite=!1):(u.transparent=!1,f===ALPHA_MODES.MASK&&(u.alphaMode="MASK",u.alphaTest=l.alphaCutoff!==void 0?l.alphaCutoff:.5)),l.normalTexture!==void 0&&(o.push(r.createMaterialTexture(l.normalTexture).then(function(h){r.disposeSet.add(h),u.normalMap=h})),u.normalScale=new THREE__namespace.Vector2(1,1),l.normalTexture.scale!==void 0)){var d=l.normalTexture.scale;u.normalScale.set(d,d)}l.occlusionTexture!==void 0&&(o.push(r.createMaterialTexture(l.occlusionTexture).then(function(h){u.aoMap=h,r.disposeSet.add(h)})),l.occlusionTexture.strength!==void 0&&(u.aoMapIntensity=l.occlusionTexture.strength)),l.emissiveFactor!==void 0&&(u.emissive=new THREE__namespace.Color().fromArray(l.emissiveFactor)),l.emissiveTexture!==void 0&&o.push(r.createMaterialTexture(l.emissiveTexture).then(function(h){u.emissiveMap=h,r.disposeSet.add(h)}))}return r.disposeSet.add(u),Promise.all(o).then(function(){return u})},t}(BaseExtension),EXTENSION_NAME="REALSEE_materials_lightmap",REALSEE_materials_lightmap=function(n){__extends(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t.prototype.extendMaterial=function(e,r,o){var s=[];if(o.json.materials&&r.material!==void 0){var u=o.json.materials[r.material],l=u.extensions[EXTENSION_NAME];l&&(l.lightMapTexture!==void 0&&s.push(o.createMaterialTexture(l.lightMapTexture).then(function(c){e.lightMap=c})),l.lightMapIntensity!==void 0&&(e.lightMapIntensity=l.lightMapIntensity))}return Promise.all(s).then(function(){})},t}(BaseExtension),EXTENSIONS={KHR_binary_glTF,KHR_draco_mesh_compression,KHR_texture_basisu,KHR_texture_transform,KHR_mesh_quantization,KHR_materials_unlit,EXT_meshopt_compression,EXT_texture_webp,CESIUM_RTC,REALSEE_materials_lightmap,PBM_mesh};function parseGltf(n,t){var e,r,o,s={},u,l;if(typeof n=="string")l=n;else{var c=EXTENSIONS.KHR_binary_glTF.getMagic(n);if(c===EXTENSIONS.KHR_binary_glTF.HEADER_MAGIC){u=new EXTENSIONS.KHR_binary_glTF;try{u.loadGlbBinary(n)}catch(A){return Promise.reject(A)}s.KHR_binary_glTF=u,l=u.content}else l=decodeText(new Uint8Array(n))}var p=JSON.parse(l);if(t.jsonModify&&(p=t.jsonModify(p)),p.asset===void 0||Number(p.asset.version[0])<2)return Promise.reject(new Error("glTF: Unsupported asset. glTF versions >=2.0 are supported."));if(p.extensionsUsed)for(var f=p.extensionsRequired||[],d=0;d<p.extensionsUsed.length;d++){var h=p.extensionsUsed[d];s[h]||(EXTENSIONS[h]?s[h]=new EXTENSIONS[h]:f.indexOf(h)>=0&&console.warn('glTF: Unknown extension "'+h+'".'))}var g=new Parser(p,s,{copyUV2:(e=t.copyUV2)!==null&&e!==void 0?e:!0,resourcePath:(r=t.resourcePath)!==null&&r!==void 0?r:"",search:(o=t.search)!==null&&o!==void 0?o:"",fetcher:t.fetcher});return g.parse().then(function(A){return u&&u.clear(),A})}function loadB3dm(n,t){var e,r,o;t===void 0&&(t={});var s=(e=t.modelUpAxis)!==null&&e!==void 0?e:"Y",u=(r=t.upAxis)!==null&&r!==void 0?r:"Z",l=(o=t.fetcher)!==null&&o!==void 0?o:new Fetcher({allowHosts:["*"]}),c={uri:n,gltfUpAxis:s};return Promise.resolve().then(function(){return l.ajax(n,{responseType:"arraybuffer"}).then(function(p){return p.body})}).then(function(p){return Promise.resolve(0).then(function(f){return parseHeader$1(c,p,f)}).then(function(f){return parseTable(c,p,f)}).then(function(f){return parseGlTFArrayBuffer(c,p,f)})}).then(function(){var p;return parseGltf(c.gltfArrayBuffer,{copyUV2:!1,resourcePath:n.slice(0,n.lastIndexOf("/")+1),search:(p=n.split("?")[1])!==null&&p!==void 0?p:"",jsonModify:function(f){var d;if(f.extensionsUsed=(d=f.extensionsUsed)!==null&&d!==void 0?d:[],typeof t.light=="boolean"){var h="KHR_materials_unlit";if(t.light){var g=f.extensionsUsed.indexOf(h);g>=0&&f.extensionsUsed.splice(g,1)}else{var g=f.extensionsUsed.indexOf(h);g===-1&&f.extensionsUsed.push(h)}}{var h="PBM_mesh",g=f.extensionsUsed.indexOf(h);g===-1&&f.extensionsUsed.push(h)}return f},fetcher:l}).then(function(f){var d=new THREE__namespace.Matrix4;s==="Y"&&d.premultiply(ROTATE_X_MATRIX);var h;if(c.rtcCenter?h=new THREE__namespace.Vector3().fromArray(c.rtcCenter):f.CESIUM_RTC&&(h=new THREE__namespace.Vector3().copy(f.CESIUM_RTC.center)),h){var g=new THREE__namespace.Matrix4().setPosition(h);d.premultiply(g)}return u==="Y"&&d.premultiply(ROTATE_X_MATRIX_INVERSE),f.scene.applyMatrix4(d),delete c.featureTableBinary,delete c.batchTableBinary,delete c.gltfArrayBuffer,{type:"b3dm",modelUpAxis:s,upAxis:"Z",uri:c.uri,byteLength:c.byteLength,memoryUsage:getMemoryUsage(f.scene),scene:f.scene,textures:f.textures,animations:[],rtcCenter:h,dispose:function(){return f.dispose()}}})})}var WorkerPool=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,p=u.input,f=u.transfer;this.workersResolver[t]={resolve:l,reject:c},this.workers[t].postMessage(p,f)}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}();const encodedJs$1="KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO2Z1bmN0aW9uIEIoYSl7b25tZXNzYWdlPWZ1bmN0aW9uKHIpe1Byb21pc2UucmVzb2x2ZShyLmRhdGEpLnRoZW4oZnVuY3Rpb24obil7cmV0dXJuIGEobil9KS50aGVuKGZ1bmN0aW9uKG4pe3ZhciBlPW4ub3V0cHV0LHQ9bi50cmFuc2ZlcjtyZXR1cm4gcG9zdE1lc3NhZ2UoZSx0KX0pLmNhdGNoKGZ1bmN0aW9uKG4pe3JldHVybiBwb3N0TWVzc2FnZSh7JCRlcnJvcjpufSl9KX19dmFyIHUseTsoZnVuY3Rpb24oYSl7YVthLkJZVEU9NTEyMF09IkJZVEUiLGFbYS5VTlNJR05FRF9CWVRFPTUxMjFdPSJVTlNJR05FRF9CWVRFIixhW2EuU0hPUlQ9NTEyMl09IlNIT1JUIixhW2EuVU5TSUdORURfU0hPUlQ9NTEyM109IlVOU0lHTkVEX1NIT1JUIixhW2EuSU5UPTUxMjRdPSJJTlQiLGFbYS5VTlNJR05FRF9JTlQ9NTEyNV09IlVOU0lHTkVEX0lOVCIsYVthLkZMT0FUPTUxMjZdPSJGTE9BVCIsYVthLkRPVUJMRT01MTMwXT0iRE9VQkxFIn0pKHl8fCh5PXt9KSk7dmFyIGM9KHU9e30sdVt5LkRPVUJMRV09RmxvYXQ2NEFycmF5LHVbeS5GTE9BVF09RmxvYXQzMkFycmF5LHVbeS5VTlNJR05FRF9TSE9SVF09VWludDE2QXJyYXksdVt5LlVOU0lHTkVEX0lOVF09VWludDMyQXJyYXksdVt5LlVOU0lHTkVEX0JZVEVdPVVpbnQ4QXJyYXksdVt5LkJZVEVdPUludDhBcnJ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QgMCxFPXZvaWQgMCxTPXZvaWQgMCxzPXZvaWQgMCxUPXZvaWQgMDt0PG47dCsrKXY9dCoyLEE9clt2XSpELTEsTj1yWysrdl0qRC0xLFM9QTwwPy1BOkEscz1OPDA/LU46TixFPTEtKFMrcyksRTwwJiYoQT0oMS1zKSooQTwwPy0xOjEpLE49KDEtUykqKE48MD8tMToxKSksVD1NYXRoLnNxcnQoQSpBK04qTitFKkUpLHY9dCo0LGVbdl09QS9UKmgsZVsrK3ZdPU4vVCpoLGVbKyt2XT1FL1QqaDtyZXR1cm57YXJyYXk6ZSxpdGVtU2l6ZTo0LG5vcm1hbGl6ZWQ6ITB9fXJldHVybiBudWxsfX0pKCk7Cg==",decodeBase64$1=n=>Uint8Array.from(atob(n),t=>t.charCodeAt(0)),blob$1=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$1&&(self.URL||self.webkitURL).createObjectURL(blob$1),!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 attributeWorkerPool=new WorkerPool(function(){return new WorkerWrapper$1},2);function parsePointCloud(n,t,e){var r=new FeatureTable(n.featureTableJson,n.featureTableBinary);return Promise.resolve().then(function(){var o=r.getExtension("3DTILES_draco_point_compression");return o?parseDraco(o,r):attributeWorkerPool.postMessage({featureTableBinary:r.buffer,featureTableJson:r.json},[r.buffer.buffer])}).then(function(o){return n.attributes=o,e})}function parseDraco(n,t){return __awaiter(this,void 0,void 0,function(){var e,r,o,s,u,l;return __generator(this,function(c){if(e=n.properties||{},r=n.byteOffset,o=n.byteLength,!e||!Number.isFinite(r)||!o)throw new Error("Draco properties, byteOffset, and byteLength must be defined");return s=t.buffer.slice(r,r+o),u=n.properties,l={POSITION:"Float32Array",NORMAL:"Float32Array",RGB:"Uint8Array",RGBA:"Uint8Array"},[2,draco.decodeGeometry(s.buffer,{attributeIDs:u,attributeTypes:l,useUniqueIDs:!0}).then(function(p){var f=p.getAttribute("POSITION"),d=p.getAttribute("RGB"),h=p.getAttribute("RGBA"),g=p.getAttribute("NORMAL"),A;if(h)A=h;else if(d){for(var m=d.count,E=d.array,v=new Uint8Array(m*4),y=0,b=void 0,T=void 0;y<m;y++)T=y*4,b=y*3,v[T]=E[b],v[++T]=E[++b],v[++T]=E[++b];A=new THREE__namespace.BufferAttribute(v,4,d.normalized)}return{position:f?{array:f.array,itemSize:f.itemSize,normalized:f.normalized}:null,color:A?{array:A.array,itemSize:A.itemSize,normalized:A.normalized}:null,normal:g?{array:g.array,itemSize:g.itemSize,normalized:g.normalized}:null}})]})})}function loadPnts(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={uri:n};return Promise.resolve().then(function(){return s.ajax(n,{responseType:"arraybuffer"}).then(function(l){return l.body})}).then(function(l){return Promise.resolve(0).then(function(c){return parseHeader$1(u,l,c)}).then(function(c){return parseTable(u,l,c)}).then(function(c){return parsePointCloud(u,l,c)})}).then(function(){var l;return createPoints(u.attributes,{computeBoundingBox:(l=t.computeBoundingBox)!==null&&l!==void 0?l:!0})}).then(function(l){var c=new THREE__namespace.Matrix4,p;if(u.rtcCenter&&(p=new THREE__namespace.Vector3().fromArray(u.rtcCenter)),p){var f=new THREE__namespace.Matrix4().setPosition(p);c.premultiply(f)}return o==="Y"&&c.premultiply(ROTATE_X_MATRIX_INVERSE),l.object.applyMatrix4(c),delete u.gltfArrayBuffer,delete u.featureTableBinary,delete u.batchTableBinary,{type:"pnts",modelUpAxis:"Z",upAxis:o,uri:u.uri,byteLength:u.byteLength,memoryUsage:getMemoryUsage(l.object),scene:l.object,textures:[],animations:[],rtcCenter:p,dispose:function(){return l.dispose()}}})}function createPoints(n,t){var e=new Set,r=new THREE__namespace.BufferGeometry;e.add(r);var o=new PBMPointCloudMaterial;e.add(o),n.position&&r.setAttribute("position",new THREE__namespace.BufferAttribute(n.position.array,n.position.itemSize,n.position.normalized)),n.color&&r.setAttribute("color",new THREE__namespace.BufferAttribute(n.color.array,n.color.itemSize,n.color.normalized)),n.normal?r.setAttribute("normal",new THREE__namespace.BufferAttribute(n.normal.array,n.normal.itemSize,n.normal.normalized)):o.flatShading=!0,t.computeBoundingBox&&r.computeBoundingBox();var s=new PBMPointCloud(r,o);return s.matrix.compose(s.position,s.quaternion,s.scale),s.matrixAutoUpdate=!1,s.frustumCulled=!1,Promise.resolve({object:s,dispose:function(){e.forEach(function(u){u.dispose()}),e.clear()}})}function loadGltf(n,t){var e,r,o;t===void 0&&(t={});var s=(e=t.modelUpAxis)!==null&&e!==void 0?e:"Y",u=(r=t.upAxis)!==null&&r!==void 0?r:"Z",l=(o=t.fetcher)!==null&&o!==void 0?o:new Fetcher({allowHosts:["*"]}),c=0;return Promise.resolve().then(function(){return l.ajax(n,{responseType:"arraybuffer"}).then(function(p){return c=p.body.byteLength,p.body})}).then(function(p){var f;return parseGltf(p,{copyUV2:!1,resourcePath:n.slice(0,n.lastIndexOf("/")+1),search:(f=n.split("?")[1])!==null&&f!==void 0?f:"",jsonModify:function(d){var h;if(d.extensionsUsed=(h=d.extensionsUsed)!==null&&h!==void 0?h:[],typeof t.light=="boolean"){var g="KHR_materials_unlit";if(t.light){var A=d.extensionsUsed.indexOf(g);A>=0&&d.extensionsUsed.splice(A,1)}else{var A=d.extensionsUsed.indexOf(g);A===-1&&d.extensionsUsed.push(g)}}{var g="PBM_mesh",A=d.extensionsUsed.indexOf(g);A===-1&&d.extensionsUsed.push(g)}return d},fetcher:l})}).then(function(p){var f,d=new THREE__namespace.Matrix4;if(s==="Y"&&d.premultiply(ROTATE_X_MATRIX),p.CESIUM_RTC){var h=new THREE__namespace.Matrix4().setPosition(p.CESIUM_RTC.center);d.premultiply(h)}return u==="Y"&&d.premultiply(ROTATE_X_MATRIX_INVERSE),p.scene.applyMatrix4(d),{type:"gltf",modelUpAxis:s,upAxis:u,uri:n,byteLength:c,memoryUsage:getMemoryUsage(p.scene),scene:p.scene,textures:p.textures,animations:p.animations,rtcCenter:(f=p.CESIUM_RTC)===null||f===void 0?void 0:f.center,dispose:function(){return p.dispose()}}})}var scratchColor=new THREE__namespace.Color;function loadPly(n,t){var e,r,o;t===void 0&&(t={});var s=(e=t.modelUpAxis)!==null&&e!==void 0?e:"Z",u=(r=t.upAxis)!==null&&r!==void 0?r:"Z",l=(o=t.fetcher)!==null&&o!==void 0?o:new Fetcher({allowHosts:["*"]}),c=0;return Promise.resolve().then(function(){return l.ajax(n,{responseType:"arraybuffer"}).then(function(p){return c=p.body.byteLength,p.body})}).then(function(p){var f,d;return parsePly(p,{propertyNameMapping:(f=t.propertyNameMapping)!==null&&f!==void 0?f:{},customPropertyMapping:(d=t.customPropertyMapping)!==null&&d!==void 0?d:{}})}).then(function(p){var f=p.geometry;switch(t.type){case"geometry":{var d=f;return s==="Y"&&d.applyMatrix4(ROTATE_X_MATRIX),u==="Y"&&d.applyMatrix4(ROTATE_X_MATRIX_INVERSE),{type:"ply",modelUpAxis:s,upAxis:u,uri:n,byteLength:c,memoryUsage:getGeometryMemoryUsed(d),scene:d,textures:[],animations:[],dispose:function(){f.dispose()}}}case"line":{var h="color"in f.attributes,g=new THREE__namespace.LineBasicMaterial({vertexColors:h}),d=new THREE__namespace.Line(f,g);return d.computeLineDistances(),s==="Y"&&d.applyMatrix4(ROTATE_X_MATRIX),u==="Y"&&d.applyMatrix4(ROTATE_X_MATRIX_INVERSE),{type:"ply",modelUpAxis:s,upAxis:u,uri:n,byteLength:c,memoryUsage:getMemoryUsage(d),scene:d,textures:[],animations:[],dispose:function(){f.dispose(),g.dispose()}}}case"pbmMesh":{var A=new PBMMeshMaterial(t.light?"phong":"basic");A.vertexColors="color"in f.attributes;var d=new THREE__namespace.Mesh(f,A);return s==="Y"&&d.applyMatrix4(ROTATE_X_MATRIX),u==="Y"&&d.applyMatrix4(ROTATE_X_MATRIX_INVERSE),{type:"ply",modelUpAxis:s,upAxis:u,uri:n,byteLength:c,memoryUsage:getMemoryUsage(d),scene:d,textures:[],animations:[],dispose:function(){f.dispose(),A.dispose()}}}case"pbmPointCloud":{var m=new PBMPointCloudMaterial,d=new PBMPointCloud(f,m);return s==="Y"&&d.applyMatrix4(ROTATE_X_MATRIX),u==="Y"&&d.applyMatrix4(ROTATE_X_MATRIX_INVERSE),{type:"ply",modelUpAxis:s,upAxis:u,uri:n,byteLength:c,memoryUsage:getMemoryUsage(d),scene:d,textures:[],animations:[],dispose:function(){f.dispose(),m.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,p=0;p<l.length;p++){var f=l[p];if(f=f.trim(),f!==""){var d=f.split(/\s+/),h=d.shift();switch(f=d.join(" "),h){case"format":u.format=d[0],u.version=d[1];break;case"comment":u.comments.push(f);break;case"element":c&&u.elements.push(c),c={name:d[0],count:parseInt(d[1]),properties:[]};break;case"property":c&&c.properties.push(makePlyElementProperty(d,e));break;case"obj_info":u.objInfo=f;break;default:console.log("unhandled",h,d)}}}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 p=t.elements[c],f=mapElementAttributes(p.properties),d=0;d<p.count;d++){var h=parseASCIIElement(p.properties,l);if(!h)break e;handleElement(r,p.name,h,f,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,p=u.normalized,f=c.length,d=void 0;switch(l){case"float32":d=new THREE__namespace.Float32BufferAttribute(n[s],f,p);break;case"uint32":d=new THREE__namespace.Uint32BufferAttribute(n[s],f,p);break;case"int32":d=new THREE__namespace.Int32BufferAttribute(n[s],f,p);break;case"uint16":d=new THREE__namespace.Uint16BufferAttribute(n[s],f,p);break;case"int16":d=new THREE__namespace.Int16BufferAttribute(n[s],f,p);break;case"uint8":d=new THREE__namespace.Uint8BufferAttribute(n[s],f,p);break;case"int8":d=new THREE__namespace.Int8BufferAttribute(n[s],f,p);break;default:d=new THREE__namespace.Float32BufferAttribute(n[s],f,p);break}e.setAttribute(s,d)}}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,p=o.customPropertyMapping[l].itemNames;c<p.length;c++){var f=p[c];n[l].push(e[f])}}else if(t==="face"){var d=e.vertex_indices||e.vertex_index,h=e.texcoord;d.length===3?(n.indices.push(d[0],d[1],d[2]),h&&h.length===6&&(n.faceVertexUvs.push(h[0],h[1]),n.faceVertexUvs.push(h[2],h[3]),n.faceVertexUvs.push(h[4],h[5]))):d.length===4&&(n.indices.push(d[0],d[1],d[3]),n.indices.push(d[1],d[2],d[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 p=0;p<c;p++)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,p){switch(c){case"int8":case"char":return{read:function(f){return l.getInt8(f)},size:1};case"uint8":case"uchar":return{read:function(f){return l.getUint8(f)},size:1};case"int16":case"short":return{read:function(f){return l.getInt16(f,p)},size:2};case"uint16":case"ushort":return{read:function(f){return l.getUint16(f,p)},size:2};case"int32":case"int":return{read:function(f){return l.getInt32(f,p)},size:4};case"uint32":case"uint":return{read:function(f){return l.getUint32(f,p)},size:4};case"float32":case"float":return{read:function(f){return l.getFloat32(f,p)},size:4};case"float64":case"double":return{read:function(f){return l.getFloat64(f,p)},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 p=t.elements[c],f=p.properties,d=mapElementAttributes(f);setPropertyBinaryReaders(f,s,o);for(var h=0;h<p.count;h++){u=binaryReadElement(l,f),l+=u[1];var g=u[0];handleElement(r,p.name,g,d,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!==`
|
|
917
|
-
`&&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}(),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;var _b=freb(fdeb,0),fd=_b.b,rev=new u16(32768);for(var 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}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 p=o<<4|n[o],f=t-n[o],d=u[n[o]-1]++<<f,h=d|(1<<f)-1;d<=h;++d)l[rev[d]>>c]=p}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);for(var 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;var fdt=new u8(32);for(var 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 p=function(le){var ae=e.length;if(le>ae){var oe=new u8(Math.max(ae*2,le));oe.set(e),e=oe}},f=t.f||0,d=t.p||0,h=t.b||0,g=t.l,A=t.d,m=t.m,E=t.n,v=o*8;do{if(!g){f=bits(n,d,1);var y=bits(n,d+1,3);if(d+=3,y)if(y==1)g=flrm,A=fdrm,m=9,E=5;else if(y==2){var S=bits(n,d,31)+257,R=bits(n,d+10,15)+4,M=S+bits(n,d+5,31)+1;d+=14;for(var H=new u8(M),B=new u8(19),C=0;C<R;++C)B[clim[C]]=bits(n,d+C*3,7);d+=R*3;for(var w=max(B),I=(1<<w)-1,O=hMap(B,w,1),C=0;C<M;){var L=O[bits(n,d,I)];d+=L&15;var b=L>>4;if(b<16)H[C++]=b;else{var N=0,z=0;for(b==16?(z=3+bits(n,d,3),d+=2,N=H[C-1]):b==17?(z=3+bits(n,d,7),d+=3):b==18&&(z=11+bits(n,d,127),d+=7);z--;)H[C++]=N}}var J=H.subarray(0,S),K=H.subarray(S);m=max(J),E=max(K),g=hMap(J,m,1),A=hMap(K,E,1)}else err(1);else{var b=shft(d)+4,T=n[b-4]|n[b-3]<<8,_=b+T;if(_>o){c&&err(0);break}l&&p(h+T),e.set(n.subarray(b,_),h),t.b=h+=T,t.p=d=_*8,t.f=f;continue}if(d>v){c&&err(0);break}}l&&p(h+131072);for(var Q=(1<<m)-1,U=(1<<E)-1,q=d;;q=d){var N=g[bits16(n,d)&Q],X=N>>4;if(d+=N&15,d>v){c&&err(0);break}if(N||err(2),X<256)e[h++]=X;else if(X==256){q=d,g=null;break}else{var Z=X-254;if(X>264){var C=X-257,W=fleb[C];Z=bits(n,d,(1<<W)-1)+fl[C],d+=W}var G=A[bits16(n,d)&U],ne=G>>4;G||err(3),d+=G&15;var K=fd[ne];if(ne>3){var W=fdeb[ne];K+=bits16(n,d)&(1<<W)-1,d+=W}if(d>v){c&&err(0);break}l&&p(h+131072);var $=h+Z;if(h<K){var ee=s-K,re=Math.min(K,$);for(ee+h<0&&err(3);h<re;++h)e[h]=r[ee+h]}for(;h<$;++h)e[h]=e[h-K]}}t.l=g,t.p=q,t.b=h,t.f=f,g&&(f=1,t.m=m,t.d=A,t.n=E)}while(!f);return h!=e.length&&u?slc(e,0,h):e.subarray(0,h)},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],p=l[1],f=l[2];return[b2(n,t+10),c,p,o,s+b2(n,t+30)+b2(n,t+32),f]},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 p=zh(n,s,u),f=p[0],d=p[1],h=p[2],g=p[3],A=p[4],m=p[5],E=slzh(n,m);s=A,f?f==8?e[g]=inflateSync(n.subarray(E,E+d),{out:new u8(h)}):err(14,"unknown compression type "+f):e[g]=slc(n,E,E+d)}return e}function loadFbx(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;return parse$2(l,{light:t.light,resourcePath:n.slice(0,n.lastIndexOf("/")+1),search:(c=n.split("?")[1])!==null&&c!==void 0?c:"",fetcher:s})}).then(function(l){var c=l.scene,p=l.unitScale/100,f=new THREE__namespace.Matrix4;if(f.makeScale(p,p,p),l.upAxis==="X")throw new Error("Cannot load fbx x upAxis");return l.upAxis==="Y"&&f.premultiply(ROTATE_X_MATRIX),o==="Y"&&f.premultiply(ROTATE_X_MATRIX_INVERSE),c.applyMatrix4(f),{type:"fbx",modelUpAxis:l.upAxis,upAxis:o,uri:n,byteLength:u,memoryUsage:getMemoryUsage(c),scene:c,textures:l.textures,animations:l.animations,dispose:function(){return l.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.light=(e=t.light)!==null&&e!==void 0?e:!0,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),p=Object.assign(new THREE__namespace.Group,{animations:[]}),f=[],d=this.parseImages(t),h=this.parseTextures(t,d,c,f),g=this.parseMaterials(t,h,c),A=this.parseDeformers(t,c),m=new GeometryParser().parse(t,A,c);this.parseScene(t,A,m,g,c,p);var E=(r=(e=t.GlobalSettings.UpAxis)===null||e===void 0?void 0:e.value)!==null&&r!==void 0?r:1,v=(s=(o=t.GlobalSettings.FrontAxis)===null||o===void 0?void 0:o.value)!==null&&s!==void 0?s:2,y=(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],S=T[1],R=T[2];if(_!==0||S!==0||R!==0){var M=new THREE__namespace.Color().setRGB(_,S,R);b=new THREE__namespace.AmbientLight(M,1)}}return Promise.all(f).then(function(H){var B;return{scene:p,textures:H,ambientLight:b,upAxis:["X","Y","Z"][E],frontAxis:["X","Y","Z"][v],unitScale:y,animations:(B=p.animations)!==null&&B!==void 0?B:[],dispose:function(){H.forEach(function(C){return C.dispose()}),g.forEach(function(C){return C.dispose()}),m.forEach(function(C){return C.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 p={ID:s,relationship:l};e.get(u).children.push(p)})}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,p=typeof u.Content=="string"&&u.Content!=="";if(c||p){var f=this.parseImage(o[s]);r[u.RelativeFilename||u.Filename]=f}}}}for(var l in e){var d=e[l];r[d]!==void 0?e[l]=r[d]: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,p=l!==void 0?l.value:0;if(s.wrapS=c===0?THREE__namespace.RepeatWrapping:THREE__namespace.ClampToEdgeWrapping,s.wrapT=p===0?THREE__namespace.RepeatWrapping:THREE__namespace.ClampToEdgeWrapping,t.Scaling){var f=t.Scaling.value;s.repeat.x=f[0],s.repeat.y=f[1]}if(t.Translation){var f=t.Translation.value;s.offset.x=f[0],s.offset.y=f[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(f){return f.body});var p=c.then(function(f){return l.image=f,l.needsUpdate=!0,l}).catch(function(f){return console.warn(f),l});return o.push(p),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,u=e.attrName,l=e.ShadingModel;if(typeof l=="object"&&(l=l.value),l=l.toLowerCase(),!o.has(s))return null;var c=new PBMMeshMaterial(this.light?"phong":"basic");c.name=u,e.BumpFactor&&(c.bumpScale=e.BumpFactor.value),e.Diffuse?c.color=new THREE__namespace.Color().fromArray(e.Diffuse.value):e.DiffuseColor&&(e.DiffuseColor.type==="Color"||e.DiffuseColor.type==="ColorRGB")&&(c.color=new THREE__namespace.Color().fromArray(e.DiffuseColor.value)),e.DisplacementFactor&&(c.displacementScale=e.DisplacementFactor.value),e.Emissive?c.emissive=new THREE__namespace.Color().fromArray(e.Emissive.value):e.EmissiveColor&&(e.EmissiveColor.type==="Color"||e.EmissiveColor.type==="ColorRGB")&&(c.emissive=new THREE__namespace.Color().fromArray(e.EmissiveColor.value)),e.EmissiveFactor&&(c.emissiveIntensity=parseFloat(e.EmissiveFactor.value));var p=1-(e.TransparencyFactor?parseFloat(e.TransparencyFactor.value):0);(p===1||p===0)&&(p=e.Opacity?parseFloat(e.Opacity.value):null,p===null&&(p=1-(e.TransparentColor?parseFloat(e.TransparentColor.value[0]):0))),c.opacity=p,c.opacity<1&&(c.transparent=!0),e.ReflectionFactor&&(c.reflectivity=e.ReflectionFactor.value),e.Shininess&&(c.shininess=e.Shininess.value),e.Specular?c.specular=new THREE__namespace.Color().fromArray(e.Specular.value):e.SpecularColor&&e.SpecularColor.type==="Color"&&(c.specular=new THREE__namespace.Color().fromArray(e.SpecularColor.value));var f=this;return o.get(s).children.forEach(function(d){var h=d.relationship;switch(h){case"Bump":c.bumpMap=f.getTexture(t,r,d.ID,o);break;case"Maya|TEX_ao_map":c.aoMap=f.getTexture(t,r,d.ID,o);break;case"DiffuseColor":case"Maya|TEX_color_map":c.map=f.getTexture(t,r,d.ID,o),c.map!==void 0&&(c.map.encoding=THREE__namespace.sRGBEncoding);break;case"DisplacementColor":c.displacementMap=f.getTexture(t,r,d.ID,o);break;case"EmissiveColor":c.emissiveMap=f.getTexture(t,r,d.ID,o),c.emissiveMap!==void 0&&(c.emissiveMap.encoding=THREE__namespace.sRGBEncoding);break;case"NormalMap":case"Maya|TEX_normal_map":c.normalMap=f.getTexture(t,r,d.ID,o);break;case"ReflectionColor":c.envMap=f.getTexture(t,r,d.ID,o),c.envMap!==void 0&&(c.envMap.mapping=THREE__namespace.EquirectangularReflectionMapping,c.envMap.encoding=THREE__namespace.sRGBEncoding);break;case"SpecularColor":c.specularMap=f.getTexture(t,r,d.ID,o),c.specularMap!==void 0&&(c.specularMap.encoding=THREE__namespace.sRGBEncoding);break;case"TransparentColor":case"TransparencyFactor":c.alphaMap=f.getTexture(t,r,d.ID,o),c.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.",h);break}}),c},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 p=this.parseSkeleton(c,s);p.ID=u,c.parents.length>1&&console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."),p.geometryID=c.parents[0].ID,r[u]=p}else if(l.attrType==="BlendShape"){var f={id:u};f.rawTargets=this.parseMorphTargets(c,s,e),f.id=u,c.parents.length>1&&console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."),o[u]=f}}}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(p){return p.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,p=this;l.forEach(function(d){var h=c[d.ID];p.setLookAtProperties(t,d,h,s,u);var g=s.get(d.ID).parents;g.forEach(function(A){var m=l.get(A.ID);m!==void 0&&m.add(d)}),d.parent===null&&u.add(d)}),this.bindSkeleton(t,e.skeletons,r,l,s),u.traverse(function(d){if(d.userData.transformData){d.parent&&(d.userData.transformData.parentMatrix=d.parent.matrix,d.userData.transformData.parentMatrixWorld=d.parent.matrixWorld);var h=generateTransform(d.userData.transformData);d.applyMatrix4(h),d.updateWorldMatrix(!0,!0)}});var f=new AnimationParser().parse(t,s,u);u.children.length===1&&u.children[0]instanceof THREE__namespace.Group&&(u=u.children[0]),u.animations=f},n.prototype.parseModels=function(t,e,r,o,s){var u=new Map,l=t.Objects.Model;for(var c in l){var p=parseInt(c),f=l[c],d=s.get(p),h=this.buildSkeleton(d,e,p,f.attrName);if(!h){switch(f.attrType){case"Camera":h=this.createCamera(t,d);break;case"Light":h=this.createLight(t,d);break;case"Mesh":h=this.createMesh(d,r,o);break;case"NurbsCurve":case"LimbNode":case"Root":h=new THREE__namespace.Bone;break;case"Null":default:h=new THREE__namespace.Group;break}h.name=f.attrName?THREE__namespace.PropertyBinding.sanitizeNodeName(f.attrName):"",h.userData.originalName=f.attrName,h.ID=p}this.getTransformData(h,f),u.set(p,h)}return u},n.prototype.buildSkeleton=function(t,e,r,o){var s=null;return t.parents.forEach(function(u){var l=function(p){var f=e[p];f.rawBones.forEach(function(d,h){if(d.ID===u.ID){var g=s;s=new THREE__namespace.Bone,s.matrixWorld.copy(d.transformLink),s.name=o?THREE__namespace.PropertyBinding.sanitizeNodeName(o):"",s.userData.originalName=o,s.ID=r,f.bones[h]=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 A=t.Objects.NodeAttribute[g.ID];A!==void 0&&(o=A)}),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,p=window.innerHeight;o.AspectWidth!==void 0&&o.AspectHeight!==void 0&&(c=o.AspectWidth.value,p=o.AspectHeight.value);var f=c/p,d=45;o.FieldOfView!==void 0&&(d=o.FieldOfView.value);var h=o.FocalLength?o.FocalLength.value:null;switch(s){case 0:r=new THREE__namespace.PerspectiveCamera(d,f,u,l),h!==null&&r.setFocalLength(h);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(h){var g=t.Objects.NodeAttribute[h.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 p=1;switch(s){case 0:r=new THREE__namespace.PointLight(u,l,c,p);break;case 1:r=new THREE__namespace.DirectionalLight(u,l);break;case 2:var f=Math.PI/3;o.InnerAngle!==void 0&&(f=THREE__namespace.MathUtils.degToRad(o.InnerAngle.value));var d=0;o.OuterAngle!==void 0&&(d=THREE__namespace.MathUtils.degToRad(o.OuterAngle.value),d=Math.max(d,1)),r=new THREE__namespace.SpotLight(u,l,c,f,d,p);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.light?"phong":"basic");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?(u.forEach(function(c){c.skinning=!0}),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 p=c.Lcl_Translation.value;"target"in e&&e.target instanceof THREE__namespace.Object3D?(e.target.position.fromArray(p),s.add(e.target)):e.lookAt(new THREE__namespace.Vector3().fromArray(p))}}})}},n.prototype.bindSkeleton=function(t,e,r,o,s){var u=this.parsePoseNodes(t),l=function(p){var f=e[p],d=s.get(parseInt(f.ID)).parents;d.forEach(function(h){if(r.has(h.ID)){var g=h.ID,A=s.get(g);A.parents.forEach(function(m){if(o.has(m.ID)){var E=o.get(m.ID);E instanceof THREE__namespace.SkinnedMesh&&E.bind(new THREE__namespace.Skeleton(f.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(h){return t.Objects.Model[h.ID]});if(l.length!==0){var c=e.children.reduce(function(h,g){return s[g.ID]!==void 0&&(h=s[g.ID]),h},null);e.children.forEach(function(h){o.morphTargets[h.ID]!==void 0&&u.push(o.morphTargets[h.ID])});var p=l[0],f={};p.RotationOrder&&(f.eulerOrder=getEulerOrder(p.RotationOrder.value)),p.InheritType&&(f.inheritType=parseInt(p.InheritType.value)),p.GeometricTranslation&&(f.translation=p.GeometricTranslation.value),p.GeometricRotation&&(f.rotation=p.GeometricRotation.value),p.GeometricScaling&&(f.scale=p.GeometricScaling.value);var d=generateTransform(f);return this.genGeometry(t,r,c,u,d)}},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),p=new THREE__namespace.Float32BufferAttribute(c.vertex,3);if(p.applyMatrix4(s),u.setAttribute("position",p),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 f=new THREE__namespace.Matrix3().getNormalMatrix(s),d=new THREE__namespace.Float32BufferAttribute(c.normal,3);d.applyNormalMatrix(f),u.setAttribute("normal",d)}if(c.uvs.forEach(function(E,v){var y=v===0?"uv":"uv".concat(v+1);u.setAttribute(y,new THREE__namespace.Float32BufferAttribute(c.uvs[v],2))}),l.material&&l.material.mappingType!=="AllSame"){var h=c.materialIndex[0],g=0;if(c.materialIndex.forEach(function(E,v){E!==h&&(u.addGroup(g,v-g,h),h=E,g=v)}),u.groups.length>0){var A=u.groups[u.groups.length-1],m=A.start+A.count;m!==c.materialIndex.length&&u.addGroup(m,c.materialIndex.length-m,h)}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=[],p=[],f=[],d=[],h=this;return t.vertexIndices.forEach(function(g,A){var m=0,E=!1;g<0&&(g=g^-1,E=!0);var v=[],y=[];if(u.push(g*3,g*3+1,g*3+2),t.color){var b=getData(A,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(R){y.push(R.weight),v.push(R.id)}),y.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];y.forEach(function(R,M){var H=R,B=v[M];_.forEach(function(C,w,I){if(H>C){I[w]=H,H=C;var O=T[w];T[w]=B,B=O}})}),v=T,y=_}for(;y.length<4;)y.push(0),v.push(0);for(var S=0;S<4;++S)f.push(y[S]),d.push(v[S])}if(t.normal){var b=getData(A,r,g,t.normal);l.push(b[0],b[1],b[2])}t.material&&t.material.mappingType!=="AllSame"&&(m=getData(A,r,g,t.material)[0],m<0&&(h.negativeMaterialIndices=!0,m=0)),t.uv&&t.uv.forEach(function(R,M){var H=getData(A,r,g,R);p[M]===void 0&&(p[M]=[]),p[M].push(H[0]),p[M].push(H[1])}),o++,E&&(h.genFace(e,t,u,m,l,c,p,f,d,o),r++,o=0,u=[],l=[],c=[],p=[],f=[],d=[])}),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,p,f){var d;if(f>3){for(var h=[],g=e.baseVertexPositions||e.vertexPositions,A=0;A<r.length;A+=3)h.push(new THREE__namespace.Vector3(g[r[A]],g[r[A+1]],g[r[A+2]]));for(var m=this.getNormalTangentAndBitangent(h),E=m.tangent,v=m.bitangent,y=[],b=0,T=h;b<T.length;b++){var _=T[b];y.push(this.flattenVertex(_,E,v))}d=THREE__namespace.ShapeUtils.triangulateShape(y,[])}else d=[[0,1,2]];for(var S=function(I,O,L){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[O*3]]),t.vertex.push(e.vertexPositions[r[O*3+1]]),t.vertex.push(e.vertexPositions[r[O*3+2]]),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]]),e.skeleton&&(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[O*4]),t.vertexWeights.push(c[O*4+1]),t.vertexWeights.push(c[O*4+2]),t.vertexWeights.push(c[O*4+3]),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.weightsIndices.push(p[I*4]),t.weightsIndices.push(p[I*4+1]),t.weightsIndices.push(p[I*4+2]),t.weightsIndices.push(p[I*4+3]),t.weightsIndices.push(p[O*4]),t.weightsIndices.push(p[O*4+1]),t.weightsIndices.push(p[O*4+2]),t.weightsIndices.push(p[O*4+3]),t.weightsIndices.push(p[L*4]),t.weightsIndices.push(p[L*4+1]),t.weightsIndices.push(p[L*4+2]),t.weightsIndices.push(p[L*4+3])),e.color&&(t.colors.push(u[I*3]),t.colors.push(u[I*3+1]),t.colors.push(u[I*3+2]),t.colors.push(u[O*3]),t.colors.push(u[O*3+1]),t.colors.push(u[O*3+2]),t.colors.push(u[L*3]),t.colors.push(u[L*3+1]),t.colors.push(u[L*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[I*3]),t.normal.push(s[I*3+1]),t.normal.push(s[I*3+2]),t.normal.push(s[O*3]),t.normal.push(s[O*3+1]),t.normal.push(s[O*3+2]),t.normal.push(s[L*3]),t.normal.push(s[L*3+1]),t.normal.push(s[L*3+2])),e.uv&&e.uv.forEach(function(N,z){t.uvs[z]===void 0&&(t.uvs[z]=[]),t.uvs[z].push(l[z][I*2]),t.uvs[z].push(l[z][I*2+1]),t.uvs[z].push(l[z][O*2]),t.uvs[z].push(l[z][O*2+1]),t.uvs[z].push(l[z][L*2]),t.uvs[z].push(l[z][L*2+1])})},R=0,M=d;R<M.length;R++){var H=M[R],B=H[0],C=H[1],w=H[2];S(B,C,w)}},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 p=t.Objects.Geometry[c.geoID];p!==void 0&&u.genMorphGeometry(e,r,p,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:[],p=r.Indexes?r.Indexes.a:[],f=t.attributes.position.count*3,d=new Float32Array(f),h=0;h<p.length;h++){var g=p[h]*3;d[g]=c[h*3],d[g+1]=c[h*3+1],d[g+2]=c[h*3+2]}var A={vertexIndices:l,vertexPositions:d,baseVertexPositions:u},m=this.genBuffers(A),E=new THREE__namespace.Float32BufferAttribute(m.vertex,3);E.name=s||r.attrName,E.applyMatrix4(o),t.morphAttributes.position.push(E)},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 p,f;if(t.Form==="Closed")s.push(s[0]);else if(t.Form==="Periodic"){p=r,f=o.length-1-p;for(var l=0;l<r;++l)s.push(s[l])}var d=new NURBSCurve(r,o,s,p,f),h=d.getPoints(s.length*12);return new THREE__namespace.BufferGeometry().setFromPoints(h)},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,p=l.parents[0].relationship,f=e.get(c);f&&(p.match(/X/)?f.curves.x=u:p.match(/Y/)?f.curves.y=u:p.match(/Z/)?f.curves.z=u:p.match(/DeformPercent/)&&e.has(c)&&(f.curves.morph=u))}}},n.prototype.parseAnimationLayers=function(t,e,r,o){var s=t.Objects.AnimationLayer,u=new Map,l=function(p){var f=[],d=r.get(parseInt(p));if(d!==void 0){var h=d.children;h.forEach(function(g,A){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(f[A]===void 0){var E=r.get(g.ID).parents.filter(function(M){return M.relationship!==void 0})[0].ID;if(E!==void 0){var v=t.Objects.Model[E.toString()];if(v===void 0){console.warn("THREE.FBXLoader: Encountered a unused curve.",g);return}var y={modelName:v.attrName?THREE__namespace.PropertyBinding.sanitizeNodeName(v.attrName):"",ID:v.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===v.id&&(y.transform=M.matrix,M.userData.transformData&&(y.eulerOrder=M.userData.transformData.eulerOrder))}),y.transform||(y.transform=new THREE__namespace.Matrix4),v.PreRotation&&(y.preRotation=v.PreRotation.value),v.PostRotation&&(y.postRotation=v.PostRotation.value),f[A]=y}}f[A]&&(f[A][m.attr]=m)}else if(m.curves.morph!==void 0){if(f[A]===void 0){var b=r.get(g.ID).parents.filter(function(H){return H.relationship!==void 0})[0].ID,T=r.get(b).parents[0].ID,_=r.get(T).parents[0].ID,E=r.get(_).parents[0].ID,S=t.Objects.Model[E],R={modelName:S.attrName?THREE__namespace.PropertyBinding.sanitizeNodeName(S.attrName):"",morphName:t.Objects.Deformer[b].attrName};f[A]=R}f[A][m.attr]=m}}}),u.set(parseInt(p),f)}};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 p=this.generateRotationTrack(t.modelName,t.R.curves,t.preRotation,t.postRotation,t.eulerOrder);p!==void 0&&r.push(p)}if(t.S!==void 0&&Object.keys(t.S.curves).length>0){var f=this.generateVectorTrack(t.modelName,t.S.curves,l,"scale");f!==void 0&&r.push(f)}if(t.DeformPercent!==void 0){var d=this.generateMorphTrack(t,e);d!==void 0&&r.push(d)}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 p=getEulerOrder(0),f=new THREE__namespace.Quaternion,d=new THREE__namespace.Quaternion;r!==void 0&&(r=r.map(THREE__namespace.MathUtils.degToRad),r.push(p),f.setFromEuler(new THREE__namespace.Euler().fromArray(r))),o!==void 0&&(o=o.map(THREE__namespace.MathUtils.degToRad),o.push(p),d.setFromEuler(new THREE__namespace.Euler().fromArray(o)),d.inverse());var h=new THREE__namespace.Quaternion,g=new THREE__namespace.Euler,A=[];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),h.setFromEuler(g),h.premultiply(f),h.multiply(d),m>2){var E=new THREE__namespace.Quaternion().fromArray(A,(m-3)/3*4);E.dot(h)<0&&h.set(-h.x,-h.y,-h.z,-h.w)}h.toArray(A,m/3*4)}return new THREE__namespace.QuaternionKeyframeTrack(t+".quaternion",u,A)},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(p){if(e.x&&(u=e.x.times.indexOf(p)),e.y&&(l=e.y.times.indexOf(p)),e.z&&(c=e.z.times.indexOf(p)),u!==-1){var f=e.x.values[u];s.push(f),o[0]=f}else s.push(o[0]);if(l!==-1){var d=e.y.values[l];s.push(d),o[1]=d}else s.push(o[1]);if(c!==-1){var h=e.z.values[c];s.push(h),o[2]=h}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 p=c.map(THREE__namespace.MathUtils.degToRad),f=[t.values[l],e.values[l],r.values[l]];if(!(isNaN(f[0])||isNaN(f[1])||isNaN(f[2]))){f.map(THREE__namespace.MathUtils.degToRad);var d=[f[0]-c[0],f[1]-c[1],f[2]-c[2]],h=[Math.abs(d[0]),Math.abs(d[1]),Math.abs(d[2])];if(h[0]>=180||h[1]>=180||h[2]>=180){var g=Math.max.apply(Math,h),A=g/180,m=new THREE__namespace.Euler(p[0],p[1],p[2],o),E=new THREE__namespace.Euler(p[0],p[1],p[2],o),v=new THREE__namespace.Quaternion().setFromEuler(m),y=new THREE__namespace.Quaternion().setFromEuler(E);v.dot(y)&&y.set(-y.x,-y.y,-y.z,-y.w);for(var b=t.times[l-1],T=t.times[l]-b,_=new THREE__namespace.Quaternion,S=new THREE__namespace.Euler,R=0;R<1;R+=1/A)_.copy(v.clone().slerp(y.clone(),R)),s.push(b+R*T),S.setFromQuaternion(_,o),u.push(S.x),u.push(S.y),u.push(S.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+):(.*){"),p=o.match("^\\t{"+e.currentIndent+"}(\\w+):[\\s\\t\\r\\n](.*)"),f=o.match("^\\t{"+(e.currentIndent-1)+"}}");c?e.parseNodeBegin(o,c):p?e.parseNodeProperty(o,p,r[++s]):f?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),p=parseInt(c[0]),f=parseInt(c[1]),d=s.split(",").slice(3);d=d.map(function(h){return h.trim().replace(/^"/,"")}),o="connections",s=[p,f],append(s,d),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(f){return f.trim().replace(/^\"/,"").replace(/\s/,"_")}),s=o[0],u=o[1],l=o[2],c=o[3],p=o[4];switch(u){case"int":case"enum":case"bool":case"ULongLong":case"double":case"Number":case"FieldOfView":p=parseFloat(p);break;case"Color":case"ColorRGB":case"Vector3D":case"Lcl_Translation":case"Lcl_Rotation":case"Lcl_Scaling":p=parseNumberArray(p);break}this.getPrevNode()[s]={type:u,type2:l,flag:c,value:p},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=[],p=0;p<s;p++)c.push(this.parseProperty(t));var f=c.length>0?c[0]:"",d=c.length>1?c[1]:"",h=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 f=="number"&&(r.id=f),d!==""&&(r.attrName=d),h!==""&&(r.attrType=h),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(h,g){g!==0&&s.push(h)}),e.connections===void 0&&(e.connections=[]),e.connections.push(s)}else if(r.name==="Properties70"){var u=Object.keys(r);u.forEach(function(h){e[h]=r[h]})}else if(t==="Properties70"&&r.name==="P"){var l=r.propertyList[0],c=r.propertyList[1],p=r.propertyList[2],f=r.propertyList[3],d=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?d=[r.propertyList[4],r.propertyList[5],r.propertyList[6]]:d=r.propertyList[4],e[l]={type:c,type2:p,flag:f,value:d}}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,p=new THREE__namespace.Matrix4,f=new THREE__namespace.Matrix4,d=new THREE__namespace.Matrix4,h=new THREE__namespace.Matrix4,g=n.inheritType?n.inheritType:0;n.translation&&t.setPosition(tempVec.fromArray(n.translation));var A=getEulerOrder(0);if(n.preRotation){var m=n.preRotation.map(THREE__namespace.MathUtils.degToRad);m.push(A),e.makeRotationFromEuler(tempEuler.fromArray(m))}if(n.rotation){var m=n.rotation.map(THREE__namespace.MathUtils.degToRad);m.push(n.eulerOrder||A),r.makeRotationFromEuler(tempEuler.fromArray(m))}if(n.postRotation){var m=n.postRotation.map(THREE__namespace.MathUtils.degToRad);m.push(A),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&&p.setPosition(tempVec.fromArray(n.rotationPivot)),n.parentMatrixWorld&&(d.copy(n.parentMatrix),f.copy(n.parentMatrixWorld));var E=e.clone().multiply(r).multiply(o),v=new THREE__namespace.Matrix4;v.extractRotation(f);var y=new THREE__namespace.Matrix4;y.copyPosition(f);var b=new THREE__namespace.Matrix4().getInverse(y).multiply(f),T=new THREE__namespace.Matrix4().getInverse(v).multiply(b),_=s,S=new THREE__namespace.Matrix4;if(g===0)S.copy(v).multiply(E).multiply(T).multiply(_);else if(g===1)S.copy(v).multiply(T).multiply(E).multiply(_);else{var R=new THREE__namespace.Matrix4().scale(new THREE__namespace.Vector3().setFromMatrixScale(d)),M=new THREE__namespace.Matrix4().getInverse(R),H=T.clone().multiply(M);S.copy(v).multiply(E).multiply(H).multiply(_)}var B=new THREE__namespace.Matrix4().getInverse(p),C=new THREE__namespace.Matrix4().getInverse(u),w=t.clone().multiply(c).multiply(p).multiply(e).multiply(r).multiply(o).multiply(B).multiply(l).multiply(u).multiply(s).multiply(C),I=new THREE__namespace.Matrix4().copyPosition(w),O=f.clone().multiply(I);return h.copyPosition(O),w=h.clone().multiply(S),w.premultiply(new THREE__namespace.Matrix4().getInverse(f)),w}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,p=o?o.length:0;l.degree=e,l.knots=r,l.controlPoints=[],l.startKnot=s||0,l.endKnot=u||c;for(var f=0;f<p;++f){var d=o[f];l.controlPoints[f]=new THREE__namespace.Vector4(d.x,d.y,d.z,d.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,p=0;p<l;++p){var f=u[p+1],d=s[l-p],h=o[p]/(f+d);o[p]=c+f*h,c=d*h}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],p=s[l],f=c.w*p;u.x+=c.x*f,u.y+=c.y*f,u.z+=c.z*f,u.w+=c.w*p}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 p=s.slice(0),f=s.slice(0),d=1;d<=e;++d){p[d]=t-o[n+1-d],f[d]=o[n+d]-t;for(var h=0,g=0;g<d;++g){var A=f[g+1],m=p[d-g];c[d][g]=A+m;var E=c[g][d-1]/c[d][g];c[g][d]=h+A*E,h=m*E}c[d][d]=h}for(var d=0;d<=e;++d)l[0][d]=c[d][e];for(var v=0;v<=e;++v){for(var y=0,b=1,T=[],u=0;u<=e;++u)T[u]=s.slice(0);T[0][0]=1;for(var _=1;_<=r;++_){var S=0,R=v-_,M=e-_;v>=_&&(T[b][0]=T[y][0]/c[M+1][R],S=T[b][0]*c[R][M]);for(var H=R>=-1?1:-R,B=v-1<=M?_-1:e-v,C=H;C<=B;++C)T[b][C]=(T[y][C]-T[y][C-1])/c[M+1][R+C],S+=T[b][C]*c[R+C][M];v<=M&&(T[b][_]=-T[y][_-1]/c[M+1][v],S+=T[b][_]*c[v][M]),l[_][v]=S;var d=y;y=b,b=d}}for(var w=e,_=1;_<=r;++_){for(var d=0;d<=e;++d)l[_][d]*=w;w*=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),p=[],f=0;f<e.length;++f){var d=e[f].clone(),h=d.w;d.x*=h,d.y*=h,d.z*=h,p[f]=d}for(var g=0;g<=s;++g){for(var d=p[l-n].clone().multiplyScalar(c[g][0]),A=1;A<=n;++A)d.add(p[l-n+A].clone().multiplyScalar(c[g][A]));u[g]=d}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,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={byteLength:0};return Promise.resolve().then(function(){return s.ajax(n,{responseType:"arraybuffer"})}).then(function(l){var c,p;return u.byteLength=l.body.byteLength,parse$1(new Uint8Array(l.body),{light:(c=t.light)!==null&&c!==void 0?c:!0,color:t.color,resourcePath:n.slice(0,n.lastIndexOf("/")+1),search:(p=n.split("?")[1])!==null&&p!==void 0?p:"",fetcher:s})}).then(function(l){var c=new THREE__namespace.Group;return c.name=n,c.add(l.object),o==="Y"&&c.applyMatrix4(ROTATE_X_MATRIX_INVERSE),{type:"x3p",modelUpAxis:"Z",upAxis:o,uri:n,byteLength:u.byteLength,memoryUsage:getMemoryUsage(c),scene:c,textures:[],animations:[],dispose:function(){return l.dispose()}}})}function parse$1(n,t){for(var e,r,o,s,u,l,c,p,f,d,h,g,A,m,E,v,y,b,T,_,S,R,M,H,B,C,w,I,O,L,N,z,J,K,Q,U,q,X,Z,W,G,ne,$,ee,re,le,ae,oe,se,pe,de,xe,ce,Re,j=unzipSync(n),te="",V=null,be=0,fe=Object.keys(j);be<fe.length;be++){var ve=fe[be];/(^|\/)main\.xml$/i.test(ve)&&(V=j[ve],te=ve.slice(0,ve.lastIndexOf("/")+1))}if(!V)throw new Error("X3p: main.xml not found.");if(typeof DOMParser=="undefined")throw new Error("X3p: DOMParser not found.");var Ve=(e=t.color)!==null&&e!==void 0?e:new THREE__namespace.Color(10066329),rt=new DOMParser,We=decodeText(V),me=rt.parseFromString(We,"text/xml"),ie=me.querySelector("Record1 Axes"),he={x:{type:(s=(o=(r=ie==null?void 0:ie.querySelector("CX AxisType"))===null||r===void 0?void 0:r.textContent)===null||o===void 0?void 0:o.toUpperCase())!==null&&s!==void 0?s:"I",dataType:(c=(l=(u=ie==null?void 0:ie.querySelector("CX DataType"))===null||u===void 0?void 0:u.textContent)===null||l===void 0?void 0:l.toUpperCase())!==null&&c!==void 0?c:"D",increment:Number((f=(p=ie==null?void 0:ie.querySelector("CX Increment"))===null||p===void 0?void 0:p.textContent)!==null&&f!==void 0?f:"1"),offset:Number((h=(d=ie==null?void 0:ie.querySelector("CX Offset"))===null||d===void 0?void 0:d.textContent)!==null&&h!==void 0?h:"0")},y:{type:(m=(A=(g=ie==null?void 0:ie.querySelector("CY AxisType"))===null||g===void 0?void 0:g.textContent)===null||A===void 0?void 0:A.toUpperCase())!==null&&m!==void 0?m:"I",dataType:(y=(v=(E=ie==null?void 0:ie.querySelector("CY DataType"))===null||E===void 0?void 0:E.textContent)===null||v===void 0?void 0:v.toUpperCase())!==null&&y!==void 0?y:"D",increment:Number((T=(b=ie==null?void 0:ie.querySelector("CY Increment"))===null||b===void 0?void 0:b.textContent)!==null&&T!==void 0?T:"1"),offset:Number((S=(_=ie==null?void 0:ie.querySelector("CY Offset"))===null||_===void 0?void 0:_.textContent)!==null&&S!==void 0?S:"0")},z:{type:(H=(M=(R=ie==null?void 0:ie.querySelector("CZ AxisType"))===null||R===void 0?void 0:R.textContent)===null||M===void 0?void 0:M.toUpperCase())!==null&&H!==void 0?H:"A",dataType:(w=(C=(B=ie==null?void 0:ie.querySelector("CZ DataType"))===null||B===void 0?void 0:B.textContent)===null||C===void 0?void 0:C.toUpperCase())!==null&&w!==void 0?w:"D",increment:Number((O=(I=ie==null?void 0:ie.querySelector("CZ Increment"))===null||I===void 0?void 0:I.textContent)!==null&&O!==void 0?O:"1"),offset:Number((N=(L=ie==null?void 0:ie.querySelector("CZ Offset"))===null||L===void 0?void 0:L.textContent)!==null&&N!==void 0?N:"0")}},Ce=null,_e=me.querySelector("Record1 Axes Rotation");_e&&(Ce=new THREE__namespace.Matrix3,Ce.set(Number((J=(z=_e.querySelector("r11"))===null||z===void 0?void 0:z.textContent)!==null&&J!==void 0?J:0),Number((Q=(K=_e.querySelector("r12"))===null||K===void 0?void 0:K.textContent)!==null&&Q!==void 0?Q:0),Number((q=(U=_e.querySelector("r13"))===null||U===void 0?void 0:U.textContent)!==null&&q!==void 0?q:0),Number((Z=(X=_e.querySelector("r21"))===null||X===void 0?void 0:X.textContent)!==null&&Z!==void 0?Z:0),Number((G=(W=_e.querySelector("r22"))===null||W===void 0?void 0:W.textContent)!==null&&G!==void 0?G:0),Number(($=(ne=_e.querySelector("r23"))===null||ne===void 0?void 0:ne.textContent)!==null&&$!==void 0?$:0),Number((re=(ee=_e.querySelector("r31"))===null||ee===void 0?void 0:ee.textContent)!==null&&re!==void 0?re:0),Number((ae=(le=_e.querySelector("r32"))===null||le===void 0?void 0:le.textContent)!==null&&ae!==void 0?ae:0),Number((se=(oe=_e.querySelector("r33"))===null||oe===void 0?void 0:oe.textContent)!==null&&se!==void 0?se:0)));var Ie=(pe=me.querySelector("Record3 DataLink PointDataLink"))===null||pe===void 0?void 0:pe.textContent;if(typeof Ie!="string")throw new Error("X3p: PointDataLink not found.");Ie=pathJoin(te,Ie);var Fe=j[Ie];if(!Fe)throw new Error("X3p: ".concat(Fe," not found."));for(var Ae=getPointArray(Fe.buffer,he.z.dataType),Te=Number((xe=(de=me.querySelector("Record3 MatrixDimension SizeX"))===null||de===void 0?void 0:de.textContent)!==null&&xe!==void 0?xe:"0"),we=Number((Re=(ce=me.querySelector("Record3 MatrixDimension SizeY"))===null||ce===void 0?void 0:ce.textContent)!==null&&Re!==void 0?Re:"0"),Pe=Math.floor(Te-1),qe=Math.floor(we-1),ke=Pe+1,Ne=qe+1,Le=new Float32Array(ke*Ne*3),Ue=new Float32Array(ke*Ne*2),ze=new Uint32Array(Pe*qe*6),je=new THREE__namespace.Box3,Se=0;Se<Ne;Se++)for(var Oe=Se*he.y.increment+he.y.offset,Me=0;Me<ke;Me++){var He=Se*ke+Me,Be=Me*he.x.increment+he.x.offset,Ge=Ae[He],Ze=!isNaN(Ge),Ye=Ze?Ge:NaN;_vector.set(Be,-Oe,Ye),Ce&&_vector.applyMatrix3(Ce),Ze&&je.expandByPoint(_vector),Le[He*3+0]=_vector.x,Le[He*3+1]=_vector.y,Le[He*3+2]=_vector.z,Ue[He*2+0]=Me/Pe,Ue[He*2+1]=1-Se/qe}for(var Se=0;Se<qe;Se++)for(var Me=0;Me<Pe;Me++){var Qe=Me+ke*Se,ye=Me+ke*(Se+1),Ct=Me+1+ke*(Se+1),vt=Me+1+ke*Se,it=(Se*Pe+Me)*6;ze[it+0]=Qe,ze[it+1]=ye,ze[it+2]=vt,ze[it+3]=ye,ze[it+4]=Ct,ze[it+5]=vt}var Je=new THREE__namespace.BufferGeometry;Je.setAttribute("position",new THREE__namespace.BufferAttribute(Le,3)),Je.setAttribute("uv",new THREE__namespace.BufferAttribute(Ue,2)),Je.setIndex(new THREE__namespace.BufferAttribute(ze,1)),(!Je.groups||Je.groups.length===0)&&Je.addGroup(0,Je.index?Je.index.count:Je.attributes.position.count,0),Je.boundingBox=je;var pt=new PBMMeshMaterial(t.light?"phong":"basic");pt.flatShading=!0,pt.color.copy(Ve);var nt=new PBMMesh(Je,[pt]);return{object:nt,dispose:function(){Je.dispose(),pt.dispose()}}}var 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,identityMatrix4=new THREE__namespace.Matrix4().identity(),scratchVector=new THREE__namespace.Vector3,scratchMatrix4$5=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$2=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$5.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$5.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),scratchFrustum.setFromProjectionMatrix(scratchMatrix4$5),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],p=e[9],f=e[10],d=e[11],h=Math.max(Math.sqrt(r*r+o*o+s*s),.001),g=Math.max(Math.sqrt(u*u+l*l+c*c),.001),A=Math.max(Math.sqrt(p*p+f*f+d*d),.001);this.halfSize.set(h,g,A);var m=this.halfSize.toArray().reduce(function(E,v){return E+v},0);return(isNaN(m)||m<=0)&&this.halfSize.setScalar(EPSILON$2),this.rotation.fromArray([r/h,o/h,s/h,u/g,l/g,c/g,p/A,f/A,d/A]),isNaN(this.rotation.toArray().reduce(function(E,v){return E+v},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 t.equals(identityMatrix4)?this:(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$5.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,p=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),f=r.dot(e)+t.constant;return f<=-p?VolumePlaneIntersect.Outside:f>=p?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$5.makeBasis(scratchXAxis,scratchYAxis,scratchZAxis),scratchMatrix4$5.setPosition(this.center),scratchMatrix4Inverse$1.getInverse(scratchMatrix4$5),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$5).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 t.equals(identityMatrix4)?this:(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$2.set(this.center,this.radius),scratchSphere$2.containsPoint(t.origin))return!0;var r=t.intersectSphere(scratchSphere$2,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(isBoundingVolume(n))return 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:!0,transparent:!0,opacity:.5})}),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(t===void 0&&(t=0),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}return null}var scratchVector3$7=new THREE__namespace.Vector3,scratchPlane=new THREE__namespace.Plane,scratchSphereBoundingVolume$1=new SphereBoundingVolume,scratchBoxBoundingVolume$1=new BoxBoundingVolume,Tile=function(){function n(t,e,r,o){var s=this,u,l,c,p;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,memoryUsage:0},e.content.group!==void 0&&(this.content.group=e.content.group),/\.json$/.test(this.content.uri)?this.type="TILESET":this.type="SCENEGRAPH"):(this.content=null,this.type="EMPTY"),this.levelOfContent=this.parent?this.parent.levelOfContent:-1,this.type==="SCENEGRAPH"&&(this.levelOfContent=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=(p=e.extras)!==null&&p!==void 0?p:{},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)),e.children?this.children=e.children.map(function(f,d){return new n("".concat(s.id,".").concat(d),f,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.transform;if(this.boundingVolume){var r=void 0;this.boundingVolume instanceof BoxBoundingVolume?r=scratchBoxBoundingVolume$1.copy(this.boundingVolume):this.boundingVolume instanceof SphereBoundingVolume?r=scratchSphereBoundingVolume$1.copy(this.boundingVolume):r=this.boundingVolume.clone(),r.applyMatrix4(e),t.camera.type==="OrthographicCamera"?(scratchPlane.setFromNormalAndCoplanarPoint(t.camera.direction,t.camera.position),this.state.distanceToCamera=r.distanceToPlane(scratchPlane)):this.state.distanceToCamera=r.distanceToPoint(t.camera.position);var o=r.getCenter(scratchVector3$7).sub(t.camera.position);this.state.centerZDepth=t.camera.direction.dot(o),this.state.centerScreenY=t.camera.up.dot(o);var s=this.parent?this.parent.state.visibilityPlaneMask:CullingVolume.MASK_INDETERMINATE;this.state.visibilityPlaneMask=t.cullingVolume.computeVisibilityWithPlaneMask(r,s),this.state.visible=this.state.visibilityPlaneMask!==CullingVolume.MASK_OUTSIDE,t.cameraCulling||(this.state.visible=!0)}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.geometricError>=t.maxGeometricError)&&(this.state.visible=!0),this.viewerRequestVolume){var u=void 0;this.viewerRequestVolume instanceof BoxBoundingVolume?u=scratchBoxBoundingVolume$1.copy(this.viewerRequestVolume):this.viewerRequestVolume instanceof SphereBoundingVolume?u=scratchSphereBoundingVolume$1.copy(this.viewerRequestVolume):u=this.viewerRequestVolume.clone(),u.applyMatrix4(e),this.state.inRequestVolume=u.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}),Object.defineProperty(n.prototype,"contentMemoryUsage",{get:function(){return this.content?this.content.memoryUsage:0},enumerable:!1,configurable:!0}),n.prototype.getScreenSpaceError=function(t,e,r){var o=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=t.height,c=t.sseDenominator;if(t.camera.type==="OrthographicCamera"){var p=t.camera.projectionMatrix.elements,f=1/(p[5]/2),d=.9,h=f/l*d,g=u/h;return g}else{var A=Math.max(e,.001),h=A*c/l,g=u/h;return g}},n.prototype.getPriority=function(t){var e=this.refine==="ADD"||t.skipLevelOfDetail;if(e&&!this.state.visible||t.frameNumber-this.state.touchedFrameNumber>=1)return-1;var r=this.parent,o=r&&(!e||this.state.screenSpaceError===0),s=o?r.state.screenSpaceError:this.state.screenSpaceError,u=this.tileset.root?this.tileset.root.state.screenSpaceError:0,l=Math.max(u-s,0);return l},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,p=t;if(l){var f=l.array,d=(r=l.stride)!==null&&r!==void 0?r:1,h=(o=l.offset)!==null&&o!==void 0?o:0;p=f[t*d+h]}var g=c.array,A=(s=c.stride)!==null&&s!==void 0?s:3,m=(u=c.offset)!==null&&u!==void 0?u:0;return p=p*A+m,e.x=g[p],e.y=g[p+1],e.z=g[p+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 p=0,f=0,d=0,h=0,g=0,A=0;return t.x>=0?(p=(e-n.x)*t.x,f=(s-n.x)*t.x):(p=(s-n.x)*t.x,f=(e-n.x)*t.x),t.y>=0?(d=(r-n.y)*t.y,h=(u-n.y)*t.y):(d=(u-n.y)*t.y,h=(r-n.y)*t.y),!(p>h||d>f||(d>p&&(p=d),h<f&&(f=h),t.z>=0?(g=(o-n.z)*t.z,A=(l-n.z)*t.z):(g=(l-n.z)*t.z,A=(o-n.z)*t.z),p>A||g>f)||(g>p&&(p=g),A<f&&(f=A),f<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$6=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=[],p=0,f=-1;if(o)for(var d=0,h=0,g=0,A=void 0,m=void 0,E=void 0,v=void 0,y=void 0,b=void 0,T=void 0;d<s;d+=1,h+=3,g+=6)u[d]=d,this.getPositionByIndex(h,scratchVector3A),this.getPositionByIndex(h+1,scratchVector3B),this.getPositionByIndex(h+2,scratchVector3C),A=v=scratchVector3A.x,T=scratchVector3B.x,T<A&&(A=T),T>v&&(v=T),T=scratchVector3C.x,T<A&&(A=T),T>v&&(v=T),m=y=scratchVector3A.y,T=scratchVector3B.y,T<m&&(m=T),T>y&&(y=T),T=scratchVector3C.y,T<m&&(m=T),T>y&&(y=T),E=b=scratchVector3A.z,T=scratchVector3B.z,T<E&&(E=T),T>b&&(b=T),T=scratchVector3C.z,T<E&&(E=T),T>b&&(b=T),l[g]=A,l[g+1]=m,l[g+2]=E,l[g+3]=v,l[g+4]=y,l[g+5]=b;else{for(var _=1/0,S=1/0,R=1/0,M=-1/0,H=-1/0,B=-1/0,d=0,h=0,g=0,A=void 0,m=void 0,E=void 0,v=void 0,y=void 0,b=void 0,T=void 0;d<s;d+=1,h+=3,g+=6)u[d]=d,this.getPositionByIndex(h,scratchVector3A),this.getPositionByIndex(h+1,scratchVector3B),this.getPositionByIndex(h+2,scratchVector3C),A=v=scratchVector3A.x,T=scratchVector3B.x,T<A&&(A=T),T>v&&(v=T),T=scratchVector3C.x,T<A&&(A=T),T>v&&(v=T),m=y=scratchVector3A.y,T=scratchVector3B.y,T<m&&(m=T),T>y&&(y=T),T=scratchVector3C.y,T<m&&(m=T),T>y&&(y=T),E=b=scratchVector3A.z,T=scratchVector3B.z,T<E&&(E=T),T>b&&(b=T),T=scratchVector3C.z,T<E&&(E=T),T>b&&(b=T),l[g]=A,l[g+1]=m,l[g+2]=E,l[g+3]=v,l[g+4]=y,l[g+5]=b,A<_&&(_=A),v>M&&(M=v),m<S&&(S=m),y>H&&(H=y),E<R&&(R=E),b>B&&(B=b);o=[_,S,R,M,H,B]}var C=new BVHNode(++f,o,0,s,0);c[p++]=C;var w=[],I=[0,1,2],O=function(N,z){return w[z]-w[N]};function L(N){var z=N.startIndex,J=N.endIndex,K=N.extents;w[0]=K[3]-K[0],w[1]=K[4]-K[1],w[2]=K[5]-K[2],I.sort(O);for(var Q=0;Q<3;Q++){for(var U=I[Q],q=K[U]+K[U+3],X=z,Z=J-1,W=-1,G=void 0;X<=Z;)W===-1?(G=u[X],l[G*6+U]+l[G*6+U+3]<q?X++:W=G):(G=u[Z],l[G*6+U]+l[G*6+U+3]>=q||(u[X]=G,u[Z]=W,W=-1,X++),Z--);if(X>z&&X<J){var ne=new BVHNode(++f,calcExtents(u,l,z,X,EPSILON$1),z,X,N.deepth+1);ne.deepth<r&&ne.endIndex-ne.startIndex>e&&(c[p++]=ne);var $=new BVHNode(++f,calcExtents(u,l,X,J,EPSILON$1),X,J,N.deepth+1);$.deepth<r&&$.endIndex-$.startIndex>e&&(c[p++]=$),N.node0=ne,N.node1=$,N.startIndex=0,N.endIndex=0;break}}}for(;p;)L(c[--p]);return this.offsetArray=u,this.rootNodePacked=packBVHNode(C,f+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),p=[0],f=[],d,h,g,A;(d=p.pop())!==void 0;){A=d*BYTES_PER_NODE/4;var m=clamp(e.x,u[A],u[A+3])-e.x,E=clamp(e.y,u[A+1],u[A+4])-e.y,v=clamp(e.z,u[A+2],u[A+5])-e.z;if(m*m+E*E+v*v<=r*r){for(var y=l[A+6];y<l[A+7];y++)f.push(o[y]);A=d*BYTES_PER_NODE/2,h=c[A+16],g=c[A+17],h&&p.push(h),g&&p.push(g)}}for(var b=f.length,T=new Float32Array(b*9),y=0;y<b;y++){var _=f[y];this.getPositionByIndex(_,scratchVector3$6),T[y*9]=scratchVector3$6.x,T[y*9+1]=scratchVector3$6.y,T[y*9+2]=scratchVector3$6.z,this.getPositionByIndex(_+1,scratchVector3$6),T[y*9+3]=scratchVector3$6.x,T[y*9+4]=scratchVector3$6.y,T[y*9+5]=scratchVector3$6.z,this.getPositionByIndex(_+2,scratchVector3$6),T[y*9+6]=scratchVector3$6.x,T[y*9+7]=scratchVector3$6.y,T[y*9+8]=scratchVector3$6.z}return T},t.prototype.intersectRay=function(e,r,o,s){for(var u=this.offsetArray,l=this.rootNodePacked,c=new Float32Array(l),p=new Uint32Array(l),f=new Uint16Array(l),d=new BVHVector3(1/r.x,1/r.y,1/r.z),h=[0],g,A,m,E;(g=h.pop())!==void 0;)if(E=g*BYTES_PER_NODE/4,intersectNodeBox(e,d,c[E],c[E+1],c[E+2],c[E+3],c[E+4],c[E+5])){for(var v=p[E+6],y=p[E+7],b=void 0,T=void 0,_=void 0,S=e.x,R=e.y,M=e.z,H=r.x,B=r.y,C=r.z,w=void 0,I=void 0,O=void 0,L=void 0,N=void 0,z=void 0,J=void 0,K=void 0,Q=void 0,U=void 0,q=void 0,X=void 0,Z=void 0,W=void 0,G=void 0,ne=void 0,$=void 0,ee=void 0,re=void 0,le=void 0,ae=void 0,oe=void 0,se=void 0,pe=void 0,de=void 0,xe=void 0,ce=void 0;v<y;v++){if(b=u[v],T=b*3,this.getPositionByIndex(T,scratchVector3$6),w=scratchVector3$6.x,I=scratchVector3$6.y,O=scratchVector3$6.z,this.getPositionByIndex(T+1,scratchVector3$6),L=scratchVector3$6.x,N=scratchVector3$6.y,z=scratchVector3$6.z,this.getPositionByIndex(T+2,scratchVector3$6),J=scratchVector3$6.x,K=scratchVector3$6.y,Q=scratchVector3$6.z,U=L-w,q=N-I,X=z-O,Z=J-w,W=K-I,G=Q-O,ne=q*G-X*W,$=X*Z-U*G,ee=U*W-q*Z,se=H*ne+B*$+C*ee,se>0)oe=1;else if(se<0)oe=-1,se=-se;else continue;re=S-w,le=R-I,ae=M-O,pe=oe*(H*(le*G-ae*W)+B*(ae*Z-re*G)+C*(re*W-le*Z)),!(pe<0)&&(de=oe*(H*(q*ae-X*le)+B*(X*re-U*ae)+C*(U*le-q*re)),!(de<0)&&(pe+de>se||(xe=-oe*(re*ne+le*$+ae*ee),!(xe<0)&&(ce=xe/se,s.push(new BVHIntersect([w,I,O,L,N,z,J,K,Q],[S+H*ce,R+B*ce,M+C*ce],b))))))}E=g*BYTES_PER_NODE/2,A=f[E+16],m=f[E+17],A&&h.push(A),m&&h.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,p=-1/0,f=-1/0,d=e,h=void 0,g=void 0;d<r;d++)h=n[d]*6,g=t[h],g<s&&(s=g),g=t[h+1],g<u&&(u=g),g=t[h+2],g<l&&(l=g),g=t[h+3],g>c&&(c=g),g=t[h+4],g>p&&(p=g),g=t[h+5],g>f&&(f=g);return[s-o,u-o,l-o,c+o,p+o,f+o]}var EPSILON=1e-6,ORDER_AXISES=["x","y","z"],scratchVector3$5=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=[],p=0,f=-1;if(o)for(var d=0;d<u;d+=1)l[d]=d;else{s(0,scratchVector3$5);for(var h=scratchVector3$5.x,g=scratchVector3$5.y,A=scratchVector3$5.z,m=h,E=g,v=A,d=0,y=void 0,b=void 0,T=void 0;d<u;d+=1)l[d]=d,s(d,scratchVector3$5),y=scratchVector3$5.x,b=scratchVector3$5.y,T=scratchVector3$5.z,y<h?h=y:y>m&&(m=y),b<g?g=b:b>E&&(E=b),T<A?A=T:T>v&&(v=T);o=[h,g,A,m,E,v]}var _=new BVHNode(++f,o,0,u,0);c[p++]=_;var S=[],R=[0,1,2],M=function(B,C){return S[C]-S[B]};function H(B){var C=B.startIndex,w=B.endIndex,I=B.extents;S[0]=I[3]-I[0],S[1]=I[4]-I[1],S[2]=I[5]-I[2];for(var O=R.sort(M)[0],L=ORDER_AXISES[O],N=(I[O]+I[O+3])/2,z=C,J=w-1,K=-1,Q;z<=J;)K===-1?(Q=l[z],s(Q,scratchVector3$5),scratchVector3$5[L]<N?z++:K=Q):(Q=l[J],s(Q,scratchVector3$5),scratchVector3$5[L]>=N||(l[z]=Q,l[J]=K,K=-1,z++),J--);if(z>C){var U=I.slice();U[O+3]=N+EPSILON;var q=new BVHNode(++f,U,C,z,B.deepth+1);q.deepth<r&&q.endIndex-q.startIndex>e&&(c[p++]=q),B.node0=q}if(w>z){var X=I.slice();X[O]=N-EPSILON;var Z=new BVHNode(++f,X,z,w,B.deepth+1);Z.deepth<r&&Z.endIndex-Z.startIndex>e&&(c[p++]=Z),B.node1=Z}B.startIndex=0,B.endIndex=0}for(;p;)H(c[--p]);return this.offsetArray=l,this.rootNodePacked=packBVHNode(_,f+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),p=new Uint32Array(l),f=new Uint16Array(l),d=o*o,h=new BVHVector3(1/r.x,1/r.y,1/r.z),g=[0],A,m,E,v;(A=g.pop())!==void 0;)if(v=A*BYTES_PER_NODE/4,intersectNodeBox(e,h,c[v],c[v+1],c[v+2],c[v+3],c[v+4],c[v+5],o)){for(var y=p[v+6],b=p[v+7],T=void 0,_=void 0,S=void 0,R=void 0,M=void 0,H=void 0,B=void 0,C=void 0,w=void 0,I=void 0,O=void 0,L=void 0;y<b;y++)T=u[y],this.getPositionByIndex(T,scratchVector3$5),_=scratchVector3$5.x,S=scratchVector3$5.y,R=scratchVector3$5.z,M=e.x,H=e.y,B=e.z,C=r.x,w=r.y,I=r.z,O=C*(_-M)+w*(S-H)+I*(R-B),O>0&&(M+=C*O,H+=w*O,B+=I*O),C=_-M,w=S-H,I=R-B,O=C*C+w*w+I*I,O<=d&&s.push(new BVHIntersect([_,S,R,_,S,R,_,S,R],[M,H,B],T));v=A*BYTES_PER_NODE/2,m=f[v+16],E=f[v+17],m&&g.push(m),E&&g.push(E)}return s},t}(BVHObject);const encodedJs="KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO3ZhciBlcj1mdW5jdGlvbihlLHIpe3JldHVybiBlcj1PYmplY3Quc2V0UHJvdG90eXBlT2Z8fHtfX3Byb3RvX186W119aW5zdGFuY2VvZiBBcnJheSYmZnVuY3Rpb24odCxvKXt0Ll9fcHJvdG9fXz1vfXx8ZnVuY3Rpb24odCxvKXtmb3IodmFyIGYgaW4gbylPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwobyxmKSYmKHRbZl09b1tmXSl9LGVyKGUscil9O2Z1bmN0aW9uIGhyKGUscil7aWYodHlwZW9mIHIhPSJmdW5jdGlvbiImJnIhPT1udWxsKXRocm93IG5ldyBUeXBlRXJyb3IoIkNsYXNzIGV4dGVuZHMgdmFsdWUgIitTdHJpbmcocikrIiBpcyBub3QgYSBjb25zdHJ1Y3RvciBvciBudWxsIik7ZXIoZSxyKTtmdW5jdGlvbiB0KCl7dGhpcy5jb25zdHJ1Y3Rvcj1lfWUucHJvdG90eXBlPXI9PT1udWxsP09iamVjdC5jcmVhdGUocik6KHQucHJvdG90eXBlPXIucHJvdG90eXBlLG5ldyB0KX10eXBlb2YgU3VwcHJlc3NlZEVycm9yPT0iZnVuY3Rpb24iJiZTdXBwcmVzc2VkRXJyb3I7dmFyIGRyPWZ1bmN0aW9uKCl7ZnVuY3Rpb24gZShyLHQpe3RoaXMucG9zaXRpb249cix0aGlzLmluZGljZXM9dH1yZXR1cm4gZS5wcm90b3R5cGUuZ2V0UG9zaXRpb25Db3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aDtmKyspe3ZhciB2PWRbZl0sbj12b2lkIDA7aWYodi50eXBlPT09Im1lc2giKW49bmV3IEFyKHYuYXR0cmlidXRlcy5wb3NpdGlvbix2LmluZGljZXMpO2Vsc2UgaWYodi50eXBlPT09InBvaW50cyIpbj1uZXcgUHIodi5hdHRyaWJ1dGVzLnBvc2l0aW9uLHYuaW5kaWNlcyk7ZWxzZSB0aHJvdyBuZXcgRXJyb3IoIkludmFsaWQgVHlwZSIpO24uY3JlYXRlVHJlZSh2Lm1heEl0ZW1QZXJOb2RlLHYubWF4VHJlZURlcHRoLHYuZXh0ZW50cyk7dmFyIHM9e3R5cGU6di50eXBlLGF0dHJpYnV0ZXM6di5hdHRyaWJ1dGVzLGluZGljZXM6di5pbmRpY2VzLG9mZnNldEFycmF5Om4ub2Zmc2V0QXJyYXkscm9vdE5vZGVQYWNrZWQ6bi5yb290Tm9kZVBhY2tlZH07dC5wdXNoKHMpO3ZhciB1PXZvaWQgMDtmb3IodmFyIHcgaW4gcy5hdHRyaWJ1dGVzKXt2YXIgeT1zLmF0dHJpYnV0ZXNbd107eSYmeS5idWZmZXIgaW5zdGFuY2VvZiBBcnJheUJ1ZmZlciYmby5hZGQoeS5idWZmZXIpfXU9cy5pbmRpY2VzLHUmJnUuYnVmZmVyIGluc3RhbmNlb2YgQXJyYXlCdWZmZXImJm8uYWRkKHUuYnVmZmVyKSx1PXMub2Zmc2V0QXJyYXksdSYmdS5idWZmZXIgaW5zdGFuY2VvZiBBcnJheUJ1ZmZlciYmby5hZGQodS5idWZmZXIpLG8uYWRkKHMucm9vdE5vZGVQYWNrZWQpfXJldHVybntvdXRwdXQ6dCx0cmFuc2ZlcjpBcnJheS5mcm9tKG8pfX0pfSl9KSgpOwo=",decodeBase64=n=>Uint8Array.from(atob(n),t=>t.charCodeAt(0)),blob=typeof self!="undefined"&&self.Blob&&new Blob([decodeBase64(encodedJs)],{type:"text/javascript;charset=utf-8"});function WorkerWrapper(n){let t;try{if(t=blob&&(self.URL||self.webkitURL).createObjectURL(blob),!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,{name:n==null?void 0:n.name})}finally{t&&(self.URL||self.webkitURL).revokeObjectURL(t)}}var bvhWorkerPool=new WorkerPool(function(){return new WorkerWrapper},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,p=l.groups,f=l.index,d=0,h=u.length;d<h;d++){var g=u[d],A=g.triangle,m=g.index,E=g.intersectionPoint,v=new THREE__namespace.Vector3(E[0],E[1],E[2]).applyMatrix4(s),y=e.ray.origin.distanceTo(v);if(!(y<e.near||y>e.far)){var b=void 0;if(Array.isArray(c)){if(p)for(var T=m*3,_=0,S=p;_<S.length;_++){var R=S[_];if(T>=R.start&&T-R.start<R.count){b=c[(o=R.materialIndex)!==null&&o!==void 0?o:0];break}}}else b=c;if(b){var M=scratchIntersectionTriangle.set(scratchIntersectionFaceA.set(A[0],A[1],A[2]).applyMatrix4(s),scratchIntersectionFaceB.set(A[3],A[4],A[5]).applyMatrix4(s),scratchIntersectionFaceC.set(A[6],A[7],A[8]).applyMatrix4(s)).getNormal(new THREE__namespace.Vector3),H=m*3,B=new THREE__namespace.Face3(f?f.array[H]:H,f?f.array[H+1]:H+1,f?f.array[H+2]:H+2,M),C=e.ray.direction.dot(M);b.side===THREE__namespace.FrontSide&&C>=0||b.side===THREE__namespace.BackSide&&C<=0||r.push({distance:y,object:n,face:B,point:v,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,[]),p=n.geometry,f=p.index,d=p.getAttribute("normal"),h=0,g=c.length;h<g;h++){var A=c[h],m=A.triangle,E=A.index,v=A.intersectionPoint,y=new THREE__namespace.Vector3(v[0],v[1],v[2]).applyMatrix4(u),b=e.ray.origin.distanceTo(y);if(!(b<e.near||b>e.far)){var T=scratchIntersectionFaceA.set(m[0],m[1],m[2]).applyMatrix4(u),_=f?f.array[E]:E,S=void 0;if(d instanceof THREE__namespace.BufferAttribute){var R=new THREE__namespace.Vector3().fromBufferAttribute(d,_).applyNormalMatrix(scratchNormalMatrix);S=new THREE__namespace.Face3(_,_,_,R)}r.push({distance:b,object:n,face:S,point:y,distanceToRay:y.distanceTo(T),index:E})}}}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 p=o[c],f=p.geometry;if(f instanceof THREE__namespace.BufferGeometry){var d=void 0;if(p instanceof THREE__namespace.Mesh?d="mesh":p instanceof THREE__namespace.Points&&(d="points"),!!d){var h=f.boundingBox,g=h?[h.min.x,h.min.y,h.min.z,h.max.x,h.max.y,h.max.z]:void 0,A={};for(var m in f.attributes){var E=f.attributes[m];E instanceof THREE__namespace.InterleavedBufferAttribute?(A[m]={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[m]={array:E.array},l=E.array,l&&l.buffer instanceof ArrayBuffer&&u.add(l.buffer))}var v=void 0,y=f.getIndex();y&&(y instanceof THREE__namespace.InterleavedBufferAttribute?(v={array:y.data.array,stride:y.data.stride,offset:y.offset},l=y.data.array,l&&l.buffer instanceof ArrayBuffer&&u.add(l.buffer)):(v={array:y.array},l=y.array,l&&l.buffer instanceof ArrayBuffer&&u.add(l.buffer)));var b={type:d,attributes:A,indices:v,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,p=s[u];if(c instanceof THREE__namespace.BufferGeometry){for(var f in p.attributes){var d=p.attributes[f].array,h=c.attributes[f];h instanceof THREE__namespace.InterleavedBufferAttribute?h.data.array=d:h.array=d}var g=c.getIndex();if(g&&p.indices){var d=p.indices.array;g instanceof THREE__namespace.InterleavedBufferAttribute?g.data.array=d:g.array=d}if(l instanceof THREE__namespace.Mesh){var A=new BVHMesh(p.attributes.position,p.indices);A.offsetArray=p.offsetArray,A.rootNodePacked=p.rootNodePacked,bindBvhTreeForMesh(l,A)}else if(l instanceof THREE__namespace.Points){var A=new BVHPoints(p.attributes.position,p.indices);A.offsetArray=p.offsetArray,A.rootNodePacked=p.rootNodePacked,bindBvhTreeForPoints(l,A)}}}return n})}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 p in this.config)c[p]=(s=t[p])!==null&&s!==void 0?s:l[p];var f=[{progress:0,value:l},{progress:1,value:c}];return this.setKeyframes(f,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}(),easeInCubic=function(n){return n*n*n},easeInQuart=function(n){return n*n*n*n},APPEAR_ANIMATION_DURATION=500,versionMap$1=new WeakMap,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.name=e,s.materials=[],s.pbmObjects=[],s.contentObject=r,s.appearMotion=new Motion({appear:0}),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 PBMSkinnedMesh||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,s){r===void 0&&(r=null),o===void 0&&(o=!0),s===void 0&&(s=[]);for(var u=this.children.slice(),l,c=[];l=u.pop();)if(l.visible){l.raycast(e,c);for(var p=0,f=l.children.length;p<f;p++)u.push(l.children[p])}for(var p=0;p<c.length;p++){var d=c[p],h=0,g=-1;if((d.object instanceof PBMMesh||d.object instanceof PBMSkinnedMesh||d.object instanceof PBMPointCloud)&&d.face){var A=Array.isArray(d.object.material)?d.object.material[d.face.materialIndex]:d.object.material;A&&(h=A.floorIndex,g=A.shownFloorIndex)}d.floor=h;var m=r!=null?r:g;m>=0&&h!==m&&(c.splice(p,1),p--)}return o&&c.sort(function(E,v){return E.distance-v.distance}),s.push.apply(s,c),s},t.prototype.update=function(e,r,o,s,u,l){var c=!1,p=s.visible&&u.state.selectedFrameNumber===u.tileset.frameNumber;if(p){var f=1;this.appearMotion.getTargetKeyframe().value.appear!==f&&this.appearMotion.set({appear:f},APPEAR_ANIMATION_DURATION).catch(noop$1)}else{var f=0;this.appearMotion.getTargetKeyframe().value.appear!==f&&this.appearMotion.set({appear:f},0).catch(noop$1)}this.appearMotion.ended!==!0&&this.appearMotion.update(r.time);for(var d=0,h=this.pbmObjects;d<h.length;d++){var g=h[d];if(g instanceof PBMMesh||g instanceof PBMSkinnedMesh){var A=updatePBMMesh(g,this.appearMotion,e,r,o,u,l);A===!0&&(c=!0)}else if(g instanceof PBMPointCloud){var A=updatePBMPointCloud(g,this.appearMotion,e,r,o,u,l);A===!0&&(c=!0)}}return c},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 updatePBMMesh(n,t,e,r,o,s,u){var l=n.material,c=!1,p=u.versions.toString();if(versionMap$1.get(n)!==p){versionMap$1.set(n,p),c=!0,n.castShadow=u.castShadow,n.receiveShadow=u.receiveShadow;for(var f=0,d=l;f<d.length;f++){var h=d[f];h.customShaders=u.customShaders,h.pano0=u.pano0,h.pano1=u.pano1,h.pano0Depth=u.pano0Depth,h.pano1Depth=u.pano1Depth,h.refinedScreen=u.refinedScreen,h.modelAlpha=u.modelAlpha,h.logDepthAlpha=u.logDepthAlpha,h.progress=u.progress,h.transition=u.transition,h.opacity=u.opacity,h.floorStyle=u.floorStyle,h.constantColor=u.constantColor,h.shownFloorIndex=u.shownFloorIndex,h.clippers=u.clippers,h.brightness=u.brightness,h.useHQWeight=u.useHQWeight,h.useHQDepth=u.useHQDepth,h.colorSaturation=u.colorSaturation,h.colorBrightness=u.colorBrightness,h.gradientTexture=u.gradientTexture,h.shaderType==="none"?(h.transparent=!0,h.blending=THREE__namespace.NormalBlending,h.blendDst=THREE__namespace.OneMinusSrcAlphaFactor,h.blendEquation=THREE__namespace.AddEquation,h.blendSrcAlpha=null,h.blendDstAlpha=null,h.blendEquationAlpha=null,h.depthWrite=!1,h.depthTest=!0):(h.transparent=h.alphaMode==="BLEND",h.blending=THREE__namespace.NormalBlending,h.blendDst=THREE__namespace.OneMinusSrcAlphaFactor,h.blendEquation=THREE__namespace.AddEquation,h.blendSrcAlpha=null,h.blendDstAlpha=null,h.blendEquationAlpha=null,h.depthWrite=!0,h.depthTest=!0,u.useAddBlend&&(h.depthWrite=!1,h.depthTest=!1,h.blending=THREE__namespace.AdditiveBlending),h.shownFloorIndex>-1&&h.shownFloorIndex!==h.floorIndex&&(h.transparent=!0),h.opacity<1&&(h.transparent=!0),h.alphaMap&&(h.transparent=!0),h.brightness<1&&(h.transparent=!0),h.logDepthAlpha>0?h.transparent=!1:u.useAddBlend&&(h.depthWrite=!1,h.depthTest=!1,h.blending=THREE__namespace.AdditiveBlending))}}for(var g=0,A=l;g<A.length;g++){var h=A[g];h.modelBoundingMax.copy(o.boundingBox.max),h.modelBoundingMin.copy(o.boundingBox.min)}return c}function updatePBMPointCloud(n,t,e,r,o,s,u){var l,c,p=n.geometry,f=[n.material],d=!1,h=u.versions.toString();if(u.pointAppearAnimation===!0&&s.refine==="ADD"&&s.tileset.rootMeta.pntsOrder==="RANDOM"){var g=s.tileset.currentMaxScreenSpaceError,A=s.state.screenSpaceError,m=(c=(l=s.parent)===null||l===void 0?void 0:l.state.screenSpaceError)!==null&&c!==void 0?c:A,E=1;m!==A&&(E=(m-g)/(m-A)),E=clamp$1(E,0,1),E=easeInCubic(E);var v=p.index?p.index.count:p.attributes.position?p.attributes.position.count:1/0,y=Math.floor(v*E*t.value.appear);p.drawRange.count!==y&&(p.setDrawRange(0,y),d=!0)}if(versionMap$1.get(n)!==h){versionMap$1.set(n,h),d=!0,n.castShadow=u.castShadow,n.receiveShadow=u.receiveShadow;for(var b=0,T=f;b<T.length;b++){var _=T[b];_.customShaders=u.customShaders,_.pointScale=u.pointScale,_.pointMinPixel=u.pointMinPixel,_.pointMaxPixel=u.pointMaxPixel,_.pointSize=u.pointSize,_.pointShape=u.pointShape,_.pointBack=u.pointBack,_.modelAlpha=u.modelAlpha,_.logDepthAlpha=u.logDepthAlpha,_.opacity=u.opacity,_.floorStyle=u.floorStyle,_.constantColor=u.constantColor,_.shownFloorIndex=u.shownFloorIndex,_.clippers=u.clippers,_.brightness=u.brightness,_.useHQWeight=u.useHQWeight,_.useHQDepth=u.useHQDepth,_.colorSaturation=u.colorSaturation,_.colorBrightness=u.colorBrightness,_.outlineGain=u.outlineGain,_.distanceGain=u.distanceGain,_.gradientTexture=u.gradientTexture,_.transparent=!1,_.blending=THREE__namespace.NormalBlending,_.blendDst=THREE__namespace.OneMinusSrcAlphaFactor,_.blendEquation=THREE__namespace.AddEquation,_.blendSrcAlpha=null,_.blendDstAlpha=null,_.blendEquationAlpha=null,_.depthWrite=!0,_.depthTest=!0,_.shownFloorIndex>-1&&(_.transparent=_.shownFloorIndex!==_.floorIndex),_.modelAlpha<1&&(_.transparent=!0),_.opacity<1&&(_.transparent=!0),_.brightness<1&&(_.transparent=!0),_.logDepthAlpha>0?_.transparent=!1:u.useAddBlend&&(_.depthWrite=!1,_.depthTest=!1,_.blending=THREE__namespace.AdditiveBlending),_.useHQWeight&&(_.depthWrite=!1,_.blending=THREE__namespace.CustomBlending,_.blendSrc=THREE__namespace.SrcAlphaFactor,_.blendSrcAlpha=THREE__namespace.SrcAlphaFactor,_.blendDst=THREE__namespace.OneFactor,_.blendDstAlpha=THREE__namespace.OneFactor)}}for(var S=0,R=f;S<R.length;S++){var _=R[S];_.modelBoundingMax.copy(o.boundingBox.max),_.modelBoundingMin.copy(o.boundingBox.min)}return d}var Trajectory=function(){function n(t,e,r){this.id=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,memoryUsage:0,loadState:"UNLOADED",loadStateUpdateTime:now(),loadfailRetryDelay:0,data:void 0}}return n}(),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,s,u,l){var c=this.contentObject.material[2];return c.uniforms.dashOffset.value=(c.uniforms.dashOffset.value-.003)%(c.uniforms.dashSize.value.x+c.uniforms.dashSize.value.y),!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),priorityCache=new Map;function getPriority(n,t,e){if(e&&e.has(t))return e.get(t);var r=t.refine==="ADD"||n.skipLevelOfDetail,o=t.parent,s=o&&(!r||t.state.screenSpaceError===0),u=s?o.state.screenSpaceError:t.state.screenSpaceError,l=t.tileset.root?t.tileset.root.state.screenSpaceError:0,c=Math.max(l-u,0);return e&&e.set(t,c),c}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 p=u[c];if(l.has(p.tile)){l.delete(p.tile);continue}p.status==="WAITING"&&(u.splice(c,1),c--,this.options.onTileSkip&&this.options.onTileSkip(p.tile))}l.size>0&&(l.forEach(function(v){u.push({tile:v,status:"WAITING",time:s,error:null})}),l.clear());for(var f=r.maxRequests,c=0;c<u.length&&f>0;c++){var p=u[c];if(p.status==="DONE")p.error!==null?this.options.onTileError&&this.options.onTileError(p.tile,p.error):(f--,p.tile.content&&(p.tile.content.loadState="READY"),this.options.onTileLoad&&this.options.onTileLoad(p.tile)),u.splice(c,1),c--;else if(p.status==="PENDING"&&s-p.time<1e3)break}switch(priorityCache.clear(),e){case"SCREEN_SPACE_ERROR":{u.sort(function(v,y){if(v.tile.state.requestedFrameNumber!==y.tile.state.requestedFrameNumber)return y.tile.state.requestedFrameNumber-v.tile.state.requestedFrameNumber;if(v.tile.state.requestedFrameNumber===r.frameNumber){var b=getPriority(r,v.tile,priorityCache),T=getPriority(r,y.tile,priorityCache);return b-T}else return v.tile.level!==y.tile.level?v.tile.level-y.tile.level:v.tile.state.distanceToCamera-y.tile.state.distanceToCamera});break}case"SCREEN_VERTICAL":{u.sort(function(v,y){return v.tile.state.requestedFrameNumber!==y.tile.state.requestedFrameNumber?y.tile.state.requestedFrameNumber-v.tile.state.requestedFrameNumber:v.tile.state.requestedFrameNumber===r.frameNumber?v.tile.state.centerScreenY!==y.tile.state.centerScreenY?v.tile.state.centerScreenY-y.tile.state.centerScreenY:v.tile.state.centerZDepth!==y.tile.state.centerZDepth?v.tile.state.centerZDepth-y.tile.state.centerZDepth:v.tile.level!==y.tile.level?v.tile.level-y.tile.level:v.tile.state.distanceToCamera-y.tile.state.distanceToCamera:v.tile.level!==y.tile.level?v.tile.level-y.tile.level:v.tile.state.distanceToCamera-y.tile.state.distanceToCamera});break}case"SCREEN_LEVEL_VERTICAL":{u.sort(function(v,y){return v.tile.state.requestedFrameNumber!==y.tile.state.requestedFrameNumber?y.tile.state.requestedFrameNumber-v.tile.state.requestedFrameNumber:v.tile.state.requestedFrameNumber===r.frameNumber?v.tile.level!==y.tile.level?v.tile.level-y.tile.level:v.tile.state.centerScreenY!==y.tile.state.centerScreenY?v.tile.state.centerScreenY-y.tile.state.centerScreenY:v.tile.state.centerZDepth!==y.tile.state.centerZDepth?v.tile.state.centerZDepth-y.tile.state.centerZDepth:v.tile.state.distanceToCamera-y.tile.state.distanceToCamera:v.tile.level!==y.tile.level?v.tile.level-y.tile.level:v.tile.state.distanceToCamera-y.tile.state.distanceToCamera});break}}if(f=Math.max(r.maxRequests-this.activeRequests,0),!r.skipLevelOfDetail)for(var d=0,h=u.length,c=0;c<h;c++){var g=u[c].tile;if(g.hasTilesetContent||g.contentParent===null||g.contentParent.state.selectedFrameNumber===r.frameNumber){var A=u.splice(c,1);u.splice.apply(u,__spreadArray([d++,0],A,!1))}}for(var m=function(v){var y=u[v];y.status==="WAITING"&&(f--,y.status="PENDING",y.time=s,E.activeRequests++,E.tileset.options.tileLoader(y.tile).catch(function(b){y.error=b}).then(function(){y.status="DONE",y.tile.content&&y.tile.content.loadState==="READY"&&(y.tile.content.loadState="LOADING"),o.activeRequests--}))},E=this,c=0;c<u.length&&f>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}return n.prototype.traverse=function(t,e,r){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.levelOfContent>=0&&t.geometricError<=e.minGeometricError||t.children.length===0?!1:t.levelOfContent<=e.minLevelOfDetail||t.geometricError>=e.maxGeometricError||t.hasTilesetContent?!0:t.state.screenSpaceError>this.tileset.currentMaxScreenSpaceError},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||r.geometricError>e.maxGeometricError?!1:r.levelOfContent>e.maxLevelOfDetail||r.levelOfContent>=0&&r.geometricError<e.minGeometricError?!0:t.getScreenSpaceError(e,t.state.distanceToCamera,!0)<this.tileset.currentMaxScreenSpaceError},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}(),TilesetNormalTraverser=function(n){__extends(t,n);function t(e){var r=n.call(this,e)||this;return 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))},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 p=!c&&l;s.hasRenderContent?s.refine==="ADD"?(this.loadTile(s,r),this.selectDesiredTile(s,r)):s.refine==="REPLACE"&&(this.loadTile(s,r),p&&this.selectDesiredTile(s,r)):(this.loadTile(s,r),p&&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 p=e.refine==="REPLACE"&&e.hasRenderContent,f=!1,d=!0,h=0,g=s;h<g.length;h++){var c=g[h];if(c.levelOfContent<=r.minLevelOfDetail||c.geometricError>=r.maxGeometricError||c.state.visible&&c.state.inRequestVolume?(o.find(c)&&o.delete(c),o.push(c),f===!1&&(f=!0)):(p||r.loadSiblings)&&(this.loadTile(c,r),this.touchTile(c,r)),p){var A=void 0;c.state.inRequestVolume?c.hasRenderContent?A=c.contentAvailable:A=this.executeEmptyTraversal(c,r):A=!1,d=d&&A}}return f||(d=!1),d},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,p=0,f=c;p<f.length;p++){var d=f[p];s.find(d)&&s.delete(d),s.push(d)}}return o},t}(TilesetBaseTraverser),TilesetSkipTraverser=function(n){__extends(t,n);function t(e){var r=n.call(this,e)||this;return 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))},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 p=!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),p&&this.selectDesiredTile(s,r)):p?(this.loadTile(s,r),this.selectDesiredTile(s,r)):this.reachedSkippingThreshold(s)&&this.loadTile(s,r)):(this.loadTile(s,r),p&&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 p=!1,f=0,d=s;f<d.length;f++){var c=d[f];c.levelOfContent<=r.minLevelOfDetail||c.geometricError>=r.maxGeometricError||c.state.visible&&c.state.inRequestVolume?(o.push(c),p===!1&&(p=!0)):r.loadSiblings&&(this.loadTile(c,r),this.touchTile(c,r))}return p},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 p=c[l];p.state.visible&&(p.contentAvailable?(this.updateTile(p,r),this.touchTile(p,r),this.selectTile(p,r)):o.push(p))}},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 p=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,!p){this.selectTile(c,r);continue}s.push(c),c.state.stackLength=o.length}if(p)for(var f=0,d=c.children;f<d.length;f++){var h=d[f];h.state.visible&&o.push(h)}}}},t}(TilesetBaseTraverser),TilesetMostDetailTraverser=function(n){__extends(t,n);function t(e){var r=n.call(this,e)||this;return r._traversalStack=new ManagedArray,r}return t.prototype.canTraverse=function(e,r){return!(!e.state.inRequestVolume||e.levelOfContent>=r.maxLevelOfDetail||e.levelOfContent>=0&&e.geometricError<=r.minGeometricError||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))},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),Tileset=function(){function n(t,e){var r=this,o,s,u,l,c,p,f;if(this.id=t.tilesetUrl,this.transform=new THREE__namespace.Matrix4,this.hasMixedContent=!1,this.frameNumber=0,this.asset={version:t.asset.version,tilesetVersion:t.asset.tilesetVersion||"",gltfUpAxis:(o=t.asset.gltfUpAxis)!==null&&o!==void 0?o:"Y",overview:t.asset.overview,trajectories:(u=(s=t.asset.trajectories)===null||s===void 0?void 0:s.list)!==null&&u!==void 0?u:[],extras:t.asset.extras},this.rootMeta=(l=t.rootMeta)!==null&&l!==void 0?l:{},this.pointLength=(c=this.rootMeta.numTotalPoints)!==null&&c!==void 0?c:1/0,this.floorLength=(p=this.rootMeta.numFloors)!==null&&p!==void 0?p:1,this.properties=(f=t.properties)!==null&&f!==void 0?f:{},this.options=e,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(g){r.cacheMemoryUsageInBytes+=g.contentMemoryUsage},onTileUnload:function(g){r.cacheMemoryUsageInBytes-=g.contentMemoryUsage,r.unloadTiles.push(g)}}),this.requestScheduler=new TileRequestScheduler(this,{onTileSkip:function(g){},onTileLoad:function(g){var A;!((A=g.content)===null||A===void 0)&&A.data&&(r.loadedTiles.add(g),r.cache.loadTile(g)),r.options.onTileLoad(g)},onTileError:function(g,A){r.options.onTileError(g,A)}}),this.loadedTiles=new Set,this.cacheMemoryUsageInBytes=0,this.currentMaxScreenSpaceError=NaN,this.root=new Tile("".concat(this.id,"#tile:0"),t.root,this),this.geometricError=t.geometricError,this.trajectories=[],this.asset.trajectories)for(var d=0;d<this.asset.trajectories.length;d++){var h=new Trajectory("".concat(this.id,"#trajectory:").concat(d),this.asset.trajectories[d],this);this.trajectories.push(h)}}return n.prototype.adjustScreenSpaceError=function(t){if((isNaN(this.currentMaxScreenSpaceError)||!isFinite(this.currentMaxScreenSpaceError))&&(this.currentMaxScreenSpaceError=t.maxScreenSpaceError),t.memoryAdjustedScreenSpaceError){var e=0;this.needsRefinedTiles.forEach(function(s){s.content&&(e+=s.content.memoryUsage)});var r=(t.maxMemoryUsage-t.memoryAdjustedOverflow)*1024*1024,o=t.maxMemoryUsage*1024*1024;e<r?this.currentMaxScreenSpaceError=Math.max(this.currentMaxScreenSpaceError/1.02,t.maxScreenSpaceError):e>o&&this.selectedTiles.length>0&&(this.currentMaxScreenSpaceError*=1.02)}else this.currentMaxScreenSpaceError=t.maxScreenSpaceError},n.prototype.getTraverser=function(t){return t.mostDetail?this.mostDetailTraverser:t.skipLevelOfDetail?this.skipTraverser:this.normalTraverser},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 f=l.unloadTiles.pop();f&&(l.loadedTiles.delete(f),l.cacheMemoryUsageInBytes-=f.contentMemoryUsage,l.options.tileUnloader(f).catch(function(){}).then(function(){t.options.onTileUnload&&t.options.onTileUnload(f)}))},l=this;this.unloadTiles.length;)u();this.cache.reset(),this.skipTraverser.reset(),this.normalTraverser.reset(),this.mostDetailTraverser.reset(),this.requestScheduler.reset(),this.loadedTiles.clear();for(var c=function(){var f=p.trajectories.pop();f&&p.options.trajectoryUnloader(f).catch(function(){}).then(function(){t.options.onTrajectoryUnload&&t.options.onTrajectoryUnload(f)})},p=this;this.trajectories.length;)c()},n.prototype.update=function(t,e){var r=this,o;e===void 0&&(e=[]),this.frameNumber=t.frameNumber,this.adjustScreenSpaceError(t),this.cache.reset(),this.getTraverser(t).traverse(this.root,t,e),this.cache.unloadTiles(function(){var h=r.cacheMemoryUsageInBytes>t.maxMemoryUsage*1024*1024;return h}),this.requestScheduler.update(this.requestedTiles,t.requestOrder,t);for(var s=function(){var h=u.unloadTiles.pop();h&&(u.loadedTiles.delete(h),u.options.tileUnloader(h).catch(function(){}).then(function(){r.options.onTileUnload&&r.options.onTileUnload(h)}))},u=this;this.unloadTiles.length;)s();this.selectedTrajectories.length=0;for(var l=function(h){h.visible===!0&&h.content.loadState==="READY"&&(!((o=h.content.data)===null||o===void 0)&&o.object)?c.selectedTrajectories.push(h):h.visible===!0&&(h.content.loadState==="FAILED"&&t.time-h.content.loadStateUpdateTime>h.content.loadfailRetryDelay&&(h.content.loadState="UNLOADED",h.content.loadStateUpdateTime=t.time),h.content.loadState==="UNLOADED"&&c.options.trajectoryLoader(h).then(function(){r.options.onTrajectoryLoad(h)}).catch(function(g){r.options.onTrajectoryError(h,g)}))},c=this,p=0,f=this.trajectories;p<f.length;p++){var d=f[p];l(d)}},n}();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(),p=(t=l.pop())!==null&&t!==void 0?t:"",f=[],d=0,h=l;d<h.length;d++){var g=h[d];if(!(g===""||g===".")){if(g===".."){f.pop();continue}f.push(g)}}return r+"//"+c+"/"+f.join("/")+"/"+p}function normalizeTileHeader(n,t){var e;if(n.content){var r=(e=n.content.uri)!==null&&e!==void 0?e:n.content.url;typeof r=="string"&&!isAbsoluteURL(r)&&(n.content.uri=normalizeURL(pathJoin(t,r)))}if(n.transform){for(var o=!1,s=0;s<16;s++){var u=n.transform[s];if(typeof u!="number"||isNaN(u)||!isFinite(u)){o=!0;break}}if(n.transform[15]===0&&(o=!0),o)throw new Error("Invalid Tile Transform: "+JSON.stringify(n.transform))}if(n.children)for(var l=0,c=n.children;l<c.length;l++){var p=c[l];normalizeTileHeader(p,t)}return n}function normalizeTilesetHeader(n,t){n.tilesetUrl=t;var e=t.slice(0,t.lastIndexOf("/")+1);if(n.asset||(n.asset={}),n.rootMeta||(n.rootMeta={}),n.rootMeta.taskParameters||(n.rootMeta.taskParameters={}),n.asset.overview){var r=n.asset.overview;isAbsoluteURL(r.imageFile)||(r.imageFile=normalizeURL(pathJoin(e,r.imageFile))),isAbsoluteURL(r.worldFile)||(r.worldFile=normalizeURL(pathJoin(e,r.worldFile)))}if(n.asset.trajectories)for(var o=0;o<n.asset.trajectories.list.length;o++){var s=n.asset.trajectories.list[o];s.file=normalizeURL(pathJoin(e,s.file))}return normalizeTileHeader(n.root,e),n}function initTextures(n,t,e){for(var r,o,s=Promise.resolve(),u=n.slice(),l=function(){for(var c=[],p=0,f=void 0;f=u.shift();){c.push(f);var d=((r=f.image)===null||r===void 0?void 0:r.width)*((o=f.image)===null||o===void 0?void 0:o.height);if(!isNaN(d)&&isFinite(d)&&(p+=d),p>=e)break}s=s.then(function(){return new Promise(function(h){AnimationFrameLoop.shared.add(function(){for(var g=0,A=c;g<A.length;g++){var m=A[g];t.initTexture(m)}h()},!0)})}).catch(function(){})};u.length>0;)l();return s}var _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,p=this._finalize(!1);p&&(p.inherited||((l=p.groupCount)!==null&&l!==void 0?l:0)<=0)&&this.materials.splice((c=p.index)!==null&&c!==void 0?c:0,1);var f={index:this.materials.length,name:s||"",mtllib:Array.isArray(u)&&u.length>0?u[u.length-1]:"",smooth:p!==void 0?p.smooth:this.smooth,groupStart:p!==void 0?p.groupEnd:0,groupEnd:-1,groupCount:-1,inherited:!1,clone:function(d){var h={index:typeof d=="number"?d:this.index,name:this.name,mtllib:this.mtllib,smooth:this.smooth,groupStart:0,groupEnd:-1,groupCount:-1,inherited:!1,clone:function(){return this}};return h.clone=this.clone.bind(h),h}};return this.materials.push(f),f},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 p=this.materials.length-1;p>=0;p--)((l=this.materials[p].groupCount)!==null&&l!==void 0?l:0)<=0&&this.materials.splice(p,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,p){var f=this.object.geometry,d=this.vertices.length,h=this.normals.length,g=this.uvs.length,A=this.parseVertexIndex(t,d),m=this.parseVertexIndex(e,d),E=this.parseVertexIndex(r,d),v=l!==void 0?this.parseNormalIndex(l,h):void 0,y=c!==void 0?this.parseNormalIndex(c,h):void 0,b=p!==void 0?this.parseNormalIndex(p,h):void 0,T=o!==void 0?this.parseUVIndex(o,g):void 0,_=s!==void 0?this.parseUVIndex(s,g):void 0,S=u!==void 0?this.parseUVIndex(u,g):void 0;(f.hasNormal===!0&&v===void 0||y===void 0||b===void 0)&&(f.hasNormal=!1),(f.hasUV===!0&&T===void 0||_===void 0||S===void 0)&&(f.hasUV=!1);var R=[A,T,v].join(":"),M=f.indexMap[R];M===void 0&&(M=f.vertices.length/3,f.indexMap[R]=M,f.vertices.push(this.vertices[A+0],this.vertices[A+1],this.vertices[A+2]),f.hasColor&&(this.colors[A]===void 0?f.hasColor=!1:f.colors.push(this.colors[A+0],this.colors[A+1],this.colors[A+2])),f.hasNormal&&f.normals.push(this.normals[A+0],this.normals[A+1],this.normals[A+2]),f.hasUV&&f.uvs.push(this.uvs[T+0],this.uvs[T+1])),f.index.push(M);var H=[m,_,y].join(":"),B=f.indexMap[H];B===void 0&&(B=f.vertices.length/3,f.indexMap[H]=B,f.vertices.push(this.vertices[m+0],this.vertices[m+1],this.vertices[m+2]),f.hasColor&&(this.colors[m]===void 0?f.hasColor=!1:f.colors.push(this.colors[m+0],this.colors[m+1],this.colors[m+2])),f.hasNormal&&f.normals.push(this.normals[m+0],this.normals[m+1],this.normals[m+2]),f.hasUV&&f.uvs.push(this.uvs[_+0],this.uvs[_+1])),f.index.push(B);var C=[E,S,b].join(":"),w=f.indexMap[C];w===void 0&&(w=f.vertices.length/3,f.indexMap[C]=w,f.vertices.push(this.vertices[E+0],this.vertices[E+1],this.vertices[E+2]),f.hasColor&&(this.colors[E]===void 0?f.hasColor=!1:f.colors.push(this.colors[E+0],this.colors[E+1],this.colors[E+2])),f.hasNormal&&f.normals.push(this.normals[E+0],this.normals[E+1],this.normals[E+2]),f.hasUV&&f.uvs.push(this.uvs[S+0],this.uvs[S+1])),f.index.push(w)},n}();function parseObj(n){var t=new ObjState;n.indexOf(`\r
|
|
917
|
+
`&&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}(),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;var _b=freb(fdeb,0),fd=_b.b,rev=new u16(32768);for(var 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}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 p=o<<4|n[o],f=t-n[o],d=u[n[o]-1]++<<f,h=d|(1<<f)-1;d<=h;++d)l[rev[d]>>c]=p}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);for(var 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;var fdt=new u8(32);for(var 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 p=function(le){var ae=e.length;if(le>ae){var oe=new u8(Math.max(ae*2,le));oe.set(e),e=oe}},f=t.f||0,d=t.p||0,h=t.b||0,g=t.l,A=t.d,m=t.m,E=t.n,v=o*8;do{if(!g){f=bits(n,d,1);var y=bits(n,d+1,3);if(d+=3,y)if(y==1)g=flrm,A=fdrm,m=9,E=5;else if(y==2){var S=bits(n,d,31)+257,R=bits(n,d+10,15)+4,M=S+bits(n,d+5,31)+1;d+=14;for(var H=new u8(M),B=new u8(19),C=0;C<R;++C)B[clim[C]]=bits(n,d+C*3,7);d+=R*3;for(var w=max(B),I=(1<<w)-1,O=hMap(B,w,1),C=0;C<M;){var L=O[bits(n,d,I)];d+=L&15;var b=L>>4;if(b<16)H[C++]=b;else{var N=0,z=0;for(b==16?(z=3+bits(n,d,3),d+=2,N=H[C-1]):b==17?(z=3+bits(n,d,7),d+=3):b==18&&(z=11+bits(n,d,127),d+=7);z--;)H[C++]=N}}var J=H.subarray(0,S),G=H.subarray(S);m=max(J),E=max(G),g=hMap(J,m,1),A=hMap(G,E,1)}else err(1);else{var b=shft(d)+4,T=n[b-4]|n[b-3]<<8,_=b+T;if(_>o){c&&err(0);break}l&&p(h+T),e.set(n.subarray(b,_),h),t.b=h+=T,t.p=d=_*8,t.f=f;continue}if(d>v){c&&err(0);break}}l&&p(h+131072);for(var Q=(1<<m)-1,U=(1<<E)-1,q=d;;q=d){var N=g[bits16(n,d)&Q],K=N>>4;if(d+=N&15,d>v){c&&err(0);break}if(N||err(2),K<256)e[h++]=K;else if(K==256){q=d,g=null;break}else{var Y=K-254;if(K>264){var C=K-257,Z=fleb[C];Y=bits(n,d,(1<<Z)-1)+fl[C],d+=Z}var te=A[bits16(n,d)&U],j=te>>4;te||err(3),d+=te&15;var G=fd[j];if(j>3){var Z=fdeb[j];G+=bits16(n,d)&(1<<Z)-1,d+=Z}if(d>v){c&&err(0);break}l&&p(h+131072);var ee=h+Y;if(h<G){var W=s-G,re=Math.min(G,ee);for(W+h<0&&err(3);h<re;++h)e[h]=r[W+h]}for(;h<ee;++h)e[h]=e[h-G]}}t.l=g,t.p=q,t.b=h,t.f=f,g&&(f=1,t.m=m,t.d=A,t.n=E)}while(!f);return h!=e.length&&u?slc(e,0,h):e.subarray(0,h)},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],p=l[1],f=l[2];return[b2(n,t+10),c,p,o,s+b2(n,t+30)+b2(n,t+32),f]},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 p=zh(n,s,u),f=p[0],d=p[1],h=p[2],g=p[3],A=p[4],m=p[5],E=slzh(n,m);s=A,f?f==8?e[g]=inflateSync(n.subarray(E,E+d),{out:new u8(h)}):err(14,"unknown compression type "+f):e[g]=slc(n,E,E+d)}return e}function loadFbx(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;return parse$2(l,{light:t.light,resourcePath:n.slice(0,n.lastIndexOf("/")+1),search:(c=n.split("?")[1])!==null&&c!==void 0?c:"",fetcher:s})}).then(function(l){var c=l.scene,p=l.unitScale/100,f=new THREE__namespace.Matrix4;if(f.makeScale(p,p,p),l.upAxis==="X")throw new Error("Cannot load fbx x upAxis");return l.upAxis==="Y"&&f.premultiply(ROTATE_X_MATRIX),o==="Y"&&f.premultiply(ROTATE_X_MATRIX_INVERSE),c.applyMatrix4(f),{type:"fbx",modelUpAxis:l.upAxis,upAxis:o,uri:n,byteLength:u,memoryUsage:getMemoryUsage(c),scene:c,textures:l.textures,animations:l.animations,dispose:function(){return l.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.light=(e=t.light)!==null&&e!==void 0?e:!0,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),p=Object.assign(new THREE__namespace.Group,{animations:[]}),f=[],d=this.parseImages(t),h=this.parseTextures(t,d,c,f),g=this.parseMaterials(t,h,c),A=this.parseDeformers(t,c),m=new GeometryParser().parse(t,A,c);this.parseScene(t,A,m,g,c,p);var E=(r=(e=t.GlobalSettings.UpAxis)===null||e===void 0?void 0:e.value)!==null&&r!==void 0?r:1,v=(s=(o=t.GlobalSettings.FrontAxis)===null||o===void 0?void 0:o.value)!==null&&s!==void 0?s:2,y=(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],S=T[1],R=T[2];if(_!==0||S!==0||R!==0){var M=new THREE__namespace.Color().setRGB(_,S,R);b=new THREE__namespace.AmbientLight(M,1)}}return Promise.all(f).then(function(H){var B;return{scene:p,textures:H,ambientLight:b,upAxis:["X","Y","Z"][E],frontAxis:["X","Y","Z"][v],unitScale:y,animations:(B=p.animations)!==null&&B!==void 0?B:[],dispose:function(){H.forEach(function(C){return C.dispose()}),g.forEach(function(C){return C.dispose()}),m.forEach(function(C){return C.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 p={ID:s,relationship:l};e.get(u).children.push(p)})}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,p=typeof u.Content=="string"&&u.Content!=="";if(c||p){var f=this.parseImage(o[s]);r[u.RelativeFilename||u.Filename]=f}}}}for(var l in e){var d=e[l];r[d]!==void 0?e[l]=r[d]: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,p=l!==void 0?l.value:0;if(s.wrapS=c===0?THREE__namespace.RepeatWrapping:THREE__namespace.ClampToEdgeWrapping,s.wrapT=p===0?THREE__namespace.RepeatWrapping:THREE__namespace.ClampToEdgeWrapping,t.Scaling){var f=t.Scaling.value;s.repeat.x=f[0],s.repeat.y=f[1]}if(t.Translation){var f=t.Translation.value;s.offset.x=f[0],s.offset.y=f[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(f){return f.body});var p=c.then(function(f){return l.image=f,l.needsUpdate=!0,l}).catch(function(f){return console.warn(f),l});return o.push(p),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,u=e.attrName,l=e.ShadingModel;if(typeof l=="object"&&(l=l.value),l=l.toLowerCase(),!o.has(s))return null;var c=new PBMMeshMaterial(this.light?"phong":"basic");c.name=u,e.BumpFactor&&(c.bumpScale=e.BumpFactor.value),e.Diffuse?c.color=new THREE__namespace.Color().fromArray(e.Diffuse.value):e.DiffuseColor&&(e.DiffuseColor.type==="Color"||e.DiffuseColor.type==="ColorRGB")&&(c.color=new THREE__namespace.Color().fromArray(e.DiffuseColor.value)),e.DisplacementFactor&&(c.displacementScale=e.DisplacementFactor.value),e.Emissive?c.emissive=new THREE__namespace.Color().fromArray(e.Emissive.value):e.EmissiveColor&&(e.EmissiveColor.type==="Color"||e.EmissiveColor.type==="ColorRGB")&&(c.emissive=new THREE__namespace.Color().fromArray(e.EmissiveColor.value)),e.EmissiveFactor&&(c.emissiveIntensity=parseFloat(e.EmissiveFactor.value));var p=1-(e.TransparencyFactor?parseFloat(e.TransparencyFactor.value):0);(p===1||p===0)&&(p=e.Opacity?parseFloat(e.Opacity.value):null,p===null&&(p=1-(e.TransparentColor?parseFloat(e.TransparentColor.value[0]):0))),c.opacity=p,c.opacity<1&&(c.transparent=!0),e.ReflectionFactor&&(c.reflectivity=e.ReflectionFactor.value),e.Shininess&&(c.shininess=e.Shininess.value),e.Specular?c.specular=new THREE__namespace.Color().fromArray(e.Specular.value):e.SpecularColor&&e.SpecularColor.type==="Color"&&(c.specular=new THREE__namespace.Color().fromArray(e.SpecularColor.value));var f=this;return o.get(s).children.forEach(function(d){var h=d.relationship;switch(h){case"Bump":c.bumpMap=f.getTexture(t,r,d.ID,o);break;case"Maya|TEX_ao_map":c.aoMap=f.getTexture(t,r,d.ID,o);break;case"DiffuseColor":case"Maya|TEX_color_map":c.map=f.getTexture(t,r,d.ID,o),c.map!==void 0&&(c.map.encoding=THREE__namespace.sRGBEncoding);break;case"DisplacementColor":c.displacementMap=f.getTexture(t,r,d.ID,o);break;case"EmissiveColor":c.emissiveMap=f.getTexture(t,r,d.ID,o),c.emissiveMap!==void 0&&(c.emissiveMap.encoding=THREE__namespace.sRGBEncoding);break;case"NormalMap":case"Maya|TEX_normal_map":c.normalMap=f.getTexture(t,r,d.ID,o);break;case"ReflectionColor":c.envMap=f.getTexture(t,r,d.ID,o),c.envMap!==void 0&&(c.envMap.mapping=THREE__namespace.EquirectangularReflectionMapping,c.envMap.encoding=THREE__namespace.sRGBEncoding);break;case"SpecularColor":c.specularMap=f.getTexture(t,r,d.ID,o),c.specularMap!==void 0&&(c.specularMap.encoding=THREE__namespace.sRGBEncoding);break;case"TransparentColor":case"TransparencyFactor":c.alphaMap=f.getTexture(t,r,d.ID,o),c.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.",h);break}}),c},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 p=this.parseSkeleton(c,s);p.ID=u,c.parents.length>1&&console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."),p.geometryID=c.parents[0].ID,r[u]=p}else if(l.attrType==="BlendShape"){var f={id:u};f.rawTargets=this.parseMorphTargets(c,s,e),f.id=u,c.parents.length>1&&console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."),o[u]=f}}}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(p){return p.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,p=this;l.forEach(function(d){var h=c[d.ID];p.setLookAtProperties(t,d,h,s,u);var g=s.get(d.ID).parents;g.forEach(function(A){var m=l.get(A.ID);m!==void 0&&m.add(d)}),d.parent===null&&u.add(d)}),this.bindSkeleton(t,e.skeletons,r,l,s),u.traverse(function(d){if(d.userData.transformData){d.parent&&(d.userData.transformData.parentMatrix=d.parent.matrix,d.userData.transformData.parentMatrixWorld=d.parent.matrixWorld);var h=generateTransform(d.userData.transformData);d.applyMatrix4(h),d.updateWorldMatrix(!0,!0)}});var f=new AnimationParser().parse(t,s,u);u.children.length===1&&u.children[0]instanceof THREE__namespace.Group&&(u=u.children[0]),u.animations=f},n.prototype.parseModels=function(t,e,r,o,s){var u=new Map,l=t.Objects.Model;for(var c in l){var p=parseInt(c),f=l[c],d=s.get(p),h=this.buildSkeleton(d,e,p,f.attrName);if(!h){switch(f.attrType){case"Camera":h=this.createCamera(t,d);break;case"Light":h=this.createLight(t,d);break;case"Mesh":h=this.createMesh(d,r,o);break;case"NurbsCurve":case"LimbNode":case"Root":h=new THREE__namespace.Bone;break;case"Null":default:h=new THREE__namespace.Group;break}h.name=f.attrName?THREE__namespace.PropertyBinding.sanitizeNodeName(f.attrName):"",h.userData.originalName=f.attrName,h.ID=p}this.getTransformData(h,f),u.set(p,h)}return u},n.prototype.buildSkeleton=function(t,e,r,o){var s=null;return t.parents.forEach(function(u){var l=function(p){var f=e[p];f.rawBones.forEach(function(d,h){if(d.ID===u.ID){var g=s;s=new THREE__namespace.Bone,s.matrixWorld.copy(d.transformLink),s.name=o?THREE__namespace.PropertyBinding.sanitizeNodeName(o):"",s.userData.originalName=o,s.ID=r,f.bones[h]=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 A=t.Objects.NodeAttribute[g.ID];A!==void 0&&(o=A)}),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,p=window.innerHeight;o.AspectWidth!==void 0&&o.AspectHeight!==void 0&&(c=o.AspectWidth.value,p=o.AspectHeight.value);var f=c/p,d=45;o.FieldOfView!==void 0&&(d=o.FieldOfView.value);var h=o.FocalLength?o.FocalLength.value:null;switch(s){case 0:r=new THREE__namespace.PerspectiveCamera(d,f,u,l),h!==null&&r.setFocalLength(h);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(h){var g=t.Objects.NodeAttribute[h.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 p=1;switch(s){case 0:r=new THREE__namespace.PointLight(u,l,c,p);break;case 1:r=new THREE__namespace.DirectionalLight(u,l);break;case 2:var f=Math.PI/3;o.InnerAngle!==void 0&&(f=THREE__namespace.MathUtils.degToRad(o.InnerAngle.value));var d=0;o.OuterAngle!==void 0&&(d=THREE__namespace.MathUtils.degToRad(o.OuterAngle.value),d=Math.max(d,1)),r=new THREE__namespace.SpotLight(u,l,c,f,d,p);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.light?"phong":"basic");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?(u.forEach(function(c){c.skinning=!0}),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 p=c.Lcl_Translation.value;"target"in e&&e.target instanceof THREE__namespace.Object3D?(e.target.position.fromArray(p),s.add(e.target)):e.lookAt(new THREE__namespace.Vector3().fromArray(p))}}})}},n.prototype.bindSkeleton=function(t,e,r,o,s){var u=this.parsePoseNodes(t),l=function(p){var f=e[p],d=s.get(parseInt(f.ID)).parents;d.forEach(function(h){if(r.has(h.ID)){var g=h.ID,A=s.get(g);A.parents.forEach(function(m){if(o.has(m.ID)){var E=o.get(m.ID);E instanceof THREE__namespace.SkinnedMesh&&E.bind(new THREE__namespace.Skeleton(f.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(h){return t.Objects.Model[h.ID]});if(l.length!==0){var c=e.children.reduce(function(h,g){return s[g.ID]!==void 0&&(h=s[g.ID]),h},null);e.children.forEach(function(h){o.morphTargets[h.ID]!==void 0&&u.push(o.morphTargets[h.ID])});var p=l[0],f={};p.RotationOrder&&(f.eulerOrder=getEulerOrder(p.RotationOrder.value)),p.InheritType&&(f.inheritType=parseInt(p.InheritType.value)),p.GeometricTranslation&&(f.translation=p.GeometricTranslation.value),p.GeometricRotation&&(f.rotation=p.GeometricRotation.value),p.GeometricScaling&&(f.scale=p.GeometricScaling.value);var d=generateTransform(f);return this.genGeometry(t,r,c,u,d)}},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),p=new THREE__namespace.Float32BufferAttribute(c.vertex,3);if(p.applyMatrix4(s),u.setAttribute("position",p),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 f=new THREE__namespace.Matrix3().getNormalMatrix(s),d=new THREE__namespace.Float32BufferAttribute(c.normal,3);d.applyNormalMatrix(f),u.setAttribute("normal",d)}if(c.uvs.forEach(function(E,v){var y=v===0?"uv":"uv".concat(v+1);u.setAttribute(y,new THREE__namespace.Float32BufferAttribute(c.uvs[v],2))}),l.material&&l.material.mappingType!=="AllSame"){var h=c.materialIndex[0],g=0;if(c.materialIndex.forEach(function(E,v){E!==h&&(u.addGroup(g,v-g,h),h=E,g=v)}),u.groups.length>0){var A=u.groups[u.groups.length-1],m=A.start+A.count;m!==c.materialIndex.length&&u.addGroup(m,c.materialIndex.length-m,h)}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=[],p=[],f=[],d=[],h=this;return t.vertexIndices.forEach(function(g,A){var m=0,E=!1;g<0&&(g=g^-1,E=!0);var v=[],y=[];if(u.push(g*3,g*3+1,g*3+2),t.color){var b=getData(A,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(R){y.push(R.weight),v.push(R.id)}),y.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];y.forEach(function(R,M){var H=R,B=v[M];_.forEach(function(C,w,I){if(H>C){I[w]=H,H=C;var O=T[w];T[w]=B,B=O}})}),v=T,y=_}for(;y.length<4;)y.push(0),v.push(0);for(var S=0;S<4;++S)f.push(y[S]),d.push(v[S])}if(t.normal){var b=getData(A,r,g,t.normal);l.push(b[0],b[1],b[2])}t.material&&t.material.mappingType!=="AllSame"&&(m=getData(A,r,g,t.material)[0],m<0&&(h.negativeMaterialIndices=!0,m=0)),t.uv&&t.uv.forEach(function(R,M){var H=getData(A,r,g,R);p[M]===void 0&&(p[M]=[]),p[M].push(H[0]),p[M].push(H[1])}),o++,E&&(h.genFace(e,t,u,m,l,c,p,f,d,o),r++,o=0,u=[],l=[],c=[],p=[],f=[],d=[])}),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,p,f){var d;if(f>3){for(var h=[],g=e.baseVertexPositions||e.vertexPositions,A=0;A<r.length;A+=3)h.push(new THREE__namespace.Vector3(g[r[A]],g[r[A+1]],g[r[A+2]]));for(var m=this.getNormalTangentAndBitangent(h),E=m.tangent,v=m.bitangent,y=[],b=0,T=h;b<T.length;b++){var _=T[b];y.push(this.flattenVertex(_,E,v))}d=THREE__namespace.ShapeUtils.triangulateShape(y,[])}else d=[[0,1,2]];for(var S=function(I,O,L){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[O*3]]),t.vertex.push(e.vertexPositions[r[O*3+1]]),t.vertex.push(e.vertexPositions[r[O*3+2]]),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]]),e.skeleton&&(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[O*4]),t.vertexWeights.push(c[O*4+1]),t.vertexWeights.push(c[O*4+2]),t.vertexWeights.push(c[O*4+3]),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.weightsIndices.push(p[I*4]),t.weightsIndices.push(p[I*4+1]),t.weightsIndices.push(p[I*4+2]),t.weightsIndices.push(p[I*4+3]),t.weightsIndices.push(p[O*4]),t.weightsIndices.push(p[O*4+1]),t.weightsIndices.push(p[O*4+2]),t.weightsIndices.push(p[O*4+3]),t.weightsIndices.push(p[L*4]),t.weightsIndices.push(p[L*4+1]),t.weightsIndices.push(p[L*4+2]),t.weightsIndices.push(p[L*4+3])),e.color&&(t.colors.push(u[I*3]),t.colors.push(u[I*3+1]),t.colors.push(u[I*3+2]),t.colors.push(u[O*3]),t.colors.push(u[O*3+1]),t.colors.push(u[O*3+2]),t.colors.push(u[L*3]),t.colors.push(u[L*3+1]),t.colors.push(u[L*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[I*3]),t.normal.push(s[I*3+1]),t.normal.push(s[I*3+2]),t.normal.push(s[O*3]),t.normal.push(s[O*3+1]),t.normal.push(s[O*3+2]),t.normal.push(s[L*3]),t.normal.push(s[L*3+1]),t.normal.push(s[L*3+2])),e.uv&&e.uv.forEach(function(N,z){t.uvs[z]===void 0&&(t.uvs[z]=[]),t.uvs[z].push(l[z][I*2]),t.uvs[z].push(l[z][I*2+1]),t.uvs[z].push(l[z][O*2]),t.uvs[z].push(l[z][O*2+1]),t.uvs[z].push(l[z][L*2]),t.uvs[z].push(l[z][L*2+1])})},R=0,M=d;R<M.length;R++){var H=M[R],B=H[0],C=H[1],w=H[2];S(B,C,w)}},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 p=t.Objects.Geometry[c.geoID];p!==void 0&&u.genMorphGeometry(e,r,p,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:[],p=r.Indexes?r.Indexes.a:[],f=t.attributes.position.count*3,d=new Float32Array(f),h=0;h<p.length;h++){var g=p[h]*3;d[g]=c[h*3],d[g+1]=c[h*3+1],d[g+2]=c[h*3+2]}var A={vertexIndices:l,vertexPositions:d,baseVertexPositions:u},m=this.genBuffers(A),E=new THREE__namespace.Float32BufferAttribute(m.vertex,3);E.name=s||r.attrName,E.applyMatrix4(o),t.morphAttributes.position.push(E)},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 p,f;if(t.Form==="Closed")s.push(s[0]);else if(t.Form==="Periodic"){p=r,f=o.length-1-p;for(var l=0;l<r;++l)s.push(s[l])}var d=new NURBSCurve(r,o,s,p,f),h=d.getPoints(s.length*12);return new THREE__namespace.BufferGeometry().setFromPoints(h)},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,p=l.parents[0].relationship,f=e.get(c);f&&(p.match(/X/)?f.curves.x=u:p.match(/Y/)?f.curves.y=u:p.match(/Z/)?f.curves.z=u:p.match(/DeformPercent/)&&e.has(c)&&(f.curves.morph=u))}}},n.prototype.parseAnimationLayers=function(t,e,r,o){var s=t.Objects.AnimationLayer,u=new Map,l=function(p){var f=[],d=r.get(parseInt(p));if(d!==void 0){var h=d.children;h.forEach(function(g,A){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(f[A]===void 0){var E=r.get(g.ID).parents.filter(function(M){return M.relationship!==void 0})[0].ID;if(E!==void 0){var v=t.Objects.Model[E.toString()];if(v===void 0){console.warn("THREE.FBXLoader: Encountered a unused curve.",g);return}var y={modelName:v.attrName?THREE__namespace.PropertyBinding.sanitizeNodeName(v.attrName):"",ID:v.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===v.id&&(y.transform=M.matrix,M.userData.transformData&&(y.eulerOrder=M.userData.transformData.eulerOrder))}),y.transform||(y.transform=new THREE__namespace.Matrix4),v.PreRotation&&(y.preRotation=v.PreRotation.value),v.PostRotation&&(y.postRotation=v.PostRotation.value),f[A]=y}}f[A]&&(f[A][m.attr]=m)}else if(m.curves.morph!==void 0){if(f[A]===void 0){var b=r.get(g.ID).parents.filter(function(H){return H.relationship!==void 0})[0].ID,T=r.get(b).parents[0].ID,_=r.get(T).parents[0].ID,E=r.get(_).parents[0].ID,S=t.Objects.Model[E],R={modelName:S.attrName?THREE__namespace.PropertyBinding.sanitizeNodeName(S.attrName):"",morphName:t.Objects.Deformer[b].attrName};f[A]=R}f[A][m.attr]=m}}}),u.set(parseInt(p),f)}};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 p=this.generateRotationTrack(t.modelName,t.R.curves,t.preRotation,t.postRotation,t.eulerOrder);p!==void 0&&r.push(p)}if(t.S!==void 0&&Object.keys(t.S.curves).length>0){var f=this.generateVectorTrack(t.modelName,t.S.curves,l,"scale");f!==void 0&&r.push(f)}if(t.DeformPercent!==void 0){var d=this.generateMorphTrack(t,e);d!==void 0&&r.push(d)}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 p=getEulerOrder(0),f=new THREE__namespace.Quaternion,d=new THREE__namespace.Quaternion;r!==void 0&&(r=r.map(THREE__namespace.MathUtils.degToRad),r.push(p),f.setFromEuler(new THREE__namespace.Euler().fromArray(r))),o!==void 0&&(o=o.map(THREE__namespace.MathUtils.degToRad),o.push(p),d.setFromEuler(new THREE__namespace.Euler().fromArray(o)),d.inverse());var h=new THREE__namespace.Quaternion,g=new THREE__namespace.Euler,A=[];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),h.setFromEuler(g),h.premultiply(f),h.multiply(d),m>2){var E=new THREE__namespace.Quaternion().fromArray(A,(m-3)/3*4);E.dot(h)<0&&h.set(-h.x,-h.y,-h.z,-h.w)}h.toArray(A,m/3*4)}return new THREE__namespace.QuaternionKeyframeTrack(t+".quaternion",u,A)},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(p){if(e.x&&(u=e.x.times.indexOf(p)),e.y&&(l=e.y.times.indexOf(p)),e.z&&(c=e.z.times.indexOf(p)),u!==-1){var f=e.x.values[u];s.push(f),o[0]=f}else s.push(o[0]);if(l!==-1){var d=e.y.values[l];s.push(d),o[1]=d}else s.push(o[1]);if(c!==-1){var h=e.z.values[c];s.push(h),o[2]=h}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 p=c.map(THREE__namespace.MathUtils.degToRad),f=[t.values[l],e.values[l],r.values[l]];if(!(isNaN(f[0])||isNaN(f[1])||isNaN(f[2]))){f.map(THREE__namespace.MathUtils.degToRad);var d=[f[0]-c[0],f[1]-c[1],f[2]-c[2]],h=[Math.abs(d[0]),Math.abs(d[1]),Math.abs(d[2])];if(h[0]>=180||h[1]>=180||h[2]>=180){var g=Math.max.apply(Math,h),A=g/180,m=new THREE__namespace.Euler(p[0],p[1],p[2],o),E=new THREE__namespace.Euler(p[0],p[1],p[2],o),v=new THREE__namespace.Quaternion().setFromEuler(m),y=new THREE__namespace.Quaternion().setFromEuler(E);v.dot(y)&&y.set(-y.x,-y.y,-y.z,-y.w);for(var b=t.times[l-1],T=t.times[l]-b,_=new THREE__namespace.Quaternion,S=new THREE__namespace.Euler,R=0;R<1;R+=1/A)_.copy(v.clone().slerp(y.clone(),R)),s.push(b+R*T),S.setFromQuaternion(_,o),u.push(S.x),u.push(S.y),u.push(S.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+):(.*){"),p=o.match("^\\t{"+e.currentIndent+"}(\\w+):[\\s\\t\\r\\n](.*)"),f=o.match("^\\t{"+(e.currentIndent-1)+"}}");c?e.parseNodeBegin(o,c):p?e.parseNodeProperty(o,p,r[++s]):f?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),p=parseInt(c[0]),f=parseInt(c[1]),d=s.split(",").slice(3);d=d.map(function(h){return h.trim().replace(/^"/,"")}),o="connections",s=[p,f],append(s,d),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(f){return f.trim().replace(/^\"/,"").replace(/\s/,"_")}),s=o[0],u=o[1],l=o[2],c=o[3],p=o[4];switch(u){case"int":case"enum":case"bool":case"ULongLong":case"double":case"Number":case"FieldOfView":p=parseFloat(p);break;case"Color":case"ColorRGB":case"Vector3D":case"Lcl_Translation":case"Lcl_Rotation":case"Lcl_Scaling":p=parseNumberArray(p);break}this.getPrevNode()[s]={type:u,type2:l,flag:c,value:p},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=[],p=0;p<s;p++)c.push(this.parseProperty(t));var f=c.length>0?c[0]:"",d=c.length>1?c[1]:"",h=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 f=="number"&&(r.id=f),d!==""&&(r.attrName=d),h!==""&&(r.attrType=h),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(h,g){g!==0&&s.push(h)}),e.connections===void 0&&(e.connections=[]),e.connections.push(s)}else if(r.name==="Properties70"){var u=Object.keys(r);u.forEach(function(h){e[h]=r[h]})}else if(t==="Properties70"&&r.name==="P"){var l=r.propertyList[0],c=r.propertyList[1],p=r.propertyList[2],f=r.propertyList[3],d=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?d=[r.propertyList[4],r.propertyList[5],r.propertyList[6]]:d=r.propertyList[4],e[l]={type:c,type2:p,flag:f,value:d}}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,p=new THREE__namespace.Matrix4,f=new THREE__namespace.Matrix4,d=new THREE__namespace.Matrix4,h=new THREE__namespace.Matrix4,g=n.inheritType?n.inheritType:0;n.translation&&t.setPosition(tempVec.fromArray(n.translation));var A=getEulerOrder(0);if(n.preRotation){var m=n.preRotation.map(THREE__namespace.MathUtils.degToRad);m.push(A),e.makeRotationFromEuler(tempEuler.fromArray(m))}if(n.rotation){var m=n.rotation.map(THREE__namespace.MathUtils.degToRad);m.push(n.eulerOrder||A),r.makeRotationFromEuler(tempEuler.fromArray(m))}if(n.postRotation){var m=n.postRotation.map(THREE__namespace.MathUtils.degToRad);m.push(A),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&&p.setPosition(tempVec.fromArray(n.rotationPivot)),n.parentMatrixWorld&&(d.copy(n.parentMatrix),f.copy(n.parentMatrixWorld));var E=e.clone().multiply(r).multiply(o),v=new THREE__namespace.Matrix4;v.extractRotation(f);var y=new THREE__namespace.Matrix4;y.copyPosition(f);var b=new THREE__namespace.Matrix4().getInverse(y).multiply(f),T=new THREE__namespace.Matrix4().getInverse(v).multiply(b),_=s,S=new THREE__namespace.Matrix4;if(g===0)S.copy(v).multiply(E).multiply(T).multiply(_);else if(g===1)S.copy(v).multiply(T).multiply(E).multiply(_);else{var R=new THREE__namespace.Matrix4().scale(new THREE__namespace.Vector3().setFromMatrixScale(d)),M=new THREE__namespace.Matrix4().getInverse(R),H=T.clone().multiply(M);S.copy(v).multiply(E).multiply(H).multiply(_)}var B=new THREE__namespace.Matrix4().getInverse(p),C=new THREE__namespace.Matrix4().getInverse(u),w=t.clone().multiply(c).multiply(p).multiply(e).multiply(r).multiply(o).multiply(B).multiply(l).multiply(u).multiply(s).multiply(C),I=new THREE__namespace.Matrix4().copyPosition(w),O=f.clone().multiply(I);return h.copyPosition(O),w=h.clone().multiply(S),w.premultiply(new THREE__namespace.Matrix4().getInverse(f)),w}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,p=o?o.length:0;l.degree=e,l.knots=r,l.controlPoints=[],l.startKnot=s||0,l.endKnot=u||c;for(var f=0;f<p;++f){var d=o[f];l.controlPoints[f]=new THREE__namespace.Vector4(d.x,d.y,d.z,d.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,p=0;p<l;++p){var f=u[p+1],d=s[l-p],h=o[p]/(f+d);o[p]=c+f*h,c=d*h}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],p=s[l],f=c.w*p;u.x+=c.x*f,u.y+=c.y*f,u.z+=c.z*f,u.w+=c.w*p}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 p=s.slice(0),f=s.slice(0),d=1;d<=e;++d){p[d]=t-o[n+1-d],f[d]=o[n+d]-t;for(var h=0,g=0;g<d;++g){var A=f[g+1],m=p[d-g];c[d][g]=A+m;var E=c[g][d-1]/c[d][g];c[g][d]=h+A*E,h=m*E}c[d][d]=h}for(var d=0;d<=e;++d)l[0][d]=c[d][e];for(var v=0;v<=e;++v){for(var y=0,b=1,T=[],u=0;u<=e;++u)T[u]=s.slice(0);T[0][0]=1;for(var _=1;_<=r;++_){var S=0,R=v-_,M=e-_;v>=_&&(T[b][0]=T[y][0]/c[M+1][R],S=T[b][0]*c[R][M]);for(var H=R>=-1?1:-R,B=v-1<=M?_-1:e-v,C=H;C<=B;++C)T[b][C]=(T[y][C]-T[y][C-1])/c[M+1][R+C],S+=T[b][C]*c[R+C][M];v<=M&&(T[b][_]=-T[y][_-1]/c[M+1][v],S+=T[b][_]*c[v][M]),l[_][v]=S;var d=y;y=b,b=d}}for(var w=e,_=1;_<=r;++_){for(var d=0;d<=e;++d)l[_][d]*=w;w*=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),p=[],f=0;f<e.length;++f){var d=e[f].clone(),h=d.w;d.x*=h,d.y*=h,d.z*=h,p[f]=d}for(var g=0;g<=s;++g){for(var d=p[l-n].clone().multiplyScalar(c[g][0]),A=1;A<=n;++A)d.add(p[l-n+A].clone().multiplyScalar(c[g][A]));u[g]=d}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,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={byteLength:0};return Promise.resolve().then(function(){return s.ajax(n,{responseType:"arraybuffer"})}).then(function(l){var c,p;return u.byteLength=l.body.byteLength,parse$1(new Uint8Array(l.body),{light:(c=t.light)!==null&&c!==void 0?c:!0,color:t.color,resourcePath:n.slice(0,n.lastIndexOf("/")+1),search:(p=n.split("?")[1])!==null&&p!==void 0?p:"",fetcher:s})}).then(function(l){var c=new THREE__namespace.Group;return c.name=n,c.add(l.object),o==="Y"&&c.applyMatrix4(ROTATE_X_MATRIX_INVERSE),{type:"x3p",modelUpAxis:"Z",upAxis:o,uri:n,byteLength:u.byteLength,memoryUsage:getMemoryUsage(c),scene:c,textures:[],animations:[],dispose:function(){return l.dispose()}}})}function parse$1(n,t){for(var e,r,o,s,u,l,c,p,f,d,h,g,A,m,E,v,y,b,T,_,S,R,M,H,B,C,w,I,O,L,N,z,J,G,Q,U,q,K,Y,Z,te,j,ee,W,re,le,ae,oe,se,ce,ve,Te,pe,me,X=unzipSync(n),ne="",V=null,Ee=0,fe=Object.keys(X);Ee<fe.length;Ee++){var he=fe[Ee];/(^|\/)main\.xml$/i.test(he)&&(V=X[he],ne=he.slice(0,he.lastIndexOf("/")+1))}if(!V)throw new Error("X3p: main.xml not found.");if(typeof DOMParser=="undefined")throw new Error("X3p: DOMParser not found.");var Ne=(e=t.color)!==null&&e!==void 0?e:new THREE__namespace.Color(10066329),rt=new DOMParser,Ye=decodeText(V),ge=rt.parseFromString(Ye,"text/xml"),ie=ge.querySelector("Record1 Axes"),de={x:{type:(s=(o=(r=ie==null?void 0:ie.querySelector("CX AxisType"))===null||r===void 0?void 0:r.textContent)===null||o===void 0?void 0:o.toUpperCase())!==null&&s!==void 0?s:"I",dataType:(c=(l=(u=ie==null?void 0:ie.querySelector("CX DataType"))===null||u===void 0?void 0:u.textContent)===null||l===void 0?void 0:l.toUpperCase())!==null&&c!==void 0?c:"D",increment:Number((f=(p=ie==null?void 0:ie.querySelector("CX Increment"))===null||p===void 0?void 0:p.textContent)!==null&&f!==void 0?f:"1"),offset:Number((h=(d=ie==null?void 0:ie.querySelector("CX Offset"))===null||d===void 0?void 0:d.textContent)!==null&&h!==void 0?h:"0")},y:{type:(m=(A=(g=ie==null?void 0:ie.querySelector("CY AxisType"))===null||g===void 0?void 0:g.textContent)===null||A===void 0?void 0:A.toUpperCase())!==null&&m!==void 0?m:"I",dataType:(y=(v=(E=ie==null?void 0:ie.querySelector("CY DataType"))===null||E===void 0?void 0:E.textContent)===null||v===void 0?void 0:v.toUpperCase())!==null&&y!==void 0?y:"D",increment:Number((T=(b=ie==null?void 0:ie.querySelector("CY Increment"))===null||b===void 0?void 0:b.textContent)!==null&&T!==void 0?T:"1"),offset:Number((S=(_=ie==null?void 0:ie.querySelector("CY Offset"))===null||_===void 0?void 0:_.textContent)!==null&&S!==void 0?S:"0")},z:{type:(H=(M=(R=ie==null?void 0:ie.querySelector("CZ AxisType"))===null||R===void 0?void 0:R.textContent)===null||M===void 0?void 0:M.toUpperCase())!==null&&H!==void 0?H:"A",dataType:(w=(C=(B=ie==null?void 0:ie.querySelector("CZ DataType"))===null||B===void 0?void 0:B.textContent)===null||C===void 0?void 0:C.toUpperCase())!==null&&w!==void 0?w:"D",increment:Number((O=(I=ie==null?void 0:ie.querySelector("CZ Increment"))===null||I===void 0?void 0:I.textContent)!==null&&O!==void 0?O:"1"),offset:Number((N=(L=ie==null?void 0:ie.querySelector("CZ Offset"))===null||L===void 0?void 0:L.textContent)!==null&&N!==void 0?N:"0")}},Ce=null,Se=ge.querySelector("Record1 Axes Rotation");Se&&(Ce=new THREE__namespace.Matrix3,Ce.set(Number((J=(z=Se.querySelector("r11"))===null||z===void 0?void 0:z.textContent)!==null&&J!==void 0?J:0),Number((Q=(G=Se.querySelector("r12"))===null||G===void 0?void 0:G.textContent)!==null&&Q!==void 0?Q:0),Number((q=(U=Se.querySelector("r13"))===null||U===void 0?void 0:U.textContent)!==null&&q!==void 0?q:0),Number((Y=(K=Se.querySelector("r21"))===null||K===void 0?void 0:K.textContent)!==null&&Y!==void 0?Y:0),Number((te=(Z=Se.querySelector("r22"))===null||Z===void 0?void 0:Z.textContent)!==null&&te!==void 0?te:0),Number((ee=(j=Se.querySelector("r23"))===null||j===void 0?void 0:j.textContent)!==null&&ee!==void 0?ee:0),Number((re=(W=Se.querySelector("r31"))===null||W===void 0?void 0:W.textContent)!==null&&re!==void 0?re:0),Number((ae=(le=Se.querySelector("r32"))===null||le===void 0?void 0:le.textContent)!==null&&ae!==void 0?ae:0),Number((se=(oe=Se.querySelector("r33"))===null||oe===void 0?void 0:oe.textContent)!==null&&se!==void 0?se:0)));var Be=(ce=ge.querySelector("Record3 DataLink PointDataLink"))===null||ce===void 0?void 0:ce.textContent;if(typeof Be!="string")throw new Error("X3p: PointDataLink not found.");Be=pathJoin(ne,Be);var Le=X[Be];if(!Le)throw new Error("X3p: ".concat(Le," not found."));for(var be=getPointArray(Le.buffer,de.z.dataType),Me=Number((Te=(ve=ge.querySelector("Record3 MatrixDimension SizeX"))===null||ve===void 0?void 0:ve.textContent)!==null&&Te!==void 0?Te:"0"),we=Number((me=(pe=ge.querySelector("Record3 MatrixDimension SizeY"))===null||pe===void 0?void 0:pe.textContent)!==null&&me!==void 0?me:"0"),Pe=Math.floor(Me-1),ze=Math.floor(we-1),Ge=Pe+1,He=ze+1,Ve=new Float32Array(Ge*He*3),$e=new Float32Array(Ge*He*2),Ie=new Uint32Array(Pe*ze*6),je=new THREE__namespace.Box3,xe=0;xe<He;xe++)for(var We=xe*de.y.increment+de.y.offset,_e=0;_e<Ge;_e++){var Oe=xe*Ge+_e,Fe=_e*de.x.increment+de.x.offset,qe=be[Oe],nt=!isNaN(qe),Ze=nt?qe:NaN;_vector.set(Fe,-We,Ze),Ce&&_vector.applyMatrix3(Ce),nt&&je.expandByPoint(_vector),Ve[Oe*3+0]=_vector.x,Ve[Oe*3+1]=_vector.y,Ve[Oe*3+2]=_vector.z,$e[Oe*2+0]=_e/Pe,$e[Oe*2+1]=1-xe/ze}for(var xe=0;xe<ze;xe++)for(var _e=0;_e<Pe;_e++){var ut=_e+Ge*xe,Ue=_e+Ge*(xe+1),Re=_e+1+Ge*(xe+1),yt=_e+1+Ge*xe,at=(xe*Pe+_e)*6;Ie[at+0]=ut,Ie[at+1]=Ue,Ie[at+2]=yt,Ie[at+3]=Ue,Ie[at+4]=Re,Ie[at+5]=yt}var Ke=new THREE__namespace.BufferGeometry;Ke.setAttribute("position",new THREE__namespace.BufferAttribute(Ve,3)),Ke.setAttribute("uv",new THREE__namespace.BufferAttribute($e,2)),Ke.setIndex(new THREE__namespace.BufferAttribute(Ie,1)),(!Ke.groups||Ke.groups.length===0)&&Ke.addGroup(0,Ke.index?Ke.index.count:Ke.attributes.position.count,0),Ke.boundingBox=je;var lt=new PBMMeshMaterial(t.light?"phong":"basic");lt.flatShading=!0,lt.color.copy(Ne);var pt=new PBMMesh(Ke,[lt]);return{object:pt,dispose:function(){Ke.dispose(),lt.dispose()}}}var 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,identityMatrix4=new THREE__namespace.Matrix4().identity(),scratchVector=new THREE__namespace.Vector3,scratchMatrix4$5=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$2=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$5.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$5.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),scratchFrustum.setFromProjectionMatrix(scratchMatrix4$5),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],p=e[9],f=e[10],d=e[11],h=Math.max(Math.sqrt(r*r+o*o+s*s),.001),g=Math.max(Math.sqrt(u*u+l*l+c*c),.001),A=Math.max(Math.sqrt(p*p+f*f+d*d),.001);this.halfSize.set(h,g,A);var m=this.halfSize.toArray().reduce(function(E,v){return E+v},0);return(isNaN(m)||m<=0)&&this.halfSize.setScalar(EPSILON$2),this.rotation.fromArray([r/h,o/h,s/h,u/g,l/g,c/g,p/A,f/A,d/A]),isNaN(this.rotation.toArray().reduce(function(E,v){return E+v},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 t.equals(identityMatrix4)?this:(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$5.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,p=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),f=r.dot(e)+t.constant;return f<=-p?VolumePlaneIntersect.Outside:f>=p?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$5.makeBasis(scratchXAxis,scratchYAxis,scratchZAxis),scratchMatrix4$5.setPosition(this.center),scratchMatrix4Inverse$1.getInverse(scratchMatrix4$5),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$5).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 t.equals(identityMatrix4)?this:(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$2.set(this.center,this.radius),scratchSphere$2.containsPoint(t.origin))return!0;var r=t.intersectSphere(scratchSphere$2,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(isBoundingVolume(n))return 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:!0,transparent:!0,opacity:.5})}),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(t===void 0&&(t=0),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}return null}var scratchVector3$7=new THREE__namespace.Vector3,scratchPlane=new THREE__namespace.Plane,scratchSphereBoundingVolume$1=new SphereBoundingVolume,scratchBoxBoundingVolume$1=new BoxBoundingVolume,Tile=function(){function n(t,e,r,o){var s=this,u,l,c,p;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,memoryUsage:0},e.content.group!==void 0&&(this.content.group=e.content.group),/\.json$/.test(this.content.uri)?this.type="TILESET":this.type="SCENEGRAPH"):(this.content=null,this.type="EMPTY"),this.levelOfContent=this.parent?this.parent.levelOfContent:-1,this.type==="SCENEGRAPH"&&(this.levelOfContent=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=(p=e.extras)!==null&&p!==void 0?p:{},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)),e.children?this.children=e.children.map(function(f,d){return new n("".concat(s.id,".").concat(d),f,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.transform;if(this.boundingVolume){var r=void 0;this.boundingVolume instanceof BoxBoundingVolume?r=scratchBoxBoundingVolume$1.copy(this.boundingVolume):this.boundingVolume instanceof SphereBoundingVolume?r=scratchSphereBoundingVolume$1.copy(this.boundingVolume):r=this.boundingVolume.clone(),r.applyMatrix4(e),t.camera.type==="OrthographicCamera"?(scratchPlane.setFromNormalAndCoplanarPoint(t.camera.direction,t.camera.position),this.state.distanceToCamera=r.distanceToPlane(scratchPlane)):this.state.distanceToCamera=r.distanceToPoint(t.camera.position);var o=r.getCenter(scratchVector3$7).sub(t.camera.position);this.state.centerZDepth=t.camera.direction.dot(o),this.state.centerScreenY=t.camera.up.dot(o);var s=this.parent?this.parent.state.visibilityPlaneMask:CullingVolume.MASK_INDETERMINATE;this.state.visibilityPlaneMask=t.cullingVolume.computeVisibilityWithPlaneMask(r,s),this.state.visible=this.state.visibilityPlaneMask!==CullingVolume.MASK_OUTSIDE,t.cameraCulling||(this.state.visible=!0)}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.geometricError>=t.maxGeometricError)&&(this.state.visible=!0),this.viewerRequestVolume){var u=void 0;this.viewerRequestVolume instanceof BoxBoundingVolume?u=scratchBoxBoundingVolume$1.copy(this.viewerRequestVolume):this.viewerRequestVolume instanceof SphereBoundingVolume?u=scratchSphereBoundingVolume$1.copy(this.viewerRequestVolume):u=this.viewerRequestVolume.clone(),u.applyMatrix4(e),this.state.inRequestVolume=u.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}),Object.defineProperty(n.prototype,"contentMemoryUsage",{get:function(){return this.content?this.content.memoryUsage:0},enumerable:!1,configurable:!0}),n.prototype.getScreenSpaceError=function(t,e,r){var o=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=t.height,c=t.sseDenominator;if(t.camera.type==="OrthographicCamera"){var p=t.camera.projectionMatrix.elements,f=1/(p[5]/2),d=.9,h=f/l*d,g=u/h;return g}else{var A=Math.max(e,.001),h=A*c/l,g=u/h;return g}},n.prototype.getPriority=function(t){var e=this.refine==="ADD"||t.skipLevelOfDetail;if(e&&!this.state.visible||t.frameNumber-this.state.touchedFrameNumber>=1)return-1;var r=this.parent,o=r&&(!e||this.state.screenSpaceError===0),s=o?r.state.screenSpaceError:this.state.screenSpaceError,u=this.tileset.root?this.tileset.root.state.screenSpaceError:0,l=Math.max(u-s,0);return l},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,p=t;if(l){var f=l.array,d=(r=l.stride)!==null&&r!==void 0?r:1,h=(o=l.offset)!==null&&o!==void 0?o:0;p=f[t*d+h]}var g=c.array,A=(s=c.stride)!==null&&s!==void 0?s:3,m=(u=c.offset)!==null&&u!==void 0?u:0;return p=p*A+m,e.x=g[p],e.y=g[p+1],e.z=g[p+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 p=0,f=0,d=0,h=0,g=0,A=0;return t.x>=0?(p=(e-n.x)*t.x,f=(s-n.x)*t.x):(p=(s-n.x)*t.x,f=(e-n.x)*t.x),t.y>=0?(d=(r-n.y)*t.y,h=(u-n.y)*t.y):(d=(u-n.y)*t.y,h=(r-n.y)*t.y),!(p>h||d>f||(d>p&&(p=d),h<f&&(f=h),t.z>=0?(g=(o-n.z)*t.z,A=(l-n.z)*t.z):(g=(l-n.z)*t.z,A=(o-n.z)*t.z),p>A||g>f)||(g>p&&(p=g),A<f&&(f=A),f<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$6=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=[],p=0,f=-1;if(o)for(var d=0,h=0,g=0,A=void 0,m=void 0,E=void 0,v=void 0,y=void 0,b=void 0,T=void 0;d<s;d+=1,h+=3,g+=6)u[d]=d,this.getPositionByIndex(h,scratchVector3A),this.getPositionByIndex(h+1,scratchVector3B),this.getPositionByIndex(h+2,scratchVector3C),A=v=scratchVector3A.x,T=scratchVector3B.x,T<A&&(A=T),T>v&&(v=T),T=scratchVector3C.x,T<A&&(A=T),T>v&&(v=T),m=y=scratchVector3A.y,T=scratchVector3B.y,T<m&&(m=T),T>y&&(y=T),T=scratchVector3C.y,T<m&&(m=T),T>y&&(y=T),E=b=scratchVector3A.z,T=scratchVector3B.z,T<E&&(E=T),T>b&&(b=T),T=scratchVector3C.z,T<E&&(E=T),T>b&&(b=T),l[g]=A,l[g+1]=m,l[g+2]=E,l[g+3]=v,l[g+4]=y,l[g+5]=b;else{for(var _=1/0,S=1/0,R=1/0,M=-1/0,H=-1/0,B=-1/0,d=0,h=0,g=0,A=void 0,m=void 0,E=void 0,v=void 0,y=void 0,b=void 0,T=void 0;d<s;d+=1,h+=3,g+=6)u[d]=d,this.getPositionByIndex(h,scratchVector3A),this.getPositionByIndex(h+1,scratchVector3B),this.getPositionByIndex(h+2,scratchVector3C),A=v=scratchVector3A.x,T=scratchVector3B.x,T<A&&(A=T),T>v&&(v=T),T=scratchVector3C.x,T<A&&(A=T),T>v&&(v=T),m=y=scratchVector3A.y,T=scratchVector3B.y,T<m&&(m=T),T>y&&(y=T),T=scratchVector3C.y,T<m&&(m=T),T>y&&(y=T),E=b=scratchVector3A.z,T=scratchVector3B.z,T<E&&(E=T),T>b&&(b=T),T=scratchVector3C.z,T<E&&(E=T),T>b&&(b=T),l[g]=A,l[g+1]=m,l[g+2]=E,l[g+3]=v,l[g+4]=y,l[g+5]=b,A<_&&(_=A),v>M&&(M=v),m<S&&(S=m),y>H&&(H=y),E<R&&(R=E),b>B&&(B=b);o=[_,S,R,M,H,B]}var C=new BVHNode(++f,o,0,s,0);c[p++]=C;var w=[],I=[0,1,2],O=function(N,z){return w[z]-w[N]};function L(N){var z=N.startIndex,J=N.endIndex,G=N.extents;w[0]=G[3]-G[0],w[1]=G[4]-G[1],w[2]=G[5]-G[2],I.sort(O);for(var Q=0;Q<3;Q++){for(var U=I[Q],q=G[U]+G[U+3],K=z,Y=J-1,Z=-1,te=void 0;K<=Y;)Z===-1?(te=u[K],l[te*6+U]+l[te*6+U+3]<q?K++:Z=te):(te=u[Y],l[te*6+U]+l[te*6+U+3]>=q||(u[K]=te,u[Y]=Z,Z=-1,K++),Y--);if(K>z&&K<J){var j=new BVHNode(++f,calcExtents(u,l,z,K,EPSILON$1),z,K,N.deepth+1);j.deepth<r&&j.endIndex-j.startIndex>e&&(c[p++]=j);var ee=new BVHNode(++f,calcExtents(u,l,K,J,EPSILON$1),K,J,N.deepth+1);ee.deepth<r&&ee.endIndex-ee.startIndex>e&&(c[p++]=ee),N.node0=j,N.node1=ee,N.startIndex=0,N.endIndex=0;break}}}for(;p;)L(c[--p]);return this.offsetArray=u,this.rootNodePacked=packBVHNode(C,f+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),p=[0],f=[],d,h,g,A;(d=p.pop())!==void 0;){A=d*BYTES_PER_NODE/4;var m=clamp(e.x,u[A],u[A+3])-e.x,E=clamp(e.y,u[A+1],u[A+4])-e.y,v=clamp(e.z,u[A+2],u[A+5])-e.z;if(m*m+E*E+v*v<=r*r){for(var y=l[A+6];y<l[A+7];y++)f.push(o[y]);A=d*BYTES_PER_NODE/2,h=c[A+16],g=c[A+17],h&&p.push(h),g&&p.push(g)}}for(var b=f.length,T=new Float32Array(b*9),y=0;y<b;y++){var _=f[y];this.getPositionByIndex(_,scratchVector3$6),T[y*9]=scratchVector3$6.x,T[y*9+1]=scratchVector3$6.y,T[y*9+2]=scratchVector3$6.z,this.getPositionByIndex(_+1,scratchVector3$6),T[y*9+3]=scratchVector3$6.x,T[y*9+4]=scratchVector3$6.y,T[y*9+5]=scratchVector3$6.z,this.getPositionByIndex(_+2,scratchVector3$6),T[y*9+6]=scratchVector3$6.x,T[y*9+7]=scratchVector3$6.y,T[y*9+8]=scratchVector3$6.z}return T},t.prototype.intersectRay=function(e,r,o,s){for(var u=this.offsetArray,l=this.rootNodePacked,c=new Float32Array(l),p=new Uint32Array(l),f=new Uint16Array(l),d=new BVHVector3(1/r.x,1/r.y,1/r.z),h=[0],g,A,m,E;(g=h.pop())!==void 0;)if(E=g*BYTES_PER_NODE/4,intersectNodeBox(e,d,c[E],c[E+1],c[E+2],c[E+3],c[E+4],c[E+5])){for(var v=p[E+6],y=p[E+7],b=void 0,T=void 0,_=void 0,S=e.x,R=e.y,M=e.z,H=r.x,B=r.y,C=r.z,w=void 0,I=void 0,O=void 0,L=void 0,N=void 0,z=void 0,J=void 0,G=void 0,Q=void 0,U=void 0,q=void 0,K=void 0,Y=void 0,Z=void 0,te=void 0,j=void 0,ee=void 0,W=void 0,re=void 0,le=void 0,ae=void 0,oe=void 0,se=void 0,ce=void 0,ve=void 0,Te=void 0,pe=void 0;v<y;v++){if(b=u[v],T=b*3,this.getPositionByIndex(T,scratchVector3$6),w=scratchVector3$6.x,I=scratchVector3$6.y,O=scratchVector3$6.z,this.getPositionByIndex(T+1,scratchVector3$6),L=scratchVector3$6.x,N=scratchVector3$6.y,z=scratchVector3$6.z,this.getPositionByIndex(T+2,scratchVector3$6),J=scratchVector3$6.x,G=scratchVector3$6.y,Q=scratchVector3$6.z,U=L-w,q=N-I,K=z-O,Y=J-w,Z=G-I,te=Q-O,j=q*te-K*Z,ee=K*Y-U*te,W=U*Z-q*Y,se=H*j+B*ee+C*W,se>0)oe=1;else if(se<0)oe=-1,se=-se;else continue;re=S-w,le=R-I,ae=M-O,ce=oe*(H*(le*te-ae*Z)+B*(ae*Y-re*te)+C*(re*Z-le*Y)),!(ce<0)&&(ve=oe*(H*(q*ae-K*le)+B*(K*re-U*ae)+C*(U*le-q*re)),!(ve<0)&&(ce+ve>se||(Te=-oe*(re*j+le*ee+ae*W),!(Te<0)&&(pe=Te/se,s.push(new BVHIntersect([w,I,O,L,N,z,J,G,Q],[S+H*pe,R+B*pe,M+C*pe],b))))))}E=g*BYTES_PER_NODE/2,A=f[E+16],m=f[E+17],A&&h.push(A),m&&h.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,p=-1/0,f=-1/0,d=e,h=void 0,g=void 0;d<r;d++)h=n[d]*6,g=t[h],g<s&&(s=g),g=t[h+1],g<u&&(u=g),g=t[h+2],g<l&&(l=g),g=t[h+3],g>c&&(c=g),g=t[h+4],g>p&&(p=g),g=t[h+5],g>f&&(f=g);return[s-o,u-o,l-o,c+o,p+o,f+o]}var EPSILON=1e-6,ORDER_AXISES=["x","y","z"],scratchVector3$5=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=[],p=0,f=-1;if(o)for(var d=0;d<u;d+=1)l[d]=d;else{s(0,scratchVector3$5);for(var h=scratchVector3$5.x,g=scratchVector3$5.y,A=scratchVector3$5.z,m=h,E=g,v=A,d=0,y=void 0,b=void 0,T=void 0;d<u;d+=1)l[d]=d,s(d,scratchVector3$5),y=scratchVector3$5.x,b=scratchVector3$5.y,T=scratchVector3$5.z,y<h?h=y:y>m&&(m=y),b<g?g=b:b>E&&(E=b),T<A?A=T:T>v&&(v=T);o=[h,g,A,m,E,v]}var _=new BVHNode(++f,o,0,u,0);c[p++]=_;var S=[],R=[0,1,2],M=function(B,C){return S[C]-S[B]};function H(B){var C=B.startIndex,w=B.endIndex,I=B.extents;S[0]=I[3]-I[0],S[1]=I[4]-I[1],S[2]=I[5]-I[2];for(var O=R.sort(M)[0],L=ORDER_AXISES[O],N=(I[O]+I[O+3])/2,z=C,J=w-1,G=-1,Q;z<=J;)G===-1?(Q=l[z],s(Q,scratchVector3$5),scratchVector3$5[L]<N?z++:G=Q):(Q=l[J],s(Q,scratchVector3$5),scratchVector3$5[L]>=N||(l[z]=Q,l[J]=G,G=-1,z++),J--);if(z>C){var U=I.slice();U[O+3]=N+EPSILON;var q=new BVHNode(++f,U,C,z,B.deepth+1);q.deepth<r&&q.endIndex-q.startIndex>e&&(c[p++]=q),B.node0=q}if(w>z){var K=I.slice();K[O]=N-EPSILON;var Y=new BVHNode(++f,K,z,w,B.deepth+1);Y.deepth<r&&Y.endIndex-Y.startIndex>e&&(c[p++]=Y),B.node1=Y}B.startIndex=0,B.endIndex=0}for(;p;)H(c[--p]);return this.offsetArray=l,this.rootNodePacked=packBVHNode(_,f+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),p=new Uint32Array(l),f=new Uint16Array(l),d=o*o,h=new BVHVector3(1/r.x,1/r.y,1/r.z),g=[0],A,m,E,v;(A=g.pop())!==void 0;)if(v=A*BYTES_PER_NODE/4,intersectNodeBox(e,h,c[v],c[v+1],c[v+2],c[v+3],c[v+4],c[v+5],o)){for(var y=p[v+6],b=p[v+7],T=void 0,_=void 0,S=void 0,R=void 0,M=void 0,H=void 0,B=void 0,C=void 0,w=void 0,I=void 0,O=void 0,L=void 0;y<b;y++)T=u[y],this.getPositionByIndex(T,scratchVector3$5),_=scratchVector3$5.x,S=scratchVector3$5.y,R=scratchVector3$5.z,M=e.x,H=e.y,B=e.z,C=r.x,w=r.y,I=r.z,O=C*(_-M)+w*(S-H)+I*(R-B),O>0&&(M+=C*O,H+=w*O,B+=I*O),C=_-M,w=S-H,I=R-B,O=C*C+w*w+I*I,O<=d&&s.push(new BVHIntersect([_,S,R,_,S,R,_,S,R],[M,H,B],T));v=A*BYTES_PER_NODE/2,m=f[v+16],E=f[v+17],m&&g.push(m),E&&g.push(E)}return s},t}(BVHObject);const encodedJs="KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO3ZhciBlcj1mdW5jdGlvbihlLHIpe3JldHVybiBlcj1PYmplY3Quc2V0UHJvdG90eXBlT2Z8fHtfX3Byb3RvX186W119aW5zdGFuY2VvZiBBcnJheSYmZnVuY3Rpb24odCxvKXt0Ll9fcHJvdG9fXz1vfXx8ZnVuY3Rpb24odCxvKXtmb3IodmFyIGYgaW4gbylPYmplY3QucHJvdG90e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ZH07dC5wdXNoKHMpO3ZhciB1PXZvaWQgMDtmb3IodmFyIHcgaW4gcy5hdHRyaWJ1dGVzKXt2YXIgeT1zLmF0dHJpYnV0ZXNbd107eSYmeS5idWZmZXIgaW5zdGFuY2VvZiBBcnJheUJ1ZmZlciYmby5hZGQoeS5idWZmZXIpfXU9cy5pbmRpY2VzLHUmJnUuYnVmZmVyIGluc3RhbmNlb2YgQXJyYXlCdWZmZXImJm8uYWRkKHUuYnVmZmVyKSx1PXMub2Zmc2V0QXJyYXksdSYmdS5idWZmZXIgaW5zdGFuY2VvZiBBcnJheUJ1ZmZlciYmby5hZGQodS5idWZmZXIpLG8uYWRkKHMucm9vdE5vZGVQYWNrZWQpfXJldHVybntvdXRwdXQ6dCx0cmFuc2ZlcjpBcnJheS5mcm9tKG8pfX0pfSl9KSgpOwo=",decodeBase64=n=>Uint8Array.from(atob(n),t=>t.charCodeAt(0)),blob=typeof self!="undefined"&&self.Blob&&new Blob([decodeBase64(encodedJs)],{type:"text/javascript;charset=utf-8"});function WorkerWrapper(n){let t;try{if(t=blob&&(self.URL||self.webkitURL).createObjectURL(blob),!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,{name:n==null?void 0:n.name})}finally{t&&(self.URL||self.webkitURL).revokeObjectURL(t)}}var bvhWorkerPool=new WorkerPool(function(){return new WorkerWrapper},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,p=l.groups,f=l.index,d=0,h=u.length;d<h;d++){var g=u[d],A=g.triangle,m=g.index,E=g.intersectionPoint,v=new THREE__namespace.Vector3(E[0],E[1],E[2]).applyMatrix4(s),y=e.ray.origin.distanceTo(v);if(!(y<e.near||y>e.far)){var b=void 0;if(Array.isArray(c)){if(p)for(var T=m*3,_=0,S=p;_<S.length;_++){var R=S[_];if(T>=R.start&&T-R.start<R.count){b=c[(o=R.materialIndex)!==null&&o!==void 0?o:0];break}}}else b=c;if(b){var M=scratchIntersectionTriangle.set(scratchIntersectionFaceA.set(A[0],A[1],A[2]).applyMatrix4(s),scratchIntersectionFaceB.set(A[3],A[4],A[5]).applyMatrix4(s),scratchIntersectionFaceC.set(A[6],A[7],A[8]).applyMatrix4(s)).getNormal(new THREE__namespace.Vector3),H=m*3,B=new THREE__namespace.Face3(f?f.array[H]:H,f?f.array[H+1]:H+1,f?f.array[H+2]:H+2,M),C=e.ray.direction.dot(M);b.side===THREE__namespace.FrontSide&&C>=0||b.side===THREE__namespace.BackSide&&C<=0||r.push({distance:y,object:n,face:B,point:v,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,[]),p=n.geometry,f=p.index,d=p.getAttribute("normal"),h=0,g=c.length;h<g;h++){var A=c[h],m=A.triangle,E=A.index,v=A.intersectionPoint,y=new THREE__namespace.Vector3(v[0],v[1],v[2]).applyMatrix4(u),b=e.ray.origin.distanceTo(y);if(!(b<e.near||b>e.far)){var T=scratchIntersectionFaceA.set(m[0],m[1],m[2]).applyMatrix4(u),_=f?f.array[E]:E,S=void 0;if(d instanceof THREE__namespace.BufferAttribute){var R=new THREE__namespace.Vector3().fromBufferAttribute(d,_).applyNormalMatrix(scratchNormalMatrix);S=new THREE__namespace.Face3(_,_,_,R)}r.push({distance:b,object:n,face:S,point:y,distanceToRay:y.distanceTo(T),index:E})}}}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 p=o[c],f=p.geometry;if(f instanceof THREE__namespace.BufferGeometry){var d=void 0;if(p instanceof THREE__namespace.Mesh?d="mesh":p instanceof THREE__namespace.Points&&(d="points"),!!d){var h=f.boundingBox,g=h?[h.min.x,h.min.y,h.min.z,h.max.x,h.max.y,h.max.z]:void 0,A={};for(var m in f.attributes){var E=f.attributes[m];E instanceof THREE__namespace.InterleavedBufferAttribute?(A[m]={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[m]={array:E.array},l=E.array,l&&l.buffer instanceof ArrayBuffer&&u.add(l.buffer))}var v=void 0,y=f.getIndex();y&&(y instanceof THREE__namespace.InterleavedBufferAttribute?(v={array:y.data.array,stride:y.data.stride,offset:y.offset},l=y.data.array,l&&l.buffer instanceof ArrayBuffer&&u.add(l.buffer)):(v={array:y.array},l=y.array,l&&l.buffer instanceof ArrayBuffer&&u.add(l.buffer)));var b={type:d,attributes:A,indices:v,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,p=s[u];if(c instanceof THREE__namespace.BufferGeometry){for(var f in p.attributes){var d=p.attributes[f].array,h=c.attributes[f];h instanceof THREE__namespace.InterleavedBufferAttribute?h.data.array=d:h.array=d}var g=c.getIndex();if(g&&p.indices){var d=p.indices.array;g instanceof THREE__namespace.InterleavedBufferAttribute?g.data.array=d:g.array=d}if(l instanceof THREE__namespace.Mesh){var A=new BVHMesh(p.attributes.position,p.indices);A.offsetArray=p.offsetArray,A.rootNodePacked=p.rootNodePacked,bindBvhTreeForMesh(l,A)}else if(l instanceof THREE__namespace.Points){var A=new BVHPoints(p.attributes.position,p.indices);A.offsetArray=p.offsetArray,A.rootNodePacked=p.rootNodePacked,bindBvhTreeForPoints(l,A)}}}return n})}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 p in this.config)c[p]=(s=t[p])!==null&&s!==void 0?s:l[p];var f=[{progress:0,value:l},{progress:1,value:c}];return this.setKeyframes(f,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}(),easeInCubic=function(n){return n*n*n},easeInQuart=function(n){return n*n*n*n},APPEAR_ANIMATION_DURATION=500,versionMap$1=new WeakMap,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.name=e,s.materials=[],s.pbmObjects=[],s.contentObject=r,s.appearMotion=new Motion({appear:0}),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 PBMSkinnedMesh||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,s){r===void 0&&(r=null),o===void 0&&(o=!0),s===void 0&&(s=[]);for(var u=this.children.slice(),l,c=[];l=u.pop();)if(l.visible){l.raycast(e,c);for(var p=0,f=l.children.length;p<f;p++)u.push(l.children[p])}for(var p=0;p<c.length;p++){var d=c[p],h=0,g=-1;if((d.object instanceof PBMMesh||d.object instanceof PBMSkinnedMesh||d.object instanceof PBMPointCloud)&&d.face){var A=Array.isArray(d.object.material)?d.object.material[d.face.materialIndex]:d.object.material;A&&(h=A.floorIndex,g=A.shownFloorIndex)}d.floor=h;var m=r!=null?r:g;m>=0&&h!==m&&(c.splice(p,1),p--)}return o&&c.sort(function(E,v){return E.distance-v.distance}),s.push.apply(s,c),s},t.prototype.update=function(e,r,o,s,u,l){var c=!1,p=s.visible&&u.state.selectedFrameNumber===u.tileset.frameNumber;if(p){var f=1;this.appearMotion.getTargetKeyframe().value.appear!==f&&this.appearMotion.set({appear:f},APPEAR_ANIMATION_DURATION).catch(noop$1)}else{var f=0;this.appearMotion.getTargetKeyframe().value.appear!==f&&this.appearMotion.set({appear:f},0).catch(noop$1)}this.appearMotion.ended!==!0&&this.appearMotion.update(r.time);for(var d=0,h=this.pbmObjects;d<h.length;d++){var g=h[d];if(g instanceof PBMMesh||g instanceof PBMSkinnedMesh){var A=updatePBMMesh(g,this.appearMotion,e,r,o,u,l);A===!0&&(c=!0)}else if(g instanceof PBMPointCloud){var A=updatePBMPointCloud(g,this.appearMotion,e,r,o,u,l);A===!0&&(c=!0)}}return c},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 updatePBMMesh(n,t,e,r,o,s,u){var l=n.material,c=!1,p=u.versions.toString();if(versionMap$1.get(n)!==p){versionMap$1.set(n,p),c=!0,n.castShadow=u.castShadow,n.receiveShadow=u.receiveShadow;for(var f=0,d=l;f<d.length;f++){var h=d[f];h.customShaders=u.customShaders,h.pano0=u.pano0,h.pano1=u.pano1,h.pano0Depth=u.pano0Depth,h.pano1Depth=u.pano1Depth,h.refinedScreen=u.refinedScreen,h.modelAlpha=u.modelAlpha,h.logDepthAlpha=u.logDepthAlpha,h.progress=u.progress,h.transition=u.transition,h.opacity=u.opacity,h.floorStyle=u.floorStyle,h.constantColor=u.constantColor,h.shownFloorIndex=u.shownFloorIndex,h.clippers=u.clippers,h.brightness=u.brightness,h.useHQWeight=u.useHQWeight,h.useHQDepth=u.useHQDepth,h.colorSaturation=u.colorSaturation,h.colorBrightness=u.colorBrightness,h.gradientTexture=u.gradientTexture,h.shaderType==="none"?(h.transparent=!0,h.blending=THREE__namespace.NormalBlending,h.blendDst=THREE__namespace.OneMinusSrcAlphaFactor,h.blendEquation=THREE__namespace.AddEquation,h.blendSrcAlpha=null,h.blendDstAlpha=null,h.blendEquationAlpha=null,h.depthWrite=!1,h.depthTest=!0):(h.transparent=h.alphaMode==="BLEND",h.blending=THREE__namespace.NormalBlending,h.blendDst=THREE__namespace.OneMinusSrcAlphaFactor,h.blendEquation=THREE__namespace.AddEquation,h.blendSrcAlpha=null,h.blendDstAlpha=null,h.blendEquationAlpha=null,h.depthWrite=!0,h.depthTest=!0,u.useAddBlend&&(h.depthWrite=!1,h.depthTest=!1,h.blending=THREE__namespace.AdditiveBlending),h.shownFloorIndex>-1&&h.shownFloorIndex!==h.floorIndex&&(h.transparent=!0),h.opacity<1&&(h.transparent=!0),h.alphaMap&&(h.transparent=!0),h.brightness<1&&(h.transparent=!0),h.logDepthAlpha>0?h.transparent=!1:u.useAddBlend&&(h.depthWrite=!1,h.depthTest=!1,h.blending=THREE__namespace.AdditiveBlending))}}for(var g=0,A=l;g<A.length;g++){var h=A[g];h.modelBoundingMax.copy(o.boundingBox.max),h.modelBoundingMin.copy(o.boundingBox.min)}return c}function updatePBMPointCloud(n,t,e,r,o,s,u){var l,c,p=n.geometry,f=[n.material],d=!1,h=u.versions.toString();if(u.pointAppearAnimation===!0&&s.refine==="ADD"&&s.tileset.rootMeta.pntsOrder==="RANDOM"){var g=s.tileset.currentMaxScreenSpaceError,A=s.state.screenSpaceError,m=(c=(l=s.parent)===null||l===void 0?void 0:l.state.screenSpaceError)!==null&&c!==void 0?c:A,E=1;m!==A&&(E=(m-g)/(m-A)),E=clamp$1(E,0,1),E=easeInCubic(E);var v=p.index?p.index.count:p.attributes.position?p.attributes.position.count:1/0,y=Math.floor(v*E*t.value.appear);p.drawRange.count!==y&&(p.setDrawRange(0,y),d=!0)}if(versionMap$1.get(n)!==h){versionMap$1.set(n,h),d=!0,n.castShadow=u.castShadow,n.receiveShadow=u.receiveShadow;for(var b=0,T=f;b<T.length;b++){var _=T[b];_.customShaders=u.customShaders,_.pointScale=u.pointScale,_.pointMinPixel=u.pointMinPixel,_.pointMaxPixel=u.pointMaxPixel,_.pointSize=u.pointSize,_.pointShape=u.pointShape,_.pointBack=u.pointBack,_.modelAlpha=u.modelAlpha,_.logDepthAlpha=u.logDepthAlpha,_.opacity=u.opacity,_.floorStyle=u.floorStyle,_.constantColor=u.constantColor,_.shownFloorIndex=u.shownFloorIndex,_.clippers=u.clippers,_.brightness=u.brightness,_.useHQWeight=u.useHQWeight,_.useHQDepth=u.useHQDepth,_.colorSaturation=u.colorSaturation,_.colorBrightness=u.colorBrightness,_.outlineGain=u.outlineGain,_.distanceGain=u.distanceGain,_.gradientTexture=u.gradientTexture,_.transparent=!1,_.blending=THREE__namespace.NormalBlending,_.blendDst=THREE__namespace.OneMinusSrcAlphaFactor,_.blendEquation=THREE__namespace.AddEquation,_.blendSrcAlpha=null,_.blendDstAlpha=null,_.blendEquationAlpha=null,_.depthWrite=!0,_.depthTest=!0,_.shownFloorIndex>-1&&(_.transparent=_.shownFloorIndex!==_.floorIndex),_.modelAlpha<1&&(_.transparent=!0),_.opacity<1&&(_.transparent=!0),_.brightness<1&&(_.transparent=!0),_.logDepthAlpha>0?_.transparent=!1:u.useAddBlend&&(_.depthWrite=!1,_.depthTest=!1,_.blending=THREE__namespace.AdditiveBlending),_.useHQWeight&&(_.depthWrite=!1,_.blending=THREE__namespace.CustomBlending,_.blendSrc=THREE__namespace.SrcAlphaFactor,_.blendSrcAlpha=THREE__namespace.SrcAlphaFactor,_.blendDst=THREE__namespace.OneFactor,_.blendDstAlpha=THREE__namespace.OneFactor)}}for(var S=0,R=f;S<R.length;S++){var _=R[S];_.modelBoundingMax.copy(o.boundingBox.max),_.modelBoundingMin.copy(o.boundingBox.min)}return d}var Trajectory=function(){function n(t,e,r){this.id=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,memoryUsage:0,loadState:"UNLOADED",loadStateUpdateTime:now(),loadfailRetryDelay:0,data:void 0}}return n}(),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,s,u,l){var c=this.contentObject.material[2];return c.uniforms.dashOffset.value=(c.uniforms.dashOffset.value-.003)%(c.uniforms.dashSize.value.x+c.uniforms.dashSize.value.y),!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),priorityCache=new Map;function getPriority(n,t,e){if(e&&e.has(t))return e.get(t);var r=t.refine==="ADD"||n.skipLevelOfDetail,o=t.parent,s=o&&(!r||t.state.screenSpaceError===0),u=s?o.state.screenSpaceError:t.state.screenSpaceError,l=t.tileset.root?t.tileset.root.state.screenSpaceError:0,c=Math.max(l-u,0);return e&&e.set(t,c),c}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 p=u[c];if(l.has(p.tile)){l.delete(p.tile);continue}p.status==="WAITING"&&(u.splice(c,1),c--,this.options.onTileSkip&&this.options.onTileSkip(p.tile))}l.size>0&&(l.forEach(function(v){u.push({tile:v,status:"WAITING",time:s,error:null})}),l.clear());for(var f=r.maxRequests,c=0;c<u.length&&f>0;c++){var p=u[c];if(p.status==="DONE")p.error!==null?this.options.onTileError&&this.options.onTileError(p.tile,p.error):(f--,p.tile.content&&(p.tile.content.loadState="READY"),this.options.onTileLoad&&this.options.onTileLoad(p.tile)),u.splice(c,1),c--;else if(p.status==="PENDING"&&s-p.time<1e3)break}switch(priorityCache.clear(),e){case"SCREEN_SPACE_ERROR":{u.sort(function(v,y){if(v.tile.state.requestedFrameNumber!==y.tile.state.requestedFrameNumber)return y.tile.state.requestedFrameNumber-v.tile.state.requestedFrameNumber;if(v.tile.state.requestedFrameNumber===r.frameNumber){var b=getPriority(r,v.tile,priorityCache),T=getPriority(r,y.tile,priorityCache);return b-T}else return v.tile.level!==y.tile.level?v.tile.level-y.tile.level:v.tile.state.distanceToCamera-y.tile.state.distanceToCamera});break}case"SCREEN_VERTICAL":{u.sort(function(v,y){return v.tile.state.requestedFrameNumber!==y.tile.state.requestedFrameNumber?y.tile.state.requestedFrameNumber-v.tile.state.requestedFrameNumber:v.tile.state.requestedFrameNumber===r.frameNumber?v.tile.state.centerScreenY!==y.tile.state.centerScreenY?v.tile.state.centerScreenY-y.tile.state.centerScreenY:v.tile.state.centerZDepth!==y.tile.state.centerZDepth?v.tile.state.centerZDepth-y.tile.state.centerZDepth:v.tile.level!==y.tile.level?v.tile.level-y.tile.level:v.tile.state.distanceToCamera-y.tile.state.distanceToCamera:v.tile.level!==y.tile.level?v.tile.level-y.tile.level:v.tile.state.distanceToCamera-y.tile.state.distanceToCamera});break}case"SCREEN_LEVEL_VERTICAL":{u.sort(function(v,y){return v.tile.state.requestedFrameNumber!==y.tile.state.requestedFrameNumber?y.tile.state.requestedFrameNumber-v.tile.state.requestedFrameNumber:v.tile.state.requestedFrameNumber===r.frameNumber?v.tile.level!==y.tile.level?v.tile.level-y.tile.level:v.tile.state.centerScreenY!==y.tile.state.centerScreenY?v.tile.state.centerScreenY-y.tile.state.centerScreenY:v.tile.state.centerZDepth!==y.tile.state.centerZDepth?v.tile.state.centerZDepth-y.tile.state.centerZDepth:v.tile.state.distanceToCamera-y.tile.state.distanceToCamera:v.tile.level!==y.tile.level?v.tile.level-y.tile.level:v.tile.state.distanceToCamera-y.tile.state.distanceToCamera});break}}if(f=Math.max(r.maxRequests-this.activeRequests,0),!r.skipLevelOfDetail)for(var d=0,h=u.length,c=0;c<h;c++){var g=u[c].tile;if(g.hasTilesetContent||g.contentParent===null||g.contentParent.state.selectedFrameNumber===r.frameNumber){var A=u.splice(c,1);u.splice.apply(u,__spreadArray([d++,0],A,!1))}}for(var m=function(v){var y=u[v];y.status==="WAITING"&&(f--,y.status="PENDING",y.time=s,E.activeRequests++,E.tileset.options.tileLoader(y.tile).catch(function(b){y.error=b}).then(function(){y.status="DONE",y.tile.content&&y.tile.content.loadState==="READY"&&(y.tile.content.loadState="LOADING"),o.activeRequests--}))},E=this,c=0;c<u.length&&f>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}return n.prototype.traverse=function(t,e,r){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.levelOfContent>=0&&t.geometricError<=e.minGeometricError||t.children.length===0?!1:t.levelOfContent<=e.minLevelOfDetail||t.geometricError>=e.maxGeometricError||t.hasTilesetContent?!0:t.state.screenSpaceError>this.tileset.currentMaxScreenSpaceError},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||r.geometricError>e.maxGeometricError?!1:r.levelOfContent>e.maxLevelOfDetail||r.levelOfContent>=0&&r.geometricError<e.minGeometricError?!0:t.getScreenSpaceError(e,t.state.distanceToCamera,!0)<this.tileset.currentMaxScreenSpaceError},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}(),TilesetNormalTraverser=function(n){__extends(t,n);function t(e){var r=n.call(this,e)||this;return 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))},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 p=!c&&l;s.hasRenderContent?s.refine==="ADD"?(this.loadTile(s,r),this.selectDesiredTile(s,r)):s.refine==="REPLACE"&&(this.loadTile(s,r),p&&this.selectDesiredTile(s,r)):(this.loadTile(s,r),p&&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 p=e.refine==="REPLACE"&&e.hasRenderContent,f=!1,d=!0,h=0,g=s;h<g.length;h++){var c=g[h];if(c.levelOfContent<=r.minLevelOfDetail||c.geometricError>=r.maxGeometricError||c.state.visible&&c.state.inRequestVolume?(o.find(c)&&o.delete(c),o.push(c),f===!1&&(f=!0)):(p||r.loadSiblings)&&(this.loadTile(c,r),this.touchTile(c,r)),p){var A=void 0;c.state.inRequestVolume?c.hasRenderContent?A=c.contentAvailable:A=this.executeEmptyTraversal(c,r):A=!1,d=d&&A}}return f||(d=!1),d},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,p=0,f=c;p<f.length;p++){var d=f[p];s.find(d)&&s.delete(d),s.push(d)}}return o},t}(TilesetBaseTraverser),TilesetSkipTraverser=function(n){__extends(t,n);function t(e){var r=n.call(this,e)||this;return 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))},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 p=!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),p&&this.selectDesiredTile(s,r)):p?(this.loadTile(s,r),this.selectDesiredTile(s,r)):this.reachedSkippingThreshold(s)&&this.loadTile(s,r)):(this.loadTile(s,r),p&&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 p=!1,f=0,d=s;f<d.length;f++){var c=d[f];c.levelOfContent<=r.minLevelOfDetail||c.geometricError>=r.maxGeometricError||c.state.visible&&c.state.inRequestVolume?(o.push(c),p===!1&&(p=!0)):r.loadSiblings&&(this.loadTile(c,r),this.touchTile(c,r))}return p},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 p=c[l];p.state.visible&&(p.contentAvailable?(this.updateTile(p,r),this.touchTile(p,r),this.selectTile(p,r)):o.push(p))}},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 p=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,!p){this.selectTile(c,r);continue}s.push(c),c.state.stackLength=o.length}if(p)for(var f=0,d=c.children;f<d.length;f++){var h=d[f];h.state.visible&&o.push(h)}}}},t}(TilesetBaseTraverser),TilesetMostDetailTraverser=function(n){__extends(t,n);function t(e){var r=n.call(this,e)||this;return r._traversalStack=new ManagedArray,r}return t.prototype.canTraverse=function(e,r){return!(!e.state.inRequestVolume||e.levelOfContent>=r.maxLevelOfDetail||e.levelOfContent>=0&&e.geometricError<=r.minGeometricError||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))},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),Tileset=function(){function n(t,e){var r=this,o,s,u,l,c,p,f;if(this.id=t.tilesetUrl,this.transform=new THREE__namespace.Matrix4,this.hasMixedContent=!1,this.frameNumber=0,this.asset={version:t.asset.version,tilesetVersion:t.asset.tilesetVersion||"",gltfUpAxis:(o=t.asset.gltfUpAxis)!==null&&o!==void 0?o:"Y",overview:t.asset.overview,trajectories:(u=(s=t.asset.trajectories)===null||s===void 0?void 0:s.list)!==null&&u!==void 0?u:[],extras:t.asset.extras},this.rootMeta=(l=t.rootMeta)!==null&&l!==void 0?l:{},this.pointLength=(c=this.rootMeta.numTotalPoints)!==null&&c!==void 0?c:1/0,this.floorLength=(p=this.rootMeta.numFloors)!==null&&p!==void 0?p:1,this.properties=(f=t.properties)!==null&&f!==void 0?f:{},this.options=e,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(g){r.cacheMemoryUsageInBytes+=g.contentMemoryUsage},onTileUnload:function(g){r.cacheMemoryUsageInBytes-=g.contentMemoryUsage,r.unloadTiles.push(g)}}),this.requestScheduler=new TileRequestScheduler(this,{onTileSkip:function(g){},onTileLoad:function(g){var A;!((A=g.content)===null||A===void 0)&&A.data&&(r.loadedTiles.add(g),r.cache.loadTile(g)),r.options.onTileLoad(g)},onTileError:function(g,A){r.options.onTileError(g,A)}}),this.loadedTiles=new Set,this.cacheMemoryUsageInBytes=0,this.currentMaxScreenSpaceError=NaN,this.root=new Tile("".concat(this.id,"#tile:0"),t.root,this),this.geometricError=t.geometricError,this.trajectories=[],this.asset.trajectories)for(var d=0;d<this.asset.trajectories.length;d++){var h=new Trajectory("".concat(this.id,"#trajectory:").concat(d),this.asset.trajectories[d],this);this.trajectories.push(h)}}return n.prototype.adjustScreenSpaceError=function(t){if((isNaN(this.currentMaxScreenSpaceError)||!isFinite(this.currentMaxScreenSpaceError))&&(this.currentMaxScreenSpaceError=t.maxScreenSpaceError),t.memoryAdjustedScreenSpaceError){var e=0;this.needsRefinedTiles.forEach(function(s){s.content&&(e+=s.content.memoryUsage)});var r=(t.maxMemoryUsage-t.memoryAdjustedOverflow)*1024*1024,o=t.maxMemoryUsage*1024*1024;e<r?this.currentMaxScreenSpaceError=Math.max(this.currentMaxScreenSpaceError/1.02,t.maxScreenSpaceError):e>o&&this.selectedTiles.length>0&&(this.currentMaxScreenSpaceError*=1.02)}else this.currentMaxScreenSpaceError=t.maxScreenSpaceError},n.prototype.getTraverser=function(t){return t.mostDetail?this.mostDetailTraverser:t.skipLevelOfDetail?this.skipTraverser:this.normalTraverser},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 f=l.unloadTiles.pop();f&&(l.loadedTiles.delete(f),l.cacheMemoryUsageInBytes-=f.contentMemoryUsage,l.options.tileUnloader(f).catch(function(){}).then(function(){t.options.onTileUnload&&t.options.onTileUnload(f)}))},l=this;this.unloadTiles.length;)u();this.cache.reset(),this.skipTraverser.reset(),this.normalTraverser.reset(),this.mostDetailTraverser.reset(),this.requestScheduler.reset(),this.loadedTiles.clear();for(var c=function(){var f=p.trajectories.pop();f&&p.options.trajectoryUnloader(f).catch(function(){}).then(function(){t.options.onTrajectoryUnload&&t.options.onTrajectoryUnload(f)})},p=this;this.trajectories.length;)c()},n.prototype.update=function(t,e){var r=this,o;e===void 0&&(e=[]),this.frameNumber=t.frameNumber,this.adjustScreenSpaceError(t),this.cache.reset(),this.getTraverser(t).traverse(this.root,t,e),this.cache.unloadTiles(function(){var h=r.cacheMemoryUsageInBytes>t.maxMemoryUsage*1024*1024;return h}),this.requestScheduler.update(this.requestedTiles,t.requestOrder,t);for(var s=function(){var h=u.unloadTiles.pop();h&&(u.loadedTiles.delete(h),u.options.tileUnloader(h).catch(function(){}).then(function(){r.options.onTileUnload&&r.options.onTileUnload(h)}))},u=this;this.unloadTiles.length;)s();this.selectedTrajectories.length=0;for(var l=function(h){h.visible===!0&&h.content.loadState==="READY"&&(!((o=h.content.data)===null||o===void 0)&&o.object)?c.selectedTrajectories.push(h):h.visible===!0&&(h.content.loadState==="FAILED"&&t.time-h.content.loadStateUpdateTime>h.content.loadfailRetryDelay&&(h.content.loadState="UNLOADED",h.content.loadStateUpdateTime=t.time),h.content.loadState==="UNLOADED"&&c.options.trajectoryLoader(h).then(function(){r.options.onTrajectoryLoad(h)}).catch(function(g){r.options.onTrajectoryError(h,g)}))},c=this,p=0,f=this.trajectories;p<f.length;p++){var d=f[p];l(d)}},n}();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(),p=(t=l.pop())!==null&&t!==void 0?t:"",f=[],d=0,h=l;d<h.length;d++){var g=h[d];if(!(g===""||g===".")){if(g===".."){f.pop();continue}f.push(g)}}return r+"//"+c+"/"+f.join("/")+"/"+p}function normalizeTileHeader(n,t){var e;if(n.content){var r=(e=n.content.uri)!==null&&e!==void 0?e:n.content.url;typeof r=="string"&&!isAbsoluteURL(r)&&(n.content.uri=normalizeURL(pathJoin(t,r)))}if(n.transform){for(var o=!1,s=0;s<16;s++){var u=n.transform[s];if(typeof u!="number"||isNaN(u)||!isFinite(u)){o=!0;break}}if(n.transform[15]===0&&(o=!0),o)throw new Error("Invalid Tile Transform: "+JSON.stringify(n.transform))}if(n.children)for(var l=0,c=n.children;l<c.length;l++){var p=c[l];normalizeTileHeader(p,t)}return n}function normalizeTilesetHeader(n,t){n.tilesetUrl=t;var e=t.slice(0,t.lastIndexOf("/")+1);if(n.asset||(n.asset={}),n.rootMeta||(n.rootMeta={}),n.rootMeta.taskParameters||(n.rootMeta.taskParameters={}),n.asset.overview){var r=n.asset.overview;isAbsoluteURL(r.imageFile)||(r.imageFile=normalizeURL(pathJoin(e,r.imageFile))),isAbsoluteURL(r.worldFile)||(r.worldFile=normalizeURL(pathJoin(e,r.worldFile)))}if(n.asset.trajectories)for(var o=0;o<n.asset.trajectories.list.length;o++){var s=n.asset.trajectories.list[o];s.file=normalizeURL(pathJoin(e,s.file))}return normalizeTileHeader(n.root,e),n}function initTextures(n,t,e){for(var r,o,s=Promise.resolve(),u=n.slice(),l=function(){for(var c=[],p=0,f=void 0;f=u.shift();){c.push(f);var d=((r=f.image)===null||r===void 0?void 0:r.width)*((o=f.image)===null||o===void 0?void 0:o.height);if(!isNaN(d)&&isFinite(d)&&(p+=d),p>=e)break}s=s.then(function(){return new Promise(function(h){AnimationFrameLoop.shared.add(function(){for(var g=0,A=c;g<A.length;g++){var m=A[g];t.initTexture(m)}h()},!0)})}).catch(function(){})};u.length>0;)l();return s}var _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,p=this._finalize(!1);p&&(p.inherited||((l=p.groupCount)!==null&&l!==void 0?l:0)<=0)&&this.materials.splice((c=p.index)!==null&&c!==void 0?c:0,1);var f={index:this.materials.length,name:s||"",mtllib:Array.isArray(u)&&u.length>0?u[u.length-1]:"",smooth:p!==void 0?p.smooth:this.smooth,groupStart:p!==void 0?p.groupEnd:0,groupEnd:-1,groupCount:-1,inherited:!1,clone:function(d){var h={index:typeof d=="number"?d:this.index,name:this.name,mtllib:this.mtllib,smooth:this.smooth,groupStart:0,groupEnd:-1,groupCount:-1,inherited:!1,clone:function(){return this}};return h.clone=this.clone.bind(h),h}};return this.materials.push(f),f},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 p=this.materials.length-1;p>=0;p--)((l=this.materials[p].groupCount)!==null&&l!==void 0?l:0)<=0&&this.materials.splice(p,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,p){var f=this.object.geometry,d=this.vertices.length,h=this.normals.length,g=this.uvs.length,A=this.parseVertexIndex(t,d),m=this.parseVertexIndex(e,d),E=this.parseVertexIndex(r,d),v=l!==void 0?this.parseNormalIndex(l,h):void 0,y=c!==void 0?this.parseNormalIndex(c,h):void 0,b=p!==void 0?this.parseNormalIndex(p,h):void 0,T=o!==void 0?this.parseUVIndex(o,g):void 0,_=s!==void 0?this.parseUVIndex(s,g):void 0,S=u!==void 0?this.parseUVIndex(u,g):void 0;(f.hasNormal===!0&&v===void 0||y===void 0||b===void 0)&&(f.hasNormal=!1),(f.hasUV===!0&&T===void 0||_===void 0||S===void 0)&&(f.hasUV=!1);var R=[A,T,v].join(":"),M=f.indexMap[R];M===void 0&&(M=f.vertices.length/3,f.indexMap[R]=M,f.vertices.push(this.vertices[A+0],this.vertices[A+1],this.vertices[A+2]),f.hasColor&&(this.colors[A]===void 0?f.hasColor=!1:f.colors.push(this.colors[A+0],this.colors[A+1],this.colors[A+2])),f.hasNormal&&f.normals.push(this.normals[A+0],this.normals[A+1],this.normals[A+2]),f.hasUV&&f.uvs.push(this.uvs[T+0],this.uvs[T+1])),f.index.push(M);var H=[m,_,y].join(":"),B=f.indexMap[H];B===void 0&&(B=f.vertices.length/3,f.indexMap[H]=B,f.vertices.push(this.vertices[m+0],this.vertices[m+1],this.vertices[m+2]),f.hasColor&&(this.colors[m]===void 0?f.hasColor=!1:f.colors.push(this.colors[m+0],this.colors[m+1],this.colors[m+2])),f.hasNormal&&f.normals.push(this.normals[m+0],this.normals[m+1],this.normals[m+2]),f.hasUV&&f.uvs.push(this.uvs[_+0],this.uvs[_+1])),f.index.push(B);var C=[E,S,b].join(":"),w=f.indexMap[C];w===void 0&&(w=f.vertices.length/3,f.indexMap[C]=w,f.vertices.push(this.vertices[E+0],this.vertices[E+1],this.vertices[E+2]),f.hasColor&&(this.colors[E]===void 0?f.hasColor=!1:f.colors.push(this.colors[E+0],this.colors[E+1],this.colors[E+2])),f.hasNormal&&f.normals.push(this.normals[E+0],this.normals[E+1],this.normals[E+2]),f.hasUV&&f.uvs.push(this.uvs[S+0],this.uvs[S+1])),f.index.push(w)},n}();function parseObj(n){var t=new ObjState;n.indexOf(`\r
|
|
918
918
|
`)!==-1&&(n=n.replace(/\r\n/g,`
|
|
919
919
|
`)),n.indexOf(`\\
|
|
920
920
|
`)!==-1&&(n=n.replace(/\\\n/g,""));for(var e=n.split(`
|
|
@@ -1021,11 +1021,11 @@ void main() {
|
|
|
1021
1021
|
#include <fog_fragment>
|
|
1022
1022
|
#include <premultiplied_alpha_fragment>
|
|
1023
1023
|
}
|
|
1024
|
-
`,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),p=new THREE__namespace.Vector3,f=new THREE__namespace.Vector3,d=new THREE__namespace.Vector2,h=new THREE__namespace.Vector3,g=0;g<=e;g++){h=n.getPointAt(g/e,h);for(var A=c.normals[g],m=c.binormals[g],E=0;E<=r;E++){var v=g*(r+1)+E,y=E/r*Math.PI*2,b=Math.sin(y),T=-Math.cos(y);f.x=T*A.x+b*m.x,f.y=T*A.y+b*m.y,f.z=T*A.z+b*m.z,f.normalize(),f.toArray(s,v*3),p.x=h.x+t*f.x,p.y=h.y+t*f.y,p.z=h.z+t*f.z,p.toArray(o,v*3),d.x=g/e,d.y=E/r,d.toArray(u,v*2)}}for(var g=0;g<e;g++)for(var E=0;E<r;E++){var _=(g*r+E)*6,S=(r+1)*g+E,R=(r+1)*(g+1)+E,M=(r+1)*(g+1)+(E+1),H=(r+1)*g+(E+1);l[_]=S,l[_+1]=R,l[_+2]=H,l[_+3]=R,l[_+4]=M,l[_+5]=H}var B=new THREE__namespace.BufferGeometry;return B.setIndex(new THREE__namespace.BufferAttribute(l,1)),B.setAttribute("position",new THREE__namespace.BufferAttribute(o,3)),B.setAttribute("normal",new THREE__namespace.BufferAttribute(s,3)),B.setAttribute("uv",new THREE__namespace.BufferAttribute(u,2)),B}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,p=3;p<c;p+=3){var f=new THREE__namespace.Vector3().fromArray(n,p-3),d=new THREE__namespace.Vector3().fromArray(n,p);u+=f.distanceTo(d);var h=new THREE__namespace.LineCurve3(f,d);l.add(h)}var g=.03,A=Math.ceil(u*100),m=6,E=createPipeBufferGeometry(l,g,A,m);E.clearGroups(),E.addGroup(0,E.index?E.index.count:E.attributes.position.count,0),E.addGroup(0,E.index?E.index.count:E.attributes.position.count,1),E.addGroup(0,E.index?E.index.count:E.attributes.position.count,2);var v=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});v.uniforms.totalLength.value=u,v.uniforms.diffuse.value=e,v.uniforms.diffuse2.value=e,v.uniforms.opacity.value=.5,v.transparent=!0;var y=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});y.uniforms.totalLength.value=u,y.uniforms.displacementScalar.value=-.01,y.uniforms.diffuse.value=r,y.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(E,[v,y,b]),_=.08,S=24,R=new THREE__namespace.SphereBufferGeometry(_,S,S);R.clearGroups(),R.addGroup(0,E.index?E.index.count:E.attributes.position.count,0),R.addGroup(0,E.index?E.index.count:E.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 H=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});H.uniforms.displacementScalar.value=-.01,H.uniforms.diffuse.value=r;var B=new THREE__namespace.Mesh(R,[M,H]);B.position.fromArray(n,0),T.add(B);var C=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});C.uniforms.displacementScalar.value=-.01,C.uniforms.diffuse.value=o;var w=new THREE__namespace.Mesh(R,[M,C]);return w.position.fromArray(n,n.length-3),T.add(w),{scene:T,dispose:function(){E.dispose(),v.dispose(),y.dispose(),b.dispose(),R.dispose(),M.dispose(),H.dispose(),C.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,p,f=(l=(u=s.scene.attributes)===null||u===void 0?void 0:u.time.array)!==null&&l!==void 0?l:[],d=(p=(c=s.scene.attributes)===null||c===void 0?void 0:c.position.array)!==null&&p!==void 0?p:[],h=s.byteLength,g=s.memoryUsage,A=parseTrajectoryObject(d);A.scene.applyMatrix4(n.transform),A.scene.updateWorldMatrix(!1,!0),A.scene.matrixAutoUpdate=!1;var m=new TrajectoryNode(e,A.scene);return n.content.data={uri:o,byteLength:h,memoryUsage:g,positionArray:d,timeArray:f,object:m},n.content.byteLength=h,n.content.memoryUsage=g,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,n.content.memoryUsage=0)}var scratchVector3$4=new THREE__namespace.Vector3,scratchMatrix3=new THREE__namespace.Matrix3,scratchMatrix4$3=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 p=Math.sin(l),f=a/Math.sqrt(1-e*p*p);c=r/Math.cos(l)-f;var d=Math.atan2(n.z/(f*(1-e)+c),r/(f+c));if(isNaN(d))break;var h=Math.abs(d-l);if(h<o)break;l=d}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),p=Math.cos(e),f=a/Math.sqrt(1-s*u*u),d=(f+r)*l*p,h=(f+r)*l*c,g=(o*o/(a*a)*f+r)*u;return n.set(d,h,g)}function getEcefToEnuMatrix(n,t){var e=ecefToLla(scratchVector3$4.copy(n)),r=e.x,o=e.y,s=e.z,u=Math.sin(r),l=Math.sin(o),c=Math.cos(r),p=Math.cos(o);t.fromArray([-l,-u*p,c*p,0,+p,-u*l,c*l,0,0,c,u,0,0,0,0,1]);var f=scratchMatrix3.setFromMatrix4(t),d=scratchVector3$4.copy(n).applyMatrix3(f).multiplyScalar(-1);t.setPosition(d);var h=scratchMatrix4$3.fromArray([1,0,0,0,0,1,0,0,0,0,1,0,0,0,s,1]);return t.premultiply(h),t}var 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]),enuToLocalMatrix=new THREE__namespace.Matrix4().copy(ROTATE_X_90_MATRIX),localToEnuMatrix=new THREE__namespace.Matrix4().copy(ROTATE_X_90_MATRIX_INVERSE);function getRecommendTile3dProps(n,t){var e,r,o;t===void 0&&(t={});var s,u,l,c=typeof n.tileset.rootMeta.creationTime=="string";if(c){var p=typeof n.tileset.rootMeta.numTotalPoints=="number"&&n.tileset.rootMeta.numTotalPoints>0;if(p){l=4,t.powerPreference==="high"&&(l=2),s=l/1.6;var f=0;if(((e=n.tileset.rootMeta.taskParameters)===null||e===void 0?void 0:e.point_homogenization)==="1"&&(!((r=n.tileset.rootMeta.taskParameters)===null||r===void 0)&&r.homo_point_density)){var d=Number((o=n.tileset.rootMeta.taskParameters)===null||o===void 0?void 0:o.homo_point_density);isFinite(d)&&!isNaN(d)&&(f=d)}f<=0&&(f=.02),u=f*1.4}else l=5,t.powerPreference==="high"&&(l=4),s=0,u=.03}else l=6,s=0,u=.03,n.name==="aerophoto"?(l=12,t.powerPreference==="high"&&(l=10)):n.tileset.asset.extras&&typeof n.tileset.asset.extras.name=="string"&&/^matterport\b/i.test(n.tileset.asset.extras.name)&&(l=5,t.powerPreference==="high"&&(l=4));return{pointScale:u,pointMinPixel:s,maxScreenSpaceError:l}}var scratchVector3$3=new THREE__namespace.Vector3,scratchSphereBoundingVolume=new SphereBoundingVolume,scratchBoxBoundingVolume=new BoxBoundingVolume,parameterVersionMap=new WeakMap,tileVersionMap=new WeakMap,trajectoryVersionMap=new WeakMap,STENCIL_CONSTANT={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=STENCIL_CONSTANT.TILE_MASK,n.stencilFunc=THREE__namespace.AlwaysStencilFunc,n.stencilFuncMask=STENCIL_CONSTANT.TILE_MASK,n.stencilZPass=THREE__namespace.ReplaceStencilOp,n.stencilWriteMask=STENCIL_CONSTANT.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,Tile3D=function(n){__extends(t,n);function t(e,r){var o,s,u=n.call(this)||this;return u.parameter=new Parameter,u.renderObjects=[],u.backfaceObjects=[],u.tileObjects=[],u.frameNumber=0,u.error=(o=r.error)!==null&&o!==void 0?o:null,u.name=r.name,u.type=r.type,u.upAxis=r.upAxis,u.light=r.light,u.fetcher=r.fetcher,u.search=(s=r.search)!==null&&s!==void 0?s:"",u.groundHeight=r.groundHeight,u.enuToEcefMatrix=new THREE__namespace.Matrix4().copy(r.enuToEcefMatrix),u.ecefToEnuMatrix=new THREE__namespace.Matrix4().copy(r.ecefToEnuMatrix),u.boundingBox=new THREE__namespace.Box3,u.autoRefine=!0,u.refined=!1,u.refineProgress=[0,0],u.loaded=!1,u.disposed=!1,u.clearStencilObject=new THREE__namespace.Mesh(CLEAR_STENCIL_GEOMETRY,CLEAR_STENCIL_MATERIAL),u.clearStencilObject.frustumCulled=!1,u.clearStencilObject.onAfterRender=function(l){return l.clearStencil()},u.tileset=new Tileset(e,{tileLoader:function(l){return u.loadContent(l)},tileUnloader:function(l){return u.unloadContent(l)},onTileLoad:function(){},onTileUnload:function(l){},onTileError:function(l,c){u.onError&&u.onError(Object.assign(c,{error:c})),console.error("Tile error",l.id,c)},trajectoryLoader:function(l){return u.loadTrajectory(l)},trajectoryUnloader:function(l){return u.unloadTrajectory(l)},onTrajectoryLoad:function(){},onTrajectoryUnload:function(l){},onTrajectoryError:function(l,c){u.onError&&u.onError(Object.assign(c,{error:c})),console.error("Trajectory error",l,c)}}),u.tileset.root.boundingVolume&&u.tileset.root.boundingVolume.getBoundingBox(u.boundingBox),u}return Object.defineProperty(t.prototype,"viewerRequestVolume",{get:function(){return this.tileset.root.viewerRequestVolume},set:function(e){this.tileset.root.viewerRequestVolume=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"tiles",{get:function(){return this.tileset.selectedTiles},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"trajectories",{get:function(){return this.tileset.trajectories},enumerable:!1,configurable:!0}),t.prototype.getRecommendProps=function(e){return e===void 0&&(e={}),getRecommendTile3dProps(this,e)},t.prototype.loadContent=function(e){var r=this;return loadTileContent(e,{light:this.light,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,s){var u=this;r===void 0&&(r=null),o===void 0&&(o=!0),s===void 0&&(s=[]);for(var l=[this.tileset.root],c=this.tileset.transform,p,f=[];p=l.pop();){var d=void 0;if(p.boundingVolume){var h=void 0;p.boundingVolume instanceof BoxBoundingVolume?h=scratchBoxBoundingVolume.copy(p.boundingVolume):p.boundingVolume instanceof SphereBoundingVolume?h=scratchSphereBoundingVolume.copy(p.boundingVolume):h=p.boundingVolume.clone(),h.applyMatrix4(c),d=h.intersectRay(e.ray,e.far)}else d=!0;if(d){for(var g=0,A=p.children.length;g<A;g++)l.push(p.children[g]);p.selected&&p.content&&p.content.data&&p.content.data.object.visible&&p.content.data.object.intersectRaycaster(e,r,!1,f)}}return o&&f.sort(function(m,E){return m.distance-E.distance}),f.map(function(m){var E;m.model=(E=u.parent)!==null&&E!==void 0?E:void 0,m.viewLayer=u}),s.push.apply(s,f),s},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,s){var u,l,c=this,p,f,d,h,g;this.renderer=e,this.frameNumber++;var A=!1,m=this.parameter.resolveValue(o.parameter,s.parameter),E=m.versions.toString();parameterVersionMap.get(this)!==E&&(parameterVersionMap.set(this,E),A=!0);var v=m.maxLevelOfDetail;v=Math.max(v,0);var y=Math.min(m.minLevelOfDetail,v);(!this.visible||!this.loaded||!o.loaded)&&(v=Math.max(y,0));var b=m.minGeometricError,T=r.controllerMode;(T==="Panorama"||T==="VRPanorama"||T==="XRPanorama")&&m.modelAlpha<.1&&(b=m.panoramaMinGeometricError);var _=m.maxGeometricError;_=Math.max(b,_);var S=m.maxRequests;m.progress>.01&&m.progress<.99&&(S=0);var R={time:now(),camera:{type:r.type,position:new THREE__namespace.Vector3().copy(r.position),direction:r.getDirection(new THREE__namespace.Vector3),up:new THREE__namespace.Vector3().copy(r.up).applyQuaternion(r.quaternion),projectionMatrix:r.projectionMatrix.clone(),visible:r.visible,refine:r.refineModel},height:r.resolution.height,pixelRatio:r.pixelRatio,frameNumber:this.frameNumber,sseDenominator:2*Math.tan(.5*r.fov/180*Math.PI),cullingVolume:new CullingVolume().setFromCamera(r),minLevelOfDetail:y,maxLevelOfDetail:v,minGeometricError:b,maxGeometricError:_,skipLevelOfDetail:m.skipLevelOfDetail,mostDetail:m.mostDetail,loadSiblings:m.loadSiblings,cameraCulling:m.cameraCulling,maxMemoryUsage:m.maxMemoryUsage,maxRequests:S,requestOrder:m.requestOrder,maxScreenSpaceError:m.maxScreenSpaceError,memoryAdjustedOverflow:m.memoryAdjustedOverflow,memoryAdjustedScreenSpaceError:m.memoryAdjustedScreenSpaceError},M=m.cacheCameras.map(function(j){return j.updateProjectionMatrix(),__assign(__assign({},R),{camera:{type:r.type,position:new THREE__namespace.Vector3().copy(j.position),direction:j.getWorldDirection(new THREE__namespace.Vector3),up:new THREE__namespace.Vector3().copy(j.up),projectionMatrix:j.projectionMatrix.clone(),visible:j.visible,refine:!0},cullingVolume:new CullingVolume().setFromCamera(j)})});if(this.updateWorldMatrix(!0,!1),this.tileset.transform.equals(this.matrixWorld)||(this.tileset.transform.copy(this.matrixWorld),A=!0),this.autoRefine&&this.tileset.update(R,M),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.autoRefine){this.loaded=!0;var H=!1;this.tileset.needsRefinedTiles.forEach(function(j){if(c.loaded!==!1&&j.content){if(j.state.visible&&(H=!0),R.skipLevelOfDetail){if(j.state.finalResolution){var te=j.state.ancestorWithContentAvailable,V=te&&te.content?te.content:j.content,be=V.loadState;(be==="UNLOADED"||be==="LOADING")&&(c.loaded=!1)}}else if(j.state.visible&&j.levelOfContent<=0){var be=j.content.loadState;(be==="UNLOADED"||be==="LOADING")&&(c.loaded=!1)}}}),H&&this.tileset.selectedTiles.length===0&&this.tileset.frameNumber<500&&(this.loaded=!1),this.loaded===!0&&(this.refined=!1,this.refineProgress[1]++)}this.renderObjects.length=0,this.backfaceObjects.length=0,this.tileObjects.length=0,this.remove.apply(this,this.children),R.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});for(var B=[],C=0,w=this.tileset.selectedTiles;C<w.length;C++){var I=w[C],O=(f=(p=I.content)===null||p===void 0?void 0:p.data)===null||f===void 0?void 0:f.object;if(O){var L=O.update(e,r,o,this,I,m);if(B.push(I.id),L&&(A=!0),this.tileset.hasMixedContent&&R.skipLevelOfDetail){if(!I.state.finalResolution){var N=this.cloneSkipBackfaceObject(O);this.backfaceObjects.push(N)}for(var z=I.state.selectionDepth,J=STENCIL_CONSTANT.TILE_MASK|z<<STENCIL_CONSTANT.SKIP_LOD_BIT_SHIFT,K=THREE__namespace.GreaterEqualStencilFunc,Q=STENCIL_CONSTANT.SKIP_LOD_MASK,U=THREE__namespace.ReplaceStencilOp,q=STENCIL_CONSTANT.TILE_MASK|STENCIL_CONSTANT.SKIP_LOD_MASK,X=0,Z=O.materials;X<Z.length;X++){var W=Z[X];W.stencilWrite=!0,W.stencilRef=J,W.stencilFunc=K,W.stencilFuncMask=Q,W.stencilZPass=U,W.stencilWriteMask=q}}else for(var G=0,ne=O.materials;G<ne.length;G++){var W=ne[G];W.stencilWrite=!1,W.stencilRef=STENCIL_CONSTANT.TILE_MASK,W.stencilFunc=THREE__namespace.AlwaysStencilFunc,W.stencilFuncMask=STENCIL_CONSTANT.TILE_MASK,W.stencilZPass=THREE__namespace.ReplaceStencilOp,W.stencilWriteMask=STENCIL_CONSTANT.TILE_MASK}this.tileObjects.push(O)}}var $=B.toString();tileVersionMap.get(this)!==$&&(tileVersionMap.set(this,$),A=!0),R.skipLevelOfDetail&&this.backfaceObjects.length&&(u=this.renderObjects).push.apply(u,this.backfaceObjects),this.tileObjects.length&&(l=this.renderObjects).push.apply(l,this.tileObjects),R.skipLevelOfDetail&&this.renderObjects.push(this.clearStencilObject);for(var ee=[],re=0,le=this.tileset.selectedTrajectories;re<le.length;re++){var ae=le[re],oe=(d=ae.content.data)===null||d===void 0?void 0:d.object;if(oe){var L=oe.update(e,r,o,this,ae,m);ee.push(ae.id),L&&(A=!0),this.renderObjects.push(oe)}}var se=ee.toString();trajectoryVersionMap.get(this)!==se&&(trajectoryVersionMap.set(this,se),A=!0);for(var pe=Math.min(0,((g=(h=this.parent)===null||h===void 0?void 0:h.children)!==null&&g!==void 0?g:[]).indexOf(this)),de=pe*1e4,xe=function(j){var te=ce.renderObjects[j],V=j+de;te.traverse(function(be){(be instanceof THREE__namespace.Mesh||be instanceof THREE__namespace.Line||be instanceof THREE__namespace.Points)&&(be.renderOrder=V)}),ce.add(te)},ce=this,Re=0;Re<this.renderObjects.length;Re++)xe(Re);return A},t.prototype.dispose=function(){this.disposed=!0,this.tileset.reset(),/^blob\:/.test(this.tileset.id)&&URL.revokeObjectURL(this.tileset.id),this.remove.apply(this,this.children),this.refined=!1,this.loaded=!1,this.refineProgress[0]=this.refineProgress[1]=0},Object.defineProperty(t.prototype,"model",{get:function(){return this.parent},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"scene",{get:function(){return this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"viewLayer",{get:function(){return this},enumerable:!1,configurable:!0}),t.prototype.localToEnu=function(e){return e.applyMatrix4(localToEnuMatrix)},t.prototype.enuToLocal=function(e){return e.applyMatrix4(enuToLocalMatrix)},t.prototype.enuToEcef=function(e){return e.applyMatrix4(this.enuToEcefMatrix)},t.prototype.ecefToEnu=function(e){return e.applyMatrix4(this.ecefToEnuMatrix)},t.prototype.localToEcef=function(e){return this.enuToEcef(this.localToEnu(e))},t.prototype.ecefToLocal=function(e){return this.enuToLocal(this.ecefToEnu(e))},t.prototype.localToLla=function(e){return ecefToLla(this.enuToEcef(this.localToEnu(e)))},t.prototype.llaToLocal=function(e){return this.enuToLocal(this.ecefToEnu(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))},Object.defineProperty(t.prototype,"coordinates",{get:function(){scratchVector3$3.setScalar(0);var e=this.localToLla(scratchVector3$3),r=e.x,o=e.y;return[r,o].map(function(s){return(s/Math.PI*180).toFixed(6)}).join(",")},enumerable:!1,configurable:!0}),t.prototype.getTransformMatrix4=function(e){return e===void 0&&(e=new THREE__namespace.Matrix4),e.copy(this.ecefToEnuMatrix),e.premultiply(enuToLocalMatrix),e.premultiply(this.matrixWorld),e},t.prototype.coordinatesToWorldPoint=function(e){var r=new THREE__namespace.Vector3(e.latitude,e.longitude,e.altitude);return this.llaToWorld(r)},t.prototype.worldPointToCoordinates=function(e){return scratchVector3$3.copy(e),this.worldToLla(scratchVector3$3),{latitude:scratchVector3$3.x,longitude:scratchVector3$3.y,altitude:scratchVector3$3.z}},t.prototype.resetBrightness=function(){this.parameter.reset("brightness")},Object.defineProperty(t.prototype,"minLevelOfDetail",{get:function(){var e,r=[];return this.parent&&this.parent.parameter instanceof Parameter&&(r.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof Parameter&&r.unshift(this.parent.parent.parameter)),(e=this.parameter).resolveValue.apply(e,r).minLevelOfDetail},set:function(e){this.parameter.set("minLevelOfDetail",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"maxLevelOfDetail",{get:function(){var e,r=[];return this.parent&&this.parent.parameter instanceof Parameter&&(r.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof Parameter&&r.unshift(this.parent.parent.parameter)),(e=this.parameter).resolveValue.apply(e,r).maxLevelOfDetail},set:function(e){this.parameter.set("maxLevelOfDetail",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"minGeometricError",{get:function(){var e,r=[];return this.parent&&this.parent.parameter instanceof Parameter&&(r.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof Parameter&&r.unshift(this.parent.parent.parameter)),(e=this.parameter).resolveValue.apply(e,r).minGeometricError},set:function(e){this.parameter.set("minGeometricError",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"maxGeometricError",{get:function(){var e,r=[];return this.parent&&this.parent.parameter instanceof Parameter&&(r.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof Parameter&&r.unshift(this.parent.parent.parameter)),(e=this.parameter).resolveValue.apply(e,r).maxGeometricError},set:function(e){this.parameter.set("maxGeometricError",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"panoramaMinGeometricError",{get:function(){var e,r=[];return this.parent&&this.parent.parameter instanceof Parameter&&(r.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof Parameter&&r.unshift(this.parent.parent.parameter)),(e=this.parameter).resolveValue.apply(e,r).panoramaMinGeometricError},set:function(e){this.parameter.set("panoramaMinGeometricError",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"skipLevelOfDetail",{get:function(){var e,r=[];return this.parent&&this.parent.parameter instanceof Parameter&&(r.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof Parameter&&r.unshift(this.parent.parent.parameter)),(e=this.parameter).resolveValue.apply(e,r).skipLevelOfDetail},set:function(e){this.parameter.set("skipLevelOfDetail",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"mostDetail",{get:function(){var e,r=[];return this.parent&&this.parent.parameter instanceof Parameter&&(r.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof Parameter&&r.unshift(this.parent.parent.parameter)),(e=this.parameter).resolveValue.apply(e,r).mostDetail},set:function(e){this.parameter.set("mostDetail",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"loadSiblings",{get:function(){var e,r=[];return this.parent&&this.parent.parameter instanceof Parameter&&(r.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof Parameter&&r.unshift(this.parent.parent.parameter)),(e=this.parameter).resolveValue.apply(e,r).loadSiblings},set:function(e){this.parameter.set("loadSiblings",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"maxMemoryUsage",{get:function(){var e,r=[];return this.parent&&this.parent.parameter instanceof Parameter&&(r.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof Parameter&&r.unshift(this.parent.parent.parameter)),(e=this.parameter).resolveValue.apply(e,r).maxMemoryUsage},set:function(e){this.parameter.set("maxMemoryUsage",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"maxRequests",{get:function(){var e,r=[];return this.parent&&this.parent.parameter instanceof Parameter&&(r.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof Parameter&&r.unshift(this.parent.parent.parameter)),(e=this.parameter).resolveValue.apply(e,r).maxRequests},set:function(e){this.parameter.set("maxRequests",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"requestOrder",{get:function(){var e,r=[];return this.parent&&this.parent.parameter instanceof Parameter&&(r.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof Parameter&&r.unshift(this.parent.parent.parameter)),(e=this.parameter).resolveValue.apply(e,r).requestOrder},set:function(e){this.parameter.set("requestOrder",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"maxScreenSpaceError",{get:function(){var e,r=[];return this.parent&&this.parent.parameter instanceof Parameter&&(r.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof Parameter&&r.unshift(this.parent.parent.parameter)),(e=this.parameter).resolveValue.apply(e,r).maxScreenSpaceError},set:function(e){this.parameter.set("maxScreenSpaceError",e)},enumerable:!1,configurable:!0}),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 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 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],p=jsonStableNoneNumberStrinfiy_(n[c],!0);p!==void 0&&(s&&r!==""&&(r+=","),r+=JSON.stringify(c)+":"+p),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 S=verify(n[_]);if(S instanceof Error)return{value:S};if(!o)o=S.issuer;else if(o!==S.issuer)return{value:error_invalid_certificate()};s?S.expire.getTime()<s.getTime()&&(s=S.expire):s=S.expire,u?u=u.filter(function(R){return S.allowHosts.indexOf(R)!==-1}):u=S.allowHosts},c=0;c<n.length;c++){var p=l(c);if(typeof p=="object")return p.value}return deepFreeze({issuer:o,expire:s,allowHosts:u})}var f=JSON.parse(n),d=typeof location!="undefined"?location.hostname:"",h=Date.now();if(typeof f!="object")return error_invalid_input();var g=new Date(typeof f.expire_at=="string"&&/^\d+$/.test(f.expire_at)?Number(f.expire_at):f.expire_at),A=Array.isArray(f.allow_hosts)?f.allow_hosts:[];if(d.length===0||isIPDomain(d)||BUILDIN_ALLOW_HOST.filter(function(_){return matchDomain(_,d)}).length>0){var m=String((t=f.certificate)!==null&&t!==void 0?t:"");if(m){var E=new X509;return E.readCertPEM(m),deepFreeze({issuer:E.getSubjectString(),expire:g,allowHosts:A})}return deepFreeze({issuer:"none",expire:g,allowHosts:A})}var v=String((e=f.certificate)!==null&&e!==void 0?e:"");if(!v)return error_invalid_certificate();var y=new X509;y.readCertPEM(v);var b=String((r=f._signature)!==null&&r!==void 0?r:"");if(!b)return error_invalid_signature();var T=jsonStableNoneNumberStrinfiy(ObjectOmit(f,["_signature"]));return verifyMessage(T,b,y)===!1?error_invalid_signature():h<g.getTime()?A.filter(function(_){return matchDomain(_,d)}).length===0?error_host_not_allowed(d):deepFreeze({issuer:y.getSubjectString(),expire:g,allowHosts:A}):error_date_expired(g)}var PANO_TEXTURE_SCALE=new THREE__namespace.Vector3(1,1,1),scratchMatrix4$2=new THREE__namespace.Matrix4,scratchObserverBox$1=new THREE__namespace.Box3,workRawMapping=new WeakMap,needsUpdateWorkCodeSet=new Set,Work=function(){function n(t,e){this.name="",this.baseURL="",this.workCode="",this.expire=new Date,this.allowHosts=[],this.initial={work:this},this.observers=[],this.observerBox=new THREE__namespace.Box3,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)}}}if(t!==null)if("up"in t&&typeof t.up=="string"&&"down"in t&&typeof t.down=="string"&&"right"in t&&typeof t.right=="string"&&"left"in t&&typeof t.left=="string"&&"front"in t&&typeof t.front=="string"&&"back"in t&&typeof t.back=="string"&&"size"in t&&typeof t.size=="number")parsePanoWork(t,this);else{var o=parse(t,e,this);if(o instanceof Error)throw new Error("[PARSE FAILED]: "+o.message+`
|
|
1024
|
+
`,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),p=new THREE__namespace.Vector3,f=new THREE__namespace.Vector3,d=new THREE__namespace.Vector2,h=new THREE__namespace.Vector3,g=0;g<=e;g++){h=n.getPointAt(g/e,h);for(var A=c.normals[g],m=c.binormals[g],E=0;E<=r;E++){var v=g*(r+1)+E,y=E/r*Math.PI*2,b=Math.sin(y),T=-Math.cos(y);f.x=T*A.x+b*m.x,f.y=T*A.y+b*m.y,f.z=T*A.z+b*m.z,f.normalize(),f.toArray(s,v*3),p.x=h.x+t*f.x,p.y=h.y+t*f.y,p.z=h.z+t*f.z,p.toArray(o,v*3),d.x=g/e,d.y=E/r,d.toArray(u,v*2)}}for(var g=0;g<e;g++)for(var E=0;E<r;E++){var _=(g*r+E)*6,S=(r+1)*g+E,R=(r+1)*(g+1)+E,M=(r+1)*(g+1)+(E+1),H=(r+1)*g+(E+1);l[_]=S,l[_+1]=R,l[_+2]=H,l[_+3]=R,l[_+4]=M,l[_+5]=H}var B=new THREE__namespace.BufferGeometry;return B.setIndex(new THREE__namespace.BufferAttribute(l,1)),B.setAttribute("position",new THREE__namespace.BufferAttribute(o,3)),B.setAttribute("normal",new THREE__namespace.BufferAttribute(s,3)),B.setAttribute("uv",new THREE__namespace.BufferAttribute(u,2)),B}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,p=3;p<c;p+=3){var f=new THREE__namespace.Vector3().fromArray(n,p-3),d=new THREE__namespace.Vector3().fromArray(n,p);u+=f.distanceTo(d);var h=new THREE__namespace.LineCurve3(f,d);l.add(h)}var g=.03,A=Math.ceil(u*100),m=6,E=createPipeBufferGeometry(l,g,A,m);E.clearGroups(),E.addGroup(0,E.index?E.index.count:E.attributes.position.count,0),E.addGroup(0,E.index?E.index.count:E.attributes.position.count,1),E.addGroup(0,E.index?E.index.count:E.attributes.position.count,2);var v=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});v.uniforms.totalLength.value=u,v.uniforms.diffuse.value=e,v.uniforms.diffuse2.value=e,v.uniforms.opacity.value=.5,v.transparent=!0;var y=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});y.uniforms.totalLength.value=u,y.uniforms.displacementScalar.value=-.01,y.uniforms.diffuse.value=r,y.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(E,[v,y,b]),_=.08,S=24,R=new THREE__namespace.SphereBufferGeometry(_,S,S);R.clearGroups(),R.addGroup(0,E.index?E.index.count:E.attributes.position.count,0),R.addGroup(0,E.index?E.index.count:E.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 H=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});H.uniforms.displacementScalar.value=-.01,H.uniforms.diffuse.value=r;var B=new THREE__namespace.Mesh(R,[M,H]);B.position.fromArray(n,0),T.add(B);var C=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});C.uniforms.displacementScalar.value=-.01,C.uniforms.diffuse.value=o;var w=new THREE__namespace.Mesh(R,[M,C]);return w.position.fromArray(n,n.length-3),T.add(w),{scene:T,dispose:function(){E.dispose(),v.dispose(),y.dispose(),b.dispose(),R.dispose(),M.dispose(),H.dispose(),C.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,p,f=(l=(u=s.scene.attributes)===null||u===void 0?void 0:u.time.array)!==null&&l!==void 0?l:[],d=(p=(c=s.scene.attributes)===null||c===void 0?void 0:c.position.array)!==null&&p!==void 0?p:[],h=s.byteLength,g=s.memoryUsage,A=parseTrajectoryObject(d);A.scene.applyMatrix4(n.transform),A.scene.updateWorldMatrix(!1,!0),A.scene.matrixAutoUpdate=!1;var m=new TrajectoryNode(e,A.scene);return n.content.data={uri:o,byteLength:h,memoryUsage:g,positionArray:d,timeArray:f,object:m},n.content.byteLength=h,n.content.memoryUsage=g,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,n.content.memoryUsage=0)}var scratchVector3$4=new THREE__namespace.Vector3,scratchMatrix3=new THREE__namespace.Matrix3,scratchMatrix4$3=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 p=Math.sin(l),f=a/Math.sqrt(1-e*p*p);c=r/Math.cos(l)-f;var d=Math.atan2(n.z/(f*(1-e)+c),r/(f+c));if(isNaN(d))break;var h=Math.abs(d-l);if(h<o)break;l=d}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),p=Math.cos(e),f=a/Math.sqrt(1-s*u*u),d=(f+r)*l*p,h=(f+r)*l*c,g=(o*o/(a*a)*f+r)*u;return n.set(d,h,g)}function getEcefToEnuMatrix(n,t){var e=ecefToLla(scratchVector3$4.copy(n)),r=e.x,o=e.y,s=e.z,u=Math.sin(r),l=Math.sin(o),c=Math.cos(r),p=Math.cos(o);t.fromArray([-l,-u*p,c*p,0,+p,-u*l,c*l,0,0,c,u,0,0,0,0,1]);var f=scratchMatrix3.setFromMatrix4(t),d=scratchVector3$4.copy(n).applyMatrix3(f).multiplyScalar(-1);t.setPosition(d);var h=scratchMatrix4$3.fromArray([1,0,0,0,0,1,0,0,0,0,1,0,0,0,s,1]);return t.premultiply(h),t}var 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]),enuToLocalMatrix=new THREE__namespace.Matrix4().copy(ROTATE_X_90_MATRIX),localToEnuMatrix=new THREE__namespace.Matrix4().copy(ROTATE_X_90_MATRIX_INVERSE);function getRecommendTile3dProps(n,t){var e,r,o;t===void 0&&(t={});var s,u,l,c=typeof n.tileset.rootMeta.creationTime=="string";if(c){var p=typeof n.tileset.rootMeta.numTotalPoints=="number"&&n.tileset.rootMeta.numTotalPoints>0;if(p){l=4,t.powerPreference==="high"&&(l=2),s=l/1.6;var f=0;if(((e=n.tileset.rootMeta.taskParameters)===null||e===void 0?void 0:e.point_homogenization)==="1"&&(!((r=n.tileset.rootMeta.taskParameters)===null||r===void 0)&&r.homo_point_density)){var d=Number((o=n.tileset.rootMeta.taskParameters)===null||o===void 0?void 0:o.homo_point_density);isFinite(d)&&!isNaN(d)&&(f=d)}f<=0&&(f=.02),u=f*1.4}else l=5,t.powerPreference==="high"&&(l=4),s=0,u=.03}else l=6,s=0,u=.03,n.name==="aerophoto"?(l=12,t.powerPreference==="high"&&(l=10)):n.tileset.asset.extras&&typeof n.tileset.asset.extras.name=="string"&&/^matterport\b/i.test(n.tileset.asset.extras.name)&&(l=5,t.powerPreference==="high"&&(l=4));return{pointScale:u,pointMinPixel:s,maxScreenSpaceError:l}}var scratchVector3$3=new THREE__namespace.Vector3,scratchSphereBoundingVolume=new SphereBoundingVolume,scratchBoxBoundingVolume=new BoxBoundingVolume,parameterVersionMap=new WeakMap,tileVersionMap=new WeakMap,trajectoryVersionMap=new WeakMap,STENCIL_CONSTANT={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=STENCIL_CONSTANT.TILE_MASK,n.stencilFunc=THREE__namespace.AlwaysStencilFunc,n.stencilFuncMask=STENCIL_CONSTANT.TILE_MASK,n.stencilZPass=THREE__namespace.ReplaceStencilOp,n.stencilWriteMask=STENCIL_CONSTANT.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,Tile3D=function(n){__extends(t,n);function t(e,r){var o,s,u=n.call(this)||this;return u.parameter=new Parameter,u.renderObjects=[],u.backfaceObjects=[],u.tileObjects=[],u.frameNumber=0,u.error=(o=r.error)!==null&&o!==void 0?o:null,u.name=r.name,u.type=r.type,u.upAxis=r.upAxis,u.light=r.light,u.fetcher=r.fetcher,u.search=(s=r.search)!==null&&s!==void 0?s:"",u.groundHeight=r.groundHeight,u.enuToEcefMatrix=new THREE__namespace.Matrix4().copy(r.enuToEcefMatrix),u.ecefToEnuMatrix=new THREE__namespace.Matrix4().copy(r.ecefToEnuMatrix),u.boundingBox=new THREE__namespace.Box3,u.autoRefine=!0,u.refined=!1,u.refineProgress=[0,0],u.loaded=!1,u.disposed=!1,u.clearStencilObject=new THREE__namespace.Mesh(CLEAR_STENCIL_GEOMETRY,CLEAR_STENCIL_MATERIAL),u.clearStencilObject.frustumCulled=!1,u.clearStencilObject.onAfterRender=function(l){return l.clearStencil()},u.tileset=new Tileset(e,{tileLoader:function(l){return u.loadContent(l)},tileUnloader:function(l){return u.unloadContent(l)},onTileLoad:function(){},onTileUnload:function(l){},onTileError:function(l,c){u.onError&&u.onError(Object.assign(c,{error:c})),console.error("Tile error",l.id,c)},trajectoryLoader:function(l){return u.loadTrajectory(l)},trajectoryUnloader:function(l){return u.unloadTrajectory(l)},onTrajectoryLoad:function(){},onTrajectoryUnload:function(l){},onTrajectoryError:function(l,c){u.onError&&u.onError(Object.assign(c,{error:c})),console.error("Trajectory error",l,c)}}),u.tileset.root.boundingVolume&&u.tileset.root.boundingVolume.getBoundingBox(u.boundingBox),u}return Object.defineProperty(t.prototype,"viewerRequestVolume",{get:function(){return this.tileset.root.viewerRequestVolume},set:function(e){this.tileset.root.viewerRequestVolume=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"tiles",{get:function(){return this.tileset.selectedTiles},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"trajectories",{get:function(){return this.tileset.trajectories},enumerable:!1,configurable:!0}),t.prototype.getRecommendProps=function(e){return e===void 0&&(e={}),getRecommendTile3dProps(this,e)},t.prototype.loadContent=function(e){var r=this;return loadTileContent(e,{light:this.light,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,s){var u=this;r===void 0&&(r=null),o===void 0&&(o=!0),s===void 0&&(s=[]);for(var l=[this.tileset.root],c=this.tileset.transform,p,f=[];p=l.pop();){var d=void 0;if(p.boundingVolume){var h=void 0;p.boundingVolume instanceof BoxBoundingVolume?h=scratchBoxBoundingVolume.copy(p.boundingVolume):p.boundingVolume instanceof SphereBoundingVolume?h=scratchSphereBoundingVolume.copy(p.boundingVolume):h=p.boundingVolume.clone(),h.applyMatrix4(c),d=h.intersectRay(e.ray,e.far)}else d=!0;if(d){for(var g=0,A=p.children.length;g<A;g++)l.push(p.children[g]);p.selected&&p.content&&p.content.data&&p.content.data.object.visible&&p.content.data.object.intersectRaycaster(e,r,!1,f)}}return o&&f.sort(function(m,E){return m.distance-E.distance}),f.map(function(m){var E;m.model=(E=u.parent)!==null&&E!==void 0?E:void 0,m.viewLayer=u}),s.push.apply(s,f),s},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,s){var u,l,c=this,p,f,d,h,g;this.renderer=e,this.frameNumber++;var A=!1,m=this.parameter.resolveValue(o.parameter,s.parameter),E=m.versions.toString();parameterVersionMap.get(this)!==E&&(parameterVersionMap.set(this,E),A=!0);var v=m.maxLevelOfDetail;v=Math.max(v,0);var y=Math.min(m.minLevelOfDetail,v);(!this.visible||!this.loaded||!o.loaded)&&(v=Math.max(y,0));var b=m.minGeometricError,T=r.controllerMode;(T==="Panorama"||T==="VRPanorama"||T==="XRPanorama")&&m.modelAlpha<.1&&(b=m.panoramaMinGeometricError);var _=m.maxGeometricError;_=Math.max(b,_);var S=m.maxRequests;m.progress>.01&&m.progress<.99&&(S=0);var R={time:now(),camera:{type:r.type,position:new THREE__namespace.Vector3().copy(r.position),direction:r.getDirection(new THREE__namespace.Vector3),up:new THREE__namespace.Vector3().copy(r.up).applyQuaternion(r.quaternion),projectionMatrix:r.projectionMatrix.clone(),visible:r.visible,refine:r.refineModel},height:r.resolution.height,pixelRatio:r.pixelRatio,frameNumber:this.frameNumber,sseDenominator:2*Math.tan(.5*r.fov/180*Math.PI),cullingVolume:new CullingVolume().setFromCamera(r),minLevelOfDetail:y,maxLevelOfDetail:v,minGeometricError:b,maxGeometricError:_,skipLevelOfDetail:m.skipLevelOfDetail,mostDetail:m.mostDetail,loadSiblings:m.loadSiblings,cameraCulling:m.cameraCulling,maxMemoryUsage:m.maxMemoryUsage,maxRequests:S,requestOrder:m.requestOrder,maxScreenSpaceError:m.maxScreenSpaceError,memoryAdjustedOverflow:m.memoryAdjustedOverflow,memoryAdjustedScreenSpaceError:m.memoryAdjustedScreenSpaceError},M=m.cacheCameras.map(function(X){return X.updateProjectionMatrix(),__assign(__assign({},R),{camera:{type:r.type,position:new THREE__namespace.Vector3().copy(X.position),direction:X.getWorldDirection(new THREE__namespace.Vector3),up:new THREE__namespace.Vector3().copy(X.up),projectionMatrix:X.projectionMatrix.clone(),visible:X.visible,refine:!0},cullingVolume:new CullingVolume().setFromCamera(X)})});if(this.updateWorldMatrix(!0,!1),this.tileset.transform.equals(this.matrixWorld)||(this.tileset.transform.copy(this.matrixWorld),A=!0),this.autoRefine&&this.tileset.update(R,M),this.refined=!0,this.refineProgress[0]=0,this.refineProgress[1]=0,this.tileset.needsRefinedTiles.forEach(function(X){if(c.refineProgress[1]++,X.content){var ne=X.content.loadState;if(ne==="UNLOADED"||ne==="LOADING"){c.refined=!1;return}}c.refineProgress[0]++}),this.loaded===!1&&this.autoRefine){this.loaded=!0;var H=!1;this.tileset.needsRefinedTiles.forEach(function(X){if(c.loaded!==!1&&X.content){if(X.state.visible&&(H=!0),R.skipLevelOfDetail){if(X.state.finalResolution){var ne=X.state.ancestorWithContentAvailable,V=ne&&ne.content?ne.content:X.content,Ee=V.loadState;(Ee==="UNLOADED"||Ee==="LOADING")&&(c.loaded=!1)}}else if(X.state.visible&&X.levelOfContent<=0){var Ee=X.content.loadState;(Ee==="UNLOADED"||Ee==="LOADING")&&(c.loaded=!1)}}}),H&&this.tileset.selectedTiles.length===0&&this.tileset.frameNumber<500&&(this.loaded=!1),this.loaded===!0&&(this.refined=!1,this.refineProgress[1]++)}this.renderObjects.length=0,this.backfaceObjects.length=0,this.tileObjects.length=0,this.remove.apply(this,this.children),R.skipLevelOfDetail||this.tileset.selectedTiles.sort(function(X,ne){return X.floor!==ne.floor?X.floor-ne.floor:X.levelOfContent!==ne.levelOfContent?ne.levelOfContent-X.levelOfContent:X.state.distanceToCamera!==ne.state.distanceToCamera?X.state.distanceToCamera-ne.state.distanceToCamera:X.state.centerZDepth-ne.state.centerZDepth});for(var B=[],C=0,w=this.tileset.selectedTiles;C<w.length;C++){var I=w[C],O=(f=(p=I.content)===null||p===void 0?void 0:p.data)===null||f===void 0?void 0:f.object;if(O){var L=O.update(e,r,o,this,I,m);if(B.push(I.id),L&&(A=!0),this.tileset.hasMixedContent&&R.skipLevelOfDetail){if(!I.state.finalResolution){var N=this.cloneSkipBackfaceObject(O);this.backfaceObjects.push(N)}for(var z=I.state.selectionDepth,J=STENCIL_CONSTANT.TILE_MASK|z<<STENCIL_CONSTANT.SKIP_LOD_BIT_SHIFT,G=THREE__namespace.GreaterEqualStencilFunc,Q=STENCIL_CONSTANT.SKIP_LOD_MASK,U=THREE__namespace.ReplaceStencilOp,q=STENCIL_CONSTANT.TILE_MASK|STENCIL_CONSTANT.SKIP_LOD_MASK,K=0,Y=O.materials;K<Y.length;K++){var Z=Y[K];Z.stencilWrite=!0,Z.stencilRef=J,Z.stencilFunc=G,Z.stencilFuncMask=Q,Z.stencilZPass=U,Z.stencilWriteMask=q}}else for(var te=0,j=O.materials;te<j.length;te++){var Z=j[te];Z.stencilWrite=!1,Z.stencilRef=STENCIL_CONSTANT.TILE_MASK,Z.stencilFunc=THREE__namespace.AlwaysStencilFunc,Z.stencilFuncMask=STENCIL_CONSTANT.TILE_MASK,Z.stencilZPass=THREE__namespace.ReplaceStencilOp,Z.stencilWriteMask=STENCIL_CONSTANT.TILE_MASK}this.tileObjects.push(O)}}var ee=B.toString();tileVersionMap.get(this)!==ee&&(tileVersionMap.set(this,ee),A=!0),R.skipLevelOfDetail&&this.backfaceObjects.length&&(u=this.renderObjects).push.apply(u,this.backfaceObjects),this.tileObjects.length&&(l=this.renderObjects).push.apply(l,this.tileObjects),R.skipLevelOfDetail&&this.renderObjects.push(this.clearStencilObject);for(var W=[],re=0,le=this.tileset.selectedTrajectories;re<le.length;re++){var ae=le[re],oe=(d=ae.content.data)===null||d===void 0?void 0:d.object;if(oe){var L=oe.update(e,r,o,this,ae,m);W.push(ae.id),L&&(A=!0),this.renderObjects.push(oe)}}var se=W.toString();trajectoryVersionMap.get(this)!==se&&(trajectoryVersionMap.set(this,se),A=!0);for(var ce=Math.min(0,((g=(h=this.parent)===null||h===void 0?void 0:h.children)!==null&&g!==void 0?g:[]).indexOf(this)),ve=ce*1e4,Te=function(X){var ne=pe.renderObjects[X],V=X+ve;ne.traverse(function(Ee){(Ee instanceof THREE__namespace.Mesh||Ee instanceof THREE__namespace.Line||Ee instanceof THREE__namespace.Points)&&(Ee.renderOrder=V)}),pe.add(ne)},pe=this,me=0;me<this.renderObjects.length;me++)Te(me);return A},t.prototype.dispose=function(){this.disposed=!0,this.tileset.reset(),/^blob\:/.test(this.tileset.id)&&URL.revokeObjectURL(this.tileset.id),this.remove.apply(this,this.children),this.refined=!1,this.loaded=!1,this.refineProgress[0]=this.refineProgress[1]=0},Object.defineProperty(t.prototype,"model",{get:function(){return this.parent},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"scene",{get:function(){return this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"viewLayer",{get:function(){return this},enumerable:!1,configurable:!0}),t.prototype.localToEnu=function(e){return e.applyMatrix4(localToEnuMatrix)},t.prototype.enuToLocal=function(e){return e.applyMatrix4(enuToLocalMatrix)},t.prototype.enuToEcef=function(e){return e.applyMatrix4(this.enuToEcefMatrix)},t.prototype.ecefToEnu=function(e){return e.applyMatrix4(this.ecefToEnuMatrix)},t.prototype.localToEcef=function(e){return this.enuToEcef(this.localToEnu(e))},t.prototype.ecefToLocal=function(e){return this.enuToLocal(this.ecefToEnu(e))},t.prototype.localToLla=function(e){return ecefToLla(this.enuToEcef(this.localToEnu(e)))},t.prototype.llaToLocal=function(e){return this.enuToLocal(this.ecefToEnu(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))},Object.defineProperty(t.prototype,"coordinates",{get:function(){scratchVector3$3.setScalar(0);var e=this.localToLla(scratchVector3$3),r=e.x,o=e.y;return[r,o].map(function(s){return(s/Math.PI*180).toFixed(6)}).join(",")},enumerable:!1,configurable:!0}),t.prototype.getTransformMatrix4=function(e){return e===void 0&&(e=new THREE__namespace.Matrix4),e.copy(this.ecefToEnuMatrix),e.premultiply(enuToLocalMatrix),e.premultiply(this.matrixWorld),e},t.prototype.coordinatesToWorldPoint=function(e){var r=new THREE__namespace.Vector3(e.latitude,e.longitude,e.altitude);return this.llaToWorld(r)},t.prototype.worldPointToCoordinates=function(e){return scratchVector3$3.copy(e),this.worldToLla(scratchVector3$3),{latitude:scratchVector3$3.x,longitude:scratchVector3$3.y,altitude:scratchVector3$3.z}},t.prototype.resetBrightness=function(){this.parameter.reset("brightness")},Object.defineProperty(t.prototype,"minLevelOfDetail",{get:function(){var e,r=[];return this.parent&&this.parent.parameter instanceof Parameter&&(r.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof Parameter&&r.unshift(this.parent.parent.parameter)),(e=this.parameter).resolveValue.apply(e,r).minLevelOfDetail},set:function(e){this.parameter.set("minLevelOfDetail",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"maxLevelOfDetail",{get:function(){var e,r=[];return this.parent&&this.parent.parameter instanceof Parameter&&(r.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof Parameter&&r.unshift(this.parent.parent.parameter)),(e=this.parameter).resolveValue.apply(e,r).maxLevelOfDetail},set:function(e){this.parameter.set("maxLevelOfDetail",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"minGeometricError",{get:function(){var e,r=[];return this.parent&&this.parent.parameter instanceof Parameter&&(r.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof Parameter&&r.unshift(this.parent.parent.parameter)),(e=this.parameter).resolveValue.apply(e,r).minGeometricError},set:function(e){this.parameter.set("minGeometricError",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"maxGeometricError",{get:function(){var e,r=[];return this.parent&&this.parent.parameter instanceof Parameter&&(r.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof Parameter&&r.unshift(this.parent.parent.parameter)),(e=this.parameter).resolveValue.apply(e,r).maxGeometricError},set:function(e){this.parameter.set("maxGeometricError",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"panoramaMinGeometricError",{get:function(){var e,r=[];return this.parent&&this.parent.parameter instanceof Parameter&&(r.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof Parameter&&r.unshift(this.parent.parent.parameter)),(e=this.parameter).resolveValue.apply(e,r).panoramaMinGeometricError},set:function(e){this.parameter.set("panoramaMinGeometricError",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"skipLevelOfDetail",{get:function(){var e,r=[];return this.parent&&this.parent.parameter instanceof Parameter&&(r.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof Parameter&&r.unshift(this.parent.parent.parameter)),(e=this.parameter).resolveValue.apply(e,r).skipLevelOfDetail},set:function(e){this.parameter.set("skipLevelOfDetail",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"mostDetail",{get:function(){var e,r=[];return this.parent&&this.parent.parameter instanceof Parameter&&(r.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof Parameter&&r.unshift(this.parent.parent.parameter)),(e=this.parameter).resolveValue.apply(e,r).mostDetail},set:function(e){this.parameter.set("mostDetail",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"loadSiblings",{get:function(){var e,r=[];return this.parent&&this.parent.parameter instanceof Parameter&&(r.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof Parameter&&r.unshift(this.parent.parent.parameter)),(e=this.parameter).resolveValue.apply(e,r).loadSiblings},set:function(e){this.parameter.set("loadSiblings",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"maxMemoryUsage",{get:function(){var e,r=[];return this.parent&&this.parent.parameter instanceof Parameter&&(r.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof Parameter&&r.unshift(this.parent.parent.parameter)),(e=this.parameter).resolveValue.apply(e,r).maxMemoryUsage},set:function(e){this.parameter.set("maxMemoryUsage",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"maxRequests",{get:function(){var e,r=[];return this.parent&&this.parent.parameter instanceof Parameter&&(r.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof Parameter&&r.unshift(this.parent.parent.parameter)),(e=this.parameter).resolveValue.apply(e,r).maxRequests},set:function(e){this.parameter.set("maxRequests",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"requestOrder",{get:function(){var e,r=[];return this.parent&&this.parent.parameter instanceof Parameter&&(r.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof Parameter&&r.unshift(this.parent.parent.parameter)),(e=this.parameter).resolveValue.apply(e,r).requestOrder},set:function(e){this.parameter.set("requestOrder",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"maxScreenSpaceError",{get:function(){var e,r=[];return this.parent&&this.parent.parameter instanceof Parameter&&(r.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof Parameter&&r.unshift(this.parent.parent.parameter)),(e=this.parameter).resolveValue.apply(e,r).maxScreenSpaceError},set:function(e){this.parameter.set("maxScreenSpaceError",e)},enumerable:!1,configurable:!0}),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 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 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],p=jsonStableNoneNumberStrinfiy_(n[c],!0);p!==void 0&&(s&&r!==""&&(r+=","),r+=JSON.stringify(c)+":"+p),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 S=verify(n[_]);if(S instanceof Error)return{value:S};if(!o)o=S.issuer;else if(o!==S.issuer)return{value:error_invalid_certificate()};s?S.expire.getTime()<s.getTime()&&(s=S.expire):s=S.expire,u?u=u.filter(function(R){return S.allowHosts.indexOf(R)!==-1}):u=S.allowHosts},c=0;c<n.length;c++){var p=l(c);if(typeof p=="object")return p.value}return deepFreeze({issuer:o,expire:s,allowHosts:u})}var f=JSON.parse(n),d=typeof location!="undefined"?location.hostname:"",h=Date.now();if(typeof f!="object")return error_invalid_input();var g=new Date(typeof f.expire_at=="string"&&/^\d+$/.test(f.expire_at)?Number(f.expire_at):f.expire_at),A=Array.isArray(f.allow_hosts)?f.allow_hosts:[];if(d.length===0||isIPDomain(d)||BUILDIN_ALLOW_HOST.filter(function(_){return matchDomain(_,d)}).length>0){var m=String((t=f.certificate)!==null&&t!==void 0?t:"");if(m){var E=new X509;return E.readCertPEM(m),deepFreeze({issuer:E.getSubjectString(),expire:g,allowHosts:A})}return deepFreeze({issuer:"none",expire:g,allowHosts:A})}var v=String((e=f.certificate)!==null&&e!==void 0?e:"");if(!v)return error_invalid_certificate();var y=new X509;y.readCertPEM(v);var b=String((r=f._signature)!==null&&r!==void 0?r:"");if(!b)return error_invalid_signature();var T=jsonStableNoneNumberStrinfiy(ObjectOmit(f,["_signature"]));return verifyMessage(T,b,y)===!1?error_invalid_signature():h<g.getTime()?A.filter(function(_){return matchDomain(_,d)}).length===0?error_host_not_allowed(d):deepFreeze({issuer:y.getSubjectString(),expire:g,allowHosts:A}):error_date_expired(g)}var PANO_TEXTURE_SCALE=new THREE__namespace.Vector3(1,1,1),scratchMatrix4$2=new THREE__namespace.Matrix4,scratchObserverBox$1=new THREE__namespace.Box3,workRawMapping=new WeakMap,needsUpdateWorkCodeSet=new Set,Work=function(){function n(t,e){this.name="",this.baseURL="",this.workCode="",this.expire=new Date,this.allowHosts=[],this.initial={work:this},this.observers=[],this.observerBox=new THREE__namespace.Box3,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)}}}if(t!==null)if("up"in t&&typeof t.up=="string"&&"down"in t&&typeof t.down=="string"&&"right"in t&&typeof t.right=="string"&&"left"in t&&typeof t.left=="string"&&"front"in t&&typeof t.front=="string"&&"back"in t&&typeof t.back=="string"&&"size"in t&&typeof t.size=="number")parsePanoWork(t,this);else{var o=parse(t,e,this);if(o instanceof Error)throw new Error("[PARSE FAILED]: "+o.message+`
|
|
1025
1025
|
Error work input:
|
|
1026
|
-
`+JSON.stringify(t))}else parseNull(t,this)}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:"",p=l.join(".");s=pathJoin(n,sha256(c))+(p?"."+p:"")}var f=s.replace(n,"");return r.baseURL&&(s=pathJoin(r.baseURL,f)),r.traverseResource&&r.traverseResource({origin:t,absolute:s,relative:f,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,p,f,d,h,g,A,m,E,v,y,b,T,_,S,R=JSON.stringify(t),M=[],H=0,B=[].concat(n);H<B.length;H++){var C=B[H];C instanceof Work?M.push.apply(M,C.raw.works):typeof C=="string"?M.push(C):M.push(JSON.stringify(C))}var w=verify(M);if(w instanceof Error)return w;Array.isArray(t.transform)?e.transform.fromArray(t.transform):t.transform&&e.transform.copy(t.transform),n=M.map(function(j){return JSON.parse(j)}).reduce(function(j,te){return deepMerge(j,te)}),defineProperty(e,"raw",{configurable:!1,get:function(){return{works:M,options:R}}});{var I;if(t.workCode&&(typeof t.workCode=="string"?I=t.workCode:typeof t.workCode=="function"&&(I=t.workCode(n))),typeof I=="undefined"&&(I=String(n.resource_code||n.basic_code||n.vr_code||n.code||n.project_id||n.work_code||n.workCode)),typeof I=="undefined")return new Error("WorkCode never matched.");defineProperty(e,"workCode",{configurable:!1,get:function(){return I}})}{var O=String(n.name);defineProperty(e,"name",{configurable:!1,get:function(){return O}})}if(w instanceof Error)return w;defineProperty(e,"issuer",{configurable:!1,get:function(){return w.issuer}}),defineProperty(e,"expire",{configurable:!1,get:function(){return w.expire}}),defineProperty(e,"allowHosts",{configurable:!1,get:function(){return w.allowHosts}});var L=(r=n.base_url)!==null&&r!==void 0?r:"";if(L&&L[L.length-1]!=="/"&&(L+="/"),e.baseURL=(o=t.baseURL)!==null&&o!==void 0?o:L,w instanceof Error)return w;if(n.model){var N={work:e,layers:[]},z;n.model.file?z=fileURL(L,n.model.file,t):n.model.file_url&&(z=fileURL(L,n.model.file_url,t)),defineProperty(N,"file",{configurable:!1,get:function(){return z}});var J;n.model.textureBase?J=textureURL$1(L,"",n.model.textureBase,t):n.model.material_base_url?J=textureURL$1(L,"",n.model.material_base_url,t):N.file&&(J=N.file.split("/").slice(0,-1).join("/").replace("/model/","/materials/")),defineProperty(N,"textureBase",{configurable:!1,get:function(){return J}});var K;Array.isArray(n.model.textures)?(K=n.model.textures.map(function(j){var te,V;return textureURL$1(L,j,(V=(te=n.model.textureBase)!==null&&te!==void 0?te:n.model.material_base_url)!==null&&V!==void 0?V:"",t)}),Object.freeze(K)):Array.isArray(n.model.material_textures)&&(K=n.model.material_textures.map(function(j){var te,V;return textureURL$1(L,j,(V=(te=n.model.textureBase)!==null&&te!==void 0?te:n.model.material_base_url)!==null&&V!==void 0?V:"",t)}),Object.freeze(K)),defineProperty(N,"textures",{configurable:!1,get:function(){return K}});var Q=[];if(Array.isArray(n.model.tiles))for(var U=0,q=n.model.tiles;U<q.length;U++){var X=q[U];X&&(X.tileset||X.tileset_url)&&Q.push(Object.freeze({type:(s=X.type)!==null&&s!==void 0?s:"mesh",name:(u=X.name)!==null&&u!==void 0?u:"",upAxis:(c=(l=X.upAxis)!==null&&l!==void 0?l:X.up_axis)!==null&&c!==void 0?c:"-Y",tileset:fileURL(L,X.tileset||X.tileset_url,t)}))}else n.model.tiles&&(n.model.tiles.tileset||n.model.tiles.tileset_url)&&Q.push(Object.freeze({type:(p=n.model.tiles.type)!==null&&p!==void 0?p:"mesh",name:(f=n.model.tiles.name)!==null&&f!==void 0?f:"lod",upAxis:(h=(d=n.model.tiles.upAxis)!==null&&d!==void 0?d:n.model.tiles.up_axis)!==null&&h!==void 0?h:"-Y",tileset:fileURL(L,n.model.tiles.tileset||n.model.tiles.tileset_url,t)}));if(Array.isArray(n.model.layers))for(var Z=0,W=n.model.layers;Z<W.length;Z++){var G=W[Z];G&&(G.tileset||G.tileset_url)&&Q.push(Object.freeze({type:(g=G.type)!==null&&g!==void 0?g:"mesh",name:(A=G.name)!==null&&A!==void 0?A:"",upAxis:(m=G.upAxis)!==null&&m!==void 0?m:G.up_axis,tileset:fileURL(L,G.tileset||G.tileset_url,t)}))}Object.freeze(Q),defineProperty(N,"layers",{configurable:!1,get:function(){return Q}}),defineProperty(e,"model",{configurable:!1,get:function(){if(N.file||N.layers.length)return N}})}if(w instanceof Error)return w;var ne=new Set,$=new Set;{var ee=[];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 le=function(j){var te={getResolvedPosition:function(Ee){return Ee.copy(this.position).applyMatrix4(this.work.transform),Ee},getResolvedStandingPosition:function(Ee){return Ee.copy(this.standingPosition).applyMatrix4(this.work.transform),Ee},getResolvedQuaternion:function(Ee){return Ee.setFromRotationMatrix(scratchMatrix4$2.makeRotationFromQuaternion(this.quaternion).premultiply(this.work.transform)),Ee},getResolvedMatrix:function(Ee){return Ee.copy(this.matrix).premultiply(this.work.transform),Ee}},V=n.observers[j];if(!V)return"break";var be=re[j];if(!be)return"break";V=Object.assign({},V,be,{active:V.active!==!1&&be.active!==!1}),defineProperty(te,"work",{configurable:!1,get:function(){return e}}),defineProperty(te,"index",{configurable:!1,get:function(){return j}}),$.add(j),defineProperty(te,"panoIndex",{configurable:!1,get:function(){return j}});var fe=panoStringify({workCode:e.workCode,panoIndex:j});ne.add(fe),defineProperty(te,"panoId",{configurable:!1,get:function(){return fe}});var ve=Object.freeze({workCode:e.workCode,panoIndex:j});defineProperty(te,"pano",{configurable:!1,get:function(){return ve}});var Ve=V.active!==!1;defineProperty(te,"active",{configurable:!1,get:function(){return Ve}});var rt=V.loadable===!0;defineProperty(te,"loadable",{configurable:!1,get:function(){return rt}});var We=V.derived_id;defineProperty(te,"derivedId",{configurable:!1,get:function(){return We}});var me=V.derived_id_str;defineProperty(te,"derivedIdStr",{configurable:!1,get:function(){return me}});var ie=(_=(b=(v=(E=n.panorama)===null||E===void 0?void 0:E.pano_high_cube_base_url)!==null&&v!==void 0?v:(y=n.panorama)===null||y===void 0?void 0:y.pano_cube_base_url)!==null&&b!==void 0?b:(T=n.panorama)===null||T===void 0?void 0:T.base_url)!==null&&_!==void 0?_:"",he={up:panoURL(L,ie,V.images?V.images.up:V.up,j,t),down:panoURL(L,ie,V.images?V.images.down:V.down,j,t),right:panoURL(L,ie,V.images?V.images.right:V.right,j,t),left:panoURL(L,ie,V.images?V.images.left:V.left,j,t),front:panoURL(L,ie,V.images?V.images.front:V.front,j,t),back:panoURL(L,ie,V.images?V.images.back:V.back,j,t)};if(V.size_list)he.sizeList=V.size_list.slice();else{var Ce=getImageSizeFromURL(he.up);if(Ce&&(he.sizeList=[Ce],V.tiles))for(var _e=V.tiles.slice().sort(function(Ee,$e){return Ee-$e}).map(function(Ee){return 512*Math.pow(2,Ee)}),Ie=0,Fe=_e;Ie<Fe.length;Ie++){var Ae=Fe[Ie];Ae>Ce&&he.sizeList.push(Ae)}}var Te=void 0;if(V.images)Te=V.images.tiles;else if(Array.isArray(V.size_list)){var we=V.size_list.slice().sort(function(Ee,$e){return Ee-$e});if(we[0]){var Pe=getTileLevel(we[0]);if(Pe)for(var qe=Pe-1;qe>=0;qe--)we.unshift(512*Math.pow(2,qe));Te=we}}else if(Array.isArray(V.tiles)){if(Te=V.tiles.slice(),typeof Te[0]=="number"){for(var ke=Te[0];--ke>=0;)Te.unshift(ke);Te=Te.sort(function(Ee,$e){return Ee-$e}).map(function(Ee){return 512*Math.pow(2,Ee)})}}else if(he.sizeList){var we=he.sizeList.slice().sort(function($e,bt){return $e-bt});if(we[0]){var Pe=getTileLevel(we[0]);if(Pe)for(var qe=Pe-1;qe>=0;qe--)we.unshift(512*Math.pow(2,qe));Te=we}}if(Te){for(var Ne=[],Le=0,Ue=Te;Le<Ue.length;Le++){var Ae=Ue[Le];if(typeof Ae=="number"){var ze=getTileLevel(Ae);if(typeof ze!="number")continue;var je=getImageSizeFromURL(he.front);if(!je)continue;if(Ae>je){var Se=replaceImageSize(he.up,Ae),Oe=replaceImageSize(he.down,Ae),Me=replaceImageSize(he.right,Ae),He=replaceImageSize(he.left,Ae),Be=replaceImageSize(he.front,Ae),Ge=replaceImageSize(he.back,Ae);Ne.push(Object.freeze({level:ze,size:Ae,scale:1,up:Se,down:Oe,right:Me,left:He,front:Be,back:Ge}))}else{var Se=he.up,Oe=he.down,Me=he.right,He=he.left,Be=he.front,Ge=he.back;Ne.push(Object.freeze({level:ze,size:je,scale:Ae/je,up:Se,down:Oe,right:Me,left:He,front:Be,back:Ge}))}}else{var ze=Ae.level;if(typeof ze!="number")continue;var Ce=Ae.size;if(typeof Ce!="number")continue;var Se=panoURL(L,ie,Ae.up,j,t),Oe=panoURL(L,ie,Ae.down,j,t),Me=panoURL(L,ie,Ae.right,j,t),He=panoURL(L,ie,Ae.left,j,t),Be=panoURL(L,ie,Ae.front,j,t),Ge=panoURL(L,ie,Ae.back,j,t);Ne.push(Object.freeze({level:ze,size:Ce,scale:(S=Ae.scale)!==null&&S!==void 0?S:1,up:Se,down:Oe,right:Me,left:He,front:Be,back:Ge}))}}Ne=sortTile(Ne),Object.freeze(Ne),defineProperty(he,"tiles",{configurable:!1,get:function(){return Ne}})}Object.freeze(he),defineProperty(te,"images",{configurable:!1,get:function(){return he}});var Ze=new THREE__namespace.Vector3;if(V.position instanceof THREE__namespace.Vector3)Ze.copy(V.position);else if(Array.isArray(V.position))Ze.fromArray(V.position);else return"break";Object.freeze(Ze),e.observerBox.expandByPoint(Ze),defineProperty(te,"position",{configurable:!1,get:function(){return Ze}});var Ye=new THREE__namespace.Vector3;if(V.standingPosition instanceof THREE__namespace.Vector3)Ye.copy(V.standingPosition);else if(Array.isArray(V.standingPosition))Ye.fromArray(V.standingPosition);else if(V.standing_position instanceof THREE__namespace.Vector3)Ye.copy(V.standing_position);else if(Array.isArray(V.standing_position))Ye.fromArray(V.standing_position);else return"break";Object.freeze(Ye),e.observerBox.expandByPoint(Ye),defineProperty(te,"standingPosition",{configurable:!1,get:function(){return Ye}});var Qe=new THREE__namespace.Quaternion;if(V.quaternion instanceof THREE__namespace.Quaternion)Qe.copy(V.quaternion);else if(Array.isArray(V.quaternion))Qe.fromArray(V.quaternion);else if(V.quaternion){var ye=V.quaternion,Ct=ye.x,vt=ye.y,it=ye.z,Je=ye.w;Qe.set(Ct,vt,it,Je)}else return"break";Object.freeze(Qe),defineProperty(te,"quaternion",{configurable:!1,get:function(){return Qe}});var pt=new THREE__namespace.Matrix4().compose(Ze,Qe,PANO_TEXTURE_SCALE);Object.freeze(pt),defineProperty(te,"matrix",{configurable:!1,get:function(){return pt}});var nt=0;isNumber(V.floorIndex)?nt=V.floorIndex:isNumber(V.floor_index)?nt=V.floor_index:isNumber(V.floor)&&(nt=V.floor),defineProperty(te,"floorIndex",{configurable:!1,get:function(){return nt}});var Ke;V.video&&(Ke={source:"",matrix:new THREE__namespace.Matrix4,size:new THREE__namespace.Vector2},typeof V.video.source=="string"&&(Ke.source=V.video.source),V.video.matrix instanceof THREE__namespace.Matrix4?Ke.matrix.copy(V.video.matrix):Array.isArray(V.video.matrix)&&Ke.matrix.fromArray(V.video.matrix),V.video.size instanceof THREE__namespace.Vector2?Ke.size.copy(V.video.size):Array.isArray(V.video.size)&&Ke.size.fromArray(V.video.size),Object.freeze(Ke)),defineProperty(te,"video",{configurable:!1,get:function(){return Ke}}),Array.isArray(V.accessibleNodes)?(te.accessibleNodes=V.accessibleNodes.slice(),te.accessibleIds=V.accessibleNodes.map(function(Ee){return panoStringify({workCode:e.workCode,panoIndex:Ee})})):Array.isArray(V.accessible_nodes)&&(te.accessibleNodes=V.accessible_nodes.slice(),te.accessibleIds=V.accessible_nodes.map(function(Ee){return panoStringify({workCode:e.workCode,panoIndex:Ee})})),Array.isArray(V.visibleNodes)?(te.visibleNodes=V.visibleNodes.slice(),te.visibleIds=V.visibleNodes.map(function(Ee){return panoStringify({workCode:e.workCode,panoIndex:Ee})})):Array.isArray(V.visible_nodes)&&(te.visibleNodes=V.visible_nodes.slice(),te.visibleIds=V.visible_nodes.map(function(Ee){return panoStringify({workCode:e.workCode,panoIndex:Ee})})),ee[j]=te},ae=0;ae<n.observers.length;ae++){var oe=le(ae);if(oe==="break")break}}for(var se=function(j){if(j.accessibleIds){var be=j.accessibleIds.filter(function(ie){return ne.has(ie)});Object.freeze(be),defineProperty(j,"accessibleIds",{configurable:!1,get:function(){return be}})}else{for(var te=[],V=0;V<ee.length;V++)ee[V]!==j&&(Math.abs(ee[V].position.y-j.position.y)>3||ee[V].position.distanceTo(j.position)>10||te.push(ee[V].panoId));Object.freeze(te),defineProperty(j,"accessibleIds",{configurable:!1,get:function(){return te}})}if(j.accessibleNodes){var ve=j.accessibleNodes.filter(function(ie){return $.has(ie)});Object.freeze(ve),defineProperty(j,"accessibleNodes",{configurable:!1,get:function(){return ve}})}else{for(var fe=[],V=0;V<ee.length;V++)ee[V]!==j&&(Math.abs(ee[V].position.y-j.position.y)>3||ee[V].position.distanceTo(j.position)>10||fe.push(ee[V].panoIndex));Object.freeze(fe),defineProperty(j,"accessibleNodes",{configurable:!1,get:function(){return fe}})}if(j.visibleIds){var rt=j.visibleIds.filter(function(ie){return ne.has(ie)});Object.freeze(rt),defineProperty(j,"visibleIds",{configurable:!1,get:function(){return rt}})}else{var Ve=j.accessibleIds.slice();Object.freeze(Ve),defineProperty(j,"visibleIds",{configurable:!1,get:function(){return Ve}})}if(j.visibleNodes){var me=j.visibleNodes.filter(function(ie){return $.has(ie)});Object.freeze(me),defineProperty(j,"visibleNodes",{configurable:!1,get:function(){return me}})}else{var We=j.accessibleNodes.slice();Object.freeze(We),defineProperty(j,"visibleNodes",{configurable:!1,get:function(){return We}})}},pe=0,de=ee;pe<de.length;pe++){var xe=de[pe];se(xe)}Object.freeze(ee),defineProperty(e,"observers",{configurable:!1,get:function(){return ee}})}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 Re=[0,0,0].map(function(j,te){var V=Number(n.initial.offset[te]);return isNaN(V)||!isFinite(V)?0:V});e.initial.offset=new THREE__namespace.Vector3().fromArray(Re)}else typeof n.initial.offset=="object"&&typeof n.initial.offset.x=="number"&&typeof n.initial.offset.y=="number"&&typeof n.initial.offset.z=="number"&&(e.initial.offset=new THREE__namespace.Vector3(n.initial.offset.x,n.initial.offset.y,n.initial.offset.z));!e.initial.mode&&typeof e.initial.panoIndex=="number"&&(e.initial.mode="Panorama")}return w instanceof Error?w:(workRawMapping.set(e,{works:M,options:R}),e)}function parseNull(n,t){return t.issuer="null",deepFreeze(t),workRawMapping.set(t,{works:["null"],options:"{}"}),t}function parsePanoWork(n,t){var e;t.issuer="null",t.allowHosts=["*"],t.workCode=(e=n.code)!==null&&e!==void 0?e:createUuid();var r=[n.size],o=[],s=getTileLevel(r[0]);if(s)for(var u=s-1;u>=0;u--)r.unshift(512*Math.pow(2,u));for(var l=0,c=r;l<c.length;l++){var p=c[l],f=getTileLevel(p);f&&o.push({level:f,size:n.size,scale:p/n.size,up:n.up,down:n.down,right:n.right,left:n.left,front:n.front,back:n.back})}var d={up:n.up,down:n.down,right:n.right,left:n.left,front:n.front,back:n.back,sizeList:r};o&&(d.tiles=o);var h=new THREE__namespace.Vector3(0,1.5,0),g=new THREE__namespace.Quaternion(0,1,0,0),A=new THREE__namespace.Vector3(0,0,0),m=new THREE__namespace.Matrix4().compose(h,g,PANO_TEXTURE_SCALE),E={work:t,accessibleIds:[],accessibleNodes:[],visibleIds:[],visibleNodes:[],active:!0,floorIndex:0,images:d,index:0,loadable:!1,pano:{workCode:t.workCode,panoIndex:0},panoId:"".concat(t.workCode,"[0]"),panoIndex:0,position:h,quaternion:g,standingPosition:A,matrix:m,getResolvedPosition:function(v){return v.copy(this.position).applyMatrix4(this.work.transform),v},getResolvedStandingPosition:function(v){return v.copy(this.standingPosition).applyMatrix4(this.work.transform),v},getResolvedQuaternion:function(v){return v.setFromRotationMatrix(scratchMatrix4$2.makeRotationFromQuaternion(this.quaternion).premultiply(this.work.transform)),v},getResolvedMatrix:function(v){return v.copy(this.matrix).premultiply(this.work.transform),v}};return t.observers=[E],deepFreeze(t),workRawMapping.set(t,{works:[JSON.stringify(n)],options:"{}"}),t}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+`
|
|
1026
|
+
`+JSON.stringify(t))}else parseNull(t,this)}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:"",p=l.join(".");s=pathJoin(n,sha256(c))+(p?"."+p:"")}var f=s.replace(n,"");return r.baseURL&&(s=pathJoin(r.baseURL,f)),r.traverseResource&&r.traverseResource({origin:t,absolute:s,relative:f,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,p,f,d,h,g,A,m,E,v,y,b,T,_,S,R=JSON.stringify(t),M=[],H=0,B=[].concat(n);H<B.length;H++){var C=B[H];C instanceof Work?M.push.apply(M,C.raw.works):typeof C=="string"?M.push(C):M.push(JSON.stringify(C))}var w=verify(M);if(w instanceof Error)return w;Array.isArray(t.transform)?e.transform.fromArray(t.transform):t.transform&&e.transform.copy(t.transform),n=M.map(function(X){return JSON.parse(X)}).reduce(function(X,ne){return deepMerge(X,ne)}),defineProperty(e,"raw",{configurable:!1,get:function(){return{works:M,options:R}}});{var I;if(t.workCode&&(typeof t.workCode=="string"?I=t.workCode:typeof t.workCode=="function"&&(I=t.workCode(n))),typeof I=="undefined"&&(I=String(n.resource_code||n.basic_code||n.vr_code||n.code||n.project_id||n.work_code||n.workCode)),typeof I=="undefined")return new Error("WorkCode never matched.");defineProperty(e,"workCode",{configurable:!1,get:function(){return I}})}{var O=String(n.name);defineProperty(e,"name",{configurable:!1,get:function(){return O}})}if(w instanceof Error)return w;defineProperty(e,"issuer",{configurable:!1,get:function(){return w.issuer}}),defineProperty(e,"expire",{configurable:!1,get:function(){return w.expire}}),defineProperty(e,"allowHosts",{configurable:!1,get:function(){return w.allowHosts}});var L=(r=n.base_url)!==null&&r!==void 0?r:"";if(L&&L[L.length-1]!=="/"&&(L+="/"),e.baseURL=(o=t.baseURL)!==null&&o!==void 0?o:L,w instanceof Error)return w;if(n.model){var N={work:e,layers:[]},z;n.model.file?z=fileURL(L,n.model.file,t):n.model.file_url&&(z=fileURL(L,n.model.file_url,t)),defineProperty(N,"file",{configurable:!1,get:function(){return z}});var J;n.model.textureBase?J=textureURL$1(L,"",n.model.textureBase,t):n.model.material_base_url?J=textureURL$1(L,"",n.model.material_base_url,t):N.file&&(J=N.file.split("/").slice(0,-1).join("/").replace("/model/","/materials/")),defineProperty(N,"textureBase",{configurable:!1,get:function(){return J}});var G;Array.isArray(n.model.textures)?(G=n.model.textures.map(function(X){var ne,V;return textureURL$1(L,X,(V=(ne=n.model.textureBase)!==null&&ne!==void 0?ne:n.model.material_base_url)!==null&&V!==void 0?V:"",t)}),Object.freeze(G)):Array.isArray(n.model.material_textures)&&(G=n.model.material_textures.map(function(X){var ne,V;return textureURL$1(L,X,(V=(ne=n.model.textureBase)!==null&&ne!==void 0?ne:n.model.material_base_url)!==null&&V!==void 0?V:"",t)}),Object.freeze(G)),defineProperty(N,"textures",{configurable:!1,get:function(){return G}});var Q=[];if(Array.isArray(n.model.tiles))for(var U=0,q=n.model.tiles;U<q.length;U++){var K=q[U];K&&(K.tileset||K.tileset_url)&&Q.push(Object.freeze({type:(s=K.type)!==null&&s!==void 0?s:"mesh",name:(u=K.name)!==null&&u!==void 0?u:"",upAxis:(c=(l=K.upAxis)!==null&&l!==void 0?l:K.up_axis)!==null&&c!==void 0?c:"-Y",tileset:fileURL(L,K.tileset||K.tileset_url,t)}))}else n.model.tiles&&(n.model.tiles.tileset||n.model.tiles.tileset_url)&&Q.push(Object.freeze({type:(p=n.model.tiles.type)!==null&&p!==void 0?p:"mesh",name:(f=n.model.tiles.name)!==null&&f!==void 0?f:"lod",upAxis:(h=(d=n.model.tiles.upAxis)!==null&&d!==void 0?d:n.model.tiles.up_axis)!==null&&h!==void 0?h:"-Y",tileset:fileURL(L,n.model.tiles.tileset||n.model.tiles.tileset_url,t)}));if(Array.isArray(n.model.layers))for(var Y=0,Z=n.model.layers;Y<Z.length;Y++){var te=Z[Y];te&&(te.tileset||te.tileset_url)&&Q.push(Object.freeze({type:(g=te.type)!==null&&g!==void 0?g:"mesh",name:(A=te.name)!==null&&A!==void 0?A:"",upAxis:(m=te.upAxis)!==null&&m!==void 0?m:te.up_axis,tileset:fileURL(L,te.tileset||te.tileset_url,t)}))}Object.freeze(Q),defineProperty(N,"layers",{configurable:!1,get:function(){return Q}}),defineProperty(e,"model",{configurable:!1,get:function(){if(N.file||N.layers.length)return N}})}if(w instanceof Error)return w;var j=new Set,ee=new Set;{var W=[];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 le=function(X){var ne={getResolvedPosition:function(ye){return ye.copy(this.position).applyMatrix4(this.work.transform),ye},getResolvedStandingPosition:function(ye){return ye.copy(this.standingPosition).applyMatrix4(this.work.transform),ye},getResolvedQuaternion:function(ye){return ye.setFromRotationMatrix(scratchMatrix4$2.makeRotationFromQuaternion(this.quaternion).premultiply(this.work.transform)),ye},getResolvedMatrix:function(ye){return ye.copy(this.matrix).premultiply(this.work.transform),ye}},V=n.observers[X];if(!V)return"break";var Ee=re[X];if(!Ee)return"break";V=Object.assign({},V,Ee,{active:V.active!==!1&&Ee.active!==!1}),defineProperty(ne,"work",{configurable:!1,get:function(){return e}}),defineProperty(ne,"index",{configurable:!1,get:function(){return X}}),ee.add(X),defineProperty(ne,"panoIndex",{configurable:!1,get:function(){return X}});var fe=panoStringify({workCode:e.workCode,panoIndex:X});j.add(fe),defineProperty(ne,"panoId",{configurable:!1,get:function(){return fe}});var he=Object.freeze({workCode:e.workCode,panoIndex:X});defineProperty(ne,"pano",{configurable:!1,get:function(){return he}});var Ne=V.active!==!1;defineProperty(ne,"active",{configurable:!1,get:function(){return Ne}});var rt=V.loadable===!0;defineProperty(ne,"loadable",{configurable:!1,get:function(){return rt}});var Ye=V.derived_id;defineProperty(ne,"derivedId",{configurable:!1,get:function(){return Ye}});var ge=V.derived_id_str;defineProperty(ne,"derivedIdStr",{configurable:!1,get:function(){return ge}});var ie=(_=(b=(v=(E=n.panorama)===null||E===void 0?void 0:E.pano_high_cube_base_url)!==null&&v!==void 0?v:(y=n.panorama)===null||y===void 0?void 0:y.pano_cube_base_url)!==null&&b!==void 0?b:(T=n.panorama)===null||T===void 0?void 0:T.base_url)!==null&&_!==void 0?_:"",de={up:panoURL(L,ie,V.images?V.images.up:V.up,X,t),down:panoURL(L,ie,V.images?V.images.down:V.down,X,t),right:panoURL(L,ie,V.images?V.images.right:V.right,X,t),left:panoURL(L,ie,V.images?V.images.left:V.left,X,t),front:panoURL(L,ie,V.images?V.images.front:V.front,X,t),back:panoURL(L,ie,V.images?V.images.back:V.back,X,t)};if(V.size_list)de.sizeList=V.size_list.slice();else{var Ce=getImageSizeFromURL(de.up);if(Ce&&(de.sizeList=[Ce],V.tiles))for(var Se=V.tiles.slice().sort(function(ye,tt){return ye-tt}).map(function(ye){return 512*Math.pow(2,ye)}),Be=0,Le=Se;Be<Le.length;Be++){var be=Le[Be];be>Ce&&de.sizeList.push(be)}}var Me=void 0;if(V.images)Me=V.images.tiles;else if(Array.isArray(V.size_list)){var we=V.size_list.slice().sort(function(ye,tt){return ye-tt});if(we[0]){var Pe=getTileLevel(we[0]);if(Pe)for(var ze=Pe-1;ze>=0;ze--)we.unshift(512*Math.pow(2,ze));Me=we}}else if(Array.isArray(V.tiles)){if(Me=V.tiles.slice(),typeof Me[0]=="number"){for(var Ge=Me[0];--Ge>=0;)Me.unshift(Ge);Me=Me.sort(function(ye,tt){return ye-tt}).map(function(ye){return 512*Math.pow(2,ye)})}}else if(de.sizeList){var we=de.sizeList.slice().sort(function(tt,Et){return tt-Et});if(we[0]){var Pe=getTileLevel(we[0]);if(Pe)for(var ze=Pe-1;ze>=0;ze--)we.unshift(512*Math.pow(2,ze));Me=we}}if(Me){for(var He=[],Ve=0,$e=Me;Ve<$e.length;Ve++){var be=$e[Ve];if(typeof be=="number"){var Ie=getTileLevel(be);if(typeof Ie!="number")continue;var je=getImageSizeFromURL(de.front);if(!je)continue;if(be>je){var xe=replaceImageSize(de.up,be),We=replaceImageSize(de.down,be),_e=replaceImageSize(de.right,be),Oe=replaceImageSize(de.left,be),Fe=replaceImageSize(de.front,be),qe=replaceImageSize(de.back,be);He.push(Object.freeze({level:Ie,size:be,scale:1,up:xe,down:We,right:_e,left:Oe,front:Fe,back:qe}))}else{var xe=de.up,We=de.down,_e=de.right,Oe=de.left,Fe=de.front,qe=de.back;He.push(Object.freeze({level:Ie,size:je,scale:be/je,up:xe,down:We,right:_e,left:Oe,front:Fe,back:qe}))}}else{var Ie=be.level;if(typeof Ie!="number")continue;var Ce=be.size;if(typeof Ce!="number")continue;var xe=panoURL(L,ie,be.up,X,t),We=panoURL(L,ie,be.down,X,t),_e=panoURL(L,ie,be.right,X,t),Oe=panoURL(L,ie,be.left,X,t),Fe=panoURL(L,ie,be.front,X,t),qe=panoURL(L,ie,be.back,X,t);He.push(Object.freeze({level:Ie,size:Ce,scale:(S=be.scale)!==null&&S!==void 0?S:1,up:xe,down:We,right:_e,left:Oe,front:Fe,back:qe}))}}He=sortTile(He),Object.freeze(He),defineProperty(de,"tiles",{configurable:!1,get:function(){return He}})}Object.freeze(de),defineProperty(ne,"images",{configurable:!1,get:function(){return de}});var nt=new THREE__namespace.Vector3;if(V.position instanceof THREE__namespace.Vector3)nt.copy(V.position);else if(Array.isArray(V.position))nt.fromArray(V.position);else return"break";Object.freeze(nt),e.observerBox.expandByPoint(nt),defineProperty(ne,"position",{configurable:!1,get:function(){return nt}});var Ze=new THREE__namespace.Vector3;if(V.standingPosition instanceof THREE__namespace.Vector3)Ze.copy(V.standingPosition);else if(Array.isArray(V.standingPosition))Ze.fromArray(V.standingPosition);else if(V.standing_position instanceof THREE__namespace.Vector3)Ze.copy(V.standing_position);else if(Array.isArray(V.standing_position))Ze.fromArray(V.standing_position);else return"break";Object.freeze(Ze),e.observerBox.expandByPoint(Ze),defineProperty(ne,"standingPosition",{configurable:!1,get:function(){return Ze}});var ut=new THREE__namespace.Quaternion;if(V.quaternion instanceof THREE__namespace.Quaternion)ut.copy(V.quaternion);else if(Array.isArray(V.quaternion))ut.fromArray(V.quaternion);else if(V.quaternion){var Ue=V.quaternion,Re=Ue.x,yt=Ue.y,at=Ue.z,Ke=Ue.w;ut.set(Re,yt,at,Ke)}else return"break";Object.freeze(ut),defineProperty(ne,"quaternion",{configurable:!1,get:function(){return ut}});var lt=new THREE__namespace.Matrix4().compose(nt,ut,PANO_TEXTURE_SCALE);Object.freeze(lt),defineProperty(ne,"matrix",{configurable:!1,get:function(){return lt}});var pt=0;isNumber(V.floorIndex)?pt=V.floorIndex:isNumber(V.floor_index)?pt=V.floor_index:isNumber(V.floor)&&(pt=V.floor),defineProperty(ne,"floorIndex",{configurable:!1,get:function(){return pt}});var Qe;V.video&&(Qe={source:"",matrix:new THREE__namespace.Matrix4,size:new THREE__namespace.Vector2},typeof V.video.source=="string"&&(Qe.source=V.video.source),V.video.matrix instanceof THREE__namespace.Matrix4?Qe.matrix.copy(V.video.matrix):Array.isArray(V.video.matrix)&&Qe.matrix.fromArray(V.video.matrix),V.video.size instanceof THREE__namespace.Vector2?Qe.size.copy(V.video.size):Array.isArray(V.video.size)&&Qe.size.fromArray(V.video.size),Object.freeze(Qe)),defineProperty(ne,"video",{configurable:!1,get:function(){return Qe}}),Array.isArray(V.accessibleNodes)?(ne.accessibleNodes=V.accessibleNodes.slice(),ne.accessibleIds=V.accessibleNodes.map(function(ye){return panoStringify({workCode:e.workCode,panoIndex:ye})})):Array.isArray(V.accessible_nodes)&&(ne.accessibleNodes=V.accessible_nodes.slice(),ne.accessibleIds=V.accessible_nodes.map(function(ye){return panoStringify({workCode:e.workCode,panoIndex:ye})})),Array.isArray(V.visibleNodes)?(ne.visibleNodes=V.visibleNodes.slice(),ne.visibleIds=V.visibleNodes.map(function(ye){return panoStringify({workCode:e.workCode,panoIndex:ye})})):Array.isArray(V.visible_nodes)&&(ne.visibleNodes=V.visible_nodes.slice(),ne.visibleIds=V.visible_nodes.map(function(ye){return panoStringify({workCode:e.workCode,panoIndex:ye})})),W[X]=ne},ae=0;ae<n.observers.length;ae++){var oe=le(ae);if(oe==="break")break}}for(var se=function(X){if(X.accessibleIds){var Ee=X.accessibleIds.filter(function(ie){return j.has(ie)});Object.freeze(Ee),defineProperty(X,"accessibleIds",{configurable:!1,get:function(){return Ee}})}else{for(var ne=[],V=0;V<W.length;V++)W[V]!==X&&(Math.abs(W[V].position.y-X.position.y)>3||W[V].position.distanceTo(X.position)>10||ne.push(W[V].panoId));Object.freeze(ne),defineProperty(X,"accessibleIds",{configurable:!1,get:function(){return ne}})}if(X.accessibleNodes){var he=X.accessibleNodes.filter(function(ie){return ee.has(ie)});Object.freeze(he),defineProperty(X,"accessibleNodes",{configurable:!1,get:function(){return he}})}else{for(var fe=[],V=0;V<W.length;V++)W[V]!==X&&(Math.abs(W[V].position.y-X.position.y)>3||W[V].position.distanceTo(X.position)>10||fe.push(W[V].panoIndex));Object.freeze(fe),defineProperty(X,"accessibleNodes",{configurable:!1,get:function(){return fe}})}if(X.visibleIds){var rt=X.visibleIds.filter(function(ie){return j.has(ie)});Object.freeze(rt),defineProperty(X,"visibleIds",{configurable:!1,get:function(){return rt}})}else{var Ne=X.accessibleIds.slice();Object.freeze(Ne),defineProperty(X,"visibleIds",{configurable:!1,get:function(){return Ne}})}if(X.visibleNodes){var ge=X.visibleNodes.filter(function(ie){return ee.has(ie)});Object.freeze(ge),defineProperty(X,"visibleNodes",{configurable:!1,get:function(){return ge}})}else{var Ye=X.accessibleNodes.slice();Object.freeze(Ye),defineProperty(X,"visibleNodes",{configurable:!1,get:function(){return Ye}})}},ce=0,ve=W;ce<ve.length;ce++){var Te=ve[ce];se(Te)}Object.freeze(W),defineProperty(e,"observers",{configurable:!1,get:function(){return W}})}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 pe=void 0;isNumber(n.initial.panoIndex)?pe=n.initial.panoIndex:isNumber(n.initial.pano_index)?pe=n.initial.pano_index:isNumber(n.initial.pano)&&(pe=n.initial.pano),typeof pe=="number"&&(pe=clamp$1(pe,0,e.observers.length-1),e.initial.panoIndex=pe)}if(isNumber(n.initial.distance)&&(e.initial.distance=n.initial.distance),Array.isArray(n.initial.offset)){var me=[0,0,0].map(function(X,ne){var V=Number(n.initial.offset[ne]);return isNaN(V)||!isFinite(V)?0:V});e.initial.offset=new THREE__namespace.Vector3().fromArray(me)}else typeof n.initial.offset=="object"&&typeof n.initial.offset.x=="number"&&typeof n.initial.offset.y=="number"&&typeof n.initial.offset.z=="number"&&(e.initial.offset=new THREE__namespace.Vector3(n.initial.offset.x,n.initial.offset.y,n.initial.offset.z));!e.initial.mode&&typeof e.initial.panoIndex=="number"&&(e.initial.mode="Panorama")}return w instanceof Error?w:(workRawMapping.set(e,{works:M,options:R}),e)}function parseNull(n,t){return t.issuer="null",deepFreeze(t),workRawMapping.set(t,{works:["null"],options:"{}"}),t}function parsePanoWork(n,t){var e;t.issuer="null",t.allowHosts=["*"],t.workCode=(e=n.code)!==null&&e!==void 0?e:createUuid();var r=[n.size],o=[],s=getTileLevel(r[0]);if(s)for(var u=s-1;u>=0;u--)r.unshift(512*Math.pow(2,u));for(var l=0,c=r;l<c.length;l++){var p=c[l],f=getTileLevel(p);f&&o.push({level:f,size:n.size,scale:p/n.size,up:n.up,down:n.down,right:n.right,left:n.left,front:n.front,back:n.back})}var d={up:n.up,down:n.down,right:n.right,left:n.left,front:n.front,back:n.back,sizeList:r};o&&(d.tiles=o);var h=new THREE__namespace.Vector3(0,1.5,0),g=new THREE__namespace.Quaternion(0,1,0,0),A=new THREE__namespace.Vector3(0,0,0),m=new THREE__namespace.Matrix4().compose(h,g,PANO_TEXTURE_SCALE),E={work:t,accessibleIds:[],accessibleNodes:[],visibleIds:[],visibleNodes:[],active:!0,floorIndex:0,images:d,index:0,loadable:!1,pano:{workCode:t.workCode,panoIndex:0},panoId:"".concat(t.workCode,"[0]"),panoIndex:0,position:h,quaternion:g,standingPosition:A,matrix:m,getResolvedPosition:function(v){return v.copy(this.position).applyMatrix4(this.work.transform),v},getResolvedStandingPosition:function(v){return v.copy(this.standingPosition).applyMatrix4(this.work.transform),v},getResolvedQuaternion:function(v){return v.setFromRotationMatrix(scratchMatrix4$2.makeRotationFromQuaternion(this.quaternion).premultiply(this.work.transform)),v},getResolvedMatrix:function(v){return v.copy(this.matrix).premultiply(this.work.transform),v}};return t.observers=[E],deepFreeze(t),workRawMapping.set(t,{works:[JSON.stringify(n)],options:"{}"}),t}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+`
|
|
1027
1027
|
Error work input:
|
|
1028
|
-
`+JSON.stringify(n))}}function createWorks(n){for(var t={},e=new THREE__namespace.Box3,r=[],o={},s=0,u=n;s<u.length;s++){var l=u[s],c=t[l.workCode];c||(c=t[l.workCode]=new THREE__namespace.Matrix4().copy(l.transform));for(var p=0,f=l.observers;p<f.length;p++){var d=f[p],h={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:d.getResolvedPosition(new THREE__namespace.Vector3),standingPosition:d.getResolvedStandingPosition(new THREE__namespace.Vector3),quaternion:d.getResolvedQuaternion(new THREE__namespace.Quaternion),matrix:d.getResolvedMatrix(new THREE__namespace.Matrix4)};Object.freeze(h),r.push(h),o[h.panoId]=h}scratchObserverBox$1.copy(l.observerBox).applyMatrix4(l.transform),e.union(scratchObserverBox$1)}Object.freeze(r);for(var g=n.slice(),A={},m=0,E=g;m<E.length;m++){var l=E[m];A[l.workCode]=l}return Object.freeze(Object.assign(g,{get initial(){return g.length>0?g[0].initial:{work:{}}},get resolvedObservers(){return r},get resolvedObserverBox(){return e},getWork:function(v){return A[v]},getResolvedObserver:function(v){var y,b;return isPanoId(v)?o[v]:typeof v=="number"?o[panoStringify({workCode:(b=(y=n[0])===null||y===void 0?void 0:y.workCode)!==null&&b!==void 0?b:"",panoIndex:v})]:o[panoStringify(v)]},update:function(){for(var v=0,y=g;v<y.length;v++){var b=y[v],T=b.transform,_=t[b.workCode];_?_.equals(T)||(_.copy(T),needsUpdateWorkCodeSet.add(b.workCode)):(t[b.workCode]=new THREE__namespace.Matrix4().copy(T),needsUpdateWorkCodeSet.add(b.workCode))}if(needsUpdateWorkCodeSet.size>0){e.makeEmpty();for(var S=0,R=g;S<R.length;S++){var b=R[S];scratchObserverBox$1.copy(b.observerBox).applyMatrix4(b.transform),e.union(scratchObserverBox$1)}for(var M=0,H=r;M<H.length;M++){var B=H[M];if(needsUpdateWorkCodeSet.has(B.work.workCode)){var C=B.work.observers[B.index];C.getResolvedPosition(B.position),C.getResolvedStandingPosition(B.standingPosition),C.getResolvedQuaternion(B.quaternion),C.getResolvedMatrix(B.matrix)}}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 scratchVector3$2=new THREE__namespace.Vector3,scratchMatrix4$1=new THREE__namespace.Matrix4;function getEcefToEnuMatrixFromUpAxis(n,t,e){switch(n){case"Z":e.identity();break;case"Y":e.fromArray([1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1]);break;case"-Y":e.fromArray([1,0,0,0,0,0,-1,0,0,1,0,0,0,0,0,1]);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""}function loadViewLayer(n,t){var e,r=n.tileset,o=n.name,s=n.type,u=r.split("#"),l=u[0],c=u[1],p=(e=(c||l).split("?")[1])!==null&&e!==void 0?e:"";return t.fetcher.ajax(r,{responseType:"text"}).catch(function(f){return{error:f,body:JSON.stringify({asset:{version:"0.0"},geometricError:0,root:{geometricError:0}})}}).then(function(f){var d,h="error"in f?f.error:null,g=normalizeTilesetHeader(JSON.parse(f.body),r),A=g.root,m=g.rootMeta,E=m===void 0?{}:m,v=n.upAxis;E.upAxis&&E.upAxis!==v&&(v=E.upAxis),"lodVersion"in g&&(v="-Y","floorInfo"in g&&(g.properties=g.properties||{},g.properties.floorInfo=g.floorInfo.map(function(R){return{ground:-R.ground,height:R.height}}),delete g.floorInfo),g.asset.tilesetVersion=String(g.lodVersion),delete g.lodVersion);var y=A.boundingVolume?makeBoundingVolume(A.boundingVolume):void 0;y&&A.transform&&y.applyMatrix4(scratchMatrix4$1.fromArray(A.transform));var b=null,T=new THREE__namespace.Matrix4,_=new THREE__namespace.Matrix4;E.coordinate?(b=E.coordinate.ground_height,T.fromArray(E.coordinate.pose_ecef_to_enu),_.fromArray(E.coordinate.pose_enu_to_ecef)):(y?y.getCenter(scratchVector3$2):scratchVector3$2.setScalar(0),getEcefToEnuMatrixFromUpAxis(v,scratchVector3$2,T),_.getInverse(T)),g.root={refine:(d=A.refine)!==null&&d!==void 0?d:"REPLACE",geometricError:A.geometricError,transform:scratchMatrix4$1.copy(T).premultiply(enuToLocalMatrix).toArray(),boundingVolume:y?y.toJson():void 0,children:[A]};var S=new Tile3D(g,{name:o,type:s,upAxis:v,light:t.light,fetcher:t.fetcher,search:p,groundHeight:b,enuToEcefMatrix:_,ecefToEnuMatrix:T,error:h});return S})}function loadViewLayers(n,t){var e,r,o=n.layers.slice();if(n.file){for(var s=!1,u=0,l=o;u<l.length;u++){var c=l[u];if(c.type==="mesh"){s=!0;break}}if(s===!1){var p=getExt(n.file)||"at3d",f=JSON.stringify({asset:{version:"0.0"},geometricError:0,root:{refine:"REPLACE",geometricError:0,transform:[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],content:{uri:n.file},extras:(e={},e[p]={textureBaseUri:n.textureBase,textureArray:n.textures,textureOptions:(r=t.textureOptions)!==null&&r!==void 0?r:{}},e)}});o.push({name:"fallback",type:"mesh",upAxis:"Z",tileset:URL.createObjectURL(new Blob([f],{type:"application/json"}))})}}return o.map(function(d){return loadViewLayer(d,{fetcher:t.fetcher,light:t.light}).then(function(h){return t.onError&&(h.error&&t.onError(h.error),h.onError=t.onError),h})})}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,p=[],f=[],d=0;d<l;d++)p[d]=new THREE__namespace.Vector3,f[d]=new THREE__namespace.Vector3;var h=new THREE__namespace.Vector3,g=new THREE__namespace.Vector3,A=new THREE__namespace.Vector3,m=new THREE__namespace.Vector2,E=new THREE__namespace.Vector2,v=new THREE__namespace.Vector2,y=new THREE__namespace.Vector3,b=new THREE__namespace.Vector3;function T(Q,U,q){h.fromArray(o,Q*3),g.fromArray(o,U*3),A.fromArray(o,q*3),m.fromArray(u,Q*2),E.fromArray(u,U*2),v.fromArray(u,q*2);var X=g.x-h.x,Z=A.x-h.x,W=g.y-h.y,G=A.y-h.y,ne=g.z-h.z,$=A.z-h.z,ee=E.x-m.x,re=v.x-m.x,le=E.y-m.y,ae=v.y-m.y,oe=1/(ee*ae-re*le);y.set((ae*X-le*Z)*oe,(ae*W-le*G)*oe,(ae*ne-le*$)*oe),b.set((ee*Z-re*X)*oe,(ee*G-re*W)*oe,(ee*$-re*ne)*oe),p[Q].add(y),p[U].add(y),p[q].add(y),f[Q].add(b),f[U].add(b),f[q].add(b)}var _=n.groups;_.length===0&&(_=[{start:0,count:r.length}]);for(var d=0,S=_.length;d<S;++d)for(var R=_[d],M=R.start,H=R.count,B=M,C=M+H;B<C;B+=3)T(r[B+0],r[B+1],r[B+2]);var w=new THREE__namespace.Vector3,I=new THREE__namespace.Vector3,O=new THREE__namespace.Vector3,L=new THREE__namespace.Vector3,N,z,J;function K(Q){O.fromArray(s,Q*3),L.copy(O),z=p[Q],w.copy(z),w.sub(O.multiplyScalar(O.dot(z))).normalize(),I.crossVectors(L,z),J=I.dot(f[Q]),N=J<0?-1:1,c[Q*4]=w.x,c[Q*4+1]=w.y,c[Q*4+2]=w.z,c[Q*4+3]=N}for(var d=0,S=_.length;d<S;++d)for(var R=_[d],M=R.start,H=R.count,B=M,C=M+H;B<C;B+=3)K(r[B+0]),K(r[B+1]),K(r[B+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,p=0;p<n.length;++p){var f=n[p];if(e!==(f.index!==null))return null;for(var d in f.attributes){if(!r.has(d))return null;s[d]===void 0&&(s[d]=[]),s[d].push(f.attributes[d])}for(var d in f.morphAttributes){if(!o.has(d))return null;u[d]===void 0&&(u[d]=[]),u[d].push(f.morphAttributes[d])}if(l.userData.mergedUserData=l.userData.mergedUserData||[],l.userData.mergedUserData.push(f.userData),t){var h;if(e)h=f.index.count;else if(f.attributes.position!==void 0)h=f.attributes.position.count;else return null;l.addGroup(c,h,p),c+=h}}if(e){for(var g=0,A=[],p=0;p<n.length;++p){for(var m=n[p].index,E=0;E<m.count;++E)A.push(m.getX(E)+g);g+=n[p].attributes.position.count}l.setIndex(A)}for(var d in s){var v=this.mergeBufferAttributes(s[d]);if(!v)return null;l.setAttribute(d,v)}for(var d in u){var y=u[d][0].length;if(y===0)break;l.morphAttributes=l.morphAttributes||{},l.morphAttributes[d]=[];for(var p=0;p<y;++p){for(var b=[],E=0;E<u[d].length;++E)b.push(u[d][E][p]);var T=this.mergeBufferAttributes(b);if(!T)return null;l.morphAttributes[d].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,p=[],f=["getX","getY","getZ","getW"],d=["setX","setY","setZ","setW"],h=0,s=n.length;h<s;h++){var u=n[h],g=u.itemSize,A=u.count,m=new THREE__namespace.InterleavedBufferAttribute(l,g,c,u.normalized);p.push(m),c+=g;for(var E=0;E<A;E++)for(var v=0;v<g;v++)m[d[v]](E,u[f[v]](E))}return p},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={},p={},f=[],d=["getX","getY","getZ","getW"],h=0,g=l.length;h<g;h++){var A=l[h];c[A]=[];var m=n.morphAttributes[A];m&&(p[A]=new Array(m.length).fill().map(function(){return[]}))}for(var E=Math.log10(1/t),v=Math.pow(10,E),h=0;h<s;h++){for(var y=r?r.getX(h):h,b="",T=0,g=l.length;T<g;T++)for(var A=l[T],_=n.getAttribute(A),S=_.itemSize,R=0;R<S;R++)b+="".concat(~~(_[d[R]](y)*v),",");if(b in e)f.push(e[b]);else{for(var T=0,g=l.length;T<g;T++)for(var A=l[T],_=n.getAttribute(A),m=n.morphAttributes[A],S=_.itemSize,M=c[A],H=p[A],R=0;R<S;R++){var B=d[R];if(M.push(_[B](y)),m)for(var C=0,w=m.length;C<w;C++)H[C].push(m[C][B](y))}e[b]=u,f.push(u),u++}}for(var I=n.clone(),h=0,g=l.length;h<g;h++){var A=l[h],O=n.getAttribute(A),L=new O.array.constructor(c[A]),_=new THREE__namespace.BufferAttribute(L,O.itemSize,O.normalized);if(I.setAttribute(A,_),A in p)for(var T=0;T<p[A].length;T++){var N=n.morphAttributes[A][T],L=new N.array.constructor(p[A][T]),z=new THREE__namespace.BufferAttribute(L,N.itemSize,N.normalized);I.morphAttributes[A][T]=z}}return I.setIndex(f),I}},scratchSphere$1=new THREE__namespace.Sphere,scratchMatrix4=new THREE__namespace.Matrix4,scratchMatrix4Inverse=new THREE__namespace.Matrix4;function getEdgesBySphere(n,t,e){e===void 0&&(e=30/180*Math.PI);for(var r=Math.cos(e),o=[],s=0,u=n.children;s<u.length;s++){var l=u[s];l instanceof Tile3D&&l.tileset.selectedTiles.forEach(function(c){var p,f,d;if(!(c.boundingVolume&&c.boundingVolume.distanceToPoint(t.center)>t.radius)){var h=(f=(p=c.content)===null||p===void 0?void 0:p.data)===null||f===void 0?void 0:f.object;if(h&&h.visible){var g=[];if(h.traverseVisible(function(U){if(U instanceof THREE__namespace.Mesh){var q=bvhMeshMap.get(U);if(q){scratchMatrix4.copy(U.matrixWorld),scratchMatrix4Inverse.getInverse(scratchMatrix4),scratchSphere$1.copy(t).applyMatrix4(scratchMatrix4Inverse);var X=q.trianglesInSphere(scratchSphere$1.center,scratchSphere$1.radius),Z=new THREE__namespace.BufferGeometry;Z.setAttribute("position",new THREE__namespace.BufferAttribute(X,3)),Z.applyMatrix4(U.matrixWorld),Z=BufferGeometryUtils.mergeVertices(Z,.01),g.push(Z)}}}),g.length===0)return;for(var A=["a","b","c"],m=BufferGeometryUtils.mergeBufferGeometries(g,!1),E=m.getAttribute("position").array,v=((d=m.getIndex())===null||d===void 0?void 0:d.array)||[],y=[],b=[],T=0,_=E.length;T<_;T+=3){var S=new THREE__namespace.Vector3(E[T],E[T+1],E[T+2]);y.push(S)}for(var T=0,_=v.length;T<_;T+=3){var R=v[T],M=v[T+1],H=v[T+2],B=new THREE__namespace.Vector3().crossVectors(y[M].clone().sub(y[R]),y[H].clone().sub(y[R])).normalize();b.push({a:R,b:M,c:H,normal:B})}for(var C={},T=0,_=b.length;T<_;T++)for(var w=b[T],I=0;I<3;I++){var O=w[A[I]],L=w[A[(I+1)%3]],N=[Math.min(O,L),Math.max(O,L)],z=N[0]+"-"+N[1];C[z]===void 0?C[z]={index1:N[0],index2:N[1],face1:T}:C[z].face2=T}for(var z in C){var J=C[z];if(J.face2===void 0||b[J.face1].normal.dot(b[J.face2].normal)<=r){var K=y[J.index1],Q=y[J.index2];o.push(new THREE__namespace.Line3(K,Q))}}y.length=0,b.length=0}}})}return o}var scratchBoundingBox$1=new THREE__namespace.Box3,scratchViewLayerBox=new THREE__namespace.Box3,scratchObserverBox=new THREE__namespace.Box3,Model=function(n){__extends(t,n);function t(e,r){r===void 0&&(r={});var o,s=n.call(this)||this;s.disposed=!1,s.parameter=new Parameter,s.outdated=!1,s.autoRefine=!0,s.metaPending=!1,s.loaded=!1,s.refined=!1,s.refineProgress=[0,0],s.boundingBox=new THREE__namespace.Box3,s.needsRender=!1,s.work=e,s.name=s.work.workCode;for(var u=0,l=0,c=e.observers;l<c.length;l++){var p=c[l];u=Math.max(u,p.floorIndex)}if(s.floorLength=u+1,e.model){s.metaPending=!0;var f=loadViewLayers(e.model,{fetcher:getFetcher(e),light:(o=r.light)!==null&&o!==void 0?o:!1,textureOptions:r.textureOptions,onError:function(d){return s.dispatchEvent({type:"error",error:d})}});s.initReady=Promise.all(f).then(function(d){if(s.metaPending=!1,d.length)if(s.disposed)for(var h=0,g=d;h<g.length;h++){var A=g[h];A.dispose()}else s.add.apply(s,d)}),s.loadedReady=new Promise(function(d){s.addEventListener("load",function(){return d()})})}else s.refined=!0,s.loaded=!0,s.initReady=Promise.resolve(),s.loadedReady=Promise.resolve();return s}return t.prototype.dispose=function(){this.disposed=!0;for(var e;e=this.children[0];)typeof e.dispose=="function"&&e.dispose(),this.remove(e)},Object.defineProperty(t.prototype,"empty",{get:function(){return this.children.length===0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"viewLayers",{get:function(){return this.children},enumerable:!1,configurable:!0}),t.prototype.getEdgesBySphere=function(e,r){return r===void 0&&(r=30/180*Math.PI),getEdgesBySphere(this,e,r)},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&&typeof c.intersectRaycaster=="function"&&c.intersectRaycaster(e,r,!1,s)}return s=s.filter(function(p){return!(p.object instanceof PBMPointCloud&&p.object.material.pointBack==="HIDDEN"&&p.face&&p.face.normal.angleTo(e.ray.direction)<Math.PI/2)}),o&&s.sort(function(p,f){return p.distance-f.distance}),s},t.prototype.update=function(e,r,o){var s=!1;this.needsRender===!0&&(this.needsRender=!1,s=!0);var u=this.loaded;this.refined=!this.metaPending,this.loaded=!this.metaPending,this.refineProgress[0]=this.refineProgress[1]=0,this.work.transform.equals(this.matrix)||(this.matrix.copy(this.work.transform),this.matrix.decompose(this.position,this.quaternion,this.scale),this.matrixAutoUpdate=!1,s=!0);for(var l=0,c=this.children;l<c.length;l++){var p=c[l];p.autoRefine=this.autoRefine;var f=p.update(e,r,o,this);f&&(s=!0),p.refined===!1&&(this.refined=!1),p.loaded===!1&&(this.loaded=!1),this.refineProgress[0]+=p.refineProgress[0],this.refineProgress[1]+=p.refineProgress[1]}scratchBoundingBox$1.makeEmpty(),scratchObserverBox.copy(this.work.observerBox),scratchObserverBox.isEmpty()||(scratchObserverBox.max.x+=1,scratchObserverBox.max.z+=1,scratchObserverBox.max.y+=1,scratchObserverBox.min.x-=1,scratchObserverBox.min.z-=1,scratchBoundingBox$1.union(scratchObserverBox));for(var d=0,h=this.viewLayers;d<h.length;d++){var p=h[d];p.boundingBox.isEmpty()||(scratchViewLayerBox.copy(p.boundingBox),scratchBoundingBox$1.union(scratchViewLayerBox))}return this.boundingBox.copy(scratchBoundingBox$1).applyMatrix4(this.matrix),u===!1&&this.loaded===!0&&this.dispatchEvent({type:"load"}),s},t.prototype.localToEnu=function(e){return e.applyMatrix4(localToEnuMatrix)},t.prototype.enuToLocal=function(e){return e.applyMatrix4(enuToLocalMatrix)},t.prototype.worldToEnu=function(e){return this.localToEnu(this.worldToLocal(e))},t.prototype.enuToWorld=function(e){return this.localToWorld(this.enuToLocal(e))},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,this.dispatchEvent({type:"changeShownFloor",shownFloor:e})},Object.defineProperty(t.prototype,"bounding",{get:function(){return this.boundingBox},enumerable:!1,configurable:!0}),t.prototype.setMaterial=function(e){this.parameter.set(e)},t.prototype.getMaterial=function(){var e,r=[];return this.parent&&this.parent.parameter instanceof Parameter&&r.unshift(this.parent.parameter),(e=this.parameter).resolveValue.apply(e,r)},Object.defineProperty(t.prototype,"shownFloorIndex",{get:function(){var e,r=[];return this.parent&&this.parent.parameter instanceof Parameter&&r.unshift(this.parent.parameter),(e=this.parameter).resolveValue.apply(e,r).shownFloorIndex},set:function(e){this.parameter.set("shownFloorIndex",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"brightness",{get:function(){var e,r=[];return this.parent&&this.parent.parameter instanceof Parameter&&r.unshift(this.parent.parameter),(e=this.parameter).resolveValue.apply(e,r).brightness},set:function(e){this.parameter.set("brightness",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clippers",{get:function(){var e,r=[];return this.parent&&this.parent.parameter instanceof Parameter&&r.unshift(this.parent.parameter),(e=this.parameter).resolveValue.apply(e,r).clippers},set:function(e){this.parameter.set("clippers",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"customShaders",{get:function(){var e,r=[];return this.parent&&this.parent.parameter instanceof Parameter&&r.unshift(this.parent.parameter),(e=this.parameter).resolveValue.apply(e,r).customShaders},set:function(e){this.parameter.set("customShaders",e)},enumerable:!1,configurable:!0}),t.prototype.resetBrightness=function(){this.parameter.reset("brightness");for(var e=0,r=this.viewLayers;e<r.length;e++){var o=r[e];o.resetBrightness()}},t}(THREE__namespace.Object3D),scratchBoundingBox3=new THREE__namespace.Box3,scratchModelBoundingBox3=new THREE__namespace.Box3,ModelScene=function(n){__extends(t,n);function t(){var e=n.call(this)||this;e.needsRender=!0,e.autoRefine=!0,e.boundingBox=new THREE__namespace.Box3,e.loaded=!1,e.refined=!1,e.refineProgress=[0,0],e.parameter=new Parameter;var r=e.models=[],o=e;return defineProperty(r,"autoUpdate",{get:function(){return o.autoRefine},set:function(s){o.autoRefine=s}}),defineProperty(r,"bounding",{get:function(){return o.boundingBox}}),defineProperty(r,"loaded",{get:function(){return o.loaded}}),defineProperty(r,"refined",{get:function(){return o.refined}}),defineProperty(r,"refineProgress",{get:function(){return o.refineProgress}}),defineProperty(r,"cacheCameras",{get:function(){return o.parameter.resolveValue().cacheCameras},set:function(s){o.parameter.set("cacheCameras",s)}}),defineProperty(r,"intersectRaycaster",{value:function(s){return o.intersectRaycaster(s)}}),defineProperty(r,"setMaterial",{value:function(s){return o.setMaterial(s)}}),defineProperty(r,"getMaterial",{value:function(){return o.getMaterial()}}),defineProperty(r,"resetBrightness",{value:function(){return o.resetBrightness()}}),e}return t.prototype.add=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];n.prototype.add.apply(this,e),this.models.length=0;for(var o=0,s=this.children;o<s.length;o++){var u=s[o];u instanceof Model&&u.outdated!==!0&&this.models.push(u)}return this.needsRender=!0,this},t.prototype.remove=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];n.prototype.remove.apply(this,e),this.models.length=0;for(var o=0,s=this.children;o<s.length;o++){var u=s[o];u instanceof Model&&u.outdated!==!0&&this.models.push(u)}scratchBoundingBox3.makeEmpty();for(var l=0,c=this.children;l<c.length;l++){var u=c[l];u instanceof Model&&(scratchModelBoundingBox3.copy(u.boundingBox).applyMatrix4(u.matrix),scratchBoundingBox3.union(scratchModelBoundingBox3))}return this.boundingBox.copy(scratchBoundingBox3),this.needsRender=!0,this},t.prototype.intersectRaycaster=function(e,r,o){o===void 0&&(o=!0);var s=this.children.filter(function(d){return d instanceof Model}),u;if(s.length===0)u=[];else if(s.length===1)u=s[0].intersectRaycaster(e,r,o);else{u=[];for(var l=0,c=s;l<c.length;l++){var p=c[l];if(p.visible){var f=p.intersectRaycaster(e,r,!1);f.length&&u.push.apply(u,f)}}o&&u.sort(function(d,h){return d.distance-h.distance})}return u},t.prototype.update=function(e,r){var o=!1;scratchBoundingBox3.makeEmpty(),this.loaded=this.models.length>0,this.refined=this.models.length>0,this.refineProgress[0]=this.refineProgress[1]=0,this.models.length=0;for(var s=0,u=this.children;s<u.length;s++){var l=u[s];if(l instanceof Model)if(l.outdated){l.autoRefine=!1;var c=l.update(e,r,this);c&&(o=!0)}else{this.models.push(l),l.autoRefine=this.autoRefine;var c=l.update(e,r,this);c&&(o=!0),l.loaded===!1&&(this.loaded=!1),l.refined===!1&&(this.refined=!1),this.refineProgress[0]+=l.refineProgress[0],this.refineProgress[1]+=l.refineProgress[1],scratchModelBoundingBox3.copy(l.boundingBox),scratchBoundingBox3.union(scratchModelBoundingBox3)}else if(l.update){var c=l.update(e,r,this);c&&(o=!0)}}return this.boundingBox.copy(scratchBoundingBox3),this.needsRender=o,o},Object.defineProperty(t.prototype,"bounding",{get:function(){return this.boundingBox},enumerable:!1,configurable:!0}),t.prototype.setMaterial=function(e){this.parameter.set(e)},t.prototype.getMaterial=function(){return this.parameter.resolveValue()},t.prototype.resetBrightness=function(){this.parameter.reset("brightness");for(var e=0,r=this.models;e<r.length;e++){var o=r[e];o.resetBrightness()}},t}(THREE__namespace.Scene),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,p=e.antialias,f=p===void 0?!1:p,d=e.webgl2,h=e.logarithmicDepthBuffer,g=e.precision,A=e.powerPreference,m=this,E={antialias:f,alpha:!0,depth:!0,preserveDrawingBuffer:o,stencil:c,premultipliedAlpha:u,powerPreference:A},v={logarithmicDepthBuffer:h,precision:g};if(d){var y=document.createElement("canvas"),b=y.getContext("webgl2",E);b?m=n.call(this,__assign(__assign(__assign({},E),v),{antialias:!0,canvas:y,context:b}))||this:(console.error("error occurred when getting webgl2 canvas context, mybe webgl2 not support, fallback to webgl."),m=n.call(this,__assign(__assign({},E),v))||this)}else m=n.call(this,__assign(__assign({},E),v))||this;return m.outputEncoding=THREE__namespace.sRGBEncoding,m.autoClear=!0,m}return t}(THREE__namespace.WebGLRenderer),Clock=function(){function n(t,e){t===void 0&&(t=!0),e===void 0&&(e=!1),this.elapsedTime=0,this.autoStart=t,this.autoUpdate=e,this.running=t;var r=now();e?defineProperty(this,"currentTime",{get:function(){return now()}}):this.currentTime=r,this.startTime=r,this.oldTime=r}return n.prototype.update=function(t){this.autoUpdate||(this.currentTime=t)},n.prototype.start=function(){this.startTime=this.currentTime,this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0},n.prototype.stop=function(){this.getElapsedTime(),this.running=!1,this.autoStart=!1},n.prototype.getElapsedTime=function(){return this.getDelta(),this.elapsedTime},n.prototype.getDelta=function(){var t=0;return this.autoStart&&!this.running?(this.start(),0):(this.running&&(t=(this.currentTime-this.oldTime)/1e3,this.oldTime=this.currentTime,this.elapsedTime+=t),t)},n}(),sharedProjScreenMatrix=new THREE__namespace.Matrix4,sharedFrustum=new THREE__namespace.Frustum,renderResolution=new THREE__namespace.Vector2,clockForMixer=new WeakMap;function updateObject(n){var t=!1;return n.needsRender===!0?(n.needsRender=!1,t=!0):n.mixer&&n.mixer.stats.actions.inUse>0&&(t=!0),t}var Scene=function(n){__extends(t,n);function t(){var e=n!==null&&n.apply(this,arguments)||this;return e.needsRender=!1,e}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.prototype.update=function(e,r){var o=!1,s;return r instanceof Camera?(s=r.time,renderResolution.copy(r.resolution)):(s=now(),e.getSize(renderResolution)),sharedProjScreenMatrix.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse),sharedFrustum.setFromProjectionMatrix(sharedProjScreenMatrix),this.traverseVisible(function(u){if(u.setResolution&&u.setResolution(renderResolution.x,renderResolution.y),u.setTime&&u.setTime(s),u.mixer instanceof THREE__namespace.AnimationMixer){var l=u.mixer,c=clockForMixer.get(l);c||(c=new Clock,clockForMixer.set(l,c)),c.update(s),l.update(c.getDelta())}if((u instanceof THREE__namespace.Mesh||u instanceof THREE__namespace.Line||u instanceof THREE__namespace.Points)&&(u instanceof THREE__namespace.ImmediateRenderObject||!u.frustumCulled||sharedFrustum.intersectsObject(u))){var p=updateObject(u);p&&(o=!0),u.traverseAncestors(function(f){var d=updateObject(f);d&&(o=!0)})}}),this.needsRender=o,o},t}(THREE__namespace.Scene),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$6=`
|
|
1028
|
+
`+JSON.stringify(n))}}function createWorks(n){for(var t={},e=new THREE__namespace.Box3,r=[],o={},s=0,u=n;s<u.length;s++){var l=u[s],c=t[l.workCode];c||(c=t[l.workCode]=new THREE__namespace.Matrix4().copy(l.transform));for(var p=0,f=l.observers;p<f.length;p++){var d=f[p],h={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:d.getResolvedPosition(new THREE__namespace.Vector3),standingPosition:d.getResolvedStandingPosition(new THREE__namespace.Vector3),quaternion:d.getResolvedQuaternion(new THREE__namespace.Quaternion),matrix:d.getResolvedMatrix(new THREE__namespace.Matrix4)};Object.freeze(h),r.push(h),o[h.panoId]=h}scratchObserverBox$1.copy(l.observerBox).applyMatrix4(l.transform),e.union(scratchObserverBox$1)}Object.freeze(r);for(var g=n.slice(),A={},m=0,E=g;m<E.length;m++){var l=E[m];A[l.workCode]=l}return Object.freeze(Object.assign(g,{get initial(){return g.length>0?g[0].initial:{work:{}}},get resolvedObservers(){return r},get resolvedObserverBox(){return e},getWork:function(v){return A[v]},getResolvedObserver:function(v){var y,b;return isPanoId(v)?o[v]:typeof v=="number"?o[panoStringify({workCode:(b=(y=n[0])===null||y===void 0?void 0:y.workCode)!==null&&b!==void 0?b:"",panoIndex:v})]:o[panoStringify(v)]},update:function(){for(var v=0,y=g;v<y.length;v++){var b=y[v],T=b.transform,_=t[b.workCode];_?_.equals(T)||(_.copy(T),needsUpdateWorkCodeSet.add(b.workCode)):(t[b.workCode]=new THREE__namespace.Matrix4().copy(T),needsUpdateWorkCodeSet.add(b.workCode))}if(needsUpdateWorkCodeSet.size>0){e.makeEmpty();for(var S=0,R=g;S<R.length;S++){var b=R[S];scratchObserverBox$1.copy(b.observerBox).applyMatrix4(b.transform),e.union(scratchObserverBox$1)}for(var M=0,H=r;M<H.length;M++){var B=H[M];if(needsUpdateWorkCodeSet.has(B.work.workCode)){var C=B.work.observers[B.index];C.getResolvedPosition(B.position),C.getResolvedStandingPosition(B.standingPosition),C.getResolvedQuaternion(B.quaternion),C.getResolvedMatrix(B.matrix)}}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 scratchVector3$2=new THREE__namespace.Vector3,scratchMatrix4$1=new THREE__namespace.Matrix4;function getEcefToEnuMatrixFromUpAxis(n,t,e){switch(n){case"Z":e.identity();break;case"Y":e.fromArray([1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1]);break;case"-Y":e.fromArray([1,0,0,0,0,0,-1,0,0,1,0,0,0,0,0,1]);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""}function loadViewLayer(n,t){var e,r=n.tileset,o=n.name,s=n.type,u=r.split("#"),l=u[0],c=u[1],p=(e=(c||l).split("?")[1])!==null&&e!==void 0?e:"";return t.fetcher.ajax(r,{responseType:"text"}).catch(function(f){return{error:f,body:JSON.stringify({asset:{version:"0.0"},geometricError:0,root:{geometricError:0}})}}).then(function(f){var d,h="error"in f?f.error:null,g=normalizeTilesetHeader(JSON.parse(f.body),r),A=g.root,m=g.rootMeta,E=m===void 0?{}:m,v=n.upAxis;E.upAxis&&E.upAxis!==v&&(v=E.upAxis),"lodVersion"in g&&(v="-Y","floorInfo"in g&&(g.properties=g.properties||{},g.properties.floorInfo=g.floorInfo.map(function(R){return{ground:-R.ground,height:R.height}}),delete g.floorInfo),g.asset.tilesetVersion=String(g.lodVersion),delete g.lodVersion);var y=A.boundingVolume?makeBoundingVolume(A.boundingVolume):void 0;y&&A.transform&&y.applyMatrix4(scratchMatrix4$1.fromArray(A.transform));var b=null,T=new THREE__namespace.Matrix4,_=new THREE__namespace.Matrix4;E.coordinate?(b=E.coordinate.ground_height,T.fromArray(E.coordinate.pose_ecef_to_enu),_.fromArray(E.coordinate.pose_enu_to_ecef)):(y?y.getCenter(scratchVector3$2):scratchVector3$2.setScalar(0),getEcefToEnuMatrixFromUpAxis(v,scratchVector3$2,T),_.getInverse(T)),g.root={refine:(d=A.refine)!==null&&d!==void 0?d:"REPLACE",geometricError:A.geometricError,transform:scratchMatrix4$1.copy(T).premultiply(enuToLocalMatrix).toArray(),boundingVolume:y?y.toJson():void 0,children:[A]};var S=new Tile3D(g,{name:o,type:s,upAxis:v,light:t.light,fetcher:t.fetcher,search:p,groundHeight:b,enuToEcefMatrix:_,ecefToEnuMatrix:T,error:h});return S})}function loadViewLayers(n,t){var e,r,o=n.layers.slice();if(n.file){for(var s=!1,u=0,l=o;u<l.length;u++){var c=l[u];if(c.type==="mesh"){s=!0;break}}if(s===!1){var p=getExt(n.file)||"at3d",f=JSON.stringify({asset:{version:"0.0"},geometricError:0,root:{refine:"REPLACE",geometricError:0,transform:[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],content:{uri:n.file},extras:(e={},e[p]={textureBaseUri:n.textureBase,textureArray:n.textures,textureOptions:(r=t.textureOptions)!==null&&r!==void 0?r:{}},e)}});o.push({name:"fallback",type:"mesh",upAxis:"Z",tileset:URL.createObjectURL(new Blob([f],{type:"application/json"}))})}}return o.map(function(d){return loadViewLayer(d,{fetcher:t.fetcher,light:t.light}).then(function(h){return t.onError&&(h.error&&t.onError(h.error),h.onError=t.onError),h})})}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,p=[],f=[],d=0;d<l;d++)p[d]=new THREE__namespace.Vector3,f[d]=new THREE__namespace.Vector3;var h=new THREE__namespace.Vector3,g=new THREE__namespace.Vector3,A=new THREE__namespace.Vector3,m=new THREE__namespace.Vector2,E=new THREE__namespace.Vector2,v=new THREE__namespace.Vector2,y=new THREE__namespace.Vector3,b=new THREE__namespace.Vector3;function T(Q,U,q){h.fromArray(o,Q*3),g.fromArray(o,U*3),A.fromArray(o,q*3),m.fromArray(u,Q*2),E.fromArray(u,U*2),v.fromArray(u,q*2);var K=g.x-h.x,Y=A.x-h.x,Z=g.y-h.y,te=A.y-h.y,j=g.z-h.z,ee=A.z-h.z,W=E.x-m.x,re=v.x-m.x,le=E.y-m.y,ae=v.y-m.y,oe=1/(W*ae-re*le);y.set((ae*K-le*Y)*oe,(ae*Z-le*te)*oe,(ae*j-le*ee)*oe),b.set((W*Y-re*K)*oe,(W*te-re*Z)*oe,(W*ee-re*j)*oe),p[Q].add(y),p[U].add(y),p[q].add(y),f[Q].add(b),f[U].add(b),f[q].add(b)}var _=n.groups;_.length===0&&(_=[{start:0,count:r.length}]);for(var d=0,S=_.length;d<S;++d)for(var R=_[d],M=R.start,H=R.count,B=M,C=M+H;B<C;B+=3)T(r[B+0],r[B+1],r[B+2]);var w=new THREE__namespace.Vector3,I=new THREE__namespace.Vector3,O=new THREE__namespace.Vector3,L=new THREE__namespace.Vector3,N,z,J;function G(Q){O.fromArray(s,Q*3),L.copy(O),z=p[Q],w.copy(z),w.sub(O.multiplyScalar(O.dot(z))).normalize(),I.crossVectors(L,z),J=I.dot(f[Q]),N=J<0?-1:1,c[Q*4]=w.x,c[Q*4+1]=w.y,c[Q*4+2]=w.z,c[Q*4+3]=N}for(var d=0,S=_.length;d<S;++d)for(var R=_[d],M=R.start,H=R.count,B=M,C=M+H;B<C;B+=3)G(r[B+0]),G(r[B+1]),G(r[B+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,p=0;p<n.length;++p){var f=n[p];if(e!==(f.index!==null))return null;for(var d in f.attributes){if(!r.has(d))return null;s[d]===void 0&&(s[d]=[]),s[d].push(f.attributes[d])}for(var d in f.morphAttributes){if(!o.has(d))return null;u[d]===void 0&&(u[d]=[]),u[d].push(f.morphAttributes[d])}if(l.userData.mergedUserData=l.userData.mergedUserData||[],l.userData.mergedUserData.push(f.userData),t){var h;if(e)h=f.index.count;else if(f.attributes.position!==void 0)h=f.attributes.position.count;else return null;l.addGroup(c,h,p),c+=h}}if(e){for(var g=0,A=[],p=0;p<n.length;++p){for(var m=n[p].index,E=0;E<m.count;++E)A.push(m.getX(E)+g);g+=n[p].attributes.position.count}l.setIndex(A)}for(var d in s){var v=this.mergeBufferAttributes(s[d]);if(!v)return null;l.setAttribute(d,v)}for(var d in u){var y=u[d][0].length;if(y===0)break;l.morphAttributes=l.morphAttributes||{},l.morphAttributes[d]=[];for(var p=0;p<y;++p){for(var b=[],E=0;E<u[d].length;++E)b.push(u[d][E][p]);var T=this.mergeBufferAttributes(b);if(!T)return null;l.morphAttributes[d].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,p=[],f=["getX","getY","getZ","getW"],d=["setX","setY","setZ","setW"],h=0,s=n.length;h<s;h++){var u=n[h],g=u.itemSize,A=u.count,m=new THREE__namespace.InterleavedBufferAttribute(l,g,c,u.normalized);p.push(m),c+=g;for(var E=0;E<A;E++)for(var v=0;v<g;v++)m[d[v]](E,u[f[v]](E))}return p},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={},p={},f=[],d=["getX","getY","getZ","getW"],h=0,g=l.length;h<g;h++){var A=l[h];c[A]=[];var m=n.morphAttributes[A];m&&(p[A]=new Array(m.length).fill().map(function(){return[]}))}for(var E=Math.log10(1/t),v=Math.pow(10,E),h=0;h<s;h++){for(var y=r?r.getX(h):h,b="",T=0,g=l.length;T<g;T++)for(var A=l[T],_=n.getAttribute(A),S=_.itemSize,R=0;R<S;R++)b+="".concat(~~(_[d[R]](y)*v),",");if(b in e)f.push(e[b]);else{for(var T=0,g=l.length;T<g;T++)for(var A=l[T],_=n.getAttribute(A),m=n.morphAttributes[A],S=_.itemSize,M=c[A],H=p[A],R=0;R<S;R++){var B=d[R];if(M.push(_[B](y)),m)for(var C=0,w=m.length;C<w;C++)H[C].push(m[C][B](y))}e[b]=u,f.push(u),u++}}for(var I=n.clone(),h=0,g=l.length;h<g;h++){var A=l[h],O=n.getAttribute(A),L=new O.array.constructor(c[A]),_=new THREE__namespace.BufferAttribute(L,O.itemSize,O.normalized);if(I.setAttribute(A,_),A in p)for(var T=0;T<p[A].length;T++){var N=n.morphAttributes[A][T],L=new N.array.constructor(p[A][T]),z=new THREE__namespace.BufferAttribute(L,N.itemSize,N.normalized);I.morphAttributes[A][T]=z}}return I.setIndex(f),I}},scratchSphere$1=new THREE__namespace.Sphere,scratchMatrix4=new THREE__namespace.Matrix4,scratchMatrix4Inverse=new THREE__namespace.Matrix4;function getEdgesBySphere(n,t,e){e===void 0&&(e=30/180*Math.PI);for(var r=Math.cos(e),o=[],s=0,u=n.children;s<u.length;s++){var l=u[s];l instanceof Tile3D&&l.tileset.selectedTiles.forEach(function(c){var p,f,d;if(!(c.boundingVolume&&c.boundingVolume.distanceToPoint(t.center)>t.radius)){var h=(f=(p=c.content)===null||p===void 0?void 0:p.data)===null||f===void 0?void 0:f.object;if(h&&h.visible){var g=[];if(h.traverseVisible(function(U){if(U instanceof THREE__namespace.Mesh){var q=bvhMeshMap.get(U);if(q){scratchMatrix4.copy(U.matrixWorld),scratchMatrix4Inverse.getInverse(scratchMatrix4),scratchSphere$1.copy(t).applyMatrix4(scratchMatrix4Inverse);var K=q.trianglesInSphere(scratchSphere$1.center,scratchSphere$1.radius),Y=new THREE__namespace.BufferGeometry;Y.setAttribute("position",new THREE__namespace.BufferAttribute(K,3)),Y.applyMatrix4(U.matrixWorld),Y=BufferGeometryUtils.mergeVertices(Y,.01),g.push(Y)}}}),g.length===0)return;for(var A=["a","b","c"],m=BufferGeometryUtils.mergeBufferGeometries(g,!1),E=m.getAttribute("position").array,v=((d=m.getIndex())===null||d===void 0?void 0:d.array)||[],y=[],b=[],T=0,_=E.length;T<_;T+=3){var S=new THREE__namespace.Vector3(E[T],E[T+1],E[T+2]);y.push(S)}for(var T=0,_=v.length;T<_;T+=3){var R=v[T],M=v[T+1],H=v[T+2],B=new THREE__namespace.Vector3().crossVectors(y[M].clone().sub(y[R]),y[H].clone().sub(y[R])).normalize();b.push({a:R,b:M,c:H,normal:B})}for(var C={},T=0,_=b.length;T<_;T++)for(var w=b[T],I=0;I<3;I++){var O=w[A[I]],L=w[A[(I+1)%3]],N=[Math.min(O,L),Math.max(O,L)],z=N[0]+"-"+N[1];C[z]===void 0?C[z]={index1:N[0],index2:N[1],face1:T}:C[z].face2=T}for(var z in C){var J=C[z];if(J.face2===void 0||b[J.face1].normal.dot(b[J.face2].normal)<=r){var G=y[J.index1],Q=y[J.index2];o.push(new THREE__namespace.Line3(G,Q))}}y.length=0,b.length=0}}})}return o}var scratchBoundingBox$1=new THREE__namespace.Box3,scratchViewLayerBox=new THREE__namespace.Box3,scratchObserverBox=new THREE__namespace.Box3,Model=function(n){__extends(t,n);function t(e,r){r===void 0&&(r={});var o,s=n.call(this)||this;s.disposed=!1,s.parameter=new Parameter,s.outdated=!1,s.autoRefine=!0,s.metaPending=!1,s.loaded=!1,s.refined=!1,s.refineProgress=[0,0],s.boundingBox=new THREE__namespace.Box3,s.needsRender=!1,s.work=e,s.name=s.work.workCode;for(var u=0,l=0,c=e.observers;l<c.length;l++){var p=c[l];u=Math.max(u,p.floorIndex)}if(s.floorLength=u+1,e.model){s.metaPending=!0;var f=loadViewLayers(e.model,{fetcher:getFetcher(e),light:(o=r.light)!==null&&o!==void 0?o:!1,textureOptions:r.textureOptions,onError:function(d){return s.dispatchEvent({type:"error",error:d})}});s.initReady=Promise.all(f).then(function(d){if(s.metaPending=!1,d.length)if(s.disposed)for(var h=0,g=d;h<g.length;h++){var A=g[h];A.dispose()}else s.add.apply(s,d)}),s.loadedReady=new Promise(function(d){s.addEventListener("load",function(){return d()})})}else s.refined=!0,s.loaded=!0,s.initReady=Promise.resolve(),s.loadedReady=Promise.resolve();return s}return t.prototype.dispose=function(){this.disposed=!0;for(var e;e=this.children[0];)typeof e.dispose=="function"&&e.dispose(),this.remove(e)},Object.defineProperty(t.prototype,"empty",{get:function(){return this.children.length===0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"viewLayers",{get:function(){return this.children},enumerable:!1,configurable:!0}),t.prototype.getEdgesBySphere=function(e,r){return r===void 0&&(r=30/180*Math.PI),getEdgesBySphere(this,e,r)},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&&typeof c.intersectRaycaster=="function"&&c.intersectRaycaster(e,r,!1,s)}return s=s.filter(function(p){return!(p.object instanceof PBMPointCloud&&p.object.material.pointBack==="HIDDEN"&&p.face&&p.face.normal.angleTo(e.ray.direction)<Math.PI/2)}),o&&s.sort(function(p,f){return p.distance-f.distance}),s},t.prototype.update=function(e,r,o){var s=!1;this.needsRender===!0&&(this.needsRender=!1,s=!0);var u=this.loaded;this.refined=!this.metaPending,this.loaded=!this.metaPending,this.refineProgress[0]=this.refineProgress[1]=0,this.work.transform.equals(this.matrix)||(this.matrix.copy(this.work.transform),this.matrix.decompose(this.position,this.quaternion,this.scale),this.matrixAutoUpdate=!1,s=!0);for(var l=0,c=this.children;l<c.length;l++){var p=c[l];p.autoRefine=this.autoRefine;var f=p.update(e,r,o,this);f&&(s=!0),p.refined===!1&&(this.refined=!1),p.loaded===!1&&(this.loaded=!1),this.refineProgress[0]+=p.refineProgress[0],this.refineProgress[1]+=p.refineProgress[1]}scratchBoundingBox$1.makeEmpty(),scratchObserverBox.copy(this.work.observerBox),scratchObserverBox.isEmpty()||(scratchObserverBox.max.x+=1,scratchObserverBox.max.z+=1,scratchObserverBox.max.y+=1,scratchObserverBox.min.x-=1,scratchObserverBox.min.z-=1,scratchBoundingBox$1.union(scratchObserverBox));for(var d=0,h=this.viewLayers;d<h.length;d++){var p=h[d];p.boundingBox.isEmpty()||(scratchViewLayerBox.copy(p.boundingBox),scratchBoundingBox$1.union(scratchViewLayerBox))}return this.boundingBox.copy(scratchBoundingBox$1).applyMatrix4(this.matrix),u===!1&&this.loaded===!0&&this.dispatchEvent({type:"load"}),s},t.prototype.localToEnu=function(e){return e.applyMatrix4(localToEnuMatrix)},t.prototype.enuToLocal=function(e){return e.applyMatrix4(enuToLocalMatrix)},t.prototype.worldToEnu=function(e){return this.localToEnu(this.worldToLocal(e))},t.prototype.enuToWorld=function(e){return this.localToWorld(this.enuToLocal(e))},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,this.dispatchEvent({type:"changeShownFloor",shownFloor:e})},Object.defineProperty(t.prototype,"bounding",{get:function(){return this.boundingBox},enumerable:!1,configurable:!0}),t.prototype.setMaterial=function(e){this.parameter.set(e)},t.prototype.getMaterial=function(){var e,r=[];return this.parent&&this.parent.parameter instanceof Parameter&&r.unshift(this.parent.parameter),(e=this.parameter).resolveValue.apply(e,r)},Object.defineProperty(t.prototype,"shownFloorIndex",{get:function(){var e,r=[];return this.parent&&this.parent.parameter instanceof Parameter&&r.unshift(this.parent.parameter),(e=this.parameter).resolveValue.apply(e,r).shownFloorIndex},set:function(e){this.parameter.set("shownFloorIndex",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"brightness",{get:function(){var e,r=[];return this.parent&&this.parent.parameter instanceof Parameter&&r.unshift(this.parent.parameter),(e=this.parameter).resolveValue.apply(e,r).brightness},set:function(e){this.parameter.set("brightness",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clippers",{get:function(){var e,r=[];return this.parent&&this.parent.parameter instanceof Parameter&&r.unshift(this.parent.parameter),(e=this.parameter).resolveValue.apply(e,r).clippers},set:function(e){this.parameter.set("clippers",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"customShaders",{get:function(){var e,r=[];return this.parent&&this.parent.parameter instanceof Parameter&&r.unshift(this.parent.parameter),(e=this.parameter).resolveValue.apply(e,r).customShaders},set:function(e){this.parameter.set("customShaders",e)},enumerable:!1,configurable:!0}),t.prototype.resetBrightness=function(){this.parameter.reset("brightness");for(var e=0,r=this.viewLayers;e<r.length;e++){var o=r[e];o.resetBrightness()}},t}(THREE__namespace.Object3D),scratchBoundingBox3=new THREE__namespace.Box3,scratchModelBoundingBox3=new THREE__namespace.Box3,ModelScene=function(n){__extends(t,n);function t(){var e=n.call(this)||this;e.needsRender=!0,e.autoRefine=!0,e.boundingBox=new THREE__namespace.Box3,e.loaded=!1,e.refined=!1,e.refineProgress=[0,0],e.parameter=new Parameter;var r=e.models=[],o=e;return defineProperty(r,"autoUpdate",{get:function(){return o.autoRefine},set:function(s){o.autoRefine=s}}),defineProperty(r,"bounding",{get:function(){return o.boundingBox}}),defineProperty(r,"loaded",{get:function(){return o.loaded}}),defineProperty(r,"refined",{get:function(){return o.refined}}),defineProperty(r,"refineProgress",{get:function(){return o.refineProgress}}),defineProperty(r,"cacheCameras",{get:function(){return o.parameter.resolveValue().cacheCameras},set:function(s){o.parameter.set("cacheCameras",s)}}),defineProperty(r,"intersectRaycaster",{value:function(s){return o.intersectRaycaster(s)}}),defineProperty(r,"setMaterial",{value:function(s){return o.setMaterial(s)}}),defineProperty(r,"getMaterial",{value:function(){return o.getMaterial()}}),defineProperty(r,"resetBrightness",{value:function(){return o.resetBrightness()}}),e}return t.prototype.add=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];n.prototype.add.apply(this,e),this.models.length=0;for(var o=0,s=this.children;o<s.length;o++){var u=s[o];u instanceof Model&&u.outdated!==!0&&this.models.push(u)}return this.needsRender=!0,this},t.prototype.remove=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];n.prototype.remove.apply(this,e),this.models.length=0;for(var o=0,s=this.children;o<s.length;o++){var u=s[o];u instanceof Model&&u.outdated!==!0&&this.models.push(u)}scratchBoundingBox3.makeEmpty();for(var l=0,c=this.children;l<c.length;l++){var u=c[l];u instanceof Model&&(scratchModelBoundingBox3.copy(u.boundingBox).applyMatrix4(u.matrix),scratchBoundingBox3.union(scratchModelBoundingBox3))}return this.boundingBox.copy(scratchBoundingBox3),this.needsRender=!0,this},t.prototype.intersectRaycaster=function(e,r,o){o===void 0&&(o=!0);var s=this.children.filter(function(d){return d instanceof Model}),u;if(s.length===0)u=[];else if(s.length===1)u=s[0].intersectRaycaster(e,r,o);else{u=[];for(var l=0,c=s;l<c.length;l++){var p=c[l];if(p.visible){var f=p.intersectRaycaster(e,r,!1);f.length&&u.push.apply(u,f)}}o&&u.sort(function(d,h){return d.distance-h.distance})}return u},t.prototype.update=function(e,r){var o=!1;scratchBoundingBox3.makeEmpty(),this.loaded=this.models.length>0,this.refined=this.models.length>0,this.refineProgress[0]=this.refineProgress[1]=0,this.models.length=0;for(var s=0,u=this.children;s<u.length;s++){var l=u[s];if(l instanceof Model)if(l.outdated){l.autoRefine=!1;var c=l.update(e,r,this);c&&(o=!0)}else{this.models.push(l),l.autoRefine=this.autoRefine;var c=l.update(e,r,this);c&&(o=!0),l.loaded===!1&&(this.loaded=!1),l.refined===!1&&(this.refined=!1),this.refineProgress[0]+=l.refineProgress[0],this.refineProgress[1]+=l.refineProgress[1],scratchModelBoundingBox3.copy(l.boundingBox),scratchBoundingBox3.union(scratchModelBoundingBox3)}else if(l.update){var c=l.update(e,r,this);c&&(o=!0)}}return this.boundingBox.copy(scratchBoundingBox3),this.needsRender=o,o},Object.defineProperty(t.prototype,"bounding",{get:function(){return this.boundingBox},enumerable:!1,configurable:!0}),t.prototype.setMaterial=function(e){this.parameter.set(e)},t.prototype.getMaterial=function(){return this.parameter.resolveValue()},t.prototype.resetBrightness=function(){this.parameter.reset("brightness");for(var e=0,r=this.models;e<r.length;e++){var o=r[e];o.resetBrightness()}},t}(THREE__namespace.Scene),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,p=e.antialias,f=p===void 0?!1:p,d=e.webgl2,h=e.logarithmicDepthBuffer,g=e.precision,A=e.powerPreference,m=this,E={antialias:f,alpha:!0,depth:!0,preserveDrawingBuffer:o,stencil:c,premultipliedAlpha:u,powerPreference:A},v={logarithmicDepthBuffer:h,precision:g};if(d){var y=document.createElement("canvas"),b=y.getContext("webgl2",E);b?m=n.call(this,__assign(__assign(__assign({},E),v),{antialias:!0,canvas:y,context:b}))||this:(console.error("error occurred when getting webgl2 canvas context, mybe webgl2 not support, fallback to webgl."),m=n.call(this,__assign(__assign({},E),v))||this)}else m=n.call(this,__assign(__assign({},E),v))||this;return m.outputEncoding=THREE__namespace.sRGBEncoding,m.autoClear=!0,m}return t}(THREE__namespace.WebGLRenderer),Clock=function(){function n(t,e){t===void 0&&(t=!0),e===void 0&&(e=!1),this.elapsedTime=0,this.autoStart=t,this.autoUpdate=e,this.running=t;var r=now();e?defineProperty(this,"currentTime",{get:function(){return now()}}):this.currentTime=r,this.startTime=r,this.oldTime=r}return n.prototype.update=function(t){this.autoUpdate||(this.currentTime=t)},n.prototype.start=function(){this.startTime=this.currentTime,this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0},n.prototype.stop=function(){this.getElapsedTime(),this.running=!1,this.autoStart=!1},n.prototype.getElapsedTime=function(){return this.getDelta(),this.elapsedTime},n.prototype.getDelta=function(){var t=0;return this.autoStart&&!this.running?(this.start(),0):(this.running&&(t=(this.currentTime-this.oldTime)/1e3,this.oldTime=this.currentTime,this.elapsedTime+=t),t)},n}(),sharedProjScreenMatrix=new THREE__namespace.Matrix4,sharedFrustum=new THREE__namespace.Frustum,renderResolution=new THREE__namespace.Vector2,clockForMixer=new WeakMap;function updateObject(n){var t=!1;return n.needsRender===!0?(n.needsRender=!1,t=!0):n.mixer&&n.mixer.stats.actions.inUse>0&&(t=!0),t}var Scene=function(n){__extends(t,n);function t(){var e=n!==null&&n.apply(this,arguments)||this;return e.needsRender=!1,e}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.prototype.update=function(e,r){var o=!1,s;return r instanceof Camera?(s=r.time,renderResolution.copy(r.resolution)):(s=now(),e.getSize(renderResolution)),sharedProjScreenMatrix.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse),sharedFrustum.setFromProjectionMatrix(sharedProjScreenMatrix),this.traverseVisible(function(u){if(u.setResolution&&u.setResolution(renderResolution.x,renderResolution.y),u.setTime&&u.setTime(s),u.mixer instanceof THREE__namespace.AnimationMixer){var l=u.mixer,c=clockForMixer.get(l);c||(c=new Clock,clockForMixer.set(l,c)),c.update(s),l.update(c.getDelta())}if((u instanceof THREE__namespace.Mesh||u instanceof THREE__namespace.Line||u instanceof THREE__namespace.Points)&&(u instanceof THREE__namespace.ImmediateRenderObject||!u.frustumCulled||sharedFrustum.intersectsObject(u))){var p=updateObject(u);p&&(o=!0),u.traverseAncestors(function(f){var d=updateObject(f);d&&(o=!0)})}}),this.needsRender=o,o},t}(THREE__namespace.Scene),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$6=`
|
|
1029
1029
|
varying vec2 vUv;
|
|
1030
1030
|
#include <common>
|
|
1031
1031
|
#include <logdepthbuf_pars_vertex>
|
|
@@ -1388,7 +1388,7 @@ void main() {
|
|
|
1388
1388
|
* Copyright (c) 2016 Jorik Tangelder;
|
|
1389
1389
|
* 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,p=Date.now;function f(P,F,k){return setTimeout(y(P,k),F)}function d(P,F,k){return Array.isArray(P)?(h(P,k[F],k),!0):!1}function h(P,F,k){var D;if(P)if(P.forEach)P.forEach(F,k);else if(P.length!==r)for(D=0;D<P.length;)F.call(k,P[D],D,P),D++;else for(D in P)P.hasOwnProperty(D)&&F.call(k,P[D],D,P)}function g(P,F,k){var D="DEPRECATED METHOD: "+F+`
|
|
1390
1390
|
`+k+` AT
|
|
1391
|
-
`;return function(){var Y=new Error("get-stack-trace"),ue=Y&&Y.stack?Y.stack.replace(/^[^\(]+?[\n$]/gm,"").replace(/^\s+at\s+/gm,"").replace(/^Object.<anonymous>\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",ge=n.console&&(n.console.warn||n.console.log);return ge&&ge.call(n.console,D,ue),P.apply(this,arguments)}}var A;typeof Object.assign!="function"?A=function(F){if(F===r||F===null)throw new TypeError("Cannot convert undefined or null to object");for(var k=Object(F),D=1;D<arguments.length;D++){var Y=arguments[D];if(Y!==r&&Y!==null)for(var ue in Y)Y.hasOwnProperty(ue)&&(k[ue]=Y[ue])}return k}:A=Object.assign;var m=g(function(F,k,D){for(var Y=Object.keys(k),ue=0;ue<Y.length;)(!D||D&&F[Y[ue]]===r)&&(F[Y[ue]]=k[Y[ue]]),ue++;return F},"extend","Use `assign`."),E=g(function(F,k){return m(F,k,!0)},"merge","Use `assign`.");function v(P,F,k){var D=F.prototype,Y;Y=P.prototype=Object.create(D),Y.constructor=P,Y._super=D,k&&A(Y,k)}function y(P,F){return function(){return P.apply(F,arguments)}}function b(P,F){return typeof P==u?P.apply(F&&F[0]||r,F):P}function T(P,F){return P===r?F:P}function _(P,F,k){h(H(F),function(D){P.addEventListener(D,k,!1)})}function S(P,F,k){h(H(F),function(D){P.removeEventListener(D,k,!1)})}function R(P,F){for(;P;){if(P==F)return!0;P=P.parentNode}return!1}function M(P,F){return P.indexOf(F)>-1}function H(P){return P.trim().split(/\s+/g)}function B(P,F,k){if(P.indexOf&&!k)return P.indexOf(F);for(var D=0;D<P.length;){if(k&&P[D][k]==F||!k&&P[D]===F)return D;D++}return-1}function C(P){return Array.prototype.slice.call(P,0)}function w(P,F,k){for(var D=[],Y=[],ue=0;ue<P.length;){var ge=P[ue][F];B(Y,ge)<0&&D.push(P[ue]),Y[ue]=ge,ue++}return D=D.sort(function(at,De){return at[F]>De[F]}),D}function I(P,F){for(var k,D,Y=F[0].toUpperCase()+F.slice(1),ue=0;ue<o.length;){if(k=o[ue],D=k?k+Y:F,D in P)return D;ue++}return r}var O=1;function L(){return O++}function N(P){var F=P.ownerDocument||P;return F.defaultView||F.parentWindow||n}var z=/mobile|tablet|ip(ad|hone|od)|android/i,J="ontouchstart"in n,K=I(n,"PointerEvent")!==r,Q=J&&z.test(navigator.userAgent),U="touch",q="pen",X="mouse",Z="kinect",W=25,G=1,ne=2,$=4,ee=8,re=1,le=2,ae=4,oe=8,se=16,pe=le|ae,de=oe|se,xe=pe|de,ce=["x","y"],Re=["clientX","clientY"];function j(P,F){var k=this;this.manager=P,this.callback=F,this.element=P.element,this.target=P.options.inputTarget,this.domHandler=function(D){b(P.options.enable,[P])&&k.handler(D)},this.init()}j.prototype={handler:function(){},init:function(){this.evEl&&_(this.element,this.evEl,this.domHandler),this.evTarget&&_(this.target,this.evTarget,this.domHandler),this.evWin&&_(N(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&S(this.element,this.evEl,this.domHandler),this.evTarget&&S(this.target,this.evTarget,this.domHandler),this.evWin&&S(N(this.element),this.evWin,this.domHandler)}};function te(P){var F,k=P.options.inputClass;return k?F=k:K?F=Ne:Q?F=He:J?F=Ye:F=Te,new F(P,V)}function V(P,F,k){var D=k.pointers.length,Y=k.changedPointers.length,ue=F&G&&D-Y===0,ge=F&($|ee)&&D-Y===0;k.isFirst=!!ue,k.isFinal=!!ge,ue&&(P.session={}),k.eventType=F,be(P,k),P.emit("hammer.input",k),P.recognize(k),P.session.prevInput=k}function be(P,F){var k=P.session,D=F.pointers,Y=D.length;k.firstInput||(k.firstInput=Ve(F)),Y>1&&!k.firstMultiple?k.firstMultiple=Ve(F):Y===1&&(k.firstMultiple=!1);var ue=k.firstInput,ge=k.firstMultiple,Xe=ge?ge.center:ue.center,at=F.center=rt(D);F.timeStamp=p(),F.deltaTime=F.timeStamp-ue.timeStamp,F.angle=he(Xe,at),F.distance=ie(Xe,at),fe(k,F),F.offsetDirection=me(F.deltaX,F.deltaY);var De=We(F.deltaTime,F.deltaX,F.deltaY);F.overallVelocityX=De.x,F.overallVelocityY=De.y,F.overallVelocity=c(De.x)>c(De.y)?De.x:De.y,F.scale=ge?_e(ge.pointers,D):1,F.rotation=ge?Ce(ge.pointers,D):0,F.maxPointers=k.prevInput?F.pointers.length>k.prevInput.maxPointers?F.pointers.length:k.prevInput.maxPointers:F.pointers.length,ve(k,F);var Et=P.element;R(F.srcEvent.target,Et)&&(Et=F.srcEvent.target),F.target=Et}function fe(P,F){var k=F.center,D=P.offsetDelta||{},Y=P.prevDelta||{},ue=P.prevInput||{};(F.eventType===G||ue.eventType===$)&&(Y=P.prevDelta={x:ue.deltaX||0,y:ue.deltaY||0},D=P.offsetDelta={x:k.x,y:k.y}),F.deltaX=Y.x+(k.x-D.x),F.deltaY=Y.y+(k.y-D.y)}function ve(P,F){var k=P.lastInterval||F,D=F.timeStamp-k.timeStamp,Y,ue,ge,Xe;if(F.eventType!=ee&&(D>W||k.velocity===r)){var at=F.deltaX-k.deltaX,De=F.deltaY-k.deltaY,Et=We(D,at,De);ue=Et.x,ge=Et.y,Y=c(Et.x)>c(Et.y)?Et.x:Et.y,Xe=me(at,De),P.lastInterval=F}else Y=k.velocity,ue=k.velocityX,ge=k.velocityY,Xe=k.direction;F.velocity=Y,F.velocityX=ue,F.velocityY=ge,F.direction=Xe}function Ve(P){for(var F=[],k=0;k<P.pointers.length;)F[k]={clientX:l(P.pointers[k].clientX),clientY:l(P.pointers[k].clientY)},k++;return{timeStamp:p(),pointers:F,center:rt(F),deltaX:P.deltaX,deltaY:P.deltaY}}function rt(P){var F=P.length;if(F===1)return{x:l(P[0].clientX),y:l(P[0].clientY)};for(var k=0,D=0,Y=0;Y<F;)k+=P[Y].clientX,D+=P[Y].clientY,Y++;return{x:l(k/F),y:l(D/F)}}function We(P,F,k){return{x:F/P||0,y:k/P||0}}function me(P,F){return P===F?re:c(P)>=c(F)?P<0?le:ae:F<0?oe:se}function ie(P,F,k){k||(k=ce);var D=F[k[0]]-P[k[0]],Y=F[k[1]]-P[k[1]];return Math.sqrt(D*D+Y*Y)}function he(P,F,k){k||(k=ce);var D=F[k[0]]-P[k[0]],Y=F[k[1]]-P[k[1]];return Math.atan2(Y,D)*180/Math.PI}function Ce(P,F){return he(F[1],F[0],Re)+he(P[1],P[0],Re)}function _e(P,F){return ie(F[0],F[1],Re)/ie(P[0],P[1],Re)}var Ie={mousedown:G,mousemove:ne,mouseup:$},Fe="mousedown",Ae="mousemove mouseup";function Te(){this.evEl=Fe,this.evWin=Ae,this.pressed=!1,j.apply(this,arguments)}v(Te,j,{handler:function(F){var k=Ie[F.type];k&G&&(F.button===0||F.button===2)&&(this.pressed=!0),k&ne&&F.which!==1&&(k=$),this.pressed&&(k&$&&(this.pressed=!1),this.callback(this.manager,k,{pointers:[F],changedPointers:[F],pointerType:X,srcEvent:F}))}});var we={pointerdown:G,pointermove:ne,pointerup:$,pointercancel:ee,pointerout:ee},Pe={2:U,3:q,4:X,5:Z},qe="pointerdown",ke="pointermove pointerup pointercancel";n.MSPointerEvent&&!n.PointerEvent&&(qe="MSPointerDown",ke="MSPointerMove MSPointerUp MSPointerCancel");function Ne(){this.evEl=qe,this.evWin=ke,j.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}v(Ne,j,{handler:function(F){var k=this.store,D=!1,Y=!1,ue=F.type.toLowerCase().replace("ms",""),ge=we[ue],Xe=Pe[F.pointerType]||F.pointerType,at=Xe==U,De=B(k,F.pointerId,"pointerId");ge&G&&(F.button===0||F.button===2||at)?De<0&&(k.push(F),De=k.length-1):ge&($|ee)?D=!0:!at&&F.buttons===0&&(D=!0,Y=!0,ge=we.pointerup),!(De<0)&&(Y||(k[De]=F),this.callback(this.manager,ge,{pointers:k,changedPointers:[F],pointerType:Xe,srcEvent:k[De]}),D&&k.splice(De,1))}});var Le={touchstart:G,touchmove:ne,touchend:$,touchcancel:ee},Ue="touchstart",ze="touchstart touchmove touchend touchcancel";function je(){this.evTarget=Ue,this.evWin=ze,this.started=!1,j.apply(this,arguments)}v(je,j,{handler:function(F){var k=Le[F.type];if(k===G&&(this.started=!0),!!this.started){var D=Se.call(this,F,k);k&($|ee)&&D[0].length-D[1].length===0&&(this.started=!1),this.callback(this.manager,k,{pointers:D[0],changedPointers:D[1],pointerType:U,srcEvent:F})}}});function Se(P,F){var k=C(P.touches),D=C(P.changedTouches);return F&($|ee)&&(k=w(k.concat(D),"identifier")),[k,D]}var Oe={touchstart:G,touchmove:ne,touchend:$,touchcancel:ee},Me="touchstart touchmove touchend touchcancel";function He(){this.evTarget=Me,this.targetIds={},j.apply(this,arguments)}v(He,j,{handler:function(F){var k=Oe[F.type],D=Be.call(this,F,k);D&&this.callback(this.manager,k,{pointers:D[0],changedPointers:D[1],pointerType:U,srcEvent:F})}});function Be(P,F){var k=C(P.touches),D=this.targetIds;if(F&(G|ne)&&k.length===1)return D[k[0].identifier]=!0,[k,k];var Y,ue,ge=C(P.changedTouches),Xe=[],at=this.target;if(ue=k.filter(function(De){return R(De.target,at)}),F===G)for(Y=0;Y<ue.length;)D[ue[Y].identifier]=!0,Y++;for(Y=0;Y<ge.length;)D[ge[Y].identifier]&&Xe.push(ge[Y]),F&($|ee)&&delete D[ge[Y].identifier],Y++;if(Xe.length)return[w(ue.concat(Xe),"identifier"),Xe]}var Ge=2500,Ze=25;function Ye(){j.apply(this,arguments);var P=y(this.handler,this);this.touch=new He(this.manager,P),this.mouse=new Te(this.manager,P),this.primaryTouch=null,this.lastTouches=[]}v(Ye,j,{handler:function(F,k,D){var Y=D.pointerType==U,ue=D.pointerType==X;if(!(ue&&D.sourceCapabilities&&D.sourceCapabilities.firesTouchEvents)){if(Y)Qe.call(this,k,D);else if(ue&&Ct.call(this,D))return;this.callback(F,k,D)}},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});function Qe(P,F){P&G?(this.primaryTouch=F.changedPointers[0].identifier,ye.call(this,F)):P&($|ee)&&ye.call(this,F)}function ye(P){var F=P.changedPointers[0];if(F.identifier===this.primaryTouch){var k={x:F.clientX,y:F.clientY};this.lastTouches.push(k);var D=this.lastTouches,Y=function(){var ue=D.indexOf(k);ue>-1&&D.splice(ue,1)};setTimeout(Y,Ge)}}function Ct(P){for(var F=P.srcEvent.clientX,k=P.srcEvent.clientY,D=0;D<this.lastTouches.length;D++){var Y=this.lastTouches[D],ue=Math.abs(F-Y.x),ge=Math.abs(k-Y.y);if(ue<=Ze&&ge<=Ze)return!0}return!1}var vt=s?I(s.style,"touchAction"):r,it=vt!==r,Je="compute",pt="auto",nt="manipulation",Ke="none",Ee="pan-x",$e="pan-y",bt=Ot();function Tt(P,F){this.manager=P,this.set(F)}Tt.prototype={set:function(P){P==Je&&(P=this.compute()),it&&this.manager.element.style&&bt[P]&&(this.manager.element.style[vt]=P),this.actions=P.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var P=[];return h(this.manager.recognizers,function(F){b(F.options.enable,[F])&&(P=P.concat(F.getTouchAction()))}),Bt(P.join(" "))},preventDefaults:function(P){var F=P.srcEvent,k=P.offsetDirection;if(this.manager.session.prevented){F.preventDefault();return}var D=this.actions,Y=M(D,Ke)&&!bt[Ke],ue=M(D,$e)&&!bt[$e],ge=M(D,Ee)&&!bt[Ee];if(Y){var Xe=P.pointers.length===1,at=P.distance<2,De=P.deltaTime<250;if(Xe&&at&&De)return}if(!(ge&&ue)&&(Y||ue&&k&pe||ge&&k&de))return this.preventSrc(F)},preventSrc:function(P){this.manager.session.prevented=!0,P.preventDefault()}};function Bt(P){if(M(P,Ke))return Ke;var F=M(P,Ee),k=M(P,$e);return F&&k?Ke:F||k?F?Ee:$e:M(P,nt)?nt:pt}function Ot(){if(!it)return!1;var P={},F=n.CSS&&n.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach(function(k){P[k]=F?n.CSS.supports("touch-action",k):!0}),P}var ot=1,tt=2,_t=4,gt=8,ft=gt,At=16,dt=32;function ht(P){this.options=A({},this.defaults,P||{}),this.id=L(),this.manager=null,this.options.enable=T(this.options.enable,!0),this.state=ot,this.simultaneous={},this.requireFail=[]}ht.prototype={defaults:{},set:function(P){return A(this.options,P),this.manager&&this.manager.touchAction.update(),this},recognizeWith:function(P){if(d(P,"recognizeWith",this))return this;var F=this.simultaneous;return P=lt(P,this),F[P.id]||(F[P.id]=P,P.recognizeWith(this)),this},dropRecognizeWith:function(P){return d(P,"dropRecognizeWith",this)?this:(P=lt(P,this),delete this.simultaneous[P.id],this)},requireFailure:function(P){if(d(P,"requireFailure",this))return this;var F=this.requireFail;return P=lt(P,this),B(F,P)===-1&&(F.push(P),P.requireFailure(this)),this},dropRequireFailure:function(P){if(d(P,"dropRequireFailure",this))return this;P=lt(P,this);var F=B(this.requireFail,P);return F>-1&&this.requireFail.splice(F,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(P){return!!this.simultaneous[P.id]},emit:function(P){var F=this,k=this.state;function D(Y){F.manager.emit(Y,P)}k<gt&&D(F.options.event+st(k)),D(F.options.event),P.additionalEvent&&D(P.additionalEvent),k>=gt&&D(F.options.event+st(k))},tryEmit:function(P){if(this.canEmit())return this.emit(P);this.state=dt},canEmit:function(){for(var P=0;P<this.requireFail.length;){if(!(this.requireFail[P].state&(dt|ot)))return!1;P++}return!0},recognize:function(P){var F=A({},P);if(!b(this.options.enable,[this,F])){this.reset(),this.state=dt;return}this.state&(ft|At|dt)&&(this.state=ot),this.state=this.process(F),this.state&(tt|_t|gt|At)&&this.tryEmit(F)},process:function(P){},getTouchAction:function(){},reset:function(){}};function st(P){return P&At?"cancel":P>?"end":P&_t?"move":P&tt?"start":""}function ut(P){return P==se?"down":P==oe?"up":P==le?"left":P==ae?"right":""}function lt(P,F){var k=F.manager;return k?k.get(P):P}function ct(){ht.apply(this,arguments)}v(ct,ht,{defaults:{pointers:1},attrTest:function(P){var F=this.options.pointers;return F===0||P.pointers.length===F},process:function(P){var F=this.state,k=P.eventType,D=F&(tt|_t),Y=this.attrTest(P);return D&&(k&ee||!Y)?F|At:D||Y?k&$?F|gt:F&tt?F|_t:tt:dt}});function wt(){ct.apply(this,arguments),this.pX=null,this.pY=null}v(wt,ct,{defaults:{event:"pan",threshold:10,pointers:1,direction:xe},getTouchAction:function(){var P=this.options.direction,F=[];return P&pe&&F.push($e),P&de&&F.push(Ee),F},directionTest:function(P){var F=this.options,k=!0,D=P.distance,Y=P.direction,ue=P.deltaX,ge=P.deltaY;return Y&F.direction||(F.direction&pe?(Y=ue===0?re:ue<0?le:ae,k=ue!=this.pX,D=Math.abs(P.deltaX)):(Y=ge===0?re:ge<0?oe:se,k=ge!=this.pY,D=Math.abs(P.deltaY))),P.direction=Y,k&&D>F.threshold&&Y&F.direction},attrTest:function(P){return ct.prototype.attrTest.call(this,P)&&(this.state&tt||!(this.state&tt)&&this.directionTest(P))},emit:function(P){this.pX=P.deltaX,this.pY=P.deltaY;var F=ut(P.direction);F&&(P.additionalEvent=this.options.event+F),this._super.emit.call(this,P)}});function Ht(){ct.apply(this,arguments)}v(Ht,ct,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[Ke]},attrTest:function(P){return this._super.attrTest.call(this,P)&&(Math.abs(P.scale-1)>this.options.threshold||this.state&tt)},emit:function(P){if(P.scale!==1){var F=P.scale<1?"in":"out";P.additionalEvent=this.options.event+F}this._super.emit.call(this,P)}});function Ft(){ht.apply(this,arguments),this._timer=null,this._input=null}v(Ft,ht,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[pt]},process:function(P){var F=this.options,k=P.pointers.length===F.pointers,D=P.distance<F.threshold,Y=P.deltaTime>F.time;if(this._input=P,!D||!k||P.eventType&($|ee)&&!Y)this.reset();else if(P.eventType&G)this.reset(),this._timer=f(function(){this.state=ft,this.tryEmit()},F.time,this);else if(P.eventType&$)return ft;return dt},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=p(),this.manager.emit(this.options.event,this._input)))}});function Mt(){ct.apply(this,arguments)}v(Mt,ct,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[Ke]},attrTest:function(P){return this._super.attrTest.call(this,P)&&(Math.abs(P.rotation)>this.options.threshold||this.state&tt)}});function yt(){ct.apply(this,arguments)}v(yt,ct,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:pe|de,pointers:1},getTouchAction:function(){return wt.prototype.getTouchAction.call(this)},attrTest:function(P){var F=this.options.direction,k;return F&(pe|de)?k=P.overallVelocity:F&pe?k=P.overallVelocityX:F&de&&(k=P.overallVelocityY),this._super.attrTest.call(this,P)&&F&P.offsetDirection&&P.distance>this.options.threshold&&P.maxPointers==this.options.pointers&&c(k)>this.options.velocity&&P.eventType&$},emit:function(P){var F=ut(P.offsetDirection);F&&this.manager.emit(this.options.event+F,P),this.manager.emit(this.options.event,P)}});function It(){ht.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}v(It,ht,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[nt]},process:function(P){var F=this.options,k=P.pointers.length===F.pointers,D=P.distance<F.threshold,Y=P.deltaTime<F.time;if(this.reset(),P.eventType&G&&this.count===0)return this.failTimeout();if(D&&Y&&k){if(P.eventType!=$)return this.failTimeout();var ue=this.pTime?P.timeStamp-this.pTime<F.interval:!0,ge=!this.pCenter||ie(this.pCenter,P.center)<F.posThreshold;this.pTime=P.timeStamp,this.pCenter=P.center,!ge||!ue?this.count=1:this.count+=1,this._input=P;var Xe=this.count%F.taps;if(Xe===0)return this.hasRequireFailures()?(this._timer=f(function(){this.state=ft,this.tryEmit()},F.interval,this),tt):ft}return dt},failTimeout:function(){return this._timer=f(function(){this.state=dt},this.options.interval,this),dt},reset:function(){clearTimeout(this._timer)},emit:function(){this.state==ft&&(this._input.tapCount=this.count,this.manager.emit(this.options.event,this._input))}});function St(P,F){return F=F||{},F.recognizers=T(F.recognizers,St.defaults.preset),new xt(P,F)}St.VERSION="2.0.7",St.defaults={domEvents:!1,touchAction:Je,enable:!0,inputTarget:null,inputClass:null,preset:[[Mt,{enable:!1}],[Ht,{enable:!1},["rotate"]],[yt,{direction:pe}],[wt,{direction:pe},["swipe"]],[It],[It,{event:"doubletap",taps:2},["tap"]],[Ft]],cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}};var Pt=1,mt=2;function xt(P,F){this.options=A({},St.defaults,F||{}),this.options.inputTarget=this.options.inputTarget||P,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=P,this.input=te(this),this.touchAction=new Tt(this,this.options.touchAction),Rt(this,!0),h(this.options.recognizers,function(k){var D=this.add(new k[0](k[1]));k[2]&&D.recognizeWith(k[2]),k[3]&&D.requireFailure(k[3])},this)}xt.prototype={set:function(P){return A(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?mt:Pt},recognize:function(P){var F=this.session;if(!F.stopped){this.touchAction.preventDefaults(P);var k,D=this.recognizers,Y=F.curRecognizer;(!Y||Y&&Y.state&ft)&&(Y=F.curRecognizer=null);for(var ue=0;ue<D.length;)k=D[ue],F.stopped!==mt&&(!Y||k==Y||k.canRecognizeWith(Y))?k.recognize(P):k.reset(),!Y&&k.state&(tt|_t|gt)&&(Y=F.curRecognizer=k),ue++}},get:function(P){if(P instanceof ht)return P;for(var F=this.recognizers,k=0;k<F.length;k++)if(F[k].options.event==P)return F[k];return null},add:function(P){if(d(P,"add",this))return this;var F=this.get(P.options.event);return F&&this.remove(F),this.recognizers.push(P),P.manager=this,this.touchAction.update(),P},remove:function(P){if(d(P,"remove",this))return this;if(P=this.get(P),P){var F=this.recognizers,k=B(F,P);k!==-1&&(F.splice(k,1),this.touchAction.update())}return this},on:function(P,F){if(P!==r&&F!==r){var k=this.handlers;return h(H(P),function(D){k[D]=k[D]||[],k[D].push(F)}),this}},off:function(P,F){if(P!==r){var k=this.handlers;return h(H(P),function(D){F?k[D]&&k[D].splice(B(k[D],F),1):delete k[D]}),this}},emit:function(P,F){this.options.domEvents&&Lt(P,F);var k=this.handlers[P]&&this.handlers[P].slice();if(!(!k||!k.length)){F.type=P,F.preventDefault=function(){F.srcEvent.preventDefault()};for(var D=0;D<k.length;)k[D](F),D++}},destroy:function(){this.element&&Rt(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}};function Rt(P,F){var k=P.element;if(k.style){var D;h(P.options.cssProps,function(Y,ue){D=I(k.style,ue),F?(P.oldCssProps[D]=k.style[D],k.style[D]=Y):k.style[D]=P.oldCssProps[D]||""}),F||(P.oldCssProps={})}}function Lt(P,F){var k=t.createEvent("Event");k.initEvent(P,!0,!0),k.gesture=F,F.target.dispatchEvent(k)}return A(St,{INPUT_START:G,INPUT_MOVE:ne,INPUT_END:$,INPUT_CANCEL:ee,STATE_POSSIBLE:ot,STATE_BEGAN:tt,STATE_CHANGED:_t,STATE_ENDED:gt,STATE_RECOGNIZED:ft,STATE_CANCELLED:At,STATE_FAILED:dt,DIRECTION_NONE:re,DIRECTION_LEFT:le,DIRECTION_RIGHT:ae,DIRECTION_UP:oe,DIRECTION_DOWN:se,DIRECTION_HORIZONTAL:pe,DIRECTION_VERTICAL:de,DIRECTION_ALL:xe,Manager:xt,Input:j,TouchAction:Tt,TouchInput:He,MouseInput:Te,PointerEventInput:Ne,TouchMouseInput:Ye,SingleTouchInput:je,Recognizer:ht,AttrRecognizer:ct,Tap:It,Pan:wt,Swipe:yt,Pinch:Ht,Rotate:Mt,Press:Ft,on:_,off:S,each:h,merge:E,extend:m,assign:A,inherit:v,bindFn:y,prefixed:I}),St}(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 BaseController=function(n){__extends(t,n);function t(e){var r,o,s,u=n.call(this)||this,l=t.parseArgs(e);return u.mode="",u.pending=new Set,u.userAction=l.initial.userAction,u.destroyed=!1,u.ident=l.ident,u.scene=l.scene,u.modelScene=l.modelScene,u.xrCustomObjectsScene=l.xrCustomObjectsScene,u.helper=l.helper,u.boundingMesh=l.boundingMesh,u.camera=l.camera,u.renderer=l.renderer,u.viewport=l.viewport,u.element=l.element,u.enableWheel=l.enableWheel,u.works=l.works,u.imageOptions=l.imageOptions,u.videoTexture=l.videoTexture,u.extraElements=l.extraElements,u.initial=l.initial,u.currentPano=typeof u.initial.state.panoIndex=="number"?{workCode:(s=(r=u.initial.state.workCode)!==null&&r!==void 0?r:(o=l.works[0])===null||o===void 0?void 0:o.workCode)!==null&&s!==void 0?s:"",panoIndex:u.initial.state.panoIndex}:{workCode:u.initial.currentState.workCode,panoIndex:u.initial.currentState.panoIndex},u.needsRender=!0,u.modelSceneNeedsRender=!0,u.cameraMotion=new Motion({longitude:{value:u.camera.pose.longitude,circle:[0,Math.PI*2]},latitude:u.camera.pose.latitude,fov:u.camera.pose.fov}),u.inMomentumMovement=null,u.eventUnbinds=[l.element].concat(l.extraElements||[]).map(function(c){return u.bindEvents(c)}),u.initAnimationIsReady=!1,u.pending.add("init-animation"),u.initAnimationReady=new Promise(function(c){AnimationFrameLoop.shared.add(function(){u.initAnimation().then(function(){u.initAnimationIsReady=!0,u.pending.delete("init-animation"),c()})},!0,0)}),u}return t.parseArgs=function(e){return e instanceof t?e:__assign({},e)},t.initAnimationEndState=function(e){var r,o,s,u,l,c,p,f,d=this.parseArgs(e),h=d.initial,g=h.state,A=h.currentState,m=typeof g.panoIndex=="number"?{workCode:(s=(r=g.workCode)!==null&&r!==void 0?r:(o=d.works[0])===null||o===void 0?void 0:o.workCode)!==null&&s!==void 0?s:"",panoIndex:g.panoIndex}:{workCode:A.workCode,panoIndex:A.panoIndex};return __assign(__assign({},m),{mode:"",longitude:(u=g.longitude)!==null&&u!==void 0?u:A.longitude,latitude:(l=g.latitude)!==null&&l!==void 0?l:A.latitude,fov:(c=g.fov)!==null&&c!==void 0?c:A.fov,offset:(p=g.offset)!==null&&p!==void 0?p:A.offset,distance:(f=g.distance)!==null&&f!==void 0?f:A.distance})},t.prototype.updateConfiguration=function(e){return!0},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.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){e.render(r)},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 p=c[l];u.push({key:p.key,progress:p.progress,value:{longitude:p.value.longitude,latitude:p.value.latitude,fov:p.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,p=(o=e.latitude)!==null&&o!==void 0?o:this.camera.pose.latitude,f=(s=e.fov)!==null&&s!==void 0?s:this.camera.pose.fov,d=(u=e.distance)!==null&&u!==void 0?u:this.camera.pose.distance,h=(l=e.offset)!==null&&l!==void 0?l:this.camera.pose.offset,g=notSimilarValue(c,this.camera.pose.longitude,Math.PI*2)||notSimilarValue(p,this.camera.pose.latitude),A=notSimilarValue(f,this.camera.pose.fov),m=notSimilarValue(d,this.camera.pose.distance),E=notSimilarVector3(h,this.camera.pose.offset);(A||g||E||m)&&(this.camera.setFromPose({longitude:c,latitude:p,fov:f,distance:d,offset:h}),this.emit("camera.update",createEvent("camera.update",{userAction:this.userAction,state:__assign(__assign({},this.currentPano),{mode:this.mode,longitude:c,latitude:p,fov:f,offset:h,distance:d})})),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.viewport)},t.prototype.bindEvents=function(e){var r=this,o=function(C){var w=calculateThreeMouse(C,r.element,r.viewport);return!(Math.abs(w.x)>1||Math.abs(w.y)>1)},s=new Hammer.Manager(e),u=function(C){var w=C.session;return w.firstInput||null},l=new Hammer.Pan({threshold:10,pointers:0}),c=new Hammer.Tap({interval:410}),p=new Hammer.Pinch({threshold:0,pointers:2});s.add([l,c,p]),s.on("panstart pan",function(C){var w=u(s);if(!(w&&!o(w.center))){var I=createEvent("gesture.pan",{target:C.target,pointerType:C.pointerType,srcEvent:C.srcEvent,pointers:C.pointers.map(function(O){var L=r.relativeClientPosition(O),N=new THREE__namespace.Raycaster;return N.params.Points={threshold:.1},N.setFromCamera(L,r.camera),{x:O.x,y:O.y,delta:0,buttons:0,coords:L,raycaster:N}}),isFirst:C.isFirst,isFinal:C.isFinal,scale:C.scale,center:function(O){var L=r.relativeClientPosition(O),N=new THREE__namespace.Raycaster;return N.params.Points={threshold:.1},N.setFromCamera(L,r.camera),{x:O.x,y:O.y,delta:0,buttons:0,coords:L,raycaster:N}}(C.center),velocityX:C.velocityX,velocityY:C.velocityY,overallVelocityX:C.overallVelocityX,overallVelocityY:C.overallVelocityY,userAction:!0,state:__assign(__assign({mode:r.mode},r.currentPano),clonePose(r.camera.pose))});r.onPanGesture(I),b()}}),s.on("tap",function(C){if(!(C.pointerType==="mouse"&&C.srcEvent.button!==0)){var w=u(s);if(!(w&&!o(w.center))){var I=createEvent("gesture.tap",{target:C.target,pointerType:C.pointerType,srcEvent:C.srcEvent,pointers:C.pointers.map(function(O){var L=r.relativeClientPosition(O),N=new THREE__namespace.Raycaster;return N.params.Points={threshold:.1},N.setFromCamera(L,r.camera),{x:O.x,y:O.y,delta:0,buttons:0,coords:L,raycaster:N}}),isFirst:!0,isFinal:!0,scale:C.scale,center:function(O){var L=r.relativeClientPosition(O),N=new THREE__namespace.Raycaster;return N.params.Points={threshold:.1},N.setFromCamera(L,r.camera),{x:O.x,y:O.y,delta:0,buttons:0,coords:L,raycaster:N}}(C.center),velocityX:C.velocityX,velocityY:C.velocityY,overallVelocityX:C.overallVelocityX,overallVelocityY:C.overallVelocityY,userAction:!0,state:__assign(__assign({mode:r.mode},r.currentPano),clonePose(r.camera.pose))});r.onTapGesture(I),b()}}}),s.on("pinchstart pinch pinchend",function(C){var w=u(s);if(!(w&&!o(w.center))){var I=createEvent("gesture.pinch",{target:C.target,pointerType:C.pointerType,srcEvent:C.srcEvent,pointers:C.pointers.map(function(O){var L,N=r.relativeClientPosition(O),z=new THREE__namespace.Raycaster;return z.params.Points={threshold:.1},z.setFromCamera(N,r.camera),{x:O.x,y:O.y,delta:(L=O.delta)!==null&&L!==void 0?L:0,buttons:0,coords:N,raycaster:z}}),isFirst:C.type==="pinchstart",isFinal:C.type==="pinchend",scale:C.scale,center:function(O){var L=r.relativeClientPosition(O),N=new THREE__namespace.Raycaster;return N.params.Points={threshold:.1},N.setFromCamera(L,r.camera),{x:O.x,y:O.y,delta:0,buttons:0,coords:L,raycaster:N}}(C.center),velocityX:C.velocityX,velocityY:C.velocityY,overallVelocityX:C.overallVelocityX,overallVelocityY:C.overallVelocityY,userAction:!0,state:__assign(__assign({mode:r.mode},r.currentPano),clonePose(r.camera.pose))});r.onPinchGesture(I),b()}}),s.on("dbltap",function(C){if(!(C.pointerType==="mouse"&&C.srcEvent.button!==0)){var w=u(s);if(!(w&&!o(w.center))){var I=createEvent("gesture.dbltap",{target:C.target,pointerType:C.pointerType,srcEvent:C.srcEvent,pointers:C.pointers.map(function(O){var L=r.relativeClientPosition(O),N=new THREE__namespace.Raycaster;return N.params.Points={threshold:.1},N.setFromCamera(L,r.camera),{x:O.x,y:O.y,delta:0,buttons:0,coords:L,raycaster:N}}),isFirst:!0,isFinal:!0,scale:C.scale,center:function(O){var L=r.relativeClientPosition(O),N=new THREE__namespace.Raycaster;return N.params.Points={threshold:.1},N.setFromCamera(L,r.camera),{x:O.x,y:O.y,delta:0,buttons:0,coords:L,raycaster:N}}(C.center),velocityX:C.velocityX,velocityY:C.velocityY,overallVelocityX:C.overallVelocityX,overallVelocityY:C.overallVelocityY,userAction:!0,state:__assign(__assign({mode:r.mode},r.currentPano),clonePose(r.camera.pose))});r.onDblTapGesture(I),b()}}});var f=null,d=null,h=function(C,w,I){var O={x:I.clientX,y:I.clientY},L=r.relativeClientPosition(O),N=new THREE__namespace.Raycaster;N.params.Points={threshold:.1},N.setFromCamera(L,r.camera);var z=__assign(__assign({},O),{coords:L,raycaster:N,buttons:I.buttons,delta:0}),J=C==="pinchend"?w:w-I.deltaY/280,K=createEvent("gesture.pinch",{target:I.target,pointerType:"mouse",srcEvent:I,pointers:[__assign({},z)],isFirst:C==="pinchstart",isFinal:C==="pinchend",scale:clamp$1(J,.1,10),center:__assign({},z),velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0,userAction:!0,state:__assign(__assign({mode:r.mode},r.currentPano),clonePose(r.camera.pose))});return K},g=function(C){var w,I={x:C.clientX,y:C.clientY};if(o(I)){if(C.preventDefault(),C.ctrlKey){var O=(w=f==null?void 0:f.prevEvent.scale)!==null&&w!==void 0?w:1,L=h(f?"pinch":"pinchstart",O,C);f===null?f={firstEvent:L,prevEvent:L}:f.prevEvent=L,r.onPinchGesture(L),d!==null&&window.clearTimeout(d),d=window.setTimeout(function(){var q;d=null;var X=(q=f==null?void 0:f.prevEvent.scale)!==null&&q!==void 0?q:1,Z=h("pinchend",X,C);f=null,r.onPinchGesture(Z)},200)}else{var N=(Math.abs(C.deltaY)>Math.abs(C.deltaX)?C.deltaY:C.deltaX)/-60,z=r.mouseWheelState!==void 0,J={x:C.clientX,y:C.clientY},K=r.relativeClientPosition(J),Q=new THREE__namespace.Raycaster;Q.params.Points={threshold:.1},Q.setFromCamera(K,r.camera);var U=__assign(__assign({},J),{coords:K,raycaster:Q,buttons:C.buttons,delta:N}),L=createEvent("gesture.mousewheel",{target:C.target,pointerType:"mouse",srcEvent:C,pointers:[__assign({},U)],isFirst:z,isFinal:!1,scale:0,center:__assign({},U),velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0,userAction:!0,state:__assign(__assign({mode:r.mode},r.currentPano),clonePose(r.camera.pose))});r.onMouseWheel(L),r.mouseWheelState&&clearTimeout(r.mouseWheelState.timer),r.mouseWheelState={timer:setTimeout(function(){delete r.mouseWheelState;var X=createEvent("gesture.mousewheel",{target:C.target,pointerType:"mouse",srcEvent:C,pointers:[__assign(__assign({},U),{delta:0})],isFirst:!1,isFinal:!0,scale:0,center:__assign(__assign({},U),{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(X)},100)}}b()}},A=function(C){if(!isMobile){if(!o({x:C.clientX,y:C.clientY})){m();return}var w=!1;r.mouseMoveState||(w=!0);var I={x:C.clientX,y:C.clientY},O=r.relativeClientPosition(I),L=new THREE__namespace.Raycaster;L.params.Points={threshold:.1},L.setFromCamera(O,r.camera);var N=__assign(__assign({},I),{coords:O,raycaster:L,buttons:C.buttons,delta:0}),z=createEvent("gesture.mousemove",{target:C.target,pointerType:"mouse",srcEvent:C,pointers:[__assign({},N)],isFirst:w,isFinal:!1,scale:0,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))});r.mouseMoveState={timeStamp:now(),event:z},r.onMouseMove(z),r.pressState&&Math.abs(C.clientX-r.pressState.event.center.y)>10&&Math.abs(C.clientY-r.pressState.event.center.y)>10&&b()}},m=function(){if(r.mouseMoveState){var C=createEvent(r.mouseMoveState.event.type,__assign(__assign({},r.mouseMoveState.event),{isFinal:!0}));delete r.mouseMoveState,r.onMouseMove(C)}b()},E=function(C){if(!o(C.center)){b();return}var w=!1;r.pressState||(w=!0,r.pressState={event:C,timeStamp:now(),stop:noop$1});var I=now()-r.pressState.timeStamp,O=createEvent(r.pressState.event.type,__assign(__assign({},r.pressState.event),{isFirst:w,isFinal:!1,center:__assign(__assign({},r.pressState.event.center),{delta:I}),pointers:r.pressState.event.pointers.map(function(L){return __assign(__assign({},L),{delta:I})})}));r.onPressGesture(O),r.pressState&&(r.pressState.stop=AnimationFrameLoop.shared.add(function(L){E(C)},!0,1))},v=function(C){if(b(),!(C.touches.length>1||C.changedTouches.length<=0)){var w={x:C.changedTouches[0].clientX,y:C.changedTouches[0].clientY},I=r.relativeClientPosition(w),O=new THREE__namespace.Raycaster;O.params.Points={threshold:.1},O.setFromCamera(I,r.camera);var L=__assign(__assign({},w),{coords:I,raycaster:O,buttons:0,delta:0}),N=createEvent("gesture.press",{target:C.target,pointerType:"touch",srcEvent:C,pointers:[__assign({},L)],isFirst:!1,isFinal:!1,scale:0,center:L,velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0,userAction:!0,state:__assign(__assign({mode:r.mode},r.currentPano),clonePose(r.camera.pose))});E(N)}},y=function(C){b();var w={x:C.clientX,y:C.clientY},I=r.relativeClientPosition(w),O=new THREE__namespace.Raycaster;O.params.Points={threshold:.1},O.setFromCamera(I,r.camera);var L=__assign(__assign({},w),{coords:I,raycaster:O,buttons:C.buttons,delta:0}),N=createEvent("gesture.press",{target:C.target,pointerType:"mouse",srcEvent:C,pointers:[__assign({},L)],isFirst:!1,isFinal:!1,scale:0,center:L,velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0,userAction:!0,state:__assign(__assign({mode:r.mode},r.currentPano),clonePose(r.camera.pose))});E(N)},b=function(){var C;if(r.pressState){var w=now()-r.pressState.timeStamp,I=createEvent(r.pressState.event.type,__assign(__assign({},r.pressState.event),{center:__assign(__assign({},r.pressState.event.center),{delta:w}),isFirst:!1,isFinal:!0,pointers:r.pressState.event.pointers.map(function(O){return __assign(__assign({},O),{delta:w})})}));r.onPressGesture(I),(C=r.pressState)===null||C===void 0||C.stop(),delete r.pressState}},T=null,_=function(C){var w,I=!1,O=!1;switch(C.type){case"gesturestart":I=!0;break;case"gestureend":O=!0;break}var L={x:C.clientX,y:C.clientY},N=r.relativeClientPosition(L),z=new THREE__namespace.Raycaster;z.params.Points={threshold:.1},z.setFromCamera(N,r.camera);var J=__assign(__assign({},L),{coords:N,raycaster:z,buttons:0,delta:0}),K=createEvent("gesture.pinch",{target:C.target,pointerType:"mouse",srcEvent:C,pointers:[__assign({},J)],isFirst:I,isFinal:O,scale:(w=C.scale)!==null&&w!==void 0?w:1,center:__assign({},J),velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0,userAction:!0,state:__assign(__assign({mode:r.mode},r.currentPano),clonePose(r.camera.pose))});return K},S=function(C){if(C.preventDefault(),!isMobile){var w=_(C);T={firstEvent:w};var I=T.firstEvent;I&&!o(I.center)||r.onPinchGesture(w)}},R=function(C){if(C.preventDefault(),!isMobile&&T){var w=_(C),I=T.firstEvent;I&&!o(I.center)||r.onPinchGesture(w)}},M=function(C){if(C.preventDefault(),!isMobile&&T){var w=_(C),I=T.firstEvent;T=null,!(I&&!o(I.center))&&r.onPinchGesture(w)}},H=function(C){if(C&&typeof C.preventDefault=="function"&&C.currentTarget===e&&C.preventDefault(),typeof getSelection=="function"){var w=getSelection();w&&w.focusNode&&(w.removeAllRanges&&w.removeAllRanges(),w.empty&&w.empty())}};this.enableWheel&&e.addEventListener("wheel",g,{passive:!1}),e.addEventListener("mousemove",A,!1),e.addEventListener("mouseout",m,!1),e.addEventListener("touchstart",v,{passive:!0}),e.addEventListener("touchend",b,!1),e.addEventListener("touchcancel",b,!1),e.addEventListener("mousedown",y,!1),e.addEventListener("mouseup",b,!1),e.addEventListener("gesturestart",S,{passive:!1}),e.addEventListener("gesturechange",R,{passive:!1}),e.addEventListener("gestureend",M,{passive:!1}),e.addEventListener("touchstart",H,{passive:!1}),e.addEventListener("contextmenu",H,!1);var B=function(){s.destroy(),e.removeEventListener("wheel",g,!1),e.removeEventListener("mousemove",A,!1),e.removeEventListener("mouseout",m,!1),e.removeEventListener("touchstart",v,!1),e.removeEventListener("touchend",b,!1),e.removeEventListener("touchcancel",b,!1),e.removeEventListener("mousedown",y,!1),e.removeEventListener("mouseup",b,!1),e.removeEventListener("gesturestart",S,!1),e.removeEventListener("gesturechange",R,!1),e.removeEventListener("gestureend",M,!1),e.removeEventListener("touchstart",H,!1),e.removeEventListener("contextmenu",H,!1)};return Object.assign(B,{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"])),p=s.images[l],f=applyImageURLOptions(p,o.imageOptions.transform,c);return getFetcher(s.work).preload(f,{timeout:500})})).then(function(){return r(e),e})},t}(Subscribe),sharedGeometry$2=new THREE__namespace.CircleBufferGeometry(.1,16),vertexShader$3=`
|
|
1391
|
+
`;return function(){var $=new Error("get-stack-trace"),ue=$&&$.stack?$.stack.replace(/^[^\(]+?[\n$]/gm,"").replace(/^\s+at\s+/gm,"").replace(/^Object.<anonymous>\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",Ae=n.console&&(n.console.warn||n.console.log);return Ae&&Ae.call(n.console,D,ue),P.apply(this,arguments)}}var A;typeof Object.assign!="function"?A=function(F){if(F===r||F===null)throw new TypeError("Cannot convert undefined or null to object");for(var k=Object(F),D=1;D<arguments.length;D++){var $=arguments[D];if($!==r&&$!==null)for(var ue in $)$.hasOwnProperty(ue)&&(k[ue]=$[ue])}return k}:A=Object.assign;var m=g(function(F,k,D){for(var $=Object.keys(k),ue=0;ue<$.length;)(!D||D&&F[$[ue]]===r)&&(F[$[ue]]=k[$[ue]]),ue++;return F},"extend","Use `assign`."),E=g(function(F,k){return m(F,k,!0)},"merge","Use `assign`.");function v(P,F,k){var D=F.prototype,$;$=P.prototype=Object.create(D),$.constructor=P,$._super=D,k&&A($,k)}function y(P,F){return function(){return P.apply(F,arguments)}}function b(P,F){return typeof P==u?P.apply(F&&F[0]||r,F):P}function T(P,F){return P===r?F:P}function _(P,F,k){h(H(F),function(D){P.addEventListener(D,k,!1)})}function S(P,F,k){h(H(F),function(D){P.removeEventListener(D,k,!1)})}function R(P,F){for(;P;){if(P==F)return!0;P=P.parentNode}return!1}function M(P,F){return P.indexOf(F)>-1}function H(P){return P.trim().split(/\s+/g)}function B(P,F,k){if(P.indexOf&&!k)return P.indexOf(F);for(var D=0;D<P.length;){if(k&&P[D][k]==F||!k&&P[D]===F)return D;D++}return-1}function C(P){return Array.prototype.slice.call(P,0)}function w(P,F,k){for(var D=[],$=[],ue=0;ue<P.length;){var Ae=P[ue][F];B($,Ae)<0&&D.push(P[ue]),$[ue]=Ae,ue++}return D=D.sort(function(st,ke){return st[F]>ke[F]}),D}function I(P,F){for(var k,D,$=F[0].toUpperCase()+F.slice(1),ue=0;ue<o.length;){if(k=o[ue],D=k?k+$:F,D in P)return D;ue++}return r}var O=1;function L(){return O++}function N(P){var F=P.ownerDocument||P;return F.defaultView||F.parentWindow||n}var z=/mobile|tablet|ip(ad|hone|od)|android/i,J="ontouchstart"in n,G=I(n,"PointerEvent")!==r,Q=J&&z.test(navigator.userAgent),U="touch",q="pen",K="mouse",Y="kinect",Z=25,te=1,j=2,ee=4,W=8,re=1,le=2,ae=4,oe=8,se=16,ce=le|ae,ve=oe|se,Te=ce|ve,pe=["x","y"],me=["clientX","clientY"];function X(P,F){var k=this;this.manager=P,this.callback=F,this.element=P.element,this.target=P.options.inputTarget,this.domHandler=function(D){b(P.options.enable,[P])&&k.handler(D)},this.init()}X.prototype={handler:function(){},init:function(){this.evEl&&_(this.element,this.evEl,this.domHandler),this.evTarget&&_(this.target,this.evTarget,this.domHandler),this.evWin&&_(N(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&S(this.element,this.evEl,this.domHandler),this.evTarget&&S(this.target,this.evTarget,this.domHandler),this.evWin&&S(N(this.element),this.evWin,this.domHandler)}};function ne(P){var F,k=P.options.inputClass;return k?F=k:G?F=He:Q?F=Oe:J?F=Ze:F=Me,new F(P,V)}function V(P,F,k){var D=k.pointers.length,$=k.changedPointers.length,ue=F&te&&D-$===0,Ae=F&(ee|W)&&D-$===0;k.isFirst=!!ue,k.isFinal=!!Ae,ue&&(P.session={}),k.eventType=F,Ee(P,k),P.emit("hammer.input",k),P.recognize(k),P.session.prevInput=k}function Ee(P,F){var k=P.session,D=F.pointers,$=D.length;k.firstInput||(k.firstInput=Ne(F)),$>1&&!k.firstMultiple?k.firstMultiple=Ne(F):$===1&&(k.firstMultiple=!1);var ue=k.firstInput,Ae=k.firstMultiple,Xe=Ae?Ae.center:ue.center,st=F.center=rt(D);F.timeStamp=p(),F.deltaTime=F.timeStamp-ue.timeStamp,F.angle=de(Xe,st),F.distance=ie(Xe,st),fe(k,F),F.offsetDirection=ge(F.deltaX,F.deltaY);var ke=Ye(F.deltaTime,F.deltaX,F.deltaY);F.overallVelocityX=ke.x,F.overallVelocityY=ke.y,F.overallVelocity=c(ke.x)>c(ke.y)?ke.x:ke.y,F.scale=Ae?Se(Ae.pointers,D):1,F.rotation=Ae?Ce(Ae.pointers,D):0,F.maxPointers=k.prevInput?F.pointers.length>k.prevInput.maxPointers?F.pointers.length:k.prevInput.maxPointers:F.pointers.length,he(k,F);var At=P.element;R(F.srcEvent.target,At)&&(At=F.srcEvent.target),F.target=At}function fe(P,F){var k=F.center,D=P.offsetDelta||{},$=P.prevDelta||{},ue=P.prevInput||{};(F.eventType===te||ue.eventType===ee)&&($=P.prevDelta={x:ue.deltaX||0,y:ue.deltaY||0},D=P.offsetDelta={x:k.x,y:k.y}),F.deltaX=$.x+(k.x-D.x),F.deltaY=$.y+(k.y-D.y)}function he(P,F){var k=P.lastInterval||F,D=F.timeStamp-k.timeStamp,$,ue,Ae,Xe;if(F.eventType!=W&&(D>Z||k.velocity===r)){var st=F.deltaX-k.deltaX,ke=F.deltaY-k.deltaY,At=Ye(D,st,ke);ue=At.x,Ae=At.y,$=c(At.x)>c(At.y)?At.x:At.y,Xe=ge(st,ke),P.lastInterval=F}else $=k.velocity,ue=k.velocityX,Ae=k.velocityY,Xe=k.direction;F.velocity=$,F.velocityX=ue,F.velocityY=Ae,F.direction=Xe}function Ne(P){for(var F=[],k=0;k<P.pointers.length;)F[k]={clientX:l(P.pointers[k].clientX),clientY:l(P.pointers[k].clientY)},k++;return{timeStamp:p(),pointers:F,center:rt(F),deltaX:P.deltaX,deltaY:P.deltaY}}function rt(P){var F=P.length;if(F===1)return{x:l(P[0].clientX),y:l(P[0].clientY)};for(var k=0,D=0,$=0;$<F;)k+=P[$].clientX,D+=P[$].clientY,$++;return{x:l(k/F),y:l(D/F)}}function Ye(P,F,k){return{x:F/P||0,y:k/P||0}}function ge(P,F){return P===F?re:c(P)>=c(F)?P<0?le:ae:F<0?oe:se}function ie(P,F,k){k||(k=pe);var D=F[k[0]]-P[k[0]],$=F[k[1]]-P[k[1]];return Math.sqrt(D*D+$*$)}function de(P,F,k){k||(k=pe);var D=F[k[0]]-P[k[0]],$=F[k[1]]-P[k[1]];return Math.atan2($,D)*180/Math.PI}function Ce(P,F){return de(F[1],F[0],me)+de(P[1],P[0],me)}function Se(P,F){return ie(F[0],F[1],me)/ie(P[0],P[1],me)}var Be={mousedown:te,mousemove:j,mouseup:ee},Le="mousedown",be="mousemove mouseup";function Me(){this.evEl=Le,this.evWin=be,this.pressed=!1,X.apply(this,arguments)}v(Me,X,{handler:function(F){var k=Be[F.type];k&te&&(F.button===0||F.button===2)&&(this.pressed=!0),k&j&&F.which!==1&&(k=ee),this.pressed&&(k&ee&&(this.pressed=!1),this.callback(this.manager,k,{pointers:[F],changedPointers:[F],pointerType:K,srcEvent:F}))}});var we={pointerdown:te,pointermove:j,pointerup:ee,pointercancel:W,pointerout:W},Pe={2:U,3:q,4:K,5:Y},ze="pointerdown",Ge="pointermove pointerup pointercancel";n.MSPointerEvent&&!n.PointerEvent&&(ze="MSPointerDown",Ge="MSPointerMove MSPointerUp MSPointerCancel");function He(){this.evEl=ze,this.evWin=Ge,X.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}v(He,X,{handler:function(F){var k=this.store,D=!1,$=!1,ue=F.type.toLowerCase().replace("ms",""),Ae=we[ue],Xe=Pe[F.pointerType]||F.pointerType,st=Xe==U,ke=B(k,F.pointerId,"pointerId");Ae&te&&(F.button===0||F.button===2||st)?ke<0&&(k.push(F),ke=k.length-1):Ae&(ee|W)?D=!0:!st&&F.buttons===0&&(D=!0,$=!0,Ae=we.pointerup),!(ke<0)&&($||(k[ke]=F),this.callback(this.manager,Ae,{pointers:k,changedPointers:[F],pointerType:Xe,srcEvent:k[ke]}),D&&k.splice(ke,1))}});var Ve={touchstart:te,touchmove:j,touchend:ee,touchcancel:W},$e="touchstart",Ie="touchstart touchmove touchend touchcancel";function je(){this.evTarget=$e,this.evWin=Ie,this.started=!1,X.apply(this,arguments)}v(je,X,{handler:function(F){var k=Ve[F.type];if(k===te&&(this.started=!0),!!this.started){var D=xe.call(this,F,k);k&(ee|W)&&D[0].length-D[1].length===0&&(this.started=!1),this.callback(this.manager,k,{pointers:D[0],changedPointers:D[1],pointerType:U,srcEvent:F})}}});function xe(P,F){var k=C(P.touches),D=C(P.changedTouches);return F&(ee|W)&&(k=w(k.concat(D),"identifier")),[k,D]}var We={touchstart:te,touchmove:j,touchend:ee,touchcancel:W},_e="touchstart touchmove touchend touchcancel";function Oe(){this.evTarget=_e,this.targetIds={},X.apply(this,arguments)}v(Oe,X,{handler:function(F){var k=We[F.type],D=Fe.call(this,F,k);D&&this.callback(this.manager,k,{pointers:D[0],changedPointers:D[1],pointerType:U,srcEvent:F})}});function Fe(P,F){var k=C(P.touches),D=this.targetIds;if(F&(te|j)&&k.length===1)return D[k[0].identifier]=!0,[k,k];var $,ue,Ae=C(P.changedTouches),Xe=[],st=this.target;if(ue=k.filter(function(ke){return R(ke.target,st)}),F===te)for($=0;$<ue.length;)D[ue[$].identifier]=!0,$++;for($=0;$<Ae.length;)D[Ae[$].identifier]&&Xe.push(Ae[$]),F&(ee|W)&&delete D[Ae[$].identifier],$++;if(Xe.length)return[w(ue.concat(Xe),"identifier"),Xe]}var qe=2500,nt=25;function Ze(){X.apply(this,arguments);var P=y(this.handler,this);this.touch=new Oe(this.manager,P),this.mouse=new Me(this.manager,P),this.primaryTouch=null,this.lastTouches=[]}v(Ze,X,{handler:function(F,k,D){var $=D.pointerType==U,ue=D.pointerType==K;if(!(ue&&D.sourceCapabilities&&D.sourceCapabilities.firesTouchEvents)){if($)ut.call(this,k,D);else if(ue&&Re.call(this,D))return;this.callback(F,k,D)}},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});function ut(P,F){P&te?(this.primaryTouch=F.changedPointers[0].identifier,Ue.call(this,F)):P&(ee|W)&&Ue.call(this,F)}function Ue(P){var F=P.changedPointers[0];if(F.identifier===this.primaryTouch){var k={x:F.clientX,y:F.clientY};this.lastTouches.push(k);var D=this.lastTouches,$=function(){var ue=D.indexOf(k);ue>-1&&D.splice(ue,1)};setTimeout($,qe)}}function Re(P){for(var F=P.srcEvent.clientX,k=P.srcEvent.clientY,D=0;D<this.lastTouches.length;D++){var $=this.lastTouches[D],ue=Math.abs(F-$.x),Ae=Math.abs(k-$.y);if(ue<=nt&&Ae<=nt)return!0}return!1}var yt=s?I(s.style,"touchAction"):r,at=yt!==r,Ke="compute",lt="auto",pt="manipulation",Qe="none",ye="pan-x",tt="pan-y",Et=Pt();function wt(P,F){this.manager=P,this.set(F)}wt.prototype={set:function(P){P==Ke&&(P=this.compute()),at&&this.manager.element.style&&Et[P]&&(this.manager.element.style[yt]=P),this.actions=P.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var P=[];return h(this.manager.recognizers,function(F){b(F.options.enable,[F])&&(P=P.concat(F.getTouchAction()))}),St(P.join(" "))},preventDefaults:function(P){var F=P.srcEvent,k=P.offsetDirection;if(this.manager.session.prevented){F.preventDefault();return}var D=this.actions,$=M(D,Qe)&&!Et[Qe],ue=M(D,tt)&&!Et[tt],Ae=M(D,ye)&&!Et[ye];if($){var Xe=P.pointers.length===1,st=P.distance<2,ke=P.deltaTime<250;if(Xe&&st&&ke)return}if(!(Ae&&ue)&&($||ue&&k&ce||Ae&&k&ve))return this.preventSrc(F)},preventSrc:function(P){this.manager.session.prevented=!0,P.preventDefault()}};function St(P){if(M(P,Qe))return Qe;var F=M(P,ye),k=M(P,tt);return F&&k?Qe:F||k?F?ye:tt:M(P,pt)?pt:lt}function Pt(){if(!at)return!1;var P={},F=n.CSS&&n.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach(function(k){P[k]=F?n.CSS.supports("touch-action",k):!0}),P}var xt=1,De=2,gt=4,dt=8,ht=dt,bt=16,it=32;function vt(P){this.options=A({},this.defaults,P||{}),this.id=L(),this.manager=null,this.options.enable=T(this.options.enable,!0),this.state=xt,this.simultaneous={},this.requireFail=[]}vt.prototype={defaults:{},set:function(P){return A(this.options,P),this.manager&&this.manager.touchAction.update(),this},recognizeWith:function(P){if(d(P,"recognizeWith",this))return this;var F=this.simultaneous;return P=ot(P,this),F[P.id]||(F[P.id]=P,P.recognizeWith(this)),this},dropRecognizeWith:function(P){return d(P,"dropRecognizeWith",this)?this:(P=ot(P,this),delete this.simultaneous[P.id],this)},requireFailure:function(P){if(d(P,"requireFailure",this))return this;var F=this.requireFail;return P=ot(P,this),B(F,P)===-1&&(F.push(P),P.requireFailure(this)),this},dropRequireFailure:function(P){if(d(P,"dropRequireFailure",this))return this;P=ot(P,this);var F=B(this.requireFail,P);return F>-1&&this.requireFail.splice(F,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(P){return!!this.simultaneous[P.id]},emit:function(P){var F=this,k=this.state;function D($){F.manager.emit($,P)}k<dt&&D(F.options.event+Bt(k)),D(F.options.event),P.additionalEvent&&D(P.additionalEvent),k>=dt&&D(F.options.event+Bt(k))},tryEmit:function(P){if(this.canEmit())return this.emit(P);this.state=it},canEmit:function(){for(var P=0;P<this.requireFail.length;){if(!(this.requireFail[P].state&(it|xt)))return!1;P++}return!0},recognize:function(P){var F=A({},P);if(!b(this.options.enable,[this,F])){this.reset(),this.state=it;return}this.state&(ht|bt|it)&&(this.state=xt),this.state=this.process(F),this.state&(De|gt|dt|bt)&&this.tryEmit(F)},process:function(P){},getTouchAction:function(){},reset:function(){}};function Bt(P){return P&bt?"cancel":P&dt?"end":P>?"move":P&De?"start":""}function ct(P){return P==se?"down":P==oe?"up":P==le?"left":P==ae?"right":""}function ot(P,F){var k=F.manager;return k?k.get(P):P}function Je(){vt.apply(this,arguments)}v(Je,vt,{defaults:{pointers:1},attrTest:function(P){var F=this.options.pointers;return F===0||P.pointers.length===F},process:function(P){var F=this.state,k=P.eventType,D=F&(De|gt),$=this.attrTest(P);return D&&(k&W||!$)?F|bt:D||$?k&ee?F|dt:F&De?F|gt:De:it}});function It(){Je.apply(this,arguments),this.pX=null,this.pY=null}v(It,Je,{defaults:{event:"pan",threshold:10,pointers:1,direction:Te},getTouchAction:function(){var P=this.options.direction,F=[];return P&ce&&F.push(tt),P&ve&&F.push(ye),F},directionTest:function(P){var F=this.options,k=!0,D=P.distance,$=P.direction,ue=P.deltaX,Ae=P.deltaY;return $&F.direction||(F.direction&ce?($=ue===0?re:ue<0?le:ae,k=ue!=this.pX,D=Math.abs(P.deltaX)):($=Ae===0?re:Ae<0?oe:se,k=Ae!=this.pY,D=Math.abs(P.deltaY))),P.direction=$,k&&D>F.threshold&&$&F.direction},attrTest:function(P){return Je.prototype.attrTest.call(this,P)&&(this.state&De||!(this.state&De)&&this.directionTest(P))},emit:function(P){this.pX=P.deltaX,this.pY=P.deltaY;var F=ct(P.direction);F&&(P.additionalEvent=this.options.event+F),this._super.emit.call(this,P)}});function Ht(){Je.apply(this,arguments)}v(Ht,Je,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[Qe]},attrTest:function(P){return this._super.attrTest.call(this,P)&&(Math.abs(P.scale-1)>this.options.threshold||this.state&De)},emit:function(P){if(P.scale!==1){var F=P.scale<1?"in":"out";P.additionalEvent=this.options.event+F}this._super.emit.call(this,P)}});function Ft(){vt.apply(this,arguments),this._timer=null,this._input=null}v(Ft,vt,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[lt]},process:function(P){var F=this.options,k=P.pointers.length===F.pointers,D=P.distance<F.threshold,$=P.deltaTime>F.time;if(this._input=P,!D||!k||P.eventType&(ee|W)&&!$)this.reset();else if(P.eventType&te)this.reset(),this._timer=f(function(){this.state=ht,this.tryEmit()},F.time,this);else if(P.eventType&ee)return ht;return it},reset:function(){clearTimeout(this._timer)},emit:function(P){this.state===ht&&(P&&P.eventType&ee?this.manager.emit(this.options.event+"up",P):(this._input.timeStamp=p(),this.manager.emit(this.options.event,this._input)))}});function Lt(){Je.apply(this,arguments)}v(Lt,Je,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[Qe]},attrTest:function(P){return this._super.attrTest.call(this,P)&&(Math.abs(P.rotation)>this.options.threshold||this.state&De)}});function Rt(){Je.apply(this,arguments)}v(Rt,Je,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:ce|ve,pointers:1},getTouchAction:function(){return It.prototype.getTouchAction.call(this)},attrTest:function(P){var F=this.options.direction,k;return F&(ce|ve)?k=P.overallVelocity:F&ce?k=P.overallVelocityX:F&ve&&(k=P.overallVelocityY),this._super.attrTest.call(this,P)&&F&P.offsetDirection&&P.distance>this.options.threshold&&P.maxPointers==this.options.pointers&&c(k)>this.options.velocity&&P.eventType&ee},emit:function(P){var F=ct(P.offsetDirection);F&&this.manager.emit(this.options.event+F,P),this.manager.emit(this.options.event,P)}});function mt(){vt.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}v(mt,vt,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[pt]},process:function(P){var F=this.options,k=P.pointers.length===F.pointers,D=P.distance<F.threshold,$=P.deltaTime<F.time;if(this.reset(),P.eventType&te&&this.count===0)return this.failTimeout();if(D&&$&&k){if(P.eventType!=ee)return this.failTimeout();var ue=this.pTime?P.timeStamp-this.pTime<F.interval:!0,Ae=!this.pCenter||ie(this.pCenter,P.center)<F.posThreshold;this.pTime=P.timeStamp,this.pCenter=P.center,!Ae||!ue?this.count=1:this.count+=1,this._input=P;var Xe=this.count%F.taps;if(Xe===0)return this.hasRequireFailures()?(this._timer=f(function(){this.state=ht,this.tryEmit()},F.interval,this),De):ht}return it},failTimeout:function(){return this._timer=f(function(){this.state=it},this.options.interval,this),it},reset:function(){clearTimeout(this._timer)},emit:function(){this.state==ht&&(this._input.tapCount=this.count,this.manager.emit(this.options.event,this._input))}});function Tt(P,F){return F=F||{},F.recognizers=T(F.recognizers,Tt.defaults.preset),new ft(P,F)}Tt.VERSION="2.0.7",Tt.defaults={domEvents:!1,touchAction:Ke,enable:!0,inputTarget:null,inputClass:null,preset:[[Lt,{enable:!1}],[Ht,{enable:!1},["rotate"]],[Rt,{direction:ce}],[It,{direction:ce},["swipe"]],[mt],[mt,{event:"doubletap",taps:2},["tap"]],[Ft]],cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}};var Ot=1,Ct=2;function ft(P,F){this.options=A({},Tt.defaults,F||{}),this.options.inputTarget=this.options.inputTarget||P,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=P,this.input=ne(this),this.touchAction=new wt(this,this.options.touchAction),_t(this,!0),h(this.options.recognizers,function(k){var D=this.add(new k[0](k[1]));k[2]&&D.recognizeWith(k[2]),k[3]&&D.requireFailure(k[3])},this)}ft.prototype={set:function(P){return A(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?Ct:Ot},recognize:function(P){var F=this.session;if(!F.stopped){this.touchAction.preventDefaults(P);var k,D=this.recognizers,$=F.curRecognizer;(!$||$&&$.state&ht)&&($=F.curRecognizer=null);for(var ue=0;ue<D.length;)k=D[ue],F.stopped!==Ct&&(!$||k==$||k.canRecognizeWith($))?k.recognize(P):k.reset(),!$&&k.state&(De|gt|dt)&&($=F.curRecognizer=k),ue++}},get:function(P){if(P instanceof vt)return P;for(var F=this.recognizers,k=0;k<F.length;k++)if(F[k].options.event==P)return F[k];return null},add:function(P){if(d(P,"add",this))return this;var F=this.get(P.options.event);return F&&this.remove(F),this.recognizers.push(P),P.manager=this,this.touchAction.update(),P},remove:function(P){if(d(P,"remove",this))return this;if(P=this.get(P),P){var F=this.recognizers,k=B(F,P);k!==-1&&(F.splice(k,1),this.touchAction.update())}return this},on:function(P,F){if(P!==r&&F!==r){var k=this.handlers;return h(H(P),function(D){k[D]=k[D]||[],k[D].push(F)}),this}},off:function(P,F){if(P!==r){var k=this.handlers;return h(H(P),function(D){F?k[D]&&k[D].splice(B(k[D],F),1):delete k[D]}),this}},emit:function(P,F){this.options.domEvents&&Mt(P,F);var k=this.handlers[P]&&this.handlers[P].slice();if(!(!k||!k.length)){F.type=P,F.preventDefault=function(){F.srcEvent.preventDefault()};for(var D=0;D<k.length;)k[D](F),D++}},destroy:function(){this.element&&_t(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}};function _t(P,F){var k=P.element;if(k.style){var D;h(P.options.cssProps,function($,ue){D=I(k.style,ue),F?(P.oldCssProps[D]=k.style[D],k.style[D]=$):k.style[D]=P.oldCssProps[D]||""}),F||(P.oldCssProps={})}}function Mt(P,F){var k=t.createEvent("Event");k.initEvent(P,!0,!0),k.gesture=F,F.target.dispatchEvent(k)}return A(Tt,{INPUT_START:te,INPUT_MOVE:j,INPUT_END:ee,INPUT_CANCEL:W,STATE_POSSIBLE:xt,STATE_BEGAN:De,STATE_CHANGED:gt,STATE_ENDED:dt,STATE_RECOGNIZED:ht,STATE_CANCELLED:bt,STATE_FAILED:it,DIRECTION_NONE:re,DIRECTION_LEFT:le,DIRECTION_RIGHT:ae,DIRECTION_UP:oe,DIRECTION_DOWN:se,DIRECTION_HORIZONTAL:ce,DIRECTION_VERTICAL:ve,DIRECTION_ALL:Te,Manager:ft,Input:X,TouchAction:wt,TouchInput:Oe,MouseInput:Me,PointerEventInput:He,TouchMouseInput:Ze,SingleTouchInput:je,Recognizer:vt,AttrRecognizer:Je,Tap:mt,Pan:It,Swipe:Rt,Pinch:Ht,Rotate:Lt,Press:Ft,on:_,off:S,each:h,merge:E,extend:m,assign:A,inherit:v,bindFn:y,prefixed:I}),Tt}(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 BaseController=function(n){__extends(t,n);function t(e){var r,o,s,u=n.call(this)||this,l=t.parseArgs(e);return u.mode="",u.pending=new Set,u.userAction=l.initial.userAction,u.destroyed=!1,u.ident=l.ident,u.scene=l.scene,u.modelScene=l.modelScene,u.xrCustomObjectsScene=l.xrCustomObjectsScene,u.helper=l.helper,u.boundingMesh=l.boundingMesh,u.camera=l.camera,u.renderer=l.renderer,u.viewport=l.viewport,u.element=l.element,u.enableWheel=l.enableWheel,u.works=l.works,u.imageOptions=l.imageOptions,u.videoTexture=l.videoTexture,u.extraElements=l.extraElements,u.initial=l.initial,u.currentPano=typeof u.initial.state.panoIndex=="number"?{workCode:(s=(r=u.initial.state.workCode)!==null&&r!==void 0?r:(o=l.works[0])===null||o===void 0?void 0:o.workCode)!==null&&s!==void 0?s:"",panoIndex:u.initial.state.panoIndex}:{workCode:u.initial.currentState.workCode,panoIndex:u.initial.currentState.panoIndex},u.needsRender=!0,u.modelSceneNeedsRender=!0,u.cameraMotion=new Motion({longitude:{value:u.camera.pose.longitude,circle:[0,Math.PI*2]},latitude:u.camera.pose.latitude,fov:u.camera.pose.fov}),u.inMomentumMovement=null,u.eventUnbinds=[l.element].concat(l.extraElements||[]).map(function(c){return u.bindEvents(c)}),u.initAnimationIsReady=!1,u.pending.add("init-animation"),u.initAnimationReady=new Promise(function(c){AnimationFrameLoop.shared.add(function(){u.initAnimation().then(function(){u.initAnimationIsReady=!0,u.pending.delete("init-animation"),c()})},!0,0)}),u}return t.parseArgs=function(e){return e instanceof t?e:__assign({},e)},t.initAnimationEndState=function(e){var r,o,s,u,l,c,p,f,d=this.parseArgs(e),h=d.initial,g=h.state,A=h.currentState,m=typeof g.panoIndex=="number"?{workCode:(s=(r=g.workCode)!==null&&r!==void 0?r:(o=d.works[0])===null||o===void 0?void 0:o.workCode)!==null&&s!==void 0?s:"",panoIndex:g.panoIndex}:{workCode:A.workCode,panoIndex:A.panoIndex};return __assign(__assign({},m),{mode:"",longitude:(u=g.longitude)!==null&&u!==void 0?u:A.longitude,latitude:(l=g.latitude)!==null&&l!==void 0?l:A.latitude,fov:(c=g.fov)!==null&&c!==void 0?c:A.fov,offset:(p=g.offset)!==null&&p!==void 0?p:A.offset,distance:(f=g.distance)!==null&&f!==void 0?f:A.distance})},t.prototype.updateConfiguration=function(e){return!0},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.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){e.render(r)},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 p=c[l];u.push({key:p.key,progress:p.progress,value:{longitude:p.value.longitude,latitude:p.value.latitude,fov:p.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,p=(o=e.latitude)!==null&&o!==void 0?o:this.camera.pose.latitude,f=(s=e.fov)!==null&&s!==void 0?s:this.camera.pose.fov,d=(u=e.distance)!==null&&u!==void 0?u:this.camera.pose.distance,h=(l=e.offset)!==null&&l!==void 0?l:this.camera.pose.offset,g=notSimilarValue(c,this.camera.pose.longitude,Math.PI*2)||notSimilarValue(p,this.camera.pose.latitude),A=notSimilarValue(f,this.camera.pose.fov),m=notSimilarValue(d,this.camera.pose.distance),E=notSimilarVector3(h,this.camera.pose.offset);(A||g||E||m)&&(this.camera.setFromPose({longitude:c,latitude:p,fov:f,distance:d,offset:h}),this.emit("camera.update",createEvent("camera.update",{userAction:this.userAction,state:__assign(__assign({},this.currentPano),{mode:this.mode,longitude:c,latitude:p,fov:f,offset:h,distance:d})})),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.viewport)},t.prototype.bindEvents=function(e){var r=this,o=function(C){var w=calculateThreeMouse(C,r.element,r.viewport);return!(Math.abs(w.x)>1||Math.abs(w.y)>1)},s=new Hammer.Manager(e),u=function(C){var w=C.session;return w.firstInput||null},l=new Hammer.Pan({threshold:10,pointers:0}),c=new Hammer.Tap({interval:410}),p=new Hammer.Pinch({threshold:0,pointers:2});s.add([l,c,p]),s.on("panstart pan",function(C){var w=u(s);if(!(w&&!o(w.center))){var I=createEvent("gesture.pan",{target:C.target,pointerType:C.pointerType,srcEvent:C.srcEvent,pointers:C.pointers.map(function(O){var L=r.relativeClientPosition(O),N=new THREE__namespace.Raycaster;return N.params.Points={threshold:.1},N.setFromCamera(L,r.camera),{x:O.x,y:O.y,delta:0,buttons:0,coords:L,raycaster:N}}),isFirst:C.isFirst,isFinal:C.isFinal,scale:C.scale,center:function(O){var L=r.relativeClientPosition(O),N=new THREE__namespace.Raycaster;return N.params.Points={threshold:.1},N.setFromCamera(L,r.camera),{x:O.x,y:O.y,delta:0,buttons:0,coords:L,raycaster:N}}(C.center),velocityX:C.velocityX,velocityY:C.velocityY,overallVelocityX:C.overallVelocityX,overallVelocityY:C.overallVelocityY,userAction:!0,state:__assign(__assign({mode:r.mode},r.currentPano),clonePose(r.camera.pose))});r.onPanGesture(I),b()}}),s.on("tap",function(C){if(!(C.pointerType==="mouse"&&C.srcEvent.button!==0)){var w=u(s);if(!(w&&!o(w.center))){var I=createEvent("gesture.tap",{target:C.target,pointerType:C.pointerType,srcEvent:C.srcEvent,pointers:C.pointers.map(function(O){var L=r.relativeClientPosition(O),N=new THREE__namespace.Raycaster;return N.params.Points={threshold:.1},N.setFromCamera(L,r.camera),{x:O.x,y:O.y,delta:0,buttons:0,coords:L,raycaster:N}}),isFirst:!0,isFinal:!0,scale:C.scale,center:function(O){var L=r.relativeClientPosition(O),N=new THREE__namespace.Raycaster;return N.params.Points={threshold:.1},N.setFromCamera(L,r.camera),{x:O.x,y:O.y,delta:0,buttons:0,coords:L,raycaster:N}}(C.center),velocityX:C.velocityX,velocityY:C.velocityY,overallVelocityX:C.overallVelocityX,overallVelocityY:C.overallVelocityY,userAction:!0,state:__assign(__assign({mode:r.mode},r.currentPano),clonePose(r.camera.pose))});r.onTapGesture(I),b()}}}),s.on("pinchstart pinch pinchend",function(C){var w=u(s);if(!(w&&!o(w.center))){var I=createEvent("gesture.pinch",{target:C.target,pointerType:C.pointerType,srcEvent:C.srcEvent,pointers:C.pointers.map(function(O){var L,N=r.relativeClientPosition(O),z=new THREE__namespace.Raycaster;return z.params.Points={threshold:.1},z.setFromCamera(N,r.camera),{x:O.x,y:O.y,delta:(L=O.delta)!==null&&L!==void 0?L:0,buttons:0,coords:N,raycaster:z}}),isFirst:C.type==="pinchstart",isFinal:C.type==="pinchend",scale:C.scale,center:function(O){var L=r.relativeClientPosition(O),N=new THREE__namespace.Raycaster;return N.params.Points={threshold:.1},N.setFromCamera(L,r.camera),{x:O.x,y:O.y,delta:0,buttons:0,coords:L,raycaster:N}}(C.center),velocityX:C.velocityX,velocityY:C.velocityY,overallVelocityX:C.overallVelocityX,overallVelocityY:C.overallVelocityY,userAction:!0,state:__assign(__assign({mode:r.mode},r.currentPano),clonePose(r.camera.pose))});r.onPinchGesture(I),b()}}),s.on("dbltap",function(C){if(!(C.pointerType==="mouse"&&C.srcEvent.button!==0)){var w=u(s);if(!(w&&!o(w.center))){var I=createEvent("gesture.dbltap",{target:C.target,pointerType:C.pointerType,srcEvent:C.srcEvent,pointers:C.pointers.map(function(O){var L=r.relativeClientPosition(O),N=new THREE__namespace.Raycaster;return N.params.Points={threshold:.1},N.setFromCamera(L,r.camera),{x:O.x,y:O.y,delta:0,buttons:0,coords:L,raycaster:N}}),isFirst:!0,isFinal:!0,scale:C.scale,center:function(O){var L=r.relativeClientPosition(O),N=new THREE__namespace.Raycaster;return N.params.Points={threshold:.1},N.setFromCamera(L,r.camera),{x:O.x,y:O.y,delta:0,buttons:0,coords:L,raycaster:N}}(C.center),velocityX:C.velocityX,velocityY:C.velocityY,overallVelocityX:C.overallVelocityX,overallVelocityY:C.overallVelocityY,userAction:!0,state:__assign(__assign({mode:r.mode},r.currentPano),clonePose(r.camera.pose))});r.onDblTapGesture(I),b()}}});var f=null,d=null,h=function(C,w,I){var O={x:I.clientX,y:I.clientY},L=r.relativeClientPosition(O),N=new THREE__namespace.Raycaster;N.params.Points={threshold:.1},N.setFromCamera(L,r.camera);var z=__assign(__assign({},O),{coords:L,raycaster:N,buttons:I.buttons,delta:0}),J=C==="pinchend"?w:w-I.deltaY/280,G=createEvent("gesture.pinch",{target:I.target,pointerType:"mouse",srcEvent:I,pointers:[__assign({},z)],isFirst:C==="pinchstart",isFinal:C==="pinchend",scale:clamp$1(J,.1,10),center:__assign({},z),velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0,userAction:!0,state:__assign(__assign({mode:r.mode},r.currentPano),clonePose(r.camera.pose))});return G},g=function(C){var w,I={x:C.clientX,y:C.clientY};if(o(I)){if(C.preventDefault(),C.ctrlKey){var O=(w=f==null?void 0:f.prevEvent.scale)!==null&&w!==void 0?w:1,L=h(f?"pinch":"pinchstart",O,C);f===null?f={firstEvent:L,prevEvent:L}:f.prevEvent=L,r.onPinchGesture(L),d!==null&&window.clearTimeout(d),d=window.setTimeout(function(){var q;d=null;var K=(q=f==null?void 0:f.prevEvent.scale)!==null&&q!==void 0?q:1,Y=h("pinchend",K,C);f=null,r.onPinchGesture(Y)},200)}else{var N=(Math.abs(C.deltaY)>Math.abs(C.deltaX)?C.deltaY:C.deltaX)/-60,z=r.mouseWheelState!==void 0,J={x:C.clientX,y:C.clientY},G=r.relativeClientPosition(J),Q=new THREE__namespace.Raycaster;Q.params.Points={threshold:.1},Q.setFromCamera(G,r.camera);var U=__assign(__assign({},J),{coords:G,raycaster:Q,buttons:C.buttons,delta:N}),L=createEvent("gesture.mousewheel",{target:C.target,pointerType:"mouse",srcEvent:C,pointers:[__assign({},U)],isFirst:z,isFinal:!1,scale:0,center:__assign({},U),velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0,userAction:!0,state:__assign(__assign({mode:r.mode},r.currentPano),clonePose(r.camera.pose))});r.onMouseWheel(L),r.mouseWheelState&&clearTimeout(r.mouseWheelState.timer),r.mouseWheelState={timer:setTimeout(function(){delete r.mouseWheelState;var K=createEvent("gesture.mousewheel",{target:C.target,pointerType:"mouse",srcEvent:C,pointers:[__assign(__assign({},U),{delta:0})],isFirst:!1,isFinal:!0,scale:0,center:__assign(__assign({},U),{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()}},A=function(C){if(!isMobile){if(!o({x:C.clientX,y:C.clientY})){m();return}var w=!1;r.mouseMoveState||(w=!0);var I={x:C.clientX,y:C.clientY},O=r.relativeClientPosition(I),L=new THREE__namespace.Raycaster;L.params.Points={threshold:.1},L.setFromCamera(O,r.camera);var N=__assign(__assign({},I),{coords:O,raycaster:L,buttons:C.buttons,delta:0}),z=createEvent("gesture.mousemove",{target:C.target,pointerType:"mouse",srcEvent:C,pointers:[__assign({},N)],isFirst:w,isFinal:!1,scale:0,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))});r.mouseMoveState={timeStamp:now(),event:z},r.onMouseMove(z),r.pressState&&Math.abs(C.clientX-r.pressState.event.center.y)>10&&Math.abs(C.clientY-r.pressState.event.center.y)>10&&b()}},m=function(){if(r.mouseMoveState){var C=createEvent(r.mouseMoveState.event.type,__assign(__assign({},r.mouseMoveState.event),{isFinal:!0}));delete r.mouseMoveState,r.onMouseMove(C)}b()},E=function(C){if(!o(C.center)){b();return}var w=!1;r.pressState||(w=!0,r.pressState={event:C,timeStamp:now(),stop:noop$1});var I=now()-r.pressState.timeStamp,O=createEvent(r.pressState.event.type,__assign(__assign({},r.pressState.event),{isFirst:w,isFinal:!1,center:__assign(__assign({},r.pressState.event.center),{delta:I}),pointers:r.pressState.event.pointers.map(function(L){return __assign(__assign({},L),{delta:I})})}));r.onPressGesture(O),r.pressState&&(r.pressState.stop=AnimationFrameLoop.shared.add(function(L){E(C)},!0,1))},v=function(C){if(b(),!(C.touches.length>1||C.changedTouches.length<=0)){var w={x:C.changedTouches[0].clientX,y:C.changedTouches[0].clientY},I=r.relativeClientPosition(w),O=new THREE__namespace.Raycaster;O.params.Points={threshold:.1},O.setFromCamera(I,r.camera);var L=__assign(__assign({},w),{coords:I,raycaster:O,buttons:0,delta:0}),N=createEvent("gesture.press",{target:C.target,pointerType:"touch",srcEvent:C,pointers:[__assign({},L)],isFirst:!1,isFinal:!1,scale:0,center:L,velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0,userAction:!0,state:__assign(__assign({mode:r.mode},r.currentPano),clonePose(r.camera.pose))});E(N)}},y=function(C){b();var w={x:C.clientX,y:C.clientY},I=r.relativeClientPosition(w),O=new THREE__namespace.Raycaster;O.params.Points={threshold:.1},O.setFromCamera(I,r.camera);var L=__assign(__assign({},w),{coords:I,raycaster:O,buttons:C.buttons,delta:0}),N=createEvent("gesture.press",{target:C.target,pointerType:"mouse",srcEvent:C,pointers:[__assign({},L)],isFirst:!1,isFinal:!1,scale:0,center:L,velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0,userAction:!0,state:__assign(__assign({mode:r.mode},r.currentPano),clonePose(r.camera.pose))});E(N)},b=function(){var C;if(r.pressState){var w=now()-r.pressState.timeStamp,I=createEvent(r.pressState.event.type,__assign(__assign({},r.pressState.event),{center:__assign(__assign({},r.pressState.event.center),{delta:w}),isFirst:!1,isFinal:!0,pointers:r.pressState.event.pointers.map(function(O){return __assign(__assign({},O),{delta:w})})}));r.onPressGesture(I),(C=r.pressState)===null||C===void 0||C.stop(),delete r.pressState}},T=null,_=function(C){var w,I=!1,O=!1;switch(C.type){case"gesturestart":I=!0;break;case"gestureend":O=!0;break}var L={x:C.clientX,y:C.clientY},N=r.relativeClientPosition(L),z=new THREE__namespace.Raycaster;z.params.Points={threshold:.1},z.setFromCamera(N,r.camera);var J=__assign(__assign({},L),{coords:N,raycaster:z,buttons:0,delta:0}),G=createEvent("gesture.pinch",{target:C.target,pointerType:"mouse",srcEvent:C,pointers:[__assign({},J)],isFirst:I,isFinal:O,scale:(w=C.scale)!==null&&w!==void 0?w:1,center:__assign({},J),velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0,userAction:!0,state:__assign(__assign({mode:r.mode},r.currentPano),clonePose(r.camera.pose))});return G},S=function(C){if(C.preventDefault(),!isMobile){var w=_(C);T={firstEvent:w};var I=T.firstEvent;I&&!o(I.center)||r.onPinchGesture(w)}},R=function(C){if(C.preventDefault(),!isMobile&&T){var w=_(C),I=T.firstEvent;I&&!o(I.center)||r.onPinchGesture(w)}},M=function(C){if(C.preventDefault(),!isMobile&&T){var w=_(C),I=T.firstEvent;T=null,!(I&&!o(I.center))&&r.onPinchGesture(w)}},H=function(C){if(C&&typeof C.preventDefault=="function"&&C.currentTarget===e&&C.preventDefault(),typeof getSelection=="function"){var w=getSelection();w&&w.focusNode&&(w.removeAllRanges&&w.removeAllRanges(),w.empty&&w.empty())}};this.enableWheel&&e.addEventListener("wheel",g,{passive:!1}),e.addEventListener("mousemove",A,!1),e.addEventListener("mouseout",m,!1),e.addEventListener("touchstart",v,{passive:!0}),e.addEventListener("touchend",b,!1),e.addEventListener("touchcancel",b,!1),e.addEventListener("mousedown",y,!1),e.addEventListener("mouseup",b,!1),e.addEventListener("gesturestart",S,{passive:!1}),e.addEventListener("gesturechange",R,{passive:!1}),e.addEventListener("gestureend",M,{passive:!1}),e.addEventListener("touchstart",H,{passive:!1}),e.addEventListener("contextmenu",H,!1);var B=function(){s.destroy(),e.removeEventListener("wheel",g,!1),e.removeEventListener("mousemove",A,!1),e.removeEventListener("mouseout",m,!1),e.removeEventListener("touchstart",v,!1),e.removeEventListener("touchend",b,!1),e.removeEventListener("touchcancel",b,!1),e.removeEventListener("mousedown",y,!1),e.removeEventListener("mouseup",b,!1),e.removeEventListener("gesturestart",S,!1),e.removeEventListener("gesturechange",R,!1),e.removeEventListener("gestureend",M,!1),e.removeEventListener("touchstart",H,!1),e.removeEventListener("contextmenu",H,!1)};return Object.assign(B,{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"])),p=s.images[l],f=applyImageURLOptions(p,o.imageOptions.transform,c);return getFetcher(s.work).preload(f,{timeout:500})})).then(function(){return r(e),e})},t}(Subscribe),sharedGeometry$2=new THREE__namespace.CircleBufferGeometry(.1,16),vertexShader$3=`
|
|
1392
1392
|
varying vec2 vUv;
|
|
1393
1393
|
#include <common>
|
|
1394
1394
|
#include <logdepthbuf_pars_vertex>
|
|
@@ -1421,7 +1421,7 @@ void main() {
|
|
|
1421
1421
|
|
|
1422
1422
|
gl_FragColor = vec4(gl_FragColor.rgb, gl_FragColor.a * outside * inside);
|
|
1423
1423
|
}
|
|
1424
|
-
`,sharedMaterial=new THREE__namespace.ShaderMaterial({vertexShader:vertexShader$3,fragmentShader:fragmentShader$3,side:THREE__namespace.DoubleSide,blending:THREE__namespace.CustomBlending,blendSrc:THREE__namespace.SrcAlphaFactor,blendDst:THREE__namespace.OneMinusSrcAlphaFactor,blendSrcAlpha:THREE__namespace.OneFactor,blendDstAlpha:THREE__namespace.OneMinusSrcAlphaFactor,depthWrite:!1}),IntersectMesh=function(n){__extends(t,n);function t(){var e=n.call(this)||this;return e.ringMesh=new THREE__namespace.Mesh(sharedGeometry$2,sharedMaterial),e.ringMesh.position.z=.01,e.ringMesh.renderOrder=-2,e.add(e.ringMesh),e}return t.prototype.dispose=function(){this.remove(this.ringMesh)},t}(THREE__namespace.Object3D),defaultFloorplanControllerCustomInitArgs={defaultLongitude:Math.PI/4,defaultLatitude:Math.PI/4,defaultFov:80,maxFov:120,minFov:20,maxLatitude:+Math.PI/2,minLatitude:-Math.PI/2,intersectMeshCreator:function(){return new IntersectMesh}},FloorplanController=function(n){__extends(t,n);function t(e){var r=this,o=t.parseArgs(e);return r=n.call(this,o)||this,r.mode="Floorplan",r.defaultLongitude=o.defaultLongitude,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.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:r.modelScene.parameter.resolveValue().modelAlpha}),r.perspToOrthoMotion=new Motion({perspToOrtho:r.camera.perspToOrtho.x}),r.currentTapId=null,r.intersectMeshCreator=o.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.boundingBox,u=s.isEmpty()?10: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);u=isNaN(u)||!isFinite(u)?1:u;var l=u/2/Math.tan(Math.PI*r/360);return o<1&&(l=l/o),isNaN(l)||!isFinite(l)?u:l},t.parseArgs=function(e){var r,o,s,u,l,c,p,f;if(e instanceof t)return e;var d=n.parseArgs.call(this,e);return __assign(__assign({},d),{defaultLongitude:(r=e.defaultLongitude)!==null&&r!==void 0?r:defaultFloorplanControllerCustomInitArgs.defaultLongitude,defaultLatitude:(o=e.defaultLatitude)!==null&&o!==void 0?o:defaultFloorplanControllerCustomInitArgs.defaultLatitude,defaultFov:(s=e.defaultFov)!==null&&s!==void 0?s:defaultFloorplanControllerCustomInitArgs.defaultFov,maxFov:(u=e.maxFov)!==null&&u!==void 0?u:defaultFloorplanControllerCustomInitArgs.maxFov,minFov:(l=e.minFov)!==null&&l!==void 0?l:defaultFloorplanControllerCustomInitArgs.minFov,maxLatitude:(c=e.maxLatitude)!==null&&c!==void 0?c:defaultFloorplanControllerCustomInitArgs.maxLatitude,minLatitude:(p=e.minLatitude)!==null&&p!==void 0?p:defaultFloorplanControllerCustomInitArgs.minLatitude,intersectMeshCreator:(f=e.intersectMeshCreator)!==null&&f!==void 0?f:defaultFloorplanControllerCustomInitArgs.intersectMeshCreator})},t.initAnimationEndState=function(e){var r,o,s,u,l,c,p,f=this.parseArgs(e),d=e.initial,h=d.state,g=d.currentState,A=typeof h.panoIndex=="number"?{workCode:(s=(r=h.workCode)!==null&&r!==void 0?r:(o=f.works[0])===null||o===void 0?void 0:o.workCode)!==null&&s!==void 0?s:"",panoIndex:h.panoIndex}:{workCode:g.workCode,panoIndex:g.panoIndex},m=(u=h.fov)!==null&&u!==void 0?u:f.defaultFov,E=(l=h.longitude)!==null&&l!==void 0?l:isThirdPersonMode(g.mode)?g.longitude:f.defaultLongitude,v=clamp$1(typeof f.minLatitude=="function"?f.minLatitude(m):f.minLatitude,-Math.PI/2,Math.PI/2),y=clamp$1(typeof f.maxLatitude=="function"?f.maxLatitude(m):f.maxLatitude,-Math.PI/2,Math.PI/2),b=clamp$1((c=h.latitude)!==null&&c!==void 0?c:g.mode==="Floorplan"?g.latitude:f.defaultLatitude,v,y),T=h.offset?h.offset.clone():e.modelScene.boundingBox.getCenter(new THREE__namespace.Vector3),_=(p=h.distance)!==null&&p!==void 0?p:t.distanceFromModel(f.modelScene,f.defaultFov,f.camera.aspect),S=__assign(__assign({},A),{mode:"Floorplan",longitude:E,latitude:b,fov:m,offset:T,distance:_});return S},t.prototype.updateConfiguration=function(e){var r=n.prototype.updateConfiguration.call(this,e);if(r===!1)return!1;if(e.defaultLongitude!==void 0&&this.defaultLongitude!==e.defaultLongitude&&(this.defaultLongitude=e.defaultLongitude),e.defaultLatitude!==void 0&&this.defaultLatitude!==e.defaultLatitude&&(this.defaultLatitude=e.defaultLatitude),e.defaultFov!==void 0&&this.defaultFov!==e.defaultFov&&(this.defaultFov=e.defaultFov),e.maxFov!==void 0&&this.maxFov!==e.maxFov&&(this.maxFov=e.maxFov),e.minFov!==void 0&&this.minFov!==e.minFov&&(this.minFov=e.minFov),e.maxLatitude!==void 0&&this.maxLatitude!==e.maxLatitude&&(this.maxLatitude=e.maxLatitude),e.minLatitude!==void 0&&this.minLatitude!==e.minLatitude&&(this.minLatitude=e.minLatitude),e.intersectMeshCreator!==void 0&&this.intersectMeshCreator!==e.intersectMeshCreator){this.intersectMeshCreator=e.intersectMeshCreator;var o=this.intersectMesh;this.intersectMesh=this.intersectMeshCreator(),this.intersectMesh.name=o.name,this.intersectMesh.visible=o.visible;var s=this.intersectMesh.parent;s&&s.add(this.intersectMesh),o.dispose()}return!0},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.boundingBox.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,p=e;c<p.length;c++){var f=p[c];u.push({key:f.key,progress:f.progress,value:{distance:f.value.distance,x:f.value.offset.x,y:f.value.offset.x,z:f.value.offset.x}}),l.push({key:f.key,progress:f.progress,value:{longitude:f.value.longitude,latitude:f.value.latitude,fov:f.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)),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.modelScene.parameter.set(o),isEmptyObject(s)||this.setCamera(s),this.intersectMesh&&this.intersectMesh.parent){var u=this.camera.position.distanceTo(this.intersectMesh.position),l=2*Math.tan(.5*this.camera.fov/180*Math.PI),c=u*l/5;this.intersectMesh.scale.setScalar(c)}}},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"]),p={x:l.offset.x,y:l.offset.y,z:l.offset.z,distance:l.distance},f={modelAlpha:1},d={perspToOrtho:0};e.emit("initAnimation.start",createEvent("initAnimation.start",{state:l,userAction:e.userAction})),e.modelAlphaMotion.set(f,s/3).catch(noop$1),e.perspToOrthoMotion.set(d,s).catch(noop$1),e.cameraMotion.set(c,s).catch(noop$1),e.locationMotion.set(p,s).then(function(){e.emit("initAnimation.end",createEvent("initAnimation.end",{state:l,userAction:e.userAction}))},function(h){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},t.prototype.getForwardObserverOrNot=function(e){var r=this,o=this.modelScene.intersectRaycaster(e)[0];if(!o)return null;var s=this.works.resolvedObservers.filter(function(p){for(var f,d=0,h=r.modelScene.children;d<h.length;d++){var g=h[d];if(g instanceof Model&&g.visible&&((f=g.work)===null||f===void 0?void 0:f.workCode)===p.work.workCode)return!0}return!1}),u=arrayMin(s,function(p){return p.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.viewport.width),latitude:2*e.y/(r.y*this.viewport.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},p=0;p<s;p++)l.longitude*=.996,l.latitude*=.996*.998,c.longitude+=l.longitude,c.latitude+=l.latitude;var f=formatRad(this.cameraMotion.value.longitude+c.longitude),d=this.cameraMotion.value.fov,h=clamp$1(typeof this.minLatitude=="function"?this.minLatitude(d):this.minLatitude,-Math.PI/2,Math.PI/2),g=clamp$1(typeof this.maxLatitude=="function"?this.maxLatitude(d):this.maxLatitude,-Math.PI/2,Math.PI/2),A=clamp$1(this.cameraMotion.value.latitude+c.latitude,h,g),m=__assign(__assign({},this.currentPano),{mode:this.mode,longitude:f,latitude:A,fov:this.cameraMotion.value.fov,offset:this.camera.pose.offset.clone(),distance:this.camera.pose.distance}),E=!(l.longitude>1e-4||l.longitude<-1e-4||l.latitude>1e-4||l.latitude<-1e-4),v=createEvent("gesture.momentum",__assign(__assign({},e),{isFirst:r,isFinal:E,state:m}));if(this.inMomentumMovement.event=v,this.emit("gesture.momentum",v),e.defaultPrevented){this.inMomentumMovement=null;return}this.inMomentumMovement&&(this.cameraMotion.set({longitude:f,latitude:A},0).catch(noop$1),E?this.inMomentumMovement=null:AnimationFrameLoop.shared.add(function(y,b){u.requestMomentumMovement(e,!1,l,b|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),p=formatRad(this.cameraMotion.value.longitude+c.longitude),f=this.camera.pose.fov,d=clamp$1(typeof this.minLatitude=="function"?this.minLatitude(f):this.minLatitude,-Math.PI/2,Math.PI/2),h=clamp$1(typeof this.maxLatitude=="function"?this.maxLatitude(f):this.maxLatitude,-Math.PI/2,Math.PI/2),g=clamp$1(this.cameraMotion.value.latitude+c.latitude,d,h);this.camera.aspect<1&&Math.abs(e.overallVelocityX)>.2&&Math.atan2(Math.abs(e.overallVelocityY),Math.abs(e.overallVelocityX))<Math.PI/6.923&&(g=this.cameraMotion.value.latitude);var A=__assign(__assign({},this.currentPano),{mode:this.mode,longitude:p,latitude:g,fov:f,offset:this.camera.pose.offset,distance:this.camera.pose.distance});if(e.state=A,this.emit("gesture.pan",e),!e.defaultPrevented&&(this.cameraMotion.set({longitude:A.longitude,latitude:A.latitude},0).catch(noop$1),e.isFinal)){var m=e.velocityX*l,E=e.velocityY;this.inMomentumMovement={uuid:createUuid()},this.requestMomentumMovement(e,!0,this.coordinatesForOffset({x:m,y:E}),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),u=clamp$1(typeof this.minLatitude=="function"?this.minLatitude(s):this.minLatitude,-Math.PI/2,Math.PI/2),l=clamp$1(typeof this.maxLatitude=="function"?this.maxLatitude(s):this.maxLatitude,-Math.PI/2,Math.PI/2),c=clamp$1(this.cameraMotion.value.latitude,u,l);e.state.fov=s,e.state.latitude=c,this.emit("gesture.pinch",e),!e.defaultPrevented&&(this.cameraMotion.set({fov:s,latitude:c},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.modelScene.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),p=c.clone(),f=u.point.clone();this.intersectMesh.position.copy(f);var d=f.clone().add(p);if(this.intersectMesh.lookAt(d),Math.abs(c.y)>.99){var h=this.camera.position.clone().sub(f);this.intersectMesh.rotation.z=-Math.atan2(h.z,h.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),l=clamp$1(typeof this.minLatitude=="function"?this.minLatitude(u):this.minLatitude,-Math.PI/2,Math.PI/2),c=clamp$1(typeof this.maxLatitude=="function"?this.maxLatitude(u):this.maxLatitude,-Math.PI/2,Math.PI/2),p=clamp$1(this.cameraMotion.value.latitude,l,c);e.state.fov=u,e.state.latitude=p,this.emit("gesture.mousewheel",e),!e.defaultPrevented&&this.cameraMotion.set({fov:u,latitude:p},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(p){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),defaultTopviewControllerCustomInitArgs=__assign({},omit(defaultFloorplanControllerCustomInitArgs,["defaultLongitude","defaultLatitude","maxLatitude","minLatitude"])),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.updateConfiguration=function(e){return n.prototype.updateConfiguration.call(this,__assign(__assign({},e),{defaultLongitude:0,defaultLatitude:Math.PI/2}))},t.prototype.updateModel=function(e){this.needsRender=!0,this.modelSceneNeedsRender=!0;var r=this.modelScene.boundingBox.getCenter(new THREE__namespace.Vector3);this.locationMotion.set({x:r.x,y:r.y,z:r.z,distance:FloorplanController.distanceFromModel(this.modelScene,this.defaultFov,this.camera.aspect)},0).catch(noop$1),this.hideIntersectMesh()},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,p=e;c<p.length;c++){var f=p[c];u.push({key:f.key,progress:f.progress,value:{distance:f.value.distance,x:f.value.offset.x,y:f.value.offset.y,z:f.value.offset.z}}),l.push({key:f.key,progress:f.progress,value:{longitude:f.value.longitude,latitude:f.value.latitude,fov:f.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},p={x:l.offset.x,y:l.offset.y,z:l.offset.z,distance:l.distance},f={modelAlpha:1},d={perspToOrtho:1};e.emit("initAnimation.start",createEvent("initAnimation.start",{state:l,userAction:e.userAction})),e.modelAlphaMotion.set(f,s/3).catch(noop$1),e.perspToOrthoMotion.set(d,s).catch(noop$1),e.cameraMotion.set(c,s).catch(noop$1),e.locationMotion.set(p,s).then(function(){e.emit("initAnimation.end",createEvent("initAnimation.end",{state:l,userAction:e.userAction}))},function(h){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),p=2*s.x*l/c.y,f=2*s.y*l/c.y,d=new THREE__namespace.Vector3;d.setFromMatrixColumn(this.camera.matrix,0),d.multiplyScalar(-p),u.add(d),d.setFromMatrixColumn(this.camera.matrix,1),d.multiplyScalar(f),u.add(d);var h=this.modelScene.boundingBox.getCenter(new THREE__namespace.Vector3),g=this.modelScene.boundingBox.getSize(new THREE__namespace.Vector3),A=Math.max(g.x,g.y,g.z)/2;u.clamp(h.clone().sub(new THREE__namespace.Vector3().setScalar(A)),h.clone().add(new THREE__namespace.Vector3().setScalar(A)));var m=__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=m,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);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],p=jsonStableStrinfiy_(n[c],!0);p!==void 0&&(s&&r!==""&&(r+=","),r+=JSON.stringify(c)+":"+p),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 defaultPanoramaLikeControllerCustomInitArgs={defaultLatitude:0,defaultFov:90,maxFov:120,minFov:20,maxLatitude:function(n){return+Math.PI/2-n/2/180*Math.PI},minLatitude:function(n){return-Math.PI/2+n/2/180*Math.PI},moveSpeed:3.4,intersectMeshCreator:function(){return new IntersectMesh}},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,p,f;if(e instanceof t)return e;var d=n.parseArgs.call(this,e);return __assign(__assign({},d),{defaultLatitude:(r=e.defaultLatitude)!==null&&r!==void 0?r:defaultPanoramaLikeControllerCustomInitArgs.defaultLatitude,defaultFov:(o=e.defaultFov)!==null&&o!==void 0?o:defaultPanoramaLikeControllerCustomInitArgs.defaultFov,maxFov:(s=e.maxFov)!==null&&s!==void 0?s:defaultPanoramaLikeControllerCustomInitArgs.maxFov,minFov:(u=e.minFov)!==null&&u!==void 0?u:defaultPanoramaLikeControllerCustomInitArgs.minFov,maxLatitude:(l=e.maxLatitude)!==null&&l!==void 0?l:defaultPanoramaLikeControllerCustomInitArgs.maxLatitude,minLatitude:(c=e.minLatitude)!==null&&c!==void 0?c:defaultPanoramaLikeControllerCustomInitArgs.minLatitude,moveSpeed:(p=e.moveSpeed)!==null&&p!==void 0?p:defaultPanoramaLikeControllerCustomInitArgs.moveSpeed,intersectMeshCreator:(f=e.intersectMeshCreator)!==null&&f!==void 0?f:defaultPanoramaLikeControllerCustomInitArgs.intersectMeshCreator})},t.initAnimationEndState=function(e){var r,o,s,u,l,c,p=this.parseArgs(e),f=p.works,d=e.initial,h=d.state,g=d.currentState,A=typeof h.panoIndex=="number"?{workCode:(s=(r=h.workCode)!==null&&r!==void 0?r:(o=p.works[0])===null||o===void 0?void 0:o.workCode)!==null&&s!==void 0?s:"",panoIndex:h.panoIndex}:{workCode:g.workCode,panoIndex:g.panoIndex},m=f.getResolvedObserver(A),E=clamp$1((u=h.fov)!==null&&u!==void 0?u:isFristPersonMode(g.mode)?g.fov:p.defaultFov,p.minFov,p.maxFov),v=(l=h.longitude)!==null&&l!==void 0?l:g.longitude,y=clamp$1(typeof p.minLatitude=="function"?p.minLatitude(E):p.minLatitude,-Math.PI/2,Math.PI/2),b=clamp$1(typeof p.maxLatitude=="function"?p.maxLatitude(E):p.maxLatitude,-Math.PI/2,Math.PI/2),T=clamp$1((c=h.latitude)!==null&&c!==void 0?c:isFristPersonMode(g.mode)?g.latitude:p.defaultLatitude,y,b),_=m?m.position.clone():new THREE__namespace.Vector3;return{workCode:A.workCode,panoIndex:A.panoIndex,mode:"PanoramaLike",longitude:v,latitude:T,fov:E,offset:_,distance:0}},t.prototype.updateConfiguration=function(e){var r=n.prototype.updateConfiguration.call(this,e);if(r===!1)return!1;if(e.defaultLatitude!==void 0&&this.defaultLatitude!==e.defaultLatitude&&(this.defaultLatitude=e.defaultLatitude),e.maxLatitude!==void 0&&this.maxLatitude!==e.maxLatitude&&(this.maxLatitude=e.maxLatitude),e.minLatitude!==void 0&&this.minLatitude!==e.minLatitude&&(this.minLatitude=e.minLatitude),e.defaultFov!==void 0&&this.defaultFov!==e.defaultFov&&(this.defaultFov=e.defaultFov),e.maxFov!==void 0&&this.maxFov!==e.maxFov&&(this.maxFov=e.maxFov),e.minFov!==void 0&&this.minFov!==e.minFov&&(this.minFov=e.minFov),e.moveSpeed!==void 0&&this.moveSpeed!==e.moveSpeed&&(this.moveSpeed=e.moveSpeed),e.intersectMeshCreator!==void 0&&this.intersectMeshCreator!==e.intersectMeshCreator){this.intersectMeshCreator=e.intersectMeshCreator;var o=this.intersectMesh;this.intersectMesh=this.intersectMeshCreator(),this.intersectMesh.name=o.name,this.intersectMesh.visible=o.visible;var s=this.intersectMesh.parent;s&&s.add(this.intersectMesh),o.dispose()}return!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.viewport.width)*r/95*o,latitude:-2*e.y/(s.y*this.viewport.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},p=0;p<s;p++)l.longitude*=.996,l.latitude*=.996*.99,c.longitude+=l.longitude,c.latitude+=l.latitude;var f=this.cameraMotion.value.fov,d=formatRad(this.cameraMotion.value.longitude+c.longitude),h=clamp$1(typeof this.minLatitude=="function"?this.minLatitude(f):this.minLatitude,-Math.PI/2,Math.PI/2),g=clamp$1(typeof this.maxLatitude=="function"?this.maxLatitude(f):this.maxLatitude,-Math.PI/2,Math.PI/2),A=clamp$1(this.cameraMotion.value.latitude+c.latitude,h,g),m=__assign(__assign({},this.currentPano),{mode:this.mode,longitude:d,latitude:A,fov:f,offset:this.camera.pose.offset.clone(),distance:this.camera.pose.distance}),E=!(l.longitude>1e-4||l.longitude<-1e-4||l.latitude>1e-4||l.latitude<-1e-4),v=createEvent("gesture.momentum",__assign(__assign({},e),{isFirst:r,isFinal:E,state:m}));if(this.inMomentumMovement.event=v,this.emit("gesture.momentum",v),e.defaultPrevented){this.inMomentumMovement=null;return}this.inMomentumMovement&&(this.cameraMotion.set({longitude:d,latitude:A},0).catch(noop$1),E?this.inMomentumMovement=null:AnimationFrameLoop.shared.add(function(y,b){u.requestMomentumMovement(e,!1,l,b|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=this.cameraMotion.value.fov,p=clamp$1(typeof this.minLatitude=="function"?this.minLatitude(c):this.minLatitude,-Math.PI/2,Math.PI/2),f=clamp$1(typeof this.maxLatitude=="function"?this.maxLatitude(c):this.maxLatitude,-Math.PI/2,Math.PI/2),d=clamp$1(this.cameraMotion.value.latitude+u.latitude,p,f);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 h=__assign(__assign({},this.currentPano),{mode:this.mode,longitude:l,latitude:d,fov:c,offset:this.camera.pose.offset.clone(),distance:this.camera.pose.distance});if(e.state=h,this.emit("gesture.pan",e),!e.defaultPrevented){var g={longitude:h.longitude,latitude:h.latitude,fov:h.fov};if(this.cameraMotion.set(g,0).catch(noop$1),e.isFinal){var A=e.velocityX,m=e.velocityY*.6;Math.abs(m)>.5&&Math.abs(A)<.5&&(A=0),this.inMomentumMovement={uuid:createUuid()},this.requestMomentumMovement(e,!0,this.coordinatesForOffset({x:A,y:m}),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),l=clamp$1(typeof this.minLatitude=="function"?this.minLatitude(u):this.minLatitude,-Math.PI/2,Math.PI/2),c=clamp$1(typeof this.maxLatitude=="function"?this.maxLatitude(u):this.maxLatitude,-Math.PI/2,Math.PI/2),p=clamp$1(this.cameraMotion.value.latitude,l,c);e.state.fov=u,e.state.latitude=p,this.emit("gesture.pinch",e),!e.defaultPrevented&&(this.cameraMotion.set({fov:u,latitude:p},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),o=clamp$1(typeof this.minLatitude=="function"?this.minLatitude(r):this.minLatitude,-Math.PI/2,Math.PI/2),s=clamp$1(typeof this.maxLatitude=="function"?this.maxLatitude(r):this.maxLatitude,-Math.PI/2,Math.PI/2),u=clamp$1(this.cameraMotion.value.latitude,o,s);e.state.fov=r,e.state.latitude=u,this.emit("gesture.mousewheel",e),!e.defaultPrevented&&(this.cameraMotion.set({fov:r,latitude:u},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.modelScene.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),p=c.clone(),f=u.point.clone();this.intersectMesh.position.copy(f);var d=f.clone().add(p);if(this.intersectMesh.lookAt(d),Math.abs(c.y)>.99){var h=this.camera.position.clone().sub(f);this.intersectMesh.rotation.z=-Math.atan2(h.z,h.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(p){return p.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,AAAAHGZ0eXBN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AAAABAAAAHQAAAAEAAAABAAAAHgAAAAIAAAABAAAAHwAAAAQAAAABAAAA4HN0c3oAAAAAAAAAAAAAADMAAAAaAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAACMc3RjbwAAAAAAAAAfAAAALAAAA1UAAANyAAADhgAAA6IAAAO+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 FACE_ORDER=["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.map(function(e){return createTileCubeNode(e,n)});return{children:t,maxLevel:n}}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 _a$1,scratchSortVector3=new THREE__namespace.Vector3,scratchFrustumMatrix=new THREE__namespace.Matrix4,scratchFrustumMatrixInverse=new THREE__namespace.Matrix4,scratchFrustumProjectMatrix=new THREE__namespace.Matrix4,scratchSceneQuaternionInverse=new THREE__namespace.Quaternion,scratchSceneMatrixInverse=new THREE__namespace.Matrix4,clearColor$1=new THREE__namespace.Color(0,0,0),clearAlpha=0,scratchPrevClearColor$1=new THREE__namespace.Color,clippingPlanes=[],SQRT1_2=(_a$1=Math.SQRT1_2)!==null&&_a$1!==void 0?_a$1:Math.sqrt(2),TILE_QUATERNION={up:new THREE__namespace.Quaternion(SQRT1_2,0,0,SQRT1_2),down:new THREE__namespace.Quaternion(-SQRT1_2,0,0,SQRT1_2),left:new THREE__namespace.Quaternion(0,SQRT1_2,0,SQRT1_2),right:new THREE__namespace.Quaternion(0,-SQRT1_2,0,SQRT1_2),front:new THREE__namespace.Quaternion(0,0,0,1),back:new THREE__namespace.Quaternion(0,1,0,0)},tileGeometry=function(){var n=new Float32Array([-.5,-.5,0,.5,-.5,0,-.5,.5,0,.5,.5,0]),t=new Float32Array([0,0,1,0,0,1,1,1]),e=new Uint32Array([0,1,2,1,3,2]),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.computeBoundingBox(),r}(),TILE_MATERIAL_VERTEX_SHADER=`
|
|
1424
|
+
`,sharedMaterial=new THREE__namespace.ShaderMaterial({vertexShader:vertexShader$3,fragmentShader:fragmentShader$3,side:THREE__namespace.DoubleSide,blending:THREE__namespace.CustomBlending,blendSrc:THREE__namespace.SrcAlphaFactor,blendDst:THREE__namespace.OneMinusSrcAlphaFactor,blendSrcAlpha:THREE__namespace.OneFactor,blendDstAlpha:THREE__namespace.OneMinusSrcAlphaFactor,depthWrite:!1}),IntersectMesh=function(n){__extends(t,n);function t(){var e=n.call(this)||this;return e.ringMesh=new THREE__namespace.Mesh(sharedGeometry$2,sharedMaterial),e.ringMesh.position.z=.01,e.ringMesh.renderOrder=-2,e.add(e.ringMesh),e}return t.prototype.dispose=function(){this.remove(this.ringMesh)},t}(THREE__namespace.Object3D),defaultFloorplanControllerCustomInitArgs={defaultLongitude:Math.PI/4,defaultLatitude:Math.PI/4,defaultFov:80,maxFov:120,minFov:20,maxLatitude:+Math.PI/2,minLatitude:-Math.PI/2,intersectMeshCreator:function(){return new IntersectMesh}},FloorplanController=function(n){__extends(t,n);function t(e){var r=this,o=t.parseArgs(e);return r=n.call(this,o)||this,r.mode="Floorplan",r.defaultLongitude=o.defaultLongitude,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.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:r.modelScene.parameter.resolveValue().modelAlpha}),r.perspToOrthoMotion=new Motion({perspToOrtho:r.camera.perspToOrtho.x}),r.currentTapId=null,r.intersectMeshCreator=o.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.boundingBox,u=s.isEmpty()?10: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);u=isNaN(u)||!isFinite(u)?1:u;var l=u/2/Math.tan(Math.PI*r/360);return o<1&&(l=l/o),isNaN(l)||!isFinite(l)?u:l},t.parseArgs=function(e){var r,o,s,u,l,c,p,f;if(e instanceof t)return e;var d=n.parseArgs.call(this,e);return __assign(__assign({},d),{defaultLongitude:(r=e.defaultLongitude)!==null&&r!==void 0?r:defaultFloorplanControllerCustomInitArgs.defaultLongitude,defaultLatitude:(o=e.defaultLatitude)!==null&&o!==void 0?o:defaultFloorplanControllerCustomInitArgs.defaultLatitude,defaultFov:(s=e.defaultFov)!==null&&s!==void 0?s:defaultFloorplanControllerCustomInitArgs.defaultFov,maxFov:(u=e.maxFov)!==null&&u!==void 0?u:defaultFloorplanControllerCustomInitArgs.maxFov,minFov:(l=e.minFov)!==null&&l!==void 0?l:defaultFloorplanControllerCustomInitArgs.minFov,maxLatitude:(c=e.maxLatitude)!==null&&c!==void 0?c:defaultFloorplanControllerCustomInitArgs.maxLatitude,minLatitude:(p=e.minLatitude)!==null&&p!==void 0?p:defaultFloorplanControllerCustomInitArgs.minLatitude,intersectMeshCreator:(f=e.intersectMeshCreator)!==null&&f!==void 0?f:defaultFloorplanControllerCustomInitArgs.intersectMeshCreator})},t.initAnimationEndState=function(e){var r,o,s,u,l,c,p,f=this.parseArgs(e),d=e.initial,h=d.state,g=d.currentState,A=typeof h.panoIndex=="number"?{workCode:(s=(r=h.workCode)!==null&&r!==void 0?r:(o=f.works[0])===null||o===void 0?void 0:o.workCode)!==null&&s!==void 0?s:"",panoIndex:h.panoIndex}:{workCode:g.workCode,panoIndex:g.panoIndex},m=(u=h.fov)!==null&&u!==void 0?u:f.defaultFov,E=(l=h.longitude)!==null&&l!==void 0?l:isThirdPersonMode(g.mode)?g.longitude:f.defaultLongitude,v=clamp$1(typeof f.minLatitude=="function"?f.minLatitude(m):f.minLatitude,-Math.PI/2,Math.PI/2),y=clamp$1(typeof f.maxLatitude=="function"?f.maxLatitude(m):f.maxLatitude,-Math.PI/2,Math.PI/2),b=clamp$1((c=h.latitude)!==null&&c!==void 0?c:g.mode==="Floorplan"?g.latitude:f.defaultLatitude,v,y),T=h.offset?h.offset.clone():e.modelScene.boundingBox.getCenter(new THREE__namespace.Vector3),_=(p=h.distance)!==null&&p!==void 0?p:t.distanceFromModel(f.modelScene,f.defaultFov,f.camera.aspect),S=__assign(__assign({},A),{mode:"Floorplan",longitude:E,latitude:b,fov:m,offset:T,distance:_});return S},t.prototype.updateConfiguration=function(e){var r=n.prototype.updateConfiguration.call(this,e);if(r===!1)return!1;if(e.defaultLongitude!==void 0&&this.defaultLongitude!==e.defaultLongitude&&(this.defaultLongitude=e.defaultLongitude),e.defaultLatitude!==void 0&&this.defaultLatitude!==e.defaultLatitude&&(this.defaultLatitude=e.defaultLatitude),e.defaultFov!==void 0&&this.defaultFov!==e.defaultFov&&(this.defaultFov=e.defaultFov),e.maxFov!==void 0&&this.maxFov!==e.maxFov&&(this.maxFov=e.maxFov),e.minFov!==void 0&&this.minFov!==e.minFov&&(this.minFov=e.minFov),e.maxLatitude!==void 0&&this.maxLatitude!==e.maxLatitude&&(this.maxLatitude=e.maxLatitude),e.minLatitude!==void 0&&this.minLatitude!==e.minLatitude&&(this.minLatitude=e.minLatitude),e.intersectMeshCreator!==void 0&&this.intersectMeshCreator!==e.intersectMeshCreator){this.intersectMeshCreator=e.intersectMeshCreator;var o=this.intersectMesh;this.intersectMesh=this.intersectMeshCreator(),this.intersectMesh.name=o.name,this.intersectMesh.visible=o.visible;var s=this.intersectMesh.parent;s&&s.add(this.intersectMesh),o.dispose()}return!0},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.boundingBox.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,p=e;c<p.length;c++){var f=p[c];u.push({key:f.key,progress:f.progress,value:{distance:f.value.distance,x:f.value.offset.x,y:f.value.offset.x,z:f.value.offset.x}}),l.push({key:f.key,progress:f.progress,value:{longitude:f.value.longitude,latitude:f.value.latitude,fov:f.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)),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.modelScene.parameter.set(o),isEmptyObject(s)||this.setCamera(s),this.intersectMesh&&this.intersectMesh.parent){var u=this.camera.position.distanceTo(this.intersectMesh.position),l=2*Math.tan(.5*this.camera.fov/180*Math.PI),c=u*l/5;this.intersectMesh.scale.setScalar(c)}}},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"]),p={x:l.offset.x,y:l.offset.y,z:l.offset.z,distance:l.distance},f={modelAlpha:1},d={perspToOrtho:0};e.emit("initAnimation.start",createEvent("initAnimation.start",{state:l,userAction:e.userAction})),e.modelAlphaMotion.set(f,s/3).catch(noop$1),e.perspToOrthoMotion.set(d,s).catch(noop$1),e.cameraMotion.set(c,s).catch(noop$1),e.locationMotion.set(p,s).then(function(){e.emit("initAnimation.end",createEvent("initAnimation.end",{state:l,userAction:e.userAction}))},function(h){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},t.prototype.getForwardObserverOrNot=function(e){var r=this,o=this.modelScene.intersectRaycaster(e)[0];if(!o)return null;var s=this.works.resolvedObservers.filter(function(p){for(var f,d=0,h=r.modelScene.children;d<h.length;d++){var g=h[d];if(g instanceof Model&&g.visible&&((f=g.work)===null||f===void 0?void 0:f.workCode)===p.work.workCode)return!0}return!1}),u=arrayMin(s,function(p){return p.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.viewport.width),latitude:2*e.y/(r.y*this.viewport.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},p=0;p<s;p++)l.longitude*=.996,l.latitude*=.996*.998,c.longitude+=l.longitude,c.latitude+=l.latitude;var f=formatRad(this.cameraMotion.value.longitude+c.longitude),d=this.cameraMotion.value.fov,h=clamp$1(typeof this.minLatitude=="function"?this.minLatitude(d):this.minLatitude,-Math.PI/2,Math.PI/2),g=clamp$1(typeof this.maxLatitude=="function"?this.maxLatitude(d):this.maxLatitude,-Math.PI/2,Math.PI/2),A=clamp$1(this.cameraMotion.value.latitude+c.latitude,h,g),m=__assign(__assign({},this.currentPano),{mode:this.mode,longitude:f,latitude:A,fov:this.cameraMotion.value.fov,offset:this.camera.pose.offset.clone(),distance:this.camera.pose.distance}),E=!(l.longitude>1e-4||l.longitude<-1e-4||l.latitude>1e-4||l.latitude<-1e-4),v=createEvent("gesture.momentum",__assign(__assign({},e),{isFirst:r,isFinal:E,state:m}));if(this.inMomentumMovement.event=v,this.emit("gesture.momentum",v),e.defaultPrevented){this.inMomentumMovement=null;return}this.inMomentumMovement&&(this.cameraMotion.set({longitude:f,latitude:A},0).catch(noop$1),E?this.inMomentumMovement=null:AnimationFrameLoop.shared.add(function(y,b){u.requestMomentumMovement(e,!1,l,b|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),p=formatRad(this.cameraMotion.value.longitude+c.longitude),f=this.camera.pose.fov,d=clamp$1(typeof this.minLatitude=="function"?this.minLatitude(f):this.minLatitude,-Math.PI/2,Math.PI/2),h=clamp$1(typeof this.maxLatitude=="function"?this.maxLatitude(f):this.maxLatitude,-Math.PI/2,Math.PI/2),g=clamp$1(this.cameraMotion.value.latitude+c.latitude,d,h);this.camera.aspect<1&&Math.abs(e.overallVelocityX)>.2&&Math.atan2(Math.abs(e.overallVelocityY),Math.abs(e.overallVelocityX))<Math.PI/6.923&&(g=this.cameraMotion.value.latitude);var A=__assign(__assign({},this.currentPano),{mode:this.mode,longitude:p,latitude:g,fov:f,offset:this.camera.pose.offset,distance:this.camera.pose.distance});if(e.state=A,this.emit("gesture.pan",e),!e.defaultPrevented&&(this.cameraMotion.set({longitude:A.longitude,latitude:A.latitude},0).catch(noop$1),e.isFinal)){var m=e.velocityX*l,E=e.velocityY;this.inMomentumMovement={uuid:createUuid()},this.requestMomentumMovement(e,!0,this.coordinatesForOffset({x:m,y:E}),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),u=clamp$1(typeof this.minLatitude=="function"?this.minLatitude(s):this.minLatitude,-Math.PI/2,Math.PI/2),l=clamp$1(typeof this.maxLatitude=="function"?this.maxLatitude(s):this.maxLatitude,-Math.PI/2,Math.PI/2),c=clamp$1(this.cameraMotion.value.latitude,u,l);e.state.fov=s,e.state.latitude=c,this.emit("gesture.pinch",e),!e.defaultPrevented&&(this.cameraMotion.set({fov:s,latitude:c},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.modelScene.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),p=c.clone(),f=u.point.clone();this.intersectMesh.position.copy(f);var d=f.clone().add(p);if(this.intersectMesh.lookAt(d),Math.abs(c.y)>.99){var h=this.camera.position.clone().sub(f);this.intersectMesh.rotation.z=-Math.atan2(h.z,h.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),l=clamp$1(typeof this.minLatitude=="function"?this.minLatitude(u):this.minLatitude,-Math.PI/2,Math.PI/2),c=clamp$1(typeof this.maxLatitude=="function"?this.maxLatitude(u):this.maxLatitude,-Math.PI/2,Math.PI/2),p=clamp$1(this.cameraMotion.value.latitude,l,c);e.state.fov=u,e.state.latitude=p,this.emit("gesture.mousewheel",e),!e.defaultPrevented&&this.cameraMotion.set({fov:u,latitude:p},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(p){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),defaultTopviewControllerCustomInitArgs=__assign({},omit(defaultFloorplanControllerCustomInitArgs,["defaultLongitude","defaultLatitude","maxLatitude","minLatitude"])),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.updateConfiguration=function(e){return n.prototype.updateConfiguration.call(this,__assign(__assign({},e),{defaultLongitude:0,defaultLatitude:Math.PI/2}))},t.prototype.updateModel=function(e){this.needsRender=!0,this.modelSceneNeedsRender=!0;var r=this.modelScene.boundingBox.getCenter(new THREE__namespace.Vector3);this.locationMotion.set({x:r.x,y:r.y,z:r.z,distance:FloorplanController.distanceFromModel(this.modelScene,this.defaultFov,this.camera.aspect)},0).catch(noop$1),this.hideIntersectMesh()},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,p=e;c<p.length;c++){var f=p[c];u.push({key:f.key,progress:f.progress,value:{distance:f.value.distance,x:f.value.offset.x,y:f.value.offset.y,z:f.value.offset.z}}),l.push({key:f.key,progress:f.progress,value:{longitude:f.value.longitude,latitude:f.value.latitude,fov:f.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},p={x:l.offset.x,y:l.offset.y,z:l.offset.z,distance:l.distance},f={modelAlpha:1},d={perspToOrtho:1};e.emit("initAnimation.start",createEvent("initAnimation.start",{state:l,userAction:e.userAction})),e.modelAlphaMotion.set(f,s/3).catch(noop$1),e.perspToOrthoMotion.set(d,s).catch(noop$1),e.cameraMotion.set(c,s).catch(noop$1),e.locationMotion.set(p,s).then(function(){e.emit("initAnimation.end",createEvent("initAnimation.end",{state:l,userAction:e.userAction}))},function(h){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),p=2*s.x*l/c.y,f=2*s.y*l/c.y,d=new THREE__namespace.Vector3;d.setFromMatrixColumn(this.camera.matrix,0),d.multiplyScalar(-p),u.add(d),d.setFromMatrixColumn(this.camera.matrix,1),d.multiplyScalar(f),u.add(d);var h=this.modelScene.boundingBox.getCenter(new THREE__namespace.Vector3),g=this.modelScene.boundingBox.getSize(new THREE__namespace.Vector3),A=Math.max(g.x,g.y,g.z)/2;u.clamp(h.clone().sub(new THREE__namespace.Vector3().setScalar(A)),h.clone().add(new THREE__namespace.Vector3().setScalar(A)));var m=__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=m,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);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],p=jsonStableStrinfiy_(n[c],!0);p!==void 0&&(s&&r!==""&&(r+=","),r+=JSON.stringify(c)+":"+p),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 defaultPanoramaLikeControllerCustomInitArgs={defaultLatitude:0,defaultFov:90,maxFov:120,minFov:20,maxLatitude:function(n){return+Math.PI/2-n/2/180*Math.PI},minLatitude:function(n){return-Math.PI/2+n/2/180*Math.PI},moveSpeed:3.4,intersectMeshCreator:function(){return new IntersectMesh}},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,p,f;if(e instanceof t)return e;var d=n.parseArgs.call(this,e);return __assign(__assign({},d),{defaultLatitude:(r=e.defaultLatitude)!==null&&r!==void 0?r:defaultPanoramaLikeControllerCustomInitArgs.defaultLatitude,defaultFov:(o=e.defaultFov)!==null&&o!==void 0?o:defaultPanoramaLikeControllerCustomInitArgs.defaultFov,maxFov:(s=e.maxFov)!==null&&s!==void 0?s:defaultPanoramaLikeControllerCustomInitArgs.maxFov,minFov:(u=e.minFov)!==null&&u!==void 0?u:defaultPanoramaLikeControllerCustomInitArgs.minFov,maxLatitude:(l=e.maxLatitude)!==null&&l!==void 0?l:defaultPanoramaLikeControllerCustomInitArgs.maxLatitude,minLatitude:(c=e.minLatitude)!==null&&c!==void 0?c:defaultPanoramaLikeControllerCustomInitArgs.minLatitude,moveSpeed:(p=e.moveSpeed)!==null&&p!==void 0?p:defaultPanoramaLikeControllerCustomInitArgs.moveSpeed,intersectMeshCreator:(f=e.intersectMeshCreator)!==null&&f!==void 0?f:defaultPanoramaLikeControllerCustomInitArgs.intersectMeshCreator})},t.initAnimationEndState=function(e){var r,o,s,u,l,c,p=this.parseArgs(e),f=p.works,d=e.initial,h=d.state,g=d.currentState,A=typeof h.panoIndex=="number"?{workCode:(s=(r=h.workCode)!==null&&r!==void 0?r:(o=p.works[0])===null||o===void 0?void 0:o.workCode)!==null&&s!==void 0?s:"",panoIndex:h.panoIndex}:{workCode:g.workCode,panoIndex:g.panoIndex},m=f.getResolvedObserver(A),E=clamp$1((u=h.fov)!==null&&u!==void 0?u:isFristPersonMode(g.mode)?g.fov:p.defaultFov,p.minFov,p.maxFov),v=(l=h.longitude)!==null&&l!==void 0?l:g.longitude,y=clamp$1(typeof p.minLatitude=="function"?p.minLatitude(E):p.minLatitude,-Math.PI/2,Math.PI/2),b=clamp$1(typeof p.maxLatitude=="function"?p.maxLatitude(E):p.maxLatitude,-Math.PI/2,Math.PI/2),T=clamp$1((c=h.latitude)!==null&&c!==void 0?c:isFristPersonMode(g.mode)?g.latitude:p.defaultLatitude,y,b),_=m?m.position.clone():new THREE__namespace.Vector3;return{workCode:A.workCode,panoIndex:A.panoIndex,mode:"PanoramaLike",longitude:v,latitude:T,fov:E,offset:_,distance:0}},t.prototype.updateConfiguration=function(e){var r=n.prototype.updateConfiguration.call(this,e);if(r===!1)return!1;if(e.defaultLatitude!==void 0&&this.defaultLatitude!==e.defaultLatitude&&(this.defaultLatitude=e.defaultLatitude),e.maxLatitude!==void 0&&this.maxLatitude!==e.maxLatitude&&(this.maxLatitude=e.maxLatitude),e.minLatitude!==void 0&&this.minLatitude!==e.minLatitude&&(this.minLatitude=e.minLatitude),e.defaultFov!==void 0&&this.defaultFov!==e.defaultFov&&(this.defaultFov=e.defaultFov),e.maxFov!==void 0&&this.maxFov!==e.maxFov&&(this.maxFov=e.maxFov),e.minFov!==void 0&&this.minFov!==e.minFov&&(this.minFov=e.minFov),e.moveSpeed!==void 0&&this.moveSpeed!==e.moveSpeed&&(this.moveSpeed=e.moveSpeed),e.intersectMeshCreator!==void 0&&this.intersectMeshCreator!==e.intersectMeshCreator){this.intersectMeshCreator=e.intersectMeshCreator;var o=this.intersectMesh;this.intersectMesh=this.intersectMeshCreator(),this.intersectMesh.name=o.name,this.intersectMesh.visible=o.visible;var s=this.intersectMesh.parent;s&&s.add(this.intersectMesh),o.dispose()}return!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.viewport.width)*r/95*o,latitude:-2*e.y/(s.y*this.viewport.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},p=0;p<s;p++)l.longitude*=.996,l.latitude*=.996*.99,c.longitude+=l.longitude,c.latitude+=l.latitude;var f=this.cameraMotion.value.fov,d=formatRad(this.cameraMotion.value.longitude+c.longitude),h=clamp$1(typeof this.minLatitude=="function"?this.minLatitude(f):this.minLatitude,-Math.PI/2,Math.PI/2),g=clamp$1(typeof this.maxLatitude=="function"?this.maxLatitude(f):this.maxLatitude,-Math.PI/2,Math.PI/2),A=clamp$1(this.cameraMotion.value.latitude+c.latitude,h,g),m=__assign(__assign({},this.currentPano),{mode:this.mode,longitude:d,latitude:A,fov:f,offset:this.camera.pose.offset.clone(),distance:this.camera.pose.distance}),E=!(l.longitude>1e-4||l.longitude<-1e-4||l.latitude>1e-4||l.latitude<-1e-4),v=createEvent("gesture.momentum",__assign(__assign({},e),{isFirst:r,isFinal:E,state:m}));if(this.inMomentumMovement.event=v,this.emit("gesture.momentum",v),e.defaultPrevented){this.inMomentumMovement=null;return}this.inMomentumMovement&&(this.cameraMotion.set({longitude:d,latitude:A},0).catch(noop$1),E?this.inMomentumMovement=null:AnimationFrameLoop.shared.add(function(y,b){u.requestMomentumMovement(e,!1,l,b|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=this.cameraMotion.value.fov,p=clamp$1(typeof this.minLatitude=="function"?this.minLatitude(c):this.minLatitude,-Math.PI/2,Math.PI/2),f=clamp$1(typeof this.maxLatitude=="function"?this.maxLatitude(c):this.maxLatitude,-Math.PI/2,Math.PI/2),d=clamp$1(this.cameraMotion.value.latitude+u.latitude,p,f);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 h=__assign(__assign({},this.currentPano),{mode:this.mode,longitude:l,latitude:d,fov:c,offset:this.camera.pose.offset.clone(),distance:this.camera.pose.distance});if(e.state=h,this.emit("gesture.pan",e),!e.defaultPrevented){var g={longitude:h.longitude,latitude:h.latitude,fov:h.fov};if(this.cameraMotion.set(g,0).catch(noop$1),e.isFinal){var A=e.velocityX,m=e.velocityY*.6;Math.abs(m)>.5&&Math.abs(A)<.5&&(A=0),this.inMomentumMovement={uuid:createUuid()},this.requestMomentumMovement(e,!0,this.coordinatesForOffset({x:A,y:m}),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),l=clamp$1(typeof this.minLatitude=="function"?this.minLatitude(u):this.minLatitude,-Math.PI/2,Math.PI/2),c=clamp$1(typeof this.maxLatitude=="function"?this.maxLatitude(u):this.maxLatitude,-Math.PI/2,Math.PI/2),p=clamp$1(this.cameraMotion.value.latitude,l,c);e.state.fov=u,e.state.latitude=p,this.emit("gesture.pinch",e),!e.defaultPrevented&&(this.cameraMotion.set({fov:u,latitude:p},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),o=clamp$1(typeof this.minLatitude=="function"?this.minLatitude(r):this.minLatitude,-Math.PI/2,Math.PI/2),s=clamp$1(typeof this.maxLatitude=="function"?this.maxLatitude(r):this.maxLatitude,-Math.PI/2,Math.PI/2),u=clamp$1(this.cameraMotion.value.latitude,o,s);e.state.fov=r,e.state.latitude=u,this.emit("gesture.mousewheel",e),!e.defaultPrevented&&(this.cameraMotion.set({fov:r,latitude:u},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.modelScene.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),p=c.clone(),f=u.point.clone();this.intersectMesh.position.copy(f);var d=f.clone().add(p);if(this.intersectMesh.lookAt(d),Math.abs(c.y)>.99){var h=this.camera.position.clone().sub(f);this.intersectMesh.rotation.z=-Math.atan2(h.z,h.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(p){return p.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,AAAAHGZ0eXBNNFYgAAACAGlzb21pc28yYXZjMQAAAAhmcmVlAAAGF21kYXTeBAAAbG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AAA4HN0c3oAAAAAAAAAAAAAADMAAAAaAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAACMc3RjbwAAAAAAAAAfAAAALAAAA1UAAANyAAADhgAAA6IAAAO+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 FACE_ORDER=["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.map(function(e){return createTileCubeNode(e,n)});return{children:t,maxLevel:n}}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 _a$1,scratchSortVector2=new THREE__namespace.Vector2,scratchSortVector3=new THREE__namespace.Vector3,scratchFrustumMatrix=new THREE__namespace.Matrix4,scratchFrustumMatrixInverse=new THREE__namespace.Matrix4,scratchFrustumProjectMatrix=new THREE__namespace.Matrix4,scratchSceneQuaternionInverse=new THREE__namespace.Quaternion,scratchSceneMatrixInverse=new THREE__namespace.Matrix4,clearColor$1=new THREE__namespace.Color(0,0,0),clearAlpha=0,scratchPrevClearColor$1=new THREE__namespace.Color,clippingPlanes=[],SQRT1_2=(_a$1=Math.SQRT1_2)!==null&&_a$1!==void 0?_a$1:Math.sqrt(2),TILE_QUATERNION={up:new THREE__namespace.Quaternion(SQRT1_2,0,0,SQRT1_2),down:new THREE__namespace.Quaternion(-SQRT1_2,0,0,SQRT1_2),left:new THREE__namespace.Quaternion(0,SQRT1_2,0,SQRT1_2),right:new THREE__namespace.Quaternion(0,-SQRT1_2,0,SQRT1_2),front:new THREE__namespace.Quaternion(0,0,0,1),back:new THREE__namespace.Quaternion(0,1,0,0)},tileGeometry=function(){var n=new Float32Array([-.5,-.5,0,.5,-.5,0,-.5,.5,0,.5,.5,0]),t=new Float32Array([0,0,1,0,0,1,1,1]),e=new Uint32Array([0,1,2,1,3,2]),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.computeBoundingBox(),r}(),TILE_MATERIAL_VERTEX_SHADER=`
|
|
1425
1425
|
varying vec2 vUV;
|
|
1426
1426
|
void main() {
|
|
1427
1427
|
vUV = uv;
|
|
@@ -1453,7 +1453,7 @@ void main() {
|
|
|
1453
1453
|
vec3 panoToVertex = normalize(vFinalPosition.xyz);
|
|
1454
1454
|
gl_FragColor = textureCube(map, vec3(FLIP_CUBE_MAP * panoToVertex.x, panoToVertex.yz));
|
|
1455
1455
|
}
|
|
1456
|
-
`,BoudningMaterial=function(n){__extends(t,n);function t(){var e=n.call(this,{defines:{},uniforms:{map:{value:null}},vertexShader:BOUNDING_MATERIAL_VERTEX_SHADER,fragmentShader:BOUNDING_MATERIAL_FRAGMENT_SHADER,transparent:!1})||this;return defineProperty(e,"map",{get:function(){return this.uniforms.map.value},set:function(r){this.uniforms.map.value=r}}),e}return t}(THREE__namespace.ShaderMaterial),BoundingMesh=function(n){__extends(t,n);function t(){var e=n.call(this,boundinghGeometry,new BoudningMaterial)||this;return e.disposed=!1,e.frustumCulled=!1,e.renderOrder=9999,e}return t.prototype.update=function(e,r){if(this.disposed){this.material.map=null,this.material.visible=!1;return}this.material.map=r,this.material.visible=r!==null},t.prototype.dispose=function(){this.disposed=!0,this.material.dispose()},t}(THREE__namespace.Mesh),Tiling=function(){function n(){this.forceRenderWhenNextUpdate=!0,this.disposed=!1,this.level=0,this.pedding=0,this.maxRequest=1,this.appearDuration=.5,this.maxCacheTile=48,this.imageOptions={},this.boundingMesh=new BoundingMesh,this.boundingMesh.frustumCulled=!1,this.textureLoader=new TextureLoader,this.observer=null,this.tileTree=createTileCubeTree(0),this.tileMeshes=new Map,this.frustum=new THREE__namespace.Frustum,this.scene=new THREE__namespace.Scene,this.camera=new THREE__namespace.PerspectiveCamera(90,1,.1,100),this.scene.add(this.boundingMesh),this.renderTarget=new THREE__namespace.WebGLRenderTarget(1,1,{depthBuffer:!0,stencilBuffer:!1,generateMipmaps:!1,magFilter:THREE__namespace.NearestFilter,minFilter:THREE__namespace.NearestFilter,wrapS:THREE__namespace.ClampToEdgeWrapping,wrapT:THREE__namespace.ClampToEdgeWrapping})}return n.prototype.dispose=function(){this.setObserver(null),this.renderTarget.dispose(),this.boundingMesh.dispose(),this.disposed=!0},n.prototype.cleanup=function(){var t=this;this.tileMeshes.forEach(function(e){e.dispose(),t.scene.remove(e)}),this.tileMeshes.clear(),this.forceRenderWhenNextUpdate=!0},n.prototype.setObserver=function(t){var e,r,o,s;if(!this.disposed&&this.observer!==t){this.cleanup(),this.observer=t;var u=(s=(o=(r=(e=this.observer)===null||e===void 0?void 0:e.images.tiles)===null||r===void 0?void 0:r.slice().sort(function(l,c){return c.level-l.level})[0])===null||o===void 0?void 0:o.level)!==null&&s!==void 0?s:0;this.tileTree=createTileCubeTree(u)}},n.prototype.update=function(t,e,r,o,s,u,l){var c=this,p=this.forceRenderWhenNextUpdate;if(this.disposed)return
|
|
1456
|
+
`,BoudningMaterial=function(n){__extends(t,n);function t(){var e=n.call(this,{defines:{},uniforms:{map:{value:null}},vertexShader:BOUNDING_MATERIAL_VERTEX_SHADER,fragmentShader:BOUNDING_MATERIAL_FRAGMENT_SHADER,transparent:!1})||this;return defineProperty(e,"map",{get:function(){return this.uniforms.map.value},set:function(r){this.uniforms.map.value=r}}),e}return t}(THREE__namespace.ShaderMaterial),BoundingMesh=function(n){__extends(t,n);function t(){var e=n.call(this,boundinghGeometry,new BoudningMaterial)||this;return e.disposed=!1,e.frustumCulled=!1,e.renderOrder=9999,e}return t.prototype.update=function(e,r){if(this.disposed){this.material.map=null,this.material.visible=!1;return}this.material.map=r,this.material.visible=r!==null},t.prototype.dispose=function(){this.disposed=!0,this.material.dispose()},t}(THREE__namespace.Mesh),Tiling=function(){function n(){this.forceRenderWhenNextUpdate=!0,this.disposed=!1,this.level=0,this.pedding=0,this.maxRequest=1,this.appearDuration=.5,this.maxCacheTile=48,this.imageOptions={},this.boundingMesh=new BoundingMesh,this.boundingMesh.frustumCulled=!1,this.textureLoader=new TextureLoader,this.observer=null,this.tileTree=createTileCubeTree(0),this.tileMeshes=new Map,this.frustum=new THREE__namespace.Frustum,this.scene=new THREE__namespace.Scene,this.camera=new THREE__namespace.PerspectiveCamera(90,1,.1,100),this.scene.add(this.boundingMesh),this.renderTarget=new THREE__namespace.WebGLRenderTarget(1,1,{depthBuffer:!0,stencilBuffer:!1,generateMipmaps:!1,magFilter:THREE__namespace.NearestFilter,minFilter:THREE__namespace.NearestFilter,wrapS:THREE__namespace.ClampToEdgeWrapping,wrapT:THREE__namespace.ClampToEdgeWrapping})}return n.prototype.dispose=function(){this.setObserver(null),this.renderTarget.dispose(),this.boundingMesh.dispose(),this.disposed=!0},n.prototype.cleanup=function(){var t=this;this.tileMeshes.forEach(function(e){e.dispose(),t.scene.remove(e)}),this.tileMeshes.clear(),this.forceRenderWhenNextUpdate=!0},n.prototype.setObserver=function(t){var e,r,o,s;if(!this.disposed&&this.observer!==t){this.cleanup(),this.observer=t;var u=(s=(o=(r=(e=this.observer)===null||e===void 0?void 0:e.images.tiles)===null||r===void 0?void 0:r.slice().sort(function(l,c){return c.level-l.level})[0])===null||o===void 0?void 0:o.level)!==null&&s!==void 0?s:0;this.tileTree=createTileCubeTree(u)}},n.prototype.update=function(t,e,r,o,s,u,l){var c=this,p,f=this.forceRenderWhenNextUpdate;if(this.disposed)return f;var d=e.fov,h=e.quaternion,g,A,m;if("time"in e&&typeof e.time=="number"?g=e.time:g=now(),"resolution"in e&&e.resolution instanceof THREE__namespace.Vector2?(A=e.resolution,m=(p=e.pixelRatio)!==null&&p!==void 0?p:1):(A=t.getSize(scratchSortVector2),m=t.getPixelRatio()),this.boundingMesh.update(g,r),this.observer===null)return(this.renderTarget.width!==1||this.renderTarget.height!==1)&&(this.renderTarget.setSize(1,1),f=!0),!1;this.level=clamp$1(l,0,this.tileTree.maxLevel);var E=A.width*m,v=A.height*m,y=E/v;(this.renderTarget.width!==E||this.renderTarget.height!==v)&&this.renderTarget.setSize(E,v),this.scene.matrix.equals(o)||(this.scene.matrix.copy(o),this.scene.matrixWorld.copy(this.scene.matrix),this.scene.matrix.decompose(this.scene.position,this.scene.quaternion,this.scene.scale),this.scene.matrixAutoUpdate=!1,f=!0),(this.camera.fov!==d||this.camera.aspect!==y||this.camera.zoom!==s)&&(this.camera.fov=d,this.camera.aspect=y,this.camera.zoom=s,this.camera.updateProjectionMatrix(),f=!0);var b=new THREE__namespace.Matrix4().compose(this.scene.position,h,this.scene.scale);this.camera.matrix.equals(b)||(this.camera.matrix.copy(b),this.camera.matrixWorld.copy(this.camera.matrix),this.camera.position.copy(this.scene.position),this.camera.quaternion.copy(h),this.camera.scale.copy(this.scene.scale),f=!0),scratchSceneQuaternionInverse.copy(this.scene.quaternion).inverse(),scratchSceneMatrixInverse.makeRotationFromQuaternion(scratchSceneQuaternionInverse),scratchFrustumMatrix.copy(this.camera.matrix),scratchFrustumMatrix.setPosition(0,0,0),scratchFrustumMatrix.premultiply(scratchSceneMatrixInverse),scratchFrustumMatrixInverse.getInverse(scratchFrustumMatrix),scratchFrustumProjectMatrix.multiplyMatrices(this.camera.projectionMatrix,scratchFrustumMatrixInverse),this.frustum.setFromProjectionMatrix(scratchFrustumProjectMatrix);var T=this.frustum.planes[5].normal,_=[];l>=u&&traverseTileCubeNode(this.tileTree,function(j){if(!(j.level<u)){if(j.level>l||!c.frustum.intersectsBox(j.box))return!1;_.push(j)}});var S=new WeakMap;_.sort(function(j,ee){if(j.level!==ee.level)return j.level-ee.level;var W=S.get(j);W===void 0&&(W=j.box.getCenter(scratchSortVector3).angleTo(T),S.set(j,W));var re=S.get(ee);return re===void 0&&(re=ee.box.getCenter(scratchSortVector3).angleTo(T),S.set(ee,re)),W-re});var R=new WeakSet,M=this.observer.images.tiles;if(M)for(var H=function(j){var ee=M.find(function(me){return me.level===j.level});if(!ee)return"continue";R.add(j);var W=B.tileMeshes.get(j);if(W){W.appearDuration=B.appearDuration;var re=W.updateTime(g);return re&&(f=!0),"continue"}if(B.pedding>=B.maxRequest)return"continue";var le=Math.pow(2,j.level)*j.position.y,ae=Math.pow(2,j.level)*j.position.x,oe="".concat(B.observer.panoId,".").concat(j.face,".").concat(j.level,".").concat(le,".").concat(ae),se=ee[j.face],ce=ee.size,ve=B.imageOptions.transform,Te=__assign(__assign({},pick(B.imageOptions,["format","sharpen","mappings"])),{key:"pano_tile.".concat(oe),size:ee.scale>=1?void 0:ce*j.size*ee.scale,cut:j.size===1?void 0:[ce*j.position.x,ce*j.position.y,ce*j.size,ce*j.size]});j.level===1&&ee.scale>=.5&&(Te.format==="jpg"||/\.jpg$/.test(se))&&(Te.size=void 0,Te.quality||(Te.quality=70)),j.size===1&&console.warn("tile: ".concat(Te.key," should not appear.")),B.pedding++;var pe=B.textureLoader.loadTexture(se,{imageURL:{transform:ve,options:Te},minFilter:THREE__namespace.LinearFilter,magFilter:THREE__namespace.LinearFilter,generateMipmaps:!1,fetcher:getFetcher(B.observer.work)}).then(function(me){return me.body});pe.then(function(me){return c.pedding--,me},function(me){return c.pedding--,Promise.reject(me)}),W=new TileMesh(j,pe),W.name="tiling:tile-".concat(oe),W.visible=!1,W.appearDuration=B.appearDuration,B.tileMeshes.set(j,W),B.scene.add(W),W.updateTime(g),f=!0},B=this,C=0,w=_;C<w.length;C++){var I=w[C];H(I)}var O=[],L=[];this.tileMeshes.forEach(function(j,ee){R.has(ee)?O.push(j):L.push(j);var W=ee.level>=u&&ee.level<=l;j.visible!==W&&(j.visible=W,f=!0)});for(var N=L.sort(function(j,ee){return ee.activeTime-j.activeTime}).slice(Math.max(0,this.maxCacheTile-O.length)),z=0,J=N;z<J.length;z++){var G=J[z];this.tileMeshes.delete(G.node),this.scene.remove(G),G.dispose(),f=!0}if(f){var Q=t.getRenderTarget();scratchPrevClearColor$1.copy(t.getClearColor());var U=t.getClearAlpha(),q=t.autoClear,K=t.autoClearColor,Y=t.autoClearDepth,Z=t.autoClearStencil,te=t.clippingPlanes;t.autoClear=!0,t.autoClearColor=!0,t.autoClearDepth=!0,t.autoClearStencil=!0,t.clippingPlanes=clippingPlanes,t.setRenderTarget(this.renderTarget),t.setClearColor(clearColor$1,clearAlpha),t.render(this.scene,this.camera),t.setRenderTarget(Q),t.setClearColor(scratchPrevClearColor$1,U),t.autoClear=q,t.autoClearColor=K,t.autoClearDepth=Y,t.autoClearStencil=Z,t.clippingPlanes=te}return this.forceRenderWhenNextUpdate=!1,f},n}(),ROTATE_Y_PI_MATRIX=new THREE__namespace.Matrix4().makeRotationAxis(new THREE__namespace.Vector3(0,1,0),Math.PI),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]),indices=new Uint32Array([0,4,1,1,4,5,1,5,2,2,5,6,2,6,3,3,6,7,3,7,0,0,7,4,3,0,2,2,0,1,4,7,5,5,7,6]),sharedGeometry$1=new THREE__namespace.BufferGeometry;sharedGeometry$1.setAttribute("position",new THREE__namespace.BufferAttribute(vertices$1,3));sharedGeometry$1.setIndex(new THREE__namespace.BufferAttribute(indices,1));sharedGeometry$1.applyMatrix4(new THREE__namespace.Matrix4().makeScale(-1,1,1));var PANO_VIDEO_MATERIAL_VERTEX_SHADER=`
|
|
1457
1457
|
|
|
1458
1458
|
#if defined(USE_PANO_VIDEO)
|
|
1459
1459
|
varying vec3 worldPosition;
|
|
@@ -1568,7 +1568,7 @@ void main() {
|
|
|
1568
1568
|
float cameraDepth = length(cameraVertex);
|
|
1569
1569
|
gl_FragColor = packDepthToRGBA(clamp(cameraDepth / maxDepth, 0.0, 1.0));
|
|
1570
1570
|
}
|
|
1571
|
-
`,depthMaterial=new THREE__namespace.ShaderMaterial({vertexShader:depthVertexShader,fragmentShader:depthFragmentShader,uniforms:{maxDepth:new THREE__namespace.Uniform(0)}});function renderDepthCube(n,t,e,r){r===void 0&&(r=1e3),depthMaterial.uniforms.maxDepth.value=r,scratchPrevClearColor.copy(n.getClearColor());var o=n.getClearAlpha(),s=t.overrideMaterial;t.overrideMaterial=depthMaterial,n.setClearColor(clearColor,0),e.update(n,t),n.setClearColor(scratchPrevClearColor,o),t.overrideMaterial=s}var scratchRaycaster$1=new THREE__namespace.Raycaster,scratchVector3$1=new THREE__namespace.Vector3,adjustPanoCircleMeshVectors=[new THREE__namespace.Vector3(0,0,0).multiplyScalar(.1),new THREE__namespace.Vector3(1,0,0).multiplyScalar(.1),new THREE__namespace.Vector3(-.5,0,-Math.sqrt(3)/2).multiplyScalar(.1),new THREE__namespace.Vector3(-.5,0,+Math.sqrt(3)/2).multiplyScalar(.1)],defaultPanoramaControllerCustomInitArgs=__assign(__assign({},defaultPanoramaLikeControllerCustomInitArgs),{maxAccessibleDistance:5,panoTapTriggerRadius:.5,panoCircleMeshCreator:function(n){return new PanoCircleMesh},adjustPanoCircleMeshPositionBasedOnModel:!1,tileLevelForFov:function(n,t){var e,r=function(l){return l/180*Math.PI},o=(e=Math.log2)!==null&&e!==void 0?e:function(l){return Math.log(l)*Math.LOG2E},s=t.height/2/Math.tan(r(n/2))*Math.tan(r(45))*2,u=Math.max(o(s/512),0);return u<2.3&&u>.1&&(u=1),u=u%1>.75?Math.ceil(u):Math.floor(u),u},tileAppearDuration:.5,tileMaxRequest:3,flyEffectUseDepthBuffer:!1}),PanoramaController=function(n){__extends(t,n);function t(e){var r=this,o=t.parseArgs(e);r=n.call(this,o)||this,r.mode="Panorama",r.initAnimationed=!1,r.maxAccessibleDistance=o.maxAccessibleDistance,r.panoTapTriggerRadius=o.panoTapTriggerRadius,r.panoCircleMeshCreator=o.panoCircleMeshCreator,r.adjustPanoCircleMeshPositionBasedOnModel=o.adjustPanoCircleMeshPositionBasedOnModel,r.tileLevelForFov=o.tileLevelForFov,r.tileAppearDuration=o.tileAppearDuration,r.tileMaxRequest=o.tileMaxRequest,r.flyEffectUseDepthBuffer=o.flyEffectUseDepthBuffer;var s=r.modelScene.parameter.resolveValue(),u=s.pano0,l=s.pano1;u&&(l==null?void 0:l.map)!==u.map&&(r.modelScene.parameter.set({pano0:l}),u.map.dispose());var c=new Set;return u&&c.add(u),l&&c.add(l),r.panoMeshes={},r.updatePanoMeshes(),r.locationMotion=new Motion({count:0,distance:r.camera.pose.distance}),r.modelAlphaMotion=new Motion({modelAlpha:r.modelScene.parameter.resolveValue().modelAlpha}),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:r.modelScene.parameter.resolveValue().pano1,position:r.camera.pose.offset.clone(),effect:"fly",fixCameraTransform:new THREE__namespace.Matrix4},r.panoPictureObserverMap=new WeakMap,r.textureLoader=new TextureLoader,r.tiling=new Tiling,r.panoVideo=new PanoVideo,r.scene.add(r.panoVideo.object),r.accessibleObserverFloorCheckCount=0,r}return t.parseArgs=function(e){var r,o,s,u,l,c,p,f;if(e instanceof t)return e;var d=n.parseArgs.call(this,e);return __assign(__assign({},d),{maxAccessibleDistance:(r=e.maxAccessibleDistance)!==null&&r!==void 0?r:defaultPanoramaControllerCustomInitArgs.maxAccessibleDistance,panoTapTriggerRadius:(o=e.panoTapTriggerRadius)!==null&&o!==void 0?o:defaultPanoramaControllerCustomInitArgs.panoTapTriggerRadius,panoCircleMeshCreator:(s=e.panoCircleMeshCreator)!==null&&s!==void 0?s:defaultPanoramaControllerCustomInitArgs.panoCircleMeshCreator,adjustPanoCircleMeshPositionBasedOnModel:(u=e.adjustPanoCircleMeshPositionBasedOnModel)!==null&&u!==void 0?u:defaultPanoramaControllerCustomInitArgs.adjustPanoCircleMeshPositionBasedOnModel,tileLevelForFov:(l=e.tileLevelForFov)!==null&&l!==void 0?l:defaultPanoramaControllerCustomInitArgs.tileLevelForFov,tileAppearDuration:(c=e.tileAppearDuration)!==null&&c!==void 0?c:defaultPanoramaControllerCustomInitArgs.tileAppearDuration,tileMaxRequest:(p=e.tileMaxRequest)!==null&&p!==void 0?p:defaultPanoramaControllerCustomInitArgs.tileMaxRequest,flyEffectUseDepthBuffer:(f=e.flyEffectUseDepthBuffer)!==null&&f!==void 0?f:defaultPanoramaControllerCustomInitArgs.flyEffectUseDepthBuffer})},t.initAnimationEndState=function(e){var r=this.parseArgs(e),o=n.initAnimationEndState.call(this,r);return __assign(__assign({},o),{mode:"Panorama"})},Object.defineProperty(t.prototype,"tileLevel",{get:function(){return this.tiling.level},enumerable:!1,configurable:!0}),t.prototype.updateConfiguration=function(e){var r=n.prototype.updateConfiguration.call(this,e);if(r===!1)return!1;if(e.maxAccessibleDistance!==void 0&&this.maxAccessibleDistance!==e.maxAccessibleDistance&&(this.maxAccessibleDistance=e.maxAccessibleDistance),e.panoTapTriggerRadius!==void 0&&this.panoTapTriggerRadius!==e.panoTapTriggerRadius&&(this.panoTapTriggerRadius=e.panoTapTriggerRadius),e.panoCircleMeshCreator!==void 0&&this.panoCircleMeshCreator!==e.panoCircleMeshCreator&&(this.panoCircleMeshCreator=e.panoCircleMeshCreator,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]}this.updatePanoMeshes()}return e.tileLevelForFov!==void 0&&this.tileLevelForFov!==e.tileLevelForFov&&(this.tileLevelForFov=e.tileLevelForFov),e.tileMaxRequest!==void 0&&this.tileMaxRequest!==e.tileMaxRequest&&(this.tileMaxRequest=e.tileMaxRequest),e.flyEffectUseDepthBuffer!==void 0&&this.flyEffectUseDepthBuffer!==e.flyEffectUseDepthBuffer&&(this.flyEffectUseDepthBuffer=e.flyEffectUseDepthBuffer),e.adjustPanoCircleMeshPositionBasedOnModel!==void 0&&this.adjustPanoCircleMeshPositionBasedOnModel!==e.adjustPanoCircleMeshPositionBasedOnModel&&(this.adjustPanoCircleMeshPositionBasedOnModel=e.adjustPanoCircleMeshPositionBasedOnModel),!0},t.prototype.destroy=function(){if(n.prototype.destroy.call(this),this.tiling.dispose(),this.modelScene.parameter.set({refinedScreen:null,pano0Depth:null,pano1Depth:null}),this.pano0DepthCubeRenderTarget&&(this.pano0DepthCubeRenderTarget.dispose(),this.pano0DepthCubeRenderTarget=void 0),this.pano1DepthCubeRenderTarget&&(this.pano1DepthCubeRenderTarget.dispose(),this.pano1DepthCubeRenderTarget=void 0),this.locationMotion.dispose(),delete this.pendingTextureTask,this.panoMeshes)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]}var l=this.videoTexture.image;l.pause(),l.oncanplay=function(){},l.ontimeupdate=function(){},this.scene.remove(this.panoVideo.object),this.panoVideo.setMaterial(null),this.panoVideo.dispose();for(var c=this.modelScene.parameter.resolveValue(),p=c.pano0,f=c.pano1,d=0,h=Object.keys(this.panoResources);d<h.length;d++){var g=h[d],A=this.panoResources[g];if(A.panoPicture){var m=A.panoPicture.map;m&&m!==(p==null?void 0:p.map)&&m!==(f==null?void 0:f.map)&&(m.dispose(),A.panoPicture=null)}delete this.panoResources[g]}},t.prototype.isReady=function(){return this.locationMotion.ended!==!0?!1:n.prototype.isReady.call(this)},t.prototype.isTileReady=function(){var e=this.tiling.pedding,r=e<=0;return this.initAnimationed&&r},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};return 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.modelScene=e,this.updatePanoMeshes(),this.hideIntersectMesh()},t.prototype.updateTime=function(e,r){var o=this,s,u,l,c,p,f;if(!this.destroyed){var d={},h={},g=this.locationMotion.keyframes[0],A=this.locationMotion.keyframes[this.locationMotion.keyframes.length-1],m=this.locationMotion.getKeyFrameSegment(e),E=m[0],v=m[1],y=this.panoResourceFromLocationMotionKeyframe(E),b=this.panoResourceFromLocationMotionKeyframe(v),T=this.panoResourceFromLocationMotionKeyframe(g),_=this.panoResourceFromLocationMotionKeyframe(A),S=!1;if(this.cameraMotion.ended===!1&&(this.cameraMotion.update(e),h.longitude=this.cameraMotion.value.longitude,h.latitude=this.cameraMotion.value.latitude,h.fov=this.cameraMotion.value.fov),this.modelAlphaMotion.ended===!1&&(this.modelAlphaMotion.update(e),d.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 R=new THREE__namespace.Vector3().copy(y.position),M=new THREE__namespace.Vector3().copy(b.position),H=this.locationMotion.value.count-v.value.count+1;if(d.progress=H,b.panoPicture&&(H<1?y.panoPicture&&(d.pano0=y.panoPicture):d.pano0=b.panoPicture,d.pano1=b.panoPicture),b.effect==="montage"?d.transition="BLACK":b.effect==="spread"?d.transition="SPREAD":d.transition="FADE",(b.effect==="zoomin"||b.effect==="zoomout")&&(d.progress=Math.pow(H,3)),H<1&&b.effect!=="fly"){if(d.pano0&&y.panoPicture){var B={panoId:d.pano0.panoId,map:d.pano0.map,mapSize:d.pano0.mapSize,zoom:d.pano0.zoom,matrix:y.panoPicture.matrix.clone().premultiply(y.fixCameraTransform).setPosition(b.position)},C=this.panoPictureObserverMap.get(d.pano0);C&&this.panoPictureObserverMap.set(B,C),d.pano0=B}R.copy(M),S=!0}h.distance=this.locationMotion.value.distance,h.offset=new THREE__namespace.Vector3(R.x+(M.x-R.x)*H,R.y+(M.y-R.y)*H,R.z+(M.z-R.z)*H);for(var w=[],I=[],O=0,L=this.locationMotion.keyframes;O<L.length;O++){var N=L[O],z=N.key,J=N.progress;z!==void 0&&(w.push(z),J>this.locationMotion.progress&&I.push(z))}for(var K=0,Q=Object.keys(this.panoResources);K<Q.length;K++){var U=Q[K];if(!(I.indexOf(U)>=0)){var q=this.panoResources[U];if(q.panoPicture){var X=q.panoPicture.map;if(X){if(X===((s=d.pano0)===null||s===void 0?void 0:s.map)||X===((u=d.pano1)===null||u===void 0?void 0:u.map))continue;X.dispose(),q.panoPicture=null}}w.indexOf(U)>=0||delete this.panoResources[U]}}var Z=panoParse(b.panoId);Z!==this.currentPano&&(this.currentPano=Z,this.accessibleObserverFloorCheckCount=0),this.emit("pano.moving",createEvent("pano.moving",{userAction:this.userAction,prevPano:panoParse(T.panoId),state:__assign(__assign(__assign(__assign({},panoParse(_.panoId)),{mode:this.mode}),clonePose(this.camera.pose)),h),options:{},progress:this.locationMotion.progress,error:null}))}isEmptyObject(d)===!1&&this.modelScene.parameter.set(d),isEmptyObject(h)===!1&&this.setCamera(h);var W=this.works.getResolvedObserver(this.currentPano),G=this.locationMotion.ended?this.getForwardObserverOrNot():null;if(this.camera.pose.distance>.1||S)for(var ne=0,$=Object.keys(this.panoMeshes);ne<$.length;ne++){var ee=$[ne],re=this.panoMeshes[ee];re.setOpacity(0),re.setCurrent(!1),re.updateTime&&re.updateTime(e,r),re.visible=!1}else if(W){var le=arrayMin(W.visibleIds,function(He){var Be=o.works.getResolvedObserver(He);return Be?W.standingPosition.distanceTo(Be.standingPosition):1/0},!0),ae=le[1];ae=clamp$1(ae,2.5,1/0);for(var oe=W.visibleIds.concat(panoStringify(this.currentPano)),se=this.camera.getDirection(new THREE__namespace.Vector3),pe=0,de=Object.keys(this.panoMeshes);pe<de.length;pe++){var ee=de[pe],re=this.panoMeshes[ee],C=this.works.getResolvedObserver(ee);if(oe.indexOf(ee)===-1)re.setCurrent(!1),re.setOpacity(0);else if(!C)re.setCurrent(!1),re.setOpacity(0);else if(!C.loadable&&!C.active)re.setCurrent(!1),re.setOpacity(0);else{var xe=re.position.clone().setY(this.camera.position.y).distanceTo(this.camera.position);re.setCurrent(!re.loading&&re.progress===0&&G!==null&&G.panoId===ee),re.setOpacity(xe<.01?0:clamp$1(ae/xe*1.2,.4,.85));var ce=this.camera.position.clone().setY(re.position.y),Re=new THREE__namespace.Vector3().copy(re.position).sub(ce).normalize();if(ee===panoStringify(this.currentPano)){var j=clamp$1((.5-ce.distanceTo(re.position))/.5,0,1);Re.multiplyScalar(1-j).add(se.clone().multiplyScalar(j))}Re.length()>0&&re.quaternion.setFromEuler(new THREE__namespace.Euler(0,Math.atan2(Re.x,Re.z),0))}re.updateTime&&re.updateTime(e,r)}}if(this.adjustPanoCircleMeshPositionBasedOnModel&&this.helper.visible&&W){for(var te=[],V=0,be=W.accessibleIds;V<be.length;V++){var ee=be[V],C=this.works.getResolvedObserver(ee);C&&te.push(C)}if(te.sort(function(He,Be){return He.standingPosition.distanceTo(W.standingPosition)-Be.standingPosition.distanceTo(W.standingPosition)}),te.length){this.accessibleObserverFloorCheckCount=this.accessibleObserverFloorCheckCount%te.length;var fe=te[this.accessibleObserverFloorCheckCount],re=this.panoMeshes[fe.panoId],ve=this.modelScene.models.find(function(Be){return Be.work===(fe==null?void 0:fe.work)});if(fe&&re&&ve&&ve.visible){var Ve=.3,rt=.05,We=.005,me=adjustPanoCircleMeshVectors.map(function(Be){scratchVector3$1.copy(Be),scratchVector3$1.setY(Ve),scratchRaycaster$1.ray.origin.copy(fe.standingPosition),scratchRaycaster$1.ray.origin.add(scratchVector3$1),scratchRaycaster$1.ray.direction.set(0,-1,0);var Ge=ve.intersectRaycaster(scratchRaycaster$1,null,!0)[0];return Ge&&Ge.distance-We<=Ve?new THREE__namespace.Vector3().copy(fe.standingPosition).setY(Ge.point.y+We):fe.standingPosition});me.sort(function(Be,Ge){return Ge.y-Be.y});var ie=me[Math.floor(me.length/2)],he=me.filter(function(Be){return Be.distanceTo(ie)<=rt})[0];he&&!he.equals(re.position)&&(re.position.copy(he),this.needsRender=!0)}this.accessibleObserverFloorCheckCount++}}{var H=(l=this.modelScene.parameter.progress)!==null&&l!==void 0?l:1,Ce=Math.round(H),_e=this.modelScene.parameter.pano0,Ie=this.modelScene.parameter.pano1,Fe=Ce===0?_e:Ie,C=void 0;if(Fe&&(C=this.works.getResolvedObserver(Fe.panoId),C||(C=this.panoPictureObserverMap.get(Fe))),this.tiling.appearDuration=this.tileAppearDuration,this.tiling.maxRequest=H<=.5||H<1?0:this.tileMaxRequest,this.tiling.imageOptions=this.imageOptions,!C||!Fe||this.tileLevelForFov===!1)this.tiling.setObserver(null),this.tiling.update(this.renderer,this.camera,null,new THREE__namespace.Matrix4,1,0,0),this.modelScene.parameter.set("refinedScreen",null);else{var Ae=getImageSizeLevel(Fe.mapSize),Te=Ae+1,we=new THREE__namespace.Vector2().copy(this.camera.resolution).multiplyScalar(this.camera.pixelRatio),Pe=Math.floor(this.tileLevelForFov(this.camera.fov,we)),qe=Pe>Ae?Pe:0;this.tiling.setObserver(C);var ke=this.tiling.update(this.renderer,this.camera,Fe.map,Fe.matrix,Fe.zoom,Te,qe),Ne={map:this.tiling.renderTarget.texture,matrixInverse:this.tiling.camera.matrixWorldInverse,projectionMatrix:this.tiling.camera.projectionMatrix,pano:Ce,opacity:(_e==null?void 0:_e.panoId)===(Ie==null?void 0:Ie.panoId)?1:easeInQuart(Math.abs(((c=this.modelScene.parameter.progress)!==null&&c!==void 0?c:0)-.5)*2)},Le=this.modelScene.parameter.refinedScreen;(ke||Ne.pano!==(Le==null?void 0:Le.pano)||Ne.opacity!==(Le==null?void 0:Le.opacity))&&this.modelScene.parameter.set("refinedScreen",Ne)}}this.panoVideo.object.position.copy(this.camera.position),this.panoVideo.updateTime(e),W&&W.video&&(this.needsRender=!0),this.intersectMesh.scale.setScalar(clamp$1(this.cameraMotion.value.fov/45,0,1));{var Ue=b.effect,ze=this.modelScene.parameter,_e=ze.pano0,Ie=ze.pano1;if(_e&&Ie&&_e!==Ie&&Ue==="fly"&&this.flyEffectUseDepthBuffer){if(((p=this.modelScene.parameter.pano0Depth)===null||p===void 0?void 0:p.panoId)!==_e.panoId||((f=this.modelScene.parameter.pano1Depth)===null||f===void 0?void 0:f.panoId)!==Ie.panoId){var je=500,Se=512;this.pano0DepthCubeRenderTarget?this.pano0DepthCubeRenderTarget.width!==Se&&this.pano0DepthCubeRenderTarget.setSize(Se,Se):this.pano0DepthCubeRenderTarget=new THREE__namespace.WebGLCubeRenderTarget(Se,{minFilter:THREE__namespace.NearestFilter,magFilter:THREE__namespace.NearestFilter,generateMipmaps:!1}),this.pano1DepthCubeRenderTarget?this.pano1DepthCubeRenderTarget.width!==Se&&this.pano1DepthCubeRenderTarget.setSize(Se,Se):this.pano1DepthCubeRenderTarget=new THREE__namespace.WebGLCubeRenderTarget(Se,{minFilter:THREE__namespace.NearestFilter,magFilter:THREE__namespace.NearestFilter,generateMipmaps:!1});var Oe=new THREE__namespace.CubeCamera(this.camera.near,this.camera.far,this.pano0DepthCubeRenderTarget);Oe.matrix.copy(_e.matrix),Oe.matrixWorld.copy(Oe.matrix),Oe.matrixAutoUpdate=!1,renderDepthCube(this.renderer,this.modelScene,Oe,je);var Me=new THREE__namespace.CubeCamera(this.camera.near,this.camera.far,this.pano1DepthCubeRenderTarget);Me.matrix.copy(Ie.matrix),Me.matrixWorld.copy(Me.matrix),Me.matrixAutoUpdate=!1,renderDepthCube(this.renderer,this.modelScene,Me,je),this.modelScene.parameter.set({pano0Depth:{panoId:_e.panoId,map:this.pano0DepthCubeRenderTarget.texture,mapSize:this.pano0DepthCubeRenderTarget.width,maxDepth:je},pano1Depth:{panoId:Ie.panoId,map:this.pano1DepthCubeRenderTarget.texture,mapSize:this.pano1DepthCubeRenderTarget.width,maxDepth:je}})}}else this.modelScene.parameter.set({pano0Depth:null,pano1Depth:null}),this.flyEffectUseDepthBuffer||(this.pano0DepthCubeRenderTarget&&(this.pano0DepthCubeRenderTarget.dispose(),this.pano0DepthCubeRenderTarget=void 0),this.pano1DepthCubeRenderTarget&&(this.pano1DepthCubeRenderTarget.dispose(),this.pano1DepthCubeRenderTarget=void 0))}}},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=(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)));getImageSizeFromURL(p.images.up),this.imageOptions.size;var f=this.imageOptions.transform,d=__assign({key:"pano.".concat(p.panoId)},pick(this.imageOptions,["format","size","quality","sharpen","mappings"])),h=p.images,g="pano:"+jsonHash([h,d,f]);if(this.pendingTextureTask){if(this.pendingTextureTask.hash===g)return;var A=this.pendingTextureTask.panoId;(l=this.panoMeshes[A])===null||l===void 0||l.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 E=this.modelScene.parameter.resolveValue(),v=E.pano0,y=E.pano1,b;if(v&&v.map.name===g?b=v:(y==null?void 0:y.map.name)===g&&(b=y),b){var T={panoId:p.panoId,effect:c,panoPicture:{panoId:b.panoId,map:b.map,mapSize:b.mapSize,matrix:p.matrix.clone(),zoom:1},position:p.position.clone(),fixCameraTransform:new THREE__namespace.Matrix4};T.panoPicture&&this.panoPictureObserverMap.set(T.panoPicture,p),AnimationFrameLoop.shared.add(function(){s.pending.delete(m),s.doMoveToPano(p.pano,T,r)},!0,1);return}this.pendingTextureTask={panoId:p.panoId,hash:g,onLoad:function(S){var R;s.pending.delete(m);var M=S.body;if(s.destroyed)M.dispose();else{M.name=g;var H=Array.isArray(M.image)?M.image[0]:M.image,B=(R=H==null?void 0:H.width)!==null&&R!==void 0?R:2048,C={panoId:p.panoId,effect:c,panoPicture:{panoId:p.panoId,map:M,mapSize:B,matrix:p.matrix.clone(),zoom:1},position:p.position.clone(),fixCameraTransform:new THREE__namespace.Matrix4};C.panoPicture&&s.panoPictureObserverMap.set(C.panoPicture,p),s.doMoveToPano(p.pano,C,r)}},onError:function(S){s.pending.delete(m);var R=__assign(__assign(__assign({},p.pano),{mode:s.mode}),clonePose(s.camera.pose));s.emit("pano.error",createEvent("pano.error",{error:S,userAction:s.userAction,options:r,prevPano:s.currentPano,progress:0,state:R})),s.emit("pano.cancel",createEvent("pano.cancel",{error:S,userAction:s.userAction,options:r,prevPano:s.currentPano,progress:0,state:R})),s.emit("error",S),r.moveCancelCallback&&r.moveCancelCallback()}};var _=this.panoMeshes[p.panoId];_&&_.tap&&_.tap(),this.textureLoader.loadCubeTexture(h,{imageURL:{transform:f,options:d},format:THREE__namespace.RGBAFormat,viaAjax:!0,fetcher:getFetcher(p.work)},void 0,void 0,function(S){var R,M;s.emit("pano.texture.progress",createEvent("pano.texture.progress",{error:null,progress:S,meta:null,pano:p.pano})),((R=s.pendingTextureTask)===null||R===void 0?void 0:R.hash)===g&&((M=s.panoMeshes[p.panoId])===null||M===void 0||M.setProgress(S))},this.renderer).then(function(S){var R,M;((R=s.pendingTextureTask)===null||R===void 0?void 0:R.hash)===g?(s.pendingTextureTask.onLoad(S),(M=s.panoMeshes[p.panoId])===null||M===void 0||M.setProgress(0),delete s.pendingTextureTask,s.emit("pano.texture.success",createEvent("pano.texture.success",{error:null,progress:1,meta:S.meta,pano:p.pano}))):S.body.dispose()}).catch(function(S){var R,M;((R=s.pendingTextureTask)===null||R===void 0?void 0:R.hash)===g&&(s.pendingTextureTask.onError(S),(M=s.panoMeshes[p.panoId])===null||M===void 0||M.setProgress(0),delete s.pendingTextureTask,s.emit("pano.texture.error",createEvent("pano.texture.error",{error:S,progress:0,meta:null,pano:p.pano})),s.emit("error",S))}),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),p={workCode:c.workCode,panoIndex:c.panoIndex},f={modelAlpha:0},d={perspToOrtho:0},h=!1;e.moveToPano(p,{longitude:c.longitude,latitude:c.latitude,fov:c.fov,effect:u,duration:s,moveStartCallback:function(g){h=!0,e.perspToOrthoMotion.set(d,s).catch(noop$1),e.modelAlphaMotion.setKeyframes([{progress:0,value:__assign({},e.modelAlphaMotion.value)},{progress:.6,value:__assign({},e.modelAlphaMotion.value)},{progress:1,value:f}],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({},p),{mode:e.mode}),clonePose(e.camera.pose));h===!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 p=1,f={},d=function(S){var R=arrayMin(S.accessibleIds,function(H){var B=e.works.getResolvedObserver(H);if(!B)return 1/0;var C=B.standingPosition.distanceTo(S.standingPosition);return clamp$1(C,1,1/0)},!0),M=R[1];f[S.panoId]===void 0&&(f[S.panoId]=M)},h=0,g=this.works.resolvedObservers;h<g.length;h++){var A=g[h];d(A)}var m=Object.keys(f).map(function(S){return f[S]});if(m.length){var E=m.reduce(function(S,R){return S+R},0)/m.length;p=clamp$1(E*.6,1,3)}for(var v=0,y=this.works.resolvedObservers;v<y.length;v++){var A=y[v],c=void 0;r[A.panoId]?(c=r[A.panoId],c.loading===!0&&A.loadable===!1&&c.setLoading(!1),delete r[A.panoId]):(c=this.panoCircleMeshCreator(A.pano),c.name="PanoCircleMesh_"+A.panoId,this.helper.add(c)),c.scale.set(p,1,p),c.position.copy(A.standingPosition),this.panoMeshes[A.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,p,f,d,h,g,A,m,E;o===void 0&&(o={});var v=now(),y=createUuid();this.panoResources[y]=r;var b=1,T,_,S;if(this.locationMotion.ended){var R=this.locationMotion.getKeyFrameSegment(v);R[0];var M=R[1],H=this.locationMotion.value,B=((u=this.panoResourceFromLocationMotionKeyframe(M))!==null&&u!==void 0?u:this.camera).position,C=r.position;T=Math.max(B.distanceTo(C),b),_=[{key:M.key,progress:0,value:__assign(__assign({},H),{count:0})},{key:y,progress:1,value:{distance:0,count:1}}],S=0}else{var w=this.locationMotion.getKeyFrameSegment(v),I=w[0],M=w[1],H=this.locationMotion.value,O=this.panoResourceFromLocationMotionKeyframe(I).position,B=this.panoResourceFromLocationMotionKeyframe(M).position,C=r.position,L=M.value.count-H.count,N=Math.max(O.distanceTo(B),b)*L,z=Math.max(B.distanceTo(C),b);T=N+z,_=[{key:I.key,progress:0,value:__assign({},H)},{key:M.key,progress:N/T,value:M.value},{key:y,progress:1,value:{count:M.value.count+1,distance:0}}];var J=this.locationMotionKeyframesLength(this.locationMotion.keyframes),K=this.locationMotionKeyframesLength(_);J===0||J===0?S=0:S=this.locationMotion.getProgressVelocity(v)*J/K}var Q=r.effect==="instant"?0:this.calculateMovingDuration(o.duration,r.effect==="fly"?T:0),U={longitude:o.longitude,latitude:o.latitude,fov:o.fov},q=__assign(__assign({},e),{mode:this.mode,longitude:(l=U.longitude)!==null&&l!==void 0?l:this.camera.pose.longitude,latitude:(c=U.latitude)!==null&&c!==void 0?c:this.camera.pose.latitude,fov:(p=U.fov)!==null&&p!==void 0?p:this.camera.pose.fov,offset:r.position.clone(),distance:this.camera.pose.distance}),X=this.currentPano;if(this.emit("pano.moveTo",createEvent("pano.moveTo",{options:o,prevPano:X,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(U,Q).catch(noop$1);else{var Z=coordinatesToVector({longitude:this.cameraMotion.value.longitude,latitude:this.cameraMotion.value.latitude}),W=coordinatesToVector({longitude:(f=U.longitude)!==null&&f!==void 0?f:this.cameraMotion.value.longitude,latitude:(d=U.latitude)!==null&&d!==void 0?d:this.cameraMotion.value.latitude}),G=new THREE__namespace.Object3D;G.lookAt(Z);var ne=new THREE__namespace.Matrix4().makeRotationFromQuaternion(G.quaternion);G.lookAt(W);var $=new THREE__namespace.Matrix4().makeRotationFromQuaternion(G.quaternion),ee=new THREE__namespace.Matrix4().getInverse(ne).premultiply($),re=this.cameraMotion.value.fov,le=(h=U.fov)!==null&&h!==void 0?h:this.cameraMotion.value.fov,ae=1;r.effect==="zoomin"?ae=1.5:r.effect==="zoomout"&&(ae=.4);for(var oe=clamp$1(le*ae,1,170),se=0;se<_.length-1;se++){var pe=_[se].key;if(pe){var de=this.panoResources[pe];de&&(de.fixCameraTransform.copy(ee),de.panoPicture&&(de.panoPicture.zoom=Math.tan(oe/2/180*Math.PI)/Math.tan(re/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=U.longitude)!==null&&g!==void 0?g:this.cameraMotion.value.longitude,latitude:(A=U.latitude)!==null&&A!==void 0?A:this.cameraMotion.value.latitude,fov:oe}},{progress:1,value:{longitude:(m=U.longitude)!==null&&m!==void 0?m:this.cameraMotion.value.longitude,latitude:(E=U.latitude)!==null&&E!==void 0?E:this.cameraMotion.value.latitude,fov:le}}],Q).catch(noop$1)}var xe=this.locationMotion.setKeyframes(_,Q,S);xe.then(function(){for(var ce=0,Re=s.modelScene.children;ce<Re.length;ce++){var j=Re[ce];j instanceof Model&&j.show()}var te=__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:X,progress:1,state:te,userAction:s.userAction,error:null})),o.moveEndCallback&&o.moveEndCallback(te);var V=s.works.getResolvedObserver(e);if(V&&V.video&&s.videoTexture&&s.videoTexture.image instanceof HTMLVideoElement){var be={map:s.videoTexture,size:V.video.size,matrix:V.video.matrix,panoMatrix:V.matrix,alpha:1},fe=createUuid(),ve=s.videoTexture.image;ve.setAttribute("uuid",fe),canplayVideo().then(function(Ve){Ve&&V.video&&ve.getAttribute("uuid")===fe&&(ve.oncanplay=function(){ve.oncanplay=noop$1,ve.play()},ve.ontimeupdate=function(){ve.currentTime>.5&&(ve.ontimeupdate=noop$1,s.panoVideo.setMaterial(be))},ve.src=V.video.source)}).catch(function(){ve.removeAttribute("uuid")})}},function(){s.emit("pano.cancel",createEvent("pano.cancel",{options:o,prevPano:X,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.modelScene.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.modelScene.intersectRaycaster(s)[0],p=c?c.point:s.ray.origin.clone().add(s.ray.direction.clone().normalize().multiplyScalar(3)),f=p.clone().sub(u).normalize();if(f.length()===0)return null;for(var d=o.accessibleIds.filter(function(_){if(_===panoStringify(r.currentPano))return!1;var S=r.works.getResolvedObserver(_);if(!S)return!1;var R=S.standingPosition.clone().project(r.camera);return Math.abs(R.z)>1||Math.abs(R.x)>1||Math.abs(R.y)>1?!1:S.loadable||S.active}),h=d.slice().sort(function(_,S){var R=r.works.getResolvedObserver(_).standingPosition.clone().distanceTo(u),M=r.works.getResolvedObserver(S).standingPosition.clone().distanceTo(u);return R-M}),g=0,A=[Math.PI/8,Math.PI/6,Math.PI/4,Math.PI/3];g<A.length;g++)for(var m=A[g],E=0,v=h;E<v.length;E++){var y=v[E],b=this.works.getResolvedObserver(y);if(b){var T=b.standingPosition.clone().sub(u);if(T&&T.length()!==0&&f.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,p=this.works.getResolvedObserver(this.currentPano);if(p){var f=p.accessibleIds.filter(function(q){if(q===panoStringify(r.currentPano))return!1;var X=r.works.getResolvedObserver(q);return!X||X.position.distanceTo(r.camera.position)>r.maxAccessibleDistance?!1:X.loadable||X.active}),d=this.modelScene.intersectRaycaster(u)[0];if(d){var h=arrayMin(f,function(q){var X=r.works.getResolvedObserver(q);if(!X)return 1/0;var Z=X.standingPosition.clone();return Z.distanceTo(d.point)},!0),g=h[0],A=h[1];g&&A<this.panoTapTriggerRadius&&(c=(o=this.works.getResolvedObserver(g))!==null&&o!==void 0?o:null)}c||(c=this.getForwardObserverOrNot(u));for(var m=0,E=this.locationMotion.keyframes;m<E.length;m++){var v=E[m],y=this.panoResourceFromLocationMotionKeyframe(v);if(!(v.progress<this.locationMotion.progress)&&c&&y.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,S=c.position.clone().setY(0).sub(p.position.clone().setY(0)).normalize(),R=[],M=[],H=[],B=0,C=c.accessibleIds;B<C.length;B++){var g=C[B],w=panoParse(g);if(!(panoEqual(w,this.currentPano)||panoEqual(w,c.pano))){var I=this.works.getResolvedObserver(g);if(I){var O=I.position.clone().sub(c.position).setY(0);S.angleTo(O)<T&&H.push(O)}}}var L=H.length>0?H:__spreadArray(__spreadArray([],R,!0),M,!0),N=L.slice().sort(function(q,X){return q.angleTo(S)-X.angleTo(S)})[0];if(N&&N.angleTo(l)>_&&(b.longitude=Math.atan2(-N.x,-N.z)),this.cameraMotion.value.latitude<-Math.PI/4){var z=e.state.fov,J=clamp$1(typeof this.minLatitude=="function"?this.minLatitude(z):this.minLatitude,-Math.PI/2,Math.PI/2),K=clamp$1(typeof this.maxLatitude=="function"?this.maxLatitude(z):this.maxLatitude,-Math.PI/2,Math.PI/2);b.latitude=clamp$1(0,J,K)}var Q=__assign({},e.state);if(Q.workCode=c.pano.workCode,Q.panoIndex=c.pano.panoIndex,b.longitude!==void 0&&(Q.longitude=b.longitude),b.latitude!==void 0&&(Q.latitude=b.latitude),b.fov!==void 0&&(Q.fov=b.fov),Q.distance=0,Q.offset=c.position.clone(),e.state=Q,this.emit("gesture.tap",e),!e.defaultPrevented){if(this.emit("pano.select",createEvent("pano.select",{prevPano:this.currentPano,state:Q,userAction:e.userAction,options:b,progress:0,error:null})),c&&!c.active){var U=c.panoId;this.panoMeshes[U]&&(this.panoMeshes[U].setDisabled(!1),this.panoMeshes[U].setLoading(!0))}c&&c.active&&this.emit("pano.request",createEvent("pano.request",{userAction:e.userAction,prevPano:this.currentPano,progress:0,state:Q,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,p=o?o[3]:1,f=u+u,d=l+l,h=c+c,g=u*f,A=u*d,m=u*h,E=l*d,v=l*h,y=c*h,b=p*f,T=p*d,_=p*h;return r[0]=1-(E+y),r[1]=A+_,r[2]=m-T,r[3]=0,r[4]=A-_,r[5]=1-(g+y),r[6]=v+b,r[7]=0,r[8]=m+T,r[9]=v-b,r[10]=1-(g+E),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],p,f,d,h,g,A,m,E,v,y,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]):(p=o[0],f=o[1],d=o[2],h=o[3],g=o[4],A=o[5],m=o[6],E=o[7],v=o[8],y=o[9],b=o[10],T=o[11],r[0]=p,r[1]=f,r[2]=d,r[3]=h,r[4]=g,r[5]=A,r[6]=m,r[7]=E,r[8]=v,r[9]=y,r[10]=b,r[11]=T,r[12]=p*u+g*l+v*c+o[12],r[13]=f*u+A*l+y*c+o[13],r[14]=d*u+m*l+b*c+o[14],r[15]=h*u+E*l+T*c+o[15]),r}function e(r,o){var s=o[0],u=o[1],l=o[2],c=o[3],p=o[4],f=o[5],d=o[6],h=o[7],g=o[8],A=o[9],m=o[10],E=o[11],v=o[12],y=o[13],b=o[14],T=o[15],_=s*f-u*p,S=s*d-l*p,R=s*h-c*p,M=u*d-l*f,H=u*h-c*f,B=l*h-c*d,C=g*y-A*v,w=g*b-m*v,I=g*T-E*v,O=A*b-m*y,L=A*T-E*y,N=m*T-E*b,z=_*N-S*L+R*O+M*I-H*w+B*C;return z?(z=1/z,r[0]=(f*N-d*L+h*O)*z,r[1]=(l*L-u*N-c*O)*z,r[2]=(y*B-b*H+T*M)*z,r[3]=(m*H-A*B-E*M)*z,r[4]=(d*I-p*N-h*w)*z,r[5]=(s*N-l*I+c*w)*z,r[6]=(b*R-v*B-T*S)*z,r[7]=(g*B-m*R+E*S)*z,r[8]=(p*L-f*I+h*C)*z,r[9]=(u*I-s*L-c*C)*z,r[10]=(v*H-y*R+T*_)*z,r[11]=(A*R-g*H-E*_)*z,r[12]=(f*w-p*O-d*C)*z,r[13]=(s*O-u*w+l*C)*z,r[14]=(y*S-v*M-b*_)*z,r[15]=(g*M-A*S+m*_)*z,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,p=2/(l+c),f=2/(s+u);o.left[0]=p,o.left[1]=0,o.left[2]=0,o.left[3]=0,o.left[4]=0,o.left[5]=f,o.left[6]=0,o.left[7]=0,o.left[8]=-((l-c)*p*.5),o.left[9]=(s-u)*f*.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,p=2/(l+c),f=2/(s+u);o.right[0]=p,o.right[1]=0,o.right[2]=0,o.right[3]=0,o.right[4]=0,o.right[5]=f,o.right[6]=0,o.right[7]=0,o.right[8]=-((l-c)*p*.5),o.right[9]=(s-u)*f*.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,p=RAD_TO_DEG*Math.atan(r.distort(s/o)),f=RAD_TO_DEG*Math.atan(r.distort(u/o)),d=RAD_TO_DEG*Math.atan(r.distort(l/o)),h=RAD_TO_DEG*Math.atan(r.distort(c/o)),g=new FieldOfView,A=new FieldOfView;return g.leftDegrees=Math.min(p,t.fov),g.rightDegrees=Math.min(f,t.fov),g.downDegrees=Math.min(d,t.fov),g.upDegrees=Math.min(h,t.fov),A.leftDegrees=g.rightDegrees,A.rightDegrees=g.leftDegrees,A.upDegrees=g.upDegrees,A.downDegrees=g.downDegrees,{left:g,right:A}},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+urq4wMDCxsbG2tra5ubliYmIuLi6zs7NHR0empqY0NDRCQkKqqqo5OTmoq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},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=`
|
|
1571
|
+
`,depthMaterial=new THREE__namespace.ShaderMaterial({vertexShader:depthVertexShader,fragmentShader:depthFragmentShader,uniforms:{maxDepth:new THREE__namespace.Uniform(0)}});function renderDepthCube(n,t,e,r){r===void 0&&(r=1e3),depthMaterial.uniforms.maxDepth.value=r,scratchPrevClearColor.copy(n.getClearColor());var o=n.getClearAlpha(),s=t.overrideMaterial;t.overrideMaterial=depthMaterial,n.setClearColor(clearColor,0),e.update(n,t),n.setClearColor(scratchPrevClearColor,o),t.overrideMaterial=s}var scratchRaycaster$1=new THREE__namespace.Raycaster,scratchVector3$1=new THREE__namespace.Vector3,adjustPanoCircleMeshVectors=[new THREE__namespace.Vector3(0,0,0).multiplyScalar(.1),new THREE__namespace.Vector3(1,0,0).multiplyScalar(.1),new THREE__namespace.Vector3(-.5,0,-Math.sqrt(3)/2).multiplyScalar(.1),new THREE__namespace.Vector3(-.5,0,+Math.sqrt(3)/2).multiplyScalar(.1)],defaultPanoramaControllerCustomInitArgs=__assign(__assign({},defaultPanoramaLikeControllerCustomInitArgs),{maxAccessibleDistance:5,panoTapTriggerRadius:.5,panoCircleMeshCreator:function(n){return new PanoCircleMesh},adjustPanoCircleMeshPositionBasedOnModel:!1,tileLevelForFov:function(n,t){var e,r=function(l){return l/180*Math.PI},o=(e=Math.log2)!==null&&e!==void 0?e:function(l){return Math.log(l)*Math.LOG2E},s=t.height/2/Math.tan(r(n/2))*Math.tan(r(45))*2,u=Math.max(o(s/512),0);return u<2.3&&u>.1&&(u=1),u=u%1>.75?Math.ceil(u):Math.floor(u),u},tileAppearDuration:.5,tileMaxRequest:3,flyEffectUseDepthBuffer:!1}),PanoramaController=function(n){__extends(t,n);function t(e){var r=this,o=t.parseArgs(e);r=n.call(this,o)||this,r.mode="Panorama",r.initAnimationed=!1,r.maxAccessibleDistance=o.maxAccessibleDistance,r.panoTapTriggerRadius=o.panoTapTriggerRadius,r.panoCircleMeshCreator=o.panoCircleMeshCreator,r.adjustPanoCircleMeshPositionBasedOnModel=o.adjustPanoCircleMeshPositionBasedOnModel,r.tileLevelForFov=o.tileLevelForFov,r.tileAppearDuration=o.tileAppearDuration,r.tileMaxRequest=o.tileMaxRequest,r.flyEffectUseDepthBuffer=o.flyEffectUseDepthBuffer;var s=r.modelScene.parameter.resolveValue(),u=s.pano0,l=s.pano1;u&&(l==null?void 0:l.map)!==u.map&&(r.modelScene.parameter.set({pano0:l}),u.map.dispose());var c=new Set;return u&&c.add(u),l&&c.add(l),r.panoMeshes={},r.updatePanoMeshes(),r.locationMotion=new Motion({count:0,distance:r.camera.pose.distance}),r.modelAlphaMotion=new Motion({modelAlpha:r.modelScene.parameter.resolveValue().modelAlpha}),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:r.modelScene.parameter.resolveValue().pano1,position:r.camera.pose.offset.clone(),effect:"fly",fixCameraTransform:new THREE__namespace.Matrix4},r.panoPictureObserverMap=new WeakMap,r.textureLoader=new TextureLoader,r.tiling=new Tiling,r.panoVideo=new PanoVideo,r.scene.add(r.panoVideo.object),r.accessibleObserverFloorCheckCount=0,r}return t.parseArgs=function(e){var r,o,s,u,l,c,p,f;if(e instanceof t)return e;var d=n.parseArgs.call(this,e);return __assign(__assign({},d),{maxAccessibleDistance:(r=e.maxAccessibleDistance)!==null&&r!==void 0?r:defaultPanoramaControllerCustomInitArgs.maxAccessibleDistance,panoTapTriggerRadius:(o=e.panoTapTriggerRadius)!==null&&o!==void 0?o:defaultPanoramaControllerCustomInitArgs.panoTapTriggerRadius,panoCircleMeshCreator:(s=e.panoCircleMeshCreator)!==null&&s!==void 0?s:defaultPanoramaControllerCustomInitArgs.panoCircleMeshCreator,adjustPanoCircleMeshPositionBasedOnModel:(u=e.adjustPanoCircleMeshPositionBasedOnModel)!==null&&u!==void 0?u:defaultPanoramaControllerCustomInitArgs.adjustPanoCircleMeshPositionBasedOnModel,tileLevelForFov:(l=e.tileLevelForFov)!==null&&l!==void 0?l:defaultPanoramaControllerCustomInitArgs.tileLevelForFov,tileAppearDuration:(c=e.tileAppearDuration)!==null&&c!==void 0?c:defaultPanoramaControllerCustomInitArgs.tileAppearDuration,tileMaxRequest:(p=e.tileMaxRequest)!==null&&p!==void 0?p:defaultPanoramaControllerCustomInitArgs.tileMaxRequest,flyEffectUseDepthBuffer:(f=e.flyEffectUseDepthBuffer)!==null&&f!==void 0?f:defaultPanoramaControllerCustomInitArgs.flyEffectUseDepthBuffer})},t.initAnimationEndState=function(e){var r=this.parseArgs(e),o=n.initAnimationEndState.call(this,r);return __assign(__assign({},o),{mode:"Panorama"})},Object.defineProperty(t.prototype,"tileLevel",{get:function(){return this.tiling.level},enumerable:!1,configurable:!0}),t.prototype.updateConfiguration=function(e){var r=n.prototype.updateConfiguration.call(this,e);if(r===!1)return!1;if(e.maxAccessibleDistance!==void 0&&this.maxAccessibleDistance!==e.maxAccessibleDistance&&(this.maxAccessibleDistance=e.maxAccessibleDistance),e.panoTapTriggerRadius!==void 0&&this.panoTapTriggerRadius!==e.panoTapTriggerRadius&&(this.panoTapTriggerRadius=e.panoTapTriggerRadius),e.panoCircleMeshCreator!==void 0&&this.panoCircleMeshCreator!==e.panoCircleMeshCreator&&(this.panoCircleMeshCreator=e.panoCircleMeshCreator,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]}this.updatePanoMeshes()}return e.tileLevelForFov!==void 0&&this.tileLevelForFov!==e.tileLevelForFov&&(this.tileLevelForFov=e.tileLevelForFov),e.tileMaxRequest!==void 0&&this.tileMaxRequest!==e.tileMaxRequest&&(this.tileMaxRequest=e.tileMaxRequest),e.flyEffectUseDepthBuffer!==void 0&&this.flyEffectUseDepthBuffer!==e.flyEffectUseDepthBuffer&&(this.flyEffectUseDepthBuffer=e.flyEffectUseDepthBuffer),e.adjustPanoCircleMeshPositionBasedOnModel!==void 0&&this.adjustPanoCircleMeshPositionBasedOnModel!==e.adjustPanoCircleMeshPositionBasedOnModel&&(this.adjustPanoCircleMeshPositionBasedOnModel=e.adjustPanoCircleMeshPositionBasedOnModel),!0},t.prototype.destroy=function(){if(n.prototype.destroy.call(this),this.tiling.dispose(),this.modelScene.parameter.set({refinedScreen:null,pano0Depth:null,pano1Depth:null}),this.pano0DepthCubeRenderTarget&&(this.pano0DepthCubeRenderTarget.dispose(),this.pano0DepthCubeRenderTarget=void 0),this.pano1DepthCubeRenderTarget&&(this.pano1DepthCubeRenderTarget.dispose(),this.pano1DepthCubeRenderTarget=void 0),this.locationMotion.dispose(),delete this.pendingTextureTask,this.panoMeshes)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]}var l=this.videoTexture.image;l.pause(),l.oncanplay=function(){},l.ontimeupdate=function(){},this.scene.remove(this.panoVideo.object),this.panoVideo.setMaterial(null),this.panoVideo.dispose();for(var c=this.modelScene.parameter.resolveValue(),p=c.pano0,f=c.pano1,d=0,h=Object.keys(this.panoResources);d<h.length;d++){var g=h[d],A=this.panoResources[g];if(A.panoPicture){var m=A.panoPicture.map;m&&m!==(p==null?void 0:p.map)&&m!==(f==null?void 0:f.map)&&(m.dispose(),A.panoPicture=null)}delete this.panoResources[g]}},t.prototype.isReady=function(){return this.locationMotion.ended!==!0?!1:n.prototype.isReady.call(this)},t.prototype.isTileReady=function(){var e=this.tiling.pedding,r=e<=0;return this.initAnimationed&&r},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};return 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.modelScene=e,this.updatePanoMeshes(),this.hideIntersectMesh()},t.prototype.updateTime=function(e,r){var o=this,s,u,l,c,p,f;if(!this.destroyed){var d={},h={},g=this.locationMotion.keyframes[0],A=this.locationMotion.keyframes[this.locationMotion.keyframes.length-1],m=this.locationMotion.getKeyFrameSegment(e),E=m[0],v=m[1],y=this.panoResourceFromLocationMotionKeyframe(E),b=this.panoResourceFromLocationMotionKeyframe(v),T=this.panoResourceFromLocationMotionKeyframe(g),_=this.panoResourceFromLocationMotionKeyframe(A),S=!1;if(this.cameraMotion.ended===!1&&(this.cameraMotion.update(e),h.longitude=this.cameraMotion.value.longitude,h.latitude=this.cameraMotion.value.latitude,h.fov=this.cameraMotion.value.fov),this.modelAlphaMotion.ended===!1&&(this.modelAlphaMotion.update(e),d.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 R=new THREE__namespace.Vector3().copy(y.position),M=new THREE__namespace.Vector3().copy(b.position),H=this.locationMotion.value.count-v.value.count+1;if(d.progress=H,b.panoPicture&&(H<1?y.panoPicture&&(d.pano0=y.panoPicture):d.pano0=b.panoPicture,d.pano1=b.panoPicture),b.effect==="montage"?d.transition="BLACK":b.effect==="spread"?d.transition="SPREAD":d.transition="FADE",(b.effect==="zoomin"||b.effect==="zoomout")&&(d.progress=Math.pow(H,3)),H<1&&b.effect!=="fly"){if(d.pano0&&y.panoPicture){var B={panoId:d.pano0.panoId,map:d.pano0.map,mapSize:d.pano0.mapSize,zoom:d.pano0.zoom,matrix:y.panoPicture.matrix.clone().premultiply(y.fixCameraTransform).setPosition(b.position)},C=this.panoPictureObserverMap.get(d.pano0);C&&this.panoPictureObserverMap.set(B,C),d.pano0=B}R.copy(M),S=!0}h.distance=this.locationMotion.value.distance,h.offset=new THREE__namespace.Vector3(R.x+(M.x-R.x)*H,R.y+(M.y-R.y)*H,R.z+(M.z-R.z)*H);for(var w=[],I=[],O=0,L=this.locationMotion.keyframes;O<L.length;O++){var N=L[O],z=N.key,J=N.progress;z!==void 0&&(w.push(z),J>this.locationMotion.progress&&I.push(z))}for(var G=0,Q=Object.keys(this.panoResources);G<Q.length;G++){var U=Q[G];if(!(I.indexOf(U)>=0)){var q=this.panoResources[U];if(q.panoPicture){var K=q.panoPicture.map;if(K){if(K===((s=d.pano0)===null||s===void 0?void 0:s.map)||K===((u=d.pano1)===null||u===void 0?void 0:u.map))continue;K.dispose(),q.panoPicture=null}}w.indexOf(U)>=0||delete this.panoResources[U]}}var Y=panoParse(b.panoId);Y!==this.currentPano&&(this.currentPano=Y,this.accessibleObserverFloorCheckCount=0),this.emit("pano.moving",createEvent("pano.moving",{userAction:this.userAction,prevPano:panoParse(T.panoId),state:__assign(__assign(__assign(__assign({},panoParse(_.panoId)),{mode:this.mode}),clonePose(this.camera.pose)),h),options:{},progress:this.locationMotion.progress,error:null}))}isEmptyObject(d)===!1&&this.modelScene.parameter.set(d),isEmptyObject(h)===!1&&this.setCamera(h);var Z=this.works.getResolvedObserver(this.currentPano),te=this.locationMotion.ended?this.getForwardObserverOrNot():null;if(this.camera.pose.distance>.1||S)for(var j=0,ee=Object.keys(this.panoMeshes);j<ee.length;j++){var W=ee[j],re=this.panoMeshes[W];re.setOpacity(0),re.setCurrent(!1),re.updateTime&&re.updateTime(e,r),re.visible=!1}else if(Z){var le=arrayMin(Z.visibleIds,function(Oe){var Fe=o.works.getResolvedObserver(Oe);return Fe?Z.standingPosition.distanceTo(Fe.standingPosition):1/0},!0),ae=le[1];ae=clamp$1(ae,2.5,1/0);for(var oe=Z.visibleIds.concat(panoStringify(this.currentPano)),se=this.camera.getDirection(new THREE__namespace.Vector3),ce=0,ve=Object.keys(this.panoMeshes);ce<ve.length;ce++){var W=ve[ce],re=this.panoMeshes[W],C=this.works.getResolvedObserver(W);if(oe.indexOf(W)===-1)re.setCurrent(!1),re.setOpacity(0);else if(!C)re.setCurrent(!1),re.setOpacity(0);else if(!C.loadable&&!C.active)re.setCurrent(!1),re.setOpacity(0);else{var Te=re.position.clone().setY(this.camera.position.y).distanceTo(this.camera.position);re.setCurrent(!re.loading&&re.progress===0&&te!==null&&te.panoId===W),re.setOpacity(Te<.01?0:clamp$1(ae/Te*1.2,.4,.85));var pe=this.camera.position.clone().setY(re.position.y),me=new THREE__namespace.Vector3().copy(re.position).sub(pe).normalize();if(W===panoStringify(this.currentPano)){var X=clamp$1((.5-pe.distanceTo(re.position))/.5,0,1);me.multiplyScalar(1-X).add(se.clone().multiplyScalar(X))}me.length()>0&&re.quaternion.setFromEuler(new THREE__namespace.Euler(0,Math.atan2(me.x,me.z),0))}re.updateTime&&re.updateTime(e,r)}}if(this.adjustPanoCircleMeshPositionBasedOnModel&&this.helper.visible&&Z){for(var ne=[],V=0,Ee=Z.accessibleIds;V<Ee.length;V++){var W=Ee[V],C=this.works.getResolvedObserver(W);C&&ne.push(C)}if(ne.sort(function(Oe,Fe){return Oe.standingPosition.distanceTo(Z.standingPosition)-Fe.standingPosition.distanceTo(Z.standingPosition)}),ne.length){this.accessibleObserverFloorCheckCount=this.accessibleObserverFloorCheckCount%ne.length;var fe=ne[this.accessibleObserverFloorCheckCount],re=this.panoMeshes[fe.panoId],he=this.modelScene.models.find(function(Fe){return Fe.work===(fe==null?void 0:fe.work)});if(fe&&re&&he&&he.visible){var Ne=.3,rt=.05,Ye=.005,ge=adjustPanoCircleMeshVectors.map(function(Fe){scratchVector3$1.copy(Fe),scratchVector3$1.setY(Ne),scratchRaycaster$1.ray.origin.copy(fe.standingPosition),scratchRaycaster$1.ray.origin.add(scratchVector3$1),scratchRaycaster$1.ray.direction.set(0,-1,0);var qe=he.intersectRaycaster(scratchRaycaster$1,null,!0)[0];return qe&&qe.distance-Ye<=Ne?new THREE__namespace.Vector3().copy(fe.standingPosition).setY(qe.point.y+Ye):fe.standingPosition});ge.sort(function(Fe,qe){return qe.y-Fe.y});var ie=ge[Math.floor(ge.length/2)],de=ge.filter(function(Fe){return Fe.distanceTo(ie)<=rt})[0];de&&!de.equals(re.position)&&(re.position.copy(de),this.needsRender=!0)}this.accessibleObserverFloorCheckCount++}}{var H=(l=this.modelScene.parameter.progress)!==null&&l!==void 0?l:1,Ce=Math.round(H),Se=this.modelScene.parameter.pano0,Be=this.modelScene.parameter.pano1,Le=Ce===0?Se:Be,C=void 0;if(Le&&(C=this.works.getResolvedObserver(Le.panoId),C||(C=this.panoPictureObserverMap.get(Le))),this.tiling.appearDuration=this.tileAppearDuration,this.tiling.maxRequest=H<=.6?0:H<1?1:this.tileMaxRequest,this.tiling.imageOptions=this.imageOptions,!C||!Le||this.tileLevelForFov===!1)this.tiling.setObserver(null),this.tiling.update(this.renderer,this.camera,null,new THREE__namespace.Matrix4,1,0,0),this.modelScene.parameter.set("refinedScreen",null);else{var be=getImageSizeLevel(Le.mapSize),Me=be+1,we=new THREE__namespace.Vector2().copy(this.camera.resolution).multiplyScalar(this.camera.pixelRatio),Pe=Math.floor(this.tileLevelForFov(this.camera.fov,we)),ze=Pe>be?Pe:0;this.tiling.setObserver(C);var Ge=this.tiling.update(this.renderer,this.camera,Le.map,Le.matrix,Le.zoom,Me,ze),He={map:this.tiling.renderTarget.texture,matrixInverse:this.tiling.camera.matrixWorldInverse,projectionMatrix:this.tiling.camera.projectionMatrix,pano:Ce,opacity:(Se==null?void 0:Se.panoId)===(Be==null?void 0:Be.panoId)?1:easeInQuart(Math.abs(((c=this.modelScene.parameter.progress)!==null&&c!==void 0?c:0)-.5)*2)},Ve=this.modelScene.parameter.refinedScreen;(Ge||He.pano!==(Ve==null?void 0:Ve.pano)||He.opacity!==(Ve==null?void 0:Ve.opacity))&&this.modelScene.parameter.set("refinedScreen",He)}}this.panoVideo.object.position.copy(this.camera.position),this.panoVideo.updateTime(e),Z&&Z.video&&(this.needsRender=!0),this.intersectMesh.scale.setScalar(clamp$1(this.cameraMotion.value.fov/45,0,1));{var $e=b.effect,Ie=this.modelScene.parameter,Se=Ie.pano0,Be=Ie.pano1;if(Se&&Be&&Se!==Be&&$e==="fly"&&this.flyEffectUseDepthBuffer){if(((p=this.modelScene.parameter.pano0Depth)===null||p===void 0?void 0:p.panoId)!==Se.panoId||((f=this.modelScene.parameter.pano1Depth)===null||f===void 0?void 0:f.panoId)!==Be.panoId){var je=500,xe=512;this.pano0DepthCubeRenderTarget?this.pano0DepthCubeRenderTarget.width!==xe&&this.pano0DepthCubeRenderTarget.setSize(xe,xe):this.pano0DepthCubeRenderTarget=new THREE__namespace.WebGLCubeRenderTarget(xe,{minFilter:THREE__namespace.NearestFilter,magFilter:THREE__namespace.NearestFilter,generateMipmaps:!1}),this.pano1DepthCubeRenderTarget?this.pano1DepthCubeRenderTarget.width!==xe&&this.pano1DepthCubeRenderTarget.setSize(xe,xe):this.pano1DepthCubeRenderTarget=new THREE__namespace.WebGLCubeRenderTarget(xe,{minFilter:THREE__namespace.NearestFilter,magFilter:THREE__namespace.NearestFilter,generateMipmaps:!1});var We=new THREE__namespace.CubeCamera(this.camera.near,this.camera.far,this.pano0DepthCubeRenderTarget);We.matrix.copy(Se.matrix),We.matrixWorld.copy(We.matrix),We.matrixAutoUpdate=!1,renderDepthCube(this.renderer,this.modelScene,We,je);var _e=new THREE__namespace.CubeCamera(this.camera.near,this.camera.far,this.pano1DepthCubeRenderTarget);_e.matrix.copy(Be.matrix),_e.matrixWorld.copy(_e.matrix),_e.matrixAutoUpdate=!1,renderDepthCube(this.renderer,this.modelScene,_e,je),this.modelScene.parameter.set({pano0Depth:{panoId:Se.panoId,map:this.pano0DepthCubeRenderTarget.texture,mapSize:this.pano0DepthCubeRenderTarget.width,maxDepth:je},pano1Depth:{panoId:Be.panoId,map:this.pano1DepthCubeRenderTarget.texture,mapSize:this.pano1DepthCubeRenderTarget.width,maxDepth:je}})}}else this.modelScene.parameter.set({pano0Depth:null,pano1Depth:null}),this.flyEffectUseDepthBuffer||(this.pano0DepthCubeRenderTarget&&(this.pano0DepthCubeRenderTarget.dispose(),this.pano0DepthCubeRenderTarget=void 0),this.pano1DepthCubeRenderTarget&&(this.pano1DepthCubeRenderTarget.dispose(),this.pano1DepthCubeRenderTarget=void 0))}}},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=(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)));getImageSizeFromURL(p.images.up),this.imageOptions.size;var f=this.imageOptions.transform,d=__assign({key:"pano.".concat(p.panoId)},pick(this.imageOptions,["format","size","quality","sharpen","mappings"])),h=p.images,g="pano:"+jsonHash([h,d,f]);if(this.pendingTextureTask){if(this.pendingTextureTask.hash===g)return;var A=this.pendingTextureTask.panoId;(l=this.panoMeshes[A])===null||l===void 0||l.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 E=this.modelScene.parameter.resolveValue(),v=E.pano0,y=E.pano1,b;if(v&&v.map.name===g?b=v:(y==null?void 0:y.map.name)===g&&(b=y),b){var T={panoId:p.panoId,effect:c,panoPicture:{panoId:b.panoId,map:b.map,mapSize:b.mapSize,matrix:p.matrix.clone(),zoom:1},position:p.position.clone(),fixCameraTransform:new THREE__namespace.Matrix4};T.panoPicture&&this.panoPictureObserverMap.set(T.panoPicture,p),AnimationFrameLoop.shared.add(function(){s.pending.delete(m),s.doMoveToPano(p.pano,T,r)},!0,1);return}this.pendingTextureTask={panoId:p.panoId,hash:g,onLoad:function(S){var R;s.pending.delete(m);var M=S.body;if(s.destroyed)M.dispose();else{M.name=g;var H=Array.isArray(M.image)?M.image[0]:M.image,B=(R=H==null?void 0:H.width)!==null&&R!==void 0?R:2048,C={panoId:p.panoId,effect:c,panoPicture:{panoId:p.panoId,map:M,mapSize:B,matrix:p.matrix.clone(),zoom:1},position:p.position.clone(),fixCameraTransform:new THREE__namespace.Matrix4};C.panoPicture&&s.panoPictureObserverMap.set(C.panoPicture,p),s.doMoveToPano(p.pano,C,r)}},onError:function(S){s.pending.delete(m);var R=__assign(__assign(__assign({},p.pano),{mode:s.mode}),clonePose(s.camera.pose));s.emit("pano.error",createEvent("pano.error",{error:S,userAction:s.userAction,options:r,prevPano:s.currentPano,progress:0,state:R})),s.emit("pano.cancel",createEvent("pano.cancel",{error:S,userAction:s.userAction,options:r,prevPano:s.currentPano,progress:0,state:R})),s.emit("error",S),r.moveCancelCallback&&r.moveCancelCallback()}};var _=this.panoMeshes[p.panoId];_&&_.tap&&_.tap(),this.textureLoader.loadCubeTexture(h,{imageURL:{transform:f,options:d},format:THREE__namespace.RGBAFormat,viaAjax:!0,fetcher:getFetcher(p.work)},void 0,void 0,function(S){var R,M;s.emit("pano.texture.progress",createEvent("pano.texture.progress",{error:null,progress:S,meta:null,pano:p.pano})),((R=s.pendingTextureTask)===null||R===void 0?void 0:R.hash)===g&&((M=s.panoMeshes[p.panoId])===null||M===void 0||M.setProgress(S))},this.renderer).then(function(S){var R,M;((R=s.pendingTextureTask)===null||R===void 0?void 0:R.hash)===g?(s.pendingTextureTask.onLoad(S),(M=s.panoMeshes[p.panoId])===null||M===void 0||M.setProgress(0),delete s.pendingTextureTask,s.emit("pano.texture.success",createEvent("pano.texture.success",{error:null,progress:1,meta:S.meta,pano:p.pano}))):S.body.dispose()}).catch(function(S){var R,M;((R=s.pendingTextureTask)===null||R===void 0?void 0:R.hash)===g&&(s.pendingTextureTask.onError(S),(M=s.panoMeshes[p.panoId])===null||M===void 0||M.setProgress(0),delete s.pendingTextureTask,s.emit("pano.texture.error",createEvent("pano.texture.error",{error:S,progress:0,meta:null,pano:p.pano})),s.emit("error",S))}),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),p={workCode:c.workCode,panoIndex:c.panoIndex},f={modelAlpha:0},d={perspToOrtho:0},h=!1;e.moveToPano(p,{longitude:c.longitude,latitude:c.latitude,fov:c.fov,effect:u,duration:s,moveStartCallback:function(g){h=!0,e.perspToOrthoMotion.set(d,s).catch(noop$1),e.modelAlphaMotion.setKeyframes([{progress:0,value:__assign({},e.modelAlphaMotion.value)},{progress:.6,value:__assign({},e.modelAlphaMotion.value)},{progress:1,value:f}],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({},p),{mode:e.mode}),clonePose(e.camera.pose));h===!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 p=1,f={},d=function(S){var R=arrayMin(S.accessibleIds,function(H){var B=e.works.getResolvedObserver(H);if(!B)return 1/0;var C=B.standingPosition.distanceTo(S.standingPosition);return clamp$1(C,1,1/0)},!0),M=R[1];f[S.panoId]===void 0&&(f[S.panoId]=M)},h=0,g=this.works.resolvedObservers;h<g.length;h++){var A=g[h];d(A)}var m=Object.keys(f).map(function(S){return f[S]});if(m.length){var E=m.reduce(function(S,R){return S+R},0)/m.length;p=clamp$1(E*.6,1,3)}for(var v=0,y=this.works.resolvedObservers;v<y.length;v++){var A=y[v],c=void 0;r[A.panoId]?(c=r[A.panoId],c.loading===!0&&A.loadable===!1&&c.setLoading(!1),delete r[A.panoId]):(c=this.panoCircleMeshCreator(A.pano),c.name="PanoCircleMesh_"+A.panoId,this.helper.add(c)),c.scale.set(p,1,p),c.position.copy(A.standingPosition),this.panoMeshes[A.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,p,f,d,h,g,A,m,E;o===void 0&&(o={});var v=now(),y=createUuid();this.panoResources[y]=r;var b=1,T,_,S;if(this.locationMotion.ended){var R=this.locationMotion.getKeyFrameSegment(v);R[0];var M=R[1],H=this.locationMotion.value,B=((u=this.panoResourceFromLocationMotionKeyframe(M))!==null&&u!==void 0?u:this.camera).position,C=r.position;T=Math.max(B.distanceTo(C),b),_=[{key:M.key,progress:0,value:__assign(__assign({},H),{count:0})},{key:y,progress:1,value:{distance:0,count:1}}],S=0}else{var w=this.locationMotion.getKeyFrameSegment(v),I=w[0],M=w[1],H=this.locationMotion.value,O=this.panoResourceFromLocationMotionKeyframe(I).position,B=this.panoResourceFromLocationMotionKeyframe(M).position,C=r.position,L=M.value.count-H.count,N=Math.max(O.distanceTo(B),b)*L,z=Math.max(B.distanceTo(C),b);T=N+z,_=[{key:I.key,progress:0,value:__assign({},H)},{key:M.key,progress:N/T,value:M.value},{key:y,progress:1,value:{count:M.value.count+1,distance:0}}];var J=this.locationMotionKeyframesLength(this.locationMotion.keyframes),G=this.locationMotionKeyframesLength(_);J===0||J===0?S=0:S=this.locationMotion.getProgressVelocity(v)*J/G}var Q=r.effect==="instant"?0:this.calculateMovingDuration(o.duration,r.effect==="fly"?T:0),U={longitude:o.longitude,latitude:o.latitude,fov:o.fov},q=__assign(__assign({},e),{mode:this.mode,longitude:(l=U.longitude)!==null&&l!==void 0?l:this.camera.pose.longitude,latitude:(c=U.latitude)!==null&&c!==void 0?c:this.camera.pose.latitude,fov:(p=U.fov)!==null&&p!==void 0?p: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(U,Q).catch(noop$1);else{var Y=coordinatesToVector({longitude:this.cameraMotion.value.longitude,latitude:this.cameraMotion.value.latitude}),Z=coordinatesToVector({longitude:(f=U.longitude)!==null&&f!==void 0?f:this.cameraMotion.value.longitude,latitude:(d=U.latitude)!==null&&d!==void 0?d:this.cameraMotion.value.latitude}),te=new THREE__namespace.Object3D;te.lookAt(Y);var j=new THREE__namespace.Matrix4().makeRotationFromQuaternion(te.quaternion);te.lookAt(Z);var ee=new THREE__namespace.Matrix4().makeRotationFromQuaternion(te.quaternion),W=new THREE__namespace.Matrix4().getInverse(j).premultiply(ee),re=this.cameraMotion.value.fov,le=(h=U.fov)!==null&&h!==void 0?h:this.cameraMotion.value.fov,ae=1;r.effect==="zoomin"?ae=1.5:r.effect==="zoomout"&&(ae=.4);for(var oe=clamp$1(le*ae,1,170),se=0;se<_.length-1;se++){var ce=_[se].key;if(ce){var ve=this.panoResources[ce];ve&&(ve.fixCameraTransform.copy(W),ve.panoPicture&&(ve.panoPicture.zoom=Math.tan(oe/2/180*Math.PI)/Math.tan(re/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=U.longitude)!==null&&g!==void 0?g:this.cameraMotion.value.longitude,latitude:(A=U.latitude)!==null&&A!==void 0?A:this.cameraMotion.value.latitude,fov:oe}},{progress:1,value:{longitude:(m=U.longitude)!==null&&m!==void 0?m:this.cameraMotion.value.longitude,latitude:(E=U.latitude)!==null&&E!==void 0?E:this.cameraMotion.value.latitude,fov:le}}],Q).catch(noop$1)}var Te=this.locationMotion.setKeyframes(_,Q,S);Te.then(function(){for(var pe=0,me=s.modelScene.children;pe<me.length;pe++){var X=me[pe];X instanceof Model&&X.show()}var ne=__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:ne,userAction:s.userAction,error:null})),o.moveEndCallback&&o.moveEndCallback(ne);var V=s.works.getResolvedObserver(e);if(V&&V.video&&s.videoTexture&&s.videoTexture.image instanceof HTMLVideoElement){var Ee={map:s.videoTexture,size:V.video.size,matrix:V.video.matrix,panoMatrix:V.matrix,alpha:1},fe=createUuid(),he=s.videoTexture.image;he.setAttribute("uuid",fe),canplayVideo().then(function(Ne){Ne&&V.video&&he.getAttribute("uuid")===fe&&(he.oncanplay=function(){he.oncanplay=noop$1,he.play()},he.ontimeupdate=function(){he.currentTime>.5&&(he.ontimeupdate=noop$1,s.panoVideo.setMaterial(Ee))},he.src=V.video.source)}).catch(function(){he.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.modelScene.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.modelScene.intersectRaycaster(s)[0],p=c?c.point:s.ray.origin.clone().add(s.ray.direction.clone().normalize().multiplyScalar(3)),f=p.clone().sub(u).normalize();if(f.length()===0)return null;for(var d=o.accessibleIds.filter(function(_){if(_===panoStringify(r.currentPano))return!1;var S=r.works.getResolvedObserver(_);if(!S)return!1;var R=S.standingPosition.clone().project(r.camera);return Math.abs(R.z)>1||Math.abs(R.x)>1||Math.abs(R.y)>1?!1:S.loadable||S.active}),h=d.slice().sort(function(_,S){var R=r.works.getResolvedObserver(_).standingPosition.clone().distanceTo(u),M=r.works.getResolvedObserver(S).standingPosition.clone().distanceTo(u);return R-M}),g=0,A=[Math.PI/8,Math.PI/6,Math.PI/4,Math.PI/3];g<A.length;g++)for(var m=A[g],E=0,v=h;E<v.length;E++){var y=v[E],b=this.works.getResolvedObserver(y);if(b){var T=b.standingPosition.clone().sub(u);if(T&&T.length()!==0&&f.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,p=this.works.getResolvedObserver(this.currentPano);if(p){var f=p.accessibleIds.filter(function(q){if(q===panoStringify(r.currentPano))return!1;var K=r.works.getResolvedObserver(q);return!K||K.position.distanceTo(r.camera.position)>r.maxAccessibleDistance?!1:K.loadable||K.active}),d=this.modelScene.intersectRaycaster(u)[0];if(d){var h=arrayMin(f,function(q){var K=r.works.getResolvedObserver(q);if(!K)return 1/0;var Y=K.standingPosition.clone();return Y.distanceTo(d.point)},!0),g=h[0],A=h[1];g&&A<this.panoTapTriggerRadius&&(c=(o=this.works.getResolvedObserver(g))!==null&&o!==void 0?o:null)}c||(c=this.getForwardObserverOrNot(u));for(var m=0,E=this.locationMotion.keyframes;m<E.length;m++){var v=E[m],y=this.panoResourceFromLocationMotionKeyframe(v);if(!(v.progress<this.locationMotion.progress)&&c&&y.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,S=c.position.clone().setY(0).sub(p.position.clone().setY(0)).normalize(),R=[],M=[],H=[],B=0,C=c.accessibleIds;B<C.length;B++){var g=C[B],w=panoParse(g);if(!(panoEqual(w,this.currentPano)||panoEqual(w,c.pano))){var I=this.works.getResolvedObserver(g);if(I){var O=I.position.clone().sub(c.position).setY(0);S.angleTo(O)<T&&H.push(O)}}}var L=H.length>0?H:__spreadArray(__spreadArray([],R,!0),M,!0),N=L.slice().sort(function(q,K){return q.angleTo(S)-K.angleTo(S)})[0];if(N&&N.angleTo(l)>_&&(b.longitude=Math.atan2(-N.x,-N.z)),this.cameraMotion.value.latitude<-Math.PI/4){var z=e.state.fov,J=clamp$1(typeof this.minLatitude=="function"?this.minLatitude(z):this.minLatitude,-Math.PI/2,Math.PI/2),G=clamp$1(typeof this.maxLatitude=="function"?this.maxLatitude(z):this.maxLatitude,-Math.PI/2,Math.PI/2);b.latitude=clamp$1(0,J,G)}var Q=__assign({},e.state);if(Q.workCode=c.pano.workCode,Q.panoIndex=c.pano.panoIndex,b.longitude!==void 0&&(Q.longitude=b.longitude),b.latitude!==void 0&&(Q.latitude=b.latitude),b.fov!==void 0&&(Q.fov=b.fov),Q.distance=0,Q.offset=c.position.clone(),e.state=Q,this.emit("gesture.tap",e),!e.defaultPrevented){if(this.emit("pano.select",createEvent("pano.select",{prevPano:this.currentPano,state:Q,userAction:e.userAction,options:b,progress:0,error:null})),c&&!c.active){var U=c.panoId;this.panoMeshes[U]&&(this.panoMeshes[U].setDisabled(!1),this.panoMeshes[U].setLoading(!0))}c&&c.active&&this.emit("pano.request",createEvent("pano.request",{userAction:e.userAction,prevPano:this.currentPano,progress:0,state:Q,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,p=o?o[3]:1,f=u+u,d=l+l,h=c+c,g=u*f,A=u*d,m=u*h,E=l*d,v=l*h,y=c*h,b=p*f,T=p*d,_=p*h;return r[0]=1-(E+y),r[1]=A+_,r[2]=m-T,r[3]=0,r[4]=A-_,r[5]=1-(g+y),r[6]=v+b,r[7]=0,r[8]=m+T,r[9]=v-b,r[10]=1-(g+E),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],p,f,d,h,g,A,m,E,v,y,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]):(p=o[0],f=o[1],d=o[2],h=o[3],g=o[4],A=o[5],m=o[6],E=o[7],v=o[8],y=o[9],b=o[10],T=o[11],r[0]=p,r[1]=f,r[2]=d,r[3]=h,r[4]=g,r[5]=A,r[6]=m,r[7]=E,r[8]=v,r[9]=y,r[10]=b,r[11]=T,r[12]=p*u+g*l+v*c+o[12],r[13]=f*u+A*l+y*c+o[13],r[14]=d*u+m*l+b*c+o[14],r[15]=h*u+E*l+T*c+o[15]),r}function e(r,o){var s=o[0],u=o[1],l=o[2],c=o[3],p=o[4],f=o[5],d=o[6],h=o[7],g=o[8],A=o[9],m=o[10],E=o[11],v=o[12],y=o[13],b=o[14],T=o[15],_=s*f-u*p,S=s*d-l*p,R=s*h-c*p,M=u*d-l*f,H=u*h-c*f,B=l*h-c*d,C=g*y-A*v,w=g*b-m*v,I=g*T-E*v,O=A*b-m*y,L=A*T-E*y,N=m*T-E*b,z=_*N-S*L+R*O+M*I-H*w+B*C;return z?(z=1/z,r[0]=(f*N-d*L+h*O)*z,r[1]=(l*L-u*N-c*O)*z,r[2]=(y*B-b*H+T*M)*z,r[3]=(m*H-A*B-E*M)*z,r[4]=(d*I-p*N-h*w)*z,r[5]=(s*N-l*I+c*w)*z,r[6]=(b*R-v*B-T*S)*z,r[7]=(g*B-m*R+E*S)*z,r[8]=(p*L-f*I+h*C)*z,r[9]=(u*I-s*L-c*C)*z,r[10]=(v*H-y*R+T*_)*z,r[11]=(A*R-g*H-E*_)*z,r[12]=(f*w-p*O-d*C)*z,r[13]=(s*O-u*w+l*C)*z,r[14]=(y*S-v*M-b*_)*z,r[15]=(g*M-A*S+m*_)*z,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,p=2/(l+c),f=2/(s+u);o.left[0]=p,o.left[1]=0,o.left[2]=0,o.left[3]=0,o.left[4]=0,o.left[5]=f,o.left[6]=0,o.left[7]=0,o.left[8]=-((l-c)*p*.5),o.left[9]=(s-u)*f*.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,p=2/(l+c),f=2/(s+u);o.right[0]=p,o.right[1]=0,o.right[2]=0,o.right[3]=0,o.right[4]=0,o.right[5]=f,o.right[6]=0,o.right[7]=0,o.right[8]=-((l-c)*p*.5),o.right[9]=(s-u)*f*.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,p=RAD_TO_DEG*Math.atan(r.distort(s/o)),f=RAD_TO_DEG*Math.atan(r.distort(u/o)),d=RAD_TO_DEG*Math.atan(r.distort(l/o)),h=RAD_TO_DEG*Math.atan(r.distort(c/o)),g=new FieldOfView,A=new FieldOfView;return g.leftDegrees=Math.min(p,t.fov),g.rightDegrees=Math.min(f,t.fov),g.downDegrees=Math.min(d,t.fov),g.upDegrees=Math.min(h,t.fov),A.leftDegrees=g.rightDegrees,A.rightDegrees=g.leftDegrees,A.upDegrees=g.upDegrees,A.downDegrees=g.downDegrees,{left:g,right:A}},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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Uil512j97HfnM7/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=`
|
|
1572
1572
|
<style>
|
|
1573
1573
|
.$id {
|
|
1574
1574
|
all: initial;
|
|
@@ -1929,7 +1929,7 @@ void main() {
|
|
|
1929
1929
|
|
|
1930
1930
|
gl_FragColor = vec4(gl_FragColor.rgb, gl_FragColor.a * opacity * outside * inside);
|
|
1931
1931
|
}
|
|
1932
|
-
`,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:vertexShader$2,fragmentShader:fragmentShader$2,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,p=s.circleOpacity,f=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=p,this.panoMesh.material.uniforms.circleScale.value=f,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,defaultVRPanoramaControllerCustomInitArgs=__assign({},omit(defaultPanoramaControllerCustomInitArgs,["maxLatitude","minLatitude"])),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.updateHelperElementSize(),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.updateConfiguration=function(e){return n.prototype.updateConfiguration.call(this,__assign(__assign({},e),{maxLatitude:Math.PI/2,minLatitude:-Math.PI/2}))},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},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 p=c[l],f=p.panoId,d=new PanoSphereMesh;d.name="panoSphere_".concat(f),d.position.copy(p.position),d.needsRender=!0,this.panoMeshes[f]=d}this.updatePanoMeshesVisible()},t.prototype.updateTime=function(e,r){var o,s,u,l,c,p;if(!this.destroyed){this.updateHelperElementSize();var f=this.currentPano;this.userAction=!0,this.needsRender=!0,this.modelSceneNeedsRender=!0;var d={},h={},g=this.locationMotion.keyframes[0],A=this.locationMotion.keyframes[this.locationMotion.keyframes.length-1],m=this.locationMotion.getKeyFrameSegment(e),E=m[0],v=m[1];this.panoResourceFromLocationMotionKeyframe(E);var y=this.panoResourceFromLocationMotionKeyframe(v),b=this.panoResourceFromLocationMotionKeyframe(g),T=this.panoResourceFromLocationMotionKeyframe(A),_=!1;if(this.modelAlphaMotion.ended===!1&&(this.modelAlphaMotion.update(e),d.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 S=this.locationMotion.getKeyFrameSegment(e),R=S[0],M=S[1],H=this.panoResourceFromLocationMotionKeyframe(R),B=this.panoResourceFromLocationMotionKeyframe(M),C=H.position,w=B.position,I=this.locationMotion.value.count-M.value.count+1;if(d.progress=I,B.panoPicture&&(I<1?H.panoPicture&&(d.pano0=H.panoPicture):d.pano0=B.panoPicture,d.pano1=B.panoPicture),B.effect==="montage"?d.transition="BLACK":B.effect==="spread"?d.transition="SPREAD":d.transition="FADE",(B.effect==="zoomin"||B.effect==="zoomout")&&(d.progress=Math.pow(I,3)),I<1&&B.effect!=="fly"){if(d.pano0&&H.panoPicture){var O={panoId:d.pano0.panoId,map:d.pano0.map,mapSize:d.pano0.mapSize,zoom:d.pano0.zoom,matrix:H.panoPicture.matrix.clone().setPosition(B.position)},L=this.panoPictureObserverMap.get(d.pano0);L&&this.panoPictureObserverMap.set(O,L),d.pano0=O}C.copy(w),_=!0}h.distance=this.locationMotion.value.distance,h.offset=new THREE__namespace.Vector3(C.x+(w.x-C.x)*I,C.y+(w.y-C.y)*I,C.z+(w.z-C.z)*I);for(var N=[],z=[],J=0,K=this.locationMotion.keyframes;J<K.length;J++){var Q=K[J],U=Q.key,q=Q.progress;U!==void 0&&(N.push(U),q>this.locationMotion.progress&&z.push(U))}for(var X=0,Z=Object.keys(this.panoResources);X<Z.length;X++){var W=Z[X];if(!(z.indexOf(W)>=0)){var G=this.panoResources[W];if(G.panoPicture){var ne=G.panoPicture.map;if(ne){if(ne===((o=d.pano0)===null||o===void 0?void 0:o.map)||ne===((s=d.pano1)===null||s===void 0?void 0:s.map))continue;ne.dispose(),G.panoPicture=null}}N.indexOf(W)>=0||delete this.panoResources[W]}}this.currentPano=panoParse(B.panoId),this.emit("pano.moving",createEvent("pano.moving",{userAction:this.userAction,prevPano:panoParse(b.panoId),state:__assign(__assign(__assign(__assign({},panoParse(T.panoId)),{mode:this.mode}),clonePose(this.camera.pose)),h),options:{},progress:this.locationMotion.progress,error:null}))}isEmptyObject(d)===!1&&this.modelScene.parameter.set(d),h.offset&&this.camera.position.copy(h.offset),panoEqual(this.currentPano,f)&&this.updatePanoMeshesVisible();var $=this.camera.pose.longitude,ee=this.camera.pose.latitude;this.camera.quaternion.fromArray(this.cardboard.sensor.getOrientation()),this.camera.computePose();var re=this.works.getResolvedObserver(this.currentPano);if(this.camera.pose.distance>.1||_)for(var le=0,ae=Object.keys(this.panoMeshes);le<ae.length;le++){var oe=ae[le],se=this.panoMeshes[oe];se.setOpacity(0),se.updateTime&&se.updateTime(e,r),se.visible=!1}else if(re)for(var pe=re.visibleIds.concat(panoStringify(this.currentPano)),de=0,xe=pe;de<xe.length;de++){var oe=xe[de],ce=panoParse(oe),L=this.works.getResolvedObserver(ce);if(L){var se=this.panoMeshes[oe];if(!L.loadable&&!L.active){se.setOpacity(0);continue}var Re=se.position.clone().setY(this.camera.position.y).distanceTo(this.camera.position);Re<.05?se.setOpacity(0):se.setOpacity(clamp$1(1.5/Re,0,1)),panoEqual(this.currentPano,ce)&&se.setOpacity(0),se.lookAt(this.camera.position)}}if(this.locationMotion.ended)for(var j=this.intersect(e),te=0,V=this.works.resolvedObservers;te<V.length;te++){var L=V[te],se=this.panoMeshes[L.panoId];se&&(se.setCurrent(se===j),se.updateTime&&se.updateTime(e,r))}($!==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 I=(u=this.modelScene.parameter.progress)!==null&&u!==void 0?u:1,be=Math.round(I),fe=this.modelScene.parameter.pano0,ve=this.modelScene.parameter.pano1,ce=be===0?fe:ve,L=void 0;if(ce&&(L=this.works.getResolvedObserver(ce.panoId),L||(L=this.panoPictureObserverMap.get(ce))),this.tiling.appearDuration=this.tileAppearDuration,this.tiling.maxRequest=I<=.5?0:I<1?1:this.tileMaxRequest,this.tiling.imageOptions=this.imageOptions,!L||!ce||this.tileLevelForFov===!1)this.tiling.setObserver(null),this.tiling.update(this.renderer,this.camera,null,new THREE__namespace.Matrix4,1,0,0),this.modelScene.parameter.set("refinedScreen",null);else{var Ve=getImageSizeLevel(ce.mapSize),rt=Ve+1,We=new THREE__namespace.Vector2().copy(this.camera.resolution).multiplyScalar(this.camera.pixelRatio),me=Math.floor(this.tileLevelForFov(this.camera.fov,We)),ie=me>Ve?me:0;this.tiling.setObserver(L);var he=this.tiling.update(this.renderer,this.camera,ce.map,ce.matrix,ce.zoom,rt,ie),Ce={map:this.tiling.renderTarget.texture,matrixInverse:this.tiling.camera.matrixWorldInverse,projectionMatrix:this.tiling.camera.projectionMatrix,pano:be,opacity:(fe==null?void 0:fe.panoId)===(ve==null?void 0:ve.panoId)?1:easeInQuart(Math.abs(((l=this.modelScene.parameter.progress)!==null&&l!==void 0?l:0)-.5)*2)},_e=this.modelScene.parameter.refinedScreen;(he||Ce.pano!==(_e==null?void 0:_e.pano)||Ce.opacity!==(_e==null?void 0:_e.opacity))&&this.modelScene.parameter.set("refinedScreen",Ce)}}this.panoVideo.object.position.copy(this.camera.position),this.panoVideo.updateTime(e);{var Ie=y.effect,Fe=this.modelScene.parameter,fe=Fe.pano0,ve=Fe.pano1;if(fe&&ve&&fe!==ve&&Ie==="fly"&&this.flyEffectUseDepthBuffer){if(((c=this.modelScene.parameter.pano0Depth)===null||c===void 0?void 0:c.panoId)!==fe.panoId||((p=this.modelScene.parameter.pano1Depth)===null||p===void 0?void 0:p.panoId)!==ve.panoId){var Ae=500,Te=512;this.pano0DepthCubeRenderTarget?this.pano0DepthCubeRenderTarget.width!==Te&&this.pano0DepthCubeRenderTarget.setSize(Te,Te):this.pano0DepthCubeRenderTarget=new THREE__namespace.WebGLCubeRenderTarget(Te,{minFilter:THREE__namespace.NearestFilter,magFilter:THREE__namespace.NearestFilter,generateMipmaps:!1}),this.pano1DepthCubeRenderTarget?this.pano1DepthCubeRenderTarget.width!==Te&&this.pano1DepthCubeRenderTarget.setSize(Te,Te):this.pano1DepthCubeRenderTarget=new THREE__namespace.WebGLCubeRenderTarget(Te,{minFilter:THREE__namespace.NearestFilter,magFilter:THREE__namespace.NearestFilter,generateMipmaps:!1});var we=new THREE__namespace.CubeCamera(this.camera.near,this.camera.far,this.pano0DepthCubeRenderTarget);we.matrix.copy(fe.matrix),we.matrixWorld.copy(we.matrix),we.matrixAutoUpdate=!1,renderDepthCube(this.renderer,this.modelScene,we,Ae);var Pe=new THREE__namespace.CubeCamera(this.camera.near,this.camera.far,this.pano1DepthCubeRenderTarget);Pe.matrix.copy(ve.matrix),Pe.matrixWorld.copy(Pe.matrix),Pe.matrixAutoUpdate=!1,renderDepthCube(this.renderer,this.modelScene,Pe,Ae),this.modelScene.parameter.set({pano0Depth:{panoId:fe.panoId,map:this.pano0DepthCubeRenderTarget.texture,mapSize:this.pano0DepthCubeRenderTarget.width,maxDepth:Ae},pano1Depth:{panoId:ve.panoId,map:this.pano1DepthCubeRenderTarget.texture,mapSize:this.pano1DepthCubeRenderTarget.width,maxDepth:Ae}})}}else this.modelScene.parameter.set({pano0Depth:null,pano1Depth:null}),this.flyEffectUseDepthBuffer||(this.pano0DepthCubeRenderTarget&&(this.pano0DepthCubeRenderTarget.dispose(),this.pano0DepthCubeRenderTarget=void 0),this.pano1DepthCubeRenderTarget&&(this.pano1DepthCubeRenderTarget.dispose(),this.pano1DepthCubeRenderTarget=void 0))}}},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.updateHelperElementSize=function(){if(this.helperElement){var e=new THREE__namespace.Vector2(this.element.offsetWidth,this.element.offsetHeight),r=e.x*this.viewport.left,o=e.y*(1-this.viewport.bottom-this.viewport.height),s=e.x*this.viewport.width,u=e.y*this.viewport.height;this.helperElement.style.marginLeft!==r+"px"&&(this.helperElement.style.marginLeft=r+"px"),this.helperElement.style.marginTop!==o+"px"&&(this.helperElement.style.marginTop=o+"px"),this.helperElement.style.width!==s+"px"&&(this.helperElement.style.width=s+"px"),this.helperElement.style.height!==u+"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,p=u;c<p.length;c++){var f=p[c];if(this.panoMeshes[f]===s){l=f;break}}return l!==null&&this.moveToPano(panoParse(l),{},!0),delete this.activePanoMesh,delete this.activeTime,s}var d=this.camera.getDirection(new THREE__namespace.Vector3),h=new THREE__namespace.Raycaster(this.camera.position,d);h.params.Points={threshold:.1};for(var g=void 0,A=[],m=this.works.getResolvedObserver(this.currentPano),E=m?m.visibleIds:[],v=0,y=E;v<y.length;v++){var l=y[v],b=this.panoMeshes[l],T=h.intersectObject((r=b.hitTestMesh)!==null&&r!==void 0?r:b,!0)[0];T&&A.push({panoMesh:b,intersection:__assign({floor:(o=m==null?void 0:m.floorIndex)!==null&&o!==void 0?o:0},T)})}var _=A.sort(function(B,C){return B.intersection.distance-C.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.modelScene.intersectRaycaster(h)[0]);var S=createEvent("intersect.update",{raycaster:h,intersection:g!=null?g:null,object:this.intersectMesh});if(this.emit("intersect.update",S),S.defaultPrevented){this.hideIntersectMesh();return}if(g&&g.face){var R=g.face.normal,M=new THREE__namespace.Quaternion;M.setFromUnitVectors(new THREE__namespace.Vector3(0,0,1),R),this.intersectMesh.quaternion.copy(M);var H=g.point.clone();this.intersectMesh.position.copy(H),_?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),defaultModelControllerCustomInitArgs=__assign({},defaultPanoramaLikeControllerCustomInitArgs),ModelController=function(n){__extends(t,n);function t(e){var r=this,o=t.parseArgs(e);return r=n.call(this,o)||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:r.modelScene.parameter.resolveValue().modelAlpha}),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,p=this.parseArgs(e),f=p.works,d=e.initial,h=d.state,g=d.currentState,A=typeof h.panoIndex=="number"?{workCode:(s=(r=h.workCode)!==null&&r!==void 0?r:(o=p.works[0])===null||o===void 0?void 0:o.workCode)!==null&&s!==void 0?s:"",panoIndex:h.panoIndex}:{workCode:g.workCode,panoIndex:g.panoIndex},m=f.getResolvedObserver(A),E=clamp$1((u=h.fov)!==null&&u!==void 0?u:!m||isFristPersonMode(g.mode)?g.fov:p.defaultFov,p.minFov,p.maxFov),v=(l=h.longitude)!==null&&l!==void 0?l:g.longitude,y=clamp$1(typeof p.minLatitude=="function"?p.minLatitude(E):p.minLatitude,-Math.PI/2,Math.PI/2),b=clamp$1(typeof p.maxLatitude=="function"?p.maxLatitude(E):p.maxLatitude,-Math.PI/2,Math.PI/2),T=clamp$1((c=h.latitude)!==null&&c!==void 0?c:!m||isFristPersonMode(g.mode)?g.latitude:p.defaultLatitude,y,b),_=new THREE__namespace.Vector3;if(p.initial.state.offset)_.copy(p.initial.state.offset);else if(m)_.copy(m.position);else{var S=coordinatesToVector(g).setLength(g.distance);_.copy(p.initial.currentState.offset).sub(S)}return{workCode:A.workCode,panoIndex:A.panoIndex,mode:"Model",longitude:v,latitude:T,fov:E,offset:_,distance:0}},t.prototype.updateConfiguration=function(e){return n.prototype.updateConfiguration.call(this,e)},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,p=e;c<p.length;c++){var f=p[c];u.push({key:f.key,progress:f.progress,value:{distance:0,x:f.value.offset.x,y:f.value.offset.x,z:f.value.offset.x}}),l.push({key:f.key,progress:f.progress,value:{longitude:f.value.longitude,latitude:f.value.latitude,fov:f.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(p){return p.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.modelScene.parameter.set(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},p={perspToOrtho:0},f={longitude:l.longitude,latitude:l.latitude,fov:l.fov,duration:s,moveStartCallback:function(d){e.perspToOrthoMotion.set(p,s).catch(noop$1),e.modelAlphaMotion.set(c,s).catch(noop$1),e.emit("initAnimation.start",createEvent("initAnimation.start",{state:d,userAction:e.userAction}))},moveEndCallback:function(d){e.emit("initAnimation.end",createEvent("initAnimation.end",{state:d,userAction:e.userAction})),r()},moveCancelCallback:function(){var d=e.currentPano,h=__assign(__assign({},d),{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:h,userAction:e.userAction})),r()}};e.moveToPosition(l.offset,f,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 p=now(),f=new THREE__namespace.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z),d=f.distanceTo(e),h=this.locationMotion.getProgressVelocity(p),g=0,A=1;A<this.locationMotion.keyframes.length;A++){var m=this.locationMotion.keyframes[A-1].value,E=m.x,v=m.y,y=m.z,b=this.locationMotion.keyframes[A].value,T=b.x,_=b.y,S=b.z;g+=Math.sqrt(Math.pow(T-E,2)+Math.pow(_-v,2)+Math.pow(S-y,2))}var R=d===0?0:h*g/d,M=this.calculateMovingDuration(r.duration,d),H={x:e.x,y:e.y,z:e.z,distance:0},B={longitude:r.longitude,latitude:r.latitude,fov:r.fov},C=this.works.resolvedObservers,w=arrayMin(C,function(N){return N.position.distanceTo(f)}),I=w?{workCode:w.work.workCode,panoIndex:w.panoIndex}:{workCode:"",panoIndex:0},O=__assign(__assign({},I),{mode:this.mode,longitude:(u=B.longitude)!==null&&u!==void 0?u:this.camera.pose.longitude,latitude:(l=B.latitude)!==null&&l!==void 0?l:this.camera.pose.latitude,fov:(c=B.fov)!==null&&c!==void 0?c:this.camera.pose.fov,offset:e.clone(),distance:0}),L=this.currentPano;this.emit("pano.moveTo",createEvent("pano.moveTo",{options:r,prevPano:L,progress:0,state:O,userAction:this.userAction,error:null})),r.moveStartCallback&&r.moveStartCallback(O),this.cameraMotion.set(B,M).catch(noop$1),this.locationMotion.set(H,M,R).then(function(){for(var N=0,z=s.modelScene.children;N<z.length;N++){var J=z[N];J instanceof Model&&J.show()}var K=__assign(__assign(__assign({},I),{mode:s.mode}),clonePose(s.camera.pose));s.emit("pano.arrived",createEvent("pano.arrived",{options:r,prevPano:L,progress:0,state:K,userAction:s.userAction,error:null})),r.moveEndCallback&&r.moveEndCallback(K)},function(){r.moveCancelCallback&&r.moveCancelCallback(),s.emit("pano.cancel",createEvent("pano.cancel",{options:r,prevPano:L,progress:0,state:O,userAction:s.userAction,error:null}))})},t.prototype.onTapGesture=function(e){var r=e.center.raycaster;this.stopMomentumMovement();var o=this.modelScene.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.modelScene.intersectRaycaster(r)[0]}}if(o){var c=new THREE__namespace.Vector3().copy(o.point).add(HUMAN_EYE_POSITION),p=this.works.resolvedObservers,f=arrayMin(p,function(g){return g.position.distanceTo(c)},!0),d=f[0],h=f[1];d&&h<5&&(c.y=d.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),minDistance=.5,PANGESTURE_FORWARD_ANGLE=Math.PI/7,defaultMapviewControllerCustomInitArgs={defaultLongitude:Math.PI/4,defaultLatitude:Math.PI/4,defaultDistance:150,maxLatitude:+Math.PI/2,minLatitude:0,cameraType:"auto",cameraFence:null,intersectMeshCreator:function(){return new IntersectMesh}},MapviewController=function(n){__extends(t,n);function t(e){var r=this,o=t.parseArgs(e);return r=n.call(this,o)||this,r.mode="Mapview",r.defaultLongitude=o.defaultLongitude,r.defaultLatitude=o.defaultLatitude,r.defaultDistance=o.defaultDistance,r.maxLatitude=o.maxLatitude,r.minLatitude=o.minLatitude,r.cameraType=o.cameraType,r.cameraFence=o.cameraFence,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:r.modelScene.parameter.resolveValue().modelAlpha}),r.perspToOrthoMotion=new Motion({perspToOrtho:r.camera.perspToOrtho.x}),r.intersectMeshCreator=o.intersectMeshCreator,r.intersectMesh=r.intersectMeshCreator(),r.intersectMesh.name="intersect",r.intersectMesh.visible=!1,r.currentTapId=null,r.helper.add(r.intersectMesh),r.edlTarget=new THREE__namespace.WebGLRenderTarget(1024,1024,{generateMipmaps:!1,minFilter:THREE__namespace.NearestFilter,magFilter:THREE__namespace.NearestFilter,format:THREE__namespace.RGBAFormat,type:THREE__namespace.FloatType,depthTexture:new THREE__namespace.DepthTexture(1024,1024,THREE__namespace.UnsignedIntType)}),r}return t.parseArgs=function(e){var r,o,s,u,l,c,p,f;if(e instanceof t)return e;var d=n.parseArgs.call(this,e);return __assign(__assign({},d),{defaultLongitude:(r=e.defaultLongitude)!==null&&r!==void 0?r:defaultMapviewControllerCustomInitArgs.defaultLongitude,defaultLatitude:(o=e.defaultLatitude)!==null&&o!==void 0?o:defaultMapviewControllerCustomInitArgs.defaultLatitude,defaultDistance:(s=e.defaultDistance)!==null&&s!==void 0?s:defaultMapviewControllerCustomInitArgs.defaultDistance,maxLatitude:(u=e.maxLatitude)!==null&&u!==void 0?u:defaultMapviewControllerCustomInitArgs.maxLatitude,minLatitude:(l=e.minLatitude)!==null&&l!==void 0?l:defaultMapviewControllerCustomInitArgs.minLatitude,cameraType:(c=e.cameraType)!==null&&c!==void 0?c:defaultMapviewControllerCustomInitArgs.cameraType,cameraFence:(p=e.cameraFence)!==null&&p!==void 0?p:defaultMapviewControllerCustomInitArgs.cameraFence,intersectMeshCreator:(f=e.intersectMeshCreator)!==null&&f!==void 0?f:defaultMapviewControllerCustomInitArgs.intersectMeshCreator})},t.distanceFromModel=function(e,r,o){var s=e.boundingBox,u=s.isEmpty()?10: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);u=isNaN(u)||!isFinite(u)?1:u;var l=u/2/Math.tan(Math.PI*r/360);return o<1&&(l=l/o),isNaN(l)||!isFinite(l)?u:l},t.initAnimationEndState=function(e){var r,o,s,u,l,c,p,f=this.parseArgs(e),d=f.works,h=f.modelScene,g=e.initial,A=g.state,m=g.currentState,E=typeof A.panoIndex=="number"?{workCode:(s=(r=A.workCode)!==null&&r!==void 0?r:(o=f.works[0])===null||o===void 0?void 0:o.workCode)!==null&&s!==void 0?s:"",panoIndex:A.panoIndex}:{workCode:m.workCode,panoIndex:m.panoIndex},v=d.getResolvedObserver(E),y=(u=A.fov)!==null&&u!==void 0?u:60,b=clamp$1(typeof f.minLatitude=="function"?f.minLatitude(y):f.minLatitude,-Math.PI/2,Math.PI/2),T=clamp$1(typeof f.maxLatitude=="function"?f.maxLatitude(y):f.maxLatitude,-Math.PI/2,Math.PI/2),_=clamp$1((l=A.latitude)!==null&&l!==void 0?l:isThirdPersonMode(m.mode)?m.latitude:f.defaultLatitude,b,T),S=t.distanceFromModel(f.modelScene,y,f.camera.aspect),R=new THREE__namespace.Vector3,M=(c=A.distance)!==null&&c!==void 0?c:Math.min(f.defaultDistance,S),H=(p=A.longitude)!==null&&p!==void 0?p:isThirdPersonMode(m.mode)?m.longitude:f.defaultLongitude;return A.offset?R.copy(A.offset):f.defaultDistance<S&&v?(R.copy(v.position),A.longitude===void 0&&(H=m.longitude)):(h.boundingBox.getCenter(R),M=S),__assign(__assign({},E),{mode:"Mapview",longitude:H,latitude:_,fov:y,offset:R,distance:M})},t.prototype.updateConfiguration=function(e){var r=n.prototype.updateConfiguration.call(this,e);if(r===!1)return!1;if(e.defaultLongitude!==void 0&&this.defaultLongitude!==e.defaultLongitude&&(this.defaultLongitude=e.defaultLongitude),e.defaultLatitude!==void 0&&this.defaultLatitude!==e.defaultLatitude&&(this.defaultLatitude=e.defaultLatitude),e.defaultDistance!==void 0&&this.defaultDistance!==e.defaultDistance&&(this.defaultDistance=e.defaultDistance),e.maxLatitude!==void 0&&this.maxLatitude!==e.maxLatitude&&(this.maxLatitude=e.maxLatitude),e.minLatitude!==void 0&&this.minLatitude!==e.minLatitude&&(this.minLatitude=e.minLatitude),e.cameraType!==void 0&&this.cameraType!==e.cameraType&&(this.cameraType=e.cameraType),this.cameraFence instanceof THREE__namespace.Box3&&e.cameraFence instanceof THREE__namespace.Box3?this.cameraFence.equals(e.cameraFence)||(this.cameraFence=e.cameraFence):this.cameraFence instanceof THREE__namespace.Sphere&&e.cameraFence instanceof THREE__namespace.Sphere?this.cameraFence.equals(e.cameraFence)||(this.cameraFence=e.cameraFence):e.cameraFence!==void 0&&(this.cameraFence=e.cameraFence),e.intersectMeshCreator!==void 0&&this.intersectMeshCreator!==e.intersectMeshCreator){this.intersectMeshCreator=e.intersectMeshCreator;var o=this.intersectMesh;this.intersectMesh=this.intersectMeshCreator(),this.intersectMesh.name=o.name,this.intersectMesh.visible=o.visible;var s=this.intersectMesh.parent;s&&s.add(this.intersectMesh),o.dispose()}return!0},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){this.userAction=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}}));this.currentPano={workCode:u.workCode,panoIndex:u.panoIndex};var l={longitude:u.longitude,latitude:u.latitude,fov:u.fov},c={x:u.offset.x,y:u.offset.y,z:u.offset.z,distance:u.distance,orthoDistance:u.distance};return this.locationMotion.set(c,o.duration).catch(noop$1),this.cameraMotion.set(l,o.duration).catch(noop$1),!0},t.prototype.updateModel=function(e){n.prototype.updateModel.call(this,e);var r=e.boundingBox.getCenter(new THREE__namespace.Vector3),o=t.distanceFromModel(e,this.cameraMotion.value.fov,this.camera.aspect);this.updateCamera({offset:r,distance:o},0,!0),this.hideIntersectMesh()},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,p=e;c<p.length;c++){var f=p[c];u.push({key:f.key,progress:f.progress,value:{distance:f.value.distance,x:f.value.offset.x,y:f.value.offset.x,z:f.value.offset.x}}),l.push({key:f.key,progress:f.progress,value:{longitude:f.value.longitude,latitude:f.value.latitude,fov:f.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.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),this.modelAlphaMotion.ended||(this.modelAlphaMotion.update(e),o.modelAlpha=this.modelAlphaMotion.value.modelAlpha);var u=0;if(this.cameraType==="auto"?u=Math.abs(Math.PI/2-this.cameraMotion.value.latitude)<.02||Math.abs(-Math.PI/2-this.cameraMotion.value.latitude)<.02?1:0:this.cameraType==="perspective"?u=0:this.cameraType==="orthographic"&&(u=1),this.perspToOrthoMotion.getTargetKeyframe().value.perspToOrtho!==u&&this.perspToOrthoMotion.set({perspToOrtho:u},500).catch(noop$1),this.perspToOrthoMotion.ended||(this.perspToOrthoMotion.update(e),this.camera.perspToOrtho.setScalar(clamp$1(this.perspToOrthoMotion.value.perspToOrtho,0,1))),isEmptyObject(o)||this.modelScene.parameter.set(o),isEmptyObject(s)||this.setCamera(s),this.cameraFence&&!this.panState&&!this.pinchState&&!this.mouseWheelState&&!this.inMomentumMovement&&this.locationMotion.ended&&this.perspToOrthoMotion.ended&&this.cameraMotion.ended){var l=coordinatesToVector(this.camera.pose,new THREE__namespace.Vector3),c=new THREE__namespace.Vector3().copy(this.camera.pose.offset).sub(l.clone().multiplyScalar(this.camera.pose.distance));if(this.cameraFence.distanceToPoint(c)>.01){var p=this.cameraFence.clampPoint(c,new THREE__namespace.Vector3),f=this.camera.pose.offset.clone().add(p).sub(c),d=__assign(__assign({},this.currentPano),{mode:this.mode,longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude,fov:this.camera.pose.fov,offset:f,distance:this.camera.pose.distance});this.fixFinalState(d),this.locationMotion.set({x:d.offset.x,y:d.offset.y,z:d.offset.z,distance:d.distance},300).catch(noop$1)}}if(this.intersectMesh&&this.intersectMesh.parent){var h=this.camera.position.distanceTo(this.intersectMesh.position),g=2*Math.tan(.5*this.camera.fov/180*Math.PI),A=h*g/5;this.intersectMesh.scale.setScalar(A)}}},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,distance:r.value.distance,offset:new THREE__namespace.Vector3(r.value.x,r.value.y,r.value.z)})},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},p={x:l.offset.x,y:l.offset.y,z:l.offset.z,distance:l.distance},f={modelAlpha:1},d={perspToOrtho:0};e.emit("initAnimation.start",createEvent("initAnimation.start",{state:l,userAction:e.userAction})),e.perspToOrthoMotion.set(d,s).catch(noop$1),e.modelAlphaMotion.set(f,s/3).catch(noop$1),e.cameraMotion.set(c,s).catch(noop$1),e.locationMotion.set(p,s).then(function(){e.emit("initAnimation.end",createEvent("initAnimation.end",{state:l,userAction:e.userAction}))},function(h){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.getForwardObserverOrNot=function(e){var r=this,o=this.modelScene.intersectRaycaster(e)[0];if(!o)return null;var s=this.works.resolvedObservers.filter(function(p){for(var f,d=0,h=r.modelScene.children;d<h.length;d++){var g=h[d];if(g instanceof Model&&g.visible&&((f=g.work)===null||f===void 0?void 0:f.workCode)===p.work.workCode)return!0}return!1}),u=arrayMin(s,function(p){return p.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.viewport.width),latitude:2*e.y/(r.y*this.viewport.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,x:0,y:0,z:0},p=0;p<s;p++)l.longitude*=.996,l.latitude*=.996*.998,l.x*=.99,l.y*=.99,l.z*=.99,c.longitude+=l.longitude,c.latitude+=l.latitude,c.x+=l.x,c.y+=l.y,c.z+=l.z;var f=this.cameraMotion.value.fov,d=formatRad(this.cameraMotion.value.longitude+c.longitude),h=clamp$1(typeof this.minLatitude=="function"?this.minLatitude(f):this.minLatitude,-Math.PI/2,Math.PI/2),g=clamp$1(typeof this.maxLatitude=="function"?this.maxLatitude(f):this.maxLatitude,-Math.PI/2,Math.PI/2),A=clamp$1(this.cameraMotion.value.latitude+c.latitude,h,g),m=new THREE__namespace.Vector3(this.locationMotion.value.x+c.x,this.locationMotion.value.y+c.y,this.locationMotion.value.z+c.z),E=__assign(__assign({},this.currentPano),{mode:this.mode,longitude:d,latitude:A,offset:m,fov:f,distance:this.locationMotion.value.distance}),v=e.state.offset.clone().sub(coordinatesToVector(e.state).setLength(E.distance)),y=!(Math.abs(l.longitude)>1e-4||Math.abs(l.latitude)>1e-4||Math.abs(l.x)>1e-4||Math.abs(l.y)>1e-4||Math.abs(l.z)>1e-4),b=this.cameraFence?this.cameraFence.containsPoint(v):!0;b===!1&&(y=!0);var T=createEvent("gesture.momentum",__assign(__assign({},e),{isFirst:r,isFinal:y,state:E}));if(this.inMomentumMovement.event=T,this.emit("gesture.momentum",T),e.defaultPrevented){this.inMomentumMovement=null;return}this.inMomentumMovement&&(this.cameraMotion.set({longitude:d,latitude:A},0).catch(noop$1),this.locationMotion.set({x:E.offset.x,y:E.offset.y,z:E.offset.z,distance:E.distance},0).catch(noop$1),y?this.inMomentumMovement=null:AnimationFrameLoop.shared.add(function(_,S){u.requestMomentumMovement(e,!1,l,S|0)},!0,1))}},t.prototype.fixFinalState=function(e){if(this.perspToOrthoMotion.getTargetKeyframe().value.perspToOrtho!==1){var r=coordinatesToVector(e,new THREE__namespace.Vector3),o=new THREE__namespace.Vector3().copy(e.offset).sub(r.clone().multiplyScalar(e.distance)),s=new THREE__namespace.Raycaster(o,r);s.params.Points={threshold:.1},s.near=this.camera.near,s.far=this.camera.far;var u;if(u=this.modelScene.intersectRaycaster(s).filter(function(d){var h,g=(h=d.face)===null||h===void 0?void 0:h.normal;return g&&s.ray.direction.dot(g)>=0?!1:d.distance>minDistance+s.near})[0],!u){var l=new THREE__namespace.Plane(new THREE__namespace.Vector3(0,1,0),-this.modelScene.boundingBox.min.y),c=s.ray.intersectPlane(l,new THREE__namespace.Vector3);if(c){var p=c.distanceTo(s.ray.origin);p<1e3&&p>=s.near&&(u={distance:p,floor:0,point:c,object:this.scene,face:null})}}if(!u){var f=Math.max(e.distance,3);u={distance:f,floor:0,point:s.ray.direction.clone().setLength(f).add(s.ray.origin),object:this.scene,face:null}}u&&(e.distance=clamp$1(u.distance,0,1/0),e.offset.copy(o).add(r.clone().multiplyScalar(e.distance)))}},t.prototype.onPanGesture=function(e){this.userAction=e.userAction,this.stopMomentumMovement(),this.hideIntersectMesh();var r=e.pointers.length,o=this.panState,s=0,u=!1;e.pointerType==="mouse"&&(s=e.srcEvent.buttons,u=e.srcEvent.shiftKey),o&&s===0&&o.buttons!==0&&(s=o.buttons);var l=o==null?void 0:o.target;if(!l){var c=this.relativeClientPosition(e.center),p=new THREE__namespace.Raycaster;p.params.Points={threshold:.1},p.setFromCamera(c,this.camera),p.near=this.camera.near,l=new THREE__namespace.Vector3().copy(p.ray.direction).multiplyScalar(3).add(p.ray.origin);var f=this.modelScene.intersectRaycaster(p)[0];if(!f&&p.ray.direction.y<-.3){var d=new THREE__namespace.Plane(new THREE__namespace.Vector3(0,1,0),0),h=p.ray.intersectPlane(d,new THREE__namespace.Vector3);if(h){var g=h.distanceTo(p.ray.origin);g<1e4&&g>=p.near&&(f={distance:g,floor:0,point:h,object:this.scene})}}if(f)l.copy(f.point);else{var A=new THREE__namespace.Vector3().copy(this.camera.pose.offset).sub(this.camera.position).normalize(),d=new THREE__namespace.Plane().setFromNormalAndCoplanarPoint(A,this.camera.pose.offset);p.ray.intersectPlane(d,l)}}if(e.isFinal?delete this.panState:this.panState={target:l,buttons:s,pointerLength:r,x:e.center.x,y:e.center.y},!(typeof o=="undefined"||o.pointerLength!==r)){var m=r>1||s===2||u;if(m){var E={x:e.center.x-o.x,y:e.center.y-o.y},v=new THREE__namespace.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z),y=coordinatesToVector(this.cameraMotion.value).setLength(this.locationMotion.value.distance).add(v),b=new THREE__namespace.Vector3().copy(y).sub(o.target).length();b*=Math.tan(this.camera.pose.fov/2*Math.PI/180);var T=this.renderer.getSize(new THREE__namespace.Vector2),_=2*E.x*b/T.y,S=2*E.y*b/T.y,R=new THREE__namespace.Vector3;R.setFromMatrixColumn(this.camera.matrix,0),R.multiplyScalar(-_),v.add(R),this.camera.pose.latitude<PANGESTURE_FORWARD_ANGLE?R.setFromMatrixColumn(this.camera.matrix,1):(R.setFromMatrixColumn(this.camera.matrix,0),R.crossVectors(this.camera.up,R)),R.multiplyScalar(S),v.add(R);var M=__assign(__assign({},this.currentPano),{mode:this.mode,longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude,fov:this.camera.pose.fov,offset:v,distance:this.camera.pose.distance});if(e.state=M,this.emit("gesture.pan",e),e.defaultPrevented)return;if(this.locationMotion.set({x:M.offset.x,y:M.offset.y,z:M.offset.z},0).catch(noop$1),e.isFinal&&(this.fixFinalState(M),Object.assign(e,{__fixFinalState:!0}),this.locationMotion.set({distance:M.distance,x:M.offset.x,y:M.offset.y,z:M.offset.z},0).catch(noop$1)),e.isFinal){var H=this.renderer.getSize(new THREE__namespace.Vector2),B=2*e.velocityX*b/H.y,C=2*e.velocityY*b/H.y,w=new THREE__namespace.Vector3,I=new THREE__namespace.Vector3;w.setFromMatrixColumn(this.camera.matrix,0),w.multiplyScalar(-B),I.add(w),this.camera.pose.latitude<PANGESTURE_FORWARD_ANGLE?w.setFromMatrixColumn(this.camera.matrix,1):(w.setFromMatrixColumn(this.camera.matrix,0),w.crossVectors(this.camera.up,w)),w.multiplyScalar(C),I.add(w),this.inMomentumMovement={uuid:createUuid()},this.requestMomentumMovement(e,!0,{longitude:0,latitude:0,x:I.x,y:I.y,z:I.z},0)}}else{var E={x:e.center.x-o.x,y:e.center.y-o.y},O=this.coordinatesForOffset(E),L=formatRad(this.cameraMotion.value.longitude+O.longitude),N=this.camera.pose.fov,z=clamp$1(typeof this.minLatitude=="function"?this.minLatitude(N):this.minLatitude,-Math.PI/2,Math.PI/2),J=clamp$1(typeof this.maxLatitude=="function"?this.maxLatitude(N):this.maxLatitude,-Math.PI/2,Math.PI/2),K=clamp$1(this.cameraMotion.value.latitude+O.latitude,z,J);this.camera.aspect<1&&Math.abs(e.overallVelocityX)>.2&&Math.atan2(Math.abs(e.overallVelocityY),Math.abs(e.overallVelocityX))<Math.PI/6.923&&(K=this.cameraMotion.value.latitude);var M=__assign(__assign({},this.currentPano),{mode:this.mode,longitude:L,latitude:K,fov:N,offset:this.camera.pose.offset,distance:this.camera.pose.distance});if(e.isFinal&&Object.assign(e,{__fixFinalState:!0}),e.state=M,this.emit("gesture.pan",e),e.defaultPrevented)return;if(e.isFinal?this.locationMotion.set({distance:M.distance,x:M.offset.x,y:M.offset.y,z:M.offset.z},0).catch(noop$1):this.cameraMotion.set({longitude:M.longitude,latitude:M.latitude},0).catch(noop$1),e.isFinal){var Q=e.velocityX,U=e.velocityY;this.inMomentumMovement={uuid:createUuid()},this.requestMomentumMovement(e,!0,__assign(__assign({},this.coordinatesForOffset({x:Q,y:U})),{x:0,y:0,z:0}),0)}}}},t.prototype.onPinchGesture=function(e){var r;if(this.initAnimationIsReady){this.userAction=e.userAction,this.stopMomentumMovement(),this.hideIntersectMesh();var o=(r=this.pinchState)===null||r===void 0?void 0:r.distance;if(e.isFirst){this.pinchState={x:e.center.x,y:e.center.y,scale:1,distance:this.locationMotion.value.distance};return}if(typeof o!="undefined"){var s=this.modelScene.boundingBox.getCenter(new THREE__namespace.Vector3),u=t.distanceFromModel(this.modelScene,this.cameraMotion.value.fov,this.camera.aspect),l=clamp$1(o/e.scale,minDistance,1/0),c=e.state.offset.clone().sub(coordinatesToVector(e.state).setLength(l)),p=this.modelScene.boundingBox.containsPoint(c),f;if(!p&&this.pinchState&&this.pinchState.scale>e.scale&&s.distanceTo(c)>u?f=e.state.distance:(f=l,this.pinchState&&(this.pinchState.scale=e.scale)),e.state.distance=f,this.emit("gesture.pinch",e),!e.defaultPrevented&&(this.locationMotion.set({distance:e.state.distance},0).catch(noop$1),e.pointerType!=="mouse"&&(e.type="gesture.pan",this.onPanGesture(e)),e.isFinal)){if(!("__fixFinalState"in e)){var d=e.state;this.fixFinalState(e.state);var h={x:d.offset.x,y:d.offset.y,z:d.offset.z,distance:d.distance};this.locationMotion.set(h,0).catch(noop$1)}delete this.panState,delete this.pinchState}}}},t.prototype.onMouseMove=function(e){var r,o;if(this.intersectMesh.parent&&!this.panState&&!this.pinchState&&!this.mouseWheelState&&(this.emit("gesture.mousemove",e),!e.defaultPrevented)){var s=e.center.raycaster;if(s.near=this.camera.near,s.far=this.camera.far,e.isFinal&&this.intersectMesh.parent&&this.intersectMesh.visible===!0){this.hideIntersectMesh();return}var u=this.modelScene.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),p=c.clone(),f=u.point.clone();this.intersectMesh.position.copy(f);var d=f.clone().add(p);if(this.intersectMesh.lookAt(d),Math.abs(c.y)>.99){var h=this.camera.position.clone().sub(f);this.intersectMesh.rotation.z=-Math.atan2(h.z,h.x)}this.intersectMesh.visible=!0,this.needsRender=!0}else this.hideIntersectMesh()}},t.prototype.onMouseWheel=function(e){if(this.initAnimationIsReady)if(this.userAction=e.userAction,this.stopMomentumMovement(),this.hideIntersectMesh(),e.isFinal){var r=e.state;if(this.fixFinalState(r),this.emit("gesture.mousewheel",e),e.defaultPrevented)return;var o={x:r.offset.x,y:r.offset.y,z:r.offset.z,distance:r.distance};this.locationMotion.set(o,0).catch(noop$1)}else{var s=Math.max(this.locationMotion.value.distance-this.camera.near,0),u=e.center.delta/10*Math.max(s/5,.1);if(this.locationMotion.value.distance-u>=minDistance){var l=this.locationMotion.value.distance-u;e.state.distance=l}else{var c=coordinatesToVector(this.cameraMotion.value);c.setLength(u),e.state.offset.add(c)}if(this.emit("gesture.mousewheel",e),e.defaultPrevented)return;this.locationMotion.set({distance:e.state.distance,x:e.state.offset.x,y:e.state.offset.y,z:e.state.offset.z},0).catch(noop$1)}},t.prototype.onTapGesture=function(e){var r=this;this.userAction=e.userAction,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(p){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){if(this.initAnimationIsReady){this.userAction=e.userAction,this.stopMomentumMovement(),this.hideIntersectMesh();var r=e.state,o=e.center.raycaster,s=o.ray.origin.clone().add(o.ray.direction.clone().setLength(3)),u=1,l=3,c=u,p=this.modelScene.intersectRaycaster(o)[0];if(p&&(s=p.point.clone(),p.distance>(u+l)/2?c=u:c=l),e.state.distance=c,e.state.offset=s,this.emit("gesture.dbltap",e),!e.defaultPrevented){var f={x:r.offset.x,y:r.offset.y,z:r.offset.z,distance:r.distance};this.locationMotion.set(f,360).catch(noop$1),this.hideIntersectMesh()}}},t.prototype.hideIntersectMesh=function(){this.intersectMesh.visible=!1,this.needsRender=!0},t}(BaseController);function isNil(n){return n==null}var _moveEvent={type:"move"},XRController=function(){function n(){this._targetRay=null,this._grip=null,this._hand=null,this._axes=[0,0]}return n.prototype.getHandSpace=function(){return this._hand===null&&(this._hand=new THREE__namespace.Group,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand},n.prototype.getTargetRaySpace=function(){return this._targetRay===null&&(this._targetRay=new THREE__namespace.Group,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new THREE__namespace.Vector3,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new THREE__namespace.Vector3),this._targetRay},n.prototype.getGripSpace=function(){return this._grip===null&&(this._grip=new THREE__namespace.Group,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new THREE__namespace.Vector3,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new THREE__namespace.Vector3),this._grip},n.prototype.dispatchEvent=function(t){return this._targetRay!==null&&this._targetRay.dispatchEvent(t),this._grip!==null&&this._grip.dispatchEvent(t),this._hand!==null&&this._hand.dispatchEvent(t),this},n.prototype.disconnect=function(t){return this.dispatchEvent({type:"disconnected",data:t}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this},n.prototype.getAxes=function(){return this._axes},n.prototype.update=function(t,e,r){var o=null,s=null,u=null,l=this._targetRay,c=this._grip,p=this._hand;if(t&&t.gamepad&&t.gamepad.axes&&(this._axes=[t.gamepad.axes[2],t.gamepad.axes[3]]),t&&e.session.visibilityState!=="visible-blurred")if(l!==null&&(o=e.getPose(t.targetRaySpace,r),o!==null&&(l.matrix.fromArray(o.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),o.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(o.linearVelocity)):l.hasLinearVelocity=!1,o.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(o.angularVelocity)):l.hasAngularVelocity=!1,this.dispatchEvent(_moveEvent))),p&&t.hand){u=!0;for(var f=0,d=t.hand.values();f<d.length;f++){var h=d[f],g=e.getJointPose(h,r);if(p.joints[h.jointName]===void 0){var A=new THREE__namespace.Group;A.matrixAutoUpdate=!1,A.visible=!1,p.joints[h.jointName]=A,p.add(A)}var m=p.joints[h.jointName];g!==null&&(m.matrix.fromArray(g.transform.matrix),m.matrix.decompose(m.position,m.rotation,m.scale),m.jointRadius=g.radius),m.visible=g!==null}var E=p.joints["index-finger-tip"],v=p.joints["thumb-tip"],y=E.position.distanceTo(v.position),b=.02,T=.005;p.inputState.pinching&&y>b+T?(p.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!p.inputState.pinching&&y<=b-T&&(p.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else c!==null&&t.gripSpace&&(s=e.getPose(t.gripSpace,r),s!==null&&(c.matrix.fromArray(s.transform.matrix),c.matrix.decompose(c.position,c.rotation,c.scale),s.linearVelocity?(c.hasLinearVelocity=!0,c.linearVelocity.copy(s.linearVelocity)):c.hasLinearVelocity=!1,s.angularVelocity?(c.hasAngularVelocity=!0,c.angularVelocity.copy(s.angularVelocity)):c.hasAngularVelocity=!1));return l!==null&&(l.visible=o!==null),c!==null&&(c.visible=s!==null),p!==null&&(p.visible=u!==null),this},n}(),framebufferScaleFactor=1,XRManager=function(){function n(t,e,r){var o,s,u,l,c;this.isPanorama=(o=r==null?void 0:r.isPanorama)!==null&&o!==void 0?o:!0;var p=navigator.userAgent.toLowerCase(),f;p.includes("pico")?f="Pico":p.includes("oculus")?f="Oculus":f="VP",this.machineType=(s=r==null?void 0:r.machineType)!==null&&s!==void 0?s:f,this.renderer=t,this.gl=e,this.enabled=!1,this.session=null,this.referenceSpaceType=(u=r==null?void 0:r.referenceSpaceType)!==null&&u!==void 0?u:"local-floor",this.referenceSpace=null,this.onSessionStartCallback=(l=r==null?void 0:r.onSessionStart)!==null&&l!==void 0?l:noop$1,this.onSessionEndCallback=(c=r==null?void 0:r.onSessionEnd)!==null&&c!==void 0?c:noop$1,this.controllers=[new XRController,new XRController],this.inputSourcesMap=new Map,this.cameraVR=new THREE__namespace.ArrayCamera,this.cameraL=new THREE__namespace.PerspectiveCamera,this.cameraR=new THREE__namespace.PerspectiveCamera,this.cameraL.viewport=new THREE__namespace.Vector4,this.cameraR.viewport=new THREE__namespace.Vector4,this.cameraL.layers.enable(1),this.cameraR.layers.enable(2),this.cameraVR.layers.enable(1),this.cameraVR.layers.enable(2),this.isPresenting=!1,this.currentDepthNear=null,this.currentDepthFar=null,this.cameraLPos=new THREE__namespace.Vector3,this.cameraRPos=new THREE__namespace.Vector3}return n.prototype.getController=function(t){var e=this.controllers[t];return e||console.warn("no controller find"),e.getTargetRaySpace()},n.prototype.getRightController=function(){if(!this.session)return null;var t=this.session.inputSources[0].handedness==="right"?0:1,e=this.controllers[t];return e||console.warn("no controller find"),e.getTargetRaySpace()},n.prototype.getLeftController=function(){if(!this.session)return null;var t=this.session.inputSources[0].handedness==="left"?0:1,e=this.controllers[t];return e||console.warn("no controller find"),e.getTargetRaySpace()},n.prototype.getControllerGrip=function(t){var e=this.controllers[t];return e||console.warn("no controller find"),e.getGripSpace()},n.prototype.getCameras=function(){return{cameraL:this.cameraL,cameraR:this.cameraR,cameraVR:this.cameraVR}},n.prototype.updateCamera=function(t,e){e===null?t.matrixWorld.copy(t.matrix):t.matrixWorld.multiplyMatrices(e.matrixWorld,t.matrix),t.matrixWorldInverse.getInverse(t.matrixWorld)},n.prototype.setProjectionFromUnion=function(t,e,r){this.cameraLPos.setFromMatrixPosition(e.matrixWorld),this.cameraRPos.setFromMatrixPosition(r.matrixWorld);var o=this.cameraLPos.distanceTo(this.cameraRPos),s=e.projectionMatrix.elements,u=r.projectionMatrix.elements,l=s[14]/(s[10]-1),c=s[14]/(s[10]+1),p=(s[9]+1)/s[5],f=(s[9]-1)/s[5],d=(s[8]-1)/s[0],h=(u[8]+1)/u[0],g=l*d,A=l*h,m=o/(-d+h),E=m*-d;e.matrixWorld.decompose(t.position,t.quaternion,t.scale),t.translateX(E),t.translateZ(m),t.matrixWorld.compose(t.position,t.quaternion,t.scale),t.matrixWorldInverse.getInverse(t.matrixWorld);var v=l+m,y=c+m,b=g-E,T=A+(o-E),_=p*c/y*v,S=f*c/y*v;t.projectionMatrix.makePerspective(b,T,_,S,v,y)},n.prototype.getCamera=function(t){this.cameraVR.near=this.cameraR.near=this.cameraL.near=t.near,this.cameraVR.far=this.cameraR.far=this.cameraL.far=t.far,this.session&&(this.currentDepthNear!==this.cameraVR.near||this.currentDepthFar!==this.cameraVR.far)&&(this.session.updateRenderState({depthNear:this.cameraVR.near,depthFar:this.cameraVR.far}),this.currentDepthNear=this.cameraVR.near,this.currentDepthFar=this.cameraVR.far);var e=t.parent,r=this.cameraVR.cameras;this.updateCamera(this.cameraVR,e);for(var o=0;o<r.length;o++)this.updateCamera(r[o],e);t.matrixWorld.copy(this.cameraVR.matrixWorld);for(var s=t.children,o=0,u=s.length;o<u;o++)s[o].updateMatrixWorld(!0);return r.length===2?this.setProjectionFromUnion(this.cameraVR,this.cameraL,this.cameraR):this.cameraVR.projectionMatrix.copy(this.cameraL.projectionMatrix),this.cameraVR},n.prototype.updateInputSources=function(t){if(!this.session){console.warn("session is lose!");return}for(var e=this.session.inputSources,r=0;r<this.controllers.length;r++)this.inputSourcesMap.set(e[r],this.controllers[r]);for(var r=0;r<t.removed.length;r++){var o=t.removed[r],s=this.inputSourcesMap.get(o);s&&(s.dispatchEvent({type:"disconnected",data:o}),this.inputSourcesMap.delete(o))}for(var r=0;r<t.added.length;r++){var o=t.added[r],s=this.inputSourcesMap.get(o);s&&s.dispatchEvent({type:"connected",data:o})}},n.prototype.onSessionEvent=function(t){var e=this.inputSourcesMap.get(t.inputSource);e&&e.dispatchEvent({type:t.type})},n.prototype.onSessionEnd=function(){this.inputSourcesMap.forEach(function(t,e){t.disconnect(e)}),this.inputSourcesMap.clear(),this.renderer.setFramebuffer(null),this.renderer.setRenderTarget(this.renderer.getRenderTarget()),this.isPresenting=!1,this.session=null,AnimationFrameLoop.shared.setContext(null),this.onSessionEndCallback()},n.prototype.onRequestReferenceSpace=function(t){this.referenceSpace=t,this.isPresenting=!0,this.session&&this.onSessionStartCallback(this.session)},n.prototype.setSession=function(t){var e=this;if(this.session=t,this.session){this.session.addEventListener("select",function(o){e.onSessionEvent(o)}),this.session.addEventListener("selectstart",function(o){e.onSessionEvent(o)}),this.session.addEventListener("selectend",function(o){e.onSessionEvent(o)}),this.session.addEventListener("squeeze",function(o){e.onSessionEvent(o)}),this.session.addEventListener("squeezestart",function(o){e.onSessionEvent(o)}),this.session.addEventListener("squeezeend",function(o){e.onSessionEvent(o)}),this.session.addEventListener("end",function(o){e.onSessionEnd()});var r=this.gl.getContextAttributes();this.gl.makeXRCompatible().then(function(){var o={antialias:r==null?void 0:r.antialias,alpha:r==null?void 0:r.alpha,depth:r==null?void 0:r.depth,stencil:r==null?void 0:r.stencil,framebufferScaleFactor};if(!e.session){console.error("session is lose while set session!");return}switch(e.machineType){case"Pico":case"VP":e.session.updateRenderState({baseLayer:new XRWebGLLayer(e.session,e.gl,o)});break;case"Oculus":e.session.updateRenderState({baseLayer:new XRWebGLLayer(e.session,e.gl,o)});break;default:e.machineType;break}e.session.requestReferenceSpace(e.referenceSpaceType).then(function(s){e.onRequestReferenceSpace(s)}),e.session.addEventListener("inputsourceschange",function(s){e.updateInputSources(s)})})}},n}(),LineSegmentsGeometry=function(n){__extends(t,n);function t(){var e=n.call(this)||this;e.type="LineSegmentsGeometry";var r=[-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],o=[-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],s=[0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5];return e.setIndex(s),e.setAttribute("position",new THREE__namespace.Float32BufferAttribute(r,3)),e.setAttribute("uv",new THREE__namespace.Float32BufferAttribute(o,2)),e}return t.prototype.applyMatrix4=function(e){var r=this.attributes.instanceStart,o=this.attributes.instanceEnd;return r!==void 0&&(r.applyMatrix4(e),o.applyMatrix4(e),r.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this},t.prototype.setPositions=function(e){var r;e instanceof Float32Array?r=e:Array.isArray(e)?r=new Float32Array(e):r=new Float32Array;var o=new THREE__namespace.InstancedInterleavedBuffer(r,6,1);return this.setAttribute("instanceStart",new THREE__namespace.InterleavedBufferAttribute(o,3,0)),this.setAttribute("instanceEnd",new THREE__namespace.InterleavedBufferAttribute(o,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this},t.prototype.setColors=function(e){var r;e instanceof Float32Array?r=e:Array.isArray(e)?r=new Float32Array(e):r=new Float32Array;var o=new THREE__namespace.InstancedInterleavedBuffer(r,6,1);return this.setAttribute("instanceColorStart",new THREE__namespace.InterleavedBufferAttribute(o,3,0)),this.setAttribute("instanceColorEnd",new THREE__namespace.InterleavedBufferAttribute(o,3,3)),this},t.prototype.fromWireframeGeometry=function(e){return this.setPositions(e.attributes.position.array),this},t.prototype.fromEdgesGeometry=function(e){return this.setPositions(e.attributes.position.array),this},t.prototype.fromMesh=function(e){return this.fromWireframeGeometry(new THREE__namespace.WireframeGeometry(e.geometry)),this},t.prototype.fromLineSegments=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.computeBoundingBox=function(){this.boundingBox===null&&(this.boundingBox=new THREE__namespace.Box3);var e=this.attributes.instanceStart,r=this.attributes.instanceEnd;if(e!==void 0&&r!==void 0){var o=new THREE__namespace.Box3;this.boundingBox.setFromBufferAttribute(e),o.setFromBufferAttribute(r),this.boundingBox.union(o)}},t.prototype.computeBoundingSphere=function(){this.boundingSphere===null&&(this.boundingSphere=new THREE__namespace.Sphere),this.boundingBox===null&&this.computeBoundingBox();var e=this.attributes.instanceStart,r=this.attributes.instanceEnd;if(e!==void 0&&r!==void 0){var o=this.boundingSphere.center;this.boundingBox.getCenter(o);for(var s=0,u=new THREE__namespace.Vector3,l=0,c=e.count;l<c;l++)u.fromBufferAttribute(e,l),s=Math.max(s,o.distanceToSquared(u)),u.fromBufferAttribute(r,l),s=Math.max(s,o.distanceToSquared(u));this.boundingSphere.radius=Math.sqrt(s),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}},t.prototype.toJSON=function(){},t}(THREE__namespace.InstancedBufferGeometry);Object.assign(LineSegmentsGeometry.prototype,{isLineSegmentsGeometry:!0});var lineShader={uniforms:THREE__namespace.UniformsUtils.merge([THREE__namespace.UniformsLib.common,THREE__namespace.UniformsLib.fog,{linewidth:{value:1},resolution:{value:new THREE__namespace.Vector2(1,1)},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1},opacity:{value:1}}]),vertexShader:`
|
|
1932
|
+
`,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:vertexShader$2,fragmentShader:fragmentShader$2,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,p=s.circleOpacity,f=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=p,this.panoMesh.material.uniforms.circleScale.value=f,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,defaultVRPanoramaControllerCustomInitArgs=__assign({},omit(defaultPanoramaControllerCustomInitArgs,["maxLatitude","minLatitude"])),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.updateHelperElementSize(),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.updateConfiguration=function(e){return n.prototype.updateConfiguration.call(this,__assign(__assign({},e),{maxLatitude:Math.PI/2,minLatitude:-Math.PI/2}))},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},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 p=c[l],f=p.panoId,d=new PanoSphereMesh;d.name="panoSphere_".concat(f),d.position.copy(p.position),d.needsRender=!0,this.panoMeshes[f]=d}this.updatePanoMeshesVisible()},t.prototype.updateTime=function(e,r){var o,s,u,l,c,p;if(!this.destroyed){this.updateHelperElementSize();var f=this.currentPano;this.userAction=!0,this.needsRender=!0,this.modelSceneNeedsRender=!0;var d={},h={},g=this.locationMotion.keyframes[0],A=this.locationMotion.keyframes[this.locationMotion.keyframes.length-1],m=this.locationMotion.getKeyFrameSegment(e),E=m[0],v=m[1];this.panoResourceFromLocationMotionKeyframe(E);var y=this.panoResourceFromLocationMotionKeyframe(v),b=this.panoResourceFromLocationMotionKeyframe(g),T=this.panoResourceFromLocationMotionKeyframe(A),_=!1;if(this.modelAlphaMotion.ended===!1&&(this.modelAlphaMotion.update(e),d.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 S=this.locationMotion.getKeyFrameSegment(e),R=S[0],M=S[1],H=this.panoResourceFromLocationMotionKeyframe(R),B=this.panoResourceFromLocationMotionKeyframe(M),C=H.position,w=B.position,I=this.locationMotion.value.count-M.value.count+1;if(d.progress=I,B.panoPicture&&(I<1?H.panoPicture&&(d.pano0=H.panoPicture):d.pano0=B.panoPicture,d.pano1=B.panoPicture),B.effect==="montage"?d.transition="BLACK":B.effect==="spread"?d.transition="SPREAD":d.transition="FADE",(B.effect==="zoomin"||B.effect==="zoomout")&&(d.progress=Math.pow(I,3)),I<1&&B.effect!=="fly"){if(d.pano0&&H.panoPicture){var O={panoId:d.pano0.panoId,map:d.pano0.map,mapSize:d.pano0.mapSize,zoom:d.pano0.zoom,matrix:H.panoPicture.matrix.clone().setPosition(B.position)},L=this.panoPictureObserverMap.get(d.pano0);L&&this.panoPictureObserverMap.set(O,L),d.pano0=O}C.copy(w),_=!0}h.distance=this.locationMotion.value.distance,h.offset=new THREE__namespace.Vector3(C.x+(w.x-C.x)*I,C.y+(w.y-C.y)*I,C.z+(w.z-C.z)*I);for(var N=[],z=[],J=0,G=this.locationMotion.keyframes;J<G.length;J++){var Q=G[J],U=Q.key,q=Q.progress;U!==void 0&&(N.push(U),q>this.locationMotion.progress&&z.push(U))}for(var K=0,Y=Object.keys(this.panoResources);K<Y.length;K++){var Z=Y[K];if(!(z.indexOf(Z)>=0)){var te=this.panoResources[Z];if(te.panoPicture){var j=te.panoPicture.map;if(j){if(j===((o=d.pano0)===null||o===void 0?void 0:o.map)||j===((s=d.pano1)===null||s===void 0?void 0:s.map))continue;j.dispose(),te.panoPicture=null}}N.indexOf(Z)>=0||delete this.panoResources[Z]}}this.currentPano=panoParse(B.panoId),this.emit("pano.moving",createEvent("pano.moving",{userAction:this.userAction,prevPano:panoParse(b.panoId),state:__assign(__assign(__assign(__assign({},panoParse(T.panoId)),{mode:this.mode}),clonePose(this.camera.pose)),h),options:{},progress:this.locationMotion.progress,error:null}))}isEmptyObject(d)===!1&&this.modelScene.parameter.set(d),h.offset&&this.camera.position.copy(h.offset),panoEqual(this.currentPano,f)&&this.updatePanoMeshesVisible();var ee=this.camera.pose.longitude,W=this.camera.pose.latitude;this.camera.quaternion.fromArray(this.cardboard.sensor.getOrientation()),this.camera.computePose();var re=this.works.getResolvedObserver(this.currentPano);if(this.camera.pose.distance>.1||_)for(var le=0,ae=Object.keys(this.panoMeshes);le<ae.length;le++){var oe=ae[le],se=this.panoMeshes[oe];se.setOpacity(0),se.updateTime&&se.updateTime(e,r),se.visible=!1}else if(re)for(var ce=re.visibleIds.concat(panoStringify(this.currentPano)),ve=0,Te=ce;ve<Te.length;ve++){var oe=Te[ve],pe=panoParse(oe),L=this.works.getResolvedObserver(pe);if(L){var se=this.panoMeshes[oe];if(!L.loadable&&!L.active){se.setOpacity(0);continue}var me=se.position.clone().setY(this.camera.position.y).distanceTo(this.camera.position);me<.05?se.setOpacity(0):se.setOpacity(clamp$1(1.5/me,0,1)),panoEqual(this.currentPano,pe)&&se.setOpacity(0),se.lookAt(this.camera.position)}}if(this.locationMotion.ended)for(var X=this.intersect(e),ne=0,V=this.works.resolvedObservers;ne<V.length;ne++){var L=V[ne],se=this.panoMeshes[L.panoId];se&&(se.setCurrent(se===X),se.updateTime&&se.updateTime(e,r))}(ee!==this.camera.pose.longitude||W!==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 I=(u=this.modelScene.parameter.progress)!==null&&u!==void 0?u:1,Ee=Math.round(I),fe=this.modelScene.parameter.pano0,he=this.modelScene.parameter.pano1,pe=Ee===0?fe:he,L=void 0;if(pe&&(L=this.works.getResolvedObserver(pe.panoId),L||(L=this.panoPictureObserverMap.get(pe))),this.tiling.appearDuration=this.tileAppearDuration,this.tiling.maxRequest=I<=.6?0:I<1?1:this.tileMaxRequest,this.tiling.imageOptions=this.imageOptions,!L||!pe||this.tileLevelForFov===!1)this.tiling.setObserver(null),this.tiling.update(this.renderer,this.camera,null,new THREE__namespace.Matrix4,1,0,0),this.modelScene.parameter.set("refinedScreen",null);else{var Ne=getImageSizeLevel(pe.mapSize),rt=Ne+1,Ye=new THREE__namespace.Vector2().copy(this.camera.resolution).multiplyScalar(this.camera.pixelRatio),ge=Math.floor(this.tileLevelForFov(this.camera.fov,Ye)),ie=ge>Ne?ge:0;this.tiling.setObserver(L);var de=this.tiling.update(this.renderer,this.camera,pe.map,pe.matrix,pe.zoom,rt,ie),Ce={map:this.tiling.renderTarget.texture,matrixInverse:this.tiling.camera.matrixWorldInverse,projectionMatrix:this.tiling.camera.projectionMatrix,pano:Ee,opacity:(fe==null?void 0:fe.panoId)===(he==null?void 0:he.panoId)?1:easeInQuart(Math.abs(((l=this.modelScene.parameter.progress)!==null&&l!==void 0?l:0)-.5)*2)},Se=this.modelScene.parameter.refinedScreen;(de||Ce.pano!==(Se==null?void 0:Se.pano)||Ce.opacity!==(Se==null?void 0:Se.opacity))&&this.modelScene.parameter.set("refinedScreen",Ce)}}this.panoVideo.object.position.copy(this.camera.position),this.panoVideo.updateTime(e);{var Be=y.effect,Le=this.modelScene.parameter,fe=Le.pano0,he=Le.pano1;if(fe&&he&&fe!==he&&Be==="fly"&&this.flyEffectUseDepthBuffer){if(((c=this.modelScene.parameter.pano0Depth)===null||c===void 0?void 0:c.panoId)!==fe.panoId||((p=this.modelScene.parameter.pano1Depth)===null||p===void 0?void 0:p.panoId)!==he.panoId){var be=500,Me=512;this.pano0DepthCubeRenderTarget?this.pano0DepthCubeRenderTarget.width!==Me&&this.pano0DepthCubeRenderTarget.setSize(Me,Me):this.pano0DepthCubeRenderTarget=new THREE__namespace.WebGLCubeRenderTarget(Me,{minFilter:THREE__namespace.NearestFilter,magFilter:THREE__namespace.NearestFilter,generateMipmaps:!1}),this.pano1DepthCubeRenderTarget?this.pano1DepthCubeRenderTarget.width!==Me&&this.pano1DepthCubeRenderTarget.setSize(Me,Me):this.pano1DepthCubeRenderTarget=new THREE__namespace.WebGLCubeRenderTarget(Me,{minFilter:THREE__namespace.NearestFilter,magFilter:THREE__namespace.NearestFilter,generateMipmaps:!1});var we=new THREE__namespace.CubeCamera(this.camera.near,this.camera.far,this.pano0DepthCubeRenderTarget);we.matrix.copy(fe.matrix),we.matrixWorld.copy(we.matrix),we.matrixAutoUpdate=!1,renderDepthCube(this.renderer,this.modelScene,we,be);var Pe=new THREE__namespace.CubeCamera(this.camera.near,this.camera.far,this.pano1DepthCubeRenderTarget);Pe.matrix.copy(he.matrix),Pe.matrixWorld.copy(Pe.matrix),Pe.matrixAutoUpdate=!1,renderDepthCube(this.renderer,this.modelScene,Pe,be),this.modelScene.parameter.set({pano0Depth:{panoId:fe.panoId,map:this.pano0DepthCubeRenderTarget.texture,mapSize:this.pano0DepthCubeRenderTarget.width,maxDepth:be},pano1Depth:{panoId:he.panoId,map:this.pano1DepthCubeRenderTarget.texture,mapSize:this.pano1DepthCubeRenderTarget.width,maxDepth:be}})}}else this.modelScene.parameter.set({pano0Depth:null,pano1Depth:null}),this.flyEffectUseDepthBuffer||(this.pano0DepthCubeRenderTarget&&(this.pano0DepthCubeRenderTarget.dispose(),this.pano0DepthCubeRenderTarget=void 0),this.pano1DepthCubeRenderTarget&&(this.pano1DepthCubeRenderTarget.dispose(),this.pano1DepthCubeRenderTarget=void 0))}}},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.updateHelperElementSize=function(){if(this.helperElement){var e=new THREE__namespace.Vector2(this.element.offsetWidth,this.element.offsetHeight),r=e.x*this.viewport.left,o=e.y*(1-this.viewport.bottom-this.viewport.height),s=e.x*this.viewport.width,u=e.y*this.viewport.height;this.helperElement.style.marginLeft!==r+"px"&&(this.helperElement.style.marginLeft=r+"px"),this.helperElement.style.marginTop!==o+"px"&&(this.helperElement.style.marginTop=o+"px"),this.helperElement.style.width!==s+"px"&&(this.helperElement.style.width=s+"px"),this.helperElement.style.height!==u+"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,p=u;c<p.length;c++){var f=p[c];if(this.panoMeshes[f]===s){l=f;break}}return l!==null&&this.moveToPano(panoParse(l),{},!0),delete this.activePanoMesh,delete this.activeTime,s}var d=this.camera.getDirection(new THREE__namespace.Vector3),h=new THREE__namespace.Raycaster(this.camera.position,d);h.params.Points={threshold:.1};for(var g=void 0,A=[],m=this.works.getResolvedObserver(this.currentPano),E=m?m.visibleIds:[],v=0,y=E;v<y.length;v++){var l=y[v],b=this.panoMeshes[l],T=h.intersectObject((r=b.hitTestMesh)!==null&&r!==void 0?r:b,!0)[0];T&&A.push({panoMesh:b,intersection:__assign({floor:(o=m==null?void 0:m.floorIndex)!==null&&o!==void 0?o:0},T)})}var _=A.sort(function(B,C){return B.intersection.distance-C.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.modelScene.intersectRaycaster(h)[0]);var S=createEvent("intersect.update",{raycaster:h,intersection:g!=null?g:null,object:this.intersectMesh});if(this.emit("intersect.update",S),S.defaultPrevented){this.hideIntersectMesh();return}if(g&&g.face){var R=g.face.normal,M=new THREE__namespace.Quaternion;M.setFromUnitVectors(new THREE__namespace.Vector3(0,0,1),R),this.intersectMesh.quaternion.copy(M);var H=g.point.clone();this.intersectMesh.position.copy(H),_?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),defaultModelControllerCustomInitArgs=__assign({},defaultPanoramaLikeControllerCustomInitArgs),ModelController=function(n){__extends(t,n);function t(e){var r=this,o=t.parseArgs(e);return r=n.call(this,o)||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:r.modelScene.parameter.resolveValue().modelAlpha}),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,p=this.parseArgs(e),f=p.works,d=e.initial,h=d.state,g=d.currentState,A=typeof h.panoIndex=="number"?{workCode:(s=(r=h.workCode)!==null&&r!==void 0?r:(o=p.works[0])===null||o===void 0?void 0:o.workCode)!==null&&s!==void 0?s:"",panoIndex:h.panoIndex}:{workCode:g.workCode,panoIndex:g.panoIndex},m=f.getResolvedObserver(A),E=clamp$1((u=h.fov)!==null&&u!==void 0?u:!m||isFristPersonMode(g.mode)?g.fov:p.defaultFov,p.minFov,p.maxFov),v=(l=h.longitude)!==null&&l!==void 0?l:g.longitude,y=clamp$1(typeof p.minLatitude=="function"?p.minLatitude(E):p.minLatitude,-Math.PI/2,Math.PI/2),b=clamp$1(typeof p.maxLatitude=="function"?p.maxLatitude(E):p.maxLatitude,-Math.PI/2,Math.PI/2),T=clamp$1((c=h.latitude)!==null&&c!==void 0?c:!m||isFristPersonMode(g.mode)?g.latitude:p.defaultLatitude,y,b),_=new THREE__namespace.Vector3;if(p.initial.state.offset)_.copy(p.initial.state.offset);else if(m)_.copy(m.position);else{var S=coordinatesToVector(g).setLength(g.distance);_.copy(p.initial.currentState.offset).sub(S)}return{workCode:A.workCode,panoIndex:A.panoIndex,mode:"Model",longitude:v,latitude:T,fov:E,offset:_,distance:0}},t.prototype.updateConfiguration=function(e){return n.prototype.updateConfiguration.call(this,e)},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,p=e;c<p.length;c++){var f=p[c];u.push({key:f.key,progress:f.progress,value:{distance:0,x:f.value.offset.x,y:f.value.offset.x,z:f.value.offset.x}}),l.push({key:f.key,progress:f.progress,value:{longitude:f.value.longitude,latitude:f.value.latitude,fov:f.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(p){return p.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.modelScene.parameter.set(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},p={perspToOrtho:0},f={longitude:l.longitude,latitude:l.latitude,fov:l.fov,duration:s,moveStartCallback:function(d){e.perspToOrthoMotion.set(p,s).catch(noop$1),e.modelAlphaMotion.set(c,s).catch(noop$1),e.emit("initAnimation.start",createEvent("initAnimation.start",{state:d,userAction:e.userAction}))},moveEndCallback:function(d){e.emit("initAnimation.end",createEvent("initAnimation.end",{state:d,userAction:e.userAction})),r()},moveCancelCallback:function(){var d=e.currentPano,h=__assign(__assign({},d),{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:h,userAction:e.userAction})),r()}};e.moveToPosition(l.offset,f,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 p=now(),f=new THREE__namespace.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z),d=f.distanceTo(e),h=this.locationMotion.getProgressVelocity(p),g=0,A=1;A<this.locationMotion.keyframes.length;A++){var m=this.locationMotion.keyframes[A-1].value,E=m.x,v=m.y,y=m.z,b=this.locationMotion.keyframes[A].value,T=b.x,_=b.y,S=b.z;g+=Math.sqrt(Math.pow(T-E,2)+Math.pow(_-v,2)+Math.pow(S-y,2))}var R=d===0?0:h*g/d,M=this.calculateMovingDuration(r.duration,d),H={x:e.x,y:e.y,z:e.z,distance:0},B={longitude:r.longitude,latitude:r.latitude,fov:r.fov},C=this.works.resolvedObservers,w=arrayMin(C,function(N){return N.position.distanceTo(f)}),I=w?{workCode:w.work.workCode,panoIndex:w.panoIndex}:{workCode:"",panoIndex:0},O=__assign(__assign({},I),{mode:this.mode,longitude:(u=B.longitude)!==null&&u!==void 0?u:this.camera.pose.longitude,latitude:(l=B.latitude)!==null&&l!==void 0?l:this.camera.pose.latitude,fov:(c=B.fov)!==null&&c!==void 0?c:this.camera.pose.fov,offset:e.clone(),distance:0}),L=this.currentPano;this.emit("pano.moveTo",createEvent("pano.moveTo",{options:r,prevPano:L,progress:0,state:O,userAction:this.userAction,error:null})),r.moveStartCallback&&r.moveStartCallback(O),this.cameraMotion.set(B,M).catch(noop$1),this.locationMotion.set(H,M,R).then(function(){for(var N=0,z=s.modelScene.children;N<z.length;N++){var J=z[N];J instanceof Model&&J.show()}var G=__assign(__assign(__assign({},I),{mode:s.mode}),clonePose(s.camera.pose));s.emit("pano.arrived",createEvent("pano.arrived",{options:r,prevPano:L,progress:0,state:G,userAction:s.userAction,error:null})),r.moveEndCallback&&r.moveEndCallback(G)},function(){r.moveCancelCallback&&r.moveCancelCallback(),s.emit("pano.cancel",createEvent("pano.cancel",{options:r,prevPano:L,progress:0,state:O,userAction:s.userAction,error:null}))})},t.prototype.onTapGesture=function(e){var r=e.center.raycaster;this.stopMomentumMovement();var o=this.modelScene.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.modelScene.intersectRaycaster(r)[0]}}if(o){var c=new THREE__namespace.Vector3().copy(o.point).add(HUMAN_EYE_POSITION),p=this.works.resolvedObservers,f=arrayMin(p,function(g){return g.position.distanceTo(c)},!0),d=f[0],h=f[1];d&&h<5&&(c.y=d.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),minDistance=.5,PANGESTURE_FORWARD_ANGLE=Math.PI/7,defaultMapviewControllerCustomInitArgs={defaultLongitude:Math.PI/4,defaultLatitude:Math.PI/4,defaultDistance:150,maxLatitude:+Math.PI/2,minLatitude:0,cameraType:"auto",cameraFence:null,intersectMeshCreator:function(){return new IntersectMesh}},MapviewController=function(n){__extends(t,n);function t(e){var r=this,o=t.parseArgs(e);return r=n.call(this,o)||this,r.mode="Mapview",r.defaultLongitude=o.defaultLongitude,r.defaultLatitude=o.defaultLatitude,r.defaultDistance=o.defaultDistance,r.maxLatitude=o.maxLatitude,r.minLatitude=o.minLatitude,r.cameraType=o.cameraType,r.cameraFence=o.cameraFence,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:r.modelScene.parameter.resolveValue().modelAlpha}),r.perspToOrthoMotion=new Motion({perspToOrtho:r.camera.perspToOrtho.x}),r.intersectMeshCreator=o.intersectMeshCreator,r.intersectMesh=r.intersectMeshCreator(),r.intersectMesh.name="intersect",r.intersectMesh.visible=!1,r.currentTapId=null,r.helper.add(r.intersectMesh),r.edlTarget=new THREE__namespace.WebGLRenderTarget(1024,1024,{generateMipmaps:!1,minFilter:THREE__namespace.NearestFilter,magFilter:THREE__namespace.NearestFilter,format:THREE__namespace.RGBAFormat,type:THREE__namespace.FloatType,depthTexture:new THREE__namespace.DepthTexture(1024,1024,THREE__namespace.UnsignedIntType)}),r}return t.parseArgs=function(e){var r,o,s,u,l,c,p,f;if(e instanceof t)return e;var d=n.parseArgs.call(this,e);return __assign(__assign({},d),{defaultLongitude:(r=e.defaultLongitude)!==null&&r!==void 0?r:defaultMapviewControllerCustomInitArgs.defaultLongitude,defaultLatitude:(o=e.defaultLatitude)!==null&&o!==void 0?o:defaultMapviewControllerCustomInitArgs.defaultLatitude,defaultDistance:(s=e.defaultDistance)!==null&&s!==void 0?s:defaultMapviewControllerCustomInitArgs.defaultDistance,maxLatitude:(u=e.maxLatitude)!==null&&u!==void 0?u:defaultMapviewControllerCustomInitArgs.maxLatitude,minLatitude:(l=e.minLatitude)!==null&&l!==void 0?l:defaultMapviewControllerCustomInitArgs.minLatitude,cameraType:(c=e.cameraType)!==null&&c!==void 0?c:defaultMapviewControllerCustomInitArgs.cameraType,cameraFence:(p=e.cameraFence)!==null&&p!==void 0?p:defaultMapviewControllerCustomInitArgs.cameraFence,intersectMeshCreator:(f=e.intersectMeshCreator)!==null&&f!==void 0?f:defaultMapviewControllerCustomInitArgs.intersectMeshCreator})},t.distanceFromModel=function(e,r,o){var s=e.boundingBox,u=s.isEmpty()?10: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);u=isNaN(u)||!isFinite(u)?1:u;var l=u/2/Math.tan(Math.PI*r/360);return o<1&&(l=l/o),isNaN(l)||!isFinite(l)?u:l},t.initAnimationEndState=function(e){var r,o,s,u,l,c,p,f=this.parseArgs(e),d=f.works,h=f.modelScene,g=e.initial,A=g.state,m=g.currentState,E=typeof A.panoIndex=="number"?{workCode:(s=(r=A.workCode)!==null&&r!==void 0?r:(o=f.works[0])===null||o===void 0?void 0:o.workCode)!==null&&s!==void 0?s:"",panoIndex:A.panoIndex}:{workCode:m.workCode,panoIndex:m.panoIndex},v=d.getResolvedObserver(E),y=(u=A.fov)!==null&&u!==void 0?u:60,b=clamp$1(typeof f.minLatitude=="function"?f.minLatitude(y):f.minLatitude,-Math.PI/2,Math.PI/2),T=clamp$1(typeof f.maxLatitude=="function"?f.maxLatitude(y):f.maxLatitude,-Math.PI/2,Math.PI/2),_=clamp$1((l=A.latitude)!==null&&l!==void 0?l:isThirdPersonMode(m.mode)?m.latitude:f.defaultLatitude,b,T),S=t.distanceFromModel(f.modelScene,y,f.camera.aspect),R=new THREE__namespace.Vector3,M=(c=A.distance)!==null&&c!==void 0?c:Math.min(f.defaultDistance,S),H=(p=A.longitude)!==null&&p!==void 0?p:isThirdPersonMode(m.mode)?m.longitude:f.defaultLongitude;return A.offset?R.copy(A.offset):f.defaultDistance<S&&v?(R.copy(v.position),A.longitude===void 0&&(H=m.longitude)):(h.boundingBox.getCenter(R),M=S),__assign(__assign({},E),{mode:"Mapview",longitude:H,latitude:_,fov:y,offset:R,distance:M})},t.prototype.updateConfiguration=function(e){var r=n.prototype.updateConfiguration.call(this,e);if(r===!1)return!1;if(e.defaultLongitude!==void 0&&this.defaultLongitude!==e.defaultLongitude&&(this.defaultLongitude=e.defaultLongitude),e.defaultLatitude!==void 0&&this.defaultLatitude!==e.defaultLatitude&&(this.defaultLatitude=e.defaultLatitude),e.defaultDistance!==void 0&&this.defaultDistance!==e.defaultDistance&&(this.defaultDistance=e.defaultDistance),e.maxLatitude!==void 0&&this.maxLatitude!==e.maxLatitude&&(this.maxLatitude=e.maxLatitude),e.minLatitude!==void 0&&this.minLatitude!==e.minLatitude&&(this.minLatitude=e.minLatitude),e.cameraType!==void 0&&this.cameraType!==e.cameraType&&(this.cameraType=e.cameraType),this.cameraFence instanceof THREE__namespace.Box3&&e.cameraFence instanceof THREE__namespace.Box3?this.cameraFence.equals(e.cameraFence)||(this.cameraFence=e.cameraFence):this.cameraFence instanceof THREE__namespace.Sphere&&e.cameraFence instanceof THREE__namespace.Sphere?this.cameraFence.equals(e.cameraFence)||(this.cameraFence=e.cameraFence):e.cameraFence!==void 0&&(this.cameraFence=e.cameraFence),e.intersectMeshCreator!==void 0&&this.intersectMeshCreator!==e.intersectMeshCreator){this.intersectMeshCreator=e.intersectMeshCreator;var o=this.intersectMesh;this.intersectMesh=this.intersectMeshCreator(),this.intersectMesh.name=o.name,this.intersectMesh.visible=o.visible;var s=this.intersectMesh.parent;s&&s.add(this.intersectMesh),o.dispose()}return!0},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){this.userAction=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}}));this.currentPano={workCode:u.workCode,panoIndex:u.panoIndex};var l={longitude:u.longitude,latitude:u.latitude,fov:u.fov},c={x:u.offset.x,y:u.offset.y,z:u.offset.z,distance:u.distance,orthoDistance:u.distance};return this.locationMotion.set(c,o.duration).catch(noop$1),this.cameraMotion.set(l,o.duration).catch(noop$1),!0},t.prototype.updateModel=function(e){n.prototype.updateModel.call(this,e);var r=e.boundingBox.getCenter(new THREE__namespace.Vector3),o=t.distanceFromModel(e,this.cameraMotion.value.fov,this.camera.aspect);this.updateCamera({offset:r,distance:o},0,!0),this.hideIntersectMesh()},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,p=e;c<p.length;c++){var f=p[c];u.push({key:f.key,progress:f.progress,value:{distance:f.value.distance,x:f.value.offset.x,y:f.value.offset.x,z:f.value.offset.x}}),l.push({key:f.key,progress:f.progress,value:{longitude:f.value.longitude,latitude:f.value.latitude,fov:f.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.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),this.modelAlphaMotion.ended||(this.modelAlphaMotion.update(e),o.modelAlpha=this.modelAlphaMotion.value.modelAlpha);var u=0;if(this.cameraType==="auto"?u=Math.abs(Math.PI/2-this.cameraMotion.value.latitude)<.02||Math.abs(-Math.PI/2-this.cameraMotion.value.latitude)<.02?1:0:this.cameraType==="perspective"?u=0:this.cameraType==="orthographic"&&(u=1),this.perspToOrthoMotion.getTargetKeyframe().value.perspToOrtho!==u&&this.perspToOrthoMotion.set({perspToOrtho:u},500).catch(noop$1),this.perspToOrthoMotion.ended||(this.perspToOrthoMotion.update(e),this.camera.perspToOrtho.setScalar(clamp$1(this.perspToOrthoMotion.value.perspToOrtho,0,1))),isEmptyObject(o)||this.modelScene.parameter.set(o),isEmptyObject(s)||this.setCamera(s),this.cameraFence&&!this.panState&&!this.pinchState&&!this.mouseWheelState&&!this.inMomentumMovement&&this.locationMotion.ended&&this.perspToOrthoMotion.ended&&this.cameraMotion.ended){var l=coordinatesToVector(this.camera.pose,new THREE__namespace.Vector3),c=new THREE__namespace.Vector3().copy(this.camera.pose.offset).sub(l.clone().multiplyScalar(this.camera.pose.distance));if(this.cameraFence.distanceToPoint(c)>.01){var p=this.cameraFence.clampPoint(c,new THREE__namespace.Vector3),f=this.camera.pose.offset.clone().add(p).sub(c),d=__assign(__assign({},this.currentPano),{mode:this.mode,longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude,fov:this.camera.pose.fov,offset:f,distance:this.camera.pose.distance});this.fixFinalState(d),this.locationMotion.set({x:d.offset.x,y:d.offset.y,z:d.offset.z,distance:d.distance},300).catch(noop$1)}}if(this.intersectMesh&&this.intersectMesh.parent){var h=this.camera.position.distanceTo(this.intersectMesh.position),g=2*Math.tan(.5*this.camera.fov/180*Math.PI),A=h*g/5;this.intersectMesh.scale.setScalar(A)}}},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,distance:r.value.distance,offset:new THREE__namespace.Vector3(r.value.x,r.value.y,r.value.z)})},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},p={x:l.offset.x,y:l.offset.y,z:l.offset.z,distance:l.distance},f={modelAlpha:1},d={perspToOrtho:0};e.emit("initAnimation.start",createEvent("initAnimation.start",{state:l,userAction:e.userAction})),e.perspToOrthoMotion.set(d,s).catch(noop$1),e.modelAlphaMotion.set(f,s/3).catch(noop$1),e.cameraMotion.set(c,s).catch(noop$1),e.locationMotion.set(p,s).then(function(){e.emit("initAnimation.end",createEvent("initAnimation.end",{state:l,userAction:e.userAction}))},function(h){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.getForwardObserverOrNot=function(e){var r=this,o=this.modelScene.intersectRaycaster(e)[0];if(!o)return null;var s=this.works.resolvedObservers.filter(function(p){for(var f,d=0,h=r.modelScene.children;d<h.length;d++){var g=h[d];if(g instanceof Model&&g.visible&&((f=g.work)===null||f===void 0?void 0:f.workCode)===p.work.workCode)return!0}return!1}),u=arrayMin(s,function(p){return p.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.viewport.width),latitude:2*e.y/(r.y*this.viewport.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,x:0,y:0,z:0},p=0;p<s;p++)l.longitude*=.996,l.latitude*=.996*.998,l.x*=.99,l.y*=.99,l.z*=.99,c.longitude+=l.longitude,c.latitude+=l.latitude,c.x+=l.x,c.y+=l.y,c.z+=l.z;var f=this.cameraMotion.value.fov,d=formatRad(this.cameraMotion.value.longitude+c.longitude),h=clamp$1(typeof this.minLatitude=="function"?this.minLatitude(f):this.minLatitude,-Math.PI/2,Math.PI/2),g=clamp$1(typeof this.maxLatitude=="function"?this.maxLatitude(f):this.maxLatitude,-Math.PI/2,Math.PI/2),A=clamp$1(this.cameraMotion.value.latitude+c.latitude,h,g),m=new THREE__namespace.Vector3(this.locationMotion.value.x+c.x,this.locationMotion.value.y+c.y,this.locationMotion.value.z+c.z),E=__assign(__assign({},this.currentPano),{mode:this.mode,longitude:d,latitude:A,offset:m,fov:f,distance:this.locationMotion.value.distance}),v=e.state.offset.clone().sub(coordinatesToVector(e.state).setLength(E.distance)),y=!(Math.abs(l.longitude)>1e-4||Math.abs(l.latitude)>1e-4||Math.abs(l.x)>1e-4||Math.abs(l.y)>1e-4||Math.abs(l.z)>1e-4),b=this.cameraFence?this.cameraFence.containsPoint(v):!0;b===!1&&(y=!0);var T=createEvent("gesture.momentum",__assign(__assign({},e),{isFirst:r,isFinal:y,state:E}));if(this.inMomentumMovement.event=T,this.emit("gesture.momentum",T),e.defaultPrevented){this.inMomentumMovement=null;return}this.inMomentumMovement&&(this.cameraMotion.set({longitude:d,latitude:A},0).catch(noop$1),this.locationMotion.set({x:E.offset.x,y:E.offset.y,z:E.offset.z,distance:E.distance},0).catch(noop$1),y?this.inMomentumMovement=null:AnimationFrameLoop.shared.add(function(_,S){u.requestMomentumMovement(e,!1,l,S|0)},!0,1))}},t.prototype.fixFinalState=function(e){if(this.perspToOrthoMotion.getTargetKeyframe().value.perspToOrtho!==1){var r=coordinatesToVector(e,new THREE__namespace.Vector3),o=new THREE__namespace.Vector3().copy(e.offset).sub(r.clone().multiplyScalar(e.distance)),s=new THREE__namespace.Raycaster(o,r);s.params.Points={threshold:.1},s.near=this.camera.near,s.far=this.camera.far;var u;if(u=this.modelScene.intersectRaycaster(s).filter(function(d){var h,g=(h=d.face)===null||h===void 0?void 0:h.normal;return g&&s.ray.direction.dot(g)>=0?!1:d.distance>minDistance+s.near})[0],!u){var l=new THREE__namespace.Plane(new THREE__namespace.Vector3(0,1,0),-this.modelScene.boundingBox.min.y),c=s.ray.intersectPlane(l,new THREE__namespace.Vector3);if(c){var p=c.distanceTo(s.ray.origin);p<1e3&&p>=s.near&&(u={distance:p,floor:0,point:c,object:this.scene,face:null})}}if(!u){var f=Math.max(e.distance,3);u={distance:f,floor:0,point:s.ray.direction.clone().setLength(f).add(s.ray.origin),object:this.scene,face:null}}u&&(e.distance=clamp$1(u.distance,0,1/0),e.offset.copy(o).add(r.clone().multiplyScalar(e.distance)))}},t.prototype.onPanGesture=function(e){this.userAction=e.userAction,this.stopMomentumMovement(),this.hideIntersectMesh();var r=e.pointers.length,o=this.panState,s=0,u=!1;e.pointerType==="mouse"&&(s=e.srcEvent.buttons,u=e.srcEvent.shiftKey),o&&s===0&&o.buttons!==0&&(s=o.buttons);var l=o==null?void 0:o.target;if(!l){var c=this.relativeClientPosition(e.center),p=new THREE__namespace.Raycaster;p.params.Points={threshold:.1},p.setFromCamera(c,this.camera),p.near=this.camera.near,l=new THREE__namespace.Vector3().copy(p.ray.direction).multiplyScalar(3).add(p.ray.origin);var f=this.modelScene.intersectRaycaster(p)[0];if(!f&&p.ray.direction.y<-.3){var d=new THREE__namespace.Plane(new THREE__namespace.Vector3(0,1,0),0),h=p.ray.intersectPlane(d,new THREE__namespace.Vector3);if(h){var g=h.distanceTo(p.ray.origin);g<1e4&&g>=p.near&&(f={distance:g,floor:0,point:h,object:this.scene})}}if(f)l.copy(f.point);else{var A=new THREE__namespace.Vector3().copy(this.camera.pose.offset).sub(this.camera.position).normalize(),d=new THREE__namespace.Plane().setFromNormalAndCoplanarPoint(A,this.camera.pose.offset);p.ray.intersectPlane(d,l)}}if(e.isFinal?delete this.panState:this.panState={target:l,buttons:s,pointerLength:r,x:e.center.x,y:e.center.y},!(typeof o=="undefined"||o.pointerLength!==r)){var m=r>1||s===2||u;if(m){var E={x:e.center.x-o.x,y:e.center.y-o.y},v=new THREE__namespace.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z),y=coordinatesToVector(this.cameraMotion.value).setLength(this.locationMotion.value.distance).add(v),b=new THREE__namespace.Vector3().copy(y).sub(o.target).length();b*=Math.tan(this.camera.pose.fov/2*Math.PI/180);var T=this.renderer.getSize(new THREE__namespace.Vector2),_=2*E.x*b/T.y,S=2*E.y*b/T.y,R=new THREE__namespace.Vector3;R.setFromMatrixColumn(this.camera.matrix,0),R.multiplyScalar(-_),v.add(R),this.camera.pose.latitude<PANGESTURE_FORWARD_ANGLE?R.setFromMatrixColumn(this.camera.matrix,1):(R.setFromMatrixColumn(this.camera.matrix,0),R.crossVectors(this.camera.up,R)),R.multiplyScalar(S),v.add(R);var M=__assign(__assign({},this.currentPano),{mode:this.mode,longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude,fov:this.camera.pose.fov,offset:v,distance:this.camera.pose.distance});if(e.state=M,this.emit("gesture.pan",e),e.defaultPrevented)return;if(this.locationMotion.set({x:M.offset.x,y:M.offset.y,z:M.offset.z},0).catch(noop$1),e.isFinal&&(this.fixFinalState(M),Object.assign(e,{__fixFinalState:!0}),this.locationMotion.set({distance:M.distance,x:M.offset.x,y:M.offset.y,z:M.offset.z},0).catch(noop$1)),e.isFinal){var H=this.renderer.getSize(new THREE__namespace.Vector2),B=2*e.velocityX*b/H.y,C=2*e.velocityY*b/H.y,w=new THREE__namespace.Vector3,I=new THREE__namespace.Vector3;w.setFromMatrixColumn(this.camera.matrix,0),w.multiplyScalar(-B),I.add(w),this.camera.pose.latitude<PANGESTURE_FORWARD_ANGLE?w.setFromMatrixColumn(this.camera.matrix,1):(w.setFromMatrixColumn(this.camera.matrix,0),w.crossVectors(this.camera.up,w)),w.multiplyScalar(C),I.add(w),this.inMomentumMovement={uuid:createUuid()},this.requestMomentumMovement(e,!0,{longitude:0,latitude:0,x:I.x,y:I.y,z:I.z},0)}}else{var E={x:e.center.x-o.x,y:e.center.y-o.y},O=this.coordinatesForOffset(E),L=formatRad(this.cameraMotion.value.longitude+O.longitude),N=this.camera.pose.fov,z=clamp$1(typeof this.minLatitude=="function"?this.minLatitude(N):this.minLatitude,-Math.PI/2,Math.PI/2),J=clamp$1(typeof this.maxLatitude=="function"?this.maxLatitude(N):this.maxLatitude,-Math.PI/2,Math.PI/2),G=clamp$1(this.cameraMotion.value.latitude+O.latitude,z,J);this.camera.aspect<1&&Math.abs(e.overallVelocityX)>.2&&Math.atan2(Math.abs(e.overallVelocityY),Math.abs(e.overallVelocityX))<Math.PI/6.923&&(G=this.cameraMotion.value.latitude);var M=__assign(__assign({},this.currentPano),{mode:this.mode,longitude:L,latitude:G,fov:N,offset:this.camera.pose.offset,distance:this.camera.pose.distance});if(e.isFinal&&Object.assign(e,{__fixFinalState:!0}),e.state=M,this.emit("gesture.pan",e),e.defaultPrevented)return;if(e.isFinal?this.locationMotion.set({distance:M.distance,x:M.offset.x,y:M.offset.y,z:M.offset.z},0).catch(noop$1):this.cameraMotion.set({longitude:M.longitude,latitude:M.latitude},0).catch(noop$1),e.isFinal){var Q=e.velocityX,U=e.velocityY;this.inMomentumMovement={uuid:createUuid()},this.requestMomentumMovement(e,!0,__assign(__assign({},this.coordinatesForOffset({x:Q,y:U})),{x:0,y:0,z:0}),0)}}}},t.prototype.onPinchGesture=function(e){var r;if(this.initAnimationIsReady){this.userAction=e.userAction,this.stopMomentumMovement(),this.hideIntersectMesh();var o=(r=this.pinchState)===null||r===void 0?void 0:r.distance;if(e.isFirst){this.pinchState={x:e.center.x,y:e.center.y,scale:1,distance:this.locationMotion.value.distance};return}if(typeof o!="undefined"){var s=this.modelScene.boundingBox.getCenter(new THREE__namespace.Vector3),u=t.distanceFromModel(this.modelScene,this.cameraMotion.value.fov,this.camera.aspect),l=clamp$1(o/e.scale,minDistance,1/0),c=e.state.offset.clone().sub(coordinatesToVector(e.state).setLength(l)),p=this.modelScene.boundingBox.containsPoint(c),f;if(!p&&this.pinchState&&this.pinchState.scale>e.scale&&s.distanceTo(c)>u?f=e.state.distance:(f=l,this.pinchState&&(this.pinchState.scale=e.scale)),e.state.distance=f,this.emit("gesture.pinch",e),!e.defaultPrevented&&(this.locationMotion.set({distance:e.state.distance},0).catch(noop$1),e.pointerType!=="mouse"&&(e.type="gesture.pan",this.onPanGesture(e)),e.isFinal)){if(!("__fixFinalState"in e)){var d=e.state;this.fixFinalState(e.state);var h={x:d.offset.x,y:d.offset.y,z:d.offset.z,distance:d.distance};this.locationMotion.set(h,0).catch(noop$1)}delete this.panState,delete this.pinchState}}}},t.prototype.onMouseMove=function(e){var r,o;if(this.intersectMesh.parent&&!this.panState&&!this.pinchState&&!this.mouseWheelState&&(this.emit("gesture.mousemove",e),!e.defaultPrevented)){var s=e.center.raycaster;if(s.near=this.camera.near,s.far=this.camera.far,e.isFinal&&this.intersectMesh.parent&&this.intersectMesh.visible===!0){this.hideIntersectMesh();return}var u=this.modelScene.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),p=c.clone(),f=u.point.clone();this.intersectMesh.position.copy(f);var d=f.clone().add(p);if(this.intersectMesh.lookAt(d),Math.abs(c.y)>.99){var h=this.camera.position.clone().sub(f);this.intersectMesh.rotation.z=-Math.atan2(h.z,h.x)}this.intersectMesh.visible=!0,this.needsRender=!0}else this.hideIntersectMesh()}},t.prototype.onMouseWheel=function(e){if(this.initAnimationIsReady)if(this.userAction=e.userAction,this.stopMomentumMovement(),this.hideIntersectMesh(),e.isFinal){var r=e.state;if(this.fixFinalState(r),this.emit("gesture.mousewheel",e),e.defaultPrevented)return;var o={x:r.offset.x,y:r.offset.y,z:r.offset.z,distance:r.distance};this.locationMotion.set(o,0).catch(noop$1)}else{var s=Math.max(this.locationMotion.value.distance-this.camera.near,0),u=e.center.delta/10*Math.max(s/5,.1);if(this.locationMotion.value.distance-u>=minDistance){var l=this.locationMotion.value.distance-u;e.state.distance=l}else{var c=coordinatesToVector(this.cameraMotion.value);c.setLength(u),e.state.offset.add(c)}if(this.emit("gesture.mousewheel",e),e.defaultPrevented)return;this.locationMotion.set({distance:e.state.distance,x:e.state.offset.x,y:e.state.offset.y,z:e.state.offset.z},0).catch(noop$1)}},t.prototype.onTapGesture=function(e){var r=this;this.userAction=e.userAction,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(p){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){if(this.initAnimationIsReady){this.userAction=e.userAction,this.stopMomentumMovement(),this.hideIntersectMesh();var r=e.state,o=e.center.raycaster,s=o.ray.origin.clone().add(o.ray.direction.clone().setLength(3)),u=1,l=3,c=u,p=this.modelScene.intersectRaycaster(o)[0];if(p&&(s=p.point.clone(),p.distance>(u+l)/2?c=u:c=l),e.state.distance=c,e.state.offset=s,this.emit("gesture.dbltap",e),!e.defaultPrevented){var f={x:r.offset.x,y:r.offset.y,z:r.offset.z,distance:r.distance};this.locationMotion.set(f,360).catch(noop$1),this.hideIntersectMesh()}}},t.prototype.hideIntersectMesh=function(){this.intersectMesh.visible=!1,this.needsRender=!0},t}(BaseController);function isNil(n){return n==null}var _moveEvent={type:"move"},XRController=function(){function n(){this._targetRay=null,this._grip=null,this._hand=null,this._axes=[0,0]}return n.prototype.getHandSpace=function(){return this._hand===null&&(this._hand=new THREE__namespace.Group,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand},n.prototype.getTargetRaySpace=function(){return this._targetRay===null&&(this._targetRay=new THREE__namespace.Group,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new THREE__namespace.Vector3,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new THREE__namespace.Vector3),this._targetRay},n.prototype.getGripSpace=function(){return this._grip===null&&(this._grip=new THREE__namespace.Group,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new THREE__namespace.Vector3,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new THREE__namespace.Vector3),this._grip},n.prototype.dispatchEvent=function(t){return this._targetRay!==null&&this._targetRay.dispatchEvent(t),this._grip!==null&&this._grip.dispatchEvent(t),this._hand!==null&&this._hand.dispatchEvent(t),this},n.prototype.disconnect=function(t){return this.dispatchEvent({type:"disconnected",data:t}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this},n.prototype.getAxes=function(){return this._axes},n.prototype.update=function(t,e,r){var o=null,s=null,u=null,l=this._targetRay,c=this._grip,p=this._hand;if(t&&t.gamepad&&t.gamepad.axes&&(this._axes=[t.gamepad.axes[2],t.gamepad.axes[3]]),t&&e.session.visibilityState!=="visible-blurred")if(l!==null&&(o=e.getPose(t.targetRaySpace,r),o!==null&&(l.matrix.fromArray(o.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),o.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(o.linearVelocity)):l.hasLinearVelocity=!1,o.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(o.angularVelocity)):l.hasAngularVelocity=!1,this.dispatchEvent(_moveEvent))),p&&t.hand){u=!0;for(var f=0,d=t.hand.values();f<d.length;f++){var h=d[f],g=e.getJointPose(h,r);if(p.joints[h.jointName]===void 0){var A=new THREE__namespace.Group;A.matrixAutoUpdate=!1,A.visible=!1,p.joints[h.jointName]=A,p.add(A)}var m=p.joints[h.jointName];g!==null&&(m.matrix.fromArray(g.transform.matrix),m.matrix.decompose(m.position,m.rotation,m.scale),m.jointRadius=g.radius),m.visible=g!==null}var E=p.joints["index-finger-tip"],v=p.joints["thumb-tip"],y=E.position.distanceTo(v.position),b=.02,T=.005;p.inputState.pinching&&y>b+T?(p.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!p.inputState.pinching&&y<=b-T&&(p.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else c!==null&&t.gripSpace&&(s=e.getPose(t.gripSpace,r),s!==null&&(c.matrix.fromArray(s.transform.matrix),c.matrix.decompose(c.position,c.rotation,c.scale),s.linearVelocity?(c.hasLinearVelocity=!0,c.linearVelocity.copy(s.linearVelocity)):c.hasLinearVelocity=!1,s.angularVelocity?(c.hasAngularVelocity=!0,c.angularVelocity.copy(s.angularVelocity)):c.hasAngularVelocity=!1));return l!==null&&(l.visible=o!==null),c!==null&&(c.visible=s!==null),p!==null&&(p.visible=u!==null),this},n}(),framebufferScaleFactor=1,isAppleVisionPro=function(){try{var n=/Macintosh/i.test(navigator.userAgent),t=navigator.maxTouchPoints===5;return n&&t}catch(e){return console.error("Error determining if the device is an Apple Vision Pro: ",e),!1}},isOculus=function(){try{return/Oculus/i.test(navigator.userAgent)}catch(n){return console.error("Error determining if the device is an Oculus: ",n),!1}},XRManager=function(){function n(t,e,r){var o,s,u,l,c;this.isPanorama=(o=r==null?void 0:r.isPanorama)!==null&&o!==void 0?o:!0,navigator.userAgent.toLowerCase();var p;isAppleVisionPro()?p="VP":isOculus()?p="Oculus":p="Pico",this.machineType=(s=r==null?void 0:r.machineType)!==null&&s!==void 0?s:p,this.renderer=t,this.gl=e,this.enabled=!1,this.session=null,this.referenceSpaceType=(u=r==null?void 0:r.referenceSpaceType)!==null&&u!==void 0?u:"local-floor",this.referenceSpace=null,this.onSessionStartCallback=(l=r==null?void 0:r.onSessionStart)!==null&&l!==void 0?l:noop$1,this.onSessionEndCallback=(c=r==null?void 0:r.onSessionEnd)!==null&&c!==void 0?c:noop$1,this.controllers=[new XRController,new XRController],this.inputSourcesMap=new Map,this.cameraVR=new THREE__namespace.ArrayCamera,this.cameraL=new THREE__namespace.PerspectiveCamera,this.cameraR=new THREE__namespace.PerspectiveCamera,this.cameraL.viewport=new THREE__namespace.Vector4,this.cameraR.viewport=new THREE__namespace.Vector4,this.cameraL.layers.enable(1),this.cameraR.layers.enable(2),this.cameraVR.layers.enable(1),this.cameraVR.layers.enable(2),this.isPresenting=!1,this.currentDepthNear=null,this.currentDepthFar=null,this.cameraLPos=new THREE__namespace.Vector3,this.cameraRPos=new THREE__namespace.Vector3}return n.prototype.getController=function(t){var e=this.controllers[t];return e||console.warn("no controller find"),e.getTargetRaySpace()},n.prototype.getRightController=function(){if(!this.session)return null;var t=this.session.inputSources[0].handedness==="right"?0:1,e=this.controllers[t];return e||console.warn("no controller find"),e.getTargetRaySpace()},n.prototype.getLeftController=function(){if(!this.session)return null;var t=this.session.inputSources[0].handedness==="left"?0:1,e=this.controllers[t];return e||console.warn("no controller find"),e.getTargetRaySpace()},n.prototype.getControllerGrip=function(t){var e=this.controllers[t];return e||console.warn("no controller find"),e.getGripSpace()},n.prototype.getCameras=function(){return{cameraL:this.cameraL,cameraR:this.cameraR,cameraVR:this.cameraVR}},n.prototype.updateCamera=function(t,e){e===null?t.matrixWorld.copy(t.matrix):t.matrixWorld.multiplyMatrices(e.matrixWorld,t.matrix),t.matrixWorldInverse.getInverse(t.matrixWorld)},n.prototype.setProjectionFromUnion=function(t,e,r){this.cameraLPos.setFromMatrixPosition(e.matrixWorld),this.cameraRPos.setFromMatrixPosition(r.matrixWorld);var o=this.cameraLPos.distanceTo(this.cameraRPos),s=e.projectionMatrix.elements,u=r.projectionMatrix.elements,l=s[14]/(s[10]-1),c=s[14]/(s[10]+1),p=(s[9]+1)/s[5],f=(s[9]-1)/s[5],d=(s[8]-1)/s[0],h=(u[8]+1)/u[0],g=l*d,A=l*h,m=o/(-d+h),E=m*-d;e.matrixWorld.decompose(t.position,t.quaternion,t.scale),t.translateX(E),t.translateZ(m),t.matrixWorld.compose(t.position,t.quaternion,t.scale),t.matrixWorldInverse.getInverse(t.matrixWorld);var v=l+m,y=c+m,b=g-E,T=A+(o-E),_=p*c/y*v,S=f*c/y*v;t.projectionMatrix.makePerspective(b,T,_,S,v,y)},n.prototype.getCamera=function(t){this.cameraVR.near=this.cameraR.near=this.cameraL.near=t.near,this.cameraVR.far=this.cameraR.far=this.cameraL.far=t.far,this.session&&(this.currentDepthNear!==this.cameraVR.near||this.currentDepthFar!==this.cameraVR.far)&&(this.session.updateRenderState({depthNear:this.cameraVR.near,depthFar:this.cameraVR.far}),this.currentDepthNear=this.cameraVR.near,this.currentDepthFar=this.cameraVR.far);var e=t.parent,r=this.cameraVR.cameras;this.updateCamera(this.cameraVR,e);for(var o=0;o<r.length;o++)this.updateCamera(r[o],e);t.matrixWorld.copy(this.cameraVR.matrixWorld);for(var s=t.children,o=0,u=s.length;o<u;o++)s[o].updateMatrixWorld(!0);return r.length===2?this.setProjectionFromUnion(this.cameraVR,this.cameraL,this.cameraR):this.cameraVR.projectionMatrix.copy(this.cameraL.projectionMatrix),this.cameraVR},n.prototype.updateInputSources=function(t){if(!this.session){console.warn("session is lose!");return}for(var e=this.session.inputSources,r=0;r<this.controllers.length;r++)this.inputSourcesMap.set(e[r],this.controllers[r]);for(var r=0;r<t.removed.length;r++){var o=t.removed[r],s=this.inputSourcesMap.get(o);s&&(s.dispatchEvent({type:"disconnected",data:o}),this.inputSourcesMap.delete(o))}for(var r=0;r<t.added.length;r++){var o=t.added[r],s=this.inputSourcesMap.get(o);s&&s.dispatchEvent({type:"connected",data:o})}},n.prototype.onSessionEvent=function(t){var e=this.inputSourcesMap.get(t.inputSource);e&&e.dispatchEvent({type:t.type})},n.prototype.onSessionEnd=function(){this.inputSourcesMap.forEach(function(t,e){t.disconnect(e)}),this.inputSourcesMap.clear(),this.renderer.setFramebuffer(null),this.renderer.setRenderTarget(this.renderer.getRenderTarget()),this.isPresenting=!1,this.session=null,AnimationFrameLoop.shared.setContext(null),this.onSessionEndCallback()},n.prototype.onRequestReferenceSpace=function(t){this.referenceSpace=t,this.isPresenting=!0,this.session&&this.onSessionStartCallback(this.session)},n.prototype.setSession=function(t){var e=this;if(this.session=t,this.session){this.session.addEventListener("select",function(o){e.onSessionEvent(o)}),this.session.addEventListener("selectstart",function(o){e.onSessionEvent(o)}),this.session.addEventListener("selectend",function(o){e.onSessionEvent(o)}),this.session.addEventListener("squeeze",function(o){e.onSessionEvent(o)}),this.session.addEventListener("squeezestart",function(o){e.onSessionEvent(o)}),this.session.addEventListener("squeezeend",function(o){e.onSessionEvent(o)}),this.session.addEventListener("end",function(o){e.onSessionEnd()});var r=this.gl.getContextAttributes();this.gl.makeXRCompatible().then(function(){var o={antialias:r==null?void 0:r.antialias,alpha:r==null?void 0:r.alpha,depth:r==null?void 0:r.depth,stencil:r==null?void 0:r.stencil,framebufferScaleFactor};if(!e.session){console.error("session is lose while set session!");return}switch(e.machineType){case"Pico":case"VP":e.session.updateRenderState({baseLayer:new XRWebGLLayer(e.session,e.gl,o)});break;case"Oculus":e.session.updateRenderState({baseLayer:new XRWebGLLayer(e.session,e.gl,o)});break;default:e.machineType;break}e.session.requestReferenceSpace(e.referenceSpaceType).then(function(s){e.onRequestReferenceSpace(s)}),e.session.addEventListener("inputsourceschange",function(s){e.updateInputSources(s)})})}},n}(),LineSegmentsGeometry=function(n){__extends(t,n);function t(){var e=n.call(this)||this;e.type="LineSegmentsGeometry";var r=[-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],o=[-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],s=[0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5];return e.setIndex(s),e.setAttribute("position",new THREE__namespace.Float32BufferAttribute(r,3)),e.setAttribute("uv",new THREE__namespace.Float32BufferAttribute(o,2)),e}return t.prototype.applyMatrix4=function(e){var r=this.attributes.instanceStart,o=this.attributes.instanceEnd;return r!==void 0&&(r.applyMatrix4(e),o.applyMatrix4(e),r.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this},t.prototype.setPositions=function(e){var r;e instanceof Float32Array?r=e:Array.isArray(e)?r=new Float32Array(e):r=new Float32Array;var o=new THREE__namespace.InstancedInterleavedBuffer(r,6,1);return this.setAttribute("instanceStart",new THREE__namespace.InterleavedBufferAttribute(o,3,0)),this.setAttribute("instanceEnd",new THREE__namespace.InterleavedBufferAttribute(o,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this},t.prototype.setColors=function(e){var r;e instanceof Float32Array?r=e:Array.isArray(e)?r=new Float32Array(e):r=new Float32Array;var o=new THREE__namespace.InstancedInterleavedBuffer(r,6,1);return this.setAttribute("instanceColorStart",new THREE__namespace.InterleavedBufferAttribute(o,3,0)),this.setAttribute("instanceColorEnd",new THREE__namespace.InterleavedBufferAttribute(o,3,3)),this},t.prototype.fromWireframeGeometry=function(e){return this.setPositions(e.attributes.position.array),this},t.prototype.fromEdgesGeometry=function(e){return this.setPositions(e.attributes.position.array),this},t.prototype.fromMesh=function(e){return this.fromWireframeGeometry(new THREE__namespace.WireframeGeometry(e.geometry)),this},t.prototype.fromLineSegments=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.computeBoundingBox=function(){this.boundingBox===null&&(this.boundingBox=new THREE__namespace.Box3);var e=this.attributes.instanceStart,r=this.attributes.instanceEnd;if(e!==void 0&&r!==void 0){var o=new THREE__namespace.Box3;this.boundingBox.setFromBufferAttribute(e),o.setFromBufferAttribute(r),this.boundingBox.union(o)}},t.prototype.computeBoundingSphere=function(){this.boundingSphere===null&&(this.boundingSphere=new THREE__namespace.Sphere),this.boundingBox===null&&this.computeBoundingBox();var e=this.attributes.instanceStart,r=this.attributes.instanceEnd;if(e!==void 0&&r!==void 0){var o=this.boundingSphere.center;this.boundingBox.getCenter(o);for(var s=0,u=new THREE__namespace.Vector3,l=0,c=e.count;l<c;l++)u.fromBufferAttribute(e,l),s=Math.max(s,o.distanceToSquared(u)),u.fromBufferAttribute(r,l),s=Math.max(s,o.distanceToSquared(u));this.boundingSphere.radius=Math.sqrt(s),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}},t.prototype.toJSON=function(){},t}(THREE__namespace.InstancedBufferGeometry);Object.assign(LineSegmentsGeometry.prototype,{isLineSegmentsGeometry:!0});var lineShader={uniforms:THREE__namespace.UniformsUtils.merge([THREE__namespace.UniformsLib.common,THREE__namespace.UniformsLib.fog,{linewidth:{value:1},resolution:{value:new THREE__namespace.Vector2(1,1)},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1},opacity:{value:1}}]),vertexShader:`
|
|
1933
1933
|
#include <common>
|
|
1934
1934
|
#include <color_pars_vertex>
|
|
1935
1935
|
#include <fog_pars_vertex>
|
|
@@ -2128,7 +2128,7 @@ void main() {
|
|
|
2128
2128
|
#include <premultiplied_alpha_fragment>
|
|
2129
2129
|
|
|
2130
2130
|
}
|
|
2131
|
-
`},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,p=0,f=r.count;c<f;c++,p+=2)u.fromBufferAttribute(r,c),l.fromBufferAttribute(o,c),s[p]=p===0?0:s[p-1],s[p+1]=s[p]+u.distanceTo(l);var d=new THREE__namespace.InstancedInterleavedBuffer(s,2,1);return e.setAttribute("instanceDistanceStart",new THREE__namespace.InterleavedBufferAttribute(d,1,0)),e.setAttribute("instanceDistanceEnd",new THREE__namespace.InterleavedBufferAttribute(d,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,p=c.resolution,f=c.linewidth,d=l.attributes.instanceStart,h=l.attributes.instanceEnd,g=new THREE__namespace.Vector4,A=new THREE__namespace.Vector4,m=new THREE__namespace.Vector4,E=new THREE__namespace.Vector3,v=new THREE__namespace.Matrix4,y=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*=p.x/2,m.y*=p.y/2,m.z=0,E.copy(m);var T=this.matrixWorld;v.multiplyMatrices(s.matrixWorldInverse,T);for(var _=0,S=d.count;_<S;_++){g.fromBufferAttribute(d,_),A.fromBufferAttribute(h,_),g.w=1,A.w=1,g.applyMatrix4(v),A.applyMatrix4(v),g.applyMatrix4(u),A.applyMatrix4(u),g.multiplyScalar(1/g.w),A.multiplyScalar(1/A.w);var R=g.z<-1&&A.z<-1,M=g.z>1&&A.z>1;if(!(R||M)){g.x*=p.x/2,g.y*=p.y/2,A.x*=p.x/2,A.y*=p.y/2,y.start.copy(g),y.start.z=0,y.end.copy(A),y.end.z=0;var H=y.closestPointToPointParameter(E,!0);y.at(H,b);var B=THREE__namespace.MathUtils.lerp(g.z,A.z,H),C=B>=-1&&B<=1,w=E.distanceTo(b)<f*.5;if(C&&w){y.start.fromBufferAttribute(d,_),y.end.fromBufferAttribute(h,_),y.start.applyMatrix4(T),y.end.applyMatrix4(T);var I=new THREE__namespace.Vector3,O=new THREE__namespace.Vector3;o.distanceSqToSegment(y.start,y.end,O,I),r.push({point:O,pointOnLine:I,distance:o.origin.distanceTo(O),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/RCPxxclSSroVzRFUbSDg4P848ePFwH8DuAhkWih83TRQWxFOXgAwvDwcOfo6OhvXV1d39tsNtuVBwTDWBwOh1UUxVsMw1hXVlbSdCgNV43uYSvrHg6H24aHh38eHBz85TrgF9FYLHA4HLzH43FvbW2d7u/vG+dANp8FpqIlbd3d3V8Fg8EfB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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.5.1"},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,p,f,d;return o===void 0&&(o=null),s===void 0&&(s=!0),__generator(this,function(h){switch(h.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=h.sent(),e.profiles.some(function(g){var A=u[g];return A&&(l={profileId:g,profilePath:"".concat(r,"/").concat(A.path),deprecated:!!A.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(p=h.sent(),s){if(d=void 0,d=p.layouts[e.handedness],!d)throw new Error("No matching handedness, ".concat(e.handedness,", in profile ").concat(l.profileId));d.assetPath&&(f=l.profilePath.replace("profile.json",d.assetPath))}return[2,{profile:p,assetPath:f}]}})})}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,p=o.valueNodeProperty;s&&(p===Constants.VisualResponseProperty.VISIBILITY?s.visible=c:p===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(p){var f=p.valueNodeName,d=p.minNodeName,h=p.maxNodeName,g=p.valueNodeProperty;if(g===Constants.VisualResponseProperty.TRANSFORM){if(p.minNode=t.getObjectByName(d),p.maxNode=t.getObjectByName(h),!p.minNode){console.warn("Could not find ".concat(d," in the model"));return}if(!p.maxNode){console.warn("Could not find ".concat(h," in the model"));return}}p.valueNode=t.getObjectByName(f),p.valueNode||console.warn("Could not find ".concat(f," 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,p=l.assetPath;r.motionController=new MotionController(u,c,p);var f=e._assetCache[r.motionController.assetUrl];if(f)o=f.scene.clone(),addAssetSceneToControllerModel(r,o);else{if(!e.gltfLoader)throw new Error("GLTFLoader not set.");e.gltfLoader.load(r.motionController.assetUrl,function(d){e._assetCache[r.motionController.assetUrl]=d,o=d.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}(),defaultXRPanoramaControllerInitArgs=__assign({},omit(defaultPanoramaControllerCustomInitArgs,["maxLatitude","minLatitude"]));function mapPanoResource(n,t){return n}var CONTROLLER_EVNET_DELTA_TIME=300,scratchRaycaster=new THREE__namespace.Raycaster,scratchVector3=new THREE__namespace.Vector3,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,p){internalFetcher.ajax(c,{responseType:"arraybuffer"}).then(function(f){var d;return parseGltf(f.body,{resourcePath:c.slice(0,c.lastIndexOf("/")+1),search:(d=c.split("?")[1])!==null&&d!==void 0?d:"",fetcher:internalFetcher})}).then(function(f){return p(f)})}},(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 p=r.xrManager.getControllerGrip(1);p.add(u.createControllerModel(p)),r.controllerWrappers[1].add(p)}),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.updateConfiguration=function(e){return n.prototype.updateConfiguration.call(this,__assign(__assign({},e),{maxLatitude:Math.PI/2,minLatitude:-Math.PI/2}))},t.prototype.moveToPano=function(e,r,o){var s=this,u,l,c,p,f=(u=r.effect)!==null&&u!==void 0?u:"fade";this.userAction=o,this.stopMomentumMovement();var d=this.works.getResolvedObserver(e);if(!d)throw new Error("Invalid PanoIndex");var h=getImageSizeFromURL(d.images.up),g=this.imageOptions.size;typeof g=="undefined"&&d&&h&&(g=Number(h)),typeof g=="undefined"&&(g=2048);var A=this.imageOptions.transform,m=function(B,C){return mapPanoResource(applyImageURLOptions(B,A,C))},E=__assign({key:"pano.".concat(d.panoId)},pick(this.imageOptions,["format","size","quality"])),v=d.images;c=(l=d.images.tiles)===null||l===void 0?void 0:l.filter(function(B){return B.size>g});var y="pano:"+jsonHash([v,E,A]);if(this.pendingTextureTask){if(this.pendingTextureTask.hash===y)return;var b=this.pendingTextureTask.panoId;(p=this.panoMeshes[b])===null||p===void 0||p.setProgress(0),this.emit("pano.texture.abort",createEvent("pano.texture.abort",{error:null,progress:0,meta:null,pano:d.pano}))}var T=this.modelScene.parameter.resolveValue(),_=T.pano0,S=T.pano1,R;if((_==null?void 0:_.map.name)===y?R=_:(S==null?void 0:S.map.name)===y&&(R=S),R){var M={panoId:d.panoId,effect:f,leftPanoPicture:{panoId:R.panoId,map:R.map,mapSize:R.mapSize,matrix:d.matrix.clone(),zoom:1},position:d.position.clone(),fixCameraTransform:new THREE__namespace.Matrix4};this.doMoveToPano(d.pano,M,r);return}var H="move-to-pano-"+d.panoId;this.pending.add(H),this.pendingTextureTask={panoId:d.panoId,hash:y,onLoad:function(B){var C;s.pending.delete(H);var w=B.body;if(s.destroyed)w.dispose();else{w.name=y;var I=Array.isArray(w.image)?w.image[0]:w.image,O=(C=I==null?void 0:I.width)!==null&&C!==void 0?C:2048,L={panoId:d.panoId,effect:f,leftPanoPicture:{panoId:d.panoId,map:w,mapSize:O,matrix:d.matrix.clone(),zoom:1},position:d.position.clone(),fixCameraTransform:new THREE__namespace.Matrix4};s.doMoveToPano(d.pano,L,r)}},onError:function(B){s.pending.delete(H);var C=__assign(__assign(__assign({},d.pano),{mode:s.mode}),clonePose(s.camera.pose));s.emit("pano.error",createEvent("pano.error",{error:B,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()}},this.textureLoader.loadCubeTexture(v,{imageURL:{transform:m,options:E},format:THREE__namespace.RGBAFormat,fetcher:getFetcher(d.work)},void 0,void 0,function(B){var C,w;((C=s.pendingTextureTask)===null||C===void 0?void 0:C.hash)===y&&((w=s.panoMeshes[d.panoId])===null||w===void 0||w.setProgress(B)),s.emit("pano.texture.progress",createEvent("pano.texture.progress",{error:null,progress:B,meta:null,pano:d.pano}))},this.renderer).then(function(B){var C,w;((C=s.pendingTextureTask)===null||C===void 0?void 0:C.hash)===y?(s.pendingTextureTask.onLoad(B),(w=s.panoMeshes[d.panoId])===null||w===void 0||w.setProgress(0),delete s.pendingTextureTask,s.emit("pano.texture.success",createEvent("pano.texture.success",{error:null,progress:1,meta:B.meta,pano:d.pano}))):B.body.dispose()}).catch(function(B){var C,w;((C=s.pendingTextureTask)===null||C===void 0?void 0:C.hash)===y&&(s.pendingTextureTask.onError(B),(w=s.panoMeshes[d.panoId])===null||w===void 0||w.setProgress(0),delete s.pendingTextureTask,s.emit("pano.texture.error",createEvent("pano.texture.error",{error:B,progress:0,meta:null,pano:d.pano})),s.emit("error",B))}),this.emit("pano.texture.load",createEvent("pano.texture.load",{error:null,progress:0,meta:null,pano:d.pano}))},t.prototype.doMoveToPano=function(e,r,o){var s=this,u,l,c,p,f,d,h,g,A,m;o===void 0&&(o={});var E=now(),v=createUuid();this.panoResources[v]=r;var y=1,b,T,_;if(this.locationMotion.ended){var S=this.locationMotion.getKeyFrameSegment(E);S[0];var R=S[1],M=this.locationMotion.value,H=this.panoResourceFromLocationMotionKeyframe(R).position,B=r.position;b=Math.max(H.distanceTo(B),y),T=[{key:R.key,progress:0,value:__assign(__assign({},M),{count:0})},{key:v,progress:1,value:{distance:0,count:1}}],_=0}else{var C=this.locationMotion.getKeyFrameSegment(E),w=C[0],R=C[1],M=this.locationMotion.value,I=this.panoResourceFromLocationMotionKeyframe(w).position,H=this.panoResourceFromLocationMotionKeyframe(R).position,B=r.position,O=R.value.count-M.count,L=Math.max(I.distanceTo(H),y)*O,N=Math.max(H.distanceTo(B),y);b=L+N,T=[{key:w.key,progress:0,value:__assign({},M)},{key:R.key,progress:L/b,value:R.value},{key:v,progress:1,value:{count:R.value.count+1,distance:0}}];var z=this.locationMotionKeyframesLength(this.locationMotion.keyframes),J=this.locationMotionKeyframesLength(T);_=this.locationMotion.getProgressVelocity(E)*z/J}var K=r.effect==="instant"?0:this.calculateMovingDuration(o.duration,r.effect==="fly"?b:0),Q={longitude:o.longitude,latitude:o.latitude,fov:o.fov},U=__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}),q=this.currentPano;if(this.emit("pano.moveTo",createEvent("pano.moveTo",{options:o,prevPano:q,progress:0,state:U,userAction:this.userAction,error:null})),o.moveStartCallback&&o.moveStartCallback(U),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,K).catch(noop$1);else{var X=coordinatesToVector({longitude:this.cameraMotion.value.longitude,latitude:this.cameraMotion.value.latitude}),Z=coordinatesToVector({longitude:(p=Q.longitude)!==null&&p!==void 0?p:this.cameraMotion.value.longitude,latitude:(f=Q.latitude)!==null&&f!==void 0?f:this.cameraMotion.value.latitude}),W=new THREE__namespace.Object3D;W.lookAt(X);var G=new THREE__namespace.Matrix4().makeRotationFromQuaternion(W.quaternion);W.lookAt(Z);var ne=new THREE__namespace.Matrix4().makeRotationFromQuaternion(W.quaternion),$=new THREE__namespace.Matrix4().getInverse(G).premultiply(ne),ee=this.cameraMotion.value.fov,re=(d=Q.fov)!==null&&d!==void 0?d:this.cameraMotion.value.fov,le=1;r.effect==="zoomin"?le=1.5:r.effect==="zoomout"&&(le=.4);for(var ae=re*le,oe=0;oe<T.length-1;oe++){var se=T[oe].key;if(se){var pe=this.panoResources[se];pe&&(pe.fixCameraTransform.copy($),pe.leftPanoPicture&&(pe.leftPanoPicture.zoom=Math.tan(ae/2/180*Math.PI)/Math.tan(ee/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:(h=Q.longitude)!==null&&h!==void 0?h:this.cameraMotion.value.longitude,latitude:(g=Q.latitude)!==null&&g!==void 0?g:this.cameraMotion.value.latitude,fov:ae}},{progress:1,value:{longitude:(A=Q.longitude)!==null&&A!==void 0?A:this.cameraMotion.value.longitude,latitude:(m=Q.latitude)!==null&&m!==void 0?m:this.cameraMotion.value.latitude,fov:re}}],K).catch(noop$1)}var de=this.locationMotion.setKeyframes(T,K,_);de.then(function(){for(var xe=0,ce=s.modelScene.children;xe<ce.length;xe++){var Re=ce[xe];Re instanceof Model&&Re.show()}var j=__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:j,userAction:s.userAction,error:null})),o.moveEndCallback&&o.moveEndCallback(j);var te=s.works.getResolvedObserver(s.currentPano);if(te&&te.video&&s.videoTexture&&s.videoTexture.image instanceof HTMLVideoElement){var V={map:s.videoTexture,size:te.video.size,matrix:te.video.matrix,panoMatrix:te.matrix,alpha:1},be=createUuid(),fe=s.videoTexture.image;fe.setAttribute("uuid",be),canplayVideo().then(function(ve){ve&&te.video&&fe.getAttribute("uuid")===be&&(fe.oncanplay=function(){fe.oncanplay=noop$1,fe.play()},fe.ontimeupdate=function(){fe.currentTime>.5&&(fe.ontimeupdate=noop$1,s.panoVideo.setMaterial(V))},fe.src=te.video.source)}).catch(function(){fe.removeAttribute("uuid")})}},function(){s.emit("pano.cancel",createEvent("pano.cancel",{options:o,prevPano:q,progress:0,state:U,userAction:s.userAction,error:null})),o.moveCancelCallback&&o.moveCancelCallback()})},t.prototype.checkSelectedPano=function(e){var r=this,o;this.stopMomentumMovement(),this.camera.getDirection(new THREE__namespace.Vector3).setY(0);var s=null,u=this.works.getResolvedObserver(this.currentPano);if(!u)return null;var l=u.accessibleIds.filter(function(b){var T=panoParse(b);if(panoEqual(T,r.currentPano))return!1;var _=r.works.getResolvedObserver(T);return!_||_.position.distanceTo(r.camera.position)>r.maxAccessibleDistance?!1:_.loadable||_.active}),c=this.modelScene.intersectRaycaster(e)[0];if(c){var p=arrayMin(l,function(b){var T=r.works.getResolvedObserver(b);if(!T)return 1/0;var _=T.standingPosition.clone();return _.distanceTo(c.point)},!0),f=p[0],d=p[1];f&&d<this.panoTapTriggerRadius&&(s=(o=this.works.getResolvedObserver(f))!==null&&o!==void 0?o:null)}if(isNil(s)){var h=this.getForwardObserverOrNot(e);h&&(s=h)}for(var g=0,A=this.locationMotion.keyframes;g<A.length;g++){var m=A[g],E=this.panoResourceFromLocationMotionKeyframe(m);if(!(m.progress<this.locationMotion.progress)&&s&&E.panoId===s.panoId){s=null;break}}if(isNil(s))return this.locationMotion.ended===!0&&this.cameraBounce(),null;if(!s.active){var v=s.panoId;this.panoMeshes[v]&&(this.panoMeshes[v].setDisabled(!1),this.panoMeshes[v].setLoading(!0))}var y={workCode:s.pano.workCode,panoIndex:s.pano.panoIndex,mode:this.mode,longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude,fov:this.camera.pose.fov,distance:0,offset:s?s.position.clone():new THREE__namespace.Vector3};return this.emit("pano.select",createEvent("pano.select",{prevPano:this.currentPano,state:y,userAction:!0,options:{},progress:0,error:null})),s&&s.active?(this.emit("pano.request",createEvent("pano.request",{userAction:!0,prevPano:this.currentPano,progress:0,state:y,options:{},error:null})),s.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,p,f,d,h=[],g=2;g<arguments.length;g++)h[g-2]=arguments[g];this.userAction=!0;var A={},m={},E=this.locationMotion.keyframes[0],v=this.locationMotion.keyframes[this.locationMotion.keyframes.length-1],y=this.locationMotion.getKeyFrameSegment(e),b=y[0],T=y[1];this.panoResourceFromLocationMotionKeyframe(b);var _=this.panoResourceFromLocationMotionKeyframe(T),S=this.panoResourceFromLocationMotionKeyframe(E),R=this.panoResourceFromLocationMotionKeyframe(v),M=!1;if(this.cameraMotion.ended===!1&&(this.cameraMotion.update(e),m.longitude=this.cameraMotion.value.longitude,m.latitude=this.cameraMotion.value.latitude,m.fov=this.cameraMotion.value.fov),this.modelAlphaMotion.ended===!1&&(this.modelAlphaMotion.update(e),A.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 H=this.locationMotion.getKeyFrameSegment(e),B=H[0],C=H[1],w=this.panoResourceFromLocationMotionKeyframe(B),I=this.panoResourceFromLocationMotionKeyframe(C),O=new THREE__namespace.Vector3().copy(w.position),L=new THREE__namespace.Vector3().copy(I.position),N=this.locationMotion.value.count-C.value.count+1;if(A.progress=N,I.leftPanoPicture&&(N<1?w.leftPanoPicture&&(A.pano0=w.leftPanoPicture):A.pano0=I.leftPanoPicture,A.pano1=I.leftPanoPicture),I.effect==="montage"?A.transition="BLACK":I.effect==="spread"?A.transition="SPREAD":A.transition="FADE",(I.effect==="zoomin"||I.effect==="zoomout")&&(A.progress=Math.pow(N,3)),N<1&&I.effect!=="fly"){if(A.pano0&&w.leftPanoPicture){var z={panoId:A.pano0.panoId,map:A.pano0.map,mapSize:A.pano0.mapSize,zoom:A.pano0.zoom,matrix:w.leftPanoPicture.matrix.clone().setPosition(I.position)},J=this.panoPictureObserverMap.get(A.pano0);J&&this.panoPictureObserverMap.set(z,J),A.pano0=z}O.copy(L),M=!0}m.distance=this.locationMotion.value.distance,m.offset=new THREE__namespace.Vector3(O.x+(L.x-O.x)*N,O.y+(L.y-O.y)*N,O.z+(L.z-O.z)*N);for(var K=[],Q=[],U=0,q=this.locationMotion.keyframes;U<q.length;U++){var X=q[U],Z=X.key,W=X.progress;Z!==void 0&&(K.push(Z),W>this.locationMotion.progress&&Q.push(Z))}for(var G=0,ne=Object.keys(this.panoResources);G<ne.length;G++){var $=ne[G];if(!(Q.indexOf($)>=0)){var ee=this.panoResources[$];if(ee.leftPanoPicture){var re=ee.leftPanoPicture.map;if(re){if(re===((s=A.pano0)===null||s===void 0?void 0:s.map)||re===((u=A.pano1)===null||u===void 0?void 0:u.map))continue;re.dispose(),ee.leftPanoPicture=null}}K.indexOf($)>=0||delete this.panoResources[$]}}var le=panoParse(I.panoId);le!==this.currentPano&&(this.currentPano=le,this.accessibleObserverFloorCheckCount=0),this.emit("pano.moving",createEvent("pano.moving",{userAction:this.userAction,prevPano:panoParse(S.panoId),state:__assign(__assign(__assign(__assign({},panoParse(R.panoId)),{mode:this.mode}),clonePose(this.camera.pose)),m),options:{},progress:this.locationMotion.progress,error:null}))}isEmptyObject(A)===!1&&this.modelScene.parameter.set(A),isEmptyObject(m)===!1&&this.setCamera(m);var ae=this.works.getResolvedObserver(this.currentPano),oe=h[1];if(!oe){console.error("xrFrame丢失,请重试");return}if(!this.xrManager.session){console.error("session丢失,请重试");return}var se=this.xrManager.referenceSpace;if(se){var pe=this.xrManager.cameraVR,de=this.xrManager.cameraL,xe=this.xrManager.cameraR,ce=[de,xe],Re=oe.getViewerPose(se),j=new THREE__namespace.Vector3(0,0,0);if(Re){var te;te=this.xrManager.session.renderState.baseLayer;var V=Re.views;if(!te){console.error("no layer found");return}this.renderer.setFramebuffer(te.framebuffer);var be=!1;V.length!==pe.cameras.length&&(pe.cameras.length=0,be=!0),this.parallaxCameraMatrixs=[];var fe=new THREE__namespace.Vector3,ve=new THREE__namespace.Vector3;new THREE__namespace.Matrix4().fromArray(V[0].transform.matrix).decompose(fe,new THREE__namespace.Quaternion,new THREE__namespace.Vector3),new THREE__namespace.Matrix4().fromArray(V[1].transform.matrix).decompose(ve,new THREE__namespace.Quaternion,new THREE__namespace.Vector3),ve.clone().sub(fe).normalize();var Ve=new THREE__namespace.Vector3,rt=new THREE__namespace.Quaternion,We=new THREE__namespace.Vector3;this.camera.matrix.decompose(Ve,rt,We);for(var me=0;me<V.length;me++){var ie=V[me],he=te.getViewport(ie),Ce=ce[me];Ce.matrix.fromArray(ie.transform.matrix);var _e=new THREE__namespace.Vector3,Ie=new THREE__namespace.Quaternion,Fe=new THREE__namespace.Vector3;Ce.matrix.decompose(_e,Ie,Fe),j.copy(Ve),Ce.position.copy(Ve),Ce.quaternion.copy(Ie),Ce.scale.copy(Fe),Ce.updateMatrix(),Ce.projectionMatrix.fromArray(ie.projectionMatrix),Ce.viewport.set(he.x,he.y,he.width,he.height),be===!0&&pe.cameras.push(Ce)}if(this.xrManager.session&&this.xrManager.session.inputSources){for(var me=0;me<this.xrManager.session.inputSources.length;me++)if(this.xrManager.session.inputSources[me]&&this.xrManager.session.inputSources[me].targetRayMode==="transient-pointer"){var Ae=oe.getPose(this.xrManager.session.inputSources[me].targetRaySpace,se);if(Ae){var Te=new THREE__namespace.Vector3(0,0,-1).applyQuaternion(Ae.transform.orientation),we=new THREE__namespace.Raycaster(this.camera.position,Te);this.gazeRay=we}}}if(this.xrManager.machineType==="Oculus"||this.xrManager.machineType==="Pico"){for(var Pe=this.xrManager.session.inputSources,me=0;me<Pe.length;me++){var qe=this.xrManager.controllers[me],ke=Pe[me];if(ke){qe&&qe.update(ke,oe,se);var we=this.xrManager.getController(me),Ne=new THREE__namespace.Vector3(0,1.2,0),Le=we.position.clone().add(j).sub(Ne);ke.handedness==="left"?this.xrControllerRay.left.set(Le,new THREE__namespace.Vector3(0,0,-1).applyEuler(we.rotation)):ke.handedness==="right"&&this.xrControllerRay.right.set(Le,new THREE__namespace.Vector3(0,0,-1).applyEuler(we.rotation)),this.controllerWrappers[me].position.copy(new THREE__namespace.Vector3(0,0,0).add(j).sub(Ne));var Ue=this.modelScene.intersectRaycaster(this.xrControllerRay.right);if(Ue.length===0&&(Ue=this.xrControllerRay.right.intersectObject(this.boundingMesh,!0).map(function(F){var k;return __assign({floor:(k=ae==null?void 0:ae.floorIndex)!==null&&k!==void 0?k:0},F)})),Ue.length>=1&&Ue[0].face)if(ke.handedness==="right"){var ze=this.xrControllerRay.right.intersectObject(this.xrCustomObjectsScene,!0),je=Ue[0].face.normal,Se=je.clone(),Oe=Ue[0].point.clone();this.intersectMesh.position.copy(Oe);var Me=Oe.clone().add(Se);if(this.intersectMesh.lookAt(Me),Math.abs(je.y)>.99){var He=this.camera.position.clone().sub(Oe);this.intersectMesh.rotation.z=-Math.atan2(He.z,He.x)}this.intersectMesh.visible=!0,this.needsRender=!0,ze.length>0?(this.pointerLines.right.setPoints(Le,ze[0].point),this.pointerLines.right.points.visible=!0,this.intersectMesh.visible=!1):(this.pointerLines.right.points.visible=!1,this.pointerLines.right.setPoints(Le,Ue[0].point));var Be=Ue[0],Ge=createEvent("intersect.update",{raycaster:(l=this.xrControllerRay.right)!==null&&l!==void 0?l:null,intersection:Be!=null?Be:null,object:this.intersectMesh});if(this.emit("intersect.update",Ge),Ge.defaultPrevented){this.hideIntersectMesh();return}}else this.pointerLines.left.setPoints(Le,Ue[0].point)}}this.updateControllerHelper(Pe,e,r)}if(this.camera.pose.distance>.1||M)for(var Ze=0,Ye=Object.keys(this.panoMeshes);Ze<Ye.length;Ze++){var Qe=Ye[Ze],ye=this.panoMeshes[Qe];ye.setOpacity(0),ye.setCurrent(!1),ye.updateTime&&ye.updateTime(e,r),ye.visible=!1}else if(ae){var Ct=arrayMin(ae.visibleIds,function(Lt){var P=o.works.getResolvedObserver(Lt);return P?ae.standingPosition.distanceTo(P.standingPosition):1/0},!0),vt=Ct[1];vt=clamp$1(vt,2.5,1/0);for(var it=ae.visibleIds.concat(panoStringify(this.currentPano)),Je=this.getForwardObserverOrNot(),pt=this.camera.getDirection(new THREE__namespace.Vector3),nt=0,Ke=Object.keys(this.panoMeshes);nt<Ke.length;nt++){var Qe=Ke[nt],ye=this.panoMeshes[Qe],J=this.works.getResolvedObserver(Qe);if(it.indexOf(Qe)===-1)ye.setCurrent(!1),ye.setOpacity(0);else if(!J)ye.setCurrent(!1),ye.setOpacity(0);else if(!J.loadable&&!J.active)ye.setCurrent(!1),ye.setOpacity(0);else{var Ee=ye.position.clone().setY(this.camera.position.y).distanceTo(this.camera.position);ye.setCurrent(!ye.loading&&ye.progress===0&&Je!==null&&Je.panoId===Qe),ye.setOpacity(Ee<.01?0:clamp$1(vt/Ee*1.2,.65,.98));var $e=this.camera.position.clone().setY(ye.position.y),Te=new THREE__namespace.Vector3().copy(ye.position).sub($e).normalize();if(Qe===panoStringify(this.currentPano)){var bt=clamp$1((.5-$e.distanceTo(ye.position))/.5,0,1);Te.multiplyScalar(1-bt).add(pt.clone().multiplyScalar(bt))}Te.length()>0&&ye.quaternion.setFromEuler(new THREE__namespace.Euler(0,Math.atan2(Te.x,Te.z),0))}ye.updateTime&&ye.updateTime(e,r)}}if(this.adjustPanoCircleMeshPositionBasedOnModel&&this.helper.visible&&ae){for(var Tt=[],Bt=0,Ot=ae.accessibleIds;Bt<Ot.length;Bt++){var Qe=Ot[Bt],J=this.works.getResolvedObserver(Qe);J&&Tt.push(J)}if(Tt.sort(function(Lt,P){return Lt.standingPosition.distanceTo(ae.standingPosition)-P.standingPosition.distanceTo(ae.standingPosition)}),Tt.length){this.accessibleObserverFloorCheckCount=this.accessibleObserverFloorCheckCount%Tt.length;var ot=Tt[this.accessibleObserverFloorCheckCount],ye=this.panoMeshes[ot.panoId],tt=this.modelScene.models.find(function(P){return P.work===(ot==null?void 0:ot.work)});if(ot&&ye&&tt&&tt.visible){var _t=.3,gt=.05,ft=.005,At=adjustPanoCircleMeshVectors.map(function(F){scratchVector3.copy(F),scratchVector3.setY(_t),scratchRaycaster.ray.origin.copy(ot.standingPosition),scratchRaycaster.ray.origin.add(scratchVector3),scratchRaycaster.ray.direction.set(0,-1,0);var k=tt.intersectRaycaster(scratchRaycaster,null,!0)[0];return k&&k.distance-ft<=_t?new THREE__namespace.Vector3().copy(ot.standingPosition).setY(k.point.y+ft):ot.standingPosition});At.sort(function(F,k){return k.y-F.y});var dt=At[Math.floor(At.length/2)],Oe=At.filter(function(F){return F.distanceTo(dt)<=gt})[0];Oe&&!Oe.equals(ye.position)&&(ye.position.copy(Oe),this.needsRender=!0)}this.accessibleObserverFloorCheckCount++}}{var N=(c=this.modelScene.parameter.progress)!==null&&c!==void 0?c:1,ht=Math.round(N),st=this.modelScene.parameter.pano0,ut=this.modelScene.parameter.pano1,lt=ht===0?st:ut,J=void 0;if(lt&&(J=this.works.getResolvedObserver(lt.panoId),J||(J=this.panoPictureObserverMap.get(lt))),this.tiling.appearDuration=this.tileAppearDuration,this.tiling.maxRequest=N<=.5?0:N<1?1:this.tileMaxRequest,this.tiling.imageOptions=this.imageOptions,!J||!lt||this.tileLevelForFov===!1)this.tiling.setObserver(null),this.tiling.update(this.renderer,this.camera,null,new THREE__namespace.Matrix4,1,0,0),this.modelScene.parameter.set("refinedScreen",null);else{var ct=getImageSizeLevel(lt.mapSize),wt=ct+1,Ht=4;this.tiling.setObserver(J);var Ft=this.tiling.update(this.renderer,this.camera,lt.map,lt.matrix,lt.zoom,wt,Ht),Mt={map:this.tiling.renderTarget.texture,matrixInverse:this.tiling.camera.matrixWorldInverse,projectionMatrix:this.tiling.camera.projectionMatrix,pano:ht,opacity:(st==null?void 0:st.panoId)===(ut==null?void 0:ut.panoId)?1:easeInQuart(Math.abs(((p=this.modelScene.parameter.progress)!==null&&p!==void 0?p:0)-.5)*2)},yt=this.modelScene.parameter.refinedScreen;(Ft||Mt.pano!==(yt==null?void 0:yt.pano)||Mt.opacity!==(yt==null?void 0:yt.opacity))&&this.modelScene.parameter.set("refinedScreen",Mt)}}this.panoVideo.object.position.copy(this.camera.position),this.panoVideo.updateTime(e);{var It=_.effect,St=this.modelScene.parameter,st=St.pano0,ut=St.pano1;if(st&&ut&&st!==ut&&It==="fly"&&this.flyEffectUseDepthBuffer){if(((f=this.modelScene.parameter.pano0Depth)===null||f===void 0?void 0:f.panoId)!==st.panoId||((d=this.modelScene.parameter.pano1Depth)===null||d===void 0?void 0:d.panoId)!==ut.panoId){var Pt=500,mt=512;this.pano0DepthCubeRenderTarget?this.pano0DepthCubeRenderTarget.width!==mt&&this.pano0DepthCubeRenderTarget.setSize(mt,mt):this.pano0DepthCubeRenderTarget=new THREE__namespace.WebGLCubeRenderTarget(mt,{minFilter:THREE__namespace.NearestFilter,magFilter:THREE__namespace.NearestFilter,generateMipmaps:!1}),this.pano1DepthCubeRenderTarget?this.pano1DepthCubeRenderTarget.width!==mt&&this.pano1DepthCubeRenderTarget.setSize(mt,mt):this.pano1DepthCubeRenderTarget=new THREE__namespace.WebGLCubeRenderTarget(mt,{minFilter:THREE__namespace.NearestFilter,magFilter:THREE__namespace.NearestFilter,generateMipmaps:!1});var xt=new THREE__namespace.CubeCamera(this.camera.near,this.camera.far,this.pano0DepthCubeRenderTarget);xt.matrix.copy(st.matrix),xt.matrixWorld.copy(xt.matrix),xt.matrixAutoUpdate=!1,renderDepthCube(this.renderer,this.modelScene,xt,Pt);var Rt=new THREE__namespace.CubeCamera(this.camera.near,this.camera.far,this.pano1DepthCubeRenderTarget);Rt.matrix.copy(ut.matrix),Rt.matrixWorld.copy(Rt.matrix),Rt.matrixAutoUpdate=!1,renderDepthCube(this.renderer,this.modelScene,Rt,Pt),this.modelScene.parameter.set({pano0Depth:{panoId:st.panoId,map:this.pano0DepthCubeRenderTarget.texture,mapSize:this.pano0DepthCubeRenderTarget.width,maxDepth:Pt},pano1Depth:{panoId:ut.panoId,map:this.pano1DepthCubeRenderTarget.texture,mapSize:this.pano1DepthCubeRenderTarget.width,maxDepth:Pt}})}}else this.modelScene.parameter.set({pano0Depth:null,pano1Depth:null}),this.flyEffectUseDepthBuffer||(this.pano0DepthCubeRenderTarget&&(this.pano0DepthCubeRenderTarget.dispose(),this.pano0DepthCubeRenderTarget=void 0),this.pano1DepthCubeRenderTarget&&(this.pano1DepthCubeRenderTarget.dispose(),this.pano1DepthCubeRenderTarget=void 0))}}}},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 p=e[c].handedness,f=e[c].gamepad;switch(p){case"left":f.axes&&(this.emitHandleEvent(f.axes[2]===-1,"LeftAxesLeft",r),this.emitHandleEvent(f.axes[2]===1,"LeftAxesRight",r),this.emitHandleEvent(f.axes[3]===-1,"LeftAxesUp",r),this.emitHandleEvent(f.axes[3]===1,"LeftAxesDown",r)),f!=null&&f.buttons&&(f.buttons[4]&&this.emitHandleEvent(f.buttons[4].pressed,"X",r),f.buttons[5]&&this.emitHandleEvent(f.buttons[5].pressed,"Y",r),f.buttons[0]&&this.emitHandleEvent(f.buttons[0].pressed,"LeftTrigger",r),f.buttons[1]&&this.emitHandleEvent(f.buttons[1].pressed,"LeftPinch",r));var d={raycaster:s,axes:{up:f.axes&&f.axes[3]<0?Math.abs(f.axes[3]):0,down:f.axes&&f.axes[3]<0?0:Math.abs(f.axes[3]),left:f.axes&&f.axes[2]<0?Math.abs(f.axes[2]):0,right:f.axes&&f.axes[2]<0?0:Math.abs(f.axes[2])},deltaTime:o};l.buttons.X=f.buttons&&f.buttons[4]?f.buttons[4].pressed:!1,l.buttons.Y=f.buttons&&f.buttons[5]?f==null?void 0:f.buttons[5].pressed:!1,l.buttons.LeftTrigger=f.buttons&&f.buttons[0]?f==null?void 0:f.buttons[0].pressed:!1,l.buttons.LeftPinch=f.buttons&&f.buttons[1]?f==null?void 0:f.buttons[1].pressed:!1,l.left=d;break;case"right":f.axes&&(this.emitHandleEvent(f.axes[2]===-1,"RightAxesLeft",r),this.emitHandleEvent(f.axes[2]===1,"RightAxesRight",r),this.emitHandleEvent(f.axes[3]===-1,"RightAxesUp",r),this.emitHandleEvent(f.axes[3]===1,"RightAxesDown",r)),f.buttons&&(f.buttons[4]&&this.emitHandleEvent(f.buttons[4].pressed,"A",r),f.buttons[5]&&this.emitHandleEvent(f.buttons[5].pressed,"B",r),f.buttons[0]&&this.emitHandleEvent(f.buttons[0].pressed,"RightTrigger",r),f.buttons[1]&&this.emitHandleEvent(f.buttons[1].pressed,"RightPinch",r));var h={raycaster:u,axes:{up:f.axes&&f.axes[3]<0?Math.abs(f.axes[3]):0,down:f.axes&&f.axes[3]<0?0:Math.abs(f.axes[3]),left:f.axes&&f.axes[2]<0?Math.abs(f.axes[2]):0,right:f.axes&&f.axes[2]<0?0:Math.abs(f.axes[2])},deltaTime:o};l.right=h,l.buttons.A=f.buttons&&f.buttons[4]?f==null?void 0:f.buttons[4].pressed:!1,l.buttons.B=f.buttons&&f.buttons[5]?f==null?void 0:f.buttons[5].pressed:!1,l.buttons.RightTrigger=f.buttons&&f.buttons[0]?f==null?void 0:f.buttons[0].pressed:!1,l.buttons.RightPinch=f.buttons&&f.buttons[1]?f==null?void 0:f.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}}}),p=this.emit("xr.gesture.tap",c);!p&&!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},controllersDefaultInitArgs={Floorplan:defaultFloorplanControllerCustomInitArgs,Topview:defaultTopviewControllerCustomInitArgs,Panorama:defaultPanoramaControllerCustomInitArgs,VRPanorama:defaultVRPanoramaControllerCustomInitArgs,Model:defaultModelControllerCustomInitArgs,Mapview:defaultMapviewControllerCustomInitArgs,XRPanorama:defaultXRPanoramaControllerInitArgs},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(){var n=new THREE__namespace.Group;n.name="internalLights";{var t=new THREE__namespace.DirectionalLight(16777215,.1);t.name="direction0",t.position.copy(new THREE__namespace.Vector3(0,1,0)),n.add(t)}{var t=new THREE__namespace.DirectionalLight(16777215,.1);t.name="direction1",t.position.copy(new THREE__namespace.Vector3(-1,-1,-1)),n.add(t)}{var t=new THREE__namespace.DirectionalLight(16777215,.3);t.name="direction2",t.position.copy(new THREE__namespace.Vector3(1,1,1)),n.add(t)}{var t=new THREE__namespace.AmbientLight(16777215,.6);t.name="ambient0",n.add(t)}return n}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("="),p=(t=c[0])===null||t===void 0?void 0:t.trim(),f=(e=c[1])===null||e===void 0?void 0:e.trim();p&&f&&(r[p]=f)}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+TUTLc7yjcOXV46OUAnUs6EbUp022ZBXc1NhoZYYd7fjDRvdcHAwrlK2QBVJ4sgoqONmY45RUT23sZ6H42F2hK5CtkMbjhZlDmUUcvq1zyieUVyjbE4I1GBfItwxG56YaUZTQwyh4P6NgJ4YYYvCuQ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Zp5/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$4=new THREE__namespace.BufferGeometry;geometry$4.setAttribute("position",new THREE__namespace.BufferAttribute(vertices,3));geometry$4.setAttribute("uv",new THREE__namespace.BufferAttribute(uvs,2));geometry$4.setIndex(new THREE__namespace.BufferAttribute(index,1));var material=new THREE__namespace.MeshBasicMaterial({transparent:!0,depthTest:!1,depthWrite:!1,stencilWrite:!1,fog:!1}),mesh$4=new THREE__namespace.Mesh(geometry$4,material);mesh$4.matrixAutoUpdate=!1;var scene$2=new THREE__namespace.Scene;scene$2.add(mesh$4);scene$2.matrixAutoUpdate=!1;var camera$2=new THREE__namespace.OrthographicCamera(-.5,.5,.5,-.5,.1,1);camera$2.position.set(0,0,.5);camera$2.lookAt(0,0,0);camera$2.updateMatrixWorld(!0);camera$2.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,p=imageSize[0]/3,f=imageSize[1]/3;n.setViewport(l,c,p,f),n.setScissor(l,c,p,f),n.setScissorTest(!0),n.autoClear=!1,n.render(scene$2,camera$2),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 FRAGMENT$2=`
|
|
2131
|
+
`},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,p=0,f=r.count;c<f;c++,p+=2)u.fromBufferAttribute(r,c),l.fromBufferAttribute(o,c),s[p]=p===0?0:s[p-1],s[p+1]=s[p]+u.distanceTo(l);var d=new THREE__namespace.InstancedInterleavedBuffer(s,2,1);return e.setAttribute("instanceDistanceStart",new THREE__namespace.InterleavedBufferAttribute(d,1,0)),e.setAttribute("instanceDistanceEnd",new THREE__namespace.InterleavedBufferAttribute(d,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,p=c.resolution,f=c.linewidth,d=l.attributes.instanceStart,h=l.attributes.instanceEnd,g=new THREE__namespace.Vector4,A=new THREE__namespace.Vector4,m=new THREE__namespace.Vector4,E=new THREE__namespace.Vector3,v=new THREE__namespace.Matrix4,y=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*=p.x/2,m.y*=p.y/2,m.z=0,E.copy(m);var T=this.matrixWorld;v.multiplyMatrices(s.matrixWorldInverse,T);for(var _=0,S=d.count;_<S;_++){g.fromBufferAttribute(d,_),A.fromBufferAttribute(h,_),g.w=1,A.w=1,g.applyMatrix4(v),A.applyMatrix4(v),g.applyMatrix4(u),A.applyMatrix4(u),g.multiplyScalar(1/g.w),A.multiplyScalar(1/A.w);var R=g.z<-1&&A.z<-1,M=g.z>1&&A.z>1;if(!(R||M)){g.x*=p.x/2,g.y*=p.y/2,A.x*=p.x/2,A.y*=p.y/2,y.start.copy(g),y.start.z=0,y.end.copy(A),y.end.z=0;var H=y.closestPointToPointParameter(E,!0);y.at(H,b);var B=THREE__namespace.MathUtils.lerp(g.z,A.z,H),C=B>=-1&&B<=1,w=E.distanceTo(b)<f*.5;if(C&&w){y.start.fromBufferAttribute(d,_),y.end.fromBufferAttribute(h,_),y.start.applyMatrix4(T),y.end.applyMatrix4(T);var I=new THREE__namespace.Vector3,O=new THREE__namespace.Vector3;o.distanceSqToSegment(y.start,y.end,O,I),r.push({point:O,pointOnLine:I,distance:o.origin.distanceTo(O),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/RCPxxclSSroVzRFUbSDg4P848ePFwH8DuAhkWih83TRQWxFOXgAwvDwcOfo6OhvXV1d39tsNtuVBwTDWBwOh1UUxVsMw1hXVlbSdCgNV43uYSvrHg6H24aHh38eHBz85TrgF9FYLHA4HLzH43FvbW2d7u/vG+dANp8FpqIlbd3d3V8Fg8EfBUFw4BONZVmL3+9vHhkZCQL4AoAHgJPK8G+yzC0XDofdoVAo5PP5vkadTBAEtr+/39ff3x8gAp/RPOEqx2qjx+NpvXv3bk9DQ0NDvQgwDIOWlhZrMBj8kgi0UJdxRgYMArzL5XJ7vd57qLPZ7Xamp6fnNgBXtQxcjFuHw+Hyer3t9SYgCAITCAScAJoBNNEY/08GOFVVrfVMv7kMNDntFD1vjIAPrlRN0xjckOm6biFQ3jwNPwDMZrOnqVTqfb3Bi8Wivru7W/VCYkwPlKOjo0IikXh7EwQikYgE4Nw0CfXKDCipVCoTj8df3QABbW1tLUc6oUgkFPMkVACUNjc337148eKvw8PDbJ2jP1taWkoCyNDVXDSECmNSK4qiKNLq6urW8+fPI/UicHx8rD59+jSVy+WOAKSJhKENwFItLtoxk8mwsixzHR0dHe3t7c5PAU+n09rs7OzJkydPYqVSaQfANoDXALIk31S2smU1TWMPDg7K5XKZ7+3t9TudTut1U7+wsFCcmJiIpdPpbQBxADsAknQWymYCOukBHYCuKApisdhpMpnURFEU79y503TVyKenpzOTk5M7e3t7MQKPV0Zv1gNm+awB0MvlshqLxfLb29uyJElWURSbXC4XXyvqxcXFs6mpqeTc3Nzu3t7e3wQcA7BPZ8Cov1pNlJplmQtAG8MwHV6v95tAINA5MDBwPxAIuLu6upr8fr/VAN3c3JQjkcjZ+vp6fnl5+d2bN29SuVzuNYAEpf01CdRChUL+X1VskHACuA3Ay3Fcu9vt7nA6nZ7m5uYWQRCaNE3jVVW15PP580KhIGUymWw2m00DOAJwSP4WwPtq4LX2Ao6USxNlQyS/RcQcdLGwlNIz6vEMAaZpNzCk2Pll94LK/cDYimxERiBwG10sxjgvEZBE0UpE6vxj+0Ct5bTaXthgEhRmja8QWNkkPGsuIpfdjpkK+cZUWTC0KredVmtD/gdlSl6EG4AMvQAAAABJRU5ErkJggg==",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.5.2"},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,p,f,d;return o===void 0&&(o=null),s===void 0&&(s=!0),__generator(this,function(h){switch(h.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=h.sent(),e.profiles.some(function(g){var A=u[g];return A&&(l={profileId:g,profilePath:"".concat(r,"/").concat(A.path),deprecated:!!A.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(p=h.sent(),s){if(d=void 0,d=p.layouts[e.handedness],!d)throw new Error("No matching handedness, ".concat(e.handedness,", in profile ").concat(l.profileId));d.assetPath&&(f=l.profilePath.replace("profile.json",d.assetPath))}return[2,{profile:p,assetPath:f}]}})})}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,p=o.valueNodeProperty;s&&(p===Constants.VisualResponseProperty.VISIBILITY?s.visible=c:p===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(p){var f=p.valueNodeName,d=p.minNodeName,h=p.maxNodeName,g=p.valueNodeProperty;if(g===Constants.VisualResponseProperty.TRANSFORM){if(p.minNode=t.getObjectByName(d),p.maxNode=t.getObjectByName(h),!p.minNode){console.warn("Could not find ".concat(d," in the model"));return}if(!p.maxNode){console.warn("Could not find ".concat(h," in the model"));return}}p.valueNode=t.getObjectByName(f),p.valueNode||console.warn("Could not find ".concat(f," 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,p=l.assetPath;r.motionController=new MotionController(u,c,p);var f=e._assetCache[r.motionController.assetUrl];if(f)o=f.scene.clone(),addAssetSceneToControllerModel(r,o);else{if(!e.gltfLoader)throw new Error("GLTFLoader not set.");e.gltfLoader.load(r.motionController.assetUrl,function(d){e._assetCache[r.motionController.assetUrl]=d,o=d.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}(),defaultXRPanoramaControllerInitArgs=__assign({},omit(defaultPanoramaControllerCustomInitArgs,["maxLatitude","minLatitude"]));function mapPanoResource(n,t){return n}var CONTROLLER_EVNET_DELTA_TIME=300,scratchRaycaster=new THREE__namespace.Raycaster,scratchVector3=new THREE__namespace.Vector3,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,p){internalFetcher.ajax(c,{responseType:"arraybuffer"}).then(function(f){var d;return parseGltf(f.body,{resourcePath:c.slice(0,c.lastIndexOf("/")+1),search:(d=c.split("?")[1])!==null&&d!==void 0?d:"",fetcher:internalFetcher})}).then(function(f){return p(f)})}},(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 p=r.xrManager.getControllerGrip(1);p.add(u.createControllerModel(p)),r.controllerWrappers[1].add(p)}),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.updateConfiguration=function(e){return n.prototype.updateConfiguration.call(this,__assign(__assign({},e),{maxLatitude:Math.PI/2,minLatitude:-Math.PI/2}))},t.prototype.moveToPano=function(e,r,o){var s=this,u,l,c,p,f=(u=r.effect)!==null&&u!==void 0?u:"fade";this.userAction=o,this.stopMomentumMovement();var d=this.works.getResolvedObserver(e);if(!d)throw new Error("Invalid PanoIndex");var h=getImageSizeFromURL(d.images.up),g=this.imageOptions.size;typeof g=="undefined"&&d&&h&&(g=Number(h)),typeof g=="undefined"&&(g=2048);var A=this.imageOptions.transform,m=function(B,C){return mapPanoResource(applyImageURLOptions(B,A,C))},E=__assign({key:"pano.".concat(d.panoId)},pick(this.imageOptions,["format","size","quality"])),v=d.images;c=(l=d.images.tiles)===null||l===void 0?void 0:l.filter(function(B){return B.size>g});var y="pano:"+jsonHash([v,E,A]);if(this.pendingTextureTask){if(this.pendingTextureTask.hash===y)return;var b=this.pendingTextureTask.panoId;(p=this.panoMeshes[b])===null||p===void 0||p.setProgress(0),this.emit("pano.texture.abort",createEvent("pano.texture.abort",{error:null,progress:0,meta:null,pano:d.pano}))}var T=this.modelScene.parameter.resolveValue(),_=T.pano0,S=T.pano1,R;if((_==null?void 0:_.map.name)===y?R=_:(S==null?void 0:S.map.name)===y&&(R=S),R){var M={panoId:d.panoId,effect:f,leftPanoPicture:{panoId:R.panoId,map:R.map,mapSize:R.mapSize,matrix:d.matrix.clone(),zoom:1},position:d.position.clone(),fixCameraTransform:new THREE__namespace.Matrix4};this.doMoveToPano(d.pano,M,r);return}var H="move-to-pano-"+d.panoId;this.pending.add(H),this.pendingTextureTask={panoId:d.panoId,hash:y,onLoad:function(B){var C;s.pending.delete(H);var w=B.body;if(s.destroyed)w.dispose();else{w.name=y;var I=Array.isArray(w.image)?w.image[0]:w.image,O=(C=I==null?void 0:I.width)!==null&&C!==void 0?C:2048,L={panoId:d.panoId,effect:f,leftPanoPicture:{panoId:d.panoId,map:w,mapSize:O,matrix:d.matrix.clone(),zoom:1},position:d.position.clone(),fixCameraTransform:new THREE__namespace.Matrix4};s.doMoveToPano(d.pano,L,r)}},onError:function(B){s.pending.delete(H);var C=__assign(__assign(__assign({},d.pano),{mode:s.mode}),clonePose(s.camera.pose));s.emit("pano.error",createEvent("pano.error",{error:B,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()}},this.textureLoader.loadCubeTexture(v,{imageURL:{transform:m,options:E},format:THREE__namespace.RGBAFormat,fetcher:getFetcher(d.work)},void 0,void 0,function(B){var C,w;((C=s.pendingTextureTask)===null||C===void 0?void 0:C.hash)===y&&((w=s.panoMeshes[d.panoId])===null||w===void 0||w.setProgress(B)),s.emit("pano.texture.progress",createEvent("pano.texture.progress",{error:null,progress:B,meta:null,pano:d.pano}))},this.renderer).then(function(B){var C,w;((C=s.pendingTextureTask)===null||C===void 0?void 0:C.hash)===y?(s.pendingTextureTask.onLoad(B),(w=s.panoMeshes[d.panoId])===null||w===void 0||w.setProgress(0),delete s.pendingTextureTask,s.emit("pano.texture.success",createEvent("pano.texture.success",{error:null,progress:1,meta:B.meta,pano:d.pano}))):B.body.dispose()}).catch(function(B){var C,w;((C=s.pendingTextureTask)===null||C===void 0?void 0:C.hash)===y&&(s.pendingTextureTask.onError(B),(w=s.panoMeshes[d.panoId])===null||w===void 0||w.setProgress(0),delete s.pendingTextureTask,s.emit("pano.texture.error",createEvent("pano.texture.error",{error:B,progress:0,meta:null,pano:d.pano})),s.emit("error",B))}),this.emit("pano.texture.load",createEvent("pano.texture.load",{error:null,progress:0,meta:null,pano:d.pano}))},t.prototype.doMoveToPano=function(e,r,o){var s=this,u,l,c,p,f,d,h,g,A,m;o===void 0&&(o={});var E=now(),v=createUuid();this.panoResources[v]=r;var y=1,b,T,_;if(this.locationMotion.ended){var S=this.locationMotion.getKeyFrameSegment(E);S[0];var R=S[1],M=this.locationMotion.value,H=this.panoResourceFromLocationMotionKeyframe(R).position,B=r.position;b=Math.max(H.distanceTo(B),y),T=[{key:R.key,progress:0,value:__assign(__assign({},M),{count:0})},{key:v,progress:1,value:{distance:0,count:1}}],_=0}else{var C=this.locationMotion.getKeyFrameSegment(E),w=C[0],R=C[1],M=this.locationMotion.value,I=this.panoResourceFromLocationMotionKeyframe(w).position,H=this.panoResourceFromLocationMotionKeyframe(R).position,B=r.position,O=R.value.count-M.count,L=Math.max(I.distanceTo(H),y)*O,N=Math.max(H.distanceTo(B),y);b=L+N,T=[{key:w.key,progress:0,value:__assign({},M)},{key:R.key,progress:L/b,value:R.value},{key:v,progress:1,value:{count:R.value.count+1,distance:0}}];var z=this.locationMotionKeyframesLength(this.locationMotion.keyframes),J=this.locationMotionKeyframesLength(T);_=this.locationMotion.getProgressVelocity(E)*z/J}var G=r.effect==="instant"?0:this.calculateMovingDuration(o.duration,r.effect==="fly"?b:0),Q={longitude:o.longitude,latitude:o.latitude,fov:o.fov},U=__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}),q=this.currentPano;if(this.emit("pano.moveTo",createEvent("pano.moveTo",{options:o,prevPano:q,progress:0,state:U,userAction:this.userAction,error:null})),o.moveStartCallback&&o.moveStartCallback(U),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,G).catch(noop$1);else{var K=coordinatesToVector({longitude:this.cameraMotion.value.longitude,latitude:this.cameraMotion.value.latitude}),Y=coordinatesToVector({longitude:(p=Q.longitude)!==null&&p!==void 0?p:this.cameraMotion.value.longitude,latitude:(f=Q.latitude)!==null&&f!==void 0?f:this.cameraMotion.value.latitude}),Z=new THREE__namespace.Object3D;Z.lookAt(K);var te=new THREE__namespace.Matrix4().makeRotationFromQuaternion(Z.quaternion);Z.lookAt(Y);var j=new THREE__namespace.Matrix4().makeRotationFromQuaternion(Z.quaternion),ee=new THREE__namespace.Matrix4().getInverse(te).premultiply(j),W=this.cameraMotion.value.fov,re=(d=Q.fov)!==null&&d!==void 0?d:this.cameraMotion.value.fov,le=1;r.effect==="zoomin"?le=1.5:r.effect==="zoomout"&&(le=.4);for(var ae=re*le,oe=0;oe<T.length-1;oe++){var se=T[oe].key;if(se){var ce=this.panoResources[se];ce&&(ce.fixCameraTransform.copy(ee),ce.leftPanoPicture&&(ce.leftPanoPicture.zoom=Math.tan(ae/2/180*Math.PI)/Math.tan(W/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:(h=Q.longitude)!==null&&h!==void 0?h:this.cameraMotion.value.longitude,latitude:(g=Q.latitude)!==null&&g!==void 0?g:this.cameraMotion.value.latitude,fov:ae}},{progress:1,value:{longitude:(A=Q.longitude)!==null&&A!==void 0?A:this.cameraMotion.value.longitude,latitude:(m=Q.latitude)!==null&&m!==void 0?m:this.cameraMotion.value.latitude,fov:re}}],G).catch(noop$1)}var ve=this.locationMotion.setKeyframes(T,G,_);ve.then(function(){for(var Te=0,pe=s.modelScene.children;Te<pe.length;Te++){var me=pe[Te];me instanceof Model&&me.show()}var X=__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:X,userAction:s.userAction,error:null})),o.moveEndCallback&&o.moveEndCallback(X);var ne=s.works.getResolvedObserver(s.currentPano);if(ne&&ne.video&&s.videoTexture&&s.videoTexture.image instanceof HTMLVideoElement){var V={map:s.videoTexture,size:ne.video.size,matrix:ne.video.matrix,panoMatrix:ne.matrix,alpha:1},Ee=createUuid(),fe=s.videoTexture.image;fe.setAttribute("uuid",Ee),canplayVideo().then(function(he){he&&ne.video&&fe.getAttribute("uuid")===Ee&&(fe.oncanplay=function(){fe.oncanplay=noop$1,fe.play()},fe.ontimeupdate=function(){fe.currentTime>.5&&(fe.ontimeupdate=noop$1,s.panoVideo.setMaterial(V))},fe.src=ne.video.source)}).catch(function(){fe.removeAttribute("uuid")})}},function(){s.emit("pano.cancel",createEvent("pano.cancel",{options:o,prevPano:q,progress:0,state:U,userAction:s.userAction,error:null})),o.moveCancelCallback&&o.moveCancelCallback()})},t.prototype.checkSelectedPano=function(e){var r=this,o;this.stopMomentumMovement(),this.camera.getDirection(new THREE__namespace.Vector3).setY(0);var s=null,u=this.works.getResolvedObserver(this.currentPano);if(!u)return null;var l=u.accessibleIds.filter(function(b){var T=panoParse(b);if(panoEqual(T,r.currentPano))return!1;var _=r.works.getResolvedObserver(T);return!_||_.position.distanceTo(r.camera.position)>r.maxAccessibleDistance?!1:_.loadable||_.active}),c=this.modelScene.intersectRaycaster(e)[0];if(c){var p=arrayMin(l,function(b){var T=r.works.getResolvedObserver(b);if(!T)return 1/0;var _=T.standingPosition.clone();return _.distanceTo(c.point)},!0),f=p[0],d=p[1];f&&d<this.panoTapTriggerRadius&&(s=(o=this.works.getResolvedObserver(f))!==null&&o!==void 0?o:null)}if(isNil(s)){var h=this.getForwardObserverOrNot(e);h&&(s=h)}for(var g=0,A=this.locationMotion.keyframes;g<A.length;g++){var m=A[g],E=this.panoResourceFromLocationMotionKeyframe(m);if(!(m.progress<this.locationMotion.progress)&&s&&E.panoId===s.panoId){s=null;break}}if(isNil(s))return this.locationMotion.ended===!0&&this.cameraBounce(),null;if(!s.active){var v=s.panoId;this.panoMeshes[v]&&(this.panoMeshes[v].setDisabled(!1),this.panoMeshes[v].setLoading(!0))}var y={workCode:s.pano.workCode,panoIndex:s.pano.panoIndex,mode:this.mode,longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude,fov:this.camera.pose.fov,distance:0,offset:s?s.position.clone():new THREE__namespace.Vector3};return this.emit("pano.select",createEvent("pano.select",{prevPano:this.currentPano,state:y,userAction:!0,options:{},progress:0,error:null})),s&&s.active?(this.emit("pano.request",createEvent("pano.request",{userAction:!0,prevPano:this.currentPano,progress:0,state:y,options:{},error:null})),s.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,p,f,d,h=[],g=2;g<arguments.length;g++)h[g-2]=arguments[g];this.userAction=!0;var A={},m={},E=this.locationMotion.keyframes[0],v=this.locationMotion.keyframes[this.locationMotion.keyframes.length-1],y=this.locationMotion.getKeyFrameSegment(e),b=y[0],T=y[1];this.panoResourceFromLocationMotionKeyframe(b);var _=this.panoResourceFromLocationMotionKeyframe(T),S=this.panoResourceFromLocationMotionKeyframe(E),R=this.panoResourceFromLocationMotionKeyframe(v),M=!1;if(this.cameraMotion.ended===!1&&(this.cameraMotion.update(e),m.longitude=this.cameraMotion.value.longitude,m.latitude=this.cameraMotion.value.latitude,m.fov=this.cameraMotion.value.fov),this.modelAlphaMotion.ended===!1&&(this.modelAlphaMotion.update(e),A.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 H=this.locationMotion.getKeyFrameSegment(e),B=H[0],C=H[1],w=this.panoResourceFromLocationMotionKeyframe(B),I=this.panoResourceFromLocationMotionKeyframe(C),O=new THREE__namespace.Vector3().copy(w.position),L=new THREE__namespace.Vector3().copy(I.position),N=this.locationMotion.value.count-C.value.count+1;if(A.progress=N,I.leftPanoPicture&&(N<1?w.leftPanoPicture&&(A.pano0=w.leftPanoPicture):A.pano0=I.leftPanoPicture,A.pano1=I.leftPanoPicture),I.effect==="montage"?A.transition="BLACK":I.effect==="spread"?A.transition="SPREAD":A.transition="FADE",(I.effect==="zoomin"||I.effect==="zoomout")&&(A.progress=Math.pow(N,3)),N<1&&I.effect!=="fly"){if(A.pano0&&w.leftPanoPicture){var z={panoId:A.pano0.panoId,map:A.pano0.map,mapSize:A.pano0.mapSize,zoom:A.pano0.zoom,matrix:w.leftPanoPicture.matrix.clone().setPosition(I.position)},J=this.panoPictureObserverMap.get(A.pano0);J&&this.panoPictureObserverMap.set(z,J),A.pano0=z}O.copy(L),M=!0}m.distance=this.locationMotion.value.distance,m.offset=new THREE__namespace.Vector3(O.x+(L.x-O.x)*N,O.y+(L.y-O.y)*N,O.z+(L.z-O.z)*N);for(var G=[],Q=[],U=0,q=this.locationMotion.keyframes;U<q.length;U++){var K=q[U],Y=K.key,Z=K.progress;Y!==void 0&&(G.push(Y),Z>this.locationMotion.progress&&Q.push(Y))}for(var te=0,j=Object.keys(this.panoResources);te<j.length;te++){var ee=j[te];if(!(Q.indexOf(ee)>=0)){var W=this.panoResources[ee];if(W.leftPanoPicture){var re=W.leftPanoPicture.map;if(re){if(re===((s=A.pano0)===null||s===void 0?void 0:s.map)||re===((u=A.pano1)===null||u===void 0?void 0:u.map))continue;re.dispose(),W.leftPanoPicture=null}}G.indexOf(ee)>=0||delete this.panoResources[ee]}}var le=panoParse(I.panoId);le!==this.currentPano&&(this.currentPano=le,this.accessibleObserverFloorCheckCount=0),this.emit("pano.moving",createEvent("pano.moving",{userAction:this.userAction,prevPano:panoParse(S.panoId),state:__assign(__assign(__assign(__assign({},panoParse(R.panoId)),{mode:this.mode}),clonePose(this.camera.pose)),m),options:{},progress:this.locationMotion.progress,error:null}))}isEmptyObject(A)===!1&&this.modelScene.parameter.set(A),isEmptyObject(m)===!1&&this.setCamera(m);var ae=this.works.getResolvedObserver(this.currentPano),oe=h[1];if(!oe){console.error("xrFrame丢失,请重试");return}if(!this.xrManager.session){console.error("session丢失,请重试");return}var se=this.xrManager.referenceSpace;if(se){var ce=this.xrManager.cameraVR,ve=this.xrManager.cameraL,Te=this.xrManager.cameraR,pe=[ve,Te],me=oe.getViewerPose(se),X=new THREE__namespace.Vector3(0,0,0);if(me){var ne;ne=this.xrManager.session.renderState.baseLayer;var V=me.views;if(!ne){console.error("no layer found");return}this.renderer.setFramebuffer(ne.framebuffer);var Ee=!1;V.length!==ce.cameras.length&&(ce.cameras.length=0,Ee=!0),this.parallaxCameraMatrixs=[];var fe=new THREE__namespace.Vector3,he=new THREE__namespace.Vector3;new THREE__namespace.Matrix4().fromArray(V[0].transform.matrix).decompose(fe,new THREE__namespace.Quaternion,new THREE__namespace.Vector3),new THREE__namespace.Matrix4().fromArray(V[1].transform.matrix).decompose(he,new THREE__namespace.Quaternion,new THREE__namespace.Vector3),he.clone().sub(fe).normalize();var Ne=new THREE__namespace.Vector3,rt=new THREE__namespace.Quaternion,Ye=new THREE__namespace.Vector3;this.camera.matrix.decompose(Ne,rt,Ye);for(var ge=0;ge<V.length;ge++){var ie=V[ge],de=ne.getViewport(ie),Ce=pe[ge];Ce.matrix.fromArray(ie.transform.matrix);var Se=new THREE__namespace.Vector3,Be=new THREE__namespace.Quaternion,Le=new THREE__namespace.Vector3;Ce.matrix.decompose(Se,Be,Le),X.copy(Ne),Ce.position.copy(Ne),Ce.quaternion.copy(Be),Ce.scale.copy(Le),Ce.updateMatrix(),Ce.projectionMatrix.fromArray(ie.projectionMatrix);var be=ve.projectionMatrix.elements;Ce.fov=2*Math.atan(1/be[5])*180/Math.PI,Ce.viewport.set(de.x,de.y,de.width,de.height),Object.assign(Ce,{resolution:new THREE__namespace.Vector2(de.width,de.height)}),Ee===!0&&ce.cameras.push(Ce)}if(this.xrManager.session&&this.xrManager.session.inputSources){for(var ge=0;ge<this.xrManager.session.inputSources.length;ge++)if(this.xrManager.session.inputSources[ge]&&this.xrManager.session.inputSources[ge].targetRayMode==="transient-pointer"){var Me=oe.getPose(this.xrManager.session.inputSources[ge].targetRaySpace,se);if(Me){var we=new THREE__namespace.Vector3(0,0,-1).applyQuaternion(Me.transform.orientation),Pe=new THREE__namespace.Raycaster(this.camera.position,we);this.gazeRay=Pe}}}if(this.xrManager.machineType==="Oculus"||this.xrManager.machineType==="Pico"){for(var ze=this.xrManager.session.inputSources,ge=0;ge<ze.length;ge++){var Ge=this.xrManager.controllers[ge],He=ze[ge];if(He){Ge&&Ge.update(He,oe,se);var Pe=this.xrManager.getController(ge),Ve=new THREE__namespace.Vector3(0,1.2,0),$e=Pe.position.clone().add(X).sub(Ve);He.handedness==="left"?this.xrControllerRay.left.set($e,new THREE__namespace.Vector3(0,0,-1).applyEuler(Pe.rotation)):He.handedness==="right"&&this.xrControllerRay.right.set($e,new THREE__namespace.Vector3(0,0,-1).applyEuler(Pe.rotation)),this.controllerWrappers[ge].position.copy(new THREE__namespace.Vector3(0,0,0).add(X).sub(Ve));var Ie=this.modelScene.intersectRaycaster(this.xrControllerRay.right);if(Ie.length===0&&(Ie=this.xrControllerRay.right.intersectObject(this.boundingMesh,!0).map(function(k){var D;return __assign({floor:(D=ae==null?void 0:ae.floorIndex)!==null&&D!==void 0?D:0},k)})),Ie.length>=1&&Ie[0].face)if(He.handedness==="right"){var je=this.xrControllerRay.right.intersectObject(this.xrCustomObjectsScene,!0),xe=Ie[0].face.normal,We=xe.clone(),_e=Ie[0].point.clone();this.intersectMesh.position.copy(_e);var Oe=_e.clone().add(We);if(this.intersectMesh.lookAt(Oe),Math.abs(xe.y)>.99){var Fe=this.camera.position.clone().sub(_e);this.intersectMesh.rotation.z=-Math.atan2(Fe.z,Fe.x)}this.intersectMesh.visible=!0,this.needsRender=!0,je.length>0?(this.pointerLines.right.setPoints($e,je[0].point),this.pointerLines.right.points.visible=!0,this.intersectMesh.visible=!1):(this.pointerLines.right.points.visible=!1,this.pointerLines.right.setPoints($e,Ie[0].point));var qe=Ie[0],nt=createEvent("intersect.update",{raycaster:(l=this.xrControllerRay.right)!==null&&l!==void 0?l:null,intersection:qe!=null?qe:null,object:this.intersectMesh});if(this.emit("intersect.update",nt),nt.defaultPrevented){this.hideIntersectMesh();return}}else this.pointerLines.left.setPoints($e,Ie[0].point)}}this.updateControllerHelper(ze,e,r)}if(this.camera.pose.distance>.1||M)for(var Ze=0,ut=Object.keys(this.panoMeshes);Ze<ut.length;Ze++){var Ue=ut[Ze],Re=this.panoMeshes[Ue];Re.setOpacity(0),Re.setCurrent(!1),Re.updateTime&&Re.updateTime(e,r),Re.visible=!1}else if(ae){var yt=arrayMin(ae.visibleIds,function(P){var F=o.works.getResolvedObserver(P);return F?ae.standingPosition.distanceTo(F.standingPosition):1/0},!0),at=yt[1];at=clamp$1(at,2.5,1/0);for(var Ke=ae.visibleIds.concat(panoStringify(this.currentPano)),lt=this.getForwardObserverOrNot(),pt=this.camera.getDirection(new THREE__namespace.Vector3),Qe=0,ye=Object.keys(this.panoMeshes);Qe<ye.length;Qe++){var Ue=ye[Qe],Re=this.panoMeshes[Ue],J=this.works.getResolvedObserver(Ue);if(Ke.indexOf(Ue)===-1)Re.setCurrent(!1),Re.setOpacity(0);else if(!J)Re.setCurrent(!1),Re.setOpacity(0);else if(!J.loadable&&!J.active)Re.setCurrent(!1),Re.setOpacity(0);else{var tt=Re.position.clone().setY(this.camera.position.y).distanceTo(this.camera.position);Re.setCurrent(!Re.loading&&Re.progress===0&<!==null&<.panoId===Ue),Re.setOpacity(tt<.01?0:clamp$1(at/tt*1.2,.65,.98));var Et=this.camera.position.clone().setY(Re.position.y),we=new THREE__namespace.Vector3().copy(Re.position).sub(Et).normalize();if(Ue===panoStringify(this.currentPano)){var wt=clamp$1((.5-Et.distanceTo(Re.position))/.5,0,1);we.multiplyScalar(1-wt).add(pt.clone().multiplyScalar(wt))}we.length()>0&&Re.quaternion.setFromEuler(new THREE__namespace.Euler(0,Math.atan2(we.x,we.z),0))}Re.updateTime&&Re.updateTime(e,r)}}if(this.adjustPanoCircleMeshPositionBasedOnModel&&this.helper.visible&&ae){for(var St=[],Pt=0,xt=ae.accessibleIds;Pt<xt.length;Pt++){var Ue=xt[Pt],J=this.works.getResolvedObserver(Ue);J&&St.push(J)}if(St.sort(function(P,F){return P.standingPosition.distanceTo(ae.standingPosition)-F.standingPosition.distanceTo(ae.standingPosition)}),St.length){this.accessibleObserverFloorCheckCount=this.accessibleObserverFloorCheckCount%St.length;var De=St[this.accessibleObserverFloorCheckCount],Re=this.panoMeshes[De.panoId],gt=this.modelScene.models.find(function(F){return F.work===(De==null?void 0:De.work)});if(De&&Re&>&>.visible){var dt=.3,ht=.05,bt=.005,it=adjustPanoCircleMeshVectors.map(function(k){scratchVector3.copy(k),scratchVector3.setY(dt),scratchRaycaster.ray.origin.copy(De.standingPosition),scratchRaycaster.ray.origin.add(scratchVector3),scratchRaycaster.ray.direction.set(0,-1,0);var D=gt.intersectRaycaster(scratchRaycaster,null,!0)[0];return D&&D.distance-bt<=dt?new THREE__namespace.Vector3().copy(De.standingPosition).setY(D.point.y+bt):De.standingPosition});it.sort(function(k,D){return D.y-k.y});var vt=it[Math.floor(it.length/2)],_e=it.filter(function(k){return k.distanceTo(vt)<=ht})[0];_e&&!_e.equals(Re.position)&&(Re.position.copy(_e),this.needsRender=!0)}this.accessibleObserverFloorCheckCount++}}{var N=(c=this.modelScene.parameter.progress)!==null&&c!==void 0?c:1,Bt=Math.round(N),ct=this.modelScene.parameter.pano0,ot=this.modelScene.parameter.pano1,Je=Bt===0?ct:ot,J=void 0;if(Je&&(J=this.works.getResolvedObserver(Je.panoId),J||(J=this.panoPictureObserverMap.get(Je))),this.tiling.appearDuration=this.tileAppearDuration,this.tiling.maxRequest=N<=.6?0:N<1?1:this.tileMaxRequest,this.tiling.imageOptions=this.imageOptions,!J||!Je||this.tileLevelForFov===!1)this.tiling.setObserver(null),this.tiling.update(this.renderer,ve,null,new THREE__namespace.Matrix4,1,0,0),this.modelScene.parameter.set("refinedScreen",null);else{var It=getImageSizeLevel(Je.mapSize),Ht=It+1,Ft=4;this.tiling.setObserver(J);var Lt=this.tiling.update(this.renderer,ve,Je.map,Je.matrix,Je.zoom,Ht,Ft),Rt={map:this.tiling.renderTarget.texture,matrixInverse:this.tiling.camera.matrixWorldInverse,projectionMatrix:this.tiling.camera.projectionMatrix,pano:Bt,opacity:(ct==null?void 0:ct.panoId)===(ot==null?void 0:ot.panoId)?1:easeInQuart(Math.abs(((p=this.modelScene.parameter.progress)!==null&&p!==void 0?p:0)-.5)*2)},mt=this.modelScene.parameter.refinedScreen;(Lt||Rt.pano!==(mt==null?void 0:mt.pano)||Rt.opacity!==(mt==null?void 0:mt.opacity))&&this.modelScene.parameter.set("refinedScreen",Rt)}}this.panoVideo.object.position.copy(this.camera.position),this.panoVideo.updateTime(e);{var Tt=_.effect,Ot=this.modelScene.parameter,ct=Ot.pano0,ot=Ot.pano1;if(ct&&ot&&ct!==ot&&Tt==="fly"&&this.flyEffectUseDepthBuffer){if(((f=this.modelScene.parameter.pano0Depth)===null||f===void 0?void 0:f.panoId)!==ct.panoId||((d=this.modelScene.parameter.pano1Depth)===null||d===void 0?void 0:d.panoId)!==ot.panoId){var Ct=500,ft=512;this.pano0DepthCubeRenderTarget?this.pano0DepthCubeRenderTarget.width!==ft&&this.pano0DepthCubeRenderTarget.setSize(ft,ft):this.pano0DepthCubeRenderTarget=new THREE__namespace.WebGLCubeRenderTarget(ft,{minFilter:THREE__namespace.NearestFilter,magFilter:THREE__namespace.NearestFilter,generateMipmaps:!1}),this.pano1DepthCubeRenderTarget?this.pano1DepthCubeRenderTarget.width!==ft&&this.pano1DepthCubeRenderTarget.setSize(ft,ft):this.pano1DepthCubeRenderTarget=new THREE__namespace.WebGLCubeRenderTarget(ft,{minFilter:THREE__namespace.NearestFilter,magFilter:THREE__namespace.NearestFilter,generateMipmaps:!1});var _t=new THREE__namespace.CubeCamera(this.camera.near,this.camera.far,this.pano0DepthCubeRenderTarget);_t.matrix.copy(ct.matrix),_t.matrixWorld.copy(_t.matrix),_t.matrixAutoUpdate=!1,renderDepthCube(this.renderer,this.modelScene,_t,Ct);var Mt=new THREE__namespace.CubeCamera(this.camera.near,this.camera.far,this.pano1DepthCubeRenderTarget);Mt.matrix.copy(ot.matrix),Mt.matrixWorld.copy(Mt.matrix),Mt.matrixAutoUpdate=!1,renderDepthCube(this.renderer,this.modelScene,Mt,Ct),this.modelScene.parameter.set({pano0Depth:{panoId:ct.panoId,map:this.pano0DepthCubeRenderTarget.texture,mapSize:this.pano0DepthCubeRenderTarget.width,maxDepth:Ct},pano1Depth:{panoId:ot.panoId,map:this.pano1DepthCubeRenderTarget.texture,mapSize:this.pano1DepthCubeRenderTarget.width,maxDepth:Ct}})}}else this.modelScene.parameter.set({pano0Depth:null,pano1Depth:null}),this.flyEffectUseDepthBuffer||(this.pano0DepthCubeRenderTarget&&(this.pano0DepthCubeRenderTarget.dispose(),this.pano0DepthCubeRenderTarget=void 0),this.pano1DepthCubeRenderTarget&&(this.pano1DepthCubeRenderTarget.dispose(),this.pano1DepthCubeRenderTarget=void 0))}}}},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 p=e[c].handedness,f=e[c].gamepad;switch(p){case"left":f.axes&&(this.emitHandleEvent(f.axes[2]===-1,"LeftAxesLeft",r),this.emitHandleEvent(f.axes[2]===1,"LeftAxesRight",r),this.emitHandleEvent(f.axes[3]===-1,"LeftAxesUp",r),this.emitHandleEvent(f.axes[3]===1,"LeftAxesDown",r)),f!=null&&f.buttons&&(f.buttons[4]&&this.emitHandleEvent(f.buttons[4].pressed,"X",r),f.buttons[5]&&this.emitHandleEvent(f.buttons[5].pressed,"Y",r),f.buttons[0]&&this.emitHandleEvent(f.buttons[0].pressed,"LeftTrigger",r),f.buttons[1]&&this.emitHandleEvent(f.buttons[1].pressed,"LeftPinch",r));var d={raycaster:s,axes:{up:f.axes&&f.axes[3]<0?Math.abs(f.axes[3]):0,down:f.axes&&f.axes[3]<0?0:Math.abs(f.axes[3]),left:f.axes&&f.axes[2]<0?Math.abs(f.axes[2]):0,right:f.axes&&f.axes[2]<0?0:Math.abs(f.axes[2])},deltaTime:o};l.buttons.X=f.buttons&&f.buttons[4]?f.buttons[4].pressed:!1,l.buttons.Y=f.buttons&&f.buttons[5]?f==null?void 0:f.buttons[5].pressed:!1,l.buttons.LeftTrigger=f.buttons&&f.buttons[0]?f==null?void 0:f.buttons[0].pressed:!1,l.buttons.LeftPinch=f.buttons&&f.buttons[1]?f==null?void 0:f.buttons[1].pressed:!1,l.left=d;break;case"right":f.axes&&(this.emitHandleEvent(f.axes[2]===-1,"RightAxesLeft",r),this.emitHandleEvent(f.axes[2]===1,"RightAxesRight",r),this.emitHandleEvent(f.axes[3]===-1,"RightAxesUp",r),this.emitHandleEvent(f.axes[3]===1,"RightAxesDown",r)),f.buttons&&(f.buttons[4]&&this.emitHandleEvent(f.buttons[4].pressed,"A",r),f.buttons[5]&&this.emitHandleEvent(f.buttons[5].pressed,"B",r),f.buttons[0]&&this.emitHandleEvent(f.buttons[0].pressed,"RightTrigger",r),f.buttons[1]&&this.emitHandleEvent(f.buttons[1].pressed,"RightPinch",r));var h={raycaster:u,axes:{up:f.axes&&f.axes[3]<0?Math.abs(f.axes[3]):0,down:f.axes&&f.axes[3]<0?0:Math.abs(f.axes[3]),left:f.axes&&f.axes[2]<0?Math.abs(f.axes[2]):0,right:f.axes&&f.axes[2]<0?0:Math.abs(f.axes[2])},deltaTime:o};l.right=h,l.buttons.A=f.buttons&&f.buttons[4]?f==null?void 0:f.buttons[4].pressed:!1,l.buttons.B=f.buttons&&f.buttons[5]?f==null?void 0:f.buttons[5].pressed:!1,l.buttons.RightTrigger=f.buttons&&f.buttons[0]?f==null?void 0:f.buttons[0].pressed:!1,l.buttons.RightPinch=f.buttons&&f.buttons[1]?f==null?void 0:f.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}}}),p=this.emit("xr.gesture.tap",c);!p&&!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},controllersDefaultInitArgs={Floorplan:defaultFloorplanControllerCustomInitArgs,Topview:defaultTopviewControllerCustomInitArgs,Panorama:defaultPanoramaControllerCustomInitArgs,VRPanorama:defaultVRPanoramaControllerCustomInitArgs,Model:defaultModelControllerCustomInitArgs,Mapview:defaultMapviewControllerCustomInitArgs,XRPanorama:defaultXRPanoramaControllerInitArgs},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(){var n=new THREE__namespace.Group;n.name="internalLights";{var t=new THREE__namespace.DirectionalLight(16777215,.1);t.name="direction0",t.position.copy(new THREE__namespace.Vector3(0,1,0)),n.add(t)}{var t=new THREE__namespace.DirectionalLight(16777215,.1);t.name="direction1",t.position.copy(new THREE__namespace.Vector3(-1,-1,-1)),n.add(t)}{var t=new THREE__namespace.DirectionalLight(16777215,.3);t.name="direction2",t.position.copy(new THREE__namespace.Vector3(1,1,1)),n.add(t)}{var t=new THREE__namespace.AmbientLight(16777215,.6);t.name="ambient0",n.add(t)}return n}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("="),p=(t=c[0])===null||t===void 0?void 0:t.trim(),f=(e=c[1])===null||e===void 0?void 0:e.trim();p&&f&&(r[p]=f)}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+TUTLc7yjcOXV46OUAnUs6EbUp022ZBXc1NhoZYYd7fjDRvdcHAwrlK2QBVJ4sgoqONmY45RUT23sZ6H42F2hK5CtkMbjhZlDmUUcvq1zyieUVyjbE4I1GBfItwxG56YaUZT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6Lv2yTj8hs3JoiU9sZZp5/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$4=new THREE__namespace.BufferGeometry;geometry$4.setAttribute("position",new THREE__namespace.BufferAttribute(vertices,3));geometry$4.setAttribute("uv",new THREE__namespace.BufferAttribute(uvs,2));geometry$4.setIndex(new THREE__namespace.BufferAttribute(index,1));var material=new THREE__namespace.MeshBasicMaterial({transparent:!0,depthTest:!1,depthWrite:!1,stencilWrite:!1,fog:!1}),mesh$4=new THREE__namespace.Mesh(geometry$4,material);mesh$4.matrixAutoUpdate=!1;var scene$2=new THREE__namespace.Scene;scene$2.add(mesh$4);scene$2.matrixAutoUpdate=!1;var camera$2=new THREE__namespace.OrthographicCamera(-.5,.5,.5,-.5,.1,1);camera$2.position.set(0,0,.5);camera$2.lookAt(0,0,0);camera$2.updateMatrixWorld(!0);camera$2.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,p=imageSize[0]/3,f=imageSize[1]/3;n.setViewport(l,c,p,f),n.setScissor(l,c,p,f),n.setScissorTest(!0),n.autoClear=!1,n.render(scene$2,camera$2),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 FRAGMENT$2=`
|
|
2132
2132
|
precision mediump float;
|
|
2133
2133
|
precision mediump int;
|
|
2134
2134
|
uniform sampler2D depthBuffer;
|
|
@@ -2244,4 +2244,4 @@ void main() {
|
|
|
2244
2244
|
rgb = clamp(lumCompressed * rgb, 0.0, 1.0);
|
|
2245
2245
|
gl_FragColor = mix(inputColor, vec4(rgb, alpha), progress * 0.9);
|
|
2246
2246
|
}
|
|
2247
|
-
`})||this;return r.material.transparent=!0,r}return Object.defineProperty(t.prototype,"luminanceAdaptiveBuffer",{get:function(){return this.material.uniforms.luminanceAdaptiveBuffer.value},set:function(e){this.material.uniforms.luminanceAdaptiveBuffer.value=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"progress",{get:function(){return this.material.uniforms.progress.value},set:function(e){this.material.uniforms.progress.value=e},enumerable:!1,configurable:!0}),t}(Pass),LuminanceAdaptiveEffect=function(n){__extends(t,n);function t(e,r,o,s){var u=n.call(this,e,r,o,s)||this;return u.enableTime=now(),u.renderer=e,u.valuePass=new ValuePass(u.renderer),u.luminancePass=new LuminancePass(u.renderer,Math.sqrt(1/3)),u.nextStepPass=new NextStepPass(u.renderer,.01),u.luminanceAdaptivePass=new LuminanceAdaptivePass(u.renderer),u}return t.prototype.render=function(e){this.renderer.setRenderTarget(e[0]),this.renderer.render(this.scene,this.camera),this.enableTime===null&&(this.enableTime=now()),this.luminanceTargetBuffer||(this.luminanceTargetBuffer=new THREE__namespace.WebGLRenderTarget(128,128,{minFilter:THREE__namespace.LinearMipmapLinearFilter,magFilter:THREE__namespace.LinearFilter,encoding:this.renderer.outputEncoding,stencilBuffer:!1,depthBuffer:!1,format:THREE__namespace.RGBAFormat,generateMipmaps:!0}),this.nextStepPass.targetBuffer=this.luminanceTargetBuffer.texture),this.luminancePass.render(e[0],this.luminanceTargetBuffer),this.luminancePrevBuffer||(this.luminancePrevBuffer=new THREE__namespace.WebGLRenderTarget(1,1,{minFilter:THREE__namespace.NearestFilter,magFilter:THREE__namespace.NearestFilter,type:THREE__namespace.HalfFloatType,encoding:this.renderer.outputEncoding,stencilBuffer:!1,depthBuffer:!1}),this.valuePass.render(new THREE__namespace.Vector3(.5,.5,.5),this.luminancePrevBuffer)),this.luminanceNextBuffer||(this.luminanceNextBuffer=new THREE__namespace.WebGLRenderTarget(1,1,{minFilter:THREE__namespace.NearestFilter,magFilter:THREE__namespace.NearestFilter,type:THREE__namespace.HalfFloatType,encoding:this.renderer.outputEncoding,stencilBuffer:!1,depthBuffer:!1}),this.valuePass.render(new THREE__namespace.Vector3(.5,.5,.5),this.luminanceNextBuffer),this.luminanceAdaptivePass.luminanceAdaptiveBuffer=this.luminanceNextBuffer.texture),this.copyPass.render(this.luminanceNextBuffer,this.luminancePrevBuffer),this.nextStepPass.render(this.luminancePrevBuffer,this.luminanceNextBuffer),this.luminanceAdaptivePass.progress=Math.min((now()-this.enableTime)/100,1),this.luminanceAdaptivePass.render(e[0],e[1])},t.prototype.dispose=function(){var e,r,o;(e=this.luminanceTargetBuffer)===null||e===void 0||e.dispose(),(r=this.luminancePrevBuffer)===null||r===void 0||r.dispose(),(o=this.luminanceNextBuffer)===null||o===void 0||o.dispose(),this.copyPass.dispose(),this.luminancePass.dispose(),this.nextStepPass.dispose(),this.luminanceAdaptivePass.dispose()},t}(Effect),sharedV2=new THREE__namespace.Vector2,LuminanceRenderer=function(n){__extends(t,n);function t(e){var r,o,s=n.call(this,e)||this;s.type="default",s.luminanceAdaptiveEffect=new LuminanceAdaptiveEffect(s.renderer,s.modelScene,s.camera,s.modelScene);var u=s.renderer.getDrawingBufferSize(sharedV2);return s.screenBuffers=[new THREE__namespace.WebGLRenderTarget(u.x,u.y,{generateMipmaps:!1,encoding:(o=(r=s.renderer)===null||r===void 0?void 0:r.outputEncoding)!==null&&o!==void 0?o:THREE__namespace.sRGBEncoding}),s.enableFragDepth?s.modelRenderTarget:null],s}return t.prototype.render=function(e){var r=this.renderer.getRenderTarget();this.enableFragDepth?(e&&(this.luminanceAdaptiveEffect.enable=!0,this.luminanceAdaptiveEffect.render(this.screenBuffers)),this.depthCopyPass.render(this.modelRenderTarget.depthTexture,r),this.renderer.autoClearDepth=!1,this.renderer.autoClearColor=!0,this.copyPass.render(this.modelRenderTarget,r),this.renderer.setRenderTarget(r),this.renderer.autoClearColor=!1,this.renderer.autoClearDepth=!1,this.renderer.render(this.scene,this.camera),this.renderer.autoClearColor=!0,this.renderer.autoClearDepth=!0):(this.luminanceAdaptiveEffect.enable=!0,this.luminanceAdaptiveEffect.render(this.screenBuffers),this.renderer.autoClearColor=!1,this.renderer.autoClearDepth=!1,this.renderer.render(this.scene,this.camera),this.renderer.autoClearColor=!0,this.renderer.autoClearDepth=!0),this.modelScene.needsRender=!0},t}(BaseRenderer),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/")},scratchSphere=new THREE__namespace.Sphere,scratchViewport=new THREE__namespace.Vector4,scratchScissor=new THREE__namespace.Vector4,scratchClearColor=new THREE__namespace.Color,scratchRenderSize=new THREE__namespace.Vector2,worksMap=new WeakMap,emptyWorks=createWorks([parseWork(null)]),Five=function(n){__extends(t,n);function t(e){e===void 0&&(e={});var r,o,s,u,l,c,p,f,d,h,g,A,m=n.call(this)||this;if(m.ident=createUuid(),typeof window!="undefined"&&(__FIVE_DEBUG__.instances[m.ident]=m),m.renderSwitch01=0,m.currentUpdateArgs={time:now(),args:[]},m.currentMode="Panorama",m.pano={workCode:"",panoIndex:0},m.needsRender=!1,m.modelSceneNeedsRender=!1,m.onlyRenderIfNeeds=(r=e.onlyRenderIfNeeds)!==null&&r!==void 0?r:!0,m.imageOptions=__assign({},(o=e.imageOptions)!==null&&o!==void 0?o:{}),m.textureOptions=__assign({},(s=e.textureOptions)!==null&&s!==void 0?s:{}),m.poweredByRealsee=(u=e.poweredByRealsee)!==null&&u!==void 0?u:!0,m.backgroundColor=new THREE__namespace.Color((l=e.backgroundColor)!==null&&l!==void 0?l:1579548),m.backgroundAlpha=(c=e.backgroundAlpha)!==null&&c!==void 0?c:1,m.extraElements=[],m.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)},m.fps={testCount:0,testTime:now()},m.modeChangeDuration=(p=e.modeChangeDuration)!==null&&p!==void 0?p:DEFAULT_MODE_CHANGE_DURATION,m.enableWheel=(f=e.enableWheel)!==null&&f!==void 0?f:!0,typeof window!="undefined")if("renderer"in e)e.renderer instanceof InternalWebGLRenderer&&m.throwError(new Error("cannot render a internal renderer")),m.renderer=e.renderer;else try{m.renderer=new InternalWebGLRenderer({preserveDrawingBuffer:e.preserveDrawingBuffer,antialias:e.antialias,webgl2:e.webgl2,logarithmicDepthBuffer:e.logarithmicDepthBuffer,precision:e.precision,powerPreference:e.powerPreference});var E=getViewportScale();m.renderer.setPixelRatio(E===1?window.devicePixelRatio:1),m.renderer.setSize(512,512),m.renderer.setClearColor(m.backgroundColor,m.backgroundAlpha)}catch(I){I instanceof Error&&m.throwError(I)}m.getPixelsRenderTarget=new THREE__namespace.WebGLRenderTarget(1,1,{encoding:(h=(d=m.renderer)===null||d===void 0?void 0:d.outputEncoding)!==null&&h!==void 0?h:THREE__namespace.sRGBEncoding,generateMipmaps:!1}),m.viewport=Object.assign({left:0,bottom:0,width:1,height:1},e.viewport),m.camera=new Camera(DEFAULT_CAMERA_FOV),m.scene=new Scene,m.xrCustomObjectsScene=new THREE__namespace.Scene,m.scene.add(m.xrCustomObjectsScene),m.scene.matrixAutoUpdate=!1,m.loadWorkTask=Promise.resolve(),m.requestProxy=(g=e.requestProxy)!==null&&g!==void 0?g:DEFAULT_REQUEST_PROXY,m.networkSubscribe=new NetworkSubscribe,m.networkSubscribe.on("network",function(I,O,L,N){var z;m.emit("network.resource",createEvent("network.resource",{source:I,requestType:O,requestState:L,detail:N})),(z=m.analysis)===null||z===void 0||z.network(m.works,I,O,L,N)}),m.boundingMesh=new BoundingMesh$1,m.boundingMesh.name="bounding",m.readyCallbacks=[],m.syncingState=!1,m.helperGroup=new THREE__namespace.Group,m.helperGroup.name="helper",m.helperGroup.matrixAutoUpdate=!1,m.scene.add(m.helperGroup);var v=new Model(emptyWorks[0]);worksMap.set(m,emptyWorks),m.modelScene=new ModelScene,m.modelScene.add(v),m.modelScene.add(m.boundingMesh),defineProperty(v,"loaded",{get:function(){return!1},set:function(I){}}),m.videoTexture=new THREE__namespace.VideoTexture(e.videoInstance||generateDefaultVideoElement());var y=initLights();m.scene.add(y);var b=new THREE__namespace.Group;defineProperty(b,"children",{get:function(){return y.children},set:function(I){y.children=I}}),defineProperty(b,"visible",{get:function(){return y.visible},set:function(I){y.visible=I}}),defineProperty(b,"name",{get:function(){return y.name},set:function(I){y.name=I}}),m.modelScene.add(b),m.state={mode:m.currentMode,workCode:m.pano.workCode,panoIndex:m.pano.panoIndex,longitude:m.camera.pose.longitude,latitude:m.camera.pose.latitude,fov:m.camera.pose.fov,offset:m.camera.pose.offset.clone(),distance:m.camera.pose.distance},m.stateSynced=!1,m.destroyed=!1,m.paused=!0,typeof window!="undefined"&&(e.play!==!1&&m.play(),m.stopAnimationLoop=AnimationFrameLoop.shared.add(function(I,O){for(var L=[],N=2;N<arguments.length;N++)L[N-2]=arguments[N];m.updateTime.apply(m,__spreadArray([I,O],L,!1))},!1,0,10));var T=function(){typeof document!="undefined"&&document.fullscreenElement===null&&m.currentMode==="VRPanorama"&&m.controller.emit("vr.requestExit",createEvent("vr.requestExit",{}))},_=function(){m.needsRender=!0,m.modelSceneNeedsRender=!0};if(typeof document!="undefined"&&document.addEventListener("fullscreenchange",T,!1),m.renderer&&m.renderer.domElement.addEventListener("webglcontextrestored",_,!1),m.removeEventListeners=function(){typeof document!="undefined"&&document.removeEventListener("fullscreenchange",T,!1),m.renderer&&m.renderer.domElement.removeEventListener("webglcontextrestored",_,!1)},m.plugins={},e.plugins&&e.plugins.length)for(var S=0,R=e.plugins;S<R.length;S++){var M=R[S];if(typeof M=="function")M(m);else if(Array.isArray(M)){var H=M[0],B=M[1],C=M[2];if(typeof H=="function"){var w=H(m,C);typeof B=="string"&&(m.plugins[B]?m.throwError(new Error("plugin name ".concat(B," is exists."))):m.plugins[B]=w)}}}return m.meshReplaceMaterialMap=new Map,m.meshOriginMaterialMap=new Map,initLegacyEvent(m),m.enableLayeringRendering=(A=e.enableLayeringRendering)!==null&&A!==void 0?A:!1,m._buildInRendererType="default",m._builtinRenderer=null,m}return Object.defineProperty(t,"version",{get:function(){return"6.5.1"},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.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.modelScene.parameter;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(),s.reset("pano0","pano1");for(var u=0,l=this.modelScene.children;u<l.length;u++){var c=l[u];c.dispose&&c.dispose(),this.modelScene.remove(c)}this.meshReplaceMaterialMap.forEach(function(p){p.dispose()}),this.meshOriginMaterialMap.forEach(function(p){p.dispose()}),this.renderer instanceof InternalWebGLRenderer&&this.renderer.forceContextLoss&&this.renderer.forceContextLoss()}},t.prototype.setViewport=function(e){Object.assign(this.viewport,e),this.needsRender=!0,this.modelSceneNeedsRender=!0},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}),t.prototype.getBuiltinRenderer=function(e){var r=this._builtinRenderer;if((r==null?void 0:r.type)!==this._buildInRendererType)switch(r&&r.dispose(),this._buildInRendererType){case"default":this._builtinRenderer=new DefaultRenderer({renderer:e,camera:this.camera,scene:this.scene,modelScene:this.modelScene,enableLayeringRendering:this.enableLayeringRendering});break;case"edl":this._builtinRenderer=new EDLRenderer({renderer:e,camera:this.camera,scene:this.scene,modelScene:this.modelScene,enableLayeringRendering:this.enableLayeringRendering});break;case"hq":this._builtinRenderer=new HQRenderer({renderer:e,camera:this.camera,scene:this.scene,modelScene:this.modelScene,enableLayeringRendering:this.enableLayeringRendering});break;case"luminance":this._builtinRenderer=new LuminanceRenderer({renderer:e,camera:this.camera,scene:this.scene,modelScene:this.modelScene,enableLayeringRendering:this.enableLayeringRendering});break}return this._builtinRenderer},Object.defineProperty(t.prototype,"renderEffect",{get:function(){return this._buildInRendererType},set:function(e){this._buildInRendererType=e,this.modelSceneNeedsRender=!0},enumerable:!1,configurable:!0}),t.prototype.updateConfiguration=function(e,r){r===void 0&&(r=!0);var o=!1;if(e.panorama&&(Object.assign(this.controllerInits.Panorama,omitUndefinedFields(e.panorama)),this.currentMode==="Panorama"&&(o=!0)),e.model&&(Object.assign(this.controllerInits.Model,omitUndefinedFields(e.model)),this.currentMode==="Model"&&(o=!0)),e.floorplan&&(Object.assign(this.controllerInits.Floorplan,omitUndefinedFields(e.floorplan)),this.currentMode==="Floorplan"&&(o=!0)),e.topview&&(Object.assign(this.controllerInits.Topview,omitUndefinedFields(e.topview)),this.currentMode==="Topview"&&(o=!0)),e.mapview&&(Object.assign(this.controllerInits.Mapview,omitUndefinedFields(e.mapview)),this.currentMode==="Mapview"&&(o=!0)),e.vrPanorama&&(Object.assign(this.controllerInits.VRPanorama,omitUndefinedFields(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){var s=this.controller.updateConfiguration(this.controllerInits[this.currentMode]);s||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,p=c===void 0?s.offsetHeight:c;this.renderer instanceof InternalWebGLRenderer&&(r&&this.renderer.setPixelRatio(r),this.renderer.setSize(l,p))}var f=new THREE__namespace.Vector2;this.renderer.getDrawingBufferSize(f),this.needsRender=!0,this.modelSceneNeedsRender=!0;var d=now(),h=d-this.currentUpdateArgs.time,g=this.currentUpdateArgs.args;this.updateTime(d,h,g)}}},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.getSize=function(e){if(!this.renderer)throw new Error("renderer is not initialized");return this.renderer.getSize(e),e.x*=this.viewport.width,e.y*=this.viewport.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.viewport.width,e.y*=this.viewport.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)},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,"models",{get:function(){return this.modelScene.models},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"model",{get:function(){return this.modelScene.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.loadWorkTask.then(function(){return isPromise(e)?e.then(function(c){return u.load_(c,r,o,s)}):u.load_(e,r,o,s)});return this.loadWorkTask=l.catch(function(c){u.throwError(c)}),l},t.prototype.load_=function(e,r,o,s){var u=this,l,c,p,f,d,h,g,A;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 E=[];if(Array.isArray(e))for(var v=0,y=e;v<y.length;v++){var b=y[v];typeof b!="string"&&"work"in b?E.push(parseWork(b.work,b)):E.push(parseWork(b))}else E.push(parseWork(e));for(var T=createWorks(E),_=function(W){var G=S,ne=new Fetcher({allowHosts:W.allowHosts,get requestProxy(){return G.requestProxy},get networkSubscribe(){return G.networkSubscribe}});registerFetcher(W,ne)},S=this,R=0,M=T;R<M.length;R++){var H=M[R];_(H)}r===void 0&&(r="inherit"),r==="inherit"&&this.works===emptyWorks&&(r="initial");var B=T.initial,C=B.work.observers[0],w=C?{workCode:C.work.workCode,panoIndex:C.panoIndex}:{workCode:B.work.workCode,panoIndex:0},I=(l=B.mode)!==null&&l!==void 0?l:C?"Panorama":"Mapview",O={};if(r==="inherit"){I=this.currentMode;var L=T.resolvedObservers[this.panoIndex];L?w={workCode:L.work.workCode,panoIndex:L.panoIndex}:typeof T.initial.panoIndex=="number"?w={workCode:T.initial.work.workCode,panoIndex:T.initial.panoIndex}:(I==="Panorama"||I==="VRPanorama"||I==="XRPanorama")&&(I="Mapview"),O={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 B.panoIndex=="number"&&(w={workCode:B.work.workCode,panoIndex:B.panoIndex}),B.mode&&(I=B.mode),O={longitude:B.longitude,latitude:B.latitude,fov:B.fov,distance:B.distance,offset:(c=B.offset)===null||c===void 0?void 0:c.clone()};else{if(I=(p=r.mode)!==null&&p!==void 0?p:this.currentMode,typeof r.panoIndex=="number"){var L=T.getResolvedObserver({workCode:(d=(f=r.workCode)!==null&&f!==void 0?f:B.work.workCode)!==null&&d!==void 0?d:"",panoIndex:r.panoIndex});L&&(w={workCode:L.work.workCode,panoIndex:L.panoIndex})}O={longitude:r.longitude,latitude:r.latitude,fov:r.fov,distance:r.distance,offset:r.offset}}var N=__assign(__assign(__assign({},w),{mode:I}),O),z=this.getCurrentState(),J=(h=m.duration)!==null&&h!==void 0?h:this.modeChangeDuration;(I==="Floorplan"||I==="Topview"||I==="Mapview")&&this.currentMode===I&&(J=0);var K="fly";(I==="Panorama"||I==="VRPanorama"||I==="XRPanorama")&&this.currentMode===I&&(K=(g=m.effect)!==null&&g!==void 0?g:"fade"),this.emit("works.request",createEvent("works.request",{input:e,works:T,state:N,userAction:s}));var Q=function(){u.pano=w;var W=__assign(__assign({initial:{state:N,currentState:z,duration:J,effect:K,userAction:s}},u.commonParams()),u.controllerInits[I]),G=Controllers[I].initAnimationEndState(W);if(u.controller&&u.currentMode===I)u.controller.updateWork(T,G,{effect:K,duration:J},s)===!1&&(u.controller.destroy(),u.controller=u.applyController(I,W));else{var ne=u.currentMode;if(u.controller)u.controller.destroy();else{var $=Controllers[I].initAnimationEndState(W);u.camera.setFromPose($),u.emit("camera.update",createEvent("camera.update",{state:u.getCurrentState(),userAction:s}))}u.controller=u.applyController(I,W);var ee=createEvent("mode.change",{prevMode:ne,mode:I,state:G,userAction:s});try{u.emit("mode.change",ee)}catch(re){console.error(re)}}u.updateTime(u.currentUpdateArgs.time,0,u.currentUpdateArgs.args)};worksMap.set(this,T);var U=Promise.resolve();if(I===t.Mode.Floorplan||I===t.Mode.Topview||I===t.Mode.Mapview||I===t.Mode.Model){this.modelScene.loaded===!1&&(this.camera.setFromPose(N),assignPose(this.state,this.camera.pose)),this.controller||(this.currentMode=I);var q=this.loadModels(T,m);U=Promise.all(q.map(function(W){return W.loadedReady})).then(function(){u.needsRender=!0,u.modelSceneNeedsRender=!0,Q(),u.emit("camera.update",createEvent("camera.update",{state:u.getCurrentState(),userAction:s}))})}else{Q();var X=!1;this.modelScene.autoRefine=!1;var Z=function(){u.works===T&&X===!1&&(u.needsRender=!0,u.modelSceneNeedsRender=!0,u.emit("camera.update",createEvent("camera.update",{state:u.getCurrentState(),userAction:s})),X=!0,u.modelScene.autoRefine=!0)},q=this.loadModels(T,m);U=Promise.all(q.map(function(G){return G.initReady})).then(noop$1),this.controller.once("pano.arrived",Z),this.controller.once("pano.cancel",Z),setTimeout(Z,((A=m.duration)!==null&&A!==void 0?A:this.modeChangeDuration)+1e3)}return this.emit("works.load",createEvent("works.load",{input:e,state:this.getCurrentState(),userAction:s,works:T})),U.then(function(){return u.ready()}).then(function(){var W;u.emit("works.ready",createEvent("works.ready",{input:e,state:u.getCurrentState(),userAction:s,works:T})),(W=u.analysis)===null||W===void 0||W.work(T)})},t.prototype.reset=function(){var e=this,r=this.loadWorkTask.then(function(){return e.reset_()});return this.loadWorkTask=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.controller.destroy(),e.controller=void 0);var s=e.modelScene.parameter;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(),s.set({pano0:null,pano1:null,modelAlpha:1}),e.renderer&&e.modelScene.update(e.renderer,e.camera);for(var u=0,l=e.modelScene.children;u<l.length;u++){var c=l[u];c instanceof Model&&(c.dispose(),e.modelScene.remove(c))}e.needsRender=!0,e.modelSceneNeedsRender=!0,worksMap.delete(e);var p=parseWork(null),f=new Model(p);f.work=p,worksMap.set(e,createWorks([p])),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.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,p){var f,d,h,g;if(!l.renderer)throw new Error("renderer is not initialized.");r=__assign({},r);var A=0;l.controller&&(typeof o=="number"?A=o:A=(f=o==null?void 0:o.duration)!==null&&f!==void 0?f:l.modeChangeDuration);var m="fly";l.controller&&typeof o=="object"&&o.effect&&(m=o.effect);var E=typeof r.panoIndex=="number"?{workCode:(g=(d=r.workCode)!==null&&d!==void 0?d:(h=l.work)===null||h===void 0?void 0:h.workCode)!==null&&g!==void 0?g:"",panoIndex:r.panoIndex}:l.pano;if(!t.Mode.hasOwnProperty(e)){var v=new Error('mode "'.concat(e,'" is not existed'));l.throwError(v),p(v);return}if((e===t.Mode.Panorama||e===t.Mode.VRPanorama||e===t.Mode.XRPanorama)&&!l.works.getResolvedObserver(E)){var v=new Error("PanoId ".concat(panoStringify(E)," not existed."));l.throwError(v),p(v);return}(e===t.Mode.Floorplan||e===t.Mode.Topview||e===t.Mode.Mapview||e===t.Mode.Model)&&(l.modelScene.loaded||(A=0));var y=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,E)&&"moveToPano"in l.controller&&typeof l.controller.moveToPano=="function"?l.controller.moveToPano(E,__assign({duration:A},r),s):l.controller.updateCamera(r,A,s).catch(noop$1):(panoEqual(l.pano,E)||(l.pano=E),l.controller.updateCamera(r,A,s).catch(noop$1));else{var S=__assign(__assign({},r),E),R=__assign(__assign({initial:{state:S,currentState:l.getCurrentState(),duration:A,effect:m,userAction:s}},l.commonParams()),l.controllerInits[e]),M=Controllers[e].initAnimationEndState(R),H=createEvent("mode.change.request",{prevMode:l.currentMode,mode:e,state:M,userAction:s});if(l.emit("mode.change.request",H),!H.defaultPrevented){y&&y.destroy(),l.controller=l.applyController(e,R);var B=createEvent("mode.change",{prevMode:l.currentMode,mode:e,state:M,userAction:s});l.emit("mode.change",B)}}c()};if(e===t.Mode.VRPanorama)l.requestFullscreen(),requestDeviceOrientationPermission().then(function(){return T()}).catch(function(S){S instanceof Error&&(l.exitFullscreen(),l.throwError(S),p(S))});else if(e===t.Mode.XRPanorama){var _=AnimationFrameLoop.shared.getContext();_?_.end():requestXRSessionPermission().then(function(S){AnimationFrameLoop.shared.setContext(S),T()}).catch(function(S){S instanceof Error&&(l.throwError(S),p(S))})}else T()})},t.prototype.getPixels=function(e,r,o,s,u,l,c){if(!this.renderer)throw new Error("renderer is not initialized.");var p=this.renderer.getPixelRatio(),f=this.renderer.getRenderTarget(),d=this.renderer.getSize(new THREE__namespace.Vector2),h=0,g=0,A=1,m=1,E,v,y,b,T;typeof e=="number"?(h=e,typeof r=="number"&&(g=r),typeof o=="number"&&(A=o),typeof s=="number"&&(m=s),E=u,v=l,T=c):(h=e.x,g=e.y,A=e.width,m=e.height,E=e.pixelRatio,v=e.flipY,y=e.helperVisible,b=e.skipPanorama,T=e.buffer),h=Math.ceil(h),g=Math.ceil(g),A=Math.ceil(A),m=Math.ceil(m),E=Math.ceil(E!=null?E:p),v=v!=null?v:!1;var _=this.helperVisible,S=this.modelScene.parameter.modelAlpha;this.helperVisible=y!=null?y:this.helperVisible,b&&(this.controller instanceof Controllers.Panorama||this.controller instanceof Controllers.VRPanorama||this.controller instanceof Controllers.XRPanorama)&&b===!0&&this.modelScene.parameter.set("modelAlpha",1),this.modelScene.update(this.renderer,this.camera);var R=this.getPixelsRenderTarget;R.setSize(A*E,m*E),this.renderer.setRenderTarget(R),this.camera.pixelRatio=E,this.camera.resolution.set(A,m),this.camera.setViewOffset(d.width,d.height,h,d.height-g-m,A,m),this.scene.update(this.renderer,this.camera),this.render(),this.helperVisible=_,S===void 0?this.modelScene.parameter.reset("modelAlpha"):this.modelScene.parameter.set("modelAlpha",S),this.renderer.setRenderTarget(f),this.camera.clearViewOffset(),this.camera.pixelRatio=p,this.getSize(this.camera.resolution),this.camera.aspect=this.camera.resolution.width/this.camera.resolution.height,this.modelScene.update(this.renderer,this.camera),this.scene.update(this.renderer,this.camera);var M=A*E,H=m*E,B=M*H,C=B*4;if(T){if(T.length!==C)throw new Error("buffer length is not equals pixels ".concat(C))}else T=new Uint8Array(C);if(this.renderer.readRenderTargetPixels(R,0,0,A*E,m*E,T),v)for(var w=B/2,I=0,O=0,L=0,N=0;O<w;O++)for(N=(H-Math.floor(O/M)-1)*M+O%M,L=0;L<4;L++)I=T[O*4+L],T[O*4+L]=T[N*4+L],T[N*4+L]=I;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){var r=this.renderer;if(r){var o=r.getRenderTarget(),s=r.autoClear,u=r.autoClearColor,l=r.autoClearDepth,c=r.autoClearStencil,p=scratchClearColor.copy(r.getClearColor()),f=r.getClearAlpha(),d=r.getViewport(scratchViewport),h=r.getScissor(scratchScissor),g=r.getScissorTest(),A=r.getSize(scratchRenderSize),m=r.getPixelRatio(),E=Math.floor(A.x*this.viewport.left),v=Math.floor(A.y*this.viewport.bottom),y=Math.floor(A.x*this.viewport.width),b=Math.floor(A.y*this.viewport.height);r.setClearColor(this.backgroundColor,this.backgroundAlpha),r.setViewport(E,v,y,b),r.setScissor(E,v,y,b),r.setScissorTest(!0);var T=this.scene.background;this.modelScene.background=this.camera.isOrthographicCamera?null:T,this.modelScene.environment=this.scene.environment,this.scene.background=null;var _=this.getBuiltinRenderer(r);_.setSize(A.x,A.y,m),this.controller?this.controller.render(_,this.onlyRenderIfNeeds?this.modelSceneNeedsRender:!0):_.render(this.onlyRenderIfNeeds?this.modelSceneNeedsRender:!0),this.scene.background=T,this.modelScene.background=null,this.modelScene.environment=null,this.poweredByRealsee&&this.currentMode!=="VRPanorama"&&this.currentMode!=="XRPanorama"&&r.getRenderTarget()!==this.getPixelsRenderTarget&&renderPoweredByRealsee(r),r.setRenderTarget(o),r.autoClear=s,r.autoClearColor=u,r.autoClearDepth=l,r.autoClearStencil=c,r.setClearColor(p,f),r.setViewport(d),r.setScissor(h),r.setScissorTest(g),e&&AnimationFrameLoop.shared.add(e,!0)}},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.currentUpdateArgs={time:e,args:u},!this.destroyed){if(this.renderer&&ktx2.detectSupport(this.renderer),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.autoNearFar){var c=this.modelScene.boundingBox.getBoundingSphere(scratchSphere),p=c.radius*2;c.containsPoint(this.camera.position)||(p=this.camera.position.distanceTo(c.center)+c.radius),p=clamp$1(p,800,5e4),this.camera.far!==p&&(this.camera.far=p);var f=p/1e4;f=clamp$1(f,.03,.1),this.camera.near!==f&&(this.camera.near=f)}if(this.camera.controllerMode=this.currentMode,this.camera.updateTime(e),this.renderer){var d=this.modelScene.loaded,h=this.modelScene.refined;if(this.modelScene.loaded){for(var g=[],A=0,m=this.modelScene.children;A<m.length;A++){var E=m[A];E instanceof Model&&E.outdated&&g.push(E)}for(var v=0,y=g;v<y.length;v++){var b=y[v];this.modelScene.remove(b),b.dispose()}if(g.length>0)for(var T=0,_=this.modelScene.children;T<_.length;T++){var E=_[T];E instanceof Model&&(E.visible=!0,this.modelSceneNeedsRender=!0)}}this.modelScene.update(this.renderer,this.camera),d===!1&&this.modelScene.loaded===!0&&(this.controller&&this.controller.updateModel(this.modelScene),AnimationFrameLoop.shared.add(function(){s.emit("models.load",createEvent("models.load",{modelScene:s.modelScene}))},!0,0,10)),h===!1&&this.modelScene.refined===!0&&AnimationFrameLoop.shared.add(function(){s.emit("models.refined",createEvent("models.refined",{modelScene:s.modelScene}))},!0,0,10)}this.renderer&&this.scene.update(this.renderer,this.camera),this.syncingState=!1,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.modelScene.needsRender===!0&&(this.modelScene.needsRender=!1,this.needsRender=!0,this.modelSceneNeedsRender=!0),this.scene.needsRender===!0&&(this.scene.needsRender=!1,this.needsRender=!0),this.onlyRenderIfNeeds!==!0&&(this.needsRender=!0,this.modelSceneNeedsRender=!0),this.modelSceneNeedsRender===!0&&(this.needsRender=!0);var S=this.camera.resolution.width*this.camera.pixelRatio*this.camera.resolution.height*this.camera.pixelRatio;S>4096*2048?this.renderSwitch01=this.renderSwitch01^1:this.renderSwitch01=0,this.renderSwitch01!==0&&(this.needsRender=!1),this.paused===!0&&(this.needsRender=!1);var R=createEvent("render.prepare",{needsRender:this.needsRender});this.emit("render.prepare",R),R.defaultPrevented&&(this.needsRender=!1),this.renderer&&this.needsRender&&this.render(),this.emit("render",createEvent("render",{needsRender:this.needsRender})),this.needsRender=!1,this.modelSceneNeedsRender=!1,this.hasListener("fps")&&(this.fps.testTime&&e-this.fps.testTime<1e3?this.fps.testCount++:(this.emit("fps",this.fps.testCount),this.fps.testTime=e,this.fps.testCount=0))}},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 p={workCode:c.work.workCode,panoIndex:c.panoIndex};return"moveToPano"in u&&typeof u.moveToPano=="function"?u.moveToPano(p,r,o):c&&(this.pano=p,this.once("initAnimation.start",function(f){r.moveStartCallback&&r.moveStartCallback(f.state)}),this.once("initAnimation.end",function(f){r.moveEndCallback&&r.moveEndCallback(f.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 p=__assign({key:"pano.".concat(s.panoId,".").concat(c)},pick(o.imageOptions,["size","format","quality","mappings"])),f=s.images[c],d=o.imageOptions.transform?o.imageOptions.transform(f,p):imageURL(f,p);return getFetcher(s.work).preload(d)})).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(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.modelScene.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 p=this.renderer.getSize(new THREE__namespace.Vector2),f=p.x*this.viewport.width,d=p.y*this.viewport.height,h=p.x*this.viewport.left+(c.x+1)/2*f,g=p.y*(1-this.viewport.bottom-this.viewport.height)+(-c.y+1)/2*d;return new THREE__namespace.Vector2(h,g)},t.prototype.getCurrentState=function(){return __assign(__assign({},this.camera.copyPose()),{mode:this.currentMode,workCode:this.pano.workCode,panoIndex:this.pano.panoIndex})},t.prototype.setState=function(e,r,o){var s,u,l,c,p,f,d,h,g,A;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 E=(u=(s=this.work)===null||s===void 0?void 0:s.workCode)!==null&&u!==void 0?u:"",v=this.state.workCode;this.works.filter(function(w){return w.workCode===v}).length>0&&(E=v),m={workCode:E,panoIndex:e.panoIndex}}var y=(l=e.mode)!==null&&l!==void 0?l:this.state.mode,b,T,_,S,R;if(this.controller&&this.controller.stopMomentumMovement(),this.state.mode!==y){if(y==="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 H=__assign(__assign({initial:{state:M,currentState:this.getCurrentState(),duration:this.modeChangeDuration,effect:"fly",userAction:!1}},this.commonParams()),this.controllerInits[y]),B=Controllers[y].initAnimationEndState(H);b=B.longitude,T=B.latitude,_=B.fov,S=B.offset,R=B.distance}else b=(c=e.longitude)!==null&&c!==void 0?c:this.state.longitude,T=(p=e.latitude)!==null&&p!==void 0?p:this.state.latitude,_=(f=e.fov)!==null&&f!==void 0?f:this.state.fov,S=(d=e.offset)!==null&&d!==void 0?d:this.state.offset,R=(h=e.distance)!==null&&h!==void 0?h:this.state.distance;var C={workCode:(m!=null?m:this.pano).workCode,panoIndex:(m!=null?m:this.pano).panoIndex,mode:y,longitude:b,latitude:T,fov:_,offset:S,distance:R};this.emit("state.set",createEvent("state.set",{userAction:o,state:C})),stateEqual(this.state,C)||(this.controller&&C.mode==="VRPanorama"&&C.mode!==this.state.mode?(assignState(this.state,C),this.changeMode("VRPanorama")):this.controller&&C.mode==="XRPanorama"&&C.mode!==this.state.mode?(assignState(this.state,C),this.changeMode("XRPanorama")):(assignState(this.state,C),this.controller&&o&&(this.controller.userAction=!1),r&&this.state.mode===C.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})),(A=this.analysis)===null||A===void 0||A.state(this.works,this.state)))},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 p=1,f=.2,d=.2,h=Math.PI/45,g=o?this.state.fov:stepNumber(this.camera.pose.fov,this.state.fov,p),A=Math.abs(this.camera.pose.distance-this.state.distance),m=A>d*15?A/15:f,E=o?this.state.distance:stepNumber(this.camera.pose.distance,this.state.distance,m),v=this.camera.pose.offset.distanceTo(this.state.offset),y=v>d*15?v/15:d,b=o?new THREE__namespace.Vector3().copy(this.state.offset):stepVector(this.camera.pose.offset,this.state.offset,y),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},h),_=T.longitude,S=T.latitude;if(notSimilarValue(g,this.camera.pose.fov)||notSimilarVector3(b,this.camera.pose.offset)||notSimilarValue(E,this.camera.pose.distance)||notSimilarValue(_,this.camera.pose.longitude,Math.PI*2)||notSimilarValue(S,this.camera.pose.latitude)){var R={x:b.x,y:b.y,z:b.z},M={fov:g};return Object.assign(R,{distance:E}),Object.assign(M,{longitude:_,latitude:S}),this.controller.stopMomentumMovement(),this.controller.cameraMotion.set(M,0).catch(noop$1),this.controller.locationMotion.set(R,0).catch(noop$1),!0}}else{var H=1,B=Math.PI/45,g=o?this.state.fov:stepNumber(this.camera.pose.fov,this.state.fov,H),C=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},B),_=C.longitude,S=C.latitude,E=this.state.distance,b=new THREE__namespace.Vector3().copy(this.state.offset);if(notSimilarValue(E,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(S,this.camera.pose.latitude)||notSimilarValue(g,this.camera.pose.fov))return this.controller.stopMomentumMovement(),this.controller.cameraMotion.set({longitude:_,latitude:S,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 w=this.currentMode,I=w===t.Mode.Floorplan||w===t.Mode.Topview||w===t.Mode.Mapview||w===t.Mode.Model;if(!I||this.modelScene.loaded){var O=this.readyCallbacks.slice();this.readyCallbacks.length=0;for(var L=0,N=O;L<N.length;L++){var z=N[L];this.controller instanceof Controllers.Panorama&&z.tile===!0&&!this.controller.isTileReady()?this.readyCallbacks.push(z):z()}}}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}))}).then(function(){return r.model.initReady})},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.loadModels=function(e,r){for(var o=this,s,u,l,c,p,f,d=new Map,h=!1,g=[],A=0,m=this.modelScene.children;A<m.length;A++){var E=m[A];E instanceof Model&&(E.outdated=!0,d.set(E.work.workCode,E),h=!0)}for(var v=function(T){var _=e[T],S=_.workCode&&d.get(_.workCode);if(S)S.work=_,S.outdated=!1,d.delete(_.workCode),g.push(S);else{var R=(l=(u=(s=r.model)===null||s===void 0?void 0:s.textureOptions)!==null&&u!==void 0?u:r.textureOptions)!==null&&l!==void 0?l:y.textureOptions,M=(p=(c=r.model)===null||c===void 0?void 0:c["3d-tiles"])!==null&&p!==void 0?p:r["3d-tiles"],H=new Model(_,{light:(f=r.model)===null||f===void 0?void 0:f.light,textureOptions:R});H.initReady.then(function(){if(M)if(typeof M=="function")for(var B=0,C=H.viewLayers;B<C.length;B++){var w=C[B],I=M(w,H,T);I&&(I.viewerRequestVolume&&(w.viewerRequestVolume=makeBoundingVolume(I.viewerRequestVolume)),w.parameter.set(omit(I,["showLayers"])),I.showLayers===!1?w.visible=!1:Array.isArray(I.showLayers)&&(w.visible=I.showLayers.includes(w.name)))}else for(var O=0,L=H.viewLayers;O<L.length;O++){var w=L[O];M.viewerRequestVolume&&(w.viewerRequestVolume=makeBoundingVolume(M.viewerRequestVolume)),w.parameter.set(omit(M,["showLayers"])),M.showLayers===!1?w.visible=!1:Array.isArray(M.showLayers)&&(w.visible=M.showLayers.includes(w.name))}}),g.push(H),h&&(H.visible=!1),y.modelScene.add(H),H.addEventListener("load",function(B){AnimationFrameLoop.shared.add(function(){o.emit("model.load",createEvent("model.load",{work:_,model:H,error:null}))},!0)}),H.addEventListener("changeShownFloor",function(B){o.emit("model.changeShownFloor",createEvent("model.changeShownFloor",{work:_,model:H,error:null}))}),H.addEventListener("error",function(B){var C=B.error;o.emit("model.error",createEvent("model.error",{work:_,model:H,error:C})),o.throwError(C)}),y.emit("model.request",createEvent("model.request",{work:_,model:H,error:null}))}},y=this,b=0;b<e.length;b++)v(b);return this.modelScene.loaded=!1,this.modelScene.refined=!1,g},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,viewport:this.viewport,element:this.getElement(),works:this.works,imageOptions:this.imageOptions,enableWheel:this.enableWheel,extraElements:this.extraElements,videoTexture:this.videoTexture,modelScene:this.modelScene}},t.prototype.applyController=function(e,r){var o=this;if(!this.renderer)throw new Error("renderer is not initialized.");var s=Controllers[e];this.currentMode=e;for(var u=new s(r),l=function(g){u.on(g,function(){for(var A=[],m=0;m<arguments.length;m++)A[m]=arguments[m];var E=o.emit.apply(o,__spreadArray([g],A,!1));if(E)return!1})},c=0,p=PROXY_CONTROLLER_EVENT_NAMES;c<p.length;c++){var f=p[c];l(f)}{var d=Controllers[e].initAnimationEndState(r),h=r.initial.userAction;stateEqual(this.state,d)||(assignState(this.state,d),this.emit("state.change",createEvent("state.change",{userAction:h,state:this.state}))),this.emit("currentState.change",createEvent("currentState.change",{userAction:h,state:this.getCurrentState()}))}return u.on("camera.update",function(g){var A;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})),(A=o.analysis)===null||A===void 0||A.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 A,m=g.state,E=g.userAction;E&&o.state.mode===m.mode&&!stateEqual(o.state,m)&&(assignState(o.state,m),o.emit("state.change",createEvent("state.change",{userAction:E,state:o.state})),(A=o.analysis)===null||A===void 0||A.state(o.works,o.state))}),u.on("initAnimation.end",function(g){var A,m=g.state,E=g.userAction;o.pano={workCode:m.workCode,panoIndex:m.panoIndex},E&&o.state.mode===m.mode&&!stateEqual(o.state,m)&&(assignState(o.state,m),o.emit("state.change",createEvent("state.change",{userAction:E,state:o.state})),(A=o.analysis)===null||A===void 0||A.state(o.works,o.state))}),u.on("pano.moveTo",function(g){var A,m=g.state,E=g.userAction;o.pano={workCode:m.workCode,panoIndex:m.panoIndex},E&&o.state.mode===m.mode&&!stateEqual(o.state,m)&&(assignState(o.state,m),o.emit("state.change",createEvent("state.change",{userAction:E,state:o.state})),(A=o.analysis)===null||A===void 0||A.state(o.works,o.state))}),u.on("pano.arrived",function(g){var A,m=g.state,E=g.userAction;o.pano={workCode:m.workCode,panoIndex:m.panoIndex},E&&o.state.mode===m.mode&&!stateEqual(o.state,m)&&(assignState(o.state,m),o.emit("state.change",createEvent("state.change",{userAction:E,state:o.state})),(A=o.analysis)===null||A===void 0||A.state(o.works,o.state))}),u.on("pano.cancel",function(g){var A,m=g.state,E=g.userAction;E&&o.state.mode===m.mode&&!stateEqual(o.state,m)&&(assignState(o.state,m),o.emit("state.change",createEvent("state.change",{userAction:E,state:o.state})),(A=o.analysis)===null||A===void 0||A.state(o.works,o.state))}),u.on("pano.moveTo",function(g){var A=g.userAction;o.emit("currentState.change",createEvent("currentState.change",{userAction:A,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(){},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),r=this.modelScene.children.find(function(o){return o.name==="internalLights"}),r&&(r.visible=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"scissor",{get:function(){return this.viewport},enumerable:!1,configurable:!0}),t.prototype.setScissor=function(e){return this.setViewport(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.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,"enableIOSEDR",{get:function(){return!1},set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enableEDL",{get:function(){return this.renderEffect==="edl"},set:function(e){this.renderEffect=e?"edl":"default"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enableHQ",{get:function(){return this.renderEffect==="hq"},set:function(e){this.renderEffect=e?"hq":"default"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enablePostProcessing",{get:function(){return!1},set:function(e){},enumerable:!1,configurable:!0}),t.Mode={Panorama:"Panorama",Model:"Model",Floorplan:"Floorplan",Topview:"Topview",Mapview:"Mapview",VRPanorama:"VRPanorama",XRPanorama:"XRPanorama"},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=PBMCustomShader;exports.Fetcher=Fetcher;exports.Five=Five;exports.InternalWebGLRenderer=InternalWebGLRenderer;exports.Model=Model;exports.ModelScene=ModelScene;exports.Motion=Motion;exports.NetworkSubscribe=NetworkSubscribe;exports.PBMContainer=PBMContainer;exports.PBMCustomShader=PBMCustomShader;exports.PBMGroup=PBMGroup;exports.PBMMesh=PBMMesh;exports.PBMMeshMaterial=PBMMeshMaterial;exports.PBMPointCloud=PBMPointCloud;exports.PBMPointCloudMaterial=PBMPointCloudMaterial;exports.PBMSkinnedMesh=PBMSkinnedMesh;exports.PROXY_CONTROLLER_EVENT_NAMES=PROXY_CONTROLLER_EVENT_NAMES;exports.PanoCircleMesh=PanoCircleMesh;exports.PanoCircleMeshCustom=PanoCircleMeshCustom;exports.PanoCircleMeshSolid=PanoCircleMeshSolid;exports.Parameter=Parameter;exports.Scene=Scene;exports.Subscribe=Subscribe;exports.TextureLoader=TextureLoader;exports.Tile=Tile;exports.Tile3DModel=Tile3D;exports.TileCache=TileCache;exports.TileNode=TileNode;exports.TileRequestScheduler=TileRequestScheduler;exports.Tileset=Tileset;exports.Trajectory=Trajectory;exports.TrajectoryNode=TrajectoryNode;exports.Work=Work;exports.XRButton=XRButton;exports.controllersDefaultInitArgs=controllersDefaultInitArgs;exports.createDebugBoundingMesh=createDebugBoundingMesh;exports.createWorks=createWorks;exports.defaultImageURLTransform=imageURL;exports.draco=draco;exports.getFetcher=getFetcher;exports.getViewportScale=getViewportScale;exports.imageSupport=imageSupport;exports.isBoundingVolume=isBoundingVolume;exports.isPanoId=isPanoId;exports.ktx2=ktx2;exports.loadAt3d=loadAt3d;exports.loadB3dm=loadB3dm;exports.loadDome=loadDome;exports.loadDomez=loadDomez;exports.loadFbx=loadFbx;exports.loadGltf=loadGltf;exports.loadPbm=loadPbm;exports.loadPly=loadPly;exports.loadPnts=loadPnts;exports.loadX3p=loadX3p;exports.makeBoundingVolume=makeBoundingVolume;exports.panoEqual=panoEqual;exports.panoParse=panoParse;exports.panoStringify=panoStringify;exports.parseWork=parseWork;exports.registerFetcher=registerFetcher;exports.workRawMapping=workRawMapping;
|
|
2247
|
+
`})||this;return r.material.transparent=!0,r}return Object.defineProperty(t.prototype,"luminanceAdaptiveBuffer",{get:function(){return this.material.uniforms.luminanceAdaptiveBuffer.value},set:function(e){this.material.uniforms.luminanceAdaptiveBuffer.value=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"progress",{get:function(){return this.material.uniforms.progress.value},set:function(e){this.material.uniforms.progress.value=e},enumerable:!1,configurable:!0}),t}(Pass),LuminanceAdaptiveEffect=function(n){__extends(t,n);function t(e,r,o,s){var u=n.call(this,e,r,o,s)||this;return u.enableTime=now(),u.renderer=e,u.valuePass=new ValuePass(u.renderer),u.luminancePass=new LuminancePass(u.renderer,Math.sqrt(1/3)),u.nextStepPass=new NextStepPass(u.renderer,.01),u.luminanceAdaptivePass=new LuminanceAdaptivePass(u.renderer),u}return t.prototype.render=function(e){this.renderer.setRenderTarget(e[0]),this.renderer.render(this.scene,this.camera),this.enableTime===null&&(this.enableTime=now()),this.luminanceTargetBuffer||(this.luminanceTargetBuffer=new THREE__namespace.WebGLRenderTarget(128,128,{minFilter:THREE__namespace.LinearMipmapLinearFilter,magFilter:THREE__namespace.LinearFilter,encoding:this.renderer.outputEncoding,stencilBuffer:!1,depthBuffer:!1,format:THREE__namespace.RGBAFormat,generateMipmaps:!0}),this.nextStepPass.targetBuffer=this.luminanceTargetBuffer.texture),this.luminancePass.render(e[0],this.luminanceTargetBuffer),this.luminancePrevBuffer||(this.luminancePrevBuffer=new THREE__namespace.WebGLRenderTarget(1,1,{minFilter:THREE__namespace.NearestFilter,magFilter:THREE__namespace.NearestFilter,type:THREE__namespace.HalfFloatType,encoding:this.renderer.outputEncoding,stencilBuffer:!1,depthBuffer:!1}),this.valuePass.render(new THREE__namespace.Vector3(.5,.5,.5),this.luminancePrevBuffer)),this.luminanceNextBuffer||(this.luminanceNextBuffer=new THREE__namespace.WebGLRenderTarget(1,1,{minFilter:THREE__namespace.NearestFilter,magFilter:THREE__namespace.NearestFilter,type:THREE__namespace.HalfFloatType,encoding:this.renderer.outputEncoding,stencilBuffer:!1,depthBuffer:!1}),this.valuePass.render(new THREE__namespace.Vector3(.5,.5,.5),this.luminanceNextBuffer),this.luminanceAdaptivePass.luminanceAdaptiveBuffer=this.luminanceNextBuffer.texture),this.copyPass.render(this.luminanceNextBuffer,this.luminancePrevBuffer),this.nextStepPass.render(this.luminancePrevBuffer,this.luminanceNextBuffer),this.luminanceAdaptivePass.progress=Math.min((now()-this.enableTime)/100,1),this.luminanceAdaptivePass.render(e[0],e[1])},t.prototype.dispose=function(){var e,r,o;(e=this.luminanceTargetBuffer)===null||e===void 0||e.dispose(),(r=this.luminancePrevBuffer)===null||r===void 0||r.dispose(),(o=this.luminanceNextBuffer)===null||o===void 0||o.dispose(),this.copyPass.dispose(),this.luminancePass.dispose(),this.nextStepPass.dispose(),this.luminanceAdaptivePass.dispose()},t}(Effect),sharedV2=new THREE__namespace.Vector2,LuminanceRenderer=function(n){__extends(t,n);function t(e){var r,o,s=n.call(this,e)||this;s.type="default",s.luminanceAdaptiveEffect=new LuminanceAdaptiveEffect(s.renderer,s.modelScene,s.camera,s.modelScene);var u=s.renderer.getDrawingBufferSize(sharedV2);return s.screenBuffers=[new THREE__namespace.WebGLRenderTarget(u.x,u.y,{generateMipmaps:!1,encoding:(o=(r=s.renderer)===null||r===void 0?void 0:r.outputEncoding)!==null&&o!==void 0?o:THREE__namespace.sRGBEncoding}),s.enableFragDepth?s.modelRenderTarget:null],s}return t.prototype.render=function(e){var r=this.renderer.getRenderTarget();this.enableFragDepth?(e&&(this.luminanceAdaptiveEffect.enable=!0,this.luminanceAdaptiveEffect.render(this.screenBuffers)),this.depthCopyPass.render(this.modelRenderTarget.depthTexture,r),this.renderer.autoClearDepth=!1,this.renderer.autoClearColor=!0,this.copyPass.render(this.modelRenderTarget,r),this.renderer.setRenderTarget(r),this.renderer.autoClearColor=!1,this.renderer.autoClearDepth=!1,this.renderer.render(this.scene,this.camera),this.renderer.autoClearColor=!0,this.renderer.autoClearDepth=!0):(this.luminanceAdaptiveEffect.enable=!0,this.luminanceAdaptiveEffect.render(this.screenBuffers),this.renderer.autoClearColor=!1,this.renderer.autoClearDepth=!1,this.renderer.render(this.scene,this.camera),this.renderer.autoClearColor=!0,this.renderer.autoClearDepth=!0),this.modelScene.needsRender=!0},t}(BaseRenderer),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/")},scratchSphere=new THREE__namespace.Sphere,scratchViewport=new THREE__namespace.Vector4,scratchScissor=new THREE__namespace.Vector4,scratchClearColor=new THREE__namespace.Color,scratchRenderSize=new THREE__namespace.Vector2,worksMap=new WeakMap,emptyWorks=createWorks([parseWork(null)]),Five=function(n){__extends(t,n);function t(e){e===void 0&&(e={});var r,o,s,u,l,c,p,f,d,h,g,A,m=n.call(this)||this;if(m.ident=createUuid(),typeof window!="undefined"&&(__FIVE_DEBUG__.instances[m.ident]=m),m.renderSwitch01=0,m.currentUpdateArgs={time:now(),args:[]},m.currentMode="Panorama",m.pano={workCode:"",panoIndex:0},m.needsRender=!1,m.modelSceneNeedsRender=!1,m.onlyRenderIfNeeds=(r=e.onlyRenderIfNeeds)!==null&&r!==void 0?r:!0,m.imageOptions=__assign({},(o=e.imageOptions)!==null&&o!==void 0?o:{}),m.textureOptions=__assign({},(s=e.textureOptions)!==null&&s!==void 0?s:{}),m.poweredByRealsee=(u=e.poweredByRealsee)!==null&&u!==void 0?u:!0,m.backgroundColor=new THREE__namespace.Color((l=e.backgroundColor)!==null&&l!==void 0?l:1579548),m.backgroundAlpha=(c=e.backgroundAlpha)!==null&&c!==void 0?c:1,m.extraElements=[],m.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)},m.fps={testCount:0,testTime:now()},m.modeChangeDuration=(p=e.modeChangeDuration)!==null&&p!==void 0?p:DEFAULT_MODE_CHANGE_DURATION,m.enableWheel=(f=e.enableWheel)!==null&&f!==void 0?f:!0,typeof window!="undefined")if("renderer"in e)e.renderer instanceof InternalWebGLRenderer&&m.throwError(new Error("cannot render a internal renderer")),m.renderer=e.renderer;else try{m.renderer=new InternalWebGLRenderer({preserveDrawingBuffer:e.preserveDrawingBuffer,antialias:e.antialias,webgl2:e.webgl2,logarithmicDepthBuffer:e.logarithmicDepthBuffer,precision:e.precision,powerPreference:e.powerPreference});var E=getViewportScale();m.renderer.setPixelRatio(E===1?window.devicePixelRatio:1),m.renderer.setSize(512,512),m.renderer.setClearColor(m.backgroundColor,m.backgroundAlpha)}catch(I){I instanceof Error&&m.throwError(I)}m.getPixelsRenderTarget=new THREE__namespace.WebGLRenderTarget(1,1,{encoding:(h=(d=m.renderer)===null||d===void 0?void 0:d.outputEncoding)!==null&&h!==void 0?h:THREE__namespace.sRGBEncoding,generateMipmaps:!1}),m.viewport=Object.assign({left:0,bottom:0,width:1,height:1},e.viewport),m.camera=new Camera(DEFAULT_CAMERA_FOV),m.scene=new Scene,m.xrCustomObjectsScene=new THREE__namespace.Scene,m.scene.add(m.xrCustomObjectsScene),m.scene.matrixAutoUpdate=!1,m.loadWorkTask=Promise.resolve(),m.requestProxy=(g=e.requestProxy)!==null&&g!==void 0?g:DEFAULT_REQUEST_PROXY,m.networkSubscribe=new NetworkSubscribe,m.networkSubscribe.on("network",function(I,O,L,N){var z;m.emit("network.resource",createEvent("network.resource",{source:I,requestType:O,requestState:L,detail:N})),(z=m.analysis)===null||z===void 0||z.network(m.works,I,O,L,N)}),m.boundingMesh=new BoundingMesh$1,m.boundingMesh.name="bounding",m.readyCallbacks=[],m.syncingState=!1,m.helperGroup=new THREE__namespace.Group,m.helperGroup.name="helper",m.helperGroup.matrixAutoUpdate=!1,m.scene.add(m.helperGroup);var v=new Model(emptyWorks[0]);worksMap.set(m,emptyWorks),m.modelScene=new ModelScene,m.modelScene.add(v),m.modelScene.add(m.boundingMesh),defineProperty(v,"loaded",{get:function(){return!1},set:function(I){}}),m.videoTexture=new THREE__namespace.VideoTexture(e.videoInstance||generateDefaultVideoElement());var y=initLights();m.scene.add(y);var b=new THREE__namespace.Group;defineProperty(b,"children",{get:function(){return y.children},set:function(I){y.children=I}}),defineProperty(b,"visible",{get:function(){return y.visible},set:function(I){y.visible=I}}),defineProperty(b,"name",{get:function(){return y.name},set:function(I){y.name=I}}),m.modelScene.add(b),m.state={mode:m.currentMode,workCode:m.pano.workCode,panoIndex:m.pano.panoIndex,longitude:m.camera.pose.longitude,latitude:m.camera.pose.latitude,fov:m.camera.pose.fov,offset:m.camera.pose.offset.clone(),distance:m.camera.pose.distance},m.stateSynced=!1,m.destroyed=!1,m.paused=!0,typeof window!="undefined"&&(e.play!==!1&&m.play(),m.stopAnimationLoop=AnimationFrameLoop.shared.add(function(I,O){for(var L=[],N=2;N<arguments.length;N++)L[N-2]=arguments[N];m.updateTime.apply(m,__spreadArray([I,O],L,!1))},!1,0,10));var T=function(){typeof document!="undefined"&&document.fullscreenElement===null&&m.currentMode==="VRPanorama"&&m.controller.emit("vr.requestExit",createEvent("vr.requestExit",{}))},_=function(){m.needsRender=!0,m.modelSceneNeedsRender=!0};if(typeof document!="undefined"&&document.addEventListener("fullscreenchange",T,!1),m.renderer&&m.renderer.domElement.addEventListener("webglcontextrestored",_,!1),m.removeEventListeners=function(){typeof document!="undefined"&&document.removeEventListener("fullscreenchange",T,!1),m.renderer&&m.renderer.domElement.removeEventListener("webglcontextrestored",_,!1)},m.plugins={},e.plugins&&e.plugins.length)for(var S=0,R=e.plugins;S<R.length;S++){var M=R[S];if(typeof M=="function")M(m);else if(Array.isArray(M)){var H=M[0],B=M[1],C=M[2];if(typeof H=="function"){var w=H(m,C);typeof B=="string"&&(m.plugins[B]?m.throwError(new Error("plugin name ".concat(B," is exists."))):m.plugins[B]=w)}}}return m.meshReplaceMaterialMap=new Map,m.meshOriginMaterialMap=new Map,initLegacyEvent(m),m.enableLayeringRendering=(A=e.enableLayeringRendering)!==null&&A!==void 0?A:!1,m._buildInRendererType="default",m._builtinRenderer=null,m}return Object.defineProperty(t,"version",{get:function(){return"6.5.2"},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.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.modelScene.parameter;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(),s.reset("pano0","pano1");for(var u=0,l=this.modelScene.children;u<l.length;u++){var c=l[u];c.dispose&&c.dispose(),this.modelScene.remove(c)}this.meshReplaceMaterialMap.forEach(function(p){p.dispose()}),this.meshOriginMaterialMap.forEach(function(p){p.dispose()}),this.renderer instanceof InternalWebGLRenderer&&this.renderer.forceContextLoss&&this.renderer.forceContextLoss()}},t.prototype.setViewport=function(e){Object.assign(this.viewport,e),this.needsRender=!0,this.modelSceneNeedsRender=!0},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}),t.prototype.getBuiltinRenderer=function(e){var r=this._builtinRenderer;if((r==null?void 0:r.type)!==this._buildInRendererType)switch(r&&r.dispose(),this._buildInRendererType){case"default":this._builtinRenderer=new DefaultRenderer({renderer:e,camera:this.camera,scene:this.scene,modelScene:this.modelScene,enableLayeringRendering:this.enableLayeringRendering});break;case"edl":this._builtinRenderer=new EDLRenderer({renderer:e,camera:this.camera,scene:this.scene,modelScene:this.modelScene,enableLayeringRendering:this.enableLayeringRendering});break;case"hq":this._builtinRenderer=new HQRenderer({renderer:e,camera:this.camera,scene:this.scene,modelScene:this.modelScene,enableLayeringRendering:this.enableLayeringRendering});break;case"luminance":this._builtinRenderer=new LuminanceRenderer({renderer:e,camera:this.camera,scene:this.scene,modelScene:this.modelScene,enableLayeringRendering:this.enableLayeringRendering});break}return this._builtinRenderer},Object.defineProperty(t.prototype,"renderEffect",{get:function(){return this._buildInRendererType},set:function(e){this._buildInRendererType=e,this.modelSceneNeedsRender=!0},enumerable:!1,configurable:!0}),t.prototype.updateConfiguration=function(e,r){r===void 0&&(r=!0);var o=!1;if(e.panorama&&(Object.assign(this.controllerInits.Panorama,omitUndefinedFields(e.panorama)),this.currentMode==="Panorama"&&(o=!0)),e.model&&(Object.assign(this.controllerInits.Model,omitUndefinedFields(e.model)),this.currentMode==="Model"&&(o=!0)),e.floorplan&&(Object.assign(this.controllerInits.Floorplan,omitUndefinedFields(e.floorplan)),this.currentMode==="Floorplan"&&(o=!0)),e.topview&&(Object.assign(this.controllerInits.Topview,omitUndefinedFields(e.topview)),this.currentMode==="Topview"&&(o=!0)),e.mapview&&(Object.assign(this.controllerInits.Mapview,omitUndefinedFields(e.mapview)),this.currentMode==="Mapview"&&(o=!0)),e.vrPanorama&&(Object.assign(this.controllerInits.VRPanorama,omitUndefinedFields(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){var s=this.controller.updateConfiguration(this.controllerInits[this.currentMode]);s||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,p=c===void 0?s.offsetHeight:c;this.renderer instanceof InternalWebGLRenderer&&(r&&this.renderer.setPixelRatio(r),this.renderer.setSize(l,p))}var f=new THREE__namespace.Vector2;this.renderer.getDrawingBufferSize(f),this.needsRender=!0,this.modelSceneNeedsRender=!0;var d=now(),h=d-this.currentUpdateArgs.time,g=this.currentUpdateArgs.args;this.updateTime(d,h,g)}}},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.getSize=function(e){if(!this.renderer)throw new Error("renderer is not initialized");return this.renderer.getSize(e),e.x*=this.viewport.width,e.y*=this.viewport.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.viewport.width,e.y*=this.viewport.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)},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,"models",{get:function(){return this.modelScene.models},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"model",{get:function(){return this.modelScene.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.loadWorkTask.then(function(){return isPromise(e)?e.then(function(c){return u.load_(c,r,o,s)}):u.load_(e,r,o,s)});return this.loadWorkTask=l.catch(function(c){u.throwError(c)}),l},t.prototype.load_=function(e,r,o,s){var u=this,l,c,p,f,d,h,g,A;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 E=[];if(Array.isArray(e))for(var v=0,y=e;v<y.length;v++){var b=y[v];typeof b!="string"&&"work"in b?E.push(parseWork(b.work,b)):E.push(parseWork(b))}else E.push(parseWork(e));for(var T=createWorks(E),_=function(Z){var te=S,j=new Fetcher({allowHosts:Z.allowHosts,get requestProxy(){return te.requestProxy},get networkSubscribe(){return te.networkSubscribe}});registerFetcher(Z,j)},S=this,R=0,M=T;R<M.length;R++){var H=M[R];_(H)}r===void 0&&(r="inherit"),r==="inherit"&&this.works===emptyWorks&&(r="initial");var B=T.initial,C=B.work.observers[0],w=C?{workCode:C.work.workCode,panoIndex:C.panoIndex}:{workCode:B.work.workCode,panoIndex:0},I=(l=B.mode)!==null&&l!==void 0?l:C?"Panorama":"Mapview",O={};if(r==="inherit"){I=this.currentMode;var L=T.resolvedObservers[this.panoIndex];L?w={workCode:L.work.workCode,panoIndex:L.panoIndex}:typeof T.initial.panoIndex=="number"?w={workCode:T.initial.work.workCode,panoIndex:T.initial.panoIndex}:(I==="Panorama"||I==="VRPanorama"||I==="XRPanorama")&&(I="Mapview"),O={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 B.panoIndex=="number"&&(w={workCode:B.work.workCode,panoIndex:B.panoIndex}),B.mode&&(I=B.mode),O={longitude:B.longitude,latitude:B.latitude,fov:B.fov,distance:B.distance,offset:(c=B.offset)===null||c===void 0?void 0:c.clone()};else{if(I=(p=r.mode)!==null&&p!==void 0?p:this.currentMode,typeof r.panoIndex=="number"){var L=T.getResolvedObserver({workCode:(d=(f=r.workCode)!==null&&f!==void 0?f:B.work.workCode)!==null&&d!==void 0?d:"",panoIndex:r.panoIndex});L&&(w={workCode:L.work.workCode,panoIndex:L.panoIndex})}O={longitude:r.longitude,latitude:r.latitude,fov:r.fov,distance:r.distance,offset:r.offset}}var N=__assign(__assign(__assign({},w),{mode:I}),O),z=this.getCurrentState(),J=(h=m.duration)!==null&&h!==void 0?h:this.modeChangeDuration;(I==="Floorplan"||I==="Topview"||I==="Mapview")&&this.currentMode===I&&(J=0);var G="fly";(I==="Panorama"||I==="VRPanorama"||I==="XRPanorama")&&this.currentMode===I&&(G=(g=m.effect)!==null&&g!==void 0?g:"fade"),this.emit("works.request",createEvent("works.request",{input:e,works:T,state:N,userAction:s}));var Q=function(){u.pano=w;var Z=__assign(__assign({initial:{state:N,currentState:z,duration:J,effect:G,userAction:s}},u.commonParams()),u.controllerInits[I]),te=Controllers[I].initAnimationEndState(Z);if(u.controller&&u.currentMode===I)u.controller.updateWork(T,te,{effect:G,duration:J},s)===!1&&(u.controller.destroy(),u.controller=u.applyController(I,Z));else{var j=u.currentMode;if(u.controller)u.controller.destroy();else{var ee=Controllers[I].initAnimationEndState(Z);u.camera.setFromPose(ee),u.emit("camera.update",createEvent("camera.update",{state:u.getCurrentState(),userAction:s}))}u.controller=u.applyController(I,Z);var W=createEvent("mode.change",{prevMode:j,mode:I,state:te,userAction:s});try{u.emit("mode.change",W)}catch(re){console.error(re)}}u.updateTime(u.currentUpdateArgs.time,0,u.currentUpdateArgs.args)};worksMap.set(this,T);var U=Promise.resolve();if(I===t.Mode.Floorplan||I===t.Mode.Topview||I===t.Mode.Mapview||I===t.Mode.Model){this.modelScene.loaded===!1&&(this.camera.setFromPose(N),assignPose(this.state,this.camera.pose)),this.controller||(this.currentMode=I);var q=this.loadModels(T,m);U=Promise.all(q.map(function(Z){return Z.loadedReady})).then(function(){u.needsRender=!0,u.modelSceneNeedsRender=!0,Q(),u.emit("camera.update",createEvent("camera.update",{state:u.getCurrentState(),userAction:s}))})}else{Q();var K=!1;this.modelScene.autoRefine=!1;var Y=function(){u.works===T&&K===!1&&(u.needsRender=!0,u.modelSceneNeedsRender=!0,u.emit("camera.update",createEvent("camera.update",{state:u.getCurrentState(),userAction:s})),K=!0,u.modelScene.autoRefine=!0)},q=this.loadModels(T,m);U=Promise.all(q.map(function(te){return te.initReady})).then(noop$1),this.controller.once("pano.arrived",Y),this.controller.once("pano.cancel",Y),setTimeout(Y,((A=m.duration)!==null&&A!==void 0?A:this.modeChangeDuration)+1e3)}return this.emit("works.load",createEvent("works.load",{input:e,state:this.getCurrentState(),userAction:s,works:T})),U.then(function(){return u.ready()}).then(function(){var Z;u.emit("works.ready",createEvent("works.ready",{input:e,state:u.getCurrentState(),userAction:s,works:T})),(Z=u.analysis)===null||Z===void 0||Z.work(T)})},t.prototype.reset=function(){var e=this,r=this.loadWorkTask.then(function(){return e.reset_()});return this.loadWorkTask=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.controller.destroy(),e.controller=void 0);var s=e.modelScene.parameter;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(),s.set({pano0:null,pano1:null,modelAlpha:1}),e.renderer&&e.modelScene.update(e.renderer,e.camera);for(var u=0,l=e.modelScene.children;u<l.length;u++){var c=l[u];c instanceof Model&&(c.dispose(),e.modelScene.remove(c))}e.needsRender=!0,e.modelSceneNeedsRender=!0,worksMap.delete(e);var p=parseWork(null),f=new Model(p);f.work=p,worksMap.set(e,createWorks([p])),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.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,p){var f,d,h,g;if(!l.renderer)throw new Error("renderer is not initialized.");r=__assign({},r);var A=0;l.controller&&(typeof o=="number"?A=o:A=(f=o==null?void 0:o.duration)!==null&&f!==void 0?f:l.modeChangeDuration);var m="fly";l.controller&&typeof o=="object"&&o.effect&&(m=o.effect);var E=typeof r.panoIndex=="number"?{workCode:(g=(d=r.workCode)!==null&&d!==void 0?d:(h=l.work)===null||h===void 0?void 0:h.workCode)!==null&&g!==void 0?g:"",panoIndex:r.panoIndex}:l.pano;if(!t.Mode.hasOwnProperty(e)){var v=new Error('mode "'.concat(e,'" is not existed'));l.throwError(v),p(v);return}if((e===t.Mode.Panorama||e===t.Mode.VRPanorama||e===t.Mode.XRPanorama)&&!l.works.getResolvedObserver(E)){var v=new Error("PanoId ".concat(panoStringify(E)," not existed."));l.throwError(v),p(v);return}(e===t.Mode.Floorplan||e===t.Mode.Topview||e===t.Mode.Mapview||e===t.Mode.Model)&&(l.modelScene.loaded||(A=0));var y=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,E)&&"moveToPano"in l.controller&&typeof l.controller.moveToPano=="function"?l.controller.moveToPano(E,__assign({duration:A},r),s):l.controller.updateCamera(r,A,s).catch(noop$1):(panoEqual(l.pano,E)||(l.pano=E),l.controller.updateCamera(r,A,s).catch(noop$1));else{var S=__assign(__assign({},r),E),R=__assign(__assign({initial:{state:S,currentState:l.getCurrentState(),duration:A,effect:m,userAction:s}},l.commonParams()),l.controllerInits[e]),M=Controllers[e].initAnimationEndState(R),H=createEvent("mode.change.request",{prevMode:l.currentMode,mode:e,state:M,userAction:s});if(l.emit("mode.change.request",H),!H.defaultPrevented){y&&y.destroy(),l.controller=l.applyController(e,R);var B=createEvent("mode.change",{prevMode:l.currentMode,mode:e,state:M,userAction:s});l.emit("mode.change",B)}}c()};if(e===t.Mode.VRPanorama)l.requestFullscreen(),requestDeviceOrientationPermission().then(function(){return T()}).catch(function(S){S instanceof Error&&(l.exitFullscreen(),l.throwError(S),p(S))});else if(e===t.Mode.XRPanorama){var _=AnimationFrameLoop.shared.getContext();_?_.end():requestXRSessionPermission().then(function(S){AnimationFrameLoop.shared.setContext(S),T()}).catch(function(S){S instanceof Error&&(l.throwError(S),p(S))})}else T()})},t.prototype.getPixels=function(e,r,o,s,u,l,c){if(!this.renderer)throw new Error("renderer is not initialized.");var p=this.renderer.getPixelRatio(),f=this.renderer.getRenderTarget(),d=this.renderer.getSize(new THREE__namespace.Vector2),h=0,g=0,A=1,m=1,E,v,y,b,T;typeof e=="number"?(h=e,typeof r=="number"&&(g=r),typeof o=="number"&&(A=o),typeof s=="number"&&(m=s),E=u,v=l,T=c):(h=e.x,g=e.y,A=e.width,m=e.height,E=e.pixelRatio,v=e.flipY,y=e.helperVisible,b=e.skipPanorama,T=e.buffer),h=Math.ceil(h),g=Math.ceil(g),A=Math.ceil(A),m=Math.ceil(m),E=Math.ceil(E!=null?E:p),v=v!=null?v:!1;var _=this.helperVisible,S=this.modelScene.parameter.modelAlpha;this.helperVisible=y!=null?y:this.helperVisible,b&&(this.controller instanceof Controllers.Panorama||this.controller instanceof Controllers.VRPanorama||this.controller instanceof Controllers.XRPanorama)&&b===!0&&this.modelScene.parameter.set("modelAlpha",1),this.modelScene.update(this.renderer,this.camera);var R=this.getPixelsRenderTarget;R.setSize(A*E,m*E),this.renderer.setRenderTarget(R),this.camera.pixelRatio=E,this.camera.resolution.set(A,m),this.camera.setViewOffset(d.width,d.height,h,d.height-g-m,A,m),this.scene.update(this.renderer,this.camera),this.render(),this.helperVisible=_,S===void 0?this.modelScene.parameter.reset("modelAlpha"):this.modelScene.parameter.set("modelAlpha",S),this.renderer.setRenderTarget(f),this.camera.clearViewOffset(),this.camera.pixelRatio=p,this.getSize(this.camera.resolution),this.camera.aspect=this.camera.resolution.width/this.camera.resolution.height,this.modelScene.update(this.renderer,this.camera),this.scene.update(this.renderer,this.camera);var M=A*E,H=m*E,B=M*H,C=B*4;if(T){if(T.length!==C)throw new Error("buffer length is not equals pixels ".concat(C))}else T=new Uint8Array(C);if(this.renderer.readRenderTargetPixels(R,0,0,A*E,m*E,T),v)for(var w=B/2,I=0,O=0,L=0,N=0;O<w;O++)for(N=(H-Math.floor(O/M)-1)*M+O%M,L=0;L<4;L++)I=T[O*4+L],T[O*4+L]=T[N*4+L],T[N*4+L]=I;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){var r=this.renderer;if(r){var o=r.getRenderTarget(),s=r.autoClear,u=r.autoClearColor,l=r.autoClearDepth,c=r.autoClearStencil,p=scratchClearColor.copy(r.getClearColor()),f=r.getClearAlpha(),d=r.getViewport(scratchViewport),h=r.getScissor(scratchScissor),g=r.getScissorTest(),A=r.getSize(scratchRenderSize),m=r.getPixelRatio(),E=Math.floor(A.x*this.viewport.left),v=Math.floor(A.y*this.viewport.bottom),y=Math.floor(A.x*this.viewport.width),b=Math.floor(A.y*this.viewport.height);r.setClearColor(this.backgroundColor,this.backgroundAlpha),r.setViewport(E,v,y,b),r.setScissor(E,v,y,b),r.setScissorTest(!0);var T=this.scene.background;this.modelScene.background=this.camera.isOrthographicCamera?null:T,this.modelScene.environment=this.scene.environment,this.scene.background=null;var _=this.getBuiltinRenderer(r);_.setSize(A.x,A.y,m),this.controller?this.controller.render(_,this.onlyRenderIfNeeds?this.modelSceneNeedsRender:!0):_.render(this.onlyRenderIfNeeds?this.modelSceneNeedsRender:!0),this.scene.background=T,this.modelScene.background=null,this.modelScene.environment=null,this.poweredByRealsee&&this.currentMode!=="VRPanorama"&&this.currentMode!=="XRPanorama"&&r.getRenderTarget()!==this.getPixelsRenderTarget&&renderPoweredByRealsee(r),r.setRenderTarget(o),r.autoClear=s,r.autoClearColor=u,r.autoClearDepth=l,r.autoClearStencil=c,r.setClearColor(p,f),r.setViewport(d),r.setScissor(h),r.setScissorTest(g),e&&AnimationFrameLoop.shared.add(e,!0)}},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.currentUpdateArgs={time:e,args:u},!this.destroyed){if(this.renderer&&ktx2.detectSupport(this.renderer),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.autoNearFar){var c=this.modelScene.boundingBox.getBoundingSphere(scratchSphere),p=c.radius*2;c.containsPoint(this.camera.position)||(p=this.camera.position.distanceTo(c.center)+c.radius),p=clamp$1(p,800,5e4),this.camera.far!==p&&(this.camera.far=p);var f=p/1e4;f=clamp$1(f,.03,.1),this.camera.near!==f&&(this.camera.near=f)}if(this.camera.controllerMode=this.currentMode,this.camera.updateTime(e),this.renderer){var d=this.modelScene.loaded,h=this.modelScene.refined;if(this.modelScene.loaded){for(var g=[],A=0,m=this.modelScene.children;A<m.length;A++){var E=m[A];E instanceof Model&&E.outdated&&g.push(E)}for(var v=0,y=g;v<y.length;v++){var b=y[v];this.modelScene.remove(b),b.dispose()}if(g.length>0)for(var T=0,_=this.modelScene.children;T<_.length;T++){var E=_[T];E instanceof Model&&(E.visible=!0,this.modelSceneNeedsRender=!0)}}this.modelScene.update(this.renderer,this.camera),d===!1&&this.modelScene.loaded===!0&&(this.controller&&this.controller.updateModel(this.modelScene),AnimationFrameLoop.shared.add(function(){s.emit("models.load",createEvent("models.load",{modelScene:s.modelScene}))},!0,0,10)),h===!1&&this.modelScene.refined===!0&&AnimationFrameLoop.shared.add(function(){s.emit("models.refined",createEvent("models.refined",{modelScene:s.modelScene}))},!0,0,10)}this.renderer&&this.scene.update(this.renderer,this.camera),this.syncingState=!1,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.modelScene.needsRender===!0&&(this.modelScene.needsRender=!1,this.needsRender=!0,this.modelSceneNeedsRender=!0),this.scene.needsRender===!0&&(this.scene.needsRender=!1,this.needsRender=!0),this.onlyRenderIfNeeds!==!0&&(this.needsRender=!0,this.modelSceneNeedsRender=!0),this.modelSceneNeedsRender===!0&&(this.needsRender=!0);var S=this.camera.resolution.width*this.camera.pixelRatio*this.camera.resolution.height*this.camera.pixelRatio;S>4096*2048?this.renderSwitch01=this.renderSwitch01^1:this.renderSwitch01=0,this.renderSwitch01!==0&&(this.needsRender=!1),this.paused===!0&&(this.needsRender=!1);var R=createEvent("render.prepare",{needsRender:this.needsRender});this.emit("render.prepare",R),R.defaultPrevented&&(this.needsRender=!1),this.renderer&&this.needsRender&&this.render(),this.emit("render",createEvent("render",{needsRender:this.needsRender})),this.needsRender=!1,this.modelSceneNeedsRender=!1,this.hasListener("fps")&&(this.fps.testTime&&e-this.fps.testTime<1e3?this.fps.testCount++:(this.emit("fps",this.fps.testCount),this.fps.testTime=e,this.fps.testCount=0))}},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 p={workCode:c.work.workCode,panoIndex:c.panoIndex};return"moveToPano"in u&&typeof u.moveToPano=="function"?u.moveToPano(p,r,o):c&&(this.pano=p,this.once("initAnimation.start",function(f){r.moveStartCallback&&r.moveStartCallback(f.state)}),this.once("initAnimation.end",function(f){r.moveEndCallback&&r.moveEndCallback(f.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 p=__assign({key:"pano.".concat(s.panoId,".").concat(c)},pick(o.imageOptions,["size","format","quality","mappings"])),f=s.images[c],d=o.imageOptions.transform?o.imageOptions.transform(f,p):imageURL(f,p);return getFetcher(s.work).preload(d)})).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(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.modelScene.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 p=this.renderer.getSize(new THREE__namespace.Vector2),f=p.x*this.viewport.width,d=p.y*this.viewport.height,h=p.x*this.viewport.left+(c.x+1)/2*f,g=p.y*(1-this.viewport.bottom-this.viewport.height)+(-c.y+1)/2*d;return new THREE__namespace.Vector2(h,g)},t.prototype.getCurrentState=function(){return __assign(__assign({},this.camera.copyPose()),{mode:this.currentMode,workCode:this.pano.workCode,panoIndex:this.pano.panoIndex})},t.prototype.setState=function(e,r,o){var s,u,l,c,p,f,d,h,g,A;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 E=(u=(s=this.work)===null||s===void 0?void 0:s.workCode)!==null&&u!==void 0?u:"",v=this.state.workCode;this.works.filter(function(w){return w.workCode===v}).length>0&&(E=v),m={workCode:E,panoIndex:e.panoIndex}}var y=(l=e.mode)!==null&&l!==void 0?l:this.state.mode,b,T,_,S,R;if(this.controller&&this.controller.stopMomentumMovement(),this.state.mode!==y){if(y==="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 H=__assign(__assign({initial:{state:M,currentState:this.getCurrentState(),duration:this.modeChangeDuration,effect:"fly",userAction:!1}},this.commonParams()),this.controllerInits[y]),B=Controllers[y].initAnimationEndState(H);b=B.longitude,T=B.latitude,_=B.fov,S=B.offset,R=B.distance}else b=(c=e.longitude)!==null&&c!==void 0?c:this.state.longitude,T=(p=e.latitude)!==null&&p!==void 0?p:this.state.latitude,_=(f=e.fov)!==null&&f!==void 0?f:this.state.fov,S=(d=e.offset)!==null&&d!==void 0?d:this.state.offset,R=(h=e.distance)!==null&&h!==void 0?h:this.state.distance;var C={workCode:(m!=null?m:this.pano).workCode,panoIndex:(m!=null?m:this.pano).panoIndex,mode:y,longitude:b,latitude:T,fov:_,offset:S,distance:R};this.emit("state.set",createEvent("state.set",{userAction:o,state:C})),stateEqual(this.state,C)||(this.controller&&C.mode==="VRPanorama"&&C.mode!==this.state.mode?(assignState(this.state,C),this.changeMode("VRPanorama")):this.controller&&C.mode==="XRPanorama"&&C.mode!==this.state.mode?(assignState(this.state,C),this.changeMode("XRPanorama")):(assignState(this.state,C),this.controller&&o&&(this.controller.userAction=!1),r&&this.state.mode===C.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})),(A=this.analysis)===null||A===void 0||A.state(this.works,this.state)))},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 p=1,f=.2,d=.2,h=Math.PI/45,g=o?this.state.fov:stepNumber(this.camera.pose.fov,this.state.fov,p),A=Math.abs(this.camera.pose.distance-this.state.distance),m=A>d*15?A/15:f,E=o?this.state.distance:stepNumber(this.camera.pose.distance,this.state.distance,m),v=this.camera.pose.offset.distanceTo(this.state.offset),y=v>d*15?v/15:d,b=o?new THREE__namespace.Vector3().copy(this.state.offset):stepVector(this.camera.pose.offset,this.state.offset,y),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},h),_=T.longitude,S=T.latitude;if(notSimilarValue(g,this.camera.pose.fov)||notSimilarVector3(b,this.camera.pose.offset)||notSimilarValue(E,this.camera.pose.distance)||notSimilarValue(_,this.camera.pose.longitude,Math.PI*2)||notSimilarValue(S,this.camera.pose.latitude)){var R={x:b.x,y:b.y,z:b.z},M={fov:g};return Object.assign(R,{distance:E}),Object.assign(M,{longitude:_,latitude:S}),this.controller.stopMomentumMovement(),this.controller.cameraMotion.set(M,0).catch(noop$1),this.controller.locationMotion.set(R,0).catch(noop$1),!0}}else{var H=1,B=Math.PI/45,g=o?this.state.fov:stepNumber(this.camera.pose.fov,this.state.fov,H),C=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},B),_=C.longitude,S=C.latitude,E=this.state.distance,b=new THREE__namespace.Vector3().copy(this.state.offset);if(notSimilarValue(E,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(S,this.camera.pose.latitude)||notSimilarValue(g,this.camera.pose.fov))return this.controller.stopMomentumMovement(),this.controller.cameraMotion.set({longitude:_,latitude:S,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 w=this.currentMode,I=w===t.Mode.Floorplan||w===t.Mode.Topview||w===t.Mode.Mapview||w===t.Mode.Model;if(!I||this.modelScene.loaded){var O=this.readyCallbacks.slice();this.readyCallbacks.length=0;for(var L=0,N=O;L<N.length;L++){var z=N[L];this.controller instanceof Controllers.Panorama&&z.tile===!0&&!this.controller.isTileReady()?this.readyCallbacks.push(z):z()}}}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}))}).then(function(){return r.model.initReady})},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.loadModels=function(e,r){for(var o=this,s,u,l,c,p,f,d=new Map,h=!1,g=[],A=0,m=this.modelScene.children;A<m.length;A++){var E=m[A];E instanceof Model&&(E.outdated=!0,d.set(E.work.workCode,E),h=!0)}for(var v=function(T){var _=e[T],S=_.workCode&&d.get(_.workCode);if(S)S.work=_,S.outdated=!1,d.delete(_.workCode),g.push(S);else{var R=(l=(u=(s=r.model)===null||s===void 0?void 0:s.textureOptions)!==null&&u!==void 0?u:r.textureOptions)!==null&&l!==void 0?l:y.textureOptions,M=(p=(c=r.model)===null||c===void 0?void 0:c["3d-tiles"])!==null&&p!==void 0?p:r["3d-tiles"],H=new Model(_,{light:(f=r.model)===null||f===void 0?void 0:f.light,textureOptions:R});H.initReady.then(function(){if(M)if(typeof M=="function")for(var B=0,C=H.viewLayers;B<C.length;B++){var w=C[B],I=M(w,H,T);I&&(I.viewerRequestVolume&&(w.viewerRequestVolume=makeBoundingVolume(I.viewerRequestVolume)),w.parameter.set(omit(I,["showLayers"])),I.showLayers===!1?w.visible=!1:Array.isArray(I.showLayers)&&(w.visible=I.showLayers.includes(w.name)))}else for(var O=0,L=H.viewLayers;O<L.length;O++){var w=L[O];M.viewerRequestVolume&&(w.viewerRequestVolume=makeBoundingVolume(M.viewerRequestVolume)),w.parameter.set(omit(M,["showLayers"])),M.showLayers===!1?w.visible=!1:Array.isArray(M.showLayers)&&(w.visible=M.showLayers.includes(w.name))}}),g.push(H),h&&(H.visible=!1),y.modelScene.add(H),H.addEventListener("load",function(B){AnimationFrameLoop.shared.add(function(){o.emit("model.load",createEvent("model.load",{work:_,model:H,error:null}))},!0)}),H.addEventListener("changeShownFloor",function(B){o.emit("model.changeShownFloor",createEvent("model.changeShownFloor",{work:_,model:H,error:null}))}),H.addEventListener("error",function(B){var C=B.error;o.emit("model.error",createEvent("model.error",{work:_,model:H,error:C})),o.throwError(C)}),y.emit("model.request",createEvent("model.request",{work:_,model:H,error:null}))}},y=this,b=0;b<e.length;b++)v(b);return this.modelScene.loaded=!1,this.modelScene.refined=!1,g},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,viewport:this.viewport,element:this.getElement(),works:this.works,imageOptions:this.imageOptions,enableWheel:this.enableWheel,extraElements:this.extraElements,videoTexture:this.videoTexture,modelScene:this.modelScene}},t.prototype.applyController=function(e,r){var o=this;if(!this.renderer)throw new Error("renderer is not initialized.");var s=Controllers[e];this.currentMode=e;for(var u=new s(r),l=function(g){u.on(g,function(){for(var A=[],m=0;m<arguments.length;m++)A[m]=arguments[m];var E=o.emit.apply(o,__spreadArray([g],A,!1));if(E)return!1})},c=0,p=PROXY_CONTROLLER_EVENT_NAMES;c<p.length;c++){var f=p[c];l(f)}{var d=Controllers[e].initAnimationEndState(r),h=r.initial.userAction;stateEqual(this.state,d)||(assignState(this.state,d),this.emit("state.change",createEvent("state.change",{userAction:h,state:this.state}))),this.emit("currentState.change",createEvent("currentState.change",{userAction:h,state:this.getCurrentState()}))}return u.on("camera.update",function(g){var A;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})),(A=o.analysis)===null||A===void 0||A.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 A,m=g.state,E=g.userAction;E&&o.state.mode===m.mode&&!stateEqual(o.state,m)&&(assignState(o.state,m),o.emit("state.change",createEvent("state.change",{userAction:E,state:o.state})),(A=o.analysis)===null||A===void 0||A.state(o.works,o.state))}),u.on("initAnimation.end",function(g){var A,m=g.state,E=g.userAction;o.pano={workCode:m.workCode,panoIndex:m.panoIndex},E&&o.state.mode===m.mode&&!stateEqual(o.state,m)&&(assignState(o.state,m),o.emit("state.change",createEvent("state.change",{userAction:E,state:o.state})),(A=o.analysis)===null||A===void 0||A.state(o.works,o.state))}),u.on("pano.moveTo",function(g){var A,m=g.state,E=g.userAction;o.pano={workCode:m.workCode,panoIndex:m.panoIndex},E&&o.state.mode===m.mode&&!stateEqual(o.state,m)&&(assignState(o.state,m),o.emit("state.change",createEvent("state.change",{userAction:E,state:o.state})),(A=o.analysis)===null||A===void 0||A.state(o.works,o.state))}),u.on("pano.arrived",function(g){var A,m=g.state,E=g.userAction;o.pano={workCode:m.workCode,panoIndex:m.panoIndex},E&&o.state.mode===m.mode&&!stateEqual(o.state,m)&&(assignState(o.state,m),o.emit("state.change",createEvent("state.change",{userAction:E,state:o.state})),(A=o.analysis)===null||A===void 0||A.state(o.works,o.state))}),u.on("pano.cancel",function(g){var A,m=g.state,E=g.userAction;E&&o.state.mode===m.mode&&!stateEqual(o.state,m)&&(assignState(o.state,m),o.emit("state.change",createEvent("state.change",{userAction:E,state:o.state})),(A=o.analysis)===null||A===void 0||A.state(o.works,o.state))}),u.on("pano.moveTo",function(g){var A=g.userAction;o.emit("currentState.change",createEvent("currentState.change",{userAction:A,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(){},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),r=this.modelScene.children.find(function(o){return o.name==="internalLights"}),r&&(r.visible=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"scissor",{get:function(){return this.viewport},enumerable:!1,configurable:!0}),t.prototype.setScissor=function(e){return this.setViewport(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.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,"enableIOSEDR",{get:function(){return!1},set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enableEDL",{get:function(){return this.renderEffect==="edl"},set:function(e){this.renderEffect=e?"edl":"default"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enableHQ",{get:function(){return this.renderEffect==="hq"},set:function(e){this.renderEffect=e?"hq":"default"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enablePostProcessing",{get:function(){return!1},set:function(e){},enumerable:!1,configurable:!0}),t.Mode={Panorama:"Panorama",Model:"Model",Floorplan:"Floorplan",Topview:"Topview",Mapview:"Mapview",VRPanorama:"VRPanorama",XRPanorama:"XRPanorama"},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=PBMCustomShader;exports.Fetcher=Fetcher;exports.Five=Five;exports.InternalWebGLRenderer=InternalWebGLRenderer;exports.Model=Model;exports.ModelScene=ModelScene;exports.Motion=Motion;exports.NetworkSubscribe=NetworkSubscribe;exports.PBMContainer=PBMContainer;exports.PBMCustomShader=PBMCustomShader;exports.PBMGroup=PBMGroup;exports.PBMMesh=PBMMesh;exports.PBMMeshMaterial=PBMMeshMaterial;exports.PBMPointCloud=PBMPointCloud;exports.PBMPointCloudMaterial=PBMPointCloudMaterial;exports.PBMSkinnedMesh=PBMSkinnedMesh;exports.PROXY_CONTROLLER_EVENT_NAMES=PROXY_CONTROLLER_EVENT_NAMES;exports.PanoCircleMesh=PanoCircleMesh;exports.PanoCircleMeshCustom=PanoCircleMeshCustom;exports.PanoCircleMeshSolid=PanoCircleMeshSolid;exports.Parameter=Parameter;exports.Scene=Scene;exports.Subscribe=Subscribe;exports.TextureLoader=TextureLoader;exports.Tile=Tile;exports.Tile3DModel=Tile3D;exports.TileCache=TileCache;exports.TileNode=TileNode;exports.TileRequestScheduler=TileRequestScheduler;exports.Tileset=Tileset;exports.Trajectory=Trajectory;exports.TrajectoryNode=TrajectoryNode;exports.Work=Work;exports.XRButton=XRButton;exports.controllersDefaultInitArgs=controllersDefaultInitArgs;exports.createDebugBoundingMesh=createDebugBoundingMesh;exports.createWorks=createWorks;exports.defaultImageURLTransform=imageURL;exports.draco=draco;exports.getFetcher=getFetcher;exports.getViewportScale=getViewportScale;exports.imageSupport=imageSupport;exports.isBoundingVolume=isBoundingVolume;exports.isPanoId=isPanoId;exports.ktx2=ktx2;exports.loadAt3d=loadAt3d;exports.loadB3dm=loadB3dm;exports.loadDome=loadDome;exports.loadDomez=loadDomez;exports.loadFbx=loadFbx;exports.loadGltf=loadGltf;exports.loadPbm=loadPbm;exports.loadPly=loadPly;exports.loadPnts=loadPnts;exports.loadX3p=loadX3p;exports.makeBoundingVolume=makeBoundingVolume;exports.panoEqual=panoEqual;exports.panoParse=panoParse;exports.panoStringify=panoStringify;exports.parseWork=parseWork;exports.registerFetcher=registerFetcher;exports.workRawMapping=workRawMapping;
|