@realsee/five 6.6.4 → 6.7.0-alpha.1

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.
Files changed (53) hide show
  1. package/docs/classes/five.Five.html +57 -57
  2. package/docs/classes/five.Work.html +16 -16
  3. package/docs/classes/five.WorkResolvedObserver.html +16 -16
  4. package/docs/classes/sticker.Sticker.html +2 -2
  5. package/docs/functions/five.loadAt3d.html +1 -1
  6. package/docs/functions/five.loadDome.html +1 -1
  7. package/docs/functions/five.loadFbx.html +1 -1
  8. package/docs/functions/five.loadPbm.html +1 -1
  9. package/docs/functions/five.parseWork.html +1 -1
  10. package/docs/interfaces/five.LooseWorkWithExtrinsics.html +5 -5
  11. package/docs/interfaces/five.TileHeader.html +2 -2
  12. package/docs/interfaces/five.TilesetHeader.html +4 -4
  13. package/docs/interfaces/five.TrajectoryHeader.html +2 -2
  14. package/docs/interfaces/five.WorkCubeImage.html +2 -2
  15. package/docs/interfaces/five.WorkImage.html +3 -3
  16. package/docs/interfaces/five.WorkInitial.html +8 -8
  17. package/docs/interfaces/five.WorkModel.html +6 -6
  18. package/docs/interfaces/five.WorkModelLayer.html +2 -2
  19. package/docs/interfaces/five.WorkObserver.html +18 -18
  20. package/docs/interfaces/five.WorkTile.html +4 -4
  21. package/docs/interfaces/five.WorkVideo.html +4 -4
  22. package/docs/types/five.ParseOptions.html +6 -6
  23. package/docs/types/five.PostProcessingType.html +1 -1
  24. package/five/index.js +20 -20
  25. package/five/index.mjs +510 -636
  26. package/gltf-loader/index.js +2 -2
  27. package/gltf-loader/index.mjs +145 -145
  28. package/line/index.js +2 -2
  29. package/line/index.mjs +9 -9
  30. package/package.json +1 -1
  31. package/plugins/index.js +1 -1
  32. package/plugins/index.mjs +1 -1
  33. package/react/index.js +1 -1
  34. package/react/index.mjs +1 -1
  35. package/shader-lib/index.js +1 -1
  36. package/shader-lib/index.mjs +1 -1
  37. package/sticker/index.js +2 -2
  38. package/sticker/index.mjs +6 -6
  39. package/umd/five-gltf-loader.js +2 -2
  40. package/umd/five-line.js +2 -2
  41. package/umd/five-plugins.js +1 -1
  42. package/umd/five-react.js +1 -1
  43. package/umd/five-shader-lib.js +1 -1
  44. package/umd/five-sticker.js +2 -2
  45. package/umd/five-vfx.js +1 -1
  46. package/umd/five-vue.js +1 -1
  47. package/umd/five.js +20 -20
  48. package/vfx/index.js +1 -1
  49. package/vfx/index.mjs +1 -1
  50. package/vue/index.js +1 -1
  51. package/vue/index.mjs +1 -1
  52. package/work-downloader/index.js +1 -1
  53. package/work-downloader/index.mjs +1 -1
package/five/index.js CHANGED
@@ -2,7 +2,7 @@
2
2
  * @license
3
3
  * @realsee/five
4
4
  * Generated: 9/25/2025
5
- * Version: 6.6.4
5
+ * Version: 6.7.0-alpha.1
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(m){h.prototype=this;var A=new h;return m&&A.mixIn(m),A.hasOwnProperty("init")||(A.init=function(){A.$super.init.apply(this,arguments)}),A.init.prototype=A,A.$super=this,A},create:function(){var m=this.extend();return m.init.apply(m,arguments),m},init:function(){},mixIn:function(m){for(var A in m)m.hasOwnProperty(A)&&(this[A]=m[A]);m.hasOwnProperty("toString")&&(this.toString=m.toString)},clone:function(){return this.init.prototype.extend(this)}}})(),s=r.WordArray=o.extend({init:function(h,m){h=this.words=h||[],m!=t?this.sigBytes=m:this.sigBytes=h.length*4},toString:function(h){return(h||l).stringify(this)},concat:function(h){var m=this.words,A=h.words,g=this.sigBytes,y=h.sigBytes;if(this.clamp(),g%4)for(var v=0;v<y;v++){var E=A[v>>>2]>>>24-v%4*8&255;m[g+v>>>2]|=E<<24-(g+v)%4*8}else for(var v=0;v<y;v+=4)m[g+v>>>2]=A[v>>>2];return this.sigBytes+=y,this},clamp:function(){var h=this.words,m=this.sigBytes;h[m>>>2]&=4294967295<<32-m%4*8,h.length=n.ceil(m/4)},clone:function(){var h=o.clone.call(this);return h.words=this.words.slice(0),h},random:function(h){for(var m=[],A=0;A<h;A+=4)m.push(n.random()*4294967296|0);return new s.init(m,h)}}),u=e.enc={},l=u.Hex={stringify:function(h){for(var m=h.words,A=h.sigBytes,g=[],y=0;y<A;y++){var v=m[y>>>2]>>>24-y%4*8&255;g.push((v>>>4).toString(16)),g.push((v&15).toString(16))}return g.join("")},parse:function(h){for(var m=h.length,A=[],g=0;g<m;g+=2)A[g>>>3]|=parseInt(h.substr(g,2),16)<<24-g%8*4;return new s.init(A,m/2)}},c=u.Latin1={stringify:function(h){for(var m=h.words,A=h.sigBytes,g=[],y=0;y<A;y++){var v=m[y>>>2]>>>24-y%4*8&255;g.push(String.fromCharCode(v))}return g.join("")},parse:function(h){for(var m=h.length,A=[],g=0;g<m;g++)A[g>>>2]|=(h.charCodeAt(g)&255)<<24-g%4*8;return new s.init(A,m)}},p=u.Utf8={stringify:function(h){try{return decodeURIComponent(escape(c.stringify(h)))}catch(m){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 m=this._data,A=m.words,g=m.sigBytes,y=this.blockSize,v=y*4,E=g/v;h?E=n.ceil(E):E=n.max((E|0)-this._minBufferSize,0);var b=E*y,T=n.min(b*4,g);if(b){for(var _=0;_<b;_+=y)this._doProcessBlock(A,_);var S=A.splice(0,b);m.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 m=this._doFinalize();return m},blockSize:512/32,_createHelper:function(h){return function(m,A){return new h.init(A).finalize(m)}},_createHmacHelper:function(h){return function(m,A){return new d.HMAC.init(h,A).finalize(m)}}});var d=e.algo={};return e})(Math);(function(n){for(var t=CryptoJS,m=t.lib,e=m.WordArray,r=m.Hasher,m=t.algo,o=[],s=[],u=function(g){return 4294967296*(g-(g|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=[],m=m.SHA256=r.extend({_doReset:function(){this._hash=new e.init(o.slice(0))},_doProcessBlock:function(A,g){for(var y=this._hash.words,v=y[0],E=y[1],b=y[2],T=y[3],_=y[4],S=y[5],R=y[6],w=y[7],M=0;64>M;M++){if(16>M)h[M]=A[g+M]|0;else{var B=h[M-15],C=h[M-2];h[M]=((B<<25|B>>>7)^(B<<14|B>>>18)^B>>>3)+h[M-7]+((C<<15|C>>>17)^(C<<13|C>>>19)^C>>>10)+h[M-16]}B=w+((_<<26|_>>>6)^(_<<21|_>>>11)^(_<<7|_>>>25))+(_&S^~_&R)+s[M]+h[M],C=((v<<30|v>>>2)^(v<<19|v>>>13)^(v<<10|v>>>22))+(v&E^v&b^E&b),w=R,R=S,S=_,_=T+B|0,T=b,b=E,E=v,v=B+C|0}y[0]=y[0]+v|0,y[1]=y[1]+E|0,y[2]=y[2]+b|0,y[3]=y[3]+T|0,y[4]=y[4]+_|0,y[5]=y[5]+S|0,y[6]=y[6]+R|0,y[7]=y[7]+w|0},_doFinalize:function(){var A=this._data,g=A.words,y=8*this._nDataBytes,v=8*A.sigBytes;return g[v>>>5]|=128<<24-v%32,g[(v+64>>>9<<4)+14]=n.floor(y/4294967296),g[(v+64>>>9<<4)+15]=y,A.sigBytes=4*g.length,this._process(),this._hash},clone:function(){var A=r.clone.call(this);return A._hash=this._hash.clone(),A}});t.SHA256=r._createHelper(m),t.HmacSHA256=r._createHmacHelper(m)})(Math);CryptoJS.lib.Cipher||(function(n){var m=CryptoJS,t=m.lib,e=t.Base,r=t.WordArray,o=t.BufferedBlockAlgorithm,s=m.enc.Base64,u=m.algo.EvpKDF,l=t.Cipher=o.extend({cfg:e.extend(),createEncryptor:function(g,y){return this.create(this._ENC_XFORM_MODE,g,y)},createDecryptor:function(g,y){return this.create(this._DEC_XFORM_MODE,g,y)},init:function(g,y,v){this.cfg=this.cfg.extend(v),this._xformMode=g,this._key=y,this.reset()},reset:function(){o.reset.call(this),this._doReset()},process:function(g){return this._append(g),this._process()},finalize:function(g){return g&&this._append(g),this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(g){return{encrypt:function(y,v,E){return(typeof v=="string"?A:h).encrypt(g,y,v,E)},decrypt:function(y,v,E){return(typeof v=="string"?A:h).decrypt(g,y,v,E)}}}});t.StreamCipher=l.extend({_doFinalize:function(){return this._process(!0)},blockSize:1});var d=m.mode={},c=function(g,y,v){var E=this._iv;E?this._iv=n:E=this._prevBlock;for(var b=0;b<v;b++)g[y+b]^=E[b]},p=(t.BlockCipherMode=e.extend({createEncryptor:function(g,y){return this.Encryptor.create(g,y)},createDecryptor:function(g,y){return this.Decryptor.create(g,y)},init:function(g,y){this._cipher=g,this._iv=y}})).extend();p.Encryptor=p.extend({processBlock:function(g,y){var v=this._cipher,E=v.blockSize;c.call(this,g,y,E),v.encryptBlock(g,y),this._prevBlock=g.slice(y,y+E)}}),p.Decryptor=p.extend({processBlock:function(g,y){var v=this._cipher,E=v.blockSize,b=g.slice(y,y+E);v.decryptBlock(g,y),c.call(this,g,y,E),this._prevBlock=b}}),d=d.CBC=p,p=(m.pad={}).Pkcs7={pad:function(g,y){for(var v=4*y,v=v-g.sigBytes%v,E=v<<24|v<<16|v<<8|v,b=[],T=0;T<v;T+=4)b.push(E);v=r.create(b,v),g.concat(v)},unpad:function(g){g.sigBytes-=g.words[g.sigBytes-1>>>2]&255}},t.BlockCipher=l.extend({cfg:l.cfg.extend({mode:d,padding:p}),reset:function(){l.reset.call(this);var y=this.cfg,g=y.iv,y=y.mode;if(this._xformMode==this._ENC_XFORM_MODE)var v=y.createEncryptor;else v=y.createDecryptor,this._minBufferSize=1;this._mode=v.call(y,this,g&&g.words)},_doProcessBlock:function(g,y){this._mode.processBlock(g,y)},_doFinalize:function(){var g=this.cfg.padding;if(this._xformMode==this._ENC_XFORM_MODE){g.pad(this._data,this.blockSize);var y=this._process(!0)}else y=this._process(!0),g.unpad(y);return y},blockSize:4});var f=t.CipherParams=e.extend({init:function(g){this.mixIn(g)},toString:function(g){return(g||this.formatter).stringify(this)}}),d=(m.format={}).OpenSSL={stringify:function(g){var y=g.ciphertext;return g=g.salt,(g?r.create([1398893684,1701076831]).concat(g).concat(y):y).toString(s)},parse:function(g){g=s.parse(g);var y=g.words;if(y[0]==1398893684&&y[1]==1701076831){var v=r.create(y.slice(2,4));y.splice(0,4),g.sigBytes-=16}return f.create({ciphertext:g,salt:v})}},h=t.SerializableCipher=e.extend({cfg:e.extend({format:d}),encrypt:function(g,y,v,E){E=this.cfg.extend(E);var b=g.createEncryptor(v,E);return y=b.finalize(y),b=b.cfg,f.create({ciphertext:y,key:v,iv:b.iv,algorithm:g,mode:b.mode,padding:b.padding,blockSize:g.blockSize,formatter:E.format})},decrypt:function(g,y,v,E){return E=this.cfg.extend(E),y=this._parse(y,E.format),g.createDecryptor(v,E).finalize(y.ciphertext)},_parse:function(g,y){return typeof g=="string"?y.parse(g,this):g}}),m=(m.kdf={}).OpenSSL={execute:function(g,y,v,E){return E||(E=r.random(8)),g=u.create({keySize:y+v}).compute(g,E),v=r.create(g.words.slice(y),4*v),g.sigBytes=4*y,f.create({key:g,iv:v,salt:E})}},A=t.PasswordBasedCipher=h.extend({cfg:h.cfg.extend({kdf:m}),encrypt:function(g,y,v,E){return E=this.cfg.extend(E),v=E.kdf.execute(v,g.keySize,g.ivSize),E.iv=v.iv,g=h.encrypt.call(this,g,y,v.key,E),g.mixIn(v),g},decrypt:function(g,y,v,E){return E=this.cfg.extend(E),y=this._parse(y,E.format),v=E.kdf.execute(v,g.keySize,g.ivSize,y.salt),E.iv=v.iv,h.decrypt.call(this,g,y,v.key,E)}})})();(function(){for(var n=CryptoJS,t=n.lib.BlockCipher,S=n.algo,e=[],r=[],o=[],s=[],u=[],l=[],c=[],p=[],f=[],d=[],h=[],m=0;256>m;m++)h[m]=128>m?m<<1:m<<1^283;for(var A=0,g=0,m=0;256>m;m++){var y=g^g<<1^g<<2^g<<3^g<<4,y=y>>>8^y&255^99;e[A]=y,r[y]=A;var v=h[A],E=h[v],b=h[E],T=257*h[y]^16843008*y;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*E^257*v^16843008*A,c[y]=T<<24|T>>>8,p[y]=T<<16|T>>>16,f[y]=T<<8|T>>>24,d[y]=T,A?(A=v^h[h[h[b^v]]],g^=h[h[g]]):A=g=1}var _=[0,1,2,4,8,16,32,64,128,27,54],S=S.AES=t.extend({_doReset:function(){for(var M=this._key,R=M.words,w=M.sigBytes/4,M=4*((this._nRounds=w+6)+1),B=this._keySchedule=[],C=0;C<M;C++)if(C<w)B[C]=R[C];else{var P=B[C-1];C%w?6<w&&C%w==4&&(P=e[P>>>24]<<24|e[P>>>16&255]<<16|e[P>>>8&255]<<8|e[P&255]):(P=P<<8|P>>>24,P=e[P>>>24]<<24|e[P>>>16&255]<<16|e[P>>>8&255]<<8|e[P&255],P^=_[C/w|0]<<24),B[C]=B[C-w]^P}for(R=this._invKeySchedule=[],w=0;w<M;w++)C=M-w,P=w%4?B[C]:B[C-4],R[w]=4>w||4>=C?P:c[e[P>>>24]]^p[e[P>>>16&255]]^f[e[P>>>8&255]]^d[e[P&255]]},encryptBlock:function(R,w){this._doCryptBlock(R,w,this._keySchedule,o,s,u,l,e)},decryptBlock:function(R,w){var M=R[w+1];R[w+1]=R[w+3],R[w+3]=M,this._doCryptBlock(R,w,this._invKeySchedule,c,p,f,d,r),M=R[w+1],R[w+1]=R[w+3],R[w+3]=M},_doCryptBlock:function(R,w,M,B,C,P,L,O){for(var F=this._nRounds,Q=R[w]^M[0],V=R[w+1]^M[1],J=R[w+2]^M[2],j=R[w+3]^M[3],N=4,D=1;D<F;D++)var U=B[Q>>>24]^C[V>>>16&255]^P[J>>>8&255]^L[j&255]^M[N++],z=B[V>>>24]^C[J>>>16&255]^P[j>>>8&255]^L[Q&255]^M[N++],G=B[J>>>24]^C[j>>>16&255]^P[Q>>>8&255]^L[V&255]^M[N++],j=B[j>>>24]^C[Q>>>16&255]^P[V>>>8&255]^L[J&255]^M[N++],Q=U,V=z,J=G;U=(O[Q>>>24]<<24|O[V>>>16&255]<<16|O[J>>>8&255]<<8|O[j&255])^M[N++],z=(O[V>>>24]<<24|O[J>>>16&255]<<16|O[j>>>8&255]<<8|O[Q&255])^M[N++],G=(O[J>>>24]<<24|O[j>>>16&255]<<16|O[Q>>>8&255]<<8|O[V&255])^M[N++],j=(O[j>>>24]<<24|O[Q>>>16&255]<<16|O[V>>>8&255]<<8|O[J&255])^M[N++],R[w]=U,R[w+1]=z,R[w+2]=G,R[w+3]=j},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(m){h.prototype=this;var A=new h;return m&&A.mixIn(m),A.hasOwnProperty("init")||(A.init=function(){A.$super.init.apply(this,arguments)}),A.init.prototype=A,A.$super=this,A},create:function(){var m=this.extend();return m.init.apply(m,arguments),m},init:function(){},mixIn:function(m){for(var A in m)m.hasOwnProperty(A)&&(this[A]=m[A]);m.hasOwnProperty("toString")&&(this.toString=m.toString)},clone:function(){return this.init.prototype.extend(this)}}})(),s=r.WordArray=o.extend({init:function(h,m){h=this.words=h||[],m!=t?this.sigBytes=m:this.sigBytes=h.length*4},toString:function(h){return(h||l).stringify(this)},concat:function(h){var m=this.words,A=h.words,g=this.sigBytes,y=h.sigBytes;if(this.clamp(),g%4)for(var v=0;v<y;v++){var E=A[v>>>2]>>>24-v%4*8&255;m[g+v>>>2]|=E<<24-(g+v)%4*8}else for(var v=0;v<y;v+=4)m[g+v>>>2]=A[v>>>2];return this.sigBytes+=y,this},clamp:function(){var h=this.words,m=this.sigBytes;h[m>>>2]&=4294967295<<32-m%4*8,h.length=n.ceil(m/4)},clone:function(){var h=o.clone.call(this);return h.words=this.words.slice(0),h},random:function(h){for(var m=[],A=0;A<h;A+=4)m.push(n.random()*4294967296|0);return new s.init(m,h)}}),u=e.enc={},l=u.Hex={stringify:function(h){for(var m=h.words,A=h.sigBytes,g=[],y=0;y<A;y++){var v=m[y>>>2]>>>24-y%4*8&255;g.push((v>>>4).toString(16)),g.push((v&15).toString(16))}return g.join("")},parse:function(h){for(var m=h.length,A=[],g=0;g<m;g+=2)A[g>>>3]|=parseInt(h.substr(g,2),16)<<24-g%8*4;return new s.init(A,m/2)}},c=u.Latin1={stringify:function(h){for(var m=h.words,A=h.sigBytes,g=[],y=0;y<A;y++){var v=m[y>>>2]>>>24-y%4*8&255;g.push(String.fromCharCode(v))}return g.join("")},parse:function(h){for(var m=h.length,A=[],g=0;g<m;g++)A[g>>>2]|=(h.charCodeAt(g)&255)<<24-g%4*8;return new s.init(A,m)}},p=u.Utf8={stringify:function(h){try{return decodeURIComponent(escape(c.stringify(h)))}catch(m){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 m=this._data,A=m.words,g=m.sigBytes,y=this.blockSize,v=y*4,E=g/v;h?E=n.ceil(E):E=n.max((E|0)-this._minBufferSize,0);var b=E*y,T=n.min(b*4,g);if(b){for(var _=0;_<b;_+=y)this._doProcessBlock(A,_);var S=A.splice(0,b);m.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 m=this._doFinalize();return m},blockSize:512/32,_createHelper:function(h){return function(m,A){return new h.init(A).finalize(m)}},_createHmacHelper:function(h){return function(m,A){return new d.HMAC.init(h,A).finalize(m)}}});var d=e.algo={};return e})(Math);(function(n){for(var t=CryptoJS,m=t.lib,e=m.WordArray,r=m.Hasher,m=t.algo,o=[],s=[],u=function(g){return 4294967296*(g-(g|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=[],m=m.SHA256=r.extend({_doReset:function(){this._hash=new e.init(o.slice(0))},_doProcessBlock:function(A,g){for(var y=this._hash.words,v=y[0],E=y[1],b=y[2],T=y[3],_=y[4],S=y[5],R=y[6],w=y[7],M=0;64>M;M++){if(16>M)h[M]=A[g+M]|0;else{var B=h[M-15],C=h[M-2];h[M]=((B<<25|B>>>7)^(B<<14|B>>>18)^B>>>3)+h[M-7]+((C<<15|C>>>17)^(C<<13|C>>>19)^C>>>10)+h[M-16]}B=w+((_<<26|_>>>6)^(_<<21|_>>>11)^(_<<7|_>>>25))+(_&S^~_&R)+s[M]+h[M],C=((v<<30|v>>>2)^(v<<19|v>>>13)^(v<<10|v>>>22))+(v&E^v&b^E&b),w=R,R=S,S=_,_=T+B|0,T=b,b=E,E=v,v=B+C|0}y[0]=y[0]+v|0,y[1]=y[1]+E|0,y[2]=y[2]+b|0,y[3]=y[3]+T|0,y[4]=y[4]+_|0,y[5]=y[5]+S|0,y[6]=y[6]+R|0,y[7]=y[7]+w|0},_doFinalize:function(){var A=this._data,g=A.words,y=8*this._nDataBytes,v=8*A.sigBytes;return g[v>>>5]|=128<<24-v%32,g[(v+64>>>9<<4)+14]=n.floor(y/4294967296),g[(v+64>>>9<<4)+15]=y,A.sigBytes=4*g.length,this._process(),this._hash},clone:function(){var A=r.clone.call(this);return A._hash=this._hash.clone(),A}});t.SHA256=r._createHelper(m),t.HmacSHA256=r._createHmacHelper(m)})(Math);CryptoJS.lib.Cipher||(function(n){var m=CryptoJS,t=m.lib,e=t.Base,r=t.WordArray,o=t.BufferedBlockAlgorithm,s=m.enc.Base64,u=m.algo.EvpKDF,l=t.Cipher=o.extend({cfg:e.extend(),createEncryptor:function(g,y){return this.create(this._ENC_XFORM_MODE,g,y)},createDecryptor:function(g,y){return this.create(this._DEC_XFORM_MODE,g,y)},init:function(g,y,v){this.cfg=this.cfg.extend(v),this._xformMode=g,this._key=y,this.reset()},reset:function(){o.reset.call(this),this._doReset()},process:function(g){return this._append(g),this._process()},finalize:function(g){return g&&this._append(g),this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(g){return{encrypt:function(y,v,E){return(typeof v=="string"?A:h).encrypt(g,y,v,E)},decrypt:function(y,v,E){return(typeof v=="string"?A:h).decrypt(g,y,v,E)}}}});t.StreamCipher=l.extend({_doFinalize:function(){return this._process(!0)},blockSize:1});var d=m.mode={},c=function(g,y,v){var E=this._iv;E?this._iv=n:E=this._prevBlock;for(var b=0;b<v;b++)g[y+b]^=E[b]},p=(t.BlockCipherMode=e.extend({createEncryptor:function(g,y){return this.Encryptor.create(g,y)},createDecryptor:function(g,y){return this.Decryptor.create(g,y)},init:function(g,y){this._cipher=g,this._iv=y}})).extend();p.Encryptor=p.extend({processBlock:function(g,y){var v=this._cipher,E=v.blockSize;c.call(this,g,y,E),v.encryptBlock(g,y),this._prevBlock=g.slice(y,y+E)}}),p.Decryptor=p.extend({processBlock:function(g,y){var v=this._cipher,E=v.blockSize,b=g.slice(y,y+E);v.decryptBlock(g,y),c.call(this,g,y,E),this._prevBlock=b}}),d=d.CBC=p,p=(m.pad={}).Pkcs7={pad:function(g,y){for(var v=4*y,v=v-g.sigBytes%v,E=v<<24|v<<16|v<<8|v,b=[],T=0;T<v;T+=4)b.push(E);v=r.create(b,v),g.concat(v)},unpad:function(g){g.sigBytes-=g.words[g.sigBytes-1>>>2]&255}},t.BlockCipher=l.extend({cfg:l.cfg.extend({mode:d,padding:p}),reset:function(){l.reset.call(this);var y=this.cfg,g=y.iv,y=y.mode;if(this._xformMode==this._ENC_XFORM_MODE)var v=y.createEncryptor;else v=y.createDecryptor,this._minBufferSize=1;this._mode=v.call(y,this,g&&g.words)},_doProcessBlock:function(g,y){this._mode.processBlock(g,y)},_doFinalize:function(){var g=this.cfg.padding;if(this._xformMode==this._ENC_XFORM_MODE){g.pad(this._data,this.blockSize);var y=this._process(!0)}else y=this._process(!0),g.unpad(y);return y},blockSize:4});var f=t.CipherParams=e.extend({init:function(g){this.mixIn(g)},toString:function(g){return(g||this.formatter).stringify(this)}}),d=(m.format={}).OpenSSL={stringify:function(g){var y=g.ciphertext;return g=g.salt,(g?r.create([1398893684,1701076831]).concat(g).concat(y):y).toString(s)},parse:function(g){g=s.parse(g);var y=g.words;if(y[0]==1398893684&&y[1]==1701076831){var v=r.create(y.slice(2,4));y.splice(0,4),g.sigBytes-=16}return f.create({ciphertext:g,salt:v})}},h=t.SerializableCipher=e.extend({cfg:e.extend({format:d}),encrypt:function(g,y,v,E){E=this.cfg.extend(E);var b=g.createEncryptor(v,E);return y=b.finalize(y),b=b.cfg,f.create({ciphertext:y,key:v,iv:b.iv,algorithm:g,mode:b.mode,padding:b.padding,blockSize:g.blockSize,formatter:E.format})},decrypt:function(g,y,v,E){return E=this.cfg.extend(E),y=this._parse(y,E.format),g.createDecryptor(v,E).finalize(y.ciphertext)},_parse:function(g,y){return typeof g=="string"?y.parse(g,this):g}}),m=(m.kdf={}).OpenSSL={execute:function(g,y,v,E){return E||(E=r.random(8)),g=u.create({keySize:y+v}).compute(g,E),v=r.create(g.words.slice(y),4*v),g.sigBytes=4*y,f.create({key:g,iv:v,salt:E})}},A=t.PasswordBasedCipher=h.extend({cfg:h.cfg.extend({kdf:m}),encrypt:function(g,y,v,E){return E=this.cfg.extend(E),v=E.kdf.execute(v,g.keySize,g.ivSize),E.iv=v.iv,g=h.encrypt.call(this,g,y,v.key,E),g.mixIn(v),g},decrypt:function(g,y,v,E){return E=this.cfg.extend(E),y=this._parse(y,E.format),v=E.kdf.execute(v,g.keySize,g.ivSize,y.salt),E.iv=v.iv,h.decrypt.call(this,g,y,v.key,E)}})})();(function(){for(var n=CryptoJS,t=n.lib.BlockCipher,S=n.algo,e=[],r=[],o=[],s=[],u=[],l=[],c=[],p=[],f=[],d=[],h=[],m=0;256>m;m++)h[m]=128>m?m<<1:m<<1^283;for(var A=0,g=0,m=0;256>m;m++){var y=g^g<<1^g<<2^g<<3^g<<4,y=y>>>8^y&255^99;e[A]=y,r[y]=A;var v=h[A],E=h[v],b=h[E],T=257*h[y]^16843008*y;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*E^257*v^16843008*A,c[y]=T<<24|T>>>8,p[y]=T<<16|T>>>16,f[y]=T<<8|T>>>24,d[y]=T,A?(A=v^h[h[h[b^v]]],g^=h[h[g]]):A=g=1}var _=[0,1,2,4,8,16,32,64,128,27,54],S=S.AES=t.extend({_doReset:function(){for(var M=this._key,R=M.words,w=M.sigBytes/4,M=4*((this._nRounds=w+6)+1),B=this._keySchedule=[],C=0;C<M;C++)if(C<w)B[C]=R[C];else{var P=B[C-1];C%w?6<w&&C%w==4&&(P=e[P>>>24]<<24|e[P>>>16&255]<<16|e[P>>>8&255]<<8|e[P&255]):(P=P<<8|P>>>24,P=e[P>>>24]<<24|e[P>>>16&255]<<16|e[P>>>8&255]<<8|e[P&255],P^=_[C/w|0]<<24),B[C]=B[C-w]^P}for(R=this._invKeySchedule=[],w=0;w<M;w++)C=M-w,P=w%4?B[C]:B[C-4],R[w]=4>w||4>=C?P:c[e[P>>>24]]^p[e[P>>>16&255]]^f[e[P>>>8&255]]^d[e[P&255]]},encryptBlock:function(R,w){this._doCryptBlock(R,w,this._keySchedule,o,s,u,l,e)},decryptBlock:function(R,w){var M=R[w+1];R[w+1]=R[w+3],R[w+3]=M,this._doCryptBlock(R,w,this._invKeySchedule,c,p,f,d,r),M=R[w+1],R[w+1]=R[w+3],R[w+3]=M},_doCryptBlock:function(R,w,M,B,C,P,L,O){for(var F=this._nRounds,Q=R[w]^M[0],V=R[w+1]^M[1],J=R[w+2]^M[2],j=R[w+3]^M[3],N=4,D=1;D<F;D++)var U=B[Q>>>24]^C[V>>>16&255]^P[J>>>8&255]^L[j&255]^M[N++],z=B[V>>>24]^C[J>>>16&255]^P[j>>>8&255]^L[Q&255]^M[N++],K=B[J>>>24]^C[j>>>16&255]^P[Q>>>8&255]^L[V&255]^M[N++],j=B[j>>>24]^C[Q>>>16&255]^P[V>>>8&255]^L[J&255]^M[N++],Q=U,V=z,J=K;U=(O[Q>>>24]<<24|O[V>>>16&255]<<16|O[J>>>8&255]<<8|O[j&255])^M[N++],z=(O[V>>>24]<<24|O[J>>>16&255]<<16|O[j>>>8&255]<<8|O[Q&255])^M[N++],K=(O[J>>>24]<<24|O[j>>>16&255]<<16|O[Q>>>8&255]<<8|O[V&255])^M[N++],j=(O[j>>>24]<<24|O[Q>>>16&255]<<16|O[V>>>8&255]<<8|O[J&255])^M[N++],R[w]=U,R[w+1]=z,R[w+2]=K,R[w+3]=j},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)!=0&&(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,m=(1<<this.F1)/d,A=1<<this.F2,g=e.t,y=g-p,v=t==null?nbi():t;for(s.dlShiftTo(y,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(;--y>=0;){var E=e[--g]==f?this.DM:Math.floor(e[g]*h+(e[g-1]+A)*m);if((e[g]+=s.am(0,E,e,y,0,p))<E)for(s.dlShiftTo(y,v),e.subTo(v,e);e[g]<--E;)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)==0)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(g){return hextorstr(s.hashHex(rstrtohex(g),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 m=oaep_mgf1_arr(h,f.length,e),A=[0];for(c=0;c<f.length;c+=1)A[c+1]=f[c]^m.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:"0"+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:"0"+s}RSAKey.prototype.doPublic=RSADoPublic;RSAKey.prototype.setPublic=RSASetPublic;RSAKey.prototype.encrypt=RSAEncrypt;RSAKey.prototype.encryptOAEP=RSAEncryptOAEP;RSAKey.prototype.type="RSA";/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/ */function pkcs1unpad2(n,t){for(var e=n.toByteArray(),r=0;r<e.length&&e[r]==0;)++r;if(e.length-r!=t-1||e[r]!=2)return null;for(++r;e[r]!=0;)if(++r>=e.length)return null;for(var o="";++r<e.length;){var s=e[r]&255;s<128?o+=String.fromCharCode(s):s>191&&s<224?(o+=String.fromCharCode((s&31)<<6|e[r+1]&63),++r):(o+=String.fromCharCode((s&15)<<12|(e[r+1]&63)<<6|e[r+2]&63),r+=2)}return o}function oaep_mgf1_str(n,t,e){for(var r="",o=0;r.length<t;)r+=e(n+String.fromCharCode.apply(String,[(o&4278190080)>>24,(o&16711680)>>16,(o&65280)>>8,o&255])),o+=1;return r}function oaep_unpad(n,t,e,r){var o=KJUR.crypto.MessageDigest,s=KJUR.crypto.Util,u=null;e||(e="sha1"),typeof e=="string"&&(u=o.getCanonicalAlgName(e),r=o.getHashLength(u),e=function(y){return hextorstr(s.hashHex(rstrtohex(y),u))}),n=n.toByteArray();var 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),m=[];for(d=0;d<c.length;d+=1)m[d]=c.charCodeAt(d)^h.charCodeAt(d);if(m=String.fromCharCode.apply(String,m),m.substr(0,r)!==e(""))throw"Hash mismatch";m=m.substr(r);var A=m.indexOf(""),g=A!=-1?m.substr(0,A).lastIndexOf("\0"):-1;if(g+1!=A)throw"Malformed data";return m.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,11 +359,11 @@
359
359
  `,M+=`\r
360
360
  `,M+=w,M+=`\r
361
361
  -----END `+A+` PRIVATE KEY-----\r
362
- `,M},parseHexOfEncryptedPKCS8:function(A){var g=ASN1HEX,y=g.getChildIdx,v=g.getV,E={},b=y(A,0);if(b.length!=2)throw"malformed format: SEQUENCE(0).items != 2: "+b.length;E.ciphertext=v(A,b[1]);var T=y(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 _=y(A,T[1]);if(T.length!=2)throw"malformed format: SEQUENCE(0.0.1).items != 2: "+_.length;var S=y(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";E.encryptionSchemeAlg="TripleDES",E.encryptionSchemeIV=v(A,S[1]);var R=y(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 w=y(A,R[1]);if(w.length<2)throw"malformed format: SEQUENCE(0.0.1.0.1).items < 2: "+w.length;E.pbkdf2Salt=v(A,w[0]);var M=v(A,w[1]);try{E.pbkdf2Iter=parseInt(M,16)}catch(B){throw"malformed format pbkdf2Iter: "+M}return E},getPBKDF2KeyHexFromParam:function(A,g){var y=CryptoJS.enc.Hex.parse(A.pbkdf2Salt),v=A.pbkdf2Iter,E=CryptoJS.PBKDF2(g,y,{keySize:192/32,iterations:v}),b=CryptoJS.enc.Hex.stringify(E);return b},_getPlainPKCS8HexFromEncryptedPKCS8PEM:function(A,g){var y=pemtohex(A,"ENCRYPTED PRIVATE KEY"),v=this.parseHexOfEncryptedPKCS8(y),E=KEYUTIL.getPBKDF2KeyHexFromParam(v,g),b={};b.ciphertext=CryptoJS.enc.Hex.parse(v.ciphertext);var T=CryptoJS.enc.Hex.parse(E),_=CryptoJS.enc.Hex.parse(v.encryptionSchemeIV),S=CryptoJS.TripleDES.decrypt(b,T,{iv:_}),R=CryptoJS.enc.Hex.stringify(S);return R},getKeyFromEncryptedPKCS8PEM:function(A,g){var y=this._getPlainPKCS8HexFromEncryptedPKCS8PEM(A,g),v=this.getKeyFromPlainPrivatePKCS8Hex(y);return v},parsePlainPrivatePKCS8Hex:function(A){var g=ASN1HEX,y=g.getChildIdx,v=g.getV,E={};if(E.algparam=null,A.substr(0,2)!="30")throw new Error("malformed plain PKCS8 private key(code:001)");var b=y(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=y(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(E.algoid=v(A,T[0]),A.substr(T[1],2)=="06"&&(E.algparam=v(A,T[1])),A.substr(b[2],2)!="04")throw new Error("malformed PKCS8 private key(code:006)");return E.keyidx=g.getVidx(A,b[2]),E},getKeyFromPlainPrivatePKCS8PEM:function(A){var g=pemtohex(A,"PRIVATE KEY"),y=this.getKeyFromPlainPrivatePKCS8Hex(g);return y},getKeyFromPlainPrivatePKCS8Hex:function(A){var g=this.parsePlainPrivatePKCS8Hex(A),y;if(g.algoid=="2a864886f70d010101")y=new RSAKey;else if(KJUR.crypto.DSA&&g.algoid=="2a8648ce380401")y=new KJUR.crypto.DSA;else if(KJUR.crypto.ECDSA&&g.algoid=="2a8648ce3d0201")y=new KJUR.crypto.ECDSA;else throw"unsupported private key algorithm";return y.readPKCS8PrvKeyHex(A),y},_getKeyFromPublicPKCS8Hex:function(A){var g,y=ASN1HEX.getVbyList(A,0,[0,0],"06");if(y==="2a864886f70d010101")g=new RSAKey;else if(KJUR.crypto.DSA&&y==="2a8648ce380401")g=new KJUR.crypto.DSA;else if(KJUR.crypto.ECDSA&&y==="2a8648ce3d0201")g=new KJUR.crypto.ECDSA;else throw"unsupported PKCS#8 public key hex";return g.readPKCS8PubKeyHex(A),g},parsePublicRawRSAKeyHex:function(A){var g=ASN1HEX,y=g.getChildIdx,v=g.getV,E={};if(A.substr(0,2)!="30")throw"malformed RSA key(code:001)";var b=y(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(E.n=v(A,b[0]),A.substr(b[1],2)!="02")throw"malformed RSA key(code:004)";return E.e=v(A,b[1]),E},parsePublicPKCS8Hex:function(A){var g=ASN1HEX,y=g.getChildIdx,v=g.getV,E={};E.algparam=null;var b=y(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 _=y(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(E.algoid=v(A,_[0]),A.substr(_[1],2)=="06"?E.algparam=v(A,_[1]):A.substr(_[1],2)=="30"&&(E.algparam={},E.algparam.p=g.getVbyList(A,_[1],[0],"02"),E.algparam.q=g.getVbyList(A,_[1],[1],"02"),E.algparam.g=g.getVbyList(A,_[1],[2],"02")),A.substr(b[1],2)!="03")throw"malformed PKCS8 public key(code:004)";return E.key=v(A,b[1]).substr(2),E}}})();KEYUTIL.getKey=function(n,t,e){var r=ASN1HEX,o=r.getChildIdx;r.getV;var s=r.getVbyList,u=KJUR.crypto,l=u.ECDSA,c=u.DSA,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 m=new l({curve:n.crv}),A=m.ecparams.keylen/4,g=("0000000000"+b64utohex(n.x)).slice(-A),y=("0000000000"+b64utohex(n.y)).slice(-A),v="04"+g+y;return m.setPublicKeyHex(v),m}if(n.kty==="EC"&&n.crv!==void 0&&n.x!==void 0&&n.y!==void 0&&n.d!==void 0){var m=new l({curve:n.crv}),A=m.ecparams.keylen/4,g=("0000000000"+b64utohex(n.x)).slice(-A),y=("0000000000"+b64utohex(n.y)).slice(-A),v="04"+g+y,E=("0000000000"+b64utohex(n.d)).slice(-A);return m.setPublicKeyHex(v),m.setPrivateKeyHex(E),m}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"),w=s(R,0,[1],"02"),M=s(R,0,[2],"02"),B=s(R,0,[3],"02"),C=s(R,0,[4],"02"),P=s(R,0,[5],"02"),h=new c;return h.setPrivate(new BigInteger(w,16),new BigInteger(M,16),new BigInteger(B,16),new BigInteger(C,16),new BigInteger(P,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 L=d.getDecryptedKeyHex(n,t),O=new RSAKey;return O.readPKCS5PrvKeyHex(L),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"),F=s(R,0,[2,0],"06"),N=s(R,0,[3,0],"03").substr(2),D="";if(KJUR.crypto.OID.oidhex2name[F]!==void 0)D=KJUR.crypto.OID.oidhex2name[F];else throw"undefined OID(hex) in KJUR.crypto.OID: "+F;var m=new l({curve:D});return m.setPublicKeyHex(N),m.setPrivateKeyHex(h),m.isPublic=!1,m}if(n.indexOf("-END DSA PRIVATE KEY-")!=-1&&n.indexOf("4,ENCRYPTED")!=-1){var R=d.getDecryptedKeyHex(n,t),w=s(R,0,[1],"02"),M=s(R,0,[2],"02"),B=s(R,0,[3],"02"),C=s(R,0,[4],"02"),P=s(R,0,[5],"02"),h=new c;return h.setPrivate(new BigInteger(w,16),new BigInteger(M,16),new BigInteger(B,16),new BigInteger(C,16),new BigInteger(P,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),m=0,A=s.getChildIdx(n,t),g=0;g<A.length;g++){var y=s.getTLV(n,A[g]);m+=y.length,s.checkStrictDER(n,A[g],e,r,o)}if(h*2!=m)throw new Error("sum of children's TLV length and L unmatch: "+h*2+"!="+m)}};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(E){return KJUR.crypto.Util.hashHex(E,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),m=d.substr(h.length,l),A=65280>>8*p-c&255;if((h.charCodeAt(0)&A)!==0)throw new Error("bits beyond keysize not zero");var g=pss_mgf1_str(m,h.length,s),y=[];for(f=0;f<h.length;f+=1)y[f]=h.charCodeAt(f)^g.charCodeAt(f);y[0]&=~A;var v=p-l-r-2;for(f=0;f<v;f+=1)if(y[f]!==0)throw new Error("leftmost octets not zero");if(y[v]!==1)throw new Error("0x01 marker not found");return m===hextorstr(s(rstrtohex("\0\0\0\0\0\0\0\0"+u+String.fromCharCode.apply(String,y.slice(-r)))))};RSAKey.SALT_LEN_HLEN=-1;RSAKey.SALT_LEN_MAX=-2;RSAKey.SALT_LEN_RECOVER=-2;function X509(n){var t=ASN1HEX,e=t.getChildIdx,r=t.getV,o=t.getTLV,s=t.getVbyList,u=t.getVbyListEx,l=t.getTLVbyList,c=t.getTLVbyListEx,p=t.getIdxbyList,f=t.getIdxbyListEx,d=t.getVidx,h=t.getInt,m=t.oidname,A=t.hextooidstr,g=pemtohex,y;try{y=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 E=l(v,0,[0]),b=h(E,0);if(b<0||2<b)throw new Error("malformed version field");return this.version=b+1,this.version}else return this.version=1,this.foffset=-1,1},this.getSerialNumberHex=function(){return u(this.hex,0,[0,0],"02")},this.getSignatureAlgorithmField=function(){var v=c(this.hex,0,[0,1]);return this.getAlgorithmIdentifierName(v)},this.getAlgorithmIdentifierName=function(v){for(var E in y)if(v===y[E])return E;return m(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 E=this.getSignatureAlgorithmField(),b=this.getSignatureValueHex(),T=l(this.hex,0,[0],"30"),_=new KJUR.crypto.Signature({alg:E});return _.init(v),_.updateHex(T),_.verify(b)},this.parseExt=function(v){var E,b,T;if(v===void 0){if(T=this.hex,this.version!==3)return-1;E=p(T,0,[0,7,0],"30"),b=e(T,E)}else{T=pemtohex(v);var _=p(T,0,[0,3,0,0],"06");if(r(T,_)!="2a864886f70d01090e"){this.aExtInfo=new Array;return}E=p(T,0,[0,3,0,1,0],"30"),b=e(T,E),this.hex=T}this.aExtInfo=new Array;for(var S=0;S<b.length;S++){var R={};R.critical=!1;var w=e(T,b[S]),M=0;w.length===3&&(R.critical=!0,M=1),R.oid=t.hextooidstr(s(T,b[S],[0],"06"));var B=p(T,b[S],[1+M]);R.vidx=d(T,B),this.aExtInfo.push(R)}},this.getExtInfo=function(v){var E=this.aExtInfo,b=v;if(v.match(/^[0-9.]+$/)||(b=KJUR.asn1.x509.OID.name2oid(v)),b!==""){for(var T=0;T<E.length;T++)if(E[T].oid===b)return E[T]}},this.getExtBasicConstraints=function(v,E){if(v===void 0&&E===void 0){var b=this.getExtInfo("basicConstraints");if(b===void 0)return;v=o(this.hex,b.vidx),E=b.critical}var T={extname:"basicConstraints"};if(E&&(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,E){if(v===void 0&&E===void 0){var b=this.getExtInfo("keyUsage");if(b===void 0)return;v=o(this.hex,b.vidx),E=b.critical}var T={extname:"keyUsage"};return E&&(T.critical=!0),T.names=this.getExtKeyUsageString(v).split(","),T},this.getExtKeyUsageBin=function(v){if(v===void 0){var E=this.getExtInfo("keyUsage");if(E===void 0)return"";v=o(this.hex,E.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 E=this.getExtKeyUsageBin(v),b=new Array,T=0;T<E.length;T++)E.substr(T,1)=="1"&&b.push(X509.KEYUSAGE_NAME[T]);return b.join(",")},this.getExtSubjectKeyIdentifier=function(v,E){if(v===void 0&&E===void 0){var b=this.getExtInfo("subjectKeyIdentifier");if(b===void 0)return;v=o(this.hex,b.vidx),E=b.critical}var T={extname:"subjectKeyIdentifier"};E&&(T.critical=!0);var _=r(v,0);return T.kid={hex:_},T},this.getExtAuthorityKeyIdentifier=function(v,E){if(v===void 0&&E===void 0){var b=this.getExtInfo("authorityKeyIdentifier");if(b===void 0)return;v=o(this.hex,b.vidx),E=b.critical}var T={extname:"authorityKeyIdentifier"};E&&(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 w=o(v,_[S]),M=this.getGeneralNames(w);T.issuer=M[0].dn}R==="82"&&(T.sn={hex:r(v,_[S])})}return T},this.getExtExtKeyUsage=function(v,E){if(v===void 0&&E===void 0){var b=this.getExtInfo("extKeyUsage");if(b===void 0)return;v=o(this.hex,b.vidx),E=b.critical}var T={extname:"extKeyUsage",array:[]};E&&(T.critical=!0);for(var _=e(v,0),S=0;S<_.length;S++)T.array.push(m(r(v,_[S])));return T},this.getExtExtKeyUsageName=function(){var v=this.getExtInfo("extKeyUsage");if(v===void 0)return v;var E=new Array,b=o(this.hex,v.vidx);if(b==="")return E;for(var T=e(b,0),_=0;_<T.length;_++)E.push(m(r(b,T[_])));return E},this.getExtSubjectAltName=function(v,E){if(v===void 0&&E===void 0){var b=this.getExtInfo("subjectAltName");if(b===void 0)return;v=o(this.hex,b.vidx),E=b.critical}var T={extname:"subjectAltName",array:[]};return E&&(T.critical=!0),T.array=this.getGeneralNames(v),T},this.getExtIssuerAltName=function(v,E){if(v===void 0&&E===void 0){var b=this.getExtInfo("issuerAltName");if(b===void 0)return;v=o(this.hex,b.vidx),E=b.critical}var T={extname:"issuerAltName",array:[]};return E&&(T.critical=!0),T.array=this.getGeneralNames(v),T},this.getGeneralNames=function(v){for(var E=e(v,0),b=[],T=0;T<E.length;T++){var _=this.getGeneralName(o(v,E[T]));_!==void 0&&b.push(_)}return b},this.getGeneralName=function(v){var E=v.substr(0,2),b=r(v,0),T=hextorstr(b);if(E=="81")return{rfc822:T};if(E=="82")return{dns:T};if(E=="86")return{uri:T};if(E=="87")return{ip:hextoip(b)};if(E=="a4")return{dn:this.getX500Name(b)}},this.getExtSubjectAltName2=function(){var v,E,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),w=0;w<R.length;w++)b=S.substr(R[w],2),v=r(S,R[w]),b==="81"&&(E=hextoutf8(v),_.push(["MAIL",E])),b==="82"&&(E=hextoutf8(v),_.push(["DNS",E])),b==="84"&&(E=X509.hex2dn(v,0),_.push(["DN",E])),b==="86"&&(E=hextoutf8(v),_.push(["URI",E])),b==="87"&&(E=hextoip(v),_.push(["IP",E]));return _},this.getExtCRLDistributionPoints=function(v,E){if(v===void 0&&E===void 0){var b=this.getExtInfo("cRLDistributionPoints");if(b===void 0)return;v=o(this.hex,b.vidx),E=b.critical}var T={extname:"cRLDistributionPoints",array:[]};E&&(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 E={},b=e(v,0),T=0;T<b.length;T++){var _=v.substr(b[T],2),S=o(v,b[T]);_=="a0"&&(E.dpname=this.getDistributionPointName(S))}return E},this.getDistributionPointName=function(v){for(var E={},b=e(v,0),T=0;T<b.length;T++){var _=v.substr(b[T],2),S=o(v,b[T]);_=="a0"&&(E.full=this.getGeneralNames(S))}return E},this.getExtCRLDistributionPointsURI=function(){var v=this.getExtInfo("cRLDistributionPoints");if(v===void 0)return v;for(var E=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(_);E.push(S)}catch(R){}return E},this.getExtAIAInfo=function(){var v=this.getExtInfo("authorityInfoAccess");if(v===void 0)return v;for(var E={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"&&E.ocsp.push(hextoutf8(S)),_==="2b06010505073002"&&E.caissuer.push(hextoutf8(S))}return E},this.getExtAuthorityInfoAccess=function(v,E){if(v===void 0&&E===void 0){var b=this.getExtInfo("authorityInfoAccess");if(b===void 0)return;v=o(this.hex,b.vidx),E=b.critical}var T={extname:"authorityInfoAccess",array:[]};E&&(T.critical=!0);for(var _=e(v,0),S=0;S<_.length;S++){var R=u(v,_[S],[0],"06"),w=s(v,_[S],[1],"86"),M=hextoutf8(w);if(R=="2b06010505073001")T.array.push({ocsp:M});else if(R=="2b06010505073002")T.array.push({caissuer:M});else throw new Error("unknown method: "+R)}return T},this.getExtCertificatePolicies=function(v,E){if(v===void 0&&E===void 0){var b=this.getExtInfo("certificatePolicies");if(b===void 0)return;v=o(this.hex,b.vidx),E=b.critical}var T={extname:"certificatePolicies",array:[]};E&&(T.critical=!0);for(var _=e(v,0),S=0;S<_.length;S++){var R=o(v,_[S]),w=this.getPolicyInformation(R);T.array.push(w)}return T},this.getPolicyInformation=function(v){var E={},b=s(v,0,[0],"06");E.policyoid=m(b);var T=f(v,0,[1],"30");if(T!=-1){E.array=[];for(var _=e(v,T),S=0;S<_.length;S++){var R=o(v,_[S]),w=this.getPolicyQualifierInfo(R);E.array.push(w)}}return E},this.getPolicyQualifierInfo=function(v){var E={},b=s(v,0,[0],"06");if(b==="2b06010505070201"){var T=u(v,0,[1],"16");E.cps=hextorstr(T)}else if(b==="2b06010505070202"){var _=l(v,0,[1],"30");E.unotice=this.getUserNotice(_)}return E},this.getUserNotice=function(v){for(var E={},b=e(v,0),T=0;T<b.length;T++){var _=o(v,b[T]);_.substr(0,2)!="30"&&(E.exptext=this.getDisplayText(_))}return E},this.getDisplayText=function(v){var E={"0c":"utf8",16:"ia5","1a":"vis","1e":"bmp"},b={};return b.type=E[v.substr(0,2)],b.str=hextorstr(r(v,0)),b},this.getExtCRLNumber=function(v,E){var b={extname:"cRLNumber"};if(E&&(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,E){var b={extname:"cRLReason"};if(E&&(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,E){var b={extname:"ocspNonce"};E&&(b.critical=!0);var T=r(v,0);return b.hex=T,b},this.getExtOcspNoCheck=function(v,E){var b={extname:"ocspNoCheck"};return E&&(b.critical=!0),b},this.getExtAdobeTimeStamp=function(v,E){if(v===void 0&&E===void 0){var b=this.getExtInfo("adobeTimeStamp");if(b===void 0)return;v=o(this.hex,b.vidx),E=b.critical}var T={extname:"adobeTimeStamp"};E&&(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 w=o(v,_[2]);w=="0101ff"&&(T.reqauth=!0),w=="010100"&&(T.reqauth=!1)}return T},this.getX500NameRule=function(v){for(var E=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],w=R.ds,M=R.value,B=R.type;if(w!="prn"&&w!="utf8"&&w!="ia5")return"mixed";if(w=="ia5"){if(B!="CN")return"mixed";if(KJUR.lang.String.isMail(M))continue;return"mixed"}if(B=="C"){if(w=="prn")continue;return"mixed"}if(E==null)E=w;else if(E!==w)return"mixed"}return E==null?"prn":E},this.getX500Name=function(v){var E=this.getX500NameArray(v),b=this.dnarraytostr(E);return{array:E,str:b}},this.getX500NameArray=function(v){for(var E=[],b=e(v,0),T=0;T<b.length;T++)E.push(this.getRDN(o(v,b[T])));return E},this.getRDN=function(v){for(var E=[],b=e(v,0),T=0;T<b.length;T++)E.push(this.getAttrTypeAndValue(o(v,b[T])));return E},this.getAttrTypeAndValue=function(v){var E={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 E.type=KJUR.asn1.x509.OID.oid2atype(S),E.ds=this.HEX2STAG[v.substr(b[1],2)],E.ds!="bmp"?E.value=hextoutf8(_):E.value=ucs2hextoutf8(_),E},this.readCertPEM=function(v){this.readCertHex(g(v))},this.readCertHex=function(v){this.hex=v,this.getVersion();try{p(this.hex,0,[0,7],"a3"),this.parseExt()}catch(E){}},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 E=f(this.hex,0,[0,"[3]"]);E!=-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 E=e(v,0),b=E.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 w={extname:T,extn:S};return _&&(w.critical=!0),w},this.findExt=function(v,E){for(var b=0;b<v.length;b++)if(v[b].extname==E)return v[b];return null},this.dnarraytostr=function(v){function E(T){return T.map(function(_){return b(_).replace(/\+/,"\\+")}).join("+")}function b(T){return T.type+"="+T.value}return"/"+v.map(function(T){return E(T).replace(/\//,"\\/")}).join("/")},this.getInfo=function(){var v=function(U){var z=JSON.stringify(U.array).replace(/[\[\]\{\}\"]/g,"");return z},E=function(U){for(var z="",G=U.array,j=0;j<G.length;j++){var Q=G[j];if(z+=" policy oid: "+Q.policyoid+`
362
+ `,M},parseHexOfEncryptedPKCS8:function(A){var g=ASN1HEX,y=g.getChildIdx,v=g.getV,E={},b=y(A,0);if(b.length!=2)throw"malformed format: SEQUENCE(0).items != 2: "+b.length;E.ciphertext=v(A,b[1]);var T=y(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 _=y(A,T[1]);if(T.length!=2)throw"malformed format: SEQUENCE(0.0.1).items != 2: "+_.length;var S=y(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";E.encryptionSchemeAlg="TripleDES",E.encryptionSchemeIV=v(A,S[1]);var R=y(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 w=y(A,R[1]);if(w.length<2)throw"malformed format: SEQUENCE(0.0.1.0.1).items < 2: "+w.length;E.pbkdf2Salt=v(A,w[0]);var M=v(A,w[1]);try{E.pbkdf2Iter=parseInt(M,16)}catch(B){throw"malformed format pbkdf2Iter: "+M}return E},getPBKDF2KeyHexFromParam:function(A,g){var y=CryptoJS.enc.Hex.parse(A.pbkdf2Salt),v=A.pbkdf2Iter,E=CryptoJS.PBKDF2(g,y,{keySize:192/32,iterations:v}),b=CryptoJS.enc.Hex.stringify(E);return b},_getPlainPKCS8HexFromEncryptedPKCS8PEM:function(A,g){var y=pemtohex(A,"ENCRYPTED PRIVATE KEY"),v=this.parseHexOfEncryptedPKCS8(y),E=KEYUTIL.getPBKDF2KeyHexFromParam(v,g),b={};b.ciphertext=CryptoJS.enc.Hex.parse(v.ciphertext);var T=CryptoJS.enc.Hex.parse(E),_=CryptoJS.enc.Hex.parse(v.encryptionSchemeIV),S=CryptoJS.TripleDES.decrypt(b,T,{iv:_}),R=CryptoJS.enc.Hex.stringify(S);return R},getKeyFromEncryptedPKCS8PEM:function(A,g){var y=this._getPlainPKCS8HexFromEncryptedPKCS8PEM(A,g),v=this.getKeyFromPlainPrivatePKCS8Hex(y);return v},parsePlainPrivatePKCS8Hex:function(A){var g=ASN1HEX,y=g.getChildIdx,v=g.getV,E={};if(E.algparam=null,A.substr(0,2)!="30")throw new Error("malformed plain PKCS8 private key(code:001)");var b=y(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=y(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(E.algoid=v(A,T[0]),A.substr(T[1],2)=="06"&&(E.algparam=v(A,T[1])),A.substr(b[2],2)!="04")throw new Error("malformed PKCS8 private key(code:006)");return E.keyidx=g.getVidx(A,b[2]),E},getKeyFromPlainPrivatePKCS8PEM:function(A){var g=pemtohex(A,"PRIVATE KEY"),y=this.getKeyFromPlainPrivatePKCS8Hex(g);return y},getKeyFromPlainPrivatePKCS8Hex:function(A){var g=this.parsePlainPrivatePKCS8Hex(A),y;if(g.algoid=="2a864886f70d010101")y=new RSAKey;else if(KJUR.crypto.DSA&&g.algoid=="2a8648ce380401")y=new KJUR.crypto.DSA;else if(KJUR.crypto.ECDSA&&g.algoid=="2a8648ce3d0201")y=new KJUR.crypto.ECDSA;else throw"unsupported private key algorithm";return y.readPKCS8PrvKeyHex(A),y},_getKeyFromPublicPKCS8Hex:function(A){var g,y=ASN1HEX.getVbyList(A,0,[0,0],"06");if(y==="2a864886f70d010101")g=new RSAKey;else if(KJUR.crypto.DSA&&y==="2a8648ce380401")g=new KJUR.crypto.DSA;else if(KJUR.crypto.ECDSA&&y==="2a8648ce3d0201")g=new KJUR.crypto.ECDSA;else throw"unsupported PKCS#8 public key hex";return g.readPKCS8PubKeyHex(A),g},parsePublicRawRSAKeyHex:function(A){var g=ASN1HEX,y=g.getChildIdx,v=g.getV,E={};if(A.substr(0,2)!="30")throw"malformed RSA key(code:001)";var b=y(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(E.n=v(A,b[0]),A.substr(b[1],2)!="02")throw"malformed RSA key(code:004)";return E.e=v(A,b[1]),E},parsePublicPKCS8Hex:function(A){var g=ASN1HEX,y=g.getChildIdx,v=g.getV,E={};E.algparam=null;var b=y(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 _=y(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(E.algoid=v(A,_[0]),A.substr(_[1],2)=="06"?E.algparam=v(A,_[1]):A.substr(_[1],2)=="30"&&(E.algparam={},E.algparam.p=g.getVbyList(A,_[1],[0],"02"),E.algparam.q=g.getVbyList(A,_[1],[1],"02"),E.algparam.g=g.getVbyList(A,_[1],[2],"02")),A.substr(b[1],2)!="03")throw"malformed PKCS8 public key(code:004)";return E.key=v(A,b[1]).substr(2),E}}})();KEYUTIL.getKey=function(n,t,e){var r=ASN1HEX,o=r.getChildIdx;r.getV;var s=r.getVbyList,u=KJUR.crypto,l=u.ECDSA,c=u.DSA,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 m=new l({curve:n.crv}),A=m.ecparams.keylen/4,g=("0000000000"+b64utohex(n.x)).slice(-A),y=("0000000000"+b64utohex(n.y)).slice(-A),v="04"+g+y;return m.setPublicKeyHex(v),m}if(n.kty==="EC"&&n.crv!==void 0&&n.x!==void 0&&n.y!==void 0&&n.d!==void 0){var m=new l({curve:n.crv}),A=m.ecparams.keylen/4,g=("0000000000"+b64utohex(n.x)).slice(-A),y=("0000000000"+b64utohex(n.y)).slice(-A),v="04"+g+y,E=("0000000000"+b64utohex(n.d)).slice(-A);return m.setPublicKeyHex(v),m.setPrivateKeyHex(E),m}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"),w=s(R,0,[1],"02"),M=s(R,0,[2],"02"),B=s(R,0,[3],"02"),C=s(R,0,[4],"02"),P=s(R,0,[5],"02"),h=new c;return h.setPrivate(new BigInteger(w,16),new BigInteger(M,16),new BigInteger(B,16),new BigInteger(C,16),new BigInteger(P,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 L=d.getDecryptedKeyHex(n,t),O=new RSAKey;return O.readPKCS5PrvKeyHex(L),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"),F=s(R,0,[2,0],"06"),N=s(R,0,[3,0],"03").substr(2),D="";if(KJUR.crypto.OID.oidhex2name[F]!==void 0)D=KJUR.crypto.OID.oidhex2name[F];else throw"undefined OID(hex) in KJUR.crypto.OID: "+F;var m=new l({curve:D});return m.setPublicKeyHex(N),m.setPrivateKeyHex(h),m.isPublic=!1,m}if(n.indexOf("-END DSA PRIVATE KEY-")!=-1&&n.indexOf("4,ENCRYPTED")!=-1){var R=d.getDecryptedKeyHex(n,t),w=s(R,0,[1],"02"),M=s(R,0,[2],"02"),B=s(R,0,[3],"02"),C=s(R,0,[4],"02"),P=s(R,0,[5],"02"),h=new c;return h.setPrivate(new BigInteger(w,16),new BigInteger(M,16),new BigInteger(B,16),new BigInteger(C,16),new BigInteger(P,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),m=0,A=s.getChildIdx(n,t),g=0;g<A.length;g++){var y=s.getTLV(n,A[g]);m+=y.length,s.checkStrictDER(n,A[g],e,r,o)}if(h*2!=m)throw new Error("sum of children's TLV length and L unmatch: "+h*2+"!="+m)}};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(E){return KJUR.crypto.Util.hashHex(E,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),m=d.substr(h.length,l),A=65280>>8*p-c&255;if((h.charCodeAt(0)&A)!==0)throw new Error("bits beyond keysize not zero");var g=pss_mgf1_str(m,h.length,s),y=[];for(f=0;f<h.length;f+=1)y[f]=h.charCodeAt(f)^g.charCodeAt(f);y[0]&=~A;var v=p-l-r-2;for(f=0;f<v;f+=1)if(y[f]!==0)throw new Error("leftmost octets not zero");if(y[v]!==1)throw new Error("0x01 marker not found");return m===hextorstr(s(rstrtohex("\0\0\0\0\0\0\0\0"+u+String.fromCharCode.apply(String,y.slice(-r)))))};RSAKey.SALT_LEN_HLEN=-1;RSAKey.SALT_LEN_MAX=-2;RSAKey.SALT_LEN_RECOVER=-2;function X509(n){var t=ASN1HEX,e=t.getChildIdx,r=t.getV,o=t.getTLV,s=t.getVbyList,u=t.getVbyListEx,l=t.getTLVbyList,c=t.getTLVbyListEx,p=t.getIdxbyList,f=t.getIdxbyListEx,d=t.getVidx,h=t.getInt,m=t.oidname,A=t.hextooidstr,g=pemtohex,y;try{y=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 E=l(v,0,[0]),b=h(E,0);if(b<0||2<b)throw new Error("malformed version field");return this.version=b+1,this.version}else return this.version=1,this.foffset=-1,1},this.getSerialNumberHex=function(){return u(this.hex,0,[0,0],"02")},this.getSignatureAlgorithmField=function(){var v=c(this.hex,0,[0,1]);return this.getAlgorithmIdentifierName(v)},this.getAlgorithmIdentifierName=function(v){for(var E in y)if(v===y[E])return E;return m(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 E=this.getSignatureAlgorithmField(),b=this.getSignatureValueHex(),T=l(this.hex,0,[0],"30"),_=new KJUR.crypto.Signature({alg:E});return _.init(v),_.updateHex(T),_.verify(b)},this.parseExt=function(v){var E,b,T;if(v===void 0){if(T=this.hex,this.version!==3)return-1;E=p(T,0,[0,7,0],"30"),b=e(T,E)}else{T=pemtohex(v);var _=p(T,0,[0,3,0,0],"06");if(r(T,_)!="2a864886f70d01090e"){this.aExtInfo=new Array;return}E=p(T,0,[0,3,0,1,0],"30"),b=e(T,E),this.hex=T}this.aExtInfo=new Array;for(var S=0;S<b.length;S++){var R={};R.critical=!1;var w=e(T,b[S]),M=0;w.length===3&&(R.critical=!0,M=1),R.oid=t.hextooidstr(s(T,b[S],[0],"06"));var B=p(T,b[S],[1+M]);R.vidx=d(T,B),this.aExtInfo.push(R)}},this.getExtInfo=function(v){var E=this.aExtInfo,b=v;if(v.match(/^[0-9.]+$/)||(b=KJUR.asn1.x509.OID.name2oid(v)),b!==""){for(var T=0;T<E.length;T++)if(E[T].oid===b)return E[T]}},this.getExtBasicConstraints=function(v,E){if(v===void 0&&E===void 0){var b=this.getExtInfo("basicConstraints");if(b===void 0)return;v=o(this.hex,b.vidx),E=b.critical}var T={extname:"basicConstraints"};if(E&&(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,E){if(v===void 0&&E===void 0){var b=this.getExtInfo("keyUsage");if(b===void 0)return;v=o(this.hex,b.vidx),E=b.critical}var T={extname:"keyUsage"};return E&&(T.critical=!0),T.names=this.getExtKeyUsageString(v).split(","),T},this.getExtKeyUsageBin=function(v){if(v===void 0){var E=this.getExtInfo("keyUsage");if(E===void 0)return"";v=o(this.hex,E.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 E=this.getExtKeyUsageBin(v),b=new Array,T=0;T<E.length;T++)E.substr(T,1)=="1"&&b.push(X509.KEYUSAGE_NAME[T]);return b.join(",")},this.getExtSubjectKeyIdentifier=function(v,E){if(v===void 0&&E===void 0){var b=this.getExtInfo("subjectKeyIdentifier");if(b===void 0)return;v=o(this.hex,b.vidx),E=b.critical}var T={extname:"subjectKeyIdentifier"};E&&(T.critical=!0);var _=r(v,0);return T.kid={hex:_},T},this.getExtAuthorityKeyIdentifier=function(v,E){if(v===void 0&&E===void 0){var b=this.getExtInfo("authorityKeyIdentifier");if(b===void 0)return;v=o(this.hex,b.vidx),E=b.critical}var T={extname:"authorityKeyIdentifier"};E&&(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 w=o(v,_[S]),M=this.getGeneralNames(w);T.issuer=M[0].dn}R==="82"&&(T.sn={hex:r(v,_[S])})}return T},this.getExtExtKeyUsage=function(v,E){if(v===void 0&&E===void 0){var b=this.getExtInfo("extKeyUsage");if(b===void 0)return;v=o(this.hex,b.vidx),E=b.critical}var T={extname:"extKeyUsage",array:[]};E&&(T.critical=!0);for(var _=e(v,0),S=0;S<_.length;S++)T.array.push(m(r(v,_[S])));return T},this.getExtExtKeyUsageName=function(){var v=this.getExtInfo("extKeyUsage");if(v===void 0)return v;var E=new Array,b=o(this.hex,v.vidx);if(b==="")return E;for(var T=e(b,0),_=0;_<T.length;_++)E.push(m(r(b,T[_])));return E},this.getExtSubjectAltName=function(v,E){if(v===void 0&&E===void 0){var b=this.getExtInfo("subjectAltName");if(b===void 0)return;v=o(this.hex,b.vidx),E=b.critical}var T={extname:"subjectAltName",array:[]};return E&&(T.critical=!0),T.array=this.getGeneralNames(v),T},this.getExtIssuerAltName=function(v,E){if(v===void 0&&E===void 0){var b=this.getExtInfo("issuerAltName");if(b===void 0)return;v=o(this.hex,b.vidx),E=b.critical}var T={extname:"issuerAltName",array:[]};return E&&(T.critical=!0),T.array=this.getGeneralNames(v),T},this.getGeneralNames=function(v){for(var E=e(v,0),b=[],T=0;T<E.length;T++){var _=this.getGeneralName(o(v,E[T]));_!==void 0&&b.push(_)}return b},this.getGeneralName=function(v){var E=v.substr(0,2),b=r(v,0),T=hextorstr(b);if(E=="81")return{rfc822:T};if(E=="82")return{dns:T};if(E=="86")return{uri:T};if(E=="87")return{ip:hextoip(b)};if(E=="a4")return{dn:this.getX500Name(b)}},this.getExtSubjectAltName2=function(){var v,E,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),w=0;w<R.length;w++)b=S.substr(R[w],2),v=r(S,R[w]),b==="81"&&(E=hextoutf8(v),_.push(["MAIL",E])),b==="82"&&(E=hextoutf8(v),_.push(["DNS",E])),b==="84"&&(E=X509.hex2dn(v,0),_.push(["DN",E])),b==="86"&&(E=hextoutf8(v),_.push(["URI",E])),b==="87"&&(E=hextoip(v),_.push(["IP",E]));return _},this.getExtCRLDistributionPoints=function(v,E){if(v===void 0&&E===void 0){var b=this.getExtInfo("cRLDistributionPoints");if(b===void 0)return;v=o(this.hex,b.vidx),E=b.critical}var T={extname:"cRLDistributionPoints",array:[]};E&&(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 E={},b=e(v,0),T=0;T<b.length;T++){var _=v.substr(b[T],2),S=o(v,b[T]);_=="a0"&&(E.dpname=this.getDistributionPointName(S))}return E},this.getDistributionPointName=function(v){for(var E={},b=e(v,0),T=0;T<b.length;T++){var _=v.substr(b[T],2),S=o(v,b[T]);_=="a0"&&(E.full=this.getGeneralNames(S))}return E},this.getExtCRLDistributionPointsURI=function(){var v=this.getExtInfo("cRLDistributionPoints");if(v===void 0)return v;for(var E=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(_);E.push(S)}catch(R){}return E},this.getExtAIAInfo=function(){var v=this.getExtInfo("authorityInfoAccess");if(v===void 0)return v;for(var E={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"&&E.ocsp.push(hextoutf8(S)),_==="2b06010505073002"&&E.caissuer.push(hextoutf8(S))}return E},this.getExtAuthorityInfoAccess=function(v,E){if(v===void 0&&E===void 0){var b=this.getExtInfo("authorityInfoAccess");if(b===void 0)return;v=o(this.hex,b.vidx),E=b.critical}var T={extname:"authorityInfoAccess",array:[]};E&&(T.critical=!0);for(var _=e(v,0),S=0;S<_.length;S++){var R=u(v,_[S],[0],"06"),w=s(v,_[S],[1],"86"),M=hextoutf8(w);if(R=="2b06010505073001")T.array.push({ocsp:M});else if(R=="2b06010505073002")T.array.push({caissuer:M});else throw new Error("unknown method: "+R)}return T},this.getExtCertificatePolicies=function(v,E){if(v===void 0&&E===void 0){var b=this.getExtInfo("certificatePolicies");if(b===void 0)return;v=o(this.hex,b.vidx),E=b.critical}var T={extname:"certificatePolicies",array:[]};E&&(T.critical=!0);for(var _=e(v,0),S=0;S<_.length;S++){var R=o(v,_[S]),w=this.getPolicyInformation(R);T.array.push(w)}return T},this.getPolicyInformation=function(v){var E={},b=s(v,0,[0],"06");E.policyoid=m(b);var T=f(v,0,[1],"30");if(T!=-1){E.array=[];for(var _=e(v,T),S=0;S<_.length;S++){var R=o(v,_[S]),w=this.getPolicyQualifierInfo(R);E.array.push(w)}}return E},this.getPolicyQualifierInfo=function(v){var E={},b=s(v,0,[0],"06");if(b==="2b06010505070201"){var T=u(v,0,[1],"16");E.cps=hextorstr(T)}else if(b==="2b06010505070202"){var _=l(v,0,[1],"30");E.unotice=this.getUserNotice(_)}return E},this.getUserNotice=function(v){for(var E={},b=e(v,0),T=0;T<b.length;T++){var _=o(v,b[T]);_.substr(0,2)!="30"&&(E.exptext=this.getDisplayText(_))}return E},this.getDisplayText=function(v){var E={"0c":"utf8",16:"ia5","1a":"vis","1e":"bmp"},b={};return b.type=E[v.substr(0,2)],b.str=hextorstr(r(v,0)),b},this.getExtCRLNumber=function(v,E){var b={extname:"cRLNumber"};if(E&&(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,E){var b={extname:"cRLReason"};if(E&&(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,E){var b={extname:"ocspNonce"};E&&(b.critical=!0);var T=r(v,0);return b.hex=T,b},this.getExtOcspNoCheck=function(v,E){var b={extname:"ocspNoCheck"};return E&&(b.critical=!0),b},this.getExtAdobeTimeStamp=function(v,E){if(v===void 0&&E===void 0){var b=this.getExtInfo("adobeTimeStamp");if(b===void 0)return;v=o(this.hex,b.vidx),E=b.critical}var T={extname:"adobeTimeStamp"};E&&(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 w=o(v,_[2]);w=="0101ff"&&(T.reqauth=!0),w=="010100"&&(T.reqauth=!1)}return T},this.getX500NameRule=function(v){for(var E=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],w=R.ds,M=R.value,B=R.type;if(w!="prn"&&w!="utf8"&&w!="ia5")return"mixed";if(w=="ia5"){if(B!="CN")return"mixed";if(KJUR.lang.String.isMail(M))continue;return"mixed"}if(B=="C"){if(w=="prn")continue;return"mixed"}if(E==null)E=w;else if(E!==w)return"mixed"}return E==null?"prn":E},this.getX500Name=function(v){var E=this.getX500NameArray(v),b=this.dnarraytostr(E);return{array:E,str:b}},this.getX500NameArray=function(v){for(var E=[],b=e(v,0),T=0;T<b.length;T++)E.push(this.getRDN(o(v,b[T])));return E},this.getRDN=function(v){for(var E=[],b=e(v,0),T=0;T<b.length;T++)E.push(this.getAttrTypeAndValue(o(v,b[T])));return E},this.getAttrTypeAndValue=function(v){var E={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 E.type=KJUR.asn1.x509.OID.oid2atype(S),E.ds=this.HEX2STAG[v.substr(b[1],2)],E.ds!="bmp"?E.value=hextoutf8(_):E.value=ucs2hextoutf8(_),E},this.readCertPEM=function(v){this.readCertHex(g(v))},this.readCertHex=function(v){this.hex=v,this.getVersion();try{p(this.hex,0,[0,7],"a3"),this.parseExt()}catch(E){}},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 E=f(this.hex,0,[0,"[3]"]);E!=-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 E=e(v,0),b=E.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 w={extname:T,extn:S};return _&&(w.critical=!0),w},this.findExt=function(v,E){for(var b=0;b<v.length;b++)if(v[b].extname==E)return v[b];return null},this.dnarraytostr=function(v){function E(T){return T.map(function(_){return b(_).replace(/\+/,"\\+")}).join("+")}function b(T){return T.type+"="+T.value}return"/"+v.map(function(T){return E(T).replace(/\//,"\\/")}).join("/")},this.getInfo=function(){var v=function(U){var z=JSON.stringify(U.array).replace(/[\[\]\{\}\"]/g,"");return z},E=function(U){for(var z="",K=U.array,j=0;j<K.length;j++){var Q=K[j];if(z+=" policy oid: "+Q.policyoid+`
363
363
  `,Q.array!==void 0)for(var V=0;V<Q.array.length;V++){var J=Q.array[V];J.cps!==void 0&&(z+=" cps: "+J.cps+`
364
- `)}}return z},b=function(U){for(var z="",G=U.array,j=0;j<G.length;j++){var Q=G[j];try{Q.dpname.full[0].uri!==void 0&&(z+=" "+Q.dpname.full[0].uri+`
364
+ `)}}return z},b=function(U){for(var z="",K=U.array,j=0;j<K.length;j++){var Q=K[j];try{Q.dpname.full[0].uri!==void 0&&(z+=" "+Q.dpname.full[0].uri+`
365
365
  `)}catch(V){}try{Q.dname.full[0].dn.hex!==void 0&&(z+=" "+X509.hex2dn(Q.dpname.full[0].dn.hex)+`
366
- `)}catch(V){}}return z},T=function(U){for(var z="",G=U.array,j=0;j<G.length;j++){var Q=G[j];Q.caissuer!==void 0&&(z+=" caissuer: "+Q.caissuer+`
366
+ `)}catch(V){}}return z},T=function(U){for(var z="",K=U.array,j=0;j<K.length;j++){var Q=K[j];Q.caissuer!==void 0&&(z+=" caissuer: "+Q.caissuer+`
367
367
  `),Q.ocsp!==void 0&&(z+=" ocsp: "+Q.ocsp+`
368
368
  `)}return z},_,S,R;if(_=`Basic Fields
369
369
  `,_+=" serial number: "+this.getSerialNumberHex()+`
@@ -394,7 +394,7 @@
394
394
  `)),v.fragmentShader=v.fragmentShader.replace(/MAIN_START/g,P.map(function(Q){return Q.fragment.mainStart}).filter(function(Q){return!!Q}).join(`
395
395
  `)),v.fragmentShader=v.fragmentShader.replace(/MAIN_END/g,P.map(function(Q){return Q.fragment.mainEnd}).filter(function(Q){return!!Q}).join(`
396
396
  `)),v.fragmentShader=v.fragmentShader.replace(/MAIN_MODEL_COLOR/g,P.map(function(Q){return Q.fragment.mainModelColor}).filter(function(Q){return!!Q}).join(`
397
- `));var U=String(r.clippers.length);v.vertexShader=v.vertexShader.replace(/NUM_CLIPPERS/g,U),v.fragmentShader=v.fragmentShader.replace(/NUM_CLIPPERS/g,U);for(var z=0,G=P;z<G.length;z++){var j=G[z];j.onBeforeCompile&&j.onBeforeCompile(v,E)}};var c="";r.onBeforeRender=function(v,E,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 w=r.customShaders.filter(function(B){return B.type.includes(R)}),M=w.map(function(B){return"".concat(B.id,":").concat(B.version)}).join("|");c!==M&&(c=M,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 m=null;defineProperty(r,"pano0Depth",{get:function(){return m},set:function(v){if(m!==v){m=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 E=m!==null&&A!==null;u.USE_PANO_DEPTH!==E&&(u.USE_PANO_DEPTH=E,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 E=m!==null&&A!==null;u.USE_PANO_DEPTH!==E&&(u.USE_PANO_DEPTH=E,this.needsUpdate=!0)}}});var g=null;defineProperty(r,"refinedScreen",{get:function(){return g},set:function(v){if(g!==v){g=v;var E;v===null?(E=!1,l.refinedScreen.value={matrixInverse:new THREE__namespace.Matrix4,projectionMatrix:new THREE__namespace.Matrix4,map:null,pano:0,opacity:0}):(E=!0,l.refinedScreen.value={matrixInverse:v.matrixInverse,projectionMatrix:v.projectionMatrix,map:v.map,pano:v.pano,opacity:v.opacity}),u.USE_REFINED_SCREEN!==E&&(u.USE_REFINED_SCREEN=E,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 E=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;E!==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 E=v==="CONSTANT",b=v==="ALTITUDE";u.USE_COLOR_CONSTANT!==E&&(u.USE_COLOR_CONSTANT=E,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 E=v==="VISIBILITY";u.USE_FLOOR_STYLE_VISIBILITY!==E&&(u.USE_FLOOR_STYLE_VISIBILITY=E,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 y=[];return defineProperty(r,"clippers",{get:function(){return y},set:function(v){y!==v&&(y=v,l.clippers.value=y.map(function(E){var b=typeof E.floorIndex=="number"?E.floorIndex:-1,T=new THREE__namespace.Matrix4().getInverse(E.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 E=l.colorSaturation.value!==0||l.colorBrightness.value!==0;u.USE_COLOR_ADJUSTMENT!==E&&(u.USE_COLOR_ADJUSTMENT=E,this.needsUpdate=!0)}}),defineProperty(r,"colorBrightness",{get:function(){return l.colorBrightness.value},set:function(v){l.colorBrightness.value=v;var E=l.colorSaturation.value!==0||l.colorBrightness.value!==0;u.USE_COLOR_ADJUSTMENT!==E&&(u.USE_COLOR_ADJUSTMENT=E,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),toFastProperties(r),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)},toFastProperties(o),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)},toFastProperties(s),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--rpA-z]|vv|{-J-vrZnv\x07-7-d|yq]|vv|{H--tyl]|vv|{-J-}|wrpv|{Znv\x07-7-z]|vv|{H--Sv{ny]|vv|{-J-d|yq]|vv|{H--0v{pyqr-Iy|tqr}uoslrr\x07K--0v{pyqr-Ipyv}}v{tl}yn{rlrr\x07K--zn@-pnzrn_|nv|{Znv\x07-J-zn@5vrZnv\x07h=jh=j9-vrZnv\x07h>jh=j9-vrZnv\x07h?jh=j9-vrZnv\x07h=jh>j9-vrZnv\x07h>jh>j9-vrZnv\x07h?jh>j9-vrZnv\x07h=jh?j9-vrZnv\x07h>jh?j9-vrZnv\x07h?jh?j6H--PnzrnQvrpv|{-J-{|znyv r5pnzrn_|nv|{Znv\x07-7-rp@5=;=9-=;=9-:>;=66H--<<传递nvor的p|y|到s里使用--<<动态调整}|v{`v r--sy|n-rny]|v{`v r-J-}|v{`pnyr-7-}v\x07ry_nv|H--0vs-qrsv{rq5b`Rl]\\V[al`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);toFastProperties(s),toFastProperties(o),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 m=0,A=Object.keys(o);m<A.length;m++){var g=A[m];g in definesLib||(o[g]=void 0)}for(var y=0,v=Object.keys(s);y<v.length;y++){var E=v[y];E in uniformsLib||(s[E]=void 0)}for(var b=r.customShaders.filter(function(L){return L.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 w in S.defines)w in o||Object.assign(o,(d={},d[w]=S.defines[w],d))}toFastProperties(s),toFastProperties(o),c.vertexShader=c.vertexShader.replace(/MAIN_BEFORE/g,b.map(function(L){return L.vertex.mainBefore}).filter(function(L){return!!L}).join(`
397
+ `));var U=String(r.clippers.length);v.vertexShader=v.vertexShader.replace(/NUM_CLIPPERS/g,U),v.fragmentShader=v.fragmentShader.replace(/NUM_CLIPPERS/g,U);for(var z=0,K=P;z<K.length;z++){var j=K[z];j.onBeforeCompile&&j.onBeforeCompile(v,E)}};var c="";r.onBeforeRender=function(v,E,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 w=r.customShaders.filter(function(B){return B.type.includes(R)}),M=w.map(function(B){return"".concat(B.id,":").concat(B.version)}).join("|");c!==M&&(c=M,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 m=null;defineProperty(r,"pano0Depth",{get:function(){return m},set:function(v){if(m!==v){m=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 E=m!==null&&A!==null;u.USE_PANO_DEPTH!==E&&(u.USE_PANO_DEPTH=E,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 E=m!==null&&A!==null;u.USE_PANO_DEPTH!==E&&(u.USE_PANO_DEPTH=E,this.needsUpdate=!0)}}});var g=null;defineProperty(r,"refinedScreen",{get:function(){return g},set:function(v){if(g!==v){g=v;var E;v===null?(E=!1,l.refinedScreen.value={matrixInverse:new THREE__namespace.Matrix4,projectionMatrix:new THREE__namespace.Matrix4,map:null,pano:0,opacity:0}):(E=!0,l.refinedScreen.value={matrixInverse:v.matrixInverse,projectionMatrix:v.projectionMatrix,map:v.map,pano:v.pano,opacity:v.opacity}),u.USE_REFINED_SCREEN!==E&&(u.USE_REFINED_SCREEN=E,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 E=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;E!==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 E=v==="CONSTANT",b=v==="ALTITUDE";u.USE_COLOR_CONSTANT!==E&&(u.USE_COLOR_CONSTANT=E,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 E=v==="VISIBILITY";u.USE_FLOOR_STYLE_VISIBILITY!==E&&(u.USE_FLOOR_STYLE_VISIBILITY=E,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 y=[];return defineProperty(r,"clippers",{get:function(){return y},set:function(v){y!==v&&(y=v,l.clippers.value=y.map(function(E){var b=typeof E.floorIndex=="number"?E.floorIndex:-1,T=new THREE__namespace.Matrix4().getInverse(E.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 E=l.colorSaturation.value!==0||l.colorBrightness.value!==0;u.USE_COLOR_ADJUSTMENT!==E&&(u.USE_COLOR_ADJUSTMENT=E,this.needsUpdate=!0)}}),defineProperty(r,"colorBrightness",{get:function(){return l.colorBrightness.value},set:function(v){l.colorBrightness.value=v;var E=l.colorSaturation.value!==0||l.colorBrightness.value!==0;u.USE_COLOR_ADJUSTMENT!==E&&(u.USE_COLOR_ADJUSTMENT=E,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),toFastProperties(r),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)},toFastProperties(o),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)},toFastProperties(s),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--rpA-z]|vv|{-J-vrZnv\x07-7-d|yq]|vv|{H--tyl]|vv|{-J-}|wrpv|{Znv\x07-7-z]|vv|{H--Sv{ny]|vv|{-J-d|yq]|vv|{H--0v{pyqr-Iy|tqr}uoslrr\x07K--0v{pyqr-Ipyv}}v{tl}yn{rlrr\x07K--zn@-pnzrn_|nv|{Znv\x07-J-zn@5vrZnv\x07h=jh=j9-vrZnv\x07h>jh=j9-vrZnv\x07h?jh=j9-vrZnv\x07h=jh>j9-vrZnv\x07h>jh>j9-vrZnv\x07h?jh>j9-vrZnv\x07h=jh?j9-vrZnv\x07h>jh?j9-vrZnv\x07h?jh?j6H--PnzrnQvrpv|{-J-{|znyv r5pnzrn_|nv|{Znv\x07-7-rp@5=;=9-=;=9-:>;=66H--<<传递nvor的p|y|到s里使用--<<动态调整}|v{`v r--sy|n-rny]|v{`v r-J-}|v{`pnyr-7-}v\x07ry_nv|H--0vs-qrsv{rq5b`Rl]\\V[al`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);toFastProperties(s),toFastProperties(o),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 m=0,A=Object.keys(o);m<A.length;m++){var g=A[m];g in definesLib||(o[g]=void 0)}for(var y=0,v=Object.keys(s);y<v.length;y++){var E=v[y];E in uniformsLib||(s[E]=void 0)}for(var b=r.customShaders.filter(function(L){return L.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 w in S.defines)w in o||Object.assign(o,(d={},d[w]=S.defines[w],d))}toFastProperties(s),toFastProperties(o),c.vertexShader=c.vertexShader.replace(/MAIN_BEFORE/g,b.map(function(L){return L.vertex.mainBefore}).filter(function(L){return!!L}).join(`
398
398
  `)),c.vertexShader=c.vertexShader.replace(/MAIN_START/g,b.map(function(L){return L.vertex.mainStart}).filter(function(L){return!!L}).join(`
399
399
  `)),c.vertexShader=c.vertexShader.replace(/MAIN_END/g,b.map(function(L){return L.vertex.mainEnd}).filter(function(L){return!!L}).join(`
400
400
  `)),c.fragmentShader=c.fragmentShader.replace(/MAIN_BEFORE/g,b.map(function(L){return L.fragment.mainBefore}).filter(function(L){return!!L}).join(`
@@ -402,7 +402,7 @@
402
402
  `)),c.fragmentShader=c.fragmentShader.replace(/MAIN_END/g,b.map(function(L){return L.fragment.mainEnd}).filter(function(L){return!!L}).join(`
403
403
  `)),c.fragmentShader=c.fragmentShader.replace(/MAIN_MODEL_COLOR/g,b.map(function(L){return L.fragment.mainModelColor}).filter(function(L){return!!L}).join(`
404
404
  `));var M=String(r.clippers.length);c.vertexShader=c.vertexShader.replace(/NUM_CLIPPERS/g,M),c.fragmentShader=c.fragmentShader.replace(/NUM_CLIPPERS/g,M);for(var B=0,C=b;B<C.length;B++){var P=C[B];P.onBeforeCompile&&P.onBeforeCompile(c,p)}};var u="";r.onBeforeRender=function(c,p,f,d,h,m){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 g=r.customShaders.filter(function(v){return v.type.includes(A)}),y=g.map(function(v){return"".concat(v.id,":").concat(v.version)}).join("|");u!==y&&(u=y,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),toFastProperties(r),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 getValueKeys(n){return Object.keys(n)}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}function vector3Equal(n,t){return n instanceof THREE__namespace.Vector3&&t instanceof THREE__namespace.Vector3?n.equals(t):n===t}function box3Equal(n,t){return n instanceof THREE__namespace.Box3&&t instanceof THREE__namespace.Box3?n.equals(t):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:vector3Equal,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,boundingBox:box3Equal,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},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([]),defineBoundingBox=Object.freeze(new THREE__namespace.Box3),defineCustomShaders=Object.freeze([]),defineCacheCameras=Object.freeze([]);function createUndefindValue(){return{customShaders:void 0,castShadow:void 0,receiveShadow:void 0,vertexMarks:void 0,pano0:void 0,pano1:void 0,pano0Depth:void 0,pano1Depth:void 0,refinedScreen:void 0,floorStyle:void 0,colorStyle:void 0,constantColor:void 0,shownFloorIndex:void 0,modelAlpha:void 0,logDepthAlpha:void 0,opacity:void 0,progress:void 0,transition:void 0,clippers:void 0,brightness:void 0,useHQWeight:void 0,useHQDepth:void 0,pointSize:void 0,pointBack:void 0,pointShape:void 0,pointScale:void 0,pointMaxPixel:void 0,pointMinPixel:void 0,pointAppearAnimation:void 0,gradientTexture:void 0,colorSaturation:void 0,colorBrightness:void 0,outlineGain:void 0,distanceGain:void 0,useAddBlend:void 0,boundingBox:void 0,minLevelOfDetail:void 0,maxLevelOfDetail:void 0,minGeometricError:void 0,maxGeometricError:void 0,panoramaMinGeometricError:void 0,skipLevelOfDetail:void 0,mostDetail:void 0,loadSiblings:void 0,cameraCulling:void 0,maxMemoryUsage:void 0,maxRequests:void 0,requestOrder:void 0,maxScreenSpaceError:void 0,memoryAdjustedOverflow:void 0,memoryAdjustedScreenSpaceError:void 0,cacheCameras:void 0}}function createDefaultValue(){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,boundingBox:defineBoundingBox,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}}var parameterKeys=getValueKeys(createUndefindValue());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)}function copyValue(n,t,e){return assignValue(n,e,t[e])}var Parameter=(function(){function n(t){this.id=createUuid(),this.versionNumber=0,this.value=createUndefindValue(),t&&this.copy(t);for(var e=function(l){Object.defineProperty(r,l,{get:function(){return this.value[l]}})},r=this,o=0,s=parameterKeys;o<s.length;o++){var u=s[o];e(u)}toFastProperties(this)}return n.createDefault=function(){return createDefaultValue()},n.resolveValue=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];for(var r=Object.assign(this.createDefault(),{versions:[],version:""}),o=0,s=t;o<s.length;o++){var u=s[o],l=u instanceof n?u.version:createUuid();r.versions.push(l);for(var c=0,p=parameterKeys;c<p.length;c++){var f=p[c];u[f]!==void 0&&copyValue(r,u,f)}}return r.version=r.versions.toString(),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,__spreadArray(__spreadArray([],t,!1),[this],!1))},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=0,l=parameterKeys;u<l.length;u++){var c=l[u];if(s[c]!==void 0){var o=copyValue(this.value,s,c);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],l=assignValue(this.value,u,void 0);l&&(r=!0)}return r&&this.versionNumber++,this},n.prototype.resetAll=function(){return this.reset.apply(this,parameterKeys)},n.prototype.copy=function(t){for(var e=!0,r=0,o=parameterKeys;r<o.length;r++){var s=o[r],u=copyValue(this.value,t,s);u&&(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().version},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,m=f.apply(void 0,e);h&&this.off(t,f),m===!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(){}var JSONP_REGEXPS=[/\.([0-9a-z]+)\.jsonp([\?\#].*)?$/i,/jsonp_([0-9a-z]+)([\?\#].*)?$/i],locationHref=typeof location!="undefined"?location.href:"",locationIsHttps=/^https\:/.test(locationHref),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);(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 isJsonp(n){return matchJsonpFunctionName(n)!==null}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),r===void 0&&(r=noop),o===void 0&&(o=noop);var s=now(),u=n;return Promise.resolve().then(function(){return t.requestProxy?t.requestProxy(n):n}).then(function(l){return locationIsHttps&&/^http\:/.test(l)?(console.warn("The page at '".concat(locationHref,"' 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;matchJsonpFunctionName(n);var p=new NetworkProxyError(u,"XMLHttpRequest",l&&l.message?String(l.message):String(l));return(c=t.networkSubscribe)===null||c===void 0||c.emit("network",n,"XMLHttpRequest","forbidden",p.message),Promise.reject(p)}).then(function(l){return new Promise(function(c,p){var f=matchJsonpFunctionName(l);if(f){var d=window,h=null,m=!1,A=document.createElement("script"),g=function(){var w;if(h=null,m!==!0){m=!0;var M=new NetworkTimeoutError(l,"XMLHttpRequest",t.timeout||NaN);r(M),p(M),(w=t.networkSubscribe)===null||w===void 0||w.emit("network",l,"XMLHttpRequest","timeout",M.message)}},y=function(w){var M,B,C=now(),P=C-s;if(delete d[f],A.parentNode&&A.parentNode.removeChild(A),h!==null&&(window.clearTimeout(h),h=null),m!==!0){if(w.indexOf("data:")!==0){var L=new NetworkResponseError(l,"XMLHttpRequest",500);r(L),p(L),(M=t.networkSubscribe)===null||M===void 0||M.emit("network",l,"XMLHttpRequest","error",L.message);return}var O=w.split(","),F=(O[0].match(/:(.*?);/)||[])[1],N=O[1];if(t.responseType==="arraybuffer"||t.responseType==="blob"){for(var D=atob(O[1]),U=D.length,z=new Uint8Array(U),G=0;G<U;G++)z[G]=D.charCodeAt(G);t.responseType==="arraybuffer"?N=z.buffer:N=new Blob([z],{type:F})}var j={},Q={body:N,meta:{origin:u,source:l,requestTime:s,responseTime:C,costs:P,headers:j}};e(Q),c(Q),(B=t.networkSubscribe)===null||B===void 0||B.emit("network",l,"XMLHttpRequest","ok",JSON.stringify(Q.meta)),m=!0}};d[f]=y,A.src=l,document.body.appendChild(A),typeof t.timeout=="number"&&(h=window.setTimeout(g,t.timeout))}else{var v=!1,E=new XMLHttpRequest,b=function(){E&&(E.removeEventListener("timeout",T,!1),E.removeEventListener("progress",_,!1),E.removeEventListener("load",S,!1),E.removeEventListener("error",R,!1)),E=null,b=noop},T=function(){var w;if(v!==!0){v=!0,b();var M=new NetworkTimeoutError(l,"XMLHttpRequest",t.timeout||NaN);r(M),p(M),(w=t.networkSubscribe)===null||w===void 0||w.emit("network",l,"XMLHttpRequest","timeout",M.message)}},_=function(w){v!==!0&&w.lengthComputable&&(w.total<=0||o(w.loaded/w.total))},S=function(w){var M;if(v!==!0){var B=this.status;if(B===0||B>=200&&B<400){v=!0,b();var C=now(),P=C-s,L=parseHeaders(this.getAllResponseHeaders()),O=w.total,F={body:this.response,meta:{origin:u,source:l,requestTime:s,responseTime:C,costs:P,headers:L,size:O}};e(F),c(F),(M=t.networkSubscribe)===null||M===void 0||M.emit("network",l,"XMLHttpRequest","ok",JSON.stringify(F.meta))}else R.call(this)}},R=function(){var w;if(v!==!0){v=!0,b();var M=new NetworkResponseError(l,"XMLHttpRequest",this.status);r(M),p(M),(w=t.networkSubscribe)===null||w===void 0||w.emit("network",l,"XMLHttpRequest","error",M.message)}};E.addEventListener("timeout",T,!1),E.addEventListener("progress",_,!1),E.addEventListener("load",S,!1),E.addEventListener("error",R,!1),t.responseType&&(E.responseType=t.responseType),typeof t.timeout=="number"&&(E.timeout=t.timeout),E.open("GET",l,!0),E.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 locationIsHttps&&/^http\:/.test(o)?(console.warn("The page at '".concat(locationHref,"' 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","forbidden",u.message),Promise.reject(u)}).then(function(o){return o in preloadCache?preloadCache[o]:preloadCache[o]=new Promise(function(s,u){var l=document.head||document.getElementsByTagName("head")[0],c=document.createElement("link"),p=!1,f=null;c.onload=function(d){var h;if(f!==null&&(clearTimeout(f),f=null),p!==!0){p=!0,s(),c.onerror=noop,c.onload=noop;var m=now(),A=m-e,g={},y={origin:r,source:o,requestTime:e,responseTime:m,costs:A,headers:g};(h=t.networkSubscribe)===null||h===void 0||h.emit("network",o,"Link","preload",JSON.stringify(y))}},c.onerror=function(d){var h;if(f!==null&&(clearTimeout(f),f=null),p!==!0){p=!0,delete preloadCache[o],l&&c.parentNode===l&&l.removeChild(c);var m=new NetworkResponseError(o,"Link",0);u(m),c.onerror=noop,c.onload=noop,(h=t.networkSubscribe)===null||h===void 0||h.emit("network",o,"Link","error",m.message)}},typeof t.timeout=="number"&&(f=window.setTimeout(function(){var d;if(f=null,p!==!0){p=!0,s(),c.onerror=noop,c.onload=noop;var h=now(),m=h-e,A={},g={origin:r,source:o,requestTime:e,responseTime:h,costs:m,headers:A};(d=t.networkSubscribe)===null||d===void 0||d.emit("network",o,"Link","timeout",JSON.stringify(g))}},t.timeout)),c.rel=c.relList&&c.relList.supports("prefetch")?"prefetch":"preload",c.as="fetch",c.crossOrigin="",c.fetchPriority="high",c.href=o,l&&l.appendChild(c)})})}function loadImage(n,t,e,r,o,s){t===void 0&&(t={}),e===void 0&&(e=noop),r===void 0&&(r=noop),o===void 0&&(o=noop);var u=now(),l=n;return Promise.resolve().then(function(){return t.requestProxy?t.requestProxy(n):n}).then(function(c){return locationIsHttps&&/^http\:/.test(c)?(console.warn("The page at '".concat(locationHref,"' 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","forbidden",f.message),Promise.reject(f)}).then(function(c){return isJsonp(c)?ajax(c,{responseType:"blob",networkSubscribe:t.networkSubscribe}).then(function(p){return URL.createObjectURL(p.body)}):c}).then(function(c){return new Promise(function(p,f){var d=s!=null?s:new Image,h=!1,m=null,A=function(){var y;if(d.onload=noop,d.onerror=noop,m!==null&&(clearTimeout(m),m=null),h!==!0){var v=now(),E={headers:{},origin:l,source:c,requestTime:u,responseTime:v,costs:v-u};h=!0;var b={body:d,meta:E};o(1),e(b),p(b),(y=t.networkSubscribe)===null||y===void 0||y.emit("network",c,"Image","ok",JSON.stringify(b.meta))}},g=function(){var y;if(d.onload=noop,d.onerror=noop,m!==null&&(clearTimeout(m),m=null),h!==!0){h=!0;var v=new NetworkResponseError(c,"Image",0);r(v),f(v),(y=t.networkSubscribe)===null||y===void 0||y.emit("network",c,"Image","ok",v.message)}};typeof t.timeout=="number"&&(m=window.setTimeout(function(){var y;if(d.onload=noop,d.onerror=noop,m=null,h!==!0){h=!0;var v=new NetworkTimeoutError(c,"Image",t.timeout);r(v),f(v),(y=t.networkSubscribe)===null||y===void 0||y.emit("network",c,"Image","timeout",v.message)}},t.timeout)),d.onload=A,d.onerror=g,o(0),d.src=c})})}var Fetcher=(function(){function n(t){t===void 0&&(t={}),this.options=t}return n.prototype.ajax=function(t,e,r,o,s){var u;e===void 0&&(e={}),r===void 0&&(r=noop),o===void 0&&(o=noop),s===void 0&&(s=noop);var l=this.options,c={responseType:e.responseType,timeout:(u=e.timeout)!==null&&u!==void 0?u:l.timeout,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),o===void 0&&(o=noop),s===void 0&&(s=noop);var c=this.options,p={timeout:(l=e.timeout)!==null&&l!==void 0?l:c.timeout,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 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={},r=new Set(t),o=0,s=Object.keys(n);o<s.length;o++){var u=s[o];r.has(u)||(e[u]=n[u])}return e}function omitUndefinedFields(n){var t={};for(var e in n){var r=n[e];r!==void 0&&(t[e]=r)}return t}function pathJoin(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];var e=[];n=n.map(function(l){return(l!=null?l:"").trim()}).filter(function(l){return l.length>0&&!/^\/+$/.test(l)});for(var r=0;r<n.length;r++){var o=r===0,s=r===n.length-1,u=n[r];o||(u=u.replace(/^\.\//,"").replace(/^\/+/,"")),s||(u=u.replace(/\/+$/,"")),e.push(u)}return e.join("/")}function isAbsoluteURL(n){return n.indexOf("/")===0||/^[0-9a-z]+\:/i.test(n)}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,f=t.forceUseExifOrientation;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 d=s!=null?s:r;d&&["jpg","webp","heic","avif"].indexOf(d)>=0&&o.push("quality/".concat(l))}if(c!==void 0){var h=n.match(/\/cube_(\d+)\//),m=h?Number(h[1]):NaN;m!==Number(c)&&o.push("thumbnail/".concat(c,"x"))}p!==void 0&&o.push("sharpen/".concat(p)),f===!0&&o.push("auto-orient");var A="";return o.length&&(A="?imageMogr2/"+o.join("/")),e+A},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],m=u[3];o.push("crop,x_".concat(f,",y_").concat(d,",w_").concat(h,",h_").concat(m,",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 g="";return o.length&&(g="?x-oss-process=image/"+o.join("/")),e+g},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 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})(),browserSupportsImageBitmapApi=typeof createImageBitmap!="undefined"&&typeof ImageBitmap!="undefined",_useNativeImageBitmap=!1;function useNativeImageBitmap(n){_useNativeImageBitmap=n}function canUseNativeImageBitmap(){return _useNativeImageBitmap===!1?!1:browserSupportsImageBitmapApi}function createImageBitmapLikeImage(n){n===void 0&&(n={});var t=n.onClose,e=Object.assign(document.createElementNS("http://www.w3.org/1999/xhtml","img"),{crossOrigin:"",close:function(){t&&t.call(this),this.onerror=this.onload=this.close=noop,this.removeAttribute("src"),t=void 0}});return e}function createImageBitmapLike(n){if(canUseNativeImageBitmap())return createImageBitmap(n);var t=URL.createObjectURL(n),e=function(){this.src===t&&URL.revokeObjectURL(t)};return new Promise(function(r,o){var s=createImageBitmapLikeImage({onClose:e});s.onload=function(){s.src===t&&URL.revokeObjectURL(t),s.onload=s.onerror=noop,AnimationFrameLoop.shared.add(function(){r(s)},!0)},s.onerror=function(){var u=s.src;s.onload=s.onerror=noop,s.close(),o(new Error("image load error: ".concat(u)))},s.decoding="async",s.src=t})}var canvasPool=[];function createCanvas(n,t){var e=canvasPool.pop();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,canvasPool.push(r)}});return r}function imageBitmapToTexture(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,u.flipY===!1&&(u.repeat.y*=-1,u.offset.y+=1,u.updateMatrix());var l=u.dispose;return u.dispose=function(){this.image&&this.image.close(),l.call(u),u.dispose=l},u}}function imageBitmapsToCubeTexture(n){var t=new THREE__namespace.CubeTexture(n);t.needsUpdate=!0,t.flipY=!1;var e=t.dispose;return t.dispose=function(){if(Array.isArray(this.images))for(var r=0,o=this.images;r<o.length;r++){var s=o[r];s.close()}e.call(t),t.dispose=e},t}var FACE_ORDER$2=["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,m;r===void 0&&(r=noop),o===void 0&&(o=noop),s===void 0&&(s=noop);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 g=(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,g);var y=(m=e.viaAjax)!==null&&m!==void 0?m:canUseNativeImageBitmap;if(y){var v=null,E="blob";return e.fetcher.ajax(t,{timeout:e.timeout,responseType:E},void 0,void 0,s).then(function(_){return createImageBitmapLike(_.body)}).then(function(_){return imageBitmapToTexture(_,e.maxSize)}).then(function(_){return Object.assign(_,A),_}).then(function(_){var S={meta:v,body:_};return r(S),S}).catch(function(_){return o(_),Promise.reject(_)})}else{var b=null,T;return Promise.resolve().then(function(){return createImageBitmapLikeImage()}).then(function(_){return T=_,e.fetcher.loadImage(t,{timeout:e.timeout},void 0,void 0,s,_)}).then(function(_){return b=_.meta,imageBitmapToTexture(_.body,e.maxSize)}).then(function(_){return Object.assign(_,A),_}).then(function(_){var S={meta:b,body:_};return r(S),S}).catch(function(_){return T&&T.close(),o(_),Promise.reject(_)})}},n.prototype.loadCubeTexture=function(t,e,r,o,s,u){var l,c,p,f,d,h,m;r===void 0&&(r=noop),o===void 0&&(o=noop),s===void 0&&(s=noop);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 g=[t[FACE_ORDER$2[0]],t[FACE_ORDER$2[1]],t[FACE_ORDER$2[2]],t[FACE_ORDER$2[3]],t[FACE_ORDER$2[4]],t[FACE_ORDER$2[5]]],y=[],v=[0,0,0,0,0,0],E=[],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(g[_],(h=e.imageURL)===null||h===void 0?void 0:h.transform,__assign(__assign({},S),{key:S.key+"."+FACE_ORDER$2[_]})),w=function(L){v[_]=L,s(v.reduce(function(O,F){return O+F},0)/6)},M=(m=e.viaAjax)!==null&&m!==void 0?m:!1;if(M){var B="blob",C=e.fetcher.ajax(R,{timeout:e.timeout,responseType:B},void 0,void 0,w).then(function(L){return E[_]=L.meta,createImageBitmapLike(L.body)});y.push(C)}else{var P,C=Promise.resolve().then(function(){return createImageBitmapLikeImage()}).then(function(O){return P=O,e.fetcher.loadImage(R,{timeout:e.timeout},void 0,void 0,w,O)}).then(function(O){return E[_]=O.meta,O.body}).catch(function(O){return P&&P.close(),Promise.reject(O)});y.push(C)}},T=0;T<6;T++)b(T);return Promise.all(y).then(function(_){return imageBitmapsToCubeTexture(_)}).then(function(_){return Object.assign(_,__assign({encoding:THREE__namespace.sRGBEncoding},A)),_}).then(function(_){var S={body:_,meta:E};return r(S),S}).catch(function(_){for(var S=0,R=y;S<R.length;S++){var w=R[S];w.then(function(M){return M.close()}).catch(noop)}return o(_),Promise.reject(_)})},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$1(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,hasRequiredAspromise;function requireAspromise(){if(hasRequiredAspromise)return aspromise;hasRequiredAspromise=1,aspromise=n;function n(t,e){for(var r=new Array(arguments.length-1),o=0,s=2,u=!0;s<arguments.length;)r[o++]=arguments[s++];return new Promise(function(c,p){r[o]=function(d){if(u)if(u=!1,d)p(d);else{for(var h=new Array(arguments.length-1),m=0;m<h.length;)h[m++]=arguments[m];c.apply(null,h)}};try{t.apply(e||null,r)}catch(f){u&&(u=!1,p(f))}})}return aspromise}var base64={},hasRequiredBase64;function requireBase64(){return hasRequiredBase64||(hasRequiredBase64=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,m=0,A;c<p;){var g=l[c++];switch(m){case 0:d[h++]=e[g>>2],A=(g&3)<<4,m=1;break;case 1:d[h++]=e[A|g>>4],A=(g&15)<<2,m=2;break;case 2:d[h++]=e[A|g>>6],d[h++]=e[g&63],m=0;break}h>8191&&((f||(f=[])).push(String.fromCharCode.apply(String,d)),h=0)}return m&&(d[h++]=e[A],d[h++]=61,m===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,m=0;m<l.length;){var A=l.charCodeAt(m++);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)),base64}var eventemitter,hasRequiredEventemitter;function requireEventemitter(){if(hasRequiredEventemitter)return eventemitter;hasRequiredEventemitter=1,eventemitter=n;function n(){this._listeners={}}return n.prototype.on=function(e,r,o){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:r,ctx:o||this}),this},n.prototype.off=function(e,r){if(e===void 0)this._listeners={};else if(r===void 0)this._listeners[e]=[];else for(var o=this._listeners[e],s=0;s<o.length;)o[s].fn===r?o.splice(s,1):++s;return this},n.prototype.emit=function(e){var r=this._listeners[e];if(r){for(var o=[],s=1;s<arguments.length;)o.push(arguments[s++]);for(s=0;s<r.length;)r[s].fn.apply(r[s++].ctx,o)}return this},eventemitter}var float,hasRequiredFloat;function requireFloat(){if(hasRequiredFloat)return float;hasRequiredFloat=1,float=n(n);function n(s){return typeof Float32Array!="undefined"?(function(){var u=new Float32Array([-0]),l=new Uint8Array(u.buffer),c=l[3]===128;function p(m,A,g){u[0]=m,A[g]=l[0],A[g+1]=l[1],A[g+2]=l[2],A[g+3]=l[3]}function f(m,A,g){u[0]=m,A[g]=l[3],A[g+1]=l[2],A[g+2]=l[1],A[g+3]=l[0]}s.writeFloatLE=c?p:f,s.writeFloatBE=c?f:p;function d(m,A){return l[0]=m[A],l[1]=m[A+1],l[2]=m[A+2],l[3]=m[A+3],u[0]}function h(m,A){return l[3]=m[A],l[2]=m[A+1],l[1]=m[A+2],l[0]=m[A+3],u[0]}s.readFloatLE=c?d:h,s.readFloatBE=c?h:d})():(function(){function u(c,p,f,d){var h=p<0?1:0;if(h&&(p=-p),p===0)c(1/p>0?0:2147483648,f,d);else if(isNaN(p))c(2143289344,f,d);else if(p>34028234663852886e22)c((h<<31|2139095040)>>>0,f,d);else if(p<11754943508222875e-54)c((h<<31|Math.round(p/1401298464324817e-60))>>>0,f,d);else{var m=Math.floor(Math.log(p)/Math.LN2),A=Math.round(p*Math.pow(2,-m)*8388608)&8388607;c((h<<31|m+127<<23|A)>>>0,f,d)}}s.writeFloatLE=u.bind(null,t),s.writeFloatBE=u.bind(null,e);function l(c,p,f){var d=c(p,f),h=(d>>31)*2+1,m=d>>>23&255,A=d&8388607;return m===255?A?NaN:h*(1/0):m===0?h*1401298464324817e-60*A:h*Math.pow(2,m-150)*(A+8388608)}s.readFloatLE=l.bind(null,r),s.readFloatBE=l.bind(null,o)})(),typeof Float64Array!="undefined"?(function(){var u=new Float64Array([-0]),l=new Uint8Array(u.buffer),c=l[7]===128;function p(m,A,g){u[0]=m,A[g]=l[0],A[g+1]=l[1],A[g+2]=l[2],A[g+3]=l[3],A[g+4]=l[4],A[g+5]=l[5],A[g+6]=l[6],A[g+7]=l[7]}function f(m,A,g){u[0]=m,A[g]=l[7],A[g+1]=l[6],A[g+2]=l[5],A[g+3]=l[4],A[g+4]=l[3],A[g+5]=l[2],A[g+6]=l[1],A[g+7]=l[0]}s.writeDoubleLE=c?p:f,s.writeDoubleBE=c?f:p;function d(m,A){return l[0]=m[A],l[1]=m[A+1],l[2]=m[A+2],l[3]=m[A+3],l[4]=m[A+4],l[5]=m[A+5],l[6]=m[A+6],l[7]=m[A+7],u[0]}function h(m,A){return l[7]=m[A],l[6]=m[A+1],l[5]=m[A+2],l[4]=m[A+3],l[3]=m[A+4],l[2]=m[A+5],l[1]=m[A+6],l[0]=m[A+7],u[0]}s.readDoubleLE=c?d:h,s.readDoubleBE=c?h:d})():(function(){function u(c,p,f,d,h,m){var A=d<0?1:0;if(A&&(d=-d),d===0)c(0,h,m+p),c(1/d>0?0:2147483648,h,m+f);else if(isNaN(d))c(0,h,m+p),c(2146959360,h,m+f);else if(d>17976931348623157e292)c(0,h,m+p),c((A<<31|2146435072)>>>0,h,m+f);else{var g;if(d<22250738585072014e-324)g=d/5e-324,c(g>>>0,h,m+p),c((A<<31|g/4294967296)>>>0,h,m+f);else{var y=Math.floor(Math.log(d)/Math.LN2);y===1024&&(y=1023),g=d*Math.pow(2,-y),c(g*4503599627370496>>>0,h,m+p),c((A<<31|y+1023<<20|g*1048576&1048575)>>>0,h,m+f)}}}s.writeDoubleLE=u.bind(null,t,0,4),s.writeDoubleBE=u.bind(null,e,4,0);function l(c,p,f,d,h){var m=c(d,h+p),A=c(d,h+f),g=(A>>31)*2+1,y=A>>>20&2047,v=4294967296*(A&1048575)+m;return y===2047?v?NaN:g*(1/0):y===0?g*5e-324*v:g*Math.pow(2,y-1075)*(v+4503599627370496)}s.readDoubleLE=l.bind(null,r,0,4),s.readDoubleBE=l.bind(null,o,4,0)})(),s}function t(s,u,l){u[l]=s&255,u[l+1]=s>>>8&255,u[l+2]=s>>>16&255,u[l+3]=s>>>24}function e(s,u,l){u[l]=s>>>24,u[l+1]=s>>>16&255,u[l+2]=s>>>8&255,u[l+3]=s&255}function r(s,u){return(s[u]|s[u+1]<<8|s[u+2]<<16|s[u+3]<<24)>>>0}function o(s,u){return(s[u]<<24|s[u+1]<<16|s[u+2]<<8|s[u+3])>>>0}return float}var inquire_1,hasRequiredInquire;function requireInquire(){if(hasRequiredInquire)return inquire_1;hasRequiredInquire=1,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}return inquire_1}var utf8={},hasRequiredUtf8;function requireUtf8(){return hasRequiredUtf8||(hasRequiredUtf8=1,(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)),utf8}var pool_1,hasRequiredPool;function requirePool(){if(hasRequiredPool)return pool_1;hasRequiredPool=1,pool_1=n;function n(t,e,r){var o=r||8192,s=o>>>1,u=null,l=o;return function(p){if(p<1||p>s)return t(p);l+p>o&&(u=t(o),l=0);var f=e.call(u,l,l+=p);return l&7&&(l=(l|7)+1),f}}return pool_1}var longbits,hasRequiredLongbits;function requireLongbits(){if(hasRequiredLongbits)return longbits;hasRequiredLongbits=1,longbits=t;var n=requireMinimal$1();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$1;function requireMinimal$1(){return hasRequiredMinimal$1||(hasRequiredMinimal$1=1,(function(n){var t=n;t.asPromise=requireAspromise(),t.base64=requireBase64(),t.EventEmitter=requireEventemitter(),t.float=requireFloat(),t.inquire=requireInquire(),t.utf8=requireUtf8(),t.pool=requirePool(),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||minimal$1,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,hasRequiredWriter;function requireWriter(){if(hasRequiredWriter)return writer;hasRequiredWriter=1,writer=c;var n=requireMinimal$1(),t,e=n.LongBits,r=n.base64,o=n.utf8;function s(y,v,E){this.fn=y,this.len=v,this.next=void 0,this.val=E}function u(){}function l(y){this.head=y.head,this.tail=y.tail,this.len=y.len,this.next=y.states}function c(){this.len=0,this.head=new s(u,0,0),this.tail=this.head,this.states=null}var p=function(){return n.Buffer?function(){return(c.create=function(){return new t})()}:function(){return new c}};c.create=p(),c.alloc=function(v){return new n.Array(v)},n.Array!==Array&&(c.alloc=n.pool(c.alloc,n.Array.prototype.subarray)),c.prototype._push=function(v,E,b){return this.tail=this.tail.next=new s(v,E,b),this.len+=E,this};function f(y,v,E){v[E]=y&255}function d(y,v,E){for(;y>127;)v[E++]=y&127|128,y>>>=7;v[E]=y}function h(y,v){this.len=y,this.next=void 0,this.val=v}h.prototype=Object.create(s.prototype),h.prototype.fn=d,c.prototype.uint32=function(v){return this.len+=(this.tail=this.tail.next=new h((v=v>>>0)<128?1:v<16384?2:v<2097152?3:v<268435456?4:5,v)).len,this},c.prototype.int32=function(v){return v<0?this._push(m,10,e.fromNumber(v)):this.uint32(v)},c.prototype.sint32=function(v){return this.uint32((v<<1^v>>31)>>>0)};function m(y,v,E){for(;y.hi;)v[E++]=y.lo&127|128,y.lo=(y.lo>>>7|y.hi<<25)>>>0,y.hi>>>=7;for(;y.lo>127;)v[E++]=y.lo&127|128,y.lo=y.lo>>>7;v[E++]=y.lo}c.prototype.uint64=function(v){var E=e.from(v);return this._push(m,E.length(),E)},c.prototype.int64=c.prototype.uint64,c.prototype.sint64=function(v){var E=e.from(v).zzEncode();return this._push(m,E.length(),E)},c.prototype.bool=function(v){return this._push(f,1,v?1:0)};function A(y,v,E){v[E]=y&255,v[E+1]=y>>>8&255,v[E+2]=y>>>16&255,v[E+3]=y>>>24}c.prototype.fixed32=function(v){return this._push(A,4,v>>>0)},c.prototype.sfixed32=c.prototype.fixed32,c.prototype.fixed64=function(v){var E=e.from(v);return this._push(A,4,E.lo)._push(A,4,E.hi)},c.prototype.sfixed64=c.prototype.fixed64,c.prototype.float=function(v){return this._push(n.float.writeFloatLE,4,v)},c.prototype.double=function(v){return this._push(n.float.writeDoubleLE,8,v)};var g=n.Array.prototype.set?function(v,E,b){E.set(v,b)}:function(v,E,b){for(var T=0;T<v.length;++T)E[b+T]=v[T]};return c.prototype.bytes=function(v){var E=v.length>>>0;if(!E)return this._push(f,1,0);if(n.isString(v)){var b=c.alloc(E=r.length(v));r.decode(v,b,0),v=b}return this.uint32(E)._push(g,E,v)},c.prototype.string=function(v){var E=o.length(v);return E?this.uint32(E)._push(o.write,E,v):this._push(f,1,0)},c.prototype.fork=function(){return this.states=new l(this),this.head=this.tail=new s(u,0,0),this.len=0,this},c.prototype.reset=function(){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 s(u,0,0),this.len=0),this},c.prototype.ldelim=function(){var v=this.head,E=this.tail,b=this.len;return this.reset().uint32(b),b&&(this.tail.next=v.next,this.tail=E,this.len+=b),this},c.prototype.finish=function(){for(var v=this.head.next,E=this.constructor.alloc(this.len),b=0;v;)v.fn(v.val,E,b),b+=v.len,v=v.next;return E},c._configure=function(y){t=y,c.create=p(),t._configure()},writer}var writer_buffer,hasRequiredWriter_buffer;function requireWriter_buffer(){if(hasRequiredWriter_buffer)return writer_buffer;hasRequiredWriter_buffer=1,writer_buffer=e;var n=requireWriter();(e.prototype=Object.create(n.prototype)).constructor=e;var t=requireMinimal$1();function e(){n.call(this)}e._configure=function(){e.alloc=t._Buffer_allocUnsafe,e.writeBytesBuffer=t.Buffer&&t.Buffer.prototype instanceof Uint8Array&&t.Buffer.prototype.set.name==="set"?function(s,u,l){u.set(s,l)}:function(s,u,l){if(s.copy)s.copy(u,l,0,s.length);else for(var c=0;c<s.length;)u[l++]=s[c++]}},e.prototype.bytes=function(s){t.isString(s)&&(s=t._Buffer_from(s,"base64"));var u=s.length>>>0;return this.uint32(u),u&&this._push(e.writeBytesBuffer,u,s),this};function r(o,s,u){o.length<40?t.utf8.write(o,s,u):s.utf8Write?s.utf8Write(o,u):s.write(o,u)}return e.prototype.string=function(s){var u=t.Buffer.byteLength(s);return this.uint32(u),u&&this._push(r,u,s),this},e._configure(),writer_buffer}var reader,hasRequiredReader;function requireReader(){if(hasRequiredReader)return reader;hasRequiredReader=1,reader=s;var n=requireMinimal$1(),t,e=n.LongBits,r=n.utf8;function o(d,h){return RangeError("index out of range: "+d.pos+" + "+(h||1)+" > "+d.len)}function s(d){this.buf=d,this.pos=0,this.len=d.length}var u=typeof Uint8Array!="undefined"?function(h){if(h instanceof Uint8Array||Array.isArray(h))return new s(h);throw Error("illegal buffer")}:function(h){if(Array.isArray(h))return new s(h);throw Error("illegal buffer")},l=function(){return n.Buffer?function(m){return(s.create=function(g){return n.Buffer.isBuffer(g)?new t(g):u(g)})(m)}:u};s.create=l(),s.prototype._slice=n.Array.prototype.subarray||n.Array.prototype.slice,s.prototype.uint32=(function(){var h=4294967295;return function(){if(h=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(h=(h|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(h=(h|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(h=(h|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(h=(h|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return h;if((this.pos+=5)>this.len)throw this.pos=this.len,o(this,10);return h}})(),s.prototype.int32=function(){return this.uint32()|0},s.prototype.sint32=function(){var h=this.uint32();return h>>>1^-(h&1)|0};function c(){var d=new e(0,0),h=0;if(this.len-this.pos>4){for(;h<4;++h)if(d.lo=(d.lo|(this.buf[this.pos]&127)<<h*7)>>>0,this.buf[this.pos++]<128)return d;if(d.lo=(d.lo|(this.buf[this.pos]&127)<<28)>>>0,d.hi=(d.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return d;h=0}else{for(;h<3;++h){if(this.pos>=this.len)throw o(this);if(d.lo=(d.lo|(this.buf[this.pos]&127)<<h*7)>>>0,this.buf[this.pos++]<128)return d}return d.lo=(d.lo|(this.buf[this.pos++]&127)<<h*7)>>>0,d}if(this.len-this.pos>4){for(;h<5;++h)if(d.hi=(d.hi|(this.buf[this.pos]&127)<<h*7+3)>>>0,this.buf[this.pos++]<128)return d}else for(;h<5;++h){if(this.pos>=this.len)throw o(this);if(d.hi=(d.hi|(this.buf[this.pos]&127)<<h*7+3)>>>0,this.buf[this.pos++]<128)return d}throw Error("invalid varint encoding")}s.prototype.bool=function(){return this.uint32()!==0};function p(d,h){return(d[h-4]|d[h-3]<<8|d[h-2]<<16|d[h-1]<<24)>>>0}s.prototype.fixed32=function(){if(this.pos+4>this.len)throw o(this,4);return p(this.buf,this.pos+=4)},s.prototype.sfixed32=function(){if(this.pos+4>this.len)throw o(this,4);return p(this.buf,this.pos+=4)|0};function f(){if(this.pos+8>this.len)throw o(this,8);return new e(p(this.buf,this.pos+=4),p(this.buf,this.pos+=4))}return s.prototype.float=function(){if(this.pos+4>this.len)throw o(this,4);var h=n.float.readFloatLE(this.buf,this.pos);return this.pos+=4,h},s.prototype.double=function(){if(this.pos+8>this.len)throw o(this,4);var h=n.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,h},s.prototype.bytes=function(){var h=this.uint32(),m=this.pos,A=this.pos+h;if(A>this.len)throw o(this,h);if(this.pos+=h,Array.isArray(this.buf))return this.buf.slice(m,A);if(m===A){var g=n.Buffer;return g?g.alloc(0):new this.buf.constructor(0)}return this._slice.call(this.buf,m,A)},s.prototype.string=function(){var h=this.bytes();return r.read(h,0,h.length)},s.prototype.skip=function(h){if(typeof h=="number"){if(this.pos+h>this.len)throw o(this,h);this.pos+=h}else do if(this.pos>=this.len)throw o(this);while(this.buf[this.pos++]&128);return this},s.prototype.skipType=function(d){switch(d){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(d=this.uint32()&7)!==4;)this.skipType(d);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+d+" at offset "+this.pos)}return this},s._configure=function(d){t=d,s.create=l(),t._configure();var h=n.Long?"toLong":"toNumber";n.merge(s.prototype,{int64:function(){return c.call(this)[h](!1)},uint64:function(){return c.call(this)[h](!0)},sint64:function(){return c.call(this).zzDecode()[h](!1)},fixed64:function(){return f.call(this)[h](!0)},sfixed64:function(){return f.call(this)[h](!1)}})},reader}var reader_buffer,hasRequiredReader_buffer;function requireReader_buffer(){if(hasRequiredReader_buffer)return reader_buffer;hasRequiredReader_buffer=1,reader_buffer=e;var n=requireReader();(e.prototype=Object.create(n.prototype)).constructor=e;var t=requireMinimal$1();function e(r){n.call(this,r)}return e._configure=function(){t.Buffer&&(e.prototype._slice=t.Buffer.prototype.slice)},e.prototype.string=function(){var o=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+o,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+o,this.len))},e._configure(),reader_buffer}var rpc={},service,hasRequiredService;function requireService(){if(hasRequiredService)return service;hasRequiredService=1,service=t;var n=requireMinimal$1();(t.prototype=Object.create(n.EventEmitter.prototype)).constructor=t;function t(e,r,o){if(typeof e!="function")throw TypeError("rpcImpl must be a function");n.EventEmitter.call(this),this.rpcImpl=e,this.requestDelimited=!!r,this.responseDelimited=!!o}return t.prototype.rpcCall=function e(r,o,s,u,l){if(!u)throw TypeError("request must be specified");var c=this;if(!l)return n.asPromise(e,c,r,o,s,u);if(!c.rpcImpl){setTimeout(function(){l(Error("already ended"))},0);return}try{return c.rpcImpl(r,o[c.requestDelimited?"encodeDelimited":"encode"](u).finish(),function(f,d){if(f)return c.emit("error",f,r),l(f);if(d===null){c.end(!0);return}if(!(d instanceof s))try{d=s[c.responseDelimited?"decodeDelimited":"decode"](d)}catch(h){return c.emit("error",h,r),l(h)}return c.emit("data",d,r),l(null,d)})}catch(p){c.emit("error",p,r),setTimeout(function(){l(p)},0);return}},t.prototype.end=function(r){return this.rpcImpl&&(r||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this},service}var hasRequiredRpc;function requireRpc(){return hasRequiredRpc||(hasRequiredRpc=1,(function(n){var t=n;t.Service=requireService()})(rpc)),rpc}var roots,hasRequiredRoots;function requireRoots(){return hasRequiredRoots||(hasRequiredRoots=1,roots={}),roots}var hasRequiredIndexMinimal;function requireIndexMinimal(){return hasRequiredIndexMinimal||(hasRequiredIndexMinimal=1,(function(n){var t=n;t.build="minimal",t.Writer=requireWriter(),t.BufferWriter=requireWriter_buffer(),t.Reader=requireReader(),t.BufferReader=requireReader_buffer(),t.util=requireMinimal$1(),t.rpc=requireRpc(),t.roots=requireRoots(),t.configure=e;function e(){t.util._configure(),t.Writer._configure(t.BufferWriter),t.Reader._configure(t.BufferReader)}e()})(indexMinimal)),indexMinimal}var minimal,hasRequiredMinimal;function requireMinimal(){return hasRequiredMinimal||(hasRequiredMinimal=1,minimal=requireIndexMinimal()),minimal}var minimalExports=requireMinimal();const $Reader$1=minimalExports.Reader,$util$1=minimalExports.util,$root$1=minimalExports.roots["@REALSEE/FIVE:five/model/loaders/protobuf/pbm.proto"]||(minimalExports.roots["@REALSEE/FIVE:five/model/loaders/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,o){e instanceof $Reader$1||(e=$Reader$1.create(e));let s=r===void 0?e.len:e.pos+r,u=new $root$1.Model;for(;e.pos<s;){let l=e.uint32();if(l===o)break;switch(l>>>3){case 1:{u.chunks&&u.chunks.length||(u.chunks=[]),u.chunks.push($root$1.Chunk.decode(e,e.uint32()));break}case 2:{u.createAt=e.uint64();break}case 3:{u.description=e.string();break}default:e.skipType(l&7);break}}return u},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,o){e instanceof $Reader$1||(e=$Reader$1.create(e));let s=r===void 0?e.len:e.pos+r,u=new $root$1.Chunk;for(;e.pos<s;){let l=e.uint32();if(l===o)break;switch(l>>>3){case 1:{u.vertices=$root$1.Vertices.decode(e,e.uint32());break}case 2:{u.faces=$root$1.Faces.decode(e,e.uint32());break}case 3:{u.name=e.string();break}case 4:{u.texture=e.string();break}default:e.skipType(l&7);break}}if(!u.hasOwnProperty("vertices"))throw $util$1.ProtocolError("missing required 'vertices'",{instance:u});if(!u.hasOwnProperty("faces"))throw $util$1.ProtocolError("missing required 'faces'",{instance:u});if(!u.hasOwnProperty("name"))throw $util$1.ProtocolError("missing required 'name'",{instance:u});return u},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,o){e instanceof $Reader$1||(e=$Reader$1.create(e));let s=r===void 0?e.len:e.pos+r,u=new $root$1.Vertices;for(;e.pos<s;){let l=e.uint32();if(l===o)break;switch(l>>>3){case 1:{if(u.xyz&&u.xyz.length||(u.xyz=[]),(l&7)===2){let c=e.uint32()+e.pos;for(;e.pos<c;)u.xyz.push(e.float())}else u.xyz.push(e.float());break}case 2:{if(u.uvs&&u.uvs.length||(u.uvs=[]),(l&7)===2){let c=e.uint32()+e.pos;for(;e.pos<c;)u.uvs.push(e.float())}else u.uvs.push(e.float());break}case 3:{if(u.marks&&u.marks.length||(u.marks=[]),(l&7)===2){let c=e.uint32()+e.pos;for(;e.pos<c;)u.marks.push(e.int32())}else u.marks.push(e.int32());break}default:e.skipType(l&7);break}}return u},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,o){e instanceof $Reader$1||(e=$Reader$1.create(e));let s=r===void 0?e.len:e.pos+r,u=new $root$1.Faces;for(;e.pos<s;){let l=e.uint32();if(l===o)break;switch(l>>>3){case 1:{if(u.indices&&u.indices.length||(u.indices=[]),(l&7)===2){let c=e.uint32()+e.pos;for(;e.pos<c;)u.indices.push(e.uint32())}else u.indices.push(e.uint32());break}case 2:{if(u.normals&&u.normals.length||(u.normals=[]),(l&7)===2){let c=e.uint32()+e.pos;for(;e.pos<c;)u.normals.push(e.float())}else u.normals.push(e.float());break}default:e.skipType(l&7);break}}return u},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,m=c.depth,A=m===void 0?1:m;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 guessTextureBaseUriFromFileUrl(n){var t=n.lastIndexOf("/");if(t>=0){var e=n.slice(0,t+1),r=e.replace(/\/(model)(\/|$)/,function(o,s,u){return"/materials"+u});return r}return""}function loadPbm(n,t){var e,r,o,s,u,l;t===void 0&&(t={});for(var c=(e=t.upAxis)!==null&&e!==void 0?e:"Z",p=(r=t.light)!==null&&r!==void 0?r:!1,f=(o=t.fetcher)!==null&&o!==void 0?o:internalFetcher,d=(s=t.textureBaseUri)!==null&&s!==void 0?s:guessTextureBaseUriFromFileUrl(n),h=t.textureBaseUri===void 0?[]:((u=t.textureArray)!==null&&u!==void 0?u:[]).slice(),m=autoRestImageOptionsByTextureLength((l=t.textureOptions)!==null&&l!==void 0?l:{},h.length),A=new Map,g=0,y=h;g<y.length;g++){var v=y[g];A.set(v,loadTexture$1(v,d,m,f))}var E={byteLength:0};return Promise.resolve().then(function(){return f.ajax(n,{responseType:"arraybuffer"})}).then(function(b){return E.byteLength=b.body.byteLength,delay$1(function(){var T=new Uint8Array(b.body);return Model$2.decode(T)})}).then(function(b){return delay$1(function(){return parse$4(b,p,d,h,m,A,f)})}).then(function(b){A.clear();var T=new THREE__namespace.Group;T.name=n;for(var _=0,S=b.objects;_<S.length;_++){var R=S[_];T.add(R)}return c==="Y"&&T.applyMatrix4(ROTATE_X_MATRIX_INVERSE),{type:"pbm",modelUpAxis:"Z",upAxis:c,uri:n,byteLength:E.byteLength,memoryUsage:getMemoryUsage(T),scene:T,textures:b.textures,animations:[],dispose:function(){return b.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,m=n.chunks;h<m.length;h++){var d=m[h];if(!d.faces.normals||d.faces.normals.length===0){l=!1;break}}for(var A=n.chunks.sort(function(ce,ie){return chunkOrder(ce)-chunkOrder(ie)}),g=[],y=0,v=A;y<v.length;y++){var d=v[y],E=parseFloorName(d.name);g[E]||(g[E]=[]),g[E].push(d)}for(var b=0;b<g.length;b++){var T=g[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),w=new Float32Array(_*2),M=new Float32Array(_*3),B=c?new Float32Array(_):void 0,C=[],P=[1/0,1/0,1/0,-1/0,-1/0,-1/0],L=0,O=0;O<T.length;O++){for(var F=[1/0,1/0,1/0,-1/0,-1/0,-1/0],d=T[O],N=d.vertices.xyz,D=d.vertices.uvs,U=d.faces.indices,z=d.faces.normals,G=d.vertices.marks,j=U.length,S=0;S<j;S++){var Q=U[S],V=R[L*3+S*3]=N[Q*3],J=R[L*3+S*3+1]=N[Q*3+1],W=R[L*3+S*3+2]=N[Q*3+2];B&&(B[L+S]=G[Q]),w[L*2+S*2]=D[Q*2],w[L*2+S*2+1]=D[Q*2+1];var X=Math.floor(S/3)*3;M[L*3+S*3]=z[X],M[L*3+S*3+1]=z[X+1],M[L*3+S*3+2]=z[X+2],V<F[0]&&(F[0]=V),J<F[1]&&(F[1]=J),W<F[2]&&(F[2]=W),V>F[3]&&(F[3]=V),J>F[4]&&(F[4]=J),W>F[5]&&(F[5]=W)}F[0]<P[0]&&(P[0]=F[0]),F[1]<P[1]&&(P[1]=F[1]),F[2]<P[2]&&(P[2]=F[2]),F[3]>P[3]&&(P[3]=F[3]),F[4]>P[4]&&(P[4]=F[4]),F[5]>P[5]&&(P[5]=F[5]),C.push({materialIndex:O,name:d.name,chunkName:parseChunkName(d.name),start:L,count:d.faces.indices.length,texture:(e=d.texture)!==null&&e!==void 0?e:void 0}),L+=j}var Z={createAt:o,description:s,vertices:R,uvs:w,normals:M,masks:B,indices:null,floorIndex:b,groups:C,extents:P};u.push(Z)}else{for(var _=0,Y=0,S=0;S<T.length;S++){var d=T[S];Y+=d.vertices.xyz.length/3,_+=d.faces.indices.length}for(var R=new Float32Array(Y*3),w=new Float32Array(Y*2),M=void 0,K=new Float32Array(Y),ee=new Uint32Array(_),B=c?new Float32Array(_):void 0,C=[],P=[1/0,1/0,1/0,-1/0,-1/0,-1/0],te=0,L=0,O=0;O<T.length;O++){for(var F=[1/0,1/0,1/0,-1/0,-1/0,-1/0],d=T[O],N=d.vertices.xyz,re=d.vertices.marks,D=d.vertices.uvs,U=d.faces.indices,ae=N.length/3,j=U.length,S=0;S<ae;S++){var V=R[L*3+S*3]=N[S*3],J=R[L*3+S*3+1]=N[S*3+1],W=R[L*3+S*3+2]=N[S*3+2];B&&(B[L+S]=re[S]),w[L*2+S*2]=D[S*2],w[L*2+S*2+1]=D[S*2+1],K[L+S]=b,V<F[0]&&(F[0]=V),J<F[1]&&(F[1]=J),W<F[2]&&(F[2]=W),V>F[3]&&(F[3]=V),J>F[4]&&(F[4]=J),W>F[5]&&(F[5]=W)}F[0]<P[0]&&(P[0]=F[0]),F[1]<P[1]&&(P[1]=F[1]),F[2]<P[2]&&(P[2]=F[2]),F[3]>P[3]&&(P[3]=F[3]),F[4]>P[4]&&(P[4]=F[4]),F[5]>P[5]&&(P[5]=F[5]);for(var S=0;S<j;S++)ee[te+S]=L+U[S];C.push({materialIndex:O,name:d.name,chunkName:parseChunkName(d.name),start:te,count:d.faces.indices.length,texture:(r=d.texture)!==null&&r!==void 0?r:void 0}),L+=ae,te+=j}var Z={createAt:o,description:s,vertices:R,uvs:w,normals:M,masks:B,indices:ee,floorIndex:b,groups:C,extents:P};u.push(Z)}}return u}function loadTexture$1(n,t,e,r){var o=__assign({key:"texture.pbm"},pick(e,["format","quality","size","sharpen","forceUseExifOrientation","mappings"])),s=new TextureLoader,u=isAbsoluteURL(n)?n:pathJoin(t,n);return s.loadTexture(u,{imageURL:{transform:e.transform,options:o},encoding:THREE__namespace.sRGBEncoding,wrapS:THREE__namespace.ClampToEdgeWrapping,wrapT:THREE__namespace.ClampToEdgeWrapping,minFilter:THREE__namespace.LinearFilter,maxSize:typeof o.size=="number"?new THREE__namespace.Vector2(o.size,o.size):void 0,fetcher:r}).then(function(l){var c=l.body;return c.needsUpdate=!0,c})}function parse$4(n,t,e,r,o,s,u){for(var l=parsePBMModel(n),c=0,p="",f=[],d={},h=new Set,m=0,A=0,g=l;A<g.length;A++){var y=g[A],v=y.createAt,E=y.description,b=y.vertices,T=y.masks,_=y.uvs,S=y.normals,R=y.indices,w=y.floorIndex,M=y.groups,B=y.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 P=new THREE__namespace.BufferGeometry;P.setAttribute("position",new THREE__namespace.BufferAttribute(b,3)),P.setAttribute("uv",new THREE__namespace.BufferAttribute(_,2)),S&&P.setAttribute("normal",new THREE__namespace.BufferAttribute(S,3)),T&&P.setAttribute("_feature_id_rsmask",new THREE__namespace.BufferAttribute(T,1)),R&&P.setIndex(new THREE__namespace.BufferAttribute(R,1)),P.boundingBox=C,P.boundingSphere=C.getBoundingSphere(new THREE__namespace.Sphere);for(var L=0,O=M;L<O.length;L++){var F=O[L];P.addGroup(F.start,F.count,F.materialIndex)}h.add(P);for(var N=[],D=0,U=M;D<U.length;D++){var F=U[D],z=void 0;if(F.texture){if(z=F.texture,r.length>0&&r.indexOf(F.texture)===-1){for(var G=0,j=r;G<j.length;G++){var Q=j[G],V=isAbsoluteURL(Q)?Q:pathJoin(e,Q),J=V.slice(F.texture.length*-1)===F.texture;if(J){z=Q;break}}console.warn("At3d/Pbm texture not matched. Use ends-guessing mode. ".concat(F.texture," -> ").concat(z))}isAbsoluteURL(z)||(z=pathJoin(e,z))}var W=new PBMMeshMaterial(t?"phong":"basic");W.floorIndex=w,P.attributes.normal===void 0&&(W.flatShading=!0),P.attributes._feature_id_rsmask&&(W.defines.USE_VERTEX_MARK=!0),N.push(W),z?(m++,d[z]?d[z].push(W):d[z]=[W]):W.color=new THREE__namespace.Color(16777215),h.add(W)}var X=new PBMMesh(P,N);X.name="model_floor_"+w,X.userData.createAt=v,X.userData.description=E,X.matrix.compose(X.position,X.quaternion,X.scale),X.matrixAutoUpdate=!1,X.frustumCulled=!1,c=v,p=E,f.push(X)}o=autoRestImageOptionsByTextureLength(o,m);for(var Z=[],Y=function(re){var ae=void 0;s&&(ae=s.get(re)),ae||(ae=loadTexture$1(re,e,o,u),s&&s.set(re,ae)),Z.push(ae.then(function(ce){for(var ie=0,fe=d[re];ie<fe.length;ie++){var ge=fe[ie];ge.map&&(h.delete(ge.map),ge.map.dispose()),ge.map=ce,h.add(ce)}return ce}).catch(function(){for(var ce=0,ie=d[re];ce<ie.length;ce++){var fe=ie[ce];fe.map&&(h.delete(fe.map),fe.map.dispose()),fe.map=null,fe.color=new THREE__namespace.Color(16777215)}return null}))},K=0,ee=Object.keys(d);K<ee.length;K++){var te=ee[K];Y(te)}return Promise.all(Z).then(function(re){var ae=re.filter(function(ce){return ce instanceof THREE__namespace.Texture});return{createAt:c,description:p,objects:f,textures:ae,dispose:function(){h.forEach(function(ce){ce.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)===0&&(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)===0&&(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)===0&&(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,m,A,g,y;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)m=0,this._rangeDecoder.decodeBit(this._isRepG0Decoders,o)===0?this._rangeDecoder.decodeBit(this._isRep0LongDecoders,(o<<4)+d)===0&&(o=o<7?9:11,m=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),m===0&&(m=2+this._repLenDecoder.decode(this._rangeDecoder,d),o=o<7?8:11);else if(c=l,l=u,u=s,m=2+this._lenDecoder.decode(this._rangeDecoder,d),o=o<7?7:10,g=this._posSlotDecoder[m<=5?m-2:3].decode(this._rangeDecoder),g>=4){if(y=(g>>1)-1,s=(2|g&1)<<y,g<14)s+=n.reverseDecode2(this._posDecoders,s-g-1,this._rangeDecoder,y);else if(s+=this._rangeDecoder.decodeDirectBits(y-4)<<4,s+=this._posAlignDecoder.reverseDecode(this._rangeDecoder),s<0){if(s===-1)break;return!1}}else s=g;if(s>=p||s>=this._dictionarySizeCheck)return!1;this._outWindow.copyBlock(s,m),p+=m,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,m;e[e.length-1]==="="&&(u--,e[e.length-2]==="="&&u--);var A=new ArrayBuffer(u),g=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)],m=o[e.charCodeAt(c+3)],g[p++]=f<<2|d>>4,g[p++]=(d&15)<<4|h>>2,g[p++]=(h&3)<<6|m&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/////wchAQsgAEGACEEAIAEQFwvBAQECfyAAQQIQBjYCACAAKAIAIgEoAgAgASgCBGpBgAg7AQggACgCACICKAIAIQEgAigCBCABQQJqakGACDsBCCAAKAIMKAIAQQEkBBAYGkEAIQIDQCACQRBIBEAgAiAAKAIEKAIAIgEoAgBBAnZJBH8gAkECdCABaigCCAUACygCAEEBJAQQGBogAiAAKAIIKAIAIgEoAgBBAnZJBH8gAkECdCABaigCCAUACygCAEEBJAQQGBogAkEBaiECDAELCwuHAgEFfyAAIQJBgAYgACgCDCAALQAUanQhAQNAIAMgAUgEQCACKAIgIgQoAgAhBSAEKAIEIANBAXQgBWpqQYAIOwEIIANBAWohAwwBCwsgAiEBQQAhAgNAIAJBBEkEQCACIAEoAiQoAgAiAygCAEECdkkEfyACQQJ0IANqKAIIBQALKAIAQQEkBBAYGiACQQFqIQIMAQsLIAEoAigoAgBBASQEEBgaIAEoAixBASQEEBgaIAAoAjBBASQEEBgaIAAoAjRBASQEEBgaIAAoAjhBASQEEBgaIAAoAjxBASQEEBgaIAAoAkBBASQEEBgaIAAoAkRBASQEEBgaIAAoAkgQGSAAKAJMEBkLyAwBA38DQCABQQNxIAIgAhsEQCAAIgRBAWohACABIgNBAWohASAEIAMtAAA6AAAgAkEBayECDAELCyAAQQNxRQRAA0AgAkEQTwRAIAAgASgCADYCACAAQQRqIAFBBGooAgA2AgAgAEEIaiABQQhqKAIANgIAIABBDGogAUEMaigCADYCACABQRBqIQEgAEEQaiEAIAJBEGshAgwBCwsgAkEIcQRAIAAgASgCADYCACAAQQRqIAFBBGooAgA2AgAgAUEIaiEBIABBCGohAAsgAkEEcQRAIAAgASgCADYCACABQQRqIQEgAEEEaiEACyACQQJxBEAgACABLwEAOwEAIAFBAmohASAAQQJqIQALIAJBAXEEQCAAIAEtAAA6AAALDwsgAkEgTwRAAkACQAJAIABBA3EiA0EBRwRAIANBAkYNASADQQNGDQIMAwsgASgCACEFIAAgASIDLQAAOgAAIABBAWoiASABIANBAWoiAS0AADoAAEEBaiIEQQFqIQAgAUEBaiIDQQFqIQEgBCADLQAAOgAAIAJBA2shAgNAIAJBEU8EQCAAIAFBAWooAgAiA0EIdCAFQRh2cjYCACAAQQRqIAFBBWooAgAiBUEIdCADQRh2cjYCACAAQQhqIAFBCWooAgAiA0EIdCAFQRh2cjYCACAAQQxqIAFBDWooAgAiBUEIdCADQRh2cjYCACABQRBqIQEgAEEQaiEAIAJBEGshAgwBCwsMAgsgASgCACEFIAAgAS0AADoAACAAQQFqIgRBAWohACABQQFqIgNBAWohASAEIAMtAAA6AAAgAkECayECA0AgAkESTwRAIAAgAUECaigCACIDQRB0IAVBEHZyNgIAIABBBGogAUEGaigCACIFQRB0IANBEHZyNgIAIABBCGogAUEKaigCACIDQRB0IAVBEHZyNgIAIABBDGogAUEOaigCACIFQRB0IANBEHZyNgIAIAFBEGohASAAQRBqIQAgAkEQayECDAELCwwBCyABKAIAIQUgACIEQQFqIQAgASIDQQFqIQEgBCADLQAAOgAAIAJBAWshAgNAIAJBE08EQCAAIAFBA2ooAgAiA0EYdCAFQQh2cjYCACAAQQRqIAFBB2ooAgAiBUEYdCADQQh2cjYCACAAQQhqIAFBC2ooAgAiA0EY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";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],m=d[2],A=d[3];h?e(null,new Uint8Array(o.buffer,A+r,m).slice(0,m)):e(new Error("lzma deocder error"))}catch(g){e(g)}}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 isJsonp(n){return matchJsonpFunctionName(n)!==null}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),r===void 0&&(r=noop),o===void 0&&(o=noop);var s=now(),u=n;return Promise.resolve().then(function(){return t.requestProxy?t.requestProxy(n):n}).then(function(l){return locationIsHttps&&/^http\:/.test(l)?(console.warn("The page at '".concat(locationHref,"' 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;matchJsonpFunctionName(n);var p=new NetworkProxyError(u,"XMLHttpRequest",l&&l.message?String(l.message):String(l));return(c=t.networkSubscribe)===null||c===void 0||c.emit("network",n,"XMLHttpRequest","forbidden",p.message),Promise.reject(p)}).then(function(l){return new Promise(function(c,p){var f=matchJsonpFunctionName(l);if(f){var d=window,h=null,m=!1,A=document.createElement("script"),g=function(){var w;if(h=null,m!==!0){m=!0;var M=new NetworkTimeoutError(l,"XMLHttpRequest",t.timeout||NaN);r(M),p(M),(w=t.networkSubscribe)===null||w===void 0||w.emit("network",l,"XMLHttpRequest","timeout",M.message)}},y=function(w){var M,B,C=now(),P=C-s;if(delete d[f],A.parentNode&&A.parentNode.removeChild(A),h!==null&&(window.clearTimeout(h),h=null),m!==!0){if(w.indexOf("data:")!==0){var L=new NetworkResponseError(l,"XMLHttpRequest",500);r(L),p(L),(M=t.networkSubscribe)===null||M===void 0||M.emit("network",l,"XMLHttpRequest","error",L.message);return}var O=w.split(","),F=(O[0].match(/:(.*?);/)||[])[1],N=O[1];if(t.responseType==="arraybuffer"||t.responseType==="blob"){for(var D=atob(O[1]),U=D.length,z=new Uint8Array(U),K=0;K<U;K++)z[K]=D.charCodeAt(K);t.responseType==="arraybuffer"?N=z.buffer:N=new Blob([z],{type:F})}var j={},Q={body:N,meta:{origin:u,source:l,requestTime:s,responseTime:C,costs:P,headers:j}};e(Q),c(Q),(B=t.networkSubscribe)===null||B===void 0||B.emit("network",l,"XMLHttpRequest","ok",JSON.stringify(Q.meta)),m=!0}};d[f]=y,A.src=l,document.body.appendChild(A),typeof t.timeout=="number"&&(h=window.setTimeout(g,t.timeout))}else{var v=!1,E=new XMLHttpRequest,b=function(){E&&(E.removeEventListener("timeout",T,!1),E.removeEventListener("progress",_,!1),E.removeEventListener("load",S,!1),E.removeEventListener("error",R,!1)),E=null,b=noop},T=function(){var w;if(v!==!0){v=!0,b();var M=new NetworkTimeoutError(l,"XMLHttpRequest",t.timeout||NaN);r(M),p(M),(w=t.networkSubscribe)===null||w===void 0||w.emit("network",l,"XMLHttpRequest","timeout",M.message)}},_=function(w){v!==!0&&w.lengthComputable&&(w.total<=0||o(w.loaded/w.total))},S=function(w){var M;if(v!==!0){var B=this.status;if(B===0||B>=200&&B<400){v=!0,b();var C=now(),P=C-s,L=parseHeaders(this.getAllResponseHeaders()),O=w.total,F={body:this.response,meta:{origin:u,source:l,requestTime:s,responseTime:C,costs:P,headers:L,size:O}};e(F),c(F),(M=t.networkSubscribe)===null||M===void 0||M.emit("network",l,"XMLHttpRequest","ok",JSON.stringify(F.meta))}else R.call(this)}},R=function(){var w;if(v!==!0){v=!0,b();var M=new NetworkResponseError(l,"XMLHttpRequest",this.status);r(M),p(M),(w=t.networkSubscribe)===null||w===void 0||w.emit("network",l,"XMLHttpRequest","error",M.message)}};E.addEventListener("timeout",T,!1),E.addEventListener("progress",_,!1),E.addEventListener("load",S,!1),E.addEventListener("error",R,!1),t.responseType&&(E.responseType=t.responseType),typeof t.timeout=="number"&&(E.timeout=t.timeout),E.open("GET",l,!0),E.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 locationIsHttps&&/^http\:/.test(o)?(console.warn("The page at '".concat(locationHref,"' 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","forbidden",u.message),Promise.reject(u)}).then(function(o){return o in preloadCache?preloadCache[o]:preloadCache[o]=new Promise(function(s,u){var l=document.head||document.getElementsByTagName("head")[0],c=document.createElement("link"),p=!1,f=null;c.onload=function(d){var h;if(f!==null&&(clearTimeout(f),f=null),p!==!0){p=!0,s(),c.onerror=noop,c.onload=noop;var m=now(),A=m-e,g={},y={origin:r,source:o,requestTime:e,responseTime:m,costs:A,headers:g};(h=t.networkSubscribe)===null||h===void 0||h.emit("network",o,"Link","preload",JSON.stringify(y))}},c.onerror=function(d){var h;if(f!==null&&(clearTimeout(f),f=null),p!==!0){p=!0,delete preloadCache[o],l&&c.parentNode===l&&l.removeChild(c);var m=new NetworkResponseError(o,"Link",0);u(m),c.onerror=noop,c.onload=noop,(h=t.networkSubscribe)===null||h===void 0||h.emit("network",o,"Link","error",m.message)}},typeof t.timeout=="number"&&(f=window.setTimeout(function(){var d;if(f=null,p!==!0){p=!0,s(),c.onerror=noop,c.onload=noop;var h=now(),m=h-e,A={},g={origin:r,source:o,requestTime:e,responseTime:h,costs:m,headers:A};(d=t.networkSubscribe)===null||d===void 0||d.emit("network",o,"Link","timeout",JSON.stringify(g))}},t.timeout)),c.rel=c.relList&&c.relList.supports("prefetch")?"prefetch":"preload",c.as="fetch",c.crossOrigin="",c.fetchPriority="high",c.href=o,l&&l.appendChild(c)})})}function loadImage(n,t,e,r,o,s){t===void 0&&(t={}),e===void 0&&(e=noop),r===void 0&&(r=noop),o===void 0&&(o=noop);var u=now(),l=n;return Promise.resolve().then(function(){return t.requestProxy?t.requestProxy(n):n}).then(function(c){return locationIsHttps&&/^http\:/.test(c)?(console.warn("The page at '".concat(locationHref,"' 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","forbidden",f.message),Promise.reject(f)}).then(function(c){return isJsonp(c)?ajax(c,{responseType:"blob",networkSubscribe:t.networkSubscribe}).then(function(p){return URL.createObjectURL(p.body)}):c}).then(function(c){return new Promise(function(p,f){var d=s!=null?s:new Image,h=!1,m=null,A=function(){var y;if(d.onload=noop,d.onerror=noop,m!==null&&(clearTimeout(m),m=null),h!==!0){var v=now(),E={headers:{},origin:l,source:c,requestTime:u,responseTime:v,costs:v-u};h=!0;var b={body:d,meta:E};o(1),e(b),p(b),(y=t.networkSubscribe)===null||y===void 0||y.emit("network",c,"Image","ok",JSON.stringify(b.meta))}},g=function(){var y;if(d.onload=noop,d.onerror=noop,m!==null&&(clearTimeout(m),m=null),h!==!0){h=!0;var v=new NetworkResponseError(c,"Image",0);r(v),f(v),(y=t.networkSubscribe)===null||y===void 0||y.emit("network",c,"Image","ok",v.message)}};typeof t.timeout=="number"&&(m=window.setTimeout(function(){var y;if(d.onload=noop,d.onerror=noop,m=null,h!==!0){h=!0;var v=new NetworkTimeoutError(c,"Image",t.timeout);r(v),f(v),(y=t.networkSubscribe)===null||y===void 0||y.emit("network",c,"Image","timeout",v.message)}},t.timeout)),d.onload=A,d.onerror=g,o(0),d.src=c})})}var Fetcher=(function(){function n(t){t===void 0&&(t={}),this.options=t}return n.prototype.ajax=function(t,e,r,o,s){var u;e===void 0&&(e={}),r===void 0&&(r=noop),o===void 0&&(o=noop),s===void 0&&(s=noop);var l=this.options,c={responseType:e.responseType,timeout:(u=e.timeout)!==null&&u!==void 0?u:l.timeout,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),o===void 0&&(o=noop),s===void 0&&(s=noop);var c=this.options,p={timeout:(l=e.timeout)!==null&&l!==void 0?l:c.timeout,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 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={},r=new Set(t),o=0,s=Object.keys(n);o<s.length;o++){var u=s[o];r.has(u)||(e[u]=n[u])}return e}function omitUndefinedFields(n){var t={};for(var e in n){var r=n[e];r!==void 0&&(t[e]=r)}return t}var hrefAElement=typeof document!="undefined"?document.createElement("a"):{href:""};function isAbsoluteURL(n){return n.indexOf("/")===0||/^[0-9a-z]+\:/i.test(n)}function getFullURL(n){if(typeof URL!="undefined")return new URL(n,location.href).href;hrefAElement.href=n;var t=hrefAElement.href;return hrefAElement.href="",t}function pathJoin(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];var e=[];n=n.map(function(l){return(l!=null?l:"").trim()}).filter(function(l){return l.length>0&&!/^\/+$/.test(l)});for(var r=0;r<n.length;r++){var o=r===0,s=r===n.length-1,u=n[r];o||(u=u.replace(/^\.\//,"").replace(/^\/+/,"")),s||(u=u.replace(/\/+$/,"")),e.push(u)}return e.join("/")}function 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 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 m=h[d];if(!(m===""||m===".")){if(m===".."){f.pop();continue}f.push(m)}}return r+"//"+c+"/"+f.join("/")+"/"+p}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,f=t.forceUseExifOrientation;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 d=s!=null?s:r;d&&["jpg","webp","heic","avif"].indexOf(d)>=0&&o.push("quality/".concat(l))}if(c!==void 0){var h=n.match(/\/cube_(\d+)\//),m=h?Number(h[1]):NaN;m!==Number(c)&&o.push("thumbnail/".concat(c,"x"))}p!==void 0&&o.push("sharpen/".concat(p)),f===!0&&o.push("auto-orient");var A="";return o.length&&(A="?imageMogr2/"+o.join("/")),e+A},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],m=u[3];o.push("crop,x_".concat(f,",y_").concat(d,",w_").concat(h,",h_").concat(m,",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 g="";return o.length&&(g="?x-oss-process=image/"+o.join("/")),e+g},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 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})(),browserSupportsImageBitmapApi=typeof createImageBitmap!="undefined"&&typeof ImageBitmap!="undefined",_useNativeImageBitmap=!1;function useNativeImageBitmap(n){_useNativeImageBitmap=n}function canUseNativeImageBitmap(){return _useNativeImageBitmap===!1?!1:browserSupportsImageBitmapApi}function createImageBitmapLikeImage(n){n===void 0&&(n={});var t=n.onClose,e=Object.assign(document.createElementNS("http://www.w3.org/1999/xhtml","img"),{crossOrigin:"",close:function(){t&&t.call(this),this.onerror=this.onload=this.close=noop,this.removeAttribute("src"),t=void 0}});return e}function createImageBitmapLike(n){if(canUseNativeImageBitmap())return createImageBitmap(n);var t=URL.createObjectURL(n),e=function(){this.src===t&&URL.revokeObjectURL(t)};return new Promise(function(r,o){var s=createImageBitmapLikeImage({onClose:e});s.onload=function(){s.src===t&&URL.revokeObjectURL(t),s.onload=s.onerror=noop,AnimationFrameLoop.shared.add(function(){r(s)},!0)},s.onerror=function(){var u=s.src;s.onload=s.onerror=noop,s.close(),o(new Error("image load error: ".concat(u)))},s.decoding="async",s.src=t})}var canvasPool=[];function createCanvas(n,t){var e=canvasPool.pop();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,canvasPool.push(r)}});return r}function imageBitmapToTexture(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,u.flipY===!1&&(u.repeat.y*=-1,u.offset.y+=1,u.updateMatrix());var l=u.dispose;return u.dispose=function(){this.image&&this.image.close(),l.call(u),u.dispose=l},u}}function imageBitmapsToCubeTexture(n){var t=new THREE__namespace.CubeTexture(n);t.needsUpdate=!0,t.flipY=!1;var e=t.dispose;return t.dispose=function(){if(Array.isArray(this.images))for(var r=0,o=this.images;r<o.length;r++){var s=o[r];s.close()}e.call(t),t.dispose=e},t}var FACE_ORDER$2=["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,m;r===void 0&&(r=noop),o===void 0&&(o=noop),s===void 0&&(s=noop);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 g=(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,g);var y=(m=e.viaAjax)!==null&&m!==void 0?m:canUseNativeImageBitmap;if(y){var v=null,E="blob";return e.fetcher.ajax(t,{timeout:e.timeout,responseType:E},void 0,void 0,s).then(function(_){return createImageBitmapLike(_.body)}).then(function(_){return imageBitmapToTexture(_,e.maxSize)}).then(function(_){return Object.assign(_,A),_}).then(function(_){var S={meta:v,body:_};return r(S),S}).catch(function(_){return o(_),Promise.reject(_)})}else{var b=null,T;return Promise.resolve().then(function(){return createImageBitmapLikeImage()}).then(function(_){return T=_,e.fetcher.loadImage(t,{timeout:e.timeout},void 0,void 0,s,_)}).then(function(_){return b=_.meta,imageBitmapToTexture(_.body,e.maxSize)}).then(function(_){return Object.assign(_,A),_}).then(function(_){var S={meta:b,body:_};return r(S),S}).catch(function(_){return T&&T.close(),o(_),Promise.reject(_)})}},n.prototype.loadCubeTexture=function(t,e,r,o,s,u){var l,c,p,f,d,h,m;r===void 0&&(r=noop),o===void 0&&(o=noop),s===void 0&&(s=noop);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 g=[t[FACE_ORDER$2[0]],t[FACE_ORDER$2[1]],t[FACE_ORDER$2[2]],t[FACE_ORDER$2[3]],t[FACE_ORDER$2[4]],t[FACE_ORDER$2[5]]],y=[],v=[0,0,0,0,0,0],E=[],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(g[_],(h=e.imageURL)===null||h===void 0?void 0:h.transform,__assign(__assign({},S),{key:S.key+"."+FACE_ORDER$2[_]})),w=function(L){v[_]=L,s(v.reduce(function(O,F){return O+F},0)/6)},M=(m=e.viaAjax)!==null&&m!==void 0?m:!1;if(M){var B="blob",C=e.fetcher.ajax(R,{timeout:e.timeout,responseType:B},void 0,void 0,w).then(function(L){return E[_]=L.meta,createImageBitmapLike(L.body)});y.push(C)}else{var P,C=Promise.resolve().then(function(){return createImageBitmapLikeImage()}).then(function(O){return P=O,e.fetcher.loadImage(R,{timeout:e.timeout},void 0,void 0,w,O)}).then(function(O){return E[_]=O.meta,O.body}).catch(function(O){return P&&P.close(),Promise.reject(O)});y.push(C)}},T=0;T<6;T++)b(T);return Promise.all(y).then(function(_){return imageBitmapsToCubeTexture(_)}).then(function(_){return Object.assign(_,__assign({encoding:THREE__namespace.sRGBEncoding},A)),_}).then(function(_){var S={body:_,meta:E};return r(S),S}).catch(function(_){for(var S=0,R=y;S<R.length;S++){var w=R[S];w.then(function(M){return M.close()}).catch(noop)}return o(_),Promise.reject(_)})},n})(),commonjsGlobal=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{},indexMinimal={},minimal$1={},aspromise,hasRequiredAspromise;function requireAspromise(){if(hasRequiredAspromise)return aspromise;hasRequiredAspromise=1,aspromise=n;function n(t,e){for(var r=new Array(arguments.length-1),o=0,s=2,u=!0;s<arguments.length;)r[o++]=arguments[s++];return new Promise(function(c,p){r[o]=function(d){if(u)if(u=!1,d)p(d);else{for(var h=new Array(arguments.length-1),m=0;m<h.length;)h[m++]=arguments[m];c.apply(null,h)}};try{t.apply(e||null,r)}catch(f){u&&(u=!1,p(f))}})}return aspromise}var base64={},hasRequiredBase64;function requireBase64(){return hasRequiredBase64||(hasRequiredBase64=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,m=0,A;c<p;){var g=l[c++];switch(m){case 0:d[h++]=e[g>>2],A=(g&3)<<4,m=1;break;case 1:d[h++]=e[A|g>>4],A=(g&15)<<2,m=2;break;case 2:d[h++]=e[A|g>>6],d[h++]=e[g&63],m=0;break}h>8191&&((f||(f=[])).push(String.fromCharCode.apply(String,d)),h=0)}return m&&(d[h++]=e[A],d[h++]=61,m===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,m=0;m<l.length;){var A=l.charCodeAt(m++);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)),base64}var eventemitter,hasRequiredEventemitter;function requireEventemitter(){if(hasRequiredEventemitter)return eventemitter;hasRequiredEventemitter=1,eventemitter=n;function n(){this._listeners={}}return n.prototype.on=function(e,r,o){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:r,ctx:o||this}),this},n.prototype.off=function(e,r){if(e===void 0)this._listeners={};else if(r===void 0)this._listeners[e]=[];else for(var o=this._listeners[e],s=0;s<o.length;)o[s].fn===r?o.splice(s,1):++s;return this},n.prototype.emit=function(e){var r=this._listeners[e];if(r){for(var o=[],s=1;s<arguments.length;)o.push(arguments[s++]);for(s=0;s<r.length;)r[s].fn.apply(r[s++].ctx,o)}return this},eventemitter}var float,hasRequiredFloat;function requireFloat(){if(hasRequiredFloat)return float;hasRequiredFloat=1,float=n(n);function n(s){return typeof Float32Array!="undefined"?(function(){var u=new Float32Array([-0]),l=new Uint8Array(u.buffer),c=l[3]===128;function p(m,A,g){u[0]=m,A[g]=l[0],A[g+1]=l[1],A[g+2]=l[2],A[g+3]=l[3]}function f(m,A,g){u[0]=m,A[g]=l[3],A[g+1]=l[2],A[g+2]=l[1],A[g+3]=l[0]}s.writeFloatLE=c?p:f,s.writeFloatBE=c?f:p;function d(m,A){return l[0]=m[A],l[1]=m[A+1],l[2]=m[A+2],l[3]=m[A+3],u[0]}function h(m,A){return l[3]=m[A],l[2]=m[A+1],l[1]=m[A+2],l[0]=m[A+3],u[0]}s.readFloatLE=c?d:h,s.readFloatBE=c?h:d})():(function(){function u(c,p,f,d){var h=p<0?1:0;if(h&&(p=-p),p===0)c(1/p>0?0:2147483648,f,d);else if(isNaN(p))c(2143289344,f,d);else if(p>34028234663852886e22)c((h<<31|2139095040)>>>0,f,d);else if(p<11754943508222875e-54)c((h<<31|Math.round(p/1401298464324817e-60))>>>0,f,d);else{var m=Math.floor(Math.log(p)/Math.LN2),A=Math.round(p*Math.pow(2,-m)*8388608)&8388607;c((h<<31|m+127<<23|A)>>>0,f,d)}}s.writeFloatLE=u.bind(null,t),s.writeFloatBE=u.bind(null,e);function l(c,p,f){var d=c(p,f),h=(d>>31)*2+1,m=d>>>23&255,A=d&8388607;return m===255?A?NaN:h*(1/0):m===0?h*1401298464324817e-60*A:h*Math.pow(2,m-150)*(A+8388608)}s.readFloatLE=l.bind(null,r),s.readFloatBE=l.bind(null,o)})(),typeof Float64Array!="undefined"?(function(){var u=new Float64Array([-0]),l=new Uint8Array(u.buffer),c=l[7]===128;function p(m,A,g){u[0]=m,A[g]=l[0],A[g+1]=l[1],A[g+2]=l[2],A[g+3]=l[3],A[g+4]=l[4],A[g+5]=l[5],A[g+6]=l[6],A[g+7]=l[7]}function f(m,A,g){u[0]=m,A[g]=l[7],A[g+1]=l[6],A[g+2]=l[5],A[g+3]=l[4],A[g+4]=l[3],A[g+5]=l[2],A[g+6]=l[1],A[g+7]=l[0]}s.writeDoubleLE=c?p:f,s.writeDoubleBE=c?f:p;function d(m,A){return l[0]=m[A],l[1]=m[A+1],l[2]=m[A+2],l[3]=m[A+3],l[4]=m[A+4],l[5]=m[A+5],l[6]=m[A+6],l[7]=m[A+7],u[0]}function h(m,A){return l[7]=m[A],l[6]=m[A+1],l[5]=m[A+2],l[4]=m[A+3],l[3]=m[A+4],l[2]=m[A+5],l[1]=m[A+6],l[0]=m[A+7],u[0]}s.readDoubleLE=c?d:h,s.readDoubleBE=c?h:d})():(function(){function u(c,p,f,d,h,m){var A=d<0?1:0;if(A&&(d=-d),d===0)c(0,h,m+p),c(1/d>0?0:2147483648,h,m+f);else if(isNaN(d))c(0,h,m+p),c(2146959360,h,m+f);else if(d>17976931348623157e292)c(0,h,m+p),c((A<<31|2146435072)>>>0,h,m+f);else{var g;if(d<22250738585072014e-324)g=d/5e-324,c(g>>>0,h,m+p),c((A<<31|g/4294967296)>>>0,h,m+f);else{var y=Math.floor(Math.log(d)/Math.LN2);y===1024&&(y=1023),g=d*Math.pow(2,-y),c(g*4503599627370496>>>0,h,m+p),c((A<<31|y+1023<<20|g*1048576&1048575)>>>0,h,m+f)}}}s.writeDoubleLE=u.bind(null,t,0,4),s.writeDoubleBE=u.bind(null,e,4,0);function l(c,p,f,d,h){var m=c(d,h+p),A=c(d,h+f),g=(A>>31)*2+1,y=A>>>20&2047,v=4294967296*(A&1048575)+m;return y===2047?v?NaN:g*(1/0):y===0?g*5e-324*v:g*Math.pow(2,y-1075)*(v+4503599627370496)}s.readDoubleLE=l.bind(null,r,0,4),s.readDoubleBE=l.bind(null,o,4,0)})(),s}function t(s,u,l){u[l]=s&255,u[l+1]=s>>>8&255,u[l+2]=s>>>16&255,u[l+3]=s>>>24}function e(s,u,l){u[l]=s>>>24,u[l+1]=s>>>16&255,u[l+2]=s>>>8&255,u[l+3]=s&255}function r(s,u){return(s[u]|s[u+1]<<8|s[u+2]<<16|s[u+3]<<24)>>>0}function o(s,u){return(s[u]<<24|s[u+1]<<16|s[u+2]<<8|s[u+3])>>>0}return float}var inquire_1,hasRequiredInquire;function requireInquire(){if(hasRequiredInquire)return inquire_1;hasRequiredInquire=1,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}return inquire_1}var utf8={},hasRequiredUtf8;function requireUtf8(){return hasRequiredUtf8||(hasRequiredUtf8=1,(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)),utf8}var pool_1,hasRequiredPool;function requirePool(){if(hasRequiredPool)return pool_1;hasRequiredPool=1,pool_1=n;function n(t,e,r){var o=r||8192,s=o>>>1,u=null,l=o;return function(p){if(p<1||p>s)return t(p);l+p>o&&(u=t(o),l=0);var f=e.call(u,l,l+=p);return l&7&&(l=(l|7)+1),f}}return pool_1}var longbits,hasRequiredLongbits;function requireLongbits(){if(hasRequiredLongbits)return longbits;hasRequiredLongbits=1,longbits=t;var n=requireMinimal$1();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$1;function requireMinimal$1(){return hasRequiredMinimal$1||(hasRequiredMinimal$1=1,(function(n){var t=n;t.asPromise=requireAspromise(),t.base64=requireBase64(),t.EventEmitter=requireEventemitter(),t.float=requireFloat(),t.inquire=requireInquire(),t.utf8=requireUtf8(),t.pool=requirePool(),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||minimal$1,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,hasRequiredWriter;function requireWriter(){if(hasRequiredWriter)return writer;hasRequiredWriter=1,writer=c;var n=requireMinimal$1(),t,e=n.LongBits,r=n.base64,o=n.utf8;function s(y,v,E){this.fn=y,this.len=v,this.next=void 0,this.val=E}function u(){}function l(y){this.head=y.head,this.tail=y.tail,this.len=y.len,this.next=y.states}function c(){this.len=0,this.head=new s(u,0,0),this.tail=this.head,this.states=null}var p=function(){return n.Buffer?function(){return(c.create=function(){return new t})()}:function(){return new c}};c.create=p(),c.alloc=function(v){return new n.Array(v)},n.Array!==Array&&(c.alloc=n.pool(c.alloc,n.Array.prototype.subarray)),c.prototype._push=function(v,E,b){return this.tail=this.tail.next=new s(v,E,b),this.len+=E,this};function f(y,v,E){v[E]=y&255}function d(y,v,E){for(;y>127;)v[E++]=y&127|128,y>>>=7;v[E]=y}function h(y,v){this.len=y,this.next=void 0,this.val=v}h.prototype=Object.create(s.prototype),h.prototype.fn=d,c.prototype.uint32=function(v){return this.len+=(this.tail=this.tail.next=new h((v=v>>>0)<128?1:v<16384?2:v<2097152?3:v<268435456?4:5,v)).len,this},c.prototype.int32=function(v){return v<0?this._push(m,10,e.fromNumber(v)):this.uint32(v)},c.prototype.sint32=function(v){return this.uint32((v<<1^v>>31)>>>0)};function m(y,v,E){for(;y.hi;)v[E++]=y.lo&127|128,y.lo=(y.lo>>>7|y.hi<<25)>>>0,y.hi>>>=7;for(;y.lo>127;)v[E++]=y.lo&127|128,y.lo=y.lo>>>7;v[E++]=y.lo}c.prototype.uint64=function(v){var E=e.from(v);return this._push(m,E.length(),E)},c.prototype.int64=c.prototype.uint64,c.prototype.sint64=function(v){var E=e.from(v).zzEncode();return this._push(m,E.length(),E)},c.prototype.bool=function(v){return this._push(f,1,v?1:0)};function A(y,v,E){v[E]=y&255,v[E+1]=y>>>8&255,v[E+2]=y>>>16&255,v[E+3]=y>>>24}c.prototype.fixed32=function(v){return this._push(A,4,v>>>0)},c.prototype.sfixed32=c.prototype.fixed32,c.prototype.fixed64=function(v){var E=e.from(v);return this._push(A,4,E.lo)._push(A,4,E.hi)},c.prototype.sfixed64=c.prototype.fixed64,c.prototype.float=function(v){return this._push(n.float.writeFloatLE,4,v)},c.prototype.double=function(v){return this._push(n.float.writeDoubleLE,8,v)};var g=n.Array.prototype.set?function(v,E,b){E.set(v,b)}:function(v,E,b){for(var T=0;T<v.length;++T)E[b+T]=v[T]};return c.prototype.bytes=function(v){var E=v.length>>>0;if(!E)return this._push(f,1,0);if(n.isString(v)){var b=c.alloc(E=r.length(v));r.decode(v,b,0),v=b}return this.uint32(E)._push(g,E,v)},c.prototype.string=function(v){var E=o.length(v);return E?this.uint32(E)._push(o.write,E,v):this._push(f,1,0)},c.prototype.fork=function(){return this.states=new l(this),this.head=this.tail=new s(u,0,0),this.len=0,this},c.prototype.reset=function(){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 s(u,0,0),this.len=0),this},c.prototype.ldelim=function(){var v=this.head,E=this.tail,b=this.len;return this.reset().uint32(b),b&&(this.tail.next=v.next,this.tail=E,this.len+=b),this},c.prototype.finish=function(){for(var v=this.head.next,E=this.constructor.alloc(this.len),b=0;v;)v.fn(v.val,E,b),b+=v.len,v=v.next;return E},c._configure=function(y){t=y,c.create=p(),t._configure()},writer}var writer_buffer,hasRequiredWriter_buffer;function requireWriter_buffer(){if(hasRequiredWriter_buffer)return writer_buffer;hasRequiredWriter_buffer=1,writer_buffer=e;var n=requireWriter();(e.prototype=Object.create(n.prototype)).constructor=e;var t=requireMinimal$1();function e(){n.call(this)}e._configure=function(){e.alloc=t._Buffer_allocUnsafe,e.writeBytesBuffer=t.Buffer&&t.Buffer.prototype instanceof Uint8Array&&t.Buffer.prototype.set.name==="set"?function(s,u,l){u.set(s,l)}:function(s,u,l){if(s.copy)s.copy(u,l,0,s.length);else for(var c=0;c<s.length;)u[l++]=s[c++]}},e.prototype.bytes=function(s){t.isString(s)&&(s=t._Buffer_from(s,"base64"));var u=s.length>>>0;return this.uint32(u),u&&this._push(e.writeBytesBuffer,u,s),this};function r(o,s,u){o.length<40?t.utf8.write(o,s,u):s.utf8Write?s.utf8Write(o,u):s.write(o,u)}return e.prototype.string=function(s){var u=t.Buffer.byteLength(s);return this.uint32(u),u&&this._push(r,u,s),this},e._configure(),writer_buffer}var reader,hasRequiredReader;function requireReader(){if(hasRequiredReader)return reader;hasRequiredReader=1,reader=s;var n=requireMinimal$1(),t,e=n.LongBits,r=n.utf8;function o(d,h){return RangeError("index out of range: "+d.pos+" + "+(h||1)+" > "+d.len)}function s(d){this.buf=d,this.pos=0,this.len=d.length}var u=typeof Uint8Array!="undefined"?function(h){if(h instanceof Uint8Array||Array.isArray(h))return new s(h);throw Error("illegal buffer")}:function(h){if(Array.isArray(h))return new s(h);throw Error("illegal buffer")},l=function(){return n.Buffer?function(m){return(s.create=function(g){return n.Buffer.isBuffer(g)?new t(g):u(g)})(m)}:u};s.create=l(),s.prototype._slice=n.Array.prototype.subarray||n.Array.prototype.slice,s.prototype.uint32=(function(){var h=4294967295;return function(){if(h=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(h=(h|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(h=(h|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(h=(h|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(h=(h|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return h;if((this.pos+=5)>this.len)throw this.pos=this.len,o(this,10);return h}})(),s.prototype.int32=function(){return this.uint32()|0},s.prototype.sint32=function(){var h=this.uint32();return h>>>1^-(h&1)|0};function c(){var d=new e(0,0),h=0;if(this.len-this.pos>4){for(;h<4;++h)if(d.lo=(d.lo|(this.buf[this.pos]&127)<<h*7)>>>0,this.buf[this.pos++]<128)return d;if(d.lo=(d.lo|(this.buf[this.pos]&127)<<28)>>>0,d.hi=(d.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return d;h=0}else{for(;h<3;++h){if(this.pos>=this.len)throw o(this);if(d.lo=(d.lo|(this.buf[this.pos]&127)<<h*7)>>>0,this.buf[this.pos++]<128)return d}return d.lo=(d.lo|(this.buf[this.pos++]&127)<<h*7)>>>0,d}if(this.len-this.pos>4){for(;h<5;++h)if(d.hi=(d.hi|(this.buf[this.pos]&127)<<h*7+3)>>>0,this.buf[this.pos++]<128)return d}else for(;h<5;++h){if(this.pos>=this.len)throw o(this);if(d.hi=(d.hi|(this.buf[this.pos]&127)<<h*7+3)>>>0,this.buf[this.pos++]<128)return d}throw Error("invalid varint encoding")}s.prototype.bool=function(){return this.uint32()!==0};function p(d,h){return(d[h-4]|d[h-3]<<8|d[h-2]<<16|d[h-1]<<24)>>>0}s.prototype.fixed32=function(){if(this.pos+4>this.len)throw o(this,4);return p(this.buf,this.pos+=4)},s.prototype.sfixed32=function(){if(this.pos+4>this.len)throw o(this,4);return p(this.buf,this.pos+=4)|0};function f(){if(this.pos+8>this.len)throw o(this,8);return new e(p(this.buf,this.pos+=4),p(this.buf,this.pos+=4))}return s.prototype.float=function(){if(this.pos+4>this.len)throw o(this,4);var h=n.float.readFloatLE(this.buf,this.pos);return this.pos+=4,h},s.prototype.double=function(){if(this.pos+8>this.len)throw o(this,4);var h=n.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,h},s.prototype.bytes=function(){var h=this.uint32(),m=this.pos,A=this.pos+h;if(A>this.len)throw o(this,h);if(this.pos+=h,Array.isArray(this.buf))return this.buf.slice(m,A);if(m===A){var g=n.Buffer;return g?g.alloc(0):new this.buf.constructor(0)}return this._slice.call(this.buf,m,A)},s.prototype.string=function(){var h=this.bytes();return r.read(h,0,h.length)},s.prototype.skip=function(h){if(typeof h=="number"){if(this.pos+h>this.len)throw o(this,h);this.pos+=h}else do if(this.pos>=this.len)throw o(this);while(this.buf[this.pos++]&128);return this},s.prototype.skipType=function(d){switch(d){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(d=this.uint32()&7)!==4;)this.skipType(d);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+d+" at offset "+this.pos)}return this},s._configure=function(d){t=d,s.create=l(),t._configure();var h=n.Long?"toLong":"toNumber";n.merge(s.prototype,{int64:function(){return c.call(this)[h](!1)},uint64:function(){return c.call(this)[h](!0)},sint64:function(){return c.call(this).zzDecode()[h](!1)},fixed64:function(){return f.call(this)[h](!0)},sfixed64:function(){return f.call(this)[h](!1)}})},reader}var reader_buffer,hasRequiredReader_buffer;function requireReader_buffer(){if(hasRequiredReader_buffer)return reader_buffer;hasRequiredReader_buffer=1,reader_buffer=e;var n=requireReader();(e.prototype=Object.create(n.prototype)).constructor=e;var t=requireMinimal$1();function e(r){n.call(this,r)}return e._configure=function(){t.Buffer&&(e.prototype._slice=t.Buffer.prototype.slice)},e.prototype.string=function(){var o=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+o,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+o,this.len))},e._configure(),reader_buffer}var rpc={},service,hasRequiredService;function requireService(){if(hasRequiredService)return service;hasRequiredService=1,service=t;var n=requireMinimal$1();(t.prototype=Object.create(n.EventEmitter.prototype)).constructor=t;function t(e,r,o){if(typeof e!="function")throw TypeError("rpcImpl must be a function");n.EventEmitter.call(this),this.rpcImpl=e,this.requestDelimited=!!r,this.responseDelimited=!!o}return t.prototype.rpcCall=function e(r,o,s,u,l){if(!u)throw TypeError("request must be specified");var c=this;if(!l)return n.asPromise(e,c,r,o,s,u);if(!c.rpcImpl){setTimeout(function(){l(Error("already ended"))},0);return}try{return c.rpcImpl(r,o[c.requestDelimited?"encodeDelimited":"encode"](u).finish(),function(f,d){if(f)return c.emit("error",f,r),l(f);if(d===null){c.end(!0);return}if(!(d instanceof s))try{d=s[c.responseDelimited?"decodeDelimited":"decode"](d)}catch(h){return c.emit("error",h,r),l(h)}return c.emit("data",d,r),l(null,d)})}catch(p){c.emit("error",p,r),setTimeout(function(){l(p)},0);return}},t.prototype.end=function(r){return this.rpcImpl&&(r||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this},service}var hasRequiredRpc;function requireRpc(){return hasRequiredRpc||(hasRequiredRpc=1,(function(n){var t=n;t.Service=requireService()})(rpc)),rpc}var roots,hasRequiredRoots;function requireRoots(){return hasRequiredRoots||(hasRequiredRoots=1,roots={}),roots}var hasRequiredIndexMinimal;function requireIndexMinimal(){return hasRequiredIndexMinimal||(hasRequiredIndexMinimal=1,(function(n){var t=n;t.build="minimal",t.Writer=requireWriter(),t.BufferWriter=requireWriter_buffer(),t.Reader=requireReader(),t.BufferReader=requireReader_buffer(),t.util=requireMinimal$1(),t.rpc=requireRpc(),t.roots=requireRoots(),t.configure=e;function e(){t.util._configure(),t.Writer._configure(t.BufferWriter),t.Reader._configure(t.BufferReader)}e()})(indexMinimal)),indexMinimal}var minimal,hasRequiredMinimal;function requireMinimal(){return hasRequiredMinimal||(hasRequiredMinimal=1,minimal=requireIndexMinimal()),minimal}var minimalExports=requireMinimal();const $Reader$1=minimalExports.Reader,$util$1=minimalExports.util,$root$1=minimalExports.roots["@REALSEE/FIVE:five/model/loaders/protobuf/pbm.proto"]||(minimalExports.roots["@REALSEE/FIVE:five/model/loaders/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,o){e instanceof $Reader$1||(e=$Reader$1.create(e));let s=r===void 0?e.len:e.pos+r,u=new $root$1.Model;for(;e.pos<s;){let l=e.uint32();if(l===o)break;switch(l>>>3){case 1:{u.chunks&&u.chunks.length||(u.chunks=[]),u.chunks.push($root$1.Chunk.decode(e,e.uint32()));break}case 2:{u.createAt=e.uint64();break}case 3:{u.description=e.string();break}default:e.skipType(l&7);break}}return u},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,o){e instanceof $Reader$1||(e=$Reader$1.create(e));let s=r===void 0?e.len:e.pos+r,u=new $root$1.Chunk;for(;e.pos<s;){let l=e.uint32();if(l===o)break;switch(l>>>3){case 1:{u.vertices=$root$1.Vertices.decode(e,e.uint32());break}case 2:{u.faces=$root$1.Faces.decode(e,e.uint32());break}case 3:{u.name=e.string();break}case 4:{u.texture=e.string();break}default:e.skipType(l&7);break}}if(!u.hasOwnProperty("vertices"))throw $util$1.ProtocolError("missing required 'vertices'",{instance:u});if(!u.hasOwnProperty("faces"))throw $util$1.ProtocolError("missing required 'faces'",{instance:u});if(!u.hasOwnProperty("name"))throw $util$1.ProtocolError("missing required 'name'",{instance:u});return u},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,o){e instanceof $Reader$1||(e=$Reader$1.create(e));let s=r===void 0?e.len:e.pos+r,u=new $root$1.Vertices;for(;e.pos<s;){let l=e.uint32();if(l===o)break;switch(l>>>3){case 1:{if(u.xyz&&u.xyz.length||(u.xyz=[]),(l&7)===2){let c=e.uint32()+e.pos;for(;e.pos<c;)u.xyz.push(e.float())}else u.xyz.push(e.float());break}case 2:{if(u.uvs&&u.uvs.length||(u.uvs=[]),(l&7)===2){let c=e.uint32()+e.pos;for(;e.pos<c;)u.uvs.push(e.float())}else u.uvs.push(e.float());break}case 3:{if(u.marks&&u.marks.length||(u.marks=[]),(l&7)===2){let c=e.uint32()+e.pos;for(;e.pos<c;)u.marks.push(e.int32())}else u.marks.push(e.int32());break}default:e.skipType(l&7);break}}return u},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,o){e instanceof $Reader$1||(e=$Reader$1.create(e));let s=r===void 0?e.len:e.pos+r,u=new $root$1.Faces;for(;e.pos<s;){let l=e.uint32();if(l===o)break;switch(l>>>3){case 1:{if(u.indices&&u.indices.length||(u.indices=[]),(l&7)===2){let c=e.uint32()+e.pos;for(;e.pos<c;)u.indices.push(e.uint32())}else u.indices.push(e.uint32());break}case 2:{if(u.normals&&u.normals.length||(u.normals=[]),(l&7)===2){let c=e.uint32()+e.pos;for(;e.pos<c;)u.normals.push(e.float())}else u.normals.push(e.float());break}default:e.skipType(l&7);break}}return u},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,m=c.depth,A=m===void 0?1:m;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 guessTextureBaseUriFromFileUrl(n){var t=n.lastIndexOf("/");if(t>=0){var e=n.slice(0,t+1),r=e.replace(/\/(model)(\/|$)/,function(o,s,u){return"/materials"+u});return r}return""}function loadPbm(n,t){var e,r,o,s,u,l;t===void 0&&(t={});for(var c=(e=t.upAxis)!==null&&e!==void 0?e:"Z",p=(r=t.light)!==null&&r!==void 0?r:!1,f=(o=t.fetcher)!==null&&o!==void 0?o:internalFetcher,d=(s=t.textureBaseUri)!==null&&s!==void 0?s:guessTextureBaseUriFromFileUrl(n),h=t.textureBaseUri===void 0?[]:((u=t.textureArray)!==null&&u!==void 0?u:[]).slice(),m=autoRestImageOptionsByTextureLength((l=t.textureOptions)!==null&&l!==void 0?l:{},h.length),A=new Map,g=0,y=h;g<y.length;g++){var v=y[g];A.set(v,loadTexture$1(v,d,m,f))}var E={byteLength:0};return Promise.resolve().then(function(){return f.ajax(n,{responseType:"arraybuffer"})}).then(function(b){E.byteLength=b.body.byteLength;var T=new Uint8Array(b.body);return Model$2.decode(T)}).then(function(b){return parse$4(b,p,d,h,m,A,f)}).then(function(b){A.clear();var T=new THREE__namespace.Group;T.name=n;for(var _=0,S=b.objects;_<S.length;_++){var R=S[_];T.add(R)}return c==="Y"&&T.applyMatrix4(ROTATE_X_MATRIX_INVERSE),{type:"pbm",modelUpAxis:"Z",upAxis:c,uri:n,byteLength:E.byteLength,memoryUsage:getMemoryUsage(T),scene:T,textures:b.textures,animations:[],dispose:function(){return b.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,m=n.chunks;h<m.length;h++){var d=m[h];if(!d.faces.normals||d.faces.normals.length===0){l=!1;break}}for(var A=n.chunks.sort(function(ce,ie){return chunkOrder(ce)-chunkOrder(ie)}),g=[],y=0,v=A;y<v.length;y++){var d=v[y],E=parseFloorName(d.name);g[E]||(g[E]=[]),g[E].push(d)}for(var b=0;b<g.length;b++){var T=g[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),w=new Float32Array(_*2),M=new Float32Array(_*3),B=c?new Float32Array(_):void 0,C=[],P=[1/0,1/0,1/0,-1/0,-1/0,-1/0],L=0,O=0;O<T.length;O++){for(var F=[1/0,1/0,1/0,-1/0,-1/0,-1/0],d=T[O],N=d.vertices.xyz,D=d.vertices.uvs,U=d.faces.indices,z=d.faces.normals,K=d.vertices.marks,j=U.length,S=0;S<j;S++){var Q=U[S],V=R[L*3+S*3]=N[Q*3],J=R[L*3+S*3+1]=N[Q*3+1],W=R[L*3+S*3+2]=N[Q*3+2];B&&(B[L+S]=K[Q]),w[L*2+S*2]=D[Q*2],w[L*2+S*2+1]=D[Q*2+1];var X=Math.floor(S/3)*3;M[L*3+S*3]=z[X],M[L*3+S*3+1]=z[X+1],M[L*3+S*3+2]=z[X+2],V<F[0]&&(F[0]=V),J<F[1]&&(F[1]=J),W<F[2]&&(F[2]=W),V>F[3]&&(F[3]=V),J>F[4]&&(F[4]=J),W>F[5]&&(F[5]=W)}F[0]<P[0]&&(P[0]=F[0]),F[1]<P[1]&&(P[1]=F[1]),F[2]<P[2]&&(P[2]=F[2]),F[3]>P[3]&&(P[3]=F[3]),F[4]>P[4]&&(P[4]=F[4]),F[5]>P[5]&&(P[5]=F[5]),C.push({materialIndex:O,name:d.name,chunkName:parseChunkName(d.name),start:L,count:d.faces.indices.length,texture:(e=d.texture)!==null&&e!==void 0?e:void 0}),L+=j}var Z={createAt:o,description:s,vertices:R,uvs:w,normals:M,masks:B,indices:null,floorIndex:b,groups:C,extents:P};u.push(Z)}else{for(var _=0,Y=0,S=0;S<T.length;S++){var d=T[S];Y+=d.vertices.xyz.length/3,_+=d.faces.indices.length}for(var R=new Float32Array(Y*3),w=new Float32Array(Y*2),M=void 0,G=new Float32Array(Y),ee=new Uint32Array(_),B=c?new Float32Array(_):void 0,C=[],P=[1/0,1/0,1/0,-1/0,-1/0,-1/0],te=0,L=0,O=0;O<T.length;O++){for(var F=[1/0,1/0,1/0,-1/0,-1/0,-1/0],d=T[O],N=d.vertices.xyz,ne=d.vertices.marks,D=d.vertices.uvs,U=d.faces.indices,ae=N.length/3,j=U.length,S=0;S<ae;S++){var V=R[L*3+S*3]=N[S*3],J=R[L*3+S*3+1]=N[S*3+1],W=R[L*3+S*3+2]=N[S*3+2];B&&(B[L+S]=ne[S]),w[L*2+S*2]=D[S*2],w[L*2+S*2+1]=D[S*2+1],G[L+S]=b,V<F[0]&&(F[0]=V),J<F[1]&&(F[1]=J),W<F[2]&&(F[2]=W),V>F[3]&&(F[3]=V),J>F[4]&&(F[4]=J),W>F[5]&&(F[5]=W)}F[0]<P[0]&&(P[0]=F[0]),F[1]<P[1]&&(P[1]=F[1]),F[2]<P[2]&&(P[2]=F[2]),F[3]>P[3]&&(P[3]=F[3]),F[4]>P[4]&&(P[4]=F[4]),F[5]>P[5]&&(P[5]=F[5]);for(var S=0;S<j;S++)ee[te+S]=L+U[S];C.push({materialIndex:O,name:d.name,chunkName:parseChunkName(d.name),start:te,count:d.faces.indices.length,texture:(r=d.texture)!==null&&r!==void 0?r:void 0}),L+=ae,te+=j}var Z={createAt:o,description:s,vertices:R,uvs:w,normals:M,masks:B,indices:ee,floorIndex:b,groups:C,extents:P};u.push(Z)}}return u}function loadTexture$1(n,t,e,r){var o=__assign({key:"texture.pbm"},pick(e,["format","quality","size","sharpen","forceUseExifOrientation","mappings"])),s=new TextureLoader,u=isAbsoluteURL(n)?n:pathJoin(t,n);return s.loadTexture(u,{imageURL:{transform:e.transform,options:o},encoding:THREE__namespace.sRGBEncoding,wrapS:THREE__namespace.ClampToEdgeWrapping,wrapT:THREE__namespace.ClampToEdgeWrapping,minFilter:THREE__namespace.LinearFilter,maxSize:typeof o.size=="number"?new THREE__namespace.Vector2(o.size,o.size):void 0,fetcher:r}).then(function(l){var c=l.body;return c.needsUpdate=!0,c})}function parse$4(n,t,e,r,o,s,u){for(var l=parsePBMModel(n),c=0,p="",f=[],d={},h=new Set,m=0,A=0,g=l;A<g.length;A++){var y=g[A],v=y.createAt,E=y.description,b=y.vertices,T=y.masks,_=y.uvs,S=y.normals,R=y.indices,w=y.floorIndex,M=y.groups,B=y.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 P=new THREE__namespace.BufferGeometry;P.setAttribute("position",new THREE__namespace.BufferAttribute(b,3)),P.setAttribute("uv",new THREE__namespace.BufferAttribute(_,2)),S&&P.setAttribute("normal",new THREE__namespace.BufferAttribute(S,3)),T&&P.setAttribute("_feature_id_rsmask",new THREE__namespace.BufferAttribute(T,1)),R&&P.setIndex(new THREE__namespace.BufferAttribute(R,1)),P.boundingBox=C,P.boundingSphere=C.getBoundingSphere(new THREE__namespace.Sphere);for(var L=0,O=M;L<O.length;L++){var F=O[L];P.addGroup(F.start,F.count,F.materialIndex)}h.add(P);for(var N=[],D=0,U=M;D<U.length;D++){var F=U[D],z=void 0;if(F.texture){if(z=F.texture,r.length>0&&r.indexOf(F.texture)===-1){for(var K=0,j=r;K<j.length;K++){var Q=j[K],V=isAbsoluteURL(Q)?Q:pathJoin(e,Q),J=V.slice(F.texture.length*-1)===F.texture;if(J){z=Q;break}}console.warn("At3d/Pbm texture not matched. Use ends-guessing mode. ".concat(F.texture," -> ").concat(z))}isAbsoluteURL(z)||(z=pathJoin(e,z))}var W=new PBMMeshMaterial(t?"phong":"basic");W.floorIndex=w,P.attributes.normal===void 0&&(W.flatShading=!0),P.attributes._feature_id_rsmask&&(W.defines.USE_VERTEX_MARK=!0),N.push(W),z?(m++,d[z]?d[z].push(W):d[z]=[W]):W.color=new THREE__namespace.Color(16777215),h.add(W)}var X=new PBMMesh(P,N);X.name="model_floor_"+w,X.userData.createAt=v,X.userData.description=E,X.matrix.compose(X.position,X.quaternion,X.scale),X.matrixAutoUpdate=!1,X.frustumCulled=!1,c=v,p=E,f.push(X)}o=autoRestImageOptionsByTextureLength(o,m);for(var Z=[],Y=function(ne){var ae=void 0;s&&(ae=s.get(ne)),ae||(ae=loadTexture$1(ne,e,o,u),s&&s.set(ne,ae)),Z.push(ae.then(function(ce){for(var ie=0,fe=d[ne];ie<fe.length;ie++){var ge=fe[ie];ge.map&&(h.delete(ge.map),ge.map.dispose()),ge.map=ce,h.add(ce)}return ce}).catch(function(){for(var ce=0,ie=d[ne];ce<ie.length;ce++){var fe=ie[ce];fe.map&&(h.delete(fe.map),fe.map.dispose()),fe.map=null,fe.color=new THREE__namespace.Color(16777215)}return null}))},G=0,ee=Object.keys(d);G<ee.length;G++){var te=ee[G];Y(te)}return Promise.all(Z).then(function(ne){var ae=ne.filter(function(ce){return ce instanceof THREE__namespace.Texture});return{createAt:c,description:p,objects:f,textures:ae,dispose:function(){h.forEach(function(ce){ce.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)===0&&(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)===0&&(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)===0&&(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,m,A,g,y;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)m=0,this._rangeDecoder.decodeBit(this._isRepG0Decoders,o)===0?this._rangeDecoder.decodeBit(this._isRep0LongDecoders,(o<<4)+d)===0&&(o=o<7?9:11,m=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),m===0&&(m=2+this._repLenDecoder.decode(this._rangeDecoder,d),o=o<7?8:11);else if(c=l,l=u,u=s,m=2+this._lenDecoder.decode(this._rangeDecoder,d),o=o<7?7:10,g=this._posSlotDecoder[m<=5?m-2:3].decode(this._rangeDecoder),g>=4){if(y=(g>>1)-1,s=(2|g&1)<<y,g<14)s+=n.reverseDecode2(this._posDecoders,s-g-1,this._rangeDecoder,y);else if(s+=this._rangeDecoder.decodeDirectBits(y-4)<<4,s+=this._posAlignDecoder.reverseDecode(this._rangeDecoder),s<0){if(s===-1)break;return!1}}else s=g;if(s>=p||s>=this._dictionarySizeCheck)return!1;this._outWindow.copyBlock(s,m),p+=m,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,m;e[e.length-1]==="="&&(u--,e[e.length-2]==="="&&u--);var A=new ArrayBuffer(u),g=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)],m=o[e.charCodeAt(c+3)],g[p++]=f<<2|d>>4,g[p++]=(d&15)<<4|h>>2,g[p++]=(h&3)<<6|m&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/////wchAQsgAEGACEEAIAEQFwvBAQECfyAAQQIQBjYCACAAKAIAIgEoAgAgASgCBGpBgAg7AQggACgCACICKAIAIQEgAigCBCABQQJqakGACDsBCCAAKAIMKAIAQQEkBBAYGkEAIQIDQCACQRBIBEAgAiAAKAIEKAIAIgEoAgBBAnZJBH8gAkECdCABaigCCAUACygCAEEBJAQQGBogAiAAKAIIKAIAIgEoAgBBAnZJBH8gAkECdCABaigCCAUACygCAEEBJAQQGBogAkEBaiECDAELCwuHAgEFfyAAIQJBgAYgACgCDCAALQAUanQhAQNAIAMgAUgEQCACKAIgIgQoAgAhBSAEKAIEIANBAXQgBWpqQYAIOwEIIANBAWohAwwBCwsgAiEBQQAhAgNAIAJBBEkEQCACIAEoAiQoAgAiAygCAEECdkkEfyACQQJ0IANqKAIIBQALKAIAQQEkBBAYGiACQQFqIQIMAQsLIAEoAigoAgBBASQEEBgaIAEoAixBASQEEBgaIAAoAjBBASQEEBgaIAAoAjRBASQEEBgaIAAoAjhBASQEEBgaIAAoAjxBASQEEBgaIAAoAkBBASQEEBgaIAAoAkRBASQEEBgaIAAoAkgQGSAAKAJMEBkLyAwBA38DQCABQQNxIAIgAhsEQCAAIgRBAWohACABIgNBAWohASAEIAMtAAA6AAAgAkEBayECDAELCyAAQQNxRQRAA0AgAkEQTwRAIAAgASgCADYCACAAQQRqIAFBBGooAgA2AgAgAEEIaiABQQhqKAIANgIAIABBDGogAUEMaigCADYCACABQRBqIQEgAEEQaiEAIAJBEGshAgwBCwsgAkEIcQRAIAAgASgCADYCACAAQQRqIAFBBGooAgA2AgAgAUEIaiEBIABBCGohAAsgAkEEcQRAIAAgASgCADYCACABQQRqIQEgAEEEaiEACyACQQJxBEAgACABLwEAOwEAIAFBAmohASAAQQJqIQALIAJBAXEEQCAAIAEtAAA6AAALDwsgAkEgTwRAAkACQAJAIABBA3EiA0EBRwRAIANBAkYNASADQQNGDQIMAwsgASgCACEFIAAgASIDLQAAOgAAIABBAWoiASABIANBAWoiAS0AADoAAEEBaiIEQQFqIQAgAUEBaiIDQQFqIQEgBCADLQAAOgAAIAJBA2shAgNAIAJBEU8EQCAAIAFBAWooAgAiA0EIdCAFQRh2cjYCACAAQQRqIAFBBWooAgAiBUEIdCADQRh2cjYCACAAQQhqIAFBCWooAgAiA0EIdCAFQRh2cjYCACAAQQxqIAFBDWooAgAiBUEIdCADQRh2cjYCACABQRBqIQEgAEEQaiEAIAJBEGshAgwBCwsMAgsgASgCACEFIAAgAS0AADoAACAAQQFqIgRBAWohACABQQFqIgNBAWohASAEIAMtAAA6AAAgAkECayECA0AgAkESTwRAIAAgAUECaigCACIDQRB0IAVBEHZyNgIAIABBBGogAUEGaigCACIFQRB0IANBEHZyNgIAIABBCGogAUEKaigCACIDQRB0IAVBEHZyNgIAIABBDGogAUEOaigCACIFQRB0IANBEHZyNgIAIAFBEGohASAAQRBqIQAgAkEQayECDAELCwwBCyABKAIAIQUgACIEQQFqIQAgASIDQQFqIQEgBCADLQAAOgAAIAJBAWshAgNAIAJBE08EQCAAIAFBA2ooAgAiA0EYdCAFQQh2cjYCACAAQQRqIAFBB2ooAgAiBUEYdCADQQh2cjYCACAAQQhqIAFBC2ooAgAiA0EY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";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],m=d[2],A=d[3];h?e(null,new Uint8Array(o.buffer,A+r,m).slice(0,m)):e(new Error("lzma deocder error"))}catch(g){e(g)}}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,l;t===void 0&&(t={});for(var c=(e=t.upAxis)!==null&&e!==void 0?e:"Z",p=(r=t.light)!==null&&r!==void 0?r:!1,f=(o=t.fetcher)!==null&&o!==void 0?o:internalFetcher,d=(s=t.textureBaseUri)!==null&&s!==void 0?s:guessTextureBaseUriFromFileUrl(n),h=t.textureBaseUri===void 0?[]:((u=t.textureArray)!==null&&u!==void 0?u:[]).slice(),m=autoRestImageOptionsByTextureLength((l=t.textureOptions)!==null&&l!==void 0?l:{},h.length),A=new Map,g=0,y=h;g<y.length;g++){var v=y[g];A.set(v,loadTexture$1(v,d,m,f))}var E={byteLength:0};return Promise.resolve().then(function(){return f.ajax(n,{responseType:"arraybuffer"})}).then(function(b){return lzma(b.body)}).then(function(b){return delay$1(function(){for(var T,_={chunks:[],createAt:void 0,description:void 0},S=0,R=b;S<R.length;S++){var w=R[S],M=Model$2.decode(w);M.chunks.length&&((T=_.chunks).push.apply(T,M.chunks),_.createAt=M.createAt,_.description=M.description)}return _})}).then(function(b){return delay$1(function(){return parse$4(b,p,d,h,m,A,f)})}).then(function(b){A.clear();var T=new THREE__namespace.Group;T.name=n;for(var _=0,S=b.objects;_<S.length;_++){var R=S[_];T.add(R)}return c==="Y"&&T.applyMatrix4(ROTATE_X_MATRIX_INVERSE),{type:"at3d",modelUpAxis:"Z",upAxis:c,uri:n,byteLength:E.byteLength,memoryUsage:getMemoryUsage(T),scene:T,textures:b.textures,animations:[],dispose:function(){return b.dispose()}}})}const $Reader=minimalExports.Reader,$util=minimalExports.util,$root=minimalExports.roots["@REALSEE/FIVE:five/model/loaders/protobuf/dome.proto"]||(minimalExports.roots["@REALSEE/FIVE:five/model/loaders/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,o){e instanceof $Reader||(e=$Reader.create(e));let s=r===void 0?e.len:e.pos+r,u=new $root.Model;for(;e.pos<s;){let l=e.uint32();if(l===o)break;switch(l>>>3){case 1:{u.meshes&&u.meshes.length||(u.meshes=[]),u.meshes.push($root.Mesh.decode(e,e.uint32()));break}default:e.skipType(l&7);break}}return u},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,o){e instanceof $Reader||(e=$Reader.create(e));let s=r===void 0?e.len:e.pos+r,u=new $root.Mesh;for(;e.pos<s;){let l=e.uint32();if(l===o)break;switch(l>>>3){case 1:{u.name=e.string();break}case 2:{u.chunks&&u.chunks.length||(u.chunks=[]),u.chunks.push($root.Chunk.decode(e,e.uint32()));break}case 3:{u.matrix&&u.matrix.length||(u.matrix=[]),u.matrix.push($root.Matrix.decode(e,e.uint32()));break}default:e.skipType(l&7);break}}if(!u.hasOwnProperty("name"))throw $util.ProtocolError("missing required 'name'",{instance:u});return u},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,o){e instanceof $Reader||(e=$Reader.create(e));let s=r===void 0?e.len:e.pos+r,u=new $root.Matrix;for(;e.pos<s;){let l=e.uint32();if(l===o)break;switch(l>>>3){case 1:{if(u.elements&&u.elements.length||(u.elements=[]),(l&7)===2){let c=e.uint32()+e.pos;for(;e.pos<c;)u.elements.push(e.float())}else u.elements.push(e.float());break}default:e.skipType(l&7);break}}return u},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,o){e instanceof $Reader||(e=$Reader.create(e));let s=r===void 0?e.len:e.pos+r,u=new $root.Chunk;for(;e.pos<s;){let l=e.uint32();if(l===o)break;switch(l>>>3){case 2:{u.geometry=$root.Geometry.decode(e,e.uint32());break}case 3:{u.material&&u.material.length||(u.material=[]),u.material.push($root.Material.decode(e,e.uint32()));break}default:e.skipType(l&7);break}}if(!u.hasOwnProperty("geometry"))throw $util.ProtocolError("missing required 'geometry'",{instance:u});return u},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,o){e instanceof $Reader||(e=$Reader.create(e));let s=r===void 0?e.len:e.pos+r,u=new $root.Geometry;for(;e.pos<s;){let l=e.uint32();if(l===o)break;switch(l>>>3){case 1:{u.position=$root.Position.decode(e,e.uint32());break}case 2:{u.uv=$root.UV.decode(e,e.uint32());break}case 3:{u.uv2=$root.UV.decode(e,e.uint32());break}case 4:{u.normal=$root.Normal.decode(e,e.uint32());break}case 5:{u.groups&&u.groups.length||(u.groups=[]),u.groups.push($root.Group.decode(e,e.uint32()));break}default:e.skipType(l&7);break}}if(!u.hasOwnProperty("position"))throw $util.ProtocolError("missing required 'position'",{instance:u});if(!u.hasOwnProperty("normal"))throw $util.ProtocolError("missing required 'normal'",{instance:u});return u},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,o){e instanceof $Reader||(e=$Reader.create(e));let s=r===void 0?e.len:e.pos+r,u=new $root.Position;for(;e.pos<s;){let l=e.uint32();if(l===o)break;switch(l>>>3){case 1:{if(u.array&&u.array.length||(u.array=[]),(l&7)===2){let c=e.uint32()+e.pos;for(;e.pos<c;)u.array.push(e.float())}else u.array.push(e.float());break}default:e.skipType(l&7);break}}return u},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,o){e instanceof $Reader||(e=$Reader.create(e));let s=r===void 0?e.len:e.pos+r,u=new $root.UV;for(;e.pos<s;){let l=e.uint32();if(l===o)break;switch(l>>>3){case 1:{if(u.array&&u.array.length||(u.array=[]),(l&7)===2){let c=e.uint32()+e.pos;for(;e.pos<c;)u.array.push(e.float())}else u.array.push(e.float());break}default:e.skipType(l&7);break}}return u},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,o){e instanceof $Reader||(e=$Reader.create(e));let s=r===void 0?e.len:e.pos+r,u=new $root.Normal;for(;e.pos<s;){let l=e.uint32();if(l===o)break;switch(l>>>3){case 1:{if(u.array&&u.array.length||(u.array=[]),(l&7)===2){let c=e.uint32()+e.pos;for(;e.pos<c;)u.array.push(e.float())}else u.array.push(e.float());break}default:e.skipType(l&7);break}}return u},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,o){e instanceof $Reader||(e=$Reader.create(e));let s=r===void 0?e.len:e.pos+r,u=new $root.Group;for(;e.pos<s;){let l=e.uint32();if(l===o)break;switch(l>>>3){case 1:{u.start=e.uint32();break}case 2:{u.count=e.uint32();break}case 3:{u.materialIndex=e.uint32();break}default:e.skipType(l&7);break}}if(!u.hasOwnProperty("start"))throw $util.ProtocolError("missing required 'start'",{instance:u});if(!u.hasOwnProperty("count"))throw $util.ProtocolError("missing required 'count'",{instance:u});if(!u.hasOwnProperty("materialIndex"))throw $util.ProtocolError("missing required 'materialIndex'",{instance:u});return u},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,o){e instanceof $Reader||(e=$Reader.create(e));let s=r===void 0?e.len:e.pos+r,u=new $root.Material;for(;e.pos<s;){let l=e.uint32();if(l===o)break;switch(l>>>3){case 1:{u.kd=$root.Color.decode(e,e.uint32());break}case 2:{u.ks=$root.Color.decode(e,e.uint32());break}case 3:{u.ke=$root.Color.decode(e,e.uint32());break}case 4:{u.mapkd=e.string();break}case 5:{u.mapks=e.string();break}case 6:{u.mapke=e.string();break}case 7:{u.norm=e.string();break}case 8:{u.mapbump=e.string();break}case 9:{u.bump=e.string();break}case 10:{u.mapd=e.string();break}case 11:{u.ns=e.float();break}case 12:{u.d=e.float();break}case 13:{u.tr=e.float();break}case 14:{u.mapkdrepeat=e.string();break}default:e.skipType(l&7);break}}return u},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,o){e instanceof $Reader||(e=$Reader.create(e));let s=r===void 0?e.len:e.pos+r,u=new $root.Color;for(;e.pos<s;){let l=e.uint32();if(l===o)break;switch(l>>>3){case 1:{if(u.rgb&&u.rgb.length||(u.rgb=[]),(l&7)===2){let c=e.uint32()+e.pos;for(;e.pos<c;)u.rgb.push(e.float())}else u.rgb.push(e.float());break}default:e.skipType(l&7);break}}return u},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:internalFetcher,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","forceUseExifOrientation","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(y){return Number(y)}),m=h[0],A=h[1];d=new THREE__namespace.Vector2(m,A)}p.push(loadTexture(n.mapkd,e,r,d,o,s,u).then(function(y){y.encoding=THREE__namespace.sRGBEncoding,f.map=y,l.add(y),c.add(y),f.needsUpdate=!0}).catch(noop))}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(y){f.specularMap=y,l.add(y),c.add(y)}).catch(noop)),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(y){y.encoding=THREE__namespace.sRGBEncoding,f.emissiveMap=y,l.add(y),c.add(y)}).catch(noop)),n.norm&&p.push(loadTexture(n.norm,e,r,null,o,s,u).then(function(y){f.normalMap=y,l.add(y),c.add(y)}).catch(noop)),n.mapbump&&p.push(loadTexture(n.mapbump,e,r,null,o,s,u).then(function(y){f.bumpMap=y,l.add(y),c.add(y)}).catch(noop)),n.bump&&p.push(loadTexture(n.bump,e,r,null,o,s,u).then(function(y){f.bumpMap=y,l.add(y),c.add(y)}).catch(noop)),typeof n.ns=="number"&&(f.shininess=n.ns),typeof n.d=="number"){var g=n.d;g>0&&g<1&&(f.opacity=g)}return f.floorIndex=0,{material:f,textureReady:Promise.all(p).then(noop)}}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,m=new THREE__namespace.Vector3,A={},g=new Set,y=0,v=c;y<v.length;y++){var E=v[y],b=E.name,T=E.chunks,_=E.matrix;if(!(b==="Ceiling"||b==="CeilingDrop"))for(var S=0,R=_;S<R.length;S++){var w=R[S];f.elements=w.elements;for(var M=new THREE__namespace.Group,B=0;B<T.length;B++){var C=parseGeometry(T[B].geometry);C.applyMatrix4(f),f.decompose(d,h,m),m.x*m.y*m.z<0&&C.attributes.normal&&C.attributes.position&&C.attributes.uv&&flipBufferGeometryNormals(C),l.add(C);for(var P=[],L=0,O=T[B].material;L<O.length;L++){var F=O[L],N=parseMaterial(F,t,e||"",r,p,o,A,l,g),D=N.material,U=N.textureReady;u.push(U),P.push(D)}var z=new PBMMesh(C,P);z.name="chunk_"+B,z.matrix.compose(z.position,z.quaternion,z.scale),z.matrixAutoUpdate=!1,z.frustumCulled=!1,M.add(z)}M.name=b,s.push(M)}}return Promise.all(u).catch(noop).then(function(){return{createAt:0,description:"",objects:s,textures:Array.from(g),dispose:function(){l.forEach(function(G){G.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:internalFetcher,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={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},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};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=[],m=[],A=[],g=0,y=p.channels.length;g<y;g++){var v=p.channels[g],E=p.samplers[v.sampler],b=v.target,T=b.node!==void 0?b.node:b.id,_=p.parameters!==void 0?p.parameters[E.input]:E.input,S=p.parameters!==void 0?p.parameters[E.output]:E.output;f.push(this.loadNode(T)),d.push(this.loadAccessor(_)),h.push(this.loadAccessor(S)),m.push(E),A.push(b)}o=Promise.all([Promise.all(f),Promise.all(d),Promise.all(h),Promise.all(m),Promise.all(A)]).then(function(R){for(var w=R[0],M=R[1],B=R[2],C=R[3],P=R[4],L=[],O=function(U,z){var G=w[U],j=M[U],Q=B[U],V=C[U],J=P[U];if(G===void 0)return"continue";G.updateMatrix(),G.matrixAutoUpdate=!0;var W=void 0;switch(PATH_PROPERTIES[J.path]){case PATH_PROPERTIES.weights:W=THREE__namespace.NumberKeyframeTrack;break;case PATH_PROPERTIES.rotation:W=THREE__namespace.QuaternionKeyframeTrack;break;case PATH_PROPERTIES.position:case PATH_PROPERTIES.scale:default:W=THREE__namespace.VectorKeyframeTrack;break}var X=G.name?G.name:G.uuid,Z=V.interpolation!==void 0?INTERPOLATION[V.interpolation]:THREE__namespace.InterpolateLinear,Y=[];PATH_PROPERTIES[J.path]===PATH_PROPERTIES.weights?G.traverse(function(ie){ie.morphTargetInfluences&&Y.push(ie.name?ie.name:ie.uuid)}):Y.push(X);var K=Q.array;if(Q.normalized){for(var ee=getNormalizedComponentScale(K.constructor),te=new Float32Array(K.length),re=0,ae=K.length;re<ae;re++)te[re]=K[re]*ee;K=te}for(var re=0,ae=Y.length;re<ae;re++){var ce=new W(Y[re]+"."+PATH_PROPERTIES[J.path],j.array,K,Z);L.push(ce)}},F=0,N=w.length;F<N;F++)O(F);var D=p.name?p.name:"animation_"+t;return new THREE__namespace.AnimationClip(D,void 0,L)})}return this.cache.set(e,o),o},n.prototype.loadBuffer=function(t){var e=this.json.buffers[t];if(e.type&&e.type!=="arraybuffer")throw new Error("glTF: "+e.type+" buffer type is not supported.");var r="buffer:"+t,o=this.cache.get(r);if(o)return o;for(var s=null,u=0,l=values(this.extensions);u<l.length;u++){var c=l[u];if(s=c.loadBuffer(t,this),s)break}if(!s){var 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,m=h*f,A=u.byteOffset||0,g=u.bufferView!==void 0?e.json.bufferViews[u.bufferView].byteStride:void 0,y=u.normalized===!0,v,E;if(g&&g!==m){var b=Math.floor(A/g),T="InterleavedBuffer:"+u.bufferView+":"+u.componentType+":"+b+":"+u.count,_=e.cache.get(T);_||(v=new d(p,b*g,u.count*g/h),_=new THREE__namespace.InterleavedBuffer(v,g/h),e.cache.set(T,_)),E=new THREE__namespace.InterleavedBufferAttribute(_,f,A%g/h,y)}else p===null?v=new d(u.count*f):v=new d(p,A,u.count*f),E=new THREE__namespace.BufferAttribute(v,f,y);if(u.sparse!==void 0){var S=WEBGL_TYPE_SIZES.SCALAR,R=WEBGL_COMPONENT_TYPES[u.sparse.indices.componentType],w=u.sparse.indices.byteOffset||0,M=u.sparse.values.byteOffset||0,B=new R(c[1],w,u.sparse.count*S),C=new d(c[2],M,u.sparse.count*f);p!==null&&(E=new THREE__namespace.BufferAttribute(E.array.slice(),E.itemSize,E.normalized));for(var P=0,L=B.length;P<L;P++){var O=B[P];if(E.setX(O,C[P*f]),f>=2&&E.setY(O,C[P*f+1]),f>=3&&E.setZ(O,C[P*f+2]),f>=4&&E.setW(O,C[P*f+3]),f>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return E})}}return this.cache.set(r,s),s},n.prototype.createPrimitiveKey=function(t){for(var e=0,r=values(this.extensions);e<r.length;e++){var o=r[e],s=o.createPrimitiveKey(t,this);if(s)return s}for(var u="",l=Object.keys(t.attributes).sort(),c=0,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,m=new Uint8Array(f,d,h),A=new Blob([m],{type:l.mimeType});return createImageBitmapLike(A)})}else if(l.uri){var p=this.resolveResouce(l.uri);canUseNativeImageBitmap()?r=this.options.fetcher.ajax(p,{responseType:"blob"}).then(function(f){var d=f.body;return createImageBitmapLike(d)}):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||{},m=h[p.sampler]||{};return d.magFilter=WEBGL_FILTERS[m.magFilter]||THREE__namespace.LinearFilter,d.minFilter=WEBGL_FILTERS[m.minFilter]||THREE__namespace.LinearMipmapLinearFilter,d.wrapS=WEBGL_WRAPPINGS[m.wrapS]||THREE__namespace.RepeatWrapping,d.wrapT=WEBGL_WRAPPINGS[m.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],m=d[1],A=[],g=0;g<c.length;g++){var y=c[g],v=h[g],E=m[g],b=y.mode||WEBGL_CONSTANTS.TRIANGLES,T=void 0;if(b===WEBGL_CONSTANTS.TRIANGLES||b===WEBGL_CONSTANTS.TRIANGLE_STRIP||b===WEBGL_CONSTANTS.TRIANGLE_FAN)if(b===WEBGL_CONSTANTS.TRIANGLE_STRIP?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,E);v.attributes.skinWeight.normalized||_.normalizeSkinWeights(),T=_}else T=new THREE__namespace.Mesh(v,E);else if(b===WEBGL_CONSTANTS.POINTS)T=new THREE__namespace.Points(v,E);else if(b===WEBGL_CONSTANTS.LINES)T=new THREE__namespace.LineSegments(v,E);else if(b===WEBGL_CONSTANTS.LINE_STRIP)T=new THREE__namespace.Line(v,E);else if(b===WEBGL_CONSTANTS.LINE_LOOP)T=new THREE__namespace.LineLoop(v,E);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 w=l.extras.targetNames;if(T.morphTargetInfluences.length===w.length){T.morphTargetDictionary={};for(var S=0,R=w.length;S<R;S++)T.morphTargetDictionary[w[S]]=S}else console.warn("glTF: Invalid extras.targetNames length. Ignoring names.")}}T.name=l.name||"mesh_"+t,h.length>1&&(T.name+="_"+g),e.assignFinalMaterial(T),A.push(T)}if(A.length===1)return A[0];for(var M=new THREE__namespace.Group,B=0,C=A;B<C.length;B++){var T=C[B];M.add(T)}return M})}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 m=e.cache.get(h);m||(m=d.clone(),s&&(m.vertexTangents=!0),u&&(m.vertexColors=!0),l&&(m.flatShading=!0),c&&(m.skinning=!0),p&&(m.morphTargets=!0),f&&(m.morphNormals=!0),s&&(m.normalScale&&(m.normalScale.y*=-1),m.clearcoatNormalScale&&(m.clearcoatNormalScale.y*=-1)),e.cache.set(h,m)),d=m}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 m=s.weights;h.traverse(function(A){if(A instanceof THREE__namespace.Mesh||A instanceof THREE__namespace.Line||A instanceof THREE__namespace.Points)for(var g=0,y=m.length;g<y;g++)A.morphTargetInfluences[g]=m[g]})}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 m;if(s.isBone===!0?m=new THREE__namespace.Bone:h.length>1?m=new THREE__namespace.Group:h.length===1?m=h[0]:m=new THREE__namespace.Object3D,m!==h[0])for(var A=0,g=h.length;A<g;A++)m.add(h[A]);if(s.name&&(m.userData.name=s.name,m.name=THREE__namespace.PropertyBinding.sanitizeNodeName(s.name)),s.matrix!==void 0){var y=new THREE__namespace.Matrix4;y.fromArray(s.matrix),m.applyMatrix4(y)}else s.translation!==void 0&&m.position.fromArray(s.translation),s.rotation!==void 0&&m.quaternion.fromArray(s.rotation),s.scale!==void 0&&m.scale.fromArray(s.scale);return m});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 m=getNormalizedComponentScale(WEBGL_COMPONENT_TYPES[f.componentType]);p.min.multiplyScalar(m),p.max.multiplyScalar(m)}}else console.warn("glTF: Missing min/max properties for accessor POSITION.")}var A=e.targets;if(A!==void 0){for(var g=new THREE__namespace.Vector3,y=new THREE__namespace.Vector3,v=0,E=A.length;v<E;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(y.setX(Math.max(Math.abs(d[0]),Math.abs(h[0]))),y.setY(Math.max(Math.abs(d[1]),Math.abs(h[1]))),y.setZ(Math.max(Math.abs(d[2]),Math.abs(h[2]))),f.normalized){var m=getNormalizedComponentScale(WEBGL_COMPONENT_TYPES[f.componentType]);y.multiplyScalar(m)}g.max(y)}else console.warn("glTF: Missing min/max properties for accessor POSITION.")}}p.expandByVector(g)}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,w=e.targets.length;R<w;R++){var M=e.targets[R];if(M.POSITION!==void 0&&(_=!0),M.NORMAL!==void 0&&(S=!0),_&&S)break}if(!_&&!S)return t;var B=[];t.morphTargetsRelative=!0;for(var C=function(P,L){var O=e.targets[P];_?B.push(r.loadAccessor(O.POSITION).then(function(F){F&&(t.morphAttributes.position=t.morphAttributes.position||[],t.morphAttributes.position[P]=F)})):t.attributes.position&&(t.morphAttributes.position=t.morphAttributes.position||[],t.morphAttributes.position[P]=t.attributes.position),S?B.push(r.loadAccessor(O.NORMAL).then(function(F){F&&(t.morphAttributes.normal=t.morphAttributes.normal||[],t.morphAttributes.normal[P]=F)})):t.attributes.normal&&(t.morphAttributes.normal=t.morphAttributes.normal||[],t.morphAttributes.normal[P]=t.attributes.normal)},R=0,w=e.targets.length;R<w;R++)C(R,w);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 m=l[d];if(m instanceof THREE__namespace.Bone){p.push(m);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 g=new THREE__namespace.Skeleton(p,f);c.bind(g,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=internalFetcher.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,l;t===void 0&&(t={});for(var c=(e=t.upAxis)!==null&&e!==void 0?e:"Z",p=(r=t.light)!==null&&r!==void 0?r:!1,f=(o=t.fetcher)!==null&&o!==void 0?o:internalFetcher,d=(s=t.textureBaseUri)!==null&&s!==void 0?s:guessTextureBaseUriFromFileUrl(n),h=t.textureBaseUri===void 0?[]:((u=t.textureArray)!==null&&u!==void 0?u:[]).slice(),m=autoRestImageOptionsByTextureLength((l=t.textureOptions)!==null&&l!==void 0?l:{},h.length),A=new Map,g=0,y=h;g<y.length;g++){var v=y[g];A.set(v,loadTexture$1(v,d,m,f))}var E={byteLength:0};return Promise.resolve().then(function(){return f.ajax(n,{responseType:"arraybuffer"})}).then(function(b){return lzma(b.body)}).then(function(b){for(var T,_={chunks:[],createAt:void 0,description:void 0},S=0,R=b;S<R.length;S++){var w=R[S],M=Model$2.decode(w);M.chunks.length&&((T=_.chunks).push.apply(T,M.chunks),_.createAt=M.createAt,_.description=M.description)}return _}).then(function(b){return parse$4(b,p,d,h,m,A,f)}).then(function(b){A.clear();var T=new THREE__namespace.Group;T.name=n;for(var _=0,S=b.objects;_<S.length;_++){var R=S[_];T.add(R)}return c==="Y"&&T.applyMatrix4(ROTATE_X_MATRIX_INVERSE),{type:"at3d",modelUpAxis:"Z",upAxis:c,uri:n,byteLength:E.byteLength,memoryUsage:getMemoryUsage(T),scene:T,textures:b.textures,animations:[],dispose:function(){return b.dispose()}}})}const $Reader=minimalExports.Reader,$util=minimalExports.util,$root=minimalExports.roots["@REALSEE/FIVE:five/model/loaders/protobuf/dome.proto"]||(minimalExports.roots["@REALSEE/FIVE:five/model/loaders/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,o){e instanceof $Reader||(e=$Reader.create(e));let s=r===void 0?e.len:e.pos+r,u=new $root.Model;for(;e.pos<s;){let l=e.uint32();if(l===o)break;switch(l>>>3){case 1:{u.meshes&&u.meshes.length||(u.meshes=[]),u.meshes.push($root.Mesh.decode(e,e.uint32()));break}default:e.skipType(l&7);break}}return u},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,o){e instanceof $Reader||(e=$Reader.create(e));let s=r===void 0?e.len:e.pos+r,u=new $root.Mesh;for(;e.pos<s;){let l=e.uint32();if(l===o)break;switch(l>>>3){case 1:{u.name=e.string();break}case 2:{u.chunks&&u.chunks.length||(u.chunks=[]),u.chunks.push($root.Chunk.decode(e,e.uint32()));break}case 3:{u.matrix&&u.matrix.length||(u.matrix=[]),u.matrix.push($root.Matrix.decode(e,e.uint32()));break}default:e.skipType(l&7);break}}if(!u.hasOwnProperty("name"))throw $util.ProtocolError("missing required 'name'",{instance:u});return u},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,o){e instanceof $Reader||(e=$Reader.create(e));let s=r===void 0?e.len:e.pos+r,u=new $root.Matrix;for(;e.pos<s;){let l=e.uint32();if(l===o)break;switch(l>>>3){case 1:{if(u.elements&&u.elements.length||(u.elements=[]),(l&7)===2){let c=e.uint32()+e.pos;for(;e.pos<c;)u.elements.push(e.float())}else u.elements.push(e.float());break}default:e.skipType(l&7);break}}return u},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,o){e instanceof $Reader||(e=$Reader.create(e));let s=r===void 0?e.len:e.pos+r,u=new $root.Chunk;for(;e.pos<s;){let l=e.uint32();if(l===o)break;switch(l>>>3){case 2:{u.geometry=$root.Geometry.decode(e,e.uint32());break}case 3:{u.material&&u.material.length||(u.material=[]),u.material.push($root.Material.decode(e,e.uint32()));break}default:e.skipType(l&7);break}}if(!u.hasOwnProperty("geometry"))throw $util.ProtocolError("missing required 'geometry'",{instance:u});return u},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,o){e instanceof $Reader||(e=$Reader.create(e));let s=r===void 0?e.len:e.pos+r,u=new $root.Geometry;for(;e.pos<s;){let l=e.uint32();if(l===o)break;switch(l>>>3){case 1:{u.position=$root.Position.decode(e,e.uint32());break}case 2:{u.uv=$root.UV.decode(e,e.uint32());break}case 3:{u.uv2=$root.UV.decode(e,e.uint32());break}case 4:{u.normal=$root.Normal.decode(e,e.uint32());break}case 5:{u.groups&&u.groups.length||(u.groups=[]),u.groups.push($root.Group.decode(e,e.uint32()));break}default:e.skipType(l&7);break}}if(!u.hasOwnProperty("position"))throw $util.ProtocolError("missing required 'position'",{instance:u});if(!u.hasOwnProperty("normal"))throw $util.ProtocolError("missing required 'normal'",{instance:u});return u},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,o){e instanceof $Reader||(e=$Reader.create(e));let s=r===void 0?e.len:e.pos+r,u=new $root.Position;for(;e.pos<s;){let l=e.uint32();if(l===o)break;switch(l>>>3){case 1:{if(u.array&&u.array.length||(u.array=[]),(l&7)===2){let c=e.uint32()+e.pos;for(;e.pos<c;)u.array.push(e.float())}else u.array.push(e.float());break}default:e.skipType(l&7);break}}return u},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,o){e instanceof $Reader||(e=$Reader.create(e));let s=r===void 0?e.len:e.pos+r,u=new $root.UV;for(;e.pos<s;){let l=e.uint32();if(l===o)break;switch(l>>>3){case 1:{if(u.array&&u.array.length||(u.array=[]),(l&7)===2){let c=e.uint32()+e.pos;for(;e.pos<c;)u.array.push(e.float())}else u.array.push(e.float());break}default:e.skipType(l&7);break}}return u},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,o){e instanceof $Reader||(e=$Reader.create(e));let s=r===void 0?e.len:e.pos+r,u=new $root.Normal;for(;e.pos<s;){let l=e.uint32();if(l===o)break;switch(l>>>3){case 1:{if(u.array&&u.array.length||(u.array=[]),(l&7)===2){let c=e.uint32()+e.pos;for(;e.pos<c;)u.array.push(e.float())}else u.array.push(e.float());break}default:e.skipType(l&7);break}}return u},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,o){e instanceof $Reader||(e=$Reader.create(e));let s=r===void 0?e.len:e.pos+r,u=new $root.Group;for(;e.pos<s;){let l=e.uint32();if(l===o)break;switch(l>>>3){case 1:{u.start=e.uint32();break}case 2:{u.count=e.uint32();break}case 3:{u.materialIndex=e.uint32();break}default:e.skipType(l&7);break}}if(!u.hasOwnProperty("start"))throw $util.ProtocolError("missing required 'start'",{instance:u});if(!u.hasOwnProperty("count"))throw $util.ProtocolError("missing required 'count'",{instance:u});if(!u.hasOwnProperty("materialIndex"))throw $util.ProtocolError("missing required 'materialIndex'",{instance:u});return u},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,o){e instanceof $Reader||(e=$Reader.create(e));let s=r===void 0?e.len:e.pos+r,u=new $root.Material;for(;e.pos<s;){let l=e.uint32();if(l===o)break;switch(l>>>3){case 1:{u.kd=$root.Color.decode(e,e.uint32());break}case 2:{u.ks=$root.Color.decode(e,e.uint32());break}case 3:{u.ke=$root.Color.decode(e,e.uint32());break}case 4:{u.mapkd=e.string();break}case 5:{u.mapks=e.string();break}case 6:{u.mapke=e.string();break}case 7:{u.norm=e.string();break}case 8:{u.mapbump=e.string();break}case 9:{u.bump=e.string();break}case 10:{u.mapd=e.string();break}case 11:{u.ns=e.float();break}case 12:{u.d=e.float();break}case 13:{u.tr=e.float();break}case 14:{u.mapkdrepeat=e.string();break}default:e.skipType(l&7);break}}return u},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,o){e instanceof $Reader||(e=$Reader.create(e));let s=r===void 0?e.len:e.pos+r,u=new $root.Color;for(;e.pos<s;){let l=e.uint32();if(l===o)break;switch(l>>>3){case 1:{if(u.rgb&&u.rgb.length||(u.rgb=[]),(l&7)===2){let c=e.uint32()+e.pos;for(;e.pos<c;)u.rgb.push(e.float())}else u.rgb.push(e.float());break}default:e.skipType(l&7);break}}return u},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:internalFetcher,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","forceUseExifOrientation","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(y){return Number(y)}),m=h[0],A=h[1];d=new THREE__namespace.Vector2(m,A)}p.push(loadTexture(n.mapkd,e,r,d,o,s,u).then(function(y){y.encoding=THREE__namespace.sRGBEncoding,f.map=y,l.add(y),c.add(y),f.needsUpdate=!0}).catch(noop))}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(y){f.specularMap=y,l.add(y),c.add(y)}).catch(noop)),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(y){y.encoding=THREE__namespace.sRGBEncoding,f.emissiveMap=y,l.add(y),c.add(y)}).catch(noop)),n.norm&&p.push(loadTexture(n.norm,e,r,null,o,s,u).then(function(y){f.normalMap=y,l.add(y),c.add(y)}).catch(noop)),n.mapbump&&p.push(loadTexture(n.mapbump,e,r,null,o,s,u).then(function(y){f.bumpMap=y,l.add(y),c.add(y)}).catch(noop)),n.bump&&p.push(loadTexture(n.bump,e,r,null,o,s,u).then(function(y){f.bumpMap=y,l.add(y),c.add(y)}).catch(noop)),typeof n.ns=="number"&&(f.shininess=n.ns),typeof n.d=="number"){var g=n.d;g>0&&g<1&&(f.opacity=g)}return f.floorIndex=0,{material:f,textureReady:Promise.all(p).then(noop)}}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,m=new THREE__namespace.Vector3,A={},g=new Set,y=0,v=c;y<v.length;y++){var E=v[y],b=E.name,T=E.chunks,_=E.matrix;if(!(b==="Ceiling"||b==="CeilingDrop"))for(var S=0,R=_;S<R.length;S++){var w=R[S];f.elements=w.elements;for(var M=new THREE__namespace.Group,B=0;B<T.length;B++){var C=parseGeometry(T[B].geometry);C.applyMatrix4(f),f.decompose(d,h,m),m.x*m.y*m.z<0&&C.attributes.normal&&C.attributes.position&&C.attributes.uv&&flipBufferGeometryNormals(C),l.add(C);for(var P=[],L=0,O=T[B].material;L<O.length;L++){var F=O[L],N=parseMaterial(F,t,e||"",r,p,o,A,l,g),D=N.material,U=N.textureReady;u.push(U),P.push(D)}var z=new PBMMesh(C,P);z.name="chunk_"+B,z.matrix.compose(z.position,z.quaternion,z.scale),z.matrixAutoUpdate=!1,z.frustumCulled=!1,M.add(z)}M.name=b,s.push(M)}}return Promise.all(u).catch(noop).then(function(){return{createAt:0,description:"",objects:s,textures:Array.from(g),dispose:function(){l.forEach(function(K){K.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:internalFetcher,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={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},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 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};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=[],m=[],A=[],g=0,y=p.channels.length;g<y;g++){var v=p.channels[g],E=p.samplers[v.sampler],b=v.target,T=b.node!==void 0?b.node:b.id,_=p.parameters!==void 0?p.parameters[E.input]:E.input,S=p.parameters!==void 0?p.parameters[E.output]:E.output;f.push(this.loadNode(T)),d.push(this.loadAccessor(_)),h.push(this.loadAccessor(S)),m.push(E),A.push(b)}o=Promise.all([Promise.all(f),Promise.all(d),Promise.all(h),Promise.all(m),Promise.all(A)]).then(function(R){for(var w=R[0],M=R[1],B=R[2],C=R[3],P=R[4],L=[],O=function(U,z){var K=w[U],j=M[U],Q=B[U],V=C[U],J=P[U];if(K===void 0)return"continue";K.updateMatrix(),K.matrixAutoUpdate=!0;var W=void 0;switch(PATH_PROPERTIES[J.path]){case PATH_PROPERTIES.weights:W=THREE__namespace.NumberKeyframeTrack;break;case PATH_PROPERTIES.rotation:W=THREE__namespace.QuaternionKeyframeTrack;break;case PATH_PROPERTIES.position:case PATH_PROPERTIES.scale:default:W=THREE__namespace.VectorKeyframeTrack;break}var X=K.name?K.name:K.uuid,Z=V.interpolation!==void 0?INTERPOLATION[V.interpolation]:THREE__namespace.InterpolateLinear,Y=[];PATH_PROPERTIES[J.path]===PATH_PROPERTIES.weights?K.traverse(function(ie){ie.morphTargetInfluences&&Y.push(ie.name?ie.name:ie.uuid)}):Y.push(X);var G=Q.array;if(Q.normalized){for(var ee=getNormalizedComponentScale(G.constructor),te=new Float32Array(G.length),ne=0,ae=G.length;ne<ae;ne++)te[ne]=G[ne]*ee;G=te}for(var ne=0,ae=Y.length;ne<ae;ne++){var ce=new W(Y[ne]+"."+PATH_PROPERTIES[J.path],j.array,G,Z);L.push(ce)}},F=0,N=w.length;F<N;F++)O(F);var D=p.name?p.name:"animation_"+t;return new THREE__namespace.AnimationClip(D,void 0,L)})}return this.cache.set(e,o),o},n.prototype.loadBuffer=function(t){var e=this.json.buffers[t];if(e.type&&e.type!=="arraybuffer")throw new Error("glTF: "+e.type+" buffer type is not supported.");var r="buffer:"+t,o=this.cache.get(r);if(o)return o;for(var s=null,u=0,l=values(this.extensions);u<l.length;u++){var c=l[u];if(s=c.loadBuffer(t,this),s)break}if(!s){var 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,m=h*f,A=u.byteOffset||0,g=u.bufferView!==void 0?e.json.bufferViews[u.bufferView].byteStride:void 0,y=u.normalized===!0,v,E;if(g&&g!==m){var b=Math.floor(A/g),T="InterleavedBuffer:"+u.bufferView+":"+u.componentType+":"+b+":"+u.count,_=e.cache.get(T);_||(v=new d(p,b*g,u.count*g/h),_=new THREE__namespace.InterleavedBuffer(v,g/h),e.cache.set(T,_)),E=new THREE__namespace.InterleavedBufferAttribute(_,f,A%g/h,y)}else p===null?v=new d(u.count*f):v=new d(p,A,u.count*f),E=new THREE__namespace.BufferAttribute(v,f,y);if(u.sparse!==void 0){var S=WEBGL_TYPE_SIZES.SCALAR,R=WEBGL_COMPONENT_TYPES[u.sparse.indices.componentType],w=u.sparse.indices.byteOffset||0,M=u.sparse.values.byteOffset||0,B=new R(c[1],w,u.sparse.count*S),C=new d(c[2],M,u.sparse.count*f);p!==null&&(E=new THREE__namespace.BufferAttribute(E.array.slice(),E.itemSize,E.normalized));for(var P=0,L=B.length;P<L;P++){var O=B[P];if(E.setX(O,C[P*f]),f>=2&&E.setY(O,C[P*f+1]),f>=3&&E.setZ(O,C[P*f+2]),f>=4&&E.setW(O,C[P*f+3]),f>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return E})}}return this.cache.set(r,s),s},n.prototype.createPrimitiveKey=function(t){for(var e=0,r=values(this.extensions);e<r.length;e++){var o=r[e],s=o.createPrimitiveKey(t,this);if(s)return s}for(var u="",l=Object.keys(t.attributes).sort(),c=0,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,m=new Uint8Array(f,d,h),A=new Blob([m],{type:l.mimeType});return createImageBitmapLike(A)})}else if(l.uri){var p=this.resolveResouce(l.uri);canUseNativeImageBitmap()?r=this.options.fetcher.ajax(p,{responseType:"blob"}).then(function(f){var d=f.body;return createImageBitmapLike(d)}):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||{},m=h[p.sampler]||{};return d.magFilter=WEBGL_FILTERS[m.magFilter]||THREE__namespace.LinearFilter,d.minFilter=WEBGL_FILTERS[m.minFilter]||THREE__namespace.LinearMipmapLinearFilter,d.wrapS=WEBGL_WRAPPINGS[m.wrapS]||THREE__namespace.RepeatWrapping,d.wrapT=WEBGL_WRAPPINGS[m.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],m=d[1],A=[],g=0;g<c.length;g++){var y=c[g],v=h[g],E=m[g],b=y.mode||WEBGL_CONSTANTS.TRIANGLES,T=void 0;if(b===WEBGL_CONSTANTS.TRIANGLES||b===WEBGL_CONSTANTS.TRIANGLE_STRIP||b===WEBGL_CONSTANTS.TRIANGLE_FAN)if(b===WEBGL_CONSTANTS.TRIANGLE_STRIP?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,E);v.attributes.skinWeight.normalized||_.normalizeSkinWeights(),T=_}else T=new THREE__namespace.Mesh(v,E);else if(b===WEBGL_CONSTANTS.POINTS)T=new THREE__namespace.Points(v,E);else if(b===WEBGL_CONSTANTS.LINES)T=new THREE__namespace.LineSegments(v,E);else if(b===WEBGL_CONSTANTS.LINE_STRIP)T=new THREE__namespace.Line(v,E);else if(b===WEBGL_CONSTANTS.LINE_LOOP)T=new THREE__namespace.LineLoop(v,E);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 w=l.extras.targetNames;if(T.morphTargetInfluences.length===w.length){T.morphTargetDictionary={};for(var S=0,R=w.length;S<R;S++)T.morphTargetDictionary[w[S]]=S}else console.warn("glTF: Invalid extras.targetNames length. Ignoring names.")}}T.name=l.name||"mesh_"+t,h.length>1&&(T.name+="_"+g),e.assignFinalMaterial(T),A.push(T)}if(A.length===1)return A[0];for(var M=new THREE__namespace.Group,B=0,C=A;B<C.length;B++){var T=C[B];M.add(T)}return M})}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 m=e.cache.get(h);m||(m=d.clone(),s&&(m.vertexTangents=!0),u&&(m.vertexColors=!0),l&&(m.flatShading=!0),c&&(m.skinning=!0),p&&(m.morphTargets=!0),f&&(m.morphNormals=!0),s&&(m.normalScale&&(m.normalScale.y*=-1),m.clearcoatNormalScale&&(m.clearcoatNormalScale.y*=-1)),e.cache.set(h,m)),d=m}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 m=s.weights;h.traverse(function(A){if(A instanceof THREE__namespace.Mesh||A instanceof THREE__namespace.Line||A instanceof THREE__namespace.Points)for(var g=0,y=m.length;g<y;g++)A.morphTargetInfluences[g]=m[g]})}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 m;if(s.isBone===!0?m=new THREE__namespace.Bone:h.length>1?m=new THREE__namespace.Group:h.length===1?m=h[0]:m=new THREE__namespace.Object3D,m!==h[0])for(var A=0,g=h.length;A<g;A++)m.add(h[A]);if(s.name&&(m.userData.name=s.name,m.name=THREE__namespace.PropertyBinding.sanitizeNodeName(s.name)),s.matrix!==void 0){var y=new THREE__namespace.Matrix4;y.fromArray(s.matrix),m.applyMatrix4(y)}else s.translation!==void 0&&m.position.fromArray(s.translation),s.rotation!==void 0&&m.quaternion.fromArray(s.rotation),s.scale!==void 0&&m.scale.fromArray(s.scale);return m});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 m=getNormalizedComponentScale(WEBGL_COMPONENT_TYPES[f.componentType]);p.min.multiplyScalar(m),p.max.multiplyScalar(m)}}else console.warn("glTF: Missing min/max properties for accessor POSITION.")}var A=e.targets;if(A!==void 0){for(var g=new THREE__namespace.Vector3,y=new THREE__namespace.Vector3,v=0,E=A.length;v<E;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(y.setX(Math.max(Math.abs(d[0]),Math.abs(h[0]))),y.setY(Math.max(Math.abs(d[1]),Math.abs(h[1]))),y.setZ(Math.max(Math.abs(d[2]),Math.abs(h[2]))),f.normalized){var m=getNormalizedComponentScale(WEBGL_COMPONENT_TYPES[f.componentType]);y.multiplyScalar(m)}g.max(y)}else console.warn("glTF: Missing min/max properties for accessor POSITION.")}}p.expandByVector(g)}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,w=e.targets.length;R<w;R++){var M=e.targets[R];if(M.POSITION!==void 0&&(_=!0),M.NORMAL!==void 0&&(S=!0),_&&S)break}if(!_&&!S)return t;var B=[];t.morphTargetsRelative=!0;for(var C=function(P,L){var O=e.targets[P];_?B.push(r.loadAccessor(O.POSITION).then(function(F){F&&(t.morphAttributes.position=t.morphAttributes.position||[],t.morphAttributes.position[P]=F)})):t.attributes.position&&(t.morphAttributes.position=t.morphAttributes.position||[],t.morphAttributes.position[P]=t.attributes.position),S?B.push(r.loadAccessor(O.NORMAL).then(function(F){F&&(t.morphAttributes.normal=t.morphAttributes.normal||[],t.morphAttributes.normal[P]=F)})):t.attributes.normal&&(t.morphAttributes.normal=t.morphAttributes.normal||[],t.morphAttributes.normal[P]=t.attributes.normal)},R=0,w=e.targets.length;R<w;R++)C(R,w);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 m=l[d];if(m instanceof THREE__namespace.Bone){p.push(m);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 g=new THREE__namespace.Skeleton(p,f);c.bind(g,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=internalFetcher.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=internalFetcher.ajax(this.decoderPath+"draco_wasm_wrapper.js",{responseType:"text"}).then(function(u){return u.body}),o=internalFetcher.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;
@@ -915,8 +915,8 @@ self.onmessage = function(event) {
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 E=new Uint8Array(v.length),b=0;b<v.length;++b){var T=v.charCodeAt(b);E[b]=T>96?T-97:T>64?T-39:T+4}for(var _=0,b=0;b<v.length;++b)E[_++]=E[b]<60?r[E[b]]:(E[b]-60)*64+E[++b];return E.buffer.slice(0,_)}function c(v,E,b,T,_,S){var R=s.exports.sbrk,w=b+3&-4,M=R(w*T),B=R(_.length),C=new Uint8Array(s.exports.memory.buffer);C.set(_,B);var P=v(M,b,T,B,_.length);if(P==0&&S&&S(M,w,T),E.set(C.subarray(M,M+b*T)),R(M-R(0)),P!=0)throw new Error("Malformed buffer data: "+P)}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 m(v){var E={object:new Worker(v),pending:0,requests:{}};return E.object.onmessage=function(b){var T=b.data;E.pending-=T.count,E.requests[T.id][T.action](T.value),delete E.requests[T.id]},E}function A(v){for(var E="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()+y.toString(),b=new Blob([E],{type:"text/javascript"}),T=URL.createObjectURL(b),_=0;_<v;++_)d[_]=m(T);URL.revokeObjectURL(T)}function g(v,E,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(w,M){var B=new Uint8Array(b),C=h++;S.pending+=v,S.requests[C]={resolve:w,reject:M},S.object.postMessage({id:C,count:v,size:E,source:B,mode:T,filter:_},[B.buffer])})}function y(v){u.then(function(){var E=v.data;try{var b=new Uint8Array(E.count*E.size);c(s.exports[E.mode],b,E.count,E.size,E.source,s.exports[E.filter]),self.postMessage({id:E.id,count:E.count,action:"resolve",value:b},[b.buffer])}catch(T){self.postMessage({id:E.id,count:E.count,action:"reject",value:T})}})}return{ready:u,supported:!0,useWorkers:function(v){A(v)},decodeVertexBuffer:function(v,E,b,T,_){c(s.exports.meshopt_decodeVertexBuffer,v,E,b,T,s.exports[p[_]])},decodeIndexBuffer:function(v,E,b,T){c(s.exports.meshopt_decodeIndexBuffer,v,E,b,T)},decodeIndexSequence:function(v,E,b,T){c(s.exports.meshopt_decodeIndexSequence,v,E,b,T)},decodeGltfBuffer:function(v,E,b,T,_,S){c(s.exports[f[_]],v,E,b,T,s.exports[p[S]])},decodeGltfBufferAsync:function(v,E,b,T,_){return d.length>0?g(v,E,b,f[T],p[_]):u.then(function(){var S=new Uint8Array(v*E);return c(s.exports[f[T]],S,v,E,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,m=u.byteStride,A=new ArrayBuffer(h*m),g=new Uint8Array(p,f,d);return meshoptDecoder.decodeGltfBuffer(new Uint8Array(A),h,m,g,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],m=[],A=0;A<u.length;A++){var g=u[A],y=d[A],v=h[A],E=g.mode||WEBGL_CONSTANTS.TRIANGLES,b=void 0;if(E===WEBGL_CONSTANTS.TRIANGLES||E===WEBGL_CONSTANTS.TRIANGLE_STRIP||E===WEBGL_CONSTANTS.TRIANGLE_FAN)if(E===WEBGL_CONSTANTS.TRIANGLE_STRIP?y=r.toGeometryTrianglesDrawMode(y,THREE__namespace.TriangleStripDrawMode):E===WEBGL_CONSTANTS.TRIANGLE_FAN&&(y=r.toGeometryTrianglesDrawMode(y,THREE__namespace.TriangleFanDrawMode)),y.clearGroups(),y.addGroup(0,y.index?y.index.count:y.attributes.position.count,0),r.disposeSet.add(y),s.isSkinnedMesh){var T=new PBMSkinnedMesh(y,[v]);y.attributes.skinWeight.normalized||T.normalizeSkinWeights(),b=T}else b=new PBMMesh(y,[v]);else if(E===WEBGL_CONSTANTS.POINTS)b=new PBMPointCloud(y,v);else throw new Error("glTF: Primitive mode unsupported: "+E);if(Object.keys(y.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),m.push(b)}if(m.length===1)return m[0];for(var w=new THREE__namespace.Group,M=0,B=m;M<B.length;M++){var b=B[M];w.add(b)}return w});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 m=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 m.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:internalFetcher,c={uri:n};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 m=f.extensionsUsed.indexOf(h);m>=0&&f.extensionsUsed.splice(m,1)}else{var m=f.extensionsUsed.indexOf(h);m===-1&&f.extensionsUsed.push(h)}}{var h="PBM_mesh",m=f.extensionsUsed.indexOf(h);m===-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 m=new THREE__namespace.Matrix4().setPosition(h);d.premultiply(m)}return u==="Y"&&d.premultiply(ROTATE_X_MATRIX_INVERSE),f.scene.applyMatrix4(d),c.featureTableBinary=void 0,c.batchTableBinary=void 0,c.gltfArrayBuffer=void 0,{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()}}})})}const jsContent$1=`(function(){"use strict";function B(a){onmessage=function(r){Promise.resolve(r.data).then(function(n){return a(n)}).then(function(n){var e=n.output,t=n.transfer;return postMessage(e,t)}).catch(function(n){return postMessage({$$error:n})})}}var u,y;(function(a){a[a.BYTE=5120]="BYTE",a[a.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",a[a.SHORT=5122]="SHORT",a[a.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",a[a.INT=5124]="INT",a[a.UNSIGNED_INT=5125]="UNSIGNED_INT",a[a.FLOAT=5126]="FLOAT",a[a.DOUBLE=5130]="DOUBLE"})(y||(y={}));var c=(u={},u[y.DOUBLE]=Float64Array,u[y.FLOAT]=Float32Array,u[y.UNSIGNED_SHORT]=Uint16Array,u[y.UNSIGNED_INT]=Uint32Array,u[y.UNSIGNED_BYTE]=Uint8Array,u[y.BYTE]=Int8Array,u[y.SHORT]=Int16Array,u[y.INT]=Int32Array,u),F={DOUBLE:y.DOUBLE,FLOAT:y.FLOAT,UNSIGNED_SHORT:y.UNSIGNED_SHORT,UNSIGNED_INT:y.UNSIGNED_INT,UNSIGNED_BYTE:y.UNSIGNED_BYTE,BYTE:y.BYTE,SHORT:y.SHORT,INT:y.INT};function O(a){var r=c[a];if(!r)throw new Error("Failed to convert GL type");return r}function p(a){var r=O(a);return r.BYTES_PER_ELEMENT}function _(a,r,n,e){n===void 0&&(n=0);var t=O(a);if(n%p(a)!==0){var i=e?r.slice(n,n+e*p(a)):r.slice(n);return new t(i)}else return new t(r,n,e!=null?e:(r.byteLength-n)/p(a))}function l(a){var r=F[a];if(!r)throw new Error("Failed to convert GL type");return r}var R=(function(){function a(r,n){this.featuresLength=0,this.cachedTypedArrays={},this.json=r,this.buffer=n;var e=this.getGlobalProperty("POINTS_LENGTH",y.UNSIGNED_INT,1);e&&e.length&&(this.featuresLength=e[0])}return a.prototype.getExtension=function(r){return this.json.extensions&&this.json.extensions[r]},a.prototype.hasProperty=function(r){return!!this.json[r]},a.prototype.getGlobalProperty=function(r,n,e){var t=this.json[r];if(typeof t=="number"){var i=O(n);return new i([t])}else if(Array.isArray(t)){var i=O(n);return new i(t)}else if(t&&Number.isFinite(t.byteOffset))return this.getTypedArrayFromBinary(r,n,e,1,t.byteOffset);return null},a.prototype.getPropertyArray=function(r,n,e){var t=this.json[r];return t&&Number.isFinite(t.byteOffset)?("componentType"in t&&(n=l(t.componentType)),this.getTypedArrayFromBinary(r,n,e,this.featuresLength,t.byteOffset)):this.getTypedArrayFromArray(r,n,t)},a.prototype.getProperty=function(r,n,e,t,i){var o=this.json[r];if(!o)return null;var v=this.getPropertyArray(r,n,e);if(e===1)return i[0]=v[t],i;for(var A=0;A<e;++A)i[A]=v[e*t+A];return i},a.prototype.getTypedArrayFromBinary=function(r,n,e,t,i){var o=this.cachedTypedArrays,v=o[r];return v||(v=_(n,this.buffer.buffer,this.buffer.byteOffset+i,t*e),o[r]=v),v},a.prototype.getTypedArrayFromArray=function(r,n,e){var t=this.cachedTypedArrays,i=t[r];return i||(i=_(n,e),t[r]=i),i},a})();B(function(a){return Promise.resolve(a).then(function(r){var n=new R(r.featureTableJson,r.featureTableBinary),e=d(n),t=g(n),i=P(n),o=[];return e&&o.push(e.array.buffer),t&&o.push(t.array.buffer),i&&o.push(i.array.buffer),{output:{position:e,color:t,normal:i},transfer:o}})});var U=65535;function d(a){if(a.hasProperty("POSITION")){var r=a.getPropertyArray("POSITION",y.FLOAT,3);return{array:r,itemSize:3,normalized:!1}}else if(a.hasProperty("POSITION_QUANTIZED")){var n=a.getPropertyArray("POSITION_QUANTIZED",y.UNSIGNED_SHORT,3),e=a.getGlobalProperty("QUANTIZED_VOLUME_SCALE",y.FLOAT,3),t=a.getGlobalProperty("QUANTIZED_VOLUME_OFFSET",y.FLOAT,3);if(!e||!t)throw new Error("QUANTIZED_VOLUME_SCALE or QUANTIZED_VOLUME_OFFSET never found.");for(var i=new Float32Array(n.length),o=n.length/3,v=e[0]/U,A=e[1]/U,N=e[2]/U,E=t[0],S=t[1],s=t[2],T=0,I=void 0;T<o;T++)I=T*3,i[I]=n[I]*v+E,i[++I]=n[I]*A+S,i[++I]=n[I]*N+s;return{array:i,itemSize:3,normalized:!1}}return null}function g(a){if(a.hasProperty("RGB")){for(var r=a.getPropertyArray("RGB",y.UNSIGNED_BYTE,3),n=r.length/3,e=new Uint8Array(n*4),t=0,i=void 0,o=void 0;t<n;t++)o=t*4,i=t*3,e[o]=r[i],e[++o]=r[++i],e[++o]=r[++i];return{array:e,itemSize:4,normalized:!0}}else if(a.hasProperty("RGBA")){var r=a.getPropertyArray("RGBA",y.UNSIGNED_BYTE,4);return{array:r,itemSize:4,normalized:!0}}else if(a.hasProperty("RGB565")){for(var r=a.getPropertyArray("RGB565",y.UNSIGNED_SHORT,1),n=r.length,e=new Uint8Array(n*4),t=0,v=void 0,A=void 0;t<n;t++)A=r[t],v=t*4,e[v]=(A>>11&31)<<3,e[++v]=(A>>5&63)<<2,e[++v]=(A&31)<<3;return{array:e,itemSize:4,normalized:!0}}return null}var G=255,h=127,D=2/G;function P(a){if(a.hasProperty("NORMAL")){for(var r=a.getPropertyArray("NORMAL",y.FLOAT,3),n=r.length/3,e=new Int8Array(n*4),t=0,i=void 0,o=void 0;t<n;t++)o=t*4,i=t*3,e[o]=r[i]*h,e[++o]=r[++i]*h,e[++o]=r[++i]*h;return{array:e,itemSize:4,normalized:!0}}else if(a.hasProperty("NORMAL_OCT16P")){for(var r=a.getPropertyArray("NORMAL_OCT16P",y.UNSIGNED_BYTE,2),n=r.length/2,e=new Int8Array(n*4),t=0,v=void 0,A=void 0,N=void 0,E=void 0,S=void 0,s=void 0,T=void 0;t<n;t++)v=t*2,A=r[v]*D-1,N=r[++v]*D-1,S=A<0?-A:A,s=N<0?-N:N,E=1-(S+s),E<0&&(A=(1-s)*(A<0?-1:1),N=(1-S)*(N<0?-1:1)),T=Math.sqrt(A*A+N*N+E*E),v=t*4,e[v]=A/T*h,e[++v]=N/T*h,e[++v]=E/T*h;return{array:e,itemSize:4,normalized:!0}}return null}})();
917
917
  `,blob$1=typeof self!="undefined"&&self.Blob&&new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);",jsContent$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;charset=utf-8,"+encodeURIComponent(jsContent$1),{name:n==null?void 0:n.name})}}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"),m=p.getAttribute("NORMAL"),A;if(h)A=h;else if(d){for(var g=d.count,y=d.array,v=new Uint8Array(g*4),E=0,b=void 0,T=void 0;E<g;E++)T=E*4,b=E*3,v[T]=y[b],v[++T]=y[++b],v[++T]=y[++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:m?{array:m.array,itemSize:m.itemSize,normalized:m.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:internalFetcher,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),u.gltfArrayBuffer=void 0,u.featureTableBinary=void 0,u.batchTableBinary=void 0,{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:internalFetcher,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 m="KHR_materials_unlit";if(t.light){var A=d.extensionsUsed.indexOf(m);A>=0&&d.extensionsUsed.splice(A,1)}else{var A=d.extensionsUsed.indexOf(m);A===-1&&d.extensionsUsed.push(m)}}{var m="PBM_mesh",A=d.extensionsUsed.indexOf(m);A===-1&&d.extensionsUsed.push(m)}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:internalFetcher,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,m=new THREE__namespace.LineBasicMaterial({vertexColors:h}),d=new THREE__namespace.Line(f,m);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(),m.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 g=new PBMPointCloudMaterial,d=new PBMPointCloud(f,g);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(),g.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 m=u[0];handleElement(r,p.name,m,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!==`
918
- `&&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(te){var re=e.length;if(te>re){var ae=new u8(Math.max(re*2,te));ae.set(e),e=ae}},f=t.f||0,d=t.p||0,h=t.b||0,m=t.l,A=t.d,g=t.m,y=t.n,v=o*8;do{if(!m){f=bits(n,d,1);var E=bits(n,d+1,3);if(d+=3,E)if(E==1)m=flrm,A=fdrm,g=9,y=5;else if(E==2){var S=bits(n,d,31)+257,R=bits(n,d+10,15)+4,w=S+bits(n,d+5,31)+1;d+=14;for(var M=new u8(w),B=new u8(19),C=0;C<R;++C)B[clim[C]]=bits(n,d+C*3,7);d+=R*3;for(var P=max(B),L=(1<<P)-1,O=hMap(B,P,1),C=0;C<w;){var F=O[bits(n,d,L)];d+=F&15;var b=F>>4;if(b<16)M[C++]=b;else{var N=0,D=0;for(b==16?(D=3+bits(n,d,3),d+=2,N=M[C-1]):b==17?(D=3+bits(n,d,7),d+=3):b==18&&(D=11+bits(n,d,127),d+=7);D--;)M[C++]=N}}var U=M.subarray(0,S),z=M.subarray(S);g=max(U),y=max(z),m=hMap(U,g,1),A=hMap(z,y,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 G=(1<<g)-1,j=(1<<y)-1,Q=d;;Q=d){var N=m[bits16(n,d)&G],V=N>>4;if(d+=N&15,d>v){c&&err(0);break}if(N||err(2),V<256)e[h++]=V;else if(V==256){Q=d,m=null;break}else{var J=V-254;if(V>264){var C=V-257,W=fleb[C];J=bits(n,d,(1<<W)-1)+fl[C],d+=W}var X=A[bits16(n,d)&j],Z=X>>4;X||err(3),d+=X&15;var z=fd[Z];if(Z>3){var W=fdeb[Z];z+=bits16(n,d)&(1<<W)-1,d+=W}if(d>v){c&&err(0);break}l&&p(h+131072);var Y=h+J;if(h<z){var K=s-z,ee=Math.min(z,Y);for(K+h<0&&err(3);h<ee;++h)e[h]=r[K+h]}for(;h<Y;++h)e[h]=e[h-z]}}t.l=m,t.p=Q,t.b=h,t.f=f,m&&(f=1,t.m=g,t.d=A,t.n=y)}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)==1&&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),-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],m=p[3],A=p[4],g=p[5],y=slzh(n,g);s=A,f?f==8?e[m]=inflateSync(n.subarray(y,y+d),{out:new u8(h)}):err(14,"unknown compression type "+f):e[m]=slc(n,y,y+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:internalFetcher,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),m=this.parseMaterials(t,h,c),A=this.parseDeformers(t,c),g=new GeometryParser().parse(t,A,c);this.parseScene(t,A,g,m,c,p);var y=(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,E=(l=(u=t.GlobalSettings.UnitScaleFactor)===null||u===void 0?void 0:u.value)!==null&&l!==void 0?l:1,b;if(t.GlobalSettings.AmbientColor){var T=t.GlobalSettings.AmbientColor.value,_=T[0],S=T[1],R=T[2];if(_!==0||S!==0||R!==0){var w=new THREE__namespace.Color().setRGB(_,S,R);b=new THREE__namespace.AmbientLight(w,1)}}return Promise.all(f).then(function(M){var B;return{scene:p,textures:M,ambientLight:b,upAxis:["X","Y","Z"][y],frontAxis:["X","Y","Z"][v],unitScale:E,animations:(B=p.animations)!==null&&B!==void 0?B:[],dispose:function(){M.forEach(function(C){return C.dispose()}),m.forEach(function(C){return C.dispose()}),g.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;canUseNativeImageBitmap()?c=this.fetcher.ajax(u,{responseType:"blob"}).then(function(f){var d=f.body;return createImageBitmapLike(d)}):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 m=s.get(d.ID).parents;m.forEach(function(A){var g=l.get(A.ID);g!==void 0&&g.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 m=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,m!==null&&s.add(m)}})};for(var c in e)l(c)}),s},n.prototype.createCamera=function(t,e){var r,o;if(e.children.forEach(function(m){var A=t.Objects.NodeAttribute[m.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 m=t.Objects.NodeAttribute[h.ID];m!==void 0&&(o=m)}),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 m=h.ID,A=s.get(m);A.parents.forEach(function(g){if(o.has(g.ID)){var y=o.get(g.ID);y instanceof THREE__namespace.SkinnedMesh&&y.bind(new THREE__namespace.Skeleton(f.bones),u[g.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,m){return s[m.ID]!==void 0&&(h=s[m.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(y,v){var E=v===0?"uv":"uv".concat(v+1);u.setAttribute(E,new THREE__namespace.Float32BufferAttribute(c.uvs[v],2))}),l.material&&l.material.mappingType!=="AllSame"){var h=c.materialIndex[0],m=0;if(c.materialIndex.forEach(function(y,v){y!==h&&(u.addGroup(m,v-m,h),h=y,m=v)}),u.groups.length>0){var A=u.groups[u.groups.length-1],g=A.start+A.count;g!==c.materialIndex.length&&u.addGroup(g,c.materialIndex.length-g,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(m,A){var g=0,y=!1;m<0&&(m=m^-1,y=!0);var v=[],E=[];if(u.push(m*3,m*3+1,m*3+2),t.color){var b=getData(A,r,m,t.color);c.push(b[0],b[1],b[2])}if(t.skeleton){if(t.weightTable[m]!==void 0&&t.weightTable[m].forEach(function(R){E.push(R.weight),v.push(R.id)}),E.length>4){s||(console.warn("THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."),s=!0);var T=[0,0,0,0],_=[0,0,0,0];E.forEach(function(R,w){var M=R,B=v[w];_.forEach(function(C,P,L){if(M>C){L[P]=M,M=C;var O=T[P];T[P]=B,B=O}})}),v=T,E=_}for(;E.length<4;)E.push(0),v.push(0);for(var S=0;S<4;++S)f.push(E[S]),d.push(v[S])}if(t.normal){var b=getData(A,r,m,t.normal);l.push(b[0],b[1],b[2])}t.material&&t.material.mappingType!=="AllSame"&&(g=getData(A,r,m,t.material)[0],g<0&&(h.negativeMaterialIndices=!0,g=0)),t.uv&&t.uv.forEach(function(R,w){var M=getData(A,r,m,R);p[w]===void 0&&(p[w]=[]),p[w].push(M[0]),p[w].push(M[1])}),o++,y&&(h.genFace(e,t,u,g,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=[],m=e.baseVertexPositions||e.vertexPositions,A=0;A<r.length;A+=3)h.push(new THREE__namespace.Vector3(m[r[A]],m[r[A+1]],m[r[A+2]]));for(var g=this.getNormalTangentAndBitangent(h),y=g.tangent,v=g.bitangent,E=[],b=0,T=h;b<T.length;b++){var _=T[b];E.push(this.flattenVertex(_,y,v))}d=THREE__namespace.ShapeUtils.triangulateShape(E,[])}else d=[[0,1,2]];for(var S=function(L,O,F){t.vertex.push(e.vertexPositions[r[L*3]]),t.vertex.push(e.vertexPositions[r[L*3+1]]),t.vertex.push(e.vertexPositions[r[L*3+2]]),t.vertex.push(e.vertexPositions[r[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[F*3]]),t.vertex.push(e.vertexPositions[r[F*3+1]]),t.vertex.push(e.vertexPositions[r[F*3+2]]),e.skeleton&&(t.vertexWeights.push(c[L*4]),t.vertexWeights.push(c[L*4+1]),t.vertexWeights.push(c[L*4+2]),t.vertexWeights.push(c[L*4+3]),t.vertexWeights.push(c[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[F*4]),t.vertexWeights.push(c[F*4+1]),t.vertexWeights.push(c[F*4+2]),t.vertexWeights.push(c[F*4+3]),t.weightsIndices.push(p[L*4]),t.weightsIndices.push(p[L*4+1]),t.weightsIndices.push(p[L*4+2]),t.weightsIndices.push(p[L*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[F*4]),t.weightsIndices.push(p[F*4+1]),t.weightsIndices.push(p[F*4+2]),t.weightsIndices.push(p[F*4+3])),e.color&&(t.colors.push(u[L*3]),t.colors.push(u[L*3+1]),t.colors.push(u[L*3+2]),t.colors.push(u[O*3]),t.colors.push(u[O*3+1]),t.colors.push(u[O*3+2]),t.colors.push(u[F*3]),t.colors.push(u[F*3+1]),t.colors.push(u[F*3+2])),e.material&&e.material.mappingType!=="AllSame"&&(t.materialIndex.push(o),t.materialIndex.push(o),t.materialIndex.push(o)),e.normal&&(t.normal.push(s[L*3]),t.normal.push(s[L*3+1]),t.normal.push(s[L*3+2]),t.normal.push(s[O*3]),t.normal.push(s[O*3+1]),t.normal.push(s[O*3+2]),t.normal.push(s[F*3]),t.normal.push(s[F*3+1]),t.normal.push(s[F*3+2])),e.uv&&e.uv.forEach(function(N,D){t.uvs[D]===void 0&&(t.uvs[D]=[]),t.uvs[D].push(l[D][L*2]),t.uvs[D].push(l[D][L*2+1]),t.uvs[D].push(l[D][O*2]),t.uvs[D].push(l[D][O*2+1]),t.uvs[D].push(l[D][F*2]),t.uvs[D].push(l[D][F*2+1])})},R=0,w=d;R<w.length;R++){var M=w[R],B=M[0],C=M[1],P=M[2];S(B,C,P)}},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 m=p[h]*3;d[m]=c[h*3],d[m+1]=c[h*3+1],d[m+2]=c[h*3+2]}var A={vertexIndices:l,vertexPositions:d,baseVertexPositions:u},g=this.genBuffers(A),y=new THREE__namespace.Float32BufferAttribute(g.vertex,3);y.name=s||r.attrName,y.applyMatrix4(o),t.morphAttributes.position.push(y)},n.prototype.parseNormals=function(t){var e=t.MappingInformationType,r=t.ReferenceInformationType,o=t.Normals.a,s=[];return r==="IndexToDirect"&&(t.NormalIndex?s=t.NormalIndex.a:t.NormalsIndex&&(s=t.NormalsIndex.a)),{dataSize:3,buffer:o,indices:s,mappingType:e,referenceType:r}},n.prototype.parseUVs=function(t){var e=t.MappingInformationType,r=t.ReferenceInformationType,o=t.UV.a,s=[];return r==="IndexToDirect"&&(s=t.UVIndex.a),{dataSize:2,buffer:o,indices:s,mappingType:e,referenceType:r}},n.prototype.parseVertexColors=function(t){var e=t.MappingInformationType,r=t.ReferenceInformationType,o=t.Colors.a,s=[];r==="IndexToDirect"&&(s=t.ColorIndex.a);for(var u=0,l=new THREE__namespace.Color;u<o.length;u+=4)l.fromArray(o,u),l.toArray(o,u);return{dataSize:4,buffer:o,indices:s,mappingType:e,referenceType:r}},n.prototype.parseMaterialIndices=function(t){var e=t.MappingInformationType,r=t.ReferenceInformationType;if(e==="NoMappingInformation")return{dataSize:1,buffer:[0],indices:[0],mappingType:"AllSame",referenceType:r};for(var o=t.Materials.a,s=[],u=0;u<o.length;++u)s.push(u);return{dataSize:1,buffer:o,indices:s,mappingType:e,referenceType:r}},n.prototype.parseNurbsGeometry=function(t){var e=parseInt(t.Order);if(isNaN(e))return console.error("THREE.FBXLoader: Invalid Order %s given for geometry ID: %s",t.Order,t.id),new THREE__namespace.BufferGeometry;for(var r=e-1,o=t.KnotVector.a,s=[],u=t.Points.a,l=0,c=u.length;l<c;l+=4)s.push(new THREE__namespace.Vector4().fromArray(u,l));var 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(m,A){if(e.has(m.ID)){var g=e.get(m.ID);if(g.curves.x!==void 0||g.curves.y!==void 0||g.curves.z!==void 0){if(f[A]===void 0){var y=r.get(m.ID).parents.filter(function(w){return w.relationship!==void 0})[0].ID;if(y!==void 0){var v=t.Objects.Model[y.toString()];if(v===void 0){console.warn("THREE.FBXLoader: Encountered a unused curve.",m);return}var E={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(w){w.ID===v.id&&(E.transform=w.matrix,w.userData.transformData&&(E.eulerOrder=w.userData.transformData.eulerOrder))}),E.transform||(E.transform=new THREE__namespace.Matrix4),v.PreRotation&&(E.preRotation=v.PreRotation.value),v.PostRotation&&(E.postRotation=v.PostRotation.value),f[A]=E}}f[A]&&(f[A][g.attr]=g)}else if(g.curves.morph!==void 0){if(f[A]===void 0){var b=r.get(m.ID).parents.filter(function(M){return M.relationship!==void 0})[0].ID,T=r.get(b).parents[0].ID,_=r.get(T).parents[0].ID,y=r.get(_).parents[0].ID,S=t.Objects.Model[y],R={modelName:S.attrName?THREE__namespace.PropertyBinding.sanitizeNodeName(S.attrName):"",morphName:t.Objects.Deformer[b].attrName};f[A]=R}f[A][g.attr]=g}}}),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,m=new THREE__namespace.Euler,A=[];if(!l||!u)return new THREE__namespace.QuaternionKeyframeTrack(t+".quaternion",[0],[0]);for(var g=0;g<l.length;g+=3){if(m.set(l[g],l[g+1],l[g+2],s),h.setFromEuler(m),h.premultiply(f),h.multiply(d),g>2){var y=new THREE__namespace.Quaternion().fromArray(A,(g-3)/3*4);y.dot(h)<0&&h.set(-h.x,-h.y,-h.z,-h.w)}h.toArray(A,g/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 m=Math.max.apply(Math,h),A=m/180,g=new THREE__namespace.Euler(p[0],p[1],p[2],o),y=new THREE__namespace.Euler(p[0],p[1],p[2],o),v=new THREE__namespace.Quaternion().setFromEuler(g),E=new THREE__namespace.Quaternion().setFromEuler(y);v.dot(E)&&E.set(-E.x,-E.y,-E.z,-E.w);for(var b=t.times[l-1],T=t.times[l]-b,_=new THREE__namespace.Quaternion,S=new THREE__namespace.Euler,R=0;R<1;R+=1/A)_.copy(v.clone().slerp(E.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 m=this.parseNode(t,e);m!==null&&this.parseSubNode(l,r,m)}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,m){m!==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,m=n.inheritType?n.inheritType:0;n.translation&&t.setPosition(tempVec.fromArray(n.translation));var A=getEulerOrder(0);if(n.preRotation){var g=n.preRotation.map(THREE__namespace.MathUtils.degToRad);g.push(A),e.makeRotationFromEuler(tempEuler.fromArray(g))}if(n.rotation){var g=n.rotation.map(THREE__namespace.MathUtils.degToRad);g.push(n.eulerOrder||A),r.makeRotationFromEuler(tempEuler.fromArray(g))}if(n.postRotation){var g=n.postRotation.map(THREE__namespace.MathUtils.degToRad);g.push(A),o.makeRotationFromEuler(tempEuler.fromArray(g)),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 y=e.clone().multiply(r).multiply(o),v=new THREE__namespace.Matrix4;v.extractRotation(f);var E=new THREE__namespace.Matrix4;E.copyPosition(f);var b=new THREE__namespace.Matrix4().getInverse(E).multiply(f),T=new THREE__namespace.Matrix4().getInverse(v).multiply(b),_=s,S=new THREE__namespace.Matrix4;if(m===0)S.copy(v).multiply(y).multiply(T).multiply(_);else if(m===1)S.copy(v).multiply(T).multiply(y).multiply(_);else{var R=new THREE__namespace.Matrix4().scale(new THREE__namespace.Vector3().setFromMatrixScale(d)),w=new THREE__namespace.Matrix4().getInverse(R),M=T.clone().multiply(w);S.copy(v).multiply(y).multiply(M).multiply(_)}var B=new THREE__namespace.Matrix4().getInverse(p),C=new THREE__namespace.Matrix4().getInverse(u),P=t.clone().multiply(c).multiply(p).multiply(e).multiply(r).multiply(o).multiply(B).multiply(l).multiply(u).multiply(s).multiply(C),L=new THREE__namespace.Matrix4().copyPosition(P),O=f.clone().multiply(L);return h.copyPosition(O),P=h.clone().multiply(S),P.premultiply(new THREE__namespace.Matrix4().getInverse(f)),P}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,m=0;m<d;++m){var A=f[m+1],g=p[d-m];c[d][m]=A+g;var y=c[m][d-1]/c[d][m];c[m][d]=h+A*y,h=g*y}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 E=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-_,w=e-_;v>=_&&(T[b][0]=T[E][0]/c[w+1][R],S=T[b][0]*c[R][w]);for(var M=R>=-1?1:-R,B=v-1<=w?_-1:e-v,C=M;C<=B;++C)T[b][C]=(T[E][C]-T[E][C-1])/c[w+1][R+C],S+=T[b][C]*c[R+C][w];v<=w&&(T[b][_]=-T[E][_-1]/c[w+1][v],S+=T[b][_]*c[v][w]),l[_][v]=S;var d=E;E=b,b=d}}for(var P=e,_=1;_<=r;++_){for(var d=0;d<=e;++d)l[_][d]*=P;P*=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 m=0;m<=s;++m){for(var d=p[l-n].clone().multiplyScalar(c[m][0]),A=1;A<=n;++A)d.add(p[l-n+A].clone().multiplyScalar(c[m][A]));u[m]=d}for(var m=s+1;m<=o+1;++m)u[m]=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:internalFetcher,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:""})}).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,m,A,g,y,v,E,b,T,_,S,R,w,M,B,C,P,L,O,F,N,D,U,z,G,j,Q,V,J,W,X,Z,Y,K,ee,te,re,ae,ce,ie,fe,ge,ye,_e,le=unzipSync(n),de="",ne=null,se=0,he=Object.keys(le);se<he.length;se++){var me=he[se];/(^|\/)main\.xml$/i.test(me)&&(ne=le[me],de=me.slice(0,me.lastIndexOf("/")+1))}if(!ne)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),qe=new DOMParser,Ye=decodeText(ne),Ve=qe.parseFromString(Ye,"text/xml"),ve=Ve.querySelector("Record1 Axes"),Ke={x:{type:(s=(o=(r=ve==null?void 0:ve.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=ve==null?void 0:ve.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=ve==null?void 0:ve.querySelector("CX Increment"))===null||p===void 0?void 0:p.textContent)!==null&&f!==void 0?f:"1"),offset:Number((h=(d=ve==null?void 0:ve.querySelector("CX Offset"))===null||d===void 0?void 0:d.textContent)!==null&&h!==void 0?h:"0")},y:{type:(g=(A=(m=ve==null?void 0:ve.querySelector("CY AxisType"))===null||m===void 0?void 0:m.textContent)===null||A===void 0?void 0:A.toUpperCase())!==null&&g!==void 0?g:"I",dataType:(E=(v=(y=ve==null?void 0:ve.querySelector("CY DataType"))===null||y===void 0?void 0:y.textContent)===null||v===void 0?void 0:v.toUpperCase())!==null&&E!==void 0?E:"D",increment:Number((T=(b=ve==null?void 0:ve.querySelector("CY Increment"))===null||b===void 0?void 0:b.textContent)!==null&&T!==void 0?T:"1"),offset:Number((S=(_=ve==null?void 0:ve.querySelector("CY Offset"))===null||_===void 0?void 0:_.textContent)!==null&&S!==void 0?S:"0")},z:{type:(M=(w=(R=ve==null?void 0:ve.querySelector("CZ AxisType"))===null||R===void 0?void 0:R.textContent)===null||w===void 0?void 0:w.toUpperCase())!==null&&M!==void 0?M:"A",dataType:(P=(C=(B=ve==null?void 0:ve.querySelector("CZ DataType"))===null||B===void 0?void 0:B.textContent)===null||C===void 0?void 0:C.toUpperCase())!==null&&P!==void 0?P:"D",increment:Number((O=(L=ve==null?void 0:ve.querySelector("CZ Increment"))===null||L===void 0?void 0:L.textContent)!==null&&O!==void 0?O:"1"),offset:Number((N=(F=ve==null?void 0:ve.querySelector("CZ Offset"))===null||F===void 0?void 0:F.textContent)!==null&&N!==void 0?N:"0")}},Te=null,Le=Ve.querySelector("Record1 Axes Rotation");Le&&(Te=new THREE__namespace.Matrix3,Te.set(Number((U=(D=Le.querySelector("r11"))===null||D===void 0?void 0:D.textContent)!==null&&U!==void 0?U:0),Number((G=(z=Le.querySelector("r12"))===null||z===void 0?void 0:z.textContent)!==null&&G!==void 0?G:0),Number((Q=(j=Le.querySelector("r13"))===null||j===void 0?void 0:j.textContent)!==null&&Q!==void 0?Q:0),Number((J=(V=Le.querySelector("r21"))===null||V===void 0?void 0:V.textContent)!==null&&J!==void 0?J:0),Number((X=(W=Le.querySelector("r22"))===null||W===void 0?void 0:W.textContent)!==null&&X!==void 0?X:0),Number((Y=(Z=Le.querySelector("r23"))===null||Z===void 0?void 0:Z.textContent)!==null&&Y!==void 0?Y:0),Number((ee=(K=Le.querySelector("r31"))===null||K===void 0?void 0:K.textContent)!==null&&ee!==void 0?ee:0),Number((re=(te=Le.querySelector("r32"))===null||te===void 0?void 0:te.textContent)!==null&&re!==void 0?re:0),Number((ce=(ae=Le.querySelector("r33"))===null||ae===void 0?void 0:ae.textContent)!==null&&ce!==void 0?ce:0)));var Me=(ie=Ve.querySelector("Record3 DataLink PointDataLink"))===null||ie===void 0?void 0:ie.textContent;if(typeof Me!="string")throw new Error("X3p: PointDataLink not found.");Me=pathJoin(de,Me);var $e=le[Me];if(!$e)throw new Error("X3p: ".concat($e," not found."));for(var tt=getPointArray($e.buffer,Ke.z.dataType),ke=Number((ge=(fe=Ve.querySelector("Record3 MatrixDimension SizeX"))===null||fe===void 0?void 0:fe.textContent)!==null&&ge!==void 0?ge:"0"),Ie=Number((_e=(ye=Ve.querySelector("Record3 MatrixDimension SizeY"))===null||ye===void 0?void 0:ye.textContent)!==null&&_e!==void 0?_e:"0"),He=Math.floor(ke-1),Ee=Math.floor(Ie-1),we=He+1,Pe=Ee+1,je=new Float32Array(we*Pe*3),Qe=new Float32Array(we*Pe*2),We=new Uint32Array(He*Ee*6),gt=new THREE__namespace.Box3,Je=0;Je<Pe;Je++)for(var At=Je*Ke.y.increment+Ke.y.offset,Re=0;Re<we;Re++){var Ue=Je*we+Re,yt=Re*Ke.x.increment+Ke.x.offset,Ct=tt[Ue],Et=!isNaN(Ct),dt=Et?Ct:NaN;_vector.set(yt,-At,dt),Te&&_vector.applyMatrix3(Te),Et&&gt.expandByPoint(_vector),je[Ue*3+0]=_vector.x,je[Ue*3+1]=_vector.y,je[Ue*3+2]=_vector.z,Qe[Ue*2+0]=Re/He,Qe[Ue*2+1]=1-Je/Ee}for(var Je=0;Je<Ee;Je++)for(var Re=0;Re<He;Re++){var ht=Re+we*Je,ze=Re+we*(Je+1),ut=Re+1+we*(Je+1),rt=Re+1+we*Je,ue=(Je*He+Re)*6;We[ue+0]=ht,We[ue+1]=ze,We[ue+2]=rt,We[ue+3]=ze,We[ue+4]=ut,We[ue+5]=rt}var Ae=new THREE__namespace.BufferGeometry;Ae.setAttribute("position",new THREE__namespace.BufferAttribute(je,3)),Ae.setAttribute("uv",new THREE__namespace.BufferAttribute(Qe,2)),Ae.setIndex(new THREE__namespace.BufferAttribute(We,1)),(!Ae.groups||Ae.groups.length===0)&&Ae.addGroup(0,Ae.index?Ae.index.count:Ae.attributes.position.count,0),Ae.boundingBox=gt;var Ce=new PBMMeshMaterial(t.light?"phong":"basic");Ce.flatShading=!0,Ce.color.copy(Ne);var Be=new PBMMesh(Ae,[Ce]);return{object:Be,dispose:function(){Ae.dispose(),Ce.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$1=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)!==0){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),m=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,m,A);var g=this.halfSize.toArray().reduce(function(y,v){return y+v},0);return(isNaN(g)||g<=0)&&this.halfSize.setScalar(EPSILON$2),this.rotation.fromArray([r/h,o/h,s/h,u/m,l/m,c/m,p/A,f/A,d/A]),isNaN(this.rotation.toArray().reduce(function(y,v){return y+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(24);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,r){if(e===void 0&&(e=0),scratchSize.copy(this.halfSize).multiplyScalar(2),scratchBox3$1.setFromCenterAndSize(scratchVector.set(0,0,0),scratchSize),scratchBox3$1.expandByScalar(e),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$1.containsPoint(scratchRay$1.origin))return!0;var o=scratchRay$1.intersectBox(scratchBox3$1,scratchVector);return o?r!==void 0?(r+=e,o.distanceToSquared(scratchRay$1.origin)<=r*r):!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,r){if(e===void 0&&(e=0),scratchSphere$2.set(this.center,this.radius+e),scratchSphere$2.containsPoint(t.origin))return!0;var o=t.intersectSphere(scratchSphere$2,scratchVector);return o?r!==void 0?(r+=e,t.origin.distanceToSquared(o)<=r*r):!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,e,r){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(24);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$a=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$a).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,m=u/h;return m}else{var A=Math.max(e,.001),h=A*c/l,m=u/h;return m}},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})(),defaultIterator=function(n){return Number(n)};function arrayMin(n,t,e){var r;t===void 0&&(t=defaultIterator),e===void 0&&(e=!1);for(var o,s=1/0,u=0,l=n;u<l.length;u++){var c=l[u],p=t(c);p<=s&&(r=[c,p],o=r[0],s=r[1])}return isFinite(s)||(s=0),e?[o,s]:o}var arrayMinCallback=function(n){return n.distance},intersectDistanceSortCallback=function(n,t){return n.distance-t.distance};function sortIntersects(n,t,e){if(t===void 0&&(t=!0),e===void 0&&(e=!1),e&&n.length>1){var r=arrayMin(n,arrayMinCallback);r?(n[0]=r,n.length=1):n.length=0}return t&&n.length>1&&n.sort(intersectDistanceSortCallback),n}var 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 m=c.array,A=(s=c.stride)!==null&&s!==void 0?s:3,g=(u=c.offset)!==null&&u!==void 0?u:0;return p=p*A+g,e.x=m[p],e.y=m[p+1],e.z=m[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,s){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=36;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){r===void 0&&(r=0);var o=e.min.x-r,s=e.min.y-r,u=e.min.z-r,l=e.max.x+r,c=e.max.y+r,p=e.max.z+r,f=0,d=0,h=0,m=0,A=0,g=0;return t.x>=0?(f=(o-n.x)*t.x,d=(l-n.x)*t.x):(f=(l-n.x)*t.x,d=(o-n.x)*t.x),t.y>=0?(h=(s-n.y)*t.y,m=(c-n.y)*t.y):(h=(c-n.y)*t.y,m=(s-n.y)*t.y),f>m||h>d||((h>f||f!==f)&&(f=h),(m<d||d!==d)&&(d=m),t.z>=0?(A=(u-n.z)*t.z,g=(p-n.z)*t.z):(A=(p-n.z)*t.z,g=(u-n.z)*t.z),f>g||A>d)||((A>f||f!==f)&&(f=A),(g<d||d!==d)&&(d=g),d<0)?null:f>=0?f:d}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,o,s){this.pointA=t,this.pointB=e,this.pointC=r,this.index=o,this.intersectionPoint=s}return n})(),BVHBox3=(function(){function n(t,e){this.min=t,this.max=e}return n})(),EPSILON$1=1e-6,scratchVector3$9=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;d<s;d+=1){var h=d*3,m=d*6,A=void 0,g=void 0,y=void 0,v=void 0,E=void 0,b=void 0,T=void 0;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),g=E=scratchVector3A.y,T=scratchVector3B.y,T<g&&(g=T),T>E&&(E=T),T=scratchVector3C.y,T<g&&(g=T),T>E&&(E=T),y=b=scratchVector3A.z,T=scratchVector3B.z,T<y&&(y=T),T>b&&(b=T),T=scratchVector3C.z,T<y&&(y=T),T>b&&(b=T),l[m]=A,l[m+1]=g,l[m+2]=y,l[m+3]=v,l[m+4]=E,l[m+5]=b}else{for(var _=1/0,S=1/0,R=1/0,w=-1/0,M=-1/0,B=-1/0,d=0;d<s;d+=1){var h=d*3,m=d*6,A=void 0,g=void 0,y=void 0,v=void 0,E=void 0,b=void 0,T=void 0;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),g=E=scratchVector3A.y,T=scratchVector3B.y,T<g&&(g=T),T>E&&(E=T),T=scratchVector3C.y,T<g&&(g=T),T>E&&(E=T),y=b=scratchVector3A.z,T=scratchVector3B.z,T<y&&(y=T),T>b&&(b=T),T=scratchVector3C.z,T<y&&(y=T),T>b&&(b=T),l[m]=A,l[m+1]=g,l[m+2]=y,l[m+3]=v,l[m+4]=E,l[m+5]=b,A<_&&(_=A),v>w&&(w=v),g<S&&(S=g),E>M&&(M=E),y<R&&(R=y),b>B&&(B=b)}o=[_,S,R,w,M,B]}var C=new BVHNode(++f,o,0,s,0);c[p++]=C;var P=[],L=[0,1,2],O=function(N,D){return P[D]-P[N]};function F(N){var D=N.startIndex,U=N.endIndex,z=N.extents;P[0]=z[3]-z[0],P[1]=z[4]-z[1],P[2]=z[5]-z[2],L.sort(O);for(var G=0;G<3;G++){for(var j=L[G],Q=z[j]+z[j+3],V=D,J=U-1,W=-1,X=void 0;V<=J;)W===-1?(X=u[V],l[X*6+j]+l[X*6+j+3]<Q?V++:W=X):(X=u[J],l[X*6+j]+l[X*6+j+3]>=Q||(u[V]=X,u[J]=W,W=-1,V++),J--);if(V>D&&V<U){var Z=new BVHNode(++f,calcExtents(u,l,D,V,EPSILON$1),D,V,N.deepth+1);Z.deepth<r&&Z.endIndex-Z.startIndex>e&&(c[p++]=Z);var Y=new BVHNode(++f,calcExtents(u,l,V,U,EPSILON$1),V,U,N.deepth+1);Y.deepth<r&&Y.endIndex-Y.startIndex>e&&(c[p++]=Y),N.node0=Z,N.node1=Y,N.startIndex=0,N.endIndex=0;break}}}for(;p;)F(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;(d=p.pop())!==void 0;){var h=d*BYTES_PER_NODE/4,m=clamp(e.x,u[h],u[h+3])-e.x,A=clamp(e.y,u[h+1],u[h+4])-e.y,g=clamp(e.z,u[h+2],u[h+5])-e.z;if(m*m+A*A+g*g<=r*r){for(var y=l[h+6],v=l[h+7],E=y;E<v;E++){var b=o[E];f.push(b)}var T=d*BYTES_PER_NODE/2,_=c[T+16],S=c[T+17];_&&p.push(_),S&&p.push(S)}}for(var R=f.length,w=new Float32Array(R*9),E=0;E<R;E++){var b=f[E],M=b*3;this.getPositionByIndex(M,scratchVector3$9),w[E*9]=scratchVector3$9.x,w[E*9+1]=scratchVector3$9.y,w[E*9+2]=scratchVector3$9.z,this.getPositionByIndex(M+1,scratchVector3$9),w[E*9+3]=scratchVector3$9.x,w[E*9+4]=scratchVector3$9.y,w[E*9+5]=scratchVector3$9.z,this.getPositionByIndex(M+2,scratchVector3$9),w[E*9+6]=scratchVector3$9.x,w[E*9+7]=scratchVector3$9.y,w[E*9+8]=scratchVector3$9.z}return w},t.prototype.intersectRay=function(e,r,o,s,u){o===void 0&&(o=0),s===void 0&&(s=!1);for(var l=[],c=this.offsetArray,p=this.rootNodePacked,f=new Float32Array(p),d=new Uint32Array(p),h=new Uint16Array(p),m=new BVHVector3(1/r.x,1/r.y,1/r.z),A=[0],g,y=new BVHBox3(new BVHVector3(0,0,0),new BVHVector3(0,0,0)),v=1/0;(g=A.pop())!==void 0;){var E=g*BYTES_PER_NODE/4;y.min.x=f[E],y.min.y=f[E+1],y.min.z=f[E+2],y.max.x=f[E+3],y.max.y=f[E+4],y.max.z=f[E+5];var b=intersectNodeBox(e,m,y,o);if(b!==null&&!(s&&b>v)){for(var T=e.x,_=e.y,S=e.z,R=r.x,w=r.y,M=r.z,B=d[E+6],C=d[E+7],P=B;P<C;P++){var L=c[P],O=L*3,F=new BVHVector3(0,0,0);this.getPositionByIndex(O,F);var N=F.x,D=F.y,U=F.z,z=new BVHVector3(0,0,0);this.getPositionByIndex(O+1,z);var G=z.x,j=z.y,Q=z.z,V=new BVHVector3(0,0,0);this.getPositionByIndex(O+2,V);var J=V.x,W=V.y,X=V.z,Z=G-N,Y=j-D,K=Q-U,ee=J-N,te=W-D,re=X-U,ae=Y*re-K*te,ce=K*ee-Z*re,ie=Z*te-Y*ee,fe=R*ae+w*ce+M*ie,ge=void 0;if(fe>0)ge=1;else if(fe<0)ge=-1,fe=-fe;else continue;var ye=T-N,_e=_-D,le=S-U,de=ge*(R*(_e*re-le*te)+w*(le*ee-ye*re)+M*(ye*te-_e*ee));if(!(de<0)){var ne=ge*(R*(Y*le-K*_e)+w*(K*ye-Z*le)+M*(Z*_e-Y*ye));if(!(ne<0)&&!(de+ne>fe)){var se=-ge*(ye*ae+_e*ce+le*ie);if(!(se<0)){var he=se/fe,me=new BVHVector3(T+R*he,_+w*he,S+M*he),Ne=new BVHIntersect(F,z,V,L,me);(!u||u(Ne))&&(s?he<v&&(v=he,l.length>0&&(l.length=0),l.push(Ne)):l.push(Ne))}}}}var qe=g*BYTES_PER_NODE/2,Ye=h[qe+16],Ve=h[qe+17];Ye&&A.push(Ye),Ve&&A.push(Ve)}}return l},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;d<r;d++){var h=n[d]*6,m=t[h];m<s&&(s=m),m=t[h+1],m<u&&(u=m),m=t[h+2],m<l&&(l=m),m=t[h+3],m>c&&(c=m),m=t[h+4],m>p&&(p=m),m=t[h+5],m>f&&(f=m)}return[s-o,u-o,l-o,c+o,p+o,f+o]}var EPSILON=1e-6,ORDER_AXISES=["x","y","z"],scratchVector3$8=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$8);for(var h=scratchVector3$8.x,m=scratchVector3$8.y,A=scratchVector3$8.z,g=h,y=m,v=A,d=0;d<u;d+=1){l[d]=d,s(d,scratchVector3$8);var E=scratchVector3$8.x,b=scratchVector3$8.y,T=scratchVector3$8.z;E<h?h=E:E>g&&(g=E),b<m?m=b:b>y&&(y=b),T<A?A=T:T>v&&(v=T)}o=[h,m,A,g,y,v]}var _=new BVHNode(++f,o,0,u,0);c[p++]=_;var S=[],R=[0,1,2],w=function(B,C){return S[C]-S[B]};function M(B){var C=B.startIndex,P=B.endIndex,L=B.extents;S[0]=L[3]-L[0],S[1]=L[4]-L[1],S[2]=L[5]-L[2];for(var O=R.sort(w)[0],F=ORDER_AXISES[O],N=(L[O]+L[O+3])/2,D=C,U=P-1,z=-1,G;D<=U;)z===-1?(G=l[D],s(G,scratchVector3$8),scratchVector3$8[F]<N?D++:z=G):(G=l[U],s(G,scratchVector3$8),scratchVector3$8[F]>=N||(l[D]=G,l[U]=z,z=-1,D++),U--);if(D>C){var j=L.slice();j[O+3]=N+EPSILON;var Q=new BVHNode(++f,j,C,D,B.deepth+1);Q.deepth<r&&Q.endIndex-Q.startIndex>e&&(c[p++]=Q),B.node0=Q}if(P>D){var V=L.slice();V[O]=N-EPSILON;var J=new BVHNode(++f,V,D,P,B.deepth+1);J.deepth<r&&J.endIndex-J.startIndex>e&&(c[p++]=J),B.node1=J}B.startIndex=0,B.endIndex=0}for(;p;)M(c[--p]);return this.offsetArray=l,this.rootNodePacked=packBVHNode(_,f+1),c.length=0,this},t.prototype.intersectRay=function(e,r,o,s,u){o===void 0&&(o=0),s===void 0&&(s=!1);for(var l=[],c=this.offsetArray,p=this.rootNodePacked,f=new Float32Array(p),d=new Uint32Array(p),h=new Uint16Array(p),m=o*o,A=new BVHVector3(1/r.x,1/r.y,1/r.z),g=[0],y,v=new BVHBox3(new BVHVector3(0,0,0),new BVHVector3(0,0,0)),E=1/0;(y=g.pop())!==void 0;){var b=y*BYTES_PER_NODE/4;v.min.x=f[b],v.min.y=f[b+1],v.min.z=f[b+2],v.max.x=f[b+3],v.max.y=f[b+4],v.max.z=f[b+5];var T=intersectNodeBox(e,A,v,o);if(T!==null&&!(s&&T>E)){for(var _=d[b+6],S=d[b+7],R=_;R<S;R++){var w=c[R],M=new BVHVector3(0,0,0);this.getPositionByIndex(w,M);var B=M.x,C=M.y,P=M.z,L=e.x,O=e.y,F=e.z,N=r.x,D=r.y,U=r.z,z=N*(B-L)+D*(C-O)+U*(P-F);if(z>0?(L+=N*z,O+=D*z,F+=U*z):z<0&&(z=0),N=B-L,D=C-O,U=P-F,N*N+D*D+U*U<=m){var G=new BVHVector3(L,O,F),j=new BVHIntersect(M,M,M,w,G);(!u||u(j))&&(s?z<E&&(E=z,l.length>0&&(l.length=0),l.push(j)):l.push(j))}}var Q=y*BYTES_PER_NODE/2,V=h[Q+16],J=h[Q+17];V&&g.push(V),J&&g.push(J)}}return l},t})(BVHObject);const jsContent=`(function(){"use strict";var ur=function(o,r){return ur=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},ur(o,r)};function yr(o,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");ur(o,r);function t(){this.constructor=o}o.prototype=r===null?Object.create(r):(t.prototype=r.prototype,new t)}typeof SuppressedError=="function"&&SuppressedError;var cr=(function(){function o(r,t){this.position=r,this.indices=t}return o.prototype.getPositionCount=function(){var r,t,n=this.indices,e=this.position;return n?n.array.length/((r=n.stride)!==null&&r!==void 0?r:1):e.array.length/((t=e.stride)!==null&&t!==void 0?t:3)},o.prototype.getPositionByIndex=function(r,t){var n,e,h,v,i=this.indices,f=this.position,l=r;if(i){var y=i.array,s=(n=i.stride)!==null&&n!==void 0?n:1,d=(e=i.offset)!==null&&e!==void 0?e:0;l=y[r*s+d]}var u=f.array,x=(h=f.stride)!==null&&h!==void 0?h:3,w=(v=f.offset)!==null&&v!==void 0?v:0;return l=l*x+w,t.x=u[l],t.y=u[l+1],t.z=u[l+2],t},o.prototype.createTree=function(r,t,n){throw new Error("not implemented")},o.prototype.trianglesInSphere=function(r,t){throw new Error("not implemented")},o.prototype.intersectRay=function(r,t,n,e,h){throw new Error("not implemented")},o})(),D=(function(){function o(r,t,n,e,h){this.id=r,this.extents=t,this.startIndex=n,this.endIndex=e,this.deepth=h}return o})(),X=36;function lr(o,r){for(var t=new ArrayBuffer(r*X),n=new Float32Array(t),e=new Uint32Array(t),h=new Uint16Array(t),v=[o],i,f;i=v.pop();)f=i.id*X/4,n[f]=i.extents[0],n[f+1]=i.extents[1],n[f+2]=i.extents[2],n[f+3]=i.extents[3],n[f+4]=i.extents[4],n[f+5]=i.extents[5],e[f+6]=i.startIndex,e[f+7]=i.endIndex,f=i.id*X/2,i.node0&&(h[f+16]=i.node0.id,v.push(i.node0)),i.node1&&(h[f+17]=i.node1.id,v.push(i.node1));return t}function dr(o,r,t,n){n===void 0&&(n=0);var e=t.min.x-n,h=t.min.y-n,v=t.min.z-n,i=t.max.x+n,f=t.max.y+n,l=t.max.z+n,y=0,s=0,d=0,u=0,x=0,w=0;return r.x>=0?(y=(e-o.x)*r.x,s=(i-o.x)*r.x):(y=(i-o.x)*r.x,s=(e-o.x)*r.x),r.y>=0?(d=(h-o.y)*r.y,u=(f-o.y)*r.y):(d=(f-o.y)*r.y,u=(h-o.y)*r.y),y>u||d>s||((d>y||y!==y)&&(y=d),(u<s||s!==s)&&(s=u),r.z>=0?(x=(v-o.z)*r.z,w=(l-o.z)*r.z):(x=(l-o.z)*r.z,w=(v-o.z)*r.z),y>w||x>s)||((x>y||y!==y)&&(y=x),(w<s||s!==s)&&(s=w),s<0)?null:y>=0?y:s}var H=(function(){function o(r,t,n){this.x=r,this.y=t,this.z=n}return o.prototype.copy=function(r){return this.x=r.x,this.y=r.y,this.z=r.z,this},o.prototype.set=function(r,t,n){return this.x=r,this.y=t,this.z=n,this},o.prototype.fromArray=function(r,t){return t===void 0&&(t=0),this.x=r[t],this.y=r[t+1],this.z=r[t+2],this},o.prototype.toArray=function(r,t){return r===void 0&&(r=[]),t===void 0&&(t=0),r[t]=this.x,r[t+1]=this.y,r[t+2]=this.z,r},o.prototype.add=function(r){return this.x+=r.x,this.y+=r.y,this.z+=r.z,this},o.prototype.multiplyScalar=function(r){return this.x*=r,this.y*=r,this.z*=r,this},o.prototype.subVectors=function(r,t){return this.x=r.x-t.x,this.y=r.y-t.y,this.z=r.z-t.z,this},o.prototype.addScaledVector=function(r,t){return this.x+=r.x*t,this.y+=r.y*t,this.z+=r.z*t,this},o.prototype.dot=function(r){return this.x*r.x+this.y*r.y+this.z*r.z},o.prototype.cross=function(r){var t=this.x,n=this.y,e=this.z;return this.x=n*r.z-e*r.y,this.y=e*r.x-t*r.z,this.z=t*r.y-n*r.x,this},o.prototype.crossVectors=function(r,t){var n=r.x,e=r.y,h=r.z,v=t.x,i=t.y,f=t.z;return this.x=e*f-h*i,this.y=h*v-n*f,this.z=n*i-e*v,this},o.prototype.distanceTo=function(r){return Math.sqrt(this.distanceToSquared(r))},o.prototype.distanceToSquared=function(r){var t=this.x-r.x,n=this.y-r.y,e=this.z-r.z;return t*t+n*n+e*e},o.prototype.clone=function(){return new o(this.x,this.y,this.z)},o})(),wr=(function(){function o(r,t,n,e,h){this.pointA=r,this.pointB=t,this.pointC=n,this.index=e,this.intersectionPoint=h}return o})(),xr=(function(){function o(r,t){this.min=r,this.max=t}return o})(),pr=1e-6,J=new H(0,0,0),Y=new H(0,0,0),g=new H(0,0,0),Z=new H(0,0,0),Hr=(function(o){yr(r,o);function r(){return o!==null&&o.apply(this,arguments)||this}return r.prototype.createTree=function(t,n,e){n=Math.min(n,16);var h=this.getPositionCount()/3,v=h>65535?new Uint32Array(h):new Uint16Array(h),i=new Float32Array(h*6),f=[],l=0,y=-1;if(e)for(var s=0;s<h;s+=1){var d=s*3,u=s*6,x=void 0,w=void 0,z=void 0,I=void 0,c=void 0,p=void 0,a=void 0;v[s]=s,this.getPositionByIndex(d,Y),this.getPositionByIndex(d+1,g),this.getPositionByIndex(d+2,Z),x=I=Y.x,a=g.x,a<x&&(x=a),a>I&&(I=a),a=Z.x,a<x&&(x=a),a>I&&(I=a),w=c=Y.y,a=g.y,a<w&&(w=a),a>c&&(c=a),a=Z.y,a<w&&(w=a),a>c&&(c=a),z=p=Y.z,a=g.z,a<z&&(z=a),a>p&&(p=a),a=Z.z,a<z&&(z=a),a>p&&(p=a),i[u]=x,i[u+1]=w,i[u+2]=z,i[u+3]=I,i[u+4]=c,i[u+5]=p}else{for(var F=1/0,k=1/0,E=1/0,S=-1/0,V=-1/0,U=-1/0,s=0;s<h;s+=1){var d=s*3,u=s*6,x=void 0,w=void 0,z=void 0,I=void 0,c=void 0,p=void 0,a=void 0;v[s]=s,this.getPositionByIndex(d,Y),this.getPositionByIndex(d+1,g),this.getPositionByIndex(d+2,Z),x=I=Y.x,a=g.x,a<x&&(x=a),a>I&&(I=a),a=Z.x,a<x&&(x=a),a>I&&(I=a),w=c=Y.y,a=g.y,a<w&&(w=a),a>c&&(c=a),a=Z.y,a<w&&(w=a),a>c&&(c=a),z=p=Y.z,a=g.z,a<z&&(z=a),a>p&&(p=a),a=Z.z,a<z&&(z=a),a>p&&(p=a),i[u]=x,i[u+1]=w,i[u+2]=z,i[u+3]=I,i[u+4]=c,i[u+5]=p,x<F&&(F=x),I>S&&(S=I),w<k&&(k=w),c>V&&(V=c),z<E&&(E=z),p>U&&(U=p)}e=[F,k,E,S,V,U]}var W=new D(++y,e,0,h,0);f[l++]=W;var M=[],T=[0,1,2],j=function(P,B){return M[B]-M[P]};function q(P){var B=P.startIndex,_=P.endIndex,A=P.extents;M[0]=A[3]-A[0],M[1]=A[4]-A[1],M[2]=A[5]-A[2],T.sort(j);for(var $=0;$<3;$++){for(var C=T[$],G=A[C]+A[C+3],N=B,L=_-1,O=-1,Q=void 0;N<=L;)O===-1?(Q=v[N],i[Q*6+C]+i[Q*6+C+3]<G?N++:O=Q):(Q=v[L],i[Q*6+C]+i[Q*6+C+3]>=G||(v[N]=Q,v[L]=O,O=-1,N++),L--);if(N>B&&N<_){var R=new D(++y,zr(v,i,B,N,pr),B,N,P.deepth+1);R.deepth<n&&R.endIndex-R.startIndex>t&&(f[l++]=R);var b=new D(++y,zr(v,i,N,_,pr),N,_,P.deepth+1);b.deepth<n&&b.endIndex-b.startIndex>t&&(f[l++]=b),P.node0=R,P.node1=b,P.startIndex=0,P.endIndex=0;break}}}for(;l;)q(f[--l]);return this.offsetArray=v,this.rootNodePacked=lr(W,y+1),f.length=0,this},r.prototype.trianglesInSphere=function(t,n){for(var e=this.offsetArray,h=this.rootNodePacked,v=new Float32Array(h),i=new Uint32Array(h),f=new Uint16Array(h),l=[0],y=[],s;(s=l.pop())!==void 0;){var d=s*X/4,u=fr(t.x,v[d],v[d+3])-t.x,x=fr(t.y,v[d+1],v[d+4])-t.y,w=fr(t.z,v[d+2],v[d+5])-t.z;if(u*u+x*x+w*w<=n*n){for(var z=i[d+6],I=i[d+7],c=z;c<I;c++){var p=e[c];y.push(p)}var a=s*X/2,F=f[a+16],k=f[a+17];F&&l.push(F),k&&l.push(k)}}for(var E=y.length,S=new Float32Array(E*9),c=0;c<E;c++){var p=y[c],V=p*3;this.getPositionByIndex(V,J),S[c*9]=J.x,S[c*9+1]=J.y,S[c*9+2]=J.z,this.getPositionByIndex(V+1,J),S[c*9+3]=J.x,S[c*9+4]=J.y,S[c*9+5]=J.z,this.getPositionByIndex(V+2,J),S[c*9+6]=J.x,S[c*9+7]=J.y,S[c*9+8]=J.z}return S},r.prototype.intersectRay=function(t,n,e,h,v){e===void 0&&(e=0),h===void 0&&(h=!1);for(var i=[],f=this.offsetArray,l=this.rootNodePacked,y=new Float32Array(l),s=new Uint32Array(l),d=new Uint16Array(l),u=new H(1/n.x,1/n.y,1/n.z),x=[0],w,z=new xr(new H(0,0,0),new H(0,0,0)),I=1/0;(w=x.pop())!==void 0;){var c=w*X/4;z.min.x=y[c],z.min.y=y[c+1],z.min.z=y[c+2],z.max.x=y[c+3],z.max.y=y[c+4],z.max.z=y[c+5];var p=dr(t,u,z,e);if(p!==null&&!(h&&p>I)){for(var a=t.x,F=t.y,k=t.z,E=n.x,S=n.y,V=n.z,U=s[c+6],W=s[c+7],M=U;M<W;M++){var T=f[M],j=T*3,q=new H(0,0,0);this.getPositionByIndex(j,q);var P=q.x,B=q.y,_=q.z,A=new H(0,0,0);this.getPositionByIndex(j+1,A);var $=A.x,C=A.y,G=A.z,N=new H(0,0,0);this.getPositionByIndex(j+2,N);var L=N.x,O=N.y,Q=N.z,R=$-P,b=C-B,or=G-_,er=L-P,vr=O-B,sr=Q-_,Ar=b*sr-or*vr,Pr=or*er-R*sr,Br=R*vr-b*er,m=E*Ar+S*Pr+V*Br,rr=void 0;if(m>0)rr=1;else if(m<0)rr=-1,m=-m;else continue;var tr=a-P,nr=F-B,ir=k-_,Sr=rr*(E*(nr*sr-ir*vr)+S*(ir*er-tr*sr)+V*(tr*vr-nr*er));if(!(Sr<0)){var Nr=rr*(E*(b*ir-or*nr)+S*(or*tr-R*ir)+V*(R*nr-b*tr));if(!(Nr<0)&&!(Sr+Nr>m)){var Vr=-rr*(tr*Ar+nr*Pr+ir*Br);if(!(Vr<0)){var ar=Vr/m,jr=new H(a+E*ar,F+S*ar,k+V*ar),hr=new wr(q,A,N,T,jr);(!v||v(hr))&&(h?ar<I&&(I=ar,i.length>0&&(i.length=0),i.push(hr)):i.push(hr))}}}}var Tr=w*X/2,Ur=d[Tr+16],_r=d[Tr+17];Ur&&x.push(Ur),_r&&x.push(_r)}}return i},r})(cr);function fr(o,r,t){return o<r?r:o>t?t:o}function zr(o,r,t,n,e){if(t>=n)return[0,0,0,0,0,0];for(var h=1/0,v=1/0,i=1/0,f=-1/0,l=-1/0,y=-1/0,s=t;s<n;s++){var d=o[s]*6,u=r[d];u<h&&(h=u),u=r[d+1],u<v&&(v=u),u=r[d+2],u<i&&(i=u),u=r[d+3],u>f&&(f=u),u=r[d+4],u>l&&(l=u),u=r[d+5],u>y&&(y=u)}return[h-e,v-e,i-e,f+e,l+e,y+e]}var Ir=1e-6,kr=["x","y","z"],K=new H(0,0,0),Er=(function(o){yr(r,o);function r(){return o!==null&&o.apply(this,arguments)||this}return r.prototype.createTree=function(t,n,e){n=Math.min(n,16);var h=this.getPositionByIndex.bind(this),v=this.getPositionCount(),i=v>65535?new Uint32Array(v):new Uint16Array(v),f=[],l=0,y=-1;if(e)for(var s=0;s<v;s+=1)i[s]=s;else{h(0,K);for(var d=K.x,u=K.y,x=K.z,w=d,z=u,I=x,s=0;s<v;s+=1){i[s]=s,h(s,K);var c=K.x,p=K.y,a=K.z;c<d?d=c:c>w&&(w=c),p<u?u=p:p>z&&(z=p),a<x?x=a:a>I&&(I=a)}e=[d,u,x,w,z,I]}var F=new D(++y,e,0,v,0);f[l++]=F;var k=[],E=[0,1,2],S=function(U,W){return k[W]-k[U]};function V(U){var W=U.startIndex,M=U.endIndex,T=U.extents;k[0]=T[3]-T[0],k[1]=T[4]-T[1],k[2]=T[5]-T[2];for(var j=E.sort(S)[0],q=kr[j],P=(T[j]+T[j+3])/2,B=W,_=M-1,A=-1,$;B<=_;)A===-1?($=i[B],h($,K),K[q]<P?B++:A=$):($=i[_],h($,K),K[q]>=P||(i[B]=$,i[_]=A,A=-1,B++),_--);if(B>W){var C=T.slice();C[j+3]=P+Ir;var G=new D(++y,C,W,B,U.deepth+1);G.deepth<n&&G.endIndex-G.startIndex>t&&(f[l++]=G),U.node0=G}if(M>B){var N=T.slice();N[j]=P-Ir;var L=new D(++y,N,B,M,U.deepth+1);L.deepth<n&&L.endIndex-L.startIndex>t&&(f[l++]=L),U.node1=L}U.startIndex=0,U.endIndex=0}for(;l;)V(f[--l]);return this.offsetArray=i,this.rootNodePacked=lr(F,y+1),f.length=0,this},r.prototype.intersectRay=function(t,n,e,h,v){e===void 0&&(e=0),h===void 0&&(h=!1);for(var i=[],f=this.offsetArray,l=this.rootNodePacked,y=new Float32Array(l),s=new Uint32Array(l),d=new Uint16Array(l),u=e*e,x=new H(1/n.x,1/n.y,1/n.z),w=[0],z,I=new xr(new H(0,0,0),new H(0,0,0)),c=1/0;(z=w.pop())!==void 0;){var p=z*X/4;I.min.x=y[p],I.min.y=y[p+1],I.min.z=y[p+2],I.max.x=y[p+3],I.max.y=y[p+4],I.max.z=y[p+5];var a=dr(t,x,I,e);if(a!==null&&!(h&&a>c)){for(var F=s[p+6],k=s[p+7],E=F;E<k;E++){var S=f[E],V=new H(0,0,0);this.getPositionByIndex(S,V);var U=V.x,W=V.y,M=V.z,T=t.x,j=t.y,q=t.z,P=n.x,B=n.y,_=n.z,A=P*(U-T)+B*(W-j)+_*(M-q);if(A>0?(T+=P*A,j+=B*A,q+=_*A):A<0&&(A=0),P=U-T,B=W-j,_=M-q,P*P+B*B+_*_<=u){var $=new H(T,j,q),C=new wr(V,V,V,S,$);(!v||v(C))&&(h?A<c&&(c=A,i.length>0&&(i.length=0),i.push(C)):i.push(C))}}var G=z*X/2,N=d[G+16],L=d[G+17];N&&w.push(N),L&&w.push(L)}}return i},r})(cr);function Mr(o){onmessage=function(r){Promise.resolve(r.data).then(function(t){return o(t)}).then(function(t){var n=t.output,e=t.transfer;return postMessage(n,e)}).catch(function(t){return postMessage({$$error:t})})}}Mr(function(o){return Promise.resolve(o).then(function(r){for(var t=[],n=new Set,e=0,h=r;e<h.length;e++){var v=h[e],i=void 0;if(v.type==="mesh")i=new Hr(v.attributes.position,v.indices);else if(v.type==="points")i=new Er(v.attributes.position,v.indices);else throw new Error("Invalid Type");i.createTree(v.maxItemPerNode,v.maxTreeDepth,v.extents);var f={type:v.type,attributes:v.attributes,indices:v.indices,offsetArray:i.offsetArray,rootNodePacked:i.rootNodePacked};t.push(f);var l=void 0;for(var y in f.attributes){var s=f.attributes[y];s&&s.buffer instanceof ArrayBuffer&&n.add(s.buffer)}l=f.indices,l&&l.buffer instanceof ArrayBuffer&&n.add(l.buffer),l=f.offsetArray,l&&l.buffer instanceof ArrayBuffer&&n.add(l.buffer),n.add(f.rootNodePacked)}return{output:t,transfer:Array.from(n)}})})})();
919
- `,blob=typeof self!="undefined"&&self.Blob&&new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);",jsContent],{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;charset=utf-8,"+encodeURIComponent(jsContent),{name:n==null?void 0:n.name})}}var bvhWorkerPool=new WorkerPool(function(){return new WorkerWrapper},4),defaultHitFilter=function(){return!0},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,intersectsMap=new Map;function raycastMesh(n,t,e,r){var o,s,u=n.matrixWorld;scratchInverseMatrix.getInverse(u),scratchRay.copy(e.ray).applyMatrix4(scratchInverseMatrix);var l=(o=e.hitFilter)!==null&&o!==void 0?o:defaultHitFilter,c=(s=e.firstHitOnly)!==null&&s!==void 0?s:!1,p=n.geometry,f=n.material,d=p.groups,h=p.index;intersectsMap.clear();for(var m=t.intersectRay(scratchRay.origin,scratchRay.direction,0,c,function(v){var E,b=v.index,T=b*3,_;if(Array.isArray(f)){if(d)for(var S=0,R=d;S<R.length;S++){var w=R[S];if(T>=w.start&&T-w.start<w.count){_=f[(E=w.materialIndex)!==null&&E!==void 0?E:0];break}}}else _=f;if(!_)return!1;var M=v.intersectionPoint,B=new THREE__namespace.Vector3(M.x,M.y,M.z).applyMatrix4(u),C=e.ray.origin.distanceTo(B);if(C<e.near||C>e.far)return!1;var P=v.pointA,L=v.pointB,O=v.pointC,F=THREE__namespace.Triangle.getNormal(scratchIntersectionFaceA.set(P.x,P.y,P.z).applyMatrix4(u),scratchIntersectionFaceB.set(L.x,L.y,L.z).applyMatrix4(u),scratchIntersectionFaceC.set(O.x,O.y,O.z).applyMatrix4(u),new THREE__namespace.Vector3),N=e.ray.direction.dot(F);if(_.side===THREE__namespace.FrontSide&&N>=0||_.side===THREE__namespace.BackSide&&N<=0)return!1;var D=new THREE__namespace.Face3(h?h.array[T]:T,h?h.array[T+1]:T+1,h?h.array[T+2]:T+2,F),U={distance:C,object:n,face:D,point:B,distanceToRay:0,faceIndex:b};return intersectsMap.set(v,U),l(U)}),A=m.length,g=0;g<A;g++){var y=intersectsMap.get(m[g]);y&&r.push(y)}intersectsMap.clear()}function raycastPoints(n,t,e,r){var o,s,u,l,c=n.matrixWorld;scratchNormalMatrix.getNormalMatrix(c),scratchInverseMatrix.getInverse(c),scratchRay.copy(e.ray).applyMatrix4(scratchInverseMatrix);var p=((s=(o=e.params.Points)===null||o===void 0?void 0:o.threshold)!==null&&s!==void 0?s:1)*scratchInverseMatrix.getMaxScaleOnAxis(),f=(u=e.hitFilter)!==null&&u!==void 0?u:defaultHitFilter,d=(l=e.firstHitOnly)!==null&&l!==void 0?l:!1,h=n.geometry,m=h.index,A=h.getAttribute("normal"),g=A instanceof THREE__namespace.BufferAttribute;intersectsMap.clear();for(var y=t.intersectRay(scratchRay.origin,scratchRay.direction,p,d,function(T){var _=T.intersectionPoint,S=new THREE__namespace.Vector3(_.x,_.y,_.z).applyMatrix4(c),R=e.ray.origin.distanceTo(S);if(R<e.near||R>e.far)return!1;var w=T.pointA,M=scratchIntersectionFaceA.set(w.x,w.y,w.z).applyMatrix4(c),B=T.index,C=m?m.array[B]:B,P;if(g){var L=new THREE__namespace.Vector3().fromBufferAttribute(A,C).applyNormalMatrix(scratchNormalMatrix);P=new THREE__namespace.Face3(C,C,C,L)}var O={distance:R,object:n,face:P,point:S,distanceToRay:S.distanceTo(M),index:B};return intersectsMap.set(T,O),f(O)}),v=y.length,E=0;E<v;E++){var b=intersectsMap.get(y[E]);b&&r.push(b)}intersectsMap.clear()}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,m=h?[h.min.x,h.min.y,h.min.z,h.max.x,h.max.y,h.max.z]:void 0,A={};for(var g in f.attributes){var y=f.attributes[g];y instanceof THREE__namespace.InterleavedBufferAttribute?(A[g]={array:y.data.array,stride:y.data.stride,offset:y.offset},l=y.data.array,l&&l.buffer instanceof ArrayBuffer&&u.add(l.buffer)):(A[g]={array:y.array},l=y.array,l&&l.buffer instanceof ArrayBuffer&&u.add(l.buffer))}var v=void 0,E=f.getIndex();E&&(E instanceof THREE__namespace.InterleavedBufferAttribute?(v={array:E.data.array,stride:E.data.stride,offset:E.offset},l=E.data.array,l&&l.buffer instanceof ArrayBuffer&&u.add(l.buffer)):(v={array:E.array},l=E.array,l&&l.buffer instanceof ArrayBuffer&&u.add(l.buffer)));var b={type:d,attributes:A,indices:v,maxItemPerNode:e,maxTreeDepth:r,extents:m};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 m=c.getIndex();if(m&&p.indices){var d=p.indices.array;m instanceof THREE__namespace.InterleavedBufferAttribute?m.data.array=d:m.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);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,20)},t.prototype.intersectRaycaster=function(e,r){var o=r!=null?r:[],s=e.hitFilter;e.hitFilter=function(f){if(f.object instanceof PBMPointCloud&&f.object.material.pointBack==="HIDDEN"&&f.face&&f.face.normal.angleTo(e.ray.direction)<Math.PI/2)return!1;var d=0,h=-1;if((f.object instanceof PBMMesh||f.object instanceof PBMSkinnedMesh||f.object instanceof PBMPointCloud)&&f.face){var m=Array.isArray(f.object.material)?f.object.material[f.face.materialIndex]:f.object.material;m&&(d=m.floorIndex,h=m.shownFloorIndex)}var A=h;return e.floorIndex!==void 0?A=e.floorIndex:e.floor!==void 0&&(A=e.floor===null?-1:e.floor),A>=0&&d!==A?!1:(Object.assign(f,{floorIndex:d,floor:d}),s?s.call(e,f):!0)};for(var u=this.children.slice(),l;l=u.pop();)if(l.visible){l.raycast(e,o);for(var c=0,p=l.children.length;c<p;c++)u.push(l.children[c])}return e.hitFilter=s,sortIntersects(o,e.sortByDistance,e.firstHitOnly),o},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)}else{var f=0;this.appearMotion.getTargetKeyframe().value.appear!==f&&this.appearMotion.set({appear:f},0).catch(noop)}this.appearMotion.ended!==!0&&this.appearMotion.update(r.time);for(var d=0,h=this.pbmObjects;d<h.length;d++){var m=h[d];if(m instanceof PBMMesh||m instanceof PBMSkinnedMesh){var A=updatePBMMesh(m,this.appearMotion,e,r,o,u,l);A===!0&&(c=!0)}else if(m instanceof PBMPointCloud){var A=updatePBMPointCloud(m,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=!1;if(versionMap$1.get(n)!==u.version){versionMap$1.set(n,u.version),l=!0,n.castShadow=u.castShadow,n.receiveShadow=u.receiveShadow;for(var c=n.material,p=0,f=c;p<f.length;p++){var d=f[p];d.customShaders=u.customShaders,d.pano0=u.pano0,d.pano1=u.pano1,d.pano0Depth=u.pano0Depth,d.pano1Depth=u.pano1Depth,d.refinedScreen=u.refinedScreen,d.modelAlpha=u.modelAlpha,d.logDepthAlpha=u.logDepthAlpha,d.progress=u.progress,d.transition=u.transition,d.opacity=u.opacity,d.floorStyle=u.floorStyle,d.constantColor=u.constantColor,d.shownFloorIndex=u.shownFloorIndex,d.clippers=u.clippers,d.brightness=u.brightness,d.useHQWeight=u.useHQWeight,d.useHQDepth=u.useHQDepth,d.colorSaturation=u.colorSaturation,d.colorBrightness=u.colorBrightness,d.gradientTexture=u.gradientTexture,d.modelBoundingMax.copy(u.boundingBox.max),d.modelBoundingMin.copy(u.boundingBox.min),d.shaderType==="none"?(d.transparent=!0,d.blending=THREE__namespace.NormalBlending,d.blendDst=THREE__namespace.OneMinusSrcAlphaFactor,d.blendEquation=THREE__namespace.AddEquation,d.blendSrcAlpha=null,d.blendDstAlpha=null,d.blendEquationAlpha=null,d.depthWrite=!1,d.depthTest=!0):(d.transparent=d.alphaMode==="BLEND",d.blending=THREE__namespace.NormalBlending,d.blendDst=THREE__namespace.OneMinusSrcAlphaFactor,d.blendEquation=THREE__namespace.AddEquation,d.blendSrcAlpha=null,d.blendDstAlpha=null,d.blendEquationAlpha=null,d.depthWrite=!0,d.depthTest=!0,u.useAddBlend&&(d.depthWrite=!1,d.depthTest=!1,d.blending=THREE__namespace.AdditiveBlending),d.shownFloorIndex>-1&&d.shownFloorIndex!==d.floorIndex&&(d.transparent=!0),d.opacity<1&&(d.transparent=!0),d.alphaMap&&(d.transparent=!0),d.brightness<1&&(d.transparent=!0),d.depthWrite=!d.transparent,d.logDepthAlpha>0?d.transparent=!1:u.useAddBlend&&(d.depthWrite=!1,d.depthTest=!1,d.blending=THREE__namespace.AdditiveBlending))}}return l}function updatePBMPointCloud(n,t,e,r,o,s,u){var l,c,p=!1;if(u.pointAppearAnimation===!0&&s.refine==="ADD"&&s.tileset.rootMeta.pntsOrder==="RANDOM"){var f=n.geometry,d=s.tileset.currentMaxScreenSpaceError,h=s.state.screenSpaceError,m=(c=(l=s.parent)===null||l===void 0?void 0:l.state.screenSpaceError)!==null&&c!==void 0?c:h,A=1;m!==h&&(A=(m-d)/(m-h)),A=clamp$1(A,0,1),A=easeInCubic(A);var g=f.index?f.index.count:f.attributes.position?f.attributes.position.count:1/0,y=Math.floor(g*A*t.value.appear);f.drawRange.count!==y&&(f.setDrawRange(0,y),p=!0)}if(versionMap$1.get(n)!==u.version){versionMap$1.set(n,u.version),p=!0,n.castShadow=u.castShadow,n.receiveShadow=u.receiveShadow;for(var v=[n.material],E=0,b=v;E<b.length;E++){var T=b[E];T.customShaders=u.customShaders,T.pointScale=u.pointScale,T.pointMinPixel=u.pointMinPixel,T.pointMaxPixel=u.pointMaxPixel,T.pointSize=u.pointSize,T.pointShape=u.pointShape,T.pointBack=u.pointBack,T.modelAlpha=u.modelAlpha,T.logDepthAlpha=u.logDepthAlpha,T.opacity=u.opacity,T.floorStyle=u.floorStyle,T.constantColor=u.constantColor,T.shownFloorIndex=u.shownFloorIndex,T.clippers=u.clippers,T.brightness=u.brightness,T.useHQWeight=u.useHQWeight,T.useHQDepth=u.useHQDepth,T.colorSaturation=u.colorSaturation,T.colorBrightness=u.colorBrightness,T.outlineGain=u.outlineGain,T.distanceGain=u.distanceGain,T.gradientTexture=u.gradientTexture,T.transparent=!1,T.blending=THREE__namespace.NormalBlending,T.blendDst=THREE__namespace.OneMinusSrcAlphaFactor,T.blendEquation=THREE__namespace.AddEquation,T.blendSrcAlpha=null,T.blendDstAlpha=null,T.blendEquationAlpha=null,T.depthWrite=!0,T.depthTest=!0,T.modelBoundingMax.copy(u.boundingBox.max),T.modelBoundingMin.copy(u.boundingBox.min),T.shownFloorIndex>-1&&(T.transparent=T.shownFloorIndex!==T.floorIndex),T.modelAlpha<1&&(T.transparent=!0),T.opacity<1&&(T.transparent=!0),T.brightness<1&&(T.transparent=!0),T.logDepthAlpha>0?T.transparent=!1:u.useAddBlend&&(T.depthWrite=!1,T.depthTest=!1,T.blending=THREE__namespace.AdditiveBlending),T.useHQWeight&&(T.depthWrite=!1,T.blending=THREE__namespace.CustomBlending,T.blendSrc=THREE__namespace.SrcAlphaFactor,T.blendSrcAlpha=THREE__namespace.SrcAlphaFactor,T.blendDst=THREE__namespace.OneFactor,T.blendDstAlpha=THREE__namespace.OneFactor)}}return p}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);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&&(r.tile.content&&this.tileset.options.tileUnloader(r.tile),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,E){if(v.tile.state.requestedFrameNumber!==E.tile.state.requestedFrameNumber)return E.tile.state.requestedFrameNumber-v.tile.state.requestedFrameNumber;if(v.tile.state.requestedFrameNumber===r.frameNumber){var b=getPriority(r,v.tile,priorityCache),T=getPriority(r,E.tile,priorityCache);return b-T}else return v.tile.level!==E.tile.level?v.tile.level-E.tile.level:v.tile.state.distanceToCamera-E.tile.state.distanceToCamera});break}case"SCREEN_VERTICAL":{u.sort(function(v,E){return v.tile.state.requestedFrameNumber!==E.tile.state.requestedFrameNumber?E.tile.state.requestedFrameNumber-v.tile.state.requestedFrameNumber:v.tile.state.requestedFrameNumber===r.frameNumber?v.tile.state.centerScreenY!==E.tile.state.centerScreenY?v.tile.state.centerScreenY-E.tile.state.centerScreenY:v.tile.state.centerZDepth!==E.tile.state.centerZDepth?v.tile.state.centerZDepth-E.tile.state.centerZDepth:v.tile.level!==E.tile.level?v.tile.level-E.tile.level:v.tile.state.distanceToCamera-E.tile.state.distanceToCamera:v.tile.level!==E.tile.level?v.tile.level-E.tile.level:v.tile.state.distanceToCamera-E.tile.state.distanceToCamera});break}case"SCREEN_LEVEL_VERTICAL":{u.sort(function(v,E){return v.tile.state.requestedFrameNumber!==E.tile.state.requestedFrameNumber?E.tile.state.requestedFrameNumber-v.tile.state.requestedFrameNumber:v.tile.state.requestedFrameNumber===r.frameNumber?v.tile.level!==E.tile.level?v.tile.level-E.tile.level:v.tile.state.centerScreenY!==E.tile.state.centerScreenY?v.tile.state.centerScreenY-E.tile.state.centerScreenY:v.tile.state.centerZDepth!==E.tile.state.centerZDepth?v.tile.state.centerZDepth-E.tile.state.centerZDepth:v.tile.state.distanceToCamera-E.tile.state.distanceToCamera:v.tile.level!==E.tile.level?v.tile.level-E.tile.level:v.tile.state.distanceToCamera-E.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 m=u[c].tile;if(m.hasTilesetContent||m.contentParent===null||m.contentParent.state.selectedFrameNumber===r.frameNumber){var A=u.splice(c,1);u.splice.apply(u,__spreadArray([d++,0],A,!1))}}for(var g=function(v){var E=u[v];E.status==="WAITING"&&(f--,E.status="PENDING",E.time=s,y.activeRequests++,y.tileset.options.tileLoader(E.tile).catch(function(b){E.error=b}).then(function(){E.status="DONE",E.tile.content&&E.tile.content.loadState==="READY"&&(E.tile.content.loadState="LOADING"),o.activeRequests--}))},y=this,c=0;c<u.length&&f>0;c++)g(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,m=s;h<m.length;h++){var c=m[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(m){r.cacheMemoryUsageInBytes+=m.contentMemoryUsage},onTileUnload:function(m){r.cacheMemoryUsageInBytes-=m.contentMemoryUsage,r.unloadTiles.push(m)}}),this.requestScheduler=new TileRequestScheduler(this,{onTileSkip:function(m){},onTileLoad:function(m){var A;!((A=m.content)===null||A===void 0)&&A.data&&(r.loadedTiles.add(m),r.cache.loadTile(m)),r.options.onTileLoad(m)},onTileError:function(m,A){r.options.onTileError(m,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(){var t=this;this.cache.reset(),this.skipTraverser.reset(),this.normalTraverser.reset(),this.mostDetailTraverser.reset(),this.requestScheduler.reset();for(var 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.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(m){r.options.onTrajectoryError(h,m)}))},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 m=h[d];if(!(m===""||m===".")){if(m===".."){f.pop();continue}f.push(m)}}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=/^blob\:/.test(t)?"":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 delay(n){return new Promise(function(t){return setTimeout(t,n)})}var AsyncTaskQueue=(function(){function n(t){this.queue=[],this.concurrency=t,this.dequeuing=0}return n.prototype.add=function(t,e){e===void 0&&(e=1e3);var r,o,s=new Promise(function(l,c){r=l,o=c}),u=function(){var l=Promise.resolve().then(t);l.then(r,o);var c=delay(e);return Promise.race([l,c]).then(noop,noop)};return this.queue.unshift(u),this.dequeue(),s},n.prototype.dequeue=function(){for(var t=this;this.dequeuing<this.concurrency&&this.queue.length>0;){var e=this.queue.pop();this.dequeuing++,e().catch(noop).then(function(){t.dequeuing--,t.dequeue()})}},n})(),initTextureQueue=new AsyncTaskQueue(1),skipImageSize=256;function canInit(n){return typeof n.image=="object"&&n.image.width>0&&n.image.height>0}function initTexture(n,t){if(!canInit(n))return Promise.resolve(n);if(n.image.width<skipImageSize&&n.image.width<skipImageSize)return t.initTexture(n),Promise.resolve(n);var e=!1,r=function(){e=!0,n.removeEventListener("dispose",r)};return n.addEventListener("dispose",r),initTextureQueue.add(function(){return new Promise(function(o){AnimationFrameLoop.shared.add(function(){canInit(n)&&e===!1&&t.initTexture(n),n.removeEventListener("dispose",r),o(n)},!0)})})}function initTextures(n,t){return Promise.all(n.map(function(e){return initTexture(e,t)}))}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,m=this.uvs.length,A=this.parseVertexIndex(t,d),g=this.parseVertexIndex(e,d),y=this.parseVertexIndex(r,d),v=l!==void 0?this.parseNormalIndex(l,h):void 0,E=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,m):void 0,_=s!==void 0?this.parseUVIndex(s,m):void 0,S=u!==void 0?this.parseUVIndex(u,m):void 0;(f.hasNormal===!0&&v===void 0||E===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(":"),w=f.indexMap[R];w===void 0&&(w=f.vertices.length/3,f.indexMap[R]=w,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(w);var M=[g,_,E].join(":"),B=f.indexMap[M];B===void 0&&(B=f.vertices.length/3,f.indexMap[M]=B,f.vertices.push(this.vertices[g+0],this.vertices[g+1],this.vertices[g+2]),f.hasColor&&(this.colors[g]===void 0?f.hasColor=!1:f.colors.push(this.colors[g+0],this.colors[g+1],this.colors[g+2])),f.hasNormal&&f.normals.push(this.normals[g+0],this.normals[g+1],this.normals[g+2]),f.hasUV&&f.uvs.push(this.uvs[_+0],this.uvs[_+1])),f.index.push(B);var C=[y,S,b].join(":"),P=f.indexMap[C];P===void 0&&(P=f.vertices.length/3,f.indexMap[C]=P,f.vertices.push(this.vertices[y+0],this.vertices[y+1],this.vertices[y+2]),f.hasColor&&(this.colors[y]===void 0?f.hasColor=!1:f.colors.push(this.colors[y+0],this.colors[y+1],this.colors[y+2])),f.hasNormal&&f.normals.push(this.normals[y+0],this.normals[y+1],this.normals[y+2]),f.hasUV&&f.uvs.push(this.uvs[S+0],this.uvs[S+1])),f.index.push(P)},n})();function parseObj(n){var t=new ObjState;n.indexOf(`\r
918
+ `&&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(te){var ne=e.length;if(te>ne){var ae=new u8(Math.max(ne*2,te));ae.set(e),e=ae}},f=t.f||0,d=t.p||0,h=t.b||0,m=t.l,A=t.d,g=t.m,y=t.n,v=o*8;do{if(!m){f=bits(n,d,1);var E=bits(n,d+1,3);if(d+=3,E)if(E==1)m=flrm,A=fdrm,g=9,y=5;else if(E==2){var S=bits(n,d,31)+257,R=bits(n,d+10,15)+4,w=S+bits(n,d+5,31)+1;d+=14;for(var M=new u8(w),B=new u8(19),C=0;C<R;++C)B[clim[C]]=bits(n,d+C*3,7);d+=R*3;for(var P=max(B),L=(1<<P)-1,O=hMap(B,P,1),C=0;C<w;){var F=O[bits(n,d,L)];d+=F&15;var b=F>>4;if(b<16)M[C++]=b;else{var N=0,D=0;for(b==16?(D=3+bits(n,d,3),d+=2,N=M[C-1]):b==17?(D=3+bits(n,d,7),d+=3):b==18&&(D=11+bits(n,d,127),d+=7);D--;)M[C++]=N}}var U=M.subarray(0,S),z=M.subarray(S);g=max(U),y=max(z),m=hMap(U,g,1),A=hMap(z,y,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 K=(1<<g)-1,j=(1<<y)-1,Q=d;;Q=d){var N=m[bits16(n,d)&K],V=N>>4;if(d+=N&15,d>v){c&&err(0);break}if(N||err(2),V<256)e[h++]=V;else if(V==256){Q=d,m=null;break}else{var J=V-254;if(V>264){var C=V-257,W=fleb[C];J=bits(n,d,(1<<W)-1)+fl[C],d+=W}var X=A[bits16(n,d)&j],Z=X>>4;X||err(3),d+=X&15;var z=fd[Z];if(Z>3){var W=fdeb[Z];z+=bits16(n,d)&(1<<W)-1,d+=W}if(d>v){c&&err(0);break}l&&p(h+131072);var Y=h+J;if(h<z){var G=s-z,ee=Math.min(z,Y);for(G+h<0&&err(3);h<ee;++h)e[h]=r[G+h]}for(;h<Y;++h)e[h]=e[h-z]}}t.l=m,t.p=Q,t.b=h,t.f=f,m&&(f=1,t.m=g,t.d=A,t.n=y)}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)==1&&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),-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],m=p[3],A=p[4],g=p[5],y=slzh(n,g);s=A,f?f==8?e[m]=inflateSync(n.subarray(y,y+d),{out:new u8(h)}):err(14,"unknown compression type "+f):e[m]=slc(n,y,y+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:internalFetcher,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),m=this.parseMaterials(t,h,c),A=this.parseDeformers(t,c),g=new GeometryParser().parse(t,A,c);this.parseScene(t,A,g,m,c,p);var y=(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,E=(l=(u=t.GlobalSettings.UnitScaleFactor)===null||u===void 0?void 0:u.value)!==null&&l!==void 0?l:1,b;if(t.GlobalSettings.AmbientColor){var T=t.GlobalSettings.AmbientColor.value,_=T[0],S=T[1],R=T[2];if(_!==0||S!==0||R!==0){var w=new THREE__namespace.Color().setRGB(_,S,R);b=new THREE__namespace.AmbientLight(w,1)}}return Promise.all(f).then(function(M){var B;return{scene:p,textures:M,ambientLight:b,upAxis:["X","Y","Z"][y],frontAxis:["X","Y","Z"][v],unitScale:E,animations:(B=p.animations)!==null&&B!==void 0?B:[],dispose:function(){M.forEach(function(C){return C.dispose()}),m.forEach(function(C){return C.dispose()}),g.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;canUseNativeImageBitmap()?c=this.fetcher.ajax(u,{responseType:"blob"}).then(function(f){var d=f.body;return createImageBitmapLike(d)}):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 m=s.get(d.ID).parents;m.forEach(function(A){var g=l.get(A.ID);g!==void 0&&g.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 m=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,m!==null&&s.add(m)}})};for(var c in e)l(c)}),s},n.prototype.createCamera=function(t,e){var r,o;if(e.children.forEach(function(m){var A=t.Objects.NodeAttribute[m.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 m=t.Objects.NodeAttribute[h.ID];m!==void 0&&(o=m)}),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 m=h.ID,A=s.get(m);A.parents.forEach(function(g){if(o.has(g.ID)){var y=o.get(g.ID);y instanceof THREE__namespace.SkinnedMesh&&y.bind(new THREE__namespace.Skeleton(f.bones),u[g.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,m){return s[m.ID]!==void 0&&(h=s[m.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(y,v){var E=v===0?"uv":"uv".concat(v+1);u.setAttribute(E,new THREE__namespace.Float32BufferAttribute(c.uvs[v],2))}),l.material&&l.material.mappingType!=="AllSame"){var h=c.materialIndex[0],m=0;if(c.materialIndex.forEach(function(y,v){y!==h&&(u.addGroup(m,v-m,h),h=y,m=v)}),u.groups.length>0){var A=u.groups[u.groups.length-1],g=A.start+A.count;g!==c.materialIndex.length&&u.addGroup(g,c.materialIndex.length-g,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(m,A){var g=0,y=!1;m<0&&(m=m^-1,y=!0);var v=[],E=[];if(u.push(m*3,m*3+1,m*3+2),t.color){var b=getData(A,r,m,t.color);c.push(b[0],b[1],b[2])}if(t.skeleton){if(t.weightTable[m]!==void 0&&t.weightTable[m].forEach(function(R){E.push(R.weight),v.push(R.id)}),E.length>4){s||(console.warn("THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."),s=!0);var T=[0,0,0,0],_=[0,0,0,0];E.forEach(function(R,w){var M=R,B=v[w];_.forEach(function(C,P,L){if(M>C){L[P]=M,M=C;var O=T[P];T[P]=B,B=O}})}),v=T,E=_}for(;E.length<4;)E.push(0),v.push(0);for(var S=0;S<4;++S)f.push(E[S]),d.push(v[S])}if(t.normal){var b=getData(A,r,m,t.normal);l.push(b[0],b[1],b[2])}t.material&&t.material.mappingType!=="AllSame"&&(g=getData(A,r,m,t.material)[0],g<0&&(h.negativeMaterialIndices=!0,g=0)),t.uv&&t.uv.forEach(function(R,w){var M=getData(A,r,m,R);p[w]===void 0&&(p[w]=[]),p[w].push(M[0]),p[w].push(M[1])}),o++,y&&(h.genFace(e,t,u,g,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=[],m=e.baseVertexPositions||e.vertexPositions,A=0;A<r.length;A+=3)h.push(new THREE__namespace.Vector3(m[r[A]],m[r[A+1]],m[r[A+2]]));for(var g=this.getNormalTangentAndBitangent(h),y=g.tangent,v=g.bitangent,E=[],b=0,T=h;b<T.length;b++){var _=T[b];E.push(this.flattenVertex(_,y,v))}d=THREE__namespace.ShapeUtils.triangulateShape(E,[])}else d=[[0,1,2]];for(var S=function(L,O,F){t.vertex.push(e.vertexPositions[r[L*3]]),t.vertex.push(e.vertexPositions[r[L*3+1]]),t.vertex.push(e.vertexPositions[r[L*3+2]]),t.vertex.push(e.vertexPositions[r[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[F*3]]),t.vertex.push(e.vertexPositions[r[F*3+1]]),t.vertex.push(e.vertexPositions[r[F*3+2]]),e.skeleton&&(t.vertexWeights.push(c[L*4]),t.vertexWeights.push(c[L*4+1]),t.vertexWeights.push(c[L*4+2]),t.vertexWeights.push(c[L*4+3]),t.vertexWeights.push(c[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[F*4]),t.vertexWeights.push(c[F*4+1]),t.vertexWeights.push(c[F*4+2]),t.vertexWeights.push(c[F*4+3]),t.weightsIndices.push(p[L*4]),t.weightsIndices.push(p[L*4+1]),t.weightsIndices.push(p[L*4+2]),t.weightsIndices.push(p[L*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[F*4]),t.weightsIndices.push(p[F*4+1]),t.weightsIndices.push(p[F*4+2]),t.weightsIndices.push(p[F*4+3])),e.color&&(t.colors.push(u[L*3]),t.colors.push(u[L*3+1]),t.colors.push(u[L*3+2]),t.colors.push(u[O*3]),t.colors.push(u[O*3+1]),t.colors.push(u[O*3+2]),t.colors.push(u[F*3]),t.colors.push(u[F*3+1]),t.colors.push(u[F*3+2])),e.material&&e.material.mappingType!=="AllSame"&&(t.materialIndex.push(o),t.materialIndex.push(o),t.materialIndex.push(o)),e.normal&&(t.normal.push(s[L*3]),t.normal.push(s[L*3+1]),t.normal.push(s[L*3+2]),t.normal.push(s[O*3]),t.normal.push(s[O*3+1]),t.normal.push(s[O*3+2]),t.normal.push(s[F*3]),t.normal.push(s[F*3+1]),t.normal.push(s[F*3+2])),e.uv&&e.uv.forEach(function(N,D){t.uvs[D]===void 0&&(t.uvs[D]=[]),t.uvs[D].push(l[D][L*2]),t.uvs[D].push(l[D][L*2+1]),t.uvs[D].push(l[D][O*2]),t.uvs[D].push(l[D][O*2+1]),t.uvs[D].push(l[D][F*2]),t.uvs[D].push(l[D][F*2+1])})},R=0,w=d;R<w.length;R++){var M=w[R],B=M[0],C=M[1],P=M[2];S(B,C,P)}},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 m=p[h]*3;d[m]=c[h*3],d[m+1]=c[h*3+1],d[m+2]=c[h*3+2]}var A={vertexIndices:l,vertexPositions:d,baseVertexPositions:u},g=this.genBuffers(A),y=new THREE__namespace.Float32BufferAttribute(g.vertex,3);y.name=s||r.attrName,y.applyMatrix4(o),t.morphAttributes.position.push(y)},n.prototype.parseNormals=function(t){var e=t.MappingInformationType,r=t.ReferenceInformationType,o=t.Normals.a,s=[];return r==="IndexToDirect"&&(t.NormalIndex?s=t.NormalIndex.a:t.NormalsIndex&&(s=t.NormalsIndex.a)),{dataSize:3,buffer:o,indices:s,mappingType:e,referenceType:r}},n.prototype.parseUVs=function(t){var e=t.MappingInformationType,r=t.ReferenceInformationType,o=t.UV.a,s=[];return r==="IndexToDirect"&&(s=t.UVIndex.a),{dataSize:2,buffer:o,indices:s,mappingType:e,referenceType:r}},n.prototype.parseVertexColors=function(t){var e=t.MappingInformationType,r=t.ReferenceInformationType,o=t.Colors.a,s=[];r==="IndexToDirect"&&(s=t.ColorIndex.a);for(var u=0,l=new THREE__namespace.Color;u<o.length;u+=4)l.fromArray(o,u),l.toArray(o,u);return{dataSize:4,buffer:o,indices:s,mappingType:e,referenceType:r}},n.prototype.parseMaterialIndices=function(t){var e=t.MappingInformationType,r=t.ReferenceInformationType;if(e==="NoMappingInformation")return{dataSize:1,buffer:[0],indices:[0],mappingType:"AllSame",referenceType:r};for(var o=t.Materials.a,s=[],u=0;u<o.length;++u)s.push(u);return{dataSize:1,buffer:o,indices:s,mappingType:e,referenceType:r}},n.prototype.parseNurbsGeometry=function(t){var e=parseInt(t.Order);if(isNaN(e))return console.error("THREE.FBXLoader: Invalid Order %s given for geometry ID: %s",t.Order,t.id),new THREE__namespace.BufferGeometry;for(var r=e-1,o=t.KnotVector.a,s=[],u=t.Points.a,l=0,c=u.length;l<c;l+=4)s.push(new THREE__namespace.Vector4().fromArray(u,l));var 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(m,A){if(e.has(m.ID)){var g=e.get(m.ID);if(g.curves.x!==void 0||g.curves.y!==void 0||g.curves.z!==void 0){if(f[A]===void 0){var y=r.get(m.ID).parents.filter(function(w){return w.relationship!==void 0})[0].ID;if(y!==void 0){var v=t.Objects.Model[y.toString()];if(v===void 0){console.warn("THREE.FBXLoader: Encountered a unused curve.",m);return}var E={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(w){w.ID===v.id&&(E.transform=w.matrix,w.userData.transformData&&(E.eulerOrder=w.userData.transformData.eulerOrder))}),E.transform||(E.transform=new THREE__namespace.Matrix4),v.PreRotation&&(E.preRotation=v.PreRotation.value),v.PostRotation&&(E.postRotation=v.PostRotation.value),f[A]=E}}f[A]&&(f[A][g.attr]=g)}else if(g.curves.morph!==void 0){if(f[A]===void 0){var b=r.get(m.ID).parents.filter(function(M){return M.relationship!==void 0})[0].ID,T=r.get(b).parents[0].ID,_=r.get(T).parents[0].ID,y=r.get(_).parents[0].ID,S=t.Objects.Model[y],R={modelName:S.attrName?THREE__namespace.PropertyBinding.sanitizeNodeName(S.attrName):"",morphName:t.Objects.Deformer[b].attrName};f[A]=R}f[A][g.attr]=g}}}),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,m=new THREE__namespace.Euler,A=[];if(!l||!u)return new THREE__namespace.QuaternionKeyframeTrack(t+".quaternion",[0],[0]);for(var g=0;g<l.length;g+=3){if(m.set(l[g],l[g+1],l[g+2],s),h.setFromEuler(m),h.premultiply(f),h.multiply(d),g>2){var y=new THREE__namespace.Quaternion().fromArray(A,(g-3)/3*4);y.dot(h)<0&&h.set(-h.x,-h.y,-h.z,-h.w)}h.toArray(A,g/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 m=Math.max.apply(Math,h),A=m/180,g=new THREE__namespace.Euler(p[0],p[1],p[2],o),y=new THREE__namespace.Euler(p[0],p[1],p[2],o),v=new THREE__namespace.Quaternion().setFromEuler(g),E=new THREE__namespace.Quaternion().setFromEuler(y);v.dot(E)&&E.set(-E.x,-E.y,-E.z,-E.w);for(var b=t.times[l-1],T=t.times[l]-b,_=new THREE__namespace.Quaternion,S=new THREE__namespace.Euler,R=0;R<1;R+=1/A)_.copy(v.clone().slerp(E.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 m=this.parseNode(t,e);m!==null&&this.parseSubNode(l,r,m)}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,m){m!==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,m=n.inheritType?n.inheritType:0;n.translation&&t.setPosition(tempVec.fromArray(n.translation));var A=getEulerOrder(0);if(n.preRotation){var g=n.preRotation.map(THREE__namespace.MathUtils.degToRad);g.push(A),e.makeRotationFromEuler(tempEuler.fromArray(g))}if(n.rotation){var g=n.rotation.map(THREE__namespace.MathUtils.degToRad);g.push(n.eulerOrder||A),r.makeRotationFromEuler(tempEuler.fromArray(g))}if(n.postRotation){var g=n.postRotation.map(THREE__namespace.MathUtils.degToRad);g.push(A),o.makeRotationFromEuler(tempEuler.fromArray(g)),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 y=e.clone().multiply(r).multiply(o),v=new THREE__namespace.Matrix4;v.extractRotation(f);var E=new THREE__namespace.Matrix4;E.copyPosition(f);var b=new THREE__namespace.Matrix4().getInverse(E).multiply(f),T=new THREE__namespace.Matrix4().getInverse(v).multiply(b),_=s,S=new THREE__namespace.Matrix4;if(m===0)S.copy(v).multiply(y).multiply(T).multiply(_);else if(m===1)S.copy(v).multiply(T).multiply(y).multiply(_);else{var R=new THREE__namespace.Matrix4().scale(new THREE__namespace.Vector3().setFromMatrixScale(d)),w=new THREE__namespace.Matrix4().getInverse(R),M=T.clone().multiply(w);S.copy(v).multiply(y).multiply(M).multiply(_)}var B=new THREE__namespace.Matrix4().getInverse(p),C=new THREE__namespace.Matrix4().getInverse(u),P=t.clone().multiply(c).multiply(p).multiply(e).multiply(r).multiply(o).multiply(B).multiply(l).multiply(u).multiply(s).multiply(C),L=new THREE__namespace.Matrix4().copyPosition(P),O=f.clone().multiply(L);return h.copyPosition(O),P=h.clone().multiply(S),P.premultiply(new THREE__namespace.Matrix4().getInverse(f)),P}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,m=0;m<d;++m){var A=f[m+1],g=p[d-m];c[d][m]=A+g;var y=c[m][d-1]/c[d][m];c[m][d]=h+A*y,h=g*y}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 E=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-_,w=e-_;v>=_&&(T[b][0]=T[E][0]/c[w+1][R],S=T[b][0]*c[R][w]);for(var M=R>=-1?1:-R,B=v-1<=w?_-1:e-v,C=M;C<=B;++C)T[b][C]=(T[E][C]-T[E][C-1])/c[w+1][R+C],S+=T[b][C]*c[R+C][w];v<=w&&(T[b][_]=-T[E][_-1]/c[w+1][v],S+=T[b][_]*c[v][w]),l[_][v]=S;var d=E;E=b,b=d}}for(var P=e,_=1;_<=r;++_){for(var d=0;d<=e;++d)l[_][d]*=P;P*=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 m=0;m<=s;++m){for(var d=p[l-n].clone().multiplyScalar(c[m][0]),A=1;A<=n;++A)d.add(p[l-n+A].clone().multiplyScalar(c[m][A]));u[m]=d}for(var m=s+1;m<=o+1;++m)u[m]=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:internalFetcher,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:""})}).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,m,A,g,y,v,E,b,T,_,S,R,w,M,B,C,P,L,O,F,N,D,U,z,K,j,Q,V,J,W,X,Z,Y,G,ee,te,ne,ae,ce,ie,fe,ge,ye,_e,le=unzipSync(n),de="",re=null,se=0,he=Object.keys(le);se<he.length;se++){var me=he[se];/(^|\/)main\.xml$/i.test(me)&&(re=le[me],de=me.slice(0,me.lastIndexOf("/")+1))}if(!re)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),qe=new DOMParser,Ye=decodeText(re),Ve=qe.parseFromString(Ye,"text/xml"),ve=Ve.querySelector("Record1 Axes"),Ke={x:{type:(s=(o=(r=ve==null?void 0:ve.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=ve==null?void 0:ve.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=ve==null?void 0:ve.querySelector("CX Increment"))===null||p===void 0?void 0:p.textContent)!==null&&f!==void 0?f:"1"),offset:Number((h=(d=ve==null?void 0:ve.querySelector("CX Offset"))===null||d===void 0?void 0:d.textContent)!==null&&h!==void 0?h:"0")},y:{type:(g=(A=(m=ve==null?void 0:ve.querySelector("CY AxisType"))===null||m===void 0?void 0:m.textContent)===null||A===void 0?void 0:A.toUpperCase())!==null&&g!==void 0?g:"I",dataType:(E=(v=(y=ve==null?void 0:ve.querySelector("CY DataType"))===null||y===void 0?void 0:y.textContent)===null||v===void 0?void 0:v.toUpperCase())!==null&&E!==void 0?E:"D",increment:Number((T=(b=ve==null?void 0:ve.querySelector("CY Increment"))===null||b===void 0?void 0:b.textContent)!==null&&T!==void 0?T:"1"),offset:Number((S=(_=ve==null?void 0:ve.querySelector("CY Offset"))===null||_===void 0?void 0:_.textContent)!==null&&S!==void 0?S:"0")},z:{type:(M=(w=(R=ve==null?void 0:ve.querySelector("CZ AxisType"))===null||R===void 0?void 0:R.textContent)===null||w===void 0?void 0:w.toUpperCase())!==null&&M!==void 0?M:"A",dataType:(P=(C=(B=ve==null?void 0:ve.querySelector("CZ DataType"))===null||B===void 0?void 0:B.textContent)===null||C===void 0?void 0:C.toUpperCase())!==null&&P!==void 0?P:"D",increment:Number((O=(L=ve==null?void 0:ve.querySelector("CZ Increment"))===null||L===void 0?void 0:L.textContent)!==null&&O!==void 0?O:"1"),offset:Number((N=(F=ve==null?void 0:ve.querySelector("CZ Offset"))===null||F===void 0?void 0:F.textContent)!==null&&N!==void 0?N:"0")}},Te=null,Le=Ve.querySelector("Record1 Axes Rotation");Le&&(Te=new THREE__namespace.Matrix3,Te.set(Number((U=(D=Le.querySelector("r11"))===null||D===void 0?void 0:D.textContent)!==null&&U!==void 0?U:0),Number((K=(z=Le.querySelector("r12"))===null||z===void 0?void 0:z.textContent)!==null&&K!==void 0?K:0),Number((Q=(j=Le.querySelector("r13"))===null||j===void 0?void 0:j.textContent)!==null&&Q!==void 0?Q:0),Number((J=(V=Le.querySelector("r21"))===null||V===void 0?void 0:V.textContent)!==null&&J!==void 0?J:0),Number((X=(W=Le.querySelector("r22"))===null||W===void 0?void 0:W.textContent)!==null&&X!==void 0?X:0),Number((Y=(Z=Le.querySelector("r23"))===null||Z===void 0?void 0:Z.textContent)!==null&&Y!==void 0?Y:0),Number((ee=(G=Le.querySelector("r31"))===null||G===void 0?void 0:G.textContent)!==null&&ee!==void 0?ee:0),Number((ne=(te=Le.querySelector("r32"))===null||te===void 0?void 0:te.textContent)!==null&&ne!==void 0?ne:0),Number((ce=(ae=Le.querySelector("r33"))===null||ae===void 0?void 0:ae.textContent)!==null&&ce!==void 0?ce:0)));var Me=(ie=Ve.querySelector("Record3 DataLink PointDataLink"))===null||ie===void 0?void 0:ie.textContent;if(typeof Me!="string")throw new Error("X3p: PointDataLink not found.");Me=pathJoin(de,Me);var $e=le[Me];if(!$e)throw new Error("X3p: ".concat($e," not found."));for(var tt=getPointArray($e.buffer,Ke.z.dataType),ke=Number((ge=(fe=Ve.querySelector("Record3 MatrixDimension SizeX"))===null||fe===void 0?void 0:fe.textContent)!==null&&ge!==void 0?ge:"0"),Ie=Number((_e=(ye=Ve.querySelector("Record3 MatrixDimension SizeY"))===null||ye===void 0?void 0:ye.textContent)!==null&&_e!==void 0?_e:"0"),He=Math.floor(ke-1),Ee=Math.floor(Ie-1),we=He+1,Pe=Ee+1,je=new Float32Array(we*Pe*3),Qe=new Float32Array(we*Pe*2),We=new Uint32Array(He*Ee*6),gt=new THREE__namespace.Box3,Je=0;Je<Pe;Je++)for(var At=Je*Ke.y.increment+Ke.y.offset,Re=0;Re<we;Re++){var Ue=Je*we+Re,yt=Re*Ke.x.increment+Ke.x.offset,Ct=tt[Ue],Et=!isNaN(Ct),dt=Et?Ct:NaN;_vector.set(yt,-At,dt),Te&&_vector.applyMatrix3(Te),Et&&gt.expandByPoint(_vector),je[Ue*3+0]=_vector.x,je[Ue*3+1]=_vector.y,je[Ue*3+2]=_vector.z,Qe[Ue*2+0]=Re/He,Qe[Ue*2+1]=1-Je/Ee}for(var Je=0;Je<Ee;Je++)for(var Re=0;Re<He;Re++){var ht=Re+we*Je,ze=Re+we*(Je+1),ut=Re+1+we*(Je+1),rt=Re+1+we*Je,ue=(Je*He+Re)*6;We[ue+0]=ht,We[ue+1]=ze,We[ue+2]=rt,We[ue+3]=ze,We[ue+4]=ut,We[ue+5]=rt}var Ae=new THREE__namespace.BufferGeometry;Ae.setAttribute("position",new THREE__namespace.BufferAttribute(je,3)),Ae.setAttribute("uv",new THREE__namespace.BufferAttribute(Qe,2)),Ae.setIndex(new THREE__namespace.BufferAttribute(We,1)),(!Ae.groups||Ae.groups.length===0)&&Ae.addGroup(0,Ae.index?Ae.index.count:Ae.attributes.position.count,0),Ae.boundingBox=gt;var Ce=new PBMMeshMaterial(t.light?"phong":"basic");Ce.flatShading=!0,Ce.color.copy(Ne);var Be=new PBMMesh(Ae,[Ce]);return{object:Be,dispose:function(){Ae.dispose(),Ce.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$1=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)!==0){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),m=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,m,A);var g=this.halfSize.toArray().reduce(function(y,v){return y+v},0);return(isNaN(g)||g<=0)&&this.halfSize.setScalar(EPSILON$2),this.rotation.fromArray([r/h,o/h,s/h,u/m,l/m,c/m,p/A,f/A,d/A]),isNaN(this.rotation.toArray().reduce(function(y,v){return y+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(24);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,r){if(e===void 0&&(e=0),scratchSize.copy(this.halfSize).multiplyScalar(2),scratchBox3$1.setFromCenterAndSize(scratchVector.set(0,0,0),scratchSize),scratchBox3$1.expandByScalar(e),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$1.containsPoint(scratchRay$1.origin))return!0;var o=scratchRay$1.intersectBox(scratchBox3$1,scratchVector);return o?r!==void 0?(r+=e,o.distanceToSquared(scratchRay$1.origin)<=r*r):!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,r){if(e===void 0&&(e=0),scratchSphere$2.set(this.center,this.radius+e),scratchSphere$2.containsPoint(t.origin))return!0;var o=t.intersectSphere(scratchSphere$2,scratchVector);return o?r!==void 0?(r+=e,t.origin.distanceToSquared(o)<=r*r):!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,e,r){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(24);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$a=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$a).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,m=u/h;return m}else{var A=Math.max(e,.001),h=A*c/l,m=u/h;return m}},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})(),defaultIterator=function(n){return Number(n)};function arrayMin(n,t,e){var r;t===void 0&&(t=defaultIterator),e===void 0&&(e=!1);for(var o,s=1/0,u=0,l=n;u<l.length;u++){var c=l[u],p=t(c);p<=s&&(r=[c,p],o=r[0],s=r[1])}return isFinite(s)||(s=0),e?[o,s]:o}var arrayMinCallback=function(n){return n.distance},intersectDistanceSortCallback=function(n,t){return n.distance-t.distance};function sortIntersects(n,t,e){if(t===void 0&&(t=!0),e===void 0&&(e=!1),e&&n.length>1){var r=arrayMin(n,arrayMinCallback);r?(n[0]=r,n.length=1):n.length=0}return t&&n.length>1&&n.sort(intersectDistanceSortCallback),n}var 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 m=c.array,A=(s=c.stride)!==null&&s!==void 0?s:3,g=(u=c.offset)!==null&&u!==void 0?u:0;return p=p*A+g,e.x=m[p],e.y=m[p+1],e.z=m[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,s){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=36;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){r===void 0&&(r=0);var o=e.min.x-r,s=e.min.y-r,u=e.min.z-r,l=e.max.x+r,c=e.max.y+r,p=e.max.z+r,f=0,d=0,h=0,m=0,A=0,g=0;return t.x>=0?(f=(o-n.x)*t.x,d=(l-n.x)*t.x):(f=(l-n.x)*t.x,d=(o-n.x)*t.x),t.y>=0?(h=(s-n.y)*t.y,m=(c-n.y)*t.y):(h=(c-n.y)*t.y,m=(s-n.y)*t.y),f>m||h>d||((h>f||f!==f)&&(f=h),(m<d||d!==d)&&(d=m),t.z>=0?(A=(u-n.z)*t.z,g=(p-n.z)*t.z):(A=(p-n.z)*t.z,g=(u-n.z)*t.z),f>g||A>d)||((A>f||f!==f)&&(f=A),(g<d||d!==d)&&(d=g),d<0)?null:f>=0?f:d}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,o,s){this.pointA=t,this.pointB=e,this.pointC=r,this.index=o,this.intersectionPoint=s}return n})(),BVHBox3=(function(){function n(t,e){this.min=t,this.max=e}return n})(),EPSILON$1=1e-6,scratchVector3$9=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;d<s;d+=1){var h=d*3,m=d*6,A=void 0,g=void 0,y=void 0,v=void 0,E=void 0,b=void 0,T=void 0;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),g=E=scratchVector3A.y,T=scratchVector3B.y,T<g&&(g=T),T>E&&(E=T),T=scratchVector3C.y,T<g&&(g=T),T>E&&(E=T),y=b=scratchVector3A.z,T=scratchVector3B.z,T<y&&(y=T),T>b&&(b=T),T=scratchVector3C.z,T<y&&(y=T),T>b&&(b=T),l[m]=A,l[m+1]=g,l[m+2]=y,l[m+3]=v,l[m+4]=E,l[m+5]=b}else{for(var _=1/0,S=1/0,R=1/0,w=-1/0,M=-1/0,B=-1/0,d=0;d<s;d+=1){var h=d*3,m=d*6,A=void 0,g=void 0,y=void 0,v=void 0,E=void 0,b=void 0,T=void 0;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),g=E=scratchVector3A.y,T=scratchVector3B.y,T<g&&(g=T),T>E&&(E=T),T=scratchVector3C.y,T<g&&(g=T),T>E&&(E=T),y=b=scratchVector3A.z,T=scratchVector3B.z,T<y&&(y=T),T>b&&(b=T),T=scratchVector3C.z,T<y&&(y=T),T>b&&(b=T),l[m]=A,l[m+1]=g,l[m+2]=y,l[m+3]=v,l[m+4]=E,l[m+5]=b,A<_&&(_=A),v>w&&(w=v),g<S&&(S=g),E>M&&(M=E),y<R&&(R=y),b>B&&(B=b)}o=[_,S,R,w,M,B]}var C=new BVHNode(++f,o,0,s,0);c[p++]=C;var P=[],L=[0,1,2],O=function(N,D){return P[D]-P[N]};function F(N){var D=N.startIndex,U=N.endIndex,z=N.extents;P[0]=z[3]-z[0],P[1]=z[4]-z[1],P[2]=z[5]-z[2],L.sort(O);for(var K=0;K<3;K++){for(var j=L[K],Q=z[j]+z[j+3],V=D,J=U-1,W=-1,X=void 0;V<=J;)W===-1?(X=u[V],l[X*6+j]+l[X*6+j+3]<Q?V++:W=X):(X=u[J],l[X*6+j]+l[X*6+j+3]>=Q||(u[V]=X,u[J]=W,W=-1,V++),J--);if(V>D&&V<U){var Z=new BVHNode(++f,calcExtents(u,l,D,V,EPSILON$1),D,V,N.deepth+1);Z.deepth<r&&Z.endIndex-Z.startIndex>e&&(c[p++]=Z);var Y=new BVHNode(++f,calcExtents(u,l,V,U,EPSILON$1),V,U,N.deepth+1);Y.deepth<r&&Y.endIndex-Y.startIndex>e&&(c[p++]=Y),N.node0=Z,N.node1=Y,N.startIndex=0,N.endIndex=0;break}}}for(;p;)F(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;(d=p.pop())!==void 0;){var h=d*BYTES_PER_NODE/4,m=clamp(e.x,u[h],u[h+3])-e.x,A=clamp(e.y,u[h+1],u[h+4])-e.y,g=clamp(e.z,u[h+2],u[h+5])-e.z;if(m*m+A*A+g*g<=r*r){for(var y=l[h+6],v=l[h+7],E=y;E<v;E++){var b=o[E];f.push(b)}var T=d*BYTES_PER_NODE/2,_=c[T+16],S=c[T+17];_&&p.push(_),S&&p.push(S)}}for(var R=f.length,w=new Float32Array(R*9),E=0;E<R;E++){var b=f[E],M=b*3;this.getPositionByIndex(M,scratchVector3$9),w[E*9]=scratchVector3$9.x,w[E*9+1]=scratchVector3$9.y,w[E*9+2]=scratchVector3$9.z,this.getPositionByIndex(M+1,scratchVector3$9),w[E*9+3]=scratchVector3$9.x,w[E*9+4]=scratchVector3$9.y,w[E*9+5]=scratchVector3$9.z,this.getPositionByIndex(M+2,scratchVector3$9),w[E*9+6]=scratchVector3$9.x,w[E*9+7]=scratchVector3$9.y,w[E*9+8]=scratchVector3$9.z}return w},t.prototype.intersectRay=function(e,r,o,s,u){o===void 0&&(o=0),s===void 0&&(s=!1);for(var l=[],c=this.offsetArray,p=this.rootNodePacked,f=new Float32Array(p),d=new Uint32Array(p),h=new Uint16Array(p),m=new BVHVector3(1/r.x,1/r.y,1/r.z),A=[0],g,y=new BVHBox3(new BVHVector3(0,0,0),new BVHVector3(0,0,0)),v=1/0;(g=A.pop())!==void 0;){var E=g*BYTES_PER_NODE/4;y.min.x=f[E],y.min.y=f[E+1],y.min.z=f[E+2],y.max.x=f[E+3],y.max.y=f[E+4],y.max.z=f[E+5];var b=intersectNodeBox(e,m,y,o);if(b!==null&&!(s&&b>v)){for(var T=e.x,_=e.y,S=e.z,R=r.x,w=r.y,M=r.z,B=d[E+6],C=d[E+7],P=B;P<C;P++){var L=c[P],O=L*3,F=new BVHVector3(0,0,0);this.getPositionByIndex(O,F);var N=F.x,D=F.y,U=F.z,z=new BVHVector3(0,0,0);this.getPositionByIndex(O+1,z);var K=z.x,j=z.y,Q=z.z,V=new BVHVector3(0,0,0);this.getPositionByIndex(O+2,V);var J=V.x,W=V.y,X=V.z,Z=K-N,Y=j-D,G=Q-U,ee=J-N,te=W-D,ne=X-U,ae=Y*ne-G*te,ce=G*ee-Z*ne,ie=Z*te-Y*ee,fe=R*ae+w*ce+M*ie,ge=void 0;if(fe>0)ge=1;else if(fe<0)ge=-1,fe=-fe;else continue;var ye=T-N,_e=_-D,le=S-U,de=ge*(R*(_e*ne-le*te)+w*(le*ee-ye*ne)+M*(ye*te-_e*ee));if(!(de<0)){var re=ge*(R*(Y*le-G*_e)+w*(G*ye-Z*le)+M*(Z*_e-Y*ye));if(!(re<0)&&!(de+re>fe)){var se=-ge*(ye*ae+_e*ce+le*ie);if(!(se<0)){var he=se/fe,me=new BVHVector3(T+R*he,_+w*he,S+M*he),Ne=new BVHIntersect(F,z,V,L,me);(!u||u(Ne))&&(s?he<v&&(v=he,l.length>0&&(l.length=0),l.push(Ne)):l.push(Ne))}}}}var qe=g*BYTES_PER_NODE/2,Ye=h[qe+16],Ve=h[qe+17];Ye&&A.push(Ye),Ve&&A.push(Ve)}}return l},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;d<r;d++){var h=n[d]*6,m=t[h];m<s&&(s=m),m=t[h+1],m<u&&(u=m),m=t[h+2],m<l&&(l=m),m=t[h+3],m>c&&(c=m),m=t[h+4],m>p&&(p=m),m=t[h+5],m>f&&(f=m)}return[s-o,u-o,l-o,c+o,p+o,f+o]}var EPSILON=1e-6,ORDER_AXISES=["x","y","z"],scratchVector3$8=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$8);for(var h=scratchVector3$8.x,m=scratchVector3$8.y,A=scratchVector3$8.z,g=h,y=m,v=A,d=0;d<u;d+=1){l[d]=d,s(d,scratchVector3$8);var E=scratchVector3$8.x,b=scratchVector3$8.y,T=scratchVector3$8.z;E<h?h=E:E>g&&(g=E),b<m?m=b:b>y&&(y=b),T<A?A=T:T>v&&(v=T)}o=[h,m,A,g,y,v]}var _=new BVHNode(++f,o,0,u,0);c[p++]=_;var S=[],R=[0,1,2],w=function(B,C){return S[C]-S[B]};function M(B){var C=B.startIndex,P=B.endIndex,L=B.extents;S[0]=L[3]-L[0],S[1]=L[4]-L[1],S[2]=L[5]-L[2];for(var O=R.sort(w)[0],F=ORDER_AXISES[O],N=(L[O]+L[O+3])/2,D=C,U=P-1,z=-1,K;D<=U;)z===-1?(K=l[D],s(K,scratchVector3$8),scratchVector3$8[F]<N?D++:z=K):(K=l[U],s(K,scratchVector3$8),scratchVector3$8[F]>=N||(l[D]=K,l[U]=z,z=-1,D++),U--);if(D>C){var j=L.slice();j[O+3]=N+EPSILON;var Q=new BVHNode(++f,j,C,D,B.deepth+1);Q.deepth<r&&Q.endIndex-Q.startIndex>e&&(c[p++]=Q),B.node0=Q}if(P>D){var V=L.slice();V[O]=N-EPSILON;var J=new BVHNode(++f,V,D,P,B.deepth+1);J.deepth<r&&J.endIndex-J.startIndex>e&&(c[p++]=J),B.node1=J}B.startIndex=0,B.endIndex=0}for(;p;)M(c[--p]);return this.offsetArray=l,this.rootNodePacked=packBVHNode(_,f+1),c.length=0,this},t.prototype.intersectRay=function(e,r,o,s,u){o===void 0&&(o=0),s===void 0&&(s=!1);for(var l=[],c=this.offsetArray,p=this.rootNodePacked,f=new Float32Array(p),d=new Uint32Array(p),h=new Uint16Array(p),m=o*o,A=new BVHVector3(1/r.x,1/r.y,1/r.z),g=[0],y,v=new BVHBox3(new BVHVector3(0,0,0),new BVHVector3(0,0,0)),E=1/0;(y=g.pop())!==void 0;){var b=y*BYTES_PER_NODE/4;v.min.x=f[b],v.min.y=f[b+1],v.min.z=f[b+2],v.max.x=f[b+3],v.max.y=f[b+4],v.max.z=f[b+5];var T=intersectNodeBox(e,A,v,o);if(T!==null&&!(s&&T>E)){for(var _=d[b+6],S=d[b+7],R=_;R<S;R++){var w=c[R],M=new BVHVector3(0,0,0);this.getPositionByIndex(w,M);var B=M.x,C=M.y,P=M.z,L=e.x,O=e.y,F=e.z,N=r.x,D=r.y,U=r.z,z=N*(B-L)+D*(C-O)+U*(P-F);if(z>0?(L+=N*z,O+=D*z,F+=U*z):z<0&&(z=0),N=B-L,D=C-O,U=P-F,N*N+D*D+U*U<=m){var K=new BVHVector3(L,O,F),j=new BVHIntersect(M,M,M,w,K);(!u||u(j))&&(s?z<E&&(E=z,l.length>0&&(l.length=0),l.push(j)):l.push(j))}}var Q=y*BYTES_PER_NODE/2,V=h[Q+16],J=h[Q+17];V&&g.push(V),J&&g.push(J)}}return l},t})(BVHObject);const jsContent=`(function(){"use strict";var ur=function(o,r){return ur=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},ur(o,r)};function yr(o,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");ur(o,r);function t(){this.constructor=o}o.prototype=r===null?Object.create(r):(t.prototype=r.prototype,new t)}typeof SuppressedError=="function"&&SuppressedError;var cr=(function(){function o(r,t){this.position=r,this.indices=t}return o.prototype.getPositionCount=function(){var r,t,n=this.indices,e=this.position;return n?n.array.length/((r=n.stride)!==null&&r!==void 0?r:1):e.array.length/((t=e.stride)!==null&&t!==void 0?t:3)},o.prototype.getPositionByIndex=function(r,t){var n,e,h,v,i=this.indices,f=this.position,l=r;if(i){var y=i.array,s=(n=i.stride)!==null&&n!==void 0?n:1,d=(e=i.offset)!==null&&e!==void 0?e:0;l=y[r*s+d]}var u=f.array,x=(h=f.stride)!==null&&h!==void 0?h:3,w=(v=f.offset)!==null&&v!==void 0?v:0;return l=l*x+w,t.x=u[l],t.y=u[l+1],t.z=u[l+2],t},o.prototype.createTree=function(r,t,n){throw new Error("not implemented")},o.prototype.trianglesInSphere=function(r,t){throw new Error("not implemented")},o.prototype.intersectRay=function(r,t,n,e,h){throw new Error("not implemented")},o})(),D=(function(){function o(r,t,n,e,h){this.id=r,this.extents=t,this.startIndex=n,this.endIndex=e,this.deepth=h}return o})(),X=36;function lr(o,r){for(var t=new ArrayBuffer(r*X),n=new Float32Array(t),e=new Uint32Array(t),h=new Uint16Array(t),v=[o],i,f;i=v.pop();)f=i.id*X/4,n[f]=i.extents[0],n[f+1]=i.extents[1],n[f+2]=i.extents[2],n[f+3]=i.extents[3],n[f+4]=i.extents[4],n[f+5]=i.extents[5],e[f+6]=i.startIndex,e[f+7]=i.endIndex,f=i.id*X/2,i.node0&&(h[f+16]=i.node0.id,v.push(i.node0)),i.node1&&(h[f+17]=i.node1.id,v.push(i.node1));return t}function dr(o,r,t,n){n===void 0&&(n=0);var e=t.min.x-n,h=t.min.y-n,v=t.min.z-n,i=t.max.x+n,f=t.max.y+n,l=t.max.z+n,y=0,s=0,d=0,u=0,x=0,w=0;return r.x>=0?(y=(e-o.x)*r.x,s=(i-o.x)*r.x):(y=(i-o.x)*r.x,s=(e-o.x)*r.x),r.y>=0?(d=(h-o.y)*r.y,u=(f-o.y)*r.y):(d=(f-o.y)*r.y,u=(h-o.y)*r.y),y>u||d>s||((d>y||y!==y)&&(y=d),(u<s||s!==s)&&(s=u),r.z>=0?(x=(v-o.z)*r.z,w=(l-o.z)*r.z):(x=(l-o.z)*r.z,w=(v-o.z)*r.z),y>w||x>s)||((x>y||y!==y)&&(y=x),(w<s||s!==s)&&(s=w),s<0)?null:y>=0?y:s}var H=(function(){function o(r,t,n){this.x=r,this.y=t,this.z=n}return o.prototype.copy=function(r){return this.x=r.x,this.y=r.y,this.z=r.z,this},o.prototype.set=function(r,t,n){return this.x=r,this.y=t,this.z=n,this},o.prototype.fromArray=function(r,t){return t===void 0&&(t=0),this.x=r[t],this.y=r[t+1],this.z=r[t+2],this},o.prototype.toArray=function(r,t){return r===void 0&&(r=[]),t===void 0&&(t=0),r[t]=this.x,r[t+1]=this.y,r[t+2]=this.z,r},o.prototype.add=function(r){return this.x+=r.x,this.y+=r.y,this.z+=r.z,this},o.prototype.multiplyScalar=function(r){return this.x*=r,this.y*=r,this.z*=r,this},o.prototype.subVectors=function(r,t){return this.x=r.x-t.x,this.y=r.y-t.y,this.z=r.z-t.z,this},o.prototype.addScaledVector=function(r,t){return this.x+=r.x*t,this.y+=r.y*t,this.z+=r.z*t,this},o.prototype.dot=function(r){return this.x*r.x+this.y*r.y+this.z*r.z},o.prototype.cross=function(r){var t=this.x,n=this.y,e=this.z;return this.x=n*r.z-e*r.y,this.y=e*r.x-t*r.z,this.z=t*r.y-n*r.x,this},o.prototype.crossVectors=function(r,t){var n=r.x,e=r.y,h=r.z,v=t.x,i=t.y,f=t.z;return this.x=e*f-h*i,this.y=h*v-n*f,this.z=n*i-e*v,this},o.prototype.distanceTo=function(r){return Math.sqrt(this.distanceToSquared(r))},o.prototype.distanceToSquared=function(r){var t=this.x-r.x,n=this.y-r.y,e=this.z-r.z;return t*t+n*n+e*e},o.prototype.clone=function(){return new o(this.x,this.y,this.z)},o})(),wr=(function(){function o(r,t,n,e,h){this.pointA=r,this.pointB=t,this.pointC=n,this.index=e,this.intersectionPoint=h}return o})(),xr=(function(){function o(r,t){this.min=r,this.max=t}return o})(),pr=1e-6,J=new H(0,0,0),Y=new H(0,0,0),g=new H(0,0,0),Z=new H(0,0,0),Hr=(function(o){yr(r,o);function r(){return o!==null&&o.apply(this,arguments)||this}return r.prototype.createTree=function(t,n,e){n=Math.min(n,16);var h=this.getPositionCount()/3,v=h>65535?new Uint32Array(h):new Uint16Array(h),i=new Float32Array(h*6),f=[],l=0,y=-1;if(e)for(var s=0;s<h;s+=1){var d=s*3,u=s*6,x=void 0,w=void 0,z=void 0,I=void 0,c=void 0,p=void 0,a=void 0;v[s]=s,this.getPositionByIndex(d,Y),this.getPositionByIndex(d+1,g),this.getPositionByIndex(d+2,Z),x=I=Y.x,a=g.x,a<x&&(x=a),a>I&&(I=a),a=Z.x,a<x&&(x=a),a>I&&(I=a),w=c=Y.y,a=g.y,a<w&&(w=a),a>c&&(c=a),a=Z.y,a<w&&(w=a),a>c&&(c=a),z=p=Y.z,a=g.z,a<z&&(z=a),a>p&&(p=a),a=Z.z,a<z&&(z=a),a>p&&(p=a),i[u]=x,i[u+1]=w,i[u+2]=z,i[u+3]=I,i[u+4]=c,i[u+5]=p}else{for(var F=1/0,k=1/0,E=1/0,S=-1/0,V=-1/0,U=-1/0,s=0;s<h;s+=1){var d=s*3,u=s*6,x=void 0,w=void 0,z=void 0,I=void 0,c=void 0,p=void 0,a=void 0;v[s]=s,this.getPositionByIndex(d,Y),this.getPositionByIndex(d+1,g),this.getPositionByIndex(d+2,Z),x=I=Y.x,a=g.x,a<x&&(x=a),a>I&&(I=a),a=Z.x,a<x&&(x=a),a>I&&(I=a),w=c=Y.y,a=g.y,a<w&&(w=a),a>c&&(c=a),a=Z.y,a<w&&(w=a),a>c&&(c=a),z=p=Y.z,a=g.z,a<z&&(z=a),a>p&&(p=a),a=Z.z,a<z&&(z=a),a>p&&(p=a),i[u]=x,i[u+1]=w,i[u+2]=z,i[u+3]=I,i[u+4]=c,i[u+5]=p,x<F&&(F=x),I>S&&(S=I),w<k&&(k=w),c>V&&(V=c),z<E&&(E=z),p>U&&(U=p)}e=[F,k,E,S,V,U]}var W=new D(++y,e,0,h,0);f[l++]=W;var M=[],T=[0,1,2],j=function(P,B){return M[B]-M[P]};function q(P){var B=P.startIndex,_=P.endIndex,A=P.extents;M[0]=A[3]-A[0],M[1]=A[4]-A[1],M[2]=A[5]-A[2],T.sort(j);for(var $=0;$<3;$++){for(var C=T[$],G=A[C]+A[C+3],N=B,L=_-1,O=-1,Q=void 0;N<=L;)O===-1?(Q=v[N],i[Q*6+C]+i[Q*6+C+3]<G?N++:O=Q):(Q=v[L],i[Q*6+C]+i[Q*6+C+3]>=G||(v[N]=Q,v[L]=O,O=-1,N++),L--);if(N>B&&N<_){var R=new D(++y,zr(v,i,B,N,pr),B,N,P.deepth+1);R.deepth<n&&R.endIndex-R.startIndex>t&&(f[l++]=R);var b=new D(++y,zr(v,i,N,_,pr),N,_,P.deepth+1);b.deepth<n&&b.endIndex-b.startIndex>t&&(f[l++]=b),P.node0=R,P.node1=b,P.startIndex=0,P.endIndex=0;break}}}for(;l;)q(f[--l]);return this.offsetArray=v,this.rootNodePacked=lr(W,y+1),f.length=0,this},r.prototype.trianglesInSphere=function(t,n){for(var e=this.offsetArray,h=this.rootNodePacked,v=new Float32Array(h),i=new Uint32Array(h),f=new Uint16Array(h),l=[0],y=[],s;(s=l.pop())!==void 0;){var d=s*X/4,u=fr(t.x,v[d],v[d+3])-t.x,x=fr(t.y,v[d+1],v[d+4])-t.y,w=fr(t.z,v[d+2],v[d+5])-t.z;if(u*u+x*x+w*w<=n*n){for(var z=i[d+6],I=i[d+7],c=z;c<I;c++){var p=e[c];y.push(p)}var a=s*X/2,F=f[a+16],k=f[a+17];F&&l.push(F),k&&l.push(k)}}for(var E=y.length,S=new Float32Array(E*9),c=0;c<E;c++){var p=y[c],V=p*3;this.getPositionByIndex(V,J),S[c*9]=J.x,S[c*9+1]=J.y,S[c*9+2]=J.z,this.getPositionByIndex(V+1,J),S[c*9+3]=J.x,S[c*9+4]=J.y,S[c*9+5]=J.z,this.getPositionByIndex(V+2,J),S[c*9+6]=J.x,S[c*9+7]=J.y,S[c*9+8]=J.z}return S},r.prototype.intersectRay=function(t,n,e,h,v){e===void 0&&(e=0),h===void 0&&(h=!1);for(var i=[],f=this.offsetArray,l=this.rootNodePacked,y=new Float32Array(l),s=new Uint32Array(l),d=new Uint16Array(l),u=new H(1/n.x,1/n.y,1/n.z),x=[0],w,z=new xr(new H(0,0,0),new H(0,0,0)),I=1/0;(w=x.pop())!==void 0;){var c=w*X/4;z.min.x=y[c],z.min.y=y[c+1],z.min.z=y[c+2],z.max.x=y[c+3],z.max.y=y[c+4],z.max.z=y[c+5];var p=dr(t,u,z,e);if(p!==null&&!(h&&p>I)){for(var a=t.x,F=t.y,k=t.z,E=n.x,S=n.y,V=n.z,U=s[c+6],W=s[c+7],M=U;M<W;M++){var T=f[M],j=T*3,q=new H(0,0,0);this.getPositionByIndex(j,q);var P=q.x,B=q.y,_=q.z,A=new H(0,0,0);this.getPositionByIndex(j+1,A);var $=A.x,C=A.y,G=A.z,N=new H(0,0,0);this.getPositionByIndex(j+2,N);var L=N.x,O=N.y,Q=N.z,R=$-P,b=C-B,or=G-_,er=L-P,vr=O-B,sr=Q-_,Ar=b*sr-or*vr,Pr=or*er-R*sr,Br=R*vr-b*er,m=E*Ar+S*Pr+V*Br,rr=void 0;if(m>0)rr=1;else if(m<0)rr=-1,m=-m;else continue;var tr=a-P,nr=F-B,ir=k-_,Sr=rr*(E*(nr*sr-ir*vr)+S*(ir*er-tr*sr)+V*(tr*vr-nr*er));if(!(Sr<0)){var Nr=rr*(E*(b*ir-or*nr)+S*(or*tr-R*ir)+V*(R*nr-b*tr));if(!(Nr<0)&&!(Sr+Nr>m)){var Vr=-rr*(tr*Ar+nr*Pr+ir*Br);if(!(Vr<0)){var ar=Vr/m,jr=new H(a+E*ar,F+S*ar,k+V*ar),hr=new wr(q,A,N,T,jr);(!v||v(hr))&&(h?ar<I&&(I=ar,i.length>0&&(i.length=0),i.push(hr)):i.push(hr))}}}}var Tr=w*X/2,Ur=d[Tr+16],_r=d[Tr+17];Ur&&x.push(Ur),_r&&x.push(_r)}}return i},r})(cr);function fr(o,r,t){return o<r?r:o>t?t:o}function zr(o,r,t,n,e){if(t>=n)return[0,0,0,0,0,0];for(var h=1/0,v=1/0,i=1/0,f=-1/0,l=-1/0,y=-1/0,s=t;s<n;s++){var d=o[s]*6,u=r[d];u<h&&(h=u),u=r[d+1],u<v&&(v=u),u=r[d+2],u<i&&(i=u),u=r[d+3],u>f&&(f=u),u=r[d+4],u>l&&(l=u),u=r[d+5],u>y&&(y=u)}return[h-e,v-e,i-e,f+e,l+e,y+e]}var Ir=1e-6,kr=["x","y","z"],K=new H(0,0,0),Er=(function(o){yr(r,o);function r(){return o!==null&&o.apply(this,arguments)||this}return r.prototype.createTree=function(t,n,e){n=Math.min(n,16);var h=this.getPositionByIndex.bind(this),v=this.getPositionCount(),i=v>65535?new Uint32Array(v):new Uint16Array(v),f=[],l=0,y=-1;if(e)for(var s=0;s<v;s+=1)i[s]=s;else{h(0,K);for(var d=K.x,u=K.y,x=K.z,w=d,z=u,I=x,s=0;s<v;s+=1){i[s]=s,h(s,K);var c=K.x,p=K.y,a=K.z;c<d?d=c:c>w&&(w=c),p<u?u=p:p>z&&(z=p),a<x?x=a:a>I&&(I=a)}e=[d,u,x,w,z,I]}var F=new D(++y,e,0,v,0);f[l++]=F;var k=[],E=[0,1,2],S=function(U,W){return k[W]-k[U]};function V(U){var W=U.startIndex,M=U.endIndex,T=U.extents;k[0]=T[3]-T[0],k[1]=T[4]-T[1],k[2]=T[5]-T[2];for(var j=E.sort(S)[0],q=kr[j],P=(T[j]+T[j+3])/2,B=W,_=M-1,A=-1,$;B<=_;)A===-1?($=i[B],h($,K),K[q]<P?B++:A=$):($=i[_],h($,K),K[q]>=P||(i[B]=$,i[_]=A,A=-1,B++),_--);if(B>W){var C=T.slice();C[j+3]=P+Ir;var G=new D(++y,C,W,B,U.deepth+1);G.deepth<n&&G.endIndex-G.startIndex>t&&(f[l++]=G),U.node0=G}if(M>B){var N=T.slice();N[j]=P-Ir;var L=new D(++y,N,B,M,U.deepth+1);L.deepth<n&&L.endIndex-L.startIndex>t&&(f[l++]=L),U.node1=L}U.startIndex=0,U.endIndex=0}for(;l;)V(f[--l]);return this.offsetArray=i,this.rootNodePacked=lr(F,y+1),f.length=0,this},r.prototype.intersectRay=function(t,n,e,h,v){e===void 0&&(e=0),h===void 0&&(h=!1);for(var i=[],f=this.offsetArray,l=this.rootNodePacked,y=new Float32Array(l),s=new Uint32Array(l),d=new Uint16Array(l),u=e*e,x=new H(1/n.x,1/n.y,1/n.z),w=[0],z,I=new xr(new H(0,0,0),new H(0,0,0)),c=1/0;(z=w.pop())!==void 0;){var p=z*X/4;I.min.x=y[p],I.min.y=y[p+1],I.min.z=y[p+2],I.max.x=y[p+3],I.max.y=y[p+4],I.max.z=y[p+5];var a=dr(t,x,I,e);if(a!==null&&!(h&&a>c)){for(var F=s[p+6],k=s[p+7],E=F;E<k;E++){var S=f[E],V=new H(0,0,0);this.getPositionByIndex(S,V);var U=V.x,W=V.y,M=V.z,T=t.x,j=t.y,q=t.z,P=n.x,B=n.y,_=n.z,A=P*(U-T)+B*(W-j)+_*(M-q);if(A>0?(T+=P*A,j+=B*A,q+=_*A):A<0&&(A=0),P=U-T,B=W-j,_=M-q,P*P+B*B+_*_<=u){var $=new H(T,j,q),C=new wr(V,V,V,S,$);(!v||v(C))&&(h?A<c&&(c=A,i.length>0&&(i.length=0),i.push(C)):i.push(C))}}var G=z*X/2,N=d[G+16],L=d[G+17];N&&w.push(N),L&&w.push(L)}}return i},r})(cr);function Mr(o){onmessage=function(r){Promise.resolve(r.data).then(function(t){return o(t)}).then(function(t){var n=t.output,e=t.transfer;return postMessage(n,e)}).catch(function(t){return postMessage({$$error:t})})}}Mr(function(o){return Promise.resolve(o).then(function(r){for(var t=[],n=new Set,e=0,h=r;e<h.length;e++){var v=h[e],i=void 0;if(v.type==="mesh")i=new Hr(v.attributes.position,v.indices);else if(v.type==="points")i=new Er(v.attributes.position,v.indices);else throw new Error("Invalid Type");i.createTree(v.maxItemPerNode,v.maxTreeDepth,v.extents);var f={type:v.type,attributes:v.attributes,indices:v.indices,offsetArray:i.offsetArray,rootNodePacked:i.rootNodePacked};t.push(f);var l=void 0;for(var y in f.attributes){var s=f.attributes[y];s&&s.buffer instanceof ArrayBuffer&&n.add(s.buffer)}l=f.indices,l&&l.buffer instanceof ArrayBuffer&&n.add(l.buffer),l=f.offsetArray,l&&l.buffer instanceof ArrayBuffer&&n.add(l.buffer),n.add(f.rootNodePacked)}return{output:t,transfer:Array.from(n)}})})})();
919
+ `,blob=typeof self!="undefined"&&self.Blob&&new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);",jsContent],{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;charset=utf-8,"+encodeURIComponent(jsContent),{name:n==null?void 0:n.name})}}var bvhWorkerPool=new WorkerPool(function(){return new WorkerWrapper},4),defaultHitFilter=function(){return!0},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,intersectsMap=new Map;function raycastMesh(n,t,e,r){var o,s,u=n.matrixWorld;scratchInverseMatrix.getInverse(u),scratchRay.copy(e.ray).applyMatrix4(scratchInverseMatrix);var l=(o=e.hitFilter)!==null&&o!==void 0?o:defaultHitFilter,c=(s=e.firstHitOnly)!==null&&s!==void 0?s:!1,p=n.geometry,f=n.material,d=p.groups,h=p.index;intersectsMap.clear();for(var m=t.intersectRay(scratchRay.origin,scratchRay.direction,0,c,function(v){var E,b=v.index,T=b*3,_;if(Array.isArray(f)){if(d)for(var S=0,R=d;S<R.length;S++){var w=R[S];if(T>=w.start&&T-w.start<w.count){_=f[(E=w.materialIndex)!==null&&E!==void 0?E:0];break}}}else _=f;if(!_)return!1;var M=v.intersectionPoint,B=new THREE__namespace.Vector3(M.x,M.y,M.z).applyMatrix4(u),C=e.ray.origin.distanceTo(B);if(C<e.near||C>e.far)return!1;var P=v.pointA,L=v.pointB,O=v.pointC,F=THREE__namespace.Triangle.getNormal(scratchIntersectionFaceA.set(P.x,P.y,P.z).applyMatrix4(u),scratchIntersectionFaceB.set(L.x,L.y,L.z).applyMatrix4(u),scratchIntersectionFaceC.set(O.x,O.y,O.z).applyMatrix4(u),new THREE__namespace.Vector3),N=e.ray.direction.dot(F);if(_.side===THREE__namespace.FrontSide&&N>=0||_.side===THREE__namespace.BackSide&&N<=0)return!1;var D=new THREE__namespace.Face3(h?h.array[T]:T,h?h.array[T+1]:T+1,h?h.array[T+2]:T+2,F),U={distance:C,object:n,face:D,point:B,distanceToRay:0,faceIndex:b};return intersectsMap.set(v,U),l(U)}),A=m.length,g=0;g<A;g++){var y=intersectsMap.get(m[g]);y&&r.push(y)}intersectsMap.clear()}function raycastPoints(n,t,e,r){var o,s,u,l,c=n.matrixWorld;scratchNormalMatrix.getNormalMatrix(c),scratchInverseMatrix.getInverse(c),scratchRay.copy(e.ray).applyMatrix4(scratchInverseMatrix);var p=((s=(o=e.params.Points)===null||o===void 0?void 0:o.threshold)!==null&&s!==void 0?s:1)*scratchInverseMatrix.getMaxScaleOnAxis(),f=(u=e.hitFilter)!==null&&u!==void 0?u:defaultHitFilter,d=(l=e.firstHitOnly)!==null&&l!==void 0?l:!1,h=n.geometry,m=h.index,A=h.getAttribute("normal"),g=A instanceof THREE__namespace.BufferAttribute;intersectsMap.clear();for(var y=t.intersectRay(scratchRay.origin,scratchRay.direction,p,d,function(T){var _=T.intersectionPoint,S=new THREE__namespace.Vector3(_.x,_.y,_.z).applyMatrix4(c),R=e.ray.origin.distanceTo(S);if(R<e.near||R>e.far)return!1;var w=T.pointA,M=scratchIntersectionFaceA.set(w.x,w.y,w.z).applyMatrix4(c),B=T.index,C=m?m.array[B]:B,P;if(g){var L=new THREE__namespace.Vector3().fromBufferAttribute(A,C).applyNormalMatrix(scratchNormalMatrix);P=new THREE__namespace.Face3(C,C,C,L)}var O={distance:R,object:n,face:P,point:S,distanceToRay:S.distanceTo(M),index:B};return intersectsMap.set(T,O),f(O)}),v=y.length,E=0;E<v;E++){var b=intersectsMap.get(y[E]);b&&r.push(b)}intersectsMap.clear()}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,m=h?[h.min.x,h.min.y,h.min.z,h.max.x,h.max.y,h.max.z]:void 0,A={};for(var g in f.attributes){var y=f.attributes[g];y instanceof THREE__namespace.InterleavedBufferAttribute?(A[g]={array:y.data.array,stride:y.data.stride,offset:y.offset},l=y.data.array,l&&l.buffer instanceof ArrayBuffer&&u.add(l.buffer)):(A[g]={array:y.array},l=y.array,l&&l.buffer instanceof ArrayBuffer&&u.add(l.buffer))}var v=void 0,E=f.getIndex();E&&(E instanceof THREE__namespace.InterleavedBufferAttribute?(v={array:E.data.array,stride:E.data.stride,offset:E.offset},l=E.data.array,l&&l.buffer instanceof ArrayBuffer&&u.add(l.buffer)):(v={array:E.array},l=E.array,l&&l.buffer instanceof ArrayBuffer&&u.add(l.buffer)));var b={type:d,attributes:A,indices:v,maxItemPerNode:e,maxTreeDepth:r,extents:m};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 m=c.getIndex();if(m&&p.indices){var d=p.indices.array;m instanceof THREE__namespace.InterleavedBufferAttribute?m.data.array=d:m.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);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,20)},t.prototype.intersectRaycaster=function(e,r){var o=r!=null?r:[],s=e.hitFilter;e.hitFilter=function(f){if(f.object instanceof PBMPointCloud&&f.object.material.pointBack==="HIDDEN"&&f.face&&f.face.normal.angleTo(e.ray.direction)<Math.PI/2)return!1;var d=0,h=-1;if((f.object instanceof PBMMesh||f.object instanceof PBMSkinnedMesh||f.object instanceof PBMPointCloud)&&f.face){var m=Array.isArray(f.object.material)?f.object.material[f.face.materialIndex]:f.object.material;m&&(d=m.floorIndex,h=m.shownFloorIndex)}var A=h;return e.floorIndex!==void 0?A=e.floorIndex:e.floor!==void 0&&(A=e.floor===null?-1:e.floor),A>=0&&d!==A?!1:(Object.assign(f,{floorIndex:d,floor:d}),s?s.call(e,f):!0)};for(var u=this.children.slice(),l;l=u.pop();)if(l.visible){l.raycast(e,o);for(var c=0,p=l.children.length;c<p;c++)u.push(l.children[c])}return e.hitFilter=s,sortIntersects(o,e.sortByDistance,e.firstHitOnly),o},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)}else{var f=0;this.appearMotion.getTargetKeyframe().value.appear!==f&&this.appearMotion.set({appear:f},0).catch(noop)}this.appearMotion.ended!==!0&&this.appearMotion.update(r.time);for(var d=0,h=this.pbmObjects;d<h.length;d++){var m=h[d];if(m instanceof PBMMesh||m instanceof PBMSkinnedMesh){var A=updatePBMMesh(m,this.appearMotion,e,r,o,u,l);A===!0&&(c=!0)}else if(m instanceof PBMPointCloud){var A=updatePBMPointCloud(m,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=!1;if(versionMap$1.get(n)!==u.version){versionMap$1.set(n,u.version),l=!0,n.castShadow=u.castShadow,n.receiveShadow=u.receiveShadow;for(var c=n.material,p=0,f=c;p<f.length;p++){var d=f[p];d.customShaders=u.customShaders,d.pano0=u.pano0,d.pano1=u.pano1,d.pano0Depth=u.pano0Depth,d.pano1Depth=u.pano1Depth,d.refinedScreen=u.refinedScreen,d.modelAlpha=u.modelAlpha,d.logDepthAlpha=u.logDepthAlpha,d.progress=u.progress,d.transition=u.transition,d.opacity=u.opacity,d.floorStyle=u.floorStyle,d.constantColor=u.constantColor,d.shownFloorIndex=u.shownFloorIndex,d.clippers=u.clippers,d.brightness=u.brightness,d.useHQWeight=u.useHQWeight,d.useHQDepth=u.useHQDepth,d.colorSaturation=u.colorSaturation,d.colorBrightness=u.colorBrightness,d.gradientTexture=u.gradientTexture,d.modelBoundingMax.copy(u.boundingBox.max),d.modelBoundingMin.copy(u.boundingBox.min),d.shaderType==="none"?(d.transparent=!0,d.blending=THREE__namespace.NormalBlending,d.blendDst=THREE__namespace.OneMinusSrcAlphaFactor,d.blendEquation=THREE__namespace.AddEquation,d.blendSrcAlpha=null,d.blendDstAlpha=null,d.blendEquationAlpha=null,d.depthWrite=!1,d.depthTest=!0):(d.transparent=d.alphaMode==="BLEND",d.blending=THREE__namespace.NormalBlending,d.blendDst=THREE__namespace.OneMinusSrcAlphaFactor,d.blendEquation=THREE__namespace.AddEquation,d.blendSrcAlpha=null,d.blendDstAlpha=null,d.blendEquationAlpha=null,d.depthWrite=!0,d.depthTest=!0,u.useAddBlend&&(d.depthWrite=!1,d.depthTest=!1,d.blending=THREE__namespace.AdditiveBlending),d.shownFloorIndex>-1&&d.shownFloorIndex!==d.floorIndex&&(d.transparent=!0),d.opacity<1&&(d.transparent=!0),d.alphaMap&&(d.transparent=!0),d.brightness<1&&(d.transparent=!0),d.depthWrite=!d.transparent,d.logDepthAlpha>0?d.transparent=!1:u.useAddBlend&&(d.depthWrite=!1,d.depthTest=!1,d.blending=THREE__namespace.AdditiveBlending))}}return l}function updatePBMPointCloud(n,t,e,r,o,s,u){var l,c,p=!1;if(u.pointAppearAnimation===!0&&s.refine==="ADD"&&s.tileset.rootMeta.pntsOrder==="RANDOM"){var f=n.geometry,d=s.tileset.currentMaxScreenSpaceError,h=s.state.screenSpaceError,m=(c=(l=s.parent)===null||l===void 0?void 0:l.state.screenSpaceError)!==null&&c!==void 0?c:h,A=1;m!==h&&(A=(m-d)/(m-h)),A=clamp$1(A,0,1),A=easeInCubic(A);var g=f.index?f.index.count:f.attributes.position?f.attributes.position.count:1/0,y=Math.floor(g*A*t.value.appear);f.drawRange.count!==y&&(f.setDrawRange(0,y),p=!0)}if(versionMap$1.get(n)!==u.version){versionMap$1.set(n,u.version),p=!0,n.castShadow=u.castShadow,n.receiveShadow=u.receiveShadow;for(var v=[n.material],E=0,b=v;E<b.length;E++){var T=b[E];T.customShaders=u.customShaders,T.pointScale=u.pointScale,T.pointMinPixel=u.pointMinPixel,T.pointMaxPixel=u.pointMaxPixel,T.pointSize=u.pointSize,T.pointShape=u.pointShape,T.pointBack=u.pointBack,T.modelAlpha=u.modelAlpha,T.logDepthAlpha=u.logDepthAlpha,T.opacity=u.opacity,T.floorStyle=u.floorStyle,T.constantColor=u.constantColor,T.shownFloorIndex=u.shownFloorIndex,T.clippers=u.clippers,T.brightness=u.brightness,T.useHQWeight=u.useHQWeight,T.useHQDepth=u.useHQDepth,T.colorSaturation=u.colorSaturation,T.colorBrightness=u.colorBrightness,T.outlineGain=u.outlineGain,T.distanceGain=u.distanceGain,T.gradientTexture=u.gradientTexture,T.transparent=!1,T.blending=THREE__namespace.NormalBlending,T.blendDst=THREE__namespace.OneMinusSrcAlphaFactor,T.blendEquation=THREE__namespace.AddEquation,T.blendSrcAlpha=null,T.blendDstAlpha=null,T.blendEquationAlpha=null,T.depthWrite=!0,T.depthTest=!0,T.modelBoundingMax.copy(u.boundingBox.max),T.modelBoundingMin.copy(u.boundingBox.min),T.shownFloorIndex>-1&&(T.transparent=T.shownFloorIndex!==T.floorIndex),T.modelAlpha<1&&(T.transparent=!0),T.opacity<1&&(T.transparent=!0),T.brightness<1&&(T.transparent=!0),T.logDepthAlpha>0?T.transparent=!1:u.useAddBlend&&(T.depthWrite=!1,T.depthTest=!1,T.blending=THREE__namespace.AdditiveBlending),T.useHQWeight&&(T.depthWrite=!1,T.blending=THREE__namespace.CustomBlending,T.blendSrc=THREE__namespace.SrcAlphaFactor,T.blendSrcAlpha=THREE__namespace.SrcAlphaFactor,T.blendDst=THREE__namespace.OneFactor,T.blendDstAlpha=THREE__namespace.OneFactor)}}return p}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);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&&(r.tile.content&&this.tileset.options.tileUnloader(r.tile),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,E){if(v.tile.state.requestedFrameNumber!==E.tile.state.requestedFrameNumber)return E.tile.state.requestedFrameNumber-v.tile.state.requestedFrameNumber;if(v.tile.state.requestedFrameNumber===r.frameNumber){var b=getPriority(r,v.tile,priorityCache),T=getPriority(r,E.tile,priorityCache);return b-T}else return v.tile.level!==E.tile.level?v.tile.level-E.tile.level:v.tile.state.distanceToCamera-E.tile.state.distanceToCamera});break}case"SCREEN_VERTICAL":{u.sort(function(v,E){return v.tile.state.requestedFrameNumber!==E.tile.state.requestedFrameNumber?E.tile.state.requestedFrameNumber-v.tile.state.requestedFrameNumber:v.tile.state.requestedFrameNumber===r.frameNumber?v.tile.state.centerScreenY!==E.tile.state.centerScreenY?v.tile.state.centerScreenY-E.tile.state.centerScreenY:v.tile.state.centerZDepth!==E.tile.state.centerZDepth?v.tile.state.centerZDepth-E.tile.state.centerZDepth:v.tile.level!==E.tile.level?v.tile.level-E.tile.level:v.tile.state.distanceToCamera-E.tile.state.distanceToCamera:v.tile.level!==E.tile.level?v.tile.level-E.tile.level:v.tile.state.distanceToCamera-E.tile.state.distanceToCamera});break}case"SCREEN_LEVEL_VERTICAL":{u.sort(function(v,E){return v.tile.state.requestedFrameNumber!==E.tile.state.requestedFrameNumber?E.tile.state.requestedFrameNumber-v.tile.state.requestedFrameNumber:v.tile.state.requestedFrameNumber===r.frameNumber?v.tile.level!==E.tile.level?v.tile.level-E.tile.level:v.tile.state.centerScreenY!==E.tile.state.centerScreenY?v.tile.state.centerScreenY-E.tile.state.centerScreenY:v.tile.state.centerZDepth!==E.tile.state.centerZDepth?v.tile.state.centerZDepth-E.tile.state.centerZDepth:v.tile.state.distanceToCamera-E.tile.state.distanceToCamera:v.tile.level!==E.tile.level?v.tile.level-E.tile.level:v.tile.state.distanceToCamera-E.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 m=u[c].tile;if(m.hasTilesetContent||m.contentParent===null||m.contentParent.state.selectedFrameNumber===r.frameNumber){var A=u.splice(c,1);u.splice.apply(u,__spreadArray([d++,0],A,!1))}}for(var g=function(v){var E=u[v];E.status==="WAITING"&&(f--,E.status="PENDING",E.time=s,y.activeRequests++,y.tileset.options.tileLoader(E.tile).catch(function(b){E.error=b}).then(function(){E.status="DONE",E.tile.content&&E.tile.content.loadState==="READY"&&(E.tile.content.loadState="LOADING"),o.activeRequests--}))},y=this,c=0;c<u.length&&f>0;c++)g(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,m=s;h<m.length;h++){var c=m[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(m){r.cacheMemoryUsageInBytes+=m.contentMemoryUsage},onTileUnload:function(m){r.cacheMemoryUsageInBytes-=m.contentMemoryUsage,r.unloadTiles.push(m)}}),this.requestScheduler=new TileRequestScheduler(this,{onTileSkip:function(m){},onTileLoad:function(m){var A;!((A=m.content)===null||A===void 0)&&A.data&&(r.loadedTiles.add(m),r.cache.loadTile(m)),r.options.onTileLoad(m)},onTileError:function(m,A){r.options.onTileError(m,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(){var t=this;this.cache.reset(),this.skipTraverser.reset(),this.normalTraverser.reset(),this.mostDetailTraverser.reset(),this.requestScheduler.reset();for(var 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.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(m){r.options.onTrajectoryError(h,m)}))},c=this,p=0,f=this.trajectories;p<f.length;p++){var d=f[p];l(d)}},n})();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=/^blob\:/.test(t)?"":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 delay(n){return new Promise(function(t){return setTimeout(t,n)})}var AsyncTaskQueue=(function(){function n(t){this.queue=[],this.concurrency=t,this.dequeuing=0}return n.prototype.add=function(t,e){e===void 0&&(e=1e3);var r,o,s=new Promise(function(l,c){r=l,o=c}),u=function(){var l=Promise.resolve().then(t);l.then(r,o);var c=delay(e);return Promise.race([l,c]).then(noop,noop)};return this.queue.unshift(u),this.dequeue(),s},n.prototype.dequeue=function(){for(var t=this;this.dequeuing<this.concurrency&&this.queue.length>0;){var e=this.queue.pop();this.dequeuing++,e().catch(noop).then(function(){t.dequeuing--,t.dequeue()})}},n})(),initTextureQueue=new AsyncTaskQueue(1),skipImageSize=256;function canInit(n){return typeof n.image=="object"&&n.image.width>0&&n.image.height>0}function initTexture(n,t){if(!canInit(n))return Promise.resolve(n);if(n.image.width<skipImageSize&&n.image.width<skipImageSize)return t.initTexture(n),Promise.resolve(n);var e=!1,r=function(){e=!0,n.removeEventListener("dispose",r)};return n.addEventListener("dispose",r),initTextureQueue.add(function(){return new Promise(function(o){AnimationFrameLoop.shared.add(function(){canInit(n)&&e===!1&&t.initTexture(n),n.removeEventListener("dispose",r),o(n)},!0)})})}function initTextures(n,t){return Promise.all(n.map(function(e){return initTexture(e,t)}))}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,m=this.uvs.length,A=this.parseVertexIndex(t,d),g=this.parseVertexIndex(e,d),y=this.parseVertexIndex(r,d),v=l!==void 0?this.parseNormalIndex(l,h):void 0,E=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,m):void 0,_=s!==void 0?this.parseUVIndex(s,m):void 0,S=u!==void 0?this.parseUVIndex(u,m):void 0;(f.hasNormal===!0&&v===void 0||E===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(":"),w=f.indexMap[R];w===void 0&&(w=f.vertices.length/3,f.indexMap[R]=w,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(w);var M=[g,_,E].join(":"),B=f.indexMap[M];B===void 0&&(B=f.vertices.length/3,f.indexMap[M]=B,f.vertices.push(this.vertices[g+0],this.vertices[g+1],this.vertices[g+2]),f.hasColor&&(this.colors[g]===void 0?f.hasColor=!1:f.colors.push(this.colors[g+0],this.colors[g+1],this.colors[g+2])),f.hasNormal&&f.normals.push(this.normals[g+0],this.normals[g+1],this.normals[g+2]),f.hasUV&&f.uvs.push(this.uvs[_+0],this.uvs[_+1])),f.index.push(B);var C=[y,S,b].join(":"),P=f.indexMap[C];P===void 0&&(P=f.vertices.length/3,f.indexMap[C]=P,f.vertices.push(this.vertices[y+0],this.vertices[y+1],this.vertices[y+2]),f.hasColor&&(this.colors[y]===void 0?f.hasColor=!1:f.colors.push(this.colors[y+0],this.colors[y+1],this.colors[y+2])),f.hasNormal&&f.normals.push(this.normals[y+0],this.normals[y+1],this.normals[y+2]),f.hasUV&&f.uvs.push(this.uvs[S+0],this.uvs[S+1])),f.index.push(P)},n})();function parseObj(n){var t=new ObjState;n.indexOf(`\r
920
920
  `)!==-1&&(n=n.replace(/\r\n/g,`
921
921
  `)),n.indexOf(`\\
922
922
  `)!==-1&&(n=n.replace(/\\\n/g,""));for(var e=n.split(`
@@ -1023,9 +1023,9 @@ void main() {
1023
1023
  #include <fog_fragment>
1024
1024
  #include <premultiplied_alpha_fragment>
1025
1025
  }
1026
- `,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,m=0;m<=e;m++){h=n.getPointAt(m/e,h);for(var A=c.normals[m],g=c.binormals[m],y=0;y<=r;y++){var v=m*(r+1)+y,E=y/r*Math.PI*2,b=Math.sin(E),T=-Math.cos(E);f.x=T*A.x+b*g.x,f.y=T*A.y+b*g.y,f.z=T*A.z+b*g.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=m/e,d.y=y/r,d.toArray(u,v*2)}}for(var m=0;m<e;m++)for(var y=0;y<r;y++){var _=(m*r+y)*6,S=(r+1)*m+y,R=(r+1)*(m+1)+y,w=(r+1)*(m+1)+(y+1),M=(r+1)*m+(y+1);l[_]=S,l[_+1]=R,l[_+2]=M,l[_+3]=R,l[_+4]=w,l[_+5]=M}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 m=.03,A=Math.ceil(u*100),g=6,y=createPipeBufferGeometry(l,m,A,g);y.clearGroups(),y.addGroup(0,y.index?y.index.count:y.attributes.position.count,0),y.addGroup(0,y.index?y.index.count:y.attributes.position.count,1),y.addGroup(0,y.index?y.index.count:y.attributes.position.count,2);var 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 E=new THREE__namespace.ShaderMaterial({vertexShader:TRAJECTOR_PIPE_SHADER.vertexShader,fragmentShader:TRAJECTOR_PIPE_SHADER.fragmentShader,uniforms:THREE__namespace.UniformsUtils.clone(TRAJECTOR_PIPE_SHADER.uniforms),side:THREE__namespace.BackSide});E.uniforms.totalLength.value=u,E.uniforms.displacementScalar.value=-.01,E.uniforms.diffuse.value=r,E.uniforms.diffuse2.value=o;var b=new THREE__namespace.ShaderMaterial({vertexShader:TRAJECTOR_PIPE_SHADER.vertexShader,fragmentShader:TRAJECTOR_PIPE_SHADER.fragmentShader,uniforms:THREE__namespace.UniformsUtils.clone(TRAJECTOR_PIPE_SHADER.uniforms),side:THREE__namespace.DoubleSide});b.uniforms.totalLength.value=u,b.uniforms.displacementScalar.value=-.026,b.uniforms.dashSize.value=new THREE__namespace.Vector2(.06,.09),b.uniforms.diffuse.value=s,b.uniforms.diffuse2.value=s;var T=new THREE__namespace.Mesh(y,[v,E,b]),_=.08,S=24,R=new THREE__namespace.SphereBufferGeometry(_,S,S);R.clearGroups(),R.addGroup(0,y.index?y.index.count:y.attributes.position.count,0),R.addGroup(0,y.index?y.index.count:y.attributes.position.count,1);var w=new THREE__namespace.ShaderMaterial({vertexShader:TRAJECTOR_SPHERE_SHADER.vertexShader,fragmentShader:TRAJECTOR_SPHERE_SHADER.fragmentShader,uniforms:THREE__namespace.UniformsUtils.clone(TRAJECTOR_SPHERE_SHADER.uniforms),side:THREE__namespace.BackSide});w.uniforms.diffuse.value=e,w.uniforms.opacity.value=.5,w.transparent=!0;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.FrontSide});M.uniforms.displacementScalar.value=-.01,M.uniforms.diffuse.value=r;var B=new THREE__namespace.Mesh(R,[w,M]);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 P=new THREE__namespace.Mesh(R,[w,C]);return P.position.fromArray(n,n.length-3),T.add(P),{scene:T,dispose:function(){y.dispose(),v.dispose(),E.dispose(),b.dispose(),R.dispose(),w.dispose(),M.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,m=s.memoryUsage,A=parseTrajectoryObject(d);A.scene.applyMatrix4(n.transform),A.scene.updateWorldMatrix(!1,!0),A.scene.matrixAutoUpdate=!1;var g=new TrajectoryNode(e,A.scene);return n.content.data={uri:o,byteLength:h,memoryUsage:m,positionArray:d,timeArray:f,object:g},n.content.byteLength=h,n.content.memoryUsage=m,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$7=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,m=(o*o/(a*a)*f+r)*u;return n.set(d,h,m)}function getEcefToEnuMatrix(n,t){var e=ecefToLla(scratchVector3$7.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$7.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$6=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},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;function cloneSkipBackfaceObject(n){var t;n instanceof THREE__namespace.Mesh?t=new THREE__namespace.Mesh(n.geometry,Array.isArray(n.material)?n.material.map(function(s){return s.transparent?SKIP_BACKFACE_TRANSPARENT_MATERIAL:SKIP_BACKFACE_MATERIAL}):n.material&&n.material.transparent?SKIP_BACKFACE_TRANSPARENT_MATERIAL:SKIP_BACKFACE_MATERIAL):n instanceof THREE__namespace.Group?t=new THREE__namespace.Group:t=new THREE__namespace.Object3D,t.position.copy(n.position),t.quaternion.copy(n.quaternion),t.scale.copy(n.scale),t.matrix.compose(n.position,n.quaternion,n.scale),t.matrixAutoUpdate=!1,t.frustumCulled=n.frustumCulled,t.visible=n.visible;for(var e=0,r=n.children;e<r.length;e++){var o=r[e];t.add(cloneSkipBackfaceObject(o))}return t}var 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){var o=this,s,u,l=r!=null?r:[],c=[this.tileset.root],p=this.tileset.transform,f=(u=(s=e.params.Points)===null||s===void 0?void 0:s.threshold)!==null&&u!==void 0?u:0,d=e.hitFilter;e.hitFilter=function(T){var _;return Object.assign(T,{model:(_=o.parent)!==null&&_!==void 0?_:void 0,viewLayer:o}),d?d.call(e,T):!0};var h=e.sortByDistance;e.sortByDistance=!1;for(var m,A=1/0;m=c.pop();){var g=void 0;if(m.boundingVolume){var y=void 0;m.boundingVolume instanceof BoxBoundingVolume?y=scratchBoxBoundingVolume.copy(m.boundingVolume):m.boundingVolume instanceof SphereBoundingVolume?y=scratchSphereBoundingVolume.copy(m.boundingVolume):y=m.boundingVolume.clone(),y.applyMatrix4(p),g=y.intersectRay(e.ray,f,A)}else g=!0;if(g){for(var v=0,E=m.children.length;v<E;v++)c.push(m.children[v]);if(m.selected&&m.content&&m.content.data&&m.content.data.object.visible&&(m.content.data.object.intersectRaycaster(e,l),e.firstHitOnly)){var b=l[0];b&&A>b.distance&&(A=b.distance)}}}return e.hitFilter=d,e.sortByDistance=h,sortIntersects(l,e.sortByDistance,e.firstHitOnly),l},t.prototype.update=function(e,r,o,s){var u,l,c=this,p,f,d,h,m;this.renderer=e,this.frameNumber++;var A=!1,g=this.parameter.resolveValue(o.parameter,s.parameter);parameterVersionMap.get(this)!==g.version&&(parameterVersionMap.set(this,g.version),A=!0);var y=g.maxLevelOfDetail;y=Math.max(y,0);var v=Math.min(g.minLevelOfDetail,y);(!this.visible||!this.loaded||!o.loaded)&&(y=Math.max(v,0));var E=g.minGeometricError,b=r.controllerMode;(b==="Panorama"||b==="VRPanorama"||b==="XRPanorama")&&g.modelAlpha<.1&&(E=g.panoramaMinGeometricError);var T=g.maxGeometricError;T=Math.max(E,T);var _={time:r.time,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:v,maxLevelOfDetail:y,minGeometricError:E,maxGeometricError:T,skipLevelOfDetail:g.skipLevelOfDetail,mostDetail:g.mostDetail,loadSiblings:g.loadSiblings,cameraCulling:g.cameraCulling,maxMemoryUsage:g.maxMemoryUsage,maxRequests:g.maxRequests,requestOrder:g.requestOrder,maxScreenSpaceError:g.maxScreenSpaceError,memoryAdjustedOverflow:g.memoryAdjustedOverflow,memoryAdjustedScreenSpaceError:g.memoryAdjustedScreenSpaceError},S=g.cacheCameras.map(function(ne){return ne.updateProjectionMatrix(),__assign(__assign({},_),{camera:{type:r.type,position:new THREE__namespace.Vector3().copy(ne.position),direction:ne.getWorldDirection(new THREE__namespace.Vector3),up:new THREE__namespace.Vector3().copy(ne.up),projectionMatrix:ne.projectionMatrix.clone(),visible:ne.visible,refine:!0},cullingVolume:new CullingVolume().setFromCamera(ne)})});this.updateWorldMatrix(!0,!1),this.tileset.transform.equals(this.matrixWorld)||(this.tileset.transform.copy(this.matrixWorld),A=!0);var R=!this.autoRefine;if(R===!1){var w=g.progress>.01&&g.progress<.99;if(w){var M=new THREE__namespace.Vector3;g.pano0&&M.setFromMatrixPosition(g.pano0.matrix);var B=M.clone();g.pano1&&B.setFromMatrixPosition(g.pano1.matrix),M.distanceTo(B)<10&&(R=!0)}}if(R||this.tileset.update(_,S),this.refined=!0,this.refineProgress[0]=0,this.refineProgress[1]=0,this.tileset.needsRefinedTiles.forEach(function(ne){if(c.refineProgress[1]++,ne.content){var se=ne.content.loadState;if(se==="UNLOADED"||se==="LOADING"){c.refined=!1;return}}c.refineProgress[0]++}),this.loaded===!1&&this.autoRefine){this.loaded=!0;var C=!1;this.tileset.needsRefinedTiles.forEach(function(ne){if(c.loaded!==!1&&ne.content){if(ne.state.visible&&(C=!0),_.skipLevelOfDetail){if(ne.state.finalResolution){var se=ne.state.ancestorWithContentAvailable,he=se&&se.content?se.content:ne.content,me=he.loadState;(me==="UNLOADED"||me==="LOADING")&&(c.loaded=!1)}}else if(ne.state.visible&&ne.levelOfContent<=0){var me=ne.content.loadState;(me==="UNLOADED"||me==="LOADING")&&(c.loaded=!1)}}}),C&&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),_.skipLevelOfDetail||this.tileset.selectedTiles.sort(function(ne,se){return ne.floor!==se.floor?ne.floor-se.floor:ne.levelOfContent!==se.levelOfContent?se.levelOfContent-ne.levelOfContent:ne.state.distanceToCamera!==se.state.distanceToCamera?ne.state.distanceToCamera-se.state.distanceToCamera:ne.state.centerZDepth-se.state.centerZDepth});for(var P=[],L=0,O=this.tileset.selectedTiles;L<O.length;L++){var F=O[L],N=(f=(p=F.content)===null||p===void 0?void 0:p.data)===null||f===void 0?void 0:f.object;if(N){var D=N.update(e,r,o,this,F,g);if(P.push(F.id),D&&(A=!0),this.tileset.hasMixedContent&&_.skipLevelOfDetail){if(!F.state.finalResolution){var U=cloneSkipBackfaceObject(N);U.name="skipBackface:"+N.name,this.backfaceObjects.push(U)}for(var z=F.state.selectionDepth,G=STENCIL_CONSTANT.TILE_MASK|z<<STENCIL_CONSTANT.SKIP_LOD_BIT_SHIFT,j=THREE__namespace.GreaterEqualStencilFunc,Q=STENCIL_CONSTANT.SKIP_LOD_MASK,V=THREE__namespace.ReplaceStencilOp,J=STENCIL_CONSTANT.TILE_MASK|STENCIL_CONSTANT.SKIP_LOD_MASK,W=0,X=N.materials;W<X.length;W++){var Z=X[W];Z.stencilWrite=!0,Z.stencilRef=G,Z.stencilFunc=j,Z.stencilFuncMask=Q,Z.stencilZPass=V,Z.stencilWriteMask=J}}else for(var Y=0,K=N.materials;Y<K.length;Y++){var Z=K[Y];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(N)}}var ee=P.toString();tileVersionMap.get(this)!==ee&&(tileVersionMap.set(this,ee),A=!0),_.skipLevelOfDetail&&this.backfaceObjects.length&&(u=this.renderObjects).push.apply(u,this.backfaceObjects),this.tileObjects.length&&(l=this.renderObjects).push.apply(l,this.tileObjects),_.skipLevelOfDetail&&this.renderObjects.push(this.clearStencilObject);for(var te=[],re=0,ae=this.tileset.selectedTrajectories;re<ae.length;re++){var ce=ae[re],ie=(d=ce.content.data)===null||d===void 0?void 0:d.object;if(ie){var D=ie.update(e,r,o,this,ce,g);te.push(ce.id),D&&(A=!0),this.renderObjects.push(ie)}}var fe=te.toString();trajectoryVersionMap.get(this)!==fe&&(trajectoryVersionMap.set(this,fe),A=!0);for(var ge=Math.min(0,((m=(h=this.parent)===null||h===void 0?void 0:h.children)!==null&&m!==void 0?m:[]).indexOf(this)),ye=ge*1e4,_e=function(ne){var se=le.renderObjects[ne],he=ne+ye;se.traverse(function(me){(me instanceof THREE__namespace.Mesh||me instanceof THREE__namespace.Line||me instanceof THREE__namespace.Points)&&(me.renderOrder=he)}),le.add(se)},le=this,de=0;de<this.renderObjects.length;de++)_e(de);return A},t.prototype.dispose=function(){this.disposed=!0,this.tileset.reset(),this.tileset.root.children.length=0,/^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,this.error=null,this.onError=void 0,this.renderer=void 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$6.setScalar(0);var e=this.localToLla(scratchVector3$6),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$6.copy(e),this.worldToLla(scratchVector3$6),{latitude:scratchVector3$6.x,longitude:scratchVector3$6.y,altitude:scratchVector3$6.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),fetcherMap=new WeakMap;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$5=new THREE__namespace.Vector3,scratchMatrix4$2=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=n.work.getURL(r),l=u.split("#"),c=l[0],p=l[1],f=(e=(p||c).split("?")[1])!==null&&e!==void 0?e:"";return t.fetcher.ajax(u,{responseType:"text"}).catch(function(d){return{error:d,body:JSON.stringify({asset:{version:"0.0"},geometricError:0,root:{geometricError:0}})}}).then(function(d){var h,m="error"in d?d.error:null,A=normalizeTilesetHeader(JSON.parse(d.body),u),g=A.root,y=A.rootMeta,v=y===void 0?{}:y,E=n.upAxis;v.upAxis&&v.upAxis!==E&&(E=v.upAxis),"lodVersion"in A&&(E="-Y","floorInfo"in A&&(A.properties=A.properties||{},A.properties.floorInfo=A.floorInfo.map(function(w){return{ground:-w.ground,height:w.height}}),A.floorInfo=void 0),A.asset.tilesetVersion=String(A.lodVersion),A.lodVersion=void 0);var b=g.boundingVolume?makeBoundingVolume(g.boundingVolume):void 0;b&&g.transform&&b.applyMatrix4(scratchMatrix4$2.fromArray(g.transform));var T=null,_=new THREE__namespace.Matrix4,S=new THREE__namespace.Matrix4;v.coordinate?(T=v.coordinate.ground_height,_.fromArray(v.coordinate.pose_ecef_to_enu),S.fromArray(v.coordinate.pose_enu_to_ecef)):(b?b.getCenter(scratchVector3$5):scratchVector3$5.setScalar(0),getEcefToEnuMatrixFromUpAxis(E,scratchVector3$5,_),S.getInverse(_)),A.root={refine:(h=g.refine)!==null&&h!==void 0?h:"REPLACE",geometricError:g.geometricError,transform:scratchMatrix4$2.copy(_).premultiply(enuToLocalMatrix).toArray(),boundingVolume:b?b.toJson():void 0,children:[g]};var R=new Tile3D(A,{name:o,type:s,upAxis:E,light:t.light,fetcher:t.fetcher,search:f,groundHeight:T,enuToEcefMatrix:S,ecefToEnuMatrix:_,error:m});return R})}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.work.getURL(n.file)},extras:(e={},e[p]={textureBaseUri:typeof n.textureBase=="string"?n.work.getURL(n.textureBase):void 0,textureArray:n.textures,textureOptions:(r=t.textureOptions)!==null&&r!==void 0?r:{}},e)}});o.push({work:n.work,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,m=new THREE__namespace.Vector3,A=new THREE__namespace.Vector3,g=new THREE__namespace.Vector2,y=new THREE__namespace.Vector2,v=new THREE__namespace.Vector2,E=new THREE__namespace.Vector3,b=new THREE__namespace.Vector3;function T(G,j,Q){h.fromArray(o,G*3),m.fromArray(o,j*3),A.fromArray(o,Q*3),g.fromArray(u,G*2),y.fromArray(u,j*2),v.fromArray(u,Q*2);var V=m.x-h.x,J=A.x-h.x,W=m.y-h.y,X=A.y-h.y,Z=m.z-h.z,Y=A.z-h.z,K=y.x-g.x,ee=v.x-g.x,te=y.y-g.y,re=v.y-g.y,ae=1/(K*re-ee*te);E.set((re*V-te*J)*ae,(re*W-te*X)*ae,(re*Z-te*Y)*ae),b.set((K*J-ee*V)*ae,(K*X-ee*W)*ae,(K*Y-ee*Z)*ae),p[G].add(E),p[j].add(E),p[Q].add(E),f[G].add(b),f[j].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],w=R.start,M=R.count,B=w,C=w+M;B<C;B+=3)T(r[B+0],r[B+1],r[B+2]);var P=new THREE__namespace.Vector3,L=new THREE__namespace.Vector3,O=new THREE__namespace.Vector3,F=new THREE__namespace.Vector3,N,D,U;function z(G){O.fromArray(s,G*3),F.copy(O),D=p[G],P.copy(D),P.sub(O.multiplyScalar(O.dot(D))).normalize(),L.crossVectors(F,D),U=L.dot(f[G]),N=U<0?-1:1,c[G*4]=P.x,c[G*4+1]=P.y,c[G*4+2]=P.z,c[G*4+3]=N}for(var d=0,S=_.length;d<S;++d)for(var R=_[d],w=R.start,M=R.count,B=w,C=w+M;B<C;B+=3)z(r[B+0]),z(r[B+1]),z(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 m=0,A=[],p=0;p<n.length;++p){for(var g=n[p].index,y=0;y<g.count;++y)A.push(g.getX(y)+m);m+=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 E=u[d][0].length;if(E===0)break;l.morphAttributes=l.morphAttributes||{},l.morphAttributes[d]=[];for(var p=0;p<E;++p){for(var b=[],y=0;y<u[d].length;++y)b.push(u[d][y][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],m=u.itemSize,A=u.count,g=new THREE__namespace.InterleavedBufferAttribute(l,m,c,u.normalized);p.push(g),c+=m;for(var y=0;y<A;y++)for(var v=0;v<m;v++)g[d[v]](y,u[f[v]](y))}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,m=l.length;h<m;h++){var A=l[h];c[A]=[];var g=n.morphAttributes[A];g&&(p[A]=new Array(g.length).fill().map(function(){return[]}))}for(var y=Math.log10(1/t),v=Math.pow(10,y),h=0;h<s;h++){for(var E=r?r.getX(h):h,b="",T=0,m=l.length;T<m;T++)for(var A=l[T],_=n.getAttribute(A),S=_.itemSize,R=0;R<S;R++)b+="".concat(~~(_[d[R]](E)*v),",");if(b in e)f.push(e[b]);else{for(var T=0,m=l.length;T<m;T++)for(var A=l[T],_=n.getAttribute(A),g=n.morphAttributes[A],S=_.itemSize,w=c[A],M=p[A],R=0;R<S;R++){var B=d[R];if(w.push(_[B](E)),g)for(var C=0,P=g.length;C<P;C++)M[C].push(g[C][B](E))}e[b]=u,f.push(u),u++}}for(var L=n.clone(),h=0,m=l.length;h<m;h++){var A=l[h],O=n.getAttribute(A),F=new O.array.constructor(c[A]),_=new THREE__namespace.BufferAttribute(F,O.itemSize,O.normalized);if(L.setAttribute(A,_),A in p)for(var T=0;T<p[A].length;T++){var N=n.morphAttributes[A][T],F=new N.array.constructor(p[A][T]),D=new THREE__namespace.BufferAttribute(F,N.itemSize,N.normalized);L.morphAttributes[A][T]=D}}return L.setIndex(f),L}},scratchSphere$1=new THREE__namespace.Sphere,scratchMatrix4$1=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,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 m=[];if(h.traverseVisible(function(j){if(j instanceof THREE__namespace.Mesh){var Q=getBvhTreeForMesh(j);if(Q){scratchMatrix4$1.copy(j.matrixWorld),scratchMatrix4Inverse.getInverse(scratchMatrix4$1),scratchSphere$1.copy(t).applyMatrix4(scratchMatrix4Inverse);var V=Q.trianglesInSphere(scratchSphere$1.center,scratchSphere$1.radius),J=new THREE__namespace.BufferGeometry;J.setAttribute("position",new THREE__namespace.BufferAttribute(V,3)),J.applyMatrix4(j.matrixWorld),J=BufferGeometryUtils.mergeVertices(J,.01),m.push(J)}}}),m.length===0)return;for(var A=["a","b","c"],g=BufferGeometryUtils.mergeBufferGeometries(m,!1),y=g.getAttribute("position").array,v=((d=g.getIndex())===null||d===void 0?void 0:d.array)||[],E=[],b=[],T=0,_=y.length;T<_;T+=3){var S=new THREE__namespace.Vector3(y[T],y[T+1],y[T+2]);E.push(S)}for(var T=0,_=v.length;T<_;T+=3){var R=v[T],w=v[T+1],M=v[T+2],B=new THREE__namespace.Vector3().crossVectors(E[w].clone().sub(E[R]),E[M].clone().sub(E[R])).normalize();b.push({a:R,b:w,c:M,normal:B})}for(var C={},T=0,_=b.length;T<_;T++)for(var P=b[T],L=0;L<3;L++){var O=P[A[L]],F=P[A[(L+1)%3]],N=[Math.min(O,F),Math.max(O,F)],D=N[0]+"-"+N[1];C[D]===void 0?C[D]={index1:N[0],index2:N[1],face1:T}:C[D].face2=T}for(var D in C){var U=C[D];if(U.face2===void 0||b[U.face1].normal.dot(b[U.face2].normal)<=r){var z=E[U.index1],G=E[U.index2];o.push(new THREE__namespace.Line3(z,G))}}E.length=0,b.length=0}})}return o}var scratchBoundingBox$1=new THREE__namespace.Box3,scratchViewLayerBox=new THREE__namespace.Box3,scratchObserverBox$3=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,m=d;h<m.length;h++){var A=m[h];A.dispose()}else s.add.apply(s,d)}),s.loadedReady=new Promise(function(d){var h=function(){d(),s.removeEventListener("load",h),s.removeEventListener("dispose",h)};s.addEventListener("load",h),s.addEventListener("dispose",h)})}else s.refined=!0,s.loaded=!0,s.initReady=Promise.resolve(),s.loadedReady=Promise.resolve();return s.parameter.set("boundingBox",s.boundingBox.clone()),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);this.dispatchEvent({type:"dispose"})},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){var o=r!=null?r:[],s=e.sortByDistance;e.sortByDistance=!1;for(var u=0,l=this.children.length;u<l;u++){var c=this.children[u];c.visible&&typeof c.intersectRaycaster=="function"&&c.intersectRaycaster(e,o)}return e.sortByDistance=s,sortIntersects(o,e.sortByDistance,e.firstHitOnly),o},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$3.copy(this.work.observerBox),scratchObserverBox$3.isEmpty()||(scratchObserverBox$3.max.x+=1,scratchObserverBox$3.max.z+=1,scratchObserverBox$3.max.y+=1,scratchObserverBox$3.min.x-=1,scratchObserverBox$3.min.z-=1,scratchBoundingBox$1.union(scratchObserverBox$3));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 scratchBoundingBox$1.applyMatrix4(this.matrix),scratchBoundingBox$1.equals(this.boundingBox)||(this.boundingBox.copy(scratchBoundingBox$1),this.parameter.set("boundingBox",scratchBoundingBox$1.clone())),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=[];e.parameter.set("boundingBox",e.boundingBox.clone());var 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){var o=r!=null?r:[],s=this.children.filter(function(f){return f instanceof Model});if(s.length===1)s[0].intersectRaycaster(e,o);else{var u=e.sortByDistance;e.sortByDistance=!1;for(var l=0,c=s;l<c.length;l++){var p=c[l];p.visible&&p.intersectRaycaster(e,o)}e.sortByDistance=u,sortIntersects(o,e.sortByDistance,e.firstHitOnly)}return o},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 scratchBoundingBox3.equals(this.boundingBox)||(this.boundingBox.copy(scratchBoundingBox3),this.parameter.set("boundingBox",scratchBoundingBox3.clone())),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);function workInitialToJson(n){var t={};return typeof n.mode!="undefined"&&(t.mode=n.mode),typeof n.panoIndex!="undefined"&&(t.pano_index=n.panoIndex),typeof n.longitude!="undefined"&&(t.longitude=n.longitude),typeof n.latitude!="undefined"&&(t.latitude=n.latitude),typeof n.fov!="undefined"&&(t.fov=n.fov),typeof n.distance!="undefined"&&(t.distance=n.distance),typeof n.offset!="undefined"&&(t.offset=n.offset.toArray()),t}function workModelToJson(n){var t;if(n)return{file_url:n.file,material_base_url:n.textureBase,material_textures:(t=n.textures)===null||t===void 0?void 0:t.slice(),layers:n.layers.map(function(e){return{tileset_url:e.tileset,up_axis:e.upAxis,name:e.name,type:e.type}})}}function workObserverToObserverJson(n){return{index:n.index,floor_index:n.floorIndex,position:n.position.toArray(),standing_position:n.standingPosition.toArray(),quaternion:{x:n.quaternion.x,y:n.quaternion.y,z:n.quaternion.z,w:n.quaternion.w},visible_nodes:n.visibleNodes.slice(),accessible_nodes:n.accessibleNodes.slice()}}function workObserverToPanoramaJson(n){return{index:n.index,active:n.active,loadable:n.loadable,derived_id:n.derivedId,derived_id_str:n.derivedIdStr,size_list:n.images.sizeList.slice(),up:n.images.up,down:n.images.down,right:n.images.right,left:n.images.left,front:n.images.front,back:n.images.back,video:n.video?{matrix:n.video.matrix.toArray(),size:n.video.size.toArray(),source:n.video.source}:void 0}}function workToJson(n){return{allow_hosts:n.allowHosts.slice(),expire_at:n.expire.getTime().toString(),project_id:n.projectId,code:n.workCode,name:n.name,base_url:n.baseURL,initial:workInitialToJson(n.initial),model:workModelToJson(n.model),observers:n.observers.map(function(t){return workObserverToObserverJson(t)}),panorama:{count:n.observers.length,list:n.observers.map(function(t){return workObserverToPanoramaJson(t)})}}}function isNumber(n){return typeof n=="number"}function jsonClone(n){if(typeof n!="object"||n===null)return n;if(Array.isArray(n))return n.map(function(o){return typeof o!="object"||o===null?o:jsonClone(o)});var t={};for(var e in n){var r=n[e];t[e]=typeof r!="object"||r===null?r:jsonClone(r)}return t}function getType(n){return n==null?"null":Array.isArray(n)?"array":typeof n=="object"?"dict":"value"}function jsonMerge(n,t){var e=getType(n),r=getType(t);if(r==="null")return n;if(r==="value")return t;if(r!==e)return jsonClone(t);if(r==="array")for(var o=0;o<t.length;o++)n[o]=jsonMerge(n[o],t[o]);else if(r==="dict")for(var s in t)n[s]=jsonMerge(n[s],t[s]);return n}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 jsonStableStrinfiy(n){return jsonStableStrinfiy_(n,!1)}function jsonHash(n){return"hash::".concat(sha256(jsonStableStrinfiy(n)))}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)}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 URL_REGEXP=/^[0-9a-z]+\:\/\/(([^:/?#]*)(?::[0-9]+)?)/i,BUILDIN_ALLOW_HOST=deepFreeze(JSON.parse((function n(){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"))),domainRegex=/^([^.]+)(\.([^.]+))*$/,currentHostname=typeof location!="undefined"?location.hostname:"localhost";function isIPDomain(n){return/^(([1-9]?\d|1\d\d|2[0-4]\d|25[0-5])(\.(?!$)|$)){4}$/.test(n)}function matchDomain(n,t){if(!domainRegex.test(n)||!domainRegex.test(t))return!1;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 hostnameFromURL(n){if(/^blob\:/i.test(n)||/^data\:/i.test(n))return currentHostname;var t=n.match(URL_REGEXP);return t?t[2]:currentHostname}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,o={};try{o=typeof n=="string"?JSON.parse(n):n}catch(y){return error_invalid_input()}if(typeof o!="object")return error_invalid_input();var s=currentHostname,u=Date.now(),l=new Date(typeof o.expire_at=="string"&&/^\d+$/.test(o.expire_at)?Number(o.expire_at):o.expire_at),c=Array.isArray(o.allow_hosts)?o.allow_hosts:[];if(s.length===0||isIPDomain(s)||BUILDIN_ALLOW_HOST.filter(function(y){return matchDomain(y,s)}).length>0){var p=String((t=o.certificate)!==null&&t!==void 0?t:"");if(p)try{var f=new X509;return f.readCertPEM(p),deepFreeze({issuer:f.getSubjectString(),expire:l,allowHosts:c})}catch(y){var d=y instanceof Error?y.message:String(y);console.warn("[PARSE Error]: Invalid Certificate. "+d)}return deepFreeze({issuer:"none",expire:l,allowHosts:c})}var h=String((e=o.certificate)!==null&&e!==void 0?e:"");if(!h)return error_invalid_certificate();var m=new X509;m.readCertPEM(h);var A=String((r=o._signature)!==null&&r!==void 0?r:"");if(!A)return error_invalid_signature();var g=jsonStableNoneNumberStrinfiy(ObjectOmit(o,["_signature"]));return verifyMessage(g,A,m)===!1?error_invalid_signature():u<l.getTime()?BUILDIN_ALLOW_HOST.concat(c).filter(function(y){return matchDomain(y,s)}).length===0?error_host_not_allowed(s):deepFreeze({issuer:m.getSubjectString(),expire:l,allowHosts:c}):error_date_expired(l)}function verifyURL(n,t){var e=hostnameFromURL(n);return currentHostname.length!==0&&!isIPDomain(currentHostname)&&BUILDIN_ALLOW_HOST.filter(function(r){return matchDomain(r,currentHostname)}).length===0&&!isIPDomain(e)&&BUILDIN_ALLOW_HOST.concat(t).filter(function(r){return matchDomain(r,e)}).length===0?error_host_not_allowed(e):n}var PANO_TEXTURE_SCALE=new THREE__namespace.Vector3(1,1,1),FACE_ORDER$1=["right","left","up","down","front","back"];function relativeURL(n,t){if(!isAbsoluteURL(n))return n;if(n.indexOf(t)===0)return n.slice(t.length);var e=t.replace(/^https\:/,"http:");if(n.indexOf(e)===0)return n.slice(e.length);var r=t.replace(/^http\:/,"https:");return n.indexOf(r)===0?n.slice(r.length):(console.warn("".concat(n," is not start with base_url(").concat(t,").")),n)}function panoURL(n,t,e){return!isAbsoluteURL(n)&&typeof t=="string"&&t.length>0&&(n=pathJoin(t,String(e),n)),n}function getTileLevel(n){for(var t=10;t>=0;t--){var e=512*Math.pow(2,t);if(e<=n)return t}return null}function sortTile(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){for(var e,r,o,s,u,l,c,p,f,d,h,m,A,g,y,v,E,b=[],T=null,_=0,S=[].concat(n);_<S.length;_++){var R=S[_];if("getURL"in R)T={allowHosts:R.allowHosts,expire:R.expire,issuer:R.issuer},b.push(workToJson(R));else{var w=typeof R=="string"?JSON.parse(R):jsonClone(R),M=verify(w);if(M instanceof Error)return M;T===null&&(T=M),b.push(w)}}if(T===null)return new Error("Empty");defineProperty(t,"issuer",{enumerable:!0,configurable:!1,writable:!1,value:T.issuer}),defineProperty(t,"expire",{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze(T.expire)}),defineProperty(t,"allowHosts",{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze(T.allowHosts)});var B=b.reduce(function(V,J){return jsonMerge(V,J)});defineProperty(t,"name",{enumerable:!0,configurable:!1,writable:!1,value:String((e=B.name)!==null&&e!==void 0?e:"Unknown")}),defineProperty(t,"workCode",{enumerable:!0,writable:!0,value:String(B.resource_code||B.basic_code||B.vr_code||B.code||B.project_id||B.work_code||B.workCode||createUuid())}),defineProperty(t,"projectId",{enumerable:!0,writable:!0,value:B.project_id}),defineProperty(t,"baseURL",{enumerable:!0,writable:!0,value:(function(){var V,J=(V=B.base_url)!==null&&V!==void 0?V:"";return J&&J[J.length-1]!=="/"&&(J+="/"),J})()});var C=void 0;typeof B.model=="object"&&(C={},defineProperty(C,"work",{enumerable:!1,configurable:!1,writable:!1,value:t}),defineProperty(C,"file",{enumerable:!0,configurable:!1,writable:!1,value:(function(){var V=B.model.file_url;if(V)return relativeURL(V,t.baseURL)})()}),defineProperty(C,"textureBase",{enumerable:!0,configurable:!1,writable:!1,value:(function(){var V=B.model.material_base_url;return V&&(V=relativeURL(V,t.baseURL)),V})()}),defineProperty(C,"textures",{enumerable:!0,configurable:!1,writable:!1,value:(function(){var V=void 0;return Array.isArray(B.model.material_textures)&&(V=B.model.material_textures.slice(),Object.freeze(V)),V})()}),defineProperty(C,"layers",{enumerable:!0,configurable:!1,writable:!1,value:(function(){var V,J,W,X=[];if(Array.isArray(B.model.layers))for(var Z=0,Y=B.model.layers;Z<Y.length;Z++){var K=Y[Z];if(K&&K.tileset_url){var ee={};defineProperty(ee,"work",{enumerable:!1,configurable:!1,writable:!1,value:t}),defineProperty(ee,"name",{enumerable:!0,configurable:!1,writable:!1,value:(V=K.name)!==null&&V!==void 0?V:""}),defineProperty(ee,"type",{enumerable:!0,configurable:!1,writable:!1,value:(J=K.type)!==null&&J!==void 0?J:"mesh"}),defineProperty(ee,"upAxis",{enumerable:!0,configurable:!1,writable:!1,value:(W=K.up_axis)!==null&&W!==void 0?W:"Z"}),defineProperty(ee,"tileset",{enumerable:!0,configurable:!1,writable:!1,value:relativeURL(K.tileset_url,t.baseURL)}),X.push(ee)}}if(typeof B.model.tiles=="object"){var K=B.model.tiles;if(K&&K.tileset_url){var ee={};defineProperty(ee,"work",{enumerable:!1,configurable:!1,writable:!1,value:t}),defineProperty(ee,"name",{enumerable:!0,configurable:!1,writable:!1,value:"lod"}),defineProperty(ee,"type",{enumerable:!0,configurable:!1,writable:!1,value:"mesh"}),defineProperty(ee,"upAxis",{enumerable:!0,configurable:!1,writable:!1,value:"-Y"}),defineProperty(ee,"tileset",{enumerable:!0,configurable:!1,writable:!1,value:relativeURL(K.tileset_url,t.baseURL)}),X.push(ee)}}return Object.freeze(X)})()})),defineProperty(t,"model",{enumerable:!0,configurable:!1,writable:!1,value:C});var P=[];if(Array.isArray(B.observers)&&B.panorama&&Array.isArray(B.panorama.list||B.panorama.info))for(var L=B.observers,O=(r=B.panorama.list||B.panorama.info)!==null&&r!==void 0?r:[],F=(p=(l=(s=(o=B.panorama)===null||o===void 0?void 0:o.pano_high_cube_base_url)!==null&&s!==void 0?s:(u=B.panorama)===null||u===void 0?void 0:u.pano_cube_base_url)!==null&&l!==void 0?l:(c=B.panorama)===null||c===void 0?void 0:c.base_url)!==null&&p!==void 0?p:"",N=Math.min(L.length,O.length),D=function(V){var J=L[V],W=O[V],X={};defineProperty(X,"work",{enumerable:!1,configurable:!1,writable:!1,value:t}),defineProperty(X,"index",{enumerable:!0,configurable:!1,writable:!1,value:V}),defineProperty(X,"panoIndex",{enumerable:!0,configurable:!1,writable:!1,value:V}),defineProperty(X,"panoId",{enumerable:!0,configurable:!1,writable:!1,value:panoStringify({workCode:t.workCode,panoIndex:V})}),defineProperty(X,"derivedId",{enumerable:!0,configurable:!1,writable:!1,value:(f=J.derived_id)!==null&&f!==void 0?f:W.derived_id}),defineProperty(X,"floorIndex",{enumerable:!0,configurable:!1,writable:!1,value:(d=J.floor_index)!==null&&d!==void 0?d:J.floor}),defineProperty(X,"derivedId",{enumerable:!0,configurable:!1,writable:!1,value:(h=J.derived_id)!==null&&h!==void 0?h:W.derived_id}),defineProperty(X,"derivedIdStr",{enumerable:!0,configurable:!1,writable:!1,value:(m=J.derived_id_str)!==null&&m!==void 0?m:W.derived_id_str}),defineProperty(X,"active",{enumerable:!0,configurable:!1,writable:!1,value:J.active!==!1&&W.active!==!1}),defineProperty(X,"loadable",{enumerable:!0,configurable:!1,writable:!1,value:(g=(A=J.active)!==null&&A!==void 0?A:W.active)!==null&&g!==void 0?g:!1}),defineProperty(X,"position",{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze(new THREE__namespace.Vector3().fromArray((y=J.position)!==null&&y!==void 0?y:[0,0,0]))}),defineProperty(X,"standingPosition",{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze(new THREE__namespace.Vector3().fromArray((E=(v=J.standing_position)!==null&&v!==void 0?v:J.standingPosition)!==null&&E!==void 0?E:[0,0,0]))}),defineProperty(X,"quaternion",{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze(new THREE__namespace.Quaternion().fromArray(J.quaternion?[J.quaternion.x,J.quaternion.y,J.quaternion.z,J.quaternion.w]:[0,0,0,1]))}),defineProperty(X,"matrix",{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze(new THREE__namespace.Matrix4().compose(X.position,X.quaternion,PANO_TEXTURE_SCALE))}),defineProperty(X,"accessibleNodes",{enumerable:!0,configurable:!1,writable:!1,value:(function(){var Z,Y,K=((Y=(Z=J.accessible_nodes)!==null&&Z!==void 0?Z:J.accessibleNodes)!==null&&Y!==void 0?Y:[]).filter(function(te){return te<N});if(K.length===0)for(var ee=0;ee<N;ee++)ee!==V&&K.push(ee);return Object.freeze(K)})()}),defineProperty(X,"visibleNodes",{enumerable:!0,configurable:!1,writable:!1,value:(function(){var Z,Y,K=((Y=(Z=J.visible_nodes)!==null&&Z!==void 0?Z:J.visibleNodes)!==null&&Y!==void 0?Y:[]).filter(function(te){return te<N});if(K.length===0)for(var ee=0;ee<N;ee++)ee!==V&&K.push(ee);return Object.freeze(K)})()}),defineProperty(X,"images",{enumerable:!0,configurable:!1,writable:!1,value:(function(){var Z={};defineProperty(Z,"work",{enumerable:!1,configurable:!1,writable:!1,value:t});for(var Y=0,K=FACE_ORDER$1;Y<K.length;Y++){var ee=K[Y];defineProperty(Z,ee,{enumerable:!0,configurable:!1,writable:!1,value:relativeURL(panoURL(W[ee],F,V),t.baseURL)})}return defineProperty(Z,"sizeList",{enumerable:!0,configurable:!1,writable:!1,value:(function(){var te=getImageSizeFromURL(Z[FACE_ORDER$1[0]]);if(te){if(W.size_list){var re=W.size_list.slice().sort(function(ye,_e){return ye-_e});return Object.freeze(re)}else if(W.tiles){for(var re=[te],ae=W.tiles.slice().sort(function(_e,le){return _e-le}),ce=0,ie=ae;ce<ie.length;ce++){var fe=ie[ce],ge=512*Math.pow(2,fe);ge>te&&re.push(ge)}return Object.freeze(re)}}return Object.freeze([])})()}),defineProperty(Z,"tiles",{enumerable:!0,configurable:!1,writable:!1,value:(function(){var te=getImageSizeFromURL(Z.front);if(te){var re=Z.sizeList.slice();if(re[0]){var ae=getTileLevel(re[0]);if(ae)for(var ce=ae-1;ce>=0;ce--)re.unshift(512*Math.pow(2,ce))}if(!(re.length<=0)){for(var ie=[],fe=0,ge=re;fe<ge.length;fe++){var ye=ge[fe],_e=getTileLevel(ye);if(typeof _e=="number"){var le={};if(defineProperty(le,"work",{enumerable:!1,configurable:!1,writable:!1,value:t}),defineProperty(le,"level",{enumerable:!0,configurable:!1,writable:!1,value:_e}),ye>te){defineProperty(le,"size",{enumerable:!0,configurable:!1,writable:!1,value:ye}),defineProperty(le,"scale",{enumerable:!0,configurable:!1,writable:!1,value:1});for(var de=0,ne=FACE_ORDER$1;de<ne.length;de++){var se=ne[de];defineProperty(le,se,{enumerable:!0,configurable:!1,writable:!1,value:replaceImageSize(Z[se],ye)})}}else{defineProperty(le,"size",{enumerable:!0,configurable:!1,writable:!1,value:te}),defineProperty(le,"scale",{enumerable:!0,configurable:!1,writable:!1,value:ye/te});for(var he=0,me=FACE_ORDER$1;he<me.length;he++){var se=me[he];defineProperty(le,se,{enumerable:!0,configurable:!1,writable:!1,value:Z[se]})}}ie.push(le)}}return ie=sortTile(ie),Object.freeze(ie)}}})()}),Z})()}),defineProperty(X,"video",{enumerable:!0,configurable:!1,writable:!1,value:(function(){var Z=void 0;return W.video&&(Z={},defineProperty(Z,"work",{enumerable:!1,configurable:!1,writable:!1,value:t}),defineProperty(Z,"source",{enumerable:!0,configurable:!1,writable:!1,value:W.video.source}),defineProperty(Z,"matrix",{enumerable:!0,configurable:!1,writable:!1,value:new THREE__namespace.Matrix4().fromArray(W.video.matrix)}),defineProperty(Z,"size",{enumerable:!0,configurable:!1,writable:!1,value:new THREE__namespace.Vector2().fromArray(W.video.size)})),Z})()}),P.push(X)},U=0;U<N;U++)D(U);defineProperty(t,"observers",{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze(P)});var z={};if(defineProperty(z,"work",{enumerable:!1,configurable:!1,writable:!1,value:t}),B.initial){if(t.observers.length>0){var G=void 0;isNumber(B.initial.panoIndex)?G=B.initial.panoIndex:isNumber(B.initial.pano_index)?G=B.initial.pano_index:isNumber(B.initial.pano)&&(G=B.initial.pano),typeof G=="number"&&(G=clamp$1(G,0,t.observers.length-1),defineProperty(z,"panoIndex",{enumerable:!0,writable:!0,value:G}))}if(B.initial.mode==="Panorama"&&t.observers.length===0||B.initial.mode==="Floorplan"||B.initial.mode==="Topview"||B.initial.mode==="Model"||B.initial.mode==="Mapview"?defineProperty(z,"mode",{enumerable:!0,writable:!0,value:B.initial.mode}):typeof z.panoIndex=="number"?defineProperty(z,"mode",{enumerable:!0,writable:!0,value:"Panorama"}):defineProperty(z,"mode",{enumerable:!0,writable:!0,value:"Mapview"}),isNumber(B.initial.latitude)&&defineProperty(z,"latitude",{enumerable:!0,writable:!0,value:B.initial.latitude}),isNumber(B.initial.longitude)?defineProperty(z,"longitude",{enumerable:!0,writable:!0,value:B.initial.longitude}):isNumber(B.initial.heading)&&defineProperty(z,"longitude",{enumerable:!0,writable:!0,value:headingToLongitude(B.initial.heading)}),isNumber(B.initial.fov)&&defineProperty(z,"fov",{enumerable:!0,writable:!0,value:B.initial.fov}),isNumber(B.initial.distance)&&defineProperty(z,"distance",{enumerable:!0,writable:!0,value:B.initial.distance}),Array.isArray(B.initial.offset)){var j=B.initial.offset,Q=[0,0,0].map(function(V,J){var W=Number(j[J]);return isNaN(W)||!isFinite(W)?0:W});defineProperty(z,"offset",{enumerable:!0,writable:!0,value:new THREE__namespace.Vector3().fromArray(Q)})}else typeof B.initial.offset=="object"&&typeof B.initial.offset.x=="number"&&typeof B.initial.offset.y=="number"&&typeof B.initial.offset.z=="number"&&defineProperty(z,"offset",{enumerable:!0,writable:!0,value:new THREE__namespace.Vector3().fromArray([B.initial.offset.x,B.initial.offset.y,B.initial.offset.z])})}return defineProperty(t,"initial",{enumerable:!0,configurable:!1,writable:!1,value:z}),t}function parseNull(n,t){return defineProperty(t,"issuer",{enumerable:!0,configurable:!1,writable:!1,value:"null"}),defineProperty(t,"expire",{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze(new Date)}),defineProperty(t,"allowHosts",{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze(["*"])}),defineProperty(t,"name",{enumerable:!0,configurable:!1,writable:!1,value:"Null"}),defineProperty(t,"workCode",{enumerable:!0,value:createUuid()}),defineProperty(t,"baseURL",{enumerable:!0,value:"/"}),defineProperty(t,"model",{enumerable:!0,configurable:!1,writable:!1,value:void 0}),defineProperty(t,"observers",{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze([])}),defineProperty(t,"initial",{enumerable:!0,configurable:!1,writable:!1,value:(function(){var e={};return defineProperty(e,"work",{enumerable:!1,configurable:!1,writable:!1,value:t}),defineProperty(e,"mode",{enumerable:!0,writable:!0,value:"Mapview"}),e})()}),t}function parsePano(n,t){var e,r;return defineProperty(t,"issuer",{enumerable:!0,configurable:!1,writable:!1,value:"null"}),defineProperty(t,"expire",{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze(new Date)}),defineProperty(t,"allowHosts",{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze(["*"])}),defineProperty(t,"name",{enumerable:!0,configurable:!1,writable:!1,value:String((e=n.name)!==null&&e!==void 0?e:"Unknown")}),defineProperty(t,"workCode",{enumerable:!0,writable:!0,value:(r=n.code)!==null&&r!==void 0?r:createUuid()}),defineProperty(t,"baseURL",{enumerable:!0,writable:!0,value:"/"}),defineProperty(t,"model",{enumerable:!0,configurable:!1,writable:!1,value:void 0}),defineProperty(t,"observers",{enumerable:!0,configurable:!1,writable:!1,value:(function(){var o={};return defineProperty(o,"work",{enumerable:!1,configurable:!1,writable:!1,value:t}),defineProperty(o,"index",{enumerable:!0,configurable:!1,writable:!1,value:0}),defineProperty(o,"panoIndex",{enumerable:!0,configurable:!1,writable:!1,value:0}),defineProperty(o,"panoId",{enumerable:!0,configurable:!1,writable:!1,value:panoStringify({workCode:t.workCode,panoIndex:0})}),defineProperty(o,"floorIndex",{enumerable:!0,configurable:!1,writable:!1,value:0}),defineProperty(o,"derivedId",{enumerable:!0,configurable:!1,writable:!1,value:void 0}),defineProperty(o,"derivedIdStr",{enumerable:!0,configurable:!1,writable:!1,value:void 0}),defineProperty(o,"active",{enumerable:!0,configurable:!1,writable:!1,value:!0}),defineProperty(o,"loadable",{enumerable:!0,configurable:!1,writable:!1,value:!1}),defineProperty(o,"position",{enumerable:!0,configurable:!1,writable:!1,value:new THREE__namespace.Vector3(0,1.5,0)}),defineProperty(o,"standingPosition",{enumerable:!0,configurable:!1,writable:!1,value:new THREE__namespace.Vector3(0,0,0)}),defineProperty(o,"quaternion",{enumerable:!0,configurable:!1,writable:!1,value:new THREE__namespace.Quaternion(0,1,0,0)}),defineProperty(o,"matrix",{enumerable:!0,configurable:!1,writable:!1,value:new THREE__namespace.Matrix4().compose(o.position,o.quaternion,PANO_TEXTURE_SCALE)}),defineProperty(o,"accessibleNodes",{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze([])}),defineProperty(o,"visibleNodes",{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze([])}),defineProperty(o,"images",{enumerable:!0,configurable:!1,writable:!1,value:(function(){var s={};defineProperty(s,"work",{enumerable:!1,configurable:!1,writable:!1,value:t});for(var u=0,l=FACE_ORDER$1;u<l.length;u++){var c=l[u];defineProperty(s,c,{enumerable:!0,configurable:!1,writable:!1,value:n[c]})}return defineProperty(s,"sizeList",{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze([n.size])}),defineProperty(s,"tiles",{enumerable:!0,configurable:!1,writable:!1,value:(function(){var p=getImageSizeFromURL(s.front);if(p){var f=s.sizeList.slice();if(f[0]){var d=getTileLevel(f[0]);if(d)for(var h=d-1;h>=0;h--)f.unshift(512*Math.pow(2,h))}if(!(f.length<=0)){for(var m=[],A=0,g=f;A<g.length;A++){var y=g[A],v=getTileLevel(y);if(typeof v=="number"){var E={};if(defineProperty(E,"work",{enumerable:!1,configurable:!1,writable:!1,value:t}),defineProperty(E,"level",{enumerable:!0,configurable:!1,writable:!1,value:v}),y>p){defineProperty(E,"size",{enumerable:!0,configurable:!1,writable:!1,value:y}),defineProperty(E,"scale",{enumerable:!0,configurable:!1,writable:!1,value:1});for(var b=0,T=FACE_ORDER$1;b<T.length;b++){var _=T[b];defineProperty(E,_,{enumerable:!0,configurable:!1,writable:!1,value:replaceImageSize(s[_],y)})}}else{defineProperty(E,"size",{enumerable:!0,configurable:!1,writable:!1,value:p}),defineProperty(E,"scale",{enumerable:!0,configurable:!1,writable:!1,value:y/p});for(var S=0,R=FACE_ORDER$1;S<R.length;S++){var _=R[S];defineProperty(E,_,{enumerable:!0,configurable:!1,writable:!1,value:s[_]})}}m.push(E)}}return m=sortTile(m),Object.freeze(m)}}})()}),s})()}),defineProperty(o,"video",{enumerable:!0,configurable:!1,writable:!1,value:void 0}),Object.freeze([o])})()}),defineProperty(t,"initial",{enumerable:!0,configurable:!1,writable:!1,value:(function(){var o={};return defineProperty(o,"work",{enumerable:!1,configurable:!1,writable:!1,value:t}),defineProperty(o,"mode",{enumerable:!0,writable:!0,value:"Panorama"}),defineProperty(o,"panoIndex",{enumerable:!0,writable:!0,value:0}),o})()}),t}var workVerifySet=new WeakSet,hrefAElement=typeof document!="undefined"?document.createElement("a"):{href:""},Work=(function(){function n(t,e){this.observerBox=new THREE__namespace.Box3,this.observerBox=new THREE__namespace.Box3,this.transform=new THREE__namespace.Matrix4,this.shortPath=!1,this.jsonp=!1;var r;if(t!==null?typeof t=="object"&&typeof t.size=="number"&&typeof t.up=="string"&&typeof t.down=="string"&&typeof t.right=="string"&&typeof t.left=="string"&&typeof t.front=="string"&&typeof t.back=="string"?r=parsePano(t,this):r=parse(t,this):r=parseNull(t,this),r instanceof Error)throw new Error("[PARSE FAILED]: "+r.message+`
1026
+ `,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,m=0;m<=e;m++){h=n.getPointAt(m/e,h);for(var A=c.normals[m],g=c.binormals[m],y=0;y<=r;y++){var v=m*(r+1)+y,E=y/r*Math.PI*2,b=Math.sin(E),T=-Math.cos(E);f.x=T*A.x+b*g.x,f.y=T*A.y+b*g.y,f.z=T*A.z+b*g.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=m/e,d.y=y/r,d.toArray(u,v*2)}}for(var m=0;m<e;m++)for(var y=0;y<r;y++){var _=(m*r+y)*6,S=(r+1)*m+y,R=(r+1)*(m+1)+y,w=(r+1)*(m+1)+(y+1),M=(r+1)*m+(y+1);l[_]=S,l[_+1]=R,l[_+2]=M,l[_+3]=R,l[_+4]=w,l[_+5]=M}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 m=.03,A=Math.ceil(u*100),g=6,y=createPipeBufferGeometry(l,m,A,g);y.clearGroups(),y.addGroup(0,y.index?y.index.count:y.attributes.position.count,0),y.addGroup(0,y.index?y.index.count:y.attributes.position.count,1),y.addGroup(0,y.index?y.index.count:y.attributes.position.count,2);var 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 E=new THREE__namespace.ShaderMaterial({vertexShader:TRAJECTOR_PIPE_SHADER.vertexShader,fragmentShader:TRAJECTOR_PIPE_SHADER.fragmentShader,uniforms:THREE__namespace.UniformsUtils.clone(TRAJECTOR_PIPE_SHADER.uniforms),side:THREE__namespace.BackSide});E.uniforms.totalLength.value=u,E.uniforms.displacementScalar.value=-.01,E.uniforms.diffuse.value=r,E.uniforms.diffuse2.value=o;var b=new THREE__namespace.ShaderMaterial({vertexShader:TRAJECTOR_PIPE_SHADER.vertexShader,fragmentShader:TRAJECTOR_PIPE_SHADER.fragmentShader,uniforms:THREE__namespace.UniformsUtils.clone(TRAJECTOR_PIPE_SHADER.uniforms),side:THREE__namespace.DoubleSide});b.uniforms.totalLength.value=u,b.uniforms.displacementScalar.value=-.026,b.uniforms.dashSize.value=new THREE__namespace.Vector2(.06,.09),b.uniforms.diffuse.value=s,b.uniforms.diffuse2.value=s;var T=new THREE__namespace.Mesh(y,[v,E,b]),_=.08,S=24,R=new THREE__namespace.SphereBufferGeometry(_,S,S);R.clearGroups(),R.addGroup(0,y.index?y.index.count:y.attributes.position.count,0),R.addGroup(0,y.index?y.index.count:y.attributes.position.count,1);var w=new THREE__namespace.ShaderMaterial({vertexShader:TRAJECTOR_SPHERE_SHADER.vertexShader,fragmentShader:TRAJECTOR_SPHERE_SHADER.fragmentShader,uniforms:THREE__namespace.UniformsUtils.clone(TRAJECTOR_SPHERE_SHADER.uniforms),side:THREE__namespace.BackSide});w.uniforms.diffuse.value=e,w.uniforms.opacity.value=.5,w.transparent=!0;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.FrontSide});M.uniforms.displacementScalar.value=-.01,M.uniforms.diffuse.value=r;var B=new THREE__namespace.Mesh(R,[w,M]);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 P=new THREE__namespace.Mesh(R,[w,C]);return P.position.fromArray(n,n.length-3),T.add(P),{scene:T,dispose:function(){y.dispose(),v.dispose(),E.dispose(),b.dispose(),R.dispose(),w.dispose(),M.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,m=s.memoryUsage,A=parseTrajectoryObject(d);A.scene.applyMatrix4(n.transform),A.scene.updateWorldMatrix(!1,!0),A.scene.matrixAutoUpdate=!1;var g=new TrajectoryNode(e,A.scene);return n.content.data={uri:o,byteLength:h,memoryUsage:m,positionArray:d,timeArray:f,object:g},n.content.byteLength=h,n.content.memoryUsage=m,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$7=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,m=(o*o/(a*a)*f+r)*u;return n.set(d,h,m)}function getEcefToEnuMatrix(n,t){var e=ecefToLla(scratchVector3$7.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$7.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$6=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},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;function cloneSkipBackfaceObject(n){var t;n instanceof THREE__namespace.Mesh?t=new THREE__namespace.Mesh(n.geometry,Array.isArray(n.material)?n.material.map(function(s){return s.transparent?SKIP_BACKFACE_TRANSPARENT_MATERIAL:SKIP_BACKFACE_MATERIAL}):n.material&&n.material.transparent?SKIP_BACKFACE_TRANSPARENT_MATERIAL:SKIP_BACKFACE_MATERIAL):n instanceof THREE__namespace.Group?t=new THREE__namespace.Group:t=new THREE__namespace.Object3D,t.position.copy(n.position),t.quaternion.copy(n.quaternion),t.scale.copy(n.scale),t.matrix.compose(n.position,n.quaternion,n.scale),t.matrixAutoUpdate=!1,t.frustumCulled=n.frustumCulled,t.visible=n.visible;for(var e=0,r=n.children;e<r.length;e++){var o=r[e];t.add(cloneSkipBackfaceObject(o))}return t}var 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){var o=this,s,u,l=r!=null?r:[],c=[this.tileset.root],p=this.tileset.transform,f=(u=(s=e.params.Points)===null||s===void 0?void 0:s.threshold)!==null&&u!==void 0?u:0,d=e.hitFilter;e.hitFilter=function(T){var _;return Object.assign(T,{model:(_=o.parent)!==null&&_!==void 0?_:void 0,viewLayer:o}),d?d.call(e,T):!0};var h=e.sortByDistance;e.sortByDistance=!1;for(var m,A=1/0;m=c.pop();){var g=void 0;if(m.boundingVolume){var y=void 0;m.boundingVolume instanceof BoxBoundingVolume?y=scratchBoxBoundingVolume.copy(m.boundingVolume):m.boundingVolume instanceof SphereBoundingVolume?y=scratchSphereBoundingVolume.copy(m.boundingVolume):y=m.boundingVolume.clone(),y.applyMatrix4(p),g=y.intersectRay(e.ray,f,A)}else g=!0;if(g){for(var v=0,E=m.children.length;v<E;v++)c.push(m.children[v]);if(m.selected&&m.content&&m.content.data&&m.content.data.object.visible&&(m.content.data.object.intersectRaycaster(e,l),e.firstHitOnly)){var b=l[0];b&&A>b.distance&&(A=b.distance)}}}return e.hitFilter=d,e.sortByDistance=h,sortIntersects(l,e.sortByDistance,e.firstHitOnly),l},t.prototype.update=function(e,r,o,s){var u,l,c=this,p,f,d,h,m;this.renderer=e,this.frameNumber++;var A=!1,g=this.parameter.resolveValue(o.parameter,s.parameter);parameterVersionMap.get(this)!==g.version&&(parameterVersionMap.set(this,g.version),A=!0);var y=g.maxLevelOfDetail;y=Math.max(y,0);var v=Math.min(g.minLevelOfDetail,y);(!this.visible||!this.loaded||!o.loaded)&&(y=Math.max(v,0));var E=g.minGeometricError,b=r.controllerMode;(b==="Panorama"||b==="VRPanorama"||b==="XRPanorama")&&g.modelAlpha<.1&&(E=g.panoramaMinGeometricError);var T=g.maxGeometricError;T=Math.max(E,T);var _={time:r.time,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:v,maxLevelOfDetail:y,minGeometricError:E,maxGeometricError:T,skipLevelOfDetail:g.skipLevelOfDetail,mostDetail:g.mostDetail,loadSiblings:g.loadSiblings,cameraCulling:g.cameraCulling,maxMemoryUsage:g.maxMemoryUsage,maxRequests:g.maxRequests,requestOrder:g.requestOrder,maxScreenSpaceError:g.maxScreenSpaceError,memoryAdjustedOverflow:g.memoryAdjustedOverflow,memoryAdjustedScreenSpaceError:g.memoryAdjustedScreenSpaceError},S=g.cacheCameras.map(function(re){return re.updateProjectionMatrix(),__assign(__assign({},_),{camera:{type:r.type,position:new THREE__namespace.Vector3().copy(re.position),direction:re.getWorldDirection(new THREE__namespace.Vector3),up:new THREE__namespace.Vector3().copy(re.up),projectionMatrix:re.projectionMatrix.clone(),visible:re.visible,refine:!0},cullingVolume:new CullingVolume().setFromCamera(re)})});this.updateWorldMatrix(!0,!1),this.tileset.transform.equals(this.matrixWorld)||(this.tileset.transform.copy(this.matrixWorld),A=!0);var R=!this.autoRefine;if(R===!1){var w=g.progress>.01&&g.progress<.99;if(w){var M=new THREE__namespace.Vector3;g.pano0&&M.setFromMatrixPosition(g.pano0.matrix);var B=M.clone();g.pano1&&B.setFromMatrixPosition(g.pano1.matrix),M.distanceTo(B)<10&&(R=!0)}}if(R||this.tileset.update(_,S),this.refined=!0,this.refineProgress[0]=0,this.refineProgress[1]=0,this.tileset.needsRefinedTiles.forEach(function(re){if(c.refineProgress[1]++,re.content){var se=re.content.loadState;if(se==="UNLOADED"||se==="LOADING"){c.refined=!1;return}}c.refineProgress[0]++}),this.loaded===!1&&this.autoRefine){this.loaded=!0;var C=!1;this.tileset.needsRefinedTiles.forEach(function(re){if(c.loaded!==!1&&re.content){if(re.state.visible&&(C=!0),_.skipLevelOfDetail){if(re.state.finalResolution){var se=re.state.ancestorWithContentAvailable,he=se&&se.content?se.content:re.content,me=he.loadState;(me==="UNLOADED"||me==="LOADING")&&(c.loaded=!1)}}else if(re.state.visible&&re.levelOfContent<=0){var me=re.content.loadState;(me==="UNLOADED"||me==="LOADING")&&(c.loaded=!1)}}}),C&&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),_.skipLevelOfDetail||this.tileset.selectedTiles.sort(function(re,se){return re.floor!==se.floor?re.floor-se.floor:re.levelOfContent!==se.levelOfContent?se.levelOfContent-re.levelOfContent:re.state.distanceToCamera!==se.state.distanceToCamera?re.state.distanceToCamera-se.state.distanceToCamera:re.state.centerZDepth-se.state.centerZDepth});for(var P=[],L=0,O=this.tileset.selectedTiles;L<O.length;L++){var F=O[L],N=(f=(p=F.content)===null||p===void 0?void 0:p.data)===null||f===void 0?void 0:f.object;if(N){var D=N.update(e,r,o,this,F,g);if(P.push(F.id),D&&(A=!0),this.tileset.hasMixedContent&&_.skipLevelOfDetail){if(!F.state.finalResolution){var U=cloneSkipBackfaceObject(N);U.name="skipBackface:"+N.name,this.backfaceObjects.push(U)}for(var z=F.state.selectionDepth,K=STENCIL_CONSTANT.TILE_MASK|z<<STENCIL_CONSTANT.SKIP_LOD_BIT_SHIFT,j=THREE__namespace.GreaterEqualStencilFunc,Q=STENCIL_CONSTANT.SKIP_LOD_MASK,V=THREE__namespace.ReplaceStencilOp,J=STENCIL_CONSTANT.TILE_MASK|STENCIL_CONSTANT.SKIP_LOD_MASK,W=0,X=N.materials;W<X.length;W++){var Z=X[W];Z.stencilWrite=!0,Z.stencilRef=K,Z.stencilFunc=j,Z.stencilFuncMask=Q,Z.stencilZPass=V,Z.stencilWriteMask=J}}else for(var Y=0,G=N.materials;Y<G.length;Y++){var Z=G[Y];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(N)}}var ee=P.toString();tileVersionMap.get(this)!==ee&&(tileVersionMap.set(this,ee),A=!0),_.skipLevelOfDetail&&this.backfaceObjects.length&&(u=this.renderObjects).push.apply(u,this.backfaceObjects),this.tileObjects.length&&(l=this.renderObjects).push.apply(l,this.tileObjects),_.skipLevelOfDetail&&this.renderObjects.push(this.clearStencilObject);for(var te=[],ne=0,ae=this.tileset.selectedTrajectories;ne<ae.length;ne++){var ce=ae[ne],ie=(d=ce.content.data)===null||d===void 0?void 0:d.object;if(ie){var D=ie.update(e,r,o,this,ce,g);te.push(ce.id),D&&(A=!0),this.renderObjects.push(ie)}}var fe=te.toString();trajectoryVersionMap.get(this)!==fe&&(trajectoryVersionMap.set(this,fe),A=!0);for(var ge=Math.min(0,((m=(h=this.parent)===null||h===void 0?void 0:h.children)!==null&&m!==void 0?m:[]).indexOf(this)),ye=ge*1e4,_e=function(re){var se=le.renderObjects[re],he=re+ye;se.traverse(function(me){(me instanceof THREE__namespace.Mesh||me instanceof THREE__namespace.Line||me instanceof THREE__namespace.Points)&&(me.renderOrder=he)}),le.add(se)},le=this,de=0;de<this.renderObjects.length;de++)_e(de);return A},t.prototype.dispose=function(){this.disposed=!0,this.tileset.reset(),this.tileset.root.children.length=0,/^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,this.error=null,this.onError=void 0,this.renderer=void 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$6.setScalar(0);var e=this.localToLla(scratchVector3$6),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$6.copy(e),this.worldToLla(scratchVector3$6),{latitude:scratchVector3$6.x,longitude:scratchVector3$6.y,altitude:scratchVector3$6.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),fetcherMap=new WeakMap;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$5=new THREE__namespace.Vector3,scratchMatrix4$2=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=n.work.getURL(r),l=u.split("#"),c=l[0],p=l[1],f=(e=(p||c).split("?")[1])!==null&&e!==void 0?e:"";return t.fetcher.ajax(u,{responseType:"text"}).catch(function(d){return{error:d,body:JSON.stringify({asset:{version:"0.0"},geometricError:0,root:{geometricError:0}})}}).then(function(d){var h,m="error"in d?d.error:null,A=normalizeTilesetHeader(JSON.parse(d.body),u),g=A.root,y=A.rootMeta,v=y===void 0?{}:y,E=n.upAxis;v.upAxis&&v.upAxis!==E&&(E=v.upAxis),"lodVersion"in A&&(E="-Y","floorInfo"in A&&(A.properties=A.properties||{},A.properties.floorInfo=A.floorInfo.map(function(w){return{ground:-w.ground,height:w.height}}),A.floorInfo=void 0),A.asset.tilesetVersion=String(A.lodVersion),A.lodVersion=void 0);var b=g.boundingVolume?makeBoundingVolume(g.boundingVolume):void 0;b&&g.transform&&b.applyMatrix4(scratchMatrix4$2.fromArray(g.transform));var T=null,_=new THREE__namespace.Matrix4,S=new THREE__namespace.Matrix4;v.coordinate?(T=v.coordinate.ground_height,_.fromArray(v.coordinate.pose_ecef_to_enu),S.fromArray(v.coordinate.pose_enu_to_ecef)):(b?b.getCenter(scratchVector3$5):scratchVector3$5.setScalar(0),getEcefToEnuMatrixFromUpAxis(E,scratchVector3$5,_),S.getInverse(_)),A.root={refine:(h=g.refine)!==null&&h!==void 0?h:"REPLACE",geometricError:g.geometricError,transform:scratchMatrix4$2.copy(_).premultiply(enuToLocalMatrix).toArray(),boundingVolume:b?b.toJson():void 0,children:[g]};var R=new Tile3D(A,{name:o,type:s,upAxis:E,light:t.light,fetcher:t.fetcher,search:f,groundHeight:T,enuToEcefMatrix:S,ecefToEnuMatrix:_,error:m});return R})}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.work.getURL(n.file)},extras:(e={},e[p]={textureBaseUri:typeof n.textureBase=="string"?n.work.getURL(n.textureBase):void 0,textureArray:n.textures,textureOptions:(r=t.textureOptions)!==null&&r!==void 0?r:{}},e)}});o.push({work:n.work,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})})}function createSimpleBoxBufferGeometry(n,t,e){n===void 0&&(n=1),t===void 0&&(t=1),e===void 0&&(e=1);var r=n/2,o=t/2,s=e/2,u=new Float32Array([-r,+o,+s,+r,+o,+s,+r,+o,-s,-r,+o,-s,-r,-o,+s,+r,-o,+s,+r,-o,-s,-r,-o,-s]),l=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]),c=new THREE__namespace.BufferGeometry;return c.setAttribute("position",new THREE__namespace.BufferAttribute(u,3)),c.setIndex(new THREE__namespace.BufferAttribute(l,1)),c.addGroup(0,c.index.count,0),c.computeBoundingBox(),c.computeBoundingSphere(),c}function mergeBufferGeometries(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;c<n.length;++c){var p=n[c];if(e!==(p.index!==null))return null;for(var f in p.attributes){if(!r.has(f))return null;s[f]===void 0&&(s[f]=[]),s[f].push(p.attributes[f])}for(var f in p.morphAttributes){if(!o.has(f))return null;u[f]===void 0&&(u[f]=[]),u[f].push(p.morphAttributes[f])}l.userData.mergedUserData=l.userData.mergedUserData||[],l.userData.mergedUserData.push(p.userData)}if(e){for(var d=0,h=[],c=0;c<n.length;++c){for(var m=n[c].index,A=0;A<m.count;++A)h.push(m.getX(A)+d);d+=n[c].attributes.position.count}l.setIndex(h)}for(var f in s){var g=mergeBufferAttributes(s[f]);if(!g)return null;l.setAttribute(f,g)}for(var f in u){var y=u[f][0].length;if(y===0)break;l.morphAttributes=l.morphAttributes||{},l.morphAttributes[f]=[];for(var c=0;c<y;++c){for(var v=[],A=0;A<u[f].length;++A)v.push(u[f][A][c]);var E=mergeBufferAttributes(v);if(!E)return null;l.morphAttributes[f].push(E)}}return l}function mergeBufferAttributes(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)}function mergeVertices(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,m=l.length;h<m;h++){var A=l[h];c[A]=[];var g=n.morphAttributes[A];g&&(p[A]=new Array(g.length).fill().map(function(){return[]}))}for(var y=Math.log10(1/t),v=Math.pow(10,y),h=0;h<s;h++){for(var E=r?r.getX(h):h,b="",T=0,m=l.length;T<m;T++)for(var A=l[T],_=n.getAttribute(A),S=_.itemSize,R=0;R<S;R++)b+="".concat(~~(_[d[R]](E)*v),",");if(b in e)f.push(e[b]);else{for(var T=0,m=l.length;T<m;T++)for(var A=l[T],_=n.getAttribute(A),g=n.morphAttributes[A],S=_.itemSize,w=c[A],M=p[A],R=0;R<S;R++){var B=d[R];if(w.push(_[B](E)),g)for(var C=0,P=g.length;C<P;C++)M[C].push(g[C][B](E))}e[b]=u,f.push(u),u++}}for(var L=n.clone(),h=0,m=l.length;h<m;h++){var A=l[h],O=n.getAttribute(A),F=new O.array.constructor(c[A]),_=new THREE__namespace.BufferAttribute(F,O.itemSize,O.normalized);if(L.setAttribute(A,_),A in p)for(var T=0;T<p[A].length;T++){var N=n.morphAttributes[A][T],F=new N.array.constructor(p[A][T]),D=new THREE__namespace.BufferAttribute(F,N.itemSize,N.normalized);L.morphAttributes[A][T]=D}}return L.setIndex(f),L}var scratchSphere$1=new THREE__namespace.Sphere,scratchMatrix4$1=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,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 m=[];if(h.traverseVisible(function(j){if(j instanceof THREE__namespace.Mesh){var Q=getBvhTreeForMesh(j);if(Q){scratchMatrix4$1.copy(j.matrixWorld),scratchMatrix4Inverse.getInverse(scratchMatrix4$1),scratchSphere$1.copy(t).applyMatrix4(scratchMatrix4Inverse);var V=Q.trianglesInSphere(scratchSphere$1.center,scratchSphere$1.radius),J=new THREE__namespace.BufferGeometry;J.setAttribute("position",new THREE__namespace.BufferAttribute(V,3)),J.applyMatrix4(j.matrixWorld),J=mergeVertices(J,.01),m.push(J)}}}),m.length===0)return;for(var A=["a","b","c"],g=mergeBufferGeometries(m),y=g.getAttribute("position").array,v=((d=g.getIndex())===null||d===void 0?void 0:d.array)||[],E=[],b=[],T=0,_=y.length;T<_;T+=3){var S=new THREE__namespace.Vector3(y[T],y[T+1],y[T+2]);E.push(S)}for(var T=0,_=v.length;T<_;T+=3){var R=v[T],w=v[T+1],M=v[T+2],B=new THREE__namespace.Vector3().crossVectors(E[w].clone().sub(E[R]),E[M].clone().sub(E[R])).normalize();b.push({a:R,b:w,c:M,normal:B})}for(var C={},T=0,_=b.length;T<_;T++)for(var P=b[T],L=0;L<3;L++){var O=P[A[L]],F=P[A[(L+1)%3]],N=[Math.min(O,F),Math.max(O,F)],D=N[0]+"-"+N[1];C[D]===void 0?C[D]={index1:N[0],index2:N[1],face1:T}:C[D].face2=T}for(var D in C){var U=C[D];if(U.face2===void 0||b[U.face1].normal.dot(b[U.face2].normal)<=r){var z=E[U.index1],K=E[U.index2];o.push(new THREE__namespace.Line3(z,K))}}E.length=0,b.length=0}})}return o}var scratchBoundingBox$1=new THREE__namespace.Box3,scratchViewLayerBox=new THREE__namespace.Box3,scratchObserverBox$3=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,m=d;h<m.length;h++){var A=m[h];A.dispose()}else s.add.apply(s,d)}),s.loadedReady=new Promise(function(d){var h=function(){d(),s.removeEventListener("load",h),s.removeEventListener("dispose",h)};s.addEventListener("load",h),s.addEventListener("dispose",h)})}else s.refined=!0,s.loaded=!0,s.initReady=Promise.resolve(),s.loadedReady=Promise.resolve();return s.parameter.set("boundingBox",s.boundingBox.clone()),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);this.dispatchEvent({type:"dispose"})},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){var o=r!=null?r:[],s=e.sortByDistance;e.sortByDistance=!1;for(var u=0,l=this.children.length;u<l;u++){var c=this.children[u];c.visible&&typeof c.intersectRaycaster=="function"&&c.intersectRaycaster(e,o)}return e.sortByDistance=s,sortIntersects(o,e.sortByDistance,e.firstHitOnly),o},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$3.copy(this.work.observerBox),scratchObserverBox$3.isEmpty()||(scratchObserverBox$3.max.x+=1,scratchObserverBox$3.max.z+=1,scratchObserverBox$3.max.y+=1,scratchObserverBox$3.min.x-=1,scratchObserverBox$3.min.z-=1,scratchBoundingBox$1.union(scratchObserverBox$3));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 scratchBoundingBox$1.applyMatrix4(this.matrix),scratchBoundingBox$1.equals(this.boundingBox)||(this.boundingBox.copy(scratchBoundingBox$1),this.parameter.set("boundingBox",scratchBoundingBox$1.clone())),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=[];e.parameter.set("boundingBox",e.boundingBox.clone());var 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){var o=r!=null?r:[],s=this.children.filter(function(f){return f instanceof Model});if(s.length===1)s[0].intersectRaycaster(e,o);else{var u=e.sortByDistance;e.sortByDistance=!1;for(var l=0,c=s;l<c.length;l++){var p=c[l];p.visible&&p.intersectRaycaster(e,o)}e.sortByDistance=u,sortIntersects(o,e.sortByDistance,e.firstHitOnly)}return o},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 scratchBoundingBox3.equals(this.boundingBox)||(this.boundingBox.copy(scratchBoundingBox3),this.parameter.set("boundingBox",scratchBoundingBox3.clone())),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);function workInitialToJson(n){var t={};return typeof n.mode!="undefined"&&(t.mode=n.mode),typeof n.panoIndex!="undefined"&&(t.pano_index=n.panoIndex),typeof n.longitude!="undefined"&&(t.longitude=n.longitude),typeof n.latitude!="undefined"&&(t.latitude=n.latitude),typeof n.fov!="undefined"&&(t.fov=n.fov),typeof n.distance!="undefined"&&(t.distance=n.distance),typeof n.offset!="undefined"&&(t.offset=n.offset.toArray()),t}function workModelToJson(n){var t;if(n)return{file_url:n.file,material_base_url:n.textureBase,material_textures:(t=n.textures)===null||t===void 0?void 0:t.slice(),layers:n.layers.map(function(e){return{tileset_url:e.tileset,up_axis:e.upAxis,name:e.name,type:e.type}})}}function workObserverToObserverJson(n){return{index:n.index,floor_index:n.floorIndex,position:n.position.toArray(),standing_position:n.standingPosition.toArray(),quaternion:{x:n.quaternion.x,y:n.quaternion.y,z:n.quaternion.z,w:n.quaternion.w},visible_nodes:n.visibleNodes.slice(),accessible_nodes:n.accessibleNodes.slice()}}function workObserverToPanoramaJson(n){return{index:n.index,active:n.active,loadable:n.loadable,derived_id:n.derivedId,derived_id_str:n.derivedIdStr,size_list:n.images.sizeList.slice(),up:n.images.up,down:n.images.down,right:n.images.right,left:n.images.left,front:n.images.front,back:n.images.back,video:n.video?{matrix:n.video.matrix.toArray(),size:n.video.size.toArray(),source:n.video.source}:void 0}}function workToJson(n){return{allow_hosts:n.allowHosts.slice(),expire_at:n.expire.getTime().toString(),project_id:n.projectId,code:n.workCode,name:n.name,base_url:n.baseURL,initial:workInitialToJson(n.initial),model:workModelToJson(n.model),observers:n.observers.map(function(t){return workObserverToObserverJson(t)}),panorama:{count:n.observers.length,list:n.observers.map(function(t){return workObserverToPanoramaJson(t)})}}}function isNumber(n){return typeof n=="number"}function jsonClone(n){if(typeof n!="object"||n===null)return n;if(Array.isArray(n))return n.map(function(o){return typeof o!="object"||o===null?o:jsonClone(o)});var t={};for(var e in n){var r=n[e];t[e]=typeof r!="object"||r===null?r:jsonClone(r)}return t}function getType(n){return n==null?"null":Array.isArray(n)?"array":typeof n=="object"?"dict":"value"}function jsonMerge(n,t){var e=getType(n),r=getType(t);if(r==="null")return n;if(r==="value")return t;if(r!==e)return jsonClone(t);if(r==="array")for(var o=0;o<t.length;o++)n[o]=jsonMerge(n[o],t[o]);else if(r==="dict")for(var s in t)n[s]=jsonMerge(n[s],t[s]);return n}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 jsonStableStrinfiy(n){return jsonStableStrinfiy_(n,!1)}function jsonHash(n){return"hash::".concat(sha256(jsonStableStrinfiy(n)))}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)}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 URL_REGEXP=/^[0-9a-z]+\:\/\/(([^:/?#]*)(?::[0-9]+)?)/i,BUILDIN_ALLOW_HOST=deepFreeze(JSON.parse((function n(){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"))),domainRegex=/^([^.]+)(\.([^.]+))*$/,currentHostname=typeof location!="undefined"?location.hostname:"localhost";function isIPDomain(n){return/^(([1-9]?\d|1\d\d|2[0-4]\d|25[0-5])(\.(?!$)|$)){4}$/.test(n)}function matchDomain(n,t){if(!domainRegex.test(n)||!domainRegex.test(t))return!1;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 hostnameFromURL(n){if(/^blob\:/i.test(n)||/^data\:/i.test(n))return currentHostname;var t=n.match(URL_REGEXP);return t?t[2]:currentHostname}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,o={};try{o=typeof n=="string"?JSON.parse(n):n}catch(y){return error_invalid_input()}if(typeof o!="object")return error_invalid_input();var s=currentHostname,u=Date.now(),l=new Date(typeof o.expire_at=="string"&&/^\d+$/.test(o.expire_at)?Number(o.expire_at):o.expire_at),c=Array.isArray(o.allow_hosts)?o.allow_hosts:[];if(s.length===0||isIPDomain(s)||BUILDIN_ALLOW_HOST.filter(function(y){return matchDomain(y,s)}).length>0){var p=String((t=o.certificate)!==null&&t!==void 0?t:"");if(p)try{var f=new X509;return f.readCertPEM(p),deepFreeze({issuer:f.getSubjectString(),expire:l,allowHosts:c})}catch(y){var d=y instanceof Error?y.message:String(y);console.warn("[PARSE Error]: Invalid Certificate. "+d)}return deepFreeze({issuer:"none",expire:l,allowHosts:c})}var h=String((e=o.certificate)!==null&&e!==void 0?e:"");if(!h)return error_invalid_certificate();var m=new X509;m.readCertPEM(h);var A=String((r=o._signature)!==null&&r!==void 0?r:"");if(!A)return error_invalid_signature();var g=jsonStableNoneNumberStrinfiy(ObjectOmit(o,["_signature"]));return verifyMessage(g,A,m)===!1?error_invalid_signature():u<l.getTime()?BUILDIN_ALLOW_HOST.concat(c).filter(function(y){return matchDomain(y,s)}).length===0?error_host_not_allowed(s):deepFreeze({issuer:m.getSubjectString(),expire:l,allowHosts:c}):error_date_expired(l)}function verifyURL(n,t){var e=hostnameFromURL(n);return currentHostname.length!==0&&!isIPDomain(currentHostname)&&BUILDIN_ALLOW_HOST.filter(function(r){return matchDomain(r,currentHostname)}).length===0&&!isIPDomain(e)&&BUILDIN_ALLOW_HOST.concat(t).filter(function(r){return matchDomain(r,e)}).length===0?error_host_not_allowed(e):n}var PANO_TEXTURE_SCALE=new THREE__namespace.Vector3(1,1,1),FACE_ORDER$1=["right","left","up","down","front","back"];function relativeURL(n,t){if(!isAbsoluteURL(n))return n;if(n.indexOf(t)===0)return n.slice(t.length);var e=t.replace(/^https\:/,"http:");if(n.indexOf(e)===0)return n.slice(e.length);var r=t.replace(/^http\:/,"https:");return n.indexOf(r)===0?n.slice(r.length):(console.warn("".concat(n," is not start with base_url(").concat(t,").")),n)}function panoURL(n,t,e){return!isAbsoluteURL(n)&&typeof t=="string"&&t.length>0&&(n=pathJoin(t,String(e),n)),n}function getTileLevel(n){for(var t=10;t>=0;t--){var e=512*Math.pow(2,t);if(e<=n)return t}return null}function sortTile(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){for(var e,r,o,s,u,l,c,p,f,d,h,m,A,g,y,v,E,b=[],T=null,_=0,S=[].concat(n);_<S.length;_++){var R=S[_];if("getURL"in R)T={allowHosts:R.allowHosts,expire:R.expire,issuer:R.issuer},b.push(workToJson(R));else{var w=typeof R=="string"?JSON.parse(R):jsonClone(R),M=verify(w);if(M instanceof Error)return M;T===null&&(T=M),b.push(w)}}if(T===null)return new Error("Empty");defineProperty(t,"issuer",{enumerable:!0,configurable:!1,writable:!1,value:T.issuer}),defineProperty(t,"expire",{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze(T.expire)}),defineProperty(t,"allowHosts",{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze(T.allowHosts)});var B=b.reduce(function(V,J){return jsonMerge(V,J)});defineProperty(t,"name",{enumerable:!0,configurable:!1,writable:!1,value:String((e=B.name)!==null&&e!==void 0?e:"Unknown")}),defineProperty(t,"workCode",{enumerable:!0,writable:!0,value:String(B.resource_code||B.basic_code||B.vr_code||B.code||B.project_id||B.work_code||B.workCode||createUuid())}),defineProperty(t,"projectId",{enumerable:!0,writable:!0,value:B.project_id}),defineProperty(t,"baseURL",{enumerable:!0,writable:!0,value:(function(){var V,J=(V=B.base_url)!==null&&V!==void 0?V:"";return J&&J[J.length-1]!=="/"&&(J+="/"),J})()});var C=void 0;typeof B.model=="object"&&(C={},defineProperty(C,"work",{enumerable:!1,configurable:!1,writable:!1,value:t}),defineProperty(C,"file",{enumerable:!0,configurable:!1,writable:!1,value:(function(){var V=B.model.file_url;if(V)return relativeURL(V,t.baseURL)})()}),defineProperty(C,"textureBase",{enumerable:!0,configurable:!1,writable:!1,value:(function(){var V=B.model.material_base_url;return V&&(V=relativeURL(V,t.baseURL)),V})()}),defineProperty(C,"textures",{enumerable:!0,configurable:!1,writable:!1,value:(function(){var V=void 0;return Array.isArray(B.model.material_textures)&&(V=B.model.material_textures.slice(),Object.freeze(V)),V})()}),defineProperty(C,"layers",{enumerable:!0,configurable:!1,writable:!1,value:(function(){var V,J,W,X=[];if(Array.isArray(B.model.layers))for(var Z=0,Y=B.model.layers;Z<Y.length;Z++){var G=Y[Z];if(G&&G.tileset_url){var ee={};defineProperty(ee,"work",{enumerable:!1,configurable:!1,writable:!1,value:t}),defineProperty(ee,"name",{enumerable:!0,configurable:!1,writable:!1,value:(V=G.name)!==null&&V!==void 0?V:""}),defineProperty(ee,"type",{enumerable:!0,configurable:!1,writable:!1,value:(J=G.type)!==null&&J!==void 0?J:"mesh"}),defineProperty(ee,"upAxis",{enumerable:!0,configurable:!1,writable:!1,value:(W=G.up_axis)!==null&&W!==void 0?W:"Z"}),defineProperty(ee,"tileset",{enumerable:!0,configurable:!1,writable:!1,value:relativeURL(G.tileset_url,t.baseURL)}),X.push(ee)}}if(typeof B.model.tiles=="object"){var G=B.model.tiles;if(G&&G.tileset_url){var ee={};defineProperty(ee,"work",{enumerable:!1,configurable:!1,writable:!1,value:t}),defineProperty(ee,"name",{enumerable:!0,configurable:!1,writable:!1,value:"lod"}),defineProperty(ee,"type",{enumerable:!0,configurable:!1,writable:!1,value:"mesh"}),defineProperty(ee,"upAxis",{enumerable:!0,configurable:!1,writable:!1,value:"-Y"}),defineProperty(ee,"tileset",{enumerable:!0,configurable:!1,writable:!1,value:relativeURL(G.tileset_url,t.baseURL)}),X.push(ee)}}return Object.freeze(X)})()})),defineProperty(t,"model",{enumerable:!0,configurable:!1,writable:!1,value:C});var P=[];if(Array.isArray(B.observers)&&B.panorama&&Array.isArray(B.panorama.list||B.panorama.info))for(var L=B.observers,O=(r=B.panorama.list||B.panorama.info)!==null&&r!==void 0?r:[],F=(p=(l=(s=(o=B.panorama)===null||o===void 0?void 0:o.pano_high_cube_base_url)!==null&&s!==void 0?s:(u=B.panorama)===null||u===void 0?void 0:u.pano_cube_base_url)!==null&&l!==void 0?l:(c=B.panorama)===null||c===void 0?void 0:c.base_url)!==null&&p!==void 0?p:"",N=Math.min(L.length,O.length),D=function(V){var J=L[V],W=O[V],X={};defineProperty(X,"work",{enumerable:!1,configurable:!1,writable:!1,value:t}),defineProperty(X,"index",{enumerable:!0,configurable:!1,writable:!1,value:V}),defineProperty(X,"panoIndex",{enumerable:!0,configurable:!1,writable:!1,value:V}),defineProperty(X,"panoId",{enumerable:!0,configurable:!1,writable:!1,value:panoStringify({workCode:t.workCode,panoIndex:V})}),defineProperty(X,"derivedId",{enumerable:!0,configurable:!1,writable:!1,value:(f=J.derived_id)!==null&&f!==void 0?f:W.derived_id}),defineProperty(X,"floorIndex",{enumerable:!0,configurable:!1,writable:!1,value:(d=J.floor_index)!==null&&d!==void 0?d:J.floor}),defineProperty(X,"derivedId",{enumerable:!0,configurable:!1,writable:!1,value:(h=J.derived_id)!==null&&h!==void 0?h:W.derived_id}),defineProperty(X,"derivedIdStr",{enumerable:!0,configurable:!1,writable:!1,value:(m=J.derived_id_str)!==null&&m!==void 0?m:W.derived_id_str}),defineProperty(X,"active",{enumerable:!0,configurable:!1,writable:!1,value:J.active!==!1&&W.active!==!1}),defineProperty(X,"loadable",{enumerable:!0,configurable:!1,writable:!1,value:(g=(A=J.active)!==null&&A!==void 0?A:W.active)!==null&&g!==void 0?g:!1}),defineProperty(X,"position",{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze(new THREE__namespace.Vector3().fromArray((y=J.position)!==null&&y!==void 0?y:[0,0,0]))}),defineProperty(X,"standingPosition",{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze(new THREE__namespace.Vector3().fromArray((E=(v=J.standing_position)!==null&&v!==void 0?v:J.standingPosition)!==null&&E!==void 0?E:[0,0,0]))}),defineProperty(X,"quaternion",{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze(new THREE__namespace.Quaternion().fromArray(J.quaternion?[J.quaternion.x,J.quaternion.y,J.quaternion.z,J.quaternion.w]:[0,0,0,1]))}),defineProperty(X,"matrix",{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze(new THREE__namespace.Matrix4().compose(X.position,X.quaternion,PANO_TEXTURE_SCALE))}),defineProperty(X,"accessibleNodes",{enumerable:!0,configurable:!1,writable:!1,value:(function(){var Z,Y,G=((Y=(Z=J.accessible_nodes)!==null&&Z!==void 0?Z:J.accessibleNodes)!==null&&Y!==void 0?Y:[]).filter(function(te){return te<N});if(G.length===0)for(var ee=0;ee<N;ee++)ee!==V&&G.push(ee);return Object.freeze(G)})()}),defineProperty(X,"visibleNodes",{enumerable:!0,configurable:!1,writable:!1,value:(function(){var Z,Y,G=((Y=(Z=J.visible_nodes)!==null&&Z!==void 0?Z:J.visibleNodes)!==null&&Y!==void 0?Y:[]).filter(function(te){return te<N});if(G.length===0)for(var ee=0;ee<N;ee++)ee!==V&&G.push(ee);return Object.freeze(G)})()}),defineProperty(X,"images",{enumerable:!0,configurable:!1,writable:!1,value:(function(){var Z={};defineProperty(Z,"work",{enumerable:!1,configurable:!1,writable:!1,value:t});for(var Y=0,G=FACE_ORDER$1;Y<G.length;Y++){var ee=G[Y];defineProperty(Z,ee,{enumerable:!0,configurable:!1,writable:!1,value:relativeURL(panoURL(W[ee],F,V),t.baseURL)})}return defineProperty(Z,"sizeList",{enumerable:!0,configurable:!1,writable:!1,value:(function(){var te=getImageSizeFromURL(Z[FACE_ORDER$1[0]]);if(te){if(W.size_list){var ne=W.size_list.slice().sort(function(ye,_e){return ye-_e});return Object.freeze(ne)}else if(W.tiles){for(var ne=[te],ae=W.tiles.slice().sort(function(_e,le){return _e-le}),ce=0,ie=ae;ce<ie.length;ce++){var fe=ie[ce],ge=512*Math.pow(2,fe);ge>te&&ne.push(ge)}return Object.freeze(ne)}}return Object.freeze([])})()}),defineProperty(Z,"tiles",{enumerable:!0,configurable:!1,writable:!1,value:(function(){var te=getImageSizeFromURL(Z.front);if(te){var ne=Z.sizeList.slice();if(ne[0]){var ae=getTileLevel(ne[0]);if(ae)for(var ce=ae-1;ce>=0;ce--)ne.unshift(512*Math.pow(2,ce))}if(!(ne.length<=0)){for(var ie=[],fe=0,ge=ne;fe<ge.length;fe++){var ye=ge[fe],_e=getTileLevel(ye);if(typeof _e=="number"){var le={};if(defineProperty(le,"work",{enumerable:!1,configurable:!1,writable:!1,value:t}),defineProperty(le,"level",{enumerable:!0,configurable:!1,writable:!1,value:_e}),ye>te){defineProperty(le,"size",{enumerable:!0,configurable:!1,writable:!1,value:ye}),defineProperty(le,"scale",{enumerable:!0,configurable:!1,writable:!1,value:1});for(var de=0,re=FACE_ORDER$1;de<re.length;de++){var se=re[de];defineProperty(le,se,{enumerable:!0,configurable:!1,writable:!1,value:replaceImageSize(Z[se],ye)})}}else{defineProperty(le,"size",{enumerable:!0,configurable:!1,writable:!1,value:te}),defineProperty(le,"scale",{enumerable:!0,configurable:!1,writable:!1,value:ye/te});for(var he=0,me=FACE_ORDER$1;he<me.length;he++){var se=me[he];defineProperty(le,se,{enumerable:!0,configurable:!1,writable:!1,value:Z[se]})}}ie.push(le)}}return ie=sortTile(ie),Object.freeze(ie)}}})()}),Z})()}),defineProperty(X,"video",{enumerable:!0,configurable:!1,writable:!1,value:(function(){var Z=void 0;return W.video&&(Z={},defineProperty(Z,"work",{enumerable:!1,configurable:!1,writable:!1,value:t}),defineProperty(Z,"source",{enumerable:!0,configurable:!1,writable:!1,value:W.video.source}),defineProperty(Z,"matrix",{enumerable:!0,configurable:!1,writable:!1,value:new THREE__namespace.Matrix4().fromArray(W.video.matrix)}),defineProperty(Z,"size",{enumerable:!0,configurable:!1,writable:!1,value:new THREE__namespace.Vector2().fromArray(W.video.size)})),Z})()}),P.push(X)},U=0;U<N;U++)D(U);defineProperty(t,"observers",{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze(P)});var z={};if(defineProperty(z,"work",{enumerable:!1,configurable:!1,writable:!1,value:t}),B.initial){if(t.observers.length>0){var K=void 0;isNumber(B.initial.panoIndex)?K=B.initial.panoIndex:isNumber(B.initial.pano_index)?K=B.initial.pano_index:isNumber(B.initial.pano)&&(K=B.initial.pano),typeof K=="number"&&(K=clamp$1(K,0,t.observers.length-1),defineProperty(z,"panoIndex",{enumerable:!0,writable:!0,value:K}))}if(B.initial.mode==="Panorama"&&t.observers.length===0||B.initial.mode==="Floorplan"||B.initial.mode==="Topview"||B.initial.mode==="Model"||B.initial.mode==="Mapview"?defineProperty(z,"mode",{enumerable:!0,writable:!0,value:B.initial.mode}):typeof z.panoIndex=="number"?defineProperty(z,"mode",{enumerable:!0,writable:!0,value:"Panorama"}):defineProperty(z,"mode",{enumerable:!0,writable:!0,value:"Mapview"}),isNumber(B.initial.latitude)&&defineProperty(z,"latitude",{enumerable:!0,writable:!0,value:B.initial.latitude}),isNumber(B.initial.longitude)?defineProperty(z,"longitude",{enumerable:!0,writable:!0,value:B.initial.longitude}):isNumber(B.initial.heading)&&defineProperty(z,"longitude",{enumerable:!0,writable:!0,value:headingToLongitude(B.initial.heading)}),isNumber(B.initial.fov)&&defineProperty(z,"fov",{enumerable:!0,writable:!0,value:B.initial.fov}),isNumber(B.initial.distance)&&defineProperty(z,"distance",{enumerable:!0,writable:!0,value:B.initial.distance}),Array.isArray(B.initial.offset)){var j=B.initial.offset,Q=[0,0,0].map(function(V,J){var W=Number(j[J]);return isNaN(W)||!isFinite(W)?0:W});defineProperty(z,"offset",{enumerable:!0,writable:!0,value:new THREE__namespace.Vector3().fromArray(Q)})}else typeof B.initial.offset=="object"&&typeof B.initial.offset.x=="number"&&typeof B.initial.offset.y=="number"&&typeof B.initial.offset.z=="number"&&defineProperty(z,"offset",{enumerable:!0,writable:!0,value:new THREE__namespace.Vector3().fromArray([B.initial.offset.x,B.initial.offset.y,B.initial.offset.z])})}return defineProperty(t,"initial",{enumerable:!0,configurable:!1,writable:!1,value:z}),t}function parseNull(n,t){return defineProperty(t,"issuer",{enumerable:!0,configurable:!1,writable:!1,value:"null"}),defineProperty(t,"expire",{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze(new Date)}),defineProperty(t,"allowHosts",{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze(["*"])}),defineProperty(t,"name",{enumerable:!0,configurable:!1,writable:!1,value:"Null"}),defineProperty(t,"workCode",{enumerable:!0,value:createUuid()}),defineProperty(t,"baseURL",{enumerable:!0,value:"/"}),defineProperty(t,"model",{enumerable:!0,configurable:!1,writable:!1,value:void 0}),defineProperty(t,"observers",{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze([])}),defineProperty(t,"initial",{enumerable:!0,configurable:!1,writable:!1,value:(function(){var e={};return defineProperty(e,"work",{enumerable:!1,configurable:!1,writable:!1,value:t}),defineProperty(e,"mode",{enumerable:!0,writable:!0,value:"Mapview"}),e})()}),t}function parsePano(n,t){var e,r;return defineProperty(t,"issuer",{enumerable:!0,configurable:!1,writable:!1,value:"null"}),defineProperty(t,"expire",{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze(new Date)}),defineProperty(t,"allowHosts",{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze(["*"])}),defineProperty(t,"name",{enumerable:!0,configurable:!1,writable:!1,value:String((e=n.name)!==null&&e!==void 0?e:"Unknown")}),defineProperty(t,"workCode",{enumerable:!0,writable:!0,value:(r=n.code)!==null&&r!==void 0?r:createUuid()}),defineProperty(t,"baseURL",{enumerable:!0,writable:!0,value:"/"}),defineProperty(t,"model",{enumerable:!0,configurable:!1,writable:!1,value:void 0}),defineProperty(t,"observers",{enumerable:!0,configurable:!1,writable:!1,value:(function(){var o={};return defineProperty(o,"work",{enumerable:!1,configurable:!1,writable:!1,value:t}),defineProperty(o,"index",{enumerable:!0,configurable:!1,writable:!1,value:0}),defineProperty(o,"panoIndex",{enumerable:!0,configurable:!1,writable:!1,value:0}),defineProperty(o,"panoId",{enumerable:!0,configurable:!1,writable:!1,value:panoStringify({workCode:t.workCode,panoIndex:0})}),defineProperty(o,"floorIndex",{enumerable:!0,configurable:!1,writable:!1,value:0}),defineProperty(o,"derivedId",{enumerable:!0,configurable:!1,writable:!1,value:void 0}),defineProperty(o,"derivedIdStr",{enumerable:!0,configurable:!1,writable:!1,value:void 0}),defineProperty(o,"active",{enumerable:!0,configurable:!1,writable:!1,value:!0}),defineProperty(o,"loadable",{enumerable:!0,configurable:!1,writable:!1,value:!1}),defineProperty(o,"position",{enumerable:!0,configurable:!1,writable:!1,value:new THREE__namespace.Vector3(0,1.5,0)}),defineProperty(o,"standingPosition",{enumerable:!0,configurable:!1,writable:!1,value:new THREE__namespace.Vector3(0,0,0)}),defineProperty(o,"quaternion",{enumerable:!0,configurable:!1,writable:!1,value:new THREE__namespace.Quaternion(0,1,0,0)}),defineProperty(o,"matrix",{enumerable:!0,configurable:!1,writable:!1,value:new THREE__namespace.Matrix4().compose(o.position,o.quaternion,PANO_TEXTURE_SCALE)}),defineProperty(o,"accessibleNodes",{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze([])}),defineProperty(o,"visibleNodes",{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze([])}),defineProperty(o,"images",{enumerable:!0,configurable:!1,writable:!1,value:(function(){var s={};defineProperty(s,"work",{enumerable:!1,configurable:!1,writable:!1,value:t});for(var u=0,l=FACE_ORDER$1;u<l.length;u++){var c=l[u];defineProperty(s,c,{enumerable:!0,configurable:!1,writable:!1,value:n[c]})}return defineProperty(s,"sizeList",{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze([n.size])}),defineProperty(s,"tiles",{enumerable:!0,configurable:!1,writable:!1,value:(function(){var p=getImageSizeFromURL(s.front);if(p){var f=s.sizeList.slice();if(f[0]){var d=getTileLevel(f[0]);if(d)for(var h=d-1;h>=0;h--)f.unshift(512*Math.pow(2,h))}if(!(f.length<=0)){for(var m=[],A=0,g=f;A<g.length;A++){var y=g[A],v=getTileLevel(y);if(typeof v=="number"){var E={};if(defineProperty(E,"work",{enumerable:!1,configurable:!1,writable:!1,value:t}),defineProperty(E,"level",{enumerable:!0,configurable:!1,writable:!1,value:v}),y>p){defineProperty(E,"size",{enumerable:!0,configurable:!1,writable:!1,value:y}),defineProperty(E,"scale",{enumerable:!0,configurable:!1,writable:!1,value:1});for(var b=0,T=FACE_ORDER$1;b<T.length;b++){var _=T[b];defineProperty(E,_,{enumerable:!0,configurable:!1,writable:!1,value:replaceImageSize(s[_],y)})}}else{defineProperty(E,"size",{enumerable:!0,configurable:!1,writable:!1,value:p}),defineProperty(E,"scale",{enumerable:!0,configurable:!1,writable:!1,value:y/p});for(var S=0,R=FACE_ORDER$1;S<R.length;S++){var _=R[S];defineProperty(E,_,{enumerable:!0,configurable:!1,writable:!1,value:s[_]})}}m.push(E)}}return m=sortTile(m),Object.freeze(m)}}})()}),s})()}),defineProperty(o,"video",{enumerable:!0,configurable:!1,writable:!1,value:void 0}),Object.freeze([o])})()}),defineProperty(t,"initial",{enumerable:!0,configurable:!1,writable:!1,value:(function(){var o={};return defineProperty(o,"work",{enumerable:!1,configurable:!1,writable:!1,value:t}),defineProperty(o,"mode",{enumerable:!0,writable:!0,value:"Panorama"}),defineProperty(o,"panoIndex",{enumerable:!0,writable:!0,value:0}),o})()}),t}var workVerifySet=new WeakSet,Work=(function(){function n(t,e){this.observerBox=new THREE__namespace.Box3,this.observerBox=new THREE__namespace.Box3,this.transform=new THREE__namespace.Matrix4,this.shortPath=!1,this.jsonp=!1;var r;if(t!==null?typeof t=="object"&&typeof t.size=="number"&&typeof t.up=="string"&&typeof t.down=="string"&&typeof t.right=="string"&&typeof t.left=="string"&&typeof t.front=="string"&&typeof t.back=="string"?r=parsePano(t,this):r=parse(t,this):r=parseNull(t,this),r instanceof Error)throw new Error("[PARSE FAILED]: "+r.message+`
1027
1027
  Error work input:
1028
- `+JSON.stringify(t));workVerifySet.add(this);for(var o=0,s=this.observers;o<s.length;o++){var u=s[o];this.observerBox.expandByPoint(u.position),this.observerBox.expandByPoint(u.standingPosition)}e.transform&&(Array.isArray(e.transform)?this.transform.fromArray(e.transform):this.transform.copy(e.transform)),typeof e.jsonp=="boolean"&&(this.jsonp=e.jsonp),typeof e.shortPath=="boolean"&&(this.shortPath=e.shortPath),e.workCode&&(typeof e.workCode=="string"?this.workCode=e.workCode:typeof e.workCode=="function"&&(this.workCode=e.workCode(t)));{var l=this;this.options={get transform(){return l.transform}},this.raw={get works(){return[JSON.stringify(workToJson(l))]}}}}return n.prototype.getURL=function(t){var e;if(!isAbsoluteURL(t)){if(this.jsonp===!0){t=t.replace(/([\?\#].*)?$/i,"");var r=sha256("".concat(t)).slice(0,7);t="".concat(t,".").concat(r,".jsonp")}if(this.shortPath===!0){var o=t.replace(t,"").split("."),s=(e=o.shift())!==null&&e!==void 0?e:"",u=o.join(".");t=sha256(s)+(u?"."+u:"")}t=pathJoin(this.baseURL,t)}return hrefAElement.href=t,t=hrefAElement.href,t},n.prototype.verifyURL=function(t){return typeof verifyURL(this.getURL(t),this.allowHosts)=="string"},n.prototype.toJSON=function(){return workToJson(this)},n.parse=parseWork,n})();function parseWork(n,t){typeof n=="string"&&n.trim()[0]==="{"&&(n=JSON.parse(n));try{return new Work(n,t!=null?t:{})}catch(r){console.log(r);var e=r instanceof Error?r.message:String(r);throw new Error("[PARSE Error]: "+e+`
1028
+ `+JSON.stringify(t));workVerifySet.add(this);for(var o=0,s=this.observers;o<s.length;o++){var u=s[o];this.observerBox.expandByPoint(u.position),this.observerBox.expandByPoint(u.standingPosition)}e.transform&&(Array.isArray(e.transform)?this.transform.fromArray(e.transform):this.transform.copy(e.transform)),typeof e.jsonp=="boolean"&&(this.jsonp=e.jsonp),typeof e.shortPath=="boolean"&&(this.shortPath=e.shortPath),e.workCode&&(typeof e.workCode=="string"?this.workCode=e.workCode:typeof e.workCode=="function"&&(this.workCode=e.workCode(t)));{var l=this;this.options={get transform(){return l.transform}},this.raw={get works(){return[JSON.stringify(workToJson(l))]}}}}return n.prototype.getURL=function(t){var e;if(!isAbsoluteURL(t)){if(this.jsonp===!0){t=t.replace(/([\?\#].*)?$/i,"");var r=sha256("".concat(t)).slice(0,7);t="".concat(t,".").concat(r,".jsonp")}if(this.shortPath===!0){var o=t.replace(t,"").split("."),s=(e=o.shift())!==null&&e!==void 0?e:"",u=o.join(".");t=sha256(s)+(u?"."+u:"")}t=pathJoin(this.baseURL,t)}return t=getFullURL(t),t},n.prototype.verifyURL=function(t){return typeof verifyURL(this.getURL(t),this.allowHosts)=="string"},n.prototype.toJSON=function(){return workToJson(this)},n.parse=parseWork,n})();function parseWork(n,t){typeof n=="string"&&n.trim()[0]==="{"&&(n=JSON.parse(n));try{return new Work(n,t!=null?t:{})}catch(r){console.log(r);var e=r instanceof Error?r.message:String(r);throw new Error("[PARSE Error]: "+e+`
1029
1029
  Error work input:
1030
1030
  `+JSON.stringify(n))}}var scratchMatrix4=new THREE__namespace.Matrix4,WorkResolvedObserver=(function(){function n(t){this.isResolved=!0,this.work=t.work,this.index=t.index,this.panoIndex=t.panoIndex,this.pano={panoIndex:t.panoIndex,workCode:t.work.workCode},this.panoId=panoStringify({panoIndex:t.panoIndex,workCode:t.work.workCode}),this.floorIndex=t.floorIndex,this.derivedId=t.derivedId,this.derivedIdStr=t.derivedIdStr,this.active=t.active,this.loadable=t.loadable,this.images=t.images,this.visibleNodes=t.visibleNodes,this.visibleIds=t.visibleNodes.map(function(e){return panoStringify({panoIndex:e,workCode:t.work.workCode})}),this.accessibleNodes=t.accessibleNodes,this.accessibleIds=t.accessibleNodes.map(function(e){return panoStringify({panoIndex:e,workCode:t.work.workCode})}),this.position=new THREE__namespace.Vector3().copy(t.position).applyMatrix4(t.work.transform),this.standingPosition=new THREE__namespace.Vector3().copy(t.standingPosition).applyMatrix4(t.work.transform),this.quaternion=new THREE__namespace.Quaternion().setFromRotationMatrix(scratchMatrix4.makeRotationFromQuaternion(t.quaternion).premultiply(t.work.transform)),this.matrix=new THREE__namespace.Matrix4().copy(t.matrix).premultiply(t.work.transform)}return n})();function createWorks(n){var t=n.map(function(e){if(workVerifySet.has(e))return e;var r=parseWork(null);return r.workCode=e.workCode,r});return Object.freeze(Object.assign(t,{get initial(){var e;return(e=t[0])===null||e===void 0?void 0:e.initial},getWork:function(e){for(var r=0,o=t;r<o.length;r++){var s=o[r];if(s.workCode===e)return s}},getObserver:function(e){var r,o,s=(r=t[0])===null||r===void 0?void 0:r.workCode,u=0;if(isPanoId(e)){var l=panoParse(e);s=l.workCode,u=l.panoIndex}else typeof e=="number"?u=e:(s=e.workCode,u=e.panoIndex);return(o=this.getWork(s))===null||o===void 0?void 0:o.observers[u]},getResolvedObserver:function(e){var r=this.getObserver(e);if(r)return new WorkResolvedObserver(r)},toJSON:function(){return this.map(function(e){return{work:workToJson(e),transform:e.transform.toArray()}})}}))}var 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,m=e.precision,A=e.powerPreference,g=this,y={antialias:f,alpha:!0,depth:!0,preserveDrawingBuffer:o,stencil:c,premultipliedAlpha:u,powerPreference:A},v={logarithmicDepthBuffer:h,precision:m};if(d){var E=document.createElement("canvas"),b=E.getContext("webgl2",y);b?g=n.call(this,__assign(__assign(__assign({},y),v),{antialias:!0,canvas:E,context:b}))||this:(console.error("error occurred when getting webgl2 canvas context, mybe webgl2 not support, fallback to webgl."),g=n.call(this,__assign(__assign({},y),v))||this)}else g=n.call(this,__assign(__assign({},y),v))||this;return g.outputEncoding=THREE__namespace.sRGBEncoding,g.autoClear=!0,g}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=`
1031
1031
  varying vec2 vUv;
@@ -1384,13 +1384,13 @@ void main() {
1384
1384
 
1385
1385
  gl_FragColor = vec4(gl_FragColor.rgb, gl_FragColor.a * opacity);
1386
1386
  }
1387
- `,PanoCircleMeshCustom=(function(n){__extends(t,n);function t(e){e===void 0&&(e={});var r,o,s,u,l,c,p,f=n.call(this)||this,d=(r=e.color)!==null&&r!==void 0?r:16777215,h=(o=e.scale)!==null&&o!==void 0?o:1,m=e.map,A=(s=e.mapAlpha)!==null&&s!==void 0?s:1,g=(u=e.mapUseColor)!==null&&u!==void 0?u:!1,y=(l=e.mapUseReverse)!==null&&l!==void 0?l:!1,v=(c=e.borderWidth)!==null&&c!==void 0?c:.1,E=(p=e.borderColor)!==null&&p!==void 0?p:16777215;return f.progress=0,f.opacity=0,f.loading=!1,f.current=!1,f.disabled=!1,f.currentMotion=new Motion({progress:0}),f.tapMotion=new Motion({scale:1,opacity:1}),f.loadingOpacityMotion=new Motion({opacity:0}),f.progressMotion=new Motion({progress:0}),f.progressOpacityMotion=new Motion({opacity:0}),f.opacityMotion=new Motion({opacity:0}),f.disableMotion=new Motion({progress:0}),f.panoMesh=new THREE__namespace.Mesh(sharedGeometry2,new THREE__namespace.ShaderMaterial({blending:THREE__namespace.CustomBlending,blendSrc:THREE__namespace.SrcAlphaFactor,blendDst:THREE__namespace.OneMinusSrcAlphaFactor,blendSrcAlpha:THREE__namespace.OneFactor,blendDstAlpha:THREE__namespace.OneMinusSrcAlphaFactor,depthWrite:!1,vertexShader:vertexShader$4,fragmentShader:fragmentShader$4,defines:{USE_COLOR:g,USE_MAP:m!==void 0,USE_BORDER:v>0,USE_REVERSE:y},uniforms:{baseColor:{value:new THREE__namespace.Color(d)},circleScale:{value:1},circleOpacity:{value:1},loadingAngle:{value:0},loadingOpacity:{value:0},progress:{value:0},progressOpacity:{value:0},expand0:{value:0},expand1:{value:0},expandOpacity:{value:0},opacity:{value:0},tapScale:{value:1},tapOpacity:{value:1},disable:{value:0},map:{value:m},mapAlpha:{value:A},borderWidth:{value:v},borderColor:{value:new THREE__namespace.Color(E)}}})),f.renderOrder=-2,f.panoMesh.renderOrder=-2,f.panoMesh.position.y=.004,f.panoMesh.scale.set(h,1,h),f.add(f.panoMesh),f.currentStartTime=now(),f.needsRender=!0,f}return t.prototype.setProgress=function(e){var r=this;this.setDisabled(!1),this.setLoading(!1),this.progress!==e&&(e=clamp$1(e,0,1),this.tapMotion.ended&&(this.progress===0&&this.progressOpacityMotion.set({opacity:1},500).catch(noop),e===0?this.progressOpacityMotion.set({opacity:0},500).catch(noop).then(function(){r.progressMotion.set({progress:0},0).catch(noop)}):this.progressMotion.set({progress:clamp$1(e*1.2,0,1)},100).catch(noop)),this.progress=e)},t.prototype.setOpacity=function(e){this.opacity!==e&&(this.opacity=e=clamp$1(e,0,1),this.opacityMotion.set({opacity:e},200).catch(noop))},t.prototype.setCurrent=function(e){this.current!==e&&(this.currentMotion.set({progress:e?1:0},2e3).catch(noop),this.current=e,this.current===!0&&(this.currentStartTime=now()))},t.prototype.setLoading=function(e){this.loading!==e&&(this.loading=e,this.disabled===!0&&this.setDisabled(!1),this.loadingOpacityMotion.set({opacity:e?1:0},500).catch(noop))},t.prototype.setDisabled=function(e){this.disabled!==e&&(this.disabled=e,this.loading===!0&&this.setLoading(!1),this.disableMotion.set({progress:e?1:0},500).catch(noop))},t.prototype.tap=function(){var e=this;if(!this.tapMotion.ended)return Promise.resolve();var r=[{progress:0,value:{scale:1,opacity:1}},{progress:.3,value:{scale:.85,opacity:.5}},{progress:.8,value:{scale:1.05,opacity:.6}},{progress:1,value:{scale:1,opacity:1}}];return this.progressOpacityMotion.set({opacity:0},0).catch(noop),this.progressMotion.set({progress:0},0).catch(noop),this.tapMotion.setKeyframes(r,600).then(function(){e.progressOpacityMotion.set({opacity:e.progress>0?1:0},300).catch(noop),e.progressMotion.set({progress:e.progress},120).catch(noop)}).catch(noop)},t.prototype.updateTime=function(e,r){if(!this.progressMotion.ended){this.progressMotion.update(e);var o=this.progressMotion.value.progress;this.panoMesh.material.uniforms.progress.value=o,this.needsRender=!0}if(!this.progressOpacityMotion.ended){this.progressOpacityMotion.update(e);var s=this.progressOpacityMotion.value.opacity;this.panoMesh.material.uniforms.progressOpacity.value=s,this.needsRender=!0}if(!this.opacityMotion.ended){this.opacityMotion.update(e);var s=this.opacityMotion.value.opacity;this.panoMesh.material.uniforms.opacity.value=s,this.needsRender=!0}if(this.visible=this.opacityMotion.value.opacity!==0,(!this.loadingOpacityMotion.ended||this.loadingOpacityMotion.value.opacity>0)&&(this.loadingOpacityMotion.update(e),this.panoMesh.material.uniforms.loadingOpacity.value=this.loadingOpacityMotion.value.opacity,this.panoMesh.material.uniforms.loadingAngle.value=e/120%(Math.PI*2),this.needsRender=!0),this.tapMotion.ended||(this.tapMotion.update(e),this.panoMesh.material.uniforms.tapOpacity.value=this.tapMotion.value.opacity,this.panoMesh.material.uniforms.tapScale.value=this.tapMotion.value.scale,this.needsRender=!0),this.panoMesh.material.uniforms.circleOpacity.value=Math.max(.6,1-Math.max(this.loadingOpacityMotion.value.opacity,this.progressOpacityMotion.value.opacity)),this.current||!this.currentMotion.ended){this.currentMotion.update(e),this.panoMesh.material.uniforms.expandOpacity.value=this.currentMotion.value.progress;{var u=(e-this.currentStartTime-1500)/2e3;if(u%5<2){var l=u%1;this.panoMesh.material.uniforms.expand0.value=easeOut(l)*this.currentMotion.value.progress,this.needsRender=!0}}{var c=(e-this.currentStartTime-1e3)/2e3;if(c%5<2){var l=c%1;this.panoMesh.material.uniforms.expand1.value=easeOut(l)*this.currentMotion.value.progress,this.needsRender=!0}}}if(!this.disableMotion.ended){var o=this.disableMotion.value.progress;this.disableMotion.update(e),this.panoMesh.material.uniforms.disable.value=o,this.needsRender=!0}},t.prototype.dispose=function(){this.tapMotion.dispose(),this.progressMotion.dispose(),this.progressOpacityMotion.dispose(),this.opacityMotion.dispose(),this.currentMotion.dispose(),this.panoMesh.material.dispose()},t})(THREE__namespace.Object3D);function isSimilarValue(n,t,e){var r=Math.abs(n-t);return r<.001||typeof e!="undefined"&&Math.abs(e-r)<.001}function notSimilarValue(n,t,e){return!isSimilarValue(n,t,e)}function isSimilarVector3(n,t){return n.distanceTo(t)<.001}function notSimilarVector3(n,t){return!isSimilarVector3(n,t)}function createBoxGeometry(n,t,e){n===void 0&&(n=1),t===void 0&&(t=1),e===void 0&&(e=1);var r=n/2,o=t/2,s=e/2,u=new Float32Array([-r,+o,+s,+r,+o,+s,+r,+o,-s,-r,+o,-s,-r,-o,+s,+r,-o,+s,+r,-o,-s,-r,-o,-s]),l=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]),c=new THREE__namespace.BufferGeometry;return c.setAttribute("position",new THREE__namespace.BufferAttribute(u,3)),c.setIndex(new THREE__namespace.BufferAttribute(l,1)),c.addGroup(0,c.index.count,0),c.computeBoundingBox(),c.computeBoundingSphere(),c}var scratchGeometry=createBoxGeometry(1,1,1);scratchGeometry.applyMatrix4(new THREE__namespace.Matrix4().makeScale(-1,1,1));var versionMap=new WeakMap,cameraBoxSize=new THREE__namespace.Vector3(1,1,1),scratchBoundingBox=new THREE__namespace.Box3,scratchBoundingBoxSize=new THREE__namespace.Vector3,scratchCameraBox=new THREE__namespace.Box3,scratchPosition=new THREE__namespace.Vector3,scratchScale=new THREE__namespace.Vector3,BoundingMesh$1=(function(n){__extends(t,n);function t(){var e=this,r=new PBMMeshMaterial("none");return r.flatShading=!0,r.depthWrite=!1,r.transparent=!1,r.blending=THREE__namespace.CustomBlending,r.blendSrc=THREE__namespace.SrcAlphaFactor,r.blendDst=THREE__namespace.OneMinusSrcAlphaFactor,r.blendSrcAlpha=THREE__namespace.OneFactor,r.blendDstAlpha=THREE__namespace.OneMinusSrcAlphaFactor,e=n.call(this,scratchGeometry,[r])||this,e.frustumCulled=!1,e.renderOrder=-1001,e}return t.prototype.update=function(e,r,o){var s=!1,u=Parameter.resolveValue(o.parameter);scratchBoundingBox.copy(u.boundingBox),scratchBoundingBox.getSize(scratchBoundingBoxSize);var l=Math.min(scratchBoundingBoxSize.x/2,500);scratchBoundingBox.min.x-=l,scratchBoundingBox.max.x+=l;var c=Math.min(scratchBoundingBoxSize.y/2,500);scratchBoundingBox.min.z-=c,scratchBoundingBox.max.z+=c;var p=scratchBoundingBoxSize.length()/2;if(scratchBoundingBox.max.y=Math.max(scratchBoundingBox.max.y,p),scratchBoundingBox.union(scratchCameraBox.setFromCenterAndSize(r.position,cameraBoxSize)),scratchBoundingBox.expandByScalar(1),scratchBoundingBox.getCenter(scratchPosition),scratchBoundingBox.getSize(scratchScale),scratchPosition.equals(this.position)||(this.position.copy(scratchPosition),s=!0),scratchScale.equals(this.scale)||(this.scale.copy(scratchScale),s=!0),versionMap.get(this)!==u.version){versionMap.set(this,u.version),s=!0;for(var f=this.material,d=0,h=f;d<h.length;d++){var m=h[d];m.customShaders=u.customShaders,m.pano0=u.pano0,m.pano1=u.pano1,m.refinedScreen=u.refinedScreen,m.modelAlpha=u.modelAlpha,m.progress=u.progress,m.transition=u.transition,m.opacity=u.opacity,m.floorStyle=u.floorStyle,m.constantColor=u.constantColor,m.shownFloorIndex=u.shownFloorIndex,m.clippers=u.clippers,m.brightness=u.brightness,m.logDepthAlpha=u.logDepthAlpha,m.useHQWeight=u.useHQWeight,m.useHQDepth=u.useHQDepth,m.colorSaturation=u.colorSaturation,m.colorBrightness=u.colorBrightness,m.gradientTexture=u.gradientTexture,m.transparent=!1,m.modelBoundingMax.copy(u.boundingBox.max),m.modelBoundingMin.copy(u.boundingBox.min),u.useAddBlend&&(m.opacity=0),m.opacity===0&&(m.visible=!1)}}return s},t.prototype.dispose=function(){for(var e=0,r=this.material;e<r.length;e++){var o=r[e];o.dispose(),o.pano0=null,o.pano1=null}},t})(PBMMesh);function cameraWorldToLocal(n,t){var e=new THREE__namespace.Vector3(0,0,-1);e.applyQuaternion(n.quaternion);var r=t.quaternion.clone().inverse();e.applyQuaternion(r);var o=Math.atan2(e.x,-e.z),s=-Math.asin(e.y);return{theta:o,phi:s,lookAtVector:e}}var PI=Math.PI,TAU=PI*2;function stepNumber(n,t,e){if(n===t)return t;var r=t-n,o=Math.abs(r);if(o<=e)return t;var s=r>0?1:-1;return n+s*e}function stepVector(n,t,e){if(n.equals(t))return new THREE__namespace.Vector3().copy(t);var r=new THREE__namespace.Vector3().subVectors(t,n);return r.lengthSq()<e*e?r.copy(t):r.setLength(e).add(n)}function stepCoordinates(n,t,e){if(n.longitude===t.longitude&&n.latitude===t.latitude)return{longitude:t.longitude,latitude:t.latitude};var r=formatRad$1(n.longitude),o=n.latitude,s=formatRad$1(t.longitude),u=t.latitude;s-r>PI?r+=TAU:r-s>PI&&(r-=TAU);var l=Math.sqrt(Math.pow(s-r,2)+Math.pow(u-o,2)),c=e/l;return c>=1?{longitude:t.longitude,latitude:t.latitude}:{longitude:r+(s-r)*c,latitude:o+(u-o)*c}}function isPromise(n){return!!n&&(typeof n=="object"||typeof n=="function")&&typeof n.then=="function"}var _a$2,userAgent=typeof navigator!="undefined"?((_a$2=navigator==null?void 0:navigator.userAgent)!==null&&_a$2!==void 0?_a$2:"").toLowerCase():"node";(function(){try{var n=document.createElement("canvas");return!!(window.WebGLRenderingContext&&(n.getContext("webgl")||n.getContext("experimental-webgl")))}catch(t){return!1}})();var isMobile=/android/i.test(userAgent)||/webos/i.test(userAgent)||/ipad|iphone|ipod/i.test(userAgent)||/iemobile/i.test(userAgent)||/opera mini/i.test(userAgent)||/blackberry/i.test(userAgent)||/windows phone/i.test(userAgent);function createEvent(n,t){for(var e=!1,r={type:n,timeStamp:now(),get defaultPrevented(){return e},preventDefault:function(){e=!0}},o=0,s=Object.keys(t);o<s.length;o++){var u=s[o];u in r||(r[u]=t[u])}return r}function requestDeviceOrientationPermission(){return typeof location=="undefined"||location.protocol!=="https:"?Promise.reject(new Error("Request DeviceOrientation Permission denied.")):typeof DeviceOrientationEvent!="undefined"&&typeof DeviceOrientationEvent.requestPermission=="function"?DeviceOrientationEvent.requestPermission().then(function(n){if(n=="granted")return Promise.resolve();var t=new Error("Request DeviceOrientation Permission denied.");return Promise.reject(t)}):Promise.resolve()}function requestXRSessionPermission(){if("xr"in navigator)return navigator.xr.isSessionSupported("immersive-vr").then(function(t){return t?Promise.resolve():Promise.reject()}).then(function(){var t={optionalFeatures:["local-floor"]};return navigator.xr.requestSession("immersive-vr",t).then(function(e){return Promise.resolve(e)})});var n=new Error("Request XR Permission denied.");return Promise.reject(n)}function assignState(n,t){n.mode=t.mode,n.workCode=t.workCode,n.panoIndex=t.panoIndex,n.longitude=t.longitude,n.latitude=t.latitude,n.fov=t.fov,n.offset.copy(t.offset),n.distance=t.distance}function stateEqual(n,t){return n.workCode===t.workCode&&n.mode===t.mode&&n.panoIndex===t.panoIndex&&isSimilarValue(n.longitude,t.longitude,Math.PI*2)&&isSimilarValue(n.latitude,t.latitude)&&isSimilarValue(n.fov,t.fov)&&isSimilarVector3(n.offset,t.offset)&&isSimilarValue(n.distance,t.distance)}function assignPose(n,t){n.longitude=t.longitude,n.latitude=t.latitude,n.fov=t.fov,n.distance=t.distance,n.offset.copy(t.offset)}function clonePose(n){return{longitude:n.longitude,latitude:n.latitude,fov:n.fov,offset:n.offset.clone(),distance:n.distance}}function isThirdPersonMode(n){switch(n){case"Floorplan":return!0;case"Mapview":return!0;default:return!1}}function isFristPersonMode(n){switch(n){case"Panorama":return!0;case"VRPanorama":return!0;case"XRPanorama":return!0;case"Model":return!0;default:return!1}}function isEmptyObject(n){for(var t in n)return!1;return!0}/*! Hammer.JS - v2.0.7 - 2016-04-22
1387
+ `,PanoCircleMeshCustom=(function(n){__extends(t,n);function t(e){e===void 0&&(e={});var r,o,s,u,l,c,p,f=n.call(this)||this,d=(r=e.color)!==null&&r!==void 0?r:16777215,h=(o=e.scale)!==null&&o!==void 0?o:1,m=e.map,A=(s=e.mapAlpha)!==null&&s!==void 0?s:1,g=(u=e.mapUseColor)!==null&&u!==void 0?u:!1,y=(l=e.mapUseReverse)!==null&&l!==void 0?l:!1,v=(c=e.borderWidth)!==null&&c!==void 0?c:.1,E=(p=e.borderColor)!==null&&p!==void 0?p:16777215;return f.progress=0,f.opacity=0,f.loading=!1,f.current=!1,f.disabled=!1,f.currentMotion=new Motion({progress:0}),f.tapMotion=new Motion({scale:1,opacity:1}),f.loadingOpacityMotion=new Motion({opacity:0}),f.progressMotion=new Motion({progress:0}),f.progressOpacityMotion=new Motion({opacity:0}),f.opacityMotion=new Motion({opacity:0}),f.disableMotion=new Motion({progress:0}),f.panoMesh=new THREE__namespace.Mesh(sharedGeometry2,new THREE__namespace.ShaderMaterial({blending:THREE__namespace.CustomBlending,blendSrc:THREE__namespace.SrcAlphaFactor,blendDst:THREE__namespace.OneMinusSrcAlphaFactor,blendSrcAlpha:THREE__namespace.OneFactor,blendDstAlpha:THREE__namespace.OneMinusSrcAlphaFactor,depthWrite:!1,vertexShader:vertexShader$4,fragmentShader:fragmentShader$4,defines:{USE_COLOR:g,USE_MAP:m!==void 0,USE_BORDER:v>0,USE_REVERSE:y},uniforms:{baseColor:{value:new THREE__namespace.Color(d)},circleScale:{value:1},circleOpacity:{value:1},loadingAngle:{value:0},loadingOpacity:{value:0},progress:{value:0},progressOpacity:{value:0},expand0:{value:0},expand1:{value:0},expandOpacity:{value:0},opacity:{value:0},tapScale:{value:1},tapOpacity:{value:1},disable:{value:0},map:{value:m},mapAlpha:{value:A},borderWidth:{value:v},borderColor:{value:new THREE__namespace.Color(E)}}})),f.renderOrder=-2,f.panoMesh.renderOrder=-2,f.panoMesh.position.y=.004,f.panoMesh.scale.set(h,1,h),f.add(f.panoMesh),f.currentStartTime=now(),f.needsRender=!0,f}return t.prototype.setProgress=function(e){var r=this;this.setDisabled(!1),this.setLoading(!1),this.progress!==e&&(e=clamp$1(e,0,1),this.tapMotion.ended&&(this.progress===0&&this.progressOpacityMotion.set({opacity:1},500).catch(noop),e===0?this.progressOpacityMotion.set({opacity:0},500).catch(noop).then(function(){r.progressMotion.set({progress:0},0).catch(noop)}):this.progressMotion.set({progress:clamp$1(e*1.2,0,1)},100).catch(noop)),this.progress=e)},t.prototype.setOpacity=function(e){this.opacity!==e&&(this.opacity=e=clamp$1(e,0,1),this.opacityMotion.set({opacity:e},200).catch(noop))},t.prototype.setCurrent=function(e){this.current!==e&&(this.currentMotion.set({progress:e?1:0},2e3).catch(noop),this.current=e,this.current===!0&&(this.currentStartTime=now()))},t.prototype.setLoading=function(e){this.loading!==e&&(this.loading=e,this.disabled===!0&&this.setDisabled(!1),this.loadingOpacityMotion.set({opacity:e?1:0},500).catch(noop))},t.prototype.setDisabled=function(e){this.disabled!==e&&(this.disabled=e,this.loading===!0&&this.setLoading(!1),this.disableMotion.set({progress:e?1:0},500).catch(noop))},t.prototype.tap=function(){var e=this;if(!this.tapMotion.ended)return Promise.resolve();var r=[{progress:0,value:{scale:1,opacity:1}},{progress:.3,value:{scale:.85,opacity:.5}},{progress:.8,value:{scale:1.05,opacity:.6}},{progress:1,value:{scale:1,opacity:1}}];return this.progressOpacityMotion.set({opacity:0},0).catch(noop),this.progressMotion.set({progress:0},0).catch(noop),this.tapMotion.setKeyframes(r,600).then(function(){e.progressOpacityMotion.set({opacity:e.progress>0?1:0},300).catch(noop),e.progressMotion.set({progress:e.progress},120).catch(noop)}).catch(noop)},t.prototype.updateTime=function(e,r){if(!this.progressMotion.ended){this.progressMotion.update(e);var o=this.progressMotion.value.progress;this.panoMesh.material.uniforms.progress.value=o,this.needsRender=!0}if(!this.progressOpacityMotion.ended){this.progressOpacityMotion.update(e);var s=this.progressOpacityMotion.value.opacity;this.panoMesh.material.uniforms.progressOpacity.value=s,this.needsRender=!0}if(!this.opacityMotion.ended){this.opacityMotion.update(e);var s=this.opacityMotion.value.opacity;this.panoMesh.material.uniforms.opacity.value=s,this.needsRender=!0}if(this.visible=this.opacityMotion.value.opacity!==0,(!this.loadingOpacityMotion.ended||this.loadingOpacityMotion.value.opacity>0)&&(this.loadingOpacityMotion.update(e),this.panoMesh.material.uniforms.loadingOpacity.value=this.loadingOpacityMotion.value.opacity,this.panoMesh.material.uniforms.loadingAngle.value=e/120%(Math.PI*2),this.needsRender=!0),this.tapMotion.ended||(this.tapMotion.update(e),this.panoMesh.material.uniforms.tapOpacity.value=this.tapMotion.value.opacity,this.panoMesh.material.uniforms.tapScale.value=this.tapMotion.value.scale,this.needsRender=!0),this.panoMesh.material.uniforms.circleOpacity.value=Math.max(.6,1-Math.max(this.loadingOpacityMotion.value.opacity,this.progressOpacityMotion.value.opacity)),this.current||!this.currentMotion.ended){this.currentMotion.update(e),this.panoMesh.material.uniforms.expandOpacity.value=this.currentMotion.value.progress;{var u=(e-this.currentStartTime-1500)/2e3;if(u%5<2){var l=u%1;this.panoMesh.material.uniforms.expand0.value=easeOut(l)*this.currentMotion.value.progress,this.needsRender=!0}}{var c=(e-this.currentStartTime-1e3)/2e3;if(c%5<2){var l=c%1;this.panoMesh.material.uniforms.expand1.value=easeOut(l)*this.currentMotion.value.progress,this.needsRender=!0}}}if(!this.disableMotion.ended){var o=this.disableMotion.value.progress;this.disableMotion.update(e),this.panoMesh.material.uniforms.disable.value=o,this.needsRender=!0}},t.prototype.dispose=function(){this.tapMotion.dispose(),this.progressMotion.dispose(),this.progressOpacityMotion.dispose(),this.opacityMotion.dispose(),this.currentMotion.dispose(),this.panoMesh.material.dispose()},t})(THREE__namespace.Object3D);function isSimilarValue(n,t,e){var r=Math.abs(n-t);return r<.001||typeof e!="undefined"&&Math.abs(e-r)<.001}function notSimilarValue(n,t,e){return!isSimilarValue(n,t,e)}function isSimilarVector3(n,t){return n.distanceTo(t)<.001}function notSimilarVector3(n,t){return!isSimilarVector3(n,t)}var scratchGeometry=createSimpleBoxBufferGeometry(1,1,1);scratchGeometry.applyMatrix4(new THREE__namespace.Matrix4().makeScale(-1,1,1));var versionMap=new WeakMap,cameraBoxSize=new THREE__namespace.Vector3(1,1,1),scratchBoundingBox=new THREE__namespace.Box3,scratchBoundingBoxSize=new THREE__namespace.Vector3,scratchCameraBox=new THREE__namespace.Box3,scratchPosition=new THREE__namespace.Vector3,scratchScale=new THREE__namespace.Vector3,BoundingMesh$1=(function(n){__extends(t,n);function t(){var e=this,r=new PBMMeshMaterial("none");return r.flatShading=!0,r.depthWrite=!1,r.transparent=!1,r.blending=THREE__namespace.CustomBlending,r.blendSrc=THREE__namespace.SrcAlphaFactor,r.blendDst=THREE__namespace.OneMinusSrcAlphaFactor,r.blendSrcAlpha=THREE__namespace.OneFactor,r.blendDstAlpha=THREE__namespace.OneMinusSrcAlphaFactor,e=n.call(this,scratchGeometry,[r])||this,e.frustumCulled=!1,e.renderOrder=-1001,e}return t.prototype.update=function(e,r,o){var s=!1,u=Parameter.resolveValue(o.parameter);scratchBoundingBox.copy(u.boundingBox),scratchBoundingBox.getSize(scratchBoundingBoxSize);var l=Math.min(scratchBoundingBoxSize.x/2,500);scratchBoundingBox.min.x-=l,scratchBoundingBox.max.x+=l;var c=Math.min(scratchBoundingBoxSize.y/2,500);scratchBoundingBox.min.z-=c,scratchBoundingBox.max.z+=c;var p=scratchBoundingBoxSize.length()/2;if(scratchBoundingBox.max.y=Math.max(scratchBoundingBox.max.y,p),scratchBoundingBox.union(scratchCameraBox.setFromCenterAndSize(r.position,cameraBoxSize)),scratchBoundingBox.expandByScalar(1),scratchBoundingBox.getCenter(scratchPosition),scratchBoundingBox.getSize(scratchScale),scratchPosition.equals(this.position)||(this.position.copy(scratchPosition),s=!0),scratchScale.equals(this.scale)||(this.scale.copy(scratchScale),s=!0),versionMap.get(this)!==u.version){versionMap.set(this,u.version),s=!0;for(var f=this.material,d=0,h=f;d<h.length;d++){var m=h[d];m.customShaders=u.customShaders,m.pano0=u.pano0,m.pano1=u.pano1,m.refinedScreen=u.refinedScreen,m.modelAlpha=u.modelAlpha,m.progress=u.progress,m.transition=u.transition,m.opacity=u.opacity,m.floorStyle=u.floorStyle,m.constantColor=u.constantColor,m.shownFloorIndex=u.shownFloorIndex,m.clippers=u.clippers,m.brightness=u.brightness,m.logDepthAlpha=u.logDepthAlpha,m.useHQWeight=u.useHQWeight,m.useHQDepth=u.useHQDepth,m.colorSaturation=u.colorSaturation,m.colorBrightness=u.colorBrightness,m.gradientTexture=u.gradientTexture,m.transparent=!1,m.modelBoundingMax.copy(u.boundingBox.max),m.modelBoundingMin.copy(u.boundingBox.min),u.useAddBlend&&(m.opacity=0),m.opacity===0&&(m.visible=!1)}}return s},t.prototype.dispose=function(){for(var e=0,r=this.material;e<r.length;e++){var o=r[e];o.dispose(),o.pano0=null,o.pano1=null}},t})(PBMMesh),PI=Math.PI,TAU=PI*2;function stepNumber(n,t,e){if(n===t)return t;var r=t-n,o=Math.abs(r);if(o<=e)return t;var s=r>0?1:-1;return n+s*e}function stepVector(n,t,e){if(n.equals(t))return new THREE__namespace.Vector3().copy(t);var r=new THREE__namespace.Vector3().subVectors(t,n);return r.lengthSq()<e*e?r.copy(t):r.setLength(e).add(n)}function stepCoordinates(n,t,e){if(n.longitude===t.longitude&&n.latitude===t.latitude)return{longitude:t.longitude,latitude:t.latitude};var r=formatRad$1(n.longitude),o=n.latitude,s=formatRad$1(t.longitude),u=t.latitude;s-r>PI?r+=TAU:r-s>PI&&(r-=TAU);var l=Math.sqrt(Math.pow(s-r,2)+Math.pow(u-o,2)),c=e/l;return c>=1?{longitude:t.longitude,latitude:t.latitude}:{longitude:r+(s-r)*c,latitude:o+(u-o)*c}}function isPromise(n){return!!n&&(typeof n=="object"||typeof n=="function")&&typeof n.then=="function"}var _a$2,userAgent=typeof navigator!="undefined"?((_a$2=navigator==null?void 0:navigator.userAgent)!==null&&_a$2!==void 0?_a$2:"").toLowerCase():"node";(function(){try{var n=document.createElement("canvas");return!!(window.WebGLRenderingContext&&(n.getContext("webgl")||n.getContext("experimental-webgl")))}catch(t){return!1}})();var isMobile=/android/i.test(userAgent)||/webos/i.test(userAgent)||/ipad|iphone|ipod/i.test(userAgent)||/iemobile/i.test(userAgent)||/opera mini/i.test(userAgent)||/blackberry/i.test(userAgent)||/windows phone/i.test(userAgent);function createEvent(n,t){for(var e=!1,r={type:n,timeStamp:now(),get defaultPrevented(){return e},preventDefault:function(){e=!0}},o=0,s=Object.keys(t);o<s.length;o++){var u=s[o];u in r||(r[u]=t[u])}return r}function requestDeviceOrientationPermission(){return typeof location=="undefined"||location.protocol!=="https:"?Promise.reject(new Error("Request DeviceOrientation Permission denied.")):typeof DeviceOrientationEvent!="undefined"&&typeof DeviceOrientationEvent.requestPermission=="function"?DeviceOrientationEvent.requestPermission().then(function(n){if(n=="granted")return Promise.resolve();var t=new Error("Request DeviceOrientation Permission denied.");return Promise.reject(t)}):Promise.resolve()}function requestXRSessionPermission(){if("xr"in navigator)return navigator.xr.isSessionSupported("immersive-vr").then(function(t){return t?Promise.resolve():Promise.reject()}).then(function(){var t={optionalFeatures:["local-floor"]};return navigator.xr.requestSession("immersive-vr",t).then(function(e){return Promise.resolve(e)})});var n=new Error("Request XR Permission denied.");return Promise.reject(n)}function assignState(n,t){n.mode=t.mode,n.workCode=t.workCode,n.panoIndex=t.panoIndex,n.longitude=t.longitude,n.latitude=t.latitude,n.fov=t.fov,n.offset.copy(t.offset),n.distance=t.distance}function stateEqual(n,t){return n.workCode===t.workCode&&n.mode===t.mode&&n.panoIndex===t.panoIndex&&isSimilarValue(n.longitude,t.longitude,Math.PI*2)&&isSimilarValue(n.latitude,t.latitude)&&isSimilarValue(n.fov,t.fov)&&isSimilarVector3(n.offset,t.offset)&&isSimilarValue(n.distance,t.distance)}function assignPose(n,t){n.longitude=t.longitude,n.latitude=t.latitude,n.fov=t.fov,n.distance=t.distance,n.offset.copy(t.offset)}function clonePose(n){return{longitude:n.longitude,latitude:n.latitude,fov:n.fov,offset:n.offset.clone(),distance:n.distance}}function isThirdPersonMode(n){switch(n){case"Floorplan":return!0;case"Mapview":return!0;default:return!1}}function isFristPersonMode(n){switch(n){case"Panorama":return!0;case"VRPanorama":return!0;case"XRPanorama":return!0;case"Model":return!0;default:return!1}}function isEmptyObject(n){for(var t in n)return!1;return!0}/*! Hammer.JS - v2.0.7 - 2016-04-22
1388
1388
  * http://hammerjs.github.io/
1389
1389
  *
1390
1390
  * Copyright (c) 2016 Jorik Tangelder;
1391
1391
  * 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(I,H,k){return setTimeout(E(I,k),H)}function d(I,H,k){return Array.isArray(I)?(h(I,k[H],k),!0):!1}function h(I,H,k){var q;if(I)if(I.forEach)I.forEach(H,k);else if(I.length!==r)for(q=0;q<I.length;)H.call(k,I[q],q,I),q++;else for(q in I)I.hasOwnProperty(q)&&H.call(k,I[q],q,I)}function m(I,H,k){var q="DEPRECATED METHOD: "+H+`
1392
1392
  `+k+` AT
1393
- `;return function(){var $=new Error("get-stack-trace"),oe=$&&$.stack?$.stack.replace(/^[^\(]+?[\n$]/gm,"").replace(/^\s+at\s+/gm,"").replace(/^Object.<anonymous>\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",be=n.console&&(n.console.warn||n.console.log);return be&&be.call(n.console,q,oe),I.apply(this,arguments)}}var A;typeof Object.assign!="function"?A=function(H){if(H===r||H===null)throw new TypeError("Cannot convert undefined or null to object");for(var k=Object(H),q=1;q<arguments.length;q++){var $=arguments[q];if($!==r&&$!==null)for(var oe in $)$.hasOwnProperty(oe)&&(k[oe]=$[oe])}return k}:A=Object.assign;var g=m(function(H,k,q){for(var $=Object.keys(k),oe=0;oe<$.length;)(!q||q&&H[$[oe]]===r)&&(H[$[oe]]=k[$[oe]]),oe++;return H},"extend","Use `assign`."),y=m(function(H,k){return g(H,k,!0)},"merge","Use `assign`.");function v(I,H,k){var q=H.prototype,$;$=I.prototype=Object.create(q),$.constructor=I,$._super=q,k&&A($,k)}function E(I,H){return function(){return I.apply(H,arguments)}}function b(I,H){return typeof I==u?I.apply(H&&H[0]||r,H):I}function T(I,H){return I===r?H:I}function _(I,H,k){h(M(H),function(q){I.addEventListener(q,k,!1)})}function S(I,H,k){h(M(H),function(q){I.removeEventListener(q,k,!1)})}function R(I,H){for(;I;){if(I==H)return!0;I=I.parentNode}return!1}function w(I,H){return I.indexOf(H)>-1}function M(I){return I.trim().split(/\s+/g)}function B(I,H,k){if(I.indexOf&&!k)return I.indexOf(H);for(var q=0;q<I.length;){if(k&&I[q][k]==H||!k&&I[q]===H)return q;q++}return-1}function C(I){return Array.prototype.slice.call(I,0)}function P(I,H,k){for(var q=[],$=[],oe=0;oe<I.length;){var be=I[oe][H];B($,be)<0&&q.push(I[oe]),$[oe]=be,oe++}return q=q.sort(function(Xe,Fe){return Xe[H]>Fe[H]}),q}function L(I,H){for(var k,q,$=H[0].toUpperCase()+H.slice(1),oe=0;oe<o.length;){if(k=o[oe],q=k?k+$:H,q in I)return q;oe++}return r}var O=1;function F(){return O++}function N(I){var H=I.ownerDocument||I;return H.defaultView||H.parentWindow||n}var D=/mobile|tablet|ip(ad|hone|od)|android/i,U="ontouchstart"in n,z=L(n,"PointerEvent")!==r,G=U&&D.test(navigator.userAgent),j="touch",Q="pen",V="mouse",J="kinect",W=25,X=1,Z=2,Y=4,K=8,ee=1,te=2,re=4,ae=8,ce=16,ie=te|re,fe=ae|ce,ge=ie|fe,ye=["x","y"],_e=["clientX","clientY"];function le(I,H){var k=this;this.manager=I,this.callback=H,this.element=I.element,this.target=I.options.inputTarget,this.domHandler=function(q){b(I.options.enable,[I])&&k.handler(q)},this.init()}le.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 de(I){var H,k=I.options.inputClass;return k?H=k:z?H=Pe:G?H=Ue:U?H=dt:H=ke,new H(I,ne)}function ne(I,H,k){var q=k.pointers.length,$=k.changedPointers.length,oe=H&X&&q-$===0,be=H&(Y|K)&&q-$===0;k.isFirst=!!oe,k.isFinal=!!be,oe&&(I.session={}),k.eventType=H,se(I,k),I.emit("hammer.input",k),I.recognize(k),I.session.prevInput=k}function se(I,H){var k=I.session,q=H.pointers,$=q.length;k.firstInput||(k.firstInput=Ne(H)),$>1&&!k.firstMultiple?k.firstMultiple=Ne(H):$===1&&(k.firstMultiple=!1);var oe=k.firstInput,be=k.firstMultiple,De=be?be.center:oe.center,Xe=H.center=qe(q);H.timeStamp=p(),H.deltaTime=H.timeStamp-oe.timeStamp,H.angle=Ke(De,Xe),H.distance=ve(De,Xe),he(k,H),H.offsetDirection=Ve(H.deltaX,H.deltaY);var Fe=Ye(H.deltaTime,H.deltaX,H.deltaY);H.overallVelocityX=Fe.x,H.overallVelocityY=Fe.y,H.overallVelocity=c(Fe.x)>c(Fe.y)?Fe.x:Fe.y,H.scale=be?Le(be.pointers,q):1,H.rotation=be?Te(be.pointers,q):0,H.maxPointers=k.prevInput?H.pointers.length>k.prevInput.maxPointers?H.pointers.length:k.prevInput.maxPointers:H.pointers.length,me(k,H);var lt=I.element;R(H.srcEvent.target,lt)&&(lt=H.srcEvent.target),H.target=lt}function he(I,H){var k=H.center,q=I.offsetDelta||{},$=I.prevDelta||{},oe=I.prevInput||{};(H.eventType===X||oe.eventType===Y)&&($=I.prevDelta={x:oe.deltaX||0,y:oe.deltaY||0},q=I.offsetDelta={x:k.x,y:k.y}),H.deltaX=$.x+(k.x-q.x),H.deltaY=$.y+(k.y-q.y)}function me(I,H){var k=I.lastInterval||H,q=H.timeStamp-k.timeStamp,$,oe,be,De;if(H.eventType!=K&&(q>W||k.velocity===r)){var Xe=H.deltaX-k.deltaX,Fe=H.deltaY-k.deltaY,lt=Ye(q,Xe,Fe);oe=lt.x,be=lt.y,$=c(lt.x)>c(lt.y)?lt.x:lt.y,De=Ve(Xe,Fe),I.lastInterval=H}else $=k.velocity,oe=k.velocityX,be=k.velocityY,De=k.direction;H.velocity=$,H.velocityX=oe,H.velocityY=be,H.direction=De}function Ne(I){for(var H=[],k=0;k<I.pointers.length;)H[k]={clientX:l(I.pointers[k].clientX),clientY:l(I.pointers[k].clientY)},k++;return{timeStamp:p(),pointers:H,center:qe(H),deltaX:I.deltaX,deltaY:I.deltaY}}function qe(I){var H=I.length;if(H===1)return{x:l(I[0].clientX),y:l(I[0].clientY)};for(var k=0,q=0,$=0;$<H;)k+=I[$].clientX,q+=I[$].clientY,$++;return{x:l(k/H),y:l(q/H)}}function Ye(I,H,k){return{x:H/I||0,y:k/I||0}}function Ve(I,H){return I===H?ee:c(I)>=c(H)?I<0?te:re:H<0?ae:ce}function ve(I,H,k){k||(k=ye);var q=H[k[0]]-I[k[0]],$=H[k[1]]-I[k[1]];return Math.sqrt(q*q+$*$)}function Ke(I,H,k){k||(k=ye);var q=H[k[0]]-I[k[0]],$=H[k[1]]-I[k[1]];return Math.atan2($,q)*180/Math.PI}function Te(I,H){return Ke(H[1],H[0],_e)+Ke(I[1],I[0],_e)}function Le(I,H){return ve(H[0],H[1],_e)/ve(I[0],I[1],_e)}var Me={mousedown:X,mousemove:Z,mouseup:Y},$e="mousedown",tt="mousemove mouseup";function ke(){this.evEl=$e,this.evWin=tt,this.pressed=!1,le.apply(this,arguments)}v(ke,le,{handler:function(H){var k=Me[H.type];k&X&&(H.button===0||H.button===2)&&(this.pressed=!0),k&Z&&H.which!==1&&(k=Y),this.pressed&&(k&Y&&(this.pressed=!1),this.callback(this.manager,k,{pointers:[H],changedPointers:[H],pointerType:V,srcEvent:H}))}});var Ie={pointerdown:X,pointermove:Z,pointerup:Y,pointercancel:K,pointerout:K},He={2:j,3:Q,4:V,5:J},Ee="pointerdown",we="pointermove pointerup pointercancel";n.MSPointerEvent&&!n.PointerEvent&&(Ee="MSPointerDown",we="MSPointerMove MSPointerUp MSPointerCancel");function Pe(){this.evEl=Ee,this.evWin=we,le.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}v(Pe,le,{handler:function(H){var k=this.store,q=!1,$=!1,oe=H.type.toLowerCase().replace("ms",""),be=Ie[oe],De=He[H.pointerType]||H.pointerType,Xe=De==j,Fe=B(k,H.pointerId,"pointerId");be&X&&(H.button===0||H.button===2||Xe)?Fe<0&&(k.push(H),Fe=k.length-1):be&(Y|K)?q=!0:!Xe&&H.buttons===0&&(q=!0,$=!0,be=Ie.pointerup),!(Fe<0)&&($||(k[Fe]=H),this.callback(this.manager,be,{pointers:k,changedPointers:[H],pointerType:De,srcEvent:k[Fe]}),q&&k.splice(Fe,1))}});var je={touchstart:X,touchmove:Z,touchend:Y,touchcancel:K},Qe="touchstart",We="touchstart touchmove touchend touchcancel";function gt(){this.evTarget=Qe,this.evWin=We,this.started=!1,le.apply(this,arguments)}v(gt,le,{handler:function(H){var k=je[H.type];if(k===X&&(this.started=!0),!!this.started){var q=Je.call(this,H,k);k&(Y|K)&&q[0].length-q[1].length===0&&(this.started=!1),this.callback(this.manager,k,{pointers:q[0],changedPointers:q[1],pointerType:j,srcEvent:H})}}});function Je(I,H){var k=C(I.touches),q=C(I.changedTouches);return H&(Y|K)&&(k=P(k.concat(q),"identifier")),[k,q]}var At={touchstart:X,touchmove:Z,touchend:Y,touchcancel:K},Re="touchstart touchmove touchend touchcancel";function Ue(){this.evTarget=Re,this.targetIds={},le.apply(this,arguments)}v(Ue,le,{handler:function(H){var k=At[H.type],q=yt.call(this,H,k);q&&this.callback(this.manager,k,{pointers:q[0],changedPointers:q[1],pointerType:j,srcEvent:H})}});function yt(I,H){var k=C(I.touches),q=this.targetIds;if(H&(X|Z)&&k.length===1)return q[k[0].identifier]=!0,[k,k];var $,oe,be=C(I.changedTouches),De=[],Xe=this.target;if(oe=k.filter(function(Fe){return R(Fe.target,Xe)}),H===X)for($=0;$<oe.length;)q[oe[$].identifier]=!0,$++;for($=0;$<be.length;)q[be[$].identifier]&&De.push(be[$]),H&(Y|K)&&delete q[be[$].identifier],$++;if(De.length)return[P(oe.concat(De),"identifier"),De]}var Ct=2500,Et=25;function dt(){le.apply(this,arguments);var I=E(this.handler,this);this.touch=new Ue(this.manager,I),this.mouse=new ke(this.manager,I),this.primaryTouch=null,this.lastTouches=[]}v(dt,le,{handler:function(H,k,q){var $=q.pointerType==j,oe=q.pointerType==V;if(!(oe&&q.sourceCapabilities&&q.sourceCapabilities.firesTouchEvents)){if($)ht.call(this,k,q);else if(oe&&ut.call(this,q))return;this.callback(H,k,q)}},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});function ht(I,H){I&X?(this.primaryTouch=H.changedPointers[0].identifier,ze.call(this,H)):I&(Y|K)&&ze.call(this,H)}function ze(I){var H=I.changedPointers[0];if(H.identifier===this.primaryTouch){var k={x:H.clientX,y:H.clientY};this.lastTouches.push(k);var q=this.lastTouches,$=function(){var oe=q.indexOf(k);oe>-1&&q.splice(oe,1)};setTimeout($,Ct)}}function ut(I){for(var H=I.srcEvent.clientX,k=I.srcEvent.clientY,q=0;q<this.lastTouches.length;q++){var $=this.lastTouches[q],oe=Math.abs(H-$.x),be=Math.abs(k-$.y);if(oe<=Et&&be<=Et)return!0}return!1}var rt=s?L(s.style,"touchAction"):r,ue=rt!==r,Ae="compute",Ce="auto",Be="manipulation",nt="none",ct="pan-x",bt="pan-y",Bt=Tt();function at(I,H){this.manager=I,this.set(H)}at.prototype={set:function(I){I==Ae&&(I=this.compute()),ue&&this.manager.element.style&&Bt[I]&&(this.manager.element.style[rt]=I),this.actions=I.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var I=[];return h(this.manager.recognizers,function(H){b(H.options.enable,[H])&&(I=I.concat(H.getTouchAction()))}),pt(I.join(" "))},preventDefaults:function(I){var H=I.srcEvent,k=I.offsetDirection;if(this.manager.session.prevented){H.preventDefault();return}var q=this.actions,$=w(q,nt)&&!Bt[nt],oe=w(q,bt)&&!Bt[bt],be=w(q,ct)&&!Bt[ct];if($){var De=I.pointers.length===1,Xe=I.distance<2,Fe=I.deltaTime<250;if(De&&Xe&&Fe)return}if(!(be&&oe)&&($||oe&&k&ie||be&&k&fe))return this.preventSrc(H)},preventSrc:function(I){this.manager.session.prevented=!0,I.preventDefault()}};function pt(I){if(w(I,nt))return nt;var H=w(I,ct),k=w(I,bt);return H&&k?nt:H||k?H?ct:bt:w(I,Be)?Be:Ce}function Tt(){if(!ue)return!1;var I={},H=n.CSS&&n.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach(function(k){I[k]=H?n.CSS.supports("touch-action",k):!0}),I}var Mt=1,it=2,It=4,_t=8,vt=_t,xt=16,Ge=32;function mt(I){this.options=A({},this.defaults,I||{}),this.id=F(),this.manager=null,this.options.enable=T(this.options.enable,!0),this.state=Mt,this.simultaneous={},this.requireFail=[]}mt.prototype={defaults:{},set:function(I){return A(this.options,I),this.manager&&this.manager.touchAction.update(),this},recognizeWith:function(I){if(d(I,"recognizeWith",this))return this;var H=this.simultaneous;return I=Ht(I,this),H[I.id]||(H[I.id]=I,I.recognizeWith(this)),this},dropRecognizeWith:function(I){return d(I,"dropRecognizeWith",this)?this:(I=Ht(I,this),delete this.simultaneous[I.id],this)},requireFailure:function(I){if(d(I,"requireFailure",this))return this;var H=this.requireFail;return I=Ht(I,this),B(H,I)===-1&&(H.push(I),I.requireFailure(this)),this},dropRequireFailure:function(I){if(d(I,"dropRequireFailure",this))return this;I=Ht(I,this);var H=B(this.requireFail,I);return H>-1&&this.requireFail.splice(H,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(I){return!!this.simultaneous[I.id]},emit:function(I){var H=this,k=this.state;function q($){H.manager.emit($,I)}k<_t&&q(H.options.event+Ot(k)),q(H.options.event),I.additionalEvent&&q(I.additionalEvent),k>=_t&&q(H.options.event+Ot(k))},tryEmit:function(I){if(this.canEmit())return this.emit(I);this.state=Ge},canEmit:function(){for(var I=0;I<this.requireFail.length;){if(!(this.requireFail[I].state&(Ge|Mt)))return!1;I++}return!0},recognize:function(I){var H=A({},I);if(!b(this.options.enable,[this,H])){this.reset(),this.state=Ge;return}this.state&(vt|xt|Ge)&&(this.state=Mt),this.state=this.process(H),this.state&(it|It|_t|xt)&&this.tryEmit(H)},process:function(I){},getTouchAction:function(){},reset:function(){}};function Ot(I){return I&xt?"cancel":I&_t?"end":I&It?"move":I&it?"start":""}function Lt(I){return I==ce?"down":I==ae?"up":I==te?"left":I==re?"right":""}function Ht(I,H){var k=H.manager;return k?k.get(I):I}function ot(){mt.apply(this,arguments)}v(ot,mt,{defaults:{pointers:1},attrTest:function(I){var H=this.options.pointers;return H===0||I.pointers.length===H},process:function(I){var H=this.state,k=I.eventType,q=H&(it|It),$=this.attrTest(I);return q&&(k&K||!$)?H|xt:q||$?k&Y?H|_t:H&it?H|It:it:Ge}});function St(){ot.apply(this,arguments),this.pX=null,this.pY=null}v(St,ot,{defaults:{event:"pan",threshold:10,pointers:1,direction:ge},getTouchAction:function(){var I=this.options.direction,H=[];return I&ie&&H.push(bt),I&fe&&H.push(ct),H},directionTest:function(I){var H=this.options,k=!0,q=I.distance,$=I.direction,oe=I.deltaX,be=I.deltaY;return $&H.direction||(H.direction&ie?($=oe===0?ee:oe<0?te:re,k=oe!=this.pX,q=Math.abs(I.deltaX)):($=be===0?ee:be<0?ae:ce,k=be!=this.pY,q=Math.abs(I.deltaY))),I.direction=$,k&&q>H.threshold&&$&H.direction},attrTest:function(I){return ot.prototype.attrTest.call(this,I)&&(this.state&it||!(this.state&it)&&this.directionTest(I))},emit:function(I){this.pX=I.deltaX,this.pY=I.deltaY;var H=Lt(I.direction);H&&(I.additionalEvent=this.options.event+H),this._super.emit.call(this,I)}});function ft(){ot.apply(this,arguments)}v(ft,ot,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[nt]},attrTest:function(I){return this._super.attrTest.call(this,I)&&(Math.abs(I.scale-1)>this.options.threshold||this.state&it)},emit:function(I){if(I.scale!==1){var H=I.scale<1?"in":"out";I.additionalEvent=this.options.event+H}this._super.emit.call(this,I)}});function Rt(){mt.apply(this,arguments),this._timer=null,this._input=null}v(Rt,mt,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[Ce]},process:function(I){var H=this.options,k=I.pointers.length===H.pointers,q=I.distance<H.threshold,$=I.deltaTime>H.time;if(this._input=I,!q||!k||I.eventType&(Y|K)&&!$)this.reset();else if(I.eventType&X)this.reset(),this._timer=f(function(){this.state=vt,this.tryEmit()},H.time,this);else if(I.eventType&Y)return vt;return Ge},reset:function(){clearTimeout(this._timer)},emit:function(I){this.state===vt&&(I&&I.eventType&Y?this.manager.emit(this.options.event+"up",I):(this._input.timeStamp=p(),this.manager.emit(this.options.event,this._input)))}});function wt(){ot.apply(this,arguments)}v(wt,ot,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[nt]},attrTest:function(I){return this._super.attrTest.call(this,I)&&(Math.abs(I.rotation)>this.options.threshold||this.state&it)}});function pe(){ot.apply(this,arguments)}v(pe,ot,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:ie|fe,pointers:1},getTouchAction:function(){return St.prototype.getTouchAction.call(this)},attrTest:function(I){var H=this.options.direction,k;return H&(ie|fe)?k=I.overallVelocity:H&ie?k=I.overallVelocityX:H&fe&&(k=I.overallVelocityY),this._super.attrTest.call(this,I)&&H&I.offsetDirection&&I.distance>this.options.threshold&&I.maxPointers==this.options.pointers&&c(k)>this.options.velocity&&I.eventType&Y},emit:function(I){var H=Lt(I.offsetDirection);H&&this.manager.emit(this.options.event+H,I),this.manager.emit(this.options.event,I)}});function xe(){mt.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}v(xe,mt,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[Be]},process:function(I){var H=this.options,k=I.pointers.length===H.pointers,q=I.distance<H.threshold,$=I.deltaTime<H.time;if(this.reset(),I.eventType&X&&this.count===0)return this.failTimeout();if(q&&$&&k){if(I.eventType!=Y)return this.failTimeout();var oe=this.pTime?I.timeStamp-this.pTime<H.interval:!0,be=!this.pCenter||ve(this.pCenter,I.center)<H.posThreshold;this.pTime=I.timeStamp,this.pCenter=I.center,!be||!oe?this.count=1:this.count+=1,this._input=I;var De=this.count%H.taps;if(De===0)return this.hasRequireFailures()?(this._timer=f(function(){this.state=vt,this.tryEmit()},H.interval,this),it):vt}return Ge},failTimeout:function(){return this._timer=f(function(){this.state=Ge},this.options.interval,this),Ge},reset:function(){clearTimeout(this._timer)},emit:function(){this.state==vt&&(this._input.tapCount=this.count,this.manager.emit(this.options.event,this._input))}});function Se(I,H){return H=H||{},H.recognizers=T(H.recognizers,Se.defaults.preset),new st(I,H)}Se.VERSION="2.0.7",Se.defaults={domEvents:!1,touchAction:Ae,enable:!0,inputTarget:null,inputClass:null,preset:[[wt,{enable:!1}],[ft,{enable:!1},["rotate"]],[pe,{direction:ie}],[St,{direction:ie},["swipe"]],[xe],[xe,{event:"doubletap",taps:2},["tap"]],[Rt]],cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}};var Oe=1,Pt=2;function st(I,H){this.options=A({},Se.defaults,H||{}),this.options.inputTarget=this.options.inputTarget||I,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=I,this.input=de(this),this.touchAction=new at(this,this.options.touchAction),Ze(this,!0),h(this.options.recognizers,function(k){var q=this.add(new k[0](k[1]));k[2]&&q.recognizeWith(k[2]),k[3]&&q.requireFailure(k[3])},this)}st.prototype={set:function(I){return A(this.options,I),I.touchAction&&this.touchAction.update(),I.inputTarget&&(this.input.destroy(),this.input.target=I.inputTarget,this.input.init()),this},stop:function(I){this.session.stopped=I?Pt:Oe},recognize:function(I){var H=this.session;if(!H.stopped){this.touchAction.preventDefaults(I);var k,q=this.recognizers,$=H.curRecognizer;(!$||$&&$.state&vt)&&($=H.curRecognizer=null);for(var oe=0;oe<q.length;)k=q[oe],H.stopped!==Pt&&(!$||k==$||k.canRecognizeWith($))?k.recognize(I):k.reset(),!$&&k.state&(it|It|_t)&&($=H.curRecognizer=k),oe++}},get:function(I){if(I instanceof mt)return I;for(var H=this.recognizers,k=0;k<H.length;k++)if(H[k].options.event==I)return H[k];return null},add:function(I){if(d(I,"add",this))return this;var H=this.get(I.options.event);return H&&this.remove(H),this.recognizers.push(I),I.manager=this,this.touchAction.update(),I},remove:function(I){if(d(I,"remove",this))return this;if(I=this.get(I),I){var H=this.recognizers,k=B(H,I);k!==-1&&(H.splice(k,1),this.touchAction.update())}return this},on:function(I,H){if(I!==r&&H!==r){var k=this.handlers;return h(M(I),function(q){k[q]=k[q]||[],k[q].push(H)}),this}},off:function(I,H){if(I!==r){var k=this.handlers;return h(M(I),function(q){H?k[q]&&k[q].splice(B(k[q],H),1):delete k[q]}),this}},emit:function(I,H){this.options.domEvents&&Ft(I,H);var k=this.handlers[I]&&this.handlers[I].slice();if(!(!k||!k.length)){H.type=I,H.preventDefault=function(){H.srcEvent.preventDefault()};for(var q=0;q<k.length;)k[q](H),q++}},destroy:function(){this.element&&Ze(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}};function Ze(I,H){var k=I.element;if(k.style){var q;h(I.options.cssProps,function($,oe){q=L(k.style,oe),H?(I.oldCssProps[q]=k.style[q],k.style[q]=$):k.style[q]=I.oldCssProps[q]||""}),H||(I.oldCssProps={})}}function Ft(I,H){var k=t.createEvent("Event");k.initEvent(I,!0,!0),k.gesture=H,H.target.dispatchEvent(k)}return A(Se,{INPUT_START:X,INPUT_MOVE:Z,INPUT_END:Y,INPUT_CANCEL:K,STATE_POSSIBLE:Mt,STATE_BEGAN:it,STATE_CHANGED:It,STATE_ENDED:_t,STATE_RECOGNIZED:vt,STATE_CANCELLED:xt,STATE_FAILED:Ge,DIRECTION_NONE:ee,DIRECTION_LEFT:te,DIRECTION_RIGHT:re,DIRECTION_UP:ae,DIRECTION_DOWN:ce,DIRECTION_HORIZONTAL:ie,DIRECTION_VERTICAL:fe,DIRECTION_ALL:ge,Manager:st,Input:le,TouchAction:at,TouchInput:Ue,MouseInput:ke,PointerEventInput:Pe,TouchMouseInput:dt,SingleTouchInput:gt,Recognizer:mt,AttrRecognizer:ot,Tap:xe,Pan:St,Swipe:pe,Pinch:ft,Rotate:wt,Press:Rt,on:_,off:S,each:h,merge:y,extend:g,assign:A,inherit:v,bindFn:E,prefixed:L}),Se})(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,m=h.state,A=h.currentState,g=typeof m.panoIndex=="number"?{workCode:(s=(r=m.workCode)!==null&&r!==void 0?r:(o=d.works[0])===null||o===void 0?void 0:o.workCode)!==null&&s!==void 0?s:"",panoIndex:m.panoIndex}:{workCode:A.workCode,panoIndex:A.panoIndex};return __assign(__assign({},g),{mode:"",longitude:(u=m.longitude)!==null&&u!==void 0?u:A.longitude,latitude:(l=m.latitude)!==null&&l!==void 0?l:A.latitude,fov:(c=m.fov)!==null&&c!==void 0?c:A.fov,offset:(p=m.offset)!==null&&p!==void 0?p:A.offset,distance:(f=m.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.panState=void 0,(e=this.pressState)===null||e===void 0||e.stop(),this.pressState=void 0},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)})},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,m=notSimilarValue(c,this.camera.pose.longitude,Math.PI*2)||notSimilarValue(p,this.camera.pose.latitude),A=notSimilarValue(f,this.camera.pose.fov),g=notSimilarValue(d,this.camera.pose.distance),y=notSimilarVector3(h,this.camera.pose.offset);(A||m||y||g)&&(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.createRaycasterFromCamera=function(e,r){var o=new THREE__namespace.Raycaster;return o.params.Points={threshold:.1},o.firstHitOnly=!0,o.near=r.near,o.far=r.far,o.setFromCamera(e,this.camera),o},t.prototype.bindEvents=function(e){var r=this,o=function(C){var P=calculateThreeMouse(C,r.element,r.viewport);return!(Math.abs(P.x)>1||Math.abs(P.y)>1)},s=new Hammer.Manager(e),u=function(C){var P=C.session;return P.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 P=u(s);if(!(P&&!o(P.center))){var L=createEvent("gesture.pan",{target:C.target,pointerType:C.pointerType,srcEvent:C.srcEvent,pointers:C.pointers.map(function(O){var F=r.relativeClientPosition(O),N=r.createRaycasterFromCamera(F,r.camera);return{x:O.x,y:O.y,delta:0,buttons:0,coords:F,raycaster:N}}),isFirst:C.isFirst,isFinal:C.isFinal,scale:C.scale,center:(function(O){var F=r.relativeClientPosition(O),N=r.createRaycasterFromCamera(F,r.camera);return{x:O.x,y:O.y,delta:0,buttons:0,coords:F,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(L),b()}}),s.on("tap",function(C){if(!(C.pointerType==="mouse"&&C.srcEvent.button!==0)){var P=u(s);if(!(P&&!o(P.center))){var L=createEvent("gesture.tap",{target:C.target,pointerType:C.pointerType,srcEvent:C.srcEvent,pointers:C.pointers.map(function(O){var F=r.relativeClientPosition(O),N=r.createRaycasterFromCamera(F,r.camera);return{x:O.x,y:O.y,delta:0,buttons:0,coords:F,raycaster:N}}),isFirst:!0,isFinal:!0,scale:C.scale,center:(function(O){var F=r.relativeClientPosition(O),N=r.createRaycasterFromCamera(F,r.camera);return{x:O.x,y:O.y,delta:0,buttons:0,coords:F,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(L),b()}}}),s.on("pinchstart pinch pinchend",function(C){var P=u(s);if(!(P&&!o(P.center))){var L=createEvent("gesture.pinch",{target:C.target,pointerType:C.pointerType,srcEvent:C.srcEvent,pointers:C.pointers.map(function(O){var F,N=r.relativeClientPosition(O),D=new THREE__namespace.Raycaster;return D.params.Points={threshold:.1},D.setFromCamera(N,r.camera),{x:O.x,y:O.y,delta:(F=O.delta)!==null&&F!==void 0?F:0,buttons:0,coords:N,raycaster:D}}),isFirst:C.type==="pinchstart",isFinal:C.type==="pinchend",scale:C.scale,center:(function(O){var F=r.relativeClientPosition(O),N=r.createRaycasterFromCamera(F,r.camera);return{x:O.x,y:O.y,delta:0,buttons:0,coords:F,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(L),b()}}),s.on("dbltap",function(C){if(!(C.pointerType==="mouse"&&C.srcEvent.button!==0)){var P=u(s);if(!(P&&!o(P.center))){var L=createEvent("gesture.dbltap",{target:C.target,pointerType:C.pointerType,srcEvent:C.srcEvent,pointers:C.pointers.map(function(O){var F=r.relativeClientPosition(O),N=r.createRaycasterFromCamera(F,r.camera);return{x:O.x,y:O.y,delta:0,buttons:0,coords:F,raycaster:N}}),isFirst:!0,isFinal:!0,scale:C.scale,center:(function(O){var F=r.relativeClientPosition(O),N=r.createRaycasterFromCamera(F,r.camera);return{x:O.x,y:O.y,delta:0,buttons:0,coords:F,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(L),b()}}});var f=null,d=null,h=function(C,P,L){var O={x:L.clientX,y:L.clientY},F=r.relativeClientPosition(O),N=r.createRaycasterFromCamera(F,r.camera),D=__assign(__assign({},O),{coords:F,raycaster:N,buttons:L.buttons,delta:0}),U=C==="pinchend"?P:P-L.deltaY/280,z=createEvent("gesture.pinch",{target:L.target,pointerType:"mouse",srcEvent:L,pointers:[__assign({},D)],isFirst:C==="pinchstart",isFinal:C==="pinchend",scale:clamp$1(U,.1,10),center:__assign({},D),velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0,userAction:!0,state:__assign(__assign({mode:r.mode},r.currentPano),clonePose(r.camera.pose))});return z},m=function(C){var P,L={x:C.clientX,y:C.clientY};if(o(L)){if(C.preventDefault(),C.ctrlKey){var O=(P=f==null?void 0:f.prevEvent.scale)!==null&&P!==void 0?P:1,F=h(f?"pinch":"pinchstart",O,C);f===null?f={firstEvent:F,prevEvent:F}:f.prevEvent=F,r.onPinchGesture(F),d!==null&&window.clearTimeout(d),d=window.setTimeout(function(){var Q;d=null;var V=(Q=f==null?void 0:f.prevEvent.scale)!==null&&Q!==void 0?Q:1,J=h("pinchend",V,C);f=null,r.onPinchGesture(J)},200)}else{var N=(Math.abs(C.deltaY)>Math.abs(C.deltaX)?C.deltaY:C.deltaX)/-60,D=r.mouseWheelState!==void 0,U={x:C.clientX,y:C.clientY},z=r.relativeClientPosition(U),G=r.createRaycasterFromCamera(z,r.camera),j=__assign(__assign({},U),{coords:z,raycaster:G,buttons:C.buttons,delta:N}),F=createEvent("gesture.mousewheel",{target:C.target,pointerType:"mouse",srcEvent:C,pointers:[__assign({},j)],isFirst:D,isFinal:!1,scale:0,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))});r.onMouseWheel(F),r.mouseWheelState&&clearTimeout(r.mouseWheelState.timer),r.mouseWheelState={timer:setTimeout(function(){r.mouseWheelState=void 0;var V=createEvent("gesture.mousewheel",{target:C.target,pointerType:"mouse",srcEvent:C,pointers:[__assign(__assign({},j),{delta:0})],isFirst:!1,isFinal:!0,scale:0,center:__assign(__assign({},j),{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(V)},100)}}b()}},A=function(C){if(!isMobile){if(!o({x:C.clientX,y:C.clientY})){g();return}var P=!1;r.mouseMoveState||(P=!0);var L={x:C.clientX,y:C.clientY},O=r.relativeClientPosition(L),F=r.createRaycasterFromCamera(O,r.camera),N=__assign(__assign({},L),{coords:O,raycaster:F,buttons:C.buttons,delta:0}),D=createEvent("gesture.mousemove",{target:C.target,pointerType:"mouse",srcEvent:C,pointers:[__assign({},N)],isFirst:P,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:D},r.onMouseMove(D),r.pressState&&Math.abs(C.clientX-r.pressState.event.center.y)>10&&Math.abs(C.clientY-r.pressState.event.center.y)>10&&b()}},g=function(){if(r.mouseMoveState){var C=createEvent(r.mouseMoveState.event.type,__assign(__assign({},r.mouseMoveState.event),{isFinal:!0}));r.mouseMoveState=void 0,r.onMouseMove(C)}b()},y=function(C){if(!o(C.center)){b();return}var P=!1;r.pressState||(P=!0,r.pressState={event:C,timeStamp:now(),stop:noop});var L=now()-r.pressState.timeStamp,O=createEvent(r.pressState.event.type,__assign(__assign({},r.pressState.event),{isFirst:P,isFinal:!1,center:__assign(__assign({},r.pressState.event.center),{delta:L}),pointers:r.pressState.event.pointers.map(function(F){return __assign(__assign({},F),{delta:L})})}));r.onPressGesture(O),r.pressState&&(r.pressState.stop=AnimationFrameLoop.shared.add(function(F){y(C)},!0,1))},v=function(C){if(b(),!(C.touches.length>1||C.changedTouches.length<=0)){var P={x:C.changedTouches[0].clientX,y:C.changedTouches[0].clientY},L=r.relativeClientPosition(P),O=r.createRaycasterFromCamera(L,r.camera),F=__assign(__assign({},P),{coords:L,raycaster:O,buttons:0,delta:0}),N=createEvent("gesture.press",{target:C.target,pointerType:"touch",srcEvent:C,pointers:[__assign({},F)],isFirst:!1,isFinal:!1,scale:0,center:F,velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0,userAction:!0,state:__assign(__assign({mode:r.mode},r.currentPano),clonePose(r.camera.pose))});y(N)}},E=function(C){b();var P={x:C.clientX,y:C.clientY},L=r.relativeClientPosition(P),O=r.createRaycasterFromCamera(L,r.camera),F=__assign(__assign({},P),{coords:L,raycaster:O,buttons:C.buttons,delta:0}),N=createEvent("gesture.press",{target:C.target,pointerType:"mouse",srcEvent:C,pointers:[__assign({},F)],isFirst:!1,isFinal:!1,scale:0,center:F,velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0,userAction:!0,state:__assign(__assign({mode:r.mode},r.currentPano),clonePose(r.camera.pose))});y(N)},b=function(){var C;if(r.pressState){var P=now()-r.pressState.timeStamp,L=createEvent(r.pressState.event.type,__assign(__assign({},r.pressState.event),{center:__assign(__assign({},r.pressState.event.center),{delta:P}),isFirst:!1,isFinal:!0,pointers:r.pressState.event.pointers.map(function(O){return __assign(__assign({},O),{delta:P})})}));r.onPressGesture(L),(C=r.pressState)===null||C===void 0||C.stop(),r.pressState=void 0}},T=null,_=function(C){var P,L=!1,O=!1;switch(C.type){case"gesturestart":L=!0;break;case"gestureend":O=!0;break}var F={x:C.clientX,y:C.clientY},N=r.relativeClientPosition(F),D=r.createRaycasterFromCamera(N,r.camera),U=__assign(__assign({},F),{coords:N,raycaster:D,buttons:0,delta:0}),z=createEvent("gesture.pinch",{target:C.target,pointerType:"mouse",srcEvent:C,pointers:[__assign({},U)],isFirst:L,isFinal:O,scale:(P=C.scale)!==null&&P!==void 0?P:1,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))});return z},S=function(C){if(C.preventDefault(),!isMobile){var P=_(C);T={firstEvent:P};var L=T.firstEvent;L&&!o(L.center)||r.onPinchGesture(P)}},R=function(C){if(C.preventDefault(),!isMobile&&T){var P=_(C),L=T.firstEvent;L&&!o(L.center)||r.onPinchGesture(P)}},w=function(C){if(C.preventDefault(),!isMobile&&T){var P=_(C),L=T.firstEvent;T=null,!(L&&!o(L.center))&&r.onPinchGesture(P)}},M=function(C){if(C&&typeof C.preventDefault=="function"&&C.currentTarget===e&&C.preventDefault(),typeof getSelection=="function"){var P=getSelection();P&&P.focusNode&&(P.removeAllRanges&&P.removeAllRanges(),P.empty&&P.empty())}};this.enableWheel&&e.addEventListener("wheel",m,{passive:!1}),e.addEventListener("mousemove",A,!1),e.addEventListener("mouseout",g,!1),e.addEventListener("touchstart",v,{passive:!0}),e.addEventListener("touchend",b,!1),e.addEventListener("touchcancel",b,!1),e.addEventListener("mousedown",E,!1),e.addEventListener("mouseup",b,!1),e.addEventListener("gesturestart",S,{passive:!1}),e.addEventListener("gesturechange",R,{passive:!1}),e.addEventListener("gestureend",w,{passive:!1}),e.addEventListener("touchstart",M,{passive:!1}),e.addEventListener("contextmenu",M,!1);var B=function(){s.destroy(),e.removeEventListener("wheel",m,!1),e.removeEventListener("mousemove",A,!1),e.removeEventListener("mouseout",g,!1),e.removeEventListener("touchstart",v,!1),e.removeEventListener("touchend",b,!1),e.removeEventListener("touchcancel",b,!1),e.removeEventListener("mousedown",E,!1),e.removeEventListener("mouseup",b,!1),e.removeEventListener("gesturestart",S,!1),e.removeEventListener("gesturechange",R,!1),e.removeEventListener("gestureend",w,!1),e.removeEventListener("touchstart",M,!1),e.removeEventListener("contextmenu",M,!1)};return Object.assign(B,{element:e})},t})(Subscribe),sharedGeometry$2=new THREE__namespace.CircleBufferGeometry(.1,16),vertexShader$3=`
1393
+ `;return function(){var $=new Error("get-stack-trace"),oe=$&&$.stack?$.stack.replace(/^[^\(]+?[\n$]/gm,"").replace(/^\s+at\s+/gm,"").replace(/^Object.<anonymous>\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",be=n.console&&(n.console.warn||n.console.log);return be&&be.call(n.console,q,oe),I.apply(this,arguments)}}var A;typeof Object.assign!="function"?A=function(H){if(H===r||H===null)throw new TypeError("Cannot convert undefined or null to object");for(var k=Object(H),q=1;q<arguments.length;q++){var $=arguments[q];if($!==r&&$!==null)for(var oe in $)$.hasOwnProperty(oe)&&(k[oe]=$[oe])}return k}:A=Object.assign;var g=m(function(H,k,q){for(var $=Object.keys(k),oe=0;oe<$.length;)(!q||q&&H[$[oe]]===r)&&(H[$[oe]]=k[$[oe]]),oe++;return H},"extend","Use `assign`."),y=m(function(H,k){return g(H,k,!0)},"merge","Use `assign`.");function v(I,H,k){var q=H.prototype,$;$=I.prototype=Object.create(q),$.constructor=I,$._super=q,k&&A($,k)}function E(I,H){return function(){return I.apply(H,arguments)}}function b(I,H){return typeof I==u?I.apply(H&&H[0]||r,H):I}function T(I,H){return I===r?H:I}function _(I,H,k){h(M(H),function(q){I.addEventListener(q,k,!1)})}function S(I,H,k){h(M(H),function(q){I.removeEventListener(q,k,!1)})}function R(I,H){for(;I;){if(I==H)return!0;I=I.parentNode}return!1}function w(I,H){return I.indexOf(H)>-1}function M(I){return I.trim().split(/\s+/g)}function B(I,H,k){if(I.indexOf&&!k)return I.indexOf(H);for(var q=0;q<I.length;){if(k&&I[q][k]==H||!k&&I[q]===H)return q;q++}return-1}function C(I){return Array.prototype.slice.call(I,0)}function P(I,H,k){for(var q=[],$=[],oe=0;oe<I.length;){var be=I[oe][H];B($,be)<0&&q.push(I[oe]),$[oe]=be,oe++}return q=q.sort(function(Xe,Fe){return Xe[H]>Fe[H]}),q}function L(I,H){for(var k,q,$=H[0].toUpperCase()+H.slice(1),oe=0;oe<o.length;){if(k=o[oe],q=k?k+$:H,q in I)return q;oe++}return r}var O=1;function F(){return O++}function N(I){var H=I.ownerDocument||I;return H.defaultView||H.parentWindow||n}var D=/mobile|tablet|ip(ad|hone|od)|android/i,U="ontouchstart"in n,z=L(n,"PointerEvent")!==r,K=U&&D.test(navigator.userAgent),j="touch",Q="pen",V="mouse",J="kinect",W=25,X=1,Z=2,Y=4,G=8,ee=1,te=2,ne=4,ae=8,ce=16,ie=te|ne,fe=ae|ce,ge=ie|fe,ye=["x","y"],_e=["clientX","clientY"];function le(I,H){var k=this;this.manager=I,this.callback=H,this.element=I.element,this.target=I.options.inputTarget,this.domHandler=function(q){b(I.options.enable,[I])&&k.handler(q)},this.init()}le.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 de(I){var H,k=I.options.inputClass;return k?H=k:z?H=Pe:K?H=Ue:U?H=dt:H=ke,new H(I,re)}function re(I,H,k){var q=k.pointers.length,$=k.changedPointers.length,oe=H&X&&q-$===0,be=H&(Y|G)&&q-$===0;k.isFirst=!!oe,k.isFinal=!!be,oe&&(I.session={}),k.eventType=H,se(I,k),I.emit("hammer.input",k),I.recognize(k),I.session.prevInput=k}function se(I,H){var k=I.session,q=H.pointers,$=q.length;k.firstInput||(k.firstInput=Ne(H)),$>1&&!k.firstMultiple?k.firstMultiple=Ne(H):$===1&&(k.firstMultiple=!1);var oe=k.firstInput,be=k.firstMultiple,De=be?be.center:oe.center,Xe=H.center=qe(q);H.timeStamp=p(),H.deltaTime=H.timeStamp-oe.timeStamp,H.angle=Ke(De,Xe),H.distance=ve(De,Xe),he(k,H),H.offsetDirection=Ve(H.deltaX,H.deltaY);var Fe=Ye(H.deltaTime,H.deltaX,H.deltaY);H.overallVelocityX=Fe.x,H.overallVelocityY=Fe.y,H.overallVelocity=c(Fe.x)>c(Fe.y)?Fe.x:Fe.y,H.scale=be?Le(be.pointers,q):1,H.rotation=be?Te(be.pointers,q):0,H.maxPointers=k.prevInput?H.pointers.length>k.prevInput.maxPointers?H.pointers.length:k.prevInput.maxPointers:H.pointers.length,me(k,H);var lt=I.element;R(H.srcEvent.target,lt)&&(lt=H.srcEvent.target),H.target=lt}function he(I,H){var k=H.center,q=I.offsetDelta||{},$=I.prevDelta||{},oe=I.prevInput||{};(H.eventType===X||oe.eventType===Y)&&($=I.prevDelta={x:oe.deltaX||0,y:oe.deltaY||0},q=I.offsetDelta={x:k.x,y:k.y}),H.deltaX=$.x+(k.x-q.x),H.deltaY=$.y+(k.y-q.y)}function me(I,H){var k=I.lastInterval||H,q=H.timeStamp-k.timeStamp,$,oe,be,De;if(H.eventType!=G&&(q>W||k.velocity===r)){var Xe=H.deltaX-k.deltaX,Fe=H.deltaY-k.deltaY,lt=Ye(q,Xe,Fe);oe=lt.x,be=lt.y,$=c(lt.x)>c(lt.y)?lt.x:lt.y,De=Ve(Xe,Fe),I.lastInterval=H}else $=k.velocity,oe=k.velocityX,be=k.velocityY,De=k.direction;H.velocity=$,H.velocityX=oe,H.velocityY=be,H.direction=De}function Ne(I){for(var H=[],k=0;k<I.pointers.length;)H[k]={clientX:l(I.pointers[k].clientX),clientY:l(I.pointers[k].clientY)},k++;return{timeStamp:p(),pointers:H,center:qe(H),deltaX:I.deltaX,deltaY:I.deltaY}}function qe(I){var H=I.length;if(H===1)return{x:l(I[0].clientX),y:l(I[0].clientY)};for(var k=0,q=0,$=0;$<H;)k+=I[$].clientX,q+=I[$].clientY,$++;return{x:l(k/H),y:l(q/H)}}function Ye(I,H,k){return{x:H/I||0,y:k/I||0}}function Ve(I,H){return I===H?ee:c(I)>=c(H)?I<0?te:ne:H<0?ae:ce}function ve(I,H,k){k||(k=ye);var q=H[k[0]]-I[k[0]],$=H[k[1]]-I[k[1]];return Math.sqrt(q*q+$*$)}function Ke(I,H,k){k||(k=ye);var q=H[k[0]]-I[k[0]],$=H[k[1]]-I[k[1]];return Math.atan2($,q)*180/Math.PI}function Te(I,H){return Ke(H[1],H[0],_e)+Ke(I[1],I[0],_e)}function Le(I,H){return ve(H[0],H[1],_e)/ve(I[0],I[1],_e)}var Me={mousedown:X,mousemove:Z,mouseup:Y},$e="mousedown",tt="mousemove mouseup";function ke(){this.evEl=$e,this.evWin=tt,this.pressed=!1,le.apply(this,arguments)}v(ke,le,{handler:function(H){var k=Me[H.type];k&X&&(H.button===0||H.button===2)&&(this.pressed=!0),k&Z&&H.which!==1&&(k=Y),this.pressed&&(k&Y&&(this.pressed=!1),this.callback(this.manager,k,{pointers:[H],changedPointers:[H],pointerType:V,srcEvent:H}))}});var Ie={pointerdown:X,pointermove:Z,pointerup:Y,pointercancel:G,pointerout:G},He={2:j,3:Q,4:V,5:J},Ee="pointerdown",we="pointermove pointerup pointercancel";n.MSPointerEvent&&!n.PointerEvent&&(Ee="MSPointerDown",we="MSPointerMove MSPointerUp MSPointerCancel");function Pe(){this.evEl=Ee,this.evWin=we,le.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}v(Pe,le,{handler:function(H){var k=this.store,q=!1,$=!1,oe=H.type.toLowerCase().replace("ms",""),be=Ie[oe],De=He[H.pointerType]||H.pointerType,Xe=De==j,Fe=B(k,H.pointerId,"pointerId");be&X&&(H.button===0||H.button===2||Xe)?Fe<0&&(k.push(H),Fe=k.length-1):be&(Y|G)?q=!0:!Xe&&H.buttons===0&&(q=!0,$=!0,be=Ie.pointerup),!(Fe<0)&&($||(k[Fe]=H),this.callback(this.manager,be,{pointers:k,changedPointers:[H],pointerType:De,srcEvent:k[Fe]}),q&&k.splice(Fe,1))}});var je={touchstart:X,touchmove:Z,touchend:Y,touchcancel:G},Qe="touchstart",We="touchstart touchmove touchend touchcancel";function gt(){this.evTarget=Qe,this.evWin=We,this.started=!1,le.apply(this,arguments)}v(gt,le,{handler:function(H){var k=je[H.type];if(k===X&&(this.started=!0),!!this.started){var q=Je.call(this,H,k);k&(Y|G)&&q[0].length-q[1].length===0&&(this.started=!1),this.callback(this.manager,k,{pointers:q[0],changedPointers:q[1],pointerType:j,srcEvent:H})}}});function Je(I,H){var k=C(I.touches),q=C(I.changedTouches);return H&(Y|G)&&(k=P(k.concat(q),"identifier")),[k,q]}var At={touchstart:X,touchmove:Z,touchend:Y,touchcancel:G},Re="touchstart touchmove touchend touchcancel";function Ue(){this.evTarget=Re,this.targetIds={},le.apply(this,arguments)}v(Ue,le,{handler:function(H){var k=At[H.type],q=yt.call(this,H,k);q&&this.callback(this.manager,k,{pointers:q[0],changedPointers:q[1],pointerType:j,srcEvent:H})}});function yt(I,H){var k=C(I.touches),q=this.targetIds;if(H&(X|Z)&&k.length===1)return q[k[0].identifier]=!0,[k,k];var $,oe,be=C(I.changedTouches),De=[],Xe=this.target;if(oe=k.filter(function(Fe){return R(Fe.target,Xe)}),H===X)for($=0;$<oe.length;)q[oe[$].identifier]=!0,$++;for($=0;$<be.length;)q[be[$].identifier]&&De.push(be[$]),H&(Y|G)&&delete q[be[$].identifier],$++;if(De.length)return[P(oe.concat(De),"identifier"),De]}var Ct=2500,Et=25;function dt(){le.apply(this,arguments);var I=E(this.handler,this);this.touch=new Ue(this.manager,I),this.mouse=new ke(this.manager,I),this.primaryTouch=null,this.lastTouches=[]}v(dt,le,{handler:function(H,k,q){var $=q.pointerType==j,oe=q.pointerType==V;if(!(oe&&q.sourceCapabilities&&q.sourceCapabilities.firesTouchEvents)){if($)ht.call(this,k,q);else if(oe&&ut.call(this,q))return;this.callback(H,k,q)}},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});function ht(I,H){I&X?(this.primaryTouch=H.changedPointers[0].identifier,ze.call(this,H)):I&(Y|G)&&ze.call(this,H)}function ze(I){var H=I.changedPointers[0];if(H.identifier===this.primaryTouch){var k={x:H.clientX,y:H.clientY};this.lastTouches.push(k);var q=this.lastTouches,$=function(){var oe=q.indexOf(k);oe>-1&&q.splice(oe,1)};setTimeout($,Ct)}}function ut(I){for(var H=I.srcEvent.clientX,k=I.srcEvent.clientY,q=0;q<this.lastTouches.length;q++){var $=this.lastTouches[q],oe=Math.abs(H-$.x),be=Math.abs(k-$.y);if(oe<=Et&&be<=Et)return!0}return!1}var rt=s?L(s.style,"touchAction"):r,ue=rt!==r,Ae="compute",Ce="auto",Be="manipulation",nt="none",ct="pan-x",bt="pan-y",Bt=Tt();function at(I,H){this.manager=I,this.set(H)}at.prototype={set:function(I){I==Ae&&(I=this.compute()),ue&&this.manager.element.style&&Bt[I]&&(this.manager.element.style[rt]=I),this.actions=I.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var I=[];return h(this.manager.recognizers,function(H){b(H.options.enable,[H])&&(I=I.concat(H.getTouchAction()))}),pt(I.join(" "))},preventDefaults:function(I){var H=I.srcEvent,k=I.offsetDirection;if(this.manager.session.prevented){H.preventDefault();return}var q=this.actions,$=w(q,nt)&&!Bt[nt],oe=w(q,bt)&&!Bt[bt],be=w(q,ct)&&!Bt[ct];if($){var De=I.pointers.length===1,Xe=I.distance<2,Fe=I.deltaTime<250;if(De&&Xe&&Fe)return}if(!(be&&oe)&&($||oe&&k&ie||be&&k&fe))return this.preventSrc(H)},preventSrc:function(I){this.manager.session.prevented=!0,I.preventDefault()}};function pt(I){if(w(I,nt))return nt;var H=w(I,ct),k=w(I,bt);return H&&k?nt:H||k?H?ct:bt:w(I,Be)?Be:Ce}function Tt(){if(!ue)return!1;var I={},H=n.CSS&&n.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach(function(k){I[k]=H?n.CSS.supports("touch-action",k):!0}),I}var Mt=1,it=2,It=4,_t=8,vt=_t,xt=16,Ge=32;function mt(I){this.options=A({},this.defaults,I||{}),this.id=F(),this.manager=null,this.options.enable=T(this.options.enable,!0),this.state=Mt,this.simultaneous={},this.requireFail=[]}mt.prototype={defaults:{},set:function(I){return A(this.options,I),this.manager&&this.manager.touchAction.update(),this},recognizeWith:function(I){if(d(I,"recognizeWith",this))return this;var H=this.simultaneous;return I=Ht(I,this),H[I.id]||(H[I.id]=I,I.recognizeWith(this)),this},dropRecognizeWith:function(I){return d(I,"dropRecognizeWith",this)?this:(I=Ht(I,this),delete this.simultaneous[I.id],this)},requireFailure:function(I){if(d(I,"requireFailure",this))return this;var H=this.requireFail;return I=Ht(I,this),B(H,I)===-1&&(H.push(I),I.requireFailure(this)),this},dropRequireFailure:function(I){if(d(I,"dropRequireFailure",this))return this;I=Ht(I,this);var H=B(this.requireFail,I);return H>-1&&this.requireFail.splice(H,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(I){return!!this.simultaneous[I.id]},emit:function(I){var H=this,k=this.state;function q($){H.manager.emit($,I)}k<_t&&q(H.options.event+Ot(k)),q(H.options.event),I.additionalEvent&&q(I.additionalEvent),k>=_t&&q(H.options.event+Ot(k))},tryEmit:function(I){if(this.canEmit())return this.emit(I);this.state=Ge},canEmit:function(){for(var I=0;I<this.requireFail.length;){if(!(this.requireFail[I].state&(Ge|Mt)))return!1;I++}return!0},recognize:function(I){var H=A({},I);if(!b(this.options.enable,[this,H])){this.reset(),this.state=Ge;return}this.state&(vt|xt|Ge)&&(this.state=Mt),this.state=this.process(H),this.state&(it|It|_t|xt)&&this.tryEmit(H)},process:function(I){},getTouchAction:function(){},reset:function(){}};function Ot(I){return I&xt?"cancel":I&_t?"end":I&It?"move":I&it?"start":""}function Lt(I){return I==ce?"down":I==ae?"up":I==te?"left":I==ne?"right":""}function Ht(I,H){var k=H.manager;return k?k.get(I):I}function ot(){mt.apply(this,arguments)}v(ot,mt,{defaults:{pointers:1},attrTest:function(I){var H=this.options.pointers;return H===0||I.pointers.length===H},process:function(I){var H=this.state,k=I.eventType,q=H&(it|It),$=this.attrTest(I);return q&&(k&G||!$)?H|xt:q||$?k&Y?H|_t:H&it?H|It:it:Ge}});function St(){ot.apply(this,arguments),this.pX=null,this.pY=null}v(St,ot,{defaults:{event:"pan",threshold:10,pointers:1,direction:ge},getTouchAction:function(){var I=this.options.direction,H=[];return I&ie&&H.push(bt),I&fe&&H.push(ct),H},directionTest:function(I){var H=this.options,k=!0,q=I.distance,$=I.direction,oe=I.deltaX,be=I.deltaY;return $&H.direction||(H.direction&ie?($=oe===0?ee:oe<0?te:ne,k=oe!=this.pX,q=Math.abs(I.deltaX)):($=be===0?ee:be<0?ae:ce,k=be!=this.pY,q=Math.abs(I.deltaY))),I.direction=$,k&&q>H.threshold&&$&H.direction},attrTest:function(I){return ot.prototype.attrTest.call(this,I)&&(this.state&it||!(this.state&it)&&this.directionTest(I))},emit:function(I){this.pX=I.deltaX,this.pY=I.deltaY;var H=Lt(I.direction);H&&(I.additionalEvent=this.options.event+H),this._super.emit.call(this,I)}});function ft(){ot.apply(this,arguments)}v(ft,ot,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[nt]},attrTest:function(I){return this._super.attrTest.call(this,I)&&(Math.abs(I.scale-1)>this.options.threshold||this.state&it)},emit:function(I){if(I.scale!==1){var H=I.scale<1?"in":"out";I.additionalEvent=this.options.event+H}this._super.emit.call(this,I)}});function Rt(){mt.apply(this,arguments),this._timer=null,this._input=null}v(Rt,mt,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[Ce]},process:function(I){var H=this.options,k=I.pointers.length===H.pointers,q=I.distance<H.threshold,$=I.deltaTime>H.time;if(this._input=I,!q||!k||I.eventType&(Y|G)&&!$)this.reset();else if(I.eventType&X)this.reset(),this._timer=f(function(){this.state=vt,this.tryEmit()},H.time,this);else if(I.eventType&Y)return vt;return Ge},reset:function(){clearTimeout(this._timer)},emit:function(I){this.state===vt&&(I&&I.eventType&Y?this.manager.emit(this.options.event+"up",I):(this._input.timeStamp=p(),this.manager.emit(this.options.event,this._input)))}});function wt(){ot.apply(this,arguments)}v(wt,ot,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[nt]},attrTest:function(I){return this._super.attrTest.call(this,I)&&(Math.abs(I.rotation)>this.options.threshold||this.state&it)}});function pe(){ot.apply(this,arguments)}v(pe,ot,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:ie|fe,pointers:1},getTouchAction:function(){return St.prototype.getTouchAction.call(this)},attrTest:function(I){var H=this.options.direction,k;return H&(ie|fe)?k=I.overallVelocity:H&ie?k=I.overallVelocityX:H&fe&&(k=I.overallVelocityY),this._super.attrTest.call(this,I)&&H&I.offsetDirection&&I.distance>this.options.threshold&&I.maxPointers==this.options.pointers&&c(k)>this.options.velocity&&I.eventType&Y},emit:function(I){var H=Lt(I.offsetDirection);H&&this.manager.emit(this.options.event+H,I),this.manager.emit(this.options.event,I)}});function xe(){mt.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}v(xe,mt,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[Be]},process:function(I){var H=this.options,k=I.pointers.length===H.pointers,q=I.distance<H.threshold,$=I.deltaTime<H.time;if(this.reset(),I.eventType&X&&this.count===0)return this.failTimeout();if(q&&$&&k){if(I.eventType!=Y)return this.failTimeout();var oe=this.pTime?I.timeStamp-this.pTime<H.interval:!0,be=!this.pCenter||ve(this.pCenter,I.center)<H.posThreshold;this.pTime=I.timeStamp,this.pCenter=I.center,!be||!oe?this.count=1:this.count+=1,this._input=I;var De=this.count%H.taps;if(De===0)return this.hasRequireFailures()?(this._timer=f(function(){this.state=vt,this.tryEmit()},H.interval,this),it):vt}return Ge},failTimeout:function(){return this._timer=f(function(){this.state=Ge},this.options.interval,this),Ge},reset:function(){clearTimeout(this._timer)},emit:function(){this.state==vt&&(this._input.tapCount=this.count,this.manager.emit(this.options.event,this._input))}});function Se(I,H){return H=H||{},H.recognizers=T(H.recognizers,Se.defaults.preset),new st(I,H)}Se.VERSION="2.0.7",Se.defaults={domEvents:!1,touchAction:Ae,enable:!0,inputTarget:null,inputClass:null,preset:[[wt,{enable:!1}],[ft,{enable:!1},["rotate"]],[pe,{direction:ie}],[St,{direction:ie},["swipe"]],[xe],[xe,{event:"doubletap",taps:2},["tap"]],[Rt]],cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}};var Oe=1,Pt=2;function st(I,H){this.options=A({},Se.defaults,H||{}),this.options.inputTarget=this.options.inputTarget||I,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=I,this.input=de(this),this.touchAction=new at(this,this.options.touchAction),Ze(this,!0),h(this.options.recognizers,function(k){var q=this.add(new k[0](k[1]));k[2]&&q.recognizeWith(k[2]),k[3]&&q.requireFailure(k[3])},this)}st.prototype={set:function(I){return A(this.options,I),I.touchAction&&this.touchAction.update(),I.inputTarget&&(this.input.destroy(),this.input.target=I.inputTarget,this.input.init()),this},stop:function(I){this.session.stopped=I?Pt:Oe},recognize:function(I){var H=this.session;if(!H.stopped){this.touchAction.preventDefaults(I);var k,q=this.recognizers,$=H.curRecognizer;(!$||$&&$.state&vt)&&($=H.curRecognizer=null);for(var oe=0;oe<q.length;)k=q[oe],H.stopped!==Pt&&(!$||k==$||k.canRecognizeWith($))?k.recognize(I):k.reset(),!$&&k.state&(it|It|_t)&&($=H.curRecognizer=k),oe++}},get:function(I){if(I instanceof mt)return I;for(var H=this.recognizers,k=0;k<H.length;k++)if(H[k].options.event==I)return H[k];return null},add:function(I){if(d(I,"add",this))return this;var H=this.get(I.options.event);return H&&this.remove(H),this.recognizers.push(I),I.manager=this,this.touchAction.update(),I},remove:function(I){if(d(I,"remove",this))return this;if(I=this.get(I),I){var H=this.recognizers,k=B(H,I);k!==-1&&(H.splice(k,1),this.touchAction.update())}return this},on:function(I,H){if(I!==r&&H!==r){var k=this.handlers;return h(M(I),function(q){k[q]=k[q]||[],k[q].push(H)}),this}},off:function(I,H){if(I!==r){var k=this.handlers;return h(M(I),function(q){H?k[q]&&k[q].splice(B(k[q],H),1):delete k[q]}),this}},emit:function(I,H){this.options.domEvents&&Ft(I,H);var k=this.handlers[I]&&this.handlers[I].slice();if(!(!k||!k.length)){H.type=I,H.preventDefault=function(){H.srcEvent.preventDefault()};for(var q=0;q<k.length;)k[q](H),q++}},destroy:function(){this.element&&Ze(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}};function Ze(I,H){var k=I.element;if(k.style){var q;h(I.options.cssProps,function($,oe){q=L(k.style,oe),H?(I.oldCssProps[q]=k.style[q],k.style[q]=$):k.style[q]=I.oldCssProps[q]||""}),H||(I.oldCssProps={})}}function Ft(I,H){var k=t.createEvent("Event");k.initEvent(I,!0,!0),k.gesture=H,H.target.dispatchEvent(k)}return A(Se,{INPUT_START:X,INPUT_MOVE:Z,INPUT_END:Y,INPUT_CANCEL:G,STATE_POSSIBLE:Mt,STATE_BEGAN:it,STATE_CHANGED:It,STATE_ENDED:_t,STATE_RECOGNIZED:vt,STATE_CANCELLED:xt,STATE_FAILED:Ge,DIRECTION_NONE:ee,DIRECTION_LEFT:te,DIRECTION_RIGHT:ne,DIRECTION_UP:ae,DIRECTION_DOWN:ce,DIRECTION_HORIZONTAL:ie,DIRECTION_VERTICAL:fe,DIRECTION_ALL:ge,Manager:st,Input:le,TouchAction:at,TouchInput:Ue,MouseInput:ke,PointerEventInput:Pe,TouchMouseInput:dt,SingleTouchInput:gt,Recognizer:mt,AttrRecognizer:ot,Tap:xe,Pan:St,Swipe:pe,Pinch:ft,Rotate:wt,Press:Rt,on:_,off:S,each:h,merge:y,extend:g,assign:A,inherit:v,bindFn:E,prefixed:L}),Se})(typeof window!="undefined"?window:{},typeof document!="undefined"?document:{}),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,m=h.state,A=h.currentState,g=typeof m.panoIndex=="number"?{workCode:(s=(r=m.workCode)!==null&&r!==void 0?r:(o=d.works[0])===null||o===void 0?void 0:o.workCode)!==null&&s!==void 0?s:"",panoIndex:m.panoIndex}:{workCode:A.workCode,panoIndex:A.panoIndex};return __assign(__assign({},g),{mode:"",longitude:(u=m.longitude)!==null&&u!==void 0?u:A.longitude,latitude:(l=m.latitude)!==null&&l!==void 0?l:A.latitude,fov:(c=m.fov)!==null&&c!==void 0?c:A.fov,offset:(p=m.offset)!==null&&p!==void 0?p:A.offset,distance:(f=m.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.panState=void 0,(e=this.pressState)===null||e===void 0||e.stop(),this.pressState=void 0},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)})},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,m=notSimilarValue(c,this.camera.pose.longitude,Math.PI*2)||notSimilarValue(p,this.camera.pose.latitude),A=notSimilarValue(f,this.camera.pose.fov),g=notSimilarValue(d,this.camera.pose.distance),y=notSimilarVector3(h,this.camera.pose.offset);(A||m||y||g)&&(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){var r=this.element.getBoundingClientRect(),o=r.top,s=r.left,u=r.width,l=r.height;return s=s+u*this.viewport.left,o=o+l*(1-this.viewport.bottom-this.viewport.height),u=u*this.viewport.width,l=l*this.viewport.height,new THREE__namespace.Vector2((e.x-s)/u*2-1,-(e.y-o)/l*2+1)},t.prototype.createRaycasterFromCamera=function(e,r){var o=new THREE__namespace.Raycaster;return o.params.Points={threshold:.1},o.firstHitOnly=!0,o.near=r.near,o.far=r.far,o.setFromCamera(e,this.camera),o},t.prototype.bindEvents=function(e){var r=this,o=function(C){var P=r.relativeClientPosition(C);return!(Math.abs(P.x)>1||Math.abs(P.y)>1)},s=new Hammer.Manager(e),u=function(C){var P=C.session;return P.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 P=u(s);if(!(P&&!o(P.center))){var L=createEvent("gesture.pan",{target:C.target,pointerType:C.pointerType,srcEvent:C.srcEvent,pointers:C.pointers.map(function(O){var F=r.relativeClientPosition(O),N=r.createRaycasterFromCamera(F,r.camera);return{x:O.x,y:O.y,delta:0,buttons:0,coords:F,raycaster:N}}),isFirst:C.isFirst,isFinal:C.isFinal,scale:C.scale,center:(function(O){var F=r.relativeClientPosition(O),N=r.createRaycasterFromCamera(F,r.camera);return{x:O.x,y:O.y,delta:0,buttons:0,coords:F,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(L),b()}}),s.on("tap",function(C){if(!(C.pointerType==="mouse"&&C.srcEvent.button!==0)){var P=u(s);if(!(P&&!o(P.center))){var L=createEvent("gesture.tap",{target:C.target,pointerType:C.pointerType,srcEvent:C.srcEvent,pointers:C.pointers.map(function(O){var F=r.relativeClientPosition(O),N=r.createRaycasterFromCamera(F,r.camera);return{x:O.x,y:O.y,delta:0,buttons:0,coords:F,raycaster:N}}),isFirst:!0,isFinal:!0,scale:C.scale,center:(function(O){var F=r.relativeClientPosition(O),N=r.createRaycasterFromCamera(F,r.camera);return{x:O.x,y:O.y,delta:0,buttons:0,coords:F,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(L),b()}}}),s.on("pinchstart pinch pinchend",function(C){var P=u(s);if(!(P&&!o(P.center))){var L=createEvent("gesture.pinch",{target:C.target,pointerType:C.pointerType,srcEvent:C.srcEvent,pointers:C.pointers.map(function(O){var F,N=r.relativeClientPosition(O),D=new THREE__namespace.Raycaster;return D.params.Points={threshold:.1},D.setFromCamera(N,r.camera),{x:O.x,y:O.y,delta:(F=O.delta)!==null&&F!==void 0?F:0,buttons:0,coords:N,raycaster:D}}),isFirst:C.type==="pinchstart",isFinal:C.type==="pinchend",scale:C.scale,center:(function(O){var F=r.relativeClientPosition(O),N=r.createRaycasterFromCamera(F,r.camera);return{x:O.x,y:O.y,delta:0,buttons:0,coords:F,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(L),b()}}),s.on("dbltap",function(C){if(!(C.pointerType==="mouse"&&C.srcEvent.button!==0)){var P=u(s);if(!(P&&!o(P.center))){var L=createEvent("gesture.dbltap",{target:C.target,pointerType:C.pointerType,srcEvent:C.srcEvent,pointers:C.pointers.map(function(O){var F=r.relativeClientPosition(O),N=r.createRaycasterFromCamera(F,r.camera);return{x:O.x,y:O.y,delta:0,buttons:0,coords:F,raycaster:N}}),isFirst:!0,isFinal:!0,scale:C.scale,center:(function(O){var F=r.relativeClientPosition(O),N=r.createRaycasterFromCamera(F,r.camera);return{x:O.x,y:O.y,delta:0,buttons:0,coords:F,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(L),b()}}});var f=null,d=null,h=function(C,P,L){var O={x:L.clientX,y:L.clientY},F=r.relativeClientPosition(O),N=r.createRaycasterFromCamera(F,r.camera),D=__assign(__assign({},O),{coords:F,raycaster:N,buttons:L.buttons,delta:0}),U=C==="pinchend"?P:P-L.deltaY/280,z=createEvent("gesture.pinch",{target:L.target,pointerType:"mouse",srcEvent:L,pointers:[__assign({},D)],isFirst:C==="pinchstart",isFinal:C==="pinchend",scale:clamp$1(U,.1,10),center:__assign({},D),velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0,userAction:!0,state:__assign(__assign({mode:r.mode},r.currentPano),clonePose(r.camera.pose))});return z},m=function(C){var P,L={x:C.clientX,y:C.clientY};if(o(L)){if(C.preventDefault(),C.ctrlKey){var O=(P=f==null?void 0:f.prevEvent.scale)!==null&&P!==void 0?P:1,F=h(f?"pinch":"pinchstart",O,C);f===null?f={firstEvent:F,prevEvent:F}:f.prevEvent=F,r.onPinchGesture(F),d!==null&&window.clearTimeout(d),d=window.setTimeout(function(){var Q;d=null;var V=(Q=f==null?void 0:f.prevEvent.scale)!==null&&Q!==void 0?Q:1,J=h("pinchend",V,C);f=null,r.onPinchGesture(J)},200)}else{var N=(Math.abs(C.deltaY)>Math.abs(C.deltaX)?C.deltaY:C.deltaX)/-60,D=r.mouseWheelState!==void 0,U={x:C.clientX,y:C.clientY},z=r.relativeClientPosition(U),K=r.createRaycasterFromCamera(z,r.camera),j=__assign(__assign({},U),{coords:z,raycaster:K,buttons:C.buttons,delta:N}),F=createEvent("gesture.mousewheel",{target:C.target,pointerType:"mouse",srcEvent:C,pointers:[__assign({},j)],isFirst:D,isFinal:!1,scale:0,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))});r.onMouseWheel(F),r.mouseWheelState&&clearTimeout(r.mouseWheelState.timer),r.mouseWheelState={timer:setTimeout(function(){r.mouseWheelState=void 0;var V=createEvent("gesture.mousewheel",{target:C.target,pointerType:"mouse",srcEvent:C,pointers:[__assign(__assign({},j),{delta:0})],isFirst:!1,isFinal:!0,scale:0,center:__assign(__assign({},j),{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(V)},100)}}b()}},A=function(C){if(!isMobile){if(!o({x:C.clientX,y:C.clientY})){g();return}var P=!1;r.mouseMoveState||(P=!0);var L={x:C.clientX,y:C.clientY},O=r.relativeClientPosition(L),F=r.createRaycasterFromCamera(O,r.camera),N=__assign(__assign({},L),{coords:O,raycaster:F,buttons:C.buttons,delta:0}),D=createEvent("gesture.mousemove",{target:C.target,pointerType:"mouse",srcEvent:C,pointers:[__assign({},N)],isFirst:P,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:D},r.onMouseMove(D),r.pressState&&Math.abs(C.clientX-r.pressState.event.center.y)>10&&Math.abs(C.clientY-r.pressState.event.center.y)>10&&b()}},g=function(){if(r.mouseMoveState){var C=createEvent(r.mouseMoveState.event.type,__assign(__assign({},r.mouseMoveState.event),{isFinal:!0}));r.mouseMoveState=void 0,r.onMouseMove(C)}b()},y=function(C){if(!o(C.center)){b();return}var P=!1;r.pressState||(P=!0,r.pressState={event:C,timeStamp:now(),stop:noop});var L=now()-r.pressState.timeStamp,O=createEvent(r.pressState.event.type,__assign(__assign({},r.pressState.event),{isFirst:P,isFinal:!1,center:__assign(__assign({},r.pressState.event.center),{delta:L}),pointers:r.pressState.event.pointers.map(function(F){return __assign(__assign({},F),{delta:L})})}));r.onPressGesture(O),r.pressState&&(r.pressState.stop=AnimationFrameLoop.shared.add(function(F){y(C)},!0,1))},v=function(C){if(b(),!(C.touches.length>1||C.changedTouches.length<=0)){var P={x:C.changedTouches[0].clientX,y:C.changedTouches[0].clientY},L=r.relativeClientPosition(P),O=r.createRaycasterFromCamera(L,r.camera),F=__assign(__assign({},P),{coords:L,raycaster:O,buttons:0,delta:0}),N=createEvent("gesture.press",{target:C.target,pointerType:"touch",srcEvent:C,pointers:[__assign({},F)],isFirst:!1,isFinal:!1,scale:0,center:F,velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0,userAction:!0,state:__assign(__assign({mode:r.mode},r.currentPano),clonePose(r.camera.pose))});y(N)}},E=function(C){b();var P={x:C.clientX,y:C.clientY},L=r.relativeClientPosition(P),O=r.createRaycasterFromCamera(L,r.camera),F=__assign(__assign({},P),{coords:L,raycaster:O,buttons:C.buttons,delta:0}),N=createEvent("gesture.press",{target:C.target,pointerType:"mouse",srcEvent:C,pointers:[__assign({},F)],isFirst:!1,isFinal:!1,scale:0,center:F,velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0,userAction:!0,state:__assign(__assign({mode:r.mode},r.currentPano),clonePose(r.camera.pose))});y(N)},b=function(){var C;if(r.pressState){var P=now()-r.pressState.timeStamp,L=createEvent(r.pressState.event.type,__assign(__assign({},r.pressState.event),{center:__assign(__assign({},r.pressState.event.center),{delta:P}),isFirst:!1,isFinal:!0,pointers:r.pressState.event.pointers.map(function(O){return __assign(__assign({},O),{delta:P})})}));r.onPressGesture(L),(C=r.pressState)===null||C===void 0||C.stop(),r.pressState=void 0}},T=null,_=function(C){var P,L=!1,O=!1;switch(C.type){case"gesturestart":L=!0;break;case"gestureend":O=!0;break}var F={x:C.clientX,y:C.clientY},N=r.relativeClientPosition(F),D=r.createRaycasterFromCamera(N,r.camera),U=__assign(__assign({},F),{coords:N,raycaster:D,buttons:0,delta:0}),z=createEvent("gesture.pinch",{target:C.target,pointerType:"mouse",srcEvent:C,pointers:[__assign({},U)],isFirst:L,isFinal:O,scale:(P=C.scale)!==null&&P!==void 0?P:1,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))});return z},S=function(C){if(C.preventDefault(),!isMobile){var P=_(C);T={firstEvent:P};var L=T.firstEvent;L&&!o(L.center)||r.onPinchGesture(P)}},R=function(C){if(C.preventDefault(),!isMobile&&T){var P=_(C),L=T.firstEvent;L&&!o(L.center)||r.onPinchGesture(P)}},w=function(C){if(C.preventDefault(),!isMobile&&T){var P=_(C),L=T.firstEvent;T=null,!(L&&!o(L.center))&&r.onPinchGesture(P)}},M=function(C){if(C&&typeof C.preventDefault=="function"&&C.currentTarget===e&&C.preventDefault(),typeof getSelection=="function"){var P=getSelection();P&&P.focusNode&&(P.removeAllRanges&&P.removeAllRanges(),P.empty&&P.empty())}};this.enableWheel&&e.addEventListener("wheel",m,{passive:!1}),e.addEventListener("mousemove",A,!1),e.addEventListener("mouseout",g,!1),e.addEventListener("touchstart",v,{passive:!0}),e.addEventListener("touchend",b,!1),e.addEventListener("touchcancel",b,!1),e.addEventListener("mousedown",E,!1),e.addEventListener("mouseup",b,!1),e.addEventListener("gesturestart",S,{passive:!1}),e.addEventListener("gesturechange",R,{passive:!1}),e.addEventListener("gestureend",w,{passive:!1}),e.addEventListener("touchstart",M,{passive:!1}),e.addEventListener("contextmenu",M,!1);var B=function(){s.destroy(),e.removeEventListener("wheel",m,!1),e.removeEventListener("mousemove",A,!1),e.removeEventListener("mouseout",g,!1),e.removeEventListener("touchstart",v,!1),e.removeEventListener("touchend",b,!1),e.removeEventListener("touchcancel",b,!1),e.removeEventListener("mousedown",E,!1),e.removeEventListener("mouseup",b,!1),e.removeEventListener("gesturestart",S,!1),e.removeEventListener("gesturechange",R,!1),e.removeEventListener("gestureend",w,!1),e.removeEventListener("touchstart",M,!1),e.removeEventListener("contextmenu",M,!1)};return Object.assign(B,{element:e})},t})(Subscribe),sharedGeometry$2=new THREE__namespace.CircleBufferGeometry(.1,16),vertexShader$3=`
1394
1394
  varying vec2 vUv;
1395
1395
  #include <common>
1396
1396
  #include <logdepthbuf_pars_vertex>
@@ -1440,7 +1440,7 @@ void main() {
1440
1440
  gl_FragColor = texture2D(map, vUV);
1441
1441
  gl_FragColor.a = gl_FragColor.a * opacity;
1442
1442
  }
1443
- `,TileMaterial=(function(n){__extends(t,n);function t(){var e=n.call(this,{defines:{USE_FLIP_Y:!0},uniforms:{map:{value:null},opacity:{value:1},level:{value:-1}},vertexShader:TILE_MATERIAL_VERTEX_SHADER,fragmentShader:TILE_MATERIAL_FRAGMENT_SHADER,depthTest:!0,depthWrite:!0})||this;return defineProperty(e,"flipY",{get:function(){return this.defines.USE_FLIP_Y},set:function(r){this.defines.USE_FLIP_Y!==r&&(this.defines.USE_FLIP_Y=r,this.needsUpdate=!0)}}),defineProperty(e,"map",{get:function(){return this.uniforms.map.value},set:function(r){this.uniforms.map.value=r}}),defineProperty(e,"opacity",{get:function(){return this.uniforms.opacity.value},set:function(r){this.uniforms.opacity.value=r}}),defineProperty(e,"level",{get:function(){return this.uniforms.level.value},set:function(r){this.uniforms.level.value=r}}),e}return t})(THREE__namespace.ShaderMaterial),TileMesh=(function(n){__extends(t,n);function t(e,r){var o=n.call(this,tileGeometry,new TileMaterial)||this;return o.disposed=!1,e.box.getCenter(o.position),o.quaternion.multiplyQuaternions(new THREE__namespace.Quaternion().setFromAxisAngle(new THREE__namespace.Vector3(0,1,0),-Math.PI),TILE_QUATERNION[e.face]),o.scale.setScalar(e.size),o.node=e,o.name="tiling:tile",o.material.level=e.level,o.material.visible=!1,o.material.polygonOffset=!0,o.material.polygonOffsetFactor=-e.level,o.material.polygonOffsetUnits=-e.level,o.activeTime=-1,o.frustumCulled=!1,o.renderOrder=e.level,o.appearDuration=0,o.appearMotion=new Motion({appear:0}),r.then(function(s){o.disposed?s.dispose():(o.material.map=s,o.material.flipY=!!s.flipY,o.material.visible=!0,o.appearMotion.set({appear:1},o.appearDuration*1e3).catch(noop))}).catch(noop),o}return t.prototype.updateTime=function(e){var r=!1;if(this.disposed)return r;this.appearMotion.ended===!1&&this.appearMotion.update(e),this.activeTime=e;var o=easeInCubic(this.appearMotion.value.appear);this.material.opacity!==o&&(this.material.opacity=o,r=!0);var s=!0;return this.material.transparent=s,r},t.prototype.dispose=function(){this.disposed=!0,this.material.map&&this.material.map.dispose(),this.material.dispose()},t})(THREE__namespace.Mesh),boundingGeometry=createBoxGeometry(20,20,20);boundingGeometry.applyMatrix4(new THREE__namespace.Matrix4().makeScale(-1,1,1));var BOUNDING_MATERIAL_VERTEX_SHADER=`
1443
+ `,TileMaterial=(function(n){__extends(t,n);function t(){var e=n.call(this,{defines:{USE_FLIP_Y:!0},uniforms:{map:{value:null},opacity:{value:1},level:{value:-1}},vertexShader:TILE_MATERIAL_VERTEX_SHADER,fragmentShader:TILE_MATERIAL_FRAGMENT_SHADER,depthTest:!0,depthWrite:!0})||this;return defineProperty(e,"flipY",{get:function(){return this.defines.USE_FLIP_Y},set:function(r){this.defines.USE_FLIP_Y!==r&&(this.defines.USE_FLIP_Y=r,this.needsUpdate=!0)}}),defineProperty(e,"map",{get:function(){return this.uniforms.map.value},set:function(r){this.uniforms.map.value=r}}),defineProperty(e,"opacity",{get:function(){return this.uniforms.opacity.value},set:function(r){this.uniforms.opacity.value=r}}),defineProperty(e,"level",{get:function(){return this.uniforms.level.value},set:function(r){this.uniforms.level.value=r}}),e}return t})(THREE__namespace.ShaderMaterial),TileMesh=(function(n){__extends(t,n);function t(e,r){var o=n.call(this,tileGeometry,new TileMaterial)||this;return o.disposed=!1,e.box.getCenter(o.position),o.quaternion.multiplyQuaternions(new THREE__namespace.Quaternion().setFromAxisAngle(new THREE__namespace.Vector3(0,1,0),-Math.PI),TILE_QUATERNION[e.face]),o.scale.setScalar(e.size),o.node=e,o.name="tiling:tile",o.material.level=e.level,o.material.visible=!1,o.material.polygonOffset=!0,o.material.polygonOffsetFactor=-e.level,o.material.polygonOffsetUnits=-e.level,o.activeTime=-1,o.frustumCulled=!1,o.renderOrder=e.level,o.appearDuration=0,o.appearMotion=new Motion({appear:0}),r.then(function(s){o.disposed?s.dispose():(o.material.map=s,o.material.flipY=!!s.flipY,o.material.visible=!0,o.appearMotion.set({appear:1},o.appearDuration*1e3).catch(noop))}).catch(noop),o}return t.prototype.updateTime=function(e){var r=!1;if(this.disposed)return r;this.appearMotion.ended===!1&&this.appearMotion.update(e),this.activeTime=e;var o=easeInCubic(this.appearMotion.value.appear);this.material.opacity!==o&&(this.material.opacity=o,r=!0);var s=!0;return this.material.transparent=s,r},t.prototype.dispose=function(){this.disposed=!0,this.material.map&&this.material.map.dispose(),this.material.dispose()},t})(THREE__namespace.Mesh),boundingGeometry=createSimpleBoxBufferGeometry(20,20,20);boundingGeometry.applyMatrix4(new THREE__namespace.Matrix4().makeScale(-1,1,1));var BOUNDING_MATERIAL_VERTEX_SHADER=`
1444
1444
  varying vec4 vFinalPosition;
1445
1445
 
1446
1446
  void main() {
@@ -1455,7 +1455,7 @@ void main() {
1455
1455
  vec3 panoToVertex = normalize(vFinalPosition.xyz);
1456
1456
  gl_FragColor = textureCube(map, vec3(FLIP_CUBE_MAP * panoToVertex.x, panoToVertex.yz));
1457
1457
  }
1458
- `,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,boundingGeometry,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.LinearFilter,minFilter:THREE__namespace.LinearFilter,wrapS:THREE__namespace.ClampToEdgeWrapping,wrapT:THREE__namespace.ClampToEdgeWrapping})}return n.prototype.dispose=function(){this.setObserver(null),this.renderTarget.dispose(),this.boundingMesh.dispose(),this.scene.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){var e=this,r=this.forceRenderWhenNextUpdate;if(this.disposed)return r;var o=t.time,s=t.resolution,u=t.pixelRatio,l=t.renderer,c=t.cameraMatrix,p=t.cameraProjectionMatrix,f=t.panoMap,d=t.panoMatrix,h=t.panoZoom,m=t.minLevel,A=t.level;if(this.boundingMesh.update(o,f),this.observer===null)return(this.renderTarget.width!==1||this.renderTarget.height!==1)&&(this.renderTarget.setSize(1,1),r=!0),!1;this.level=clamp$1(A,0,this.tileTree.maxLevel);var g=Math.floor(s.width*u),y=Math.floor(s.height*u),v=Math.max(g,y),E=l.capabilities.maxTextureSize;v>E&&(g=Math.floor(g/v*E),y=Math.floor(y/v*E)),(this.renderTarget.width!==g||this.renderTarget.height!==y)&&this.renderTarget.setSize(g,y),this.scene.matrix.equals(d)||(this.scene.matrix.copy(d),this.scene.matrixWorld.copy(this.scene.matrix),this.scene.matrix.decompose(this.scene.position,this.scene.quaternion,this.scene.scale),this.scene.matrixAutoUpdate=!1,r=!0);var b=scratchCameraQuaternion.setFromRotationMatrix(c),T=scratchCameraMatrix.compose(this.scene.position,b,this.scene.scale);this.camera.matrix.equals(T)||(this.camera.matrix.copy(T),this.camera.matrixWorld.copy(this.camera.matrix),this.camera.position.copy(this.scene.position),this.camera.quaternion.copy(b),this.camera.scale.copy(this.scene.scale),r=!0);var _=scratchCameraProjectMatrix.copy(p);_.elements[0]*=h,_.elements[5]*=h,this.camera.projectionMatrix.equals(_)||(this.camera.projectionMatrix.copy(_),this.camera.projectionMatrixInverse.getInverse(this.camera.projectionMatrix),r=!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 S=this.frustum.planes[5].normal,R=[];A>=m&&traverseTileCubeNode(this.tileTree,function(K){if(!(K.level<m)){if(K.level>A||!e.frustum.intersectsBox(K.box))return!1;R.push(K)}});var w=new WeakMap;R.sort(function(K,ee){if(K.level!==ee.level)return K.level-ee.level;var te=w.get(K);te===void 0&&(te=K.box.getCenter(scratchSortVector3).angleTo(S),w.set(K,te));var re=w.get(ee);return re===void 0&&(re=ee.box.getCenter(scratchSortVector3).angleTo(S),w.set(ee,re)),te-re});var M=new WeakSet,B=this.observer.images.tiles;if(B)for(var C=function(K){var ee=B.find(function(ne){return ne.level===K.level});if(!ee)return"continue";M.add(K);var te=P.tileMeshes.get(K);if(te){te.appearDuration=P.appearDuration;var re=te.updateTime(o);return re&&(r=!0),"continue"}if(P.pedding>=P.maxRequest)return"continue";var ae=Math.pow(2,K.level)*K.position.y,ce=Math.pow(2,K.level)*K.position.x,ie=panoStringify({panoIndex:P.observer.panoIndex,workCode:P.observer.work.workCode}),fe="".concat(ie,".").concat(K.face,".").concat(K.level,".").concat(ae,".").concat(ce),ge=ee.work.getURL(ee[K.face]),ye=ee.size,_e=P.imageOptions.transform,le=__assign(__assign({},pick(P.imageOptions,["format","sharpen","forceUseExifOrientation","mappings"])),{key:"pano_tile.".concat(fe),size:ee.scale>=1?void 0:ye*K.size*ee.scale,cut:K.size===1?void 0:[ye*K.position.x,ye*K.position.y,ye*K.size,ye*K.size]});K.level===1&&ee.scale>=.5&&(le.format==="jpg"||/\.jpg$/.test(ge))&&(le.size=void 0,le.quality||(le.quality=70)),K.size===1&&console.warn("tile: ".concat(le.key," should not appear.")),P.pedding++;var de=P.textureLoader.loadTexture(ge,{imageURL:{transform:_e,options:le},minFilter:THREE__namespace.LinearFilter,magFilter:THREE__namespace.LinearFilter,generateMipmaps:!1,fetcher:getFetcher(P.observer.work)}).then(function(ne){return ne.body});de.then(function(ne){return initTexture(ne,l)}).then(function(ne){return e.pedding--,ne},function(ne){return e.pedding--,Promise.reject(ne)}),te=new TileMesh(K,de),te.name="tiling:tile-".concat(fe),te.visible=!1,te.appearDuration=P.appearDuration,P.tileMeshes.set(K,te),P.scene.add(te),te.updateTime(o),r=!0},P=this,L=0,O=R;L<O.length;L++){var F=O[L];C(F)}var N=[],D=[];this.tileMeshes.forEach(function(K,ee){M.has(ee)?N.push(K):D.push(K);var te=ee.level>=m&&ee.level<=A;K.visible!==te&&(K.visible=te,r=!0)});for(var U=D.sort(function(K,ee){return ee.activeTime-K.activeTime}).slice(Math.max(0,this.maxCacheTile-N.length)),z=0,G=U;z<G.length;z++){var j=G[z];this.tileMeshes.delete(j.node),this.scene.remove(j),j.dispose(),r=!0}if(r){var Q=l.getRenderTarget();scratchPrevClearColor$1.copy(l.getClearColor());var V=l.getClearAlpha(),J=l.autoClear,W=l.autoClearColor,X=l.autoClearDepth,Z=l.autoClearStencil,Y=l.clippingPlanes;l.autoClear=!0,l.autoClearColor=!0,l.autoClearDepth=!0,l.autoClearStencil=!0,l.clippingPlanes=clippingPlanes,l.setRenderTarget(this.renderTarget),l.setClearColor(clearColor$1,clearAlpha),l.render(this.scene,this.camera),l.setRenderTarget(Q),l.setClearColor(scratchPrevClearColor$1,V),l.autoClear=J,l.autoClearColor=W,l.autoClearDepth=X,l.autoClearStencil=Z,l.clippingPlanes=Y}return this.forceRenderWhenNextUpdate=!1,r},n})(),ROTATE_Y_PI_MATRIX=new THREE__namespace.Matrix4().makeRotationAxis(new THREE__namespace.Vector3(0,1,0),Math.PI),sharedGeometry$1=createBoxGeometry(2,2,2);sharedGeometry$1.applyMatrix4(new THREE__namespace.Matrix4().makeScale(-1,1,1));var PANO_VIDEO_MATERIAL_VERTEX_SHADER=`
1458
+ `,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,boundingGeometry,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.LinearFilter,minFilter:THREE__namespace.LinearFilter,wrapS:THREE__namespace.ClampToEdgeWrapping,wrapT:THREE__namespace.ClampToEdgeWrapping})}return n.prototype.dispose=function(){this.setObserver(null),this.renderTarget.dispose(),this.boundingMesh.dispose(),this.scene.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){var e=this,r=this.forceRenderWhenNextUpdate;if(this.disposed)return r;var o=t.time,s=t.resolution,u=t.pixelRatio,l=t.renderer,c=t.cameraMatrix,p=t.cameraProjectionMatrix,f=t.panoMap,d=t.panoMatrix,h=t.panoZoom,m=t.minLevel,A=t.level;if(this.boundingMesh.update(o,f),this.observer===null)return(this.renderTarget.width!==1||this.renderTarget.height!==1)&&(this.renderTarget.setSize(1,1),r=!0),!1;this.level=clamp$1(A,0,this.tileTree.maxLevel);var g=Math.floor(s.width*u),y=Math.floor(s.height*u),v=Math.max(g,y),E=l.capabilities.maxTextureSize;v>E&&(g=Math.floor(g/v*E),y=Math.floor(y/v*E)),(this.renderTarget.width!==g||this.renderTarget.height!==y)&&this.renderTarget.setSize(g,y),this.scene.matrix.equals(d)||(this.scene.matrix.copy(d),this.scene.matrixWorld.copy(this.scene.matrix),this.scene.matrix.decompose(this.scene.position,this.scene.quaternion,this.scene.scale),this.scene.matrixAutoUpdate=!1,r=!0);var b=scratchCameraQuaternion.setFromRotationMatrix(c),T=scratchCameraMatrix.compose(this.scene.position,b,this.scene.scale);this.camera.matrix.equals(T)||(this.camera.matrix.copy(T),this.camera.matrixWorld.copy(this.camera.matrix),this.camera.position.copy(this.scene.position),this.camera.quaternion.copy(b),this.camera.scale.copy(this.scene.scale),r=!0);var _=scratchCameraProjectMatrix.copy(p);_.elements[0]*=h,_.elements[5]*=h,this.camera.projectionMatrix.equals(_)||(this.camera.projectionMatrix.copy(_),this.camera.projectionMatrixInverse.getInverse(this.camera.projectionMatrix),r=!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 S=this.frustum.planes[5].normal,R=[];A>=m&&traverseTileCubeNode(this.tileTree,function(G){if(!(G.level<m)){if(G.level>A||!e.frustum.intersectsBox(G.box))return!1;R.push(G)}});var w=new WeakMap;R.sort(function(G,ee){if(G.level!==ee.level)return G.level-ee.level;var te=w.get(G);te===void 0&&(te=G.box.getCenter(scratchSortVector3).angleTo(S),w.set(G,te));var ne=w.get(ee);return ne===void 0&&(ne=ee.box.getCenter(scratchSortVector3).angleTo(S),w.set(ee,ne)),te-ne});var M=new WeakSet,B=this.observer.images.tiles;if(B)for(var C=function(G){var ee=B.find(function(re){return re.level===G.level});if(!ee)return"continue";M.add(G);var te=P.tileMeshes.get(G);if(te){te.appearDuration=P.appearDuration;var ne=te.updateTime(o);return ne&&(r=!0),"continue"}if(P.pedding>=P.maxRequest)return"continue";var ae=Math.pow(2,G.level)*G.position.y,ce=Math.pow(2,G.level)*G.position.x,ie=panoStringify({panoIndex:P.observer.panoIndex,workCode:P.observer.work.workCode}),fe="".concat(ie,".").concat(G.face,".").concat(G.level,".").concat(ae,".").concat(ce),ge=ee.work.getURL(ee[G.face]),ye=ee.size,_e=P.imageOptions.transform,le=__assign(__assign({},pick(P.imageOptions,["format","sharpen","forceUseExifOrientation","mappings"])),{key:"pano_tile.".concat(fe),size:ee.scale>=1?void 0:ye*G.size*ee.scale,cut:G.size===1?void 0:[ye*G.position.x,ye*G.position.y,ye*G.size,ye*G.size]});G.level===1&&ee.scale>=.5&&(le.format==="jpg"||/\.jpg$/.test(ge))&&(le.size=void 0,le.quality||(le.quality=70)),G.size===1&&console.warn("tile: ".concat(le.key," should not appear.")),P.pedding++;var de=P.textureLoader.loadTexture(ge,{imageURL:{transform:_e,options:le},minFilter:THREE__namespace.LinearFilter,magFilter:THREE__namespace.LinearFilter,generateMipmaps:!1,fetcher:getFetcher(P.observer.work)}).then(function(re){return re.body});de.then(function(re){return initTexture(re,l)}).then(function(re){return e.pedding--,re},function(re){return e.pedding--,Promise.reject(re)}),te=new TileMesh(G,de),te.name="tiling:tile-".concat(fe),te.visible=!1,te.appearDuration=P.appearDuration,P.tileMeshes.set(G,te),P.scene.add(te),te.updateTime(o),r=!0},P=this,L=0,O=R;L<O.length;L++){var F=O[L];C(F)}var N=[],D=[];this.tileMeshes.forEach(function(G,ee){M.has(ee)?N.push(G):D.push(G);var te=ee.level>=m&&ee.level<=A;G.visible!==te&&(G.visible=te,r=!0)});for(var U=D.sort(function(G,ee){return ee.activeTime-G.activeTime}).slice(Math.max(0,this.maxCacheTile-N.length)),z=0,K=U;z<K.length;z++){var j=K[z];this.tileMeshes.delete(j.node),this.scene.remove(j),j.dispose(),r=!0}if(r){var Q=l.getRenderTarget();scratchPrevClearColor$1.copy(l.getClearColor());var V=l.getClearAlpha(),J=l.autoClear,W=l.autoClearColor,X=l.autoClearDepth,Z=l.autoClearStencil,Y=l.clippingPlanes;l.autoClear=!0,l.autoClearColor=!0,l.autoClearDepth=!0,l.autoClearStencil=!0,l.clippingPlanes=clippingPlanes,l.setRenderTarget(this.renderTarget),l.setClearColor(clearColor$1,clearAlpha),l.render(this.scene,this.camera),l.setRenderTarget(Q),l.setClearColor(scratchPrevClearColor$1,V),l.autoClear=J,l.autoClearColor=W,l.autoClearDepth=X,l.autoClearStencil=Z,l.clippingPlanes=Y}return this.forceRenderWhenNextUpdate=!1,r},n})(),ROTATE_Y_PI_MATRIX=new THREE__namespace.Matrix4().makeRotationAxis(new THREE__namespace.Vector3(0,1,0),Math.PI),sharedGeometry$1=createSimpleBoxBufferGeometry(2,2,2);sharedGeometry$1.applyMatrix4(new THREE__namespace.Matrix4().makeScale(-1,1,1));var PANO_VIDEO_MATERIAL_VERTEX_SHADER=`
1459
1459
 
1460
1460
  #if defined(USE_PANO_VIDEO)
1461
1461
  varying vec3 worldPosition;
@@ -1570,7 +1570,7 @@ void main() {
1570
1570
  float cameraDepth = length(cameraVertex);
1571
1571
  gl_FragColor = packDepthToRGBA(clamp(cameraDepth / maxDepth, 0.0, 1.0));
1572
1572
  }
1573
- `,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$3=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,r.adjustPanoCircleMeshPositionFix=new Map;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=new Map,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=this,o=n.prototype.updateConfiguration.call(this,e);return o===!1?!1:(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&&(this.panoMeshes.forEach(function(s){r.helper.remove(s),s.dispose()}),this.panoMeshes.clear())),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,this.adjustPanoCircleMeshPositionBasedOnModel||this.adjustPanoCircleMeshPositionFix.clear()),!0)},t.prototype.destroy=function(){var e=this;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(),this.pendingTextureTask=void 0,this.panoMeshes&&(this.panoMeshes.forEach(function(h){e.helper.remove(h),h.dispose()}),this.panoMeshes.clear());var r=this.videoTexture.image;r.pause(),r.oncanplay=noop,r.ontimeupdate=noop,this.scene.remove(this.panoVideo.object),this.panoVideo.setMaterial(null),this.panoVideo.dispose();for(var o=this.modelScene.parameter.resolveValue(),s=o.pano0,u=o.pano1,l=0,c=Object.keys(this.panoResources);l<c.length;l++){var p=c[l],f=this.panoResources[p];if(f.panoPicture){var d=f.panoPicture.map;d&&d!==(s==null?void 0:s.map)&&d!==(u==null?void 0:u.map)&&(d.dispose(),f.panoPicture=null)}delete this.panoResources[p]}},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.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.hideIntersectMesh()},t.prototype.updateTime=function(e,r){var o=this,s,u,l,c,p,f;if(!this.destroyed){var d={},h={},m=this.locationMotion.keyframes[0],A=this.locationMotion.keyframes[this.locationMotion.keyframes.length-1],g=this.locationMotion.getKeyFrameSegment(e),y=g[0],v=g[1],E=this.panoResourceFromLocationMotionKeyframe(y),b=this.panoResourceFromLocationMotionKeyframe(v),T=this.panoResourceFromLocationMotionKeyframe(m),_=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(E.position),w=new THREE__namespace.Vector3().copy(b.position),M=this.locationMotion.value.count-v.value.count+1;if(d.progress=M,b.panoPicture&&(M<1?E.panoPicture&&(d.pano0=E.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(M,3)),M<1&&b.effect!=="fly"){if(d.pano0&&E.panoPicture){var B={panoId:d.pano0.panoId,map:d.pano0.map,mapSize:d.pano0.mapSize,zoom:d.pano0.zoom,matrix:E.panoPicture.matrix.clone().premultiply(E.fixCameraTransform).setPosition(b.position)},C=this.panoPictureObserverMap.get(d.pano0);C&&this.panoPictureObserverMap.set(B,C),d.pano0=B}R.copy(w),S=!0}h.distance=this.locationMotion.value.distance,h.offset=new THREE__namespace.Vector3(R.x+(w.x-R.x)*M,R.y+(w.y-R.y)*M,R.z+(w.z-R.z)*M);for(var P=[],L=[],O=0,F=this.locationMotion.keyframes;O<F.length;O++){var N=F[O],D=N.key,U=N.progress;D!==void 0&&(P.push(D),U>this.locationMotion.progress&&L.push(D))}for(var z=0,G=Object.keys(this.panoResources);z<G.length;z++){var j=G[z];if(!(L.indexOf(j)>=0)){var Q=this.panoResources[j];if(Q.panoPicture){var V=Q.panoPicture.map;if(V){if(V===((s=d.pano0)===null||s===void 0?void 0:s.map)||V===((u=d.pano1)===null||u===void 0?void 0:u.map))continue;V.dispose(),Q.panoPicture=null}}P.indexOf(j)>=0||delete this.panoResources[j]}}var J=panoParse(b.panoId);J!==this.currentPano&&(this.currentPano=J,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.getObserver(this.currentPano),X=this.locationMotion.ended?this.getForwardObserverOrNot(this.camera):null,Z=this.works.getObserver(E.panoId),Y=this.works.getObserver(b.panoId);if(this.adjustPanoCircleMeshPositionBasedOnModel&&this.helper.visible&&W){for(var K=[],ee=W.work.observers,te=0,re=W.accessibleNodes;te<re.length;te++){var ae=re[te],C=ee[ae];C&&K.push(C)}var ce=new Map;if(K.sort(function(ue,Ae){var Ce=ce.get(ue);typeof Ce=="undefined"&&(Ce=ue.standingPosition.distanceTo(W.standingPosition),ce.set(ue,Ce));var Be=ce.get(ue);return typeof Be=="undefined"&&(Be=Ae.standingPosition.distanceTo(W.standingPosition),ce.set(Ae,Be)),Ce-Be}),K.length){this.accessibleObserverFloorCheckCount=this.accessibleObserverFloorCheckCount%K.length;var ie=K[this.accessibleObserverFloorCheckCount],fe=this.modelScene.models.find(function(ue){return ue.work===(ie==null?void 0:ie.work)});if(ie&&fe&&fe.visible){var ge=.3,ye=.05,_e=.005,le=ie.standingPosition.clone().applyMatrix4(ie.work.transform),de=panoStringify({panoIndex:ie.panoIndex,workCode:ie.work.workCode}),ne=adjustPanoCircleMeshVectors.map(function(ue){scratchRaycaster$1.ray.origin.copy(le),scratchRaycaster$1.ray.origin.add(scratchVector3$3.copy(ue).setY(ge)),scratchRaycaster$1.ray.direction.set(0,-1,0),scratchRaycaster$1.firstHitOnly=!0,scratchRaycaster$1.floorIndex=-1;var Ae=fe.intersectRaycaster(scratchRaycaster$1)[0];return Ae&&Ae.distance-_e<=ge?new THREE__namespace.Vector3().copy(le).setY(Ae.point.y+_e):le});ne.sort(function(ue,Ae){return Ae.y-ue.y});var se=ne[Math.floor(ne.length/2)],he=ne.filter(function(ue){return ue.distanceTo(se)<=ye})[0];if(he){var me=new THREE__namespace.Vector4(le.x,le.y,le.z,he.y-le.y),Ne=this.adjustPanoCircleMeshPositionFix.get(de);Ne&&!me.equals(Ne)&&(this.needsRender=!0),this.adjustPanoCircleMeshPositionFix.set(de,me)}}this.accessibleObserverFloorCheckCount++}}var qe=new Map;if(Z)for(var Ye=0,Ve=Z.accessibleNodes;Ye<Ve.length;Ye++){var ae=Ve[Ye],C=Z.work.observers[ae];if(C){var de=panoStringify({panoIndex:C.panoIndex,workCode:C.work.workCode});qe.set(de,C)}}if(Y)for(var ve=0,Ke=Y.accessibleNodes;ve<Ke.length;ve++){var ae=Ke[ve],C=Y.work.observers[ae];if(C){var de=panoStringify({panoIndex:C.panoIndex,workCode:C.work.workCode});qe.set(de,C)}}if(this.panoMeshes.forEach(function(ue,Ae){var Ce=qe.get(Ae);if(Ce){ue.position.copy(Ce.standingPosition).applyMatrix4(Ce.work.transform);var Be=o.adjustPanoCircleMeshPositionFix.get(Ae);Be&&(scratchVector3$3.set(Be.x,Be.y,Be.z),scratchVector3$3.equals(ue.position)&&(ue.position.y+=Be.w)),ue.scale.setScalar(1.2),qe.delete(Ae)}else o.helper.remove(ue),ue.dispose(),o.panoMeshes.delete(Ae)}),qe.forEach(function(ue,Ae){var Ce=o.panoCircleMeshCreator(panoParse(Ae));Ce.position.copy(ue.standingPosition).applyMatrix4(ue.work.transform);var Be=o.adjustPanoCircleMeshPositionFix.get(Ae);Be&&(scratchVector3$3.set(Be.x,Be.y,Be.z),scratchVector3$3.equals(Ce.position)&&(Ce.position.y+=Be.w)),Ce.scale.setScalar(1.2),o.panoMeshes.set(Ae,Ce),o.helper.add(Ce),qe.delete(Ae)}),this.camera.pose.distance>.1||S)this.panoMeshes.forEach(function(ue){ue.setOpacity(0),ue.setCurrent(!1),ue.updateTime&&ue.updateTime(e,r),ue.visible=!1});else if(W){var Te=W.work.observers,Le=arrayMin(W.accessibleNodes,function(ue){var Ae=Te[ue];return Ae?W.standingPosition.distanceTo(Ae.standingPosition):1/0},!0),Me=Le[1];Me=clamp$1(Me,2.5,1/0);var $e=W.visibleNodes.concat(W.panoIndex).map(function(ue){return panoStringify({panoIndex:ue,workCode:W.work.workCode})}),tt=this.camera.getDirection(new THREE__namespace.Vector3);this.panoMeshes.forEach(function(ue,Ae){var Ce=o.works.getObserver(Ae);if($e.indexOf(Ae)===-1)ue.setCurrent(!1),ue.setOpacity(0);else if(!Ce)ue.setCurrent(!1),ue.setOpacity(0);else if(!Ce.loadable&&!Ce.active)ue.setCurrent(!1),ue.setOpacity(0);else{var Be=ue.position.clone().setY(o.camera.position.y).distanceTo(o.camera.position);ue.setCurrent(!ue.loading&&ue.progress===0&&X!==null&&panoStringify({panoIndex:X.panoIndex,workCode:X.work.workCode})===Ae),ue.setOpacity(Be<.01?0:clamp$1(Me/Be*1.2,.4,.85));var nt=o.camera.position.clone().setY(ue.position.y),ct=new THREE__namespace.Vector3().copy(ue.position).sub(nt).normalize();if(Ae===panoStringify(o.currentPano)){var bt=clamp$1((.5-nt.distanceTo(ue.position))/.5,0,1);ct.multiplyScalar(1-bt).add(tt.clone().multiplyScalar(bt))}ct.length()>0&&ue.quaternion.setFromEuler(new THREE__namespace.Euler(0,Math.atan2(ct.x,ct.z),0))}ue.updateTime&&ue.updateTime(e,r)})}{var M=(l=this.modelScene.parameter.progress)!==null&&l!==void 0?l:1,ke=Math.round(M),Ie=this.modelScene.parameter.pano0,He=this.modelScene.parameter.pano1,Ee=ke===0?Ie:He,C=void 0;if(Ee&&(C=this.works.getObserver(Ee.panoId),C||(C=this.panoPictureObserverMap.get(Ee))),this.tiling.appearDuration=this.tileAppearDuration,this.tiling.maxRequest=M<.6?0:this.tileMaxRequest,this.tiling.imageOptions=this.imageOptions,!C||!Ee||this.tileLevelForFov===!1||this.camera.perspToOrtho.x>0){this.tiling.setObserver(null);var we={renderer:this.renderer,resolution:this.camera.resolution,pixelRatio:this.camera.pixelRatio,time:this.camera.time,cameraMatrix:this.camera.matrixWorld,cameraProjectionMatrix:this.camera.projectionMatrix,panoMap:null,panoMatrix:new THREE__namespace.Matrix4,panoZoom:1,minLevel:0,level:0};this.tiling.update(we),this.modelScene.parameter.set("refinedScreen",null)}else{var Pe=getImageSizeLevel(Ee.mapSize),je=Pe+1,Qe=new THREE__namespace.Vector2().copy(this.camera.resolution).multiplyScalar(this.camera.pixelRatio),We=Math.floor(this.tileLevelForFov(this.camera.fov,Qe)),gt=We>Pe?We:0;this.tiling.setObserver(C);var we={renderer:this.renderer,resolution:this.camera.resolution,pixelRatio:this.camera.pixelRatio,time:this.camera.time,cameraMatrix:this.camera.matrixWorld,cameraProjectionMatrix:this.camera.projectionMatrix,panoMap:Ee.map,panoMatrix:Ee.matrix,panoZoom:Ee.zoom,minLevel:je,level:gt},Je=this.tiling.update(we),At={map:this.tiling.renderTarget.texture,matrixInverse:this.tiling.camera.matrixWorldInverse,projectionMatrix:this.tiling.camera.projectionMatrix,pano:ke,opacity:(Ie==null?void 0:Ie.panoId)===(He==null?void 0:He.panoId)?1:easeInQuart(Math.abs(((c=this.modelScene.parameter.progress)!==null&&c!==void 0?c:0)-.5)*2)},Re=this.modelScene.parameter.refinedScreen;(Je||At.pano!==(Re==null?void 0:Re.pano)||At.opacity!==(Re==null?void 0:Re.opacity))&&this.modelScene.parameter.set("refinedScreen",At)}}if(this.panoVideo.object.position.copy(this.camera.position),this.panoVideo.updateTime(e),W&&W.video&&(this.needsRender=!0),this.intersectMesh&&this.intersectMesh.parent&&W&&W.position.y-W.standingPosition.y>10){var Ue=this.camera.position.distanceTo(this.intersectMesh.position),yt=2*Math.tan(.5*this.camera.fov/180*Math.PI),Ct=Ue*yt/5;this.intersectMesh.scale.setScalar(Ct)}else this.intersectMesh.scale.setScalar(1);{var Et=b.effect,dt=this.modelScene.parameter,Ie=dt.pano0,He=dt.pano1;if(Ie&&He&&Ie!==He&&Et==="fly"&&this.flyEffectUseDepthBuffer){if(((p=this.modelScene.parameter.pano0Depth)===null||p===void 0?void 0:p.panoId)!==Ie.panoId||((f=this.modelScene.parameter.pano1Depth)===null||f===void 0?void 0:f.panoId)!==He.panoId){var ht=500,ze=512;this.pano0DepthCubeRenderTarget?this.pano0DepthCubeRenderTarget.width!==ze&&this.pano0DepthCubeRenderTarget.setSize(ze,ze):this.pano0DepthCubeRenderTarget=new THREE__namespace.WebGLCubeRenderTarget(ze,{minFilter:THREE__namespace.NearestFilter,magFilter:THREE__namespace.NearestFilter,generateMipmaps:!1}),this.pano1DepthCubeRenderTarget?this.pano1DepthCubeRenderTarget.width!==ze&&this.pano1DepthCubeRenderTarget.setSize(ze,ze):this.pano1DepthCubeRenderTarget=new THREE__namespace.WebGLCubeRenderTarget(ze,{minFilter:THREE__namespace.NearestFilter,magFilter:THREE__namespace.NearestFilter,generateMipmaps:!1});var ut=new THREE__namespace.CubeCamera(this.camera.near,this.camera.far,this.pano0DepthCubeRenderTarget);ut.matrix.copy(Ie.matrix),ut.matrixWorld.copy(ut.matrix),ut.matrixAutoUpdate=!1,renderDepthCube(this.renderer,this.modelScene,ut,ht);var rt=new THREE__namespace.CubeCamera(this.camera.near,this.camera.far,this.pano1DepthCubeRenderTarget);rt.matrix.copy(He.matrix),rt.matrixWorld.copy(rt.matrix),rt.matrixAutoUpdate=!1,renderDepthCube(this.renderer,this.modelScene,rt,ht),this.modelScene.parameter.set({pano0Depth:{panoId:Ie.panoId,map:this.pano0DepthCubeRenderTarget.texture,mapSize:this.pano0DepthCubeRenderTarget.width,maxDepth:ht},pano1Depth:{panoId:He.panoId,map:this.pano1DepthCubeRenderTarget.texture,mapSize:this.pano1DepthCubeRenderTarget.width,maxDepth:ht}})}}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.getObserver(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().applyMatrix4(s.work.transform):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=panoStringify(e),f=this.works.getObserver(e);if(!f)throw new Error("Invalid PanoId ".concat(JSON.stringify(e)));getImageSizeFromURL(f.images.up),this.imageOptions.size;var d=this.imageOptions.transform,h=__assign({key:"pano.".concat(p)},pick(this.imageOptions,["format","size","quality","sharpen","forceUseExifOrientation","mappings"])),m={right:f.images.work.getURL(f.images.right),left:f.images.work.getURL(f.images.left),up:f.images.work.getURL(f.images.up),down:f.images.work.getURL(f.images.down),front:f.images.work.getURL(f.images.front),back:f.images.work.getURL(f.images.back)},A="pano:"+jsonHash([m,h,d]);if(this.pendingTextureTask){if(this.pendingTextureTask.hash===A)return;var g=this.pendingTextureTask.panoId;(l=this.panoMeshes.get(g))===null||l===void 0||l.setProgress(0),this.emit("pano.texture.abort",createEvent("pano.texture.abort",{error:null,progress:0,meta:null,pano:{panoIndex:f.panoIndex,workCode:f.work.workCode}}))}var y="move-to-pano-"+p;this.pending.add(y);var v=this.modelScene.parameter,E;if(v.pano0&&v.pano0.map.name===A?E=v.pano0:v.pano1&&v.pano1.map.name===A&&(E=v.pano1),E){var b={panoId:p,effect:c,panoPicture:{panoId:E.panoId,map:E.map,mapSize:E.mapSize,matrix:f.matrix.clone().premultiply(f.work.transform),zoom:1},position:f.position.clone().applyMatrix4(f.work.transform),fixCameraTransform:new THREE__namespace.Matrix4};b.panoPicture&&this.panoPictureObserverMap.set(b.panoPicture,f),this.pendingTextureTask=void 0,AnimationFrameLoop.shared.add(function(){s.pending.delete(y),s.doMoveToPano(e,b,r)},!0,1);return}this.pendingTextureTask={panoId:p,hash:A,onLoad:function(_){var S;s.pending.delete(y);var R=_.body;if(s.destroyed)R.dispose();else{R.name=A;var w=Array.isArray(R.image)?R.image[0]:R.image,M=(S=w==null?void 0:w.width)!==null&&S!==void 0?S:2048,B={panoId:p,effect:c,panoPicture:{panoId:p,map:R,mapSize:M,matrix:f.matrix.clone().premultiply(f.work.transform),zoom:1},position:f.position.clone().applyMatrix4(f.work.transform),fixCameraTransform:new THREE__namespace.Matrix4};B.panoPicture&&s.panoPictureObserverMap.set(B.panoPicture,f),s.doMoveToPano(e,B,r)}},onError:function(_){s.pending.delete(y);var S=__assign(__assign(__assign({},e),{mode:s.mode}),clonePose(s.camera.pose));s.emit("pano.error",createEvent("pano.error",{error:_,userAction:s.userAction,options:r,prevPano:s.currentPano,progress:0,state:S})),s.emit("pano.cancel",createEvent("pano.cancel",{error:_,userAction:s.userAction,options:r,prevPano:s.currentPano,progress:0,state:S})),s.emit("error",_),r.moveCancelCallback&&r.moveCancelCallback()}};var T=this.panoMeshes.get(p);T&&T.tap&&T.tap(),this.textureLoader.loadCubeTexture(m,{imageURL:{transform:d,options:h},format:THREE__namespace.RGBAFormat,viaAjax:!0,fetcher:getFetcher(f.work)},void 0,void 0,function(_){var S,R;s.emit("pano.texture.progress",createEvent("pano.texture.progress",{error:null,progress:_,meta:null,pano:e})),((S=s.pendingTextureTask)===null||S===void 0?void 0:S.hash)===A&&((R=s.panoMeshes.get(p))===null||R===void 0||R.setProgress(_))},this.renderer).then(function(_){var S,R;((S=s.pendingTextureTask)===null||S===void 0?void 0:S.hash)===A?(s.pendingTextureTask.onLoad(_),(R=s.panoMeshes.get(p))===null||R===void 0||R.setProgress(0),s.pendingTextureTask=void 0,s.emit("pano.texture.success",createEvent("pano.texture.success",{error:null,progress:1,meta:_.meta,pano:e}))):_.body.dispose()}).catch(function(_){var S,R;((S=s.pendingTextureTask)===null||S===void 0?void 0:S.hash)===A&&(s.pendingTextureTask.onError(_),(R=s.panoMeshes.get(p))===null||R===void 0||R.setProgress(0),s.pendingTextureTask=void 0,s.emit("pano.texture.error",createEvent("pano.texture.error",{error:_,progress:0,meta:null,pano:e})),s.emit("error",_))}),this.emit("pano.texture.load",createEvent("pano.texture.load",{error:null,progress:0,meta:null,pano:e}))},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(m){h=!0,e.perspToOrthoMotion.set(d,s).catch(noop),e.modelAlphaMotion.setKeyframes([{progress:0,value:__assign({},e.modelAlphaMotion.value)},{progress:.6,value:__assign({},e.modelAlphaMotion.value)},{progress:1,value:f}],s).catch(noop),e.emit("initAnimation.start",createEvent("initAnimation.start",{state:m,userAction:e.userAction}))},moveEndCallback:function(m){e.emit("initAnimation.end",createEvent("initAnimation.end",{state:m,userAction:e.userAction})),e.initAnimationed=!0,r()},moveCancelCallback:function(){var m=__assign(__assign(__assign({},p),{mode:e.mode}),clonePose(e.camera.pose));h===!1&&e.emit("initAnimation.start",createEvent("initAnimation.start",{state:m,userAction:e.userAction})),e.emit("initAnimation.end",createEvent("initAnimation.end",{state:m,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.doMoveToPano=function(e,r,o){var s=this,u,l,c,p,f,d,h,m,A,g,y;o===void 0&&(o={});var v=now(),E=createUuid();this.panoResources[E]=r;var b=1,T,_,S;if(this.locationMotion.ended){var R=this.locationMotion.getKeyFrameSegment(v);R[0];var w=R[1],M=this.locationMotion.value,B=((u=this.panoResourceFromLocationMotionKeyframe(w))!==null&&u!==void 0?u:this.camera).position,C=r.position;T=Math.max(B.distanceTo(C),b),_=[{key:w.key,progress:0,value:__assign(__assign({},M),{count:0})},{key:E,progress:1,value:{distance:0,count:1}}],S=0}else{var P=this.locationMotion.getKeyFrameSegment(v),L=P[0],w=P[1],M=this.locationMotion.value,O=this.panoResourceFromLocationMotionKeyframe(L).position,B=this.panoResourceFromLocationMotionKeyframe(w).position,C=r.position,F=w.value.count-M.count,N=Math.max(O.distanceTo(B),b)*F,D=Math.max(B.distanceTo(C),b);T=N+D,_=[{key:L.key,progress:0,value:__assign({},M)},{key:w.key,progress:N/T,value:w.value},{key:E,progress:1,value:{count:w.value.count+1,distance:0}}];var U=this.locationMotionKeyframesLength(this.locationMotion.keyframes),z=this.locationMotionKeyframesLength(_);U===0||U===0?S=0:S=this.locationMotion.getProgressVelocity(v)*U/z}var G=r.effect==="instant"?0:this.calculateMovingDuration(o.duration,r.effect==="fly"?T:0),j={longitude:o.longitude,latitude:o.latitude,fov:o.fov},Q=__assign(__assign({},e),{mode:this.mode,longitude:(l=j.longitude)!==null&&l!==void 0?l:this.camera.pose.longitude,latitude:(c=j.latitude)!==null&&c!==void 0?c:this.camera.pose.latitude,fov:(p=j.fov)!==null&&p!==void 0?p:this.camera.pose.fov,offset:r.position.clone(),distance:this.camera.pose.distance}),V=this.currentPano;if(this.emit("pano.moveTo",createEvent("pano.moveTo",{options:o,prevPano:V,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,this.videoTexture.needsUpdate=!0),this.panoVideo.setMaterial(null),r.effect==="fly")this.cameraMotion.set(j,G).catch(noop);else{var J=coordinatesToVector({longitude:this.cameraMotion.value.longitude,latitude:this.cameraMotion.value.latitude}),W=coordinatesToVector({longitude:(f=j.longitude)!==null&&f!==void 0?f:this.cameraMotion.value.longitude,latitude:(d=j.latitude)!==null&&d!==void 0?d:this.cameraMotion.value.latitude}),X=new THREE__namespace.Object3D;X.lookAt(J);var Z=new THREE__namespace.Matrix4().makeRotationFromQuaternion(X.quaternion);X.lookAt(W);var Y=new THREE__namespace.Matrix4().makeRotationFromQuaternion(X.quaternion),K=new THREE__namespace.Matrix4().getInverse(Z).premultiply(Y),ee=this.cameraMotion.value.fov,te=(h=j.fov)!==null&&h!==void 0?h:this.cameraMotion.value.fov,re=1;r.effect==="zoomin"?re=1.5:r.effect==="zoomout"&&(re=.4);for(var ae=clamp$1(te*re,1,170),ce=0;ce<_.length-1;ce++){var ie=_[ce].key;if(ie){var fe=this.panoResources[ie];fe&&(fe.fixCameraTransform.copy(K),fe.panoPicture&&(fe.panoPicture.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:(m=j.longitude)!==null&&m!==void 0?m:this.cameraMotion.value.longitude,latitude:(A=j.latitude)!==null&&A!==void 0?A:this.cameraMotion.value.latitude,fov:ae}},{progress:1,value:{longitude:(g=j.longitude)!==null&&g!==void 0?g:this.cameraMotion.value.longitude,latitude:(y=j.latitude)!==null&&y!==void 0?y:this.cameraMotion.value.latitude,fov:te}}],G).catch(noop)}var ge=this.locationMotion.setKeyframes(_,G,S);ge.then(function(){for(var ye=0,_e=s.modelScene.children;ye<_e.length;ye++){var le=_e[ye];le instanceof Model&&le.show()}var de=__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:V,progress:1,state:de,userAction:s.userAction,error:null})),o.moveEndCallback&&o.moveEndCallback(de);var ne=s.works.getObserver(e);if(ne&&ne.video&&s.videoTexture&&s.videoTexture.image instanceof HTMLVideoElement){var se={map:s.videoTexture,size:ne.video.size.clone(),matrix:ne.video.matrix.clone(),panoMatrix:ne.matrix.clone().premultiply(ne.work.transform),alpha:1},he=createUuid(),me=s.videoTexture.image;me.setAttribute("uuid",he),me.oncanplay=noop,me.ontimeupdate=noop,canplayVideo().then(function(qe){qe&&ne.video&&me.getAttribute("uuid")===he&&(me.oncanplay=function(){me.oncanplay=noop,me.play()},me.ontimeupdate=function(){me.currentTime>.5&&(me.ontimeupdate=noop,s.panoVideo.setMaterial(se))},me.src=ne.video.source)}).catch((function(){me.removeAttribute("uuid")}))}else{var Ne=s.videoTexture.image;Ne.removeAttribute("uuid"),Ne.oncanplay=noop,Ne.ontimeupdate=noop}},function(){s.emit("pano.cancel",createEvent("pano.cancel",{options:o,prevPano:V,progress:0,state:Q,userAction:s.userAction,error:null})),o.moveCancelCallback&&o.moveCancelCallback()})},t.prototype.getForwardObserverOrNot=function(e,r){var o=this,s=this.works.getObserver(this.currentPano);if(!s)return null;var u=r!=null?r:new THREE__namespace.Raycaster(e.position.clone(),e.getWorldDirection(new THREE__namespace.Vector3));u.params.Points={threshold:.1},u.firstHitOnly=!0,u.floorIndex=-1;var l=s.standingPosition.clone().applyMatrix4(s.work.transform),c=s.position.clone().applyMatrix4(s.work.transform);if(c.distanceTo(u.ray.origin)>1){var p=new THREE__namespace.Raycaster(u.ray.origin,new THREE__namespace.Vector3(0,-1,0));p.firstHitOnly=u.firstHitOnly,p.floorIndex=u.floorIndex;var f=this.modelScene.intersectRaycaster(p)[0];f&&f.distance<=2?l.copy(f.point):l.copy(u.ray.origin).add(new THREE__namespace.Vector3(0,-1.5,0))}var d=this.modelScene.intersectRaycaster(u)[0],h=d?d.point:u.ray.origin.clone().add(u.ray.direction.clone().normalize().multiplyScalar(3)),m=h.clone().sub(l).normalize();if(m.length()===0)return null;var A=s.work.observers,g=s.accessibleNodes.filter(function(C){if(C===o.currentPano.panoIndex&&s.work.workCode===o.currentPano.workCode)return!1;var P=A[C];if(!P)return!1;var L=P.standingPosition.clone().applyMatrix4(P.work.transform).project(e);return Math.abs(L.z)>1||Math.abs(L.x)>1||Math.abs(L.y)>1?!1:P.loadable||P.active}),y=new Map,v=g.slice().sort(function(C,P){var L=A[C],O=y.get(L);typeof O=="undefined"&&(O=scratchVector3$3.copy(L.standingPosition).applyMatrix4(L.work.transform).distanceTo(l),y.set(L,O));var F=A[P],N=y.get(F);return typeof N=="undefined"&&(N=scratchVector3$3.copy(F.standingPosition).applyMatrix4(F.work.transform).distanceTo(l),y.set(F,N)),O-N});y.clear();for(var E=0,b=[Math.PI/8,Math.PI/6,Math.PI/4,Math.PI/3];E<b.length;E++)for(var T=b[E],_=0,S=v;_<S.length;_++){var R=S[_],w=A[R];if(w){var M=scratchVector3$3.copy(w.standingPosition).applyMatrix4(w.work.transform).sub(l);if(M&&M.length()!==0&&m.angleTo(M)<T)return w}}var B=arrayMin(g.map(function(C){return A[C]}),function(C){var P=scratchVector3$3.copy(C.position).applyMatrix4(C.work.transform);return u.ray.closestPointToPoint(P,new THREE__namespace.Vector3).distanceTo(P)});return B||null},t.prototype.onTapGesture=function(e){var r=this,o;if(this.userAction=e.userAction,this.stopMomentumMovement(),!!this.initAnimationed){var s=e.center.raycaster;s.floorIndex=-1;var u=this.camera.getDirection(new THREE__namespace.Vector3).setY(0),l=null,c=this.works.getObserver(this.currentPano);if(c){var p=c.work.observers,f=c.accessibleNodes.filter(function(V){if(V===r.currentPano.panoIndex&&c.work.workCode===r.currentPano.workCode)return!1;var J=p[V];if(!J)return!1;var W=scratchVector3$3.copy(J.position).applyMatrix4(J.work.transform);return W.distanceTo(r.camera.position)>r.maxAccessibleDistance?!1:J.loadable||J.active}),d=this.modelScene.intersectRaycaster(s)[0];if(d){var h=arrayMin(f,function(V){var J=p[V];if(!J)return 1/0;var W=scratchVector3$3.copy(J.standingPosition).applyMatrix4(J.work.transform);return W.distanceTo(d.point)},!0),m=h[0],A=h[1];typeof m=="number"&&A<this.panoTapTriggerRadius&&(l=(o=p[m])!==null&&o!==void 0?o:null)}if(l||(l=this.getForwardObserverOrNot(this.camera,s)),l&&l.panoId===panoStringify(this.currentPano)&&(l=null),l&&!this.locationMotion.ended)for(var g=0,y=this.locationMotion.keyframes;g<y.length;g++){var v=y[g],E=this.panoResourceFromLocationMotionKeyframe(v);if(E.panoId===l.panoId){l=null;break}}if(!l)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=l.position.clone().applyMatrix4(l.work.transform).setY(0).sub(c.position.clone().applyMatrix4(l.work.transform).setY(0)).normalize(),R=[],w=[],M=[],B=l.work.observers,C=0,P=l.accessibleNodes;C<P.length;C++){var m=P[C];if(l.panoIndex!==m&&!(m===this.currentPano.panoIndex&&l.work.workCode===this.currentPano.workCode)){var L=B[m];if(L){var O=L.position.clone().applyMatrix4(L.work.transform).sub(l.position.clone().applyMatrix4(l.work.transform)).setY(0).normalize();S.angleTo(O)<T&&M.push(O)}}}var F=M.length>0?M:__spreadArray(__spreadArray([],R,!0),w,!0),N=F.slice().sort(function(V,J){return V.angleTo(S)-J.angleTo(S)})[0];if(N&&N.angleTo(u)>_&&(b.longitude=Math.atan2(-N.x,-N.z)),this.cameraMotion.value.latitude<-Math.PI/4){var D=e.state.fov,U=clamp$1(typeof this.minLatitude=="function"?this.minLatitude(D):this.minLatitude,-Math.PI/2,Math.PI/2),z=clamp$1(typeof this.maxLatitude=="function"?this.maxLatitude(D):this.maxLatitude,-Math.PI/2,Math.PI/2);b.latitude=clamp$1(0,U,z)}var G=__assign({},e.state);if(G.workCode=l.work.workCode,G.panoIndex=l.panoIndex,b.longitude!==void 0&&(G.longitude=b.longitude),b.latitude!==void 0&&(G.latitude=b.latitude),b.fov!==void 0&&(G.fov=b.fov),G.distance=0,G.offset=l.position.clone(),e.state=G,this.emit("gesture.tap",e),!e.defaultPrevented){if(this.emit("pano.select",createEvent("pano.select",{prevPano:this.currentPano,state:G,userAction:e.userAction,options:b,progress:0,error:null})),l&&!l.active){var j=panoStringify({panoIndex:l.panoIndex,workCode:l.work.workCode}),Q=this.panoMeshes.get(j);Q&&(Q.setDisabled(!1),Q.setLoading(!0))}l&&l.active&&this.emit("pano.request",createEvent("pano.request",{userAction:e.userAction,prevPano:this.currentPano,progress:0,state:G,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,m=u*f,A=u*d,g=u*h,y=l*d,v=l*h,E=c*h,b=p*f,T=p*d,_=p*h;return r[0]=1-(y+E),r[1]=A+_,r[2]=g-T,r[3]=0,r[4]=A-_,r[5]=1-(m+E),r[6]=v+b,r[7]=0,r[8]=g+T,r[9]=v-b,r[10]=1-(m+y),r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function t(r,o,s){var u=s[0],l=s[1],c=s[2],p,f,d,h,m,A,g,y,v,E,b,T;return o===r?(r[12]=o[0]*u+o[4]*l+o[8]*c+o[12],r[13]=o[1]*u+o[5]*l+o[9]*c+o[13],r[14]=o[2]*u+o[6]*l+o[10]*c+o[14],r[15]=o[3]*u+o[7]*l+o[11]*c+o[15]):(p=o[0],f=o[1],d=o[2],h=o[3],m=o[4],A=o[5],g=o[6],y=o[7],v=o[8],E=o[9],b=o[10],T=o[11],r[0]=p,r[1]=f,r[2]=d,r[3]=h,r[4]=m,r[5]=A,r[6]=g,r[7]=y,r[8]=v,r[9]=E,r[10]=b,r[11]=T,r[12]=p*u+m*l+v*c+o[12],r[13]=f*u+A*l+E*c+o[13],r[14]=d*u+g*l+b*c+o[14],r[15]=h*u+y*l+T*c+o[15]),r}function e(r,o){var s=o[0],u=o[1],l=o[2],c=o[3],p=o[4],f=o[5],d=o[6],h=o[7],m=o[8],A=o[9],g=o[10],y=o[11],v=o[12],E=o[13],b=o[14],T=o[15],_=s*f-u*p,S=s*d-l*p,R=s*h-c*p,w=u*d-l*f,M=u*h-c*f,B=l*h-c*d,C=m*E-A*v,P=m*b-g*v,L=m*T-y*v,O=A*b-g*E,F=A*T-y*E,N=g*T-y*b,D=_*N-S*F+R*O+w*L-M*P+B*C;return D?(D=1/D,r[0]=(f*N-d*F+h*O)*D,r[1]=(l*F-u*N-c*O)*D,r[2]=(E*B-b*M+T*w)*D,r[3]=(g*M-A*B-y*w)*D,r[4]=(d*L-p*N-h*P)*D,r[5]=(s*N-l*L+c*P)*D,r[6]=(b*R-v*B-T*S)*D,r[7]=(m*B-g*R+y*S)*D,r[8]=(p*F-f*L+h*C)*D,r[9]=(u*L-s*F-c*C)*D,r[10]=(v*M-E*R+T*_)*D,r[11]=(A*R-m*M-y*_)*D,r[12]=(f*P-p*O-d*C)*D,r[13]=(s*O-u*P+l*C)*D,r[14]=(E*S-v*w-b*_)*D,r[15]=(m*w-A*S+g*_)*D,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)),m=new FieldOfView,A=new FieldOfView;return m.leftDegrees=Math.min(p,t.fov),m.rightDegrees=Math.min(f,t.fov),m.downDegrees=Math.min(d,t.fov),m.upDegrees=Math.min(h,t.fov),A.leftDegrees=m.rightDegrees,A.rightDegrees=m.leftDegrees,A.upDegrees=m.upDegrees,A.downDegrees=m.downDegrees,{left:m,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,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",phone="data:image/png;base64,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";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=`
1573
+ `,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$3=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,r.adjustPanoCircleMeshPositionFix=new Map;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=new Map,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=this,o=n.prototype.updateConfiguration.call(this,e);return o===!1?!1:(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&&(this.panoMeshes.forEach(function(s){r.helper.remove(s),s.dispose()}),this.panoMeshes.clear())),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,this.adjustPanoCircleMeshPositionBasedOnModel||this.adjustPanoCircleMeshPositionFix.clear()),!0)},t.prototype.destroy=function(){var e=this;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(),this.pendingTextureTask=void 0,this.panoMeshes&&(this.panoMeshes.forEach(function(h){e.helper.remove(h),h.dispose()}),this.panoMeshes.clear());var r=this.videoTexture.image;r.pause(),r.oncanplay=noop,r.ontimeupdate=noop,this.scene.remove(this.panoVideo.object),this.panoVideo.setMaterial(null),this.panoVideo.dispose();for(var o=this.modelScene.parameter.resolveValue(),s=o.pano0,u=o.pano1,l=0,c=Object.keys(this.panoResources);l<c.length;l++){var p=c[l],f=this.panoResources[p];if(f.panoPicture){var d=f.panoPicture.map;d&&d!==(s==null?void 0:s.map)&&d!==(u==null?void 0:u.map)&&(d.dispose(),f.panoPicture=null)}delete this.panoResources[p]}},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.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.hideIntersectMesh()},t.prototype.updateTime=function(e,r){var o=this,s,u,l,c,p,f;if(!this.destroyed){var d={},h={},m=this.locationMotion.keyframes[0],A=this.locationMotion.keyframes[this.locationMotion.keyframes.length-1],g=this.locationMotion.getKeyFrameSegment(e),y=g[0],v=g[1],E=this.panoResourceFromLocationMotionKeyframe(y),b=this.panoResourceFromLocationMotionKeyframe(v),T=this.panoResourceFromLocationMotionKeyframe(m),_=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(E.position),w=new THREE__namespace.Vector3().copy(b.position),M=this.locationMotion.value.count-v.value.count+1;if(d.progress=M,b.panoPicture&&(M<1?E.panoPicture&&(d.pano0=E.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(M,3)),M<1&&b.effect!=="fly"){if(d.pano0&&E.panoPicture){var B={panoId:d.pano0.panoId,map:d.pano0.map,mapSize:d.pano0.mapSize,zoom:d.pano0.zoom,matrix:E.panoPicture.matrix.clone().premultiply(E.fixCameraTransform).setPosition(b.position)},C=this.panoPictureObserverMap.get(d.pano0);C&&this.panoPictureObserverMap.set(B,C),d.pano0=B}R.copy(w),S=!0}h.distance=this.locationMotion.value.distance,h.offset=new THREE__namespace.Vector3(R.x+(w.x-R.x)*M,R.y+(w.y-R.y)*M,R.z+(w.z-R.z)*M);for(var P=[],L=[],O=0,F=this.locationMotion.keyframes;O<F.length;O++){var N=F[O],D=N.key,U=N.progress;D!==void 0&&(P.push(D),U>this.locationMotion.progress&&L.push(D))}for(var z=0,K=Object.keys(this.panoResources);z<K.length;z++){var j=K[z];if(!(L.indexOf(j)>=0)){var Q=this.panoResources[j];if(Q.panoPicture){var V=Q.panoPicture.map;if(V){if(V===((s=d.pano0)===null||s===void 0?void 0:s.map)||V===((u=d.pano1)===null||u===void 0?void 0:u.map))continue;V.dispose(),Q.panoPicture=null}}P.indexOf(j)>=0||delete this.panoResources[j]}}var J=panoParse(b.panoId);J!==this.currentPano&&(this.currentPano=J,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.getObserver(this.currentPano),X=this.locationMotion.ended?this.getForwardObserverOrNot(this.camera):null,Z=this.works.getObserver(E.panoId),Y=this.works.getObserver(b.panoId);if(this.adjustPanoCircleMeshPositionBasedOnModel&&this.helper.visible&&W){for(var G=[],ee=W.work.observers,te=0,ne=W.accessibleNodes;te<ne.length;te++){var ae=ne[te],C=ee[ae];C&&G.push(C)}var ce=new Map;if(G.sort(function(ue,Ae){var Ce=ce.get(ue);typeof Ce=="undefined"&&(Ce=ue.standingPosition.distanceTo(W.standingPosition),ce.set(ue,Ce));var Be=ce.get(ue);return typeof Be=="undefined"&&(Be=Ae.standingPosition.distanceTo(W.standingPosition),ce.set(Ae,Be)),Ce-Be}),G.length){this.accessibleObserverFloorCheckCount=this.accessibleObserverFloorCheckCount%G.length;var ie=G[this.accessibleObserverFloorCheckCount],fe=this.modelScene.models.find(function(ue){return ue.work===(ie==null?void 0:ie.work)});if(ie&&fe&&fe.visible){var ge=.3,ye=.05,_e=.005,le=ie.standingPosition.clone().applyMatrix4(ie.work.transform),de=panoStringify({panoIndex:ie.panoIndex,workCode:ie.work.workCode}),re=adjustPanoCircleMeshVectors.map(function(ue){scratchRaycaster$1.ray.origin.copy(le),scratchRaycaster$1.ray.origin.add(scratchVector3$3.copy(ue).setY(ge)),scratchRaycaster$1.ray.direction.set(0,-1,0),scratchRaycaster$1.firstHitOnly=!0,scratchRaycaster$1.floorIndex=-1;var Ae=fe.intersectRaycaster(scratchRaycaster$1)[0];return Ae&&Ae.distance-_e<=ge?new THREE__namespace.Vector3().copy(le).setY(Ae.point.y+_e):le});re.sort(function(ue,Ae){return Ae.y-ue.y});var se=re[Math.floor(re.length/2)],he=re.filter(function(ue){return ue.distanceTo(se)<=ye})[0];if(he){var me=new THREE__namespace.Vector4(le.x,le.y,le.z,he.y-le.y),Ne=this.adjustPanoCircleMeshPositionFix.get(de);Ne&&!me.equals(Ne)&&(this.needsRender=!0),this.adjustPanoCircleMeshPositionFix.set(de,me)}}this.accessibleObserverFloorCheckCount++}}var qe=new Map;if(Z)for(var Ye=0,Ve=Z.accessibleNodes;Ye<Ve.length;Ye++){var ae=Ve[Ye],C=Z.work.observers[ae];if(C){var de=panoStringify({panoIndex:C.panoIndex,workCode:C.work.workCode});qe.set(de,C)}}if(Y)for(var ve=0,Ke=Y.accessibleNodes;ve<Ke.length;ve++){var ae=Ke[ve],C=Y.work.observers[ae];if(C){var de=panoStringify({panoIndex:C.panoIndex,workCode:C.work.workCode});qe.set(de,C)}}if(this.panoMeshes.forEach(function(ue,Ae){var Ce=qe.get(Ae);if(Ce){ue.position.copy(Ce.standingPosition).applyMatrix4(Ce.work.transform);var Be=o.adjustPanoCircleMeshPositionFix.get(Ae);Be&&(scratchVector3$3.set(Be.x,Be.y,Be.z),scratchVector3$3.equals(ue.position)&&(ue.position.y+=Be.w)),ue.scale.setScalar(1.2),qe.delete(Ae)}else o.helper.remove(ue),ue.dispose(),o.panoMeshes.delete(Ae)}),qe.forEach(function(ue,Ae){var Ce=o.panoCircleMeshCreator(panoParse(Ae));Ce.position.copy(ue.standingPosition).applyMatrix4(ue.work.transform);var Be=o.adjustPanoCircleMeshPositionFix.get(Ae);Be&&(scratchVector3$3.set(Be.x,Be.y,Be.z),scratchVector3$3.equals(Ce.position)&&(Ce.position.y+=Be.w)),Ce.scale.setScalar(1.2),o.panoMeshes.set(Ae,Ce),o.helper.add(Ce),qe.delete(Ae)}),this.camera.pose.distance>.1||S)this.panoMeshes.forEach(function(ue){ue.setOpacity(0),ue.setCurrent(!1),ue.updateTime&&ue.updateTime(e,r),ue.visible=!1});else if(W){var Te=W.work.observers,Le=arrayMin(W.accessibleNodes,function(ue){var Ae=Te[ue];return Ae?W.standingPosition.distanceTo(Ae.standingPosition):1/0},!0),Me=Le[1];Me=clamp$1(Me,2.5,1/0);var $e=W.visibleNodes.concat(W.panoIndex).map(function(ue){return panoStringify({panoIndex:ue,workCode:W.work.workCode})}),tt=this.camera.getDirection(new THREE__namespace.Vector3);this.panoMeshes.forEach(function(ue,Ae){var Ce=o.works.getObserver(Ae);if($e.indexOf(Ae)===-1)ue.setCurrent(!1),ue.setOpacity(0);else if(!Ce)ue.setCurrent(!1),ue.setOpacity(0);else if(!Ce.loadable&&!Ce.active)ue.setCurrent(!1),ue.setOpacity(0);else{var Be=ue.position.clone().setY(o.camera.position.y).distanceTo(o.camera.position);ue.setCurrent(!ue.loading&&ue.progress===0&&X!==null&&panoStringify({panoIndex:X.panoIndex,workCode:X.work.workCode})===Ae),ue.setOpacity(Be<.01?0:clamp$1(Me/Be*1.2,.4,.85));var nt=o.camera.position.clone().setY(ue.position.y),ct=new THREE__namespace.Vector3().copy(ue.position).sub(nt).normalize();if(Ae===panoStringify(o.currentPano)){var bt=clamp$1((.5-nt.distanceTo(ue.position))/.5,0,1);ct.multiplyScalar(1-bt).add(tt.clone().multiplyScalar(bt))}ct.length()>0&&ue.quaternion.setFromEuler(new THREE__namespace.Euler(0,Math.atan2(ct.x,ct.z),0))}ue.updateTime&&ue.updateTime(e,r)})}{var M=(l=this.modelScene.parameter.progress)!==null&&l!==void 0?l:1,ke=Math.round(M),Ie=this.modelScene.parameter.pano0,He=this.modelScene.parameter.pano1,Ee=ke===0?Ie:He,C=void 0;if(Ee&&(C=this.works.getObserver(Ee.panoId),C||(C=this.panoPictureObserverMap.get(Ee))),this.tiling.appearDuration=this.tileAppearDuration,this.tiling.maxRequest=M<.6?0:this.tileMaxRequest,this.tiling.imageOptions=this.imageOptions,!C||!Ee||this.tileLevelForFov===!1||this.camera.perspToOrtho.x>0){this.tiling.setObserver(null);var we={renderer:this.renderer,resolution:this.camera.resolution,pixelRatio:this.camera.pixelRatio,time:this.camera.time,cameraMatrix:this.camera.matrixWorld,cameraProjectionMatrix:this.camera.projectionMatrix,panoMap:null,panoMatrix:new THREE__namespace.Matrix4,panoZoom:1,minLevel:0,level:0};this.tiling.update(we),this.modelScene.parameter.set("refinedScreen",null)}else{var Pe=getImageSizeLevel(Ee.mapSize),je=Pe+1,Qe=new THREE__namespace.Vector2().copy(this.camera.resolution).multiplyScalar(this.camera.pixelRatio),We=Math.floor(this.tileLevelForFov(this.camera.fov,Qe)),gt=We>Pe?We:0;this.tiling.setObserver(C);var we={renderer:this.renderer,resolution:this.camera.resolution,pixelRatio:this.camera.pixelRatio,time:this.camera.time,cameraMatrix:this.camera.matrixWorld,cameraProjectionMatrix:this.camera.projectionMatrix,panoMap:Ee.map,panoMatrix:Ee.matrix,panoZoom:Ee.zoom,minLevel:je,level:gt},Je=this.tiling.update(we),At={map:this.tiling.renderTarget.texture,matrixInverse:this.tiling.camera.matrixWorldInverse,projectionMatrix:this.tiling.camera.projectionMatrix,pano:ke,opacity:(Ie==null?void 0:Ie.panoId)===(He==null?void 0:He.panoId)?1:easeInQuart(Math.abs(((c=this.modelScene.parameter.progress)!==null&&c!==void 0?c:0)-.5)*2)},Re=this.modelScene.parameter.refinedScreen;(Je||At.pano!==(Re==null?void 0:Re.pano)||At.opacity!==(Re==null?void 0:Re.opacity))&&this.modelScene.parameter.set("refinedScreen",At)}}if(this.panoVideo.object.position.copy(this.camera.position),this.panoVideo.updateTime(e),W&&W.video&&(this.needsRender=!0),this.intersectMesh&&this.intersectMesh.parent&&W&&W.position.y-W.standingPosition.y>10){var Ue=this.camera.position.distanceTo(this.intersectMesh.position),yt=2*Math.tan(.5*this.camera.fov/180*Math.PI),Ct=Ue*yt/5;this.intersectMesh.scale.setScalar(Ct)}else this.intersectMesh.scale.setScalar(1);{var Et=b.effect,dt=this.modelScene.parameter,Ie=dt.pano0,He=dt.pano1;if(Ie&&He&&Ie!==He&&Et==="fly"&&this.flyEffectUseDepthBuffer){if(((p=this.modelScene.parameter.pano0Depth)===null||p===void 0?void 0:p.panoId)!==Ie.panoId||((f=this.modelScene.parameter.pano1Depth)===null||f===void 0?void 0:f.panoId)!==He.panoId){var ht=500,ze=512;this.pano0DepthCubeRenderTarget?this.pano0DepthCubeRenderTarget.width!==ze&&this.pano0DepthCubeRenderTarget.setSize(ze,ze):this.pano0DepthCubeRenderTarget=new THREE__namespace.WebGLCubeRenderTarget(ze,{minFilter:THREE__namespace.NearestFilter,magFilter:THREE__namespace.NearestFilter,generateMipmaps:!1}),this.pano1DepthCubeRenderTarget?this.pano1DepthCubeRenderTarget.width!==ze&&this.pano1DepthCubeRenderTarget.setSize(ze,ze):this.pano1DepthCubeRenderTarget=new THREE__namespace.WebGLCubeRenderTarget(ze,{minFilter:THREE__namespace.NearestFilter,magFilter:THREE__namespace.NearestFilter,generateMipmaps:!1});var ut=new THREE__namespace.CubeCamera(this.camera.near,this.camera.far,this.pano0DepthCubeRenderTarget);ut.matrix.copy(Ie.matrix),ut.matrixWorld.copy(ut.matrix),ut.matrixAutoUpdate=!1,renderDepthCube(this.renderer,this.modelScene,ut,ht);var rt=new THREE__namespace.CubeCamera(this.camera.near,this.camera.far,this.pano1DepthCubeRenderTarget);rt.matrix.copy(He.matrix),rt.matrixWorld.copy(rt.matrix),rt.matrixAutoUpdate=!1,renderDepthCube(this.renderer,this.modelScene,rt,ht),this.modelScene.parameter.set({pano0Depth:{panoId:Ie.panoId,map:this.pano0DepthCubeRenderTarget.texture,mapSize:this.pano0DepthCubeRenderTarget.width,maxDepth:ht},pano1Depth:{panoId:He.panoId,map:this.pano1DepthCubeRenderTarget.texture,mapSize:this.pano1DepthCubeRenderTarget.width,maxDepth:ht}})}}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.getObserver(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().applyMatrix4(s.work.transform):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=panoStringify(e),f=this.works.getObserver(e);if(!f)throw new Error("Invalid PanoId ".concat(JSON.stringify(e)));getImageSizeFromURL(f.images.up),this.imageOptions.size;var d=this.imageOptions.transform,h=__assign({key:"pano.".concat(p)},pick(this.imageOptions,["format","size","quality","sharpen","forceUseExifOrientation","mappings"])),m={right:f.images.work.getURL(f.images.right),left:f.images.work.getURL(f.images.left),up:f.images.work.getURL(f.images.up),down:f.images.work.getURL(f.images.down),front:f.images.work.getURL(f.images.front),back:f.images.work.getURL(f.images.back)},A="pano:"+jsonHash([m,h,d]);if(this.pendingTextureTask){if(this.pendingTextureTask.hash===A)return;var g=this.pendingTextureTask.panoId;(l=this.panoMeshes.get(g))===null||l===void 0||l.setProgress(0),this.emit("pano.texture.abort",createEvent("pano.texture.abort",{error:null,progress:0,meta:null,pano:{panoIndex:f.panoIndex,workCode:f.work.workCode}}))}var y="move-to-pano-"+p;this.pending.add(y);var v=this.modelScene.parameter,E;if(v.pano0&&v.pano0.map.name===A?E=v.pano0:v.pano1&&v.pano1.map.name===A&&(E=v.pano1),E){var b={panoId:p,effect:c,panoPicture:{panoId:E.panoId,map:E.map,mapSize:E.mapSize,matrix:f.matrix.clone().premultiply(f.work.transform),zoom:1},position:f.position.clone().applyMatrix4(f.work.transform),fixCameraTransform:new THREE__namespace.Matrix4};b.panoPicture&&this.panoPictureObserverMap.set(b.panoPicture,f),this.pendingTextureTask=void 0,AnimationFrameLoop.shared.add(function(){s.pending.delete(y),s.doMoveToPano(e,b,r)},!0,1);return}this.pendingTextureTask={panoId:p,hash:A,onLoad:function(_){var S;s.pending.delete(y);var R=_.body;if(s.destroyed)R.dispose();else{R.name=A;var w=Array.isArray(R.image)?R.image[0]:R.image,M=(S=w==null?void 0:w.width)!==null&&S!==void 0?S:2048,B={panoId:p,effect:c,panoPicture:{panoId:p,map:R,mapSize:M,matrix:f.matrix.clone().premultiply(f.work.transform),zoom:1},position:f.position.clone().applyMatrix4(f.work.transform),fixCameraTransform:new THREE__namespace.Matrix4};B.panoPicture&&s.panoPictureObserverMap.set(B.panoPicture,f),s.doMoveToPano(e,B,r)}},onError:function(_){s.pending.delete(y);var S=__assign(__assign(__assign({},e),{mode:s.mode}),clonePose(s.camera.pose));s.emit("pano.error",createEvent("pano.error",{error:_,userAction:s.userAction,options:r,prevPano:s.currentPano,progress:0,state:S})),s.emit("pano.cancel",createEvent("pano.cancel",{error:_,userAction:s.userAction,options:r,prevPano:s.currentPano,progress:0,state:S})),s.emit("error",_),r.moveCancelCallback&&r.moveCancelCallback()}};var T=this.panoMeshes.get(p);T&&T.tap&&T.tap(),this.textureLoader.loadCubeTexture(m,{imageURL:{transform:d,options:h},format:THREE__namespace.RGBAFormat,viaAjax:!0,fetcher:getFetcher(f.work)},void 0,void 0,function(_){var S,R;s.emit("pano.texture.progress",createEvent("pano.texture.progress",{error:null,progress:_,meta:null,pano:e})),((S=s.pendingTextureTask)===null||S===void 0?void 0:S.hash)===A&&((R=s.panoMeshes.get(p))===null||R===void 0||R.setProgress(_))},this.renderer).then(function(_){var S,R;((S=s.pendingTextureTask)===null||S===void 0?void 0:S.hash)===A?(s.pendingTextureTask.onLoad(_),(R=s.panoMeshes.get(p))===null||R===void 0||R.setProgress(0),s.pendingTextureTask=void 0,s.emit("pano.texture.success",createEvent("pano.texture.success",{error:null,progress:1,meta:_.meta,pano:e}))):_.body.dispose()}).catch(function(_){var S,R;((S=s.pendingTextureTask)===null||S===void 0?void 0:S.hash)===A&&(s.pendingTextureTask.onError(_),(R=s.panoMeshes.get(p))===null||R===void 0||R.setProgress(0),s.pendingTextureTask=void 0,s.emit("pano.texture.error",createEvent("pano.texture.error",{error:_,progress:0,meta:null,pano:e})),s.emit("error",_))}),this.emit("pano.texture.load",createEvent("pano.texture.load",{error:null,progress:0,meta:null,pano:e}))},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(m){h=!0,e.perspToOrthoMotion.set(d,s).catch(noop),e.modelAlphaMotion.setKeyframes([{progress:0,value:__assign({},e.modelAlphaMotion.value)},{progress:.6,value:__assign({},e.modelAlphaMotion.value)},{progress:1,value:f}],s).catch(noop),e.emit("initAnimation.start",createEvent("initAnimation.start",{state:m,userAction:e.userAction}))},moveEndCallback:function(m){e.emit("initAnimation.end",createEvent("initAnimation.end",{state:m,userAction:e.userAction})),e.initAnimationed=!0,r()},moveCancelCallback:function(){var m=__assign(__assign(__assign({},p),{mode:e.mode}),clonePose(e.camera.pose));h===!1&&e.emit("initAnimation.start",createEvent("initAnimation.start",{state:m,userAction:e.userAction})),e.emit("initAnimation.end",createEvent("initAnimation.end",{state:m,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.doMoveToPano=function(e,r,o){var s=this,u,l,c,p,f,d,h,m,A,g,y;o===void 0&&(o={});var v=now(),E=createUuid();this.panoResources[E]=r;var b=1,T,_,S;if(this.locationMotion.ended){var R=this.locationMotion.getKeyFrameSegment(v);R[0];var w=R[1],M=this.locationMotion.value,B=((u=this.panoResourceFromLocationMotionKeyframe(w))!==null&&u!==void 0?u:this.camera).position,C=r.position;T=Math.max(B.distanceTo(C),b),_=[{key:w.key,progress:0,value:__assign(__assign({},M),{count:0})},{key:E,progress:1,value:{distance:0,count:1}}],S=0}else{var P=this.locationMotion.getKeyFrameSegment(v),L=P[0],w=P[1],M=this.locationMotion.value,O=this.panoResourceFromLocationMotionKeyframe(L).position,B=this.panoResourceFromLocationMotionKeyframe(w).position,C=r.position,F=w.value.count-M.count,N=Math.max(O.distanceTo(B),b)*F,D=Math.max(B.distanceTo(C),b);T=N+D,_=[{key:L.key,progress:0,value:__assign({},M)},{key:w.key,progress:N/T,value:w.value},{key:E,progress:1,value:{count:w.value.count+1,distance:0}}];var U=this.locationMotionKeyframesLength(this.locationMotion.keyframes),z=this.locationMotionKeyframesLength(_);U===0||U===0?S=0:S=this.locationMotion.getProgressVelocity(v)*U/z}var K=r.effect==="instant"?0:this.calculateMovingDuration(o.duration,r.effect==="fly"?T:0),j={longitude:o.longitude,latitude:o.latitude,fov:o.fov},Q=__assign(__assign({},e),{mode:this.mode,longitude:(l=j.longitude)!==null&&l!==void 0?l:this.camera.pose.longitude,latitude:(c=j.latitude)!==null&&c!==void 0?c:this.camera.pose.latitude,fov:(p=j.fov)!==null&&p!==void 0?p:this.camera.pose.fov,offset:r.position.clone(),distance:this.camera.pose.distance}),V=this.currentPano;if(this.emit("pano.moveTo",createEvent("pano.moveTo",{options:o,prevPano:V,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,this.videoTexture.needsUpdate=!0),this.panoVideo.setMaterial(null),r.effect==="fly")this.cameraMotion.set(j,K).catch(noop);else{var J=coordinatesToVector({longitude:this.cameraMotion.value.longitude,latitude:this.cameraMotion.value.latitude}),W=coordinatesToVector({longitude:(f=j.longitude)!==null&&f!==void 0?f:this.cameraMotion.value.longitude,latitude:(d=j.latitude)!==null&&d!==void 0?d:this.cameraMotion.value.latitude}),X=new THREE__namespace.Object3D;X.lookAt(J);var Z=new THREE__namespace.Matrix4().makeRotationFromQuaternion(X.quaternion);X.lookAt(W);var Y=new THREE__namespace.Matrix4().makeRotationFromQuaternion(X.quaternion),G=new THREE__namespace.Matrix4().getInverse(Z).premultiply(Y),ee=this.cameraMotion.value.fov,te=(h=j.fov)!==null&&h!==void 0?h:this.cameraMotion.value.fov,ne=1;r.effect==="zoomin"?ne=1.5:r.effect==="zoomout"&&(ne=.4);for(var ae=clamp$1(te*ne,1,170),ce=0;ce<_.length-1;ce++){var ie=_[ce].key;if(ie){var fe=this.panoResources[ie];fe&&(fe.fixCameraTransform.copy(G),fe.panoPicture&&(fe.panoPicture.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:(m=j.longitude)!==null&&m!==void 0?m:this.cameraMotion.value.longitude,latitude:(A=j.latitude)!==null&&A!==void 0?A:this.cameraMotion.value.latitude,fov:ae}},{progress:1,value:{longitude:(g=j.longitude)!==null&&g!==void 0?g:this.cameraMotion.value.longitude,latitude:(y=j.latitude)!==null&&y!==void 0?y:this.cameraMotion.value.latitude,fov:te}}],K).catch(noop)}var ge=this.locationMotion.setKeyframes(_,K,S);ge.then(function(){for(var ye=0,_e=s.modelScene.children;ye<_e.length;ye++){var le=_e[ye];le instanceof Model&&le.show()}var de=__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:V,progress:1,state:de,userAction:s.userAction,error:null})),o.moveEndCallback&&o.moveEndCallback(de);var re=s.works.getObserver(e);if(re&&re.video&&s.videoTexture&&s.videoTexture.image instanceof HTMLVideoElement){var se={map:s.videoTexture,size:re.video.size.clone(),matrix:re.video.matrix.clone(),panoMatrix:re.matrix.clone().premultiply(re.work.transform),alpha:1},he=createUuid(),me=s.videoTexture.image;me.setAttribute("uuid",he),me.oncanplay=noop,me.ontimeupdate=noop,canplayVideo().then(function(qe){qe&&re.video&&me.getAttribute("uuid")===he&&(me.oncanplay=function(){me.oncanplay=noop,me.play()},me.ontimeupdate=function(){me.currentTime>.5&&(me.ontimeupdate=noop,s.panoVideo.setMaterial(se))},me.src=re.video.source)}).catch((function(){me.removeAttribute("uuid")}))}else{var Ne=s.videoTexture.image;Ne.removeAttribute("uuid"),Ne.oncanplay=noop,Ne.ontimeupdate=noop}},function(){s.emit("pano.cancel",createEvent("pano.cancel",{options:o,prevPano:V,progress:0,state:Q,userAction:s.userAction,error:null})),o.moveCancelCallback&&o.moveCancelCallback()})},t.prototype.getForwardObserverOrNot=function(e,r){var o=this,s=this.works.getObserver(this.currentPano);if(!s)return null;var u=r!=null?r:new THREE__namespace.Raycaster(e.position.clone(),e.getWorldDirection(new THREE__namespace.Vector3));u.params.Points={threshold:.1},u.firstHitOnly=!0,u.floorIndex=-1;var l=s.standingPosition.clone().applyMatrix4(s.work.transform),c=s.position.clone().applyMatrix4(s.work.transform);if(c.distanceTo(u.ray.origin)>1){var p=new THREE__namespace.Raycaster(u.ray.origin,new THREE__namespace.Vector3(0,-1,0));p.firstHitOnly=u.firstHitOnly,p.floorIndex=u.floorIndex;var f=this.modelScene.intersectRaycaster(p)[0];f&&f.distance<=2?l.copy(f.point):l.copy(u.ray.origin).add(new THREE__namespace.Vector3(0,-1.5,0))}var d=this.modelScene.intersectRaycaster(u)[0],h=d?d.point:u.ray.origin.clone().add(u.ray.direction.clone().normalize().multiplyScalar(3)),m=h.clone().sub(l).normalize();if(m.length()===0)return null;var A=s.work.observers,g=s.accessibleNodes.filter(function(C){if(C===o.currentPano.panoIndex&&s.work.workCode===o.currentPano.workCode)return!1;var P=A[C];if(!P)return!1;var L=P.standingPosition.clone().applyMatrix4(P.work.transform).project(e);return Math.abs(L.z)>1||Math.abs(L.x)>1||Math.abs(L.y)>1?!1:P.loadable||P.active}),y=new Map,v=g.slice().sort(function(C,P){var L=A[C],O=y.get(L);typeof O=="undefined"&&(O=scratchVector3$3.copy(L.standingPosition).applyMatrix4(L.work.transform).distanceTo(l),y.set(L,O));var F=A[P],N=y.get(F);return typeof N=="undefined"&&(N=scratchVector3$3.copy(F.standingPosition).applyMatrix4(F.work.transform).distanceTo(l),y.set(F,N)),O-N});y.clear();for(var E=0,b=[Math.PI/8,Math.PI/6,Math.PI/4,Math.PI/3];E<b.length;E++)for(var T=b[E],_=0,S=v;_<S.length;_++){var R=S[_],w=A[R];if(w){var M=scratchVector3$3.copy(w.standingPosition).applyMatrix4(w.work.transform).sub(l);if(M&&M.length()!==0&&m.angleTo(M)<T)return w}}var B=arrayMin(g.map(function(C){return A[C]}),function(C){var P=scratchVector3$3.copy(C.position).applyMatrix4(C.work.transform);return u.ray.closestPointToPoint(P,new THREE__namespace.Vector3).distanceTo(P)});return B||null},t.prototype.onTapGesture=function(e){var r=this,o;if(this.userAction=e.userAction,this.stopMomentumMovement(),!!this.initAnimationed){var s=e.center.raycaster;s.floorIndex=-1;var u=this.camera.getDirection(new THREE__namespace.Vector3).setY(0),l=null,c=this.works.getObserver(this.currentPano);if(c){var p=c.work.observers,f=c.accessibleNodes.filter(function(V){if(V===r.currentPano.panoIndex&&c.work.workCode===r.currentPano.workCode)return!1;var J=p[V];if(!J)return!1;var W=scratchVector3$3.copy(J.position).applyMatrix4(J.work.transform);return W.distanceTo(r.camera.position)>r.maxAccessibleDistance?!1:J.loadable||J.active}),d=this.modelScene.intersectRaycaster(s)[0];if(d){var h=arrayMin(f,function(V){var J=p[V];if(!J)return 1/0;var W=scratchVector3$3.copy(J.standingPosition).applyMatrix4(J.work.transform);return W.distanceTo(d.point)},!0),m=h[0],A=h[1];typeof m=="number"&&A<this.panoTapTriggerRadius&&(l=(o=p[m])!==null&&o!==void 0?o:null)}if(l||(l=this.getForwardObserverOrNot(this.camera,s)),l&&l.panoId===panoStringify(this.currentPano)&&(l=null),l&&!this.locationMotion.ended)for(var g=0,y=this.locationMotion.keyframes;g<y.length;g++){var v=y[g],E=this.panoResourceFromLocationMotionKeyframe(v);if(E.panoId===l.panoId){l=null;break}}if(!l)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=l.position.clone().applyMatrix4(l.work.transform).setY(0).sub(c.position.clone().applyMatrix4(l.work.transform).setY(0)).normalize(),R=[],w=[],M=[],B=l.work.observers,C=0,P=l.accessibleNodes;C<P.length;C++){var m=P[C];if(l.panoIndex!==m&&!(m===this.currentPano.panoIndex&&l.work.workCode===this.currentPano.workCode)){var L=B[m];if(L){var O=L.position.clone().applyMatrix4(L.work.transform).sub(l.position.clone().applyMatrix4(l.work.transform)).setY(0).normalize();S.angleTo(O)<T&&M.push(O)}}}var F=M.length>0?M:__spreadArray(__spreadArray([],R,!0),w,!0),N=F.slice().sort(function(V,J){return V.angleTo(S)-J.angleTo(S)})[0];if(N&&N.angleTo(u)>_&&(b.longitude=Math.atan2(-N.x,-N.z)),this.cameraMotion.value.latitude<-Math.PI/4){var D=e.state.fov,U=clamp$1(typeof this.minLatitude=="function"?this.minLatitude(D):this.minLatitude,-Math.PI/2,Math.PI/2),z=clamp$1(typeof this.maxLatitude=="function"?this.maxLatitude(D):this.maxLatitude,-Math.PI/2,Math.PI/2);b.latitude=clamp$1(0,U,z)}var K=__assign({},e.state);if(K.workCode=l.work.workCode,K.panoIndex=l.panoIndex,b.longitude!==void 0&&(K.longitude=b.longitude),b.latitude!==void 0&&(K.latitude=b.latitude),b.fov!==void 0&&(K.fov=b.fov),K.distance=0,K.offset=l.position.clone(),e.state=K,this.emit("gesture.tap",e),!e.defaultPrevented){if(this.emit("pano.select",createEvent("pano.select",{prevPano:this.currentPano,state:K,userAction:e.userAction,options:b,progress:0,error:null})),l&&!l.active){var j=panoStringify({panoIndex:l.panoIndex,workCode:l.work.workCode}),Q=this.panoMeshes.get(j);Q&&(Q.setDisabled(!1),Q.setLoading(!0))}l&&l.active&&this.emit("pano.request",createEvent("pano.request",{userAction:e.userAction,prevPano:this.currentPano,progress:0,state:K,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,m=u*f,A=u*d,g=u*h,y=l*d,v=l*h,E=c*h,b=p*f,T=p*d,_=p*h;return r[0]=1-(y+E),r[1]=A+_,r[2]=g-T,r[3]=0,r[4]=A-_,r[5]=1-(m+E),r[6]=v+b,r[7]=0,r[8]=g+T,r[9]=v-b,r[10]=1-(m+y),r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function t(r,o,s){var u=s[0],l=s[1],c=s[2],p,f,d,h,m,A,g,y,v,E,b,T;return o===r?(r[12]=o[0]*u+o[4]*l+o[8]*c+o[12],r[13]=o[1]*u+o[5]*l+o[9]*c+o[13],r[14]=o[2]*u+o[6]*l+o[10]*c+o[14],r[15]=o[3]*u+o[7]*l+o[11]*c+o[15]):(p=o[0],f=o[1],d=o[2],h=o[3],m=o[4],A=o[5],g=o[6],y=o[7],v=o[8],E=o[9],b=o[10],T=o[11],r[0]=p,r[1]=f,r[2]=d,r[3]=h,r[4]=m,r[5]=A,r[6]=g,r[7]=y,r[8]=v,r[9]=E,r[10]=b,r[11]=T,r[12]=p*u+m*l+v*c+o[12],r[13]=f*u+A*l+E*c+o[13],r[14]=d*u+g*l+b*c+o[14],r[15]=h*u+y*l+T*c+o[15]),r}function e(r,o){var s=o[0],u=o[1],l=o[2],c=o[3],p=o[4],f=o[5],d=o[6],h=o[7],m=o[8],A=o[9],g=o[10],y=o[11],v=o[12],E=o[13],b=o[14],T=o[15],_=s*f-u*p,S=s*d-l*p,R=s*h-c*p,w=u*d-l*f,M=u*h-c*f,B=l*h-c*d,C=m*E-A*v,P=m*b-g*v,L=m*T-y*v,O=A*b-g*E,F=A*T-y*E,N=g*T-y*b,D=_*N-S*F+R*O+w*L-M*P+B*C;return D?(D=1/D,r[0]=(f*N-d*F+h*O)*D,r[1]=(l*F-u*N-c*O)*D,r[2]=(E*B-b*M+T*w)*D,r[3]=(g*M-A*B-y*w)*D,r[4]=(d*L-p*N-h*P)*D,r[5]=(s*N-l*L+c*P)*D,r[6]=(b*R-v*B-T*S)*D,r[7]=(m*B-g*R+y*S)*D,r[8]=(p*F-f*L+h*C)*D,r[9]=(u*L-s*F-c*C)*D,r[10]=(v*M-E*R+T*_)*D,r[11]=(A*R-m*M-y*_)*D,r[12]=(f*P-p*O-d*C)*D,r[13]=(s*O-u*P+l*C)*D,r[14]=(E*S-v*w-b*_)*D,r[15]=(m*w-A*S+g*_)*D,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)),m=new FieldOfView,A=new FieldOfView;return m.leftDegrees=Math.min(p,t.fov),m.rightDegrees=Math.min(f,t.fov),m.downDegrees=Math.min(d,t.fov),m.upDegrees=Math.min(h,t.fov),A.leftDegrees=m.rightDegrees,A.rightDegrees=m.leftDegrees,A.upDegrees=m.upDegrees,A.downDegrees=m.downDegrees,{left:m,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,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",phone="data:image/png;base64,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";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=`
1574
1574
  <style>
1575
1575
  .$id {
1576
1576
  all: initial;
@@ -1931,7 +1931,7 @@ void main() {
1931
1931
 
1932
1932
  gl_FragColor = vec4(gl_FragColor.rgb, gl_FragColor.a * opacity * outside * inside);
1933
1933
  }
1934
- `,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))},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)}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)}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):this.loadingMotion.set({opacity:0},0).catch(noop),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),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),r.helperElement=void 0},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()},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.updateTime=function(e,r){var o=this,s,u,l,c,p,f;if(!this.destroyed){this.updateHelperElementSize(),this.userAction=!0,this.needsRender=!0,this.modelSceneNeedsRender=!0;var d={},h={},m=this.locationMotion.keyframes[0],A=this.locationMotion.keyframes[this.locationMotion.keyframes.length-1],g=this.locationMotion.getKeyFrameSegment(e),y=g[0],v=g[1],E=this.panoResourceFromLocationMotionKeyframe(y),b=this.panoResourceFromLocationMotionKeyframe(v),T=this.panoResourceFromLocationMotionKeyframe(m),_=this.panoResourceFromLocationMotionKeyframe(A),S=!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 R=this.locationMotion.getKeyFrameSegment(e),w=R[0],M=R[1],B=this.panoResourceFromLocationMotionKeyframe(w),C=this.panoResourceFromLocationMotionKeyframe(M),P=B.position,L=C.position,O=this.locationMotion.value.count-M.value.count+1;if(d.progress=O,C.panoPicture&&(O<1?B.panoPicture&&(d.pano0=B.panoPicture):d.pano0=C.panoPicture,d.pano1=C.panoPicture),C.effect==="montage"?d.transition="BLACK":C.effect==="spread"?d.transition="SPREAD":d.transition="FADE",(C.effect==="zoomin"||C.effect==="zoomout")&&(d.progress=Math.pow(O,3)),O<1&&C.effect!=="fly"){if(d.pano0&&B.panoPicture){var F={panoId:d.pano0.panoId,map:d.pano0.map,mapSize:d.pano0.mapSize,zoom:d.pano0.zoom,matrix:B.panoPicture.matrix.clone().setPosition(C.position)},N=this.panoPictureObserverMap.get(d.pano0);N&&this.panoPictureObserverMap.set(F,N),d.pano0=F}P.copy(L),S=!0}h.distance=this.locationMotion.value.distance,h.offset=new THREE__namespace.Vector3(P.x+(L.x-P.x)*O,P.y+(L.y-P.y)*O,P.z+(L.z-P.z)*O);for(var D=[],U=[],z=0,G=this.locationMotion.keyframes;z<G.length;z++){var j=G[z],Q=j.key,V=j.progress;Q!==void 0&&(D.push(Q),V>this.locationMotion.progress&&U.push(Q))}for(var J=0,W=Object.keys(this.panoResources);J<W.length;J++){var X=W[J];if(!(U.indexOf(X)>=0)){var Z=this.panoResources[X];if(Z.panoPicture){var Y=Z.panoPicture.map;if(Y){if(Y===((s=d.pano0)===null||s===void 0?void 0:s.map)||Y===((u=d.pano1)===null||u===void 0?void 0:u.map))continue;Y.dispose(),Z.panoPicture=null}}D.indexOf(X)>=0||delete this.panoResources[X]}}this.currentPano=panoParse(C.panoId),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),h.offset&&this.camera.position.copy(h.offset);var K=this.camera.pose.longitude,ee=this.camera.pose.latitude;this.camera.quaternion.fromArray(this.cardboard.sensor.getOrientation()),this.camera.computePose(),(K!==this.camera.pose.longitude||ee!==this.camera.pose.latitude)&&(this.cameraMotion.set(pick(this.camera.pose,["longitude","latitude"]),0).catch(noop),this.emit("camera.update",createEvent("camera.update",{userAction:!0,state:__assign(__assign(__assign({},this.currentPano),{mode:this.mode}),clonePose(this.camera.pose))}))),this.works.getObserver(this.currentPano);var te=this.works.getObserver(E.panoId),re=this.works.getObserver(b.panoId),ae=new Map;if(te)for(var ce=0,ie=te.accessibleNodes;ce<ie.length;ce++){var fe=ie[ce],N=te.work.observers[fe];if(N){var ge=panoStringify({panoIndex:N.panoIndex,workCode:N.work.workCode});ae.set(ge,N)}}if(re)for(var ye=0,_e=re.accessibleNodes;ye<_e.length;ye++){var fe=_e[ye],N=re.work.observers[fe];if(N){var ge=panoStringify({panoIndex:N.panoIndex,workCode:N.work.workCode});ae.set(ge,N)}}if(this.panoMeshes.forEach(function(Ee,we){var Pe=ae.get(we);Pe?(Ee.position.copy(Pe.position).applyMatrix4(Pe.work.transform),ae.delete(we)):(o.helper.remove(Ee),Ee.dispose(),o.panoMeshes.delete(we))}),ae.forEach(function(Ee,we){var Pe=new PanoSphereMesh;Pe.position.copy(Ee.position).applyMatrix4(Ee.work.transform),o.panoMeshes.set(we,Pe),o.helper.add(Pe),ae.delete(we)}),this.camera.pose.distance>.1||S?this.panoMeshes.forEach(function(Ee,we){Ee.setOpacity(0),Ee.updateTime&&Ee.updateTime(e,r),Ee.visible=!1}):this.panoMeshes.forEach(function(Ee,we){var Pe=panoParse(we),je=o.works.getObserver(Pe);if(je){if(!je.loadable&&!je.active){Ee.setOpacity(0);return}var Qe=Ee.position.clone().setY(o.camera.position.y).distanceTo(o.camera.position);Qe<.05?Ee.setOpacity(0):Ee.setOpacity(clamp$1(1.5/Qe,0,1)),panoEqual(o.currentPano,Pe)&&Ee.setOpacity(0),Ee.lookAt(o.camera.position)}}),this.locationMotion.ended){var le=this.intersect(e);this.panoMeshes.forEach(function(Ee,we){Ee.setCurrent(Ee===le),Ee.updateTime&&Ee.updateTime(e,r)})}{var O=(l=this.modelScene.parameter.progress)!==null&&l!==void 0?l:1,de=Math.round(O),ne=this.modelScene.parameter.pano0,se=this.modelScene.parameter.pano1,he=de===0?ne:se,N=void 0;if(he&&(N=this.works.getObserver(he.panoId),N||(N=this.panoPictureObserverMap.get(he))),this.tiling.appearDuration=this.tileAppearDuration,this.tiling.maxRequest=O<.6?0:this.tileMaxRequest,this.tiling.imageOptions=this.imageOptions,!N||!he||this.tileLevelForFov===!1||this.camera.perspToOrtho.x>0){this.tiling.setObserver(null);var me={renderer:this.renderer,resolution:this.camera.resolution,pixelRatio:this.camera.pixelRatio,time:this.camera.time,cameraMatrix:this.camera.matrixWorld,cameraProjectionMatrix:this.camera.projectionMatrix,panoMap:null,panoMatrix:new THREE__namespace.Matrix4,panoZoom:1,minLevel:0,level:0};this.tiling.update(me),this.modelScene.parameter.set("refinedScreen",null)}else{var Ne=getImageSizeLevel(he.mapSize),qe=Ne+1,Ye=new THREE__namespace.Vector2().copy(this.camera.resolution).multiplyScalar(this.camera.pixelRatio),Ve=Math.floor(this.tileLevelForFov(this.camera.fov,Ye)),ve=Ve>Ne?Ve:0;this.tiling.setObserver(N);var me={renderer:this.renderer,resolution:this.camera.resolution,pixelRatio:this.camera.pixelRatio,time:this.camera.time,cameraMatrix:this.camera.matrixWorld,cameraProjectionMatrix:this.camera.projectionMatrix,panoMap:he.map,panoMatrix:he.matrix,panoZoom:he.zoom,minLevel:qe,level:ve},Ke=this.tiling.update(me),Te={map:this.tiling.renderTarget.texture,matrixInverse:this.tiling.camera.matrixWorldInverse,projectionMatrix:this.tiling.camera.projectionMatrix,pano:de,opacity:(ne==null?void 0:ne.panoId)===(se==null?void 0:se.panoId)?1:easeInQuart(Math.abs(((c=this.modelScene.parameter.progress)!==null&&c!==void 0?c:0)-.5)*2)},Le=this.modelScene.parameter.refinedScreen;(Ke||Te.pano!==(Le==null?void 0:Le.pano)||Te.opacity!==(Le==null?void 0:Le.opacity))&&this.modelScene.parameter.set("refinedScreen",Te)}}this.panoVideo.object.position.copy(this.camera.position),this.panoVideo.updateTime(e);{var Me=b.effect,$e=this.modelScene.parameter,ne=$e.pano0,se=$e.pano1;if(ne&&se&&ne!==se&&Me==="fly"&&this.flyEffectUseDepthBuffer){if(((p=this.modelScene.parameter.pano0Depth)===null||p===void 0?void 0:p.panoId)!==ne.panoId||((f=this.modelScene.parameter.pano1Depth)===null||f===void 0?void 0:f.panoId)!==se.panoId){var tt=500,ke=512;this.pano0DepthCubeRenderTarget?this.pano0DepthCubeRenderTarget.width!==ke&&this.pano0DepthCubeRenderTarget.setSize(ke,ke):this.pano0DepthCubeRenderTarget=new THREE__namespace.WebGLCubeRenderTarget(ke,{minFilter:THREE__namespace.NearestFilter,magFilter:THREE__namespace.NearestFilter,generateMipmaps:!1}),this.pano1DepthCubeRenderTarget?this.pano1DepthCubeRenderTarget.width!==ke&&this.pano1DepthCubeRenderTarget.setSize(ke,ke):this.pano1DepthCubeRenderTarget=new THREE__namespace.WebGLCubeRenderTarget(ke,{minFilter:THREE__namespace.NearestFilter,magFilter:THREE__namespace.NearestFilter,generateMipmaps:!1});var Ie=new THREE__namespace.CubeCamera(this.camera.near,this.camera.far,this.pano0DepthCubeRenderTarget);Ie.matrix.copy(ne.matrix),Ie.matrixWorld.copy(Ie.matrix),Ie.matrixAutoUpdate=!1,renderDepthCube(this.renderer,this.modelScene,Ie,tt);var He=new THREE__namespace.CubeCamera(this.camera.near,this.camera.far,this.pano1DepthCubeRenderTarget);He.matrix.copy(se.matrix),He.matrixWorld.copy(He.matrix),He.matrixAutoUpdate=!1,renderDepthCube(this.renderer,this.modelScene,He,tt),this.modelScene.parameter.set({pano0Depth:{panoId:ne.panoId,map:this.pano0DepthCubeRenderTarget.texture,mapSize:this.pano0DepthCubeRenderTarget.width,maxDepth:tt},pano1Depth:{panoId:se.panoId,map:this.pano1DepthCubeRenderTarget.texture,mapSize:this.pano1DepthCubeRenderTarget.width,maxDepth:tt}})}}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.renderer.setScissorTest(!1),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,this.activePanoMesh=void 0,this.activeTime=void 0;return}if(this.activePanoMesh&&this.activeTime&&e-this.activeTime>ACTIVE_TO_CURRENT_DELAY){var s=this.activePanoMesh,u=null;return this.panoMeshes.forEach(function(w,M){w===s&&(u=M)}),u!==null&&this.moveToPano(panoParse(u),{},!0),this.activePanoMesh=void 0,this.activeTime=void 0,s}var l=this.camera.getDirection(new THREE__namespace.Vector3),c=new THREE__namespace.Raycaster(this.camera.position,l);c.params.Points={threshold:.1},c.firstHitOnly=!0,c.floorIndex=-1;for(var p=void 0,f=[],d=this.works.getObserver(this.currentPano),h=d?d.accessibleNodes.map(function(w){return panoStringify({panoIndex:w,workCode:d.work.workCode})}):[],m=0,A=h;m<A.length;m++){var g=A[m],y=this.panoMeshes.get(g);if(y){var v=c.intersectObject((r=y.hitTestMesh)!==null&&r!==void 0?r:y,!0)[0];if(v){var E=(o=d==null?void 0:d.floorIndex)!==null&&o!==void 0?o:0;f.push({panoMesh:y,intersection:__assign({floorIndex:E,floor:E},v)})}}}var b=f.sort(function(w,M){return w.intersection.distance-M.intersection.distance})[0];b?(p=b.intersection,this.activePanoMesh!==b.panoMesh&&(this.activePanoMesh=b.panoMesh,this.activeTime=e),this.intersectMesh.position.copy(b.panoMesh.position),this.intersectMesh.lookAt(this.camera.position)):(this.activePanoMesh=void 0,this.activeTime=void 0),p||(p=this.modelScene.intersectRaycaster(c)[0]);var T=createEvent("intersect.update",{raycaster:c,intersection:p!=null?p:null,object:this.intersectMesh});if(this.emit("intersect.update",T),T.defaultPrevented){this.hideIntersectMesh();return}if(p&&p.face){var _=p.face.normal,S=new THREE__namespace.Quaternion;S.setFromUnitVectors(new THREE__namespace.Vector3(0,0,1),_),this.intersectMesh.quaternion.copy(S);var R=p.point.clone();this.intersectMesh.position.copy(R),b?this.intersectMesh.visible=!1:this.intersectMesh.visible=!0}else this.intersectMesh.visible=!1;return b==null?void 0:b.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),scratchObserverBox$1=new THREE__namespace.Box3,scratchVector3$2=new THREE__namespace.Vector3,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,m=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:m.workCode,panoIndex:m.panoIndex},g=f.getObserver(A),y=clamp$1((u=h.fov)!==null&&u!==void 0?u:!g||isFristPersonMode(m.mode)?m.fov:p.defaultFov,p.minFov,p.maxFov),v=(l=h.longitude)!==null&&l!==void 0?l:m.longitude,E=clamp$1(typeof p.minLatitude=="function"?p.minLatitude(y):p.minLatitude,-Math.PI/2,Math.PI/2),b=clamp$1(typeof p.maxLatitude=="function"?p.maxLatitude(y):p.maxLatitude,-Math.PI/2,Math.PI/2),T=clamp$1((c=h.latitude)!==null&&c!==void 0?c:!g||isFristPersonMode(m.mode)?m.latitude:p.defaultLatitude,E,b),_=new THREE__namespace.Vector3;if(p.initial.state.offset)_.copy(p.initial.state.offset);else if(g)_.copy(g.position).applyMatrix4(g.work.transform);else{var S=coordinatesToVector(m).setLength(m.distance);_.copy(p.initial.currentState.offset).sub(S)}return{workCode:A.workCode,panoIndex:A.panoIndex,mode:"Model",longitude:v,latitude:T,fov:y,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),s.cameraMotion.set(l,r).catch(noop)})},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),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.modelScene.parameter.modelAlpha===0&&this.modelScene.parameter.progress!==1){var u=this.modelScene.parameter,l=u.pano0,c=u.pano1;l&&l.map!==(c==null?void 0:c.map)&&l.map.dispose(),o.progress=1,o.pano0=o.pano1=c}if(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);for(var p=new THREE__namespace.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z),f=[],d=function(_){var S=h.modelScene.models.find(function(B){return B.work===_});if(!S||S.visible===!1||_.observers.length<=0)return"continue";if(scratchObserverBox$1.copy(_.observerBox).expandByScalar(10).applyMatrix4(_.transform),scratchObserverBox$1.containsPoint(p))for(var R=0,w=_.observers;R<w.length;R++){var M=w[R];f.push(M)}},h=this,m=0,A=this.works;m<A.length;m++){var g=A[m];d(g)}var y=arrayMin(f,function(_){return scratchVector3$2.copy(_.position).applyMatrix4(_.work.transform).distanceTo(p)});this.currentPano=y?{workCode:y.work.workCode,panoIndex:y.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);var v=this.works.getObserver(this.currentPano);if(this.intersectMesh&&this.intersectMesh.parent&&v&&v.position.y-v.standingPosition.y>10){var E=this.camera.position.distanceTo(this.intersectMesh.position),b=2*Math.tan(.5*this.camera.fov/180*Math.PI),T=E*b/5;this.intersectMesh.scale.setScalar(T)}else this.intersectMesh.scale.setScalar(1)}},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),e.modelAlphaMotion.set(c,s).catch(noop),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.getObserver(e);if(s){var u=new THREE__namespace.Vector3().copy(s.position).applyMatrix4(s.work.transform);this.moveToPosition(u,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),m=0,A=1;A<this.locationMotion.keyframes.length;A++){var g=this.locationMotion.keyframes[A-1].value,y=g.x,v=g.y,E=g.z,b=this.locationMotion.keyframes[A].value,T=b.x,_=b.y,S=b.z;m+=Math.sqrt(Math.pow(T-y,2)+Math.pow(_-v,2)+Math.pow(S-E,2))}for(var R=d===0?0:h*m/d,w=this.calculateMovingDuration(r.duration,d),M={x:e.x,y:e.y,z:e.z,distance:0},B={longitude:r.longitude,latitude:r.latitude,fov:r.fov},C=[],P=function(j){var Q=L.modelScene.models.find(function(X){return X.work===j});if(!Q||Q.visible===!1||j.observers.length<=0)return"continue";if(scratchObserverBox$1.copy(j.observerBox).expandByScalar(10).applyMatrix4(j.transform),scratchObserverBox$1.containsPoint(f))for(var V=0,J=j.observers;V<J.length;V++){var W=J[V];C.push(W)}},L=this,O=0,F=this.works;O<F.length;O++){var N=F[O];P(N)}var D=arrayMin(C,function(j){return scratchVector3$2.copy(j.position).applyMatrix4(j.work.transform).distanceTo(f)}),U=D?{workCode:D.work.workCode,panoIndex:D.panoIndex}:{workCode:"",panoIndex:0},z=__assign(__assign({},U),{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}),G=this.currentPano;this.emit("pano.moveTo",createEvent("pano.moveTo",{options:r,prevPano:G,progress:0,state:z,userAction:this.userAction,error:null})),r.moveStartCallback&&r.moveStartCallback(z),this.cameraMotion.set(B,w).catch(noop),this.locationMotion.set(M,w,R).then(function(){for(var j=0,Q=s.modelScene.children;j<Q.length;j++){var V=Q[j];V instanceof Model&&V.show()}var J=__assign(__assign(__assign({},U),{mode:s.mode}),clonePose(s.camera.pose));s.emit("pano.arrived",createEvent("pano.arrived",{options:r,prevPano:G,progress:0,state:J,userAction:s.userAction,error:null})),r.moveEndCallback&&r.moveEndCallback(J)},function(){r.moveCancelCallback&&r.moveCancelCallback(),s.emit("pano.cancel",createEvent("pano.cancel",{options:r,prevPano:G,progress:0,state:z,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=new THREE__namespace.Raycaster;l.firstHitOnly=!0;var c=s.clone().setLength(.3).add(u);l.set(c,new THREE__namespace.Vector3(0,-1,0)),o=this.modelScene.intersectRaycaster(l)[0]}}if(o){for(var p=new THREE__namespace.Vector3().copy(o.point).add(HUMAN_EYE_POSITION),f=[],d=function(T){var _=h.modelScene.models.find(function(M){return M.work===T});if(!_||_.visible===!1||T.observers.length<=0)return"continue";if(scratchObserverBox$1.copy(T.observerBox).expandByScalar(10).applyMatrix4(T.transform),scratchObserverBox$1.containsPoint(p))for(var S=0,R=T.observers;S<R.length;S++){var w=R[S];f.push(w)}},h=this,m=0,A=this.works;m<A.length;m++){var g=A[m];d(g)}var y=arrayMin(f,function(T){return scratchVector3$2.copy(T.position).applyMatrix4(T.work.transform).distanceTo(p)},!0),v=y[0],E=y[1];if(v&&E<5){var b=scratchVector3$2.copy(v.position).applyMatrix4(v.work.transform);p.y=b.y}e.state.offset.copy(p),e.state.distance=0,this.emit("gesture.tap",e),e.defaultPrevented||this.moveToPosition(p,{},!0)}else this.emit("gesture.tap",e),e.defaultPrevented||this.cameraBounce()},t})(PanoramaLikeController),scratchObserverBox=new THREE__namespace.Box3,scratchVector3$1=new THREE__namespace.Vector3,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.pendingTextureId=null,r.textureLoader=new TextureLoader,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),{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,m=e.initial,A=m.state,g=m.currentState,y=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:g.workCode,panoIndex:g.panoIndex},v=(u=A.fov)!==null&&u!==void 0?u:60,E=clamp$1(typeof f.minLatitude=="function"?f.minLatitude(v):f.minLatitude,-Math.PI/2,Math.PI/2),b=clamp$1(typeof f.maxLatitude=="function"?f.maxLatitude(v):f.maxLatitude,-Math.PI/2,Math.PI/2),T=clamp$1((l=A.latitude)!==null&&l!==void 0?l:isThirdPersonMode(g.mode)?g.latitude:f.defaultLatitude,E,b),_=t.distanceFromModel(f.modelScene,v,f.camera.aspect),S=new THREE__namespace.Vector3,R=(c=A.distance)!==null&&c!==void 0?c:Math.min(f.defaultDistance,_),w=(p=A.longitude)!==null&&p!==void 0?p:isThirdPersonMode(g.mode)?g.longitude:f.defaultLongitude;if(A.offset)S.copy(A.offset);else{var M=d.getObserver(y);f.defaultDistance<_&&M?(S.copy(M.position).applyMatrix4(M.work.transform),A.longitude===void 0&&(w=g.longitude)):(h.boundingBox.getCenter(S),R=_)}return __assign(__assign({},y),{mode:"Mapview",longitude:w,latitude:T,fov:v,offset:S,distance:R})},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.pendingTextureId=null,this.locationMotion.dispose(),this.panState=void 0,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),this.cameraMotion.set(l,o.duration).catch(noop),!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),s.cameraMotion.set(l,r).catch(noop)})},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),s.cameraMotion.setKeyframes(e,r)})},t.prototype.updateTime=function(e,r){if(!this.destroyed){var o={},s={};if(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),this.modelScene.parameter.modelAlpha===0&&this.modelScene.parameter.progress!==1){var u=this.modelScene.parameter,l=u.pano0,c=u.pano1;l&&l.map!==(c==null?void 0:c.map)&&l.map.dispose(),o.progress=1,o.pano0=o.pano1=c}var p=0;if(this.cameraType==="auto"?p=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"?p=0:this.cameraType==="orthographic"&&(p=1),this.perspToOrthoMotion.getTargetKeyframe().value.perspToOrtho!==p&&this.perspToOrthoMotion.set({perspToOrtho:p},500).catch(noop),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 f=coordinatesToVector(this.camera.pose,new THREE__namespace.Vector3),d=new THREE__namespace.Vector3().copy(this.camera.pose.offset).sub(f.clone().multiplyScalar(this.camera.pose.distance));if(this.cameraFence.distanceToPoint(d)>.01){var h=this.cameraFence.clampPoint(d,new THREE__namespace.Vector3),m=this.camera.pose.offset.clone().add(h).sub(d),A=__assign(__assign({},this.currentPano),{mode:this.mode,longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude,fov:this.camera.pose.fov,offset:m,distance:this.camera.pose.distance});this.fixFinalState(A),this.locationMotion.set({x:A.offset.x,y:A.offset.y,z:A.offset.z,distance:A.distance},300).catch(noop)}}if(this.intersectMesh&&this.intersectMesh.parent){var g=this.camera.position.distanceTo(this.intersectMesh.position),y=2*Math.tan(.5*this.camera.fov/180*Math.PI),v=g*y/5;this.intersectMesh.scale.setScalar(v)}else this.intersectMesh.scale.setScalar(1)}},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),e.modelAlphaMotion.set(f,s/3).catch(noop),e.cameraMotion.set(c,s).catch(noop),e.locationMotion.set(p,s).then(function(){e.emit("initAnimation.end",createEvent("initAnimation.end",{state:l,userAction:e.userAction}))},function(h){var m=__assign(__assign(__assign({},e.currentPano),{mode:e.mode}),clonePose(e.camera.pose));e.emit("initAnimation.end",createEvent("initAnimation.end",{state:m,userAction:e.userAction}))}).then(function(){r()})})},t.prototype.getForwardObserverOrNot=function(e){var r=this.modelScene.intersectRaycaster(e)[0];if(!r)return null;for(var o=[],s=function(m){var A=u.modelScene.models.find(function(E){return E.work===m});if(!A||A.visible===!1||m.observers.length<=0)return"continue";if(scratchObserverBox.copy(m.observerBox).expandByScalar(10).applyMatrix4(m.transform),scratchObserverBox.containsPoint(e.ray.origin)||e.ray.intersectsBox(scratchObserverBox))for(var g=0,y=m.observers;g<y.length;g++){var v=y[g];o.push(v)}},u=this,l=0,c=this.works;l<c.length;l++){var p=c[l];s(p)}var f=arrayMin(o,function(m){return scratchVector3$1.copy(m.standingPosition).applyMatrix4(m.work.transform).distanceTo(r.point)},!0),d=f[0],h=f[1];return d&&h<Math.max(d.standingPosition.distanceTo(this.camera.position)/5,10)?d: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){s=Math.max(s,1);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$1(this.cameraMotion.value.longitude+c.longitude),h=clamp$1(typeof this.minLatitude=="function"?this.minLatitude(f):this.minLatitude,-Math.PI/2,Math.PI/2),m=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,m),g=new THREE__namespace.Vector3(this.locationMotion.value.x+c.x,this.locationMotion.value.y+c.y,this.locationMotion.value.z+c.z),y=__assign(__assign({},this.currentPano),{mode:this.mode,longitude:d,latitude:A,offset:g,fov:f,distance:this.locationMotion.value.distance}),v=e.state.offset.clone().sub(coordinatesToVector(e.state).setLength(y.distance)),E=!(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&&(E=!0);var T=createEvent("gesture.momentum",__assign(__assign({},e),{isFirst:r,isFinal:E,state:y}));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),this.locationMotion.set({x:y.offset.x,y:y.offset.y,z:y.offset.z,distance:y.distance},0).catch(noop),E?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.firstHitOnly=!0,s.near=this.camera.near,s.far=this.camera.far;var u;if(u=this.modelScene.intersectRaycaster(s).filter(function(d){var h,m=(h=d.face)===null||h===void 0?void 0:h.normal;return m&&s.ray.direction.dot(m)>=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,floorIndex:0,floor:0,point:c,object:this.scene,face:null})}}if(!u){var f=Math.max(e.distance,3);u={distance:f,floorIndex:0,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=this.createRaycasterFromCamera(c,this.camera);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 m=h.distanceTo(p.ray.origin);m<1e4&&m>=p.near&&(f={distance:m,floorIndex:0,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?this.panState=void 0:this.panState={target:l,buttons:s,pointerLength:r,x:e.center.x,y:e.center.y},!(typeof o=="undefined"||o.pointerLength!==r)){var g=r>1||s===2||u;if(g){var y={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),E=coordinatesToVector(this.cameraMotion.value).setLength(this.locationMotion.value.distance).add(v),b=new THREE__namespace.Vector3().copy(E).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*y.x*b/T.y,S=2*y.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 w=__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=w,this.emit("gesture.pan",e),e.defaultPrevented)return;if(this.locationMotion.set({x:w.offset.x,y:w.offset.y,z:w.offset.z},0).catch(noop),e.isFinal&&(this.fixFinalState(w),Object.assign(e,{__fixFinalState:!0}),this.locationMotion.set({distance:w.distance,x:w.offset.x,y:w.offset.y,z:w.offset.z},0).catch(noop)),e.isFinal){var M=this.renderer.getSize(new THREE__namespace.Vector2),B=2*e.velocityX*b/M.y,C=2*e.velocityY*b/M.y,P=new THREE__namespace.Vector3,L=new THREE__namespace.Vector3;P.setFromMatrixColumn(this.camera.matrix,0),P.multiplyScalar(-B),L.add(P),this.camera.pose.latitude<PANGESTURE_FORWARD_ANGLE?P.setFromMatrixColumn(this.camera.matrix,1):(P.setFromMatrixColumn(this.camera.matrix,0),P.crossVectors(this.camera.up,P)),P.multiplyScalar(C),L.add(P),this.inMomentumMovement={uuid:createUuid()},this.requestMomentumMovement(e,!0,{longitude:0,latitude:0,x:L.x,y:L.y,z:L.z},0)}}else{var y={x:e.center.x-o.x,y:e.center.y-o.y},O=this.coordinatesForOffset(y),F=formatRad$1(this.cameraMotion.value.longitude+O.longitude),N=this.camera.pose.fov,D=clamp$1(typeof this.minLatitude=="function"?this.minLatitude(N):this.minLatitude,-Math.PI/2,Math.PI/2),U=clamp$1(typeof this.maxLatitude=="function"?this.maxLatitude(N):this.maxLatitude,-Math.PI/2,Math.PI/2),z=clamp$1(this.cameraMotion.value.latitude+O.latitude,D,U);this.camera.aspect<1&&Math.abs(e.overallVelocityX)>.2&&Math.atan2(Math.abs(e.overallVelocityY),Math.abs(e.overallVelocityX))<Math.PI/6.923&&(z=this.cameraMotion.value.latitude);var w=__assign(__assign({},this.currentPano),{mode:this.mode,longitude:F,latitude:z,fov:N,offset:this.camera.pose.offset,distance:this.camera.pose.distance});if(e.isFinal&&Object.assign(e,{__fixFinalState:!0}),e.state=w,this.emit("gesture.pan",e),e.defaultPrevented)return;if(e.isFinal?this.locationMotion.set({distance:w.distance,x:w.offset.x,y:w.offset.y,z:w.offset.z},0).catch(noop):this.cameraMotion.set({longitude:w.longitude,latitude:w.latitude},0).catch(noop),e.isFinal){var G=e.velocityX,j=e.velocityY;this.inMomentumMovement={uuid:createUuid()},this.requestMomentumMovement(e,!0,__assign(__assign({},this.coordinatesForOffset({x:G,y:j})),{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),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)}this.panState=void 0,this.pinchState=void 0}}}},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(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)}else{var s=t.distanceFromModel(this.modelScene,this.cameraMotion.value.fov,this.camera.aspect),u=Math.max(this.locationMotion.value.distance-this.camera.near,0),l=e.center.delta/10*Math.max(u/5,.1);if(u<=s||l>0)if(this.locationMotion.value.distance-l>=minDistance){var c=this.locationMotion.value.distance-l;e.state.distance=c}else{var p=coordinatesToVector(this.cameraMotion.value);p.setLength(l),e.state.offset.add(p)}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)}},t.prototype.onTapGesture=function(e){var r=this,o;this.userAction=e.userAction,this.stopMomentumMovement();var s=e.center.raycaster,u=this.getForwardObserverOrNot(s);if(!u)this.emit("gesture.tap",e);else{var l={longitude:this.camera.pose.longitude,latitude:0},c=__assign(__assign({},e.state),{mode:"Panorama",workCode:u.work.workCode,panoIndex:u.panoIndex,longitude:l.longitude,latitude:l.latitude,offset:u?u.position.clone():new THREE__namespace.Vector3,distance:0});if(e.state=c,this.emit("gesture.tap",e),!e.defaultPrevented&&(this.emit("pano.select",createEvent("pano.select",{prevPano:this.currentPano,state:c,userAction:e.userAction,options:l,progress:0,error:null})),u&&u.active)){var p=this.pendingTextureId=createUuid(),f={panoIndex:u.panoIndex,workCode:u.work.workCode},d=panoStringify(f),h={right:u.images.work.getURL(u.images.right),left:u.images.work.getURL(u.images.left),up:u.images.work.getURL(u.images.up),down:u.images.work.getURL(u.images.down),front:u.images.work.getURL(u.images.front),back:u.images.work.getURL(u.images.back)},m=this.imageOptions.transform,A=__assign({key:"pano.".concat(d)},pick(this.imageOptions,["format","size","quality","sharpen","forceUseExifOrientation","mappings"])),g="pano:"+jsonHash([h,A,m]),y=this.modelScene.parameter,v=void 0;y.pano0&&y.pano0.map.name===g?v=y.pano0:y.pano1&&y.pano1.map.name===g&&(v=y.pano1),v?(y.pano0&&y.pano0.map!==v.map&&y.pano0.map.dispose(),y.pano1&&y.pano1.map!==v.map&&y.pano1.map!==((o=y.pano0)===null||o===void 0?void 0:o.map)&&y.pano1.map.dispose(),y.set({pano0:v,pano1:v}),this.emit("pano.request",createEvent("pano.request",{userAction:!0,prevPano:this.currentPano,progress:0,state:c,options:l,error:null}))):this.textureLoader.loadCubeTexture(h,{imageURL:{transform:m,options:A},format:THREE__namespace.RGBAFormat,viaAjax:!0,fetcher:getFetcher(u.work)},void 0,void 0,void 0,this.renderer).then(function(E){var b,T,_=E.body;if(r.destroyed||r.pendingTextureId!==p){_.dispose();return}r.pendingTextureId=null,_.name=g;var S=Array.isArray(_.image)?_.image[0]:_.image,R=(b=S==null?void 0:S.width)!==null&&b!==void 0?b:2048,w={panoId:d,map:_,mapSize:R,matrix:u.matrix.clone().premultiply(u.work.transform),zoom:1};y.pano0&&y.pano0.map.dispose(),y.pano1&&y.pano1.map!==((T=y.pano0)===null||T===void 0?void 0:T.map)&&y.pano1.map.dispose(),y.set({pano0:w,pano1:w}),r.emit("pano.request",createEvent("pano.request",{userAction:!0,prevPano:r.currentPano,progress:0,state:c,options:l,error:null}))}).catch(function(E){r.destroyed||r.pendingTextureId!==p||(r.pendingTextureId=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),this.hideIntersectMesh()}}},t.prototype.hideIntersectMesh=function(){this.intersectMesh.visible===!0&&(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],m=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 g=p.joints[h.jointName];m!==null&&(g.matrix.fromArray(m.transform.matrix),g.matrix.decompose(g.position,g.rotation,g.scale),g.jointRadius=m.radius),g.visible=m!==null}var y=p.joints["index-finger-tip"],v=p.joints["thumb-tip"],E=y.position.distanceTo(v.position),b=.02,T=.005;p.inputState.pinching&&E>b+T?(p.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!p.inputState.pinching&&E<=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,this.onSessionEndCallback=(c=r==null?void 0:r.onSessionEnd)!==null&&c!==void 0?c:noop,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.cameraVR.cameras.push(this.cameraL,this.cameraR),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],m=l*d,A=l*h,g=o/(-d+h),y=g*-d;e.matrixWorld.decompose(t.position,t.quaternion,t.scale),t.translateX(y),t.translateZ(g),t.matrixWorld.compose(t.position,t.quaternion,t.scale),t.matrixWorldInverse.getInverse(t.matrixWorld);var v=l+g,E=c+g,b=m-y,T=A+(o-y),_=p*c/E*v,S=f*c/E*v;t.projectionMatrix.makePerspective(b,T,_,S,v,E)},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:`
1934
+ `,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))},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)}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)}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):this.loadingMotion.set({opacity:0},0).catch(noop),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),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),r.helperElement=void 0},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()},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.updateTime=function(e,r){var o=this,s,u,l,c,p,f;if(!this.destroyed){this.updateHelperElementSize(),this.userAction=!0,this.needsRender=!0,this.modelSceneNeedsRender=!0;var d={},h={},m=this.locationMotion.keyframes[0],A=this.locationMotion.keyframes[this.locationMotion.keyframes.length-1],g=this.locationMotion.getKeyFrameSegment(e),y=g[0],v=g[1],E=this.panoResourceFromLocationMotionKeyframe(y),b=this.panoResourceFromLocationMotionKeyframe(v),T=this.panoResourceFromLocationMotionKeyframe(m),_=this.panoResourceFromLocationMotionKeyframe(A),S=!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 R=this.locationMotion.getKeyFrameSegment(e),w=R[0],M=R[1],B=this.panoResourceFromLocationMotionKeyframe(w),C=this.panoResourceFromLocationMotionKeyframe(M),P=B.position,L=C.position,O=this.locationMotion.value.count-M.value.count+1;if(d.progress=O,C.panoPicture&&(O<1?B.panoPicture&&(d.pano0=B.panoPicture):d.pano0=C.panoPicture,d.pano1=C.panoPicture),C.effect==="montage"?d.transition="BLACK":C.effect==="spread"?d.transition="SPREAD":d.transition="FADE",(C.effect==="zoomin"||C.effect==="zoomout")&&(d.progress=Math.pow(O,3)),O<1&&C.effect!=="fly"){if(d.pano0&&B.panoPicture){var F={panoId:d.pano0.panoId,map:d.pano0.map,mapSize:d.pano0.mapSize,zoom:d.pano0.zoom,matrix:B.panoPicture.matrix.clone().setPosition(C.position)},N=this.panoPictureObserverMap.get(d.pano0);N&&this.panoPictureObserverMap.set(F,N),d.pano0=F}P.copy(L),S=!0}h.distance=this.locationMotion.value.distance,h.offset=new THREE__namespace.Vector3(P.x+(L.x-P.x)*O,P.y+(L.y-P.y)*O,P.z+(L.z-P.z)*O);for(var D=[],U=[],z=0,K=this.locationMotion.keyframes;z<K.length;z++){var j=K[z],Q=j.key,V=j.progress;Q!==void 0&&(D.push(Q),V>this.locationMotion.progress&&U.push(Q))}for(var J=0,W=Object.keys(this.panoResources);J<W.length;J++){var X=W[J];if(!(U.indexOf(X)>=0)){var Z=this.panoResources[X];if(Z.panoPicture){var Y=Z.panoPicture.map;if(Y){if(Y===((s=d.pano0)===null||s===void 0?void 0:s.map)||Y===((u=d.pano1)===null||u===void 0?void 0:u.map))continue;Y.dispose(),Z.panoPicture=null}}D.indexOf(X)>=0||delete this.panoResources[X]}}this.currentPano=panoParse(C.panoId),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),h.offset&&this.camera.position.copy(h.offset);var G=this.camera.pose.longitude,ee=this.camera.pose.latitude;this.camera.quaternion.fromArray(this.cardboard.sensor.getOrientation()),this.camera.computePose(),(G!==this.camera.pose.longitude||ee!==this.camera.pose.latitude)&&(this.cameraMotion.set(pick(this.camera.pose,["longitude","latitude"]),0).catch(noop),this.emit("camera.update",createEvent("camera.update",{userAction:!0,state:__assign(__assign(__assign({},this.currentPano),{mode:this.mode}),clonePose(this.camera.pose))}))),this.works.getObserver(this.currentPano);var te=this.works.getObserver(E.panoId),ne=this.works.getObserver(b.panoId),ae=new Map;if(te)for(var ce=0,ie=te.accessibleNodes;ce<ie.length;ce++){var fe=ie[ce],N=te.work.observers[fe];if(N){var ge=panoStringify({panoIndex:N.panoIndex,workCode:N.work.workCode});ae.set(ge,N)}}if(ne)for(var ye=0,_e=ne.accessibleNodes;ye<_e.length;ye++){var fe=_e[ye],N=ne.work.observers[fe];if(N){var ge=panoStringify({panoIndex:N.panoIndex,workCode:N.work.workCode});ae.set(ge,N)}}if(this.panoMeshes.forEach(function(Ee,we){var Pe=ae.get(we);Pe?(Ee.position.copy(Pe.position).applyMatrix4(Pe.work.transform),ae.delete(we)):(o.helper.remove(Ee),Ee.dispose(),o.panoMeshes.delete(we))}),ae.forEach(function(Ee,we){var Pe=new PanoSphereMesh;Pe.position.copy(Ee.position).applyMatrix4(Ee.work.transform),o.panoMeshes.set(we,Pe),o.helper.add(Pe),ae.delete(we)}),this.camera.pose.distance>.1||S?this.panoMeshes.forEach(function(Ee,we){Ee.setOpacity(0),Ee.updateTime&&Ee.updateTime(e,r),Ee.visible=!1}):this.panoMeshes.forEach(function(Ee,we){var Pe=panoParse(we),je=o.works.getObserver(Pe);if(je){if(!je.loadable&&!je.active){Ee.setOpacity(0);return}var Qe=Ee.position.clone().setY(o.camera.position.y).distanceTo(o.camera.position);Qe<.05?Ee.setOpacity(0):Ee.setOpacity(clamp$1(1.5/Qe,0,1)),panoEqual(o.currentPano,Pe)&&Ee.setOpacity(0),Ee.lookAt(o.camera.position)}}),this.locationMotion.ended){var le=this.intersect(e);this.panoMeshes.forEach(function(Ee,we){Ee.setCurrent(Ee===le),Ee.updateTime&&Ee.updateTime(e,r)})}{var O=(l=this.modelScene.parameter.progress)!==null&&l!==void 0?l:1,de=Math.round(O),re=this.modelScene.parameter.pano0,se=this.modelScene.parameter.pano1,he=de===0?re:se,N=void 0;if(he&&(N=this.works.getObserver(he.panoId),N||(N=this.panoPictureObserverMap.get(he))),this.tiling.appearDuration=this.tileAppearDuration,this.tiling.maxRequest=O<.6?0:this.tileMaxRequest,this.tiling.imageOptions=this.imageOptions,!N||!he||this.tileLevelForFov===!1||this.camera.perspToOrtho.x>0){this.tiling.setObserver(null);var me={renderer:this.renderer,resolution:this.camera.resolution,pixelRatio:this.camera.pixelRatio,time:this.camera.time,cameraMatrix:this.camera.matrixWorld,cameraProjectionMatrix:this.camera.projectionMatrix,panoMap:null,panoMatrix:new THREE__namespace.Matrix4,panoZoom:1,minLevel:0,level:0};this.tiling.update(me),this.modelScene.parameter.set("refinedScreen",null)}else{var Ne=getImageSizeLevel(he.mapSize),qe=Ne+1,Ye=new THREE__namespace.Vector2().copy(this.camera.resolution).multiplyScalar(this.camera.pixelRatio),Ve=Math.floor(this.tileLevelForFov(this.camera.fov,Ye)),ve=Ve>Ne?Ve:0;this.tiling.setObserver(N);var me={renderer:this.renderer,resolution:this.camera.resolution,pixelRatio:this.camera.pixelRatio,time:this.camera.time,cameraMatrix:this.camera.matrixWorld,cameraProjectionMatrix:this.camera.projectionMatrix,panoMap:he.map,panoMatrix:he.matrix,panoZoom:he.zoom,minLevel:qe,level:ve},Ke=this.tiling.update(me),Te={map:this.tiling.renderTarget.texture,matrixInverse:this.tiling.camera.matrixWorldInverse,projectionMatrix:this.tiling.camera.projectionMatrix,pano:de,opacity:(re==null?void 0:re.panoId)===(se==null?void 0:se.panoId)?1:easeInQuart(Math.abs(((c=this.modelScene.parameter.progress)!==null&&c!==void 0?c:0)-.5)*2)},Le=this.modelScene.parameter.refinedScreen;(Ke||Te.pano!==(Le==null?void 0:Le.pano)||Te.opacity!==(Le==null?void 0:Le.opacity))&&this.modelScene.parameter.set("refinedScreen",Te)}}this.panoVideo.object.position.copy(this.camera.position),this.panoVideo.updateTime(e);{var Me=b.effect,$e=this.modelScene.parameter,re=$e.pano0,se=$e.pano1;if(re&&se&&re!==se&&Me==="fly"&&this.flyEffectUseDepthBuffer){if(((p=this.modelScene.parameter.pano0Depth)===null||p===void 0?void 0:p.panoId)!==re.panoId||((f=this.modelScene.parameter.pano1Depth)===null||f===void 0?void 0:f.panoId)!==se.panoId){var tt=500,ke=512;this.pano0DepthCubeRenderTarget?this.pano0DepthCubeRenderTarget.width!==ke&&this.pano0DepthCubeRenderTarget.setSize(ke,ke):this.pano0DepthCubeRenderTarget=new THREE__namespace.WebGLCubeRenderTarget(ke,{minFilter:THREE__namespace.NearestFilter,magFilter:THREE__namespace.NearestFilter,generateMipmaps:!1}),this.pano1DepthCubeRenderTarget?this.pano1DepthCubeRenderTarget.width!==ke&&this.pano1DepthCubeRenderTarget.setSize(ke,ke):this.pano1DepthCubeRenderTarget=new THREE__namespace.WebGLCubeRenderTarget(ke,{minFilter:THREE__namespace.NearestFilter,magFilter:THREE__namespace.NearestFilter,generateMipmaps:!1});var Ie=new THREE__namespace.CubeCamera(this.camera.near,this.camera.far,this.pano0DepthCubeRenderTarget);Ie.matrix.copy(re.matrix),Ie.matrixWorld.copy(Ie.matrix),Ie.matrixAutoUpdate=!1,renderDepthCube(this.renderer,this.modelScene,Ie,tt);var He=new THREE__namespace.CubeCamera(this.camera.near,this.camera.far,this.pano1DepthCubeRenderTarget);He.matrix.copy(se.matrix),He.matrixWorld.copy(He.matrix),He.matrixAutoUpdate=!1,renderDepthCube(this.renderer,this.modelScene,He,tt),this.modelScene.parameter.set({pano0Depth:{panoId:re.panoId,map:this.pano0DepthCubeRenderTarget.texture,mapSize:this.pano0DepthCubeRenderTarget.width,maxDepth:tt},pano1Depth:{panoId:se.panoId,map:this.pano1DepthCubeRenderTarget.texture,mapSize:this.pano1DepthCubeRenderTarget.width,maxDepth:tt}})}}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.renderer.setScissorTest(!1),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,this.activePanoMesh=void 0,this.activeTime=void 0;return}if(this.activePanoMesh&&this.activeTime&&e-this.activeTime>ACTIVE_TO_CURRENT_DELAY){var s=this.activePanoMesh,u=null;return this.panoMeshes.forEach(function(w,M){w===s&&(u=M)}),u!==null&&this.moveToPano(panoParse(u),{},!0),this.activePanoMesh=void 0,this.activeTime=void 0,s}var l=this.camera.getDirection(new THREE__namespace.Vector3),c=new THREE__namespace.Raycaster(this.camera.position,l);c.params.Points={threshold:.1},c.firstHitOnly=!0,c.floorIndex=-1;for(var p=void 0,f=[],d=this.works.getObserver(this.currentPano),h=d?d.accessibleNodes.map(function(w){return panoStringify({panoIndex:w,workCode:d.work.workCode})}):[],m=0,A=h;m<A.length;m++){var g=A[m],y=this.panoMeshes.get(g);if(y){var v=c.intersectObject((r=y.hitTestMesh)!==null&&r!==void 0?r:y,!0)[0];if(v){var E=(o=d==null?void 0:d.floorIndex)!==null&&o!==void 0?o:0;f.push({panoMesh:y,intersection:__assign({floorIndex:E,floor:E},v)})}}}var b=f.sort(function(w,M){return w.intersection.distance-M.intersection.distance})[0];b?(p=b.intersection,this.activePanoMesh!==b.panoMesh&&(this.activePanoMesh=b.panoMesh,this.activeTime=e),this.intersectMesh.position.copy(b.panoMesh.position),this.intersectMesh.lookAt(this.camera.position)):(this.activePanoMesh=void 0,this.activeTime=void 0),p||(p=this.modelScene.intersectRaycaster(c)[0]);var T=createEvent("intersect.update",{raycaster:c,intersection:p!=null?p:null,object:this.intersectMesh});if(this.emit("intersect.update",T),T.defaultPrevented){this.hideIntersectMesh();return}if(p&&p.face){var _=p.face.normal,S=new THREE__namespace.Quaternion;S.setFromUnitVectors(new THREE__namespace.Vector3(0,0,1),_),this.intersectMesh.quaternion.copy(S);var R=p.point.clone();this.intersectMesh.position.copy(R),b?this.intersectMesh.visible=!1:this.intersectMesh.visible=!0}else this.intersectMesh.visible=!1;return b==null?void 0:b.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),scratchObserverBox$1=new THREE__namespace.Box3,scratchVector3$2=new THREE__namespace.Vector3,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,m=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:m.workCode,panoIndex:m.panoIndex},g=f.getObserver(A),y=clamp$1((u=h.fov)!==null&&u!==void 0?u:!g||isFristPersonMode(m.mode)?m.fov:p.defaultFov,p.minFov,p.maxFov),v=(l=h.longitude)!==null&&l!==void 0?l:m.longitude,E=clamp$1(typeof p.minLatitude=="function"?p.minLatitude(y):p.minLatitude,-Math.PI/2,Math.PI/2),b=clamp$1(typeof p.maxLatitude=="function"?p.maxLatitude(y):p.maxLatitude,-Math.PI/2,Math.PI/2),T=clamp$1((c=h.latitude)!==null&&c!==void 0?c:!g||isFristPersonMode(m.mode)?m.latitude:p.defaultLatitude,E,b),_=new THREE__namespace.Vector3;if(p.initial.state.offset)_.copy(p.initial.state.offset);else if(g)_.copy(g.position).applyMatrix4(g.work.transform);else{var S=coordinatesToVector(m).setLength(m.distance);_.copy(p.initial.currentState.offset).sub(S)}return{workCode:A.workCode,panoIndex:A.panoIndex,mode:"Model",longitude:v,latitude:T,fov:y,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),s.cameraMotion.set(l,r).catch(noop)})},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),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.modelScene.parameter.modelAlpha===0&&this.modelScene.parameter.progress!==1){var u=this.modelScene.parameter,l=u.pano0,c=u.pano1;l&&l.map!==(c==null?void 0:c.map)&&l.map.dispose(),o.progress=1,o.pano0=o.pano1=c}if(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);for(var p=new THREE__namespace.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z),f=[],d=function(_){var S=h.modelScene.models.find(function(B){return B.work===_});if(!S||S.visible===!1||_.observers.length<=0)return"continue";if(scratchObserverBox$1.copy(_.observerBox).expandByScalar(10).applyMatrix4(_.transform),scratchObserverBox$1.containsPoint(p))for(var R=0,w=_.observers;R<w.length;R++){var M=w[R];f.push(M)}},h=this,m=0,A=this.works;m<A.length;m++){var g=A[m];d(g)}var y=arrayMin(f,function(_){return scratchVector3$2.copy(_.position).applyMatrix4(_.work.transform).distanceTo(p)});this.currentPano=y?{workCode:y.work.workCode,panoIndex:y.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);var v=this.works.getObserver(this.currentPano);if(this.intersectMesh&&this.intersectMesh.parent&&v&&v.position.y-v.standingPosition.y>10){var E=this.camera.position.distanceTo(this.intersectMesh.position),b=2*Math.tan(.5*this.camera.fov/180*Math.PI),T=E*b/5;this.intersectMesh.scale.setScalar(T)}else this.intersectMesh.scale.setScalar(1)}},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),e.modelAlphaMotion.set(c,s).catch(noop),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.getObserver(e);if(s){var u=new THREE__namespace.Vector3().copy(s.position).applyMatrix4(s.work.transform);this.moveToPosition(u,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),m=0,A=1;A<this.locationMotion.keyframes.length;A++){var g=this.locationMotion.keyframes[A-1].value,y=g.x,v=g.y,E=g.z,b=this.locationMotion.keyframes[A].value,T=b.x,_=b.y,S=b.z;m+=Math.sqrt(Math.pow(T-y,2)+Math.pow(_-v,2)+Math.pow(S-E,2))}for(var R=d===0?0:h*m/d,w=this.calculateMovingDuration(r.duration,d),M={x:e.x,y:e.y,z:e.z,distance:0},B={longitude:r.longitude,latitude:r.latitude,fov:r.fov},C=[],P=function(j){var Q=L.modelScene.models.find(function(X){return X.work===j});if(!Q||Q.visible===!1||j.observers.length<=0)return"continue";if(scratchObserverBox$1.copy(j.observerBox).expandByScalar(10).applyMatrix4(j.transform),scratchObserverBox$1.containsPoint(f))for(var V=0,J=j.observers;V<J.length;V++){var W=J[V];C.push(W)}},L=this,O=0,F=this.works;O<F.length;O++){var N=F[O];P(N)}var D=arrayMin(C,function(j){return scratchVector3$2.copy(j.position).applyMatrix4(j.work.transform).distanceTo(f)}),U=D?{workCode:D.work.workCode,panoIndex:D.panoIndex}:{workCode:"",panoIndex:0},z=__assign(__assign({},U),{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}),K=this.currentPano;this.emit("pano.moveTo",createEvent("pano.moveTo",{options:r,prevPano:K,progress:0,state:z,userAction:this.userAction,error:null})),r.moveStartCallback&&r.moveStartCallback(z),this.cameraMotion.set(B,w).catch(noop),this.locationMotion.set(M,w,R).then(function(){for(var j=0,Q=s.modelScene.children;j<Q.length;j++){var V=Q[j];V instanceof Model&&V.show()}var J=__assign(__assign(__assign({},U),{mode:s.mode}),clonePose(s.camera.pose));s.emit("pano.arrived",createEvent("pano.arrived",{options:r,prevPano:K,progress:0,state:J,userAction:s.userAction,error:null})),r.moveEndCallback&&r.moveEndCallback(J)},function(){r.moveCancelCallback&&r.moveCancelCallback(),s.emit("pano.cancel",createEvent("pano.cancel",{options:r,prevPano:K,progress:0,state:z,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=new THREE__namespace.Raycaster;l.firstHitOnly=!0;var c=s.clone().setLength(.3).add(u);l.set(c,new THREE__namespace.Vector3(0,-1,0)),o=this.modelScene.intersectRaycaster(l)[0]}}if(o){for(var p=new THREE__namespace.Vector3().copy(o.point).add(HUMAN_EYE_POSITION),f=[],d=function(T){var _=h.modelScene.models.find(function(M){return M.work===T});if(!_||_.visible===!1||T.observers.length<=0)return"continue";if(scratchObserverBox$1.copy(T.observerBox).expandByScalar(10).applyMatrix4(T.transform),scratchObserverBox$1.containsPoint(p))for(var S=0,R=T.observers;S<R.length;S++){var w=R[S];f.push(w)}},h=this,m=0,A=this.works;m<A.length;m++){var g=A[m];d(g)}var y=arrayMin(f,function(T){return scratchVector3$2.copy(T.position).applyMatrix4(T.work.transform).distanceTo(p)},!0),v=y[0],E=y[1];if(v&&E<5){var b=scratchVector3$2.copy(v.position).applyMatrix4(v.work.transform);p.y=b.y}e.state.offset.copy(p),e.state.distance=0,this.emit("gesture.tap",e),e.defaultPrevented||this.moveToPosition(p,{},!0)}else this.emit("gesture.tap",e),e.defaultPrevented||this.cameraBounce()},t})(PanoramaLikeController),scratchObserverBox=new THREE__namespace.Box3,scratchVector3$1=new THREE__namespace.Vector3,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.pendingTextureId=null,r.textureLoader=new TextureLoader,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),{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,m=e.initial,A=m.state,g=m.currentState,y=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:g.workCode,panoIndex:g.panoIndex},v=(u=A.fov)!==null&&u!==void 0?u:60,E=clamp$1(typeof f.minLatitude=="function"?f.minLatitude(v):f.minLatitude,-Math.PI/2,Math.PI/2),b=clamp$1(typeof f.maxLatitude=="function"?f.maxLatitude(v):f.maxLatitude,-Math.PI/2,Math.PI/2),T=clamp$1((l=A.latitude)!==null&&l!==void 0?l:isThirdPersonMode(g.mode)?g.latitude:f.defaultLatitude,E,b),_=t.distanceFromModel(f.modelScene,v,f.camera.aspect),S=new THREE__namespace.Vector3,R=(c=A.distance)!==null&&c!==void 0?c:Math.min(f.defaultDistance,_),w=(p=A.longitude)!==null&&p!==void 0?p:isThirdPersonMode(g.mode)?g.longitude:f.defaultLongitude;if(A.offset)S.copy(A.offset);else{var M=d.getObserver(y);f.defaultDistance<_&&M?(S.copy(M.position).applyMatrix4(M.work.transform),A.longitude===void 0&&(w=g.longitude)):(h.boundingBox.getCenter(S),R=_)}return __assign(__assign({},y),{mode:"Mapview",longitude:w,latitude:T,fov:v,offset:S,distance:R})},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.pendingTextureId=null,this.locationMotion.dispose(),this.panState=void 0,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),this.cameraMotion.set(l,o.duration).catch(noop),!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),s.cameraMotion.set(l,r).catch(noop)})},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),s.cameraMotion.setKeyframes(e,r)})},t.prototype.updateTime=function(e,r){if(!this.destroyed){var o={},s={};if(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),this.modelScene.parameter.modelAlpha===0&&this.modelScene.parameter.progress!==1){var u=this.modelScene.parameter,l=u.pano0,c=u.pano1;l&&l.map!==(c==null?void 0:c.map)&&l.map.dispose(),o.progress=1,o.pano0=o.pano1=c}var p=0;if(this.cameraType==="auto"?p=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"?p=0:this.cameraType==="orthographic"&&(p=1),this.perspToOrthoMotion.getTargetKeyframe().value.perspToOrtho!==p&&this.perspToOrthoMotion.set({perspToOrtho:p},500).catch(noop),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 f=coordinatesToVector(this.camera.pose,new THREE__namespace.Vector3),d=new THREE__namespace.Vector3().copy(this.camera.pose.offset).sub(f.clone().multiplyScalar(this.camera.pose.distance));if(this.cameraFence.distanceToPoint(d)>.01){var h=this.cameraFence.clampPoint(d,new THREE__namespace.Vector3),m=this.camera.pose.offset.clone().add(h).sub(d),A=__assign(__assign({},this.currentPano),{mode:this.mode,longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude,fov:this.camera.pose.fov,offset:m,distance:this.camera.pose.distance});this.fixFinalState(A),this.locationMotion.set({x:A.offset.x,y:A.offset.y,z:A.offset.z,distance:A.distance},300).catch(noop)}}if(this.intersectMesh&&this.intersectMesh.parent){var g=this.camera.position.distanceTo(this.intersectMesh.position),y=2*Math.tan(.5*this.camera.fov/180*Math.PI),v=g*y/5;this.intersectMesh.scale.setScalar(v)}else this.intersectMesh.scale.setScalar(1)}},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),e.modelAlphaMotion.set(f,s/3).catch(noop),e.cameraMotion.set(c,s).catch(noop),e.locationMotion.set(p,s).then(function(){e.emit("initAnimation.end",createEvent("initAnimation.end",{state:l,userAction:e.userAction}))},function(h){var m=__assign(__assign(__assign({},e.currentPano),{mode:e.mode}),clonePose(e.camera.pose));e.emit("initAnimation.end",createEvent("initAnimation.end",{state:m,userAction:e.userAction}))}).then(function(){r()})})},t.prototype.getForwardObserverOrNot=function(e){var r=this.modelScene.intersectRaycaster(e)[0];if(!r)return null;for(var o=[],s=function(m){var A=u.modelScene.models.find(function(E){return E.work===m});if(!A||A.visible===!1||m.observers.length<=0)return"continue";if(scratchObserverBox.copy(m.observerBox).expandByScalar(10).applyMatrix4(m.transform),scratchObserverBox.containsPoint(e.ray.origin)||e.ray.intersectsBox(scratchObserverBox))for(var g=0,y=m.observers;g<y.length;g++){var v=y[g];o.push(v)}},u=this,l=0,c=this.works;l<c.length;l++){var p=c[l];s(p)}var f=arrayMin(o,function(m){return scratchVector3$1.copy(m.standingPosition).applyMatrix4(m.work.transform).distanceTo(r.point)},!0),d=f[0],h=f[1];return d&&h<Math.max(d.standingPosition.distanceTo(this.camera.position)/5,10)?d: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){s=Math.max(s,1);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$1(this.cameraMotion.value.longitude+c.longitude),h=clamp$1(typeof this.minLatitude=="function"?this.minLatitude(f):this.minLatitude,-Math.PI/2,Math.PI/2),m=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,m),g=new THREE__namespace.Vector3(this.locationMotion.value.x+c.x,this.locationMotion.value.y+c.y,this.locationMotion.value.z+c.z),y=__assign(__assign({},this.currentPano),{mode:this.mode,longitude:d,latitude:A,offset:g,fov:f,distance:this.locationMotion.value.distance}),v=e.state.offset.clone().sub(coordinatesToVector(e.state).setLength(y.distance)),E=!(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&&(E=!0);var T=createEvent("gesture.momentum",__assign(__assign({},e),{isFirst:r,isFinal:E,state:y}));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),this.locationMotion.set({x:y.offset.x,y:y.offset.y,z:y.offset.z,distance:y.distance},0).catch(noop),E?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.firstHitOnly=!0,s.near=this.camera.near,s.far=this.camera.far;var u;if(u=this.modelScene.intersectRaycaster(s).filter(function(d){var h,m=(h=d.face)===null||h===void 0?void 0:h.normal;return m&&s.ray.direction.dot(m)>=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,floorIndex:0,floor:0,point:c,object:this.scene,face:null})}}if(!u){var f=Math.max(e.distance,3);u={distance:f,floorIndex:0,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=this.createRaycasterFromCamera(c,this.camera);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 m=h.distanceTo(p.ray.origin);m<1e4&&m>=p.near&&(f={distance:m,floorIndex:0,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?this.panState=void 0:this.panState={target:l,buttons:s,pointerLength:r,x:e.center.x,y:e.center.y},!(typeof o=="undefined"||o.pointerLength!==r)){var g=r>1||s===2||u;if(g){var y={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),E=coordinatesToVector(this.cameraMotion.value).setLength(this.locationMotion.value.distance).add(v),b=new THREE__namespace.Vector3().copy(E).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*y.x*b/T.y,S=2*y.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 w=__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=w,this.emit("gesture.pan",e),e.defaultPrevented)return;if(this.locationMotion.set({x:w.offset.x,y:w.offset.y,z:w.offset.z},0).catch(noop),e.isFinal&&(this.fixFinalState(w),Object.assign(e,{__fixFinalState:!0}),this.locationMotion.set({distance:w.distance,x:w.offset.x,y:w.offset.y,z:w.offset.z},0).catch(noop)),e.isFinal){var M=this.renderer.getSize(new THREE__namespace.Vector2),B=2*e.velocityX*b/M.y,C=2*e.velocityY*b/M.y,P=new THREE__namespace.Vector3,L=new THREE__namespace.Vector3;P.setFromMatrixColumn(this.camera.matrix,0),P.multiplyScalar(-B),L.add(P),this.camera.pose.latitude<PANGESTURE_FORWARD_ANGLE?P.setFromMatrixColumn(this.camera.matrix,1):(P.setFromMatrixColumn(this.camera.matrix,0),P.crossVectors(this.camera.up,P)),P.multiplyScalar(C),L.add(P),this.inMomentumMovement={uuid:createUuid()},this.requestMomentumMovement(e,!0,{longitude:0,latitude:0,x:L.x,y:L.y,z:L.z},0)}}else{var y={x:e.center.x-o.x,y:e.center.y-o.y},O=this.coordinatesForOffset(y),F=formatRad$1(this.cameraMotion.value.longitude+O.longitude),N=this.camera.pose.fov,D=clamp$1(typeof this.minLatitude=="function"?this.minLatitude(N):this.minLatitude,-Math.PI/2,Math.PI/2),U=clamp$1(typeof this.maxLatitude=="function"?this.maxLatitude(N):this.maxLatitude,-Math.PI/2,Math.PI/2),z=clamp$1(this.cameraMotion.value.latitude+O.latitude,D,U);this.camera.aspect<1&&Math.abs(e.overallVelocityX)>.2&&Math.atan2(Math.abs(e.overallVelocityY),Math.abs(e.overallVelocityX))<Math.PI/6.923&&(z=this.cameraMotion.value.latitude);var w=__assign(__assign({},this.currentPano),{mode:this.mode,longitude:F,latitude:z,fov:N,offset:this.camera.pose.offset,distance:this.camera.pose.distance});if(e.isFinal&&Object.assign(e,{__fixFinalState:!0}),e.state=w,this.emit("gesture.pan",e),e.defaultPrevented)return;if(e.isFinal?this.locationMotion.set({distance:w.distance,x:w.offset.x,y:w.offset.y,z:w.offset.z},0).catch(noop):this.cameraMotion.set({longitude:w.longitude,latitude:w.latitude},0).catch(noop),e.isFinal){var K=e.velocityX,j=e.velocityY;this.inMomentumMovement={uuid:createUuid()},this.requestMomentumMovement(e,!0,__assign(__assign({},this.coordinatesForOffset({x:K,y:j})),{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),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)}this.panState=void 0,this.pinchState=void 0}}}},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(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)}else{var s=t.distanceFromModel(this.modelScene,this.cameraMotion.value.fov,this.camera.aspect),u=Math.max(this.locationMotion.value.distance-this.camera.near,0),l=e.center.delta/10*Math.max(u/5,.1);if(u<=s||l>0)if(this.locationMotion.value.distance-l>=minDistance){var c=this.locationMotion.value.distance-l;e.state.distance=c}else{var p=coordinatesToVector(this.cameraMotion.value);p.setLength(l),e.state.offset.add(p)}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)}},t.prototype.onTapGesture=function(e){var r=this,o;this.userAction=e.userAction,this.stopMomentumMovement();var s=e.center.raycaster,u=this.getForwardObserverOrNot(s);if(!u)this.emit("gesture.tap",e);else{var l={longitude:this.camera.pose.longitude,latitude:0},c=__assign(__assign({},e.state),{mode:"Panorama",workCode:u.work.workCode,panoIndex:u.panoIndex,longitude:l.longitude,latitude:l.latitude,offset:u?u.position.clone():new THREE__namespace.Vector3,distance:0});if(e.state=c,this.emit("gesture.tap",e),!e.defaultPrevented&&(this.emit("pano.select",createEvent("pano.select",{prevPano:this.currentPano,state:c,userAction:e.userAction,options:l,progress:0,error:null})),u&&u.active)){var p=this.pendingTextureId=createUuid(),f={panoIndex:u.panoIndex,workCode:u.work.workCode},d=panoStringify(f),h={right:u.images.work.getURL(u.images.right),left:u.images.work.getURL(u.images.left),up:u.images.work.getURL(u.images.up),down:u.images.work.getURL(u.images.down),front:u.images.work.getURL(u.images.front),back:u.images.work.getURL(u.images.back)},m=this.imageOptions.transform,A=__assign({key:"pano.".concat(d)},pick(this.imageOptions,["format","size","quality","sharpen","forceUseExifOrientation","mappings"])),g="pano:"+jsonHash([h,A,m]),y=this.modelScene.parameter,v=void 0;y.pano0&&y.pano0.map.name===g?v=y.pano0:y.pano1&&y.pano1.map.name===g&&(v=y.pano1),v?(y.pano0&&y.pano0.map!==v.map&&y.pano0.map.dispose(),y.pano1&&y.pano1.map!==v.map&&y.pano1.map!==((o=y.pano0)===null||o===void 0?void 0:o.map)&&y.pano1.map.dispose(),y.set({pano0:v,pano1:v}),this.emit("pano.request",createEvent("pano.request",{userAction:!0,prevPano:this.currentPano,progress:0,state:c,options:l,error:null}))):this.textureLoader.loadCubeTexture(h,{imageURL:{transform:m,options:A},format:THREE__namespace.RGBAFormat,viaAjax:!0,fetcher:getFetcher(u.work)},void 0,void 0,void 0,this.renderer).then(function(E){var b,T,_=E.body;if(r.destroyed||r.pendingTextureId!==p){_.dispose();return}r.pendingTextureId=null,_.name=g;var S=Array.isArray(_.image)?_.image[0]:_.image,R=(b=S==null?void 0:S.width)!==null&&b!==void 0?b:2048,w={panoId:d,map:_,mapSize:R,matrix:u.matrix.clone().premultiply(u.work.transform),zoom:1};y.pano0&&y.pano0.map.dispose(),y.pano1&&y.pano1.map!==((T=y.pano0)===null||T===void 0?void 0:T.map)&&y.pano1.map.dispose(),y.set({pano0:w,pano1:w}),r.emit("pano.request",createEvent("pano.request",{userAction:!0,prevPano:r.currentPano,progress:0,state:c,options:l,error:null}))}).catch(function(E){r.destroyed||r.pendingTextureId!==p||(r.pendingTextureId=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),this.hideIntersectMesh()}}},t.prototype.hideIntersectMesh=function(){this.intersectMesh.visible===!0&&(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],m=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 g=p.joints[h.jointName];m!==null&&(g.matrix.fromArray(m.transform.matrix),g.matrix.decompose(g.position,g.rotation,g.scale),g.jointRadius=m.radius),g.visible=m!==null}var y=p.joints["index-finger-tip"],v=p.joints["thumb-tip"],E=y.position.distanceTo(v.position),b=.02,T=.005;p.inputState.pinching&&E>b+T?(p.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!p.inputState.pinching&&E<=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,this.onSessionEndCallback=(c=r==null?void 0:r.onSessionEnd)!==null&&c!==void 0?c:noop,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.cameraVR.cameras.push(this.cameraL,this.cameraR),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],m=l*d,A=l*h,g=o/(-d+h),y=g*-d;e.matrixWorld.decompose(t.position,t.quaternion,t.scale),t.translateX(y),t.translateZ(g),t.matrixWorld.compose(t.position,t.quaternion,t.scale),t.matrixWorldInverse.getInverse(t.matrixWorld);var v=l+g,E=c+g,b=m-y,T=A+(o-y),_=p*c/E*v,S=f*c/E*v;t.projectionMatrix.makePerspective(b,T,_,S,v,E)},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:`
1935
1935
  #include <common>
1936
1936
  #include <color_pars_vertex>
1937
1937
  #include <fog_pars_vertex>
@@ -2130,7 +2130,7 @@ void main() {
2130
2130
  #include <premultiplied_alpha_fragment>
2131
2131
 
2132
2132
  }
2133
- `},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,m=new THREE__namespace.Vector4,A=new THREE__namespace.Vector4,g=new THREE__namespace.Vector4,y=new THREE__namespace.Vector3,v=new THREE__namespace.Matrix4,E=new THREE__namespace.Line3,b=new THREE__namespace.Vector3;o.at(1,g),g.w=1,g.applyMatrix4(s.matrixWorldInverse),g.applyMatrix4(u),g.multiplyScalar(1/g.w),g.x*=p.x/2,g.y*=p.y/2,g.z=0,y.copy(g);var T=this.matrixWorld;v.multiplyMatrices(s.matrixWorldInverse,T);for(var _=0,S=d.count;_<S;_++){m.fromBufferAttribute(d,_),A.fromBufferAttribute(h,_),m.w=1,A.w=1,m.applyMatrix4(v),A.applyMatrix4(v),m.applyMatrix4(u),A.applyMatrix4(u),m.multiplyScalar(1/m.w),A.multiplyScalar(1/A.w);var R=m.z<-1&&A.z<-1,w=m.z>1&&A.z>1;if(!(R||w)){m.x*=p.x/2,m.y*=p.y/2,A.x*=p.x/2,A.y*=p.y/2,E.start.copy(m),E.start.z=0,E.end.copy(A),E.end.z=0;var M=E.closestPointToPointParameter(y,!0);E.at(M,b);var B=THREE__namespace.MathUtils.lerp(m.z,A.z,M),C=B>=-1&&B<=1,P=y.distanceTo(b)<f*.5;if(C&&P){E.start.fromBufferAttribute(d,_),E.end.fromBufferAttribute(h,_),E.start.applyMatrix4(T),E.end.applyMatrix4(T);var L=new THREE__namespace.Vector3,O=new THREE__namespace.Vector3;o.distanceSqToSegment(E.start,E.end,O,L),r.push({point:O,pointOnLine:L,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.6.4"},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={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(m){var A=u[m];return A&&(l={profileId:m,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,m=p.valueNodeProperty;if(m===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.left.firstHitOnly=!0,r.xrControllerRay.left.floorIndex=-1,r.xrControllerRay.right.params.Points={threshold:.1},r.xrControllerRay.right.firstHitOnly=!0,r.xrControllerRay.right.floorIndex=-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=(u=r.effect)!==null&&u!==void 0?u:"fade";this.userAction=o,this.stopMomentumMovement();var p=panoStringify(e),f=this.works.getObserver(e);if(!f)throw new Error("Invalid PanoIndex");getImageSizeFromURL(f.images.up),this.imageOptions.size;var d=this.imageOptions.transform,h=function(R,w){return mapPanoResource(applyImageURLOptions(R,d,w))},m=__assign({key:"pano.".concat(p)},pick(this.imageOptions,["format","size","quality"])),A={right:f.images.work.getURL(f.images.right),left:f.images.work.getURL(f.images.left),up:f.images.work.getURL(f.images.up),down:f.images.work.getURL(f.images.down),front:f.images.work.getURL(f.images.front),back:f.images.work.getURL(f.images.back)},g="pano:"+jsonHash([A,m,d]);if(this.pendingTextureTask){if(this.pendingTextureTask.hash===g)return;var y=this.pendingTextureTask.panoId;(l=this.panoMeshes.get(y))===null||l===void 0||l.setProgress(0),this.emit("pano.texture.abort",createEvent("pano.texture.abort",{error:null,progress:0,meta:null,pano:e}))}var v=this.modelScene.parameter.resolveValue(),E=v.pano0,b=v.pano1,T;if((E==null?void 0:E.map.name)===g?T=E:(b==null?void 0:b.map.name)===g&&(T=b),T){var _={panoId:p,effect:c,leftPanoPicture:{panoId:T.panoId,map:T.map,mapSize:T.mapSize,matrix:f.matrix.clone().premultiply(f.work.transform),zoom:1},position:f.position.clone().applyMatrix4(f.work.transform),fixCameraTransform:new THREE__namespace.Matrix4};this.doMoveToPano(e,_,r);return}var S="move-to-pano-"+p;this.pending.add(S),this.pendingTextureTask={panoId:p,hash:g,onLoad:function(R){var w;s.pending.delete(S);var M=R.body;if(s.destroyed)M.dispose();else{M.name=g;var B=Array.isArray(M.image)?M.image[0]:M.image,C=(w=B==null?void 0:B.width)!==null&&w!==void 0?w:2048,P={panoId:p,effect:c,leftPanoPicture:{panoId:p,map:M,mapSize:C,matrix:f.matrix.clone(),zoom:1},position:f.position.clone(),fixCameraTransform:new THREE__namespace.Matrix4};s.doMoveToPano(e,P,r)}},onError:function(R){s.pending.delete(S);var w=__assign(__assign(__assign({},e),{mode:s.mode}),clonePose(s.camera.pose));s.emit("pano.error",createEvent("pano.error",{error:R,userAction:s.userAction,options:r,prevPano:s.currentPano,progress:0,state:w})),s.emit("pano.cancel",createEvent("pano.cancel",{error:null,userAction:s.userAction,options:r,prevPano:s.currentPano,progress:0,state:w})),r.moveCancelCallback&&r.moveCancelCallback()}},this.textureLoader.loadCubeTexture(A,{imageURL:{transform:h,options:m},format:THREE__namespace.RGBAFormat,fetcher:getFetcher(f.work)},void 0,void 0,function(R){var w,M;((w=s.pendingTextureTask)===null||w===void 0?void 0:w.hash)===g&&((M=s.panoMeshes.get(p))===null||M===void 0||M.setProgress(R)),s.emit("pano.texture.progress",createEvent("pano.texture.progress",{error:null,progress:R,meta:null,pano:e}))},this.renderer).then(function(R){var w,M;((w=s.pendingTextureTask)===null||w===void 0?void 0:w.hash)===g?(s.pendingTextureTask.onLoad(R),(M=s.panoMeshes.get(p))===null||M===void 0||M.setProgress(0),s.pendingTextureTask=void 0,s.emit("pano.texture.success",createEvent("pano.texture.success",{error:null,progress:1,meta:R.meta,pano:e}))):R.body.dispose()}).catch(function(R){var w,M;((w=s.pendingTextureTask)===null||w===void 0?void 0:w.hash)===g&&(s.pendingTextureTask.onError(R),(M=s.panoMeshes.get(p))===null||M===void 0||M.setProgress(0),s.pendingTextureTask=void 0,s.emit("pano.texture.error",createEvent("pano.texture.error",{error:R,progress:0,meta:null,pano:e})),s.emit("error",R))}),this.emit("pano.texture.load",createEvent("pano.texture.load",{error:null,progress:0,meta:null,pano:e}))},t.prototype.doMoveToPano=function(e,r,o){var s=this,u,l,c,p,f,d,h,m,A,g;o===void 0&&(o={});var y=now(),v=createUuid();this.panoResources[v]=r;var E=1,b,T,_;if(this.locationMotion.ended){var S=this.locationMotion.getKeyFrameSegment(y);S[0];var R=S[1],w=this.locationMotion.value,M=this.panoResourceFromLocationMotionKeyframe(R).position,B=r.position;b=Math.max(M.distanceTo(B),E),T=[{key:R.key,progress:0,value:__assign(__assign({},w),{count:0})},{key:v,progress:1,value:{distance:0,count:1}}],_=0}else{var C=this.locationMotion.getKeyFrameSegment(y),P=C[0],R=C[1],w=this.locationMotion.value,L=this.panoResourceFromLocationMotionKeyframe(P).position,M=this.panoResourceFromLocationMotionKeyframe(R).position,B=r.position,O=R.value.count-w.count,F=Math.max(L.distanceTo(M),E)*O,N=Math.max(M.distanceTo(B),E);b=F+N,T=[{key:P.key,progress:0,value:__assign({},w)},{key:R.key,progress:F/b,value:R.value},{key:v,progress:1,value:{count:R.value.count+1,distance:0}}];var D=this.locationMotionKeyframesLength(this.locationMotion.keyframes),U=this.locationMotionKeyframesLength(T);_=this.locationMotion.getProgressVelocity(y)*D/U}var z=r.effect==="instant"?0:this.calculateMovingDuration(o.duration,r.effect==="fly"?b:0),G={longitude:o.longitude,latitude:o.latitude,fov:o.fov},j=__assign(__assign({},e),{mode:this.mode,longitude:(u=G.longitude)!==null&&u!==void 0?u:this.camera.pose.longitude,latitude:(l=G.latitude)!==null&&l!==void 0?l:this.camera.pose.latitude,fov:(c=G.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:j,userAction:this.userAction,error:null})),o.moveStartCallback&&o.moveStartCallback(j),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,this.videoTexture.needsUpdate=!0),this.panoVideo.setMaterial(null),r.effect==="fly")this.cameraMotion.set(G,z).catch(noop);else{var V=coordinatesToVector({longitude:this.cameraMotion.value.longitude,latitude:this.cameraMotion.value.latitude}),J=coordinatesToVector({longitude:(p=G.longitude)!==null&&p!==void 0?p:this.cameraMotion.value.longitude,latitude:(f=G.latitude)!==null&&f!==void 0?f:this.cameraMotion.value.latitude}),W=new THREE__namespace.Object3D;W.lookAt(V);var X=new THREE__namespace.Matrix4().makeRotationFromQuaternion(W.quaternion);W.lookAt(J);var Z=new THREE__namespace.Matrix4().makeRotationFromQuaternion(W.quaternion),Y=new THREE__namespace.Matrix4().getInverse(X).premultiply(Z),K=this.cameraMotion.value.fov,ee=(d=G.fov)!==null&&d!==void 0?d:this.cameraMotion.value.fov,te=1;r.effect==="zoomin"?te=1.5:r.effect==="zoomout"&&(te=.4);for(var re=ee*te,ae=0;ae<T.length-1;ae++){var ce=T[ae].key;if(ce){var ie=this.panoResources[ce];ie&&(ie.fixCameraTransform.copy(Y),ie.leftPanoPicture&&(ie.leftPanoPicture.zoom=Math.tan(re/2/180*Math.PI)/Math.tan(K/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=G.longitude)!==null&&h!==void 0?h:this.cameraMotion.value.longitude,latitude:(m=G.latitude)!==null&&m!==void 0?m:this.cameraMotion.value.latitude,fov:re}},{progress:1,value:{longitude:(A=G.longitude)!==null&&A!==void 0?A:this.cameraMotion.value.longitude,latitude:(g=G.latitude)!==null&&g!==void 0?g:this.cameraMotion.value.latitude,fov:ee}}],z).catch(noop)}var fe=this.locationMotion.setKeyframes(T,z,_);fe.then(function(){for(var ge=0,ye=s.modelScene.children;ge<ye.length;ge++){var _e=ye[ge];_e instanceof Model&&_e.show()}var le=__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:le,userAction:s.userAction,error:null})),o.moveEndCallback&&o.moveEndCallback(le);var de=s.works.getObserver(s.currentPano);if(de&&de.video&&s.videoTexture&&s.videoTexture.image instanceof HTMLVideoElement){var ne={map:s.videoTexture,size:de.video.size.clone(),matrix:de.video.matrix.clone(),panoMatrix:de.matrix.clone().premultiply(de.work.transform),alpha:1},se=createUuid(),he=s.videoTexture.image;he.setAttribute("uuid",se),canplayVideo().then(function(me){me&&de.video&&he.getAttribute("uuid")===se&&(he.oncanplay=function(){he.oncanplay=noop,he.play()},he.ontimeupdate=function(){he.currentTime>.5&&(he.ontimeupdate=noop,s.panoVideo.setMaterial(ne))},he.src=de.video.source)}).catch((function(){he.removeAttribute("uuid")}))}},function(){s.emit("pano.cancel",createEvent("pano.cancel",{options:o,prevPano:Q,progress:0,state:j,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.getObserver(this.currentPano);if(!u)return null;var l=u.work.observers,c=u.accessibleNodes.filter(function(_){if(_===r.currentPano.panoIndex&&u.work.workCode===r.currentPano.workCode)return!1;var S=l[_];if(!S)return!1;var R=scratchVector3.copy(S.position).applyMatrix4(S.work.transform);return R.distanceTo(r.camera.position)>r.maxAccessibleDistance?!1:S.loadable||S.active}),p=this.modelScene.intersectRaycaster(e)[0];if(p){var f=arrayMin(c,function(_){var S=l[_];if(!S)return 1/0;var R=scratchVector3.copy(S.standingPosition).applyMatrix4(S.work.transform);return R.distanceTo(p.point)},!0),d=f[0],h=f[1];typeof d=="number"&&h<this.panoTapTriggerRadius&&(s=(o=l[d])!==null&&o!==void 0?o:null)}if(isNil(s)){var m=this.getForwardObserverOrNot(this.xrManager.cameraVR,e);m&&(s=m)}for(var A=0,g=this.locationMotion.keyframes;A<g.length;A++){var y=g[A],v=this.panoResourceFromLocationMotionKeyframe(y);if(!(y.progress<this.locationMotion.progress)&&s){var E=panoStringify({panoIndex:s.panoIndex,workCode:s.work.workCode});if(v.panoId===E){s=null;break}}}if(isNil(s))return this.locationMotion.ended===!0&&this.cameraBounce(),null;if(!s.active){var E=panoStringify({panoIndex:s.panoIndex,workCode:s.work.workCode}),b=this.panoMeshes.get(E);b&&(b.setDisabled(!1),b.setLoading(!0))}var T={workCode:s.work.workCode,panoIndex:s.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:T,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:T,options:{},error:null})),{workCode:s.work.workCode,panoIndex:s.panoIndex}):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,m,A=[],g=2;g<arguments.length;g++)A[g-2]=arguments[g];this.userAction=!0;var y={},v={},E=this.locationMotion.keyframes[0],b=this.locationMotion.keyframes[this.locationMotion.keyframes.length-1],T=this.locationMotion.getKeyFrameSegment(e),_=T[0],S=T[1],R=this.panoResourceFromLocationMotionKeyframe(_),w=this.panoResourceFromLocationMotionKeyframe(S),M=this.panoResourceFromLocationMotionKeyframe(E),B=this.panoResourceFromLocationMotionKeyframe(b),C=!1;if(this.cameraMotion.ended===!1&&(this.cameraMotion.update(e),v.fov=this.cameraMotion.value.fov),this.modelAlphaMotion.ended===!1&&(this.modelAlphaMotion.update(e),y.modelAlpha=this.modelAlphaMotion.value.modelAlpha),this.perspToOrthoMotion.ended===!1&&(this.perspToOrthoMotion.update(e),this.camera.perspToOrtho.setScalar(clamp$1(this.perspToOrthoMotion.value.perspToOrtho,0,1))),this.locationMotion.ended===!1){this.locationMotion.update(e);var P=this.locationMotion.getKeyFrameSegment(e);P[0];var L=P[1],O=new THREE__namespace.Vector3().copy(R.position),F=new THREE__namespace.Vector3().copy(w.position),N=this.locationMotion.value.count-L.value.count+1;if(y.progress=N,w.leftPanoPicture&&(N<1?R.leftPanoPicture&&(y.pano0=R.leftPanoPicture):y.pano0=w.leftPanoPicture,y.pano1=w.leftPanoPicture),w.effect==="montage"?y.transition="BLACK":w.effect==="spread"?y.transition="SPREAD":y.transition="FADE",(w.effect==="zoomin"||w.effect==="zoomout")&&(y.progress=Math.pow(N,3)),N<1&&w.effect!=="fly"){if(y.pano0&&R.leftPanoPicture){var D={panoId:y.pano0.panoId,map:y.pano0.map,mapSize:y.pano0.mapSize,zoom:y.pano0.zoom,matrix:R.leftPanoPicture.matrix.clone().setPosition(w.position)},U=this.panoPictureObserverMap.get(y.pano0);U&&this.panoPictureObserverMap.set(D,U),y.pano0=D}O.copy(F),C=!0}v.distance=this.locationMotion.value.distance,v.offset=new THREE__namespace.Vector3(O.x+(F.x-O.x)*N,O.y+(F.y-O.y)*N,O.z+(F.z-O.z)*N);for(var z=[],G=[],j=0,Q=this.locationMotion.keyframes;j<Q.length;j++){var V=Q[j],J=V.key,W=V.progress;J!==void 0&&(z.push(J),W>this.locationMotion.progress&&G.push(J))}for(var X=0,Z=Object.keys(this.panoResources);X<Z.length;X++){var Y=Z[X];if(!(G.indexOf(Y)>=0)){var K=this.panoResources[Y];if(K.leftPanoPicture){var ee=K.leftPanoPicture.map;if(ee){if(ee===((s=y.pano0)===null||s===void 0?void 0:s.map)||ee===((u=y.pano1)===null||u===void 0?void 0:u.map))continue;ee.dispose(),K.leftPanoPicture=null}}z.indexOf(Y)>=0||delete this.panoResources[Y]}}var te=panoParse(w.panoId);te!==this.currentPano&&(this.currentPano=te,this.accessibleObserverFloorCheckCount=0),this.emit("pano.moving",createEvent("pano.moving",{userAction:this.userAction,prevPano:panoParse(M.panoId),state:__assign(__assign(__assign(__assign({},panoParse(B.panoId)),{mode:this.mode}),clonePose(this.camera.pose)),v),options:{},progress:this.locationMotion.progress,error:null}))}this.camera.setFromPose(v),this.xrManager.cameraVR.projectionMatrix.copy(this.camera.projectionMatrix),this.xrManager.cameraVR.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),this.xrManager.cameraVR.matrix.copy(this.camera.matrix),this.xrManager.cameraVR.position.copy(this.camera.position),this.xrManager.cameraVR.quaternion.copy(this.camera.quaternion),this.xrManager.cameraVR.scale.copy(this.camera.scale),this.xrManager.cameraVR.matrixAutoUpdate=!1,this.xrManager.cameraVR.matrixWorld.copy(this.camera.matrixWorld);var re=A,ae=re[1],ce=new THREE__namespace.Vector3(0,0,0),ie=new THREE__namespace.Vector2().copy(this.camera.resolution);if(ae&&this.xrManager.session&&this.xrManager.referenceSpace&&this.xrManager.session.renderState.baseLayer){var fe=this.xrManager.cameraVR,ge=this.xrManager.referenceSpace,ye=this.xrManager.session.renderState.baseLayer,_e=ae.getViewerPose(ge),le=(l=_e==null?void 0:_e.views)!==null&&l!==void 0?l:[];this.renderer.setFramebuffer(ye.framebuffer);for(var de=0;de<le.length;de++){var ne=le[de],se=fe.cameras[de],he=ye.getViewport(ne);he&&(se.projectionMatrix.fromArray(ne.projectionMatrix),se.projectionMatrixInverse.getInverse(se.projectionMatrix),se.matrix.fromArray(ne.transform.matrix),se.matrix.setPosition(this.camera.position),se.matrix.decompose(se.position,se.quaternion,se.scale),se.matrixWorld.copy(se.matrix),se.matrixWorldInverse.getInverse(se.matrixWorld),se.matrixAutoUpdate=!1,ce.copy(se.position),se.viewport.set(he.x,he.y,he.width,he.height),ie.set(he.width,he.height))}if(this.xrManager.setProjectionFromUnion(this.xrManager.cameraVR,this.xrManager.cameraL,this.xrManager.cameraR),this.camera.quaternion.copy(this.xrManager.cameraVR.quaternion),this.camera.scale.copy(this.xrManager.cameraVR.scale),this.camera.matrix.compose(this.camera.position,this.camera.quaternion,this.camera.scale),this.camera.computePose((c=v.distance)!==null&&c!==void 0?c:this.camera.pose.distance),this.xrManager.session&&this.xrManager.session.inputSources){for(var de=0;de<this.xrManager.session.inputSources.length;de++)if(this.xrManager.session.inputSources[de]&&this.xrManager.session.inputSources[de].targetRayMode==="transient-pointer"){var me=ae.getPose(this.xrManager.session.inputSources[de].targetRaySpace,ge);if(me){var Ne=me.transform.orientation,qe=new THREE__namespace.Quaternion(Ne.x,Ne.y,Ne.z,Ne.w),Ye=new THREE__namespace.Vector3(0,0,-1).applyQuaternion(qe),Ve=new THREE__namespace.Raycaster(this.camera.position,Ye);this.gazeRay=Ve}}}if(this.xrManager.machineType==="Oculus"||this.xrManager.machineType==="Pico"){for(var ve=this.xrManager.session.inputSources,Ke=function(pe){var xe=Te.xrManager.controllers[pe],Se=ve[pe];if(!Se)return"continue";xe&&xe.update(Se,ae,ge);var Oe=Te.xrManager.getController(pe),Pt=new THREE__namespace.Vector3(0,1.2,0),st=Oe.position.clone().add(ce).sub(Pt);Se.handedness==="left"?Te.xrControllerRay.left.set(st,new THREE__namespace.Vector3(0,0,-1).applyEuler(Oe.rotation)):Se.handedness==="right"&&Te.xrControllerRay.right.set(st,new THREE__namespace.Vector3(0,0,-1).applyEuler(Oe.rotation)),Te.controllerWrappers[pe].position.copy(new THREE__namespace.Vector3(0,0,0).add(ce).sub(Pt));var Ze=Te.modelScene.intersectRaycaster(Te.xrControllerRay.right);if(Ze.length===0){var Ft=Te.works.getResolvedObserver(Te.currentPano);Ze=Te.xrControllerRay.right.intersectObject(Te.boundingMesh,!0).map(function(Xe){var Fe,lt=(Fe=Ft==null?void 0:Ft.floorIndex)!==null&&Fe!==void 0?Fe:0;return __assign({floorIndex:lt,floor:lt},Xe)})}if(Ze.length>=1&&Ze[0].face)if(Se.handedness==="right"){var I=Te.xrControllerRay.right.intersectObject(Te.xrCustomObjectsScene,!0),H=Ze[0].face.normal,k=H.clone(),q=Ze[0].point.clone();Te.intersectMesh.position.copy(q);var $=q.clone().add(k);if(Te.intersectMesh.lookAt($),Math.abs(H.y)>.99){var oe=Te.camera.position.clone().sub(q);Te.intersectMesh.rotation.z=-Math.atan2(oe.z,oe.x)}Te.intersectMesh.visible=!0,Te.needsRender=!0,I.length>0?(Te.pointerLines.right.setPoints(st,I[0].point),Te.pointerLines.right.points.visible=!0,Te.intersectMesh.visible=!1):(Te.pointerLines.right.points.visible=!1,Te.pointerLines.right.setPoints(st,Ze[0].point));var be=Ze[0],De=createEvent("intersect.update",{raycaster:(p=Te.xrControllerRay.right)!==null&&p!==void 0?p:null,intersection:be!=null?be:null,object:Te.intersectMesh});if(Te.emit("intersect.update",De),De.defaultPrevented)return Te.hideIntersectMesh(),{value:void 0}}else Te.pointerLines.left.setPoints(st,Ze[0].point)},Te=this,de=0;de<ve.length;de++){var Le=Ke(de);if(typeof Le=="object")return Le.value}this.updateControllerHelper(ve,e,r)}}else ae||console.error("xrFrame丢失,请重试"),this.xrManager.session||console.error("session丢失,请重试"),this.xrManager.session&&!this.xrManager.session.renderState.baseLayer&&console.error("no layer found");isEmptyObject(y)===!1&&this.modelScene.parameter.set(y),this.emit("camera.update",createEvent("camera.update",{userAction:this.userAction,state:__assign(__assign(__assign({},this.currentPano),{mode:this.mode}),clonePose(this.camera.pose))}));var Me=this.works.getResolvedObserver(this.currentPano),$e=this.locationMotion.ended?this.getForwardObserverOrNot(this.xrManager.cameraVR):null,tt=this.works.getObserver(R.panoId),ke=this.works.getObserver(w.panoId);if(this.adjustPanoCircleMeshPositionBasedOnModel&&this.helper.visible&&Me){for(var Ie=[],He=Me.work.observers,Ee=0,we=Me.accessibleNodes;Ee<we.length;Ee++){var Pe=we[Ee],U=He[Pe];U&&Ie.push(U)}var je=new Map;if(Ie.sort(function(pe,xe){var Se=je.get(pe);typeof Se=="undefined"&&(Se=pe.standingPosition.distanceTo(Me.standingPosition),je.set(pe,Se));var Oe=je.get(pe);return typeof Oe=="undefined"&&(Oe=xe.standingPosition.distanceTo(Me.standingPosition),je.set(xe,Oe)),Se-Oe}),Ie.length){this.accessibleObserverFloorCheckCount=this.accessibleObserverFloorCheckCount%Ie.length;var Qe=Ie[this.accessibleObserverFloorCheckCount],We=this.modelScene.models.find(function(pe){return pe.work===(Qe==null?void 0:Qe.work)});if(Qe&&We&&We.visible){var gt=.3,Je=.05,At=.005,Re=Qe.standingPosition.clone().applyMatrix4(Qe.work.transform),Ue=panoStringify({panoIndex:Qe.panoIndex,workCode:Qe.work.workCode}),yt=adjustPanoCircleMeshVectors.map(function(pe){scratchRaycaster.ray.origin.copy(Re),scratchRaycaster.ray.origin.add(scratchVector3.copy(pe).setY(gt)),scratchRaycaster.ray.direction.set(0,-1,0),scratchRaycaster.firstHitOnly=!0,scratchRaycaster.floorIndex=-1;var xe=We.intersectRaycaster(scratchRaycaster)[0];return xe&&xe.distance-At<=gt?new THREE__namespace.Vector3().copy(Re).setY(xe.point.y+At):Re});yt.sort(function(pe,xe){return xe.y-pe.y});var Ct=yt[Math.floor(yt.length/2)],Et=yt.filter(function(pe){return pe.distanceTo(Ct)<=Je})[0];if(Et){var dt=new THREE__namespace.Vector4(Re.x,Re.y,Re.z,Et.y-Re.y),ht=this.adjustPanoCircleMeshPositionFix.get(Ue);ht&&!dt.equals(ht)&&(this.needsRender=!0),this.adjustPanoCircleMeshPositionFix.set(Ue,dt)}}this.accessibleObserverFloorCheckCount++}}var ze=new Map;if(tt)for(var ut=0,rt=tt.accessibleNodes;ut<rt.length;ut++){var Pe=rt[ut],U=tt.work.observers[Pe];if(U){var Ue=panoStringify({panoIndex:U.panoIndex,workCode:U.work.workCode});ze.set(Ue,U)}}if(ke)for(var ue=0,Ae=ke.accessibleNodes;ue<Ae.length;ue++){var Pe=Ae[ue],U=ke.work.observers[Pe];if(U){var Ue=panoStringify({panoIndex:U.panoIndex,workCode:U.work.workCode});ze.set(Ue,U)}}if(this.panoMeshes.forEach(function(pe,xe){var Se=ze.get(xe);if(Se){pe.position.copy(Se.standingPosition).applyMatrix4(Se.work.transform);var Oe=o.adjustPanoCircleMeshPositionFix.get(xe);Oe&&(scratchVector3.set(Oe.x,Oe.y,Oe.z),scratchVector3.equals(pe.position)&&(pe.position.y+=Oe.w)),pe.scale.setScalar(1.2),ze.delete(xe)}else o.helper.remove(pe),pe.dispose(),o.panoMeshes.delete(xe)}),ze.forEach(function(pe,xe){var Se=o.panoCircleMeshCreator(panoParse(xe));Se.position.copy(pe.standingPosition).applyMatrix4(pe.work.transform);var Oe=o.adjustPanoCircleMeshPositionFix.get(xe);Oe&&(scratchVector3.set(Oe.x,Oe.y,Oe.z),scratchVector3.equals(Se.position)&&(Se.position.y+=Oe.w)),Se.scale.setScalar(1.2),o.panoMeshes.set(xe,Se),o.helper.add(Se),ze.delete(xe)}),this.camera.pose.distance>.1||C)this.panoMeshes.forEach(function(pe){pe.setOpacity(0),pe.setCurrent(!1),pe.updateTime&&pe.updateTime(e,r),pe.visible=!1});else if(Me){var Ce=Me.work.observers,Be=arrayMin(Me.accessibleNodes,function(pe){var xe=Ce[pe];return xe?Me.standingPosition.distanceTo(xe.standingPosition):1/0},!0),nt=Be[1];nt=clamp$1(nt,2.5,1/0);var ct=Me.visibleNodes.concat(Me.panoIndex).map(function(pe){return panoStringify({panoIndex:pe,workCode:Me.work.workCode})}),bt=this.camera.getDirection(new THREE__namespace.Vector3);this.panoMeshes.forEach(function(pe,xe){var Se=o.works.getObserver(xe);if(ct.indexOf(xe)===-1)pe.setCurrent(!1),pe.setOpacity(0);else if(!Se)pe.setCurrent(!1),pe.setOpacity(0);else if(!Se.loadable&&!Se.active)pe.setCurrent(!1),pe.setOpacity(0);else{var Oe=pe.position.clone().setY(o.camera.position.y).distanceTo(o.camera.position);pe.setCurrent(!pe.loading&&pe.progress===0&&$e!==null&&panoStringify({panoIndex:$e.panoIndex,workCode:$e.work.workCode})===xe),pe.setOpacity(Oe<.01?0:clamp$1(nt/Oe*1.2,.65,.98));var Pt=o.camera.position.clone().setY(pe.position.y),st=new THREE__namespace.Vector3().copy(pe.position).sub(Pt).normalize();if(xe===panoStringify(o.currentPano)){var Ze=clamp$1((.5-Pt.distanceTo(pe.position))/.5,0,1);st.multiplyScalar(1-Ze).add(bt.clone().multiplyScalar(Ze))}st.length()>0&&pe.quaternion.setFromEuler(new THREE__namespace.Euler(0,Math.atan2(st.x,st.z),0))}pe.updateTime&&pe.updateTime(e,r)})}{var N=(f=this.modelScene.parameter.progress)!==null&&f!==void 0?f:1,Bt=Math.round(N),at=this.modelScene.parameter.pano0,pt=this.modelScene.parameter.pano1,Tt=Bt===0?at:pt,U=void 0;if(Tt&&(U=this.works.getObserver(Tt.panoId),U||(U=this.panoPictureObserverMap.get(Tt))),this.tiling.appearDuration=this.tileAppearDuration,this.tiling.maxRequest=N<.6?0:this.tileMaxRequest,this.tiling.imageOptions=this.imageOptions,!U||!Tt||this.tileLevelForFov===!1||this.camera.perspToOrtho.x>0){this.tiling.setObserver(null);var Mt={renderer:this.renderer,resolution:ie,pixelRatio:1,time:this.camera.time,cameraMatrix:this.xrManager.cameraVR.matrixWorld,cameraProjectionMatrix:this.xrManager.cameraVR.projectionMatrix,panoMap:null,panoMatrix:new THREE__namespace.Matrix4,panoZoom:1,minLevel:0,level:0};this.tiling.update(Mt),this.modelScene.parameter.set("refinedScreen",null)}else{var it=getImageSizeLevel(Tt.mapSize),It=it+1,_t=4;this.tiling.setObserver(U);var Mt={renderer:this.renderer,resolution:ie,pixelRatio:1,time:this.camera.time,cameraMatrix:this.xrManager.cameraVR.matrixWorld,cameraProjectionMatrix:this.xrManager.cameraVR.projectionMatrix,panoMap:Tt.map,panoMatrix:Tt.matrix,panoZoom:Tt.zoom,minLevel:It,level:_t},vt=this.tiling.update(Mt),xt={map:this.tiling.renderTarget.texture,matrixInverse:this.tiling.camera.matrixWorldInverse,projectionMatrix:this.tiling.camera.projectionMatrix,pano:Bt,opacity:(at==null?void 0:at.panoId)===(pt==null?void 0:pt.panoId)?1:easeInQuart(Math.abs(((d=this.modelScene.parameter.progress)!==null&&d!==void 0?d:0)-.5)*2)},Ge=this.modelScene.parameter.refinedScreen;(vt||xt.pano!==(Ge==null?void 0:Ge.pano)||xt.opacity!==(Ge==null?void 0:Ge.opacity))&&this.modelScene.parameter.set("refinedScreen",xt)}}if(this.panoVideo.object.position.copy(this.camera.position),this.panoVideo.updateTime(e),this.intersectMesh&&this.intersectMesh.parent&&Me&&Me.position.y-Me.standingPosition.y>10){var mt=this.camera.position.distanceTo(this.intersectMesh.position),Ot=2*Math.tan(.5*this.camera.fov/180*Math.PI),Lt=mt*Ot/5;this.intersectMesh.scale.setScalar(Lt)}else this.intersectMesh.scale.setScalar(1);{var Ht=w.effect,ot=this.modelScene.parameter,at=ot.pano0,pt=ot.pano1;if(at&&pt&&at!==pt&&Ht==="fly"&&this.flyEffectUseDepthBuffer){if(((h=this.modelScene.parameter.pano0Depth)===null||h===void 0?void 0:h.panoId)!==at.panoId||((m=this.modelScene.parameter.pano1Depth)===null||m===void 0?void 0:m.panoId)!==pt.panoId){var St=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 Rt=new THREE__namespace.CubeCamera(this.camera.near,this.camera.far,this.pano0DepthCubeRenderTarget);Rt.matrix.copy(at.matrix),Rt.matrixWorld.copy(Rt.matrix),Rt.matrixAutoUpdate=!1,renderDepthCube(this.renderer,this.modelScene,Rt,St);var wt=new THREE__namespace.CubeCamera(this.camera.near,this.camera.far,this.pano1DepthCubeRenderTarget);wt.matrix.copy(pt.matrix),wt.matrixWorld.copy(wt.matrix),wt.matrixAutoUpdate=!1,renderDepthCube(this.renderer,this.modelScene,wt,St),this.modelScene.parameter.set({pano0Depth:{panoId:at.panoId,map:this.pano0DepthCubeRenderTarget.texture,mapSize:this.pano0DepthCubeRenderTarget.width,maxDepth:St},pano1Depth:{panoId:pt.panoId,map:this.pano1DepthCubeRenderTarget.texture,mapSize:this.pano1DepthCubeRenderTarget.width,maxDepth:St}})}}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.renderer.setScissorTest(!1);var e=this.xrManager.cameraVR;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,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";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},e.src=textureURL,material.map=t}}var FRAGMENT$2=`
2133
+ `},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,m=new THREE__namespace.Vector4,A=new THREE__namespace.Vector4,g=new THREE__namespace.Vector4,y=new THREE__namespace.Vector3,v=new THREE__namespace.Matrix4,E=new THREE__namespace.Line3,b=new THREE__namespace.Vector3;o.at(1,g),g.w=1,g.applyMatrix4(s.matrixWorldInverse),g.applyMatrix4(u),g.multiplyScalar(1/g.w),g.x*=p.x/2,g.y*=p.y/2,g.z=0,y.copy(g);var T=this.matrixWorld;v.multiplyMatrices(s.matrixWorldInverse,T);for(var _=0,S=d.count;_<S;_++){m.fromBufferAttribute(d,_),A.fromBufferAttribute(h,_),m.w=1,A.w=1,m.applyMatrix4(v),A.applyMatrix4(v),m.applyMatrix4(u),A.applyMatrix4(u),m.multiplyScalar(1/m.w),A.multiplyScalar(1/A.w);var R=m.z<-1&&A.z<-1,w=m.z>1&&A.z>1;if(!(R||w)){m.x*=p.x/2,m.y*=p.y/2,A.x*=p.x/2,A.y*=p.y/2,E.start.copy(m),E.start.z=0,E.end.copy(A),E.end.z=0;var M=E.closestPointToPointParameter(y,!0);E.at(M,b);var B=THREE__namespace.MathUtils.lerp(m.z,A.z,M),C=B>=-1&&B<=1,P=y.distanceTo(b)<f*.5;if(C&&P){E.start.fromBufferAttribute(d,_),E.end.fromBufferAttribute(h,_),E.start.applyMatrix4(T),E.end.applyMatrix4(T);var L=new THREE__namespace.Vector3,O=new THREE__namespace.Vector3;o.distanceSqToSegment(E.start,E.end,O,L),r.push({point:O,pointOnLine:L,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.7.0-alpha.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={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(m){var A=u[m];return A&&(l={profileId:m,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,m=p.valueNodeProperty;if(m===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.left.firstHitOnly=!0,r.xrControllerRay.left.floorIndex=-1,r.xrControllerRay.right.params.Points={threshold:.1},r.xrControllerRay.right.firstHitOnly=!0,r.xrControllerRay.right.floorIndex=-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=(u=r.effect)!==null&&u!==void 0?u:"fade";this.userAction=o,this.stopMomentumMovement();var p=panoStringify(e),f=this.works.getObserver(e);if(!f)throw new Error("Invalid PanoIndex");getImageSizeFromURL(f.images.up),this.imageOptions.size;var d=this.imageOptions.transform,h=function(R,w){return mapPanoResource(applyImageURLOptions(R,d,w))},m=__assign({key:"pano.".concat(p)},pick(this.imageOptions,["format","size","quality"])),A={right:f.images.work.getURL(f.images.right),left:f.images.work.getURL(f.images.left),up:f.images.work.getURL(f.images.up),down:f.images.work.getURL(f.images.down),front:f.images.work.getURL(f.images.front),back:f.images.work.getURL(f.images.back)},g="pano:"+jsonHash([A,m,d]);if(this.pendingTextureTask){if(this.pendingTextureTask.hash===g)return;var y=this.pendingTextureTask.panoId;(l=this.panoMeshes.get(y))===null||l===void 0||l.setProgress(0),this.emit("pano.texture.abort",createEvent("pano.texture.abort",{error:null,progress:0,meta:null,pano:e}))}var v=this.modelScene.parameter.resolveValue(),E=v.pano0,b=v.pano1,T;if((E==null?void 0:E.map.name)===g?T=E:(b==null?void 0:b.map.name)===g&&(T=b),T){var _={panoId:p,effect:c,leftPanoPicture:{panoId:T.panoId,map:T.map,mapSize:T.mapSize,matrix:f.matrix.clone().premultiply(f.work.transform),zoom:1},position:f.position.clone().applyMatrix4(f.work.transform),fixCameraTransform:new THREE__namespace.Matrix4};this.doMoveToPano(e,_,r);return}var S="move-to-pano-"+p;this.pending.add(S),this.pendingTextureTask={panoId:p,hash:g,onLoad:function(R){var w;s.pending.delete(S);var M=R.body;if(s.destroyed)M.dispose();else{M.name=g;var B=Array.isArray(M.image)?M.image[0]:M.image,C=(w=B==null?void 0:B.width)!==null&&w!==void 0?w:2048,P={panoId:p,effect:c,leftPanoPicture:{panoId:p,map:M,mapSize:C,matrix:f.matrix.clone(),zoom:1},position:f.position.clone(),fixCameraTransform:new THREE__namespace.Matrix4};s.doMoveToPano(e,P,r)}},onError:function(R){s.pending.delete(S);var w=__assign(__assign(__assign({},e),{mode:s.mode}),clonePose(s.camera.pose));s.emit("pano.error",createEvent("pano.error",{error:R,userAction:s.userAction,options:r,prevPano:s.currentPano,progress:0,state:w})),s.emit("pano.cancel",createEvent("pano.cancel",{error:null,userAction:s.userAction,options:r,prevPano:s.currentPano,progress:0,state:w})),r.moveCancelCallback&&r.moveCancelCallback()}},this.textureLoader.loadCubeTexture(A,{imageURL:{transform:h,options:m},format:THREE__namespace.RGBAFormat,fetcher:getFetcher(f.work)},void 0,void 0,function(R){var w,M;((w=s.pendingTextureTask)===null||w===void 0?void 0:w.hash)===g&&((M=s.panoMeshes.get(p))===null||M===void 0||M.setProgress(R)),s.emit("pano.texture.progress",createEvent("pano.texture.progress",{error:null,progress:R,meta:null,pano:e}))},this.renderer).then(function(R){var w,M;((w=s.pendingTextureTask)===null||w===void 0?void 0:w.hash)===g?(s.pendingTextureTask.onLoad(R),(M=s.panoMeshes.get(p))===null||M===void 0||M.setProgress(0),s.pendingTextureTask=void 0,s.emit("pano.texture.success",createEvent("pano.texture.success",{error:null,progress:1,meta:R.meta,pano:e}))):R.body.dispose()}).catch(function(R){var w,M;((w=s.pendingTextureTask)===null||w===void 0?void 0:w.hash)===g&&(s.pendingTextureTask.onError(R),(M=s.panoMeshes.get(p))===null||M===void 0||M.setProgress(0),s.pendingTextureTask=void 0,s.emit("pano.texture.error",createEvent("pano.texture.error",{error:R,progress:0,meta:null,pano:e})),s.emit("error",R))}),this.emit("pano.texture.load",createEvent("pano.texture.load",{error:null,progress:0,meta:null,pano:e}))},t.prototype.doMoveToPano=function(e,r,o){var s=this,u,l,c,p,f,d,h,m,A,g;o===void 0&&(o={});var y=now(),v=createUuid();this.panoResources[v]=r;var E=1,b,T,_;if(this.locationMotion.ended){var S=this.locationMotion.getKeyFrameSegment(y);S[0];var R=S[1],w=this.locationMotion.value,M=this.panoResourceFromLocationMotionKeyframe(R).position,B=r.position;b=Math.max(M.distanceTo(B),E),T=[{key:R.key,progress:0,value:__assign(__assign({},w),{count:0})},{key:v,progress:1,value:{distance:0,count:1}}],_=0}else{var C=this.locationMotion.getKeyFrameSegment(y),P=C[0],R=C[1],w=this.locationMotion.value,L=this.panoResourceFromLocationMotionKeyframe(P).position,M=this.panoResourceFromLocationMotionKeyframe(R).position,B=r.position,O=R.value.count-w.count,F=Math.max(L.distanceTo(M),E)*O,N=Math.max(M.distanceTo(B),E);b=F+N,T=[{key:P.key,progress:0,value:__assign({},w)},{key:R.key,progress:F/b,value:R.value},{key:v,progress:1,value:{count:R.value.count+1,distance:0}}];var D=this.locationMotionKeyframesLength(this.locationMotion.keyframes),U=this.locationMotionKeyframesLength(T);_=this.locationMotion.getProgressVelocity(y)*D/U}var z=r.effect==="instant"?0:this.calculateMovingDuration(o.duration,r.effect==="fly"?b:0),K={longitude:o.longitude,latitude:o.latitude,fov:o.fov},j=__assign(__assign({},e),{mode:this.mode,longitude:(u=K.longitude)!==null&&u!==void 0?u:this.camera.pose.longitude,latitude:(l=K.latitude)!==null&&l!==void 0?l:this.camera.pose.latitude,fov:(c=K.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:j,userAction:this.userAction,error:null})),o.moveStartCallback&&o.moveStartCallback(j),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,this.videoTexture.needsUpdate=!0),this.panoVideo.setMaterial(null),r.effect==="fly")this.cameraMotion.set(K,z).catch(noop);else{var V=coordinatesToVector({longitude:this.cameraMotion.value.longitude,latitude:this.cameraMotion.value.latitude}),J=coordinatesToVector({longitude:(p=K.longitude)!==null&&p!==void 0?p:this.cameraMotion.value.longitude,latitude:(f=K.latitude)!==null&&f!==void 0?f:this.cameraMotion.value.latitude}),W=new THREE__namespace.Object3D;W.lookAt(V);var X=new THREE__namespace.Matrix4().makeRotationFromQuaternion(W.quaternion);W.lookAt(J);var Z=new THREE__namespace.Matrix4().makeRotationFromQuaternion(W.quaternion),Y=new THREE__namespace.Matrix4().getInverse(X).premultiply(Z),G=this.cameraMotion.value.fov,ee=(d=K.fov)!==null&&d!==void 0?d:this.cameraMotion.value.fov,te=1;r.effect==="zoomin"?te=1.5:r.effect==="zoomout"&&(te=.4);for(var ne=ee*te,ae=0;ae<T.length-1;ae++){var ce=T[ae].key;if(ce){var ie=this.panoResources[ce];ie&&(ie.fixCameraTransform.copy(Y),ie.leftPanoPicture&&(ie.leftPanoPicture.zoom=Math.tan(ne/2/180*Math.PI)/Math.tan(G/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=K.longitude)!==null&&h!==void 0?h:this.cameraMotion.value.longitude,latitude:(m=K.latitude)!==null&&m!==void 0?m:this.cameraMotion.value.latitude,fov:ne}},{progress:1,value:{longitude:(A=K.longitude)!==null&&A!==void 0?A:this.cameraMotion.value.longitude,latitude:(g=K.latitude)!==null&&g!==void 0?g:this.cameraMotion.value.latitude,fov:ee}}],z).catch(noop)}var fe=this.locationMotion.setKeyframes(T,z,_);fe.then(function(){for(var ge=0,ye=s.modelScene.children;ge<ye.length;ge++){var _e=ye[ge];_e instanceof Model&&_e.show()}var le=__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:le,userAction:s.userAction,error:null})),o.moveEndCallback&&o.moveEndCallback(le);var de=s.works.getObserver(s.currentPano);if(de&&de.video&&s.videoTexture&&s.videoTexture.image instanceof HTMLVideoElement){var re={map:s.videoTexture,size:de.video.size.clone(),matrix:de.video.matrix.clone(),panoMatrix:de.matrix.clone().premultiply(de.work.transform),alpha:1},se=createUuid(),he=s.videoTexture.image;he.setAttribute("uuid",se),canplayVideo().then(function(me){me&&de.video&&he.getAttribute("uuid")===se&&(he.oncanplay=function(){he.oncanplay=noop,he.play()},he.ontimeupdate=function(){he.currentTime>.5&&(he.ontimeupdate=noop,s.panoVideo.setMaterial(re))},he.src=de.video.source)}).catch((function(){he.removeAttribute("uuid")}))}},function(){s.emit("pano.cancel",createEvent("pano.cancel",{options:o,prevPano:Q,progress:0,state:j,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.getObserver(this.currentPano);if(!u)return null;var l=u.work.observers,c=u.accessibleNodes.filter(function(_){if(_===r.currentPano.panoIndex&&u.work.workCode===r.currentPano.workCode)return!1;var S=l[_];if(!S)return!1;var R=scratchVector3.copy(S.position).applyMatrix4(S.work.transform);return R.distanceTo(r.camera.position)>r.maxAccessibleDistance?!1:S.loadable||S.active}),p=this.modelScene.intersectRaycaster(e)[0];if(p){var f=arrayMin(c,function(_){var S=l[_];if(!S)return 1/0;var R=scratchVector3.copy(S.standingPosition).applyMatrix4(S.work.transform);return R.distanceTo(p.point)},!0),d=f[0],h=f[1];typeof d=="number"&&h<this.panoTapTriggerRadius&&(s=(o=l[d])!==null&&o!==void 0?o:null)}if(isNil(s)){var m=this.getForwardObserverOrNot(this.xrManager.cameraVR,e);m&&(s=m)}for(var A=0,g=this.locationMotion.keyframes;A<g.length;A++){var y=g[A],v=this.panoResourceFromLocationMotionKeyframe(y);if(!(y.progress<this.locationMotion.progress)&&s){var E=panoStringify({panoIndex:s.panoIndex,workCode:s.work.workCode});if(v.panoId===E){s=null;break}}}if(isNil(s))return this.locationMotion.ended===!0&&this.cameraBounce(),null;if(!s.active){var E=panoStringify({panoIndex:s.panoIndex,workCode:s.work.workCode}),b=this.panoMeshes.get(E);b&&(b.setDisabled(!1),b.setLoading(!0))}var T={workCode:s.work.workCode,panoIndex:s.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:T,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:T,options:{},error:null})),{workCode:s.work.workCode,panoIndex:s.panoIndex}):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,m,A=[],g=2;g<arguments.length;g++)A[g-2]=arguments[g];this.userAction=!0;var y={},v={},E=this.locationMotion.keyframes[0],b=this.locationMotion.keyframes[this.locationMotion.keyframes.length-1],T=this.locationMotion.getKeyFrameSegment(e),_=T[0],S=T[1],R=this.panoResourceFromLocationMotionKeyframe(_),w=this.panoResourceFromLocationMotionKeyframe(S),M=this.panoResourceFromLocationMotionKeyframe(E),B=this.panoResourceFromLocationMotionKeyframe(b),C=!1;if(this.cameraMotion.ended===!1&&(this.cameraMotion.update(e),v.fov=this.cameraMotion.value.fov),this.modelAlphaMotion.ended===!1&&(this.modelAlphaMotion.update(e),y.modelAlpha=this.modelAlphaMotion.value.modelAlpha),this.perspToOrthoMotion.ended===!1&&(this.perspToOrthoMotion.update(e),this.camera.perspToOrtho.setScalar(clamp$1(this.perspToOrthoMotion.value.perspToOrtho,0,1))),this.locationMotion.ended===!1){this.locationMotion.update(e);var P=this.locationMotion.getKeyFrameSegment(e);P[0];var L=P[1],O=new THREE__namespace.Vector3().copy(R.position),F=new THREE__namespace.Vector3().copy(w.position),N=this.locationMotion.value.count-L.value.count+1;if(y.progress=N,w.leftPanoPicture&&(N<1?R.leftPanoPicture&&(y.pano0=R.leftPanoPicture):y.pano0=w.leftPanoPicture,y.pano1=w.leftPanoPicture),w.effect==="montage"?y.transition="BLACK":w.effect==="spread"?y.transition="SPREAD":y.transition="FADE",(w.effect==="zoomin"||w.effect==="zoomout")&&(y.progress=Math.pow(N,3)),N<1&&w.effect!=="fly"){if(y.pano0&&R.leftPanoPicture){var D={panoId:y.pano0.panoId,map:y.pano0.map,mapSize:y.pano0.mapSize,zoom:y.pano0.zoom,matrix:R.leftPanoPicture.matrix.clone().setPosition(w.position)},U=this.panoPictureObserverMap.get(y.pano0);U&&this.panoPictureObserverMap.set(D,U),y.pano0=D}O.copy(F),C=!0}v.distance=this.locationMotion.value.distance,v.offset=new THREE__namespace.Vector3(O.x+(F.x-O.x)*N,O.y+(F.y-O.y)*N,O.z+(F.z-O.z)*N);for(var z=[],K=[],j=0,Q=this.locationMotion.keyframes;j<Q.length;j++){var V=Q[j],J=V.key,W=V.progress;J!==void 0&&(z.push(J),W>this.locationMotion.progress&&K.push(J))}for(var X=0,Z=Object.keys(this.panoResources);X<Z.length;X++){var Y=Z[X];if(!(K.indexOf(Y)>=0)){var G=this.panoResources[Y];if(G.leftPanoPicture){var ee=G.leftPanoPicture.map;if(ee){if(ee===((s=y.pano0)===null||s===void 0?void 0:s.map)||ee===((u=y.pano1)===null||u===void 0?void 0:u.map))continue;ee.dispose(),G.leftPanoPicture=null}}z.indexOf(Y)>=0||delete this.panoResources[Y]}}var te=panoParse(w.panoId);te!==this.currentPano&&(this.currentPano=te,this.accessibleObserverFloorCheckCount=0),this.emit("pano.moving",createEvent("pano.moving",{userAction:this.userAction,prevPano:panoParse(M.panoId),state:__assign(__assign(__assign(__assign({},panoParse(B.panoId)),{mode:this.mode}),clonePose(this.camera.pose)),v),options:{},progress:this.locationMotion.progress,error:null}))}this.camera.setFromPose(v),this.xrManager.cameraVR.projectionMatrix.copy(this.camera.projectionMatrix),this.xrManager.cameraVR.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),this.xrManager.cameraVR.matrix.copy(this.camera.matrix),this.xrManager.cameraVR.position.copy(this.camera.position),this.xrManager.cameraVR.quaternion.copy(this.camera.quaternion),this.xrManager.cameraVR.scale.copy(this.camera.scale),this.xrManager.cameraVR.matrixAutoUpdate=!1,this.xrManager.cameraVR.matrixWorld.copy(this.camera.matrixWorld);var ne=A,ae=ne[1],ce=new THREE__namespace.Vector3(0,0,0),ie=new THREE__namespace.Vector2().copy(this.camera.resolution);if(ae&&this.xrManager.session&&this.xrManager.referenceSpace&&this.xrManager.session.renderState.baseLayer){var fe=this.xrManager.cameraVR,ge=this.xrManager.referenceSpace,ye=this.xrManager.session.renderState.baseLayer,_e=ae.getViewerPose(ge),le=(l=_e==null?void 0:_e.views)!==null&&l!==void 0?l:[];this.renderer.setFramebuffer(ye.framebuffer);for(var de=0;de<le.length;de++){var re=le[de],se=fe.cameras[de],he=ye.getViewport(re);he&&(se.projectionMatrix.fromArray(re.projectionMatrix),se.projectionMatrixInverse.getInverse(se.projectionMatrix),se.matrix.fromArray(re.transform.matrix),se.matrix.setPosition(this.camera.position),se.matrix.decompose(se.position,se.quaternion,se.scale),se.matrixWorld.copy(se.matrix),se.matrixWorldInverse.getInverse(se.matrixWorld),se.matrixAutoUpdate=!1,ce.copy(se.position),se.viewport.set(he.x,he.y,he.width,he.height),ie.set(he.width,he.height))}if(this.xrManager.setProjectionFromUnion(this.xrManager.cameraVR,this.xrManager.cameraL,this.xrManager.cameraR),this.camera.quaternion.copy(this.xrManager.cameraVR.quaternion),this.camera.scale.copy(this.xrManager.cameraVR.scale),this.camera.matrix.compose(this.camera.position,this.camera.quaternion,this.camera.scale),this.camera.computePose((c=v.distance)!==null&&c!==void 0?c:this.camera.pose.distance),this.xrManager.session&&this.xrManager.session.inputSources){for(var de=0;de<this.xrManager.session.inputSources.length;de++)if(this.xrManager.session.inputSources[de]&&this.xrManager.session.inputSources[de].targetRayMode==="transient-pointer"){var me=ae.getPose(this.xrManager.session.inputSources[de].targetRaySpace,ge);if(me){var Ne=me.transform.orientation,qe=new THREE__namespace.Quaternion(Ne.x,Ne.y,Ne.z,Ne.w),Ye=new THREE__namespace.Vector3(0,0,-1).applyQuaternion(qe),Ve=new THREE__namespace.Raycaster(this.camera.position,Ye);this.gazeRay=Ve}}}if(this.xrManager.machineType==="Oculus"||this.xrManager.machineType==="Pico"){for(var ve=this.xrManager.session.inputSources,Ke=function(pe){var xe=Te.xrManager.controllers[pe],Se=ve[pe];if(!Se)return"continue";xe&&xe.update(Se,ae,ge);var Oe=Te.xrManager.getController(pe),Pt=new THREE__namespace.Vector3(0,1.2,0),st=Oe.position.clone().add(ce).sub(Pt);Se.handedness==="left"?Te.xrControllerRay.left.set(st,new THREE__namespace.Vector3(0,0,-1).applyEuler(Oe.rotation)):Se.handedness==="right"&&Te.xrControllerRay.right.set(st,new THREE__namespace.Vector3(0,0,-1).applyEuler(Oe.rotation)),Te.controllerWrappers[pe].position.copy(new THREE__namespace.Vector3(0,0,0).add(ce).sub(Pt));var Ze=Te.modelScene.intersectRaycaster(Te.xrControllerRay.right);if(Ze.length===0){var Ft=Te.works.getResolvedObserver(Te.currentPano);Ze=Te.xrControllerRay.right.intersectObject(Te.boundingMesh,!0).map(function(Xe){var Fe,lt=(Fe=Ft==null?void 0:Ft.floorIndex)!==null&&Fe!==void 0?Fe:0;return __assign({floorIndex:lt,floor:lt},Xe)})}if(Ze.length>=1&&Ze[0].face)if(Se.handedness==="right"){var I=Te.xrControllerRay.right.intersectObject(Te.xrCustomObjectsScene,!0),H=Ze[0].face.normal,k=H.clone(),q=Ze[0].point.clone();Te.intersectMesh.position.copy(q);var $=q.clone().add(k);if(Te.intersectMesh.lookAt($),Math.abs(H.y)>.99){var oe=Te.camera.position.clone().sub(q);Te.intersectMesh.rotation.z=-Math.atan2(oe.z,oe.x)}Te.intersectMesh.visible=!0,Te.needsRender=!0,I.length>0?(Te.pointerLines.right.setPoints(st,I[0].point),Te.pointerLines.right.points.visible=!0,Te.intersectMesh.visible=!1):(Te.pointerLines.right.points.visible=!1,Te.pointerLines.right.setPoints(st,Ze[0].point));var be=Ze[0],De=createEvent("intersect.update",{raycaster:(p=Te.xrControllerRay.right)!==null&&p!==void 0?p:null,intersection:be!=null?be:null,object:Te.intersectMesh});if(Te.emit("intersect.update",De),De.defaultPrevented)return Te.hideIntersectMesh(),{value:void 0}}else Te.pointerLines.left.setPoints(st,Ze[0].point)},Te=this,de=0;de<ve.length;de++){var Le=Ke(de);if(typeof Le=="object")return Le.value}this.updateControllerHelper(ve,e,r)}}else ae||console.error("xrFrame丢失,请重试"),this.xrManager.session||console.error("session丢失,请重试"),this.xrManager.session&&!this.xrManager.session.renderState.baseLayer&&console.error("no layer found");isEmptyObject(y)===!1&&this.modelScene.parameter.set(y),this.emit("camera.update",createEvent("camera.update",{userAction:this.userAction,state:__assign(__assign(__assign({},this.currentPano),{mode:this.mode}),clonePose(this.camera.pose))}));var Me=this.works.getResolvedObserver(this.currentPano),$e=this.locationMotion.ended?this.getForwardObserverOrNot(this.xrManager.cameraVR):null,tt=this.works.getObserver(R.panoId),ke=this.works.getObserver(w.panoId);if(this.adjustPanoCircleMeshPositionBasedOnModel&&this.helper.visible&&Me){for(var Ie=[],He=Me.work.observers,Ee=0,we=Me.accessibleNodes;Ee<we.length;Ee++){var Pe=we[Ee],U=He[Pe];U&&Ie.push(U)}var je=new Map;if(Ie.sort(function(pe,xe){var Se=je.get(pe);typeof Se=="undefined"&&(Se=pe.standingPosition.distanceTo(Me.standingPosition),je.set(pe,Se));var Oe=je.get(pe);return typeof Oe=="undefined"&&(Oe=xe.standingPosition.distanceTo(Me.standingPosition),je.set(xe,Oe)),Se-Oe}),Ie.length){this.accessibleObserverFloorCheckCount=this.accessibleObserverFloorCheckCount%Ie.length;var Qe=Ie[this.accessibleObserverFloorCheckCount],We=this.modelScene.models.find(function(pe){return pe.work===(Qe==null?void 0:Qe.work)});if(Qe&&We&&We.visible){var gt=.3,Je=.05,At=.005,Re=Qe.standingPosition.clone().applyMatrix4(Qe.work.transform),Ue=panoStringify({panoIndex:Qe.panoIndex,workCode:Qe.work.workCode}),yt=adjustPanoCircleMeshVectors.map(function(pe){scratchRaycaster.ray.origin.copy(Re),scratchRaycaster.ray.origin.add(scratchVector3.copy(pe).setY(gt)),scratchRaycaster.ray.direction.set(0,-1,0),scratchRaycaster.firstHitOnly=!0,scratchRaycaster.floorIndex=-1;var xe=We.intersectRaycaster(scratchRaycaster)[0];return xe&&xe.distance-At<=gt?new THREE__namespace.Vector3().copy(Re).setY(xe.point.y+At):Re});yt.sort(function(pe,xe){return xe.y-pe.y});var Ct=yt[Math.floor(yt.length/2)],Et=yt.filter(function(pe){return pe.distanceTo(Ct)<=Je})[0];if(Et){var dt=new THREE__namespace.Vector4(Re.x,Re.y,Re.z,Et.y-Re.y),ht=this.adjustPanoCircleMeshPositionFix.get(Ue);ht&&!dt.equals(ht)&&(this.needsRender=!0),this.adjustPanoCircleMeshPositionFix.set(Ue,dt)}}this.accessibleObserverFloorCheckCount++}}var ze=new Map;if(tt)for(var ut=0,rt=tt.accessibleNodes;ut<rt.length;ut++){var Pe=rt[ut],U=tt.work.observers[Pe];if(U){var Ue=panoStringify({panoIndex:U.panoIndex,workCode:U.work.workCode});ze.set(Ue,U)}}if(ke)for(var ue=0,Ae=ke.accessibleNodes;ue<Ae.length;ue++){var Pe=Ae[ue],U=ke.work.observers[Pe];if(U){var Ue=panoStringify({panoIndex:U.panoIndex,workCode:U.work.workCode});ze.set(Ue,U)}}if(this.panoMeshes.forEach(function(pe,xe){var Se=ze.get(xe);if(Se){pe.position.copy(Se.standingPosition).applyMatrix4(Se.work.transform);var Oe=o.adjustPanoCircleMeshPositionFix.get(xe);Oe&&(scratchVector3.set(Oe.x,Oe.y,Oe.z),scratchVector3.equals(pe.position)&&(pe.position.y+=Oe.w)),pe.scale.setScalar(1.2),ze.delete(xe)}else o.helper.remove(pe),pe.dispose(),o.panoMeshes.delete(xe)}),ze.forEach(function(pe,xe){var Se=o.panoCircleMeshCreator(panoParse(xe));Se.position.copy(pe.standingPosition).applyMatrix4(pe.work.transform);var Oe=o.adjustPanoCircleMeshPositionFix.get(xe);Oe&&(scratchVector3.set(Oe.x,Oe.y,Oe.z),scratchVector3.equals(Se.position)&&(Se.position.y+=Oe.w)),Se.scale.setScalar(1.2),o.panoMeshes.set(xe,Se),o.helper.add(Se),ze.delete(xe)}),this.camera.pose.distance>.1||C)this.panoMeshes.forEach(function(pe){pe.setOpacity(0),pe.setCurrent(!1),pe.updateTime&&pe.updateTime(e,r),pe.visible=!1});else if(Me){var Ce=Me.work.observers,Be=arrayMin(Me.accessibleNodes,function(pe){var xe=Ce[pe];return xe?Me.standingPosition.distanceTo(xe.standingPosition):1/0},!0),nt=Be[1];nt=clamp$1(nt,2.5,1/0);var ct=Me.visibleNodes.concat(Me.panoIndex).map(function(pe){return panoStringify({panoIndex:pe,workCode:Me.work.workCode})}),bt=this.camera.getDirection(new THREE__namespace.Vector3);this.panoMeshes.forEach(function(pe,xe){var Se=o.works.getObserver(xe);if(ct.indexOf(xe)===-1)pe.setCurrent(!1),pe.setOpacity(0);else if(!Se)pe.setCurrent(!1),pe.setOpacity(0);else if(!Se.loadable&&!Se.active)pe.setCurrent(!1),pe.setOpacity(0);else{var Oe=pe.position.clone().setY(o.camera.position.y).distanceTo(o.camera.position);pe.setCurrent(!pe.loading&&pe.progress===0&&$e!==null&&panoStringify({panoIndex:$e.panoIndex,workCode:$e.work.workCode})===xe),pe.setOpacity(Oe<.01?0:clamp$1(nt/Oe*1.2,.65,.98));var Pt=o.camera.position.clone().setY(pe.position.y),st=new THREE__namespace.Vector3().copy(pe.position).sub(Pt).normalize();if(xe===panoStringify(o.currentPano)){var Ze=clamp$1((.5-Pt.distanceTo(pe.position))/.5,0,1);st.multiplyScalar(1-Ze).add(bt.clone().multiplyScalar(Ze))}st.length()>0&&pe.quaternion.setFromEuler(new THREE__namespace.Euler(0,Math.atan2(st.x,st.z),0))}pe.updateTime&&pe.updateTime(e,r)})}{var N=(f=this.modelScene.parameter.progress)!==null&&f!==void 0?f:1,Bt=Math.round(N),at=this.modelScene.parameter.pano0,pt=this.modelScene.parameter.pano1,Tt=Bt===0?at:pt,U=void 0;if(Tt&&(U=this.works.getObserver(Tt.panoId),U||(U=this.panoPictureObserverMap.get(Tt))),this.tiling.appearDuration=this.tileAppearDuration,this.tiling.maxRequest=N<.6?0:this.tileMaxRequest,this.tiling.imageOptions=this.imageOptions,!U||!Tt||this.tileLevelForFov===!1||this.camera.perspToOrtho.x>0){this.tiling.setObserver(null);var Mt={renderer:this.renderer,resolution:ie,pixelRatio:1,time:this.camera.time,cameraMatrix:this.xrManager.cameraVR.matrixWorld,cameraProjectionMatrix:this.xrManager.cameraVR.projectionMatrix,panoMap:null,panoMatrix:new THREE__namespace.Matrix4,panoZoom:1,minLevel:0,level:0};this.tiling.update(Mt),this.modelScene.parameter.set("refinedScreen",null)}else{var it=getImageSizeLevel(Tt.mapSize),It=it+1,_t=4;this.tiling.setObserver(U);var Mt={renderer:this.renderer,resolution:ie,pixelRatio:1,time:this.camera.time,cameraMatrix:this.xrManager.cameraVR.matrixWorld,cameraProjectionMatrix:this.xrManager.cameraVR.projectionMatrix,panoMap:Tt.map,panoMatrix:Tt.matrix,panoZoom:Tt.zoom,minLevel:It,level:_t},vt=this.tiling.update(Mt),xt={map:this.tiling.renderTarget.texture,matrixInverse:this.tiling.camera.matrixWorldInverse,projectionMatrix:this.tiling.camera.projectionMatrix,pano:Bt,opacity:(at==null?void 0:at.panoId)===(pt==null?void 0:pt.panoId)?1:easeInQuart(Math.abs(((d=this.modelScene.parameter.progress)!==null&&d!==void 0?d:0)-.5)*2)},Ge=this.modelScene.parameter.refinedScreen;(vt||xt.pano!==(Ge==null?void 0:Ge.pano)||xt.opacity!==(Ge==null?void 0:Ge.opacity))&&this.modelScene.parameter.set("refinedScreen",xt)}}if(this.panoVideo.object.position.copy(this.camera.position),this.panoVideo.updateTime(e),this.intersectMesh&&this.intersectMesh.parent&&Me&&Me.position.y-Me.standingPosition.y>10){var mt=this.camera.position.distanceTo(this.intersectMesh.position),Ot=2*Math.tan(.5*this.camera.fov/180*Math.PI),Lt=mt*Ot/5;this.intersectMesh.scale.setScalar(Lt)}else this.intersectMesh.scale.setScalar(1);{var Ht=w.effect,ot=this.modelScene.parameter,at=ot.pano0,pt=ot.pano1;if(at&&pt&&at!==pt&&Ht==="fly"&&this.flyEffectUseDepthBuffer){if(((h=this.modelScene.parameter.pano0Depth)===null||h===void 0?void 0:h.panoId)!==at.panoId||((m=this.modelScene.parameter.pano1Depth)===null||m===void 0?void 0:m.panoId)!==pt.panoId){var St=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 Rt=new THREE__namespace.CubeCamera(this.camera.near,this.camera.far,this.pano0DepthCubeRenderTarget);Rt.matrix.copy(at.matrix),Rt.matrixWorld.copy(Rt.matrix),Rt.matrixAutoUpdate=!1,renderDepthCube(this.renderer,this.modelScene,Rt,St);var wt=new THREE__namespace.CubeCamera(this.camera.near,this.camera.far,this.pano1DepthCubeRenderTarget);wt.matrix.copy(pt.matrix),wt.matrixWorld.copy(wt.matrix),wt.matrixAutoUpdate=!1,renderDepthCube(this.renderer,this.modelScene,wt,St),this.modelScene.parameter.set({pano0Depth:{panoId:at.panoId,map:this.pano0DepthCubeRenderTarget.texture,mapSize:this.pano0DepthCubeRenderTarget.width,maxDepth:St},pano1Depth:{panoId:pt.panoId,map:this.pano1DepthCubeRenderTarget.texture,mapSize:this.pano1DepthCubeRenderTarget.width,maxDepth:St}})}}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.renderer.setScissorTest(!1);var e=this.xrManager.cameraVR;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,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";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},e.src=textureURL,material.map=t}}var FRAGMENT$2=`
2134
2134
  precision mediump float;
2135
2135
  precision mediump int;
2136
2136
  uniform sampler2D depthBuffer;
@@ -2246,4 +2246,4 @@ void main() {
2246
2246
  rgb = clamp(lumCompressed * rgb, 0.0, 1.0);
2247
2247
  gl_FragColor = mix(inputColor, vec4(rgb, alpha), progress * 0.9);
2248
2248
  }
2249
- `})||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=1e3,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,scratchBox3=new THREE__namespace.Box3,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,m,A,g=n.call(this)||this;if(g.ident=createUuid(),typeof window!="undefined"&&(__FIVE_DEBUG__.instances[g.ident]=g),g.renderSwitch01=0,g.currentUpdateArgs={time:now(),args:[]},g.currentMode="Panorama",g.pano={workCode:"",panoIndex:0},g.needsRender=!1,g.modelSceneNeedsRender=!1,g.onlyRenderIfNeeds=(r=e.onlyRenderIfNeeds)!==null&&r!==void 0?r:!0,g.imageOptions=__assign({},(o=e.imageOptions)!==null&&o!==void 0?o:{}),g.textureOptions=__assign({},(s=e.textureOptions)!==null&&s!==void 0?s:{}),g.poweredByRealsee=(u=e.poweredByRealsee)!==null&&u!==void 0?u:!0,g.backgroundColor=new THREE__namespace.Color((l=e.backgroundColor)!==null&&l!==void 0?l:1579548),g.backgroundAlpha=(c=e.backgroundAlpha)!==null&&c!==void 0?c:1,g.extraElements=[],g.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)},g.fps={testCount:0,testTime:now()},g.modeChangeDuration=(p=e.modeChangeDuration)!==null&&p!==void 0?p:DEFAULT_MODE_CHANGE_DURATION,g.enableWheel=(f=e.enableWheel)!==null&&f!==void 0?f:!0,typeof window!="undefined")if("renderer"in e)e.renderer instanceof InternalWebGLRenderer&&g.throwError(new Error("cannot render a internal renderer")),g.renderer=e.renderer;else try{g.renderer=new InternalWebGLRenderer({preserveDrawingBuffer:e.preserveDrawingBuffer,antialias:e.antialias,webgl2:e.webgl2,logarithmicDepthBuffer:e.logarithmicDepthBuffer,precision:e.precision,powerPreference:e.powerPreference});var y=getViewportScale();g.renderer.setPixelRatio(y===1?window.devicePixelRatio:1),g.renderer.setSize(512,512),g.renderer.setClearColor(g.backgroundColor,g.backgroundAlpha)}catch(O){var v=O instanceof Error?O:new Error(String(O));g.throwError(v)}g.getPixelsRenderTarget=new THREE__namespace.WebGLRenderTarget(1,1,{encoding:(h=(d=g.renderer)===null||d===void 0?void 0:d.outputEncoding)!==null&&h!==void 0?h:THREE__namespace.sRGBEncoding,generateMipmaps:!1}),g.viewport=Object.assign({left:0,bottom:0,width:1,height:1},e.viewport),g.camera=new Camera(DEFAULT_CAMERA_FOV),g.scene=new Scene,g.xrCustomObjectsScene=new THREE__namespace.Scene,g.scene.add(g.xrCustomObjectsScene),g.scene.matrixAutoUpdate=!1,g.loadWorkTask=Promise.resolve(),g.requestProxy=(m=e.requestProxy)!==null&&m!==void 0?m:DEFAULT_REQUEST_PROXY,g.networkSubscribe=new NetworkSubscribe,g.networkSubscribe.on("network",function(O,F,N,D){var U;g.emit("network.resource",createEvent("network.resource",{source:O,requestType:F,requestState:N,detail:D})),(U=g.analysis)===null||U===void 0||U.network(g.works,O,F,N,D)}),g.boundingMesh=new BoundingMesh$1,g.boundingMesh.name="bounding",g.readyCallbacks=[],g.syncingState=!1,g.helperGroup=new THREE__namespace.Group,g.helperGroup.name="helper",g.helperGroup.matrixAutoUpdate=!1,g.scene.add(g.helperGroup);var E=new Model(emptyWorks[0]);worksMap.set(g,emptyWorks),g.modelScene=new ModelScene,g.modelScene.add(E),g.modelScene.add(g.boundingMesh),defineProperty(E,"loaded",{get:function(){return!1},set:function(O){}}),g.videoTexture=new THREE__namespace.VideoTexture(e.videoInstance||generateDefaultVideoElement());var b=initLights();g.scene.add(b);var T=new THREE__namespace.Group;defineProperty(T,"children",{get:function(){return b.children},set:function(O){b.children=O}}),defineProperty(T,"visible",{get:function(){return b.visible},set:function(O){b.visible=O}}),defineProperty(T,"name",{get:function(){return b.name},set:function(O){b.name=O}}),g.modelScene.add(T),g.state={mode:g.currentMode,workCode:g.pano.workCode,panoIndex:g.pano.panoIndex,longitude:g.camera.pose.longitude,latitude:g.camera.pose.latitude,fov:g.camera.pose.fov,offset:g.camera.pose.offset.clone(),distance:g.camera.pose.distance},g.stateSynced=!1,g.destroyed=!1,g.paused=!0,typeof window!="undefined"&&(e.play!==!1&&g.play(),g.stopAnimationLoop=AnimationFrameLoop.shared.add(function(O,F){for(var N=[],D=2;D<arguments.length;D++)N[D-2]=arguments[D];g.updateTime.apply(g,__spreadArray([O,F],N,!1))},!1,0,10));var _=function(){typeof document!="undefined"&&document.fullscreenElement===null&&g.currentMode==="VRPanorama"&&g.controller.emit("vr.requestExit",createEvent("vr.requestExit",{}))},S=function(){g.needsRender=!0,g.modelSceneNeedsRender=!0};if(typeof document!="undefined"&&document.addEventListener("fullscreenchange",_,!1),g.renderer&&g.renderer.domElement.addEventListener("webglcontextrestored",S,!1),g.removeEventListeners=function(){typeof document!="undefined"&&document.removeEventListener("fullscreenchange",_,!1),g.renderer&&g.renderer.domElement.removeEventListener("webglcontextrestored",S,!1)},g.plugins={},e.plugins&&e.plugins.length)for(var R=0,w=e.plugins;R<w.length;R++){var M=w[R];if(typeof M=="function")M(g);else if(Array.isArray(M)){var B=M[0],C=M[1],P=M[2];if(typeof B=="function"){var L=B(g,P);typeof C=="string"&&(g.plugins[C]?g.throwError(new Error("plugin name ".concat(C," is exists."))):g.plugins[C]=L)}}}return initLegacyEvent(g),g.enableLayeringRendering=(A=e.enableLayeringRendering)!==null&&A!==void 0?A:!1,g._buildInRendererType="default",g._builtinRenderer=null,g}return Object.defineProperty(t,"version",{get:function(){return"6.6.4"},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,"useNativeImageBitmap",{get:function(){return canUseNativeImageBitmap()},set:function(e){useNativeImageBitmap(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;if(this.destroyed!==!0){delete __FIVE_DEBUG__.instances[this.ident],this.emit("dispose"),this.destroyed=!0,this.pause(),this.stopAnimationLoop&&(this.stopAnimationLoop(),this.stopAnimationLoop=void 0),this.off(),this.networkSubscribe.off(),this.controller&&(this.controller.destroy(),this.controller=void 0);var r=this.getElement();r&&r.parentNode&&r.parentNode.removeChild(r);var o=this.modelScene.parameter;o.pano0&&o.pano0.map.dispose(),o.pano1&&o.pano1.map!==((e=o.pano0)===null||e===void 0?void 0:e.map)&&o.pano1.map.dispose(),o.reset("pano0","pano1");for(var s=0,u=this.modelScene.children.slice();s<u.length;s++){var l=u[s];l.dispose&&l.dispose(),this.modelScene.remove(l)}this.modelScene.dispose(),this.scene.dispose(),this.xrCustomObjectsScene.dispose(),worksMap.set(this,emptyWorks),this.renderer&&(this.renderer.render(new THREE__namespace.Scene,new THREE__namespace.Camera),this.renderer.setAnimationLoop(null)),this.renderer instanceof InternalWebGLRenderer&&(this.renderer.forceContextLoss&&this.renderer.forceContextLoss(),this.renderer.dispose())}},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){var o,s;if(e===void 0&&(e={}),!!this.renderer){var u=this.renderer.domElement,l=u.parentNode,c=e.width,p=c===void 0?(o=l==null?void 0:l.offsetWidth)!==null&&o!==void 0?o:512:c,f=e.height,d=f===void 0?(s=l==null?void 0:l.offsetHeight)!==null&&s!==void 0?s:512:f;r=r!=null?r:this.renderer.getPixelRatio();var h=this.renderer.capabilities.maxTextureSize,m=Math.max(p,d)*r;m>h&&(r=r/m*h,r=Math.floor(r*100)/100),this.renderer.setPixelRatio(r),this.renderer.setSize(p,d),this.needsRender=!0,this.modelSceneNeedsRender=!0;var A=now(),g=A-this.currentUpdateArgs.time,y=this.currentUpdateArgs.args;this.updateTime(A,g,y)}},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);return e||emptyWorks},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"work",{get:function(){return this.works[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"observers",{get:function(){return this.work.observers},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,m,A,g,y;s===void 0&&(s=!0);var v={};typeof o=="number"?v.duration=o:typeof o=="object"&&Object.assign(v,o),this.works===emptyWorks&&(v.duration===void 0&&(v.duration=0),v.effect===void 0&&(v.effect="instant"));var E=[];if(Array.isArray(e))for(var b=0,T=e;b<T.length;b++){var _=T[b];_ instanceof Work?E.push(_):typeof _!="string"&&"work"in _?E.push(parseWork(_.work,_)):E.push(parseWork(_))}else e instanceof Work?E.push(e):E.push(parseWork(e));for(var S=createWorks(E),R=function(Y){var K=w,ee=new Fetcher({get networkSubscribe(){return K.networkSubscribe},requestProxy:function(te){return Promise.resolve(te).then(function(re){return K.requestProxy(re)}).then(function(re){var ae=verifyURL(re,Y.allowHosts);if(ae instanceof Error)throw ae;return ae})}});registerFetcher(Y,ee)},w=this,M=0,B=S;M<B.length;M++){var C=B[M];R(C)}r===void 0&&(r="inherit"),r==="inherit"&&this.works===emptyWorks&&(r="initial");var P=S.initial,L=P.work.observers[0],O=L?{workCode:L.work.workCode,panoIndex:L.panoIndex}:{workCode:P.work.workCode,panoIndex:0},F=(l=P.mode)!==null&&l!==void 0?l:L?"Panorama":"Mapview",N={};if(r==="inherit"){F=this.currentMode;var D=(p=(c=S[0])===null||c===void 0?void 0:c.observers)===null||p===void 0?void 0:p[this.panoIndex];D?O={workCode:D.work.workCode,panoIndex:D.panoIndex}:typeof S.initial.panoIndex=="number"?O={workCode:S.initial.work.workCode,panoIndex:S.initial.panoIndex}:(F==="Panorama"||F==="VRPanorama"||F==="XRPanorama")&&(F="Mapview"),N={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 P.panoIndex=="number"&&(O={workCode:P.work.workCode,panoIndex:P.panoIndex}),P.mode&&(F=P.mode),N={longitude:P.longitude,latitude:P.latitude,fov:P.fov,distance:P.distance,offset:(f=P.offset)===null||f===void 0?void 0:f.clone()};else{if(F=(d=r.mode)!==null&&d!==void 0?d:this.currentMode,typeof r.panoIndex=="number"){var D=S.getObserver({workCode:(m=(h=r.workCode)!==null&&h!==void 0?h:P.work.workCode)!==null&&m!==void 0?m:"",panoIndex:r.panoIndex});D&&(O={workCode:D.work.workCode,panoIndex:D.panoIndex})}N={longitude:r.longitude,latitude:r.latitude,fov:r.fov,distance:r.distance,offset:r.offset}}var U=__assign(__assign(__assign({},O),{mode:F}),N),z=this.getCurrentState(),G=(A=v.duration)!==null&&A!==void 0?A:this.modeChangeDuration;(F==="Floorplan"||F==="Topview"||F==="Mapview")&&this.currentMode===F&&(G=0);var j="fly";(F==="Panorama"||F==="VRPanorama"||F==="XRPanorama")&&this.currentMode===F&&(j=(g=v.effect)!==null&&g!==void 0?g:"fade"),this.emit("works.request",createEvent("works.request",{input:e,works:S,state:U,userAction:s}));var Q=function(){u.pano=O;var Y=__assign(__assign({initial:{state:U,currentState:z,duration:G,effect:j,userAction:s}},u.commonParams()),u.controllerInits[F]),K=Controllers[F].initAnimationEndState(Y);if(u.controller&&u.currentMode===F)u.controller.updateWork(S,K,{effect:j,duration:G},s)===!1&&(u.controller.destroy(),u.controller=u.applyController(F,Y));else{var ee=u.currentMode;if(u.controller)u.controller.destroy();else{var te=Controllers[F].initAnimationEndState(Y);u.camera.setFromPose(te),u.emit("camera.update",createEvent("camera.update",{state:u.getCurrentState(),userAction:s}))}u.controller=u.applyController(F,Y);var re=createEvent("mode.change",{prevMode:ee,mode:F,state:K,userAction:s});try{u.emit("mode.change",re)}catch(ae){console.error(ae)}}u.updateTime(u.currentUpdateArgs.time,0,u.currentUpdateArgs.args)};worksMap.set(this,S);var V=Promise.resolve();if(F===t.Mode.Floorplan||F===t.Mode.Topview||F===t.Mode.Mapview||F===t.Mode.Model){this.modelScene.loaded===!1&&(this.camera.setFromPose(U),assignPose(this.state,this.camera.pose)),this.controller||(this.currentMode=F);var J=this.loadModels(S,v);V=Promise.all(J.map(function(Y){return Y.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 W=this.controller,X=!1;this.modelScene.autoRefine=!1;var Z=function(){u.works===S&&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),W.off("pano.arrived",Z),W.off("pano.cancel",Z)},J=this.loadModels(S,v);V=Promise.all(J.map(function(K){return K.initReady})).then(noop),W.once("pano.arrived",Z),W.once("pano.cancel",Z),setTimeout(Z,((y=v.duration)!==null&&y!==void 0?y:this.modeChangeDuration)+1e3)}return this.emit("works.load",createEvent("works.load",{input:e,state:this.getCurrentState(),userAction:s,works:S})),V.then(function(){return u.ready()}).then(function(){var Y;u.emit("works.ready",createEvent("works.ready",{input:e,state:u.getCurrentState(),userAction:s,works:S})),(Y=u.analysis)===null||Y===void 0||Y.work(S)})},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,m;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 g="fly";l.controller&&typeof o=="object"&&o.effect&&(g=o.effect);var y=typeof r.panoIndex=="number"?{workCode:(m=(d=r.workCode)!==null&&d!==void 0?d:(h=l.work)===null||h===void 0?void 0:h.workCode)!==null&&m!==void 0?m:"",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.getObserver(y)){var v=new Error("PanoId ".concat(panoStringify(y)," 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 E=l.controller,b=l.currentMode,T=function(){if(l.controller&&l.controller.stopMomentumMovement(),l.controller&&u===!1&&b===e)e===t.Mode.Panorama||e===t.Mode.Model||e===t.Mode.VRPanorama||e===t.Mode.XRPanorama?!panoEqual(l.pano,y)&&"moveToPano"in l.controller&&typeof l.controller.moveToPano=="function"?l.controller.moveToPano(y,__assign({duration:A},r),s):l.controller.updateCamera(r,A,s).catch(noop):(panoEqual(l.pano,y)||(l.pano=y),l.controller.updateCamera(r,A,s).catch(noop));else{var S=__assign(__assign({},r),y),R=__assign(__assign({initial:{state:S,currentState:l.getCurrentState(),duration:A,effect:g,userAction:s}},l.commonParams()),l.controllerInits[e]),w=Controllers[e].initAnimationEndState(R),M=createEvent("mode.change.request",{prevMode:l.currentMode,mode:e,state:w,userAction:s});if(l.emit("mode.change.request",M),!M.defaultPrevented){E&&E.destroy(),l.controller=l.applyController(e,R);var B=createEvent("mode.change",{prevMode:l.currentMode,mode:e,state:w,userAction:s});l.emit("mode.change",B)}}c()};if(e===t.Mode.VRPanorama)l.requestFullscreen(),requestDeviceOrientationPermission().then(function(){return T()}).catch(function(S){var R=S instanceof Error?S:new Error(String(S));l.exitFullscreen(),l.throwError(R),p(R)});else if(e===t.Mode.XRPanorama){var _=AnimationFrameLoop.shared.getContext();_?_.end():requestXRSessionPermission().then(function(S){AnimationFrameLoop.shared.setContext(S),T()}).catch(function(S){var R=S instanceof Error?S:new Error(String(S));l.throwError(R),p(R)})}else T()})},t.prototype.getPixels=function(e,r,o,s,u,l,c){if(!this.renderer)throw new Error("renderer is not initialized.");var p=this.renderer.getPixelRatio(),f=this.renderer.getRenderTarget(),d=this.renderer.getSize(new THREE__namespace.Vector2),h=0,m=0,A=1,g=1,y,v,E,b,T;typeof e=="number"?(h=e,typeof r=="number"&&(m=r),typeof o=="number"&&(A=o),typeof s=="number"&&(g=s),y=u,v=l,T=c):(h=e.x,m=e.y,A=e.width,g=e.height,y=e.pixelRatio,v=e.flipY,E=e.helperVisible,b=e.skipPanorama,T=e.buffer),h=Math.ceil(h),m=Math.ceil(m),A=Math.ceil(A),g=Math.ceil(g),y=Math.ceil(y!=null?y:p),v=v!=null?v:!1;var _=this.helperVisible,S=this.modelScene.parameter.modelAlpha;this.helperVisible=E!=null?E: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*y,g*y),this.renderer.setRenderTarget(R),this.camera.pixelRatio=y,this.camera.resolution.set(A,g),this.camera.setViewOffset(d.width,d.height,h,d.height-m-g,A,g),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 w=A*y,M=g*y,B=w*M,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*y,g*y,T),v)for(var P=B/2,L=0,O=0,F=0,N=0;O<P;O++)for(N=(M-Math.floor(O/w)-1)*w+O%w,F=0;F<4;F++)L=T[O*4+F],T[O*4+F]=T[N*4+F],T[N*4+F]=L;return T},t.prototype.getElement=function(){var e;return(e=this.renderer)===null||e===void 0?void 0:e.domElement},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),m=r.getScissorTest(),A=r.getSize(scratchRenderSize),g=r.getPixelRatio(),y=Math.floor(A.x*this.viewport.left),v=Math.floor(A.y*this.viewport.bottom),E=Math.floor(A.x*this.viewport.width),b=Math.floor(A.y*this.viewport.height);r.setClearColor(this.backgroundColor,this.backgroundAlpha),r.setViewport(y,v,E,b),r.setScissor(y,v,E,b);var T=this.viewport.bottom!==0||this.viewport.left!==0||this.viewport.width!==1||this.viewport.height!==1;r.setScissorTest(T);var _=this.scene.background;this.modelScene.background=this.camera.isOrthographicCamera?null:_,this.modelScene.environment=this.scene.environment,this.scene.background=null;var S=this.getBuiltinRenderer(r);S.setSize(A.x,A.y,g),this.controller?this.controller.render(S,this.onlyRenderIfNeeds?this.modelSceneNeedsRender:!0):S.render(this.onlyRenderIfNeeds?this.modelSceneNeedsRender:!0),this.scene.background=_,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(m),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.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){scratchBox3.makeEmpty(),scratchBox3.expandByObject(this.boundingMesh);var c=scratchBox3.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);var f=p/1e4;f=clamp$1(f,.03,.1),this.camera.near!==f&&(this.camera.near=f),this.camera.far!==p&&(this.camera.far=p)}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 m=[],A=0,g=this.modelScene.children;A<g.length;A++){var y=g[A];y instanceof Model&&y.outdated&&m.push(y)}for(var v=0,E=m;v<E.length;v++){var b=E[v];this.modelScene.remove(b),b.dispose()}if(m.length>0)for(var T=0,_=this.modelScene.children;T<_.length;T++){var y=_[T];y instanceof Model&&(y.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);var w=this.needsRender;this.renderer&&w&&this.render(),this.needsRender=!1,this.modelSceneNeedsRender=!1,this.emit("render",createEvent("render",{needsRender:w})),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.getObserver(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);var s=this.works.getObserver(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=panoStringify({panoIndex:s.panoIndex,workCode:s.work.workCode}),f=__assign({key:"pano.".concat(p,".").concat(c)},pick(o.imageOptions,["size","format","quality","forceUseExifOrientation","mappings"])),d=s.work.getURL(s.images[c]),h=o.imageOptions.transform?o.imageOptions.transform(d,f):imageURL(d,f);return getFetcher(s.work).preload(h)})).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,m=p.y*(1-this.viewport.bottom-this.viewport.height)+(-c.y+1)/2*d;return new THREE__namespace.Vector2(h,m)},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,m,A;r===void 0&&(r=!1),o===void 0&&(o=!0),e=pick(e,["mode","workCode","panoIndex","longitude","latitude","fov","offset","distance"]),e.offset&&!(e instanceof THREE__namespace.Vector3)&&(e.offset=new THREE__namespace.Vector3(e.offset.x,e.offset.y,e.offset.z));var g;if(typeof e.panoIndex=="number")if(e.workCode)g={workCode:e.workCode,panoIndex:e.panoIndex};else{var y=(u=(s=this.work)===null||s===void 0?void 0:s.workCode)!==null&&u!==void 0?u:"",v=this.state.workCode;this.works.filter(function(P){return P.workCode===v}).length>0&&(y=v),g={workCode:y,panoIndex:e.panoIndex}}var E=(l=e.mode)!==null&&l!==void 0?l:this.state.mode,b,T,_,S,R;if(this.controller&&this.controller.stopMomentumMovement(),this.state.mode!==E){if(E==="VRPanorama"){this.changeMode("VRPanorama",void 0,void 0,!0);return}var w={workCode:g==null?void 0:g.workCode,panoIndex:g==null?void 0:g.panoIndex};typeof e.longitude=="number"&&(w.longitude=e.longitude),typeof e.latitude=="number"&&(w.latitude=e.latitude),typeof e.fov=="number"&&(w.fov=e.fov),typeof e.distance=="number"&&(w.distance=e.distance),e.offset instanceof THREE__namespace.Vector3&&(w.offset=e.offset);var M=__assign(__assign({initial:{state:w,currentState:this.getCurrentState(),duration:this.modeChangeDuration,effect:"fly",userAction:!1}},this.commonParams()),this.controllerInits[E]),B=Controllers[E].initAnimationEndState(M);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:(g!=null?g:this.pano).workCode,panoIndex:(g!=null?g:this.pano).panoIndex,mode:E,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&&((m=this.controller)===null||m===void 0||m.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,m=o?this.state.fov:stepNumber(this.camera.pose.fov,this.state.fov,p),A=Math.abs(this.camera.pose.distance-this.state.distance),g=A>d*15?A/15:f,y=o?this.state.distance:stepNumber(this.camera.pose.distance,this.state.distance,g),v=this.camera.pose.offset.distanceTo(this.state.offset),E=v>d*15?v/15:d,b=o?new THREE__namespace.Vector3().copy(this.state.offset):stepVector(this.camera.pose.offset,this.state.offset,E),T=o?{longitude:this.state.longitude,latitude:this.state.latitude}:stepCoordinates({longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude},{longitude:this.state.longitude,latitude:this.state.latitude},h),_=T.longitude,S=T.latitude;if(notSimilarValue(m,this.camera.pose.fov)||notSimilarVector3(b,this.camera.pose.offset)||notSimilarValue(y,this.camera.pose.distance)||notSimilarValue(_,this.camera.pose.longitude,Math.PI*2)||notSimilarValue(S,this.camera.pose.latitude)){var R={x:b.x,y:b.y,z:b.z},w={fov:m};return Object.assign(R,{distance:y}),Object.assign(w,{longitude:_,latitude:S}),this.controller.stopMomentumMovement(),this.controller.cameraMotion.set(w,0).catch(noop),this.controller.locationMotion.set(R,0).catch(noop),!0}}else{var M=1,B=Math.PI/45,m=o?this.state.fov:stepNumber(this.camera.pose.fov,this.state.fov,M),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,y=this.state.distance,b=new THREE__namespace.Vector3().copy(this.state.offset);if(notSimilarValue(y,this.camera.pose.distance)&&(this.state.distance=this.camera.pose.distance),notSimilarVector3(b,this.camera.pose.offset)&&(this.state.offset=this.camera.pose.offset.clone()),notSimilarValue(_,this.camera.pose.longitude,Math.PI*2)||notSimilarValue(S,this.camera.pose.latitude)||notSimilarValue(m,this.camera.pose.fov))return this.controller.stopMomentumMovement(),this.controller.cameraMotion.set({longitude:_,latitude:S,fov:m},0).catch(noop),!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 P=this.currentMode,L=P===t.Mode.Floorplan||P===t.Mode.Topview||P===t.Mode.Mapview||P===t.Mode.Model;if(!L||this.modelScene.loaded){var O=this.readyCallbacks.slice();this.readyCallbacks.length=0;for(var F=0,N=O;F<N.length;F++){var D=N[F];this.controller instanceof Controllers.Panorama&&D.tile===!0&&!this.controller.isTileReady()?this.readyCallbacks.push(D):D()}}}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,m=[],A=0,g=this.modelScene.children;A<g.length;A++){var y=g[A];y instanceof Model&&(y.outdated=!0,d.set(y.work.workCode,y),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),m.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:E.textureOptions,w=(p=(c=r.model)===null||c===void 0?void 0:c["3d-tiles"])!==null&&p!==void 0?p:r["3d-tiles"],M=new Model(_,{light:(f=r.model)===null||f===void 0?void 0:f.light,textureOptions:R});M.initReady.then(function(){if(w)if(typeof w=="function")for(var O=0,F=M.viewLayers;O<F.length;O++){var N=F[O],D=w(N,M,T);D&&(D.viewerRequestVolume&&(N.viewerRequestVolume=makeBoundingVolume(D.viewerRequestVolume)),N.parameter.set(omit(D,["showLayers"])),D.showLayers===!1?N.visible=!1:Array.isArray(D.showLayers)&&(N.visible=D.showLayers.includes(N.name)))}else for(var U=0,z=M.viewLayers;U<z.length;U++){var N=z[U];w.viewerRequestVolume&&(N.viewerRequestVolume=makeBoundingVolume(w.viewerRequestVolume)),N.parameter.set(omit(w,["showLayers"])),w.showLayers===!1?N.visible=!1:Array.isArray(w.showLayers)&&(N.visible=w.showLayers.includes(N.name))}}),m.push(M),h&&(M.visible=!1),E.modelScene.add(M);var B=function(){AnimationFrameLoop.shared.add(function(){o.emit("model.load",createEvent("model.load",{work:_,model:M,error:null}))},!0)},C=function(O){var F=O.error;o.emit("model.error",createEvent("model.error",{work:_,model:M,error:F})),o.throwError(F)},P=function(){o.emit("model.changeShownFloor",createEvent("model.changeShownFloor",{work:_,model:M,error:null}))},L=function(){M.removeEventListener("load",B),M.removeEventListener("error",C),M.removeEventListener("changeShownFloor",P),M.removeEventListener("dispose",L)};M.addEventListener("load",B),M.addEventListener("error",C),M.addEventListener("changeShownFloor",P),M.addEventListener("dispose",L),E.emit("model.request",createEvent("model.request",{work:_,model:M,error:null}))}},E=this,b=0;b<e.length;b++)v(b);return this.modelScene.loaded=!1,this.modelScene.refined=!1,m},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(m){u.on(m,function(){for(var A=[],g=0;g<arguments.length;g++)A[g]=arguments[g];var y=o.emit.apply(o,__spreadArray([m],A,!1));if(y)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(m){var A;if(o.controller){var g=o.controller.getTargetState();m.userAction&&o.syncingState===!1&&o.state.mode===g.mode&&!stateEqual(o.state,g)&&(assignState(o.state,g),o.emit("state.change",createEvent("state.change",{userAction:m.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:m.userAction,state:o.getCurrentState()}))}),u.on("initAnimation.start",function(m){var A,g=m.state,y=m.userAction;y&&o.state.mode===g.mode&&!stateEqual(o.state,g)&&(assignState(o.state,g),o.emit("state.change",createEvent("state.change",{userAction:y,state:o.state})),(A=o.analysis)===null||A===void 0||A.state(o.works,o.state))}),u.on("initAnimation.end",function(m){var A,g=m.state,y=m.userAction;o.pano={workCode:g.workCode,panoIndex:g.panoIndex},y&&o.state.mode===g.mode&&!stateEqual(o.state,g)&&(assignState(o.state,g),o.emit("state.change",createEvent("state.change",{userAction:y,state:o.state})),(A=o.analysis)===null||A===void 0||A.state(o.works,o.state))}),u.on("pano.moveTo",function(m){var A,g=m.state,y=m.userAction;o.pano={workCode:g.workCode,panoIndex:g.panoIndex},y&&o.state.mode===g.mode&&!stateEqual(o.state,g)&&(assignState(o.state,g),o.emit("state.change",createEvent("state.change",{userAction:y,state:o.state})),(A=o.analysis)===null||A===void 0||A.state(o.works,o.state))}),u.on("pano.arrived",function(m){var A,g=m.state,y=m.userAction;o.pano={workCode:g.workCode,panoIndex:g.panoIndex},y&&o.state.mode===g.mode&&!stateEqual(o.state,g)&&(assignState(o.state,g),o.emit("state.change",createEvent("state.change",{userAction:y,state:o.state})),(A=o.analysis)===null||A===void 0||A.state(o.works,o.state))}),u.on("pano.cancel",function(m){var A,g=m.state,y=m.userAction;y&&o.state.mode===g.mode&&!stateEqual(o.state,g)&&(assignState(o.state,g),o.emit("state.change",createEvent("state.change",{userAction:y,state:o.state})),(A=o.analysis)===null||A===void 0||A.state(o.works,o.state))}),u.on("pano.moveTo",function(m){var A=m.userAction;o.emit("currentState.change",createEvent("currentState.change",{userAction:A,state:o.getCurrentState()}))}),u.on("pano.request",function(m){o.emit("pano.request",m),m.defaultPrevented||o.moveToPano(m.state,m.options,m.userAction)}),u.on("vr.requestExit",function(){o.currentMode===t.Mode.VRPanorama&&(o.exitFullscreen(),o.changeMode(t.Mode.Panorama))}),u.on("error",function(m){return o.throwError(m)}),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.getObserver(this.pano);if(e){var r=new THREE__namespace.Object3D;return r.matrix.copy(e.matrix).premultiply(e.work.transform),r.matrix.decompose(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__={constructor:Five,THREE:THREE__namespace,instances:{}};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.WorkResolvedObserver=WorkResolvedObserver;exports.XRButton=XRButton;exports.controllersDefaultInitArgs=controllersDefaultInitArgs;exports.coordinatesToVector=coordinatesToVector;exports.createDebugBoundingMesh=createDebugBoundingMesh;exports.createWorks=createWorks;exports.defaultImageURLTransform=imageURL;exports.draco=draco;exports.getViewportScale=getViewportScale;exports.headingToLongitude=headingToLongitude;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.longitudeToHeading=longitudeToHeading;exports.makeBoundingVolume=makeBoundingVolume;exports.panoEqual=panoEqual;exports.panoParse=panoParse;exports.panoStringify=panoStringify;exports.parseWork=parseWork;exports.vectorToCoordinates=vectorToCoordinates;exports.workToJson=workToJson;
2249
+ `})||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=1e3,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,scratchBox3=new THREE__namespace.Box3,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,m,A,g=n.call(this)||this;if(g.ident=createUuid(),typeof window!="undefined"&&(__FIVE_DEBUG__.instances[g.ident]=g),g.renderSwitch01=0,g.currentUpdateArgs={time:now(),args:[]},g.currentMode="Panorama",g.pano={workCode:"",panoIndex:0},g.needsRender=!1,g.modelSceneNeedsRender=!1,g.onlyRenderIfNeeds=(r=e.onlyRenderIfNeeds)!==null&&r!==void 0?r:!0,g.imageOptions=__assign({},(o=e.imageOptions)!==null&&o!==void 0?o:{}),g.textureOptions=__assign({},(s=e.textureOptions)!==null&&s!==void 0?s:{}),g.poweredByRealsee=(u=e.poweredByRealsee)!==null&&u!==void 0?u:!0,g.backgroundColor=new THREE__namespace.Color((l=e.backgroundColor)!==null&&l!==void 0?l:1579548),g.backgroundAlpha=(c=e.backgroundAlpha)!==null&&c!==void 0?c:1,g.extraElements=[],g.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)},g.fps={testCount:0,testTime:now()},g.modeChangeDuration=(p=e.modeChangeDuration)!==null&&p!==void 0?p:DEFAULT_MODE_CHANGE_DURATION,g.enableWheel=(f=e.enableWheel)!==null&&f!==void 0?f:!0,typeof window!="undefined")if("renderer"in e)e.renderer instanceof InternalWebGLRenderer&&g.throwError(new Error("cannot render a internal renderer")),g.renderer=e.renderer;else try{g.renderer=new InternalWebGLRenderer({preserveDrawingBuffer:e.preserveDrawingBuffer,antialias:e.antialias,webgl2:e.webgl2,logarithmicDepthBuffer:e.logarithmicDepthBuffer,precision:e.precision,powerPreference:e.powerPreference});var y=getViewportScale();g.renderer.setPixelRatio(y===1?window.devicePixelRatio:1),g.renderer.setSize(512,512),g.renderer.setClearColor(g.backgroundColor,g.backgroundAlpha)}catch(O){var v=O instanceof Error?O:new Error(String(O));g.throwError(v)}g.getPixelsRenderTarget=new THREE__namespace.WebGLRenderTarget(1,1,{encoding:(h=(d=g.renderer)===null||d===void 0?void 0:d.outputEncoding)!==null&&h!==void 0?h:THREE__namespace.sRGBEncoding,generateMipmaps:!1}),g.viewport=Object.assign({left:0,bottom:0,width:1,height:1},e.viewport),g.camera=new Camera(DEFAULT_CAMERA_FOV),g.scene=new Scene,g.xrCustomObjectsScene=new THREE__namespace.Scene,g.scene.add(g.xrCustomObjectsScene),g.scene.matrixAutoUpdate=!1,g.loadWorkTask=Promise.resolve(),g.requestProxy=(m=e.requestProxy)!==null&&m!==void 0?m:DEFAULT_REQUEST_PROXY,g.networkSubscribe=new NetworkSubscribe,g.networkSubscribe.on("network",function(O,F,N,D){var U;g.emit("network.resource",createEvent("network.resource",{source:O,requestType:F,requestState:N,detail:D})),(U=g.analysis)===null||U===void 0||U.network(g.works,O,F,N,D)}),g.boundingMesh=new BoundingMesh$1,g.boundingMesh.name="bounding",g.readyCallbacks=[],g.syncingState=!1,g.helperGroup=new THREE__namespace.Group,g.helperGroup.name="helper",g.helperGroup.matrixAutoUpdate=!1,g.scene.add(g.helperGroup);var E=new Model(emptyWorks[0]);worksMap.set(g,emptyWorks),g.modelScene=new ModelScene,g.modelScene.add(E),g.modelScene.add(g.boundingMesh),defineProperty(E,"loaded",{get:function(){return!1},set:function(O){}}),g.videoTexture=new THREE__namespace.VideoTexture(e.videoInstance||generateDefaultVideoElement());var b=initLights();g.scene.add(b);var T=new THREE__namespace.Group;defineProperty(T,"children",{get:function(){return b.children},set:function(O){b.children=O}}),defineProperty(T,"visible",{get:function(){return b.visible},set:function(O){b.visible=O}}),defineProperty(T,"name",{get:function(){return b.name},set:function(O){b.name=O}}),g.modelScene.add(T),g.state={mode:g.currentMode,workCode:g.pano.workCode,panoIndex:g.pano.panoIndex,longitude:g.camera.pose.longitude,latitude:g.camera.pose.latitude,fov:g.camera.pose.fov,offset:g.camera.pose.offset.clone(),distance:g.camera.pose.distance},g.stateSynced=!1,g.destroyed=!1,g.paused=!0,typeof window!="undefined"&&(e.play!==!1&&g.play(),g.stopAnimationLoop=AnimationFrameLoop.shared.add(function(O,F){for(var N=[],D=2;D<arguments.length;D++)N[D-2]=arguments[D];g.updateTime.apply(g,__spreadArray([O,F],N,!1))},!1,0,10));var _=function(){typeof document!="undefined"&&document.fullscreenElement===null&&g.currentMode==="VRPanorama"&&g.controller.emit("vr.requestExit",createEvent("vr.requestExit",{}))},S=function(){g.needsRender=!0,g.modelSceneNeedsRender=!0};if(typeof document!="undefined"&&document.addEventListener("fullscreenchange",_,!1),g.renderer&&g.renderer.domElement.addEventListener("webglcontextrestored",S,!1),g.removeEventListeners=function(){typeof document!="undefined"&&document.removeEventListener("fullscreenchange",_,!1),g.renderer&&g.renderer.domElement.removeEventListener("webglcontextrestored",S,!1)},g.plugins={},e.plugins&&e.plugins.length)for(var R=0,w=e.plugins;R<w.length;R++){var M=w[R];if(typeof M=="function")M(g);else if(Array.isArray(M)){var B=M[0],C=M[1],P=M[2];if(typeof B=="function"){var L=B(g,P);typeof C=="string"&&(g.plugins[C]?g.throwError(new Error("plugin name ".concat(C," is exists."))):g.plugins[C]=L)}}}return initLegacyEvent(g),g.enableLayeringRendering=(A=e.enableLayeringRendering)!==null&&A!==void 0?A:!1,g._buildInRendererType="default",g._builtinRenderer=null,g}return Object.defineProperty(t,"version",{get:function(){return"6.7.0-alpha.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,"useNativeImageBitmap",{get:function(){return canUseNativeImageBitmap()},set:function(e){useNativeImageBitmap(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;if(this.destroyed!==!0){delete __FIVE_DEBUG__.instances[this.ident],this.emit("dispose"),this.destroyed=!0,this.pause(),this.stopAnimationLoop&&(this.stopAnimationLoop(),this.stopAnimationLoop=void 0),this.off(),this.networkSubscribe.off(),this.controller&&(this.controller.destroy(),this.controller=void 0);var r=this.getElement();r&&r.parentNode&&r.parentNode.removeChild(r);var o=this.modelScene.parameter;o.pano0&&o.pano0.map.dispose(),o.pano1&&o.pano1.map!==((e=o.pano0)===null||e===void 0?void 0:e.map)&&o.pano1.map.dispose(),o.reset("pano0","pano1");for(var s=0,u=this.modelScene.children.slice();s<u.length;s++){var l=u[s];l.dispose&&l.dispose(),this.modelScene.remove(l)}this.modelScene.dispose(),this.scene.dispose(),this.xrCustomObjectsScene.dispose(),worksMap.set(this,emptyWorks),this.renderer&&(this.renderer.render(new THREE__namespace.Scene,new THREE__namespace.Camera),this.renderer.setAnimationLoop(null)),this.renderer instanceof InternalWebGLRenderer&&(this.renderer.forceContextLoss&&this.renderer.forceContextLoss(),this.renderer.dispose())}},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){var o,s;if(e===void 0&&(e={}),!!this.renderer){var u=this.renderer.domElement,l=u.parentNode,c=e.width,p=c===void 0?(o=l==null?void 0:l.offsetWidth)!==null&&o!==void 0?o:512:c,f=e.height,d=f===void 0?(s=l==null?void 0:l.offsetHeight)!==null&&s!==void 0?s:512:f;r=r!=null?r:this.renderer.getPixelRatio();var h=this.renderer.capabilities.maxTextureSize,m=Math.max(p,d)*r;m>h&&(r=r/m*h,r=Math.floor(r*100)/100),this.renderer.setPixelRatio(r),this.renderer.setSize(p,d),this.needsRender=!0,this.modelSceneNeedsRender=!0;var A=now(),g=A-this.currentUpdateArgs.time,y=this.currentUpdateArgs.args;this.updateTime(A,g,y)}},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);return e||emptyWorks},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"work",{get:function(){return this.works[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"observers",{get:function(){return this.work.observers},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,m,A,g,y;s===void 0&&(s=!0);var v={};typeof o=="number"?v.duration=o:typeof o=="object"&&Object.assign(v,o),this.works===emptyWorks&&(v.duration===void 0&&(v.duration=0),v.effect===void 0&&(v.effect="instant"));var E=[];if(Array.isArray(e))for(var b=0,T=e;b<T.length;b++){var _=T[b];_ instanceof Work?E.push(_):typeof _!="string"&&"work"in _?E.push(parseWork(_.work,_)):E.push(parseWork(_))}else e instanceof Work?E.push(e):E.push(parseWork(e));for(var S=createWorks(E),R=function(Y){var G=w,ee=new Fetcher({get networkSubscribe(){return G.networkSubscribe},requestProxy:function(te){return Promise.resolve(te).then(function(ne){return G.requestProxy(ne)}).then(function(ne){var ae=verifyURL(ne,Y.allowHosts);if(ae instanceof Error)throw ae;return ae})}});registerFetcher(Y,ee)},w=this,M=0,B=S;M<B.length;M++){var C=B[M];R(C)}r===void 0&&(r="inherit"),r==="inherit"&&this.works===emptyWorks&&(r="initial");var P=S.initial,L=P.work.observers[0],O=L?{workCode:L.work.workCode,panoIndex:L.panoIndex}:{workCode:P.work.workCode,panoIndex:0},F=(l=P.mode)!==null&&l!==void 0?l:L?"Panorama":"Mapview",N={};if(r==="inherit"){F=this.currentMode;var D=(p=(c=S[0])===null||c===void 0?void 0:c.observers)===null||p===void 0?void 0:p[this.panoIndex];D?O={workCode:D.work.workCode,panoIndex:D.panoIndex}:typeof S.initial.panoIndex=="number"?O={workCode:S.initial.work.workCode,panoIndex:S.initial.panoIndex}:(F==="Panorama"||F==="VRPanorama"||F==="XRPanorama")&&(F="Mapview"),N={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 P.panoIndex=="number"&&(O={workCode:P.work.workCode,panoIndex:P.panoIndex}),P.mode&&(F=P.mode),N={longitude:P.longitude,latitude:P.latitude,fov:P.fov,distance:P.distance,offset:(f=P.offset)===null||f===void 0?void 0:f.clone()};else{if(F=(d=r.mode)!==null&&d!==void 0?d:this.currentMode,typeof r.panoIndex=="number"){var D=S.getObserver({workCode:(m=(h=r.workCode)!==null&&h!==void 0?h:P.work.workCode)!==null&&m!==void 0?m:"",panoIndex:r.panoIndex});D&&(O={workCode:D.work.workCode,panoIndex:D.panoIndex})}N={longitude:r.longitude,latitude:r.latitude,fov:r.fov,distance:r.distance,offset:r.offset}}var U=__assign(__assign(__assign({},O),{mode:F}),N),z=this.getCurrentState(),K=(A=v.duration)!==null&&A!==void 0?A:this.modeChangeDuration;(F==="Floorplan"||F==="Topview"||F==="Mapview")&&this.currentMode===F&&(K=0);var j="fly";(F==="Panorama"||F==="VRPanorama"||F==="XRPanorama")&&this.currentMode===F&&(j=(g=v.effect)!==null&&g!==void 0?g:"fade"),this.emit("works.request",createEvent("works.request",{input:e,works:S,state:U,userAction:s}));var Q=function(){u.pano=O;var Y=__assign(__assign({initial:{state:U,currentState:z,duration:K,effect:j,userAction:s}},u.commonParams()),u.controllerInits[F]),G=Controllers[F].initAnimationEndState(Y);if(u.controller&&u.currentMode===F)u.controller.updateWork(S,G,{effect:j,duration:K},s)===!1&&(u.controller.destroy(),u.controller=u.applyController(F,Y));else{var ee=u.currentMode;if(u.controller)u.controller.destroy();else{var te=Controllers[F].initAnimationEndState(Y);u.camera.setFromPose(te),u.emit("camera.update",createEvent("camera.update",{state:u.getCurrentState(),userAction:s}))}u.controller=u.applyController(F,Y);var ne=createEvent("mode.change",{prevMode:ee,mode:F,state:G,userAction:s});try{u.emit("mode.change",ne)}catch(ae){console.error(ae)}}u.updateTime(u.currentUpdateArgs.time,0,u.currentUpdateArgs.args)};worksMap.set(this,S);var V=Promise.resolve();if(F===t.Mode.Floorplan||F===t.Mode.Topview||F===t.Mode.Mapview||F===t.Mode.Model){this.modelScene.loaded===!1&&(this.camera.setFromPose(U),assignPose(this.state,this.camera.pose)),this.controller||(this.currentMode=F);var J=this.loadModels(S,v);V=Promise.all(J.map(function(Y){return Y.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 W=this.controller,X=!1;this.modelScene.autoRefine=!1;var Z=function(){u.works===S&&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),W.off("pano.arrived",Z),W.off("pano.cancel",Z)},J=this.loadModels(S,v);V=Promise.all(J.map(function(G){return G.initReady})).then(noop),W.once("pano.arrived",Z),W.once("pano.cancel",Z),setTimeout(Z,((y=v.duration)!==null&&y!==void 0?y:this.modeChangeDuration)+1e3)}return this.emit("works.load",createEvent("works.load",{input:e,state:this.getCurrentState(),userAction:s,works:S})),V.then(function(){return u.ready()}).then(function(){var Y;u.emit("works.ready",createEvent("works.ready",{input:e,state:u.getCurrentState(),userAction:s,works:S})),(Y=u.analysis)===null||Y===void 0||Y.work(S)})},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,m;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 g="fly";l.controller&&typeof o=="object"&&o.effect&&(g=o.effect);var y=typeof r.panoIndex=="number"?{workCode:(m=(d=r.workCode)!==null&&d!==void 0?d:(h=l.work)===null||h===void 0?void 0:h.workCode)!==null&&m!==void 0?m:"",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.getObserver(y)){var v=new Error("PanoId ".concat(panoStringify(y)," 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 E=l.controller,b=l.currentMode,T=function(){if(l.controller&&l.controller.stopMomentumMovement(),l.controller&&u===!1&&b===e)e===t.Mode.Panorama||e===t.Mode.Model||e===t.Mode.VRPanorama||e===t.Mode.XRPanorama?!panoEqual(l.pano,y)&&"moveToPano"in l.controller&&typeof l.controller.moveToPano=="function"?l.controller.moveToPano(y,__assign({duration:A},r),s):l.controller.updateCamera(r,A,s).catch(noop):(panoEqual(l.pano,y)||(l.pano=y),l.controller.updateCamera(r,A,s).catch(noop));else{var S=__assign(__assign({},r),y),R=__assign(__assign({initial:{state:S,currentState:l.getCurrentState(),duration:A,effect:g,userAction:s}},l.commonParams()),l.controllerInits[e]),w=Controllers[e].initAnimationEndState(R),M=createEvent("mode.change.request",{prevMode:l.currentMode,mode:e,state:w,userAction:s});if(l.emit("mode.change.request",M),!M.defaultPrevented){E&&E.destroy(),l.controller=l.applyController(e,R);var B=createEvent("mode.change",{prevMode:l.currentMode,mode:e,state:w,userAction:s});l.emit("mode.change",B)}}c()};if(e===t.Mode.VRPanorama)l.requestFullscreen(),requestDeviceOrientationPermission().then(function(){return T()}).catch(function(S){var R=S instanceof Error?S:new Error(String(S));l.exitFullscreen(),l.throwError(R),p(R)});else if(e===t.Mode.XRPanorama){var _=AnimationFrameLoop.shared.getContext();_?_.end():requestXRSessionPermission().then(function(S){AnimationFrameLoop.shared.setContext(S),T()}).catch(function(S){var R=S instanceof Error?S:new Error(String(S));l.throwError(R),p(R)})}else T()})},t.prototype.getPixels=function(e,r,o,s,u,l,c){if(!this.renderer)throw new Error("renderer is not initialized.");var p=this.renderer.getPixelRatio(),f=this.renderer.getRenderTarget(),d=this.renderer.getSize(new THREE__namespace.Vector2),h=0,m=0,A=1,g=1,y,v,E,b,T;typeof e=="number"?(h=e,typeof r=="number"&&(m=r),typeof o=="number"&&(A=o),typeof s=="number"&&(g=s),y=u,v=l,T=c):(h=e.x,m=e.y,A=e.width,g=e.height,y=e.pixelRatio,v=e.flipY,E=e.helperVisible,b=e.skipPanorama,T=e.buffer),h=Math.ceil(h),m=Math.ceil(m),A=Math.ceil(A),g=Math.ceil(g),y=Math.ceil(y!=null?y:p),v=v!=null?v:!1;var _=this.helperVisible,S=this.modelScene.parameter.modelAlpha;this.helperVisible=E!=null?E: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*y,g*y),this.renderer.setRenderTarget(R),this.camera.pixelRatio=y,this.camera.resolution.set(A,g),this.camera.setViewOffset(d.width,d.height,h,d.height-m-g,A,g),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 w=A*y,M=g*y,B=w*M,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*y,g*y,T),v)for(var P=B/2,L=0,O=0,F=0,N=0;O<P;O++)for(N=(M-Math.floor(O/w)-1)*w+O%w,F=0;F<4;F++)L=T[O*4+F],T[O*4+F]=T[N*4+F],T[N*4+F]=L;return T},t.prototype.getElement=function(){var e;return(e=this.renderer)===null||e===void 0?void 0:e.domElement},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),m=r.getScissorTest(),A=r.getSize(scratchRenderSize),g=r.getPixelRatio(),y=Math.floor(A.x*this.viewport.left),v=Math.floor(A.y*this.viewport.bottom),E=Math.floor(A.x*this.viewport.width),b=Math.floor(A.y*this.viewport.height);r.setClearColor(this.backgroundColor,this.backgroundAlpha),r.setViewport(y,v,E,b),r.setScissor(y,v,E,b);var T=this.viewport.bottom!==0||this.viewport.left!==0||this.viewport.width!==1||this.viewport.height!==1;r.setScissorTest(T);var _=this.scene.background;this.modelScene.background=this.camera.isOrthographicCamera?null:_,this.modelScene.environment=this.scene.environment,this.scene.background=null;var S=this.getBuiltinRenderer(r);S.setSize(A.x,A.y,g),this.controller?this.controller.render(S,this.onlyRenderIfNeeds?this.modelSceneNeedsRender:!0):S.render(this.onlyRenderIfNeeds?this.modelSceneNeedsRender:!0),this.scene.background=_,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(m),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.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){scratchBox3.makeEmpty(),scratchBox3.expandByObject(this.boundingMesh);var c=scratchBox3.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);var f=p/1e4;f=clamp$1(f,.03,.1),this.camera.near!==f&&(this.camera.near=f),this.camera.far!==p&&(this.camera.far=p)}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 m=[],A=0,g=this.modelScene.children;A<g.length;A++){var y=g[A];y instanceof Model&&y.outdated&&m.push(y)}for(var v=0,E=m;v<E.length;v++){var b=E[v];this.modelScene.remove(b),b.dispose()}if(m.length>0)for(var T=0,_=this.modelScene.children;T<_.length;T++){var y=_[T];y instanceof Model&&(y.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);var w=this.needsRender;this.renderer&&w&&this.render(),this.needsRender=!1,this.modelSceneNeedsRender=!1,this.emit("render",createEvent("render",{needsRender:w})),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.getObserver(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);var s=this.works.getObserver(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=panoStringify({panoIndex:s.panoIndex,workCode:s.work.workCode}),f=__assign({key:"pano.".concat(p,".").concat(c)},pick(o.imageOptions,["size","format","quality","forceUseExifOrientation","mappings"])),d=s.work.getURL(s.images[c]),h=o.imageOptions.transform?o.imageOptions.transform(d,f):imageURL(d,f);return getFetcher(s.work).preload(h)})).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,m=p.y*(1-this.viewport.bottom-this.viewport.height)+(-c.y+1)/2*d;return new THREE__namespace.Vector2(h,m)},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,m,A;r===void 0&&(r=!1),o===void 0&&(o=!0),e=pick(e,["mode","workCode","panoIndex","longitude","latitude","fov","offset","distance"]),e.offset&&!(e instanceof THREE__namespace.Vector3)&&(e.offset=new THREE__namespace.Vector3(e.offset.x,e.offset.y,e.offset.z));var g;if(typeof e.panoIndex=="number")if(e.workCode)g={workCode:e.workCode,panoIndex:e.panoIndex};else{var y=(u=(s=this.work)===null||s===void 0?void 0:s.workCode)!==null&&u!==void 0?u:"",v=this.state.workCode;this.works.filter(function(P){return P.workCode===v}).length>0&&(y=v),g={workCode:y,panoIndex:e.panoIndex}}var E=(l=e.mode)!==null&&l!==void 0?l:this.state.mode,b,T,_,S,R;if(this.controller&&this.controller.stopMomentumMovement(),this.state.mode!==E){if(E==="VRPanorama"){this.changeMode("VRPanorama",void 0,void 0,!0);return}var w={workCode:g==null?void 0:g.workCode,panoIndex:g==null?void 0:g.panoIndex};typeof e.longitude=="number"&&(w.longitude=e.longitude),typeof e.latitude=="number"&&(w.latitude=e.latitude),typeof e.fov=="number"&&(w.fov=e.fov),typeof e.distance=="number"&&(w.distance=e.distance),e.offset instanceof THREE__namespace.Vector3&&(w.offset=e.offset);var M=__assign(__assign({initial:{state:w,currentState:this.getCurrentState(),duration:this.modeChangeDuration,effect:"fly",userAction:!1}},this.commonParams()),this.controllerInits[E]),B=Controllers[E].initAnimationEndState(M);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:(g!=null?g:this.pano).workCode,panoIndex:(g!=null?g:this.pano).panoIndex,mode:E,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&&((m=this.controller)===null||m===void 0||m.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,m=o?this.state.fov:stepNumber(this.camera.pose.fov,this.state.fov,p),A=Math.abs(this.camera.pose.distance-this.state.distance),g=A>d*15?A/15:f,y=o?this.state.distance:stepNumber(this.camera.pose.distance,this.state.distance,g),v=this.camera.pose.offset.distanceTo(this.state.offset),E=v>d*15?v/15:d,b=o?new THREE__namespace.Vector3().copy(this.state.offset):stepVector(this.camera.pose.offset,this.state.offset,E),T=o?{longitude:this.state.longitude,latitude:this.state.latitude}:stepCoordinates({longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude},{longitude:this.state.longitude,latitude:this.state.latitude},h),_=T.longitude,S=T.latitude;if(notSimilarValue(m,this.camera.pose.fov)||notSimilarVector3(b,this.camera.pose.offset)||notSimilarValue(y,this.camera.pose.distance)||notSimilarValue(_,this.camera.pose.longitude,Math.PI*2)||notSimilarValue(S,this.camera.pose.latitude)){var R={x:b.x,y:b.y,z:b.z},w={fov:m};return Object.assign(R,{distance:y}),Object.assign(w,{longitude:_,latitude:S}),this.controller.stopMomentumMovement(),this.controller.cameraMotion.set(w,0).catch(noop),this.controller.locationMotion.set(R,0).catch(noop),!0}}else{var M=1,B=Math.PI/45,m=o?this.state.fov:stepNumber(this.camera.pose.fov,this.state.fov,M),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,y=this.state.distance,b=new THREE__namespace.Vector3().copy(this.state.offset);if(notSimilarValue(y,this.camera.pose.distance)&&(this.state.distance=this.camera.pose.distance),notSimilarVector3(b,this.camera.pose.offset)&&(this.state.offset=this.camera.pose.offset.clone()),notSimilarValue(_,this.camera.pose.longitude,Math.PI*2)||notSimilarValue(S,this.camera.pose.latitude)||notSimilarValue(m,this.camera.pose.fov))return this.controller.stopMomentumMovement(),this.controller.cameraMotion.set({longitude:_,latitude:S,fov:m},0).catch(noop),!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 P=this.currentMode,L=P===t.Mode.Floorplan||P===t.Mode.Topview||P===t.Mode.Mapview||P===t.Mode.Model;if(!L||this.modelScene.loaded){var O=this.readyCallbacks.slice();this.readyCallbacks.length=0;for(var F=0,N=O;F<N.length;F++){var D=N[F];this.controller instanceof Controllers.Panorama&&D.tile===!0&&!this.controller.isTileReady()?this.readyCallbacks.push(D):D()}}}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,m=[],A=0,g=this.modelScene.children;A<g.length;A++){var y=g[A];y instanceof Model&&(y.outdated=!0,d.set(y.work.workCode,y),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),m.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:E.textureOptions,w=(p=(c=r.model)===null||c===void 0?void 0:c["3d-tiles"])!==null&&p!==void 0?p:r["3d-tiles"],M=new Model(_,{light:(f=r.model)===null||f===void 0?void 0:f.light,textureOptions:R});M.initReady.then(function(){if(w)if(typeof w=="function")for(var O=0,F=M.viewLayers;O<F.length;O++){var N=F[O],D=w(N,M,T);D&&(D.viewerRequestVolume&&(N.viewerRequestVolume=makeBoundingVolume(D.viewerRequestVolume)),N.parameter.set(omit(D,["showLayers"])),D.showLayers===!1?N.visible=!1:Array.isArray(D.showLayers)&&(N.visible=D.showLayers.includes(N.name)))}else for(var U=0,z=M.viewLayers;U<z.length;U++){var N=z[U];w.viewerRequestVolume&&(N.viewerRequestVolume=makeBoundingVolume(w.viewerRequestVolume)),N.parameter.set(omit(w,["showLayers"])),w.showLayers===!1?N.visible=!1:Array.isArray(w.showLayers)&&(N.visible=w.showLayers.includes(N.name))}}),m.push(M),h&&(M.visible=!1),E.modelScene.add(M);var B=function(){AnimationFrameLoop.shared.add(function(){o.emit("model.load",createEvent("model.load",{work:_,model:M,error:null}))},!0)},C=function(O){var F=O.error;o.emit("model.error",createEvent("model.error",{work:_,model:M,error:F})),o.throwError(F)},P=function(){o.emit("model.changeShownFloor",createEvent("model.changeShownFloor",{work:_,model:M,error:null}))},L=function(){M.removeEventListener("load",B),M.removeEventListener("error",C),M.removeEventListener("changeShownFloor",P),M.removeEventListener("dispose",L)};M.addEventListener("load",B),M.addEventListener("error",C),M.addEventListener("changeShownFloor",P),M.addEventListener("dispose",L),E.emit("model.request",createEvent("model.request",{work:_,model:M,error:null}))}},E=this,b=0;b<e.length;b++)v(b);return this.modelScene.loaded=!1,this.modelScene.refined=!1,m},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(m){u.on(m,function(){for(var A=[],g=0;g<arguments.length;g++)A[g]=arguments[g];var y=o.emit.apply(o,__spreadArray([m],A,!1));if(y)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(m){var A;if(o.controller){var g=o.controller.getTargetState();m.userAction&&o.syncingState===!1&&o.state.mode===g.mode&&!stateEqual(o.state,g)&&(assignState(o.state,g),o.emit("state.change",createEvent("state.change",{userAction:m.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:m.userAction,state:o.getCurrentState()}))}),u.on("initAnimation.start",function(m){var A,g=m.state,y=m.userAction;y&&o.state.mode===g.mode&&!stateEqual(o.state,g)&&(assignState(o.state,g),o.emit("state.change",createEvent("state.change",{userAction:y,state:o.state})),(A=o.analysis)===null||A===void 0||A.state(o.works,o.state))}),u.on("initAnimation.end",function(m){var A,g=m.state,y=m.userAction;o.pano={workCode:g.workCode,panoIndex:g.panoIndex},y&&o.state.mode===g.mode&&!stateEqual(o.state,g)&&(assignState(o.state,g),o.emit("state.change",createEvent("state.change",{userAction:y,state:o.state})),(A=o.analysis)===null||A===void 0||A.state(o.works,o.state))}),u.on("pano.moveTo",function(m){var A,g=m.state,y=m.userAction;o.pano={workCode:g.workCode,panoIndex:g.panoIndex},y&&o.state.mode===g.mode&&!stateEqual(o.state,g)&&(assignState(o.state,g),o.emit("state.change",createEvent("state.change",{userAction:y,state:o.state})),(A=o.analysis)===null||A===void 0||A.state(o.works,o.state))}),u.on("pano.arrived",function(m){var A,g=m.state,y=m.userAction;o.pano={workCode:g.workCode,panoIndex:g.panoIndex},y&&o.state.mode===g.mode&&!stateEqual(o.state,g)&&(assignState(o.state,g),o.emit("state.change",createEvent("state.change",{userAction:y,state:o.state})),(A=o.analysis)===null||A===void 0||A.state(o.works,o.state))}),u.on("pano.cancel",function(m){var A,g=m.state,y=m.userAction;y&&o.state.mode===g.mode&&!stateEqual(o.state,g)&&(assignState(o.state,g),o.emit("state.change",createEvent("state.change",{userAction:y,state:o.state})),(A=o.analysis)===null||A===void 0||A.state(o.works,o.state))}),u.on("pano.moveTo",function(m){var A=m.userAction;o.emit("currentState.change",createEvent("currentState.change",{userAction:A,state:o.getCurrentState()}))}),u.on("pano.request",function(m){o.emit("pano.request",m),m.defaultPrevented||o.moveToPano(m.state,m.options,m.userAction)}),u.on("vr.requestExit",function(){o.currentMode===t.Mode.VRPanorama&&(o.exitFullscreen(),o.changeMode(t.Mode.Panorama))}),u.on("error",function(m){return o.throwError(m)}),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.getObserver(this.pano);if(e){var r=new THREE__namespace.Object3D;r.matrix.copy(e.matrix).premultiply(e.work.transform),r.matrix.decompose(r.position,r.quaternion,r.scale),r.matrixAutoUpdate=!1;var o=new THREE__namespace.Vector3(0,0,-1);o.applyQuaternion(this.camera.quaternion);var s=r.quaternion.clone().inverse();o.applyQuaternion(s);var u=Math.atan2(o.x,-o.z),l=-Math.asin(o.y);return{theta:u,phi:l,lookAtVector:o}}}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__={constructor:Five,THREE:THREE__namespace,instances:{}};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.WorkResolvedObserver=WorkResolvedObserver;exports.XRButton=XRButton;exports.controllersDefaultInitArgs=controllersDefaultInitArgs;exports.coordinatesToVector=coordinatesToVector;exports.createDebugBoundingMesh=createDebugBoundingMesh;exports.createWorks=createWorks;exports.defaultImageURLTransform=imageURL;exports.draco=draco;exports.getViewportScale=getViewportScale;exports.headingToLongitude=headingToLongitude;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.longitudeToHeading=longitudeToHeading;exports.makeBoundingVolume=makeBoundingVolume;exports.panoEqual=panoEqual;exports.panoParse=panoParse;exports.panoStringify=panoStringify;exports.parseWork=parseWork;exports.vectorToCoordinates=vectorToCoordinates;exports.workToJson=workToJson;