@realsee/five 5.0.0-alpha.164 → 5.0.0-alpha.167

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 (156) hide show
  1. package/docs/assets/search.js +1 -1
  2. package/docs/classes/five.AnimationFrameLoop.html +1 -1
  3. package/docs/classes/five.BVH.html +1 -1
  4. package/docs/classes/five.BVHIntersect.html +1 -1
  5. package/docs/classes/five.BVHNode.html +1 -1
  6. package/docs/classes/five.BVHVector3.html +1 -1
  7. package/docs/classes/five.Camera.html +1 -1
  8. package/docs/classes/five.Clipper.html +1 -1
  9. package/docs/classes/five.Five.html +57 -55
  10. package/docs/classes/five.InternalWebGLRenderer.html +1 -1
  11. package/docs/classes/five.IntersectMesh.html +1 -1
  12. package/docs/classes/five.Model.html +29 -29
  13. package/docs/classes/five.NetworkSubscribe.html +1 -1
  14. package/docs/classes/five.PBMContainer.html +5 -5
  15. package/docs/classes/five.PBMGroup.html +5 -5
  16. package/docs/classes/five.PBMMaterial.html +1 -1
  17. package/docs/classes/five.PBMMesh.html +1 -1
  18. package/docs/classes/five.PanoCircleMesh.html +4 -4
  19. package/docs/classes/five.PanoCircleMeshSolid.html +4 -4
  20. package/docs/classes/five.Scene.html +1 -1
  21. package/docs/classes/five.Subscribe.html +1 -1
  22. package/docs/classes/five.TextureLoader.html +1 -1
  23. package/docs/classes/five.Tile3D.html +1 -1
  24. package/docs/classes/five.Tile3DModel.html +5 -5
  25. package/docs/classes/five.TileBoundingSphere.html +1 -1
  26. package/docs/classes/five.TileCacheNode.html +1 -1
  27. package/docs/classes/five.TileCubeTextureTarget.html +1 -1
  28. package/docs/classes/five.TileCullingVolume.html +1 -1
  29. package/docs/classes/five.TileOrientedBoundingBox.html +1 -1
  30. package/docs/classes/five.TileRequestScheduler.html +1 -1
  31. package/docs/classes/five.Tileset3D.html +1 -1
  32. package/docs/classes/five.Tileset3DTraverser.html +1 -1
  33. package/docs/classes/five.TilesetCache.html +1 -1
  34. package/docs/classes/five.Work.html +1 -1
  35. package/docs/classes/five.XRButton.html +1 -1
  36. package/docs/classes/gltf_loader.DDSLoader.html +1 -1
  37. package/docs/classes/gltf_loader.DRACOLoader.html +1 -1
  38. package/docs/classes/gltf_loader.GLTFLoader.html +1 -1
  39. package/docs/classes/gltf_loader.GLTFObject.html +1 -1
  40. package/docs/classes/gltf_loader.GLTFParser.html +1 -1
  41. package/docs/classes/gltf_loader.THREEGLTFLoader.html +1 -1
  42. package/docs/classes/line.Line.html +1 -1
  43. package/docs/classes/line.LineGeometry.html +1 -1
  44. package/docs/classes/line.LineMaterial.html +1 -1
  45. package/docs/classes/line.LineSegmentsGeometry.html +1 -1
  46. package/docs/classes/line.THREE_Line2.html +1 -1
  47. package/docs/classes/line.THREE_LineSegments2.html +1 -1
  48. package/docs/classes/react.Store.html +1 -1
  49. package/docs/classes/server.BVH.html +1 -1
  50. package/docs/classes/server.BVHIntersect.html +1 -1
  51. package/docs/classes/server.BVHNode.html +1 -1
  52. package/docs/classes/server.BVHVector3.html +1 -1
  53. package/docs/classes/server.Model.html +1 -1
  54. package/docs/classes/server.PBMContainer.html +1 -1
  55. package/docs/classes/server.PBMGroup.html +1 -1
  56. package/docs/classes/server.PBMMesh.html +1 -1
  57. package/docs/classes/sticker.Sticker.html +1 -1
  58. package/docs/classes/vfx.Airflow.html +1 -1
  59. package/docs/classes/vfx.Flame.html +1 -1
  60. package/docs/classes/vfx.Particle.html +1 -1
  61. package/docs/classes/vfx.SpotLight.html +1 -1
  62. package/docs/index.html +1 -1
  63. package/docs/interfaces/five.AddableObject.html +1 -1
  64. package/docs/interfaces/five.AnimationFrame.html +1 -1
  65. package/docs/interfaces/five.CameraPose.html +1 -1
  66. package/docs/interfaces/five.ClipperParameter.html +1 -1
  67. package/docs/interfaces/five.DepthPanoramaControllerCustomInitArgs.html +3 -3
  68. package/docs/interfaces/five.EventCallback.html +1 -1
  69. package/docs/interfaces/five.FiveInitArgs.html +1 -1
  70. package/docs/interfaces/five.FloorplanControllerCustomInitArgs.html +1 -1
  71. package/docs/interfaces/five.ImageOptions.html +1 -1
  72. package/docs/interfaces/five.ImageURLMappings.html +1 -1
  73. package/docs/interfaces/five.ImageURLOptions.html +1 -1
  74. package/docs/interfaces/five.IntersectMeshInterface.html +1 -1
  75. package/docs/interfaces/five.Intersection.html +3 -3
  76. package/docs/interfaces/five.MapviewControllerCustomInitArgs.html +1 -1
  77. package/docs/interfaces/five.ModelControllerCustomInitArgs.html +1 -1
  78. package/docs/interfaces/five.ModelEventCallback.html +7 -7
  79. package/docs/interfaces/five.MotionKeyframe.html +1 -1
  80. package/docs/interfaces/five.MovePanoOptions.html +1 -1
  81. package/docs/interfaces/five.NetworkOptions.html +1 -1
  82. package/docs/interfaces/five.PBMPanoPicture.html +1 -1
  83. package/docs/interfaces/five.PBMParameters.html +1 -1
  84. package/docs/interfaces/five.PanoCircleMeshInterface.html +2 -2
  85. package/docs/interfaces/five.PanoCircleMeshOptions.html +1 -0
  86. package/docs/interfaces/five.PanoCircleMeshSolidOptions.html +1 -0
  87. package/docs/interfaces/five.PanoramaControllerCustomInitArgs.html +7 -7
  88. package/docs/interfaces/five.PanoramaLikeControllerCustomInitArgs.html +1 -1
  89. package/docs/interfaces/five.Pose.html +1 -1
  90. package/docs/interfaces/five.Scissor.html +1 -1
  91. package/docs/interfaces/five.State.html +1 -1
  92. package/docs/interfaces/five.SubscribeMixinType.emit.html +1 -1
  93. package/docs/interfaces/five.SubscribeMixinType.hasListener.html +1 -1
  94. package/docs/interfaces/five.SubscribeMixinType.off.html +1 -1
  95. package/docs/interfaces/five.SubscribeMixinType.on.html +1 -1
  96. package/docs/interfaces/five.SubscribeMixinType.once.html +1 -1
  97. package/docs/interfaces/five.TextureOptions.html +1 -1
  98. package/docs/interfaces/five.Tile3DModelLoaderOptions.html +1 -1
  99. package/docs/interfaces/five.TileBoundingVolume.html +1 -1
  100. package/docs/interfaces/five.TileContent.html +1 -1
  101. package/docs/interfaces/five.TileCubeNode.html +1 -1
  102. package/docs/interfaces/five.TileCubeTree.html +1 -1
  103. package/docs/interfaces/five.Tileset3dOptions.html +1 -1
  104. package/docs/interfaces/five.TilesetJSON.html +1 -1
  105. package/docs/interfaces/five.TilesetJSONNode.html +1 -1
  106. package/docs/interfaces/five.TopviewControllerCustomInitArgs.html +1 -1
  107. package/docs/interfaces/five.VRPanoramaControllerCustomInitArgs.html +7 -7
  108. package/docs/interfaces/five.WebXRSelectParams.html +1 -1
  109. package/docs/interfaces/five.WorkCubeImage.html +1 -1
  110. package/docs/interfaces/five.WorkImage.html +1 -1
  111. package/docs/interfaces/five.WorkInitial.html +1 -1
  112. package/docs/interfaces/five.WorkModel.html +1 -1
  113. package/docs/interfaces/five.WorkModelTiles.html +1 -1
  114. package/docs/interfaces/five.WorkObserver.html +1 -1
  115. package/docs/interfaces/five.WorkTile.html +1 -1
  116. package/docs/interfaces/five.WorkVideo.html +1 -1
  117. package/docs/interfaces/five.XRPanoramaControllerCustomInitArgs.html +7 -7
  118. package/docs/interfaces/gltf_loader.DDS.html +1 -1
  119. package/docs/interfaces/gltf_loader.GLTF.html +1 -1
  120. package/docs/interfaces/gltf_loader.GLTFReference.html +1 -1
  121. package/docs/interfaces/gltf_loader.THREEGLTF.html +1 -1
  122. package/docs/interfaces/react.FiveActionReactCallbacks.html +1 -1
  123. package/docs/interfaces/react.FiveInjectionTypes.html +1 -1
  124. package/docs/interfaces/react.PropTypeOfFiveFeatures.html +1 -1
  125. package/docs/interfaces/server.Intersection.html +1 -1
  126. package/docs/interfaces/server.ModelEventCallback.html +1 -1
  127. package/docs/interfaces/sticker.IntersectionLike.html +1 -1
  128. package/docs/interfaces/vfx.ParticleArgs.html +1 -1
  129. package/docs/interfaces/vfx.ParticleTweenKeyframe.html +1 -1
  130. package/docs/interfaces/vue.FiveActionVueCallbacks.html +1 -1
  131. package/docs/modules/five.SubscribeMixinType.html +1 -1
  132. package/docs/modules/five.html +10 -10
  133. package/docs/modules/gltf_loader.html +1 -1
  134. package/docs/modules/line.html +1 -1
  135. package/docs/modules/react.html +1 -1
  136. package/docs/modules/server.html +1 -1
  137. package/docs/modules/sticker.html +1 -1
  138. package/docs/modules/vfx.html +1 -1
  139. package/docs/modules/vue.html +1 -1
  140. package/docs/modules.html +1 -1
  141. package/five/index.d.ts +24 -62
  142. package/five/index.js +10 -10
  143. package/gltf-loader/index.js +3 -3
  144. package/line/index.js +3 -3
  145. package/package.json +1 -1
  146. package/react/index.js +2 -2
  147. package/server/index.js +8 -8
  148. package/sticker/index.js +3 -3
  149. package/umd/five-gltf-loader.js +1 -1
  150. package/umd/five-line.js +1 -1
  151. package/umd/five-sticker.js +1 -1
  152. package/umd/five.js +1 -1
  153. package/vfx/index.js +2 -2
  154. package/vue/index.js +2 -2
  155. package/docs/classes/five.LegacyPanoCircleMesh.html +0 -5
  156. package/docs/classes/five.PanoCircleMeshDark.html +0 -8
package/five/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * @realsee/five
3
3
  *
4
- * Generated: 2022-11-22
5
- * Version: 5.0.0-alpha.164
4
+ * Generated: 2022-11-29
5
+ * Version: 5.0.0-alpha.167
6
6
  *
7
7
  * Terms:
8
8
  * Realsee SDK License Agreement
@@ -347,26 +347,26 @@
347
347
  *
348
348
  * https://code.google.com/p/crypto-js/wiki/License
349
349
  * PART: ext/cryptojs
350
- */var s,a={},l={},u=u||function(e,t){var i={},n=i.lib={},r=n.Base=function(){function e(){}return{extend:function(t){e.prototype=this;var i=new e;return t&&i.mixIn(t),i.hasOwnProperty("init")||(i.init=function(){i.$super.init.apply(this,arguments)}),i.init.prototype=i,i.$super=this,i},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),o=n.WordArray=r.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:4*e.length},toString:function(e){return(e||a).stringify(this)},concat:function(e){var t=this.words,i=e.words,n=this.sigBytes,r=e.sigBytes;if(this.clamp(),n%4)for(var o=0;o<r;o++){var s=i[o>>>2]>>>24-o%4*8&255;t[n+o>>>2]|=s<<24-(n+o)%4*8}else for(o=0;o<r;o+=4)t[n+o>>>2]=i[o>>>2];return this.sigBytes+=r,this},clamp:function(){var t=this.words,i=this.sigBytes;t[i>>>2]&=4294967295<<32-i%4*8,t.length=e.ceil(i/4)},clone:function(){var e=r.clone.call(this);return e.words=this.words.slice(0),e},random:function(t){for(var i=[],n=0;n<t;n+=4)i.push(4294967296*e.random()|0);return new o.init(i,t)}}),s=i.enc={},a=s.Hex={stringify:function(e){for(var t=e.words,i=e.sigBytes,n=[],r=0;r<i;r++){var o=t[r>>>2]>>>24-r%4*8&255;n.push((o>>>4).toString(16)),n.push((15&o).toString(16))}return n.join("")},parse:function(e){for(var t=e.length,i=[],n=0;n<t;n+=2)i[n>>>3]|=parseInt(e.substr(n,2),16)<<24-n%8*4;return new o.init(i,t/2)}},l=s.Latin1={stringify:function(e){for(var t=e.words,i=e.sigBytes,n=[],r=0;r<i;r++){var o=t[r>>>2]>>>24-r%4*8&255;n.push(String.fromCharCode(o))}return n.join("")},parse:function(e){for(var t=e.length,i=[],n=0;n<t;n++)i[n>>>2]|=(255&e.charCodeAt(n))<<24-n%4*8;return new o.init(i,t)}},u=s.Utf8={stringify:function(e){try{return decodeURIComponent(escape(l.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return l.parse(unescape(encodeURIComponent(e)))}},c=n.BufferedBlockAlgorithm=r.extend({reset:function(){this._data=new o.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=u.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var i=this._data,n=i.words,r=i.sigBytes,s=this.blockSize,a=r/(4*s),l=(a=t?e.ceil(a):e.max((0|a)-this._minBufferSize,0))*s,u=e.min(4*l,r);if(l){for(var c=0;c<l;c+=s)this._doProcessBlock(n,c);var h=n.splice(0,l);i.sigBytes-=u}return new o.init(h,u)},clone:function(){var e=r.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0});n.Hasher=c.extend({cfg:r.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){c.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function(e){return function(t,i){return new e.init(i).finalize(t)}},_createHmacHelper:function(e){return function(t,i){return new h.HMAC.init(e,i).finalize(t)}}});var h=i.algo={};return i}(Math);function c(e,t,i){null!=e&&("number"==typeof e?this.fromNumber(e,t,i):null==t&&"string"!=typeof e?this.fromString(e,256):this.fromString(e,t))}function h(){return new c(null)}!function(e){for(var t=u,i=(r=t.lib).WordArray,n=r.Hasher,r=t.algo,o=[],s=[],a=function(e){return 4294967296*(e-(0|e))|0},l=2,c=0;64>c;){var h;e:{h=l;for(var d=e.sqrt(h),p=2;p<=d;p++)if(!(h%p)){h=!1;break e}h=!0}h&&(8>c&&(o[c]=a(e.pow(l,.5))),s[c]=a(e.pow(l,1/3)),c++),l++}var f=[];r=r.SHA256=n.extend({_doReset:function(){this._hash=new i.init(o.slice(0))},_doProcessBlock:function(e,t){for(var i=this._hash.words,n=i[0],r=i[1],o=i[2],a=i[3],l=i[4],u=i[5],c=i[6],h=i[7],d=0;64>d;d++){if(16>d)f[d]=0|e[t+d];else{var p=f[d-15],A=f[d-2];f[d]=((p<<25|p>>>7)^(p<<14|p>>>18)^p>>>3)+f[d-7]+((A<<15|A>>>17)^(A<<13|A>>>19)^A>>>10)+f[d-16]}p=h+((l<<26|l>>>6)^(l<<21|l>>>11)^(l<<7|l>>>25))+(l&u^~l&c)+s[d]+f[d],A=((n<<30|n>>>2)^(n<<19|n>>>13)^(n<<10|n>>>22))+(n&r^n&o^r&o),h=c,c=u,u=l,l=a+p|0,a=o,o=r,r=n,n=p+A|0}i[0]=i[0]+n|0,i[1]=i[1]+r|0,i[2]=i[2]+o|0,i[3]=i[3]+a|0,i[4]=i[4]+l|0,i[5]=i[5]+u|0,i[6]=i[6]+c|0,i[7]=i[7]+h|0},_doFinalize:function(){var t=this._data,i=t.words,n=8*this._nDataBytes,r=8*t.sigBytes;return i[r>>>5]|=128<<24-r%32,i[14+(r+64>>>9<<4)]=e.floor(n/4294967296),i[15+(r+64>>>9<<4)]=n,t.sigBytes=4*i.length,this._process(),this._hash},clone:function(){var e=n.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA256=n._createHelper(r),t.HmacSHA256=n._createHmacHelper(r)}(Math),u.lib.Cipher||function(e){var t=(f=u).lib,i=t.Base,n=t.WordArray,r=t.BufferedBlockAlgorithm,o=f.enc.Base64,s=f.algo.EvpKDF,a=t.Cipher=r.extend({cfg:i.extend(),createEncryptor:function(e,t){return this.create(this._ENC_XFORM_MODE,e,t)},createDecryptor:function(e,t){return this.create(this._DEC_XFORM_MODE,e,t)},init:function(e,t,i){this.cfg=this.cfg.extend(i),this._xformMode=e,this._key=t,this.reset()},reset:function(){r.reset.call(this),this._doReset()},process:function(e){return this._append(e),this._process()},finalize:function(e){return e&&this._append(e),this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(e){return{encrypt:function(t,i,n){return("string"==typeof i?A:p).encrypt(e,t,i,n)},decrypt:function(t,i,n){return("string"==typeof i?A:p).decrypt(e,t,i,n)}}}});t.StreamCipher=a.extend({_doFinalize:function(){return this._process(!0)},blockSize:1});var l=f.mode={},c=function(e,t,i){var n=this._iv;n?this._iv=undefined:n=this._prevBlock;for(var r=0;r<i;r++)e[t+r]^=n[r]},h=(t.BlockCipherMode=i.extend({createEncryptor:function(e,t){return this.Encryptor.create(e,t)},createDecryptor:function(e,t){return this.Decryptor.create(e,t)},init:function(e,t){this._cipher=e,this._iv=t}})).extend();h.Encryptor=h.extend({processBlock:function(e,t){var i=this._cipher,n=i.blockSize;c.call(this,e,t,n),i.encryptBlock(e,t),this._prevBlock=e.slice(t,t+n)}}),h.Decryptor=h.extend({processBlock:function(e,t){var i=this._cipher,n=i.blockSize,r=e.slice(t,t+n);i.decryptBlock(e,t),c.call(this,e,t,n),this._prevBlock=r}}),l=l.CBC=h,h=(f.pad={}).Pkcs7={pad:function(e,t){for(var i,r=(i=(i=4*t)-e.sigBytes%i)<<24|i<<16|i<<8|i,o=[],s=0;s<i;s+=4)o.push(r);i=n.create(o,i),e.concat(i)},unpad:function(e){e.sigBytes-=255&e.words[e.sigBytes-1>>>2]}},t.BlockCipher=a.extend({cfg:a.cfg.extend({mode:l,padding:h}),reset:function(){a.reset.call(this);var e=(t=this.cfg).iv,t=t.mode;if(this._xformMode==this._ENC_XFORM_MODE)var i=t.createEncryptor;else i=t.createDecryptor,this._minBufferSize=1;this._mode=i.call(t,this,e&&e.words)},_doProcessBlock:function(e,t){this._mode.processBlock(e,t)},_doFinalize:function(){var e=this.cfg.padding;if(this._xformMode==this._ENC_XFORM_MODE){e.pad(this._data,this.blockSize);var t=this._process(!0)}else t=this._process(!0),e.unpad(t);return t},blockSize:4});var d=t.CipherParams=i.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}}),p=(l=(f.format={}).OpenSSL={stringify:function(e){var t=e.ciphertext;return((e=e.salt)?n.create([1398893684,1701076831]).concat(e).concat(t):t).toString(o)},parse:function(e){var t=(e=o.parse(e)).words;if(1398893684==t[0]&&1701076831==t[1]){var i=n.create(t.slice(2,4));t.splice(0,4),e.sigBytes-=16}return d.create({ciphertext:e,salt:i})}},t.SerializableCipher=i.extend({cfg:i.extend({format:l}),encrypt:function(e,t,i,n){n=this.cfg.extend(n);var r=e.createEncryptor(i,n);return t=r.finalize(t),r=r.cfg,d.create({ciphertext:t,key:i,iv:r.iv,algorithm:e,mode:r.mode,padding:r.padding,blockSize:e.blockSize,formatter:n.format})},decrypt:function(e,t,i,n){return n=this.cfg.extend(n),t=this._parse(t,n.format),e.createDecryptor(i,n).finalize(t.ciphertext)},_parse:function(e,t){return"string"==typeof e?t.parse(e,this):e}})),f=(f.kdf={}).OpenSSL={execute:function(e,t,i,r){return r||(r=n.random(8)),e=s.create({keySize:t+i}).compute(e,r),i=n.create(e.words.slice(t),4*i),e.sigBytes=4*t,d.create({key:e,iv:i,salt:r})}},A=t.PasswordBasedCipher=p.extend({cfg:p.cfg.extend({kdf:f}),encrypt:function(e,t,i,n){return i=(n=this.cfg.extend(n)).kdf.execute(i,e.keySize,e.ivSize),n.iv=i.iv,(e=p.encrypt.call(this,e,t,i.key,n)).mixIn(i),e},decrypt:function(e,t,i,n){return n=this.cfg.extend(n),t=this._parse(t,n.format),i=n.kdf.execute(i,e.keySize,e.ivSize,t.salt),n.iv=i.iv,p.decrypt.call(this,e,t,i.key,n)}})}(),function(){for(var e=u,t=e.lib.BlockCipher,i=e.algo,n=[],r=[],o=[],s=[],a=[],l=[],c=[],h=[],d=[],p=[],f=[],A=0;256>A;A++)f[A]=128>A?A<<1:A<<1^283;var g=0,m=0;for(A=0;256>A;A++){var v=(v=m^m<<1^m<<2^m<<3^m<<4)>>>8^255&v^99;n[g]=v,r[v]=g;var y=f[g],b=f[y],x=f[b],w=257*f[v]^16843008*v;o[g]=w<<24|w>>>8,s[g]=w<<16|w>>>16,a[g]=w<<8|w>>>24,l[g]=w,w=16843009*x^65537*b^257*y^16843008*g,c[v]=w<<24|w>>>8,h[v]=w<<16|w>>>16,d[v]=w<<8|w>>>24,p[v]=w,g?(g=y^f[f[f[x^y]]],m^=f[f[m]]):g=m=1}var M=[0,1,2,4,8,16,32,64,128,27,54];i=i.AES=t.extend({_doReset:function(){for(var e=(i=this._key).words,t=i.sigBytes/4,i=4*((this._nRounds=t+6)+1),r=this._keySchedule=[],o=0;o<i;o++)if(o<t)r[o]=e[o];else{var s=r[o-1];o%t?6<t&&4==o%t&&(s=n[s>>>24]<<24|n[s>>>16&255]<<16|n[s>>>8&255]<<8|n[255&s]):(s=n[(s=s<<8|s>>>24)>>>24]<<24|n[s>>>16&255]<<16|n[s>>>8&255]<<8|n[255&s],s^=M[o/t|0]<<24),r[o]=r[o-t]^s}for(e=this._invKeySchedule=[],t=0;t<i;t++)o=i-t,s=t%4?r[o]:r[o-4],e[t]=4>t||4>=o?s:c[n[s>>>24]]^h[n[s>>>16&255]]^d[n[s>>>8&255]]^p[n[255&s]]},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,o,s,a,l,n)},decryptBlock:function(e,t){var i=e[t+1];e[t+1]=e[t+3],e[t+3]=i,this._doCryptBlock(e,t,this._invKeySchedule,c,h,d,p,r),i=e[t+1],e[t+1]=e[t+3],e[t+3]=i},_doCryptBlock:function(e,t,i,n,r,o,s,a){for(var l=this._nRounds,u=e[t]^i[0],c=e[t+1]^i[1],h=e[t+2]^i[2],d=e[t+3]^i[3],p=4,f=1;f<l;f++){var A=n[u>>>24]^r[c>>>16&255]^o[h>>>8&255]^s[255&d]^i[p++],g=n[c>>>24]^r[h>>>16&255]^o[d>>>8&255]^s[255&u]^i[p++],m=n[h>>>24]^r[d>>>16&255]^o[u>>>8&255]^s[255&c]^i[p++];d=n[d>>>24]^r[u>>>16&255]^o[c>>>8&255]^s[255&h]^i[p++],u=A,c=g,h=m}A=(a[u>>>24]<<24|a[c>>>16&255]<<16|a[h>>>8&255]<<8|a[255&d])^i[p++],g=(a[c>>>24]<<24|a[h>>>16&255]<<16|a[d>>>8&255]<<8|a[255&u])^i[p++],m=(a[h>>>24]<<24|a[d>>>16&255]<<16|a[u>>>8&255]<<8|a[255&c])^i[p++],d=(a[d>>>24]<<24|a[u>>>16&255]<<16|a[c>>>8&255]<<8|a[255&h])^i[p++],e[t]=A,e[t+1]=g,e[t+2]=m,e[t+3]=d},keySize:8});e.AES=t._createHelper(i)}(),
350
+ */var s,a={},l={},u=u||function(e,t){var i={},n=i.lib={},r=n.Base=function(){function e(){}return{extend:function(t){e.prototype=this;var i=new e;return t&&i.mixIn(t),i.hasOwnProperty("init")||(i.init=function(){i.$super.init.apply(this,arguments)}),i.init.prototype=i,i.$super=this,i},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),o=n.WordArray=r.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:4*e.length},toString:function(e){return(e||a).stringify(this)},concat:function(e){var t=this.words,i=e.words,n=this.sigBytes,r=e.sigBytes;if(this.clamp(),n%4)for(var o=0;o<r;o++){var s=i[o>>>2]>>>24-o%4*8&255;t[n+o>>>2]|=s<<24-(n+o)%4*8}else for(o=0;o<r;o+=4)t[n+o>>>2]=i[o>>>2];return this.sigBytes+=r,this},clamp:function(){var t=this.words,i=this.sigBytes;t[i>>>2]&=4294967295<<32-i%4*8,t.length=e.ceil(i/4)},clone:function(){var e=r.clone.call(this);return e.words=this.words.slice(0),e},random:function(t){for(var i=[],n=0;n<t;n+=4)i.push(4294967296*e.random()|0);return new o.init(i,t)}}),s=i.enc={},a=s.Hex={stringify:function(e){for(var t=e.words,i=e.sigBytes,n=[],r=0;r<i;r++){var o=t[r>>>2]>>>24-r%4*8&255;n.push((o>>>4).toString(16)),n.push((15&o).toString(16))}return n.join("")},parse:function(e){for(var t=e.length,i=[],n=0;n<t;n+=2)i[n>>>3]|=parseInt(e.substr(n,2),16)<<24-n%8*4;return new o.init(i,t/2)}},l=s.Latin1={stringify:function(e){for(var t=e.words,i=e.sigBytes,n=[],r=0;r<i;r++){var o=t[r>>>2]>>>24-r%4*8&255;n.push(String.fromCharCode(o))}return n.join("")},parse:function(e){for(var t=e.length,i=[],n=0;n<t;n++)i[n>>>2]|=(255&e.charCodeAt(n))<<24-n%4*8;return new o.init(i,t)}},u=s.Utf8={stringify:function(e){try{return decodeURIComponent(escape(l.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return l.parse(unescape(encodeURIComponent(e)))}},c=n.BufferedBlockAlgorithm=r.extend({reset:function(){this._data=new o.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=u.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var i=this._data,n=i.words,r=i.sigBytes,s=this.blockSize,a=r/(4*s),l=(a=t?e.ceil(a):e.max((0|a)-this._minBufferSize,0))*s,u=e.min(4*l,r);if(l){for(var c=0;c<l;c+=s)this._doProcessBlock(n,c);var h=n.splice(0,l);i.sigBytes-=u}return new o.init(h,u)},clone:function(){var e=r.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0});n.Hasher=c.extend({cfg:r.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){c.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function(e){return function(t,i){return new e.init(i).finalize(t)}},_createHmacHelper:function(e){return function(t,i){return new h.HMAC.init(e,i).finalize(t)}}});var h=i.algo={};return i}(Math);function c(e,t,i){null!=e&&("number"==typeof e?this.fromNumber(e,t,i):null==t&&"string"!=typeof e?this.fromString(e,256):this.fromString(e,t))}function h(){return new c(null)}!function(e){for(var t=u,i=(r=t.lib).WordArray,n=r.Hasher,r=t.algo,o=[],s=[],a=function(e){return 4294967296*(e-(0|e))|0},l=2,c=0;64>c;){var h;e:{h=l;for(var d=e.sqrt(h),p=2;p<=d;p++)if(!(h%p)){h=!1;break e}h=!0}h&&(8>c&&(o[c]=a(e.pow(l,.5))),s[c]=a(e.pow(l,1/3)),c++),l++}var f=[];r=r.SHA256=n.extend({_doReset:function(){this._hash=new i.init(o.slice(0))},_doProcessBlock:function(e,t){for(var i=this._hash.words,n=i[0],r=i[1],o=i[2],a=i[3],l=i[4],u=i[5],c=i[6],h=i[7],d=0;64>d;d++){if(16>d)f[d]=0|e[t+d];else{var p=f[d-15],A=f[d-2];f[d]=((p<<25|p>>>7)^(p<<14|p>>>18)^p>>>3)+f[d-7]+((A<<15|A>>>17)^(A<<13|A>>>19)^A>>>10)+f[d-16]}p=h+((l<<26|l>>>6)^(l<<21|l>>>11)^(l<<7|l>>>25))+(l&u^~l&c)+s[d]+f[d],A=((n<<30|n>>>2)^(n<<19|n>>>13)^(n<<10|n>>>22))+(n&r^n&o^r&o),h=c,c=u,u=l,l=a+p|0,a=o,o=r,r=n,n=p+A|0}i[0]=i[0]+n|0,i[1]=i[1]+r|0,i[2]=i[2]+o|0,i[3]=i[3]+a|0,i[4]=i[4]+l|0,i[5]=i[5]+u|0,i[6]=i[6]+c|0,i[7]=i[7]+h|0},_doFinalize:function(){var t=this._data,i=t.words,n=8*this._nDataBytes,r=8*t.sigBytes;return i[r>>>5]|=128<<24-r%32,i[14+(r+64>>>9<<4)]=e.floor(n/4294967296),i[15+(r+64>>>9<<4)]=n,t.sigBytes=4*i.length,this._process(),this._hash},clone:function(){var e=n.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA256=n._createHelper(r),t.HmacSHA256=n._createHmacHelper(r)}(Math),u.lib.Cipher||function(e){var t=(f=u).lib,i=t.Base,n=t.WordArray,r=t.BufferedBlockAlgorithm,o=f.enc.Base64,s=f.algo.EvpKDF,a=t.Cipher=r.extend({cfg:i.extend(),createEncryptor:function(e,t){return this.create(this._ENC_XFORM_MODE,e,t)},createDecryptor:function(e,t){return this.create(this._DEC_XFORM_MODE,e,t)},init:function(e,t,i){this.cfg=this.cfg.extend(i),this._xformMode=e,this._key=t,this.reset()},reset:function(){r.reset.call(this),this._doReset()},process:function(e){return this._append(e),this._process()},finalize:function(e){return e&&this._append(e),this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(e){return{encrypt:function(t,i,n){return("string"==typeof i?A:p).encrypt(e,t,i,n)},decrypt:function(t,i,n){return("string"==typeof i?A:p).decrypt(e,t,i,n)}}}});t.StreamCipher=a.extend({_doFinalize:function(){return this._process(!0)},blockSize:1});var l=f.mode={},c=function(e,t,i){var n=this._iv;n?this._iv=undefined:n=this._prevBlock;for(var r=0;r<i;r++)e[t+r]^=n[r]},h=(t.BlockCipherMode=i.extend({createEncryptor:function(e,t){return this.Encryptor.create(e,t)},createDecryptor:function(e,t){return this.Decryptor.create(e,t)},init:function(e,t){this._cipher=e,this._iv=t}})).extend();h.Encryptor=h.extend({processBlock:function(e,t){var i=this._cipher,n=i.blockSize;c.call(this,e,t,n),i.encryptBlock(e,t),this._prevBlock=e.slice(t,t+n)}}),h.Decryptor=h.extend({processBlock:function(e,t){var i=this._cipher,n=i.blockSize,r=e.slice(t,t+n);i.decryptBlock(e,t),c.call(this,e,t,n),this._prevBlock=r}}),l=l.CBC=h,h=(f.pad={}).Pkcs7={pad:function(e,t){for(var i,r=(i=(i=4*t)-e.sigBytes%i)<<24|i<<16|i<<8|i,o=[],s=0;s<i;s+=4)o.push(r);i=n.create(o,i),e.concat(i)},unpad:function(e){e.sigBytes-=255&e.words[e.sigBytes-1>>>2]}},t.BlockCipher=a.extend({cfg:a.cfg.extend({mode:l,padding:h}),reset:function(){a.reset.call(this);var e=(t=this.cfg).iv,t=t.mode;if(this._xformMode==this._ENC_XFORM_MODE)var i=t.createEncryptor;else i=t.createDecryptor,this._minBufferSize=1;this._mode=i.call(t,this,e&&e.words)},_doProcessBlock:function(e,t){this._mode.processBlock(e,t)},_doFinalize:function(){var e=this.cfg.padding;if(this._xformMode==this._ENC_XFORM_MODE){e.pad(this._data,this.blockSize);var t=this._process(!0)}else t=this._process(!0),e.unpad(t);return t},blockSize:4});var d=t.CipherParams=i.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}}),p=(l=(f.format={}).OpenSSL={stringify:function(e){var t=e.ciphertext;return((e=e.salt)?n.create([1398893684,1701076831]).concat(e).concat(t):t).toString(o)},parse:function(e){var t=(e=o.parse(e)).words;if(1398893684==t[0]&&1701076831==t[1]){var i=n.create(t.slice(2,4));t.splice(0,4),e.sigBytes-=16}return d.create({ciphertext:e,salt:i})}},t.SerializableCipher=i.extend({cfg:i.extend({format:l}),encrypt:function(e,t,i,n){n=this.cfg.extend(n);var r=e.createEncryptor(i,n);return t=r.finalize(t),r=r.cfg,d.create({ciphertext:t,key:i,iv:r.iv,algorithm:e,mode:r.mode,padding:r.padding,blockSize:e.blockSize,formatter:n.format})},decrypt:function(e,t,i,n){return n=this.cfg.extend(n),t=this._parse(t,n.format),e.createDecryptor(i,n).finalize(t.ciphertext)},_parse:function(e,t){return"string"==typeof e?t.parse(e,this):e}})),f=(f.kdf={}).OpenSSL={execute:function(e,t,i,r){return r||(r=n.random(8)),e=s.create({keySize:t+i}).compute(e,r),i=n.create(e.words.slice(t),4*i),e.sigBytes=4*t,d.create({key:e,iv:i,salt:r})}},A=t.PasswordBasedCipher=p.extend({cfg:p.cfg.extend({kdf:f}),encrypt:function(e,t,i,n){return i=(n=this.cfg.extend(n)).kdf.execute(i,e.keySize,e.ivSize),n.iv=i.iv,(e=p.encrypt.call(this,e,t,i.key,n)).mixIn(i),e},decrypt:function(e,t,i,n){return n=this.cfg.extend(n),t=this._parse(t,n.format),i=n.kdf.execute(i,e.keySize,e.ivSize,t.salt),n.iv=i.iv,p.decrypt.call(this,e,t,i.key,n)}})}(),function(){for(var e=u,t=e.lib.BlockCipher,i=e.algo,n=[],r=[],o=[],s=[],a=[],l=[],c=[],h=[],d=[],p=[],f=[],A=0;256>A;A++)f[A]=128>A?A<<1:A<<1^283;var m=0,g=0;for(A=0;256>A;A++){var v=(v=g^g<<1^g<<2^g<<3^g<<4)>>>8^255&v^99;n[m]=v,r[v]=m;var y=f[m],b=f[y],x=f[b],w=257*f[v]^16843008*v;o[m]=w<<24|w>>>8,s[m]=w<<16|w>>>16,a[m]=w<<8|w>>>24,l[m]=w,w=16843009*x^65537*b^257*y^16843008*m,c[v]=w<<24|w>>>8,h[v]=w<<16|w>>>16,d[v]=w<<8|w>>>24,p[v]=w,m?(m=y^f[f[f[x^y]]],g^=f[f[g]]):m=g=1}var E=[0,1,2,4,8,16,32,64,128,27,54];i=i.AES=t.extend({_doReset:function(){for(var e=(i=this._key).words,t=i.sigBytes/4,i=4*((this._nRounds=t+6)+1),r=this._keySchedule=[],o=0;o<i;o++)if(o<t)r[o]=e[o];else{var s=r[o-1];o%t?6<t&&4==o%t&&(s=n[s>>>24]<<24|n[s>>>16&255]<<16|n[s>>>8&255]<<8|n[255&s]):(s=n[(s=s<<8|s>>>24)>>>24]<<24|n[s>>>16&255]<<16|n[s>>>8&255]<<8|n[255&s],s^=E[o/t|0]<<24),r[o]=r[o-t]^s}for(e=this._invKeySchedule=[],t=0;t<i;t++)o=i-t,s=t%4?r[o]:r[o-4],e[t]=4>t||4>=o?s:c[n[s>>>24]]^h[n[s>>>16&255]]^d[n[s>>>8&255]]^p[n[255&s]]},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,o,s,a,l,n)},decryptBlock:function(e,t){var i=e[t+1];e[t+1]=e[t+3],e[t+3]=i,this._doCryptBlock(e,t,this._invKeySchedule,c,h,d,p,r),i=e[t+1],e[t+1]=e[t+3],e[t+3]=i},_doCryptBlock:function(e,t,i,n,r,o,s,a){for(var l=this._nRounds,u=e[t]^i[0],c=e[t+1]^i[1],h=e[t+2]^i[2],d=e[t+3]^i[3],p=4,f=1;f<l;f++){var A=n[u>>>24]^r[c>>>16&255]^o[h>>>8&255]^s[255&d]^i[p++],m=n[c>>>24]^r[h>>>16&255]^o[d>>>8&255]^s[255&u]^i[p++],g=n[h>>>24]^r[d>>>16&255]^o[u>>>8&255]^s[255&c]^i[p++];d=n[d>>>24]^r[u>>>16&255]^o[c>>>8&255]^s[255&h]^i[p++],u=A,c=m,h=g}A=(a[u>>>24]<<24|a[c>>>16&255]<<16|a[h>>>8&255]<<8|a[255&d])^i[p++],m=(a[c>>>24]<<24|a[h>>>16&255]<<16|a[d>>>8&255]<<8|a[255&u])^i[p++],g=(a[h>>>24]<<24|a[d>>>16&255]<<16|a[u>>>8&255]<<8|a[255&c])^i[p++],d=(a[d>>>24]<<24|a[u>>>16&255]<<16|a[c>>>8&255]<<8|a[255&h])^i[p++],e[t]=A,e[t+1]=m,e[t+2]=g,e[t+3]=d},keySize:8});e.AES=t._createHelper(i)}(),
351
351
  /*!
352
352
  Copyright (c) 2011, Yahoo! Inc. All rights reserved.
353
353
  Code licensed under the BSD License:
354
354
  http://developer.yahoo.com/yui/license.html
355
355
  version: 2.9.0
356
356
  */
357
- l.lang={extend:function(e,t,i){if(!t||!e)throw new Error("YAHOO.lang.extend failed, please check that all dependencies are included.");var n=function(){};if(n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e,e.superclass=t.prototype,t.prototype.constructor==Object.prototype.constructor&&(t.prototype.constructor=t),i){var r;for(r in i)e.prototype[r]=i[r];var o=function(){},s=["toString","valueOf"];try{/MSIE/.test("undefined"!=typeof navigator?navigator.userAgent:"node")&&(o=function(e,t){for(r=0;r<s.length;r+=1){var i=s[r],n=t[i];"function"==typeof n&&n!=Object.prototype[i]&&(e[i]=n)}})}catch(e){}o(e.prototype,i)}}},"undefined"!=typeof navigator&&"Microsoft Internet Explorer"==navigator.appName?(c.prototype.am=function(e,t,i,n,r,o){for(var s=32767&t,a=t>>15;--o>=0;){var l=32767&this[e],u=this[e++]>>15,c=a*l+u*s;r=((l=s*l+((32767&c)<<15)+i[n]+(1073741823&r))>>>30)+(c>>>15)+a*u+(r>>>30),i[n++]=1073741823&l}return r},s=30):"undefined"!=typeof navigator&&"Netscape"!=navigator.appName?(c.prototype.am=function(e,t,i,n,r,o){for(;--o>=0;){var s=t*this[e++]+i[n]+r;r=Math.floor(s/67108864),i[n++]=67108863&s}return r},s=26):(c.prototype.am=function(e,t,i,n,r,o){for(var s=16383&t,a=t>>14;--o>=0;){var l=16383&this[e],u=this[e++]>>14,c=a*l+u*s;r=((l=s*l+((16383&c)<<14)+i[n]+r)>>28)+(c>>14)+a*u,i[n++]=268435455&l}return r},s=28),c.prototype.DB=s,c.prototype.DM=(1<<s)-1,c.prototype.DV=1<<s;c.prototype.FV=Math.pow(2,52),c.prototype.F1=52-s,c.prototype.F2=2*s-52;var d,p,f=new Array;for(d="0".charCodeAt(0),p=0;p<=9;++p)f[d++]=p;for(d="a".charCodeAt(0),p=10;p<36;++p)f[d++]=p;for(d="A".charCodeAt(0),p=10;p<36;++p)f[d++]=p;function A(e){return"0123456789abcdefghijklmnopqrstuvwxyz".charAt(e)}function g(e,t){var i=f[e.charCodeAt(t)];return null==i?-1:i}function m(e){var t=h();return t.fromInt(e),t}function v(e){var t,i=1;return 0!=(t=e>>>16)&&(e=t,i+=16),0!=(t=e>>8)&&(e=t,i+=8),0!=(t=e>>4)&&(e=t,i+=4),0!=(t=e>>2)&&(e=t,i+=2),0!=(t=e>>1)&&(e=t,i+=1),i}function y(e){this.m=e}function b(e){this.m=e,this.mp=e.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<e.DB-15)-1,this.mt2=2*e.t}function x(e,t){return e&t}function w(e,t){return e|t}function M(e,t){return e^t}function E(e,t){return e&~t}function S(e){if(0==e)return-1;var t=0;return 0==(65535&e)&&(e>>=16,t+=16),0==(255&e)&&(e>>=8,t+=8),0==(15&e)&&(e>>=4,t+=4),0==(3&e)&&(e>>=2,t+=2),0==(1&e)&&++t,t}function C(e){for(var t=0;0!=e;)e&=e-1,++t;return t}function I(){}function B(e){return e}function T(e){this.r2=h(),this.q3=h(),c.ONE.dlShiftTo(2*e.t,this.r2),this.mu=this.r2.divide(e),this.m=e}y.prototype.convert=function(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e},y.prototype.revert=function(e){return e},y.prototype.reduce=function(e){e.divRemTo(this.m,null,e)},y.prototype.mulTo=function(e,t,i){e.multiplyTo(t,i),this.reduce(i)},y.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},b.prototype.convert=function(e){var t=h();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(c.ZERO)>0&&this.m.subTo(t,t),t},b.prototype.revert=function(e){var t=h();return e.copyTo(t),this.reduce(t),t},b.prototype.reduce=function(e){for(;e.t<=this.mt2;)e[e.t++]=0;for(var t=0;t<this.m.t;++t){var i=32767&e[t],n=i*this.mpl+((i*this.mph+(e[t]>>15)*this.mpl&this.um)<<15)&e.DM;for(e[i=t+this.m.t]+=this.m.am(0,n,e,t,0,this.m.t);e[i]>=e.DV;)e[i]-=e.DV,e[++i]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)},b.prototype.mulTo=function(e,t,i){e.multiplyTo(t,i),this.reduce(i)},b.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},c.prototype.copyTo=function(e){for(var t=this.t-1;t>=0;--t)e[t]=this[t];e.t=this.t,e.s=this.s},c.prototype.fromInt=function(e){this.t=1,this.s=e<0?-1:0,e>0?this[0]=e:e<-1?this[0]=e+this.DV:this.t=0},c.prototype.fromString=function(e,t){var i;if(16==t)i=4;else if(8==t)i=3;else if(256==t)i=8;else if(2==t)i=1;else if(32==t)i=5;else{if(4!=t)return void this.fromRadix(e,t);i=2}this.t=0,this.s=0;for(var n=e.length,r=!1,o=0;--n>=0;){var s=8==i?255&e[n]:g(e,n);s<0?"-"==e.charAt(n)&&(r=!0):(r=!1,0==o?this[this.t++]=s:o+i>this.DB?(this[this.t-1]|=(s&(1<<this.DB-o)-1)<<o,this[this.t++]=s>>this.DB-o):this[this.t-1]|=s<<o,(o+=i)>=this.DB&&(o-=this.DB))}8==i&&0!=(128&e[0])&&(this.s=-1,o>0&&(this[this.t-1]|=(1<<this.DB-o)-1<<o)),this.clamp(),r&&c.ZERO.subTo(this,this)},c.prototype.clamp=function(){for(var e=this.s&this.DM;this.t>0&&this[this.t-1]==e;)--this.t},c.prototype.dlShiftTo=function(e,t){var i;for(i=this.t-1;i>=0;--i)t[i+e]=this[i];for(i=e-1;i>=0;--i)t[i]=0;t.t=this.t+e,t.s=this.s},c.prototype.drShiftTo=function(e,t){for(var i=e;i<this.t;++i)t[i-e]=this[i];t.t=Math.max(this.t-e,0),t.s=this.s},c.prototype.lShiftTo=function(e,t){var i,n=e%this.DB,r=this.DB-n,o=(1<<r)-1,s=Math.floor(e/this.DB),a=this.s<<n&this.DM;for(i=this.t-1;i>=0;--i)t[i+s+1]=this[i]>>r|a,a=(this[i]&o)<<n;for(i=s-1;i>=0;--i)t[i]=0;t[s]=a,t.t=this.t+s+1,t.s=this.s,t.clamp()},c.prototype.rShiftTo=function(e,t){t.s=this.s;var i=Math.floor(e/this.DB);if(i>=this.t)t.t=0;else{var n=e%this.DB,r=this.DB-n,o=(1<<n)-1;t[0]=this[i]>>n;for(var s=i+1;s<this.t;++s)t[s-i-1]|=(this[s]&o)<<r,t[s-i]=this[s]>>n;n>0&&(t[this.t-i-1]|=(this.s&o)<<r),t.t=this.t-i,t.clamp()}},c.prototype.subTo=function(e,t){for(var i=0,n=0,r=Math.min(e.t,this.t);i<r;)n+=this[i]-e[i],t[i++]=n&this.DM,n>>=this.DB;if(e.t<this.t){for(n-=e.s;i<this.t;)n+=this[i],t[i++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;i<e.t;)n-=e[i],t[i++]=n&this.DM,n>>=this.DB;n-=e.s}t.s=n<0?-1:0,n<-1?t[i++]=this.DV+n:n>0&&(t[i++]=n),t.t=i,t.clamp()},c.prototype.multiplyTo=function(e,t){var i=this.abs(),n=e.abs(),r=i.t;for(t.t=r+n.t;--r>=0;)t[r]=0;for(r=0;r<n.t;++r)t[r+i.t]=i.am(0,n[r],t,r,0,i.t);t.s=0,t.clamp(),this.s!=e.s&&c.ZERO.subTo(t,t)},c.prototype.squareTo=function(e){for(var t=this.abs(),i=e.t=2*t.t;--i>=0;)e[i]=0;for(i=0;i<t.t-1;++i){var n=t.am(i,t[i],e,2*i,0,1);(e[i+t.t]+=t.am(i+1,2*t[i],e,2*i+1,n,t.t-i-1))>=t.DV&&(e[i+t.t]-=t.DV,e[i+t.t+1]=1)}e.t>0&&(e[e.t-1]+=t.am(i,t[i],e,2*i,0,1)),e.s=0,e.clamp()},c.prototype.divRemTo=function(e,t,i){var n=e.abs();if(!(n.t<=0)){var r=this.abs();if(r.t<n.t)return null!=t&&t.fromInt(0),void(null!=i&&this.copyTo(i));null==i&&(i=h());var o=h(),s=this.s,a=e.s,l=this.DB-v(n[n.t-1]);l>0?(n.lShiftTo(l,o),r.lShiftTo(l,i)):(n.copyTo(o),r.copyTo(i));var u=o.t,d=o[u-1];if(0!=d){var p=d*(1<<this.F1)+(u>1?o[u-2]>>this.F2:0),f=this.FV/p,A=(1<<this.F1)/p,g=1<<this.F2,m=i.t,y=m-u,b=null==t?h():t;for(o.dlShiftTo(y,b),i.compareTo(b)>=0&&(i[i.t++]=1,i.subTo(b,i)),c.ONE.dlShiftTo(u,b),b.subTo(o,o);o.t<u;)o[o.t++]=0;for(;--y>=0;){var x=i[--m]==d?this.DM:Math.floor(i[m]*f+(i[m-1]+g)*A);if((i[m]+=o.am(0,x,i,y,0,u))<x)for(o.dlShiftTo(y,b),i.subTo(b,i);i[m]<--x;)i.subTo(b,i)}null!=t&&(i.drShiftTo(u,t),s!=a&&c.ZERO.subTo(t,t)),i.t=u,i.clamp(),l>0&&i.rShiftTo(l,i),s<0&&c.ZERO.subTo(i,i)}}},c.prototype.invDigit=function(){if(this.t<1)return 0;var e=this[0];if(0==(1&e))return 0;var t=3&e;return(t=(t=(t=(t=t*(2-(15&e)*t)&15)*(2-(255&e)*t)&255)*(2-((65535&e)*t&65535))&65535)*(2-e*t%this.DV)%this.DV)>0?this.DV-t:-t},c.prototype.isEven=function(){return 0==(this.t>0?1&this[0]:this.s)},c.prototype.exp=function(e,t){if(e>4294967295||e<1)return c.ONE;var i=h(),n=h(),r=t.convert(this),o=v(e)-1;for(r.copyTo(i);--o>=0;)if(t.sqrTo(i,n),(e&1<<o)>0)t.mulTo(n,r,i);else{var s=i;i=n,n=s}return t.revert(i)},c.prototype.toString=function(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)return this.toRadix(e);t=2}var i,n=(1<<t)-1,r=!1,o="",s=this.t,a=this.DB-s*this.DB%t;if(s-- >0)for(a<this.DB&&(i=this[s]>>a)>0&&(r=!0,o=A(i));s>=0;)a<t?(i=(this[s]&(1<<a)-1)<<t-a,i|=this[--s]>>(a+=this.DB-t)):(i=this[s]>>(a-=t)&n,a<=0&&(a+=this.DB,--s)),i>0&&(r=!0),r&&(o+=A(i));return r?o:"0"},c.prototype.negate=function(){var e=h();return c.ZERO.subTo(this,e),e},c.prototype.abs=function(){return this.s<0?this.negate():this},c.prototype.compareTo=function(e){var t=this.s-e.s;if(0!=t)return t;var i=this.t;if(0!=(t=i-e.t))return this.s<0?-t:t;for(;--i>=0;)if(0!=(t=this[i]-e[i]))return t;return 0},c.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+v(this[this.t-1]^this.s&this.DM)},c.prototype.mod=function(e){var t=h();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(c.ZERO)>0&&e.subTo(t,t),t},c.prototype.modPowInt=function(e,t){var i;return i=e<256||t.isEven()?new y(t):new b(t),this.exp(e,i)},c.ZERO=m(0),c.ONE=m(1),I.prototype.convert=B,I.prototype.revert=B,I.prototype.mulTo=function(e,t,i){e.multiplyTo(t,i)},I.prototype.sqrTo=function(e,t){e.squareTo(t)},T.prototype.convert=function(e){if(e.s<0||e.t>2*this.m.t)return e.mod(this.m);if(e.compareTo(this.m)<0)return e;var t=h();return e.copyTo(t),this.reduce(t),t},T.prototype.revert=function(e){return e},T.prototype.reduce=function(e){for(e.drShiftTo(this.m.t-1,this.r2),e.t>this.m.t+1&&(e.t=this.m.t+1,e.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);e.compareTo(this.r2)<0;)e.dAddOffset(1,this.m.t+1);for(e.subTo(this.r2,e);e.compareTo(this.m)>=0;)e.subTo(this.m,e)},T.prototype.mulTo=function(e,t,i){e.multiplyTo(t,i),this.reduce(i)},T.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)};var P=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],R=(1<<26)/P[P.length-1];c.prototype.chunkSize=function(e){return Math.floor(Math.LN2*this.DB/Math.log(e))},c.prototype.toRadix=function(e){if(null==e&&(e=10),0==this.signum()||e<2||e>36)return"0";var t=this.chunkSize(e),i=Math.pow(e,t),n=m(i),r=h(),o=h(),s="";for(this.divRemTo(n,r,o);r.signum()>0;)s=(i+o.intValue()).toString(e).substr(1)+s,r.divRemTo(n,r,o);return o.intValue().toString(e)+s},c.prototype.fromRadix=function(e,t){this.fromInt(0),null==t&&(t=10);for(var i=this.chunkSize(t),n=Math.pow(t,i),r=!1,o=0,s=0,a=0;a<e.length;++a){var l=g(e,a);l<0?"-"==e.charAt(a)&&0==this.signum()&&(r=!0):(s=t*s+l,++o>=i&&(this.dMultiply(n),this.dAddOffset(s,0),o=0,s=0))}o>0&&(this.dMultiply(Math.pow(t,o)),this.dAddOffset(s,0)),r&&c.ZERO.subTo(this,this)},c.prototype.fromNumber=function(e,t,i){if("number"==typeof t)if(e<2)this.fromInt(1);else for(this.fromNumber(e,i),this.testBit(e-1)||this.bitwiseTo(c.ONE.shiftLeft(e-1),w,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(t);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(c.ONE.shiftLeft(e-1),this);else{var n=new Array,r=7&e;n.length=1+(e>>3),t.nextBytes(n),r>0?n[0]&=(1<<r)-1:n[0]=0,this.fromString(n,256)}},c.prototype.bitwiseTo=function(e,t,i){var n,r,o=Math.min(e.t,this.t);for(n=0;n<o;++n)i[n]=t(this[n],e[n]);if(e.t<this.t){for(r=e.s&this.DM,n=o;n<this.t;++n)i[n]=t(this[n],r);i.t=this.t}else{for(r=this.s&this.DM,n=o;n<e.t;++n)i[n]=t(r,e[n]);i.t=e.t}i.s=t(this.s,e.s),i.clamp()},c.prototype.changeBit=function(e,t){var i=c.ONE.shiftLeft(e);return this.bitwiseTo(i,t,i),i},c.prototype.addTo=function(e,t){for(var i=0,n=0,r=Math.min(e.t,this.t);i<r;)n+=this[i]+e[i],t[i++]=n&this.DM,n>>=this.DB;if(e.t<this.t){for(n+=e.s;i<this.t;)n+=this[i],t[i++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;i<e.t;)n+=e[i],t[i++]=n&this.DM,n>>=this.DB;n+=e.s}t.s=n<0?-1:0,n>0?t[i++]=n:n<-1&&(t[i++]=this.DV+n),t.t=i,t.clamp()},c.prototype.dMultiply=function(e){this[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()},c.prototype.dAddOffset=function(e,t){if(0!=e){for(;this.t<=t;)this[this.t++]=0;for(this[t]+=e;this[t]>=this.DV;)this[t]-=this.DV,++t>=this.t&&(this[this.t++]=0),++this[t]}},c.prototype.multiplyLowerTo=function(e,t,i){var n,r=Math.min(this.t+e.t,t);for(i.s=0,i.t=r;r>0;)i[--r]=0;for(n=i.t-this.t;r<n;++r)i[r+this.t]=this.am(0,e[r],i,r,0,this.t);for(n=Math.min(e.t,t);r<n;++r)this.am(0,e[r],i,r,0,t-r);i.clamp()},c.prototype.multiplyUpperTo=function(e,t,i){--t;var n=i.t=this.t+e.t-t;for(i.s=0;--n>=0;)i[n]=0;for(n=Math.max(t-this.t,0);n<e.t;++n)i[this.t+n-t]=this.am(t-n,e[n],i,0,0,this.t+n-t);i.clamp(),i.drShiftTo(1,i)},c.prototype.modInt=function(e){if(e<=0)return 0;var t=this.DV%e,i=this.s<0?e-1:0;if(this.t>0)if(0==t)i=this[0]%e;else for(var n=this.t-1;n>=0;--n)i=(t*i+this[n])%e;return i},c.prototype.millerRabin=function(e){var t=this.subtract(c.ONE),i=t.getLowestSetBit();if(i<=0)return!1;var n=t.shiftRight(i);(e=e+1>>1)>P.length&&(e=P.length);for(var r=h(),o=0;o<e;++o){r.fromInt(P[Math.floor(Math.random()*P.length)]);var s=r.modPow(n,this);if(0!=s.compareTo(c.ONE)&&0!=s.compareTo(t)){for(var a=1;a++<i&&0!=s.compareTo(t);)if(0==(s=s.modPowInt(2,this)).compareTo(c.ONE))return!1;if(0!=s.compareTo(t))return!1}}return!0},c.prototype.clone=
357
+ l.lang={extend:function(e,t,i){if(!t||!e)throw new Error("YAHOO.lang.extend failed, please check that all dependencies are included.");var n=function(){};if(n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e,e.superclass=t.prototype,t.prototype.constructor==Object.prototype.constructor&&(t.prototype.constructor=t),i){var r;for(r in i)e.prototype[r]=i[r];var o=function(){},s=["toString","valueOf"];try{/MSIE/.test("undefined"!=typeof navigator?navigator.userAgent:"node")&&(o=function(e,t){for(r=0;r<s.length;r+=1){var i=s[r],n=t[i];"function"==typeof n&&n!=Object.prototype[i]&&(e[i]=n)}})}catch(e){}o(e.prototype,i)}}},"undefined"!=typeof navigator&&"Microsoft Internet Explorer"==navigator.appName?(c.prototype.am=function(e,t,i,n,r,o){for(var s=32767&t,a=t>>15;--o>=0;){var l=32767&this[e],u=this[e++]>>15,c=a*l+u*s;r=((l=s*l+((32767&c)<<15)+i[n]+(1073741823&r))>>>30)+(c>>>15)+a*u+(r>>>30),i[n++]=1073741823&l}return r},s=30):"undefined"!=typeof navigator&&"Netscape"!=navigator.appName?(c.prototype.am=function(e,t,i,n,r,o){for(;--o>=0;){var s=t*this[e++]+i[n]+r;r=Math.floor(s/67108864),i[n++]=67108863&s}return r},s=26):(c.prototype.am=function(e,t,i,n,r,o){for(var s=16383&t,a=t>>14;--o>=0;){var l=16383&this[e],u=this[e++]>>14,c=a*l+u*s;r=((l=s*l+((16383&c)<<14)+i[n]+r)>>28)+(c>>14)+a*u,i[n++]=268435455&l}return r},s=28),c.prototype.DB=s,c.prototype.DM=(1<<s)-1,c.prototype.DV=1<<s;c.prototype.FV=Math.pow(2,52),c.prototype.F1=52-s,c.prototype.F2=2*s-52;var d,p,f=new Array;for(d="0".charCodeAt(0),p=0;p<=9;++p)f[d++]=p;for(d="a".charCodeAt(0),p=10;p<36;++p)f[d++]=p;for(d="A".charCodeAt(0),p=10;p<36;++p)f[d++]=p;function A(e){return"0123456789abcdefghijklmnopqrstuvwxyz".charAt(e)}function m(e,t){var i=f[e.charCodeAt(t)];return null==i?-1:i}function g(e){var t=h();return t.fromInt(e),t}function v(e){var t,i=1;return 0!=(t=e>>>16)&&(e=t,i+=16),0!=(t=e>>8)&&(e=t,i+=8),0!=(t=e>>4)&&(e=t,i+=4),0!=(t=e>>2)&&(e=t,i+=2),0!=(t=e>>1)&&(e=t,i+=1),i}function y(e){this.m=e}function b(e){this.m=e,this.mp=e.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<e.DB-15)-1,this.mt2=2*e.t}function x(e,t){return e&t}function w(e,t){return e|t}function E(e,t){return e^t}function M(e,t){return e&~t}function S(e){if(0==e)return-1;var t=0;return 0==(65535&e)&&(e>>=16,t+=16),0==(255&e)&&(e>>=8,t+=8),0==(15&e)&&(e>>=4,t+=4),0==(3&e)&&(e>>=2,t+=2),0==(1&e)&&++t,t}function C(e){for(var t=0;0!=e;)e&=e-1,++t;return t}function I(){}function B(e){return e}function T(e){this.r2=h(),this.q3=h(),c.ONE.dlShiftTo(2*e.t,this.r2),this.mu=this.r2.divide(e),this.m=e}y.prototype.convert=function(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e},y.prototype.revert=function(e){return e},y.prototype.reduce=function(e){e.divRemTo(this.m,null,e)},y.prototype.mulTo=function(e,t,i){e.multiplyTo(t,i),this.reduce(i)},y.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},b.prototype.convert=function(e){var t=h();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(c.ZERO)>0&&this.m.subTo(t,t),t},b.prototype.revert=function(e){var t=h();return e.copyTo(t),this.reduce(t),t},b.prototype.reduce=function(e){for(;e.t<=this.mt2;)e[e.t++]=0;for(var t=0;t<this.m.t;++t){var i=32767&e[t],n=i*this.mpl+((i*this.mph+(e[t]>>15)*this.mpl&this.um)<<15)&e.DM;for(e[i=t+this.m.t]+=this.m.am(0,n,e,t,0,this.m.t);e[i]>=e.DV;)e[i]-=e.DV,e[++i]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)},b.prototype.mulTo=function(e,t,i){e.multiplyTo(t,i),this.reduce(i)},b.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},c.prototype.copyTo=function(e){for(var t=this.t-1;t>=0;--t)e[t]=this[t];e.t=this.t,e.s=this.s},c.prototype.fromInt=function(e){this.t=1,this.s=e<0?-1:0,e>0?this[0]=e:e<-1?this[0]=e+this.DV:this.t=0},c.prototype.fromString=function(e,t){var i;if(16==t)i=4;else if(8==t)i=3;else if(256==t)i=8;else if(2==t)i=1;else if(32==t)i=5;else{if(4!=t)return void this.fromRadix(e,t);i=2}this.t=0,this.s=0;for(var n=e.length,r=!1,o=0;--n>=0;){var s=8==i?255&e[n]:m(e,n);s<0?"-"==e.charAt(n)&&(r=!0):(r=!1,0==o?this[this.t++]=s:o+i>this.DB?(this[this.t-1]|=(s&(1<<this.DB-o)-1)<<o,this[this.t++]=s>>this.DB-o):this[this.t-1]|=s<<o,(o+=i)>=this.DB&&(o-=this.DB))}8==i&&0!=(128&e[0])&&(this.s=-1,o>0&&(this[this.t-1]|=(1<<this.DB-o)-1<<o)),this.clamp(),r&&c.ZERO.subTo(this,this)},c.prototype.clamp=function(){for(var e=this.s&this.DM;this.t>0&&this[this.t-1]==e;)--this.t},c.prototype.dlShiftTo=function(e,t){var i;for(i=this.t-1;i>=0;--i)t[i+e]=this[i];for(i=e-1;i>=0;--i)t[i]=0;t.t=this.t+e,t.s=this.s},c.prototype.drShiftTo=function(e,t){for(var i=e;i<this.t;++i)t[i-e]=this[i];t.t=Math.max(this.t-e,0),t.s=this.s},c.prototype.lShiftTo=function(e,t){var i,n=e%this.DB,r=this.DB-n,o=(1<<r)-1,s=Math.floor(e/this.DB),a=this.s<<n&this.DM;for(i=this.t-1;i>=0;--i)t[i+s+1]=this[i]>>r|a,a=(this[i]&o)<<n;for(i=s-1;i>=0;--i)t[i]=0;t[s]=a,t.t=this.t+s+1,t.s=this.s,t.clamp()},c.prototype.rShiftTo=function(e,t){t.s=this.s;var i=Math.floor(e/this.DB);if(i>=this.t)t.t=0;else{var n=e%this.DB,r=this.DB-n,o=(1<<n)-1;t[0]=this[i]>>n;for(var s=i+1;s<this.t;++s)t[s-i-1]|=(this[s]&o)<<r,t[s-i]=this[s]>>n;n>0&&(t[this.t-i-1]|=(this.s&o)<<r),t.t=this.t-i,t.clamp()}},c.prototype.subTo=function(e,t){for(var i=0,n=0,r=Math.min(e.t,this.t);i<r;)n+=this[i]-e[i],t[i++]=n&this.DM,n>>=this.DB;if(e.t<this.t){for(n-=e.s;i<this.t;)n+=this[i],t[i++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;i<e.t;)n-=e[i],t[i++]=n&this.DM,n>>=this.DB;n-=e.s}t.s=n<0?-1:0,n<-1?t[i++]=this.DV+n:n>0&&(t[i++]=n),t.t=i,t.clamp()},c.prototype.multiplyTo=function(e,t){var i=this.abs(),n=e.abs(),r=i.t;for(t.t=r+n.t;--r>=0;)t[r]=0;for(r=0;r<n.t;++r)t[r+i.t]=i.am(0,n[r],t,r,0,i.t);t.s=0,t.clamp(),this.s!=e.s&&c.ZERO.subTo(t,t)},c.prototype.squareTo=function(e){for(var t=this.abs(),i=e.t=2*t.t;--i>=0;)e[i]=0;for(i=0;i<t.t-1;++i){var n=t.am(i,t[i],e,2*i,0,1);(e[i+t.t]+=t.am(i+1,2*t[i],e,2*i+1,n,t.t-i-1))>=t.DV&&(e[i+t.t]-=t.DV,e[i+t.t+1]=1)}e.t>0&&(e[e.t-1]+=t.am(i,t[i],e,2*i,0,1)),e.s=0,e.clamp()},c.prototype.divRemTo=function(e,t,i){var n=e.abs();if(!(n.t<=0)){var r=this.abs();if(r.t<n.t)return null!=t&&t.fromInt(0),void(null!=i&&this.copyTo(i));null==i&&(i=h());var o=h(),s=this.s,a=e.s,l=this.DB-v(n[n.t-1]);l>0?(n.lShiftTo(l,o),r.lShiftTo(l,i)):(n.copyTo(o),r.copyTo(i));var u=o.t,d=o[u-1];if(0!=d){var p=d*(1<<this.F1)+(u>1?o[u-2]>>this.F2:0),f=this.FV/p,A=(1<<this.F1)/p,m=1<<this.F2,g=i.t,y=g-u,b=null==t?h():t;for(o.dlShiftTo(y,b),i.compareTo(b)>=0&&(i[i.t++]=1,i.subTo(b,i)),c.ONE.dlShiftTo(u,b),b.subTo(o,o);o.t<u;)o[o.t++]=0;for(;--y>=0;){var x=i[--g]==d?this.DM:Math.floor(i[g]*f+(i[g-1]+m)*A);if((i[g]+=o.am(0,x,i,y,0,u))<x)for(o.dlShiftTo(y,b),i.subTo(b,i);i[g]<--x;)i.subTo(b,i)}null!=t&&(i.drShiftTo(u,t),s!=a&&c.ZERO.subTo(t,t)),i.t=u,i.clamp(),l>0&&i.rShiftTo(l,i),s<0&&c.ZERO.subTo(i,i)}}},c.prototype.invDigit=function(){if(this.t<1)return 0;var e=this[0];if(0==(1&e))return 0;var t=3&e;return(t=(t=(t=(t=t*(2-(15&e)*t)&15)*(2-(255&e)*t)&255)*(2-((65535&e)*t&65535))&65535)*(2-e*t%this.DV)%this.DV)>0?this.DV-t:-t},c.prototype.isEven=function(){return 0==(this.t>0?1&this[0]:this.s)},c.prototype.exp=function(e,t){if(e>4294967295||e<1)return c.ONE;var i=h(),n=h(),r=t.convert(this),o=v(e)-1;for(r.copyTo(i);--o>=0;)if(t.sqrTo(i,n),(e&1<<o)>0)t.mulTo(n,r,i);else{var s=i;i=n,n=s}return t.revert(i)},c.prototype.toString=function(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)return this.toRadix(e);t=2}var i,n=(1<<t)-1,r=!1,o="",s=this.t,a=this.DB-s*this.DB%t;if(s-- >0)for(a<this.DB&&(i=this[s]>>a)>0&&(r=!0,o=A(i));s>=0;)a<t?(i=(this[s]&(1<<a)-1)<<t-a,i|=this[--s]>>(a+=this.DB-t)):(i=this[s]>>(a-=t)&n,a<=0&&(a+=this.DB,--s)),i>0&&(r=!0),r&&(o+=A(i));return r?o:"0"},c.prototype.negate=function(){var e=h();return c.ZERO.subTo(this,e),e},c.prototype.abs=function(){return this.s<0?this.negate():this},c.prototype.compareTo=function(e){var t=this.s-e.s;if(0!=t)return t;var i=this.t;if(0!=(t=i-e.t))return this.s<0?-t:t;for(;--i>=0;)if(0!=(t=this[i]-e[i]))return t;return 0},c.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+v(this[this.t-1]^this.s&this.DM)},c.prototype.mod=function(e){var t=h();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(c.ZERO)>0&&e.subTo(t,t),t},c.prototype.modPowInt=function(e,t){var i;return i=e<256||t.isEven()?new y(t):new b(t),this.exp(e,i)},c.ZERO=g(0),c.ONE=g(1),I.prototype.convert=B,I.prototype.revert=B,I.prototype.mulTo=function(e,t,i){e.multiplyTo(t,i)},I.prototype.sqrTo=function(e,t){e.squareTo(t)},T.prototype.convert=function(e){if(e.s<0||e.t>2*this.m.t)return e.mod(this.m);if(e.compareTo(this.m)<0)return e;var t=h();return e.copyTo(t),this.reduce(t),t},T.prototype.revert=function(e){return e},T.prototype.reduce=function(e){for(e.drShiftTo(this.m.t-1,this.r2),e.t>this.m.t+1&&(e.t=this.m.t+1,e.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);e.compareTo(this.r2)<0;)e.dAddOffset(1,this.m.t+1);for(e.subTo(this.r2,e);e.compareTo(this.m)>=0;)e.subTo(this.m,e)},T.prototype.mulTo=function(e,t,i){e.multiplyTo(t,i),this.reduce(i)},T.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)};var P=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],R=(1<<26)/P[P.length-1];c.prototype.chunkSize=function(e){return Math.floor(Math.LN2*this.DB/Math.log(e))},c.prototype.toRadix=function(e){if(null==e&&(e=10),0==this.signum()||e<2||e>36)return"0";var t=this.chunkSize(e),i=Math.pow(e,t),n=g(i),r=h(),o=h(),s="";for(this.divRemTo(n,r,o);r.signum()>0;)s=(i+o.intValue()).toString(e).substr(1)+s,r.divRemTo(n,r,o);return o.intValue().toString(e)+s},c.prototype.fromRadix=function(e,t){this.fromInt(0),null==t&&(t=10);for(var i=this.chunkSize(t),n=Math.pow(t,i),r=!1,o=0,s=0,a=0;a<e.length;++a){var l=m(e,a);l<0?"-"==e.charAt(a)&&0==this.signum()&&(r=!0):(s=t*s+l,++o>=i&&(this.dMultiply(n),this.dAddOffset(s,0),o=0,s=0))}o>0&&(this.dMultiply(Math.pow(t,o)),this.dAddOffset(s,0)),r&&c.ZERO.subTo(this,this)},c.prototype.fromNumber=function(e,t,i){if("number"==typeof t)if(e<2)this.fromInt(1);else for(this.fromNumber(e,i),this.testBit(e-1)||this.bitwiseTo(c.ONE.shiftLeft(e-1),w,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(t);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(c.ONE.shiftLeft(e-1),this);else{var n=new Array,r=7&e;n.length=1+(e>>3),t.nextBytes(n),r>0?n[0]&=(1<<r)-1:n[0]=0,this.fromString(n,256)}},c.prototype.bitwiseTo=function(e,t,i){var n,r,o=Math.min(e.t,this.t);for(n=0;n<o;++n)i[n]=t(this[n],e[n]);if(e.t<this.t){for(r=e.s&this.DM,n=o;n<this.t;++n)i[n]=t(this[n],r);i.t=this.t}else{for(r=this.s&this.DM,n=o;n<e.t;++n)i[n]=t(r,e[n]);i.t=e.t}i.s=t(this.s,e.s),i.clamp()},c.prototype.changeBit=function(e,t){var i=c.ONE.shiftLeft(e);return this.bitwiseTo(i,t,i),i},c.prototype.addTo=function(e,t){for(var i=0,n=0,r=Math.min(e.t,this.t);i<r;)n+=this[i]+e[i],t[i++]=n&this.DM,n>>=this.DB;if(e.t<this.t){for(n+=e.s;i<this.t;)n+=this[i],t[i++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;i<e.t;)n+=e[i],t[i++]=n&this.DM,n>>=this.DB;n+=e.s}t.s=n<0?-1:0,n>0?t[i++]=n:n<-1&&(t[i++]=this.DV+n),t.t=i,t.clamp()},c.prototype.dMultiply=function(e){this[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()},c.prototype.dAddOffset=function(e,t){if(0!=e){for(;this.t<=t;)this[this.t++]=0;for(this[t]+=e;this[t]>=this.DV;)this[t]-=this.DV,++t>=this.t&&(this[this.t++]=0),++this[t]}},c.prototype.multiplyLowerTo=function(e,t,i){var n,r=Math.min(this.t+e.t,t);for(i.s=0,i.t=r;r>0;)i[--r]=0;for(n=i.t-this.t;r<n;++r)i[r+this.t]=this.am(0,e[r],i,r,0,this.t);for(n=Math.min(e.t,t);r<n;++r)this.am(0,e[r],i,r,0,t-r);i.clamp()},c.prototype.multiplyUpperTo=function(e,t,i){--t;var n=i.t=this.t+e.t-t;for(i.s=0;--n>=0;)i[n]=0;for(n=Math.max(t-this.t,0);n<e.t;++n)i[this.t+n-t]=this.am(t-n,e[n],i,0,0,this.t+n-t);i.clamp(),i.drShiftTo(1,i)},c.prototype.modInt=function(e){if(e<=0)return 0;var t=this.DV%e,i=this.s<0?e-1:0;if(this.t>0)if(0==t)i=this[0]%e;else for(var n=this.t-1;n>=0;--n)i=(t*i+this[n])%e;return i},c.prototype.millerRabin=function(e){var t=this.subtract(c.ONE),i=t.getLowestSetBit();if(i<=0)return!1;var n=t.shiftRight(i);(e=e+1>>1)>P.length&&(e=P.length);for(var r=h(),o=0;o<e;++o){r.fromInt(P[Math.floor(Math.random()*P.length)]);var s=r.modPow(n,this);if(0!=s.compareTo(c.ONE)&&0!=s.compareTo(t)){for(var a=1;a++<i&&0!=s.compareTo(t);)if(0==(s=s.modPowInt(2,this)).compareTo(c.ONE))return!1;if(0!=s.compareTo(t))return!1}}return!0},c.prototype.clone=
358
358
  /*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/ */
359
- function(){var e=h();return this.copyTo(e),e},c.prototype.intValue=function(){if(this.s<0){if(1==this.t)return this[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this[0];if(0==this.t)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]},c.prototype.byteValue=function(){return 0==this.t?this.s:this[0]<<24>>24},c.prototype.shortValue=function(){return 0==this.t?this.s:this[0]<<16>>16},c.prototype.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1},c.prototype.toByteArray=function(){var e=this.t,t=new Array;t[0]=this.s;var i,n=this.DB-e*this.DB%8,r=0;if(e-- >0)for(n<this.DB&&(i=this[e]>>n)!=(this.s&this.DM)>>n&&(t[r++]=i|this.s<<this.DB-n);e>=0;)n<8?(i=(this[e]&(1<<n)-1)<<8-n,i|=this[--e]>>(n+=this.DB-8)):(i=this[e]>>(n-=8)&255,n<=0&&(n+=this.DB,--e)),0!=(128&i)&&(i|=-256),0==r&&(128&this.s)!=(128&i)&&++r,(r>0||i!=this.s)&&(t[r++]=i);return t},c.prototype.equals=function(e){return 0==this.compareTo(e)},c.prototype.min=function(e){return this.compareTo(e)<0?this:e},c.prototype.max=function(e){return this.compareTo(e)>0?this:e},c.prototype.and=function(e){var t=h();return this.bitwiseTo(e,x,t),t},c.prototype.or=function(e){var t=h();return this.bitwiseTo(e,w,t),t},c.prototype.xor=function(e){var t=h();return this.bitwiseTo(e,M,t),t},c.prototype.andNot=function(e){var t=h();return this.bitwiseTo(e,E,t),t},c.prototype.not=function(){for(var e=h(),t=0;t<this.t;++t)e[t]=this.DM&~this[t];return e.t=this.t,e.s=~this.s,e},c.prototype.shiftLeft=function(e){var t=h();return e<0?this.rShiftTo(-e,t):this.lShiftTo(e,t),t},c.prototype.shiftRight=function(e){var t=h();return e<0?this.lShiftTo(-e,t):this.rShiftTo(e,t),t},c.prototype.getLowestSetBit=function(){for(var e=0;e<this.t;++e)if(0!=this[e])return e*this.DB+S(this[e]);return this.s<0?this.t*this.DB:-1},c.prototype.bitCount=function(){for(var e=0,t=this.s&this.DM,i=0;i<this.t;++i)e+=C(this[i]^t);return e},c.prototype.testBit=function(e){var t=Math.floor(e/this.DB);return t>=this.t?0!=this.s:0!=(this[t]&1<<e%this.DB)},c.prototype.setBit=function(e){return this.changeBit(e,w)},c.prototype.clearBit=function(e){return this.changeBit(e,E)},c.prototype.flipBit=function(e){return this.changeBit(e,M)},c.prototype.add=function(e){var t=h();return this.addTo(e,t),t},c.prototype.subtract=function(e){var t=h();return this.subTo(e,t),t},c.prototype.multiply=function(e){var t=h();return this.multiplyTo(e,t),t},c.prototype.divide=function(e){var t=h();return this.divRemTo(e,t,null),t},c.prototype.remainder=function(e){var t=h();return this.divRemTo(e,null,t),t},c.prototype.divideAndRemainder=function(e){var t=h(),i=h();return this.divRemTo(e,t,i),new Array(t,i)},c.prototype.modPow=function(e,t){var i,n,r=e.bitLength(),o=m(1);if(r<=0)return o;i=r<18?1:r<48?3:r<144?4:r<768?5:6,n=r<8?new y(t):t.isEven()?new T(t):new b(t);var s=new Array,a=3,l=i-1,u=(1<<i)-1;if(s[1]=n.convert(this),i>1){var c=h();for(n.sqrTo(s[1],c);a<=u;)s[a]=h(),n.mulTo(c,s[a-2],s[a]),a+=2}var d,p,f=e.t-1,A=!0,g=h();for(r=v(e[f])-1;f>=0;){for(r>=l?d=e[f]>>r-l&u:(d=(e[f]&(1<<r+1)-1)<<l-r,f>0&&(d|=e[f-1]>>this.DB+r-l)),a=i;0==(1&d);)d>>=1,--a;if((r-=a)<0&&(r+=this.DB,--f),A)s[d].copyTo(o),A=!1;else{for(;a>1;)n.sqrTo(o,g),n.sqrTo(g,o),a-=2;a>0?n.sqrTo(o,g):(p=o,o=g,g=p),n.mulTo(g,s[d],o)}for(;f>=0&&0==(e[f]&1<<r);)n.sqrTo(o,g),p=o,o=g,g=p,--r<0&&(r=this.DB-1,--f)}return n.revert(o)},c.prototype.modInverse=function(e){var t=e.isEven();if(this.isEven()&&t||0==e.signum())return c.ZERO;for(var i=e.clone(),n=this.clone(),r=m(1),o=m(0),s=m(0),a=m(1);0!=i.signum();){for(;i.isEven();)i.rShiftTo(1,i),t?(r.isEven()&&o.isEven()||(r.addTo(this,r),o.subTo(e,o)),r.rShiftTo(1,r)):o.isEven()||o.subTo(e,o),o.rShiftTo(1,o);for(;n.isEven();)n.rShiftTo(1,n),t?(s.isEven()&&a.isEven()||(s.addTo(this,s),a.subTo(e,a)),s.rShiftTo(1,s)):a.isEven()||a.subTo(e,a),a.rShiftTo(1,a);i.compareTo(n)>=0?(i.subTo(n,i),t&&r.subTo(s,r),o.subTo(a,o)):(n.subTo(i,n),t&&s.subTo(r,s),a.subTo(o,a))}return 0!=n.compareTo(c.ONE)?c.ZERO:a.compareTo(e)>=0?a.subtract(e):a.signum()<0?(a.addTo(e,a),a.signum()<0?a.add(e):a):a},c.prototype.pow=function(e){return this.exp(e,new I)},c.prototype.gcd=function(e){var t=this.s<0?this.negate():this.clone(),i=e.s<0?e.negate():e.clone();if(t.compareTo(i)<0){var n=t;t=i,i=n}var r=t.getLowestSetBit(),o=i.getLowestSetBit();if(o<0)return t;for(r<o&&(o=r),o>0&&(t.rShiftTo(o,t),i.rShiftTo(o,i));t.signum()>0;)(r=t.getLowestSetBit())>0&&t.rShiftTo(r,t),(r=i.getLowestSetBit())>0&&i.rShiftTo(r,i),t.compareTo(i)>=0?(t.subTo(i,t),t.rShiftTo(1,t)):(i.subTo(t,i),i.rShiftTo(1,i));return o>0&&i.lShiftTo(o,i),i},c.prototype.isProbablePrime=function(e){var t,i=this.abs();if(1==i.t&&i[0]<=P[P.length-1]){for(t=0;t<P.length;++t)if(i[0]==P[t])return!0;return!1}if(i.isEven())return!1;for(t=1;t<P.length;){for(var n=P[t],r=t+1;r<P.length&&n<R;)n*=P[r++];for(n=i.modInt(n);t<r;)if(n%P[t++]==0)return!1}return i.millerRabin(e)},c.prototype.square=function(){var e=h();return this.squareTo(e),e};
359
+ function(){var e=h();return this.copyTo(e),e},c.prototype.intValue=function(){if(this.s<0){if(1==this.t)return this[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this[0];if(0==this.t)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]},c.prototype.byteValue=function(){return 0==this.t?this.s:this[0]<<24>>24},c.prototype.shortValue=function(){return 0==this.t?this.s:this[0]<<16>>16},c.prototype.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1},c.prototype.toByteArray=function(){var e=this.t,t=new Array;t[0]=this.s;var i,n=this.DB-e*this.DB%8,r=0;if(e-- >0)for(n<this.DB&&(i=this[e]>>n)!=(this.s&this.DM)>>n&&(t[r++]=i|this.s<<this.DB-n);e>=0;)n<8?(i=(this[e]&(1<<n)-1)<<8-n,i|=this[--e]>>(n+=this.DB-8)):(i=this[e]>>(n-=8)&255,n<=0&&(n+=this.DB,--e)),0!=(128&i)&&(i|=-256),0==r&&(128&this.s)!=(128&i)&&++r,(r>0||i!=this.s)&&(t[r++]=i);return t},c.prototype.equals=function(e){return 0==this.compareTo(e)},c.prototype.min=function(e){return this.compareTo(e)<0?this:e},c.prototype.max=function(e){return this.compareTo(e)>0?this:e},c.prototype.and=function(e){var t=h();return this.bitwiseTo(e,x,t),t},c.prototype.or=function(e){var t=h();return this.bitwiseTo(e,w,t),t},c.prototype.xor=function(e){var t=h();return this.bitwiseTo(e,E,t),t},c.prototype.andNot=function(e){var t=h();return this.bitwiseTo(e,M,t),t},c.prototype.not=function(){for(var e=h(),t=0;t<this.t;++t)e[t]=this.DM&~this[t];return e.t=this.t,e.s=~this.s,e},c.prototype.shiftLeft=function(e){var t=h();return e<0?this.rShiftTo(-e,t):this.lShiftTo(e,t),t},c.prototype.shiftRight=function(e){var t=h();return e<0?this.lShiftTo(-e,t):this.rShiftTo(e,t),t},c.prototype.getLowestSetBit=function(){for(var e=0;e<this.t;++e)if(0!=this[e])return e*this.DB+S(this[e]);return this.s<0?this.t*this.DB:-1},c.prototype.bitCount=function(){for(var e=0,t=this.s&this.DM,i=0;i<this.t;++i)e+=C(this[i]^t);return e},c.prototype.testBit=function(e){var t=Math.floor(e/this.DB);return t>=this.t?0!=this.s:0!=(this[t]&1<<e%this.DB)},c.prototype.setBit=function(e){return this.changeBit(e,w)},c.prototype.clearBit=function(e){return this.changeBit(e,M)},c.prototype.flipBit=function(e){return this.changeBit(e,E)},c.prototype.add=function(e){var t=h();return this.addTo(e,t),t},c.prototype.subtract=function(e){var t=h();return this.subTo(e,t),t},c.prototype.multiply=function(e){var t=h();return this.multiplyTo(e,t),t},c.prototype.divide=function(e){var t=h();return this.divRemTo(e,t,null),t},c.prototype.remainder=function(e){var t=h();return this.divRemTo(e,null,t),t},c.prototype.divideAndRemainder=function(e){var t=h(),i=h();return this.divRemTo(e,t,i),new Array(t,i)},c.prototype.modPow=function(e,t){var i,n,r=e.bitLength(),o=g(1);if(r<=0)return o;i=r<18?1:r<48?3:r<144?4:r<768?5:6,n=r<8?new y(t):t.isEven()?new T(t):new b(t);var s=new Array,a=3,l=i-1,u=(1<<i)-1;if(s[1]=n.convert(this),i>1){var c=h();for(n.sqrTo(s[1],c);a<=u;)s[a]=h(),n.mulTo(c,s[a-2],s[a]),a+=2}var d,p,f=e.t-1,A=!0,m=h();for(r=v(e[f])-1;f>=0;){for(r>=l?d=e[f]>>r-l&u:(d=(e[f]&(1<<r+1)-1)<<l-r,f>0&&(d|=e[f-1]>>this.DB+r-l)),a=i;0==(1&d);)d>>=1,--a;if((r-=a)<0&&(r+=this.DB,--f),A)s[d].copyTo(o),A=!1;else{for(;a>1;)n.sqrTo(o,m),n.sqrTo(m,o),a-=2;a>0?n.sqrTo(o,m):(p=o,o=m,m=p),n.mulTo(m,s[d],o)}for(;f>=0&&0==(e[f]&1<<r);)n.sqrTo(o,m),p=o,o=m,m=p,--r<0&&(r=this.DB-1,--f)}return n.revert(o)},c.prototype.modInverse=function(e){var t=e.isEven();if(this.isEven()&&t||0==e.signum())return c.ZERO;for(var i=e.clone(),n=this.clone(),r=g(1),o=g(0),s=g(0),a=g(1);0!=i.signum();){for(;i.isEven();)i.rShiftTo(1,i),t?(r.isEven()&&o.isEven()||(r.addTo(this,r),o.subTo(e,o)),r.rShiftTo(1,r)):o.isEven()||o.subTo(e,o),o.rShiftTo(1,o);for(;n.isEven();)n.rShiftTo(1,n),t?(s.isEven()&&a.isEven()||(s.addTo(this,s),a.subTo(e,a)),s.rShiftTo(1,s)):a.isEven()||a.subTo(e,a),a.rShiftTo(1,a);i.compareTo(n)>=0?(i.subTo(n,i),t&&r.subTo(s,r),o.subTo(a,o)):(n.subTo(i,n),t&&s.subTo(r,s),a.subTo(o,a))}return 0!=n.compareTo(c.ONE)?c.ZERO:a.compareTo(e)>=0?a.subtract(e):a.signum()<0?(a.addTo(e,a),a.signum()<0?a.add(e):a):a},c.prototype.pow=function(e){return this.exp(e,new I)},c.prototype.gcd=function(e){var t=this.s<0?this.negate():this.clone(),i=e.s<0?e.negate():e.clone();if(t.compareTo(i)<0){var n=t;t=i,i=n}var r=t.getLowestSetBit(),o=i.getLowestSetBit();if(o<0)return t;for(r<o&&(o=r),o>0&&(t.rShiftTo(o,t),i.rShiftTo(o,i));t.signum()>0;)(r=t.getLowestSetBit())>0&&t.rShiftTo(r,t),(r=i.getLowestSetBit())>0&&i.rShiftTo(r,i),t.compareTo(i)>=0?(t.subTo(i,t),t.rShiftTo(1,t)):(i.subTo(t,i),i.rShiftTo(1,i));return o>0&&i.lShiftTo(o,i),i},c.prototype.isProbablePrime=function(e){var t,i=this.abs();if(1==i.t&&i[0]<=P[P.length-1]){for(t=0;t<P.length;++t)if(i[0]==P[t])return!0;return!1}if(i.isEven())return!1;for(t=1;t<P.length;){for(var n=P[t],r=t+1;r<P.length&&n<R;)n*=P[r++];for(n=i.modInt(n);t<r;)if(n%P[t++]==0)return!1}return i.millerRabin(e)},c.prototype.square=function(){var e=h();return this.squareTo(e),e};
360
360
  /*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/ */
361
361
  var D="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function L(e){var t,i,n="";for(t=0;t+3<=e.length;t+=3)i=parseInt(e.substring(t,t+3),16),n+=D.charAt(i>>6)+D.charAt(63&i);for(t+1==e.length?(i=parseInt(e.substring(t,t+1),16),n+=D.charAt(i<<2)):t+2==e.length&&(i=parseInt(e.substring(t,t+2),16),n+=D.charAt(i>>2)+D.charAt((3&i)<<4));(3&n.length)>0;)n+="=";return n}function k(e){var t,i,n,r="",o=0;for(t=0;t<e.length&&"="!=e.charAt(t);++t)(n=D.indexOf(e.charAt(t)))<0||(0==o?(r+=A(n>>2),i=3&n,o=1):1==o?(r+=A(i<<2|n>>4),i=15&n,o=2):2==o?(r+=A(i),r+=A(n>>2),i=3&n,o=3):(r+=A(i<<2|n>>4),r+=A(15&n),o=0));return 1==o&&(r+=A(i<<2)),r}
362
- /*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/ */function O(){this.i=0,this.j=0,this.S=new Array}O.prototype.init=function(e){var t,i,n;for(t=0;t<256;++t)this.S[t]=t;for(i=0,t=0;t<256;++t)i=i+this.S[t]+e[t%e.length]&255,n=this.S[t],this.S[t]=this.S[i],this.S[i]=n;this.i=0,this.j=0},O.prototype.next=function(){var e;return this.i=this.i+1&255,this.j=this.j+this.S[this.i]&255,e=this.S[this.i],this.S[this.i]=this.S[this.j],this.S[this.j]=e,this.S[e+this.S[this.i]&255]};var F,N,V;
363
- /*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/ */function Q(){var e;e=(new Date).getTime(),N[V++]^=255&e,N[V++]^=e>>8&255,N[V++]^=e>>16&255,N[V++]^=e>>24&255,V>=256&&(V-=256)}if(null==N){var H;if(N=new Array,V=0,"undefined"!=typeof window&&(void 0!==window.crypto||void 0!==window.msCrypto)){var q=window.crypto||window.msCrypto;if(q.getRandomValues){var U=new Uint8Array(32);for(q.getRandomValues(U),H=0;H<32;++H)N[V++]=U[H]}else if("undefined"!=typeof navigator&&"Netscape"==navigator.appName&&navigator.appVersion<"5"){var z=window.crypto.random(32);for(H=0;H<z.length;++H)N[V++]=255&z.charCodeAt(H)}}for(;V<256;)H=Math.floor(65536*Math.random()),N[V++]=H>>>8,N[V++]=255&H;V=0,Q()}function j(){if(null==F){for(Q(),(F=new O).init(N),V=0;V<N.length;++V)N[V]=0;V=0}return F.next()}function K(){}
362
+ /*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/ */function F(){this.i=0,this.j=0,this.S=new Array}F.prototype.init=function(e){var t,i,n;for(t=0;t<256;++t)this.S[t]=t;for(i=0,t=0;t<256;++t)i=i+this.S[t]+e[t%e.length]&255,n=this.S[t],this.S[t]=this.S[i],this.S[i]=n;this.i=0,this.j=0},F.prototype.next=function(){var e;return this.i=this.i+1&255,this.j=this.j+this.S[this.i]&255,e=this.S[this.i],this.S[this.i]=this.S[this.j],this.S[this.j]=e,this.S[e+this.S[this.i]&255]};var O,N,V;
363
+ /*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/ */function Q(){var e;e=(new Date).getTime(),N[V++]^=255&e,N[V++]^=e>>8&255,N[V++]^=e>>16&255,N[V++]^=e>>24&255,V>=256&&(V-=256)}if(null==N){var H;if(N=new Array,V=0,"undefined"!=typeof window&&(void 0!==window.crypto||void 0!==window.msCrypto)){var q=window.crypto||window.msCrypto;if(q.getRandomValues){var z=new Uint8Array(32);for(q.getRandomValues(z),H=0;H<32;++H)N[V++]=z[H]}else if("undefined"!=typeof navigator&&"Netscape"==navigator.appName&&navigator.appVersion<"5"){var U=window.crypto.random(32);for(H=0;H<U.length;++H)N[V++]=255&U.charCodeAt(H)}}for(;V<256;)H=Math.floor(65536*Math.random()),N[V++]=H>>>8,N[V++]=255&H;V=0,Q()}function j(){if(null==O){for(Q(),(O=new F).init(N),V=0;V<N.length;++V)N[V]=0;V=0}return O.next()}function K(){}
364
364
  /*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/ */
365
- function G(e,t){return new c(e,t)}function _(e,t,i){for(var n="",r=0;n.length<t;)n+=i(String.fromCharCode.apply(String,e.concat([(4278190080&r)>>24,(16711680&r)>>16,(65280&r)>>8,255&r]))),r+=1;return n}function W(){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 X(e,t,i){for(var n="",r=0;n.length<t;)n+=i(e+String.fromCharCode.apply(String,[(4278190080&r)>>24,(16711680&r)>>16,(65280&r)>>8,255&r])),r+=1;return n}function Y(e){for(var t="",i=0;i<e.length;i++){var n=e[i].toString(16);1==n.length&&(n="0"+n),t+=n}return t}function Z(e){return Y(function(e){for(var t=new Array,i=0;i<e.length;i++)t[i]=e.charCodeAt(i);return t}(e))}function J(e){return e.length%4==2?e+="==":e.length%4==3&&(e+="="),e=(e=e.replace(/-/g,"+")).replace(/_/g,"/")}function $(e){return e.length%2==1&&(e="0"+e),function(e){return(e=(e=e.replace(/\=/g,"")).replace(/\+/g,"-")).replace(/\//g,"_")}(L(e))}function ee(e){return k(J(e))}function te(e){return function(e){return e.replace(/%/g,"")}(function(e){for(var t=encodeURIComponent(e),i="",n=0;n<t.length;n++)"%"==t[n]?(i+=t.substr(n,3),n+=2):i=i+"%"+Z(t[n]);return i}(e))}function ie(e){return decodeURIComponent(function(e){return e.replace(/(..)/g,"%$1")}(e))}function ne(e){for(var t="",i=0;i<e.length-1;i+=2)t+=String.fromCharCode(parseInt(e.substr(i,2),16));return t}function re(e){for(var t="",i=0;i<e.length;i++)t+=("0"+e.charCodeAt(i).toString(16)).slice(-2);return t}function oe(e){var t=function(e){return L(e)}(e).replace(/(.{64})/g,"$1\r\n");return t=t.replace(/\r\n$/,"")}function se(e,t){return"-----BEGIN "+t+"-----\r\n"+oe(e)+"\r\n-----END "+t+"-----\r\n"}function ae(e,t){if(-1==e.indexOf("-----BEGIN "))throw"can't find PEM header: "+t;return function(e){return k(e.replace(/[^0-9A-Za-z\/+=]*/g,""))}(e=void 0!==t?(e=e.replace(new RegExp("^[^]*-----BEGIN "+t+"-----"),"")).replace(new RegExp("-----END "+t+"-----[^]*$"),""):(e=e.replace(/^[^]*-----BEGIN [^-]+-----/,"")).replace(/-----END [^-]+-----[^]*$/,""))}function le(e){var t="malformed hex value";if(!e.match(/^([0-9A-Fa-f][0-9A-Fa-f]){1,}$/))throw t;if(8!=e.length)return 32==e.length?function(e){if(!e.match(/^[0-9A-Fa-f]{32}$/))throw"malformed IPv6 address octet";for(var t=(e=e.toLowerCase()).match(/.{1,4}/g),i=0;i<8;i++)t[i]=t[i].replace(/^0+/,""),""==t[i]&&(t[i]="0");var n=(e=":"+t.join(":")+":").match(/:(0:){2,}/g);if(null===n)return e.slice(1,-1);var r="";for(i=0;i<n.length;i++)n[i].length>r.length&&(r=n[i]);return(e=e.replace(r,"::")).slice(1,-1)}(e):e;try{return parseInt(e.substr(0,2),16)+"."+parseInt(e.substr(2,2),16)+"."+parseInt(e.substr(4,2),16)+"."+parseInt(e.substr(6,2),16)}catch(e){throw t}}function ue(e){return e.match(/.{4}/g).map((function(e){var t=parseInt(e.substr(0,2),16),i=parseInt(e.substr(2),16);if(0==t&i<128)return String.fromCharCode(i);if(t<8){var n=128|63&i;return ie((192|(7&t)<<3|(192&i)>>6).toString(16)+n.toString(16))}n=128|(15&t)<<2|(192&i)>>6;var r=128|63&i;return ie((224|(240&t)>>4).toString(16)+n.toString(16)+r.toString(16))})).join("")}function ce(e){return!(e.length%2!=0||!e.match(/^[0-9a-f]+$/)&&!e.match(/^[0-9A-F]+$/))}function he(e){return e.length%2==1?"0"+e:e.substr(0,1)>"7"?"00"+e:e}K.prototype.nextBytes=function(e){var t;for(t=0;t<e.length;++t)e[t]=j()},W.prototype.doPublic=function(e){return e.modPowInt(this.e,this.n)},W.prototype.setPublic=function(e,t){if(this.isPublic=!0,this.isPrivate=!1,"string"!=typeof e)this.n=e,this.e=t;else{if(!(null!=e&&null!=t&&e.length>0&&t.length>0))throw"Invalid RSA public key";this.n=G(e,16),this.e=parseInt(t,16)}},W.prototype.encrypt=function(e){var t=function(e,t){if(t<e.length+11)throw"Message too long for RSA";for(var i=new Array,n=e.length-1;n>=0&&t>0;){var r=e.charCodeAt(n--);r<128?i[--t]=r:r>127&&r<2048?(i[--t]=63&r|128,i[--t]=r>>6|192):(i[--t]=63&r|128,i[--t]=r>>6&63|128,i[--t]=r>>12|224)}i[--t]=0;for(var o=new K,s=new Array;t>2;){for(s[0]=0;0==s[0];)o.nextBytes(s);i[--t]=s[0]}return i[--t]=2,i[--t]=0,new c(i)}(e,this.n.bitLength()+7>>3);if(null==t)return null;var i=this.doPublic(t);if(null==i)return null;var n=i.toString(16);return 0==(1&n.length)?n:"0"+n},W.prototype.encryptOAEP=function(e,t,i){var n=function(e,t,i,n){var r=a.crypto.MessageDigest,o=a.crypto.Util,s=null;if(i||(i="sha1"),"string"==typeof i&&(s=r.getCanonicalAlgName(i),n=r.getHashLength(s),i=function(e){return ne(o.hashHex(re(e),s))}),e.length+2*n+2>t)throw"Message too long for RSA";var l,u="";for(l=0;l<t-e.length-2*n-2;l+=1)u+="\0";var h=i("")+u+""+e,d=new Array(n);(new K).nextBytes(d);var p=_(d,h.length,i),f=[];for(l=0;l<h.length;l+=1)f[l]=h.charCodeAt(l)^p.charCodeAt(l);var A=_(f,d.length,i),g=[0];for(l=0;l<d.length;l+=1)g[l+1]=d[l]^A.charCodeAt(l);return new c(g.concat(f))}(e,this.n.bitLength()+7>>3,t,i);if(null==n)return null;var r=this.doPublic(n);if(null==r)return null;var o=r.toString(16);return 0==(1&o.length)?o:"0"+o},W.prototype.type="RSA",W.prototype.doPrivate=function(e){if(null==this.p||null==this.q)return e.modPow(this.d,this.n);for(var t=e.mod(this.p).modPow(this.dmp1,this.p),i=e.mod(this.q).modPow(this.dmq1,this.q);t.compareTo(i)<0;)t=t.add(this.p);return t.subtract(i).multiply(this.coeff).mod(this.p).multiply(this.q).add(i)},W.prototype.setPrivate=function(e,t,i){if(this.isPrivate=!0,"string"!=typeof e)this.n=e,this.e=t,this.d=i;else{if(!(null!=e&&null!=t&&e.length>0&&t.length>0))throw"Invalid RSA private key";this.n=G(e,16),this.e=parseInt(t,16),this.d=G(i,16)}},W.prototype.setPrivateEx=function(e,t,i,n,r,o,s,a){if(this.isPrivate=!0,this.isPublic=!1,null==e)throw"RSASetPrivateEx N == null";if(null==t)throw"RSASetPrivateEx E == null";if(0==e.length)throw"RSASetPrivateEx N.length == 0";if(0==t.length)throw"RSASetPrivateEx E.length == 0";if(!(null!=e&&null!=t&&e.length>0&&t.length>0))throw"Invalid RSA private key in RSASetPrivateEx";this.n=G(e,16),this.e=parseInt(t,16),this.d=G(i,16),this.p=G(n,16),this.q=G(r,16),this.dmp1=G(o,16),this.dmq1=G(s,16),this.coeff=G(a,16)},W.prototype.generate=function(e,t){var i=new K,n=e>>1;this.e=parseInt(t,16);for(var r=new c(t,16);;){for(;this.p=new c(e-n,1,i),0!=this.p.subtract(c.ONE).gcd(r).compareTo(c.ONE)||!this.p.isProbablePrime(10););for(;this.q=new c(n,1,i),0!=this.q.subtract(c.ONE).gcd(r).compareTo(c.ONE)||!this.q.isProbablePrime(10););if(this.p.compareTo(this.q)<=0){var o=this.p;this.p=this.q,this.q=o}var s=this.p.subtract(c.ONE),a=this.q.subtract(c.ONE),l=s.multiply(a);if(0==l.gcd(r).compareTo(c.ONE)&&(this.n=this.p.multiply(this.q),this.n.bitLength()==e)){this.d=r.modInverse(l),this.dmp1=this.d.mod(s),this.dmq1=this.d.mod(a),this.coeff=this.q.modInverse(this.p);break}}this.isPrivate=!0},W.prototype.decrypt=function(e){if(e.length!=Math.ceil(this.n.bitLength()/4))throw new Error("wrong ctext length");var t=G(e,16),i=this.doPrivate(t);return null==i?null:
365
+ function G(e,t){return new c(e,t)}function _(e,t,i){for(var n="",r=0;n.length<t;)n+=i(String.fromCharCode.apply(String,e.concat([(4278190080&r)>>24,(16711680&r)>>16,(65280&r)>>8,255&r]))),r+=1;return n}function W(){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 X(e,t,i){for(var n="",r=0;n.length<t;)n+=i(e+String.fromCharCode.apply(String,[(4278190080&r)>>24,(16711680&r)>>16,(65280&r)>>8,255&r])),r+=1;return n}function Y(e){for(var t="",i=0;i<e.length;i++){var n=e[i].toString(16);1==n.length&&(n="0"+n),t+=n}return t}function Z(e){return Y(function(e){for(var t=new Array,i=0;i<e.length;i++)t[i]=e.charCodeAt(i);return t}(e))}function J(e){return e.length%4==2?e+="==":e.length%4==3&&(e+="="),e=(e=e.replace(/-/g,"+")).replace(/_/g,"/")}function $(e){return e.length%2==1&&(e="0"+e),function(e){return(e=(e=e.replace(/\=/g,"")).replace(/\+/g,"-")).replace(/\//g,"_")}(L(e))}function ee(e){return k(J(e))}function te(e){return function(e){return e.replace(/%/g,"")}(function(e){for(var t=encodeURIComponent(e),i="",n=0;n<t.length;n++)"%"==t[n]?(i+=t.substr(n,3),n+=2):i=i+"%"+Z(t[n]);return i}(e))}function ie(e){return decodeURIComponent(function(e){return e.replace(/(..)/g,"%$1")}(e))}function ne(e){for(var t="",i=0;i<e.length-1;i+=2)t+=String.fromCharCode(parseInt(e.substr(i,2),16));return t}function re(e){for(var t="",i=0;i<e.length;i++)t+=("0"+e.charCodeAt(i).toString(16)).slice(-2);return t}function oe(e){var t=function(e){return L(e)}(e).replace(/(.{64})/g,"$1\r\n");return t=t.replace(/\r\n$/,"")}function se(e,t){return"-----BEGIN "+t+"-----\r\n"+oe(e)+"\r\n-----END "+t+"-----\r\n"}function ae(e,t){if(-1==e.indexOf("-----BEGIN "))throw"can't find PEM header: "+t;return function(e){return k(e.replace(/[^0-9A-Za-z\/+=]*/g,""))}(e=void 0!==t?(e=e.replace(new RegExp("^[^]*-----BEGIN "+t+"-----"),"")).replace(new RegExp("-----END "+t+"-----[^]*$"),""):(e=e.replace(/^[^]*-----BEGIN [^-]+-----/,"")).replace(/-----END [^-]+-----[^]*$/,""))}function le(e){var t="malformed hex value";if(!e.match(/^([0-9A-Fa-f][0-9A-Fa-f]){1,}$/))throw t;if(8!=e.length)return 32==e.length?function(e){if(!e.match(/^[0-9A-Fa-f]{32}$/))throw"malformed IPv6 address octet";for(var t=(e=e.toLowerCase()).match(/.{1,4}/g),i=0;i<8;i++)t[i]=t[i].replace(/^0+/,""),""==t[i]&&(t[i]="0");var n=(e=":"+t.join(":")+":").match(/:(0:){2,}/g);if(null===n)return e.slice(1,-1);var r="";for(i=0;i<n.length;i++)n[i].length>r.length&&(r=n[i]);return(e=e.replace(r,"::")).slice(1,-1)}(e):e;try{return parseInt(e.substr(0,2),16)+"."+parseInt(e.substr(2,2),16)+"."+parseInt(e.substr(4,2),16)+"."+parseInt(e.substr(6,2),16)}catch(e){throw t}}function ue(e){return e.match(/.{4}/g).map((function(e){var t=parseInt(e.substr(0,2),16),i=parseInt(e.substr(2),16);if(0==t&i<128)return String.fromCharCode(i);if(t<8){var n=128|63&i;return ie((192|(7&t)<<3|(192&i)>>6).toString(16)+n.toString(16))}n=128|(15&t)<<2|(192&i)>>6;var r=128|63&i;return ie((224|(240&t)>>4).toString(16)+n.toString(16)+r.toString(16))})).join("")}function ce(e){return!(e.length%2!=0||!e.match(/^[0-9a-f]+$/)&&!e.match(/^[0-9A-F]+$/))}function he(e){return e.length%2==1?"0"+e:e.substr(0,1)>"7"?"00"+e:e}K.prototype.nextBytes=function(e){var t;for(t=0;t<e.length;++t)e[t]=j()},W.prototype.doPublic=function(e){return e.modPowInt(this.e,this.n)},W.prototype.setPublic=function(e,t){if(this.isPublic=!0,this.isPrivate=!1,"string"!=typeof e)this.n=e,this.e=t;else{if(!(null!=e&&null!=t&&e.length>0&&t.length>0))throw"Invalid RSA public key";this.n=G(e,16),this.e=parseInt(t,16)}},W.prototype.encrypt=function(e){var t=function(e,t){if(t<e.length+11)throw"Message too long for RSA";for(var i=new Array,n=e.length-1;n>=0&&t>0;){var r=e.charCodeAt(n--);r<128?i[--t]=r:r>127&&r<2048?(i[--t]=63&r|128,i[--t]=r>>6|192):(i[--t]=63&r|128,i[--t]=r>>6&63|128,i[--t]=r>>12|224)}i[--t]=0;for(var o=new K,s=new Array;t>2;){for(s[0]=0;0==s[0];)o.nextBytes(s);i[--t]=s[0]}return i[--t]=2,i[--t]=0,new c(i)}(e,this.n.bitLength()+7>>3);if(null==t)return null;var i=this.doPublic(t);if(null==i)return null;var n=i.toString(16);return 0==(1&n.length)?n:"0"+n},W.prototype.encryptOAEP=function(e,t,i){var n=function(e,t,i,n){var r=a.crypto.MessageDigest,o=a.crypto.Util,s=null;if(i||(i="sha1"),"string"==typeof i&&(s=r.getCanonicalAlgName(i),n=r.getHashLength(s),i=function(e){return ne(o.hashHex(re(e),s))}),e.length+2*n+2>t)throw"Message too long for RSA";var l,u="";for(l=0;l<t-e.length-2*n-2;l+=1)u+="\0";var h=i("")+u+""+e,d=new Array(n);(new K).nextBytes(d);var p=_(d,h.length,i),f=[];for(l=0;l<h.length;l+=1)f[l]=h.charCodeAt(l)^p.charCodeAt(l);var A=_(f,d.length,i),m=[0];for(l=0;l<d.length;l+=1)m[l+1]=d[l]^A.charCodeAt(l);return new c(m.concat(f))}(e,this.n.bitLength()+7>>3,t,i);if(null==n)return null;var r=this.doPublic(n);if(null==r)return null;var o=r.toString(16);return 0==(1&o.length)?o:"0"+o},W.prototype.type="RSA",W.prototype.doPrivate=function(e){if(null==this.p||null==this.q)return e.modPow(this.d,this.n);for(var t=e.mod(this.p).modPow(this.dmp1,this.p),i=e.mod(this.q).modPow(this.dmq1,this.q);t.compareTo(i)<0;)t=t.add(this.p);return t.subtract(i).multiply(this.coeff).mod(this.p).multiply(this.q).add(i)},W.prototype.setPrivate=function(e,t,i){if(this.isPrivate=!0,"string"!=typeof e)this.n=e,this.e=t,this.d=i;else{if(!(null!=e&&null!=t&&e.length>0&&t.length>0))throw"Invalid RSA private key";this.n=G(e,16),this.e=parseInt(t,16),this.d=G(i,16)}},W.prototype.setPrivateEx=function(e,t,i,n,r,o,s,a){if(this.isPrivate=!0,this.isPublic=!1,null==e)throw"RSASetPrivateEx N == null";if(null==t)throw"RSASetPrivateEx E == null";if(0==e.length)throw"RSASetPrivateEx N.length == 0";if(0==t.length)throw"RSASetPrivateEx E.length == 0";if(!(null!=e&&null!=t&&e.length>0&&t.length>0))throw"Invalid RSA private key in RSASetPrivateEx";this.n=G(e,16),this.e=parseInt(t,16),this.d=G(i,16),this.p=G(n,16),this.q=G(r,16),this.dmp1=G(o,16),this.dmq1=G(s,16),this.coeff=G(a,16)},W.prototype.generate=function(e,t){var i=new K,n=e>>1;this.e=parseInt(t,16);for(var r=new c(t,16);;){for(;this.p=new c(e-n,1,i),0!=this.p.subtract(c.ONE).gcd(r).compareTo(c.ONE)||!this.p.isProbablePrime(10););for(;this.q=new c(n,1,i),0!=this.q.subtract(c.ONE).gcd(r).compareTo(c.ONE)||!this.q.isProbablePrime(10););if(this.p.compareTo(this.q)<=0){var o=this.p;this.p=this.q,this.q=o}var s=this.p.subtract(c.ONE),a=this.q.subtract(c.ONE),l=s.multiply(a);if(0==l.gcd(r).compareTo(c.ONE)&&(this.n=this.p.multiply(this.q),this.n.bitLength()==e)){this.d=r.modInverse(l),this.dmp1=this.d.mod(s),this.dmq1=this.d.mod(a),this.coeff=this.q.modInverse(this.p);break}}this.isPrivate=!0},W.prototype.decrypt=function(e){if(e.length!=Math.ceil(this.n.bitLength()/4))throw new Error("wrong ctext length");var t=G(e,16),i=this.doPrivate(t);return null==i?null:
366
366
  /*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/ */
367
- function(e,t){for(var i=e.toByteArray(),n=0;n<i.length&&0==i[n];)++n;if(i.length-n!=t-1||2!=i[n])return null;for(++n;0!=i[n];)if(++n>=i.length)return null;for(var r="";++n<i.length;){var o=255&i[n];o<128?r+=String.fromCharCode(o):o>191&&o<224?(r+=String.fromCharCode((31&o)<<6|63&i[n+1]),++n):(r+=String.fromCharCode((15&o)<<12|(63&i[n+1])<<6|63&i[n+2]),n+=2)}return r}(i,this.n.bitLength()+7>>3)},W.prototype.decryptOAEP=function(e,t,i){if(e.length!=Math.ceil(this.n.bitLength()/4))throw new Error("wrong ctext length");var n=G(e,16),r=this.doPrivate(n);return null==r?null:function(e,t,i,n){var r=a.crypto.MessageDigest,o=a.crypto.Util,s=null;for(i||(i="sha1"),"string"==typeof i&&(s=r.getCanonicalAlgName(i),n=r.getHashLength(s),i=function(e){return ne(o.hashHex(re(e),s))}),e=e.toByteArray(),l=0;l<e.length;l+=1)e[l]&=255;for(;e.length<t;)e.unshift(0);if((e=String.fromCharCode.apply(String,e)).length<2*n+2)throw"Cipher too short";var l,u=e.substr(1,n),c=e.substr(n+1),h=X(c,n,i),d=[];for(l=0;l<u.length;l+=1)d[l]=u.charCodeAt(l)^h.charCodeAt(l);var p=X(String.fromCharCode.apply(String,d),e.length-n,i),f=[];for(l=0;l<c.length;l+=1)f[l]=c.charCodeAt(l)^p.charCodeAt(l);if((f=String.fromCharCode.apply(String,f)).substr(0,n)!==i(""))throw"Hash mismatch";var A=(f=f.substr(n)).indexOf("");if((-1!=A?f.substr(0,A).lastIndexOf("\0"):-1)+1!=A)throw"Malformed data";return f.substr(A+1)}(r,this.n.bitLength()+7>>3,t,i)},void 0!==a.lang&&a.lang||(a.lang={}),a.lang.String=function(){},a.lang.String.isInteger=function(e){return!!e.match(/^[0-9]+$/)||!!e.match(/^-[0-9]+$/)},a.lang.String.isHex=function(e){return ce(e)},a.lang.String.isBase64=function(e){return!(!(e=e.replace(/\s+/g,"")).match(/^[0-9A-Za-z+\/]+={0,3}$/)||e.length%4!=0)},a.lang.String.isBase64URL=function(e){return!e.match(/[+/=]/)&&(e=J(e),a.lang.String.isBase64(e))},a.lang.String.isIntegerArray=function(e){return!!(e=e.replace(/\s+/g,"")).match(/^\[[0-9,]+\]$/)},a.lang.String.isPrintable=function(e){return null!==e.match(/^[0-9A-Za-z '()+,-./:=?]*$/)},a.lang.String.isIA5=function(e){return null!==e.match(/^[\x20-\x21\x23-\x7f]*$/)},a.lang.String.isMail=function(e){return null!==e.match(/^[A-Za-z0-9]{1}[A-Za-z0-9_.-]*@{1}[A-Za-z0-9_.-]{1,}\.[A-Za-z0-9]{1,}$/)};var de=function(e,t,i){return null==i&&(i="0"),e.length>=t?e:new Array(t-e.length+1).join(i)+e};function pe(e,t){var i=function(){};i.prototype=t.prototype,e.prototype=new i,e.prototype.constructor=e,e.superclass=t.prototype,t.prototype.constructor==Object.prototype.constructor&&(t.prototype.constructor=t)}void 0!==a.crypto&&a.crypto||(a.crypto={}),a.crypto.Util=new function(){this.DIGESTINFOHEAD={sha1:"3021300906052b0e03021a05000414",sha224:"302d300d06096086480165030402040500041c",sha256:"3031300d060960864801650304020105000420",sha384:"3041300d060960864801650304020205000430",sha512:"3051300d060960864801650304020305000440",md2:"3020300c06082a864886f70d020205000410",md5:"3020300c06082a864886f70d020505000410",ripemd160:"3021300906052b2403020105000414"},this.DEFAULTPROVIDER={md5:"cryptojs",sha1:"cryptojs",sha224:"cryptojs",sha256:"cryptojs",sha384:"cryptojs",sha512:"cryptojs",ripemd160:"cryptojs",hmacmd5:"cryptojs",hmacsha1:"cryptojs",hmacsha224:"cryptojs",hmacsha256:"cryptojs",hmacsha384:"cryptojs",hmacsha512:"cryptojs",hmacripemd160:"cryptojs",MD5withRSA:"cryptojs/jsrsa",SHA1withRSA:"cryptojs/jsrsa",SHA224withRSA:"cryptojs/jsrsa",SHA256withRSA:"cryptojs/jsrsa",SHA384withRSA:"cryptojs/jsrsa",SHA512withRSA:"cryptojs/jsrsa",RIPEMD160withRSA:"cryptojs/jsrsa",MD5withECDSA:"cryptojs/jsrsa",SHA1withECDSA:"cryptojs/jsrsa",SHA224withECDSA:"cryptojs/jsrsa",SHA256withECDSA:"cryptojs/jsrsa",SHA384withECDSA:"cryptojs/jsrsa",SHA512withECDSA:"cryptojs/jsrsa",RIPEMD160withECDSA:"cryptojs/jsrsa",SHA1withDSA:"cryptojs/jsrsa",SHA224withDSA:"cryptojs/jsrsa",SHA256withDSA:"cryptojs/jsrsa",MD5withRSAandMGF1:"cryptojs/jsrsa",SHAwithRSAandMGF1:"cryptojs/jsrsa",SHA1withRSAandMGF1:"cryptojs/jsrsa",SHA224withRSAandMGF1:"cryptojs/jsrsa",SHA256withRSAandMGF1:"cryptojs/jsrsa",SHA384withRSAandMGF1:"cryptojs/jsrsa",SHA512withRSAandMGF1:"cryptojs/jsrsa",RIPEMD160withRSAandMGF1:"cryptojs/jsrsa"},this.CRYPTOJSMESSAGEDIGESTNAME={md5:u.algo.MD5,sha1:u.algo.SHA1,sha224:u.algo.SHA224,sha256:u.algo.SHA256,sha384:u.algo.SHA384,sha512:u.algo.SHA512,ripemd160:u.algo.RIPEMD160},this.getDigestInfoHex=function(e,t){if(void 0===this.DIGESTINFOHEAD[t])throw"alg not supported in Util.DIGESTINFOHEAD: "+t;return this.DIGESTINFOHEAD[t]+e},this.getPaddedDigestInfoHex=function(e,t,i){var n=this.getDigestInfoHex(e,t),r=i/4;if(n.length+22>r)throw"key is too short for SigAlg: keylen="+i+","+t;for(var o="0001",s="00"+n,a="",l=r-o.length-s.length,u=0;u<l;u+=2)a+="ff";return o+a+s},this.hashString=function(e,t){return new a.crypto.MessageDigest({alg:t}).digestString(e)},this.hashHex=function(e,t){return new a.crypto.MessageDigest({alg:t}).digestHex(e)},this.sha1=function(e){return this.hashString(e,"sha1")},this.sha256=function(e){return this.hashString(e,"sha256")},this.sha256Hex=function(e){return this.hashHex(e,"sha256")},this.sha512=function(e){return this.hashString(e,"sha512")},this.sha512Hex=function(e){return this.hashHex(e,"sha512")},this.isKey=function(e){return e instanceof W||e instanceof a.crypto.DSA||e instanceof a.crypto.ECDSA}},a.crypto.Util.md5=function(e){return new a.crypto.MessageDigest({alg:"md5",prov:"cryptojs"}).digestString(e)},a.crypto.Util.ripemd160=function(e){return new a.crypto.MessageDigest({alg:"ripemd160",prov:"cryptojs"}).digestString(e)},a.crypto.Util.SECURERANDOMGEN=new K,a.crypto.Util.getRandomHexOfNbytes=function(e){var t=new Array(e);return a.crypto.Util.SECURERANDOMGEN.nextBytes(t),Y(t)},a.crypto.Util.getRandomBigIntegerOfNbytes=function(e){return new c(a.crypto.Util.getRandomHexOfNbytes(e),16)},a.crypto.Util.getRandomHexOfNbits=function(e){var t=e%8,i=new Array((e-t)/8+1);return a.crypto.Util.SECURERANDOMGEN.nextBytes(i),i[0]=(255<<t&255^255)&i[0],Y(i)},a.crypto.Util.getRandomBigIntegerOfNbits=function(e){return new c(a.crypto.Util.getRandomHexOfNbits(e),16)},a.crypto.Util.getRandomBigIntegerZeroToMax=function(e){for(var t=e.bitLength();;){var i=a.crypto.Util.getRandomBigIntegerOfNbits(t);if(-1!=e.compareTo(i))return i}},a.crypto.Util.getRandomBigIntegerMinToMax=function(e,t){var i=e.compareTo(t);if(1==i)throw"biMin is greater than biMax";if(0==i)return e;var n=t.subtract(e);return a.crypto.Util.getRandomBigIntegerZeroToMax(n).add(e)},a.crypto.MessageDigest=function(e){this.setAlgAndProvider=function(e,t){if(null!==(e=a.crypto.MessageDigest.getCanonicalAlgName(e))&&void 0===t&&(t=a.crypto.Util.DEFAULTPROVIDER[e]),-1!=":md5:sha1:sha224:sha256:sha384:sha512:ripemd160:".indexOf(e)&&"cryptojs"==t){try{this.md=a.crypto.Util.CRYPTOJSMESSAGEDIGESTNAME[e].create()}catch(t){throw"setAlgAndProvider hash alg set fail alg="+e+"/"+t}this.updateString=function(e){this.md.update(e)},this.updateHex=function(e){var t=u.enc.Hex.parse(e);this.md.update(t)},this.digest=function(){return this.md.finalize().toString(u.enc.Hex)},this.digestString=function(e){return this.updateString(e),this.digest()},this.digestHex=function(e){return this.updateHex(e),this.digest()}}if(-1!=":sha256:".indexOf(e)&&"sjcl"==t){try{this.md=new sjcl.hash.sha256}catch(t){throw"setAlgAndProvider hash alg set fail alg="+e+"/"+t}this.updateString=function(e){this.md.update(e)},this.updateHex=function(e){var t=sjcl.codec.hex.toBits(e);this.md.update(t)},this.digest=function(){var e=this.md.finalize();return sjcl.codec.hex.fromBits(e)},this.digestString=function(e){return this.updateString(e),this.digest()},this.digestHex=function(e){return this.updateHex(e),this.digest()}}},this.updateString=function(e){throw"updateString(str) not supported for this alg/prov: "+this.algName+"/"+this.provName},this.updateHex=function(e){throw"updateHex(hex) not supported for this alg/prov: "+this.algName+"/"+this.provName},this.digest=function(){throw"digest() not supported for this alg/prov: "+this.algName+"/"+this.provName},this.digestString=function(e){throw"digestString(str) not supported for this alg/prov: "+this.algName+"/"+this.provName},this.digestHex=function(e){throw"digestHex(hex) not supported for this alg/prov: "+this.algName+"/"+this.provName},void 0!==e&&void 0!==e.alg&&(this.algName=e.alg,void 0===e.prov&&(this.provName=a.crypto.Util.DEFAULTPROVIDER[this.algName]),this.setAlgAndProvider(this.algName,this.provName))},a.crypto.MessageDigest.getCanonicalAlgName=function(e){return"string"==typeof e&&(e=(e=e.toLowerCase()).replace(/-/,"")),e},a.crypto.MessageDigest.getHashLength=function(e){var t=a.crypto.MessageDigest,i=t.getCanonicalAlgName(e);if(void 0===t.HASHLENGTH[i])throw"not supported algorithm: "+e;return t.HASHLENGTH[i]},a.crypto.MessageDigest.HASHLENGTH={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,ripemd160:20},a.crypto.Mac=function(e){this.setAlgAndProvider=function(e,t){if(null==(e=e.toLowerCase())&&(e="hmacsha1"),"hmac"!=(e=e.toLowerCase()).substr(0,4))throw"setAlgAndProvider unsupported HMAC alg: "+e;void 0===t&&(t=a.crypto.Util.DEFAULTPROVIDER[e]),this.algProv=e+"/"+t;var i=e.substr(4);if(-1!=":md5:sha1:sha224:sha256:sha384:sha512:ripemd160:".indexOf(i)&&"cryptojs"==t){try{var n=a.crypto.Util.CRYPTOJSMESSAGEDIGESTNAME[i];this.mac=u.algo.HMAC.create(n,this.pass)}catch(e){throw"setAlgAndProvider hash alg set fail hashAlg="+i+"/"+e}this.updateString=function(e){this.mac.update(e)},this.updateHex=function(e){var t=u.enc.Hex.parse(e);this.mac.update(t)},this.doFinal=function(){return this.mac.finalize().toString(u.enc.Hex)},this.doFinalString=function(e){return this.updateString(e),this.doFinal()},this.doFinalHex=function(e){return this.updateHex(e),this.doFinal()}}},this.updateString=function(e){throw"updateString(str) not supported for this alg/prov: "+this.algProv},this.updateHex=function(e){throw"updateHex(hex) not supported for this alg/prov: "+this.algProv},this.doFinal=function(){throw"digest() not supported for this alg/prov: "+this.algProv},this.doFinalString=function(e){throw"digestString(str) not supported for this alg/prov: "+this.algProv},this.doFinalHex=function(e){throw"digestHex(hex) not supported for this alg/prov: "+this.algProv},this.setPassword=function(e){if("string"==typeof e){var t=e;return e.length%2!=1&&e.match(/^[0-9A-Fa-f]+$/)||(t=re(e)),void(this.pass=u.enc.Hex.parse(t))}if("object"!=typeof e)throw"KJUR.crypto.Mac unsupported password type: "+e;t=null;if(void 0!==e.hex){if(e.hex.length%2!=0||!e.hex.match(/^[0-9A-Fa-f]+$/))throw"Mac: wrong hex password: "+e.hex;t=e.hex}if(void 0!==e.utf8&&(t=te(e.utf8)),void 0!==e.rstr&&(t=re(e.rstr)),void 0!==e.b64&&(t=k(e.b64)),void 0!==e.b64u&&(t=ee(e.b64u)),null==t)throw"KJUR.crypto.Mac unsupported password type: "+e;this.pass=u.enc.Hex.parse(t)},void 0!==e&&(void 0!==e.pass&&this.setPassword(e.pass),void 0!==e.alg&&(this.algName=e.alg,void 0===e.prov&&(this.provName=a.crypto.Util.DEFAULTPROVIDER[this.algName]),this.setAlgAndProvider(this.algName,this.provName)))},a.crypto.Signature=function(e){var t=null;if(this._setAlgNames=function(){var e=this.algName.match(/^(.+)with(.+)$/);e&&(this.mdAlgName=e[1].toLowerCase(),this.pubkeyAlgName=e[2].toLowerCase(),"rsaandmgf1"==this.pubkeyAlgName&&"sha"==this.mdAlgName&&(this.mdAlgName="sha1"))},this._zeroPaddingOfSignature=function(e,t){for(var i="",n=t/4-e.length,r=0;r<n;r++)i+="0";return i+e},this.setAlgAndProvider=function(e,t){if(this._setAlgNames(),"cryptojs/jsrsa"!=t)throw new Error("provider not supported: "+t);if(-1!=":md5:sha1:sha224:sha256:sha384:sha512:ripemd160:".indexOf(this.mdAlgName)){try{this.md=new a.crypto.MessageDigest({alg:this.mdAlgName})}catch(e){throw new Error("setAlgAndProvider hash alg set fail alg="+this.mdAlgName+"/"+e)}this.init=function(e,t){var i=null;try{i=void 0===t?we.getKey(e):we.getKey(e,t)}catch(e){throw"init failed:"+e}if(!0===i.isPrivate)this.prvKey=i,this.state="SIGN";else{if(!0!==i.isPublic)throw"init failed.:"+i;this.pubKey=i,this.state="VERIFY"}},this.updateString=function(e){this.md.updateString(e)},this.updateHex=function(e){this.md.updateHex(e)},this.sign=function(){if(this.sHashHex=this.md.digest(),void 0===this.prvKey&&void 0!==this.ecprvhex&&void 0!==this.eccurvename&&void 0!==a.crypto.ECDSA&&(this.prvKey=new a.crypto.ECDSA({curve:this.eccurvename,prv:this.ecprvhex})),this.prvKey instanceof W&&"rsaandmgf1"===this.pubkeyAlgName)this.hSign=this.prvKey.signWithMessageHashPSS(this.sHashHex,this.mdAlgName,this.pssSaltLen);else if(this.prvKey instanceof W&&"rsa"===this.pubkeyAlgName)this.hSign=this.prvKey.signWithMessageHash(this.sHashHex,this.mdAlgName);else if(this.prvKey instanceof a.crypto.ECDSA)this.hSign=this.prvKey.signWithMessageHash(this.sHashHex);else{if(!(this.prvKey instanceof a.crypto.DSA))throw"Signature: unsupported private key alg: "+this.pubkeyAlgName;this.hSign=this.prvKey.signWithMessageHash(this.sHashHex)}return this.hSign},this.signString=function(e){return this.updateString(e),this.sign()},this.signHex=function(e){return this.updateHex(e),this.sign()},this.verify=function(e){if(this.sHashHex=this.md.digest(),void 0===this.pubKey&&void 0!==this.ecpubhex&&void 0!==this.eccurvename&&void 0!==a.crypto.ECDSA&&(this.pubKey=new a.crypto.ECDSA({curve:this.eccurvename,pub:this.ecpubhex})),this.pubKey instanceof W&&"rsaandmgf1"===this.pubkeyAlgName)return this.pubKey.verifyWithMessageHashPSS(this.sHashHex,e,this.mdAlgName,this.pssSaltLen);if(this.pubKey instanceof W&&"rsa"===this.pubkeyAlgName)return this.pubKey.verifyWithMessageHash(this.sHashHex,e);if(void 0!==a.crypto.ECDSA&&this.pubKey instanceof a.crypto.ECDSA)return this.pubKey.verifyWithMessageHash(this.sHashHex,e);if(void 0!==a.crypto.DSA&&this.pubKey instanceof a.crypto.DSA)return this.pubKey.verifyWithMessageHash(this.sHashHex,e);throw"Signature: unsupported public key alg: "+this.pubkeyAlgName}}},this.init=function(e,t){throw"init(key, pass) not supported for this alg:prov="+this.algProvName},this.updateString=function(e){throw"updateString(str) not supported for this alg:prov="+this.algProvName},this.updateHex=function(e){throw"updateHex(hex) not supported for this alg:prov="+this.algProvName},this.sign=function(){throw"sign() not supported for this alg:prov="+this.algProvName},this.signString=function(e){throw"digestString(str) not supported for this alg:prov="+this.algProvName},this.signHex=function(e){throw"digestHex(hex) not supported for this alg:prov="+this.algProvName},this.verify=function(e){throw"verify(hSigVal) not supported for this alg:prov="+this.algProvName},this.initParams=e,void 0!==e&&(void 0!==e.alg&&(this.algName=e.alg,void 0===e.prov?this.provName=a.crypto.Util.DEFAULTPROVIDER[this.algName]:this.provName=e.prov,this.algProvName=this.algName+":"+this.provName,this.setAlgAndProvider(this.algName,this.provName),this._setAlgNames()),void 0!==e.psssaltlen&&(this.pssSaltLen=e.psssaltlen),void 0!==e.prvkeypem)){if(void 0!==e.prvkeypas)throw"both prvkeypem and prvkeypas parameters not supported";try{t=we.getKey(e.prvkeypem);this.init(t)}catch(e){throw"fatal error to load pem private key: "+e}}},a.crypto.Cipher=function(e){},a.crypto.Cipher.encrypt=function(e,t,i){if(t instanceof W&&t.isPublic){var n=a.crypto.Cipher.getAlgByKeyAndName(t,i);if("RSA"===n)return t.encrypt(e);if("RSAOAEP"===n)return t.encryptOAEP(e,"sha1");var r=n.match(/^RSAOAEP(\d+)$/);if(null!==r)return t.encryptOAEP(e,"sha"+r[1]);throw"Cipher.encrypt: unsupported algorithm for RSAKey: "+i}throw"Cipher.encrypt: unsupported key or algorithm"},a.crypto.Cipher.decrypt=function(e,t,i){if(t instanceof W&&t.isPrivate){var n=a.crypto.Cipher.getAlgByKeyAndName(t,i);if("RSA"===n)return t.decrypt(e);if("RSAOAEP"===n)return t.decryptOAEP(e,"sha1");var r=n.match(/^RSAOAEP(\d+)$/);if(null!==r)return t.decryptOAEP(e,"sha"+r[1]);throw"Cipher.decrypt: unsupported algorithm for RSAKey: "+i}throw"Cipher.decrypt: unsupported key or algorithm"},a.crypto.Cipher.getAlgByKeyAndName=function(e,t){if(e instanceof W){if(-1!=":RSA:RSAOAEP:RSAOAEP224:RSAOAEP256:RSAOAEP384:RSAOAEP512:".indexOf(t))return t;if(null==t)return"RSA";throw"getAlgByKeyAndName: not supported algorithm name for RSAKey: "+t}throw"getAlgByKeyAndName: not supported algorithm name: "+t},a.crypto.OID=new function(){this.oidhex2name={"2a864886f70d010101":"rsaEncryption","2a8648ce3d0201":"ecPublicKey","2a8648ce380401":"dsa","2a8648ce3d030107":"secp256r1","2b8104001f":"secp192k1","2b81040021":"secp224r1","2b8104000a":"secp256k1","2b81040023":"secp521r1","2b81040022":"secp384r1","2a8648ce380403":"SHA1withDSA","608648016503040301":"SHA224withDSA","608648016503040302":"SHA256withDSA"}};var fe,Ae,ge,me,ve,ye,be,xe,we=(fe=function(e,t,i){return Ae(u.AES,e,t,i)},Ae=function(e,t,i,n){var r=u.enc.Hex.parse(t),o=u.enc.Hex.parse(i),s=u.enc.Hex.parse(n),a={};a.key=o,a.iv=s,a.ciphertext=r;var l=e.decrypt(a,o,{iv:s});return u.enc.Hex.stringify(l)},ge=function(e,t,i){return me(u.AES,e,t,i)},me=function(e,t,i,n){var r=u.enc.Hex.parse(t),o=u.enc.Hex.parse(i),s=u.enc.Hex.parse(n),a=e.encrypt(r,o,{iv:s}),l=u.enc.Hex.parse(a.toString());return u.enc.Base64.stringify(l)},ve={"AES-256-CBC":{proc:fe,eproc:ge,keylen:32,ivlen:16},"AES-192-CBC":{proc:fe,eproc:ge,keylen:24,ivlen:16},"AES-128-CBC":{proc:fe,eproc:ge,keylen:16,ivlen:16},"DES-EDE3-CBC":{proc:function(e,t,i){return Ae(u.TripleDES,e,t,i)},eproc:function(e,t,i){return me(u.TripleDES,e,t,i)},keylen:24,ivlen:8},"DES-CBC":{proc:function(e,t,i){return Ae(u.DES,e,t,i)},eproc:function(e,t,i){return me(u.DES,e,t,i)},keylen:8,ivlen:8}},ye=function(e){var t={},i=e.match(new RegExp("DEK-Info: ([^,]+),([0-9A-Fa-f]+)","m"));i&&(t.cipher=i[1],t.ivsalt=i[2]);var n=e.match(new RegExp("-----BEGIN ([A-Z]+) PRIVATE KEY-----"));n&&(t.type=n[1]);var r=-1,o=0;-1!=e.indexOf("\r\n\r\n")&&(r=e.indexOf("\r\n\r\n"),o=2),-1!=e.indexOf("\n\n")&&(r=e.indexOf("\n\n"),o=1);var s=e.indexOf("-----END");if(-1!=r&&-1!=s){var a=e.substring(r+2*o,s-o);a=a.replace(/\s+/g,""),t.data=a}return t},be=function(e,t,i){for(var n=i.substring(0,16),r=u.enc.Hex.parse(n),o=u.enc.Utf8.parse(t),s=ve[e].keylen+ve[e].ivlen,a="",l=null;;){var c=u.algo.MD5.create();if(null!=l&&c.update(l),c.update(o),c.update(r),l=c.finalize(),(a+=u.enc.Hex.stringify(l)).length>=2*s)break}var h={};return h.keyhex=a.substr(0,2*ve[e].keylen),h.ivhex=a.substr(2*ve[e].keylen,2*ve[e].ivlen),h},xe=function(e,t,i,n){var r=u.enc.Base64.parse(e),o=u.enc.Hex.stringify(r);return(0,ve[t].proc)(o,i,n)},{version:"1.0.0",parsePKCS5PEM:function(e){return ye(e)},getKeyAndUnusedIvByPasscodeAndIvsalt:function(e,t,i){return be(e,t,i)},decryptKeyB64:function(e,t,i,n){return xe(e,t,i,n)},getDecryptedKeyHex:function(e,t){var i=ye(e),n=i.cipher,r=i.ivsalt,o=i.data,s=be(n,t,r).keyhex;return xe(o,n,s,r)},getEncryptedPKCS5PEMFromPrvKeyHex:function(e,t,i,n,r){var o="";if(void 0!==n&&null!=n||(n="AES-256-CBC"),void 0===ve[n])throw"KEYUTIL unsupported algorithm: "+n;if(void 0===r||null==r){var s=function(e){var t=u.lib.WordArray.random(e);return u.enc.Hex.stringify(t)}(ve[n].ivlen);r=s.toUpperCase()}var a=function(e,t,i,n){return(0,ve[t].eproc)(e,i,n)}(t,n,be(n,i,r).keyhex,r);return o="-----BEGIN "+e+" PRIVATE KEY-----\r\n",o+="Proc-Type: 4,ENCRYPTED\r\n",o+="DEK-Info: "+n+","+r+"\r\n",o+="\r\n",o+=a.replace(/(.{64})/g,"$1\r\n"),o+="\r\n-----END "+e+" PRIVATE KEY-----\r\n"},parseHexOfEncryptedPKCS8:function(e){var t=Me,i=t.getChildIdx,n=t.getV,r={},o=i(e,0);if(2!=o.length)throw"malformed format: SEQUENCE(0).items != 2: "+o.length;r.ciphertext=n(e,o[1]);var s=i(e,o[0]);if(2!=s.length)throw"malformed format: SEQUENCE(0.0).items != 2: "+s.length;if("2a864886f70d01050d"!=n(e,s[0]))throw"this only supports pkcs5PBES2";var a=i(e,s[1]);if(2!=s.length)throw"malformed format: SEQUENCE(0.0.1).items != 2: "+a.length;var l=i(e,a[1]);if(2!=l.length)throw"malformed format: SEQUENCE(0.0.1.1).items != 2: "+l.length;if("2a864886f70d0307"!=n(e,l[0]))throw"this only supports TripleDES";r.encryptionSchemeAlg="TripleDES",r.encryptionSchemeIV=n(e,l[1]);var u=i(e,a[0]);if(2!=u.length)throw"malformed format: SEQUENCE(0.0.1.0).items != 2: "+u.length;if("2a864886f70d01050c"!=n(e,u[0]))throw"this only supports pkcs5PBKDF2";var c=i(e,u[1]);if(c.length<2)throw"malformed format: SEQUENCE(0.0.1.0.1).items < 2: "+c.length;r.pbkdf2Salt=n(e,c[0]);var h=n(e,c[1]);try{r.pbkdf2Iter=parseInt(h,16)}catch(e){throw"malformed format pbkdf2Iter: "+h}return r},getPBKDF2KeyHexFromParam:function(e,t){var i=u.enc.Hex.parse(e.pbkdf2Salt),n=e.pbkdf2Iter,r=u.PBKDF2(t,i,{keySize:6,iterations:n});return u.enc.Hex.stringify(r)},_getPlainPKCS8HexFromEncryptedPKCS8PEM:function(e,t){var i=ae(e,"ENCRYPTED PRIVATE KEY"),n=this.parseHexOfEncryptedPKCS8(i),r=we.getPBKDF2KeyHexFromParam(n,t),o={};o.ciphertext=u.enc.Hex.parse(n.ciphertext);var s=u.enc.Hex.parse(r),a=u.enc.Hex.parse(n.encryptionSchemeIV),l=u.TripleDES.decrypt(o,s,{iv:a});return u.enc.Hex.stringify(l)},getKeyFromEncryptedPKCS8PEM:function(e,t){var i=this._getPlainPKCS8HexFromEncryptedPKCS8PEM(e,t);return this.getKeyFromPlainPrivatePKCS8Hex(i)},parsePlainPrivatePKCS8Hex:function(e){var t=Me,i=t.getChildIdx,n=t.getV,r={algparam:null};if("30"!=e.substr(0,2))throw new Error("malformed plain PKCS8 private key(code:001)");var o=i(e,0);if(o.length<3)throw new Error("malformed plain PKCS8 private key(code:002)");if("30"!=e.substr(o[1],2))throw new Error("malformed PKCS8 private key(code:003)");var s=i(e,o[1]);if(2!=s.length)throw new Error("malformed PKCS8 private key(code:004)");if("06"!=e.substr(s[0],2))throw new Error("malformed PKCS8 private key(code:005)");if(r.algoid=n(e,s[0]),"06"==e.substr(s[1],2)&&(r.algparam=n(e,s[1])),"04"!=e.substr(o[2],2))throw new Error("malformed PKCS8 private key(code:006)");return r.keyidx=t.getVidx(e,o[2]),r},getKeyFromPlainPrivatePKCS8PEM:function(e){var t=ae(e,"PRIVATE KEY");return this.getKeyFromPlainPrivatePKCS8Hex(t)},getKeyFromPlainPrivatePKCS8Hex:function(e){var t,i=this.parsePlainPrivatePKCS8Hex(e);if("2a864886f70d010101"==i.algoid)t=new W;else if("2a8648ce380401"==i.algoid)t=new a.crypto.DSA;else{if("2a8648ce3d0201"!=i.algoid)throw"unsupported private key algorithm";t=new a.crypto.ECDSA}return t.readPKCS8PrvKeyHex(e),t},_getKeyFromPublicPKCS8Hex:function(e){var t,i=Me.getVbyList(e,0,[0,0],"06");if("2a864886f70d010101"===i)t=new W;else if("2a8648ce380401"===i)t=new a.crypto.DSA;else{if("2a8648ce3d0201"!==i)throw"unsupported PKCS#8 public key hex";t=new a.crypto.ECDSA}return t.readPKCS8PubKeyHex(e),t},parsePublicRawRSAKeyHex:function(e){var t=Me,i=t.getChildIdx,n=t.getV,r={};if("30"!=e.substr(0,2))throw"malformed RSA key(code:001)";var o=i(e,0);if(2!=o.length)throw"malformed RSA key(code:002)";if("02"!=e.substr(o[0],2))throw"malformed RSA key(code:003)";if(r.n=n(e,o[0]),"02"!=e.substr(o[1],2))throw"malformed RSA key(code:004)";return r.e=n(e,o[1]),r},parsePublicPKCS8Hex:function(e){var t=Me,i=t.getChildIdx,n=t.getV,r={algparam:null},o=i(e,0);if(2!=o.length)throw"outer DERSequence shall have 2 elements: "+o.length;var s=o[0];if("30"!=e.substr(s,2))throw"malformed PKCS8 public key(code:001)";var a=i(e,s);if(2!=a.length)throw"malformed PKCS8 public key(code:002)";if("06"!=e.substr(a[0],2))throw"malformed PKCS8 public key(code:003)";if(r.algoid=n(e,a[0]),"06"==e.substr(a[1],2)?r.algparam=n(e,a[1]):"30"==e.substr(a[1],2)&&(r.algparam={},r.algparam.p=t.getVbyList(e,a[1],[0],"02"),r.algparam.q=t.getVbyList(e,a[1],[1],"02"),r.algparam.g=t.getVbyList(e,a[1],[2],"02")),"03"!=e.substr(o[1],2))throw"malformed PKCS8 public key(code:004)";return r.key=n(e,o[1]).substr(2),r}});we.getKey=function(e,t,i){var n=(v=Me).getChildIdx;v.getV;var r=v.getVbyList,o=a.crypto,s=o.ECDSA,l=o.DSA,u=W,h=ae,d=we;if(void 0!==u&&e instanceof u)return e;if(void 0!==s&&e instanceof s)return e;if(void 0!==l&&e instanceof l)return e;if(void 0!==e.curve&&void 0!==e.xy&&void 0===e.d)return new s({pub:e.xy,curve:e.curve});if(void 0!==e.curve&&void 0!==e.d)return new s({prv:e.d,curve:e.curve});if(void 0===e.kty&&void 0!==e.n&&void 0!==e.e&&void 0===e.d)return(T=new u).setPublic(e.n,e.e),T;if(void 0===e.kty&&void 0!==e.n&&void 0!==e.e&&void 0!==e.d&&void 0!==e.p&&void 0!==e.q&&void 0!==e.dp&&void 0!==e.dq&&void 0!==e.co&&void 0===e.qi)return(T=new u).setPrivateEx(e.n,e.e,e.d,e.p,e.q,e.dp,e.dq,e.co),T;if(void 0===e.kty&&void 0!==e.n&&void 0!==e.e&&void 0!==e.d&&void 0===e.p)return(T=new u).setPrivate(e.n,e.e,e.d),T;if(void 0!==e.p&&void 0!==e.q&&void 0!==e.g&&void 0!==e.y&&void 0===e.x)return(T=new l).setPublic(e.p,e.q,e.g,e.y),T;if(void 0!==e.p&&void 0!==e.q&&void 0!==e.g&&void 0!==e.y&&void 0!==e.x)return(T=new l).setPrivate(e.p,e.q,e.g,e.y,e.x),T;if("RSA"===e.kty&&void 0!==e.n&&void 0!==e.e&&void 0===e.d)return(T=new u).setPublic(ee(e.n),ee(e.e)),T;if("RSA"===e.kty&&void 0!==e.n&&void 0!==e.e&&void 0!==e.d&&void 0!==e.p&&void 0!==e.q&&void 0!==e.dp&&void 0!==e.dq&&void 0!==e.qi)return(T=new u).setPrivateEx(ee(e.n),ee(e.e),ee(e.d),ee(e.p),ee(e.q),ee(e.dp),ee(e.dq),ee(e.qi)),T;if("RSA"===e.kty&&void 0!==e.n&&void 0!==e.e&&void 0!==e.d)return(T=new u).setPrivate(ee(e.n),ee(e.e),ee(e.d)),T;if("EC"===e.kty&&void 0!==e.crv&&void 0!==e.x&&void 0!==e.y&&void 0===e.d){var p=(B=new s({curve:e.crv})).ecparams.keylen/4,f="04"+("0000000000"+ee(e.x)).slice(-p)+("0000000000"+ee(e.y)).slice(-p);return B.setPublicKeyHex(f),B}if("EC"===e.kty&&void 0!==e.crv&&void 0!==e.x&&void 0!==e.y&&void 0!==e.d){p=(B=new s({curve:e.crv})).ecparams.keylen/4,f="04"+("0000000000"+ee(e.x)).slice(-p)+("0000000000"+ee(e.y)).slice(-p);var A=("0000000000"+ee(e.d)).slice(-p);return B.setPublicKeyHex(f),B.setPrivateKeyHex(A),B}if("pkcs5prv"===i){var g,m=e,v=Me;if(9===(g=n(m,0)).length)(T=new u).readPKCS5PrvKeyHex(m);else if(6===g.length)(T=new l).readPKCS5PrvKeyHex(m);else{if(!(g.length>2&&"04"===m.substr(g[1],2)))throw"unsupported PKCS#1/5 hexadecimal key";(T=new s).readPKCS5PrvKeyHex(m)}return T}if("pkcs8prv"===i)return T=d.getKeyFromPlainPrivatePKCS8Hex(e);if("pkcs8pub"===i)return d._getKeyFromPublicPKCS8Hex(e);if("x509pub"===i)return Ie.getPublicKeyFromCertHex(e);if(-1!=e.indexOf("-END CERTIFICATE-",0)||-1!=e.indexOf("-END X509 CERTIFICATE-",0)||-1!=e.indexOf("-END TRUSTED CERTIFICATE-",0))return Ie.getPublicKeyFromCertPEM(e);if(-1!=e.indexOf("-END PUBLIC KEY-")){var y=ae(e,"PUBLIC KEY");return d._getKeyFromPublicPKCS8Hex(y)}if(-1!=e.indexOf("-END RSA PRIVATE KEY-")&&-1==e.indexOf("4,ENCRYPTED")){var b=h(e,"RSA PRIVATE KEY");return d.getKey(b,null,"pkcs5prv")}if(-1!=e.indexOf("-END DSA PRIVATE KEY-")&&-1==e.indexOf("4,ENCRYPTED")){var x=r(D=h(e,"DSA PRIVATE KEY"),0,[1],"02"),w=r(D,0,[2],"02"),M=r(D,0,[3],"02"),E=r(D,0,[4],"02"),S=r(D,0,[5],"02");return(T=new l).setPrivate(new c(x,16),new c(w,16),new c(M,16),new c(E,16),new c(S,16)),T}if(-1!=e.indexOf("-END EC PRIVATE KEY-")&&-1==e.indexOf("4,ENCRYPTED")){b=h(e,"EC PRIVATE KEY");return d.getKey(b,null,"pkcs5prv")}if(-1!=e.indexOf("-END PRIVATE KEY-"))return d.getKeyFromPlainPrivatePKCS8PEM(e);if(-1!=e.indexOf("-END RSA PRIVATE KEY-")&&-1!=e.indexOf("4,ENCRYPTED")){var C=d.getDecryptedKeyHex(e,t),I=new W;return I.readPKCS5PrvKeyHex(C),I}if(-1!=e.indexOf("-END EC PRIVATE KEY-")&&-1!=e.indexOf("4,ENCRYPTED")){var B,T=r(D=d.getDecryptedKeyHex(e,t),0,[1],"04"),P=r(D,0,[2,0],"06"),R=r(D,0,[3,0],"03").substr(2);if(void 0===a.crypto.OID.oidhex2name[P])throw"undefined OID(hex) in KJUR.crypto.OID: "+P;return(B=new s({curve:a.crypto.OID.oidhex2name[P]})).setPublicKeyHex(R),B.setPrivateKeyHex(T),B.isPublic=!1,B}if(-1!=e.indexOf("-END DSA PRIVATE KEY-")&&-1!=e.indexOf("4,ENCRYPTED")){var D;x=r(D=d.getDecryptedKeyHex(e,t),0,[1],"02"),w=r(D,0,[2],"02"),M=r(D,0,[3],"02"),E=r(D,0,[4],"02"),S=r(D,0,[5],"02");return(T=new l).setPrivate(new c(x,16),new c(w,16),new c(M,16),new c(E,16),new c(S,16)),T}if(-1!=e.indexOf("-END ENCRYPTED PRIVATE KEY-"))return d.getKeyFromEncryptedPKCS8PEM(e,t);throw new Error("not supported argument")},we.generateKeypair=function(e,t){if("RSA"==e){var i=t;(s=new W).generate(i,"10001"),s.isPrivate=!0,s.isPublic=!0;var n=new W,r=s.n.toString(16),o=s.e.toString(16);return n.setPublic(r,o),n.isPrivate=!1,n.isPublic=!0,(l={}).prvKeyObj=s,l.pubKeyObj=n,l}if("EC"==e){var s,l,u=t,c=new a.crypto.ECDSA({curve:u}).generateKeyPairHex();return(s=new a.crypto.ECDSA({curve:u})).setPublicKeyHex(c.ecpubhex),s.setPrivateKeyHex(c.ecprvhex),s.isPrivate=!0,s.isPublic=!1,(n=new a.crypto.ECDSA({curve:u})).setPublicKeyHex(c.ecpubhex),n.isPrivate=!1,n.isPublic=!0,(l={}).prvKeyObj=s,l.pubKeyObj=n,l}throw"unknown algorithm: "+e},we.getPEM=function(e,t,i,n,r,o){var s=a,l=s.asn1,c=l.DERObjectIdentifier,h=l.DERInteger,d=l.ASN1Util.newObject,p=l.x509.SubjectPublicKeyInfo,f=s.crypto,A=f.DSA,g=f.ECDSA,m=W;function v(e){return d({seq:[{int:0},{int:{bigint:e.n}},{int:e.e},{int:{bigint:e.d}},{int:{bigint:e.p}},{int:{bigint:e.q}},{int:{bigint:e.dmp1}},{int:{bigint:e.dmq1}},{int:{bigint:e.coeff}}]})}function y(e){return d({seq:[{int:1},{octstr:{hex:e.prvKeyHex}},{tag:["a0",!0,{oid:{name:e.curveName}}]},{tag:["a1",!0,{bitstr:{hex:"00"+e.pubKeyHex}}]}]})}function b(e){return d({seq:[{int:0},{int:{bigint:e.p}},{int:{bigint:e.q}},{int:{bigint:e.g}},{int:{bigint:e.y}},{int:{bigint:e.x}}]})}if((void 0!==m&&e instanceof m||void 0!==A&&e instanceof A||void 0!==g&&e instanceof g)&&1==e.isPublic&&(void 0===t||"PKCS8PUB"==t))return se(E=new p(e).getEncodedHex(),"PUBLIC KEY");if("PKCS1PRV"==t&&void 0!==m&&e instanceof m&&(void 0===i||null==i)&&1==e.isPrivate)return se(E=v(e).getEncodedHex(),"RSA PRIVATE KEY");if("PKCS1PRV"==t&&void 0!==g&&e instanceof g&&(void 0===i||null==i)&&1==e.isPrivate){var x=new c({name:e.curveName}).getEncodedHex(),w=y(e).getEncodedHex(),M="";return M+=se(x,"EC PARAMETERS"),M+=se(w,"EC PRIVATE KEY")}if("PKCS1PRV"==t&&void 0!==A&&e instanceof A&&(void 0===i||null==i)&&1==e.isPrivate)return se(E=b(e).getEncodedHex(),"DSA PRIVATE KEY");if("PKCS5PRV"==t&&void 0!==m&&e instanceof m&&void 0!==i&&null!=i&&1==e.isPrivate){var E=v(e).getEncodedHex();return void 0===n&&(n="DES-EDE3-CBC"),this.getEncryptedPKCS5PEMFromPrvKeyHex("RSA",E,i,n,o)}if("PKCS5PRV"==t&&void 0!==g&&e instanceof g&&void 0!==i&&null!=i&&1==e.isPrivate){E=y(e).getEncodedHex();return void 0===n&&(n="DES-EDE3-CBC"),this.getEncryptedPKCS5PEMFromPrvKeyHex("EC",E,i,n,o)}if("PKCS5PRV"==t&&void 0!==A&&e instanceof A&&void 0!==i&&null!=i&&1==e.isPrivate){E=b(e).getEncodedHex();return void 0===n&&(n="DES-EDE3-CBC"),this.getEncryptedPKCS5PEMFromPrvKeyHex("DSA",E,i,n,o)}var S=function(e,t){var i=C(e,t);return new d({seq:[{seq:[{oid:{name:"pkcs5PBES2"}},{seq:[{seq:[{oid:{name:"pkcs5PBKDF2"}},{seq:[{octstr:{hex:i.pbkdf2Salt}},{int:i.pbkdf2Iter}]}]},{seq:[{oid:{name:"des-EDE3-CBC"}},{octstr:{hex:i.encryptionSchemeIV}}]}]}]},{octstr:{hex:i.ciphertext}}]}).getEncodedHex()},C=function(e,t){var i=u.lib.WordArray.random(8),n=u.lib.WordArray.random(8),r=u.PBKDF2(t,i,{keySize:6,iterations:100}),o=u.enc.Hex.parse(e),s=u.TripleDES.encrypt(o,r,{iv:n})+"",a={};return a.ciphertext=s,a.pbkdf2Salt=u.enc.Hex.stringify(i),a.pbkdf2Iter=100,a.encryptionSchemeAlg="DES-EDE3-CBC",a.encryptionSchemeIV=u.enc.Hex.stringify(n),a};if("PKCS8PRV"==t&&null!=m&&e instanceof m&&1==e.isPrivate){var I=v(e).getEncodedHex();E=d({seq:[{int:0},{seq:[{oid:{name:"rsaEncryption"}},{null:!0}]},{octstr:{hex:I}}]}).getEncodedHex();return void 0===i||null==i?se(E,"PRIVATE KEY"):se(w=S(E,i),"ENCRYPTED PRIVATE KEY")}if("PKCS8PRV"==t&&void 0!==g&&e instanceof g&&1==e.isPrivate){I=new d({seq:[{int:1},{octstr:{hex:e.prvKeyHex}},{tag:["a1",!0,{bitstr:{hex:"00"+e.pubKeyHex}}]}]}).getEncodedHex(),E=d({seq:[{int:0},{seq:[{oid:{name:"ecPublicKey"}},{oid:{name:e.curveName}}]},{octstr:{hex:I}}]}).getEncodedHex();return void 0===i||null==i?se(E,"PRIVATE KEY"):se(w=S(E,i),"ENCRYPTED PRIVATE KEY")}if("PKCS8PRV"==t&&void 0!==A&&e instanceof A&&1==e.isPrivate){I=new h({bigint:e.x}).getEncodedHex(),E=d({seq:[{int:0},{seq:[{oid:{name:"dsa"}},{seq:[{int:{bigint:e.p}},{int:{bigint:e.q}},{int:{bigint:e.g}}]}]},{octstr:{hex:I}}]}).getEncodedHex();return void 0===i||null==i?se(E,"PRIVATE KEY"):se(w=S(E,i),"ENCRYPTED PRIVATE KEY")}throw new Error("unsupported object nor format")},we.getKeyFromCSRPEM=function(e){var t=ae(e,"CERTIFICATE REQUEST");return we.getKeyFromCSRHex(t)},we.getKeyFromCSRHex=function(e){var t=we.parseCSRHex(e);return we.getKey(t.p8pubkeyhex,null,"pkcs8pub")},we.parseCSRHex=function(e){var t=Me,i=t.getChildIdx,n=t.getTLV,r={},o=e;if("30"!=o.substr(0,2))throw"malformed CSR(code:001)";var s=i(o,0);if(s.length<1)throw"malformed CSR(code:002)";if("30"!=o.substr(s[0],2))throw"malformed CSR(code:003)";var a=i(o,s[0]);if(a.length<3)throw"malformed CSR(code:004)";return r.p8pubkeyhex=n(o,a[2]),r},we.getKeyID=function(e){var t=we,i=Me;"string"==typeof e&&-1!=e.indexOf("BEGIN ")&&(e=t.getKey(e));var n=ae(t.getPEM(e)),r=i.getIdxbyList(n,0,[1]),o=i.getV(n,r).substring(2);return a.crypto.Util.hashHex(o,"sha1")},we.getJWKFromKey=function(e){var t={};if(e instanceof W&&e.isPrivate)return t.kty="RSA",t.n=$(e.n.toString(16)),t.e=$(e.e.toString(16)),t.d=$(e.d.toString(16)),t.p=$(e.p.toString(16)),t.q=$(e.q.toString(16)),t.dp=$(e.dmp1.toString(16)),t.dq=$(e.dmq1.toString(16)),t.qi=$(e.coeff.toString(16)),t;if(e instanceof W&&e.isPublic)return t.kty="RSA",t.n=$(e.n.toString(16)),t.e=$(e.e.toString(16)),t;if(e instanceof a.crypto.ECDSA&&e.isPrivate){if("P-256"!==(n=e.getShortNISTPCurveName())&&"P-384"!==n)throw"unsupported curve name for JWT: "+n;var i=e.getPublicKeyXYHex();return t.kty="EC",t.crv=n,t.x=$(i.x),t.y=$(i.y),t.d=$(e.prvKeyHex),t}if(e instanceof a.crypto.ECDSA&&e.isPublic){var n;if("P-256"!==(n=e.getShortNISTPCurveName())&&"P-384"!==n)throw"unsupported curve name for JWT: "+n;i=e.getPublicKeyXYHex();return t.kty="EC",t.crv=n,t.x=$(i.x),t.y=$(i.y),t}throw"not supported key object"},void 0!==a.asn1&&a.asn1||(a.asn1={}),a.asn1.ASN1Util=new function(){this.integerToByteHex=function(e){var t=e.toString(16);return t.length%2==1&&(t="0"+t),t},this.bigIntToMinTwosComplementsHex=function(e){var t=e.toString(16);if("-"!=t.substr(0,1))t.length%2==1?t="0"+t:t.match(/^[0-7]/)||(t="00"+t);else{var i=t.substr(1).length;i%2==1?i+=1:t.match(/^[0-7]/)||(i+=2);for(var n="",r=0;r<i;r++)n+="f";t=new c(n,16).xor(e).add(c.ONE).toString(16).replace(/^-/,"")}return t},this.getPEMStringFromHex=function(e,t){return se(e,t)},this.newObject=function(e){var t=a.asn1,i=t.ASN1Object,n=t.DERBoolean,r=t.DERInteger,o=t.DERBitString,s=t.DEROctetString,l=t.DERNull,u=t.DERObjectIdentifier,c=t.DEREnumerated,h=t.DERUTF8String,d=t.DERNumericString,p=t.DERPrintableString,f=t.DERTeletexString,A=t.DERIA5String,g=t.DERUTCTime,m=t.DERGeneralizedTime,v=t.DERVisibleString,y=t.DERBMPString,b=t.DERSequence,x=t.DERSet,w=t.DERTaggedObject,M=t.ASN1Util.newObject;if(e instanceof t.ASN1Object)return e;var E=Object.keys(e);if(1!=E.length)throw new Error("key of param shall be only one.");var S=E[0];if(-1==":asn1:bool:int:bitstr:octstr:null:oid:enum:utf8str:numstr:prnstr:telstr:ia5str:utctime:gentime:visstr:bmpstr:seq:set:tag:".indexOf(":"+S+":"))throw new Error("undefined key: "+S);if("bool"==S)return new n(e[S]);if("int"==S)return new r(e[S]);if("bitstr"==S)return new o(e[S]);if("octstr"==S)return new s(e[S]);if("null"==S)return new l(e[S]);if("oid"==S)return new u(e[S]);if("enum"==S)return new c(e[S]);if("utf8str"==S)return new h(e[S]);if("numstr"==S)return new d(e[S]);if("prnstr"==S)return new p(e[S]);if("telstr"==S)return new f(e[S]);if("ia5str"==S)return new A(e[S]);if("utctime"==S)return new g(e[S]);if("gentime"==S)return new m(e[S]);if("visstr"==S)return new v(e[S]);if("bmpstr"==S)return new y(e[S]);if("asn1"==S)return new i(e[S]);if("seq"==S){for(var C=e[S],I=[],B=0;B<C.length;B++){var T=M(C[B]);I.push(T)}return new b({array:I})}if("set"==S){for(C=e[S],I=[],B=0;B<C.length;B++){T=M(C[B]);I.push(T)}return new x({array:I})}if("tag"==S){var P=e[S];if("[object Array]"===Object.prototype.toString.call(P)&&3==P.length){var R=M(P[2]);return new w({tag:P[0],explicit:P[1],obj:R})}return new w(P)}},this.jsonToASN1HEX=function(e){return this.newObject(e).getEncodedHex()}},a.asn1.ASN1Util.oidHexToInt=function(e){for(var t="",i=parseInt(e.substr(0,2),16),n=(t=Math.floor(i/40)+"."+i%40,""),r=2;r<e.length;r+=2){var o=("00000000"+parseInt(e.substr(r,2),16).toString(2)).slice(-8);if(n+=o.substr(1,7),"0"==o.substr(0,1))t=t+"."+new c(n,2).toString(10),n=""}return t},a.asn1.ASN1Util.oidIntToHex=function(e){var t=function(e){var t=e.toString(16);return 1==t.length&&(t="0"+t),t},i=function(e){var i="",n=new c(e,10).toString(2),r=7-n.length%7;7==r&&(r=0);for(var o="",s=0;s<r;s++)o+="0";n=o+n;for(s=0;s<n.length-1;s+=7){var a=n.substr(s,7);s!=n.length-7&&(a="1"+a),i+=t(parseInt(a,2))}return i};if(!e.match(/^[0-9.]+$/))throw"malformed oid string: "+e;var n="",r=e.split("."),o=40*parseInt(r[0])+parseInt(r[1]);n+=t(o),r.splice(0,2);for(var s=0;s<r.length;s++)n+=i(r[s]);return n},a.asn1.ASN1Object=function(e){this.params=null,this.getLengthHexFromValue=function(){if(void 0===this.hV||null==this.hV)throw new Error("this.hV is null or undefined");if(this.hV.length%2==1)throw new Error("value hex must be even length: n="+"".length+",v="+this.hV);var e=this.hV.length/2,t=e.toString(16);if(t.length%2==1&&(t="0"+t),e<128)return t;var i=t.length/2;if(i>15)throw"ASN.1 length too long to represent by 8x: n = "+e.toString(16);return(128+i).toString(16)+t},this.getEncodedHex=function(){return(null==this.hTLV||this.isModified)&&(this.hV=this.getFreshValueHex(),this.hL=this.getLengthHexFromValue(),this.hTLV=this.hT+this.hL+this.hV,this.isModified=!1),this.hTLV},this.getValueHex=function(){return this.getEncodedHex(),this.hV},this.getFreshValueHex=function(){return""},this.setByParam=function(e){this.params=e},null!=e&&null!=e.tlv&&(this.hTLV=e.tlv,this.isModified=!1)},a.asn1.DERAbstractString=function(e){a.asn1.DERAbstractString.superclass.constructor.call(this),this.getString=function(){return this.s},this.setString=function(e){this.hTLV=null,this.isModified=!0,this.s=e,this.hV=te(this.s).toLowerCase()},this.setStringHex=function(e){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=e},this.getFreshValueHex=function(){return this.hV},void 0!==e&&("string"==typeof e?this.setString(e):void 0!==e.str?this.setString(e.str):void 0!==e.hex&&this.setStringHex(e.hex))},l.lang.extend(a.asn1.DERAbstractString,a.asn1.ASN1Object),a.asn1.DERAbstractTime=function(e){a.asn1.DERAbstractTime.superclass.constructor.call(this),this.localDateToUTC=function(e){var t=e.getTime()+6e4*e.getTimezoneOffset();return new Date(t)},this.formatDate=function(e,t,i){var n=this.zeroPadding,r=this.localDateToUTC(e),o=String(r.getFullYear());"utc"==t&&(o=o.substr(2,2));var s=o+n(String(r.getMonth()+1),2)+n(String(r.getDate()),2)+n(String(r.getHours()),2)+n(String(r.getMinutes()),2)+n(String(r.getSeconds()),2);if(!0===i){var a=r.getMilliseconds();if(0!=a){var l=n(String(a),3);s=s+"."+(l=l.replace(/[0]+$/,""))}}return s+"Z"},this.zeroPadding=function(e,t){return e.length>=t?e:new Array(t-e.length+1).join("0")+e},this.getString=function(){return this.s},this.setString=function(e){this.hTLV=null,this.isModified=!0,this.s=e,this.hV=Z(e)},this.setByDateValue=function(e,t,i,n,r,o){var s=new Date(Date.UTC(e,t-1,i,n,r,o,0));this.setByDate(s)},this.getFreshValueHex=function(){return this.hV}},l.lang.extend(a.asn1.DERAbstractTime,a.asn1.ASN1Object),a.asn1.DERAbstractStructured=function(e){a.asn1.DERAbstractString.superclass.constructor.call(this),this.setByASN1ObjectArray=function(e){this.hTLV=null,this.isModified=!0,this.asn1Array=e},this.appendASN1Object=function(e){this.hTLV=null,this.isModified=!0,this.asn1Array.push(e)},this.asn1Array=new Array,void 0!==e&&void 0!==e.array&&(this.asn1Array=e.array)},l.lang.extend(a.asn1.DERAbstractStructured,a.asn1.ASN1Object),a.asn1.DERBoolean=function(e){a.asn1.DERBoolean.superclass.constructor.call(this),this.hT="01",this.hTLV=0==e?"010100":"0101ff"},l.lang.extend(a.asn1.DERBoolean,a.asn1.ASN1Object),a.asn1.DERInteger=function(e){a.asn1.DERInteger.superclass.constructor.call(this),this.hT="02",this.setByBigInteger=function(e){this.hTLV=null,this.isModified=!0,this.hV=a.asn1.ASN1Util.bigIntToMinTwosComplementsHex(e)},this.setByInteger=function(e){var t=new c(String(e),10);this.setByBigInteger(t)},this.setValueHex=function(e){this.hV=e},this.getFreshValueHex=function(){return this.hV},void 0!==e&&(void 0!==e.bigint?this.setByBigInteger(e.bigint):void 0!==e.int?this.setByInteger(e.int):"number"==typeof e?this.setByInteger(e):void 0!==e.hex&&this.setValueHex(e.hex))},l.lang.extend(a.asn1.DERInteger,a.asn1.ASN1Object),a.asn1.DERBitString=function(e){if(void 0!==e&&void 0!==e.obj){var t=a.asn1.ASN1Util.newObject(e.obj);e.hex="00"+t.getEncodedHex()}a.asn1.DERBitString.superclass.constructor.call(this),this.hT="03",this.setHexValueIncludingUnusedBits=function(e){this.hTLV=null,this.isModified=!0,this.hV=e},this.setUnusedBitsAndHexValue=function(e,t){if(e<0||7<e)throw"unused bits shall be from 0 to 7: u = "+e;var i="0"+e;this.hTLV=null,this.isModified=!0,this.hV=i+t},this.setByBinaryString=function(e){var t=8-(e=e.replace(/0+$/,"")).length%8;8==t&&(t=0);for(var i=0;i<=t;i++)e+="0";var n="";for(i=0;i<e.length-1;i+=8){var r=e.substr(i,8),o=parseInt(r,2).toString(16);1==o.length&&(o="0"+o),n+=o}this.hTLV=null,this.isModified=!0,this.hV="0"+t+n},this.setByBooleanArray=function(e){for(var t="",i=0;i<e.length;i++)1==e[i]?t+="1":t+="0";this.setByBinaryString(t)},this.newFalseArray=function(e){for(var t=new Array(e),i=0;i<e;i++)t[i]=!1;return t},this.getFreshValueHex=function(){return this.hV},void 0!==e&&("string"==typeof e&&e.toLowerCase().match(/^[0-9a-f]+$/)?this.setHexValueIncludingUnusedBits(e):void 0!==e.hex?this.setHexValueIncludingUnusedBits(e.hex):void 0!==e.bin?this.setByBinaryString(e.bin):void 0!==e.array&&this.setByBooleanArray(e.array))},l.lang.extend(a.asn1.DERBitString,a.asn1.ASN1Object),a.asn1.DEROctetString=function(e){if(void 0!==e&&void 0!==e.obj){var t=a.asn1.ASN1Util.newObject(e.obj);e.hex=t.getEncodedHex()}a.asn1.DEROctetString.superclass.constructor.call(this,e),this.hT="04"},l.lang.extend(a.asn1.DEROctetString,a.asn1.DERAbstractString),a.asn1.DERNull=function(){a.asn1.DERNull.superclass.constructor.call(this),this.hT="05",this.hTLV="0500"},l.lang.extend(a.asn1.DERNull,a.asn1.ASN1Object),a.asn1.DERObjectIdentifier=function(e){a.asn1.DERObjectIdentifier.superclass.constructor.call(this),this.hT="06",this.setValueHex=function(e){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=e},this.setValueOidString=function(e){var t=function(e){var t=function(e){var t=e.toString(16);return 1==t.length&&(t="0"+t),t},i=function(e){var i="",n=parseInt(e,10).toString(2),r=7-n.length%7;7==r&&(r=0);for(var o="",s=0;s<r;s++)o+="0";for(n=o+n,s=0;s<n.length-1;s+=7){var a=n.substr(s,7);s!=n.length-7&&(a="1"+a),i+=t(parseInt(a,2))}return i};try{if(!e.match(/^[0-9.]+$/))return null;var n="",r=e.split("."),o=40*parseInt(r[0],10)+parseInt(r[1],10);n+=t(o),r.splice(0,2);for(var s=0;s<r.length;s++)n+=i(r[s]);return n}catch(e){return null}}(e);if(null==t)throw new Error("malformed oid string: "+e);this.hTLV=null,this.isModified=!0,this.s=null,this.hV=t},this.setValueName=function(e){var t=a.asn1.x509.OID.name2oid(e);if(""===t)throw new Error("DERObjectIdentifier oidName undefined: "+e);this.setValueOidString(t)},this.setValueNameOrOid=function(e){e.match(/^[0-2].[0-9.]+$/)?this.setValueOidString(e):this.setValueName(e)},this.getFreshValueHex=function(){return this.hV},this.setByParam=function(e){"string"==typeof e?this.setValueNameOrOid(e):void 0!==e.oid?this.setValueNameOrOid(e.oid):void 0!==e.name?this.setValueNameOrOid(e.name):void 0!==e.hex&&this.setValueHex(e.hex)},void 0!==e&&this.setByParam(e)},l.lang.extend(a.asn1.DERObjectIdentifier,a.asn1.ASN1Object),a.asn1.DEREnumerated=function(e){a.asn1.DEREnumerated.superclass.constructor.call(this),this.hT="0a",this.setByBigInteger=function(e){this.hTLV=null,this.isModified=!0,this.hV=a.asn1.ASN1Util.bigIntToMinTwosComplementsHex(e)},this.setByInteger=function(e){var t=new c(String(e),10);this.setByBigInteger(t)},this.setValueHex=function(e){this.hV=e},this.getFreshValueHex=function(){return this.hV},void 0!==e&&(void 0!==e.int?this.setByInteger(e.int):"number"==typeof e?this.setByInteger(e):void 0!==e.hex&&this.setValueHex(e.hex))},l.lang.extend(a.asn1.DEREnumerated,a.asn1.ASN1Object),a.asn1.DERUTF8String=function(e){a.asn1.DERUTF8String.superclass.constructor.call(this,e),this.hT="0c"},l.lang.extend(a.asn1.DERUTF8String,a.asn1.DERAbstractString),a.asn1.DERNumericString=function(e){a.asn1.DERNumericString.superclass.constructor.call(this,e),this.hT="12"},l.lang.extend(a.asn1.DERNumericString,a.asn1.DERAbstractString),a.asn1.DERPrintableString=function(e){a.asn1.DERPrintableString.superclass.constructor.call(this,e),this.hT="13"},l.lang.extend(a.asn1.DERPrintableString,a.asn1.DERAbstractString),a.asn1.DERTeletexString=function(e){a.asn1.DERTeletexString.superclass.constructor.call(this,e),this.hT="14"},l.lang.extend(a.asn1.DERTeletexString,a.asn1.DERAbstractString),a.asn1.DERIA5String=function(e){a.asn1.DERIA5String.superclass.constructor.call(this,e),this.hT="16"},l.lang.extend(a.asn1.DERIA5String,a.asn1.DERAbstractString),a.asn1.DERVisibleString=function(e){a.asn1.DERIA5String.superclass.constructor.call(this,e),this.hT="1a"},l.lang.extend(a.asn1.DERVisibleString,a.asn1.DERAbstractString),a.asn1.DERBMPString=function(e){a.asn1.DERBMPString.superclass.constructor.call(this,e),this.hT="1e"},l.lang.extend(a.asn1.DERBMPString,a.asn1.DERAbstractString),a.asn1.DERUTCTime=function(e){a.asn1.DERUTCTime.superclass.constructor.call(this,e),this.hT="17",this.setByDate=function(e){this.hTLV=null,this.isModified=!0,this.date=e,this.s=this.formatDate(this.date,"utc"),this.hV=Z(this.s)},this.getFreshValueHex=function(){return void 0===this.date&&void 0===this.s&&(this.date=new Date,this.s=this.formatDate(this.date,"utc"),this.hV=Z(this.s)),this.hV},void 0!==e&&(void 0!==e.str?this.setString(e.str):"string"==typeof e&&e.match(/^[0-9]{12}Z$/)?this.setString(e):void 0!==e.hex?this.setStringHex(e.hex):void 0!==e.date&&this.setByDate(e.date))},l.lang.extend(a.asn1.DERUTCTime,a.asn1.DERAbstractTime),a.asn1.DERGeneralizedTime=function(e){a.asn1.DERGeneralizedTime.superclass.constructor.call(this,e),this.hT="18",this.withMillis=!1,this.setByDate=function(e){this.hTLV=null,this.isModified=!0,this.date=e,this.s=this.formatDate(this.date,"gen",this.withMillis),this.hV=Z(this.s)},this.getFreshValueHex=function(){return void 0===this.date&&void 0===this.s&&(this.date=new Date,this.s=this.formatDate(this.date,"gen",this.withMillis),this.hV=Z(this.s)),this.hV},void 0!==e&&(void 0!==e.str?this.setString(e.str):"string"==typeof e&&e.match(/^[0-9]{14}Z$/)?this.setString(e):void 0!==e.hex?this.setStringHex(e.hex):void 0!==e.date&&this.setByDate(e.date),!0===e.millis&&(this.withMillis=!0))},l.lang.extend(a.asn1.DERGeneralizedTime,a.asn1.DERAbstractTime),a.asn1.DERSequence=function(e){a.asn1.DERSequence.superclass.constructor.call(this,e),this.hT="30",this.getFreshValueHex=function(){for(var e="",t=0;t<this.asn1Array.length;t++){e+=this.asn1Array[t].getEncodedHex()}return this.hV=e,this.hV}},l.lang.extend(a.asn1.DERSequence,a.asn1.DERAbstractStructured),a.asn1.DERSet=function(e){a.asn1.DERSet.superclass.constructor.call(this,e),this.hT="31",this.sortFlag=!0,this.getFreshValueHex=function(){for(var e=new Array,t=0;t<this.asn1Array.length;t++){var i=this.asn1Array[t];e.push(i.getEncodedHex())}return 1==this.sortFlag&&e.sort(),this.hV=e.join(""),this.hV},void 0!==e&&void 0!==e.sortflag&&0==e.sortflag&&(this.sortFlag=!1)},l.lang.extend(a.asn1.DERSet,a.asn1.DERAbstractStructured),a.asn1.DERTaggedObject=function(e){a.asn1.DERTaggedObject.superclass.constructor.call(this);var t=a.asn1;this.hT="a0",this.hV="",this.isExplicit=!0,this.asn1Object=null,this.setASN1Object=function(e,t,i){this.hT=t,this.isExplicit=e,this.asn1Object=i,this.isExplicit?(this.hV=this.asn1Object.getEncodedHex(),this.hTLV=null,this.isModified=!0):(this.hV=null,this.hTLV=i.getEncodedHex(),this.hTLV=this.hTLV.replace(/^../,t),this.isModified=!1)},this.getFreshValueHex=function(){return this.hV},this.setByParam=function(e){null!=e.tag&&(this.hT=e.tag),null!=e.explicit&&(this.isExplicit=e.explicit),null!=e.tage&&(this.hT=e.tage,this.isExplicit=!0),null!=e.tagi&&(this.hT=e.tagi,this.isExplicit=!1),null!=e.obj&&(e.obj instanceof t.ASN1Object?(this.asn1Object=e.obj,this.setASN1Object(this.isExplicit,this.hT,this.asn1Object)):"object"==typeof e.obj&&(this.asn1Object=t.ASN1Util.newObject(e.obj),this.setASN1Object(this.isExplicit,this.hT,this.asn1Object)))},null!=e&&this.setByParam(e)},l.lang.extend(a.asn1.DERTaggedObject,a.asn1.ASN1Object);var Me=new function(){};function Ee(e,t){for(var i="",n=t/4-e.length,r=0;r<n;r++)i+="0";return i+e}function Se(e,t,i){for(var n="",r=0;n.length<t;)n+=ne(i(re(e+String.fromCharCode.apply(String,[(4278190080&r)>>24,(16711680&r)>>16,(65280&r)>>8,255&r])))),r+=1;return n}function Ce(e){for(var t in a.crypto.Util.DIGESTINFOHEAD){var i=a.crypto.Util.DIGESTINFOHEAD[t],n=i.length;if(e.substring(0,n)==i)return[t,e.substring(n)]}return[]}function Ie(e){var t,i=Me,n=i.getChildIdx,r=i.getV,o=i.getTLV,s=i.getVbyList,l=i.getVbyListEx,u=i.getTLVbyList,c=i.getTLVbyListEx,h=i.getIdxbyList,d=i.getIdxbyListEx,p=i.getVidx,f=i.getInt,A=i.oidname,g=i.hextooidstr,m=ae;try{t=a.asn1.x509.AlgorithmIdentifier.PSSNAME2ASN1TLV}catch(e){}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(null===this.hex||0!==this.version)return this.version;var e=u(this.hex,0,[0,0]);if("a0"==e.substr(0,2)){var t=u(e,0,[0]),i=f(t,0);if(i<0||2<i)throw new Error("malformed version field");return this.version=i+1,this.version}return this.version=1,this.foffset=-1,1},this.getSerialNumberHex=function(){return l(this.hex,0,[0,0],"02")},this.getSignatureAlgorithmField=function(){var e=c(this.hex,0,[0,1]);return this.getAlgorithmIdentifierName(e)},this.getAlgorithmIdentifierName=function(e){for(var i in t)if(e===t[i])return i;return A(l(e,0,[0],"06"))},this.getIssuer=function(){return this.getX500Name(this.getIssuerHex())},this.getIssuerHex=function(){return u(this.hex,0,[0,3+this.foffset],"30")},this.getIssuerString=function(){return this.getIssuer().str},this.getSubject=function(){return this.getX500Name(this.getSubjectHex())},this.getSubjectHex=function(){return u(this.hex,0,[0,5+this.foffset],"30")},this.getSubjectString=function(){return this.getSubject().str},this.getNotBefore=function(){var e=s(this.hex,0,[0,4+this.foffset,0]);return e=e.replace(/(..)/g,"%$1"),e=decodeURIComponent(e)},this.getNotAfter=function(){var e=s(this.hex,0,[0,4+this.foffset,1]);return e=e.replace(/(..)/g,"%$1"),e=decodeURIComponent(e)},this.getPublicKeyHex=function(){return i.getTLVbyList(this.hex,0,[0,6+this.foffset],"30")},this.getPublicKeyIdx=function(){return h(this.hex,0,[0,6+this.foffset],"30")},this.getPublicKeyContentIdx=function(){var e=this.getPublicKeyIdx();return h(this.hex,e,[1,0],"30")},this.getPublicKey=function(){return we.getKey(this.getPublicKeyHex(),null,"pkcs8pub")},this.getSignatureAlgorithmName=function(){var e=u(this.hex,0,[1],"30");return this.getAlgorithmIdentifierName(e)},this.getSignatureValueHex=function(){return s(this.hex,0,[2],"03",!0)},this.verifySignature=function(e){var t=this.getSignatureAlgorithmField(),i=this.getSignatureValueHex(),n=u(this.hex,0,[0],"30"),r=new a.crypto.Signature({alg:t});return r.init(e),r.updateHex(n),r.verify(i)},this.parseExt=function(e){var t,o,a;if(void 0===e){if(a=this.hex,3!==this.version)return-1;t=h(a,0,[0,7,0],"30"),o=n(a,t)}else{a=ae(e);var l=h(a,0,[0,3,0,0],"06");if("2a864886f70d01090e"!=r(a,l))return void(this.aExtInfo=new Array);t=h(a,0,[0,3,0,1,0],"30"),o=n(a,t),this.hex=a}this.aExtInfo=new Array;for(var u=0;u<o.length;u++){var c={critical:!1},d=0;3===n(a,o[u]).length&&(c.critical=!0,d=1),c.oid=i.hextooidstr(s(a,o[u],[0],"06"));var f=h(a,o[u],[1+d]);c.vidx=p(a,f),this.aExtInfo.push(c)}},this.getExtInfo=function(e){var t=this.aExtInfo,i=e;if(e.match(/^[0-9.]+$/)||(i=a.asn1.x509.OID.name2oid(e)),""!==i)for(var n=0;n<t.length;n++)if(t[n].oid===i)return t[n]},this.getExtBasicConstraints=function(e,t){if(void 0===e&&void 0===t){var i=this.getExtInfo("basicConstraints");if(void 0===i)return;e=o(this.hex,i.vidx),t=i.critical}var n={extname:"basicConstraints"};if(t&&(n.critical=!0),"3000"===e)return n;if("30030101ff"===e)return n.cA=!0,n;if("30060101ff02"===e.substr(0,12)){var s=r(e,10),a=parseInt(s,16);return n.cA=!0,n.pathLen=a,n}throw new Error("hExtV parse error: "+e)},this.getExtKeyUsage=function(e,t){if(void 0===e&&void 0===t){var i=this.getExtInfo("keyUsage");if(void 0===i)return;e=o(this.hex,i.vidx),t=i.critical}var n={extname:"keyUsage"};return t&&(n.critical=!0),n.names=this.getExtKeyUsageString(e).split(","),n},this.getExtKeyUsageBin=function(e){if(void 0===e){var t=this.getExtInfo("keyUsage");if(void 0===t)return"";e=o(this.hex,t.vidx)}if(8!=e.length&&10!=e.length)throw new Error("malformed key usage value: "+e);var i="000000000000000"+parseInt(e.substr(6),16).toString(2);return 8==e.length&&(i=i.slice(-8)),10==e.length&&(i=i.slice(-16)),""==(i=i.replace(/0+$/,""))&&(i="0"),i},this.getExtKeyUsageString=function(e){for(var t=this.getExtKeyUsageBin(e),i=new Array,n=0;n<t.length;n++)"1"==t.substr(n,1)&&i.push(Ie.KEYUSAGE_NAME[n]);return i.join(",")},this.getExtSubjectKeyIdentifier=function(e,t){if(void 0===e&&void 0===t){var i=this.getExtInfo("subjectKeyIdentifier");if(void 0===i)return;e=o(this.hex,i.vidx),t=i.critical}var n={extname:"subjectKeyIdentifier"};t&&(n.critical=!0);var s=r(e,0);return n.kid={hex:s},n},this.getExtAuthorityKeyIdentifier=function(e,t){if(void 0===e&&void 0===t){var i=this.getExtInfo("authorityKeyIdentifier");if(void 0===i)return;e=o(this.hex,i.vidx),t=i.critical}var s={extname:"authorityKeyIdentifier"};t&&(s.critical=!0);for(var a=n(e,0),l=0;l<a.length;l++){var u=e.substr(a[l],2);if("80"===u&&(s.kid={hex:r(e,a[l])}),"a1"===u){var c=o(e,a[l]),h=this.getGeneralNames(c);s.issuer=h[0].dn}"82"===u&&(s.sn={hex:r(e,a[l])})}return s},this.getExtExtKeyUsage=function(e,t){if(void 0===e&&void 0===t){var i=this.getExtInfo("extKeyUsage");if(void 0===i)return;e=o(this.hex,i.vidx),t=i.critical}var s={extname:"extKeyUsage",array:[]};t&&(s.critical=!0);for(var a=n(e,0),l=0;l<a.length;l++)s.array.push(A(r(e,a[l])));return s},this.getExtExtKeyUsageName=function(){var e=this.getExtInfo("extKeyUsage");if(void 0===e)return e;var t=new Array,i=o(this.hex,e.vidx);if(""===i)return t;for(var s=n(i,0),a=0;a<s.length;a++)t.push(A(r(i,s[a])));return t},this.getExtSubjectAltName=function(e,t){if(void 0===e&&void 0===t){var i=this.getExtInfo("subjectAltName");if(void 0===i)return;e=o(this.hex,i.vidx),t=i.critical}var n={extname:"subjectAltName",array:[]};return t&&(n.critical=!0),n.array=this.getGeneralNames(e),n},this.getExtIssuerAltName=function(e,t){if(void 0===e&&void 0===t){var i=this.getExtInfo("issuerAltName");if(void 0===i)return;e=o(this.hex,i.vidx),t=i.critical}var n={extname:"issuerAltName",array:[]};return t&&(n.critical=!0),n.array=this.getGeneralNames(e),n},this.getGeneralNames=function(e){for(var t=n(e,0),i=[],r=0;r<t.length;r++){var s=this.getGeneralName(o(e,t[r]));void 0!==s&&i.push(s)}return i},this.getGeneralName=function(e){var t=e.substr(0,2),i=r(e,0),n=ne(i);return"81"==t?{rfc822:n}:"82"==t?{dns:n}:"86"==t?{uri:n}:"87"==t?{ip:le(i)}:"a4"==t?{dn:this.getX500Name(i)}:void 0},this.getExtSubjectAltName2=function(){var e,t,i,s=this.getExtInfo("subjectAltName");if(void 0===s)return s;for(var a=new Array,l=o(this.hex,s.vidx),u=n(l,0),c=0;c<u.length;c++)i=l.substr(u[c],2),e=r(l,u[c]),"81"===i&&(t=ie(e),a.push(["MAIL",t])),"82"===i&&(t=ie(e),a.push(["DNS",t])),"84"===i&&(t=Ie.hex2dn(e,0),a.push(["DN",t])),"86"===i&&(t=ie(e),a.push(["URI",t])),"87"===i&&(t=le(e),a.push(["IP",t]));return a},this.getExtCRLDistributionPoints=function(e,t){if(void 0===e&&void 0===t){var i=this.getExtInfo("cRLDistributionPoints");if(void 0===i)return;e=o(this.hex,i.vidx),t=i.critical}var r={extname:"cRLDistributionPoints",array:[]};t&&(r.critical=!0);for(var s=n(e,0),a=0;a<s.length;a++){var l=o(e,s[a]);r.array.push(this.getDistributionPoint(l))}return r},this.getDistributionPoint=function(e){for(var t={},i=n(e,0),r=0;r<i.length;r++){var s=e.substr(i[r],2),a=o(e,i[r]);"a0"==s&&(t.dpname=this.getDistributionPointName(a))}return t},this.getDistributionPointName=function(e){for(var t={},i=n(e,0),r=0;r<i.length;r++){var s=e.substr(i[r],2),a=o(e,i[r]);"a0"==s&&(t.full=this.getGeneralNames(a))}return t},this.getExtCRLDistributionPointsURI=function(){var e=this.getExtInfo("cRLDistributionPoints");if(void 0===e)return e;for(var t=new Array,i=n(this.hex,e.vidx),r=0;r<i.length;r++)try{var o=ie(s(this.hex,i[r],[0,0,0],"86"));t.push(o)}catch(e){}return t},this.getExtAIAInfo=function(){var e=this.getExtInfo("authorityInfoAccess");if(void 0===e)return e;for(var t={ocsp:[],caissuer:[]},i=n(this.hex,e.vidx),r=0;r<i.length;r++){var o=s(this.hex,i[r],[0],"06"),a=s(this.hex,i[r],[1],"86");"2b06010505073001"===o&&t.ocsp.push(ie(a)),"2b06010505073002"===o&&t.caissuer.push(ie(a))}return t},this.getExtAuthorityInfoAccess=function(e,t){if(void 0===e&&void 0===t){var i=this.getExtInfo("authorityInfoAccess");if(void 0===i)return;e=o(this.hex,i.vidx),t=i.critical}var r={extname:"authorityInfoAccess",array:[]};t&&(r.critical=!0);for(var a=n(e,0),u=0;u<a.length;u++){var c=l(e,a[u],[0],"06"),h=ie(s(e,a[u],[1],"86"));if("2b06010505073001"==c)r.array.push({ocsp:h});else{if("2b06010505073002"!=c)throw new Error("unknown method: "+c);r.array.push({caissuer:h})}}return r},this.getExtCertificatePolicies=function(e,t){if(void 0===e&&void 0===t){var i=this.getExtInfo("certificatePolicies");if(void 0===i)return;e=o(this.hex,i.vidx),t=i.critical}var r={extname:"certificatePolicies",array:[]};t&&(r.critical=!0);for(var s=n(e,0),a=0;a<s.length;a++){var l=o(e,s[a]),u=this.getPolicyInformation(l);r.array.push(u)}return r},this.getPolicyInformation=function(e){var t={},i=s(e,0,[0],"06");t.policyoid=A(i);var r=d(e,0,[1],"30");if(-1!=r){t.array=[];for(var a=n(e,r),l=0;l<a.length;l++){var u=o(e,a[l]),c=this.getPolicyQualifierInfo(u);t.array.push(c)}}return t},this.getPolicyQualifierInfo=function(e){var t={},i=s(e,0,[0],"06");if("2b06010505070201"===i){var n=l(e,0,[1],"16");t.cps=ne(n)}else if("2b06010505070202"===i){var r=u(e,0,[1],"30");t.unotice=this.getUserNotice(r)}return t},this.getUserNotice=function(e){for(var t={},i=n(e,0),r=0;r<i.length;r++){var s=o(e,i[r]);"30"!=s.substr(0,2)&&(t.exptext=this.getDisplayText(s))}return t},this.getDisplayText=function(e){var t={};return t.type={"0c":"utf8",16:"ia5","1a":"vis","1e":"bmp"}[e.substr(0,2)],t.str=ne(r(e,0)),t},this.getExtCRLNumber=function(e,t){var i={extname:"cRLNumber"};if(t&&(i.critical=!0),"02"==e.substr(0,2))return i.num={hex:r(e,0)},i;throw new Error("hExtV parse error: "+e)},this.getExtCRLReason=function(e,t){var i={extname:"cRLReason"};if(t&&(i.critical=!0),"0a"==e.substr(0,2))return i.code=parseInt(r(e,0),16),i;throw new Error("hExtV parse error: "+e)},this.getExtOcspNonce=function(e,t){var i={extname:"ocspNonce"};t&&(i.critical=!0);var n=r(e,0);return i.hex=n,i},this.getExtOcspNoCheck=function(e,t){var i={extname:"ocspNoCheck"};return t&&(i.critical=!0),i},this.getExtAdobeTimeStamp=function(e,t){if(void 0===e&&void 0===t){var i=this.getExtInfo("adobeTimeStamp");if(void 0===i)return;e=o(this.hex,i.vidx),t=i.critical}var r={extname:"adobeTimeStamp"};t&&(r.critical=!0);var s=n(e,0);if(s.length>1){var a=o(e,s[1]),l=this.getGeneralName(a);null!=l.uri&&(r.uri=l.uri)}if(s.length>2){var u=o(e,s[2]);"0101ff"==u&&(r.reqauth=!0),"010100"==u&&(r.reqauth=!1)}return r},this.getX500NameRule=function(e){for(var t=null,i=[],n=0;n<e.length;n++)for(var r=e[n],o=0;o<r.length;o++)i.push(r[o]);for(n=0;n<i.length;n++){var s=i[n],l=s.ds,u=s.value,c=s.type;if("prn"!=l&&"utf8"!=l&&"ia5"!=l)return"mixed";if("ia5"==l){if("CN"!=c)return"mixed";if(a.lang.String.isMail(u))continue;return"mixed"}if("C"==c){if("prn"==l)continue;return"mixed"}if(null==t)t=l;else if(t!==l)return"mixed"}return null==t?"prn":t},this.getX500Name=function(e){var t=this.getX500NameArray(e);return{array:t,str:this.dnarraytostr(t)}},this.getX500NameArray=function(e){for(var t=[],i=n(e,0),r=0;r<i.length;r++)t.push(this.getRDN(o(e,i[r])));return t},this.getRDN=function(e){for(var t=[],i=n(e,0),r=0;r<i.length;r++)t.push(this.getAttrTypeAndValue(o(e,i[r])));return t},this.getAttrTypeAndValue=function(e){var t={type:null,value:null,ds:null},i=n(e,0),r=s(e,i[0],[],"06"),o=s(e,i[1],[]),l=a.asn1.ASN1Util.oidHexToInt(r);return t.type=a.asn1.x509.OID.oid2atype(l),t.ds=this.HEX2STAG[e.substr(i[1],2)],"bmp"!=t.ds?t.value=ie(o):t.value=ue(o),t},this.readCertPEM=function(e){this.readCertHex(m(e))},this.readCertHex=function(e){this.hex=e,this.getVersion();try{h(this.hex,0,[0,7],"a3"),this.parseExt()}catch(e){}},this.getParam=function(){var e={};return e.version=this.getVersion(),e.serial={hex:this.getSerialNumberHex()},e.sigalg=this.getSignatureAlgorithmField(),e.issuer=this.getIssuer(),e.notbefore=this.getNotBefore(),e.notafter=this.getNotAfter(),e.subject=this.getSubject(),e.sbjpubkey=se(this.getPublicKeyHex(),"PUBLIC KEY"),this.aExtInfo.length>0&&(e.ext=this.getExtParamArray()),e.sighex=this.getSignatureValueHex(),e},this.getExtParamArray=function(e){null==e&&(-1!=d(this.hex,0,[0,"[3]"])&&(e=c(this.hex,0,[0,"[3]",0],"30")));for(var t=[],i=n(e,0),r=0;r<i.length;r++){var s=o(e,i[r]),a=this.getExtParam(s);null!=a&&t.push(a)}return t},this.getExtParam=function(e){var t=n(e,0).length;if(2!=t&&3!=t)throw new Error("wrong number elements in Extension: "+t+" "+e);var i=g(s(e,0,[0],"06")),r=!1;3==t&&"0101ff"==u(e,0,[1])&&(r=!0);var o=u(e,0,[t-1,0]),a=void 0;if("2.5.29.14"==i?a=this.getExtSubjectKeyIdentifier(o,r):"2.5.29.15"==i?a=this.getExtKeyUsage(o,r):"2.5.29.17"==i?a=this.getExtSubjectAltName(o,r):"2.5.29.18"==i?a=this.getExtIssuerAltName(o,r):"2.5.29.19"==i?a=this.getExtBasicConstraints(o,r):"2.5.29.31"==i?a=this.getExtCRLDistributionPoints(o,r):"2.5.29.32"==i?a=this.getExtCertificatePolicies(o,r):"2.5.29.35"==i?a=this.getExtAuthorityKeyIdentifier(o,r):"2.5.29.37"==i?a=this.getExtExtKeyUsage(o,r):"1.3.6.1.5.5.7.1.1"==i?a=this.getExtAuthorityInfoAccess(o,r):"2.5.29.20"==i?a=this.getExtCRLNumber(o,r):"2.5.29.21"==i?a=this.getExtCRLReason(o,r):"1.3.6.1.5.5.7.48.1.2"==i?a=this.getExtOcspNonce(o,r):"1.3.6.1.5.5.7.48.1.5"==i?a=this.getExtOcspNoCheck(o,r):"1.2.840.113583.1.1.9.1"==i&&(a=this.getExtAdobeTimeStamp(o,r)),null!=a)return a;var l={extname:i,extn:o};return r&&(l.critical=!0),l},this.findExt=function(e,t){for(var i=0;i<e.length;i++)if(e[i].extname==t)return e[i];return null},this.updateExtCDPFullURI=function(e,t){var i=this.findExt(e,"cRLDistributionPoints");if(null!=i&&null!=i.array)for(var n=i.array,r=0;r<n.length;r++)if(null!=n[r].dpname&&null!=n[r].dpname.full)for(var o=n[r].dpname.full,s=0;s<o.length;s++){var a=o[r];null!=a.uri&&(a.uri=t)}},this.updateExtAIAOCSP=function(e,t){var i=this.findExt(e,"authorityInfoAccess");if(null!=i&&null!=i.array)for(var n=i.array,r=0;r<n.length;r++)null!=n[r].ocsp&&(n[r].ocsp=t)},this.updateExtAIACAIssuer=function(e,t){var i=this.findExt(e,"authorityInfoAccess");if(null!=i&&null!=i.array)for(var n=i.array,r=0;r<n.length;r++)null!=n[r].caissuer&&(n[r].caissuer=t)},this.dnarraytostr=function(e){return"/"+e.map((function(e){return function(e){return e.map((function(e){return function(e){return e.type+"="+e.value}(e).replace(/\+/,"\\+")})).join("+")}(e).replace(/\//,"\\/")})).join("/")},this.getInfo=function(){var e,t,i,n,r=function(e){for(var t="",i=e.array,n=0;n<i.length;n++){var r=i[n];if(t+=" policy oid: "+r.policyoid+"\n",void 0!==r.array)for(var o=0;o<r.array.length;o++){var s=r.array[o];void 0!==s.cps&&(t+=" cps: "+s.cps+"\n")}}return t},o=function(e){for(var t="",i=e.array,n=0;n<i.length;n++){var r=i[n];try{void 0!==r.dpname.full[0].uri&&(t+=" "+r.dpname.full[0].uri+"\n")}catch(e){}try{void 0!==r.dname.full[0].dn.hex&&(t+=" "+Ie.hex2dn(r.dpname.full[0].dn.hex)+"\n")}catch(e){}}return t},s=function(e){for(var t="",i=e.array,n=0;n<i.length;n++){var r=i[n];void 0!==r.caissuer&&(t+=" caissuer: "+r.caissuer+"\n"),void 0!==r.ocsp&&(t+=" ocsp: "+r.ocsp+"\n")}return t};if(e="Basic Fields\n",e+=" serial number: "+this.getSerialNumberHex()+"\n",e+=" signature algorithm: "+this.getSignatureAlgorithmField()+"\n",e+=" issuer: "+this.getIssuerString()+"\n",e+=" notBefore: "+this.getNotBefore()+"\n",e+=" notAfter: "+this.getNotAfter()+"\n",e+=" subject: "+this.getSubjectString()+"\n",e+=" subject public key info: \n",e+=" key algorithm: "+(t=this.getPublicKey()).type+"\n","RSA"===t.type&&(e+=" n="+he(t.n.toString(16)).substr(0,16)+"...\n",e+=" e="+he(t.e.toString(16))+"\n"),null!=(i=this.aExtInfo)){e+="X509v3 Extensions:\n";for(var l=0;l<i.length;l++){var u=i[l],c=a.asn1.x509.OID.oid2name(u.oid);""===c&&(c=u.oid);var h="";if(!0===u.critical&&(h="CRITICAL"),e+=" "+c+" "+h+":\n","basicConstraints"===c){var d=this.getExtBasicConstraints();void 0===d.cA?e+=" {}\n":(e+=" cA=true",void 0!==d.pathLen&&(e+=", pathLen="+d.pathLen),e+="\n")}else if("keyUsage"===c)e+=" "+this.getExtKeyUsageString()+"\n";else if("subjectKeyIdentifier"===c)e+=" "+this.getExtSubjectKeyIdentifier().kid.hex+"\n";else if("authorityKeyIdentifier"===c){var p=this.getExtAuthorityKeyIdentifier();void 0!==p.kid&&(e+=" kid="+p.kid.hex+"\n")}else{if("extKeyUsage"===c)e+=" "+this.getExtExtKeyUsage().array.join(", ")+"\n";else if("subjectAltName"===c)e+=" "+(n=this.getExtSubjectAltName(),JSON.stringify(n.array).replace(/[\[\]\{\}\"]/g,""))+"\n";else if("cRLDistributionPoints"===c)e+=o(this.getExtCRLDistributionPoints());else if("authorityInfoAccess"===c)e+=s(this.getExtAuthorityInfoAccess());else"certificatePolicies"===c&&(e+=r(this.getExtCertificatePolicies()))}}}return e+="signature algorithm: "+this.getSignatureAlgorithmName()+"\n",e+="signature: "+this.getSignatureValueHex().substr(0,16)+"...\n"},"string"==typeof e&&(-1!=e.indexOf("-----BEGIN")?this.readCertPEM(e):a.lang.String.isHex(e)&&this.readCertHex(e))}function Be(e){return u.SHA256(e).toString()}Me.getLblen=function(e,t){if("8"!=e.substr(t+2,1))return 1;var i=parseInt(e.substr(t+3,1));return 0==i?-1:0<i&&i<10?i+1:-2},Me.getL=function(e,t){var i=Me.getLblen(e,t);return i<1?"":e.substr(t+2,2*i)},Me.getVblen=function(e,t){var i;return""==(i=Me.getL(e,t))?-1:("8"===i.substr(0,1)?new c(i.substr(2),16):new c(i,16)).intValue()},Me.getVidx=function(e,t){var i=Me.getLblen(e,t);return i<0?i:t+2*(i+1)},Me.getV=function(e,t){var i=Me.getVidx(e,t),n=Me.getVblen(e,t);return e.substr(i,2*n)},Me.getTLV=function(e,t){return e.substr(t,2)+Me.getL(e,t)+Me.getV(e,t)},Me.getTLVblen=function(e,t){return 2+2*Me.getLblen(e,t)+2*Me.getVblen(e,t)},Me.getNextSiblingIdx=function(e,t){return Me.getVidx(e,t)+2*Me.getVblen(e,t)},Me.getChildIdx=function(e,t){var i,n,r,o=Me,s=[];i=o.getVidx(e,t),n=2*o.getVblen(e,t),"03"==e.substr(t,2)&&(i+=2,n-=2),r=0;for(var a=i;r<=n;){var l=o.getTLVblen(e,a);if((r+=l)<=n&&s.push(a),a+=l,r>=n)break}return s},Me.getNthChildIdx=function(e,t,i){return Me.getChildIdx(e,t)[i]},Me.getIdxbyList=function(e,t,i,n){var r,o,s=Me;return 0==i.length?void 0!==n&&e.substr(t,2)!==n?-1:t:(r=i.shift())>=(o=s.getChildIdx(e,t)).length?-1:s.getIdxbyList(e,o[r],i,n)},Me.getIdxbyListEx=function(e,t,i,n){var r,o,s=Me;if(0==i.length)return void 0!==n&&e.substr(t,2)!==n?-1:t;r=i.shift(),o=s.getChildIdx(e,t);for(var a=0,l=0;l<o.length;l++){var u=e.substr(o[l],2);if("number"==typeof r&&!s.isContextTag(u)&&a==r||"string"==typeof r&&s.isContextTag(u,r))return s.getIdxbyListEx(e,o[l],i,n);s.isContextTag(u)||a++}return-1},Me.getTLVbyList=function(e,t,i,n){var r=Me,o=r.getIdxbyList(e,t,i,n);return-1==o||o>=e.length?null:r.getTLV(e,o)},Me.getTLVbyListEx=function(e,t,i,n){var r=Me,o=r.getIdxbyListEx(e,t,i,n);return-1==o?null:r.getTLV(e,o)},Me.getVbyList=function(e,t,i,n,r){var o,s,a=Me;return-1==(o=a.getIdxbyList(e,t,i,n))||o>=e.length?null:(s=a.getV(e,o),!0===r&&(s=s.substr(2)),s)},Me.getVbyListEx=function(e,t,i,n,r){var o,s,a=Me;return-1==(o=a.getIdxbyListEx(e,t,i,n))?null:(s=a.getV(e,o),"03"==e.substr(o,2)&&!1!==r&&(s=s.substr(2)),s)},Me.getInt=function(e,t,i){null==i&&(i=-1);try{var n=e.substr(t,2);if("02"!=n&&"03"!=n)return i;var r=Me.getV(e,t);return"02"==n?parseInt(r,16):function(e){try{var t=e.substr(0,2);if("00"==t)return parseInt(e.substr(2),16);var i=parseInt(t,16),n=e.substr(2),r=parseInt(n,16).toString(2);return"0"==r&&(r="00000000"),r=r.slice(0,0-i),parseInt(r,2)}catch(e){return-1}}(r)}catch(e){return i}},Me.getOID=function(e,t,i){null==i&&(i=null);try{return"06"!=e.substr(t,2)?i:function(e){if(!ce(e))return null;try{var t=[],i=e.substr(0,2),n=parseInt(i,16);t[0]=new String(Math.floor(n/40)),t[1]=new String(n%40);for(var r=e.substr(2),o=[],s=0;s<r.length/2;s++)o.push(parseInt(r.substr(2*s,2),16));var a=[],l="";for(s=0;s<o.length;s++)128&o[s]?l+=de((127&o[s]).toString(2),7):(l+=de((127&o[s]).toString(2),7),a.push(new String(parseInt(l,2))),l="");var u=t.join(".");return a.length>0&&(u=u+"."+a.join(".")),u}catch(e){return null}}(Me.getV(e,t))}catch(e){return i}},Me.getOIDName=function(e,t,i){null==i&&(i=null);try{var n=Me.getOID(e,t,i);if(n==i)return i;var r=a.asn1.x509.OID.oid2name(n);return""==r?n:r}catch(e){return i}},Me.getString=function(e,t,i){null==i&&(i=null);try{return ne(Me.getV(e,t))}catch(e){return i}},Me.hextooidstr=function(e){var t=function(e,t){return e.length>=t?e:new Array(t-e.length+1).join("0")+e},i=[],n=e.substr(0,2),r=parseInt(n,16);i[0]=new String(Math.floor(r/40)),i[1]=new String(r%40);for(var o=e.substr(2),s=[],a=0;a<o.length/2;a++)s.push(parseInt(o.substr(2*a,2),16));var l=[],u="";for(a=0;a<s.length;a++)128&s[a]?u+=t((127&s[a]).toString(2),7):(u+=t((127&s[a]).toString(2),7),l.push(new String(parseInt(u,2))),u="");var c=i.join(".");return l.length>0&&(c=c+"."+l.join(".")),c},Me.dump=function(e,t,i,n){var r=Me,o=r.getV,s=r.dump,l=r.getChildIdx,u=e;e instanceof a.asn1.ASN1Object&&(u=e.getEncodedHex());var c=function(e,t){return e.length<=2*t?e:e.substr(0,t)+"..(total "+e.length/2+"bytes).."+e.substr(e.length-t,t)};void 0===t&&(t={ommit_long_octet:32}),void 0===i&&(i=0),void 0===n&&(n="");var h,d=t.ommit_long_octet;if("01"==(h=u.substr(i,2)))return"00"==(p=o(u,i))?n+"BOOLEAN FALSE\n":n+"BOOLEAN TRUE\n";if("02"==h)return n+"INTEGER "+c(p=o(u,i),d)+"\n";if("03"==h){var p=o(u,i);if(r.isASN1HEX(p.substr(2))){var f=n+"BITSTRING, encapsulates\n";return f+=s(p.substr(2),t,0,n+" ")}return n+"BITSTRING "+c(p,d)+"\n"}if("04"==h){p=o(u,i);if(r.isASN1HEX(p)){f=n+"OCTETSTRING, encapsulates\n";return f+=s(p,t,0,n+" ")}return n+"OCTETSTRING "+c(p,d)+"\n"}if("05"==h)return n+"NULL\n";if("06"==h){var A=o(u,i),g=a.asn1.ASN1Util.oidHexToInt(A),m=a.asn1.x509.OID.oid2name(g),v=g.replace(/\./g," ");return""!=m?n+"ObjectIdentifier "+m+" ("+v+")\n":n+"ObjectIdentifier ("+v+")\n"}if("0a"==h)return n+"ENUMERATED "+parseInt(o(u,i))+"\n";if("0c"==h)return n+"UTF8String '"+ie(o(u,i))+"'\n";if("13"==h)return n+"PrintableString '"+ie(o(u,i))+"'\n";if("14"==h)return n+"TeletexString '"+ie(o(u,i))+"'\n";if("16"==h)return n+"IA5String '"+ie(o(u,i))+"'\n";if("17"==h)return n+"UTCTime "+ie(o(u,i))+"\n";if("18"==h)return n+"GeneralizedTime "+ie(o(u,i))+"\n";if("1a"==h)return n+"VisualString '"+ie(o(u,i))+"'\n";if("1e"==h)return n+"BMPString '"+ue(o(u,i))+"'\n";if("30"==h){if("3000"==u.substr(i,4))return n+"SEQUENCE {}\n";f=n+"SEQUENCE\n";var y=t;if((2==(w=l(u,i)).length||3==w.length)&&"06"==u.substr(w[0],2)&&"04"==u.substr(w[w.length-1],2)){m=r.oidname(o(u,w[0]));var b=JSON.parse(JSON.stringify(t));b.x509ExtName=m,y=b}for(var x=0;x<w.length;x++)f+=s(u,y,w[x],n+" ");return f}if("31"==h){f=n+"SET\n";var w=l(u,i);for(x=0;x<w.length;x++)f+=s(u,t,w[x],n+" ");return f}if(0!=(128&(h=parseInt(h,16)))){var M=31&h;if(0!=(32&h)){for(f=n+"["+M+"]\n",w=l(u,i),x=0;x<w.length;x++)f+=s(u,t,w[x],n+" ");return f}p=o(u,i);if(Me.isASN1HEX(p)){var f=n+"["+M+"]\n";return f+=s(p,t,0,n+" ")}return("68747470"==p.substr(0,8)||"subjectAltName"===t.x509ExtName&&2==M)&&(p=ie(p)),f=n+"["+M+"] "+p+"\n"}return n+"UNKNOWN("+h+") "+o(u,i)+"\n"},Me.isContextTag=function(e,t){var i,n;e=e.toLowerCase();try{i=parseInt(e,16)}catch(e){return-1}if(void 0===t)return 128==(192&i);try{return null!=t.match(/^\[[0-9]+\]$/)&&(!((n=parseInt(t.substr(1,t.length-1),10))>31)&&(128==(192&i)&&(31&i)==n))}catch(e){return!1}},Me.isASN1HEX=function(e){var t=Me;if(e.length%2==1)return!1;var i=t.getVblen(e,0),n=e.substr(0,2),r=t.getL(e,0);return e.length-n.length-r.length==2*i},Me.checkStrictDER=function(e,t,i,n,r){var o=Me;if(void 0===i){if("string"!=typeof e)throw new Error("not hex string");if(e=e.toLowerCase(),!a.lang.String.isHex(e))throw new Error("not hex string");i=e.length,r=(n=e.length/2)<128?1:Math.ceil(n.toString(16))+1}if(o.getL(e,t).length>2*r)throw new Error("L of TLV too long: idx="+t);var s=o.getVblen(e,t);if(s>n)throw new Error("value of L too long than hex: idx="+t);var l=o.getTLV(e,t),u=l.length-2-o.getL(e,t).length;if(u!==2*s)throw new Error("V string length and L's value not the same:"+u+"/"+2*s);if(0===t&&e.length!=l.length)throw new Error("total length and TLV length unmatch:"+e.length+"!="+l.length);var c=e.substr(t,2);if("02"===c){var h=o.getVidx(e,t);if("00"==e.substr(h,2)&&e.charCodeAt(h+2)<56)throw new Error("not least zeros for DER INTEGER")}if(32&parseInt(c,16)){for(var d=o.getVblen(e,t),p=0,f=o.getChildIdx(e,t),A=0;A<f.length;A++){p+=o.getTLV(e,f[A]).length,o.checkStrictDER(e,f[A],i,n,r)}if(2*d!=p)throw new Error("sum of children's TLV length and L unmatch: "+2*d+"!="+p)}},Me.oidname=function(e){var t=a.asn1;a.lang.String.isHex(e)&&(e=t.ASN1Util.oidHexToInt(e));var i=t.x509.OID.oid2name(e);return""===i&&(i=e),i},void 0!==a.asn1&&a.asn1||(a.asn1={}),void 0!==a.asn1.x509&&a.asn1.x509||(a.asn1.x509={}),a.asn1.x509.Certificate=function(e){a.asn1.x509.Certificate.superclass.constructor.call(this);var t=a.asn1,i=t.DERBitString,n=t.DERSequence,r=t.x509,o=r.TBSCertificate,s=r.AlgorithmIdentifier;this.params=void 0,this.setByParam=function(e){this.params=e},this.sign=function(){var e=this.params,t=e.sigalg;null!=e.sigalg.name&&(t=e.sigalg.name);var i=e.tbsobj.getEncodedHex(),n=new a.crypto.Signature({alg:t});n.init(e.cakey),n.updateHex(i),e.sighex=n.sign()},this.getPEM=function(){return se(this.getEncodedHex(),"CERTIFICATE")},this.getEncodedHex=function(){var e=this.params;if(null!=e.tbsobj&&null!=e.tbsobj||(e.tbsobj=new o(e)),null==e.sighex&&null!=e.cakey&&this.sign(),null==e.sighex)throw new Error("sighex or cakey parameter not defined");var t=[];return t.push(e.tbsobj),t.push(new s({name:e.sigalg})),t.push(new i({hex:"00"+e.sighex})),new n({array:t}).getEncodedHex()},null!=e&&(this.params=e)},pe(a.asn1.x509.Certificate,a.asn1.ASN1Object),a.asn1.x509.TBSCertificate=function(e){a.asn1.x509.TBSCertificate.superclass.constructor.call(this);var t=a.asn1,i=t.x509,n=t.DERTaggedObject,r=t.DERInteger,o=t.DERSequence,s=i.AlgorithmIdentifier,l=i.Time,u=i.X500Name,c=i.Extensions,h=i.SubjectPublicKeyInfo;this.params=null,this.setByParam=function(e){this.params=e},this.getEncodedHex=function(){var e=[],t=this.params;if(null!=t.version||1!=t.version){var i=2;null!=t.version&&(i=t.version-1);var d=new n({obj:new r({int:i})});e.push(d)}return e.push(new r(t.serial)),e.push(new s({name:t.sigalg})),e.push(new u(t.issuer)),e.push(new o({array:[new l(t.notbefore),new l(t.notafter)]})),e.push(new u(t.subject)),e.push(new h(we.getKey(t.sbjpubkey))),void 0!==t.ext&&t.ext.length>0&&e.push(new n({tag:"a3",obj:new c(t.ext)})),new a.asn1.DERSequence({array:e}).getEncodedHex()},void 0!==e&&this.setByParam(e)},pe(a.asn1.x509.TBSCertificate,a.asn1.ASN1Object),a.asn1.x509.Extensions=function(e){a.asn1.x509.Extensions.superclass.constructor.call(this);var t=a.asn1,i=t.DERSequence,n=t.x509;this.aParam=[],this.setByParam=function(e){this.aParam=e},this.getEncodedHex=function(){for(var e=[],t=0;t<this.aParam.length;t++){var r=this.aParam[t],o=r.extname,s=null;if(null!=r.extn)s=new n.PrivateExtension(r);else if("subjectKeyIdentifier"==o)s=new n.SubjectKeyIdentifier(r);else if("keyUsage"==o)s=new n.KeyUsage(r);else if("subjectAltName"==o)s=new n.SubjectAltName(r);else if("issuerAltName"==o)s=new n.IssuerAltName(r);else if("basicConstraints"==o)s=new n.BasicConstraints(r);else if("cRLDistributionPoints"==o)s=new n.CRLDistributionPoints(r);else if("certificatePolicies"==o)s=new n.CertificatePolicies(r);else if("authorityKeyIdentifier"==o)s=new n.AuthorityKeyIdentifier(r);else if("extKeyUsage"==o)s=new n.ExtKeyUsage(r);else if("authorityInfoAccess"==o)s=new n.AuthorityInfoAccess(r);else if("cRLNumber"==o)s=new n.CRLNumber(r);else if("cRLReason"==o)s=new n.CRLReason(r);else if("ocspNonce"==o)s=new n.OCSPNonce(r);else if("ocspNoCheck"==o)s=new n.OCSPNoCheck(r);else if("adobeTimeStamp"==o)s=new n.AdobeTimeStamp(r);else{if("subjectDirectoryAttributes"!=o)throw new Error("extension not supported:"+JSON.stringify(r));s=new n.SubjectDirectoryAttributes(r)}null!=s&&e.push(s)}return new i({array:e}).getEncodedHex()},null!=e&&this.setByParam(e)},pe(a.asn1.x509.Extensions,a.asn1.ASN1Object),a.asn1.x509.Extension=function(e){a.asn1.x509.Extension.superclass.constructor.call(this);var t=a.asn1,i=t.DERObjectIdentifier,n=t.DEROctetString;t.DERBitString;var r=t.DERBoolean,o=t.DERSequence;this.getEncodedHex=function(){var e=new i({oid:this.oid}),t=new n({hex:this.getExtnValueHex()}),s=new Array;return s.push(e),this.critical&&s.push(new r),s.push(t),new o({array:s}).getEncodedHex()},this.critical=!1,void 0!==e&&void 0!==e.critical&&(this.critical=e.critical)},pe(a.asn1.x509.Extension,a.asn1.ASN1Object),a.asn1.x509.KeyUsage=function(e){a.asn1.x509.KeyUsage.superclass.constructor.call(this,e);var t=Ie.KEYUSAGE_NAME;if(this.getExtnValueHex=function(){return this.asn1ExtnValue.getEncodedHex()},this.oid="2.5.29.15",void 0!==e&&(void 0!==e.bin&&(this.asn1ExtnValue=new a.asn1.DERBitString(e)),void 0!==e.names&&void 0!==e.names.length)){for(var i=e.names,n="000000000",r=0;r<i.length;r++)for(var o=0;o<t.length;o++)i[r]===t[o]&&(n=n.substring(0,o)+"1"+n.substring(o+1,n.length));this.asn1ExtnValue=new a.asn1.DERBitString({bin:n})}},pe(a.asn1.x509.KeyUsage,a.asn1.x509.Extension),a.asn1.x509.BasicConstraints=function(e){a.asn1.x509.BasicConstraints.superclass.constructor.call(this,e);var t=a.asn1,i=t.DERBoolean,n=t.DERInteger,r=t.DERSequence;this.getExtnValueHex=function(){var e=new Array;this.cA&&e.push(new i),this.pathLen>-1&&e.push(new n({int:this.pathLen}));var t=new r({array:e});return this.asn1ExtnValue=t,this.asn1ExtnValue.getEncodedHex()},this.oid="2.5.29.19",this.cA=!1,this.pathLen=-1,void 0!==e&&(void 0!==e.cA&&(this.cA=e.cA),void 0!==e.pathLen&&(this.pathLen=e.pathLen))},pe(a.asn1.x509.BasicConstraints,a.asn1.x509.Extension),a.asn1.x509.CRLDistributionPoints=function(e){a.asn1.x509.CRLDistributionPoints.superclass.constructor.call(this,e);var t=a.asn1,i=t.x509;this.getExtnValueHex=function(){return this.asn1ExtnValue.getEncodedHex()},this.setByDPArray=function(e){for(var n=[],r=0;r<e.length;r++)if(e[r]instanceof a.asn1.ASN1Object)n.push(e[r]);else{var o=new i.DistributionPoint(e[r]);n.push(o)}this.asn1ExtnValue=new t.DERSequence({array:n})},this.setByOneURI=function(e){var t=new i.DistributionPoint({fulluri:e});this.setByDPArray([t])},this.oid="2.5.29.31",void 0!==e&&(void 0!==e.array?this.setByDPArray(e.array):void 0!==e.uri&&this.setByOneURI(e.uri))},pe(a.asn1.x509.CRLDistributionPoints,a.asn1.x509.Extension),a.asn1.x509.DistributionPoint=function(e){a.asn1.x509.DistributionPoint.superclass.constructor.call(this);var t=a.asn1,i=t.x509.DistributionPointName;this.getEncodedHex=function(){var e=new t.DERSequence;if(null!=this.asn1DP){var i=new t.DERTaggedObject({explicit:!0,tag:"a0",obj:this.asn1DP});e.appendASN1Object(i)}return this.hTLV=e.getEncodedHex(),this.hTLV},void 0!==e&&(void 0!==e.dpobj?this.asn1DP=e.dpobj:void 0!==e.dpname?this.asn1DP=new i(e.dpname):void 0!==e.fulluri&&(this.asn1DP=new i({full:[{uri:e.fulluri}]})))},pe(a.asn1.x509.DistributionPoint,a.asn1.ASN1Object),a.asn1.x509.DistributionPointName=function(e){a.asn1.x509.DistributionPointName.superclass.constructor.call(this);var t=a.asn1,i=t.DERTaggedObject;if(this.getEncodedHex=function(){if("full"!=this.type)throw new Error("currently type shall be 'full': "+this.type);return this.asn1Obj=new i({explicit:!1,tag:this.tag,obj:this.asn1V}),this.hTLV=this.asn1Obj.getEncodedHex(),this.hTLV},void 0!==e)if(t.x509.GeneralNames.prototype.isPrototypeOf(e))this.type="full",this.tag="a0",this.asn1V=e;else{if(void 0===e.full)throw new Error("This class supports GeneralNames only as argument");this.type="full",this.tag="a0",this.asn1V=new t.x509.GeneralNames(e.full)}},pe(a.asn1.x509.DistributionPointName,a.asn1.ASN1Object),a.asn1.x509.CertificatePolicies=function(e){a.asn1.x509.CertificatePolicies.superclass.constructor.call(this,e);var t=a.asn1,i=t.x509,n=t.DERSequence,r=i.PolicyInformation;this.params=null,this.getExtnValueHex=function(){for(var e=[],t=0;t<this.params.array.length;t++)e.push(new r(this.params.array[t]));var i=new n({array:e});return this.asn1ExtnValue=i,this.asn1ExtnValue.getEncodedHex()},this.oid="2.5.29.32",void 0!==e&&(this.params=e)},pe(a.asn1.x509.CertificatePolicies,a.asn1.x509.Extension),a.asn1.x509.PolicyInformation=function(e){a.asn1.x509.PolicyInformation.superclass.constructor.call(this,e);var t=a.asn1,i=t.DERSequence,n=t.DERObjectIdentifier,r=t.x509.PolicyQualifierInfo;this.params=null,this.getEncodedHex=function(){if(void 0===this.params.policyoid&&void 0===this.params.array)throw new Error("parameter oid and array missing");var e=[new n(this.params.policyoid)];if(void 0!==this.params.array){for(var t=[],o=0;o<this.params.array.length;o++)t.push(new r(this.params.array[o]));t.length>0&&e.push(new i({array:t}))}return new i({array:e}).getEncodedHex()},void 0!==e&&(this.params=e)},pe(a.asn1.x509.PolicyInformation,a.asn1.ASN1Object),a.asn1.x509.PolicyQualifierInfo=function(e){a.asn1.x509.PolicyQualifierInfo.superclass.constructor.call(this,e);var t=a.asn1,i=t.DERSequence,n=t.DERIA5String,r=t.DERObjectIdentifier,o=t.x509.UserNotice;this.params=null,this.getEncodedHex=function(){return void 0!==this.params.cps?new i({array:[new r({oid:"1.3.6.1.5.5.7.2.1"}),new n({str:this.params.cps})]}).getEncodedHex():null!=this.params.unotice?new i({array:[new r({oid:"1.3.6.1.5.5.7.2.2"}),new o(this.params.unotice)]}).getEncodedHex():void 0},void 0!==e&&(this.params=e)},pe(a.asn1.x509.PolicyQualifierInfo,a.asn1.ASN1Object),a.asn1.x509.UserNotice=function(e){a.asn1.x509.UserNotice.superclass.constructor.call(this,e);var t=a.asn1.DERSequence;a.asn1.DERInteger;var i=a.asn1.x509.DisplayText,n=a.asn1.x509.NoticeReference;this.params=null,this.getEncodedHex=function(){var e=[];return void 0!==this.params.noticeref&&e.push(new n(this.params.noticeref)),void 0!==this.params.exptext&&e.push(new i(this.params.exptext)),new t({array:e}).getEncodedHex()},void 0!==e&&(this.params=e)},pe(a.asn1.x509.UserNotice,a.asn1.ASN1Object),a.asn1.x509.NoticeReference=function(e){a.asn1.x509.NoticeReference.superclass.constructor.call(this,e);var t=a.asn1.DERSequence,i=a.asn1.DERInteger,n=a.asn1.x509.DisplayText;this.params=null,this.getEncodedHex=function(){var e=[];if(void 0!==this.params.org&&e.push(new n(this.params.org)),void 0!==this.params.noticenum){for(var r=[],o=this.params.noticenum,s=0;s<o.length;s++)r.push(new i(o[s]));e.push(new t({array:r}))}if(0==e.length)throw new Error("parameter is empty");return new t({array:e}).getEncodedHex()},void 0!==e&&(this.params=e)},pe(a.asn1.x509.NoticeReference,a.asn1.ASN1Object),a.asn1.x509.DisplayText=function(e){a.asn1.x509.DisplayText.superclass.constructor.call(this,e),this.hT="0c",void 0!==e&&("ia5"===e.type?this.hT="16":"vis"===e.type?this.hT="1a":"bmp"===e.type&&(this.hT="1e"))},pe(a.asn1.x509.DisplayText,a.asn1.DERAbstractString),a.asn1.x509.ExtKeyUsage=function(e){a.asn1.x509.ExtKeyUsage.superclass.constructor.call(this,e);var t=a.asn1;this.setPurposeArray=function(e){this.asn1ExtnValue=new t.DERSequence;for(var i=0;i<e.length;i++){var n=new t.DERObjectIdentifier(e[i]);this.asn1ExtnValue.appendASN1Object(n)}},this.getExtnValueHex=function(){return this.asn1ExtnValue.getEncodedHex()},this.oid="2.5.29.37",void 0!==e&&void 0!==e.array&&this.setPurposeArray(e.array)},pe(a.asn1.x509.ExtKeyUsage,a.asn1.x509.Extension),a.asn1.x509.AuthorityKeyIdentifier=function(e){a.asn1.x509.AuthorityKeyIdentifier.superclass.constructor.call(this,e);var t=a,i=t.asn1,n=i.DERTaggedObject,r=i.x509.GeneralNames;t.crypto.Util.isKey,this.asn1KID=null,this.asn1CertIssuer=null,this.asn1CertSN=null,this.getExtnValueHex=function(){var e=new Array;this.asn1KID&&e.push(new n({explicit:!1,tag:"80",obj:this.asn1KID})),this.asn1CertIssuer&&e.push(new n({explicit:!1,tag:"a1",obj:new r([{dn:this.asn1CertIssuer}])})),this.asn1CertSN&&e.push(new n({explicit:!1,tag:"82",obj:this.asn1CertSN}));var t=new i.DERSequence({array:e});return this.asn1ExtnValue=t,this.asn1ExtnValue.getEncodedHex()},this.setKIDByParam=function(e){if(void 0!==e.str||void 0!==e.hex)this.asn1KID=new a.asn1.DEROctetString(e);else if("object"==typeof e&&a.crypto.Util.isKey(e)||"string"==typeof e&&-1!=e.indexOf("BEGIN ")){var t=e;"string"==typeof e&&(t=we.getKey(e));var i=we.getKeyID(t);this.asn1KID=new a.asn1.DEROctetString({hex:i})}},this.setCertIssuerByParam=function(e){void 0!==e.str||void 0!==e.ldapstr||void 0!==e.hex||void 0!==e.certsubject||void 0!==e.certissuer?this.asn1CertIssuer=new a.asn1.x509.X500Name(e):"string"==typeof e&&-1!=e.indexOf("BEGIN ")&&-1!=e.indexOf("CERTIFICATE")&&(this.asn1CertIssuer=new a.asn1.x509.X500Name({certissuer:e}))},this.setCertSNByParam=function(e){if(void 0!==e.str||void 0!==e.bigint||void 0!==e.hex)this.asn1CertSN=new a.asn1.DERInteger(e);else if("string"==typeof e&&-1!=e.indexOf("BEGIN ")&&e.indexOf("CERTIFICATE")){var t=new Ie;t.readCertPEM(e);var i=t.getSerialNumberHex();this.asn1CertSN=new a.asn1.DERInteger({hex:i})}},this.oid="2.5.29.35",void 0!==e&&(void 0!==e.kid&&this.setKIDByParam(e.kid),void 0!==e.issuer&&this.setCertIssuerByParam(e.issuer),void 0!==e.sn&&this.setCertSNByParam(e.sn),void 0!==e.issuersn&&"string"==typeof e.issuersn&&-1!=e.issuersn.indexOf("BEGIN ")&&e.issuersn.indexOf("CERTIFICATE")&&(this.setCertSNByParam(e.issuersn),this.setCertIssuerByParam(e.issuersn)))},pe(a.asn1.x509.AuthorityKeyIdentifier,a.asn1.x509.Extension),a.asn1.x509.SubjectKeyIdentifier=function(e){a.asn1.x509.SubjectKeyIdentifier.superclass.constructor.call(this,e);var t=a.asn1.DEROctetString;this.asn1KID=null,this.getExtnValueHex=function(){return this.asn1ExtnValue=this.asn1KID,this.asn1ExtnValue.getEncodedHex()},this.setKIDByParam=function(e){if(void 0!==e.str||void 0!==e.hex)this.asn1KID=new t(e);else if("object"==typeof e&&a.crypto.Util.isKey(e)||"string"==typeof e&&-1!=e.indexOf("BEGIN")){var i=e;"string"==typeof e&&(i=we.getKey(e));var n=we.getKeyID(i);this.asn1KID=new a.asn1.DEROctetString({hex:n})}},this.oid="2.5.29.14",void 0!==e&&void 0!==e.kid&&this.setKIDByParam(e.kid)},pe(a.asn1.x509.SubjectKeyIdentifier,a.asn1.x509.Extension),a.asn1.x509.AuthorityInfoAccess=function(e){a.asn1.x509.AuthorityInfoAccess.superclass.constructor.call(this,e),this.setAccessDescriptionArray=function(e){for(var t=new Array,i=a.asn1,n=i.DERSequence,r=i.DERObjectIdentifier,o=i.x509.GeneralName,s=0;s<e.length;s++){var l,u=e[s];if(void 0!==u.ocsp)l=new n({array:[new r({oid:"1.3.6.1.5.5.7.48.1"}),new o({uri:u.ocsp})]});else{if(void 0===u.caissuer)throw new Error("unknown AccessMethod parameter: "+JSON.stringify(u));l=new n({array:[new r({oid:"1.3.6.1.5.5.7.48.2"}),new o({uri:u.caissuer})]})}t.push(l)}this.asn1ExtnValue=new n({array:t})},this.getExtnValueHex=function(){return this.asn1ExtnValue.getEncodedHex()},this.oid="1.3.6.1.5.5.7.1.1",void 0!==e&&void 0!==e.array&&this.setAccessDescriptionArray(e.array)},pe(a.asn1.x509.AuthorityInfoAccess,a.asn1.x509.Extension),a.asn1.x509.SubjectAltName=function(e){a.asn1.x509.SubjectAltName.superclass.constructor.call(this,e),this.setNameArray=function(e){this.asn1ExtnValue=new a.asn1.x509.GeneralNames(e)},this.getExtnValueHex=function(){return this.asn1ExtnValue.getEncodedHex()},this.oid="2.5.29.17",void 0!==e&&void 0!==e.array&&this.setNameArray(e.array)},pe(a.asn1.x509.SubjectAltName,a.asn1.x509.Extension),a.asn1.x509.IssuerAltName=function(e){a.asn1.x509.IssuerAltName.superclass.constructor.call(this,e),this.setNameArray=function(e){this.asn1ExtnValue=new a.asn1.x509.GeneralNames(e)},this.getExtnValueHex=function(){return this.asn1ExtnValue.getEncodedHex()},this.oid="2.5.29.18",void 0!==e&&void 0!==e.array&&this.setNameArray(e.array)},pe(a.asn1.x509.IssuerAltName,a.asn1.x509.Extension),a.asn1.x509.SubjectDirectoryAttributes=function(e){a.asn1.x509.SubjectDirectoryAttributes.superclass.constructor.call(this,e);var t=a.asn1,i=t.DERSequence,n=t.ASN1Util.newObject,r=t.x509.OID.name2oid;this.params=null,this.getExtnValueHex=function(){for(var e=[],t=0;t<this.params.array.length;t++){var o=this.params.array[t],s={seq:[{oid:"1.2.3.4"},{set:[{utf8str:"DE"}]}]};if("dateOfBirth"==o.attr)s.seq[0].oid=r(o.attr),s.seq[1].set[0]={gentime:o.str};else if("placeOfBirth"==o.attr)s.seq[0].oid=r(o.attr),s.seq[1].set[0]={utf8str:o.str};else if("gender"==o.attr)s.seq[0].oid=r(o.attr),s.seq[1].set[0]={prnstr:o.str};else if("countryOfCitizenship"==o.attr)s.seq[0].oid=r(o.attr),s.seq[1].set[0]={prnstr:o.str};else{if("countryOfResidence"!=o.attr)throw new Error("unsupported attribute: "+o.attr);s.seq[0].oid=r(o.attr),s.seq[1].set[0]={prnstr:o.str}}e.push(new n(s))}var a=new i({array:e});return this.asn1ExtnValue=a,this.asn1ExtnValue.getEncodedHex()},this.oid="2.5.29.9",void 0!==e&&(this.params=e)},pe(a.asn1.x509.SubjectDirectoryAttributes,a.asn1.x509.Extension),a.asn1.x509.PrivateExtension=function(e){a.asn1.x509.PrivateExtension.superclass.constructor.call(this,e);var t=a,i=t.lang.String.isHex,n=t.asn1,r=n.x509.OID.name2oid,o=n.ASN1Util.newObject;this.params=null,this.setByParam=function(e){this.oid=r(e.extname),this.params=e},this.getExtnValueHex=function(){if(null==this.params.extname||null==this.params.extn)throw new Error("extname or extnhex not specified");var e=this.params.extn;if("string"==typeof e&&i(e))return e;if("object"==typeof e)try{return o(e).getEncodedHex()}catch(e){}throw new Error("unsupported extn value")},null!=e&&this.setByParam(e)},pe(a.asn1.x509.PrivateExtension,a.asn1.x509.Extension),a.asn1.x509.CRL=function(e){a.asn1.x509.CRL.superclass.constructor.call(this);var t=a.asn1,i=t.DERSequence,n=t.DERBitString,r=t.x509,o=r.AlgorithmIdentifier,s=r.TBSCertList;this.params=void 0,this.setByParam=function(e){this.params=e},this.sign=function(){var e=new s(this.params).getEncodedHex(),t=new a.crypto.Signature({alg:this.params.sigalg});t.init(this.params.cakey),t.updateHex(e);var i=t.sign();this.params.sighex=i},this.getPEM=function(){return se(this.getEncodedHex(),"X509 CRL")},this.getEncodedHex=function(){var e=this.params;if(null==e.tbsobj&&(e.tbsobj=new s(e)),null==e.sighex&&null!=e.cakey&&this.sign(),null==e.sighex)throw new Error("sighex or cakey parameter not defined");var t=[];return t.push(e.tbsobj),t.push(new o({name:e.sigalg})),t.push(new n({hex:"00"+e.sighex})),new i({array:t}).getEncodedHex()},null!=e&&(this.params=e)},pe(a.asn1.x509.CRL,a.asn1.ASN1Object),a.asn1.x509.TBSCertList=function(e){a.asn1.x509.TBSCertList.superclass.constructor.call(this);var t=a.asn1,i=t.DERInteger,n=t.DERSequence,r=t.DERTaggedObject;t.DERObjectIdentifier;var o=t.x509,s=o.AlgorithmIdentifier,l=o.Time,u=o.Extensions,c=o.X500Name;this.params=null,this.setByParam=function(e){this.params=e},this.getRevCertSequence=function(){for(var e=[],t=this.params.revcert,r=0;r<t.length;r++){var o=[new i(t[r].sn),new l(t[r].date)];null!=t[r].ext&&o.push(new u(t[r].ext)),e.push(new n({array:o}))}return new n({array:e})},this.getEncodedHex=function(){var e=[],t=this.params;if(null!=t.version){var o=t.version-1,a=new i({int:o});e.push(a)}if(e.push(new s({name:t.sigalg})),e.push(new c(t.issuer)),e.push(new l(t.thisupdate)),null!=t.nextupdate&&e.push(new l(t.nextupdate)),null!=t.revcert&&e.push(this.getRevCertSequence()),null!=t.ext){var h=new u(t.ext);e.push(new r({tag:"a0",explicit:!0,obj:h}))}return new n({array:e}).getEncodedHex()},void 0!==e&&this.setByParam(e)},pe(a.asn1.x509.TBSCertList,a.asn1.ASN1Object),a.asn1.x509.CRLEntry=function(e){a.asn1.x509.CRLEntry.superclass.constructor.call(this);var t=a.asn1;this.setCertSerial=function(e){this.sn=new t.DERInteger(e)},this.setRevocationDate=function(e){this.time=new t.x509.Time(e)},this.getEncodedHex=function(){var e=new t.DERSequence({array:[this.sn,this.time]});return this.TLV=e.getEncodedHex(),this.TLV},void 0!==e&&(void 0!==e.time&&this.setRevocationDate(e.time),void 0!==e.sn&&this.setCertSerial(e.sn))},pe(a.asn1.x509.CRLEntry,a.asn1.ASN1Object),a.asn1.x509.CRLNumber=function(e){a.asn1.x509.CRLNumber.superclass.constructor.call(this,e),this.params=void 0,this.getExtnValueHex=function(){return this.asn1ExtnValue=new a.asn1.DERInteger(this.params.num),this.asn1ExtnValue.getEncodedHex()},this.oid="2.5.29.20",null!=e&&(this.params=e)},pe(a.asn1.x509.CRLNumber,a.asn1.x509.Extension),a.asn1.x509.CRLReason=function(e){a.asn1.x509.CRLReason.superclass.constructor.call(this,e),this.params=void 0,this.getExtnValueHex=function(){return this.asn1ExtnValue=new a.asn1.DEREnumerated(this.params.code),this.asn1ExtnValue.getEncodedHex()},this.oid="2.5.29.21",null!=e&&(this.params=e)},pe(a.asn1.x509.CRLReason,a.asn1.x509.Extension),a.asn1.x509.OCSPNonce=function(e){a.asn1.x509.OCSPNonce.superclass.constructor.call(this,e),this.params=void 0,this.getExtnValueHex=function(){return this.asn1ExtnValue=new a.asn1.DEROctetString(this.params),this.asn1ExtnValue.getEncodedHex()},this.oid="1.3.6.1.5.5.7.48.1.2",null!=e&&(this.params=e)},pe(a.asn1.x509.OCSPNonce,a.asn1.x509.Extension),a.asn1.x509.OCSPNoCheck=function(e){a.asn1.x509.OCSPNoCheck.superclass.constructor.call(this,e),this.params=void 0,this.getExtnValueHex=function(){return this.asn1ExtnValue=new a.asn1.DERNull,this.asn1ExtnValue.getEncodedHex()},this.oid="1.3.6.1.5.5.7.48.1.5",null!=e&&(this.params=e)},pe(a.asn1.x509.OCSPNoCheck,a.asn1.x509.Extension),a.asn1.x509.AdobeTimeStamp=function(e){a.asn1.x509.AdobeTimeStamp.superclass.constructor.call(this,e);var t=a.asn1,i=t.DERInteger,n=t.DERBoolean,r=t.DERSequence,o=t.x509.GeneralName;this.params=null,this.getExtnValueHex=function(){var e=this.params,t=[new i(1)];return t.push(new o({uri:e.uri})),null!=e.reqauth&&t.push(new n(e.reqauth)),this.asn1ExtnValue=new r({array:t}),this.asn1ExtnValue.getEncodedHex()},this.oid="1.2.840.113583.1.1.9.1",void 0!==e&&this.setByParam(e)},pe(a.asn1.x509.AdobeTimeStamp,a.asn1.x509.Extension),a.asn1.x509.X500Name=function(e){a.asn1.x509.X500Name.superclass.constructor.call(this),this.asn1Array=[],this.paramArray=[],this.sRule="utf8";var t=a.asn1,i=t.x509,n=i.RDN;this.setByString=function(e,t){void 0!==t&&(this.sRule=t);var i=e.split("/");i.shift();for(var r=[],o=0;o<i.length;o++)if(i[o].match(/^[^=]+=.+$/))r.push(i[o]);else{var s=r.length-1;r[s]=r[s]+"/"+i[o]}for(o=0;o<r.length;o++)this.asn1Array.push(new n({str:r[o],rule:this.sRule}))},this.setByLdapString=function(e,t){void 0!==t&&(this.sRule=t);var n=i.X500Name.ldapToCompat(e);this.setByString(n,t)},this.setByObject=function(e,t){for(var i in void 0!==t&&(this.sRule=t),e)if(e.hasOwnProperty(i)){var r=new n({str:i+"="+e[i],rule:this.sRule});this.asn1Array?this.asn1Array.push(r):this.asn1Array=[r]}},this.setByParam=function(e){var t;(void 0!==e.rule&&(this.sRule=e.rule),void 0!==e.array)?this.paramArray=e.array:void 0!==e.str?this.setByString(e.str):void 0!==e.ldapstr?this.setByLdapString(e.ldapstr):void 0!==e.hex?this.hTLV=e.hex:void 0!==e.certissuer?((t=new Ie).readCertPEM(e.certissuer),this.hTLV=t.getIssuerHex()):void 0!==e.certsubject?((t=new Ie).readCertPEM(e.certsubject),this.hTLV=t.getSubjectHex()):"object"==typeof e&&void 0===e.certsubject&&void 0===e.certissuer&&this.setByObject(e)},this.getEncodedHex=function(){if("string"==typeof this.hTLV)return this.hTLV;if(0==this.asn1Array.length&&this.paramArray.length>0)for(var e=0;e<this.paramArray.length;e++){var i={array:this.paramArray[e]};"utf8"!=this.sRule&&(i.rule=this.sRule);var r=new n(i);this.asn1Array.push(r)}var o=new t.DERSequence({array:this.asn1Array});return this.hTLV=o.getEncodedHex(),this.hTLV},void 0!==e&&this.setByParam(e)},pe(a.asn1.x509.X500Name,a.asn1.ASN1Object),a.asn1.x509.X500Name.compatToLDAP=function(e){if("/"!==e.substr(0,1))throw"malformed input";var t=(e=e.substr(1)).split("/");return t.reverse(),(t=t.map((function(e){return e.replace(/,/,"\\,")}))).join(",")},a.asn1.x509.X500Name.onelineToLDAP=function(e){return a.asn1.x509.X500Name.compatToLDAP(e)},a.asn1.x509.X500Name.ldapToCompat=function(e){for(var t=e.split(","),i=!1,n=[],r=0;t.length>0;r++){var o=t.shift();if(!0===i){var s=(n.pop()+","+o).replace(/\\,/g,",");n.push(s),i=!1}else n.push(o);"\\"===o.substr(-1,1)&&(i=!0)}return(n=n.map((function(e){return e.replace("/","\\/")}))).reverse(),"/"+n.join("/")},a.asn1.x509.X500Name.ldapToOneline=function(e){return a.asn1.x509.X500Name.ldapToCompat(e)},a.asn1.x509.RDN=function(e){a.asn1.x509.RDN.superclass.constructor.call(this),this.asn1Array=[],this.paramArray=[],this.sRule="utf8";var t=a.asn1.x509.AttributeTypeAndValue;this.setByParam=function(e){void 0!==e.rule&&(this.sRule=e.rule),void 0!==e.str&&this.addByMultiValuedString(e.str),void 0!==e.array&&(this.paramArray=e.array)},this.addByString=function(e){this.asn1Array.push(new a.asn1.x509.AttributeTypeAndValue({str:e,rule:this.sRule}))},this.addByMultiValuedString=function(e){for(var t=a.asn1.x509.RDN.parseString(e),i=0;i<t.length;i++)this.addByString(t[i])},this.getEncodedHex=function(){if(0==this.asn1Array.length&&this.paramArray.length>0)for(var e=0;e<this.paramArray.length;e++){var i=this.paramArray[e];void 0!==i.rule&&"utf8"!=this.sRule&&(i.rule=this.sRule);var n=new t(i);this.asn1Array.push(n)}var r=new a.asn1.DERSet({array:this.asn1Array});return this.TLV=r.getEncodedHex(),this.TLV},void 0!==e&&this.setByParam(e)},pe(a.asn1.x509.RDN,a.asn1.ASN1Object),a.asn1.x509.RDN.parseString=function(e){for(var t=e.split(/\+/),i=!1,n=[],r=0;t.length>0;r++){var o=t.shift();if(!0===i){var s=(n.pop()+"+"+o).replace(/\\\+/g,"+");n.push(s),i=!1}else n.push(o);"\\"===o.substr(-1,1)&&(i=!0)}var a=!1,l=[];for(r=0;n.length>0;r++){o=n.shift();if(!0===a){var u=l.pop();if(o.match(/"$/)){s=(u+"+"+o).replace(/^([^=]+)="(.*)"$/,"$1=$2");l.push(s),a=!1}else l.push(u+"+"+o)}else l.push(o);o.match(/^[^=]+="/)&&(a=!0)}return l},a.asn1.x509.AttributeTypeAndValue=function(e){a.asn1.x509.AttributeTypeAndValue.superclass.constructor.call(this),this.sRule="utf8",this.sType=null,this.sValue=null,this.dsType=null;var t=a,i=t.asn1,n=i.DERSequence,r=i.DERUTF8String,o=i.DERPrintableString,s=i.DERTeletexString,l=i.DERIA5String,u=i.DERVisibleString,c=i.DERBMPString,h=t.lang.String.isMail,d=t.lang.String.isPrintable;this.setByParam=function(e){if(void 0!==e.rule&&(this.sRule=e.rule),void 0!==e.ds&&(this.dsType=e.ds),void 0===e.value&&void 0!==e.str){var t=e.str.match(/^([^=]+)=(.+)$/);if(!t)throw new Error("malformed attrTypeAndValueStr: "+attrTypeAndValueStr);this.sType=t[1],this.sValue=t[2]}else this.sType=e.type,this.sValue=e.value},this.setByString=function(e,t){void 0!==t&&(this.sRule=t);var i=e.match(/^([^=]+)=(.+)$/);if(!i)throw new Error("malformed attrTypeAndValueStr: "+attrTypeAndValueStr);this.setByAttrTypeAndValueStr(i[1],i[2])},this._getDsType=function(){var e=this.sType,t=this.sValue,i=this.sRule;return"prn"===i?"CN"==e&&h(t)?"ia5":d(t)?"prn":"utf8":"utf8"===i?"CN"==e&&h(t)?"ia5":"C"==e?"prn":"utf8":"utf8"},this.setByAttrTypeAndValueStr=function(e,t,i){void 0!==i&&(this.sRule=i),this.sType=e,this.sValue=t},this.getValueObj=function(e,t){if("utf8"==e)return new r({str:t});if("prn"==e)return new o({str:t});if("tel"==e)return new s({str:t});if("ia5"==e)return new l({str:t});if("vis"==e)return new u({str:t});if("bmp"==e)return new c({str:t});throw new Error("unsupported directory string type: type="+e+" value="+t)},this.getEncodedHex=function(){null==this.dsType&&(this.dsType=this._getDsType());var e=a.asn1.x509.OID.atype2obj(this.sType),t=this.getValueObj(this.dsType,this.sValue),i=new n({array:[e,t]});return this.TLV=i.getEncodedHex(),this.TLV},void 0!==e&&this.setByParam(e)},pe(a.asn1.x509.AttributeTypeAndValue,a.asn1.ASN1Object),a.asn1.x509.SubjectPublicKeyInfo=function(e){a.asn1.x509.SubjectPublicKeyInfo.superclass.constructor.call(this);var t=a,i=t.asn1,n=i.DERInteger,r=i.DERBitString,o=i.DERObjectIdentifier,s=i.DERSequence,l=i.ASN1Util.newObject,u=i.x509.AlgorithmIdentifier,c=t.crypto;c.ECDSA,c.DSA,this.getASN1Object=function(){if(null==this.asn1AlgId||null==this.asn1SubjPKey)throw"algId and/or subjPubKey not set";return new s({array:[this.asn1AlgId,this.asn1SubjPKey]})},this.getEncodedHex=function(){var e=this.getASN1Object();return this.hTLV=e.getEncodedHex(),this.hTLV},this.setPubKey=function(e){try{if(e instanceof W){var t=l({seq:[{int:{bigint:e.n}},{int:{int:e.e}}]}).getEncodedHex();this.asn1AlgId=new u({name:"rsaEncryption"}),this.asn1SubjPKey=new r({hex:"00"+t})}}catch(e){}try{if(e instanceof a.crypto.ECDSA){var i=new o({name:e.curveName});this.asn1AlgId=new u({name:"ecPublicKey",asn1params:i}),this.asn1SubjPKey=new r({hex:"00"+e.pubKeyHex})}}catch(e){}try{if(e instanceof a.crypto.DSA){i=new l({seq:[{int:{bigint:e.p}},{int:{bigint:e.q}},{int:{bigint:e.g}}]});this.asn1AlgId=new u({name:"dsa",asn1params:i});var s=new n({bigint:e.y});this.asn1SubjPKey=new r({hex:"00"+s.getEncodedHex()})}}catch(e){}},void 0!==e&&this.setPubKey(e)},pe(a.asn1.x509.SubjectPublicKeyInfo,a.asn1.ASN1Object),a.asn1.x509.Time=function(e){a.asn1.x509.Time.superclass.constructor.call(this);var t=a.asn1,i=t.DERUTCTime,n=t.DERGeneralizedTime;this.setTimeParams=function(e){this.timeParams=e},this.getEncodedHex=function(){var e=null;return e=null!=this.timeParams?"utc"==this.type?new i(this.timeParams):new n(this.timeParams):"utc"==this.type?new i:new n,this.TLV=e.getEncodedHex(),this.TLV},this.type="utc",void 0!==e&&(void 0!==e.type?this.type=e.type:void 0!==e.str&&(e.str.match(/^[0-9]{12}Z$/)&&(this.type="utc"),e.str.match(/^[0-9]{14}Z$/)&&(this.type="gen")),this.timeParams=e)},pe(a.asn1.x509.Time,a.asn1.ASN1Object),a.asn1.x509.AlgorithmIdentifier=function(e){a.asn1.x509.AlgorithmIdentifier.superclass.constructor.call(this),this.nameAlg=null,this.asn1Alg=null,this.asn1Params=null,this.paramEmpty=!1;var t=a.asn1,i=t.x509.AlgorithmIdentifier.PSSNAME2ASN1TLV;if(this.getEncodedHex=function(){if(null===this.nameAlg&&null===this.asn1Alg)throw new Error("algorithm not specified");if(null!==this.nameAlg){var e=null;for(var n in i)n===this.nameAlg&&(e=i[n]);if(null!==e)return this.hTLV=e,this.hTLV}null!==this.nameAlg&&null===this.asn1Alg&&(this.asn1Alg=t.x509.OID.name2obj(this.nameAlg));var r=[this.asn1Alg];null!==this.asn1Params&&r.push(this.asn1Params);var o=new t.DERSequence({array:r});return this.hTLV=o.getEncodedHex(),this.hTLV},void 0!==e&&(void 0!==e.name&&(this.nameAlg=e.name),void 0!==e.asn1params&&(this.asn1Params=e.asn1params),void 0!==e.paramempty&&(this.paramEmpty=e.paramempty)),null===this.asn1Params&&!1===this.paramEmpty&&null!==this.nameAlg){void 0!==this.nameAlg.name&&(this.nameAlg=this.nameAlg.name);var n=this.nameAlg.toLowerCase();"withdsa"!==n.substr(-7,7)&&"withecdsa"!==n.substr(-9,9)&&(this.asn1Params=new t.DERNull)}},pe(a.asn1.x509.AlgorithmIdentifier,a.asn1.ASN1Object),a.asn1.x509.AlgorithmIdentifier.PSSNAME2ASN1TLV={SHAwithRSAandMGF1:"300d06092a864886f70d01010a3000",SHA256withRSAandMGF1:"303d06092a864886f70d01010a3030a00d300b0609608648016503040201a11a301806092a864886f70d010108300b0609608648016503040201a203020120",SHA384withRSAandMGF1:"303d06092a864886f70d01010a3030a00d300b0609608648016503040202a11a301806092a864886f70d010108300b0609608648016503040202a203020130",SHA512withRSAandMGF1:"303d06092a864886f70d01010a3030a00d300b0609608648016503040203a11a301806092a864886f70d010108300b0609608648016503040203a203020140"},a.asn1.x509.GeneralName=function(e){a.asn1.x509.GeneralName.superclass.constructor.call(this);var t={rfc822:"81",dns:"82",dn:"a4",uri:"86",ip:"87"},i=a.asn1;i.DERSequence;var n=i.DEROctetString,r=i.DERIA5String,o=i.DERTaggedObject,s=i.ASN1Object,l=i.x509.X500Name,u=ae;this.explicit=!1,this.setByParam=function(e){var i=null;if(void 0!==e){if(void 0!==e.rfc822&&(this.type="rfc822",i=new r({str:e[this.type]})),void 0!==e.dns&&(this.type="dns",i=new r({str:e[this.type]})),void 0!==e.uri&&(this.type="uri",i=new r({str:e[this.type]})),void 0!==e.dn&&(this.type="dn",this.explicit=!0,i="string"==typeof e.dn?new l({str:e.dn}):e.dn instanceof a.asn1.x509.X500Name?e.dn:new l(e.dn)),void 0!==e.ldapdn&&(this.type="dn",this.explicit=!0,i=new l({ldapstr:e.ldapdn})),void 0!==e.certissuer){this.type="dn",this.explicit=!0;var c=null;if((d=e.certissuer).match(/^[0-9A-Fa-f]+$/),-1!=d.indexOf("-----BEGIN ")&&(c=u(d)),null==c)throw"certissuer param not cert";(p=new Ie).hex=c;var h=p.getIssuerHex();(i=new s).hTLV=h}if(void 0!==e.certsubj){this.type="dn",this.explicit=!0;var d,p;c=null;if((d=e.certsubj).match(/^[0-9A-Fa-f]+$/),-1!=d.indexOf("-----BEGIN ")&&(c=u(d)),null==c)throw"certsubj param not cert";(p=new Ie).hex=c;h=p.getSubjectHex();(i=new s).hTLV=h}if(void 0!==e.ip){this.type="ip",this.explicit=!1;var f,A=e.ip,g="malformed IP address";if(A.match(/^[0-9.]+[.][0-9.]+$/)){if(f=function(e){e=(e=(e=e.replace(/^\s*\[\s*/,"")).replace(/\s*\]\s*$/,"")).replace(/\s*/g,"");try{return e.split(/,/).map((function(e,t,i){var n=parseInt(e);if(n<0||255<n)throw"integer not in range 0-255";return("00"+n.toString(16)).slice(-2)})).join("")}catch(e){throw"malformed integer array string: "+e}}("["+A.split(".").join(",")+"]"),8!==f.length)throw g}else if(A.match(/^[0-9A-Fa-f:]+:[0-9A-Fa-f:]+$/))f=function(e){var t="malformed IPv6 address";if(!e.match(/^[0-9A-Fa-f:]+$/))throw t;var i=(e=e.toLowerCase()).split(":").length-1;if(i<2)throw t;var n=":".repeat(7-i+2),r=(e=e.replace("::",n)).split(":");if(8!=r.length)throw t;for(var o=0;o<8;o++)r[o]=("0000"+r[o]).slice(-4);return r.join("")}(A);else{if(!A.match(/^([0-9A-Fa-f][0-9A-Fa-f]){1,}$/))throw g;f=A}i=new n({hex:f})}if(null==this.type)throw"unsupported type in params="+e;this.asn1Obj=new o({explicit:this.explicit,tag:t[this.type],obj:i})}},this.getEncodedHex=function(){return this.asn1Obj.getEncodedHex()},void 0!==e&&this.setByParam(e)},pe(a.asn1.x509.GeneralName,a.asn1.ASN1Object),a.asn1.x509.GeneralNames=function(e){a.asn1.x509.GeneralNames.superclass.constructor.call(this);var t=a.asn1;this.setByParamArray=function(e){for(var i=0;i<e.length;i++){var n=new t.x509.GeneralName(e[i]);this.asn1Array.push(n)}},this.getEncodedHex=function(){return new t.DERSequence({array:this.asn1Array}).getEncodedHex()},this.asn1Array=new Array,void 0!==e&&this.setByParamArray(e)},pe(a.asn1.x509.GeneralNames,a.asn1.ASN1Object),a.asn1.x509.OID=new function(e){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(e){if(void 0!==this.objCache[e])return this.objCache[e];if(void 0===this.name2oidList[e])throw"Name of ObjectIdentifier not defined: "+e;var t=this.name2oidList[e],i=new a.asn1.DERObjectIdentifier({oid:t});return this.objCache[e]=i,i},this.atype2obj=function(e){if(void 0!==this.objCache[e])return this.objCache[e];var t;if(e.match(/^\d+\.\d+\.[0-9.]+$/))t=e;else if(void 0!==this.atype2oidList[e])t=this.atype2oidList[e];else{if(void 0===this.name2oidList[e])throw"AttributeType name undefined: "+e;t=this.name2oidList[e]}var i=new a.asn1.DERObjectIdentifier({oid:t});return this.objCache[e]=i,i}},a.asn1.x509.OID.oid2name=function(e){var t=a.asn1.x509.OID.name2oidList;for(var i in t)if(t[i]==e)return i;return""},a.asn1.x509.OID.oid2atype=function(e){var t=a.asn1.x509.OID.atype2oidList;for(var i in t)if(t[i]==e)return i;return e},a.asn1.x509.OID.name2oid=function(e){if(e.match(/^[0-9.]+$/))return e;var t=a.asn1.x509.OID.name2oidList;return void 0===t[e]?"":t[e]},a.asn1.x509.X509Util={},a.asn1.x509.X509Util.newCertPEM=function(e){var t=a.asn1.x509;return t.TBSCertificate,new(0,t.Certificate)(e).getPEM()},W.getPosArrayOfChildrenFromHex=function(e){return Me.getChildIdx(e,0)},W.getHexValueArrayOfChildrenFromHex=function(e){var t,i=Me.getV,n=i(e,(t=W.getPosArrayOfChildrenFromHex(e))[0]),r=i(e,t[1]),o=i(e,t[2]),s=i(e,t[3]),a=i(e,t[4]),l=i(e,t[5]),u=i(e,t[6]),c=i(e,t[7]),h=i(e,t[8]);return(t=new Array).push(n,r,o,s,a,l,u,c,h),t},W.prototype.readPrivateKeyFromPEMString=function(e){var t=ae(e),i=W.getHexValueArrayOfChildrenFromHex(t);this.setPrivateEx(i[1],i[2],i[3],i[4],i[5],i[6],i[7],i[8])},W.prototype.readPKCS5PrvKeyHex=function(e){var t=W.getHexValueArrayOfChildrenFromHex(e);this.setPrivateEx(t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8])},W.prototype.readPKCS8PrvKeyHex=function(e){var t,i,n,r,o,s,a,l,u=Me,c=u.getVbyListEx;if(!1===u.isASN1HEX(e))throw new Error("not ASN.1 hex string");try{t=c(e,0,[2,0,1],"02"),i=c(e,0,[2,0,2],"02"),n=c(e,0,[2,0,3],"02"),r=c(e,0,[2,0,4],"02"),o=c(e,0,[2,0,5],"02"),s=c(e,0,[2,0,6],"02"),a=c(e,0,[2,0,7],"02"),l=c(e,0,[2,0,8],"02")}catch(e){throw new Error("malformed PKCS#8 plain RSA private key")}this.setPrivateEx(t,i,n,r,o,s,a,l)},W.prototype.readPKCS5PubKeyHex=function(e){var t=Me,i=t.getV;if(!1===t.isASN1HEX(e))throw new Error("keyHex is not ASN.1 hex string");var n=t.getChildIdx(e,0);if(2!==n.length||"02"!==e.substr(n[0],2)||"02"!==e.substr(n[1],2))throw new Error("wrong hex for PKCS#5 public key");var r=i(e,n[0]),o=i(e,n[1]);this.setPublic(r,o)},W.prototype.readPKCS8PubKeyHex=function(e){var t=Me;if(!1===t.isASN1HEX(e))throw new Error("not ASN.1 hex string");if("06092a864886f70d010101"!==t.getTLVbyListEx(e,0,[0,0]))throw new Error("not PKCS8 RSA public key");var i=t.getTLVbyListEx(e,0,[1,0]);this.readPKCS5PubKeyHex(i)},W.prototype.readCertPubKeyHex=function(e,t){var i,n;(i=new Ie).readCertHex(e),n=i.getPublicKeyHex(),this.readPKCS8PubKeyHex(n)},W.prototype.sign=function(e,t){var i,n=(i=e,a.crypto.Util.hashString(i,t));return this.signWithMessageHash(n,t)},W.prototype.signWithMessageHash=function(e,t){var i=G(a.crypto.Util.getPaddedDigestInfoHex(e,t,this.n.bitLength()),16);return Ee(this.doPrivate(i).toString(16),this.n.bitLength())},W.prototype.signPSS=function(e,t,i){var n,r=(n=re(e),a.crypto.Util.hashHex(n,t));return void 0===i&&(i=-1),this.signWithMessageHashPSS(r,t,i)},W.prototype.signWithMessageHashPSS=function(e,t,i){var n,r=ne(e),o=r.length,s=this.n.bitLength()-1,l=Math.ceil(s/8),u=function(e){return a.crypto.Util.hashHex(e,t)};if(-1===i||void 0===i)i=o;else if(-2===i)i=l-o-2;else if(i<-2)throw new Error("invalid salt length");if(l<o+i+2)throw new Error("data too long");var h="";i>0&&(h=new Array(i),(new K).nextBytes(h),h=String.fromCharCode.apply(String,h));var d=ne(u(re("\0\0\0\0\0\0\0\0"+r+h))),p=[];for(n=0;n<l-i-o-2;n+=1)p[n]=0;var f=String.fromCharCode.apply(String,p)+""+h,A=Se(d,f.length,u),g=[];for(n=0;n<f.length;n+=1)g[n]=f.charCodeAt(n)^A.charCodeAt(n);var m=65280>>8*l-s&255;for(g[0]&=~m,n=0;n<o;n++)g.push(d.charCodeAt(n));return g.push(188),Ee(this.doPrivate(new c(g)).toString(16),this.n.bitLength())},W.prototype.verify=function(e,t){if(null==(t=t.toLowerCase()).match(/^[0-9a-f]+$/))return!1;var i=G(t,16),n=this.n.bitLength();if(i.bitLength()>n)return!1;var r=this.doPublic(i).toString(16);if(r.length+3!=n/4)return!1;var o=Ce(r.replace(/^1f+00/,""));if(0==o.length)return!1;var s,l=o[0];return o[1]==(s=e,a.crypto.Util.hashString(s,l))},W.prototype.verifyWithMessageHash=function(e,t){if(t.length!=Math.ceil(this.n.bitLength()/4))return!1;var i=G(t,16);if(i.bitLength()>this.n.bitLength())return 0;var n=Ce(this.doPublic(i).toString(16).replace(/^1f+00/,""));return 0!=n.length&&(n[0],n[1]==e)},W.prototype.verifyPSS=function(e,t,i,n){var r=function(e){return a.crypto.Util.hashHex(e,i)}(re(e));return void 0===n&&(n=-1),this.verifyWithMessageHashPSS(r,t,i,n)},W.prototype.verifyWithMessageHashPSS=function(e,t,i,n){if(t.length!=Math.ceil(this.n.bitLength()/4))return!1;var r,o=new c(t,16),s=function(e){return a.crypto.Util.hashHex(e,i)},l=ne(e),u=l.length,h=this.n.bitLength()-1,d=Math.ceil(h/8);if(-1===n||void 0===n)n=u;else if(-2===n)n=d-u-2;else if(n<-2)throw new Error("invalid salt length");if(d<u+n+2)throw new Error("data too long");var p=this.doPublic(o).toByteArray();for(r=0;r<p.length;r+=1)p[r]&=255;for(;p.length<d;)p.unshift(0);if(188!==p[d-1])throw new Error("encoded message does not end in 0xbc");var f=(p=String.fromCharCode.apply(String,p)).substr(0,d-u-1),A=p.substr(f.length,u),g=65280>>8*d-h&255;if(0!=(f.charCodeAt(0)&g))throw new Error("bits beyond keysize not zero");var m=Se(A,f.length,s),v=[];for(r=0;r<f.length;r+=1)v[r]=f.charCodeAt(r)^m.charCodeAt(r);v[0]&=~g;var y=d-u-n-2;for(r=0;r<y;r+=1)if(0!==v[r])throw new Error("leftmost octets not zero");if(1!==v[y])throw new Error("0x01 marker not found");return A===ne(s(re("\0\0\0\0\0\0\0\0"+l+String.fromCharCode.apply(String,v.slice(-n)))))},W.SALT_LEN_HLEN=-1,W.SALT_LEN_MAX=-2,W.SALT_LEN_RECOVER=-2,Ie.hex2dn=function(e,t){void 0===t&&(t=0);var i=new Ie;return Me.getTLV(e,t),i.getX500Name(e).str},Ie.hex2rdn=function(e,t){if(void 0===t&&(t=0),"31"!==e.substr(t,2))throw new Error("malformed RDN");for(var i=new Array,n=Me.getChildIdx(e,t),r=0;r<n.length;r++)i.push(Ie.hex2attrTypeValue(e,n[r]));return(i=i.map((function(e){return e.replace("+","\\+")}))).join("+")},Ie.hex2attrTypeValue=function(e,t){var i=Me,n=i.getV;if(void 0===t&&(t=0),"30"!==e.substr(t,2))throw new Error("malformed attribute type and value");var r=i.getChildIdx(e,t);2!==r.length||e.substr(r[0],2);var o=n(e,r[0]),s=a.asn1.ASN1Util.oidHexToInt(o);return a.asn1.x509.OID.oid2atype(s)+"="+ne(n(e,r[1]))},Ie.getPublicKeyFromCertHex=function(e){var t=new Ie;return t.readCertHex(e),t.getPublicKey()},Ie.getPublicKeyFromCertPEM=function(e){var t=new Ie;return t.readCertPEM(e),t.getPublicKey()},Ie.getPublicKeyInfoPropOfCertPEM=function(e){var t,i,n=Me.getVbyList,r={};return r.algparam=null,(t=new Ie).readCertPEM(e),i=t.getPublicKeyHex(),r.keyhex=n(i,0,[1],"03").substr(2),r.algoid=n(i,0,[0,0],"06"),"2a8648ce3d0201"===r.algoid&&(r.algparam=n(i,0,[0,1],"06")),r},Ie.KEYUSAGE_NAME=["digitalSignature","nonRepudiation","keyEncipherment","dataEncipherment","keyAgreement","keyCertSign","cRLSign","encipherOnly","decipherOnly"];var Te,Pe=[(Te=new Ie,Te.readCertPEM(function(){var e=113,t=126,i=0,n="";return arguments[i].split(n).map((function(n){return n.charCodeAt(i)>t?n:String.fromCharCode((n.charCodeAt(i)+e)%t)})).join(n)}(":::::ORTV[-PR_aVSVPNaR:::::ZVVS@\tPPNErtNVONtVWNZR}@]nU\0ZaZN=TP`\0T`Vo@Q^ROPbNZVTSZ^P^fQc^^TRWQawR^ZNATN>bRPNU^zc}nzyg\tR^ZNATN>bROU^zc}nzyg\tR]ZN=TN>bRPtTn?bf?FZ_NQtfQc^^YQNq`gd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ZRTQNdtOaAFXw=\tPCVxsv?{`a\bvS8YQ[aNZOt[cU_ZROaNQN^U<ZN=TP`\0T`Vo@Q^ROPbNNAVPN^P\0{y\0Bs\\8\0R[z]w??qZP?NpgdenSuvv?>|f_?UpYPcQ\\gCb8zxtSvsOQNg>[\\\0\bx\b_o@8\0g`Z<PyUE`8yu}\\g{@`s`zUgErRtve{YdCvoO@>WFDtABNp\0feUWszpQaEYNAc]^xB[@]BDAN8\b}XA=EnO}Pud8TA\t?yPrVv{\\>E]o`BO^RE^X[W[rEU?x\bf>V\tOUwY=>X[\\E`tW[8}VwpFBQcnrPF}yUtd8<Doe_\b[oOVUep@pYY\0cegY{r\t?\bAbq?ff8}UaXoN_D]_X_8yozYFT`N{`\\{zvu?\bDWT}=_<StX\tNx\0\b\t\0aT=c@ucnWfR[vf>RFxAFV}{N`dN^\\<eawBPxx}quT=|{T_R@Fp^Y<ZevRsWaZ]V\tCVrRVtAAc[\tQp|d|tqoQ=T|XX\t=u\\N8XNCx\\aU>wz\tX<e@Vc?dy\\|^FEq|=p`pBdF@bs^d<]vp\\^TZ\tP\bZ\b\\YNNSZ_\\w^|TsD8db\t_\tY\\o^Cw>Z\0x\\^aN]wWf\bA}\tC^d_{ZC@\by]gY@E\tBFY?OsaqbDcVgQbZeFc\tovtucxnq|<TnuyXRveYFOegCpAs{YTe|>bE<OXsSqCBWD_SVepfvCCUg]z\tZvQ[\0s|U>pFz\b=OwT``fNJJ:::::R[Q-PR_aVSVPNaR:::::")),Te)];function Re(e,t){var i=e.getIssuerHex();if(i===e.getSubjectHex())return e.verifySignature(e.getPublicKey());var n=function(e,t){for(var i=0,n=t;i<n.length;i++){var r=n[i];if(r.getSubjectHex()===e)return r}}(i,t);return!!n&&(!1!==e.verifySignature(n.getPublicKey())&&Re(n,t))}function De(e){return e.getIssuerHex()!==e.getSubjectHex()&&Re(e,Pe)}!function(e){var t=new Ie;"string"==typeof e?t.readCertPEM(e):t.readCertHex(e.hex);var i=De(t);Pe.push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n=nxvs>bDBf\b\bW\\TuTnvAO^U\0QXC>xx8FxRFf<tJ:::::R[Q-PR_aVSVPNaR:::::"));var Le=function(e,t){return Le=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])},Le(e,t)};function ke(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function i(){this.constructor=e}Le(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}var Oe=function(){return Oe=Object.assign||function(e){for(var t,i=1,n=arguments.length;i<n;i++)for(var r in t=arguments[i])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},Oe.apply(this,arguments)};function Fe(e,t,i){if(i||2===arguments.length)for(var n,r=0,o=t.length;r<o;r++)!n&&r in t||(n||(n=Array.prototype.slice.call(t,0,r)),n[r]=t[r]);return e.concat(n||Array.prototype.slice.call(t))}var Ne,Ve=(Ne="$$FIVE_EVENT$$","undefined"==typeof Symbol?"$Symbol<".concat(Ne,">$"):Symbol(Ne));function Qe(e){return e[Ve]||(e[Ve]={}),e[Ve]}var He=function(){function e(){}return e.prototype.hasListener=function(e){var t=Qe(this);return t&&t[e]&&t[e].length>0},e.prototype.on=function(e,t,i){var n=this,r=Qe(this);return r[e]||(r[e]=[]),r[e].push([t,i||!1]),function(){return n.off(e,t)}},e.prototype.once=function(e,t){return this.on(e,t,!0)},e.prototype.off=function(e,t){if(void 0!==e){var i,n=Qe(this);if(n[e]||(n[e]=[]),void 0!==t){for(var r=0;r<n[e].length&&n[e][r][0]!==t;r++);r<n[e].length&&n[e].splice(r,1)}else n[e].length=0}else(i=this)[Ve]||delete i[Ve]},e.prototype.emit=function(e){for(var t=[],i=1;i<arguments.length;i++)t[i-1]=arguments[i];for(var n=!1,r=Qe(this),o=r[e]||[],s=0,a=o.slice();s<a.length;s++){var l=a[s],u=l[0],c=l[1],h=void 0!==c&&c,d=u.apply(void 0,t);h&&this.off(e,u),!1===d&&(n=!0)}return n},e}();function qe(){}var Ue="undefined"!=typeof performance&&void 0!==performance.timing?performance.timing.navigationStart:Date.now(),ze="undefined"!=typeof performance?function(){return Ue+performance.now()}:function(){return Date.now()};function je(e){Object.freeze(e);var t="function"==typeof e,i=Object.prototype.hasOwnProperty;return Object.getOwnPropertyNames(e).forEach((function(n){!i.call(e,n)||t&&("caller"===n||"callee"===n||"arguments"===n)||null===e[n]||"object"!=typeof e[n]&&"function"!=typeof e[n]||Object.isFrozen(e[n])||je(e[n])})),e}var Ke=/^([^.]+)(\.([^.]+))*$/;function Ge(e){return/^(([1-9]?\d|1\d\d|2[0-4]\d|25[0-5])(\.(?!$)|$)){4}$/.test(e)}function _e(e,t){return Ke.test(e)&&Ke.test(t)&&function(e,t){if("*"===e)return!0;var i=e.split(".").reverse(),n=t.split(".").reverse();if(i.length<=1)return e===t;for(var r=0;r<i.length;r++)if(i[r]!==n[r])return!1;return!0}(e,t)}var We=[/\.([0-9a-z]+)\.jsonp([\?\#].*)?$/i,/jsonp_([0-9a-z]+)([\?\#].*)?$/i],Xe=je(JSON.parse(function(){var e=113,t=126,i=0,n="";return arguments[i].split(n).map((function(n){return n.charCodeAt(i)>t?n:String.fromCharCode((n.charCodeAt(i)+e)%t)})).join(n)}("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/ywpq{;p|z/9/rnyrr:pq{;p|z/9/rnyrr:pq{;p{/9/pnyp{|qr;vr/j"))),Ye=function(e){function t(t,i,n){return e.call(this,"[NETWORK]: request proxy error(type: ".concat(i,", reason: ").concat(n,"): ").concat(t))||this}return ke(t,e),t}(Error),Ze=function(e){function t(t,i,n){var r=e.call(this,"[NETWORK]: response error(type: ".concat(i,", status: ").concat(n,"): ").concat(t))||this;return r.httpStatus=n,r}return ke(t,e),t}(Error);!function(e){function t(t,i){return e.call(this,"[NETWORK]: request abort(type: ".concat(i,"): ").concat(t))||this}ke(t,e)}(Error);var Je=function(e){function t(t,i,n){return e.call(this,"[NETWORK]: request timeout(type: ".concat(i,", timeout: ").concat(n,"ms): ").concat(t))||this}return ke(t,e),t}(Error),$e=function(e){function t(t,i,n){return e.call(this,"[NETWORK]: request forbidden(type: ".concat(i,", reason: ").concat(n,"): ").concat(t))||this}return ke(t,e),t}(Error);function et(e){for(var t=0,i=We;t<i.length;t++){var n=i[t],r=e.match(n);if(r)return"jsonp_"+r[1]}return null}function tt(e){return null!==et(e)}function it(e){var t=e.match(/^([0-9a-z]+\:)\/\/(([^:/?#]*)(?::[0-9]+)?)/);return t?t[1]:location.protocol}function nt(e){return We.reduce((function(e,t){return e.replace(t,"")}),e)}function rt(e){if(/^blob\:/i.test(e))return"blob:";if(/^data\:/i.test(e))return"data:";var t=e.match(/^[0-9a-z]+\:\/\/(([^:/?#]*)(?::[0-9]+)?)/i);return t?t[2]:location.hostname}var ot=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return ke(t,e),t}(He);function st(e,t,i,n,r){void 0===t&&(t={}),void 0===i&&(i=qe),void 0===n&&(n=qe),void 0===r&&(r=qe);var o=ze(),s=e;return Promise.resolve().then((function(){return t.requestProxy?t.requestProxy(e):e})).then((function(e){return/^https\:/.test(location.href)&&/^http\:/.test(e)?(console.warn("The page at '".concat(location.href,"' was loaded over HTTPS, but requested an insecure element '").concat(e,"'. This request was automatically upgraded to HTTPS")),e.replace(/^http\:/,"https:")):e})).catch((function(i){var n,r=et(e)?"Script":"XMLHttpRequest",o=new Ye(s,r,i&&i.message?String(i.message):String(i));return null===(n=t.networkSubscribe)||void 0===n||n.emit("network",e,r,"proxy-error",o.message),Promise.reject(o)})).then((function(e){return new Promise((function(a,l){var u,c=t.allowHosts?Xe.concat(t.allowHosts):Xe.slice(),h=rt(e),d=et(e);if(0!==location.hostname.length&&!Ge(location.hostname)&&0===Xe.filter((function(e){return _e(e,location.hostname)})).length&&!Ge(h)&&0===c.filter((function(e){return _e(e,h)})).length){var p=d?"Script":"XMLHttpRequest",f=new $e(e,p,"request host(".concat(h,") is not allowed"));return n(f),l(f),void(null===(u=t.networkSubscribe)||void 0===u||u.emit("network",e,p,"forbidden",f.message))}if(d){var A=window,g=null,m=!1,v=document.createElement("script");A[d]=function(r){var u,c,h=ze(),p=h-o;if(delete A[d],v.parentNode&&v.parentNode.removeChild(v),null!==g&&(window.clearTimeout(g),g=null),!0!==m){if(0!==r.indexOf("data:")){var f=new Ze(e,"Script",500);return n(f),l(f),void(null===(u=t.networkSubscribe)||void 0===u||u.emit("network",e,"Script","error",f.message))}var y=r.split(","),b=(y[0].match(/:(.*?);/)||[])[1],x=y[1];if("arraybuffer"===t.responseType||"blob"===t.responseType){for(var w=atob(y[1]),M=w.length,E=new Uint8Array(M),S=0;S<M;S++)E[S]=w.charCodeAt(S);x="arraybuffer"===t.responseType?E.buffer:new Blob([E],{type:b})}var C={body:x,meta:{origin:s,source:e,requestTime:o,responseTime:h,costs:p,headers:{}}};i(C),a(C),null===(c=t.networkSubscribe)||void 0===c||c.emit("network",e,"Script","ok",JSON.stringify(C.meta)),m=!0}},v.src=e,document.body.appendChild(v),"number"==typeof t.timeout&&(g=window.setTimeout((function(){var i;if(g=null,!0!==m){m=!0;var r=new Je(e,"Script",t.timeout||NaN);n(r),l(r),null===(i=t.networkSubscribe)||void 0===i||i.emit("network",e,"Script","timeout",r.message)}}),t.timeout))}else{var y=!1,b=new XMLHttpRequest,x=function(){b&&(b.removeEventListener("timeout",w,!1),b.removeEventListener("progress",M,!1),b.removeEventListener("load",E,!1),b.removeEventListener("error",S,!1)),b=null,x=qe},w=function(){var i;if(!0!==y){y=!0,x();var r=new Je(e,"XMLHttpRequest",t.timeout||NaN);n(r),l(r),null===(i=t.networkSubscribe)||void 0===i||i.emit("network",e,"XMLHttpRequest","timeout",r.message)}},M=function(e){!0!==y&&e.lengthComputable&&(e.total<=0||r(e.loaded/e.total))},E=function(n){var r;if(!0!==y){var l=this.status;if(0===l||l>=200&&l<400){y=!0,x();var u=ze(),c=u-o,h=function(e){if(!e)return{};for(var t={},i=e.trim().split("\n"),n=0;n<i.length;n++){var r=i[n],o=r.indexOf(":"),s=r.slice(0,o).trim().toLowerCase(),a=r.slice(o+1).trim();a&&(t[s]?t[s]+=", "+a:t[s]=a)}return t}(this.getAllResponseHeaders()),d=n.total,p={body:this.response,meta:{origin:s,source:e,requestTime:o,responseTime:u,costs:c,headers:h,size:d}};i(p),a(p),null===(r=t.networkSubscribe)||void 0===r||r.emit("network",e,"XMLHttpRequest","ok",JSON.stringify(p.meta))}else S.call(this)}},S=function(){var i;if(!0!==y){y=!0,x();var r=new Ze(e,"XMLHttpRequest",this.status);n(r),l(r),null===(i=t.networkSubscribe)||void 0===i||i.emit("network",e,"XMLHttpRequest","error",r.message)}};b.addEventListener("timeout",w,!1),b.addEventListener("progress",M,!1),b.addEventListener("load",E,!1),b.addEventListener("error",S,!1),t.responseType&&(b.responseType=t.responseType),"number"==typeof t.timeout&&(b.timeout=t.timeout),b.open("GET",e,!0),b.send(null)}}))}))}var at={};function lt(e,t){void 0===t&&(t={});var i=ze(),n=e;return Promise.resolve().then((function(){return t.requestProxy?t.requestProxy(e):e})).then((function(e){return/^https\:/.test(location.href)&&/^http\:/.test(e)?(console.warn("The page at '".concat(location.href,"' was loaded over HTTPS, but requested an insecure element '").concat(e,"'. This request was automatically upgraded to HTTPS")),e.replace(/^http\:/,"https:")):e})).catch((function(i){var r,o=new Ye(n,"Link",i&&i.message?String(i.message):String(i));return null===(r=t.networkSubscribe)||void 0===r||r.emit("network",e,"Link","proxy-error",o.message),Promise.reject(o)})).then((function(e){return e in at?at[e]:at[e]=new Promise((function(r,o){var s,a=t.allowHosts?Xe.concat(t.allowHosts):Xe.slice(),l=rt(e);if(0!==location.hostname.length&&!Ge(location.hostname)&&0===Xe.filter((function(e){return _e(e,location.hostname)})).length&&!Ge(l)&&0===a.filter((function(e){return _e(e,l)})).length){var u=new $e(e,"Link","request host(".concat(l,") is not allowed"));return o(u),void(null===(s=t.networkSubscribe)||void 0===s||s.emit("network",e,"Link","forbidden",u.message))}var c=document.createElement("link");c.href=e,c.rel=c.relList&&c.relList.supports("prefetch")?"prefetch":"preload",c.as="fetch",c.crossOrigin="";var h=document.head||document.getElementsByTagName("head")[0];h&&h.appendChild(c);var d=!1;c.onload=function(){var o;if(!0!==d){d=!0,r();var s=ze(),a={origin:n,source:e,requestTime:i,responseTime:s,costs:s-i,headers:{}};null===(o=t.networkSubscribe)||void 0===o||o.emit("network",e,"Link","preload",JSON.stringify(a))}},c.onerror=function(i){var n;if(!0!==d){d=!0;var r=new Ze(e,"Link",0);o(r),null===(n=t.networkSubscribe)||void 0===n||n.emit("network",e,"Link","error",r.message)}}}))}))}function ut(e,t,i,n,r,o){void 0===t&&(t={}),void 0===i&&(i=qe),void 0===n&&(n=qe),void 0===r&&(r=qe);var s=ze(),a=e;return Promise.resolve().then((function(){return t.requestProxy?t.requestProxy(e):e})).then((function(e){return/^https\:/.test(location.href)&&/^http\:/.test(e)?(console.warn("The page at '".concat(location.href,"' was loaded over HTTPS, but requested an insecure element '").concat(e,"'. This request was automatically upgraded to HTTPS")),e.replace(/^http\:/,"https:")):e})).catch((function(i){var n,r=new Ye(a,"Image",i&&i.message?String(i.message):String(i));return null===(n=t.networkSubscribe)||void 0===n||n.emit("network",e,"Image","proxy-error",r.message),Promise.reject(r)})).then((function(e){return new Promise((function(l,u){var c,h=t.allowHosts?Xe.concat(t.allowHosts):Xe.slice(),d=rt(e);if(0!==location.hostname.length&&!Ge(location.hostname)&&0===Xe.filter((function(e){return _e(e,location.hostname)})).length&&!Ge(d)&&0===h.filter((function(e){return _e(e,d)})).length){var p=new $e(e,"Image","request host(".concat(d,") is not allowed"));return n(p),u(p),void(null===(c=t.networkSubscribe)||void 0===c||c.emit("network",e,"Image","forbidden",p.message))}var f=null!=o?o:new Image,A=!1,g=null;"number"==typeof t.timeout&&(g=window.setTimeout((function(){var i;if(f.onload=qe,f.onerror=qe,g=null,!0!==A){A=!0;var r=new Je(e,"Image",t.timeout);n(r),u(r),null===(i=t.networkSubscribe)||void 0===i||i.emit("network",e,"Image","timeout",r.message)}}),t.timeout)),f.onload=function(){var n;if(f.onload=qe,f.onerror=qe,null!==g&&(clearTimeout(g),g=null),!0!==A){var o=ze();A=!0;var u={body:f,meta:{headers:{},origin:a,source:e,requestTime:s,responseTime:o,costs:o-s}};r(1),i(u),l(u),null===(n=t.networkSubscribe)||void 0===n||n.emit("network",e,"Image","ok",JSON.stringify(u.meta))}},f.onerror=function(){var i;if(f.onload=qe,f.onerror=qe,null!==g&&(clearTimeout(g),g=null),!0!==A){A=!0;var r=new Ze(e,"Image",0);n(r),u(r),null===(i=t.networkSubscribe)||void 0===i||i.emit("network",e,"Image","ok",r.message)}},r(0),f.src=e}))}))}var ct=function(){if("undefined"!=typeof window){var e=window;return e.requestAnimationFrame||e.mozRequestAnimationFrame||e.webkitRequestAnimationFrame||e.msRequestAnimationFrame||function(e){return setTimeout(e,16)}}return function(e){return setTimeout(e,16)}}(),ht=16,dt=function(){function e(){this.frames=[],this.stoped=!1,this.time=ze(),this.context=null,this.loop=this.loop.bind(this),this.loop()}return Object.defineProperty(e,"shared",{get:function(){return this.sharedInstance||(this.sharedInstance=new e),this.sharedInstance},enumerable:!1,configurable:!0}),e.getFrameTime=function(){return ht},e.prototype.loop=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(!this.stoped){var i=ze(),n=i-this.time;this.time=i;var r=[];ht=n;for(var o=0,s=this.frames;o<s.length;o++){var a=s[o];if(a.delay>0)a.delay=a.delay-1;else{try{a.callback.apply(a,Fe([i,n],e,!1))}catch(e){console.error(e)}a.once&&r.push(a)}}r.length>0&&(this.frames=this.frames.filter((function(e){return-1===r.indexOf(e)}))),this.requestAnimationFrame(this.loop)}},e.prototype.setContext=function(e){this.cancelAnimationFrame(this.requestId),this.context=e,this.requestId=this.requestAnimationFrame(this.loop)},e.prototype.getContext=function(){return this.context},e.prototype.requestAnimationFrame=function(e){return this.context?this.context.requestAnimationFrame(e):ct(e)},e.prototype.cancelAnimationFrame=function(e){this.context?this.context.cancelAnimationFrame(e):function(e){var t;if("undefined"!=typeof window){var i=window;t=i.cancelAnimationFrame||i.mozCancelAnimationFrame||i.webkitCancelAnimationFrame||i.msCancelAnimationFrame||function(e){return window.clearTimeout(e)}}else t=function(e){return window.clearTimeout(e)};t(e)}(this.loop),this.requestId=null},e.prototype.remove=function(e){var t=this.frames.indexOf(e);t>=0&&this.frames.splice(t,1)},e.prototype.add=function(e,t,i,n){var r=this;void 0===t&&(t=!1),void 0===i&&(i=0),void 0===n&&(n=5);var o={callback:e,once:t,delay:i,order:n};return this.frames.push(o),this.frames.sort((function(e,t){return e.order-t.order})),function(){return r.remove(o)}},e.prototype.disponse=function(){this.stoped=!0,this.frames.length=0},e}(),pt=/^https?\:\/\/?([^\/]+)/;function ft(e,t){return e.replace(pt,(function(e,i){return e.slice(0,e.length-i.length)+t}))}var At={"vrlab-public.ljcdn.com":{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"],default:["vrlab-image4.ljcdn.com"]},"vr-public.realsee-cdn.cn":{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-1.realsee-cdn.cn"],default:["vr-image-4.realsee-cdn.cn"]},"global-public.realsee-cdn.com":{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"],default:["global-image-4.realsee-cdn.com"]},"test-vr-public.realsee-cdn.com":{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"],default:["test-vr-image.realsee-cdn.com"]},"test-vr-public.realsee-cdn.cn":{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"],default:["test-vr-image.realsee-cdn.cn"]}};function gt(e,t){var i=Oe(Oe({},At),t.mappings),n=function(e){var t=e.match(pt);return null===t?null:t[1]}(e);if(null===n)return e;var r=i[n];return r?(/\.basis(\?|$)/.test(e)&&!0!==t.basisLoaderInitialized&&(e=e.replace(/\.basis(\?|$)/,".jpg$1")),function(e,t){var i,n=e.split("?")[0],r=n.split(".").pop();if("jpeg"===r&&(r="jpg"),"png"!==r&&"jpg"!==r)return e;var o="";if(void 0!==t.format&&t.format!==r&&(o+="/format/".concat(t.format)),void 0!==t.cut&&(o+="/cut/".concat(t.cut[2],"x").concat(t.cut[3],"x").concat(t.cut[0],"x").concat(t.cut[1])),void 0!==t.quality){var s=null!==(i=t.format)&&void 0!==i?i:r;s&&["jpg","webp","tpg","heif","avif"].indexOf(s)>=0&&(o+="/quality/".concat(t.quality))}if(void 0!==t.size){var a=e.match(/\/cube_(\d+)\//);(a?Number(a[1]):NaN)!==Number(t.size)&&(o+="/thumbnail/".concat(t.size,"x"))}return void 0!==t.sharpen&&(o+="/sharpen/".concat(t.sharpen)),o.length&&(o="?imageMogr2"+o),n+o}(function(e,t,i){var n=t.split("."),r=n[0],o=n.slice(1);if("texture"===r)return ft(e,i.texture[0]);if("pano"===r||"pano_luminance"===r)switch(o[0],o[1]){case"front":case"left":case"up":return ft(e,i.pano[0]);case"down":case"right":case"back":return ft(e,i.pano[1])}else if("pano_tile"===r||"pano_tile_luminance"===r){o[0],o[1];var s=o[2],a=o[3],l=o[4],u=Math.pow(2,Number(s))*Number(a)+Number(l);if(!isNaN(u))return ft(e,i.tile[u%2])}return ft(e,i.default[0])}(e,t.key,r),t)):e}function mt(e,t,i){return void 0===t&&(t=gt),t(e,i)}function vt(e){return new Promise((function(t){var i=new Image,n=setTimeout((function(){i.onload=i.onerror=function(){},clearTimeout(n),t(!1)}));i.onload=i.onerror=function(){i.onload=i.onerror=function(){},clearTimeout(n),t(2===i.height)},i.src=e}))}var yt=null;var bt=function(){function e(){this.numPlanes=0,this.clipperPlanes=null,this.clipperFloors=null}return Object.defineProperty(e,"shared",{get:function(){return this.sharedInstance||(this.sharedInstance=new e),this.sharedInstance},enumerable:!1,configurable:!0}),e.prototype.update=function(e,t){if(this.clipperFloors=[],e instanceof Array){this.clipperPlanes=new Float32Array(24*e.length);for(var i=function(i){var o=[new n.Plane(new n.Vector3(.5,0,0),-1),new n.Plane(new n.Vector3(-.5,0,0),-1),new n.Plane(new n.Vector3(0,.5,0),-1),new n.Plane(new n.Vector3(0,-.5,0),-1),new n.Plane(new n.Vector3(0,0,.5),-1),new n.Plane(new n.Vector3(0,0,-.5),-1)];o.forEach((function(t){t.applyMatrix4(e[i].clippingBoxMatrix)}));for(var s=r.projectPlanes(o,t),a=0;a<24;a++)r.clipperPlanes[24*i+a]=s[a];var l=e[i].floorIndex?e[i].floorIndex:-1;r.clipperFloors[i]=l},r=this,o=0;o<e.length;o++)i(o)}else{var s=[new n.Plane(new n.Vector3(.5,0,0),-1),new n.Plane(new n.Vector3(-.5,0,0),-1),new n.Plane(new n.Vector3(0,.5,0),-1),new n.Plane(new n.Vector3(0,-.5,0),-1),new n.Plane(new n.Vector3(0,0,.5),-1),new n.Plane(new n.Vector3(0,0,-.5),-1)];s.forEach((function(t){t.applyMatrix4(e.clippingBoxMatrix)})),this.clipperPlanes=this.projectPlanes(s,t),this.clipperFloors[0]=e.floorIndex?e.floorIndex:-1}},e.prototype.projectPlanes=function(e,t){var i=null!==e?e.length:0,r=4*i,o=t.matrixWorldInverse,s=new n.Matrix3;s.getNormalMatrix(o);for(var a=new Float32Array(r),l=new n.Plane,u=0,c=0;u!==i;++u,c+=4)l.copy(e[u]).applyMatrix4(o,s),l.normal.toArray(a,c),a[c+3]=l.constant;return a},e}(),xt=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.floorIndex=0,t.needsRender=!0,t}return ke(t,e),t}(n.Mesh),wt=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.needsRender=!0,t.enableTransparent=!0,t}return ke(t,e),t.prototype.getTransparent=function(){return this.enableTransparent},t.prototype.setTransparent=function(e){this.enableTransparent=e,this.traverse((function(t){t instanceof xt&&t.material.forEach((function(t){t.transparent=e}))}))},t.prototype.getMaterial=function(){var e=null;return this.traverse((function(t){if(null===e&&t instanceof xt){var i=t.material[0];e={pano0:i.pano0,pano1:i.pano1,modelAlpha:i.modelAlpha,progress:i.progress,useBlackTransition:i.useBlackTransition,modelColorInfo:i.modelColorInfo,opacity:i.opacity,floorIndex:i.floorIndex,floorInfo:i.floorInfo,clippers:i.clippers,clipperPlanesArray:i.clipperPlanesArray,clipperFloors:i.clipperFloors}}})),e},t.prototype.setMaterial=function(e){this.traverse((function(t){t instanceof xt&&t.material.forEach((function(t){void 0!==e.pano0&&(t.pano0=e.pano0),void 0!==e.pano1&&(t.pano1=e.pano1),void 0!==e.modelAlpha&&(t.modelAlpha=e.modelAlpha),void 0!==e.progress&&(t.progress=e.progress),void 0!==e.useBlackTransition&&(t.useBlackTransition=e.useBlackTransition),void 0!==e.modelColorInfo&&(t.modelColorInfo=e.modelColorInfo),void 0!==e.opacity&&(t.opacity=e.opacity),void 0!==e.floorIndex&&(t.floorIndex=e.floorIndex),void 0!==e.floorInfo&&(t.floorInfo=e.floorInfo),void 0!==e.clippers&&(t.clippers=e.clippers),void 0!==e.clipperPlanesArray&&(t.clipperPlanesArray=e.clipperPlanesArray),void 0!==e.clipperFloors&&(t.clipperFloors=e.clipperFloors)}))}))},t.prototype.disposeMaterial=function(){this.traverse((function(e){if(e instanceof xt){var t=[];e.material.forEach((function(e){var i=e.uniforms;Object.keys(i).map((function(e){if(/^pano\d\_/.test(e))i[e].value=null;else{var n=i[e].value;n&&"function"==typeof n.dispose&&-1===t.indexOf(n)&&(i[e].value=null,t.push(n))}})),e.dispose()})),t.forEach((function(e){return e.dispose()}))}}))},t.prototype.disposeGeometry=function(){this.traverse((function(e){e instanceof xt&&e.geometry.dispose()}))},t}(n.Group),Mt=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.floorIndex=0,t}return ke(t,e),t}(wt),Et=["right","left","up","down","front","back"];function St(e,t,i,r){var o=new n.Box3;switch(e){case"up":o.min.y=.5,o.max.y=.5,o.min.x=+t-.5,o.max.x=+t-.5+r,o.min.z=.5-i-r,o.max.z=.5-i;break;case"down":o.min.y=-.5,o.max.y=-.5,o.min.x=+t-.5,o.max.x=+t-.5+r,o.min.z=+i-.5,o.max.z=+i-.5+r;break;case"left":o.min.x=-.5,o.max.x=-.5,o.min.z=.5-t-r,o.max.z=.5-t,o.min.y=.5-i-r,o.max.y=.5-i;break;case"right":o.min.x=.5,o.max.x=.5,o.min.z=+t-.5,o.max.z=+t-.5+r,o.min.y=.5-i-r,o.max.y=.5-i;break;case"front":o.min.z=-.5,o.max.z=-.5,o.min.x=+t-.5,o.max.x=+t-.5+r,o.min.y=.5-i-r,o.max.y=.5-i;break;case"back":o.min.z=.5,o.max.z=.5,o.min.x=.5-t-r,o.max.x=.5-t,o.min.y=.5-i-r,o.max.y=.5-i}return o.applyMatrix4((new n.Matrix4).makeRotationY(Math.PI))}var Ct=function(e,t){if(!(e.level>=t))for(var i=e.level+1,r=e.size/2,o=0,s=[new n.Vector2(e.position.x,e.position.y),new n.Vector2(e.position.x+r,e.position.y),new n.Vector2(e.position.x,e.position.y+r),new n.Vector2(e.position.x+r,e.position.y+r)];o<s.length;o++){var a=s[o],l={face:e.face,level:i,size:r,position:a,box:St(e.face,a.x,a.y,r),children:[]};e.children.push(l),Ct(l,t)}};function It(e){var t=Et.map((function(t){return function(e,t){var i={level:0,face:e,position:new n.Vector2(0,0),size:1,box:St(e,0,0,1),children:[]};return Ct(i,t),i}(t,e)}));return{children:t}}function Bt(e,t){for(var i=0,n=e.children;i<n.length;i++){var r=n[i];!1!==t(r)&&Bt(r,t)}}function Tt(e,t){for(var i={},n=0,r=t;n<r.length;n++){var o=r[n];o in e&&(i[o]=e[o])}return i}var Pt=new n.BoxBufferGeometry(1,1,1,1,1);Pt.deleteAttribute("uv"),Pt.deleteAttribute("normal"),Pt.groups=[],Pt.scale(-1,1,1);var Rt,Dt=new n.ShaderMaterial({uniforms:{map:{value:null}},vertexShader:"\nvarying vec3 worldPosition;\nvoid main() {\n vec4 transform = vec4(position, 1.0);\n worldPosition = (modelMatrix * transform).xyz;\n gl_Position = projectionMatrix * modelViewMatrix * transform;\n}\n",fragmentShader:"\nuniform samplerCube map;\nvarying vec3 worldPosition;\nvoid main() {\n gl_FragColor = textureCube(map, worldPosition);\n}\n",depthTest:!1,depthWrite:!1,stencilWrite:!1,blending:n.NoBlending,lights:!1});function Lt(e,t,i){var r=new n.Scene,o=new n.Mesh(Pt,Dt);Dt.uniforms.map.value=e,r.add(o);var s=i.autoClear;i.autoClear=!1,new n.CubeCamera(.1,2,t).update(i,r),i.autoClear=s,Dt.uniforms.map.value=null}var kt=null!==(Rt=Math.SQRT1_2)&&void 0!==Rt?Rt:Math.sqrt(2),Ot={up:new n.Quaternion(kt,0,0,kt),down:new n.Quaternion(-kt,0,0,kt),left:new n.Quaternion(0,kt,0,kt),right:new n.Quaternion(0,-kt,0,kt),front:new n.Quaternion(0,0,0,1),back:new n.Quaternion(0,1,0,0)},Ft=function(){var e=new Float32Array([-.5,-.5,0,.5,-.5,0,-.5,.5,0,.5,.5,0]),t=new Float32Array([0,0,1,0,0,1,1,1]),i=new Uint8Array([0,1,2,1,3,2]),r=new n.BufferGeometry;return r.setAttribute("position",new n.BufferAttribute(e,3)),r.setAttribute("uv",new n.BufferAttribute(t,2)),r.setIndex(new n.BufferAttribute(i,1)),r}();var Nt=[];function Vt(){var e=this.src;this.onerror=this.onload=qe,this.removeAttribute("src"),/^blob\:/.test(e)&&URL.revokeObjectURL(e),this.close=qe}function Qt(){Nt.push(this)}function Ht(){return Object.assign(new Image,{crossOrigin:"",close:Vt})}function qt(e){return new Promise((function(t,i){var n=Ht();n.onload=function(){n.onload=n.onerror=qe,setTimeout((function(){return t(n)}),30)},n.onerror=function(){var e=n.src;n.onload=n.onerror=qe,n.close(),i(new Error("image load error: ".concat(e)))},n.src=URL.createObjectURL(e)}))}function Ut(e,t){if(t&&(e.width>t.width||e.height>t.height)){var i=function(e,t){var i=Nt.shift();if(i)return i.width=e,i.height=t,i;var n=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");return Object.assign(n,{close:Qt})}(Math.min(e.width,t.width),Math.min(e.height,t.height)),r=i.getContext("2d");r.clearRect(0,0,i.width,i.height),r.drawImage(e,0,0,i.width,i.height),e.close();var o=new n.Texture(i);o.needsUpdate=!0,o.flipY=!0;var s=o.dispose;return o.dispose=function(){i.close(),s.call(o),delete o.dispose},o}var a=new n.Texture(e);a.needsUpdate=!0,a.minFilter=n.LinearFilter,a.magFilter=n.LinearFilter,a.flipY=!0;var l=a.dispose;return a.dispose=function(){e.close(),l.call(a),delete a.dispose},a}var zt=new n.WebGLRenderTarget(1,1),jt=new n.OrthographicCamera(-1,1,1,-1,0,1),Kt=new n.BufferGeometry;Kt.setAttribute("position",new n.Float32BufferAttribute([-1,3,0,-1,-1,0,3,-1,0],3)),Kt.setAttribute("uv",new n.Float32BufferAttribute([0,2,0,0,2,0],2));var Gt=new n.Mesh(Kt),_t=new n.Scene;_t.add(Gt);var Wt,Xt=new n.RawShaderMaterial({uniforms:{map:{value:null}},vertexShader:"\n void main() {\n gl_Position = vec4(0, 0, 0, 0);\n }\n ",fragmentShader:"\n uniform sampler2D map;\n void main() {\n gl_FragColor = textureCube(map, vec3(0, 0));\n }\n ",depthTest:!1,depthWrite:!1,blending:n.NoBlending,lights:!1}),Yt=new n.RawShaderMaterial({uniforms:{map:{value:null}},vertexShader:"\n void main() {\n gl_Position = vec4(0, 0, 0, 0);\n }\n ",fragmentShader:"\n uniform samplerCube map;\n void main() {\n gl_FragColor = textureCube(map, vec3(0, 0, 0));\n }\n ",depthTest:!1,depthWrite:!1,blending:n.NoBlending,lights:!1});function Zt(e,t){if(!t)return Promise.resolve(e);var i=t.getRenderTarget();return t.setRenderTarget(zt),e instanceof n.CubeTexture?(Gt.material=Yt,Yt.uniforms.map.value=e,t.render(_t,jt),Yt.uniforms.map.value=null):(Gt.material=Xt,Xt.uniforms.map.value=e,t.render(_t,jt),Yt.uniforms.map.value=null),t.setRenderTarget(i),new Promise((function(t){dt.shared.add((function(){return t(e)}),!0,4)}))}var Jt='\nvar config, transcoderPending, _BasisFile;\nself.onmessage = function(e) {\n var message = e.data;\n switch (message.type) {\n case "init":\n config = message.config;\n init(message.transcoderBinary);\n break;\n case "transcode":\n transcoderPending.then(function() {\n try {\n var result = transcode(message.buffer);\n var width = result.width;\n var height = result.height;\n var hasAlpha = result.hasAlpha;\n var mipmaps = result.mipmaps;\n var format = result.format;\n var buffers = [];\n for (var i = 0; i < mipmaps.length; ++i) {\n buffers.push(mipmaps[i].data.buffer);\n }\n self.postMessage({ type: "transcode", id: message.id, width, height, hasAlpha, mipmaps, format }, buffers);\n } catch (error) {\n console.error(error);\n self.postMessage({ type: "error", id: message.id, error: error.message });\n }\n });\n break;\n default: break;\n }\n};\n\nfunction init(wasmBinary) {\n var BasisModule;\n transcoderPending = new Promise(function(resolve) {\n BasisModule = { wasmBinary, onRuntimeInitialized: resolve };\n BASIS(BasisModule); // eslint-disable-line no-undef\n }).then(function() {\n _BasisFile = BasisModule.BasisFile;\n BasisModule.initializeBasis();\n self.postMessage({ type: "initialized" });\n });\n}\n\nfunction transcode(buffer) {\n var basisFile = new _BasisFile(new Uint8Array(buffer));\n var width = basisFile.getImageWidth(0, 0);\n var height = basisFile.getImageHeight(0, 0);\n var levels = basisFile.getNumLevels(0);\n var hasAlpha = basisFile.getHasAlpha();\n function cleanup() {\n basisFile.close();\n basisFile.delete();\n }\n if (!hasAlpha) {\n switch (config.format) {\n case 9: // Hardcoded: BasisTextureLoader.BASIS_FORMAT.cTFPVRTC1_4_RGBA\n config.format = 8; // Hardcoded: BasisTextureLoader.BASIS_FORMAT.cTFPVRTC1_4_RGB;\n break;\n default: break;\n }\n }\n if (!width || !height || !levels) {\n cleanup();\n throw new Error("BasisTextureLoader: Invalid .basis file");\n }\n if (!basisFile.startTranscoding()) {\n cleanup();\n throw new Error("BasisTextureLoader: .startTranscoding failed");\n }\n var mipmaps = [];\n for (var mip = 0; mip < levels; mip++) {\n var mipWidth = basisFile.getImageWidth(0, mip);\n var mipHeight = basisFile.getImageHeight(0, mip);\n var dst = new Uint8Array(basisFile.getImageTranscodedSizeInBytes(0, mip, config.format));\n var status = basisFile.transcodeImage(dst, 0, mip, config.format, 0, hasAlpha);\n if (!status) {\n cleanup();\n throw new Error("BasisTextureLoader: .transcodeImage failed.");\n }\n mipmaps.push({ data: dst, width: mipWidth, height: mipHeight });\n }\n cleanup();\n return { width, height, hasAlpha, mipmaps, format: config.format };\n}\n',$t={cTFETC1:0,cTFETC2:1,cTFBC1:2,cTFBC3:3,cTFBC4:4,cTFBC5:5,cTFBC7_M6_OPAQUE_ONLY:6,cTFBC7_M5:7,cTFPVRTC1_4_RGB:8,cTFPVRTC1_4_RGBA:9,cTFASTC_4x4:10,cTFATC_RGB:11,cTFATC_RGBA_INTERPOLATED_ALPHA:12,cTFRGBA32:13,cTFRGB565:14,cTFBGR565:15,cTFRGBA4444:16},ei={COMPRESSED_RGB_S3TC_DXT1_EXT:33776,COMPRESSED_RGBA_S3TC_DXT1_EXT:33777,COMPRESSED_RGBA_S3TC_DXT3_EXT:33778,COMPRESSED_RGBA_S3TC_DXT5_EXT:33779},ti=((Wt={})[$t.cTFBC1]=ei.COMPRESSED_RGB_S3TC_DXT1_EXT,Wt[$t.cTFBC3]=ei.COMPRESSED_RGBA_S3TC_DXT5_EXT,Wt),ii=function(){function e(){}return e.setTranscoderPath=function(e){return this.transcoderPath=e,this},e.setWorkerLimit=function(e){return this.workerLimit=e,this},e.isInitialized=function(){return 0!==this.workerPool.filter((function(e){return e._initialized})).length},e.detectSupport=function(t){var i=this.workerConfig;if(i.astcSupported=!!t.extensions.get("WEBGL_compressed_texture_astc"),i.bptcSupported=!!t.extensions.get("EXT_texture_compression_bptc"),i.etcSupported=!!t.extensions.get("WEBGL_compressed_texture_etc1"),i.dxtSupported=!!t.extensions.get("WEBGL_compressed_texture_s3tc"),i.pvrtcSupported=!!t.extensions.get("WEBGL_compressed_texture_pvrtc")||!!t.extensions.get("WEBKIT_WEBGL_compressed_texture_pvrtc"),i.astcSupported)i.format=e.BASIS_FORMAT.cTFASTC_4x4;else if(i.bptcSupported)i.format=e.BASIS_FORMAT.cTFBC7_M5;else if(i.dxtSupported)i.format=e.BASIS_FORMAT.cTFBC3;else if(i.pvrtcSupported)i.format=e.BASIS_FORMAT.cTFPVRTC1_4_RGBA;else{if(!i.etcSupported)throw new Error("BasisTextureLoader: No suitable compressed texture format found.");i.format=e.BASIS_FORMAT.cTFETC1}return this},e.createTexture=function(e){var t,i,r=this,o=e.byteLength,s=this._allocateWorker(o).then((function(n){return t=n,i=r.workerNextTaskID++,new Promise((function(n,r){t._callbacks[i]={resolve:n,reject:r},t.postMessage({type:"transcode",id:i,buffer:e},[e])}))})).then((function(e){var t,i=r.workerConfig,o=e.width,s=e.height,a=e.mipmaps;switch(e.format){case $t.cTFASTC_4x4:t=new n.CompressedTexture(a,o,s,n.RGBA_ASTC_4x4_Format);break;case $t.cTFBC1:case $t.cTFBC3:t=new n.CompressedTexture(a,o,s,ti[i.format],n.UnsignedByteType);break;case $t.cTFETC1:t=new n.CompressedTexture(a,o,s,n.RGB_ETC1_Format);break;case $t.cTFPVRTC1_4_RGB:t=new n.CompressedTexture(a,o,s,n.RGB_PVRTC_4BPPV1_Format);break;case $t.cTFPVRTC1_4_RGBA:t=new n.CompressedTexture(a,o,s,n.RGBA_PVRTC_4BPPV1_Format);break;default:throw new Error("BasisTextureLoader: No supported format available.")}return t.minFilter=1===a.length?n.LinearFilter:n.LinearMipmapLinearFilter,t.magFilter=n.LinearFilter,t.generateMipmaps=!1,t.needsUpdate=!0,t}));return s.catch((function(){return!0})).then((function(){t&&i&&(t._taskLoad-=o,delete t._callbacks[i])})),s},e._initTranscoder=function(){var e=this;if(!this.transcoderPending){var t=new n.FileLoader;t.setPath(this.transcoderPath);var i=new Promise((function(e,i){t.load("basis_transcoder.js",e,void 0,i)})),r=new n.FileLoader;r.setPath(this.transcoderPath),r.setResponseType("arraybuffer");var o=new Promise((function(e,t){r.load("basis_transcoder.wasm",e,void 0,t)}));this.transcoderPending=Promise.all([i,o]).then((function(t){var i=t[0],n=t[1],r=["/* basis_transcoder.js */",i,"/* worker */",Jt].join("\n");e.workerSourceURL=URL.createObjectURL(new Blob([r])),e.transcoderBinary=n}))}return this.transcoderPending},e._allocateWorker=function(e){var t=this;return this._initTranscoder().then((function(){if(t.workerPool.length<t.workerLimit){var i=function(e){var t=new Worker(e);return Object.assign(t,{_callbacks:{},_initialized:!1,_taskLoad:0})}(t.workerSourceURL);i._callbacks={},i._initialized=!1,i._taskLoad=0,i.postMessage({type:"init",config:t.workerConfig,transcoderBinary:t.transcoderBinary}),i.onmessage=function(e){var t=e.data;switch(t.type){case"initialized":i._initialized=!0,console.info("BasisTextureLoader: basis loader initialized");break;case"transcode":i._callbacks[t.id].resolve(t);break;case"error":i._callbacks[t.id].reject(t);break;default:console.error('BasisTextureLoader: Unexpected message, "'.concat(t.type,'"'))}},t.workerPool.push(i)}else t.workerPool.sort((function(e,t){return e._taskLoad>t._taskLoad?-1:1}));var n=t.workerPool[t.workerPool.length-1];return n._taskLoad+=e,n}))},e.prototype.dispose=function(){for(var t=0;t<e.workerPool.length;t++)e.workerPool[t].terminate();return e.workerPool.length=0,this},e.BASIS_FORMAT=$t,e.DXT_FORMAT=ei,e.DXT_FORMAT_MAP=ti,e.transcoderPath="https://vr-public.realsee-cdn.cn/release/static/image/release/five/basis/",e.transcoderBinary=null,e.transcoderPending=null,e.workerLimit=1,e.workerPool=[],e.workerNextTaskID=1,e.workerSourceURL="",e.workerConfig={format:null,astcSupported:!1,bptcSupported:!1,etcSupported:!1,dxtSupported:!1,pvrtcSupported:!1},e}(),ni=["right","left","up","down","front","back"];Object.assign(window,{cubeRenderTargetPool:[]});var ri=function(){function e(e,t,i,n,r){this.tileTree=t,this.tileSources=i,this.options=n,this.renderer=r,this.name="",this.needsRender=!1,this.disposed=!1,this.loadedCubeNodes=new Set,this.loadingCubeNodes=new Set,this.baseCubeTexture=null,this._cubeRenderTarget=null,this.textures=[],this.baseCubeTexture=e}return Object.defineProperty(e.prototype,"cubeRenderTarget",{get:function(){return this._cubeRenderTarget},set:function(e){var t,i,r,o,s;if(null===e)throw new Error("cannot set cubeRenderTarget to null.");e.width!==this.options.textureSize&&e.setSize(this.options.textureSize,this.options.textureSize),e.texture.format=null!==(t=this.options.format)&&void 0!==t?t:n.RGBAFormat,e.texture.minFilter=null!==(i=this.options.minFilter)&&void 0!==i?i:n.LinearFilter,e.texture.magFilter=null!==(r=this.options.magFilter)&&void 0!==r?r:n.LinearFilter,e.texture.wrapS=null!==(o=this.options.wrapS)&&void 0!==o?o:n.ClampToEdgeWrapping,e.texture.wrapT=null!==(s=this.options.wrapT)&&void 0!==s?s:n.ClampToEdgeWrapping,this.baseCubeTexture&&(Lt(this.baseCubeTexture,e,this.renderer),this.baseCubeTexture.dispose(),this.baseCubeTexture=null),this._cubeRenderTarget&&Lt(this._cubeRenderTarget.texture,e,this.renderer),this._cubeRenderTarget=e},enumerable:!1,configurable:!0}),e.prototype.requestTile=function(e){var t,i,r,o,s,a,l=this,u=this.tileSources.filter((function(t){return t.level===e.level}))[0];if(u){var c=u.size,h=Math.pow(2,e.level)*e.position.y,d=Math.pow(2,e.level)*e.position.x,p="".concat((null!==(r=null===(i=null===(t=this.options.imageURL)||void 0===t?void 0:t.options)||void 0===i?void 0:i.key)&&void 0!==r?r:"pano.0").replace(/^pano/,"pano_tile"),".").concat(e.face,".").concat(e.level,".").concat(h,".").concat(d),f=Oe(Oe({},null!==(s=null===(o=this.options.imageURL)||void 0===o?void 0:o.options)&&void 0!==s?s:{basisLoaderInitialized:!1,key:"unknown"}),{key:p,size:c*e.size===this.options.tileImageSize?void 0:this.options.tileImageSize,quality:void 0,cut:[c*e.position.x,c*e.position.y,c*e.size,c*e.size]});this.loadingCubeNodes.add(e),this.options.textureLoader.loadTexture(u[e.face],{imageURL:{transform:null===(a=this.options.imageURL)||void 0===a?void 0:a.transform,options:Oe({},f)},format:n.RGBAFormat,preInit:!1,viaAjax:!1}).then((function(t){l.disposed?t.body.dispose():(l.textures.push({face:e.face,level:e.level,position:e.position,size:new n.Vector2(e.size,e.size),texture:t.body}),l.loadedCubeNodes.add(e))})).catch(qe).then((function(){l.disposed||l.loadingCubeNodes.delete(e)}))}else this.loadedCubeNodes.add(e)},e.prototype.update=function(e,t){var i=this;if(!this.disposed){var r=[];Bt(this.tileTree,(function(n){return!(n.level>t)&&(!i.loadingCubeNodes.has(n)&&(!!e.intersectsBox(n.box)&&(i.loadedCubeNodes.has(n)?void 0:(r.push(n),!1))))}));for(var o=0,s=r;o<s.length;o++){var a=s[o];this.requestTile(a)}if(this.cubeRenderTarget&&this.textures.length){var l=this.textures.splice(0,4);!function(e,t,i){var r=new n.Scene,o=new n.Group;o.scale.set(1,1,-1),r.add(o);for(var s=0,a=e;s<a.length;s++){var l=a[s],u=new n.ShaderMaterial({uniforms:{map:{value:l.texture}},vertexShader:"\nvarying vec2 vUv;\nvoid main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}\n",fragmentShader:"\nuniform sampler2D map;\nvarying vec2 vUv;\nvoid main() {\n gl_FragColor = texture2D(map, vUv);\n}\n",depthTest:!1,depthWrite:!1,blending:n.NoBlending,lights:!1}),c=new n.Group,h=new n.Mesh(Ft,u);h.position.set(l.position.x+l.size.x/2-.5,1-(l.position.y+l.size.y/2)-.5,-.5),h.scale.set(l.size.x,l.size.y,1),c.quaternion.copy(Ot[l.face]),c.add(h),o.add(c)}var d=i.autoClear;i.autoClear=!1,new n.CubeCamera(.1,2,t).update(i,r),i.autoClear=d;for(var p=0,f=[];p<f.length;p++)(u=f[p]).uniforms.map.value=null,u.dispose()}(l,this.cubeRenderTarget,this.renderer),this.needsRender=!0;for(var u=0,c=l;u<c.length;u++){c[u].texture.dispose()}}}},Object.defineProperty(e.prototype,"tilePending",{get:function(){return this.loadingCubeNodes.size},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"texture",{get:function(){if(!this._cubeRenderTarget)throw new Error("cubeRenderTarget never set.");return this._cubeRenderTarget.texture},enumerable:!1,configurable:!0}),e.prototype.dispose=function(){if(!this.disposed){this.disposed=!0,this.baseCubeTexture&&(this.baseCubeTexture.dispose(),this.baseCubeTexture=null),this.loadingCubeNodes.clear(),this.loadedCubeNodes.clear();for(var e=0,t=this.textures;e<t.length;e++){t[e].texture.dispose()}this.textures.length=0}},e}(),oi=function(){function e(e){this.timeout=e.timeout,this.allowHosts=e.allowHosts,this.requestProxy=e.requestProxy,this.networkSubscribe=e.networkSubscribe}return e.prototype.setAllowHosts=function(e){this.allowHosts=e},e.prototype.setRequestProxy=function(e){this.requestProxy=e},e.prototype.setNetworkSubscribe=function(e){this.networkSubscribe=e},e.prototype.loadTexture=function(e,t,i,r,o,s){var a,l,u,c;void 0===t&&(t={}),void 0===i&&(i=qe),void 0===r&&(r=qe),void 0===o&&(o=qe);var h={};void 0!==t.flipY&&(h.flipY=t.flipY),void 0!==t.format&&(h.format=t.format),void 0!==t.minFilter&&(h.minFilter=t.minFilter),void 0!==t.magFilter&&(h.magFilter=t.magFilter);var d=null!==(l=null===(a=t.imageURL)||void 0===a?void 0:a.options)&&void 0!==l?l:{basisLoaderInitialized:!1,key:"unknown"},p=it(e=mt(e,null===(u=t.imageURL)||void 0===u?void 0:u.transform,d)),f={timeout:this.timeout,allowHosts:this.allowHosts,requestProxy:this.requestProxy,networkSubscribe:this.networkSubscribe},A=null!==(c=t.viaAjax)&&void 0!==c&&c,g=tt(e),m=/^https?:/.test(p),v=/\.basis$/.test(nt(e).split("?")[0]);if(g?A=!0:m||(A=!1),A){if(v){var y=null,b="arraybuffer";return!0===t.flipY?Promise.reject(new Error(".basis cannnot set flipY: true.")):st(e,Oe(Oe({},f),{responseType:b}),void 0,void 0,o).then((function(e){return y=e.meta,ii.createTexture(e.body)})).then((function(e){return Object.assign(e,Oe({flipY:!1,encoding:n.sRGBEncoding},Tt(t,["wrapS","wrapT"]))),!1!==t.preInit?Zt(e,s):e})).then((function(e){var t={meta:y,body:e};return i(t),t})).catch((function(e){return r(e),Promise.reject(e)}))}b="blob";return st(e,Oe(Oe({},f),{responseType:b}),void 0,void 0,o).then((function(e){return qt(e.body)})).then((function(e){return Ut(e,t.maxSize)})).then((function(e){return Object.assign(e,h),!1!==t.preInit?Zt(e,s):e})).then((function(e){var t={meta:null,body:e};return i(t),t})).catch((function(e){return r(e),Promise.reject(e)}))}if(v){var x=new Error("cannot load basis texture via image");return r(x),Promise.reject(x)}var w=null,M=Ht();return ut(e,f,void 0,void 0,o,M).then((function(e){return w=e.meta,Ut(e.body,t.maxSize)})).then((function(e){return Object.assign(e,Oe(Oe({},h),{flipY:!0})),!1!==t.preInit?Zt(e,s):e})).then((function(e){var t={meta:w,body:e};return i(t),t})).catch((function(e){return M.close(),r(e),Promise.reject(e)}))},e.prototype.loadCubeTexture=function(e,t,i,r,o,s){var a,l,u,c;void 0===t&&(t={}),void 0===i&&(i=qe),void 0===r&&(r=qe),void 0===o&&(o=qe),void 0!==t.format&&t.format,void 0!==t.minFilter&&t.minFilter,void 0!==t.magFilter&&t.magFilter;for(var h=[e[ni[0]],e[ni[1]],e[ni[2]],e[ni[3]],e[ni[4]],e[ni[5]]],d={timeout:this.timeout,allowHosts:this.allowHosts,requestProxy:this.requestProxy,networkSubscribe:this.networkSubscribe},p=[],f=[0,0,0,0,0,0],A=[],g=function(e){var i=null!==(l=null===(a=t.imageURL)||void 0===a?void 0:a.options)&&void 0!==l?l:{basisLoaderInitialized:!1,key:"unknown"},n=mt(h[e],null===(u=t.imageURL)||void 0===u?void 0:u.transform,Oe(Oe({},i),{key:i.key+"."+ni[e]})),s=it(n),g=function(t){f[e]=t,o(f.reduce((function(e,t){return e+t}),0)/6)},m=null!==(c=t.viaAjax)&&void 0!==c&&c,v=/^https?:$/.test(s),y=tt(n),b=/\.basis$/.test(nt(n).split("?")[0]);if(y?m=!0:v||(m=!1),m)if(b){var x="arraybuffer",w=st(n,Oe(Oe({},d),{responseType:x}),void 0,void 0,g).then((function(t){return A[e]=t.meta,ii.createTexture(t.body)}));p.push(w)}else{x="blob",w=st(n,Oe(Oe({},d),{responseType:x}),void 0,void 0,g).then((function(t){return A[e]=t.meta,qt(t.body)}));p.push(w)}else{if(b){var M=new Error("cannot load basis texture via image");return r(M),{value:Promise.reject(M)}}var E=Ht();w=ut(n,d,void 0,void 0,g,E).then((function(t){return A[e]=t.meta,t.body})).catch((function(e){return E.close(),Promise.reject(e)}));p.push(w)}},m=0;m<6;m++){var v=g(m);if("object"==typeof v)return v.value}return Promise.all(p).then((function(e){var t;if(e[0]instanceof n.CompressedTexture){(t=new n.CubeTexture(e)).needsUpdate=!0;var i=t.dispose;t.dispose=function(){for(var n=0,r=e;n<r.length;n++){r[n].dispose()}i.call(t),delete t.dispose},t.isCompressedTexture=!0,t.format=e[0].format,t.minFilter=e[0].minFilter,t.magFilter=e[0].magFilter}else t=function(e){var t=new n.CubeTexture(e);t.needsUpdate=!0,t.minFilter=n.LinearFilter,t.magFilter=n.LinearFilter,t.flipY=!1;var i=t.dispose;return t.dispose=function(){for(var n=0,r=e;n<r.length;n++)r[n].close();i.call(t),delete t.dispose},t}(e);return t})).then((function(e){return e.isCompressedTexture?Object.assign(e,Oe({flipY:!1,encoding:n.sRGBEncoding},Tt(t,["wrapS","wrapT"]))):Object.assign(e,Oe({flipY:!1,encoding:n.sRGBEncoding},t)),!1!==t.preInit?Zt(e,s):e})).then((function(e){var t={body:e,meta:A};return i(t),t})).catch((function(e){for(var t=0,i=p;t<i.length;t++){i[t].then((function(e){e instanceof n.Texture?e.dispose():e.close()})).catch(qe)}return r(e),Promise.reject(e)}))},e.prototype.loadTiledCubeTexture=function(e,t,i,r,o,s,a){var l=this;return void 0===i&&(i={}),void 0===r&&(r=qe),void 0===o&&(o=qe),void 0===s&&(s=qe),new Promise((function(u,c){var h,d;l.loadCubeTexture(e,{imageURL:{transform:null===(h=i.imageURL)||void 0===h?void 0:h.transform,options:null===(d=i.imageURL)||void 0===d?void 0:d.options},format:n.RGBAFormat,preInit:!1,viaAjax:i.viaAjax},(function(e){var n,o;e.body.generateMipmaps=!1;var s=e.meta,c=e.body,h=null!==(n=i.tileImageSize)&&void 0!==n?n:512,d=null!==(o=i.tileMaxLevel)&&void 0!==o?o:2,p=Math.max(1024*d,512),f=It(d),A={meta:s,body:new ri(c,f,t,{textureSize:p,tileImageSize:h,textureLoader:l,imageURL:i.imageURL},a)};r(A),u(A)}),(function(e){o(e),c(e)}),s,a).catch(qe)}))},e}(),si=function(){var e=113,t=126,i=0,n="";return arguments[i].split(n).map((function(n){return n.charCodeAt(i)>t?n:String.fromCharCode((n.charCodeAt(i)+e)%t)})).join(n)}("n\bv{t-rp@-[|znyHn\bv{t-rp@-cvr]|vv|{Hn\bv{t-rpA-|yq]|vv|{H0v{pyqr-Ip|zz|{K0v{pyqr-Il}nlrrK0v{pyqr-I?l}nlrrK0v{pyqr-Ip|y|l}nlrrK0v{pyqr-Iunq|zn}l}nlrrK|vq-znv{56-\n--0v{pyqr-IlrrK--0v{pyqr-I?lrrK--0v{pyqr-Ip|y|lrrK--0v{pyqr-Iortv{{|znylrrK--0v{pyqr-Iqrsny{|znylrrK--rpA-n{s|zrq-J-rpA5}|vv|{9->;=6H--rpA-z]|vv|{-J-z|qrycvrZnv-7-n{s|zrqH--[|zny-J-{|znyv\tr5n{s|zrq[|zny6H--cvr]|vv|{-J-:z]|vv|{;\b\tH--|yq]|vv|{-J-z|qryZnv-7-n{s|zrqH--tyl]|vv|{-J-}|wrpv|{Znv-7-z|qrycvrZnv-7-n{s|zrqH--0v{pyqr-Iunq|zn}lrrK\f"),ai=function(){var e=113,t=126,i=0,n="";return arguments[i].split(n).map((function(n){return n.charCodeAt(i)>t?n:String.fromCharCode((n.charCodeAt(i)+e)%t)})).join(n)}("0qrsv{r-OYNPXlP\\Y\\_-rpA5=;=EC9-=;>=C9-=;>AF9->;=60qrsv{r-aNb-C;?E@>EB?{vs|z-nz}yrPor-}n{|=lzn}H{vs|z-znA-}n{|=lznvH0vs-qrsv{rq5b`RlYbZV[N[PR6--{vs|z-nz}yrPor-}n{|=lyzv{n{prZn}H0r{qvs{vs|z-nz}yrPor-}n{|>lzn}H{vs|z-znA-}n{|>lznvH0vs-qrsv{rq5b`RlYbZV[N[PR6--{vs|z-nz}yrPor-}n{|>lyzv{n{prZn}H0r{qvs{vs|z-rp@-qvssrH{vs|z-rp@-rzvvrH{vs|z-rp@-}rpynH{vs|z-sy|n-uv{v{rH{vs|z-sy|n-r}|rH{vs|z-sy|n-|}npv\bH{vs|z-sy|n-z|qryNy}unH{vs|z-sy|n-}|trH{vs|z-sy|n-sy||V{qrH0vs-qrsv{rq5b`RlNYYlP\\Y\\_6{vs|z-rp@-z|qryP|y|V{s|H0r{qvs0vs-qrsv{rq5b`Rl]N[\\lcVQR\\6--{vs|z-rp?-}n{|cvqr|lv\trH--{vs|z-znA-}n{|cvqr|lznvH--{vs|z-sy|n-}n{|cvqr|lny}unH--{vs|z-nz}yr?Q-}n{|cvqr|lzn}H0r{qvs0vs-qrsv{rq5b`RlPYV]SY\\\\_6--{vs|z-rp@-sy||V{s|H0r{qvsn\bv{t-rpA-|yq]|vv|{H0vs-qrsv{rq5b`RlPbaR_6--0vs-[bZlPYV]]V[TlN__NflYR[TaU-K-=----{vs|z-rpA-pyv}}r]yn{rNn\bh-[bZlPYV]]V[TlN__NflYR[TaU-jH----{vs|z-sy|n-pyv}}rSy||h[bZlPYV]]V[TlN__NflYR[TaUjH--0r{qvs0r{qvs0v{pyqr-Ip|zz|{K0v{pyqr-I}npxv{tK0v{pyqr-Ip|y|l}nlsntzr{K0v{pyqr-Il}nlsntzr{K0v{pyqr-I?l}nlsntzr{K0v{pyqr-Izn}l}nlsntzr{K0v{pyqr-Iny}unzn}l}nlsntzr{K0v{pyqr-In|zn}l}nlsntzr{K0v{pyqr-Iyvtuzn}l}nlsntzr{K0v{pyqr-Irzvvrzn}l}nlsntzr{K0v{pyqr-Ir{zn}l}nlsntzr{K0v{pyqr-Itnqvr{zn}l}nlsntzr{K0v{pyqr-Is|tl}nlsntzr{K0v{pyqr-IoqsK0v{pyqr-Iyvtul}nlortv{K0v{pyqr-Iyvtul}u|{tl}nlsntzr{K0v{pyqr-Iunq|zn}l}nlsntzr{Krp?-|P||q5rp@-rp|6-\n--sy|n--J-yr{tu5rp|6H--sy|n-urn-J-np|5rp|;\b-<-6H--sy|n-}uv-J-nn{5rp|;9-rp|;\t6H--r{-rp?5=;B-8-}uv-<-aNb9-urn-<-]V6H\f|vq-znv{56-\n--0vs-qrsv{rq5b`RlNYYlP\\Y\\_6----tylSntP|y|-J-rpA5z|qryP|y|V{s|;9z|qryP|y|V{s|;t9z|qryP|y|V{s|;o9>;=6H----r{H--0r{qvsvs-5q|5cvr]|vv|{9-[|zny6-I-=;=6-\n----qvpnqH--\f--<<前置裁切计算--0vs-qrsv{rq5b`RlPbaR_6----rpA-}yn{rH----s|5-v{-v-J-=H-v-I-[bZlPYV]]V[TlO\\eH-v886\n------o||y-pyv}}rq-J-rH------sy|n-pr{Sy||V{qr-J-pyv}}rSy||hvjH------s|-5-v{-w-J-=H-w-I-CH-w-88-6-\n--------}yn{r-J-pyv}}r]yn{rNn\bh-v-7-C-8-w-jH--------pyv}}rq-J-5-q|5-cvr]|vv|{9-}yn{r;\b\t-6-K-}yn{r;-6-33-pyv}}rqH------\f------vs5-pyv}}rq-33-5pr{Sy||V{qr-JJ-:>;=-\v\v-pr{Sy||V{qr-JJ-sy||V{qr66-\n--------qvpnqH------\fH----\f--0r{qvs--<<楼层切割计算--0vs-qrsv{rq5b`RlPYV]SY\\\\_6----vs-5|yq]|vv|{;\b-I-sy||V{s|;-\v\v-|yq]|vv|{;\b-K-sy||V{s|;t6-\n------qvpnqH----\f--0r{qvs--rpA-qvssrP|y|-J-rpA5qvssr;to9-|}npv\b6H--_rsyrprqYvtu-rsyrprqYvtu-J-_rsyrprqYvtu5rp@5=;=69-rp@5=;=69-rp@5=;=69-rp@5=;=66H--rp@-|nyRzvvr_nqvn{pr-J-rzvvrH--0v{pyqr-Izn}lsntzr{K--0v{pyqr-Ip|y|lsntzr{K--0v{pyqr-Iny}unzn}lsntzr{K--0v{pyqr-Iny}unrlsntzr{K--0v{pyqr-I}rpynzn}lsntzr{K--0v{pyqr-I{|znylsntzr{lortv{K--0v{pyqr-I{|znylsntzr{lzn}K--0v{pyqr-Irzvvrzn}lsntzr{K--0v{pyqr-Iyvtul}u|{tlsntzr{K--0v{pyqr-Iyvtulsntzr{lortv{K--<<-调整曝光值--vnqvn{pr-J-vnqvn{pr-7-r}|rH--0v{pyqr-Iyvtulsntzr{lzn}K--0v{pyqr-Iyvtulsntzr{lr{qK--0v{pyqr-In|zn}lsntzr{K--<<-减少方向光对模型的影响--rp@-|t|v{tYvtu-J-5rsyrprqYvtu;qvrpQvssr-7-=;?6-8----rsyrprqYvtu;v{qvrpQvssr-8----rsyrprqYvtu;v{qvrp`}rpyn-8----|nyRzvvr_nqvn{prH--<<-修复黑色面片的问题--vs-5|t|v{tYvtu;-K-=;=-\v\v-|t|v{tYvtu;t-K-=;=-\v\v-|t|v{tYvtu;o-K-=;=6-\n----tylSntP|y|-J-rpA5|t|v{tYvtu9-qvssrP|y|;n6H--\f-ryr-\n----tylSntP|y|-J-rpA5OYNPXlP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666H----sy|n-ny}un-J-pynz}5=;=9->;=9-B;=-7-5>;=-:-pynz}5qvn{pr59-rp?5=;B9-=;B66-<-=;BB-9-=;=9->;=666H----}n{|P|y|-J-zv5}n{|P|y|9-vqr|P|y|9-znpu-7-ny}un-7-}n{|cvqr|lny}un6H--0r{qvs--tylSntP|y|-J-rpA5tylSntP|y|;to9-|}npv\b6H--tylSntP|y|-J-zv5}n{|P|y|9-tylSntP|y|9-z|qryNy}un6H\f"),li=new n.WebGLCubeRenderTarget(1).texture;li.name="EMPTY_TEXTURE";var ui=Object.assign({modelAlpha:new n.Uniform(0),progress:new n.Uniform(0),pano0_map:new n.Uniform(li),pano0_luminanceMap:new n.Uniform(null),pano0_matrix:new n.Uniform(new n.Matrix4),pano1_map:new n.Uniform(li),pano1_luminanceMap:new n.Uniform(null),pano1_matrix:new n.Uniform(new n.Matrix4),floorIndex:-1,floorInfo:new n.Vector3(0,0,0),clipperPlanesArray:new Float32Array,clipperFloors:[],modelColorInfo:new n.Uniform(null)},{exposure:new n.Uniform(1),emissive:new n.Uniform(new n.Color(0)),emissiveMap:new n.Uniform(null),specular:new n.Uniform(new n.Color(1118481)),specularMap:new n.Uniform(null),normalMap:new n.Uniform(null),bumpMap:new n.Uniform(null),shininess:new n.Uniform(30)},n.UniformsUtils.clone(n.UniformsLib.common),n.UniformsUtils.clone(n.UniformsLib.lights)),ci=function(e){function t(t){void 0===t&&(t={});var i,r,o,s,a,l,u,c,h,d=this;d=e.call(this,{vertexShader:si,fragmentShader:ai,uniforms:n.UniformsUtils.clone(ui),defines:{USE_MAP:!0,USE_UV:!0,USE_LUMINANCE:!1,USE_BLACK_TRANSITION:!1,USE_PANO_VIDEO:!1,USE_ALL_COLOR:!1,USE_CLIPFLOOR:!1,USE_CUTER:!1,NUM_CLIPPING_ARRAY_LENGTH:0,NUM_CLIPPING_BOX:0},blending:n.NoBlending,lights:!0})||this;var p=null,f=null;return Object.defineProperties(d,{pano0:{get:function(){return p},set:function(e){p=e,null===e?(this.uniforms.pano0_map.value=li,this.uniforms.pano0_luminanceMap.value=null,this.uniforms.pano0_matrix.value.identity()):(this.uniforms.pano0_map.value=e.map instanceof ri?e.map.texture:e.map,this.uniforms.pano0_luminanceMap.value=e.luminanceMap instanceof ri?e.luminanceMap.texture:e.luminanceMap,this.uniforms.pano0_matrix.value.copy(e.matrix));var t=null!==this.uniforms.pano0_luminanceMap.value&&null!==this.uniforms.pano1_luminanceMap.value;this.defines.USE_LUMINANCE!==t&&(this.defines.USE_LUMINANCE=t,this.needsUpdate=!0)}},pano1:{get:function(){return f},set:function(e){f=e,null===e?(this.uniforms.pano1_map.value=li,this.uniforms.pano1_luminanceMap.value=null,this.uniforms.pano1_matrix.value.identity()):(this.uniforms.pano1_map.value=e.map instanceof ri?e.map.texture:e.map,this.uniforms.pano1_luminanceMap.value=e.luminanceMap instanceof ri?e.luminanceMap.texture:e.luminanceMap,this.uniforms.pano1_matrix.value.copy(e.matrix));var t=null!==this.uniforms.pano0_luminanceMap.value&&null!==this.uniforms.pano1_luminanceMap.value;this.defines.USE_LUMINANCE!==t&&(this.defines.USE_LUMINANCE=t,this.needsUpdate=!0)}},modelAlpha:{get:function(){return this.uniforms.modelAlpha.value},set:function(e){this.uniforms.modelAlpha.value=e}},progress:{get:function(){return this.uniforms.progress.value},set:function(e){this.uniforms.progress.value=e}},useBlackTransition:{get:function(){return this.defines.USE_BLACK_TRANSITION},set:function(e){this.defines.USE_BLACK_TRANSITION!==e&&(this.defines.USE_BLACK_TRANSITION=e,this.needsUpdate=!0)}},modelColorInfo:{get:function(){return this.uniforms.modelColorInfo.value},set:function(e){null===e?this.defines.USE_ALL_COLOR=!1:(this.defines.USE_ALL_COLOR=!0,this.uniforms.modelColorInfo.value=e),this.needsUpdate=!0}},opacity:{get:function(){return this.uniforms.opacity.value},set:function(e){this.uniforms.opacity.value=e;var t=e<1?n.NormalBlending:n.NoBlending;t!==this.blending&&(this.blending=t,this.needsUpdate=!0)}},floorIndex:{get:function(){return this.uniforms.floorIndex.value},set:function(e){this.uniforms.floorIndex.value=e}},floorInfo:{get:function(){return this.uniforms.floorInfo.value},set:function(e){e&&e.equals(new n.Vector3(0,0,0))&&(this.defines.USE_CLIPFLOOR=!1,this.needsUpdate=!0),e&&!e.equals(new n.Vector3(0,0,0))&&(this.defines.USE_CLIPFLOOR=!0,this.uniforms.floorInfo.value=e,this.needsUpdate=!0)}},clippers:{get:function(){return this._clippers},set:function(e){this._clippers=e}},clipperPlanesArray:{get:function(){return this.uniforms.clipperPlanesArray.value},set:function(e){if(e instanceof Float32Array&&e.length>0&&e.length%6==0){var t=e.length/4;this.defines.USE_CUTER=!0,this.defines.NUM_CLIPPING_ARRAY_LENGTH=t,this.defines.NUM_CLIPPING_BOX=t/6,this.uniforms.clipperPlanesArray.value=e,this.needsUpdate=!0}else this.defines.USE_CUTER=!1,this.defines.NUM_CLIPPING_ARRAY_LENGTH=0,this.defines.NUM_CLIPPING_BOX=0,this.uniforms.clipperPlanesArray.value=new Float32Array,this.needsUpdate=!0}},clipperFloors:{get:function(){return this.uniforms.clipperFloors.value},set:function(e){this.uniforms.clipperFloors.value=e}}}),d.pano0=null!==(i=t.pano0)&&void 0!==i?i:null,d.pano1=null!==(r=t.pano1)&&void 0!==r?r:null,d.modelAlpha=null!==(o=t.modelAlpha)&&void 0!==o?o:1,d.progress=null!==(s=t.progress)&&void 0!==s?s:0,d.useBlackTransition=null!==(a=t.useBlackTransition)&&void 0!==a&&a,d.modelColorInfo=null!==(l=t.modelColorInfo)&&void 0!==l?l:null,d.opacity=null!==(u=t.opacity)&&void 0!==u?u:1,d.originOpacity=1,d.floorIndex=null!==(c=t.floorIndex)&&void 0!==c?c:-1,d.floorInfo=null!==(h=t.floorInfo)&&void 0!==h?h:null,d.clippers=null,d.clipperPlanesArray=null,d.clipperFloors=null,d}return ke(t,e),t}(n.ShaderMaterial),hi=function(e){function t(t){var i=t.preserveDrawingBuffer,r=void 0===i||i,o=t.backgroundColor,s=void 0===o?1579548:o,a=t.backgroundAlpha,l=void 0===a?1:a,u=t.pixelRatio,c=void 0===u?1:u,h=t.antialias,d=void 0!==h&&h,p=t.webgl2,f=this;if(void 0!==p&&p){var A=document.createElement("canvas"),g=A.getContext("webgl2");if(null===g)throw new Error("error occurred when getting webgl2 canvas context");f=e.call(this,{antialias:d,preserveDrawingBuffer:r,alpha:l<1,canvas:A,context:g})||this}else f=e.call(this,{antialias:d,preserveDrawingBuffer:r,alpha:l<1})||this;return f.setPixelRatio(c),f.setClearColor(s,l),f.outputEncoding=n.sRGBEncoding,f.autoClear=!0,f}return ke(t,e),t}(n.WebGLRenderer),di=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return ke(t,e),t.prototype.add=function(){for(var t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];return e.prototype.add.apply(this,t)},t.prototype.remove=function(){for(var t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];return e.prototype.remove.apply(this,t)},t}(n.Scene);var pi=2*Math.PI,fi=Math.PI/2;function Ai(e){return e>0&&e<=pi?e:(e%pi+pi)%pi}var gi,mi,vi,yi,bi=function(e){function t(t,i,r,o,s,a){void 0===i&&(i=1),void 0===r&&(r=.1),void 0===o&&(o=1e3),void 0===s&&(s=new n.Vector2),void 0===a&&(a=1);var l=e.call(this)||this;l.fov=t,l.aspect=i,l.near=r,l.far=o,l.perspToOrtho=s,l.orthoDistance=a,l.needsRender=!0,l.pose={longitude:0,latitude:0,fov:t,distance:0,offset:new n.Vector3},l.computePose(),l.perspectiveCamera=new n.PerspectiveCamera(l.fov,l.aspect,l.near,l.far);var u=Math.max(l.orthoDistance,.01)*Math.tan(.5*l.fov/180*Math.PI),c=-.5*l.aspect*2*u;return l.orthographicCamera=new n.OrthographicCamera(c,-c,u,-u,l.near,l.far),l.computeProjectionMatrix(),l.lastValues={position:l.position.clone(),quaternion:l.quaternion.clone(),scale:l.scale.clone(),fov:l.fov,aspect:l.aspect,near:l.near,far:l.far,perspToOrtho:l.perspToOrtho.clone(),orthoDistance:l.orthoDistance},l}return ke(t,e),t.prototype.computePose=function(){var e=this.getWorldDirection(new n.Vector3);return this.pose.longitude=Ai(-Math.atan2(e.x,-e.z)),this.pose.latitude=-Math.asin(e.y/1),this.pose.fov=this.fov,this.pose.distance=0,this.pose.offset.copy(this.position),this},t.prototype.setFromPose=function(e){var t,i,r,o,s,a=Ai(null!==(t=e.longitude)&&void 0!==t?t:this.pose.longitude),l=Math.max(1e-4-fi,Math.min(fi-1e-4,null!==(i=e.latitude)&&void 0!==i?i:this.pose.latitude)),u=null!==(r=e.fov)&&void 0!==r?r:this.pose.fov,c=null!==(o=e.distance)&&void 0!==o?o:this.pose.distance,h=null!==(s=e.offset)&&void 0!==s?s:this.pose.offset,d=function(e){var t=Math.abs(Math.cos(e.latitude));return new n.Vector3(-Math.sin(e.longitude)*t,-Math.sin(e.latitude),-Math.cos(e.longitude)*t)}({longitude:a,latitude:l}).normalize();return this.position.set(0,0,0),this.lookAt(d),this.position.add(h).sub(d.clone().setLength(c)),this.fov!==u&&(this.fov=u,this.updateProjectionMatrix()),this.updateMatrixWorld(),this.pose.longitude=a,this.pose.latitude=l,this.pose.fov=u,this.pose.distance=c,this.pose.offset.copy(h),this.needsRender=!0,this},t.prototype.copyPose=function(){return{longitude:this.pose.longitude,latitude:this.pose.latitude,fov:this.pose.fov,distance:this.pose.distance,offset:this.pose.offset.clone()}},t.prototype.computeProjectionMatrix=function(){!function(e,t,i,n){i=Math.pow(i,2);for(var r=0;r<16;r++)n.elements[r]=e.elements[r]+(t.elements[r]-e.elements[r])*i}(this.orthographicCamera.projectionMatrix,this.perspectiveCamera.projectionMatrix,1-this.perspToOrtho.x,this.projectionMatrix),this.projectionMatrixInverse.getInverse(this.projectionMatrix),this.needsRender=!0},t.prototype.setViewOffset=function(e,t,i,n,r,o){this.perspectiveCamera.setViewOffset(e,t,i,n,r,o),this.orthographicCamera.setViewOffset(e,t,i,n,r,o),this.computeProjectionMatrix()},t.prototype.clearViewOffset=function(){this.perspectiveCamera.clearViewOffset(),this.orthographicCamera.clearViewOffset(),this.computeProjectionMatrix()},t.prototype.updateProjectionMatrix=function(){this.perspectiveCamera.updateProjectionMatrix(),this.orthographicCamera.updateProjectionMatrix(),this.computeProjectionMatrix()},Object.defineProperty(t.prototype,"perspectiveProjectionMatrix",{get:function(){return this.perspectiveCamera.projectionMatrix},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"perspectiveProjectionMatrixInverse",{get:function(){return this.perspectiveCamera.projectionMatrixInverse},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"orthographicProjectionMatrix",{get:function(){return this.orthographicCamera.projectionMatrix},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"orthographicProjectionMatrixInverse",{get:function(){return this.orthographicCamera.projectionMatrixInverse},enumerable:!1,configurable:!0}),t.prototype.updateTime=function(e,t){var i=!1;if(this.lastValues.fov===this.fov&&this.lastValues.near===this.near&&this.lastValues.far===this.far&&this.lastValues.aspect===this.aspect||(this.perspectiveCamera.fov=this.fov,this.perspectiveCamera.near=this.near,this.perspectiveCamera.far=this.far,this.perspectiveCamera.aspect=this.aspect,this.perspectiveCamera.updateProjectionMatrix(),i=!0),!this.lastValues.position.equals(this.position)||!this.lastValues.quaternion.equals(this.quaternion)||!this.lastValues.scale.equals(this.scale)||this.lastValues.orthoDistance!==this.orthoDistance||this.lastValues.fov!==this.fov||this.lastValues.near!==this.near||this.lastValues.far!==this.far||this.lastValues.aspect!==this.aspect){var n=Math.max(this.orthoDistance,.01)*Math.tan(.5*this.fov/180*Math.PI),r=-.5*this.aspect*2*n;this.orthographicCamera.left=r,this.orthographicCamera.right=-r,this.orthographicCamera.top=n,this.orthographicCamera.bottom=-n,this.orthographicCamera.updateProjectionMatrix(),i=!0}this.lastValues.perspToOrtho.equals(this.perspToOrtho)||(i=!0),i&&this.computeProjectionMatrix(),this.lastValues.position.copy(this.position),this.lastValues.quaternion.copy(this.quaternion),this.lastValues.scale.copy(this.scale),this.lastValues.fov=this.fov,this.lastValues.aspect=this.aspect,this.lastValues.near=this.near,this.lastValues.far=this.far,this.lastValues.perspToOrtho.copy(this.perspToOrtho),this.lastValues.orthoDistance=this.orthoDistance},Object.defineProperty(t.prototype,"isPerspectiveCamera",{get:function(){return this.perspToOrtho.x<1},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isOrthographicCamera",{get:function(){return this.perspToOrtho.x>=1},enumerable:!1,configurable:!0}),t.prototype.copy=function(t,i){return e.prototype.copy.call(this,t,i),this.fov=t.fov,this.aspect=t.aspect,this.near=t.near,this.far=t.far,this.perspToOrtho.copy(t.perspToOrtho),this.orthoDistance=t.orthoDistance,this.updateTime(ze(),0),this},t}(n.Camera),xi=function(){function e(e,t,i){this.x=e,this.y=t,this.z=i}return e.prototype.copy=function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this},e.prototype.set=function(e,t,i){return this.x=e,this.y=t,this.z=i,this},e.prototype.fromArray=function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this},e.prototype.add=function(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this},e.prototype.multiplyScalar=function(e){return this.x*=e,this.y*=e,this.z*=e,this},e.prototype.subVectors=function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this},e.prototype.dot=function(e){return this.x*e.x+this.y*e.y+this.z*e.z},e.prototype.cross=function(e){var t=this.x,i=this.y,n=this.z;return this.x=i*e.z-n*e.y,this.y=n*e.x-t*e.z,this.z=t*e.y-i*e.x,this},e.prototype.crossVectors=function(e,t){var i=e.x,n=e.y,r=e.z,o=t.x,s=t.y,a=t.z;return this.x=n*a-r*s,this.y=r*o-i*a,this.z=i*s-n*o,this},e.prototype.clone=function(){return new e(this.x,this.y,this.z)},e}(),wi=function(e,t,i){this.extents=e,this.startIndex=t,this.endIndex=i},Mi=function(e,t){this.triangle=e,this.intersectionPoint=t},Ei=(gi=new xi(0,0,0),mi=new xi(0,0,0),vi=new xi(0,0,0),yi=new xi(0,0,0),function(e,t,i,n,r,o){mi.subVectors(t,e),vi.subVectors(i,e),yi.crossVectors(mi,vi);var s,a=r.dot(yi);if(a>0){if(o)return null;s=1}else{if(!(a<0))return null;s=-1,a=-a}gi.subVectors(n,e);var l=s*r.dot(vi.crossVectors(gi,vi));if(l<0)return null;var u=s*r.dot(mi.cross(gi));if(u<0)return null;if(l+u>a)return null;var c=-s*gi.dot(yi);if(c<0)return null;var h=c/a;return new xi(0,0,0).copy(r).multiplyScalar(h).add(n)}),Si=function(e,t){this.min=e,this.max=t};function Ci(e,t,i){var n=new Si(0,0);t.x>=0?(n.min=(i.extents[0]-e.x)*t.x,n.max=(i.extents[3]-e.x)*t.x):(n.min=(i.extents[3]-e.x)*t.x,n.max=(i.extents[0]-e.x)*t.x);var r=new Si(0,0);if(t.y>=0?(r.min=(i.extents[1]-e.y)*t.y,r.max=(i.extents[4]-e.y)*t.y):(r.min=(i.extents[4]-e.y)*t.y,r.max=(i.extents[1]-e.y)*t.y),n.min>r.max||r.min>n.max)return!1;r.min>n.min&&(n.min=r.min),r.max<n.max&&(n.max=r.max);var o=new Si(0,0);return t.z>=0?(o.min=(i.extents[2]-e.z)*t.z,o.max=(i.extents[5]-e.z)*t.z):(o.min=(i.extents[5]-e.z)*t.z,o.max=(i.extents[2]-e.z)*t.z),!(n.min>o.max||o.min>n.max)&&(o.min>n.min&&(n.min=o.min),o.max<n.max&&(n.max=o.max),!(n.max<0))}function Ii(e,t,i,n,r){if(i>=n)return[0,0,0,0,0,0];for(var o=1/0,s=1/0,a=1/0,l=-1/0,u=-1/0,c=-1/0,h=i,d=void 0,p=void 0;h<n;h++)(p=t[d=6*e[h]])<o&&(o=p),(p=t[d+1])<s&&(s=p),(p=t[d+2])<a&&(a=p),(p=t[d+3])>l&&(l=p),(p=t[d+4])>u&&(u=p),(p=t[d+5])>c&&(c=p);return[o-r,s-r,a-r,l+r,u+r,c+r]}var Bi=function(){function e(){}return e.prototype.create=function(e){return this.trianglesArray=e,this},e.prototype.splitNode=function(e){if(!this.trianglesArray)throw new Error("bvh-tree never perpared. call `create` to initialize.");for(var t=this.trianglesArray,i=t.length/9,n=new Uint32Array(i),r=new Float32Array(6*i),o=[],s=1/0,a=1/0,l=1/0,u=-1/0,c=-1/0,h=-1/0,d=0,p=0,f=0,A=void 0,g=void 0,m=void 0,v=void 0,y=void 0,b=void 0,x=void 0;d<i;d++,p+=6,f+=9)n[d]=d,A=v=t[f],(x=t[f+3])<A&&(A=x),x>v&&(v=x),(x=t[f+6])<A&&(A=x),x>v&&(v=x),g=y=t[f+1],(x=t[f+4])<g&&(g=x),x>y&&(y=x),(x=t[f+7])<g&&(g=x),x>y&&(y=x),m=b=t[f+2],(x=t[f+5])<m&&(m=x),x>b&&(b=x),(x=t[f+8])<m&&(m=x),x>b&&(b=x),A<s&&(s=A),v>u&&(u=v),g<a&&(a=g),y>c&&(c=y),m<l&&(l=m),b>h&&(h=b),r[p]=A,r[p+1]=g,r[p+2]=m,r[p+3]=v,r[p+4]=y,r[p+5]=b;var w,M=new wi([s,a,l,u,c,h],0,i);function E(t){for(var i=t.startIndex,s=t.endIndex,a=t.extents,l=[a[3]-a[0],a[4]-a[1],a[5]-a[2]],u=[0,1,2].sort((function(e,t){return l[t]-l[e]})),c=0;c<3;c++){for(var h=u[c],d=a[h]+a[h+3],p=i,f=s-1,A=-1,g=void 0;p<=f;)-1===A?(g=n[p],r[6*g+h]+r[6*g+h+3]<d?p++:A=g):(g=n[f],r[6*g+h]+r[6*g+h+3]>=d||(n[p]=g,n[f]=A,A=-1,p++),f--);if(p>i&&p<s){var m=new wi(Ii(n,r,i,p,1e-6),i,p);m.endIndex-m.startIndex>e&&o.push(m);var v=new wi(Ii(n,r,p,s,1e-6),p,s);v.endIndex-v.startIndex>e&&o.push(v),t.node0=m,t.node1=v,t.startIndex=0,t.endIndex=0;break}}}for(o.push(M);w=o.pop();)E(w);return this.offsetArray=n,this.rootNode=M,this},e.prototype.intersectRay=function(e,t,i){if(!this.trianglesArray)throw new Error("bvh-tree never perpared. call `create` to initialize.");if(!this.rootNode||!this.offsetArray)throw new Error("bvh-tree never perpared. call `splitNode` to perpare.");for(var n,r=this.trianglesArray,o=this.offsetArray,s=this.rootNode,a=[],l=[],u=new xi(1/t.x,1/t.y,1/t.z),c=[s];n=c.pop();)if(Ci(e,u,n)){n.node0&&c.push(n.node0),n.node1&&c.push(n.node1);for(var h=n.startIndex;h<n.endIndex;h++)a.push(o[h])}for(var d=new xi(0,0,0),p=new xi(0,0,0),f=new xi(0,0,0),A=new xi(e.x,e.y,e.z),g=new xi(t.x,t.y,t.z),m=(h=0,void 0),v=a.length;h<v;h++){m=9*a[h],d.x=r[m],d.y=r[m+1],d.z=r[m+2],p.x=r[m+3],p.y=r[m+3+1],p.z=r[m+3+2],f.x=r[m+6],f.y=r[m+6+1],f.z=r[m+6+2];var y=Ei(d,p,f,A,g,i);y&&l.push(new Mi([d.clone(),p.clone(),f.clone()],y))}return l},e.prototype.dispose=function(){delete this.offsetArray,delete this.rootNode},e}(),Ti=!1,Pi=[];function Ri(e){if(void 0===e&&(e=!1),e||!Ti){Ti=!0;var t=Pi.shift();if(t){try{t()}catch(e){}dt.shared.add((function(){return Ri(!0)}),!0,2)}else Ti=!1}}function Di(e){return new Promise((function(t,i){Pi.push((function(){try{t(e())}catch(e){i(e)}})),Ri()}))}function Li(){var e={OutWindow:function(){this._windowSize=0}};return e.OutWindow.prototype.create=function(e){this._buffer&&this._windowSize===e||(this._buffer=[]),this._windowSize=e,this._pos=0,this._streamPos=0},e.OutWindow.prototype.flush=function(){var e=this._pos-this._streamPos;if(0!==e){for(;e--;)this._stream.writeByte(this._buffer[this._streamPos++]);this._pos>=this._windowSize&&(this._pos=0),this._streamPos=this._pos}},e.OutWindow.prototype.releaseStream=function(){this.flush(),this._stream=null},e.OutWindow.prototype.setStream=function(e){this.releaseStream(),this._stream=e},e.OutWindow.prototype.init=function(e){e||(this._streamPos=0,this._pos=0)},e.OutWindow.prototype.copyBlock=function(e,t){var i=this._pos-e-1;for(i<0&&(i+=this._windowSize);t--;)i>=this._windowSize&&(i=0),this._buffer[this._pos++]=this._buffer[i++],this._pos>=this._windowSize&&this.flush()},e.OutWindow.prototype.putByte=function(e){this._buffer[this._pos++]=e,this._pos>=this._windowSize&&this.flush()},e.OutWindow.prototype.getByte=function(e){var t=this._pos-e-1;return t<0&&(t+=this._windowSize),this._buffer[t]},e.RangeDecoder=function(){},e.RangeDecoder.prototype.setStream=function(e){this._stream=e},e.RangeDecoder.prototype.releaseStream=function(){this._stream=null},e.RangeDecoder.prototype.init=function(){var e=5;for(this._code=0,this._range=-1;e--;)this._code=this._code<<8|this._stream.readByte()},e.RangeDecoder.prototype.decodeDirectBits=function(e){for(var t,i=0,n=e;n--;)this._range>>>=1,t=this._code-this._range>>>31,this._code-=this._range&t-1,i=i<<1|1-t,0==(4278190080&this._range)&&(this._code=this._code<<8|this._stream.readByte(),this._range<<=8);return i},e.RangeDecoder.prototype.decodeBit=function(e,t){var i=e[t],n=(this._range>>>11)*i;return(2147483648^this._code)<(2147483648^n)?(this._range=n,e[t]+=2048-i>>>5,0==(4278190080&this._range)&&(this._code=this._code<<8|this._stream.readByte(),this._range<<=8),0):(this._range-=n,this._code-=n,e[t]-=i>>>5,0==(4278190080&this._range)&&(this._code=this._code<<8|this._stream.readByte(),this._range<<=8),1)},e.initBitModels=function(e,t){for(;t--;)e[t]=1024},e.BitTreeDecoder=function(e){this._models=[],this._numBitLevels=e},e.BitTreeDecoder.prototype.init=function(){e.initBitModels(this._models,1<<this._numBitLevels)},e.BitTreeDecoder.prototype.decode=function(e){for(var t=1,i=this._numBitLevels;i--;)t=t<<1|e.decodeBit(this._models,t);return t-(1<<this._numBitLevels)},e.BitTreeDecoder.prototype.reverseDecode=function(e){for(var t,i=1,n=0,r=0;r<this._numBitLevels;++r)i=i<<1|(t=e.decodeBit(this._models,i)),n|=t<<r;return n},e.reverseDecode2=function(e,t,i,n){for(var r,o=1,s=0,a=0;a<n;++a)o=o<<1|(r=i.decodeBit(e,t+o)),s|=r<<a;return s},e.LenDecoder=function(){this._choice=[],this._lowCoder=[],this._midCoder=[],this._highCoder=new e.BitTreeDecoder(8),this._numPosStates=0},e.LenDecoder.prototype.create=function(t){for(;this._numPosStates<t;++this._numPosStates)this._lowCoder[this._numPosStates]=new e.BitTreeDecoder(3),this._midCoder[this._numPosStates]=new e.BitTreeDecoder(3)},e.LenDecoder.prototype.init=function(){var t=this._numPosStates;for(e.initBitModels(this._choice,2);t--;)this._lowCoder[t].init(),this._midCoder[t].init();this._highCoder.init()},e.LenDecoder.prototype.decode=function(e,t){return 0===e.decodeBit(this._choice,0)?this._lowCoder[t].decode(e):0===e.decodeBit(this._choice,1)?8+this._midCoder[t].decode(e):16+this._highCoder.decode(e)},e.Decoder2=function(){this._decoders=[]},e.Decoder2.prototype.init=function(){e.initBitModels(this._decoders,768)},e.Decoder2.prototype.decodeNormal=function(e){var t=1;do{t=t<<1|e.decodeBit(this._decoders,t)}while(t<256);return 255&t},e.Decoder2.prototype.decodeWithMatchByte=function(e,t){var i,n,r=1;do{if(i=t>>7&1,t<<=1,r=r<<1|(n=e.decodeBit(this._decoders,(1+i<<8)+r)),i!==n){for(;r<256;)r=r<<1|e.decodeBit(this._decoders,r);break}}while(r<256);return 255&r},e.LiteralDecoder=function(){},e.LiteralDecoder.prototype.create=function(t,i){var n;if(!this._coders||this._numPrevBits!==i||this._numPosBits!==t)for(this._numPosBits=t,this._posMask=(1<<t)-1,this._numPrevBits=i,this._coders=[],n=1<<this._numPrevBits+this._numPosBits;n--;)this._coders[n]=new e.Decoder2},e.LiteralDecoder.prototype.init=function(){for(var e=1<<this._numPrevBits+this._numPosBits;e--;)this._coders[e].init()},e.LiteralDecoder.prototype.getDecoder=function(e,t){return this._coders[((e&this._posMask)<<this._numPrevBits)+((255&t)>>>8-this._numPrevBits)]},e.Decoder=function(){this._outWindow=new e.OutWindow,this._rangeDecoder=new e.RangeDecoder,this._isMatchDecoders=[],this._isRepDecoders=[],this._isRepG0Decoders=[],this._isRepG1Decoders=[],this._isRepG2Decoders=[],this._isRep0LongDecoders=[],this._posSlotDecoder=[],this._posDecoders=[],this._posAlignDecoder=new e.BitTreeDecoder(4),this._lenDecoder=new e.LenDecoder,this._repLenDecoder=new e.LenDecoder,this._literalDecoder=new e.LiteralDecoder,this._dictionarySize=-1,this._dictionarySizeCheck=-1,this._posSlotDecoder[0]=new e.BitTreeDecoder(6),this._posSlotDecoder[1]=new e.BitTreeDecoder(6),this._posSlotDecoder[2]=new e.BitTreeDecoder(6),this._posSlotDecoder[3]=new e.BitTreeDecoder(6)},e.Decoder.prototype.setDictionarySize=function(e){return!(e<0)&&(this._dictionarySize!==e&&(this._dictionarySize=e,this._dictionarySizeCheck=Math.max(this._dictionarySize,1),this._outWindow.create(Math.max(this._dictionarySizeCheck,4096))),!0)},e.Decoder.prototype.setLcLpPb=function(e,t,i){var n=1<<i;return!(e>8||t>4||i>4)&&(this._literalDecoder.create(t,e),this._lenDecoder.create(n),this._repLenDecoder.create(n),this._posStateMask=n-1,!0)},e.Decoder.prototype.init=function(){var t=4;for(this._outWindow.init(!1),e.initBitModels(this._isMatchDecoders,192),e.initBitModels(this._isRep0LongDecoders,192),e.initBitModels(this._isRepDecoders,12),e.initBitModels(this._isRepG0Decoders,12),e.initBitModels(this._isRepG1Decoders,12),e.initBitModels(this._isRepG2Decoders,12),e.initBitModels(this._posDecoders,114),this._literalDecoder.init();t--;)this._posSlotDecoder[t].init();this._lenDecoder.init(),this._repLenDecoder.init(),this._posAlignDecoder.init(),this._rangeDecoder.init()},e.Decoder.prototype.decode=function(t,i,n){var r,o,s,a,l,u,c=0,h=0,d=0,p=0,f=0,A=0,g=0;for(this._rangeDecoder.setStream(t),this._outWindow.setStream(i),this.init();n<0||A<n;)if(r=A&this._posStateMask,0===this._rangeDecoder.decodeBit(this._isMatchDecoders,(c<<4)+r))o=this._literalDecoder.getDecoder(A++,g),g=c>=7?o.decodeWithMatchByte(this._rangeDecoder,this._outWindow.getByte(h)):o.decodeNormal(this._rangeDecoder),this._outWindow.putByte(g),c=c<4?0:c-(c<10?3:6);else{if(1===this._rangeDecoder.decodeBit(this._isRepDecoders,c))s=0,0===this._rangeDecoder.decodeBit(this._isRepG0Decoders,c)?0===this._rangeDecoder.decodeBit(this._isRep0LongDecoders,(c<<4)+r)&&(c=c<7?9:11,s=1):(0===this._rangeDecoder.decodeBit(this._isRepG1Decoders,c)?a=d:(0===this._rangeDecoder.decodeBit(this._isRepG2Decoders,c)?a=p:(a=f,f=p),p=d),d=h,h=a),0===s&&(s=2+this._repLenDecoder.decode(this._rangeDecoder,r),c=c<7?8:11);else if(f=p,p=d,d=h,s=2+this._lenDecoder.decode(this._rangeDecoder,r),c=c<7?7:10,(l=this._posSlotDecoder[s<=5?s-2:3].decode(this._rangeDecoder))>=4){if(h=(2|1&l)<<(u=(l>>1)-1),l<14)h+=e.reverseDecode2(this._posDecoders,h-l-1,this._rangeDecoder,u);else if(h+=this._rangeDecoder.decodeDirectBits(u-4)<<4,(h+=this._posAlignDecoder.reverseDecode(this._rangeDecoder))<0){if(-1===h)break;return!1}}else h=l;if(h>=A||h>=this._dictionarySizeCheck)return!1;this._outWindow.copyBlock(h,s),A+=s,g=this._outWindow.getByte(0)}return this._outWindow.flush(),this._outWindow.releaseStream(),this._rangeDecoder.releaseStream(),!0},e.Decoder.prototype.setDecoderProperties=function(e){var t,i,n,r,o;return!(e.size<5)&&(i=(t=e.readByte())%9,n=(t=~~(t/9))%5,r=~~(t/5),!!this.setLcLpPb(i,n,r)&&(o=e.readByte(),o|=e.readByte()<<8,o|=e.readByte()<<16,o+=16777216*e.readByte(),this.setDictionarySize(o)))},e.decompress=function(t,i,n,r){var o=new e.Decoder;if(!o.setDecoderProperties(t))throw"Incorrect stream properties";if(!o.decode(i,n,r))throw"Error in data stream";return!0},e.decompressFile=function(t,i){var n,r=new e.Decoder;if(!r.setDecoderProperties(t))throw"Incorrect stream properties";if(n=t.readByte(),n|=t.readByte()<<8,n|=t.readByte()<<16,n+=16777216*t.readByte(),t.readByte(),t.readByte(),t.readByte(),t.readByte(),!r.decode(t,i,n))throw"Error in data stream";return!0},e}var ki=Li();var Oi="\nvar decodeLZMA = (function() {\n var LZMA = (".concat(Li.toString(),")();\n return function(data, callback) {\n return (").concat(function(e,t,i){try{var n={data:t,offset:0,readByte:function(){return this.data[this.offset++]}},r=n.data.length,o={data:[],offset:0,writeByte:function(e){var t=Math.floor(this.offset/r);this.data[t]||(this.data[t]=new Uint8Array(r)),this.data[t][this.offset%r]=e,this.offset++}};e.decompressFile(n,o);for(var s=new Uint8Array(o.offset),a=0;a<o.offset;a++)s[a]=o.data[Math.floor(a/r)][a%r];i(null,s)}catch(e){i(e)}}.toString(),")(LZMA, data, callback);\n }\n})();\n\nvar decodeLZMAWithWASM = (function() {\n var LZMA_WASM = (").concat(function(){return function(e){for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=new Uint8Array(256),n=0;n<t.length;n++)i[t.charCodeAt(n)]=n;var r,o,s,a,l,u=.75*e.length,c=e.length,h=0;"="===e[e.length-1]&&(u--,"="===e[e.length-2]&&u--);var d=new ArrayBuffer(u),p=new Uint8Array(d);for(r=0;r<c;r+=4)o=i[e.charCodeAt(r)],s=i[e.charCodeAt(r+1)],a=i[e.charCodeAt(r+2)],l=i[e.charCodeAt(r+3)],p[h++]=o<<2|s>>4,p[h++]=(15&s)<<4|a>>2,p[h++]=(3&a)<<6|63&l;return d}("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///wNLBEBBAEHAAEEXQSIQAAALIAEQAiICQQhqIAEQAyAARQRAQQwQASEACyAAQQA2AgAgAEEANgIEIABBADYCCCAAIAI2AgAgAEEANgIEIAAgATYCCCAACwoAQQwQASAAEA4LBgAgABAPCyoAIAEgACgCCE8EQEEAQcAAQSdBPxAAAAsgACgCBCABIAAoAgBqai0ACAssACABIAAoAghPBEBBAEHAAEEyQT8QAAALIAAoAgQgASAAKAIAamogAjo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AAKAJMEBkLyAwBA38DQCABQQNxIAIgAhsEQCAAIgRBAWohACABIgNBAWohASAEIAMtAAA6AAAgAkEBayECDAELCyAAQQNxRQRAA0AgAkEQTwRAIAAgASgCADYCACAAQQRqIAFBBGooAgA2AgAgAEEIaiABQQhqKAIANgIAIABBDGogAUEMaigCADYCACABQRBqIQEgAEEQaiEAIAJBEGshAgwBCwsgAkEIcQRAIAAgASgCADYCACAAQQRqIAFBBGooAgA2AgAgAUEIaiEBIABBCGohAAsgAkEEcQRAIAAgASgCADYCACABQQRqIQEgAEEEaiEACyACQQJxBEAgACABLwEAOwEAIAFBAmohASAAQQJqIQALIAJBAXEEQCAAIAEtAAA6AAALDwsgAkEgTwRAAkACQAJAIABBA3EiA0EBRwRAIANBAkYNASADQQNGDQIMAwsgASgCACEFIAAgASIDLQAAOgAAIABBAWoiASABIANBAWoiAS0AADoAAEEBaiIEQQFqIQAgAUEBaiIDQQFqIQEgBCADLQAAOgAAIAJBA2shAgNAIAJBEU8EQCAAIAFBAWooAgAiA0EIdCAFQRh2cjYCACAAQQRqIAFBBWooAgAiBUEIdCADQRh2cjYCACAAQQhqIAFBCWooAgAiA0EIdCAFQRh2cjYCACAAQQxqIAFBDWooAgAiBUEIdCADQRh2cjYCACABQRBqIQEgAEEQaiEAIAJBEGshAgwBCwsMAgsgASgCACEFIAAgAS0AADoAACAAQQFqIgRBAWohACABQQFqIgNBAWohASAEIAMtAAA6AAAgAkECayECA0AgAkESTwRAIAAgAUECaigCACIDQRB0IAVBEHZyNgIAIABBBGogAUEGaigCACIFQRB0IANBEHZyNgIAIABBCGogAUEKaigCACIDQRB0IAVBEHZyNgIAIABBDGogAUEOaigCACIFQRB0IANBEHZyNgIAIAFBEGohASAAQRBqIQAgAkEQayECDAELCwwBCyABKAIAIQUgACIEQQFqIQAgASIDQQFqIQEgBCADLQAAOgAAIAJBAWshAgNAIAJBE08EQCAAIAFBA2ooAgAiA0EYdCAFQQh2cjYCACAAQQRqIAFBB2ooAgAi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QQN0dHI2AhwgAkEBaiECDAELCyAEIAQoAhw2AhggBCgCGEGAIEkEQCAEQYAgNgIYC0EAIQJBACEFQQAhAwNAAkAgA0EITg0AIAYgA0EFahARQf8BcSIEQf8BRwRAQQEhBQsgBCADQQN0dCACciECIANBAWohAwwBCwsgACgCACAFRToAACAAKAIAKAIEIAE2AgAgACgCABAWAkAgACgCACAFIAIQICIBQQFGDQAgAUEDRwRAIAFBAkYEQCAFBEAgACgCACgCCCgCECACRw0DCwUMAgsLIAAoAgAoAgQtAAQaQQFBACAAKAIAKAIIKAIQIAAoAgAoAggoAgQQIQ8LQQBBAUEAQQAQIQsIACMDIAAQIgsWAEG4ASQAIwAkAUGAgIAIJAIQDCQDCwMAAQsLtwEEAEEICxcKAAAAdQBzAGUAIABzAHQAcgBpAGMAdABBIAsdDQAAAH4AbABpAGIALwBhAHIAcgBhAHkALgB0AHMAQcAACzkbAAAAfgBsAGkAYgAvAGkAbgB0AGUAcgBuAGEAbAAvAHQAeQBwAGUAZABhAHIAcgBhAHkALgB0AHMAQYABCzMYAAAAcwByAGMALwBsAHoAbQBhAC8AbAB6AG0AYQAtAGQAZQBjAG8AZABlAHIALgB0AHM=")}.toString(),")();\n return function(data, callback) {\n return (").concat(function(e,t,i){try{var n=new WebAssembly.Memory({initial:16}),r=new WebAssembly.Module(e),o=new WebAssembly.Instance(r,{env:{memory:n,abort:function(){i(new Error("webAssembly abort"))}}}).exports,s=o.newU8Array(t.length);new Uint8Array(n.buffer,s+24,t.length).set(t);var a=o.decode(s),l=new Uint32Array(n.buffer,a,4),u=l[0],c=l[2],h=l[3];u?i(null,new Uint8Array(n.buffer,h+24,c).slice(0,c)):i(new Error("lzma deocder error"))}catch(e){i(e)}}.toString(),')(LZMA_WASM, data, callback);\n }\n})();\n\nself.onmessage = function(event) {\n var packet = event.data;\n if (!packet.id) {\n postMessage({ id: packet.id, error: "No incoming id." });\n return;\n }\n if (!packet.data) {\n postMessage({ id: packet.id, error: "No input data." });\n return;\n }\n if (packet.type == "decompress") {\n if (packet.data.constructor !== Uint8Array) {\n postMessage({ id: packet.id, error: "Input data is not Uint8Array." });\n }\n const callback = function(error, result) {\n if (error) {\n postMessage({ id: packet.id, error: error.toString() });\n } else {\n postMessage({ id: packet.id, result: result, error: null }, [ result.buffer ]);\n }\n }\n if (typeof WebAssembly !== "undefined" && WebAssembly.instantiate) {\n decodeLZMAWithWASM(packet.data, callback);\n } else {\n decodeLZMA(packet.data, callback);\n }\n return;\n }\n postMessage({ id: packet.id, error: "type never matched." });\n};\n'),Fi="undefined"!=typeof Worker&&"undefined"!=typeof Blob,Ni="";if(Fi)try{var Vi=new Blob([Oi],{type:"text/javascript"});Ni=URL.createObjectURL(Vi)}catch(e){}var Qi=function(){function e(){var e=this;if(!Fi)throw new Error("LZMAWorker cannot work in this broswer.");this.callCounter=0,this.requests={};var t=this.worker=new Worker(Ni);t.onmessage=function(t){var i=t.data,n=i.id,r=i.result,o=i.error,s=e.getKey(n);e.requests[s]&&(o?e.requests[s](new Error(o)):e.requests[s](null,r),delete e.requests[s])},t.onerror=function(e){return console.error(e)}}return e.prototype.getKey=function(e){return"key_"+String(e)},e.prototype.decompress=function(e,t){var i=++this.callCounter;this.requests[this.getKey(i)]=t,this.worker.postMessage({type:"decompress",id:i,data:e},[e.buffer])},e.prototype.terminate=function(){this.worker.terminate()},e.support=Fi,e}();function Hi(e){return Array.prototype.reduce.call(e,(function(e,t,i){return e|t<<8*i}),0)}function qi(e){var t=new Uint8Array(e),i=Hi(t.slice(0,4));if(i>10)return Promise.reject(new Error("LZMA got too many sub chunks."));for(var n=[],r=[],o=4+4*i,s=0;s<i;s++)r[s]=Hi(t.slice(4+4*s,8+4*s)),n[s]=s===i-1?t.subarray(o,o+r[s]):t.slice(o,o+r[s]),o+=r[s];return Qi.support?function(e){for(var t=[],i=e.length,n=function(i){t.push(new Promise((function(t,n){var r=new Qi;r.decompress(e[i],(function(e,i){if(r.terminate(),e)return n(e);t(i)}))})))},r=0;r<i;r++)n(r);return Promise.all(t)}(n):Promise.resolve(function(e){for(var t,i=[],n=e.length,r=function(n){var r={data:e[n],offset:0,readByte:function(){return this.data[this.offset++]}},o=r.data.length,s={data:[],offset:0,writeByte:function(e){var t=Math.floor(this.offset/o);this.data[t]||(this.data[t]=new Uint8Array(o)),this.data[t][this.offset%o]=e,this.offset++}};ki.decompressFile(r,s),t=new Uint8Array(s.offset);for(var a=0;a<s.offset;a++)t[a]=s.data[Math.floor(a/o)][a%o];i.push(t)},o=0;o<n;o++)r(o);return i}(n))}function Ui(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var i=[];e=e.map((function(e){return(null!=e?e:"").trim()})).filter((function(e){return e.length>0&&!/^\/+$/.test(e)}));for(var n=0;n<e.length;n++){var r=0===n,o=n===e.length-1,s=e[n];r||(s=s.replace(/^\/+/,"")),o||(s=s.replace(/\/+$/,"")),i.push(s)}return i.join("/")}const zi=r.Reader,ji=r.util,Ki=r.roots["@REALSEE/FIVE:five/loaders/model/proto/pbm.proto"]||(r.roots["@REALSEE/FIVE:five/loaders/model/proto/pbm.proto"]={}),Gi=Ki.Model=(()=>{function e(e){if(this.chunks=[],e)for(let t=Object.keys(e),i=0;i<t.length;++i)null!=e[t[i]]&&(this[t[i]]=e[t[i]])}return e.prototype.chunks=ji.emptyArray,e.prototype.createAt=ji.Long?ji.Long.fromBits(0,0,!0):0,e.prototype.description="",e.decode=function(e,t){e instanceof zi||(e=zi.create(e));let i=void 0===t?e.len:e.pos+t,n=new Ki.Model;for(;e.pos<i;){let t=e.uint32();switch(t>>>3){case 1:n.chunks&&n.chunks.length||(n.chunks=[]),n.chunks.push(Ki.Chunk.decode(e,e.uint32()));break;case 2:n.createAt=e.uint64();break;case 3:n.description=e.string();break;default:e.skipType(7&t)}}return n},e})();Ki.Chunk=(()=>{function e(e){if(e)for(let t=Object.keys(e),i=0;i<t.length;++i)null!=e[t[i]]&&(this[t[i]]=e[t[i]])}return e.prototype.vertices=null,e.prototype.faces=null,e.prototype.name="",e.prototype.texture="",e.decode=function(e,t){e instanceof zi||(e=zi.create(e));let i=void 0===t?e.len:e.pos+t,n=new Ki.Chunk;for(;e.pos<i;){let t=e.uint32();switch(t>>>3){case 1:n.vertices=Ki.Vertices.decode(e,e.uint32());break;case 2:n.faces=Ki.Faces.decode(e,e.uint32());break;case 3:n.name=e.string();break;case 4:n.texture=e.string();break;default:e.skipType(7&t)}}if(!n.hasOwnProperty("vertices"))throw ji.ProtocolError("missing required 'vertices'",{instance:n});if(!n.hasOwnProperty("faces"))throw ji.ProtocolError("missing required 'faces'",{instance:n});if(!n.hasOwnProperty("name"))throw ji.ProtocolError("missing required 'name'",{instance:n});return n},e})(),Ki.Vertices=(()=>{function e(e){if(this.xyz=[],this.uvs=[],e)for(let t=Object.keys(e),i=0;i<t.length;++i)null!=e[t[i]]&&(this[t[i]]=e[t[i]])}return e.prototype.xyz=ji.emptyArray,e.prototype.uvs=ji.emptyArray,e.decode=function(e,t){e instanceof zi||(e=zi.create(e));let i=void 0===t?e.len:e.pos+t,n=new Ki.Vertices;for(;e.pos<i;){let t=e.uint32();switch(t>>>3){case 1:if(n.xyz&&n.xyz.length||(n.xyz=[]),2==(7&t)){let t=e.uint32()+e.pos;for(;e.pos<t;)n.xyz.push(e.float())}else n.xyz.push(e.float());break;case 2:if(n.uvs&&n.uvs.length||(n.uvs=[]),2==(7&t)){let t=e.uint32()+e.pos;for(;e.pos<t;)n.uvs.push(e.float())}else n.uvs.push(e.float());break;default:e.skipType(7&t)}}return n},e})(),Ki.Faces=(()=>{function e(e){if(this.indices=[],this.normals=[],e)for(let t=Object.keys(e),i=0;i<t.length;++i)null!=e[t[i]]&&(this[t[i]]=e[t[i]])}return e.prototype.indices=ji.emptyArray,e.prototype.normals=ji.emptyArray,e.decode=function(e,t){e instanceof zi||(e=zi.create(e));let i=void 0===t?e.len:e.pos+t,n=new Ki.Faces;for(;e.pos<i;){let t=e.uint32();switch(t>>>3){case 1:if(n.indices&&n.indices.length||(n.indices=[]),2==(7&t)){let t=e.uint32()+e.pos;for(;e.pos<t;)n.indices.push(e.uint32())}else n.indices.push(e.uint32());break;case 2:if(n.normals&&n.normals.length||(n.normals=[]),2==(7&t)){let t=e.uint32()+e.pos;for(;e.pos<t;)n.normals.push(e.float())}else n.normals.push(e.float());break;default:e.skipType(7&t)}}return n},e})();var _i=(new n.Matrix4).set(1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1).elements;function Wi(e){var t=e.match(/(group|floor)-?(\d+)/);return t?parseInt(t[2],10):0}function Xi(e){var t=e.match(/(chunk)-?(\d+)/);return t?parseInt(t[2],10):0}function Yi(e){var t=Wi(e.name),i=Xi(e.name),n=function(e){var t=e.match(/(sub)-?(\d+)/);return t?parseInt(t[2],10):0}(e.name);return 1e6*t+1e3*i+n}function Zi(e,t,i,r,o){var s=Oe({key:"texture.pbm",basisLoaderInitialized:ii.isInitialized()},Tt(t,["format","quality","size","sharpen","mappings"]));return new oi({allowHosts:i,requestProxy:r,networkSubscribe:o}).loadTexture(e,{imageURL:{transform:t.transform,options:s},wrapS:n.ClampToEdgeWrapping,wrapT:n.ClampToEdgeWrapping,minFilter:n.LinearFilter,maxSize:"number"==typeof s.size?new n.Vector2(s.size,s.size):void 0,preInit:!0}).then((function(e){var t=e.body;return t.needsUpdate=!0,t}))}function Ji(e,t,i,r,o,s,a,l){void 0===o&&(o={});for(var u=function(e){for(var t,i,n,r="number"==typeof e.createAt?e.createAt:null===e.createAt||void 0===e.createAt?0:e.createAt.toNumber(),o=null!==(t=e.description)&&void 0!==t?t:"",s=[],a=!0,l=0,u=e.chunks;l<u.length;l++)if(!(ie=u[l]).faces.normals||0===ie.faces.normals.length){a=!1;break}for(var c=e.chunks.sort((function(e,t){return Yi(e)-Yi(t)})),h=[],d=0,p=c;d<p.length;d++){var f=Wi((ie=p[d]).name);h[f]||(h[f]=[]),h[f].push(ie)}for(var A=0;A<h.length;A++){var g=h[A];if(g)if(a){for(var m=0,v=0;v<g.length;v++)m+=(ie=g[v]).faces.indices.length;for(var y=3*m,b=2*m,x=3*m,w=new ArrayBuffer(4*y+4*b+4*x),M=new Float32Array(w,0,y),E=new Float32Array(w,4*y,b),S=new Float32Array(w,4*y+4*b,x),C=[],I=[1/0,1/0,1/0,-1/0,-1/0,-1/0],B=0,T=0;T<g.length;T++){var P=[1/0,1/0,1/0,-1/0,-1/0,-1/0],R=(ie=g[T]).vertices.xyz,D=ie.vertices.uvs,L=ie.faces.indices,k=ie.faces.normals,O=L.length;for(v=0;v<O;v++){var F=L[v],N=R[3*F],V=R[3*F+1],Q=R[3*F+2],H=1/(_i[3]*N+_i[7]*V+_i[11]*Q+_i[15]),q=(_i[0]*N+_i[4]*V+_i[8]*Q+_i[12])*H,U=(_i[1]*N+_i[5]*V+_i[9]*Q+_i[13])*H,z=(_i[2]*N+_i[6]*V+_i[10]*Q+_i[14])*H;M[3*B+3*v]=q,M[3*B+3*v+1]=U,M[3*B+3*v+2]=z,E[2*B+2*v]=D[2*F],E[2*B+2*v+1]=D[2*F+1];var j=3*Math.floor(v/3),K=k[j],G=k[j+1],_=k[j+2],W=1/(_i[3]*K+_i[7]*G+_i[11]*_+_i[15]),X=(_i[0]*K+_i[4]*G+_i[8]*_+_i[12])*W,Y=(_i[1]*K+_i[5]*G+_i[9]*_+_i[13])*W,Z=(_i[2]*K+_i[6]*G+_i[10]*_+_i[14])*W;S[3*B+3*v]=X,S[3*B+3*v+1]=Y,S[3*B+3*v+2]=Z,q<P[0]&&(P[0]=q),U<P[1]&&(P[1]=U),z<P[2]&&(P[2]=z),q>P[3]&&(P[3]=q),U>P[4]&&(P[4]=U),z>P[5]&&(P[5]=z)}P[0]<I[0]&&(I[0]=P[0]),P[1]<I[1]&&(I[1]=P[1]),P[2]<I[2]&&(I[2]=P[2]),P[3]>I[3]&&(I[3]=P[3]),P[4]>I[4]&&(I[4]=P[4]),P[5]>I[5]&&(I[5]=P[5]),C.push({materialIndex:T,name:ie.name,chunkName:Xi(ie.name),start:B,count:ie.faces.indices.length,texture:null!==(i=ie.texture)&&void 0!==i?i:void 0}),B+=O}s.push({createAt:r,description:o,floorIndex:A,vertices:M,uvs:E,indices:null,normals:S,groups:C,extents:I})}else{m=0;var J=0;for(v=0;v<g.length;v++)J+=(ie=g[v]).vertices.xyz.length/3,m+=ie.faces.indices.length;y=3*J,b=2*J,x=3*J;var $=m,ee=(w=new ArrayBuffer(4*y+4*b+4*x+4*$),M=new Float32Array(w,0,y),E=new Float32Array(w,4*y,b),S=new Float32Array(w,4*y+4*b,x),new Uint32Array(w,4*y+4*b+4*x,$)),te=(C=[],I=[1/0,1/0,1/0,-1/0,-1/0,-1/0],0);for(B=0,T=0;T<g.length;T++){P=[1/0,1/0,1/0,-1/0,-1/0,-1/0],R=(ie=g[T]).vertices.xyz,D=ie.vertices.uvs,L=ie.faces.indices;var ie,ne=R.length/3;for(O=L.length,v=0;v<ne;v++)N=R[3*v],V=R[3*v+1],Q=R[3*v+2],H=1/(_i[3]*N+_i[7]*V+_i[11]*Q+_i[15]),q=(_i[0]*N+_i[4]*V+_i[8]*Q+_i[12])*H,U=(_i[1]*N+_i[5]*V+_i[9]*Q+_i[13])*H,z=(_i[2]*N+_i[6]*V+_i[10]*Q+_i[14])*H,M[3*B+3*v]=q,M[3*B+3*v+1]=U,M[3*B+3*v+2]=z,E[2*B+2*v]=D[2*v],E[2*B+2*v+1]=D[2*v+1],q<P[0]&&(P[0]=q),U<P[1]&&(P[1]=U),z<P[2]&&(P[2]=z),q>P[3]&&(P[3]=q),U>P[4]&&(P[4]=U),z>P[5]&&(P[5]=z);for(P[0]<I[0]&&(I[0]=P[0]),P[1]<I[1]&&(I[1]=P[1]),P[2]<I[2]&&(I[2]=P[2]),P[3]>I[3]&&(I[3]=P[3]),P[4]>I[4]&&(I[4]=P[4]),P[5]>I[5]&&(I[5]=P[5]),v=0;v<O;v++)ee[te+v]=B+L[v];C.push({materialIndex:T,name:ie.name,chunkName:Xi(ie.name),start:te,count:ie.faces.indices.length,texture:null!==(n=ie.texture)&&void 0!==n?n:void 0}),B+=ne,te+=O}for(v=0;v<m;v+=3){var re,oe,se,ae,le,ue,ce,he,de,pe,fe,Ae,ge,me,ve,ye;K=void 0,G=void 0,_=void 0,re=3*ee[v],oe=3*ee[v+1],se=3*ee[v+2],ae=M[re],le=M[re+1],ue=M[re+2],ce=M[oe],he=M[oe+1],de=M[oe+2],pe=M[se],K=(Ae=M[se+1]-he)*(ye=ue-de)-(ge=M[se+2]-de)*(ve=le-he),G=ge*(me=ae-ce)-(fe=pe-ce)*ye,_=fe*ve-Ae*me,S[re]+=K,S[re+1]+=G,S[re+2]+=_,S[oe]+=K,S[oe+1]+=G,S[oe+2]+=_,S[se]+=K,S[se+1]+=G,S[se+2]+=_}s.push({createAt:r,description:o,floorIndex:A,vertices:M,uvs:E,indices:ee,normals:S,groups:C,extents:I})}}return s}(e),c=0,h="",d=[],p=0,f=u;p<f.length;p++){var A=f[p],g=A.createAt,m=A.description,v=A.floorIndex,y=A.vertices,b=A.uvs,x=A.indices,w=A.normals,M=A.groups,E=A.extents,S=new n.Box3;S.min.x=E[0],S.min.y=E[1],S.min.z=E[2],S.max.x=E[3],S.max.y=E[4],S.max.z=E[5];var C=new n.BufferGeometry;C.setAttribute("position",new n.BufferAttribute(y,3)),C.setAttribute("uv",new n.BufferAttribute(b,2)),C.setAttribute("normal",new n.BufferAttribute(w,3)),x&&C.setIndex(new n.BufferAttribute(x,1)),C.boundingBox=S,C.boundingSphere=S.getBoundingSphere(new n.Sphere);for(var I=0,B=M;I<B.length;I++){var T=B[I];C.addGroup(T.start,T.count,T.materialIndex)}for(var P=[],R=function(e){var u=i[e.chunkName]||(e.texture?Ui(t,e.texture):void 0),c=new ci;if(P.push(c),u){var h=void 0;u in o?h=o[u]:(h=Zi(u,r,s,a,l),o[u]=h),h.then((function(e){c.uniforms.map.value=e,c.uniforms.exposure.value=3.3}),(function(){c.defines.USE_MAP=!1,c.uniforms.diffuse.value=new n.Color(16777215)}))}else c.defines.USE_MAP=!1,c.uniforms.diffuse.value=new n.Color(16777215);c.uniforms.floorIndex.value=v},D=0,L=M;D<L.length;D++){R(T=L[D])}var k=new xt(C,P);k.name="model_floor_"+v,k.floorIndex=v,k.userData.createAt=g,k.userData.description=m,c=g,h=m,d.push(k)}return{createAt:c,description:h,objects:d,texturePromise:Promise.all(Object.keys(o).map((function(e){return o[e].catch(qe)}))).then(qe)}}function $i(e,t){return!1!==(e=Object.assign({},e)).autoResize&&(t>96?e.size=Math.min(e.size||1/0,100):t>48?e.size=Math.min(e.size||1/0,200):t>24?e.size=Math.min(e.size||1/0,400):t>12?e.size=Math.min(e.size||1/0,800):t>4&&(e.size=Math.min(e.size||1/0,1024))),e}function en(e){return 0===e.indexOf("//")||/^[0-9a-z]+\:/i.test(e)}const tn=r.Reader,nn=r.util,rn=r.roots["@REALSEE/FIVE:five/loaders/model/proto/dome.proto"]||(r.roots["@REALSEE/FIVE:five/loaders/model/proto/dome.proto"]={}),on=rn.Model=(()=>{function e(e){if(this.meshes=[],e)for(let t=Object.keys(e),i=0;i<t.length;++i)null!=e[t[i]]&&(this[t[i]]=e[t[i]])}return e.prototype.meshes=nn.emptyArray,e.decode=function(e,t){e instanceof tn||(e=tn.create(e));let i=void 0===t?e.len:e.pos+t,n=new rn.Model;for(;e.pos<i;){let t=e.uint32();if(t>>>3==1)n.meshes&&n.meshes.length||(n.meshes=[]),n.meshes.push(rn.Mesh.decode(e,e.uint32()));else e.skipType(7&t)}return n},e})();function sn(e){for(var t=[0,0,0],i=0;i<e.attributes.normal.array.length/9;i++)t[0]=e.attributes.normal.array[9*i],t[1]=e.attributes.normal.array[9*i+1],t[2]=e.attributes.normal.array[9*i+2],e.attributes.normal.array[9*i]=e.attributes.normal.array[9*i+6],e.attributes.normal.array[9*i+1]=e.attributes.normal.array[9*i+7],e.attributes.normal.array[9*i+2]=e.attributes.normal.array[9*i+8],e.attributes.normal.array[9*i+6]=t[0],e.attributes.normal.array[9*i+7]=t[1],e.attributes.normal.array[9*i+8]=t[2];for(i=0;i<e.attributes.position.array.length/9;i++)t[0]=e.attributes.position.array[9*i],t[1]=e.attributes.position.array[9*i+1],t[2]=e.attributes.position.array[9*i+2],e.attributes.position.array[9*i]=e.attributes.position.array[9*i+6],e.attributes.position.array[9*i+1]=e.attributes.position.array[9*i+7],e.attributes.position.array[9*i+2]=e.attributes.position.array[9*i+8],e.attributes.position.array[9*i+6]=t[0],e.attributes.position.array[9*i+7]=t[1],e.attributes.position.array[9*i+8]=t[2];for(i=0;i<e.attributes.uv.array.length/6;i++)t[0]=e.attributes.uv.array[6*i],t[1]=e.attributes.uv.array[6*i+1],e.attributes.uv.array[6*i]=e.attributes.uv.array[6*i+4],e.attributes.uv.array[6*i+1]=e.attributes.uv.array[6*i+5],e.attributes.uv.array[6*i+4]=t[0],e.attributes.uv.array[6*i+5]=t[1];e.attributes.normal.needsUpdate=!0,e.attributes.position.needsUpdate=!0,e.attributes.uv.needsUpdate=!0}function an(e){var t=e.position,i=e.normal,r=e.uv,o=e.uv2,s=e.groups,a=new n.BufferGeometry;a.setAttribute("position",new n.BufferAttribute(new Float32Array(t.array),3)),i&&a.setAttribute("normal",new n.BufferAttribute(new Float32Array(i.array),3)),r&&a.setAttribute("uv",new n.BufferAttribute(new Float32Array(r.array),2)),o&&a.setAttribute("uv2",new n.BufferAttribute(new Float32Array(o.array),2));for(var l=0,u=s;l<u.length;l++){var c=u[l];a.addGroup(c.start,c.count,c.materialIndex)}return a}function ln(e,t,i,r,o,s){if(s.hasOwnProperty(e))return s[e];en(e=e.split("?")[0])||(e=Ui(t,e)),0===(e=e.replace(/\/\/vrlab-image\d*.ljcdn.com\//,"//vrlab-public.ljcdn.com/")).indexOf("//")&&(e="https:"+e);var a=Oe({key:"texture.dome",size:64,basisLoaderInitialized:ii.isInitialized()},Tt(i,["quality","format","sharpen","mappings"]));return s[e]=o.loadTexture(e,{imageURL:{transform:i.transform,options:a},wrapS:n.RepeatWrapping,wrapT:n.RepeatWrapping}).then((function(e){var t=e.body;return r&&t.repeat.copy(r),t.needsUpdate=!0,t.updateMatrix(),t}))}function un(e,t,i,r,o){var s=[],a=new ci,l=a.uniforms;l.exposure.value=4.3;var u=a.defines;if(u.USE_MAP=!1,u.USE_UV=!1,e.kd&&(l.diffuse.value=(new n.Color).fromArray(e.kd.rgb)),e.mapkd){var c=null;if(e.mapkdrepeat){var h=e.mapkdrepeat.split(/\s+/).map((function(e){return Number(e)})),d=h[0],p=h[1];c=new n.Vector2(d,p)}s.push(ln(e.mapkd,t,i,c,r,o).then((function(e){u.USE_MAP=!0,u.USE_UV=!0,l.map.value=e,l.uvTransform.value=e.matrix,a.needsUpdate=!0})).catch(qe))}if(e.ks&&(l.specular.value=(new n.Color).fromArray(e.ks.rgb)),e.mapks&&s.push(ln(e.mapks,t,i,null,r,o).then((function(e){l.specularMap.value=e})).catch(qe)),e.ke&&(l.emissive.value=(new n.Color).fromArray(e.ke.rgb)),e.mapke&&s.push(ln(e.mapke,t,i,null,r,o).then((function(e){l.emissiveMap.value=e})).catch(qe)),e.norm&&s.push(ln(e.norm,t,i,null,r,o).then((function(e){l.normalMap.value=e})).catch(qe)),e.mapbump&&s.push(ln(e.mapbump,t,i,null,r,o).then((function(e){l.bumpMap.value=e})).catch(qe)),e.bump&&s.push(ln(e.bump,t,i,null,r,o).then((function(e){l.bumpMap.value=e})).catch(qe)),"number"==typeof e.ns&&(l.shininess.value=e.ns),"number"==typeof e.d){var f=e.d;f>0&&f<1&&(a.originOpacity=f,a.opacity=f)}return{material:a,textureReady:Promise.all(s).then(qe)}}function cn(e,t,i,r,o,s){for(var a,l=[],u=[],c=(a=e,on.decode(a).meshes),h=new oi({allowHosts:r,requestProxy:o,networkSubscribe:s}),d=new n.Matrix4,p=new n.Vector3,f=new n.Quaternion,A=new n.Vector3,g={},m=0,v=c;m<v.length;m++){var y=v[m],b=y.name,x=y.chunks,w=y.matrix;if("Ceiling"!==b&&"CeilingDrop"!==b)for(var M=0,E=w;M<E.length;M++){var S=E[M];d.elements=S.elements;var C=new Mt;C.renderOrder=-3;for(var I=0;I<x.length;I++){var B=an(x[I].geometry);B.applyMatrix4(d),d.decompose(p,f,A),A.x*A.y*A.z<0&&B.attributes.normal&&B.attributes.position&&B.attributes.uv&&sn(B);for(var T=[],P=0,R=x[I].material;P<R.length;P++){var D=un(R[P],t,i,h,g),L=D.material,k=D.textureReady;u.push(k),T.push(L)}var O=new xt(B,T);O.name="chunk_"+I,C.add(O)}C.floorIndex=0,C.name=b,l.push(C)}}return{createAt:0,description:"",objects:l,texturePromise:Promise.all(u).catch(qe)}}rn.Mesh=(()=>{function e(e){if(this.chunks=[],this.matrix=[],e)for(let t=Object.keys(e),i=0;i<t.length;++i)null!=e[t[i]]&&(this[t[i]]=e[t[i]])}return e.prototype.name="",e.prototype.chunks=nn.emptyArray,e.prototype.matrix=nn.emptyArray,e.decode=function(e,t){e instanceof tn||(e=tn.create(e));let i=void 0===t?e.len:e.pos+t,n=new rn.Mesh;for(;e.pos<i;){let t=e.uint32();switch(t>>>3){case 1:n.name=e.string();break;case 2:n.chunks&&n.chunks.length||(n.chunks=[]),n.chunks.push(rn.Chunk.decode(e,e.uint32()));break;case 3:n.matrix&&n.matrix.length||(n.matrix=[]),n.matrix.push(rn.Matrix.decode(e,e.uint32()));break;default:e.skipType(7&t)}}if(!n.hasOwnProperty("name"))throw nn.ProtocolError("missing required 'name'",{instance:n});return n},e})(),rn.Matrix=(()=>{function e(e){if(this.elements=[],e)for(let t=Object.keys(e),i=0;i<t.length;++i)null!=e[t[i]]&&(this[t[i]]=e[t[i]])}return e.prototype.elements=nn.emptyArray,e.decode=function(e,t){e instanceof tn||(e=tn.create(e));let i=void 0===t?e.len:e.pos+t,n=new rn.Matrix;for(;e.pos<i;){let t=e.uint32();if(t>>>3==1)if(n.elements&&n.elements.length||(n.elements=[]),2==(7&t)){let t=e.uint32()+e.pos;for(;e.pos<t;)n.elements.push(e.float())}else n.elements.push(e.float());else e.skipType(7&t)}return n},e})(),rn.Chunk=(()=>{function e(e){if(this.material=[],e)for(let t=Object.keys(e),i=0;i<t.length;++i)null!=e[t[i]]&&(this[t[i]]=e[t[i]])}return e.prototype.geometry=null,e.prototype.material=nn.emptyArray,e.decode=function(e,t){e instanceof tn||(e=tn.create(e));let i=void 0===t?e.len:e.pos+t,n=new rn.Chunk;for(;e.pos<i;){let t=e.uint32();switch(t>>>3){case 2:n.geometry=rn.Geometry.decode(e,e.uint32());break;case 3:n.material&&n.material.length||(n.material=[]),n.material.push(rn.Material.decode(e,e.uint32()));break;default:e.skipType(7&t)}}if(!n.hasOwnProperty("geometry"))throw nn.ProtocolError("missing required 'geometry'",{instance:n});return n},e})(),rn.Geometry=(()=>{function e(e){if(this.groups=[],e)for(let t=Object.keys(e),i=0;i<t.length;++i)null!=e[t[i]]&&(this[t[i]]=e[t[i]])}return e.prototype.position=null,e.prototype.uv=null,e.prototype.uv2=null,e.prototype.normal=null,e.prototype.groups=nn.emptyArray,e.decode=function(e,t){e instanceof tn||(e=tn.create(e));let i=void 0===t?e.len:e.pos+t,n=new rn.Geometry;for(;e.pos<i;){let t=e.uint32();switch(t>>>3){case 1:n.position=rn.Position.decode(e,e.uint32());break;case 2:n.uv=rn.UV.decode(e,e.uint32());break;case 3:n.uv2=rn.UV.decode(e,e.uint32());break;case 4:n.normal=rn.Normal.decode(e,e.uint32());break;case 5:n.groups&&n.groups.length||(n.groups=[]),n.groups.push(rn.Group.decode(e,e.uint32()));break;default:e.skipType(7&t)}}if(!n.hasOwnProperty("position"))throw nn.ProtocolError("missing required 'position'",{instance:n});if(!n.hasOwnProperty("normal"))throw nn.ProtocolError("missing required 'normal'",{instance:n});return n},e})(),rn.Position=(()=>{function e(e){if(this.array=[],e)for(let t=Object.keys(e),i=0;i<t.length;++i)null!=e[t[i]]&&(this[t[i]]=e[t[i]])}return e.prototype.array=nn.emptyArray,e.decode=function(e,t){e instanceof tn||(e=tn.create(e));let i=void 0===t?e.len:e.pos+t,n=new rn.Position;for(;e.pos<i;){let t=e.uint32();if(t>>>3==1)if(n.array&&n.array.length||(n.array=[]),2==(7&t)){let t=e.uint32()+e.pos;for(;e.pos<t;)n.array.push(e.float())}else n.array.push(e.float());else e.skipType(7&t)}return n},e})(),rn.UV=(()=>{function e(e){if(this.array=[],e)for(let t=Object.keys(e),i=0;i<t.length;++i)null!=e[t[i]]&&(this[t[i]]=e[t[i]])}return e.prototype.array=nn.emptyArray,e.decode=function(e,t){e instanceof tn||(e=tn.create(e));let i=void 0===t?e.len:e.pos+t,n=new rn.UV;for(;e.pos<i;){let t=e.uint32();if(t>>>3==1)if(n.array&&n.array.length||(n.array=[]),2==(7&t)){let t=e.uint32()+e.pos;for(;e.pos<t;)n.array.push(e.float())}else n.array.push(e.float());else e.skipType(7&t)}return n},e})(),rn.Normal=(()=>{function e(e){if(this.array=[],e)for(let t=Object.keys(e),i=0;i<t.length;++i)null!=e[t[i]]&&(this[t[i]]=e[t[i]])}return e.prototype.array=nn.emptyArray,e.decode=function(e,t){e instanceof tn||(e=tn.create(e));let i=void 0===t?e.len:e.pos+t,n=new rn.Normal;for(;e.pos<i;){let t=e.uint32();if(t>>>3==1)if(n.array&&n.array.length||(n.array=[]),2==(7&t)){let t=e.uint32()+e.pos;for(;e.pos<t;)n.array.push(e.float())}else n.array.push(e.float());else e.skipType(7&t)}return n},e})(),rn.Group=(()=>{function e(e){if(e)for(let t=Object.keys(e),i=0;i<t.length;++i)null!=e[t[i]]&&(this[t[i]]=e[t[i]])}return e.prototype.start=0,e.prototype.count=0,e.prototype.materialIndex=0,e.decode=function(e,t){e instanceof tn||(e=tn.create(e));let i=void 0===t?e.len:e.pos+t,n=new rn.Group;for(;e.pos<i;){let t=e.uint32();switch(t>>>3){case 1:n.start=e.uint32();break;case 2:n.count=e.uint32();break;case 3:n.materialIndex=e.uint32();break;default:e.skipType(7&t)}}if(!n.hasOwnProperty("start"))throw nn.ProtocolError("missing required 'start'",{instance:n});if(!n.hasOwnProperty("count"))throw nn.ProtocolError("missing required 'count'",{instance:n});if(!n.hasOwnProperty("materialIndex"))throw nn.ProtocolError("missing required 'materialIndex'",{instance:n});return n},e})(),rn.Material=(()=>{function e(e){if(e)for(let t=Object.keys(e),i=0;i<t.length;++i)null!=e[t[i]]&&(this[t[i]]=e[t[i]])}return e.prototype.kd=null,e.prototype.ks=null,e.prototype.ke=null,e.prototype.mapkd="",e.prototype.mapks="",e.prototype.mapke="",e.prototype.norm="",e.prototype.mapbump="",e.prototype.bump="",e.prototype.mapd="",e.prototype.ns=0,e.prototype.d=0,e.prototype.tr=0,e.prototype.mapkdrepeat="",e.decode=function(e,t){e instanceof tn||(e=tn.create(e));let i=void 0===t?e.len:e.pos+t,n=new rn.Material;for(;e.pos<i;){let t=e.uint32();switch(t>>>3){case 1:n.kd=rn.Color.decode(e,e.uint32());break;case 2:n.ks=rn.Color.decode(e,e.uint32());break;case 3:n.ke=rn.Color.decode(e,e.uint32());break;case 4:n.mapkd=e.string();break;case 5:n.mapks=e.string();break;case 6:n.mapke=e.string();break;case 7:n.norm=e.string();break;case 8:n.mapbump=e.string();break;case 9:n.bump=e.string();break;case 10:n.mapd=e.string();break;case 11:n.ns=e.float();break;case 12:n.d=e.float();break;case 13:n.tr=e.float();break;case 14:n.mapkdrepeat=e.string();break;default:e.skipType(7&t)}}return n},e})(),rn.Color=(()=>{function e(e){if(this.rgb=[],e)for(let t=Object.keys(e),i=0;i<t.length;++i)null!=e[t[i]]&&(this[t[i]]=e[t[i]])}return e.prototype.rgb=nn.emptyArray,e.decode=function(e,t){e instanceof tn||(e=tn.create(e));let i=void 0===t?e.len:e.pos+t,n=new rn.Color;for(;e.pos<i;){let t=e.uint32();if(t>>>3==1)if(n.rgb&&n.rgb.length||(n.rgb=[]),2==(7&t)){let t=e.uint32()+e.pos;for(;e.pos<t;)n.rgb.push(e.float())}else n.rgb.push(e.float());else e.skipType(7&t)}return n},e})();var hn={throttleRequests:!0,maxRequests:5},dn=function(){function e(e){void 0===e&&(e={}),this.props=Oe(Oe({},hn),e),this.activeRequestCount=0,this.requestQueue=[],this.requestMap=new Map,this.deferred=null}return e.prototype.scheduleRequest=function(e,t){if(void 0===t&&(t=function(){return 0}),!this.props.throttleRequests)return Promise.resolve({done:function(){}});if(this.requestMap.has(e))return this.requestMap.get(e);var i={identiy:e,priority:0,getPriority:t,resolve:function(){}},n=new Promise((function(e){return i.resolve=e}));return this.requestQueue.push(i),this.requestMap.set(e,n),this.issueNewRequests(),n},e.prototype.issueRequest=function(e){var t=this,i=e.identiy,n=e.resolve,r=!1;this.activeRequestCount++,n({done:function(){r||(r=!0,t.requestMap.delete(i),t.activeRequestCount--,t.issueNewRequests())}})},e.prototype.issueNewRequests=function(){var e=this;this.deferred||(this.deferred=setTimeout((function(){return e.issueNewRequestsAsync()}),0))},e.prototype.issueNewRequestsAsync=function(){this.deferred=null;var e=Math.max(this.props.maxRequests-this.activeRequestCount,0);if(0!==e){this.updateAllRequests();for(var t=0;t<e;t++){var i=this.requestQueue.shift();i&&this.issueRequest(i)}}},e.prototype.updateAllRequests=function(){for(var e=this.requestQueue,t=0;t<e.length;t++){var i=e[t];this.updateRequest(i)||(e.splice(t,1),this.requestMap.delete(i.identiy),t--)}e.sort((function(e,t){return e.priority-t.priority}))},e.prototype.updateRequest=function(e){return e.priority=e.getPriority(e.identiy),!(e.priority<0)||(e.resolve(null),!1)},e}(),pn=function(e,t,i){this.item=e,this.previous=t,this.next=i},fn=function(){function e(){this.head=null,this.tail=null,this._length=0}return Object.defineProperty(e.prototype,"length",{get:function(){return this._length},enumerable:!1,configurable:!0}),e.prototype.add=function(e){var t=new pn(e,this.tail,null);return this.tail?(this.tail.next=t,this.tail=t):(this.head=t,this.tail=t),this._length++,t},e.prototype.remove=function(e){e.previous&&e.next?(e.previous.next=e.next,e.next.previous=e.previous):e.previous?(e.previous.next=null,this.tail=e.previous):e.next?(e.next.previous=null,this.head=e.next):(this.head=null,this.tail=null),e.next=null,e.previous=null,this._length--},e.prototype.splice=function(e,t){e!==t&&(this.remove(t),this.insert(e,t))},e.prototype.insert=function(e,t){var i=e.next;e.next=t,this.tail===e?this.tail=t:i.previous=t,t.next=i,t.previous=e,this._length++},e}(),An=function(){function e(){this.list=new fn,this.sentinel=this.list.add("sentinel")}return e.prototype.reset=function(){this.list.splice(this.list.tail,this.sentinel)},e.prototype.touch=function(e){var t=e.cacheNode;t&&this.list.splice(this.sentinel,t)},e.prototype.add=function(e,t){e.cacheNode||(e.cacheNode=this.list.add(e),t&&t(e))},e.prototype.unloadTile=function(e,t){var i=e.cacheNode;i&&(this.list.remove(i),e.cacheNode=void 0,t&&t(e))},e.prototype.unloadTiles=function(e,t){for(var i=this.list.head;i!==this.sentinel&&e();){var n=i.item;i=i.next,this.unloadTile(n,t)}},e}(),gn=Object.freeze({OUTSIDE:-1,INTERSECTING:0,INSIDE:1}),mn=[new e.Vector3(1,0,0),new e.Vector3(0,1,0),new e.Vector3(0,0,1)],vn=new e.Vector3,yn=new e.Vector3,bn=function(){function t(e){void 0===e&&(e=[]),this.planes=e}return Object.defineProperty(t,"MASK_OUTSIDE",{get:function(){return 4294967295},enumerable:!1,configurable:!0}),Object.defineProperty(t,"MASK_INSIDE",{get:function(){return 0},enumerable:!1,configurable:!0}),Object.defineProperty(t,"MASK_INDETERMINATE",{get:function(){return 2147483647},enumerable:!1,configurable:!0}),t.prototype.fromBoundingSphere=function(t){this.planes.length=2*mn.length;for(var i=t.center,n=t.radius,r=0,o=0,s=mn;o<s.length;o++){var a=s[o],l=this.planes[r],u=this.planes[r+1];l||(l=this.planes[r]=new e.Plane),u||(u=this.planes[r+1]=new e.Plane);var c=vn.copy(a).multiplyScalar(-n).add(i);l.setFromNormalAndCoplanarPoint(a,c);var h=vn.copy(a).multiplyScalar(n).add(i),d=yn.copy(a).negate();u.setFromNormalAndCoplanarPoint(d,h),r+=2}return this},t.prototype.computeVisibilityWithPlaneMask=function(e,i){if(i===t.MASK_OUTSIDE||i===t.MASK_INSIDE)return i;for(var n=t.MASK_INSIDE,r=this.planes,o=0;o<this.planes.length;++o){var s=o<31?1<<o:0;if(!(o<31&&0==(i&s))){var a=r[o],l=e.intersectPlane(a);if(l===gn.OUTSIDE)return t.MASK_OUTSIDE;l===gn.INTERSECTING&&(n|=s)}}return n},t}();var xn=Object.freeze({OUTSIDE:-1,INTERSECTING:0,INSIDE:1}),wn=new e.Vector3,Mn=new e.Vector3,En=function(){function t(t,i){void 0===t&&(t=[0,0,0]),void 0===i&&(i=0),this.radius=-0,this.center=new e.Vector3,this.fromCenterRadius(t,i)}return t.prototype.fromCenterRadius=function(e,t){return this.center.fromArray(e),this.radius=t,this},t.prototype.fromCornerPoints=function(t,i){var n=wn.fromArray(i);return this.center=(new e.Vector3).fromArray(t).add((new e.Vector3).fromArray(i)).multiplyScalar(.5),this.radius=this.center.distanceTo(n),this},t.prototype.equals=function(e){return this===e||Boolean(e)&&this.center.equals(e.center)&&this.radius===e.radius},t.prototype.clone=function(){return new t(this.center.toArray(),this.radius)},t.prototype.union=function(e){var t=this.center,i=this.radius,n=e.center,r=e.radius,o=wn.copy(n).sub(t),s=o.length();if(i>=s+r)return this.clone();if(r>=s+i)return e.clone();var a=.5*(i+s+r);return Mn.copy(o).multiplyScalar((-i+a)/s).add(t),this.center.copy(Mn),this.radius=a,this},t.prototype.expand=function(e){var t=wn.fromArray(e).sub(this.center).length();return t>this.radius&&(this.radius=t),this},t.prototype.transform=function(e){this.center.applyMatrix4(e);var t,i,n,r,o,s,a,l,u,c,h,d=(t=wn.toArray(),i=e.toArray(),n=i[0],r=i[1],o=i[2],s=i[4],a=i[5],l=i[6],u=i[8],c=i[9],h=i[10],t[0]=Math.hypot(n,r,o),t[1]=Math.hypot(s,a,l),t[2]=Math.hypot(u,c,h),t);return this.radius=Math.max(d[0],Math.max(d[1],d[2]))*this.radius,this},t.prototype.distanceSquaredTo=function(e){var t=this.distanceTo(e);return t*t},t.prototype.distanceTo=function(e){var t=wn.fromArray(e).sub(this.center);return Math.max(0,t.length()-this.radius)},t.prototype.intersectPlane=function(e){var t=this.center,i=this.radius,n=e.normal.dot(t)+e.constant;return n<-i?xn.OUTSIDE:n<i?xn.INTERSECTING:xn.INSIDE},t}(),Sn=Object.freeze({OUTSIDE:-1,INTERSECTING:0,INSIDE:1}),Cn=new e.Vector3,In=new e.Vector3,Bn=new e.Vector3,Tn=new e.Vector3,Pn=new e.Vector3,Rn=new e.Vector3,Dn=new e.Vector3,Ln=0,kn=1,On=2,Fn=3,Nn=4,Vn=5,Qn=6,Hn=7,qn=8;function Un(t,i,n){void 0===n&&(n=new e.Vector3);for(var r=3*i,o=new Array(3),s=0;s<3;++s)o[s]=t.toArray()[r+s];return n.fromArray(o)}var zn=function(){function t(t,i){void 0===t&&(t=[0,0,0]),void 0===i&&(i=[0,0,0,0,0,0,0,0,0]),this.center=(new e.Vector3).fromArray(t),this.halfAxes=(new e.Matrix3).fromArray(i)}return t.prototype.clone=function(){return new t(this.center.toArray(),this.halfAxes.toArray())},t.prototype.equals=function(e){return this===e||Boolean(e)&&this.center.equals(e.center)&&this.halfAxes.equals(e.halfAxes)},t.prototype.getBoundingSphere=function(e){void 0===e&&(e=new En);var t=this.halfAxes,i=Un(t,0,Bn),n=Un(t,1,Tn),r=Un(t,2,Pn),o=Cn.copy(i).add(n).add(r);return e.center.copy(this.center),e.radius=o.length(),e},t.prototype.intersectPlane=function(e){var t=this.center,i=e.normal,n=this.halfAxes.toArray(),r=i.x,o=i.y,s=i.z,a=Math.abs(r*n[Ln]+o*n[kn]+s*n[On])+Math.abs(r*n[Fn]+o*n[Nn]+s*n[Vn])+Math.abs(r*n[Qn]+o*n[Hn]+s*n[qn]),l=i.dot(t)+e.constant;return l<=-a?Sn.OUTSIDE:l>=a?Sn.INSIDE:Sn.INTERSECTING},t.prototype.distanceTo=function(e){return Math.sqrt(this.distanceSquaredTo(e))},t.prototype.distanceSquaredTo=function(e){var t=In.fromArray(e).sub(this.center),i=this.halfAxes,n=Un(i,0,Bn),r=Un(i,1,Tn),o=Un(i,2,Pn),s=n.length(),a=r.length(),l=o.length();n.normalize(),r.normalize(),o.normalize();var u,c=0;return(u=Math.abs(t.dot(n))-s)>0&&(c+=u*u),(u=Math.abs(t.dot(r))-a)>0&&(c+=u*u),(u=Math.abs(t.dot(o))-l)>0&&(c+=u*u),c},t.prototype.computePlaneDistances=function(e,t,i){void 0===i&&(i=[-0,-0]);var n=Number.POSITIVE_INFINITY,r=Number.NEGATIVE_INFINITY,o=this.center,s=this.halfAxes,a=Un(s,0,Bn),l=Un(s,1,Tn),u=Un(s,2,Pn),c=Rn.copy(a).add(l).add(u).add(o),h=Dn.copy(c).sub(e),d=t.dot(h);return n=Math.min(d,n),r=Math.max(d,r),c.copy(o).add(a).add(l).sub(u),h.copy(c).sub(e),d=t.dot(h),n=Math.min(d,n),r=Math.max(d,r),c.copy(o).add(a).sub(l).add(u),h.copy(c).sub(e),d=t.dot(h),n=Math.min(d,n),r=Math.max(d,r),c.copy(o).add(a).sub(l).sub(u),h.copy(c).sub(e),d=t.dot(h),n=Math.min(d,n),r=Math.max(d,r),o.copy(c).sub(a).add(l).add(u),h.copy(c).sub(e),d=t.dot(h),n=Math.min(d,n),r=Math.max(d,r),o.copy(c).sub(a).add(l).sub(u),h.copy(c).sub(e),d=t.dot(h),n=Math.min(d,n),r=Math.max(d,r),o.copy(c).sub(a).sub(l).add(u),h.copy(c).sub(e),d=t.dot(h),n=Math.min(d,n),r=Math.max(d,r),o.copy(c).sub(a).sub(l).sub(u),h.copy(c).sub(e),d=t.dot(h),n=Math.min(d,n),r=Math.max(d,r),i[0]=n,i[1]=r,i},t.prototype.transform=function(t){var i=(new e.Matrix4).fromArray(t);this.center.applyMatrix4(i);var n=Un(this.halfAxes,0,Bn);n.applyMatrix4(i);var r=Un(this.halfAxes,1,Tn);r.applyMatrix4(i);var o=Un(this.halfAxes,2,Pn);return o.applyMatrix4(i),this.halfAxes=(new e.Matrix3).fromArray(Fe(Fe(Fe([],n.toArray(),!0),r.toArray(),!0),o.toArray(),!0)),this},t}();function jn(t,i){var n=i.toArray(),r=t.toArray(),o=[0,0,0],s=r[0],a=r[1],l=r[2],u=n[3]*s+n[7]*a+n[11]*l||1;return o[0]=(n[0]*s+n[4]*a+n[8]*l)/u,o[1]=(n[1]*s+n[5]*a+n[9]*l)/u,o[2]=(n[2]*s+n[6]*a+n[10]*l)/u,(new e.Vector3).fromArray(o)}function Kn(e,t){var i=function(e,t,i){var n=i[0],r=i[1],o=i[2],s=i[3],a=t[0],l=t[1],u=t[2],c=r*u-o*l,h=o*a-n*u,d=n*l-r*a,p=r*d-o*h,f=o*c-n*d,A=n*h-r*c,g=2*s;return c*=g,h*=g,d*=g,p*=2,f*=2,A*=2,e[0]=a+c+p,e[1]=l+h+f,e[2]=u+d+A,e}([0,0,0],e.toArray(),t.toArray());e.fromArray(i)}function Gn(t,i){if(t.box)return function(t,i){var n=new e.Vector3(t[0],t[1],t[2]);n.applyMatrix4(i);var r=[];if(10===t.length){var o=t.slice(3,6),s=new e.Quaternion;s.fromArray(t,6);var a=new e.Vector3(1,0,0),l=new e.Vector3(0,1,0),u=new e.Vector3(0,0,1);Kn(a,s),a.multiplyScalar(o[0]),Kn(l,s),l.multiplyScalar(o[1]),Kn(u,s),u.multiplyScalar(o[2]),r=Fe(Fe(Fe([],a.toArray(),!0),l.toArray(),!0),u.toArray(),!0)}else r=Fe(Fe(Fe([],t.slice(3,6),!0),t.slice(6,9),!0),t.slice(9,12),!0);var c=jn((new e.Vector3).fromArray(r.slice(0,3)),i).toArray(),h=jn((new e.Vector3).fromArray(r.slice(3,6)),i).toArray(),d=jn((new e.Vector3).fromArray(r.slice(6,9)),i).toArray(),p=(new e.Matrix3).fromArray([c[0],c[1],c[2],h[0],h[1],h[2],d[0],d[1],d[2]]);return new zn(n.toArray(),p.toArray())}(t.box,i);throw new Error("3D Tile: boundingVolume must only can be box")}function _n(e,t){if(e.dynamicScreenSpaceError&&e.dynamicScreenSpaceErrorComputedDensity){var i=e.dynamicScreenSpaceErrorComputedDensity,n=e.dynamicScreenSpaceErrorFactor,r=function(e,t){var i=e*t;return 1-Math.exp(-i*i)}(t,i)*n;return r}return 0}function Wn(e,t,i){var n=new TextDecoder("utf8"),r=new Uint8Array(e,t,i);return n.decode(r)}function Xn(e,t,i){return void 0===i&&(i=0),i=function(e,t,i){void 0===i&&(i=0);var n=e.header,r=n.featureTableJsonByteLength,o=n.featureTableBinaryByteLength,s=n.batchLength;if(e.featureTableJson={BATCH_LENGTH:s||0},r>0){var a=Wn(t,i,r);e.featureTableJson=JSON.parse(a)}return i+=r,e.featureTableBinary=new Uint8Array(t,i,o),i+=o}(e,t,i),i=function(e,t,i){void 0===i&&(i=0);var n=e.header,r=n.batchTableJsonByteLength,o=n.batchTableBinaryByteLength;if(r>0){var s=Wn(t,i,r);e.batchTableJson=JSON.parse(s),i+=r,o>0&&(e.batchTableBinary=new Uint8Array(t,i,o),e.batchTableBinary=new Uint8Array(e.batchTableBinary),i+=o)}return i}(e,t,i),i}function Yn(e,t,i){void 0===i&&(i=0);var n=e.byteOffset+e.byteLength-i;if(0===n)throw new Error("glTF byte length must be greater than 0.");return e.rotateYtoZ=!0,e.gltfUpAxis="Y",e.gltfArrayBuffer=function(e,t,i){var n=void 0!==i?new Uint8Array(e).subarray(t,t+i):new Uint8Array(e).subarray(t);return new Uint8Array(n).buffer}(t,i,n),e.gltfByteOffset=0,e.gltfByteLength=n,i%4==0||console.warn("".concat(e.type,": embedded glb is not aligned to a 4-byte boundary.")),e.byteOffset+e.byteLength}function Zn(e,t,i){i=function(e,t,i){void 0===i&&(i=0);var n=new DataView(t);if(e.magic=n.getUint32(i,!0),i+=4,e.version=n.getUint32(i,!0),i+=4,e.byteLength=n.getUint32(i,!0),i+=4,1!==e.version)throw new Error("3D Tile Version ".concat(e.version," not supported"));return i}(e,t,i),i=function(e,t,i){void 0===i&&(i=0);var n,r=new DataView(t);e.header=e.header||{};var o=r.getUint32(i,!0);i+=4;var s=r.getUint32(i,!0);i+=4;var a=r.getUint32(i,!0);i+=4;var l=r.getUint32(i,!0);return i+=4,a>=570425344?(i-=8,n=o,a=s,l=0,o=0,s=0,console.warn("b3dm tile in legacy format.")):l>=570425344&&(i-=4,n=a,a=o,l=s,o=0,s=0,console.warn("b3dm tile in legacy format.")),e.header.featureTableJsonByteLength=o,e.header.featureTableBinaryByteLength=s,e.header.batchTableJsonByteLength=a,e.header.batchTableBinaryByteLength=l,e.header.batchLength=n,i}(e,t,i),i=Yn(e,t,i=Xn(e,t,i));var n=e.featureTableJson.RTC_CENTER;return n&&Number.isFinite(n.byteOffset)&&(e.rtcCenter=new Float32Array(e.featureTableBinary.buffer,e.featureTableBinary.buffer.byteOffset+n.byteOffset,3)),i}var Jn=function(){function t(t,i,n){this.header=i,this.tileset=t,this.parent=n,this.children=[],this.contentState="UNLOADED",this.transform=this.header.transform?(new e.Matrix4).fromArray(this.header.transform.slice()):new e.Matrix4;var r=this.parent&&this.parent.computedTransform?this.parent.computedTransform.clone():t.modelMatrix.clone();this.computedTransform=r.clone().multiply(this.transform),this.boundingVolume=Gn(this.header.boundingVolume,this.computedTransform),this.depth=this.parent?this.parent.depth+1:0,this.distanceToCamera=0,this.centerZDepth=0,this.screenSpaceError=0,this.shouldRefine=!1,this.visibilityPlaneMask=bn.MASK_INDETERMINATE,this.visible=!1,this.selectionDepth=0,this.frameNumber=0,this.touchedFrameNumber=0,this.selectedFrameNumber=0,this.requestedFrameNumber=0}return Object.defineProperty(t.prototype,"id",{get:function(){return this.header.id},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"refine",{get:function(){return this.header.refine||this.parent&&this.parent.refine||"REPLACE"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"type",{get:function(){return this.header.type},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"contentUrl",{get:function(){if(this.header.content.uri){var e=this.tileset.b3dmMapping.b3dm_base_url;e=/\/$/.test(e)?e:e+"/";var t=this.tileset.b3dmMapping.b3dm_url[this.header.content.uri];t=/^\//.test(t)?t.slice(1):t;var i=/^https?:/.test(t)?t:e+t;if(-1!==i.indexOf("http")&&-1===i.indexOf("https")){var n=i.slice(4);i="https"+n}return i}return this.header.contentUrl},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lodMetricType",{get:function(){return this.header.lodMetricType},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lodMetricValue",{get:function(){return this.header.lodMetricValue},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"hasEmptyContent",{get:function(){return!this.header.contentUrl},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"selected",{get:function(){return this.selectedFrameNumber===this.tileset.frameNumber},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"hasRenderContent",{get:function(){return!this.hasEmptyContent},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"hasChildren",{get:function(){return this.children.length>0||this.header.children&&this.header.children.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"contentReady",{get:function(){return"READY"===this.contentState||this.hasEmptyContent},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"contentAvailable",{get:function(){return Boolean(this.contentReady&&this.hasRenderContent||!1)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"hasUnloadedContent",{get:function(){return this.hasRenderContent&&this.contentUnloaded},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"contentUnloaded",{get:function(){return"UNLOADED"===this.contentState},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"contentFailed",{get:function(){return"FAILED"===this.contentState},enumerable:!1,configurable:!0}),t.prototype.getScreenSpaceError=function(e,t){if("TILES3D"===this.tileset.type)return function(e,t,i){var n=e.tileset,r=e.parent&&e.parent.lodMetricValue||e.lodMetricValue,o=i?r:e.lodMetricValue;if(0===o)return 0;var s=Math.max(e.distanceToCamera,1e-7),a=n.options.viewDistanceScale,l=o*t.height*a/(s*t.sseDenominator);return l-_n(n,s)}(this,e,t);throw new Error("Unsupported tileset type")},t.prototype.getPriority=function(){var e=this.tileset.traverser,t=e.options.skipLevelOfDetail,i="ADD"===this.refine||t;if(i&&!this.visible)return-1;if(this.tileset.frameNumber-this.touchedFrameNumber>=1)return-1;if("UNLOADED"===this.contentState)return-1;var n=this.parent,r=n&&(!i||0===this.screenSpaceError)?n.screenSpaceError:this.screenSpaceError,o=e.root?e.root.screenSpaceError:0;return Math.max(o-r,0)},t.prototype.loadContent=function(){var e=this;return this.hasEmptyContent||!this.contentUrl?Promise.resolve(!1):this.content?Promise.resolve(!0):(this.contentState="LOADING",this.tileset.requestScheduler.scheduleRequest(this.id,(function(){return e.getPriority()})).then((function(t){return t?st(e.contentUrl,{responseType:"arraybuffer",allowHosts:e.tileset.options.allowHosts,networkSubscribe:e.tileset.options.networkSubscribe,requestProxy:e.tileset.options.requestProxy}).then((function(e){return e.body})).then((function(e){return Zn(t={byteOffset:0,type:"b3dm"},e,t.byteOffset),t;var t})).then((function(i){return e.content=i,e.tileset.options.contentLoader(e).then((function(){return e.contentState="READY",t.done(),!0}))})).catch((function(i){return e.contentState="FAILED",t.done(),Promise.reject(i)})):(e.contentState="UNLOADED",Promise.resolve(!1))})))},t.prototype.unloadContent=function(){this.content=void 0,this.contentState="UNLOADED"},t.prototype.updateVisibility=function(e){if(this.frameNumber!==e.frameNumber){var t=this.parent,i=t?t.visibilityPlaneMask:bn.MASK_INDETERMINATE,n=t?t.computedTransform:this.tileset.modelMatrix;this.updateTransform(n),this.distanceToCamera=this.distanceToTile(e),this.screenSpaceError=this.getScreenSpaceError(e,!1),this.visibilityPlaneMask=this.visibility(e,i),this.visible=this.visibilityPlaneMask!==bn.MASK_OUTSIDE,this.frameNumber=e.frameNumber}},t.prototype.visibility=function(e,t){return e.cullingVolume.computeVisibilityWithPlaneMask(this.boundingVolume,t)},t.prototype.distanceToTile=function(e){return Math.sqrt(Math.max(this.boundingVolume.distanceSquaredTo(e.camera.position),0))},t.prototype.updateTransform=function(t){void 0===t&&(t=new e.Matrix4);var i=t.clone().multiply(this.transform);!i.equals(this.computedTransform)&&(this.computedTransform.copy(i),this.boundingVolume=Gn(this.header.boundingVolume,this.computedTransform))},t}(),$n=function(){function e(){this.map=new Map,this.array=[],this._length=0}return Object.defineProperty(e.prototype,"length",{get:function(){return this._length},enumerable:!1,configurable:!0}),e.prototype.get=function(e){return this.array[e]},e.prototype.set=function(e,t){e>=this.length&&(this._length=e+1),this.map.has(this.array[e])&&this.map.delete(this.array[e]),this.array[e]=t,this.map.set(t,e)},e.prototype.delete=function(e){var t=this.map.get(e);void 0!==t&&t>=0&&(this.array.splice(t,1),this.map.delete(e),this._length--)},e.prototype.push=function(e){if(!this.map.has(e)){var t=this._length++;this.array[t]=e,this.map.set(e,t)}},e.prototype.pop=function(){var e=this.array[--this._length];return this.map.delete(e),e},e.prototype.reset=function(){this.array=[],this.map=new Map,this._length=0},e.prototype.find=function(e){return this.map.has(e)},e}(),er=function(){function e(e){this.options=e,this._traversalStack=new $n,this._emptyTraversalStack=new $n,this._frameNumber=null,this.root=null,this.selectedTiles={},this.requestedTiles={},this.emptyTiles={}}return e.prototype.traverse=function(e,t){this.root=e,this.reset(),this.updateTile(e,t),this._frameNumber=t.frameNumber,this.executeTraversal(e,t)},e.prototype.reset=function(){this.requestedTiles={},this.selectedTiles={},this.emptyTiles={},this._traversalStack.reset(),this._emptyTraversalStack.reset()},e.prototype.executeTraversal=function(e,t){var i=this._traversalStack;for(e.selectionDepth=1,i.push(e);i.length>0;){var n=i.pop(),r=!1;if(this.canTraverse(n,t)){this.updateChildTiles(n,t);var o=n.hasRenderContent?n.selectionDepth+1:n.selectionDepth;r=this.updateAndPushChildren(n,t,i,o)}var s=n.parent,a=Boolean(!s||s.shouldRefine),l=!r;n.hasRenderContent?"ADD"===n.refine?(this.loadTile(n,t),this.selectTile(n,t)):"REPLACE"===n.refine&&(this.loadTile(n,t),l&&this.selectTile(n,t)):(this.emptyTiles[n.id]=n,this.loadTile(n,t),l&&this.selectTile(n,t)),this.touchTile(n,t),n.shouldRefine=r&&a}this.options.onTraversalEnd(t)},e.prototype.updateChildTiles=function(e,t){for(var i=0,n=e.children;i<n.length;i++){var r=n[i];this.updateTile(r,t)}return!0},e.prototype.updateAndPushChildren=function(e,t,i,n){var r=this.options,o=r.loadSiblings,s=r.skipLevelOfDetail,a=e.children;a.sort(this.compareDistanceToCamera.bind(this));for(var l="REPLACE"===e.refine&&e.hasRenderContent&&!s,u=!1,c=!0,h=0,d=a;h<d.length;h++){var p=d[h];if(p.selectionDepth=n,p.visible?(i.find(p)&&i.delete(p),i.push(p),u=!0):(l||o)&&(this.loadTile(p,t),this.touchTile(p,t)),l){var f=void 0;if(f=p.hasRenderContent?p.contentAvailable:this.executeEmptyTraversal(p,t),!(c=c&&f))return!1}}return u||(c=!1),c},e.prototype.updateTile=function(e,t){this.updateTileVisibility(e,t)},e.prototype.selectTile=function(e,t){this.shouldSelectTile(e)&&(e.selectedFrameNumber=t.frameNumber,this.selectedTiles[e.id]=e)},e.prototype.loadTile=function(e,t){this.shouldLoadTile(e)&&(e.requestedFrameNumber=t.frameNumber,this.requestedTiles[e.id]=e)},e.prototype.touchTile=function(e,t){e.tileset.cache.touch(e),e.touchedFrameNumber=t.frameNumber},e.prototype.canTraverse=function(e,t,i,n){return void 0===i&&(i=!1),void 0===n&&(n=!1),!!e.hasChildren&&(!(!n&&!e.visible)&&this.shouldRefine(e,t,i))},e.prototype.shouldLoadTile=function(e){var t=!this.options.maxDepth||e.depth<=this.options.maxDepth;return e.hasUnloadedContent&&t},e.prototype.shouldSelectTile=function(e){var t=!this.options.maxDepth||e.depth<=this.options.maxDepth;return e.contentAvailable&&!this.options.skipLevelOfDetail&&t},e.prototype.shouldRefine=function(e,t,i){var n=e.screenSpaceError;return i&&(n=e.getScreenSpaceError(t,!0)),n>this.options.maxScreenSpaceError},e.prototype.updateTileVisibility=function(e,t){if(e.updateVisibility(t),e.visible){var i=e.children.length>0;this.meetsScreenSpaceErrorEarly(e,t)?e.visible=!1:"REPLACE"!==e.refine||!i||this.anyChildrenVisible(e,t)||(e.visible=!1)}},e.prototype.meetsScreenSpaceErrorEarly=function(e,t){var i=e.parent;return!(!i||"ADD"!==i.refine)&&!this.shouldRefine(e,t,!0)},e.prototype.compareDistanceToCamera=function(e,t){return 0===t.distanceToCamera&&0===e.distanceToCamera?t.centerZDepth-e.centerZDepth:t.distanceToCamera-e.distanceToCamera},e.prototype.anyChildrenVisible=function(e,t){for(var i=!1,n=0,r=e.children;n<r.length;n++){var o=r[n];o.updateVisibility(t),i=i||o.visible}return i},e.prototype.everyChildrenVisibleIsLoaded=function(e){for(var t=!0,i=0,n=e.children;i<n.length;i++){var r=n[i];r.visible&&"READY"!==r.contentState&&(t=!1)}return t},e.prototype.executeEmptyTraversal=function(e,t){var i=!0,n=this._emptyTraversalStack;for(n.push(e);n.length>0&&i;){var r=n.pop();if(this.updateTile(r,t),r.visible||this.loadTile(r,t),this.touchTile(r,t),!r.hasRenderContent&&this.canTraverse(r,t,!1,!0))for(var o=0,s=r.children;o<s.length;o++){var a=s[o];n.find(a)&&n.delete(a),n.push(a)}else r.contentAvailable||(i=!1)}return i},e}();function tr(e){for(var t=[],i=0,n=Object.keys(e);i<n.length;i++){var r=n[i];t.push(e[r])}return t}var ir=function(){function t(e,t){var i=this;this.rawJson=e,this.b3dmMapping=e.b3dmMapping,this.options=t,this.traverser=new er({loadSiblings:!1,maxScreenSpaceError:this.options.maxScreenSpaceError,skipLevelOfDetail:!1,maxDepth:this.options.maxDepth,onTraversalEnd:function(e){return i.onTraversalEnd(e)}}),this.cache=new An,this.requestScheduler=new dn({throttleRequests:this.options.throttleRequests,maxRequests:this.options.maxRequests}),this.frameNumber=0,this.pendingCount=0,this._tiles={},this.selectedTiles=[],this.requestedTiles=[],this.memoryUsageInBytes=0,this.root=new Jn(this,e.root);for(var n=[this.root];n.length>0;)for(var r=n.pop(),o=0,s=r.header.children||[];o<s.length;o++){var a=s[o],l=new Jn(this,a,r);l.depth=r.depth+1,r.children.push(l),n.push(l)}}return Object.defineProperty(t.prototype,"maxMemoryUsage",{get:function(){return this.options.maxMemoryUsage},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"asset",{get:function(){return this.rawJson.asset},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"type",{get:function(){return this.rawJson.type},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"basePath",{get:function(){return this.rawJson.basePath},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"modelMatrix",{get:function(){return this.options.modelMatrix},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"geometricError",{get:function(){return this.rawJson.geometricError},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lodMetricType",{get:function(){return this.rawJson.lodMetricType},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lodMetricValue",{get:function(){return this.rawJson.lodMetricValue},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"refine",{get:function(){return this.rawJson.root.refine},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"tiles",{get:function(){return tr(this._tiles)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"floorInfo",{get:function(){return this.rawJson.floorInfo||this.rawJson.floor_info||[]},enumerable:!1,configurable:!0}),t.prototype.reset=function(){for(var e=[this.root];e.length>0;){for(var t=e.pop(),i=0,n=t.children;i<n.length;i++){var r=n[i];e.push(r)}this.cache.unloadTile(t),this.unloadTile(t)}this.cache.reset(),this.traverser.reset(),this.selectedTiles=[],this.requestedTiles=[]},t.prototype.isLoaded=function(){return 0===this.pendingCount&&0!==this.frameNumber},t.prototype.onTraversalEnd=function(t){var i=this,n=(new e.Vector3).fromArray(t.camera.position);this.selectedTiles=this.options.onTraversalComplete(tr(this.traverser.selectedTiles)),this.requestedTiles=tr(this.traverser.requestedTiles).slice().sort((function(e,t){return e.boundingVolume.center.distanceTo(n)-t.boundingVolume.center.distanceTo(n)}));for(var r=0,o=this.selectedTiles;r<o.length;r++){var s=o[r];this._tiles[s.id]=s}for(var a=0,l=this.requestedTiles;a<l.length;a++){(s=l[a]).contentUnloaded&&this.loadTile(s)}this.cache.unloadTiles((function(){return i.memoryUsageInBytes>1024*i.maxMemoryUsage*1024}),(function(e){return i.unloadTile(e)}))},t.prototype.loadTile=function(e){var t=this;this.pendingCount++,e.loadContent().catch((function(i){var n=i.message||i.toString();return console.error("A 3D tile failed to load: ".concat(e.id," ").concat(n)),t.options.onTileError(e,n),!1})).then((function(i){t.pendingCount--,i&&(t.cache.add(e,(function(){e.content&&(t.memoryUsageInBytes+=e.content.byteLength||0)})),t.options.onTileLoad(e))}))},t.prototype.unloadTile=function(e){this.memoryUsageInBytes-=e.content&&e.content.byteLength||0,this.options.onTileUnload(e),e.unloadContent()},t}();function nr(){return(65536*(1+Math.random())|0).toString(16).substring(1)}function rr(){return(nr()+nr()+"-"+nr()+"-4"+nr().substr(0,3)+"-"+nr()+"-"+nr()+nr()+nr()).toLowerCase()}function or(e,t){var i;return e.content&&(e.contentUrl="".concat(t,"/").concat(e.content.uri||e.content.url)),e.id=null!==(i=e.contentUrl)&&void 0!==i?i:"empty:"+rr(),e.lodMetricType="geometricError",e.lodMetricValue=e.geometricError,e.transformMatrix=e.transform,e.type=e.contentUrl?"SCENEGRAPH":"EMPTY",e.refine=function(e){switch(e){case"REPLACE":case"replace":return"REPLACE";case"ADD":case"add":return"ADD";default:throw new Error("refine ".concat(e," is not supported."))}}(e.refine),e}function sr(e,t){var i,n=JSON.parse(JSON.stringify(e));return n.basePath=t,n.root=function(e,t){e=or(e,t);var i=[];for(i.push(e);i.length>0;)for(var n=0,r=(i.pop()||{}).children||[];n<r.length;n++){var o=r[n];or(o,t),i.push(o)}return e}(n.root,t),n.type="TILES3D",n.lodMetricType="geometricError",n.lodMetricValue=(null===(i=n.root)||void 0===i?void 0:i.lodMetricValue)||0,n}var ar=function(){function t(t){e.Loader.call(this,t),this.dracoLoader=null,this.ddsLoader=null}function i(){var e={};return{get:function(t){return e[t]},add:function(t,i){e[t]=i},remove:function(t){delete e[t]},removeAll:function(){e={}}}}t.prototype=Object.assign(Object.create(e.Loader.prototype),{constructor:t,load:function(t,i,n,r){var o,s=this;o=""!==this.resourcePath?this.resourcePath:""!==this.path?this.path:e.LoaderUtils.extractUrlBase(t),s.manager.itemStart(t);var a=function(e){r?r(e):console.error(e),s.manager.itemError(t),s.manager.itemEnd(t)},l=new e.FileLoader(s.manager);l.setPath(this.path),l.setResponseType("arraybuffer"),l.setRequestHeader(this.requestHeader),"use-credentials"===s.crossOrigin&&l.setWithCredentials(!0),l.load(t,(function(e){try{s.parse(e,o,(function(e){i(e),s.manager.itemEnd(t)}),a)}catch(e){a(e)}}),n,a)},setDRACOLoader:function(e){return this.dracoLoader=e,this},setDDSLoader:function(e){return this.ddsLoader=e,this},parse:function(t,i,u,c){var f,m={};if("string"==typeof t)f=t;else if(e.LoaderUtils.decodeText(new Uint8Array(t,0,4))===l){try{m[n.KHR_BINARY_GLTF]=new h(t)}catch(e){return void(c&&c(e))}f=m[n.KHR_BINARY_GLTF].content}else f=e.LoaderUtils.decodeText(new Uint8Array(t));var v=JSON.parse(f);if(void 0===v.asset||v.asset.version[0]<2)c&&c(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));else{if(v.extensionsUsed)for(var y=0;y<v.extensionsUsed.length;++y){var b=v.extensionsUsed[y],x=v.extensionsRequired||[];switch(b){case n.KHR_LIGHTS_PUNCTUAL:m[b]=new o(v);break;case n.KHR_MATERIALS_CLEARCOAT:m[b]=new a;break;case n.KHR_MATERIALS_UNLIT:m[b]=new s;break;case n.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:m[b]=new A;break;case n.KHR_DRACO_MESH_COMPRESSION:m[b]=new d(v,this.dracoLoader);break;case n.MSFT_TEXTURE_DDS:m[b]=new r(this.ddsLoader);break;case n.KHR_TEXTURE_TRANSFORM:m[b]=new p;break;case n.KHR_MESH_QUANTIZATION:m[b]=new g;break;default:x.indexOf(b)>=0&&console.warn('THREE.GLTFLoader: Unknown extension "'+b+'".')}}var w=new q(v,m,{path:i||this.resourcePath||"",crossOrigin:this.crossOrigin,manager:this.manager});w.fileLoader.setRequestHeader(this.requestHeader),w.parse(u,c)}}});var n={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:"KHR_materials_pbrSpecularGlossiness",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",MSFT_TEXTURE_DDS:"MSFT_texture_dds"};function r(e){if(!e)throw new Error("THREE.GLTFLoader: Attempting to load .dds texture without importing DDSLoader");this.name=n.MSFT_TEXTURE_DDS,this.ddsLoader=e}function o(e){this.name=n.KHR_LIGHTS_PUNCTUAL;var t=e.extensions&&e.extensions[n.KHR_LIGHTS_PUNCTUAL]||{};this.lightDefs=t.lights||[]}function s(){this.name=n.KHR_MATERIALS_UNLIT}function a(){this.name=n.KHR_MATERIALS_CLEARCOAT}o.prototype.loadLight=function(t){var i,n=this.lightDefs[t],r=new e.Color(16777215);void 0!==n.color&&r.fromArray(n.color);var o=void 0!==n.range?n.range:0;switch(n.type){case"directional":(i=new e.DirectionalLight(r)).target.position.set(0,0,-1),i.add(i.target);break;case"point":(i=new e.PointLight(r)).distance=o;break;case"spot":(i=new e.SpotLight(r)).distance=o,n.spot=n.spot||{},n.spot.innerConeAngle=void 0!==n.spot.innerConeAngle?n.spot.innerConeAngle:0,n.spot.outerConeAngle=void 0!==n.spot.outerConeAngle?n.spot.outerConeAngle:Math.PI/4,i.angle=n.spot.outerConeAngle,i.penumbra=1-n.spot.innerConeAngle/n.spot.outerConeAngle,i.target.position.set(0,0,-1),i.add(i.target);break;default:throw new Error('THREE.GLTFLoader: Unexpected light type, "'+n.type+'".')}return i.position.set(0,0,0),i.decay=2,void 0!==n.intensity&&(i.intensity=n.intensity),i.name=n.name||"light_"+t,Promise.resolve(i)},s.prototype.getMaterialType=function(){return e.MeshBasicMaterial},s.prototype.extendParams=function(t,i,n){var r=[];t.color=new e.Color(1,1,1),t.opacity=1;var o=i.pbrMetallicRoughness;if(o){if(Array.isArray(o.baseColorFactor)){var s=o.baseColorFactor;t.color.fromArray(s),t.opacity=s[3]}void 0!==o.baseColorTexture&&r.push(n.assignTexture(t,"map",o.baseColorTexture))}return Promise.all(r)},a.prototype.getMaterialType=function(){return e.MeshPhysicalMaterial},a.prototype.extendParams=function(t,i,n){var r=[],o=i.extensions[this.name];if(void 0!==o.clearcoatFactor&&(t.clearcoat=o.clearcoatFactor),void 0!==o.clearcoatTexture&&r.push(n.assignTexture(t,"clearcoatMap",o.clearcoatTexture)),void 0!==o.clearcoatRoughnessFactor&&(t.clearcoatRoughness=o.clearcoatRoughnessFactor),void 0!==o.clearcoatRoughnessTexture&&r.push(n.assignTexture(t,"clearcoatRoughnessMap",o.clearcoatRoughnessTexture)),void 0!==o.clearcoatNormalTexture&&(r.push(n.assignTexture(t,"clearcoatNormalMap",o.clearcoatNormalTexture)),void 0!==o.clearcoatNormalTexture.scale)){var s=o.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new e.Vector2(s,s)}return Promise.all(r)};var l="glTF",u=1313821514,c=5130562;function h(t){this.name=n.KHR_BINARY_GLTF,this.content=null,this.body=null;var i=new DataView(t,0,12);if(this.header={magic:e.LoaderUtils.decodeText(new Uint8Array(t.slice(0,4))),version:i.getUint32(4,!0),length:i.getUint32(8,!0)},this.header.magic!==l)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");for(var r=new DataView(t,12),o=0;o<r.byteLength;){var s=r.getUint32(o,!0);o+=4;var a=r.getUint32(o,!0);if(o+=4,a===u){var h=new Uint8Array(t,12+o,s);this.content=e.LoaderUtils.decodeText(h)}else if(a===c){var d=12+o;this.body=t.slice(d,d+s)}o+=s}if(null===this.content)throw new Error("THREE.GLTFLoader: JSON content not found.")}function d(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=n.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}function p(){this.name=n.KHR_TEXTURE_TRANSFORM}function f(t){e.MeshStandardMaterial.call(this),this.isGLTFSpecularGlossinessMaterial=!0;var i=["#ifdef USE_SPECULARMAP","\tuniform sampler2D specularMap;","#endif"].join("\n"),n=["#ifdef USE_GLOSSINESSMAP","\tuniform sampler2D glossinessMap;","#endif"].join("\n"),r=["vec3 specularFactor = specular;","#ifdef USE_SPECULARMAP","\tvec4 texelSpecular = texture2D( specularMap, vUv );","\ttexelSpecular = sRGBToLinear( texelSpecular );","\t// reads channel RGB, compatible with a glTF Specular-Glossiness (RGBA) texture","\tspecularFactor *= texelSpecular.rgb;","#endif"].join("\n"),o=["float glossinessFactor = glossiness;","#ifdef USE_GLOSSINESSMAP","\tvec4 texelGlossiness = texture2D( glossinessMap, vUv );","\t// reads channel A, compatible with a glTF Specular-Glossiness (RGBA) texture","\tglossinessFactor *= texelGlossiness.a;","#endif"].join("\n"),s=["PhysicalMaterial material;","material.diffuseColor = diffuseColor.rgb;","vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );","float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );","material.specularRoughness = max( 1.0 - glossinessFactor, 0.0525 );// 0.0525 corresponds to the base mip of a 256 cubemap.","material.specularRoughness += geometryRoughness;","material.specularRoughness = min( material.specularRoughness, 1.0 );","material.specularColor = specularFactor.rgb;"].join("\n"),a={specular:{value:(new e.Color).setHex(16777215)},glossiness:{value:1},specularMap:{value:null},glossinessMap:{value:null}};this._extraUniforms=a,this.onBeforeCompile=function(e){for(var t in a)e.uniforms[t]=a[t];e.fragmentShader=e.fragmentShader.replace("uniform float roughness;","uniform vec3 specular;"),e.fragmentShader=e.fragmentShader.replace("uniform float metalness;","uniform float glossiness;"),e.fragmentShader=e.fragmentShader.replace("#include <roughnessmap_pars_fragment>",i),e.fragmentShader=e.fragmentShader.replace("#include <metalnessmap_pars_fragment>",n),e.fragmentShader=e.fragmentShader.replace("#include <roughnessmap_fragment>",r),e.fragmentShader=e.fragmentShader.replace("#include <metalnessmap_fragment>",o),e.fragmentShader=e.fragmentShader.replace("#include <lights_physical_fragment>",s)},Object.defineProperties(this,{specular:{get:function(){return a.specular.value},set:function(e){a.specular.value=e}},specularMap:{get:function(){return a.specularMap.value},set:function(e){a.specularMap.value=e}},glossiness:{get:function(){return a.glossiness.value},set:function(e){a.glossiness.value=e}},glossinessMap:{get:function(){return a.glossinessMap.value},set:function(e){a.glossinessMap.value=e,e?(this.defines.USE_GLOSSINESSMAP="",this.defines.USE_ROUGHNESSMAP=""):(delete this.defines.USE_ROUGHNESSMAP,delete this.defines.USE_GLOSSINESSMAP)}}}),delete this.metalness,delete this.roughness,delete this.metalnessMap,delete this.roughnessMap,this.setValues(t)}function A(){return{name:n.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS,specularGlossinessParams:["color","map","lightMap","lightMapIntensity","aoMap","aoMapIntensity","emissive","emissiveIntensity","emissiveMap","bumpMap","bumpScale","normalMap","normalMapType","displacementMap","displacementScale","displacementBias","specularMap","specular","glossinessMap","glossiness","alphaMap","envMap","envMapIntensity","refractionRatio"],getMaterialType:function(){return f},extendParams:function(t,i,n){var r=i.extensions[this.name];t.color=new e.Color(1,1,1),t.opacity=1;var o=[];if(Array.isArray(r.diffuseFactor)){var s=r.diffuseFactor;t.color.fromArray(s),t.opacity=s[3]}if(void 0!==r.diffuseTexture&&o.push(n.assignTexture(t,"map",r.diffuseTexture)),t.emissive=new e.Color(0,0,0),t.glossiness=void 0!==r.glossinessFactor?r.glossinessFactor:1,t.specular=new e.Color(1,1,1),Array.isArray(r.specularFactor)&&t.specular.fromArray(r.specularFactor),void 0!==r.specularGlossinessTexture){var a=r.specularGlossinessTexture;o.push(n.assignTexture(t,"glossinessMap",a)),o.push(n.assignTexture(t,"specularMap",a))}return Promise.all(o)},createMaterial:function(t){var i=new f(t);return i.fog=!0,i.color=t.color,i.map=void 0===t.map?null:t.map,i.lightMap=null,i.lightMapIntensity=1,i.aoMap=void 0===t.aoMap?null:t.aoMap,i.aoMapIntensity=1,i.emissive=t.emissive,i.emissiveIntensity=1,i.emissiveMap=void 0===t.emissiveMap?null:t.emissiveMap,i.bumpMap=void 0===t.bumpMap?null:t.bumpMap,i.bumpScale=1,i.normalMap=void 0===t.normalMap?null:t.normalMap,i.normalMapType=e.TangentSpaceNormalMap,t.normalScale&&(i.normalScale=t.normalScale),i.displacementMap=null,i.displacementScale=1,i.displacementBias=0,i.specularMap=void 0===t.specularMap?null:t.specularMap,i.specular=t.specular,i.glossinessMap=void 0===t.glossinessMap?null:t.glossinessMap,i.glossiness=t.glossiness,i.alphaMap=null,i.envMap=void 0===t.envMap?null:t.envMap,i.envMapIntensity=1,i.refractionRatio=.98,i}}}function g(){this.name=n.KHR_MESH_QUANTIZATION}function m(t,i,n,r){e.Interpolant.call(this,t,i,n,r)}d.prototype.decodePrimitive=function(e,t){var i=this.json,n=this.dracoLoader,r=e.extensions[this.name].bufferView,o=e.extensions[this.name].attributes,s={},a={},l={};for(var u in o){var c=T[u]||u.toLowerCase();s[c]=o[u]}for(u in e.attributes){c=T[u]||u.toLowerCase();if(void 0!==o[u]){var h=i.accessors[e.attributes[u]],d=S[h.componentType];l[c]=d,a[c]=!0===h.normalized}}return t.getDependency("bufferView",r).then((function(e){return new Promise((function(t){n.decodeDracoFile(e,(function(e){for(var i in e.attributes){var n=e.attributes[i],r=a[i];void 0!==r&&(n.normalized=r)}t(e)}),s,l)}))}))},p.prototype.extendTexture=function(e,t){return e=e.clone(),void 0!==t.offset&&e.offset.fromArray(t.offset),void 0!==t.rotation&&(e.rotation=t.rotation),void 0!==t.scale&&e.repeat.fromArray(t.scale),void 0!==t.texCoord&&console.warn('THREE.GLTFLoader: Custom UV sets in "'+this.name+'" extension not yet supported.'),e.needsUpdate=!0,e},f.prototype=Object.create(e.MeshStandardMaterial.prototype),f.prototype.constructor=f,f.prototype.copy=function(t){return e.MeshStandardMaterial.prototype.copy.call(this,t),this.specularMap=t.specularMap,this.specular.copy(t.specular),this.glossinessMap=t.glossinessMap,this.glossiness=t.glossiness,delete this.metalness,delete this.roughness,delete this.metalnessMap,delete this.roughnessMap,this},m.prototype=Object.create(e.Interpolant.prototype),m.prototype.constructor=m,m.prototype.copySampleValue_=function(e){for(var t=this.resultBuffer,i=this.sampleValues,n=this.valueSize,r=e*n*3+n,o=0;o!==n;o++)t[o]=i[r+o];return t},m.prototype.beforeStart_=m.prototype.copySampleValue_,m.prototype.afterEnd_=m.prototype.copySampleValue_,m.prototype.interpolate_=function(e,t,i,n){for(var r=this.resultBuffer,o=this.sampleValues,s=this.valueSize,a=2*s,l=3*s,u=n-t,c=(i-t)/u,h=c*c,d=h*c,p=e*l,f=p-l,A=-2*d+3*h,g=d-h,m=1-A,v=g-h+c,y=0;y!==s;y++){var b=o[f+y+s],x=o[f+y+a]*u,w=o[p+y+s],M=o[p+y]*u;r[y]=m*b+v*x+A*w+g*M}return r};var v=0,y=1,b=2,x=3,w=4,M=5,E=6,S={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},C={9728:e.NearestFilter,9729:e.LinearFilter,9984:e.NearestMipmapNearestFilter,9985:e.LinearMipmapNearestFilter,9986:e.NearestMipmapLinearFilter,9987:e.LinearMipmapLinearFilter},I={33071:e.ClampToEdgeWrapping,33648:e.MirroredRepeatWrapping,10497:e.RepeatWrapping},B={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},T={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv2",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},P={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},R={CUBICSPLINE:void 0,LINEAR:e.InterpolateLinear,STEP:e.InterpolateDiscrete},D="OPAQUE",L="MASK",k="BLEND",O={"image/png":e.RGBAFormat,"image/jpeg":e.RGBFormat};function F(e,t){return"string"!=typeof e||""===e?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}function N(e,t,i){for(var n in i.extensions)void 0===e[n]&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[n]=i.extensions[n])}function V(e,t){void 0!==t.extras&&("object"==typeof t.extras?Object.assign(e.userData,t.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras))}function Q(e,t){if(e.updateMorphTargets(),void 0!==t.weights)for(var i=0,n=t.weights.length;i<n;i++)e.morphTargetInfluences[i]=t.weights[i];if(t.extras&&Array.isArray(t.extras.targetNames)){var r=t.extras.targetNames;if(e.morphTargetInfluences.length===r.length){e.morphTargetDictionary={};for(i=0,n=r.length;i<n;i++)e.morphTargetDictionary[r[i]]=i}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function H(e){for(var t="",i=Object.keys(e).sort(),n=0,r=i.length;n<r;n++)t+=i[n]+":"+e[i[n]]+";";return t}function q(t,n,r){this.json=t||{},this.extensions=n||{},this.options=r||{},this.cache=new i,this.associations=new Map,this.primitiveCache={},this.textureLoader=new e.TextureLoader(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.fileLoader=new e.FileLoader(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}function U(t,i,n){var r=i.attributes,o=[];function s(e,i){return n.getDependency("accessor",e).then((function(e){t.setAttribute(i,e)}))}for(var a in r){var l=T[a]||a.toLowerCase();l in t.attributes||o.push(s(r[a],l))}if(void 0!==i.indices&&!t.index){var u=n.getDependency("accessor",i.indices).then((function(e){t.setIndex(e)}));o.push(u)}return V(t,i),function(t,i,n){var r=i.attributes,o=new e.Box3;if(void 0!==r.POSITION){var s=(p=n.json.accessors[r.POSITION]).min,a=p.max;if(void 0!==s&&void 0!==a){o.set(new e.Vector3(s[0],s[1],s[2]),new e.Vector3(a[0],a[1],a[2]));var l=i.targets;if(void 0!==l){for(var u=new e.Vector3,c=new e.Vector3,h=0,d=l.length;h<d;h++){var p,f=l[h];if(void 0!==f.POSITION)s=(p=n.json.accessors[f.POSITION]).min,a=p.max,void 0!==s&&void 0!==a?(c.setX(Math.max(Math.abs(s[0]),Math.abs(a[0]))),c.setY(Math.max(Math.abs(s[1]),Math.abs(a[1]))),c.setZ(Math.max(Math.abs(s[2]),Math.abs(a[2]))),u.max(c)):console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}o.expandByVector(u)}t.boundingBox=o;var A=new e.Sphere;o.getCenter(A.center),A.radius=o.min.distanceTo(o.max)/2,t.boundingSphere=A}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}(t,i,n),Promise.all(o).then((function(){return void 0!==i.targets?function(e,t,i){for(var n=!1,r=!1,o=0,s=t.length;o<s&&(void 0!==(u=t[o]).POSITION&&(n=!0),void 0!==u.NORMAL&&(r=!0),!n||!r);o++);if(!n&&!r)return Promise.resolve(e);var a=[],l=[];for(o=0,s=t.length;o<s;o++){var u=t[o];if(n){var c=void 0!==u.POSITION?i.getDependency("accessor",u.POSITION):e.attributes.position;a.push(c)}r&&(c=void 0!==u.NORMAL?i.getDependency("accessor",u.NORMAL):e.attributes.normal,l.push(c))}return Promise.all([Promise.all(a),Promise.all(l)]).then((function(t){var i=t[0],o=t[1];return n&&(e.morphAttributes.position=i),r&&(e.morphAttributes.normal=o),e.morphTargetsRelative=!0,e}))}(t,i.targets,n):t}))}function z(t,i){var n=t.getIndex();if(null===n){var r=[],o=t.getAttribute("position");if(void 0===o)return console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),t;for(var s=0;s<o.count;s++)r.push(s);t.setIndex(r),n=t.getIndex()}var a=n.count-2,l=[];if(i===e.TriangleFanDrawMode)for(s=1;s<=a;s++)l.push(n.getX(0)),l.push(n.getX(s)),l.push(n.getX(s+1));else for(s=0;s<a;s++)s%2==0?(l.push(n.getX(s)),l.push(n.getX(s+1)),l.push(n.getX(s+2))):(l.push(n.getX(s+2)),l.push(n.getX(s+1)),l.push(n.getX(s)));l.length/3!==a&&console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");var u=t.clone();return u.setIndex(l),u}return q.prototype.parse=function(e,t){var i=this,n=this.json,r=this.extensions;this.cache.removeAll(),this.markDefs(),Promise.all([this.getDependencies("scene"),this.getDependencies("animation"),this.getDependencies("camera")]).then((function(t){var o={scene:t[0][n.scene||0],scenes:t[0],animations:t[1],cameras:t[2],asset:n.asset,parser:i,userData:{}};N(r,o,n),V(o,n),e(o)})).catch(t)},q.prototype.markDefs=function(){for(var e=this.json.nodes||[],t=this.json.skins||[],i=this.json.meshes||[],n={},r={},o=0,s=t.length;o<s;o++)for(var a=t[o].joints,l=0,u=a.length;l<u;l++)e[a[l]].isBone=!0;for(var c=0,h=e.length;c<h;c++){var d=e[c];void 0!==d.mesh&&(void 0===n[d.mesh]&&(n[d.mesh]=r[d.mesh]=0),n[d.mesh]++,void 0!==d.skin&&(i[d.mesh].isSkinnedMesh=!0))}this.json.meshReferences=n,this.json.meshUses=r},q.prototype.getDependency=function(e,t){var i=e+":"+t,r=this.cache.get(i);if(!r){switch(e){case"scene":r=this.loadScene(t);break;case"node":r=this.loadNode(t);break;case"mesh":r=this.loadMesh(t);break;case"accessor":r=this.loadAccessor(t);break;case"bufferView":r=this.loadBufferView(t);break;case"buffer":r=this.loadBuffer(t);break;case"material":r=this.loadMaterial(t);break;case"texture":r=this.loadTexture(t);break;case"skin":r=this.loadSkin(t);break;case"animation":r=this.loadAnimation(t);break;case"camera":r=this.loadCamera(t);break;case"light":r=this.extensions[n.KHR_LIGHTS_PUNCTUAL].loadLight(t);break;default:throw new Error("Unknown type: "+e)}this.cache.add(i,r)}return r},q.prototype.getDependencies=function(e){var t=this.cache.get(e);if(!t){var i=this,n=this.json[e+("mesh"===e?"es":"s")]||[];t=Promise.all(n.map((function(t,n){return i.getDependency(e,n)}))),this.cache.add(e,t)}return t},q.prototype.loadBuffer=function(e){var t=this.json.buffers[e],i=this.fileLoader;if(t.type&&"arraybuffer"!==t.type)throw new Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(void 0===t.uri&&0===e)return Promise.resolve(this.extensions[n.KHR_BINARY_GLTF].body);var r=this.options;return new Promise((function(e,n){i.load(F(t.uri,r.path),e,void 0,(function(){n(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))}))}))},q.prototype.loadBufferView=function(e){var t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then((function(e){var i=t.byteLength||0,n=t.byteOffset||0;return e.slice(n,n+i)}))},q.prototype.loadAccessor=function(t){var i=this,n=this.json,r=this.json.accessors[t];if(void 0===r.bufferView&&void 0===r.sparse)return Promise.resolve(null);var o=[];return void 0!==r.bufferView?o.push(this.getDependency("bufferView",r.bufferView)):o.push(null),void 0!==r.sparse&&(o.push(this.getDependency("bufferView",r.sparse.indices.bufferView)),o.push(this.getDependency("bufferView",r.sparse.values.bufferView))),Promise.all(o).then((function(t){var o,s,a=t[0],l=B[r.type],u=S[r.componentType],c=u.BYTES_PER_ELEMENT,h=c*l,d=r.byteOffset||0,p=void 0!==r.bufferView?n.bufferViews[r.bufferView].byteStride:void 0,f=!0===r.normalized;if(p&&p!==h){var A=Math.floor(d/p),g="InterleavedBuffer:"+r.bufferView+":"+r.componentType+":"+A+":"+r.count,m=i.cache.get(g);m||(o=new u(a,A*p,r.count*p/c),m=new e.InterleavedBuffer(o,p/c),i.cache.add(g,m)),s=new e.InterleavedBufferAttribute(m,l,d%p/c,f)}else o=null===a?new u(r.count*l):new u(a,d,r.count*l),s=new e.BufferAttribute(o,l,f);if(void 0!==r.sparse){var v=B.SCALAR,y=S[r.sparse.indices.componentType],b=r.sparse.indices.byteOffset||0,x=r.sparse.values.byteOffset||0,w=new y(t[1],b,r.sparse.count*v),M=new u(t[2],x,r.sparse.count*l);null!==a&&(s=new e.BufferAttribute(s.array.slice(),s.itemSize,s.normalized));for(var E=0,C=w.length;E<C;E++){var I=w[E];if(s.setX(I,M[E*l]),l>=2&&s.setY(I,M[E*l+1]),l>=3&&s.setZ(I,M[E*l+2]),l>=4&&s.setW(I,M[E*l+3]),l>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return s}))},q.prototype.loadTexture=function(t){var i,r=this,o=this.json,s=this.options,a=this.textureLoader,l=self.URL||self.webkitURL,u=o.textures[t],c=u.extensions||{},h=(i=c[n.MSFT_TEXTURE_DDS]?o.images[c[n.MSFT_TEXTURE_DDS].source]:o.images[u.source]).uri,d=!1;return void 0!==i.bufferView&&(h=r.getDependency("bufferView",i.bufferView).then((function(e){d=!0;var t=new Blob([e],{type:i.mimeType});return h=l.createObjectURL(t)}))),Promise.resolve(h).then((function(e){var t=s.manager.getHandler(e);return t||(t=c[n.MSFT_TEXTURE_DDS]?r.extensions[n.MSFT_TEXTURE_DDS].ddsLoader:a),new Promise((function(i,n){t.load(F(e,s.path),i,void 0,n)}))})).then((function(n){!0===d&&l.revokeObjectURL(h),n.flipY=!1,u.name&&(n.name=u.name),i.mimeType in O&&(n.format=O[i.mimeType]);var s=(o.samplers||{})[u.sampler]||{};return n.magFilter=C[s.magFilter]||e.LinearFilter,n.minFilter=C[s.minFilter]||e.LinearMipmapLinearFilter,n.wrapS=I[s.wrapS]||e.RepeatWrapping,n.wrapT=I[s.wrapT]||e.RepeatWrapping,r.associations.set(n,{type:"textures",index:t}),n}))},q.prototype.assignTexture=function(t,i,r){var o=this;return this.getDependency("texture",r.index).then((function(s){if(!s.isCompressedTexture)switch(i){case"aoMap":case"emissiveMap":case"metalnessMap":case"normalMap":case"roughnessMap":s.format=e.RGBFormat}if(void 0===r.texCoord||0==r.texCoord||"aoMap"===i&&1==r.texCoord||console.warn("THREE.GLTFLoader: Custom UV set "+r.texCoord+" for texture "+i+" not yet supported."),o.extensions[n.KHR_TEXTURE_TRANSFORM]){var a=void 0!==r.extensions?r.extensions[n.KHR_TEXTURE_TRANSFORM]:void 0;if(a){var l=this.associations.get(s);s=o.extensions[n.KHR_TEXTURE_TRANSFORM].extendTexture(s,a),this.associations.set(s,l)}}t[i]=s}))},q.prototype.assignFinalMaterial=function(t){var i=t.geometry,n=t.material,r=void 0!==i.attributes.tangent,o=void 0!==i.attributes.color,s=void 0===i.attributes.normal,a=!0===t.isSkinnedMesh,l=Object.keys(i.morphAttributes).length>0,u=l&&void 0!==i.morphAttributes.normal;if(t.isPoints){var c="PointsMaterial:"+n.uuid,h=this.cache.get(c);h||(h=new e.PointsMaterial,e.Material.prototype.copy.call(h,n),h.color.copy(n.color),h.map=n.map,h.sizeAttenuation=!1,this.cache.add(c,h)),n=h}else if(t.isLine){c="LineBasicMaterial:"+n.uuid;var d=this.cache.get(c);d||(d=new e.LineBasicMaterial,e.Material.prototype.copy.call(d,n),d.color.copy(n.color),this.cache.add(c,d)),n=d}if(r||o||s||a||l){c="ClonedMaterial:"+n.uuid+":";n.isGLTFSpecularGlossinessMaterial&&(c+="specular-glossiness:"),a&&(c+="skinning:"),r&&(c+="vertex-tangents:"),o&&(c+="vertex-colors:"),s&&(c+="flat-shading:"),l&&(c+="morph-targets:"),u&&(c+="morph-normals:");var p=this.cache.get(c);p||(p=n.clone(),a&&(p.skinning=!0),r&&(p.vertexTangents=!0),o&&(p.vertexColors=!0),s&&(p.flatShading=!0),l&&(p.morphTargets=!0),u&&(p.morphNormals=!0),this.cache.add(c,p),this.associations.set(p,this.associations.get(n))),n=p}n.aoMap&&void 0===i.attributes.uv2&&void 0!==i.attributes.uv&&i.setAttribute("uv2",i.attributes.uv),n.normalScale&&!r&&(n.normalScale.y=-n.normalScale.y),n.clearcoatNormalScale&&!r&&(n.clearcoatNormalScale.y=-n.clearcoatNormalScale.y),t.material=n},q.prototype.loadMaterial=function(t){var i,r=this,o=this.json,s=this.extensions,a=o.materials[t],l={},u=a.extensions||{},c=[];if(u[n.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS]){var h=s[n.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS];i=h.getMaterialType(),c.push(h.extendParams(l,a,r))}else if(u[n.KHR_MATERIALS_UNLIT]){var d=s[n.KHR_MATERIALS_UNLIT];i=d.getMaterialType(),c.push(d.extendParams(l,a,r))}else{i=e.MeshStandardMaterial;var p=a.pbrMetallicRoughness||{};if(l.color=new e.Color(1,1,1),l.opacity=1,Array.isArray(p.baseColorFactor)){var A=p.baseColorFactor;l.color.fromArray(A),l.opacity=A[3]}void 0!==p.baseColorTexture&&c.push(r.assignTexture(l,"map",p.baseColorTexture)),l.metalness=void 0!==p.metallicFactor?p.metallicFactor:1,l.roughness=void 0!==p.roughnessFactor?p.roughnessFactor:1,void 0!==p.metallicRoughnessTexture&&(c.push(r.assignTexture(l,"metalnessMap",p.metallicRoughnessTexture)),c.push(r.assignTexture(l,"roughnessMap",p.metallicRoughnessTexture)))}!0===a.doubleSided&&(l.side=e.DoubleSide);var g=a.alphaMode||D;if(g===k?(l.transparent=!0,l.depthWrite=!1):(l.transparent=!1,g===L&&(l.alphaTest=void 0!==a.alphaCutoff?a.alphaCutoff:.5)),void 0!==a.normalTexture&&i!==e.MeshBasicMaterial&&(c.push(r.assignTexture(l,"normalMap",a.normalTexture)),l.normalScale=new e.Vector2(1,1),void 0!==a.normalTexture.scale&&l.normalScale.set(a.normalTexture.scale,a.normalTexture.scale)),void 0!==a.occlusionTexture&&i!==e.MeshBasicMaterial&&(c.push(r.assignTexture(l,"aoMap",a.occlusionTexture)),void 0!==a.occlusionTexture.strength&&(l.aoMapIntensity=a.occlusionTexture.strength)),void 0!==a.emissiveFactor&&i!==e.MeshBasicMaterial&&(l.emissive=(new e.Color).fromArray(a.emissiveFactor)),void 0!==a.emissiveTexture&&i!==e.MeshBasicMaterial&&c.push(r.assignTexture(l,"emissiveMap",a.emissiveTexture)),u[n.KHR_MATERIALS_CLEARCOAT]){var m=s[n.KHR_MATERIALS_CLEARCOAT];i=m.getMaterialType(),c.push(m.extendParams(l,{extensions:u},r))}return Promise.all(c).then((function(){var o;return o=i===f?s[n.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS].createMaterial(l):new i(l),a.name&&(o.name=a.name),o.map&&(o.map.encoding=e.sRGBEncoding),o.emissiveMap&&(o.emissiveMap.encoding=e.sRGBEncoding),V(o,a),r.associations.set(o,{type:"materials",index:t}),a.extensions&&N(s,o,a),o}))},q.prototype.loadGeometries=function(t){var i=this,r=this.extensions,o=this.primitiveCache;function s(e){return r[n.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,i).then((function(t){return U(t,e,i)}))}for(var a,l,u=[],c=0,h=t.length;c<h;c++){var d,p=t[c],f=(l=void 0,(l=(a=p).extensions&&a.extensions[n.KHR_DRACO_MESH_COMPRESSION])?"draco:"+l.bufferView+":"+l.indices+":"+H(l.attributes):a.indices+":"+H(a.attributes)+":"+a.mode),A=o[f];if(A)u.push(A.promise);else d=p.extensions&&p.extensions[n.KHR_DRACO_MESH_COMPRESSION]?s(p):U(new e.BufferGeometry,p,i),o[f]={primitive:p,promise:d},u.push(d)}return Promise.all(u)},q.prototype.loadMesh=function(t){for(var i,n=this,r=this.json.meshes[t],o=r.primitives,s=[],a=0,l=o.length;a<l;a++){var u=void 0===o[a].material?(void 0===(i=this.cache).DefaultMaterial&&(i.DefaultMaterial=new e.MeshStandardMaterial({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:e.FrontSide})),i.DefaultMaterial):this.getDependency("material",o[a].material);s.push(u)}return s.push(n.loadGeometries(o)),Promise.all(s).then((function(i){for(var s=i.slice(0,i.length-1),a=i[i.length-1],l=[],u=0,c=a.length;u<c;u++){var h,d=a[u],p=o[u],f=s[u];if(p.mode===w||p.mode===M||p.mode===E||void 0===p.mode)!0!==(h=!0===r.isSkinnedMesh?new e.SkinnedMesh(d,f):new e.Mesh(d,f)).isSkinnedMesh||h.geometry.attributes.skinWeight.normalized||h.normalizeSkinWeights(),p.mode===M?h.geometry=z(h.geometry,e.TriangleStripDrawMode):p.mode===E&&(h.geometry=z(h.geometry,e.TriangleFanDrawMode));else if(p.mode===y)h=new e.LineSegments(d,f);else if(p.mode===x)h=new e.Line(d,f);else if(p.mode===b)h=new e.LineLoop(d,f);else{if(p.mode!==v)throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+p.mode);h=new e.Points(d,f)}Object.keys(h.geometry.morphAttributes).length>0&&Q(h,r),h.name=r.name||"mesh_"+t,a.length>1&&(h.name+="_"+u),V(h,r),n.assignFinalMaterial(h),l.push(h)}if(1===l.length)return l[0];var A=new e.Group;for(u=0,c=l.length;u<c;u++)A.add(l[u]);return A}))},q.prototype.loadCamera=function(t){var i,n=this.json.cameras[t],r=n[n.type];if(r)return"perspective"===n.type?i=new e.PerspectiveCamera(e.MathUtils.radToDeg(r.yfov),r.aspectRatio||1,r.znear||1,r.zfar||2e6):"orthographic"===n.type&&(i=new e.OrthographicCamera(-r.xmag,r.xmag,r.ymag,-r.ymag,r.znear,r.zfar)),n.name&&(i.name=n.name),V(i,n),Promise.resolve(i);console.warn("THREE.GLTFLoader: Missing camera parameters.")},q.prototype.loadSkin=function(e){var t=this.json.skins[e],i={joints:t.joints};return void 0===t.inverseBindMatrices?Promise.resolve(i):this.getDependency("accessor",t.inverseBindMatrices).then((function(e){return i.inverseBindMatrices=e,i}))},q.prototype.loadAnimation=function(t){for(var i=this.json.animations[t],n=[],r=[],o=[],s=[],a=[],l=0,u=i.channels.length;l<u;l++){var c=i.channels[l],h=i.samplers[c.sampler],d=c.target,p=void 0!==d.node?d.node:d.id,f=void 0!==i.parameters?i.parameters[h.input]:h.input,A=void 0!==i.parameters?i.parameters[h.output]:h.output;n.push(this.getDependency("node",p)),r.push(this.getDependency("accessor",f)),o.push(this.getDependency("accessor",A)),s.push(h),a.push(d)}return Promise.all([Promise.all(n),Promise.all(r),Promise.all(o),Promise.all(s),Promise.all(a)]).then((function(n){for(var r=n[0],o=n[1],s=n[2],a=n[3],l=n[4],u=[],c=0,h=r.length;c<h;c++){var d=r[c],p=o[c],f=s[c],A=a[c],g=l[c];if(void 0!==d){var v;switch(d.updateMatrix(),d.matrixAutoUpdate=!0,P[g.path]){case P.weights:v=e.NumberKeyframeTrack;break;case P.rotation:v=e.QuaternionKeyframeTrack;break;default:v=e.VectorKeyframeTrack}var y=d.name?d.name:d.uuid,b=void 0!==A.interpolation?R[A.interpolation]:e.InterpolateLinear,x=[];P[g.path]===P.weights?d.traverse((function(e){!0===e.isMesh&&e.morphTargetInfluences&&x.push(e.name?e.name:e.uuid)})):x.push(y);var w=f.array;if(f.normalized){var M;if(w.constructor===Int8Array)M=1/127;else if(w.constructor===Uint8Array)M=1/255;else if(w.constructor==Int16Array)M=1/32767;else{if(w.constructor!==Uint16Array)throw new Error("THREE.GLTFLoader: Unsupported output accessor component type.");M=1/65535}for(var E=new Float32Array(w.length),S=0,C=w.length;S<C;S++)E[S]=w[S]*M;w=E}for(S=0,C=x.length;S<C;S++){var I=new v(x[S]+"."+P[g.path],p.array,w,b);"CUBICSPLINE"===A.interpolation&&(I.createInterpolant=function(e){return new m(this.times,this.values,this.getValueSize()/3,e)},I.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0),u.push(I)}}}var B=i.name?i.name:"animation_"+t;return new e.AnimationClip(B,void 0,u)}))},q.prototype.loadNode=function(t){var i,r=this.json,o=this.extensions,s=this,a=r.meshReferences,l=r.meshUses,u=r.nodes[t];return(i=[],void 0!==u.mesh&&i.push(s.getDependency("mesh",u.mesh).then((function(e){var t;if(a[u.mesh]>1){var i=l[u.mesh]++;(t=e.clone()).name+="_instance_"+i}else t=e;return void 0!==u.weights&&t.traverse((function(e){if(e.isMesh)for(var t=0,i=u.weights.length;t<i;t++)e.morphTargetInfluences[t]=u.weights[t]})),t}))),void 0!==u.camera&&i.push(s.getDependency("camera",u.camera)),u.extensions&&u.extensions[n.KHR_LIGHTS_PUNCTUAL]&&void 0!==u.extensions[n.KHR_LIGHTS_PUNCTUAL].light&&i.push(s.getDependency("light",u.extensions[n.KHR_LIGHTS_PUNCTUAL].light)),Promise.all(i)).then((function(i){var n;if((n=!0===u.isBone?new e.Bone:i.length>1?new e.Group:1===i.length?i[0]:new e.Object3D)!==i[0])for(var r=0,a=i.length;r<a;r++)n.add(i[r]);if(u.name&&(n.userData.name=u.name,n.name=e.PropertyBinding.sanitizeNodeName(u.name)),V(n,u),u.extensions&&N(o,n,u),void 0!==u.matrix){var l=new e.Matrix4;l.fromArray(u.matrix),n.applyMatrix4(l)}else void 0!==u.translation&&n.position.fromArray(u.translation),void 0!==u.rotation&&n.quaternion.fromArray(u.rotation),void 0!==u.scale&&n.scale.fromArray(u.scale);return s.associations.set(n,{type:"nodes",index:t}),n}))},q.prototype.loadScene=function(){function t(i,n,r,o){var s=r.nodes[i];return o.getDependency("node",i).then((function(t){return void 0===s.skin?t:o.getDependency("skin",s.skin).then((function(e){for(var t=[],n=0,r=(i=e).joints.length;n<r;n++)t.push(o.getDependency("node",i.joints[n]));return Promise.all(t)})).then((function(n){return t.traverse((function(t){if(t.isMesh){for(var r=[],o=[],s=0,a=n.length;s<a;s++){var l=n[s];if(l){r.push(l);var u=new e.Matrix4;void 0!==i.inverseBindMatrices&&u.fromArray(i.inverseBindMatrices.array,16*s),o.push(u)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',i.joints[s])}t.bind(new e.Skeleton(r,o),t.matrixWorld)}})),t}));var i})).then((function(e){n.add(e);var i=[];if(s.children)for(var a=s.children,l=0,u=a.length;l<u;l++){var c=a[l];i.push(t(c,e,r,o))}return Promise.all(i)}))}return function(i){var n=this.json,r=this.extensions,o=this.json.scenes[i],s=new e.Group;o.name&&(s.name=o.name),V(s,o),o.extensions&&N(r,s,o);for(var a=o.nodes||[],l=[],u=0,c=a.length;u<c;u++)l.push(t(a[u],s,n,this));return Promise.all(l).then((function(){return s}))}}(),t}(),lr=new ar,ur=(new n.Matrix4).makeRotationAxis(new n.Vector3(1,0,0),Math.PI/2);function cr(e){function t(e){if(e.isMesh)return function(e){var t=new xt;t.geometry=e.geometry,t.geometry.computeVertexNormals(),t.geometry.computeBoundingBox(),t.geometry.computeBoundingSphere(),t.geometry.addGroup(0,e.geometry.index.count,0);var i=new ci;return i.uniforms.map.value=e.material.map,i.uniforms.exposure.value=3.3,i.opacity=1,e.material.dispose(),t.material=[i],t.position.copy(e.position),t.quaternion.copy(e.quaternion),t.scale.copy(e.scale),t.matrix.compose(t.position,t.quaternion,t.scale),t}(e);if(e.isGroup){for(var i=function(e){var t=new Mt;return t.position.copy(e.position),t.quaternion.copy(e.quaternion),t.scale.copy(e.scale),t.matrix.compose(t.position,t.quaternion,t.scale),t}(e),n=0;n<e.children.length;n++){var r=t(e.children[n]);i.add(r)}return i}return new Mt}return new Promise((function(i,r){var o,s=(new n.Matrix4).copy(e.computedTransform);if("Z"!==(null===(o=e.tileset.asset)||void 0===o?void 0:o.gltfUpAxis)&&s.multiply(ur),e.content){var a=e.content.gltfArrayBuffer,l=e.contentUrl?e.contentUrl.slice(0,e.contentUrl.lastIndexOf("/")+1):"";lr.parse(a,l,(function(e){var n=e.scene,r=new Mt,o=t(n);o.applyMatrix4(s),r.add(o),i(r)}),(function(t){r(new Error("error parsing gltf in tile ".concat(e.id,": ").concat(t.message)))}))}else i(new Mt)}))}function hr(e){e.traverse((function(e){if(e instanceof xt){e.geometry.dispose();for(var t=0,i=e.material;t<i.length;t++){var n=i[t];n.uniforms.map&&n.uniforms.map.value&&(n.uniforms.map.value.dispose(),n.uniforms.map.value=null)}}}))}function dr(e){var t=e.toArray();return(new n.Matrix4).fromArray([2*t[0],2*t[1],2*t[2],0,2*t[3],2*t[4],2*t[5],0,2*t[6],2*t[7],2*t[8],0,0,0,0,1])}var pr=new n.EdgesGeometry(new n.BoxBufferGeometry(1,1,1)),fr=new n.LineBasicMaterial({color:new n.Color(1,1,0),transparent:!0});function Ar(e){e.updateMatrix(),e.updateMatrixWorld(),e.matrixWorld.getInverse(e.matrixWorldInverse);var t=(new n.Matrix4).multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse);return(new n.Frustum).setFromProjectionMatrix(t)}var gr={throttleRequests:!0,maxRequests:64,updateInterval:.1,maxScreenSpaceError:8,maxMemoryUsage:32,viewDistanceScale:.2,onNodeCreated:function(){}},mr=function(e){function t(t){void 0===t&&(t={});var i=e.call(this)||this;return i.options=Oe(Oe({},gr),t),i.clock=new n.Clock,i.timer=0,i.unloadTileQueue=[],i.nodes={},i.boundings={},i.nodeGroup=new n.Group,i.boundingGroup=new n.Group,i.add(i.nodeGroup),i.sseDenominator=null,i.lastCameraTransform=new n.Matrix4,i.lastCameraAspect=1,i.lastCameraFov=null,i.lastCamera=null,i.lastRenderer=null,i.enabled=!1,i}return ke(t,e),Object.defineProperty(t.prototype,"enable",{get:function(){return this.enabled},set:function(e){this.enabled!==e&&(this.enabled=e,!1===this.enabled?this.reset():(this.timer=0,this.clock.getDelta()))},enumerable:!1,configurable:!0}),t.prototype.load=function(e){var t=this,i=e.tileset_url;e.tileset_url_md5;var r=e.b3md_mappings_url;e.b3md_mappings_url_md5;var o={modelMatrix:(new n.Matrix4).fromArray([1,0,0,0,0,-1,0,1e9,0,0,-1,0,0,0,0,1]),maxMemoryUsage:this.options.maxMemoryUsage,maxScreenSpaceError:this.options.maxScreenSpaceError,viewDistanceScale:this.options.viewDistanceScale,throttleRequests:this.options.throttleRequests,maxRequests:this.options.maxRequests,contentLoader:function(e){var i=function(e){var t=e.boundingVolume,i=new n.LineSegments(pr,fr);return i.applyMatrix4(dr(t.halfAxes)),i.position.set(t.center.x,t.center.y,t.center.z),i}(e);return i.visible=!1,t.boundings[e.id]=i,t.boundingGroup.add(i),i.updateMatrixWorld(!0),"SCENEGRAPH"===e.type||"MESH"===e.type?cr(e).then((function(i){void 0===t.tileset?hr(i):(i.visible=!1,t.nodes[e.id]=i,t.nodeGroup.add(i),t.options.onNodeCreated(i),i.updateMatrixWorld(!0))})):Promise.resolve()},onTileLoad:function(){t.enabled&&t.tileset&&t.lastRenderer&&t.lastCamera&&(t.tileset.frameNumber++,t.tilesetUpdate(t.tileset,t.lastRenderer,t.lastCamera)),t.enabled||t.reset()},onTileUnload:function(e){t.unloadTileQueue.push(e)},onTileError:function(e,t){console.error("Tile error",e.id,t)},onTraversalComplete:function(e){return e},allowHosts:this.options.allowHosts,networkSubscribe:this.options.networkSubscribe,requestProxy:this.options.requestProxy,maxDepth:this.options.maxDepth},s=i.split("/").slice(0,-1).join("/"),a=st(i,{allowHosts:this.options.allowHosts,networkSubscribe:this.options.networkSubscribe,requestProxy:this.options.requestProxy}).then((function(e){return JSON.parse(e.body)})).then((function(e){return sr(e,s)})),l=st(r,{allowHosts:this.options.allowHosts,networkSubscribe:this.options.networkSubscribe,requestProxy:this.options.requestProxy}).then((function(e){return JSON.parse(e.body)}));Promise.all([a,l]).then((function(e){var i=e[0],r=e[1];i.b3dmMapping=r;var s=t.tileset=new ir(i,o),a=new n.Matrix4;if(s.root&&s.root.boundingVolume){var l=s.root.boundingVolume,u=l.halfAxes,c=l.center;a.extractRotation(dr(u)),a.setPosition(c.x,c.y,c.z)}s.modelMatrix.copy((new n.Matrix4).getInverse(a))}))},t.prototype.update=function(e,t){this.lastCamera=t,this.lastRenderer=e,!1!==this.enabled&&(this.timer+=this.clock.getDelta(),this.tileset&&this.timer>=this.options.updateInterval&&(t.matrixWorld.equals(this.lastCameraTransform)&&t.aspect===this.lastCameraAspect&&t.fov===this.lastCameraFov||(this.timer=0,this.tileset.frameNumber++,this.lastCameraTransform.copy(t.matrixWorld),this.tilesetUpdate(this.tileset,e,t))))},t.prototype.tilesetUpdate=function(e,t,i){this.sseDenominator&&i.aspect===this.lastCameraAspect&&i.fov===this.lastCameraFov||(this.sseDenominator=function(e){var t=e.aspect,i=e.fov/180*Math.PI,n=e.aspect<=1?i:2*Math.atan(Math.tan(.5*i)/t);return 2*Math.tan(.5*n)}(i),this.lastCameraAspect=i.aspect,this.lastCameraFov=i.fov);var r,o,s,a={camera:{position:i.getWorldPosition(new n.Vector3).toArray(),direction:i.getWorldDirection(new n.Vector3).toArray(),up:i.up.toArray()},height:t.getSize(new n.Vector2).height,frameNumber:e.frameNumber,sseDenominator:this.sseDenominator,cullingVolume:(r=Ar(i),o=r.planes.map((function(e){return new n.Plane(e.normal,e.constant)})),new bn(o))};e.cache.reset(),e.traverser.traverse(e.root,a);for(var l=0,u=e.tiles;l<u.length;l++){var c=u[l],h=c.selected,d=c.id;this.nodes[d]&&this.nodes[d].visible!==h&&(this.nodes[d].visible=h,h&&(this.nodes[d].needsRender=!0)),this.boundings[d]&&this.boundings[d].visible!==h&&(this.boundings[d].visible=h)}for(;s=this.unloadTileQueue.pop();){d=s.id;if(this.nodes[d]){var p=this.nodes[d];this.nodeGroup.remove(p),hr(p),delete this.nodes[d]}if(this.boundings[d]){p=this.boundings[d];this.boundingGroup.remove(p),delete this.boundings[d]}}},t.prototype.reset=function(){if(this.tileset){this.tileset.reset();for(var e=void 0;e=this.unloadTileQueue.pop();)if("UNLOADED"!==e.contentState){var t=e.id;if(this.nodes[t]){var i=this.nodes[t];this.nodeGroup.remove(i),hr(i),delete this.nodes[t]}if(this.boundings[t]){i=this.boundings[t];this.boundingGroup.remove(i),delete this.boundings[t]}}for(var n=0,r=Object.keys(this.nodes);n<r.length;n++){t=r[n];var o=this.nodes[t];this.nodeGroup.remove(o),hr(o),delete this.nodes[t]}for(var s=0,a=Object.keys(this.boundings);s<a.length;s++){t=a[s],o=this.boundings[t];this.boundingGroup.remove(o),delete this.boundings[t]}}},t}(wt);function vr(e){return null==e}var yr=function(e,t){void 0===t&&(t=1e-4),t=Math.max(t,Number.EPSILON);for(var i={},r=e.getIndex(),o=e.getAttribute("position"),s=r?r.count:o.count,a=0,l=Object.keys(e.attributes),u={},c={},h=[],d=["getX","getY","getZ","getW"],p=0,f=l.length;p<f;p++){u[b=l[p]]=[],(E=e.morphAttributes[b])&&(c[b]=new Array(E.length).fill().map((function(){return[]})))}var A=Math.log10(1/t),g=Math.pow(10,A);for(p=0;p<s;p++){var m=r?r.getX(p):p,v="",y=0;for(f=l.length;y<f;y++)for(var b=l[y],x=(M=e.getAttribute(b)).itemSize,w=0;w<x;w++)v+="".concat(~~(M[d[w]](m)*g),",");if(v in i)h.push(i[v]);else{for(y=0,f=l.length;y<f;y++){b=l[y];var M=e.getAttribute(b),E=e.morphAttributes[b],S=(x=M.itemSize,u[b]),C=c[b];for(w=0;w<x;w++){var I=d[w];if(S.push(M[I](m)),E)for(var B=0,T=E.length;B<T;B++)C[B].push(E[B][I](m))}}i[v]=a,h.push(a),a++}}var P=e.clone();for(p=0,f=l.length;p<f;p++){b=l[p];var R=e.getAttribute(b),D=new R.array.constructor(u[b]);M=new n.BufferAttribute(D,R.itemSize,R.normalized);if(P.setAttribute(b,M),b in c)for(y=0;y<c[b].length;y++){var L=e.morphAttributes[b][y],k=(D=new L.array.constructor(c[b][y]),new n.BufferAttribute(D,L.itemSize,L.normalized));P.morphAttributes[b][y]=k}}return P.setIndex(h),P};function br(e){var t;return new((t=n.Triangle).bind.apply(t,Fe([void 0],e.map((function(e){return new n.Vector3(e.x,e.y,e.z)})),!1)))}var xr={at3d:function(e,t){for(var i=$i(t.textureOptions,e.textures.length),n={},r=0,o=e.textures;r<o.length;r++){var s=o[r];n[s]=Zi(s,i,t.allowHosts,t.requestProxy,t.networkSubscribe)}return Promise.resolve().then((function(){return st(e.file,{responseType:"arraybuffer",allowHosts:t.allowHosts,requestProxy:t.requestProxy,networkSubscribe:t.networkSubscribe})})).then((function(e){return qi(e.body)})).then((function(e){return Di((function(){for(var t,i={chunks:[],createAt:void 0,description:void 0},n=0,r=e;n<r.length;n++){var o=r[n],s=Gi.decode(o);s.chunks.length&&((t=i.chunks).push.apply(t,s.chunks),i.createAt=s.createAt,i.description=s.description)}return i}))})).then((function(r){return Di((function(){return Ji(r,e.textureBase,e.textures.slice(),i,n,t.allowHosts,t.requestProxy,t.networkSubscribe)}))}))},pbm:function(e,t){for(var i=$i(t.textureOptions,e.textures.length),n={},r=0,o=e.textures;r<o.length;r++){var s=o[r];n[s]=Zi(s,i,t.allowHosts,t.requestProxy,t.networkSubscribe)}return Promise.resolve().then((function(){return st(e.file,{responseType:"arraybuffer",allowHosts:t.allowHosts,requestProxy:t.requestProxy,networkSubscribe:t.networkSubscribe})})).then((function(e){return Di((function(){var t=new Uint8Array(e.body);return Gi.decode(t)}))})).then((function(r){return Di((function(){return Ji(r,e.textureBase,e.textures.slice(),i,n,t.allowHosts,t.requestProxy,t.networkSubscribe)}))}))},dome:function(e,t){return Promise.resolve().then((function(){return st(e.file,{responseType:"arraybuffer",allowHosts:t.allowHosts,requestProxy:t.requestProxy,networkSubscribe:t.networkSubscribe})})).then((function(i){return cn(new Uint8Array(i.body),e.textureBase,t.textureOptions,t.allowHosts,t.requestProxy,t.networkSubscribe)}))},domez:function(e,t){return Promise.resolve().then((function(){return st(e.file,{responseType:"arraybuffer",allowHosts:t.allowHosts,requestProxy:t.requestProxy,networkSubscribe:t.networkSubscribe})})).then((function(e){return qi(e.body)})).then((function(e){var t=e.reduce((function(e,t){return e+t.length}),0),i=new Uint8Array(t),n=0;return e.forEach((function(e){i.set(e,n),n+=e.length})),i})).then((function(i){return cn(i,e.textureBase,t.textureOptions,t.allowHosts,t.requestProxy,t.networkSubscribe)}))}},wr=function(e){function t(t){void 0===t&&(t={});var i=e.call(this)||this;return i.empty=!0,i.name="model",i.loaded=!1,i.bvhs=Object.assign([],{loaded:!1}),i.bounding=new n.Box3,i.shownFloor=null,i.floorLength=0,i.requestProxy=t.requestProxy,i.networkSubscribe=t.networkSubscribe,i.allowHosts=t.allowHosts,i.renderOrder=-3,i}return ke(t,e),Object.defineProperty(t.prototype,"shownfloor",{get:function(){return this.shownFloor},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"hasTiles",{get:function(){return void 0!==this.tiledModel},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enableTiles",{get:function(){return!!this.tiledModel&&this.tiledModel.enable},set:function(e){this.tiledModel&&(this.tiledModel.enable=e)},enumerable:!1,configurable:!0}),t.prototype.getEdges=function(e){var t;if(void 0===e&&(e=30/180*Math.PI),!this.originModel)return[];for(var i=Math.cos(e),r=[],o=0,s=this.originModel.children;o<s.length;o++){var a=s[o];if(a instanceof xt){for(var l={},u=["a","b","c"],c=yr(a.geometry),h=c.getAttribute("position").array,d=(null===(t=c.getIndex())||void 0===t?void 0:t.array)||[],p=[],f=[],A=0,g=h.length;A<g;A+=3)p.push(new n.Vector3(h[A],h[A+1],h[A+2]));for(A=0,g=d.length;A<g;A+=3){var m=d[A],v=d[A+1],y=d[A+2],b=(new n.Vector3).crossVectors(p[v].clone().sub(p[m]),p[y].clone().sub(p[m])).normalize();f.push({a:m,b:v,c:y,normal:b})}for(A=0,g=f.length;A<g;A++)for(var x=f[A],w=0;w<3;w++){var M=x[u[w]],E=x[u[(w+1)%3]],S=[Math.min(M,E),Math.max(M,E)];void 0===l[C=S[0]+"-"+S[1]]?l[C]={index1:S[0],index2:S[1],face1:A}:l[C].face2=A}for(var C in l){var I=l[C];if(void 0===I.face2||f[I.face1].normal.dot(f[I.face2].normal)<=i){var B=p[I.index1],T=p[I.index2];r.push(new n.Line3(B,T))}}c.dispose(),p.length=0,f.length=0}}return r},t.prototype.hasFloors=function(){return this.hasFloors_()},t.prototype.hasFloors_=function(){var e=[];return this.traverse((function(t){t instanceof xt&&(e[t.floorIndex]=!0)})),e.length},t.prototype.show=function(){for(var e,t,i=[],r=0;r<arguments.length;r++)i[r]=arguments[r];var o=this.shownFloor,s=null,a=null!==(e=i[1])&&void 0!==e?e:.1,l=0!==i.length;this.shownFloor=s=l?i[0]:null,this.setMaterial({opacity:1,floorInfo:new n.Vector3(0,0,0)}),(null===(t=this.tiledModel)||void 0===t?void 0:t.enable)?this.b3dmShow(o,s):this.at3dShow(o,s,a)},t.prototype.at3dShow=function(e,t,i){this.traverse((function(e){e instanceof xt&&e.material.forEach((function(n){null===t||t===e.floorIndex?n.opacity=1*n.originOpacity:n.opacity=n.originOpacity*i}))})),e!==this.shownFloor&&this.emit("shownFloorChange",this.shownFloor,this.floorLength),this.needsRender=!0},t.prototype.b3dmShow=function(e,t){var i,r;if(null===(r=null===(i=this.tiledModel)||void 0===i?void 0:i.tileset)||void 0===r?void 0:r.floorInfo){if("number"==typeof t&&t>=0&&t<this.tiledModel.tileset.floorInfo.length){var o=this.tiledModel.tileset.floorInfo,s=-o[t].ground,a=o[t].height+s;this.setMaterial({opacity:1,floorInfo:new n.Vector3(s,a,0)})}else this.setMaterial({opacity:1,floorInfo:new n.Vector3(0,0,0)});e!==this.shownFloor&&this.emit("shownFloorChange",this.shownFloor,this.floorLength),this.needsRender=!0}},t.prototype.intersectRaycaster=function(e,t){var i=e.ray,r=i.origin,o=i.direction;if(vr(t))if(vr(this.shownFloor)){var s=this.floorLength;t=[];for(var a=-1;a<s;a++)t.push(a)}else t=[this.shownFloor];var l=[],u=[];Array.isArray(t)?u.push.apply(u,t):u.push(t);for(var c=function(t){var i=h.bvhs&&h.bvhs[t];if(i){var s=new xi(r.x,r.y,r.z),a=new xi(o.x,o.y,o.z),u=i.intersectRay(s,a,!0).map((function(e){var t=e.intersectionPoint,i=e.triangle,o=new n.Vector3(t.x,t.y,t.z);return{point:o,face:{normal:br(i).getNormal(new n.Vector3)},distance:r.distanceTo(o)}}));u.length&&l.push.apply(l,u)}else if(h.originModel){var c=[];h.originModel.traverse((function(e){e instanceof xt&&e.floorIndex===t&&c.push(e)})),(u=e.intersectObjects(c).map((function(e){return{face:e.face?{normal:e.face.normal}:void 0,point:e.point,distance:e.distance}}))).length&&l.push.apply(l,u)}},h=this,d=0,p=u;d<p.length;d++){c(p[d])}return l.filter((function(t){var i=t.distance;return i<=e.far&&i>=e.near})).sort((function(e,t){return e.distance-t.distance}))},t.prototype.buildBVH=function(){if(!this.bvhs.loaded&&this.originModel){var e=[];this.originModel.traverse((function(t){t instanceof xt&&(e[t.floorIndex]=e[t.floorIndex]||[],e[t.floorIndex].push(t.geometry))})),this.bvhs.length=0;for(var t=0,i=e;t<i.length;t++){var n=i[t],r=0;if(n){for(var o=0,s=n;o<s.length;o++){var a=0;a=(d=s[o]).index?d.index.array.length:d.attributes.position.array.length/3,r+=3*Math.floor(a/3)}for(var l=new Float32Array(3*r),u=0,c=0,h=n;c<h.length;c++){var d,p=(d=h[c]).attributes.position.array,f=d.index?d.index.array:null;if(f){for(var A=3*Math.floor(f.length/3),g=0,m=void 0,v=void 0;g<A;g++)m=3*(u+g),v=3*f[g],l[m]=p[v],l[m+1]=p[v+1],l[m+2]=p[v+2];u+=A}else{for(A=3*Math.floor(p.length/3/3),g=0,m=void 0,v=void 0;g<A;g++)v=3*g,l[m=3*(u+g)]=p[v],l[m+1]=p[v+1],l[m+2]=p[v+2];u+=A}}var y=(new Bi).create(l).splitNode(50);this.bvhs.push(y)}}this.bvhs.loaded=!0,this.emit("bvhLoaded")}},t.prototype.load=function(e,t){var i=this;if(void 0===t&&(t={}),!0===this.loaded)throw new Error("[MODEL LOAD ERROR]: model cannot load twice.");var n=function(e,t){if(void 0===t&&(t=[]),/^blob\:/.test(e))return"at3d";var i=/([0-9a-z\.\_\-]+)([\?\#].*)?$/i.exec(e);if(!i)return"";for(var n=0,r=String(i[1]).trim().split(".").slice(1).reverse();n<r.length;n++){var o=r[n],s=t.indexOf(o);if(s>=0)return t[s]}return""}(e.file,Object.keys(xr)),r=xr[n];if(!r)throw new Error("[MODEL LOAD ERROR]: file type(".concat(n,") does not support."));return this.name=e.file,r(e,{textureOptions:t,allowHosts:this.allowHosts,requestProxy:this.requestProxy,networkSubscribe:this.networkSubscribe}).then((function(t){var n=t.createAt,r=t.description,o=t.objects,s=t.texturePromise;i.userData.createAt=n,i.userData.description=r,i.bounding.makeEmpty();var a=i.originModel=new wt;a.renderOrder=-3;for(var l=0,u=o;l<u.length;l++){var c=u[l];c.traverse((function(e){if(e instanceof xt){var t=e.geometry;t.boundingBox||t.computeBoundingBox(),t.boundingSphere||t.computeBoundingSphere(),i.bounding.union(t.boundingBox)}})),a.add(c)}if(i.add(a),i.floorLength=i.hasFloors_(),i.empty=!1,i.loaded=!0,e.tiles&&e.tiles.tileset_url&&e.tiles.b3md_mappings_url){var h=i.tiledModel=new mr({onNodeCreated:function(e){var t=a.getMaterial();t&&(e.setMaterial(t),e.renderOrder=-3)},allowHosts:i.allowHosts,networkSubscribe:i.networkSubscribe,requestProxy:i.requestProxy});h.renderOrder=-3,i.add(h),h.load(e.tiles)}e.bvh&&i.buildBVH(),Di((function(){i.emit("geometryLoaded"),s.then((function(){i.emit("materialLoaded"),i.emit("loaded")}))}))})).catch((function(e){return i.name="",i.emit("error",e),Promise.reject(e)}))},t.prototype.update=function(e,t){if(this.originModel){var i=this.originModel.visible;if(this.tiledModel&&this.tiledModel.enable&&this.tiledModel.tileset){this.tiledModel.update(e,t);var n=this.tiledModel.tileset.root;n.content&&"READY"===n.contentState&&!1!==i&&(this.setTransparent(!1),this.shownFloor&&this.show(this.shownFloor),this.originModel.visible=!1,this.originModel.needsRender=!0)}else!0!==i&&(this.originModel.visible=!0,this.originModel.needsRender=!0)}},t.prototype.dispose=function(){this.off();var e=this.originModel,t=this.tiledModel;if(t&&(t.enable=!1,t.reset()),e)for(e.disposeGeometry(),e.disposeMaterial();e.children.length;)e.remove(e.children[0]);this.bvhs.length=0,this.bvhs.loaded=!1},t}(wt);Object.assign(wr.prototype,{on:He.prototype.on,once:He.prototype.once,off:He.prototype.off,emit:He.prototype.emit,hasListener:He.prototype.hasListener});function Mr(e,t,i){return e<t?t:e>i?i:e}function Er(e,t){if(e===t)return!0;if(e&&t&&"object"==typeof e&&"object"==typeof t){if(e.constructor!==t.constructor)return!1;var i,n,r;if(Array.isArray(e)){if((i=e.length)!=t.length)return!1;for(n=i;0!=n--;)if(!Er(e[n],t[n]))return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===t.toString();if((i=(r=Object.keys(e)).length)!==Object.keys(t).length)return!1;for(n=i;0!=n--;)if(!Object.prototype.hasOwnProperty.call(t,r[n]))return!1;for(n=i;0!=n--;){var o=r[n];if(!Er(e[o],t[o]))return!1}return!0}return e!=e&&t!=t}function Sr(e){return"number"==typeof e}function Cr(e){return 0==(e&e-1)&&0!==e}var Ir=function(){return new Error("Invalid input.")},Br=function(){return new Error("Invalid certificate.")},Tr=function(){return new Error("Invalid signature.")};function Pr(e,t){void 0===t&&(t=!1);var i=typeof e;if("string"===i)return JSON.stringify(e);if(!0===e)return"true";if(!1===e)return"false";if(null===e)return"null";if(e instanceof Array){for(var n="[",r=e.length-1,o=0;o<r;o++)n+=Pr(e[o],!1)+",";return r>-1&&(n+=Pr(e[o],!1)),n+"]"}if(e instanceof Object){if("function"==typeof e.toJSON)return Pr(e.toJSON(),t);var s=Object.keys(e).sort(),a=s.length;for(n="",o=0;o<a;){var l=s[o],u=Pr(e[l],!0);void 0!==u&&(o&&""!==n&&(n+=","),n+=JSON.stringify(l)+":"+u),o++}return"{"+n+"}"}switch(i){case"function":case"undefined":return t?void 0:null;case"number":return 0;default:return isFinite(e)?e:null}}function Rr(e){return String(Pr(e,!1))}function Dr(e){var t,i,n;if(Array.isArray(e)){var r,o,s=void 0;if(e.length<=0)return Ir();for(var a=function(t){var i=Dr(e[t]);if(i instanceof Error)return{value:i};if(s){if(s!==i.issuer)return{value:Br()}}else s=i.issuer;r?i.expire.getTime()<r.getTime()&&(r=i.expire):r=i.expire,o=o?o.filter((function(e){return-1!==i.allowHosts.indexOf(e)})):i.allowHosts},l=0;l<e.length;l++){var u=a(l);if("object"==typeof u)return u.value}return je({issuer:s,expire:r,allowHosts:o})}var c=JSON.parse(e),h="undefined"!=typeof location?location.hostname:"",d=Date.now();if("object"!=typeof c)return Ir();var p=new Date("string"==typeof c.expire_at&&/^\d+$/.test(c.expire_at)?Number(c.expire_at):c.expire_at),f=Array.isArray(c.allow_hosts)?c.allow_hosts:[];if(0===h.length||Ge(h)||Xe.filter((function(e){return _e(e,h)})).length>0){var A=String(null!==(t=c.certificate)&&void 0!==t?t:"");if(A){var g=new Ie;return g.readCertPEM(A),je({issuer:g.getSubjectString(),expire:p,allowHosts:f})}return je({issuer:"none",expire:p,allowHosts:f})}var m=String(null!==(i=c.certificate)&&void 0!==i?i:"");if(!m)return Br();var v=new Ie;v.readCertPEM(m);var y=String(null!==(n=c._signature)&&void 0!==n?n:"");if(!y)return Tr();var b=Rr(function(e,t){for(var i={},n=0,r=Object.keys(e);n<r.length;n++){var o=r[n];-1===t.indexOf(o)&&(i[o]=e[o])}return i}(c,["_signature"]));return!1===function(e,t,i){var n=new Ie;if("string"==typeof i?n.readCertPEM(i):n.readCertHex(i.hex),!1===De(n))return!1;var r=new W;return r.readCertPubKeyHex(n.hex,6),!!r.verify(e,k(t))}(b,y,v)?Tr():d<p.getTime()?0===f.filter((function(e){return _e(e,h)})).length?function(e){return new Error("host(".concat(JSON.stringify(e),") is not allowed."))}(h):je({issuer:v.getSubjectString(),expire:p,allowHosts:f}):function(e){return new Error("date(".concat(e.toString(),") expired."))}(p)}var Lr=new WeakMap,kr=function(){function e(){this.name="",this.workCode="",this.expire=new Date,this.allowHosts=[],this.initial={mode:"Panorama",latitude:0,longitude:0,panoIndex:0,fov:80},this.observers=[],this.issuer="none",this.raw={works:[""],options:""}}return e.prototype.toJSON=function(){return this.raw.works},e.parse=Vr,e}();function Or(e){return null==e?"null":Array.isArray(e)?"array":"object"==typeof e?"dict":"value"}function Fr(e,t){var i=Or(e),n=Or(t);if("null"===n)return e;if("value"===n)return t;if(n!==i)return JSON.parse(JSON.stringify(t));if("array"===n)for(var r=0;r<t.length;r++)e[r]=Fr(e[r],t[r]);else if("dict"===n)for(var o in t)e[o]=Fr(e[o],t[o]);return e}function Nr(e,t,i){for(var r,o=JSON.stringify(t),s=[],a=0,l=[].concat(e);a<l.length;a++){var u=l[a];u instanceof kr?s.push.apply(s,u.raw.works):"string"==typeof u?s.push(u):s.push(JSON.stringify(u))}var c=Dr(s);if(c instanceof Error)return c;t=JSON.parse(o),e=s.map((function(e){return JSON.parse(e)})).reduce((function(e,t){return Fr(e,t)}));var h=new kr;if(c instanceof Error)return c;h.issuer=c.issuer,h.expire=c.expire,h.allowHosts=c.allowHosts,h.raw={works:s,options:o};var d=null!==(r=e.base_url)&&void 0!==r?r:"";d&&"/"!==d[d.length-1]&&(d+="/");var p=function(e,t){return 0===e.indexOf(t)},f=function(e,n){var r,o=e;if(!0===t.jsonp){o=e.replace(/([\?\#].*)?$/i,"");var s=Be("".concat(o)).slice(0,7);o="".concat(o,".").concat(s,".jsonp")}if(!0===t.shortPath){var a=o.replace(d,"").split("."),l=null!==(r=a.shift())&&void 0!==r?r:"",u=a.join(".");o=Ui(d,Be(l))+(u?"."+u:"")}var c=o.replace(d,"");return t.baseURL&&(o=Ui(t.baseURL,c)),i&&i(e,o,c,n),o},A=function(t,i){var n,r,o,s,a,l,u=t;if(!en(t)){var c=null!==(l=null!==(s=null!==(r=null===(n=e.panorama)||void 0===n?void 0:n.pano_high_cube_base_url)&&void 0!==r?r:null===(o=e.panorama)||void 0===o?void 0:o.pano_cube_base_url)&&void 0!==s?s:null===(a=e.panorama)||void 0===a?void 0:a.base_url)&&void 0!==l?l:"";c&&(c=Ui(c,String(i))),u=Ui(c,u)}return en(u)||(u=Ui(d,u)),p(u,d)||console.warn("".concat(u," is not start with base_url(").concat(d,").")),f(u,"panorama")},g=function(e){var t=e;return en(t)||(t=Ui(d,e)),p(t,d)||console.warn("".concat(t," is not start with base_url(").concat(d,").")),f(t,"model")},m=function(e,t){void 0===t&&(t="");var i=e;return en(i)||(i=Ui(t,i)),en(i)||(i=Ui(d,i)),p(i,d)||console.warn("".concat(i," is not start with base_url(").concat(d,").")),f(i,"texture")};if(c instanceof Error)return c;if(h.workCode=String(e.work_code||e.code||e.vr_code||e.workCode),h.name=String(e.name),c instanceof Error)return c;if(e.model){var v={bvh:!0,async:!1,textureBase:"",textures:[]};"boolean"==typeof t.modelBvh?v.bvh=t.modelBvh:"boolean"==typeof e.model.bvh?v.bvh=e.model.bvh:"boolean"==typeof e.bvh&&(v.bvh=e.bvh),e.model.file?v.file=g(e.model.file):e.model.file_url&&(v.file=g(e.model.file_url)),e.model.textureBase?v.textureBase=m("",e.model.textureBase):e.model.material_base_url?v.textureBase=m("",e.model.material_base_url):v.file&&(v.textureBase=v.file.split("/").slice(0,-1).join("/").replace("/model/","/materials/")),Array.isArray(e.model.textures)?v.textures=e.model.textures.map((function(t){var i,n;return m(t,null!==(n=null!==(i=e.model.textureBase)&&void 0!==i?i:e.model.material_base_url)&&void 0!==n?n:"")})):Array.isArray(e.model.material_textures)&&(v.textures=e.model.material_textures.map((function(t){var i,n;return m(t,null!==(n=null!==(i=e.model.textureBase)&&void 0!==i?i:e.model.material_base_url)&&void 0!==n?n:"")}))),e.model.tiles&&(v.tiles=e.model.tiles),v.file&&(h.model=v)}if(c instanceof Error)return c;if(e.observers&&Array.isArray(e.observers)){var y=[];e.panorama&&(Array.isArray(e.panorama)?y=e.panorama:Array.isArray(e.panorama.list)?y=e.panorama.list:Array.isArray(e.panorama.info)&&(y=e.panorama.info));for(var b=0;b<e.observers.length;b++){var x={},w=e.observers[b];if(!w)break;var M=y[b];if(!M)break;w=Object.assign({},w,M,{active:!1!==w.active&&!1!==M.active}),x.panoIndex=b,x.active=!1!==w.active,x.loadable=!0===w.loadable,x.images={up:A(w.images?w.images.up:w.up,b),down:A(w.images?w.images.down:w.down,b),right:A(w.images?w.images.right:w.right,b),left:A(w.images?w.images.left:w.left,b),front:A(w.images?w.images.front:w.front,b),back:A(w.images?w.images.back:w.back,b)};var E=w.images?w.images.depth:w.depth;E&&(x.images.depth=A(E,b));var S=w.images?w.images.luminance:w.luminance;S&&(x.images.luminance={up:A(S.up,b),down:A(S.down,b),right:A(S.right,b),left:A(S.left,b),front:A(S.front,b),back:A(S.back,b)});var C=w.images?w.images.tiles:w.tiles;if(C){for(var I=[],B=function(e){var t=e.match(/\/cube_(\d+)\//);if(t){var i=Number(t[1]);if(Cr(i))return i}return!1},T=function(e,t){return e.replace(/\/cube_(\d+)\//,(function(){return"/cube_".concat(t,"/")}))},P=0,R=C;P<R.length;P++){var D=R[P];if("number"==typeof D){var L=D,k=B(x.images.front);if(!1===k)continue;if((q=Math.max(k,512*Math.pow(2,L)))>2048){var O=T(x.images.up,q),F=T(x.images.down,q),N=T(x.images.right,q),V=T(x.images.left,q),Q=T(x.images.front,q),H=T(x.images.back,q);I.push({level:L,size:q,up:O,down:F,right:N,left:V,front:Q,back:H})}else{O=x.images.up,F=x.images.down,N=x.images.right,V=x.images.left,Q=x.images.front,H=x.images.back;I.push({level:L,size:q,up:O,down:F,right:N,left:V,front:Q,back:H})}}else{var q;if("number"!=typeof(L=D.level))continue;if("number"!=typeof(q=D.size))continue;O=A(D.up,b),F=A(D.down,b),N=A(D.right,b),V=A(D.left,b),Q=A(D.front,b),H=A(D.back,b);I.push({level:L,size:q,up:O,down:F,right:N,left:V,front:Q,back:H})}}I.sort((function(e,t){return e.level-t.level})),x.images.tiles=I}if(w.position instanceof n.Vector3)x.position=w.position.clone();else{if(!Array.isArray(w.position))break;x.position=(new n.Vector3).fromArray(w.position)}if(w.standingPosition instanceof n.Vector3)x.standingPosition=w.standingPosition.clone();else if(Array.isArray(w.standingPosition))x.standingPosition=(new n.Vector3).fromArray(w.standingPosition);else if(w.standing_position instanceof n.Vector3)x.standingPosition=w.standing_position.clone();else{if(!Array.isArray(w.standing_position))break;x.standingPosition=(new n.Vector3).fromArray(w.standing_position)}if(w.quaternion instanceof n.Quaternion)x.quaternion=w.quaternion.clone();else if(Array.isArray(w.quaternion))x.quaternion=(new n.Quaternion).fromArray(w.quaternion);else{if(!w.quaternion)break;var U=w.quaternion,z=U.x,j=U.y,K=U.z,G=U.w;x.quaternion=new n.Quaternion(z,j,K,G)}if(Array.isArray(w.accessibleNodes)?x.accessibleNodes=w.accessibleNodes.slice():Array.isArray(w.accessible_nodes)&&(x.accessibleNodes=w.accessible_nodes.slice()),Array.isArray(w.visibleNodes)?x.visibleNodes=w.visibleNodes.slice():Array.isArray(w.visible_nodes)&&(x.visibleNodes=w.visible_nodes.slice()),Sr(w.floorIndex)?x.floorIndex=w.floorIndex:Sr(w.floor_index)?x.floorIndex=w.floor_index:x.floorIndex=0,w.video){var _={};"string"==typeof w.video.source&&(_.source=w.video.source),w.video.matrix instanceof n.Matrix4?_.matrix=w.video.matrix.clone():Array.isArray(w.video.matrix)&&(_.matrix=(new n.Matrix4).fromArray(w.video.matrix)),w.video.size instanceof n.Vector2?_.size=w.video.size.clone():Array.isArray(w.video.size)&&(_.size=(new n.Vector2).fromArray(w.video.size)),_.source&&_.matrix&&_.size&&(x.video=_)}h.observers[b]=x}}if(c instanceof Error)return c;for(var W=0,X=h.observers;W<X.length;W++){if((x=X[W]).accessibleNodes)x.accessibleNodes=x.accessibleNodes.filter((function(e){return e<h.observers.length}));else{x.accessibleNodes=[];for(var Y=0;Y<h.observers.length;Y++)h.observers[Y]!==x&&x.accessibleNodes.push(Y)}if(x.visibleNodes)x.visibleNodes=x.visibleNodes.filter((function(e){return e<h.observers.length}));else{x.visibleNodes=[];for(Y=0;Y<h.observers.length;Y++)h.observers[Y]!==x&&x.visibleNodes.push(Y)}}if(c instanceof Error)return c;if(e.initial)if("Floorplan"!==e.initial.mode&&"Topview"!==e.initial.mode&&"Panorama"!==e.initial.mode&&"VRPanorama"!==e.initial.mode&&"Model"!==e.initial.mode&&"DepthPanorama"!==e.initial.mode||(h.initial.mode=e.initial.mode),Sr(e.initial.latitude)&&(h.initial.latitude=e.initial.latitude),Sr(e.initial.longitude)?h.initial.longitude=e.initial.longitude:Sr(e.initial.heading)&&(h.initial.longitude=-(360*(e.initial.heading-.25)+90)/180*Math.PI),Sr(e.initial.fov)&&(h.initial.fov=e.initial.fov),Sr(e.initial.panoIndex)){var Z=h.observers.length>0?h.observers.length-1:0;h.initial.panoIndex=Mr(e.initial.panoIndex,0,Z)}else if(Sr(e.initial.pano_index)){Z=h.observers.length>0?h.observers.length-1:0;h.initial.panoIndex=Mr(e.initial.pano_index,0,Z)}else if(Sr(e.initial.pano)){Z=h.observers.length>0?h.observers.length-1:0;h.initial.panoIndex=Mr(e.initial.pano,0,Z)}if(c instanceof Error)return c;var J=je(h);return Lr.set(J,{works:s,options:o}),J}function Vr(e,t,i){"string"==typeof e&&"{"===e.trim()[0]&&(e=JSON.parse(e));var n=Lr.get(e);if(n){if(t&&!Er(JSON.parse(n.options),t))throw new Error("[PARSE FAILED]: work is parsed with different options.");return e}var r=Nr(e,null!=t?t:{},i);if(r instanceof Error)throw new Error("[PARSE FAILED]: "+r.message+"\nError work input:\n"+JSON.stringify(e));return r}function Qr(){return"undefined"==typeof document?{}:document.createElementNS("http://www.w3.org/1999/xhtml","img")}function Hr(e,t,i){return e+(t-e)*i}function qr(e,t){var i=t[1]-t[0];return e<t[0]?qr(e+i,t):e>=t[1]?qr(e-i,t):e}function Ur(e,t,i,n){return n?function(e,t,i,n){var r=n[1]-n[0];return e=qr(e,n),Hr((t=qr(t,n))-e>r/2?e+r:e-t>r/2?e-r:e,t,i)}(e,t,i,n):Hr(e,t,i)}var zr=function(){function e(e){for(var t in this.config={},this.progress=1,this.ended=!0,this.value={},this.startTime=ze(),this.startVelocity=0,this.duration=0,this.keyframes=[],e){var i=e[t];"number"==typeof i?(this.value[t]=i,this.config[t]={circle:!1}):(this.value[t]=i.value,this.config[t]={circle:i.circle})}this.keyframes=[{progress:0,value:Oe({},this.value)},{progress:1,value:Oe({},this.value)}]}return e.prototype.getProgress=function(e){var t=e-this.startTime;return t<0?0:t>=this.duration?1:1-function(e,t,i,n){var r=(t*i+2*e)/Math.pow(i,3),o=-(2*t*i+3*e)/Math.pow(i,2),s=t,a=e;return r*Math.pow(n,3)+o*Math.pow(n,2)+s*n+a}(1,this.startVelocity,this.duration,t)},e.prototype.getValue=function(e){for(var t=1;t<this.keyframes.length;t++)if(this.keyframes[t].progress>e){var i=this.keyframes[t-1],n=this.keyframes[t],r={};for(var o in this.config){var s=(e-i.progress)/(n.progress-i.progress);r[o]=Ur(i.value[o],n.value[o],s,this.config[o].circle)}return r}return Oe({},this.keyframes[this.keyframes.length-1].value)},e.prototype.getProgressVelocity=function(e){var t=e-this.startTime;return t>=this.duration?0:function(e,t,i,n){var r=(t*i+2*e)/Math.pow(i,3),o=-(2*t*i+3*e)/Math.pow(i,2),s=t;return 3*r*Math.pow(n,2)+2*o*n+s}(1,this.startVelocity,this.duration,t)},e.prototype.update=function(e){return!!this.ended||(this.progress=Math.min(1,Math.max(0,this.progress,this.getProgress(e))),this.value=this.getValue(this.progress),this.ended=this.progress>=1,this.ended&&this.callbacks&&(this.callbacks[0](),this.callbacks=void 0),this.ended)},e.prototype.getKeyFrameSegment=function(e){for(var t=this.getProgress(e),i=1;i<this.keyframes.length;i++)if(this.keyframes[i].progress>t)return[this.keyframes[i-1],this.keyframes[i]];return[this.keyframes[this.keyframes.length-2],this.keyframes[this.keyframes.length-1]]},e.prototype.getTargetKeyframe=function(){return this.keyframes[this.keyframes.length-1]},e.prototype.set=function(e,t,i,n){var r;void 0===i&&(i=0),isNaN(t)&&(t=0),isNaN(i)&&(i=0),n=null!=n?n:ze();var o=this.getProgress(n),s=this.getValue(o),a={};for(var l in this.config)a[l]=null!==(r=e[l])&&void 0!==r?r:s[l];var u=[{progress:0,value:s},{progress:1,value:a}];return this.setKeyframes(u,t,i,n)},e.prototype.setKeyframes=function(e,t,i,n){var r=this;if(void 0===i&&(i=0),e.length<2)throw new Error("keyframes invalid.");return isNaN(t)&&(t=0),isNaN(i)&&(i=0),this.callbacks&&(this.callbacks[1](new Error("motion aborted.")),this.callbacks=void 0),new Promise((function(o,s){n=null!=n?n:ze(),r.progress=0,r.ended=!1,r.startTime=n,r.startVelocity=i,r.keyframes=e,r.duration=t,0===t?(r.progress=1,r.value=Oe({},e[e.length-1].value)):r.value=Oe({},e[0].value),r.callbacks=[o,s]}))},e.prototype.dispose=function(){this.callbacks&&(this.callbacks[1](new Error("motion dispose.")),this.callbacks=void 0)},e}(),jr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAR9JREFUOBF10kFOAzEMBdCZFhCbrrgAN+NqHIULsWKDKO3gF+VHoZpa+rXjfH87nq7btr0ty3KZ8FsxnHeQPL748lA/x0Jsq+AwYe0X8nDtGA33BEJUHIEKW/EorHOLI7BHNlkEbju38YkQAIRZxFkHz2HOirKDxNcIzG+fu/6oLiNmqc5ZrlwTeKyAgJF14tMZmSn87pBrxeX/CRABgk/dl1s+C18dio2Pp9nmCQru2UtdvN+7lI9AFsgb3zNMcSp8FF4LYs3UhLfOAvkDJffci8q1J/ByRLKnQ8gUJUFOd2SeZYliCxwiyJCxCbhUGFKF4zPm61hiq7sVyJnPmATyR5IzLSNyDNEFRCDnkAmA8U2RfCsIefYhDeKOQLv7A+l1ZTyjymNxAAAAAElFTkSuQmCC",Kr=Qr(),Gr=new n.Texture(Kr);Kr.onload=function(){return Gr.needsUpdate=!0},Kr.src=jr;var _r=new n.RingBufferGeometry(.06,.07,32).rotateX(-Math.PI/2),Wr=new n.MeshBasicMaterial({map:Gr,transparent:!0}),Xr=new n.SphereBufferGeometry(.12,16,16),Yr=new n.MeshBasicMaterial({color:16777215,opacity:0,transparent:!0});function Zr(){if("undefined"==typeof document){var e=new n.Texture;return Object.assign(e,{draw:function(e){},retain:!1,pool:!1})}var t=document.createElement("canvas"),i=512,r=256,o=190;t.setAttribute("width",String(i)),t.setAttribute("height",String(i));var s=new n.Texture(t),a=t.getContext("2d");if(!a)throw Error("cannot create canvas context");var l=a.createRadialGradient(r,r,150,r,r,0);function u(){var e=Math.PI/12,t=2*Math.PI/3;a&&(a.beginPath(),a.arc(r,r,o,0*t,1*t-e),a.stroke(),a.beginPath(),a.arc(r,r,o,1*t,2*t-e),a.stroke(),a.beginPath(),a.arc(r,r,o,2*t,3*t-e),a.stroke())}function c(e){a&&(a.clearRect(0,0,i,i),a.lineWidth=20,-1!==e&&(a.globalCompositeOperation="source-over",a.strokeStyle="rgba(255, 255, 255, 1)",u(),a.globalCompositeOperation="source-in",a.beginPath(),a.arc(r,r,o,0,2*Math.PI*e),a.strokeStyle="rgba(255, 255, 255, 1)",a.stroke(),a.globalCompositeOperation="source-over",a.strokeStyle="rgba(255, 255, 255, "+(e?.5:1)+")",u()),a.beginPath(),a.arc(r,r,150,0,2*Math.PI),a.closePath(),a.fillStyle=l,a.fill(),a.fillStyle="rgba(255, 255, 255, 0.01)",a.fillRect(0,0,i,i),s.needsUpdate=!0)}return l.addColorStop(0,"rgba(255, 255, 255, 1)"),l.addColorStop(.15,"rgba(255, 255, 255, 1)"),l.addColorStop(.15,"rgba(255, 255, 255, 0.5)"),l.addColorStop(.4,"rgba(255, 255, 255, 0.0)"),l.addColorStop(1,"rgba(255, 255, 255, 0.0)"),c(0),Object.assign(s,{draw:c,retain:!1,pool:!1})}var Jr=[];var $r=Zr();$r.draw(0);var eo=Zr();eo.draw(1);var to=Zr();to.draw(-1);var io=new n.CircleBufferGeometry(.12,32).rotateX(-Math.PI/2);function no(){return new n.Mesh(io,new n.MeshBasicMaterial({map:$r,transparent:!0}))}function ro(e,t){var i=e.map;0===t||1===t?(!0===i.pool&&(i.retain=!1),0===t&&(e.map=$r),1===t&&(e.map=eo)):(!0!==i.pool&&(e.map=function(){for(var e=0,t=Jr;e<t.length;e++){var i=t[e];if(!1===i.retain)return i}var n=Zr();return n.pool=!0,n.retain=!0,Jr.push(n),n}()),e.map.draw(t))}var oo=function(e){function t(){var t=e.call(this)||this;return t.loading=!1,t.disabled=!1,t.current=!1,t.progress=0,t.opacity=0,t.hitTestMesh=new n.Mesh(Xr,Yr),t.add(t.hitTestMesh),t.centerMesh=no(),t.centerMesh.position.y+=.01,t.add(t.centerMesh),t.loadingMesh=new n.Mesh(_r,Wr),t.loadingMesh.position.y+=.011,t.progressMotion=new zr({progress:t.progress}),t.opacityMotion=new zr({opacity:t.opacity}),t.needsRender=!0,t.renderOrder=-2,t}return ke(t,e),t.prototype.setLoading=function(e){var t=this;this.loading=e,this.stopInterval&&this.stopInterval(),e?(this.add(this.loadingMesh),this.stopInterval=dt.shared.add((function(){t.loadingMesh.rotateOnAxis(new n.Vector3(0,1,0),.1),t.needsRender=!0}))):this.remove(this.loadingMesh),this.needsRender=!0},t.prototype.setDisabled=function(e){this.disabled=e,function(e,t){var i=e.map;!0===i.pool&&(i.retain=!1),e.map=t?to:$r}(this.centerMesh.material,e),this.needsRender=!0},t.prototype.setProgress=function(e){this.setLoading(!1),this.setDisabled(!1),this.progress=e=Mr(e,0,1),e!==this.progressMotion.getTargetKeyframe().value.progress&&this.progressMotion.set({progress:e},120).catch(qe)},t.prototype.setOpacity=function(e){this.opacity=e=Mr(e,0,1),this.current&&(e=1),e!==this.opacityMotion.getTargetKeyframe().value.opacity&&this.opacityMotion.set({opacity:e},500).catch(qe)},t.prototype.setCurrent=function(e){this.current!==e&&(this.current=e,this.setOpacity(this.opacity))},t.prototype.updateTime=function(e,t){this.opacityMotion.ended||(this.opacityMotion.update(e),this.centerMesh.material.opacity=this.opacityMotion.value.opacity,this.needsRender=!0),this.progressMotion.ended||(this.progressMotion.update(e),ro(this.centerMesh.material,this.progressMotion.value.progress),this.needsRender=!0)},t.prototype.dispose=function(){this.setLoading(!1),this.remove(this.hitTestMesh),this.remove(this.centerMesh),this.remove(this.loadingMesh),this.centerMesh.material.dispose()},t}(n.Object3D),so=function(e){return 2*e-e*e*e},ao=new Float32Array([-.13,0,-.13,.13,0,-.13,-.13,0,.13,.13,0,.13]),lo=new Float32Array([0,1,1,1,0,0,1,0]),uo=new Uint8Array([0,2,1,2,3,1]),co=new n.BufferGeometry;co.setAttribute("position",new n.BufferAttribute(ao,3)),co.setAttribute("uv",new n.BufferAttribute(lo,2)),co.setIndex(new n.BufferAttribute(uo,1));var ho,po,fo,Ao,go=(ho=Qr(),po=new n.Texture,fo=256,Ao=128,ho.onload=function(){if("undefined"!=typeof document){var e=document.createElement("canvas");e.setAttribute("width",String(fo)),e.setAttribute("height",String(fo));var t=e.getContext("2d");t&&(t.save(),t.drawImage(ho,0,0,fo,fo),t.globalCompositeOperation="source-out",t.beginPath(),t.arc(Ao,Ao,84.48,0,2*Math.PI),t.lineWidth=29.952,t.strokeStyle="rgba(255, 255, 255, 0.5)",t.stroke(),t.restore(),po.image=e,po.needsUpdate=!0)}},ho.src=jr,po),mo=function(){if("undefined"!=typeof document){var e=256,t=199.68,i=document.createElement("canvas");i.setAttribute("width",String(512)),i.setAttribute("height",String(512));var r=i.getContext("2d");if(r){r.save(),r.beginPath(),r.arc(e,e,t,0,2*Math.PI),r.fillStyle="rgba(255, 255, 255, 0.1)",r.fill(),r.beginPath(),r.arc(e,e,t,0,2*Math.PI),r.strokeStyle="rgba(255, 255, 255, 0.5)",r.lineWidth=10.24,r.stroke(),r.restore();var o=new n.CanvasTexture(i);return o.generateMipmaps=!0,o}}return null}(),vo=function(){if("undefined"!=typeof document){var e=256,t=128,i=document.createElement("canvas");i.setAttribute("width",String(512)),i.setAttribute("height",String(512));var r=i.getContext("2d");if(r){r.save(),r.beginPath(),r.arc(e,e,t,0,2*Math.PI);var o=r.createLinearGradient(e-Math.cos(Math.PI/4)*t,e-Math.sin(Math.PI/4)*t,e+Math.cos(Math.PI/4)*t,e+Math.sin(Math.PI/4)*t);o.addColorStop(0,"rgba(255, 255, 255, 1)"),o.addColorStop(.5,"rgba(255, 255, 255, 0.6)"),o.addColorStop(1,"rgba(255, 255, 255, 1)"),r.strokeStyle=o,r.lineWidth=40.96,r.shadowBlur=25.6,r.shadowColor="rgba(0, 0, 0, 0.1)",r.stroke(),r.restore();var s=new n.CanvasTexture(i);return s.generateMipmaps=!0,s}}return null}(),yo=function(){if("undefined"!=typeof document){var e=256,t=199.68,i=document.createElement("canvas");i.setAttribute("width",String(512)),i.setAttribute("height",String(512));var r=i.getContext("2d");if(r){r.save(),r.beginPath(),r.arc(e,e,t,0,2*Math.PI);var o=r.createLinearGradient(e+Math.cos(Math.PI/4)*t,e-Math.sin(Math.PI/4)*t,e-Math.cos(Math.PI/4)*t,e+Math.sin(Math.PI/4)*t);o.addColorStop(0,"rgba(255, 255, 255, 0.7)"),o.addColorStop(.5,"rgba(255, 255, 255, 0.15)"),o.addColorStop(1,"rgba(255, 255, 255, 0.7)"),r.strokeStyle=o,r.lineWidth=15.36,r.shadowBlur=25.6,r.shadowColor="rgba(0, 0, 0, 0.2)",r.stroke(),r.restore();var s=new n.CanvasTexture(i);return s.generateMipmaps=!0,s}}return null}(),bo=function(){if("undefined"!=typeof document){var e=256,t=document.createElement("canvas");t.setAttribute("width",String(512)),t.setAttribute("height",String(512));var i=t.getContext("2d");if(i){i.save(),i.beginPath(),i.arc(e,e,153.6,0,2*Math.PI);var r=i.createRadialGradient(e,e,153.6,e,e,0);r.addColorStop(0,"rgba(255, 255, 255, 0.9)"),r.addColorStop(.3,"rgba(255, 255, 255, 0.0)"),i.fillStyle=r,i.fill(),i.restore();var o=new n.CanvasTexture(t);return o.generateMipmaps=!0,o}}return null}(),xo=function(e,t){var i=128;e.save(),e.clearRect(0,0,256,256),e.beginPath(),e.arc(i,i,88.32,0,2*Math.PI*t),e.lineWidth=30.72,e.strokeStyle="rgba(255, 255, 255, 0.4)",e.stroke(),e.restore()},wo=function(){if("undefined"!=typeof document){var e=document.createElement("canvas");e.setAttribute("width",String(256)),e.setAttribute("height",String(256));var t=e.getContext("2d");t&&xo(t,2*Math.PI);var i=new n.CanvasTexture(e);return Object.assign(i,{setProgress:function(e){t&&(xo(t,e),i.needsUpdate=!0)}})}return null},Mo=[],Eo=wo(),So=function(e){function t(){var t=e.call(this)||this;t.progress=0,t.opacity=0,t.loading=!1,t.current=!1,t.disabled=!1,t.currentMotion=new zr({progress:0}),t.ringMotion=new zr({scale:1,opacity:1}),t.tapMotion=new zr({scale:1,opacity:1}),t.progressMotion=new zr({progress:0}),t.progressOpacityMotion=new zr({opacity:0}),t.opacityMotion=new zr({opacity:0});var i={blending:n.CustomBlending,blendSrc:n.SrcAlphaFactor,blendDst:n.OneMinusSrcAlphaFactor,blendSrcAlpha:n.OneFactor,blendDstAlpha:n.OneMinusSrcAlphaFactor,depthWrite:!1};return t.centerMesh=new n.Mesh(co,new n.MeshBasicMaterial(Oe(Oe({},i),{map:vo,opacity:0}))),t.ringMesh=new n.Mesh(co,new n.MeshBasicMaterial(Oe(Oe({},i),{map:yo,opacity:0}))),t.loadingMesh=new n.Mesh(co,new n.MeshBasicMaterial(Oe(Oe({},i),{map:go,opacity:.5}))),t.disableMesh=new n.Mesh(co,new n.MeshBasicMaterial(Oe(Oe({},i),{map:mo,opacity:0}))),t.progressMesh=new n.Mesh(co,new n.MeshBasicMaterial(Oe(Oe({},i),{map:Eo,opacity:0}))),t.expandMesh=new n.Mesh(co,new n.MeshBasicMaterial(Oe(Oe({},i),{map:bo,opacity:0}))),t.expandMesh2=new n.Mesh(co,new n.MeshBasicMaterial(Oe(Oe({},i),{map:bo,opacity:0}))),t.loadingMesh.visible=!1,t.disableMesh.visible=!1,t.ringMesh.position.y=.003,t.disableMesh.position.y=.003,t.centerMesh.position.y=.004,t.loadingMesh.position.y=.003,t.progressMesh.position.y=.003,t.expandMesh.position.y=.002,t.expandMesh2.position.y=.002,t.centerMesh.frustumCulled=!1,t.ringMesh.frustumCulled=!1,t.progressMesh.frustumCulled=!1,t.loadingMesh.frustumCulled=!1,t.disableMesh.frustumCulled=!1,t.expandMesh.frustumCulled=!1,t.expandMesh2.frustumCulled=!1,t.container=new n.Group,t.renderOrder=-2,t.container.renderOrder=-2,t.container.add(t.centerMesh),t.container.add(t.ringMesh),t.container.add(t.progressMesh),t.container.add(t.loadingMesh),t.container.add(t.disableMesh),t.add(t.container),t.add(t.expandMesh),t.add(t.expandMesh2),t.currentStartTime=ze(),t.needsRender=!0,t}return ke(t,e),t.prototype.setProgress=function(e){this.setDisabled(!1),this.setLoading(!1),this.progress!==e&&(e=Mr(e,0,1),this.tapMotion.ended&&(0===this.progress&&this.progressOpacityMotion.set({opacity:1},300).catch(qe),0===e?(this.progressOpacityMotion.set({opacity:0},300).catch(qe),this.progressMotion.set({progress:Mr(1.2*e,0,1)},0).catch(qe)):this.progressMotion.set({progress:Mr(1.2*e,0,1)},100).catch(qe)),this.progress=e)},t.prototype.setOpacity=function(e){this.opacity!==e&&(this.opacity=e=Mr(e,0,1),this.opacityMotion.set({opacity:e},500).catch(qe))},t.prototype.setCurrent=function(e){this.current!==e&&(this.currentMotion.set({progress:e?1:0},1e3).catch(qe),this.current=e,!0===this.current&&(this.currentStartTime=ze()))},t.prototype.setLoading=function(e){this.loading!==e&&(this.loading=e,!0===this.disabled&&this.setDisabled(!1),this.loadingMesh.visible=e,this.needsRender=!0)},t.prototype.setDisabled=function(e){this.disabled!==e&&(this.disabled=e,!0===this.loading&&this.setLoading(!1),this.disableMesh.visible=e,this.ringMesh.visible=!e,this.centerMesh.visible=!e,this.needsRender=!0)},t.prototype.tap=function(){var e=this;if(!this.tapMotion.ended)return Promise.resolve();return this.progressOpacityMotion.set({opacity:0},0).catch(qe),this.progressMotion.set({progress:0},0).catch(qe),this.tapMotion.setKeyframes([{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}}],600).then((function(){e.progressOpacityMotion.set({opacity:e.progress>0?1:0},300).catch(qe),e.progressMotion.set({progress:e.progress},120).catch(qe)})).catch(qe)},t.prototype.updateTime=function(e,t){var i;if(!this.progressMotion.ended){this.progressMotion.update(e);var n=this.progressMotion.value.progress;if(null!==this.progressMesh.material.map)if(0===n)this.progressMesh.material.map!==Eo&&(Mo.push(this.progressMesh.material.map),this.progressMesh.material.map=Eo);else if(1===n)this.progressMesh.material.map!==Eo&&(Mo.push(this.progressMesh.material.map),this.progressMesh.material.map=Eo);else{if(this.progressMesh.material.map===Eo){var r=Mo.pop()||wo();this.progressMesh.material.map=r}null===(i=this.progressMesh.material.map)||void 0===i||i.setProgress(n)}this.needsRender=!0}if(!this.progressOpacityMotion.ended){this.progressOpacityMotion.update(e);var o=this.progressOpacityMotion.value.opacity;this.progressMesh.material.opacity=o,this.needsRender=!0}if(!this.opacityMotion.ended){this.opacityMotion.update(e);o=this.opacityMotion.value.opacity*this.tapMotion.value.opacity;this.centerMesh.material.opacity=o,this.ringMesh.material.opacity=o,this.disableMesh.material.opacity=o,this.loadingMesh.material.opacity=o;var s=e/2e3%1;this.expandMesh.material.opacity=(1-so(s))/4*this.currentMotion.progress*this.opacityMotion.value.opacity;s=(e-480)/2e3%1;this.expandMesh2.material.opacity=(1-so(s))*this.currentMotion.progress*this.opacityMotion.value.opacity,this.needsRender=!0}if(!0===this.loadingMesh.visible&&(this.loadingMesh.rotateY(-t/120),this.needsRender=!0),!this.tapMotion.ended){this.tapMotion.update(e);var a=this.tapMotion.value.scale;this.container.scale.set(a,1,a);o=this.opacityMotion.value.opacity*this.tapMotion.value.opacity;this.centerMesh.material.opacity=o,this.ringMesh.material.opacity=o*this.ringMotion.value.opacity,this.disableMesh.material.opacity=o,this.loadingMesh.material.opacity=o,this.needsRender=!0}if(!this.ringMotion.ended){var l=this.ringMotion.value;a=l.scale,o=l.opacity;this.ringMotion.update(e),this.ringMesh.scale.set(a,1,a),this.ringMesh.material.opacity=o*this.opacityMotion.value.opacity*this.tapMotion.value.opacity,this.needsRender=!0}if(this.current&&0===this.progress&&!1===this.loading){var u=(e+500-this.currentStartTime)/2e3;Math.ceil(u)%5<3?.8!==this.ringMotion.getTargetKeyframe().value.scale&&this.ringMotion.set({scale:.8,opacity:0},500).catch(qe):1!==this.ringMotion.getTargetKeyframe().value.scale&&this.ringMotion.set({scale:1,opacity:1},500).catch(qe)}else 1!==this.ringMotion.getTargetKeyframe().value.scale&&this.ringMotion.set({scale:1,opacity:1},500).catch(qe);if(this.current||!this.currentMotion.ended){this.currentMotion.update(e);var c=(e-this.currentStartTime)/2e3;if(Math.ceil(c)%5<3){a=1+Math.sin(Math.PI*c)/25*this.currentMotion.value.progress;this.centerMesh.scale.set(a,1,a),this.needsRender=!0}var h=(e-this.currentStartTime)/2e3;if(Math.ceil(h)%5<3){a=1+.8*so(s=h%1)*this.currentMotion.value.progress;this.expandMesh.scale.set(a,1,a),this.expandMesh.material.opacity=(1-so(s))*this.currentMotion.value.progress*this.opacityMotion.value.opacity,this.needsRender=!0}var d=(e-this.currentStartTime-500)/2e3;if(Math.ceil(d)%5<3){a=1+.8*so(s=d%1)*this.currentMotion.value.progress;this.expandMesh2.scale.set(a,1,a),this.expandMesh2.material.opacity=(1-so(s))/2*this.currentMotion.value.progress*this.opacityMotion.value.opacity,this.needsRender=!0}}},t.prototype.dispose=function(){this.ringMotion.dispose(),this.tapMotion.dispose(),this.progressMotion.dispose(),this.progressOpacityMotion.dispose(),this.opacityMotion.dispose(),this.currentMotion.dispose(),this.progressMesh.material.map!==Eo&&(Mo.push(this.progressMesh.material.map),this.progressMesh.material.map=null),this.ringMesh.material.dispose(),this.disableMesh.material.dispose(),this.centerMesh.material.dispose(),this.expandMesh.material.dispose(),this.expandMesh2.material.dispose(),this.loadingMesh.material.dispose(),this.progressMesh.material.dispose()},t}(n.Object3D),Co=new Float32Array([-.13,0,-.13,.13,0,-.13,-.13,0,.13,.13,0,.13]),Io=new Float32Array([0,1,1,1,0,0,1,0]),Bo=new Uint8Array([0,2,1,2,3,1]),To=new n.BufferGeometry;To.setAttribute("position",new n.BufferAttribute(Co,3)),To.setAttribute("uv",new n.BufferAttribute(Io,2)),To.setIndex(new n.BufferAttribute(Bo,1));var Po=function(){var e=Qr(),t=new n.Texture;return e.onload=function(){if("undefined"!=typeof document){var i=256,n=document.createElement("canvas");n.setAttribute("width",String(i)),n.setAttribute("height",String(i));var r=n.getContext("2d");if(r){r.drawImage(e,0,0,i,i),r.globalCompositeOperation="source-out";var o=128;r.beginPath(),r.lineWidth=29.952,r.arc(o,o,84.48,0,2*Math.PI),r.strokeStyle="rgba(255, 255, 255, 0.5)",r.closePath(),r.stroke(),t.image=n,t.needsUpdate=!0}}},e.src=jr,t}(),Ro=function(){if("undefined"!=typeof document){var e=document.createElement("canvas");e.setAttribute("width",String(512)),e.setAttribute("height",String(512));var t=e.getContext("2d");if(t){var i=256,r=199.68;return t.beginPath(),t.arc(i,i,r,0,2*Math.PI),t.fillStyle="rgba(255, 255, 255, 0.1)",t.closePath(),t.fill(),t.save(),t.beginPath(),t.arc(i,i,r,0,2*Math.PI),t.strokeStyle="rgba(255, 255, 255, 0.5)",t.lineWidth=10.24,t.closePath(),t.stroke(),new n.CanvasTexture(e)}}return null}(),Do=function(){if("undefined"!=typeof document){var e=document.createElement("canvas");e.setAttribute("width",String(512)),e.setAttribute("height",String(512));var t=e.getContext("2d");if(t){return t.beginPath(),t.arc(256,256,199.68,0,2*Math.PI),t.fillStyle="rgba(0, 0, 0, 0.2)",t.closePath(),t.fill(),new n.CanvasTexture(e)}}return null}(),Lo=function(){if("undefined"!=typeof document){var e=document.createElement("canvas");e.setAttribute("width",String(512)),e.setAttribute("height",String(512));var t=e.getContext("2d");if(t){var i=256,r=138.24,o=t.createLinearGradient(i-Math.cos(Math.PI/4)*r,i-Math.sin(Math.PI/4)*r,i+Math.cos(Math.PI/4)*r,i+Math.sin(Math.PI/4)*r);return o.addColorStop(0,"rgba(255, 255, 255, 1)"),o.addColorStop(.5,"rgba(255, 255, 255, 0.6)"),o.addColorStop(1,"rgba(255, 255, 255, 1)"),t.beginPath(),t.lineWidth=33.28,t.arc(i,i,r,0,2*Math.PI),t.strokeStyle=o,t.shadowBlur=38.4,t.shadowColor="rgba(0, 0, 0, 0.3)",t.closePath(),t.stroke(),new n.CanvasTexture(e)}}return null}(),ko=function(){if("undefined"!=typeof document){var e=document.createElement("canvas");e.setAttribute("width",String(512)),e.setAttribute("height",String(512));var t=e.getContext("2d");if(t){var i=256,r=199.68,o=t.createLinearGradient(i+Math.cos(Math.PI/4)*r,i-Math.sin(Math.PI/4)*r,i-Math.cos(Math.PI/4)*r,i+Math.sin(Math.PI/4)*r);return o.addColorStop(0,"rgba(255, 255, 255, 0.5)"),o.addColorStop(.5,"rgba(255, 255, 255, 0.1)"),o.addColorStop(1,"rgba(255, 255, 255, 0.5)"),t.beginPath(),t.lineWidth=15.36,t.arc(i,i,r,0,2*Math.PI),t.strokeStyle=o,t.shadowBlur=25.6,t.shadowColor="rgba(0, 0, 0, 0.5)",t.closePath(),t.stroke(),new n.CanvasTexture(e)}}return null}(),Oo=function(e,t){var i=128;e.clearRect(0,0,256,256),e.beginPath(),e.lineWidth=29.44,e.arc(i,i,84.48,0,2*Math.PI*t),e.strokeStyle="rgba(255, 255, 255, 0.2)",e.stroke()},Fo=function(){if("undefined"!=typeof document){var e=document.createElement("canvas");e.setAttribute("width",String(256)),e.setAttribute("height",String(256));var t=e.getContext("2d");t&&Oo(t,2*Math.PI);var i=new n.CanvasTexture(e);return Object.assign(i,{setProgress:function(e){t&&(Oo(t,e),i.needsUpdate=!0)}})}return null},No=[],Vo=Fo(),Qo=function(e){function t(){var t=e.call(this)||this;t.progress=0,t.opacity=0,t.loading=!1,t.current=!1,t.disabled=!1,t.ringRotateMotion=new zr({angle:0}),t.tapMotion=new zr({scale:1,opacity:1}),t.progressMotion=new zr({progress:0}),t.progressOpacityMotion=new zr({opacity:0}),t.opacityMotion=new zr({opacity:0});var i={blending:n.CustomBlending,blendSrc:n.SrcAlphaFactor,blendDst:n.OneMinusSrcAlphaFactor,blendSrcAlpha:n.OneFactor,blendDstAlpha:n.OneMinusSrcAlphaFactor,depthWrite:!1};return t.backgroundMesh=new n.Mesh(To,new n.MeshBasicMaterial(Oe(Oe({},i),{map:Do,opacity:1}))),t.centerMesh=new n.Mesh(To,new n.MeshBasicMaterial(Oe(Oe({},i),{map:Lo,opacity:0}))),t.ringMesh=new n.Mesh(To,new n.MeshBasicMaterial(Oe(Oe({},i),{map:ko,opacity:0}))),t.loadingMesh=new n.Mesh(To,new n.MeshBasicMaterial(Oe(Oe({},i),{map:Po,opacity:.5}))),t.disableMesh=new n.Mesh(To,new n.MeshBasicMaterial(Oe(Oe({},i),{map:Ro,opacity:0}))),t.progressMesh=new n.Mesh(To,new n.MeshBasicMaterial(Oe(Oe({},i),{map:Vo,opacity:0}))),t.loadingMesh.visible=!1,t.disableMesh.visible=!1,t.backgroundMesh.position.y=.0018,t.ringMesh.position.y=.003,t.disableMesh.position.y=.002,t.centerMesh.position.y=.002,t.loadingMesh.position.y=.005,t.progressMesh.position.y=.004,t.centerMesh.frustumCulled=!1,t.ringMesh.frustumCulled=!1,t.progressMesh.frustumCulled=!1,t.loadingMesh.frustumCulled=!1,t.disableMesh.frustumCulled=!1,t.container=new n.Group,t.renderOrder=-2,t.container.renderOrder=-2,t.container.add(t.backgroundMesh),t.container.add(t.centerMesh),t.container.add(t.ringMesh),t.container.add(t.progressMesh),t.container.add(t.loadingMesh),t.container.add(t.disableMesh),t.add(t.container),t.needsRender=!0,t}return ke(t,e),t.prototype.setProgress=function(e){this.setDisabled(!1),this.setLoading(!1),this.progress!==e&&(e=Mr(e,0,1),this.tapMotion.ended&&(0===this.progress&&this.progressOpacityMotion.set({opacity:1},300).catch(qe),0===e?(this.progressOpacityMotion.set({opacity:0},300).catch(qe),this.progressMotion.set({progress:Mr(1.2*e,0,1)},0).catch(qe)):this.progressMotion.set({progress:Mr(1.2*e,0,1)},100).catch(qe)),this.progress=e)},t.prototype.setOpacity=function(e){this.opacity!==e&&(this.opacity=e=Mr(e,0,1),this.opacityMotion.set({opacity:e},500).catch(qe))},t.prototype.setCurrent=function(e){if(this.current!==e){if(!0===e&&this.ringRotateMotion.ended){var t=[{progress:0,value:{angle:0}},{progress:1,value:{angle:2*Math.PI}}];this.ringRotateMotion.setKeyframes(t,5e3).catch(qe)}this.current=e}},t.prototype.setLoading=function(e){this.loading!==e&&(this.loading=e,!0===this.disabled&&this.setDisabled(!1),this.loadingMesh.visible=e,this.needsRender=!0)},t.prototype.setDisabled=function(e){this.disabled!==e&&(this.disabled=e,!0===this.loading&&this.setLoading(!1),this.disableMesh.visible=e,this.ringMesh.visible=!e,this.centerMesh.visible=!e,this.needsRender=!0)},t.prototype.tap=function(){var e=this;if(!this.tapMotion.ended)return Promise.resolve();return this.progressOpacityMotion.set({opacity:0},0).catch(qe),this.progressMotion.set({progress:0},0).catch(qe),this.tapMotion.setKeyframes([{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}}],600).then((function(){e.progressOpacityMotion.set({opacity:e.progress>0?1:0},300).catch(qe),e.progressMotion.set({progress:e.progress},120).catch(qe)})).catch(qe)},t.prototype.updateTime=function(e,t){var i;if(!this.progressMotion.ended){this.progressMotion.update(e);var r=this.progressMotion.value.progress;if(null!==this.progressMesh.material.map)if(0===r)this.progressMesh.material.map!==Vo&&(No.push(this.progressMesh.material.map),this.progressMesh.material.map=Vo);else if(1===r)this.progressMesh.material.map!==Vo&&(No.push(this.progressMesh.material.map),this.progressMesh.material.map=Vo);else{if(this.progressMesh.material.map===Vo){var o=No.pop()||Fo();this.progressMesh.material.map=o}null===(i=this.progressMesh.material.map)||void 0===i||i.setProgress(r)}this.needsRender=!0}if(!this.progressOpacityMotion.ended){this.progressOpacityMotion.update(e);var s=this.progressOpacityMotion.value.opacity;this.progressMesh.material.opacity=s,this.needsRender=!0}if(!this.opacityMotion.ended){this.opacityMotion.update(e);s=this.opacityMotion.value.opacity*this.tapMotion.value.opacity;this.backgroundMesh.material.opacity=s,this.centerMesh.material.opacity=s,this.ringMesh.material.opacity=s,this.disableMesh.material.opacity=s,this.loadingMesh.material.opacity=s,this.needsRender=!0}if(!0===this.loadingMesh.visible&&(this.loadingMesh.rotateY(-t/120),this.needsRender=!0),!this.tapMotion.ended){this.tapMotion.update(e);var a=this.tapMotion.value.scale;this.backgroundMesh.scale.set(a,a,a),this.centerMesh.scale.set(a,a,a),this.ringMesh.scale.set(a,a,a),this.progressMesh.scale.set(a,a,a);s=this.opacityMotion.value.opacity*this.tapMotion.value.opacity;this.centerMesh.material.opacity=s,this.ringMesh.material.opacity=s,this.disableMesh.material.opacity=s,this.loadingMesh.material.opacity=s,this.needsRender=!0}this.ringRotateMotion.ended||(this.ringRotateMotion.update(e),this.ringMesh.quaternion.setFromEuler(new n.Euler(0,this.ringRotateMotion.value.angle,0)),this.needsRender=!0)},t.prototype.dispose=function(){this.ringRotateMotion.dispose(),this.tapMotion.dispose(),this.progressMotion.dispose(),this.progressOpacityMotion.dispose(),this.opacityMotion.dispose(),this.progressMesh.material.map!==Vo&&(No.push(this.progressMesh.material.map),this.progressMesh.material.map=null),this.ringMesh.material.dispose(),this.disableMesh.material.dispose(),this.centerMesh.material.dispose(),this.loadingMesh.material.dispose(),this.progressMesh.material.dispose()},t}(n.Object3D),Ho=function(e){return 2*e-e*e*e},qo=new Float32Array([-.13,0,-.13,.13,0,-.13,-.13,0,.13,.13,0,.13]),Uo=new Float32Array([0,1,1,1,0,0,1,0]),zo=new Uint8Array([0,2,1,2,3,1]),jo=new n.BufferGeometry;jo.setAttribute("position",new n.BufferAttribute(qo,3)),jo.setAttribute("uv",new n.BufferAttribute(Uo,2)),jo.setIndex(new n.BufferAttribute(zo,1));var Ko=function(){var e=Qr(),t=new n.Texture,i=256,r=128;return e.onload=function(){if("undefined"!=typeof document){var n=document.createElement("canvas");n.setAttribute("width",String(i)),n.setAttribute("height",String(i));var o=n.getContext("2d");o&&(o.save(),o.clearRect(0,0,i,i),o.drawImage(e,0,0,i,i),o.globalCompositeOperation="source-out",o.beginPath(),o.lineWidth=29.44,o.arc(r,r,84.48,0,2*Math.PI),o.strokeStyle="rgba(255, 255, 255, 0.7)",o.stroke(),o.restore(),t.image=n,t.needsUpdate=!0)}},e.src=jr,t}(),Go=function(){if("undefined"!=typeof document){var e=256,t=199.68,i=document.createElement("canvas");i.setAttribute("width",String(512)),i.setAttribute("height",String(512));var r=i.getContext("2d");if(r)return r.save(),r.beginPath(),r.arc(e,e,t,0,2*Math.PI),r.fillStyle="rgba(255, 255, 255, 0.1)",r.fill(),r.beginPath(),r.arc(e,e,t,0,2*Math.PI),r.strokeStyle="rgba(255, 255, 255, 0.5)",r.lineWidth=10.24,r.stroke(),r.restore(),new n.CanvasTexture(i)}return null}(),_o=function(){if("undefined"!=typeof document){var e=128,t=document.createElement("canvas");t.setAttribute("width",String(256)),t.setAttribute("height",String(256));var i=t.getContext("2d");if(i)return i.save(),i.beginPath(),i.arc(e,e,84.48,0,2*Math.PI),i.lineWidth=29.44,i.strokeStyle="rgba(255, 255, 255, 0.8)",i.shadowBlur=19.2,i.shadowColor="rgba(200, 200, 200, 0.2)",i.stroke(),i.restore(),new n.CanvasTexture(t)}return null}(),Wo=function(){if("undefined"!=typeof document){var e=256,t=document.createElement("canvas");t.setAttribute("width",String(512)),t.setAttribute("height",String(512));var i=t.getContext("2d");if(i){i.save(),i.beginPath(),i.arc(e,e,204.8,0,2*Math.PI);var r=i.createRadialGradient(e,e,204.8,e,e,0);r.addColorStop(0,"rgba(255, 255, 255, 0.9)"),r.addColorStop(.3,"rgba(255, 255, 255, 0.0)"),i.fillStyle=r,i.fill(),i.restore();var o=new n.CanvasTexture(t);return o.generateMipmaps=!0,o}}return null}(),Xo=function(e,t){var i=128;e.save(),e.clearRect(0,0,256,256),e.beginPath(),e.arc(i,i,84.48,0,2*Math.PI),e.lineWidth=29.44,e.strokeStyle="rgba(255, 255, 255, 0.6)",e.stroke(),e.beginPath(),e.arc(i,i,84.48,0,2*Math.PI*t),e.lineWidth=29.44,e.strokeStyle="rgba(255, 255, 255, 1.0)",e.stroke(),e.restore()},Yo=function(){if("undefined"!=typeof document){var e=document.createElement("canvas");e.setAttribute("width",String(256)),e.setAttribute("height",String(256));var t=e.getContext("2d");t&&Xo(t,2*Math.PI);var i=new n.CanvasTexture(e);return Object.assign(i,{setProgress:function(e){t&&(Xo(t,e),i.needsUpdate=!0)}})}return null},Zo=[],Jo=Yo(),$o=function(e){function t(){var t=e.call(this)||this;t.progress=0,t.opacity=0,t.loading=!1,t.current=!1,t.disabled=!1,t.currentMotion=new zr({progress:0}),t.tapMotion=new zr({scale:1,opacity:1}),t.progressMotion=new zr({progress:0}),t.progressOpacityMotion=new zr({opacity:0}),t.opacityMotion=new zr({opacity:0});var i={blending:n.CustomBlending,blendSrc:n.SrcAlphaFactor,blendDst:n.OneMinusSrcAlphaFactor,blendSrcAlpha:n.OneFactor,blendDstAlpha:n.OneMinusSrcAlphaFactor,depthWrite:!1};return t.centerMesh=new n.Mesh(jo,new n.MeshBasicMaterial(Oe(Oe({},i),{map:_o,opacity:0}))),t.loadingMesh=new n.Mesh(jo,new n.MeshBasicMaterial(Oe(Oe({},i),{map:Ko,opacity:.5}))),t.disableMesh=new n.Mesh(jo,new n.MeshBasicMaterial(Oe(Oe({},i),{map:Go,opacity:0}))),t.progressMesh=new n.Mesh(jo,new n.MeshBasicMaterial(Oe(Oe({},i),{map:Jo,opacity:0}))),t.expandMesh=new n.Mesh(jo,new n.MeshBasicMaterial(Oe(Oe({},i),{map:Wo,opacity:0}))),t.expandMesh2=new n.Mesh(jo,new n.MeshBasicMaterial(Oe(Oe({},i),{map:Wo,opacity:0}))),t.loadingMesh.visible=!1,t.disableMesh.visible=!1,t.disableMesh.position.y=.003,t.centerMesh.position.y=.003,t.loadingMesh.position.y=.005,t.progressMesh.position.y=.004,t.expandMesh.position.y=.002,t.expandMesh2.position.y=.002,t.centerMesh.frustumCulled=!1,t.progressMesh.frustumCulled=!1,t.loadingMesh.frustumCulled=!1,t.disableMesh.frustumCulled=!1,t.expandMesh.frustumCulled=!1,t.expandMesh2.frustumCulled=!1,t.container=new n.Group,t.renderOrder=-2,t.container.renderOrder=-2,t.container.add(t.centerMesh),t.container.add(t.progressMesh),t.container.add(t.loadingMesh),t.container.add(t.disableMesh),t.add(t.container),t.add(t.expandMesh),t.add(t.expandMesh2),t.currentStartTime=ze(),t.needsRender=!0,t}return ke(t,e),t.prototype.setProgress=function(e){this.setDisabled(!1),this.setLoading(!1),this.progress!==e&&(e=Mr(e,0,1),this.tapMotion.ended&&(0===this.progress&&this.progressOpacityMotion.set({opacity:1},300).catch(qe),0===e?(this.progressOpacityMotion.set({opacity:0},300).catch(qe),this.progressMotion.set({progress:Mr(1.2*e,0,1)},0).catch(qe)):this.progressMotion.set({progress:Mr(1.2*e,0,1)},100).catch(qe)),this.progress=e)},t.prototype.setOpacity=function(e){e>0&&(e=1),this.opacity!==e&&(this.opacity=e=Mr(e,0,1),this.opacityMotion.set({opacity:e},500).catch(qe))},t.prototype.setCurrent=function(e){this.current!==e&&(this.currentMotion.set({progress:e?1:0},1e3).catch(qe),this.current=e,!0===this.current&&(this.currentStartTime=ze()))},t.prototype.setLoading=function(e){this.loading!==e&&(this.loading=e,!0===this.disabled&&this.setDisabled(!1),this.loadingMesh.visible=e,this.progressOpacityMotion.set({opacity:e?1:0},300).catch(qe),this.needsRender=!0)},t.prototype.setDisabled=function(e){this.disabled!==e&&(this.disabled=e,!0===this.loading&&this.setLoading(!1),this.disableMesh.visible=e,this.centerMesh.visible=!e,this.needsRender=!0)},t.prototype.tap=function(){var e=this;if(!this.tapMotion.ended)return Promise.resolve();return this.progressOpacityMotion.set({opacity:0},0).catch(qe),this.progressMotion.set({progress:0},0).catch(qe),this.tapMotion.setKeyframes([{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}}],600).then((function(){e.progressOpacityMotion.set({opacity:e.progress>0?1:0},300).catch(qe),e.progressMotion.set({progress:e.progress},120).catch(qe)})).catch(qe)},t.prototype.updateTime=function(e,t){var i;if(!this.progressMotion.ended){this.progressMotion.update(e);var n=this.progressMotion.value.progress;if(null!==this.progressMesh.material.map)if(0===n)this.progressMesh.material.map!==Jo&&(Zo.push(this.progressMesh.material.map),this.progressMesh.material.map=Jo);else if(1===n)this.progressMesh.material.map!==Jo&&(Zo.push(this.progressMesh.material.map),this.progressMesh.material.map=Jo);else{if(this.progressMesh.material.map===Jo){var r=Zo.pop()||Yo();this.progressMesh.material.map=r}null===(i=this.progressMesh.material.map)||void 0===i||i.setProgress(n)}this.needsRender=!0}if(this.progressOpacityMotion.ended||(this.progressOpacityMotion.update(e),this.progressMesh.material.opacity=this.loading?0:this.progressOpacityMotion.value.opacity,this.centerMesh.material.opacity=this.opacityMotion.value.opacity*this.tapMotion.value.opacity*(1-this.progressOpacityMotion.value.opacity),this.needsRender=!0),!this.opacityMotion.ended){this.opacityMotion.update(e);var o=this.opacityMotion.value.opacity*this.tapMotion.value.opacity;this.centerMesh.material.opacity=o*(1-this.progressOpacityMotion.value.opacity),this.disableMesh.material.opacity=o,this.loadingMesh.material.opacity=o,this.needsRender=!0}if(!0===this.loadingMesh.visible&&(this.loadingMesh.rotateY(-t/120),this.needsRender=!0),!this.tapMotion.ended){this.tapMotion.update(e);var s=this.tapMotion.value.scale;this.container.scale.set(s,1,s);o=this.opacityMotion.value.opacity*this.tapMotion.value.opacity;this.centerMesh.material.opacity=o*(1-this.progressOpacityMotion.value.opacity),this.disableMesh.material.opacity=o,this.loadingMesh.material.opacity=o,this.needsRender=!0}if(this.current||!this.currentMotion.ended){this.currentMotion.update(e);var a=(e-this.currentStartTime)/2e3;if(Math.ceil(a)%5<3){s=1+Math.sin(Math.PI*a)/25*this.currentMotion.value.progress;this.centerMesh.scale.set(s,1,s),this.needsRender=!0}var l=(e-this.currentStartTime)/2e3;if(Math.ceil(l)%5<3){s=1+.8*Ho(c=l%1)*this.currentMotion.value.progress;this.expandMesh.scale.set(s,1,s),this.expandMesh.material.opacity=(1-Ho(c))*this.currentMotion.value.progress*this.opacityMotion.value.opacity,this.needsRender=!0}var u=(e-this.currentStartTime-500)/2e3;if(Math.ceil(u)%5<3){var c;s=1+.8*Ho(c=u%1)*this.currentMotion.value.progress;this.expandMesh2.scale.set(s,1,s),this.expandMesh2.material.opacity=(1-Ho(c))/2*this.currentMotion.value.progress*this.opacityMotion.value.opacity,this.needsRender=!0}}},t.prototype.dispose=function(){this.currentMotion.dispose(),this.tapMotion.dispose(),this.progressMotion.dispose(),this.progressOpacityMotion.dispose(),this.opacityMotion.dispose(),this.progressMesh.material.map!==Jo&&(Zo.push(this.progressMesh.material.map),this.progressMesh.material.map=null),this.disableMesh.material.dispose(),this.centerMesh.material.dispose(),this.expandMesh.material.dispose(),this.expandMesh2.material.dispose(),this.loadingMesh.material.dispose(),this.progressMesh.material.dispose()},t}(n.Object3D),es=new n.CircleBufferGeometry(.1,16),ts=function(){if("undefined"!=typeof document){var e=512,t=document.createElement("canvas");t.setAttribute("width",String(e)),t.setAttribute("height",String(e));var i=t.getContext("2d");if(i){var r=256,o=192,s=76.8;i.lineWidth=s,i.arc(r,r,o,0,2*Math.PI),i.strokeStyle="rgba(147, 162, 255, 0.3)",i.shadowBlur=12.8,i.shadowColor="rgba(255, 255, 255, 0.6)",i.stroke(),i.lineWidth=s,i.arc(r,r,o,0,2*Math.PI);var a=i.createRadialGradient(r,r,153.6,r,r,230.4);a.addColorStop(0,"rgba(255, 255, 255, 0.3)"),a.addColorStop(.3,"rgba(255, 255, 255, 0.0)"),a.addColorStop(.7,"rgba(255, 255, 255, 0.0)"),a.addColorStop(1,"rgba(255, 255, 255, 0.3)"),i.strokeStyle=a,i.stroke(),i.beginPath(),i.lineWidth=4.8,i.arc(r,r,228,0,2*Math.PI);var l=i.createLinearGradient(0,0,e,0);return l.addColorStop(.02,"rgba(255, 255, 255, 1.0)"),l.addColorStop(.08,"rgba(255, 255, 255, 0.0)"),l.addColorStop(.92,"rgba(255, 255, 255, 0.0)"),l.addColorStop(.98,"rgba(255, 255, 255, 1.0)"),i.strokeStyle=l,i.stroke(),new n.CanvasTexture(t)}}return null}(),is=new n.MeshBasicMaterial({map:ts,transparent:!0}),ns=function(e){function t(){var t=e.call(this)||this;return t.ringMesh=new n.Mesh(es,is),t.ringMesh.renderOrder=-3,t.add(t.ringMesh),t}return ke(t,e),t.prototype.dispose=function(){this.remove(this.ringMesh)},t}(n.Object3D);function rs(e,t,i){var n=Math.abs(e-t);return n<.001||void 0!==i&&Math.abs(i-n)<.001}function os(e,t,i){return!rs(e,t,i)}function ss(e,t){return e.distanceTo(t)<.001}function as(e,t){return!ss(e,t)}var ls=new n.Vector3(0,0,0),us=function(e){function t(t,i){void 0===i&&(i=ls);var r=e.call(this)||this,o=new n.BoxBufferGeometry(t.max.x-t.min.x+2*i.x,t.max.y-t.min.y+2*i.y,t.max.z-t.min.z+2*i.z,1,1);o.groups.length=0,o.groups.push({start:0,count:36,materialIndex:0}),o.applyMatrix4((new n.Matrix4).makeScale(-1,1,1)),o.computeVertexNormals();var s=new ci;s.defines.USE_MAP=!1,s.defines.USE_UV=!1,s.uniforms.diffuse.value=new n.Color(16777215);var a=new xt(o,[s]);return a.floorIndex=-1,a.position.copy(t.getCenter(new n.Vector3)),a.frustumCulled=!1,r.renderOrder=-3,r.add(a),r.boundingBox=new n.Box3,r.computeBoundingBox(),r}return ke(t,e),t.prototype.computeBoundingBox=function(){this.boundingBox.setFromObject(this)},t.prototype.dispose=function(){this.disposeMaterial(),this.disposeGeometry()},t}(Mt);function cs(e,t){return void 0===t&&(t=ls),new us(e,t)}function hs(e){var t=e.getError();if(t===e.NO_ERROR)return null;switch(t){case e.INVALID_ENUM:return new Error("webgl error: INVALID_ENUM");case e.INVALID_VALUE:return new Error("webgl error: INVALID_VALUE");case e.INVALID_OPERATION:return new Error("webgl error: INVALID_OPERATION");case e.INVALID_FRAMEBUFFER_OPERATION:return new Error("webgl error: INVALID_FRAMEBUFFER_OPERATION");case e.OUT_OF_MEMORY:return new Error("webgl error: OUT_OF_MEMORY");case e.CONTEXT_LOST_WEBGL:return new Error("webgl error: CONTEXT_LOST_WEBGL");default:return null}}var ds=2*Math.PI;function ps(e){return e>=0&&e<ds?e:(e%ds+ds)%ds}var fs=Math.PI,As=2*fs;function gs(e,t,i){if(e===t)return t;var n=t-e;return Math.abs(n)<=i?t:e+(n>0?1:-1)*i}!function(){try{var e=document.createElement("canvas");!window.WebGLRenderingContext||!e.getContext("webgl")&&e.getContext("experimental-webgl")}catch(e){return!1}}();var ms=function(){var e="undefined"!=typeof navigator?navigator.userAgent.toLowerCase():"node";return/android/i.test(e)||/webos/i.test(e)||/ipad|iphone|ipod/i.test(e)||/iemobile/i.test(e)||/opera mini/i.test(e)||/blackberry/i.test(e)||/windows phone/i.test(e)};function vs(e,t){e.mode=t.mode,e.panoIndex=t.panoIndex,e.longitude=t.longitude,e.latitude=t.latitude,e.fov=t.fov,e.offset.copy(t.offset)}function ys(e,t){return e.panoIndex===t.panoIndex&&e.mode===t.mode&&rs(e.longitude,t.longitude,2*Math.PI)&&rs(e.latitude,t.latitude)&&rs(e.fov,t.fov)&&ss(e.offset,t.offset)}var bs=function(e){return Number(e)};function xs(e,t,i){var n;void 0===t&&(t=bs),void 0===i&&(i=!1);for(var r,o=1/0,s=0,a=e;s<a.length;s++){var l=a[s],u=t(l);u<=o&&(r=(n=[l,u])[0],o=n[1])}return isFinite(o)&&(o=0),i?[r,o]:r}function ws(e){for(var t in e)return!1;return!0}function Ms(e){return{longitude:e.longitude,latitude:e.latitude,fov:e.fov,offset:e.offset.clone(),distance:e.distance}}
367
+ function(e,t){for(var i=e.toByteArray(),n=0;n<i.length&&0==i[n];)++n;if(i.length-n!=t-1||2!=i[n])return null;for(++n;0!=i[n];)if(++n>=i.length)return null;for(var r="";++n<i.length;){var o=255&i[n];o<128?r+=String.fromCharCode(o):o>191&&o<224?(r+=String.fromCharCode((31&o)<<6|63&i[n+1]),++n):(r+=String.fromCharCode((15&o)<<12|(63&i[n+1])<<6|63&i[n+2]),n+=2)}return r}(i,this.n.bitLength()+7>>3)},W.prototype.decryptOAEP=function(e,t,i){if(e.length!=Math.ceil(this.n.bitLength()/4))throw new Error("wrong ctext length");var n=G(e,16),r=this.doPrivate(n);return null==r?null:function(e,t,i,n){var r=a.crypto.MessageDigest,o=a.crypto.Util,s=null;for(i||(i="sha1"),"string"==typeof i&&(s=r.getCanonicalAlgName(i),n=r.getHashLength(s),i=function(e){return ne(o.hashHex(re(e),s))}),e=e.toByteArray(),l=0;l<e.length;l+=1)e[l]&=255;for(;e.length<t;)e.unshift(0);if((e=String.fromCharCode.apply(String,e)).length<2*n+2)throw"Cipher too short";var l,u=e.substr(1,n),c=e.substr(n+1),h=X(c,n,i),d=[];for(l=0;l<u.length;l+=1)d[l]=u.charCodeAt(l)^h.charCodeAt(l);var p=X(String.fromCharCode.apply(String,d),e.length-n,i),f=[];for(l=0;l<c.length;l+=1)f[l]=c.charCodeAt(l)^p.charCodeAt(l);if((f=String.fromCharCode.apply(String,f)).substr(0,n)!==i(""))throw"Hash mismatch";var A=(f=f.substr(n)).indexOf("");if((-1!=A?f.substr(0,A).lastIndexOf("\0"):-1)+1!=A)throw"Malformed data";return f.substr(A+1)}(r,this.n.bitLength()+7>>3,t,i)},void 0!==a.lang&&a.lang||(a.lang={}),a.lang.String=function(){},a.lang.String.isInteger=function(e){return!!e.match(/^[0-9]+$/)||!!e.match(/^-[0-9]+$/)},a.lang.String.isHex=function(e){return ce(e)},a.lang.String.isBase64=function(e){return!(!(e=e.replace(/\s+/g,"")).match(/^[0-9A-Za-z+\/]+={0,3}$/)||e.length%4!=0)},a.lang.String.isBase64URL=function(e){return!e.match(/[+/=]/)&&(e=J(e),a.lang.String.isBase64(e))},a.lang.String.isIntegerArray=function(e){return!!(e=e.replace(/\s+/g,"")).match(/^\[[0-9,]+\]$/)},a.lang.String.isPrintable=function(e){return null!==e.match(/^[0-9A-Za-z '()+,-./:=?]*$/)},a.lang.String.isIA5=function(e){return null!==e.match(/^[\x20-\x21\x23-\x7f]*$/)},a.lang.String.isMail=function(e){return null!==e.match(/^[A-Za-z0-9]{1}[A-Za-z0-9_.-]*@{1}[A-Za-z0-9_.-]{1,}\.[A-Za-z0-9]{1,}$/)};var de=function(e,t,i){return null==i&&(i="0"),e.length>=t?e:new Array(t-e.length+1).join(i)+e};function pe(e,t){var i=function(){};i.prototype=t.prototype,e.prototype=new i,e.prototype.constructor=e,e.superclass=t.prototype,t.prototype.constructor==Object.prototype.constructor&&(t.prototype.constructor=t)}void 0!==a.crypto&&a.crypto||(a.crypto={}),a.crypto.Util=new function(){this.DIGESTINFOHEAD={sha1:"3021300906052b0e03021a05000414",sha224:"302d300d06096086480165030402040500041c",sha256:"3031300d060960864801650304020105000420",sha384:"3041300d060960864801650304020205000430",sha512:"3051300d060960864801650304020305000440",md2:"3020300c06082a864886f70d020205000410",md5:"3020300c06082a864886f70d020505000410",ripemd160:"3021300906052b2403020105000414"},this.DEFAULTPROVIDER={md5:"cryptojs",sha1:"cryptojs",sha224:"cryptojs",sha256:"cryptojs",sha384:"cryptojs",sha512:"cryptojs",ripemd160:"cryptojs",hmacmd5:"cryptojs",hmacsha1:"cryptojs",hmacsha224:"cryptojs",hmacsha256:"cryptojs",hmacsha384:"cryptojs",hmacsha512:"cryptojs",hmacripemd160:"cryptojs",MD5withRSA:"cryptojs/jsrsa",SHA1withRSA:"cryptojs/jsrsa",SHA224withRSA:"cryptojs/jsrsa",SHA256withRSA:"cryptojs/jsrsa",SHA384withRSA:"cryptojs/jsrsa",SHA512withRSA:"cryptojs/jsrsa",RIPEMD160withRSA:"cryptojs/jsrsa",MD5withECDSA:"cryptojs/jsrsa",SHA1withECDSA:"cryptojs/jsrsa",SHA224withECDSA:"cryptojs/jsrsa",SHA256withECDSA:"cryptojs/jsrsa",SHA384withECDSA:"cryptojs/jsrsa",SHA512withECDSA:"cryptojs/jsrsa",RIPEMD160withECDSA:"cryptojs/jsrsa",SHA1withDSA:"cryptojs/jsrsa",SHA224withDSA:"cryptojs/jsrsa",SHA256withDSA:"cryptojs/jsrsa",MD5withRSAandMGF1:"cryptojs/jsrsa",SHAwithRSAandMGF1:"cryptojs/jsrsa",SHA1withRSAandMGF1:"cryptojs/jsrsa",SHA224withRSAandMGF1:"cryptojs/jsrsa",SHA256withRSAandMGF1:"cryptojs/jsrsa",SHA384withRSAandMGF1:"cryptojs/jsrsa",SHA512withRSAandMGF1:"cryptojs/jsrsa",RIPEMD160withRSAandMGF1:"cryptojs/jsrsa"},this.CRYPTOJSMESSAGEDIGESTNAME={md5:u.algo.MD5,sha1:u.algo.SHA1,sha224:u.algo.SHA224,sha256:u.algo.SHA256,sha384:u.algo.SHA384,sha512:u.algo.SHA512,ripemd160:u.algo.RIPEMD160},this.getDigestInfoHex=function(e,t){if(void 0===this.DIGESTINFOHEAD[t])throw"alg not supported in Util.DIGESTINFOHEAD: "+t;return this.DIGESTINFOHEAD[t]+e},this.getPaddedDigestInfoHex=function(e,t,i){var n=this.getDigestInfoHex(e,t),r=i/4;if(n.length+22>r)throw"key is too short for SigAlg: keylen="+i+","+t;for(var o="0001",s="00"+n,a="",l=r-o.length-s.length,u=0;u<l;u+=2)a+="ff";return o+a+s},this.hashString=function(e,t){return new a.crypto.MessageDigest({alg:t}).digestString(e)},this.hashHex=function(e,t){return new a.crypto.MessageDigest({alg:t}).digestHex(e)},this.sha1=function(e){return this.hashString(e,"sha1")},this.sha256=function(e){return this.hashString(e,"sha256")},this.sha256Hex=function(e){return this.hashHex(e,"sha256")},this.sha512=function(e){return this.hashString(e,"sha512")},this.sha512Hex=function(e){return this.hashHex(e,"sha512")},this.isKey=function(e){return e instanceof W||e instanceof a.crypto.DSA||e instanceof a.crypto.ECDSA}},a.crypto.Util.md5=function(e){return new a.crypto.MessageDigest({alg:"md5",prov:"cryptojs"}).digestString(e)},a.crypto.Util.ripemd160=function(e){return new a.crypto.MessageDigest({alg:"ripemd160",prov:"cryptojs"}).digestString(e)},a.crypto.Util.SECURERANDOMGEN=new K,a.crypto.Util.getRandomHexOfNbytes=function(e){var t=new Array(e);return a.crypto.Util.SECURERANDOMGEN.nextBytes(t),Y(t)},a.crypto.Util.getRandomBigIntegerOfNbytes=function(e){return new c(a.crypto.Util.getRandomHexOfNbytes(e),16)},a.crypto.Util.getRandomHexOfNbits=function(e){var t=e%8,i=new Array((e-t)/8+1);return a.crypto.Util.SECURERANDOMGEN.nextBytes(i),i[0]=(255<<t&255^255)&i[0],Y(i)},a.crypto.Util.getRandomBigIntegerOfNbits=function(e){return new c(a.crypto.Util.getRandomHexOfNbits(e),16)},a.crypto.Util.getRandomBigIntegerZeroToMax=function(e){for(var t=e.bitLength();;){var i=a.crypto.Util.getRandomBigIntegerOfNbits(t);if(-1!=e.compareTo(i))return i}},a.crypto.Util.getRandomBigIntegerMinToMax=function(e,t){var i=e.compareTo(t);if(1==i)throw"biMin is greater than biMax";if(0==i)return e;var n=t.subtract(e);return a.crypto.Util.getRandomBigIntegerZeroToMax(n).add(e)},a.crypto.MessageDigest=function(e){this.setAlgAndProvider=function(e,t){if(null!==(e=a.crypto.MessageDigest.getCanonicalAlgName(e))&&void 0===t&&(t=a.crypto.Util.DEFAULTPROVIDER[e]),-1!=":md5:sha1:sha224:sha256:sha384:sha512:ripemd160:".indexOf(e)&&"cryptojs"==t){try{this.md=a.crypto.Util.CRYPTOJSMESSAGEDIGESTNAME[e].create()}catch(t){throw"setAlgAndProvider hash alg set fail alg="+e+"/"+t}this.updateString=function(e){this.md.update(e)},this.updateHex=function(e){var t=u.enc.Hex.parse(e);this.md.update(t)},this.digest=function(){return this.md.finalize().toString(u.enc.Hex)},this.digestString=function(e){return this.updateString(e),this.digest()},this.digestHex=function(e){return this.updateHex(e),this.digest()}}if(-1!=":sha256:".indexOf(e)&&"sjcl"==t){try{this.md=new sjcl.hash.sha256}catch(t){throw"setAlgAndProvider hash alg set fail alg="+e+"/"+t}this.updateString=function(e){this.md.update(e)},this.updateHex=function(e){var t=sjcl.codec.hex.toBits(e);this.md.update(t)},this.digest=function(){var e=this.md.finalize();return sjcl.codec.hex.fromBits(e)},this.digestString=function(e){return this.updateString(e),this.digest()},this.digestHex=function(e){return this.updateHex(e),this.digest()}}},this.updateString=function(e){throw"updateString(str) not supported for this alg/prov: "+this.algName+"/"+this.provName},this.updateHex=function(e){throw"updateHex(hex) not supported for this alg/prov: "+this.algName+"/"+this.provName},this.digest=function(){throw"digest() not supported for this alg/prov: "+this.algName+"/"+this.provName},this.digestString=function(e){throw"digestString(str) not supported for this alg/prov: "+this.algName+"/"+this.provName},this.digestHex=function(e){throw"digestHex(hex) not supported for this alg/prov: "+this.algName+"/"+this.provName},void 0!==e&&void 0!==e.alg&&(this.algName=e.alg,void 0===e.prov&&(this.provName=a.crypto.Util.DEFAULTPROVIDER[this.algName]),this.setAlgAndProvider(this.algName,this.provName))},a.crypto.MessageDigest.getCanonicalAlgName=function(e){return"string"==typeof e&&(e=(e=e.toLowerCase()).replace(/-/,"")),e},a.crypto.MessageDigest.getHashLength=function(e){var t=a.crypto.MessageDigest,i=t.getCanonicalAlgName(e);if(void 0===t.HASHLENGTH[i])throw"not supported algorithm: "+e;return t.HASHLENGTH[i]},a.crypto.MessageDigest.HASHLENGTH={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,ripemd160:20},a.crypto.Mac=function(e){this.setAlgAndProvider=function(e,t){if(null==(e=e.toLowerCase())&&(e="hmacsha1"),"hmac"!=(e=e.toLowerCase()).substr(0,4))throw"setAlgAndProvider unsupported HMAC alg: "+e;void 0===t&&(t=a.crypto.Util.DEFAULTPROVIDER[e]),this.algProv=e+"/"+t;var i=e.substr(4);if(-1!=":md5:sha1:sha224:sha256:sha384:sha512:ripemd160:".indexOf(i)&&"cryptojs"==t){try{var n=a.crypto.Util.CRYPTOJSMESSAGEDIGESTNAME[i];this.mac=u.algo.HMAC.create(n,this.pass)}catch(e){throw"setAlgAndProvider hash alg set fail hashAlg="+i+"/"+e}this.updateString=function(e){this.mac.update(e)},this.updateHex=function(e){var t=u.enc.Hex.parse(e);this.mac.update(t)},this.doFinal=function(){return this.mac.finalize().toString(u.enc.Hex)},this.doFinalString=function(e){return this.updateString(e),this.doFinal()},this.doFinalHex=function(e){return this.updateHex(e),this.doFinal()}}},this.updateString=function(e){throw"updateString(str) not supported for this alg/prov: "+this.algProv},this.updateHex=function(e){throw"updateHex(hex) not supported for this alg/prov: "+this.algProv},this.doFinal=function(){throw"digest() not supported for this alg/prov: "+this.algProv},this.doFinalString=function(e){throw"digestString(str) not supported for this alg/prov: "+this.algProv},this.doFinalHex=function(e){throw"digestHex(hex) not supported for this alg/prov: "+this.algProv},this.setPassword=function(e){if("string"==typeof e){var t=e;return e.length%2!=1&&e.match(/^[0-9A-Fa-f]+$/)||(t=re(e)),void(this.pass=u.enc.Hex.parse(t))}if("object"!=typeof e)throw"KJUR.crypto.Mac unsupported password type: "+e;t=null;if(void 0!==e.hex){if(e.hex.length%2!=0||!e.hex.match(/^[0-9A-Fa-f]+$/))throw"Mac: wrong hex password: "+e.hex;t=e.hex}if(void 0!==e.utf8&&(t=te(e.utf8)),void 0!==e.rstr&&(t=re(e.rstr)),void 0!==e.b64&&(t=k(e.b64)),void 0!==e.b64u&&(t=ee(e.b64u)),null==t)throw"KJUR.crypto.Mac unsupported password type: "+e;this.pass=u.enc.Hex.parse(t)},void 0!==e&&(void 0!==e.pass&&this.setPassword(e.pass),void 0!==e.alg&&(this.algName=e.alg,void 0===e.prov&&(this.provName=a.crypto.Util.DEFAULTPROVIDER[this.algName]),this.setAlgAndProvider(this.algName,this.provName)))},a.crypto.Signature=function(e){var t=null;if(this._setAlgNames=function(){var e=this.algName.match(/^(.+)with(.+)$/);e&&(this.mdAlgName=e[1].toLowerCase(),this.pubkeyAlgName=e[2].toLowerCase(),"rsaandmgf1"==this.pubkeyAlgName&&"sha"==this.mdAlgName&&(this.mdAlgName="sha1"))},this._zeroPaddingOfSignature=function(e,t){for(var i="",n=t/4-e.length,r=0;r<n;r++)i+="0";return i+e},this.setAlgAndProvider=function(e,t){if(this._setAlgNames(),"cryptojs/jsrsa"!=t)throw new Error("provider not supported: "+t);if(-1!=":md5:sha1:sha224:sha256:sha384:sha512:ripemd160:".indexOf(this.mdAlgName)){try{this.md=new a.crypto.MessageDigest({alg:this.mdAlgName})}catch(e){throw new Error("setAlgAndProvider hash alg set fail alg="+this.mdAlgName+"/"+e)}this.init=function(e,t){var i=null;try{i=void 0===t?we.getKey(e):we.getKey(e,t)}catch(e){throw"init failed:"+e}if(!0===i.isPrivate)this.prvKey=i,this.state="SIGN";else{if(!0!==i.isPublic)throw"init failed.:"+i;this.pubKey=i,this.state="VERIFY"}},this.updateString=function(e){this.md.updateString(e)},this.updateHex=function(e){this.md.updateHex(e)},this.sign=function(){if(this.sHashHex=this.md.digest(),void 0===this.prvKey&&void 0!==this.ecprvhex&&void 0!==this.eccurvename&&void 0!==a.crypto.ECDSA&&(this.prvKey=new a.crypto.ECDSA({curve:this.eccurvename,prv:this.ecprvhex})),this.prvKey instanceof W&&"rsaandmgf1"===this.pubkeyAlgName)this.hSign=this.prvKey.signWithMessageHashPSS(this.sHashHex,this.mdAlgName,this.pssSaltLen);else if(this.prvKey instanceof W&&"rsa"===this.pubkeyAlgName)this.hSign=this.prvKey.signWithMessageHash(this.sHashHex,this.mdAlgName);else if(this.prvKey instanceof a.crypto.ECDSA)this.hSign=this.prvKey.signWithMessageHash(this.sHashHex);else{if(!(this.prvKey instanceof a.crypto.DSA))throw"Signature: unsupported private key alg: "+this.pubkeyAlgName;this.hSign=this.prvKey.signWithMessageHash(this.sHashHex)}return this.hSign},this.signString=function(e){return this.updateString(e),this.sign()},this.signHex=function(e){return this.updateHex(e),this.sign()},this.verify=function(e){if(this.sHashHex=this.md.digest(),void 0===this.pubKey&&void 0!==this.ecpubhex&&void 0!==this.eccurvename&&void 0!==a.crypto.ECDSA&&(this.pubKey=new a.crypto.ECDSA({curve:this.eccurvename,pub:this.ecpubhex})),this.pubKey instanceof W&&"rsaandmgf1"===this.pubkeyAlgName)return this.pubKey.verifyWithMessageHashPSS(this.sHashHex,e,this.mdAlgName,this.pssSaltLen);if(this.pubKey instanceof W&&"rsa"===this.pubkeyAlgName)return this.pubKey.verifyWithMessageHash(this.sHashHex,e);if(void 0!==a.crypto.ECDSA&&this.pubKey instanceof a.crypto.ECDSA)return this.pubKey.verifyWithMessageHash(this.sHashHex,e);if(void 0!==a.crypto.DSA&&this.pubKey instanceof a.crypto.DSA)return this.pubKey.verifyWithMessageHash(this.sHashHex,e);throw"Signature: unsupported public key alg: "+this.pubkeyAlgName}}},this.init=function(e,t){throw"init(key, pass) not supported for this alg:prov="+this.algProvName},this.updateString=function(e){throw"updateString(str) not supported for this alg:prov="+this.algProvName},this.updateHex=function(e){throw"updateHex(hex) not supported for this alg:prov="+this.algProvName},this.sign=function(){throw"sign() not supported for this alg:prov="+this.algProvName},this.signString=function(e){throw"digestString(str) not supported for this alg:prov="+this.algProvName},this.signHex=function(e){throw"digestHex(hex) not supported for this alg:prov="+this.algProvName},this.verify=function(e){throw"verify(hSigVal) not supported for this alg:prov="+this.algProvName},this.initParams=e,void 0!==e&&(void 0!==e.alg&&(this.algName=e.alg,void 0===e.prov?this.provName=a.crypto.Util.DEFAULTPROVIDER[this.algName]:this.provName=e.prov,this.algProvName=this.algName+":"+this.provName,this.setAlgAndProvider(this.algName,this.provName),this._setAlgNames()),void 0!==e.psssaltlen&&(this.pssSaltLen=e.psssaltlen),void 0!==e.prvkeypem)){if(void 0!==e.prvkeypas)throw"both prvkeypem and prvkeypas parameters not supported";try{t=we.getKey(e.prvkeypem);this.init(t)}catch(e){throw"fatal error to load pem private key: "+e}}},a.crypto.Cipher=function(e){},a.crypto.Cipher.encrypt=function(e,t,i){if(t instanceof W&&t.isPublic){var n=a.crypto.Cipher.getAlgByKeyAndName(t,i);if("RSA"===n)return t.encrypt(e);if("RSAOAEP"===n)return t.encryptOAEP(e,"sha1");var r=n.match(/^RSAOAEP(\d+)$/);if(null!==r)return t.encryptOAEP(e,"sha"+r[1]);throw"Cipher.encrypt: unsupported algorithm for RSAKey: "+i}throw"Cipher.encrypt: unsupported key or algorithm"},a.crypto.Cipher.decrypt=function(e,t,i){if(t instanceof W&&t.isPrivate){var n=a.crypto.Cipher.getAlgByKeyAndName(t,i);if("RSA"===n)return t.decrypt(e);if("RSAOAEP"===n)return t.decryptOAEP(e,"sha1");var r=n.match(/^RSAOAEP(\d+)$/);if(null!==r)return t.decryptOAEP(e,"sha"+r[1]);throw"Cipher.decrypt: unsupported algorithm for RSAKey: "+i}throw"Cipher.decrypt: unsupported key or algorithm"},a.crypto.Cipher.getAlgByKeyAndName=function(e,t){if(e instanceof W){if(-1!=":RSA:RSAOAEP:RSAOAEP224:RSAOAEP256:RSAOAEP384:RSAOAEP512:".indexOf(t))return t;if(null==t)return"RSA";throw"getAlgByKeyAndName: not supported algorithm name for RSAKey: "+t}throw"getAlgByKeyAndName: not supported algorithm name: "+t},a.crypto.OID=new function(){this.oidhex2name={"2a864886f70d010101":"rsaEncryption","2a8648ce3d0201":"ecPublicKey","2a8648ce380401":"dsa","2a8648ce3d030107":"secp256r1","2b8104001f":"secp192k1","2b81040021":"secp224r1","2b8104000a":"secp256k1","2b81040023":"secp521r1","2b81040022":"secp384r1","2a8648ce380403":"SHA1withDSA","608648016503040301":"SHA224withDSA","608648016503040302":"SHA256withDSA"}};var fe,Ae,me,ge,ve,ye,be,xe,we=(fe=function(e,t,i){return Ae(u.AES,e,t,i)},Ae=function(e,t,i,n){var r=u.enc.Hex.parse(t),o=u.enc.Hex.parse(i),s=u.enc.Hex.parse(n),a={};a.key=o,a.iv=s,a.ciphertext=r;var l=e.decrypt(a,o,{iv:s});return u.enc.Hex.stringify(l)},me=function(e,t,i){return ge(u.AES,e,t,i)},ge=function(e,t,i,n){var r=u.enc.Hex.parse(t),o=u.enc.Hex.parse(i),s=u.enc.Hex.parse(n),a=e.encrypt(r,o,{iv:s}),l=u.enc.Hex.parse(a.toString());return u.enc.Base64.stringify(l)},ve={"AES-256-CBC":{proc:fe,eproc:me,keylen:32,ivlen:16},"AES-192-CBC":{proc:fe,eproc:me,keylen:24,ivlen:16},"AES-128-CBC":{proc:fe,eproc:me,keylen:16,ivlen:16},"DES-EDE3-CBC":{proc:function(e,t,i){return Ae(u.TripleDES,e,t,i)},eproc:function(e,t,i){return ge(u.TripleDES,e,t,i)},keylen:24,ivlen:8},"DES-CBC":{proc:function(e,t,i){return Ae(u.DES,e,t,i)},eproc:function(e,t,i){return ge(u.DES,e,t,i)},keylen:8,ivlen:8}},ye=function(e){var t={},i=e.match(new RegExp("DEK-Info: ([^,]+),([0-9A-Fa-f]+)","m"));i&&(t.cipher=i[1],t.ivsalt=i[2]);var n=e.match(new RegExp("-----BEGIN ([A-Z]+) PRIVATE KEY-----"));n&&(t.type=n[1]);var r=-1,o=0;-1!=e.indexOf("\r\n\r\n")&&(r=e.indexOf("\r\n\r\n"),o=2),-1!=e.indexOf("\n\n")&&(r=e.indexOf("\n\n"),o=1);var s=e.indexOf("-----END");if(-1!=r&&-1!=s){var a=e.substring(r+2*o,s-o);a=a.replace(/\s+/g,""),t.data=a}return t},be=function(e,t,i){for(var n=i.substring(0,16),r=u.enc.Hex.parse(n),o=u.enc.Utf8.parse(t),s=ve[e].keylen+ve[e].ivlen,a="",l=null;;){var c=u.algo.MD5.create();if(null!=l&&c.update(l),c.update(o),c.update(r),l=c.finalize(),(a+=u.enc.Hex.stringify(l)).length>=2*s)break}var h={};return h.keyhex=a.substr(0,2*ve[e].keylen),h.ivhex=a.substr(2*ve[e].keylen,2*ve[e].ivlen),h},xe=function(e,t,i,n){var r=u.enc.Base64.parse(e),o=u.enc.Hex.stringify(r);return(0,ve[t].proc)(o,i,n)},{version:"1.0.0",parsePKCS5PEM:function(e){return ye(e)},getKeyAndUnusedIvByPasscodeAndIvsalt:function(e,t,i){return be(e,t,i)},decryptKeyB64:function(e,t,i,n){return xe(e,t,i,n)},getDecryptedKeyHex:function(e,t){var i=ye(e),n=i.cipher,r=i.ivsalt,o=i.data,s=be(n,t,r).keyhex;return xe(o,n,s,r)},getEncryptedPKCS5PEMFromPrvKeyHex:function(e,t,i,n,r){var o="";if(void 0!==n&&null!=n||(n="AES-256-CBC"),void 0===ve[n])throw"KEYUTIL unsupported algorithm: "+n;if(void 0===r||null==r){var s=function(e){var t=u.lib.WordArray.random(e);return u.enc.Hex.stringify(t)}(ve[n].ivlen);r=s.toUpperCase()}var a=function(e,t,i,n){return(0,ve[t].eproc)(e,i,n)}(t,n,be(n,i,r).keyhex,r);return o="-----BEGIN "+e+" PRIVATE KEY-----\r\n",o+="Proc-Type: 4,ENCRYPTED\r\n",o+="DEK-Info: "+n+","+r+"\r\n",o+="\r\n",o+=a.replace(/(.{64})/g,"$1\r\n"),o+="\r\n-----END "+e+" PRIVATE KEY-----\r\n"},parseHexOfEncryptedPKCS8:function(e){var t=Ee,i=t.getChildIdx,n=t.getV,r={},o=i(e,0);if(2!=o.length)throw"malformed format: SEQUENCE(0).items != 2: "+o.length;r.ciphertext=n(e,o[1]);var s=i(e,o[0]);if(2!=s.length)throw"malformed format: SEQUENCE(0.0).items != 2: "+s.length;if("2a864886f70d01050d"!=n(e,s[0]))throw"this only supports pkcs5PBES2";var a=i(e,s[1]);if(2!=s.length)throw"malformed format: SEQUENCE(0.0.1).items != 2: "+a.length;var l=i(e,a[1]);if(2!=l.length)throw"malformed format: SEQUENCE(0.0.1.1).items != 2: "+l.length;if("2a864886f70d0307"!=n(e,l[0]))throw"this only supports TripleDES";r.encryptionSchemeAlg="TripleDES",r.encryptionSchemeIV=n(e,l[1]);var u=i(e,a[0]);if(2!=u.length)throw"malformed format: SEQUENCE(0.0.1.0).items != 2: "+u.length;if("2a864886f70d01050c"!=n(e,u[0]))throw"this only supports pkcs5PBKDF2";var c=i(e,u[1]);if(c.length<2)throw"malformed format: SEQUENCE(0.0.1.0.1).items < 2: "+c.length;r.pbkdf2Salt=n(e,c[0]);var h=n(e,c[1]);try{r.pbkdf2Iter=parseInt(h,16)}catch(e){throw"malformed format pbkdf2Iter: "+h}return r},getPBKDF2KeyHexFromParam:function(e,t){var i=u.enc.Hex.parse(e.pbkdf2Salt),n=e.pbkdf2Iter,r=u.PBKDF2(t,i,{keySize:6,iterations:n});return u.enc.Hex.stringify(r)},_getPlainPKCS8HexFromEncryptedPKCS8PEM:function(e,t){var i=ae(e,"ENCRYPTED PRIVATE KEY"),n=this.parseHexOfEncryptedPKCS8(i),r=we.getPBKDF2KeyHexFromParam(n,t),o={};o.ciphertext=u.enc.Hex.parse(n.ciphertext);var s=u.enc.Hex.parse(r),a=u.enc.Hex.parse(n.encryptionSchemeIV),l=u.TripleDES.decrypt(o,s,{iv:a});return u.enc.Hex.stringify(l)},getKeyFromEncryptedPKCS8PEM:function(e,t){var i=this._getPlainPKCS8HexFromEncryptedPKCS8PEM(e,t);return this.getKeyFromPlainPrivatePKCS8Hex(i)},parsePlainPrivatePKCS8Hex:function(e){var t=Ee,i=t.getChildIdx,n=t.getV,r={algparam:null};if("30"!=e.substr(0,2))throw new Error("malformed plain PKCS8 private key(code:001)");var o=i(e,0);if(o.length<3)throw new Error("malformed plain PKCS8 private key(code:002)");if("30"!=e.substr(o[1],2))throw new Error("malformed PKCS8 private key(code:003)");var s=i(e,o[1]);if(2!=s.length)throw new Error("malformed PKCS8 private key(code:004)");if("06"!=e.substr(s[0],2))throw new Error("malformed PKCS8 private key(code:005)");if(r.algoid=n(e,s[0]),"06"==e.substr(s[1],2)&&(r.algparam=n(e,s[1])),"04"!=e.substr(o[2],2))throw new Error("malformed PKCS8 private key(code:006)");return r.keyidx=t.getVidx(e,o[2]),r},getKeyFromPlainPrivatePKCS8PEM:function(e){var t=ae(e,"PRIVATE KEY");return this.getKeyFromPlainPrivatePKCS8Hex(t)},getKeyFromPlainPrivatePKCS8Hex:function(e){var t,i=this.parsePlainPrivatePKCS8Hex(e);if("2a864886f70d010101"==i.algoid)t=new W;else if("2a8648ce380401"==i.algoid)t=new a.crypto.DSA;else{if("2a8648ce3d0201"!=i.algoid)throw"unsupported private key algorithm";t=new a.crypto.ECDSA}return t.readPKCS8PrvKeyHex(e),t},_getKeyFromPublicPKCS8Hex:function(e){var t,i=Ee.getVbyList(e,0,[0,0],"06");if("2a864886f70d010101"===i)t=new W;else if("2a8648ce380401"===i)t=new a.crypto.DSA;else{if("2a8648ce3d0201"!==i)throw"unsupported PKCS#8 public key hex";t=new a.crypto.ECDSA}return t.readPKCS8PubKeyHex(e),t},parsePublicRawRSAKeyHex:function(e){var t=Ee,i=t.getChildIdx,n=t.getV,r={};if("30"!=e.substr(0,2))throw"malformed RSA key(code:001)";var o=i(e,0);if(2!=o.length)throw"malformed RSA key(code:002)";if("02"!=e.substr(o[0],2))throw"malformed RSA key(code:003)";if(r.n=n(e,o[0]),"02"!=e.substr(o[1],2))throw"malformed RSA key(code:004)";return r.e=n(e,o[1]),r},parsePublicPKCS8Hex:function(e){var t=Ee,i=t.getChildIdx,n=t.getV,r={algparam:null},o=i(e,0);if(2!=o.length)throw"outer DERSequence shall have 2 elements: "+o.length;var s=o[0];if("30"!=e.substr(s,2))throw"malformed PKCS8 public key(code:001)";var a=i(e,s);if(2!=a.length)throw"malformed PKCS8 public key(code:002)";if("06"!=e.substr(a[0],2))throw"malformed PKCS8 public key(code:003)";if(r.algoid=n(e,a[0]),"06"==e.substr(a[1],2)?r.algparam=n(e,a[1]):"30"==e.substr(a[1],2)&&(r.algparam={},r.algparam.p=t.getVbyList(e,a[1],[0],"02"),r.algparam.q=t.getVbyList(e,a[1],[1],"02"),r.algparam.g=t.getVbyList(e,a[1],[2],"02")),"03"!=e.substr(o[1],2))throw"malformed PKCS8 public key(code:004)";return r.key=n(e,o[1]).substr(2),r}});we.getKey=function(e,t,i){var n=(v=Ee).getChildIdx;v.getV;var r=v.getVbyList,o=a.crypto,s=o.ECDSA,l=o.DSA,u=W,h=ae,d=we;if(void 0!==u&&e instanceof u)return e;if(void 0!==s&&e instanceof s)return e;if(void 0!==l&&e instanceof l)return e;if(void 0!==e.curve&&void 0!==e.xy&&void 0===e.d)return new s({pub:e.xy,curve:e.curve});if(void 0!==e.curve&&void 0!==e.d)return new s({prv:e.d,curve:e.curve});if(void 0===e.kty&&void 0!==e.n&&void 0!==e.e&&void 0===e.d)return(T=new u).setPublic(e.n,e.e),T;if(void 0===e.kty&&void 0!==e.n&&void 0!==e.e&&void 0!==e.d&&void 0!==e.p&&void 0!==e.q&&void 0!==e.dp&&void 0!==e.dq&&void 0!==e.co&&void 0===e.qi)return(T=new u).setPrivateEx(e.n,e.e,e.d,e.p,e.q,e.dp,e.dq,e.co),T;if(void 0===e.kty&&void 0!==e.n&&void 0!==e.e&&void 0!==e.d&&void 0===e.p)return(T=new u).setPrivate(e.n,e.e,e.d),T;if(void 0!==e.p&&void 0!==e.q&&void 0!==e.g&&void 0!==e.y&&void 0===e.x)return(T=new l).setPublic(e.p,e.q,e.g,e.y),T;if(void 0!==e.p&&void 0!==e.q&&void 0!==e.g&&void 0!==e.y&&void 0!==e.x)return(T=new l).setPrivate(e.p,e.q,e.g,e.y,e.x),T;if("RSA"===e.kty&&void 0!==e.n&&void 0!==e.e&&void 0===e.d)return(T=new u).setPublic(ee(e.n),ee(e.e)),T;if("RSA"===e.kty&&void 0!==e.n&&void 0!==e.e&&void 0!==e.d&&void 0!==e.p&&void 0!==e.q&&void 0!==e.dp&&void 0!==e.dq&&void 0!==e.qi)return(T=new u).setPrivateEx(ee(e.n),ee(e.e),ee(e.d),ee(e.p),ee(e.q),ee(e.dp),ee(e.dq),ee(e.qi)),T;if("RSA"===e.kty&&void 0!==e.n&&void 0!==e.e&&void 0!==e.d)return(T=new u).setPrivate(ee(e.n),ee(e.e),ee(e.d)),T;if("EC"===e.kty&&void 0!==e.crv&&void 0!==e.x&&void 0!==e.y&&void 0===e.d){var p=(B=new s({curve:e.crv})).ecparams.keylen/4,f="04"+("0000000000"+ee(e.x)).slice(-p)+("0000000000"+ee(e.y)).slice(-p);return B.setPublicKeyHex(f),B}if("EC"===e.kty&&void 0!==e.crv&&void 0!==e.x&&void 0!==e.y&&void 0!==e.d){p=(B=new s({curve:e.crv})).ecparams.keylen/4,f="04"+("0000000000"+ee(e.x)).slice(-p)+("0000000000"+ee(e.y)).slice(-p);var A=("0000000000"+ee(e.d)).slice(-p);return B.setPublicKeyHex(f),B.setPrivateKeyHex(A),B}if("pkcs5prv"===i){var m,g=e,v=Ee;if(9===(m=n(g,0)).length)(T=new u).readPKCS5PrvKeyHex(g);else if(6===m.length)(T=new l).readPKCS5PrvKeyHex(g);else{if(!(m.length>2&&"04"===g.substr(m[1],2)))throw"unsupported PKCS#1/5 hexadecimal key";(T=new s).readPKCS5PrvKeyHex(g)}return T}if("pkcs8prv"===i)return T=d.getKeyFromPlainPrivatePKCS8Hex(e);if("pkcs8pub"===i)return d._getKeyFromPublicPKCS8Hex(e);if("x509pub"===i)return Ie.getPublicKeyFromCertHex(e);if(-1!=e.indexOf("-END CERTIFICATE-",0)||-1!=e.indexOf("-END X509 CERTIFICATE-",0)||-1!=e.indexOf("-END TRUSTED CERTIFICATE-",0))return Ie.getPublicKeyFromCertPEM(e);if(-1!=e.indexOf("-END PUBLIC KEY-")){var y=ae(e,"PUBLIC KEY");return d._getKeyFromPublicPKCS8Hex(y)}if(-1!=e.indexOf("-END RSA PRIVATE KEY-")&&-1==e.indexOf("4,ENCRYPTED")){var b=h(e,"RSA PRIVATE KEY");return d.getKey(b,null,"pkcs5prv")}if(-1!=e.indexOf("-END DSA PRIVATE KEY-")&&-1==e.indexOf("4,ENCRYPTED")){var x=r(D=h(e,"DSA PRIVATE KEY"),0,[1],"02"),w=r(D,0,[2],"02"),E=r(D,0,[3],"02"),M=r(D,0,[4],"02"),S=r(D,0,[5],"02");return(T=new l).setPrivate(new c(x,16),new c(w,16),new c(E,16),new c(M,16),new c(S,16)),T}if(-1!=e.indexOf("-END EC PRIVATE KEY-")&&-1==e.indexOf("4,ENCRYPTED")){b=h(e,"EC PRIVATE KEY");return d.getKey(b,null,"pkcs5prv")}if(-1!=e.indexOf("-END PRIVATE KEY-"))return d.getKeyFromPlainPrivatePKCS8PEM(e);if(-1!=e.indexOf("-END RSA PRIVATE KEY-")&&-1!=e.indexOf("4,ENCRYPTED")){var C=d.getDecryptedKeyHex(e,t),I=new W;return I.readPKCS5PrvKeyHex(C),I}if(-1!=e.indexOf("-END EC PRIVATE KEY-")&&-1!=e.indexOf("4,ENCRYPTED")){var B,T=r(D=d.getDecryptedKeyHex(e,t),0,[1],"04"),P=r(D,0,[2,0],"06"),R=r(D,0,[3,0],"03").substr(2);if(void 0===a.crypto.OID.oidhex2name[P])throw"undefined OID(hex) in KJUR.crypto.OID: "+P;return(B=new s({curve:a.crypto.OID.oidhex2name[P]})).setPublicKeyHex(R),B.setPrivateKeyHex(T),B.isPublic=!1,B}if(-1!=e.indexOf("-END DSA PRIVATE KEY-")&&-1!=e.indexOf("4,ENCRYPTED")){var D;x=r(D=d.getDecryptedKeyHex(e,t),0,[1],"02"),w=r(D,0,[2],"02"),E=r(D,0,[3],"02"),M=r(D,0,[4],"02"),S=r(D,0,[5],"02");return(T=new l).setPrivate(new c(x,16),new c(w,16),new c(E,16),new c(M,16),new c(S,16)),T}if(-1!=e.indexOf("-END ENCRYPTED PRIVATE KEY-"))return d.getKeyFromEncryptedPKCS8PEM(e,t);throw new Error("not supported argument")},we.generateKeypair=function(e,t){if("RSA"==e){var i=t;(s=new W).generate(i,"10001"),s.isPrivate=!0,s.isPublic=!0;var n=new W,r=s.n.toString(16),o=s.e.toString(16);return n.setPublic(r,o),n.isPrivate=!1,n.isPublic=!0,(l={}).prvKeyObj=s,l.pubKeyObj=n,l}if("EC"==e){var s,l,u=t,c=new a.crypto.ECDSA({curve:u}).generateKeyPairHex();return(s=new a.crypto.ECDSA({curve:u})).setPublicKeyHex(c.ecpubhex),s.setPrivateKeyHex(c.ecprvhex),s.isPrivate=!0,s.isPublic=!1,(n=new a.crypto.ECDSA({curve:u})).setPublicKeyHex(c.ecpubhex),n.isPrivate=!1,n.isPublic=!0,(l={}).prvKeyObj=s,l.pubKeyObj=n,l}throw"unknown algorithm: "+e},we.getPEM=function(e,t,i,n,r,o){var s=a,l=s.asn1,c=l.DERObjectIdentifier,h=l.DERInteger,d=l.ASN1Util.newObject,p=l.x509.SubjectPublicKeyInfo,f=s.crypto,A=f.DSA,m=f.ECDSA,g=W;function v(e){return d({seq:[{int:0},{int:{bigint:e.n}},{int:e.e},{int:{bigint:e.d}},{int:{bigint:e.p}},{int:{bigint:e.q}},{int:{bigint:e.dmp1}},{int:{bigint:e.dmq1}},{int:{bigint:e.coeff}}]})}function y(e){return d({seq:[{int:1},{octstr:{hex:e.prvKeyHex}},{tag:["a0",!0,{oid:{name:e.curveName}}]},{tag:["a1",!0,{bitstr:{hex:"00"+e.pubKeyHex}}]}]})}function b(e){return d({seq:[{int:0},{int:{bigint:e.p}},{int:{bigint:e.q}},{int:{bigint:e.g}},{int:{bigint:e.y}},{int:{bigint:e.x}}]})}if((void 0!==g&&e instanceof g||void 0!==A&&e instanceof A||void 0!==m&&e instanceof m)&&1==e.isPublic&&(void 0===t||"PKCS8PUB"==t))return se(M=new p(e).getEncodedHex(),"PUBLIC KEY");if("PKCS1PRV"==t&&void 0!==g&&e instanceof g&&(void 0===i||null==i)&&1==e.isPrivate)return se(M=v(e).getEncodedHex(),"RSA PRIVATE KEY");if("PKCS1PRV"==t&&void 0!==m&&e instanceof m&&(void 0===i||null==i)&&1==e.isPrivate){var x=new c({name:e.curveName}).getEncodedHex(),w=y(e).getEncodedHex(),E="";return E+=se(x,"EC PARAMETERS"),E+=se(w,"EC PRIVATE KEY")}if("PKCS1PRV"==t&&void 0!==A&&e instanceof A&&(void 0===i||null==i)&&1==e.isPrivate)return se(M=b(e).getEncodedHex(),"DSA PRIVATE KEY");if("PKCS5PRV"==t&&void 0!==g&&e instanceof g&&void 0!==i&&null!=i&&1==e.isPrivate){var M=v(e).getEncodedHex();return void 0===n&&(n="DES-EDE3-CBC"),this.getEncryptedPKCS5PEMFromPrvKeyHex("RSA",M,i,n,o)}if("PKCS5PRV"==t&&void 0!==m&&e instanceof m&&void 0!==i&&null!=i&&1==e.isPrivate){M=y(e).getEncodedHex();return void 0===n&&(n="DES-EDE3-CBC"),this.getEncryptedPKCS5PEMFromPrvKeyHex("EC",M,i,n,o)}if("PKCS5PRV"==t&&void 0!==A&&e instanceof A&&void 0!==i&&null!=i&&1==e.isPrivate){M=b(e).getEncodedHex();return void 0===n&&(n="DES-EDE3-CBC"),this.getEncryptedPKCS5PEMFromPrvKeyHex("DSA",M,i,n,o)}var S=function(e,t){var i=C(e,t);return new d({seq:[{seq:[{oid:{name:"pkcs5PBES2"}},{seq:[{seq:[{oid:{name:"pkcs5PBKDF2"}},{seq:[{octstr:{hex:i.pbkdf2Salt}},{int:i.pbkdf2Iter}]}]},{seq:[{oid:{name:"des-EDE3-CBC"}},{octstr:{hex:i.encryptionSchemeIV}}]}]}]},{octstr:{hex:i.ciphertext}}]}).getEncodedHex()},C=function(e,t){var i=u.lib.WordArray.random(8),n=u.lib.WordArray.random(8),r=u.PBKDF2(t,i,{keySize:6,iterations:100}),o=u.enc.Hex.parse(e),s=u.TripleDES.encrypt(o,r,{iv:n})+"",a={};return a.ciphertext=s,a.pbkdf2Salt=u.enc.Hex.stringify(i),a.pbkdf2Iter=100,a.encryptionSchemeAlg="DES-EDE3-CBC",a.encryptionSchemeIV=u.enc.Hex.stringify(n),a};if("PKCS8PRV"==t&&null!=g&&e instanceof g&&1==e.isPrivate){var I=v(e).getEncodedHex();M=d({seq:[{int:0},{seq:[{oid:{name:"rsaEncryption"}},{null:!0}]},{octstr:{hex:I}}]}).getEncodedHex();return void 0===i||null==i?se(M,"PRIVATE KEY"):se(w=S(M,i),"ENCRYPTED PRIVATE KEY")}if("PKCS8PRV"==t&&void 0!==m&&e instanceof m&&1==e.isPrivate){I=new d({seq:[{int:1},{octstr:{hex:e.prvKeyHex}},{tag:["a1",!0,{bitstr:{hex:"00"+e.pubKeyHex}}]}]}).getEncodedHex(),M=d({seq:[{int:0},{seq:[{oid:{name:"ecPublicKey"}},{oid:{name:e.curveName}}]},{octstr:{hex:I}}]}).getEncodedHex();return void 0===i||null==i?se(M,"PRIVATE KEY"):se(w=S(M,i),"ENCRYPTED PRIVATE KEY")}if("PKCS8PRV"==t&&void 0!==A&&e instanceof A&&1==e.isPrivate){I=new h({bigint:e.x}).getEncodedHex(),M=d({seq:[{int:0},{seq:[{oid:{name:"dsa"}},{seq:[{int:{bigint:e.p}},{int:{bigint:e.q}},{int:{bigint:e.g}}]}]},{octstr:{hex:I}}]}).getEncodedHex();return void 0===i||null==i?se(M,"PRIVATE KEY"):se(w=S(M,i),"ENCRYPTED PRIVATE KEY")}throw new Error("unsupported object nor format")},we.getKeyFromCSRPEM=function(e){var t=ae(e,"CERTIFICATE REQUEST");return we.getKeyFromCSRHex(t)},we.getKeyFromCSRHex=function(e){var t=we.parseCSRHex(e);return we.getKey(t.p8pubkeyhex,null,"pkcs8pub")},we.parseCSRHex=function(e){var t=Ee,i=t.getChildIdx,n=t.getTLV,r={},o=e;if("30"!=o.substr(0,2))throw"malformed CSR(code:001)";var s=i(o,0);if(s.length<1)throw"malformed CSR(code:002)";if("30"!=o.substr(s[0],2))throw"malformed CSR(code:003)";var a=i(o,s[0]);if(a.length<3)throw"malformed CSR(code:004)";return r.p8pubkeyhex=n(o,a[2]),r},we.getKeyID=function(e){var t=we,i=Ee;"string"==typeof e&&-1!=e.indexOf("BEGIN ")&&(e=t.getKey(e));var n=ae(t.getPEM(e)),r=i.getIdxbyList(n,0,[1]),o=i.getV(n,r).substring(2);return a.crypto.Util.hashHex(o,"sha1")},we.getJWKFromKey=function(e){var t={};if(e instanceof W&&e.isPrivate)return t.kty="RSA",t.n=$(e.n.toString(16)),t.e=$(e.e.toString(16)),t.d=$(e.d.toString(16)),t.p=$(e.p.toString(16)),t.q=$(e.q.toString(16)),t.dp=$(e.dmp1.toString(16)),t.dq=$(e.dmq1.toString(16)),t.qi=$(e.coeff.toString(16)),t;if(e instanceof W&&e.isPublic)return t.kty="RSA",t.n=$(e.n.toString(16)),t.e=$(e.e.toString(16)),t;if(e instanceof a.crypto.ECDSA&&e.isPrivate){if("P-256"!==(n=e.getShortNISTPCurveName())&&"P-384"!==n)throw"unsupported curve name for JWT: "+n;var i=e.getPublicKeyXYHex();return t.kty="EC",t.crv=n,t.x=$(i.x),t.y=$(i.y),t.d=$(e.prvKeyHex),t}if(e instanceof a.crypto.ECDSA&&e.isPublic){var n;if("P-256"!==(n=e.getShortNISTPCurveName())&&"P-384"!==n)throw"unsupported curve name for JWT: "+n;i=e.getPublicKeyXYHex();return t.kty="EC",t.crv=n,t.x=$(i.x),t.y=$(i.y),t}throw"not supported key object"},void 0!==a.asn1&&a.asn1||(a.asn1={}),a.asn1.ASN1Util=new function(){this.integerToByteHex=function(e){var t=e.toString(16);return t.length%2==1&&(t="0"+t),t},this.bigIntToMinTwosComplementsHex=function(e){var t=e.toString(16);if("-"!=t.substr(0,1))t.length%2==1?t="0"+t:t.match(/^[0-7]/)||(t="00"+t);else{var i=t.substr(1).length;i%2==1?i+=1:t.match(/^[0-7]/)||(i+=2);for(var n="",r=0;r<i;r++)n+="f";t=new c(n,16).xor(e).add(c.ONE).toString(16).replace(/^-/,"")}return t},this.getPEMStringFromHex=function(e,t){return se(e,t)},this.newObject=function(e){var t=a.asn1,i=t.ASN1Object,n=t.DERBoolean,r=t.DERInteger,o=t.DERBitString,s=t.DEROctetString,l=t.DERNull,u=t.DERObjectIdentifier,c=t.DEREnumerated,h=t.DERUTF8String,d=t.DERNumericString,p=t.DERPrintableString,f=t.DERTeletexString,A=t.DERIA5String,m=t.DERUTCTime,g=t.DERGeneralizedTime,v=t.DERVisibleString,y=t.DERBMPString,b=t.DERSequence,x=t.DERSet,w=t.DERTaggedObject,E=t.ASN1Util.newObject;if(e instanceof t.ASN1Object)return e;var M=Object.keys(e);if(1!=M.length)throw new Error("key of param shall be only one.");var S=M[0];if(-1==":asn1:bool:int:bitstr:octstr:null:oid:enum:utf8str:numstr:prnstr:telstr:ia5str:utctime:gentime:visstr:bmpstr:seq:set:tag:".indexOf(":"+S+":"))throw new Error("undefined key: "+S);if("bool"==S)return new n(e[S]);if("int"==S)return new r(e[S]);if("bitstr"==S)return new o(e[S]);if("octstr"==S)return new s(e[S]);if("null"==S)return new l(e[S]);if("oid"==S)return new u(e[S]);if("enum"==S)return new c(e[S]);if("utf8str"==S)return new h(e[S]);if("numstr"==S)return new d(e[S]);if("prnstr"==S)return new p(e[S]);if("telstr"==S)return new f(e[S]);if("ia5str"==S)return new A(e[S]);if("utctime"==S)return new m(e[S]);if("gentime"==S)return new g(e[S]);if("visstr"==S)return new v(e[S]);if("bmpstr"==S)return new y(e[S]);if("asn1"==S)return new i(e[S]);if("seq"==S){for(var C=e[S],I=[],B=0;B<C.length;B++){var T=E(C[B]);I.push(T)}return new b({array:I})}if("set"==S){for(C=e[S],I=[],B=0;B<C.length;B++){T=E(C[B]);I.push(T)}return new x({array:I})}if("tag"==S){var P=e[S];if("[object Array]"===Object.prototype.toString.call(P)&&3==P.length){var R=E(P[2]);return new w({tag:P[0],explicit:P[1],obj:R})}return new w(P)}},this.jsonToASN1HEX=function(e){return this.newObject(e).getEncodedHex()}},a.asn1.ASN1Util.oidHexToInt=function(e){for(var t="",i=parseInt(e.substr(0,2),16),n=(t=Math.floor(i/40)+"."+i%40,""),r=2;r<e.length;r+=2){var o=("00000000"+parseInt(e.substr(r,2),16).toString(2)).slice(-8);if(n+=o.substr(1,7),"0"==o.substr(0,1))t=t+"."+new c(n,2).toString(10),n=""}return t},a.asn1.ASN1Util.oidIntToHex=function(e){var t=function(e){var t=e.toString(16);return 1==t.length&&(t="0"+t),t},i=function(e){var i="",n=new c(e,10).toString(2),r=7-n.length%7;7==r&&(r=0);for(var o="",s=0;s<r;s++)o+="0";n=o+n;for(s=0;s<n.length-1;s+=7){var a=n.substr(s,7);s!=n.length-7&&(a="1"+a),i+=t(parseInt(a,2))}return i};if(!e.match(/^[0-9.]+$/))throw"malformed oid string: "+e;var n="",r=e.split("."),o=40*parseInt(r[0])+parseInt(r[1]);n+=t(o),r.splice(0,2);for(var s=0;s<r.length;s++)n+=i(r[s]);return n},a.asn1.ASN1Object=function(e){this.params=null,this.getLengthHexFromValue=function(){if(void 0===this.hV||null==this.hV)throw new Error("this.hV is null or undefined");if(this.hV.length%2==1)throw new Error("value hex must be even length: n="+"".length+",v="+this.hV);var e=this.hV.length/2,t=e.toString(16);if(t.length%2==1&&(t="0"+t),e<128)return t;var i=t.length/2;if(i>15)throw"ASN.1 length too long to represent by 8x: n = "+e.toString(16);return(128+i).toString(16)+t},this.getEncodedHex=function(){return(null==this.hTLV||this.isModified)&&(this.hV=this.getFreshValueHex(),this.hL=this.getLengthHexFromValue(),this.hTLV=this.hT+this.hL+this.hV,this.isModified=!1),this.hTLV},this.getValueHex=function(){return this.getEncodedHex(),this.hV},this.getFreshValueHex=function(){return""},this.setByParam=function(e){this.params=e},null!=e&&null!=e.tlv&&(this.hTLV=e.tlv,this.isModified=!1)},a.asn1.DERAbstractString=function(e){a.asn1.DERAbstractString.superclass.constructor.call(this),this.getString=function(){return this.s},this.setString=function(e){this.hTLV=null,this.isModified=!0,this.s=e,this.hV=te(this.s).toLowerCase()},this.setStringHex=function(e){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=e},this.getFreshValueHex=function(){return this.hV},void 0!==e&&("string"==typeof e?this.setString(e):void 0!==e.str?this.setString(e.str):void 0!==e.hex&&this.setStringHex(e.hex))},l.lang.extend(a.asn1.DERAbstractString,a.asn1.ASN1Object),a.asn1.DERAbstractTime=function(e){a.asn1.DERAbstractTime.superclass.constructor.call(this),this.localDateToUTC=function(e){var t=e.getTime()+6e4*e.getTimezoneOffset();return new Date(t)},this.formatDate=function(e,t,i){var n=this.zeroPadding,r=this.localDateToUTC(e),o=String(r.getFullYear());"utc"==t&&(o=o.substr(2,2));var s=o+n(String(r.getMonth()+1),2)+n(String(r.getDate()),2)+n(String(r.getHours()),2)+n(String(r.getMinutes()),2)+n(String(r.getSeconds()),2);if(!0===i){var a=r.getMilliseconds();if(0!=a){var l=n(String(a),3);s=s+"."+(l=l.replace(/[0]+$/,""))}}return s+"Z"},this.zeroPadding=function(e,t){return e.length>=t?e:new Array(t-e.length+1).join("0")+e},this.getString=function(){return this.s},this.setString=function(e){this.hTLV=null,this.isModified=!0,this.s=e,this.hV=Z(e)},this.setByDateValue=function(e,t,i,n,r,o){var s=new Date(Date.UTC(e,t-1,i,n,r,o,0));this.setByDate(s)},this.getFreshValueHex=function(){return this.hV}},l.lang.extend(a.asn1.DERAbstractTime,a.asn1.ASN1Object),a.asn1.DERAbstractStructured=function(e){a.asn1.DERAbstractString.superclass.constructor.call(this),this.setByASN1ObjectArray=function(e){this.hTLV=null,this.isModified=!0,this.asn1Array=e},this.appendASN1Object=function(e){this.hTLV=null,this.isModified=!0,this.asn1Array.push(e)},this.asn1Array=new Array,void 0!==e&&void 0!==e.array&&(this.asn1Array=e.array)},l.lang.extend(a.asn1.DERAbstractStructured,a.asn1.ASN1Object),a.asn1.DERBoolean=function(e){a.asn1.DERBoolean.superclass.constructor.call(this),this.hT="01",this.hTLV=0==e?"010100":"0101ff"},l.lang.extend(a.asn1.DERBoolean,a.asn1.ASN1Object),a.asn1.DERInteger=function(e){a.asn1.DERInteger.superclass.constructor.call(this),this.hT="02",this.setByBigInteger=function(e){this.hTLV=null,this.isModified=!0,this.hV=a.asn1.ASN1Util.bigIntToMinTwosComplementsHex(e)},this.setByInteger=function(e){var t=new c(String(e),10);this.setByBigInteger(t)},this.setValueHex=function(e){this.hV=e},this.getFreshValueHex=function(){return this.hV},void 0!==e&&(void 0!==e.bigint?this.setByBigInteger(e.bigint):void 0!==e.int?this.setByInteger(e.int):"number"==typeof e?this.setByInteger(e):void 0!==e.hex&&this.setValueHex(e.hex))},l.lang.extend(a.asn1.DERInteger,a.asn1.ASN1Object),a.asn1.DERBitString=function(e){if(void 0!==e&&void 0!==e.obj){var t=a.asn1.ASN1Util.newObject(e.obj);e.hex="00"+t.getEncodedHex()}a.asn1.DERBitString.superclass.constructor.call(this),this.hT="03",this.setHexValueIncludingUnusedBits=function(e){this.hTLV=null,this.isModified=!0,this.hV=e},this.setUnusedBitsAndHexValue=function(e,t){if(e<0||7<e)throw"unused bits shall be from 0 to 7: u = "+e;var i="0"+e;this.hTLV=null,this.isModified=!0,this.hV=i+t},this.setByBinaryString=function(e){var t=8-(e=e.replace(/0+$/,"")).length%8;8==t&&(t=0);for(var i=0;i<=t;i++)e+="0";var n="";for(i=0;i<e.length-1;i+=8){var r=e.substr(i,8),o=parseInt(r,2).toString(16);1==o.length&&(o="0"+o),n+=o}this.hTLV=null,this.isModified=!0,this.hV="0"+t+n},this.setByBooleanArray=function(e){for(var t="",i=0;i<e.length;i++)1==e[i]?t+="1":t+="0";this.setByBinaryString(t)},this.newFalseArray=function(e){for(var t=new Array(e),i=0;i<e;i++)t[i]=!1;return t},this.getFreshValueHex=function(){return this.hV},void 0!==e&&("string"==typeof e&&e.toLowerCase().match(/^[0-9a-f]+$/)?this.setHexValueIncludingUnusedBits(e):void 0!==e.hex?this.setHexValueIncludingUnusedBits(e.hex):void 0!==e.bin?this.setByBinaryString(e.bin):void 0!==e.array&&this.setByBooleanArray(e.array))},l.lang.extend(a.asn1.DERBitString,a.asn1.ASN1Object),a.asn1.DEROctetString=function(e){if(void 0!==e&&void 0!==e.obj){var t=a.asn1.ASN1Util.newObject(e.obj);e.hex=t.getEncodedHex()}a.asn1.DEROctetString.superclass.constructor.call(this,e),this.hT="04"},l.lang.extend(a.asn1.DEROctetString,a.asn1.DERAbstractString),a.asn1.DERNull=function(){a.asn1.DERNull.superclass.constructor.call(this),this.hT="05",this.hTLV="0500"},l.lang.extend(a.asn1.DERNull,a.asn1.ASN1Object),a.asn1.DERObjectIdentifier=function(e){a.asn1.DERObjectIdentifier.superclass.constructor.call(this),this.hT="06",this.setValueHex=function(e){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=e},this.setValueOidString=function(e){var t=function(e){var t=function(e){var t=e.toString(16);return 1==t.length&&(t="0"+t),t},i=function(e){var i="",n=parseInt(e,10).toString(2),r=7-n.length%7;7==r&&(r=0);for(var o="",s=0;s<r;s++)o+="0";for(n=o+n,s=0;s<n.length-1;s+=7){var a=n.substr(s,7);s!=n.length-7&&(a="1"+a),i+=t(parseInt(a,2))}return i};try{if(!e.match(/^[0-9.]+$/))return null;var n="",r=e.split("."),o=40*parseInt(r[0],10)+parseInt(r[1],10);n+=t(o),r.splice(0,2);for(var s=0;s<r.length;s++)n+=i(r[s]);return n}catch(e){return null}}(e);if(null==t)throw new Error("malformed oid string: "+e);this.hTLV=null,this.isModified=!0,this.s=null,this.hV=t},this.setValueName=function(e){var t=a.asn1.x509.OID.name2oid(e);if(""===t)throw new Error("DERObjectIdentifier oidName undefined: "+e);this.setValueOidString(t)},this.setValueNameOrOid=function(e){e.match(/^[0-2].[0-9.]+$/)?this.setValueOidString(e):this.setValueName(e)},this.getFreshValueHex=function(){return this.hV},this.setByParam=function(e){"string"==typeof e?this.setValueNameOrOid(e):void 0!==e.oid?this.setValueNameOrOid(e.oid):void 0!==e.name?this.setValueNameOrOid(e.name):void 0!==e.hex&&this.setValueHex(e.hex)},void 0!==e&&this.setByParam(e)},l.lang.extend(a.asn1.DERObjectIdentifier,a.asn1.ASN1Object),a.asn1.DEREnumerated=function(e){a.asn1.DEREnumerated.superclass.constructor.call(this),this.hT="0a",this.setByBigInteger=function(e){this.hTLV=null,this.isModified=!0,this.hV=a.asn1.ASN1Util.bigIntToMinTwosComplementsHex(e)},this.setByInteger=function(e){var t=new c(String(e),10);this.setByBigInteger(t)},this.setValueHex=function(e){this.hV=e},this.getFreshValueHex=function(){return this.hV},void 0!==e&&(void 0!==e.int?this.setByInteger(e.int):"number"==typeof e?this.setByInteger(e):void 0!==e.hex&&this.setValueHex(e.hex))},l.lang.extend(a.asn1.DEREnumerated,a.asn1.ASN1Object),a.asn1.DERUTF8String=function(e){a.asn1.DERUTF8String.superclass.constructor.call(this,e),this.hT="0c"},l.lang.extend(a.asn1.DERUTF8String,a.asn1.DERAbstractString),a.asn1.DERNumericString=function(e){a.asn1.DERNumericString.superclass.constructor.call(this,e),this.hT="12"},l.lang.extend(a.asn1.DERNumericString,a.asn1.DERAbstractString),a.asn1.DERPrintableString=function(e){a.asn1.DERPrintableString.superclass.constructor.call(this,e),this.hT="13"},l.lang.extend(a.asn1.DERPrintableString,a.asn1.DERAbstractString),a.asn1.DERTeletexString=function(e){a.asn1.DERTeletexString.superclass.constructor.call(this,e),this.hT="14"},l.lang.extend(a.asn1.DERTeletexString,a.asn1.DERAbstractString),a.asn1.DERIA5String=function(e){a.asn1.DERIA5String.superclass.constructor.call(this,e),this.hT="16"},l.lang.extend(a.asn1.DERIA5String,a.asn1.DERAbstractString),a.asn1.DERVisibleString=function(e){a.asn1.DERIA5String.superclass.constructor.call(this,e),this.hT="1a"},l.lang.extend(a.asn1.DERVisibleString,a.asn1.DERAbstractString),a.asn1.DERBMPString=function(e){a.asn1.DERBMPString.superclass.constructor.call(this,e),this.hT="1e"},l.lang.extend(a.asn1.DERBMPString,a.asn1.DERAbstractString),a.asn1.DERUTCTime=function(e){a.asn1.DERUTCTime.superclass.constructor.call(this,e),this.hT="17",this.setByDate=function(e){this.hTLV=null,this.isModified=!0,this.date=e,this.s=this.formatDate(this.date,"utc"),this.hV=Z(this.s)},this.getFreshValueHex=function(){return void 0===this.date&&void 0===this.s&&(this.date=new Date,this.s=this.formatDate(this.date,"utc"),this.hV=Z(this.s)),this.hV},void 0!==e&&(void 0!==e.str?this.setString(e.str):"string"==typeof e&&e.match(/^[0-9]{12}Z$/)?this.setString(e):void 0!==e.hex?this.setStringHex(e.hex):void 0!==e.date&&this.setByDate(e.date))},l.lang.extend(a.asn1.DERUTCTime,a.asn1.DERAbstractTime),a.asn1.DERGeneralizedTime=function(e){a.asn1.DERGeneralizedTime.superclass.constructor.call(this,e),this.hT="18",this.withMillis=!1,this.setByDate=function(e){this.hTLV=null,this.isModified=!0,this.date=e,this.s=this.formatDate(this.date,"gen",this.withMillis),this.hV=Z(this.s)},this.getFreshValueHex=function(){return void 0===this.date&&void 0===this.s&&(this.date=new Date,this.s=this.formatDate(this.date,"gen",this.withMillis),this.hV=Z(this.s)),this.hV},void 0!==e&&(void 0!==e.str?this.setString(e.str):"string"==typeof e&&e.match(/^[0-9]{14}Z$/)?this.setString(e):void 0!==e.hex?this.setStringHex(e.hex):void 0!==e.date&&this.setByDate(e.date),!0===e.millis&&(this.withMillis=!0))},l.lang.extend(a.asn1.DERGeneralizedTime,a.asn1.DERAbstractTime),a.asn1.DERSequence=function(e){a.asn1.DERSequence.superclass.constructor.call(this,e),this.hT="30",this.getFreshValueHex=function(){for(var e="",t=0;t<this.asn1Array.length;t++){e+=this.asn1Array[t].getEncodedHex()}return this.hV=e,this.hV}},l.lang.extend(a.asn1.DERSequence,a.asn1.DERAbstractStructured),a.asn1.DERSet=function(e){a.asn1.DERSet.superclass.constructor.call(this,e),this.hT="31",this.sortFlag=!0,this.getFreshValueHex=function(){for(var e=new Array,t=0;t<this.asn1Array.length;t++){var i=this.asn1Array[t];e.push(i.getEncodedHex())}return 1==this.sortFlag&&e.sort(),this.hV=e.join(""),this.hV},void 0!==e&&void 0!==e.sortflag&&0==e.sortflag&&(this.sortFlag=!1)},l.lang.extend(a.asn1.DERSet,a.asn1.DERAbstractStructured),a.asn1.DERTaggedObject=function(e){a.asn1.DERTaggedObject.superclass.constructor.call(this);var t=a.asn1;this.hT="a0",this.hV="",this.isExplicit=!0,this.asn1Object=null,this.setASN1Object=function(e,t,i){this.hT=t,this.isExplicit=e,this.asn1Object=i,this.isExplicit?(this.hV=this.asn1Object.getEncodedHex(),this.hTLV=null,this.isModified=!0):(this.hV=null,this.hTLV=i.getEncodedHex(),this.hTLV=this.hTLV.replace(/^../,t),this.isModified=!1)},this.getFreshValueHex=function(){return this.hV},this.setByParam=function(e){null!=e.tag&&(this.hT=e.tag),null!=e.explicit&&(this.isExplicit=e.explicit),null!=e.tage&&(this.hT=e.tage,this.isExplicit=!0),null!=e.tagi&&(this.hT=e.tagi,this.isExplicit=!1),null!=e.obj&&(e.obj instanceof t.ASN1Object?(this.asn1Object=e.obj,this.setASN1Object(this.isExplicit,this.hT,this.asn1Object)):"object"==typeof e.obj&&(this.asn1Object=t.ASN1Util.newObject(e.obj),this.setASN1Object(this.isExplicit,this.hT,this.asn1Object)))},null!=e&&this.setByParam(e)},l.lang.extend(a.asn1.DERTaggedObject,a.asn1.ASN1Object);var Ee=new function(){};function Me(e,t){for(var i="",n=t/4-e.length,r=0;r<n;r++)i+="0";return i+e}function Se(e,t,i){for(var n="",r=0;n.length<t;)n+=ne(i(re(e+String.fromCharCode.apply(String,[(4278190080&r)>>24,(16711680&r)>>16,(65280&r)>>8,255&r])))),r+=1;return n}function Ce(e){for(var t in a.crypto.Util.DIGESTINFOHEAD){var i=a.crypto.Util.DIGESTINFOHEAD[t],n=i.length;if(e.substring(0,n)==i)return[t,e.substring(n)]}return[]}function Ie(e){var t,i=Ee,n=i.getChildIdx,r=i.getV,o=i.getTLV,s=i.getVbyList,l=i.getVbyListEx,u=i.getTLVbyList,c=i.getTLVbyListEx,h=i.getIdxbyList,d=i.getIdxbyListEx,p=i.getVidx,f=i.getInt,A=i.oidname,m=i.hextooidstr,g=ae;try{t=a.asn1.x509.AlgorithmIdentifier.PSSNAME2ASN1TLV}catch(e){}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(null===this.hex||0!==this.version)return this.version;var e=u(this.hex,0,[0,0]);if("a0"==e.substr(0,2)){var t=u(e,0,[0]),i=f(t,0);if(i<0||2<i)throw new Error("malformed version field");return this.version=i+1,this.version}return this.version=1,this.foffset=-1,1},this.getSerialNumberHex=function(){return l(this.hex,0,[0,0],"02")},this.getSignatureAlgorithmField=function(){var e=c(this.hex,0,[0,1]);return this.getAlgorithmIdentifierName(e)},this.getAlgorithmIdentifierName=function(e){for(var i in t)if(e===t[i])return i;return A(l(e,0,[0],"06"))},this.getIssuer=function(){return this.getX500Name(this.getIssuerHex())},this.getIssuerHex=function(){return u(this.hex,0,[0,3+this.foffset],"30")},this.getIssuerString=function(){return this.getIssuer().str},this.getSubject=function(){return this.getX500Name(this.getSubjectHex())},this.getSubjectHex=function(){return u(this.hex,0,[0,5+this.foffset],"30")},this.getSubjectString=function(){return this.getSubject().str},this.getNotBefore=function(){var e=s(this.hex,0,[0,4+this.foffset,0]);return e=e.replace(/(..)/g,"%$1"),e=decodeURIComponent(e)},this.getNotAfter=function(){var e=s(this.hex,0,[0,4+this.foffset,1]);return e=e.replace(/(..)/g,"%$1"),e=decodeURIComponent(e)},this.getPublicKeyHex=function(){return i.getTLVbyList(this.hex,0,[0,6+this.foffset],"30")},this.getPublicKeyIdx=function(){return h(this.hex,0,[0,6+this.foffset],"30")},this.getPublicKeyContentIdx=function(){var e=this.getPublicKeyIdx();return h(this.hex,e,[1,0],"30")},this.getPublicKey=function(){return we.getKey(this.getPublicKeyHex(),null,"pkcs8pub")},this.getSignatureAlgorithmName=function(){var e=u(this.hex,0,[1],"30");return this.getAlgorithmIdentifierName(e)},this.getSignatureValueHex=function(){return s(this.hex,0,[2],"03",!0)},this.verifySignature=function(e){var t=this.getSignatureAlgorithmField(),i=this.getSignatureValueHex(),n=u(this.hex,0,[0],"30"),r=new a.crypto.Signature({alg:t});return r.init(e),r.updateHex(n),r.verify(i)},this.parseExt=function(e){var t,o,a;if(void 0===e){if(a=this.hex,3!==this.version)return-1;t=h(a,0,[0,7,0],"30"),o=n(a,t)}else{a=ae(e);var l=h(a,0,[0,3,0,0],"06");if("2a864886f70d01090e"!=r(a,l))return void(this.aExtInfo=new Array);t=h(a,0,[0,3,0,1,0],"30"),o=n(a,t),this.hex=a}this.aExtInfo=new Array;for(var u=0;u<o.length;u++){var c={critical:!1},d=0;3===n(a,o[u]).length&&(c.critical=!0,d=1),c.oid=i.hextooidstr(s(a,o[u],[0],"06"));var f=h(a,o[u],[1+d]);c.vidx=p(a,f),this.aExtInfo.push(c)}},this.getExtInfo=function(e){var t=this.aExtInfo,i=e;if(e.match(/^[0-9.]+$/)||(i=a.asn1.x509.OID.name2oid(e)),""!==i)for(var n=0;n<t.length;n++)if(t[n].oid===i)return t[n]},this.getExtBasicConstraints=function(e,t){if(void 0===e&&void 0===t){var i=this.getExtInfo("basicConstraints");if(void 0===i)return;e=o(this.hex,i.vidx),t=i.critical}var n={extname:"basicConstraints"};if(t&&(n.critical=!0),"3000"===e)return n;if("30030101ff"===e)return n.cA=!0,n;if("30060101ff02"===e.substr(0,12)){var s=r(e,10),a=parseInt(s,16);return n.cA=!0,n.pathLen=a,n}throw new Error("hExtV parse error: "+e)},this.getExtKeyUsage=function(e,t){if(void 0===e&&void 0===t){var i=this.getExtInfo("keyUsage");if(void 0===i)return;e=o(this.hex,i.vidx),t=i.critical}var n={extname:"keyUsage"};return t&&(n.critical=!0),n.names=this.getExtKeyUsageString(e).split(","),n},this.getExtKeyUsageBin=function(e){if(void 0===e){var t=this.getExtInfo("keyUsage");if(void 0===t)return"";e=o(this.hex,t.vidx)}if(8!=e.length&&10!=e.length)throw new Error("malformed key usage value: "+e);var i="000000000000000"+parseInt(e.substr(6),16).toString(2);return 8==e.length&&(i=i.slice(-8)),10==e.length&&(i=i.slice(-16)),""==(i=i.replace(/0+$/,""))&&(i="0"),i},this.getExtKeyUsageString=function(e){for(var t=this.getExtKeyUsageBin(e),i=new Array,n=0;n<t.length;n++)"1"==t.substr(n,1)&&i.push(Ie.KEYUSAGE_NAME[n]);return i.join(",")},this.getExtSubjectKeyIdentifier=function(e,t){if(void 0===e&&void 0===t){var i=this.getExtInfo("subjectKeyIdentifier");if(void 0===i)return;e=o(this.hex,i.vidx),t=i.critical}var n={extname:"subjectKeyIdentifier"};t&&(n.critical=!0);var s=r(e,0);return n.kid={hex:s},n},this.getExtAuthorityKeyIdentifier=function(e,t){if(void 0===e&&void 0===t){var i=this.getExtInfo("authorityKeyIdentifier");if(void 0===i)return;e=o(this.hex,i.vidx),t=i.critical}var s={extname:"authorityKeyIdentifier"};t&&(s.critical=!0);for(var a=n(e,0),l=0;l<a.length;l++){var u=e.substr(a[l],2);if("80"===u&&(s.kid={hex:r(e,a[l])}),"a1"===u){var c=o(e,a[l]),h=this.getGeneralNames(c);s.issuer=h[0].dn}"82"===u&&(s.sn={hex:r(e,a[l])})}return s},this.getExtExtKeyUsage=function(e,t){if(void 0===e&&void 0===t){var i=this.getExtInfo("extKeyUsage");if(void 0===i)return;e=o(this.hex,i.vidx),t=i.critical}var s={extname:"extKeyUsage",array:[]};t&&(s.critical=!0);for(var a=n(e,0),l=0;l<a.length;l++)s.array.push(A(r(e,a[l])));return s},this.getExtExtKeyUsageName=function(){var e=this.getExtInfo("extKeyUsage");if(void 0===e)return e;var t=new Array,i=o(this.hex,e.vidx);if(""===i)return t;for(var s=n(i,0),a=0;a<s.length;a++)t.push(A(r(i,s[a])));return t},this.getExtSubjectAltName=function(e,t){if(void 0===e&&void 0===t){var i=this.getExtInfo("subjectAltName");if(void 0===i)return;e=o(this.hex,i.vidx),t=i.critical}var n={extname:"subjectAltName",array:[]};return t&&(n.critical=!0),n.array=this.getGeneralNames(e),n},this.getExtIssuerAltName=function(e,t){if(void 0===e&&void 0===t){var i=this.getExtInfo("issuerAltName");if(void 0===i)return;e=o(this.hex,i.vidx),t=i.critical}var n={extname:"issuerAltName",array:[]};return t&&(n.critical=!0),n.array=this.getGeneralNames(e),n},this.getGeneralNames=function(e){for(var t=n(e,0),i=[],r=0;r<t.length;r++){var s=this.getGeneralName(o(e,t[r]));void 0!==s&&i.push(s)}return i},this.getGeneralName=function(e){var t=e.substr(0,2),i=r(e,0),n=ne(i);return"81"==t?{rfc822:n}:"82"==t?{dns:n}:"86"==t?{uri:n}:"87"==t?{ip:le(i)}:"a4"==t?{dn:this.getX500Name(i)}:void 0},this.getExtSubjectAltName2=function(){var e,t,i,s=this.getExtInfo("subjectAltName");if(void 0===s)return s;for(var a=new Array,l=o(this.hex,s.vidx),u=n(l,0),c=0;c<u.length;c++)i=l.substr(u[c],2),e=r(l,u[c]),"81"===i&&(t=ie(e),a.push(["MAIL",t])),"82"===i&&(t=ie(e),a.push(["DNS",t])),"84"===i&&(t=Ie.hex2dn(e,0),a.push(["DN",t])),"86"===i&&(t=ie(e),a.push(["URI",t])),"87"===i&&(t=le(e),a.push(["IP",t]));return a},this.getExtCRLDistributionPoints=function(e,t){if(void 0===e&&void 0===t){var i=this.getExtInfo("cRLDistributionPoints");if(void 0===i)return;e=o(this.hex,i.vidx),t=i.critical}var r={extname:"cRLDistributionPoints",array:[]};t&&(r.critical=!0);for(var s=n(e,0),a=0;a<s.length;a++){var l=o(e,s[a]);r.array.push(this.getDistributionPoint(l))}return r},this.getDistributionPoint=function(e){for(var t={},i=n(e,0),r=0;r<i.length;r++){var s=e.substr(i[r],2),a=o(e,i[r]);"a0"==s&&(t.dpname=this.getDistributionPointName(a))}return t},this.getDistributionPointName=function(e){for(var t={},i=n(e,0),r=0;r<i.length;r++){var s=e.substr(i[r],2),a=o(e,i[r]);"a0"==s&&(t.full=this.getGeneralNames(a))}return t},this.getExtCRLDistributionPointsURI=function(){var e=this.getExtInfo("cRLDistributionPoints");if(void 0===e)return e;for(var t=new Array,i=n(this.hex,e.vidx),r=0;r<i.length;r++)try{var o=ie(s(this.hex,i[r],[0,0,0],"86"));t.push(o)}catch(e){}return t},this.getExtAIAInfo=function(){var e=this.getExtInfo("authorityInfoAccess");if(void 0===e)return e;for(var t={ocsp:[],caissuer:[]},i=n(this.hex,e.vidx),r=0;r<i.length;r++){var o=s(this.hex,i[r],[0],"06"),a=s(this.hex,i[r],[1],"86");"2b06010505073001"===o&&t.ocsp.push(ie(a)),"2b06010505073002"===o&&t.caissuer.push(ie(a))}return t},this.getExtAuthorityInfoAccess=function(e,t){if(void 0===e&&void 0===t){var i=this.getExtInfo("authorityInfoAccess");if(void 0===i)return;e=o(this.hex,i.vidx),t=i.critical}var r={extname:"authorityInfoAccess",array:[]};t&&(r.critical=!0);for(var a=n(e,0),u=0;u<a.length;u++){var c=l(e,a[u],[0],"06"),h=ie(s(e,a[u],[1],"86"));if("2b06010505073001"==c)r.array.push({ocsp:h});else{if("2b06010505073002"!=c)throw new Error("unknown method: "+c);r.array.push({caissuer:h})}}return r},this.getExtCertificatePolicies=function(e,t){if(void 0===e&&void 0===t){var i=this.getExtInfo("certificatePolicies");if(void 0===i)return;e=o(this.hex,i.vidx),t=i.critical}var r={extname:"certificatePolicies",array:[]};t&&(r.critical=!0);for(var s=n(e,0),a=0;a<s.length;a++){var l=o(e,s[a]),u=this.getPolicyInformation(l);r.array.push(u)}return r},this.getPolicyInformation=function(e){var t={},i=s(e,0,[0],"06");t.policyoid=A(i);var r=d(e,0,[1],"30");if(-1!=r){t.array=[];for(var a=n(e,r),l=0;l<a.length;l++){var u=o(e,a[l]),c=this.getPolicyQualifierInfo(u);t.array.push(c)}}return t},this.getPolicyQualifierInfo=function(e){var t={},i=s(e,0,[0],"06");if("2b06010505070201"===i){var n=l(e,0,[1],"16");t.cps=ne(n)}else if("2b06010505070202"===i){var r=u(e,0,[1],"30");t.unotice=this.getUserNotice(r)}return t},this.getUserNotice=function(e){for(var t={},i=n(e,0),r=0;r<i.length;r++){var s=o(e,i[r]);"30"!=s.substr(0,2)&&(t.exptext=this.getDisplayText(s))}return t},this.getDisplayText=function(e){var t={};return t.type={"0c":"utf8",16:"ia5","1a":"vis","1e":"bmp"}[e.substr(0,2)],t.str=ne(r(e,0)),t},this.getExtCRLNumber=function(e,t){var i={extname:"cRLNumber"};if(t&&(i.critical=!0),"02"==e.substr(0,2))return i.num={hex:r(e,0)},i;throw new Error("hExtV parse error: "+e)},this.getExtCRLReason=function(e,t){var i={extname:"cRLReason"};if(t&&(i.critical=!0),"0a"==e.substr(0,2))return i.code=parseInt(r(e,0),16),i;throw new Error("hExtV parse error: "+e)},this.getExtOcspNonce=function(e,t){var i={extname:"ocspNonce"};t&&(i.critical=!0);var n=r(e,0);return i.hex=n,i},this.getExtOcspNoCheck=function(e,t){var i={extname:"ocspNoCheck"};return t&&(i.critical=!0),i},this.getExtAdobeTimeStamp=function(e,t){if(void 0===e&&void 0===t){var i=this.getExtInfo("adobeTimeStamp");if(void 0===i)return;e=o(this.hex,i.vidx),t=i.critical}var r={extname:"adobeTimeStamp"};t&&(r.critical=!0);var s=n(e,0);if(s.length>1){var a=o(e,s[1]),l=this.getGeneralName(a);null!=l.uri&&(r.uri=l.uri)}if(s.length>2){var u=o(e,s[2]);"0101ff"==u&&(r.reqauth=!0),"010100"==u&&(r.reqauth=!1)}return r},this.getX500NameRule=function(e){for(var t=null,i=[],n=0;n<e.length;n++)for(var r=e[n],o=0;o<r.length;o++)i.push(r[o]);for(n=0;n<i.length;n++){var s=i[n],l=s.ds,u=s.value,c=s.type;if("prn"!=l&&"utf8"!=l&&"ia5"!=l)return"mixed";if("ia5"==l){if("CN"!=c)return"mixed";if(a.lang.String.isMail(u))continue;return"mixed"}if("C"==c){if("prn"==l)continue;return"mixed"}if(null==t)t=l;else if(t!==l)return"mixed"}return null==t?"prn":t},this.getX500Name=function(e){var t=this.getX500NameArray(e);return{array:t,str:this.dnarraytostr(t)}},this.getX500NameArray=function(e){for(var t=[],i=n(e,0),r=0;r<i.length;r++)t.push(this.getRDN(o(e,i[r])));return t},this.getRDN=function(e){for(var t=[],i=n(e,0),r=0;r<i.length;r++)t.push(this.getAttrTypeAndValue(o(e,i[r])));return t},this.getAttrTypeAndValue=function(e){var t={type:null,value:null,ds:null},i=n(e,0),r=s(e,i[0],[],"06"),o=s(e,i[1],[]),l=a.asn1.ASN1Util.oidHexToInt(r);return t.type=a.asn1.x509.OID.oid2atype(l),t.ds=this.HEX2STAG[e.substr(i[1],2)],"bmp"!=t.ds?t.value=ie(o):t.value=ue(o),t},this.readCertPEM=function(e){this.readCertHex(g(e))},this.readCertHex=function(e){this.hex=e,this.getVersion();try{h(this.hex,0,[0,7],"a3"),this.parseExt()}catch(e){}},this.getParam=function(){var e={};return e.version=this.getVersion(),e.serial={hex:this.getSerialNumberHex()},e.sigalg=this.getSignatureAlgorithmField(),e.issuer=this.getIssuer(),e.notbefore=this.getNotBefore(),e.notafter=this.getNotAfter(),e.subject=this.getSubject(),e.sbjpubkey=se(this.getPublicKeyHex(),"PUBLIC KEY"),this.aExtInfo.length>0&&(e.ext=this.getExtParamArray()),e.sighex=this.getSignatureValueHex(),e},this.getExtParamArray=function(e){null==e&&(-1!=d(this.hex,0,[0,"[3]"])&&(e=c(this.hex,0,[0,"[3]",0],"30")));for(var t=[],i=n(e,0),r=0;r<i.length;r++){var s=o(e,i[r]),a=this.getExtParam(s);null!=a&&t.push(a)}return t},this.getExtParam=function(e){var t=n(e,0).length;if(2!=t&&3!=t)throw new Error("wrong number elements in Extension: "+t+" "+e);var i=m(s(e,0,[0],"06")),r=!1;3==t&&"0101ff"==u(e,0,[1])&&(r=!0);var o=u(e,0,[t-1,0]),a=void 0;if("2.5.29.14"==i?a=this.getExtSubjectKeyIdentifier(o,r):"2.5.29.15"==i?a=this.getExtKeyUsage(o,r):"2.5.29.17"==i?a=this.getExtSubjectAltName(o,r):"2.5.29.18"==i?a=this.getExtIssuerAltName(o,r):"2.5.29.19"==i?a=this.getExtBasicConstraints(o,r):"2.5.29.31"==i?a=this.getExtCRLDistributionPoints(o,r):"2.5.29.32"==i?a=this.getExtCertificatePolicies(o,r):"2.5.29.35"==i?a=this.getExtAuthorityKeyIdentifier(o,r):"2.5.29.37"==i?a=this.getExtExtKeyUsage(o,r):"1.3.6.1.5.5.7.1.1"==i?a=this.getExtAuthorityInfoAccess(o,r):"2.5.29.20"==i?a=this.getExtCRLNumber(o,r):"2.5.29.21"==i?a=this.getExtCRLReason(o,r):"1.3.6.1.5.5.7.48.1.2"==i?a=this.getExtOcspNonce(o,r):"1.3.6.1.5.5.7.48.1.5"==i?a=this.getExtOcspNoCheck(o,r):"1.2.840.113583.1.1.9.1"==i&&(a=this.getExtAdobeTimeStamp(o,r)),null!=a)return a;var l={extname:i,extn:o};return r&&(l.critical=!0),l},this.findExt=function(e,t){for(var i=0;i<e.length;i++)if(e[i].extname==t)return e[i];return null},this.updateExtCDPFullURI=function(e,t){var i=this.findExt(e,"cRLDistributionPoints");if(null!=i&&null!=i.array)for(var n=i.array,r=0;r<n.length;r++)if(null!=n[r].dpname&&null!=n[r].dpname.full)for(var o=n[r].dpname.full,s=0;s<o.length;s++){var a=o[r];null!=a.uri&&(a.uri=t)}},this.updateExtAIAOCSP=function(e,t){var i=this.findExt(e,"authorityInfoAccess");if(null!=i&&null!=i.array)for(var n=i.array,r=0;r<n.length;r++)null!=n[r].ocsp&&(n[r].ocsp=t)},this.updateExtAIACAIssuer=function(e,t){var i=this.findExt(e,"authorityInfoAccess");if(null!=i&&null!=i.array)for(var n=i.array,r=0;r<n.length;r++)null!=n[r].caissuer&&(n[r].caissuer=t)},this.dnarraytostr=function(e){return"/"+e.map((function(e){return function(e){return e.map((function(e){return function(e){return e.type+"="+e.value}(e).replace(/\+/,"\\+")})).join("+")}(e).replace(/\//,"\\/")})).join("/")},this.getInfo=function(){var e,t,i,n,r=function(e){for(var t="",i=e.array,n=0;n<i.length;n++){var r=i[n];if(t+=" policy oid: "+r.policyoid+"\n",void 0!==r.array)for(var o=0;o<r.array.length;o++){var s=r.array[o];void 0!==s.cps&&(t+=" cps: "+s.cps+"\n")}}return t},o=function(e){for(var t="",i=e.array,n=0;n<i.length;n++){var r=i[n];try{void 0!==r.dpname.full[0].uri&&(t+=" "+r.dpname.full[0].uri+"\n")}catch(e){}try{void 0!==r.dname.full[0].dn.hex&&(t+=" "+Ie.hex2dn(r.dpname.full[0].dn.hex)+"\n")}catch(e){}}return t},s=function(e){for(var t="",i=e.array,n=0;n<i.length;n++){var r=i[n];void 0!==r.caissuer&&(t+=" caissuer: "+r.caissuer+"\n"),void 0!==r.ocsp&&(t+=" ocsp: "+r.ocsp+"\n")}return t};if(e="Basic Fields\n",e+=" serial number: "+this.getSerialNumberHex()+"\n",e+=" signature algorithm: "+this.getSignatureAlgorithmField()+"\n",e+=" issuer: "+this.getIssuerString()+"\n",e+=" notBefore: "+this.getNotBefore()+"\n",e+=" notAfter: "+this.getNotAfter()+"\n",e+=" subject: "+this.getSubjectString()+"\n",e+=" subject public key info: \n",e+=" key algorithm: "+(t=this.getPublicKey()).type+"\n","RSA"===t.type&&(e+=" n="+he(t.n.toString(16)).substr(0,16)+"...\n",e+=" e="+he(t.e.toString(16))+"\n"),null!=(i=this.aExtInfo)){e+="X509v3 Extensions:\n";for(var l=0;l<i.length;l++){var u=i[l],c=a.asn1.x509.OID.oid2name(u.oid);""===c&&(c=u.oid);var h="";if(!0===u.critical&&(h="CRITICAL"),e+=" "+c+" "+h+":\n","basicConstraints"===c){var d=this.getExtBasicConstraints();void 0===d.cA?e+=" {}\n":(e+=" cA=true",void 0!==d.pathLen&&(e+=", pathLen="+d.pathLen),e+="\n")}else if("keyUsage"===c)e+=" "+this.getExtKeyUsageString()+"\n";else if("subjectKeyIdentifier"===c)e+=" "+this.getExtSubjectKeyIdentifier().kid.hex+"\n";else if("authorityKeyIdentifier"===c){var p=this.getExtAuthorityKeyIdentifier();void 0!==p.kid&&(e+=" kid="+p.kid.hex+"\n")}else{if("extKeyUsage"===c)e+=" "+this.getExtExtKeyUsage().array.join(", ")+"\n";else if("subjectAltName"===c)e+=" "+(n=this.getExtSubjectAltName(),JSON.stringify(n.array).replace(/[\[\]\{\}\"]/g,""))+"\n";else if("cRLDistributionPoints"===c)e+=o(this.getExtCRLDistributionPoints());else if("authorityInfoAccess"===c)e+=s(this.getExtAuthorityInfoAccess());else"certificatePolicies"===c&&(e+=r(this.getExtCertificatePolicies()))}}}return e+="signature algorithm: "+this.getSignatureAlgorithmName()+"\n",e+="signature: "+this.getSignatureValueHex().substr(0,16)+"...\n"},"string"==typeof e&&(-1!=e.indexOf("-----BEGIN")?this.readCertPEM(e):a.lang.String.isHex(e)&&this.readCertHex(e))}function Be(e){return u.SHA256(e).toString()}Ee.getLblen=function(e,t){if("8"!=e.substr(t+2,1))return 1;var i=parseInt(e.substr(t+3,1));return 0==i?-1:0<i&&i<10?i+1:-2},Ee.getL=function(e,t){var i=Ee.getLblen(e,t);return i<1?"":e.substr(t+2,2*i)},Ee.getVblen=function(e,t){var i;return""==(i=Ee.getL(e,t))?-1:("8"===i.substr(0,1)?new c(i.substr(2),16):new c(i,16)).intValue()},Ee.getVidx=function(e,t){var i=Ee.getLblen(e,t);return i<0?i:t+2*(i+1)},Ee.getV=function(e,t){var i=Ee.getVidx(e,t),n=Ee.getVblen(e,t);return e.substr(i,2*n)},Ee.getTLV=function(e,t){return e.substr(t,2)+Ee.getL(e,t)+Ee.getV(e,t)},Ee.getTLVblen=function(e,t){return 2+2*Ee.getLblen(e,t)+2*Ee.getVblen(e,t)},Ee.getNextSiblingIdx=function(e,t){return Ee.getVidx(e,t)+2*Ee.getVblen(e,t)},Ee.getChildIdx=function(e,t){var i,n,r,o=Ee,s=[];i=o.getVidx(e,t),n=2*o.getVblen(e,t),"03"==e.substr(t,2)&&(i+=2,n-=2),r=0;for(var a=i;r<=n;){var l=o.getTLVblen(e,a);if((r+=l)<=n&&s.push(a),a+=l,r>=n)break}return s},Ee.getNthChildIdx=function(e,t,i){return Ee.getChildIdx(e,t)[i]},Ee.getIdxbyList=function(e,t,i,n){var r,o,s=Ee;return 0==i.length?void 0!==n&&e.substr(t,2)!==n?-1:t:(r=i.shift())>=(o=s.getChildIdx(e,t)).length?-1:s.getIdxbyList(e,o[r],i,n)},Ee.getIdxbyListEx=function(e,t,i,n){var r,o,s=Ee;if(0==i.length)return void 0!==n&&e.substr(t,2)!==n?-1:t;r=i.shift(),o=s.getChildIdx(e,t);for(var a=0,l=0;l<o.length;l++){var u=e.substr(o[l],2);if("number"==typeof r&&!s.isContextTag(u)&&a==r||"string"==typeof r&&s.isContextTag(u,r))return s.getIdxbyListEx(e,o[l],i,n);s.isContextTag(u)||a++}return-1},Ee.getTLVbyList=function(e,t,i,n){var r=Ee,o=r.getIdxbyList(e,t,i,n);return-1==o||o>=e.length?null:r.getTLV(e,o)},Ee.getTLVbyListEx=function(e,t,i,n){var r=Ee,o=r.getIdxbyListEx(e,t,i,n);return-1==o?null:r.getTLV(e,o)},Ee.getVbyList=function(e,t,i,n,r){var o,s,a=Ee;return-1==(o=a.getIdxbyList(e,t,i,n))||o>=e.length?null:(s=a.getV(e,o),!0===r&&(s=s.substr(2)),s)},Ee.getVbyListEx=function(e,t,i,n,r){var o,s,a=Ee;return-1==(o=a.getIdxbyListEx(e,t,i,n))?null:(s=a.getV(e,o),"03"==e.substr(o,2)&&!1!==r&&(s=s.substr(2)),s)},Ee.getInt=function(e,t,i){null==i&&(i=-1);try{var n=e.substr(t,2);if("02"!=n&&"03"!=n)return i;var r=Ee.getV(e,t);return"02"==n?parseInt(r,16):function(e){try{var t=e.substr(0,2);if("00"==t)return parseInt(e.substr(2),16);var i=parseInt(t,16),n=e.substr(2),r=parseInt(n,16).toString(2);return"0"==r&&(r="00000000"),r=r.slice(0,0-i),parseInt(r,2)}catch(e){return-1}}(r)}catch(e){return i}},Ee.getOID=function(e,t,i){null==i&&(i=null);try{return"06"!=e.substr(t,2)?i:function(e){if(!ce(e))return null;try{var t=[],i=e.substr(0,2),n=parseInt(i,16);t[0]=new String(Math.floor(n/40)),t[1]=new String(n%40);for(var r=e.substr(2),o=[],s=0;s<r.length/2;s++)o.push(parseInt(r.substr(2*s,2),16));var a=[],l="";for(s=0;s<o.length;s++)128&o[s]?l+=de((127&o[s]).toString(2),7):(l+=de((127&o[s]).toString(2),7),a.push(new String(parseInt(l,2))),l="");var u=t.join(".");return a.length>0&&(u=u+"."+a.join(".")),u}catch(e){return null}}(Ee.getV(e,t))}catch(e){return i}},Ee.getOIDName=function(e,t,i){null==i&&(i=null);try{var n=Ee.getOID(e,t,i);if(n==i)return i;var r=a.asn1.x509.OID.oid2name(n);return""==r?n:r}catch(e){return i}},Ee.getString=function(e,t,i){null==i&&(i=null);try{return ne(Ee.getV(e,t))}catch(e){return i}},Ee.hextooidstr=function(e){var t=function(e,t){return e.length>=t?e:new Array(t-e.length+1).join("0")+e},i=[],n=e.substr(0,2),r=parseInt(n,16);i[0]=new String(Math.floor(r/40)),i[1]=new String(r%40);for(var o=e.substr(2),s=[],a=0;a<o.length/2;a++)s.push(parseInt(o.substr(2*a,2),16));var l=[],u="";for(a=0;a<s.length;a++)128&s[a]?u+=t((127&s[a]).toString(2),7):(u+=t((127&s[a]).toString(2),7),l.push(new String(parseInt(u,2))),u="");var c=i.join(".");return l.length>0&&(c=c+"."+l.join(".")),c},Ee.dump=function(e,t,i,n){var r=Ee,o=r.getV,s=r.dump,l=r.getChildIdx,u=e;e instanceof a.asn1.ASN1Object&&(u=e.getEncodedHex());var c=function(e,t){return e.length<=2*t?e:e.substr(0,t)+"..(total "+e.length/2+"bytes).."+e.substr(e.length-t,t)};void 0===t&&(t={ommit_long_octet:32}),void 0===i&&(i=0),void 0===n&&(n="");var h,d=t.ommit_long_octet;if("01"==(h=u.substr(i,2)))return"00"==(p=o(u,i))?n+"BOOLEAN FALSE\n":n+"BOOLEAN TRUE\n";if("02"==h)return n+"INTEGER "+c(p=o(u,i),d)+"\n";if("03"==h){var p=o(u,i);if(r.isASN1HEX(p.substr(2))){var f=n+"BITSTRING, encapsulates\n";return f+=s(p.substr(2),t,0,n+" ")}return n+"BITSTRING "+c(p,d)+"\n"}if("04"==h){p=o(u,i);if(r.isASN1HEX(p)){f=n+"OCTETSTRING, encapsulates\n";return f+=s(p,t,0,n+" ")}return n+"OCTETSTRING "+c(p,d)+"\n"}if("05"==h)return n+"NULL\n";if("06"==h){var A=o(u,i),m=a.asn1.ASN1Util.oidHexToInt(A),g=a.asn1.x509.OID.oid2name(m),v=m.replace(/\./g," ");return""!=g?n+"ObjectIdentifier "+g+" ("+v+")\n":n+"ObjectIdentifier ("+v+")\n"}if("0a"==h)return n+"ENUMERATED "+parseInt(o(u,i))+"\n";if("0c"==h)return n+"UTF8String '"+ie(o(u,i))+"'\n";if("13"==h)return n+"PrintableString '"+ie(o(u,i))+"'\n";if("14"==h)return n+"TeletexString '"+ie(o(u,i))+"'\n";if("16"==h)return n+"IA5String '"+ie(o(u,i))+"'\n";if("17"==h)return n+"UTCTime "+ie(o(u,i))+"\n";if("18"==h)return n+"GeneralizedTime "+ie(o(u,i))+"\n";if("1a"==h)return n+"VisualString '"+ie(o(u,i))+"'\n";if("1e"==h)return n+"BMPString '"+ue(o(u,i))+"'\n";if("30"==h){if("3000"==u.substr(i,4))return n+"SEQUENCE {}\n";f=n+"SEQUENCE\n";var y=t;if((2==(w=l(u,i)).length||3==w.length)&&"06"==u.substr(w[0],2)&&"04"==u.substr(w[w.length-1],2)){g=r.oidname(o(u,w[0]));var b=JSON.parse(JSON.stringify(t));b.x509ExtName=g,y=b}for(var x=0;x<w.length;x++)f+=s(u,y,w[x],n+" ");return f}if("31"==h){f=n+"SET\n";var w=l(u,i);for(x=0;x<w.length;x++)f+=s(u,t,w[x],n+" ");return f}if(0!=(128&(h=parseInt(h,16)))){var E=31&h;if(0!=(32&h)){for(f=n+"["+E+"]\n",w=l(u,i),x=0;x<w.length;x++)f+=s(u,t,w[x],n+" ");return f}p=o(u,i);if(Ee.isASN1HEX(p)){var f=n+"["+E+"]\n";return f+=s(p,t,0,n+" ")}return("68747470"==p.substr(0,8)||"subjectAltName"===t.x509ExtName&&2==E)&&(p=ie(p)),f=n+"["+E+"] "+p+"\n"}return n+"UNKNOWN("+h+") "+o(u,i)+"\n"},Ee.isContextTag=function(e,t){var i,n;e=e.toLowerCase();try{i=parseInt(e,16)}catch(e){return-1}if(void 0===t)return 128==(192&i);try{return null!=t.match(/^\[[0-9]+\]$/)&&(!((n=parseInt(t.substr(1,t.length-1),10))>31)&&(128==(192&i)&&(31&i)==n))}catch(e){return!1}},Ee.isASN1HEX=function(e){var t=Ee;if(e.length%2==1)return!1;var i=t.getVblen(e,0),n=e.substr(0,2),r=t.getL(e,0);return e.length-n.length-r.length==2*i},Ee.checkStrictDER=function(e,t,i,n,r){var o=Ee;if(void 0===i){if("string"!=typeof e)throw new Error("not hex string");if(e=e.toLowerCase(),!a.lang.String.isHex(e))throw new Error("not hex string");i=e.length,r=(n=e.length/2)<128?1:Math.ceil(n.toString(16))+1}if(o.getL(e,t).length>2*r)throw new Error("L of TLV too long: idx="+t);var s=o.getVblen(e,t);if(s>n)throw new Error("value of L too long than hex: idx="+t);var l=o.getTLV(e,t),u=l.length-2-o.getL(e,t).length;if(u!==2*s)throw new Error("V string length and L's value not the same:"+u+"/"+2*s);if(0===t&&e.length!=l.length)throw new Error("total length and TLV length unmatch:"+e.length+"!="+l.length);var c=e.substr(t,2);if("02"===c){var h=o.getVidx(e,t);if("00"==e.substr(h,2)&&e.charCodeAt(h+2)<56)throw new Error("not least zeros for DER INTEGER")}if(32&parseInt(c,16)){for(var d=o.getVblen(e,t),p=0,f=o.getChildIdx(e,t),A=0;A<f.length;A++){p+=o.getTLV(e,f[A]).length,o.checkStrictDER(e,f[A],i,n,r)}if(2*d!=p)throw new Error("sum of children's TLV length and L unmatch: "+2*d+"!="+p)}},Ee.oidname=function(e){var t=a.asn1;a.lang.String.isHex(e)&&(e=t.ASN1Util.oidHexToInt(e));var i=t.x509.OID.oid2name(e);return""===i&&(i=e),i},void 0!==a.asn1&&a.asn1||(a.asn1={}),void 0!==a.asn1.x509&&a.asn1.x509||(a.asn1.x509={}),a.asn1.x509.Certificate=function(e){a.asn1.x509.Certificate.superclass.constructor.call(this);var t=a.asn1,i=t.DERBitString,n=t.DERSequence,r=t.x509,o=r.TBSCertificate,s=r.AlgorithmIdentifier;this.params=void 0,this.setByParam=function(e){this.params=e},this.sign=function(){var e=this.params,t=e.sigalg;null!=e.sigalg.name&&(t=e.sigalg.name);var i=e.tbsobj.getEncodedHex(),n=new a.crypto.Signature({alg:t});n.init(e.cakey),n.updateHex(i),e.sighex=n.sign()},this.getPEM=function(){return se(this.getEncodedHex(),"CERTIFICATE")},this.getEncodedHex=function(){var e=this.params;if(null!=e.tbsobj&&null!=e.tbsobj||(e.tbsobj=new o(e)),null==e.sighex&&null!=e.cakey&&this.sign(),null==e.sighex)throw new Error("sighex or cakey parameter not defined");var t=[];return t.push(e.tbsobj),t.push(new s({name:e.sigalg})),t.push(new i({hex:"00"+e.sighex})),new n({array:t}).getEncodedHex()},null!=e&&(this.params=e)},pe(a.asn1.x509.Certificate,a.asn1.ASN1Object),a.asn1.x509.TBSCertificate=function(e){a.asn1.x509.TBSCertificate.superclass.constructor.call(this);var t=a.asn1,i=t.x509,n=t.DERTaggedObject,r=t.DERInteger,o=t.DERSequence,s=i.AlgorithmIdentifier,l=i.Time,u=i.X500Name,c=i.Extensions,h=i.SubjectPublicKeyInfo;this.params=null,this.setByParam=function(e){this.params=e},this.getEncodedHex=function(){var e=[],t=this.params;if(null!=t.version||1!=t.version){var i=2;null!=t.version&&(i=t.version-1);var d=new n({obj:new r({int:i})});e.push(d)}return e.push(new r(t.serial)),e.push(new s({name:t.sigalg})),e.push(new u(t.issuer)),e.push(new o({array:[new l(t.notbefore),new l(t.notafter)]})),e.push(new u(t.subject)),e.push(new h(we.getKey(t.sbjpubkey))),void 0!==t.ext&&t.ext.length>0&&e.push(new n({tag:"a3",obj:new c(t.ext)})),new a.asn1.DERSequence({array:e}).getEncodedHex()},void 0!==e&&this.setByParam(e)},pe(a.asn1.x509.TBSCertificate,a.asn1.ASN1Object),a.asn1.x509.Extensions=function(e){a.asn1.x509.Extensions.superclass.constructor.call(this);var t=a.asn1,i=t.DERSequence,n=t.x509;this.aParam=[],this.setByParam=function(e){this.aParam=e},this.getEncodedHex=function(){for(var e=[],t=0;t<this.aParam.length;t++){var r=this.aParam[t],o=r.extname,s=null;if(null!=r.extn)s=new n.PrivateExtension(r);else if("subjectKeyIdentifier"==o)s=new n.SubjectKeyIdentifier(r);else if("keyUsage"==o)s=new n.KeyUsage(r);else if("subjectAltName"==o)s=new n.SubjectAltName(r);else if("issuerAltName"==o)s=new n.IssuerAltName(r);else if("basicConstraints"==o)s=new n.BasicConstraints(r);else if("cRLDistributionPoints"==o)s=new n.CRLDistributionPoints(r);else if("certificatePolicies"==o)s=new n.CertificatePolicies(r);else if("authorityKeyIdentifier"==o)s=new n.AuthorityKeyIdentifier(r);else if("extKeyUsage"==o)s=new n.ExtKeyUsage(r);else if("authorityInfoAccess"==o)s=new n.AuthorityInfoAccess(r);else if("cRLNumber"==o)s=new n.CRLNumber(r);else if("cRLReason"==o)s=new n.CRLReason(r);else if("ocspNonce"==o)s=new n.OCSPNonce(r);else if("ocspNoCheck"==o)s=new n.OCSPNoCheck(r);else if("adobeTimeStamp"==o)s=new n.AdobeTimeStamp(r);else{if("subjectDirectoryAttributes"!=o)throw new Error("extension not supported:"+JSON.stringify(r));s=new n.SubjectDirectoryAttributes(r)}null!=s&&e.push(s)}return new i({array:e}).getEncodedHex()},null!=e&&this.setByParam(e)},pe(a.asn1.x509.Extensions,a.asn1.ASN1Object),a.asn1.x509.Extension=function(e){a.asn1.x509.Extension.superclass.constructor.call(this);var t=a.asn1,i=t.DERObjectIdentifier,n=t.DEROctetString;t.DERBitString;var r=t.DERBoolean,o=t.DERSequence;this.getEncodedHex=function(){var e=new i({oid:this.oid}),t=new n({hex:this.getExtnValueHex()}),s=new Array;return s.push(e),this.critical&&s.push(new r),s.push(t),new o({array:s}).getEncodedHex()},this.critical=!1,void 0!==e&&void 0!==e.critical&&(this.critical=e.critical)},pe(a.asn1.x509.Extension,a.asn1.ASN1Object),a.asn1.x509.KeyUsage=function(e){a.asn1.x509.KeyUsage.superclass.constructor.call(this,e);var t=Ie.KEYUSAGE_NAME;if(this.getExtnValueHex=function(){return this.asn1ExtnValue.getEncodedHex()},this.oid="2.5.29.15",void 0!==e&&(void 0!==e.bin&&(this.asn1ExtnValue=new a.asn1.DERBitString(e)),void 0!==e.names&&void 0!==e.names.length)){for(var i=e.names,n="000000000",r=0;r<i.length;r++)for(var o=0;o<t.length;o++)i[r]===t[o]&&(n=n.substring(0,o)+"1"+n.substring(o+1,n.length));this.asn1ExtnValue=new a.asn1.DERBitString({bin:n})}},pe(a.asn1.x509.KeyUsage,a.asn1.x509.Extension),a.asn1.x509.BasicConstraints=function(e){a.asn1.x509.BasicConstraints.superclass.constructor.call(this,e);var t=a.asn1,i=t.DERBoolean,n=t.DERInteger,r=t.DERSequence;this.getExtnValueHex=function(){var e=new Array;this.cA&&e.push(new i),this.pathLen>-1&&e.push(new n({int:this.pathLen}));var t=new r({array:e});return this.asn1ExtnValue=t,this.asn1ExtnValue.getEncodedHex()},this.oid="2.5.29.19",this.cA=!1,this.pathLen=-1,void 0!==e&&(void 0!==e.cA&&(this.cA=e.cA),void 0!==e.pathLen&&(this.pathLen=e.pathLen))},pe(a.asn1.x509.BasicConstraints,a.asn1.x509.Extension),a.asn1.x509.CRLDistributionPoints=function(e){a.asn1.x509.CRLDistributionPoints.superclass.constructor.call(this,e);var t=a.asn1,i=t.x509;this.getExtnValueHex=function(){return this.asn1ExtnValue.getEncodedHex()},this.setByDPArray=function(e){for(var n=[],r=0;r<e.length;r++)if(e[r]instanceof a.asn1.ASN1Object)n.push(e[r]);else{var o=new i.DistributionPoint(e[r]);n.push(o)}this.asn1ExtnValue=new t.DERSequence({array:n})},this.setByOneURI=function(e){var t=new i.DistributionPoint({fulluri:e});this.setByDPArray([t])},this.oid="2.5.29.31",void 0!==e&&(void 0!==e.array?this.setByDPArray(e.array):void 0!==e.uri&&this.setByOneURI(e.uri))},pe(a.asn1.x509.CRLDistributionPoints,a.asn1.x509.Extension),a.asn1.x509.DistributionPoint=function(e){a.asn1.x509.DistributionPoint.superclass.constructor.call(this);var t=a.asn1,i=t.x509.DistributionPointName;this.getEncodedHex=function(){var e=new t.DERSequence;if(null!=this.asn1DP){var i=new t.DERTaggedObject({explicit:!0,tag:"a0",obj:this.asn1DP});e.appendASN1Object(i)}return this.hTLV=e.getEncodedHex(),this.hTLV},void 0!==e&&(void 0!==e.dpobj?this.asn1DP=e.dpobj:void 0!==e.dpname?this.asn1DP=new i(e.dpname):void 0!==e.fulluri&&(this.asn1DP=new i({full:[{uri:e.fulluri}]})))},pe(a.asn1.x509.DistributionPoint,a.asn1.ASN1Object),a.asn1.x509.DistributionPointName=function(e){a.asn1.x509.DistributionPointName.superclass.constructor.call(this);var t=a.asn1,i=t.DERTaggedObject;if(this.getEncodedHex=function(){if("full"!=this.type)throw new Error("currently type shall be 'full': "+this.type);return this.asn1Obj=new i({explicit:!1,tag:this.tag,obj:this.asn1V}),this.hTLV=this.asn1Obj.getEncodedHex(),this.hTLV},void 0!==e)if(t.x509.GeneralNames.prototype.isPrototypeOf(e))this.type="full",this.tag="a0",this.asn1V=e;else{if(void 0===e.full)throw new Error("This class supports GeneralNames only as argument");this.type="full",this.tag="a0",this.asn1V=new t.x509.GeneralNames(e.full)}},pe(a.asn1.x509.DistributionPointName,a.asn1.ASN1Object),a.asn1.x509.CertificatePolicies=function(e){a.asn1.x509.CertificatePolicies.superclass.constructor.call(this,e);var t=a.asn1,i=t.x509,n=t.DERSequence,r=i.PolicyInformation;this.params=null,this.getExtnValueHex=function(){for(var e=[],t=0;t<this.params.array.length;t++)e.push(new r(this.params.array[t]));var i=new n({array:e});return this.asn1ExtnValue=i,this.asn1ExtnValue.getEncodedHex()},this.oid="2.5.29.32",void 0!==e&&(this.params=e)},pe(a.asn1.x509.CertificatePolicies,a.asn1.x509.Extension),a.asn1.x509.PolicyInformation=function(e){a.asn1.x509.PolicyInformation.superclass.constructor.call(this,e);var t=a.asn1,i=t.DERSequence,n=t.DERObjectIdentifier,r=t.x509.PolicyQualifierInfo;this.params=null,this.getEncodedHex=function(){if(void 0===this.params.policyoid&&void 0===this.params.array)throw new Error("parameter oid and array missing");var e=[new n(this.params.policyoid)];if(void 0!==this.params.array){for(var t=[],o=0;o<this.params.array.length;o++)t.push(new r(this.params.array[o]));t.length>0&&e.push(new i({array:t}))}return new i({array:e}).getEncodedHex()},void 0!==e&&(this.params=e)},pe(a.asn1.x509.PolicyInformation,a.asn1.ASN1Object),a.asn1.x509.PolicyQualifierInfo=function(e){a.asn1.x509.PolicyQualifierInfo.superclass.constructor.call(this,e);var t=a.asn1,i=t.DERSequence,n=t.DERIA5String,r=t.DERObjectIdentifier,o=t.x509.UserNotice;this.params=null,this.getEncodedHex=function(){return void 0!==this.params.cps?new i({array:[new r({oid:"1.3.6.1.5.5.7.2.1"}),new n({str:this.params.cps})]}).getEncodedHex():null!=this.params.unotice?new i({array:[new r({oid:"1.3.6.1.5.5.7.2.2"}),new o(this.params.unotice)]}).getEncodedHex():void 0},void 0!==e&&(this.params=e)},pe(a.asn1.x509.PolicyQualifierInfo,a.asn1.ASN1Object),a.asn1.x509.UserNotice=function(e){a.asn1.x509.UserNotice.superclass.constructor.call(this,e);var t=a.asn1.DERSequence;a.asn1.DERInteger;var i=a.asn1.x509.DisplayText,n=a.asn1.x509.NoticeReference;this.params=null,this.getEncodedHex=function(){var e=[];return void 0!==this.params.noticeref&&e.push(new n(this.params.noticeref)),void 0!==this.params.exptext&&e.push(new i(this.params.exptext)),new t({array:e}).getEncodedHex()},void 0!==e&&(this.params=e)},pe(a.asn1.x509.UserNotice,a.asn1.ASN1Object),a.asn1.x509.NoticeReference=function(e){a.asn1.x509.NoticeReference.superclass.constructor.call(this,e);var t=a.asn1.DERSequence,i=a.asn1.DERInteger,n=a.asn1.x509.DisplayText;this.params=null,this.getEncodedHex=function(){var e=[];if(void 0!==this.params.org&&e.push(new n(this.params.org)),void 0!==this.params.noticenum){for(var r=[],o=this.params.noticenum,s=0;s<o.length;s++)r.push(new i(o[s]));e.push(new t({array:r}))}if(0==e.length)throw new Error("parameter is empty");return new t({array:e}).getEncodedHex()},void 0!==e&&(this.params=e)},pe(a.asn1.x509.NoticeReference,a.asn1.ASN1Object),a.asn1.x509.DisplayText=function(e){a.asn1.x509.DisplayText.superclass.constructor.call(this,e),this.hT="0c",void 0!==e&&("ia5"===e.type?this.hT="16":"vis"===e.type?this.hT="1a":"bmp"===e.type&&(this.hT="1e"))},pe(a.asn1.x509.DisplayText,a.asn1.DERAbstractString),a.asn1.x509.ExtKeyUsage=function(e){a.asn1.x509.ExtKeyUsage.superclass.constructor.call(this,e);var t=a.asn1;this.setPurposeArray=function(e){this.asn1ExtnValue=new t.DERSequence;for(var i=0;i<e.length;i++){var n=new t.DERObjectIdentifier(e[i]);this.asn1ExtnValue.appendASN1Object(n)}},this.getExtnValueHex=function(){return this.asn1ExtnValue.getEncodedHex()},this.oid="2.5.29.37",void 0!==e&&void 0!==e.array&&this.setPurposeArray(e.array)},pe(a.asn1.x509.ExtKeyUsage,a.asn1.x509.Extension),a.asn1.x509.AuthorityKeyIdentifier=function(e){a.asn1.x509.AuthorityKeyIdentifier.superclass.constructor.call(this,e);var t=a,i=t.asn1,n=i.DERTaggedObject,r=i.x509.GeneralNames;t.crypto.Util.isKey,this.asn1KID=null,this.asn1CertIssuer=null,this.asn1CertSN=null,this.getExtnValueHex=function(){var e=new Array;this.asn1KID&&e.push(new n({explicit:!1,tag:"80",obj:this.asn1KID})),this.asn1CertIssuer&&e.push(new n({explicit:!1,tag:"a1",obj:new r([{dn:this.asn1CertIssuer}])})),this.asn1CertSN&&e.push(new n({explicit:!1,tag:"82",obj:this.asn1CertSN}));var t=new i.DERSequence({array:e});return this.asn1ExtnValue=t,this.asn1ExtnValue.getEncodedHex()},this.setKIDByParam=function(e){if(void 0!==e.str||void 0!==e.hex)this.asn1KID=new a.asn1.DEROctetString(e);else if("object"==typeof e&&a.crypto.Util.isKey(e)||"string"==typeof e&&-1!=e.indexOf("BEGIN ")){var t=e;"string"==typeof e&&(t=we.getKey(e));var i=we.getKeyID(t);this.asn1KID=new a.asn1.DEROctetString({hex:i})}},this.setCertIssuerByParam=function(e){void 0!==e.str||void 0!==e.ldapstr||void 0!==e.hex||void 0!==e.certsubject||void 0!==e.certissuer?this.asn1CertIssuer=new a.asn1.x509.X500Name(e):"string"==typeof e&&-1!=e.indexOf("BEGIN ")&&-1!=e.indexOf("CERTIFICATE")&&(this.asn1CertIssuer=new a.asn1.x509.X500Name({certissuer:e}))},this.setCertSNByParam=function(e){if(void 0!==e.str||void 0!==e.bigint||void 0!==e.hex)this.asn1CertSN=new a.asn1.DERInteger(e);else if("string"==typeof e&&-1!=e.indexOf("BEGIN ")&&e.indexOf("CERTIFICATE")){var t=new Ie;t.readCertPEM(e);var i=t.getSerialNumberHex();this.asn1CertSN=new a.asn1.DERInteger({hex:i})}},this.oid="2.5.29.35",void 0!==e&&(void 0!==e.kid&&this.setKIDByParam(e.kid),void 0!==e.issuer&&this.setCertIssuerByParam(e.issuer),void 0!==e.sn&&this.setCertSNByParam(e.sn),void 0!==e.issuersn&&"string"==typeof e.issuersn&&-1!=e.issuersn.indexOf("BEGIN ")&&e.issuersn.indexOf("CERTIFICATE")&&(this.setCertSNByParam(e.issuersn),this.setCertIssuerByParam(e.issuersn)))},pe(a.asn1.x509.AuthorityKeyIdentifier,a.asn1.x509.Extension),a.asn1.x509.SubjectKeyIdentifier=function(e){a.asn1.x509.SubjectKeyIdentifier.superclass.constructor.call(this,e);var t=a.asn1.DEROctetString;this.asn1KID=null,this.getExtnValueHex=function(){return this.asn1ExtnValue=this.asn1KID,this.asn1ExtnValue.getEncodedHex()},this.setKIDByParam=function(e){if(void 0!==e.str||void 0!==e.hex)this.asn1KID=new t(e);else if("object"==typeof e&&a.crypto.Util.isKey(e)||"string"==typeof e&&-1!=e.indexOf("BEGIN")){var i=e;"string"==typeof e&&(i=we.getKey(e));var n=we.getKeyID(i);this.asn1KID=new a.asn1.DEROctetString({hex:n})}},this.oid="2.5.29.14",void 0!==e&&void 0!==e.kid&&this.setKIDByParam(e.kid)},pe(a.asn1.x509.SubjectKeyIdentifier,a.asn1.x509.Extension),a.asn1.x509.AuthorityInfoAccess=function(e){a.asn1.x509.AuthorityInfoAccess.superclass.constructor.call(this,e),this.setAccessDescriptionArray=function(e){for(var t=new Array,i=a.asn1,n=i.DERSequence,r=i.DERObjectIdentifier,o=i.x509.GeneralName,s=0;s<e.length;s++){var l,u=e[s];if(void 0!==u.ocsp)l=new n({array:[new r({oid:"1.3.6.1.5.5.7.48.1"}),new o({uri:u.ocsp})]});else{if(void 0===u.caissuer)throw new Error("unknown AccessMethod parameter: "+JSON.stringify(u));l=new n({array:[new r({oid:"1.3.6.1.5.5.7.48.2"}),new o({uri:u.caissuer})]})}t.push(l)}this.asn1ExtnValue=new n({array:t})},this.getExtnValueHex=function(){return this.asn1ExtnValue.getEncodedHex()},this.oid="1.3.6.1.5.5.7.1.1",void 0!==e&&void 0!==e.array&&this.setAccessDescriptionArray(e.array)},pe(a.asn1.x509.AuthorityInfoAccess,a.asn1.x509.Extension),a.asn1.x509.SubjectAltName=function(e){a.asn1.x509.SubjectAltName.superclass.constructor.call(this,e),this.setNameArray=function(e){this.asn1ExtnValue=new a.asn1.x509.GeneralNames(e)},this.getExtnValueHex=function(){return this.asn1ExtnValue.getEncodedHex()},this.oid="2.5.29.17",void 0!==e&&void 0!==e.array&&this.setNameArray(e.array)},pe(a.asn1.x509.SubjectAltName,a.asn1.x509.Extension),a.asn1.x509.IssuerAltName=function(e){a.asn1.x509.IssuerAltName.superclass.constructor.call(this,e),this.setNameArray=function(e){this.asn1ExtnValue=new a.asn1.x509.GeneralNames(e)},this.getExtnValueHex=function(){return this.asn1ExtnValue.getEncodedHex()},this.oid="2.5.29.18",void 0!==e&&void 0!==e.array&&this.setNameArray(e.array)},pe(a.asn1.x509.IssuerAltName,a.asn1.x509.Extension),a.asn1.x509.SubjectDirectoryAttributes=function(e){a.asn1.x509.SubjectDirectoryAttributes.superclass.constructor.call(this,e);var t=a.asn1,i=t.DERSequence,n=t.ASN1Util.newObject,r=t.x509.OID.name2oid;this.params=null,this.getExtnValueHex=function(){for(var e=[],t=0;t<this.params.array.length;t++){var o=this.params.array[t],s={seq:[{oid:"1.2.3.4"},{set:[{utf8str:"DE"}]}]};if("dateOfBirth"==o.attr)s.seq[0].oid=r(o.attr),s.seq[1].set[0]={gentime:o.str};else if("placeOfBirth"==o.attr)s.seq[0].oid=r(o.attr),s.seq[1].set[0]={utf8str:o.str};else if("gender"==o.attr)s.seq[0].oid=r(o.attr),s.seq[1].set[0]={prnstr:o.str};else if("countryOfCitizenship"==o.attr)s.seq[0].oid=r(o.attr),s.seq[1].set[0]={prnstr:o.str};else{if("countryOfResidence"!=o.attr)throw new Error("unsupported attribute: "+o.attr);s.seq[0].oid=r(o.attr),s.seq[1].set[0]={prnstr:o.str}}e.push(new n(s))}var a=new i({array:e});return this.asn1ExtnValue=a,this.asn1ExtnValue.getEncodedHex()},this.oid="2.5.29.9",void 0!==e&&(this.params=e)},pe(a.asn1.x509.SubjectDirectoryAttributes,a.asn1.x509.Extension),a.asn1.x509.PrivateExtension=function(e){a.asn1.x509.PrivateExtension.superclass.constructor.call(this,e);var t=a,i=t.lang.String.isHex,n=t.asn1,r=n.x509.OID.name2oid,o=n.ASN1Util.newObject;this.params=null,this.setByParam=function(e){this.oid=r(e.extname),this.params=e},this.getExtnValueHex=function(){if(null==this.params.extname||null==this.params.extn)throw new Error("extname or extnhex not specified");var e=this.params.extn;if("string"==typeof e&&i(e))return e;if("object"==typeof e)try{return o(e).getEncodedHex()}catch(e){}throw new Error("unsupported extn value")},null!=e&&this.setByParam(e)},pe(a.asn1.x509.PrivateExtension,a.asn1.x509.Extension),a.asn1.x509.CRL=function(e){a.asn1.x509.CRL.superclass.constructor.call(this);var t=a.asn1,i=t.DERSequence,n=t.DERBitString,r=t.x509,o=r.AlgorithmIdentifier,s=r.TBSCertList;this.params=void 0,this.setByParam=function(e){this.params=e},this.sign=function(){var e=new s(this.params).getEncodedHex(),t=new a.crypto.Signature({alg:this.params.sigalg});t.init(this.params.cakey),t.updateHex(e);var i=t.sign();this.params.sighex=i},this.getPEM=function(){return se(this.getEncodedHex(),"X509 CRL")},this.getEncodedHex=function(){var e=this.params;if(null==e.tbsobj&&(e.tbsobj=new s(e)),null==e.sighex&&null!=e.cakey&&this.sign(),null==e.sighex)throw new Error("sighex or cakey parameter not defined");var t=[];return t.push(e.tbsobj),t.push(new o({name:e.sigalg})),t.push(new n({hex:"00"+e.sighex})),new i({array:t}).getEncodedHex()},null!=e&&(this.params=e)},pe(a.asn1.x509.CRL,a.asn1.ASN1Object),a.asn1.x509.TBSCertList=function(e){a.asn1.x509.TBSCertList.superclass.constructor.call(this);var t=a.asn1,i=t.DERInteger,n=t.DERSequence,r=t.DERTaggedObject;t.DERObjectIdentifier;var o=t.x509,s=o.AlgorithmIdentifier,l=o.Time,u=o.Extensions,c=o.X500Name;this.params=null,this.setByParam=function(e){this.params=e},this.getRevCertSequence=function(){for(var e=[],t=this.params.revcert,r=0;r<t.length;r++){var o=[new i(t[r].sn),new l(t[r].date)];null!=t[r].ext&&o.push(new u(t[r].ext)),e.push(new n({array:o}))}return new n({array:e})},this.getEncodedHex=function(){var e=[],t=this.params;if(null!=t.version){var o=t.version-1,a=new i({int:o});e.push(a)}if(e.push(new s({name:t.sigalg})),e.push(new c(t.issuer)),e.push(new l(t.thisupdate)),null!=t.nextupdate&&e.push(new l(t.nextupdate)),null!=t.revcert&&e.push(this.getRevCertSequence()),null!=t.ext){var h=new u(t.ext);e.push(new r({tag:"a0",explicit:!0,obj:h}))}return new n({array:e}).getEncodedHex()},void 0!==e&&this.setByParam(e)},pe(a.asn1.x509.TBSCertList,a.asn1.ASN1Object),a.asn1.x509.CRLEntry=function(e){a.asn1.x509.CRLEntry.superclass.constructor.call(this);var t=a.asn1;this.setCertSerial=function(e){this.sn=new t.DERInteger(e)},this.setRevocationDate=function(e){this.time=new t.x509.Time(e)},this.getEncodedHex=function(){var e=new t.DERSequence({array:[this.sn,this.time]});return this.TLV=e.getEncodedHex(),this.TLV},void 0!==e&&(void 0!==e.time&&this.setRevocationDate(e.time),void 0!==e.sn&&this.setCertSerial(e.sn))},pe(a.asn1.x509.CRLEntry,a.asn1.ASN1Object),a.asn1.x509.CRLNumber=function(e){a.asn1.x509.CRLNumber.superclass.constructor.call(this,e),this.params=void 0,this.getExtnValueHex=function(){return this.asn1ExtnValue=new a.asn1.DERInteger(this.params.num),this.asn1ExtnValue.getEncodedHex()},this.oid="2.5.29.20",null!=e&&(this.params=e)},pe(a.asn1.x509.CRLNumber,a.asn1.x509.Extension),a.asn1.x509.CRLReason=function(e){a.asn1.x509.CRLReason.superclass.constructor.call(this,e),this.params=void 0,this.getExtnValueHex=function(){return this.asn1ExtnValue=new a.asn1.DEREnumerated(this.params.code),this.asn1ExtnValue.getEncodedHex()},this.oid="2.5.29.21",null!=e&&(this.params=e)},pe(a.asn1.x509.CRLReason,a.asn1.x509.Extension),a.asn1.x509.OCSPNonce=function(e){a.asn1.x509.OCSPNonce.superclass.constructor.call(this,e),this.params=void 0,this.getExtnValueHex=function(){return this.asn1ExtnValue=new a.asn1.DEROctetString(this.params),this.asn1ExtnValue.getEncodedHex()},this.oid="1.3.6.1.5.5.7.48.1.2",null!=e&&(this.params=e)},pe(a.asn1.x509.OCSPNonce,a.asn1.x509.Extension),a.asn1.x509.OCSPNoCheck=function(e){a.asn1.x509.OCSPNoCheck.superclass.constructor.call(this,e),this.params=void 0,this.getExtnValueHex=function(){return this.asn1ExtnValue=new a.asn1.DERNull,this.asn1ExtnValue.getEncodedHex()},this.oid="1.3.6.1.5.5.7.48.1.5",null!=e&&(this.params=e)},pe(a.asn1.x509.OCSPNoCheck,a.asn1.x509.Extension),a.asn1.x509.AdobeTimeStamp=function(e){a.asn1.x509.AdobeTimeStamp.superclass.constructor.call(this,e);var t=a.asn1,i=t.DERInteger,n=t.DERBoolean,r=t.DERSequence,o=t.x509.GeneralName;this.params=null,this.getExtnValueHex=function(){var e=this.params,t=[new i(1)];return t.push(new o({uri:e.uri})),null!=e.reqauth&&t.push(new n(e.reqauth)),this.asn1ExtnValue=new r({array:t}),this.asn1ExtnValue.getEncodedHex()},this.oid="1.2.840.113583.1.1.9.1",void 0!==e&&this.setByParam(e)},pe(a.asn1.x509.AdobeTimeStamp,a.asn1.x509.Extension),a.asn1.x509.X500Name=function(e){a.asn1.x509.X500Name.superclass.constructor.call(this),this.asn1Array=[],this.paramArray=[],this.sRule="utf8";var t=a.asn1,i=t.x509,n=i.RDN;this.setByString=function(e,t){void 0!==t&&(this.sRule=t);var i=e.split("/");i.shift();for(var r=[],o=0;o<i.length;o++)if(i[o].match(/^[^=]+=.+$/))r.push(i[o]);else{var s=r.length-1;r[s]=r[s]+"/"+i[o]}for(o=0;o<r.length;o++)this.asn1Array.push(new n({str:r[o],rule:this.sRule}))},this.setByLdapString=function(e,t){void 0!==t&&(this.sRule=t);var n=i.X500Name.ldapToCompat(e);this.setByString(n,t)},this.setByObject=function(e,t){for(var i in void 0!==t&&(this.sRule=t),e)if(e.hasOwnProperty(i)){var r=new n({str:i+"="+e[i],rule:this.sRule});this.asn1Array?this.asn1Array.push(r):this.asn1Array=[r]}},this.setByParam=function(e){var t;(void 0!==e.rule&&(this.sRule=e.rule),void 0!==e.array)?this.paramArray=e.array:void 0!==e.str?this.setByString(e.str):void 0!==e.ldapstr?this.setByLdapString(e.ldapstr):void 0!==e.hex?this.hTLV=e.hex:void 0!==e.certissuer?((t=new Ie).readCertPEM(e.certissuer),this.hTLV=t.getIssuerHex()):void 0!==e.certsubject?((t=new Ie).readCertPEM(e.certsubject),this.hTLV=t.getSubjectHex()):"object"==typeof e&&void 0===e.certsubject&&void 0===e.certissuer&&this.setByObject(e)},this.getEncodedHex=function(){if("string"==typeof this.hTLV)return this.hTLV;if(0==this.asn1Array.length&&this.paramArray.length>0)for(var e=0;e<this.paramArray.length;e++){var i={array:this.paramArray[e]};"utf8"!=this.sRule&&(i.rule=this.sRule);var r=new n(i);this.asn1Array.push(r)}var o=new t.DERSequence({array:this.asn1Array});return this.hTLV=o.getEncodedHex(),this.hTLV},void 0!==e&&this.setByParam(e)},pe(a.asn1.x509.X500Name,a.asn1.ASN1Object),a.asn1.x509.X500Name.compatToLDAP=function(e){if("/"!==e.substr(0,1))throw"malformed input";var t=(e=e.substr(1)).split("/");return t.reverse(),(t=t.map((function(e){return e.replace(/,/,"\\,")}))).join(",")},a.asn1.x509.X500Name.onelineToLDAP=function(e){return a.asn1.x509.X500Name.compatToLDAP(e)},a.asn1.x509.X500Name.ldapToCompat=function(e){for(var t=e.split(","),i=!1,n=[],r=0;t.length>0;r++){var o=t.shift();if(!0===i){var s=(n.pop()+","+o).replace(/\\,/g,",");n.push(s),i=!1}else n.push(o);"\\"===o.substr(-1,1)&&(i=!0)}return(n=n.map((function(e){return e.replace("/","\\/")}))).reverse(),"/"+n.join("/")},a.asn1.x509.X500Name.ldapToOneline=function(e){return a.asn1.x509.X500Name.ldapToCompat(e)},a.asn1.x509.RDN=function(e){a.asn1.x509.RDN.superclass.constructor.call(this),this.asn1Array=[],this.paramArray=[],this.sRule="utf8";var t=a.asn1.x509.AttributeTypeAndValue;this.setByParam=function(e){void 0!==e.rule&&(this.sRule=e.rule),void 0!==e.str&&this.addByMultiValuedString(e.str),void 0!==e.array&&(this.paramArray=e.array)},this.addByString=function(e){this.asn1Array.push(new a.asn1.x509.AttributeTypeAndValue({str:e,rule:this.sRule}))},this.addByMultiValuedString=function(e){for(var t=a.asn1.x509.RDN.parseString(e),i=0;i<t.length;i++)this.addByString(t[i])},this.getEncodedHex=function(){if(0==this.asn1Array.length&&this.paramArray.length>0)for(var e=0;e<this.paramArray.length;e++){var i=this.paramArray[e];void 0!==i.rule&&"utf8"!=this.sRule&&(i.rule=this.sRule);var n=new t(i);this.asn1Array.push(n)}var r=new a.asn1.DERSet({array:this.asn1Array});return this.TLV=r.getEncodedHex(),this.TLV},void 0!==e&&this.setByParam(e)},pe(a.asn1.x509.RDN,a.asn1.ASN1Object),a.asn1.x509.RDN.parseString=function(e){for(var t=e.split(/\+/),i=!1,n=[],r=0;t.length>0;r++){var o=t.shift();if(!0===i){var s=(n.pop()+"+"+o).replace(/\\\+/g,"+");n.push(s),i=!1}else n.push(o);"\\"===o.substr(-1,1)&&(i=!0)}var a=!1,l=[];for(r=0;n.length>0;r++){o=n.shift();if(!0===a){var u=l.pop();if(o.match(/"$/)){s=(u+"+"+o).replace(/^([^=]+)="(.*)"$/,"$1=$2");l.push(s),a=!1}else l.push(u+"+"+o)}else l.push(o);o.match(/^[^=]+="/)&&(a=!0)}return l},a.asn1.x509.AttributeTypeAndValue=function(e){a.asn1.x509.AttributeTypeAndValue.superclass.constructor.call(this),this.sRule="utf8",this.sType=null,this.sValue=null,this.dsType=null;var t=a,i=t.asn1,n=i.DERSequence,r=i.DERUTF8String,o=i.DERPrintableString,s=i.DERTeletexString,l=i.DERIA5String,u=i.DERVisibleString,c=i.DERBMPString,h=t.lang.String.isMail,d=t.lang.String.isPrintable;this.setByParam=function(e){if(void 0!==e.rule&&(this.sRule=e.rule),void 0!==e.ds&&(this.dsType=e.ds),void 0===e.value&&void 0!==e.str){var t=e.str.match(/^([^=]+)=(.+)$/);if(!t)throw new Error("malformed attrTypeAndValueStr: "+attrTypeAndValueStr);this.sType=t[1],this.sValue=t[2]}else this.sType=e.type,this.sValue=e.value},this.setByString=function(e,t){void 0!==t&&(this.sRule=t);var i=e.match(/^([^=]+)=(.+)$/);if(!i)throw new Error("malformed attrTypeAndValueStr: "+attrTypeAndValueStr);this.setByAttrTypeAndValueStr(i[1],i[2])},this._getDsType=function(){var e=this.sType,t=this.sValue,i=this.sRule;return"prn"===i?"CN"==e&&h(t)?"ia5":d(t)?"prn":"utf8":"utf8"===i?"CN"==e&&h(t)?"ia5":"C"==e?"prn":"utf8":"utf8"},this.setByAttrTypeAndValueStr=function(e,t,i){void 0!==i&&(this.sRule=i),this.sType=e,this.sValue=t},this.getValueObj=function(e,t){if("utf8"==e)return new r({str:t});if("prn"==e)return new o({str:t});if("tel"==e)return new s({str:t});if("ia5"==e)return new l({str:t});if("vis"==e)return new u({str:t});if("bmp"==e)return new c({str:t});throw new Error("unsupported directory string type: type="+e+" value="+t)},this.getEncodedHex=function(){null==this.dsType&&(this.dsType=this._getDsType());var e=a.asn1.x509.OID.atype2obj(this.sType),t=this.getValueObj(this.dsType,this.sValue),i=new n({array:[e,t]});return this.TLV=i.getEncodedHex(),this.TLV},void 0!==e&&this.setByParam(e)},pe(a.asn1.x509.AttributeTypeAndValue,a.asn1.ASN1Object),a.asn1.x509.SubjectPublicKeyInfo=function(e){a.asn1.x509.SubjectPublicKeyInfo.superclass.constructor.call(this);var t=a,i=t.asn1,n=i.DERInteger,r=i.DERBitString,o=i.DERObjectIdentifier,s=i.DERSequence,l=i.ASN1Util.newObject,u=i.x509.AlgorithmIdentifier,c=t.crypto;c.ECDSA,c.DSA,this.getASN1Object=function(){if(null==this.asn1AlgId||null==this.asn1SubjPKey)throw"algId and/or subjPubKey not set";return new s({array:[this.asn1AlgId,this.asn1SubjPKey]})},this.getEncodedHex=function(){var e=this.getASN1Object();return this.hTLV=e.getEncodedHex(),this.hTLV},this.setPubKey=function(e){try{if(e instanceof W){var t=l({seq:[{int:{bigint:e.n}},{int:{int:e.e}}]}).getEncodedHex();this.asn1AlgId=new u({name:"rsaEncryption"}),this.asn1SubjPKey=new r({hex:"00"+t})}}catch(e){}try{if(e instanceof a.crypto.ECDSA){var i=new o({name:e.curveName});this.asn1AlgId=new u({name:"ecPublicKey",asn1params:i}),this.asn1SubjPKey=new r({hex:"00"+e.pubKeyHex})}}catch(e){}try{if(e instanceof a.crypto.DSA){i=new l({seq:[{int:{bigint:e.p}},{int:{bigint:e.q}},{int:{bigint:e.g}}]});this.asn1AlgId=new u({name:"dsa",asn1params:i});var s=new n({bigint:e.y});this.asn1SubjPKey=new r({hex:"00"+s.getEncodedHex()})}}catch(e){}},void 0!==e&&this.setPubKey(e)},pe(a.asn1.x509.SubjectPublicKeyInfo,a.asn1.ASN1Object),a.asn1.x509.Time=function(e){a.asn1.x509.Time.superclass.constructor.call(this);var t=a.asn1,i=t.DERUTCTime,n=t.DERGeneralizedTime;this.setTimeParams=function(e){this.timeParams=e},this.getEncodedHex=function(){var e=null;return e=null!=this.timeParams?"utc"==this.type?new i(this.timeParams):new n(this.timeParams):"utc"==this.type?new i:new n,this.TLV=e.getEncodedHex(),this.TLV},this.type="utc",void 0!==e&&(void 0!==e.type?this.type=e.type:void 0!==e.str&&(e.str.match(/^[0-9]{12}Z$/)&&(this.type="utc"),e.str.match(/^[0-9]{14}Z$/)&&(this.type="gen")),this.timeParams=e)},pe(a.asn1.x509.Time,a.asn1.ASN1Object),a.asn1.x509.AlgorithmIdentifier=function(e){a.asn1.x509.AlgorithmIdentifier.superclass.constructor.call(this),this.nameAlg=null,this.asn1Alg=null,this.asn1Params=null,this.paramEmpty=!1;var t=a.asn1,i=t.x509.AlgorithmIdentifier.PSSNAME2ASN1TLV;if(this.getEncodedHex=function(){if(null===this.nameAlg&&null===this.asn1Alg)throw new Error("algorithm not specified");if(null!==this.nameAlg){var e=null;for(var n in i)n===this.nameAlg&&(e=i[n]);if(null!==e)return this.hTLV=e,this.hTLV}null!==this.nameAlg&&null===this.asn1Alg&&(this.asn1Alg=t.x509.OID.name2obj(this.nameAlg));var r=[this.asn1Alg];null!==this.asn1Params&&r.push(this.asn1Params);var o=new t.DERSequence({array:r});return this.hTLV=o.getEncodedHex(),this.hTLV},void 0!==e&&(void 0!==e.name&&(this.nameAlg=e.name),void 0!==e.asn1params&&(this.asn1Params=e.asn1params),void 0!==e.paramempty&&(this.paramEmpty=e.paramempty)),null===this.asn1Params&&!1===this.paramEmpty&&null!==this.nameAlg){void 0!==this.nameAlg.name&&(this.nameAlg=this.nameAlg.name);var n=this.nameAlg.toLowerCase();"withdsa"!==n.substr(-7,7)&&"withecdsa"!==n.substr(-9,9)&&(this.asn1Params=new t.DERNull)}},pe(a.asn1.x509.AlgorithmIdentifier,a.asn1.ASN1Object),a.asn1.x509.AlgorithmIdentifier.PSSNAME2ASN1TLV={SHAwithRSAandMGF1:"300d06092a864886f70d01010a3000",SHA256withRSAandMGF1:"303d06092a864886f70d01010a3030a00d300b0609608648016503040201a11a301806092a864886f70d010108300b0609608648016503040201a203020120",SHA384withRSAandMGF1:"303d06092a864886f70d01010a3030a00d300b0609608648016503040202a11a301806092a864886f70d010108300b0609608648016503040202a203020130",SHA512withRSAandMGF1:"303d06092a864886f70d01010a3030a00d300b0609608648016503040203a11a301806092a864886f70d010108300b0609608648016503040203a203020140"},a.asn1.x509.GeneralName=function(e){a.asn1.x509.GeneralName.superclass.constructor.call(this);var t={rfc822:"81",dns:"82",dn:"a4",uri:"86",ip:"87"},i=a.asn1;i.DERSequence;var n=i.DEROctetString,r=i.DERIA5String,o=i.DERTaggedObject,s=i.ASN1Object,l=i.x509.X500Name,u=ae;this.explicit=!1,this.setByParam=function(e){var i=null;if(void 0!==e){if(void 0!==e.rfc822&&(this.type="rfc822",i=new r({str:e[this.type]})),void 0!==e.dns&&(this.type="dns",i=new r({str:e[this.type]})),void 0!==e.uri&&(this.type="uri",i=new r({str:e[this.type]})),void 0!==e.dn&&(this.type="dn",this.explicit=!0,i="string"==typeof e.dn?new l({str:e.dn}):e.dn instanceof a.asn1.x509.X500Name?e.dn:new l(e.dn)),void 0!==e.ldapdn&&(this.type="dn",this.explicit=!0,i=new l({ldapstr:e.ldapdn})),void 0!==e.certissuer){this.type="dn",this.explicit=!0;var c=null;if((d=e.certissuer).match(/^[0-9A-Fa-f]+$/),-1!=d.indexOf("-----BEGIN ")&&(c=u(d)),null==c)throw"certissuer param not cert";(p=new Ie).hex=c;var h=p.getIssuerHex();(i=new s).hTLV=h}if(void 0!==e.certsubj){this.type="dn",this.explicit=!0;var d,p;c=null;if((d=e.certsubj).match(/^[0-9A-Fa-f]+$/),-1!=d.indexOf("-----BEGIN ")&&(c=u(d)),null==c)throw"certsubj param not cert";(p=new Ie).hex=c;h=p.getSubjectHex();(i=new s).hTLV=h}if(void 0!==e.ip){this.type="ip",this.explicit=!1;var f,A=e.ip,m="malformed IP address";if(A.match(/^[0-9.]+[.][0-9.]+$/)){if(f=function(e){e=(e=(e=e.replace(/^\s*\[\s*/,"")).replace(/\s*\]\s*$/,"")).replace(/\s*/g,"");try{return e.split(/,/).map((function(e,t,i){var n=parseInt(e);if(n<0||255<n)throw"integer not in range 0-255";return("00"+n.toString(16)).slice(-2)})).join("")}catch(e){throw"malformed integer array string: "+e}}("["+A.split(".").join(",")+"]"),8!==f.length)throw m}else if(A.match(/^[0-9A-Fa-f:]+:[0-9A-Fa-f:]+$/))f=function(e){var t="malformed IPv6 address";if(!e.match(/^[0-9A-Fa-f:]+$/))throw t;var i=(e=e.toLowerCase()).split(":").length-1;if(i<2)throw t;var n=":".repeat(7-i+2),r=(e=e.replace("::",n)).split(":");if(8!=r.length)throw t;for(var o=0;o<8;o++)r[o]=("0000"+r[o]).slice(-4);return r.join("")}(A);else{if(!A.match(/^([0-9A-Fa-f][0-9A-Fa-f]){1,}$/))throw m;f=A}i=new n({hex:f})}if(null==this.type)throw"unsupported type in params="+e;this.asn1Obj=new o({explicit:this.explicit,tag:t[this.type],obj:i})}},this.getEncodedHex=function(){return this.asn1Obj.getEncodedHex()},void 0!==e&&this.setByParam(e)},pe(a.asn1.x509.GeneralName,a.asn1.ASN1Object),a.asn1.x509.GeneralNames=function(e){a.asn1.x509.GeneralNames.superclass.constructor.call(this);var t=a.asn1;this.setByParamArray=function(e){for(var i=0;i<e.length;i++){var n=new t.x509.GeneralName(e[i]);this.asn1Array.push(n)}},this.getEncodedHex=function(){return new t.DERSequence({array:this.asn1Array}).getEncodedHex()},this.asn1Array=new Array,void 0!==e&&this.setByParamArray(e)},pe(a.asn1.x509.GeneralNames,a.asn1.ASN1Object),a.asn1.x509.OID=new function(e){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(e){if(void 0!==this.objCache[e])return this.objCache[e];if(void 0===this.name2oidList[e])throw"Name of ObjectIdentifier not defined: "+e;var t=this.name2oidList[e],i=new a.asn1.DERObjectIdentifier({oid:t});return this.objCache[e]=i,i},this.atype2obj=function(e){if(void 0!==this.objCache[e])return this.objCache[e];var t;if(e.match(/^\d+\.\d+\.[0-9.]+$/))t=e;else if(void 0!==this.atype2oidList[e])t=this.atype2oidList[e];else{if(void 0===this.name2oidList[e])throw"AttributeType name undefined: "+e;t=this.name2oidList[e]}var i=new a.asn1.DERObjectIdentifier({oid:t});return this.objCache[e]=i,i}},a.asn1.x509.OID.oid2name=function(e){var t=a.asn1.x509.OID.name2oidList;for(var i in t)if(t[i]==e)return i;return""},a.asn1.x509.OID.oid2atype=function(e){var t=a.asn1.x509.OID.atype2oidList;for(var i in t)if(t[i]==e)return i;return e},a.asn1.x509.OID.name2oid=function(e){if(e.match(/^[0-9.]+$/))return e;var t=a.asn1.x509.OID.name2oidList;return void 0===t[e]?"":t[e]},a.asn1.x509.X509Util={},a.asn1.x509.X509Util.newCertPEM=function(e){var t=a.asn1.x509;return t.TBSCertificate,new(0,t.Certificate)(e).getPEM()},W.getPosArrayOfChildrenFromHex=function(e){return Ee.getChildIdx(e,0)},W.getHexValueArrayOfChildrenFromHex=function(e){var t,i=Ee.getV,n=i(e,(t=W.getPosArrayOfChildrenFromHex(e))[0]),r=i(e,t[1]),o=i(e,t[2]),s=i(e,t[3]),a=i(e,t[4]),l=i(e,t[5]),u=i(e,t[6]),c=i(e,t[7]),h=i(e,t[8]);return(t=new Array).push(n,r,o,s,a,l,u,c,h),t},W.prototype.readPrivateKeyFromPEMString=function(e){var t=ae(e),i=W.getHexValueArrayOfChildrenFromHex(t);this.setPrivateEx(i[1],i[2],i[3],i[4],i[5],i[6],i[7],i[8])},W.prototype.readPKCS5PrvKeyHex=function(e){var t=W.getHexValueArrayOfChildrenFromHex(e);this.setPrivateEx(t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8])},W.prototype.readPKCS8PrvKeyHex=function(e){var t,i,n,r,o,s,a,l,u=Ee,c=u.getVbyListEx;if(!1===u.isASN1HEX(e))throw new Error("not ASN.1 hex string");try{t=c(e,0,[2,0,1],"02"),i=c(e,0,[2,0,2],"02"),n=c(e,0,[2,0,3],"02"),r=c(e,0,[2,0,4],"02"),o=c(e,0,[2,0,5],"02"),s=c(e,0,[2,0,6],"02"),a=c(e,0,[2,0,7],"02"),l=c(e,0,[2,0,8],"02")}catch(e){throw new Error("malformed PKCS#8 plain RSA private key")}this.setPrivateEx(t,i,n,r,o,s,a,l)},W.prototype.readPKCS5PubKeyHex=function(e){var t=Ee,i=t.getV;if(!1===t.isASN1HEX(e))throw new Error("keyHex is not ASN.1 hex string");var n=t.getChildIdx(e,0);if(2!==n.length||"02"!==e.substr(n[0],2)||"02"!==e.substr(n[1],2))throw new Error("wrong hex for PKCS#5 public key");var r=i(e,n[0]),o=i(e,n[1]);this.setPublic(r,o)},W.prototype.readPKCS8PubKeyHex=function(e){var t=Ee;if(!1===t.isASN1HEX(e))throw new Error("not ASN.1 hex string");if("06092a864886f70d010101"!==t.getTLVbyListEx(e,0,[0,0]))throw new Error("not PKCS8 RSA public key");var i=t.getTLVbyListEx(e,0,[1,0]);this.readPKCS5PubKeyHex(i)},W.prototype.readCertPubKeyHex=function(e,t){var i,n;(i=new Ie).readCertHex(e),n=i.getPublicKeyHex(),this.readPKCS8PubKeyHex(n)},W.prototype.sign=function(e,t){var i,n=(i=e,a.crypto.Util.hashString(i,t));return this.signWithMessageHash(n,t)},W.prototype.signWithMessageHash=function(e,t){var i=G(a.crypto.Util.getPaddedDigestInfoHex(e,t,this.n.bitLength()),16);return Me(this.doPrivate(i).toString(16),this.n.bitLength())},W.prototype.signPSS=function(e,t,i){var n,r=(n=re(e),a.crypto.Util.hashHex(n,t));return void 0===i&&(i=-1),this.signWithMessageHashPSS(r,t,i)},W.prototype.signWithMessageHashPSS=function(e,t,i){var n,r=ne(e),o=r.length,s=this.n.bitLength()-1,l=Math.ceil(s/8),u=function(e){return a.crypto.Util.hashHex(e,t)};if(-1===i||void 0===i)i=o;else if(-2===i)i=l-o-2;else if(i<-2)throw new Error("invalid salt length");if(l<o+i+2)throw new Error("data too long");var h="";i>0&&(h=new Array(i),(new K).nextBytes(h),h=String.fromCharCode.apply(String,h));var d=ne(u(re("\0\0\0\0\0\0\0\0"+r+h))),p=[];for(n=0;n<l-i-o-2;n+=1)p[n]=0;var f=String.fromCharCode.apply(String,p)+""+h,A=Se(d,f.length,u),m=[];for(n=0;n<f.length;n+=1)m[n]=f.charCodeAt(n)^A.charCodeAt(n);var g=65280>>8*l-s&255;for(m[0]&=~g,n=0;n<o;n++)m.push(d.charCodeAt(n));return m.push(188),Me(this.doPrivate(new c(m)).toString(16),this.n.bitLength())},W.prototype.verify=function(e,t){if(null==(t=t.toLowerCase()).match(/^[0-9a-f]+$/))return!1;var i=G(t,16),n=this.n.bitLength();if(i.bitLength()>n)return!1;var r=this.doPublic(i).toString(16);if(r.length+3!=n/4)return!1;var o=Ce(r.replace(/^1f+00/,""));if(0==o.length)return!1;var s,l=o[0];return o[1]==(s=e,a.crypto.Util.hashString(s,l))},W.prototype.verifyWithMessageHash=function(e,t){if(t.length!=Math.ceil(this.n.bitLength()/4))return!1;var i=G(t,16);if(i.bitLength()>this.n.bitLength())return 0;var n=Ce(this.doPublic(i).toString(16).replace(/^1f+00/,""));return 0!=n.length&&(n[0],n[1]==e)},W.prototype.verifyPSS=function(e,t,i,n){var r=function(e){return a.crypto.Util.hashHex(e,i)}(re(e));return void 0===n&&(n=-1),this.verifyWithMessageHashPSS(r,t,i,n)},W.prototype.verifyWithMessageHashPSS=function(e,t,i,n){if(t.length!=Math.ceil(this.n.bitLength()/4))return!1;var r,o=new c(t,16),s=function(e){return a.crypto.Util.hashHex(e,i)},l=ne(e),u=l.length,h=this.n.bitLength()-1,d=Math.ceil(h/8);if(-1===n||void 0===n)n=u;else if(-2===n)n=d-u-2;else if(n<-2)throw new Error("invalid salt length");if(d<u+n+2)throw new Error("data too long");var p=this.doPublic(o).toByteArray();for(r=0;r<p.length;r+=1)p[r]&=255;for(;p.length<d;)p.unshift(0);if(188!==p[d-1])throw new Error("encoded message does not end in 0xbc");var f=(p=String.fromCharCode.apply(String,p)).substr(0,d-u-1),A=p.substr(f.length,u),m=65280>>8*d-h&255;if(0!=(f.charCodeAt(0)&m))throw new Error("bits beyond keysize not zero");var g=Se(A,f.length,s),v=[];for(r=0;r<f.length;r+=1)v[r]=f.charCodeAt(r)^g.charCodeAt(r);v[0]&=~m;var y=d-u-n-2;for(r=0;r<y;r+=1)if(0!==v[r])throw new Error("leftmost octets not zero");if(1!==v[y])throw new Error("0x01 marker not found");return A===ne(s(re("\0\0\0\0\0\0\0\0"+l+String.fromCharCode.apply(String,v.slice(-n)))))},W.SALT_LEN_HLEN=-1,W.SALT_LEN_MAX=-2,W.SALT_LEN_RECOVER=-2,Ie.hex2dn=function(e,t){void 0===t&&(t=0);var i=new Ie;return Ee.getTLV(e,t),i.getX500Name(e).str},Ie.hex2rdn=function(e,t){if(void 0===t&&(t=0),"31"!==e.substr(t,2))throw new Error("malformed RDN");for(var i=new Array,n=Ee.getChildIdx(e,t),r=0;r<n.length;r++)i.push(Ie.hex2attrTypeValue(e,n[r]));return(i=i.map((function(e){return e.replace("+","\\+")}))).join("+")},Ie.hex2attrTypeValue=function(e,t){var i=Ee,n=i.getV;if(void 0===t&&(t=0),"30"!==e.substr(t,2))throw new Error("malformed attribute type and value");var r=i.getChildIdx(e,t);2!==r.length||e.substr(r[0],2);var o=n(e,r[0]),s=a.asn1.ASN1Util.oidHexToInt(o);return a.asn1.x509.OID.oid2atype(s)+"="+ne(n(e,r[1]))},Ie.getPublicKeyFromCertHex=function(e){var t=new Ie;return t.readCertHex(e),t.getPublicKey()},Ie.getPublicKeyFromCertPEM=function(e){var t=new Ie;return t.readCertPEM(e),t.getPublicKey()},Ie.getPublicKeyInfoPropOfCertPEM=function(e){var t,i,n=Ee.getVbyList,r={};return r.algparam=null,(t=new Ie).readCertPEM(e),i=t.getPublicKeyHex(),r.keyhex=n(i,0,[1],"03").substr(2),r.algoid=n(i,0,[0,0],"06"),"2a8648ce3d0201"===r.algoid&&(r.algparam=n(i,0,[0,1],"06")),r},Ie.KEYUSAGE_NAME=["digitalSignature","nonRepudiation","keyEncipherment","dataEncipherment","keyAgreement","keyCertSign","cRLSign","encipherOnly","decipherOnly"];var Te,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\b=OwT``fNJJ:::::R[Q-PR_aVSVPNaR:::::")),Te)];function Re(e,t){var i=e.getIssuerHex();if(i===e.getSubjectHex())return e.verifySignature(e.getPublicKey());var n=function(e,t){for(var i=0,n=t;i<n.length;i++){var r=n[i];if(r.getSubjectHex()===e)return r}}(i,t);return!!n&&(!1!==e.verifySignature(n.getPublicKey())&&Re(n,t))}function De(e){return e.getIssuerHex()!==e.getSubjectHex()&&Re(e,Pe)}!function(e){var t=new Ie;"string"==typeof e?t.readCertPEM(e):t.readCertHex(e.hex);var i=De(t);Pe.push(t)}(function(){var e=113,t=126,i=0,n="";return arguments[i].split(n).map((function(n){return n.charCodeAt(i)>t?n:String.fromCharCode((n.charCodeAt(i)+e)%t)})).join(n)}(":::::ORTV[-PR_aVSVPNaR:::::ZVVTU\tPPONrtNVONtVWNW=_SVw\tVE=ZN=TP`\0T`Vo@Q^ROPbNZVTSZ^P^fQc^^TRWQawR^ZNATN>bRPNU^zc}nzyg\tR^ZNATN>bROU^zc}nzyg\tR]ZN=TN>bRPtTn?bf?FZ_NQtfQc^^YQNq`gdSp?cyZ^P^fQc^^QQNWQ^aRvZPNTP`\0T`Vo@Q^RWN_fapzFqSFwfbOndSnzyuYz[oaNrS=\bZQNAZaN\\aZ\t[QSnS=\b[aNBZQZ\\aZ\t[QSnZVTaZ^P^fQc^^TRWQawR^ZNATN>bRPNU^zc}nzyg\tR^ZNATN>bROU^zc}nzyg\tRbZOVTN>bRPtYoTyuoz}}f`Bwo?=RQN\\Ot[cONZO>Wyfd\tgdbRaN]Ot[cONZZPRuupz_@feWyZ`bVfWX|gVup[N^xOSugnec|fdyndB{^T}fdB\0ndRf?FZVVPVwN[Otx\0uxvTF=ON^RSNN\\PNtENZVVPPtXPNtRN?=?]q[VD|{\\oyo`oOu}F\tSAe`tn[t\tu\b8^a]qx\bE_^ZN?[QC\0yuOpybY8r\\RPAS=8rUq\0E8>xean^e\bf]Y`XO}{C[Ur^?\0x[SRXvVQ\\CFr}QnAPRQF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q\t{\0DvAVBbnTqEE[QzDyqF`bF}R=Q?VeDo<Vzb\0w}D}NZ\0t}^?OyFP\bVaVNrTNYqe?[NRYTSQby@yzWvT`wQo}y]c_WgxBYCy\tRNRg@NZCaaq8?`\t^`?ryD\t=obzw?E]Ou]n@>bVzqAQT?@_zo@}CxWVTUsAYdNd?{APQr8{P]]AZ>aR\0[D<z?Tr@`u@X|YDwd_<p<>zWE>]\0=X`\b@uucp|^_Qb@uZouTX^o\0\\{PCq{ug8^f[YQAWad8FNqxFQE?ZOo\t}RnO\bsQc\txyccn=nxvs>bDBf\b\bW\\TuTnvAO^U\0QXC>xx8FxRFf<tJ:::::R[Q-PR_aVSVPNaR:::::"));var Le=function(e,t){return Le=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])},Le(e,t)};function ke(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function i(){this.constructor=e}Le(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}var Fe=function(){return Fe=Object.assign||function(e){for(var t,i=1,n=arguments.length;i<n;i++)for(var r in t=arguments[i])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},Fe.apply(this,arguments)};function Oe(e,t,i){if(i||2===arguments.length)for(var n,r=0,o=t.length;r<o;r++)!n&&r in t||(n||(n=Array.prototype.slice.call(t,0,r)),n[r]=t[r]);return e.concat(n||Array.prototype.slice.call(t))}var Ne,Ve=(Ne="$$FIVE_EVENT$$","undefined"==typeof Symbol?"$Symbol<".concat(Ne,">$"):Symbol(Ne));function Qe(e){return e[Ve]||(e[Ve]={}),e[Ve]}var He=function(){function e(){}return e.prototype.hasListener=function(e){var t=Qe(this);return t&&t[e]&&t[e].length>0},e.prototype.on=function(e,t,i){var n=this,r=Qe(this);return r[e]||(r[e]=[]),r[e].push([t,i||!1]),function(){return n.off(e,t)}},e.prototype.once=function(e,t){return this.on(e,t,!0)},e.prototype.off=function(e,t){if(void 0!==e){var i,n=Qe(this);if(n[e]||(n[e]=[]),void 0!==t){for(var r=0;r<n[e].length&&n[e][r][0]!==t;r++);r<n[e].length&&n[e].splice(r,1)}else n[e].length=0}else(i=this)[Ve]||delete i[Ve]},e.prototype.emit=function(e){for(var t=[],i=1;i<arguments.length;i++)t[i-1]=arguments[i];for(var n=!1,r=Qe(this),o=r[e]||[],s=0,a=o.slice();s<a.length;s++){var l=a[s],u=l[0],c=l[1],h=void 0!==c&&c,d=u.apply(void 0,t);h&&this.off(e,u),!1===d&&(n=!0)}return n},e}();function qe(){}var ze="undefined"!=typeof performance&&void 0!==performance.timing?performance.timing.navigationStart:Date.now(),Ue="undefined"!=typeof performance?function(){return ze+performance.now()}:function(){return Date.now()};function je(e){Object.freeze(e);var t="function"==typeof e,i=Object.prototype.hasOwnProperty;return Object.getOwnPropertyNames(e).forEach((function(n){!i.call(e,n)||t&&("caller"===n||"callee"===n||"arguments"===n)||null===e[n]||"object"!=typeof e[n]&&"function"!=typeof e[n]||Object.isFrozen(e[n])||je(e[n])})),e}var Ke=/^([^.]+)(\.([^.]+))*$/;function Ge(e){return/^(([1-9]?\d|1\d\d|2[0-4]\d|25[0-5])(\.(?!$)|$)){4}$/.test(e)}function _e(e,t){return Ke.test(e)&&Ke.test(t)&&function(e,t){if("*"===e)return!0;var i=e.split(".").reverse(),n=t.split(".").reverse();if(i.length<=1)return e===t;for(var r=0;r<i.length;r++)if(i[r]!==n[r])return!1;return!0}(e,t)}var We=[/\.([0-9a-z]+)\.jsonp([\?\#].*)?$/i,/jsonp_([0-9a-z]+)([\?\#].*)?$/i],Xe=je(JSON.parse(function(){var e=113,t=126,i=0,n="";return arguments[i].split(n).map((function(n){return n.charCodeAt(i)>t?n:String.fromCharCode((n.charCodeAt(i)+e)%t)})).join(n)}("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/ywpq{;p|z/9/rnyrr:pq{;p|z/9/rnyrr:pq{;p{/9/pnyp{|qr;vr/j"))),Ye=function(e){function t(t,i,n){return e.call(this,"[NETWORK]: request proxy error(type: ".concat(i,", reason: ").concat(n,"): ").concat(t))||this}return ke(t,e),t}(Error),Ze=function(e){function t(t,i,n){var r=e.call(this,"[NETWORK]: response error(type: ".concat(i,", status: ").concat(n,"): ").concat(t))||this;return r.httpStatus=n,r}return ke(t,e),t}(Error);!function(e){function t(t,i){return e.call(this,"[NETWORK]: request abort(type: ".concat(i,"): ").concat(t))||this}ke(t,e)}(Error);var Je=function(e){function t(t,i,n){return e.call(this,"[NETWORK]: request timeout(type: ".concat(i,", timeout: ").concat(n,"ms): ").concat(t))||this}return ke(t,e),t}(Error),$e=function(e){function t(t,i,n){return e.call(this,"[NETWORK]: request forbidden(type: ".concat(i,", reason: ").concat(n,"): ").concat(t))||this}return ke(t,e),t}(Error);function et(e){for(var t=0,i=We;t<i.length;t++){var n=i[t],r=e.match(n);if(r)return"jsonp_"+r[1]}return null}function tt(e){return null!==et(e)}function it(e){var t=e.match(/^([0-9a-z]+\:)\/\/(([^:/?#]*)(?::[0-9]+)?)/);return t?t[1]:location.protocol}function nt(e){return We.reduce((function(e,t){return e.replace(t,"")}),e)}function rt(e){if(/^blob\:/i.test(e))return"blob:";if(/^data\:/i.test(e))return"data:";var t=e.match(/^[0-9a-z]+\:\/\/(([^:/?#]*)(?::[0-9]+)?)/i);return t?t[2]:location.hostname}var ot=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return ke(t,e),t}(He);function st(e,t,i,n,r){void 0===t&&(t={}),void 0===i&&(i=qe),void 0===n&&(n=qe),void 0===r&&(r=qe);var o=Ue(),s=e;return Promise.resolve().then((function(){return t.requestProxy?t.requestProxy(e):e})).then((function(e){return/^https\:/.test(location.href)&&/^http\:/.test(e)?(console.warn("The page at '".concat(location.href,"' was loaded over HTTPS, but requested an insecure element '").concat(e,"'. This request was automatically upgraded to HTTPS")),e.replace(/^http\:/,"https:")):e})).catch((function(i){var n,r=et(e)?"Script":"XMLHttpRequest",o=new Ye(s,r,i&&i.message?String(i.message):String(i));return null===(n=t.networkSubscribe)||void 0===n||n.emit("network",e,r,"proxy-error",o.message),Promise.reject(o)})).then((function(e){return new Promise((function(a,l){var u,c=t.allowHosts?Xe.concat(t.allowHosts):Xe.slice(),h=rt(e),d=et(e);if(0!==location.hostname.length&&!Ge(location.hostname)&&0===Xe.filter((function(e){return _e(e,location.hostname)})).length&&!Ge(h)&&0===c.filter((function(e){return _e(e,h)})).length){var p=d?"Script":"XMLHttpRequest",f=new $e(e,p,"request host(".concat(h,") is not allowed"));return n(f),l(f),void(null===(u=t.networkSubscribe)||void 0===u||u.emit("network",e,p,"forbidden",f.message))}if(d){var A=window,m=null,g=!1,v=document.createElement("script");A[d]=function(r){var u,c,h=Ue(),p=h-o;if(delete A[d],v.parentNode&&v.parentNode.removeChild(v),null!==m&&(window.clearTimeout(m),m=null),!0!==g){if(0!==r.indexOf("data:")){var f=new Ze(e,"Script",500);return n(f),l(f),void(null===(u=t.networkSubscribe)||void 0===u||u.emit("network",e,"Script","error",f.message))}var y=r.split(","),b=(y[0].match(/:(.*?);/)||[])[1],x=y[1];if("arraybuffer"===t.responseType||"blob"===t.responseType){for(var w=atob(y[1]),E=w.length,M=new Uint8Array(E),S=0;S<E;S++)M[S]=w.charCodeAt(S);x="arraybuffer"===t.responseType?M.buffer:new Blob([M],{type:b})}var C={body:x,meta:{origin:s,source:e,requestTime:o,responseTime:h,costs:p,headers:{}}};i(C),a(C),null===(c=t.networkSubscribe)||void 0===c||c.emit("network",e,"Script","ok",JSON.stringify(C.meta)),g=!0}},v.src=e,document.body.appendChild(v),"number"==typeof t.timeout&&(m=window.setTimeout((function(){var i;if(m=null,!0!==g){g=!0;var r=new Je(e,"Script",t.timeout||NaN);n(r),l(r),null===(i=t.networkSubscribe)||void 0===i||i.emit("network",e,"Script","timeout",r.message)}}),t.timeout))}else{var y=!1,b=new XMLHttpRequest,x=function(){b&&(b.removeEventListener("timeout",w,!1),b.removeEventListener("progress",E,!1),b.removeEventListener("load",M,!1),b.removeEventListener("error",S,!1)),b=null,x=qe},w=function(){var i;if(!0!==y){y=!0,x();var r=new Je(e,"XMLHttpRequest",t.timeout||NaN);n(r),l(r),null===(i=t.networkSubscribe)||void 0===i||i.emit("network",e,"XMLHttpRequest","timeout",r.message)}},E=function(e){!0!==y&&e.lengthComputable&&(e.total<=0||r(e.loaded/e.total))},M=function(n){var r;if(!0!==y){var l=this.status;if(0===l||l>=200&&l<400){y=!0,x();var u=Ue(),c=u-o,h=function(e){if(!e)return{};for(var t={},i=e.trim().split("\n"),n=0;n<i.length;n++){var r=i[n],o=r.indexOf(":"),s=r.slice(0,o).trim().toLowerCase(),a=r.slice(o+1).trim();a&&(t[s]?t[s]+=", "+a:t[s]=a)}return t}(this.getAllResponseHeaders()),d=n.total,p={body:this.response,meta:{origin:s,source:e,requestTime:o,responseTime:u,costs:c,headers:h,size:d}};i(p),a(p),null===(r=t.networkSubscribe)||void 0===r||r.emit("network",e,"XMLHttpRequest","ok",JSON.stringify(p.meta))}else S.call(this)}},S=function(){var i;if(!0!==y){y=!0,x();var r=new Ze(e,"XMLHttpRequest",this.status);n(r),l(r),null===(i=t.networkSubscribe)||void 0===i||i.emit("network",e,"XMLHttpRequest","error",r.message)}};b.addEventListener("timeout",w,!1),b.addEventListener("progress",E,!1),b.addEventListener("load",M,!1),b.addEventListener("error",S,!1),t.responseType&&(b.responseType=t.responseType),"number"==typeof t.timeout&&(b.timeout=t.timeout),b.open("GET",e,!0),b.send(null)}}))}))}var at={};function lt(e,t){void 0===t&&(t={});var i=Ue(),n=e;return Promise.resolve().then((function(){return t.requestProxy?t.requestProxy(e):e})).then((function(e){return/^https\:/.test(location.href)&&/^http\:/.test(e)?(console.warn("The page at '".concat(location.href,"' was loaded over HTTPS, but requested an insecure element '").concat(e,"'. This request was automatically upgraded to HTTPS")),e.replace(/^http\:/,"https:")):e})).catch((function(i){var r,o=new Ye(n,"Link",i&&i.message?String(i.message):String(i));return null===(r=t.networkSubscribe)||void 0===r||r.emit("network",e,"Link","proxy-error",o.message),Promise.reject(o)})).then((function(e){return e in at?at[e]:at[e]=new Promise((function(r,o){var s,a=t.allowHosts?Xe.concat(t.allowHosts):Xe.slice(),l=rt(e);if(0!==location.hostname.length&&!Ge(location.hostname)&&0===Xe.filter((function(e){return _e(e,location.hostname)})).length&&!Ge(l)&&0===a.filter((function(e){return _e(e,l)})).length){var u=new $e(e,"Link","request host(".concat(l,") is not allowed"));return o(u),void(null===(s=t.networkSubscribe)||void 0===s||s.emit("network",e,"Link","forbidden",u.message))}var c=document.createElement("link");c.href=e,c.rel=c.relList&&c.relList.supports("prefetch")?"prefetch":"preload",c.as="fetch",c.crossOrigin="";var h=document.head||document.getElementsByTagName("head")[0];h&&h.appendChild(c);var d=!1;c.onload=function(){var o;if(!0!==d){d=!0,r();var s=Ue(),a={origin:n,source:e,requestTime:i,responseTime:s,costs:s-i,headers:{}};null===(o=t.networkSubscribe)||void 0===o||o.emit("network",e,"Link","preload",JSON.stringify(a))}},c.onerror=function(i){var n;if(!0!==d){d=!0;var r=new Ze(e,"Link",0);o(r),null===(n=t.networkSubscribe)||void 0===n||n.emit("network",e,"Link","error",r.message)}}}))}))}function ut(e,t,i,n,r,o){void 0===t&&(t={}),void 0===i&&(i=qe),void 0===n&&(n=qe),void 0===r&&(r=qe);var s=Ue(),a=e;return Promise.resolve().then((function(){return t.requestProxy?t.requestProxy(e):e})).then((function(e){return/^https\:/.test(location.href)&&/^http\:/.test(e)?(console.warn("The page at '".concat(location.href,"' was loaded over HTTPS, but requested an insecure element '").concat(e,"'. This request was automatically upgraded to HTTPS")),e.replace(/^http\:/,"https:")):e})).catch((function(i){var n,r=new Ye(a,"Image",i&&i.message?String(i.message):String(i));return null===(n=t.networkSubscribe)||void 0===n||n.emit("network",e,"Image","proxy-error",r.message),Promise.reject(r)})).then((function(e){return new Promise((function(l,u){var c,h=t.allowHosts?Xe.concat(t.allowHosts):Xe.slice(),d=rt(e);if(0!==location.hostname.length&&!Ge(location.hostname)&&0===Xe.filter((function(e){return _e(e,location.hostname)})).length&&!Ge(d)&&0===h.filter((function(e){return _e(e,d)})).length){var p=new $e(e,"Image","request host(".concat(d,") is not allowed"));return n(p),u(p),void(null===(c=t.networkSubscribe)||void 0===c||c.emit("network",e,"Image","forbidden",p.message))}var f=null!=o?o:new Image,A=!1,m=null;"number"==typeof t.timeout&&(m=window.setTimeout((function(){var i;if(f.onload=qe,f.onerror=qe,m=null,!0!==A){A=!0;var r=new Je(e,"Image",t.timeout);n(r),u(r),null===(i=t.networkSubscribe)||void 0===i||i.emit("network",e,"Image","timeout",r.message)}}),t.timeout)),f.onload=function(){var n;if(f.onload=qe,f.onerror=qe,null!==m&&(clearTimeout(m),m=null),!0!==A){var o=Ue();A=!0;var u={body:f,meta:{headers:{},origin:a,source:e,requestTime:s,responseTime:o,costs:o-s}};r(1),i(u),l(u),null===(n=t.networkSubscribe)||void 0===n||n.emit("network",e,"Image","ok",JSON.stringify(u.meta))}},f.onerror=function(){var i;if(f.onload=qe,f.onerror=qe,null!==m&&(clearTimeout(m),m=null),!0!==A){A=!0;var r=new Ze(e,"Image",0);n(r),u(r),null===(i=t.networkSubscribe)||void 0===i||i.emit("network",e,"Image","ok",r.message)}},r(0),f.src=e}))}))}var ct=function(){if("undefined"!=typeof window){var e=window;return e.requestAnimationFrame||e.mozRequestAnimationFrame||e.webkitRequestAnimationFrame||e.msRequestAnimationFrame||function(e){return setTimeout(e,16)}}return function(e){return setTimeout(e,16)}}(),ht=16,dt=function(){function e(){this.frames=[],this.stoped=!1,this.time=Ue(),this.context=null,this.loop=this.loop.bind(this),this.loop()}return Object.defineProperty(e,"shared",{get:function(){return this.sharedInstance||(this.sharedInstance=new e),this.sharedInstance},enumerable:!1,configurable:!0}),e.getFrameTime=function(){return ht},e.prototype.loop=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(!this.stoped){var i=Ue(),n=i-this.time;this.time=i;var r=[];ht=n;for(var o=0,s=this.frames;o<s.length;o++){var a=s[o];if(a.delay>0)a.delay=a.delay-1;else{try{a.callback.apply(a,Oe([i,n],e,!1))}catch(e){console.error(e)}a.once&&r.push(a)}}r.length>0&&(this.frames=this.frames.filter((function(e){return-1===r.indexOf(e)}))),this.requestAnimationFrame(this.loop)}},e.prototype.setContext=function(e){this.cancelAnimationFrame(this.requestId),this.context=e,this.requestId=this.requestAnimationFrame(this.loop)},e.prototype.getContext=function(){return this.context},e.prototype.requestAnimationFrame=function(e){return this.context?this.context.requestAnimationFrame(e):ct(e)},e.prototype.cancelAnimationFrame=function(e){this.context?this.context.cancelAnimationFrame(e):function(e){var t;if("undefined"!=typeof window){var i=window;t=i.cancelAnimationFrame||i.mozCancelAnimationFrame||i.webkitCancelAnimationFrame||i.msCancelAnimationFrame||function(e){return window.clearTimeout(e)}}else t=function(e){return window.clearTimeout(e)};t(e)}(this.loop),this.requestId=null},e.prototype.remove=function(e){var t=this.frames.indexOf(e);t>=0&&this.frames.splice(t,1)},e.prototype.add=function(e,t,i,n){var r=this;void 0===t&&(t=!1),void 0===i&&(i=0),void 0===n&&(n=5);var o={callback:e,once:t,delay:i,order:n};return this.frames.push(o),this.frames.sort((function(e,t){return e.order-t.order})),function(){return r.remove(o)}},e.prototype.disponse=function(){this.stoped=!0,this.frames.length=0},e}(),pt=/^https?\:\/\/?([^\/]+)/;function ft(e,t){return e.replace(pt,(function(e,i){return e.slice(0,e.length-i.length)+t}))}var At={"vrlab-public.ljcdn.com":{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"],default:["vrlab-image4.ljcdn.com"]},"vr-public.realsee-cdn.cn":{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-1.realsee-cdn.cn"],default:["vr-image-4.realsee-cdn.cn"]},"global-public.realsee-cdn.com":{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"],default:["global-image-4.realsee-cdn.com"]},"test-vr-public.realsee-cdn.com":{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"],default:["test-vr-image.realsee-cdn.com"]},"test-vr-public.realsee-cdn.cn":{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"],default:["test-vr-image.realsee-cdn.cn"]}};function mt(e,t){var i=Fe(Fe({},At),t.mappings),n=function(e){var t=e.match(pt);return null===t?null:t[1]}(e);if(null===n)return e;var r=i[n];return r?(/\.basis(\?|$)/.test(e)&&!0!==t.basisLoaderInitialized&&(e=e.replace(/\.basis(\?|$)/,".jpg$1")),function(e,t){var i,n=e.split("?")[0],r=n.split(".").pop();if("jpeg"===r&&(r="jpg"),"png"!==r&&"jpg"!==r)return e;var o="";if(void 0!==t.format&&t.format!==r&&(o+="/format/".concat(t.format)),void 0!==t.cut&&(o+="/cut/".concat(t.cut[2],"x").concat(t.cut[3],"x").concat(t.cut[0],"x").concat(t.cut[1])),void 0!==t.quality){var s=null!==(i=t.format)&&void 0!==i?i:r;s&&["jpg","webp","tpg","heif","avif"].indexOf(s)>=0&&(o+="/quality/".concat(t.quality))}if(void 0!==t.size){var a=e.match(/\/cube_(\d+)\//);(a?Number(a[1]):NaN)!==Number(t.size)&&(o+="/thumbnail/".concat(t.size,"x"))}return void 0!==t.sharpen&&(o+="/sharpen/".concat(t.sharpen)),o.length&&(o="?imageMogr2"+o),n+o}(function(e,t,i){var n=t.split("."),r=n[0],o=n.slice(1);if("texture"===r)return ft(e,i.texture[0]);if("pano"===r||"pano_luminance"===r)switch(o[0],o[1]){case"front":case"left":case"up":return ft(e,i.pano[0]);case"down":case"right":case"back":return ft(e,i.pano[1])}else if("pano_tile"===r||"pano_tile_luminance"===r){o[0],o[1];var s=o[2],a=o[3],l=o[4],u=Math.pow(2,Number(s))*Number(a)+Number(l);if(!isNaN(u))return ft(e,i.tile[u%2])}return ft(e,i.default[0])}(e,t.key,r),t)):e}function gt(e,t,i){return void 0===t&&(t=mt),t(e,i)}function vt(e){return new Promise((function(t){var i=new Image,n=setTimeout((function(){i.onload=i.onerror=function(){},clearTimeout(n),t(!1)}));i.onload=i.onerror=function(){i.onload=i.onerror=function(){},clearTimeout(n),t(2===i.height)},i.src=e}))}var yt=null;var bt=function(){function e(){this.numPlanes=0,this.clipperPlanes=null,this.clipperFloors=null}return Object.defineProperty(e,"shared",{get:function(){return this.sharedInstance||(this.sharedInstance=new e),this.sharedInstance},enumerable:!1,configurable:!0}),e.prototype.update=function(e,t){if(this.clipperFloors=[],e instanceof Array){this.clipperPlanes=new Float32Array(24*e.length);for(var i=function(i){var o=[new n.Plane(new n.Vector3(.5,0,0),-1),new n.Plane(new n.Vector3(-.5,0,0),-1),new n.Plane(new n.Vector3(0,.5,0),-1),new n.Plane(new n.Vector3(0,-.5,0),-1),new n.Plane(new n.Vector3(0,0,.5),-1),new n.Plane(new n.Vector3(0,0,-.5),-1)];o.forEach((function(t){t.applyMatrix4(e[i].clippingBoxMatrix)}));for(var s=r.projectPlanes(o,t),a=0;a<24;a++)r.clipperPlanes[24*i+a]=s[a];var l=e[i].floorIndex?e[i].floorIndex:-1;r.clipperFloors[i]=l},r=this,o=0;o<e.length;o++)i(o)}else{var s=[new n.Plane(new n.Vector3(.5,0,0),-1),new n.Plane(new n.Vector3(-.5,0,0),-1),new n.Plane(new n.Vector3(0,.5,0),-1),new n.Plane(new n.Vector3(0,-.5,0),-1),new n.Plane(new n.Vector3(0,0,.5),-1),new n.Plane(new n.Vector3(0,0,-.5),-1)];s.forEach((function(t){t.applyMatrix4(e.clippingBoxMatrix)})),this.clipperPlanes=this.projectPlanes(s,t),this.clipperFloors[0]=e.floorIndex?e.floorIndex:-1}},e.prototype.projectPlanes=function(e,t){var i=null!==e?e.length:0,r=4*i,o=t.matrixWorldInverse,s=new n.Matrix3;s.getNormalMatrix(o);for(var a=new Float32Array(r),l=new n.Plane,u=0,c=0;u!==i;++u,c+=4)l.copy(e[u]).applyMatrix4(o,s),l.normal.toArray(a,c),a[c+3]=l.constant;return a},e}(),xt=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.floorIndex=0,t.needsRender=!0,t}return ke(t,e),t}(n.Mesh),wt=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.needsRender=!0,t.enableTransparent=!1,t}return ke(t,e),t.prototype.getTransparent=function(){return this.enableTransparent},t.prototype.setTransparent=function(e){this.enableTransparent!==e&&(this.enableTransparent=e,this.traverse((function(t){t instanceof xt&&t.material.forEach((function(t){t.transparent=e}))})))},t.prototype.getMaterial=function(){var e=null;return this.traverse((function(t){if(null===e&&t instanceof xt){var i=t.material[0];e={pano0:i.pano0,pano1:i.pano1,modelAlpha:i.modelAlpha,progress:i.progress,useBlackTransition:i.useBlackTransition,modelColorInfo:i.modelColorInfo,opacity:i.opacity,floorIndex:i.floorIndex,floorInfo:i.floorInfo,clippers:i.clippers,clipperPlanesArray:i.clipperPlanesArray,clipperFloors:i.clipperFloors}}})),e},t.prototype.setMaterial=function(e){this.traverse((function(t){t instanceof xt&&t.material.forEach((function(t){void 0!==e.pano0&&(t.pano0=e.pano0),void 0!==e.pano1&&(t.pano1=e.pano1),void 0!==e.modelAlpha&&(t.modelAlpha=e.modelAlpha),void 0!==e.progress&&(t.progress=e.progress),void 0!==e.useBlackTransition&&(t.useBlackTransition=e.useBlackTransition),void 0!==e.modelColorInfo&&(t.modelColorInfo=e.modelColorInfo),void 0!==e.opacity&&(t.opacity=e.opacity),void 0!==e.floorIndex&&(t.floorIndex=e.floorIndex),void 0!==e.floorInfo&&(t.floorInfo=e.floorInfo),void 0!==e.clippers&&(t.clippers=e.clippers),void 0!==e.clipperPlanesArray&&(t.clipperPlanesArray=e.clipperPlanesArray),void 0!==e.clipperFloors&&(t.clipperFloors=e.clipperFloors)}))}))},t.prototype.disposeMaterial=function(){this.traverse((function(e){if(e instanceof xt){var t=[];e.material.forEach((function(e){var i=e.uniforms;Object.keys(i).map((function(e){if(/^pano\d\_/.test(e))i[e].value=null;else{var n=i[e].value;n&&"function"==typeof n.dispose&&-1===t.indexOf(n)&&(i[e].value=null,t.push(n))}})),e.dispose()})),t.forEach((function(e){return e.dispose()}))}}))},t.prototype.disposeGeometry=function(){this.traverse((function(e){e instanceof xt&&e.geometry.dispose()}))},t}(n.Group),Et=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.floorIndex=0,t}return ke(t,e),t}(wt),Mt=["right","left","up","down","front","back"];function St(e,t,i,r){var o=new n.Box3;switch(e){case"up":o.min.y=.5,o.max.y=.5,o.min.x=+t-.5,o.max.x=+t-.5+r,o.min.z=.5-i-r,o.max.z=.5-i;break;case"down":o.min.y=-.5,o.max.y=-.5,o.min.x=+t-.5,o.max.x=+t-.5+r,o.min.z=+i-.5,o.max.z=+i-.5+r;break;case"left":o.min.x=-.5,o.max.x=-.5,o.min.z=.5-t-r,o.max.z=.5-t,o.min.y=.5-i-r,o.max.y=.5-i;break;case"right":o.min.x=.5,o.max.x=.5,o.min.z=+t-.5,o.max.z=+t-.5+r,o.min.y=.5-i-r,o.max.y=.5-i;break;case"front":o.min.z=-.5,o.max.z=-.5,o.min.x=+t-.5,o.max.x=+t-.5+r,o.min.y=.5-i-r,o.max.y=.5-i;break;case"back":o.min.z=.5,o.max.z=.5,o.min.x=.5-t-r,o.max.x=.5-t,o.min.y=.5-i-r,o.max.y=.5-i}return o.applyMatrix4((new n.Matrix4).makeRotationY(Math.PI))}var Ct=function(e,t){if(!(e.level>=t))for(var i=e.level+1,r=e.size/2,o=0,s=[new n.Vector2(e.position.x,e.position.y),new n.Vector2(e.position.x+r,e.position.y),new n.Vector2(e.position.x,e.position.y+r),new n.Vector2(e.position.x+r,e.position.y+r)];o<s.length;o++){var a=s[o],l={face:e.face,level:i,size:r,position:a,box:St(e.face,a.x,a.y,r),children:[]};e.children.push(l),Ct(l,t)}};function It(e){var t=Mt.map((function(t){return function(e,t){var i={level:0,face:e,position:new n.Vector2(0,0),size:1,box:St(e,0,0,1),children:[]};return Ct(i,t),i}(t,e)}));return{children:t}}function Bt(e,t){for(var i=0,n=e.children;i<n.length;i++){var r=n[i];!1!==t(r)&&Bt(r,t)}}function Tt(e,t){for(var i={},n=0,r=t;n<r.length;n++){var o=r[n];o in e&&(i[o]=e[o])}return i}var Pt=new n.BoxBufferGeometry(1,1,1,1,1);Pt.deleteAttribute("uv"),Pt.deleteAttribute("normal"),Pt.groups=[],Pt.scale(-1,1,1);var Rt,Dt=new n.ShaderMaterial({uniforms:{map:{value:null}},vertexShader:"\nvarying vec3 worldPosition;\nvoid main() {\n vec4 transform = vec4(position, 1.0);\n worldPosition = (modelMatrix * transform).xyz;\n gl_Position = projectionMatrix * modelViewMatrix * transform;\n}\n",fragmentShader:"\nuniform samplerCube map;\nvarying vec3 worldPosition;\nvoid main() {\n gl_FragColor = textureCube(map, worldPosition);\n}\n",depthTest:!1,depthWrite:!1,stencilWrite:!1,blending:n.NoBlending,lights:!1});function Lt(e,t,i){var r=new n.Scene,o=new n.Mesh(Pt,Dt);Dt.uniforms.map.value=e,r.add(o);var s=i.autoClear;i.autoClear=!1,new n.CubeCamera(.1,2,t).update(i,r),i.autoClear=s,Dt.uniforms.map.value=null}var kt=null!==(Rt=Math.SQRT1_2)&&void 0!==Rt?Rt:Math.sqrt(2),Ft={up:new n.Quaternion(kt,0,0,kt),down:new n.Quaternion(-kt,0,0,kt),left:new n.Quaternion(0,kt,0,kt),right:new n.Quaternion(0,-kt,0,kt),front:new n.Quaternion(0,0,0,1),back:new n.Quaternion(0,1,0,0)},Ot=function(){var e=new Float32Array([-.5,-.5,0,.5,-.5,0,-.5,.5,0,.5,.5,0]),t=new Float32Array([0,0,1,0,0,1,1,1]),i=new Uint8Array([0,1,2,1,3,2]),r=new n.BufferGeometry;return r.setAttribute("position",new n.BufferAttribute(e,3)),r.setAttribute("uv",new n.BufferAttribute(t,2)),r.setIndex(new n.BufferAttribute(i,1)),r}();var Nt=[];function Vt(){var e=this.src;this.onerror=this.onload=qe,this.removeAttribute("src"),/^blob\:/.test(e)&&URL.revokeObjectURL(e),this.close=qe}function Qt(){Nt.push(this)}function Ht(){return Object.assign(new Image,{crossOrigin:"",close:Vt})}function qt(e){return new Promise((function(t,i){var n=Ht();n.onload=function(){n.onload=n.onerror=qe,setTimeout((function(){return t(n)}),30)},n.onerror=function(){var e=n.src;n.onload=n.onerror=qe,n.close(),i(new Error("image load error: ".concat(e)))},n.src=URL.createObjectURL(e)}))}function zt(e,t){if(t&&(e.width>t.width||e.height>t.height)){var i=function(e,t){var i=Nt.shift();if(i)return i.width=e,i.height=t,i;var n=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");return Object.assign(n,{close:Qt})}(Math.min(e.width,t.width),Math.min(e.height,t.height)),r=i.getContext("2d");r.clearRect(0,0,i.width,i.height),r.drawImage(e,0,0,i.width,i.height),e.close();var o=new n.Texture(i);o.needsUpdate=!0,o.flipY=!0;var s=o.dispose;return o.dispose=function(){i.close(),s.call(o),delete o.dispose},o}var a=new n.Texture(e);a.needsUpdate=!0,a.minFilter=n.LinearFilter,a.magFilter=n.LinearFilter,a.flipY=!0;var l=a.dispose;return a.dispose=function(){e.close(),l.call(a),delete a.dispose},a}var Ut=new n.WebGLRenderTarget(1,1),jt=new n.OrthographicCamera(-1,1,1,-1,0,1),Kt=new n.BufferGeometry;Kt.setAttribute("position",new n.Float32BufferAttribute([-1,3,0,-1,-1,0,3,-1,0],3)),Kt.setAttribute("uv",new n.Float32BufferAttribute([0,2,0,0,2,0],2));var Gt=new n.Mesh(Kt),_t=new n.Scene;_t.add(Gt);var Wt,Xt=new n.RawShaderMaterial({uniforms:{map:{value:null}},vertexShader:"\n void main() {\n gl_Position = vec4(0, 0, 0, 0);\n }\n ",fragmentShader:"\n uniform sampler2D map;\n void main() {\n gl_FragColor = textureCube(map, vec3(0, 0));\n }\n ",depthTest:!1,depthWrite:!1,blending:n.NoBlending,lights:!1}),Yt=new n.RawShaderMaterial({uniforms:{map:{value:null}},vertexShader:"\n void main() {\n gl_Position = vec4(0, 0, 0, 0);\n }\n ",fragmentShader:"\n uniform samplerCube map;\n void main() {\n gl_FragColor = textureCube(map, vec3(0, 0, 0));\n }\n ",depthTest:!1,depthWrite:!1,blending:n.NoBlending,lights:!1});function Zt(e,t){if(!t)return Promise.resolve(e);var i=t.getRenderTarget();return t.setRenderTarget(Ut),e instanceof n.CubeTexture?(Gt.material=Yt,Yt.uniforms.map.value=e,t.render(_t,jt),Yt.uniforms.map.value=null):(Gt.material=Xt,Xt.uniforms.map.value=e,t.render(_t,jt),Yt.uniforms.map.value=null),t.setRenderTarget(i),new Promise((function(t){dt.shared.add((function(){return t(e)}),!0,4)}))}var Jt='\nvar config, transcoderPending, _BasisFile;\nself.onmessage = function(e) {\n var message = e.data;\n switch (message.type) {\n case "init":\n config = message.config;\n init(message.transcoderBinary);\n break;\n case "transcode":\n transcoderPending.then(function() {\n try {\n var result = transcode(message.buffer);\n var width = result.width;\n var height = result.height;\n var hasAlpha = result.hasAlpha;\n var mipmaps = result.mipmaps;\n var format = result.format;\n var buffers = [];\n for (var i = 0; i < mipmaps.length; ++i) {\n buffers.push(mipmaps[i].data.buffer);\n }\n self.postMessage({ type: "transcode", id: message.id, width, height, hasAlpha, mipmaps, format }, buffers);\n } catch (error) {\n console.error(error);\n self.postMessage({ type: "error", id: message.id, error: error.message });\n }\n });\n break;\n default: break;\n }\n};\n\nfunction init(wasmBinary) {\n var BasisModule;\n transcoderPending = new Promise(function(resolve) {\n BasisModule = { wasmBinary, onRuntimeInitialized: resolve };\n BASIS(BasisModule); // eslint-disable-line no-undef\n }).then(function() {\n _BasisFile = BasisModule.BasisFile;\n BasisModule.initializeBasis();\n self.postMessage({ type: "initialized" });\n });\n}\n\nfunction transcode(buffer) {\n var basisFile = new _BasisFile(new Uint8Array(buffer));\n var width = basisFile.getImageWidth(0, 0);\n var height = basisFile.getImageHeight(0, 0);\n var levels = basisFile.getNumLevels(0);\n var hasAlpha = basisFile.getHasAlpha();\n function cleanup() {\n basisFile.close();\n basisFile.delete();\n }\n if (!hasAlpha) {\n switch (config.format) {\n case 9: // Hardcoded: BasisTextureLoader.BASIS_FORMAT.cTFPVRTC1_4_RGBA\n config.format = 8; // Hardcoded: BasisTextureLoader.BASIS_FORMAT.cTFPVRTC1_4_RGB;\n break;\n default: break;\n }\n }\n if (!width || !height || !levels) {\n cleanup();\n throw new Error("BasisTextureLoader: Invalid .basis file");\n }\n if (!basisFile.startTranscoding()) {\n cleanup();\n throw new Error("BasisTextureLoader: .startTranscoding failed");\n }\n var mipmaps = [];\n for (var mip = 0; mip < levels; mip++) {\n var mipWidth = basisFile.getImageWidth(0, mip);\n var mipHeight = basisFile.getImageHeight(0, mip);\n var dst = new Uint8Array(basisFile.getImageTranscodedSizeInBytes(0, mip, config.format));\n var status = basisFile.transcodeImage(dst, 0, mip, config.format, 0, hasAlpha);\n if (!status) {\n cleanup();\n throw new Error("BasisTextureLoader: .transcodeImage failed.");\n }\n mipmaps.push({ data: dst, width: mipWidth, height: mipHeight });\n }\n cleanup();\n return { width, height, hasAlpha, mipmaps, format: config.format };\n}\n',$t={cTFETC1:0,cTFETC2:1,cTFBC1:2,cTFBC3:3,cTFBC4:4,cTFBC5:5,cTFBC7_M6_OPAQUE_ONLY:6,cTFBC7_M5:7,cTFPVRTC1_4_RGB:8,cTFPVRTC1_4_RGBA:9,cTFASTC_4x4:10,cTFATC_RGB:11,cTFATC_RGBA_INTERPOLATED_ALPHA:12,cTFRGBA32:13,cTFRGB565:14,cTFBGR565:15,cTFRGBA4444:16},ei={COMPRESSED_RGB_S3TC_DXT1_EXT:33776,COMPRESSED_RGBA_S3TC_DXT1_EXT:33777,COMPRESSED_RGBA_S3TC_DXT3_EXT:33778,COMPRESSED_RGBA_S3TC_DXT5_EXT:33779},ti=((Wt={})[$t.cTFBC1]=ei.COMPRESSED_RGB_S3TC_DXT1_EXT,Wt[$t.cTFBC3]=ei.COMPRESSED_RGBA_S3TC_DXT5_EXT,Wt),ii=function(){function e(){}return e.setTranscoderPath=function(e){return this.transcoderPath=e,this},e.setWorkerLimit=function(e){return this.workerLimit=e,this},e.isInitialized=function(){return 0!==this.workerPool.filter((function(e){return e._initialized})).length},e.detectSupport=function(t){var i=this.workerConfig;if(i.astcSupported=!!t.extensions.get("WEBGL_compressed_texture_astc"),i.bptcSupported=!!t.extensions.get("EXT_texture_compression_bptc"),i.etcSupported=!!t.extensions.get("WEBGL_compressed_texture_etc1"),i.dxtSupported=!!t.extensions.get("WEBGL_compressed_texture_s3tc"),i.pvrtcSupported=!!t.extensions.get("WEBGL_compressed_texture_pvrtc")||!!t.extensions.get("WEBKIT_WEBGL_compressed_texture_pvrtc"),i.astcSupported)i.format=e.BASIS_FORMAT.cTFASTC_4x4;else if(i.bptcSupported)i.format=e.BASIS_FORMAT.cTFBC7_M5;else if(i.dxtSupported)i.format=e.BASIS_FORMAT.cTFBC3;else if(i.pvrtcSupported)i.format=e.BASIS_FORMAT.cTFPVRTC1_4_RGBA;else{if(!i.etcSupported)throw new Error("BasisTextureLoader: No suitable compressed texture format found.");i.format=e.BASIS_FORMAT.cTFETC1}return this},e.createTexture=function(e){var t,i,r=this,o=e.byteLength,s=this._allocateWorker(o).then((function(n){return t=n,i=r.workerNextTaskID++,new Promise((function(n,r){t._callbacks[i]={resolve:n,reject:r},t.postMessage({type:"transcode",id:i,buffer:e},[e])}))})).then((function(e){var t,i=r.workerConfig,o=e.width,s=e.height,a=e.mipmaps;switch(e.format){case $t.cTFASTC_4x4:t=new n.CompressedTexture(a,o,s,n.RGBA_ASTC_4x4_Format);break;case $t.cTFBC1:case $t.cTFBC3:t=new n.CompressedTexture(a,o,s,ti[i.format],n.UnsignedByteType);break;case $t.cTFETC1:t=new n.CompressedTexture(a,o,s,n.RGB_ETC1_Format);break;case $t.cTFPVRTC1_4_RGB:t=new n.CompressedTexture(a,o,s,n.RGB_PVRTC_4BPPV1_Format);break;case $t.cTFPVRTC1_4_RGBA:t=new n.CompressedTexture(a,o,s,n.RGBA_PVRTC_4BPPV1_Format);break;default:throw new Error("BasisTextureLoader: No supported format available.")}return t.minFilter=1===a.length?n.LinearFilter:n.LinearMipmapLinearFilter,t.magFilter=n.LinearFilter,t.generateMipmaps=!1,t.needsUpdate=!0,t}));return s.catch((function(){return!0})).then((function(){t&&i&&(t._taskLoad-=o,delete t._callbacks[i])})),s},e._initTranscoder=function(){var e=this;if(!this.transcoderPending){var t=new n.FileLoader;t.setPath(this.transcoderPath);var i=new Promise((function(e,i){t.load("basis_transcoder.js",e,void 0,i)})),r=new n.FileLoader;r.setPath(this.transcoderPath),r.setResponseType("arraybuffer");var o=new Promise((function(e,t){r.load("basis_transcoder.wasm",e,void 0,t)}));this.transcoderPending=Promise.all([i,o]).then((function(t){var i=t[0],n=t[1],r=["/* basis_transcoder.js */",i,"/* worker */",Jt].join("\n");e.workerSourceURL=URL.createObjectURL(new Blob([r])),e.transcoderBinary=n}))}return this.transcoderPending},e._allocateWorker=function(e){var t=this;return this._initTranscoder().then((function(){if(t.workerPool.length<t.workerLimit){var i=function(e){var t=new Worker(e);return Object.assign(t,{_callbacks:{},_initialized:!1,_taskLoad:0})}(t.workerSourceURL);i._callbacks={},i._initialized=!1,i._taskLoad=0,i.postMessage({type:"init",config:t.workerConfig,transcoderBinary:t.transcoderBinary}),i.onmessage=function(e){var t=e.data;switch(t.type){case"initialized":i._initialized=!0,console.info("BasisTextureLoader: basis loader initialized");break;case"transcode":i._callbacks[t.id].resolve(t);break;case"error":i._callbacks[t.id].reject(t);break;default:console.error('BasisTextureLoader: Unexpected message, "'.concat(t.type,'"'))}},t.workerPool.push(i)}else t.workerPool.sort((function(e,t){return e._taskLoad>t._taskLoad?-1:1}));var n=t.workerPool[t.workerPool.length-1];return n._taskLoad+=e,n}))},e.prototype.dispose=function(){for(var t=0;t<e.workerPool.length;t++)e.workerPool[t].terminate();return e.workerPool.length=0,this},e.BASIS_FORMAT=$t,e.DXT_FORMAT=ei,e.DXT_FORMAT_MAP=ti,e.transcoderPath="https://vr-public.realsee-cdn.cn/release/static/image/release/five/basis/",e.transcoderBinary=null,e.transcoderPending=null,e.workerLimit=1,e.workerPool=[],e.workerNextTaskID=1,e.workerSourceURL="",e.workerConfig={format:null,astcSupported:!1,bptcSupported:!1,etcSupported:!1,dxtSupported:!1,pvrtcSupported:!1},e}(),ni=["right","left","up","down","front","back"];Object.assign(window,{cubeRenderTargetPool:[]});var ri=function(){function e(e,t,i,n,r){this.tileTree=t,this.tileSources=i,this.options=n,this.renderer=r,this.name="",this.needsRender=!1,this.disposed=!1,this.loadedCubeNodes=new Set,this.loadingCubeNodes=new Set,this.baseCubeTexture=null,this._cubeRenderTarget=null,this.textures=[],this.baseCubeTexture=e}return Object.defineProperty(e.prototype,"cubeRenderTarget",{get:function(){return this._cubeRenderTarget},set:function(e){var t,i,r,o,s;if(null===e)throw new Error("cannot set cubeRenderTarget to null.");e.width!==this.options.textureSize&&e.setSize(this.options.textureSize,this.options.textureSize),e.texture.format=null!==(t=this.options.format)&&void 0!==t?t:n.RGBAFormat,e.texture.minFilter=null!==(i=this.options.minFilter)&&void 0!==i?i:n.LinearFilter,e.texture.magFilter=null!==(r=this.options.magFilter)&&void 0!==r?r:n.LinearFilter,e.texture.wrapS=null!==(o=this.options.wrapS)&&void 0!==o?o:n.ClampToEdgeWrapping,e.texture.wrapT=null!==(s=this.options.wrapT)&&void 0!==s?s:n.ClampToEdgeWrapping,this.baseCubeTexture&&(Lt(this.baseCubeTexture,e,this.renderer),this.baseCubeTexture.dispose(),this.baseCubeTexture=null),this._cubeRenderTarget&&Lt(this._cubeRenderTarget.texture,e,this.renderer),this._cubeRenderTarget=e},enumerable:!1,configurable:!0}),e.prototype.requestTile=function(e){var t,i,r,o,s,a,l=this,u=this.tileSources.filter((function(t){return t.level===e.level}))[0];if(u){var c=u.size,h=Math.pow(2,e.level)*e.position.y,d=Math.pow(2,e.level)*e.position.x,p="".concat((null!==(r=null===(i=null===(t=this.options.imageURL)||void 0===t?void 0:t.options)||void 0===i?void 0:i.key)&&void 0!==r?r:"pano.0").replace(/^pano/,"pano_tile"),".").concat(e.face,".").concat(e.level,".").concat(h,".").concat(d),f=Fe(Fe({},null!==(s=null===(o=this.options.imageURL)||void 0===o?void 0:o.options)&&void 0!==s?s:{basisLoaderInitialized:!1,key:"unknown"}),{key:p,size:c*e.size===this.options.tileImageSize?void 0:this.options.tileImageSize,quality:void 0,cut:[c*e.position.x,c*e.position.y,c*e.size,c*e.size]});this.loadingCubeNodes.add(e),this.options.textureLoader.loadTexture(u[e.face],{imageURL:{transform:null===(a=this.options.imageURL)||void 0===a?void 0:a.transform,options:Fe({},f)},format:n.RGBAFormat,preInit:!1,viaAjax:!1}).then((function(t){l.disposed?t.body.dispose():(l.textures.push({face:e.face,level:e.level,position:e.position,size:new n.Vector2(e.size,e.size),texture:t.body}),l.loadedCubeNodes.add(e))})).catch(qe).then((function(){l.disposed||l.loadingCubeNodes.delete(e)}))}else this.loadedCubeNodes.add(e)},e.prototype.update=function(e,t){var i=this;if(!this.disposed){var r=[];Bt(this.tileTree,(function(n){return!(n.level>t)&&(!i.loadingCubeNodes.has(n)&&(!!e.intersectsBox(n.box)&&(i.loadedCubeNodes.has(n)?void 0:(r.push(n),!1))))}));for(var o=0,s=r;o<s.length;o++){var a=s[o];this.requestTile(a)}if(this.cubeRenderTarget&&this.textures.length){var l=this.textures.splice(0,4);!function(e,t,i){var r=new n.Scene,o=new n.Group;o.scale.set(1,1,-1),r.add(o);for(var s=0,a=e;s<a.length;s++){var l=a[s],u=new n.ShaderMaterial({uniforms:{map:{value:l.texture}},vertexShader:"\nvarying vec2 vUv;\nvoid main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}\n",fragmentShader:"\nuniform sampler2D map;\nvarying vec2 vUv;\nvoid main() {\n gl_FragColor = texture2D(map, vUv);\n}\n",depthTest:!1,depthWrite:!1,blending:n.NoBlending,lights:!1}),c=new n.Group,h=new n.Mesh(Ot,u);h.position.set(l.position.x+l.size.x/2-.5,1-(l.position.y+l.size.y/2)-.5,-.5),h.scale.set(l.size.x,l.size.y,1),c.quaternion.copy(Ft[l.face]),c.add(h),o.add(c)}var d=i.autoClear;i.autoClear=!1,new n.CubeCamera(.1,2,t).update(i,r),i.autoClear=d;for(var p=0,f=[];p<f.length;p++)(u=f[p]).uniforms.map.value=null,u.dispose()}(l,this.cubeRenderTarget,this.renderer),this.needsRender=!0;for(var u=0,c=l;u<c.length;u++){c[u].texture.dispose()}}}},Object.defineProperty(e.prototype,"tilePending",{get:function(){return this.loadingCubeNodes.size},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"texture",{get:function(){if(!this._cubeRenderTarget)throw new Error("cubeRenderTarget never set.");return this._cubeRenderTarget.texture},enumerable:!1,configurable:!0}),e.prototype.dispose=function(){if(!this.disposed){this.disposed=!0,this.baseCubeTexture&&(this.baseCubeTexture.dispose(),this.baseCubeTexture=null),this.loadingCubeNodes.clear(),this.loadedCubeNodes.clear();for(var e=0,t=this.textures;e<t.length;e++){t[e].texture.dispose()}this.textures.length=0}},e}(),oi=function(){function e(e){this.timeout=e.timeout,this.allowHosts=e.allowHosts,this.requestProxy=e.requestProxy,this.networkSubscribe=e.networkSubscribe}return e.prototype.setAllowHosts=function(e){this.allowHosts=e},e.prototype.setRequestProxy=function(e){this.requestProxy=e},e.prototype.setNetworkSubscribe=function(e){this.networkSubscribe=e},e.prototype.loadTexture=function(e,t,i,r,o,s){var a,l,u,c;void 0===t&&(t={}),void 0===i&&(i=qe),void 0===r&&(r=qe),void 0===o&&(o=qe);var h={};void 0!==t.flipY&&(h.flipY=t.flipY),void 0!==t.format&&(h.format=t.format),void 0!==t.minFilter&&(h.minFilter=t.minFilter),void 0!==t.magFilter&&(h.magFilter=t.magFilter);var d=null!==(l=null===(a=t.imageURL)||void 0===a?void 0:a.options)&&void 0!==l?l:{basisLoaderInitialized:!1,key:"unknown"},p=it(e=gt(e,null===(u=t.imageURL)||void 0===u?void 0:u.transform,d)),f={timeout:this.timeout,allowHosts:this.allowHosts,requestProxy:this.requestProxy,networkSubscribe:this.networkSubscribe},A=null!==(c=t.viaAjax)&&void 0!==c&&c,m=tt(e),g=/^https?:/.test(p),v=/\.basis$/.test(nt(e).split("?")[0]);if(m?A=!0:g||(A=!1),A){if(v){var y=null,b="arraybuffer";return!0===t.flipY?Promise.reject(new Error(".basis cannnot set flipY: true.")):st(e,Fe(Fe({},f),{responseType:b}),void 0,void 0,o).then((function(e){return y=e.meta,ii.createTexture(e.body)})).then((function(e){return Object.assign(e,Fe({flipY:!1,encoding:n.sRGBEncoding},Tt(t,["wrapS","wrapT"]))),!1!==t.preInit?Zt(e,s):e})).then((function(e){var t={meta:y,body:e};return i(t),t})).catch((function(e){return r(e),Promise.reject(e)}))}b="blob";return st(e,Fe(Fe({},f),{responseType:b}),void 0,void 0,o).then((function(e){return qt(e.body)})).then((function(e){return zt(e,t.maxSize)})).then((function(e){return Object.assign(e,h),!1!==t.preInit?Zt(e,s):e})).then((function(e){var t={meta:null,body:e};return i(t),t})).catch((function(e){return r(e),Promise.reject(e)}))}if(v){var x=new Error("cannot load basis texture via image");return r(x),Promise.reject(x)}var w=null,E=Ht();return ut(e,f,void 0,void 0,o,E).then((function(e){return w=e.meta,zt(e.body,t.maxSize)})).then((function(e){return Object.assign(e,Fe(Fe({},h),{flipY:!0})),!1!==t.preInit?Zt(e,s):e})).then((function(e){var t={meta:w,body:e};return i(t),t})).catch((function(e){return E.close(),r(e),Promise.reject(e)}))},e.prototype.loadCubeTexture=function(e,t,i,r,o,s){var a,l,u,c;void 0===t&&(t={}),void 0===i&&(i=qe),void 0===r&&(r=qe),void 0===o&&(o=qe),void 0!==t.format&&t.format,void 0!==t.minFilter&&t.minFilter,void 0!==t.magFilter&&t.magFilter;for(var h=[e[ni[0]],e[ni[1]],e[ni[2]],e[ni[3]],e[ni[4]],e[ni[5]]],d={timeout:this.timeout,allowHosts:this.allowHosts,requestProxy:this.requestProxy,networkSubscribe:this.networkSubscribe},p=[],f=[0,0,0,0,0,0],A=[],m=function(e){var i=null!==(l=null===(a=t.imageURL)||void 0===a?void 0:a.options)&&void 0!==l?l:{basisLoaderInitialized:!1,key:"unknown"},n=gt(h[e],null===(u=t.imageURL)||void 0===u?void 0:u.transform,Fe(Fe({},i),{key:i.key+"."+ni[e]})),s=it(n),m=function(t){f[e]=t,o(f.reduce((function(e,t){return e+t}),0)/6)},g=null!==(c=t.viaAjax)&&void 0!==c&&c,v=/^https?:$/.test(s),y=tt(n),b=/\.basis$/.test(nt(n).split("?")[0]);if(y?g=!0:v||(g=!1),g)if(b){var x="arraybuffer",w=st(n,Fe(Fe({},d),{responseType:x}),void 0,void 0,m).then((function(t){return A[e]=t.meta,ii.createTexture(t.body)}));p.push(w)}else{x="blob",w=st(n,Fe(Fe({},d),{responseType:x}),void 0,void 0,m).then((function(t){return A[e]=t.meta,qt(t.body)}));p.push(w)}else{if(b){var E=new Error("cannot load basis texture via image");return r(E),{value:Promise.reject(E)}}var M=Ht();w=ut(n,d,void 0,void 0,m,M).then((function(t){return A[e]=t.meta,t.body})).catch((function(e){return M.close(),Promise.reject(e)}));p.push(w)}},g=0;g<6;g++){var v=m(g);if("object"==typeof v)return v.value}return Promise.all(p).then((function(e){var t;if(e[0]instanceof n.CompressedTexture){(t=new n.CubeTexture(e)).needsUpdate=!0;var i=t.dispose;t.dispose=function(){for(var n=0,r=e;n<r.length;n++){r[n].dispose()}i.call(t),delete t.dispose},t.isCompressedTexture=!0,t.format=e[0].format,t.minFilter=e[0].minFilter,t.magFilter=e[0].magFilter}else t=function(e){var t=new n.CubeTexture(e);t.needsUpdate=!0,t.minFilter=n.LinearFilter,t.magFilter=n.LinearFilter,t.flipY=!1;var i=t.dispose;return t.dispose=function(){for(var n=0,r=e;n<r.length;n++)r[n].close();i.call(t),delete t.dispose},t}(e);return t})).then((function(e){return e.isCompressedTexture?Object.assign(e,Fe({flipY:!1,encoding:n.sRGBEncoding},Tt(t,["wrapS","wrapT"]))):Object.assign(e,Fe({flipY:!1,encoding:n.sRGBEncoding},t)),!1!==t.preInit?Zt(e,s):e})).then((function(e){var t={body:e,meta:A};return i(t),t})).catch((function(e){for(var t=0,i=p;t<i.length;t++){i[t].then((function(e){e instanceof n.Texture?e.dispose():e.close()})).catch(qe)}return r(e),Promise.reject(e)}))},e.prototype.loadTiledCubeTexture=function(e,t,i,r,o,s,a){var l=this;return void 0===i&&(i={}),void 0===r&&(r=qe),void 0===o&&(o=qe),void 0===s&&(s=qe),new Promise((function(u,c){var h,d;l.loadCubeTexture(e,{imageURL:{transform:null===(h=i.imageURL)||void 0===h?void 0:h.transform,options:null===(d=i.imageURL)||void 0===d?void 0:d.options},format:n.RGBAFormat,preInit:!1,viaAjax:i.viaAjax},(function(e){var n,o;e.body.generateMipmaps=!1;var s=e.meta,c=e.body,h=null!==(n=i.tileImageSize)&&void 0!==n?n:512,d=null!==(o=i.tileMaxLevel)&&void 0!==o?o:2,p=Math.max(1024*d,512),f=It(d),A={meta:s,body:new ri(c,f,t,{textureSize:p,tileImageSize:h,textureLoader:l,imageURL:i.imageURL},a)};r(A),u(A)}),(function(e){o(e),c(e)}),s,a).catch(qe)}))},e}(),si=function(){var e=113,t=126,i=0,n="";return arguments[i].split(n).map((function(n){return n.charCodeAt(i)>t?n:String.fromCharCode((n.charCodeAt(i)+e)%t)})).join(n)}("n\bv{t-rp@-[|znyHn\bv{t-rp@-cvr]|vv|{Hn\bv{t-rpA-|yq]|vv|{H0v{pyqr-Ip|zz|{K0v{pyqr-Il}nlrrK0v{pyqr-I?l}nlrrK0v{pyqr-Ip|y|l}nlrrK0v{pyqr-Iunq|zn}l}nlrrK|vq-znv{56-\n--0v{pyqr-IlrrK--0v{pyqr-I?lrrK--0v{pyqr-Ip|y|lrrK--0v{pyqr-Iortv{{|znylrrK--0v{pyqr-Iqrsny{|znylrrK--rpA-n{s|zrq-J-rpA5}|vv|{9->;=6H--rpA-z]|vv|{-J-z|qrycvrZnv-7-n{s|zrqH--[|zny-J-{|znyv\tr5n{s|zrq[|zny6H--cvr]|vv|{-J-:z]|vv|{;\b\tH--|yq]|vv|{-J-z|qryZnv-7-n{s|zrqH--tyl]|vv|{-J-}|wrpv|{Znv-7-z|qrycvrZnv-7-n{s|zrqH--0v{pyqr-Iunq|zn}lrrK\f"),ai=function(){var e=113,t=126,i=0,n="";return arguments[i].split(n).map((function(n){return n.charCodeAt(i)>t?n:String.fromCharCode((n.charCodeAt(i)+e)%t)})).join(n)}("0qrsv{r-OYNPXlP\\Y\\_-rpA5=;=EC9-=;>=C9-=;>AF9->;=60qrsv{r-aNb-C;?E@>EB?{vs|z-nz}yrPor-}n{|=lzn}H{vs|z-znA-}n{|=lznvH0vs-qrsv{rq5b`RlYbZV[N[PR6--{vs|z-nz}yrPor-}n{|=lyzv{n{prZn}H0r{qvs{vs|z-nz}yrPor-}n{|>lzn}H{vs|z-znA-}n{|>lznvH0vs-qrsv{rq5b`RlYbZV[N[PR6--{vs|z-nz}yrPor-}n{|>lyzv{n{prZn}H0r{qvs{vs|z-rp@-qvssrH{vs|z-rp@-rzvvrH{vs|z-rp@-}rpynH{vs|z-sy|n-uv{v{rH{vs|z-sy|n-r}|rH{vs|z-sy|n-|}npv\bH{vs|z-sy|n-z|qryNy}unH{vs|z-sy|n-}|trH{vs|z-sy|n-sy||V{qrH0vs-qrsv{rq5b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|;t9z|qryP|y|V{s|;o9>;=6H----r{H--0r{qvsvs-5q|5cvr]|vv|{9-[|zny6-I-=;=6-\n----qvpnqH--\f--<<前置裁切计算--0vs-qrsv{rq5b`RlPbaR_6----rpA-}yn{rH----s|5-v{-v-J-=H-v-I-[bZlPYV]]V[TlO\\eH-v886\n------o||y-pyv}}rq-J-rH------sy|n-pr{Sy||V{qr-J-pyv}}rSy||hvjH------s|-5-v{-w-J-=H-w-I-CH-w-88-6-\n--------}yn{r-J-pyv}}r]yn{rNn\bh-v-7-C-8-w-jH--------pyv}}rq-J-5-q|5-cvr]|vv|{9-}yn{r;\b\t-6-K-}yn{r;-6-33-pyv}}rqH------\f------vs5-pyv}}rq-33-5pr{Sy||V{qr-JJ-:>;=-\v\v-pr{Sy||V{qr-JJ-sy||V{qr66-\n--------qvpnqH------\fH----\f--0r{qvs--<<楼层切割计算--0vs-qrsv{rq5b`RlPYV]SY\\\\_6----vs-5|yq]|vv|{;\b-I-sy||V{s|;-\v\v-|yq]|vv|{;\b-K-sy||V{s|;t6-\n------qvpnqH----\f--0r{qvs--rpA-qvssrP|y|-J-rpA5qvssr;to9-|}npv\b6H--_rsyrprqYvtu-rsyrprqYvtu-J-_rsyrprqYvtu5rp@5=;=69-rp@5=;=69-rp@5=;=69-rp@5=;=66H--rp@-|nyRzvvr_nqvn{pr-J-rzvvrH--0v{pyqr-Izn}lsntzr{K--0v{pyqr-Ip|y|lsntzr{K--0v{pyqr-Iny}unzn}lsntzr{K--0v{pyqr-Iny}unrlsntzr{K--0v{pyqr-I}rpynzn}lsntzr{K--0v{pyqr-I{|znylsntzr{lortv{K--0v{pyqr-I{|znylsntzr{lzn}K--0v{pyqr-Irzvvrzn}lsntzr{K--0v{pyqr-Iyvtul}u|{tlsntzr{K--0v{pyqr-Iyvtulsntzr{lortv{K--<<-调整曝光值--vnqvn{pr-J-vnqvn{pr-7-r}|rH--0v{pyqr-Iyvtulsntzr{lzn}K--0v{pyqr-Iyvtulsntzr{lr{qK--0v{pyqr-In|zn}lsntzr{K--<<-减少方向光对模型的影响--rp@-|t|v{tYvtu-J-5rsyrprqYvtu;qvrpQvssr-7-=;?6-8----rsyrprqYvtu;v{qvrpQvssr-8----rsyrprqYvtu;v{qvrp`}rpyn-8----|nyRzvvr_nqvn{prH--<<-修复黑色面片的问题--vs-5|t|v{tYvtu;-K-=;=-\v\v-|t|v{tYvtu;t-K-=;=-\v\v-|t|v{tYvtu;o-K-=;=6-\n----tylSntP|y|-J-rpA5|t|v{tYvtu9-qvssrP|y|;n6H--\f-ryr-\n----tylSntP|y|-J-rpA5OYNPXlP\\Y\\_;\b\t9-qvssrP|y|;n6H--\f--rp@-}n{|=a|crr-J-5|yq]|vv|{;\b\t-:-}n{|=lznvh@j;\b\t6-7-zn@5}n{|=lznv6H--rp@-}n{|>a|crr-J-5|yq]|vv|{;\b\t-:-}n{|>lznvh@j;\b\t6-7-zn@5}n{|>lznv6H--rpA-}n{|P|y|H--rpA-}n{|=P|y|-J-rrPor5}n{|=lzn}9-}n{|=a|crr6H--rpA-}n{|>P|y|-J-rrPor5}n{|>lzn}9-}n{|>a|crr6H--0vs-qrsv{rq5b`RlYbZV[N[PR6----}n{|=P|y|;n-J->;=-:-rrPor5}n{|=lyzv{n{prZn}9-}n{|=a|crr6;H----}n{|>P|y|;n-J->;=-:-rrPor5}n{|>lyzv{n{prZn}9-}n{|>a|crr6;H--0r{qvs--0vs-qrsv{rq5b`RlOYNPXla_N[`VaV\\[6----sy|n-oynpx]|tr-J-np|5:?;=-7-}|tr-8->;=6H----}n{|P|y|-J-zv5}n{|=P|y|9-OYNPXlP\\Y\\_9-zv{5>;=9-oynpx]|tr66H----}n{|P|y|-J-zv5}n{|P|y|9-}n{|>P|y|9-zn5=;=9-oynpx]|tr-:-?;=66H--0ryr----}n{|P|y|-J-zv5}n{|=P|y|9-}n{|>P|y|9-}|tr6H--0r{qvs--0vs-qrsv{rq5b`Rl]N[\\lcVQR\\6----rp@-pnzrna|crr-J-|yq]|vv|{;\b\t-:-pnzrn]|vv|{H----rpA-zn}P||q-J-rpA5pnzrna|crr9->;=6-7-}n{|cvqr|lznvH----rp?--J-rp?5------=;B-8-zn}P||q;-<-zn}P||q;\t-<-}n{|cvqr|lv\tr;9------=;B-:-zn}P||q;\b-<-zn}P||q;\t-<-}n{|cvqr|lv\tr;\b----6H----rpA-vqr|P|y|-J-rr?Q5}n{|cvqr|lzn}9-6H----sy|n-znpu-J-5>;=-:-r}5=;=9-zn}P||q;\t66-7-5>;=-:-r}5=;B9-no5;-:-=;B666-7-5>;=-:-r}5=;B9-no5;\b-:-=;B666H----sy|n-ny}un-J-pynz}5=;=9->;=9-B;=-7-5>;=-:-pynz}5qvn{pr59-rp?5=;B9-=;B66-<-=;BB-9-=;=9->;=666H----}n{|P|y|-J-zv5}n{|P|y|9-vqr|P|y|9-znpu-7-ny}un-7-}n{|cvqr|lny}un6H--0r{qvs--0vs-qrsv{rq5b`Rl]N[\\l\\]NPVaf6----tylSntP|y|-J-zv5}n{|P|y|9-tylSntP|y|9-z|qryNy}un6H----tylSntP|y|;n-J-|}npv\bH--0ryr----tylSntP|y|-J-rpA5tylSntP|y|;to9-|}npv\b6H----tylSntP|y|-J-zv5}n{|P|y|9-tylSntP|y|9-z|qryNy}un6H--0r{qvs\f"),li=new n.WebGLCubeRenderTarget(1).texture;li.name="EMPTY_TEXTURE";var ui=Object.assign({modelAlpha:new n.Uniform(0),progress:new n.Uniform(0),pano0_map:new n.Uniform(li),pano0_luminanceMap:new n.Uniform(null),pano0_matrix:new n.Uniform(new n.Matrix4),pano1_map:new n.Uniform(li),pano1_luminanceMap:new n.Uniform(null),pano1_matrix:new n.Uniform(new n.Matrix4),floorIndex:-1,floorInfo:new n.Vector3(0,0,0),clipperPlanesArray:new Float32Array,clipperFloors:[],modelColorInfo:new n.Uniform(null)},{exposure:new n.Uniform(1),emissive:new n.Uniform(new n.Color(0)),emissiveMap:new n.Uniform(null),specular:new n.Uniform(new n.Color(1118481)),specularMap:new n.Uniform(null),normalMap:new n.Uniform(null),bumpMap:new n.Uniform(null),shininess:new n.Uniform(30)},n.UniformsUtils.clone(n.UniformsLib.common),n.UniformsUtils.clone(n.UniformsLib.lights)),ci=function(e){function t(t){void 0===t&&(t={});var i,r,o,s,a,l,u,c,h,d=this;d=e.call(this,{vertexShader:si,fragmentShader:ai,uniforms:n.UniformsUtils.clone(ui),defines:{USE_MAP:!0,USE_UV:!0,USE_LUMINANCE:!1,USE_PANO_OPACITY:!1,USE_BLACK_TRANSITION:!1,USE_PANO_VIDEO:!1,USE_ALL_COLOR:!1,USE_CLIPFLOOR:!1,USE_CUTER:!1,NUM_CLIPPING_ARRAY_LENGTH:0,NUM_CLIPPING_BOX:0},blending:n.NoBlending,lights:!0})||this;var p=null,f=null;return Object.defineProperties(d,{pano0:{get:function(){return p},set:function(e){p=e,null===e?(this.uniforms.pano0_map.value=li,this.uniforms.pano0_luminanceMap.value=null,this.uniforms.pano0_matrix.value.identity()):(this.uniforms.pano0_map.value=e.map instanceof ri?e.map.texture:e.map,this.uniforms.pano0_luminanceMap.value=e.luminanceMap instanceof ri?e.luminanceMap.texture:e.luminanceMap,this.uniforms.pano0_matrix.value.copy(e.matrix));var t=null!==this.uniforms.pano0_luminanceMap.value&&null!==this.uniforms.pano1_luminanceMap.value;this.defines.USE_LUMINANCE!==t&&(this.defines.USE_LUMINANCE=t,this.needsUpdate=!0)}},pano1:{get:function(){return f},set:function(e){f=e,null===e?(this.uniforms.pano1_map.value=li,this.uniforms.pano1_luminanceMap.value=null,this.uniforms.pano1_matrix.value.identity()):(this.uniforms.pano1_map.value=e.map instanceof ri?e.map.texture:e.map,this.uniforms.pano1_luminanceMap.value=e.luminanceMap instanceof ri?e.luminanceMap.texture:e.luminanceMap,this.uniforms.pano1_matrix.value.copy(e.matrix));var t=null!==this.uniforms.pano0_luminanceMap.value&&null!==this.uniforms.pano1_luminanceMap.value;this.defines.USE_LUMINANCE!==t&&(this.defines.USE_LUMINANCE=t,this.needsUpdate=!0)}},modelAlpha:{get:function(){return this.uniforms.modelAlpha.value},set:function(e){this.uniforms.modelAlpha.value=e}},progress:{get:function(){return this.uniforms.progress.value},set:function(e){this.uniforms.progress.value=e}},useBlackTransition:{get:function(){return this.defines.USE_BLACK_TRANSITION},set:function(e){this.defines.USE_BLACK_TRANSITION!==e&&(this.defines.USE_BLACK_TRANSITION=e,this.needsUpdate=!0)}},modelColorInfo:{get:function(){return this.uniforms.modelColorInfo.value},set:function(e){null===e?this.defines.USE_ALL_COLOR=!1:(this.defines.USE_ALL_COLOR=!0,this.uniforms.modelColorInfo.value=e),this.needsUpdate=!0}},opacity:{get:function(){return this.uniforms.opacity.value},set:function(e){this.uniforms.opacity.value=e;var t=e<1?n.NormalBlending:n.NoBlending;t!==this.blending&&(this.blending=t,this.needsUpdate=!0)}},floorIndex:{get:function(){return this.uniforms.floorIndex.value},set:function(e){this.uniforms.floorIndex.value=e}},floorInfo:{get:function(){return this.uniforms.floorInfo.value},set:function(e){e&&e.equals(new n.Vector3(0,0,0))&&(this.defines.USE_CLIPFLOOR=!1,this.needsUpdate=!0),e&&!e.equals(new n.Vector3(0,0,0))&&(this.defines.USE_CLIPFLOOR=!0,this.uniforms.floorInfo.value=e,this.needsUpdate=!0)}},clippers:{get:function(){return this._clippers},set:function(e){this._clippers=e}},clipperPlanesArray:{get:function(){return this.uniforms.clipperPlanesArray.value},set:function(e){if(e instanceof Float32Array&&e.length>0&&e.length%6==0){var t=e.length/4;this.defines.USE_CUTER=!0,this.defines.NUM_CLIPPING_ARRAY_LENGTH=t,this.defines.NUM_CLIPPING_BOX=t/6,this.uniforms.clipperPlanesArray.value=e,this.needsUpdate=!0}else this.defines.USE_CUTER=!1,this.defines.NUM_CLIPPING_ARRAY_LENGTH=0,this.defines.NUM_CLIPPING_BOX=0,this.uniforms.clipperPlanesArray.value=new Float32Array,this.needsUpdate=!0}},clipperFloors:{get:function(){return this.uniforms.clipperFloors.value},set:function(e){this.uniforms.clipperFloors.value=e}}}),d.pano0=null!==(i=t.pano0)&&void 0!==i?i:null,d.pano1=null!==(r=t.pano1)&&void 0!==r?r:null,d.modelAlpha=null!==(o=t.modelAlpha)&&void 0!==o?o:1,d.progress=null!==(s=t.progress)&&void 0!==s?s:0,d.useBlackTransition=null!==(a=t.useBlackTransition)&&void 0!==a&&a,d.modelColorInfo=null!==(l=t.modelColorInfo)&&void 0!==l?l:null,d.opacity=null!==(u=t.opacity)&&void 0!==u?u:1,d.originOpacity=1,d.floorIndex=null!==(c=t.floorIndex)&&void 0!==c?c:-1,d.floorInfo=null!==(h=t.floorInfo)&&void 0!==h?h:null,d.clippers=null,d.clipperPlanesArray=null,d.clipperFloors=null,d}return ke(t,e),t}(n.ShaderMaterial),hi=function(e){function t(t){var i=t.preserveDrawingBuffer,r=void 0===i||i,o=t.backgroundColor,s=void 0===o?1579548:o,a=t.backgroundAlpha,l=void 0===a?1:a,u=t.pixelRatio,c=void 0===u?1:u,h=t.antialias,d=void 0!==h&&h,p=t.webgl2,f=this;if(void 0!==p&&p){var A=document.createElement("canvas"),m=A.getContext("webgl2");if(null===m)throw new Error("error occurred when getting webgl2 canvas context");f=e.call(this,{antialias:d,preserveDrawingBuffer:r,alpha:l<1,canvas:A,context:m})||this}else f=e.call(this,{antialias:d,preserveDrawingBuffer:r,alpha:l<1})||this;return f.setPixelRatio(c),f.setClearColor(s,l),f.outputEncoding=n.sRGBEncoding,f.autoClear=!0,f}return ke(t,e),t}(n.WebGLRenderer),di=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return ke(t,e),t.prototype.add=function(){for(var t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];return e.prototype.add.apply(this,t)},t.prototype.remove=function(){for(var t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];return e.prototype.remove.apply(this,t)},t}(n.Scene);var pi=2*Math.PI,fi=Math.PI/2;function Ai(e){return e>0&&e<=pi?e:(e%pi+pi)%pi}var mi,gi,vi,yi,bi=function(e){function t(t,i,r,o,s,a){void 0===i&&(i=1),void 0===r&&(r=.1),void 0===o&&(o=1e3),void 0===s&&(s=new n.Vector2),void 0===a&&(a=1);var l=e.call(this)||this;l.fov=t,l.aspect=i,l.near=r,l.far=o,l.perspToOrtho=s,l.orthoDistance=a,l.needsRender=!0,l.pose={longitude:0,latitude:0,fov:t,distance:0,offset:new n.Vector3},l.computePose(),l.perspectiveCamera=new n.PerspectiveCamera(l.fov,l.aspect,l.near,l.far);var u=Math.max(l.orthoDistance,.01)*Math.tan(.5*l.fov/180*Math.PI),c=-.5*l.aspect*2*u;return l.orthographicCamera=new n.OrthographicCamera(c,-c,u,-u,l.near,l.far),l.computeProjectionMatrix(),l.lastValues={position:l.position.clone(),quaternion:l.quaternion.clone(),scale:l.scale.clone(),fov:l.fov,aspect:l.aspect,near:l.near,far:l.far,perspToOrtho:l.perspToOrtho.clone(),orthoDistance:l.orthoDistance},l}return ke(t,e),t.prototype.computePose=function(){var e=this.getWorldDirection(new n.Vector3);return this.pose.longitude=Ai(-Math.atan2(e.x,-e.z)),this.pose.latitude=-Math.asin(e.y/1),this.pose.fov=this.fov,this.pose.distance=0,this.pose.offset.copy(this.position),this},t.prototype.setFromPose=function(e){var t,i,r,o,s,a=Ai(null!==(t=e.longitude)&&void 0!==t?t:this.pose.longitude),l=Math.max(1e-4-fi,Math.min(fi-1e-4,null!==(i=e.latitude)&&void 0!==i?i:this.pose.latitude)),u=null!==(r=e.fov)&&void 0!==r?r:this.pose.fov,c=null!==(o=e.distance)&&void 0!==o?o:this.pose.distance,h=null!==(s=e.offset)&&void 0!==s?s:this.pose.offset,d=function(e){var t=Math.abs(Math.cos(e.latitude));return new n.Vector3(-Math.sin(e.longitude)*t,-Math.sin(e.latitude),-Math.cos(e.longitude)*t)}({longitude:a,latitude:l}).normalize();return this.position.set(0,0,0),this.lookAt(d),this.position.add(h).sub(d.clone().setLength(c)),this.fov!==u&&(this.fov=u,this.updateProjectionMatrix()),this.updateMatrixWorld(),this.pose.longitude=a,this.pose.latitude=l,this.pose.fov=u,this.pose.distance=c,this.pose.offset.copy(h),this.needsRender=!0,this},t.prototype.copyPose=function(){return{longitude:this.pose.longitude,latitude:this.pose.latitude,fov:this.pose.fov,distance:this.pose.distance,offset:this.pose.offset.clone()}},t.prototype.computeProjectionMatrix=function(){!function(e,t,i,n){i=Math.pow(i,2);for(var r=0;r<16;r++)n.elements[r]=e.elements[r]+(t.elements[r]-e.elements[r])*i}(this.orthographicCamera.projectionMatrix,this.perspectiveCamera.projectionMatrix,1-this.perspToOrtho.x,this.projectionMatrix),this.projectionMatrixInverse.getInverse(this.projectionMatrix),this.needsRender=!0},t.prototype.setViewOffset=function(e,t,i,n,r,o){this.perspectiveCamera.setViewOffset(e,t,i,n,r,o),this.orthographicCamera.setViewOffset(e,t,i,n,r,o),this.computeProjectionMatrix()},t.prototype.clearViewOffset=function(){this.perspectiveCamera.clearViewOffset(),this.orthographicCamera.clearViewOffset(),this.computeProjectionMatrix()},t.prototype.updateProjectionMatrix=function(){this.perspectiveCamera.updateProjectionMatrix(),this.orthographicCamera.updateProjectionMatrix(),this.computeProjectionMatrix()},Object.defineProperty(t.prototype,"perspectiveProjectionMatrix",{get:function(){return this.perspectiveCamera.projectionMatrix},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"perspectiveProjectionMatrixInverse",{get:function(){return this.perspectiveCamera.projectionMatrixInverse},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"orthographicProjectionMatrix",{get:function(){return this.orthographicCamera.projectionMatrix},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"orthographicProjectionMatrixInverse",{get:function(){return this.orthographicCamera.projectionMatrixInverse},enumerable:!1,configurable:!0}),t.prototype.updateTime=function(e,t){var i=!1;if(this.lastValues.fov===this.fov&&this.lastValues.near===this.near&&this.lastValues.far===this.far&&this.lastValues.aspect===this.aspect||(this.perspectiveCamera.fov=this.fov,this.perspectiveCamera.near=this.near,this.perspectiveCamera.far=this.far,this.perspectiveCamera.aspect=this.aspect,this.perspectiveCamera.updateProjectionMatrix(),i=!0),!this.lastValues.position.equals(this.position)||!this.lastValues.quaternion.equals(this.quaternion)||!this.lastValues.scale.equals(this.scale)||this.lastValues.orthoDistance!==this.orthoDistance||this.lastValues.fov!==this.fov||this.lastValues.near!==this.near||this.lastValues.far!==this.far||this.lastValues.aspect!==this.aspect){var n=Math.max(this.orthoDistance,.01)*Math.tan(.5*this.fov/180*Math.PI),r=-.5*this.aspect*2*n;this.orthographicCamera.left=r,this.orthographicCamera.right=-r,this.orthographicCamera.top=n,this.orthographicCamera.bottom=-n,this.orthographicCamera.updateProjectionMatrix(),i=!0}this.lastValues.perspToOrtho.equals(this.perspToOrtho)||(i=!0),i&&this.computeProjectionMatrix(),this.lastValues.position.copy(this.position),this.lastValues.quaternion.copy(this.quaternion),this.lastValues.scale.copy(this.scale),this.lastValues.fov=this.fov,this.lastValues.aspect=this.aspect,this.lastValues.near=this.near,this.lastValues.far=this.far,this.lastValues.perspToOrtho.copy(this.perspToOrtho),this.lastValues.orthoDistance=this.orthoDistance},Object.defineProperty(t.prototype,"isPerspectiveCamera",{get:function(){return this.perspToOrtho.x<1},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isOrthographicCamera",{get:function(){return this.perspToOrtho.x>=1},enumerable:!1,configurable:!0}),t.prototype.copy=function(t,i){return e.prototype.copy.call(this,t,i),this.fov=t.fov,this.aspect=t.aspect,this.near=t.near,this.far=t.far,this.perspToOrtho.copy(t.perspToOrtho),this.orthoDistance=t.orthoDistance,this.updateTime(Ue(),0),this},t}(n.Camera),xi=function(){function e(e,t,i){this.x=e,this.y=t,this.z=i}return e.prototype.copy=function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this},e.prototype.set=function(e,t,i){return this.x=e,this.y=t,this.z=i,this},e.prototype.fromArray=function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this},e.prototype.add=function(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this},e.prototype.multiplyScalar=function(e){return this.x*=e,this.y*=e,this.z*=e,this},e.prototype.subVectors=function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this},e.prototype.dot=function(e){return this.x*e.x+this.y*e.y+this.z*e.z},e.prototype.cross=function(e){var t=this.x,i=this.y,n=this.z;return this.x=i*e.z-n*e.y,this.y=n*e.x-t*e.z,this.z=t*e.y-i*e.x,this},e.prototype.crossVectors=function(e,t){var i=e.x,n=e.y,r=e.z,o=t.x,s=t.y,a=t.z;return this.x=n*a-r*s,this.y=r*o-i*a,this.z=i*s-n*o,this},e.prototype.clone=function(){return new e(this.x,this.y,this.z)},e}(),wi=function(e,t,i){this.extents=e,this.startIndex=t,this.endIndex=i},Ei=function(e,t){this.triangle=e,this.intersectionPoint=t},Mi=(mi=new xi(0,0,0),gi=new xi(0,0,0),vi=new xi(0,0,0),yi=new xi(0,0,0),function(e,t,i,n,r,o){gi.subVectors(t,e),vi.subVectors(i,e),yi.crossVectors(gi,vi);var s,a=r.dot(yi);if(a>0){if(o)return null;s=1}else{if(!(a<0))return null;s=-1,a=-a}mi.subVectors(n,e);var l=s*r.dot(vi.crossVectors(mi,vi));if(l<0)return null;var u=s*r.dot(gi.cross(mi));if(u<0)return null;if(l+u>a)return null;var c=-s*mi.dot(yi);if(c<0)return null;var h=c/a;return new xi(0,0,0).copy(r).multiplyScalar(h).add(n)}),Si=function(e,t){this.min=e,this.max=t};function Ci(e,t,i){var n=new Si(0,0);t.x>=0?(n.min=(i.extents[0]-e.x)*t.x,n.max=(i.extents[3]-e.x)*t.x):(n.min=(i.extents[3]-e.x)*t.x,n.max=(i.extents[0]-e.x)*t.x);var r=new Si(0,0);if(t.y>=0?(r.min=(i.extents[1]-e.y)*t.y,r.max=(i.extents[4]-e.y)*t.y):(r.min=(i.extents[4]-e.y)*t.y,r.max=(i.extents[1]-e.y)*t.y),n.min>r.max||r.min>n.max)return!1;r.min>n.min&&(n.min=r.min),r.max<n.max&&(n.max=r.max);var o=new Si(0,0);return t.z>=0?(o.min=(i.extents[2]-e.z)*t.z,o.max=(i.extents[5]-e.z)*t.z):(o.min=(i.extents[5]-e.z)*t.z,o.max=(i.extents[2]-e.z)*t.z),!(n.min>o.max||o.min>n.max)&&(o.min>n.min&&(n.min=o.min),o.max<n.max&&(n.max=o.max),!(n.max<0))}function Ii(e,t,i,n,r){if(i>=n)return[0,0,0,0,0,0];for(var o=1/0,s=1/0,a=1/0,l=-1/0,u=-1/0,c=-1/0,h=i,d=void 0,p=void 0;h<n;h++)(p=t[d=6*e[h]])<o&&(o=p),(p=t[d+1])<s&&(s=p),(p=t[d+2])<a&&(a=p),(p=t[d+3])>l&&(l=p),(p=t[d+4])>u&&(u=p),(p=t[d+5])>c&&(c=p);return[o-r,s-r,a-r,l+r,u+r,c+r]}var Bi=function(){function e(){}return e.prototype.create=function(e){return this.trianglesArray=e,this},e.prototype.splitNode=function(e){if(!this.trianglesArray)throw new Error("bvh-tree never perpared. call `create` to initialize.");for(var t=this.trianglesArray,i=t.length/9,n=new Uint32Array(i),r=new Float32Array(6*i),o=[],s=1/0,a=1/0,l=1/0,u=-1/0,c=-1/0,h=-1/0,d=0,p=0,f=0,A=void 0,m=void 0,g=void 0,v=void 0,y=void 0,b=void 0,x=void 0;d<i;d++,p+=6,f+=9)n[d]=d,A=v=t[f],(x=t[f+3])<A&&(A=x),x>v&&(v=x),(x=t[f+6])<A&&(A=x),x>v&&(v=x),m=y=t[f+1],(x=t[f+4])<m&&(m=x),x>y&&(y=x),(x=t[f+7])<m&&(m=x),x>y&&(y=x),g=b=t[f+2],(x=t[f+5])<g&&(g=x),x>b&&(b=x),(x=t[f+8])<g&&(g=x),x>b&&(b=x),A<s&&(s=A),v>u&&(u=v),m<a&&(a=m),y>c&&(c=y),g<l&&(l=g),b>h&&(h=b),r[p]=A,r[p+1]=m,r[p+2]=g,r[p+3]=v,r[p+4]=y,r[p+5]=b;var w,E=new wi([s,a,l,u,c,h],0,i);function M(t){for(var i=t.startIndex,s=t.endIndex,a=t.extents,l=[a[3]-a[0],a[4]-a[1],a[5]-a[2]],u=[0,1,2].sort((function(e,t){return l[t]-l[e]})),c=0;c<3;c++){for(var h=u[c],d=a[h]+a[h+3],p=i,f=s-1,A=-1,m=void 0;p<=f;)-1===A?(m=n[p],r[6*m+h]+r[6*m+h+3]<d?p++:A=m):(m=n[f],r[6*m+h]+r[6*m+h+3]>=d||(n[p]=m,n[f]=A,A=-1,p++),f--);if(p>i&&p<s){var g=new wi(Ii(n,r,i,p,1e-6),i,p);g.endIndex-g.startIndex>e&&o.push(g);var v=new wi(Ii(n,r,p,s,1e-6),p,s);v.endIndex-v.startIndex>e&&o.push(v),t.node0=g,t.node1=v,t.startIndex=0,t.endIndex=0;break}}}for(o.push(E);w=o.pop();)M(w);return this.offsetArray=n,this.rootNode=E,this},e.prototype.intersectRay=function(e,t,i){if(!this.trianglesArray)throw new Error("bvh-tree never perpared. call `create` to initialize.");if(!this.rootNode||!this.offsetArray)throw new Error("bvh-tree never perpared. call `splitNode` to perpare.");for(var n,r=this.trianglesArray,o=this.offsetArray,s=this.rootNode,a=[],l=[],u=new xi(1/t.x,1/t.y,1/t.z),c=[s];n=c.pop();)if(Ci(e,u,n)){n.node0&&c.push(n.node0),n.node1&&c.push(n.node1);for(var h=n.startIndex;h<n.endIndex;h++)a.push(o[h])}for(var d=new xi(0,0,0),p=new xi(0,0,0),f=new xi(0,0,0),A=new xi(e.x,e.y,e.z),m=new xi(t.x,t.y,t.z),g=(h=0,void 0),v=a.length;h<v;h++){g=9*a[h],d.x=r[g],d.y=r[g+1],d.z=r[g+2],p.x=r[g+3],p.y=r[g+3+1],p.z=r[g+3+2],f.x=r[g+6],f.y=r[g+6+1],f.z=r[g+6+2];var y=Mi(d,p,f,A,m,i);y&&l.push(new Ei([d.clone(),p.clone(),f.clone()],y))}return l},e.prototype.dispose=function(){delete this.offsetArray,delete this.rootNode},e}(),Ti=!1,Pi=[];function Ri(e){if(void 0===e&&(e=!1),e||!Ti){Ti=!0;var t=Pi.shift();if(t){try{t()}catch(e){}dt.shared.add((function(){return Ri(!0)}),!0,2)}else Ti=!1}}function Di(e){return new Promise((function(t,i){Pi.push((function(){try{t(e())}catch(e){i(e)}})),Ri()}))}function Li(){var e={OutWindow:function(){this._windowSize=0}};return e.OutWindow.prototype.create=function(e){this._buffer&&this._windowSize===e||(this._buffer=[]),this._windowSize=e,this._pos=0,this._streamPos=0},e.OutWindow.prototype.flush=function(){var e=this._pos-this._streamPos;if(0!==e){for(;e--;)this._stream.writeByte(this._buffer[this._streamPos++]);this._pos>=this._windowSize&&(this._pos=0),this._streamPos=this._pos}},e.OutWindow.prototype.releaseStream=function(){this.flush(),this._stream=null},e.OutWindow.prototype.setStream=function(e){this.releaseStream(),this._stream=e},e.OutWindow.prototype.init=function(e){e||(this._streamPos=0,this._pos=0)},e.OutWindow.prototype.copyBlock=function(e,t){var i=this._pos-e-1;for(i<0&&(i+=this._windowSize);t--;)i>=this._windowSize&&(i=0),this._buffer[this._pos++]=this._buffer[i++],this._pos>=this._windowSize&&this.flush()},e.OutWindow.prototype.putByte=function(e){this._buffer[this._pos++]=e,this._pos>=this._windowSize&&this.flush()},e.OutWindow.prototype.getByte=function(e){var t=this._pos-e-1;return t<0&&(t+=this._windowSize),this._buffer[t]},e.RangeDecoder=function(){},e.RangeDecoder.prototype.setStream=function(e){this._stream=e},e.RangeDecoder.prototype.releaseStream=function(){this._stream=null},e.RangeDecoder.prototype.init=function(){var e=5;for(this._code=0,this._range=-1;e--;)this._code=this._code<<8|this._stream.readByte()},e.RangeDecoder.prototype.decodeDirectBits=function(e){for(var t,i=0,n=e;n--;)this._range>>>=1,t=this._code-this._range>>>31,this._code-=this._range&t-1,i=i<<1|1-t,0==(4278190080&this._range)&&(this._code=this._code<<8|this._stream.readByte(),this._range<<=8);return i},e.RangeDecoder.prototype.decodeBit=function(e,t){var i=e[t],n=(this._range>>>11)*i;return(2147483648^this._code)<(2147483648^n)?(this._range=n,e[t]+=2048-i>>>5,0==(4278190080&this._range)&&(this._code=this._code<<8|this._stream.readByte(),this._range<<=8),0):(this._range-=n,this._code-=n,e[t]-=i>>>5,0==(4278190080&this._range)&&(this._code=this._code<<8|this._stream.readByte(),this._range<<=8),1)},e.initBitModels=function(e,t){for(;t--;)e[t]=1024},e.BitTreeDecoder=function(e){this._models=[],this._numBitLevels=e},e.BitTreeDecoder.prototype.init=function(){e.initBitModels(this._models,1<<this._numBitLevels)},e.BitTreeDecoder.prototype.decode=function(e){for(var t=1,i=this._numBitLevels;i--;)t=t<<1|e.decodeBit(this._models,t);return t-(1<<this._numBitLevels)},e.BitTreeDecoder.prototype.reverseDecode=function(e){for(var t,i=1,n=0,r=0;r<this._numBitLevels;++r)i=i<<1|(t=e.decodeBit(this._models,i)),n|=t<<r;return n},e.reverseDecode2=function(e,t,i,n){for(var r,o=1,s=0,a=0;a<n;++a)o=o<<1|(r=i.decodeBit(e,t+o)),s|=r<<a;return s},e.LenDecoder=function(){this._choice=[],this._lowCoder=[],this._midCoder=[],this._highCoder=new e.BitTreeDecoder(8),this._numPosStates=0},e.LenDecoder.prototype.create=function(t){for(;this._numPosStates<t;++this._numPosStates)this._lowCoder[this._numPosStates]=new e.BitTreeDecoder(3),this._midCoder[this._numPosStates]=new e.BitTreeDecoder(3)},e.LenDecoder.prototype.init=function(){var t=this._numPosStates;for(e.initBitModels(this._choice,2);t--;)this._lowCoder[t].init(),this._midCoder[t].init();this._highCoder.init()},e.LenDecoder.prototype.decode=function(e,t){return 0===e.decodeBit(this._choice,0)?this._lowCoder[t].decode(e):0===e.decodeBit(this._choice,1)?8+this._midCoder[t].decode(e):16+this._highCoder.decode(e)},e.Decoder2=function(){this._decoders=[]},e.Decoder2.prototype.init=function(){e.initBitModels(this._decoders,768)},e.Decoder2.prototype.decodeNormal=function(e){var t=1;do{t=t<<1|e.decodeBit(this._decoders,t)}while(t<256);return 255&t},e.Decoder2.prototype.decodeWithMatchByte=function(e,t){var i,n,r=1;do{if(i=t>>7&1,t<<=1,r=r<<1|(n=e.decodeBit(this._decoders,(1+i<<8)+r)),i!==n){for(;r<256;)r=r<<1|e.decodeBit(this._decoders,r);break}}while(r<256);return 255&r},e.LiteralDecoder=function(){},e.LiteralDecoder.prototype.create=function(t,i){var n;if(!this._coders||this._numPrevBits!==i||this._numPosBits!==t)for(this._numPosBits=t,this._posMask=(1<<t)-1,this._numPrevBits=i,this._coders=[],n=1<<this._numPrevBits+this._numPosBits;n--;)this._coders[n]=new e.Decoder2},e.LiteralDecoder.prototype.init=function(){for(var e=1<<this._numPrevBits+this._numPosBits;e--;)this._coders[e].init()},e.LiteralDecoder.prototype.getDecoder=function(e,t){return this._coders[((e&this._posMask)<<this._numPrevBits)+((255&t)>>>8-this._numPrevBits)]},e.Decoder=function(){this._outWindow=new e.OutWindow,this._rangeDecoder=new e.RangeDecoder,this._isMatchDecoders=[],this._isRepDecoders=[],this._isRepG0Decoders=[],this._isRepG1Decoders=[],this._isRepG2Decoders=[],this._isRep0LongDecoders=[],this._posSlotDecoder=[],this._posDecoders=[],this._posAlignDecoder=new e.BitTreeDecoder(4),this._lenDecoder=new e.LenDecoder,this._repLenDecoder=new e.LenDecoder,this._literalDecoder=new e.LiteralDecoder,this._dictionarySize=-1,this._dictionarySizeCheck=-1,this._posSlotDecoder[0]=new e.BitTreeDecoder(6),this._posSlotDecoder[1]=new e.BitTreeDecoder(6),this._posSlotDecoder[2]=new e.BitTreeDecoder(6),this._posSlotDecoder[3]=new e.BitTreeDecoder(6)},e.Decoder.prototype.setDictionarySize=function(e){return!(e<0)&&(this._dictionarySize!==e&&(this._dictionarySize=e,this._dictionarySizeCheck=Math.max(this._dictionarySize,1),this._outWindow.create(Math.max(this._dictionarySizeCheck,4096))),!0)},e.Decoder.prototype.setLcLpPb=function(e,t,i){var n=1<<i;return!(e>8||t>4||i>4)&&(this._literalDecoder.create(t,e),this._lenDecoder.create(n),this._repLenDecoder.create(n),this._posStateMask=n-1,!0)},e.Decoder.prototype.init=function(){var t=4;for(this._outWindow.init(!1),e.initBitModels(this._isMatchDecoders,192),e.initBitModels(this._isRep0LongDecoders,192),e.initBitModels(this._isRepDecoders,12),e.initBitModels(this._isRepG0Decoders,12),e.initBitModels(this._isRepG1Decoders,12),e.initBitModels(this._isRepG2Decoders,12),e.initBitModels(this._posDecoders,114),this._literalDecoder.init();t--;)this._posSlotDecoder[t].init();this._lenDecoder.init(),this._repLenDecoder.init(),this._posAlignDecoder.init(),this._rangeDecoder.init()},e.Decoder.prototype.decode=function(t,i,n){var r,o,s,a,l,u,c=0,h=0,d=0,p=0,f=0,A=0,m=0;for(this._rangeDecoder.setStream(t),this._outWindow.setStream(i),this.init();n<0||A<n;)if(r=A&this._posStateMask,0===this._rangeDecoder.decodeBit(this._isMatchDecoders,(c<<4)+r))o=this._literalDecoder.getDecoder(A++,m),m=c>=7?o.decodeWithMatchByte(this._rangeDecoder,this._outWindow.getByte(h)):o.decodeNormal(this._rangeDecoder),this._outWindow.putByte(m),c=c<4?0:c-(c<10?3:6);else{if(1===this._rangeDecoder.decodeBit(this._isRepDecoders,c))s=0,0===this._rangeDecoder.decodeBit(this._isRepG0Decoders,c)?0===this._rangeDecoder.decodeBit(this._isRep0LongDecoders,(c<<4)+r)&&(c=c<7?9:11,s=1):(0===this._rangeDecoder.decodeBit(this._isRepG1Decoders,c)?a=d:(0===this._rangeDecoder.decodeBit(this._isRepG2Decoders,c)?a=p:(a=f,f=p),p=d),d=h,h=a),0===s&&(s=2+this._repLenDecoder.decode(this._rangeDecoder,r),c=c<7?8:11);else if(f=p,p=d,d=h,s=2+this._lenDecoder.decode(this._rangeDecoder,r),c=c<7?7:10,(l=this._posSlotDecoder[s<=5?s-2:3].decode(this._rangeDecoder))>=4){if(h=(2|1&l)<<(u=(l>>1)-1),l<14)h+=e.reverseDecode2(this._posDecoders,h-l-1,this._rangeDecoder,u);else if(h+=this._rangeDecoder.decodeDirectBits(u-4)<<4,(h+=this._posAlignDecoder.reverseDecode(this._rangeDecoder))<0){if(-1===h)break;return!1}}else h=l;if(h>=A||h>=this._dictionarySizeCheck)return!1;this._outWindow.copyBlock(h,s),A+=s,m=this._outWindow.getByte(0)}return this._outWindow.flush(),this._outWindow.releaseStream(),this._rangeDecoder.releaseStream(),!0},e.Decoder.prototype.setDecoderProperties=function(e){var t,i,n,r,o;return!(e.size<5)&&(i=(t=e.readByte())%9,n=(t=~~(t/9))%5,r=~~(t/5),!!this.setLcLpPb(i,n,r)&&(o=e.readByte(),o|=e.readByte()<<8,o|=e.readByte()<<16,o+=16777216*e.readByte(),this.setDictionarySize(o)))},e.decompress=function(t,i,n,r){var o=new e.Decoder;if(!o.setDecoderProperties(t))throw"Incorrect stream properties";if(!o.decode(i,n,r))throw"Error in data stream";return!0},e.decompressFile=function(t,i){var n,r=new e.Decoder;if(!r.setDecoderProperties(t))throw"Incorrect stream properties";if(n=t.readByte(),n|=t.readByte()<<8,n|=t.readByte()<<16,n+=16777216*t.readByte(),t.readByte(),t.readByte(),t.readByte(),t.readByte(),!r.decode(t,i,n))throw"Error in data stream";return!0},e}var ki=Li();var Fi="\nvar decodeLZMA = (function() {\n var LZMA = (".concat(Li.toString(),")();\n return function(data, callback) {\n return (").concat(function(e,t,i){try{var n={data:t,offset:0,readByte:function(){return this.data[this.offset++]}},r=n.data.length,o={data:[],offset:0,writeByte:function(e){var t=Math.floor(this.offset/r);this.data[t]||(this.data[t]=new Uint8Array(r)),this.data[t][this.offset%r]=e,this.offset++}};e.decompressFile(n,o);for(var s=new Uint8Array(o.offset),a=0;a<o.offset;a++)s[a]=o.data[Math.floor(a/r)][a%r];i(null,s)}catch(e){i(e)}}.toString(),")(LZMA, data, callback);\n }\n})();\n\nvar decodeLZMAWithWASM = (function() {\n var LZMA_WASM = (").concat(function(){return function(e){for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=new Uint8Array(256),n=0;n<t.length;n++)i[t.charCodeAt(n)]=n;var r,o,s,a,l,u=.75*e.length,c=e.length,h=0;"="===e[e.length-1]&&(u--,"="===e[e.length-2]&&u--);var d=new ArrayBuffer(u),p=new Uint8Array(d);for(r=0;r<c;r+=4)o=i[e.charCodeAt(r)],s=i[e.charCodeAt(r+1)],a=i[e.charCodeAt(r+2)],l=i[e.charCodeAt(r+3)],p[h++]=o<<2|s>>4,p[h++]=(15&s)<<4|a>>2,p[h++]=(3&a)<<6|63&l;return d}("AGFzbQEAAAABSg1gAABgAX8Bf2ACf38Bf2AEf39/fwBgA39/fwBgAX8AYAJ/fwBgA39/fwF/YAR/f39/AX9gAn9/AGABfwF/YAABf2AEf39/fwF/AhsCA2VudgVhYm9ydAADA2VudgZtZW1vcnkCAAEDJiUBAQkKAgoKCwsLCwsAAgoBAgQKAQYFCAoFBQQEBwgCBwwCAQAABAQBcAABBhoFfwFBAAt/AUEAC38BQQALfwFBAAt/AUEACwc9BgZtZW1vcnkCAAV0YWJsZQEABXJlc2V0AA0KbmV3VThBcnJheQAQCnVucGFja1NpemUAFAZkZWNvZGUAIwgBJAkHAQBBAAsBJQqAViVoAQN/IABBgICAgARLBEAACyMBIgEgAEEBIABBAUsbakEHakF4cSICPwAiA0EQdEsEQCADIAIgAWtB//8DakGAgHxxQRB2IgAgAyAAShtAAEEASARAIABAAEEASARAAAsLCyACJAEgAQsbAQF/QQFBICAAQQdqZ2t0EAEiASAANgIAIAELkQMBAX8gAUUEQA8LIABBADoAACAAIAFqQQFrQQA6AAAgAUECTQRADwsgAEEBakEAOgAAIABBAmpBADoAACAAIAFqIgJBAmtBADoAACACQQNrQQA6AAAgAUEGTQRADwsgAEEDakEAOgAAIAAgAWpBBGtBADoAACABQQhNBEAPC0EAIABrQQNxIgIgAGoiAEEANgIAIAEgAmtBfHEiASAAakEEa0EANgIAIAFBCE0EQA8LIABBBGpBADYCACAAQQhqQQA2AgAgACABaiICQQxrQQA2AgAgAkEIa0EANgIAIAFBGE0EQA8LIABBDGpBADYCACAAQRBqQQA2AgAgAEEUakEANgIAIABBGGpBADYCACAAIAFqIgJBHGtBADYCACACQRhrQQA2AgAgAkEUa0EANgIAIAJBEGtBADYCACAAQQRxQRhqIgIgAGohACABIAJrIQEDQCABQSBPBEAgAEIANwMAIABBCGpCADcDACAAQRBqQgA3AwAgAEEYakIANwMAIAFBIGshASAAQSBqIQAMAQsLC1EBA38gAEH+////AEsEQEEAQSBBLUEnEAAACyAAQQJ0IgMQAiECQQgQASIBQQA2AgAgAUEANgIEIAEgAjYCACABIAA2AgQgAkEIaiADEAMgAQtmAQF/IAFB/P///wFLBEBBAEHAAEEXQSIQAAALIAFBAXQiARACIgJBCGogARADIABFBEBBDBABIQALIABBADYCACAAQQA2AgQgAEEANgIIIAAgAjYCACAAQQA2AgQgACABNgIIIAALCgBBDBABIAAQBQsuAQF/QQgQASIBQQA2AgAgAUEANgIEIAEgADYCBCABQQEgASgCBHQQBjYCACABC6EBAQR/QRAQASIBQQA2AgAgAUEANgIEIAFBADYCCCABQQA2AgxBEBAEIQIDQCAAQRBIBEBBAxAHIQMgAigCACAAQQJ0aiADNgIIIABBAWohAAwBCwsgASACNgIEQRAQBCECQQAhAANAIABBEEgEQEEDEAchAyACKAIAIABBAnRqIAM2AgggAEEBaiEADAELCyABIAI2AgggAUEIEAc2AgwgAQs0AQF/QRQQASIAQQA2AgAgAEEAOgAEIABBADYCCCAAQQA2AgwgAEEANgIQIABBDTYCCCAAC0IBAX9BGRABIgBBADYCACAAQQA2AgQgAEEANgIIIABBADYCDCAAQQA2AhAgAEEANgIUIABBADoAGCAAQQA2AhAgAAu1AgEEf0HQABABIgBBADoAACAAQQA2AgQgAEEANgIIIABBADYCDCAAQQA2AhAgAEEAOgAUIABBADYCGCAAQQA2AhwgAEEANgIgIABBADYCJCAAQQA2AiggAEEANgIsIABBADYCMCAAQQA2AjQgAEEANgI4IABBADYCPCAAQQA2AkAgAEEANgJEIABBADYCSCAAQQA2AkxBBBAEIQIDQCABQQRIBEBBBhAHIQMgAigCACABQQJ0aiADNgIIIAFBAWoh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GQAZQBjAG8AZABlAHIALgB0AHM=")}.toString(),")();\n return function(data, callback) {\n return (").concat(function(e,t,i){try{var n=new WebAssembly.Memory({initial:16}),r=new WebAssembly.Module(e),o=new WebAssembly.Instance(r,{env:{memory:n,abort:function(){i(new Error("webAssembly abort"))}}}).exports,s=o.newU8Array(t.length);new Uint8Array(n.buffer,s+24,t.length).set(t);var a=o.decode(s),l=new Uint32Array(n.buffer,a,4),u=l[0],c=l[2],h=l[3];u?i(null,new Uint8Array(n.buffer,h+24,c).slice(0,c)):i(new Error("lzma deocder error"))}catch(e){i(e)}}.toString(),')(LZMA_WASM, data, callback);\n }\n})();\n\nself.onmessage = function(event) {\n var packet = event.data;\n if (!packet.id) {\n postMessage({ id: packet.id, error: "No incoming id." });\n return;\n }\n if (!packet.data) {\n postMessage({ id: packet.id, error: "No input data." });\n return;\n }\n if (packet.type == "decompress") {\n if (packet.data.constructor !== Uint8Array) {\n postMessage({ id: packet.id, error: "Input data is not Uint8Array." });\n }\n const callback = function(error, result) {\n if (error) {\n postMessage({ id: packet.id, error: error.toString() });\n } else {\n postMessage({ id: packet.id, result: result, error: null }, [ result.buffer ]);\n }\n }\n if (typeof WebAssembly !== "undefined" && WebAssembly.instantiate) {\n decodeLZMAWithWASM(packet.data, callback);\n } else {\n decodeLZMA(packet.data, callback);\n }\n return;\n }\n postMessage({ id: packet.id, error: "type never matched." });\n};\n'),Oi="undefined"!=typeof Worker&&"undefined"!=typeof Blob,Ni="";if(Oi)try{var Vi=new Blob([Fi],{type:"text/javascript"});Ni=URL.createObjectURL(Vi)}catch(e){}var Qi=function(){function e(){var e=this;if(!Oi)throw new Error("LZMAWorker cannot work in this broswer.");this.callCounter=0,this.requests={};var t=this.worker=new Worker(Ni);t.onmessage=function(t){var i=t.data,n=i.id,r=i.result,o=i.error,s=e.getKey(n);e.requests[s]&&(o?e.requests[s](new Error(o)):e.requests[s](null,r),delete e.requests[s])},t.onerror=function(e){return console.error(e)}}return e.prototype.getKey=function(e){return"key_"+String(e)},e.prototype.decompress=function(e,t){var i=++this.callCounter;this.requests[this.getKey(i)]=t,this.worker.postMessage({type:"decompress",id:i,data:e},[e.buffer])},e.prototype.terminate=function(){this.worker.terminate()},e.support=Oi,e}();function Hi(e){return Array.prototype.reduce.call(e,(function(e,t,i){return e|t<<8*i}),0)}function qi(e){var t=new Uint8Array(e),i=Hi(t.slice(0,4));if(i>10)return Promise.reject(new Error("LZMA got too many sub chunks."));for(var n=[],r=[],o=4+4*i,s=0;s<i;s++)r[s]=Hi(t.slice(4+4*s,8+4*s)),n[s]=s===i-1?t.subarray(o,o+r[s]):t.slice(o,o+r[s]),o+=r[s];return Qi.support?function(e){for(var t=[],i=e.length,n=function(i){t.push(new Promise((function(t,n){var r=new Qi;r.decompress(e[i],(function(e,i){if(r.terminate(),e)return n(e);t(i)}))})))},r=0;r<i;r++)n(r);return Promise.all(t)}(n):Promise.resolve(function(e){for(var t,i=[],n=e.length,r=function(n){var r={data:e[n],offset:0,readByte:function(){return this.data[this.offset++]}},o=r.data.length,s={data:[],offset:0,writeByte:function(e){var t=Math.floor(this.offset/o);this.data[t]||(this.data[t]=new Uint8Array(o)),this.data[t][this.offset%o]=e,this.offset++}};ki.decompressFile(r,s),t=new Uint8Array(s.offset);for(var a=0;a<s.offset;a++)t[a]=s.data[Math.floor(a/o)][a%o];i.push(t)},o=0;o<n;o++)r(o);return i}(n))}function zi(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var i=[];e=e.map((function(e){return(null!=e?e:"").trim()})).filter((function(e){return e.length>0&&!/^\/+$/.test(e)}));for(var n=0;n<e.length;n++){var r=0===n,o=n===e.length-1,s=e[n];r||(s=s.replace(/^\/+/,"")),o||(s=s.replace(/\/+$/,"")),i.push(s)}return i.join("/")}const Ui=r.Reader,ji=r.util,Ki=r.roots["@REALSEE/FIVE:five/loaders/model/proto/pbm.proto"]||(r.roots["@REALSEE/FIVE:five/loaders/model/proto/pbm.proto"]={}),Gi=Ki.Model=(()=>{function e(e){if(this.chunks=[],e)for(let t=Object.keys(e),i=0;i<t.length;++i)null!=e[t[i]]&&(this[t[i]]=e[t[i]])}return e.prototype.chunks=ji.emptyArray,e.prototype.createAt=ji.Long?ji.Long.fromBits(0,0,!0):0,e.prototype.description="",e.decode=function(e,t){e instanceof Ui||(e=Ui.create(e));let i=void 0===t?e.len:e.pos+t,n=new Ki.Model;for(;e.pos<i;){let t=e.uint32();switch(t>>>3){case 1:n.chunks&&n.chunks.length||(n.chunks=[]),n.chunks.push(Ki.Chunk.decode(e,e.uint32()));break;case 2:n.createAt=e.uint64();break;case 3:n.description=e.string();break;default:e.skipType(7&t)}}return n},e})();Ki.Chunk=(()=>{function e(e){if(e)for(let t=Object.keys(e),i=0;i<t.length;++i)null!=e[t[i]]&&(this[t[i]]=e[t[i]])}return e.prototype.vertices=null,e.prototype.faces=null,e.prototype.name="",e.prototype.texture="",e.decode=function(e,t){e instanceof Ui||(e=Ui.create(e));let i=void 0===t?e.len:e.pos+t,n=new Ki.Chunk;for(;e.pos<i;){let t=e.uint32();switch(t>>>3){case 1:n.vertices=Ki.Vertices.decode(e,e.uint32());break;case 2:n.faces=Ki.Faces.decode(e,e.uint32());break;case 3:n.name=e.string();break;case 4:n.texture=e.string();break;default:e.skipType(7&t)}}if(!n.hasOwnProperty("vertices"))throw ji.ProtocolError("missing required 'vertices'",{instance:n});if(!n.hasOwnProperty("faces"))throw ji.ProtocolError("missing required 'faces'",{instance:n});if(!n.hasOwnProperty("name"))throw ji.ProtocolError("missing required 'name'",{instance:n});return n},e})(),Ki.Vertices=(()=>{function e(e){if(this.xyz=[],this.uvs=[],e)for(let t=Object.keys(e),i=0;i<t.length;++i)null!=e[t[i]]&&(this[t[i]]=e[t[i]])}return e.prototype.xyz=ji.emptyArray,e.prototype.uvs=ji.emptyArray,e.decode=function(e,t){e instanceof Ui||(e=Ui.create(e));let i=void 0===t?e.len:e.pos+t,n=new Ki.Vertices;for(;e.pos<i;){let t=e.uint32();switch(t>>>3){case 1:if(n.xyz&&n.xyz.length||(n.xyz=[]),2==(7&t)){let t=e.uint32()+e.pos;for(;e.pos<t;)n.xyz.push(e.float())}else n.xyz.push(e.float());break;case 2:if(n.uvs&&n.uvs.length||(n.uvs=[]),2==(7&t)){let t=e.uint32()+e.pos;for(;e.pos<t;)n.uvs.push(e.float())}else n.uvs.push(e.float());break;default:e.skipType(7&t)}}return n},e})(),Ki.Faces=(()=>{function e(e){if(this.indices=[],this.normals=[],e)for(let t=Object.keys(e),i=0;i<t.length;++i)null!=e[t[i]]&&(this[t[i]]=e[t[i]])}return e.prototype.indices=ji.emptyArray,e.prototype.normals=ji.emptyArray,e.decode=function(e,t){e instanceof Ui||(e=Ui.create(e));let i=void 0===t?e.len:e.pos+t,n=new Ki.Faces;for(;e.pos<i;){let t=e.uint32();switch(t>>>3){case 1:if(n.indices&&n.indices.length||(n.indices=[]),2==(7&t)){let t=e.uint32()+e.pos;for(;e.pos<t;)n.indices.push(e.uint32())}else n.indices.push(e.uint32());break;case 2:if(n.normals&&n.normals.length||(n.normals=[]),2==(7&t)){let t=e.uint32()+e.pos;for(;e.pos<t;)n.normals.push(e.float())}else n.normals.push(e.float());break;default:e.skipType(7&t)}}return n},e})();var _i=(new n.Matrix4).set(1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1).elements;function Wi(e){var t=e.match(/(group|floor)-?(\d+)/);return t?parseInt(t[2],10):0}function Xi(e){var t=e.match(/(chunk)-?(\d+)/);return t?parseInt(t[2],10):0}function Yi(e){var t=Wi(e.name),i=Xi(e.name),n=function(e){var t=e.match(/(sub)-?(\d+)/);return t?parseInt(t[2],10):0}(e.name);return 1e6*t+1e3*i+n}function Zi(e,t,i,r,o){var s=Fe({key:"texture.pbm",basisLoaderInitialized:ii.isInitialized()},Tt(t,["format","quality","size","sharpen","mappings"]));return new oi({allowHosts:i,requestProxy:r,networkSubscribe:o}).loadTexture(e,{imageURL:{transform:t.transform,options:s},wrapS:n.ClampToEdgeWrapping,wrapT:n.ClampToEdgeWrapping,minFilter:n.LinearFilter,maxSize:"number"==typeof s.size?new n.Vector2(s.size,s.size):void 0,preInit:!0}).then((function(e){var t=e.body;return t.needsUpdate=!0,t}))}function Ji(e,t,i,r,o,s,a,l){void 0===o&&(o={});for(var u=function(e){for(var t,i,n,r="number"==typeof e.createAt?e.createAt:null===e.createAt||void 0===e.createAt?0:e.createAt.toNumber(),o=null!==(t=e.description)&&void 0!==t?t:"",s=[],a=!0,l=0,u=e.chunks;l<u.length;l++)if(!(ie=u[l]).faces.normals||0===ie.faces.normals.length){a=!1;break}for(var c=e.chunks.sort((function(e,t){return Yi(e)-Yi(t)})),h=[],d=0,p=c;d<p.length;d++){var f=Wi((ie=p[d]).name);h[f]||(h[f]=[]),h[f].push(ie)}for(var A=0;A<h.length;A++){var m=h[A];if(m)if(a){for(var g=0,v=0;v<m.length;v++)g+=(ie=m[v]).faces.indices.length;for(var y=3*g,b=2*g,x=3*g,w=new ArrayBuffer(4*y+4*b+4*x),E=new Float32Array(w,0,y),M=new Float32Array(w,4*y,b),S=new Float32Array(w,4*y+4*b,x),C=[],I=[1/0,1/0,1/0,-1/0,-1/0,-1/0],B=0,T=0;T<m.length;T++){var P=[1/0,1/0,1/0,-1/0,-1/0,-1/0],R=(ie=m[T]).vertices.xyz,D=ie.vertices.uvs,L=ie.faces.indices,k=ie.faces.normals,F=L.length;for(v=0;v<F;v++){var O=L[v],N=R[3*O],V=R[3*O+1],Q=R[3*O+2],H=1/(_i[3]*N+_i[7]*V+_i[11]*Q+_i[15]),q=(_i[0]*N+_i[4]*V+_i[8]*Q+_i[12])*H,z=(_i[1]*N+_i[5]*V+_i[9]*Q+_i[13])*H,U=(_i[2]*N+_i[6]*V+_i[10]*Q+_i[14])*H;E[3*B+3*v]=q,E[3*B+3*v+1]=z,E[3*B+3*v+2]=U,M[2*B+2*v]=D[2*O],M[2*B+2*v+1]=D[2*O+1];var j=3*Math.floor(v/3),K=k[j],G=k[j+1],_=k[j+2],W=1/(_i[3]*K+_i[7]*G+_i[11]*_+_i[15]),X=(_i[0]*K+_i[4]*G+_i[8]*_+_i[12])*W,Y=(_i[1]*K+_i[5]*G+_i[9]*_+_i[13])*W,Z=(_i[2]*K+_i[6]*G+_i[10]*_+_i[14])*W;S[3*B+3*v]=X,S[3*B+3*v+1]=Y,S[3*B+3*v+2]=Z,q<P[0]&&(P[0]=q),z<P[1]&&(P[1]=z),U<P[2]&&(P[2]=U),q>P[3]&&(P[3]=q),z>P[4]&&(P[4]=z),U>P[5]&&(P[5]=U)}P[0]<I[0]&&(I[0]=P[0]),P[1]<I[1]&&(I[1]=P[1]),P[2]<I[2]&&(I[2]=P[2]),P[3]>I[3]&&(I[3]=P[3]),P[4]>I[4]&&(I[4]=P[4]),P[5]>I[5]&&(I[5]=P[5]),C.push({materialIndex:T,name:ie.name,chunkName:Xi(ie.name),start:B,count:ie.faces.indices.length,texture:null!==(i=ie.texture)&&void 0!==i?i:void 0}),B+=F}s.push({createAt:r,description:o,floorIndex:A,vertices:E,uvs:M,indices:null,normals:S,groups:C,extents:I})}else{g=0;var J=0;for(v=0;v<m.length;v++)J+=(ie=m[v]).vertices.xyz.length/3,g+=ie.faces.indices.length;y=3*J,b=2*J,x=3*J;var $=g,ee=(w=new ArrayBuffer(4*y+4*b+4*x+4*$),E=new Float32Array(w,0,y),M=new Float32Array(w,4*y,b),S=new Float32Array(w,4*y+4*b,x),new Uint32Array(w,4*y+4*b+4*x,$)),te=(C=[],I=[1/0,1/0,1/0,-1/0,-1/0,-1/0],0);for(B=0,T=0;T<m.length;T++){P=[1/0,1/0,1/0,-1/0,-1/0,-1/0],R=(ie=m[T]).vertices.xyz,D=ie.vertices.uvs,L=ie.faces.indices;var ie,ne=R.length/3;for(F=L.length,v=0;v<ne;v++)N=R[3*v],V=R[3*v+1],Q=R[3*v+2],H=1/(_i[3]*N+_i[7]*V+_i[11]*Q+_i[15]),q=(_i[0]*N+_i[4]*V+_i[8]*Q+_i[12])*H,z=(_i[1]*N+_i[5]*V+_i[9]*Q+_i[13])*H,U=(_i[2]*N+_i[6]*V+_i[10]*Q+_i[14])*H,E[3*B+3*v]=q,E[3*B+3*v+1]=z,E[3*B+3*v+2]=U,M[2*B+2*v]=D[2*v],M[2*B+2*v+1]=D[2*v+1],q<P[0]&&(P[0]=q),z<P[1]&&(P[1]=z),U<P[2]&&(P[2]=U),q>P[3]&&(P[3]=q),z>P[4]&&(P[4]=z),U>P[5]&&(P[5]=U);for(P[0]<I[0]&&(I[0]=P[0]),P[1]<I[1]&&(I[1]=P[1]),P[2]<I[2]&&(I[2]=P[2]),P[3]>I[3]&&(I[3]=P[3]),P[4]>I[4]&&(I[4]=P[4]),P[5]>I[5]&&(I[5]=P[5]),v=0;v<F;v++)ee[te+v]=B+L[v];C.push({materialIndex:T,name:ie.name,chunkName:Xi(ie.name),start:te,count:ie.faces.indices.length,texture:null!==(n=ie.texture)&&void 0!==n?n:void 0}),B+=ne,te+=F}for(v=0;v<g;v+=3){var re,oe,se,ae,le,ue,ce,he,de,pe,fe,Ae,me,ge,ve,ye;K=void 0,G=void 0,_=void 0,re=3*ee[v],oe=3*ee[v+1],se=3*ee[v+2],ae=E[re],le=E[re+1],ue=E[re+2],ce=E[oe],he=E[oe+1],de=E[oe+2],pe=E[se],K=(Ae=E[se+1]-he)*(ye=ue-de)-(me=E[se+2]-de)*(ve=le-he),G=me*(ge=ae-ce)-(fe=pe-ce)*ye,_=fe*ve-Ae*ge,S[re]+=K,S[re+1]+=G,S[re+2]+=_,S[oe]+=K,S[oe+1]+=G,S[oe+2]+=_,S[se]+=K,S[se+1]+=G,S[se+2]+=_}s.push({createAt:r,description:o,floorIndex:A,vertices:E,uvs:M,indices:ee,normals:S,groups:C,extents:I})}}return s}(e),c=0,h="",d=[],p=0,f=u;p<f.length;p++){var A=f[p],m=A.createAt,g=A.description,v=A.floorIndex,y=A.vertices,b=A.uvs,x=A.indices,w=A.normals,E=A.groups,M=A.extents,S=new n.Box3;S.min.x=M[0],S.min.y=M[1],S.min.z=M[2],S.max.x=M[3],S.max.y=M[4],S.max.z=M[5];var C=new n.BufferGeometry;C.setAttribute("position",new n.BufferAttribute(y,3)),C.setAttribute("uv",new n.BufferAttribute(b,2)),C.setAttribute("normal",new n.BufferAttribute(w,3)),x&&C.setIndex(new n.BufferAttribute(x,1)),C.boundingBox=S,C.boundingSphere=S.getBoundingSphere(new n.Sphere);for(var I=0,B=E;I<B.length;I++){var T=B[I];C.addGroup(T.start,T.count,T.materialIndex)}for(var P=[],R=function(e){var u=i[e.chunkName]||(e.texture?zi(t,e.texture):void 0),c=new ci;if(P.push(c),u){var h=void 0;u in o?h=o[u]:(h=Zi(u,r,s,a,l),o[u]=h),h.then((function(e){c.uniforms.map.value=e,c.uniforms.exposure.value=3.3}),(function(){c.defines.USE_MAP=!1,c.uniforms.diffuse.value=new n.Color(16777215)}))}else c.defines.USE_MAP=!1,c.uniforms.diffuse.value=new n.Color(16777215);c.uniforms.floorIndex.value=v},D=0,L=E;D<L.length;D++){R(T=L[D])}var k=new xt(C,P);k.name="model_floor_"+v,k.floorIndex=v,k.userData.createAt=m,k.userData.description=g,c=m,h=g,d.push(k)}return{createAt:c,description:h,objects:d,texturePromise:Promise.all(Object.keys(o).map((function(e){return o[e].catch(qe)}))).then(qe)}}function $i(e,t){return!1!==(e=Object.assign({},e)).autoResize&&(t>96?e.size=Math.min(e.size||1/0,100):t>48?e.size=Math.min(e.size||1/0,200):t>24?e.size=Math.min(e.size||1/0,400):t>12?e.size=Math.min(e.size||1/0,800):t>4&&(e.size=Math.min(e.size||1/0,1024))),e}function en(e){return 0===e.indexOf("//")||/^[0-9a-z]+\:/i.test(e)}const tn=r.Reader,nn=r.util,rn=r.roots["@REALSEE/FIVE:five/loaders/model/proto/dome.proto"]||(r.roots["@REALSEE/FIVE:five/loaders/model/proto/dome.proto"]={}),on=rn.Model=(()=>{function e(e){if(this.meshes=[],e)for(let t=Object.keys(e),i=0;i<t.length;++i)null!=e[t[i]]&&(this[t[i]]=e[t[i]])}return e.prototype.meshes=nn.emptyArray,e.decode=function(e,t){e instanceof tn||(e=tn.create(e));let i=void 0===t?e.len:e.pos+t,n=new rn.Model;for(;e.pos<i;){let t=e.uint32();if(t>>>3==1)n.meshes&&n.meshes.length||(n.meshes=[]),n.meshes.push(rn.Mesh.decode(e,e.uint32()));else e.skipType(7&t)}return n},e})();function sn(e){for(var t=[0,0,0],i=0;i<e.attributes.normal.array.length/9;i++)t[0]=e.attributes.normal.array[9*i],t[1]=e.attributes.normal.array[9*i+1],t[2]=e.attributes.normal.array[9*i+2],e.attributes.normal.array[9*i]=e.attributes.normal.array[9*i+6],e.attributes.normal.array[9*i+1]=e.attributes.normal.array[9*i+7],e.attributes.normal.array[9*i+2]=e.attributes.normal.array[9*i+8],e.attributes.normal.array[9*i+6]=t[0],e.attributes.normal.array[9*i+7]=t[1],e.attributes.normal.array[9*i+8]=t[2];for(i=0;i<e.attributes.position.array.length/9;i++)t[0]=e.attributes.position.array[9*i],t[1]=e.attributes.position.array[9*i+1],t[2]=e.attributes.position.array[9*i+2],e.attributes.position.array[9*i]=e.attributes.position.array[9*i+6],e.attributes.position.array[9*i+1]=e.attributes.position.array[9*i+7],e.attributes.position.array[9*i+2]=e.attributes.position.array[9*i+8],e.attributes.position.array[9*i+6]=t[0],e.attributes.position.array[9*i+7]=t[1],e.attributes.position.array[9*i+8]=t[2];for(i=0;i<e.attributes.uv.array.length/6;i++)t[0]=e.attributes.uv.array[6*i],t[1]=e.attributes.uv.array[6*i+1],e.attributes.uv.array[6*i]=e.attributes.uv.array[6*i+4],e.attributes.uv.array[6*i+1]=e.attributes.uv.array[6*i+5],e.attributes.uv.array[6*i+4]=t[0],e.attributes.uv.array[6*i+5]=t[1];e.attributes.normal.needsUpdate=!0,e.attributes.position.needsUpdate=!0,e.attributes.uv.needsUpdate=!0}function an(e){var t=e.position,i=e.normal,r=e.uv,o=e.uv2,s=e.groups,a=new n.BufferGeometry;a.setAttribute("position",new n.BufferAttribute(new Float32Array(t.array),3)),i&&a.setAttribute("normal",new n.BufferAttribute(new Float32Array(i.array),3)),r&&a.setAttribute("uv",new n.BufferAttribute(new Float32Array(r.array),2)),o&&a.setAttribute("uv2",new n.BufferAttribute(new Float32Array(o.array),2));for(var l=0,u=s;l<u.length;l++){var c=u[l];a.addGroup(c.start,c.count,c.materialIndex)}return a}function ln(e,t,i,r,o,s){if(s.hasOwnProperty(e))return s[e];en(e=e.split("?")[0])||(e=zi(t,e)),0===(e=e.replace(/\/\/vrlab-image\d*.ljcdn.com\//,"//vrlab-public.ljcdn.com/")).indexOf("//")&&(e="https:"+e);var a=Fe({key:"texture.dome",size:64,basisLoaderInitialized:ii.isInitialized()},Tt(i,["quality","format","sharpen","mappings"]));return s[e]=o.loadTexture(e,{imageURL:{transform:i.transform,options:a},wrapS:n.RepeatWrapping,wrapT:n.RepeatWrapping}).then((function(e){var t=e.body;return r&&t.repeat.copy(r),t.needsUpdate=!0,t.updateMatrix(),t}))}function un(e,t,i,r,o){var s=[],a=new ci,l=a.uniforms;l.exposure.value=4.3;var u=a.defines;if(u.USE_MAP=!1,u.USE_UV=!1,e.kd&&(l.diffuse.value=(new n.Color).fromArray(e.kd.rgb)),e.mapkd){var c=null;if(e.mapkdrepeat){var h=e.mapkdrepeat.split(/\s+/).map((function(e){return Number(e)})),d=h[0],p=h[1];c=new n.Vector2(d,p)}s.push(ln(e.mapkd,t,i,c,r,o).then((function(e){u.USE_MAP=!0,u.USE_UV=!0,l.map.value=e,l.uvTransform.value=e.matrix,a.needsUpdate=!0})).catch(qe))}if(e.ks&&(l.specular.value=(new n.Color).fromArray(e.ks.rgb)),e.mapks&&s.push(ln(e.mapks,t,i,null,r,o).then((function(e){l.specularMap.value=e})).catch(qe)),e.ke&&(l.emissive.value=(new n.Color).fromArray(e.ke.rgb)),e.mapke&&s.push(ln(e.mapke,t,i,null,r,o).then((function(e){l.emissiveMap.value=e})).catch(qe)),e.norm&&s.push(ln(e.norm,t,i,null,r,o).then((function(e){l.normalMap.value=e})).catch(qe)),e.mapbump&&s.push(ln(e.mapbump,t,i,null,r,o).then((function(e){l.bumpMap.value=e})).catch(qe)),e.bump&&s.push(ln(e.bump,t,i,null,r,o).then((function(e){l.bumpMap.value=e})).catch(qe)),"number"==typeof e.ns&&(l.shininess.value=e.ns),"number"==typeof e.d){var f=e.d;f>0&&f<1&&(a.originOpacity=f,a.opacity=f)}return{material:a,textureReady:Promise.all(s).then(qe)}}function cn(e,t,i,r,o,s){for(var a,l=[],u=[],c=(a=e,on.decode(a).meshes),h=new oi({allowHosts:r,requestProxy:o,networkSubscribe:s}),d=new n.Matrix4,p=new n.Vector3,f=new n.Quaternion,A=new n.Vector3,m={},g=0,v=c;g<v.length;g++){var y=v[g],b=y.name,x=y.chunks,w=y.matrix;if("Ceiling"!==b&&"CeilingDrop"!==b)for(var E=0,M=w;E<M.length;E++){var S=M[E];d.elements=S.elements;var C=new Et;C.renderOrder=-3;for(var I=0;I<x.length;I++){var B=an(x[I].geometry);B.applyMatrix4(d),d.decompose(p,f,A),A.x*A.y*A.z<0&&B.attributes.normal&&B.attributes.position&&B.attributes.uv&&sn(B);for(var T=[],P=0,R=x[I].material;P<R.length;P++){var D=un(R[P],t,i,h,m),L=D.material,k=D.textureReady;u.push(k),T.push(L)}var F=new xt(B,T);F.name="chunk_"+I,C.add(F)}C.floorIndex=0,C.name=b,l.push(C)}}return{createAt:0,description:"",objects:l,texturePromise:Promise.all(u).catch(qe)}}rn.Mesh=(()=>{function e(e){if(this.chunks=[],this.matrix=[],e)for(let t=Object.keys(e),i=0;i<t.length;++i)null!=e[t[i]]&&(this[t[i]]=e[t[i]])}return e.prototype.name="",e.prototype.chunks=nn.emptyArray,e.prototype.matrix=nn.emptyArray,e.decode=function(e,t){e instanceof tn||(e=tn.create(e));let i=void 0===t?e.len:e.pos+t,n=new rn.Mesh;for(;e.pos<i;){let t=e.uint32();switch(t>>>3){case 1:n.name=e.string();break;case 2:n.chunks&&n.chunks.length||(n.chunks=[]),n.chunks.push(rn.Chunk.decode(e,e.uint32()));break;case 3:n.matrix&&n.matrix.length||(n.matrix=[]),n.matrix.push(rn.Matrix.decode(e,e.uint32()));break;default:e.skipType(7&t)}}if(!n.hasOwnProperty("name"))throw nn.ProtocolError("missing required 'name'",{instance:n});return n},e})(),rn.Matrix=(()=>{function e(e){if(this.elements=[],e)for(let t=Object.keys(e),i=0;i<t.length;++i)null!=e[t[i]]&&(this[t[i]]=e[t[i]])}return e.prototype.elements=nn.emptyArray,e.decode=function(e,t){e instanceof tn||(e=tn.create(e));let i=void 0===t?e.len:e.pos+t,n=new rn.Matrix;for(;e.pos<i;){let t=e.uint32();if(t>>>3==1)if(n.elements&&n.elements.length||(n.elements=[]),2==(7&t)){let t=e.uint32()+e.pos;for(;e.pos<t;)n.elements.push(e.float())}else n.elements.push(e.float());else e.skipType(7&t)}return n},e})(),rn.Chunk=(()=>{function e(e){if(this.material=[],e)for(let t=Object.keys(e),i=0;i<t.length;++i)null!=e[t[i]]&&(this[t[i]]=e[t[i]])}return e.prototype.geometry=null,e.prototype.material=nn.emptyArray,e.decode=function(e,t){e instanceof tn||(e=tn.create(e));let i=void 0===t?e.len:e.pos+t,n=new rn.Chunk;for(;e.pos<i;){let t=e.uint32();switch(t>>>3){case 2:n.geometry=rn.Geometry.decode(e,e.uint32());break;case 3:n.material&&n.material.length||(n.material=[]),n.material.push(rn.Material.decode(e,e.uint32()));break;default:e.skipType(7&t)}}if(!n.hasOwnProperty("geometry"))throw nn.ProtocolError("missing required 'geometry'",{instance:n});return n},e})(),rn.Geometry=(()=>{function e(e){if(this.groups=[],e)for(let t=Object.keys(e),i=0;i<t.length;++i)null!=e[t[i]]&&(this[t[i]]=e[t[i]])}return e.prototype.position=null,e.prototype.uv=null,e.prototype.uv2=null,e.prototype.normal=null,e.prototype.groups=nn.emptyArray,e.decode=function(e,t){e instanceof tn||(e=tn.create(e));let i=void 0===t?e.len:e.pos+t,n=new rn.Geometry;for(;e.pos<i;){let t=e.uint32();switch(t>>>3){case 1:n.position=rn.Position.decode(e,e.uint32());break;case 2:n.uv=rn.UV.decode(e,e.uint32());break;case 3:n.uv2=rn.UV.decode(e,e.uint32());break;case 4:n.normal=rn.Normal.decode(e,e.uint32());break;case 5:n.groups&&n.groups.length||(n.groups=[]),n.groups.push(rn.Group.decode(e,e.uint32()));break;default:e.skipType(7&t)}}if(!n.hasOwnProperty("position"))throw nn.ProtocolError("missing required 'position'",{instance:n});if(!n.hasOwnProperty("normal"))throw nn.ProtocolError("missing required 'normal'",{instance:n});return n},e})(),rn.Position=(()=>{function e(e){if(this.array=[],e)for(let t=Object.keys(e),i=0;i<t.length;++i)null!=e[t[i]]&&(this[t[i]]=e[t[i]])}return e.prototype.array=nn.emptyArray,e.decode=function(e,t){e instanceof tn||(e=tn.create(e));let i=void 0===t?e.len:e.pos+t,n=new rn.Position;for(;e.pos<i;){let t=e.uint32();if(t>>>3==1)if(n.array&&n.array.length||(n.array=[]),2==(7&t)){let t=e.uint32()+e.pos;for(;e.pos<t;)n.array.push(e.float())}else n.array.push(e.float());else e.skipType(7&t)}return n},e})(),rn.UV=(()=>{function e(e){if(this.array=[],e)for(let t=Object.keys(e),i=0;i<t.length;++i)null!=e[t[i]]&&(this[t[i]]=e[t[i]])}return e.prototype.array=nn.emptyArray,e.decode=function(e,t){e instanceof tn||(e=tn.create(e));let i=void 0===t?e.len:e.pos+t,n=new rn.UV;for(;e.pos<i;){let t=e.uint32();if(t>>>3==1)if(n.array&&n.array.length||(n.array=[]),2==(7&t)){let t=e.uint32()+e.pos;for(;e.pos<t;)n.array.push(e.float())}else n.array.push(e.float());else e.skipType(7&t)}return n},e})(),rn.Normal=(()=>{function e(e){if(this.array=[],e)for(let t=Object.keys(e),i=0;i<t.length;++i)null!=e[t[i]]&&(this[t[i]]=e[t[i]])}return e.prototype.array=nn.emptyArray,e.decode=function(e,t){e instanceof tn||(e=tn.create(e));let i=void 0===t?e.len:e.pos+t,n=new rn.Normal;for(;e.pos<i;){let t=e.uint32();if(t>>>3==1)if(n.array&&n.array.length||(n.array=[]),2==(7&t)){let t=e.uint32()+e.pos;for(;e.pos<t;)n.array.push(e.float())}else n.array.push(e.float());else e.skipType(7&t)}return n},e})(),rn.Group=(()=>{function e(e){if(e)for(let t=Object.keys(e),i=0;i<t.length;++i)null!=e[t[i]]&&(this[t[i]]=e[t[i]])}return e.prototype.start=0,e.prototype.count=0,e.prototype.materialIndex=0,e.decode=function(e,t){e instanceof tn||(e=tn.create(e));let i=void 0===t?e.len:e.pos+t,n=new rn.Group;for(;e.pos<i;){let t=e.uint32();switch(t>>>3){case 1:n.start=e.uint32();break;case 2:n.count=e.uint32();break;case 3:n.materialIndex=e.uint32();break;default:e.skipType(7&t)}}if(!n.hasOwnProperty("start"))throw nn.ProtocolError("missing required 'start'",{instance:n});if(!n.hasOwnProperty("count"))throw nn.ProtocolError("missing required 'count'",{instance:n});if(!n.hasOwnProperty("materialIndex"))throw nn.ProtocolError("missing required 'materialIndex'",{instance:n});return n},e})(),rn.Material=(()=>{function e(e){if(e)for(let t=Object.keys(e),i=0;i<t.length;++i)null!=e[t[i]]&&(this[t[i]]=e[t[i]])}return e.prototype.kd=null,e.prototype.ks=null,e.prototype.ke=null,e.prototype.mapkd="",e.prototype.mapks="",e.prototype.mapke="",e.prototype.norm="",e.prototype.mapbump="",e.prototype.bump="",e.prototype.mapd="",e.prototype.ns=0,e.prototype.d=0,e.prototype.tr=0,e.prototype.mapkdrepeat="",e.decode=function(e,t){e instanceof tn||(e=tn.create(e));let i=void 0===t?e.len:e.pos+t,n=new rn.Material;for(;e.pos<i;){let t=e.uint32();switch(t>>>3){case 1:n.kd=rn.Color.decode(e,e.uint32());break;case 2:n.ks=rn.Color.decode(e,e.uint32());break;case 3:n.ke=rn.Color.decode(e,e.uint32());break;case 4:n.mapkd=e.string();break;case 5:n.mapks=e.string();break;case 6:n.mapke=e.string();break;case 7:n.norm=e.string();break;case 8:n.mapbump=e.string();break;case 9:n.bump=e.string();break;case 10:n.mapd=e.string();break;case 11:n.ns=e.float();break;case 12:n.d=e.float();break;case 13:n.tr=e.float();break;case 14:n.mapkdrepeat=e.string();break;default:e.skipType(7&t)}}return n},e})(),rn.Color=(()=>{function e(e){if(this.rgb=[],e)for(let t=Object.keys(e),i=0;i<t.length;++i)null!=e[t[i]]&&(this[t[i]]=e[t[i]])}return e.prototype.rgb=nn.emptyArray,e.decode=function(e,t){e instanceof tn||(e=tn.create(e));let i=void 0===t?e.len:e.pos+t,n=new rn.Color;for(;e.pos<i;){let t=e.uint32();if(t>>>3==1)if(n.rgb&&n.rgb.length||(n.rgb=[]),2==(7&t)){let t=e.uint32()+e.pos;for(;e.pos<t;)n.rgb.push(e.float())}else n.rgb.push(e.float());else e.skipType(7&t)}return n},e})();var hn={throttleRequests:!0,maxRequests:5},dn=function(){function e(e){void 0===e&&(e={}),this.props=Fe(Fe({},hn),e),this.activeRequestCount=0,this.requestQueue=[],this.requestMap=new Map,this.deferred=null}return e.prototype.scheduleRequest=function(e,t){if(void 0===t&&(t=function(){return 0}),!this.props.throttleRequests)return Promise.resolve({done:function(){}});if(this.requestMap.has(e))return this.requestMap.get(e);var i={identiy:e,priority:0,getPriority:t,resolve:function(){}},n=new Promise((function(e){return i.resolve=e}));return this.requestQueue.push(i),this.requestMap.set(e,n),this.issueNewRequests(),n},e.prototype.issueRequest=function(e){var t=this,i=e.identiy,n=e.resolve,r=!1;this.activeRequestCount++,n({done:function(){r||(r=!0,t.requestMap.delete(i),t.activeRequestCount--,t.issueNewRequests())}})},e.prototype.issueNewRequests=function(){var e=this;this.deferred||(this.deferred=setTimeout((function(){return e.issueNewRequestsAsync()}),0))},e.prototype.issueNewRequestsAsync=function(){this.deferred=null;var e=Math.max(this.props.maxRequests-this.activeRequestCount,0);if(0!==e){this.updateAllRequests();for(var t=0;t<e;t++){var i=this.requestQueue.shift();i&&this.issueRequest(i)}}},e.prototype.updateAllRequests=function(){for(var e=this.requestQueue,t=0;t<e.length;t++){var i=e[t];this.updateRequest(i)||(e.splice(t,1),this.requestMap.delete(i.identiy),t--)}e.sort((function(e,t){return e.priority-t.priority}))},e.prototype.updateRequest=function(e){return e.priority=e.getPriority(e.identiy),!(e.priority<0)||(e.resolve(null),!1)},e}(),pn=function(e,t,i){this.item=e,this.previous=t,this.next=i},fn=function(){function e(){this.head=null,this.tail=null,this._length=0}return Object.defineProperty(e.prototype,"length",{get:function(){return this._length},enumerable:!1,configurable:!0}),e.prototype.add=function(e){var t=new pn(e,this.tail,null);return this.tail?(this.tail.next=t,this.tail=t):(this.head=t,this.tail=t),this._length++,t},e.prototype.remove=function(e){e.previous&&e.next?(e.previous.next=e.next,e.next.previous=e.previous):e.previous?(e.previous.next=null,this.tail=e.previous):e.next?(e.next.previous=null,this.head=e.next):(this.head=null,this.tail=null),e.next=null,e.previous=null,this._length--},e.prototype.splice=function(e,t){e!==t&&(this.remove(t),this.insert(e,t))},e.prototype.insert=function(e,t){var i=e.next;e.next=t,this.tail===e?this.tail=t:i.previous=t,t.next=i,t.previous=e,this._length++},e}(),An=function(){function e(){this.list=new fn,this.sentinel=this.list.add("sentinel")}return e.prototype.reset=function(){this.list.splice(this.list.tail,this.sentinel)},e.prototype.touch=function(e){var t=e.cacheNode;t&&this.list.splice(this.sentinel,t)},e.prototype.add=function(e,t){e.cacheNode||(e.cacheNode=this.list.add(e),t&&t(e))},e.prototype.unloadTile=function(e,t){var i=e.cacheNode;i&&(this.list.remove(i),e.cacheNode=void 0,t&&t(e))},e.prototype.unloadTiles=function(e,t){for(var i=this.list.head;i!==this.sentinel&&e();){var n=i.item;i=i.next,this.unloadTile(n,t)}},e}(),mn=Object.freeze({OUTSIDE:-1,INTERSECTING:0,INSIDE:1}),gn=[new e.Vector3(1,0,0),new e.Vector3(0,1,0),new e.Vector3(0,0,1)],vn=new e.Vector3,yn=new e.Vector3,bn=function(){function t(e){void 0===e&&(e=[]),this.planes=e}return Object.defineProperty(t,"MASK_OUTSIDE",{get:function(){return 4294967295},enumerable:!1,configurable:!0}),Object.defineProperty(t,"MASK_INSIDE",{get:function(){return 0},enumerable:!1,configurable:!0}),Object.defineProperty(t,"MASK_INDETERMINATE",{get:function(){return 2147483647},enumerable:!1,configurable:!0}),t.prototype.fromBoundingSphere=function(t){this.planes.length=2*gn.length;for(var i=t.center,n=t.radius,r=0,o=0,s=gn;o<s.length;o++){var a=s[o],l=this.planes[r],u=this.planes[r+1];l||(l=this.planes[r]=new e.Plane),u||(u=this.planes[r+1]=new e.Plane);var c=vn.copy(a).multiplyScalar(-n).add(i);l.setFromNormalAndCoplanarPoint(a,c);var h=vn.copy(a).multiplyScalar(n).add(i),d=yn.copy(a).negate();u.setFromNormalAndCoplanarPoint(d,h),r+=2}return this},t.prototype.computeVisibilityWithPlaneMask=function(e,i){if(i===t.MASK_OUTSIDE||i===t.MASK_INSIDE)return i;for(var n=t.MASK_INSIDE,r=this.planes,o=0;o<this.planes.length;++o){var s=o<31?1<<o:0;if(!(o<31&&0==(i&s))){var a=r[o],l=e.intersectPlane(a);if(l===mn.OUTSIDE)return t.MASK_OUTSIDE;l===mn.INTERSECTING&&(n|=s)}}return n},t}();var xn=Object.freeze({OUTSIDE:-1,INTERSECTING:0,INSIDE:1}),wn=new e.Vector3,En=new e.Vector3,Mn=function(){function t(t,i){void 0===t&&(t=[0,0,0]),void 0===i&&(i=0),this.radius=-0,this.center=new e.Vector3,this.fromCenterRadius(t,i)}return t.prototype.fromCenterRadius=function(e,t){return this.center.fromArray(e),this.radius=t,this},t.prototype.fromCornerPoints=function(t,i){var n=wn.fromArray(i);return this.center=(new e.Vector3).fromArray(t).add((new e.Vector3).fromArray(i)).multiplyScalar(.5),this.radius=this.center.distanceTo(n),this},t.prototype.equals=function(e){return this===e||Boolean(e)&&this.center.equals(e.center)&&this.radius===e.radius},t.prototype.clone=function(){return new t(this.center.toArray(),this.radius)},t.prototype.union=function(e){var t=this.center,i=this.radius,n=e.center,r=e.radius,o=wn.copy(n).sub(t),s=o.length();if(i>=s+r)return this.clone();if(r>=s+i)return e.clone();var a=.5*(i+s+r);return En.copy(o).multiplyScalar((-i+a)/s).add(t),this.center.copy(En),this.radius=a,this},t.prototype.expand=function(e){var t=wn.fromArray(e).sub(this.center).length();return t>this.radius&&(this.radius=t),this},t.prototype.transform=function(e){this.center.applyMatrix4(e);var t,i,n,r,o,s,a,l,u,c,h,d=(t=wn.toArray(),i=e.toArray(),n=i[0],r=i[1],o=i[2],s=i[4],a=i[5],l=i[6],u=i[8],c=i[9],h=i[10],t[0]=Math.hypot(n,r,o),t[1]=Math.hypot(s,a,l),t[2]=Math.hypot(u,c,h),t);return this.radius=Math.max(d[0],Math.max(d[1],d[2]))*this.radius,this},t.prototype.distanceSquaredTo=function(e){var t=this.distanceTo(e);return t*t},t.prototype.distanceTo=function(e){var t=wn.fromArray(e).sub(this.center);return Math.max(0,t.length()-this.radius)},t.prototype.intersectPlane=function(e){var t=this.center,i=this.radius,n=e.normal.dot(t)+e.constant;return n<-i?xn.OUTSIDE:n<i?xn.INTERSECTING:xn.INSIDE},t}(),Sn=Object.freeze({OUTSIDE:-1,INTERSECTING:0,INSIDE:1}),Cn=new e.Vector3,In=new e.Vector3,Bn=new e.Vector3,Tn=new e.Vector3,Pn=new e.Vector3,Rn=new e.Vector3,Dn=new e.Vector3,Ln=0,kn=1,Fn=2,On=3,Nn=4,Vn=5,Qn=6,Hn=7,qn=8;function zn(t,i,n){void 0===n&&(n=new e.Vector3);for(var r=3*i,o=new Array(3),s=0;s<3;++s)o[s]=t.toArray()[r+s];return n.fromArray(o)}var Un=function(){function t(t,i){void 0===t&&(t=[0,0,0]),void 0===i&&(i=[0,0,0,0,0,0,0,0,0]),this.center=(new e.Vector3).fromArray(t),this.halfAxes=(new e.Matrix3).fromArray(i)}return t.prototype.clone=function(){return new t(this.center.toArray(),this.halfAxes.toArray())},t.prototype.equals=function(e){return this===e||Boolean(e)&&this.center.equals(e.center)&&this.halfAxes.equals(e.halfAxes)},t.prototype.getBoundingSphere=function(e){void 0===e&&(e=new Mn);var t=this.halfAxes,i=zn(t,0,Bn),n=zn(t,1,Tn),r=zn(t,2,Pn),o=Cn.copy(i).add(n).add(r);return e.center.copy(this.center),e.radius=o.length(),e},t.prototype.intersectPlane=function(e){var t=this.center,i=e.normal,n=this.halfAxes.toArray(),r=i.x,o=i.y,s=i.z,a=Math.abs(r*n[Ln]+o*n[kn]+s*n[Fn])+Math.abs(r*n[On]+o*n[Nn]+s*n[Vn])+Math.abs(r*n[Qn]+o*n[Hn]+s*n[qn]),l=i.dot(t)+e.constant;return l<=-a?Sn.OUTSIDE:l>=a?Sn.INSIDE:Sn.INTERSECTING},t.prototype.distanceTo=function(e){return Math.sqrt(this.distanceSquaredTo(e))},t.prototype.distanceSquaredTo=function(e){var t=In.fromArray(e).sub(this.center),i=this.halfAxes,n=zn(i,0,Bn),r=zn(i,1,Tn),o=zn(i,2,Pn),s=n.length(),a=r.length(),l=o.length();n.normalize(),r.normalize(),o.normalize();var u,c=0;return(u=Math.abs(t.dot(n))-s)>0&&(c+=u*u),(u=Math.abs(t.dot(r))-a)>0&&(c+=u*u),(u=Math.abs(t.dot(o))-l)>0&&(c+=u*u),c},t.prototype.computePlaneDistances=function(e,t,i){void 0===i&&(i=[-0,-0]);var n=Number.POSITIVE_INFINITY,r=Number.NEGATIVE_INFINITY,o=this.center,s=this.halfAxes,a=zn(s,0,Bn),l=zn(s,1,Tn),u=zn(s,2,Pn),c=Rn.copy(a).add(l).add(u).add(o),h=Dn.copy(c).sub(e),d=t.dot(h);return n=Math.min(d,n),r=Math.max(d,r),c.copy(o).add(a).add(l).sub(u),h.copy(c).sub(e),d=t.dot(h),n=Math.min(d,n),r=Math.max(d,r),c.copy(o).add(a).sub(l).add(u),h.copy(c).sub(e),d=t.dot(h),n=Math.min(d,n),r=Math.max(d,r),c.copy(o).add(a).sub(l).sub(u),h.copy(c).sub(e),d=t.dot(h),n=Math.min(d,n),r=Math.max(d,r),o.copy(c).sub(a).add(l).add(u),h.copy(c).sub(e),d=t.dot(h),n=Math.min(d,n),r=Math.max(d,r),o.copy(c).sub(a).add(l).sub(u),h.copy(c).sub(e),d=t.dot(h),n=Math.min(d,n),r=Math.max(d,r),o.copy(c).sub(a).sub(l).add(u),h.copy(c).sub(e),d=t.dot(h),n=Math.min(d,n),r=Math.max(d,r),o.copy(c).sub(a).sub(l).sub(u),h.copy(c).sub(e),d=t.dot(h),n=Math.min(d,n),r=Math.max(d,r),i[0]=n,i[1]=r,i},t.prototype.transform=function(t){var i=(new e.Matrix4).fromArray(t);this.center.applyMatrix4(i);var n=zn(this.halfAxes,0,Bn);n.applyMatrix4(i);var r=zn(this.halfAxes,1,Tn);r.applyMatrix4(i);var o=zn(this.halfAxes,2,Pn);return o.applyMatrix4(i),this.halfAxes=(new e.Matrix3).fromArray(Oe(Oe(Oe([],n.toArray(),!0),r.toArray(),!0),o.toArray(),!0)),this},t}();function jn(t,i){var n=i.toArray(),r=t.toArray(),o=[0,0,0],s=r[0],a=r[1],l=r[2],u=n[3]*s+n[7]*a+n[11]*l||1;return o[0]=(n[0]*s+n[4]*a+n[8]*l)/u,o[1]=(n[1]*s+n[5]*a+n[9]*l)/u,o[2]=(n[2]*s+n[6]*a+n[10]*l)/u,(new e.Vector3).fromArray(o)}function Kn(e,t){var i=function(e,t,i){var n=i[0],r=i[1],o=i[2],s=i[3],a=t[0],l=t[1],u=t[2],c=r*u-o*l,h=o*a-n*u,d=n*l-r*a,p=r*d-o*h,f=o*c-n*d,A=n*h-r*c,m=2*s;return c*=m,h*=m,d*=m,p*=2,f*=2,A*=2,e[0]=a+c+p,e[1]=l+h+f,e[2]=u+d+A,e}([0,0,0],e.toArray(),t.toArray());e.fromArray(i)}function Gn(t,i){if(t.box)return function(t,i){var n=new e.Vector3(t[0],t[1],t[2]);n.applyMatrix4(i);var r=[];if(10===t.length){var o=t.slice(3,6),s=new e.Quaternion;s.fromArray(t,6);var a=new e.Vector3(1,0,0),l=new e.Vector3(0,1,0),u=new e.Vector3(0,0,1);Kn(a,s),a.multiplyScalar(o[0]),Kn(l,s),l.multiplyScalar(o[1]),Kn(u,s),u.multiplyScalar(o[2]),r=Oe(Oe(Oe([],a.toArray(),!0),l.toArray(),!0),u.toArray(),!0)}else r=Oe(Oe(Oe([],t.slice(3,6),!0),t.slice(6,9),!0),t.slice(9,12),!0);var c=jn((new e.Vector3).fromArray(r.slice(0,3)),i).toArray(),h=jn((new e.Vector3).fromArray(r.slice(3,6)),i).toArray(),d=jn((new e.Vector3).fromArray(r.slice(6,9)),i).toArray(),p=(new e.Matrix3).fromArray([c[0],c[1],c[2],h[0],h[1],h[2],d[0],d[1],d[2]]);return new Un(n.toArray(),p.toArray())}(t.box,i);throw new Error("3D Tile: boundingVolume must only can be box")}function _n(e,t){if(e.dynamicScreenSpaceError&&e.dynamicScreenSpaceErrorComputedDensity){var i=e.dynamicScreenSpaceErrorComputedDensity,n=e.dynamicScreenSpaceErrorFactor,r=function(e,t){var i=e*t;return 1-Math.exp(-i*i)}(t,i)*n;return r}return 0}function Wn(e,t,i){var n=new TextDecoder("utf8"),r=new Uint8Array(e,t,i);return n.decode(r)}function Xn(e,t,i){return void 0===i&&(i=0),i=function(e,t,i){void 0===i&&(i=0);var n=e.header,r=n.featureTableJsonByteLength,o=n.featureTableBinaryByteLength,s=n.batchLength;if(e.featureTableJson={BATCH_LENGTH:s||0},r>0){var a=Wn(t,i,r);e.featureTableJson=JSON.parse(a)}return i+=r,e.featureTableBinary=new Uint8Array(t,i,o),i+=o}(e,t,i),i=function(e,t,i){void 0===i&&(i=0);var n=e.header,r=n.batchTableJsonByteLength,o=n.batchTableBinaryByteLength;if(r>0){var s=Wn(t,i,r);e.batchTableJson=JSON.parse(s),i+=r,o>0&&(e.batchTableBinary=new Uint8Array(t,i,o),e.batchTableBinary=new Uint8Array(e.batchTableBinary),i+=o)}return i}(e,t,i),i}function Yn(e,t,i){void 0===i&&(i=0);var n=e.byteOffset+e.byteLength-i;if(0===n)throw new Error("glTF byte length must be greater than 0.");return e.rotateYtoZ=!0,e.gltfUpAxis="Y",e.gltfArrayBuffer=function(e,t,i){var n=void 0!==i?new Uint8Array(e).subarray(t,t+i):new Uint8Array(e).subarray(t);return new Uint8Array(n).buffer}(t,i,n),e.gltfByteOffset=0,e.gltfByteLength=n,i%4==0||console.warn("".concat(e.type,": embedded glb is not aligned to a 4-byte boundary.")),e.byteOffset+e.byteLength}function Zn(e,t,i){i=function(e,t,i){void 0===i&&(i=0);var n=new DataView(t);if(e.magic=n.getUint32(i,!0),i+=4,e.version=n.getUint32(i,!0),i+=4,e.byteLength=n.getUint32(i,!0),i+=4,1!==e.version)throw new Error("3D Tile Version ".concat(e.version," not supported"));return i}(e,t,i),i=function(e,t,i){void 0===i&&(i=0);var n,r=new DataView(t);e.header=e.header||{};var o=r.getUint32(i,!0);i+=4;var s=r.getUint32(i,!0);i+=4;var a=r.getUint32(i,!0);i+=4;var l=r.getUint32(i,!0);return i+=4,a>=570425344?(i-=8,n=o,a=s,l=0,o=0,s=0,console.warn("b3dm tile in legacy format.")):l>=570425344&&(i-=4,n=a,a=o,l=s,o=0,s=0,console.warn("b3dm tile in legacy format.")),e.header.featureTableJsonByteLength=o,e.header.featureTableBinaryByteLength=s,e.header.batchTableJsonByteLength=a,e.header.batchTableBinaryByteLength=l,e.header.batchLength=n,i}(e,t,i),i=Yn(e,t,i=Xn(e,t,i));var n=e.featureTableJson.RTC_CENTER;return n&&Number.isFinite(n.byteOffset)&&(e.rtcCenter=new Float32Array(e.featureTableBinary.buffer,e.featureTableBinary.buffer.byteOffset+n.byteOffset,3)),i}var Jn=function(){function t(t,i,n){this.header=i,this.tileset=t,this.parent=n,this.children=[],this.contentState="UNLOADED",this.transform=this.header.transform?(new e.Matrix4).fromArray(this.header.transform.slice()):new e.Matrix4;var r=this.parent&&this.parent.computedTransform?this.parent.computedTransform.clone():t.modelMatrix.clone();this.computedTransform=r.clone().multiply(this.transform),this.boundingVolume=Gn(this.header.boundingVolume,this.computedTransform),this.depth=this.parent?this.parent.depth+1:0,this.distanceToCamera=0,this.centerZDepth=0,this.screenSpaceError=0,this.shouldRefine=!1,this.visibilityPlaneMask=bn.MASK_INDETERMINATE,this.visible=!1,this.selectionDepth=0,this.frameNumber=0,this.touchedFrameNumber=0,this.selectedFrameNumber=0,this.requestedFrameNumber=0}return Object.defineProperty(t.prototype,"id",{get:function(){return this.header.id},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"refine",{get:function(){return this.header.refine||this.parent&&this.parent.refine||"REPLACE"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"type",{get:function(){return this.header.type},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"contentUrl",{get:function(){if(this.header.content.uri){var e=this.tileset.b3dmMapping.b3dm_base_url;e=/\/$/.test(e)?e:e+"/";var t=this.tileset.b3dmMapping.b3dm_url[this.header.content.uri];t=/^\//.test(t)?t.slice(1):t;var i=/^https?:/.test(t)?t:e+t;if(-1!==i.indexOf("http")&&-1===i.indexOf("https")){var n=i.slice(4);i="https"+n}return i}return this.header.contentUrl},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lodMetricType",{get:function(){return this.header.lodMetricType},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lodMetricValue",{get:function(){return this.header.lodMetricValue},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"hasEmptyContent",{get:function(){return!this.header.contentUrl},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"selected",{get:function(){return this.selectedFrameNumber===this.tileset.frameNumber},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"hasRenderContent",{get:function(){return!this.hasEmptyContent},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"hasChildren",{get:function(){return this.children.length>0||this.header.children&&this.header.children.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"contentReady",{get:function(){return"READY"===this.contentState||this.hasEmptyContent},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"contentAvailable",{get:function(){return Boolean(this.contentReady&&this.hasRenderContent||!1)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"hasUnloadedContent",{get:function(){return this.hasRenderContent&&this.contentUnloaded},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"contentUnloaded",{get:function(){return"UNLOADED"===this.contentState},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"contentFailed",{get:function(){return"FAILED"===this.contentState},enumerable:!1,configurable:!0}),t.prototype.getScreenSpaceError=function(e,t){if("TILES3D"===this.tileset.type)return function(e,t,i){var n=e.tileset,r=e.parent&&e.parent.lodMetricValue||e.lodMetricValue,o=i?r:e.lodMetricValue;if(0===o)return 0;var s=Math.max(e.distanceToCamera,1e-7),a=n.options.viewDistanceScale,l=o*t.height*a/(s*t.sseDenominator);return l-_n(n,s)}(this,e,t);throw new Error("Unsupported tileset type")},t.prototype.getPriority=function(){var e=this.tileset.traverser,t=e.options.skipLevelOfDetail,i="ADD"===this.refine||t;if(i&&!this.visible)return-1;if(this.tileset.frameNumber-this.touchedFrameNumber>=1)return-1;if("UNLOADED"===this.contentState)return-1;var n=this.parent,r=n&&(!i||0===this.screenSpaceError)?n.screenSpaceError:this.screenSpaceError,o=e.root?e.root.screenSpaceError:0;return Math.max(o-r,0)},t.prototype.loadContent=function(){var e=this;return this.hasEmptyContent||!this.contentUrl?Promise.resolve(!1):this.content?Promise.resolve(!0):(this.contentState="LOADING",this.tileset.requestScheduler.scheduleRequest(this.id,(function(){return e.getPriority()})).then((function(t){return t?st(e.contentUrl,{responseType:"arraybuffer",allowHosts:e.tileset.options.allowHosts,networkSubscribe:e.tileset.options.networkSubscribe,requestProxy:e.tileset.options.requestProxy}).then((function(e){return e.body})).then((function(e){return Zn(t={byteOffset:0,type:"b3dm"},e,t.byteOffset),t;var t})).then((function(i){return e.content=i,e.tileset.options.contentLoader(e).then((function(){return e.contentState="READY",t.done(),!0}))})).catch((function(i){return e.contentState="FAILED",t.done(),Promise.reject(i)})):(e.contentState="UNLOADED",Promise.resolve(!1))})))},t.prototype.unloadContent=function(){this.content=void 0,this.contentState="UNLOADED"},t.prototype.updateVisibility=function(e){if(this.frameNumber!==e.frameNumber){var t=this.parent,i=t?t.visibilityPlaneMask:bn.MASK_INDETERMINATE,n=t?t.computedTransform:this.tileset.modelMatrix;this.updateTransform(n),this.distanceToCamera=this.distanceToTile(e),this.screenSpaceError=this.getScreenSpaceError(e,!1),this.visibilityPlaneMask=this.visibility(e,i),this.visible=this.visibilityPlaneMask!==bn.MASK_OUTSIDE,this.frameNumber=e.frameNumber}},t.prototype.visibility=function(e,t){return e.cullingVolume.computeVisibilityWithPlaneMask(this.boundingVolume,t)},t.prototype.distanceToTile=function(e){return Math.sqrt(Math.max(this.boundingVolume.distanceSquaredTo(e.camera.position),0))},t.prototype.updateTransform=function(t){void 0===t&&(t=new e.Matrix4);var i=t.clone().multiply(this.transform);!i.equals(this.computedTransform)&&(this.computedTransform.copy(i),this.boundingVolume=Gn(this.header.boundingVolume,this.computedTransform))},t}(),$n=function(){function e(){this.map=new Map,this.array=[],this._length=0}return Object.defineProperty(e.prototype,"length",{get:function(){return this._length},enumerable:!1,configurable:!0}),e.prototype.get=function(e){return this.array[e]},e.prototype.set=function(e,t){e>=this.length&&(this._length=e+1),this.map.has(this.array[e])&&this.map.delete(this.array[e]),this.array[e]=t,this.map.set(t,e)},e.prototype.delete=function(e){var t=this.map.get(e);void 0!==t&&t>=0&&(this.array.splice(t,1),this.map.delete(e),this._length--)},e.prototype.push=function(e){if(!this.map.has(e)){var t=this._length++;this.array[t]=e,this.map.set(e,t)}},e.prototype.pop=function(){var e=this.array[--this._length];return this.map.delete(e),e},e.prototype.reset=function(){this.array=[],this.map=new Map,this._length=0},e.prototype.find=function(e){return this.map.has(e)},e}(),er=function(){function e(e){this.options=e,this._traversalStack=new $n,this._emptyTraversalStack=new $n,this._frameNumber=null,this.root=null,this.selectedTiles={},this.requestedTiles={},this.emptyTiles={}}return e.prototype.traverse=function(e,t){this.root=e,this.reset(),this.updateTile(e,t),this._frameNumber=t.frameNumber,this.executeTraversal(e,t)},e.prototype.reset=function(){this.requestedTiles={},this.selectedTiles={},this.emptyTiles={},this._traversalStack.reset(),this._emptyTraversalStack.reset()},e.prototype.executeTraversal=function(e,t){var i=this._traversalStack;for(e.selectionDepth=1,i.push(e);i.length>0;){var n=i.pop(),r=!1;if(this.canTraverse(n,t)){this.updateChildTiles(n,t);var o=n.hasRenderContent?n.selectionDepth+1:n.selectionDepth;r=this.updateAndPushChildren(n,t,i,o)}var s=n.parent,a=Boolean(!s||s.shouldRefine),l=!r;n.hasRenderContent?"ADD"===n.refine?(this.loadTile(n,t),this.selectTile(n,t)):"REPLACE"===n.refine&&(this.loadTile(n,t),l&&this.selectTile(n,t)):(this.emptyTiles[n.id]=n,this.loadTile(n,t),l&&this.selectTile(n,t)),this.touchTile(n,t),n.shouldRefine=r&&a}this.options.onTraversalEnd(t)},e.prototype.updateChildTiles=function(e,t){for(var i=0,n=e.children;i<n.length;i++){var r=n[i];this.updateTile(r,t)}return!0},e.prototype.updateAndPushChildren=function(e,t,i,n){var r=this.options,o=r.loadSiblings,s=r.skipLevelOfDetail,a=e.children;a.sort(this.compareDistanceToCamera.bind(this));for(var l="REPLACE"===e.refine&&e.hasRenderContent&&!s,u=!1,c=!0,h=0,d=a;h<d.length;h++){var p=d[h];if(p.selectionDepth=n,p.visible?(i.find(p)&&i.delete(p),i.push(p),u=!0):(l||o)&&(this.loadTile(p,t),this.touchTile(p,t)),l){var f=void 0;if(f=p.hasRenderContent?p.contentAvailable:this.executeEmptyTraversal(p,t),!(c=c&&f))return!1}}return u||(c=!1),c},e.prototype.updateTile=function(e,t){this.updateTileVisibility(e,t)},e.prototype.selectTile=function(e,t){this.shouldSelectTile(e)&&(e.selectedFrameNumber=t.frameNumber,this.selectedTiles[e.id]=e)},e.prototype.loadTile=function(e,t){this.shouldLoadTile(e)&&(e.requestedFrameNumber=t.frameNumber,this.requestedTiles[e.id]=e)},e.prototype.touchTile=function(e,t){e.tileset.cache.touch(e),e.touchedFrameNumber=t.frameNumber},e.prototype.canTraverse=function(e,t,i,n){return void 0===i&&(i=!1),void 0===n&&(n=!1),!!e.hasChildren&&(!(!n&&!e.visible)&&this.shouldRefine(e,t,i))},e.prototype.shouldLoadTile=function(e){var t=!this.options.maxDepth||e.depth<=this.options.maxDepth;return e.hasUnloadedContent&&t},e.prototype.shouldSelectTile=function(e){var t=!this.options.maxDepth||e.depth<=this.options.maxDepth;return e.contentAvailable&&!this.options.skipLevelOfDetail&&t},e.prototype.shouldRefine=function(e,t,i){var n=e.screenSpaceError;return i&&(n=e.getScreenSpaceError(t,!0)),n>this.options.maxScreenSpaceError},e.prototype.updateTileVisibility=function(e,t){if(e.updateVisibility(t),e.visible){var i=e.children.length>0;this.meetsScreenSpaceErrorEarly(e,t)?e.visible=!1:"REPLACE"!==e.refine||!i||this.anyChildrenVisible(e,t)||(e.visible=!1)}},e.prototype.meetsScreenSpaceErrorEarly=function(e,t){var i=e.parent;return!(!i||"ADD"!==i.refine)&&!this.shouldRefine(e,t,!0)},e.prototype.compareDistanceToCamera=function(e,t){return 0===t.distanceToCamera&&0===e.distanceToCamera?t.centerZDepth-e.centerZDepth:t.distanceToCamera-e.distanceToCamera},e.prototype.anyChildrenVisible=function(e,t){for(var i=!1,n=0,r=e.children;n<r.length;n++){var o=r[n];o.updateVisibility(t),i=i||o.visible}return i},e.prototype.everyChildrenVisibleIsLoaded=function(e){for(var t=!0,i=0,n=e.children;i<n.length;i++){var r=n[i];r.visible&&"READY"!==r.contentState&&(t=!1)}return t},e.prototype.executeEmptyTraversal=function(e,t){var i=!0,n=this._emptyTraversalStack;for(n.push(e);n.length>0&&i;){var r=n.pop();if(this.updateTile(r,t),r.visible||this.loadTile(r,t),this.touchTile(r,t),!r.hasRenderContent&&this.canTraverse(r,t,!1,!0))for(var o=0,s=r.children;o<s.length;o++){var a=s[o];n.find(a)&&n.delete(a),n.push(a)}else r.contentAvailable||(i=!1)}return i},e}();function tr(e){for(var t=[],i=0,n=Object.keys(e);i<n.length;i++){var r=n[i];t.push(e[r])}return t}var ir=function(){function t(e,t){var i=this;this.rawJson=e,this.b3dmMapping=e.b3dmMapping,this.options=t,this.traverser=new er({loadSiblings:!1,maxScreenSpaceError:this.options.maxScreenSpaceError,skipLevelOfDetail:!1,maxDepth:this.options.maxDepth,onTraversalEnd:function(e){return i.onTraversalEnd(e)}}),this.cache=new An,this.requestScheduler=new dn({throttleRequests:this.options.throttleRequests,maxRequests:this.options.maxRequests}),this.frameNumber=0,this.pendingCount=0,this._tiles={},this.selectedTiles=[],this.requestedTiles=[],this.memoryUsageInBytes=0,this.root=new Jn(this,e.root);for(var n=[this.root];n.length>0;)for(var r=n.pop(),o=0,s=r.header.children||[];o<s.length;o++){var a=s[o],l=new Jn(this,a,r);l.depth=r.depth+1,r.children.push(l),n.push(l)}}return Object.defineProperty(t.prototype,"maxMemoryUsage",{get:function(){return this.options.maxMemoryUsage},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"asset",{get:function(){return this.rawJson.asset},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"type",{get:function(){return this.rawJson.type},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"basePath",{get:function(){return this.rawJson.basePath},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"modelMatrix",{get:function(){return this.options.modelMatrix},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"geometricError",{get:function(){return this.rawJson.geometricError},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lodMetricType",{get:function(){return this.rawJson.lodMetricType},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lodMetricValue",{get:function(){return this.rawJson.lodMetricValue},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"refine",{get:function(){return this.rawJson.root.refine},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"tiles",{get:function(){return tr(this._tiles)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"floorInfo",{get:function(){return this.rawJson.floorInfo||this.rawJson.floor_info||[]},enumerable:!1,configurable:!0}),t.prototype.reset=function(){for(var e=[this.root];e.length>0;){for(var t=e.pop(),i=0,n=t.children;i<n.length;i++){var r=n[i];e.push(r)}this.cache.unloadTile(t),this.unloadTile(t)}this.cache.reset(),this.traverser.reset(),this.selectedTiles=[],this.requestedTiles=[]},t.prototype.isLoaded=function(){return 0===this.pendingCount&&0!==this.frameNumber},t.prototype.onTraversalEnd=function(t){var i=this,n=(new e.Vector3).fromArray(t.camera.position);this.selectedTiles=this.options.onTraversalComplete(tr(this.traverser.selectedTiles)),this.requestedTiles=tr(this.traverser.requestedTiles).slice().sort((function(e,t){return e.boundingVolume.center.distanceTo(n)-t.boundingVolume.center.distanceTo(n)}));for(var r=0,o=this.selectedTiles;r<o.length;r++){var s=o[r];this._tiles[s.id]=s}for(var a=0,l=this.requestedTiles;a<l.length;a++){(s=l[a]).contentUnloaded&&this.loadTile(s)}this.cache.unloadTiles((function(){return i.memoryUsageInBytes>1024*i.maxMemoryUsage*1024}),(function(e){return i.unloadTile(e)}))},t.prototype.loadTile=function(e){var t=this;this.pendingCount++,e.loadContent().catch((function(i){var n=i.message||i.toString();return console.error("A 3D tile failed to load: ".concat(e.id," ").concat(n)),t.options.onTileError(e,n),!1})).then((function(i){t.pendingCount--,i&&(t.cache.add(e,(function(){e.content&&(t.memoryUsageInBytes+=e.content.byteLength||0)})),t.options.onTileLoad(e))}))},t.prototype.unloadTile=function(e){this.memoryUsageInBytes-=e.content&&e.content.byteLength||0,this.options.onTileUnload(e),e.unloadContent()},t}();function nr(){return(65536*(1+Math.random())|0).toString(16).substring(1)}function rr(){return(nr()+nr()+"-"+nr()+"-4"+nr().substr(0,3)+"-"+nr()+"-"+nr()+nr()+nr()).toLowerCase()}function or(e,t){var i;return e.content&&(e.contentUrl="".concat(t,"/").concat(e.content.uri||e.content.url)),e.id=null!==(i=e.contentUrl)&&void 0!==i?i:"empty:"+rr(),e.lodMetricType="geometricError",e.lodMetricValue=e.geometricError,e.transformMatrix=e.transform,e.type=e.contentUrl?"SCENEGRAPH":"EMPTY",e.refine=function(e){switch(e){case"REPLACE":case"replace":return"REPLACE";case"ADD":case"add":return"ADD";default:throw new Error("refine ".concat(e," is not supported."))}}(e.refine),e}function sr(e,t){var i,n=JSON.parse(JSON.stringify(e));return n.basePath=t,n.root=function(e,t){e=or(e,t);var i=[];for(i.push(e);i.length>0;)for(var n=0,r=(i.pop()||{}).children||[];n<r.length;n++){var o=r[n];or(o,t),i.push(o)}return e}(n.root,t),n.type="TILES3D",n.lodMetricType="geometricError",n.lodMetricValue=(null===(i=n.root)||void 0===i?void 0:i.lodMetricValue)||0,n}var ar=function(){function t(t){e.Loader.call(this,t),this.dracoLoader=null,this.ddsLoader=null}function i(){var e={};return{get:function(t){return e[t]},add:function(t,i){e[t]=i},remove:function(t){delete e[t]},removeAll:function(){e={}}}}t.prototype=Object.assign(Object.create(e.Loader.prototype),{constructor:t,load:function(t,i,n,r){var o,s=this;o=""!==this.resourcePath?this.resourcePath:""!==this.path?this.path:e.LoaderUtils.extractUrlBase(t),s.manager.itemStart(t);var a=function(e){r?r(e):console.error(e),s.manager.itemError(t),s.manager.itemEnd(t)},l=new e.FileLoader(s.manager);l.setPath(this.path),l.setResponseType("arraybuffer"),l.setRequestHeader(this.requestHeader),"use-credentials"===s.crossOrigin&&l.setWithCredentials(!0),l.load(t,(function(e){try{s.parse(e,o,(function(e){i(e),s.manager.itemEnd(t)}),a)}catch(e){a(e)}}),n,a)},setDRACOLoader:function(e){return this.dracoLoader=e,this},setDDSLoader:function(e){return this.ddsLoader=e,this},parse:function(t,i,u,c){var f,g={};if("string"==typeof t)f=t;else if(e.LoaderUtils.decodeText(new Uint8Array(t,0,4))===l){try{g[n.KHR_BINARY_GLTF]=new h(t)}catch(e){return void(c&&c(e))}f=g[n.KHR_BINARY_GLTF].content}else f=e.LoaderUtils.decodeText(new Uint8Array(t));var v=JSON.parse(f);if(void 0===v.asset||v.asset.version[0]<2)c&&c(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));else{if(v.extensionsUsed)for(var y=0;y<v.extensionsUsed.length;++y){var b=v.extensionsUsed[y],x=v.extensionsRequired||[];switch(b){case n.KHR_LIGHTS_PUNCTUAL:g[b]=new o(v);break;case n.KHR_MATERIALS_CLEARCOAT:g[b]=new a;break;case n.KHR_MATERIALS_UNLIT:g[b]=new s;break;case n.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:g[b]=new A;break;case n.KHR_DRACO_MESH_COMPRESSION:g[b]=new d(v,this.dracoLoader);break;case n.MSFT_TEXTURE_DDS:g[b]=new r(this.ddsLoader);break;case n.KHR_TEXTURE_TRANSFORM:g[b]=new p;break;case n.KHR_MESH_QUANTIZATION:g[b]=new m;break;default:x.indexOf(b)>=0&&console.warn('THREE.GLTFLoader: Unknown extension "'+b+'".')}}var w=new q(v,g,{path:i||this.resourcePath||"",crossOrigin:this.crossOrigin,manager:this.manager});w.fileLoader.setRequestHeader(this.requestHeader),w.parse(u,c)}}});var n={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:"KHR_materials_pbrSpecularGlossiness",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",MSFT_TEXTURE_DDS:"MSFT_texture_dds"};function r(e){if(!e)throw new Error("THREE.GLTFLoader: Attempting to load .dds texture without importing DDSLoader");this.name=n.MSFT_TEXTURE_DDS,this.ddsLoader=e}function o(e){this.name=n.KHR_LIGHTS_PUNCTUAL;var t=e.extensions&&e.extensions[n.KHR_LIGHTS_PUNCTUAL]||{};this.lightDefs=t.lights||[]}function s(){this.name=n.KHR_MATERIALS_UNLIT}function a(){this.name=n.KHR_MATERIALS_CLEARCOAT}o.prototype.loadLight=function(t){var i,n=this.lightDefs[t],r=new e.Color(16777215);void 0!==n.color&&r.fromArray(n.color);var o=void 0!==n.range?n.range:0;switch(n.type){case"directional":(i=new e.DirectionalLight(r)).target.position.set(0,0,-1),i.add(i.target);break;case"point":(i=new e.PointLight(r)).distance=o;break;case"spot":(i=new e.SpotLight(r)).distance=o,n.spot=n.spot||{},n.spot.innerConeAngle=void 0!==n.spot.innerConeAngle?n.spot.innerConeAngle:0,n.spot.outerConeAngle=void 0!==n.spot.outerConeAngle?n.spot.outerConeAngle:Math.PI/4,i.angle=n.spot.outerConeAngle,i.penumbra=1-n.spot.innerConeAngle/n.spot.outerConeAngle,i.target.position.set(0,0,-1),i.add(i.target);break;default:throw new Error('THREE.GLTFLoader: Unexpected light type, "'+n.type+'".')}return i.position.set(0,0,0),i.decay=2,void 0!==n.intensity&&(i.intensity=n.intensity),i.name=n.name||"light_"+t,Promise.resolve(i)},s.prototype.getMaterialType=function(){return e.MeshBasicMaterial},s.prototype.extendParams=function(t,i,n){var r=[];t.color=new e.Color(1,1,1),t.opacity=1;var o=i.pbrMetallicRoughness;if(o){if(Array.isArray(o.baseColorFactor)){var s=o.baseColorFactor;t.color.fromArray(s),t.opacity=s[3]}void 0!==o.baseColorTexture&&r.push(n.assignTexture(t,"map",o.baseColorTexture))}return Promise.all(r)},a.prototype.getMaterialType=function(){return e.MeshPhysicalMaterial},a.prototype.extendParams=function(t,i,n){var r=[],o=i.extensions[this.name];if(void 0!==o.clearcoatFactor&&(t.clearcoat=o.clearcoatFactor),void 0!==o.clearcoatTexture&&r.push(n.assignTexture(t,"clearcoatMap",o.clearcoatTexture)),void 0!==o.clearcoatRoughnessFactor&&(t.clearcoatRoughness=o.clearcoatRoughnessFactor),void 0!==o.clearcoatRoughnessTexture&&r.push(n.assignTexture(t,"clearcoatRoughnessMap",o.clearcoatRoughnessTexture)),void 0!==o.clearcoatNormalTexture&&(r.push(n.assignTexture(t,"clearcoatNormalMap",o.clearcoatNormalTexture)),void 0!==o.clearcoatNormalTexture.scale)){var s=o.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new e.Vector2(s,s)}return Promise.all(r)};var l="glTF",u=1313821514,c=5130562;function h(t){this.name=n.KHR_BINARY_GLTF,this.content=null,this.body=null;var i=new DataView(t,0,12);if(this.header={magic:e.LoaderUtils.decodeText(new Uint8Array(t.slice(0,4))),version:i.getUint32(4,!0),length:i.getUint32(8,!0)},this.header.magic!==l)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");for(var r=new DataView(t,12),o=0;o<r.byteLength;){var s=r.getUint32(o,!0);o+=4;var a=r.getUint32(o,!0);if(o+=4,a===u){var h=new Uint8Array(t,12+o,s);this.content=e.LoaderUtils.decodeText(h)}else if(a===c){var d=12+o;this.body=t.slice(d,d+s)}o+=s}if(null===this.content)throw new Error("THREE.GLTFLoader: JSON content not found.")}function d(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=n.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}function p(){this.name=n.KHR_TEXTURE_TRANSFORM}function f(t){e.MeshStandardMaterial.call(this),this.isGLTFSpecularGlossinessMaterial=!0;var i=["#ifdef USE_SPECULARMAP","\tuniform sampler2D specularMap;","#endif"].join("\n"),n=["#ifdef USE_GLOSSINESSMAP","\tuniform sampler2D glossinessMap;","#endif"].join("\n"),r=["vec3 specularFactor = specular;","#ifdef USE_SPECULARMAP","\tvec4 texelSpecular = texture2D( specularMap, vUv );","\ttexelSpecular = sRGBToLinear( texelSpecular );","\t// reads channel RGB, compatible with a glTF Specular-Glossiness (RGBA) texture","\tspecularFactor *= texelSpecular.rgb;","#endif"].join("\n"),o=["float glossinessFactor = glossiness;","#ifdef USE_GLOSSINESSMAP","\tvec4 texelGlossiness = texture2D( glossinessMap, vUv );","\t// reads channel A, compatible with a glTF Specular-Glossiness (RGBA) texture","\tglossinessFactor *= texelGlossiness.a;","#endif"].join("\n"),s=["PhysicalMaterial material;","material.diffuseColor = diffuseColor.rgb;","vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );","float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );","material.specularRoughness = max( 1.0 - glossinessFactor, 0.0525 );// 0.0525 corresponds to the base mip of a 256 cubemap.","material.specularRoughness += geometryRoughness;","material.specularRoughness = min( material.specularRoughness, 1.0 );","material.specularColor = specularFactor.rgb;"].join("\n"),a={specular:{value:(new e.Color).setHex(16777215)},glossiness:{value:1},specularMap:{value:null},glossinessMap:{value:null}};this._extraUniforms=a,this.onBeforeCompile=function(e){for(var t in a)e.uniforms[t]=a[t];e.fragmentShader=e.fragmentShader.replace("uniform float roughness;","uniform vec3 specular;"),e.fragmentShader=e.fragmentShader.replace("uniform float metalness;","uniform float glossiness;"),e.fragmentShader=e.fragmentShader.replace("#include <roughnessmap_pars_fragment>",i),e.fragmentShader=e.fragmentShader.replace("#include <metalnessmap_pars_fragment>",n),e.fragmentShader=e.fragmentShader.replace("#include <roughnessmap_fragment>",r),e.fragmentShader=e.fragmentShader.replace("#include <metalnessmap_fragment>",o),e.fragmentShader=e.fragmentShader.replace("#include <lights_physical_fragment>",s)},Object.defineProperties(this,{specular:{get:function(){return a.specular.value},set:function(e){a.specular.value=e}},specularMap:{get:function(){return a.specularMap.value},set:function(e){a.specularMap.value=e}},glossiness:{get:function(){return a.glossiness.value},set:function(e){a.glossiness.value=e}},glossinessMap:{get:function(){return a.glossinessMap.value},set:function(e){a.glossinessMap.value=e,e?(this.defines.USE_GLOSSINESSMAP="",this.defines.USE_ROUGHNESSMAP=""):(delete this.defines.USE_ROUGHNESSMAP,delete this.defines.USE_GLOSSINESSMAP)}}}),delete this.metalness,delete this.roughness,delete this.metalnessMap,delete this.roughnessMap,this.setValues(t)}function A(){return{name:n.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS,specularGlossinessParams:["color","map","lightMap","lightMapIntensity","aoMap","aoMapIntensity","emissive","emissiveIntensity","emissiveMap","bumpMap","bumpScale","normalMap","normalMapType","displacementMap","displacementScale","displacementBias","specularMap","specular","glossinessMap","glossiness","alphaMap","envMap","envMapIntensity","refractionRatio"],getMaterialType:function(){return f},extendParams:function(t,i,n){var r=i.extensions[this.name];t.color=new e.Color(1,1,1),t.opacity=1;var o=[];if(Array.isArray(r.diffuseFactor)){var s=r.diffuseFactor;t.color.fromArray(s),t.opacity=s[3]}if(void 0!==r.diffuseTexture&&o.push(n.assignTexture(t,"map",r.diffuseTexture)),t.emissive=new e.Color(0,0,0),t.glossiness=void 0!==r.glossinessFactor?r.glossinessFactor:1,t.specular=new e.Color(1,1,1),Array.isArray(r.specularFactor)&&t.specular.fromArray(r.specularFactor),void 0!==r.specularGlossinessTexture){var a=r.specularGlossinessTexture;o.push(n.assignTexture(t,"glossinessMap",a)),o.push(n.assignTexture(t,"specularMap",a))}return Promise.all(o)},createMaterial:function(t){var i=new f(t);return i.fog=!0,i.color=t.color,i.map=void 0===t.map?null:t.map,i.lightMap=null,i.lightMapIntensity=1,i.aoMap=void 0===t.aoMap?null:t.aoMap,i.aoMapIntensity=1,i.emissive=t.emissive,i.emissiveIntensity=1,i.emissiveMap=void 0===t.emissiveMap?null:t.emissiveMap,i.bumpMap=void 0===t.bumpMap?null:t.bumpMap,i.bumpScale=1,i.normalMap=void 0===t.normalMap?null:t.normalMap,i.normalMapType=e.TangentSpaceNormalMap,t.normalScale&&(i.normalScale=t.normalScale),i.displacementMap=null,i.displacementScale=1,i.displacementBias=0,i.specularMap=void 0===t.specularMap?null:t.specularMap,i.specular=t.specular,i.glossinessMap=void 0===t.glossinessMap?null:t.glossinessMap,i.glossiness=t.glossiness,i.alphaMap=null,i.envMap=void 0===t.envMap?null:t.envMap,i.envMapIntensity=1,i.refractionRatio=.98,i}}}function m(){this.name=n.KHR_MESH_QUANTIZATION}function g(t,i,n,r){e.Interpolant.call(this,t,i,n,r)}d.prototype.decodePrimitive=function(e,t){var i=this.json,n=this.dracoLoader,r=e.extensions[this.name].bufferView,o=e.extensions[this.name].attributes,s={},a={},l={};for(var u in o){var c=T[u]||u.toLowerCase();s[c]=o[u]}for(u in e.attributes){c=T[u]||u.toLowerCase();if(void 0!==o[u]){var h=i.accessors[e.attributes[u]],d=S[h.componentType];l[c]=d,a[c]=!0===h.normalized}}return t.getDependency("bufferView",r).then((function(e){return new Promise((function(t){n.decodeDracoFile(e,(function(e){for(var i in e.attributes){var n=e.attributes[i],r=a[i];void 0!==r&&(n.normalized=r)}t(e)}),s,l)}))}))},p.prototype.extendTexture=function(e,t){return e=e.clone(),void 0!==t.offset&&e.offset.fromArray(t.offset),void 0!==t.rotation&&(e.rotation=t.rotation),void 0!==t.scale&&e.repeat.fromArray(t.scale),void 0!==t.texCoord&&console.warn('THREE.GLTFLoader: Custom UV sets in "'+this.name+'" extension not yet supported.'),e.needsUpdate=!0,e},f.prototype=Object.create(e.MeshStandardMaterial.prototype),f.prototype.constructor=f,f.prototype.copy=function(t){return e.MeshStandardMaterial.prototype.copy.call(this,t),this.specularMap=t.specularMap,this.specular.copy(t.specular),this.glossinessMap=t.glossinessMap,this.glossiness=t.glossiness,delete this.metalness,delete this.roughness,delete this.metalnessMap,delete this.roughnessMap,this},g.prototype=Object.create(e.Interpolant.prototype),g.prototype.constructor=g,g.prototype.copySampleValue_=function(e){for(var t=this.resultBuffer,i=this.sampleValues,n=this.valueSize,r=e*n*3+n,o=0;o!==n;o++)t[o]=i[r+o];return t},g.prototype.beforeStart_=g.prototype.copySampleValue_,g.prototype.afterEnd_=g.prototype.copySampleValue_,g.prototype.interpolate_=function(e,t,i,n){for(var r=this.resultBuffer,o=this.sampleValues,s=this.valueSize,a=2*s,l=3*s,u=n-t,c=(i-t)/u,h=c*c,d=h*c,p=e*l,f=p-l,A=-2*d+3*h,m=d-h,g=1-A,v=m-h+c,y=0;y!==s;y++){var b=o[f+y+s],x=o[f+y+a]*u,w=o[p+y+s],E=o[p+y]*u;r[y]=g*b+v*x+A*w+m*E}return r};var v=0,y=1,b=2,x=3,w=4,E=5,M=6,S={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},C={9728:e.NearestFilter,9729:e.LinearFilter,9984:e.NearestMipmapNearestFilter,9985:e.LinearMipmapNearestFilter,9986:e.NearestMipmapLinearFilter,9987:e.LinearMipmapLinearFilter},I={33071:e.ClampToEdgeWrapping,33648:e.MirroredRepeatWrapping,10497:e.RepeatWrapping},B={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},T={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv2",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},P={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},R={CUBICSPLINE:void 0,LINEAR:e.InterpolateLinear,STEP:e.InterpolateDiscrete},D="OPAQUE",L="MASK",k="BLEND",F={"image/png":e.RGBAFormat,"image/jpeg":e.RGBFormat};function O(e,t){return"string"!=typeof e||""===e?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}function N(e,t,i){for(var n in i.extensions)void 0===e[n]&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[n]=i.extensions[n])}function V(e,t){void 0!==t.extras&&("object"==typeof t.extras?Object.assign(e.userData,t.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras))}function Q(e,t){if(e.updateMorphTargets(),void 0!==t.weights)for(var i=0,n=t.weights.length;i<n;i++)e.morphTargetInfluences[i]=t.weights[i];if(t.extras&&Array.isArray(t.extras.targetNames)){var r=t.extras.targetNames;if(e.morphTargetInfluences.length===r.length){e.morphTargetDictionary={};for(i=0,n=r.length;i<n;i++)e.morphTargetDictionary[r[i]]=i}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function H(e){for(var t="",i=Object.keys(e).sort(),n=0,r=i.length;n<r;n++)t+=i[n]+":"+e[i[n]]+";";return t}function q(t,n,r){this.json=t||{},this.extensions=n||{},this.options=r||{},this.cache=new i,this.associations=new Map,this.primitiveCache={},this.textureLoader=new e.TextureLoader(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.fileLoader=new e.FileLoader(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}function z(t,i,n){var r=i.attributes,o=[];function s(e,i){return n.getDependency("accessor",e).then((function(e){t.setAttribute(i,e)}))}for(var a in r){var l=T[a]||a.toLowerCase();l in t.attributes||o.push(s(r[a],l))}if(void 0!==i.indices&&!t.index){var u=n.getDependency("accessor",i.indices).then((function(e){t.setIndex(e)}));o.push(u)}return V(t,i),function(t,i,n){var r=i.attributes,o=new e.Box3;if(void 0!==r.POSITION){var s=(p=n.json.accessors[r.POSITION]).min,a=p.max;if(void 0!==s&&void 0!==a){o.set(new e.Vector3(s[0],s[1],s[2]),new e.Vector3(a[0],a[1],a[2]));var l=i.targets;if(void 0!==l){for(var u=new e.Vector3,c=new e.Vector3,h=0,d=l.length;h<d;h++){var p,f=l[h];if(void 0!==f.POSITION)s=(p=n.json.accessors[f.POSITION]).min,a=p.max,void 0!==s&&void 0!==a?(c.setX(Math.max(Math.abs(s[0]),Math.abs(a[0]))),c.setY(Math.max(Math.abs(s[1]),Math.abs(a[1]))),c.setZ(Math.max(Math.abs(s[2]),Math.abs(a[2]))),u.max(c)):console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}o.expandByVector(u)}t.boundingBox=o;var A=new e.Sphere;o.getCenter(A.center),A.radius=o.min.distanceTo(o.max)/2,t.boundingSphere=A}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}(t,i,n),Promise.all(o).then((function(){return void 0!==i.targets?function(e,t,i){for(var n=!1,r=!1,o=0,s=t.length;o<s&&(void 0!==(u=t[o]).POSITION&&(n=!0),void 0!==u.NORMAL&&(r=!0),!n||!r);o++);if(!n&&!r)return Promise.resolve(e);var a=[],l=[];for(o=0,s=t.length;o<s;o++){var u=t[o];if(n){var c=void 0!==u.POSITION?i.getDependency("accessor",u.POSITION):e.attributes.position;a.push(c)}r&&(c=void 0!==u.NORMAL?i.getDependency("accessor",u.NORMAL):e.attributes.normal,l.push(c))}return Promise.all([Promise.all(a),Promise.all(l)]).then((function(t){var i=t[0],o=t[1];return n&&(e.morphAttributes.position=i),r&&(e.morphAttributes.normal=o),e.morphTargetsRelative=!0,e}))}(t,i.targets,n):t}))}function U(t,i){var n=t.getIndex();if(null===n){var r=[],o=t.getAttribute("position");if(void 0===o)return console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),t;for(var s=0;s<o.count;s++)r.push(s);t.setIndex(r),n=t.getIndex()}var a=n.count-2,l=[];if(i===e.TriangleFanDrawMode)for(s=1;s<=a;s++)l.push(n.getX(0)),l.push(n.getX(s)),l.push(n.getX(s+1));else for(s=0;s<a;s++)s%2==0?(l.push(n.getX(s)),l.push(n.getX(s+1)),l.push(n.getX(s+2))):(l.push(n.getX(s+2)),l.push(n.getX(s+1)),l.push(n.getX(s)));l.length/3!==a&&console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");var u=t.clone();return u.setIndex(l),u}return q.prototype.parse=function(e,t){var i=this,n=this.json,r=this.extensions;this.cache.removeAll(),this.markDefs(),Promise.all([this.getDependencies("scene"),this.getDependencies("animation"),this.getDependencies("camera")]).then((function(t){var o={scene:t[0][n.scene||0],scenes:t[0],animations:t[1],cameras:t[2],asset:n.asset,parser:i,userData:{}};N(r,o,n),V(o,n),e(o)})).catch(t)},q.prototype.markDefs=function(){for(var e=this.json.nodes||[],t=this.json.skins||[],i=this.json.meshes||[],n={},r={},o=0,s=t.length;o<s;o++)for(var a=t[o].joints,l=0,u=a.length;l<u;l++)e[a[l]].isBone=!0;for(var c=0,h=e.length;c<h;c++){var d=e[c];void 0!==d.mesh&&(void 0===n[d.mesh]&&(n[d.mesh]=r[d.mesh]=0),n[d.mesh]++,void 0!==d.skin&&(i[d.mesh].isSkinnedMesh=!0))}this.json.meshReferences=n,this.json.meshUses=r},q.prototype.getDependency=function(e,t){var i=e+":"+t,r=this.cache.get(i);if(!r){switch(e){case"scene":r=this.loadScene(t);break;case"node":r=this.loadNode(t);break;case"mesh":r=this.loadMesh(t);break;case"accessor":r=this.loadAccessor(t);break;case"bufferView":r=this.loadBufferView(t);break;case"buffer":r=this.loadBuffer(t);break;case"material":r=this.loadMaterial(t);break;case"texture":r=this.loadTexture(t);break;case"skin":r=this.loadSkin(t);break;case"animation":r=this.loadAnimation(t);break;case"camera":r=this.loadCamera(t);break;case"light":r=this.extensions[n.KHR_LIGHTS_PUNCTUAL].loadLight(t);break;default:throw new Error("Unknown type: "+e)}this.cache.add(i,r)}return r},q.prototype.getDependencies=function(e){var t=this.cache.get(e);if(!t){var i=this,n=this.json[e+("mesh"===e?"es":"s")]||[];t=Promise.all(n.map((function(t,n){return i.getDependency(e,n)}))),this.cache.add(e,t)}return t},q.prototype.loadBuffer=function(e){var t=this.json.buffers[e],i=this.fileLoader;if(t.type&&"arraybuffer"!==t.type)throw new Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(void 0===t.uri&&0===e)return Promise.resolve(this.extensions[n.KHR_BINARY_GLTF].body);var r=this.options;return new Promise((function(e,n){i.load(O(t.uri,r.path),e,void 0,(function(){n(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))}))}))},q.prototype.loadBufferView=function(e){var t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then((function(e){var i=t.byteLength||0,n=t.byteOffset||0;return e.slice(n,n+i)}))},q.prototype.loadAccessor=function(t){var i=this,n=this.json,r=this.json.accessors[t];if(void 0===r.bufferView&&void 0===r.sparse)return Promise.resolve(null);var o=[];return void 0!==r.bufferView?o.push(this.getDependency("bufferView",r.bufferView)):o.push(null),void 0!==r.sparse&&(o.push(this.getDependency("bufferView",r.sparse.indices.bufferView)),o.push(this.getDependency("bufferView",r.sparse.values.bufferView))),Promise.all(o).then((function(t){var o,s,a=t[0],l=B[r.type],u=S[r.componentType],c=u.BYTES_PER_ELEMENT,h=c*l,d=r.byteOffset||0,p=void 0!==r.bufferView?n.bufferViews[r.bufferView].byteStride:void 0,f=!0===r.normalized;if(p&&p!==h){var A=Math.floor(d/p),m="InterleavedBuffer:"+r.bufferView+":"+r.componentType+":"+A+":"+r.count,g=i.cache.get(m);g||(o=new u(a,A*p,r.count*p/c),g=new e.InterleavedBuffer(o,p/c),i.cache.add(m,g)),s=new e.InterleavedBufferAttribute(g,l,d%p/c,f)}else o=null===a?new u(r.count*l):new u(a,d,r.count*l),s=new e.BufferAttribute(o,l,f);if(void 0!==r.sparse){var v=B.SCALAR,y=S[r.sparse.indices.componentType],b=r.sparse.indices.byteOffset||0,x=r.sparse.values.byteOffset||0,w=new y(t[1],b,r.sparse.count*v),E=new u(t[2],x,r.sparse.count*l);null!==a&&(s=new e.BufferAttribute(s.array.slice(),s.itemSize,s.normalized));for(var M=0,C=w.length;M<C;M++){var I=w[M];if(s.setX(I,E[M*l]),l>=2&&s.setY(I,E[M*l+1]),l>=3&&s.setZ(I,E[M*l+2]),l>=4&&s.setW(I,E[M*l+3]),l>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return s}))},q.prototype.loadTexture=function(t){var i,r=this,o=this.json,s=this.options,a=this.textureLoader,l=self.URL||self.webkitURL,u=o.textures[t],c=u.extensions||{},h=(i=c[n.MSFT_TEXTURE_DDS]?o.images[c[n.MSFT_TEXTURE_DDS].source]:o.images[u.source]).uri,d=!1;return void 0!==i.bufferView&&(h=r.getDependency("bufferView",i.bufferView).then((function(e){d=!0;var t=new Blob([e],{type:i.mimeType});return h=l.createObjectURL(t)}))),Promise.resolve(h).then((function(e){var t=s.manager.getHandler(e);return t||(t=c[n.MSFT_TEXTURE_DDS]?r.extensions[n.MSFT_TEXTURE_DDS].ddsLoader:a),new Promise((function(i,n){t.load(O(e,s.path),i,void 0,n)}))})).then((function(n){!0===d&&l.revokeObjectURL(h),n.flipY=!1,u.name&&(n.name=u.name),i.mimeType in F&&(n.format=F[i.mimeType]);var s=(o.samplers||{})[u.sampler]||{};return n.magFilter=C[s.magFilter]||e.LinearFilter,n.minFilter=C[s.minFilter]||e.LinearMipmapLinearFilter,n.wrapS=I[s.wrapS]||e.RepeatWrapping,n.wrapT=I[s.wrapT]||e.RepeatWrapping,r.associations.set(n,{type:"textures",index:t}),n}))},q.prototype.assignTexture=function(t,i,r){var o=this;return this.getDependency("texture",r.index).then((function(s){if(!s.isCompressedTexture)switch(i){case"aoMap":case"emissiveMap":case"metalnessMap":case"normalMap":case"roughnessMap":s.format=e.RGBFormat}if(void 0===r.texCoord||0==r.texCoord||"aoMap"===i&&1==r.texCoord||console.warn("THREE.GLTFLoader: Custom UV set "+r.texCoord+" for texture "+i+" not yet supported."),o.extensions[n.KHR_TEXTURE_TRANSFORM]){var a=void 0!==r.extensions?r.extensions[n.KHR_TEXTURE_TRANSFORM]:void 0;if(a){var l=this.associations.get(s);s=o.extensions[n.KHR_TEXTURE_TRANSFORM].extendTexture(s,a),this.associations.set(s,l)}}t[i]=s}))},q.prototype.assignFinalMaterial=function(t){var i=t.geometry,n=t.material,r=void 0!==i.attributes.tangent,o=void 0!==i.attributes.color,s=void 0===i.attributes.normal,a=!0===t.isSkinnedMesh,l=Object.keys(i.morphAttributes).length>0,u=l&&void 0!==i.morphAttributes.normal;if(t.isPoints){var c="PointsMaterial:"+n.uuid,h=this.cache.get(c);h||(h=new e.PointsMaterial,e.Material.prototype.copy.call(h,n),h.color.copy(n.color),h.map=n.map,h.sizeAttenuation=!1,this.cache.add(c,h)),n=h}else if(t.isLine){c="LineBasicMaterial:"+n.uuid;var d=this.cache.get(c);d||(d=new e.LineBasicMaterial,e.Material.prototype.copy.call(d,n),d.color.copy(n.color),this.cache.add(c,d)),n=d}if(r||o||s||a||l){c="ClonedMaterial:"+n.uuid+":";n.isGLTFSpecularGlossinessMaterial&&(c+="specular-glossiness:"),a&&(c+="skinning:"),r&&(c+="vertex-tangents:"),o&&(c+="vertex-colors:"),s&&(c+="flat-shading:"),l&&(c+="morph-targets:"),u&&(c+="morph-normals:");var p=this.cache.get(c);p||(p=n.clone(),a&&(p.skinning=!0),r&&(p.vertexTangents=!0),o&&(p.vertexColors=!0),s&&(p.flatShading=!0),l&&(p.morphTargets=!0),u&&(p.morphNormals=!0),this.cache.add(c,p),this.associations.set(p,this.associations.get(n))),n=p}n.aoMap&&void 0===i.attributes.uv2&&void 0!==i.attributes.uv&&i.setAttribute("uv2",i.attributes.uv),n.normalScale&&!r&&(n.normalScale.y=-n.normalScale.y),n.clearcoatNormalScale&&!r&&(n.clearcoatNormalScale.y=-n.clearcoatNormalScale.y),t.material=n},q.prototype.loadMaterial=function(t){var i,r=this,o=this.json,s=this.extensions,a=o.materials[t],l={},u=a.extensions||{},c=[];if(u[n.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS]){var h=s[n.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS];i=h.getMaterialType(),c.push(h.extendParams(l,a,r))}else if(u[n.KHR_MATERIALS_UNLIT]){var d=s[n.KHR_MATERIALS_UNLIT];i=d.getMaterialType(),c.push(d.extendParams(l,a,r))}else{i=e.MeshStandardMaterial;var p=a.pbrMetallicRoughness||{};if(l.color=new e.Color(1,1,1),l.opacity=1,Array.isArray(p.baseColorFactor)){var A=p.baseColorFactor;l.color.fromArray(A),l.opacity=A[3]}void 0!==p.baseColorTexture&&c.push(r.assignTexture(l,"map",p.baseColorTexture)),l.metalness=void 0!==p.metallicFactor?p.metallicFactor:1,l.roughness=void 0!==p.roughnessFactor?p.roughnessFactor:1,void 0!==p.metallicRoughnessTexture&&(c.push(r.assignTexture(l,"metalnessMap",p.metallicRoughnessTexture)),c.push(r.assignTexture(l,"roughnessMap",p.metallicRoughnessTexture)))}!0===a.doubleSided&&(l.side=e.DoubleSide);var m=a.alphaMode||D;if(m===k?(l.transparent=!0,l.depthWrite=!1):(l.transparent=!1,m===L&&(l.alphaTest=void 0!==a.alphaCutoff?a.alphaCutoff:.5)),void 0!==a.normalTexture&&i!==e.MeshBasicMaterial&&(c.push(r.assignTexture(l,"normalMap",a.normalTexture)),l.normalScale=new e.Vector2(1,1),void 0!==a.normalTexture.scale&&l.normalScale.set(a.normalTexture.scale,a.normalTexture.scale)),void 0!==a.occlusionTexture&&i!==e.MeshBasicMaterial&&(c.push(r.assignTexture(l,"aoMap",a.occlusionTexture)),void 0!==a.occlusionTexture.strength&&(l.aoMapIntensity=a.occlusionTexture.strength)),void 0!==a.emissiveFactor&&i!==e.MeshBasicMaterial&&(l.emissive=(new e.Color).fromArray(a.emissiveFactor)),void 0!==a.emissiveTexture&&i!==e.MeshBasicMaterial&&c.push(r.assignTexture(l,"emissiveMap",a.emissiveTexture)),u[n.KHR_MATERIALS_CLEARCOAT]){var g=s[n.KHR_MATERIALS_CLEARCOAT];i=g.getMaterialType(),c.push(g.extendParams(l,{extensions:u},r))}return Promise.all(c).then((function(){var o;return o=i===f?s[n.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS].createMaterial(l):new i(l),a.name&&(o.name=a.name),o.map&&(o.map.encoding=e.sRGBEncoding),o.emissiveMap&&(o.emissiveMap.encoding=e.sRGBEncoding),V(o,a),r.associations.set(o,{type:"materials",index:t}),a.extensions&&N(s,o,a),o}))},q.prototype.loadGeometries=function(t){var i=this,r=this.extensions,o=this.primitiveCache;function s(e){return r[n.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,i).then((function(t){return z(t,e,i)}))}for(var a,l,u=[],c=0,h=t.length;c<h;c++){var d,p=t[c],f=(l=void 0,(l=(a=p).extensions&&a.extensions[n.KHR_DRACO_MESH_COMPRESSION])?"draco:"+l.bufferView+":"+l.indices+":"+H(l.attributes):a.indices+":"+H(a.attributes)+":"+a.mode),A=o[f];if(A)u.push(A.promise);else d=p.extensions&&p.extensions[n.KHR_DRACO_MESH_COMPRESSION]?s(p):z(new e.BufferGeometry,p,i),o[f]={primitive:p,promise:d},u.push(d)}return Promise.all(u)},q.prototype.loadMesh=function(t){for(var i,n=this,r=this.json.meshes[t],o=r.primitives,s=[],a=0,l=o.length;a<l;a++){var u=void 0===o[a].material?(void 0===(i=this.cache).DefaultMaterial&&(i.DefaultMaterial=new e.MeshStandardMaterial({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:e.FrontSide})),i.DefaultMaterial):this.getDependency("material",o[a].material);s.push(u)}return s.push(n.loadGeometries(o)),Promise.all(s).then((function(i){for(var s=i.slice(0,i.length-1),a=i[i.length-1],l=[],u=0,c=a.length;u<c;u++){var h,d=a[u],p=o[u],f=s[u];if(p.mode===w||p.mode===E||p.mode===M||void 0===p.mode)!0!==(h=!0===r.isSkinnedMesh?new e.SkinnedMesh(d,f):new e.Mesh(d,f)).isSkinnedMesh||h.geometry.attributes.skinWeight.normalized||h.normalizeSkinWeights(),p.mode===E?h.geometry=U(h.geometry,e.TriangleStripDrawMode):p.mode===M&&(h.geometry=U(h.geometry,e.TriangleFanDrawMode));else if(p.mode===y)h=new e.LineSegments(d,f);else if(p.mode===x)h=new e.Line(d,f);else if(p.mode===b)h=new e.LineLoop(d,f);else{if(p.mode!==v)throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+p.mode);h=new e.Points(d,f)}Object.keys(h.geometry.morphAttributes).length>0&&Q(h,r),h.name=r.name||"mesh_"+t,a.length>1&&(h.name+="_"+u),V(h,r),n.assignFinalMaterial(h),l.push(h)}if(1===l.length)return l[0];var A=new e.Group;for(u=0,c=l.length;u<c;u++)A.add(l[u]);return A}))},q.prototype.loadCamera=function(t){var i,n=this.json.cameras[t],r=n[n.type];if(r)return"perspective"===n.type?i=new e.PerspectiveCamera(e.MathUtils.radToDeg(r.yfov),r.aspectRatio||1,r.znear||1,r.zfar||2e6):"orthographic"===n.type&&(i=new e.OrthographicCamera(-r.xmag,r.xmag,r.ymag,-r.ymag,r.znear,r.zfar)),n.name&&(i.name=n.name),V(i,n),Promise.resolve(i);console.warn("THREE.GLTFLoader: Missing camera parameters.")},q.prototype.loadSkin=function(e){var t=this.json.skins[e],i={joints:t.joints};return void 0===t.inverseBindMatrices?Promise.resolve(i):this.getDependency("accessor",t.inverseBindMatrices).then((function(e){return i.inverseBindMatrices=e,i}))},q.prototype.loadAnimation=function(t){for(var i=this.json.animations[t],n=[],r=[],o=[],s=[],a=[],l=0,u=i.channels.length;l<u;l++){var c=i.channels[l],h=i.samplers[c.sampler],d=c.target,p=void 0!==d.node?d.node:d.id,f=void 0!==i.parameters?i.parameters[h.input]:h.input,A=void 0!==i.parameters?i.parameters[h.output]:h.output;n.push(this.getDependency("node",p)),r.push(this.getDependency("accessor",f)),o.push(this.getDependency("accessor",A)),s.push(h),a.push(d)}return Promise.all([Promise.all(n),Promise.all(r),Promise.all(o),Promise.all(s),Promise.all(a)]).then((function(n){for(var r=n[0],o=n[1],s=n[2],a=n[3],l=n[4],u=[],c=0,h=r.length;c<h;c++){var d=r[c],p=o[c],f=s[c],A=a[c],m=l[c];if(void 0!==d){var v;switch(d.updateMatrix(),d.matrixAutoUpdate=!0,P[m.path]){case P.weights:v=e.NumberKeyframeTrack;break;case P.rotation:v=e.QuaternionKeyframeTrack;break;default:v=e.VectorKeyframeTrack}var y=d.name?d.name:d.uuid,b=void 0!==A.interpolation?R[A.interpolation]:e.InterpolateLinear,x=[];P[m.path]===P.weights?d.traverse((function(e){!0===e.isMesh&&e.morphTargetInfluences&&x.push(e.name?e.name:e.uuid)})):x.push(y);var w=f.array;if(f.normalized){var E;if(w.constructor===Int8Array)E=1/127;else if(w.constructor===Uint8Array)E=1/255;else if(w.constructor==Int16Array)E=1/32767;else{if(w.constructor!==Uint16Array)throw new Error("THREE.GLTFLoader: Unsupported output accessor component type.");E=1/65535}for(var M=new Float32Array(w.length),S=0,C=w.length;S<C;S++)M[S]=w[S]*E;w=M}for(S=0,C=x.length;S<C;S++){var I=new v(x[S]+"."+P[m.path],p.array,w,b);"CUBICSPLINE"===A.interpolation&&(I.createInterpolant=function(e){return new g(this.times,this.values,this.getValueSize()/3,e)},I.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0),u.push(I)}}}var B=i.name?i.name:"animation_"+t;return new e.AnimationClip(B,void 0,u)}))},q.prototype.loadNode=function(t){var i,r=this.json,o=this.extensions,s=this,a=r.meshReferences,l=r.meshUses,u=r.nodes[t];return(i=[],void 0!==u.mesh&&i.push(s.getDependency("mesh",u.mesh).then((function(e){var t;if(a[u.mesh]>1){var i=l[u.mesh]++;(t=e.clone()).name+="_instance_"+i}else t=e;return void 0!==u.weights&&t.traverse((function(e){if(e.isMesh)for(var t=0,i=u.weights.length;t<i;t++)e.morphTargetInfluences[t]=u.weights[t]})),t}))),void 0!==u.camera&&i.push(s.getDependency("camera",u.camera)),u.extensions&&u.extensions[n.KHR_LIGHTS_PUNCTUAL]&&void 0!==u.extensions[n.KHR_LIGHTS_PUNCTUAL].light&&i.push(s.getDependency("light",u.extensions[n.KHR_LIGHTS_PUNCTUAL].light)),Promise.all(i)).then((function(i){var n;if((n=!0===u.isBone?new e.Bone:i.length>1?new e.Group:1===i.length?i[0]:new e.Object3D)!==i[0])for(var r=0,a=i.length;r<a;r++)n.add(i[r]);if(u.name&&(n.userData.name=u.name,n.name=e.PropertyBinding.sanitizeNodeName(u.name)),V(n,u),u.extensions&&N(o,n,u),void 0!==u.matrix){var l=new e.Matrix4;l.fromArray(u.matrix),n.applyMatrix4(l)}else void 0!==u.translation&&n.position.fromArray(u.translation),void 0!==u.rotation&&n.quaternion.fromArray(u.rotation),void 0!==u.scale&&n.scale.fromArray(u.scale);return s.associations.set(n,{type:"nodes",index:t}),n}))},q.prototype.loadScene=function(){function t(i,n,r,o){var s=r.nodes[i];return o.getDependency("node",i).then((function(t){return void 0===s.skin?t:o.getDependency("skin",s.skin).then((function(e){for(var t=[],n=0,r=(i=e).joints.length;n<r;n++)t.push(o.getDependency("node",i.joints[n]));return Promise.all(t)})).then((function(n){return t.traverse((function(t){if(t.isMesh){for(var r=[],o=[],s=0,a=n.length;s<a;s++){var l=n[s];if(l){r.push(l);var u=new e.Matrix4;void 0!==i.inverseBindMatrices&&u.fromArray(i.inverseBindMatrices.array,16*s),o.push(u)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',i.joints[s])}t.bind(new e.Skeleton(r,o),t.matrixWorld)}})),t}));var i})).then((function(e){n.add(e);var i=[];if(s.children)for(var a=s.children,l=0,u=a.length;l<u;l++){var c=a[l];i.push(t(c,e,r,o))}return Promise.all(i)}))}return function(i){var n=this.json,r=this.extensions,o=this.json.scenes[i],s=new e.Group;o.name&&(s.name=o.name),V(s,o),o.extensions&&N(r,s,o);for(var a=o.nodes||[],l=[],u=0,c=a.length;u<c;u++)l.push(t(a[u],s,n,this));return Promise.all(l).then((function(){return s}))}}(),t}(),lr=new ar,ur=(new n.Matrix4).makeRotationAxis(new n.Vector3(1,0,0),Math.PI/2);function cr(e){function t(e){if(e.isMesh)return function(e){var t=new xt;t.geometry=e.geometry,t.geometry.computeVertexNormals(),t.geometry.computeBoundingBox(),t.geometry.computeBoundingSphere(),t.geometry.addGroup(0,e.geometry.index.count,0);var i=new ci;return i.uniforms.map.value=e.material.map,i.uniforms.exposure.value=3.3,i.opacity=1,e.material.dispose(),t.material=[i],t.position.copy(e.position),t.quaternion.copy(e.quaternion),t.scale.copy(e.scale),t.matrix.compose(t.position,t.quaternion,t.scale),t}(e);if(e.isGroup){for(var i=function(e){var t=new Et;return t.position.copy(e.position),t.quaternion.copy(e.quaternion),t.scale.copy(e.scale),t.matrix.compose(t.position,t.quaternion,t.scale),t}(e),n=0;n<e.children.length;n++){var r=t(e.children[n]);i.add(r)}return i}return new Et}return new Promise((function(i,r){var o,s=(new n.Matrix4).copy(e.computedTransform);if("Z"!==(null===(o=e.tileset.asset)||void 0===o?void 0:o.gltfUpAxis)&&s.multiply(ur),e.content){var a=e.content.gltfArrayBuffer,l=e.contentUrl?e.contentUrl.slice(0,e.contentUrl.lastIndexOf("/")+1):"";lr.parse(a,l,(function(e){var n=e.scene,r=new Et,o=t(n);o.applyMatrix4(s),r.add(o),i(r)}),(function(t){r(new Error("error parsing gltf in tile ".concat(e.id,": ").concat(t.message)))}))}else i(new Et)}))}function hr(e){e.traverse((function(e){if(e instanceof xt){e.geometry.dispose();for(var t=0,i=e.material;t<i.length;t++){var n=i[t];n.uniforms.map&&n.uniforms.map.value&&(n.uniforms.map.value.dispose(),n.uniforms.map.value=null)}}}))}function dr(e){var t=e.toArray();return(new n.Matrix4).fromArray([2*t[0],2*t[1],2*t[2],0,2*t[3],2*t[4],2*t[5],0,2*t[6],2*t[7],2*t[8],0,0,0,0,1])}var pr=new n.EdgesGeometry(new n.BoxBufferGeometry(1,1,1)),fr=new n.LineBasicMaterial({color:new n.Color(1,1,0),transparent:!0});function Ar(e){e.updateMatrix(),e.updateMatrixWorld(),e.matrixWorld.getInverse(e.matrixWorldInverse);var t=(new n.Matrix4).multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse);return(new n.Frustum).setFromProjectionMatrix(t)}var mr={throttleRequests:!0,maxRequests:64,updateInterval:.1,maxScreenSpaceError:8,maxMemoryUsage:32,viewDistanceScale:.2,onNodeCreated:function(){}},gr=function(e){function t(t){void 0===t&&(t={});var i=e.call(this)||this;return i.options=Fe(Fe({},mr),t),i.clock=new n.Clock,i.timer=0,i.unloadTileQueue=[],i.nodes={},i.boundings={},i.nodeGroup=new n.Group,i.boundingGroup=new n.Group,i.add(i.nodeGroup),i.sseDenominator=null,i.lastCameraTransform=new n.Matrix4,i.lastCameraAspect=1,i.lastCameraFov=null,i.lastCamera=null,i.lastRenderer=null,i.enabled=!1,i}return ke(t,e),Object.defineProperty(t.prototype,"enable",{get:function(){return this.enabled},set:function(e){this.enabled!==e&&(this.enabled=e,!1===this.enabled?this.reset():(this.timer=0,this.clock.getDelta()))},enumerable:!1,configurable:!0}),t.prototype.load=function(e){var t=this,i=e.tileset_url;e.tileset_url_md5;var r=e.b3md_mappings_url;e.b3md_mappings_url_md5;var o={modelMatrix:(new n.Matrix4).fromArray([1,0,0,0,0,-1,0,1e9,0,0,-1,0,0,0,0,1]),maxMemoryUsage:this.options.maxMemoryUsage,maxScreenSpaceError:this.options.maxScreenSpaceError,viewDistanceScale:this.options.viewDistanceScale,throttleRequests:this.options.throttleRequests,maxRequests:this.options.maxRequests,contentLoader:function(e){var i=function(e){var t=e.boundingVolume,i=new n.LineSegments(pr,fr);return i.applyMatrix4(dr(t.halfAxes)),i.position.set(t.center.x,t.center.y,t.center.z),i}(e);return i.visible=!1,t.boundings[e.id]=i,t.boundingGroup.add(i),i.updateMatrixWorld(!0),"SCENEGRAPH"===e.type||"MESH"===e.type?cr(e).then((function(i){void 0===t.tileset?hr(i):(i.visible=!1,t.nodes[e.id]=i,t.nodeGroup.add(i),t.options.onNodeCreated(i),i.updateMatrixWorld(!0))})):Promise.resolve()},onTileLoad:function(){t.enabled&&t.tileset&&t.lastRenderer&&t.lastCamera&&(t.tileset.frameNumber++,t.tilesetUpdate(t.tileset,t.lastRenderer,t.lastCamera)),t.enabled||t.reset()},onTileUnload:function(e){t.unloadTileQueue.push(e)},onTileError:function(e,t){console.error("Tile error",e.id,t)},onTraversalComplete:function(e){return e},allowHosts:this.options.allowHosts,networkSubscribe:this.options.networkSubscribe,requestProxy:this.options.requestProxy,maxDepth:this.options.maxDepth},s=i.split("/").slice(0,-1).join("/"),a=st(i,{allowHosts:this.options.allowHosts,networkSubscribe:this.options.networkSubscribe,requestProxy:this.options.requestProxy}).then((function(e){return JSON.parse(e.body)})).then((function(e){return sr(e,s)})),l=st(r,{allowHosts:this.options.allowHosts,networkSubscribe:this.options.networkSubscribe,requestProxy:this.options.requestProxy}).then((function(e){return JSON.parse(e.body)}));Promise.all([a,l]).then((function(e){var i=e[0],r=e[1];i.b3dmMapping=r;var s=t.tileset=new ir(i,o),a=new n.Matrix4;if(s.root&&s.root.boundingVolume){var l=s.root.boundingVolume,u=l.halfAxes,c=l.center;a.extractRotation(dr(u)),a.setPosition(c.x,c.y,c.z)}s.modelMatrix.copy((new n.Matrix4).getInverse(a))}))},t.prototype.update=function(e,t){this.lastCamera=t,this.lastRenderer=e,!1!==this.enabled&&(this.timer+=this.clock.getDelta(),this.tileset&&this.timer>=this.options.updateInterval&&(t.matrixWorld.equals(this.lastCameraTransform)&&t.aspect===this.lastCameraAspect&&t.fov===this.lastCameraFov||(this.timer=0,this.tileset.frameNumber++,this.lastCameraTransform.copy(t.matrixWorld),this.tilesetUpdate(this.tileset,e,t))))},t.prototype.tilesetUpdate=function(e,t,i){this.sseDenominator&&i.aspect===this.lastCameraAspect&&i.fov===this.lastCameraFov||(this.sseDenominator=function(e){var t=e.aspect,i=e.fov/180*Math.PI,n=e.aspect<=1?i:2*Math.atan(Math.tan(.5*i)/t);return 2*Math.tan(.5*n)}(i),this.lastCameraAspect=i.aspect,this.lastCameraFov=i.fov);var r,o,s,a={camera:{position:i.getWorldPosition(new n.Vector3).toArray(),direction:i.getWorldDirection(new n.Vector3).toArray(),up:i.up.toArray()},height:t.getSize(new n.Vector2).height,frameNumber:e.frameNumber,sseDenominator:this.sseDenominator,cullingVolume:(r=Ar(i),o=r.planes.map((function(e){return new n.Plane(e.normal,e.constant)})),new bn(o))};e.cache.reset(),e.traverser.traverse(e.root,a);for(var l=0,u=e.tiles;l<u.length;l++){var c=u[l],h=c.selected,d=c.id;this.nodes[d]&&this.nodes[d].visible!==h&&(this.nodes[d].visible=h,h&&(this.nodes[d].needsRender=!0)),this.boundings[d]&&this.boundings[d].visible!==h&&(this.boundings[d].visible=h)}for(;s=this.unloadTileQueue.pop();){d=s.id;if(this.nodes[d]){var p=this.nodes[d];this.nodeGroup.remove(p),hr(p),delete this.nodes[d]}if(this.boundings[d]){p=this.boundings[d];this.boundingGroup.remove(p),delete this.boundings[d]}}},t.prototype.reset=function(){if(this.tileset){this.tileset.reset();for(var e=void 0;e=this.unloadTileQueue.pop();)if("UNLOADED"!==e.contentState){var t=e.id;if(this.nodes[t]){var i=this.nodes[t];this.nodeGroup.remove(i),hr(i),delete this.nodes[t]}if(this.boundings[t]){i=this.boundings[t];this.boundingGroup.remove(i),delete this.boundings[t]}}for(var n=0,r=Object.keys(this.nodes);n<r.length;n++){t=r[n];var o=this.nodes[t];this.nodeGroup.remove(o),hr(o),delete this.nodes[t]}for(var s=0,a=Object.keys(this.boundings);s<a.length;s++){t=a[s],o=this.boundings[t];this.boundingGroup.remove(o),delete this.boundings[t]}}},t}(wt);function vr(e){return null==e}var yr=function(e,t){void 0===t&&(t=1e-4),t=Math.max(t,Number.EPSILON);for(var i={},r=e.getIndex(),o=e.getAttribute("position"),s=r?r.count:o.count,a=0,l=Object.keys(e.attributes),u={},c={},h=[],d=["getX","getY","getZ","getW"],p=0,f=l.length;p<f;p++){u[b=l[p]]=[],(M=e.morphAttributes[b])&&(c[b]=new Array(M.length).fill().map((function(){return[]})))}var A=Math.log10(1/t),m=Math.pow(10,A);for(p=0;p<s;p++){var g=r?r.getX(p):p,v="",y=0;for(f=l.length;y<f;y++)for(var b=l[y],x=(E=e.getAttribute(b)).itemSize,w=0;w<x;w++)v+="".concat(~~(E[d[w]](g)*m),",");if(v in i)h.push(i[v]);else{for(y=0,f=l.length;y<f;y++){b=l[y];var E=e.getAttribute(b),M=e.morphAttributes[b],S=(x=E.itemSize,u[b]),C=c[b];for(w=0;w<x;w++){var I=d[w];if(S.push(E[I](g)),M)for(var B=0,T=M.length;B<T;B++)C[B].push(M[B][I](g))}}i[v]=a,h.push(a),a++}}var P=e.clone();for(p=0,f=l.length;p<f;p++){b=l[p];var R=e.getAttribute(b),D=new R.array.constructor(u[b]);E=new n.BufferAttribute(D,R.itemSize,R.normalized);if(P.setAttribute(b,E),b in c)for(y=0;y<c[b].length;y++){var L=e.morphAttributes[b][y],k=(D=new L.array.constructor(c[b][y]),new n.BufferAttribute(D,L.itemSize,L.normalized));P.morphAttributes[b][y]=k}}return P.setIndex(h),P};function br(e){var t;return new((t=n.Triangle).bind.apply(t,Oe([void 0],e.map((function(e){return new n.Vector3(e.x,e.y,e.z)})),!1)))}var xr={at3d:function(e,t){for(var i=$i(t.textureOptions,e.textures.length),n={},r=0,o=e.textures;r<o.length;r++){var s=o[r];n[s]=Zi(s,i,t.allowHosts,t.requestProxy,t.networkSubscribe)}return Promise.resolve().then((function(){return st(e.file,{responseType:"arraybuffer",allowHosts:t.allowHosts,requestProxy:t.requestProxy,networkSubscribe:t.networkSubscribe})})).then((function(e){return qi(e.body)})).then((function(e){return Di((function(){for(var t,i={chunks:[],createAt:void 0,description:void 0},n=0,r=e;n<r.length;n++){var o=r[n],s=Gi.decode(o);s.chunks.length&&((t=i.chunks).push.apply(t,s.chunks),i.createAt=s.createAt,i.description=s.description)}return i}))})).then((function(r){return Di((function(){return Ji(r,e.textureBase,e.textures.slice(),i,n,t.allowHosts,t.requestProxy,t.networkSubscribe)}))}))},pbm:function(e,t){for(var i=$i(t.textureOptions,e.textures.length),n={},r=0,o=e.textures;r<o.length;r++){var s=o[r];n[s]=Zi(s,i,t.allowHosts,t.requestProxy,t.networkSubscribe)}return Promise.resolve().then((function(){return st(e.file,{responseType:"arraybuffer",allowHosts:t.allowHosts,requestProxy:t.requestProxy,networkSubscribe:t.networkSubscribe})})).then((function(e){return Di((function(){var t=new Uint8Array(e.body);return Gi.decode(t)}))})).then((function(r){return Di((function(){return Ji(r,e.textureBase,e.textures.slice(),i,n,t.allowHosts,t.requestProxy,t.networkSubscribe)}))}))},dome:function(e,t){return Promise.resolve().then((function(){return st(e.file,{responseType:"arraybuffer",allowHosts:t.allowHosts,requestProxy:t.requestProxy,networkSubscribe:t.networkSubscribe})})).then((function(i){return cn(new Uint8Array(i.body),e.textureBase,t.textureOptions,t.allowHosts,t.requestProxy,t.networkSubscribe)}))},domez:function(e,t){return Promise.resolve().then((function(){return st(e.file,{responseType:"arraybuffer",allowHosts:t.allowHosts,requestProxy:t.requestProxy,networkSubscribe:t.networkSubscribe})})).then((function(e){return qi(e.body)})).then((function(e){var t=e.reduce((function(e,t){return e+t.length}),0),i=new Uint8Array(t),n=0;return e.forEach((function(e){i.set(e,n),n+=e.length})),i})).then((function(i){return cn(i,e.textureBase,t.textureOptions,t.allowHosts,t.requestProxy,t.networkSubscribe)}))}},wr=function(e){function t(t){void 0===t&&(t={});var i=e.call(this)||this;return i.empty=!0,i.name="model",i.loaded=!1,i.bvhs=Object.assign([],{loaded:!1}),i.bounding=new n.Box3,i.shownFloor=null,i.floorLength=0,i.requestProxy=t.requestProxy,i.networkSubscribe=t.networkSubscribe,i.allowHosts=t.allowHosts,i.renderOrder=-3,i}return ke(t,e),Object.defineProperty(t.prototype,"shownfloor",{get:function(){return this.shownFloor},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"hasTiles",{get:function(){return void 0!==this.tiledModel},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enableTiles",{get:function(){return!!this.tiledModel&&this.tiledModel.enable},set:function(e){this.tiledModel&&(this.tiledModel.enable=e)},enumerable:!1,configurable:!0}),t.prototype.getEdges=function(e){var t;if(void 0===e&&(e=30/180*Math.PI),!this.originModel)return[];for(var i=Math.cos(e),r=[],o=0,s=this.originModel.children;o<s.length;o++){var a=s[o];if(a instanceof xt){for(var l={},u=["a","b","c"],c=yr(a.geometry),h=c.getAttribute("position").array,d=(null===(t=c.getIndex())||void 0===t?void 0:t.array)||[],p=[],f=[],A=0,m=h.length;A<m;A+=3)p.push(new n.Vector3(h[A],h[A+1],h[A+2]));for(A=0,m=d.length;A<m;A+=3){var g=d[A],v=d[A+1],y=d[A+2],b=(new n.Vector3).crossVectors(p[v].clone().sub(p[g]),p[y].clone().sub(p[g])).normalize();f.push({a:g,b:v,c:y,normal:b})}for(A=0,m=f.length;A<m;A++)for(var x=f[A],w=0;w<3;w++){var E=x[u[w]],M=x[u[(w+1)%3]],S=[Math.min(E,M),Math.max(E,M)];void 0===l[C=S[0]+"-"+S[1]]?l[C]={index1:S[0],index2:S[1],face1:A}:l[C].face2=A}for(var C in l){var I=l[C];if(void 0===I.face2||f[I.face1].normal.dot(f[I.face2].normal)<=i){var B=p[I.index1],T=p[I.index2];r.push(new n.Line3(B,T))}}c.dispose(),p.length=0,f.length=0}}return r},t.prototype.hasFloors=function(){return this.hasFloors_()},t.prototype.hasFloors_=function(){var e=[];return this.traverse((function(t){t instanceof xt&&(e[t.floorIndex]=!0)})),e.length},t.prototype.show=function(){for(var e,t,i=[],r=0;r<arguments.length;r++)i[r]=arguments[r];var o=this.shownFloor,s=null,a=null!==(e=i[1])&&void 0!==e?e:.1,l=0!==i.length;this.shownFloor=s=l?i[0]:null,this.setMaterial({opacity:1,floorInfo:new n.Vector3(0,0,0)}),(null===(t=this.tiledModel)||void 0===t?void 0:t.enable)?this.b3dmShow(o,s):this.at3dShow(o,s,a)},t.prototype.at3dShow=function(e,t,i){var n;null===(n=this.originModel)||void 0===n||n.traverse((function(e){e instanceof xt&&e.material.forEach((function(n){null===t||t===e.floorIndex?n.opacity=1*n.originOpacity:n.opacity=n.originOpacity*i}))})),e!==this.shownFloor&&this.emit("shownFloorChange",this.shownFloor,this.floorLength),this.needsRender=!0},t.prototype.b3dmShow=function(e,t){var i,r;if(null===(r=null===(i=this.tiledModel)||void 0===i?void 0:i.tileset)||void 0===r?void 0:r.floorInfo){if("number"==typeof t&&t>=0&&t<this.tiledModel.tileset.floorInfo.length){var o=this.tiledModel.tileset.floorInfo,s=-o[t].ground,a=o[t].height+s;this.setMaterial({opacity:1,floorInfo:new n.Vector3(s,a,0)})}else this.setMaterial({opacity:1,floorInfo:new n.Vector3(0,0,0)});e!==this.shownFloor&&this.emit("shownFloorChange",this.shownFloor,this.floorLength),this.needsRender=!0}},t.prototype.intersectRaycaster=function(e,t){var i=e.ray,r=i.origin,o=i.direction;if(vr(t))if(vr(this.shownFloor)){var s=this.floorLength;t=[];for(var a=-1;a<s;a++)t.push(a)}else t=[this.shownFloor];var l=[],u=[];Array.isArray(t)?u.push.apply(u,t):u.push(t);for(var c=function(t){var i=h.bvhs&&h.bvhs[t];if(i){var s=new xi(r.x,r.y,r.z),a=new xi(o.x,o.y,o.z),u=i.intersectRay(s,a,!0).map((function(e){var t=e.intersectionPoint,i=e.triangle,o=new n.Vector3(t.x,t.y,t.z);return{point:o,face:{normal:br(i).getNormal(new n.Vector3)},distance:r.distanceTo(o)}}));u.length&&l.push.apply(l,u)}else if(h.originModel){var c=[];h.originModel.traverse((function(e){e instanceof xt&&e.floorIndex===t&&c.push(e)})),(u=e.intersectObjects(c).map((function(e){return{face:e.face?{normal:e.face.normal}:void 0,point:e.point,distance:e.distance}}))).length&&l.push.apply(l,u)}},h=this,d=0,p=u;d<p.length;d++){c(p[d])}return l.filter((function(t){var i=t.distance;return i<=e.far&&i>=e.near})).sort((function(e,t){return e.distance-t.distance}))},t.prototype.buildBVH=function(){if(!this.bvhs.loaded&&this.originModel){var e=[];this.originModel.traverse((function(t){t instanceof xt&&(e[t.floorIndex]=e[t.floorIndex]||[],e[t.floorIndex].push(t.geometry))})),this.bvhs.length=0;for(var t=0,i=e;t<i.length;t++){var n=i[t],r=0;if(n){for(var o=0,s=n;o<s.length;o++){var a=0;a=(d=s[o]).index?d.index.array.length:d.attributes.position.array.length/3,r+=3*Math.floor(a/3)}for(var l=new Float32Array(3*r),u=0,c=0,h=n;c<h.length;c++){var d,p=(d=h[c]).attributes.position.array,f=d.index?d.index.array:null;if(f){for(var A=3*Math.floor(f.length/3),m=0,g=void 0,v=void 0;m<A;m++)g=3*(u+m),v=3*f[m],l[g]=p[v],l[g+1]=p[v+1],l[g+2]=p[v+2];u+=A}else{for(A=3*Math.floor(p.length/3/3),m=0,g=void 0,v=void 0;m<A;m++)v=3*m,l[g=3*(u+m)]=p[v],l[g+1]=p[v+1],l[g+2]=p[v+2];u+=A}}var y=(new Bi).create(l).splitNode(50);this.bvhs.push(y)}}this.bvhs.loaded=!0,this.emit("bvhLoaded")}},t.prototype.load=function(e,t){var i=this;if(void 0===t&&(t={}),!0===this.loaded)throw new Error("[MODEL LOAD ERROR]: model cannot load twice.");var n=function(e,t){if(void 0===t&&(t=[]),/^blob\:/.test(e))return"at3d";var i=/([0-9a-z\.\_\-]+)([\?\#].*)?$/i.exec(e);if(!i)return"";for(var n=0,r=String(i[1]).trim().split(".").slice(1).reverse();n<r.length;n++){var o=r[n],s=t.indexOf(o);if(s>=0)return t[s]}return""}(e.file,Object.keys(xr)),r=xr[n];if(!r)throw new Error("[MODEL LOAD ERROR]: file type(".concat(n,") does not support."));return this.name=e.file,r(e,{textureOptions:t,allowHosts:this.allowHosts,requestProxy:this.requestProxy,networkSubscribe:this.networkSubscribe}).then((function(t){var n=t.createAt,r=t.description,o=t.objects,s=t.texturePromise;i.userData.createAt=n,i.userData.description=r,i.bounding.makeEmpty();var a=i.originModel=new wt;a.renderOrder=-3;for(var l=0,u=o;l<u.length;l++){var c=u[l];c.traverse((function(e){if(e instanceof xt){var t=e.geometry;t.boundingBox||t.computeBoundingBox(),t.boundingSphere||t.computeBoundingSphere(),i.bounding.union(t.boundingBox)}})),a.add(c)}if(i.add(a),i.floorLength=i.hasFloors_(),i.empty=!1,i.loaded=!0,e.tiles&&e.tiles.tileset_url&&e.tiles.b3md_mappings_url){var h=i.tiledModel=new gr({onNodeCreated:function(e){var t=a.getMaterial();t&&(e.setMaterial(t),e.renderOrder=-3)},allowHosts:i.allowHosts,networkSubscribe:i.networkSubscribe,requestProxy:i.requestProxy});h.renderOrder=-3,i.add(h),h.load(e.tiles)}e.bvh&&i.buildBVH(),Di((function(){i.emit("geometryLoaded"),s.then((function(){i.emit("materialLoaded"),i.emit("loaded")}))}))})).catch((function(e){return i.name="",i.emit("error",e),Promise.reject(e)}))},t.prototype.update=function(e,t){if(this.originModel){var i=this.originModel.visible;if(this.tiledModel&&this.tiledModel.enable&&this.tiledModel.tileset){this.tiledModel.update(e,t);var n=this.tiledModel.tileset.root;n.content&&"READY"===n.contentState&&!1!==i&&(this.setTransparent(!1),this.shownFloor&&this.show(this.shownFloor),this.originModel.visible=!1,this.originModel.needsRender=!0)}else!0!==i&&(this.originModel.visible=!0,this.originModel.needsRender=!0)}},t.prototype.dispose=function(){this.off();var e=this.originModel,t=this.tiledModel;if(t&&(t.enable=!1,t.reset()),e)for(e.disposeGeometry(),e.disposeMaterial();e.children.length;)e.remove(e.children[0]);this.bvhs.length=0,this.bvhs.loaded=!1},t}(wt);Object.assign(wr.prototype,{on:He.prototype.on,once:He.prototype.once,off:He.prototype.off,emit:He.prototype.emit,hasListener:He.prototype.hasListener});function Er(e,t,i){return e<t?t:e>i?i:e}function Mr(e,t){if(e===t)return!0;if(e&&t&&"object"==typeof e&&"object"==typeof t){if(e.constructor!==t.constructor)return!1;var i,n,r;if(Array.isArray(e)){if((i=e.length)!=t.length)return!1;for(n=i;0!=n--;)if(!Mr(e[n],t[n]))return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===t.toString();if((i=(r=Object.keys(e)).length)!==Object.keys(t).length)return!1;for(n=i;0!=n--;)if(!Object.prototype.hasOwnProperty.call(t,r[n]))return!1;for(n=i;0!=n--;){var o=r[n];if(!Mr(e[o],t[o]))return!1}return!0}return e!=e&&t!=t}function Sr(e){return"number"==typeof e}function Cr(e){return 0==(e&e-1)&&0!==e}var Ir=function(){return new Error("Invalid input.")},Br=function(){return new Error("Invalid certificate.")},Tr=function(){return new Error("Invalid signature.")};function Pr(e,t){void 0===t&&(t=!1);var i=typeof e;if("string"===i)return JSON.stringify(e);if(!0===e)return"true";if(!1===e)return"false";if(null===e)return"null";if(e instanceof Array){for(var n="[",r=e.length-1,o=0;o<r;o++)n+=Pr(e[o],!1)+",";return r>-1&&(n+=Pr(e[o],!1)),n+"]"}if(e instanceof Object){if("function"==typeof e.toJSON)return Pr(e.toJSON(),t);var s=Object.keys(e).sort(),a=s.length;for(n="",o=0;o<a;){var l=s[o],u=Pr(e[l],!0);void 0!==u&&(o&&""!==n&&(n+=","),n+=JSON.stringify(l)+":"+u),o++}return"{"+n+"}"}switch(i){case"function":case"undefined":return t?void 0:null;case"number":return 0;default:return isFinite(e)?e:null}}function Rr(e){return String(Pr(e,!1))}function Dr(e){var t,i,n;if(Array.isArray(e)){var r,o,s=void 0;if(e.length<=0)return Ir();for(var a=function(t){var i=Dr(e[t]);if(i instanceof Error)return{value:i};if(s){if(s!==i.issuer)return{value:Br()}}else s=i.issuer;r?i.expire.getTime()<r.getTime()&&(r=i.expire):r=i.expire,o=o?o.filter((function(e){return-1!==i.allowHosts.indexOf(e)})):i.allowHosts},l=0;l<e.length;l++){var u=a(l);if("object"==typeof u)return u.value}return je({issuer:s,expire:r,allowHosts:o})}var c=JSON.parse(e),h="undefined"!=typeof location?location.hostname:"",d=Date.now();if("object"!=typeof c)return Ir();var p=new Date("string"==typeof c.expire_at&&/^\d+$/.test(c.expire_at)?Number(c.expire_at):c.expire_at),f=Array.isArray(c.allow_hosts)?c.allow_hosts:[];if(0===h.length||Ge(h)||Xe.filter((function(e){return _e(e,h)})).length>0){var A=String(null!==(t=c.certificate)&&void 0!==t?t:"");if(A){var m=new Ie;return m.readCertPEM(A),je({issuer:m.getSubjectString(),expire:p,allowHosts:f})}return je({issuer:"none",expire:p,allowHosts:f})}var g=String(null!==(i=c.certificate)&&void 0!==i?i:"");if(!g)return Br();var v=new Ie;v.readCertPEM(g);var y=String(null!==(n=c._signature)&&void 0!==n?n:"");if(!y)return Tr();var b=Rr(function(e,t){for(var i={},n=0,r=Object.keys(e);n<r.length;n++){var o=r[n];-1===t.indexOf(o)&&(i[o]=e[o])}return i}(c,["_signature"]));return!1===function(e,t,i){var n=new Ie;if("string"==typeof i?n.readCertPEM(i):n.readCertHex(i.hex),!1===De(n))return!1;var r=new W;return r.readCertPubKeyHex(n.hex,6),!!r.verify(e,k(t))}(b,y,v)?Tr():d<p.getTime()?0===f.filter((function(e){return _e(e,h)})).length?function(e){return new Error("host(".concat(JSON.stringify(e),") is not allowed."))}(h):je({issuer:v.getSubjectString(),expire:p,allowHosts:f}):function(e){return new Error("date(".concat(e.toString(),") expired."))}(p)}var Lr=new WeakMap,kr=function(){function e(){this.name="",this.workCode="",this.expire=new Date,this.allowHosts=[],this.initial={mode:"Panorama",latitude:0,longitude:0,panoIndex:0,fov:80},this.observers=[],this.issuer="none",this.raw={works:[""],options:""}}return e.prototype.toJSON=function(){return this.raw.works},e.parse=Vr,e}();function Fr(e){return null==e?"null":Array.isArray(e)?"array":"object"==typeof e?"dict":"value"}function Or(e,t){var i=Fr(e),n=Fr(t);if("null"===n)return e;if("value"===n)return t;if(n!==i)return JSON.parse(JSON.stringify(t));if("array"===n)for(var r=0;r<t.length;r++)e[r]=Or(e[r],t[r]);else if("dict"===n)for(var o in t)e[o]=Or(e[o],t[o]);return e}function Nr(e,t,i){for(var r,o=JSON.stringify(t),s=[],a=0,l=[].concat(e);a<l.length;a++){var u=l[a];u instanceof kr?s.push.apply(s,u.raw.works):"string"==typeof u?s.push(u):s.push(JSON.stringify(u))}var c=Dr(s);if(c instanceof Error)return c;t=JSON.parse(o),e=s.map((function(e){return JSON.parse(e)})).reduce((function(e,t){return Or(e,t)}));var h=new kr;if(c instanceof Error)return c;h.issuer=c.issuer,h.expire=c.expire,h.allowHosts=c.allowHosts,h.raw={works:s,options:o};var d=null!==(r=e.base_url)&&void 0!==r?r:"";d&&"/"!==d[d.length-1]&&(d+="/");var p=function(e,t){return 0===e.indexOf(t)},f=function(e,n){var r,o=e;if(!0===t.jsonp){o=e.replace(/([\?\#].*)?$/i,"");var s=Be("".concat(o)).slice(0,7);o="".concat(o,".").concat(s,".jsonp")}if(!0===t.shortPath){var a=o.replace(d,"").split("."),l=null!==(r=a.shift())&&void 0!==r?r:"",u=a.join(".");o=zi(d,Be(l))+(u?"."+u:"")}var c=o.replace(d,"");return t.baseURL&&(o=zi(t.baseURL,c)),i&&i(e,o,c,n),o},A=function(t,i){var n,r,o,s,a,l,u=t;if(!en(t)){var c=null!==(l=null!==(s=null!==(r=null===(n=e.panorama)||void 0===n?void 0:n.pano_high_cube_base_url)&&void 0!==r?r:null===(o=e.panorama)||void 0===o?void 0:o.pano_cube_base_url)&&void 0!==s?s:null===(a=e.panorama)||void 0===a?void 0:a.base_url)&&void 0!==l?l:"";c&&(c=zi(c,String(i))),u=zi(c,u)}return en(u)||(u=zi(d,u)),p(u,d)||console.warn("".concat(u," is not start with base_url(").concat(d,").")),f(u,"panorama")},m=function(e){var t=e;return en(t)||(t=zi(d,e)),p(t,d)||console.warn("".concat(t," is not start with base_url(").concat(d,").")),f(t,"model")},g=function(e,t){void 0===t&&(t="");var i=e;return en(i)||(i=zi(t,i)),en(i)||(i=zi(d,i)),p(i,d)||console.warn("".concat(i," is not start with base_url(").concat(d,").")),f(i,"texture")};if(c instanceof Error)return c;if(h.workCode=String(e.work_code||e.code||e.vr_code||e.workCode),h.name=String(e.name),c instanceof Error)return c;if(e.model){var v={bvh:!0,async:!1,textureBase:"",textures:[]};"boolean"==typeof t.modelBvh?v.bvh=t.modelBvh:"boolean"==typeof e.model.bvh?v.bvh=e.model.bvh:"boolean"==typeof e.bvh&&(v.bvh=e.bvh),e.model.file?v.file=m(e.model.file):e.model.file_url&&(v.file=m(e.model.file_url)),e.model.textureBase?v.textureBase=g("",e.model.textureBase):e.model.material_base_url?v.textureBase=g("",e.model.material_base_url):v.file&&(v.textureBase=v.file.split("/").slice(0,-1).join("/").replace("/model/","/materials/")),Array.isArray(e.model.textures)?v.textures=e.model.textures.map((function(t){var i,n;return g(t,null!==(n=null!==(i=e.model.textureBase)&&void 0!==i?i:e.model.material_base_url)&&void 0!==n?n:"")})):Array.isArray(e.model.material_textures)&&(v.textures=e.model.material_textures.map((function(t){var i,n;return g(t,null!==(n=null!==(i=e.model.textureBase)&&void 0!==i?i:e.model.material_base_url)&&void 0!==n?n:"")}))),e.model.tiles&&(v.tiles=e.model.tiles),v.file&&(h.model=v)}if(c instanceof Error)return c;if(e.observers&&Array.isArray(e.observers)){var y=[];e.panorama&&(Array.isArray(e.panorama)?y=e.panorama:Array.isArray(e.panorama.list)?y=e.panorama.list:Array.isArray(e.panorama.info)&&(y=e.panorama.info));for(var b=0;b<e.observers.length;b++){var x={},w=e.observers[b];if(!w)break;var E=y[b];if(!E)break;w=Object.assign({},w,E,{active:!1!==w.active&&!1!==E.active}),x.panoIndex=b,x.active=!1!==w.active,x.loadable=!0===w.loadable,x.images={up:A(w.images?w.images.up:w.up,b),down:A(w.images?w.images.down:w.down,b),right:A(w.images?w.images.right:w.right,b),left:A(w.images?w.images.left:w.left,b),front:A(w.images?w.images.front:w.front,b),back:A(w.images?w.images.back:w.back,b)};var M=w.images?w.images.depth:w.depth;M&&(x.images.depth=A(M,b));var S=w.images?w.images.luminance:w.luminance;S&&(x.images.luminance={up:A(S.up,b),down:A(S.down,b),right:A(S.right,b),left:A(S.left,b),front:A(S.front,b),back:A(S.back,b)});var C=w.images?w.images.tiles:w.tiles;if(C){for(var I=[],B=function(e){var t=e.match(/\/cube_(\d+)\//);if(t){var i=Number(t[1]);if(Cr(i))return i}return!1},T=function(e,t){return e.replace(/\/cube_(\d+)\//,(function(){return"/cube_".concat(t,"/")}))},P=0,R=C;P<R.length;P++){var D=R[P];if("number"==typeof D){var L=D,k=B(x.images.front);if(!1===k)continue;if((q=Math.max(k,512*Math.pow(2,L)))>2048){var F=T(x.images.up,q),O=T(x.images.down,q),N=T(x.images.right,q),V=T(x.images.left,q),Q=T(x.images.front,q),H=T(x.images.back,q);I.push({level:L,size:q,up:F,down:O,right:N,left:V,front:Q,back:H})}else{F=x.images.up,O=x.images.down,N=x.images.right,V=x.images.left,Q=x.images.front,H=x.images.back;I.push({level:L,size:q,up:F,down:O,right:N,left:V,front:Q,back:H})}}else{var q;if("number"!=typeof(L=D.level))continue;if("number"!=typeof(q=D.size))continue;F=A(D.up,b),O=A(D.down,b),N=A(D.right,b),V=A(D.left,b),Q=A(D.front,b),H=A(D.back,b);I.push({level:L,size:q,up:F,down:O,right:N,left:V,front:Q,back:H})}}I.sort((function(e,t){return e.level-t.level})),x.images.tiles=I}if(w.position instanceof n.Vector3)x.position=w.position.clone();else{if(!Array.isArray(w.position))break;x.position=(new n.Vector3).fromArray(w.position)}if(w.standingPosition instanceof n.Vector3)x.standingPosition=w.standingPosition.clone();else if(Array.isArray(w.standingPosition))x.standingPosition=(new n.Vector3).fromArray(w.standingPosition);else if(w.standing_position instanceof n.Vector3)x.standingPosition=w.standing_position.clone();else{if(!Array.isArray(w.standing_position))break;x.standingPosition=(new n.Vector3).fromArray(w.standing_position)}if(w.quaternion instanceof n.Quaternion)x.quaternion=w.quaternion.clone();else if(Array.isArray(w.quaternion))x.quaternion=(new n.Quaternion).fromArray(w.quaternion);else{if(!w.quaternion)break;var z=w.quaternion,U=z.x,j=z.y,K=z.z,G=z.w;x.quaternion=new n.Quaternion(U,j,K,G)}if(Array.isArray(w.accessibleNodes)?x.accessibleNodes=w.accessibleNodes.slice():Array.isArray(w.accessible_nodes)&&(x.accessibleNodes=w.accessible_nodes.slice()),Array.isArray(w.visibleNodes)?x.visibleNodes=w.visibleNodes.slice():Array.isArray(w.visible_nodes)&&(x.visibleNodes=w.visible_nodes.slice()),Sr(w.floorIndex)?x.floorIndex=w.floorIndex:Sr(w.floor_index)?x.floorIndex=w.floor_index:x.floorIndex=0,w.video){var _={};"string"==typeof w.video.source&&(_.source=w.video.source),w.video.matrix instanceof n.Matrix4?_.matrix=w.video.matrix.clone():Array.isArray(w.video.matrix)&&(_.matrix=(new n.Matrix4).fromArray(w.video.matrix)),w.video.size instanceof n.Vector2?_.size=w.video.size.clone():Array.isArray(w.video.size)&&(_.size=(new n.Vector2).fromArray(w.video.size)),_.source&&_.matrix&&_.size&&(x.video=_)}h.observers[b]=x}}if(c instanceof Error)return c;for(var W=0,X=h.observers;W<X.length;W++){if((x=X[W]).accessibleNodes)x.accessibleNodes=x.accessibleNodes.filter((function(e){return e<h.observers.length}));else{x.accessibleNodes=[];for(var Y=0;Y<h.observers.length;Y++)h.observers[Y]!==x&&x.accessibleNodes.push(Y)}if(x.visibleNodes)x.visibleNodes=x.visibleNodes.filter((function(e){return e<h.observers.length}));else{x.visibleNodes=[];for(Y=0;Y<h.observers.length;Y++)h.observers[Y]!==x&&x.visibleNodes.push(Y)}}if(c instanceof Error)return c;if(e.initial)if("Floorplan"!==e.initial.mode&&"Topview"!==e.initial.mode&&"Panorama"!==e.initial.mode&&"VRPanorama"!==e.initial.mode&&"Model"!==e.initial.mode&&"DepthPanorama"!==e.initial.mode||(h.initial.mode=e.initial.mode),Sr(e.initial.latitude)&&(h.initial.latitude=e.initial.latitude),Sr(e.initial.longitude)?h.initial.longitude=e.initial.longitude:Sr(e.initial.heading)&&(h.initial.longitude=-(360*(e.initial.heading-.25)+90)/180*Math.PI),Sr(e.initial.fov)&&(h.initial.fov=e.initial.fov),Sr(e.initial.panoIndex)){var Z=h.observers.length>0?h.observers.length-1:0;h.initial.panoIndex=Er(e.initial.panoIndex,0,Z)}else if(Sr(e.initial.pano_index)){Z=h.observers.length>0?h.observers.length-1:0;h.initial.panoIndex=Er(e.initial.pano_index,0,Z)}else if(Sr(e.initial.pano)){Z=h.observers.length>0?h.observers.length-1:0;h.initial.panoIndex=Er(e.initial.pano,0,Z)}if(c instanceof Error)return c;var J=je(h);return Lr.set(J,{works:s,options:o}),J}function Vr(e,t,i){"string"==typeof e&&"{"===e.trim()[0]&&(e=JSON.parse(e));var n=Lr.get(e);if(n){if(t&&!Mr(JSON.parse(n.options),t))throw new Error("[PARSE FAILED]: work is parsed with different options.");return e}var r=Nr(e,null!=t?t:{},i);if(r instanceof Error)throw new Error("[PARSE FAILED]: "+r.message+"\nError work input:\n"+JSON.stringify(e));return r}function Qr(){return"undefined"==typeof document?{}:document.createElementNS("http://www.w3.org/1999/xhtml","img")}function Hr(e,t,i){return e+(t-e)*i}function qr(e,t){var i=t[1]-t[0];return e<t[0]?qr(e+i,t):e>=t[1]?qr(e-i,t):e}function zr(e,t,i,n){return n?function(e,t,i,n){var r=n[1]-n[0];return e=qr(e,n),Hr((t=qr(t,n))-e>r/2?e+r:e-t>r/2?e-r:e,t,i)}(e,t,i,n):Hr(e,t,i)}var Ur=function(){function e(e){for(var t in this.config={},this.progress=1,this.ended=!0,this.value={},this.startTime=Ue(),this.startVelocity=0,this.duration=0,this.keyframes=[],e){var i=e[t];"number"==typeof i?(this.value[t]=i,this.config[t]={circle:!1}):(this.value[t]=i.value,this.config[t]={circle:i.circle})}this.keyframes=[{progress:0,value:Fe({},this.value)},{progress:1,value:Fe({},this.value)}]}return e.prototype.getProgress=function(e){var t=e-this.startTime;return t<0?0:t>=this.duration?1:1-function(e,t,i,n){var r=(t*i+2*e)/Math.pow(i,3),o=-(2*t*i+3*e)/Math.pow(i,2),s=t,a=e;return r*Math.pow(n,3)+o*Math.pow(n,2)+s*n+a}(1,this.startVelocity,this.duration,t)},e.prototype.getValue=function(e){for(var t=1;t<this.keyframes.length;t++)if(this.keyframes[t].progress>e){var i=this.keyframes[t-1],n=this.keyframes[t],r={};for(var o in this.config){var s=(e-i.progress)/(n.progress-i.progress);r[o]=zr(i.value[o],n.value[o],s,this.config[o].circle)}return r}return Fe({},this.keyframes[this.keyframes.length-1].value)},e.prototype.getProgressVelocity=function(e){var t=e-this.startTime;return t>=this.duration?0:function(e,t,i,n){var r=(t*i+2*e)/Math.pow(i,3),o=-(2*t*i+3*e)/Math.pow(i,2),s=t;return 3*r*Math.pow(n,2)+2*o*n+s}(1,this.startVelocity,this.duration,t)},e.prototype.update=function(e){return!!this.ended||(this.progress=Math.min(1,Math.max(0,this.progress,this.getProgress(e))),this.value=this.getValue(this.progress),this.ended=this.progress>=1,this.ended&&this.callbacks&&(this.callbacks[0](),this.callbacks=void 0),this.ended)},e.prototype.getKeyFrameSegment=function(e){for(var t=this.getProgress(e),i=1;i<this.keyframes.length;i++)if(this.keyframes[i].progress>t)return[this.keyframes[i-1],this.keyframes[i]];return[this.keyframes[this.keyframes.length-2],this.keyframes[this.keyframes.length-1]]},e.prototype.getTargetKeyframe=function(){return this.keyframes[this.keyframes.length-1]},e.prototype.set=function(e,t,i,n){var r;void 0===i&&(i=0),isNaN(t)&&(t=0),isNaN(i)&&(i=0),n=null!=n?n:Ue();var o=this.getProgress(n),s=this.getValue(o),a={};for(var l in this.config)a[l]=null!==(r=e[l])&&void 0!==r?r:s[l];var u=[{progress:0,value:s},{progress:1,value:a}];return this.setKeyframes(u,t,i,n)},e.prototype.setKeyframes=function(e,t,i,n){var r=this;if(void 0===i&&(i=0),e.length<2)throw new Error("keyframes invalid.");return isNaN(t)&&(t=0),isNaN(i)&&(i=0),this.callbacks&&(this.callbacks[1](new Error("motion aborted.")),this.callbacks=void 0),new Promise((function(o,s){n=null!=n?n:Ue(),r.progress=0,r.ended=!1,r.startTime=n,r.startVelocity=i,r.keyframes=e,r.duration=t,0===t?(r.progress=1,r.value=Fe({},e[e.length-1].value)):r.value=Fe({},e[0].value),r.callbacks=[o,s]}))},e.prototype.dispose=function(){this.callbacks&&(this.callbacks[1](new Error("motion dispose.")),this.callbacks=void 0)},e}(),jr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAR9JREFUOBF10kFOAzEMBdCZFhCbrrgAN+NqHIULsWKDKO3gF+VHoZpa+rXjfH87nq7btr0ty3KZ8FsxnHeQPL748lA/x0Jsq+AwYe0X8nDtGA33BEJUHIEKW/EorHOLI7BHNlkEbju38YkQAIRZxFkHz2HOirKDxNcIzG+fu/6oLiNmqc5ZrlwTeKyAgJF14tMZmSn87pBrxeX/CRABgk/dl1s+C18dio2Pp9nmCQru2UtdvN+7lI9AFsgb3zNMcSp8FF4LYs3UhLfOAvkDJffci8q1J/ByRLKnQ8gUJUFOd2SeZYliCxwiyJCxCbhUGFKF4zPm61hiq7sVyJnPmATyR5IzLSNyDNEFRCDnkAmA8U2RfCsIefYhDeKOQLv7A+l1ZTyjymNxAAAAAElFTkSuQmCC",Kr=function(e){return 2*e-e*e*e},Gr=new Float32Array([-.13,0,-.13,.13,0,-.13,-.13,0,.13,.13,0,.13]),_r=new Float32Array([0,1,1,1,0,0,1,0]),Wr=new Uint8Array([0,2,1,2,3,1]),Xr=new n.BufferGeometry;Xr.setAttribute("position",new n.BufferAttribute(Gr,3)),Xr.setAttribute("uv",new n.BufferAttribute(_r,2)),Xr.setIndex(new n.BufferAttribute(Wr,1));var Yr,Zr,Jr,$r,eo=(Yr=Qr(),Zr=new n.Texture,Jr=256,$r=128,Yr.onload=function(){if("undefined"!=typeof document){var e=document.createElement("canvas");e.setAttribute("width",String(Jr)),e.setAttribute("height",String(Jr));var t=e.getContext("2d");t&&(t.save(),t.drawImage(Yr,0,0,Jr,Jr),t.globalCompositeOperation="source-out",t.beginPath(),t.arc($r,$r,84.48,0,2*Math.PI),t.lineWidth=29.952,t.strokeStyle="rgba(255, 255, 255, 0.5)",t.stroke(),t.restore(),Zr.image=e,Zr.needsUpdate=!0)}},Yr.src=jr,Zr),to=function(){if("undefined"!=typeof document){var e=256,t=199.68,i=document.createElement("canvas");i.setAttribute("width",String(512)),i.setAttribute("height",String(512));var r=i.getContext("2d");if(r){r.save(),r.beginPath(),r.arc(e,e,t,0,2*Math.PI),r.fillStyle="rgba(255, 255, 255, 0.1)",r.fill(),r.beginPath(),r.arc(e,e,t,0,2*Math.PI),r.strokeStyle="rgba(255, 255, 255, 0.5)",r.lineWidth=10.24,r.stroke(),r.restore();var o=new n.CanvasTexture(i);return o.generateMipmaps=!0,o}}return null}(),io=function(){if("undefined"!=typeof document){var e=256,t=128,i=document.createElement("canvas");i.setAttribute("width",String(512)),i.setAttribute("height",String(512));var r=i.getContext("2d");if(r){r.save(),r.beginPath(),r.arc(e,e,t,0,2*Math.PI);var o=r.createLinearGradient(e-Math.cos(Math.PI/4)*t,e-Math.sin(Math.PI/4)*t,e+Math.cos(Math.PI/4)*t,e+Math.sin(Math.PI/4)*t);o.addColorStop(0,"rgba(255, 255, 255, 1)"),o.addColorStop(.5,"rgba(255, 255, 255, 0.6)"),o.addColorStop(1,"rgba(255, 255, 255, 1)"),r.strokeStyle=o,r.lineWidth=40.96,r.shadowBlur=25.6,r.shadowColor="rgba(0, 0, 0, 0.1)",r.stroke(),r.restore();var s=new n.CanvasTexture(i);return s.generateMipmaps=!0,s}}return null}(),no=function(){if("undefined"!=typeof document){var e=256,t=199.68,i=document.createElement("canvas");i.setAttribute("width",String(512)),i.setAttribute("height",String(512));var r=i.getContext("2d");if(r){r.save(),r.beginPath(),r.arc(e,e,t,0,2*Math.PI);var o=r.createLinearGradient(e+Math.cos(Math.PI/4)*t,e-Math.sin(Math.PI/4)*t,e-Math.cos(Math.PI/4)*t,e+Math.sin(Math.PI/4)*t);o.addColorStop(0,"rgba(255, 255, 255, 0.7)"),o.addColorStop(.5,"rgba(255, 255, 255, 0.15)"),o.addColorStop(1,"rgba(255, 255, 255, 0.7)"),r.strokeStyle=o,r.lineWidth=15.36,r.shadowBlur=25.6,r.shadowColor="rgba(0, 0, 0, 0.2)",r.stroke(),r.restore();var s=new n.CanvasTexture(i);return s.generateMipmaps=!0,s}}return null}(),ro=function(){if("undefined"!=typeof document){var e=256,t=document.createElement("canvas");t.setAttribute("width",String(512)),t.setAttribute("height",String(512));var i=t.getContext("2d");if(i){i.save(),i.beginPath(),i.arc(e,e,153.6,0,2*Math.PI);var r=i.createRadialGradient(e,e,153.6,e,e,0);r.addColorStop(0,"rgba(255, 255, 255, 0.9)"),r.addColorStop(.3,"rgba(255, 255, 255, 0.0)"),i.fillStyle=r,i.fill(),i.restore();var o=new n.CanvasTexture(t);return o.generateMipmaps=!0,o}}return null}(),oo=function(e,t){var i=128;e.save(),e.clearRect(0,0,256,256),e.beginPath(),e.arc(i,i,88.32,0,2*Math.PI*t),e.lineWidth=30.72,e.strokeStyle="rgba(255, 255, 255, 0.4)",e.stroke(),e.restore()},so=function(){if("undefined"!=typeof document){var e=document.createElement("canvas");e.setAttribute("width",String(256)),e.setAttribute("height",String(256));var t=e.getContext("2d");t&&oo(t,2*Math.PI);var i=new n.CanvasTexture(e);return Object.assign(i,{setProgress:function(e){t&&(oo(t,e),i.needsUpdate=!0)}})}return null},ao=[],lo=so(),uo=function(e){function t(t){void 0===t&&(t={});var i,r,o=this;o=e.call(this)||this;var s=null!==(i=t.color)&&void 0!==i?i:16777215,a=null!==(r=t.scale)&&void 0!==r?r:1;o.progress=0,o.opacity=0,o.loading=!1,o.current=!1,o.disabled=!1,o.currentMotion=new Ur({progress:0}),o.ringMotion=new Ur({scale:1,opacity:1}),o.tapMotion=new Ur({scale:1,opacity:1}),o.progressMotion=new Ur({progress:0}),o.progressOpacityMotion=new Ur({opacity:0}),o.opacityMotion=new Ur({opacity:0});var l={color:s,blending:n.CustomBlending,blendSrc:n.SrcAlphaFactor,blendDst:n.OneMinusSrcAlphaFactor,blendSrcAlpha:n.OneFactor,blendDstAlpha:n.OneMinusSrcAlphaFactor,depthWrite:!1};return o.centerMesh=new n.Mesh(Xr,new n.MeshBasicMaterial(Fe(Fe({},l),{map:io,opacity:0}))),o.ringMesh=new n.Mesh(Xr,new n.MeshBasicMaterial(Fe(Fe({},l),{map:no,opacity:0}))),o.loadingMesh=new n.Mesh(Xr,new n.MeshBasicMaterial(Fe(Fe({},l),{map:eo,opacity:.5}))),o.disableMesh=new n.Mesh(Xr,new n.MeshBasicMaterial(Fe(Fe({},l),{map:to,opacity:0}))),o.progressMesh=new n.Mesh(Xr,new n.MeshBasicMaterial(Fe(Fe({},l),{map:lo,opacity:0}))),o.expandMesh=new n.Mesh(Xr,new n.MeshBasicMaterial(Fe(Fe({},l),{map:ro,opacity:0}))),o.expandMesh2=new n.Mesh(Xr,new n.MeshBasicMaterial(Fe(Fe({},l),{map:ro,opacity:0}))),o.loadingMesh.visible=!1,o.disableMesh.visible=!1,o.ringMesh.position.y=.003,o.disableMesh.position.y=.003,o.centerMesh.position.y=.004,o.loadingMesh.position.y=.003,o.progressMesh.position.y=.003,o.expandMesh.position.y=.002,o.expandMesh2.position.y=.002,o.container=new n.Group,o.renderOrder=-2,o.container.renderOrder=-2,o.container.add(o.centerMesh),o.container.add(o.ringMesh),o.container.add(o.progressMesh),o.container.add(o.loadingMesh),o.container.add(o.disableMesh),o.scaleable=new n.Group,o.scaleable.scale.set(a,1,a),o.scaleable.renderOrder=-2,o.add(o.scaleable),o.scaleable.add(o.container),o.scaleable.add(o.expandMesh),o.scaleable.add(o.expandMesh2),o.currentStartTime=Ue(),o.needsRender=!0,o}return ke(t,e),t.prototype.setProgress=function(e){this.setDisabled(!1),this.setLoading(!1),this.progress!==e&&(e=Er(e,0,1),this.tapMotion.ended&&(0===this.progress&&this.progressOpacityMotion.set({opacity:1},300).catch(qe),0===e?(this.progressOpacityMotion.set({opacity:0},300).catch(qe),this.progressMotion.set({progress:Er(1.2*e,0,1)},0).catch(qe)):this.progressMotion.set({progress:Er(1.2*e,0,1)},100).catch(qe)),this.progress=e)},t.prototype.setOpacity=function(e){this.opacity!==e&&(this.opacity=e=Er(e,0,1),this.opacityMotion.set({opacity:e},500).catch(qe))},t.prototype.setCurrent=function(e){this.current!==e&&(this.currentMotion.set({progress:e?1:0},1e3).catch(qe),this.current=e,!0===this.current&&(this.currentStartTime=Ue()))},t.prototype.setLoading=function(e){this.loading!==e&&(this.loading=e,!0===this.disabled&&this.setDisabled(!1),this.loadingMesh.visible=e,this.needsRender=!0)},t.prototype.setDisabled=function(e){this.disabled!==e&&(this.disabled=e,!0===this.loading&&this.setLoading(!1),this.disableMesh.visible=e,this.ringMesh.visible=!e,this.centerMesh.visible=!e,this.needsRender=!0)},t.prototype.tap=function(){var e=this;if(!this.tapMotion.ended)return Promise.resolve();return this.progressOpacityMotion.set({opacity:0},0).catch(qe),this.progressMotion.set({progress:0},0).catch(qe),this.tapMotion.setKeyframes([{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}}],600).then((function(){e.progressOpacityMotion.set({opacity:e.progress>0?1:0},300).catch(qe),e.progressMotion.set({progress:e.progress},120).catch(qe)})).catch(qe)},t.prototype.updateTime=function(e,t){var i;if(!this.progressMotion.ended){this.progressMotion.update(e);var n=this.progressMotion.value.progress;if(null!==this.progressMesh.material.map)if(0===n)this.progressMesh.material.map!==lo&&(ao.push(this.progressMesh.material.map),this.progressMesh.material.map=lo);else if(1===n)this.progressMesh.material.map!==lo&&(ao.push(this.progressMesh.material.map),this.progressMesh.material.map=lo);else{if(this.progressMesh.material.map===lo){var r=ao.pop()||so();this.progressMesh.material.map=r}null===(i=this.progressMesh.material.map)||void 0===i||i.setProgress(n)}this.needsRender=!0}if(!this.progressOpacityMotion.ended){this.progressOpacityMotion.update(e);var o=this.progressOpacityMotion.value.opacity;this.progressMesh.material.opacity=o,this.needsRender=!0}if(!this.opacityMotion.ended){this.opacityMotion.update(e);o=this.opacityMotion.value.opacity*this.tapMotion.value.opacity;this.centerMesh.material.opacity=o,this.ringMesh.material.opacity=o,this.disableMesh.material.opacity=o,this.loadingMesh.material.opacity=o;var s=e/2e3%1;this.expandMesh.material.opacity=(1-Kr(s))/4*this.currentMotion.progress*this.opacityMotion.value.opacity;s=(e-480)/2e3%1;this.expandMesh2.material.opacity=(1-Kr(s))*this.currentMotion.progress*this.opacityMotion.value.opacity,this.needsRender=!0}if(!0===this.loadingMesh.visible&&(this.loadingMesh.rotateY(-t/120),this.needsRender=!0),!this.tapMotion.ended){this.tapMotion.update(e);var a=this.tapMotion.value.scale;this.container.scale.set(a,1,a);o=this.opacityMotion.value.opacity*this.tapMotion.value.opacity;this.centerMesh.material.opacity=o,this.ringMesh.material.opacity=o*this.ringMotion.value.opacity,this.disableMesh.material.opacity=o,this.loadingMesh.material.opacity=o,this.needsRender=!0}if(!this.ringMotion.ended){var l=this.ringMotion.value;a=l.scale,o=l.opacity;this.ringMotion.update(e),this.ringMesh.scale.set(a,1,a),this.ringMesh.material.opacity=o*this.opacityMotion.value.opacity*this.tapMotion.value.opacity,this.needsRender=!0}if(this.current&&0===this.progress&&!1===this.loading){var u=(e+500-this.currentStartTime)/2e3;Math.ceil(u)%5<3?.8!==this.ringMotion.getTargetKeyframe().value.scale&&this.ringMotion.set({scale:.8,opacity:0},500).catch(qe):1!==this.ringMotion.getTargetKeyframe().value.scale&&this.ringMotion.set({scale:1,opacity:1},500).catch(qe)}else 1!==this.ringMotion.getTargetKeyframe().value.scale&&this.ringMotion.set({scale:1,opacity:1},500).catch(qe);if(this.current||!this.currentMotion.ended){this.currentMotion.update(e);var c=(e-this.currentStartTime)/2e3;if(Math.ceil(c)%5<3){a=1+Math.sin(Math.PI*c)/25*this.currentMotion.value.progress;this.centerMesh.scale.set(a,1,a),this.needsRender=!0}var h=(e-this.currentStartTime)/2e3;if(Math.ceil(h)%5<3){a=1+.8*Kr(s=h%1)*this.currentMotion.value.progress;this.expandMesh.scale.set(a,1,a),this.expandMesh.material.opacity=(1-Kr(s))*this.currentMotion.value.progress*this.opacityMotion.value.opacity,this.needsRender=!0}var d=(e-this.currentStartTime-500)/2e3;if(Math.ceil(d)%5<3){a=1+.8*Kr(s=d%1)*this.currentMotion.value.progress;this.expandMesh2.scale.set(a,1,a),this.expandMesh2.material.opacity=(1-Kr(s))/2*this.currentMotion.value.progress*this.opacityMotion.value.opacity,this.needsRender=!0}}},t.prototype.dispose=function(){this.ringMotion.dispose(),this.tapMotion.dispose(),this.progressMotion.dispose(),this.progressOpacityMotion.dispose(),this.opacityMotion.dispose(),this.currentMotion.dispose(),this.progressMesh.material.map!==lo&&(ao.push(this.progressMesh.material.map),this.progressMesh.material.map=null),this.ringMesh.material.dispose(),this.disableMesh.material.dispose(),this.centerMesh.material.dispose(),this.expandMesh.material.dispose(),this.expandMesh2.material.dispose(),this.loadingMesh.material.dispose(),this.progressMesh.material.dispose()},t}(n.Object3D),co=function(e){return 2*e-e*e*e},ho=new Float32Array([-.13,0,-.13,.13,0,-.13,-.13,0,.13,.13,0,.13]),po=new Float32Array([0,1,1,1,0,0,1,0]),fo=new Uint8Array([0,2,1,2,3,1]),Ao=new n.BufferGeometry;Ao.setAttribute("position",new n.BufferAttribute(ho,3)),Ao.setAttribute("uv",new n.BufferAttribute(po,2)),Ao.setIndex(new n.BufferAttribute(fo,1));var mo=function(){var e=Qr(),t=new n.Texture,i=256,r=128;return e.onload=function(){if("undefined"!=typeof document){var n=document.createElement("canvas");n.setAttribute("width",String(i)),n.setAttribute("height",String(i));var o=n.getContext("2d");o&&(o.save(),o.clearRect(0,0,i,i),o.drawImage(e,0,0,i,i),o.globalCompositeOperation="source-out",o.beginPath(),o.lineWidth=29.44,o.arc(r,r,84.48,0,2*Math.PI),o.strokeStyle="rgba(255, 255, 255, 0.7)",o.stroke(),o.restore(),t.image=n,t.needsUpdate=!0)}},e.src=jr,t}(),go=function(){if("undefined"!=typeof document){var e=256,t=199.68,i=document.createElement("canvas");i.setAttribute("width",String(512)),i.setAttribute("height",String(512));var r=i.getContext("2d");if(r)return r.save(),r.beginPath(),r.arc(e,e,t,0,2*Math.PI),r.fillStyle="rgba(255, 255, 255, 0.1)",r.fill(),r.beginPath(),r.arc(e,e,t,0,2*Math.PI),r.strokeStyle="rgba(255, 255, 255, 0.5)",r.lineWidth=10.24,r.stroke(),r.restore(),new n.CanvasTexture(i)}return null}(),vo=function(){if("undefined"!=typeof document){var e=128,t=document.createElement("canvas");t.setAttribute("width",String(256)),t.setAttribute("height",String(256));var i=t.getContext("2d");if(i)return i.save(),i.beginPath(),i.arc(e,e,84.48,0,2*Math.PI),i.lineWidth=29.44,i.strokeStyle="rgba(255, 255, 255, 0.8)",i.shadowBlur=19.2,i.shadowColor="rgba(200, 200, 200, 0.2)",i.stroke(),i.restore(),new n.CanvasTexture(t)}return null}(),yo=function(){if("undefined"!=typeof document){var e=256,t=document.createElement("canvas");t.setAttribute("width",String(512)),t.setAttribute("height",String(512));var i=t.getContext("2d");if(i){i.save(),i.beginPath(),i.arc(e,e,204.8,0,2*Math.PI);var r=i.createRadialGradient(e,e,204.8,e,e,0);r.addColorStop(0,"rgba(255, 255, 255, 0.9)"),r.addColorStop(.3,"rgba(255, 255, 255, 0.0)"),i.fillStyle=r,i.fill(),i.restore();var o=new n.CanvasTexture(t);return o.generateMipmaps=!0,o}}return null}(),bo=function(e,t){var i=128;e.save(),e.clearRect(0,0,256,256),e.beginPath(),e.arc(i,i,84.48,0,2*Math.PI),e.lineWidth=29.44,e.strokeStyle="rgba(255, 255, 255, 0.6)",e.stroke(),e.beginPath(),e.arc(i,i,84.48,0,2*Math.PI*t),e.lineWidth=29.44,e.strokeStyle="rgba(255, 255, 255, 1.0)",e.stroke(),e.restore()},xo=function(){if("undefined"!=typeof document){var e=document.createElement("canvas");e.setAttribute("width",String(256)),e.setAttribute("height",String(256));var t=e.getContext("2d");t&&bo(t,2*Math.PI);var i=new n.CanvasTexture(e);return Object.assign(i,{setProgress:function(e){t&&(bo(t,e),i.needsUpdate=!0)}})}return null},wo=[],Eo=xo(),Mo=function(e){function t(t){void 0===t&&(t={});var i,r,o=this;o=e.call(this)||this;var s=null!==(i=t.color)&&void 0!==i?i:16777215,a=null!==(r=t.scale)&&void 0!==r?r:1;o.progress=0,o.opacity=0,o.loading=!1,o.current=!1,o.disabled=!1,o.currentMotion=new Ur({progress:0}),o.tapMotion=new Ur({scale:1,opacity:1}),o.progressMotion=new Ur({progress:0}),o.progressOpacityMotion=new Ur({opacity:0}),o.opacityMotion=new Ur({opacity:0});var l={color:s,blending:n.CustomBlending,blendSrc:n.SrcAlphaFactor,blendDst:n.OneMinusSrcAlphaFactor,blendSrcAlpha:n.OneFactor,blendDstAlpha:n.OneMinusSrcAlphaFactor,depthWrite:!1};return o.centerMesh=new n.Mesh(Ao,new n.MeshBasicMaterial(Fe(Fe({},l),{map:vo,opacity:0}))),o.loadingMesh=new n.Mesh(Ao,new n.MeshBasicMaterial(Fe(Fe({},l),{map:mo,opacity:.5}))),o.disableMesh=new n.Mesh(Ao,new n.MeshBasicMaterial(Fe(Fe({},l),{map:go,opacity:0}))),o.progressMesh=new n.Mesh(Ao,new n.MeshBasicMaterial(Fe(Fe({},l),{map:Eo,opacity:0}))),o.expandMesh=new n.Mesh(Ao,new n.MeshBasicMaterial(Fe(Fe({},l),{map:yo,opacity:0}))),o.expandMesh2=new n.Mesh(Ao,new n.MeshBasicMaterial(Fe(Fe({},l),{map:yo,opacity:0}))),o.loadingMesh.visible=!1,o.disableMesh.visible=!1,o.disableMesh.position.y=.003,o.centerMesh.position.y=.003,o.loadingMesh.position.y=.005,o.progressMesh.position.y=.004,o.expandMesh.position.y=.002,o.expandMesh2.position.y=.002,o.container=new n.Group,o.renderOrder=-2,o.container.renderOrder=-2,o.container.add(o.centerMesh),o.container.add(o.progressMesh),o.container.add(o.loadingMesh),o.container.add(o.disableMesh),o.scaleable=new n.Group,o.scaleable.scale.set(a,1,a),o.scaleable.renderOrder=-2,o.add(o.scaleable),o.scaleable.add(o.container),o.scaleable.add(o.expandMesh),o.scaleable.add(o.expandMesh2),o.currentStartTime=Ue(),o.needsRender=!0,o}return ke(t,e),t.prototype.setProgress=function(e){this.setDisabled(!1),this.setLoading(!1),this.progress!==e&&(e=Er(e,0,1),this.tapMotion.ended&&(0===this.progress&&this.progressOpacityMotion.set({opacity:1},300).catch(qe),0===e?(this.progressOpacityMotion.set({opacity:0},300).catch(qe),this.progressMotion.set({progress:Er(1.2*e,0,1)},0).catch(qe)):this.progressMotion.set({progress:Er(1.2*e,0,1)},100).catch(qe)),this.progress=e)},t.prototype.setOpacity=function(e){e>0&&(e=1),this.opacity!==e&&(this.opacity=e=Er(e,0,1),this.opacityMotion.set({opacity:e},500).catch(qe))},t.prototype.setCurrent=function(e){this.current!==e&&(this.currentMotion.set({progress:e?1:0},1e3).catch(qe),this.current=e,!0===this.current&&(this.currentStartTime=Ue()))},t.prototype.setLoading=function(e){this.loading!==e&&(this.loading=e,!0===this.disabled&&this.setDisabled(!1),this.loadingMesh.visible=e,this.progressOpacityMotion.set({opacity:e?1:0},300).catch(qe),this.needsRender=!0)},t.prototype.setDisabled=function(e){this.disabled!==e&&(this.disabled=e,!0===this.loading&&this.setLoading(!1),this.disableMesh.visible=e,this.centerMesh.visible=!e,this.needsRender=!0)},t.prototype.tap=function(){var e=this;if(!this.tapMotion.ended)return Promise.resolve();return this.progressOpacityMotion.set({opacity:0},0).catch(qe),this.progressMotion.set({progress:0},0).catch(qe),this.tapMotion.setKeyframes([{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}}],600).then((function(){e.progressOpacityMotion.set({opacity:e.progress>0?1:0},300).catch(qe),e.progressMotion.set({progress:e.progress},120).catch(qe)})).catch(qe)},t.prototype.updateTime=function(e,t){var i;if(!this.progressMotion.ended){this.progressMotion.update(e);var n=this.progressMotion.value.progress;if(null!==this.progressMesh.material.map)if(0===n)this.progressMesh.material.map!==Eo&&(wo.push(this.progressMesh.material.map),this.progressMesh.material.map=Eo);else if(1===n)this.progressMesh.material.map!==Eo&&(wo.push(this.progressMesh.material.map),this.progressMesh.material.map=Eo);else{if(this.progressMesh.material.map===Eo){var r=wo.pop()||xo();this.progressMesh.material.map=r}null===(i=this.progressMesh.material.map)||void 0===i||i.setProgress(n)}this.needsRender=!0}if(this.progressOpacityMotion.ended||(this.progressOpacityMotion.update(e),this.progressMesh.material.opacity=this.loading?0:this.progressOpacityMotion.value.opacity,this.centerMesh.material.opacity=this.opacityMotion.value.opacity*this.tapMotion.value.opacity*(1-this.progressOpacityMotion.value.opacity),this.needsRender=!0),!this.opacityMotion.ended){this.opacityMotion.update(e);var o=this.opacityMotion.value.opacity*this.tapMotion.value.opacity;this.centerMesh.material.opacity=o*(1-this.progressOpacityMotion.value.opacity),this.disableMesh.material.opacity=o,this.loadingMesh.material.opacity=o,this.needsRender=!0}if(!0===this.loadingMesh.visible&&(this.loadingMesh.rotateY(-t/120),this.needsRender=!0),!this.tapMotion.ended){this.tapMotion.update(e);var s=this.tapMotion.value.scale;this.container.scale.set(s,1,s);o=this.opacityMotion.value.opacity*this.tapMotion.value.opacity;this.centerMesh.material.opacity=o*(1-this.progressOpacityMotion.value.opacity),this.disableMesh.material.opacity=o,this.loadingMesh.material.opacity=o,this.needsRender=!0}if(this.current||!this.currentMotion.ended){this.currentMotion.update(e);var a=(e-this.currentStartTime)/2e3;if(Math.ceil(a)%5<3){s=1+Math.sin(Math.PI*a)/25*this.currentMotion.value.progress;this.centerMesh.scale.set(s,1,s),this.needsRender=!0}var l=(e-this.currentStartTime)/2e3;if(Math.ceil(l)%5<3){s=1+.8*co(c=l%1)*this.currentMotion.value.progress;this.expandMesh.scale.set(s,1,s),this.expandMesh.material.opacity=(1-co(c))*this.currentMotion.value.progress*this.opacityMotion.value.opacity,this.needsRender=!0}var u=(e-this.currentStartTime-500)/2e3;if(Math.ceil(u)%5<3){var c;s=1+.8*co(c=u%1)*this.currentMotion.value.progress;this.expandMesh2.scale.set(s,1,s),this.expandMesh2.material.opacity=(1-co(c))/2*this.currentMotion.value.progress*this.opacityMotion.value.opacity,this.needsRender=!0}}},t.prototype.dispose=function(){this.currentMotion.dispose(),this.tapMotion.dispose(),this.progressMotion.dispose(),this.progressOpacityMotion.dispose(),this.opacityMotion.dispose(),this.progressMesh.material.map!==Eo&&(wo.push(this.progressMesh.material.map),this.progressMesh.material.map=null),this.disableMesh.material.dispose(),this.centerMesh.material.dispose(),this.expandMesh.material.dispose(),this.expandMesh2.material.dispose(),this.loadingMesh.material.dispose(),this.progressMesh.material.dispose()},t}(n.Object3D),So=new n.CircleBufferGeometry(.1,16),Co=function(){if("undefined"!=typeof document){var e=512,t=document.createElement("canvas");t.setAttribute("width",String(e)),t.setAttribute("height",String(e));var i=t.getContext("2d");if(i){var r=256,o=192,s=76.8;i.lineWidth=s,i.arc(r,r,o,0,2*Math.PI),i.strokeStyle="rgba(147, 162, 255, 0.3)",i.shadowBlur=12.8,i.shadowColor="rgba(255, 255, 255, 0.6)",i.stroke(),i.lineWidth=s,i.arc(r,r,o,0,2*Math.PI);var a=i.createRadialGradient(r,r,153.6,r,r,230.4);a.addColorStop(0,"rgba(255, 255, 255, 0.3)"),a.addColorStop(.3,"rgba(255, 255, 255, 0.0)"),a.addColorStop(.7,"rgba(255, 255, 255, 0.0)"),a.addColorStop(1,"rgba(255, 255, 255, 0.3)"),i.strokeStyle=a,i.stroke(),i.beginPath(),i.lineWidth=4.8,i.arc(r,r,228,0,2*Math.PI);var l=i.createLinearGradient(0,0,e,0);return l.addColorStop(.02,"rgba(255, 255, 255, 1.0)"),l.addColorStop(.08,"rgba(255, 255, 255, 0.0)"),l.addColorStop(.92,"rgba(255, 255, 255, 0.0)"),l.addColorStop(.98,"rgba(255, 255, 255, 1.0)"),i.strokeStyle=l,i.stroke(),new n.CanvasTexture(t)}}return null}(),Io=new n.MeshBasicMaterial({map:Co,transparent:!0}),Bo=function(e){function t(){var t=e.call(this)||this;return t.ringMesh=new n.Mesh(So,Io),t.ringMesh.renderOrder=-3,t.add(t.ringMesh),t}return ke(t,e),t.prototype.dispose=function(){this.remove(this.ringMesh)},t}(n.Object3D);function To(e,t,i){var n=Math.abs(e-t);return n<.001||void 0!==i&&Math.abs(i-n)<.001}function Po(e,t,i){return!To(e,t,i)}function Ro(e,t){return e.distanceTo(t)<.001}function Do(e,t){return!Ro(e,t)}var Lo=new n.Vector3(0,0,0),ko=function(e){function t(t,i){void 0===i&&(i=Lo);var r=e.call(this)||this,o=new n.BoxBufferGeometry(t.max.x-t.min.x+2*i.x,t.max.y-t.min.y+2*i.y,t.max.z-t.min.z+2*i.z,1,1);o.groups.length=0,o.groups.push({start:0,count:36,materialIndex:0}),o.applyMatrix4((new n.Matrix4).makeScale(-1,1,1)),o.computeVertexNormals();var s=new ci;s.defines.USE_MAP=!1,s.defines.USE_UV=!1,s.defines.USE_PANO_OPACITY=!0,s.uniforms.diffuse.value=new n.Color(10066329);var a=new xt(o,[s]);return a.floorIndex=-1,a.position.copy(t.getCenter(new n.Vector3)),a.frustumCulled=!1,r.renderOrder=-3,r.add(a),r.boundingBox=new n.Box3,r.boundingBox.setFromObject(r),r}return ke(t,e),t.prototype.dispose=function(){this.disposeMaterial(),this.disposeGeometry()},t}(Et);function Fo(e,t){return void 0===t&&(t=Lo),new ko(e,t)}function Oo(e){var t=e.getError();if(t===e.NO_ERROR)return null;switch(t){case e.INVALID_ENUM:return new Error("webgl error: INVALID_ENUM");case e.INVALID_VALUE:return new Error("webgl error: INVALID_VALUE");case e.INVALID_OPERATION:return new Error("webgl error: INVALID_OPERATION");case e.INVALID_FRAMEBUFFER_OPERATION:return new Error("webgl error: INVALID_FRAMEBUFFER_OPERATION");case e.OUT_OF_MEMORY:return new Error("webgl error: OUT_OF_MEMORY");case e.CONTEXT_LOST_WEBGL:return new Error("webgl error: CONTEXT_LOST_WEBGL");default:return null}}var No=2*Math.PI;function Vo(e){return e>=0&&e<No?e:(e%No+No)%No}var Qo=Math.PI,Ho=2*Qo;function qo(e,t,i){if(e===t)return t;var n=t-e;return Math.abs(n)<=i?t:e+(n>0?1:-1)*i}!function(){try{var e=document.createElement("canvas");!window.WebGLRenderingContext||!e.getContext("webgl")&&e.getContext("experimental-webgl")}catch(e){return!1}}();var zo=function(){var e="undefined"!=typeof navigator?navigator.userAgent.toLowerCase():"node";return/android/i.test(e)||/webos/i.test(e)||/ipad|iphone|ipod/i.test(e)||/iemobile/i.test(e)||/opera mini/i.test(e)||/blackberry/i.test(e)||/windows phone/i.test(e)};function Uo(e,t){e.mode=t.mode,e.panoIndex=t.panoIndex,e.longitude=t.longitude,e.latitude=t.latitude,e.fov=t.fov,e.offset.copy(t.offset)}function jo(e,t){return e.panoIndex===t.panoIndex&&e.mode===t.mode&&To(e.longitude,t.longitude,2*Math.PI)&&To(e.latitude,t.latitude)&&To(e.fov,t.fov)&&Ro(e.offset,t.offset)}var Ko=function(e){return Number(e)};function Go(e,t,i){var n;void 0===t&&(t=Ko),void 0===i&&(i=!1);for(var r,o=1/0,s=0,a=e;s<a.length;s++){var l=a[s],u=t(l);u<=o&&(r=(n=[l,u])[0],o=n[1])}return isFinite(o)||(o=0),i?[r,o]:r}function _o(e){for(var t in e)return!1;return!0}function Wo(e){return{longitude:e.longitude,latitude:e.latitude,fov:e.fov,offset:e.offset.clone(),distance:e.distance}}
368
368
  /*! Hammer.JS - v2.0.7 - 2016-04-22
369
369
  * http://hammerjs.github.io/
370
370
  *
371
371
  * Copyright (c) 2016 Jorik Tangelder;
372
- * Licensed under the MIT license */var Es=function(e,t,i,n){var r,o=["","webkit","Moz","MS","ms","o"],s=t.createElement?t.createElement("div"):n,a=Math.round,l=Math.abs,u=Date.now;function c(e,t,i){return setTimeout(m(e,i),t)}function h(e,t,i){return!!Array.isArray(e)&&(d(e,i[t],i),!0)}function d(e,t,i){var r;if(e)if(e.forEach)e.forEach(t,i);else if(e.length!==n)for(r=0;r<e.length;)t.call(i,e[r],r,e),r++;else for(r in e)e.hasOwnProperty(r)&&t.call(i,e[r],r,e)}function p(t,i,n){var r="DEPRECATED METHOD: "+i+"\n"+n+" AT \n";return function(){var i=new Error("get-stack-trace"),n=i&&i.stack?i.stack.replace(/^[^\(]+?[\n$]/gm,"").replace(/^\s+at\s+/gm,"").replace(/^Object.<anonymous>\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",o=e.console&&(e.console.warn||e.console.log);return o&&o.call(e.console,r,n),t.apply(this,arguments)}}r="function"!=typeof Object.assign?function(e){if(e===n||null===e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),i=1;i<arguments.length;i++){var r=arguments[i];if(r!==n&&null!==r)for(var o in r)r.hasOwnProperty(o)&&(t[o]=r[o])}return t}:Object.assign;var f=p((function(e,t,i){for(var r=Object.keys(t),o=0;o<r.length;)(!i||i&&e[r[o]]===n)&&(e[r[o]]=t[r[o]]),o++;return e}),"extend","Use `assign`."),A=p((function(e,t){return f(e,t,!0)}),"merge","Use `assign`.");function g(e,t,i){var n,o=t.prototype;(n=e.prototype=Object.create(o)).constructor=e,n._super=o,i&&r(n,i)}function m(e,t){return function(){return e.apply(t,arguments)}}function v(e,t){return"function"==typeof e?e.apply(t&&t[0]||n,t):e}function y(e,t){return e===n?t:e}function b(e,t,i){d(E(t),(function(t){e.addEventListener(t,i,!1)}))}function x(e,t,i){d(E(t),(function(t){e.removeEventListener(t,i,!1)}))}function w(e,t){for(;e;){if(e==t)return!0;e=e.parentNode}return!1}function M(e,t){return e.indexOf(t)>-1}function E(e){return e.trim().split(/\s+/g)}function S(e,t,i){if(e.indexOf&&!i)return e.indexOf(t);for(var n=0;n<e.length;){if(i&&e[n][i]==t||!i&&e[n]===t)return n;n++}return-1}function C(e){return Array.prototype.slice.call(e,0)}function I(e,t,i){for(var n=[],r=[],o=0;o<e.length;){var s=t?e[o][t]:e[o];S(r,s)<0&&n.push(e[o]),r[o]=s,o++}return i&&(n=t?n.sort((function(e,i){return e[t]>i[t]})):n.sort()),n}function B(e,t){for(var i,r,s=t[0].toUpperCase()+t.slice(1),a=0;a<o.length;){if((r=(i=o[a])?i+s:t)in e)return r;a++}return n}var T=1;function P(t){var i=t.ownerDocument||t;return i.defaultView||i.parentWindow||e}var R="ontouchstart"in e,D=B(e,"PointerEvent")!==n,L=R&&/mobile|tablet|ip(ad|hone|od)|android/i.test(navigator.userAgent),k="touch",O="mouse",F=24,N=["x","y"],V=["clientX","clientY"];function Q(e,t){var i=this;this.manager=e,this.callback=t,this.element=e.element,this.target=e.options.inputTarget,this.domHandler=function(t){v(e.options.enable,[e])&&i.handler(t)},this.init()}function H(e,t,i){var r=i.pointers.length,o=i.changedPointers.length,s=1&t&&r-o==0,a=12&t&&r-o==0;i.isFirst=!!s,i.isFinal=!!a,s&&(e.session={}),i.eventType=t,function(e,t){var i=e.session,r=t.pointers,o=r.length;i.firstInput||(i.firstInput=q(t));o>1&&!i.firstMultiple?i.firstMultiple=q(t):1===o&&(i.firstMultiple=!1);var s=i.firstInput,a=i.firstMultiple,c=a?a.center:s.center,h=t.center=U(r);t.timeStamp=u(),t.deltaTime=t.timeStamp-s.timeStamp,t.angle=G(c,h),t.distance=K(c,h),function(e,t){var i=t.center,n=e.offsetDelta||{},r=e.prevDelta||{},o=e.prevInput||{};1!==t.eventType&&4!==o.eventType||(r=e.prevDelta={x:o.deltaX||0,y:o.deltaY||0},n=e.offsetDelta={x:i.x,y:i.y});t.deltaX=r.x+(i.x-n.x),t.deltaY=r.y+(i.y-n.y)}(i,t),t.offsetDirection=j(t.deltaX,t.deltaY);var d=z(t.deltaTime,t.deltaX,t.deltaY);t.overallVelocityX=d.x,t.overallVelocityY=d.y,t.overallVelocity=l(d.x)>l(d.y)?d.x:d.y,t.scale=a?function(e,t){return K(t[0],t[1],V)/K(e[0],e[1],V)}(a.pointers,r):1,t.rotation=a?function(e,t){return G(t[1],t[0],V)+G(e[1],e[0],V)}(a.pointers,r):0,t.maxPointers=i.prevInput?t.pointers.length>i.prevInput.maxPointers?t.pointers.length:i.prevInput.maxPointers:t.pointers.length,function(e,t){var i,r,o,s,a=e.lastInterval||t,u=t.timeStamp-a.timeStamp;if(8!=t.eventType&&(u>25||a.velocity===n)){var c=t.deltaX-a.deltaX,h=t.deltaY-a.deltaY,d=z(u,c,h);r=d.x,o=d.y,i=l(d.x)>l(d.y)?d.x:d.y,s=j(c,h),e.lastInterval=t}else i=a.velocity,r=a.velocityX,o=a.velocityY,s=a.direction;t.velocity=i,t.velocityX=r,t.velocityY=o,t.direction=s}(i,t);var p=e.element;w(t.srcEvent.target,p)&&(p=t.srcEvent.target);t.target=p}(e,i),e.emit("hammer.input",i),e.recognize(i),e.session.prevInput=i}function q(e){for(var t=[],i=0;i<e.pointers.length;)t[i]={clientX:a(e.pointers[i].clientX),clientY:a(e.pointers[i].clientY)},i++;return{timeStamp:u(),pointers:t,center:U(t),deltaX:e.deltaX,deltaY:e.deltaY}}function U(e){var t=e.length;if(1===t)return{x:a(e[0].clientX),y:a(e[0].clientY)};for(var i=0,n=0,r=0;r<t;)i+=e[r].clientX,n+=e[r].clientY,r++;return{x:a(i/t),y:a(n/t)}}function z(e,t,i){return{x:t/e||0,y:i/e||0}}function j(e,t){return e===t?1:l(e)>=l(t)?e<0?2:4:t<0?8:16}function K(e,t,i){i||(i=N);var n=t[i[0]]-e[i[0]],r=t[i[1]]-e[i[1]];return Math.sqrt(n*n+r*r)}function G(e,t,i){i||(i=N);var n=t[i[0]]-e[i[0]],r=t[i[1]]-e[i[1]];return 180*Math.atan2(r,n)/Math.PI}Q.prototype={handler:function(){},init:function(){this.evEl&&b(this.element,this.evEl,this.domHandler),this.evTarget&&b(this.target,this.evTarget,this.domHandler),this.evWin&&b(P(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&x(this.element,this.evEl,this.domHandler),this.evTarget&&x(this.target,this.evTarget,this.domHandler),this.evWin&&x(P(this.element),this.evWin,this.domHandler)}};var _={mousedown:1,mousemove:2,mouseup:4},W="mousedown",X="mousemove mouseup";function Y(){this.evEl=W,this.evWin=X,this.pressed=!1,Q.apply(this,arguments)}g(Y,Q,{handler:function(e){var t=_[e.type];1&t&&(0===e.button||2===e.button)&&(this.pressed=!0),2&t&&1!==e.which&&(t=4),this.pressed&&(4&t&&(this.pressed=!1),this.callback(this.manager,t,{pointers:[e],changedPointers:[e],pointerType:O,srcEvent:e}))}});var Z={pointerdown:1,pointermove:2,pointerup:4,pointercancel:8,pointerout:8},J={2:k,3:"pen",4:O,5:"kinect"},$="pointerdown",ee="pointermove pointerup pointercancel";function te(){this.evEl=$,this.evWin=ee,Q.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}e.MSPointerEvent&&!e.PointerEvent&&($="MSPointerDown",ee="MSPointerMove MSPointerUp MSPointerCancel"),g(te,Q,{handler:function(e){var t=this.store,i=!1,n=!1,r=e.type.toLowerCase().replace("ms",""),o=Z[r],s=J[e.pointerType]||e.pointerType,a=s==k,l=S(t,e.pointerId,"pointerId");1&o&&(0===e.button||2===e.button||a)?l<0&&(t.push(e),l=t.length-1):12&o?i=!0:a||0!==e.buttons||(i=!0,n=!0,o=Z.pointerup),l<0||(n||(t[l]=e),this.callback(this.manager,o,{pointers:t,changedPointers:[e],pointerType:s,srcEvent:t[l]}),i&&t.splice(l,1))}});var ie={touchstart:1,touchmove:2,touchend:4,touchcancel:8},ne="touchstart",re="touchstart touchmove touchend touchcancel";function oe(){this.evTarget=ne,this.evWin=re,this.started=!1,Q.apply(this,arguments)}function se(e,t){var i=C(e.touches),n=C(e.changedTouches);return 12&t&&(i=I(i.concat(n),"identifier",!0)),[i,n]}g(oe,Q,{handler:function(e){var t=ie[e.type];if(1===t&&(this.started=!0),this.started){var i=se.call(this,e,t);12&t&&i[0].length-i[1].length==0&&(this.started=!1),this.callback(this.manager,t,{pointers:i[0],changedPointers:i[1],pointerType:k,srcEvent:e})}}});var ae={touchstart:1,touchmove:2,touchend:4,touchcancel:8},le="touchstart touchmove touchend touchcancel";function ue(){this.evTarget=le,this.targetIds={},Q.apply(this,arguments)}function ce(e,t){var i=C(e.touches),n=this.targetIds;if(3&t&&1===i.length)return n[i[0].identifier]=!0,[i,i];var r,o,s=C(e.changedTouches),a=[],l=this.target;if(o=i.filter((function(e){return w(e.target,l)})),1===t)for(r=0;r<o.length;)n[o[r].identifier]=!0,r++;for(r=0;r<s.length;)n[s[r].identifier]&&a.push(s[r]),12&t&&delete n[s[r].identifier],r++;return a.length?[I(o.concat(a),"identifier",!0),a]:void 0}g(ue,Q,{handler:function(e){var t=ae[e.type],i=ce.call(this,e,t);i&&this.callback(this.manager,t,{pointers:i[0],changedPointers:i[1],pointerType:k,srcEvent:e})}});function he(){Q.apply(this,arguments);var e=m(this.handler,this);this.touch=new ue(this.manager,e),this.mouse=new Y(this.manager,e),this.primaryTouch=null,this.lastTouches=[]}function de(e,t){1&e?(this.primaryTouch=t.changedPointers[0].identifier,pe.call(this,t)):12&e&&pe.call(this,t)}function pe(e){var t=e.changedPointers[0];if(t.identifier===this.primaryTouch){var i={x:t.clientX,y:t.clientY};this.lastTouches.push(i);var n=this.lastTouches;setTimeout((function(){var e=n.indexOf(i);e>-1&&n.splice(e,1)}),2500)}}function fe(e){for(var t=e.srcEvent.clientX,i=e.srcEvent.clientY,n=0;n<this.lastTouches.length;n++){var r=this.lastTouches[n],o=Math.abs(t-r.x),s=Math.abs(i-r.y);if(o<=25&&s<=25)return!0}return!1}g(he,Q,{handler:function(e,t,i){var n=i.pointerType==k,r=i.pointerType==O;if(!(r&&i.sourceCapabilities&&i.sourceCapabilities.firesTouchEvents)){if(n)de.call(this,t,i);else if(r&&fe.call(this,i))return;this.callback(e,t,i)}},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});var Ae=s?B(s.style,"touchAction"):n,ge=Ae!==n,me="compute",ve="auto",ye="manipulation",be="none",xe="pan-x",we="pan-y",Me=function(){if(!ge)return!1;var t={},i=e.CSS&&e.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach((function(n){t[n]=!i||e.CSS.supports("touch-action",n)})),t}();function Ee(e,t){this.manager=e,this.set(t)}Ee.prototype={set:function(e){e==me&&(e=this.compute()),ge&&this.manager.element.style&&Me[e]&&(this.manager.element.style[Ae]=e),this.actions=e.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var e=[];return d(this.manager.recognizers,(function(t){v(t.options.enable,[t])&&(e=e.concat(t.getTouchAction()))})),function(e){if(M(e,be))return be;var t=M(e,xe),i=M(e,we);if(t&&i)return be;if(t||i)return t?xe:we;if(M(e,ye))return ye;return ve}(e.join(" "))},preventDefaults:function(e){var t=e.srcEvent,i=e.offsetDirection;if(this.manager.session.prevented)t.preventDefault();else{var n=this.actions,r=M(n,be)&&!Me.none,o=M(n,we)&&!Me["pan-y"],s=M(n,xe)&&!Me["pan-x"];if(r){var a=1===e.pointers.length,l=e.distance<2,u=e.deltaTime<250;if(a&&l&&u)return}if(!s||!o)return r||o&&6&i||s&&i&F?this.preventSrc(t):void 0}},preventSrc:function(e){this.manager.session.prevented=!0,e.preventDefault()}};var Se=32;function Ce(e){this.options=r({},this.defaults,e||{}),this.id=T++,this.manager=null,this.options.enable=y(this.options.enable,!0),this.state=1,this.simultaneous={},this.requireFail=[]}function Ie(e){return 16&e?"cancel":8&e?"end":4&e?"move":2&e?"start":""}function Be(e){return 16==e?"down":8==e?"up":2==e?"left":4==e?"right":""}function Te(e,t){var i=t.manager;return i?i.get(e):e}function Pe(){Ce.apply(this,arguments)}function Re(){Pe.apply(this,arguments),this.pX=null,this.pY=null}function De(){Pe.apply(this,arguments)}function Le(){Ce.apply(this,arguments),this._timer=null,this._input=null}function ke(){Pe.apply(this,arguments)}function Oe(){Pe.apply(this,arguments)}function Fe(){Ce.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}function Ne(e,t){return(t=t||{}).recognizers=y(t.recognizers,Ne.defaults.preset),new Ve(e,t)}Ce.prototype={defaults:{},set:function(e){return r(this.options,e),this.manager&&this.manager.touchAction.update(),this},recognizeWith:function(e){if(h(e,"recognizeWith",this))return this;var t=this.simultaneous;return t[(e=Te(e,this)).id]||(t[e.id]=e,e.recognizeWith(this)),this},dropRecognizeWith:function(e){return h(e,"dropRecognizeWith",this)||(e=Te(e,this),delete this.simultaneous[e.id]),this},requireFailure:function(e){if(h(e,"requireFailure",this))return this;var t=this.requireFail;return-1===S(t,e=Te(e,this))&&(t.push(e),e.requireFailure(this)),this},dropRequireFailure:function(e){if(h(e,"dropRequireFailure",this))return this;e=Te(e,this);var t=S(this.requireFail,e);return t>-1&&this.requireFail.splice(t,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(e){return!!this.simultaneous[e.id]},emit:function(e){var t=this,i=this.state;function n(i){t.manager.emit(i,e)}i<8&&n(t.options.event+Ie(i)),n(t.options.event),e.additionalEvent&&n(e.additionalEvent),i>=8&&n(t.options.event+Ie(i))},tryEmit:function(e){if(this.canEmit())return this.emit(e);this.state=Se},canEmit:function(){for(var e=0;e<this.requireFail.length;){if(!(33&this.requireFail[e].state))return!1;e++}return!0},recognize:function(e){var t=r({},e);if(!v(this.options.enable,[this,t]))return this.reset(),void(this.state=Se);56&this.state&&(this.state=1),this.state=this.process(t),30&this.state&&this.tryEmit(t)},process:function(e){},getTouchAction:function(){},reset:function(){}},g(Pe,Ce,{defaults:{pointers:1},attrTest:function(e){var t=this.options.pointers;return 0===t||e.pointers.length===t},process:function(e){var t=this.state,i=e.eventType,n=6&t,r=this.attrTest(e);return n&&(8&i||!r)?16|t:n||r?4&i?8|t:2&t?4|t:2:Se}}),g(Re,Pe,{defaults:{event:"pan",threshold:10,pointers:1,direction:30},getTouchAction:function(){var e=this.options.direction,t=[];return 6&e&&t.push(we),e&F&&t.push(xe),t},directionTest:function(e){var t=this.options,i=!0,n=e.distance,r=e.direction,o=e.deltaX,s=e.deltaY;return r&t.direction||(6&t.direction?(r=0===o?1:o<0?2:4,i=o!=this.pX,n=Math.abs(e.deltaX)):(r=0===s?1:s<0?8:16,i=s!=this.pY,n=Math.abs(e.deltaY))),e.direction=r,i&&n>t.threshold&&r&t.direction},attrTest:function(e){return Pe.prototype.attrTest.call(this,e)&&(2&this.state||!(2&this.state)&&this.directionTest(e))},emit:function(e){this.pX=e.deltaX,this.pY=e.deltaY;var t=Be(e.direction);t&&(e.additionalEvent=this.options.event+t),this._super.emit.call(this,e)}}),g(De,Pe,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[be]},attrTest:function(e){return this._super.attrTest.call(this,e)&&(Math.abs(e.scale-1)>this.options.threshold||2&this.state)},emit:function(e){if(1!==e.scale){var t=e.scale<1?"in":"out";e.additionalEvent=this.options.event+t}this._super.emit.call(this,e)}}),g(Le,Ce,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[ve]},process:function(e){var t=this.options,i=e.pointers.length===t.pointers,n=e.distance<t.threshold,r=e.deltaTime>t.time;if(this._input=e,!n||!i||12&e.eventType&&!r)this.reset();else if(1&e.eventType)this.reset(),this._timer=c((function(){this.state=8,this.tryEmit()}),t.time,this);else if(4&e.eventType)return 8;return Se},reset:function(){clearTimeout(this._timer)},emit:function(e){8===this.state&&(e&&4&e.eventType?this.manager.emit(this.options.event+"up",e):(this._input.timeStamp=u(),this.manager.emit(this.options.event,this._input)))}}),g(ke,Pe,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[be]},attrTest:function(e){return this._super.attrTest.call(this,e)&&(Math.abs(e.rotation)>this.options.threshold||2&this.state)}}),g(Oe,Pe,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:30,pointers:1},getTouchAction:function(){return Re.prototype.getTouchAction.call(this)},attrTest:function(e){var t,i=this.options.direction;return 30&i?t=e.overallVelocity:6&i?t=e.overallVelocityX:i&F&&(t=e.overallVelocityY),this._super.attrTest.call(this,e)&&i&e.offsetDirection&&e.distance>this.options.threshold&&e.maxPointers==this.options.pointers&&l(t)>this.options.velocity&&4&e.eventType},emit:function(e){var t=Be(e.offsetDirection);t&&this.manager.emit(this.options.event+t,e),this.manager.emit(this.options.event,e)}}),g(Fe,Ce,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[ye]},process:function(e){var t=this.options,i=e.pointers.length===t.pointers,n=e.distance<t.threshold,r=e.deltaTime<t.time;if(this.reset(),1&e.eventType&&0===this.count)return this.failTimeout();if(n&&r&&i){if(4!=e.eventType)return this.failTimeout();var o=!this.pTime||e.timeStamp-this.pTime<t.interval,s=!this.pCenter||K(this.pCenter,e.center)<t.posThreshold;if(this.pTime=e.timeStamp,this.pCenter=e.center,s&&o?this.count+=1:this.count=1,this._input=e,0===this.count%t.taps)return this.hasRequireFailures()?(this._timer=c((function(){this.state=8,this.tryEmit()}),t.interval,this),2):8}return Se},failTimeout:function(){return this._timer=c((function(){this.state=Se}),this.options.interval,this),Se},reset:function(){clearTimeout(this._timer)},emit:function(){8==this.state&&(this._input.tapCount=this.count,this.manager.emit(this.options.event,this._input))}}),Ne.VERSION="2.0.7",Ne.defaults={domEvents:!1,touchAction:me,enable:!0,inputTarget:null,inputClass:null,preset:[[ke,{enable:!1}],[De,{enable:!1},["rotate"]],[Oe,{direction:6}],[Re,{direction:6},["swipe"]],[Fe],[Fe,{event:"doubletap",taps:2},["tap"]],[Le]],cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}};function Ve(e,t){var i;this.options=r({},Ne.defaults,t||{}),this.options.inputTarget=this.options.inputTarget||e,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=e,this.input=new((i=this).options.inputClass||(D?te:L?ue:R?he:Y))(i,H),this.touchAction=new Ee(this,this.options.touchAction),Qe(this,!0),d(this.options.recognizers,(function(e){var t=this.add(new e[0](e[1]));e[2]&&t.recognizeWith(e[2]),e[3]&&t.requireFailure(e[3])}),this)}function Qe(e,t){var i,n=e.element;n.style&&(d(e.options.cssProps,(function(r,o){i=B(n.style,o),t?(e.oldCssProps[i]=n.style[i],n.style[i]=r):n.style[i]=e.oldCssProps[i]||""})),t||(e.oldCssProps={}))}return Ve.prototype={set:function(e){return r(this.options,e),e.touchAction&&this.touchAction.update(),e.inputTarget&&(this.input.destroy(),this.input.target=e.inputTarget,this.input.init()),this},stop:function(e){this.session.stopped=e?2:1},recognize:function(e){var t=this.session;if(!t.stopped){var i;this.touchAction.preventDefaults(e);var n=this.recognizers,r=t.curRecognizer;(!r||r&&8&r.state)&&(r=t.curRecognizer=null);for(var o=0;o<n.length;)i=n[o],2===t.stopped||r&&i!=r&&!i.canRecognizeWith(r)?i.reset():i.recognize(e),!r&&14&i.state&&(r=t.curRecognizer=i),o++}},get:function(e){if(e instanceof Ce)return e;for(var t=this.recognizers,i=0;i<t.length;i++)if(t[i].options.event==e)return t[i];return null},add:function(e){if(h(e,"add",this))return this;var t=this.get(e.options.event);return t&&this.remove(t),this.recognizers.push(e),e.manager=this,this.touchAction.update(),e},remove:function(e){if(h(e,"remove",this))return this;if(e=this.get(e)){var t=this.recognizers,i=S(t,e);-1!==i&&(t.splice(i,1),this.touchAction.update())}return this},on:function(e,t){if(e!==n&&t!==n){var i=this.handlers;return d(E(e),(function(e){i[e]=i[e]||[],i[e].push(t)})),this}},off:function(e,t){if(e!==n){var i=this.handlers;return d(E(e),(function(e){t?i[e]&&i[e].splice(S(i[e],t),1):delete i[e]})),this}},emit:function(e,i){this.options.domEvents&&function(e,i){var n=t.createEvent("Event");n.initEvent(e,!0,!0),n.gesture=i,i.target.dispatchEvent(n)}(e,i);var n=this.handlers[e]&&this.handlers[e].slice();if(n&&n.length){i.type=e,i.preventDefault=function(){i.srcEvent.preventDefault()};for(var r=0;r<n.length;)n[r](i),r++}},destroy:function(){this.element&&Qe(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}},r(Ne,{INPUT_START:1,INPUT_MOVE:2,INPUT_END:4,INPUT_CANCEL:8,STATE_POSSIBLE:1,STATE_BEGAN:2,STATE_CHANGED:4,STATE_ENDED:8,STATE_RECOGNIZED:8,STATE_CANCELLED:16,STATE_FAILED:Se,DIRECTION_NONE:1,DIRECTION_LEFT:2,DIRECTION_RIGHT:4,DIRECTION_UP:8,DIRECTION_DOWN:16,DIRECTION_HORIZONTAL:6,DIRECTION_VERTICAL:F,DIRECTION_ALL:30,Manager:Ve,Input:Q,TouchAction:Ee,TouchInput:ue,MouseInput:Y,PointerEventInput:te,TouchMouseInput:he,SingleTouchInput:oe,Recognizer:Ce,AttrRecognizer:Pe,Tap:Fe,Pan:Re,Swipe:Oe,Pinch:De,Rotate:ke,Press:Le,on:b,off:x,each:d,merge:A,extend:f,assign:r,inherit:g,bindFn:m,prefixed:B}),Ne}("undefined"!=typeof window?window:{},"undefined"!=typeof document?document:{});function Ss(e,t,i){var r=t.getBoundingClientRect(),o=r.top,s=r.left,a=r.width,l=r.height;return i&&(s+=a*i.left,o+=l*(1-i.bottom-i.height),a*=i.width,l*=i.height),new n.Vector2((e.x-s)/a*2-1,-(e.y-o)/l*2+1)}var Cs=new n.OrthographicCamera(-1,1,1,-1,0,1),Is=new n.BufferGeometry;Is.setAttribute("position",new n.Float32BufferAttribute([-1,3,0,-1,-1,0,3,-1,0],3)),Is.setAttribute("uv",new n.Float32BufferAttribute([0,2,0,0,2,0],2));var Bs=new n.Mesh(Is),Ts=new n.Scene;Ts.add(Bs);var Ps=function(){function e(e,t){var i;this.renderer=e,this.material=new n.ShaderMaterial({vertexShader:null!==(i=t.vertex)&&void 0!==i?i:"\nvarying vec2 vUv;\nvoid main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}\n",fragmentShader:t.fragment,uniforms:Object.assign({inputBuffer:new n.Uniform(null)},t.uniforms),defines:Object.assign({},t.defines),blending:n.NoBlending,depthWrite:!1,depthTest:!1})}return e.prototype.render=function(e,t){var i=this.renderer.getRenderTarget(),n=Bs.material;this.material.uniforms.inputBuffer.value=e.texture,Bs.material=this.material,this.renderer.setRenderTarget(t||null),this.renderer.render(Ts,Cs),this.renderer.setRenderTarget(i),Bs.material=n},e.prototype.dispose=function(){this.material.dispose()},e}(),Rs=function(){function e(e){this.renderer=e,this.material=new n.ShaderMaterial({vertexShader:"\nvoid main() {\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}\n",fragmentShader:"\nuniform vec3 inputValue;\nvoid main() {\n gl_FragColor = vec4(inputValue, 1.0);\n}\n",uniforms:Object.assign({inputValue:new n.Uniform(new n.Vector3)}),blending:n.NoBlending,depthWrite:!1,depthTest:!1})}return e.prototype.render=function(e,t){var i=this.renderer.getRenderTarget(),n=Bs.material;this.material.uniforms.inputValue.value.copy(e),Bs.material=this.material,this.renderer.setRenderTarget(t||null),this.renderer.render(Ts,Cs),this.renderer.setRenderTarget(i),Bs.material=n},e.prototype.dispose=function(){this.material.dispose()},e}(),Ds=function(e){function t(t){return e.call(this,t,{fragment:"\nuniform sampler2D inputBuffer;\nvarying vec2 vUv;\nvoid main() {\n gl_FragColor = texture2D(inputBuffer, vUv);\n}\n"})||this}return ke(t,e),t}(Ps),Ls=function(){function e(e){this.enable=!0,this.renderer=e,this.copyPass=new Ds(this.renderer)}return e.prototype.render=function(e,t){this.copyPass.render(e,t)},e.prototype.dispose=function(){this.copyPass.dispose()},e}(),ks=function(e){function t(i){var n,r=this;r=e.call(this)||this;var o=t.parseArgs(i);return r.pending=!0,r.userAction=o.initial[3],r.destroyed=!1,r.ident=o.ident,r.scene=o.scene,r.parallaxScene=o.parallaxScene,r.helper=o.helper,r.camera=o.camera,r.renderer=o.renderer,r.scissor=o.scissor,r.element=o.element,r.model=o.model,r.enableIOSEDR=null!==(n=o.enableIOSEDR)&&void 0!==n&&n,r.work=o.work,r.imageOptions=o.imageOptions,r.videoTexture=o.videoTexture,r.networkSubscribe=o.networkSubscribe,r.requestProxy=o.requestProxy,r.needsRender=!0,r.maxFov=120,r.minFov=40,r.maxLatitude=+Math.PI/2,r.minLatitude=-Math.PI/2,r.cameraMotion=new zr({longitude:{value:r.camera.pose.longitude,circle:[0,2*Math.PI]},latitude:r.camera.pose.latitude,fov:r.camera.pose.fov}),r.eventUnbinds=[o.element].concat(o.extraElements||[]).map((function(e){return r.bindEvents(e)})),dt.shared.add((function(){return r.initAnimation.apply(r,o.initial)}),!0),r}return ke(t,e),t.parseArgs=function(e){return Oe({},e)},t.initAnimationEndState=function(e){var t=this.parseArgs(e);return{longitude:t.camera.pose.longitude,latitude:t.camera.pose.latitude,fov:t.camera.pose.fov,offset:t.camera.pose.offset.clone(),distance:t.camera.pose.distance}},t.prototype.destroy=function(){var e;this.destroyed=!0,this.off(),this.cameraMotion.dispose();for(var t=0,i=this.eventUnbinds;t<i.length;t++){(0,i[t])()}this.copyEffect&&(this.copyEffect.dispose(),delete this.copyEffect),delete this.panState,null===(e=this.pressState)||void 0===e||e.stop(),delete this.pressState},t.prototype.isReady=function(){return!1===this.pending&&!0===this.cameraMotion.ended},t.prototype.bindExtraElement=function(e){for(var t=0,i=this.eventUnbinds;t<i.length;t++){if(i[t].element===e)return}this.eventUnbinds.push(this.bindEvents(e))},t.prototype.unbindExtraElement=function(e){for(var t=[],i=0,n=this.eventUnbinds;i<n.length;i++){var r=n[i];r.element===e?r():t.push(r)}this.eventUnbinds=t},t.prototype.updateRenderSize=function(){this.needsRender=!0},t.prototype.updateModel=function(e){this.model=e,this.needsRender=!0},t.prototype.updateWork=function(e,t,i,n,r){return this.work=e,this.userAction=r,!1},t.prototype.updateTime=function(e,t){if(!this.destroyed){var i={};this.cameraMotion.ended&&(this.cameraMotion.update(e),i.longitude=this.cameraMotion.value.longitude,i.latitude=this.cameraMotion.value.latitude,i.fov=this.cameraMotion.value.fov),ws(i)&&this.setCamera(i)}},t.prototype.render=function(){this.renderer.render(this.scene,this.camera)},t.prototype.postProcessing=function(e,t){this.destroyed||(this.copyEffect||(this.copyEffect=new Ls(this.renderer)),this.copyEffect.render(e,t))},t.prototype.updateCamera=function(e,t,i){return this.userAction=i,this.cameraMotion.set(e,t)},t.prototype.updateCameraWithKeyframes=function(e,t,i){return this.userAction=i,this.cameraMotion.setKeyframes(e,t)},t.prototype.getTargetPose=function(){var e=this.cameraMotion.getKeyFrameSegment(ze())[1];return{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.moveToPano=function(e,t,i){void 0===t&&(t={}),this.userAction=i;var n={longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude,fov:this.camera.pose.fov,offset:this.camera.pose.offset.clone(),distance:this.camera.pose.distance};t.moveStartCallback&&t.moveStartCallback(e,n),this.emit("moveToPano",e,this.userAction),this.emit("panoWillArrive",e,n,this.userAction),this.emit("panoArrived",e,n,this.userAction),t.moveEndCallback&&t.moveEndCallback(e,n)},t.prototype.initAnimation=function(e,t,i,n){this.pending=!1,this.userAction=n},t.prototype.setCamera=function(e){var t,i,n,r,o;void 0===e&&(e={});var s=null!==(t=e.longitude)&&void 0!==t?t:this.camera.pose.longitude,a=null!==(i=e.latitude)&&void 0!==i?i:this.camera.pose.latitude,l=null!==(n=e.fov)&&void 0!==n?n:this.camera.pose.fov,u=null!==(r=e.distance)&&void 0!==r?r:this.camera.pose.distance,c=null!==(o=e.offset)&&void 0!==o?o:this.camera.pose.offset,h=this.camera.position.clone(),d=os(s,this.camera.pose.longitude,2*Math.PI)||os(a,this.camera.pose.latitude),p=os(l,this.camera.pose.fov),f=os(u,this.camera.pose.distance),A=as(c,this.camera.pose.offset);this.camera.setFromPose({longitude:s,latitude:a,fov:l,distance:u,offset:c});var g=as(h,this.camera.position);p&&this.emit("cameraFovUpdate",l,this.userAction),d&&this.emit("cameraDirectionUpdate",{longitude:s,latitude:a},this.userAction),g&&this.emit("cameraPositionUpdate",this.camera.position.clone(),this.userAction),(p||d||A||f)&&this.emit("cameraUpdate",{longitude:s,latitude:a,fov:l,offset:c,distance:u},this.userAction),this.needsRender=!0},t.prototype.onPanGesture=function(e){var t=this.panState,i=e.pointers.length;if(e.isFinal?delete this.panState:this.panState={pointerLength:i,x:e.center.x,y:e.center.y},void 0!==t&&t.pointerLength===i){var n=e.pointers.map((function(e){return Tt(e,["x","y"])}));this.emit("wantsGesture","pan",n,e.isFinal)||this.emit("gesture","pan",n,e.isFinal)}},t.prototype.onTapGesture=function(e){var t=e.pointers.map((function(e){return Tt(e,["x","y"])}));this.emit("wantsGesture","tap",t,!0)||this.emit("gesture","tap",t,!0)},t.prototype.onPressGesture=function(e,t){var i,n=[e];if(this.emit("wantsGesture","press",n,t))return null===(i=this.pressState)||void 0===i||i.stop(),void delete this.pressState;this.emit("gesture","press",n,t)},t.prototype.onPinchGesture=function(e){var t=e.pointers.map((function(e){return Tt(e,["x","y"])}));this.emit("wantsGesture","pinch",t,e.isFinal)||this.emit("gesture","pinch",t,e.isFinal)},t.prototype.onMouseWheel=function(e){var t=(Math.abs(e.deltaY)>Math.abs(e.deltaX)?e.deltaY:e.deltaX)/-60,i=[{x:e.clientX,y:e.clientY,delta:t}];this.emit("wantsGesture","mouseWheel",i,!1)||this.emit("gesture","mouseWheel",i,!1)},t.prototype.onMouseMove=function(e){},t.prototype.onMouseOut=function(){},t.prototype.relativeClientPosition=function(e){return Ss(e,this.element,this.scissor)},t.prototype.bindEvents=function(e){var t=this,i=function(e){var i=Ss(e,t.element,t.scissor);return!(Math.abs(i.x)>1||Math.abs(i.y)>1)},n=new Es.Manager(e),r=function(e){return e.session.firstInput||null};n.add(new Es.Pan({threshold:10,pointers:0})),n.add(new Es.Tap({interval:410})),n.add(new Es.Pinch({threshold:0,pointers:2})),n.on("panstart pan",(function(e){var o=r(n);o&&!i(o.center)||(t.onPanGesture(e),f())})),n.on("tap",(function(e){if("mouse"!==e.pointerType||0===e.srcEvent.button){var o=r(n);o&&!i(o.center)||(t.onTapGesture(e),f())}})),n.on("pinchstart pinch pinchend",(function(e){var o=r(n);o&&!i(o.center)||(t.onPinchGesture(e),f())}));var o=null,s=null,a=function(e,t,i){var n="pinchend"===e?t:t-i.deltaY/280;return{type:e,target:i.target,pointerType:"mouse",srcEvent:i,pointers:[{x:i.clientX,y:i.clientY}],isFirst:"pinchstart"===e,isFinal:"pinchend"===e,scale:Mr(n,.1,10),center:{x:i.clientX,y:i.clientY},velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0}},l=function(e){var n,r={x:e.clientX,y:e.clientY};if(i(r)){if(e.preventDefault(),e.ctrlKey){var l=null!==(n=null==o?void 0:o.prevInput.scale)&&void 0!==n?n:1,u=a(o?"pinch":"pinchstart",l,e);null===o?o={firstInput:u,prevInput:u}:o.prevInput=u,t.onPinchGesture(u),null!==s&&window.clearTimeout(s),s=window.setTimeout((function(){var i;s=null;var n=null!==(i=null==o?void 0:o.prevInput.scale)&&void 0!==i?i:1,r=a("pinchend",n,e);o=null,t.onPinchGesture(r)}),200)}else t.onMouseWheel(e);f()}},u=function(e){if(!ms()){var n={x:e.clientX,y:e.clientY};i(n)?(t.onMouseMove(e),t.pressState&&Math.abs(e.clientX-t.pressState.x)>10&&Math.abs(e.clientY-t.pressState.y)>10&&f()):t.onMouseOut()}},c=function(){t.onMouseOut(),f()},h=function(e,n){if(i(e)){t.pressState={x:e.x,y:e.y,time:t.pressState?t.pressState.time:n,stop:qe};var r=n-t.pressState.time;t.onPressGesture({x:e.x,y:e.y,delta:r},!1),t.pressState&&(t.pressState.stop=dt.shared.add((function(t){return h({x:e.x,y:e.y},t)}),!0,1))}else f()},d=function(e){f(),e.touches.length>1||e.changedTouches.length<=0||h({x:e.changedTouches[0].clientX,y:e.changedTouches[0].clientY},ze())},p=function(e){f(),h({x:e.clientX,y:e.clientY},ze())},f=function(){var e;if(t.pressState){var i=ze()-t.pressState.time;t.onPressGesture({x:t.pressState.x,y:t.pressState.y,delta:i},!0),null===(e=t.pressState)||void 0===e||e.stop(),delete t.pressState}},A=null,g=function(e){var t,i="pinch",n=!1,r=!1;switch(e.type){case"gesturestart":i="pinchstart",n=!0;break;case"gestureend":i="pinchend",r=!0}return{type:i,target:e.target,pointerType:"mouse",srcEvent:e,pointers:[{x:e.clientX,y:e.clientY}],isFirst:n,isFinal:r,scale:null!==(t=e.scale)&&void 0!==t?t:1,center:{x:e.clientX,y:e.clientY},velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0}},m=function(e){if(e.preventDefault(),!ms()){var n=g(e),r=(A={firstInput:n}).firstInput;r&&!i(r.center)||t.onPinchGesture(n)}},v=function(e){if(e.preventDefault(),!ms()&&A){var n=g(e),r=A.firstInput;r&&!i(r.center)||t.onPinchGesture(n)}},y=function(e){if(e.preventDefault(),!ms()&&A){var n=g(e),r=A.firstInput;A=null,r&&!i(r.center)||t.onPinchGesture(n)}},b=function(t){if(t&&"function"==typeof t.preventDefault&&t.currentTarget===e&&t.preventDefault(),"function"==typeof getSelection){var i=getSelection();i&&i.focusNode&&(i.removeAllRanges&&i.removeAllRanges(),i.empty&&i.empty())}};e.addEventListener("wheel",l,{passive:!1}),e.addEventListener("mousemove",u,!1),e.addEventListener("mouseout",c,!1),e.addEventListener("touchstart",d,!1),e.addEventListener("touchend",f,!1),e.addEventListener("touchcancel",f,!1),e.addEventListener("mousedown",p,!1),e.addEventListener("mouseup",f,!1),e.addEventListener("gesturestart",m,{passive:!1}),e.addEventListener("gesturechange",v,{passive:!1}),e.addEventListener("gestureend",y,{passive:!1}),e.addEventListener("touchstart",b,!1),e.addEventListener("contextmenu",b,!1);return Object.assign((function(){n.destroy(),e.removeEventListener("wheel",l,!1),e.removeEventListener("mousemove",u,!1),e.removeEventListener("mouseout",c,!1),e.removeEventListener("touchstart",d,!1),e.removeEventListener("touchend",f,!1),e.removeEventListener("touchcancel",f,!1),e.removeEventListener("mousedown",p,!1),e.removeEventListener("mouseup",f,!1),e.removeEventListener("gesturestart",m,!1),e.removeEventListener("gesturechange",v,!1),e.removeEventListener("gestureend",y,!1),e.removeEventListener("touchstart",b,!1),e.removeEventListener("contextmenu",b,!1)}),{element:e})},t}(He),Os=function(e){function t(i){var n,r,o=this,s=t.parseArgs(i);return(o=e.call(this,s)||this).defaultLongitude=s.defaultLongitude,o.defaultLatitude=s.defaultLatitude,o.defaultFov=s.defaultFov,o.maxFov=s.maxFov,o.minFov=s.minFov,o.maxLatitude=s.maxLatitude,o.minLatitude=s.minLatitude,o.locationMotion=new zr({x:o.camera.pose.offset.x,y:o.camera.pose.offset.y,z:o.camera.pose.offset.z,distance:o.camera.pose.distance,modelAlpha:null!==(r=null===(n=o.model.getMaterial())||void 0===n?void 0:n.modelAlpha)&&void 0!==r?r:0,perspToOrtho:o.camera.perspToOrtho.x,orthoDistance:o.camera.orthoDistance}),o.currentTapPanoIndex=-1,o.intersectMeshCreator=s.intersectMeshCreator,o.intersectMesh=o.intersectMeshCreator(),o.scene.add(o.intersectMesh),o}return ke(t,e),t.distanceFromModel=function(e,t,i){var n=e.bounding,r=Math.pow(Math.pow(n.max.x-n.min.x+1,2)+Math.pow(n.max.y-n.min.y+1,2)+Math.pow(n.max.z-n.min.z+1,2),.5),o=r/2/Math.tan(Math.PI*t/360);return i<1&&(o/=i),isNaN(o)?r:o},t.parseArgs=function(t){var i,n,r,o,s,a,l,u,c=e.parseArgs.call(this,t);return Oe(Oe({},c),{defaultLongitude:null!==(i=t.defaultLongitude)&&void 0!==i?i:Math.PI/4,defaultLatitude:null!==(n=t.defaultLatitude)&&void 0!==n?n:Math.PI/4,defaultFov:null!==(r=t.defaultFov)&&void 0!==r?r:80,maxFov:null!==(o=t.maxFov)&&void 0!==o?o:120,minFov:null!==(s=t.minFov)&&void 0!==s?s:40,maxLatitude:null!==(a=t.maxLatitude)&&void 0!==a?a:+Math.PI/2,minLatitude:null!==(l=t.minLatitude)&&void 0!==l?l:-Math.PI/2,intersectMeshCreator:null!==(u=t.intersectMeshCreator)&&void 0!==u?u:function(){return new ns}})},t.initAnimationEndPose=function(e){var i,r,o,s=this.parseArgs(e),a=e.initial[1];return{longitude:null!==(i=a.longitude)&&void 0!==i?i:s.defaultLongitude,latitude:Mr(null!==(r=a.latitude)&&void 0!==r?r:s.defaultLatitude,s.minLatitude,s.maxLatitude),fov:null!==(o=a.fov)&&void 0!==o?o:s.defaultFov,offset:e.model.bounding.getCenter(new n.Vector3),distance:t.distanceFromModel(s.model,s.defaultFov,s.camera.aspect)}},t.prototype.destroy=function(){e.prototype.destroy.call(this),this.locationMotion.dispose(),this.mouseWheelState&&clearTimeout(this.mouseWheelState.timer),delete this.mouseWheelState,delete this.mouseMoveState,delete this.panState,this.intersectMesh.dispose(),this.scene.remove(this.intersectMesh)},t.prototype.isReady=function(){return!1!==this.locationMotion.ended&&e.prototype.isReady.call(this)},t.prototype.updateWork=function(e,t,i,n,r){return this.work=e,this.updateCamera(i,null!=n?n:0,r),!0},t.prototype.updateModel=function(i){e.prototype.updateModel.call(this,i);var r=i.bounding.getCenter(new n.Vector3),o=t.distanceFromModel(i,this.defaultFov,this.camera.aspect);this.locationMotion.set({x:r.x,y:r.y,z:r.z,distance:o},0).catch(qe)},t.prototype.updateTime=function(e,t){if(!this.destroyed){var i={},r={};this.locationMotion.ended||(this.locationMotion.update(e),i.modelAlpha=this.locationMotion.value.modelAlpha,this.camera.perspToOrtho.setScalar(Mr(this.locationMotion.value.perspToOrtho,0,1)),this.camera.orthoDistance=this.locationMotion.value.orthoDistance,r.distance=this.locationMotion.value.distance,r.offset=new n.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z)),this.cameraMotion.ended||(this.cameraMotion.update(e),r.longitude=this.cameraMotion.value.longitude,r.latitude=this.cameraMotion.value.latitude,r.fov=this.cameraMotion.value.fov),ws(i)||this.model.setMaterial(i),ws(r)||this.setCamera(r)}},t.prototype.getTargetPose=function(){var e=this.cameraMotion.getKeyFrameSegment(ze())[1],t=this.locationMotion.getKeyFrameSegment(ze())[1];return{longitude:e.value.longitude,latitude:e.value.latitude,fov:e.value.fov,offset:new n.Vector3(t.value.x,t.value.y,t.value.z),distance:t.value.distance}},t.prototype.initAnimation=function(e,i,r,o){var s,a,l,u=this;if(!this.destroyed){this.pending=!1,this.userAction=o;var c={longitude:null!==(s=i.longitude)&&void 0!==s?s:this.defaultLongitude,latitude:Mr(null!==(a=i.latitude)&&void 0!==a?a:this.defaultLatitude,this.minLatitude,this.maxLatitude),fov:Mr(null!==(l=i.fov)&&void 0!==l?l:this.defaultFov,this.minFov,this.maxFov),offset:this.model.bounding.getCenter(new n.Vector3),distance:t.distanceFromModel(this.model,this.defaultFov,this.camera.aspect)},h=Tt(c,["longitude","latitude","fov"]),d={x:c.offset.x,y:c.offset.y,z:c.offset.z,distance:c.distance,modelAlpha:1,perspToOrtho:0,orthoDistance:c.distance};this.emit("initAnimationWillStart",e,c,this.userAction),this.cameraMotion.set(h,r).catch(qe),this.locationMotion.set(d,r).then((function(){u.emit("initAnimationEnded",e,c,u.userAction)}),(function(t){var i=Ms(u.camera.pose);u.emit("initAnimationEnded",e,i,u.userAction)})).catch(qe)}},t.prototype.updateRenderSize=function(){this.locationMotion.set({distance:t.distanceFromModel(this.model,this.defaultFov,this.camera.aspect)},0).catch(qe)},t.prototype.getForwardPanoIndexOrNot=function(e){var t=this.work.observers.filter((function(e){return e.active})),i=this.model.intersectRaycaster(e)[0];if(!i)return null;var n=xs(t,(function(e){return e.standingPosition.distanceTo(i.point)}),!0),r=n[0];return n[1]<5?this.work.observers.indexOf(r):null},t.prototype.coordinatesForOffset=function(e){var t=this.renderer.getSize(new n.Vector2);return{longitude:2*e.x/(t.x*this.scissor.width),latitude:2*e.y/(t.y*this.scissor.height)}},t.prototype.requestInteriaMovement=function(e,t){var i=this;if(!1!==this.interiaMovement){for(var n=Oe({},e),r={longitude:0,latitude:0},o=0;o<t;o++)n.longitude*=.996,n.latitude*=.994008,r.longitude+=n.longitude,r.latitude+=n.latitude;var s=ps(this.cameraMotion.value.longitude+r.longitude),a=Mr(this.cameraMotion.value.latitude+r.latitude,this.minLatitude,this.maxLatitude),l={longitude:s,latitude:a,fov:this.cameraMotion.value.fov,offset:this.camera.pose.offset.clone(),distance:this.camera.pose.distance};this.cameraMotion.set({longitude:s,latitude:a},0).catch(qe);var u=n.longitude>1e-4||n.longitude<-1e-4||n.latitude>1e-4||n.latitude<-1e-4;this.emit("interiaPan",l,!u),u?dt.shared.add((function(e,t){i.requestInteriaMovement(n,0|t)}),!0,1):this.interiaMovement=!1}},t.prototype.onPanGesture=function(e){var t=this.panState,i=e.pointers.length;if(e.isFinal?delete this.panState:this.panState={pointerLength:i,x:e.center.x,y:e.center.y},void 0!==t&&t.pointerLength===i){var n=e.pointers.map((function(e){return Tt(e,["x","y"])}));if(!this.emit("wantsGesture","pan",n,e.isFinal)){var r={x:e.center.x-t.x,y:e.center.y-t.y},o=this.relativeClientPosition(e.center),s=this.camera.pose.latitude<Math.PI/6||o.y<0?-1:1;r.x*=s;var a=this.coordinatesForOffset(r),l=ps(this.cameraMotion.value.longitude+a.longitude),u=Mr(this.cameraMotion.value.latitude+a.latitude,this.minLatitude,this.maxLatitude);this.camera.aspect<1&&Math.abs(e.overallVelocityX)>.2&&Math.atan2(Math.abs(e.overallVelocityY),Math.abs(e.overallVelocityX))<Math.PI/6.923&&(u=this.cameraMotion.value.latitude);var c={longitude:l,latitude:u,fov:this.camera.pose.fov,offset:this.camera.pose.offset,distance:this.camera.pose.distance};if(!this.emit("wantsPanGesture",c,e.isFinal))if(this.emit("gesture","pan",n,e.isFinal),this.emit("panGesture",c,e.isFinal),this.userAction=!0,this.interiaMovement=!1,this.hideIntersectMesh(),this.cameraMotion.set({longitude:c.longitude,latitude:c.latitude},0).catch(qe),e.isFinal)if(!this.emit("wantsInteriaPan",c)){this.interiaMovement=!0;var h=e.velocityX*s,d=e.velocityY;this.requestInteriaMovement(this.coordinatesForOffset({x:h,y:d}),0)}}}},t.prototype.onPinchGesture=function(e){var t,i=null===(t=this.pinchState)||void 0===t?void 0:t.fov,n=!1;if("pinchstart"!==e.type){if("pinchend"===e.type&&(n=!0,delete this.panState,delete this.pinchState),void 0!==i){var r=e.pointers.map((function(e){return Tt(e,["x","y"])}));if(!this.emit("wantsGesture","pinch",r,n)){var o=Mr(i/e.scale,this.minFov,this.maxFov);this.emit("wantsPinchGesture",e.scale,o,n)||this.emit("wantsChangeCameraFov",o)||(this.emit("gesture","pinch",r,n),this.emit("pinchGesture",e.scale,o,n),this.userAction=!0,this.interiaMovement=!1,this.cameraMotion.set({fov:o},0).catch(qe),this.onPanGesture(e))}}}else this.pinchState={fov:this.cameraMotion.value.fov}},t.prototype.onMouseMove=function(e){if(this.intersectMesh.parent&&!this.model.empty&&this.model.bvhs&&!0===this.model.bvhs.loaded&&!this.panState){var t=this.relativeClientPosition({x:e.clientX,y:e.clientY}),i=new n.Raycaster;if(i.setFromCamera(t,this.camera),this.emit("wantsShowIntersectionOnModel",i))this.hideIntersectMesh();else{var r=this.model.intersectRaycaster(i)[0];if(r&&r.face){var o=r.face.normal,s=o.clone().multiplyScalar(.05),a=r.point.clone().add(s);this.intersectMesh.position.copy(a);var l=a.clone().add(s);if(this.intersectMesh.lookAt(l),Math.abs(o.y)>.99){var u=this.camera.position.clone().sub(a);this.intersectMesh.rotation.z=-Math.atan2(u.z,u.x)}this.intersectMesh.visible=!0,this.needsRender=!0,this.emit("intersectionOnModelUpdate",r,this.intersectMesh)}else this.hideIntersectMesh();this.mouseMoveState={clientX:e.clientX,clientY:e.clientY}}}},t.prototype.onMouseOut=function(){this.intersectMesh.parent&&!0===this.intersectMesh.visible&&this.hideIntersectMesh()},t.prototype.onMouseWheel=function(e){var t=this,i=(Math.abs(e.deltaY)>Math.abs(e.deltaX)?e.deltaY:e.deltaX)/-60,n=[{x:e.clientX,y:e.clientY,delta:i}];if(!this.emit("wantsGesture","mouseWheel",n,!1)){var r=this.minFov,o=this.maxFov,s=Mr(this.camera.fov-i,r,o);this.emit("wantsMouseWheel",i,s,!1)||this.emit("wantsChangeCameraFov",s)||(this.emit("gesture","mouseWheel",n,!1),this.emit("mouseWheel",i,s,!1),this.userAction=!0,this.interiaMovement=!1,this.cameraMotion.set({fov:s},0).catch(qe),this.mouseWheelState&&clearTimeout(this.mouseWheelState.timer),this.mouseWheelState={timer:window.setTimeout((function(){delete t.mouseWheelState;t.emit("wantsGesture","mouseWheel",n,!0)||t.emit("wantsMouseWheel",i,s,!0)||(t.emit("gesture","mouseWheel",n,!0),t.emit("mouseWheel",0,s,!0))}),200)})}},t.prototype.onTapGesture=function(e){var t=this,i=e.pointers.map((function(e){return Tt(e,["x","y"])}));if(!this.emit("wantsGesture","tap",i,!0)){var r=this.relativeClientPosition(e.center),o=new n.Raycaster;if(o.setFromCamera(r,this.camera),!this.emit("wantsTapGesture",o,r,!0)){this.emit("gesture","tap",i,!0),this.emit("tapGesture",o,r,!0),this.interiaMovement=!1;var s=this.getForwardPanoIndexOrNot(o);if(!vr(s)){this.emit("panoSelected",s);var a={longitude:this.camera.pose.longitude,latitude:0};this.currentTapPanoIndex=s,this.preloadPano(s).then((function(e){t.currentTapPanoIndex===e&&t.emit("wantsMoveToPano",e,a,!0)}))}}}},t.prototype.onPressGesture=function(e,t){var i,r,o=[e];if(this.emit("wantsGesture","press",o,t))return null===(i=this.pressState)||void 0===i||i.stop(),void delete this.pressState;var s=this.relativeClientPosition(e),a=new n.Raycaster;if(a.setFromCamera(s,this.camera),this.emit("wantsPressGesture",a,s,e.delta,t))return null===(r=this.pressState)||void 0===r||r.stop(),void delete this.pressState;this.emit("gesture","press",o,t),this.emit("pressGesture",a,s,e.delta,t)},t.prototype.preloadPano=function(e,t){var i=this;void 0===t&&(t=qe);var n=this.work.observers[e],r=this.work.allowHosts;return Promise.all(["right","left","up","down","front","back"].map((function(t){var o=Oe({key:"pano.".concat(e,".").concat(t),basisLoaderInitialized:ii.isInitialized()},Tt(i.imageOptions,["size","format","quality","mappings"])),s=n.images[t];return lt(i.imageOptions.transform?i.imageOptions.transform(s,o):gt(s,o),{allowHosts:r,requestProxy:i.requestProxy,networkSubscribe:i.networkSubscribe})}))).then((function(){return t(e),e}))},t.prototype.hideIntersectMesh=function(){this.intersectMesh.visible=!1,this.emit("intersectionHidden"),this.needsRender=!0},t}(ks),Fs={longitude:0,latitude:Math.PI/2},Ns={longitude:0,latitude:0},Vs={longitude:Math.PI/2,latitude:0},Qs={longitude:Math.PI,latitude:0},Hs={longitude:1.5*Math.PI,latitude:0};var qs=function(e){function t(i){var n=t.parseArgs(i);return e.call(this,n)||this}return ke(t,e),t.parseArgs=function(t){var i=[t.initial[0],Oe(Oe({},t.initial[1]),{longitude:0,latitude:Math.PI/2}),t.initial[2],t.initial[3]],n=Oe(Oe({},t),{initial:i,maxLatitude:Math.PI/2,minLatitude:Math.PI/2,defaultLongitude:0,defaultLatitude:Math.PI/2});return e.parseArgs.call(this,n)},t.initAnimationEndPose=function(t){var i=this.parseArgs(t);return e.initAnimationEndPose.call(this,i)},t.prototype.updateModel=function(e){this.model=e,this.needsRender=!0;var t=e.bounding.getCenter(new n.Vector3);this.locationMotion.set({x:t.x,y:t.y,z:t.z,distance:Os.distanceFromModel(this.model,this.defaultFov,this.camera.aspect)},0).catch(qe)},t.prototype.initAnimation=function(e,t,i,r){var o,s=this;if(!this.destroyed){this.pending=!1,this.userAction=r;var a={longitude:0,latitude:Math.PI/2,fov:Mr(null!==(o=t.fov)&&void 0!==o?o:this.defaultFov,this.minFov,this.maxFov),offset:this.model.bounding.getCenter(new n.Vector3),distance:Os.distanceFromModel(this.model,this.defaultFov,this.camera.aspect)},l=Tt(a,["longitude","latitude","fov"]),u={x:a.offset.x,y:a.offset.y,z:a.offset.z,distance:a.distance,modelAlpha:1,perspToOrtho:1,orthoDistance:a.distance};this.cameraMotion.set(l,i).catch(qe),this.locationMotion.set(u,i).then((function(){s.emit("initAnimationEnded",e,a,s.userAction)}),(function(t){var i=Ms(s.camera.pose);s.emit("initAnimationEnded",e,i,s.userAction)}))}},t.prototype.getZoomOffsetFromFov=function(e,t,i){var r=this.camera.getWorldDirection(new n.Vector3),o=Math.tan(i/2*Math.PI/180),s=Math.tan(t.fov/2*Math.PI/180),a=(s-o)/s,l=new n.Raycaster;l.setFromCamera(e,t);var u=l.ray.direction,c=u.angleTo(r),h=Os.distanceFromModel(this.model,this.defaultFov,this.camera.aspect),d=h*Math.tan(c),p=u.clone().setLength(h*Math.cos(c)).projectOnPlane(r),f=p.length(),A=a/f*p.x*d,g=a/f*p.z*d,m=a/f*p.y*d;return new n.Vector3(A,m,g)},t.prototype.requestInteriaMovement=function(e,t){},t.prototype.onPanGesture=function(e){var t=this.panState,i=e.pointers.length;if(e.isFinal?delete this.panState:this.panState={pointerLength:i,x:e.center.x,y:e.center.y},void 0!==t&&t.pointerLength===i){var r=e.pointers.map((function(e){return Tt(e,["x","y"])}));if(!this.emit("wantsGesture","pan",r,e.isFinal)){var o=e.center.x-t.x,s=e.center.y-t.y,a=new n.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z),l=this.model.bounding,u=l.getCenter(new n.Vector3),c=(l.max.x-l.min.x)/this.defaultFov*this.cameraMotion.value.fov,h=(l.max.y-l.min.y)/this.defaultFov*this.cameraMotion.value.fov,d=(l.max.z-l.min.z)/this.defaultFov*this.cameraMotion.value.fov,p={left:new n.Vector3,up:new n.Vector3,cameraDirection:"y"};this.cameraMotion.value.longitude===Fs.longitude&&this.cameraMotion.value.latitude===Fs.latitude?(p.left.set(1,0,0),p.up.set(0,0,-1),p.cameraDirection="y"):this.cameraMotion.value.longitude===Ns.longitude&&this.cameraMotion.value.latitude===Ns.latitude?(p.left.set(1,0,0),p.up.set(0,1,0),p.cameraDirection="z"):this.cameraMotion.value.longitude===Qs.longitude&&this.cameraMotion.value.latitude===Qs.latitude?(p.left.set(1,0,0),p.up.set(0,-1,0),p.cameraDirection="z"):this.cameraMotion.value.longitude===Hs.longitude&&this.cameraMotion.value.latitude===Hs.latitude?(p.left.set(0,0,-1),p.up.set(0,-1,0),p.cameraDirection="x"):this.cameraMotion.value.longitude===Vs.longitude&&this.cameraMotion.value.latitude===Vs.latitude&&(p.left.set(0,0,-1),p.up.set(0,1,0),p.cameraDirection="x");var f=(this.camera.position[p.cameraDirection]-l.min[p.cameraDirection])*Math.tan(this.camera.fov/2*Math.PI/180),A=this.renderer.getSize(new n.Vector2);a.add(function(e,t){var i=(new n.Vector3).copy(t);return i.multiplyScalar(-e),i}(2*o*f/A.y,p.left)),a.add(function(e,t){var i=(new n.Vector3).copy(t);return i.multiplyScalar(e),i}(2*s*f/A.y,p.up)),a.x=Mr(a.x,u.x-c,u.x+c),a.y=Mr(a.y,u.y-h,u.y+h),a.z=Mr(a.z,u.z-d,u.z+d);var g={longitude:0,latitude:Math.PI/2,fov:this.cameraMotion.value.fov,offset:a,distance:this.locationMotion.value.distance};this.emit("wantsPanGesture",g,e.isFinal)||(this.emit("gesture","pan",r,e.isFinal),this.emit("panGesture",g,e.isFinal),this.userAction=!0,this.locationMotion.set({x:a.x,y:a.y,z:a.z},0).catch(qe))}}},t.prototype.onPinchGesture=function(e){var t,i=null===(t=this.pinchState)||void 0===t?void 0:t.fov,n=!1;if("pinchstart"!==e.type){if("pinchend"===e.type&&(n=!0,delete this.pinchState),void 0!==i){var r=e.pointers.map((function(e){return Tt(e,["x","y"])}));if(!this.emit("wantsGesture","pinch",r,n)){var o=Mr(i/e.scale,this.minFov,this.maxFov),s=this.relativeClientPosition({x:e.center.x,y:e.center.y}),a=this.getZoomOffsetFromFov(s,this.camera,o);this.cameraMotion.value.longitude===Fs.longitude&&this.cameraMotion.value.latitude===Fs.latitude?a.y=0:this.cameraMotion.value.longitude===Ns.longitude&&this.cameraMotion.value.latitude===Ns.latitude||this.cameraMotion.value.longitude===Qs.longitude&&this.cameraMotion.value.latitude===Qs.latitude?a.z=0:(this.cameraMotion.value.longitude===Hs.longitude&&this.cameraMotion.value.latitude===Hs.latitude||this.cameraMotion.value.longitude===Vs.longitude&&this.cameraMotion.value.latitude===Vs.latitude)&&(a.x=0);var l=this.camera.pose.offset.clone().add(a);this.emit("wantsPinchGesture",e.scale,o,n)||this.emit("wantsChangeCameraFov",o)||(this.emit("gesture","pinch",r,n),this.emit("pinchGesture",e.scale,o,n),this.userAction=!0,this.locationMotion.set({x:l.x,y:l.y,z:l.z},0).catch(qe),this.cameraMotion.set({longitude:this.cameraMotion.value.longitude,latitude:this.cameraMotion.value.latitude,fov:o},0).catch(qe),this.onPanGesture(e))}}}else this.pinchState={fov:this.cameraMotion.value.fov}},t.prototype.onMouseWheel=function(e){var t=this,i=(Math.abs(e.deltaY)>Math.abs(e.deltaX)?e.deltaY:e.deltaX)/-60,n=[{x:e.clientX,y:e.clientY,delta:i}];if(!this.emit("wantsGesture","mouseWheel",n,!1)){var r=Mr(this.cameraMotion.value.fov-i,this.minFov,this.maxFov),o=this.relativeClientPosition({x:e.clientX,y:e.clientY}),s=this.getZoomOffsetFromFov(o,this.camera,r);this.cameraMotion.value.longitude===Fs.longitude&&this.cameraMotion.value.latitude===Fs.latitude?s.y=0:this.cameraMotion.value.longitude===Ns.longitude&&this.cameraMotion.value.latitude===Ns.latitude||this.cameraMotion.value.longitude===Qs.longitude&&this.cameraMotion.value.latitude===Qs.latitude?s.z=0:(this.cameraMotion.value.longitude===Hs.longitude&&this.cameraMotion.value.latitude===Hs.latitude||this.cameraMotion.value.longitude===Vs.longitude&&this.cameraMotion.value.latitude===Vs.latitude)&&(s.x=0);var a=this.camera.pose.offset.clone().add(s);this.emit("wantsMouseWheel",i,r,!1)||this.emit("wantsChangeCameraFov",r)||(this.emit("gesture","mouseWheel",n,!1),this.emit("mouseWheel",i,r,!1),this.userAction=!0,this.locationMotion.set({x:a.x,y:a.y,z:a.z},0).catch(qe),this.cameraMotion.set({longitude:this.cameraMotion.value.longitude,latitude:this.cameraMotion.value.latitude,fov:r},0).catch(qe),this.mouseWheelState&&clearTimeout(this.mouseWheelState.timer),this.mouseWheelState={timer:window.setTimeout((function(){delete t.mouseWheelState;t.emit("wantsGesture","mouseWheel",n,!0)||t.emit("wantsMouseWheel",i,r,!0)||t.emit("wantsChangeCameraFov",r)||(t.emit("gesture","mouseWheel",n,!0),t.emit("mouseWheel",0,r,!0))}),200)})}},t}(Os);function Us(e,t){void 0===t&&(t=!1);var i=typeof e;if("string"===i)return JSON.stringify(e);if(!0===e)return"true";if(!1===e)return"false";if(null===e)return"null";if(e instanceof Array){for(var n="[",r=e.length-1,o=0;o<r;o++)n+=Us(e[o],!1)+",";return r>-1&&(n+=Us(e[o],!1)),n+"]"}if(e instanceof Object){if("function"==typeof e.toJSON)return Us(e.toJSON(),t);var s=Object.keys(e).sort(),a=s.length;for(n="",o=0;o<a;){var l=s[o],u=Us(e[l],!0);void 0!==u&&(o&&""!==n&&(n+=","),n+=JSON.stringify(l)+":"+u),o++}return"{"+n+"}"}switch(i){case"function":return JSON.stringify(e.toString());case"undefined":return t?void 0:null;case"number":return e;default:return isFinite(e)?e:null}}function zs(e){return Be(String(Us(e,!1)))}var js,Ks=function(e){function t(i){var n=this,r=t.parseArgs(i);return(n=e.call(this,r)||this).defaultLongitude=r.defaultLongitude,n.defaultLatitude=r.defaultLongitude,n.defaultFov=r.defaultFov,n.maxFov=r.maxFov,n.minFov=r.minFov,n.maxLatitude=r.maxLatitude,n.minLatitude=r.minLatitude,n.moveSpeed=r.moveSpeed,n.intersectMeshCreator=r.intersectMeshCreator,n.interiaMovement=!1,n.intersectMesh=n.intersectMeshCreator(),n.intersectMesh.name="intersect",n.intersectMesh.visible=!1,n.helper.add(n.intersectMesh),n}return ke(t,e),t.parseArgs=function(t){var i,n,r,o,s,a,l,u,c,h=e.parseArgs.call(this,t);return Oe(Oe({},h),{defaultLongitude:null!==(i=t.defaultLongitude)&&void 0!==i?i:0,defaultLatitude:null!==(n=t.defaultLatitude)&&void 0!==n?n:0,defaultFov:null!==(r=t.defaultFov)&&void 0!==r?r:90,maxFov:null!==(o=t.maxFov)&&void 0!==o?o:120,minFov:null!==(s=t.minFov)&&void 0!==s?s:40,maxLatitude:null!==(a=t.maxLatitude)&&void 0!==a?a:+Math.PI/2,minLatitude:null!==(l=t.minLatitude)&&void 0!==l?l:-Math.PI/2,moveSpeed:null!==(u=t.moveSpeed)&&void 0!==u?u:3.2,intersectMeshCreator:null!==(c=t.intersectMeshCreator)&&void 0!==c?c:function(){return new ns}})},t.initAnimationEndPose=function(e){var t,i,n,r=this.parseArgs(e),o=e.initial,s=o[0],a=o[1];return{longitude:null!==(t=a.longitude)&&void 0!==t?t:r.defaultLongitude,latitude:Mr(null!==(i=a.latitude)&&void 0!==i?i:r.defaultLatitude,r.minLatitude,r.maxLatitude),fov:Mr(null!==(n=a.fov)&&void 0!==n?n:r.defaultFov,r.minFov,r.maxFov),offset:r.work.observers[s].position.clone(),distance:0}},t.prototype.destroy=function(){e.prototype.destroy.call(this),this.interiaMovement=!1,this.intersectMesh&&(this.helper.remove(this.intersectMesh),this.intersectMesh.dispose()),this.mouseWheelState&&clearTimeout(this.mouseWheelState.timer),delete this.mouseWheelState,delete this.mouseMoveState,delete this.panState},t.prototype.isReady=function(){return!this.interiaMovement&&(!this.panState&&(!this.pinchState&&(!this.mouseWheelState&&e.prototype.isReady.call(this))))},t.prototype.calculateMovingDuration=function(e,t){switch(typeof e){case"function":return e(t,this.moveSpeed);case"number":return e;case"string":return Number(e);default:return Mr(t,2,5)/this.moveSpeed*1e3}},t.prototype.hideIntersectMesh=function(){this.intersectMesh.visible=!1,this.emit("intersectionHidden"),this.needsRender=!0},t.prototype.coordinatesForOffset=function(e){var t=this.cameraMotion.value.fov,i=this.camera.aspect,r=this.renderer.getSize(new n.Vector2);return{longitude:2*e.x/(r.x*this.scissor.width)*t/95*i,latitude:-2*e.y/(r.y*this.scissor.height)*t/95}},t.prototype.cameraBounce=function(){var e=this.cameraMotion.value,t=e.longitude,i=e.latitude,n=e.fov,r=[{progress:0,value:{longitude:t,latitude:i,fov:n}},{progress:.5,value:{longitude:t,latitude:i,fov:.98*n}},{progress:1,value:{longitude:t,latitude:i,fov:n}}];this.cameraMotion.setKeyframes(r,500).catch(qe)},t.prototype.requestInteriaMovement=function(e,t){var i=this;if(!1!==this.interiaMovement){for(var n=Oe({},e),r={longitude:0,latitude:0},o=0;o<t;o++)n.longitude*=.996,n.latitude*=.98604,r.longitude+=n.longitude,r.latitude+=n.latitude;var s=ps(this.cameraMotion.value.longitude+r.longitude),a=Mr(this.cameraMotion.value.latitude+r.latitude,this.minLatitude,this.maxLatitude),l={longitude:s,latitude:a,fov:this.cameraMotion.value.fov,offset:this.camera.pose.offset.clone(),distance:this.camera.pose.distance};this.cameraMotion.set({longitude:s,latitude:a},0).catch(qe);var u=n.longitude>1e-4||n.longitude<-1e-4||n.latitude>1e-4||n.latitude<-1e-4;this.emit("interiaPan",l,!u),u?dt.shared.add((function(e,t){i.requestInteriaMovement(n,0|t)}),!0,1):this.interiaMovement=!1}},t.prototype.onPanGesture=function(e){var t=this.panState,i=e.pointers.length;if(e.isFinal?delete this.panState:this.panState={pointerLength:i,x:e.center.x,y:e.center.y},void 0!==t&&t.pointerLength===i){var n=e.pointers.map((function(e){return Tt(e,["x","y"])}));if(!this.emit("wantsGesture","pan",n,e.isFinal)){var r={x:e.center.x-t.x,y:e.center.y-t.y},o=this.coordinatesForOffset(r),s=ps(this.cameraMotion.value.longitude+o.longitude),a=Mr(this.cameraMotion.value.latitude+o.latitude,this.minLatitude,this.maxLatitude);this.camera.aspect<1&&Math.abs(e.overallVelocityX)>.2&&Math.atan2(Math.abs(e.overallVelocityY),Math.abs(e.overallVelocityX))<Math.PI/6.923&&(a=this.cameraMotion.value.latitude);var l={longitude:s,latitude:a,fov:this.cameraMotion.value.fov,offset:this.camera.pose.offset.clone(),distance:this.camera.pose.distance};if(!this.emit("wantsPanGesture",l,e.isFinal)){this.emit("gesture","pan",n,e.isFinal),this.emit("panGesture",l,e.isFinal),this.userAction=!0,this.interiaMovement=!1,this.hideIntersectMesh();var u={longitude:l.longitude,latitude:l.latitude,fov:l.fov};if(this.cameraMotion.set(u,0).catch(qe),e.isFinal)if(!this.emit("wantsInteriaPan",l)){this.interiaMovement=!0;var c=e.velocityX,h=.6*e.velocityY;Math.abs(h)>.5&&Math.abs(c)<.5&&(c=0),this.requestInteriaMovement(this.coordinatesForOffset({x:c,y:h}),0)}}}}},t.prototype.onPinchGesture=function(e){var t,i=null===(t=this.pinchState)||void 0===t?void 0:t.fov,n=e.scale,r=!1;if("pinchstart"!==e.type){if("pinchend"===e.type&&(r=!0,delete this.pinchState),void 0!==i){var o=e.pointers.map((function(e){return Tt(e,["x","y"])}));if(!this.emit("wantsGesture","pinch",o,r)){var s=Mr(i/n,this.minFov,this.maxFov);this.emit("wantsPinchGesture",n,s,r)||this.emit("wantsChangeCameraFov",s)||(this.emit("gesture","pinch",o,r),this.emit("pinchGesture",n,s,r),this.userAction=!0,this.interiaMovement=!1,this.cameraMotion.set({fov:s},0).catch(qe),this.onPanGesture(e))}}}else this.pinchState={fov:this.cameraMotion.value.fov}},t.prototype.onMouseWheel=function(e){var t=this,i=(Math.abs(e.deltaY)>Math.abs(e.deltaX)?e.deltaY:e.deltaX)/-60,n=[{x:e.clientX,y:e.clientY,delta:i}];if(!this.emit("wantsGesture","mouseWheel",n,!1)){var r=Mr(this.cameraMotion.value.fov-i,this.minFov,this.maxFov);this.emit("wantsMouseWheel",i,r,!1)||this.emit("wantsChangeCameraFov",r)||(this.emit("gesture","mouseWheel",n,!1),this.emit("mouseWheel",i,r,!1),this.userAction=!0,this.interiaMovement=!1,this.cameraMotion.set({fov:r},0).catch(qe),this.mouseWheelState&&clearTimeout(this.mouseWheelState.timer),this.mouseWheelState={timer:window.setTimeout((function(){delete t.mouseWheelState;t.emit("wantsGesture","mouseWheel",n,!0)||t.emit("wantsMouseWheel",i,r,!0)||t.emit("wantsChangeCameraFov",r)||(t.emit("gesture","mouseWheel",n,!0),t.emit("mouseWheel",0,r,!0))}),200)})}},t.prototype.onMouseMove=function(e){if(this.intersectMesh.parent&&!this.model.empty&&this.model.bvhs&&!0===this.model.bvhs.loaded&&!this.panState){var t=this.relativeClientPosition({x:e.clientX,y:e.clientY}),i=new n.Raycaster;if(i.setFromCamera(t,this.camera),this.emit("wantsShowIntersectionOnModel",i))this.hideIntersectMesh();else{var r=this.model.intersectRaycaster(i)[0];if(r&&r.face){var o=r.face.normal,s=o.clone().multiplyScalar(.05),a=r.point.clone().add(s);this.intersectMesh.position.copy(a);var l=a.clone().add(s);if(this.intersectMesh.lookAt(l),Math.abs(o.y)>.99){var u=this.camera.position.clone().sub(a);this.intersectMesh.rotation.z=-Math.atan2(u.z,u.x)}this.intersectMesh.visible=!0,this.needsRender=!0,this.emit("intersectionOnModelUpdate",r,this.intersectMesh)}else this.hideIntersectMesh();this.mouseMoveState={clientX:e.clientX,clientY:e.clientY}}}},t.prototype.onMouseOut=function(){this.intersectMesh.parent&&!0===this.intersectMesh.visible&&this.hideIntersectMesh()},t.prototype.onPressGesture=function(e,t){var i,r,o=[e];if(this.emit("wantsGesture","press",o,t))return null===(i=this.pressState)||void 0===i||i.stop(),void delete this.pressState;var s=this.relativeClientPosition(e),a=new n.Raycaster;if(a.setFromCamera(s,this.camera),this.emit("wantsPressGesture",a,s,e.delta,t))return null===(r=this.pressState)||void 0===r||r.stop(),void delete this.pressState;this.emit("gesture","press",o,t),this.emit("pressGesture",a,s,e.delta,t)},t}(ks);function Gs(){return js||(js=new Promise((function(e){var t,i=document.createElement("video");i.muted=!0,i.src="data:video/mp4;base64,AAAAHGZ0eXBNNFYgAAACAGlzb21pc28yYXZjMQAAAAhmcmVlAAAGF21kYXTeBAAAbGliZmFhYyAxLjI4AABCAJMgBDIARwAAArEGBf//rdxF6b3m2Ui3lizYINkj7u94MjY0IC0gY29yZSAxNDIgcjIgOTU2YzhkOCAtIEguMjY0L01QRUctNCBBVkMgY29kZWMgLSBDb3B5bGVmdCAyMDAzLTIwMTQgLSBodHRwOi8vd3d3LnZpZGVvbGFuLm9yZy94MjY0Lmh0bWwgLSBvcHRpb25zOiBjYWJhYz0wIHJlZj0zIGRlYmxvY2s9MTowOjAgYW5hbHlzZT0weDE6MHgxMTEgbWU9aGV4IHN1Ym1lPTcgcHN5PTEgcHN5X3JkPTEuMDA6MC4wMCBtaXhlZF9yZWY9MSBtZV9yYW5nZT0xNiBjaHJvbWFfbWU9MSB0cmVsbGlzPTEgOHg4ZGN0PTAgY3FtPTAgZGVhZHpvbmU9MjEsMTEgZmFzdF9wc2tpcD0xIGNocm9tYV9xcF9vZmZzZXQ9LTIgdGhyZWFkcz02IGxvb2thaGVhZF90aHJlYWRzPTEgc2xpY2VkX3RocmVhZHM9MCBucj0wIGRlY2ltYXRlPTEgaW50ZXJsYWNlZD0wIGJsdXJheV9jb21wYXQ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MuMTAw",i.addEventListener("timeupdate",(function n(){i.removeEventListener("timeupdate",n,!1),clearTimeout(t);var r=document.createElement("canvas");r.width=r.height=1;var o=r.getContext("2d");o?(o.drawImage(i,0,0,1,1),o.getImageData(0,0,1,1).data[3]>10?e(!0):e(!1)):e(!1)}),!1),i.addEventListener("canplay",(function e(){i.removeEventListener("canplay",e,!1),i.play()}),!1),t=window.setTimeout((function(){return e(!1)}),1e3)})))}var _s,Ws=function(e){function t(t,i){return void 0===i&&(i=.5),e.call(this,t,{uniforms:{inputBuffer:new n.Uniform(null),scale:new n.Uniform(i)},fragment:"\n#include <common>\nuniform sampler2D inputBuffer;\nuniform float scale;\nvarying vec2 vUv;\n\nvoid main() {\n float u = (vUv.x - 0.5) * scale + 0.5;\n float v = (vUv.y - 0.5) * scale + 0.5;\n vec3 rgb = texture2D(inputBuffer, vec2(u, v)).rgb;\n float luminance = clamp(linearToRelativeLuminance(rgb), 0.1, 0.9);\n gl_FragColor = vec4(luminance);\n}\n"})||this}return ke(t,e),t}(Ps),Xs=function(e){function t(t,i){void 0===i&&(i=.002);var r=e.call(this,t,{uniforms:{targetBuffer:new n.Uniform(null),inputBuffer:new n.Uniform(null),step:new n.Uniform(i)},fragment:"\n uniform sampler2D targetBuffer;\n uniform sampler2D inputBuffer;\n uniform float step;\n varying vec2 vUv;\n void main() {\n\n #ifdef GL_EXT_shader_texture_lod\n #if __VERSION__ < 300\n float target = texture2DLodEXT(targetBuffer, vUv, 5.0).r;\n #else\n float target = textureLod(targetBuffer, vUv, 5.0).r;\n #endif\n #else\n float target = texture2D(targetBuffer, vUv).r;\n #endif\n float current = texture2D(inputBuffer, vUv).r;\n\n float result;\n if (abs(target - current) < step) {\n result = target;\n } else if (target - current > 0.0) {\n result = current + step;\n } else {\n result = current - step;\n }\n gl_FragColor = vec4(result, result, result, 1.0);\n }\n "})||this;return r.material.extensions.shaderTextureLOD=!0,r}return ke(t,e),Object.defineProperty(t.prototype,"targetBuffer",{get:function(){return this.material.uniforms.targetBuffer.value},set:function(e){this.material.uniforms.targetBuffer.value=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"step",{get:function(){return this.material.uniforms.step.value},set:function(e){this.material.uniforms.step.value=e},enumerable:!1,configurable:!0}),t}(Ps),Ys=function(e){function t(t){var i=e.call(this,t,{uniforms:{inputBuffer:new n.Uniform(null),luminanceAdaptiveBuffer:new n.Uniform(null),progress:new n.Uniform(0)},fragment:"\n #include <common>\n uniform sampler2D inputBuffer;\n uniform sampler2D luminanceAdaptiveBuffer;\n uniform float progress;\n varying vec2 vUv;\n\n void main() {\n float middleGrey = 1.5;\n float whitePoint = 13.0;\n float exposure = 1.4;\n vec4 inputColor = texture2D(inputBuffer, vUv);\n vec3 rgb = inputColor.rgb * exposure;\n float alpha = inputColor.a;\n float luminance = linearToRelativeLuminance(rgb);\n float lumAvg = texture2D(luminanceAdaptiveBuffer, vec2(0.5)).r;\n float lumScaled = (luminance * middleGrey) / max(lumAvg, 1e-6);\n float lumCompressed = lumScaled * (1.0 + lumScaled / (whitePoint * whitePoint));\n lumCompressed /= (1.0 + lumScaled);\n rgb = clamp(lumCompressed * rgb, 0.0, 1.0);\n gl_FragColor = mix(inputColor, vec4(rgb, alpha), progress * 0.9);\n }\n "})||this;return i.material.transparent=!0,i}return ke(t,e),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}(Ps),Zs=function(e){function t(t){var i=e.call(this,t)||this;return i.enableTime=ze(),i.renderer=t,i.valuePass=new Rs(i.renderer),i.luminancePass=new Ws(i.renderer,Math.sqrt(1/3)),i.nextStepPass=new Xs(i.renderer,.01),i.luminanceAdaptivePass=new Ys(i.renderer),i}return ke(t,e),t.prototype.render=function(e,t){if(!this.enable)return this.enableTime=null,void this.copyPass.render(e,t);null===this.enableTime&&(this.enableTime=ze()),this.luminanceTargetBuffer||(this.luminanceTargetBuffer=new n.WebGLRenderTarget(128,128,{minFilter:n.LinearMipmapLinearFilter,magFilter:n.LinearFilter,encoding:this.renderer.outputEncoding,stencilBuffer:!1,depthBuffer:!1,format:n.RGBAFormat,generateMipmaps:!0}),this.nextStepPass.targetBuffer=this.luminanceTargetBuffer.texture),this.luminancePass.render(e,this.luminanceTargetBuffer),this.luminancePrevBuffer||(this.luminancePrevBuffer=new n.WebGLRenderTarget(1,1,{minFilter:n.NearestFilter,magFilter:n.NearestFilter,type:n.HalfFloatType,encoding:this.renderer.outputEncoding,stencilBuffer:!1,depthBuffer:!1}),this.valuePass.render(new n.Vector3(.5,.5,.5),this.luminancePrevBuffer)),this.luminanceNextBuffer||(this.luminanceNextBuffer=new n.WebGLRenderTarget(1,1,{minFilter:n.NearestFilter,magFilter:n.NearestFilter,type:n.HalfFloatType,encoding:this.renderer.outputEncoding,stencilBuffer:!1,depthBuffer:!1}),this.valuePass.render(new n.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((ze()-this.enableTime)/100,1),this.luminanceAdaptivePass.render(e,t)},t.prototype.dispose=function(){var e,t,i;null===(e=this.luminanceTargetBuffer)||void 0===e||e.dispose(),null===(t=this.luminancePrevBuffer)||void 0===t||t.dispose(),null===(i=this.luminanceNextBuffer)||void 0===i||i.dispose(),this.copyPass.dispose(),this.luminancePass.dispose(),this.nextStepPass.dispose(),this.luminanceAdaptivePass.dispose()},t}(Ls),Js=null!==(_s=Math.SQRT1_2)&&void 0!==_s?_s:Math.sqrt(2),$s={up:new n.Quaternion(Js,0,0,Js),down:new n.Quaternion(-Js,0,0,Js),left:new n.Quaternion(0,Js,0,Js),right:new n.Quaternion(0,-Js,0,Js),front:new n.Quaternion(0,0,0,1),back:new n.Quaternion(0,1,0,0)},ea=new Float32Array([-.5,-.5,0,.5,-.5,0,-.5,.5,0,.5,.5,0]),ta=new Float32Array([0,0,1,0,0,1,1,1]),ia=new Uint8Array([0,1,2,1,3,2]),na=new n.BufferGeometry;na.setAttribute("position",new n.BufferAttribute(ea,3)),na.setAttribute("uv",new n.BufferAttribute(ta,2)),na.setIndex(new n.BufferAttribute(ia,1));var ra=function(e){function t(){var t=e.call(this,{uniforms:{map:{value:null},luminanceMap:{value:null}},vertexShader:"\nvarying vec2 vUv;\nvoid main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}\n",fragmentShader:"\n#if defined(USE_LUMINANCE)\nuniform sampler2D luminanceMap;\n#endif\nuniform sampler2D map;\nvarying vec2 vUv;\n\nvoid main() {\n gl_FragColor = texture2D(map, vUv);\n #if defined(USE_LUMINANCE)\n gl_FragColor.a = 1.0 - texture2D(luminanceMap, vUv).r;\n #endif\n}\n"})||this;return t.depthTest=!1,t.depthWrite=!1,t.blending=n.NoBlending,t.map=t.uniforms.map.value,t.luminanceMap=t.uniforms.luminanceMap.value,Object.defineProperties(t,{map:{get:function(){return this.uniforms.map.value},set:function(e){this.uniforms.map.value=e}},luminanceMap:{get:function(){return this.uniforms.luminanceMap.value},set:function(e){this.uniforms.luminanceMap.value=e,this.defines.USE_LUMINANCE=null!==e,this.needsUpdate=!0}}}),t}return ke(t,e),t}(n.ShaderMaterial),oa=function(e){function t(t,i){var r=e.call(this,na,new ra)||this;return t.box.getCenter(r.position),r.quaternion.multiplyQuaternions((new n.Quaternion).setFromAxisAngle(new n.Vector3(0,1,0),-Math.PI),$s[t.face]),r.scale.setScalar(t.size),r.node=t,r.name="tiling:tile",r.material.visible=!1,r.activeTime=-1,r.disposed=!1,r.needsRender=!1,r.frustumCulled=!1,i.then((function(e){var t=e[0],i=e[1];r.disposed?(t.dispose(),null==i||i.dispose()):(r.material.map=t,r.material.luminanceMap=i,r.material.needsUpdate=!0,r.material.visible=!0,r.needsRender=!0)})).catch(qe),r}return ke(t,e),t.prototype.updateTime=function(e){},t.prototype.dispose=function(){var e;this.disposed=!0,this.material.map&&(this.material.map.dispose(),null===(e=this.material.luminanceMap)||void 0===e||e.dispose()),this.material.dispose()},t}(n.Mesh),sa=function(e){function t(){var t=e.call(this)||this;return t.needsRender=!1,t.name="tiling",t}return ke(t,e),t}(n.Group),aa=function(){function e(e,t,i){this.disposed=!1,this.textureLoader=new oi(e),this.minLevel=t,this.level=0,this.panoIndex=0,this.pedding=0,this.tileTree=It(this.minLevel),this.tileMeshes=new Map,this.resource=[],this.luminance=null,this.imageOptions=i,this.object=new sa,this.object.renderOrder=-2}return e.prototype.setAllowHosts=function(e){this.textureLoader.setAllowHosts(e)},e.prototype.setRequestProxy=function(e){this.textureLoader.setRequestProxy(e)},e.prototype.setNetworkSubscribe=function(e){this.textureLoader.setNetworkSubscribe(e)},e.prototype.cleanup=function(){var e=this;this.tileMeshes.forEach((function(t){t.dispose(),e.object.remove(t),e.object.needsRender=!0})),this.tileMeshes.clear()},e.prototype.setRotation=function(e){this.disposed||this.object.quaternion.equals(e)||(this.object.quaternion.copy(e),this.object.needsRender=!0)},e.prototype.setPosition=function(e){this.disposed||this.object.position.equals(e)||(this.object.position.copy(e),this.object.needsRender=!0)},e.prototype.setResource=function(e,t){var i,n;if(!this.disposed&&(this.resource!==e||this.luminance!==t)){this.cleanup(),this.resource=e;var r=null!==(n=null===(i=e.slice().sort((function(e,t){return t.level-e.level}))[0])||void 0===i?void 0:i.level)&&void 0!==n?n:0;this.tileTree=It(r),this.luminance=t,this.object.needsRender=!0}},e.prototype.update=function(e,t,i){var r=this;if(!this.disposed){this.level=t;var o=e.planes[5].normal,s=[];t>=this.minLevel&&Bt(this.tileTree,(function(i){if(!(i.level<r.minLevel))return!(i.level>t)&&(!!e.intersectsBox(i.box)&&void s.push(i))}));var a=new n.Vector3;s.sort((function(e,t){return e.level!==t.level?e.level-t.level:e.box.getCenter(a).angleTo(o)-t.box.getCenter(a).angleTo(o)}));for(var l=new Set,u=function(e){var t=c.resource.filter((function(t){return t.level===e.level}))[0];if(!t)return"continue";if(l.add(e),c.tileMeshes.has(e))return c.tileMeshes.get(e).activeTime=i,"continue";var n=t.size,o=c.imageOptions.transform,s=Math.pow(2,e.level)*e.position.y,a=Math.pow(2,e.level)*e.position.x,u="".concat(c.panoIndex,".").concat(e.face,".").concat(e.level,".").concat(s,".").concat(a),h=Oe(Oe({key:"pano_tile.".concat(u),basisLoaderInitialized:ii.isInitialized()},Tt(c.imageOptions,["format","size","quality","sharpen","mappings"])),{size:n*e.size==512?void 0:512,cut:[n*e.position.x,n*e.position.y,n*e.size,n*e.size]}),d=c.textureLoader.loadTexture(t[e.face],{imageURL:{transform:o,options:h},preInit:!0}).then((function(e){return e.body})),p=null;if(c.luminance){var f=c.luminance[e.face],A=f.match(/\/cube_(\d+)\//),g=!!A&&Number(A[1]);if(!1!==g){var m=Oe(Oe({},h),{size:g*e.size==256?void 0:256,cut:[g*e.position.x,g*e.position.y,g*e.size,g*e.size],key:"pano_tile_luminance.".concat(u)});p=c.textureLoader.loadTexture(f,{imageURL:{transform:c.imageOptions.transform,options:m},preInit:!0}).then((function(e){return e.body})).catch((function(){return null}))}}c.pedding++;var v=Promise.all([d,p]).then((function(e){return r.pedding--,e}),(function(e){return r.pedding--,Promise.reject(e)})),y=new oa(e,v);y.name="tiling:tile-".concat(u),y.activeTime=i,y.renderOrder=e.level,c.tileMeshes.set(e,y),c.object.needsRender=!0,c.object.add(y)},c=this,h=0,d=s;h<d.length;h++){u(m=d[h])}var p=[];this.tileMeshes.forEach((function(e,t){l.has(t)||p.push(t)}));for(var f=p.sort((function(e,t){var i,n,o,s;return(null!==(n=null===(i=r.tileMeshes.get(t))||void 0===i?void 0:i.activeTime)&&void 0!==n?n:0)-(null!==(s=null===(o=r.tileMeshes.get(e))||void 0===o?void 0:o.activeTime)&&void 0!==s?s:0)})).slice(Math.max(0,32-l.size)),A=0,g=f;A<g.length;A++){var m=g[A],v=this.tileMeshes.get(m);v&&(v.dispose(),this.object.remove(v),this.object.needsRender=!0),this.tileMeshes.delete(m)}}},e.prototype.dispose=function(){this.cleanup(),this.resource=[],this.disposed=!0},e}(),la=new Float32Array([-1,1,1,-1,1,-1,-1,-1,1,-1,-1,-1,1,1,-1,1,1,1,1,-1,-1,1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,-1,1,-1,-1,1,1,-1,-1,-1,-1,-1,1,1,1,-1,1,1,1,-1,1,-1,-1,1,-1,1,-1,1,1,-1,-1,-1,-1,1,-1,-1]),ua=new Uint8Array([0,2,1,2,3,1,4,6,5,6,7,5,8,10,9,10,11,9,12,14,13,14,15,13,16,18,17,18,19,17,20,22,21,22,23,21]),ca=new n.BufferGeometry;ca.setAttribute("position",new n.BufferAttribute(la,3)),ca.setIndex(new n.BufferAttribute(ua,1));var ha=function(){function e(){this.material=new n.ShaderMaterial({vertexShader:"\n#if defined(USE_PANO_VIDEO)\nvarying vec3 worldPosition;\n#endif\nvoid main() {\n vec4 transformed = vec4(position, 1.0);\n #if defined(USE_PANO_VIDEO)\n worldPosition = (modelMatrix * transformed).xyz;\n #endif\n gl_Position = projectionMatrix * modelViewMatrix * transformed;\n}\n",fragmentShader:"\nuniform vec2 size;\nuniform mat4 matrix;\nuniform float alpha;\nuniform sampler2D map;\n#if defined(USE_PANO_VIDEO)\nvarying vec3 worldPosition;\n#endif\n#include <common>\nvoid main() {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);\n #if defined(USE_PANO_VIDEO)\n vec3 cameraToVertex = worldPosition - cameraPosition;\n vec4 mapCoods = vec4(cameraToVertex, 1.0) * matrix;\n vec2 uv = vec2(\n 0.5 + mapCoods.x / mapCoods.z / size.x,\n 0.5 - mapCoods.y / mapCoods.z / size.y\n );\n vec4 videoColor = texture2D(map, uv);\n float match = (1.0 - step(0.0, mapCoods.z)) * (1.0 - step(0.5, abs(uv.x - 0.5))) * (1.0 - step(0.5, abs(uv.y - 0.5)));\n float blendAlpha = clamp(0.0, 1.0, 5.0 * (1.0 - clamp(distance(uv, vec2(0.5, 0.5)) / 0.55 , 0.0, 1.0)));\n gl_FragColor = vec4(videoColor.rgb, match * blendAlpha * alpha);\n #endif\n}\n",uniforms:{size:new n.Uniform(null),matrix:new n.Uniform(null),alpha:new n.Uniform(null),map:new n.Uniform(null)},depthTest:!1,depthWrite:!1,defines:{USE_PANO_VIDEO:!1},blending:n.CustomBlending,blendSrc:n.SrcAlphaFactor,blendDst:n.OneMinusSrcAlphaFactor,blendSrcAlpha:n.OneFactor,blendDstAlpha:n.OneMinusSrcAlphaFactor}),this.object=new n.Mesh(ca,this.material),this.object.visible=!1,this.object.renderOrder=-1,this.object.frustumCulled=!1,this.alphaMotion=new zr({alpha:0})}return e.prototype.setMaterial=function(e){e?(this.material.uniforms.size.value=e.size,this.material.uniforms.matrix.value=e.matrix,this.material.uniforms.map.value=e.map,this.alphaMotion.set({alpha:e.alpha},500).catch(qe),this.material.uniforms.alpha.value=e.alpha):(this.material.uniforms.size.value=null,this.material.uniforms.matrix.value=null,this.material.uniforms.map.value=null,this.alphaMotion.set({alpha:0},0).catch(qe));var t=null!==e;t!==this.material.defines.USE_PANO_VIDEO&&(this.material.defines.USE_PANO_VIDEO=t,this.material.needsUpdate=!0,this.object.visible=null!==e)},e.prototype.updateTime=function(e){this.alphaMotion.ended||(this.alphaMotion.update(e),this.material.uniforms.alpha.value=this.alphaMotion.value.alpha)},e.prototype.dispose=function(){this.material.dispose()},e}(),da=(new n.Matrix4).makeRotationAxis(new n.Vector3(0,1,0),Math.PI),pa=new n.Vector3(-1,1,1),fa=function(){function e(e){void 0===e&&(e=0),this.width=e,this.pool=[]}return Object.defineProperty(e.prototype,"size",{get:function(){return this.pool.length},enumerable:!1,configurable:!0}),e.prototype.pop=function(){var e=this.pool.pop();return e||new n.WebGLCubeRenderTarget(this.width,{stencilBuffer:!1,depthBuffer:!1})},e.prototype.push=function(e){-1===this.pool.indexOf(e)&&this.pool.push(e)},e.prototype.clear=function(){for(var e=0,t=this.pool;e<t.length;e++){t[e].dispose()}this.pool.length=0},e}(),Aa=function(e){function t(i){var n,r,o,s,a=this,l=t.parseArgs(i);(a=e.call(this,l)||this).TILED_CUBE_TEXTURE_LEVEL=2,a.tileLevel=0,a.initAnimationed=!1,a.currentPanoIndex=l.initial[0],a.maxAccessibleDistance=l.maxAccessibleDistance,a.panoTapTriggerRadius=l.panoTapTriggerRadius,a.panoCircleMeshCreator=l.panoCircleMeshCreator,a.tileLevelForFov=l.tileLevelForFov,a.luminanceAdaptiveEffectEnable=l.luminanceAdaptiveEffectEnable,a.colorCubeRenderTargetPool=new fa,a.luminanceCubeRenderTargetPool=new fa;var u=a.model.getMaterial()||{},c=u.pano0,h=u.pano1;c&&(null==h?void 0:h.map)!==c.map&&(a.model.setMaterial({pano0:h}),c.map.dispose(),c.map instanceof ri&&c.map.cubeRenderTarget&&a.colorCubeRenderTargetPool.push(c.map.cubeRenderTarget),c.luminanceMap&&(c.luminanceMap.dispose(),c.luminanceMap instanceof ri&&c.luminanceMap.cubeRenderTarget&&a.luminanceCubeRenderTargetPool.push(c.luminanceMap.cubeRenderTarget))),a.boundingMesh=a.generateBoundingMesh(),a.boundingMesh.setMaterial(a.model.getMaterial()||{}),a.boundingMesh.visible=!1,a.scene.add(a.boundingMesh),a.panoMeshes=[],a.updatePanoMeshes(),a.locationMotion=new zr({count:0,distance:a.camera.pose.distance,modelAlpha:null!==(r=null===(n=a.model.getMaterial())||void 0===n?void 0:n.modelAlpha)&&void 0!==r?r:0,perspToOrtho:a.camera.perspToOrtho.x,orthoDistance:a.camera.orthoDistance}),a.panoResources={},a.panoResources[a.locationMotion.keyframes[0].key=a.locationMotion.keyframes[1].key=rr()]={panoIndex:a.currentPanoIndex,workCode:a.work.workCode,panoPicture:null!==(s=null===(o=a.model.getMaterial())||void 0===o?void 0:o.pano1)&&void 0!==s?s:null,position:a.camera.pose.offset.clone(),effect:"fly"};var d={allowHosts:a.work.allowHosts,requestProxy:a.requestProxy,networkSubscribe:a.networkSubscribe};return a.textureLoader=new oi(d),a.tiling=new aa(d,a.TILED_CUBE_TEXTURE_LEVEL+1,a.imageOptions),a.scene.add(a.tiling.object),a.panoVideo=new ha,a.scene.add(a.panoVideo.object),a}return ke(t,e),t.parseArgs=function(t){var i,n,r,o,s,a=e.parseArgs.call(this,t);return Oe(Oe({},a),{maxAccessibleDistance:null!==(i=t.maxAccessibleDistance)&&void 0!==i?i:5,panoTapTriggerRadius:null!==(n=t.panoTapTriggerRadius)&&void 0!==n?n:.5,panoCircleMeshCreator:null!==(r=t.panoCircleMeshCreator)&&void 0!==r?r:function(){return new So},tileLevelForFov:null!==(o=t.tileLevelForFov)&&void 0!==o?o:function(e,t){var i=2*Math.atan(Math.tan(e/180*Math.PI/2)*(t.width/t.height))/Math.PI*180,n=Math.max(t.width/i,t.height/e);return n>80?4:n>48?3:n>18?2:n>12?1:0},luminanceAdaptiveEffectEnable:null===(s=t.luminanceAdaptiveEffectEnable)||void 0===s||s})},t.initAnimationEndPose=function(t){var i=this.parseArgs(t);return e.initAnimationEndPose.call(this,i)},t.prototype.destroy=function(){var t,i,n=this;e.prototype.destroy.call(this),this.scene.remove(this.tiling.object),this.tiling.dispose(),this.locationMotion.dispose(),this.colorCubeRenderTargetPool.clear(),this.luminanceCubeRenderTargetPool.clear(),delete this.pendingTextureTask,this.boundingMesh&&(this.scene.remove(this.boundingMesh),this.boundingMesh.dispose()),this.panoMeshes&&(this.panoMeshes.forEach((function(e){n.helper.remove(e),e.dispose()})),this.panoMeshes.length=0),this.interiaMovement=!1;var r=this.videoTexture.image;r.pause(),r.oncanplay=function(){},r.ontimeupdate=function(){},this.scene.remove(this.panoVideo.object),this.panoVideo.setMaterial(null),this.panoVideo.dispose();for(var o=null!==(t=this.model.getMaterial())&&void 0!==t?t:{},s=o.pano0,a=o.pano1,l=0,u=Object.keys(this.panoResources);l<u.length;l++){var c=u[l],h=this.panoResources[c];if(h.panoPicture){var d=h.panoPicture.map;d&&d!==(null==s?void 0:s.map)&&d!==(null==a?void 0:a.map)&&(d.dispose(),null===(i=h.panoPicture.luminanceMap)||void 0===i||i.dispose(),h.panoPicture=null)}delete this.panoResources[c]}this.luminanceAdaptiveEffect&&(this.luminanceAdaptiveEffect.dispose(),delete this.luminanceAdaptiveEffect)},t.prototype.isReady=function(){return!0===this.locationMotion.ended&&e.prototype.isReady.call(this)},t.prototype.isTileReady=function(){var e,t,i,n=this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[this.locationMotion.keyframes.length-1]),r=(null===(e=n.panoPicture)||void 0===e?void 0:e.map)instanceof ri&&null!==(i=null===(t=n.panoPicture)||void 0===t?void 0:t.map.tilePending)&&void 0!==i?i:0,o=this.tiling.pedding;return this.initAnimationed&&r<=0&&o<=0},t.prototype.updateWork=function(e,t,i,n,r){var o=this;this.userAction=r,this.work=e,this.currentPanoIndex=t,this.textureLoader.setAllowHosts(this.work.allowHosts),this.tiling.setAllowHosts(this.work.allowHosts),this.tiling.cleanup(),this.initAnimationed=!1;var s={},a=!0;this.boundingMesh&&(s=this.boundingMesh.getMaterial()||{},a=this.boundingMesh.visible,this.scene.remove(this.boundingMesh),this.boundingMesh.dispose()),this.boundingMesh=this.generateBoundingMesh(!0),this.boundingMesh.visible=a,this.boundingMesh.setMaterial(s),this.scene.add(this.boundingMesh),this.hideIntersectMesh(),this.updatePanoMeshes();for(var l=0,u=this.panoMeshes;l<u.length;l++){u[l].visible=!1}return this.moveToPano(t,{effect:"fade",duration:n,longitude:i.longitude,latitude:i.latitude,fov:i.fov,moveEndCallback:function(){o.initAnimationed=!0},moveCancelCallback:function(){o.initAnimationed=!0}},r),!0},t.prototype.updateModel=function(e){this.model=e;var t={},i=!0;this.boundingMesh&&(t=this.boundingMesh.getMaterial()||{},i=this.boundingMesh.visible,this.scene.remove(this.boundingMesh),this.boundingMesh.dispose()),this.boundingMesh=this.generateBoundingMesh(),this.boundingMesh.visible=i,this.boundingMesh.name="bounding",this.boundingMesh.setMaterial(t),this.scene.add(this.boundingMesh),this.updatePanoMeshes()},t.prototype.updateTime=function(e,t){var i,r,o,s,a,l,u,c,h,d,p,f=this;if(!this.destroyed){var A={},g={},m=this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[0]),v=this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[this.locationMotion.keyframes.length-1]),y=!1;if(!1===this.locationMotion.ended){this.locationMotion.update(e);var b=this.locationMotion.getKeyFrameSegment(e),x=b[0],w=b[1],M=this.panoResourceFromLocationMotionKeyframe(x),E=this.panoResourceFromLocationMotionKeyframe(w),S=(new n.Vector3).copy(M.position),C=(new n.Vector3).copy(E.position),I=this.locationMotion.value.count-w.value.count+1;A.progress=I,A.modelAlpha=this.locationMotion.value.modelAlpha,this.camera.perspToOrtho.setScalar(Mr(this.locationMotion.value.perspToOrtho,0,1)),this.camera.orthoDistance=this.locationMotion.value.orthoDistance,E.panoPicture&&(I<1?M.panoPicture&&(A.pano0=M.panoPicture):A.pano0=E.panoPicture,A.pano1=E.panoPicture),y=A.useBlackTransition="instant"===E.effect||"montage"===E.effect,"fade"!==E.effect&&"montage"!==E.effect||(A.pano0&&M.panoPicture&&(A.pano0={map:A.pano0.map,luminanceMap:A.pano0.luminanceMap,matrix:M.panoPicture.matrix.clone().setPosition(E.position)}),S.copy(C)),g.distance=this.locationMotion.value.distance,g.offset=new n.Vector3(S.x+(C.x-S.x)*I,S.y+(C.y-S.y)*I,S.z+(C.z-S.z)*I);for(var B=[],T=[],P=0,R=this.locationMotion.keyframes;P<R.length;P++){var D=R[P],L=D.key,k=D.progress;void 0!==L&&(B.push(L),k>=this.locationMotion.progress&&T.push(L))}for(var O=0,F=Object.keys(this.panoResources);O<F.length;O++){var N=F[O];if(!(T.indexOf(N)>=0)){var V=this.panoResources[N];if(V.panoPicture){var Q=V.panoPicture.map,H=V.panoPicture.luminanceMap;if(Q){if(Q===(null===(i=A.pano0)||void 0===i?void 0:i.map))continue;if(Q===(null===(r=A.pano1)||void 0===r?void 0:r.map))continue;Q instanceof ri&&Q.cubeRenderTarget&&this.colorCubeRenderTargetPool.push(Q.cubeRenderTarget),Q.dispose(),H&&(H instanceof ri&&H.cubeRenderTarget&&this.luminanceCubeRenderTargetPool.push(H.cubeRenderTarget),H.dispose()),V.panoPicture=null}}B.indexOf(N)>=0||delete this.panoResources[N]}}M.workCode===E.workCode?this.currentPanoIndex=I<.5?M.panoIndex:E.panoIndex:this.currentPanoIndex=E.panoIndex,this.emit("movingToPano",v.panoIndex,m.panoIndex,this.locationMotion.progress)}if(!1===this.cameraMotion.ended&&(this.cameraMotion.update(e),g.longitude=this.cameraMotion.value.longitude,g.latitude=this.cameraMotion.value.latitude,g.fov=this.cameraMotion.value.fov),!1===ws(A)&&((null===(o=A.pano0)||void 0===o?void 0:o.map)&&A.pano0.map instanceof ri&&!A.pano0.map.cubeRenderTarget&&(A.pano0.map.cubeRenderTarget=this.colorCubeRenderTargetPool.pop()),(null===(s=A.pano0)||void 0===s?void 0:s.luminanceMap)&&A.pano0.luminanceMap instanceof ri&&!A.pano0.luminanceMap.cubeRenderTarget&&(A.pano0.luminanceMap.cubeRenderTarget=this.luminanceCubeRenderTargetPool.pop()),(null===(a=A.pano1)||void 0===a?void 0:a.map)&&A.pano1.map instanceof ri&&!A.pano1.map.cubeRenderTarget&&(A.pano1.map.cubeRenderTarget=this.colorCubeRenderTargetPool.pop()),(null===(l=A.pano1)||void 0===l?void 0:l.luminanceMap)&&A.pano1.luminanceMap instanceof ri&&!A.pano1.luminanceMap.cubeRenderTarget&&(A.pano1.luminanceMap.cubeRenderTarget=this.luminanceCubeRenderTargetPool.pop()),this.model.setMaterial(A),this.boundingMesh.setMaterial(A)),!1===ws(g)&&this.setCamera(g),this.camera.pose.distance>.1)for(var q=0;q<this.work.observers.length;q++){(G=this.panoMeshes[q])&&(G.visible=!1)}else{var U=this.work.observers[this.currentPanoIndex];if(U){var z=xs(U.visibleNodes,(function(e){return U.standingPosition.distanceTo(f.work.observers[e].standingPosition)}),!0)[1];z=Mr(z,2.5,1/0);var j=U.visibleNodes.concat(this.currentPanoIndex),K=this.getForwardPanoIndexOrNot();for(q=0;q<this.work.observers.length;q++){var G,_=this.work.observers[q];if(G=this.panoMeshes[q])if(_.loadable||_.active)if(-1!==j.indexOf(q))if(y)G.visible=!1,G.setOpacity(0);else{G.visible=!0;var W=G.position.clone().setY(this.camera.position.y).distanceTo(this.camera.position);G.setCurrent(!G.loading&&0===G.progress&&K===q),G.setOpacity(W<.01?0:Mr(z/W*1.2,.65,.98)),G.updateTime&&G.updateTime(e,t)}else G.visible=!1,G.setOpacity(0);else G.visible=!1,G.setOpacity(0)}}}this.boundingMesh.visible=Boolean(null===(u=this.boundingMesh.getMaterial())||void 0===u?void 0:u.pano0)&&this.boundingMesh.boundingBox.containsPoint(this.camera.position);var X=this.tileLevel=function(){if(!1===f.tileLevelForFov)return 0;var e=f.renderer.getDrawingBufferSize(new n.Vector2);e.width*=f.scissor.width,e.height*=f.scissor.height;var t=v.panoIndex,i=f.work.observers[t],r=f.imageOptions.size;if(void 0===r&&i){var o=i.images.up.match(/\/cube_(\d+)\//);o&&(r=Number(o[1]))}void 0===r&&(r=2048);var s=0;r>=1024&&(s=1),r>=2048&&(s=2),r>=4096&&(s=3),r>=8192&&(s=4);var a=f.tileLevelForFov(f.camera.fov,e);return a>s?a:0}(),Y=function(){var e,t=(new n.Camera).copy(f.camera);return t.position.set(0,0,0),t.quaternion.premultiply((null!==(e=f.work.observers[v.panoIndex])&&void 0!==e?e:f.work.observers[f.currentPanoIndex]).quaternion.clone().inverse()),t.updateMatrixWorld(!0),(new n.Frustum).setFromProjectionMatrix((new n.Matrix4).multiplyMatrices(f.camera.projectionMatrix,t.matrixWorldInverse))}();v.panoIndex===this.currentPanoIndex&&((null===(c=v.panoPicture)||void 0===c?void 0:c.map)instanceof ri&&(v.panoPicture.map.update(Y,X),!0===v.panoPicture.map.needsRender&&(v.panoPicture.map.needsRender=!1,this.needsRender=!0)),(null===(h=v.panoPicture)||void 0===h?void 0:h.luminanceMap)instanceof ri&&(v.panoPicture.luminanceMap.update(Y,X),!0===v.panoPicture.luminanceMap.needsRender&&(v.panoPicture.luminanceMap.needsRender=!1,this.needsRender=!0)));var Z=this.tiling.object.visible;if(this.initAnimationed){var J=v.panoIndex,$=this.work.observers[J];$&&ss(this.camera.position,$.position)&&this.locationMotion.ended?(this.tiling.object.visible=!0,this.tiling.panoIndex!==J&&this.tiling.cleanup(),this.tiling.panoIndex=J,this.tiling.setResource(null!==(p=null===(d=$.images)||void 0===d?void 0:d.tiles)&&void 0!==p?p:[],this.enableIOSEDR&&$.images.luminance?$.images.luminance:null),this.tiling.setRotation($.quaternion),this.tiling.setPosition($.position),X>this.TILED_CUBE_TEXTURE_LEVEL?this.tiling.update(Y,X,e):this.tiling.update(Y,0,e)):this.tiling.object.visible=!1}else this.tiling.object.visible=!1;Z!==this.tiling.object.visible&&(this.tiling.object.needsRender=!0),this.panoVideo.object.position.copy(this.camera.position),this.panoVideo.updateTime(e)}},t.prototype.render=function(){var t=this.work.observers[this.currentPanoIndex];t&&t.video&&(this.needsRender=!0),e.prototype.render.call(this)},t.prototype.postProcessing=function(e,t){if(!this.destroyed)return this.luminanceAdaptiveEffect||(this.luminanceAdaptiveEffect=new Zs(this.renderer),this.luminanceAdaptiveEffect.enable=this.luminanceAdaptiveEffectEnable),this.luminanceAdaptiveEffect.render(e,t)},t.prototype.getTargetPose=function(){var e=this.cameraMotion.getKeyFrameSegment(ze())[1],t=this.locationMotion.getKeyFrameSegment(ze())[1],i=this.panoResourceFromLocationMotionKeyframe(t),n=this.work.observers[i.panoIndex];return{longitude:e.value.longitude,latitude:e.value.latitude,fov:e.value.fov,offset:n?n.position.clone():this.camera.position.clone(),distance:this.locationMotion.value.distance}},t.prototype.moveToPano=function(e,t,i){var r,o,s,a,l=this,u=this.work.observers[e],c=this.imageOptions.size;if(void 0===c&&u){var h=u.images.up.match(/\/cube_(\d+)\//);h&&(c=Number(h[1]))}void 0===c&&(c=2048);var d=this.imageOptions.transform,p=Oe({key:"pano.".concat(e),basisLoaderInitialized:ii.isInitialized()},Tt(this.imageOptions,["format","size","quality","sharpen","mappings"])),f=u.images,A=null!==(o=null===(r=u.images.tiles)||void 0===r?void 0:r.filter((function(e){return e.size>c})))&&void 0!==o?o:null,g=d,m={key:"pano_luminance.".concat(e),basisLoaderInitialized:ii.isInitialized(),size:p.size?p.size/2:1024},v=this.enableIOSEDR&&u.images.luminance?u.images.luminance:null,y=function(){if(!u.images.tiles)return null;if(!v)return null;var e=v.up.match(/\/cube_(\d+)\//),t=!!e&&Number(e[1]);return!1===t?null:null==A?void 0:A.map((function(e){return{level:e.level,size:t,back:v.back,front:v.front,left:v.left,right:v.right,up:v.up,down:v.down}}))}(),b="pano:"+zs([f,p,d]);if(this.pendingTextureTask){if(this.pendingTextureTask.hash===b)return;var x=this.pendingTextureTask.panoIndex;null===(s=this.panoMeshes[x])||void 0===s||s.setProgress(0),this.emit("textureAbort",x,u),this.pendingTextureTask.onError(new Error("texture aborted"))}this.pending=!0;var w,M=this.model.getMaterial()||{},E=M.pano0,S=M.pano1;if(E&&E.map.name===b&&null!==E.luminanceMap===this.enableIOSEDR?w=E:(null==S?void 0:S.map.name)===b&&null!==S.luminanceMap===this.enableIOSEDR&&(w=S),w){var C={panoIndex:e,workCode:this.work.workCode,effect:null!==(a=t.effect)&&void 0!==a?a:"fly",panoPicture:{map:w.map,luminanceMap:w.luminanceMap,matrix:(new n.Matrix4).compose(u.position,u.quaternion,pa)},position:u.position.clone()};dt.shared.add((function(){l.pending=!1,l.emit("panoLoaded",e),l.doMoveToPano(e,C,t,i)}),!0,1)}else{this.pendingTextureTask={panoIndex:e,hash:b,onLoad:function(r,o){var s,a;if(l.pending=!1,l.destroyed)r.body.dispose();else{r.body.name=b,l.emit("panoLoaded",e);var c={panoIndex:e,workCode:l.work.workCode,effect:null!==(s=t.effect)&&void 0!==s?s:"fly",panoPicture:{map:r.body,luminanceMap:null!==(a=null==o?void 0:o.body)&&void 0!==a?a:null,matrix:(new n.Matrix4).compose(u.position,u.quaternion,pa)},position:u.position.clone()};l.doMoveToPano(e,c,t,i)}},onError:function(i){l.pending=!1,t.moveCancelCallback&&t.moveCancelCallback(),l.emit("panoLoadError",i,e),l.emit("moveToPanoCanceled",e)}};var I=this.panoMeshes[e];I&&I.tap&&I.tap(),Promise.all([this.tileLevelForFov&&A&&A.length?this.textureLoader.loadTiledCubeTexture(f,A,{tileMaxLevel:this.TILED_CUBE_TEXTURE_LEVEL,imageURL:{transform:d,options:p},format:n.RGBAFormat,viaAjax:!0},void 0,void 0,(function(t){var i,n;l.emit("textureLoading",t,e,u),(null===(i=l.pendingTextureTask)||void 0===i?void 0:i.hash)===b&&(null===(n=l.panoMeshes[e])||void 0===n||n.setProgress(t))}),this.renderer):this.textureLoader.loadCubeTexture(f,{imageURL:{transform:d,options:p},format:n.RGBAFormat,viaAjax:!0,preInit:!0},void 0,void 0,(function(t){var i,n;l.emit("textureLoading",t,e,u),(null===(i=l.pendingTextureTask)||void 0===i?void 0:i.hash)===b&&(null===(n=l.panoMeshes[e])||void 0===n||n.setProgress(t))}),this.renderer),v?this.tileLevelForFov&&y&&y.length?this.textureLoader.loadTiledCubeTexture(v,y,{tileImageSize:256,tileMaxLevel:this.TILED_CUBE_TEXTURE_LEVEL,imageURL:{transform:g,options:m}},void 0,void 0,void 0,this.renderer).catch((function(){return null})):this.textureLoader.loadCubeTexture(v,{imageURL:{transform:g,options:m},preInit:!0},void 0,void 0,void 0,this.renderer).catch((function(){return null})):Promise.resolve(null)]).then((function(t){var i,n,r=t[0],o=t[1];(null===(i=l.pendingTextureTask)||void 0===i?void 0:i.hash)===b?(l.pendingTextureTask.onLoad(r,o),null===(n=l.panoMeshes[e])||void 0===n||n.setProgress(0),delete l.pendingTextureTask,l.emit("textureLoaded",e,u,r.meta)):(r.body.dispose(),null==o||o.body.dispose())})).catch((function(t){var i,n;(null===(i=l.pendingTextureTask)||void 0===i?void 0:i.hash)===b&&(l.pendingTextureTask.onError(t),null===(n=l.panoMeshes[e])||void 0===n||n.setProgress(0),delete l.pendingTextureTask,l.emit("textureError",t,e,u),l.emit("error",t))})),this.emit("textureStartLoad",e,u)}},t.prototype.initAnimation=function(e,t,i,n){var r,o,s,a=this;if(!this.destroyed){var l=!1;this.pending=!1,this.userAction=n,this.moveToPano(e,{longitude:null!==(r=t.longitude)&&void 0!==r?r:this.defaultLongitude,latitude:Mr(null!==(o=t.latitude)&&void 0!==o?o:this.defaultLatitude,this.minLatitude,this.maxLatitude),fov:Mr(null!==(s=t.fov)&&void 0!==s?s:this.defaultFov,this.minFov,this.maxFov),duration:i,moveStartCallback:function(e,t){l=!0,a.emit("initAnimationWillStart",e,t,a.userAction)},moveEndCallback:function(e,t){a.emit("initAnimationEnded",e,t,a.userAction),a.initAnimationed=!0},moveCancelCallback:function(){var e={longitude:a.camera.pose.longitude,latitude:a.camera.pose.latitude,fov:a.camera.pose.fov,offset:a.camera.pose.offset.clone(),distance:a.camera.pose.distance};!1===l&&a.emit("initAnimationWillStart",a.currentPanoIndex,e,a.userAction),a.emit("initAnimationEnded",a.currentPanoIndex,e,a.userAction),a.initAnimationed=!0}},n)}},t.prototype.panoResourceFromLocationMotionKeyframe=function(e){return this.panoResources[e.key]},t.prototype.locationMotionKeyframesLength=function(e){for(var t=0,i=1;i<e.length;i++){var n=this.panoResourceFromLocationMotionKeyframe(e[i-1]).position,r=this.panoResourceFromLocationMotionKeyframe(e[i]).position;t+=n.distanceTo(r)*(e[i].value.count-e[i-1].value.count)}return t},t.prototype.updatePanoMeshes=function(e){var t=this;void 0===e&&(e=!0);for(var i={},r=0,o=this.panoMeshes;r<o.length;r++){i[(A=o[r]).name]=A}this.panoMeshes.length=0;for(var s=1,a={},l=function(e){if(e.accessibleNodes.length){var i=xs(e.accessibleNodes,(function(i){return Mr(t.work.observers[i].standingPosition.distanceTo(e.standingPosition),1,1/0)}),!0),n=i[1];void 0===a[e.panoIndex]&&(a[e.panoIndex]=n)}},u=0,c=this.work.observers;u<c.length;u++){l(f=c[u])}var h=Object.keys(a).map((function(e){return a[e]}));h.length&&(s=Mr(.6*(h.reduce((function(e,t){return e+t}),0)/h.length),1,3));for(var d=0;d<this.work.observers.length;d++){var p="panoCircle_".concat(this.work.workCode,"_").concat(d),f=this.work.observers[d],A=void 0;if(i[p]?(!0===(A=i[p]).loading&&!1===f.loadable&&A.setLoading(!1),delete i[p]):((A=this.panoCircleMeshCreator()).name=p,this.helper.add(A)),A.scale.set(s,1,s),A.position.copy(f.standingPosition),e&&this.model.loaded&&this.model.bvhs.loaded){var g=new n.Vector3(0,-1,0),m=new n.Vector3(0,.1,0).add(A.position),v=new n.Raycaster(m,g,0,.2),y=this.model.intersectRaycaster(v)[0];y&&y.point.distanceTo(m)<.1&&A.position.copy(y.point)}this.panoMeshes[d]=A}for(var b=0,x=Object.keys(i);b<x.length;b++){var w=x[b];this.helper.remove(i[w]),i[w].dispose(),delete i[w]}},t.prototype.generateBoundingMesh=function(e){void 0===e&&(e=!1);for(var t=this.model.bounding.clone(),i=0,r=this.work.observers;i<r.length;i++){var o=r[i];t.expandByPoint(o.standingPosition),t.expandByPoint((new n.Vector3).fromArray([o.position.x,2*o.position.y-o.standingPosition.y,o.position.z]))}e&&t.expandByPoint(this.camera.position);var s=cs(t,new n.Vector3(1,0,1));return s.name="panorama_bounding",s},t.prototype.doMoveToPano=function(e,t,i,r){var o,s,a,l=this;void 0===i&&(i={}),this.userAction=r;var u=ze(),c=rr();this.tiling.cleanup(),this.panoResources[c]=t;var h,d,p;if(this.locationMotion.ended){var f=this.locationMotion.getKeyFrameSegment(u);f[0];var A=f[1],g=this.locationMotion.value,m=this.panoResourceFromLocationMotionKeyframe(A).position,v=t.position;h=Math.max(m.distanceTo(v),1),d=[{key:A.key,progress:0,value:Oe(Oe({},g),{count:0})},{key:c,progress:1,value:{distance:0,perspToOrtho:0,orthoDistance:1,modelAlpha:0,count:1}}],p=0}else{var y=this.locationMotion.getKeyFrameSegment(u),b=y[0],x=(A=y[1],g=this.locationMotion.value,this.panoResourceFromLocationMotionKeyframe(b).position),w=(m=this.panoResourceFromLocationMotionKeyframe(A).position,v=t.position,A.value.count-g.count),M=Math.max(x.distanceTo(m),1)*w;h=M+Math.max(m.distanceTo(v),1),d=[{key:b.key,progress:0,value:Oe({},g)},{key:A.key,progress:M/h,value:A.value},{key:c,progress:1,value:{count:A.value.count+1,distance:0,perspToOrtho:0,orthoDistance:1,modelAlpha:0}}];var E=this.locationMotionKeyframesLength(this.locationMotion.keyframes),S=this.locationMotionKeyframesLength(d);p=0===E||0===E?0:this.locationMotion.getProgressVelocity(u)*E/S}var C=this.calculateMovingDuration(i.duration,"fade"===i.effect||"montage"===i.effect?0:h),I={longitude:i.longitude,latitude:i.latitude,fov:i.fov},B={longitude:null!==(o=I.longitude)&&void 0!==o?o:this.camera.pose.longitude,latitude:null!==(s=I.latitude)&&void 0!==s?s:this.camera.pose.latitude,fov:null!==(a=I.fov)&&void 0!==a?a:this.camera.pose.fov,offset:t.position.clone(),distance:this.camera.pose.distance};this.emit("moveToPano",e,r),i.moveStartCallback&&i.moveStartCallback(e,B),this.emit("panoWillArrive",e,B,this.userAction),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=qe,this.videoTexture.needsUpdate=!0),this.panoVideo.setMaterial(null),this.cameraMotion.set(I,C).catch(qe),this.locationMotion.setKeyframes(d,C,p).then((function(){var t,o,s,a={longitude:l.camera.pose.longitude,latitude:l.camera.pose.latitude,fov:l.camera.pose.fov,offset:l.camera.pose.offset.clone(),distance:l.camera.pose.distance};i.moveEndCallback&&i.moveEndCallback(e,a),l.emit("panoArrived",e,a,r);var u=l.work.observers[l.currentPanoIndex];if(u&&u.video&&l.videoTexture&&l.videoTexture.image instanceof HTMLVideoElement){var c=da.clone().multiply(null!==(s=null===(o=null===(t=l.model.getMaterial())||void 0===t?void 0:t.pano1)||void 0===o?void 0:o.matrix)&&void 0!==s?s:new n.Matrix4).multiply(u.video.matrix),h={map:l.videoTexture,size:u.video.size,matrix:c,alpha:1},d=rr(),p=l.videoTexture.image;p.setAttribute("uuid",d),Gs().then((function(e){e&&u.video&&p.getAttribute("uuid")===d&&(p.oncanplay=function(){p.oncanplay=qe,p.play()},p.ontimeupdate=function(){p.currentTime>.5&&(p.ontimeupdate=qe,l.panoVideo.setMaterial(h))},p.src=u.video.source)})).catch((function(){p.removeAttribute("uuid")}))}}),(function(){i.moveCancelCallback&&i.moveCancelCallback(),l.emit("moveToPanoCanceled",e)}))},t.prototype.getForwardPanoIndexOrNot=function(e){var t=this,i=this.work.observers[this.currentPanoIndex];if(!i)return null;var r=null!=e?e:new n.Raycaster(this.camera.position.clone(),this.camera.getWorldDirection(new n.Vector3)),o=new n.Vector3,s=this.model.intersectRaycaster(new n.Raycaster(r.ray.origin,new n.Vector3(0,-1,0)))[0];s&&s.distance<=2?o.copy(s.point):o.copy(r.ray.origin).add(new n.Vector3(0,-1.5,0));var a=this.model.intersectRaycaster(r)[0],l=(a?a.point:r.ray.origin.clone().add(r.ray.direction.clone().normalize().multiplyScalar(3))).clone().sub(o).normalize();if(0===l.length())return null;for(var u=i.accessibleNodes.filter((function(e){if(e===t.currentPanoIndex)return!1;var i=t.work.observers[e],n=i.standingPosition.clone().project(t.camera);return!(Math.abs(n.z)>1)&&(!(Math.abs(n.x)>1)&&(!(Math.abs(n.y)>1)&&(i.loadable||i.active)))})),c=u.slice().sort((function(e,i){return t.work.observers[e].standingPosition.clone().distanceTo(o)-t.work.observers[i].standingPosition.clone().distanceTo(o)})),h=0,d=[Math.PI/8,Math.PI/6,Math.PI/4,Math.PI/3];h<d.length;h++)for(var p=d[h],f=0,A=c;f<A.length;f++){var g=A[f],m=this.work.observers[g].standingPosition.clone().sub(o);if(0!==m.length()&&l.angleTo(m)<p)return g}return null},t.prototype.onTapGesture=function(e){var t=this,i=e.pointers.map((function(e){return Tt(e,["x","y"])}));if(!this.emit("wantsGesture","tap",i,!0)){var r=this.relativeClientPosition(e.center),o=new n.Raycaster;if(o.setFromCamera(r,this.camera),!this.emit("wantsTapGesture",o,r,!0)){this.emit("gesture","tap",i,!0),this.emit("tapGesture",o,r,!0),this.interiaMovement=!1;var s=this.camera.getWorldDirection(new n.Vector3).setY(0),a=null,l=this.work.observers[this.currentPanoIndex];if(l){var u=l.accessibleNodes.filter((function(e){if(e===t.currentPanoIndex)return!1;var i=t.work.observers[e];return!(i.position.distanceTo(t.camera.position)>t.maxAccessibleDistance)&&(i.loadable||i.active)})),c=this.model.intersectRaycaster(o)[0];if(c){var h=xs(u,(function(e){var i=t.work.observers[e].standingPosition.clone();return i.clone().sub(t.camera.position).setY(0).angleTo(s)>Math.PI/2?1/0:i.distanceTo(c.point)}),!0),d=h[0];h[1]<this.panoTapTriggerRadius&&(a=d)}vr(a)&&(a=this.getForwardPanoIndexOrNot(o));for(var p=0,f=this.locationMotion.keyframes;p<f.length;p++){var A=f[p],g=this.panoResourceFromLocationMotionKeyframe(A);if(!(A.progress<this.locationMotion.progress)&&g.panoIndex===a){a=null;break}}if(this.emit("panoSelected",a),vr(a))!0===this.locationMotion.ended&&this.cameraBounce();else{var m=this.work.observers[a];if(m.active){for(var v={},y=Math.PI/6,b=Math.PI/12,x=m.position.clone().setY(0).sub(l.position.clone().setY(0)).normalize(),w=[],M=0,E=m.accessibleNodes;M<E.length;M++){if((d=E[M])!==this.currentPanoIndex&&d!==a){var S=this.work.observers[d].position.clone().sub(m.position).setY(0);x.angleTo(S)<y&&w.push(S)}}var C=(w.length>0?w:Fe(Fe([],[],!0),[],!0)).slice().sort((function(e,t){return e.angleTo(x)-t.angleTo(x)}))[0];C&&C.angleTo(s)>b&&(v.longitude=Math.atan2(-C.x,-C.z)),this.cameraMotion.value.latitude<-Math.PI/4&&(v.latitude=Mr(0,this.minLatitude,this.maxLatitude)),this.cameraMotion.value.fov<60&&(v.fov=this.defaultFov),this.emit("wantsMoveToPano",a,v,!0)}else this.panoMeshes[a]&&(this.panoMeshes[a].setDisabled(!1),this.panoMeshes[a].setLoading(!0))}}}}},t}(Ks),ga=Math.PI/180,ma=180/Math.PI,va=function(){var e="undefined"!=typeof navigator&&/iPad|iPhone|iPod/.test(navigator.platform);return function(){return e}}(),ya=function(){var e="undefined"!=typeof navigator&&/^((?!chrome|android).)*safari/i.test(navigator.userAgent);return function(){return e}}(),ba=function(){var e="undefined"!=typeof navigator&&-1!==navigator.userAgent.indexOf("Firefox")&&-1!==navigator.userAgent.indexOf("Android");return function(){return e}}(),xa=function(){var e="undefined"!=typeof navigator?navigator.userAgent.match(/.*Chrome\/([0-9]+)/):null,t=e?parseInt(e[1],10):null;return function(){return t}}(),wa=function(){var e=!1;if(65===xa()){var t="undefined"!=typeof navigator?navigator.userAgent.match(/.*Chrome\/([0-9\.]*)/):null;if(t){var i=t[1].split(".");i[0],i[1];var n=i[2],r=i[3];e=3325===parseInt(n,10)&&parseInt(r,10)<148}}return function(){return e}}(),Ma=function(){var e=va()&&ya()&&"undefined"!=typeof navigator&&-1!==navigator.userAgent.indexOf("13_4");return function(){return e}}(),Ea=function(){var e="undefined"!=typeof navigator&&-1!==navigator.userAgent.indexOf("R7 Build");return function(){return e}}();function Sa(){var e="undefined"!=typeof window&&(90==window.orientation||-90==window.orientation);return Ea()?!e:e}var Ca,Ia=(Ca={},function(e,t){void 0===Ca[e]&&(console.warn("cardboard: "+t),Ca[e]=!0)});function Ba(e){var t,i=e.indexOf("://");t=-1!==i?i+3:0;var n=e.indexOf("/",t);return-1===n&&(n=e.length),e.substring(0,n)}var Ta,Pa=function(e,t,i){var n,r,o,s,a,l,u,c,h,d,p,f,A,g,m,v,y,b,x,w,M,E,S,C,I,B,T,P,R,D,L;!function(e,t,i){var n=t?t[0]:0,r=t?t[1]:0,o=t?t[2]:0,s=t?t[3]:1,a=n+n,l=r+r,u=o+o,c=n*a,h=n*l,d=n*u,p=r*l,f=r*u,A=o*u,g=s*a,m=s*l,v=s*u;e[0]=1-(p+A),e[1]=h+v,e[2]=d-m,e[3]=0,e[4]=h-v,e[5]=1-(c+A),e[6]=f+g,e[7]=0,e[8]=d+m,e[9]=f-g,e[10]=1-(c+p),e[11]=0,e[12]=i?i[0]:0,e[13]=i?i[1]:0,e[14]=i?i[2]:0,e[15]=1}(e,t),i&&function(e,t,i){var n,r,o,s,a,l,u,c,h,d,p,f,A=i[0],g=i[1],m=i[2];t===e?(e[12]=t[0]*A+t[4]*g+t[8]*m+t[12],e[13]=t[1]*A+t[5]*g+t[9]*m+t[13],e[14]=t[2]*A+t[6]*g+t[10]*m+t[14],e[15]=t[3]*A+t[7]*g+t[11]*m+t[15]):(n=t[0],r=t[1],o=t[2],s=t[3],a=t[4],l=t[5],u=t[6],c=t[7],h=t[8],d=t[9],p=t[10],f=t[11],e[0]=n,e[1]=r,e[2]=o,e[3]=s,e[4]=a,e[5]=l,e[6]=u,e[7]=c,e[8]=h,e[9]=d,e[10]=p,e[11]=f,e[12]=n*A+a*g+h*m+t[12],e[13]=r*A+l*g+d*m+t[13],e[14]=o*A+u*g+p*m+t[14],e[15]=s*A+c*g+f*m+t[15])}(e,e,i),n=e,o=(r=e)[0],s=r[1],a=r[2],l=r[3],u=r[4],c=r[5],h=r[6],d=r[7],p=r[8],f=r[9],A=r[10],g=r[11],m=r[12],v=r[13],y=r[14],b=r[15],(L=(x=o*c-s*u)*(D=A*b-g*y)-(w=o*h-a*u)*(R=f*b-g*v)+(M=o*d-l*u)*(P=f*y-A*v)+(E=s*h-a*c)*(T=p*b-g*m)-(S=s*d-l*c)*(B=p*y-A*m)+(C=a*d-l*h)*(I=p*v-f*m))&&(L=1/L,n[0]=(c*D-h*R+d*P)*L,n[1]=(a*R-s*D-l*P)*L,n[2]=(v*C-y*S+b*E)*L,n[3]=(A*S-f*C-g*E)*L,n[4]=(h*T-u*D-d*B)*L,n[5]=(o*D-a*T+l*B)*L,n[6]=(y*M-m*C-b*w)*L,n[7]=(p*C-A*M+g*w)*L,n[8]=(u*R-c*T+d*I)*L,n[9]=(s*T-o*R-l*I)*L,n[10]=(m*S-v*M+b*x)*L,n[11]=(f*M-p*S-g*x)*L,n[12]=(c*B-u*P-h*I)*L,n[13]=(o*P-s*B+a*I)*L,n[14]=(v*w-m*E-y*x)*L,n[15]=(p*E-f*w+A*x)*L)},Ra=function(){function e(e,t){void 0===e&&(e=new n.Vector3),void 0===t&&(t=0),this.sample=e,this.timestampS=t}return e.prototype.set=function(e,t){this.sample=e,this.timestampS=t},e.prototype.copy=function(e){this.set(e.sample,e.timestampS)},e}(),Da=function(){function e(e,t){this.kFilter=e,this.isDebug=t,this.currentAccelMeasurement=new Ra,this.currentGyroMeasurement=new Ra,this.previousGyroMeasurement=new Ra,va()?this.filterQ=new n.Quaternion(-1,0,0,1):this.filterQ=new n.Quaternion(1,0,0,1),this.previousFilterQ=new n.Quaternion,this.previousFilterQ.copy(this.filterQ),this.accelQ=new n.Quaternion,this.isOrientationInitialized=!1,this.estimatedGravity=new n.Vector3,this.measuredGravity=new n.Vector3,this.gyroIntegralQ=new n.Quaternion}return e.prototype.addAccelMeasurement=function(e,t){this.currentAccelMeasurement.set(e,t)},e.prototype.addGyroMeasurement=function(e,t){this.currentGyroMeasurement.set(e,t);var i,n=t-this.previousGyroMeasurement.timestampS;i=n,isNaN(i)||i<=.001||i>1||this.run_(),this.previousGyroMeasurement.copy(this.currentGyroMeasurement)},e.prototype.getOrientation=function(){return this.filterQ},e.prototype.run_=function(){if(!this.isOrientationInitialized)return this.accelQ=this.accelToQuaternion_(this.currentAccelMeasurement.sample),this.previousFilterQ.copy(this.accelQ),void(this.isOrientationInitialized=!0);var e=this.currentGyroMeasurement.timestampS-this.previousGyroMeasurement.timestampS,t=this.gyroToQuaternionDelta_(this.currentGyroMeasurement.sample,e);this.gyroIntegralQ.multiply(t),this.filterQ.copy(this.previousFilterQ),this.filterQ.multiply(t);var i=new n.Quaternion;i.copy(this.filterQ),i.inverse(),this.estimatedGravity.set(0,0,-1),this.estimatedGravity.applyQuaternion(i),this.estimatedGravity.normalize(),this.measuredGravity.copy(this.currentAccelMeasurement.sample),this.measuredGravity.normalize();var r,o=new n.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)",ma*((r=o).w>1?0:2*Math.acos(r.w)),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 n.Quaternion;s.copy(this.filterQ),s.multiply(o),this.filterQ.slerp(s,1-this.kFilter),this.previousFilterQ.copy(this.filterQ)},e.prototype.accelToQuaternion_=function(e){var t=new n.Vector3;t.copy(e),t.normalize();var i=new n.Quaternion;return i.setFromUnitVectors(new n.Vector3(0,0,-1),t),i.inverse(),i},e.prototype.gyroToQuaternionDelta_=function(e,t){var i=new n.Quaternion,r=new n.Vector3;return r.copy(e),r.normalize(),i.setFromAxisAngle(r,e.length()*t),i},e}(),La=function(){function e(e,t){this.predictionTimeS=e,this.isDebug=t,this.previousQ=new n.Quaternion,this.previousTimestampS=null,this.deltaQ=new n.Quaternion,this.outQ=new n.Quaternion}return e.prototype.getPrediction=function(e,t,i){if(!this.previousTimestampS)return this.previousQ.copy(e),this.previousTimestampS=i,e;var r=new n.Vector3;r.copy(t),r.normalize();var o=t.length();if(o<20*ga)return this.isDebug&&console.log("Moving slowly, at %s deg/s: no prediction",(ma*o).toFixed(1)),this.outQ.copy(e),this.previousQ.copy(e),this.outQ;var s=o*this.predictionTimeS;return this.deltaQ.setFromAxisAngle(r,s),this.outQ.copy(this.previousQ),this.outQ.multiply(this.deltaQ),this.previousQ.copy(e),this.previousTimestampS=i,this.outQ},e}(),ka=function(){function e(e){this.coefficients=e}return e.prototype.distortInverse=function(e){for(var t=0,i=1,n=e-this.distort(t);Math.abs(i-t)>1e-4;){var r=e-this.distort(i),o=i-r*((i-t)/(r-n));t=i,i=o,n=r}return i},e.prototype.distort=function(e){for(var t=e*e,i=0,n=0;n<this.coefficients.length;n++)i=t*(i+this.coefficients[n]);return(i+1)*e},e}(),Oa=function(){this.angularAcceleration=null,this.angularVelocity=null,this.linearAcceleration=null,this.linearVelocity=null,this.orientation=null,this.position=null},Fa=function(){this.leftDegrees=0,this.rightDegrees=0,this.upDegrees=0,this.downDegrees=0},Na=function(){function e(e,t,i,r){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=i,this.accelerometer=new n.Vector3,this.gyroscope=new n.Vector3,this.filter=new Da(e,r),this.posePredictor=new La(t,r),this.isFirefoxAndroid=ba(),this.isIOS=va();var o=xa();this.isDeviceMotionInRadians=!this.isIOS&&null!==o&&o<66,this.isWithoutDeviceMotion=wa()||Ma(),this.filterToWorldQ=new n.Quaternion,va()?this.filterToWorldQ.setFromAxisAngle(new n.Vector3(1,0,0),Math.PI/2):this.filterToWorldQ.setFromAxisAngle(new n.Vector3(1,0,0),-Math.PI/2),this.inverseWorldToScreenQ=new n.Quaternion,this.worldToScreenQ=new n.Quaternion,this.originalPoseAdjustQ=new n.Quaternion;var s="undefined"!=typeof window?-window.orientation*Math.PI/180:0;this.originalPoseAdjustQ.setFromAxisAngle(new n.Vector3(0,0,1),s),this.setScreenTransform_(),Sa()&&this.filterToWorldQ.multiply(this.inverseWorldToScreenQ),this.resetQ=new n.Quaternion,this.orientationOut_=new Float32Array(4),this.previousTimestampS=Date.now()}return e.prototype.getPosition=function(){return null},e.prototype.getOrientation=function(){var e;if(this.isWithoutDeviceMotion&&this._deviceOrientationQ){this.deviceOrientationFixQ=this.deviceOrientationFixQ||function(){var e=(new n.Quaternion).setFromAxisAngle(new n.Vector3(0,0,-1),0),t=new n.Quaternion;return"undefined"!=typeof window&&-90===window.orientation?t.setFromAxisAngle(new n.Vector3(0,1,0),Math.PI/-2):t.setFromAxisAngle(new n.Vector3(0,1,0),Math.PI/2),e.multiply(t)}(),this.deviceOrientationFilterToWorldQ=this.deviceOrientationFilterToWorldQ||((i=new n.Quaternion).setFromAxisAngle(new n.Vector3(1,0,0),-Math.PI/2),i),e=this._deviceOrientationQ;var t=new n.Quaternion;return t.copy(e),t.multiply(this.deviceOrientationFilterToWorldQ),t.multiply(this.resetQ),t.multiply(this.worldToScreenQ),t.multiplyQuaternions(this.deviceOrientationFixQ,t),this.yawOnly&&(t.x=0,t.z=0,t.normalize()),this.orientationOut_[0]=t.x,this.orientationOut_[1]=t.y,this.orientationOut_[2]=t.z,this.orientationOut_[3]=t.w,this.orientationOut_}var i,r=this.filter.getOrientation();e=this.posePredictor.getPrediction(r,this.gyroscope,this.previousTimestampS);var o=new n.Quaternion;return o.copy(this.filterToWorldQ),o.multiply(this.resetQ),o.multiply(e),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_},e.prototype.getPose=function(){var e=new Oa;return e.orientation=this.getOrientation(),e},e.prototype.resetPose=function(){this.resetQ.copy(this.filter.getOrientation()),this.resetQ.x=0,this.resetQ.y=0,this.resetQ.z*=-1,this.resetQ.normalize(),Sa()&&this.resetQ.multiply(this.inverseWorldToScreenQ),this.resetQ.multiply(this.originalPoseAdjustQ)},e.prototype.getFrameData=function(e){var t=this.getOrientation(),i=this.getEyeOffset(),n=this.getEyeProjectionMatrix();return e.pose.angularAcceleration=null,e.pose.angularVelocity=null,e.pose.linearAcceleration=null,e.pose.linearVelocity=null,e.pose.orientation=t,e.pose.position=null,e.timestamp=this.previousTimestampS,e.leftProjectionMatrix.set(n.left),e.rightProjectionMatrix.set(n.right),Pa(e.leftViewMatrix,t,i.left),Pa(e.rightViewMatrix,t,i.right),e},e.prototype.start=function(){if("undefined"==typeof window)return function(){};var e=this.onDeviceMotion_.bind(this),t=this.onOrientationChange_.bind(this),i=this.onMessage_.bind(this),n=this.onDeviceOrientation_.bind(this);return va()&&function(){if("undefined"==typeof window)return!1;if("undefined"==typeof document)return!1;var e=window.self!==window.top,t=Ba(document.referrer),i=Ba(window.location.href);return e&&t!==i}()&&window.addEventListener("message",i),window.addEventListener("orientationchange",t),this.isWithoutDeviceMotion?window.addEventListener("deviceorientation",n):window.addEventListener("devicemotion",e),function(){window.removeEventListener("devicemotion",e),window.removeEventListener("deviceorientation",t),window.removeEventListener("orientationchange",t),window.removeEventListener("message",i)}},e.prototype.getEyeOffset=function(){return{left:[.5*-this.viewer.interLensDistance,0,0],right:[.5*this.viewer.interLensDistance,0,0]}},e.prototype.getEyeProjectionMatrix=function(){var e=this.getEyeFieldOfView(),t=this.depthNear,i=this.depthFar,n={left:[],right:[]},r=e.left.upDegrees*ga,o=e.left.downDegrees*ga,s=2/((l=e.left.leftDegrees*ga)+(u=e.left.rightDegrees*ga)),a=2/(r+o);n.left[0]=s,n.left[1]=0,n.left[2]=0,n.left[3]=0,n.left[4]=0,n.left[5]=a,n.left[6]=0,n.left[7]=0,n.left[8]=-(l-u)*s*.5,n.left[9]=(r-o)*a*.5,n.left[10]=i/(t-i),n.left[11]=-1,n.left[12]=0,n.left[13]=0,n.left[14]=i*t/(t-i),n.left[15]=0;var l,u;r=e.right.upDegrees*ga,o=e.right.downDegrees*ga,s=2/((l=e.right.leftDegrees*ga)+(u=e.right.rightDegrees*ga)),a=2/(r+o);return n.right[0]=s,n.right[1]=0,n.right[2]=0,n.right[3]=0,n.right[4]=0,n.right[5]=a,n.right[6]=0,n.right[7]=0,n.right[8]=-(l-u)*s*.5,n.right[9]=(r-o)*a*.5,n.right[10]=i/(t-i),n.right[11]=-1,n.right[12]=0,n.right[13]=0,n.right[14]=i*t/(t-i),n.right[15]=0,n},e.prototype.getEyeFieldOfView=function(){var e=this.viewer,t=this.device,i=new ka(e.distortionCoefficients),n=e.screenLensDistance,r=(t.widthMeters-e.interLensDistance)/2,o=e.interLensDistance/2,s=e.baselineLensDistance-t.bevelMeters,a=t.heightMeters-s,l=ma*Math.atan(i.distort(r/n)),u=ma*Math.atan(i.distort(o/n)),c=ma*Math.atan(i.distort(s/n)),h=ma*Math.atan(i.distort(a/n)),d=new Fa,p=new Fa;return d.leftDegrees=Math.min(l,e.fov),d.rightDegrees=Math.min(u,e.fov),d.downDegrees=Math.min(c,e.fov),d.upDegrees=Math.min(h,e.fov),p.leftDegrees=d.rightDegrees,p.rightDegrees=d.leftDegrees,p.upDegrees=d.upDegrees,p.downDegrees=d.downDegrees,{left:d,right:p}},e.prototype.onDeviceOrientation_=function(e){this._deviceOrientationQ=this._deviceOrientationQ||new n.Quaternion;var t=e.alpha,i=e.beta,r=e.gamma;t=(t||0)*Math.PI/180,i=(i||0)*Math.PI/180,r=(r||0)*Math.PI/180,this._deviceOrientationQ.setFromEuler(new n.Euler(t,i,-r,"YXZ"))},e.prototype.onDeviceMotion_=function(e){this.updateDeviceMotion_(e)},e.prototype.updateDeviceMotion_=function(e){var t=e.accelerationIncludingGravity,i=e.rotationRate,n=e.timeStamp/1e3,r=n-this.previousTimestampS;return r<0?(Ia("fusion-pose-sensor:invalid:non-monotonic","Invalid timestamps detected: non-monotonic timestamp from devicemotion"),void(this.previousTimestampS=n)):r<=.001||r>1?(Ia("fusion-pose-sensor:invalid:outside-threshold","Invalid timestamps detected: Timestamp from devicemotion outside expected range."),void(this.previousTimestampS=n)):(t&&(this.accelerometer.set(-t.x,-t.y,-t.z),i&&(Ea()?this.gyroscope.set(-i.beta,i.alpha,i.gamma):this.gyroscope.set(i.alpha,i.beta,i.gamma),this.isDeviceMotionInRadians||this.gyroscope.multiplyScalar(Math.PI/180),this.filter.addGyroMeasurement(this.gyroscope,n)),this.filter.addAccelMeasurement(this.accelerometer,n)),void(this.previousTimestampS=n))},e.prototype.onOrientationChange_=function(){this.setScreenTransform_()},e.prototype.onMessage_=function(e){var t=e.data;t&&t.type&&("devicemotion"===t.type.toLowerCase()&&this.updateDeviceMotion_(t.deviceMotionEvent))},e.prototype.setScreenTransform_=function(){switch(this.worldToScreenQ.set(0,0,0,1),"undefined"!=typeof window?window.orientation:0){case 0:break;case 90:this.worldToScreenQ.setFromAxisAngle(new n.Vector3(0,0,1),-Math.PI/2);break;case-90:this.worldToScreenQ.setFromAxisAngle(new n.Vector3(0,0,1),Math.PI/2)}this.inverseWorldToScreenQ.copy(this.worldToScreenQ),this.inverseWorldToScreenQ.inverse()},e}(),Va=[0,0,.5,1],Qa=[.5,0,.5,1],Ha=function(){function e(e){var t=this;this.renderer=e,this.sensor=new Na(.98,.04,!1,!1),this.scale=1,this.cameraL=new n.PerspectiveCamera,this.cameraR=new n.PerspectiveCamera;var i=this.sensor.start();this.dispose=function(){var e=t.renderer.getSize(new n.Vector2);t.renderer.setScissor(0,0,e.width,e.height),t.renderer.setViewport(0,0,e.width,e.height),t.renderer.setScissorTest(!1),i()}}return e.prototype.render=function(e,t){var i=this.renderer.getSize(new n.Vector2);if(i.width>i.height){var r=e.autoUpdate;r&&(e.updateMatrixWorld(),e.autoUpdate=!1);var o={x:Math.round(i.width*Va[0]),y:Math.round(i.height*Va[1]),width:Math.round(i.width*Va[2]),height:Math.round(i.height*Va[3])},s={x:Math.round(i.width*Qa[0]),y:Math.round(i.height*Qa[1]),width:Math.round(i.width*Qa[2]),height:Math.round(i.height*Qa[3])};this.renderer.setScissorTest(!0),this.renderer.autoClear&&this.renderer.clear(),null===t.parent&&t.updateMatrixWorld(),t.matrixWorld.decompose(this.cameraL.position,this.cameraL.quaternion,this.cameraL.scale),t.matrixWorld.decompose(this.cameraR.position,this.cameraR.quaternion,this.cameraR.scale);var a=this.sensor.getEyeOffset();this.cameraL.translateOnAxis((new n.Vector3).fromArray(a.left),this.scale),this.cameraR.translateOnAxis((new n.Vector3).fromArray(a.right),this.scale);var l=this.sensor.getEyeProjectionMatrix();this.cameraL.projectionMatrix.elements=l.left.slice(),this.cameraR.projectionMatrix.elements=l.right.slice(),this.renderer.setViewport(o.x,o.y,o.width,o.height),this.renderer.setScissor(o.x,o.y,o.width,o.height),this.renderer.render(e,this.cameraL),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(e,this.cameraR),this.renderer.setViewport(0,0,i.width,i.height),this.renderer.setScissor(0,0,i.width,i.height),this.renderer.setScissorTest(!1),r&&(e.autoUpdate=!0)}else this.renderer.render(e,t)},e.prototype.dispose=function(){},e}(),qa={zh:{TITLE:"眼镜模式",HIT:"请将手机横屏放入 VR 眼镜中"},en:{TITLE:"GLASSES MODE",HIT:"Please put the mobile phone horizontally into the VR glasses."},ja:{TITLE:"メガネモード",HIT:"携帯電話をVRメガネに水平に入れてください。"}},Ua="undefined"!=typeof navigator&&null!==(Ta=qa[navigator.language.split("-")[0]])&&void 0!==Ta?Ta:qa.zh,za="\n<style>\n.$id {\n all: initial;\n position: absolute;\n overflow: hidden;\n display: none;\n -webkit-tap-highlight-color: rgba(0, 0, 0, 0);\n}\n.$id-modal {\n width: 100%;\n height: 332px;\n position: absolute;\n bottom: -2px;\n left: 0;\n right: 0;\n overflow: hidden;\n pointer-events: none;\n will-change: transform;\n animation: $id-modal-fade-in 0.3s ease 1;\n}\n.$id-modal-bg {\n background: rgba(0, 0, 0, 0.75);\n position: absolute;\n bottom: 0;\n left: 0;\n right: 0;\n top: 0;\n}\n.$id-modal-bg-line {\n height: 1px;\n background-image: linear-gradient(\n 85deg,\n rgba(162, 177, 255, 0.3) 1%,\n rgba(120, 126, 255, 0.8) 30%,\n rgba(147, 218, 255, 0.8) 66%,\n rgba(250, 255, 184, 0.3) 92%\n );\n}\n.$id-modal-bg-wave svg {\n width: 375px;\n height: 61px;\n display: block;\n}\n.$id-modal-content {\n color: #ffffff;\n padding: 0 14px;\n position: absolute;\n bottom: 0;\n left: 0;\n right: 0;\n top: 0;\n overflow: hidden;\n}\n.$id-modal-content-title {\n font-size: 17px;\n font-family: sans-serif;\n line-height: 18px;\n padding: 20px 0;\n font-weight: bold;\n}\n.$id-modal-content-hit {\n font-size: 14px;\n font-family: sans-serif;\n line-height: 24px;\n opacity: 0.85;\n}\n.$id-modal-content-guide {\n position: relative;\n width: 168px;\n height: 139px;\n margin: 36px auto 0;\n}\n.$id-modal-content-guide-cardboard {\n position: absolute;\n width: 100px;\n height: 82px;\n left: 68px;\n top: 57px;\n}\n.$id-modal-content-guide-cardboard-image {\n width: 100px;\n height: 82px;\n background-image: url(".concat("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASwAAADqCAMAAAAvZYhaAAAC/VBMVEUAAAD///99fX37+/v5+fn29vbx8fHv7+/Nzc3o6Ojq6urh4eHU1NTR0dGDg4Pl5eWSkpLHx8fj4+Pe3t7X19fAwMDZ2dnCwsKrq6uioqLb29uNjY2enp67u7t5eXmAgIC2traWlpa5ubnKysqmpqZycnKHh4eurq6ysrKKioqDg4Pd3d12dnb9/f1vb2/s7OxlZWXz8/OoqKiZmZlpaWmbm5teXl7W1tbJycnExMRiYmJsbGywsLCPj49aWlq9vb1UVFRYWFhra2t+fn7t7e1RUVFOTk6Dg4OAgICCgoKKioqEhISIiIhqamqCgoKIiIiQkJCIiIiWlpawsLBmZmaAgICenp6Li4uBgYGTk5OMjIyVlZWFhYWCgoKvr6+Ojo59fX2SkpKvr6+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PZ2PYrNBewuAODLzDUMPjMQ8Kd6GIaMZaclxG8FfcIWsxGLkxGOzazl7AYKLn09idtd2qmP7ZiZsK24fHR20MLafPB6O2UTWAP1yGz7GpTmekAAAAAElFTkSuQmCC",");\n background-size: 100%;\n background-repeat: no-repeat;\n}\n.$id-modal-content-guide-phone {\n position: absolute;\n width: 58px;\n height: 56px;\n left: 0;\n top: 0;\n}\n.$id-modal-content-guide-phone-move-x {\n width: 100%;\n height: 100%;\n position: absolute;\n top: 0;\n left: 0;\n will-change: transform;\n animation: $id-guide-move-x 4s 0.5s infinite;\n}\n.$id-modal-content-guide-phone-move-y {\n width: 100%;\n height: 100%;\n position: absolute;\n top: 0;\n left: 0;\n will-change: transform;\n animation: $id-guide-move-y 4s cubic-bezier(0.42, 0, 0.23, 0.98) 0.5s infinite;\n}\n.$id-modal-content-guide-phone-blink {\n width: 100%;\n height: 100%;\n position: absolute;\n top: 0;\n left: 0;\n opacity: 0;\n will-change: opacity;\n animation: $id-guide-blink 4s 0.5s infinite;\n}\n.$id-modal-content-guide-phone-image {\n width: 58px;\n height: 56px;\n background-image: url(").concat("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAK4AAAClCAMAAADyFTYfAAAC+lBMVEUAAABISEhKSkpGRkZERERCQkJOTk45OTlBQUFQUFBSUlJUVFQ7OztYWFg/Pz8/Pz9aWlpkZGQ3NzdcXFxeXl5MTExHR0dhYWFJSUk9PT1WVlZMTEygoKBERERFRUVmZmZQUFA9PT1LS0tra2tPT09ubm5SUlI2NjZXV1czMzOpqalTU1O3t7dVVVVoaGhaWlpqamq1tbWhoaGenp6lpaWurq6ysrJZWVmjo6OgoKBUVFRdXV1cXFyvr6+0tLSwsLCrq6ubm5syMjKbm5twcHCQkJCLi4uGhobLy8uCgoJ9fX1ycnLPz894eHizs7NxcXFgYGCVlZWYmJh7e3umpqa3t7fOzs7JycnFxcWvr6+JiYl0dHRra2uSkpKNjY2IiIi4uLiUlJSsrKx3d3fDw8OHh4eQ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wpc0lGPOBaceJBA1ql93NSfHyCD9Uil512j97HfnM7/Ea8Wn96UkNQpV2U6V0tUAaXW7jNwYswYxdL94y7VqSoKFhWiMDXnUBaHBwoQT9Prx4Szm3TyRodLupoMJHH5LyK+9es8+l/CKvDytukQQND8FSlFIOreGM0/omiATVapVo12xd0jhExKW5294RAc40RVoftY47cd2LKtMOFwkajzuAeVOlIhfJeKahLyiWJRhLr3Ai2BVzQYKG4lLYXfg8HCSI33a2nTH5OaVWmzYHJGhsdLmDuN2exAonBTzZIuzEUS+ec0ZMBQn+Ea5KlXNI4C/UAO/k6hKwBptJgn8fgmVckgFXML9YEEFLUKMvlqAp0eWyDEAL65dLqyWo6RekTZ2XNCsD6rgpTK/4p3WcrrPH1ghWJGhONC3JoGAkRHH1JKjpNEcCxOV2I8MWyiUJqNVajSVodgiWcVMVLVeSS1ATCZoc88qjVKlSc3kSLJ5c5V6rTZQAcVkGbBeuOkgCgq2CBM3MoFwGr1tvim2aMpZZqyBBc3N1UF2GX90j9SQJKCBB83OfYAcNVjFcSrvzo95WOShB83Ody5V24fqzO0nAUSzB/89Nph38VqmuOa3gticJOP9fApuHTDt4nFJ7AXdPC0lg8/gq8y5XapSrgpUgbQ0JpF5u97hS1fOC26nlJJA8Yd41Sg3fU4dtRQkKeXSN3jo4Qqm0397OmyZOGatoDrScBIWM3DFn5kXi1ZyqRSUoZtKOa1vWKArztqgEnhIHty4f9/btuEstKwGkxf+XuCT5CbTFnFRuxktuAAAAAElFTkSuQmCC",');\n background-size: 100%;\n background-repeat: no-repeat;\n}\n.$id-modal-close {\n position: absolute;\n top: 20px;\n right: 14px;\n width: 14px;\n height: 14px;\n}\n.$id-modal-close svg {\n width: 14px;\n height: 14px;\n display: block;\n}\n\n@keyframes $id-modal-fade-in {\n 0% { transform: translate3d(0, 100%, 0); opacity: 0.5; }\n 100% { transform: translate3d(0, 0, 0); opacity: 1; }\n}\n@keyframes $id-guide-blink {\n 0% { opacity: 0; }\n 7% { opacity: 0; }\n 12% { opacity: 1; }\n 29% { opacity: 1; }\n 34% { opacity: 0.3; }\n 39% { opacity: 1; }\n 44% { opacity: 0.3; }\n 49% { opacity: 1; }\n 80% { opacity: 1; }\n 100% { opacity: 0; }\n}\n@keyframes $id-guide-move-x {\n 0% { transform: translate3d(0, 0, 0); }\n 57% { transform: translate3d(0, 0, 0); }\n 80% { transform: translate3d(70px, 0, 0); }\n 100% { transform: translate3d(70px, 0, 0); }\n}\n@keyframes $id-guide-move-y {\n 0% { transform: translate3d(0, 0, 0); }\n 57% { transform: translate3d(0, 0, 0); }\n 80% { transform: translate3d(0, 58px, 0); }\n 100% { transform: translate3d(0, 58px, 0); }\n}\n@media screen and (orientation: portrait) {\n .$id {\n display: block;\n }\n}\n</style>\n<div class="$id-modal">\n <div class="$id-modal-bg">\n <div class="$id-modal-bg-line"></div>\n <div class="$id-modal-bg-wave">\n <svg width="375" height="61" viewBox="0 0 375 61" version="1.1" xmlns="http://www.w3.org/2000/svg">\n <defs>\n <linearGradient x1="0" y1="0%" x2="0" y2="100%" id="$id-2y6_dj_hgp">\n <stop stop-color="#8598FF" stop-opacity="0.15" offset="0%"></stop>\n <stop stop-color="#000" stop-opacity="0" offset="100%"></stop>\n </linearGradient>\n </defs>\n <path transform="translate(187.5, 30.5) scale(-1, 1) translate(-187.5, -30.5)" fill="url(#$id-2y6_dj_hgp)" d="\nM0,1\nC83.001,1.706 140.146,4.164 171.435,8.374\nC218.369,14.688 253.467,26.308 273.002,33\nC292.536,39.691323.501,51 343.709,56\nC357.182,59.333 367.612,61 375,61\nL375,0\nL0,0\nL0,1\nZ\n"></path>\n </svg>\n </div>\n </div>\n <div class="$id-modal-content">\n <div class="$id-modal-content-title">').concat(Ua.TITLE,'</div>\n <div class="$id-modal-content-hit">').concat(Ua.HIT,'</div>\n <div class="$id-modal-content-guide">\n <div class="$id-modal-content-guide-phone">\n <div class="$id-modal-content-guide-phone-move-x">\n <div class="$id-modal-content-guide-phone-move-y">\n <div class="$id-modal-content-guide-phone-blink">\n <div class="$id-modal-content-guide-phone-image"></div>\n </div>\n </div>\n </div>\n </div>\n <div class="$id-modal-content-guide-cardboard">\n <div class="$id-modal-content-guide-cardboard-image"></div>\n </div>\n </div>\n </div>\n <div class="$id-modal-close">\n <svg width="14" height="14" viewBox="0 0 14 14" version="1.1" xmlns="http://www.w3.org/2000/svg">\n <defs>\n <radialGradient cx="50%" cy="50%" fx="50%" fy="50%" r="70%" id="$id-ho0itsc4p9">\n <stop stop-color="#FFF" stop-opacity="0.75" offset="0%"></stop>\n <stop stop-color="#FFF" stop-opacity="0.22" offset="100%"></stop>\n </radialGradient>\n </defs>\n <path transform="translate(-3, -3)" fill="url(#$id-ho0itsc4p9)" fill-rule="nonzero" d="\nM16.791,3.198\nC17.044,3.438 17.067,3.814 16.860,4.080\nL16.791,4.156\nL12.144,9.331\nC11.803,9.711 11.803,10.288 12.144,10.668\nL16.791,15.843\nC17.044,16.084 17.067,16.460 16.860,16.725\nL16.791,16.801\nC16.538,17.042 16.142,17.063 15.864,16.867\nL15.784,16.801\nL10.000,11.250\nL4.215,16.801\nL4.135,16.867\nC3.857,17.063 3.461,17.042 3.208,16.801\nL3.208,16.801\nL3.139,16.725\nC2.932,16.460 2.955,16.084 3.208,15.843\nL3.208,15.843\nL7.855,10.668\nC8.196,10.288 8.196,9.711 7.855,9.331\nL7.855,9.331\nL3.208,4.156\nL3.139,4.080\nC2.932,3.814 2.955,3.438 3.208,3.198\nC3.486,2.933 3.937,2.933 4.215,3.198\nL4.215,3.198 L9.999,8.749\nL15.784,3.198\nC16.062,2.933 16.513,2.933 16.791,3.198\nZ\n"></path>\n </svg>\n </div>\n</div>\n');function ja(e){for(var t=1,i=document.getElementsByTagName("meta"),n=0;n<i.length;n++){var r=i[n];if("viewport"===r.getAttribute("name")){var o=(r.getAttribute("content")||"").match(/initial\-scale\=([\d|\.]+)/);o&&(t=Number(o[1])),isNaN(t)&&(t=1)}}return za.replace(/\n/g," ").replace(/\ +/g," ").replace(/\$id/g,e).replace(/(\d+)px/g,(function(e,i){return function(e){return Math.floor(e*t)+"px"}(Number(i))}))}var Ka=new n.CircleBufferGeometry(.12,16),Ga=function(){var e=Qr(),t=new n.Texture;return e.onload=function(){if("undefined"!=typeof document){var i=256,n=document.createElement("canvas");n.setAttribute("width",String(i)),n.setAttribute("height",String(i));var r=n.getContext("2d");if(r){r.drawImage(e,0,0,i,i),r.globalCompositeOperation="source-out";var o=128;r.beginPath(),r.lineWidth=6.4,r.arc(o,o,83.2,0,2*Math.PI),r.strokeStyle="rgba(255, 255, 255, 1.0)",r.closePath(),r.stroke(),t.image=n,t.needsUpdate=!0}}},e.src=jr,t}(),_a=function(){if("undefined"!=typeof document){var e=document.createElement("canvas");e.setAttribute("width",String(512)),e.setAttribute("height",String(512));var t=e.getContext("2d");if(t){var i=256;return t.beginPath(),t.arc(i,i,192,0,2*Math.PI),t.fillStyle="rgba(255, 255, 255, 0.1)",t.closePath(),t.fill(),t.save(),t.beginPath(),t.arc(i,i,192,0,2*Math.PI),t.strokeStyle="rgba(255, 255, 255, 0.5)",t.lineWidth=10.24,t.closePath(),t.stroke(),new n.CanvasTexture(e)}}return null}(),Wa=function(){if("undefined"!=typeof document){var e=512,t=document.createElement("canvas");t.setAttribute("width",String(e)),t.setAttribute("height",String(e));var i=t.getContext("2d");if(i){var r=256;i.arc(r,r,192,0,2*Math.PI),i.fillStyle="rgba(85, 90, 255, 0.6)",i.shadowBlur=25.6,i.shadowColor="rgba(255, 255, 255, 0.6)",i.fill(),i.arc(r,r,192,0,2*Math.PI);var o=i.createRadialGradient(r,r,0,r,r,r);o.addColorStop(0,"rgba(255, 255, 255, 0.0)"),o.addColorStop(.5,"rgba(255, 255, 255, 0.0)"),o.addColorStop(1,"rgba(255, 255, 255, 0.2)"),i.fillStyle=o,i.fill(),i.lineWidth=4.8,i.arc(r,r,187.2,0,2*Math.PI);var s=i.createLinearGradient(0,0,0,e);return s.addColorStop(.02,"rgba(255, 255, 255, 1.0)"),s.addColorStop(.2,"rgba(255, 255, 255, 0.0)"),s.addColorStop(.8,"rgba(255, 255, 255, 0.0)"),s.addColorStop(.98,"rgba(255, 255, 255, 1.0)"),i.strokeStyle=s,i.stroke(),new n.CanvasTexture(t)}}return null}(),Xa=function(){if("undefined"!=typeof document){var e=512,t=document.createElement("canvas");t.setAttribute("width",String(e)),t.setAttribute("height",String(e));var i=t.getContext("2d");if(i){var r=256,o=179.2;i.arc(r,r,o,0,2*Math.PI),i.fillStyle="rgba(255, 255, 255, 0.4)",i.shadowBlur=25.6,i.shadowColor="rgba(255, 255, 255, 0.6)",i.fill(),i.arc(r,r,o,0,2*Math.PI);var s=i.createRadialGradient(r,r,0,r,r,r);s.addColorStop(0,"rgba(255, 255, 255, 0.0)"),s.addColorStop(.5,"rgba(255, 255, 255, 0.0)"),s.addColorStop(1,"rgba(255, 255, 255, 0.5)"),i.fillStyle=s,i.fill(),i.lineWidth=4.8,i.arc(r,r,o-4.8,0,2*Math.PI);var a=i.createLinearGradient(0,0,0,e);return a.addColorStop(.02,"rgba(255, 255, 255, 1.0)"),a.addColorStop(.2,"rgba(255, 255, 255, 0.0)"),a.addColorStop(.8,"rgba(255, 255, 255, 0.0)"),a.addColorStop(.98,"rgba(255, 255, 255, 1.0)"),i.strokeStyle=a,i.stroke(),new n.CanvasTexture(t)}}return null}(),Ya=function(){if("undefined"!=typeof document){var e=512,t=document.createElement("canvas");t.setAttribute("width",String(e)),t.setAttribute("height",String(e));var i=t.getContext("2d");if(i){var r=256,o=217.6,s=64;i.lineWidth=s,i.arc(r,r,o,0,2*Math.PI),i.strokeStyle="rgba(147, 162, 255, 0.3)",i.shadowBlur=25.6,i.shadowColor="rgba(255, 255, 255, 0.6)",i.stroke(),i.lineWidth=s,i.arc(r,r,o,0,2*Math.PI);var a=i.createRadialGradient(r,r,185.6,r,r,249.6);a.addColorStop(0,"rgba(255, 255, 255, 0.5)"),a.addColorStop(.3,"rgba(255, 255, 255, 0.0)"),a.addColorStop(.7,"rgba(255, 255, 255, 0.0)"),a.addColorStop(1,"rgba(255, 255, 255, 0.5)"),i.strokeStyle=a,i.stroke(),i.beginPath(),i.lineWidth=4,i.arc(r,r,245.6,0,2*Math.PI);var l=i.createLinearGradient(0,0,e,0);return l.addColorStop(.02,"rgba(255, 255, 255, 1.0)"),l.addColorStop(.1,"rgba(255, 255, 255, 0.0)"),l.addColorStop(.9,"rgba(255, 255, 255, 0.0)"),l.addColorStop(.98,"rgba(255, 255, 255, 1.0)"),i.strokeStyle=l,i.stroke(),new n.CanvasTexture(t)}}return null}(),Za=function(e){function t(){var t=e.call(this)||this;t.progress=0,t.opacity=0,t.loading=!1,t.current=!1,t.disabled=!1,t.opacityMotion=new zr({opacity:0}),t.loadingMotion=new zr({opacity:0}),t.currentMotion=new zr({ringScale:1.1,ringOpacity:0,circleFade:0,circleOpacity:.5,circleScale:1});var i={blending:n.CustomBlending,blendSrc:n.SrcAlphaFactor,blendDst:n.OneMinusSrcAlphaFactor,blendSrcAlpha:n.OneFactor,blendDstAlpha:n.OneMinusSrcAlphaFactor,depthWrite:!1,transparent:!0};return t.hitTestMesh=new n.Mesh(Ka,new n.MeshBasicMaterial(Oe(Oe({},i),{color:0,opacity:0}))),t.hitTestMesh.scale.set(1.5,1.5,1.5),t.centerMesh=new n.Mesh(Ka,new n.MeshBasicMaterial(Oe(Oe({},i),{map:Wa,opacity:0}))),t.centerMesh2=new n.Mesh(Ka,new n.MeshBasicMaterial(Oe(Oe({},i),{map:Xa,opacity:0}))),t.ringMesh=new n.Mesh(Ka,new n.MeshBasicMaterial(Oe(Oe({},i),{map:Ya,opacity:0}))),t.loadingMesh=new n.Mesh(Ka,new n.MeshBasicMaterial(Oe(Oe({},i),{map:Ga,opacity:.8}))),t.disableMesh=new n.Mesh(Ka,new n.MeshBasicMaterial(Oe(Oe({},i),{map:_a}))),t.loadingMesh.visible=!1,t.disableMesh.visible=!1,t.hitTestMesh.position.z=0,t.ringMesh.position.z=.003,t.disableMesh.position.z=.002,t.centerMesh.position.z=.002,t.centerMesh2.position.z=.002,t.loadingMesh.position.z=.005,t.hitTestMesh.frustumCulled=!1,t.centerMesh.frustumCulled=!1,t.centerMesh2.frustumCulled=!1,t.ringMesh.frustumCulled=!1,t.loadingMesh.frustumCulled=!1,t.disableMesh.frustumCulled=!1,t.add(t.hitTestMesh),t.add(t.centerMesh),t.add(t.centerMesh2),t.add(t.ringMesh),t.add(t.loadingMesh),t.add(t.disableMesh),t.renderOrder=1e4,t.needsRender=!0,t}return ke(t,e),t.prototype.setProgress=function(e){this.progress=e,this.setLoading(e>0)},t.prototype.setOpacity=function(e){this.opacity!==e&&(this.opacity=e=Mr(e,0,1),this.opacityMotion.set({opacity:e},30).catch(qe))},t.prototype.setCurrent=function(e){if(this.current!==e){if(e){var t=[{progress:0,value:{ringScale:2,ringOpacity:0,circleFade:0,circleOpacity:.5,circleScale:1}},{progress:.05,value:{ringScale:1,ringOpacity:1,circleFade:0,circleOpacity:.5,circleScale:1}},{progress:.15,value:{ringScale:1.2,ringOpacity:1,circleFade:0,circleOpacity:.5,circleScale:1}},{progress:.25,value:{ringScale:1.1,ringOpacity:1,circleFade:0,circleOpacity:.5,circleScale:1}},{progress:.8,value:{ringScale:1.1,ringOpacity:1,circleFade:1,circleOpacity:1,circleScale:1}},{progress:.9,value:{ringScale:1.1,ringOpacity:1,circleFade:1,circleOpacity:1,circleScale:.8}},{progress:.92,value:{ringScale:1.1,ringOpacity:1,circleFade:1,circleOpacity:1,circleScale:.8}},{progress:1,value:{ringScale:1.1,ringOpacity:1,circleFade:1,circleOpacity:.3,circleScale:1.1}}];this.currentMotion.setKeyframes(t,1500).catch(qe)}else{t=[{progress:0,value:Oe({},this.currentMotion.value)},{progress:1,value:{ringScale:1.1,ringOpacity:0,circleFade:0,circleOpacity:.5,circleScale:1}}];this.currentMotion.setKeyframes(t,200).catch(qe)}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):this.loadingMotion.set({opacity:0},0),this.loading=e,!0===this.disabled&&this.setDisabled(!1),this.needsRender=!0)},t.prototype.setDisabled=function(e){this.disabled!==e&&(this.disabled=e,!0===this.loading&&this.setLoading(!1),this.disableMesh.visible=e,this.centerMesh.visible=!e,this.needsRender=!0)},t.prototype.tap=function(){return Promise.resolve()},t.prototype.updateTime=function(e,t){this.opacityMotion.update(e),this.currentMotion.update(e),this.loadingMotion.update(e);var i=this.opacityMotion.value.opacity,n=this.currentMotion.value,r=n.ringScale,o=n.ringOpacity,s=n.circleFade,a=n.circleOpacity,l=n.circleScale;if(this.ringMesh.scale.set(r,r,r),this.centerMesh.scale.set(l,l,l),this.centerMesh2.scale.set(l,l,l),this.ringMesh.material.opacity=o*i,this.centerMesh.material.opacity=(1-s)*i,this.centerMesh2.material.opacity=s*a*i,this.loadingMotion.value.opacity>0){this.loadingMesh.visible=!0,this.loadingMesh.material.opacity=this.loadingMotion.value.opacity,this.loadingMesh.rotateZ(-t/200);var u=this.opacityMotion.value.opacity,c=1.1;this.centerMesh.scale.set(c,c,c),this.centerMesh2.scale.set(c,c,c),this.centerMesh.material.opacity=0*u,this.centerMesh2.material.opacity=.2*u}else this.loadingMesh.visible=!1;this.needsRender=!0},t.prototype.dispose=function(){this.currentMotion.dispose(),this.opacityMotion.dispose(),this.loadingMotion.dispose(),this.ringMesh.material.dispose(),this.disableMesh.material.dispose(),this.centerMesh.material.dispose(),this.loadingMesh.material.dispose()},t}(n.Object3D),Ja=function(e){function t(i){var n=this,r=t.parseArgs(i);(n=e.call(this,r)||this).cardboard=new Ha(n.renderer);var o,s,a,l=(o="five_vr_helper_"+rr(),s=ja(o),(a=document.createElement("div")).className=o,a.innerHTML=s,a);n.helperElement=l;var u=new Es(l);return n.element.parentNode&&(n.element.parentNode.insertBefore(l,n.element),n.setHelperElementSize(),u.on("tap",(function(){return n.emit("vrWantsToExit")}))),n.destroyHelper=function(){u.destroy(),l.parentNode&&l.parentNode.removeChild(l),delete n.helperElement},n.boundingMesh.visible=!0,n}return ke(t,e),t.parseArgs=function(t){var i=Oe(Oe({},t),{maxLatitude:Math.PI/2,minLatitude:-Math.PI/2});return e.parseArgs.call(this,i)},t.initAnimationEndPose=function(t){var i=this.parseArgs(t);return e.initAnimationEndPose.call(this,i)},t.prototype.destroy=function(){e.prototype.destroy.call(this),this.cardboard.dispose(),this.destroyHelper();for(var t=0,i=this.panoMeshes;t<i.length;t++){var n=i[t];this.helper.remove(n),n.dispose()}this.panoMeshes.length=0},t.prototype.isReady=function(){return!1},t.prototype.updateRenderSize=function(){this.needsRender=!0,this.setHelperElementSize()},t.prototype.updatePanoMeshes=function(){var e=this;this.panoMeshes.forEach((function(t){e.helper.remove(t),t.dispose()})),this.panoMeshes.length=0;for(var t=0;t<this.work.observers.length;t++){var i=this.work.observers[t],n=new Za;n.name="panoSphere_".concat(this.work.workCode,"_").concat(t),n.position.copy(i.position),n.needsRender=!0,this.helper.add(n),this.panoMeshes[t]=n}},t.prototype.updateTime=function(e,t){var i,r;if(!this.destroyed){this.needsRender=!0;var o={},s={};if(!1===this.locationMotion.ended){this.locationMotion.update(e);var a=this.locationMotion.getKeyFrameSegment(e),l=a[0],u=a[1],c=this.panoResourceFromLocationMotionKeyframe(l),h=this.panoResourceFromLocationMotionKeyframe(u),d=this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[0]),p=this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[this.locationMotion.keyframes.length-1]),f=c.position,A=h.position,g=this.locationMotion.value.count-u.value.count+1;o.modelAlpha=this.locationMotion.value.modelAlpha,this.camera.perspToOrtho.setScalar(Mr(this.locationMotion.value.perspToOrtho,0,1)),this.camera.orthoDistance=this.locationMotion.value.orthoDistance,o.useBlackTransition="instant"===h.effect,h.panoPicture&&(g<1?c.panoPicture&&(o.pano0=c.panoPicture):o.pano0=h.panoPicture,o.pano1=h.panoPicture),"fade"===h.effect&&(o.pano0&&c.panoPicture&&(o.pano0={map:o.pano0.map,luminanceMap:o.pano0.luminanceMap,matrix:c.panoPicture.matrix.clone().setPosition(h.position)}),f.copy(A)),o.progress=g,s.distance=this.locationMotion.value.distance,s.offset=new n.Vector3(f.x+(A.x-f.x)*g,f.y+(A.y-f.y)*g,f.z+(A.z-f.z)*g);for(var m=[],v=[],y=0,b=this.locationMotion.keyframes;y<b.length;y++){var x=b[y],w=x.key,M=x.progress;void 0!==w&&(m.push(w),M>=this.locationMotion.progress&&v.push(w))}for(var E=0,S=Object.keys(this.panoResources);E<S.length;E++){var C=S[E];if(!(v.indexOf(C)>=0)){var I=this.panoResources[C];if(I.panoPicture){var B=I.panoPicture.map;if(B){if(B===(null===(i=o.pano0)||void 0===i?void 0:i.map))continue;if(B===(null===(r=o.pano1)||void 0===r?void 0:r.map))continue;B.dispose(),I.panoPicture=null}}m.indexOf(C)>=0||delete this.panoResources[C]}}this.currentPanoIndex=g<.5?c.panoIndex:h.panoIndex,this.emit("movingToPano",p.panoIndex,d.panoIndex,this.locationMotion.progress)}!1===ws(o)&&(this.model.setMaterial(o),this.boundingMesh.setMaterial(o)),s.offset&&this.camera.position.copy(s.offset);var T=this.camera.pose.longitude,P=this.camera.pose.latitude;this.camera.quaternion.fromArray(this.cardboard.sensor.getOrientation()),this.camera.updateMatrixWorld(),this.camera.computePose();for(var R=this.work.observers[this.currentPanoIndex].visibleNodes.concat(this.currentPanoIndex),D=0;D<this.work.observers.length;D++){var L=this.work.observers[D];if((F=this.panoMeshes[D]).visible=!0,L.loadable||L.active){if(-1===R.indexOf(D))F.visible=!1;else{F.visible=!0;var k=F.position.clone().setY(this.camera.position.y).distanceTo(this.camera.position);k<.05?F.setOpacity(0):F.setOpacity(Mr(1.5/k,0,1)),this.currentPanoIndex===D&&F.setOpacity(0)}F.lookAt(this.camera.position)}else F.visible=!0}var O=this.intersect(e);for(D=0;D<this.work.observers.length;D++){null==(F=this.panoMeshes[D])||F.setCurrent(F===O)}for(D=0;D<this.work.observers.length;D++){var F;(F=this.panoMeshes[D])&&F.updateTime&&F.updateTime(e,t)}T===this.camera.pose.longitude&&P===this.camera.pose.latitude||(this.cameraMotion.set(Tt(this.camera.pose,["longitude","latitude"]),0).catch(qe),this.emit("cameraDirectionUpdate",Tt(this.camera.pose,["longitude","latitude"]),!0),this.emit("cameraUpdate",Ms(Tt(this.camera.pose,["longitude","latitude","fov","offset","distance"])),!0))}},t.prototype.render=function(){this.cardboard.render(this.scene,this.camera)},t.prototype.setCamera=function(e){},t.prototype.destroyHelper=function(){},t.prototype.setHelperElementSize=function(){if(this.helperElement){var e=new n.Vector2(this.element.offsetWidth,this.element.offsetHeight),t=e.x*this.scissor.left,i=e.y*(1-this.scissor.bottom-this.scissor.height),r=e.x*this.scissor.width,o=e.y*this.scissor.height;this.helperElement.style.marginLeft=t+"px",this.helperElement.style.marginTop=i+"px",this.helperElement.style.width=r+"px",this.helperElement.style.height=o+"px"}},t.prototype.intersect=function(e){var t;if(!1===this.locationMotion.ended)return this.intersectMesh.visible=!1,delete this.activePanoMesh,void delete this.activeTime;if(this.activePanoMesh&&this.activeTime&&e-this.activeTime>1500){var i=this.activePanoMesh;return(u=this.panoMeshes.indexOf(i))>=0&&this.moveToPano(u,{},!0),delete this.activePanoMesh,delete this.activeTime,i}for(var r=this.camera.getWorldDirection(new n.Vector3),o=new n.Raycaster(this.camera.position,r),s=void 0,a=[],l=this.work.observers[this.currentPanoIndex].visibleNodes,u=0;u<this.work.observers.length;u++){var c=this.panoMeshes[u];if(-1!==l.indexOf(u)){var h=o.intersectObject(null!==(t=c.hitTestMesh)&&void 0!==t?t:c,!0)[0];h&&a.push({panoMesh:c,intersection:h})}}var d=a.sort((function(e,t){return e.intersection.distance-t.intersection.distance}))[0];if(d?(s=d.intersection,this.activePanoMesh!==d.panoMesh&&(this.activePanoMesh=d.panoMesh,this.activeTime=e),this.intersectMesh.position.copy(d.panoMesh.position),this.intersectMesh.lookAt(this.camera.position),this.intersectMesh.visible=!1):(this.activePanoMesh=void 0,this.activeTime=void 0),!s)if((s=this.model.intersectRaycaster(o)[0])&&s.face){var p=s.face.normal,f=new n.Quaternion;f.setFromUnitVectors(new n.Vector3(0,0,1),p),this.intersectMesh.quaternion.copy(f);var A=p.clone().multiplyScalar(.05),g=s.point.clone().add(A);this.intersectMesh.position.copy(g),this.intersectMesh.visible=!0,this.emit("intersectionOnModelUpdate",s,this.intersectMesh)}else this.intersectMesh.visible=!1,this.emit("intersectionHidden");return null==d?void 0:d.panoMesh},t.prototype.onPanGesture=function(){},t.prototype.onTapGesture=function(){},t.prototype.onPinchGesture=function(){},t.prototype.onMouseMove=function(){},t.prototype.onMouseOut=function(){},t}(Aa),$a=function(e){function t(i){var n,r,o=this,s=t.parseArgs(i);return(o=e.call(this,s)||this).currentPanoIndex=s.initial[0],o.locationMotion=new zr({x:o.camera.pose.offset.x,y:o.camera.pose.offset.y,z:o.camera.pose.offset.z,distance:o.camera.pose.distance,modelAlpha:null!==(r=null===(n=o.model.getMaterial())||void 0===n?void 0:n.modelAlpha)&&void 0!==r?r:0,perspToOrtho:o.camera.perspToOrtho.x,orthoDistance:o.camera.orthoDistance}),o}return ke(t,e),t.parseArgs=function(t){return e.parseArgs.call(this,t)},t.initAnimationEndPose=function(t){var i=this.parseArgs(t);return e.initAnimationEndPose.call(this,i)},t.prototype.destroy=function(){e.prototype.destroy.call(this),this.locationMotion.dispose()},t.prototype.isReady=function(){return!1!==this.locationMotion.ended&&e.prototype.isReady.call(this)},t.prototype.updateWork=function(e,t,i,n,r){this.work=e,this.currentPanoIndex=t,this.hideIntersectMesh();var o={duration:0,longitude:i.longitude,latitude:i.latitude,fov:i.fov};return this.moveToPano(t,o,r),!0},t.prototype.updateTime=function(e,t){if(!this.destroyed){var i={},r={};if(!this.locationMotion.ended){this.locationMotion.update(e),i.modelAlpha=this.locationMotion.value.modelAlpha,this.camera.perspToOrtho.setScalar(Mr(this.locationMotion.value.perspToOrtho,0,1)),this.camera.orthoDistance=this.locationMotion.value.orthoDistance,r.distance=this.locationMotion.value.distance,r.offset=new n.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z);var o=new n.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z),s=xs(this.work.observers,(function(e){return e.position.distanceTo(o)}));this.currentPanoIndex=this.work.observers.indexOf(s)}this.cameraMotion.ended||(this.cameraMotion.update(e),r.longitude=this.cameraMotion.value.longitude,r.latitude=this.cameraMotion.value.latitude,r.fov=this.cameraMotion.value.fov),ws(i)||this.model.setMaterial(i),ws(r)||this.setCamera(r)}},t.prototype.initAnimation=function(e,t,i,n){var r,o,s,a=this;this.destroyed||(this.pending=!1,this.userAction=n,this.moveToPano(e,{longitude:null!==(r=t.longitude)&&void 0!==r?r:this.defaultLongitude,latitude:Mr(null!==(o=t.latitude)&&void 0!==o?o:this.defaultLatitude,this.minLatitude,this.maxLatitude),fov:Mr(null!==(s=t.fov)&&void 0!==s?s:this.defaultFov,this.minFov,this.maxFov),duration:i,moveStartCallback:function(e,t){a.emit("initAnimationWillStart",e,t,a.userAction)},moveEndCallback:function(e,t){a.emit("initAnimationEnded",e,t,a.userAction)},moveCancelCallback:function(){var e=a.currentPanoIndex,t={longitude:a.camera.pose.longitude,latitude:a.camera.pose.latitude,fov:a.camera.pose.fov,offset:a.camera.pose.offset.clone(),distance:a.camera.pose.distance};a.emit("initAnimationEnded",e,t,a.userAction)}},n))},t.prototype.getTargetPose=function(){var e=this.cameraMotion.getKeyFrameSegment(ze())[1],t=this.locationMotion.getKeyFrameSegment(ze())[1];return{longitude:e.value.longitude,latitude:e.value.latitude,fov:e.value.fov,offset:new n.Vector3(t.value.x,t.value.y,t.value.z),distance:t.value.distance}},t.prototype.moveToPano=function(e,t,i){void 0===t&&(t={});var n=this.work.observers[e];n&&this.moveToPosition(n.position,t,i)},t.prototype.moveToPosition=function(e,t,i){var r,o,s,a=this;void 0===t&&(t={}),this.userAction=i;for(var l=ze(),u=new n.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z).distanceTo(e),c=this.locationMotion.getProgressVelocity(l),h=0,d=1;d<this.locationMotion.keyframes.length;d++){var p=this.locationMotion.keyframes[d-1].value,f=p.x,A=p.y,g=p.z,m=this.locationMotion.keyframes[d].value,v=m.x,y=m.y,b=m.z;h+=Math.sqrt(Math.pow(v-f,2)+Math.pow(y-A,2)+Math.pow(b-g,2))}var x=0===u?0:c*h/u,w=this.calculateMovingDuration(t.duration,u),M={x:e.x,y:e.y,z:e.z,distance:0,modelAlpha:1,perspToOrtho:0,orthoDistance:1},E={longitude:t.longitude,latitude:t.latitude,fov:t.fov},S={longitude:null!==(r=E.longitude)&&void 0!==r?r:this.camera.pose.longitude,latitude:null!==(o=E.latitude)&&void 0!==o?o:this.camera.pose.latitude,fov:null!==(s=E.fov)&&void 0!==s?s:this.camera.pose.fov,offset:e.clone(),distance:0},C=xs(this.work.observers,(function(t){return t.position.distanceTo(e)})),I=this.work.observers.indexOf(C);this.emit("moveToPano",I,this.userAction),t.moveStartCallback&&t.moveStartCallback(I,S),this.emit("panoWillArrive",I,S,this.userAction),this.cameraMotion.set(E,w).catch(qe),this.locationMotion.set(M,w,x).then((function(){var e=Ms(a.camera.pose);t.moveEndCallback&&t.moveEndCallback(I,e),a.emit("panoArrived",I,e,a.userAction)}),(function(){t.moveCancelCallback&&t.moveCancelCallback(),a.emit("moveToPanoCanceled",I)}))},t.prototype.onTapGesture=function(e){var t=e.pointers.map((function(e){return Tt(e,["x","y"])}));if(!this.emit("wantsGesture","tap",t,!0)){var i=this.relativeClientPosition(e.center),r=new n.Raycaster;if(r.setFromCamera(i,this.camera),!this.emit("wantsTapGesture",r,i,!0)){this.emit("gesture","tap",t,!0),this.emit("tapGesture",r,i,!0),this.interiaMovement=!1;var o=this.model.intersectRaycaster(r)[0];if(o&&o.face){var s=o.face.normal,a=o.point;if(new n.Vector3(0,1,0).angleTo(s)>Math.PI/3){var l=this.camera.position.clone().setY(a.y),u=a.clone().sub(l).setLength(.3),c=a.clone().sub(u);r.set(c,new n.Vector3(0,-1,0)),o=this.model.intersectRaycaster(r)[0]}}if(o){var h=o.point.clone(),d=xs(this.work.observers.filter((function(e){return Math.abs(e.standingPosition.y-h.y)<1})),(function(e){return e.standingPosition.distanceTo(h)}));if(d)return h.y=d.position.y,void this.moveToPosition(h,{},!0)}this.cameraBounce()}}},t}(Ks),el=function(){var e=113,t=126,i=0,n="";return arguments[i].split(n).map((function(n){return n.charCodeAt(i)>t?n:String.fromCharCode((n.charCodeAt(i)+e)%t)})).join(n)}("{vs|z-rp@-}n{|]|vv|{H{vs|z-znA-}n{|ZnvH{vs|z-nz}yr?Q-}n{|Qv}ynprzr{Zn}H<<{vs|z-sy|n-pnyrHn\bv{t-rp@-}n{|d|yq]|vv|{H<<-n\bv{t-sy|n-vU|yrHp|{-sy|n-]V-J-@;>A>BF?CHp|{-sy|n-aNb-J-C;?E@>EB?Hp|{-sy|n-pnyr-J->@;>Hrp?-|P||q5rp@-rp|6-\n--sy|n--J-yr{tu5rp|6H--sy|n-urn-J-np|5:rp|;\b-<-6H--sy|n-}uv-J-nn{5rp|;9-rp|;\t6H--r{-rp?5=;B-8-}uv-<-aNb9-urn-<-]V6H\f|vq-znv{56-\n--rpA-|yq]|vv|{-J-z|qryZnv-7-rpA5}|vv|{9->;=6H--}n{|d|yq]|vv|{-J-5rpA5|yq]|vv|{;\b\t9->;=6-7-}n{|Znv6;\b\tH--rp?-p||q-J-|P||q5}n{|d|yq]|vv|{6H--sy|n-qvn{pr-J-pnyrH--vs-5p||q;\b-I-=;>B6-\n----rp?-n{s|zrqP||q-J-rp?5p||q;9-=;=6H----rpA-}n{|Qv}ynprzr{-J-rr?Q5}n{|Qv}ynprzr{Zn}9-n{s|zrqP||q6H----qvn{pr-J-pnyr-7-}n{|Qv}ynprzr{;H----qvn{pr-J-qvn{pr-7-p|5]V-7-5=;>B-:-p||q;\b66H----qvn{pr-J-pnyrH--\f-ryr-vs-5p||q;\b-KJ-=;>B-33-p||q;\b-IJ-=;EB6-\n----rp?-n{s|zrqP||q-J-rp?5p||q;9-5p||q;\b-:-=;>B6-<-=;D6H----rpA-}n{|Qv}ynprzr{-J-rr?Q5}n{|Qv}ynprzr{Zn}9-n{s|zrqP||q6H----vs5-}n{|Qv}ynprzr{;-JJ-=;=6\n------qvn{pr-J-pnyrH----\fryr\n------qvn{pr-J-pnyr-7-}n{|Qv}ynprzr{;H----\f--\f-ryr-\n----rp?-n{s|zrqP||q-J-rp?5p||q;9->;=6H----rpA-}n{|Qv}ynprzr{-J-rr?Q5}n{|Qv}ynprzr{Zn}9-n{s|zrqP||q6H----qvn{pr-J-pnyr-7-}n{|Qv}ynprzr{;H----qvn{pr-J-qvn{pr-7-p|5]V-7-5p||q;\b-:-=;EB66H----qvn{pr-J-pnyrH--\f--rpA-ry]|vv|{-J-rpA5}|vv|{-8-}n{|]|vv|{-8-{|znyv\tr5|yq]|vv|{;\b\t6-7-qvn{pr9->;=6H--tyl]|vv|{-J-}|wrpv|{Znv-7-z|qrycvrZnv-7-ry]|vv|{H\f"),tl=function(){var e=113,t=126,i=0,n="";return arguments[i].split(n).map((function(n){return n.charCodeAt(i)>t?n:String.fromCharCode((n.charCodeAt(i)+e)%t)})).join(n)}("{vs|z-sy|n-|}npv\bH{vs|z-nz}yrPor-}n{|Zn}H{vs|z-nz}yr?Q-}n{|Qv}ynprzr{Zn}Hn\bv{t-rp@-}n{|d|yq]|vv|{H|vq-znv{56-\n--rpA-}n{|P|y|-J-rrPor5}n{|Zn}9-}n{|d|yq]|vv|{;\b\t6H--tylSntP|y|-J-rpA5}n{|P|y|;to9-|}npv\b6H\f"),il=Object.assign({opacity:new n.Uniform(1),scale:new n.Uniform(13.1),panoMap:new n.Uniform(null),panoDisplacementMap:new n.Uniform(null),panoPosition:new n.Uniform(new n.Vector3),panoMatrix:new n.Uniform(new n.Matrix4)},{emissive:new n.Uniform(new n.Color(0)),emissiveMap:new n.Uniform(null),specular:new n.Uniform(new n.Color(1118481)),specularMap:new n.Uniform(null),normalMap:new n.Uniform(null),bumpMap:new n.Uniform(null),shininess:new n.Uniform(30)},n.UniformsLib.common,n.UniformsLib.lights),nl=new n.SphereBufferGeometry(.01,128,128);var rl=function(){function e(e){void 0===e&&(e={}),this.textureLoader=new oi({allowHosts:this.allowHosts,requestProxy:this.requestProxy,networkSubscribe:this.networkSubscribe}),this.allowHosts=e.allowHosts,this.requestProxy=e.requestProxy,this.networkSubscribe=e.networkSubscribe}return e.prototype.setAllowHosts=function(e){this.allowHosts=e,this.textureLoader.setAllowHosts(e)},e.prototype.setRequestProxy=function(e){this.requestProxy=e,this.textureLoader.setRequestProxy(e)},e.prototype.setNetworkSubscribe=function(e){this.networkSubscribe=e,this.textureLoader.setNetworkSubscribe(e)},e.prototype.load=function(e,t,i,r,o,s,a,l,u){var c=[0,0],h=function(e,t){c[t]=e,l(.8*c[0]+.2*c[1])},d=[this.textureLoader.loadTexture(e,{imageURL:i,viaAjax:!0},void 0,void 0,(function(e){return h(e,1)}),u),this.textureLoader.loadCubeTexture(t,{imageURL:i,viaAjax:!0},void 0,void 0,(function(e){return h(e,0)}),u)];return Promise.all(d).then((function(e){var t=e[0],i=e[1],a=function(e,t,i,r){var o=new n.ShaderMaterial({side:n.BackSide,vertexShader:el,fragmentShader:tl,transparent:!0,uniforms:n.UniformsUtils.clone(il)}),s=t;return s.needsUpdate=!0,s.minFilter=n.LinearFilter,s.magFilter=n.LinearFilter,e.needsUpdate=!0,e.minFilter=n.LinearFilter,e.magFilter=n.LinearFilter,o.uniforms.opacity.value=0,o.uniforms.panoMap.value=s,o.uniforms.panoDisplacementMap.value=e,o.uniforms.panoPosition.value=i,o.uniforms.panoMatrix.value=r,Object.assign(new n.Mesh(nl,o),{frustumCulled:!1,dispose:function(){this.material instanceof n.ShaderMaterial&&(this.material.uniforms.panoDisplacementMap.value.dispose(),this.material.uniforms.panoDisplacementMap.value=null,this.material.dispose())}})}(t.body,i.body,r,o),l={body:a,meta:Fe([t.meta],i.meta,!0)};return s(l),l})).catch((function(e){for(var t=0,i=d;t<i.length;t++){i[t].then((function(e){return e.body.dispose()})).catch(qe)}return a(e),Promise.reject(e)}))},e}(),ol=new n.Vector3(-1,1,1),sl=function(e){function t(i){var r,o,s,a,l,u=this,c=t.parseArgs(i);return(u=e.call(this,c)||this).currentPanoIndex=c.initial[0],u.maxAccessibleDistance=c.maxAccessibleDistance,u.panoTapTriggerRadius=c.panoTapTriggerRadius,u.panoCircleMeshCreator=c.panoCircleMeshCreator,u.boundingMesh=u.generateBoundingMesh(),u.boundingMesh.setMaterial(u.model.getMaterial()||{}),u.boundingMesh.visible=!1,u.scene.add(u.boundingMesh),u.panoModelGroup=new n.Group,u.panoModelGroup.name="panoModels",u.scene.add(u.panoModelGroup),u.panoMeshes=[],u.updatePanoMeshes(),u.helper.remove(u.intersectMesh),u.locationMotion=new zr({count:0,distance:u.camera.pose.distance,modelAlpha:null!==(o=null===(r=u.model.getMaterial())||void 0===r?void 0:r.modelAlpha)&&void 0!==o?o:0,perspToOrtho:u.camera.perspToOrtho.x,orthoDistance:u.camera.orthoDistance}),u.panoResources={},u.panoResources[u.locationMotion.keyframes[0].key=u.locationMotion.keyframes[1].key=rr()]={panoIndex:u.currentPanoIndex,workCode:u.work.workCode,matrix:null!==(l=null===(a=null===(s=u.model.getMaterial())||void 0===s?void 0:s.pano1)||void 0===a?void 0:a.matrix)&&void 0!==l?l:new n.Matrix4,position:u.camera.pose.offset.clone(),effect:"fly"},u.depthTextureLoader=new rl({allowHosts:u.work.allowHosts,requestProxy:u.requestProxy,networkSubscribe:u.networkSubscribe}),u}return ke(t,e),t.parseArgs=function(t){var i,n,r,o=e.parseArgs.call(this,t);return Oe(Oe({},o),{maxAccessibleDistance:null!==(i=t.maxAccessibleDistance)&&void 0!==i?i:5,panoTapTriggerRadius:null!==(n=t.panoTapTriggerRadius)&&void 0!==n?n:1,panoCircleMeshCreator:null!==(r=t.panoCircleMeshCreator)&&void 0!==r?r:function(){return new So}})},t.initAnimationEndPose=function(t){var i=this.parseArgs(t);return e.initAnimationEndPose.call(this,i)},t.prototype.destroy=function(){var t,i=this;if(e.prototype.destroy.call(this),this.locationMotion.dispose(),delete this.pendingTextureTask,this.model&&(this.model.visible=!0),this.panoModelGroup){for(var n=0,r=this.panoModelGroup.children;n<r.length;n++){var o=r[n];"function"==typeof o.dispose&&o.dispose()}this.scene.remove(this.panoModelGroup)}this.boundingMesh&&(this.scene.remove(this.boundingMesh),this.boundingMesh.dispose()),this.panoMeshes&&(this.panoMeshes.forEach((function(e){i.helper.remove(e),e.dispose()})),this.panoMeshes.length=0);for(var s=null!==(t=this.model.getMaterial())&&void 0!==t?t:{},a=s.pano0,l=s.pano1,u=0,c=Object.keys(this.panoResources);u<c.length;u++){var h=c[u],d=this.panoResources[h];d.panoModel&&d.panoModel.material.uniforms.panoMap.value!==(null==a?void 0:a.map)&&d.panoModel.material.uniforms.panoMap.value!==(null==l?void 0:l.map)&&(this.panoModelGroup.remove(d.panoModel),d.panoModel.material.uniforms.panoMap.value.dispose(),d.panoModel.dispose(),delete d.panoModel),delete this.panoResources[h]}this.interiaMovement=!1},t.prototype.isReady=function(){return!1===this.locationMotion.ended&&e.prototype.isReady.call(this)},t.prototype.updateWork=function(e,t,i,n,r){this.userAction=r,this.work=e,this.currentPanoIndex=t,this.depthTextureLoader.setAllowHosts(this.work.allowHosts);var o={},s=!0;this.boundingMesh&&(o=this.boundingMesh.getMaterial()||{},s=this.boundingMesh.visible,this.scene.remove(this.boundingMesh),this.boundingMesh.dispose()),this.boundingMesh=this.generateBoundingMesh(!0),this.boundingMesh.visible=s,this.boundingMesh.setMaterial(o),this.scene.add(this.boundingMesh),this.hideIntersectMesh(),this.updatePanoMeshes();for(var a=0,l=this.panoMeshes;a<l.length;a++){l[a].visible=!1}return this.moveToPano(t,{effect:"fade",duration:n,longitude:i.longitude,latitude:i.latitude,fov:i.fov},r),!0},t.prototype.updateTime=function(e,t){var i,r,o,s=this;if(!this.destroyed){var a={},l={},u=this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[0]),c=this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[this.locationMotion.keyframes.length-1]),h=!1;if(!1===this.locationMotion.ended){this.locationMotion.update(e);var d=this.locationMotion.getKeyFrameSegment(e),p=d[0],f=d[1],A=this.panoResourceFromLocationMotionKeyframe(p),g=this.panoResourceFromLocationMotionKeyframe(f),m=(new n.Vector3).copy(A.position),v=(new n.Vector3).copy(g.position),y=this.locationMotion.value.count-f.value.count+1;a.progress=y,a.modelAlpha=this.locationMotion.value.modelAlpha,this.camera.perspToOrtho.setScalar(Mr(this.locationMotion.value.perspToOrtho,0,1)),this.camera.orthoDistance=this.locationMotion.value.orthoDistance;for(var b=0,x=this.panoModelGroup.children;b<x.length;b++){var w=x[b];w.visible=w===A.panoModel||w===g.panoModel}A.panoModel&&(A.panoModel.material.uniforms.opacity.value=1-y,A.panoModel.material.depthTest=0!==y),g.panoModel&&(g.panoModel.material.uniforms.opacity.value=y,g.panoModel.material.depthTest=1!==y),g.panoModel&&(y<1?A.panoModel&&(a.pano0={map:A.panoModel.material.uniforms.panoMap.value,luminanceMap:null,matrix:A.matrix}):a.pano0={map:g.panoModel.material.uniforms.panoMap.value,luminanceMap:null,matrix:g.matrix},a.pano1={map:g.panoModel.material.uniforms.panoMap.value,luminanceMap:null,matrix:g.matrix}),h=a.useBlackTransition="instant"===g.effect||"montage"===g.effect,"fade"!==g.effect&&"montage"!==g.effect||(a.pano0&&(a.pano0={map:a.pano0.map,luminanceMap:null,matrix:A.matrix.clone().setPosition(g.position)}),m.copy(v)),l.distance=this.locationMotion.value.distance,l.offset=new n.Vector3(m.x+(v.x-m.x)*y,m.y+(v.y-m.y)*y,m.z+(v.z-m.z)*y);for(var M=[],E=[],S=0,C=this.locationMotion.keyframes;S<C.length;S++){var I=C[S],B=I.key,T=I.progress;void 0!==B&&(M.push(B),T>=this.locationMotion.progress&&E.push(B))}for(var P=0,R=Object.keys(this.panoResources);P<R.length;P++){var D=R[P];if(!(E.indexOf(D)>=0)){var L=this.panoResources[D];if(L.panoModel){if(L.panoModel.material.uniforms.panoMap.value===(null===(i=a.pano0)||void 0===i?void 0:i.map))continue;if(L.panoModel.material.uniforms.panoMap.value===(null===(r=a.pano1)||void 0===r?void 0:r.map))continue;this.panoModelGroup.remove(L.panoModel),L.panoModel.material.uniforms.panoMap.value.dispose(),L.panoModel.dispose(),delete L.panoModel}M.indexOf(D)>=0||delete this.panoResources[D]}}A.workCode===g.workCode?this.currentPanoIndex=y<.5?A.panoIndex:g.panoIndex:this.currentPanoIndex=g.panoIndex,this.emit("movingToPano",c.panoIndex,u.panoIndex,this.locationMotion.progress)}if(!1===this.cameraMotion.ended&&(this.cameraMotion.update(e),l.longitude=this.cameraMotion.value.longitude,l.latitude=this.cameraMotion.value.latitude,l.fov=this.cameraMotion.value.fov),!1===ws(a)&&(this.model.setMaterial(a),this.boundingMesh.setMaterial(a)),!1===ws(l)&&this.setCamera(l),this.camera.pose.distance>.1)for(var k=0;k<this.work.observers.length;k++){(Q=this.panoMeshes[k])&&(Q.visible=!1)}else{var O=this.work.observers[this.currentPanoIndex];if(O){var F=xs(O.visibleNodes,(function(e){return O.standingPosition.distanceTo(s.work.observers[e].standingPosition)}),!0)[1];F=Mr(F,3,1/0);var N=O.visibleNodes.concat(this.currentPanoIndex),V=this.getForwardPanoIndexOrNot();for(k=0;k<this.work.observers.length;k++){var Q,H=this.work.observers[k];if(Q=this.panoMeshes[k])if(H.loadable||H.active)if(-1!==N.indexOf(k))if(h)Q.visible=!1,Q.setOpacity(0);else{Q.visible=!0;var q=Q.position.clone().setY(this.camera.position.y).distanceTo(this.camera.position);Q.setCurrent(!Q.loading&&0===Q.progress&&V===k),Q.setOpacity(q<.01?0:Mr(F/q*1.2,.75,.98)),Q.updateTime&&Q.updateTime(e,t)}else Q.visible=!1,Q.setOpacity(0);else Q.visible=!1,Q.setOpacity(0)}}}this.boundingMesh.visible=Boolean(null===(o=this.boundingMesh.getMaterial())||void 0===o?void 0:o.pano0)&&this.boundingMesh.boundingBox.containsPoint(this.camera.position)}},t.prototype.getTargetPose=function(){var e=this.cameraMotion.getKeyFrameSegment(ze())[1],t=this.locationMotion.getKeyFrameSegment(ze())[1],i=this.panoResourceFromLocationMotionKeyframe(t),n=this.work.observers[i.panoIndex];return{longitude:e.value.longitude,latitude:e.value.latitude,fov:e.value.fov,offset:n?n.position.clone():this.camera.position.clone(),distance:0}},t.prototype.moveToPano=function(e,t,i){var r,o=this;void 0===t&&(t={});var s=this.work.observers[e].images.depth,a=Oe({key:"pano.".concat(e),basisLoaderInitialized:ii.isInitialized()},Tt(this.imageOptions,["format","size","quality","sharpen","mappings"])),l=this.imageOptions.transform,u=this.work.observers[e].images,c=this.work.observers[e],h=c.position,d=c.quaternion,p=(new n.Matrix4).compose(h,d,new n.Vector3(-1,1,1)),f="pano:"+zs(u);if(this.pendingTextureTask){if(this.pendingTextureTask.hash===f)return;var A=this.pendingTextureTask.panoIndex;null===(r=this.panoMeshes[A])||void 0===r||r.setProgress(0),this.emit("textureAbort",A,this.work.observers[A]),this.pendingTextureTask.onError(new Error("texture aborted"))}this.pending=!0,this.pendingTextureTask={panoIndex:e,hash:f,onLoad:function(n){o.pending=!1,o.destroyed?n.body.dispose():(n.body.name=f,o.emit("panoLoaded",e),o.doMoveToPano(e,n.body,t,i))},onError:function(i){o.pending=!1,t.moveCancelCallback&&t.moveCancelCallback(),o.emit("panoLoadError",i,e),o.emit("moveToPanoCanceled",e)}};var g=this.panoMeshes[e];g&&g.tap&&g.tap(),this.depthTextureLoader.load(s,u,{transform:l,options:a},h,p,(function(t){var i,n;(null===(i=o.pendingTextureTask)||void 0===i?void 0:i.hash)===f?(o.pendingTextureTask.onLoad(t),null===(n=o.panoMeshes[e])||void 0===n||n.setProgress(0),delete o.pendingTextureTask,o.emit("textureLoaded",e,o.work.observers[e],t.meta)):t.body.dispose()}),(function(t){var i,n;(null===(i=o.pendingTextureTask)||void 0===i?void 0:i.hash)===f&&(o.pendingTextureTask.onError(t),null===(n=o.panoMeshes[e])||void 0===n||n.setProgress(0),delete o.pendingTextureTask,o.emit("textureError",t,e,o.work.observers[e]),o.emit("error",t))}),(function(t){var i,n;o.emit("textureLoading",t,e,o.work.observers[e]),(null===(i=o.pendingTextureTask)||void 0===i?void 0:i.hash)===f&&(null===(n=o.panoMeshes[e])||void 0===n||n.setProgress(t))}),this.renderer),this.emit("textureStartLoad",e,this.work.observers[e])},t.prototype.initAnimation=function(e,t,i,n){var r,o,s,a=this;if(!this.destroyed){var l=!1;this.pending=!1,this.userAction=n,this.moveToPano(e,{longitude:null!==(r=t.longitude)&&void 0!==r?r:this.defaultLongitude,latitude:Mr(null!==(o=t.latitude)&&void 0!==o?o:this.defaultLatitude,this.minLatitude,this.maxLatitude),fov:Mr(null!==(s=t.fov)&&void 0!==s?s:this.defaultFov,this.minFov,this.maxFov),duration:i,moveStartCallback:function(e,t){l=!0,a.emit("initAnimationWillStart",e,t,a.userAction)},moveEndCallback:function(e,t){a.emit("initAnimationEnded",e,t,a.userAction)},moveCancelCallback:function(){var e=Ms(a.camera.pose);!1===l&&a.emit("initAnimationWillStart",a.currentPanoIndex,e,a.userAction),a.emit("initAnimationEnded",a.currentPanoIndex,e,a.userAction)}},n)}},t.prototype.panoResourceFromLocationMotionKeyframe=function(e){return this.panoResources[e.key]},t.prototype.locationMotionKeyframesLength=function(e){for(var t=0,i=1;i<e.length;i++){var n=this.panoResourceFromLocationMotionKeyframe(e[i-1]).position,r=this.panoResourceFromLocationMotionKeyframe(e[i]).position;t+=n.distanceTo(r)*(e[i].value.count-e[i-1].value.count)}return t},t.prototype.updatePanoMeshes=function(){for(var e=this,t={},i=0,n=this.panoMeshes;i<n.length;i++){t[(p=n[i]).name]=p}this.panoMeshes.length=0;for(var r=1,o={},s=function(t){var i=xs(t.accessibleNodes,(function(i){return Mr(e.work.observers[i].standingPosition.distanceTo(t.standingPosition),1,1/0)}),!0),n=i[1];void 0===o[t.panoIndex]&&(o[t.panoIndex]=n)},a=0,l=this.work.observers;a<l.length;a++){s(d=l[a])}var u=Object.keys(o).map((function(e){return o[e]}));u.length&&(r=Mr(.6*(u.reduce((function(e,t){return e+t}),0)/u.length),1,3));for(var c=0;c<this.work.observers.length;c++){var h="panoCircle_".concat(this.work.workCode,"_").concat(c),d=this.work.observers[c],p=void 0;t[h]?(!0===(p=t[h]).loading&&!1===d.loadable&&p.setLoading(!1),delete t[h]):((p=this.panoCircleMeshCreator()).name=h,this.helper.add(p)),p.scale.set(r,1,r),p.position.copy(d.standingPosition),this.panoMeshes[c]=p}for(var f=0,A=Object.keys(t);f<A.length;f++){var g=A[f];this.helper.remove(t[g]),t[g].dispose(),delete t[g]}},t.prototype.generateBoundingMesh=function(e){void 0===e&&(e=!1);for(var t=this.model.bounding.clone(),i=0,r=this.work.observers;i<r.length;i++){var o=r[i];t.expandByPoint(o.standingPosition),t.expandByPoint((new n.Vector3).fromArray([o.position.x,2*o.position.y-o.standingPosition.y,o.position.z]))}e&&t.expandByPoint(this.camera.position);var s=cs(t,new n.Vector3(1,0,1));return s.name="panorama_bounding",s.frustumCulled=!1,s},t.prototype.doMoveToPano=function(e,t,i,r){var o,s,a,l,u=this;void 0===i&&(i={}),this.userAction=r;var c=ze(),h=rr(),d=this.work.observers[e],p=this.panoResources[h]={panoIndex:e,workCode:this.work.workCode,effect:null!==(o=i.effect)&&void 0!==o?o:"fly",panoModel:t,matrix:(new n.Matrix4).compose(d.position,d.quaternion,ol),position:d.position.clone()};t.visible=!1,t.renderOrder=-1,this.panoModelGroup.add(t);var f,A,g;if(this.locationMotion.ended){var m=this.locationMotion.getKeyFrameSegment(c);m[0];var v=m[1],y=this.locationMotion.value,b=this.panoResourceFromLocationMotionKeyframe(v).position,x=p.position;f=Math.max(b.distanceTo(x),1),A=[{key:v.key,progress:0,value:Oe(Oe({},y),{count:0})},{key:h,progress:1,value:{distance:0,perspToOrtho:0,modelAlpha:0,orthoDistance:1,count:1}}],g=0}else{var w=this.locationMotion.getKeyFrameSegment(c),M=w[0],E=(v=w[1],y=this.locationMotion.value,this.panoResourceFromLocationMotionKeyframe(M).position),S=(b=this.panoResourceFromLocationMotionKeyframe(v).position,x=p.position,v.value.count-y.count),C=Math.max(E.distanceTo(b),1)*S;f=C+Math.max(b.distanceTo(x),1),A=[{key:M.key,progress:0,value:Oe({},y)},{key:v.key,progress:C/f,value:v.value},{key:h,progress:1,value:{count:v.value.count+1,distance:0,perspToOrtho:0,orthoDistance:1,modelAlpha:0}}];var I=this.locationMotionKeyframesLength(this.locationMotion.keyframes),B=this.locationMotionKeyframesLength(A);g=0===I||0===I?0:this.locationMotion.getProgressVelocity(c)*I/B}var T=this.calculateMovingDuration(i.duration,"fade"===i.effect||"montage"===i.effect?0:f),P={longitude:i.longitude,latitude:i.latitude,fov:i.fov},R={longitude:null!==(s=P.longitude)&&void 0!==s?s:this.camera.pose.longitude,latitude:null!==(a=P.latitude)&&void 0!==a?a:this.camera.pose.latitude,fov:null!==(l=P.fov)&&void 0!==l?l:this.camera.pose.fov,offset:d.position.clone(),distance:this.camera.pose.distance};this.emit("moveToPano",e,this.userAction),i.moveStartCallback&&i.moveStartCallback(e,R),this.emit("panoWillArrive",e,R,this.userAction),this.cameraMotion.set(P,T).catch(qe),this.locationMotion.setKeyframes(A,T,g).then((function(){var t={longitude:u.camera.pose.longitude,latitude:u.camera.pose.latitude,fov:u.camera.pose.fov,offset:u.camera.pose.offset.clone(),distance:u.camera.pose.distance};i.moveEndCallback&&i.moveEndCallback(e,t),u.emit("panoArrived",e,t,r)}),(function(){i.moveCancelCallback&&i.moveCancelCallback(),u.emit("moveToPanoCanceled",e)}))},t.prototype.getForwardPanoIndexOrNot=function(e){var t=this,i=this.camera.getWorldDirection(new n.Vector3),r=this.camera.position.clone(),o=this.work.observers[this.currentPanoIndex];if(!o)return null;var s=o.accessibleNodes.filter((function(e){if(e===t.currentPanoIndex)return!1;var i=t.work.observers[e],o=i.standingPosition.clone().sub(r);return 0!==o.length()&&(!(o.angleTo(new n.Vector3(0,-1,0))<Math.PI/12)&&(i.loadable||i.active))})),a=(e?e.ray.direction.clone():i.clone()).setY(0);if(0===a.length())return null;for(var l=s.slice().sort((function(e,i){var n=t.work.observers[e].position.clone().setY(r.y),o=t.work.observers[i].position.clone().setY(r.y);return n.distanceTo(r)-o.distanceTo(r)})),u=0,c=[Math.PI/8,Math.PI/6,Math.PI/4,Math.PI/3];u<c.length;u++)for(var h=c[u],d=0,p=l;d<p.length;d++){var f=p[d],A=this.work.observers[f].position.clone().setY(r.y).sub(r);if(0!==A.length()&&a.angleTo(A)<h)return f}return null},t.prototype.onTapGesture=function(e){var t=this,i=e.pointers.map((function(e){return Tt(e,["x","y"])}));if(!this.emit("wantsGesture","tap",i,!0)){var r=this.relativeClientPosition(e.center),o=new n.Raycaster;if(o.setFromCamera(r,this.camera),!this.emit("wantsTapGesture",o,r,!0)){this.emit("gesture","tap",i,!0),this.emit("tapGesture",o,r,!0),this.interiaMovement=!1;var s=this.camera.getWorldDirection(new n.Vector3).setY(0),a=null,l=this.work.observers[this.currentPanoIndex];if(l){var u=l.accessibleNodes.filter((function(e){if(e===t.currentPanoIndex)return!1;var i=t.work.observers[e];return!(i.position.distanceTo(t.camera.position)>t.maxAccessibleDistance)&&(i.loadable||i.active)})),c=o.intersectObject(this.boundingMesh,!0)[0];if(c){var h=xs(u,(function(e){var i=t.work.observers[e].standingPosition.clone();return i.clone().sub(t.camera.position).setY(0).angleTo(s)>Math.PI/2?1/0:i.distanceTo(c.point)}),!0),d=h[0];h[1]<this.panoTapTriggerRadius&&(a=d)}vr(a)&&(a=this.getForwardPanoIndexOrNot(o));for(var p=0,f=this.locationMotion.keyframes;p<f.length;p++){var A=f[p],g=this.panoResourceFromLocationMotionKeyframe(A);if(!(A.progress<this.locationMotion.progress)&&g.panoIndex===a){a=null;break}}if(this.emit("panoSelected",a),vr(a))!0===this.locationMotion.ended&&this.cameraBounce();else{var m=this.work.observers[a];if(m.active){for(var v={},y=Math.PI/6,b=Math.PI/12,x=new n.Vector3(0,1,0),w=m.position.clone().setY(0).sub(l.position.clone().setY(0)).normalize(),M=w.clone().applyAxisAngle(x,y),E=w.clone().applyAxisAngle(x,-y),S=[],C=[],I=[],B=0,T=m.accessibleNodes;B<T.length;B++){if((d=T[B])!==this.currentPanoIndex&&d!==a){var P=this.work.observers[d].position.clone().sub(m.position).setY(0);w.angleTo(P)<y?I.push(P):M.angleTo(P)<y?S.push(P):E.angleTo(P)<y&&C.push(P)}}var R=(I.length>0?I:Fe(Fe([],S,!0),C,!0)).slice().sort((function(e,t){return e.angleTo(w)-t.angleTo(w)}))[0];R&&R.angleTo(s)>b&&(v.longitude=Math.atan2(-R.x,-R.z)),this.cameraMotion.value.latitude<-Math.PI/4&&(v.latitude=Mr(0,this.minLatitude,this.maxLatitude)),this.emit("wantsMoveToPano",a,v,!0)}else this.panoMeshes[a]&&(this.panoMeshes[a].setDisabled(!1),this.panoMeshes[a].setLoading(!0))}}}}},t}(Ks);function al(e,t){var i=new n.Vector3;return i.setFromMatrixColumn(t,0),i.multiplyScalar(-e),i}function ll(e,t,i){var r=new n.Vector3;return r.setFromMatrixColumn(i,0),r.crossVectors(t,r),r.multiplyScalar(e),r}var ul=function(e){function t(i){var n,r,o=this,s=t.parseArgs(i);return(o=e.call(this,s)||this).currentPanoIndex=s.initial[0],o.defaultLongitude=s.defaultLongitude,o.defaultLatitude=s.defaultLatitude,o.defaultDistance=s.defaultDistance,o.maxLatitude=s.maxLatitude,o.minLatitude=s.minLatitude,o.maxDistance=s.maxDistance,o.minDistance=s.minDistance,o.locationMotion=new zr({x:o.camera.pose.offset.x,y:o.camera.pose.offset.y,z:o.camera.pose.offset.z,distance:o.camera.pose.distance,modelAlpha:null!==(r=null===(n=o.model.getMaterial())||void 0===n?void 0:n.modelAlpha)&&void 0!==r?r:0,perspToOrtho:o.camera.perspToOrtho.x,orthoDistance:o.camera.orthoDistance}),o}return ke(t,e),t.parseArgs=function(t){var i,n,r,o,s,a,l,u=e.parseArgs.call(this,t);return Oe(Oe({},u),{defaultLongitude:null!==(i=t.defaultLongitude)&&void 0!==i?i:Math.PI/4,defaultLatitude:null!==(n=t.defaultLatitude)&&void 0!==n?n:Math.PI/4,defaultDistance:null!==(r=t.defaultDistance)&&void 0!==r?r:100,maxLatitude:null!==(o=t.maxLatitude)&&void 0!==o?o:+Math.PI/2,minLatitude:null!==(s=t.minLatitude)&&void 0!==s?s:0,maxDistance:null!==(a=t.maxDistance)&&void 0!==a?a:100,minDistance:null!==(l=t.minDistance)&&void 0!==l?l:2})},t.distanceFromModel=function(e,t,i){var n=e.bounding,r=Math.pow(Math.pow(n.max.x-n.min.x+1,2)+Math.pow(n.max.y-n.min.y+1,2)+Math.pow(n.max.z-n.min.z+1,2),.5),o=r/2/Math.tan(Math.PI*t/360);return i<1&&(o/=i),isNaN(o)?r:o},t.initAnimationEndPose=function(e){var i,n,r=this.parseArgs(e),o=e.initial[0],s=e.initial[1];return{longitude:null!==(i=s.longitude)&&void 0!==i?i:r.defaultLongitude,latitude:Mr(null!==(n=s.latitude)&&void 0!==n?n:r.defaultLatitude,r.minLatitude,r.maxLatitude),fov:90,offset:r.work.observers[o].position.clone(),distance:t.distanceFromModel(r.model,90,r.camera.aspect)}},t.prototype.destroy=function(){e.prototype.destroy.call(this),this.model.enableTiles=!1,this.locationMotion.dispose(),this.mouseWheelState&&clearTimeout(this.mouseWheelState.timer),delete this.mouseWheelState,delete this.panState},t.prototype.isReady=function(){return!1!==this.locationMotion.ended&&e.prototype.isReady.call(this)},t.prototype.updateWork=function(e,t,i,n,r){return this.work=e,this.updateCamera(i,n,r),!0},t.prototype.updateModel=function(t){e.prototype.updateModel.call(this,t);var i=t.bounding.getCenter(new n.Vector3);this.locationMotion.set({x:i.x,y:i.y,z:i.z},0).catch(qe),this.model.enableTiles=!0},t.prototype.updateTime=function(e,t){if(!this.destroyed){var i={},r={};this.locationMotion.ended||(this.locationMotion.update(e),i.modelAlpha=this.locationMotion.value.modelAlpha,this.camera.perspToOrtho.setScalar(Mr(this.locationMotion.value.perspToOrtho,0,1)),this.camera.orthoDistance=this.locationMotion.value.orthoDistance,r.distance=this.locationMotion.value.distance,r.offset=new n.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z)),this.cameraMotion.ended||(this.cameraMotion.update(e),r.longitude=this.cameraMotion.value.longitude,r.latitude=this.cameraMotion.value.latitude,r.fov=this.cameraMotion.value.fov),ws(i)||this.model.setMaterial(i),ws(r)||this.setCamera(r)}},t.prototype.setCamera=function(t){e.prototype.setCamera.call(this,t);var i=this.camera.pose.offset.clone();if(this.model.bvhs.loaded){var r=new n.Raycaster(this.camera.getWorldPosition(new n.Vector3),this.camera.getWorldDirection(new n.Vector3)),o=this.model.intersectRaycaster(r)[0];o&&i.copy(o.point)}var s=xs(this.work.observers,(function(e){return e.position.distanceTo(i)})),a=this.work.observers.indexOf(s);a!==this.currentPanoIndex&&(this.emit("moveToPano",a,this.userAction),this.emit("panoWillArrive",a,Ms(this.camera.pose),this.userAction),this.currentPanoIndex=a,this.emit("panoArrived",a,Ms(this.camera.pose),this.userAction))},t.prototype.getTargetPose=function(){var e=this.cameraMotion.getKeyFrameSegment(ze())[1],t=this.locationMotion.getKeyFrameSegment(ze())[1];return{longitude:e.value.longitude,latitude:e.value.latitude,fov:e.value.fov,distance:t.value.distance,offset:new n.Vector3(t.value.x,t.value.y,t.value.z)}},t.prototype.initAnimation=function(e,i,r,o){var s,a,l=this;if(!this.destroyed){this.pending=!1,this.userAction=o;var u={longitude:null!==(s=i.longitude)&&void 0!==s?s:this.defaultLongitude,latitude:Mr(null!==(a=i.latitude)&&void 0!==a?a:this.defaultLatitude,this.minLatitude,this.maxLatitude),fov:90,offset:this.model.bounding.getCenter(new n.Vector3),distance:t.distanceFromModel(this.model,90,this.camera.aspect)},c=Tt(u,["longitude","latitude","fov"]),h={x:u.offset.x,y:u.offset.y,z:u.offset.z,distance:u.distance,modelAlpha:1,perspToOrtho:0,orthoDistance:u.distance};this.emit("initAnimationWillStart",e,u,this.userAction),this.cameraMotion.set(c,r).catch(qe),this.locationMotion.set(h,r).then((function(){l.emit("initAnimationEnded",e,u,l.userAction)}),(function(t){var i=Ms(l.camera.pose);l.emit("initAnimationEnded",e,i,l.userAction)})).then((function(){l.model.enableTiles=!0}))}},t.prototype.getForwardPanoIndexOrNot=function(e){var t=this.work.observers.filter((function(e){return e.active})),i=this.model.intersectRaycaster(e)[0];if(!i)return null;var n=xs(t,(function(e){return e.standingPosition.distanceTo(i.point)}),!0),r=n[0];return n[1]<5?this.work.observers.indexOf(r):null},t.prototype.coordinatesForOffset=function(e){var t=this.cameraMotion.value.fov,i=this.camera.aspect,r=this.renderer.getSize(new n.Vector2);return{longitude:2*e.x/(r.x*this.scissor.width)*t/95*i,latitude:-2*e.y/(r.y*this.scissor.height)*t/95}},t.prototype.onPanGesture=function(e){var t=this.panState,i=e.pointers.length;if(e.isFinal?delete this.panState:this.panState={pointerLength:i,x:e.center.x,y:e.center.y},void 0!==t&&t.pointerLength===i){var r=e.pointers.map((function(e){return Tt(e,["x","y"])}));if(!this.emit("wantsGesture","pan",r,e.isFinal))if("mouse"===e.pointerType&&2===e.srcEvent.buttons){var o={x:e.center.x-t.x,y:e.center.y-t.y},s=new n.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z),a=this.model.bounding,l=a.getCenter(new n.Vector3),u={x:(a.max.x-a.min.x)/90*this.cameraMotion.value.fov,y:(a.max.y-a.min.y)/90*this.cameraMotion.value.fov,z:(a.max.z-a.min.z)/90*this.cameraMotion.value.fov},c=(this.camera.position.y-a.min.y)*Math.tan(this.camera.fov/2*Math.PI/180),h=this.renderer.getSize(new n.Vector2);s.add(al(2*o.x*c/h.y,this.camera.matrix)),s.add(ll(2*o.y*c/h.y,this.camera.up,this.camera.matrix)),s.x=Mr(s.x,l.x-u.x,l.x+u.x),s.z=Mr(s.z,l.z-u.z,l.z+u.z);var d={longitude:0,latitude:Math.PI/2,fov:this.cameraMotion.value.fov,offset:s,distance:this.locationMotion.value.distance};if(this.emit("wantsPanGesture",d,e.isFinal))return;this.emit("gesture","pan",r,e.isFinal),this.emit("panGesture",d,e.isFinal),this.userAction=!0,this.locationMotion.set({x:s.x,y:s.y,z:s.z},0).catch(qe)}else{s={x:e.center.x-t.x,y:e.center.y-t.y};var p=this.coordinatesForOffset(s),f=ps(this.cameraMotion.value.longitude+-1*p.longitude),A=Mr(this.cameraMotion.value.latitude+-1*p.latitude,this.minLatitude,this.maxLatitude);this.camera.aspect<1&&Math.abs(e.overallVelocityX)>.2&&Math.atan2(Math.abs(e.overallVelocityY),Math.abs(e.overallVelocityX))<Math.PI/6.923&&(A=this.cameraMotion.value.latitude);d={longitude:f,latitude:A,fov:this.cameraMotion.value.fov,offset:this.camera.pose.offset.clone(),distance:this.camera.pose.distance};if(this.emit("wantsPanGesture",d,e.isFinal))return;this.emit("gesture","pan",r,e.isFinal),this.emit("panGesture",d,e.isFinal),this.userAction=!0,this.interiaMovement=!1;var g={longitude:d.longitude,latitude:d.latitude,fov:d.fov};if(this.cameraMotion.set(g,0).catch(qe),e.isFinal)this.emit("wantsInteriaPan",d)||(this.interiaMovement=!0,e.velocityX,e.velocityY)}}},t.prototype.onPinchGesture=function(e){var t=this.pinchState||{},i=t.distance;t.offsetY;var r=!1;if("pinchstart"!==e.type){if("pinchend"===e.type&&(r=!0,delete this.pinchState),void 0!==i){this.pinchState={distance:i};var o=e.pointers.map((function(e){return Tt(e,["x","y"])}));if(this.emit("wantsGesture","pinch",o,r))return;var s=Mr(i/e.scale,this.minDistance,this.maxDistance);if(this.emit("wantsPinchGesture",e.scale,this.camera.pose.fov,r))return;this.emit("gesture","pinch",o,r),this.emit("pinchGesture",e.scale,this.camera.pose.fov,r),this.userAction=!0,this.locationMotion.set({distance:s},0).catch(qe)}var a=this.panState,l=e.pointers.length;if(e.isFinal?delete this.panState:this.panState={pointerLength:l,x:e.center.x,y:e.center.y},void 0!==a&&a.pointerLength===l){var u=e.pointers.map((function(e){return Tt(e,["x","y"])}));if(!this.emit("wantsGesture","pinch",u,r)){var c=e.pointers.map((function(e){return Tt(e,["x","y"])}));if(!this.emit("wantsGesture","pinch",c,r)){var h={x:e.center.x-a.x,y:e.center.y-a.y},d=new n.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z),p=this.model.bounding,f=p.getCenter(new n.Vector3),A={x:(p.max.x-p.min.x)/90*this.cameraMotion.value.fov,y:(p.max.y-p.min.y)/90*this.cameraMotion.value.fov,z:(p.max.z-p.min.z)/90*this.cameraMotion.value.fov},g=(this.camera.position.y-p.min.y)*Math.tan(this.camera.fov/2*Math.PI/180),m=this.renderer.getSize(new n.Vector2);d.add(al(2*h.x*g/m.y,this.camera.matrix)),d.add(ll(2*h.y*g/m.y,this.camera.up,this.camera.matrix)),d.x=Mr(d.x,f.x-A.x,f.x+A.x),d.z=Mr(d.z,f.z-A.z,f.z+A.z);var v={longitude:0,latitude:Math.PI/2,fov:this.cameraMotion.value.fov,offset:d,distance:this.locationMotion.value.distance};this.emit("wantsPanGesture",v,e.isFinal)||(this.emit("gesture","pan",c,e.isFinal),this.emit("panGesture",v,e.isFinal),this.userAction=!0,this.locationMotion.set({x:d.x,y:d.y,z:d.z},0).catch(qe))}}}}else this.pinchState={distance:this.locationMotion.value.distance}},t.prototype.onMouseWheel=function(e){var t=this,i=(Math.abs(e.deltaY)>Math.abs(e.deltaX)?e.deltaY:e.deltaX)/-60,n=[{x:e.clientX,y:e.clientY,delta:i}];if(!this.emit("wantsGesture","mouseWheel",n,!1)){var r=Mr(this.locationMotion.value.distance-i/2,this.minDistance,this.maxDistance);this.emit("wantsMouseWheel",i,this.camera.pose.fov,!1)||(this.emit("gesture","mouseWheel",n,!1),this.emit("mouseWheel",i,this.camera.pose.fov,!1),this.userAction=!0,this.locationMotion.set({distance:r},0).catch(qe),this.mouseWheelState&&clearTimeout(this.mouseWheelState.timer),this.mouseWheelState={timer:window.setTimeout((function(){delete t.mouseWheelState;t.emit("wantsGesture","mouseWheel",n,!0)||t.emit("wantsMouseWheel",i,t.camera.pose.fov,!0)||(t.emit("gesture","mouseWheel",n,!0),t.emit("mouseWheel",0,t.camera.pose.fov,!0))}),200)})}},t.prototype.onTapGesture=function(e){var t=e.pointers.map((function(e){return Tt(e,["x","y"])}));if(!this.emit("wantsGesture","tap",t,!0)){var i=this.relativeClientPosition(e.center),r=new n.Raycaster;if(r.setFromCamera(i,this.camera),!this.emit("wantsTapGesture",r,i,!0)){this.emit("gesture","tap",t,!0),this.emit("tapGesture",r,i,!0),this.interiaMovement=!1;var o=this.getForwardPanoIndexOrNot(r);if(!vr(o)){this.emit("panoSelected",o);var s={longitude:this.camera.pose.longitude,latitude:0};this.emit("wantsMoveToPano",o,s,!0)}}}},t.prototype.onPressGesture=function(e,t){var i,r,o=[e];if(this.emit("wantsGesture","press",o,t))return null===(i=this.pressState)||void 0===i||i.stop(),void delete this.pressState;var s=this.relativeClientPosition(e),a=new n.Raycaster;if(a.setFromCamera(s,this.camera),this.emit("wantsPressGesture",a,s,e.delta,t))return null===(r=this.pressState)||void 0===r||r.stop(),void delete this.pressState;this.emit("gesture","press",o,t),this.emit("pressGesture",a,s,e.delta,t)},t}(ks),cl={type:"move"},hl=function(){function e(){this._targetRay=null,this._grip=null,this._hand=null,this._axes=[0,0]}return e.prototype.getHandSpace=function(){return null===this._hand&&(this._hand=new n.Group,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand},e.prototype.getTargetRaySpace=function(){return null===this._targetRay&&(this._targetRay=new n.Group,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new n.Vector3,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new n.Vector3),this._targetRay},e.prototype.getGripSpace=function(){return null===this._grip&&(this._grip=new n.Group,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new n.Vector3,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new n.Vector3),this._grip},e.prototype.dispatchEvent=function(e){return null!==this._targetRay&&this._targetRay.dispatchEvent(e),null!==this._grip&&this._grip.dispatchEvent(e),null!==this._hand&&this._hand.dispatchEvent(e),this},e.prototype.disconnect=function(e){return this.dispatchEvent({type:"disconnected",data:e}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this},e.prototype.getAxes=function(){return this._axes},e.prototype.update=function(e,t,i){var r=null,o=null,s=null,a=this._targetRay,l=this._grip,u=this._hand;if(e&&e.gamepad&&e.gamepad.axes&&(this._axes=[e.gamepad.axes[2],e.gamepad.axes[3]]),e&&"visible-blurred"!==t.session.visibilityState)if(null!==a&&null!==(r=t.getPose(e.targetRaySpace,i))&&(a.matrix.fromArray(r.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),r.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(r.linearVelocity)):a.hasLinearVelocity=!1,r.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(r.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(cl)),u&&e.hand){s=!0;for(var c=0,h=e.hand.values();c<h.length;c++){var d=h[c],p=t.getJointPose(d,i);if(void 0===u.joints[d.jointName]){var f=new n.Group;f.matrixAutoUpdate=!1,f.visible=!1,u.joints[d.jointName]=f,u.add(f)}var A=u.joints[d.jointName];null!==p&&(A.matrix.fromArray(p.transform.matrix),A.matrix.decompose(A.position,A.rotation,A.scale),A.jointRadius=p.radius),A.visible=null!==p}var g=u.joints["index-finger-tip"],m=u.joints["thumb-tip"],v=g.position.distanceTo(m.position);u.inputState.pinching&&v>.025?(u.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!u.inputState.pinching&&v<=.015&&(u.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else null!==l&&e.gripSpace&&null!==(o=t.getPose(e.gripSpace,i))&&(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);return null!==a&&(a.visible=null!==r),null!==l&&(l.visible=null!==o),null!==u&&(u.visible=null!==s),this},e}(),dl=function(e){function t(t,i,r){var o,s,a,l=this;return(l=e.call(this)||this).isPanorama=null===(o=null==r?void 0:r.isPanorama)||void 0===o||o,l.machineType=null!==(s=null==r?void 0:r.machineType)&&void 0!==s?s:"Pico",l.renderer=t,l.gl=i,l.enabled=!1,l.session=null,l.referenceSpaceType=null!==(a=null==r?void 0:r.referenceSpaceType)&&void 0!==a?a:"local-floor",l.referenceSpace=null,l.controllers=[new hl,new hl],l.inputSourcesMap=new Map,l.cameraVR=new n.ArrayCamera,l.cameraL=new n.PerspectiveCamera,l.cameraR=new n.PerspectiveCamera,l.cameraL.viewport=new n.Vector4,l.cameraR.viewport=new n.Vector4,l.cameraL.layers.enable(1),l.cameraR.layers.enable(2),l.cameraVR.layers.enable(1),l.cameraVR.layers.enable(2),l.isPresenting=!1,l.currentDepthNear=null,l.currentDepthFar=null,l.cameraLPos=new n.Vector3,l.cameraRPos=new n.Vector3,l}return ke(t,e),t.prototype.getController=function(e){var t=this.controllers[e];return t||console.warn("no controller find"),t.getTargetRaySpace()},t.prototype.getCameras=function(){return{cameraL:this.cameraL,cameraR:this.cameraR,cameraVR:this.cameraVR}},t.prototype.updateCamera=function(e,t){null===t?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(t.matrixWorld,e.matrix),e.matrixWorldInverse.getInverse(e.matrixWorld)},t.prototype.setProjectionFromUnion=function(e,t,i){this.cameraLPos.setFromMatrixPosition(t.matrixWorld),this.cameraRPos.setFromMatrixPosition(i.matrixWorld);var n=this.cameraLPos.distanceTo(this.cameraRPos),r=t.projectionMatrix.elements,o=i.projectionMatrix.elements,s=r[14]/(r[10]-1),a=r[14]/(r[10]+1),l=(r[9]+1)/r[5],u=(r[9]-1)/r[5],c=(r[8]-1)/r[0],h=(o[8]+1)/o[0],d=s*c,p=s*h,f=n/(-c+h),A=f*-c;t.matrixWorld.decompose(e.position,e.quaternion,e.scale),e.translateX(A),e.translateZ(f),e.matrixWorld.compose(e.position,e.quaternion,e.scale),e.matrixWorldInverse.getInverse(e.matrixWorld);var g=s+f,m=a+f,v=d-A,y=p+(n-A),b=l*a/m*g,x=u*a/m*g;e.projectionMatrix.makePerspective(v,y,b,x,g,m)},t.prototype.getCamera=function(e){this.cameraVR.near=this.cameraR.near=this.cameraL.near=e.near,this.cameraVR.far=this.cameraR.far=this.cameraL.far=e.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 t=e.parent,i=this.cameraVR.cameras;this.updateCamera(this.cameraVR,t);for(var n=0;n<i.length;n++)this.updateCamera(i[n],t);e.matrixWorld.copy(this.cameraVR.matrixWorld);for(var r=e.children,o=(n=0,r.length);n<o;n++)r[n].updateMatrixWorld(!0);return 2===i.length?this.setProjectionFromUnion(this.cameraVR,this.cameraL,this.cameraR):this.cameraVR.projectionMatrix.copy(this.cameraL.projectionMatrix),this.cameraVR},t.prototype.updateInputSources=function(e){if(this.session){for(var t=this.session.inputSources,i=0;i<this.controllers.length;i++)this.inputSourcesMap.set(t[i],this.controllers[i]);for(i=0;i<e.removed.length;i++){var n=e.removed[i];(r=this.inputSourcesMap.get(n))&&(r.dispatchEvent({type:"disconnected",data:n}),this.inputSourcesMap.delete(n))}for(i=0;i<e.added.length;i++){var r;n=e.added[i];(r=this.inputSourcesMap.get(n))&&r.dispatchEvent({type:"connected",data:n})}}else console.warn("session is lose!")},t.prototype.onSessionEvent=function(e){var t=this.inputSourcesMap.get(e.inputSource);t&&t.dispatchEvent({type:e.type})},t.prototype.onSessionEnd=function(){this.inputSourcesMap.forEach((function(e,t){e.disconnect(t)})),this.inputSourcesMap.clear(),this.renderer.setFramebuffer(null),this.renderer.setRenderTarget(this.renderer.getRenderTarget()),this.isPresenting=!1,this.session=null,dt.shared.setContext(null),this.emit("webXRSessionEnd")},t.prototype.onRequestReferenceSpace=function(e){this.referenceSpace=e,this.isPresenting=!0,this.emit("webXRSessionStart")},t.prototype.setSession=function(e){var t=this;if(this.session=e,this.session){this.session.addEventListener("select",(function(e){t.onSessionEvent(e)})),this.session.addEventListener("selectstart",(function(e){t.onSessionEvent(e)})),this.session.addEventListener("selectend",(function(e){t.onSessionEvent(e)})),this.session.addEventListener("squeeze",(function(e){t.onSessionEvent(e)})),this.session.addEventListener("squeezestart",(function(e){t.onSessionEvent(e)})),this.session.addEventListener("squeezeend",(function(e){t.onSessionEvent(e)})),this.session.addEventListener("end",(function(e){t.onSessionEnd()}));var i=this.gl.getContextAttributes();this.gl.makeXRCompatible().then((function(){var e={antialias:null==i?void 0:i.antialias,alpha:null==i?void 0:i.alpha,depth:null==i?void 0:i.depth,stencil:null==i?void 0:i.stencil,framebufferScaleFactor:1};if(t.session){switch(t.machineType){case"Pico":t.session.updateRenderState({baseLayer:new XRWebGLLayer(t.session,t.gl,e)});break;case"Oculus":t.session.updateRenderState({layers:[new XRWebGLLayer(t.session,t.gl,e)]});break;default:t.machineType}t.session.requestReferenceSpace(t.referenceSpaceType).then((function(e){t.onRequestReferenceSpace(e)})),t.session.addEventListener("inputsourceschange",(function(e){t.updateInputSources(e)}))}else console.error("session is lose while set session!")}))}},t}(He),pl=["webXRSessionStart","webXRSessionEnd"],fl=function(e){function t(){var t=e.call(this)||this;t.type="LineSegmentsGeometry";return t.setIndex([0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5]),t.setAttribute("position",new n.Float32BufferAttribute([-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],3)),t.setAttribute("uv",new n.Float32BufferAttribute([-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],2)),t}return ke(t,e),t.prototype.applyMatrix4=function(e){var t=this.attributes.instanceStart,i=this.attributes.instanceEnd;return void 0!==t&&(t.applyMatrix4(e),i.applyMatrix4(e),t.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},t.prototype.setPositions=function(e){var t;t=e instanceof Float32Array?e:Array.isArray(e)?new Float32Array(e):new Float32Array;var i=new n.InstancedInterleavedBuffer(t,6,1);return this.setAttribute("instanceStart",new n.InterleavedBufferAttribute(i,3,0)),this.setAttribute("instanceEnd",new n.InterleavedBufferAttribute(i,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this},t.prototype.setColors=function(e){var t;t=e instanceof Float32Array?e:Array.isArray(e)?new Float32Array(e):new Float32Array;var i=new n.InstancedInterleavedBuffer(t,6,1);return this.setAttribute("instanceColorStart",new n.InterleavedBufferAttribute(i,3,0)),this.setAttribute("instanceColorEnd",new n.InterleavedBufferAttribute(i,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 n.WireframeGeometry(e.geometry)),this},t.prototype.fromLineSegments=function(e){var t=e.geometry;if(t instanceof n.Geometry){var i=(new n.BufferGeometry).fromGeometry(t);this.setPositions(i.attributes.position.array)}else t instanceof n.BufferGeometry&&this.setPositions(t.attributes.position.array);return this},t.prototype.computeBoundingBox=function(){null===this.boundingBox&&(this.boundingBox=new n.Box3);var e=this.attributes.instanceStart,t=this.attributes.instanceEnd;if(void 0!==e&&void 0!==t){var i=new n.Box3;this.boundingBox.setFromBufferAttribute(e),i.setFromBufferAttribute(t),this.boundingBox.union(i)}},t.prototype.computeBoundingSphere=function(){null===this.boundingSphere&&(this.boundingSphere=new n.Sphere),null===this.boundingBox&&this.computeBoundingBox();var e=this.attributes.instanceStart,t=this.attributes.instanceEnd;if(void 0!==e&&void 0!==t){var i=this.boundingSphere.center;this.boundingBox.getCenter(i);for(var r=0,o=new n.Vector3,s=0,a=e.count;s<a;s++)o.fromBufferAttribute(e,s),r=Math.max(r,i.distanceToSquared(o)),o.fromBufferAttribute(t,s),r=Math.max(r,i.distanceToSquared(o));this.boundingSphere.radius=Math.sqrt(r),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}(n.InstancedBufferGeometry);Object.assign(fl.prototype,{isLineSegmentsGeometry:!0});var Al={uniforms:n.UniformsUtils.merge([n.UniformsLib.common,n.UniformsLib.fog,{linewidth:{value:1},resolution:{value:new n.Vector2(1,1)},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1},opacity:{value:1}}]),vertexShader:"\n\t\t#include <common>\n\t\t#include <color_pars_vertex>\n\t\t#include <fog_pars_vertex>\n\t\t#include <logdepthbuf_pars_vertex>\n\t\t#include <clipping_planes_pars_vertex>\n\n\t\tuniform float linewidth;\n\t\tuniform vec2 resolution;\n\n\t\tattribute vec3 instanceStart;\n\t\tattribute vec3 instanceEnd;\n\n\t\tattribute vec3 instanceColorStart;\n\t\tattribute vec3 instanceColorEnd;\n\n\t\tvarying vec2 vUv;\n\n\t\t#ifdef USE_DASH\n\n\t\t\tuniform float dashScale;\n\t\t\tattribute float instanceDistanceStart;\n\t\t\tattribute float instanceDistanceEnd;\n\t\t\tvarying float vLineDistance;\n\n\t\t#endif\n\n\t\tvoid trimSegment( const in vec4 start, inout vec4 end ) {\n\n\t\t\t// trim end segment so it terminates between the camera plane and the near plane\n\n\t\t\t// conservative estimate of the near plane\n\t\t\tfloat a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column\n\t\t\tfloat b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column\n\t\t\tfloat nearEstimate = - 0.5 * b / a;\n\n\t\t\tfloat alpha = ( nearEstimate - start.z ) / ( end.z - start.z );\n\n\t\t\tend.xyz = mix( start.xyz, end.xyz, alpha );\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\t#ifdef USE_COLOR\n\n\t\t\t\tvColor.xyz = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd;\n\n\t\t\t#endif\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd;\n\n\t\t\t#endif\n\n\t\t\tfloat aspect = resolution.x / resolution.y;\n\n\t\t\tvUv = uv;\n\n\t\t\t// camera space\n\t\t\tvec4 start = modelViewMatrix * vec4( instanceStart, 1.0 );\n\t\t\tvec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 );\n\n\t\t\t// special case for perspective projection, and segments that terminate either in, or behind, the camera plane\n\t\t\t// clearly the gpu firmware has a way of addressing this issue when projecting into ndc space\n\t\t\t// but we need to perform ndc-space calculations in the shader, so we must address this issue directly\n\t\t\t// perhaps there is a more elegant solution -- WestLangley\n\n\t\t\tbool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column\n\n\t\t\tif ( perspective ) {\n\n\t\t\t\tif ( start.z < 0.0 && end.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( start, end );\n\n\t\t\t\t} else if ( end.z < 0.0 && start.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( end, start );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// clip space\n\t\t\tvec4 clipStart = projectionMatrix * start;\n\t\t\tvec4 clipEnd = projectionMatrix * end;\n\n\t\t\t// ndc space\n\t\t\tvec2 ndcStart = clipStart.xy / clipStart.w;\n\t\t\tvec2 ndcEnd = clipEnd.xy / clipEnd.w;\n\n\t\t\t// direction\n\t\t\tvec2 dir = ndcEnd - ndcStart;\n\n\t\t\t// account for clip-space aspect ratio\n\t\t\tdir.x *= aspect;\n\t\t\tdir = normalize( dir );\n\n\t\t\t// perpendicular to dir\n\t\t\tvec2 offset = vec2( dir.y, - dir.x );\n\n\t\t\t// undo aspect ratio adjustment\n\t\t\tdir.x /= aspect;\n\t\t\toffset.x /= aspect;\n\n\t\t\t// sign flip\n\t\t\tif ( position.x < 0.0 ) offset *= - 1.0;\n\n\t\t\t// endcaps\n\t\t\tif ( position.y < 0.0 ) {\n\n\t\t\t\toffset += - dir;\n\n\t\t\t} else if ( position.y > 1.0 ) {\n\n\t\t\t\toffset += dir;\n\n\t\t\t}\n\n\t\t\t// adjust for linewidth\n\t\t\toffset *= linewidth;\n\n\t\t\t// adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ...\n\t\t\toffset /= resolution.y;\n\n\t\t\t// select end\n\t\t\tvec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd;\n\n\t\t\t// back to clip space\n\t\t\toffset *= clip.w;\n\n\t\t\tclip.xy += offset;\n\n\t\t\tgl_Position = clip;\n\n\t\t\tvec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation\n\n\t\t\t#include <logdepthbuf_vertex>\n\t\t\t#include <clipping_planes_vertex>\n\t\t\t#include <fog_vertex>\n\n\t\t}\n\t\t",fragmentShader:"\n\t\tuniform vec3 diffuse;\n\t\tuniform float opacity;\n\n\t\t#ifdef USE_DASH\n\n\t\t\tuniform float dashSize;\n\t\t\tuniform float gapSize;\n\n\t\t#endif\n\n\t\tvarying float vLineDistance;\n\n\t\t#include <common>\n\t\t#include <color_pars_fragment>\n\t\t#include <fog_pars_fragment>\n\t\t#include <logdepthbuf_pars_fragment>\n\t\t#include <clipping_planes_pars_fragment>\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\t#include <clipping_planes_fragment>\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tif ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps\n\n\t\t\t\tif ( mod( vLineDistance, dashSize + gapSize ) > dashSize ) discard; // todo - FIX\n\n\t\t\t#endif\n\n\t\t\tif ( abs( vUv.y ) > 1.0 ) {\n\n\t\t\t\tfloat a = vUv.x;\n\t\t\t\tfloat b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n\t\t\t\tfloat len2 = a * a + b * b;\n\n\t\t\t\tif ( len2 > 1.0 ) discard;\n\n\t\t\t}\n\n\t\t\tvec4 diffuseColor = vec4( diffuse, opacity );\n\n\t\t\t#include <logdepthbuf_fragment>\n\t\t\t#include <color_fragment>\n\n\t\t\tgl_FragColor = vec4( diffuseColor.rgb, diffuseColor.a );\n\n\t\t\t#include <tonemapping_fragment>\n\t\t\t#include <fog_fragment>\n\t\t\t#include <premultiplied_alpha_fragment>\n\n\t\t}\n\t\t"},gl=function(e){function t(t){var i=e.call(this,{uniforms:n.UniformsUtils.clone(Al.uniforms),vertexShader:Al.vertexShader,fragmentShader:Al.fragmentShader,clipping:!0})||this;return i.type="LineMaterial",i.dashed=!1,Object.defineProperties(i,{color:{enumerable:!0,get:function(){return this.uniforms.diffuse.value},set:function(e){this.uniforms.diffuse.value=e}},linewidth:{enumerable:!0,get:function(){return this.uniforms.linewidth.value},set:function(e){this.uniforms.linewidth.value=e}},dashScale:{enumerable:!0,get:function(){return this.uniforms.dashScale.value},set:function(e){this.uniforms.dashScale.value=e}},dashSize:{enumerable:!0,get:function(){return this.uniforms.dashSize.value},set:function(e){this.uniforms.dashSize.value=e}},gapSize:{enumerable:!0,get:function(){return this.uniforms.gapSize.value},set:function(e){this.uniforms.gapSize.value=e}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(e){this.uniforms.opacity.value=e}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(e){this.uniforms.resolution.value.copy(e)}}}),i.setValues(t),i}return ke(t,e),t}(n.ShaderMaterial);Object.assign(gl.prototype,{isLineMaterial:!0});var ml=function(e){function t(t,i){var n=e.call(this)||this;return n.type="LineSegments2",n.geometry=void 0!==t?t:new fl,n.material=void 0!==i?i:new gl({color:16777215*Math.random()}),n}return ke(t,e),t.prototype.computeLineDistances=function(){for(var e=this.geometry,t=e.attributes.instanceStart,i=e.attributes.instanceEnd,r=new Float32Array(2*t.count),o=new n.Vector3,s=new n.Vector3,a=0,l=0,u=t.count;a<u;a++,l+=2)o.fromBufferAttribute(t,a),s.fromBufferAttribute(i,a),r[l]=0===l?0:r[l-1],r[l+1]=r[l]+o.distanceTo(s);var c=new n.InstancedInterleavedBuffer(r,2,1);return e.setAttribute("instanceDistanceStart",new n.InterleavedBufferAttribute(c,1,0)),e.setAttribute("instanceDistanceEnd",new n.InterleavedBufferAttribute(c,1,1)),this},t.prototype.raycast=function(e,t){null===e.camera&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2.');var i=e.ray,r=e.camera,o=r.projectionMatrix,s=this.geometry,a=this.material,l=a.resolution,u=a.linewidth,c=s.attributes.instanceStart,h=s.attributes.instanceEnd,d=new n.Vector4,p=new n.Vector4,f=new n.Vector4,A=new n.Vector3,g=new n.Matrix4,m=new n.Line3,v=new n.Vector3;i.at(1,f),f.w=1,f.applyMatrix4(r.matrixWorldInverse),f.applyMatrix4(o),f.multiplyScalar(1/f.w),f.x*=l.x/2,f.y*=l.y/2,f.z=0,A.copy(f);var y=this.matrixWorld;g.multiplyMatrices(r.matrixWorldInverse,y);for(var b=0,x=c.count;b<x;b++){d.fromBufferAttribute(c,b),p.fromBufferAttribute(h,b),d.w=1,p.w=1,d.applyMatrix4(g),p.applyMatrix4(g),d.applyMatrix4(o),p.applyMatrix4(o),d.multiplyScalar(1/d.w),p.multiplyScalar(1/p.w);var w=d.z<-1&&p.z<-1,M=d.z>1&&p.z>1;if(!w&&!M){d.x*=l.x/2,d.y*=l.y/2,p.x*=l.x/2,p.y*=l.y/2,m.start.copy(d),m.start.z=0,m.end.copy(p),m.end.z=0;var E=m.closestPointToPointParameter(A,!0);m.at(E,v);var S=n.MathUtils.lerp(d.z,p.z,E),C=S>=-1&&S<=1,I=A.distanceTo(v)<.5*u;if(C&&I){m.start.fromBufferAttribute(c,b),m.end.fromBufferAttribute(h,b),m.start.applyMatrix4(y),m.end.applyMatrix4(y);var B=new n.Vector3,T=new n.Vector3;i.distanceSqToSegment(m.start,m.end,T,B),t.push({point:T,pointOnLine:B,distance:i.origin.distanceTo(T),object:this,faceIndex:b})}}}},t}(n.Mesh);Object.assign(ml.prototype,{isLineSegments2:!0});var vl=function(e){function t(t,i){var n=e.call(this,t,i)||this;return n.type="Line2",n}return ke(t,e),t}(ml);Object.assign(vl.prototype,{isLine2:!0});var yl=function(e){function t(){var t=e.call(this)||this;return t.type="LineGeometry",t}return ke(t,e),t.prototype.setPositions=function(t){for(var i=t.length-3,n=new Float32Array(2*i),r=0;r<i;r+=3)n[2*r]=t[r],n[2*r+1]=t[r+1],n[2*r+2]=t[r+2],n[2*r+3]=t[r+3],n[2*r+4]=t[r+4],n[2*r+5]=t[r+5];return e.prototype.setPositions.call(this,n),this},t.prototype.setColors=function(t){for(var i=t.length-3,n=new Float32Array(2*i),r=0;r<i;r+=3)n[2*r]=t[r],n[2*r+1]=t[r+1],n[2*r+2]=t[r+2],n[2*r+3]=t[r+3],n[2*r+4]=t[r+4],n[2*r+5]=t[r+5];return e.prototype.setColors.call(this,n),this},t.prototype.fromLine=function(e){var t=e.geometry;if(t instanceof n.Geometry){var i=(new n.BufferGeometry).fromGeometry(t);this.setPositions(i.attributes.position.array)}else t instanceof n.BufferGeometry&&this.setPositions(t.attributes.position.array);return this},t.prototype.copy=function(){return this},t}(fl);Object.assign(yl.prototype,{isLineGeometry:!0});var bl=null,xl=function(e){function t(t,i){void 0===t&&(t=new n.Vector3),void 0===i&&(i=new n.Vector3);var r=e.call(this)||this;r.type="FiveLine",r.needsRender=!0;var o=new yl,s=new gl({color:14467195,linewidth:2,dashScale:20,dashed:!1});r.line=new vl(o,s);var a=new n.BufferGeometry,l=new n.PointsMaterial({color:14467195,size:8,map:bl||(bl=(new n.TextureLoader).load("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAAZiS0dEAAAAAAAA+UO7fwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sHDgwCEMBJZu0AAAAdaVRYdENvbW1lbnQAAAAAAENyZWF0ZWQgd2l0aCBHSU1QZC5lBwAABM5JREFUWMO1V0tPG2cUPZ4Hxh6DazIOrjFNqJs0FIMqWFgWQkatsmvVbtggKlSVRVf5AWz4AWz4AUSKEChll19QJYSXkECuhFxsHjEhxCYm+DWGMZ5HF72DJq4bAzFXurI0M/I5997v3u9cC65vTJVn2lX/xHINQOYSBLTLEuIuCWw4Z3IGAEvf6ASmVHjNzHCXBG4A0AjACsAOwEbO0nsFQBnAGYASAIl+ZRMR7SolMEdsByD09fV5R0ZGgg8ePPjW5/N1iqLYpuu6RZblciKR2I9Go69evnwZnZ+fjwI4IS8AKBIRzeQfJWCANwKwh0KhtrGxsYehUOin1tbW+zzP23ietzY2NnIAoGmaLsuyUiqVyvl8XtrY2NiamZn589mzZxsAUgCOAeQAnFI2tI+VxIjaAeDzoaGh7xYWFuZOTk6OZVk+12uYqqq6JEnn0Wg0OT4+/geAXwGEAdwDIFJQXC1wO4DWR48e/RCPxxclSSroVzRFUbSDg4P848ePFwH8DuAhkWih83TRQWxFOXgAwvDwcOfo6OhvXV1d39tsNtuVBwTDWBwOh1UUxVsMw1hXVlbSdCgNV43uYSvrHg6H24aHh38eHBz85TrgF9FYLHA4HLzH43FvbW2d7u/vG+dANp8FpqIlbd3d3V8Fg8EfBUFw4BONZVmL3+9vHhkZCQL4AoAHgJPK8G+yzC0XDofdoVAo5PP5vkadTBAEtr+/39ff3x8gAp/RPOEqx2qjx+NpvXv3bk9DQ0NDvQgwDIOWlhZrMBj8kgi0UJdxRgYMArzL5XJ7vd57qLPZ7Xamp6fnNgBXtQxcjFuHw+Hyer3t9SYgCAITCAScAJoBNNEY/08GOFVVrfVMv7kMNDntFD1vjIAPrlRN0xjckOm6biFQ3jwNPwDMZrOnqVTqfb3Bi8Wivru7W/VCYkwPlKOjo0IikXh7EwQikYgE4Nw0CfXKDCipVCoTj8df3QABbW1tLUc6oUgkFPMkVACUNjc337148eKvw8PDbJ2jP1taWkoCyNDVXDSECmNSK4qiKNLq6urW8+fPI/UicHx8rD59+jSVy+WOAKSJhKENwFItLtoxk8mwsixzHR0dHe3t7c5PAU+n09rs7OzJkydPYqVSaQfANoDXALIk31S2smU1TWMPDg7K5XKZ7+3t9TudTut1U7+wsFCcmJiIpdPpbQBxADsAknQWymYCOukBHYCuKApisdhpMpnURFEU79y503TVyKenpzOTk5M7e3t7MQKPV0Zv1gNm+awB0MvlshqLxfLb29uyJElWURSbXC4XXyvqxcXFs6mpqeTc3Nzu3t7e3wQcA7BPZ8Cov1pNlJplmQtAG8MwHV6v95tAINA5MDBwPxAIuLu6upr8fr/VAN3c3JQjkcjZ+vp6fnl5+d2bN29SuVzuNYAEpf01CdRChUL+X1VskHACuA3Ay3Fcu9vt7nA6nZ7m5uYWQRCaNE3jVVW15PP580KhIGUymWw2m00DOAJwSP4WwPtq4LX2Ao6USxNlQyS/RcQcdLGwlNIz6vEMAaZpNzCk2Pll94LK/cDYimxERiBwG10sxjgvEZBE0UpE6vxj+0Ct5bTaXthgEhRmja8QWNkkPGsuIpfdjpkK+cZUWTC0KredVmtD/gdlSl6EG4AMvQAAAABJRU5ErkJggg==")),sizeAttenuation:!1,transparent:!0});return r.points=new n.Points(a,l),r.points.renderOrder=11,r.points.frustumCulled=!1,r.setPoints(t,i),r.add(r.line,r.points),r}return ke(t,e),Object.defineProperty(t,"version",{get:function(){return"5.0.0-alpha.164"},enumerable:!1,configurable:!0}),t.prototype.setPoints=function(e,t){var i=[].concat(e.toArray(),t.toArray());this.points.geometry.setAttribute("position",new n.BufferAttribute(new Float32Array(i),3)),this.line.geometry.setPositions(i),this.line.computeLineDistances(),this.needsRender=!0},t.prototype.getPoints=function(){var e=this.points.geometry.attributes.position.array;return[new n.Vector3(e[0],e[1],e[2]),new n.Vector3(e[3],e[4],e[5])]},t.prototype.setMaterial=function(e){var t=this.line.material;for(var i in e)if(e.hasOwnProperty(i)){var n=e[i];"dashed"===i?(t.dashed=n,n?t.defines.USE_DASH="":delete t.defines.USE_DASH,t.needsUpdate=!0):t[i]=e[i]}this.needsRender=!0},t.prototype.setResolution=function(e,t){var i=this.line.material.resolution;i.x===e&&i.y===t||(i.set(e,t),this.needsRender=!0)},t}(n.Object3D);Object.assign(xl.prototype,{isFiveLine:!0});var wl=(new n.Matrix4).makeRotationAxis(new n.Vector3(0,1,0),Math.PI),Ml=new n.Vector3(-1,1,1),El=function(e){function t(t){var i=e.call(this,t)||this;i.xrManager=new dl(i.renderer,i.renderer.getContext()),i.xrControllerRay=new n.Raycaster,i.pointerLine=new xl,i.scene.add(i.pointerLine),i.pointerLine.line.material.depthTest=!1,i.pointerLine.points.material instanceof Array?i.pointerLine.points.material.forEach((function(e){e.depthTest=!1})):i.pointerLine.points.material.depthTest=!1,i.pointerLine.setMaterial({color:new n.Vector3(1,1,1)}),i.boundingMesh.visible=!0,i.panoResources={},i.panoResources[i.locationMotion.keyframes[0].key=i.locationMotion.keyframes[1].key=rr()]={panoIndex:i.currentPanoIndex,workCode:i.work.workCode,leftPanoPicture:null,position:i.camera.pose.offset.clone(),effect:"fade"},i.parallaxCameraMatrixs=[];var r=dt.shared.getContext();if(!r)return console.error("获取session失败,请退出重试"),i;i.xrManager.setSession(r),i.on("webXRSelected",(function(e){"Select"===e&&i.checkSelectedPano()}));for(var o=function(e){s.xrManager.on(e,(function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];i.emit.apply(i,Fe([e],t,!1))}))},s=this,a=0,l=pl;a<l.length;a++){o(l[a])}return i.xrControllerState={axes:[{left:{isTap:!1,startTime:0},right:{isTap:!1,startTime:0}},{up:{isTap:!1,startTime:0},down:{isTap:!1,startTime:0}},{left:{isTap:!1,startTime:0},right:{isTap:!1,startTime:0}},{up:{isTap:!1,startTime:0},down:{isTap:!1,startTime:0}}],select:{startTime:0,istap:!1},squeeze:{startTime:0,istap:!1},leftButtonA:{startTime:0,istap:!1},leftButtonB:{startTime:0,istap:!1},rightButtonA:{startTime:0,istap:!1},rightButtonB:{startTime:0,istap:!1}},i}return ke(t,e),t.parseArgs=function(t){var i=Oe(Oe({},t),{maxLatitude:Math.PI/2,minLatitude:-Math.PI/2});return e.parseArgs.call(this,i)},t.initAnimationEndPose=function(t){var i=this.parseArgs(t);return e.initAnimationEndPose.call(this,i)},t.prototype.moveToPano=function(e,t,i){var r,o,s,a,l=this,u=this.work.observers[e],c=this.imageOptions.size;if(void 0===c&&u){var h=u.images.up.match(/\/cube_(\d+)\//);h&&(c=Number(h[1]))}void 0===c&&(c=2048);var d=this.imageOptions.transform,p=function(e,t){return function(e,t){if(!t)return e;var i=e.match(/\d+_[a-z].png/);return e.substring(0,i.index)+t+"/"+e.substring(i.index)}(mt(e,d,t))},f=Oe({key:"pano.".concat(e),basisLoaderInitialized:ii.isInitialized()},Tt(this.imageOptions,["format","size","quality"])),A=u.images,g=null!==(o=null===(r=u.images.tiles)||void 0===r?void 0:r.filter((function(e){return e.size>c})))&&void 0!==o?o:null,m="pano:"+zs([A,f,d]);if(this.pendingTextureTask){if(this.pendingTextureTask.hash===m)return;var v=this.pendingTextureTask.panoIndex;null===(s=this.panoMeshes[v])||void 0===s||s.setProgress(0),this.emit("textureAbort",v,u),this.pendingTextureTask.onError(new Error("texture aborted"))}var y,b=this.model.getMaterial()||{},x=b.pano0,w=b.pano1;if((null==x?void 0:x.map.name)===m?y=x:(null==w?void 0:w.map.name)===m&&(y=w),y){var M={panoIndex:e,workCode:this.work.workCode,effect:null!==(a=t.effect)&&void 0!==a?a:"fade",leftPanoPicture:{map:y.map,luminanceMap:y.luminanceMap,matrix:(new n.Matrix4).compose(u.position,u.quaternion,Ml)},position:u.position.clone()};this.doMoveToPano(e,M,t,i)}else this.pending=!0,this.pendingTextureTask={panoIndex:e,hash:m,onLoad:function(r){var o;if(l.pending=!1,l.destroyed)r.body.dispose();else{r.body.name=m;var s={panoIndex:e,workCode:l.work.workCode,effect:null!==(o=t.effect)&&void 0!==o?o:"fade",leftPanoPicture:{map:r.body,luminanceMap:null,matrix:(new n.Matrix4).compose(u.position,u.quaternion,Ml)},position:u.position.clone()};l.doMoveToPano(e,s,t,i)}},onError:function(i){l.pending=!1,t.moveCancelCallback&&t.moveCancelCallback(),l.emit("panoLoadError",i,e),l.emit("moveToPanoCanceled",e)}},Promise.all([this.tileLevelForFov&&g&&g.length?this.textureLoader.loadTiledCubeTexture(A,g,{tileMaxLevel:this.TILED_CUBE_TEXTURE_LEVEL,imageURL:{transform:p,options:f},format:n.RGBAFormat,viaAjax:!0},void 0,void 0,(function(t){var i,n;l.emit("textureLoading",t,e,u),(null===(i=l.pendingTextureTask)||void 0===i?void 0:i.hash)===m&&(null===(n=l.panoMeshes[e])||void 0===n||n.setProgress(t))}),this.renderer):this.textureLoader.loadCubeTexture(A,{imageURL:{transform:p,options:f},format:n.RGBAFormat},void 0,void 0,(function(t){var i,n;(null===(i=l.pendingTextureTask)||void 0===i?void 0:i.hash)===m&&(null===(n=l.panoMeshes[e])||void 0===n||n.setProgress(t)),l.emit("textureLoading",t,e,u)}),this.renderer)]).then((function(t){var i,n,r=t[0];(null===(i=l.pendingTextureTask)||void 0===i?void 0:i.hash)===m?(l.pendingTextureTask.onLoad(r),null===(n=l.panoMeshes[e])||void 0===n||n.setProgress(0),delete l.pendingTextureTask,l.emit("textureLoaded",e,u,r.meta)):r.body.dispose()})).catch((function(t){var i,n;(null===(i=l.pendingTextureTask)||void 0===i?void 0:i.hash)===m&&(l.pendingTextureTask.onError(t),null===(n=l.panoMeshes[e])||void 0===n||n.setProgress(0),delete l.pendingTextureTask,l.emit("textureError",t,e,u),l.emit("error",t))})),this.emit("textureStartLoad",e,u)},t.prototype.doMoveToPano=function(e,t,i,r){var o,s,a,l=this;void 0===i&&(i={}),this.userAction=r;var u=ze(),c=rr();this.panoResources[c]=t;var h,d,p;if(this.locationMotion.ended){var f=this.locationMotion.getKeyFrameSegment(u);f[0];var A=f[1],g=this.locationMotion.value,m=this.panoResourceFromLocationMotionKeyframe(A).position,v=t.position;h=Math.max(m.distanceTo(v),1),d=[{key:A.key,progress:0,value:Oe(Oe({},g),{count:0})},{key:c,progress:1,value:{distance:0,perspToOrtho:0,orthoDistance:1,modelAlpha:0,count:1}}],p=0}else{var y=this.locationMotion.getKeyFrameSegment(u),b=y[0],x=(A=y[1],g=this.locationMotion.value,this.panoResourceFromLocationMotionKeyframe(b).position),w=(m=this.panoResourceFromLocationMotionKeyframe(A).position,v=t.position,A.value.count-g.count),M=Math.max(x.distanceTo(m),1)*w;h=M+Math.max(m.distanceTo(v),1),d=[{key:b.key,progress:0,value:Oe({},g)},{key:A.key,progress:M/h,value:A.value},{key:c,progress:1,value:{count:A.value.count+1,distance:0,perspToOrtho:0,orthoDistance:1,modelAlpha:0}}];var E=this.locationMotionKeyframesLength(this.locationMotion.keyframes),S=this.locationMotionKeyframesLength(d);p=this.locationMotion.getProgressVelocity(u)*E/S}var C=this.calculateMovingDuration(i.duration,h),I={longitude:i.longitude,latitude:i.latitude,fov:i.fov},B={longitude:null!==(o=I.longitude)&&void 0!==o?o:this.camera.pose.longitude,latitude:null!==(s=I.latitude)&&void 0!==s?s:this.camera.pose.latitude,fov:null!==(a=I.fov)&&void 0!==a?a:this.camera.pose.fov,offset:t.position.clone(),distance:0};this.emit("moveToPano",e,this.userAction),i.moveStartCallback&&i.moveStartCallback(e,B),this.emit("panoWillArrive",e,B,this.userAction),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=qe,this.videoTexture.needsUpdate=!0),this.panoVideo.setMaterial(null),this.cameraMotion.set(I,C).catch(qe),this.locationMotion.setKeyframes(d,C,p).then((function(){var t,o,s,a={longitude:l.camera.pose.longitude,latitude:l.camera.pose.latitude,fov:l.camera.pose.fov,offset:l.camera.pose.offset.clone(),distance:0};i.moveEndCallback&&i.moveEndCallback(e,a),l.emit("panoArrived",e,a,r);var u=l.work.observers[l.currentPanoIndex];if(u&&u.video&&l.videoTexture&&l.videoTexture.image instanceof HTMLVideoElement){var c=wl.clone().multiply(null!==(s=null===(o=null===(t=l.model.getMaterial())||void 0===t?void 0:t.pano1)||void 0===o?void 0:o.matrix)&&void 0!==s?s:new n.Matrix4).multiply(u.video.matrix),h={map:l.videoTexture,size:u.video.size,matrix:c,alpha:1},d=rr(),p=l.videoTexture.image;p.setAttribute("uuid",d),Gs().then((function(e){e&&u.video&&p.getAttribute("uuid")===d&&(p.oncanplay=function(){p.oncanplay=qe,p.play()},p.ontimeupdate=function(){p.currentTime>.5&&(p.ontimeupdate=qe,l.panoVideo.setMaterial(h))},p.src=u.video.source)})).catch((function(){p.removeAttribute("uuid")}))}}),(function(){i.moveCancelCallback&&i.moveCancelCallback(),l.emit("moveToPanoCanceled",e)}))},t.prototype.checkSelectedPano=function(){var e=this,t=this.xrControllerRay;this.interiaMovement=!1;var i=this.camera.getWorldDirection(new n.Vector3).setY(0),r=null,o=this.work.observers[this.currentPanoIndex];if(!o)return r;var s=o.accessibleNodes.filter((function(t){if(t===e.currentPanoIndex)return!1;var i=e.work.observers[t];return!(i.position.distanceTo(e.camera.position)>e.maxAccessibleDistance)&&(i.loadable||i.active)})),a=this.model.intersectRaycaster(t)[0];if(a){var l=xs(s,(function(t){var n=e.work.observers[t].standingPosition.clone();return n.clone().sub(e.camera.position).setY(0).angleTo(i)>Math.PI/2?1/0:n.distanceTo(a.point)}),!0),u=l[0];l[1]<this.panoTapTriggerRadius&&(r=u)}vr(r)&&(r=this.getForwardPanoIndexOrNot(t));for(var c=0,h=this.locationMotion.keyframes;c<h.length;c++){var d=h[c],p=this.panoResourceFromLocationMotionKeyframe(d);if(!(d.progress<this.locationMotion.progress)&&p.panoIndex===r){r=null;break}}if(this.emit("panoSelected",r),vr(r))return!0===this.locationMotion.ended&&this.cameraBounce(),r;var f=this.work.observers[r];if(!f.active)return this.panoMeshes[r]&&(this.panoMeshes[r].setDisabled(!1),this.panoMeshes[r].setLoading(!0)),r;for(var A={effect:"fade"},g=Math.PI/6,m=Math.PI/12,v=new n.Vector3(0,1,0),y=f.position.clone().setY(0).sub(o.position.clone().setY(0)).normalize(),b=y.clone().applyAxisAngle(v,g),x=y.clone().applyAxisAngle(v,-g),w=[],M=[],E=[],S=0,C=f.accessibleNodes;S<C.length;S++){if((u=C[S])!==this.currentPanoIndex&&u!==r){var I=this.work.observers[u].position.clone().sub(f.position).setY(0);y.angleTo(I)<g?E.push(I):b.angleTo(I)<g?w.push(I):x.angleTo(I)<g&&M.push(I)}}var B=(E.length>0?E:Fe(Fe([],w,!0),M,!0)).slice().sort((function(e,t){return e.angleTo(y)-t.angleTo(y)}))[0];return B&&B.angleTo(i)>m&&(A.longitude=Math.atan2(-B.x,-B.z)),this.cameraMotion.value.latitude<-Math.PI/4&&(A.latitude=Mr(0,this.minLatitude,this.maxLatitude)),this.cameraMotion.value.fov<60&&(A.fov=this.defaultFov),this.emit("wantsMoveToPano",r,A,!0),r},t.prototype.destroy=function(){e.prototype.destroy.call(this)},t.prototype.isReady=function(){return!1},t.prototype.updateTime=function(e,t){for(var i,r,o,s,a,l,u,c,h=this,d=[],p=2;p<arguments.length;p++)d[p-2]=arguments[p];var f={},A={},g=this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[0]),m=this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[this.locationMotion.keyframes.length-1]),v=!1;if(!1===this.locationMotion.ended){this.locationMotion.update(e);var y=this.locationMotion.getKeyFrameSegment(e),b=y[0],x=y[1],w=this.panoResourceFromLocationMotionKeyframe(b),M=this.panoResourceFromLocationMotionKeyframe(x),E=(new n.Vector3).copy(w.position),S=(new n.Vector3).copy(M.position),C=this.locationMotion.value.count-x.value.count+1;f.progress=C,f.modelAlpha=this.locationMotion.value.modelAlpha,this.camera.perspToOrtho.setScalar(Mr(this.locationMotion.value.perspToOrtho,0,1)),this.camera.orthoDistance=this.locationMotion.value.orthoDistance,M.leftPanoPicture&&(C<1?w.leftPanoPicture&&(f.pano0=w.leftPanoPicture):f.pano0=M.leftPanoPicture,f.pano1=M.leftPanoPicture),v=f.useBlackTransition="instant"===M.effect||"montage"===M.effect,"fade"!==M.effect&&"montage"!==M.effect||(f.pano0&&w.leftPanoPicture&&(f.pano0={map:f.pano0.map,luminanceMap:f.pano0.luminanceMap,matrix:w.leftPanoPicture.matrix.clone().setPosition(M.position)}),E.copy(S)),A.distance=this.locationMotion.value.distance,A.offset=new n.Vector3(E.x+(S.x-E.x)*C,E.y+(S.y-E.y)*C,E.z+(S.z-E.z)*C);for(var I=[],B=[],T=0,P=this.locationMotion.keyframes;T<P.length;T++){var R=P[T],D=R.key,L=R.progress;void 0!==D&&(I.push(D),L>=this.locationMotion.progress&&B.push(D))}for(var k=0,O=Object.keys(this.panoResources);k<O.length;k++){var F=O[k];if(!(B.indexOf(F)>=0)){var N=this.panoResources[F];if(N.leftPanoPicture){var V=N.leftPanoPicture.map;if(V){if(V===(null===(i=f.pano0)||void 0===i?void 0:i.map))continue;if(V===(null===(r=f.pano1)||void 0===r?void 0:r.map))continue;V instanceof ri&&V.cubeRenderTarget&&this.colorCubeRenderTargetPool.push(V.cubeRenderTarget),V.dispose(),N.leftPanoPicture=null}}I.indexOf(F)>=0||delete this.panoResources[F]}}w.workCode===M.workCode?this.currentPanoIndex=C<.5?w.panoIndex:M.panoIndex:this.currentPanoIndex=M.panoIndex,this.emit("movingToPano",m.panoIndex,g.panoIndex,this.locationMotion.progress)}!1===this.cameraMotion.ended&&(this.cameraMotion.update(e),A.longitude=this.cameraMotion.value.longitude,A.latitude=this.cameraMotion.value.latitude,A.fov=this.cameraMotion.value.fov),!1===ws(f)&&((null===(o=f.pano0)||void 0===o?void 0:o.map)&&f.pano0.map instanceof ri&&!f.pano0.map.cubeRenderTarget&&(f.pano0.map.cubeRenderTarget=this.colorCubeRenderTargetPool.pop()),(null===(s=f.pano1)||void 0===s?void 0:s.map)&&f.pano1.map instanceof ri&&!f.pano1.map.cubeRenderTarget&&(f.pano1.map.cubeRenderTarget=this.colorCubeRenderTargetPool.pop()),this.model.setMaterial(f),this.boundingMesh.setMaterial(f)),!1===ws(A)&&this.setCamera(A);var Q=d[1];if(Q)if(this.xrManager.session){var H=this.xrManager.referenceSpace;if(H){var q=this.xrManager.cameraVR,U=this.xrManager.cameraL,z=this.xrManager.cameraR,j=[U,z],K=Q.getViewerPose(H),G=new n.Vector3(0,0,0);if(K){var _=void 0;switch(this.xrManager.machineType){case"Pico":_=this.xrManager.session.renderState.baseLayer;break;case"Oculus":var W=this.xrManager.session.renderState.layers;W&&(_=W[0]);break;default:this.xrManager.machineType}var X=K.views;if(!_)return void console.error("no layer found");this.renderer.setFramebuffer(_.framebuffer);var Y=!1;X.length!==q.cameras.length&&(q.cameras.length=0,Y=!0),this.parallaxCameraMatrixs=[];var Z=new n.Vector3,J=new n.Vector3;(new n.Matrix4).fromArray(X[0].transform.matrix).decompose(Z,new n.Quaternion,new n.Vector3),(new n.Matrix4).fromArray(X[1].transform.matrix).decompose(J,new n.Quaternion,new n.Vector3),J.clone().sub(Z).normalize();var $=new n.Vector3,ee=new n.Quaternion,te=new n.Vector3;this.camera.matrix.decompose($,ee,te);for(var ie=0;ie<X.length;ie++){var ne=X[ie],re=_.getViewport(ne),oe=j[ie];oe.matrix.fromArray(ne.transform.matrix);var se=new n.Vector3,ae=new n.Quaternion,le=new n.Vector3;oe.matrix.decompose(se,ae,le),G.copy($),oe.position.copy($),oe.quaternion.copy(ae),oe.scale.copy(le),oe.updateMatrix(),oe.projectionMatrix.fromArray(ne.projectionMatrix),oe.viewport.set(re.x,re.y,re.width,re.height),!0===Y&&q.cameras.push(oe)}}var ue=this.xrManager.session.inputSources;for(ie=0;ie<this.xrManager.controllers.length;ie++){var ce=this.xrManager.controllers[ie],he=ue[ie];ce.update(he,Q,H)}var de=this.xrManager.getController(0),pe=de.position.clone().add(G).sub(new n.Vector3(0,1.35,0));this.xrControllerRay.set(pe,new n.Vector3(0,0,-1).applyEuler(de.rotation));var fe=this.model.intersectRaycaster(this.xrControllerRay);if(fe.length>=1&&fe[0].face){this.pointerLine.setPoints(pe,fe[0].point);var Ae=fe[0].face.normal,ge=Ae.clone().multiplyScalar(.05),me=fe[0].point.clone().add(ge);this.intersectMesh.position.copy(me);var ve=me.clone().add(ge);if(this.intersectMesh.lookAt(ve),Math.abs(Ae.y)>.99){var ye=this.camera.position.clone().sub(me);this.intersectMesh.rotation.z=-Math.atan2(ye.z,ye.x)}this.intersectMesh.visible=!0,this.needsRender=!0,this.emit("intersectionOnModelUpdate",fe[0],this.intersectMesh)}if(this.camera.pose.distance>.1)for(var be=0;be<this.work.observers.length;be++){(Ee=this.panoMeshes[be])&&(Ee.visible=!1)}else{var xe=this.work.observers[this.currentPanoIndex];if(xe){var we=xe.visibleNodes.concat(this.currentPanoIndex),Me=this.getForwardPanoIndexOrNot();for(be=0;be<this.work.observers.length;be++){var Ee,Se=this.work.observers[be];if(Ee=this.panoMeshes[be])if(Se.loadable||Se.active)if(-1!==we.indexOf(be))if(v)Ee.visible=!1,Ee.setOpacity(0);else{Ee.visible=!0;var Ce=Ee.position.clone().setY(this.camera.position.y).distanceTo(this.camera.position);Ee.setCurrent(Me===be),Ee.setOpacity(Ce<.01?0:Mr(1.4/Ce,.5,.7)),Ee.updateTime&&Ee.updateTime(e,t)}else Ee.visible=!1,Ee.setOpacity(0);else Ee.visible=!1,Ee.setOpacity(0)}}}this.boundingMesh.visible=Boolean(null===(a=this.boundingMesh.getMaterial())||void 0===a?void 0:a.pano0)&&this.boundingMesh.boundingBox.containsPoint(this.camera.position);var Ie,Be=function(){if(!1===h.tileLevelForFov)return 0;var e=new n.Vector2(4e3,4e3),t=m.panoIndex,i=h.work.observers[t],r=h.imageOptions.size;if(void 0===r&&i){var o=i.images.up.match(/\/cube_(\d+)\//);o&&(r=Number(o[1]))}void 0===r&&(r=2048);var s=0;r>=1024&&(s=1),r>=2048&&(s=2),r>=4096&&(s=3),r>=8192&&(s=4);var a=h.tileLevelForFov(U.fov,e);return a>s?a:0}(),Te=((Ie=new n.PerspectiveCamera).applyMatrix4(q.matrix),Ie.position.set(0,0,0),Ie.quaternion.premultiply(h.work.observers[m.panoIndex].quaternion.clone().inverse()),Ie.updateProjectionMatrix(),Ie.updateMatrixWorld(!0),(new n.Frustum).setFromProjectionMatrix((new n.Matrix4).multiplyMatrices(Ie.projectionMatrix,Ie.matrixWorldInverse)));m.panoIndex===this.currentPanoIndex&&(null===(l=m.leftPanoPicture)||void 0===l?void 0:l.map)instanceof ri&&(m.leftPanoPicture.map.update(Te,Be),!0===m.leftPanoPicture.map.needsRender&&(this.needsRender=!0));var Pe=this.tiling.object.visible;if(Be>this.TILED_CUBE_TEXTURE_LEVEL&&this.initAnimationed){var Re=m.panoIndex,De=this.work.observers[Re];De&&ss(this.camera.position,De.position)&&this.locationMotion.ended?(this.tiling.object.visible=!0,this.tiling.panoIndex!==Re&&this.tiling.cleanup(),this.tiling.panoIndex=Re,this.tiling.setResource(null!==(c=null===(u=De.images)||void 0===u?void 0:u.tiles)&&void 0!==c?c:[],this.enableIOSEDR&&De.images.luminance?De.images.luminance:null),this.tiling.setRotation(De.quaternion),this.tiling.setPosition(De.position),this.tiling.update(Te,Be,e)):this.tiling.object.visible=!1}else this.tiling.object.visible=!1;Pe!==this.tiling.object.visible&&(this.tiling.object.needsRender=!0),this.panoVideo.object.position.copy(this.camera.position),this.panoVideo.updateTime(e);var Le=ue[0].gamepad;if((null==Le?void 0:Le.axes)&&this.emit("webXRSelected","Axes",{axes:Le.axes}),-1===(null==Le?void 0:Le.axes[2])){if(!this.xrControllerState.axes[2].left.isTap){var ke=e-this.xrControllerState.axes[2].left.startTime;ke>=300&&this.emit("webXRSelected","RightAxesLeftTap"),this.xrControllerState.axes[2].left.isTap=!0}}else this.xrControllerState.axes[2].left.isTap=!1,this.xrControllerState.axes[2].left.startTime=0;if(1===(null==Le?void 0:Le.axes[2])){if(!this.xrControllerState.axes[2].right.isTap){var Oe=e-this.xrControllerState.axes[2].right.startTime;Oe>=300&&this.emit("webXRSelected","RightAxesRightTap"),this.xrControllerState.axes[2].right.isTap=!0}}else this.xrControllerState.axes[2].right.isTap=!1,this.xrControllerState.axes[2].right.startTime=0;if(-1===(null==Le?void 0:Le.axes[3])){if(!this.xrControllerState.axes[3].up.isTap){var Fe=e-this.xrControllerState.axes[3].up.startTime;Fe>=300&&this.emit("webXRSelected","RightAxesUpTap"),this.xrControllerState.axes[3].up.isTap=!0}}else this.xrControllerState.axes[3].up.isTap=!1,this.xrControllerState.axes[3].up.startTime=0;if(1===(null==Le?void 0:Le.axes[3])){if(!this.xrControllerState.axes[3].down.isTap){var Ne=e-this.xrControllerState.axes[3].down.startTime;Ne>=300&&this.emit("webXRSelected","RightAxesDownTap"),this.xrControllerState.axes[3].down.isTap=!0}}else this.xrControllerState.axes[3].down.isTap=!1,this.xrControllerState.axes[3].down.startTime=0;if(null==Le?void 0:Le.buttons[0].pressed){if(!this.xrControllerState.select.isTap){var Ve=e-this.xrControllerState.select.startTime;Ve>=300&&this.emit("webXRSelected","Select",{raycaster:this.xrControllerRay}),this.xrControllerState.select.isTap=!0}}else this.xrControllerState.select.isTap=!1,this.xrControllerState.select.startTime=0;if(null==Le?void 0:Le.buttons[1].pressed){if(!this.xrControllerState.squeeze.isTap){var Qe=e-this.xrControllerState.squeeze.startTime;Qe>=300&&this.emit("webXRSelected","Squeeze",{raycaster:this.xrControllerRay}),this.xrControllerState.squeeze.isTap=!0}}else this.xrControllerState.squeeze.isTap=!1,this.xrControllerState.squeeze.startTime=0;if(null==Le?void 0:Le.buttons[2].pressed){if(!this.xrControllerState.leftButtonA.isTap){var He=e-this.xrControllerState.leftButtonA.startTime;He>=300&&this.emit("webXRSelected","LeftButtonA",{raycaster:this.xrControllerRay}),this.xrControllerState.leftButtonA.isTap=!0}}else this.xrControllerState.leftButtonA.isTap=!1,this.xrControllerState.leftButtonA.startTime=0;if(null==Le?void 0:Le.buttons[3].pressed){if(!this.xrControllerState.leftButtonB.isTap){var qe=e-this.xrControllerState.leftButtonB.startTime;qe>=300&&this.emit("webXRSelected","LeftButtonB",{raycaster:this.xrControllerRay}),this.xrControllerState.leftButtonB.isTap=!0}}else this.xrControllerState.leftButtonB.isTap=!1,this.xrControllerState.leftButtonB.startTime=0;if(null==Le?void 0:Le.buttons[4].pressed){if(!this.xrControllerState.rightButtonA.isTap){var Ue=e-this.xrControllerState.rightButtonA.startTime;Ue>=300&&this.emit("webXRSelected","RightButtonA",{raycaster:this.xrControllerRay}),this.xrControllerState.rightButtonA.isTap=!0}}else this.xrControllerState.rightButtonA.isTap=!1,this.xrControllerState.rightButtonA.startTime=0;if(null==Le?void 0:Le.buttons[5].pressed){if(!this.xrControllerState.rightButtonB.isTap){var ze=e-this.xrControllerState.rightButtonB.startTime;ze>=300&&this.emit("webXRSelected","RightButtonB",{raycaster:this.xrControllerRay}),this.xrControllerState.rightButtonB.isTap=!0}}else this.xrControllerState.rightButtonB.isTap=!1,this.xrControllerState.rightButtonB.startTime=0}}else console.error("session丢失,请重试");else console.error("xrFrame丢失,请重试")},t.prototype.render=function(){var e=this.xrManager.getCamera(this.camera);this.renderer.render(this.scene,e)},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}(Aa),Sl=["Panorama","DepthPanorama","Model"],Cl={Floorplan:Os,Topview:qs,Panorama:Aa,VRPanorama:Ja,Model:$a,DepthPanorama:sl,Mapview:ul,XRPanorama:El};function Il(e){for(var t=0,i=Sl;t<i.length;t++){var n=i[t];if("string"==typeof e){if(n===e)return!0}else if(e instanceof ks&&e instanceof Cl[n])return!0}return!1}var Bl=["cameraDirectionUpdate","cameraUpdate","cameraPositionUpdate","panoSelected","moveToPano","moveToPanoCanceled","panoWillArrive","movingToPano","panoArrived","panoWillLoad","panoLoaded","panoLoadError","initAnimationEnded","initAnimationWillStart","wantsGesture","gesture","wantsTapGesture","tapGesture","wantsPressGesture","pressGesture","wantsPanGesture","wantsInteriaPan","panGesture","interiaPan","wantsPinchGesture","pinchGesture","wantsMouseWheel","mouseWheel","wantsShowIntersectionOnModel","intersectionOnModelUpdate","intersectionHidden","textureStartLoad","textureLoading","textureAbort","textureLoaded","textureError","webXRSessionStart","webXRSessionEnd","webXRSelected"];function Tl(e){for(var t,i,n={},r=0,o=e.split(/(\;|\,)/);r<o.length;r++){var s=o[r].split("="),a=null===(t=s[0])||void 0===t?void 0:t.trim(),l=null===(i=s[1])||void 0===i?void 0:i.trim();a&&l&&(n[a]=l)}return n}function Pl(){for(var e,t=document.getElementsByTagName("meta"),i=0;i<t.length;i++){var n=t[i];if("viewport"===n.getAttribute("name")){var r=Tl(null!==(e=n.getAttribute("content"))&&void 0!==e?e:""),o=Number(r["initial-scale"]);if(!isNaN(o))return o}}return 1}var Rl=[351,63],Dl=[20,20],Ll=new Float32Array([-.5,-.5,0,.5,-.5,0,-.5,.5,0,.5,.5,0]),kl=new Float32Array([0,0,1,0,0,1,1,1]),Ol=new Uint8Array([0,1,2,1,3,2]),Fl=new n.BufferGeometry;Fl.setAttribute("position",new n.BufferAttribute(Ll,3)),Fl.setAttribute("uv",new n.BufferAttribute(kl,2)),Fl.setIndex(new n.BufferAttribute(Ol,1));var Nl=new n.MeshBasicMaterial({transparent:!0,depthTest:!1}),Vl=new n.Mesh(Fl,Nl),Ql=new n.Scene;Ql.add(Vl);var Hl=new n.OrthographicCamera(-.5,.5,.5,-.5,.1,1);Hl.position.set(0,0,.5),Hl.lookAt(0,0,0);var ql=new n.Vector4,Ul=new n.Vector4;function zl(e){if(Nl.map){var t=e.getViewport(ql),i=e.getScissor(Ul),r=e.getScissorTest(),o=e.autoClear;e.setViewport(i.x+Dl[0]/3,i.y+Dl[1]/3,Rl[0]/3,Rl[1]/3),e.setScissor(i.x+Dl[0]/3,i.y+Dl[1]/3,Rl[0]/3,Rl[1]/3),e.setScissorTest(!0),e.autoClear=!1,e.render(Ql,Hl),e.setViewport(t),e.setScissor(i),e.setScissorTest(r),e.autoClear=o}else{var s=new n.Texture,a=new Image;a.onload=function(){s.image=a,s.wrapS=n.ClampToEdgeWrapping,s.wrapT=n.ClampToEdgeWrapping,s.minFilter=n.LinearFilter,s.needsUpdate=!0,Nl.needsUpdate=!0,a.onload=function(){}},a.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAV8AAAA/CAQAAADtPwPkAAAR+0lEQVR4AezYg3LEQACH8d1cbdu23Q5qG9G47z/TN/h6tn2b/H+TUTLc7yjcOXV46OUAnUs6EbUp022ZBXc1NhoZYYd7fjDRvdcHAwrlK2QBVJ4sgoqONmY45RUT23sZ6H42F2hK5CtkMbjhZlDmUUcvq1zyieUVyjbE4I1GBfItwxG56YaUZTQwyh4P6NgJ4YYYvCuQb5kOyI03pORjiqe4Lwpq5pt1vJqfUwKWJVbSMYfppYconG+maNNQOWBZuwHTzicGel75NtFOkxr5apmV8cikcko0DrDQs863AeGl0cE0+1xy573m0/wf0cEKW6H7BWtggiMG8sy3oHRDpJMw4NWb6am/bv9znkqEzjd61t5oo5clTrjhwevO75EJRBKSRt745Z16ZEjcM73sccZplBPm8PyTcxZAkSRdHm/acJ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EG57vU67OBeuMV8KXLUzv93UTTj42tvaFS++GVsc5JRyLSLJ8nzO555hFBmiSRCqMr4GwrcmGkib5xSvcwmzFK6e8s7DMa2xH4YZdZumSOwsVzFeBWdr37tpIhOpSwXqONNgZq/2KgvBt54znHN1HzlljTO4oVD5fb+prNIJXQNL1ofDKQisbPLJDv3jNSLq9OkYBEIihKIj3v7S1TRQCX5Kdl1ZQlol7LF+E++fwirfiq2sf4cTXxc6hzxffPuLEeqSWrPGWMF58TWr5viyJAP5/4EV4KePiaSE8eNRgjDy8/tyRW+FZjhS+2tlovNJovtJovNJ0uhK6Wo64SDdxEbM//KesjwAAAABJRU5ErkJggg==",Nl.map=s}}var jl=new n.Box3(new n.Vector3(-50,-50,-50),new n.Vector3(50,50,50)),Kl=function(e){return e.replace("//vrlab-public.ljcdn.com/","//vr-public.realsee-cdn.cn/").replace("//vrlab-image4.ljcdn.com/","//vr-image-4.realsee-cdn.cn/").replace("//vrlab-image3.ljcdn.com/","//vr-image-3.realsee-cdn.cn/").replace("//vrlab-image2.ljcdn.com/","//vr-image-2.realsee-cdn.cn/").replace("//vrlab-image1.ljcdn.com/","//vr-image-1.realsee-cdn.cn/")},Gl=new n.Vector2,_l=new n.Frustum,Wl=new n.Matrix4,Xl=new WeakMap,Yl=new WeakMap,Zl=function(e){function t(t){void 0===t&&(t={});var i,r,o,s,a,l,u,c,h,d,p,f=this;if((f=e.call(this)||this).ident=rr(),Jl.instances[f.ident]=f,f.renderSwitch01=0,f.panoIndex=0,f.needsRender=!1,f.onlyRenderIfNeeds=null===(i=t.onlyRenderIfNeeds)||void 0===i||i,f.imageOptions=Oe({},null!==(r=t.imageOptions)&&void 0!==r?r:{}),f.textureOptions=Oe({},null!==(o=t.textureOptions)&&void 0!==o?o:{}),f.poweredByRealsee=null===(s=t.poweredByRealsee)||void 0===s||s,f.extraElements=[],f.controllerInits={Panorama:Object.assign({},t.panorama),Model:Object.assign({},t.model),Floorplan:Object.assign({},t.floorplan),Topview:Object.assign({},t.topview),Mapview:Object.assign({},t.mapview),DepthPanorama:Object.assign({},t.depthPanorama),VRPanorama:Object.assign({},t.vrPanorama),XRPanorama:Object.assign({},t.xrPanorama)},f.fps={testCount:0,testTime:ze()},f.modeChangeDuration=null!==(a=t.modeChangeDuration)&&void 0!==a?a:800,f.panoramaLikeSavedPose={},"undefined"!=typeof window)if(t.renderer)t.renderer instanceof hi&&f.throwError(new Error("cannot render a internal renderer")),f.renderer=t.renderer;else try{f.renderer=new hi({preserveDrawingBuffer:t.preserveDrawingBuffer,backgroundColor:t.backgroundColor,backgroundAlpha:t.backgroundAlpha,antialias:t.antialias,webgl2:null==t?void 0:t.webgl2});var A=Pl();f.renderer.setPixelRatio(1===A?window.devicePixelRatio:1),f.renderer.setSize(512,512)}catch(e){e instanceof Error&&f.throwError(e)}f.copyEffect=new Ls(f.renderer),f.getPixelsRenderTarget=new n.WebGLRenderTarget(1,1,{encoding:null!==(u=null===(l=f.renderer)||void 0===l?void 0:l.outputEncoding)&&void 0!==u?u:n.sRGBEncoding}),f.scissor=Object.assign({left:0,bottom:0,width:1,height:1},t.scissor),f.camera=new bi(80),f.scene=new di,f.parallaxScene=new di,f.lastLoadWorkTask=Promise.resolve(),f.requestProxy=null!==(c=t.requestProxy)&&void 0!==c?c:Kl,f.networkSubscribe=new ot,f.networkSubscribe.on("network",(function(e,t,i,n){var r;f.emit("network",e,t,i,n),null===(r=f.analysis)||void 0===r||r.network(f.work,e,t,i,n)})),f.model=new wr({allowHosts:[],requestProxy:f.requestProxy,networkSubscribe:f.networkSubscribe});var g=cs(jl);g.name="model_empty",f.model.add(g),f.model.visible=!1,f.readyCallbacks=[],f.modelPending=!1,f.syncingState=!1,f.scene.add(f.model),f.helperGroup=new n.Group,f.helperGroup.name="helper",f.scene.add(f.helperGroup),f.videoTexture=new n.VideoTexture(t.videoInstance||function(){var e=document.createElement("video");e.loop=!0,e.autoplay=!0,e.playsInline=!0,e.muted=!0,e.crossOrigin="";var t=function(){document.removeEventListener("touchstart",t,!1),document.removeEventListener("mousedown",t,!1),e.muted=!1};return document.addEventListener("touchstart",t,!1),document.addEventListener("mousedown",t,!1),e}()),function(e){(t=new n.DirectionalLight(16777215,.5)).position.copy(new n.Vector3(1,1,1)),e.add(t);var t=new n.DirectionalLight(16777215,.3);e.add(t),t=new n.AmbientLight(16777215,.3),e.add(t)}(f.scene),f.state={mode:null!==(h=f.currentMode)&&void 0!==h?h:"Panorama",panoIndex:null!==(d=f.panoIndex)&&void 0!==d?d:0,longitude:f.camera.pose.longitude,latitude:f.camera.pose.latitude,fov:f.camera.pose.fov,offset:f.camera.pose.offset.clone(),distance:f.camera.pose.distance},f.stateSynced=!1,f._enableIOSEDR=!1,f.destroyed=!1,f.paused=!0,"undefined"!=typeof window&&(!1!==t.play&&f.play(),!1!==(null!==(p=t.initialBasisLoader)&&void 0!==p&&p)&&("string"==typeof t.initialBasisLoader?f.initBasisLoader(t.initialBasisLoader):f.initBasisLoader()),f.stopAnimationLoop=dt.shared.add((function(e,t){for(var i=[],n=2;n<arguments.length;n++)i[n-2]=arguments[n];f.updateTime.apply(f,Fe([e,t],i,!1))}),!1,0,10));var m=function(){"undefined"!=typeof document&&null===document.fullscreenElement&&"VRPanorama"===f.currentMode&&f.controller.emit("vrWantsToExit")};if("undefined"!=typeof document&&document.addEventListener("fullscreenchange",m,!1),f.removeEventListeners=function(){"undefined"!=typeof document&&document.removeEventListener("fullscreenchange",m,!1)},f.plugins={},t.plugins&&t.plugins.length)for(var v=0,y=t.plugins;v<y.length;v++){var b=y[v];if("function"==typeof b)b(f);else if(Array.isArray(b)){var x=b[0],w=b[1],M=b[2];if("function"==typeof x){var E=x(f,M);"string"==typeof w&&(f.plugins[w]?f.throwError(new Error("plugin name ".concat(w," is exists."))):f.plugins[w]=E)}}}return f.gpuPickingRenderTarget=new n.WebGLRenderTarget(1,1),f.meshReplaceMaterialMap=new Map,f.meshOriginMaterialMap=new Map,f}return ke(t,e),Object.defineProperty(t,"version",{get:function(){return"5.0.0-alpha.164"},enumerable:!1,configurable:!0}),t.prototype.getGPUPicking=function(e,t,i,r,o){var s=this;if(void 0===r&&(r=1),void 0===o&&(o=new n.Vector3(0,0,0)),!this.renderer)throw new Error("renderer is not initialized.");this.model.setMaterial({modelColorInfo:o}),this.scene.traverse((function(e){if(e instanceof n.Mesh&&!(e instanceof xt)){var t=Object.keys(i).filter((function(t){return t===e.uuid}))[0];if(t)if(s.meshOriginMaterialMap.set(t,e.material),s.meshReplaceMaterialMap.get(t))e.material=s.meshReplaceMaterialMap.get(t);else{var r=new n.ShaderMaterial({uniforms:{color:{value:i[t]}},vertexShader:"\n void main() {\n vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n gl_Position = projectionMatrix * mvPosition;\n }\n ",fragmentShader:"\n uniform vec3 color;\n void main() {\n gl_FragColor = vec4( color, 1.0 );\n }\n "});r.depthTest=e.material.depthTest,r.side=e.material.side,s.meshReplaceMaterialMap.set(t,r),e.material=r}}}));var a=this.renderer.getSize(new n.Vector2);this.camera.setViewOffset(a.width,a.height,e*r,t*r,1,1),this.renderer.setRenderTarget(this.gpuPickingRenderTarget),this.render();var l=new Uint8Array(4);this.renderer.readRenderTargetPixels(this.gpuPickingRenderTarget,0,0,1,1,l),this.renderer.setRenderTarget(null),this.camera.clearViewOffset(),this.scene.traverse((function(e){e instanceof n.Mesh&&!(e instanceof xt)&&s.meshOriginMaterialMap.get(e.uuid)&&(e.material=s.meshOriginMaterialMap.get(e.uuid))})),this.model.setMaterial({modelColorInfo:null});var u=Object.keys(i).filter((function(e){return i[e].equals((new n.Color).setRGB(l[0]/255,l[1]/255,l[2]/255))}))[0];return u||!1},t.prototype.dispose=function(){var e,t;if(!0!==this.destroyed){delete Jl.instances[this.ident],this.emit("dispose"),this.destroyed=!0,this.pause(),this.stopAnimationLoop&&(this.stopAnimationLoop(),delete this.stopAnimationLoop),null===(e=this.renderer)||void 0===e||e.setAnimationLoop(null),this.off(),this.networkSubscribe.off(),this.controller&&(this.controller.destroy(),this.controller=void 0);var i=this.getElement();i&&i.parentNode&&i.parentNode.removeChild(i),this.scene.remove(this.model);var n=this.model.getMaterial();n&&(n.pano0&&n.pano0.map.dispose(),n.pano1&&n.pano1.map!==(null===(t=n.pano0)||void 0===t?void 0:t.map)&&n.pano1.map.dispose()),this.model.dispose(),this.diposeGPUPickingMaterial(),this.renderer instanceof hi&&this.renderer.forceContextLoss&&this.renderer.forceContextLoss()}},t.prototype.setScissor=function(e){Object.assign(this.scissor,e),this.controller&&this.controller.updateRenderSize&&this.controller.updateRenderSize()},Object.defineProperty(t.prototype,"helperVisible",{get:function(){return this.helperGroup.visible},set:function(e){this.helperGroup.visible!==e&&(this.helperGroup.visible=e,this.emit("helpersVisibleChange",e),this.needsRender=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enableIOSEDR",{get:function(){return this._enableIOSEDR},set:function(e){this._enableIOSEDR!==e&&(this._enableIOSEDR=e,this.currentMode&&"Panorama"===this.currentMode&&this.changeMode(this.currentMode,{},0,!1,!0))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enablePostProcessing",{get:function(){return void 0!==this.screenBuffers},set:function(e){var t,i,r,o;if(e){if(!this.screenBuffers){var s=this.getDrawingBufferSize(Gl);this.screenBuffers=[new n.WebGLRenderTarget(s.x,s.y,{encoding:null!==(i=null===(t=this.renderer)||void 0===t?void 0:t.outputEncoding)&&void 0!==i?i:n.sRGBEncoding}),new n.WebGLRenderTarget(s.x,s.y,{encoding:null!==(o=null===(r=this.renderer)||void 0===r?void 0:r.outputEncoding)&&void 0!==o?o:n.sRGBEncoding})]}}else this.screenBuffers&&(this.screenBuffers[0].dispose(),this.screenBuffers[1].dispose(),delete this.screenBuffers);this.needsRender=!0},enumerable:!1,configurable:!0}),t.prototype.updateConfiguration=function(e){var t=!1;e.panorama&&(Object.assign(this.controllerInits.Panorama,e.panorama),"Panorama"===this.currentMode&&(t=!0)),e.model&&(Object.assign(this.controllerInits.Model,e.model),"Model"===this.currentMode&&(t=!0)),e.floorplan&&(Object.assign(this.controllerInits.Floorplan,e.floorplan),"Floorplan"===this.currentMode&&(t=!0)),e.topview&&(Object.assign(this.controllerInits.Topview,e.topview),"Topview"===this.currentMode&&(t=!0)),e.mapview&&(Object.assign(this.controllerInits.Mapview,e.topview),"Mapview"===this.currentMode&&(t=!0)),e.depthPanorama&&(Object.assign(this.controllerInits.DepthPanorama,e.depthPanorama),"DepthPanorama"===this.currentMode&&(t=!0)),e.vrPanorama&&(Object.assign(this.controllerInits.VRPanorama,e.vrPanorama),"VRPanorama"===this.currentMode&&(t=!0)),e.imageOptions&&(Object.assign(this.imageOptions,e.imageOptions),"Panorama"!==this.currentMode&&"DepthPanorama"!==this.currentMode&&"VRPanorama"!==this.currentMode||(t=!0)),t&&this.controller&&this.currentMode&&this.changeMode(this.currentMode,this.getCurrentState(),0,!1,!0)},t.prototype.appendTo=function(e,t){if(void 0===t&&(t={}),this.renderer)if(this.renderer instanceof hi){var i=this.getElement();if(i){e.appendChild(i),this.refresh(t);var n=window.getComputedStyle(e).position;"relative"!==n&&"absolute"!==n&&"fixed"!==n&&"sticky"!==n&&(e.style.position="relative")}}else this.throwError(new Error("cannot call appendTo method when render a external renderer"))},t.prototype.refresh=function(e,t){if(void 0===e&&(e={}),this.renderer){var i=this.getElement();if(i){var r=i.parentNode;if(r&&r.nodeName){var o=e.width,s=void 0===o?r.offsetWidth:o,a=e.height,l=void 0===a?r.offsetHeight:a;if(this.renderer instanceof hi){if(t)this.renderer.setPixelRatio(t);else{if((t=1===Pl()?Math.floor(window.devicePixelRatio):1)>1)for(;t>1&&s*l*t*t>7372800;)t--;this.renderer.setPixelRatio(t)}this.renderer.setSize(s,l)}}var u=this.renderer.getSize(new n.Vector2);this.camera.aspect=u.x*this.scissor.width/(u.y*this.scissor.height),this.camera.updateProjectionMatrix(),this.controller&&this.controller.updateRenderSize&&this.controller.updateRenderSize(),this.needsRender=!0}}},t.prototype.addExtraElement=function(e){var t=this;return-1===this.extraElements.indexOf(e)&&(this.extraElements.push(e),this.controller&&this.controller.bindExtraElement(e)),function(){return t.removeExtraElement(e)}},t.prototype.removeExtraElement=function(e){var t=this.extraElements.indexOf(e);-1!==t&&(this.extraElements.splice(t,1),this.controller&&this.controller.unbindExtraElement(e))},t.prototype.getPose=function(){var e=this.camera.copyPose(),t=e.longitude,i=e.latitude,n=e.fov,r=e.offset,o=e.distance;return{longitude:t,latitude:i,fov:n,offset:r.clone(),distance:o}},t.prototype.getSize=function(e){if(!this.renderer)throw new Error("renderer is not initialized");return this.renderer.getSize(e),e.x*=this.scissor.width,e.y*=this.scissor.height,e},t.prototype.getDrawingBufferSize=function(e){if(!this.renderer)throw new Error("renderer is not initialized");return this.renderer.getDrawingBufferSize(e),e.x*=this.scissor.width,e.y*=this.scissor.height,e},t.prototype.updateCamera=function(e,t,i){return void 0===i&&(i=!0),this.controller?this.controller.updateCamera(e,t,i):Promise.reject(new Error("controller is not initialized."))},t.prototype.updateCameraWithKeyframes=function(e,t,i){return void 0===i&&(i=!0),this.controller?this.controller.updateCameraWithKeyframes(e,t,i):Promise.reject(new Error("controller is not initialized."))},t.prototype.getLongitudeAndLatitude=function(){var e=this.getPose();return{longitude:e.longitude,latitude:e.latitude}},t.prototype.getOffset=function(){return this.getPose().offset},t.prototype.getCameraLocal=function(){if("number"==typeof this.panoIndex&&this.controller&&this.work){var e=this.work.observers[this.panoIndex],t=new n.Object3D;return t.position.copy(e.position),t.quaternion.copy(e.quaternion),t.scale.set(1,1,1),t.updateMatrixWorld(!0),function(e,t){var i=new n.Vector3(0,0,-1);i.applyQuaternion(e.quaternion);var r=t.quaternion.clone().inverse();return i.applyQuaternion(r),{theta:Math.atan2(i.x,-i.z),phi:-Math.asin(i.y),lookAtVector:i}}(this.camera,t)}},t.prototype.initBasisLoader=function(e){try{if(!this.renderer)throw new Error("renderer is not initialized.");if("undefined"==typeof Promise||"undefined"==typeof WeakMap||"undefined"==typeof WebAssembly)throw new Error("Basis loader not support.");"string"==typeof e&&ii.setTranscoderPath(e),ii.workerConfig.format||ii.detectSupport(this.renderer),ii._allocateWorker(0)}catch(e){e instanceof Error&&this.throwError(e)}},Object.defineProperty(t.prototype,"work",{get:function(){var e=Yl.get(this);if(e&&Lr.get(e))return e},enumerable:!1,configurable:!0}),t.prototype.load=function(e,t,i,n){var r=this;if(void 0===n&&(n=!0),!this.renderer)throw new Error("renderer is not initialized");var o=this.lastLoadWorkTask.then((function(){return!(o=e)||"object"!=typeof o&&"function"!=typeof o||"function"!=typeof o.then?r.load_(e,t,i,n):e.then((function(e){return r.load_(e,t,i,n)}));var o}));return this.lastLoadWorkTask=o.catch((function(e){r.throwError(e)})),o},t.prototype.load_=function(e,i,n,r){var o,s,a,l,u,c,h,d,p,f=this;void 0===r&&(r=!0);var A,g,m,v=Vr(e),y=this.work;void 0===i&&(i=y?"inherit":"initial"),"inherit"===i?(A="number"==typeof this.panoIndex&&v.observers[this.panoIndex]?this.panoIndex:v.initial.panoIndex,g=null!==(o=this.currentMode)&&void 0!==o?o:v.initial.mode,m={longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude,fov:this.camera.pose.fov}):"initial"===i?(g=null!==(s=this.currentMode)&&void 0!==s?s:v.initial.mode,A=v.initial.panoIndex,m=g===t.Mode.Panorama||g===t.Mode.DepthPanorama||g===t.Mode.Model||g===t.Mode.VRPanorama||g===t.Mode.XRPanorama?{longitude:v.initial.longitude,latitude:v.initial.latitude,fov:v.initial.fov}:{longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude,fov:this.camera.pose.fov}):(A=null!==(a=i.panoIndex)&&void 0!==a?a:v.initial.panoIndex,g=null!==(u=null!==(l=i.mode)&&void 0!==l?l:this.currentMode)&&void 0!==u?u:"Panorama",m={longitude:null!==(c=i.longitude)&&void 0!==c?c:v.initial.longitude,latitude:null!==(h=i.latitude)&&void 0!==h?h:v.initial.latitude,fov:null!==(d=i.fov)&&void 0!==d?d:v.initial.fov}),this.emit("willLoad",e,v,{panoIndex:A,mode:g,longitude:m.longitude,latitude:m.latitude,fov:m.fov});var b=function(){var t;f.panoIndex=A,f.panoramaLikeSavedPose.longitude=v.initial.longitude,f.panoramaLikeSavedPose.latitude=v.initial.latitude,f.panoramaLikeSavedPose.fov=v.initial.fov;var i=f.controller?null!=n?n:f.modeChangeDuration:0,o=Oe(Oe({initial:[A,m,i,r]},f.commonParams()),f.controllerInits[g]);f.controller?!1===f.controller.updateWork(v,A,m,i,r)&&(f.controller.destroy(),f.controller=f.applyController(g,o)):f.controller=f.applyController(g,o),f.emit("load",e,v,{panoIndex:A,mode:g,longitude:m.longitude,latitude:m.latitude,fov:m.fov}),null===(t=f.analysis)||void 0===t||t.work(v)},x=function(e){var t;void 0===e&&(e=qe),v.model&&(f.model.name!==(null===(t=v.model)||void 0===t?void 0:t.file)?(f.emit("modelWillLoad",v.model),f.loadModel(v.model,v.allowHosts,e,!0)):e&&e())};return Yl.set(this,v),g===t.Mode.Floorplan||g===t.Mode.Topview||g===t.Mode.Mapview||g===t.Mode.Model?x((function(){b(),f.needsRender=!0})):(this.controller||(this.camera.setFromPose({distance:0,fov:v.initial.fov,longitude:v.initial.longitude,latitude:v.initial.latitude,offset:v.observers[v.initial.panoIndex].position}),this.needsRender=!0),b(),null===(p=this.controller)||void 0===p||p.once("panoLoaded",(function(){f.needsRender=!0,f.emit("cameraUpdate",f.camera.copyPose(),r),x()}))),this.ready().then((function(){f.emit("loaded",e,f.work)}))},t.prototype.changeMode=function(e,i,n,r,o){var s=this;if(void 0===i&&(i={}),void 0===n&&(n=this.modeChangeDuration),void 0===r&&(r=!0),void 0===o&&(o=!1),!this.renderer)throw new Error("renderer is not initialized.");return new Promise((function(a,l){if(!t.Mode.hasOwnProperty(e)){var u=new Error('mode "'.concat(e,'" is not existed'));return s.throwError(u),void l(u)}if((e===t.Mode.Floorplan||e===t.Mode.Topview||e===t.Mode.Mapview||e===t.Mode.Model)&&(vr(s.model)||!0!==s.model.loaded)){u=new Error("model is not ready.");return s.throwError(u),void l(u)}if(vr(s.controller)){u=new Error("controller is not ready.");return s.throwError(u),void l(u)}var c=s.controller,h=s.currentMode,d=function(){var u,d,p,f;if(s.emit("wantsChangeMode",e,h))l(new Error("change mode canceled."));else{if(s.controller&&!1===o&&h===e)e===t.Mode.Panorama||e===t.Mode.DepthPanorama||e===t.Mode.Model||e===t.Mode.VRPanorama||e===t.Mode.XRPanorama?"number"==typeof i.panoIndex&&i.panoIndex!==s.panoIndex?s.controller.moveToPano(null!==(d=null!==(u=i.panoIndex)&&void 0!==u?u:s.panoIndex)&&void 0!==d?d:0,Oe({duration:n},i),r):s.controller.updateCamera(i,n,r).catch(qe):("number"==typeof i.panoIndex&&i.panoIndex!==s.panoIndex&&(s.panoIndex=i.panoIndex),s.controller.updateCamera(i,n,r).catch(qe));else{c.destroy();var A=null!==(f=null!==(p=i.panoIndex)&&void 0!==p?p:s.panoIndex)&&void 0!==f?f:0,g=Il(e)?s.panoramaLikeSavedPose:{};e===t.Mode.Mapview&&(g.longitude=s.panoramaLikeSavedPose.longitude),"number"!=typeof i.longitude&&"number"!=typeof i.latitude||(g.longitude=i.longitude,g.latitude=i.latitude),"number"==typeof i.fov&&(g.fov=i.fov);var m=Oe(Oe({initial:[A,g,n,r]},s.commonParams()),s.controllerInits[e]);s.saveControllerPose(c),s.controller=s.applyController(e,m);var v=Cl[e].initAnimationEndPose(m);s.emit("modeChange",e,h,A,v,r)}a()}};if(e===t.Mode.VRPanorama)s.requestFullscreen(),("undefined"==typeof location||"https:"!==location.protocol?Promise.reject(new Error("Request DeviceOrientation Permission denied.")):"undefined"!=typeof DeviceOrientationEvent&&"function"==typeof DeviceOrientationEvent.requestPermission?DeviceOrientationEvent.requestPermission().then((function(e){if("granted"==e)return Promise.resolve();var t=new Error("Request DeviceOrientation Permission denied.");return Promise.reject(t)})):Promise.resolve()).then((function(){return d()})).catch((function(e){e instanceof Error&&(s.exitFullscreen(),s.throwError(e),l(e))}));else if(e===t.Mode.XRPanorama){var p=dt.shared.getContext();p?p.end():function(){if("xr"in navigator)return navigator.xr.isSessionSupported("immersive-vr").then((function(e){return e?Promise.resolve():Promise.reject()})).then((function(){return navigator.xr.requestSession("immersive-vr",{optionalFeatures:["local-floor","bounded-floor"]}).then((function(e){return Promise.resolve(e)}))}));var e=new Error("Request XR Permission denied.");return Promise.reject(e)}().then((function(e){dt.shared.setContext(e),d()})).catch((function(e){e instanceof Error&&(s.throwError(e),l(e))}))}else d()}))},t.prototype.getPixels=function(e,t,i,r,o){if(void 0===o&&(o=1),!this.renderer)throw new Error("renderer is not initialized.");var s=this.getPixelsRenderTarget,a=this.renderer.getSize(new n.Vector2);e=Mr(e,Math.floor(i/2),Math.floor(a.x-i)),t=Mr(t,Math.floor(r/2),Math.floor(a.y-r)),s.setSize(i*o,r*o),this.renderer.setRenderTarget(s),this.camera.setViewOffset(a.width,a.height,e,a.height-t-r,i,r),this.controller?this.controller.render():this.renderer.render(this.scene,this.camera);var l=new Uint8Array(i*o*r*o*4);return this.renderer.readRenderTargetPixels(s,0,0,i*o,r*o,l),this.renderer.setRenderTarget(null),this.camera.clearViewOffset(),l},t.prototype.getElement=function(){var e;return null===(e=this.renderer)||void 0===e?void 0:e.domElement},t.prototype.render=function(e,t){var i,n=this;if(void 0===t&&(t=!1),!this.renderer)return null;var r=bt.shared,o=null===(i=this.model.getMaterial())||void 0===i?void 0:i.clippers;if(o&&r.update(o,this.camera),this.model.setMaterial({clipperPlanesArray:o?r.clipperPlanes:null,clipperFloors:o?r.clipperFloors:null}),t){var s=this.renderer.getSize(Gl);this.scene.traverseVisible((function(e){e.setResolution&&e.setResolution(s.x,s.y)}))}if(this.controller&&this.screenBuffers&&null===this.renderer.getRenderTarget()){var a=this.getDrawingBufferSize(Gl);return this.screenBuffers[0].setSize(a.x,a.y),this.screenBuffers[1].setSize(a.x,a.y),this.renderer.setRenderTarget(this.screenBuffers[0]),this.controller.render(),"VRPanorama"!==this.currentMode&&"XRPanorama"!==this.currentMode&&this.poweredByRealsee&&zl(this.renderer),this.renderer.setRenderTarget(null),e&&dt.shared.add(e,!0),this.screenBuffers[0]}return this.aroundScissor((function(){n.renderer&&(n.controller?n.controller.render():n.renderer.render(n.scene,n.camera),n.poweredByRealsee&&"VRPanorama"!==n.currentMode&&"XRPanorama"!==n.currentMode&&zl(n.renderer)),e&&dt.shared.add(e,!0)})),null},t.prototype.updateTime=function(e,t){for(var i,r=this,o=[],s=2;s<arguments.length;s++)o[s-2]=arguments[s];if(!this.destroyed){this.syncingState=this.syncState(e,t),this.controller&&(i=this.controller).updateTime.apply(i,Fe([e,t],o,!1)),this.camera.updateTime(e,t),this.syncingState=!1;var a=new n.Vector2(512,512),l=new n.Vector2(512,512);this.renderer&&(this.renderer.getSize(a),a.x*=this.scissor.width,a.y*=this.scissor.height,this.renderer.getDrawingBufferSize(l),l.x*=this.scissor.width,l.y*=this.scissor.height);var u=[];if(Wl.multiplyMatrices(this.camera.projectionMatrix,this.camera.matrixWorldInverse),this.renderer&&this.model.update(this.renderer,this.camera),_l.setFromProjectionMatrix(Wl),this.scene.traverse((function(t){if(t.setResolution&&t.setResolution(a.x,a.y),t.setTime&&t.setTime(e),t.mixer instanceof n.AnimationMixer){var i=Xl.get(t.mixer);i||(i=new n.Clock,Xl.set(t.mixer,i)),t.mixer.update(i.getDelta())}(t instanceof n.Mesh||t instanceof n.Line||t instanceof n.Points)&&(t instanceof n.ImmediateRenderObject||!t.frustumCulled||_l.intersectsObject(t))&&u.push(t)})),l.width*l.height>8388608?this.renderSwitch01=1^this.renderSwitch01:this.renderSwitch01=0,this.renderer&&!1===this.paused&&0===this.renderSwitch01){var c=void 0;if(!0!==this.onlyRenderIfNeeds)c=this.render();else{for(var h=0,d=u;h<d.length;h++){var p=d[h],f=function(e){!0===e.needsRender?(e.needsRender=!1,r.needsRender=!0):e.mixer&&e.mixer.stats.actions.inUse>0&&(r.needsRender=!0)};f(p),p.traverseAncestors(f)}this.controller&&!0===this.controller.needsRender&&(this.controller.needsRender=!1,this.needsRender=!0),!0===this.camera.needsRender&&(this.camera.needsRender=!1,this.needsRender=!0),!1!==this.needsRender&&(c=this.render())}if(this.needsRender=!1,this.controller&&this.screenBuffers){var A=this.controller,g=this.screenBuffers;this.aroundScissor((function(){A.postProcessing(g[0],g[1]),r.copyEffect.render(g[1],void 0)}))}this.hasListener("renderFrame")&&this.emit("renderFrame",void 0!==c)}if(this.fps.testTime&&e-this.fps.testTime<1e3)this.fps.testCount++;else if(this.emit("fps",this.fps.testCount),this.fps.testTime=e,this.fps.testCount=0,this.renderer){var m=this.renderer.getContext(),v=hs(m);v&&this.throwError(v)}}},t.prototype.pause=function(){this.paused=!0,this.renderer&&this.renderer instanceof hi&&this.renderer.clear(!0,!0,!0)},t.prototype.play=function(){this.needsRender=!0,this.paused=!1},t.prototype.moveToPano=function(e,i,n){var r=this;void 0===i&&(i={}),void 0===n&&(n=!0);var o=this,s=o.controller,a=o.currentMode,l=o.renderer;return s?l?(a===t.Mode.Floorplan||a===t.Mode.Topview||a===t.Mode.Mapview?vr(e)||(this.panoIndex=e,this.once("initAnimationWillStart",(function(e,n){r.currentMode===t.Mode.Panorama&&i.moveStartCallback&&i.moveStartCallback(e,n)})),this.once("initAnimationEnded",(function(e,n){r.currentMode===t.Mode.Panorama&&i.moveEndCallback&&i.moveEndCallback(e,n)})),this.changeMode(t.Mode.Panorama,i,void 0,n)):s.moveToPano(e,i,n),this.ready()):(this.throwError(new Error("renderer is not initialized.")),Promise.resolve()):(this.throwError(new Error("controller is not initialized.")),Promise.resolve())},t.prototype.preloadPano=function(e,t){var i=this;if(void 0===t&&(t=qe),!this.work)return Promise.reject(new Error("work never loaded"));var n=this.work.observers[e],r=this.work.allowHosts,o=ze();return Promise.all(["right","left","up","down","front","back"].map((function(t){var o=Oe({key:"pano.".concat(e,".").concat(t),basisLoaderInitialized:ii.isInitialized()},Tt(i.imageOptions,["size","format","quality","mappings"])),s=n.images[t];return lt(i.imageOptions.transform?i.imageOptions.transform(s,o):gt(s,o),{allowHosts:r,requestProxy:i.requestProxy,networkSubscribe:i.networkSubscribe})}))).then((function(){var e=ze()-o;return t(e),e}))},t.prototype.project2d=function(e,t){if(void 0===t&&(t=!1),!this.renderer)return null;if(!1===this.model.empty&&t){var i=this.camera.position,r=e.clone().sub(i),o=new n.Raycaster(i,r.clone().normalize()),s=this.model.intersectRaycaster(o)[0];if(s&&s.distance+.01<r.length())return null}var a=e.clone().project(this.camera);if(Math.abs(a.z)>1)return null;var l=this.renderer.getSize(new n.Vector2),u=l.x*this.scissor.width,c=l.y*this.scissor.height,h=l.x*this.scissor.left+(a.x+1)/2*u,d=l.y*(1-this.scissor.bottom-this.scissor.height)+(1-a.y)/2*c;return new n.Vector2(h,d)},t.prototype.getRenderObjects=function(e){Wl.multiplyMatrices(this.camera.projectionMatrix,this.camera.matrixWorldInverse),_l.setFromProjectionMatrix(Wl),e||(e=this.scene);var t=[];return e.traverseVisible((function(e){(e instanceof n.Mesh||e instanceof n.Line||e instanceof n.Points)&&(e instanceof n.ImmediateRenderObject||!e.frustumCulled||_l.intersectsObject(e))&&t.push(e)})),t},t.prototype.getCurrentState=function(){return Oe(Oe({},this.getPose()),{mode:this.currentMode||t.Mode.Panorama,panoIndex:this.panoIndex||0})},t.prototype.setState=function(e,i,r){var o,s,a,l,u,c,h,d,p;void 0===i&&(i=!1),void 0===r&&(r=!0),!(e=Object.assign({},e)).offset||e instanceof n.Vector3||(e.offset=new n.Vector3(e.offset.x,e.offset.y,e.offset.z));var f,A,g,m,v,y=null!==(o=e.panoIndex)&&void 0!==o?o:this.state.panoIndex,b=null!==(s=e.mode)&&void 0!==s?s:this.state.mode;if(this.work)if(this.work.observers[y])if(e.mode!==t.Mode.Floorplan&&e.mode!==t.Mode.Topview&&e.mode!==t.Mode.Mapview&&e.mode!==t.Mode.Model||!vr(this.model)&&!0===this.model.loaded){if(this.state.mode!==b){if("VRPanorama"===b)return void this.changeMode("VRPanorama",void 0,void 0,!0);var x=void 0;x=Il(this.state.mode)&&Il(b)?Oe({},this.state):Il(b)?Oe({},this.panoramaLikeSavedPose):b===t.Mode.Mapview?{longitude:this.panoramaLikeSavedPose.latitude}:Oe({},e),"number"==typeof e.longitude&&(x.longitude=e.longitude),"number"==typeof e.latitude&&(x.latitude=e.latitude),"number"==typeof e.fov&&(x.fov=e.fov);var w=Oe(Oe({initial:[y,x,this.modeChangeDuration,!1]},this.commonParams()),this.controllerInits[b]),M=Cl[b].initAnimationEndPose(w);f=M.longitude,A=M.latitude,g=M.fov,m=M.offset,v=M.distance}else f=null!==(a=e.longitude)&&void 0!==a?a:this.state.longitude,A=null!==(l=e.latitude)&&void 0!==l?l:this.state.latitude,g=null!==(u=e.fov)&&void 0!==u?u:this.state.fov,m=null!==(c=e.offset)&&void 0!==c?c:this.state.offset,v=null!==(h=e.distance)&&void 0!==h?h:this.state.distance;var E={panoIndex:y,mode:b,longitude:f,latitude:A,fov:g,offset:m,distance:v};this.emit("setState",E),ys(this.state,E)||(this.controller&&"VRPanorama"===E.mode&&E.mode!==this.state.mode?(vs(this.state,E),this.changeMode("VRPanorama")):this.controller&&"XRPanorama"===E.mode&&E.mode!==this.state.mode?(vs(this.state,E),this.changeMode("XRPanorama")):(vs(this.state,E),this.controller&&(this.controller.userAction=r),i&&this.state.mode===E.mode&&(this.syncingState=this.syncState(ze(),0,i),this.syncingState&&(null===(d=this.controller)||void 0===d||d.updateTime(ze(),0),this.syncingState=!1)),this.emit("stateChange",this.state,r),null===(p=this.analysis)||void 0===p||p.state(this.work,this.state)))}else this.throwError(new Error("model is not ready."));else this.throwError(new Error("panoIndex not found in work"));else this.throwError(new Error("work never load."))},t.prototype.aroundScissor=function(e){if(this.renderer)if("XRPanorama"!==this.state.mode){var t=new n.Vector2,i=0!==this.scissor.left||0!==this.scissor.bottom||1!==this.scissor.width||1!==this.scissor.height;if(i){this.renderer.getSize(t);var r=Math.floor(t.x*this.scissor.left),o=Math.floor(t.y*this.scissor.bottom),s=Math.floor(t.x*this.scissor.width),a=Math.floor(t.y*this.scissor.height);this.renderer.setViewport(r,o,s,a),this.renderer.setScissor(r,o,s,a),this.renderer.setScissorTest(!0)}e(),i&&(this.renderer.setViewport(0,0,t.x,t.y),this.renderer.setScissor(0,0,t.x,t.y),this.renderer.setScissorTest(!1))}else e()},t.prototype.syncState=function(e,i,r){void 0===r&&(r=!1);var o=this.stateSynced;if(this.stateSynced=!1,!this.work)return!1;if(!this.controller)return!1;if(this.state.mode!==this.currentMode){var s={mode:this.state.mode,panoIndex:this.state.panoIndex,longitude:this.state.longitude,latitude:this.state.latitude,fov:this.state.fov,offset:this.state.offset};return this.changeMode(this.state.mode,s,this.modeChangeDuration,this.controller.userAction),!0}if(!1===this.controller.isReady())return!1;if(this.controller instanceof Cl.Model){if(!this.camera.pose.offset.equals(this.state.offset)){var a={longitude:this.state.longitude,latitude:this.state.latitude,fov:this.state.fov,offset:this.state.offset};return this.controller.moveToPosition(this.state.offset,a,!1),!0}}else if(this.state.panoIndex!==this.panoIndex){a={longitude:this.state.longitude,latitude:this.state.latitude,fov:this.state.fov,offset:this.state.offset,distance:this.state.distance};return this.controller.moveToPano(this.state.panoIndex,a,!1),!0}if(this.controller instanceof Cl.Topview||this.controller instanceof Cl.Mapview){var l=1,u=r?this.state.fov:gs(this.camera.pose.fov,this.state.fov,l),c=r?new n.Vector3(this.state.offset.x,this.state.offset.y,this.state.offset.z):new n.Vector3(gs(this.camera.pose.offset.x,this.state.offset.x,.2),gs(this.camera.pose.offset.y,this.state.offset.y,.2),gs(this.camera.pose.offset.z,this.state.offset.z,.2));if(os(u,this.camera.pose.fov)||as(c,this.camera.pose.offset))return this.controller.cameraMotion.set({fov:u},0).catch(qe),this.controller.locationMotion.set({x:c.x,y:c.y,z:c.z},0).catch(qe),!0}else{l=1;var h=Math.PI/45,d=(u=r?this.state.fov:gs(this.camera.pose.fov,this.state.fov,l),r?{longitude:this.state.longitude,latitude:this.state.latitude}:function(e,t,i){if(e.longitude===t.longitude&&e.latitude===t.latitude)return{longitude:t.longitude,latitude:t.latitude};var n=ps(e.longitude),r=e.latitude,o=ps(t.longitude),s=t.latitude;o-n>fs?n+=As:n-o>fs&&(n-=As);var a=i/Math.sqrt(Math.pow(o-n,2)+Math.pow(s-r,2));return a>=1?{longitude:t.longitude,latitude:t.latitude}:{longitude:n+(o-n)*a,latitude:r+(s-r)*a}}({longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude},{longitude:this.state.longitude,latitude:this.state.latitude},h)),p=d.longitude,f=d.latitude;if(os(p,this.camera.pose.longitude,2*Math.PI)||os(f,this.camera.pose.latitude)||os(u,this.camera.pose.fov))return this.controller.cameraMotion.set({longitude:p,latitude:f,fov:u},0).catch(qe),!0}if(this.stateSynced=!0,!1===o&&this.emit("stateSynced",this.state),this.readyCallbacks.length&&this.stateSynced){var A=this.currentMode;if(!(A===t.Mode.Floorplan||A===t.Mode.Topview||A===t.Mode.Mapview||A===t.Mode.Model)||!this.modelPending){var g=this.readyCallbacks.slice();this.readyCallbacks.length=0;for(var m=0,v=g;m<v.length;m++){var y=v[m];this.controller instanceof Cl.Panorama?!0!==y.tile||this.controller.isTileReady()?y():this.readyCallbacks.push(y):y()}}}return!1},t.prototype.ready=function(e){var t=this;return void 0===e&&(e={}),new Promise((function(i){var n;t.readyCallbacks.push(Object.assign(i,{tile:null!==(n=e.tile)&&void 0!==n&&n}))}))},t.prototype.requestFullscreen=function(){var e;if(ms()){var t=null===(e=this.getElement())||void 0===e?void 0:e.parentNode;t&&"requestFullscreen"in t&&"undefined"!=typeof document&&null===document.fullscreenElement&&t.requestFullscreen()}},t.prototype.exitFullscreen=function(){"undefined"!=typeof document&&document.fullscreenElement&&"exitFullscreen"in document&&document.exitFullscreen()},t.prototype.throwError=function(e){this.hasListener("error")?this.emit("error",e):console.error(e)},t.prototype.loadModel=function(e,t,i,r){var o=this,s=e.file;this.emit("modelWillLoad",e);var a=new wr({allowHosts:t,requestProxy:this.requestProxy,networkSubscribe:this.networkSubscribe});a.once("bvhLoaded",(function(){var e,t;o.destroyed||s===(null===(t=null===(e=o.work)||void 0===e?void 0:e.model)||void 0===t?void 0:t.file)&&o.emit("modelBvhLoaded",a)})),a.once("materialLoaded",(function(){var e,t;o.destroyed||s===(null===(t=null===(e=o.work)||void 0===e?void 0:e.model)||void 0===t?void 0:t.file)&&o.emit("modelMaterialLoaded",a)})),a.once("geometryLoaded",(function(){var e,t;o.destroyed||s===(null===(t=null===(e=o.work)||void 0===e?void 0:e.model)||void 0===t?void 0:t.file)&&(a.bounding.max.y-a.bounding.min.y<1.5&&(a.bounding.max.y=a.bounding.min.y+10),o.emit("modelGeometryLoaded",a))})),a.once("loaded",(function(){var e,t,n,r;if(!o.destroyed&&s===(null===(t=null===(e=o.work)||void 0===e?void 0:e.model)||void 0===t?void 0:t.file)){var l,u=o.model;u&&(u.show(),l=u.getMaterial()||{},o.scene.remove(u),u.dispose(),a.setTransparent(u.getTransparent())),l&&a.setMaterial(l),o.model=a,o.scene.add(a),null===(n=o.controller)||void 0===n||n.updateModel(a),null===(r=o.renderer)||void 0===r||r.compile(o.scene,o.camera),o.needsRender=!0,o.modelPending=!1,i(),o.emit("modelLoaded",a)}})),a.on("shownFloorChange",(function(e,t){var i,n;o.destroyed||s===(null===(n=null===(i=o.work)||void 0===i?void 0:i.model)||void 0===n?void 0:n.file)&&o.emit("modelShownFloorChange",e,t)})),a.on("error",(function(e){var t,r,l,u;if(!o.destroyed&&s===(null===(r=null===(t=o.work)||void 0===t?void 0:t.model)||void 0===r?void 0:r.file)){a.bounding.makeEmpty();for(var c=0,h=o.work.observers;c<h.length;c++){var d=h[c];a.bounding.expandByPoint(d.standingPosition),a.bounding.expandByPoint((new n.Vector3).fromArray([d.position.x,2*d.position.y-d.standingPosition.y,d.position.z]))}var p=cs(a.bounding,new n.Vector3(1,0,1));p.visible=!0,p.name="model_empty",a.add(p);var f,A=o.model;A&&(A.show(),f=A.getMaterial()||{},o.scene.remove(A),A.dispose(),a.setTransparent(A.getTransparent())),f&&a.setMaterial(f),o.model=a,o.scene.add(a),null===(l=o.controller)||void 0===l||l.updateModel(a),null===(u=o.renderer)||void 0===u||u.compile(o.scene,o.camera),o.emit("modelLoadError",e,a),o.throwError(e),o.modelPending=!1,i()}})),this.modelPending=!0,a.load(e,this.textureOptions).catch(qe)},t.prototype.commonParams=function(){return{ident:this.ident,scene:this.scene,parallaxScene:this.parallaxScene,helper:this.helperGroup,camera:this.camera,renderer:this.renderer,scissor:this.scissor,element:this.getElement(),model:this.model,work:this.work,imageOptions:this.imageOptions,enableIOSEDR:this._enableIOSEDR,extraElements:this.extraElements,videoTexture:this.videoTexture,networkSubscribe:this.networkSubscribe,requestProxy:this.requestProxy}},t.prototype.saveControllerPose=function(e){void 0===e&&(e=this.controller),e&&Il(e)&&(this.panoramaLikeSavedPose.longitude=this.camera.pose.longitude,this.panoramaLikeSavedPose.latitude=this.camera.pose.latitude,this.panoramaLikeSavedPose.fov=this.camera.pose.fov)},t.prototype.applyController=function(e,i){var n=this;if(!this.renderer)throw new Error("renderer is not initialized.");var r=Cl[e];e===this.currentMode||this.model.empty||this.model.show(),this.model.setTransparent(e===t.Mode.Floorplan||e===t.Mode.Topview||e===t.Mode.Model||e===t.Mode.Mapview),this.currentMode=e;for(var o=new r(i),s=function(e){o.on(e,(function(){for(var t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];var r=n.emit.apply(n,Fe([e],t,!1));if(r)return!1}))},a=0,l=Bl;a<l.length;a++){s(l[a])}var u=Cl[e].initAnimationEndPose(i),c=i.initial[3],h={panoIndex:i.initial[0],mode:e,longitude:u.longitude,latitude:u.latitude,fov:u.fov,offset:u.offset,distance:u.distance};return ys(this.state,h)||(vs(this.state,h),this.emit("stateChange",this.state,c)),this.emit("currentStateChange",this.getCurrentState(),c),o.on("cameraUpdate",(function(t,i){var r;if(n.controller){var o=Oe(Oe({},n.controller.getTargetPose()),{panoIndex:n.panoIndex,mode:e});i&&!1===n.syncingState&&n.state.mode===o.mode&&!ys(n.state,o)&&(vs(n.state,o),n.emit("stateChange",n.state,i),null===(r=n.analysis)||void 0===r||r.state(n.work,n.state))}n.emit("currentStateChange",n.getCurrentState(),i)})),o.on("initAnimationWillStart",(function(t,i,r){var o,s=Oe(Oe({},i),{panoIndex:t,mode:e});r&&n.state.mode===s.mode&&!ys(n.state,s)&&(vs(n.state,s),n.emit("stateChange",n.state,r),null===(o=n.analysis)||void 0===o||o.state(n.work,n.state))})),o.on("initAnimationEnded",(function(t,i,r){var o,s=Oe(Oe({},i),{panoIndex:t,mode:e});r&&n.state.mode===s.mode&&!ys(n.state,s)&&(vs(n.state,s),n.emit("stateChange",n.state,r),null===(o=n.analysis)||void 0===o||o.state(n.work,n.state))})),o.on("panoWillArrive",(function(t,i,r){var o;n.panoIndex=t;var s=Oe(Oe({},i),{panoIndex:t,mode:e});r&&n.state.mode===s.mode&&!ys(n.state,s)&&(vs(n.state,s),n.emit("stateChange",n.state,r),null===(o=n.analysis)||void 0===o||o.state(n.work,n.state))})),o.on("panoArrived",(function(t,i,r){var o,s=Oe(Oe({},i),{panoIndex:t,mode:e});r&&n.state.mode===s.mode&&!ys(n.state,s)&&(vs(n.state,s),n.emit("stateChange",n.state,r),null===(o=n.analysis)||void 0===o||o.state(n.work,n.state))})),o.on("moveToPano",(function(e,t){n.emit("currentStateChange",n.getCurrentState(),t)})),o.on("wantsMoveToPano",(function(e,t,i){var r=n.emit("wantsMoveToPano",e,t,i);r||(r=n.emit("wantsToMoveToPano",e,t,i)),r||n.moveToPano(e,t,i)})),o.on("vrWantsToExit",(function(){n.currentMode===t.Mode.VRPanorama&&(n.exitFullscreen(),n.changeMode(t.Mode.Panorama))})),o.on("error",(function(e){return n.throwError(e)})),o},t.prototype.removeEventListeners=function(){},t.prototype.diposeGPUPickingMaterial=function(){this.meshReplaceMaterialMap.forEach((function(e){e.dispose()})),this.meshOriginMaterialMap.forEach((function(e){e.dispose()}))},t.Mode={Panorama:"Panorama",Model:"Model",Floorplan:"Floorplan",Topview:"Topview",Mapview:"Mapview",DepthPanorama:"DepthPanorama",VRPanorama:"VRPanorama",XRPanorama:"XRPanorama"},t.Line=null,t}(He),Jl={instances:{},constructor:Zl};"undefined"!=typeof window&&Object.assign(window,{__FIVE_DEBUG__:Jl});var $l=function(){function e(){}return e.createButton=function(e){var t=document.createElement("button");function i(){t.style.display="",t.style.cursor="auto",t.style.left="calc(50% - 75px)",t.style.width="150px",t.onmouseenter=null,t.onmouseleave=null,t.onclick=null,t.textContent="VR NOT SUPPORTED"}function n(e){e.style.position="absolute",e.style.bottom="20px",e.style.padding="12px 6px",e.style.border="1px solid #fff",e.style.borderRadius="4px",e.style.background="rgba(0,0,0,0.1)",e.style.color="#fff",e.style.font="normal 13px sans-serif",e.style.textAlign="center",e.style.opacity="0.5",e.style.outline="none",e.style.zIndex="999"}if("xr"in navigator)return t.id="VRButton",t.style.display="none",n(t),navigator.xr.isSessionSupported("immersive-vr").then((function(n){n?(t.style.display="",t.style.cursor="pointer",t.style.left="calc(50% - 50px)",t.style.width="100px",t.textContent="ENTER VR",t.onmouseenter=function(){t.style.opacity="1.0"},t.onmouseleave=function(){t.style.opacity="0.5"},t.onclick=function(){e&&e()}):i()})),t;var r=document.createElement("a");return!1===window.isSecureContext?(r.href=document.location.href.replace(/^http:/,"https:"),r.innerHTML="WEBXR NEEDS HTTPS"):(r.href="https://immersiveweb.dev/",r.innerHTML="WEBXR NOT AVAILABLE"),r.style.left="calc(50% - 90px)",r.style.width="180px",r.style.textDecoration="none",n(r),r},e}();exports.AnimationFrameLoop=dt,exports.BVH=Bi,exports.BVHIntersect=Mi,exports.BVHNode=wi,exports.BVHVector3=xi,exports.Camera=bi,exports.Clipper=bt,exports.Five=Zl,exports.InternalWebGLRenderer=hi,exports.IntersectMesh=ns,exports.LegacyPanoCircleMesh=oo,exports.Model=wr,exports.NetworkSubscribe=ot,exports.PBMContainer=wt,exports.PBMGroup=Mt,exports.PBMMaterial=ci,exports.PBMMesh=xt,exports.PROXY_CONTROLLER_EVENT_NAMES=Bl,exports.PanoCircleMesh=So,exports.PanoCircleMeshDark=Qo,exports.PanoCircleMeshSolid=$o,exports.Scene=di,exports.Subscribe=He,exports.TextureLoader=oi,exports.Tile3D=Jn,exports.Tile3DModel=mr,exports.TileBoundingSphere=En,exports.TileCacheNode=pn,exports.TileCubeTextureTarget=ri,exports.TileCullingVolume=bn,exports.TileOrientedBoundingBox=zn,exports.TileRequestScheduler=dn,exports.Tileset3D=ir,exports.Tileset3DTraverser=er,exports.TilesetCache=An,exports.Work=kr,exports.XRButton=$l,exports.defaultImageURLTransform=gt,exports.getViewportScale=Pl,exports.imageSupport=function(){return yt||(yt=Promise.all([vt("data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A="),vt("data:image/webp;base64,UklGRjoAAABXRUJQVlA4IC4AAACyAgCdASoCAAIALmk0mk0iIiIiIgBoSygABc6WWgAA/veff/0PP8bA//LwYAAA")]).then((function(e){var t=e[0];return{webp:e[1],avif:t}})).catch((function(){return{webp:!1,avif:!1}})))},exports.parseWork=Vr;
372
+ * Licensed under the MIT license */var Xo=function(e,t,i,n){var r,o=["","webkit","Moz","MS","ms","o"],s=t.createElement?t.createElement("div"):n,a=Math.round,l=Math.abs,u=Date.now;function c(e,t,i){return setTimeout(g(e,i),t)}function h(e,t,i){return!!Array.isArray(e)&&(d(e,i[t],i),!0)}function d(e,t,i){var r;if(e)if(e.forEach)e.forEach(t,i);else if(e.length!==n)for(r=0;r<e.length;)t.call(i,e[r],r,e),r++;else for(r in e)e.hasOwnProperty(r)&&t.call(i,e[r],r,e)}function p(t,i,n){var r="DEPRECATED METHOD: "+i+"\n"+n+" AT \n";return function(){var i=new Error("get-stack-trace"),n=i&&i.stack?i.stack.replace(/^[^\(]+?[\n$]/gm,"").replace(/^\s+at\s+/gm,"").replace(/^Object.<anonymous>\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",o=e.console&&(e.console.warn||e.console.log);return o&&o.call(e.console,r,n),t.apply(this,arguments)}}r="function"!=typeof Object.assign?function(e){if(e===n||null===e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),i=1;i<arguments.length;i++){var r=arguments[i];if(r!==n&&null!==r)for(var o in r)r.hasOwnProperty(o)&&(t[o]=r[o])}return t}:Object.assign;var f=p((function(e,t,i){for(var r=Object.keys(t),o=0;o<r.length;)(!i||i&&e[r[o]]===n)&&(e[r[o]]=t[r[o]]),o++;return e}),"extend","Use `assign`."),A=p((function(e,t){return f(e,t,!0)}),"merge","Use `assign`.");function m(e,t,i){var n,o=t.prototype;(n=e.prototype=Object.create(o)).constructor=e,n._super=o,i&&r(n,i)}function g(e,t){return function(){return e.apply(t,arguments)}}function v(e,t){return"function"==typeof e?e.apply(t&&t[0]||n,t):e}function y(e,t){return e===n?t:e}function b(e,t,i){d(M(t),(function(t){e.addEventListener(t,i,!1)}))}function x(e,t,i){d(M(t),(function(t){e.removeEventListener(t,i,!1)}))}function w(e,t){for(;e;){if(e==t)return!0;e=e.parentNode}return!1}function E(e,t){return e.indexOf(t)>-1}function M(e){return e.trim().split(/\s+/g)}function S(e,t,i){if(e.indexOf&&!i)return e.indexOf(t);for(var n=0;n<e.length;){if(i&&e[n][i]==t||!i&&e[n]===t)return n;n++}return-1}function C(e){return Array.prototype.slice.call(e,0)}function I(e,t,i){for(var n=[],r=[],o=0;o<e.length;){var s=t?e[o][t]:e[o];S(r,s)<0&&n.push(e[o]),r[o]=s,o++}return i&&(n=t?n.sort((function(e,i){return e[t]>i[t]})):n.sort()),n}function B(e,t){for(var i,r,s=t[0].toUpperCase()+t.slice(1),a=0;a<o.length;){if((r=(i=o[a])?i+s:t)in e)return r;a++}return n}var T=1;function P(t){var i=t.ownerDocument||t;return i.defaultView||i.parentWindow||e}var R="ontouchstart"in e,D=B(e,"PointerEvent")!==n,L=R&&/mobile|tablet|ip(ad|hone|od)|android/i.test(navigator.userAgent),k="touch",F="mouse",O=24,N=["x","y"],V=["clientX","clientY"];function Q(e,t){var i=this;this.manager=e,this.callback=t,this.element=e.element,this.target=e.options.inputTarget,this.domHandler=function(t){v(e.options.enable,[e])&&i.handler(t)},this.init()}function H(e,t,i){var r=i.pointers.length,o=i.changedPointers.length,s=1&t&&r-o==0,a=12&t&&r-o==0;i.isFirst=!!s,i.isFinal=!!a,s&&(e.session={}),i.eventType=t,function(e,t){var i=e.session,r=t.pointers,o=r.length;i.firstInput||(i.firstInput=q(t));o>1&&!i.firstMultiple?i.firstMultiple=q(t):1===o&&(i.firstMultiple=!1);var s=i.firstInput,a=i.firstMultiple,c=a?a.center:s.center,h=t.center=z(r);t.timeStamp=u(),t.deltaTime=t.timeStamp-s.timeStamp,t.angle=G(c,h),t.distance=K(c,h),function(e,t){var i=t.center,n=e.offsetDelta||{},r=e.prevDelta||{},o=e.prevInput||{};1!==t.eventType&&4!==o.eventType||(r=e.prevDelta={x:o.deltaX||0,y:o.deltaY||0},n=e.offsetDelta={x:i.x,y:i.y});t.deltaX=r.x+(i.x-n.x),t.deltaY=r.y+(i.y-n.y)}(i,t),t.offsetDirection=j(t.deltaX,t.deltaY);var d=U(t.deltaTime,t.deltaX,t.deltaY);t.overallVelocityX=d.x,t.overallVelocityY=d.y,t.overallVelocity=l(d.x)>l(d.y)?d.x:d.y,t.scale=a?function(e,t){return K(t[0],t[1],V)/K(e[0],e[1],V)}(a.pointers,r):1,t.rotation=a?function(e,t){return G(t[1],t[0],V)+G(e[1],e[0],V)}(a.pointers,r):0,t.maxPointers=i.prevInput?t.pointers.length>i.prevInput.maxPointers?t.pointers.length:i.prevInput.maxPointers:t.pointers.length,function(e,t){var i,r,o,s,a=e.lastInterval||t,u=t.timeStamp-a.timeStamp;if(8!=t.eventType&&(u>25||a.velocity===n)){var c=t.deltaX-a.deltaX,h=t.deltaY-a.deltaY,d=U(u,c,h);r=d.x,o=d.y,i=l(d.x)>l(d.y)?d.x:d.y,s=j(c,h),e.lastInterval=t}else i=a.velocity,r=a.velocityX,o=a.velocityY,s=a.direction;t.velocity=i,t.velocityX=r,t.velocityY=o,t.direction=s}(i,t);var p=e.element;w(t.srcEvent.target,p)&&(p=t.srcEvent.target);t.target=p}(e,i),e.emit("hammer.input",i),e.recognize(i),e.session.prevInput=i}function q(e){for(var t=[],i=0;i<e.pointers.length;)t[i]={clientX:a(e.pointers[i].clientX),clientY:a(e.pointers[i].clientY)},i++;return{timeStamp:u(),pointers:t,center:z(t),deltaX:e.deltaX,deltaY:e.deltaY}}function z(e){var t=e.length;if(1===t)return{x:a(e[0].clientX),y:a(e[0].clientY)};for(var i=0,n=0,r=0;r<t;)i+=e[r].clientX,n+=e[r].clientY,r++;return{x:a(i/t),y:a(n/t)}}function U(e,t,i){return{x:t/e||0,y:i/e||0}}function j(e,t){return e===t?1:l(e)>=l(t)?e<0?2:4:t<0?8:16}function K(e,t,i){i||(i=N);var n=t[i[0]]-e[i[0]],r=t[i[1]]-e[i[1]];return Math.sqrt(n*n+r*r)}function G(e,t,i){i||(i=N);var n=t[i[0]]-e[i[0]],r=t[i[1]]-e[i[1]];return 180*Math.atan2(r,n)/Math.PI}Q.prototype={handler:function(){},init:function(){this.evEl&&b(this.element,this.evEl,this.domHandler),this.evTarget&&b(this.target,this.evTarget,this.domHandler),this.evWin&&b(P(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&x(this.element,this.evEl,this.domHandler),this.evTarget&&x(this.target,this.evTarget,this.domHandler),this.evWin&&x(P(this.element),this.evWin,this.domHandler)}};var _={mousedown:1,mousemove:2,mouseup:4},W="mousedown",X="mousemove mouseup";function Y(){this.evEl=W,this.evWin=X,this.pressed=!1,Q.apply(this,arguments)}m(Y,Q,{handler:function(e){var t=_[e.type];1&t&&(0===e.button||2===e.button)&&(this.pressed=!0),2&t&&1!==e.which&&(t=4),this.pressed&&(4&t&&(this.pressed=!1),this.callback(this.manager,t,{pointers:[e],changedPointers:[e],pointerType:F,srcEvent:e}))}});var Z={pointerdown:1,pointermove:2,pointerup:4,pointercancel:8,pointerout:8},J={2:k,3:"pen",4:F,5:"kinect"},$="pointerdown",ee="pointermove pointerup pointercancel";function te(){this.evEl=$,this.evWin=ee,Q.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}e.MSPointerEvent&&!e.PointerEvent&&($="MSPointerDown",ee="MSPointerMove MSPointerUp MSPointerCancel"),m(te,Q,{handler:function(e){var t=this.store,i=!1,n=!1,r=e.type.toLowerCase().replace("ms",""),o=Z[r],s=J[e.pointerType]||e.pointerType,a=s==k,l=S(t,e.pointerId,"pointerId");1&o&&(0===e.button||2===e.button||a)?l<0&&(t.push(e),l=t.length-1):12&o?i=!0:a||0!==e.buttons||(i=!0,n=!0,o=Z.pointerup),l<0||(n||(t[l]=e),this.callback(this.manager,o,{pointers:t,changedPointers:[e],pointerType:s,srcEvent:t[l]}),i&&t.splice(l,1))}});var ie={touchstart:1,touchmove:2,touchend:4,touchcancel:8},ne="touchstart",re="touchstart touchmove touchend touchcancel";function oe(){this.evTarget=ne,this.evWin=re,this.started=!1,Q.apply(this,arguments)}function se(e,t){var i=C(e.touches),n=C(e.changedTouches);return 12&t&&(i=I(i.concat(n),"identifier",!0)),[i,n]}m(oe,Q,{handler:function(e){var t=ie[e.type];if(1===t&&(this.started=!0),this.started){var i=se.call(this,e,t);12&t&&i[0].length-i[1].length==0&&(this.started=!1),this.callback(this.manager,t,{pointers:i[0],changedPointers:i[1],pointerType:k,srcEvent:e})}}});var ae={touchstart:1,touchmove:2,touchend:4,touchcancel:8},le="touchstart touchmove touchend touchcancel";function ue(){this.evTarget=le,this.targetIds={},Q.apply(this,arguments)}function ce(e,t){var i=C(e.touches),n=this.targetIds;if(3&t&&1===i.length)return n[i[0].identifier]=!0,[i,i];var r,o,s=C(e.changedTouches),a=[],l=this.target;if(o=i.filter((function(e){return w(e.target,l)})),1===t)for(r=0;r<o.length;)n[o[r].identifier]=!0,r++;for(r=0;r<s.length;)n[s[r].identifier]&&a.push(s[r]),12&t&&delete n[s[r].identifier],r++;return a.length?[I(o.concat(a),"identifier",!0),a]:void 0}m(ue,Q,{handler:function(e){var t=ae[e.type],i=ce.call(this,e,t);i&&this.callback(this.manager,t,{pointers:i[0],changedPointers:i[1],pointerType:k,srcEvent:e})}});function he(){Q.apply(this,arguments);var e=g(this.handler,this);this.touch=new ue(this.manager,e),this.mouse=new Y(this.manager,e),this.primaryTouch=null,this.lastTouches=[]}function de(e,t){1&e?(this.primaryTouch=t.changedPointers[0].identifier,pe.call(this,t)):12&e&&pe.call(this,t)}function pe(e){var t=e.changedPointers[0];if(t.identifier===this.primaryTouch){var i={x:t.clientX,y:t.clientY};this.lastTouches.push(i);var n=this.lastTouches;setTimeout((function(){var e=n.indexOf(i);e>-1&&n.splice(e,1)}),2500)}}function fe(e){for(var t=e.srcEvent.clientX,i=e.srcEvent.clientY,n=0;n<this.lastTouches.length;n++){var r=this.lastTouches[n],o=Math.abs(t-r.x),s=Math.abs(i-r.y);if(o<=25&&s<=25)return!0}return!1}m(he,Q,{handler:function(e,t,i){var n=i.pointerType==k,r=i.pointerType==F;if(!(r&&i.sourceCapabilities&&i.sourceCapabilities.firesTouchEvents)){if(n)de.call(this,t,i);else if(r&&fe.call(this,i))return;this.callback(e,t,i)}},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});var Ae=s?B(s.style,"touchAction"):n,me=Ae!==n,ge="compute",ve="auto",ye="manipulation",be="none",xe="pan-x",we="pan-y",Ee=function(){if(!me)return!1;var t={},i=e.CSS&&e.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach((function(n){t[n]=!i||e.CSS.supports("touch-action",n)})),t}();function Me(e,t){this.manager=e,this.set(t)}Me.prototype={set:function(e){e==ge&&(e=this.compute()),me&&this.manager.element.style&&Ee[e]&&(this.manager.element.style[Ae]=e),this.actions=e.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var e=[];return d(this.manager.recognizers,(function(t){v(t.options.enable,[t])&&(e=e.concat(t.getTouchAction()))})),function(e){if(E(e,be))return be;var t=E(e,xe),i=E(e,we);if(t&&i)return be;if(t||i)return t?xe:we;if(E(e,ye))return ye;return ve}(e.join(" "))},preventDefaults:function(e){var t=e.srcEvent,i=e.offsetDirection;if(this.manager.session.prevented)t.preventDefault();else{var n=this.actions,r=E(n,be)&&!Ee.none,o=E(n,we)&&!Ee["pan-y"],s=E(n,xe)&&!Ee["pan-x"];if(r){var a=1===e.pointers.length,l=e.distance<2,u=e.deltaTime<250;if(a&&l&&u)return}if(!s||!o)return r||o&&6&i||s&&i&O?this.preventSrc(t):void 0}},preventSrc:function(e){this.manager.session.prevented=!0,e.preventDefault()}};var Se=32;function Ce(e){this.options=r({},this.defaults,e||{}),this.id=T++,this.manager=null,this.options.enable=y(this.options.enable,!0),this.state=1,this.simultaneous={},this.requireFail=[]}function Ie(e){return 16&e?"cancel":8&e?"end":4&e?"move":2&e?"start":""}function Be(e){return 16==e?"down":8==e?"up":2==e?"left":4==e?"right":""}function Te(e,t){var i=t.manager;return i?i.get(e):e}function Pe(){Ce.apply(this,arguments)}function Re(){Pe.apply(this,arguments),this.pX=null,this.pY=null}function De(){Pe.apply(this,arguments)}function Le(){Ce.apply(this,arguments),this._timer=null,this._input=null}function ke(){Pe.apply(this,arguments)}function Fe(){Pe.apply(this,arguments)}function Oe(){Ce.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}function Ne(e,t){return(t=t||{}).recognizers=y(t.recognizers,Ne.defaults.preset),new Ve(e,t)}Ce.prototype={defaults:{},set:function(e){return r(this.options,e),this.manager&&this.manager.touchAction.update(),this},recognizeWith:function(e){if(h(e,"recognizeWith",this))return this;var t=this.simultaneous;return t[(e=Te(e,this)).id]||(t[e.id]=e,e.recognizeWith(this)),this},dropRecognizeWith:function(e){return h(e,"dropRecognizeWith",this)||(e=Te(e,this),delete this.simultaneous[e.id]),this},requireFailure:function(e){if(h(e,"requireFailure",this))return this;var t=this.requireFail;return-1===S(t,e=Te(e,this))&&(t.push(e),e.requireFailure(this)),this},dropRequireFailure:function(e){if(h(e,"dropRequireFailure",this))return this;e=Te(e,this);var t=S(this.requireFail,e);return t>-1&&this.requireFail.splice(t,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(e){return!!this.simultaneous[e.id]},emit:function(e){var t=this,i=this.state;function n(i){t.manager.emit(i,e)}i<8&&n(t.options.event+Ie(i)),n(t.options.event),e.additionalEvent&&n(e.additionalEvent),i>=8&&n(t.options.event+Ie(i))},tryEmit:function(e){if(this.canEmit())return this.emit(e);this.state=Se},canEmit:function(){for(var e=0;e<this.requireFail.length;){if(!(33&this.requireFail[e].state))return!1;e++}return!0},recognize:function(e){var t=r({},e);if(!v(this.options.enable,[this,t]))return this.reset(),void(this.state=Se);56&this.state&&(this.state=1),this.state=this.process(t),30&this.state&&this.tryEmit(t)},process:function(e){},getTouchAction:function(){},reset:function(){}},m(Pe,Ce,{defaults:{pointers:1},attrTest:function(e){var t=this.options.pointers;return 0===t||e.pointers.length===t},process:function(e){var t=this.state,i=e.eventType,n=6&t,r=this.attrTest(e);return n&&(8&i||!r)?16|t:n||r?4&i?8|t:2&t?4|t:2:Se}}),m(Re,Pe,{defaults:{event:"pan",threshold:10,pointers:1,direction:30},getTouchAction:function(){var e=this.options.direction,t=[];return 6&e&&t.push(we),e&O&&t.push(xe),t},directionTest:function(e){var t=this.options,i=!0,n=e.distance,r=e.direction,o=e.deltaX,s=e.deltaY;return r&t.direction||(6&t.direction?(r=0===o?1:o<0?2:4,i=o!=this.pX,n=Math.abs(e.deltaX)):(r=0===s?1:s<0?8:16,i=s!=this.pY,n=Math.abs(e.deltaY))),e.direction=r,i&&n>t.threshold&&r&t.direction},attrTest:function(e){return Pe.prototype.attrTest.call(this,e)&&(2&this.state||!(2&this.state)&&this.directionTest(e))},emit:function(e){this.pX=e.deltaX,this.pY=e.deltaY;var t=Be(e.direction);t&&(e.additionalEvent=this.options.event+t),this._super.emit.call(this,e)}}),m(De,Pe,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[be]},attrTest:function(e){return this._super.attrTest.call(this,e)&&(Math.abs(e.scale-1)>this.options.threshold||2&this.state)},emit:function(e){if(1!==e.scale){var t=e.scale<1?"in":"out";e.additionalEvent=this.options.event+t}this._super.emit.call(this,e)}}),m(Le,Ce,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[ve]},process:function(e){var t=this.options,i=e.pointers.length===t.pointers,n=e.distance<t.threshold,r=e.deltaTime>t.time;if(this._input=e,!n||!i||12&e.eventType&&!r)this.reset();else if(1&e.eventType)this.reset(),this._timer=c((function(){this.state=8,this.tryEmit()}),t.time,this);else if(4&e.eventType)return 8;return Se},reset:function(){clearTimeout(this._timer)},emit:function(e){8===this.state&&(e&&4&e.eventType?this.manager.emit(this.options.event+"up",e):(this._input.timeStamp=u(),this.manager.emit(this.options.event,this._input)))}}),m(ke,Pe,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[be]},attrTest:function(e){return this._super.attrTest.call(this,e)&&(Math.abs(e.rotation)>this.options.threshold||2&this.state)}}),m(Fe,Pe,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:30,pointers:1},getTouchAction:function(){return Re.prototype.getTouchAction.call(this)},attrTest:function(e){var t,i=this.options.direction;return 30&i?t=e.overallVelocity:6&i?t=e.overallVelocityX:i&O&&(t=e.overallVelocityY),this._super.attrTest.call(this,e)&&i&e.offsetDirection&&e.distance>this.options.threshold&&e.maxPointers==this.options.pointers&&l(t)>this.options.velocity&&4&e.eventType},emit:function(e){var t=Be(e.offsetDirection);t&&this.manager.emit(this.options.event+t,e),this.manager.emit(this.options.event,e)}}),m(Oe,Ce,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[ye]},process:function(e){var t=this.options,i=e.pointers.length===t.pointers,n=e.distance<t.threshold,r=e.deltaTime<t.time;if(this.reset(),1&e.eventType&&0===this.count)return this.failTimeout();if(n&&r&&i){if(4!=e.eventType)return this.failTimeout();var o=!this.pTime||e.timeStamp-this.pTime<t.interval,s=!this.pCenter||K(this.pCenter,e.center)<t.posThreshold;if(this.pTime=e.timeStamp,this.pCenter=e.center,s&&o?this.count+=1:this.count=1,this._input=e,0===this.count%t.taps)return this.hasRequireFailures()?(this._timer=c((function(){this.state=8,this.tryEmit()}),t.interval,this),2):8}return Se},failTimeout:function(){return this._timer=c((function(){this.state=Se}),this.options.interval,this),Se},reset:function(){clearTimeout(this._timer)},emit:function(){8==this.state&&(this._input.tapCount=this.count,this.manager.emit(this.options.event,this._input))}}),Ne.VERSION="2.0.7",Ne.defaults={domEvents:!1,touchAction:ge,enable:!0,inputTarget:null,inputClass:null,preset:[[ke,{enable:!1}],[De,{enable:!1},["rotate"]],[Fe,{direction:6}],[Re,{direction:6},["swipe"]],[Oe],[Oe,{event:"doubletap",taps:2},["tap"]],[Le]],cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}};function Ve(e,t){var i;this.options=r({},Ne.defaults,t||{}),this.options.inputTarget=this.options.inputTarget||e,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=e,this.input=new((i=this).options.inputClass||(D?te:L?ue:R?he:Y))(i,H),this.touchAction=new Me(this,this.options.touchAction),Qe(this,!0),d(this.options.recognizers,(function(e){var t=this.add(new e[0](e[1]));e[2]&&t.recognizeWith(e[2]),e[3]&&t.requireFailure(e[3])}),this)}function Qe(e,t){var i,n=e.element;n.style&&(d(e.options.cssProps,(function(r,o){i=B(n.style,o),t?(e.oldCssProps[i]=n.style[i],n.style[i]=r):n.style[i]=e.oldCssProps[i]||""})),t||(e.oldCssProps={}))}return Ve.prototype={set:function(e){return r(this.options,e),e.touchAction&&this.touchAction.update(),e.inputTarget&&(this.input.destroy(),this.input.target=e.inputTarget,this.input.init()),this},stop:function(e){this.session.stopped=e?2:1},recognize:function(e){var t=this.session;if(!t.stopped){var i;this.touchAction.preventDefaults(e);var n=this.recognizers,r=t.curRecognizer;(!r||r&&8&r.state)&&(r=t.curRecognizer=null);for(var o=0;o<n.length;)i=n[o],2===t.stopped||r&&i!=r&&!i.canRecognizeWith(r)?i.reset():i.recognize(e),!r&&14&i.state&&(r=t.curRecognizer=i),o++}},get:function(e){if(e instanceof Ce)return e;for(var t=this.recognizers,i=0;i<t.length;i++)if(t[i].options.event==e)return t[i];return null},add:function(e){if(h(e,"add",this))return this;var t=this.get(e.options.event);return t&&this.remove(t),this.recognizers.push(e),e.manager=this,this.touchAction.update(),e},remove:function(e){if(h(e,"remove",this))return this;if(e=this.get(e)){var t=this.recognizers,i=S(t,e);-1!==i&&(t.splice(i,1),this.touchAction.update())}return this},on:function(e,t){if(e!==n&&t!==n){var i=this.handlers;return d(M(e),(function(e){i[e]=i[e]||[],i[e].push(t)})),this}},off:function(e,t){if(e!==n){var i=this.handlers;return d(M(e),(function(e){t?i[e]&&i[e].splice(S(i[e],t),1):delete i[e]})),this}},emit:function(e,i){this.options.domEvents&&function(e,i){var n=t.createEvent("Event");n.initEvent(e,!0,!0),n.gesture=i,i.target.dispatchEvent(n)}(e,i);var n=this.handlers[e]&&this.handlers[e].slice();if(n&&n.length){i.type=e,i.preventDefault=function(){i.srcEvent.preventDefault()};for(var r=0;r<n.length;)n[r](i),r++}},destroy:function(){this.element&&Qe(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}},r(Ne,{INPUT_START:1,INPUT_MOVE:2,INPUT_END:4,INPUT_CANCEL:8,STATE_POSSIBLE:1,STATE_BEGAN:2,STATE_CHANGED:4,STATE_ENDED:8,STATE_RECOGNIZED:8,STATE_CANCELLED:16,STATE_FAILED:Se,DIRECTION_NONE:1,DIRECTION_LEFT:2,DIRECTION_RIGHT:4,DIRECTION_UP:8,DIRECTION_DOWN:16,DIRECTION_HORIZONTAL:6,DIRECTION_VERTICAL:O,DIRECTION_ALL:30,Manager:Ve,Input:Q,TouchAction:Me,TouchInput:ue,MouseInput:Y,PointerEventInput:te,TouchMouseInput:he,SingleTouchInput:oe,Recognizer:Ce,AttrRecognizer:Pe,Tap:Oe,Pan:Re,Swipe:Fe,Pinch:De,Rotate:ke,Press:Le,on:b,off:x,each:d,merge:A,extend:f,assign:r,inherit:m,bindFn:g,prefixed:B}),Ne}("undefined"!=typeof window?window:{},"undefined"!=typeof document?document:{});function Yo(e,t,i){var r=t.getBoundingClientRect(),o=r.top,s=r.left,a=r.width,l=r.height;return i&&(s+=a*i.left,o+=l*(1-i.bottom-i.height),a*=i.width,l*=i.height),new n.Vector2((e.x-s)/a*2-1,-(e.y-o)/l*2+1)}var Zo=new n.OrthographicCamera(-1,1,1,-1,0,1),Jo=new n.BufferGeometry;Jo.setAttribute("position",new n.Float32BufferAttribute([-1,3,0,-1,-1,0,3,-1,0],3)),Jo.setAttribute("uv",new n.Float32BufferAttribute([0,2,0,0,2,0],2));var $o=new n.Mesh(Jo),es=new n.Scene;es.add($o);var ts=function(){function e(e,t){var i;this.renderer=e,this.material=new n.ShaderMaterial({vertexShader:null!==(i=t.vertex)&&void 0!==i?i:"\nvarying vec2 vUv;\nvoid main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}\n",fragmentShader:t.fragment,uniforms:Object.assign({inputBuffer:new n.Uniform(null)},t.uniforms),defines:Object.assign({},t.defines),blending:n.NoBlending,depthWrite:!1,depthTest:!1})}return e.prototype.render=function(e,t){var i=this.renderer.getRenderTarget(),n=$o.material;this.material.uniforms.inputBuffer.value=e.texture,$o.material=this.material,this.renderer.setRenderTarget(t||null),this.renderer.render(es,Zo),this.renderer.setRenderTarget(i),$o.material=n},e.prototype.dispose=function(){this.material.dispose()},e}(),is=function(){function e(e){this.renderer=e,this.material=new n.ShaderMaterial({vertexShader:"\nvoid main() {\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}\n",fragmentShader:"\nuniform vec3 inputValue;\nvoid main() {\n gl_FragColor = vec4(inputValue, 1.0);\n}\n",uniforms:Object.assign({inputValue:new n.Uniform(new n.Vector3)}),blending:n.NoBlending,depthWrite:!1,depthTest:!1})}return e.prototype.render=function(e,t){var i=this.renderer.getRenderTarget(),n=$o.material;this.material.uniforms.inputValue.value.copy(e),$o.material=this.material,this.renderer.setRenderTarget(t||null),this.renderer.render(es,Zo),this.renderer.setRenderTarget(i),$o.material=n},e.prototype.dispose=function(){this.material.dispose()},e}(),ns=function(e){function t(t){return e.call(this,t,{fragment:"\nuniform sampler2D inputBuffer;\nvarying vec2 vUv;\nvoid main() {\n gl_FragColor = texture2D(inputBuffer, vUv);\n}\n"})||this}return ke(t,e),t}(ts),rs=function(){function e(e){this.enable=!0,this.renderer=e,this.copyPass=new ns(this.renderer)}return e.prototype.render=function(e,t){this.copyPass.render(e,t)},e.prototype.dispose=function(){this.copyPass.dispose()},e}(),os=function(e){function t(i){var n,r=this;r=e.call(this)||this;var o=t.parseArgs(i);return r.pending=!0,r.userAction=o.initial[3],r.destroyed=!1,r.ident=o.ident,r.scene=o.scene,r.parallaxScene=o.parallaxScene,r.helper=o.helper,r.camera=o.camera,r.renderer=o.renderer,r.scissor=o.scissor,r.element=o.element,r.model=o.model,r.enableIOSEDR=null!==(n=o.enableIOSEDR)&&void 0!==n&&n,r.work=o.work,r.imageOptions=o.imageOptions,r.videoTexture=o.videoTexture,r.networkSubscribe=o.networkSubscribe,r.requestProxy=o.requestProxy,r.needsRender=!0,r.maxFov=120,r.minFov=40,r.maxLatitude=+Math.PI/2,r.minLatitude=-Math.PI/2,r.cameraMotion=new Ur({longitude:{value:r.camera.pose.longitude,circle:[0,2*Math.PI]},latitude:r.camera.pose.latitude,fov:r.camera.pose.fov}),r.eventUnbinds=[o.element].concat(o.extraElements||[]).map((function(e){return r.bindEvents(e)})),dt.shared.add((function(){return r.initAnimation.apply(r,o.initial)}),!0),r}return ke(t,e),t.parseArgs=function(e){return Fe({},e)},t.initAnimationEndState=function(e){var t=this.parseArgs(e);return{longitude:t.camera.pose.longitude,latitude:t.camera.pose.latitude,fov:t.camera.pose.fov,offset:t.camera.pose.offset.clone(),distance:t.camera.pose.distance}},t.prototype.destroy=function(){var e;this.destroyed=!0,this.off(),this.cameraMotion.dispose();for(var t=0,i=this.eventUnbinds;t<i.length;t++){(0,i[t])()}this.copyEffect&&(this.copyEffect.dispose(),delete this.copyEffect),delete this.panState,null===(e=this.pressState)||void 0===e||e.stop(),delete this.pressState},t.prototype.isReady=function(){return!1===this.pending&&!0===this.cameraMotion.ended},t.prototype.bindExtraElement=function(e){for(var t=0,i=this.eventUnbinds;t<i.length;t++){if(i[t].element===e)return}this.eventUnbinds.push(this.bindEvents(e))},t.prototype.unbindExtraElement=function(e){for(var t=[],i=0,n=this.eventUnbinds;i<n.length;i++){var r=n[i];r.element===e?r():t.push(r)}this.eventUnbinds=t},t.prototype.updateRenderSize=function(){this.needsRender=!0},t.prototype.updateModel=function(e){this.model=e,this.needsRender=!0},t.prototype.updateWork=function(e,t,i,n,r){return this.work=e,this.userAction=r,!1},t.prototype.updateTime=function(e,t){if(!this.destroyed){var i={};this.cameraMotion.ended&&(this.cameraMotion.update(e),i.longitude=this.cameraMotion.value.longitude,i.latitude=this.cameraMotion.value.latitude,i.fov=this.cameraMotion.value.fov),_o(i)&&this.setCamera(i)}},t.prototype.render=function(){this.renderer.render(this.scene,this.camera)},t.prototype.postProcessing=function(e,t){this.destroyed||(this.copyEffect||(this.copyEffect=new rs(this.renderer)),this.copyEffect.render(e,t))},t.prototype.updateCamera=function(e,t,i){return this.userAction=i,this.cameraMotion.set(e,t).catch(qe)},t.prototype.updateCameraWithKeyframes=function(e,t,i){return this.userAction=i,this.cameraMotion.setKeyframes(e,t)},t.prototype.getTargetPose=function(){var e=this.cameraMotion.getKeyFrameSegment(Ue())[1];return{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.moveToPano=function(e,t,i){void 0===t&&(t={}),this.userAction=i;var n={longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude,fov:this.camera.pose.fov,offset:this.camera.pose.offset.clone(),distance:this.camera.pose.distance};t.moveStartCallback&&t.moveStartCallback(e,n),this.emit("moveToPano",e,this.userAction),this.emit("panoWillArrive",e,n,this.userAction),this.emit("panoArrived",e,n,this.userAction),t.moveEndCallback&&t.moveEndCallback(e,n)},t.prototype.initAnimation=function(e,t,i,n){this.pending=!1,this.userAction=n},t.prototype.setCamera=function(e){var t,i,n,r,o;void 0===e&&(e={});var s=null!==(t=e.longitude)&&void 0!==t?t:this.camera.pose.longitude,a=null!==(i=e.latitude)&&void 0!==i?i:this.camera.pose.latitude,l=null!==(n=e.fov)&&void 0!==n?n:this.camera.pose.fov,u=null!==(r=e.distance)&&void 0!==r?r:this.camera.pose.distance,c=null!==(o=e.offset)&&void 0!==o?o:this.camera.pose.offset,h=this.camera.position.clone(),d=Po(s,this.camera.pose.longitude,2*Math.PI)||Po(a,this.camera.pose.latitude),p=Po(l,this.camera.pose.fov),f=Po(u,this.camera.pose.distance),A=Do(c,this.camera.pose.offset);this.camera.setFromPose({longitude:s,latitude:a,fov:l,distance:u,offset:c});var m=Do(h,this.camera.position);p&&this.emit("cameraFovUpdate",l,this.userAction),d&&this.emit("cameraDirectionUpdate",{longitude:s,latitude:a},this.userAction),m&&this.emit("cameraPositionUpdate",this.camera.position.clone(),this.userAction),(p||d||A||f)&&this.emit("cameraUpdate",{longitude:s,latitude:a,fov:l,offset:c,distance:u},this.userAction),this.needsRender=!0},t.prototype.onPanGesture=function(e){var t=this.panState,i=e.pointers.length;if(e.isFinal?delete this.panState:this.panState={pointerLength:i,x:e.center.x,y:e.center.y},void 0!==t&&t.pointerLength===i){var n=e.pointers.map((function(e){return Tt(e,["x","y"])}));this.emit("wantsGesture","pan",n,e.isFinal)||this.emit("gesture","pan",n,e.isFinal)}},t.prototype.onTapGesture=function(e){var t=e.pointers.map((function(e){return Tt(e,["x","y"])}));this.emit("wantsGesture","tap",t,!0)||this.emit("gesture","tap",t,!0)},t.prototype.onPressGesture=function(e,t){var i,n=[e];if(this.emit("wantsGesture","press",n,t))return null===(i=this.pressState)||void 0===i||i.stop(),void delete this.pressState;this.emit("gesture","press",n,t)},t.prototype.onPinchGesture=function(e){var t=e.pointers.map((function(e){return Tt(e,["x","y"])}));this.emit("wantsGesture","pinch",t,e.isFinal)||this.emit("gesture","pinch",t,e.isFinal)},t.prototype.onMouseWheel=function(e){var t=(Math.abs(e.deltaY)>Math.abs(e.deltaX)?e.deltaY:e.deltaX)/-60,i=[{x:e.clientX,y:e.clientY,delta:t}];this.emit("wantsGesture","mouseWheel",i,!1)||this.emit("gesture","mouseWheel",i,!1)},t.prototype.onMouseMove=function(e){},t.prototype.onMouseOut=function(){},t.prototype.relativeClientPosition=function(e){return Yo(e,this.element,this.scissor)},t.prototype.bindEvents=function(e){var t=this,i=function(e){var i=Yo(e,t.element,t.scissor);return!(Math.abs(i.x)>1||Math.abs(i.y)>1)},n=new Xo.Manager(e),r=function(e){return e.session.firstInput||null};n.add(new Xo.Pan({threshold:10,pointers:0})),n.add(new Xo.Tap({interval:410})),n.add(new Xo.Pinch({threshold:0,pointers:2})),n.on("panstart pan",(function(e){var o=r(n);o&&!i(o.center)||(t.onPanGesture(e),f())})),n.on("tap",(function(e){if("mouse"!==e.pointerType||0===e.srcEvent.button){var o=r(n);o&&!i(o.center)||(t.onTapGesture(e),f())}})),n.on("pinchstart pinch pinchend",(function(e){var o=r(n);o&&!i(o.center)||(t.onPinchGesture(e),f())}));var o=null,s=null,a=function(e,t,i){var n="pinchend"===e?t:t-i.deltaY/280;return{type:e,target:i.target,pointerType:"mouse",srcEvent:i,pointers:[{x:i.clientX,y:i.clientY}],isFirst:"pinchstart"===e,isFinal:"pinchend"===e,scale:Er(n,.1,10),center:{x:i.clientX,y:i.clientY},velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0}},l=function(e){var n,r={x:e.clientX,y:e.clientY};if(i(r)){if(e.preventDefault(),e.ctrlKey){var l=null!==(n=null==o?void 0:o.prevInput.scale)&&void 0!==n?n:1,u=a(o?"pinch":"pinchstart",l,e);null===o?o={firstInput:u,prevInput:u}:o.prevInput=u,t.onPinchGesture(u),null!==s&&window.clearTimeout(s),s=window.setTimeout((function(){var i;s=null;var n=null!==(i=null==o?void 0:o.prevInput.scale)&&void 0!==i?i:1,r=a("pinchend",n,e);o=null,t.onPinchGesture(r)}),200)}else t.onMouseWheel(e);f()}},u=function(e){if(!zo()){var n={x:e.clientX,y:e.clientY};i(n)?(t.onMouseMove(e),t.pressState&&Math.abs(e.clientX-t.pressState.x)>10&&Math.abs(e.clientY-t.pressState.y)>10&&f()):t.onMouseOut()}},c=function(){t.onMouseOut(),f()},h=function(e,n){if(i(e)){t.pressState={x:e.x,y:e.y,time:t.pressState?t.pressState.time:n,stop:qe};var r=n-t.pressState.time;t.onPressGesture({x:e.x,y:e.y,delta:r},!1),t.pressState&&(t.pressState.stop=dt.shared.add((function(t){return h({x:e.x,y:e.y},t)}),!0,1))}else f()},d=function(e){f(),e.touches.length>1||e.changedTouches.length<=0||h({x:e.changedTouches[0].clientX,y:e.changedTouches[0].clientY},Ue())},p=function(e){f(),h({x:e.clientX,y:e.clientY},Ue())},f=function(){var e;if(t.pressState){var i=Ue()-t.pressState.time;t.onPressGesture({x:t.pressState.x,y:t.pressState.y,delta:i},!0),null===(e=t.pressState)||void 0===e||e.stop(),delete t.pressState}},A=null,m=function(e){var t,i="pinch",n=!1,r=!1;switch(e.type){case"gesturestart":i="pinchstart",n=!0;break;case"gestureend":i="pinchend",r=!0}return{type:i,target:e.target,pointerType:"mouse",srcEvent:e,pointers:[{x:e.clientX,y:e.clientY}],isFirst:n,isFinal:r,scale:null!==(t=e.scale)&&void 0!==t?t:1,center:{x:e.clientX,y:e.clientY},velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0}},g=function(e){if(e.preventDefault(),!zo()){var n=m(e),r=(A={firstInput:n}).firstInput;r&&!i(r.center)||t.onPinchGesture(n)}},v=function(e){if(e.preventDefault(),!zo()&&A){var n=m(e),r=A.firstInput;r&&!i(r.center)||t.onPinchGesture(n)}},y=function(e){if(e.preventDefault(),!zo()&&A){var n=m(e),r=A.firstInput;A=null,r&&!i(r.center)||t.onPinchGesture(n)}},b=function(t){if(t&&"function"==typeof t.preventDefault&&t.currentTarget===e&&t.preventDefault(),"function"==typeof getSelection){var i=getSelection();i&&i.focusNode&&(i.removeAllRanges&&i.removeAllRanges(),i.empty&&i.empty())}};e.addEventListener("wheel",l,{passive:!1}),e.addEventListener("mousemove",u,!1),e.addEventListener("mouseout",c,!1),e.addEventListener("touchstart",d,!1),e.addEventListener("touchend",f,!1),e.addEventListener("touchcancel",f,!1),e.addEventListener("mousedown",p,!1),e.addEventListener("mouseup",f,!1),e.addEventListener("gesturestart",g,{passive:!1}),e.addEventListener("gesturechange",v,{passive:!1}),e.addEventListener("gestureend",y,{passive:!1}),e.addEventListener("touchstart",b,!1),e.addEventListener("contextmenu",b,!1);return Object.assign((function(){n.destroy(),e.removeEventListener("wheel",l,!1),e.removeEventListener("mousemove",u,!1),e.removeEventListener("mouseout",c,!1),e.removeEventListener("touchstart",d,!1),e.removeEventListener("touchend",f,!1),e.removeEventListener("touchcancel",f,!1),e.removeEventListener("mousedown",p,!1),e.removeEventListener("mouseup",f,!1),e.removeEventListener("gesturestart",g,!1),e.removeEventListener("gesturechange",v,!1),e.removeEventListener("gestureend",y,!1),e.removeEventListener("touchstart",b,!1),e.removeEventListener("contextmenu",b,!1)}),{element:e})},t}(He),ss=function(e){function t(i){var n,r,o=this,s=t.parseArgs(i);return(o=e.call(this,s)||this).defaultLongitude=s.defaultLongitude,o.defaultLatitude=s.defaultLatitude,o.defaultFov=s.defaultFov,o.maxFov=s.maxFov,o.minFov=s.minFov,o.maxLatitude=s.maxLatitude,o.minLatitude=s.minLatitude,o.locationMotion=new Ur({x:o.camera.pose.offset.x,y:o.camera.pose.offset.y,z:o.camera.pose.offset.z,distance:o.camera.pose.distance,modelAlpha:null!==(r=null===(n=o.model.getMaterial())||void 0===n?void 0:n.modelAlpha)&&void 0!==r?r:0,perspToOrtho:o.camera.perspToOrtho.x,orthoDistance:o.camera.orthoDistance}),o.currentTapPanoIndex=-1,o.intersectMeshCreator=s.intersectMeshCreator,o.intersectMesh=o.intersectMeshCreator(),o.intersectMesh.name="intersect",o.intersectMesh.visible=!1,o.helper.add(o.intersectMesh),o}return ke(t,e),t.distanceFromModel=function(e,t,i){var n=e.bounding,r=Math.pow(Math.pow(n.max.x-n.min.x+1,2)+Math.pow(n.max.y-n.min.y+1,2)+Math.pow(n.max.z-n.min.z+1,2),.5),o=r/2/Math.tan(Math.PI*t/360);return i<1&&(o/=i),isNaN(o)?r:o},t.parseArgs=function(t){var i,n,r,o,s,a,l,u,c=e.parseArgs.call(this,t);return Fe(Fe({},c),{defaultLongitude:null!==(i=t.defaultLongitude)&&void 0!==i?i:Math.PI/4,defaultLatitude:null!==(n=t.defaultLatitude)&&void 0!==n?n:Math.PI/4,defaultFov:null!==(r=t.defaultFov)&&void 0!==r?r:80,maxFov:null!==(o=t.maxFov)&&void 0!==o?o:120,minFov:null!==(s=t.minFov)&&void 0!==s?s:40,maxLatitude:null!==(a=t.maxLatitude)&&void 0!==a?a:+Math.PI/2,minLatitude:null!==(l=t.minLatitude)&&void 0!==l?l:-Math.PI/2,intersectMeshCreator:null!==(u=t.intersectMeshCreator)&&void 0!==u?u:function(){return new Bo}})},t.initAnimationEndPose=function(e){var i,r,o,s=this.parseArgs(e),a=e.initial[1];return{longitude:null!==(i=a.longitude)&&void 0!==i?i:s.defaultLongitude,latitude:Er(null!==(r=a.latitude)&&void 0!==r?r:s.defaultLatitude,s.minLatitude,s.maxLatitude),fov:null!==(o=a.fov)&&void 0!==o?o:s.defaultFov,offset:e.model.bounding.getCenter(new n.Vector3),distance:t.distanceFromModel(s.model,s.defaultFov,s.camera.aspect)}},t.prototype.destroy=function(){e.prototype.destroy.call(this),this.locationMotion.dispose(),this.mouseWheelState&&clearTimeout(this.mouseWheelState.timer),delete this.mouseWheelState,delete this.mouseMoveState,delete this.panState,this.intersectMesh.dispose(),this.helper.remove(this.intersectMesh)},t.prototype.isReady=function(){return!1!==this.locationMotion.ended&&e.prototype.isReady.call(this)},t.prototype.updateWork=function(e,t,i,n,r){return this.work=e,this.updateCamera(i,null!=n?n:0,r),!0},t.prototype.updateModel=function(i){e.prototype.updateModel.call(this,i);var r=i.bounding.getCenter(new n.Vector3),o=t.distanceFromModel(i,this.defaultFov,this.camera.aspect);this.locationMotion.set({x:r.x,y:r.y,z:r.z,distance:o},0).catch(qe)},t.prototype.updateTime=function(e,t){if(!this.destroyed){var i={},r={};this.locationMotion.ended||(this.locationMotion.update(e),i.modelAlpha=this.locationMotion.value.modelAlpha,this.camera.perspToOrtho.setScalar(Er(this.locationMotion.value.perspToOrtho,0,1)),this.camera.orthoDistance=this.locationMotion.value.orthoDistance,r.distance=this.locationMotion.value.distance,r.offset=new n.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z)),this.cameraMotion.ended||(this.cameraMotion.update(e),r.longitude=this.cameraMotion.value.longitude,r.latitude=this.cameraMotion.value.latitude,r.fov=this.cameraMotion.value.fov),_o(i)||this.model.setMaterial(i),_o(r)||this.setCamera(r)}},t.prototype.getTargetPose=function(){var e=this.cameraMotion.getKeyFrameSegment(Ue())[1],t=this.locationMotion.getKeyFrameSegment(Ue())[1];return{longitude:e.value.longitude,latitude:e.value.latitude,fov:e.value.fov,offset:new n.Vector3(t.value.x,t.value.y,t.value.z),distance:t.value.distance}},t.prototype.initAnimation=function(e,i,r,o){var s,a,l,u=this;if(!this.destroyed){this.pending=!1,this.userAction=o;var c={longitude:null!==(s=i.longitude)&&void 0!==s?s:this.defaultLongitude,latitude:Er(null!==(a=i.latitude)&&void 0!==a?a:this.defaultLatitude,this.minLatitude,this.maxLatitude),fov:Er(null!==(l=i.fov)&&void 0!==l?l:this.defaultFov,this.minFov,this.maxFov),offset:this.model.bounding.getCenter(new n.Vector3),distance:t.distanceFromModel(this.model,this.defaultFov,this.camera.aspect)},h=Tt(c,["longitude","latitude","fov"]),d={x:c.offset.x,y:c.offset.y,z:c.offset.z,distance:c.distance,modelAlpha:1,perspToOrtho:0,orthoDistance:c.distance};this.emit("initAnimationWillStart",e,c,this.userAction),this.cameraMotion.set(h,r).catch(qe),this.locationMotion.set(d,r).then((function(){u.emit("initAnimationEnded",e,c,u.userAction)}),(function(t){var i=Wo(u.camera.pose);u.emit("initAnimationEnded",e,i,u.userAction)})).catch(qe)}},t.prototype.updateRenderSize=function(){this.locationMotion.set({distance:t.distanceFromModel(this.model,this.defaultFov,this.camera.aspect)},0).catch(qe)},t.prototype.getForwardPanoIndexOrNot=function(e){var t=this.work.observers.filter((function(e){return e.active})),i=this.model.intersectRaycaster(e)[0];if(!i)return null;var n=Go(t,(function(e){return e.standingPosition.distanceTo(i.point)}),!0),r=n[0];return n[1]<10?r.panoIndex:null},t.prototype.coordinatesForOffset=function(e){var t=this.renderer.getSize(new n.Vector2);return{longitude:2*e.x/(t.x*this.scissor.width),latitude:2*e.y/(t.y*this.scissor.height)}},t.prototype.requestInteriaMovement=function(e,t){var i=this;if(!1!==this.interiaMovement){for(var n=Fe({},e),r={longitude:0,latitude:0},o=0;o<t;o++)n.longitude*=.996,n.latitude*=.994008,r.longitude+=n.longitude,r.latitude+=n.latitude;var s=Vo(this.cameraMotion.value.longitude+r.longitude),a=Er(this.cameraMotion.value.latitude+r.latitude,this.minLatitude,this.maxLatitude),l={longitude:s,latitude:a,fov:this.cameraMotion.value.fov,offset:this.camera.pose.offset.clone(),distance:this.camera.pose.distance};this.cameraMotion.set({longitude:s,latitude:a},0).catch(qe);var u=n.longitude>1e-4||n.longitude<-1e-4||n.latitude>1e-4||n.latitude<-1e-4;this.emit("interiaPan",l,!u),u?dt.shared.add((function(e,t){i.requestInteriaMovement(n,0|t)}),!0,1):this.interiaMovement=!1}},t.prototype.onPanGesture=function(e){var t=this.panState,i=e.pointers.length;if(e.isFinal?delete this.panState:this.panState={pointerLength:i,x:e.center.x,y:e.center.y},void 0!==t&&t.pointerLength===i){var n=e.pointers.map((function(e){return Tt(e,["x","y"])}));if(!this.emit("wantsGesture","pan",n,e.isFinal)){var r={x:e.center.x-t.x,y:e.center.y-t.y},o=this.relativeClientPosition(e.center),s=this.camera.pose.latitude<Math.PI/6||o.y<0?-1:1;r.x*=s;var a=this.coordinatesForOffset(r),l=Vo(this.cameraMotion.value.longitude+a.longitude),u=Er(this.cameraMotion.value.latitude+a.latitude,this.minLatitude,this.maxLatitude);this.camera.aspect<1&&Math.abs(e.overallVelocityX)>.2&&Math.atan2(Math.abs(e.overallVelocityY),Math.abs(e.overallVelocityX))<Math.PI/6.923&&(u=this.cameraMotion.value.latitude);var c={longitude:l,latitude:u,fov:this.camera.pose.fov,offset:this.camera.pose.offset,distance:this.camera.pose.distance};if(!this.emit("wantsPanGesture",c,e.isFinal))if(this.emit("gesture","pan",n,e.isFinal),this.emit("panGesture",c,e.isFinal),this.userAction=!0,this.interiaMovement=!1,this.hideIntersectMesh(),this.cameraMotion.set({longitude:c.longitude,latitude:c.latitude},0).catch(qe),e.isFinal)if(!this.emit("wantsInteriaPan",c)){this.interiaMovement=!0;var h=e.velocityX*s,d=e.velocityY;this.requestInteriaMovement(this.coordinatesForOffset({x:h,y:d}),0)}}}},t.prototype.onPinchGesture=function(e){var t,i=null===(t=this.pinchState)||void 0===t?void 0:t.fov,n=!1;if("pinchstart"!==e.type){if("pinchend"===e.type&&(n=!0,delete this.panState,delete this.pinchState),void 0!==i){var r=e.pointers.map((function(e){return Tt(e,["x","y"])}));if(!this.emit("wantsGesture","pinch",r,n)){var o=Er(i/e.scale,this.minFov,this.maxFov);this.emit("wantsPinchGesture",e.scale,o,n)||this.emit("wantsChangeCameraFov",o)||(this.emit("gesture","pinch",r,n),this.emit("pinchGesture",e.scale,o,n),this.userAction=!0,this.interiaMovement=!1,this.cameraMotion.set({fov:o},0).catch(qe),this.onPanGesture(e))}}}else this.pinchState={fov:this.cameraMotion.value.fov}},t.prototype.onMouseMove=function(e){if(this.intersectMesh.parent&&!this.model.empty&&this.model.bvhs&&!0===this.model.bvhs.loaded&&!this.panState){var t=this.relativeClientPosition({x:e.clientX,y:e.clientY}),i=new n.Raycaster;if(i.setFromCamera(t,this.camera),this.emit("wantsShowIntersectionOnModel",i))this.hideIntersectMesh();else{var r=this.model.intersectRaycaster(i)[0];if(r&&r.face){var o=r.face.normal,s=o.clone().multiplyScalar(.05),a=r.point.clone().add(s);this.intersectMesh.position.copy(a);var l=a.clone().add(s);if(this.intersectMesh.lookAt(l),Math.abs(o.y)>.99){var u=this.camera.position.clone().sub(a);this.intersectMesh.rotation.z=-Math.atan2(u.z,u.x)}this.intersectMesh.visible=!0,this.needsRender=!0,this.emit("intersectionOnModelUpdate",r,this.intersectMesh)}else this.hideIntersectMesh();this.mouseMoveState={clientX:e.clientX,clientY:e.clientY}}}},t.prototype.onMouseOut=function(){this.intersectMesh.parent&&!0===this.intersectMesh.visible&&this.hideIntersectMesh()},t.prototype.onMouseWheel=function(e){var t=this,i=(Math.abs(e.deltaY)>Math.abs(e.deltaX)?e.deltaY:e.deltaX)/-60,n=[{x:e.clientX,y:e.clientY,delta:i}];if(!this.emit("wantsGesture","mouseWheel",n,!1)){var r=this.minFov,o=this.maxFov,s=Er(this.camera.fov-i,r,o);this.emit("wantsMouseWheel",i,s,!1)||this.emit("wantsChangeCameraFov",s)||(this.emit("gesture","mouseWheel",n,!1),this.emit("mouseWheel",i,s,!1),this.userAction=!0,this.interiaMovement=!1,this.cameraMotion.set({fov:s},0).catch(qe),this.mouseWheelState&&clearTimeout(this.mouseWheelState.timer),this.mouseWheelState={timer:window.setTimeout((function(){delete t.mouseWheelState;t.emit("wantsGesture","mouseWheel",n,!0)||t.emit("wantsMouseWheel",i,s,!0)||(t.emit("gesture","mouseWheel",n,!0),t.emit("mouseWheel",0,s,!0))}),200)})}},t.prototype.onTapGesture=function(e){var t=this,i=e.pointers.map((function(e){return Tt(e,["x","y"])}));if(!this.emit("wantsGesture","tap",i,!0)){var r=this.relativeClientPosition(e.center),o=new n.Raycaster;if(o.setFromCamera(r,this.camera),!this.emit("wantsTapGesture",o,r,!0)){this.emit("gesture","tap",i,!0),this.emit("tapGesture",o,r,!0),this.interiaMovement=!1;var s=this.getForwardPanoIndexOrNot(o);if(!vr(s)){this.emit("panoSelected",s);var a={longitude:this.camera.pose.longitude,latitude:0};this.currentTapPanoIndex=s,this.preloadPano(s).then((function(e){t.currentTapPanoIndex===e&&t.emit("wantsMoveToPano",e,a,!0)}))}}}},t.prototype.onPressGesture=function(e,t){var i,r,o=[e];if(this.emit("wantsGesture","press",o,t))return null===(i=this.pressState)||void 0===i||i.stop(),void delete this.pressState;var s=this.relativeClientPosition(e),a=new n.Raycaster;if(a.setFromCamera(s,this.camera),this.emit("wantsPressGesture",a,s,e.delta,t))return null===(r=this.pressState)||void 0===r||r.stop(),void delete this.pressState;this.emit("gesture","press",o,t),this.emit("pressGesture",a,s,e.delta,t)},t.prototype.preloadPano=function(e,t){var i=this;void 0===t&&(t=qe);var n=this.work.observers[e],r=this.work.allowHosts;return Promise.all(["right","left","up","down","front","back"].map((function(t){var o=Fe({key:"pano.".concat(e,".").concat(t),basisLoaderInitialized:ii.isInitialized()},Tt(i.imageOptions,["size","format","quality","mappings"])),s=n.images[t];return lt(i.imageOptions.transform?i.imageOptions.transform(s,o):mt(s,o),{allowHosts:r,requestProxy:i.requestProxy,networkSubscribe:i.networkSubscribe})}))).then((function(){return t(e),e}))},t.prototype.hideIntersectMesh=function(){this.intersectMesh.visible=!1,this.emit("intersectionHidden"),this.needsRender=!0},t}(os),as={longitude:0,latitude:Math.PI/2},ls={longitude:0,latitude:0},us={longitude:Math.PI/2,latitude:0},cs={longitude:Math.PI,latitude:0},hs={longitude:1.5*Math.PI,latitude:0};var ds=function(e){function t(i){var n=t.parseArgs(i);return e.call(this,n)||this}return ke(t,e),t.parseArgs=function(t){var i=[t.initial[0],Fe(Fe({},t.initial[1]),{longitude:0,latitude:Math.PI/2}),t.initial[2],t.initial[3]],n=Fe(Fe({},t),{initial:i,maxLatitude:Math.PI/2,minLatitude:Math.PI/2,defaultLongitude:0,defaultLatitude:Math.PI/2});return e.parseArgs.call(this,n)},t.initAnimationEndPose=function(t){var i=this.parseArgs(t);return e.initAnimationEndPose.call(this,i)},t.prototype.updateModel=function(e){this.model=e,this.needsRender=!0;var t=e.bounding.getCenter(new n.Vector3);this.locationMotion.set({x:t.x,y:t.y,z:t.z,distance:ss.distanceFromModel(this.model,this.defaultFov,this.camera.aspect)},0).catch(qe)},t.prototype.initAnimation=function(e,t,i,r){var o,s=this;if(!this.destroyed){this.pending=!1,this.userAction=r;var a={longitude:0,latitude:Math.PI/2,fov:Er(null!==(o=t.fov)&&void 0!==o?o:this.defaultFov,this.minFov,this.maxFov),offset:this.model.bounding.getCenter(new n.Vector3),distance:ss.distanceFromModel(this.model,this.defaultFov,this.camera.aspect)},l=Tt(a,["longitude","latitude","fov"]),u={x:a.offset.x,y:a.offset.y,z:a.offset.z,distance:a.distance,modelAlpha:1,perspToOrtho:1,orthoDistance:a.distance};this.cameraMotion.set(l,i).catch(qe),this.locationMotion.set(u,i).then((function(){s.emit("initAnimationEnded",e,a,s.userAction)}),(function(t){var i=Wo(s.camera.pose);s.emit("initAnimationEnded",e,i,s.userAction)}))}},t.prototype.getZoomOffsetFromFov=function(e,t,i){var r=this.camera.getWorldDirection(new n.Vector3),o=Math.tan(i/2*Math.PI/180),s=Math.tan(t.fov/2*Math.PI/180),a=(s-o)/s,l=new n.Raycaster;l.setFromCamera(e,t);var u=l.ray.direction,c=u.angleTo(r),h=ss.distanceFromModel(this.model,this.defaultFov,this.camera.aspect),d=h*Math.tan(c),p=u.clone().setLength(h*Math.cos(c)).projectOnPlane(r),f=p.length(),A=a/f*p.x*d,m=a/f*p.z*d,g=a/f*p.y*d;return new n.Vector3(A,g,m)},t.prototype.requestInteriaMovement=function(e,t){},t.prototype.onPanGesture=function(e){var t=this.panState,i=e.pointers.length;if(e.isFinal?delete this.panState:this.panState={pointerLength:i,x:e.center.x,y:e.center.y},void 0!==t&&t.pointerLength===i){var r=e.pointers.map((function(e){return Tt(e,["x","y"])}));if(!this.emit("wantsGesture","pan",r,e.isFinal)){var o=e.center.x-t.x,s=e.center.y-t.y,a=new n.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z),l=this.model.bounding,u=l.getCenter(new n.Vector3),c=(l.max.x-l.min.x)/this.defaultFov*this.cameraMotion.value.fov,h=(l.max.y-l.min.y)/this.defaultFov*this.cameraMotion.value.fov,d=(l.max.z-l.min.z)/this.defaultFov*this.cameraMotion.value.fov,p={left:new n.Vector3,up:new n.Vector3,cameraDirection:"y"};this.cameraMotion.value.longitude===as.longitude&&this.cameraMotion.value.latitude===as.latitude?(p.left.set(1,0,0),p.up.set(0,0,-1),p.cameraDirection="y"):this.cameraMotion.value.longitude===ls.longitude&&this.cameraMotion.value.latitude===ls.latitude?(p.left.set(1,0,0),p.up.set(0,1,0),p.cameraDirection="z"):this.cameraMotion.value.longitude===cs.longitude&&this.cameraMotion.value.latitude===cs.latitude?(p.left.set(1,0,0),p.up.set(0,-1,0),p.cameraDirection="z"):this.cameraMotion.value.longitude===hs.longitude&&this.cameraMotion.value.latitude===hs.latitude?(p.left.set(0,0,-1),p.up.set(0,-1,0),p.cameraDirection="x"):this.cameraMotion.value.longitude===us.longitude&&this.cameraMotion.value.latitude===us.latitude&&(p.left.set(0,0,-1),p.up.set(0,1,0),p.cameraDirection="x");var f=(this.camera.position[p.cameraDirection]-l.min[p.cameraDirection])*Math.tan(this.camera.fov/2*Math.PI/180),A=this.renderer.getSize(new n.Vector2);a.add(function(e,t){var i=(new n.Vector3).copy(t);return i.multiplyScalar(-e),i}(2*o*f/A.y,p.left)),a.add(function(e,t){var i=(new n.Vector3).copy(t);return i.multiplyScalar(e),i}(2*s*f/A.y,p.up)),a.x=Er(a.x,u.x-c,u.x+c),a.y=Er(a.y,u.y-h,u.y+h),a.z=Er(a.z,u.z-d,u.z+d);var m={longitude:0,latitude:Math.PI/2,fov:this.cameraMotion.value.fov,offset:a,distance:this.locationMotion.value.distance};this.emit("wantsPanGesture",m,e.isFinal)||(this.emit("gesture","pan",r,e.isFinal),this.emit("panGesture",m,e.isFinal),this.userAction=!0,this.locationMotion.set({x:a.x,y:a.y,z:a.z},0).catch(qe))}}},t.prototype.onPinchGesture=function(e){var t,i=null===(t=this.pinchState)||void 0===t?void 0:t.fov,n=!1;if("pinchstart"!==e.type){if("pinchend"===e.type&&(n=!0,delete this.pinchState),void 0!==i){var r=e.pointers.map((function(e){return Tt(e,["x","y"])}));if(!this.emit("wantsGesture","pinch",r,n)){var o=Er(i/e.scale,this.minFov,this.maxFov),s=this.relativeClientPosition({x:e.center.x,y:e.center.y}),a=this.getZoomOffsetFromFov(s,this.camera,o);this.cameraMotion.value.longitude===as.longitude&&this.cameraMotion.value.latitude===as.latitude?a.y=0:this.cameraMotion.value.longitude===ls.longitude&&this.cameraMotion.value.latitude===ls.latitude||this.cameraMotion.value.longitude===cs.longitude&&this.cameraMotion.value.latitude===cs.latitude?a.z=0:(this.cameraMotion.value.longitude===hs.longitude&&this.cameraMotion.value.latitude===hs.latitude||this.cameraMotion.value.longitude===us.longitude&&this.cameraMotion.value.latitude===us.latitude)&&(a.x=0);var l=this.camera.pose.offset.clone().add(a);this.emit("wantsPinchGesture",e.scale,o,n)||this.emit("wantsChangeCameraFov",o)||(this.emit("gesture","pinch",r,n),this.emit("pinchGesture",e.scale,o,n),this.userAction=!0,this.locationMotion.set({x:l.x,y:l.y,z:l.z},0).catch(qe),this.cameraMotion.set({longitude:this.cameraMotion.value.longitude,latitude:this.cameraMotion.value.latitude,fov:o},0).catch(qe),this.onPanGesture(e))}}}else this.pinchState={fov:this.cameraMotion.value.fov}},t.prototype.onMouseWheel=function(e){var t=this,i=(Math.abs(e.deltaY)>Math.abs(e.deltaX)?e.deltaY:e.deltaX)/-60,n=[{x:e.clientX,y:e.clientY,delta:i}];if(!this.emit("wantsGesture","mouseWheel",n,!1)){var r=Er(this.cameraMotion.value.fov-i,this.minFov,this.maxFov),o=this.relativeClientPosition({x:e.clientX,y:e.clientY}),s=this.getZoomOffsetFromFov(o,this.camera,r);this.cameraMotion.value.longitude===as.longitude&&this.cameraMotion.value.latitude===as.latitude?s.y=0:this.cameraMotion.value.longitude===ls.longitude&&this.cameraMotion.value.latitude===ls.latitude||this.cameraMotion.value.longitude===cs.longitude&&this.cameraMotion.value.latitude===cs.latitude?s.z=0:(this.cameraMotion.value.longitude===hs.longitude&&this.cameraMotion.value.latitude===hs.latitude||this.cameraMotion.value.longitude===us.longitude&&this.cameraMotion.value.latitude===us.latitude)&&(s.x=0);var a=this.camera.pose.offset.clone().add(s);this.emit("wantsMouseWheel",i,r,!1)||this.emit("wantsChangeCameraFov",r)||(this.emit("gesture","mouseWheel",n,!1),this.emit("mouseWheel",i,r,!1),this.userAction=!0,this.locationMotion.set({x:a.x,y:a.y,z:a.z},0).catch(qe),this.cameraMotion.set({longitude:this.cameraMotion.value.longitude,latitude:this.cameraMotion.value.latitude,fov:r},0).catch(qe),this.mouseWheelState&&clearTimeout(this.mouseWheelState.timer),this.mouseWheelState={timer:window.setTimeout((function(){delete t.mouseWheelState;t.emit("wantsGesture","mouseWheel",n,!0)||t.emit("wantsMouseWheel",i,r,!0)||t.emit("wantsChangeCameraFov",r)||(t.emit("gesture","mouseWheel",n,!0),t.emit("mouseWheel",0,r,!0))}),200)})}},t}(ss);function ps(e,t){void 0===t&&(t=!1);var i=typeof e;if("string"===i)return JSON.stringify(e);if(!0===e)return"true";if(!1===e)return"false";if(null===e)return"null";if(e instanceof Array){for(var n="[",r=e.length-1,o=0;o<r;o++)n+=ps(e[o],!1)+",";return r>-1&&(n+=ps(e[o],!1)),n+"]"}if(e instanceof Object){if("function"==typeof e.toJSON)return ps(e.toJSON(),t);var s=Object.keys(e).sort(),a=s.length;for(n="",o=0;o<a;){var l=s[o],u=ps(e[l],!0);void 0!==u&&(o&&""!==n&&(n+=","),n+=JSON.stringify(l)+":"+u),o++}return"{"+n+"}"}switch(i){case"function":return JSON.stringify(e.toString());case"undefined":return t?void 0:null;case"number":return e;default:return isFinite(e)?e:null}}function fs(e){return Be(String(ps(e,!1)))}var As,ms=function(e){function t(i){var n=this,r=t.parseArgs(i);return(n=e.call(this,r)||this).defaultLongitude=r.defaultLongitude,n.defaultLatitude=r.defaultLongitude,n.defaultFov=r.defaultFov,n.maxFov=r.maxFov,n.minFov=r.minFov,n.maxLatitude=r.maxLatitude,n.minLatitude=r.minLatitude,n.moveSpeed=r.moveSpeed,n.intersectMeshCreator=r.intersectMeshCreator,n.interiaMovement=!1,n.intersectMesh=n.intersectMeshCreator(),n.intersectMesh.name="intersect",n.intersectMesh.visible=!1,n.helper.add(n.intersectMesh),n}return ke(t,e),t.parseArgs=function(t){var i,n,r,o,s,a,l,u,c,h=e.parseArgs.call(this,t);return Fe(Fe({},h),{defaultLongitude:null!==(i=t.defaultLongitude)&&void 0!==i?i:0,defaultLatitude:null!==(n=t.defaultLatitude)&&void 0!==n?n:0,defaultFov:null!==(r=t.defaultFov)&&void 0!==r?r:90,maxFov:null!==(o=t.maxFov)&&void 0!==o?o:120,minFov:null!==(s=t.minFov)&&void 0!==s?s:40,maxLatitude:null!==(a=t.maxLatitude)&&void 0!==a?a:+Math.PI/2,minLatitude:null!==(l=t.minLatitude)&&void 0!==l?l:-Math.PI/2,moveSpeed:null!==(u=t.moveSpeed)&&void 0!==u?u:3.2,intersectMeshCreator:null!==(c=t.intersectMeshCreator)&&void 0!==c?c:function(){return new Bo}})},t.initAnimationEndPose=function(e){var t,i,n,r=this.parseArgs(e),o=e.initial,s=o[0],a=o[1];return{longitude:null!==(t=a.longitude)&&void 0!==t?t:r.defaultLongitude,latitude:Er(null!==(i=a.latitude)&&void 0!==i?i:r.defaultLatitude,r.minLatitude,r.maxLatitude),fov:Er(null!==(n=a.fov)&&void 0!==n?n:r.defaultFov,r.minFov,r.maxFov),offset:r.work.observers[s].position.clone(),distance:0}},t.prototype.destroy=function(){e.prototype.destroy.call(this),this.interiaMovement=!1,this.intersectMesh&&(this.helper.remove(this.intersectMesh),this.intersectMesh.dispose()),this.mouseWheelState&&clearTimeout(this.mouseWheelState.timer),delete this.mouseWheelState,delete this.mouseMoveState,delete this.panState},t.prototype.isReady=function(){return!this.interiaMovement&&(!this.panState&&(!this.pinchState&&(!this.mouseWheelState&&e.prototype.isReady.call(this))))},t.prototype.calculateMovingDuration=function(e,t){switch(typeof e){case"function":return e(t,this.moveSpeed);case"number":return e;case"string":return Number(e);default:return Er(t,2,5)/this.moveSpeed*1e3}},t.prototype.hideIntersectMesh=function(){this.intersectMesh.visible=!1,this.emit("intersectionHidden"),this.needsRender=!0},t.prototype.coordinatesForOffset=function(e){var t=this.cameraMotion.value.fov,i=this.camera.aspect,r=this.renderer.getSize(new n.Vector2);return{longitude:2*e.x/(r.x*this.scissor.width)*t/95*i,latitude:-2*e.y/(r.y*this.scissor.height)*t/95}},t.prototype.cameraBounce=function(){var e=this.cameraMotion.value,t=e.longitude,i=e.latitude,n=e.fov,r=[{progress:0,value:{longitude:t,latitude:i,fov:n}},{progress:.5,value:{longitude:t,latitude:i,fov:.98*n}},{progress:1,value:{longitude:t,latitude:i,fov:n}}];this.cameraMotion.setKeyframes(r,500).catch(qe)},t.prototype.requestInteriaMovement=function(e,t){var i=this;if(!1!==this.interiaMovement){for(var n=Fe({},e),r={longitude:0,latitude:0},o=0;o<t;o++)n.longitude*=.996,n.latitude*=.98604,r.longitude+=n.longitude,r.latitude+=n.latitude;var s=Vo(this.cameraMotion.value.longitude+r.longitude),a=Er(this.cameraMotion.value.latitude+r.latitude,this.minLatitude,this.maxLatitude),l={longitude:s,latitude:a,fov:this.cameraMotion.value.fov,offset:this.camera.pose.offset.clone(),distance:this.camera.pose.distance};this.cameraMotion.set({longitude:s,latitude:a},0).catch(qe);var u=n.longitude>1e-4||n.longitude<-1e-4||n.latitude>1e-4||n.latitude<-1e-4;this.emit("interiaPan",l,!u),u?dt.shared.add((function(e,t){i.requestInteriaMovement(n,0|t)}),!0,1):this.interiaMovement=!1}},t.prototype.onPanGesture=function(e){var t=this.panState,i=e.pointers.length;if(e.isFinal?delete this.panState:this.panState={pointerLength:i,x:e.center.x,y:e.center.y},void 0!==t&&t.pointerLength===i){var n=e.pointers.map((function(e){return Tt(e,["x","y"])}));if(!this.emit("wantsGesture","pan",n,e.isFinal)){var r={x:e.center.x-t.x,y:e.center.y-t.y},o=this.coordinatesForOffset(r),s=Vo(this.cameraMotion.value.longitude+o.longitude),a=Er(this.cameraMotion.value.latitude+o.latitude,this.minLatitude,this.maxLatitude);this.camera.aspect<1&&Math.abs(e.overallVelocityX)>.2&&Math.atan2(Math.abs(e.overallVelocityY),Math.abs(e.overallVelocityX))<Math.PI/6.923&&(a=this.cameraMotion.value.latitude);var l={longitude:s,latitude:a,fov:this.cameraMotion.value.fov,offset:this.camera.pose.offset.clone(),distance:this.camera.pose.distance};if(!this.emit("wantsPanGesture",l,e.isFinal)){this.emit("gesture","pan",n,e.isFinal),this.emit("panGesture",l,e.isFinal),this.userAction=!0,this.interiaMovement=!1,this.hideIntersectMesh();var u={longitude:l.longitude,latitude:l.latitude,fov:l.fov};if(this.cameraMotion.set(u,0).catch(qe),e.isFinal)if(!this.emit("wantsInteriaPan",l)){this.interiaMovement=!0;var c=e.velocityX,h=.6*e.velocityY;Math.abs(h)>.5&&Math.abs(c)<.5&&(c=0),this.requestInteriaMovement(this.coordinatesForOffset({x:c,y:h}),0)}}}}},t.prototype.onPinchGesture=function(e){var t,i=null===(t=this.pinchState)||void 0===t?void 0:t.fov,n=e.scale,r=!1;if("pinchstart"!==e.type){if("pinchend"===e.type&&(r=!0,delete this.pinchState),void 0!==i){var o=e.pointers.map((function(e){return Tt(e,["x","y"])}));if(!this.emit("wantsGesture","pinch",o,r)){var s=Er(i/n,this.minFov,this.maxFov);this.emit("wantsPinchGesture",n,s,r)||this.emit("wantsChangeCameraFov",s)||(this.emit("gesture","pinch",o,r),this.emit("pinchGesture",n,s,r),this.userAction=!0,this.interiaMovement=!1,this.cameraMotion.set({fov:s},0).catch(qe),this.onPanGesture(e))}}}else this.pinchState={fov:this.cameraMotion.value.fov}},t.prototype.onMouseWheel=function(e){var t=this,i=(Math.abs(e.deltaY)>Math.abs(e.deltaX)?e.deltaY:e.deltaX)/-60,n=[{x:e.clientX,y:e.clientY,delta:i}];if(!this.emit("wantsGesture","mouseWheel",n,!1)){var r=Er(this.cameraMotion.value.fov-i,this.minFov,this.maxFov);this.emit("wantsMouseWheel",i,r,!1)||this.emit("wantsChangeCameraFov",r)||(this.emit("gesture","mouseWheel",n,!1),this.emit("mouseWheel",i,r,!1),this.userAction=!0,this.interiaMovement=!1,this.cameraMotion.set({fov:r},0).catch(qe),this.mouseWheelState&&clearTimeout(this.mouseWheelState.timer),this.mouseWheelState={timer:window.setTimeout((function(){delete t.mouseWheelState;t.emit("wantsGesture","mouseWheel",n,!0)||t.emit("wantsMouseWheel",i,r,!0)||t.emit("wantsChangeCameraFov",r)||(t.emit("gesture","mouseWheel",n,!0),t.emit("mouseWheel",0,r,!0))}),200)})}},t.prototype.onMouseMove=function(e){if(this.intersectMesh.parent&&!this.model.empty&&this.model.bvhs&&!0===this.model.bvhs.loaded&&!this.panState){var t=this.relativeClientPosition({x:e.clientX,y:e.clientY}),i=new n.Raycaster;if(i.setFromCamera(t,this.camera),this.emit("wantsShowIntersectionOnModel",i))this.hideIntersectMesh();else{var r=this.model.intersectRaycaster(i)[0];if(r&&r.face){var o=r.face.normal,s=o.clone().multiplyScalar(.05),a=r.point.clone().add(s);this.intersectMesh.position.copy(a);var l=a.clone().add(s);if(this.intersectMesh.lookAt(l),Math.abs(o.y)>.99){var u=this.camera.position.clone().sub(a);this.intersectMesh.rotation.z=-Math.atan2(u.z,u.x)}this.intersectMesh.visible=!0,this.needsRender=!0,this.emit("intersectionOnModelUpdate",r,this.intersectMesh)}else this.hideIntersectMesh();this.mouseMoveState={clientX:e.clientX,clientY:e.clientY}}}},t.prototype.onMouseOut=function(){this.intersectMesh.parent&&!0===this.intersectMesh.visible&&this.hideIntersectMesh()},t.prototype.onPressGesture=function(e,t){var i,r,o=[e];if(this.emit("wantsGesture","press",o,t))return null===(i=this.pressState)||void 0===i||i.stop(),void delete this.pressState;var s=this.relativeClientPosition(e),a=new n.Raycaster;if(a.setFromCamera(s,this.camera),this.emit("wantsPressGesture",a,s,e.delta,t))return null===(r=this.pressState)||void 0===r||r.stop(),void delete this.pressState;this.emit("gesture","press",o,t),this.emit("pressGesture",a,s,e.delta,t)},t}(os);function gs(){return As||(As=new Promise((function(e){var t,i=document.createElement("video");i.muted=!0,i.src="data:video/mp4;base64,AAAAHGZ0eXBNNFYgAAACAGlzb21pc28yYXZjMQAAAAhmcmVlAAAGF21kYXTeBAAAbGliZmFhYyAxLjI4AABCAJMgBDIARwAAArEGBf//rdxF6b3m2Ui3lizYINkj7u94MjY0IC0gY29yZSAxNDIgcjIgOTU2YzhkOCAtIEguMjY0L01QRUctNCBBVkMgY29kZWMgLSBDb3B5bGVmdCAyMDAzLTIwMTQgLSBodHRwOi8vd3d3LnZpZGVvbGFuLm9yZy94MjY0Lmh0bWwgLSBvcHRpb25zOiBjYWJhYz0wIHJlZj0zIGRlYm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AAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAACMc3RjbwAAAAAAAAAfAAAALAAAA1UAAANyAAADhgAAA6IAAAO+AAAD0QAAA+0AAAQAAAAEHAAABC8AAARLAAAEZwAABHoAAASWAAAEqQAABMUAAATYAAAE9AAABRAAAAUjAAAFPwAABVIAAAVuAAAFgQAABZ0AAAWwAAAFzAAABegAAAX7AAAGFwAAAGJ1ZHRhAAAAWm1ldGEAAAAAAAAAIWhkbHIAAAAAAAAAAG1kaXJhcHBsAAAAAAAAAAAAAAAALWlsc3QAAAAlqXRvbwAAAB1kYXRhAAAAAQAAAABMYXZmNTUuMzMuMTAw",i.addEventListener("timeupdate",(function n(){i.removeEventListener("timeupdate",n,!1),clearTimeout(t);var r=document.createElement("canvas");r.width=r.height=1;var o=r.getContext("2d");o?(o.drawImage(i,0,0,1,1),o.getImageData(0,0,1,1).data[3]>10?e(!0):e(!1)):e(!1)}),!1),i.addEventListener("canplay",(function e(){i.removeEventListener("canplay",e,!1),i.play()}),!1),t=window.setTimeout((function(){return e(!1)}),1e3)})))}var vs,ys=function(e){function t(t,i){return void 0===i&&(i=.5),e.call(this,t,{uniforms:{inputBuffer:new n.Uniform(null),scale:new n.Uniform(i)},fragment:"\n#include <common>\nuniform sampler2D inputBuffer;\nuniform float scale;\nvarying vec2 vUv;\n\nvoid main() {\n float u = (vUv.x - 0.5) * scale + 0.5;\n float v = (vUv.y - 0.5) * scale + 0.5;\n vec3 rgb = texture2D(inputBuffer, vec2(u, v)).rgb;\n float luminance = clamp(linearToRelativeLuminance(rgb), 0.1, 0.9);\n gl_FragColor = vec4(luminance);\n}\n"})||this}return ke(t,e),t}(ts),bs=function(e){function t(t,i){void 0===i&&(i=.002);var r=e.call(this,t,{uniforms:{targetBuffer:new n.Uniform(null),inputBuffer:new n.Uniform(null),step:new n.Uniform(i)},fragment:"\n uniform sampler2D targetBuffer;\n uniform sampler2D inputBuffer;\n uniform float step;\n varying vec2 vUv;\n void main() {\n\n #ifdef GL_EXT_shader_texture_lod\n #if __VERSION__ < 300\n float target = texture2DLodEXT(targetBuffer, vUv, 5.0).r;\n #else\n float target = textureLod(targetBuffer, vUv, 5.0).r;\n #endif\n #else\n float target = texture2D(targetBuffer, vUv).r;\n #endif\n float current = texture2D(inputBuffer, vUv).r;\n\n float result;\n if (abs(target - current) < step) {\n result = target;\n } else if (target - current > 0.0) {\n result = current + step;\n } else {\n result = current - step;\n }\n gl_FragColor = vec4(result, result, result, 1.0);\n }\n "})||this;return r.material.extensions.shaderTextureLOD=!0,r}return ke(t,e),Object.defineProperty(t.prototype,"targetBuffer",{get:function(){return this.material.uniforms.targetBuffer.value},set:function(e){this.material.uniforms.targetBuffer.value=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"step",{get:function(){return this.material.uniforms.step.value},set:function(e){this.material.uniforms.step.value=e},enumerable:!1,configurable:!0}),t}(ts),xs=function(e){function t(t){var i=e.call(this,t,{uniforms:{inputBuffer:new n.Uniform(null),luminanceAdaptiveBuffer:new n.Uniform(null),progress:new n.Uniform(0)},fragment:"\n #include <common>\n uniform sampler2D inputBuffer;\n uniform sampler2D luminanceAdaptiveBuffer;\n uniform float progress;\n varying vec2 vUv;\n\n void main() {\n float middleGrey = 1.5;\n float whitePoint = 13.0;\n float exposure = 1.4;\n vec4 inputColor = texture2D(inputBuffer, vUv);\n vec3 rgb = inputColor.rgb * exposure;\n float alpha = inputColor.a;\n float luminance = linearToRelativeLuminance(rgb);\n float lumAvg = texture2D(luminanceAdaptiveBuffer, vec2(0.5)).r;\n float lumScaled = (luminance * middleGrey) / max(lumAvg, 1e-6);\n float lumCompressed = lumScaled * (1.0 + lumScaled / (whitePoint * whitePoint));\n lumCompressed /= (1.0 + lumScaled);\n rgb = clamp(lumCompressed * rgb, 0.0, 1.0);\n gl_FragColor = mix(inputColor, vec4(rgb, alpha), progress * 0.9);\n }\n "})||this;return i.material.transparent=!0,i}return ke(t,e),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}(ts),ws=function(e){function t(t){var i=e.call(this,t)||this;return i.enableTime=Ue(),i.renderer=t,i.valuePass=new is(i.renderer),i.luminancePass=new ys(i.renderer,Math.sqrt(1/3)),i.nextStepPass=new bs(i.renderer,.01),i.luminanceAdaptivePass=new xs(i.renderer),i}return ke(t,e),t.prototype.render=function(e,t){if(!this.enable)return this.enableTime=null,void this.copyPass.render(e,t);null===this.enableTime&&(this.enableTime=Ue()),this.luminanceTargetBuffer||(this.luminanceTargetBuffer=new n.WebGLRenderTarget(128,128,{minFilter:n.LinearMipmapLinearFilter,magFilter:n.LinearFilter,encoding:this.renderer.outputEncoding,stencilBuffer:!1,depthBuffer:!1,format:n.RGBAFormat,generateMipmaps:!0}),this.nextStepPass.targetBuffer=this.luminanceTargetBuffer.texture),this.luminancePass.render(e,this.luminanceTargetBuffer),this.luminancePrevBuffer||(this.luminancePrevBuffer=new n.WebGLRenderTarget(1,1,{minFilter:n.NearestFilter,magFilter:n.NearestFilter,type:n.HalfFloatType,encoding:this.renderer.outputEncoding,stencilBuffer:!1,depthBuffer:!1}),this.valuePass.render(new n.Vector3(.5,.5,.5),this.luminancePrevBuffer)),this.luminanceNextBuffer||(this.luminanceNextBuffer=new n.WebGLRenderTarget(1,1,{minFilter:n.NearestFilter,magFilter:n.NearestFilter,type:n.HalfFloatType,encoding:this.renderer.outputEncoding,stencilBuffer:!1,depthBuffer:!1}),this.valuePass.render(new n.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((Ue()-this.enableTime)/100,1),this.luminanceAdaptivePass.render(e,t)},t.prototype.dispose=function(){var e,t,i;null===(e=this.luminanceTargetBuffer)||void 0===e||e.dispose(),null===(t=this.luminancePrevBuffer)||void 0===t||t.dispose(),null===(i=this.luminanceNextBuffer)||void 0===i||i.dispose(),this.copyPass.dispose(),this.luminancePass.dispose(),this.nextStepPass.dispose(),this.luminanceAdaptivePass.dispose()},t}(rs),Es=null!==(vs=Math.SQRT1_2)&&void 0!==vs?vs:Math.sqrt(2),Ms={up:new n.Quaternion(Es,0,0,Es),down:new n.Quaternion(-Es,0,0,Es),left:new n.Quaternion(0,Es,0,Es),right:new n.Quaternion(0,-Es,0,Es),front:new n.Quaternion(0,0,0,1),back:new n.Quaternion(0,1,0,0)},Ss=new Float32Array([-.5,-.5,0,.5,-.5,0,-.5,.5,0,.5,.5,0]),Cs=new Float32Array([0,0,1,0,0,1,1,1]),Is=new Uint8Array([0,1,2,1,3,2]),Bs=new n.BufferGeometry;Bs.setAttribute("position",new n.BufferAttribute(Ss,3)),Bs.setAttribute("uv",new n.BufferAttribute(Cs,2)),Bs.setIndex(new n.BufferAttribute(Is,1));var Ts=function(e){function t(){var t=e.call(this,{uniforms:{map:{value:null},luminanceMap:{value:null}},vertexShader:"\nvarying vec2 vUv;\nvoid main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}\n",fragmentShader:"\n#if defined(USE_LUMINANCE)\nuniform sampler2D luminanceMap;\n#endif\nuniform sampler2D map;\nvarying vec2 vUv;\n\nvoid main() {\n gl_FragColor = texture2D(map, vUv);\n #if defined(USE_LUMINANCE)\n gl_FragColor.a = 1.0 - texture2D(luminanceMap, vUv).r;\n #endif\n}\n"})||this;return t.depthTest=!1,t.depthWrite=!1,t.blending=n.NoBlending,t.map=t.uniforms.map.value,t.luminanceMap=t.uniforms.luminanceMap.value,Object.defineProperties(t,{map:{get:function(){return this.uniforms.map.value},set:function(e){this.uniforms.map.value=e}},luminanceMap:{get:function(){return this.uniforms.luminanceMap.value},set:function(e){this.uniforms.luminanceMap.value=e,this.defines.USE_LUMINANCE=null!==e,this.needsUpdate=!0}}}),t}return ke(t,e),t}(n.ShaderMaterial),Ps=function(e){function t(t,i){var r=e.call(this,Bs,new Ts)||this;return t.box.getCenter(r.position),r.quaternion.multiplyQuaternions((new n.Quaternion).setFromAxisAngle(new n.Vector3(0,1,0),-Math.PI),Ms[t.face]),r.scale.setScalar(t.size),r.node=t,r.name="tiling:tile",r.material.visible=!1,r.activeTime=-1,r.disposed=!1,r.needsRender=!1,r.frustumCulled=!1,i.then((function(e){var t=e[0],i=e[1];r.disposed?(t.dispose(),null==i||i.dispose()):(r.material.map=t,r.material.luminanceMap=i,r.material.needsUpdate=!0,r.material.visible=!0,r.needsRender=!0)})).catch(qe),r}return ke(t,e),t.prototype.updateTime=function(e){},t.prototype.dispose=function(){var e;this.disposed=!0,this.material.map&&(this.material.map.dispose(),null===(e=this.material.luminanceMap)||void 0===e||e.dispose()),this.material.dispose()},t}(n.Mesh),Rs=function(e){function t(){var t=e.call(this)||this;return t.needsRender=!1,t.name="tiling",t}return ke(t,e),t}(n.Group),Ds=function(){function e(e,t,i){this.disposed=!1,this.textureLoader=new oi(e),this.minLevel=t,this.level=0,this.panoIndex=0,this.pedding=0,this.tileTree=It(this.minLevel),this.tileMeshes=new Map,this.resource=[],this.luminance=null,this.imageOptions=i,this.object=new Rs,this.object.renderOrder=-2}return e.prototype.setAllowHosts=function(e){this.textureLoader.setAllowHosts(e)},e.prototype.setRequestProxy=function(e){this.textureLoader.setRequestProxy(e)},e.prototype.setNetworkSubscribe=function(e){this.textureLoader.setNetworkSubscribe(e)},e.prototype.cleanup=function(){var e=this;this.tileMeshes.forEach((function(t){t.dispose(),e.object.remove(t),e.object.needsRender=!0})),this.tileMeshes.clear()},e.prototype.setRotation=function(e){this.disposed||this.object.quaternion.equals(e)||(this.object.quaternion.copy(e),this.object.needsRender=!0)},e.prototype.setPosition=function(e){this.disposed||this.object.position.equals(e)||(this.object.position.copy(e),this.object.needsRender=!0)},e.prototype.setResource=function(e,t){var i,n;if(!this.disposed&&(this.resource!==e||this.luminance!==t)){this.cleanup(),this.resource=e;var r=null!==(n=null===(i=e.slice().sort((function(e,t){return t.level-e.level}))[0])||void 0===i?void 0:i.level)&&void 0!==n?n:0;this.tileTree=It(r),this.luminance=t,this.object.needsRender=!0}},e.prototype.update=function(e,t,i){var r=this;if(!this.disposed){this.level=t;var o=e.planes[5].normal,s=[];t>=this.minLevel&&Bt(this.tileTree,(function(i){if(!(i.level<r.minLevel))return!(i.level>t)&&(!!e.intersectsBox(i.box)&&void s.push(i))}));var a=new n.Vector3;s.sort((function(e,t){return e.level!==t.level?e.level-t.level:e.box.getCenter(a).angleTo(o)-t.box.getCenter(a).angleTo(o)}));for(var l=new Set,u=function(e){var t=c.resource.filter((function(t){return t.level===e.level}))[0];if(!t)return"continue";if(l.add(e),c.tileMeshes.has(e))return c.tileMeshes.get(e).activeTime=i,"continue";var n=t.size,o=c.imageOptions.transform,s=Math.pow(2,e.level)*e.position.y,a=Math.pow(2,e.level)*e.position.x,u="".concat(c.panoIndex,".").concat(e.face,".").concat(e.level,".").concat(s,".").concat(a),h=Fe(Fe({key:"pano_tile.".concat(u),basisLoaderInitialized:ii.isInitialized()},Tt(c.imageOptions,["format","size","quality","sharpen","mappings"])),{size:n*e.size==512?void 0:512,cut:[n*e.position.x,n*e.position.y,n*e.size,n*e.size]}),d=c.textureLoader.loadTexture(t[e.face],{imageURL:{transform:o,options:h},preInit:!0}).then((function(e){return e.body})),p=null;if(c.luminance){var f=c.luminance[e.face],A=f.match(/\/cube_(\d+)\//),m=!!A&&Number(A[1]);if(!1!==m){var g=Fe(Fe({},h),{size:m*e.size==256?void 0:256,cut:[m*e.position.x,m*e.position.y,m*e.size,m*e.size],key:"pano_tile_luminance.".concat(u)});p=c.textureLoader.loadTexture(f,{imageURL:{transform:c.imageOptions.transform,options:g},preInit:!0}).then((function(e){return e.body})).catch((function(){return null}))}}c.pedding++;var v=Promise.all([d,p]).then((function(e){return r.pedding--,e}),(function(e){return r.pedding--,Promise.reject(e)})),y=new Ps(e,v);y.name="tiling:tile-".concat(u),y.activeTime=i,y.renderOrder=e.level,c.tileMeshes.set(e,y),c.object.needsRender=!0,c.object.add(y)},c=this,h=0,d=s;h<d.length;h++){u(g=d[h])}var p=[];this.tileMeshes.forEach((function(e,t){l.has(t)||p.push(t)}));for(var f=p.sort((function(e,t){var i,n,o,s;return(null!==(n=null===(i=r.tileMeshes.get(t))||void 0===i?void 0:i.activeTime)&&void 0!==n?n:0)-(null!==(s=null===(o=r.tileMeshes.get(e))||void 0===o?void 0:o.activeTime)&&void 0!==s?s:0)})).slice(Math.max(0,32-l.size)),A=0,m=f;A<m.length;A++){var g=m[A],v=this.tileMeshes.get(g);v&&(v.dispose(),this.object.remove(v),this.object.needsRender=!0),this.tileMeshes.delete(g)}}},e.prototype.dispose=function(){this.cleanup(),this.resource=[],this.disposed=!0},e}(),Ls=new Float32Array([-1,1,1,-1,1,-1,-1,-1,1,-1,-1,-1,1,1,-1,1,1,1,1,-1,-1,1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,-1,1,-1,-1,1,1,-1,-1,-1,-1,-1,1,1,1,-1,1,1,1,-1,1,-1,-1,1,-1,1,-1,1,1,-1,-1,-1,-1,1,-1,-1]),ks=new Uint8Array([0,2,1,2,3,1,4,6,5,6,7,5,8,10,9,10,11,9,12,14,13,14,15,13,16,18,17,18,19,17,20,22,21,22,23,21]),Fs=new n.BufferGeometry;Fs.setAttribute("position",new n.BufferAttribute(Ls,3)),Fs.setIndex(new n.BufferAttribute(ks,1));var Os=function(){function e(){this.material=new n.ShaderMaterial({vertexShader:"\n#if defined(USE_PANO_VIDEO)\nvarying vec3 worldPosition;\n#endif\nvoid main() {\n vec4 transformed = vec4(position, 1.0);\n #if defined(USE_PANO_VIDEO)\n worldPosition = (modelMatrix * transformed).xyz;\n #endif\n gl_Position = projectionMatrix * modelViewMatrix * transformed;\n}\n",fragmentShader:"\nuniform vec2 size;\nuniform mat4 matrix;\nuniform float alpha;\nuniform sampler2D map;\n#if defined(USE_PANO_VIDEO)\nvarying vec3 worldPosition;\n#endif\n#include <common>\nvoid main() {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);\n #if defined(USE_PANO_VIDEO)\n vec3 cameraToVertex = worldPosition - cameraPosition;\n vec4 mapCoods = vec4(cameraToVertex, 1.0) * matrix;\n vec2 uv = vec2(\n 0.5 + mapCoods.x / mapCoods.z / size.x,\n 0.5 - mapCoods.y / mapCoods.z / size.y\n );\n vec4 videoColor = texture2D(map, uv);\n float match = (1.0 - step(0.0, mapCoods.z)) * (1.0 - step(0.5, abs(uv.x - 0.5))) * (1.0 - step(0.5, abs(uv.y - 0.5)));\n float blendAlpha = clamp(0.0, 1.0, 5.0 * (1.0 - clamp(distance(uv, vec2(0.5, 0.5)) / 0.55 , 0.0, 1.0)));\n gl_FragColor = vec4(videoColor.rgb, match * blendAlpha * alpha);\n #endif\n}\n",uniforms:{size:new n.Uniform(null),matrix:new n.Uniform(null),alpha:new n.Uniform(null),map:new n.Uniform(null)},depthTest:!1,depthWrite:!1,defines:{USE_PANO_VIDEO:!1},blending:n.CustomBlending,blendSrc:n.SrcAlphaFactor,blendDst:n.OneMinusSrcAlphaFactor,blendSrcAlpha:n.OneFactor,blendDstAlpha:n.OneMinusSrcAlphaFactor}),this.object=new n.Mesh(Fs,this.material),this.object.visible=!1,this.object.renderOrder=-1,this.object.frustumCulled=!1,this.alphaMotion=new Ur({alpha:0})}return e.prototype.setMaterial=function(e){e?(this.material.uniforms.size.value=e.size,this.material.uniforms.matrix.value=e.matrix,this.material.uniforms.map.value=e.map,this.alphaMotion.set({alpha:e.alpha},500).catch(qe),this.material.uniforms.alpha.value=e.alpha):(this.material.uniforms.size.value=null,this.material.uniforms.matrix.value=null,this.material.uniforms.map.value=null,this.alphaMotion.set({alpha:0},0).catch(qe));var t=null!==e;t!==this.material.defines.USE_PANO_VIDEO&&(this.material.defines.USE_PANO_VIDEO=t,this.material.needsUpdate=!0,this.object.visible=null!==e)},e.prototype.updateTime=function(e){this.alphaMotion.ended||(this.alphaMotion.update(e),this.material.uniforms.alpha.value=this.alphaMotion.value.alpha)},e.prototype.dispose=function(){this.material.dispose()},e}(),Ns=(new n.Matrix4).makeRotationAxis(new n.Vector3(0,1,0),Math.PI),Vs=new n.Vector3(-1,1,1),Qs=function(){function e(e){void 0===e&&(e=0),this.width=e,this.pool=[]}return Object.defineProperty(e.prototype,"size",{get:function(){return this.pool.length},enumerable:!1,configurable:!0}),e.prototype.pop=function(){var e=this.pool.pop();return e||new n.WebGLCubeRenderTarget(this.width,{stencilBuffer:!1,depthBuffer:!1})},e.prototype.push=function(e){-1===this.pool.indexOf(e)&&this.pool.push(e)},e.prototype.clear=function(){for(var e=0,t=this.pool;e<t.length;e++){t[e].dispose()}this.pool.length=0},e}(),Hs=function(e){function t(i){var n,r,o,s,a=this,l=t.parseArgs(i);(a=e.call(this,l)||this).TILED_CUBE_TEXTURE_LEVEL=2,a.tileLevel=0,a.initAnimationed=!1,a.currentPanoIndex=l.initial[0],a.maxAccessibleDistance=l.maxAccessibleDistance,a.panoTapTriggerRadius=l.panoTapTriggerRadius,a.panoCircleMeshCreator=l.panoCircleMeshCreator,a.tileLevelForFov=l.tileLevelForFov,a.luminanceAdaptiveEffectEnable=l.luminanceAdaptiveEffectEnable,a.colorCubeRenderTargetPool=new Qs,a.luminanceCubeRenderTargetPool=new Qs;var u=a.model.getMaterial()||{},c=u.pano0,h=u.pano1;c&&(null==h?void 0:h.map)!==c.map&&(a.model.setMaterial({pano0:h}),c.map.dispose(),c.map instanceof ri&&c.map.cubeRenderTarget&&a.colorCubeRenderTargetPool.push(c.map.cubeRenderTarget),c.luminanceMap&&(c.luminanceMap.dispose(),c.luminanceMap instanceof ri&&c.luminanceMap.cubeRenderTarget&&a.luminanceCubeRenderTargetPool.push(c.luminanceMap.cubeRenderTarget))),a.panoMeshes=[],a.updatePanoMeshes(),a.locationMotion=new Ur({count:0,distance:a.camera.pose.distance,modelAlpha:null!==(r=null===(n=a.model.getMaterial())||void 0===n?void 0:n.modelAlpha)&&void 0!==r?r:0,perspToOrtho:a.camera.perspToOrtho.x,orthoDistance:a.camera.orthoDistance}),a.panoResources={},a.panoResources[a.locationMotion.keyframes[0].key=a.locationMotion.keyframes[1].key=rr()]={panoIndex:a.currentPanoIndex,workCode:a.work.workCode,panoPicture:null!==(s=null===(o=a.model.getMaterial())||void 0===o?void 0:o.pano1)&&void 0!==s?s:null,position:a.camera.pose.offset.clone(),effect:"fly"};var d={allowHosts:a.work.allowHosts,requestProxy:a.requestProxy,networkSubscribe:a.networkSubscribe};return a.textureLoader=new oi(d),a.tiling=new Ds(d,a.TILED_CUBE_TEXTURE_LEVEL+1,a.imageOptions),a.scene.add(a.tiling.object),a.panoVideo=new Os,a.scene.add(a.panoVideo.object),a}return ke(t,e),t.parseArgs=function(t){var i,n,r,o,s,a=e.parseArgs.call(this,t);return Fe(Fe({},a),{maxAccessibleDistance:null!==(i=t.maxAccessibleDistance)&&void 0!==i?i:5,panoTapTriggerRadius:null!==(n=t.panoTapTriggerRadius)&&void 0!==n?n:.5,panoCircleMeshCreator:null!==(r=t.panoCircleMeshCreator)&&void 0!==r?r:function(e){return new uo},tileLevelForFov:null!==(o=t.tileLevelForFov)&&void 0!==o?o:function(e,t){var i=2*Math.atan(Math.tan(e/180*Math.PI/2)*(t.width/t.height))/Math.PI*180,n=Math.max(t.width/i,t.height/e);return n>80?4:n>48?3:n>18?2:n>12?1:0},luminanceAdaptiveEffectEnable:null===(s=t.luminanceAdaptiveEffectEnable)||void 0===s||s})},t.initAnimationEndPose=function(t){var i=this.parseArgs(t);return e.initAnimationEndPose.call(this,i)},t.prototype.destroy=function(){var t,i,n=this;e.prototype.destroy.call(this),this.scene.remove(this.tiling.object),this.tiling.dispose(),this.locationMotion.dispose(),this.colorCubeRenderTargetPool.clear(),this.luminanceCubeRenderTargetPool.clear(),delete this.pendingTextureTask,this.panoMeshes&&(this.panoMeshes.forEach((function(e){n.helper.remove(e),e.dispose()})),this.panoMeshes.length=0),this.interiaMovement=!1;var r=this.videoTexture.image;r.pause(),r.oncanplay=function(){},r.ontimeupdate=function(){},this.scene.remove(this.panoVideo.object),this.panoVideo.setMaterial(null),this.panoVideo.dispose();for(var o=null!==(t=this.model.getMaterial())&&void 0!==t?t:{},s=o.pano0,a=o.pano1,l=0,u=Object.keys(this.panoResources);l<u.length;l++){var c=u[l],h=this.panoResources[c];if(h.panoPicture){var d=h.panoPicture.map;d&&d!==(null==s?void 0:s.map)&&d!==(null==a?void 0:a.map)&&(d.dispose(),null===(i=h.panoPicture.luminanceMap)||void 0===i||i.dispose(),h.panoPicture=null)}delete this.panoResources[c]}this.luminanceAdaptiveEffect&&(this.luminanceAdaptiveEffect.dispose(),delete this.luminanceAdaptiveEffect)},t.prototype.isReady=function(){return!0===this.locationMotion.ended&&e.prototype.isReady.call(this)},t.prototype.isTileReady=function(){var e,t,i,n=this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[this.locationMotion.keyframes.length-1]),r=(null===(e=n.panoPicture)||void 0===e?void 0:e.map)instanceof ri&&null!==(i=null===(t=n.panoPicture)||void 0===t?void 0:t.map.tilePending)&&void 0!==i?i:0,o=this.tiling.pedding;return this.initAnimationed&&r<=0&&o<=0},t.prototype.updateWork=function(e,t,i,n,r){var o=this;this.userAction=r,this.work=e,this.currentPanoIndex=t,this.textureLoader.setAllowHosts(this.work.allowHosts),this.tiling.setAllowHosts(this.work.allowHosts),this.tiling.cleanup(),this.initAnimationed=!1,this.hideIntersectMesh(),this.updatePanoMeshes();for(var s=0,a=this.panoMeshes;s<a.length;s++){a[s].visible=!1}return this.moveToPano(t,{effect:"fade",duration:n,longitude:i.longitude,latitude:i.latitude,fov:i.fov,moveEndCallback:function(){o.initAnimationed=!0},moveCancelCallback:function(){o.initAnimationed=!0}},r),!0},t.prototype.updateModel=function(e){this.model=e,this.updatePanoMeshes()},t.prototype.updateTime=function(e,t){var i,r,o,s,a,l,u,c,h,d,p=this;if(!this.destroyed){var f={},A={},m=this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[0]),g=this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[this.locationMotion.keyframes.length-1]),v=!1;if(!1===this.locationMotion.ended){this.locationMotion.update(e);var y=this.locationMotion.getKeyFrameSegment(e),b=y[0],x=y[1],w=this.panoResourceFromLocationMotionKeyframe(b),E=this.panoResourceFromLocationMotionKeyframe(x),M=(new n.Vector3).copy(w.position),S=(new n.Vector3).copy(E.position),C=this.locationMotion.value.count-x.value.count+1;f.progress=C,f.modelAlpha=this.locationMotion.value.modelAlpha,this.camera.perspToOrtho.setScalar(Er(this.locationMotion.value.perspToOrtho,0,1)),this.camera.orthoDistance=this.locationMotion.value.orthoDistance,E.panoPicture&&(C<1?w.panoPicture&&(f.pano0=w.panoPicture):f.pano0=E.panoPicture,f.pano1=E.panoPicture),v=f.useBlackTransition="instant"===E.effect||"montage"===E.effect,"fade"!==E.effect&&"montage"!==E.effect||(f.pano0&&w.panoPicture&&(f.pano0={map:f.pano0.map,luminanceMap:f.pano0.luminanceMap,matrix:w.panoPicture.matrix.clone().setPosition(E.position)}),M.copy(S)),A.distance=this.locationMotion.value.distance,A.offset=new n.Vector3(M.x+(S.x-M.x)*C,M.y+(S.y-M.y)*C,M.z+(S.z-M.z)*C);for(var I=[],B=[],T=0,P=this.locationMotion.keyframes;T<P.length;T++){var R=P[T],D=R.key,L=R.progress;void 0!==D&&(I.push(D),L>=this.locationMotion.progress&&B.push(D))}for(var k=0,F=Object.keys(this.panoResources);k<F.length;k++){var O=F[k];if(!(B.indexOf(O)>=0)){var N=this.panoResources[O];if(N.panoPicture){var V=N.panoPicture.map,Q=N.panoPicture.luminanceMap;if(V){if(V===(null===(i=f.pano0)||void 0===i?void 0:i.map))continue;if(V===(null===(r=f.pano1)||void 0===r?void 0:r.map))continue;V instanceof ri&&V.cubeRenderTarget&&this.colorCubeRenderTargetPool.push(V.cubeRenderTarget),V.dispose(),Q&&(Q instanceof ri&&Q.cubeRenderTarget&&this.luminanceCubeRenderTargetPool.push(Q.cubeRenderTarget),Q.dispose()),N.panoPicture=null}}I.indexOf(O)>=0||delete this.panoResources[O]}}w.workCode===E.workCode?this.currentPanoIndex=C<.5?w.panoIndex:E.panoIndex:this.currentPanoIndex=E.panoIndex,this.emit("movingToPano",g.panoIndex,m.panoIndex,this.locationMotion.progress)}if(!1===this.cameraMotion.ended&&(this.cameraMotion.update(e),A.longitude=this.cameraMotion.value.longitude,A.latitude=this.cameraMotion.value.latitude,A.fov=this.cameraMotion.value.fov),!1===_o(f)&&((null===(o=f.pano0)||void 0===o?void 0:o.map)&&f.pano0.map instanceof ri&&!f.pano0.map.cubeRenderTarget&&(f.pano0.map.cubeRenderTarget=this.colorCubeRenderTargetPool.pop()),(null===(s=f.pano0)||void 0===s?void 0:s.luminanceMap)&&f.pano0.luminanceMap instanceof ri&&!f.pano0.luminanceMap.cubeRenderTarget&&(f.pano0.luminanceMap.cubeRenderTarget=this.luminanceCubeRenderTargetPool.pop()),(null===(a=f.pano1)||void 0===a?void 0:a.map)&&f.pano1.map instanceof ri&&!f.pano1.map.cubeRenderTarget&&(f.pano1.map.cubeRenderTarget=this.colorCubeRenderTargetPool.pop()),(null===(l=f.pano1)||void 0===l?void 0:l.luminanceMap)&&f.pano1.luminanceMap instanceof ri&&!f.pano1.luminanceMap.cubeRenderTarget&&(f.pano1.luminanceMap.cubeRenderTarget=this.luminanceCubeRenderTargetPool.pop()),this.model.setMaterial(f)),!1===_o(A)&&this.setCamera(A),this.camera.pose.distance>.1)for(var H=0;H<this.work.observers.length;H++){(K=this.panoMeshes[H])&&(K.visible=!1)}else{var q=this.work.observers[this.currentPanoIndex];if(q){var z=Go(q.visibleNodes,(function(e){return q.standingPosition.distanceTo(p.work.observers[e].standingPosition)}),!0)[1];z=Er(z,2.5,1/0);var U=q.visibleNodes.concat(this.currentPanoIndex),j=this.getForwardPanoIndexOrNot();for(H=0;H<this.work.observers.length;H++){var K,G=this.work.observers[H];if(K=this.panoMeshes[H])if(G.loadable||G.active)if(-1!==U.indexOf(H))if(v)K.visible=!1,K.setOpacity(0);else{K.visible=!0;var _=K.position.clone().setY(this.camera.position.y).distanceTo(this.camera.position);K.setCurrent(!K.loading&&0===K.progress&&j===H),K.setOpacity(_<.01?0:Er(z/_*1.2,.65,.98));var W=this.camera.position.clone().setY(K.position.y),X=new n.Vector3;W.equals(K.position)?(this.camera.getWorldDirection(X),X.setY(0)):X.copy(K.position).sub(W),X.length()>0&&K.lookAt(X.clone().normalize().add(K.position)),K.updateTime&&K.updateTime(e,t)}else K.visible=!1,K.setOpacity(0);else K.visible=!1,K.setOpacity(0)}}}var Y=this.tileLevel=function(){if(!1===p.tileLevelForFov)return 0;var e=p.renderer.getDrawingBufferSize(new n.Vector2);e.width*=p.scissor.width,e.height*=p.scissor.height;var t=g.panoIndex,i=p.work.observers[t],r=p.imageOptions.size;if(void 0===r&&i){var o=i.images.up.match(/\/cube_(\d+)\//);o&&(r=Number(o[1]))}void 0===r&&(r=2048);var s=0;r>=1024&&(s=1),r>=2048&&(s=2),r>=4096&&(s=3),r>=8192&&(s=4);var a=p.tileLevelForFov(p.camera.fov,e);return a>s?a:0}(),Z=function(){var e,t=(new n.Camera).copy(p.camera);return t.position.set(0,0,0),t.quaternion.premultiply((null!==(e=p.work.observers[g.panoIndex])&&void 0!==e?e:p.work.observers[p.currentPanoIndex]).quaternion.clone().inverse()),t.updateMatrixWorld(!0),(new n.Frustum).setFromProjectionMatrix((new n.Matrix4).multiplyMatrices(p.camera.projectionMatrix,t.matrixWorldInverse))}();g.panoIndex===this.currentPanoIndex&&((null===(u=g.panoPicture)||void 0===u?void 0:u.map)instanceof ri&&(g.panoPicture.map.update(Z,Y),!0===g.panoPicture.map.needsRender&&(g.panoPicture.map.needsRender=!1,this.needsRender=!0)),(null===(c=g.panoPicture)||void 0===c?void 0:c.luminanceMap)instanceof ri&&(g.panoPicture.luminanceMap.update(Z,Y),!0===g.panoPicture.luminanceMap.needsRender&&(g.panoPicture.luminanceMap.needsRender=!1,this.needsRender=!0)));var J=this.tiling.object.visible;if(this.initAnimationed){var $=g.panoIndex,ee=this.work.observers[$];ee&&Ro(this.camera.position,ee.position)&&this.locationMotion.ended?(this.tiling.object.visible=!0,this.tiling.panoIndex!==$&&this.tiling.cleanup(),this.tiling.panoIndex=$,this.tiling.setResource(null!==(d=null===(h=ee.images)||void 0===h?void 0:h.tiles)&&void 0!==d?d:[],this.enableIOSEDR&&ee.images.luminance?ee.images.luminance:null),this.tiling.setRotation(ee.quaternion),this.tiling.setPosition(ee.position),Y>this.TILED_CUBE_TEXTURE_LEVEL?this.tiling.update(Z,Y,e):this.tiling.update(Z,0,e)):this.tiling.object.visible=!1}else this.tiling.object.visible=!1;J!==this.tiling.object.visible&&(this.tiling.object.needsRender=!0),this.panoVideo.object.position.copy(this.camera.position),this.panoVideo.updateTime(e)}},t.prototype.render=function(){var t=this.work.observers[this.currentPanoIndex];t&&t.video&&(this.needsRender=!0),e.prototype.render.call(this)},t.prototype.postProcessing=function(e,t){if(!this.destroyed)return this.luminanceAdaptiveEffect||(this.luminanceAdaptiveEffect=new ws(this.renderer),this.luminanceAdaptiveEffect.enable=this.luminanceAdaptiveEffectEnable),this.luminanceAdaptiveEffect.render(e,t)},t.prototype.getTargetPose=function(){var e=this.cameraMotion.getKeyFrameSegment(Ue())[1],t=this.locationMotion.getKeyFrameSegment(Ue())[1],i=this.panoResourceFromLocationMotionKeyframe(t),n=this.work.observers[i.panoIndex];return{longitude:e.value.longitude,latitude:e.value.latitude,fov:e.value.fov,offset:n?n.position.clone():this.camera.position.clone(),distance:this.locationMotion.value.distance}},t.prototype.moveToPano=function(e,t,i){var r,o,s,a,l=this,u=this.work.observers[e],c=this.imageOptions.size;if(void 0===c&&u){var h=u.images.up.match(/\/cube_(\d+)\//);h&&(c=Number(h[1]))}void 0===c&&(c=2048);var d=this.imageOptions.transform,p=Fe({key:"pano.".concat(e),basisLoaderInitialized:ii.isInitialized()},Tt(this.imageOptions,["format","size","quality","sharpen","mappings"])),f=u.images,A=null!==(o=null===(r=u.images.tiles)||void 0===r?void 0:r.filter((function(e){return e.size>c})))&&void 0!==o?o:null,m=d,g={key:"pano_luminance.".concat(e),basisLoaderInitialized:ii.isInitialized(),size:p.size?p.size/2:1024},v=this.enableIOSEDR&&u.images.luminance?u.images.luminance:null,y=function(){if(!u.images.tiles)return null;if(!v)return null;var e=v.up.match(/\/cube_(\d+)\//),t=!!e&&Number(e[1]);return!1===t?null:null==A?void 0:A.map((function(e){return{level:e.level,size:t,back:v.back,front:v.front,left:v.left,right:v.right,up:v.up,down:v.down}}))}(),b="pano:"+fs([f,p,d]);if(this.pendingTextureTask){if(this.pendingTextureTask.hash===b)return;var x=this.pendingTextureTask.panoIndex;null===(s=this.panoMeshes[x])||void 0===s||s.setProgress(0),this.emit("textureAbort",x,u),this.pendingTextureTask.onError(new Error("texture aborted"))}this.pending=!0;var w,E=this.model.getMaterial()||{},M=E.pano0,S=E.pano1;if(M&&M.map.name===b&&null!==M.luminanceMap===this.enableIOSEDR?w=M:(null==S?void 0:S.map.name)===b&&null!==S.luminanceMap===this.enableIOSEDR&&(w=S),w){var C={panoIndex:e,workCode:this.work.workCode,effect:null!==(a=t.effect)&&void 0!==a?a:"fly",panoPicture:{map:w.map,luminanceMap:w.luminanceMap,matrix:(new n.Matrix4).compose(u.position,u.quaternion,Vs)},position:u.position.clone()};dt.shared.add((function(){l.pending=!1,l.emit("panoLoaded",e),l.doMoveToPano(e,C,t,i)}),!0,1)}else{this.pendingTextureTask={panoIndex:e,hash:b,onLoad:function(r,o){var s,a;if(l.pending=!1,l.destroyed)r.body.dispose();else{r.body.name=b,l.emit("panoLoaded",e);var c={panoIndex:e,workCode:l.work.workCode,effect:null!==(s=t.effect)&&void 0!==s?s:"fly",panoPicture:{map:r.body,luminanceMap:null!==(a=null==o?void 0:o.body)&&void 0!==a?a:null,matrix:(new n.Matrix4).compose(u.position,u.quaternion,Vs)},position:u.position.clone()};l.doMoveToPano(e,c,t,i)}},onError:function(i){l.pending=!1,t.moveCancelCallback&&t.moveCancelCallback(),l.emit("panoLoadError",i,e),l.emit("moveToPanoCanceled",e)}};var I=this.panoMeshes[e];I&&I.tap&&I.tap(),Promise.all([this.tileLevelForFov&&A&&A.length?this.textureLoader.loadTiledCubeTexture(f,A,{tileMaxLevel:this.TILED_CUBE_TEXTURE_LEVEL,imageURL:{transform:d,options:p},format:n.RGBAFormat,viaAjax:!0},void 0,void 0,(function(t){var i,n;l.emit("textureLoading",t,e,u),(null===(i=l.pendingTextureTask)||void 0===i?void 0:i.hash)===b&&(null===(n=l.panoMeshes[e])||void 0===n||n.setProgress(t))}),this.renderer):this.textureLoader.loadCubeTexture(f,{imageURL:{transform:d,options:p},format:n.RGBAFormat,viaAjax:!0,preInit:!0},void 0,void 0,(function(t){var i,n;l.emit("textureLoading",t,e,u),(null===(i=l.pendingTextureTask)||void 0===i?void 0:i.hash)===b&&(null===(n=l.panoMeshes[e])||void 0===n||n.setProgress(t))}),this.renderer),v?this.tileLevelForFov&&y&&y.length?this.textureLoader.loadTiledCubeTexture(v,y,{tileImageSize:256,tileMaxLevel:this.TILED_CUBE_TEXTURE_LEVEL,imageURL:{transform:m,options:g}},void 0,void 0,void 0,this.renderer).catch((function(){return null})):this.textureLoader.loadCubeTexture(v,{imageURL:{transform:m,options:g},preInit:!0},void 0,void 0,void 0,this.renderer).catch((function(){return null})):Promise.resolve(null)]).then((function(t){var i,n,r=t[0],o=t[1];(null===(i=l.pendingTextureTask)||void 0===i?void 0:i.hash)===b?(l.pendingTextureTask.onLoad(r,o),null===(n=l.panoMeshes[e])||void 0===n||n.setProgress(0),delete l.pendingTextureTask,l.emit("textureLoaded",e,u,r.meta)):(r.body.dispose(),null==o||o.body.dispose())})).catch((function(t){var i,n;(null===(i=l.pendingTextureTask)||void 0===i?void 0:i.hash)===b&&(l.pendingTextureTask.onError(t),null===(n=l.panoMeshes[e])||void 0===n||n.setProgress(0),delete l.pendingTextureTask,l.emit("textureError",t,e,u),l.emit("error",t))})),this.emit("textureStartLoad",e,u)}},t.prototype.initAnimation=function(e,t,i,n){var r,o,s,a=this;if(!this.destroyed){var l=!1;this.pending=!1,this.userAction=n,this.moveToPano(e,{longitude:null!==(r=t.longitude)&&void 0!==r?r:this.defaultLongitude,latitude:Er(null!==(o=t.latitude)&&void 0!==o?o:this.defaultLatitude,this.minLatitude,this.maxLatitude),fov:Er(null!==(s=t.fov)&&void 0!==s?s:this.defaultFov,this.minFov,this.maxFov),duration:i,moveStartCallback:function(e,t){l=!0,a.emit("initAnimationWillStart",e,t,a.userAction)},moveEndCallback:function(e,t){a.emit("initAnimationEnded",e,t,a.userAction),a.initAnimationed=!0},moveCancelCallback:function(){var e={longitude:a.camera.pose.longitude,latitude:a.camera.pose.latitude,fov:a.camera.pose.fov,offset:a.camera.pose.offset.clone(),distance:a.camera.pose.distance};!1===l&&a.emit("initAnimationWillStart",a.currentPanoIndex,e,a.userAction),a.emit("initAnimationEnded",a.currentPanoIndex,e,a.userAction),a.initAnimationed=!0}},n)}},t.prototype.panoResourceFromLocationMotionKeyframe=function(e){return this.panoResources[e.key]},t.prototype.locationMotionKeyframesLength=function(e){for(var t=0,i=1;i<e.length;i++){var n=this.panoResourceFromLocationMotionKeyframe(e[i-1]).position,r=this.panoResourceFromLocationMotionKeyframe(e[i]).position;t+=n.distanceTo(r)*(e[i].value.count-e[i-1].value.count)}return t},t.prototype.updatePanoMeshes=function(e){var t=this;void 0===e&&(e=!0);for(var i={},r=0,o=this.panoMeshes;r<o.length;r++){i[(A=o[r]).name]=A}this.panoMeshes.length=0;for(var s=1,a={},l=function(e){if(e.accessibleNodes.length){var i=Go(e.accessibleNodes,(function(i){return Er(t.work.observers[i].standingPosition.distanceTo(e.standingPosition),1,1/0)}),!0),n=i[1];void 0===a[e.panoIndex]&&(a[e.panoIndex]=n)}},u=0,c=this.work.observers;u<c.length;u++){l(f=c[u])}var h=Object.keys(a).map((function(e){return a[e]}));h.length&&(s=Er(.6*(h.reduce((function(e,t){return e+t}),0)/h.length),1,3));for(var d=0;d<this.work.observers.length;d++){var p="panoCircle_".concat(this.work.workCode,"_").concat(d),f=this.work.observers[d],A=void 0;if(i[p]?(!0===(A=i[p]).loading&&!1===f.loadable&&A.setLoading(!1),delete i[p]):((A=this.panoCircleMeshCreator(d)).name=p,this.helper.add(A)),A.scale.set(s,1,s),A.position.copy(f.standingPosition),e&&this.model.loaded&&this.model.bvhs.loaded&&this.work.observers.length<50){var m=new n.Vector3(0,-1,0),g=new n.Vector3(0,.1,0).add(A.position),v=new n.Raycaster(g,m,0,.2),y=this.model.intersectRaycaster(v)[0];y&&y.point.distanceTo(g)<.1&&A.position.copy(y.point)}this.panoMeshes[d]=A}for(var b=0,x=Object.keys(i);b<x.length;b++){var w=x[b];this.helper.remove(i[w]),i[w].dispose(),delete i[w]}},t.prototype.doMoveToPano=function(e,t,i,r){var o,s,a,l=this;void 0===i&&(i={}),this.userAction=r;var u=Ue(),c=rr();this.tiling.cleanup(),this.panoResources[c]=t;var h,d,p;if(this.locationMotion.ended){var f=this.locationMotion.getKeyFrameSegment(u);f[0];var A=f[1],m=this.locationMotion.value,g=this.panoResourceFromLocationMotionKeyframe(A).position,v=t.position;h=Math.max(g.distanceTo(v),1),d=[{key:A.key,progress:0,value:Fe(Fe({},m),{count:0})},{key:c,progress:1,value:{distance:0,perspToOrtho:0,orthoDistance:1,modelAlpha:0,count:1}}],p=0}else{var y=this.locationMotion.getKeyFrameSegment(u),b=y[0],x=(A=y[1],m=this.locationMotion.value,this.panoResourceFromLocationMotionKeyframe(b).position),w=(g=this.panoResourceFromLocationMotionKeyframe(A).position,v=t.position,A.value.count-m.count),E=Math.max(x.distanceTo(g),1)*w;h=E+Math.max(g.distanceTo(v),1),d=[{key:b.key,progress:0,value:Fe({},m)},{key:A.key,progress:E/h,value:A.value},{key:c,progress:1,value:{count:A.value.count+1,distance:0,perspToOrtho:0,orthoDistance:1,modelAlpha:0}}];var M=this.locationMotionKeyframesLength(this.locationMotion.keyframes),S=this.locationMotionKeyframesLength(d);p=0===M||0===M?0:this.locationMotion.getProgressVelocity(u)*M/S}var C=this.calculateMovingDuration(i.duration,"fade"===i.effect||"montage"===i.effect?0:h),I={longitude:i.longitude,latitude:i.latitude,fov:i.fov},B={longitude:null!==(o=I.longitude)&&void 0!==o?o:this.camera.pose.longitude,latitude:null!==(s=I.latitude)&&void 0!==s?s:this.camera.pose.latitude,fov:null!==(a=I.fov)&&void 0!==a?a:this.camera.pose.fov,offset:t.position.clone(),distance:this.camera.pose.distance};this.emit("moveToPano",e,r),i.moveStartCallback&&i.moveStartCallback(e,B),this.emit("panoWillArrive",e,B,this.userAction),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=qe,this.videoTexture.needsUpdate=!0),this.panoVideo.setMaterial(null),this.cameraMotion.set(I,C).catch(qe),this.locationMotion.setKeyframes(d,C,p).then((function(){var t,o,s,a={longitude:l.camera.pose.longitude,latitude:l.camera.pose.latitude,fov:l.camera.pose.fov,offset:l.camera.pose.offset.clone(),distance:l.camera.pose.distance};i.moveEndCallback&&i.moveEndCallback(e,a),l.emit("panoArrived",e,a,r);var u=l.work.observers[l.currentPanoIndex];if(u&&u.video&&l.videoTexture&&l.videoTexture.image instanceof HTMLVideoElement){var c=Ns.clone().multiply(null!==(s=null===(o=null===(t=l.model.getMaterial())||void 0===t?void 0:t.pano1)||void 0===o?void 0:o.matrix)&&void 0!==s?s:new n.Matrix4).multiply(u.video.matrix),h={map:l.videoTexture,size:u.video.size,matrix:c,alpha:1},d=rr(),p=l.videoTexture.image;p.setAttribute("uuid",d),gs().then((function(e){e&&u.video&&p.getAttribute("uuid")===d&&(p.oncanplay=function(){p.oncanplay=qe,p.play()},p.ontimeupdate=function(){p.currentTime>.5&&(p.ontimeupdate=qe,l.panoVideo.setMaterial(h))},p.src=u.video.source)})).catch((function(){p.removeAttribute("uuid")}))}}),(function(){i.moveCancelCallback&&i.moveCancelCallback(),l.emit("moveToPanoCanceled",e)}))},t.prototype.getForwardPanoIndexOrNot=function(e){var t=this,i=this.work.observers[this.currentPanoIndex];if(!i)return null;var r=null!=e?e:new n.Raycaster(this.camera.position.clone(),this.camera.getWorldDirection(new n.Vector3)),o=new n.Vector3,s=this.model.intersectRaycaster(new n.Raycaster(r.ray.origin,new n.Vector3(0,-1,0)))[0];s&&s.distance<=2?o.copy(s.point):o.copy(r.ray.origin).add(new n.Vector3(0,-1.5,0));var a=this.model.intersectRaycaster(r)[0],l=(a?a.point:r.ray.origin.clone().add(r.ray.direction.clone().normalize().multiplyScalar(3))).clone().sub(o).normalize();if(0===l.length())return null;for(var u=i.accessibleNodes.filter((function(e){if(e===t.currentPanoIndex)return!1;var i=t.work.observers[e],n=i.standingPosition.clone().project(t.camera);return!(Math.abs(n.z)>1)&&(!(Math.abs(n.x)>1)&&(!(Math.abs(n.y)>1)&&(i.loadable||i.active)))})),c=u.slice().sort((function(e,i){return t.work.observers[e].standingPosition.clone().distanceTo(o)-t.work.observers[i].standingPosition.clone().distanceTo(o)})),h=0,d=[Math.PI/8,Math.PI/6,Math.PI/4,Math.PI/3];h<d.length;h++)for(var p=d[h],f=0,A=c;f<A.length;f++){var m=A[f],g=this.work.observers[m].standingPosition.clone().sub(o);if(0!==g.length()&&l.angleTo(g)<p)return m}return null},t.prototype.onTapGesture=function(e){var t=this,i=e.pointers.map((function(e){return Tt(e,["x","y"])}));if(!this.emit("wantsGesture","tap",i,!0)){var r=this.relativeClientPosition(e.center),o=new n.Raycaster;if(o.setFromCamera(r,this.camera),!this.emit("wantsTapGesture",o,r,!0)){this.emit("gesture","tap",i,!0),this.emit("tapGesture",o,r,!0),this.interiaMovement=!1;var s=this.camera.getWorldDirection(new n.Vector3).setY(0),a=null,l=this.work.observers[this.currentPanoIndex];if(l){var u=l.accessibleNodes.filter((function(e){if(e===t.currentPanoIndex)return!1;var i=t.work.observers[e];return!(i.position.distanceTo(t.camera.position)>t.maxAccessibleDistance)&&(i.loadable||i.active)})),c=this.model.intersectRaycaster(o)[0];if(c){var h=Go(u,(function(e){return t.work.observers[e].standingPosition.clone().distanceTo(c.point)}),!0),d=h[0];h[1]<this.panoTapTriggerRadius&&(a=d)}vr(a)&&(a=this.getForwardPanoIndexOrNot(o));for(var p=0,f=this.locationMotion.keyframes;p<f.length;p++){var A=f[p],m=this.panoResourceFromLocationMotionKeyframe(A);if(!(A.progress<this.locationMotion.progress)&&m.panoIndex===a){a=null;break}}if(this.emit("panoSelected",a),vr(a))!0===this.locationMotion.ended&&this.cameraBounce();else{var g=this.work.observers[a];if(g.active){for(var v={},y=Math.PI/6,b=Math.PI/12,x=g.position.clone().setY(0).sub(l.position.clone().setY(0)).normalize(),w=[],E=0,M=g.accessibleNodes;E<M.length;E++){if((d=M[E])!==this.currentPanoIndex&&d!==a){var S=this.work.observers[d].position.clone().sub(g.position).setY(0);x.angleTo(S)<y&&w.push(S)}}var C=(w.length>0?w:Oe(Oe([],[],!0),[],!0)).slice().sort((function(e,t){return e.angleTo(x)-t.angleTo(x)}))[0];C&&C.angleTo(s)>b&&(v.longitude=Math.atan2(-C.x,-C.z)),this.cameraMotion.value.latitude<-Math.PI/4&&(v.latitude=Er(0,this.minLatitude,this.maxLatitude)),this.cameraMotion.value.fov<60&&(v.fov=this.defaultFov),this.emit("wantsMoveToPano",a,v,!0)}else this.panoMeshes[a]&&(this.panoMeshes[a].setDisabled(!1),this.panoMeshes[a].setLoading(!0))}}}}},t}(ms),qs=Math.PI/180,zs=180/Math.PI,Us=function(){var e="undefined"!=typeof navigator&&/iPad|iPhone|iPod/.test(navigator.platform);return function(){return e}}(),js=function(){var e="undefined"!=typeof navigator&&/^((?!chrome|android).)*safari/i.test(navigator.userAgent);return function(){return e}}(),Ks=function(){var e="undefined"!=typeof navigator&&-1!==navigator.userAgent.indexOf("Firefox")&&-1!==navigator.userAgent.indexOf("Android");return function(){return e}}(),Gs=function(){var e="undefined"!=typeof navigator?navigator.userAgent.match(/.*Chrome\/([0-9]+)/):null,t=e?parseInt(e[1],10):null;return function(){return t}}(),_s=function(){var e=!1;if(65===Gs()){var t="undefined"!=typeof navigator?navigator.userAgent.match(/.*Chrome\/([0-9\.]*)/):null;if(t){var i=t[1].split(".");i[0],i[1];var n=i[2],r=i[3];e=3325===parseInt(n,10)&&parseInt(r,10)<148}}return function(){return e}}(),Ws=function(){var e=Us()&&js()&&"undefined"!=typeof navigator&&-1!==navigator.userAgent.indexOf("13_4");return function(){return e}}(),Xs=function(){var e="undefined"!=typeof navigator&&-1!==navigator.userAgent.indexOf("R7 Build");return function(){return e}}();function Ys(){var e="undefined"!=typeof window&&(90==window.orientation||-90==window.orientation);return Xs()?!e:e}var Zs,Js=(Zs={},function(e,t){void 0===Zs[e]&&(console.warn("cardboard: "+t),Zs[e]=!0)});function $s(e){var t,i=e.indexOf("://");t=-1!==i?i+3:0;var n=e.indexOf("/",t);return-1===n&&(n=e.length),e.substring(0,n)}var ea,ta=function(e,t,i){var n,r,o,s,a,l,u,c,h,d,p,f,A,m,g,v,y,b,x,w,E,M,S,C,I,B,T,P,R,D,L;!function(e,t,i){var n=t?t[0]:0,r=t?t[1]:0,o=t?t[2]:0,s=t?t[3]:1,a=n+n,l=r+r,u=o+o,c=n*a,h=n*l,d=n*u,p=r*l,f=r*u,A=o*u,m=s*a,g=s*l,v=s*u;e[0]=1-(p+A),e[1]=h+v,e[2]=d-g,e[3]=0,e[4]=h-v,e[5]=1-(c+A),e[6]=f+m,e[7]=0,e[8]=d+g,e[9]=f-m,e[10]=1-(c+p),e[11]=0,e[12]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+a*I)*L,n[14]=(v*w-g*M-y*x)*L,n[15]=(p*M-f*w+A*x)*L)},ia=function(){function e(e,t){void 0===e&&(e=new n.Vector3),void 0===t&&(t=0),this.sample=e,this.timestampS=t}return e.prototype.set=function(e,t){this.sample=e,this.timestampS=t},e.prototype.copy=function(e){this.set(e.sample,e.timestampS)},e}(),na=function(){function e(e,t){this.kFilter=e,this.isDebug=t,this.currentAccelMeasurement=new ia,this.currentGyroMeasurement=new ia,this.previousGyroMeasurement=new ia,Us()?this.filterQ=new n.Quaternion(-1,0,0,1):this.filterQ=new n.Quaternion(1,0,0,1),this.previousFilterQ=new n.Quaternion,this.previousFilterQ.copy(this.filterQ),this.accelQ=new n.Quaternion,this.isOrientationInitialized=!1,this.estimatedGravity=new n.Vector3,this.measuredGravity=new n.Vector3,this.gyroIntegralQ=new n.Quaternion}return e.prototype.addAccelMeasurement=function(e,t){this.currentAccelMeasurement.set(e,t)},e.prototype.addGyroMeasurement=function(e,t){this.currentGyroMeasurement.set(e,t);var i,n=t-this.previousGyroMeasurement.timestampS;i=n,isNaN(i)||i<=.001||i>1||this.run_(),this.previousGyroMeasurement.copy(this.currentGyroMeasurement)},e.prototype.getOrientation=function(){return this.filterQ},e.prototype.run_=function(){if(!this.isOrientationInitialized)return this.accelQ=this.accelToQuaternion_(this.currentAccelMeasurement.sample),this.previousFilterQ.copy(this.accelQ),void(this.isOrientationInitialized=!0);var e=this.currentGyroMeasurement.timestampS-this.previousGyroMeasurement.timestampS,t=this.gyroToQuaternionDelta_(this.currentGyroMeasurement.sample,e);this.gyroIntegralQ.multiply(t),this.filterQ.copy(this.previousFilterQ),this.filterQ.multiply(t);var i=new n.Quaternion;i.copy(this.filterQ),i.inverse(),this.estimatedGravity.set(0,0,-1),this.estimatedGravity.applyQuaternion(i),this.estimatedGravity.normalize(),this.measuredGravity.copy(this.currentAccelMeasurement.sample),this.measuredGravity.normalize();var r,o=new n.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)",zs*((r=o).w>1?0:2*Math.acos(r.w)),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 n.Quaternion;s.copy(this.filterQ),s.multiply(o),this.filterQ.slerp(s,1-this.kFilter),this.previousFilterQ.copy(this.filterQ)},e.prototype.accelToQuaternion_=function(e){var t=new n.Vector3;t.copy(e),t.normalize();var i=new n.Quaternion;return i.setFromUnitVectors(new n.Vector3(0,0,-1),t),i.inverse(),i},e.prototype.gyroToQuaternionDelta_=function(e,t){var i=new n.Quaternion,r=new n.Vector3;return r.copy(e),r.normalize(),i.setFromAxisAngle(r,e.length()*t),i},e}(),ra=function(){function e(e,t){this.predictionTimeS=e,this.isDebug=t,this.previousQ=new n.Quaternion,this.previousTimestampS=null,this.deltaQ=new n.Quaternion,this.outQ=new n.Quaternion}return e.prototype.getPrediction=function(e,t,i){if(!this.previousTimestampS)return this.previousQ.copy(e),this.previousTimestampS=i,e;var r=new n.Vector3;r.copy(t),r.normalize();var o=t.length();if(o<20*qs)return this.isDebug&&console.log("Moving slowly, at %s deg/s: no prediction",(zs*o).toFixed(1)),this.outQ.copy(e),this.previousQ.copy(e),this.outQ;var s=o*this.predictionTimeS;return this.deltaQ.setFromAxisAngle(r,s),this.outQ.copy(this.previousQ),this.outQ.multiply(this.deltaQ),this.previousQ.copy(e),this.previousTimestampS=i,this.outQ},e}(),oa=function(){function e(e){this.coefficients=e}return e.prototype.distortInverse=function(e){for(var t=0,i=1,n=e-this.distort(t);Math.abs(i-t)>1e-4;){var r=e-this.distort(i),o=i-r*((i-t)/(r-n));t=i,i=o,n=r}return i},e.prototype.distort=function(e){for(var t=e*e,i=0,n=0;n<this.coefficients.length;n++)i=t*(i+this.coefficients[n]);return(i+1)*e},e}(),sa=function(){this.angularAcceleration=null,this.angularVelocity=null,this.linearAcceleration=null,this.linearVelocity=null,this.orientation=null,this.position=null},aa=function(){this.leftDegrees=0,this.rightDegrees=0,this.upDegrees=0,this.downDegrees=0},la=function(){function e(e,t,i,r){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=i,this.accelerometer=new n.Vector3,this.gyroscope=new n.Vector3,this.filter=new na(e,r),this.posePredictor=new ra(t,r),this.isFirefoxAndroid=Ks(),this.isIOS=Us();var o=Gs();this.isDeviceMotionInRadians=!this.isIOS&&null!==o&&o<66,this.isWithoutDeviceMotion=_s()||Ws(),this.filterToWorldQ=new n.Quaternion,Us()?this.filterToWorldQ.setFromAxisAngle(new n.Vector3(1,0,0),Math.PI/2):this.filterToWorldQ.setFromAxisAngle(new n.Vector3(1,0,0),-Math.PI/2),this.inverseWorldToScreenQ=new n.Quaternion,this.worldToScreenQ=new n.Quaternion,this.originalPoseAdjustQ=new n.Quaternion;var s="undefined"!=typeof window?-window.orientation*Math.PI/180:0;this.originalPoseAdjustQ.setFromAxisAngle(new n.Vector3(0,0,1),s),this.setScreenTransform_(),Ys()&&this.filterToWorldQ.multiply(this.inverseWorldToScreenQ),this.resetQ=new n.Quaternion,this.orientationOut_=new Float32Array(4),this.previousTimestampS=Date.now()}return e.prototype.getPosition=function(){return null},e.prototype.getOrientation=function(){var e;if(this.isWithoutDeviceMotion&&this._deviceOrientationQ){this.deviceOrientationFixQ=this.deviceOrientationFixQ||function(){var e=(new n.Quaternion).setFromAxisAngle(new n.Vector3(0,0,-1),0),t=new n.Quaternion;return"undefined"!=typeof window&&-90===window.orientation?t.setFromAxisAngle(new n.Vector3(0,1,0),Math.PI/-2):t.setFromAxisAngle(new n.Vector3(0,1,0),Math.PI/2),e.multiply(t)}(),this.deviceOrientationFilterToWorldQ=this.deviceOrientationFilterToWorldQ||((i=new n.Quaternion).setFromAxisAngle(new n.Vector3(1,0,0),-Math.PI/2),i),e=this._deviceOrientationQ;var t=new n.Quaternion;return t.copy(e),t.multiply(this.deviceOrientationFilterToWorldQ),t.multiply(this.resetQ),t.multiply(this.worldToScreenQ),t.multiplyQuaternions(this.deviceOrientationFixQ,t),this.yawOnly&&(t.x=0,t.z=0,t.normalize()),this.orientationOut_[0]=t.x,this.orientationOut_[1]=t.y,this.orientationOut_[2]=t.z,this.orientationOut_[3]=t.w,this.orientationOut_}var i,r=this.filter.getOrientation();e=this.posePredictor.getPrediction(r,this.gyroscope,this.previousTimestampS);var o=new n.Quaternion;return o.copy(this.filterToWorldQ),o.multiply(this.resetQ),o.multiply(e),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_},e.prototype.getPose=function(){var e=new sa;return e.orientation=this.getOrientation(),e},e.prototype.resetPose=function(){this.resetQ.copy(this.filter.getOrientation()),this.resetQ.x=0,this.resetQ.y=0,this.resetQ.z*=-1,this.resetQ.normalize(),Ys()&&this.resetQ.multiply(this.inverseWorldToScreenQ),this.resetQ.multiply(this.originalPoseAdjustQ)},e.prototype.getFrameData=function(e){var t=this.getOrientation(),i=this.getEyeOffset(),n=this.getEyeProjectionMatrix();return e.pose.angularAcceleration=null,e.pose.angularVelocity=null,e.pose.linearAcceleration=null,e.pose.linearVelocity=null,e.pose.orientation=t,e.pose.position=null,e.timestamp=this.previousTimestampS,e.leftProjectionMatrix.set(n.left),e.rightProjectionMatrix.set(n.right),ta(e.leftViewMatrix,t,i.left),ta(e.rightViewMatrix,t,i.right),e},e.prototype.start=function(){if("undefined"==typeof window)return function(){};var e=this.onDeviceMotion_.bind(this),t=this.onOrientationChange_.bind(this),i=this.onMessage_.bind(this),n=this.onDeviceOrientation_.bind(this);return Us()&&function(){if("undefined"==typeof window)return!1;if("undefined"==typeof document)return!1;var e=window.self!==window.top,t=$s(document.referrer),i=$s(window.location.href);return e&&t!==i}()&&window.addEventListener("message",i),window.addEventListener("orientationchange",t),this.isWithoutDeviceMotion?window.addEventListener("deviceorientation",n):window.addEventListener("devicemotion",e),function(){window.removeEventListener("devicemotion",e),window.removeEventListener("deviceorientation",t),window.removeEventListener("orientationchange",t),window.removeEventListener("message",i)}},e.prototype.getEyeOffset=function(){return{left:[.5*-this.viewer.interLensDistance,0,0],right:[.5*this.viewer.interLensDistance,0,0]}},e.prototype.getEyeProjectionMatrix=function(){var e=this.getEyeFieldOfView(),t=this.depthNear,i=this.depthFar,n={left:[],right:[]},r=e.left.upDegrees*qs,o=e.left.downDegrees*qs,s=2/((l=e.left.leftDegrees*qs)+(u=e.left.rightDegrees*qs)),a=2/(r+o);n.left[0]=s,n.left[1]=0,n.left[2]=0,n.left[3]=0,n.left[4]=0,n.left[5]=a,n.left[6]=0,n.left[7]=0,n.left[8]=-(l-u)*s*.5,n.left[9]=(r-o)*a*.5,n.left[10]=i/(t-i),n.left[11]=-1,n.left[12]=0,n.left[13]=0,n.left[14]=i*t/(t-i),n.left[15]=0;var l,u;r=e.right.upDegrees*qs,o=e.right.downDegrees*qs,s=2/((l=e.right.leftDegrees*qs)+(u=e.right.rightDegrees*qs)),a=2/(r+o);return n.right[0]=s,n.right[1]=0,n.right[2]=0,n.right[3]=0,n.right[4]=0,n.right[5]=a,n.right[6]=0,n.right[7]=0,n.right[8]=-(l-u)*s*.5,n.right[9]=(r-o)*a*.5,n.right[10]=i/(t-i),n.right[11]=-1,n.right[12]=0,n.right[13]=0,n.right[14]=i*t/(t-i),n.right[15]=0,n},e.prototype.getEyeFieldOfView=function(){var e=this.viewer,t=this.device,i=new oa(e.distortionCoefficients),n=e.screenLensDistance,r=(t.widthMeters-e.interLensDistance)/2,o=e.interLensDistance/2,s=e.baselineLensDistance-t.bevelMeters,a=t.heightMeters-s,l=zs*Math.atan(i.distort(r/n)),u=zs*Math.atan(i.distort(o/n)),c=zs*Math.atan(i.distort(s/n)),h=zs*Math.atan(i.distort(a/n)),d=new aa,p=new aa;return d.leftDegrees=Math.min(l,e.fov),d.rightDegrees=Math.min(u,e.fov),d.downDegrees=Math.min(c,e.fov),d.upDegrees=Math.min(h,e.fov),p.leftDegrees=d.rightDegrees,p.rightDegrees=d.leftDegrees,p.upDegrees=d.upDegrees,p.downDegrees=d.downDegrees,{left:d,right:p}},e.prototype.onDeviceOrientation_=function(e){this._deviceOrientationQ=this._deviceOrientationQ||new n.Quaternion;var t=e.alpha,i=e.beta,r=e.gamma;t=(t||0)*Math.PI/180,i=(i||0)*Math.PI/180,r=(r||0)*Math.PI/180,this._deviceOrientationQ.setFromEuler(new n.Euler(t,i,-r,"YXZ"))},e.prototype.onDeviceMotion_=function(e){this.updateDeviceMotion_(e)},e.prototype.updateDeviceMotion_=function(e){var t=e.accelerationIncludingGravity,i=e.rotationRate,n=e.timeStamp/1e3,r=n-this.previousTimestampS;return r<0?(Js("fusion-pose-sensor:invalid:non-monotonic","Invalid timestamps detected: non-monotonic timestamp from devicemotion"),void(this.previousTimestampS=n)):r<=.001||r>1?(Js("fusion-pose-sensor:invalid:outside-threshold","Invalid timestamps detected: Timestamp from devicemotion outside expected range."),void(this.previousTimestampS=n)):(t&&(this.accelerometer.set(-t.x,-t.y,-t.z),i&&(Xs()?this.gyroscope.set(-i.beta,i.alpha,i.gamma):this.gyroscope.set(i.alpha,i.beta,i.gamma),this.isDeviceMotionInRadians||this.gyroscope.multiplyScalar(Math.PI/180),this.filter.addGyroMeasurement(this.gyroscope,n)),this.filter.addAccelMeasurement(this.accelerometer,n)),void(this.previousTimestampS=n))},e.prototype.onOrientationChange_=function(){this.setScreenTransform_()},e.prototype.onMessage_=function(e){var t=e.data;t&&t.type&&("devicemotion"===t.type.toLowerCase()&&this.updateDeviceMotion_(t.deviceMotionEvent))},e.prototype.setScreenTransform_=function(){switch(this.worldToScreenQ.set(0,0,0,1),"undefined"!=typeof window?window.orientation:0){case 0:break;case 90:this.worldToScreenQ.setFromAxisAngle(new n.Vector3(0,0,1),-Math.PI/2);break;case-90:this.worldToScreenQ.setFromAxisAngle(new n.Vector3(0,0,1),Math.PI/2)}this.inverseWorldToScreenQ.copy(this.worldToScreenQ),this.inverseWorldToScreenQ.inverse()},e}(),ua=[0,0,.5,1],ca=[.5,0,.5,1],ha=function(){function e(e){var t=this;this.renderer=e,this.sensor=new la(.98,.04,!1,!1),this.scale=1,this.cameraL=new n.PerspectiveCamera,this.cameraR=new n.PerspectiveCamera;var i=this.sensor.start();this.dispose=function(){var e=t.renderer.getSize(new n.Vector2);t.renderer.setScissor(0,0,e.width,e.height),t.renderer.setViewport(0,0,e.width,e.height),t.renderer.setScissorTest(!1),i()}}return e.prototype.render=function(e,t){var i=this.renderer.getSize(new n.Vector2);if(i.width>i.height){var r=e.autoUpdate;r&&(e.updateMatrixWorld(),e.autoUpdate=!1);var o={x:Math.round(i.width*ua[0]),y:Math.round(i.height*ua[1]),width:Math.round(i.width*ua[2]),height:Math.round(i.height*ua[3])},s={x:Math.round(i.width*ca[0]),y:Math.round(i.height*ca[1]),width:Math.round(i.width*ca[2]),height:Math.round(i.height*ca[3])};this.renderer.setScissorTest(!0),this.renderer.autoClear&&this.renderer.clear(),null===t.parent&&t.updateMatrixWorld(),t.matrixWorld.decompose(this.cameraL.position,this.cameraL.quaternion,this.cameraL.scale),t.matrixWorld.decompose(this.cameraR.position,this.cameraR.quaternion,this.cameraR.scale);var a=this.sensor.getEyeOffset();this.cameraL.translateOnAxis((new n.Vector3).fromArray(a.left),this.scale),this.cameraR.translateOnAxis((new n.Vector3).fromArray(a.right),this.scale);var l=this.sensor.getEyeProjectionMatrix();this.cameraL.projectionMatrix.elements=l.left.slice(),this.cameraR.projectionMatrix.elements=l.right.slice(),this.renderer.setViewport(o.x,o.y,o.width,o.height),this.renderer.setScissor(o.x,o.y,o.width,o.height),this.renderer.render(e,this.cameraL),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(e,this.cameraR),this.renderer.setViewport(0,0,i.width,i.height),this.renderer.setScissor(0,0,i.width,i.height),this.renderer.setScissorTest(!1),r&&(e.autoUpdate=!0)}else this.renderer.render(e,t)},e.prototype.dispose=function(){},e}(),da={zh:{TITLE:"眼镜模式",HIT:"请将手机横屏放入 VR 眼镜中"},en:{TITLE:"GLASSES MODE",HIT:"Please put the mobile phone horizontally into the VR glasses."},ja:{TITLE:"メガネモード",HIT:"携帯電話をVRメガネに水平に入れてください。"}},pa="undefined"!=typeof navigator&&null!==(ea=da[navigator.language.split("-")[0]])&&void 0!==ea?ea:da.zh,fa="\n<style>\n.$id {\n all: initial;\n position: absolute;\n overflow: hidden;\n display: none;\n -webkit-tap-highlight-color: rgba(0, 0, 0, 0);\n}\n.$id-modal {\n width: 100%;\n height: 332px;\n position: absolute;\n bottom: -2px;\n left: 0;\n right: 0;\n overflow: hidden;\n pointer-events: none;\n will-change: transform;\n animation: $id-modal-fade-in 0.3s ease 1;\n}\n.$id-modal-bg {\n background: rgba(0, 0, 0, 0.75);\n position: absolute;\n bottom: 0;\n left: 0;\n right: 0;\n top: 0;\n}\n.$id-modal-bg-line {\n height: 1px;\n background-image: linear-gradient(\n 85deg,\n rgba(162, 177, 255, 0.3) 1%,\n rgba(120, 126, 255, 0.8) 30%,\n rgba(147, 218, 255, 0.8) 66%,\n rgba(250, 255, 184, 0.3) 92%\n );\n}\n.$id-modal-bg-wave svg {\n width: 375px;\n height: 61px;\n display: block;\n}\n.$id-modal-content {\n color: #ffffff;\n padding: 0 14px;\n position: absolute;\n bottom: 0;\n left: 0;\n right: 0;\n top: 0;\n overflow: hidden;\n}\n.$id-modal-content-title {\n font-size: 17px;\n font-family: sans-serif;\n line-height: 18px;\n padding: 20px 0;\n font-weight: bold;\n}\n.$id-modal-content-hit {\n font-size: 14px;\n font-family: sans-serif;\n line-height: 24px;\n opacity: 0.85;\n}\n.$id-modal-content-guide {\n position: relative;\n width: 168px;\n height: 139px;\n margin: 36px auto 0;\n}\n.$id-modal-content-guide-cardboard {\n position: absolute;\n width: 100px;\n height: 82px;\n left: 68px;\n top: 57px;\n}\n.$id-modal-content-guide-cardboard-image {\n width: 100px;\n height: 82px;\n background-image: url(".concat("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASwAAADqCAMAAAAvZYhaAAAC/VBMVEUAAAD///99fX37+/v5+fn29vbx8fHv7+/Nzc3o6Ojq6urh4eHU1NTR0dGDg4Pl5eWSkpLHx8fj4+Pe3t7X19fAwMDZ2dnCwsKrq6uioqLb29uNjY2enp67u7t5eXmAgIC2traWlpa5ubnKysqmpqZycnKHh4eurq6ysrKKioqDg4Pd3d12dnb9/f1vb2/s7OxlZWXz8/OoqKiZmZlpaWmbm5teXl7W1tbJycnExMRiYmJsbGywsLCPj49aWlq9vb1UVFRYWFhra2t+fn7t7e1RUVFOTk6Dg4OAgICCgoKKioqEhISIiIhqamqCgoKIiIiQkJCIiIiWlpawsLBmZmaAgICenp6Li4uBgYGTk5OMjIyVlZWFhYWCgoKvr6+Ojo59fX2SkpKvr6+Ojo6QkJCurq6BgYGxsbF8fHx4eHitra2enp6srKyJiYmurq54eHj5+fl+fn57e3v////5+fnS0tLAwMCVlZWwsLCurq5QUFCtra2EhISUlJSwsLCUlJSUlJSlpaWVlZW3t7diYmLAwMCFhYV3d3f///+tra3///9XV1eampqnp6d8fHz///////9VVVVlZWVtbW3+/v5SUlKcnJytra28vLzGxsbR0dHX19doaGiWlpafn5/Hx8ezs7Nzc3Nubm7AwMCIiIjj4+NTU1P29vZbW1vl5eVkZGTMzMxYWFjq6upfX1/k5OT////4+PjV1dWkpKRoaGj4+Pizs7Pm5ubAwMCfn5+vr6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1GGjRJoCBdKinwB09B/DgIICHvELRIQ+RQYuHnqxdjI42ejMqVWpguUWPKNJHFKtKBZJBlD5YpucPh8c/aRLeeHSOK/vgFHzBak93bsgaY3ZIVUl+eQCgVdZPcTsE5RCJqs+/lSrSJUvrhFkBX+RkJdmBXCFr1bRA+drjpp52uS35fPPDWxYQnzFbuJo6zhPnIOt6g5s06QxEfN8PAPGytQUf0JbQRbK+x4YjlR9eDpg9dOdOFjEPv0hXiMgOoJXWe7rblnIbLuWms8mz+oX2kozqEOdrLC1hSpJWVjZB+HS1TSjbgDyWZALPmXXwhdNxOvhCWz20JVyluoIYQKiiyRhqNwG/RvLsiGdW18WI2chw2pEkpRWgLEUICk9V1zf6X56bMKMqz6s+s5QrpWuc2PIlQbBSogAO+XR1Ky6afvy0AuGKniXhPWIWI3U5vdRW4AcCkJArJN7d7SLtlx9VW8pXbdfN/6frfJPYUq58cqWivBpIlTrFRcJOObOe4SKx1Vsj20Cwjam01JODjiUpcbaE9jL4W9Hkla7tNgTI9XgxmtChiMie0F5G/930+vX6wOOsKvinKDlaFdrL4XOcipIACOpcxco820J7BfhsLH1F+jyUQxE2hvYqdEezo8lk8hQIavQFwiwN7ZV5Awa0+Mnh1nen/Z44BkLv9DljYHVorwbfgwGtf4iL2u+03weXYKJKi5pXE0J7FU5Bw8zz+N6Q0F4OD4EwvhWRJoX2UoZhUY9PZ2PYrNBewuAODLzDUMPjMQ8Kd6GIaMZaclxG8FfcIWsxGLkxGOzazl7AYKLn09idtd2qmP7ZiZsK24fHR20MLafPB6O2UTWAP1yGz7GpTmekAAAAAElFTkSuQmCC",");\n background-size: 100%;\n background-repeat: no-repeat;\n}\n.$id-modal-content-guide-phone {\n position: absolute;\n width: 58px;\n height: 56px;\n left: 0;\n top: 0;\n}\n.$id-modal-content-guide-phone-move-x {\n width: 100%;\n height: 100%;\n position: absolute;\n top: 0;\n left: 0;\n will-change: transform;\n animation: $id-guide-move-x 4s 0.5s infinite;\n}\n.$id-modal-content-guide-phone-move-y {\n width: 100%;\n height: 100%;\n position: absolute;\n top: 0;\n left: 0;\n will-change: transform;\n animation: $id-guide-move-y 4s cubic-bezier(0.42, 0, 0.23, 0.98) 0.5s infinite;\n}\n.$id-modal-content-guide-phone-blink {\n width: 100%;\n height: 100%;\n position: absolute;\n top: 0;\n left: 0;\n opacity: 0;\n will-change: opacity;\n animation: $id-guide-blink 4s 0.5s infinite;\n}\n.$id-modal-content-guide-phone-image {\n width: 58px;\n height: 56px;\n background-image: url(").concat("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAK4AAAClCAMAAADyFTYfAAAC+lBMVEUAAABISEhKSkpGRkZERERCQkJOTk45OTlBQUFQUFBSUlJUVFQ7OztYWFg/Pz8/Pz9aWlpkZGQ3NzdcXFxeXl5MTExHR0dhYWFJSUk9PT1WVlZMTEygoKBERERFRUVmZmZQUFA9PT1LS0tra2tPT09ubm5SUlI2NjZXV1czMzOpqalTU1O3t7dVVVVoaGhaWlpqamq1tbWhoaGenp6lpaWurq6ysrJZWVmjo6OgoKBUVFRdXV1cXFyvr6+0tLSwsLCrq6ubm5syMjKbm5twcHCQkJCLi4uGhobLy8uCgoJ9fX1ycnLPz894eHizs7NxcXFgYGCVlZWYmJh7e3umpqa3t7fOzs7JycnFxcWvr6+JiYl0dHRra2uSkpKNjY2IiIi4uLiUlJSsrKx3d3fDw8OHh4eQkJB9fX2dnZ2UlJR/f3++vr6RkZFzc3ODg4OioqKcnJyUlJSCgoJ4eHirq6u4uLh4eHiBgYF2dnaLi4uMjIyjo6OZmZm1tbWwsLCcnJyxsbF6enqAgICwsLC9vb26urqjo6OKioqsrKyWlpaoqKhbW1u2traCgoJ6enqZmZmbm5t+fn6JiYmgoKC0tLS4uLhmZma0tLSYmJhxcXF1dXWlpaWfn5+IiIicnJyzs7Ofn5+xsbGampq7u7vAwMCMjIxgYGChoaGgoKCQkJCOjo5vb2+RkZG1tbWOjo6Hh4d6enq1tbV8fHzGxsZubm5mZmanp6eZmZmvr6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mVckgFXML9YEEFLUKMvlqAp0eWyDEAL65dLqyWo6RekTZ2XNCsD6rgpTK/4p3WcrrPH1ghWJGhONC3JoGAkRHH1JKjpNEcCxOV2I8MWyiUJqNVajSVodgiWcVMVLVeSS1ATCZoc88qjVKlSc3kSLJ5c5V6rTZQAcVkGbBeuOkgCgq2CBM3MoFwGr1tvim2aMpZZqyBBc3N1UF2GX90j9SQJKCBB83OfYAcNVjFcSrvzo95WOShB83Ody5V24fqzO0nAUSzB/89Nph38VqmuOa3gticJOP9fApuHTDt4nFJ7AXdPC0lg8/gq8y5XapSrgpUgbQ0JpF5u97hS1fOC26nlJJA8Yd41Sg3fU4dtRQkKeXSN3jo4Qqm0397OmyZOGatoDrScBIWM3DFn5kXi1ZyqRSUoZtKOa1vWKArztqgEnhIHty4f9/btuEstKwGkxf+XuCT5CbTFnFRuxktuAAAAAElFTkSuQmCC",');\n background-size: 100%;\n background-repeat: no-repeat;\n}\n.$id-modal-close {\n position: absolute;\n top: 20px;\n right: 14px;\n width: 14px;\n height: 14px;\n}\n.$id-modal-close svg {\n width: 14px;\n height: 14px;\n display: block;\n}\n\n@keyframes $id-modal-fade-in {\n 0% { transform: translate3d(0, 100%, 0); opacity: 0.5; }\n 100% { transform: translate3d(0, 0, 0); opacity: 1; }\n}\n@keyframes $id-guide-blink {\n 0% { opacity: 0; }\n 7% { opacity: 0; }\n 12% { opacity: 1; }\n 29% { opacity: 1; }\n 34% { opacity: 0.3; }\n 39% { opacity: 1; }\n 44% { opacity: 0.3; }\n 49% { opacity: 1; }\n 80% { opacity: 1; }\n 100% { opacity: 0; }\n}\n@keyframes $id-guide-move-x {\n 0% { transform: translate3d(0, 0, 0); }\n 57% { transform: translate3d(0, 0, 0); }\n 80% { transform: translate3d(70px, 0, 0); }\n 100% { transform: translate3d(70px, 0, 0); }\n}\n@keyframes $id-guide-move-y {\n 0% { transform: translate3d(0, 0, 0); }\n 57% { transform: translate3d(0, 0, 0); }\n 80% { transform: translate3d(0, 58px, 0); }\n 100% { transform: translate3d(0, 58px, 0); }\n}\n@media screen and (orientation: portrait) {\n .$id {\n display: block;\n }\n}\n</style>\n<div class="$id-modal">\n <div class="$id-modal-bg">\n <div class="$id-modal-bg-line"></div>\n <div class="$id-modal-bg-wave">\n <svg width="375" height="61" viewBox="0 0 375 61" version="1.1" xmlns="http://www.w3.org/2000/svg">\n <defs>\n <linearGradient x1="0" y1="0%" x2="0" y2="100%" id="$id-2y6_dj_hgp">\n <stop stop-color="#8598FF" stop-opacity="0.15" offset="0%"></stop>\n <stop stop-color="#000" stop-opacity="0" offset="100%"></stop>\n </linearGradient>\n </defs>\n <path transform="translate(187.5, 30.5) scale(-1, 1) translate(-187.5, -30.5)" fill="url(#$id-2y6_dj_hgp)" d="\nM0,1\nC83.001,1.706 140.146,4.164 171.435,8.374\nC218.369,14.688 253.467,26.308 273.002,33\nC292.536,39.691323.501,51 343.709,56\nC357.182,59.333 367.612,61 375,61\nL375,0\nL0,0\nL0,1\nZ\n"></path>\n </svg>\n </div>\n </div>\n <div class="$id-modal-content">\n <div class="$id-modal-content-title">').concat(pa.TITLE,'</div>\n <div class="$id-modal-content-hit">').concat(pa.HIT,'</div>\n <div class="$id-modal-content-guide">\n <div class="$id-modal-content-guide-phone">\n <div class="$id-modal-content-guide-phone-move-x">\n <div class="$id-modal-content-guide-phone-move-y">\n <div class="$id-modal-content-guide-phone-blink">\n <div class="$id-modal-content-guide-phone-image"></div>\n </div>\n </div>\n </div>\n </div>\n <div class="$id-modal-content-guide-cardboard">\n <div class="$id-modal-content-guide-cardboard-image"></div>\n </div>\n </div>\n </div>\n <div class="$id-modal-close">\n <svg width="14" height="14" viewBox="0 0 14 14" version="1.1" xmlns="http://www.w3.org/2000/svg">\n <defs>\n <radialGradient cx="50%" cy="50%" fx="50%" fy="50%" r="70%" id="$id-ho0itsc4p9">\n <stop stop-color="#FFF" stop-opacity="0.75" offset="0%"></stop>\n <stop stop-color="#FFF" stop-opacity="0.22" offset="100%"></stop>\n </radialGradient>\n </defs>\n <path transform="translate(-3, -3)" fill="url(#$id-ho0itsc4p9)" fill-rule="nonzero" d="\nM16.791,3.198\nC17.044,3.438 17.067,3.814 16.860,4.080\nL16.791,4.156\nL12.144,9.331\nC11.803,9.711 11.803,10.288 12.144,10.668\nL16.791,15.843\nC17.044,16.084 17.067,16.460 16.860,16.725\nL16.791,16.801\nC16.538,17.042 16.142,17.063 15.864,16.867\nL15.784,16.801\nL10.000,11.250\nL4.215,16.801\nL4.135,16.867\nC3.857,17.063 3.461,17.042 3.208,16.801\nL3.208,16.801\nL3.139,16.725\nC2.932,16.460 2.955,16.084 3.208,15.843\nL3.208,15.843\nL7.855,10.668\nC8.196,10.288 8.196,9.711 7.855,9.331\nL7.855,9.331\nL3.208,4.156\nL3.139,4.080\nC2.932,3.814 2.955,3.438 3.208,3.198\nC3.486,2.933 3.937,2.933 4.215,3.198\nL4.215,3.198 L9.999,8.749\nL15.784,3.198\nC16.062,2.933 16.513,2.933 16.791,3.198\nZ\n"></path>\n </svg>\n </div>\n</div>\n');function Aa(e){for(var t=1,i=document.getElementsByTagName("meta"),n=0;n<i.length;n++){var r=i[n];if("viewport"===r.getAttribute("name")){var o=(r.getAttribute("content")||"").match(/initial\-scale\=([\d|\.]+)/);o&&(t=Number(o[1])),isNaN(t)&&(t=1)}}return fa.replace(/\n/g," ").replace(/\ +/g," ").replace(/\$id/g,e).replace(/(\d+)px/g,(function(e,i){return function(e){return Math.floor(e*t)+"px"}(Number(i))}))}var ma=new n.CircleBufferGeometry(.12,16),ga=function(){var e=Qr(),t=new n.Texture;return e.onload=function(){if("undefined"!=typeof document){var i=256,n=document.createElement("canvas");n.setAttribute("width",String(i)),n.setAttribute("height",String(i));var r=n.getContext("2d");if(r){r.drawImage(e,0,0,i,i),r.globalCompositeOperation="source-out";var o=128;r.beginPath(),r.lineWidth=6.4,r.arc(o,o,83.2,0,2*Math.PI),r.strokeStyle="rgba(255, 255, 255, 1.0)",r.closePath(),r.stroke(),t.image=n,t.needsUpdate=!0}}},e.src=jr,t}(),va=function(){if("undefined"!=typeof document){var e=document.createElement("canvas");e.setAttribute("width",String(512)),e.setAttribute("height",String(512));var t=e.getContext("2d");if(t){var i=256;return t.beginPath(),t.arc(i,i,192,0,2*Math.PI),t.fillStyle="rgba(255, 255, 255, 0.1)",t.closePath(),t.fill(),t.save(),t.beginPath(),t.arc(i,i,192,0,2*Math.PI),t.strokeStyle="rgba(255, 255, 255, 0.5)",t.lineWidth=10.24,t.closePath(),t.stroke(),new n.CanvasTexture(e)}}return null}(),ya=function(){if("undefined"!=typeof document){var e=512,t=document.createElement("canvas");t.setAttribute("width",String(e)),t.setAttribute("height",String(e));var i=t.getContext("2d");if(i){var r=256;i.arc(r,r,192,0,2*Math.PI),i.fillStyle="rgba(85, 90, 255, 0.6)",i.shadowBlur=25.6,i.shadowColor="rgba(255, 255, 255, 0.6)",i.fill(),i.arc(r,r,192,0,2*Math.PI);var o=i.createRadialGradient(r,r,0,r,r,r);o.addColorStop(0,"rgba(255, 255, 255, 0.0)"),o.addColorStop(.5,"rgba(255, 255, 255, 0.0)"),o.addColorStop(1,"rgba(255, 255, 255, 0.2)"),i.fillStyle=o,i.fill(),i.lineWidth=4.8,i.arc(r,r,187.2,0,2*Math.PI);var s=i.createLinearGradient(0,0,0,e);return s.addColorStop(.02,"rgba(255, 255, 255, 1.0)"),s.addColorStop(.2,"rgba(255, 255, 255, 0.0)"),s.addColorStop(.8,"rgba(255, 255, 255, 0.0)"),s.addColorStop(.98,"rgba(255, 255, 255, 1.0)"),i.strokeStyle=s,i.stroke(),new n.CanvasTexture(t)}}return null}(),ba=function(){if("undefined"!=typeof document){var e=512,t=document.createElement("canvas");t.setAttribute("width",String(e)),t.setAttribute("height",String(e));var i=t.getContext("2d");if(i){var r=256,o=179.2;i.arc(r,r,o,0,2*Math.PI),i.fillStyle="rgba(255, 255, 255, 0.4)",i.shadowBlur=25.6,i.shadowColor="rgba(255, 255, 255, 0.6)",i.fill(),i.arc(r,r,o,0,2*Math.PI);var s=i.createRadialGradient(r,r,0,r,r,r);s.addColorStop(0,"rgba(255, 255, 255, 0.0)"),s.addColorStop(.5,"rgba(255, 255, 255, 0.0)"),s.addColorStop(1,"rgba(255, 255, 255, 0.5)"),i.fillStyle=s,i.fill(),i.lineWidth=4.8,i.arc(r,r,o-4.8,0,2*Math.PI);var a=i.createLinearGradient(0,0,0,e);return a.addColorStop(.02,"rgba(255, 255, 255, 1.0)"),a.addColorStop(.2,"rgba(255, 255, 255, 0.0)"),a.addColorStop(.8,"rgba(255, 255, 255, 0.0)"),a.addColorStop(.98,"rgba(255, 255, 255, 1.0)"),i.strokeStyle=a,i.stroke(),new n.CanvasTexture(t)}}return null}(),xa=function(){if("undefined"!=typeof document){var e=512,t=document.createElement("canvas");t.setAttribute("width",String(e)),t.setAttribute("height",String(e));var i=t.getContext("2d");if(i){var r=256,o=217.6,s=64;i.lineWidth=s,i.arc(r,r,o,0,2*Math.PI),i.strokeStyle="rgba(147, 162, 255, 0.3)",i.shadowBlur=25.6,i.shadowColor="rgba(255, 255, 255, 0.6)",i.stroke(),i.lineWidth=s,i.arc(r,r,o,0,2*Math.PI);var a=i.createRadialGradient(r,r,185.6,r,r,249.6);a.addColorStop(0,"rgba(255, 255, 255, 0.5)"),a.addColorStop(.3,"rgba(255, 255, 255, 0.0)"),a.addColorStop(.7,"rgba(255, 255, 255, 0.0)"),a.addColorStop(1,"rgba(255, 255, 255, 0.5)"),i.strokeStyle=a,i.stroke(),i.beginPath(),i.lineWidth=4,i.arc(r,r,245.6,0,2*Math.PI);var l=i.createLinearGradient(0,0,e,0);return l.addColorStop(.02,"rgba(255, 255, 255, 1.0)"),l.addColorStop(.1,"rgba(255, 255, 255, 0.0)"),l.addColorStop(.9,"rgba(255, 255, 255, 0.0)"),l.addColorStop(.98,"rgba(255, 255, 255, 1.0)"),i.strokeStyle=l,i.stroke(),new n.CanvasTexture(t)}}return null}(),wa=function(e){function t(){var t=e.call(this)||this;t.progress=0,t.opacity=0,t.loading=!1,t.current=!1,t.disabled=!1,t.opacityMotion=new Ur({opacity:0}),t.loadingMotion=new Ur({opacity:0}),t.currentMotion=new Ur({ringScale:1.1,ringOpacity:0,circleFade:0,circleOpacity:.5,circleScale:1});var i={blending:n.CustomBlending,blendSrc:n.SrcAlphaFactor,blendDst:n.OneMinusSrcAlphaFactor,blendSrcAlpha:n.OneFactor,blendDstAlpha:n.OneMinusSrcAlphaFactor,depthWrite:!1,transparent:!0};return t.hitTestMesh=new n.Mesh(ma,new n.MeshBasicMaterial(Fe(Fe({},i),{color:0,opacity:0}))),t.hitTestMesh.scale.set(1.5,1.5,1.5),t.centerMesh=new n.Mesh(ma,new n.MeshBasicMaterial(Fe(Fe({},i),{map:ya,opacity:0}))),t.centerMesh2=new n.Mesh(ma,new n.MeshBasicMaterial(Fe(Fe({},i),{map:ba,opacity:0}))),t.ringMesh=new n.Mesh(ma,new n.MeshBasicMaterial(Fe(Fe({},i),{map:xa,opacity:0}))),t.loadingMesh=new n.Mesh(ma,new n.MeshBasicMaterial(Fe(Fe({},i),{map:ga,opacity:.8}))),t.disableMesh=new n.Mesh(ma,new n.MeshBasicMaterial(Fe(Fe({},i),{map:va}))),t.loadingMesh.visible=!1,t.disableMesh.visible=!1,t.hitTestMesh.position.z=0,t.ringMesh.position.z=.003,t.disableMesh.position.z=.002,t.centerMesh.position.z=.002,t.centerMesh2.position.z=.002,t.loadingMesh.position.z=.005,t.hitTestMesh.frustumCulled=!1,t.centerMesh.frustumCulled=!1,t.centerMesh2.frustumCulled=!1,t.ringMesh.frustumCulled=!1,t.loadingMesh.frustumCulled=!1,t.disableMesh.frustumCulled=!1,t.add(t.hitTestMesh),t.add(t.centerMesh),t.add(t.centerMesh2),t.add(t.ringMesh),t.add(t.loadingMesh),t.add(t.disableMesh),t.renderOrder=1e4,t.needsRender=!0,t}return ke(t,e),t.prototype.setProgress=function(e){this.progress=e,this.setLoading(e>0)},t.prototype.setOpacity=function(e){this.opacity!==e&&(this.opacity=e=Er(e,0,1),this.opacityMotion.set({opacity:e},30).catch(qe))},t.prototype.setCurrent=function(e){if(this.current!==e){if(e){var t=[{progress:0,value:{ringScale:2,ringOpacity:0,circleFade:0,circleOpacity:.5,circleScale:1}},{progress:.05,value:{ringScale:1,ringOpacity:1,circleFade:0,circleOpacity:.5,circleScale:1}},{progress:.15,value:{ringScale:1.2,ringOpacity:1,circleFade:0,circleOpacity:.5,circleScale:1}},{progress:.25,value:{ringScale:1.1,ringOpacity:1,circleFade:0,circleOpacity:.5,circleScale:1}},{progress:.8,value:{ringScale:1.1,ringOpacity:1,circleFade:1,circleOpacity:1,circleScale:1}},{progress:.9,value:{ringScale:1.1,ringOpacity:1,circleFade:1,circleOpacity:1,circleScale:.8}},{progress:.92,value:{ringScale:1.1,ringOpacity:1,circleFade:1,circleOpacity:1,circleScale:.8}},{progress:1,value:{ringScale:1.1,ringOpacity:1,circleFade:1,circleOpacity:.3,circleScale:1.1}}];this.currentMotion.setKeyframes(t,1500).catch(qe)}else{t=[{progress:0,value:Fe({},this.currentMotion.value)},{progress:1,value:{ringScale:1.1,ringOpacity:0,circleFade:0,circleOpacity:.5,circleScale:1}}];this.currentMotion.setKeyframes(t,200).catch(qe)}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):this.loadingMotion.set({opacity:0},0),this.loading=e,!0===this.disabled&&this.setDisabled(!1),this.needsRender=!0)},t.prototype.setDisabled=function(e){this.disabled!==e&&(this.disabled=e,!0===this.loading&&this.setLoading(!1),this.disableMesh.visible=e,this.centerMesh.visible=!e,this.needsRender=!0)},t.prototype.tap=function(){return Promise.resolve()},t.prototype.updateTime=function(e,t){this.opacityMotion.update(e),this.currentMotion.update(e),this.loadingMotion.update(e);var i=this.opacityMotion.value.opacity,n=this.currentMotion.value,r=n.ringScale,o=n.ringOpacity,s=n.circleFade,a=n.circleOpacity,l=n.circleScale;if(this.ringMesh.scale.set(r,r,r),this.centerMesh.scale.set(l,l,l),this.centerMesh2.scale.set(l,l,l),this.ringMesh.material.opacity=o*i,this.centerMesh.material.opacity=(1-s)*i,this.centerMesh2.material.opacity=s*a*i,this.loadingMotion.value.opacity>0){this.loadingMesh.visible=!0,this.loadingMesh.material.opacity=this.loadingMotion.value.opacity,this.loadingMesh.rotateZ(-t/200);var u=this.opacityMotion.value.opacity,c=1.1;this.centerMesh.scale.set(c,c,c),this.centerMesh2.scale.set(c,c,c),this.centerMesh.material.opacity=0*u,this.centerMesh2.material.opacity=.2*u}else this.loadingMesh.visible=!1;this.needsRender=!0},t.prototype.dispose=function(){this.currentMotion.dispose(),this.opacityMotion.dispose(),this.loadingMotion.dispose(),this.ringMesh.material.dispose(),this.disableMesh.material.dispose(),this.centerMesh.material.dispose(),this.loadingMesh.material.dispose()},t}(n.Object3D),Ea=function(e){function t(i){var n=this,r=t.parseArgs(i);(n=e.call(this,r)||this).cardboard=new ha(n.renderer);var o,s,a,l=(o="five_vr_helper_"+rr(),s=Aa(o),(a=document.createElement("div")).className=o,a.innerHTML=s,a);n.helperElement=l;var u=new Xo(l);return n.element.parentNode&&(n.element.parentNode.insertBefore(l,n.element),n.setHelperElementSize(),u.on("tap",(function(){return n.emit("vrWantsToExit")}))),n.destroyHelper=function(){u.destroy(),l.parentNode&&l.parentNode.removeChild(l),delete n.helperElement},n}return ke(t,e),t.parseArgs=function(t){var i=Fe(Fe({},t),{maxLatitude:Math.PI/2,minLatitude:-Math.PI/2});return e.parseArgs.call(this,i)},t.initAnimationEndPose=function(t){var i=this.parseArgs(t);return e.initAnimationEndPose.call(this,i)},t.prototype.destroy=function(){e.prototype.destroy.call(this),this.cardboard.dispose(),this.destroyHelper();for(var t=0,i=this.panoMeshes;t<i.length;t++){var n=i[t];this.helper.remove(n),n.dispose()}this.panoMeshes.length=0},t.prototype.isReady=function(){return!1},t.prototype.updateRenderSize=function(){this.needsRender=!0,this.setHelperElementSize()},t.prototype.updatePanoMeshes=function(){var e=this;this.panoMeshes.forEach((function(t){e.helper.remove(t),t.dispose()})),this.panoMeshes.length=0;for(var t=0;t<this.work.observers.length;t++){var i=this.work.observers[t],n=new wa;n.name="panoSphere_".concat(this.work.workCode,"_").concat(t),n.position.copy(i.position),n.needsRender=!0,this.helper.add(n),this.panoMeshes[t]=n}},t.prototype.updateTime=function(e,t){var i,r;if(!this.destroyed){this.needsRender=!0;var o={},s={};if(!1===this.locationMotion.ended){this.locationMotion.update(e);var a=this.locationMotion.getKeyFrameSegment(e),l=a[0],u=a[1],c=this.panoResourceFromLocationMotionKeyframe(l),h=this.panoResourceFromLocationMotionKeyframe(u),d=this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[0]),p=this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[this.locationMotion.keyframes.length-1]),f=c.position,A=h.position,m=this.locationMotion.value.count-u.value.count+1;o.modelAlpha=this.locationMotion.value.modelAlpha,this.camera.perspToOrtho.setScalar(Er(this.locationMotion.value.perspToOrtho,0,1)),this.camera.orthoDistance=this.locationMotion.value.orthoDistance,o.useBlackTransition="instant"===h.effect,h.panoPicture&&(m<1?c.panoPicture&&(o.pano0=c.panoPicture):o.pano0=h.panoPicture,o.pano1=h.panoPicture),"fade"===h.effect&&(o.pano0&&c.panoPicture&&(o.pano0={map:o.pano0.map,luminanceMap:o.pano0.luminanceMap,matrix:c.panoPicture.matrix.clone().setPosition(h.position)}),f.copy(A)),o.progress=m,s.distance=this.locationMotion.value.distance,s.offset=new n.Vector3(f.x+(A.x-f.x)*m,f.y+(A.y-f.y)*m,f.z+(A.z-f.z)*m);for(var g=[],v=[],y=0,b=this.locationMotion.keyframes;y<b.length;y++){var x=b[y],w=x.key,E=x.progress;void 0!==w&&(g.push(w),E>=this.locationMotion.progress&&v.push(w))}for(var M=0,S=Object.keys(this.panoResources);M<S.length;M++){var C=S[M];if(!(v.indexOf(C)>=0)){var I=this.panoResources[C];if(I.panoPicture){var B=I.panoPicture.map;if(B){if(B===(null===(i=o.pano0)||void 0===i?void 0:i.map))continue;if(B===(null===(r=o.pano1)||void 0===r?void 0:r.map))continue;B.dispose(),I.panoPicture=null}}g.indexOf(C)>=0||delete this.panoResources[C]}}this.currentPanoIndex=m<.5?c.panoIndex:h.panoIndex,this.emit("movingToPano",p.panoIndex,d.panoIndex,this.locationMotion.progress)}!1===_o(o)&&this.model.setMaterial(o),s.offset&&this.camera.position.copy(s.offset);var T=this.camera.pose.longitude,P=this.camera.pose.latitude;this.camera.quaternion.fromArray(this.cardboard.sensor.getOrientation()),this.camera.updateMatrixWorld(),this.camera.computePose();for(var R=this.work.observers[this.currentPanoIndex].visibleNodes.concat(this.currentPanoIndex),D=0;D<this.work.observers.length;D++){var L=this.work.observers[D];if((O=this.panoMeshes[D]).visible=!0,L.loadable||L.active){if(-1===R.indexOf(D))O.visible=!1;else{O.visible=!0;var k=O.position.clone().setY(this.camera.position.y).distanceTo(this.camera.position);k<.05?O.setOpacity(0):O.setOpacity(Er(1.5/k,0,1)),this.currentPanoIndex===D&&O.setOpacity(0)}O.lookAt(this.camera.position)}else O.visible=!0}var F=this.intersect(e);for(D=0;D<this.work.observers.length;D++){null==(O=this.panoMeshes[D])||O.setCurrent(O===F)}for(D=0;D<this.work.observers.length;D++){var O;(O=this.panoMeshes[D])&&O.updateTime&&O.updateTime(e,t)}T===this.camera.pose.longitude&&P===this.camera.pose.latitude||(this.cameraMotion.set(Tt(this.camera.pose,["longitude","latitude"]),0).catch(qe),this.emit("cameraDirectionUpdate",Tt(this.camera.pose,["longitude","latitude"]),!0),this.emit("cameraUpdate",Wo(Tt(this.camera.pose,["longitude","latitude","fov","offset","distance"])),!0))}},t.prototype.render=function(){this.cardboard.render(this.scene,this.camera)},t.prototype.setCamera=function(e){},t.prototype.destroyHelper=function(){},t.prototype.setHelperElementSize=function(){if(this.helperElement){var e=new n.Vector2(this.element.offsetWidth,this.element.offsetHeight),t=e.x*this.scissor.left,i=e.y*(1-this.scissor.bottom-this.scissor.height),r=e.x*this.scissor.width,o=e.y*this.scissor.height;this.helperElement.style.marginLeft=t+"px",this.helperElement.style.marginTop=i+"px",this.helperElement.style.width=r+"px",this.helperElement.style.height=o+"px"}},t.prototype.intersect=function(e){var t;if(!1===this.locationMotion.ended)return this.intersectMesh.visible=!1,delete this.activePanoMesh,void delete this.activeTime;if(this.activePanoMesh&&this.activeTime&&e-this.activeTime>1500){var i=this.activePanoMesh;return(u=this.panoMeshes.indexOf(i))>=0&&this.moveToPano(u,{},!0),delete this.activePanoMesh,delete this.activeTime,i}for(var r=this.camera.getWorldDirection(new n.Vector3),o=new n.Raycaster(this.camera.position,r),s=void 0,a=[],l=this.work.observers[this.currentPanoIndex].visibleNodes,u=0;u<this.work.observers.length;u++){var c=this.panoMeshes[u];if(-1!==l.indexOf(u)){var h=o.intersectObject(null!==(t=c.hitTestMesh)&&void 0!==t?t:c,!0)[0];h&&a.push({panoMesh:c,intersection:h})}}var d=a.sort((function(e,t){return e.intersection.distance-t.intersection.distance}))[0];if(d?(s=d.intersection,this.activePanoMesh!==d.panoMesh&&(this.activePanoMesh=d.panoMesh,this.activeTime=e),this.intersectMesh.position.copy(d.panoMesh.position),this.intersectMesh.lookAt(this.camera.position),this.intersectMesh.visible=!1):(this.activePanoMesh=void 0,this.activeTime=void 0),!s)if((s=this.model.intersectRaycaster(o)[0])&&s.face){var p=s.face.normal,f=new n.Quaternion;f.setFromUnitVectors(new n.Vector3(0,0,1),p),this.intersectMesh.quaternion.copy(f);var A=p.clone().multiplyScalar(.05),m=s.point.clone().add(A);this.intersectMesh.position.copy(m),this.intersectMesh.visible=!0,this.emit("intersectionOnModelUpdate",s,this.intersectMesh)}else this.intersectMesh.visible=!1,this.emit("intersectionHidden");return null==d?void 0:d.panoMesh},t.prototype.onPanGesture=function(){},t.prototype.onTapGesture=function(){},t.prototype.onPinchGesture=function(){},t.prototype.onMouseMove=function(){},t.prototype.onMouseOut=function(){},t}(Hs),Ma=function(e){function t(i){var n,r,o=this,s=t.parseArgs(i);return(o=e.call(this,s)||this).currentPanoIndex=s.initial[0],o.locationMotion=new Ur({x:o.camera.pose.offset.x,y:o.camera.pose.offset.y,z:o.camera.pose.offset.z,distance:o.camera.pose.distance,modelAlpha:null!==(r=null===(n=o.model.getMaterial())||void 0===n?void 0:n.modelAlpha)&&void 0!==r?r:0,perspToOrtho:o.camera.perspToOrtho.x,orthoDistance:o.camera.orthoDistance}),o}return ke(t,e),t.parseArgs=function(t){return e.parseArgs.call(this,t)},t.initAnimationEndPose=function(t){var i=this.parseArgs(t);return e.initAnimationEndPose.call(this,i)},t.prototype.destroy=function(){e.prototype.destroy.call(this),this.locationMotion.dispose()},t.prototype.isReady=function(){return!1!==this.locationMotion.ended&&e.prototype.isReady.call(this)},t.prototype.updateWork=function(e,t,i,n,r){this.work=e,this.currentPanoIndex=t,this.hideIntersectMesh();var o={duration:0,longitude:i.longitude,latitude:i.latitude,fov:i.fov};return this.moveToPano(t,o,r),!0},t.prototype.updateTime=function(e,t){if(!this.destroyed){var i={},r={};if(!this.locationMotion.ended){this.locationMotion.update(e),i.modelAlpha=this.locationMotion.value.modelAlpha,this.camera.perspToOrtho.setScalar(Er(this.locationMotion.value.perspToOrtho,0,1)),this.camera.orthoDistance=this.locationMotion.value.orthoDistance,r.distance=this.locationMotion.value.distance,r.offset=new n.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z);var o=new n.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z),s=Go(this.work.observers,(function(e){return e.position.distanceTo(o)}));this.currentPanoIndex=this.work.observers.indexOf(s)}this.cameraMotion.ended||(this.cameraMotion.update(e),r.longitude=this.cameraMotion.value.longitude,r.latitude=this.cameraMotion.value.latitude,r.fov=this.cameraMotion.value.fov),_o(i)||this.model.setMaterial(i),_o(r)||this.setCamera(r)}},t.prototype.initAnimation=function(e,t,i,n){var r,o,s,a=this;this.destroyed||(this.pending=!1,this.userAction=n,this.moveToPano(e,{longitude:null!==(r=t.longitude)&&void 0!==r?r:this.defaultLongitude,latitude:Er(null!==(o=t.latitude)&&void 0!==o?o:this.defaultLatitude,this.minLatitude,this.maxLatitude),fov:Er(null!==(s=t.fov)&&void 0!==s?s:this.defaultFov,this.minFov,this.maxFov),duration:i,moveStartCallback:function(e,t){a.emit("initAnimationWillStart",e,t,a.userAction)},moveEndCallback:function(e,t){a.emit("initAnimationEnded",e,t,a.userAction)},moveCancelCallback:function(){var e=a.currentPanoIndex,t={longitude:a.camera.pose.longitude,latitude:a.camera.pose.latitude,fov:a.camera.pose.fov,offset:a.camera.pose.offset.clone(),distance:a.camera.pose.distance};a.emit("initAnimationEnded",e,t,a.userAction)}},n))},t.prototype.getTargetPose=function(){var e=this.cameraMotion.getKeyFrameSegment(Ue())[1],t=this.locationMotion.getKeyFrameSegment(Ue())[1];return{longitude:e.value.longitude,latitude:e.value.latitude,fov:e.value.fov,offset:new n.Vector3(t.value.x,t.value.y,t.value.z),distance:t.value.distance}},t.prototype.moveToPano=function(e,t,i){void 0===t&&(t={});var n=this.work.observers[e];n&&this.moveToPosition(n.position,t,i)},t.prototype.moveToPosition=function(e,t,i){var r,o,s,a=this;void 0===t&&(t={}),this.userAction=i;for(var l=Ue(),u=new n.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z).distanceTo(e),c=this.locationMotion.getProgressVelocity(l),h=0,d=1;d<this.locationMotion.keyframes.length;d++){var p=this.locationMotion.keyframes[d-1].value,f=p.x,A=p.y,m=p.z,g=this.locationMotion.keyframes[d].value,v=g.x,y=g.y,b=g.z;h+=Math.sqrt(Math.pow(v-f,2)+Math.pow(y-A,2)+Math.pow(b-m,2))}var x=0===u?0:c*h/u,w=this.calculateMovingDuration(t.duration,u),E={x:e.x,y:e.y,z:e.z,distance:0,modelAlpha:1,perspToOrtho:0,orthoDistance:1},M={longitude:t.longitude,latitude:t.latitude,fov:t.fov},S={longitude:null!==(r=M.longitude)&&void 0!==r?r:this.camera.pose.longitude,latitude:null!==(o=M.latitude)&&void 0!==o?o:this.camera.pose.latitude,fov:null!==(s=M.fov)&&void 0!==s?s:this.camera.pose.fov,offset:e.clone(),distance:0},C=Go(this.work.observers,(function(t){return t.position.distanceTo(e)})),I=this.work.observers.indexOf(C);this.emit("moveToPano",I,this.userAction),t.moveStartCallback&&t.moveStartCallback(I,S),this.emit("panoWillArrive",I,S,this.userAction),this.cameraMotion.set(M,w).catch(qe),this.locationMotion.set(E,w,x).then((function(){var e=Wo(a.camera.pose);t.moveEndCallback&&t.moveEndCallback(I,e),a.emit("panoArrived",I,e,a.userAction)}),(function(){t.moveCancelCallback&&t.moveCancelCallback(),a.emit("moveToPanoCanceled",I)}))},t.prototype.onTapGesture=function(e){var t=e.pointers.map((function(e){return Tt(e,["x","y"])}));if(!this.emit("wantsGesture","tap",t,!0)){var i=this.relativeClientPosition(e.center),r=new n.Raycaster;if(r.setFromCamera(i,this.camera),!this.emit("wantsTapGesture",r,i,!0)){this.emit("gesture","tap",t,!0),this.emit("tapGesture",r,i,!0),this.interiaMovement=!1;var o=this.model.intersectRaycaster(r)[0];if(o&&o.face){var s=o.face.normal,a=o.point;if(new n.Vector3(0,1,0).angleTo(s)>Math.PI/3){var l=this.camera.position.clone().setY(a.y),u=a.clone().sub(l).setLength(.3),c=a.clone().sub(u);r.set(c,new n.Vector3(0,-1,0)),o=this.model.intersectRaycaster(r)[0]}}if(o){var h=o.point.clone(),d=Go(this.work.observers.filter((function(e){return Math.abs(e.standingPosition.y-h.y)<1})),(function(e){return e.standingPosition.distanceTo(h)}));if(d)return h.y=d.position.y,void this.moveToPosition(h,{},!0)}this.cameraBounce()}}},t}(ms),Sa=function(){var e=113,t=126,i=0,n="";return arguments[i].split(n).map((function(n){return n.charCodeAt(i)>t?n:String.fromCharCode((n.charCodeAt(i)+e)%t)})).join(n)}("{vs|z-rp@-}n{|]|vv|{H{vs|z-znA-}n{|ZnvH{vs|z-nz}yr?Q-}n{|Qv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v}ynprzr{;H----qvn{pr-J-qvn{pr-7-p|5]V-7-5p||q;\b-:-=;EB66H----qvn{pr-J-pnyrH--\f--rpA-ry]|vv|{-J-rpA5}|vv|{-8-}n{|]|vv|{-8-{|znyv\tr5|yq]|vv|{;\b\t6-7-qvn{pr9->;=6H--tyl]|vv|{-J-}|wrpv|{Znv-7-z|qrycvrZnv-7-ry]|vv|{H\f"),Ca=function(){var e=113,t=126,i=0,n="";return arguments[i].split(n).map((function(n){return n.charCodeAt(i)>t?n:String.fromCharCode((n.charCodeAt(i)+e)%t)})).join(n)}("{vs|z-sy|n-|}npv\bH{vs|z-nz}yrPor-}n{|Zn}H{vs|z-nz}yr?Q-}n{|Qv}ynprzr{Zn}Hn\bv{t-rp@-}n{|d|yq]|vv|{H|vq-znv{56-\n--rpA-}n{|P|y|-J-rrPor5}n{|Zn}9-}n{|d|yq]|vv|{;\b\t6H--tylSntP|y|-J-rpA5}n{|P|y|;to9-|}npv\b6H\f"),Ia=Object.assign({opacity:new n.Uniform(1),scale:new n.Uniform(13.1),panoMap:new n.Uniform(null),panoDisplacementMap:new n.Uniform(null),panoPosition:new n.Uniform(new n.Vector3),panoMatrix:new n.Uniform(new n.Matrix4)},{emissive:new n.Uniform(new n.Color(0)),emissiveMap:new n.Uniform(null),specular:new n.Uniform(new n.Color(1118481)),specularMap:new n.Uniform(null),normalMap:new n.Uniform(null),bumpMap:new n.Uniform(null),shininess:new n.Uniform(30)},n.UniformsLib.common,n.UniformsLib.lights),Ba=new n.SphereBufferGeometry(.01,128,128);var Ta=function(){function e(e){void 0===e&&(e={}),this.textureLoader=new oi({allowHosts:this.allowHosts,requestProxy:this.requestProxy,networkSubscribe:this.networkSubscribe}),this.allowHosts=e.allowHosts,this.requestProxy=e.requestProxy,this.networkSubscribe=e.networkSubscribe}return e.prototype.setAllowHosts=function(e){this.allowHosts=e,this.textureLoader.setAllowHosts(e)},e.prototype.setRequestProxy=function(e){this.requestProxy=e,this.textureLoader.setRequestProxy(e)},e.prototype.setNetworkSubscribe=function(e){this.networkSubscribe=e,this.textureLoader.setNetworkSubscribe(e)},e.prototype.load=function(e,t,i,r,o,s,a,l,u){var c=[0,0],h=function(e,t){c[t]=e,l(.8*c[0]+.2*c[1])},d=[this.textureLoader.loadTexture(e,{imageURL:i,viaAjax:!0},void 0,void 0,(function(e){return h(e,1)}),u),this.textureLoader.loadCubeTexture(t,{imageURL:i,viaAjax:!0},void 0,void 0,(function(e){return h(e,0)}),u)];return Promise.all(d).then((function(e){var t=e[0],i=e[1],a=function(e,t,i,r){var o=new n.ShaderMaterial({side:n.BackSide,vertexShader:Sa,fragmentShader:Ca,transparent:!0,uniforms:n.UniformsUtils.clone(Ia)}),s=t;return s.needsUpdate=!0,s.minFilter=n.LinearFilter,s.magFilter=n.LinearFilter,e.needsUpdate=!0,e.minFilter=n.LinearFilter,e.magFilter=n.LinearFilter,o.uniforms.opacity.value=0,o.uniforms.panoMap.value=s,o.uniforms.panoDisplacementMap.value=e,o.uniforms.panoPosition.value=i,o.uniforms.panoMatrix.value=r,Object.assign(new n.Mesh(Ba,o),{frustumCulled:!1,dispose:function(){this.material instanceof n.ShaderMaterial&&(this.material.uniforms.panoDisplacementMap.value.dispose(),this.material.uniforms.panoDisplacementMap.value=null,this.material.dispose())}})}(t.body,i.body,r,o),l={body:a,meta:Oe([t.meta],i.meta,!0)};return s(l),l})).catch((function(e){for(var t=0,i=d;t<i.length;t++){i[t].then((function(e){return e.body.dispose()})).catch(qe)}return a(e),Promise.reject(e)}))},e}(),Pa=new n.Vector3(-1,1,1),Ra=function(e){function t(i){var r,o,s,a,l,u=this,c=t.parseArgs(i);return(u=e.call(this,c)||this).currentPanoIndex=c.initial[0],u.maxAccessibleDistance=c.maxAccessibleDistance,u.panoTapTriggerRadius=c.panoTapTriggerRadius,u.panoCircleMeshCreator=c.panoCircleMeshCreator,u.boundingMesh=u.generateBoundingMesh(),u.boundingMesh.setMaterial(u.model.getMaterial()||{}),u.boundingMesh.visible=!1,u.scene.add(u.boundingMesh),u.panoModelGroup=new n.Group,u.panoModelGroup.name="panoModels",u.scene.add(u.panoModelGroup),u.panoMeshes=[],u.updatePanoMeshes(),u.helper.remove(u.intersectMesh),u.locationMotion=new Ur({count:0,distance:u.camera.pose.distance,modelAlpha:null!==(o=null===(r=u.model.getMaterial())||void 0===r?void 0:r.modelAlpha)&&void 0!==o?o:0,perspToOrtho:u.camera.perspToOrtho.x,orthoDistance:u.camera.orthoDistance}),u.panoResources={},u.panoResources[u.locationMotion.keyframes[0].key=u.locationMotion.keyframes[1].key=rr()]={panoIndex:u.currentPanoIndex,workCode:u.work.workCode,matrix:null!==(l=null===(a=null===(s=u.model.getMaterial())||void 0===s?void 0:s.pano1)||void 0===a?void 0:a.matrix)&&void 0!==l?l:new n.Matrix4,position:u.camera.pose.offset.clone(),effect:"fly"},u.depthTextureLoader=new Ta({allowHosts:u.work.allowHosts,requestProxy:u.requestProxy,networkSubscribe:u.networkSubscribe}),u}return ke(t,e),t.parseArgs=function(t){var i,n,r,o=e.parseArgs.call(this,t);return Fe(Fe({},o),{maxAccessibleDistance:null!==(i=t.maxAccessibleDistance)&&void 0!==i?i:5,panoTapTriggerRadius:null!==(n=t.panoTapTriggerRadius)&&void 0!==n?n:1,panoCircleMeshCreator:null!==(r=t.panoCircleMeshCreator)&&void 0!==r?r:function(e){return new uo}})},t.initAnimationEndPose=function(t){var i=this.parseArgs(t);return e.initAnimationEndPose.call(this,i)},t.prototype.destroy=function(){var t,i=this;if(e.prototype.destroy.call(this),this.locationMotion.dispose(),delete this.pendingTextureTask,this.model&&(this.model.visible=!0),this.panoModelGroup){for(var n=0,r=this.panoModelGroup.children;n<r.length;n++){var o=r[n];"function"==typeof o.dispose&&o.dispose()}this.scene.remove(this.panoModelGroup)}this.boundingMesh&&(this.scene.remove(this.boundingMesh),this.boundingMesh.dispose()),this.panoMeshes&&(this.panoMeshes.forEach((function(e){i.helper.remove(e),e.dispose()})),this.panoMeshes.length=0);for(var s=null!==(t=this.model.getMaterial())&&void 0!==t?t:{},a=s.pano0,l=s.pano1,u=0,c=Object.keys(this.panoResources);u<c.length;u++){var h=c[u],d=this.panoResources[h];d.panoModel&&d.panoModel.material.uniforms.panoMap.value!==(null==a?void 0:a.map)&&d.panoModel.material.uniforms.panoMap.value!==(null==l?void 0:l.map)&&(this.panoModelGroup.remove(d.panoModel),d.panoModel.material.uniforms.panoMap.value.dispose(),d.panoModel.dispose(),delete d.panoModel),delete this.panoResources[h]}this.interiaMovement=!1},t.prototype.isReady=function(){return!1===this.locationMotion.ended&&e.prototype.isReady.call(this)},t.prototype.updateWork=function(e,t,i,n,r){this.userAction=r,this.work=e,this.currentPanoIndex=t,this.depthTextureLoader.setAllowHosts(this.work.allowHosts);var o={},s=!0;this.boundingMesh&&(o=this.boundingMesh.getMaterial()||{},s=this.boundingMesh.visible,this.scene.remove(this.boundingMesh),this.boundingMesh.dispose()),this.boundingMesh=this.generateBoundingMesh(!0),this.boundingMesh.visible=s,this.boundingMesh.setMaterial(o),this.scene.add(this.boundingMesh),this.hideIntersectMesh(),this.updatePanoMeshes();for(var a=0,l=this.panoMeshes;a<l.length;a++){l[a].visible=!1}return this.moveToPano(t,{effect:"fade",duration:n,longitude:i.longitude,latitude:i.latitude,fov:i.fov},r),!0},t.prototype.updateTime=function(e,t){var i,r,o,s=this;if(!this.destroyed){var a={},l={},u=this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[0]),c=this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[this.locationMotion.keyframes.length-1]),h=!1;if(!1===this.locationMotion.ended){this.locationMotion.update(e);var d=this.locationMotion.getKeyFrameSegment(e),p=d[0],f=d[1],A=this.panoResourceFromLocationMotionKeyframe(p),m=this.panoResourceFromLocationMotionKeyframe(f),g=(new n.Vector3).copy(A.position),v=(new n.Vector3).copy(m.position),y=this.locationMotion.value.count-f.value.count+1;a.progress=y,a.modelAlpha=this.locationMotion.value.modelAlpha,this.camera.perspToOrtho.setScalar(Er(this.locationMotion.value.perspToOrtho,0,1)),this.camera.orthoDistance=this.locationMotion.value.orthoDistance;for(var b=0,x=this.panoModelGroup.children;b<x.length;b++){var w=x[b];w.visible=w===A.panoModel||w===m.panoModel}A.panoModel&&(A.panoModel.material.uniforms.opacity.value=1-y,A.panoModel.material.depthTest=0!==y),m.panoModel&&(m.panoModel.material.uniforms.opacity.value=y,m.panoModel.material.depthTest=1!==y),m.panoModel&&(y<1?A.panoModel&&(a.pano0={map:A.panoModel.material.uniforms.panoMap.value,luminanceMap:null,matrix:A.matrix}):a.pano0={map:m.panoModel.material.uniforms.panoMap.value,luminanceMap:null,matrix:m.matrix},a.pano1={map:m.panoModel.material.uniforms.panoMap.value,luminanceMap:null,matrix:m.matrix}),h=a.useBlackTransition="instant"===m.effect||"montage"===m.effect,"fade"!==m.effect&&"montage"!==m.effect||(a.pano0&&(a.pano0={map:a.pano0.map,luminanceMap:null,matrix:A.matrix.clone().setPosition(m.position)}),g.copy(v)),l.distance=this.locationMotion.value.distance,l.offset=new n.Vector3(g.x+(v.x-g.x)*y,g.y+(v.y-g.y)*y,g.z+(v.z-g.z)*y);for(var E=[],M=[],S=0,C=this.locationMotion.keyframes;S<C.length;S++){var I=C[S],B=I.key,T=I.progress;void 0!==B&&(E.push(B),T>=this.locationMotion.progress&&M.push(B))}for(var P=0,R=Object.keys(this.panoResources);P<R.length;P++){var D=R[P];if(!(M.indexOf(D)>=0)){var L=this.panoResources[D];if(L.panoModel){if(L.panoModel.material.uniforms.panoMap.value===(null===(i=a.pano0)||void 0===i?void 0:i.map))continue;if(L.panoModel.material.uniforms.panoMap.value===(null===(r=a.pano1)||void 0===r?void 0:r.map))continue;this.panoModelGroup.remove(L.panoModel),L.panoModel.material.uniforms.panoMap.value.dispose(),L.panoModel.dispose(),delete L.panoModel}E.indexOf(D)>=0||delete this.panoResources[D]}}A.workCode===m.workCode?this.currentPanoIndex=y<.5?A.panoIndex:m.panoIndex:this.currentPanoIndex=m.panoIndex,this.emit("movingToPano",c.panoIndex,u.panoIndex,this.locationMotion.progress)}if(!1===this.cameraMotion.ended&&(this.cameraMotion.update(e),l.longitude=this.cameraMotion.value.longitude,l.latitude=this.cameraMotion.value.latitude,l.fov=this.cameraMotion.value.fov),!1===_o(a)&&(this.model.setMaterial(a),this.boundingMesh.setMaterial(a)),!1===_o(l)&&this.setCamera(l),this.camera.pose.distance>.1)for(var k=0;k<this.work.observers.length;k++){(Q=this.panoMeshes[k])&&(Q.visible=!1)}else{var F=this.work.observers[this.currentPanoIndex];if(F){var O=Go(F.visibleNodes,(function(e){return F.standingPosition.distanceTo(s.work.observers[e].standingPosition)}),!0)[1];O=Er(O,3,1/0);var N=F.visibleNodes.concat(this.currentPanoIndex),V=this.getForwardPanoIndexOrNot();for(k=0;k<this.work.observers.length;k++){var Q,H=this.work.observers[k];if(Q=this.panoMeshes[k])if(H.loadable||H.active)if(-1!==N.indexOf(k))if(h)Q.visible=!1,Q.setOpacity(0);else{Q.visible=!0;var q=Q.position.clone().setY(this.camera.position.y).distanceTo(this.camera.position);Q.setCurrent(!Q.loading&&0===Q.progress&&V===k),Q.setOpacity(q<.01?0:Er(O/q*1.2,.75,.98));var z=this.camera.position.clone().setY(Q.position.y),U=new n.Vector3;z.equals(Q.position)?(this.camera.getWorldDirection(U),U.setY(0)):U.copy(Q.position).sub(z),U.length()>0&&Q.lookAt(U.clone().normalize().add(Q.position)),Q.updateTime&&Q.updateTime(e,t)}else Q.visible=!1,Q.setOpacity(0);else Q.visible=!1,Q.setOpacity(0)}}}this.boundingMesh.visible=Boolean(null===(o=this.boundingMesh.getMaterial())||void 0===o?void 0:o.pano0)&&this.boundingMesh.boundingBox.containsPoint(this.camera.position)}},t.prototype.getTargetPose=function(){var e=this.cameraMotion.getKeyFrameSegment(Ue())[1],t=this.locationMotion.getKeyFrameSegment(Ue())[1],i=this.panoResourceFromLocationMotionKeyframe(t),n=this.work.observers[i.panoIndex];return{longitude:e.value.longitude,latitude:e.value.latitude,fov:e.value.fov,offset:n?n.position.clone():this.camera.position.clone(),distance:0}},t.prototype.moveToPano=function(e,t,i){var r,o=this;void 0===t&&(t={});var s=this.work.observers[e].images.depth,a=Fe({key:"pano.".concat(e),basisLoaderInitialized:ii.isInitialized()},Tt(this.imageOptions,["format","size","quality","sharpen","mappings"])),l=this.imageOptions.transform,u=this.work.observers[e].images,c=this.work.observers[e],h=c.position,d=c.quaternion,p=(new n.Matrix4).compose(h,d,new n.Vector3(-1,1,1)),f="pano:"+fs(u);if(this.pendingTextureTask){if(this.pendingTextureTask.hash===f)return;var A=this.pendingTextureTask.panoIndex;null===(r=this.panoMeshes[A])||void 0===r||r.setProgress(0),this.emit("textureAbort",A,this.work.observers[A]),this.pendingTextureTask.onError(new Error("texture aborted"))}this.pending=!0,this.pendingTextureTask={panoIndex:e,hash:f,onLoad:function(n){o.pending=!1,o.destroyed?n.body.dispose():(n.body.name=f,o.emit("panoLoaded",e),o.doMoveToPano(e,n.body,t,i))},onError:function(i){o.pending=!1,t.moveCancelCallback&&t.moveCancelCallback(),o.emit("panoLoadError",i,e),o.emit("moveToPanoCanceled",e)}};var m=this.panoMeshes[e];m&&m.tap&&m.tap(),this.depthTextureLoader.load(s,u,{transform:l,options:a},h,p,(function(t){var i,n;(null===(i=o.pendingTextureTask)||void 0===i?void 0:i.hash)===f?(o.pendingTextureTask.onLoad(t),null===(n=o.panoMeshes[e])||void 0===n||n.setProgress(0),delete o.pendingTextureTask,o.emit("textureLoaded",e,o.work.observers[e],t.meta)):t.body.dispose()}),(function(t){var i,n;(null===(i=o.pendingTextureTask)||void 0===i?void 0:i.hash)===f&&(o.pendingTextureTask.onError(t),null===(n=o.panoMeshes[e])||void 0===n||n.setProgress(0),delete o.pendingTextureTask,o.emit("textureError",t,e,o.work.observers[e]),o.emit("error",t))}),(function(t){var i,n;o.emit("textureLoading",t,e,o.work.observers[e]),(null===(i=o.pendingTextureTask)||void 0===i?void 0:i.hash)===f&&(null===(n=o.panoMeshes[e])||void 0===n||n.setProgress(t))}),this.renderer),this.emit("textureStartLoad",e,this.work.observers[e])},t.prototype.initAnimation=function(e,t,i,n){var r,o,s,a=this;if(!this.destroyed){var l=!1;this.pending=!1,this.userAction=n,this.moveToPano(e,{longitude:null!==(r=t.longitude)&&void 0!==r?r:this.defaultLongitude,latitude:Er(null!==(o=t.latitude)&&void 0!==o?o:this.defaultLatitude,this.minLatitude,this.maxLatitude),fov:Er(null!==(s=t.fov)&&void 0!==s?s:this.defaultFov,this.minFov,this.maxFov),duration:i,moveStartCallback:function(e,t){l=!0,a.emit("initAnimationWillStart",e,t,a.userAction)},moveEndCallback:function(e,t){a.emit("initAnimationEnded",e,t,a.userAction)},moveCancelCallback:function(){var e=Wo(a.camera.pose);!1===l&&a.emit("initAnimationWillStart",a.currentPanoIndex,e,a.userAction),a.emit("initAnimationEnded",a.currentPanoIndex,e,a.userAction)}},n)}},t.prototype.panoResourceFromLocationMotionKeyframe=function(e){return this.panoResources[e.key]},t.prototype.locationMotionKeyframesLength=function(e){for(var t=0,i=1;i<e.length;i++){var n=this.panoResourceFromLocationMotionKeyframe(e[i-1]).position,r=this.panoResourceFromLocationMotionKeyframe(e[i]).position;t+=n.distanceTo(r)*(e[i].value.count-e[i-1].value.count)}return t},t.prototype.updatePanoMeshes=function(){for(var e=this,t={},i=0,n=this.panoMeshes;i<n.length;i++){t[(p=n[i]).name]=p}this.panoMeshes.length=0;for(var r=1,o={},s=function(t){var i=Go(t.accessibleNodes,(function(i){return Er(e.work.observers[i].standingPosition.distanceTo(t.standingPosition),1,1/0)}),!0),n=i[1];void 0===o[t.panoIndex]&&(o[t.panoIndex]=n)},a=0,l=this.work.observers;a<l.length;a++){s(d=l[a])}var u=Object.keys(o).map((function(e){return o[e]}));u.length&&(r=Er(.6*(u.reduce((function(e,t){return e+t}),0)/u.length),1,3));for(var c=0;c<this.work.observers.length;c++){var h="panoCircle_".concat(this.work.workCode,"_").concat(c),d=this.work.observers[c],p=void 0;t[h]?(!0===(p=t[h]).loading&&!1===d.loadable&&p.setLoading(!1),delete t[h]):((p=this.panoCircleMeshCreator(c)).name=h,this.helper.add(p)),p.scale.set(r,1,r),p.position.copy(d.standingPosition),this.panoMeshes[c]=p}for(var f=0,A=Object.keys(t);f<A.length;f++){var m=A[f];this.helper.remove(t[m]),t[m].dispose(),delete t[m]}},t.prototype.generateBoundingMesh=function(e){void 0===e&&(e=!1);for(var t=this.model.bounding.clone(),i=0,r=this.work.observers;i<r.length;i++){var o=r[i];t.expandByPoint(o.standingPosition),t.expandByPoint((new n.Vector3).fromArray([o.position.x,2*o.position.y-o.standingPosition.y,o.position.z]))}e&&t.expandByPoint(this.camera.position);var s=Fo(t,new n.Vector3(1,0,1));return s.name="panorama_bounding",s.frustumCulled=!1,s},t.prototype.doMoveToPano=function(e,t,i,r){var o,s,a,l,u=this;void 0===i&&(i={}),this.userAction=r;var c=Ue(),h=rr(),d=this.work.observers[e],p=this.panoResources[h]={panoIndex:e,workCode:this.work.workCode,effect:null!==(o=i.effect)&&void 0!==o?o:"fly",panoModel:t,matrix:(new n.Matrix4).compose(d.position,d.quaternion,Pa),position:d.position.clone()};t.visible=!1,t.renderOrder=-1,this.panoModelGroup.add(t);var f,A,m;if(this.locationMotion.ended){var g=this.locationMotion.getKeyFrameSegment(c);g[0];var v=g[1],y=this.locationMotion.value,b=this.panoResourceFromLocationMotionKeyframe(v).position,x=p.position;f=Math.max(b.distanceTo(x),1),A=[{key:v.key,progress:0,value:Fe(Fe({},y),{count:0})},{key:h,progress:1,value:{distance:0,perspToOrtho:0,modelAlpha:0,orthoDistance:1,count:1}}],m=0}else{var w=this.locationMotion.getKeyFrameSegment(c),E=w[0],M=(v=w[1],y=this.locationMotion.value,this.panoResourceFromLocationMotionKeyframe(E).position),S=(b=this.panoResourceFromLocationMotionKeyframe(v).position,x=p.position,v.value.count-y.count),C=Math.max(M.distanceTo(b),1)*S;f=C+Math.max(b.distanceTo(x),1),A=[{key:E.key,progress:0,value:Fe({},y)},{key:v.key,progress:C/f,value:v.value},{key:h,progress:1,value:{count:v.value.count+1,distance:0,perspToOrtho:0,orthoDistance:1,modelAlpha:0}}];var I=this.locationMotionKeyframesLength(this.locationMotion.keyframes),B=this.locationMotionKeyframesLength(A);m=0===I||0===I?0:this.locationMotion.getProgressVelocity(c)*I/B}var T=this.calculateMovingDuration(i.duration,"fade"===i.effect||"montage"===i.effect?0:f),P={longitude:i.longitude,latitude:i.latitude,fov:i.fov},R={longitude:null!==(s=P.longitude)&&void 0!==s?s:this.camera.pose.longitude,latitude:null!==(a=P.latitude)&&void 0!==a?a:this.camera.pose.latitude,fov:null!==(l=P.fov)&&void 0!==l?l:this.camera.pose.fov,offset:d.position.clone(),distance:this.camera.pose.distance};this.emit("moveToPano",e,this.userAction),i.moveStartCallback&&i.moveStartCallback(e,R),this.emit("panoWillArrive",e,R,this.userAction),this.cameraMotion.set(P,T).catch(qe),this.locationMotion.setKeyframes(A,T,m).then((function(){var t={longitude:u.camera.pose.longitude,latitude:u.camera.pose.latitude,fov:u.camera.pose.fov,offset:u.camera.pose.offset.clone(),distance:u.camera.pose.distance};i.moveEndCallback&&i.moveEndCallback(e,t),u.emit("panoArrived",e,t,r)}),(function(){i.moveCancelCallback&&i.moveCancelCallback(),u.emit("moveToPanoCanceled",e)}))},t.prototype.getForwardPanoIndexOrNot=function(e){var t=this,i=this.camera.getWorldDirection(new n.Vector3),r=this.camera.position.clone(),o=this.work.observers[this.currentPanoIndex];if(!o)return null;var s=o.accessibleNodes.filter((function(e){if(e===t.currentPanoIndex)return!1;var i=t.work.observers[e],o=i.standingPosition.clone().sub(r);return 0!==o.length()&&(!(o.angleTo(new n.Vector3(0,-1,0))<Math.PI/12)&&(i.loadable||i.active))})),a=(e?e.ray.direction.clone():i.clone()).setY(0);if(0===a.length())return null;for(var l=s.slice().sort((function(e,i){var n=t.work.observers[e].position.clone().setY(r.y),o=t.work.observers[i].position.clone().setY(r.y);return n.distanceTo(r)-o.distanceTo(r)})),u=0,c=[Math.PI/8,Math.PI/6,Math.PI/4,Math.PI/3];u<c.length;u++)for(var h=c[u],d=0,p=l;d<p.length;d++){var f=p[d],A=this.work.observers[f].position.clone().setY(r.y).sub(r);if(0!==A.length()&&a.angleTo(A)<h)return f}return null},t.prototype.onTapGesture=function(e){var t=this,i=e.pointers.map((function(e){return Tt(e,["x","y"])}));if(!this.emit("wantsGesture","tap",i,!0)){var r=this.relativeClientPosition(e.center),o=new n.Raycaster;if(o.setFromCamera(r,this.camera),!this.emit("wantsTapGesture",o,r,!0)){this.emit("gesture","tap",i,!0),this.emit("tapGesture",o,r,!0),this.interiaMovement=!1;var s=this.camera.getWorldDirection(new n.Vector3).setY(0),a=null,l=this.work.observers[this.currentPanoIndex];if(l){var u=l.accessibleNodes.filter((function(e){if(e===t.currentPanoIndex)return!1;var i=t.work.observers[e];return!(i.position.distanceTo(t.camera.position)>t.maxAccessibleDistance)&&(i.loadable||i.active)})),c=o.intersectObject(this.boundingMesh,!0)[0];if(c){var h=Go(u,(function(e){var i=t.work.observers[e].standingPosition.clone();return i.clone().sub(t.camera.position).setY(0).angleTo(s)>Math.PI/2?1/0:i.distanceTo(c.point)}),!0),d=h[0];h[1]<this.panoTapTriggerRadius&&(a=d)}vr(a)&&(a=this.getForwardPanoIndexOrNot(o));for(var p=0,f=this.locationMotion.keyframes;p<f.length;p++){var A=f[p],m=this.panoResourceFromLocationMotionKeyframe(A);if(!(A.progress<this.locationMotion.progress)&&m.panoIndex===a){a=null;break}}if(this.emit("panoSelected",a),vr(a))!0===this.locationMotion.ended&&this.cameraBounce();else{var g=this.work.observers[a];if(g.active){for(var v={},y=Math.PI/6,b=Math.PI/12,x=new n.Vector3(0,1,0),w=g.position.clone().setY(0).sub(l.position.clone().setY(0)).normalize(),E=w.clone().applyAxisAngle(x,y),M=w.clone().applyAxisAngle(x,-y),S=[],C=[],I=[],B=0,T=g.accessibleNodes;B<T.length;B++){if((d=T[B])!==this.currentPanoIndex&&d!==a){var P=this.work.observers[d].position.clone().sub(g.position).setY(0);w.angleTo(P)<y?I.push(P):E.angleTo(P)<y?S.push(P):M.angleTo(P)<y&&C.push(P)}}var R=(I.length>0?I:Oe(Oe([],S,!0),C,!0)).slice().sort((function(e,t){return e.angleTo(w)-t.angleTo(w)}))[0];R&&R.angleTo(s)>b&&(v.longitude=Math.atan2(-R.x,-R.z)),this.cameraMotion.value.latitude<-Math.PI/4&&(v.latitude=Er(0,this.minLatitude,this.maxLatitude)),this.emit("wantsMoveToPano",a,v,!0)}else this.panoMeshes[a]&&(this.panoMeshes[a].setDisabled(!1),this.panoMeshes[a].setLoading(!0))}}}}},t}(ms);function Da(e,t){var i=new n.Vector3;return i.setFromMatrixColumn(t,0),i.multiplyScalar(-e),i}function La(e,t,i){var r=new n.Vector3;return r.setFromMatrixColumn(i,0),r.crossVectors(t,r),r.multiplyScalar(e),r}var ka=function(e){function t(i){var n,r,o=this,s=t.parseArgs(i);return(o=e.call(this,s)||this).currentPanoIndex=s.initial[0],o.defaultLongitude=s.defaultLongitude,o.defaultLatitude=s.defaultLatitude,o.defaultDistance=s.defaultDistance,o.maxLatitude=s.maxLatitude,o.minLatitude=s.minLatitude,o.maxDistance=s.maxDistance,o.minDistance=s.minDistance,o.locationMotion=new Ur({x:o.camera.pose.offset.x,y:o.camera.pose.offset.y,z:o.camera.pose.offset.z,distance:o.camera.pose.distance,modelAlpha:null!==(r=null===(n=o.model.getMaterial())||void 0===n?void 0:n.modelAlpha)&&void 0!==r?r:0,perspToOrtho:o.camera.perspToOrtho.x,orthoDistance:o.camera.orthoDistance}),o}return ke(t,e),t.parseArgs=function(t){var i,n,r,o,s,a,l,u=e.parseArgs.call(this,t);return Fe(Fe({},u),{defaultLongitude:null!==(i=t.defaultLongitude)&&void 0!==i?i:Math.PI/4,defaultLatitude:null!==(n=t.defaultLatitude)&&void 0!==n?n:Math.PI/4,defaultDistance:null!==(r=t.defaultDistance)&&void 0!==r?r:100,maxLatitude:null!==(o=t.maxLatitude)&&void 0!==o?o:+Math.PI/2,minLatitude:null!==(s=t.minLatitude)&&void 0!==s?s:0,maxDistance:null!==(a=t.maxDistance)&&void 0!==a?a:100,minDistance:null!==(l=t.minDistance)&&void 0!==l?l:2})},t.distanceFromModel=function(e,t,i){var n=e.bounding,r=Math.pow(Math.pow(n.max.x-n.min.x+1,2)+Math.pow(n.max.y-n.min.y+1,2)+Math.pow(n.max.z-n.min.z+1,2),.5),o=r/2/Math.tan(Math.PI*t/360);return i<1&&(o/=i),isNaN(o)?r:o},t.initAnimationEndPose=function(e){var i,n,r=this.parseArgs(e),o=e.initial[0],s=e.initial[1];return{longitude:null!==(i=s.longitude)&&void 0!==i?i:r.defaultLongitude,latitude:Er(null!==(n=s.latitude)&&void 0!==n?n:r.defaultLatitude,r.minLatitude,r.maxLatitude),fov:90,offset:r.work.observers[o].position.clone(),distance:t.distanceFromModel(r.model,90,r.camera.aspect)}},t.prototype.destroy=function(){e.prototype.destroy.call(this),this.model.enableTiles=!1,this.locationMotion.dispose(),this.mouseWheelState&&clearTimeout(this.mouseWheelState.timer),delete this.mouseWheelState,delete this.panState},t.prototype.isReady=function(){return!1!==this.locationMotion.ended&&e.prototype.isReady.call(this)},t.prototype.updateWork=function(e,t,i,n,r){return this.work=e,this.updateCamera(i,n,r),!0},t.prototype.updateModel=function(t){e.prototype.updateModel.call(this,t);var i=t.bounding.getCenter(new n.Vector3);this.locationMotion.set({x:i.x,y:i.y,z:i.z},0).catch(qe),this.model.enableTiles=!0},t.prototype.updateTime=function(e,t){if(!this.destroyed){var i={},r={};this.locationMotion.ended||(this.locationMotion.update(e),i.modelAlpha=this.locationMotion.value.modelAlpha,this.camera.perspToOrtho.setScalar(Er(this.locationMotion.value.perspToOrtho,0,1)),this.camera.orthoDistance=this.locationMotion.value.orthoDistance,r.distance=this.locationMotion.value.distance,r.offset=new n.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z)),this.cameraMotion.ended||(this.cameraMotion.update(e),r.longitude=this.cameraMotion.value.longitude,r.latitude=this.cameraMotion.value.latitude,r.fov=this.cameraMotion.value.fov),_o(i)||this.model.setMaterial(i),_o(r)||this.setCamera(r)}},t.prototype.setCamera=function(t){e.prototype.setCamera.call(this,t);var i=this.camera.pose.offset.clone();if(this.model.bvhs.loaded){var r=new n.Raycaster(this.camera.getWorldPosition(new n.Vector3),this.camera.getWorldDirection(new n.Vector3)),o=this.model.intersectRaycaster(r)[0];o&&i.copy(o.point)}var s=Go(this.work.observers,(function(e){return e.position.distanceTo(i)})),a=this.work.observers.indexOf(s);a!==this.currentPanoIndex&&(this.emit("moveToPano",a,this.userAction),this.emit("panoWillArrive",a,Wo(this.camera.pose),this.userAction),this.currentPanoIndex=a,this.emit("panoArrived",a,Wo(this.camera.pose),this.userAction))},t.prototype.getTargetPose=function(){var e=this.cameraMotion.getKeyFrameSegment(Ue())[1],t=this.locationMotion.getKeyFrameSegment(Ue())[1];return{longitude:e.value.longitude,latitude:e.value.latitude,fov:e.value.fov,distance:t.value.distance,offset:new n.Vector3(t.value.x,t.value.y,t.value.z)}},t.prototype.initAnimation=function(e,i,r,o){var s,a,l=this;if(!this.destroyed){this.pending=!1,this.userAction=o;var u={longitude:null!==(s=i.longitude)&&void 0!==s?s:this.defaultLongitude,latitude:Er(null!==(a=i.latitude)&&void 0!==a?a:this.defaultLatitude,this.minLatitude,this.maxLatitude),fov:90,offset:this.model.bounding.getCenter(new n.Vector3),distance:t.distanceFromModel(this.model,90,this.camera.aspect)},c=Tt(u,["longitude","latitude","fov"]),h={x:u.offset.x,y:u.offset.y,z:u.offset.z,distance:u.distance,modelAlpha:1,perspToOrtho:0,orthoDistance:u.distance};this.emit("initAnimationWillStart",e,u,this.userAction),this.cameraMotion.set(c,r).catch(qe),this.locationMotion.set(h,r).then((function(){l.emit("initAnimationEnded",e,u,l.userAction)}),(function(t){var i=Wo(l.camera.pose);l.emit("initAnimationEnded",e,i,l.userAction)})).then((function(){l.model.enableTiles=!0}))}},t.prototype.getForwardPanoIndexOrNot=function(e){var t=this.work.observers.filter((function(e){return e.active})),i=this.model.intersectRaycaster(e)[0];if(!i)return null;var n=Go(t,(function(e){return e.standingPosition.distanceTo(i.point)}),!0),r=n[0];return n[1]<5?this.work.observers.indexOf(r):null},t.prototype.coordinatesForOffset=function(e){var t=this.cameraMotion.value.fov,i=this.camera.aspect,r=this.renderer.getSize(new n.Vector2);return{longitude:2*e.x/(r.x*this.scissor.width)*t/95*i,latitude:-2*e.y/(r.y*this.scissor.height)*t/95}},t.prototype.onPanGesture=function(e){var t=this.panState,i=e.pointers.length;if(e.isFinal?delete this.panState:this.panState={pointerLength:i,x:e.center.x,y:e.center.y},void 0!==t&&t.pointerLength===i){var r=e.pointers.map((function(e){return Tt(e,["x","y"])}));if(!this.emit("wantsGesture","pan",r,e.isFinal))if("mouse"===e.pointerType&&2===e.srcEvent.buttons){var o={x:e.center.x-t.x,y:e.center.y-t.y},s=new n.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z),a=this.model.bounding,l=a.getCenter(new n.Vector3),u={x:(a.max.x-a.min.x)/90*this.cameraMotion.value.fov,y:(a.max.y-a.min.y)/90*this.cameraMotion.value.fov,z:(a.max.z-a.min.z)/90*this.cameraMotion.value.fov},c=(this.camera.position.y-a.min.y)*Math.tan(this.camera.fov/2*Math.PI/180),h=this.renderer.getSize(new n.Vector2);s.add(Da(2*o.x*c/h.y,this.camera.matrix)),s.add(La(2*o.y*c/h.y,this.camera.up,this.camera.matrix)),s.x=Er(s.x,l.x-u.x,l.x+u.x),s.z=Er(s.z,l.z-u.z,l.z+u.z);var d={longitude:0,latitude:Math.PI/2,fov:this.cameraMotion.value.fov,offset:s,distance:this.locationMotion.value.distance};if(this.emit("wantsPanGesture",d,e.isFinal))return;this.emit("gesture","pan",r,e.isFinal),this.emit("panGesture",d,e.isFinal),this.userAction=!0,this.locationMotion.set({x:s.x,y:s.y,z:s.z},0).catch(qe)}else{s={x:e.center.x-t.x,y:e.center.y-t.y};var p=this.coordinatesForOffset(s),f=Vo(this.cameraMotion.value.longitude+-1*p.longitude),A=Er(this.cameraMotion.value.latitude+-1*p.latitude,this.minLatitude,this.maxLatitude);this.camera.aspect<1&&Math.abs(e.overallVelocityX)>.2&&Math.atan2(Math.abs(e.overallVelocityY),Math.abs(e.overallVelocityX))<Math.PI/6.923&&(A=this.cameraMotion.value.latitude);d={longitude:f,latitude:A,fov:this.cameraMotion.value.fov,offset:this.camera.pose.offset.clone(),distance:this.camera.pose.distance};if(this.emit("wantsPanGesture",d,e.isFinal))return;this.emit("gesture","pan",r,e.isFinal),this.emit("panGesture",d,e.isFinal),this.userAction=!0,this.interiaMovement=!1;var m={longitude:d.longitude,latitude:d.latitude,fov:d.fov};if(this.cameraMotion.set(m,0).catch(qe),e.isFinal)this.emit("wantsInteriaPan",d)||(this.interiaMovement=!0,e.velocityX,e.velocityY)}}},t.prototype.onPinchGesture=function(e){var t=this.pinchState||{},i=t.distance;t.offsetY;var r=!1;if("pinchstart"!==e.type){if("pinchend"===e.type&&(r=!0,delete this.pinchState),void 0!==i){this.pinchState={distance:i};var o=e.pointers.map((function(e){return Tt(e,["x","y"])}));if(this.emit("wantsGesture","pinch",o,r))return;var s=Er(i/e.scale,this.minDistance,this.maxDistance);if(this.emit("wantsPinchGesture",e.scale,this.camera.pose.fov,r))return;this.emit("gesture","pinch",o,r),this.emit("pinchGesture",e.scale,this.camera.pose.fov,r),this.userAction=!0,this.locationMotion.set({distance:s},0).catch(qe)}var a=this.panState,l=e.pointers.length;if(e.isFinal?delete this.panState:this.panState={pointerLength:l,x:e.center.x,y:e.center.y},void 0!==a&&a.pointerLength===l){var u=e.pointers.map((function(e){return Tt(e,["x","y"])}));if(!this.emit("wantsGesture","pinch",u,r)){var c=e.pointers.map((function(e){return Tt(e,["x","y"])}));if(!this.emit("wantsGesture","pinch",c,r)){var h={x:e.center.x-a.x,y:e.center.y-a.y},d=new n.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z),p=this.model.bounding,f=p.getCenter(new n.Vector3),A={x:(p.max.x-p.min.x)/90*this.cameraMotion.value.fov,y:(p.max.y-p.min.y)/90*this.cameraMotion.value.fov,z:(p.max.z-p.min.z)/90*this.cameraMotion.value.fov},m=(this.camera.position.y-p.min.y)*Math.tan(this.camera.fov/2*Math.PI/180),g=this.renderer.getSize(new n.Vector2);d.add(Da(2*h.x*m/g.y,this.camera.matrix)),d.add(La(2*h.y*m/g.y,this.camera.up,this.camera.matrix)),d.x=Er(d.x,f.x-A.x,f.x+A.x),d.z=Er(d.z,f.z-A.z,f.z+A.z);var v={longitude:0,latitude:Math.PI/2,fov:this.cameraMotion.value.fov,offset:d,distance:this.locationMotion.value.distance};this.emit("wantsPanGesture",v,e.isFinal)||(this.emit("gesture","pan",c,e.isFinal),this.emit("panGesture",v,e.isFinal),this.userAction=!0,this.locationMotion.set({x:d.x,y:d.y,z:d.z},0).catch(qe))}}}}else this.pinchState={distance:this.locationMotion.value.distance}},t.prototype.onMouseWheel=function(e){var t=this,i=(Math.abs(e.deltaY)>Math.abs(e.deltaX)?e.deltaY:e.deltaX)/-60,n=[{x:e.clientX,y:e.clientY,delta:i}];if(!this.emit("wantsGesture","mouseWheel",n,!1)){var r=Er(this.locationMotion.value.distance-i/2,this.minDistance,this.maxDistance);this.emit("wantsMouseWheel",i,this.camera.pose.fov,!1)||(this.emit("gesture","mouseWheel",n,!1),this.emit("mouseWheel",i,this.camera.pose.fov,!1),this.userAction=!0,this.locationMotion.set({distance:r},0).catch(qe),this.mouseWheelState&&clearTimeout(this.mouseWheelState.timer),this.mouseWheelState={timer:window.setTimeout((function(){delete t.mouseWheelState;t.emit("wantsGesture","mouseWheel",n,!0)||t.emit("wantsMouseWheel",i,t.camera.pose.fov,!0)||(t.emit("gesture","mouseWheel",n,!0),t.emit("mouseWheel",0,t.camera.pose.fov,!0))}),200)})}},t.prototype.onTapGesture=function(e){var t=e.pointers.map((function(e){return Tt(e,["x","y"])}));if(!this.emit("wantsGesture","tap",t,!0)){var i=this.relativeClientPosition(e.center),r=new n.Raycaster;if(r.setFromCamera(i,this.camera),!this.emit("wantsTapGesture",r,i,!0)){this.emit("gesture","tap",t,!0),this.emit("tapGesture",r,i,!0),this.interiaMovement=!1;var o=this.getForwardPanoIndexOrNot(r);if(!vr(o)){this.emit("panoSelected",o);var s={longitude:this.camera.pose.longitude,latitude:0};this.emit("wantsMoveToPano",o,s,!0)}}}},t.prototype.onPressGesture=function(e,t){var i,r,o=[e];if(this.emit("wantsGesture","press",o,t))return null===(i=this.pressState)||void 0===i||i.stop(),void delete this.pressState;var s=this.relativeClientPosition(e),a=new n.Raycaster;if(a.setFromCamera(s,this.camera),this.emit("wantsPressGesture",a,s,e.delta,t))return null===(r=this.pressState)||void 0===r||r.stop(),void delete this.pressState;this.emit("gesture","press",o,t),this.emit("pressGesture",a,s,e.delta,t)},t}(os),Fa={type:"move"},Oa=function(){function e(){this._targetRay=null,this._grip=null,this._hand=null,this._axes=[0,0]}return e.prototype.getHandSpace=function(){return null===this._hand&&(this._hand=new n.Group,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand},e.prototype.getTargetRaySpace=function(){return null===this._targetRay&&(this._targetRay=new n.Group,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new n.Vector3,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new n.Vector3),this._targetRay},e.prototype.getGripSpace=function(){return null===this._grip&&(this._grip=new n.Group,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new n.Vector3,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new n.Vector3),this._grip},e.prototype.dispatchEvent=function(e){return null!==this._targetRay&&this._targetRay.dispatchEvent(e),null!==this._grip&&this._grip.dispatchEvent(e),null!==this._hand&&this._hand.dispatchEvent(e),this},e.prototype.disconnect=function(e){return this.dispatchEvent({type:"disconnected",data:e}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this},e.prototype.getAxes=function(){return this._axes},e.prototype.update=function(e,t,i){var r=null,o=null,s=null,a=this._targetRay,l=this._grip,u=this._hand;if(e&&e.gamepad&&e.gamepad.axes&&(this._axes=[e.gamepad.axes[2],e.gamepad.axes[3]]),e&&"visible-blurred"!==t.session.visibilityState)if(null!==a&&null!==(r=t.getPose(e.targetRaySpace,i))&&(a.matrix.fromArray(r.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),r.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(r.linearVelocity)):a.hasLinearVelocity=!1,r.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(r.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(Fa)),u&&e.hand){s=!0;for(var c=0,h=e.hand.values();c<h.length;c++){var d=h[c],p=t.getJointPose(d,i);if(void 0===u.joints[d.jointName]){var f=new n.Group;f.matrixAutoUpdate=!1,f.visible=!1,u.joints[d.jointName]=f,u.add(f)}var A=u.joints[d.jointName];null!==p&&(A.matrix.fromArray(p.transform.matrix),A.matrix.decompose(A.position,A.rotation,A.scale),A.jointRadius=p.radius),A.visible=null!==p}var m=u.joints["index-finger-tip"],g=u.joints["thumb-tip"],v=m.position.distanceTo(g.position);u.inputState.pinching&&v>.025?(u.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!u.inputState.pinching&&v<=.015&&(u.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else null!==l&&e.gripSpace&&null!==(o=t.getPose(e.gripSpace,i))&&(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);return null!==a&&(a.visible=null!==r),null!==l&&(l.visible=null!==o),null!==u&&(u.visible=null!==s),this},e}(),Na=function(e){function t(t,i,r){var o,s,a,l=this;return(l=e.call(this)||this).isPanorama=null===(o=null==r?void 0:r.isPanorama)||void 0===o||o,l.machineType=null!==(s=null==r?void 0:r.machineType)&&void 0!==s?s:"Pico",l.renderer=t,l.gl=i,l.enabled=!1,l.session=null,l.referenceSpaceType=null!==(a=null==r?void 0:r.referenceSpaceType)&&void 0!==a?a:"local-floor",l.referenceSpace=null,l.controllers=[new Oa,new Oa],l.inputSourcesMap=new Map,l.cameraVR=new n.ArrayCamera,l.cameraL=new n.PerspectiveCamera,l.cameraR=new n.PerspectiveCamera,l.cameraL.viewport=new n.Vector4,l.cameraR.viewport=new n.Vector4,l.cameraL.layers.enable(1),l.cameraR.layers.enable(2),l.cameraVR.layers.enable(1),l.cameraVR.layers.enable(2),l.isPresenting=!1,l.currentDepthNear=null,l.currentDepthFar=null,l.cameraLPos=new n.Vector3,l.cameraRPos=new n.Vector3,l}return ke(t,e),t.prototype.getController=function(e){var t=this.controllers[e];return t||console.warn("no controller find"),t.getTargetRaySpace()},t.prototype.getCameras=function(){return{cameraL:this.cameraL,cameraR:this.cameraR,cameraVR:this.cameraVR}},t.prototype.updateCamera=function(e,t){null===t?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(t.matrixWorld,e.matrix),e.matrixWorldInverse.getInverse(e.matrixWorld)},t.prototype.setProjectionFromUnion=function(e,t,i){this.cameraLPos.setFromMatrixPosition(t.matrixWorld),this.cameraRPos.setFromMatrixPosition(i.matrixWorld);var n=this.cameraLPos.distanceTo(this.cameraRPos),r=t.projectionMatrix.elements,o=i.projectionMatrix.elements,s=r[14]/(r[10]-1),a=r[14]/(r[10]+1),l=(r[9]+1)/r[5],u=(r[9]-1)/r[5],c=(r[8]-1)/r[0],h=(o[8]+1)/o[0],d=s*c,p=s*h,f=n/(-c+h),A=f*-c;t.matrixWorld.decompose(e.position,e.quaternion,e.scale),e.translateX(A),e.translateZ(f),e.matrixWorld.compose(e.position,e.quaternion,e.scale),e.matrixWorldInverse.getInverse(e.matrixWorld);var m=s+f,g=a+f,v=d-A,y=p+(n-A),b=l*a/g*m,x=u*a/g*m;e.projectionMatrix.makePerspective(v,y,b,x,m,g)},t.prototype.getCamera=function(e){this.cameraVR.near=this.cameraR.near=this.cameraL.near=e.near,this.cameraVR.far=this.cameraR.far=this.cameraL.far=e.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 t=e.parent,i=this.cameraVR.cameras;this.updateCamera(this.cameraVR,t);for(var n=0;n<i.length;n++)this.updateCamera(i[n],t);e.matrixWorld.copy(this.cameraVR.matrixWorld);for(var r=e.children,o=(n=0,r.length);n<o;n++)r[n].updateMatrixWorld(!0);return 2===i.length?this.setProjectionFromUnion(this.cameraVR,this.cameraL,this.cameraR):this.cameraVR.projectionMatrix.copy(this.cameraL.projectionMatrix),this.cameraVR},t.prototype.updateInputSources=function(e){if(this.session){for(var t=this.session.inputSources,i=0;i<this.controllers.length;i++)this.inputSourcesMap.set(t[i],this.controllers[i]);for(i=0;i<e.removed.length;i++){var n=e.removed[i];(r=this.inputSourcesMap.get(n))&&(r.dispatchEvent({type:"disconnected",data:n}),this.inputSourcesMap.delete(n))}for(i=0;i<e.added.length;i++){var r;n=e.added[i];(r=this.inputSourcesMap.get(n))&&r.dispatchEvent({type:"connected",data:n})}}else console.warn("session is lose!")},t.prototype.onSessionEvent=function(e){var t=this.inputSourcesMap.get(e.inputSource);t&&t.dispatchEvent({type:e.type})},t.prototype.onSessionEnd=function(){this.inputSourcesMap.forEach((function(e,t){e.disconnect(t)})),this.inputSourcesMap.clear(),this.renderer.setFramebuffer(null),this.renderer.setRenderTarget(this.renderer.getRenderTarget()),this.isPresenting=!1,this.session=null,dt.shared.setContext(null),this.emit("webXRSessionEnd")},t.prototype.onRequestReferenceSpace=function(e){this.referenceSpace=e,this.isPresenting=!0,this.emit("webXRSessionStart")},t.prototype.setSession=function(e){var t=this;if(this.session=e,this.session){this.session.addEventListener("select",(function(e){t.onSessionEvent(e)})),this.session.addEventListener("selectstart",(function(e){t.onSessionEvent(e)})),this.session.addEventListener("selectend",(function(e){t.onSessionEvent(e)})),this.session.addEventListener("squeeze",(function(e){t.onSessionEvent(e)})),this.session.addEventListener("squeezestart",(function(e){t.onSessionEvent(e)})),this.session.addEventListener("squeezeend",(function(e){t.onSessionEvent(e)})),this.session.addEventListener("end",(function(e){t.onSessionEnd()}));var i=this.gl.getContextAttributes();this.gl.makeXRCompatible().then((function(){var e={antialias:null==i?void 0:i.antialias,alpha:null==i?void 0:i.alpha,depth:null==i?void 0:i.depth,stencil:null==i?void 0:i.stencil,framebufferScaleFactor:1};if(t.session){switch(t.machineType){case"Pico":t.session.updateRenderState({baseLayer:new XRWebGLLayer(t.session,t.gl,e)});break;case"Oculus":t.session.updateRenderState({layers:[new XRWebGLLayer(t.session,t.gl,e)]});break;default:t.machineType}t.session.requestReferenceSpace(t.referenceSpaceType).then((function(e){t.onRequestReferenceSpace(e)})),t.session.addEventListener("inputsourceschange",(function(e){t.updateInputSources(e)}))}else console.error("session is lose while set session!")}))}},t}(He),Va=["webXRSessionStart","webXRSessionEnd"],Qa=function(e){function t(){var t=e.call(this)||this;t.type="LineSegmentsGeometry";return t.setIndex([0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5]),t.setAttribute("position",new n.Float32BufferAttribute([-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],3)),t.setAttribute("uv",new n.Float32BufferAttribute([-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],2)),t}return ke(t,e),t.prototype.applyMatrix4=function(e){var t=this.attributes.instanceStart,i=this.attributes.instanceEnd;return void 0!==t&&(t.applyMatrix4(e),i.applyMatrix4(e),t.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},t.prototype.setPositions=function(e){var t;t=e instanceof Float32Array?e:Array.isArray(e)?new Float32Array(e):new Float32Array;var i=new n.InstancedInterleavedBuffer(t,6,1);return this.setAttribute("instanceStart",new n.InterleavedBufferAttribute(i,3,0)),this.setAttribute("instanceEnd",new n.InterleavedBufferAttribute(i,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this},t.prototype.setColors=function(e){var t;t=e instanceof Float32Array?e:Array.isArray(e)?new Float32Array(e):new Float32Array;var i=new n.InstancedInterleavedBuffer(t,6,1);return this.setAttribute("instanceColorStart",new n.InterleavedBufferAttribute(i,3,0)),this.setAttribute("instanceColorEnd",new n.InterleavedBufferAttribute(i,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 n.WireframeGeometry(e.geometry)),this},t.prototype.fromLineSegments=function(e){var t=e.geometry;if(t instanceof n.Geometry){var i=(new n.BufferGeometry).fromGeometry(t);this.setPositions(i.attributes.position.array)}else t instanceof n.BufferGeometry&&this.setPositions(t.attributes.position.array);return this},t.prototype.computeBoundingBox=function(){null===this.boundingBox&&(this.boundingBox=new n.Box3);var e=this.attributes.instanceStart,t=this.attributes.instanceEnd;if(void 0!==e&&void 0!==t){var i=new n.Box3;this.boundingBox.setFromBufferAttribute(e),i.setFromBufferAttribute(t),this.boundingBox.union(i)}},t.prototype.computeBoundingSphere=function(){null===this.boundingSphere&&(this.boundingSphere=new n.Sphere),null===this.boundingBox&&this.computeBoundingBox();var e=this.attributes.instanceStart,t=this.attributes.instanceEnd;if(void 0!==e&&void 0!==t){var i=this.boundingSphere.center;this.boundingBox.getCenter(i);for(var r=0,o=new n.Vector3,s=0,a=e.count;s<a;s++)o.fromBufferAttribute(e,s),r=Math.max(r,i.distanceToSquared(o)),o.fromBufferAttribute(t,s),r=Math.max(r,i.distanceToSquared(o));this.boundingSphere.radius=Math.sqrt(r),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}(n.InstancedBufferGeometry);Object.assign(Qa.prototype,{isLineSegmentsGeometry:!0});var Ha={uniforms:n.UniformsUtils.merge([n.UniformsLib.common,n.UniformsLib.fog,{linewidth:{value:1},resolution:{value:new n.Vector2(1,1)},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1},opacity:{value:1}}]),vertexShader:"\n\t\t#include <common>\n\t\t#include <color_pars_vertex>\n\t\t#include <fog_pars_vertex>\n\t\t#include <logdepthbuf_pars_vertex>\n\t\t#include <clipping_planes_pars_vertex>\n\n\t\tuniform float linewidth;\n\t\tuniform vec2 resolution;\n\n\t\tattribute vec3 instanceStart;\n\t\tattribute vec3 instanceEnd;\n\n\t\tattribute vec3 instanceColorStart;\n\t\tattribute vec3 instanceColorEnd;\n\n\t\tvarying vec2 vUv;\n\n\t\t#ifdef USE_DASH\n\n\t\t\tuniform float dashScale;\n\t\t\tattribute float instanceDistanceStart;\n\t\t\tattribute float instanceDistanceEnd;\n\t\t\tvarying float vLineDistance;\n\n\t\t#endif\n\n\t\tvoid trimSegment( const in vec4 start, inout vec4 end ) {\n\n\t\t\t// trim end segment so it terminates between the camera plane and the near plane\n\n\t\t\t// conservative estimate of the near plane\n\t\t\tfloat a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column\n\t\t\tfloat b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column\n\t\t\tfloat nearEstimate = - 0.5 * b / a;\n\n\t\t\tfloat alpha = ( nearEstimate - start.z ) / ( end.z - start.z );\n\n\t\t\tend.xyz = mix( start.xyz, end.xyz, alpha );\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\t#ifdef USE_COLOR\n\n\t\t\t\tvColor.xyz = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd;\n\n\t\t\t#endif\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd;\n\n\t\t\t#endif\n\n\t\t\tfloat aspect = resolution.x / resolution.y;\n\n\t\t\tvUv = uv;\n\n\t\t\t// camera space\n\t\t\tvec4 start = modelViewMatrix * vec4( instanceStart, 1.0 );\n\t\t\tvec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 );\n\n\t\t\t// special case for perspective projection, and segments that terminate either in, or behind, the camera plane\n\t\t\t// clearly the gpu firmware has a way of addressing this issue when projecting into ndc space\n\t\t\t// but we need to perform ndc-space calculations in the shader, so we must address this issue directly\n\t\t\t// perhaps there is a more elegant solution -- WestLangley\n\n\t\t\tbool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column\n\n\t\t\tif ( perspective ) {\n\n\t\t\t\tif ( start.z < 0.0 && end.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( start, end );\n\n\t\t\t\t} else if ( end.z < 0.0 && start.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( end, start );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// clip space\n\t\t\tvec4 clipStart = projectionMatrix * start;\n\t\t\tvec4 clipEnd = projectionMatrix * end;\n\n\t\t\t// ndc space\n\t\t\tvec2 ndcStart = clipStart.xy / clipStart.w;\n\t\t\tvec2 ndcEnd = clipEnd.xy / clipEnd.w;\n\n\t\t\t// direction\n\t\t\tvec2 dir = ndcEnd - ndcStart;\n\n\t\t\t// account for clip-space aspect ratio\n\t\t\tdir.x *= aspect;\n\t\t\tdir = normalize( dir );\n\n\t\t\t// perpendicular to dir\n\t\t\tvec2 offset = vec2( dir.y, - dir.x );\n\n\t\t\t// undo aspect ratio adjustment\n\t\t\tdir.x /= aspect;\n\t\t\toffset.x /= aspect;\n\n\t\t\t// sign flip\n\t\t\tif ( position.x < 0.0 ) offset *= - 1.0;\n\n\t\t\t// endcaps\n\t\t\tif ( position.y < 0.0 ) {\n\n\t\t\t\toffset += - dir;\n\n\t\t\t} else if ( position.y > 1.0 ) {\n\n\t\t\t\toffset += dir;\n\n\t\t\t}\n\n\t\t\t// adjust for linewidth\n\t\t\toffset *= linewidth;\n\n\t\t\t// adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ...\n\t\t\toffset /= resolution.y;\n\n\t\t\t// select end\n\t\t\tvec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd;\n\n\t\t\t// back to clip space\n\t\t\toffset *= clip.w;\n\n\t\t\tclip.xy += offset;\n\n\t\t\tgl_Position = clip;\n\n\t\t\tvec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation\n\n\t\t\t#include <logdepthbuf_vertex>\n\t\t\t#include <clipping_planes_vertex>\n\t\t\t#include <fog_vertex>\n\n\t\t}\n\t\t",fragmentShader:"\n\t\tuniform vec3 diffuse;\n\t\tuniform float opacity;\n\n\t\t#ifdef USE_DASH\n\n\t\t\tuniform float dashSize;\n\t\t\tuniform float gapSize;\n\n\t\t#endif\n\n\t\tvarying float vLineDistance;\n\n\t\t#include <common>\n\t\t#include <color_pars_fragment>\n\t\t#include <fog_pars_fragment>\n\t\t#include <logdepthbuf_pars_fragment>\n\t\t#include <clipping_planes_pars_fragment>\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\t#include <clipping_planes_fragment>\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tif ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps\n\n\t\t\t\tif ( mod( vLineDistance, dashSize + gapSize ) > dashSize ) discard; // todo - FIX\n\n\t\t\t#endif\n\n\t\t\tif ( abs( vUv.y ) > 1.0 ) {\n\n\t\t\t\tfloat a = vUv.x;\n\t\t\t\tfloat b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n\t\t\t\tfloat len2 = a * a + b * b;\n\n\t\t\t\tif ( len2 > 1.0 ) discard;\n\n\t\t\t}\n\n\t\t\tvec4 diffuseColor = vec4( diffuse, opacity );\n\n\t\t\t#include <logdepthbuf_fragment>\n\t\t\t#include <color_fragment>\n\n\t\t\tgl_FragColor = vec4( diffuseColor.rgb, diffuseColor.a );\n\n\t\t\t#include <tonemapping_fragment>\n\t\t\t#include <fog_fragment>\n\t\t\t#include <premultiplied_alpha_fragment>\n\n\t\t}\n\t\t"},qa=function(e){function t(t){var i=e.call(this,{uniforms:n.UniformsUtils.clone(Ha.uniforms),vertexShader:Ha.vertexShader,fragmentShader:Ha.fragmentShader,clipping:!0})||this;return i.type="LineMaterial",i.dashed=!1,Object.defineProperties(i,{color:{enumerable:!0,get:function(){return this.uniforms.diffuse.value},set:function(e){this.uniforms.diffuse.value=e}},linewidth:{enumerable:!0,get:function(){return this.uniforms.linewidth.value},set:function(e){this.uniforms.linewidth.value=e}},dashScale:{enumerable:!0,get:function(){return this.uniforms.dashScale.value},set:function(e){this.uniforms.dashScale.value=e}},dashSize:{enumerable:!0,get:function(){return this.uniforms.dashSize.value},set:function(e){this.uniforms.dashSize.value=e}},gapSize:{enumerable:!0,get:function(){return this.uniforms.gapSize.value},set:function(e){this.uniforms.gapSize.value=e}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(e){this.uniforms.opacity.value=e}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(e){this.uniforms.resolution.value.copy(e)}}}),i.setValues(t),i}return ke(t,e),t}(n.ShaderMaterial);Object.assign(qa.prototype,{isLineMaterial:!0});var za=function(e){function t(t,i){var n=e.call(this)||this;return n.type="LineSegments2",n.geometry=void 0!==t?t:new Qa,n.material=void 0!==i?i:new qa({color:16777215*Math.random()}),n}return ke(t,e),t.prototype.computeLineDistances=function(){for(var e=this.geometry,t=e.attributes.instanceStart,i=e.attributes.instanceEnd,r=new Float32Array(2*t.count),o=new n.Vector3,s=new n.Vector3,a=0,l=0,u=t.count;a<u;a++,l+=2)o.fromBufferAttribute(t,a),s.fromBufferAttribute(i,a),r[l]=0===l?0:r[l-1],r[l+1]=r[l]+o.distanceTo(s);var c=new n.InstancedInterleavedBuffer(r,2,1);return e.setAttribute("instanceDistanceStart",new n.InterleavedBufferAttribute(c,1,0)),e.setAttribute("instanceDistanceEnd",new n.InterleavedBufferAttribute(c,1,1)),this},t.prototype.raycast=function(e,t){null===e.camera&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2.');var i=e.ray,r=e.camera,o=r.projectionMatrix,s=this.geometry,a=this.material,l=a.resolution,u=a.linewidth,c=s.attributes.instanceStart,h=s.attributes.instanceEnd,d=new n.Vector4,p=new n.Vector4,f=new n.Vector4,A=new n.Vector3,m=new n.Matrix4,g=new n.Line3,v=new n.Vector3;i.at(1,f),f.w=1,f.applyMatrix4(r.matrixWorldInverse),f.applyMatrix4(o),f.multiplyScalar(1/f.w),f.x*=l.x/2,f.y*=l.y/2,f.z=0,A.copy(f);var y=this.matrixWorld;m.multiplyMatrices(r.matrixWorldInverse,y);for(var b=0,x=c.count;b<x;b++){d.fromBufferAttribute(c,b),p.fromBufferAttribute(h,b),d.w=1,p.w=1,d.applyMatrix4(m),p.applyMatrix4(m),d.applyMatrix4(o),p.applyMatrix4(o),d.multiplyScalar(1/d.w),p.multiplyScalar(1/p.w);var w=d.z<-1&&p.z<-1,E=d.z>1&&p.z>1;if(!w&&!E){d.x*=l.x/2,d.y*=l.y/2,p.x*=l.x/2,p.y*=l.y/2,g.start.copy(d),g.start.z=0,g.end.copy(p),g.end.z=0;var M=g.closestPointToPointParameter(A,!0);g.at(M,v);var S=n.MathUtils.lerp(d.z,p.z,M),C=S>=-1&&S<=1,I=A.distanceTo(v)<.5*u;if(C&&I){g.start.fromBufferAttribute(c,b),g.end.fromBufferAttribute(h,b),g.start.applyMatrix4(y),g.end.applyMatrix4(y);var B=new n.Vector3,T=new n.Vector3;i.distanceSqToSegment(g.start,g.end,T,B),t.push({point:T,pointOnLine:B,distance:i.origin.distanceTo(T),object:this,faceIndex:b})}}}},t}(n.Mesh);Object.assign(za.prototype,{isLineSegments2:!0});var Ua=function(e){function t(t,i){var n=e.call(this,t,i)||this;return n.type="Line2",n}return ke(t,e),t}(za);Object.assign(Ua.prototype,{isLine2:!0});var ja=function(e){function t(){var t=e.call(this)||this;return t.type="LineGeometry",t}return ke(t,e),t.prototype.setPositions=function(t){for(var i=t.length-3,n=new Float32Array(2*i),r=0;r<i;r+=3)n[2*r]=t[r],n[2*r+1]=t[r+1],n[2*r+2]=t[r+2],n[2*r+3]=t[r+3],n[2*r+4]=t[r+4],n[2*r+5]=t[r+5];return e.prototype.setPositions.call(this,n),this},t.prototype.setColors=function(t){for(var i=t.length-3,n=new Float32Array(2*i),r=0;r<i;r+=3)n[2*r]=t[r],n[2*r+1]=t[r+1],n[2*r+2]=t[r+2],n[2*r+3]=t[r+3],n[2*r+4]=t[r+4],n[2*r+5]=t[r+5];return e.prototype.setColors.call(this,n),this},t.prototype.fromLine=function(e){var t=e.geometry;if(t instanceof n.Geometry){var i=(new n.BufferGeometry).fromGeometry(t);this.setPositions(i.attributes.position.array)}else t instanceof n.BufferGeometry&&this.setPositions(t.attributes.position.array);return this},t.prototype.copy=function(){return this},t}(Qa);Object.assign(ja.prototype,{isLineGeometry:!0});var Ka=null,Ga=function(e){function t(t,i){void 0===t&&(t=new n.Vector3),void 0===i&&(i=new n.Vector3);var r=e.call(this)||this;r.type="FiveLine",r.needsRender=!0;var o=new ja,s=new qa({color:14467195,linewidth:2,dashScale:20,dashed:!1});r.line=new Ua(o,s);var a=new n.BufferGeometry,l=new n.PointsMaterial({color:14467195,size:8,map:Ka||(Ka=(new n.TextureLoader).load("data:image/png;base64,iVBORw0K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jckOm6biFQ3jwNPwDMZrOnqVTqfb3Bi8Wivru7W/VCYkwPlKOjo0IikXh7EwQikYgE4Nw0CfXKDCipVCoTj8df3QABbW1tLUc6oUgkFPMkVACUNjc337148eKvw8PDbJ2jP1taWkoCyNDVXDSECmNSK4qiKNLq6urW8+fPI/UicHx8rD59+jSVy+WOAKSJhKENwFItLtoxk8mwsixzHR0dHe3t7c5PAU+n09rs7OzJkydPYqVSaQfANoDXALIk31S2smU1TWMPDg7K5XKZ7+3t9TudTut1U7+wsFCcmJiIpdPpbQBxADsAknQWymYCOukBHYCuKApisdhpMpnURFEU79y503TVyKenpzOTk5M7e3t7MQKPV0Zv1gNm+awB0MvlshqLxfLb29uyJElWURSbXC4XXyvqxcXFs6mpqeTc3Nzu3t7e3wQcA7BPZ8Cov1pNlJplmQtAG8MwHV6v95tAINA5MDBwPxAIuLu6upr8fr/VAN3c3JQjkcjZ+vp6fnl5+d2bN29SuVzuNYAEpf01CdRChUL+X1VskHACuA3Ay3Fcu9vt7nA6nZ7m5uYWQRCaNE3jVVW15PP580KhIGUymWw2m00DOAJwSP4WwPtq4LX2Ao6USxNlQyS/RcQcdLGwlNIz6vEMAaZpNzCk2Pll94LK/cDYimxERiBwG10sxjgvEZBE0UpE6vxj+0Ct5bTaXthgEhRmja8QWNkkPGsuIpfdjpkK+cZUWTC0KredVmtD/gdlSl6EG4AMvQAAAABJRU5ErkJggg==")),sizeAttenuation:!1,transparent:!0});return r.points=new n.Points(a,l),r.points.renderOrder=11,r.points.frustumCulled=!1,r.setPoints(t,i),r.add(r.line,r.points),r}return ke(t,e),Object.defineProperty(t,"version",{get:function(){return"5.0.0-alpha.167"},enumerable:!1,configurable:!0}),t.prototype.setPoints=function(e,t){var i=[].concat(e.toArray(),t.toArray());this.points.geometry.setAttribute("position",new n.BufferAttribute(new Float32Array(i),3)),this.line.geometry.setPositions(i),this.line.computeLineDistances(),this.needsRender=!0},t.prototype.getPoints=function(){var e=this.points.geometry.attributes.position.array;return[new n.Vector3(e[0],e[1],e[2]),new n.Vector3(e[3],e[4],e[5])]},t.prototype.setMaterial=function(e){var t=this.line.material;for(var i in e)if(e.hasOwnProperty(i)){var n=e[i];"dashed"===i?(t.dashed=n,n?t.defines.USE_DASH="":delete t.defines.USE_DASH,t.needsUpdate=!0):t[i]=e[i]}this.needsRender=!0},t.prototype.setResolution=function(e,t){var i=this.line.material.resolution;i.x===e&&i.y===t||(i.set(e,t),this.needsRender=!0)},t}(n.Object3D);Object.assign(Ga.prototype,{isFiveLine:!0});var _a=(new n.Matrix4).makeRotationAxis(new n.Vector3(0,1,0),Math.PI),Wa=new n.Vector3(-1,1,1),Xa=function(e){function t(t){var i=e.call(this,t)||this;i.xrManager=new Na(i.renderer,i.renderer.getContext()),i.xrControllerRay=new n.Raycaster,i.pointerLine=new Ga,i.scene.add(i.pointerLine),i.pointerLine.line.material.depthTest=!1,i.pointerLine.points.material instanceof Array?i.pointerLine.points.material.forEach((function(e){e.depthTest=!1})):i.pointerLine.points.material.depthTest=!1,i.pointerLine.setMaterial({color:new n.Vector3(1,1,1)}),i.panoResources={},i.panoResources[i.locationMotion.keyframes[0].key=i.locationMotion.keyframes[1].key=rr()]={panoIndex:i.currentPanoIndex,workCode:i.work.workCode,leftPanoPicture:null,position:i.camera.pose.offset.clone(),effect:"fade"},i.parallaxCameraMatrixs=[];var r=dt.shared.getContext();if(!r)return console.error("获取session失败,请退出重试"),i;i.xrManager.setSession(r),i.on("webXRSelected",(function(e){"Select"===e&&i.checkSelectedPano()}));for(var o=function(e){s.xrManager.on(e,(function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];i.emit.apply(i,Oe([e],t,!1))}))},s=this,a=0,l=Va;a<l.length;a++){o(l[a])}return i.xrControllerState={axes:[{left:{isTap:!1,startTime:0},right:{isTap:!1,startTime:0}},{up:{isTap:!1,startTime:0},down:{isTap:!1,startTime:0}},{left:{isTap:!1,startTime:0},right:{isTap:!1,startTime:0}},{up:{isTap:!1,startTime:0},down:{isTap:!1,startTime:0}}],select:{startTime:0,istap:!1},squeeze:{startTime:0,istap:!1},leftButtonA:{startTime:0,istap:!1},leftButtonB:{startTime:0,istap:!1},rightButtonA:{startTime:0,istap:!1},rightButtonB:{startTime:0,istap:!1}},i}return ke(t,e),t.parseArgs=function(t){var i=Fe(Fe({},t),{maxLatitude:Math.PI/2,minLatitude:-Math.PI/2});return e.parseArgs.call(this,i)},t.initAnimationEndPose=function(t){var i=this.parseArgs(t);return e.initAnimationEndPose.call(this,i)},t.prototype.moveToPano=function(e,t,i){var r,o,s,a,l=this,u=this.work.observers[e],c=this.imageOptions.size;if(void 0===c&&u){var h=u.images.up.match(/\/cube_(\d+)\//);h&&(c=Number(h[1]))}void 0===c&&(c=2048);var d=this.imageOptions.transform,p=function(e,t){return function(e,t){if(!t)return e;var i=e.match(/\d+_[a-z].png/);return e.substring(0,i.index)+t+"/"+e.substring(i.index)}(gt(e,d,t))},f=Fe({key:"pano.".concat(e),basisLoaderInitialized:ii.isInitialized()},Tt(this.imageOptions,["format","size","quality"])),A=u.images,m=null!==(o=null===(r=u.images.tiles)||void 0===r?void 0:r.filter((function(e){return e.size>c})))&&void 0!==o?o:null,g="pano:"+fs([A,f,d]);if(this.pendingTextureTask){if(this.pendingTextureTask.hash===g)return;var v=this.pendingTextureTask.panoIndex;null===(s=this.panoMeshes[v])||void 0===s||s.setProgress(0),this.emit("textureAbort",v,u),this.pendingTextureTask.onError(new Error("texture aborted"))}var y,b=this.model.getMaterial()||{},x=b.pano0,w=b.pano1;if((null==x?void 0:x.map.name)===g?y=x:(null==w?void 0:w.map.name)===g&&(y=w),y){var E={panoIndex:e,workCode:this.work.workCode,effect:null!==(a=t.effect)&&void 0!==a?a:"fade",leftPanoPicture:{map:y.map,luminanceMap:y.luminanceMap,matrix:(new n.Matrix4).compose(u.position,u.quaternion,Wa)},position:u.position.clone()};this.doMoveToPano(e,E,t,i)}else this.pending=!0,this.pendingTextureTask={panoIndex:e,hash:g,onLoad:function(r){var o;if(l.pending=!1,l.destroyed)r.body.dispose();else{r.body.name=g;var s={panoIndex:e,workCode:l.work.workCode,effect:null!==(o=t.effect)&&void 0!==o?o:"fade",leftPanoPicture:{map:r.body,luminanceMap:null,matrix:(new n.Matrix4).compose(u.position,u.quaternion,Wa)},position:u.position.clone()};l.doMoveToPano(e,s,t,i)}},onError:function(i){l.pending=!1,t.moveCancelCallback&&t.moveCancelCallback(),l.emit("panoLoadError",i,e),l.emit("moveToPanoCanceled",e)}},Promise.all([this.tileLevelForFov&&m&&m.length?this.textureLoader.loadTiledCubeTexture(A,m,{tileMaxLevel:this.TILED_CUBE_TEXTURE_LEVEL,imageURL:{transform:p,options:f},format:n.RGBAFormat,viaAjax:!0},void 0,void 0,(function(t){var i,n;l.emit("textureLoading",t,e,u),(null===(i=l.pendingTextureTask)||void 0===i?void 0:i.hash)===g&&(null===(n=l.panoMeshes[e])||void 0===n||n.setProgress(t))}),this.renderer):this.textureLoader.loadCubeTexture(A,{imageURL:{transform:p,options:f},format:n.RGBAFormat},void 0,void 0,(function(t){var i,n;(null===(i=l.pendingTextureTask)||void 0===i?void 0:i.hash)===g&&(null===(n=l.panoMeshes[e])||void 0===n||n.setProgress(t)),l.emit("textureLoading",t,e,u)}),this.renderer)]).then((function(t){var i,n,r=t[0];(null===(i=l.pendingTextureTask)||void 0===i?void 0:i.hash)===g?(l.pendingTextureTask.onLoad(r),null===(n=l.panoMeshes[e])||void 0===n||n.setProgress(0),delete l.pendingTextureTask,l.emit("textureLoaded",e,u,r.meta)):r.body.dispose()})).catch((function(t){var i,n;(null===(i=l.pendingTextureTask)||void 0===i?void 0:i.hash)===g&&(l.pendingTextureTask.onError(t),null===(n=l.panoMeshes[e])||void 0===n||n.setProgress(0),delete l.pendingTextureTask,l.emit("textureError",t,e,u),l.emit("error",t))})),this.emit("textureStartLoad",e,u)},t.prototype.doMoveToPano=function(e,t,i,r){var o,s,a,l=this;void 0===i&&(i={}),this.userAction=r;var u=Ue(),c=rr();this.panoResources[c]=t;var h,d,p;if(this.locationMotion.ended){var f=this.locationMotion.getKeyFrameSegment(u);f[0];var A=f[1],m=this.locationMotion.value,g=this.panoResourceFromLocationMotionKeyframe(A).position,v=t.position;h=Math.max(g.distanceTo(v),1),d=[{key:A.key,progress:0,value:Fe(Fe({},m),{count:0})},{key:c,progress:1,value:{distance:0,perspToOrtho:0,orthoDistance:1,modelAlpha:0,count:1}}],p=0}else{var y=this.locationMotion.getKeyFrameSegment(u),b=y[0],x=(A=y[1],m=this.locationMotion.value,this.panoResourceFromLocationMotionKeyframe(b).position),w=(g=this.panoResourceFromLocationMotionKeyframe(A).position,v=t.position,A.value.count-m.count),E=Math.max(x.distanceTo(g),1)*w;h=E+Math.max(g.distanceTo(v),1),d=[{key:b.key,progress:0,value:Fe({},m)},{key:A.key,progress:E/h,value:A.value},{key:c,progress:1,value:{count:A.value.count+1,distance:0,perspToOrtho:0,orthoDistance:1,modelAlpha:0}}];var M=this.locationMotionKeyframesLength(this.locationMotion.keyframes),S=this.locationMotionKeyframesLength(d);p=this.locationMotion.getProgressVelocity(u)*M/S}var C=this.calculateMovingDuration(i.duration,h),I={longitude:i.longitude,latitude:i.latitude,fov:i.fov},B={longitude:null!==(o=I.longitude)&&void 0!==o?o:this.camera.pose.longitude,latitude:null!==(s=I.latitude)&&void 0!==s?s:this.camera.pose.latitude,fov:null!==(a=I.fov)&&void 0!==a?a:this.camera.pose.fov,offset:t.position.clone(),distance:0};this.emit("moveToPano",e,this.userAction),i.moveStartCallback&&i.moveStartCallback(e,B),this.emit("panoWillArrive",e,B,this.userAction),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=qe,this.videoTexture.needsUpdate=!0),this.panoVideo.setMaterial(null),this.cameraMotion.set(I,C).catch(qe),this.locationMotion.setKeyframes(d,C,p).then((function(){var t,o,s,a={longitude:l.camera.pose.longitude,latitude:l.camera.pose.latitude,fov:l.camera.pose.fov,offset:l.camera.pose.offset.clone(),distance:0};i.moveEndCallback&&i.moveEndCallback(e,a),l.emit("panoArrived",e,a,r);var u=l.work.observers[l.currentPanoIndex];if(u&&u.video&&l.videoTexture&&l.videoTexture.image instanceof HTMLVideoElement){var c=_a.clone().multiply(null!==(s=null===(o=null===(t=l.model.getMaterial())||void 0===t?void 0:t.pano1)||void 0===o?void 0:o.matrix)&&void 0!==s?s:new n.Matrix4).multiply(u.video.matrix),h={map:l.videoTexture,size:u.video.size,matrix:c,alpha:1},d=rr(),p=l.videoTexture.image;p.setAttribute("uuid",d),gs().then((function(e){e&&u.video&&p.getAttribute("uuid")===d&&(p.oncanplay=function(){p.oncanplay=qe,p.play()},p.ontimeupdate=function(){p.currentTime>.5&&(p.ontimeupdate=qe,l.panoVideo.setMaterial(h))},p.src=u.video.source)})).catch((function(){p.removeAttribute("uuid")}))}}),(function(){i.moveCancelCallback&&i.moveCancelCallback(),l.emit("moveToPanoCanceled",e)}))},t.prototype.checkSelectedPano=function(){var e=this,t=this.xrControllerRay;this.interiaMovement=!1;var i=this.camera.getWorldDirection(new n.Vector3).setY(0),r=null,o=this.work.observers[this.currentPanoIndex];if(!o)return r;var s=o.accessibleNodes.filter((function(t){if(t===e.currentPanoIndex)return!1;var i=e.work.observers[t];return!(i.position.distanceTo(e.camera.position)>e.maxAccessibleDistance)&&(i.loadable||i.active)})),a=this.model.intersectRaycaster(t)[0];if(a){var l=Go(s,(function(t){var n=e.work.observers[t].standingPosition.clone();return n.clone().sub(e.camera.position).setY(0).angleTo(i)>Math.PI/2?1/0:n.distanceTo(a.point)}),!0),u=l[0];l[1]<this.panoTapTriggerRadius&&(r=u)}vr(r)&&(r=this.getForwardPanoIndexOrNot(t));for(var c=0,h=this.locationMotion.keyframes;c<h.length;c++){var d=h[c],p=this.panoResourceFromLocationMotionKeyframe(d);if(!(d.progress<this.locationMotion.progress)&&p.panoIndex===r){r=null;break}}if(this.emit("panoSelected",r),vr(r))return!0===this.locationMotion.ended&&this.cameraBounce(),r;var f=this.work.observers[r];if(!f.active)return this.panoMeshes[r]&&(this.panoMeshes[r].setDisabled(!1),this.panoMeshes[r].setLoading(!0)),r;for(var A={effect:"fade"},m=Math.PI/6,g=Math.PI/12,v=new n.Vector3(0,1,0),y=f.position.clone().setY(0).sub(o.position.clone().setY(0)).normalize(),b=y.clone().applyAxisAngle(v,m),x=y.clone().applyAxisAngle(v,-m),w=[],E=[],M=[],S=0,C=f.accessibleNodes;S<C.length;S++){if((u=C[S])!==this.currentPanoIndex&&u!==r){var I=this.work.observers[u].position.clone().sub(f.position).setY(0);y.angleTo(I)<m?M.push(I):b.angleTo(I)<m?w.push(I):x.angleTo(I)<m&&E.push(I)}}var B=(M.length>0?M:Oe(Oe([],w,!0),E,!0)).slice().sort((function(e,t){return e.angleTo(y)-t.angleTo(y)}))[0];return B&&B.angleTo(i)>g&&(A.longitude=Math.atan2(-B.x,-B.z)),this.cameraMotion.value.latitude<-Math.PI/4&&(A.latitude=Er(0,this.minLatitude,this.maxLatitude)),this.cameraMotion.value.fov<60&&(A.fov=this.defaultFov),this.emit("wantsMoveToPano",r,A,!0),r},t.prototype.destroy=function(){e.prototype.destroy.call(this)},t.prototype.isReady=function(){return!1},t.prototype.updateTime=function(e,t){for(var i,r,o,s,a,l,u,c=this,h=[],d=2;d<arguments.length;d++)h[d-2]=arguments[d];var p={},f={},A=this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[0]),m=this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[this.locationMotion.keyframes.length-1]),g=!1;if(!1===this.locationMotion.ended){this.locationMotion.update(e);var v=this.locationMotion.getKeyFrameSegment(e),y=v[0],b=v[1],x=this.panoResourceFromLocationMotionKeyframe(y),w=this.panoResourceFromLocationMotionKeyframe(b),E=(new n.Vector3).copy(x.position),M=(new n.Vector3).copy(w.position),S=this.locationMotion.value.count-b.value.count+1;p.progress=S,p.modelAlpha=this.locationMotion.value.modelAlpha,this.camera.perspToOrtho.setScalar(Er(this.locationMotion.value.perspToOrtho,0,1)),this.camera.orthoDistance=this.locationMotion.value.orthoDistance,w.leftPanoPicture&&(S<1?x.leftPanoPicture&&(p.pano0=x.leftPanoPicture):p.pano0=w.leftPanoPicture,p.pano1=w.leftPanoPicture),g=p.useBlackTransition="instant"===w.effect||"montage"===w.effect,"fade"!==w.effect&&"montage"!==w.effect||(p.pano0&&x.leftPanoPicture&&(p.pano0={map:p.pano0.map,luminanceMap:p.pano0.luminanceMap,matrix:x.leftPanoPicture.matrix.clone().setPosition(w.position)}),E.copy(M)),f.distance=this.locationMotion.value.distance,f.offset=new n.Vector3(E.x+(M.x-E.x)*S,E.y+(M.y-E.y)*S,E.z+(M.z-E.z)*S);for(var C=[],I=[],B=0,T=this.locationMotion.keyframes;B<T.length;B++){var P=T[B],R=P.key,D=P.progress;void 0!==R&&(C.push(R),D>=this.locationMotion.progress&&I.push(R))}for(var L=0,k=Object.keys(this.panoResources);L<k.length;L++){var F=k[L];if(!(I.indexOf(F)>=0)){var O=this.panoResources[F];if(O.leftPanoPicture){var N=O.leftPanoPicture.map;if(N){if(N===(null===(i=p.pano0)||void 0===i?void 0:i.map))continue;if(N===(null===(r=p.pano1)||void 0===r?void 0:r.map))continue;N instanceof ri&&N.cubeRenderTarget&&this.colorCubeRenderTargetPool.push(N.cubeRenderTarget),N.dispose(),O.leftPanoPicture=null}}C.indexOf(F)>=0||delete this.panoResources[F]}}x.workCode===w.workCode?this.currentPanoIndex=S<.5?x.panoIndex:w.panoIndex:this.currentPanoIndex=w.panoIndex,this.emit("movingToPano",m.panoIndex,A.panoIndex,this.locationMotion.progress)}!1===this.cameraMotion.ended&&(this.cameraMotion.update(e),f.longitude=this.cameraMotion.value.longitude,f.latitude=this.cameraMotion.value.latitude,f.fov=this.cameraMotion.value.fov),!1===_o(p)&&((null===(o=p.pano0)||void 0===o?void 0:o.map)&&p.pano0.map instanceof ri&&!p.pano0.map.cubeRenderTarget&&(p.pano0.map.cubeRenderTarget=this.colorCubeRenderTargetPool.pop()),(null===(s=p.pano1)||void 0===s?void 0:s.map)&&p.pano1.map instanceof ri&&!p.pano1.map.cubeRenderTarget&&(p.pano1.map.cubeRenderTarget=this.colorCubeRenderTargetPool.pop()),this.model.setMaterial(p)),!1===_o(f)&&this.setCamera(f);var V=h[1];if(V)if(this.xrManager.session){var Q=this.xrManager.referenceSpace;if(Q){var H=this.xrManager.cameraVR,q=this.xrManager.cameraL,z=this.xrManager.cameraR,U=[q,z],j=V.getViewerPose(Q),K=new n.Vector3(0,0,0);if(j){var G=void 0;switch(this.xrManager.machineType){case"Pico":G=this.xrManager.session.renderState.baseLayer;break;case"Oculus":var _=this.xrManager.session.renderState.layers;_&&(G=_[0]);break;default:this.xrManager.machineType}var W=j.views;if(!G)return void console.error("no layer found");this.renderer.setFramebuffer(G.framebuffer);var X=!1;W.length!==H.cameras.length&&(H.cameras.length=0,X=!0),this.parallaxCameraMatrixs=[];var Y=new n.Vector3,Z=new n.Vector3;(new n.Matrix4).fromArray(W[0].transform.matrix).decompose(Y,new n.Quaternion,new n.Vector3),(new n.Matrix4).fromArray(W[1].transform.matrix).decompose(Z,new n.Quaternion,new n.Vector3),Z.clone().sub(Y).normalize();var J=new n.Vector3,$=new n.Quaternion,ee=new n.Vector3;this.camera.matrix.decompose(J,$,ee);for(var te=0;te<W.length;te++){var ie=W[te],ne=G.getViewport(ie),re=U[te];re.matrix.fromArray(ie.transform.matrix);var oe=new n.Vector3,se=new n.Quaternion,ae=new n.Vector3;re.matrix.decompose(oe,se,ae),K.copy(J),re.position.copy(J),re.quaternion.copy(se),re.scale.copy(ae),re.updateMatrix(),re.projectionMatrix.fromArray(ie.projectionMatrix),re.viewport.set(ne.x,ne.y,ne.width,ne.height),!0===X&&H.cameras.push(re)}}var le=this.xrManager.session.inputSources;for(te=0;te<this.xrManager.controllers.length;te++){var ue=this.xrManager.controllers[te],ce=le[te];ue.update(ce,V,Q)}var he=this.xrManager.getController(0),de=he.position.clone().add(K).sub(new n.Vector3(0,1.35,0));this.xrControllerRay.set(de,new n.Vector3(0,0,-1).applyEuler(he.rotation));var pe=this.model.intersectRaycaster(this.xrControllerRay);if(pe.length>=1&&pe[0].face){this.pointerLine.setPoints(de,pe[0].point);var fe=pe[0].face.normal,Ae=fe.clone().multiplyScalar(.05),me=pe[0].point.clone().add(Ae);this.intersectMesh.position.copy(me);var ge=me.clone().add(Ae);if(this.intersectMesh.lookAt(ge),Math.abs(fe.y)>.99){var ve=this.camera.position.clone().sub(me);this.intersectMesh.rotation.z=-Math.atan2(ve.z,ve.x)}this.intersectMesh.visible=!0,this.needsRender=!0,this.emit("intersectionOnModelUpdate",pe[0],this.intersectMesh)}if(this.camera.pose.distance>.1)for(var ye=0;ye<this.work.observers.length;ye++){(Ee=this.panoMeshes[ye])&&(Ee.visible=!1)}else{var be=this.work.observers[this.currentPanoIndex];if(be){var xe=be.visibleNodes.concat(this.currentPanoIndex),we=this.getForwardPanoIndexOrNot();for(ye=0;ye<this.work.observers.length;ye++){var Ee,Me=this.work.observers[ye];if(Ee=this.panoMeshes[ye])if(Me.loadable||Me.active)if(-1!==xe.indexOf(ye))if(g)Ee.visible=!1,Ee.setOpacity(0);else{Ee.visible=!0;var Se=Ee.position.clone().setY(this.camera.position.y).distanceTo(this.camera.position);Ee.setCurrent(we===ye),Ee.setOpacity(Se<.01?0:Er(1.4/Se,.5,.7));var Ce=this.camera.position.clone().setY(Ee.position.y),Ie=new n.Vector3;Ce.equals(Ee.position)?(this.camera.getWorldDirection(Ie),Ie.setY(0)):Ie.copy(Ee.position).sub(Ce),Ie.length()>0&&Ee.lookAt(Ie.clone().normalize().add(Ee.position)),Ee.updateTime&&Ee.updateTime(e,t)}else Ee.visible=!1,Ee.setOpacity(0);else Ee.visible=!1,Ee.setOpacity(0)}}}var Be,Te=function(){if(!1===c.tileLevelForFov)return 0;var e=new n.Vector2(4e3,4e3),t=m.panoIndex,i=c.work.observers[t],r=c.imageOptions.size;if(void 0===r&&i){var o=i.images.up.match(/\/cube_(\d+)\//);o&&(r=Number(o[1]))}void 0===r&&(r=2048);var s=0;r>=1024&&(s=1),r>=2048&&(s=2),r>=4096&&(s=3),r>=8192&&(s=4);var a=c.tileLevelForFov(q.fov,e);return a>s?a:0}(),Pe=((Be=new n.PerspectiveCamera).applyMatrix4(H.matrix),Be.position.set(0,0,0),Be.quaternion.premultiply(c.work.observers[m.panoIndex].quaternion.clone().inverse()),Be.updateProjectionMatrix(),Be.updateMatrixWorld(!0),(new n.Frustum).setFromProjectionMatrix((new n.Matrix4).multiplyMatrices(Be.projectionMatrix,Be.matrixWorldInverse)));m.panoIndex===this.currentPanoIndex&&(null===(a=m.leftPanoPicture)||void 0===a?void 0:a.map)instanceof ri&&(m.leftPanoPicture.map.update(Pe,Te),!0===m.leftPanoPicture.map.needsRender&&(this.needsRender=!0));var Re=this.tiling.object.visible;if(Te>this.TILED_CUBE_TEXTURE_LEVEL&&this.initAnimationed){var De=m.panoIndex,Le=this.work.observers[De];Le&&Ro(this.camera.position,Le.position)&&this.locationMotion.ended?(this.tiling.object.visible=!0,this.tiling.panoIndex!==De&&this.tiling.cleanup(),this.tiling.panoIndex=De,this.tiling.setResource(null!==(u=null===(l=Le.images)||void 0===l?void 0:l.tiles)&&void 0!==u?u:[],this.enableIOSEDR&&Le.images.luminance?Le.images.luminance:null),this.tiling.setRotation(Le.quaternion),this.tiling.setPosition(Le.position),this.tiling.update(Pe,Te,e)):this.tiling.object.visible=!1}else this.tiling.object.visible=!1;Re!==this.tiling.object.visible&&(this.tiling.object.needsRender=!0),this.panoVideo.object.position.copy(this.camera.position),this.panoVideo.updateTime(e);var ke=le[0].gamepad;if((null==ke?void 0:ke.axes)&&this.emit("webXRSelected","Axes",{axes:ke.axes}),-1===(null==ke?void 0:ke.axes[2])){if(!this.xrControllerState.axes[2].left.isTap){var Fe=e-this.xrControllerState.axes[2].left.startTime;Fe>=300&&this.emit("webXRSelected","RightAxesLeftTap"),this.xrControllerState.axes[2].left.isTap=!0}}else this.xrControllerState.axes[2].left.isTap=!1,this.xrControllerState.axes[2].left.startTime=0;if(1===(null==ke?void 0:ke.axes[2])){if(!this.xrControllerState.axes[2].right.isTap){var Oe=e-this.xrControllerState.axes[2].right.startTime;Oe>=300&&this.emit("webXRSelected","RightAxesRightTap"),this.xrControllerState.axes[2].right.isTap=!0}}else this.xrControllerState.axes[2].right.isTap=!1,this.xrControllerState.axes[2].right.startTime=0;if(-1===(null==ke?void 0:ke.axes[3])){if(!this.xrControllerState.axes[3].up.isTap){var Ne=e-this.xrControllerState.axes[3].up.startTime;Ne>=300&&this.emit("webXRSelected","RightAxesUpTap"),this.xrControllerState.axes[3].up.isTap=!0}}else this.xrControllerState.axes[3].up.isTap=!1,this.xrControllerState.axes[3].up.startTime=0;if(1===(null==ke?void 0:ke.axes[3])){if(!this.xrControllerState.axes[3].down.isTap){var Ve=e-this.xrControllerState.axes[3].down.startTime;Ve>=300&&this.emit("webXRSelected","RightAxesDownTap"),this.xrControllerState.axes[3].down.isTap=!0}}else this.xrControllerState.axes[3].down.isTap=!1,this.xrControllerState.axes[3].down.startTime=0;if(null==ke?void 0:ke.buttons[0].pressed){if(!this.xrControllerState.select.isTap){var Qe=e-this.xrControllerState.select.startTime;Qe>=300&&this.emit("webXRSelected","Select",{raycaster:this.xrControllerRay}),this.xrControllerState.select.isTap=!0}}else this.xrControllerState.select.isTap=!1,this.xrControllerState.select.startTime=0;if(null==ke?void 0:ke.buttons[1].pressed){if(!this.xrControllerState.squeeze.isTap){var He=e-this.xrControllerState.squeeze.startTime;He>=300&&this.emit("webXRSelected","Squeeze",{raycaster:this.xrControllerRay}),this.xrControllerState.squeeze.isTap=!0}}else this.xrControllerState.squeeze.isTap=!1,this.xrControllerState.squeeze.startTime=0;if(null==ke?void 0:ke.buttons[2].pressed){if(!this.xrControllerState.leftButtonA.isTap){var qe=e-this.xrControllerState.leftButtonA.startTime;qe>=300&&this.emit("webXRSelected","LeftButtonA",{raycaster:this.xrControllerRay}),this.xrControllerState.leftButtonA.isTap=!0}}else this.xrControllerState.leftButtonA.isTap=!1,this.xrControllerState.leftButtonA.startTime=0;if(null==ke?void 0:ke.buttons[3].pressed){if(!this.xrControllerState.leftButtonB.isTap){var ze=e-this.xrControllerState.leftButtonB.startTime;ze>=300&&this.emit("webXRSelected","LeftButtonB",{raycaster:this.xrControllerRay}),this.xrControllerState.leftButtonB.isTap=!0}}else this.xrControllerState.leftButtonB.isTap=!1,this.xrControllerState.leftButtonB.startTime=0;if(null==ke?void 0:ke.buttons[4].pressed){if(!this.xrControllerState.rightButtonA.isTap){var Ue=e-this.xrControllerState.rightButtonA.startTime;Ue>=300&&this.emit("webXRSelected","RightButtonA",{raycaster:this.xrControllerRay}),this.xrControllerState.rightButtonA.isTap=!0}}else this.xrControllerState.rightButtonA.isTap=!1,this.xrControllerState.rightButtonA.startTime=0;if(null==ke?void 0:ke.buttons[5].pressed){if(!this.xrControllerState.rightButtonB.isTap){var je=e-this.xrControllerState.rightButtonB.startTime;je>=300&&this.emit("webXRSelected","RightButtonB",{raycaster:this.xrControllerRay}),this.xrControllerState.rightButtonB.isTap=!0}}else this.xrControllerState.rightButtonB.isTap=!1,this.xrControllerState.rightButtonB.startTime=0}}else console.error("session丢失,请重试");else console.error("xrFrame丢失,请重试")},t.prototype.render=function(){var e=this.xrManager.getCamera(this.camera);this.renderer.render(this.scene,e)},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}(Hs),Ya=["Panorama","DepthPanorama","Model"],Za={Floorplan:ss,Topview:ds,Panorama:Hs,VRPanorama:Ea,Model:Ma,DepthPanorama:Ra,Mapview:ka,XRPanorama:Xa};function Ja(e){for(var t=0,i=Ya;t<i.length;t++){var n=i[t];if("string"==typeof e){if(n===e)return!0}else if(e instanceof os&&e instanceof Za[n])return!0}return!1}var $a=["cameraDirectionUpdate","cameraUpdate","cameraPositionUpdate","panoSelected","moveToPano","moveToPanoCanceled","panoWillArrive","movingToPano","panoArrived","panoWillLoad","panoLoaded","panoLoadError","initAnimationEnded","initAnimationWillStart","wantsGesture","gesture","wantsTapGesture","tapGesture","wantsPressGesture","pressGesture","wantsPanGesture","wantsInteriaPan","panGesture","interiaPan","wantsPinchGesture","pinchGesture","wantsMouseWheel","mouseWheel","wantsShowIntersectionOnModel","intersectionOnModelUpdate","intersectionHidden","textureStartLoad","textureLoading","textureAbort","textureLoaded","textureError","webXRSessionStart","webXRSessionEnd","webXRSelected"];function el(e){for(var t,i,n={},r=0,o=e.split(/(\;|\,)/);r<o.length;r++){var s=o[r].split("="),a=null===(t=s[0])||void 0===t?void 0:t.trim(),l=null===(i=s[1])||void 0===i?void 0:i.trim();a&&l&&(n[a]=l)}return n}function tl(){for(var e,t=document.getElementsByTagName("meta"),i=0;i<t.length;i++){var n=t[i];if("viewport"===n.getAttribute("name")){var r=el(null!==(e=n.getAttribute("content"))&&void 0!==e?e:""),o=Number(r["initial-scale"]);if(!isNaN(o))return o}}return 1}var il=[351,63],nl=[20,20],rl=new Float32Array([-.5,-.5,0,.5,-.5,0,-.5,.5,0,.5,.5,0]),ol=new Float32Array([0,0,1,0,0,1,1,1]),sl=new Uint8Array([0,1,2,1,3,2]),al=new n.BufferGeometry;al.setAttribute("position",new n.BufferAttribute(rl,3)),al.setAttribute("uv",new n.BufferAttribute(ol,2)),al.setIndex(new n.BufferAttribute(sl,1));var ll=new n.MeshBasicMaterial({transparent:!0,depthTest:!1}),ul=new n.Mesh(al,ll),cl=new n.Scene;cl.add(ul);var hl=new n.OrthographicCamera(-.5,.5,.5,-.5,.1,1);hl.position.set(0,0,.5),hl.lookAt(0,0,0);var dl=new n.Vector4,pl=new n.Vector4;function fl(e){if(ll.map){var t=e.getViewport(dl),i=e.getScissor(pl),r=e.getScissorTest(),o=e.autoClear;e.setViewport(i.x+nl[0]/3,i.y+nl[1]/3,il[0]/3,il[1]/3),e.setScissor(i.x+nl[0]/3,i.y+nl[1]/3,il[0]/3,il[1]/3),e.setScissorTest(!0),e.autoClear=!1,e.render(cl,hl),e.setViewport(t),e.setScissor(i),e.setScissorTest(r),e.autoClear=o}else{var s=new n.Texture,a=new Image;a.onload=function(){s.image=a,s.wrapS=n.ClampToEdgeWrapping,s.wrapT=n.ClampToEdgeWrapping,s.minFilter=n.LinearFilter,s.needsUpdate=!0,ll.needsUpdate=!0,a.onload=function(){}},a.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAV8AAAA/CAQAAADtPwPkAAAR+0lEQVR4AezYg3LEQACH8d1cbdu23Q5qG9G47z/TN/h6tn2b/H+TUTLc7yjcOXV46OUAnUs6EbUp022ZBXc1NhoZYYd7fjDRvdcHAwrlK2QBVJ4sgoqONmY45RUT23sZ6H42F2hK5CtkMbjhZlDmUUcvq1zyieUVyjbE4I1GBfItwxG56YaUZTQwyh4P6NgJ4YYYvCuQb5kOyI03pORjiqe4Lwpq5pt1vJqfUwKWJVbSMYfppYconG+maNNQOWBZuwHTzicGel75NtFOkxr5apmV8cikcko0DrDQs863AeGl0cE0+1xy573m0/wf0cEKW6H7BWtggiMG8sy3oHRDpJMw4NWb6am/bv9znkqEzjd61t5oo5clTrjhwevO75EJRBKSRt745Z16ZEjcM73sccZplBPm8PyTcxZAkSRdHm/acJ0Z3JZhHB0BxqDHgWFZFmm0ZbCw87twI/zc3e/Cz93vPneXtU/WdQS3oTviXdY/q5PsJKfoGuQjZuO/0in1qsj85cuXrxqeAOJpGqdJOqrUutgVl2Qb0BWqp/RE8AWWVB7t2KrIzY2Wx2fWKl7yfswgxqj8lYummYa3hfwF9MuQRmbfQE4ocPDjtUWQ6Tq1M2w7gC2EcrMGtWS6xlpGKEDDcb1vUQ25zT4lrC2s0dU4gFPppKkbeIYr7NMpqjStuFg5rNU9epGyt8PX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V4KePiaSE8eNRgjDy8/tyRW+FZjhS+2tlovNJovtJovNJ0uhK6Wo64SDdxEbM//KesjwAAAABJRU5ErkJggg==",ll.map=s}}var Al=new n.Box3(new n.Vector3(-50,-50,-50),new n.Vector3(50,50,50)),ml=function(e){return e.replace("//vrlab-public.ljcdn.com/","//vr-public.realsee-cdn.cn/").replace("//vrlab-image4.ljcdn.com/","//vr-image-4.realsee-cdn.cn/").replace("//vrlab-image3.ljcdn.com/","//vr-image-3.realsee-cdn.cn/").replace("//vrlab-image2.ljcdn.com/","//vr-image-2.realsee-cdn.cn/").replace("//vrlab-image1.ljcdn.com/","//vr-image-1.realsee-cdn.cn/")},gl=new n.Vector2,vl=new n.Frustum,yl=new n.Matrix4,bl=new WeakMap,xl=new WeakMap,wl=function(e){function t(t){void 0===t&&(t={});var i,r,o,s,a,l,u,c,h,d,p,f=this;if((f=e.call(this)||this).ident=rr(),El.instances[f.ident]=f,f.renderSwitch01=0,f.panoIndex=0,f.needsRender=!1,f.onlyRenderIfNeeds=null===(i=t.onlyRenderIfNeeds)||void 0===i||i,f.imageOptions=Fe({},null!==(r=t.imageOptions)&&void 0!==r?r:{}),f.textureOptions=Fe({},null!==(o=t.textureOptions)&&void 0!==o?o:{}),f.poweredByRealsee=null===(s=t.poweredByRealsee)||void 0===s||s,f.extraElements=[],f.controllerInits={Panorama:Object.assign({},t.panorama),Model:Object.assign({},t.model),Floorplan:Object.assign({},t.floorplan),Topview:Object.assign({},t.topview),Mapview:Object.assign({},t.mapview),DepthPanorama:Object.assign({},t.depthPanorama),VRPanorama:Object.assign({},t.vrPanorama),XRPanorama:Object.assign({},t.xrPanorama)},f.fps={testCount:0,testTime:Ue()},f.modeChangeDuration=null!==(a=t.modeChangeDuration)&&void 0!==a?a:800,f.panoramaLikeSavedPose={},"undefined"!=typeof window)if(t.renderer)t.renderer instanceof hi&&f.throwError(new Error("cannot render a internal renderer")),f.renderer=t.renderer;else try{f.renderer=new hi({preserveDrawingBuffer:t.preserveDrawingBuffer,backgroundColor:t.backgroundColor,backgroundAlpha:t.backgroundAlpha,antialias:t.antialias,webgl2:null==t?void 0:t.webgl2});var A=tl();f.renderer.setPixelRatio(1===A?window.devicePixelRatio:1),f.renderer.setSize(512,512)}catch(e){e instanceof Error&&f.throwError(e)}f.copyEffect=new rs(f.renderer),f.getPixelsRenderTarget=new n.WebGLRenderTarget(1,1,{encoding:null!==(u=null===(l=f.renderer)||void 0===l?void 0:l.outputEncoding)&&void 0!==u?u:n.sRGBEncoding}),f.scissor=Object.assign({left:0,bottom:0,width:1,height:1},t.scissor),f.camera=new bi(80),f.scene=new di,f.parallaxScene=new di,f.lastLoadWorkTask=Promise.resolve(),f.requestProxy=null!==(c=t.requestProxy)&&void 0!==c?c:ml,f.networkSubscribe=new ot,f.networkSubscribe.on("network",(function(e,t,i,n){var r;f.emit("network",e,t,i,n),null===(r=f.analysis)||void 0===r||r.network(f.work,e,t,i,n)})),f.boundingMesh=Fo(new n.Box3(new n.Vector3(-.5,-.5,-.5),new n.Vector3(.5,.5,.5))),f.scene.add(f.boundingMesh),f.model=new wr({allowHosts:[],requestProxy:f.requestProxy,networkSubscribe:f.networkSubscribe});var m=Fo(Al);m.name="model_empty",f.model.add(m),f.model.visible=!1,f.readyCallbacks=[],f.modelPending=!1,f.syncingState=!1,f.scene.add(f.model),f.helperGroup=new n.Group,f.helperGroup.name="helper",f.scene.add(f.helperGroup),f.videoTexture=new n.VideoTexture(t.videoInstance||function(){var e=document.createElement("video");e.loop=!0,e.autoplay=!0,e.playsInline=!0,e.muted=!0,e.crossOrigin="";var t=function(){document.removeEventListener("touchstart",t,!1),document.removeEventListener("mousedown",t,!1),e.muted=!1};return document.addEventListener("touchstart",t,!1),document.addEventListener("mousedown",t,!1),e}()),function(e){(t=new n.DirectionalLight(16777215,.5)).position.copy(new n.Vector3(1,1,1)),e.add(t);var t=new n.DirectionalLight(16777215,.3);e.add(t),t=new n.AmbientLight(16777215,.3),e.add(t)}(f.scene),f.state={mode:null!==(h=f.currentMode)&&void 0!==h?h:"Panorama",panoIndex:null!==(d=f.panoIndex)&&void 0!==d?d:0,longitude:f.camera.pose.longitude,latitude:f.camera.pose.latitude,fov:f.camera.pose.fov,offset:f.camera.pose.offset.clone(),distance:f.camera.pose.distance},f.stateSynced=!1,f._enableIOSEDR=!1,f.destroyed=!1,f.paused=!0,"undefined"!=typeof window&&(!1!==t.play&&f.play(),!1!==(null!==(p=t.initialBasisLoader)&&void 0!==p&&p)&&("string"==typeof t.initialBasisLoader?f.initBasisLoader(t.initialBasisLoader):f.initBasisLoader()),f.stopAnimationLoop=dt.shared.add((function(e,t){for(var i=[],n=2;n<arguments.length;n++)i[n-2]=arguments[n];f.updateTime.apply(f,Oe([e,t],i,!1))}),!1,0,10));var g=function(){"undefined"!=typeof document&&null===document.fullscreenElement&&"VRPanorama"===f.currentMode&&f.controller.emit("vrWantsToExit")};if("undefined"!=typeof document&&document.addEventListener("fullscreenchange",g,!1),f.removeEventListeners=function(){"undefined"!=typeof document&&document.removeEventListener("fullscreenchange",g,!1)},f.plugins={},t.plugins&&t.plugins.length)for(var v=0,y=t.plugins;v<y.length;v++){var b=y[v];if("function"==typeof b)b(f);else if(Array.isArray(b)){var x=b[0],w=b[1],E=b[2];if("function"==typeof x){var M=x(f,E);"string"==typeof w&&(f.plugins[w]?f.throwError(new Error("plugin name ".concat(w," is exists."))):f.plugins[w]=M)}}}return f.gpuPickingRenderTarget=new n.WebGLRenderTarget(1,1),f.meshReplaceMaterialMap=new Map,f.meshOriginMaterialMap=new Map,f}return ke(t,e),Object.defineProperty(t,"version",{get:function(){return"5.0.0-alpha.167"},enumerable:!1,configurable:!0}),t.prototype.getGPUPicking=function(e,t,i,r,o){var s=this;if(void 0===r&&(r=1),void 0===o&&(o=new n.Vector3(0,0,0)),!this.renderer)throw new Error("renderer is not initialized.");this.model.setMaterial({modelColorInfo:o}),this.scene.traverse((function(e){if(e instanceof n.Mesh&&!(e instanceof xt)){var t=Object.keys(i).filter((function(t){return t===e.uuid}))[0];if(t)if(s.meshOriginMaterialMap.set(t,e.material),s.meshReplaceMaterialMap.get(t))e.material=s.meshReplaceMaterialMap.get(t);else{var r=new n.ShaderMaterial({uniforms:{color:{value:i[t]}},vertexShader:"\n void main() {\n vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n gl_Position = projectionMatrix * mvPosition;\n }\n ",fragmentShader:"\n uniform vec3 color;\n void main() {\n gl_FragColor = vec4( color, 1.0 );\n }\n "});r.depthTest=e.material.depthTest,r.side=e.material.side,s.meshReplaceMaterialMap.set(t,r),e.material=r}}}));var a=this.renderer.getSize(new n.Vector2);this.camera.setViewOffset(a.width,a.height,e*r,t*r,1,1),this.renderer.setRenderTarget(this.gpuPickingRenderTarget),this.render();var l=new Uint8Array(4);this.renderer.readRenderTargetPixels(this.gpuPickingRenderTarget,0,0,1,1,l),this.renderer.setRenderTarget(null),this.camera.clearViewOffset(),this.scene.traverse((function(e){e instanceof n.Mesh&&!(e instanceof xt)&&s.meshOriginMaterialMap.get(e.uuid)&&(e.material=s.meshOriginMaterialMap.get(e.uuid))})),this.model.setMaterial({modelColorInfo:null});var u=Object.keys(i).filter((function(e){return i[e].equals((new n.Color).setRGB(l[0]/255,l[1]/255,l[2]/255))}))[0];return u||!1},t.prototype.dispose=function(){var e,t;if(!0!==this.destroyed){delete El.instances[this.ident],this.emit("dispose"),this.destroyed=!0,this.pause(),this.stopAnimationLoop&&(this.stopAnimationLoop(),delete this.stopAnimationLoop),null===(e=this.renderer)||void 0===e||e.setAnimationLoop(null),this.off(),this.networkSubscribe.off(),this.controller&&(this.controller.destroy(),this.controller=void 0);var i=this.getElement();i&&i.parentNode&&i.parentNode.removeChild(i),this.scene.remove(this.model);var n=this.model.getMaterial();n&&(n.pano0&&n.pano0.map.dispose(),n.pano1&&n.pano1.map!==(null===(t=n.pano0)||void 0===t?void 0:t.map)&&n.pano1.map.dispose()),this.model.dispose(),this.diposeGPUPickingMaterial(),this.renderer instanceof hi&&this.renderer.forceContextLoss&&this.renderer.forceContextLoss()}},t.prototype.setScissor=function(e){Object.assign(this.scissor,e),this.controller&&this.controller.updateRenderSize&&this.controller.updateRenderSize()},Object.defineProperty(t.prototype,"helperVisible",{get:function(){return this.helperGroup.visible},set:function(e){this.helperGroup.visible!==e&&(this.helperGroup.visible=e,this.emit("helpersVisibleChange",e),this.needsRender=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enableIOSEDR",{get:function(){return this._enableIOSEDR},set:function(e){this._enableIOSEDR!==e&&(this._enableIOSEDR=e,this.currentMode&&"Panorama"===this.currentMode&&this.changeMode(this.currentMode,{},0,!1,!0))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enablePostProcessing",{get:function(){return void 0!==this.screenBuffers},set:function(e){var t,i,r,o;if(e){if(!this.screenBuffers){var s=this.getDrawingBufferSize(gl);this.screenBuffers=[new n.WebGLRenderTarget(s.x,s.y,{encoding:null!==(i=null===(t=this.renderer)||void 0===t?void 0:t.outputEncoding)&&void 0!==i?i:n.sRGBEncoding}),new n.WebGLRenderTarget(s.x,s.y,{encoding:null!==(o=null===(r=this.renderer)||void 0===r?void 0:r.outputEncoding)&&void 0!==o?o:n.sRGBEncoding})]}}else this.screenBuffers&&(this.screenBuffers[0].dispose(),this.screenBuffers[1].dispose(),delete this.screenBuffers);this.needsRender=!0},enumerable:!1,configurable:!0}),t.prototype.updateConfiguration=function(e){var t=!1;e.panorama&&(Object.assign(this.controllerInits.Panorama,e.panorama),"Panorama"===this.currentMode&&(t=!0)),e.model&&(Object.assign(this.controllerInits.Model,e.model),"Model"===this.currentMode&&(t=!0)),e.floorplan&&(Object.assign(this.controllerInits.Floorplan,e.floorplan),"Floorplan"===this.currentMode&&(t=!0)),e.topview&&(Object.assign(this.controllerInits.Topview,e.topview),"Topview"===this.currentMode&&(t=!0)),e.mapview&&(Object.assign(this.controllerInits.Mapview,e.topview),"Mapview"===this.currentMode&&(t=!0)),e.depthPanorama&&(Object.assign(this.controllerInits.DepthPanorama,e.depthPanorama),"DepthPanorama"===this.currentMode&&(t=!0)),e.vrPanorama&&(Object.assign(this.controllerInits.VRPanorama,e.vrPanorama),"VRPanorama"===this.currentMode&&(t=!0)),e.imageOptions&&(Object.assign(this.imageOptions,e.imageOptions),"Panorama"!==this.currentMode&&"DepthPanorama"!==this.currentMode&&"VRPanorama"!==this.currentMode||(t=!0)),t&&this.controller&&this.currentMode&&this.changeMode(this.currentMode,this.getCurrentState(),0,!1,!0)},t.prototype.appendTo=function(e,t){if(void 0===t&&(t={}),this.renderer)if(this.renderer instanceof hi){var i=this.getElement();if(i){e.appendChild(i),this.refresh(t);var n=window.getComputedStyle(e).position;"relative"!==n&&"absolute"!==n&&"fixed"!==n&&"sticky"!==n&&(e.style.position="relative")}}else this.throwError(new Error("cannot call appendTo method when render a external renderer"))},t.prototype.refresh=function(e,t){if(void 0===e&&(e={}),this.renderer){var i=this.getElement();if(i){var r=i.parentNode;if(r&&r.nodeName){var o=e.width,s=void 0===o?r.offsetWidth:o,a=e.height,l=void 0===a?r.offsetHeight:a;if(this.renderer instanceof hi){if(t)this.renderer.setPixelRatio(t);else{if((t=1===tl()?Math.floor(window.devicePixelRatio):1)>1)for(;t>1&&s*l*t*t>7372800;)t--;this.renderer.setPixelRatio(t)}this.renderer.setSize(s,l)}}var u=this.renderer.getSize(new n.Vector2);this.camera.aspect=u.x*this.scissor.width/(u.y*this.scissor.height),this.camera.updateProjectionMatrix(),this.controller&&this.controller.updateRenderSize&&this.controller.updateRenderSize(),this.needsRender=!0}}},t.prototype.addExtraElement=function(e){var t=this;return-1===this.extraElements.indexOf(e)&&(this.extraElements.push(e),this.controller&&this.controller.bindExtraElement(e)),function(){return t.removeExtraElement(e)}},t.prototype.removeExtraElement=function(e){var t=this.extraElements.indexOf(e);-1!==t&&(this.extraElements.splice(t,1),this.controller&&this.controller.unbindExtraElement(e))},t.prototype.getPose=function(){var e=this.camera.copyPose(),t=e.longitude,i=e.latitude,n=e.fov,r=e.offset,o=e.distance;return{longitude:t,latitude:i,fov:n,offset:r.clone(),distance:o}},t.prototype.getSize=function(e){if(!this.renderer)throw new Error("renderer is not initialized");return this.renderer.getSize(e),e.x*=this.scissor.width,e.y*=this.scissor.height,e},t.prototype.getDrawingBufferSize=function(e){if(!this.renderer)throw new Error("renderer is not initialized");return this.renderer.getDrawingBufferSize(e),e.x*=this.scissor.width,e.y*=this.scissor.height,e},t.prototype.updateCamera=function(e,t,i){return void 0===i&&(i=!0),this.controller?this.controller.updateCamera(e,t,i):Promise.reject(new Error("controller is not initialized."))},t.prototype.updateCameraWithKeyframes=function(e,t,i){return void 0===i&&(i=!0),this.controller?this.controller.updateCameraWithKeyframes(e,t,i):Promise.reject(new Error("controller is not initialized."))},t.prototype.getLongitudeAndLatitude=function(){var e=this.getPose();return{longitude:e.longitude,latitude:e.latitude}},t.prototype.getOffset=function(){return this.getPose().offset},t.prototype.getCameraLocal=function(){if("number"==typeof this.panoIndex&&this.controller&&this.work){var e=this.work.observers[this.panoIndex],t=new n.Object3D;return t.position.copy(e.position),t.quaternion.copy(e.quaternion),t.scale.set(1,1,1),t.updateMatrixWorld(!0),function(e,t){var i=new n.Vector3(0,0,-1);i.applyQuaternion(e.quaternion);var r=t.quaternion.clone().inverse();return i.applyQuaternion(r),{theta:Math.atan2(i.x,-i.z),phi:-Math.asin(i.y),lookAtVector:i}}(this.camera,t)}},t.prototype.initBasisLoader=function(e){try{if(!this.renderer)throw new Error("renderer is not initialized.");if("undefined"==typeof Promise||"undefined"==typeof WeakMap||"undefined"==typeof WebAssembly)throw new Error("Basis loader not support.");"string"==typeof e&&ii.setTranscoderPath(e),ii.workerConfig.format||ii.detectSupport(this.renderer),ii._allocateWorker(0)}catch(e){e instanceof Error&&this.throwError(e)}},Object.defineProperty(t.prototype,"work",{get:function(){var e=xl.get(this);if(e&&Lr.get(e))return e},enumerable:!1,configurable:!0}),t.prototype.load=function(e,t,i,n){var r=this;if(void 0===n&&(n=!0),!this.renderer)throw new Error("renderer is not initialized");var o=this.lastLoadWorkTask.then((function(){return!(o=e)||"object"!=typeof o&&"function"!=typeof o||"function"!=typeof o.then?r.load_(e,t,i,n):e.then((function(e){return r.load_(e,t,i,n)}));var o}));return this.lastLoadWorkTask=o.catch((function(e){r.throwError(e)})),o},t.prototype.load_=function(e,i,r,o){var s,a,l,u,c,h,d,p,f,A=this;void 0===o&&(o=!0);var m,g,v,y=Vr(e),b=this.work;void 0===i&&(i=b?"inherit":"initial"),"inherit"===i?(m="number"==typeof this.panoIndex&&y.observers[this.panoIndex]?this.panoIndex:y.initial.panoIndex,g=null!==(s=this.currentMode)&&void 0!==s?s:y.initial.mode,v={longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude,fov:this.camera.pose.fov}):"initial"===i?(g=null!==(a=this.currentMode)&&void 0!==a?a:y.initial.mode,m=y.initial.panoIndex,v=g===t.Mode.Panorama||g===t.Mode.DepthPanorama||g===t.Mode.Model||g===t.Mode.VRPanorama||g===t.Mode.XRPanorama?{longitude:y.initial.longitude,latitude:y.initial.latitude,fov:y.initial.fov}:{longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude,fov:this.camera.pose.fov}):(m=null!==(l=i.panoIndex)&&void 0!==l?l:y.initial.panoIndex,g=null!==(c=null!==(u=i.mode)&&void 0!==u?u:this.currentMode)&&void 0!==c?c:"Panorama",v={longitude:null!==(h=i.longitude)&&void 0!==h?h:y.initial.longitude,latitude:null!==(d=i.latitude)&&void 0!==d?d:y.initial.latitude,fov:null!==(p=i.fov)&&void 0!==p?p:y.initial.fov}),this.emit("willLoad",e,y,{panoIndex:m,mode:g,longitude:v.longitude,latitude:v.latitude,fov:v.fov});var x=function(){var t;A.panoIndex=m,A.panoramaLikeSavedPose.longitude=y.initial.longitude,A.panoramaLikeSavedPose.latitude=y.initial.latitude,A.panoramaLikeSavedPose.fov=y.initial.fov;var i=A.controller?null!=r?r:A.modeChangeDuration:0,n=Fe(Fe({initial:[m,v,i,o]},A.commonParams()),A.controllerInits[g]);A.controller?!1===A.controller.updateWork(y,m,v,i,o)&&(A.controller.destroy(),A.controller=A.applyController(g,n)):A.controller=A.applyController(g,n),A.emit("load",e,y,{panoIndex:m,mode:g,longitude:v.longitude,latitude:v.latitude,fov:v.fov}),null===(t=A.analysis)||void 0===t||t.work(y)},w=function(e){var t;void 0===e&&(e=qe),y.model&&(A.model.name!==(null===(t=y.model)||void 0===t?void 0:t.file)?(A.emit("modelWillLoad",y.model),A.loadModel(y.model,y.allowHosts,e,!0)):e&&e())};xl.set(this,y);for(var E=new n.Box3,M=0,S=y.observers;M<S.length;M++){var C=S[M];E.expandByPoint(C.standingPosition),E.expandByPoint((new n.Vector3).fromArray([C.position.x,2*C.position.y-C.standingPosition.y,C.position.z]))}return this.model.bounding.union(E),g===t.Mode.Floorplan||g===t.Mode.Topview||g===t.Mode.Mapview||g===t.Mode.Model?w((function(){x(),A.needsRender=!0})):(this.controller||(this.camera.setFromPose({distance:0,fov:y.initial.fov,longitude:y.initial.longitude,latitude:y.initial.latitude,offset:y.observers[y.initial.panoIndex].position}),this.needsRender=!0),x(),null===(f=this.controller)||void 0===f||f.once("panoLoaded",(function(){A.needsRender=!0,A.emit("cameraUpdate",A.camera.copyPose(),o),w()}))),this.ready().then((function(){A.emit("loaded",e,A.work)}))},t.prototype.changeMode=function(e,i,n,r,o){var s=this;if(void 0===i&&(i={}),void 0===n&&(n=this.modeChangeDuration),void 0===r&&(r=!0),void 0===o&&(o=!1),!this.renderer)throw new Error("renderer is not initialized.");return new Promise((function(a,l){if(!t.Mode.hasOwnProperty(e)){var u=new Error('mode "'.concat(e,'" is not existed'));return s.throwError(u),void l(u)}if((e===t.Mode.Floorplan||e===t.Mode.Topview||e===t.Mode.Mapview||e===t.Mode.Model)&&(vr(s.model)||!0!==s.model.loaded)){u=new Error("model is not ready.");return s.throwError(u),void l(u)}if(vr(s.controller)){u=new Error("controller is not ready.");return s.throwError(u),void l(u)}var c=s.controller,h=s.currentMode,d=function(){var u,d,p,f;if(s.emit("wantsChangeMode",e,h))l(new Error("change mode canceled."));else{if(s.controller&&!1===o&&h===e)e===t.Mode.Panorama||e===t.Mode.DepthPanorama||e===t.Mode.Model||e===t.Mode.VRPanorama||e===t.Mode.XRPanorama?"number"==typeof i.panoIndex&&i.panoIndex!==s.panoIndex?s.controller.moveToPano(null!==(d=null!==(u=i.panoIndex)&&void 0!==u?u:s.panoIndex)&&void 0!==d?d:0,Fe({duration:n},i),r):s.controller.updateCamera(i,n,r).catch(qe):("number"==typeof i.panoIndex&&i.panoIndex!==s.panoIndex&&(s.panoIndex=i.panoIndex),s.controller.updateCamera(i,n,r).catch(qe));else{c.destroy();var A=null!==(f=null!==(p=i.panoIndex)&&void 0!==p?p:s.panoIndex)&&void 0!==f?f:0,m=Ja(e)?s.panoramaLikeSavedPose:{};e===t.Mode.Mapview&&(m.longitude=s.panoramaLikeSavedPose.longitude),"number"!=typeof i.longitude&&"number"!=typeof i.latitude||(m.longitude=i.longitude,m.latitude=i.latitude),"number"==typeof i.fov&&(m.fov=i.fov);var g=Fe(Fe({initial:[A,m,n,r]},s.commonParams()),s.controllerInits[e]);s.saveControllerPose(c),s.controller=s.applyController(e,g);var v=Za[e].initAnimationEndPose(g);s.emit("modeChange",e,h,A,v,r)}a()}};if(e===t.Mode.VRPanorama)s.requestFullscreen(),("undefined"==typeof location||"https:"!==location.protocol?Promise.reject(new Error("Request DeviceOrientation Permission denied.")):"undefined"!=typeof DeviceOrientationEvent&&"function"==typeof DeviceOrientationEvent.requestPermission?DeviceOrientationEvent.requestPermission().then((function(e){if("granted"==e)return Promise.resolve();var t=new Error("Request DeviceOrientation Permission denied.");return Promise.reject(t)})):Promise.resolve()).then((function(){return d()})).catch((function(e){e instanceof Error&&(s.exitFullscreen(),s.throwError(e),l(e))}));else if(e===t.Mode.XRPanorama){var p=dt.shared.getContext();p?p.end():function(){if("xr"in navigator)return navigator.xr.isSessionSupported("immersive-vr").then((function(e){return e?Promise.resolve():Promise.reject()})).then((function(){return navigator.xr.requestSession("immersive-vr",{optionalFeatures:["local-floor","bounded-floor"]}).then((function(e){return Promise.resolve(e)}))}));var e=new Error("Request XR Permission denied.");return Promise.reject(e)}().then((function(e){dt.shared.setContext(e),d()})).catch((function(e){e instanceof Error&&(s.throwError(e),l(e))}))}else d()}))},t.prototype.getPixels=function(e,t,i,r,o){if(void 0===o&&(o=1),!this.renderer)throw new Error("renderer is not initialized.");var s=this.getPixelsRenderTarget,a=this.renderer.getSize(new n.Vector2);e=Er(e,Math.floor(i/2),Math.floor(a.x-i)),t=Er(t,Math.floor(r/2),Math.floor(a.y-r)),s.setSize(i*o,r*o),this.renderer.setRenderTarget(s),this.camera.setViewOffset(a.width,a.height,e,a.height-t-r,i,r),this.controller?this.controller.render():this.renderer.render(this.scene,this.camera);var l=new Uint8Array(i*o*r*o*4);return this.renderer.readRenderTargetPixels(s,0,0,i*o,r*o,l),this.renderer.setRenderTarget(null),this.camera.clearViewOffset(),l},t.prototype.getElement=function(){var e;return null===(e=this.renderer)||void 0===e?void 0:e.domElement},t.prototype.render=function(e,t){var i,n=this;if(void 0===t&&(t=!1),!this.renderer)return null;var r=bt.shared,o=null===(i=this.model.getMaterial())||void 0===i?void 0:i.clippers;if(o&&r.update(o,this.camera),this.model.setMaterial({clipperPlanesArray:o?r.clipperPlanes:null,clipperFloors:o?r.clipperFloors:null}),t){var s=this.renderer.getSize(gl);this.scene.traverseVisible((function(e){e.setResolution&&e.setResolution(s.x,s.y)}))}if(this.controller&&this.screenBuffers&&null===this.renderer.getRenderTarget()){var a=this.getDrawingBufferSize(gl);return this.screenBuffers[0].setSize(a.x,a.y),this.screenBuffers[1].setSize(a.x,a.y),this.renderer.setRenderTarget(this.screenBuffers[0]),this.controller.render(),"VRPanorama"!==this.currentMode&&"XRPanorama"!==this.currentMode&&this.poweredByRealsee&&fl(this.renderer),this.renderer.setRenderTarget(null),e&&dt.shared.add(e,!0),this.screenBuffers[0]}return this.aroundScissor((function(){n.renderer&&(n.controller?n.controller.render():n.renderer.render(n.scene,n.camera),n.poweredByRealsee&&"VRPanorama"!==n.currentMode&&"XRPanorama"!==n.currentMode&&fl(n.renderer)),e&&dt.shared.add(e,!0)})),null},t.prototype.updateTime=function(e,t){for(var i,r,o,s=this,a=[],l=2;l<arguments.length;l++)a[l-2]=arguments[l];if(!this.destroyed){this.syncingState=this.syncState(e,t),this.controller&&(i=this.controller).updateTime.apply(i,Oe([e,t],a,!1)),this.camera.updateTime(e,t),this.syncingState=!1;var u=new n.Vector2(512,512),c=new n.Vector2(512,512);this.renderer&&(this.renderer.getSize(u),u.x*=this.scissor.width,u.y*=this.scissor.height,this.renderer.getDrawingBufferSize(c),c.x*=this.scissor.width,c.y*=this.scissor.height);var h=[];if(yl.multiplyMatrices(this.camera.projectionMatrix,this.camera.matrixWorldInverse),this.renderer&&this.model.update(this.renderer,this.camera),this.model.empty)this.boundingMesh.visible=!1;else{this.boundingMesh.visible=!0;var d=new n.Box3;if(this.work)for(var p=0,f=this.work.observers;p<f.length;p++){var A=f[p];d.expandByPoint(A.standingPosition),d.expandByPoint((new n.Vector3).fromArray([A.position.x,2*A.position.y-A.standingPosition.y,A.position.z]))}d.union(this.model.bounding),d.max.x+=1,d.max.y+=1,d.max.z+=1,d.min.x-=1,d.min.y-=.001,d.min.z-=1,d.getCenter(this.boundingMesh.position),d.getSize(this.boundingMesh.scale),this.boundingMesh.boundingBox.copy(d);var m=null!==(r=this.model.getMaterial())&&void 0!==r?r:{},g=1-(null!==(o=m.modelAlpha)&&void 0!==o?o:0);m.opacity=Er(4*g-3,0,1),this.boundingMesh.setMaterial(m),this.boundingMesh.setTransparent(1!==g)}if(vl.setFromProjectionMatrix(yl),this.scene.traverse((function(t){if(t.setResolution&&t.setResolution(u.x,u.y),t.setTime&&t.setTime(e),t.mixer instanceof n.AnimationMixer){var i=bl.get(t.mixer);i||(i=new n.Clock,bl.set(t.mixer,i)),t.mixer.update(i.getDelta())}(t instanceof n.Mesh||t instanceof n.Line||t instanceof n.Points)&&(t instanceof n.ImmediateRenderObject||!t.frustumCulled||vl.intersectsObject(t))&&h.push(t)})),c.width*c.height>8388608?this.renderSwitch01=1^this.renderSwitch01:this.renderSwitch01=0,this.renderer&&!1===this.paused&&0===this.renderSwitch01){var v=void 0;if(!0!==this.onlyRenderIfNeeds)v=this.render();else{for(var y=0,b=h;y<b.length;y++){var x=b[y],w=function(e){!0===e.needsRender?(e.needsRender=!1,s.needsRender=!0):e.mixer&&e.mixer.stats.actions.inUse>0&&(s.needsRender=!0)};w(x),x.traverseAncestors(w)}this.controller&&!0===this.controller.needsRender&&(this.controller.needsRender=!1,this.needsRender=!0),!0===this.camera.needsRender&&(this.camera.needsRender=!1,this.needsRender=!0),!1!==this.needsRender&&(v=this.render())}if(this.needsRender=!1,this.controller&&this.screenBuffers){var E=this.controller,M=this.screenBuffers;this.aroundScissor((function(){E.postProcessing(M[0],M[1]),s.copyEffect.render(M[1],void 0)}))}this.hasListener("renderFrame")&&this.emit("renderFrame",void 0!==v)}if(this.fps.testTime&&e-this.fps.testTime<1e3)this.fps.testCount++;else if(this.emit("fps",this.fps.testCount),this.fps.testTime=e,this.fps.testCount=0,this.renderer){var S=this.renderer.getContext(),C=Oo(S);C&&this.throwError(C)}}},t.prototype.pause=function(){this.paused=!0,this.renderer&&this.renderer instanceof hi&&this.renderer.clear(!0,!0,!0)},t.prototype.play=function(){this.needsRender=!0,this.paused=!1},t.prototype.moveToPano=function(e,i,n){var r=this;void 0===i&&(i={}),void 0===n&&(n=!0);var o=this,s=o.controller,a=o.currentMode,l=o.renderer;return s?l?(a===t.Mode.Floorplan||a===t.Mode.Topview||a===t.Mode.Mapview?vr(e)||(this.panoIndex=e,this.once("initAnimationWillStart",(function(e,n){r.currentMode===t.Mode.Panorama&&i.moveStartCallback&&i.moveStartCallback(e,n)})),this.once("initAnimationEnded",(function(e,n){r.currentMode===t.Mode.Panorama&&i.moveEndCallback&&i.moveEndCallback(e,n)})),this.changeMode(t.Mode.Panorama,i,void 0,n)):s.moveToPano(e,i,n),this.ready()):(this.throwError(new Error("renderer is not initialized.")),Promise.resolve()):(this.throwError(new Error("controller is not initialized.")),Promise.resolve())},t.prototype.preloadPano=function(e,t){var i=this;if(void 0===t&&(t=qe),!this.work)return Promise.reject(new Error("work never loaded"));var n=this.work.observers[e],r=this.work.allowHosts,o=Ue();return Promise.all(["right","left","up","down","front","back"].map((function(t){var o=Fe({key:"pano.".concat(e,".").concat(t),basisLoaderInitialized:ii.isInitialized()},Tt(i.imageOptions,["size","format","quality","mappings"])),s=n.images[t];return lt(i.imageOptions.transform?i.imageOptions.transform(s,o):mt(s,o),{allowHosts:r,requestProxy:i.requestProxy,networkSubscribe:i.networkSubscribe})}))).then((function(){var e=Ue()-o;return t(e),e}))},t.prototype.project2d=function(e,t){if(void 0===t&&(t=!1),!this.renderer)return null;if(!1===this.model.empty&&t){var i=this.camera.position,r=e.clone().sub(i),o=new n.Raycaster(i,r.clone().normalize()),s=this.model.intersectRaycaster(o)[0];if(s&&s.distance+.01<r.length())return null}var a=e.clone().project(this.camera);if(Math.abs(a.z)>1)return null;var l=this.renderer.getSize(new n.Vector2),u=l.x*this.scissor.width,c=l.y*this.scissor.height,h=l.x*this.scissor.left+(a.x+1)/2*u,d=l.y*(1-this.scissor.bottom-this.scissor.height)+(1-a.y)/2*c;return new n.Vector2(h,d)},t.prototype.getRenderObjects=function(e){yl.multiplyMatrices(this.camera.projectionMatrix,this.camera.matrixWorldInverse),vl.setFromProjectionMatrix(yl),e||(e=this.scene);var t=[];return e.traverseVisible((function(e){(e instanceof n.Mesh||e instanceof n.Line||e instanceof n.Points)&&(e instanceof n.ImmediateRenderObject||!e.frustumCulled||vl.intersectsObject(e))&&t.push(e)})),t},t.prototype.getCurrentState=function(){return Fe(Fe({},this.getPose()),{mode:this.currentMode||t.Mode.Panorama,panoIndex:this.panoIndex||0})},t.prototype.setState=function(e,i,r){var o,s,a,l,u,c,h,d,p;void 0===i&&(i=!1),void 0===r&&(r=!0),!(e=Object.assign({},e)).offset||e instanceof n.Vector3||(e.offset=new n.Vector3(e.offset.x,e.offset.y,e.offset.z));var f,A,m,g,v,y=null!==(o=e.panoIndex)&&void 0!==o?o:this.state.panoIndex,b=null!==(s=e.mode)&&void 0!==s?s:this.state.mode;if(this.work)if(this.work.observers[y])if(e.mode!==t.Mode.Floorplan&&e.mode!==t.Mode.Topview&&e.mode!==t.Mode.Mapview&&e.mode!==t.Mode.Model||!vr(this.model)&&!0===this.model.loaded){if(this.state.mode!==b){if("VRPanorama"===b)return void this.changeMode("VRPanorama",void 0,void 0,!0);var x=void 0;x=Ja(this.state.mode)&&Ja(b)?Fe({},this.state):Ja(b)?Fe({},this.panoramaLikeSavedPose):b===t.Mode.Mapview?{longitude:this.panoramaLikeSavedPose.latitude}:Fe({},e),"number"==typeof e.longitude&&(x.longitude=e.longitude),"number"==typeof e.latitude&&(x.latitude=e.latitude),"number"==typeof e.fov&&(x.fov=e.fov);var w=Fe(Fe({initial:[y,x,this.modeChangeDuration,!1]},this.commonParams()),this.controllerInits[b]),E=Za[b].initAnimationEndPose(w);f=E.longitude,A=E.latitude,m=E.fov,g=E.offset,v=E.distance}else f=null!==(a=e.longitude)&&void 0!==a?a:this.state.longitude,A=null!==(l=e.latitude)&&void 0!==l?l:this.state.latitude,m=null!==(u=e.fov)&&void 0!==u?u:this.state.fov,g=null!==(c=e.offset)&&void 0!==c?c:this.state.offset,v=null!==(h=e.distance)&&void 0!==h?h:this.state.distance;var M={panoIndex:y,mode:b,longitude:f,latitude:A,fov:m,offset:g,distance:v};this.emit("setState",M),jo(this.state,M)||(this.controller&&"VRPanorama"===M.mode&&M.mode!==this.state.mode?(Uo(this.state,M),this.changeMode("VRPanorama")):this.controller&&"XRPanorama"===M.mode&&M.mode!==this.state.mode?(Uo(this.state,M),this.changeMode("XRPanorama")):(Uo(this.state,M),this.controller&&(this.controller.userAction=r),i&&this.state.mode===M.mode&&(this.syncingState=this.syncState(Ue(),0,i),this.syncingState&&(null===(d=this.controller)||void 0===d||d.updateTime(Ue(),0),this.syncingState=!1)),this.emit("stateChange",this.state,r),null===(p=this.analysis)||void 0===p||p.state(this.work,this.state)))}else this.throwError(new Error("model is not ready."));else this.throwError(new Error("panoIndex not found in work"));else this.throwError(new Error("work never load."))},t.prototype.aroundScissor=function(e){if(this.renderer)if("XRPanorama"!==this.state.mode){var t=new n.Vector2,i=0!==this.scissor.left||0!==this.scissor.bottom||1!==this.scissor.width||1!==this.scissor.height;if(i){this.renderer.getSize(t);var r=Math.floor(t.x*this.scissor.left),o=Math.floor(t.y*this.scissor.bottom),s=Math.floor(t.x*this.scissor.width),a=Math.floor(t.y*this.scissor.height);this.renderer.setViewport(r,o,s,a),this.renderer.setScissor(r,o,s,a),this.renderer.setScissorTest(!0)}e(),i&&(this.renderer.setViewport(0,0,t.x,t.y),this.renderer.setScissor(0,0,t.x,t.y),this.renderer.setScissorTest(!1))}else e()},t.prototype.syncState=function(e,i,r){void 0===r&&(r=!1);var o=this.stateSynced;if(this.stateSynced=!1,!this.work)return!1;if(!this.controller)return!1;if(this.state.mode!==this.currentMode){var s={mode:this.state.mode,panoIndex:this.state.panoIndex,longitude:this.state.longitude,latitude:this.state.latitude,fov:this.state.fov,offset:this.state.offset};return this.changeMode(this.state.mode,s,this.modeChangeDuration,this.controller.userAction),!0}if(!1===this.controller.isReady())return!1;if(this.controller instanceof Za.Model){if(!this.camera.pose.offset.equals(this.state.offset)){var a={longitude:this.state.longitude,latitude:this.state.latitude,fov:this.state.fov,offset:this.state.offset};return this.controller.moveToPosition(this.state.offset,a,!1),!0}}else if(this.state.panoIndex!==this.panoIndex){a={longitude:this.state.longitude,latitude:this.state.latitude,fov:this.state.fov,offset:this.state.offset,distance:this.state.distance};return this.controller.moveToPano(this.state.panoIndex,a,!1),!0}if(this.controller instanceof Za.Topview||this.controller instanceof Za.Mapview){var l=1,u=r?this.state.fov:qo(this.camera.pose.fov,this.state.fov,l),c=r?new n.Vector3(this.state.offset.x,this.state.offset.y,this.state.offset.z):new n.Vector3(qo(this.camera.pose.offset.x,this.state.offset.x,.2),qo(this.camera.pose.offset.y,this.state.offset.y,.2),qo(this.camera.pose.offset.z,this.state.offset.z,.2));if(Po(u,this.camera.pose.fov)||Do(c,this.camera.pose.offset))return this.controller.cameraMotion.set({fov:u},0).catch(qe),this.controller.locationMotion.set({x:c.x,y:c.y,z:c.z},0).catch(qe),!0}else{l=1;var h=Math.PI/45,d=(u=r?this.state.fov:qo(this.camera.pose.fov,this.state.fov,l),r?{longitude:this.state.longitude,latitude:this.state.latitude}:function(e,t,i){if(e.longitude===t.longitude&&e.latitude===t.latitude)return{longitude:t.longitude,latitude:t.latitude};var n=Vo(e.longitude),r=e.latitude,o=Vo(t.longitude),s=t.latitude;o-n>Qo?n+=Ho:n-o>Qo&&(n-=Ho);var a=i/Math.sqrt(Math.pow(o-n,2)+Math.pow(s-r,2));return a>=1?{longitude:t.longitude,latitude:t.latitude}:{longitude:n+(o-n)*a,latitude:r+(s-r)*a}}({longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude},{longitude:this.state.longitude,latitude:this.state.latitude},h)),p=d.longitude,f=d.latitude;if(Po(p,this.camera.pose.longitude,2*Math.PI)||Po(f,this.camera.pose.latitude)||Po(u,this.camera.pose.fov))return this.controller.cameraMotion.set({longitude:p,latitude:f,fov:u},0).catch(qe),!0}if(this.stateSynced=!0,!1===o&&this.emit("stateSynced",this.state),this.readyCallbacks.length&&this.stateSynced){var A=this.currentMode;if(!(A===t.Mode.Floorplan||A===t.Mode.Topview||A===t.Mode.Mapview||A===t.Mode.Model)||!this.modelPending){var m=this.readyCallbacks.slice();this.readyCallbacks.length=0;for(var g=0,v=m;g<v.length;g++){var y=v[g];this.controller instanceof Za.Panorama?!0!==y.tile||this.controller.isTileReady()?y():this.readyCallbacks.push(y):y()}}}return!1},t.prototype.ready=function(e){var t=this;return void 0===e&&(e={}),new Promise((function(i){var n;t.readyCallbacks.push(Object.assign(i,{tile:null!==(n=e.tile)&&void 0!==n&&n}))}))},t.prototype.requestFullscreen=function(){var e;if(zo()){var t=null===(e=this.getElement())||void 0===e?void 0:e.parentNode;t&&"requestFullscreen"in t&&"undefined"!=typeof document&&null===document.fullscreenElement&&t.requestFullscreen()}},t.prototype.exitFullscreen=function(){"undefined"!=typeof document&&document.fullscreenElement&&"exitFullscreen"in document&&document.exitFullscreen()},t.prototype.throwError=function(e){this.hasListener("error")?this.emit("error",e):console.error(e)},t.prototype.loadModel=function(e,t,i,r){var o=this,s=e.file;this.emit("modelWillLoad",e);var a=new wr({allowHosts:t,requestProxy:this.requestProxy,networkSubscribe:this.networkSubscribe});a.once("bvhLoaded",(function(){var e,t;o.destroyed||s===(null===(t=null===(e=o.work)||void 0===e?void 0:e.model)||void 0===t?void 0:t.file)&&o.emit("modelBvhLoaded",a)})),a.once("materialLoaded",(function(){var e,t;o.destroyed||s===(null===(t=null===(e=o.work)||void 0===e?void 0:e.model)||void 0===t?void 0:t.file)&&o.emit("modelMaterialLoaded",a)})),a.once("geometryLoaded",(function(){var e,t;o.destroyed||s===(null===(t=null===(e=o.work)||void 0===e?void 0:e.model)||void 0===t?void 0:t.file)&&(a.bounding.max.y-a.bounding.min.y<1.5&&(a.bounding.max.y=a.bounding.min.y+10),o.emit("modelGeometryLoaded",a))})),a.once("loaded",(function(){var e,t,n,r;if(!o.destroyed&&s===(null===(t=null===(e=o.work)||void 0===e?void 0:e.model)||void 0===t?void 0:t.file)){var l,u=o.model;u&&(u.show(),l=u.getMaterial()||{},o.scene.remove(u),u.dispose(),a.setTransparent(u.getTransparent())),l&&a.setMaterial(l),o.model=a,o.scene.add(a),null===(n=o.controller)||void 0===n||n.updateModel(a),null===(r=o.renderer)||void 0===r||r.compile(o.scene,o.camera),o.needsRender=!0,o.modelPending=!1,i(),o.emit("modelLoaded",a)}})),a.on("shownFloorChange",(function(e,t){var i,n;o.destroyed||s===(null===(n=null===(i=o.work)||void 0===i?void 0:i.model)||void 0===n?void 0:n.file)&&o.emit("modelShownFloorChange",e,t)})),a.on("error",(function(e){var t,r,l,u;if(!o.destroyed&&s===(null===(r=null===(t=o.work)||void 0===t?void 0:t.model)||void 0===r?void 0:r.file)){a.bounding.makeEmpty();for(var c=0,h=o.work.observers;c<h.length;c++){var d=h[c];a.bounding.expandByPoint(d.standingPosition),a.bounding.expandByPoint((new n.Vector3).fromArray([d.position.x,2*d.position.y-d.standingPosition.y,d.position.z]))}var p=Fo(a.bounding,new n.Vector3(1,0,1));p.visible=!0,p.name="model_empty",a.add(p);var f,A=o.model;A&&(A.show(),f=A.getMaterial()||{},o.scene.remove(A),A.dispose(),a.setTransparent(A.getTransparent())),f&&a.setMaterial(f),o.model=a,o.scene.add(a),null===(l=o.controller)||void 0===l||l.updateModel(a),null===(u=o.renderer)||void 0===u||u.compile(o.scene,o.camera),o.emit("modelLoadError",e,a),o.throwError(e),o.modelPending=!1,i()}})),this.modelPending=!0,a.load(e,this.textureOptions).catch(qe)},t.prototype.commonParams=function(){return{ident:this.ident,scene:this.scene,parallaxScene:this.parallaxScene,helper:this.helperGroup,camera:this.camera,renderer:this.renderer,scissor:this.scissor,element:this.getElement(),model:this.model,work:this.work,imageOptions:this.imageOptions,enableIOSEDR:this._enableIOSEDR,extraElements:this.extraElements,videoTexture:this.videoTexture,networkSubscribe:this.networkSubscribe,requestProxy:this.requestProxy}},t.prototype.saveControllerPose=function(e){void 0===e&&(e=this.controller),e&&Ja(e)&&(this.panoramaLikeSavedPose.longitude=this.camera.pose.longitude,this.panoramaLikeSavedPose.latitude=this.camera.pose.latitude,this.panoramaLikeSavedPose.fov=this.camera.pose.fov)},t.prototype.applyController=function(e,i){var n=this;if(!this.renderer)throw new Error("renderer is not initialized.");var r=Za[e];e===this.currentMode||this.model.empty||this.model.show(),this.model.setTransparent(e===t.Mode.Floorplan||e===t.Mode.Topview||e===t.Mode.Model||e===t.Mode.Mapview),this.currentMode=e;for(var o=new r(i),s=function(e){o.on(e,(function(){for(var t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];var r=n.emit.apply(n,Oe([e],t,!1));if(r)return!1}))},a=0,l=$a;a<l.length;a++){s(l[a])}var u=Za[e].initAnimationEndPose(i),c=i.initial[3],h={panoIndex:i.initial[0],mode:e,longitude:u.longitude,latitude:u.latitude,fov:u.fov,offset:u.offset,distance:u.distance};return jo(this.state,h)||(Uo(this.state,h),this.emit("stateChange",this.state,c)),this.emit("currentStateChange",this.getCurrentState(),c),o.on("cameraUpdate",(function(t,i){var r;if(n.controller){var o=Fe(Fe({},n.controller.getTargetPose()),{panoIndex:n.panoIndex,mode:e});i&&!1===n.syncingState&&n.state.mode===o.mode&&!jo(n.state,o)&&(Uo(n.state,o),n.emit("stateChange",n.state,i),null===(r=n.analysis)||void 0===r||r.state(n.work,n.state))}n.emit("currentStateChange",n.getCurrentState(),i)})),o.on("initAnimationWillStart",(function(t,i,r){var o,s=Fe(Fe({},i),{panoIndex:t,mode:e});r&&n.state.mode===s.mode&&!jo(n.state,s)&&(Uo(n.state,s),n.emit("stateChange",n.state,r),null===(o=n.analysis)||void 0===o||o.state(n.work,n.state))})),o.on("initAnimationEnded",(function(t,i,r){var o,s=Fe(Fe({},i),{panoIndex:t,mode:e});r&&n.state.mode===s.mode&&!jo(n.state,s)&&(Uo(n.state,s),n.emit("stateChange",n.state,r),null===(o=n.analysis)||void 0===o||o.state(n.work,n.state))})),o.on("panoWillArrive",(function(t,i,r){var o;n.panoIndex=t;var s=Fe(Fe({},i),{panoIndex:t,mode:e});r&&n.state.mode===s.mode&&!jo(n.state,s)&&(Uo(n.state,s),n.emit("stateChange",n.state,r),null===(o=n.analysis)||void 0===o||o.state(n.work,n.state))})),o.on("panoArrived",(function(t,i,r){var o,s=Fe(Fe({},i),{panoIndex:t,mode:e});r&&n.state.mode===s.mode&&!jo(n.state,s)&&(Uo(n.state,s),n.emit("stateChange",n.state,r),null===(o=n.analysis)||void 0===o||o.state(n.work,n.state))})),o.on("moveToPano",(function(e,t){n.emit("currentStateChange",n.getCurrentState(),t)})),o.on("wantsMoveToPano",(function(e,t,i){var r=n.emit("wantsMoveToPano",e,t,i);r||(r=n.emit("wantsToMoveToPano",e,t,i)),r||n.moveToPano(e,t,i)})),o.on("vrWantsToExit",(function(){n.currentMode===t.Mode.VRPanorama&&(n.exitFullscreen(),n.changeMode(t.Mode.Panorama))})),o.on("error",(function(e){return n.throwError(e)})),o},t.prototype.removeEventListeners=function(){},t.prototype.diposeGPUPickingMaterial=function(){this.meshReplaceMaterialMap.forEach((function(e){e.dispose()})),this.meshOriginMaterialMap.forEach((function(e){e.dispose()}))},t.Mode={Panorama:"Panorama",Model:"Model",Floorplan:"Floorplan",Topview:"Topview",Mapview:"Mapview",DepthPanorama:"DepthPanorama",VRPanorama:"VRPanorama",XRPanorama:"XRPanorama"},t.Line=null,t}(He),El={instances:{},constructor:wl};"undefined"!=typeof window&&Object.assign(window,{__FIVE_DEBUG__:El});var Ml=function(){function e(){}return e.createButton=function(e){var t=document.createElement("button");function i(){t.style.display="",t.style.cursor="auto",t.style.left="calc(50% - 75px)",t.style.width="150px",t.onmouseenter=null,t.onmouseleave=null,t.onclick=null,t.textContent="VR NOT SUPPORTED"}function n(e){e.style.position="absolute",e.style.bottom="20px",e.style.padding="12px 6px",e.style.border="1px solid #fff",e.style.borderRadius="4px",e.style.background="rgba(0,0,0,0.1)",e.style.color="#fff",e.style.font="normal 13px sans-serif",e.style.textAlign="center",e.style.opacity="0.5",e.style.outline="none",e.style.zIndex="999"}if("xr"in navigator)return t.id="VRButton",t.style.display="none",n(t),navigator.xr.isSessionSupported("immersive-vr").then((function(n){n?(t.style.display="",t.style.cursor="pointer",t.style.left="calc(50% - 50px)",t.style.width="100px",t.textContent="ENTER VR",t.onmouseenter=function(){t.style.opacity="1.0"},t.onmouseleave=function(){t.style.opacity="0.5"},t.onclick=function(){e&&e()}):i()})),t;var r=document.createElement("a");return!1===window.isSecureContext?(r.href=document.location.href.replace(/^http:/,"https:"),r.innerHTML="WEBXR NEEDS HTTPS"):(r.href="https://immersiveweb.dev/",r.innerHTML="WEBXR NOT AVAILABLE"),r.style.left="calc(50% - 90px)",r.style.width="180px",r.style.textDecoration="none",n(r),r},e}();exports.AnimationFrameLoop=dt,exports.BVH=Bi,exports.BVHIntersect=Ei,exports.BVHNode=wi,exports.BVHVector3=xi,exports.Camera=bi,exports.Clipper=bt,exports.Five=wl,exports.InternalWebGLRenderer=hi,exports.IntersectMesh=Bo,exports.Model=wr,exports.NetworkSubscribe=ot,exports.PBMContainer=wt,exports.PBMGroup=Et,exports.PBMMaterial=ci,exports.PBMMesh=xt,exports.PROXY_CONTROLLER_EVENT_NAMES=$a,exports.PanoCircleMesh=uo,exports.PanoCircleMeshSolid=Mo,exports.Scene=di,exports.Subscribe=He,exports.TextureLoader=oi,exports.Tile3D=Jn,exports.Tile3DModel=gr,exports.TileBoundingSphere=Mn,exports.TileCacheNode=pn,exports.TileCubeTextureTarget=ri,exports.TileCullingVolume=bn,exports.TileOrientedBoundingBox=Un,exports.TileRequestScheduler=dn,exports.Tileset3D=ir,exports.Tileset3DTraverser=er,exports.TilesetCache=An,exports.Work=kr,exports.XRButton=Ml,exports.defaultImageURLTransform=mt,exports.getViewportScale=tl,exports.imageSupport=function(){return yt||(yt=Promise.all([vt("data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A="),vt("data:image/webp;base64,UklGRjoAAABXRUJQVlA4IC4AAACyAgCdASoCAAIALmk0mk0iIiIiIgBoSygABc6WWgAA/veff/0PP8bA//LwYAAA")]).then((function(e){var t=e[0];return{webp:e[1],avif:t}})).catch((function(){return{webp:!1,avif:!1}})))},exports.parseWork=Vr;