@realsee/five 5.0.0-alpha.162 → 5.0.0-alpha.164
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/docs/assets/search.js +1 -1
- package/docs/classes/five.AnimationFrameLoop.html +1 -1
- package/docs/classes/five.BVH.html +1 -1
- package/docs/classes/five.BVHIntersect.html +1 -1
- package/docs/classes/five.BVHNode.html +1 -1
- package/docs/classes/five.BVHVector3.html +1 -1
- package/docs/classes/five.Camera.html +1 -1
- package/docs/classes/five.Clipper.html +1 -1
- package/docs/classes/five.Five.html +1 -1
- package/docs/classes/five.InternalWebGLRenderer.html +1 -1
- package/docs/classes/five.IntersectMesh.html +1 -1
- package/docs/classes/five.LegacyPanoCircleMesh.html +3 -3
- package/docs/classes/five.Model.html +25 -25
- package/docs/classes/five.NetworkSubscribe.html +1 -1
- package/docs/classes/five.PBMContainer.html +1 -1
- package/docs/classes/five.PBMGroup.html +1 -1
- package/docs/classes/five.PBMMaterial.html +1 -1
- package/docs/classes/five.PBMMesh.html +1 -1
- package/docs/classes/five.PanoCircleMesh.html +4 -4
- package/docs/classes/five.PanoCircleMeshDark.html +5 -5
- package/docs/classes/five.PanoCircleMeshSolid.html +4 -4
- package/docs/classes/five.Scene.html +1 -1
- package/docs/classes/five.Subscribe.html +1 -1
- package/docs/classes/five.TextureLoader.html +1 -1
- package/docs/classes/five.Tile3D.html +2 -2
- package/docs/classes/five.Tile3DModel.html +4 -4
- package/docs/classes/five.TileBoundingSphere.html +1 -1
- package/docs/classes/five.TileCacheNode.html +1 -1
- package/docs/classes/five.TileCubeTextureTarget.html +1 -1
- package/docs/classes/five.TileCullingVolume.html +1 -1
- package/docs/classes/five.TileOrientedBoundingBox.html +1 -1
- package/docs/classes/five.TileRequestScheduler.html +1 -1
- package/docs/classes/five.Tileset3D.html +4 -4
- package/docs/classes/five.Tileset3DTraverser.html +1 -1
- package/docs/classes/five.TilesetCache.html +1 -1
- package/docs/classes/five.Work.html +1 -1
- package/docs/classes/five.XRButton.html +1 -1
- package/docs/classes/gltf_loader.DDSLoader.html +1 -1
- package/docs/classes/gltf_loader.DRACOLoader.html +1 -1
- package/docs/classes/gltf_loader.GLTFLoader.html +1 -1
- package/docs/classes/gltf_loader.GLTFObject.html +1 -1
- package/docs/classes/gltf_loader.GLTFParser.html +1 -1
- package/docs/classes/gltf_loader.THREEGLTFLoader.html +1 -1
- package/docs/classes/line.Line.html +1 -1
- package/docs/classes/line.LineGeometry.html +1 -1
- package/docs/classes/line.LineMaterial.html +1 -1
- package/docs/classes/line.LineSegmentsGeometry.html +1 -1
- package/docs/classes/line.THREE_Line2.html +1 -1
- package/docs/classes/line.THREE_LineSegments2.html +1 -1
- package/docs/classes/react.Store.html +1 -1
- package/docs/classes/server.BVH.html +1 -1
- package/docs/classes/server.BVHIntersect.html +1 -1
- package/docs/classes/server.BVHNode.html +1 -1
- package/docs/classes/server.BVHVector3.html +1 -1
- package/docs/classes/server.Model.html +25 -18
- package/docs/classes/server.PBMContainer.html +7 -0
- package/docs/classes/server.PBMGroup.html +1 -1
- package/docs/classes/server.PBMMesh.html +1 -1
- package/docs/classes/sticker.Sticker.html +1 -1
- package/docs/classes/vfx.Airflow.html +1 -1
- package/docs/classes/vfx.Flame.html +1 -1
- package/docs/classes/vfx.Particle.html +1 -1
- package/docs/classes/vfx.SpotLight.html +1 -1
- package/docs/index.html +1 -1
- package/docs/interfaces/five.AddableObject.html +1 -1
- package/docs/interfaces/five.AnimationFrame.html +1 -1
- package/docs/interfaces/five.CameraPose.html +1 -1
- package/docs/interfaces/five.ClipperParameter.html +1 -1
- package/docs/interfaces/five.DepthPanoramaControllerCustomInitArgs.html +1 -1
- package/docs/interfaces/five.EventCallback.html +1 -1
- package/docs/interfaces/five.FiveInitArgs.html +1 -1
- package/docs/interfaces/five.FloorplanControllerCustomInitArgs.html +1 -1
- package/docs/interfaces/five.ImageOptions.html +1 -1
- package/docs/interfaces/five.ImageURLMappings.html +1 -1
- package/docs/interfaces/five.ImageURLOptions.html +1 -1
- package/docs/interfaces/five.IntersectMeshInterface.html +1 -1
- package/docs/interfaces/five.Intersection.html +3 -3
- package/docs/interfaces/five.MapviewControllerCustomInitArgs.html +1 -1
- package/docs/interfaces/five.ModelControllerCustomInitArgs.html +1 -1
- package/docs/interfaces/five.ModelEventCallback.html +7 -7
- package/docs/interfaces/five.MotionKeyframe.html +1 -1
- package/docs/interfaces/five.MovePanoOptions.html +1 -1
- package/docs/interfaces/five.NetworkOptions.html +1 -1
- package/docs/interfaces/five.PBMPanoPicture.html +1 -1
- package/docs/interfaces/five.PBMParameters.html +1 -1
- package/docs/interfaces/five.PanoCircleMeshInterface.html +1 -1
- package/docs/interfaces/five.PanoramaControllerCustomInitArgs.html +1 -1
- package/docs/interfaces/five.PanoramaLikeControllerCustomInitArgs.html +1 -1
- package/docs/interfaces/five.Pose.html +1 -1
- package/docs/interfaces/five.Scissor.html +1 -1
- package/docs/interfaces/five.State.html +1 -1
- package/docs/interfaces/five.SubscribeMixinType.emit.html +1 -1
- package/docs/interfaces/five.SubscribeMixinType.hasListener.html +1 -1
- package/docs/interfaces/five.SubscribeMixinType.off.html +1 -1
- package/docs/interfaces/five.SubscribeMixinType.on.html +1 -1
- package/docs/interfaces/five.SubscribeMixinType.once.html +1 -1
- package/docs/interfaces/five.TextureOptions.html +1 -1
- package/docs/interfaces/five.Tile3DModelLoaderOptions.html +2 -2
- package/docs/interfaces/five.TileBoundingVolume.html +5 -5
- package/docs/interfaces/five.TileContent.html +1 -1
- package/docs/interfaces/five.TileCubeNode.html +1 -1
- package/docs/interfaces/five.TileCubeTree.html +1 -1
- package/docs/interfaces/five.Tileset3dOptions.html +1 -1
- package/docs/interfaces/five.TilesetJSON.html +1 -1
- package/docs/interfaces/five.TilesetJSONNode.html +1 -1
- package/docs/interfaces/five.TopviewControllerCustomInitArgs.html +1 -1
- package/docs/interfaces/five.VRPanoramaControllerCustomInitArgs.html +1 -1
- package/docs/interfaces/five.WebXRSelectParams.html +1 -1
- package/docs/interfaces/five.WorkCubeImage.html +1 -1
- package/docs/interfaces/five.WorkImage.html +1 -1
- package/docs/interfaces/five.WorkInitial.html +1 -1
- package/docs/interfaces/five.WorkModel.html +1 -1
- package/docs/interfaces/five.WorkModelTiles.html +1 -1
- package/docs/interfaces/five.WorkObserver.html +1 -1
- package/docs/interfaces/five.WorkTile.html +1 -1
- package/docs/interfaces/five.WorkVideo.html +1 -1
- package/docs/interfaces/five.XRPanoramaControllerCustomInitArgs.html +1 -1
- package/docs/interfaces/gltf_loader.DDS.html +1 -1
- package/docs/interfaces/gltf_loader.GLTF.html +1 -1
- package/docs/interfaces/gltf_loader.GLTFReference.html +1 -1
- package/docs/interfaces/gltf_loader.THREEGLTF.html +1 -1
- package/docs/interfaces/react.FiveActionReactCallbacks.html +1 -1
- package/docs/interfaces/react.FiveInjectionTypes.html +1 -1
- package/docs/interfaces/react.PropTypeOfFiveFeatures.html +1 -1
- package/docs/interfaces/server.Intersection.html +3 -3
- package/docs/interfaces/server.ModelEventCallback.html +6 -6
- package/docs/interfaces/sticker.IntersectionLike.html +1 -1
- package/docs/interfaces/vfx.ParticleArgs.html +1 -1
- package/docs/interfaces/vfx.ParticleTweenKeyframe.html +1 -1
- package/docs/interfaces/vue.FiveActionVueCallbacks.html +12 -4
- package/docs/modules/five.SubscribeMixinType.html +1 -1
- package/docs/modules/five.html +10 -10
- package/docs/modules/gltf_loader.html +1 -1
- package/docs/modules/line.html +1 -1
- package/docs/modules/react.html +1 -1
- package/docs/modules/server.html +7 -7
- package/docs/modules/sticker.html +1 -1
- package/docs/modules/vfx.html +1 -1
- package/docs/modules/vue.html +9 -6
- package/docs/modules.html +1 -1
- package/five/index.d.ts +9 -26
- package/five/index.js +12 -12
- package/gltf-loader/index.js +3 -3
- package/line/index.js +3 -3
- package/package.json +2 -5
- package/react/index.js +3 -3
- package/server/index.d.ts +20 -1
- package/server/index.js +11 -11
- package/sticker/index.js +3 -3
- package/umd/five-gltf-loader.js +1 -1
- package/umd/five-line.js +1 -1
- package/umd/five-sticker.js +1 -1
- package/umd/five-vue.js +1 -1
- package/umd/five.js +1 -1
- package/vfx/index.js +3 -3
- package/vue/index.d.ts +24 -3
- package/vue/index.js +3 -3
- package/docs/classes/five.TilePlane.html +0 -1
package/umd/five.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see five.js.LICENSE.txt */
|
|
2
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.FiveSDK=t():e.FiveSDK=t()}(self,(()=>(()=>{var __webpack_modules__={438:e=>{if(!("THREE"in window))throw new Error('"THREE" is not available. Please include "three.js" in your HTML.');const t=Number(THREE.REVISION);if(t<115||t>117)throw new Error('"Five" needs "THREE.js" version between 125 - 117.');e.exports=window.THREE},383:e=>{"use strict";e.exports=function(e,t){for(var i=new Array(arguments.length-1),r=0,n=2,o=!0;n<arguments.length;)i[r++]=arguments[n++];return new Promise((function(n,s){i[r]=function(e){if(o)if(o=!1,e)s(e);else{for(var t=new Array(arguments.length-1),i=0;i<t.length;)t[i++]=arguments[i];n.apply(null,t)}};try{e.apply(t||null,i)}catch(e){o&&(o=!1,s(e))}}))}},417:(e,t)=>{"use strict";var i=t;i.length=function(e){var t=e.length;if(!t)return 0;for(var i=0;--t%4>1&&"="===e.charAt(t);)++i;return Math.ceil(3*e.length)/4-i};for(var r=new Array(64),n=new Array(123),o=0;o<64;)n[r[o]=o<26?o+65:o<52?o+71:o<62?o-4:o-59|43]=o++;i.encode=function(e,t,i){for(var n,o=null,s=[],a=0,l=0;t<i;){var u=e[t++];switch(l){case 0:s[a++]=r[u>>2],n=(3&u)<<4,l=1;break;case 1:s[a++]=r[n|u>>4],n=(15&u)<<2,l=2;break;case 2:s[a++]=r[n|u>>6],s[a++]=r[63&u],l=0}a>8191&&((o||(o=[])).push(String.fromCharCode.apply(String,s)),a=0)}return l&&(s[a++]=r[n],s[a++]=61,1===l&&(s[a++]=61)),o?(a&&o.push(String.fromCharCode.apply(String,s.slice(0,a))),o.join("")):String.fromCharCode.apply(String,s.slice(0,a))};var s="invalid encoding";i.decode=function(e,t,i){for(var r,o=i,a=0,l=0;l<e.length;){var u=e.charCodeAt(l++);if(61===u&&a>1)break;if(void 0===(u=n[u]))throw Error(s);switch(a){case 0:r=u,a=1;break;case 1:t[i++]=r<<2|(48&u)>>4,r=u,a=2;break;case 2:t[i++]=(15&r)<<4|(60&u)>>2,r=u,a=3;break;case 3:t[i++]=(3&r)<<6|u,a=0}}if(1===a)throw Error(s);return i-o},i.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}},516:e=>{"use strict";function t(){this._listeners={}}e.exports=t,t.prototype.on=function(e,t,i){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:t,ctx:i||this}),this},t.prototype.off=function(e,t){if(void 0===e)this._listeners={};else if(void 0===t)this._listeners[e]=[];else for(var i=this._listeners[e],r=0;r<i.length;)i[r].fn===t?i.splice(r,1):++r;return this},t.prototype.emit=function(e){var t=this._listeners[e];if(t){for(var i=[],r=1;r<arguments.length;)i.push(arguments[r++]);for(r=0;r<t.length;)t[r].fn.apply(t[r++].ctx,i)}return this}},787:e=>{"use strict";function t(e){return"undefined"!=typeof Float32Array?function(){var t=new Float32Array([-0]),i=new Uint8Array(t.buffer),r=128===i[3];function n(e,r,n){t[0]=e,r[n]=i[0],r[n+1]=i[1],r[n+2]=i[2],r[n+3]=i[3]}function o(e,r,n){t[0]=e,r[n]=i[3],r[n+1]=i[2],r[n+2]=i[1],r[n+3]=i[0]}function s(e,r){return i[0]=e[r],i[1]=e[r+1],i[2]=e[r+2],i[3]=e[r+3],t[0]}function a(e,r){return i[3]=e[r],i[2]=e[r+1],i[1]=e[r+2],i[0]=e[r+3],t[0]}e.writeFloatLE=r?n:o,e.writeFloatBE=r?o:n,e.readFloatLE=r?s:a,e.readFloatBE=r?a:s}():function(){function t(e,t,i,r){var n=t<0?1:0;if(n&&(t=-t),0===t)e(1/t>0?0:2147483648,i,r);else if(isNaN(t))e(2143289344,i,r);else if(t>34028234663852886e22)e((n<<31|2139095040)>>>0,i,r);else if(t<11754943508222875e-54)e((n<<31|Math.round(t/1401298464324817e-60))>>>0,i,r);else{var o=Math.floor(Math.log(t)/Math.LN2);e((n<<31|o+127<<23|8388607&Math.round(t*Math.pow(2,-o)*8388608))>>>0,i,r)}}function s(e,t,i){var r=e(t,i),n=2*(r>>31)+1,o=r>>>23&255,s=8388607&r;return 255===o?s?NaN:n*(1/0):0===o?1401298464324817e-60*n*s:n*Math.pow(2,o-150)*(s+8388608)}e.writeFloatLE=t.bind(null,i),e.writeFloatBE=t.bind(null,r),e.readFloatLE=s.bind(null,n),e.readFloatBE=s.bind(null,o)}(),"undefined"!=typeof Float64Array?function(){var t=new Float64Array([-0]),i=new Uint8Array(t.buffer),r=128===i[7];function n(e,r,n){t[0]=e,r[n]=i[0],r[n+1]=i[1],r[n+2]=i[2],r[n+3]=i[3],r[n+4]=i[4],r[n+5]=i[5],r[n+6]=i[6],r[n+7]=i[7]}function o(e,r,n){t[0]=e,r[n]=i[7],r[n+1]=i[6],r[n+2]=i[5],r[n+3]=i[4],r[n+4]=i[3],r[n+5]=i[2],r[n+6]=i[1],r[n+7]=i[0]}function s(e,r){return i[0]=e[r],i[1]=e[r+1],i[2]=e[r+2],i[3]=e[r+3],i[4]=e[r+4],i[5]=e[r+5],i[6]=e[r+6],i[7]=e[r+7],t[0]}function a(e,r){return i[7]=e[r],i[6]=e[r+1],i[5]=e[r+2],i[4]=e[r+3],i[3]=e[r+4],i[2]=e[r+5],i[1]=e[r+6],i[0]=e[r+7],t[0]}e.writeDoubleLE=r?n:o,e.writeDoubleBE=r?o:n,e.readDoubleLE=r?s:a,e.readDoubleBE=r?a:s}():function(){function t(e,t,i,r,n,o){var s=r<0?1:0;if(s&&(r=-r),0===r)e(0,n,o+t),e(1/r>0?0:2147483648,n,o+i);else if(isNaN(r))e(0,n,o+t),e(2146959360,n,o+i);else if(r>17976931348623157e292)e(0,n,o+t),e((s<<31|2146435072)>>>0,n,o+i);else{var a;if(r<22250738585072014e-324)e((a=r/5e-324)>>>0,n,o+t),e((s<<31|a/4294967296)>>>0,n,o+i);else{var l=Math.floor(Math.log(r)/Math.LN2);1024===l&&(l=1023),e(4503599627370496*(a=r*Math.pow(2,-l))>>>0,n,o+t),e((s<<31|l+1023<<20|1048576*a&1048575)>>>0,n,o+i)}}}function s(e,t,i,r,n){var o=e(r,n+t),s=e(r,n+i),a=2*(s>>31)+1,l=s>>>20&2047,u=4294967296*(1048575&s)+o;return 2047===l?u?NaN:a*(1/0):0===l?5e-324*a*u:a*Math.pow(2,l-1075)*(u+4503599627370496)}e.writeDoubleLE=t.bind(null,i,0,4),e.writeDoubleBE=t.bind(null,r,4,0),e.readDoubleLE=s.bind(null,n,0,4),e.readDoubleBE=s.bind(null,o,4,0)}(),e}function i(e,t,i){t[i]=255&e,t[i+1]=e>>>8&255,t[i+2]=e>>>16&255,t[i+3]=e>>>24}function r(e,t,i){t[i]=e>>>24,t[i+1]=e>>>16&255,t[i+2]=e>>>8&255,t[i+3]=255&e}function n(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}function o(e,t){return(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}e.exports=t(t)},795:module=>{"use strict";function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(e){}return null}module.exports=inquire},476:e=>{"use strict";e.exports=function(e,t,i){var r=i||8192,n=r>>>1,o=null,s=r;return function(i){if(i<1||i>n)return e(i);s+i>r&&(o=e(r),s=0);var a=t.call(o,s,s+=i);return 7&s&&(s=1+(7|s)),a}}},893:(e,t)=>{"use strict";var i=t;i.length=function(e){for(var t=0,i=0,r=0;r<e.length;++r)(i=e.charCodeAt(r))<128?t+=1:i<2048?t+=2:55296==(64512&i)&&56320==(64512&e.charCodeAt(r+1))?(++r,t+=4):t+=3;return t},i.read=function(e,t,i){if(i-t<1)return"";for(var r,n=null,o=[],s=0;t<i;)(r=e[t++])<128?o[s++]=r:r>191&&r<224?o[s++]=(31&r)<<6|63&e[t++]:r>239&&r<365?(r=((7&r)<<18|(63&e[t++])<<12|(63&e[t++])<<6|63&e[t++])-65536,o[s++]=55296+(r>>10),o[s++]=56320+(1023&r)):o[s++]=(15&r)<<12|(63&e[t++])<<6|63&e[t++],s>8191&&((n||(n=[])).push(String.fromCharCode.apply(String,o)),s=0);return n?(s&&n.push(String.fromCharCode.apply(String,o.slice(0,s))),n.join("")):String.fromCharCode.apply(String,o.slice(0,s))},i.write=function(e,t,i){for(var r,n,o=i,s=0;s<e.length;++s)(r=e.charCodeAt(s))<128?t[i++]=r:r<2048?(t[i++]=r>>6|192,t[i++]=63&r|128):55296==(64512&r)&&56320==(64512&(n=e.charCodeAt(s+1)))?(r=65536+((1023&r)<<10)+(1023&n),++s,t[i++]=r>>18|240,t[i++]=r>>12&63|128,t[i++]=r>>6&63|128,t[i++]=63&r|128):(t[i++]=r>>12|224,t[i++]=r>>6&63|128,t[i++]=63&r|128);return i-o}},967:(e,t,i)=>{"use strict";e.exports=i(365)},365:(e,t,i)=>{"use strict";var r=t;function n(){r.util._configure(),r.Writer._configure(r.BufferWriter),r.Reader._configure(r.BufferReader)}r.build="minimal",r.Writer=i(147),r.BufferWriter=i(55),r.Reader=i(74),r.BufferReader=i(69),r.util=i(835),r.rpc=i(876),r.roots=i(7),r.configure=n,n()},74:(e,t,i)=>{"use strict";e.exports=l;var r,n=i(835),o=n.LongBits,s=n.utf8;function a(e,t){return RangeError("index out of range: "+e.pos+" + "+(t||1)+" > "+e.len)}function l(e){this.buf=e,this.pos=0,this.len=e.length}var u,h="undefined"!=typeof Uint8Array?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new l(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new l(e);throw Error("illegal buffer")},c=function(){return n.Buffer?function(e){return(l.create=function(e){return n.Buffer.isBuffer(e)?new r(e):h(e)})(e)}:h};function d(){var e=new o(0,0),t=0;if(!(this.len-this.pos>4)){for(;t<3;++t){if(this.pos>=this.len)throw a(this);if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e}return e.lo=(e.lo|(127&this.buf[this.pos++])<<7*t)>>>0,e}for(;t<4;++t)if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e;if(e.lo=(e.lo|(127&this.buf[this.pos])<<28)>>>0,e.hi=(e.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return e;if(t=0,this.len-this.pos>4){for(;t<5;++t)if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}else for(;t<5;++t){if(this.pos>=this.len)throw a(this);if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}throw Error("invalid varint encoding")}function p(e,t){return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0}function f(){if(this.pos+8>this.len)throw a(this,8);return new o(p(this.buf,this.pos+=4),p(this.buf,this.pos+=4))}l.create=c(),l.prototype._slice=n.Array.prototype.subarray||n.Array.prototype.slice,l.prototype.uint32=(u=4294967295,function(){if(u=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128)return u;if(u=(u|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)return u;if(u=(u|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)return u;if(u=(u|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)return u;if(u=(u|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128)return u;if((this.pos+=5)>this.len)throw this.pos=this.len,a(this,10);return u}),l.prototype.int32=function(){return 0|this.uint32()},l.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(1&e)|0},l.prototype.bool=function(){return 0!==this.uint32()},l.prototype.fixed32=function(){if(this.pos+4>this.len)throw a(this,4);return p(this.buf,this.pos+=4)},l.prototype.sfixed32=function(){if(this.pos+4>this.len)throw a(this,4);return 0|p(this.buf,this.pos+=4)},l.prototype.float=function(){if(this.pos+4>this.len)throw a(this,4);var e=n.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e},l.prototype.double=function(){if(this.pos+8>this.len)throw a(this,4);var e=n.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e},l.prototype.bytes=function(){var e=this.uint32(),t=this.pos,i=this.pos+e;if(i>this.len)throw a(this,e);return this.pos+=e,Array.isArray(this.buf)?this.buf.slice(t,i):t===i?new this.buf.constructor(0):this._slice.call(this.buf,t,i)},l.prototype.string=function(){var e=this.bytes();return s.read(e,0,e.length)},l.prototype.skip=function(e){if("number"==typeof e){if(this.pos+e>this.len)throw a(this,e);this.pos+=e}else do{if(this.pos>=this.len)throw a(this)}while(128&this.buf[this.pos++]);return this},l.prototype.skipType=function(e){switch(e){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;4!=(e=7&this.uint32());)this.skipType(e);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+e+" at offset "+this.pos)}return this},l._configure=function(e){r=e,l.create=c(),r._configure();var t=n.Long?"toLong":"toNumber";n.merge(l.prototype,{int64:function(){return d.call(this)[t](!1)},uint64:function(){return d.call(this)[t](!0)},sint64:function(){return d.call(this).zzDecode()[t](!1)},fixed64:function(){return f.call(this)[t](!0)},sfixed64:function(){return f.call(this)[t](!1)}})}},69:(e,t,i)=>{"use strict";e.exports=o;var r=i(74);(o.prototype=Object.create(r.prototype)).constructor=o;var n=i(835);function o(e){r.call(this,e)}o._configure=function(){n.Buffer&&(o.prototype._slice=n.Buffer.prototype.slice)},o.prototype.string=function(){var e=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+e,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+e,this.len))},o._configure()},7:e=>{"use strict";e.exports={}},876:(e,t,i)=>{"use strict";t.Service=i(380)},380:(e,t,i)=>{"use strict";e.exports=n;var r=i(835);function n(e,t,i){if("function"!=typeof e)throw TypeError("rpcImpl must be a function");r.EventEmitter.call(this),this.rpcImpl=e,this.requestDelimited=Boolean(t),this.responseDelimited=Boolean(i)}(n.prototype=Object.create(r.EventEmitter.prototype)).constructor=n,n.prototype.rpcCall=function e(t,i,n,o,s){if(!o)throw TypeError("request must be specified");var a=this;if(!s)return r.asPromise(e,a,t,i,n,o);if(a.rpcImpl)try{return a.rpcImpl(t,i[a.requestDelimited?"encodeDelimited":"encode"](o).finish(),(function(e,i){if(e)return a.emit("error",e,t),s(e);if(null!==i){if(!(i instanceof n))try{i=n[a.responseDelimited?"decodeDelimited":"decode"](i)}catch(e){return a.emit("error",e,t),s(e)}return a.emit("data",i,t),s(null,i)}a.end(!0)}))}catch(e){return a.emit("error",e,t),void setTimeout((function(){s(e)}),0)}else setTimeout((function(){s(Error("already ended"))}),0)},n.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}},600:(e,t,i)=>{"use strict";e.exports=n;var r=i(835);function n(e,t){this.lo=e>>>0,this.hi=t>>>0}var o=n.zero=new n(0,0);o.toNumber=function(){return 0},o.zzEncode=o.zzDecode=function(){return this},o.length=function(){return 1};var s=n.zeroHash="\0\0\0\0\0\0\0\0";n.fromNumber=function(e){if(0===e)return o;var t=e<0;t&&(e=-e);var i=e>>>0,r=(e-i)/4294967296>>>0;return t&&(r=~r>>>0,i=~i>>>0,++i>4294967295&&(i=0,++r>4294967295&&(r=0))),new n(i,r)},n.from=function(e){if("number"==typeof e)return n.fromNumber(e);if(r.isString(e)){if(!r.Long)return n.fromNumber(parseInt(e,10));e=r.Long.fromString(e)}return e.low||e.high?new n(e.low>>>0,e.high>>>0):o},n.prototype.toNumber=function(e){if(!e&&this.hi>>>31){var t=1+~this.lo>>>0,i=~this.hi>>>0;return t||(i=i+1>>>0),-(t+4294967296*i)}return this.lo+4294967296*this.hi},n.prototype.toLong=function(e){return r.Long?new r.Long(0|this.lo,0|this.hi,Boolean(e)):{low:0|this.lo,high:0|this.hi,unsigned:Boolean(e)}};var a=String.prototype.charCodeAt;n.fromHash=function(e){return e===s?o:new n((a.call(e,0)|a.call(e,1)<<8|a.call(e,2)<<16|a.call(e,3)<<24)>>>0,(a.call(e,4)|a.call(e,5)<<8|a.call(e,6)<<16|a.call(e,7)<<24)>>>0)},n.prototype.toHash=function(){return String.fromCharCode(255&this.lo,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,255&this.hi,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},n.prototype.zzEncode=function(){var e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this},n.prototype.zzDecode=function(){var e=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this},n.prototype.length=function(){var e=this.lo,t=(this.lo>>>28|this.hi<<4)>>>0,i=this.hi>>>24;return 0===i?0===t?e<16384?e<128?1:2:e<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:i<128?9:10}},835:function(e,t,i){"use strict";var r=t;function n(e,t,i){for(var r=Object.keys(t),n=0;n<r.length;++n)void 0!==e[r[n]]&&i||(e[r[n]]=t[r[n]]);return e}function o(e){function t(e,i){if(!(this instanceof t))return new t(e,i);Object.defineProperty(this,"message",{get:function(){return e}}),Error.captureStackTrace?Error.captureStackTrace(this,t):Object.defineProperty(this,"stack",{value:(new Error).stack||""}),i&&n(this,i)}return(t.prototype=Object.create(Error.prototype)).constructor=t,Object.defineProperty(t.prototype,"name",{get:function(){return e}}),t.prototype.toString=function(){return this.name+": "+this.message},t}r.asPromise=i(383),r.base64=i(417),r.EventEmitter=i(516),r.float=i(787),r.inquire=i(795),r.utf8=i(893),r.pool=i(476),r.LongBits=i(600),r.isNode=Boolean(void 0!==i.g&&i.g&&i.g.process&&i.g.process.versions&&i.g.process.versions.node),r.global=r.isNode&&i.g||"undefined"!=typeof window&&window||"undefined"!=typeof self&&self||this,r.emptyArray=Object.freeze?Object.freeze([]):[],r.emptyObject=Object.freeze?Object.freeze({}):{},r.isInteger=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e},r.isString=function(e){return"string"==typeof e||e instanceof String},r.isObject=function(e){return e&&"object"==typeof e},r.isset=r.isSet=function(e,t){var i=e[t];return!(null==i||!e.hasOwnProperty(t))&&("object"!=typeof i||(Array.isArray(i)?i.length:Object.keys(i).length)>0)},r.Buffer=function(){try{var e=r.inquire("buffer").Buffer;return e.prototype.utf8Write?e:null}catch(e){return null}}(),r._Buffer_from=null,r._Buffer_allocUnsafe=null,r.newBuffer=function(e){return"number"==typeof e?r.Buffer?r._Buffer_allocUnsafe(e):new r.Array(e):r.Buffer?r._Buffer_from(e):"undefined"==typeof Uint8Array?e:new Uint8Array(e)},r.Array="undefined"!=typeof Uint8Array?Uint8Array:Array,r.Long=r.global.dcodeIO&&r.global.dcodeIO.Long||r.global.Long||r.inquire("long"),r.key2Re=/^true|false|0|1$/,r.key32Re=/^-?(?:0|[1-9][0-9]*)$/,r.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,r.longToHash=function(e){return e?r.LongBits.from(e).toHash():r.LongBits.zeroHash},r.longFromHash=function(e,t){var i=r.LongBits.fromHash(e);return r.Long?r.Long.fromBits(i.lo,i.hi,t):i.toNumber(Boolean(t))},r.merge=n,r.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)},r.newError=o,r.ProtocolError=o("ProtocolError"),r.oneOfGetter=function(e){for(var t={},i=0;i<e.length;++i)t[e[i]]=1;return function(){for(var e=Object.keys(this),i=e.length-1;i>-1;--i)if(1===t[e[i]]&&void 0!==this[e[i]]&&null!==this[e[i]])return e[i]}},r.oneOfSetter=function(e){return function(t){for(var i=0;i<e.length;++i)e[i]!==t&&delete this[e[i]]}},r.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},r._configure=function(){var e=r.Buffer;e?(r._Buffer_from=e.from!==Uint8Array.from&&e.from||function(t,i){return new e(t,i)},r._Buffer_allocUnsafe=e.allocUnsafe||function(t){return new e(t)}):r._Buffer_from=r._Buffer_allocUnsafe=null}},147:(e,t,i)=>{"use strict";e.exports=c;var r,n=i(835),o=n.LongBits,s=n.base64,a=n.utf8;function l(e,t,i){this.fn=e,this.len=t,this.next=void 0,this.val=i}function u(){}function h(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}function c(){this.len=0,this.head=new l(u,0,0),this.tail=this.head,this.states=null}var d=function(){return n.Buffer?function(){return(c.create=function(){return new r})()}:function(){return new c}};function p(e,t,i){t[i]=255&e}function f(e,t){this.len=e,this.next=void 0,this.val=t}function A(e,t,i){for(;e.hi;)t[i++]=127&e.lo|128,e.lo=(e.lo>>>7|e.hi<<25)>>>0,e.hi>>>=7;for(;e.lo>127;)t[i++]=127&e.lo|128,e.lo=e.lo>>>7;t[i++]=e.lo}function g(e,t,i){t[i]=255&e,t[i+1]=e>>>8&255,t[i+2]=e>>>16&255,t[i+3]=e>>>24}c.create=d(),c.alloc=function(e){return new n.Array(e)},n.Array!==Array&&(c.alloc=n.pool(c.alloc,n.Array.prototype.subarray)),c.prototype._push=function(e,t,i){return this.tail=this.tail.next=new l(e,t,i),this.len+=t,this},f.prototype=Object.create(l.prototype),f.prototype.fn=function(e,t,i){for(;e>127;)t[i++]=127&e|128,e>>>=7;t[i]=e},c.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new f((e>>>=0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this},c.prototype.int32=function(e){return e<0?this._push(A,10,o.fromNumber(e)):this.uint32(e)},c.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)},c.prototype.uint64=function(e){var t=o.from(e);return this._push(A,t.length(),t)},c.prototype.int64=c.prototype.uint64,c.prototype.sint64=function(e){var t=o.from(e).zzEncode();return this._push(A,t.length(),t)},c.prototype.bool=function(e){return this._push(p,1,e?1:0)},c.prototype.fixed32=function(e){return this._push(g,4,e>>>0)},c.prototype.sfixed32=c.prototype.fixed32,c.prototype.fixed64=function(e){var t=o.from(e);return this._push(g,4,t.lo)._push(g,4,t.hi)},c.prototype.sfixed64=c.prototype.fixed64,c.prototype.float=function(e){return this._push(n.float.writeFloatLE,4,e)},c.prototype.double=function(e){return this._push(n.float.writeDoubleLE,8,e)};var m=n.Array.prototype.set?function(e,t,i){t.set(e,i)}:function(e,t,i){for(var r=0;r<e.length;++r)t[i+r]=e[r]};c.prototype.bytes=function(e){var t=e.length>>>0;if(!t)return this._push(p,1,0);if(n.isString(e)){var i=c.alloc(t=s.length(e));s.decode(e,i,0),e=i}return this.uint32(t)._push(m,t,e)},c.prototype.string=function(e){var t=a.length(e);return t?this.uint32(t)._push(a.write,t,e):this._push(p,1,0)},c.prototype.fork=function(){return this.states=new h(this),this.head=this.tail=new l(u,0,0),this.len=0,this},c.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new l(u,0,0),this.len=0),this},c.prototype.ldelim=function(){var e=this.head,t=this.tail,i=this.len;return this.reset().uint32(i),i&&(this.tail.next=e.next,this.tail=t,this.len+=i),this},c.prototype.finish=function(){for(var e=this.head.next,t=this.constructor.alloc(this.len),i=0;e;)e.fn(e.val,t,i),i+=e.len,e=e.next;return t},c._configure=function(e){r=e,c.create=d(),r._configure()}},55:(e,t,i)=>{"use strict";e.exports=o;var r=i(147);(o.prototype=Object.create(r.prototype)).constructor=o;var n=i(835);function o(){r.call(this)}function s(e,t,i){e.length<40?n.utf8.write(e,t,i):t.utf8Write?t.utf8Write(e,i):t.write(e,i)}o._configure=function(){o.alloc=n._Buffer_allocUnsafe,o.writeBytesBuffer=n.Buffer&&n.Buffer.prototype instanceof Uint8Array&&"set"===n.Buffer.prototype.set.name?function(e,t,i){t.set(e,i)}:function(e,t,i){if(e.copy)e.copy(t,i,0,e.length);else for(var r=0;r<e.length;)t[i++]=e[r++]}},o.prototype.bytes=function(e){n.isString(e)&&(e=n._Buffer_from(e,"base64"));var t=e.length>>>0;return this.uint32(t),t&&this._push(o.writeBytesBuffer,t,e),this},o.prototype.string=function(e){var t=n.Buffer.byteLength(e);return this.uint32(t),t&&this._push(s,t,e),this},o._configure()}},__webpack_module_cache__={};function __webpack_require__(e){var t=__webpack_module_cache__[e];if(void 0!==t)return t.exports;var i=__webpack_module_cache__[e]={exports:{}};return __webpack_modules__[e].call(i.exports,i,i.exports,__webpack_require__),i.exports}__webpack_require__.d=(e,t)=>{for(var i in t)__webpack_require__.o(t,i)&&!__webpack_require__.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},__webpack_require__.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),__webpack_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),__webpack_require__.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var __webpack_exports__={};return(()=>{"use strict";__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{AnimationFrameLoop:()=>ft,BVH:()=>ki,BVHIntersect:()=>Ci,BVHNode:()=>Si,BVHVector3:()=>Mi,Camera:()=>Ei,Clipper:()=>Et,Five:()=>Ju,InternalWebGLRenderer:()=>fi,IntersectMesh:()=>Ws,LegacyPanoCircleMesh:()=>Jo,Model:()=>vo,NetworkSubscribe:()=>at,PBMContainer:()=>St,PBMGroup:()=>Ct,PBMMaterial:()=>pi,PBMMesh:()=>Mt,PROXY_CONTROLLER_EVENT_NAMES:()=>Tu,PanoCircleMesh:()=>gs,PanoCircleMeshDark:()=>Ps,PanoCircleMeshSolid:()=>js,Scene:()=>Ai,Subscribe:()=>qe,TextureLoader:()=>li,Tile3D:()=>Gn,Tile3DModel:()=>po,TileBoundingSphere:()=>Dn,TileCacheNode:()=>Hr,TileCubeTextureTarget:()=>ai,TileCullingVolume:()=>un,TileOrientedBoundingBox:()=>Un,TilePlane:()=>nn,TileRequestScheduler:()=>Vr,Tileset3D:()=>Zn,Tileset3DTraverser:()=>Xn,TilesetCache:()=>zr,Work:()=>Po,XRButton:()=>eh,defaultImageURLTransform:()=>vt,getViewportScale:()=>Ru,imageSupport:()=>wt,parseWork:()=>Do});var e=__webpack_require__(438),t=Number(e.REVISION);if(t<115||t>117)throw new Error('"Five" needs "THREE.js" version between 125 - 117.');var i,r,n,o,s,a,l,u,h,c,d,p,f={},A={},g=g||(i=Math,n=(r={}).lib={},o=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)}}}(),s=n.WordArray=o.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:4*e.length},toString:function(e){return(e||l).stringify(this)},concat:function(e){var t=this.words,i=e.words,r=this.sigBytes,n=e.sigBytes;if(this.clamp(),r%4)for(var o=0;o<n;o++){var s=i[o>>>2]>>>24-o%4*8&255;t[r+o>>>2]|=s<<24-(r+o)%4*8}else for(o=0;o<n;o+=4)t[r+o>>>2]=i[o>>>2];return this.sigBytes+=n,this},clamp:function(){var e=this.words,t=this.sigBytes;e[t>>>2]&=4294967295<<32-t%4*8,e.length=i.ceil(t/4)},clone:function(){var e=o.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var t=[],r=0;r<e;r+=4)t.push(4294967296*i.random()|0);return new s.init(t,e)}}),a=r.enc={},l=a.Hex={stringify:function(e){for(var t=e.words,i=e.sigBytes,r=[],n=0;n<i;n++){var o=t[n>>>2]>>>24-n%4*8&255;r.push((o>>>4).toString(16)),r.push((15&o).toString(16))}return r.join("")},parse:function(e){for(var t=e.length,i=[],r=0;r<t;r+=2)i[r>>>3]|=parseInt(e.substr(r,2),16)<<24-r%8*4;return new s.init(i,t/2)}},u=a.Latin1={stringify:function(e){for(var t=e.words,i=e.sigBytes,r=[],n=0;n<i;n++){var o=t[n>>>2]>>>24-n%4*8&255;r.push(String.fromCharCode(o))}return r.join("")},parse:function(e){for(var t=e.length,i=[],r=0;r<t;r++)i[r>>>2]|=(255&e.charCodeAt(r))<<24-r%4*8;return new s.init(i,t)}},h=a.Utf8={stringify:function(e){try{return decodeURIComponent(escape(u.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return u.parse(unescape(encodeURIComponent(e)))}},c=n.BufferedBlockAlgorithm=o.extend({reset:function(){this._data=new s.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=h.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(e){var t=this._data,r=t.words,n=t.sigBytes,o=this.blockSize,a=n/(4*o),l=(a=e?i.ceil(a):i.max((0|a)-this._minBufferSize,0))*o,u=i.min(4*l,n);if(l){for(var h=0;h<l;h+=o)this._doProcessBlock(r,h);var c=r.splice(0,l);t.sigBytes-=u}return new s.init(c,u)},clone:function(){var e=o.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0}),n.Hasher=c.extend({cfg:o.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 d.HMAC.init(e,i).finalize(t)}}}),d=r.algo={},r);function m(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 v(){return new m(null)}!function(e){for(var t=g,i=(n=t.lib).WordArray,r=n.Hasher,n=t.algo,o=[],s=[],a=function(e){return 4294967296*(e-(0|e))|0},l=2,u=0;64>u;){var h;e:{h=l;for(var c=e.sqrt(h),d=2;d<=c;d++)if(!(h%d)){h=!1;break e}h=!0}h&&(8>u&&(o[u]=a(e.pow(l,.5))),s[u]=a(e.pow(l,1/3)),u++),l++}var p=[];n=n.SHA256=r.extend({_doReset:function(){this._hash=new i.init(o.slice(0))},_doProcessBlock:function(e,t){for(var i=this._hash.words,r=i[0],n=i[1],o=i[2],a=i[3],l=i[4],u=i[5],h=i[6],c=i[7],d=0;64>d;d++){if(16>d)p[d]=0|e[t+d];else{var f=p[d-15],A=p[d-2];p[d]=((f<<25|f>>>7)^(f<<14|f>>>18)^f>>>3)+p[d-7]+((A<<15|A>>>17)^(A<<13|A>>>19)^A>>>10)+p[d-16]}f=c+((l<<26|l>>>6)^(l<<21|l>>>11)^(l<<7|l>>>25))+(l&u^~l&h)+s[d]+p[d],A=((r<<30|r>>>2)^(r<<19|r>>>13)^(r<<10|r>>>22))+(r&n^r&o^n&o),c=h,h=u,u=l,l=a+f|0,a=o,o=n,n=r,r=f+A|0}i[0]=i[0]+r|0,i[1]=i[1]+n|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]+h|0,i[7]=i[7]+c|0},_doFinalize:function(){var t=this._data,i=t.words,r=8*this._nDataBytes,n=8*t.sigBytes;return i[n>>>5]|=128<<24-n%32,i[14+(n+64>>>9<<4)]=e.floor(r/4294967296),i[15+(n+64>>>9<<4)]=r,t.sigBytes=4*i.length,this._process(),this._hash},clone:function(){var e=r.clone.call(this);return e._hash=this._hash.clone(),e}}),t.SHA256=r._createHelper(n),t.HmacSHA256=r._createHmacHelper(n)}(Math),g.lib.Cipher||function(e){var t=(p=g).lib,i=t.Base,r=t.WordArray,n=t.BufferedBlockAlgorithm,o=p.enc.Base64,s=p.algo.EvpKDF,a=t.Cipher=n.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(){n.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,r){return("string"==typeof i?f:d).encrypt(e,t,i,r)},decrypt:function(t,i,r){return("string"==typeof i?f:d).decrypt(e,t,i,r)}}}});t.StreamCipher=a.extend({_doFinalize:function(){return this._process(!0)},blockSize:1});var l=p.mode={},u=function(e,t,i){var r=this._iv;r?this._iv=void 0:r=this._prevBlock;for(var n=0;n<i;n++)e[t+n]^=r[n]},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,r=i.blockSize;u.call(this,e,t,r),i.encryptBlock(e,t),this._prevBlock=e.slice(t,t+r)}}),h.Decryptor=h.extend({processBlock:function(e,t){var i=this._cipher,r=i.blockSize,n=e.slice(t,t+r);i.decryptBlock(e,t),u.call(this,e,t,r),this._prevBlock=n}}),l=l.CBC=h,h=(p.pad={}).Pkcs7={pad:function(e,t){for(var i,n=(i=(i=4*t)-e.sigBytes%i)<<24|i<<16|i<<8|i,o=[],s=0;s<i;s+=4)o.push(n);i=r.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 c=t.CipherParams=i.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}}),d=(l=(p.format={}).OpenSSL={stringify:function(e){var t=e.ciphertext;return((e=e.salt)?r.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=r.create(t.slice(2,4));t.splice(0,4),e.sigBytes-=16}return c.create({ciphertext:e,salt:i})}},t.SerializableCipher=i.extend({cfg:i.extend({format:l}),encrypt:function(e,t,i,r){r=this.cfg.extend(r);var n=e.createEncryptor(i,r);return t=n.finalize(t),n=n.cfg,c.create({ciphertext:t,key:i,iv:n.iv,algorithm:e,mode:n.mode,padding:n.padding,blockSize:e.blockSize,formatter:r.format})},decrypt:function(e,t,i,r){return r=this.cfg.extend(r),t=this._parse(t,r.format),e.createDecryptor(i,r).finalize(t.ciphertext)},_parse:function(e,t){return"string"==typeof e?t.parse(e,this):e}})),p=(p.kdf={}).OpenSSL={execute:function(e,t,i,n){return n||(n=r.random(8)),e=s.create({keySize:t+i}).compute(e,n),i=r.create(e.words.slice(t),4*i),e.sigBytes=4*t,c.create({key:e,iv:i,salt:n})}},f=t.PasswordBasedCipher=d.extend({cfg:d.cfg.extend({kdf:p}),encrypt:function(e,t,i,r){return i=(r=this.cfg.extend(r)).kdf.execute(i,e.keySize,e.ivSize),r.iv=i.iv,(e=d.encrypt.call(this,e,t,i.key,r)).mixIn(i),e},decrypt:function(e,t,i,r){return r=this.cfg.extend(r),t=this._parse(t,r.format),i=r.kdf.execute(i,e.keySize,e.ivSize,t.salt),r.iv=i.iv,d.decrypt.call(this,e,t,i.key,r)}})}(),function(){for(var e=g,t=e.lib.BlockCipher,i=e.algo,r=[],n=[],o=[],s=[],a=[],l=[],u=[],h=[],c=[],d=[],p=[],f=0;256>f;f++)p[f]=128>f?f<<1:f<<1^283;var A=0,m=0;for(f=0;256>f;f++){var v=(v=m^m<<1^m<<2^m<<3^m<<4)>>>8^255&v^99;r[A]=v,n[v]=A;var y=p[A],b=p[y],x=p[b],w=257*p[v]^16843008*v;o[A]=w<<24|w>>>8,s[A]=w<<16|w>>>16,a[A]=w<<8|w>>>24,l[A]=w,w=16843009*x^65537*b^257*y^16843008*A,u[v]=w<<24|w>>>8,h[v]=w<<16|w>>>16,c[v]=w<<8|w>>>24,d[v]=w,A?(A=y^p[p[p[x^y]]],m^=p[p[m]]):A=m=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),n=this._keySchedule=[],o=0;o<i;o++)if(o<t)n[o]=e[o];else{var s=n[o-1];o%t?6<t&&4==o%t&&(s=r[s>>>24]<<24|r[s>>>16&255]<<16|r[s>>>8&255]<<8|r[255&s]):(s=r[(s=s<<8|s>>>24)>>>24]<<24|r[s>>>16&255]<<16|r[s>>>8&255]<<8|r[255&s],s^=E[o/t|0]<<24),n[o]=n[o-t]^s}for(e=this._invKeySchedule=[],t=0;t<i;t++)o=i-t,s=t%4?n[o]:n[o-4],e[t]=4>t||4>=o?s:u[r[s>>>24]]^h[r[s>>>16&255]]^c[r[s>>>8&255]]^d[r[255&s]]},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,o,s,a,l,r)},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,u,h,c,d,n),i=e[t+1],e[t+1]=e[t+3],e[t+3]=i},_doCryptBlock:function(e,t,i,r,n,o,s,a){for(var l=this._nRounds,u=e[t]^i[0],h=e[t+1]^i[1],c=e[t+2]^i[2],d=e[t+3]^i[3],p=4,f=1;f<l;f++){var A=r[u>>>24]^n[h>>>16&255]^o[c>>>8&255]^s[255&d]^i[p++],g=r[h>>>24]^n[c>>>16&255]^o[d>>>8&255]^s[255&u]^i[p++],m=r[c>>>24]^n[d>>>16&255]^o[u>>>8&255]^s[255&h]^i[p++];d=r[d>>>24]^n[u>>>16&255]^o[h>>>8&255]^s[255&c]^i[p++],u=A,h=g,c=m}A=(a[u>>>24]<<24|a[h>>>16&255]<<16|a[c>>>8&255]<<8|a[255&d])^i[p++],g=(a[h>>>24]<<24|a[c>>>16&255]<<16|a[d>>>8&255]<<8|a[255&u])^i[p++],m=(a[c>>>24]<<24|a[d>>>16&255]<<16|a[u>>>8&255]<<8|a[255&h])^i[p++],d=(a[d>>>24]<<24|a[u>>>16&255]<<16|a[h>>>8&255]<<8|a[255&c])^i[p++],e[t]=A,e[t+1]=g,e[t+2]=m,e[t+3]=d},keySize:8}),e.AES=t._createHelper(i)}(),A.lang={extend:function(e,t,i){if(!t||!e)throw new Error("YAHOO.lang.extend failed, please check that all dependencies are included.");var r=function(){};if(r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e,e.superclass=t.prototype,t.prototype.constructor==Object.prototype.constructor&&(t.prototype.constructor=t),i){var n;for(n in i)e.prototype[n]=i[n];var o=function(){},s=["toString","valueOf"];try{/MSIE/.test("undefined"!=typeof navigator?navigator.userAgent:"node")&&(o=function(e,t){for(n=0;n<s.length;n+=1){var i=s[n],r=t[i];"function"==typeof r&&r!=Object.prototype[i]&&(e[i]=r)}})}catch(e){}o(e.prototype,i)}}},"undefined"!=typeof navigator&&"Microsoft Internet Explorer"==navigator.appName?(m.prototype.am=function(e,t,i,r,n,o){for(var s=32767&t,a=t>>15;--o>=0;){var l=32767&this[e],u=this[e++]>>15,h=a*l+u*s;n=((l=s*l+((32767&h)<<15)+i[r]+(1073741823&n))>>>30)+(h>>>15)+a*u+(n>>>30),i[r++]=1073741823&l}return n},p=30):"undefined"!=typeof navigator&&"Netscape"!=navigator.appName?(m.prototype.am=function(e,t,i,r,n,o){for(;--o>=0;){var s=t*this[e++]+i[r]+n;n=Math.floor(s/67108864),i[r++]=67108863&s}return n},p=26):(m.prototype.am=function(e,t,i,r,n,o){for(var s=16383&t,a=t>>14;--o>=0;){var l=16383&this[e],u=this[e++]>>14,h=a*l+u*s;n=((l=s*l+((16383&h)<<14)+i[r]+n)>>28)+(h>>14)+a*u,i[r++]=268435455&l}return n},p=28),m.prototype.DB=p,m.prototype.DM=(1<<p)-1,m.prototype.DV=1<<p,m.prototype.FV=Math.pow(2,52),m.prototype.F1=52-p,m.prototype.F2=2*p-52;var y,b,x=new Array;for(y="0".charCodeAt(0),b=0;b<=9;++b)x[y++]=b;for(y="a".charCodeAt(0),b=10;b<36;++b)x[y++]=b;for(y="A".charCodeAt(0),b=10;b<36;++b)x[y++]=b;function w(e){return"0123456789abcdefghijklmnopqrstuvwxyz".charAt(e)}function E(e,t){var i=x[e.charCodeAt(t)];return null==i?-1:i}function M(e){var t=v();return t.fromInt(e),t}function S(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 C(e){this.m=e}function I(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 B(e,t){return e&t}function T(e,t){return e|t}function P(e,t){return e^t}function R(e,t){return e&~t}function k(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 L(e){for(var t=0;0!=e;)e&=e-1,++t;return t}function D(){}function O(e){return e}function N(e){this.r2=v(),this.q3=v(),m.ONE.dlShiftTo(2*e.t,this.r2),this.mu=this.r2.divide(e),this.m=e}C.prototype.convert=function(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e},C.prototype.revert=function(e){return e},C.prototype.reduce=function(e){e.divRemTo(this.m,null,e)},C.prototype.mulTo=function(e,t,i){e.multiplyTo(t,i),this.reduce(i)},C.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},I.prototype.convert=function(e){var t=v();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(m.ZERO)>0&&this.m.subTo(t,t),t},I.prototype.revert=function(e){var t=v();return e.copyTo(t),this.reduce(t),t},I.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],r=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,r,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)},I.prototype.mulTo=function(e,t,i){e.multiplyTo(t,i),this.reduce(i)},I.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},m.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},m.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},m.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 r=e.length,n=!1,o=0;--r>=0;){var s=8==i?255&e[r]:E(e,r);s<0?"-"==e.charAt(r)&&(n=!0):(n=!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(),n&&m.ZERO.subTo(this,this)},m.prototype.clamp=function(){for(var e=this.s&this.DM;this.t>0&&this[this.t-1]==e;)--this.t},m.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},m.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},m.prototype.lShiftTo=function(e,t){var i,r=e%this.DB,n=this.DB-r,o=(1<<n)-1,s=Math.floor(e/this.DB),a=this.s<<r&this.DM;for(i=this.t-1;i>=0;--i)t[i+s+1]=this[i]>>n|a,a=(this[i]&o)<<r;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()},m.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 r=e%this.DB,n=this.DB-r,o=(1<<r)-1;t[0]=this[i]>>r;for(var s=i+1;s<this.t;++s)t[s-i-1]|=(this[s]&o)<<n,t[s-i]=this[s]>>r;r>0&&(t[this.t-i-1]|=(this.s&o)<<n),t.t=this.t-i,t.clamp()}},m.prototype.subTo=function(e,t){for(var i=0,r=0,n=Math.min(e.t,this.t);i<n;)r+=this[i]-e[i],t[i++]=r&this.DM,r>>=this.DB;if(e.t<this.t){for(r-=e.s;i<this.t;)r+=this[i],t[i++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;i<e.t;)r-=e[i],t[i++]=r&this.DM,r>>=this.DB;r-=e.s}t.s=r<0?-1:0,r<-1?t[i++]=this.DV+r:r>0&&(t[i++]=r),t.t=i,t.clamp()},m.prototype.multiplyTo=function(e,t){var i=this.abs(),r=e.abs(),n=i.t;for(t.t=n+r.t;--n>=0;)t[n]=0;for(n=0;n<r.t;++n)t[n+i.t]=i.am(0,r[n],t,n,0,i.t);t.s=0,t.clamp(),this.s!=e.s&&m.ZERO.subTo(t,t)},m.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 r=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,r,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()},m.prototype.divRemTo=function(e,t,i){var r=e.abs();if(!(r.t<=0)){var n=this.abs();if(n.t<r.t)return null!=t&&t.fromInt(0),void(null!=i&&this.copyTo(i));null==i&&(i=v());var o=v(),s=this.s,a=e.s,l=this.DB-S(r[r.t-1]);l>0?(r.lShiftTo(l,o),n.lShiftTo(l,i)):(r.copyTo(o),n.copyTo(i));var u=o.t,h=o[u-1];if(0!=h){var c=h*(1<<this.F1)+(u>1?o[u-2]>>this.F2:0),d=this.FV/c,p=(1<<this.F1)/c,f=1<<this.F2,A=i.t,g=A-u,y=null==t?v():t;for(o.dlShiftTo(g,y),i.compareTo(y)>=0&&(i[i.t++]=1,i.subTo(y,i)),m.ONE.dlShiftTo(u,y),y.subTo(o,o);o.t<u;)o[o.t++]=0;for(;--g>=0;){var b=i[--A]==h?this.DM:Math.floor(i[A]*d+(i[A-1]+f)*p);if((i[A]+=o.am(0,b,i,g,0,u))<b)for(o.dlShiftTo(g,y),i.subTo(y,i);i[A]<--b;)i.subTo(y,i)}null!=t&&(i.drShiftTo(u,t),s!=a&&m.ZERO.subTo(t,t)),i.t=u,i.clamp(),l>0&&i.rShiftTo(l,i),s<0&&m.ZERO.subTo(i,i)}}},m.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},m.prototype.isEven=function(){return 0==(this.t>0?1&this[0]:this.s)},m.prototype.exp=function(e,t){if(e>4294967295||e<1)return m.ONE;var i=v(),r=v(),n=t.convert(this),o=S(e)-1;for(n.copyTo(i);--o>=0;)if(t.sqrTo(i,r),(e&1<<o)>0)t.mulTo(r,n,i);else{var s=i;i=r,r=s}return t.revert(i)},m.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,r=(1<<t)-1,n=!1,o="",s=this.t,a=this.DB-s*this.DB%t;if(s-- >0)for(a<this.DB&&(i=this[s]>>a)>0&&(n=!0,o=w(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)&r,a<=0&&(a+=this.DB,--s)),i>0&&(n=!0),n&&(o+=w(i));return n?o:"0"},m.prototype.negate=function(){var e=v();return m.ZERO.subTo(this,e),e},m.prototype.abs=function(){return this.s<0?this.negate():this},m.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},m.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+S(this[this.t-1]^this.s&this.DM)},m.prototype.mod=function(e){var t=v();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(m.ZERO)>0&&e.subTo(t,t),t},m.prototype.modPowInt=function(e,t){var i;return i=e<256||t.isEven()?new C(t):new I(t),this.exp(e,i)},m.ZERO=M(0),m.ONE=M(1),D.prototype.convert=O,D.prototype.revert=O,D.prototype.mulTo=function(e,t,i){e.multiplyTo(t,i)},D.prototype.sqrTo=function(e,t){e.squareTo(t)},N.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=v();return e.copyTo(t),this.reduce(t),t},N.prototype.revert=function(e){return e},N.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)},N.prototype.mulTo=function(e,t,i){e.multiplyTo(t,i),this.reduce(i)},N.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)};var F=[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],Q=(1<<26)/F[F.length-1];m.prototype.chunkSize=function(e){return Math.floor(Math.LN2*this.DB/Math.log(e))},m.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),r=M(i),n=v(),o=v(),s="";for(this.divRemTo(r,n,o);n.signum()>0;)s=(i+o.intValue()).toString(e).substr(1)+s,n.divRemTo(r,n,o);return o.intValue().toString(e)+s},m.prototype.fromRadix=function(e,t){this.fromInt(0),null==t&&(t=10);for(var i=this.chunkSize(t),r=Math.pow(t,i),n=!1,o=0,s=0,a=0;a<e.length;++a){var l=E(e,a);l<0?"-"==e.charAt(a)&&0==this.signum()&&(n=!0):(s=t*s+l,++o>=i&&(this.dMultiply(r),this.dAddOffset(s,0),o=0,s=0))}o>0&&(this.dMultiply(Math.pow(t,o)),this.dAddOffset(s,0)),n&&m.ZERO.subTo(this,this)},m.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(m.ONE.shiftLeft(e-1),T,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(t);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(m.ONE.shiftLeft(e-1),this);else{var r=new Array,n=7&e;r.length=1+(e>>3),t.nextBytes(r),n>0?r[0]&=(1<<n)-1:r[0]=0,this.fromString(r,256)}},m.prototype.bitwiseTo=function(e,t,i){var r,n,o=Math.min(e.t,this.t);for(r=0;r<o;++r)i[r]=t(this[r],e[r]);if(e.t<this.t){for(n=e.s&this.DM,r=o;r<this.t;++r)i[r]=t(this[r],n);i.t=this.t}else{for(n=this.s&this.DM,r=o;r<e.t;++r)i[r]=t(n,e[r]);i.t=e.t}i.s=t(this.s,e.s),i.clamp()},m.prototype.changeBit=function(e,t){var i=m.ONE.shiftLeft(e);return this.bitwiseTo(i,t,i),i},m.prototype.addTo=function(e,t){for(var i=0,r=0,n=Math.min(e.t,this.t);i<n;)r+=this[i]+e[i],t[i++]=r&this.DM,r>>=this.DB;if(e.t<this.t){for(r+=e.s;i<this.t;)r+=this[i],t[i++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;i<e.t;)r+=e[i],t[i++]=r&this.DM,r>>=this.DB;r+=e.s}t.s=r<0?-1:0,r>0?t[i++]=r:r<-1&&(t[i++]=this.DV+r),t.t=i,t.clamp()},m.prototype.dMultiply=function(e){this[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()},m.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]}},m.prototype.multiplyLowerTo=function(e,t,i){var r,n=Math.min(this.t+e.t,t);for(i.s=0,i.t=n;n>0;)i[--n]=0;for(r=i.t-this.t;n<r;++n)i[n+this.t]=this.am(0,e[n],i,n,0,this.t);for(r=Math.min(e.t,t);n<r;++n)this.am(0,e[n],i,n,0,t-n);i.clamp()},m.prototype.multiplyUpperTo=function(e,t,i){--t;var r=i.t=this.t+e.t-t;for(i.s=0;--r>=0;)i[r]=0;for(r=Math.max(t-this.t,0);r<e.t;++r)i[this.t+r-t]=this.am(t-r,e[r],i,0,0,this.t+r-t);i.clamp(),i.drShiftTo(1,i)},m.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 r=this.t-1;r>=0;--r)i=(t*i+this[r])%e;return i},m.prototype.millerRabin=function(e){var t=this.subtract(m.ONE),i=t.getLowestSetBit();if(i<=0)return!1;var r=t.shiftRight(i);(e=e+1>>1)>F.length&&(e=F.length);for(var n=v(),o=0;o<e;++o){n.fromInt(F[Math.floor(Math.random()*F.length)]);var s=n.modPow(r,this);if(0!=s.compareTo(m.ONE)&&0!=s.compareTo(t)){for(var a=1;a++<i&&0!=s.compareTo(t);)if(0==(s=s.modPowInt(2,this)).compareTo(m.ONE))return!1;if(0!=s.compareTo(t))return!1}}return!0},m.prototype.clone=function(){var e=v();return this.copyTo(e),e},m.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]},m.prototype.byteValue=function(){return 0==this.t?this.s:this[0]<<24>>24},m.prototype.shortValue=function(){return 0==this.t?this.s:this[0]<<16>>16},m.prototype.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1},m.prototype.toByteArray=function(){var e=this.t,t=new Array;t[0]=this.s;var i,r=this.DB-e*this.DB%8,n=0;if(e-- >0)for(r<this.DB&&(i=this[e]>>r)!=(this.s&this.DM)>>r&&(t[n++]=i|this.s<<this.DB-r);e>=0;)r<8?(i=(this[e]&(1<<r)-1)<<8-r,i|=this[--e]>>(r+=this.DB-8)):(i=this[e]>>(r-=8)&255,r<=0&&(r+=this.DB,--e)),0!=(128&i)&&(i|=-256),0==n&&(128&this.s)!=(128&i)&&++n,(n>0||i!=this.s)&&(t[n++]=i);return t},m.prototype.equals=function(e){return 0==this.compareTo(e)},m.prototype.min=function(e){return this.compareTo(e)<0?this:e},m.prototype.max=function(e){return this.compareTo(e)>0?this:e},m.prototype.and=function(e){var t=v();return this.bitwiseTo(e,B,t),t},m.prototype.or=function(e){var t=v();return this.bitwiseTo(e,T,t),t},m.prototype.xor=function(e){var t=v();return this.bitwiseTo(e,P,t),t},m.prototype.andNot=function(e){var t=v();return this.bitwiseTo(e,R,t),t},m.prototype.not=function(){for(var e=v(),t=0;t<this.t;++t)e[t]=this.DM&~this[t];return e.t=this.t,e.s=~this.s,e},m.prototype.shiftLeft=function(e){var t=v();return e<0?this.rShiftTo(-e,t):this.lShiftTo(e,t),t},m.prototype.shiftRight=function(e){var t=v();return e<0?this.lShiftTo(-e,t):this.rShiftTo(e,t),t},m.prototype.getLowestSetBit=function(){for(var e=0;e<this.t;++e)if(0!=this[e])return e*this.DB+k(this[e]);return this.s<0?this.t*this.DB:-1},m.prototype.bitCount=function(){for(var e=0,t=this.s&this.DM,i=0;i<this.t;++i)e+=L(this[i]^t);return e},m.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)},m.prototype.setBit=function(e){return this.changeBit(e,T)},m.prototype.clearBit=function(e){return this.changeBit(e,R)},m.prototype.flipBit=function(e){return this.changeBit(e,P)},m.prototype.add=function(e){var t=v();return this.addTo(e,t),t},m.prototype.subtract=function(e){var t=v();return this.subTo(e,t),t},m.prototype.multiply=function(e){var t=v();return this.multiplyTo(e,t),t},m.prototype.divide=function(e){var t=v();return this.divRemTo(e,t,null),t},m.prototype.remainder=function(e){var t=v();return this.divRemTo(e,null,t),t},m.prototype.divideAndRemainder=function(e){var t=v(),i=v();return this.divRemTo(e,t,i),new Array(t,i)},m.prototype.modPow=function(e,t){var i,r,n=e.bitLength(),o=M(1);if(n<=0)return o;i=n<18?1:n<48?3:n<144?4:n<768?5:6,r=n<8?new C(t):t.isEven()?new N(t):new I(t);var s=new Array,a=3,l=i-1,u=(1<<i)-1;if(s[1]=r.convert(this),i>1){var h=v();for(r.sqrTo(s[1],h);a<=u;)s[a]=v(),r.mulTo(h,s[a-2],s[a]),a+=2}var c,d,p=e.t-1,f=!0,A=v();for(n=S(e[p])-1;p>=0;){for(n>=l?c=e[p]>>n-l&u:(c=(e[p]&(1<<n+1)-1)<<l-n,p>0&&(c|=e[p-1]>>this.DB+n-l)),a=i;0==(1&c);)c>>=1,--a;if((n-=a)<0&&(n+=this.DB,--p),f)s[c].copyTo(o),f=!1;else{for(;a>1;)r.sqrTo(o,A),r.sqrTo(A,o),a-=2;a>0?r.sqrTo(o,A):(d=o,o=A,A=d),r.mulTo(A,s[c],o)}for(;p>=0&&0==(e[p]&1<<n);)r.sqrTo(o,A),d=o,o=A,A=d,--n<0&&(n=this.DB-1,--p)}return r.revert(o)},m.prototype.modInverse=function(e){var t=e.isEven();if(this.isEven()&&t||0==e.signum())return m.ZERO;for(var i=e.clone(),r=this.clone(),n=M(1),o=M(0),s=M(0),a=M(1);0!=i.signum();){for(;i.isEven();)i.rShiftTo(1,i),t?(n.isEven()&&o.isEven()||(n.addTo(this,n),o.subTo(e,o)),n.rShiftTo(1,n)):o.isEven()||o.subTo(e,o),o.rShiftTo(1,o);for(;r.isEven();)r.rShiftTo(1,r),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(r)>=0?(i.subTo(r,i),t&&n.subTo(s,n),o.subTo(a,o)):(r.subTo(i,r),t&&s.subTo(n,s),a.subTo(o,a))}return 0!=r.compareTo(m.ONE)?m.ZERO:a.compareTo(e)>=0?a.subtract(e):a.signum()<0?(a.addTo(e,a),a.signum()<0?a.add(e):a):a},m.prototype.pow=function(e){return this.exp(e,new D)},m.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 r=t;t=i,i=r}var n=t.getLowestSetBit(),o=i.getLowestSetBit();if(o<0)return t;for(n<o&&(o=n),o>0&&(t.rShiftTo(o,t),i.rShiftTo(o,i));t.signum()>0;)(n=t.getLowestSetBit())>0&&t.rShiftTo(n,t),(n=i.getLowestSetBit())>0&&i.rShiftTo(n,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},m.prototype.isProbablePrime=function(e){var t,i=this.abs();if(1==i.t&&i[0]<=F[F.length-1]){for(t=0;t<F.length;++t)if(i[0]==F[t])return!0;return!1}if(i.isEven())return!1;for(t=1;t<F.length;){for(var r=F[t],n=t+1;n<F.length&&r<Q;)r*=F[n++];for(r=i.modInt(r);t<n;)if(r%F[t++]==0)return!1}return i.millerRabin(e)},m.prototype.square=function(){var e=v();return this.squareTo(e),e};var V,H,q,z="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function U(e){var t,i,r="";for(t=0;t+3<=e.length;t+=3)i=parseInt(e.substring(t,t+3),16),r+=z.charAt(i>>6)+z.charAt(63&i);for(t+1==e.length?(i=parseInt(e.substring(t,t+1),16),r+=z.charAt(i<<2)):t+2==e.length&&(i=parseInt(e.substring(t,t+2),16),r+=z.charAt(i>>2)+z.charAt((3&i)<<4));(3&r.length)>0;)r+="=";return r}function j(e){var t,i,r,n="",o=0;for(t=0;t<e.length&&"="!=e.charAt(t);++t)(r=z.indexOf(e.charAt(t)))<0||(0==o?(n+=w(r>>2),i=3&r,o=1):1==o?(n+=w(i<<2|r>>4),i=15&r,o=2):2==o?(n+=w(i),n+=w(r>>2),i=3&r,o=3):(n+=w(i<<2|r>>4),n+=w(15&r),o=0));return 1==o&&(n+=w(i<<2)),n}function K(){this.i=0,this.j=0,this.S=new Array}function _(){!function(e){H[q++]^=255&e,H[q++]^=e>>8&255,H[q++]^=e>>16&255,H[q++]^=e>>24&255,q>=256&&(q-=256)}((new Date).getTime())}if(K.prototype.init=function(e){var t,i,r;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,r=this.S[t],this.S[t]=this.S[i],this.S[i]=r;this.i=0,this.j=0},K.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]},null==H){var G;if(H=new Array,q=0,"undefined"!=typeof window&&(void 0!==window.crypto||void 0!==window.msCrypto)){var W=window.crypto||window.msCrypto;if(W.getRandomValues){var X=new Uint8Array(32);for(W.getRandomValues(X),G=0;G<32;++G)H[q++]=X[G]}else if("undefined"!=typeof navigator&&"Netscape"==navigator.appName&&navigator.appVersion<"5"){var Y=window.crypto.random(32);for(G=0;G<Y.length;++G)H[q++]=255&Y.charCodeAt(G)}}for(;q<256;)G=Math.floor(65536*Math.random()),H[q++]=G>>>8,H[q++]=255&G;q=0,_()}function Z(){if(null==V){for(_(),(V=new K).init(H),q=0;q<H.length;++q)H[q]=0;q=0}return V.next()}function J(){}function $(e,t){return new m(e,t)}function ee(e,t,i){for(var r="",n=0;r.length<t;)r+=i(String.fromCharCode.apply(String,e.concat([(4278190080&n)>>24,(16711680&n)>>16,(65280&n)>>8,255&n]))),n+=1;return r}function te(){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 ie(e,t,i){for(var r="",n=0;r.length<t;)r+=i(e+String.fromCharCode.apply(String,[(4278190080&n)>>24,(16711680&n)>>16,(65280&n)>>8,255&n])),n+=1;return r}function re(e){for(var t="",i=0;i<e.length;i++){var r=e[i].toString(16);1==r.length&&(r="0"+r),t+=r}return t}function ne(e){return re(function(e){for(var t=new Array,i=0;i<e.length;i++)t[i]=e.charCodeAt(i);return t}(e))}function oe(e){return(e=(e=e.replace(/\=/g,"")).replace(/\+/g,"-")).replace(/\//g,"_")}function se(e){return e.length%4==2?e+="==":e.length%4==3&&(e+="="),(e=e.replace(/-/g,"+")).replace(/_/g,"/")}function ae(e){return e.length%2==1&&(e="0"+e),oe(U(e))}function le(e){return j(se(e))}function ue(e){return Ae(ve(e))}function he(e){return decodeURIComponent(function(e){return e.replace(/(..)/g,"%$1")}(e))}function ce(e){for(var t="",i=0;i<e.length-1;i+=2)t+=String.fromCharCode(parseInt(e.substr(i,2),16));return t}function de(e){for(var t="",i=0;i<e.length;i++)t+=("0"+e.charCodeAt(i).toString(16)).slice(-2);return t}function pe(e,t){return"-----BEGIN "+t+"-----\r\n"+function(e){var t=function(e){return U(e)}(e).replace(/(.{64})/g,"$1\r\n");return t.replace(/\r\n$/,"")}(e)+"\r\n-----END "+t+"-----\r\n"}function fe(e,t){if(-1==e.indexOf("-----BEGIN "))throw"can't find PEM header: "+t;return function(e){return j(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 Ae(e){return e.replace(/%/g,"")}function ge(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 r=(e=":"+t.join(":")+":").match(/:(0:){2,}/g);if(null===r)return e.slice(1,-1);var n="";for(i=0;i<r.length;i++)r[i].length>n.length&&(n=r[i]);return(e=e.replace(n,"::")).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 me(e){var t=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 r=128|63&i;return he((192|(7&t)<<3|(192&i)>>6).toString(16)+r.toString(16))}r=128|(15&t)<<2|(192&i)>>6;var n=128|63&i;return he((224|(240&t)>>4).toString(16)+r.toString(16)+n.toString(16))}));return t.join("")}function ve(e){for(var t=encodeURIComponent(e),i="",r=0;r<t.length;r++)"%"==t[r]?(i+=t.substr(r,3),r+=2):i=i+"%"+ne(t[r]);return i}function ye(e){return!(e.length%2!=0||!e.match(/^[0-9a-f]+$/)&&!e.match(/^[0-9A-F]+$/))}function be(e){return e.length%2==1?"0"+e:e.substr(0,1)>"7"?"00"+e:e}J.prototype.nextBytes=function(e){var t;for(t=0;t<e.length;++t)e[t]=Z()},te.prototype.doPublic=function(e){return e.modPowInt(this.e,this.n)},te.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=$(e,16),this.e=parseInt(t,16)}},te.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,r=e.length-1;r>=0&&t>0;){var n=e.charCodeAt(r--);n<128?i[--t]=n:n>127&&n<2048?(i[--t]=63&n|128,i[--t]=n>>6|192):(i[--t]=63&n|128,i[--t]=n>>6&63|128,i[--t]=n>>12|224)}i[--t]=0;for(var o=new J,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 m(i)}(e,this.n.bitLength()+7>>3);if(null==t)return null;var i=this.doPublic(t);if(null==i)return null;var r=i.toString(16);return 0==(1&r.length)?r:"0"+r},te.prototype.encryptOAEP=function(e,t,i){var r=function(e,t,i,r){var n=f.crypto.MessageDigest,o=f.crypto.Util,s=null;if(i||(i="sha1"),"string"==typeof i&&(s=n.getCanonicalAlgName(i),r=n.getHashLength(s),i=function(e){return ce(o.hashHex(de(e),s))}),e.length+2*r+2>t)throw"Message too long for RSA";var a,l="";for(a=0;a<t-e.length-2*r-2;a+=1)l+="\0";var u=i("")+l+""+e,h=new Array(r);(new J).nextBytes(h);var c=ee(h,u.length,i),d=[];for(a=0;a<u.length;a+=1)d[a]=u.charCodeAt(a)^c.charCodeAt(a);var p=ee(d,h.length,i),A=[0];for(a=0;a<h.length;a+=1)A[a+1]=h[a]^p.charCodeAt(a);return new m(A.concat(d))}(e,this.n.bitLength()+7>>3,t,i);if(null==r)return null;var n=this.doPublic(r);if(null==n)return null;var o=n.toString(16);return 0==(1&o.length)?o:"0"+o},te.prototype.type="RSA",te.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)},te.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=$(e,16),this.e=parseInt(t,16),this.d=$(i,16)}},te.prototype.setPrivateEx=function(e,t,i,r,n,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=$(e,16),this.e=parseInt(t,16),this.d=$(i,16),this.p=$(r,16),this.q=$(n,16),this.dmp1=$(o,16),this.dmq1=$(s,16),this.coeff=$(a,16)},te.prototype.generate=function(e,t){var i=new J,r=e>>1;this.e=parseInt(t,16);for(var n=new m(t,16);;){for(;this.p=new m(e-r,1,i),0!=this.p.subtract(m.ONE).gcd(n).compareTo(m.ONE)||!this.p.isProbablePrime(10););for(;this.q=new m(r,1,i),0!=this.q.subtract(m.ONE).gcd(n).compareTo(m.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(m.ONE),a=this.q.subtract(m.ONE),l=s.multiply(a);if(0==l.gcd(n).compareTo(m.ONE)&&(this.n=this.p.multiply(this.q),this.n.bitLength()==e)){this.d=n.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},te.prototype.decrypt=function(e){if(e.length!=Math.ceil(this.n.bitLength()/4))throw new Error("wrong ctext length");var t=$(e,16),i=this.doPrivate(t);return null==i?null:function(e,t){for(var i=e.toByteArray(),r=0;r<i.length&&0==i[r];)++r;if(i.length-r!=t-1||2!=i[r])return null;for(++r;0!=i[r];)if(++r>=i.length)return null;for(var n="";++r<i.length;){var o=255&i[r];o<128?n+=String.fromCharCode(o):o>191&&o<224?(n+=String.fromCharCode((31&o)<<6|63&i[r+1]),++r):(n+=String.fromCharCode((15&o)<<12|(63&i[r+1])<<6|63&i[r+2]),r+=2)}return n}(i,this.n.bitLength()+7>>3)},te.prototype.decryptOAEP=function(e,t,i){if(e.length!=Math.ceil(this.n.bitLength()/4))throw new Error("wrong ctext length");var r=$(e,16),n=this.doPrivate(r);return null==n?null:function(e,t,i,r){var n=f.crypto.MessageDigest,o=f.crypto.Util,s=null;for(i||(i="sha1"),"string"==typeof i&&(s=n.getCanonicalAlgName(i),r=n.getHashLength(s),i=function(e){return ce(o.hashHex(de(e),s))}),e=e.toByteArray(),a=0;a<e.length;a+=1)e[a]&=255;for(;e.length<t;)e.unshift(0);if((e=String.fromCharCode.apply(String,e)).length<2*r+2)throw"Cipher too short";var a,l=e.substr(1,r),u=e.substr(r+1),h=ie(u,r,i),c=[];for(a=0;a<l.length;a+=1)c[a]=l.charCodeAt(a)^h.charCodeAt(a);var d=ie(String.fromCharCode.apply(String,c),e.length-r,i),p=[];for(a=0;a<u.length;a+=1)p[a]=u.charCodeAt(a)^d.charCodeAt(a);if((p=String.fromCharCode.apply(String,p)).substr(0,r)!==i(""))throw"Hash mismatch";var A=(p=p.substr(r)).indexOf("");if((-1!=A?p.substr(0,A).lastIndexOf("\0"):-1)+1!=A)throw"Malformed data";return p.substr(A+1)}(n,this.n.bitLength()+7>>3,t,i)},void 0!==f.lang&&f.lang||(f.lang={}),f.lang.String=function(){},f.lang.String.isInteger=function(e){return!!e.match(/^[0-9]+$/)||!!e.match(/^-[0-9]+$/)},f.lang.String.isHex=function(e){return ye(e)},f.lang.String.isBase64=function(e){return!(!(e=e.replace(/\s+/g,"")).match(/^[0-9A-Za-z+\/]+={0,3}$/)||e.length%4!=0)},f.lang.String.isBase64URL=function(e){return!e.match(/[+/=]/)&&(e=se(e),f.lang.String.isBase64(e))},f.lang.String.isIntegerArray=function(e){return!!(e=e.replace(/\s+/g,"")).match(/^\[[0-9,]+\]$/)},f.lang.String.isPrintable=function(e){return null!==e.match(/^[0-9A-Za-z '()+,-./:=?]*$/)},f.lang.String.isIA5=function(e){return null!==e.match(/^[\x20-\x21\x23-\x7f]*$/)},f.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 xe=function(e,t,i){return null==i&&(i="0"),e.length>=t?e:new Array(t-e.length+1).join(i)+e};function we(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!==f.crypto&&f.crypto||(f.crypto={}),f.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:g.algo.MD5,sha1:g.algo.SHA1,sha224:g.algo.SHA224,sha256:g.algo.SHA256,sha384:g.algo.SHA384,sha512:g.algo.SHA512,ripemd160:g.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 r=this.getDigestInfoHex(e,t),n=i/4;if(r.length+22>n)throw"key is too short for SigAlg: keylen="+i+","+t;for(var o="0001",s="00"+r,a="",l=n-o.length-s.length,u=0;u<l;u+=2)a+="ff";return o+a+s},this.hashString=function(e,t){return new f.crypto.MessageDigest({alg:t}).digestString(e)},this.hashHex=function(e,t){return new f.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 te||e instanceof f.crypto.DSA||e instanceof f.crypto.ECDSA}},f.crypto.Util.md5=function(e){return new f.crypto.MessageDigest({alg:"md5",prov:"cryptojs"}).digestString(e)},f.crypto.Util.ripemd160=function(e){return new f.crypto.MessageDigest({alg:"ripemd160",prov:"cryptojs"}).digestString(e)},f.crypto.Util.SECURERANDOMGEN=new J,f.crypto.Util.getRandomHexOfNbytes=function(e){var t=new Array(e);return f.crypto.Util.SECURERANDOMGEN.nextBytes(t),re(t)},f.crypto.Util.getRandomBigIntegerOfNbytes=function(e){return new m(f.crypto.Util.getRandomHexOfNbytes(e),16)},f.crypto.Util.getRandomHexOfNbits=function(e){var t=e%8,i=new Array((e-t)/8+1);return f.crypto.Util.SECURERANDOMGEN.nextBytes(i),i[0]=(255<<t&255^255)&i[0],re(i)},f.crypto.Util.getRandomBigIntegerOfNbits=function(e){return new m(f.crypto.Util.getRandomHexOfNbits(e),16)},f.crypto.Util.getRandomBigIntegerZeroToMax=function(e){for(var t=e.bitLength();;){var i=f.crypto.Util.getRandomBigIntegerOfNbits(t);if(-1!=e.compareTo(i))return i}},f.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 r=t.subtract(e);return f.crypto.Util.getRandomBigIntegerZeroToMax(r).add(e)},f.crypto.MessageDigest=function(e){this.setAlgAndProvider=function(e,t){if(null!==(e=f.crypto.MessageDigest.getCanonicalAlgName(e))&&void 0===t&&(t=f.crypto.Util.DEFAULTPROVIDER[e]),-1!=":md5:sha1:sha224:sha256:sha384:sha512:ripemd160:".indexOf(e)&&"cryptojs"==t){try{this.md=f.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=g.enc.Hex.parse(e);this.md.update(t)},this.digest=function(){return this.md.finalize().toString(g.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=f.crypto.Util.DEFAULTPROVIDER[this.algName]),this.setAlgAndProvider(this.algName,this.provName))},f.crypto.MessageDigest.getCanonicalAlgName=function(e){return"string"==typeof e&&(e=(e=e.toLowerCase()).replace(/-/,"")),e},f.crypto.MessageDigest.getHashLength=function(e){var t=f.crypto.MessageDigest,i=t.getCanonicalAlgName(e);if(void 0===t.HASHLENGTH[i])throw"not supported algorithm: "+e;return t.HASHLENGTH[i]},f.crypto.MessageDigest.HASHLENGTH={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,ripemd160:20},f.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=f.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 r=f.crypto.Util.CRYPTOJSMESSAGEDIGESTNAME[i];this.mac=g.algo.HMAC.create(r,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=g.enc.Hex.parse(e);this.mac.update(t)},this.doFinal=function(){return this.mac.finalize().toString(g.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=de(e)),void(this.pass=g.enc.Hex.parse(t))}if("object"!=typeof e)throw"KJUR.crypto.Mac unsupported password type: "+e;if(t=null,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=ue(e.utf8)),void 0!==e.rstr&&(t=de(e.rstr)),void 0!==e.b64&&(t=j(e.b64)),void 0!==e.b64u&&(t=le(e.b64u)),null==t)throw"KJUR.crypto.Mac unsupported password type: "+e;this.pass=g.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=f.crypto.Util.DEFAULTPROVIDER[this.algName]),this.setAlgAndProvider(this.algName,this.provName)))},f.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="",r=t/4-e.length,n=0;n<r;n++)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 f.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?Ee.getKey(e):Ee.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!==f.crypto.ECDSA&&(this.prvKey=new f.crypto.ECDSA({curve:this.eccurvename,prv:this.ecprvhex})),this.prvKey instanceof te&&"rsaandmgf1"===this.pubkeyAlgName)this.hSign=this.prvKey.signWithMessageHashPSS(this.sHashHex,this.mdAlgName,this.pssSaltLen);else if(this.prvKey instanceof te&&"rsa"===this.pubkeyAlgName)this.hSign=this.prvKey.signWithMessageHash(this.sHashHex,this.mdAlgName);else if(this.prvKey instanceof f.crypto.ECDSA)this.hSign=this.prvKey.signWithMessageHash(this.sHashHex);else{if(!(this.prvKey instanceof f.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!==f.crypto.ECDSA&&(this.pubKey=new f.crypto.ECDSA({curve:this.eccurvename,pub:this.ecpubhex})),this.pubKey instanceof te&&"rsaandmgf1"===this.pubkeyAlgName)return this.pubKey.verifyWithMessageHashPSS(this.sHashHex,e,this.mdAlgName,this.pssSaltLen);if(this.pubKey instanceof te&&"rsa"===this.pubkeyAlgName)return this.pubKey.verifyWithMessageHash(this.sHashHex,e);if(void 0!==f.crypto.ECDSA&&this.pubKey instanceof f.crypto.ECDSA)return this.pubKey.verifyWithMessageHash(this.sHashHex,e);if(void 0!==f.crypto.DSA&&this.pubKey instanceof f.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=f.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=Ee.getKey(e.prvkeypem),this.init(t)}catch(e){throw"fatal error to load pem private key: "+e}}},f.crypto.Cipher=function(e){},f.crypto.Cipher.encrypt=function(e,t,i){if(t instanceof te&&t.isPublic){var r=f.crypto.Cipher.getAlgByKeyAndName(t,i);if("RSA"===r)return t.encrypt(e);if("RSAOAEP"===r)return t.encryptOAEP(e,"sha1");var n=r.match(/^RSAOAEP(\d+)$/);if(null!==n)return t.encryptOAEP(e,"sha"+n[1]);throw"Cipher.encrypt: unsupported algorithm for RSAKey: "+i}throw"Cipher.encrypt: unsupported key or algorithm"},f.crypto.Cipher.decrypt=function(e,t,i){if(t instanceof te&&t.isPrivate){var r=f.crypto.Cipher.getAlgByKeyAndName(t,i);if("RSA"===r)return t.decrypt(e);if("RSAOAEP"===r)return t.decryptOAEP(e,"sha1");var n=r.match(/^RSAOAEP(\d+)$/);if(null!==n)return t.decryptOAEP(e,"sha"+n[1]);throw"Cipher.decrypt: unsupported algorithm for RSAKey: "+i}throw"Cipher.decrypt: unsupported key or algorithm"},f.crypto.Cipher.getAlgByKeyAndName=function(e,t){if(e instanceof te){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},f.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 Ee=function(){var e=function(e,i,r){return t(g.AES,e,i,r)},t=function(e,t,i,r){var n=g.enc.Hex.parse(t),o=g.enc.Hex.parse(i),s=g.enc.Hex.parse(r),a={};a.key=o,a.iv=s,a.ciphertext=n;var l=e.decrypt(a,o,{iv:s});return g.enc.Hex.stringify(l)},i=function(e,t,i){return r(g.AES,e,t,i)},r=function(e,t,i,r){var n=g.enc.Hex.parse(t),o=g.enc.Hex.parse(i),s=g.enc.Hex.parse(r),a=e.encrypt(n,o,{iv:s}),l=g.enc.Hex.parse(a.toString());return g.enc.Base64.stringify(l)},n={"AES-256-CBC":{proc:e,eproc:i,keylen:32,ivlen:16},"AES-192-CBC":{proc:e,eproc:i,keylen:24,ivlen:16},"AES-128-CBC":{proc:e,eproc:i,keylen:16,ivlen:16},"DES-EDE3-CBC":{proc:function(e,i,r){return t(g.TripleDES,e,i,r)},eproc:function(e,t,i){return r(g.TripleDES,e,t,i)},keylen:24,ivlen:8},"DES-CBC":{proc:function(e,i,r){return t(g.DES,e,i,r)},eproc:function(e,t,i){return r(g.DES,e,t,i)},keylen:8,ivlen:8}},o=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 r=e.match(new RegExp("-----BEGIN ([A-Z]+) PRIVATE KEY-----"));r&&(t.type=r[1]);var n=-1,o=0;-1!=e.indexOf("\r\n\r\n")&&(n=e.indexOf("\r\n\r\n"),o=2),-1!=e.indexOf("\n\n")&&(n=e.indexOf("\n\n"),o=1);var s=e.indexOf("-----END");if(-1!=n&&-1!=s){var a=e.substring(n+2*o,s-o);a=a.replace(/\s+/g,""),t.data=a}return t},s=function(e,t,i){for(var r=i.substring(0,16),o=g.enc.Hex.parse(r),s=g.enc.Utf8.parse(t),a=n[e].keylen+n[e].ivlen,l="",u=null;;){var h=g.algo.MD5.create();if(null!=u&&h.update(u),h.update(s),h.update(o),u=h.finalize(),(l+=g.enc.Hex.stringify(u)).length>=2*a)break}var c={};return c.keyhex=l.substr(0,2*n[e].keylen),c.ivhex=l.substr(2*n[e].keylen,2*n[e].ivlen),c},a=function(e,t,i,r){var o=g.enc.Base64.parse(e),s=g.enc.Hex.stringify(o);return(0,n[t].proc)(s,i,r)};return{version:"1.0.0",parsePKCS5PEM:function(e){return o(e)},getKeyAndUnusedIvByPasscodeAndIvsalt:function(e,t,i){return s(e,t,i)},decryptKeyB64:function(e,t,i,r){return a(e,t,i,r)},getDecryptedKeyHex:function(e,t){var i=o(e),r=(i.type,i.cipher),n=i.ivsalt,l=i.data,u=s(r,t,n).keyhex;return a(l,r,u,n)},getEncryptedPKCS5PEMFromPrvKeyHex:function(e,t,i,r,o){var a="";if(void 0!==r&&null!=r||(r="AES-256-CBC"),void 0===n[r])throw"KEYUTIL unsupported algorithm: "+r;if(void 0===o||null==o){var l=function(e){var t=g.lib.WordArray.random(e);return g.enc.Hex.stringify(t)}(n[r].ivlen);o=l.toUpperCase()}var u=function(e,t,i,r){return(0,n[t].eproc)(e,i,r)}(t,r,s(r,i,o).keyhex,o);return a="-----BEGIN "+e+" PRIVATE KEY-----\r\n",a+="Proc-Type: 4,ENCRYPTED\r\n",a+="DEK-Info: "+r+","+o+"\r\n",a+="\r\n",(a+=u.replace(/(.{64})/g,"$1\r\n"))+"\r\n-----END "+e+" PRIVATE KEY-----\r\n"},parseHexOfEncryptedPKCS8:function(e){var t=Me,i=t.getChildIdx,r=t.getV,n={},o=i(e,0);if(2!=o.length)throw"malformed format: SEQUENCE(0).items != 2: "+o.length;n.ciphertext=r(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"!=r(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"!=r(e,l[0]))throw"this only supports TripleDES";n.encryptionSchemeAlg="TripleDES",n.encryptionSchemeIV=r(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"!=r(e,u[0]))throw"this only supports pkcs5PBKDF2";var h=i(e,u[1]);if(h.length<2)throw"malformed format: SEQUENCE(0.0.1.0.1).items < 2: "+h.length;n.pbkdf2Salt=r(e,h[0]);var c=r(e,h[1]);try{n.pbkdf2Iter=parseInt(c,16)}catch(e){throw"malformed format pbkdf2Iter: "+c}return n},getPBKDF2KeyHexFromParam:function(e,t){var i=g.enc.Hex.parse(e.pbkdf2Salt),r=e.pbkdf2Iter,n=g.PBKDF2(t,i,{keySize:6,iterations:r});return g.enc.Hex.stringify(n)},_getPlainPKCS8HexFromEncryptedPKCS8PEM:function(e,t){var i=fe(e,"ENCRYPTED PRIVATE KEY"),r=this.parseHexOfEncryptedPKCS8(i),n=Ee.getPBKDF2KeyHexFromParam(r,t),o={};o.ciphertext=g.enc.Hex.parse(r.ciphertext);var s=g.enc.Hex.parse(n),a=g.enc.Hex.parse(r.encryptionSchemeIV),l=g.TripleDES.decrypt(o,s,{iv:a});return g.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,r=t.getV,n={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(n.algoid=r(e,s[0]),"06"==e.substr(s[1],2)&&(n.algparam=r(e,s[1])),"04"!=e.substr(o[2],2))throw new Error("malformed PKCS8 private key(code:006)");return n.keyidx=t.getVidx(e,o[2]),n},getKeyFromPlainPrivatePKCS8PEM:function(e){var t=fe(e,"PRIVATE KEY");return this.getKeyFromPlainPrivatePKCS8Hex(t)},getKeyFromPlainPrivatePKCS8Hex:function(e){var t,i=this.parsePlainPrivatePKCS8Hex(e);if("2a864886f70d010101"==i.algoid)t=new te;else if("2a8648ce380401"==i.algoid)t=new f.crypto.DSA;else{if("2a8648ce3d0201"!=i.algoid)throw"unsupported private key algorithm";t=new f.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 te;else if("2a8648ce380401"===i)t=new f.crypto.DSA;else{if("2a8648ce3d0201"!==i)throw"unsupported PKCS#8 public key hex";t=new f.crypto.ECDSA}return t.readPKCS8PubKeyHex(e),t},parsePublicRawRSAKeyHex:function(e){var t=Me,i=t.getChildIdx,r=t.getV,n={};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(n.n=r(e,o[0]),"02"!=e.substr(o[1],2))throw"malformed RSA key(code:004)";return n.e=r(e,o[1]),n},parsePublicPKCS8Hex:function(e){var t=Me,i=t.getChildIdx,r=t.getV,n={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(n.algoid=r(e,a[0]),"06"==e.substr(a[1],2)?n.algparam=r(e,a[1]):"30"==e.substr(a[1],2)&&(n.algparam={},n.algparam.p=t.getVbyList(e,a[1],[0],"02"),n.algparam.q=t.getVbyList(e,a[1],[1],"02"),n.algparam.g=t.getVbyList(e,a[1],[2],"02")),"03"!=e.substr(o[1],2))throw"malformed PKCS8 public key(code:004)";return n.key=r(e,o[1]).substr(2),n}}}();Ee.getKey=function(e,t,i){var r,n=(y=Me).getChildIdx,o=(y.getV,y.getVbyList),s=f.crypto,a=s.ECDSA,l=s.DSA,u=te,h=fe,c=Ee;if(void 0!==u&&e instanceof u)return e;if(void 0!==a&&e instanceof a)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 a({pub:e.xy,curve:e.curve});if(void 0!==e.curve&&void 0!==e.d)return new a({prv:e.d,curve:e.curve});if(void 0===e.kty&&void 0!==e.n&&void 0!==e.e&&void 0===e.d)return(P=new u).setPublic(e.n,e.e),P;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(P=new u).setPrivateEx(e.n,e.e,e.d,e.p,e.q,e.dp,e.dq,e.co),P;if(void 0===e.kty&&void 0!==e.n&&void 0!==e.e&&void 0!==e.d&&void 0===e.p)return(P=new u).setPrivate(e.n,e.e,e.d),P;if(void 0!==e.p&&void 0!==e.q&&void 0!==e.g&&void 0!==e.y&&void 0===e.x)return(P=new l).setPublic(e.p,e.q,e.g,e.y),P;if(void 0!==e.p&&void 0!==e.q&&void 0!==e.g&&void 0!==e.y&&void 0!==e.x)return(P=new l).setPrivate(e.p,e.q,e.g,e.y,e.x),P;if("RSA"===e.kty&&void 0!==e.n&&void 0!==e.e&&void 0===e.d)return(P=new u).setPublic(le(e.n),le(e.e)),P;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(P=new u).setPrivateEx(le(e.n),le(e.e),le(e.d),le(e.p),le(e.q),le(e.dp),le(e.dq),le(e.qi)),P;if("RSA"===e.kty&&void 0!==e.n&&void 0!==e.e&&void 0!==e.d)return(P=new u).setPrivate(le(e.n),le(e.e),le(e.d)),P;if("EC"===e.kty&&void 0!==e.crv&&void 0!==e.x&&void 0!==e.y&&void 0===e.d){var d=(T=new a({curve:e.crv})).ecparams.keylen/4,p="04"+("0000000000"+le(e.x)).slice(-d)+("0000000000"+le(e.y)).slice(-d);return T.setPublicKeyHex(p),T}if("EC"===e.kty&&void 0!==e.crv&&void 0!==e.x&&void 0!==e.y&&void 0!==e.d){d=(T=new a({curve:e.crv})).ecparams.keylen/4,p="04"+("0000000000"+le(e.x)).slice(-d)+("0000000000"+le(e.y)).slice(-d);var A=("0000000000"+le(e.d)).slice(-d);return T.setPublicKeyHex(p),T.setPrivateKeyHex(A),T}if("pkcs5prv"===i){var g,v=e,y=Me;if(9===(g=n(v,0)).length)(P=new u).readPKCS5PrvKeyHex(v);else if(6===g.length)(P=new l).readPKCS5PrvKeyHex(v);else{if(!(g.length>2&&"04"===v.substr(g[1],2)))throw"unsupported PKCS#1/5 hexadecimal key";(P=new a).readPKCS5PrvKeyHex(v)}return P}if("pkcs8prv"===i)return c.getKeyFromPlainPrivatePKCS8Hex(e);if("pkcs8pub"===i)return c._getKeyFromPublicPKCS8Hex(e);if("x509pub"===i)return Be.getPublicKeyFromCertHex(e);if(-1!=e.indexOf("-END CERTIFICATE-",0)||-1!=e.indexOf("-END X509 CERTIFICATE-",0)||-1!=e.indexOf("-END TRUSTED CERTIFICATE-",0))return Be.getPublicKeyFromCertPEM(e);if(-1!=e.indexOf("-END PUBLIC KEY-")){var b=fe(e,"PUBLIC KEY");return c._getKeyFromPublicPKCS8Hex(b)}if(-1!=e.indexOf("-END RSA PRIVATE KEY-")&&-1==e.indexOf("4,ENCRYPTED")){var x=h(e,"RSA PRIVATE KEY");return c.getKey(x,null,"pkcs5prv")}if(-1!=e.indexOf("-END DSA PRIVATE KEY-")&&-1==e.indexOf("4,ENCRYPTED")){var w=o(r=h(e,"DSA PRIVATE KEY"),0,[1],"02"),E=o(r,0,[2],"02"),M=o(r,0,[3],"02"),S=o(r,0,[4],"02"),C=o(r,0,[5],"02");return(P=new l).setPrivate(new m(w,16),new m(E,16),new m(M,16),new m(S,16),new m(C,16)),P}if(-1!=e.indexOf("-END EC PRIVATE KEY-")&&-1==e.indexOf("4,ENCRYPTED"))return x=h(e,"EC PRIVATE KEY"),c.getKey(x,null,"pkcs5prv");if(-1!=e.indexOf("-END PRIVATE KEY-"))return c.getKeyFromPlainPrivatePKCS8PEM(e);if(-1!=e.indexOf("-END RSA PRIVATE KEY-")&&-1!=e.indexOf("4,ENCRYPTED")){var I=c.getDecryptedKeyHex(e,t),B=new te;return B.readPKCS5PrvKeyHex(I),B}if(-1!=e.indexOf("-END EC PRIVATE KEY-")&&-1!=e.indexOf("4,ENCRYPTED")){var T,P=o(r=c.getDecryptedKeyHex(e,t),0,[1],"04"),R=o(r,0,[2,0],"06"),k=o(r,0,[3,0],"03").substr(2);if(void 0===f.crypto.OID.oidhex2name[R])throw"undefined OID(hex) in KJUR.crypto.OID: "+R;return(T=new a({curve:f.crypto.OID.oidhex2name[R]})).setPublicKeyHex(k),T.setPrivateKeyHex(P),T.isPublic=!1,T}if(-1!=e.indexOf("-END DSA PRIVATE KEY-")&&-1!=e.indexOf("4,ENCRYPTED"))return w=o(r=c.getDecryptedKeyHex(e,t),0,[1],"02"),E=o(r,0,[2],"02"),M=o(r,0,[3],"02"),S=o(r,0,[4],"02"),C=o(r,0,[5],"02"),(P=new l).setPrivate(new m(w,16),new m(E,16),new m(M,16),new m(S,16),new m(C,16)),P;if(-1!=e.indexOf("-END ENCRYPTED PRIVATE KEY-"))return c.getKeyFromEncryptedPKCS8PEM(e,t);throw new Error("not supported argument")},Ee.generateKeypair=function(e,t){if("RSA"==e){var i=t;(s=new te).generate(i,"10001"),s.isPrivate=!0,s.isPublic=!0;var r=new te,n=s.n.toString(16),o=s.e.toString(16);return r.setPublic(n,o),r.isPrivate=!1,r.isPublic=!0,(a={}).prvKeyObj=s,a.pubKeyObj=r,a}if("EC"==e){var s,a,l=t,u=new f.crypto.ECDSA({curve:l}).generateKeyPairHex();return(s=new f.crypto.ECDSA({curve:l})).setPublicKeyHex(u.ecpubhex),s.setPrivateKeyHex(u.ecprvhex),s.isPrivate=!0,s.isPublic=!1,(r=new f.crypto.ECDSA({curve:l})).setPublicKeyHex(u.ecpubhex),r.isPrivate=!1,r.isPublic=!0,(a={}).prvKeyObj=s,a.pubKeyObj=r,a}throw"unknown algorithm: "+e},Ee.getPEM=function(e,t,i,r,n,o){var s=f,a=s.asn1,l=a.DERObjectIdentifier,u=a.DERInteger,h=a.ASN1Util.newObject,c=a.x509.SubjectPublicKeyInfo,d=s.crypto,p=d.DSA,A=d.ECDSA,m=te;function v(e){return h({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 h({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 h({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!==p&&e instanceof p||void 0!==A&&e instanceof A)&&1==e.isPublic&&(void 0===t||"PKCS8PUB"==t))return pe(M=new c(e).getEncodedHex(),"PUBLIC KEY");if("PKCS1PRV"==t&&void 0!==m&&e instanceof m&&(void 0===i||null==i)&&1==e.isPrivate)return pe(M=v(e).getEncodedHex(),"RSA PRIVATE KEY");if("PKCS1PRV"==t&&void 0!==A&&e instanceof A&&(void 0===i||null==i)&&1==e.isPrivate){var x=new l({name:e.curveName}).getEncodedHex(),w=y(e).getEncodedHex(),E="";return(E+=pe(x,"EC PARAMETERS"))+pe(w,"EC PRIVATE KEY")}if("PKCS1PRV"==t&&void 0!==p&&e instanceof p&&(void 0===i||null==i)&&1==e.isPrivate)return pe(M=b(e).getEncodedHex(),"DSA PRIVATE KEY");if("PKCS5PRV"==t&&void 0!==m&&e instanceof m&&void 0!==i&&null!=i&&1==e.isPrivate){var M=v(e).getEncodedHex();return void 0===r&&(r="DES-EDE3-CBC"),this.getEncryptedPKCS5PEMFromPrvKeyHex("RSA",M,i,r,o)}if("PKCS5PRV"==t&&void 0!==A&&e instanceof A&&void 0!==i&&null!=i&&1==e.isPrivate)return M=y(e).getEncodedHex(),void 0===r&&(r="DES-EDE3-CBC"),this.getEncryptedPKCS5PEMFromPrvKeyHex("EC",M,i,r,o);if("PKCS5PRV"==t&&void 0!==p&&e instanceof p&&void 0!==i&&null!=i&&1==e.isPrivate)return M=b(e).getEncodedHex(),void 0===r&&(r="DES-EDE3-CBC"),this.getEncryptedPKCS5PEMFromPrvKeyHex("DSA",M,i,r,o);var S=function(e,t){var i=C(e,t);return new h({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=g.lib.WordArray.random(8),r=g.lib.WordArray.random(8),n=g.PBKDF2(t,i,{keySize:6,iterations:100}),o=g.enc.Hex.parse(e),s=g.TripleDES.encrypt(o,n,{iv:r})+"",a={};return a.ciphertext=s,a.pbkdf2Salt=g.enc.Hex.stringify(i),a.pbkdf2Iter=100,a.encryptionSchemeAlg="DES-EDE3-CBC",a.encryptionSchemeIV=g.enc.Hex.stringify(r),a};if("PKCS8PRV"==t&&null!=m&&e instanceof m&&1==e.isPrivate){var I=v(e).getEncodedHex();return M=h({seq:[{int:0},{seq:[{oid:{name:"rsaEncryption"}},{null:!0}]},{octstr:{hex:I}}]}).getEncodedHex(),void 0===i||null==i?pe(M,"PRIVATE KEY"):pe(w=S(M,i),"ENCRYPTED PRIVATE KEY")}if("PKCS8PRV"==t&&void 0!==A&&e instanceof A&&1==e.isPrivate)return I=new h({seq:[{int:1},{octstr:{hex:e.prvKeyHex}},{tag:["a1",!0,{bitstr:{hex:"00"+e.pubKeyHex}}]}]}).getEncodedHex(),M=h({seq:[{int:0},{seq:[{oid:{name:"ecPublicKey"}},{oid:{name:e.curveName}}]},{octstr:{hex:I}}]}).getEncodedHex(),void 0===i||null==i?pe(M,"PRIVATE KEY"):pe(w=S(M,i),"ENCRYPTED PRIVATE KEY");if("PKCS8PRV"==t&&void 0!==p&&e instanceof p&&1==e.isPrivate)return I=new u({bigint:e.x}).getEncodedHex(),M=h({seq:[{int:0},{seq:[{oid:{name:"dsa"}},{seq:[{int:{bigint:e.p}},{int:{bigint:e.q}},{int:{bigint:e.g}}]}]},{octstr:{hex:I}}]}).getEncodedHex(),void 0===i||null==i?pe(M,"PRIVATE KEY"):pe(w=S(M,i),"ENCRYPTED PRIVATE KEY");throw new Error("unsupported object nor format")},Ee.getKeyFromCSRPEM=function(e){var t=fe(e,"CERTIFICATE REQUEST");return Ee.getKeyFromCSRHex(t)},Ee.getKeyFromCSRHex=function(e){var t=Ee.parseCSRHex(e);return Ee.getKey(t.p8pubkeyhex,null,"pkcs8pub")},Ee.parseCSRHex=function(e){var t=Me,i=t.getChildIdx,r=t.getTLV,n={},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 n.p8pubkeyhex=r(o,a[2]),n},Ee.getKeyID=function(e){var t=Ee,i=Me;"string"==typeof e&&-1!=e.indexOf("BEGIN ")&&(e=t.getKey(e));var r=fe(t.getPEM(e)),n=i.getIdxbyList(r,0,[1]),o=i.getV(r,n).substring(2);return f.crypto.Util.hashHex(o,"sha1")},Ee.getJWKFromKey=function(e){var t={};if(e instanceof te&&e.isPrivate)return t.kty="RSA",t.n=ae(e.n.toString(16)),t.e=ae(e.e.toString(16)),t.d=ae(e.d.toString(16)),t.p=ae(e.p.toString(16)),t.q=ae(e.q.toString(16)),t.dp=ae(e.dmp1.toString(16)),t.dq=ae(e.dmq1.toString(16)),t.qi=ae(e.coeff.toString(16)),t;if(e instanceof te&&e.isPublic)return t.kty="RSA",t.n=ae(e.n.toString(16)),t.e=ae(e.e.toString(16)),t;if(e instanceof f.crypto.ECDSA&&e.isPrivate){if("P-256"!==(r=e.getShortNISTPCurveName())&&"P-384"!==r)throw"unsupported curve name for JWT: "+r;var i=e.getPublicKeyXYHex();return t.kty="EC",t.crv=r,t.x=ae(i.x),t.y=ae(i.y),t.d=ae(e.prvKeyHex),t}if(e instanceof f.crypto.ECDSA&&e.isPublic){var r;if("P-256"!==(r=e.getShortNISTPCurveName())&&"P-384"!==r)throw"unsupported curve name for JWT: "+r;return i=e.getPublicKeyXYHex(),t.kty="EC",t.crv=r,t.x=ae(i.x),t.y=ae(i.y),t}throw"not supported key object"},void 0!==f.asn1&&f.asn1||(f.asn1={}),f.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 r="",n=0;n<i;n++)r+="f";t=new m(r,16).xor(e).add(m.ONE).toString(16).replace(/^-/,"")}return t},this.getPEMStringFromHex=function(e,t){return pe(e,t)},this.newObject=function(e){var t=f.asn1,i=t.ASN1Object,r=t.DERBoolean,n=t.DERInteger,o=t.DERBitString,s=t.DEROctetString,a=t.DERNull,l=t.DERObjectIdentifier,u=t.DEREnumerated,h=t.DERUTF8String,c=t.DERNumericString,d=t.DERPrintableString,p=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,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 r(e[S]);if("int"==S)return new n(e[S]);if("bitstr"==S)return new o(e[S]);if("octstr"==S)return new s(e[S]);if("null"==S)return new a(e[S]);if("oid"==S)return new l(e[S]);if("enum"==S)return new u(e[S]);if("utf8str"==S)return new h(e[S]);if("numstr"==S)return new c(e[S]);if("prnstr"==S)return new d(e[S]);if("telstr"==S)return new p(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=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()}},f.asn1.ASN1Util.oidHexToInt=function(e){for(var t="",i=parseInt(e.substr(0,2),16),r=(t=Math.floor(i/40)+"."+i%40,""),n=2;n<e.length;n+=2){var o=("00000000"+parseInt(e.substr(n,2),16).toString(2)).slice(-8);r+=o.substr(1,7),"0"==o.substr(0,1)&&(t=t+"."+new m(r,2).toString(10),r="")}return t},f.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="",r=new m(e,10).toString(2),n=7-r.length%7;7==n&&(n=0);for(var o="",s=0;s<n;s++)o+="0";for(r=o+r,s=0;s<r.length-1;s+=7){var a=r.substr(s,7);s!=r.length-7&&(a="1"+a),i+=t(parseInt(a,2))}return i};if(!e.match(/^[0-9.]+$/))throw"malformed oid string: "+e;var r="",n=e.split("."),o=40*parseInt(n[0])+parseInt(n[1]);r+=t(o),n.splice(0,2);for(var s=0;s<n.length;s++)r+=i(n[s]);return r},f.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)},f.asn1.DERAbstractString=function(e){f.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=ue(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))},A.lang.extend(f.asn1.DERAbstractString,f.asn1.ASN1Object),f.asn1.DERAbstractTime=function(e){f.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 r=this.zeroPadding,n=this.localDateToUTC(e),o=String(n.getFullYear());"utc"==t&&(o=o.substr(2,2));var s=o+r(String(n.getMonth()+1),2)+r(String(n.getDate()),2)+r(String(n.getHours()),2)+r(String(n.getMinutes()),2)+r(String(n.getSeconds()),2);if(!0===i){var a=n.getMilliseconds();if(0!=a){var l=r(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=ne(e)},this.setByDateValue=function(e,t,i,r,n,o){var s=new Date(Date.UTC(e,t-1,i,r,n,o,0));this.setByDate(s)},this.getFreshValueHex=function(){return this.hV}},A.lang.extend(f.asn1.DERAbstractTime,f.asn1.ASN1Object),f.asn1.DERAbstractStructured=function(e){f.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)},A.lang.extend(f.asn1.DERAbstractStructured,f.asn1.ASN1Object),f.asn1.DERBoolean=function(e){f.asn1.DERBoolean.superclass.constructor.call(this),this.hT="01",this.hTLV=0==e?"010100":"0101ff"},A.lang.extend(f.asn1.DERBoolean,f.asn1.ASN1Object),f.asn1.DERInteger=function(e){f.asn1.DERInteger.superclass.constructor.call(this),this.hT="02",this.setByBigInteger=function(e){this.hTLV=null,this.isModified=!0,this.hV=f.asn1.ASN1Util.bigIntToMinTwosComplementsHex(e)},this.setByInteger=function(e){var t=new m(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))},A.lang.extend(f.asn1.DERInteger,f.asn1.ASN1Object),f.asn1.DERBitString=function(e){if(void 0!==e&&void 0!==e.obj){var t=f.asn1.ASN1Util.newObject(e.obj);e.hex="00"+t.getEncodedHex()}f.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 r="";for(i=0;i<e.length-1;i+=8){var n=e.substr(i,8),o=parseInt(n,2).toString(16);1==o.length&&(o="0"+o),r+=o}this.hTLV=null,this.isModified=!0,this.hV="0"+t+r},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))},A.lang.extend(f.asn1.DERBitString,f.asn1.ASN1Object),f.asn1.DEROctetString=function(e){if(void 0!==e&&void 0!==e.obj){var t=f.asn1.ASN1Util.newObject(e.obj);e.hex=t.getEncodedHex()}f.asn1.DEROctetString.superclass.constructor.call(this,e),this.hT="04"},A.lang.extend(f.asn1.DEROctetString,f.asn1.DERAbstractString),f.asn1.DERNull=function(){f.asn1.DERNull.superclass.constructor.call(this),this.hT="05",this.hTLV="0500"},A.lang.extend(f.asn1.DERNull,f.asn1.ASN1Object),f.asn1.DERObjectIdentifier=function(e){f.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="",r=parseInt(e,10).toString(2),n=7-r.length%7;7==n&&(n=0);for(var o="",s=0;s<n;s++)o+="0";for(r=o+r,s=0;s<r.length-1;s+=7){var a=r.substr(s,7);s!=r.length-7&&(a="1"+a),i+=t(parseInt(a,2))}return i};try{if(!e.match(/^[0-9.]+$/))return null;var r="",n=e.split("."),o=40*parseInt(n[0],10)+parseInt(n[1],10);r+=t(o),n.splice(0,2);for(var s=0;s<n.length;s++)r+=i(n[s]);return r}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=f.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)},A.lang.extend(f.asn1.DERObjectIdentifier,f.asn1.ASN1Object),f.asn1.DEREnumerated=function(e){f.asn1.DEREnumerated.superclass.constructor.call(this),this.hT="0a",this.setByBigInteger=function(e){this.hTLV=null,this.isModified=!0,this.hV=f.asn1.ASN1Util.bigIntToMinTwosComplementsHex(e)},this.setByInteger=function(e){var t=new m(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))},A.lang.extend(f.asn1.DEREnumerated,f.asn1.ASN1Object),f.asn1.DERUTF8String=function(e){f.asn1.DERUTF8String.superclass.constructor.call(this,e),this.hT="0c"},A.lang.extend(f.asn1.DERUTF8String,f.asn1.DERAbstractString),f.asn1.DERNumericString=function(e){f.asn1.DERNumericString.superclass.constructor.call(this,e),this.hT="12"},A.lang.extend(f.asn1.DERNumericString,f.asn1.DERAbstractString),f.asn1.DERPrintableString=function(e){f.asn1.DERPrintableString.superclass.constructor.call(this,e),this.hT="13"},A.lang.extend(f.asn1.DERPrintableString,f.asn1.DERAbstractString),f.asn1.DERTeletexString=function(e){f.asn1.DERTeletexString.superclass.constructor.call(this,e),this.hT="14"},A.lang.extend(f.asn1.DERTeletexString,f.asn1.DERAbstractString),f.asn1.DERIA5String=function(e){f.asn1.DERIA5String.superclass.constructor.call(this,e),this.hT="16"},A.lang.extend(f.asn1.DERIA5String,f.asn1.DERAbstractString),f.asn1.DERVisibleString=function(e){f.asn1.DERIA5String.superclass.constructor.call(this,e),this.hT="1a"},A.lang.extend(f.asn1.DERVisibleString,f.asn1.DERAbstractString),f.asn1.DERBMPString=function(e){f.asn1.DERBMPString.superclass.constructor.call(this,e),this.hT="1e"},A.lang.extend(f.asn1.DERBMPString,f.asn1.DERAbstractString),f.asn1.DERUTCTime=function(e){f.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=ne(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=ne(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))},A.lang.extend(f.asn1.DERUTCTime,f.asn1.DERAbstractTime),f.asn1.DERGeneralizedTime=function(e){f.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=ne(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=ne(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))},A.lang.extend(f.asn1.DERGeneralizedTime,f.asn1.DERAbstractTime),f.asn1.DERSequence=function(e){f.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}},A.lang.extend(f.asn1.DERSequence,f.asn1.DERAbstractStructured),f.asn1.DERSet=function(e){f.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)},A.lang.extend(f.asn1.DERSet,f.asn1.DERAbstractStructured),f.asn1.DERTaggedObject=function(e){f.asn1.DERTaggedObject.superclass.constructor.call(this);var t=f.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)},A.lang.extend(f.asn1.DERTaggedObject,f.asn1.ASN1Object);var Me=new function(){};function Se(e,t){for(var i="",r=t/4-e.length,n=0;n<r;n++)i+="0";return i+e}function Ce(e,t,i){for(var r="",n=0;r.length<t;)r+=ce(i(de(e+String.fromCharCode.apply(String,[(4278190080&n)>>24,(16711680&n)>>16,(65280&n)>>8,255&n])))),n+=1;return r}function Ie(e){for(var t in f.crypto.Util.DIGESTINFOHEAD){var i=f.crypto.Util.DIGESTINFOHEAD[t],r=i.length;if(e.substring(0,r)==i)return[t,e.substring(r)]}return[]}function Be(e){var t,i=Me,r=i.getChildIdx,n=i.getV,o=i.getTLV,s=i.getVbyList,a=i.getVbyListEx,l=i.getTLVbyList,u=i.getTLVbyListEx,h=i.getIdxbyList,c=i.getIdxbyListEx,d=i.getVidx,p=i.getInt,A=i.oidname,g=i.hextooidstr,m=fe;try{t=f.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=l(this.hex,0,[0,0]);if("a0"==e.substr(0,2)){var t=l(e,0,[0]),i=p(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 a(this.hex,0,[0,0],"02")},this.getSignatureAlgorithmField=function(){var e=u(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(a(e,0,[0],"06"))},this.getIssuer=function(){return this.getX500Name(this.getIssuerHex())},this.getIssuerHex=function(){return l(this.hex,0,[0,3+this.foffset],"30")},this.getIssuerString=function(){return this.getIssuer().str},this.getSubject=function(){return this.getX500Name(this.getSubjectHex())},this.getSubjectHex=function(){return l(this.hex,0,[0,5+this.foffset],"30")},this.getSubjectString=function(){return this.getSubject().str},this.getNotBefore=function(){var e=s(this.hex,0,[0,4+this.foffset,0]);return e=e.replace(/(..)/g,"%$1"),decodeURIComponent(e)},this.getNotAfter=function(){var e=s(this.hex,0,[0,4+this.foffset,1]);return e=e.replace(/(..)/g,"%$1"),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 Ee.getKey(this.getPublicKeyHex(),null,"pkcs8pub")},this.getSignatureAlgorithmName=function(){var e=l(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(),r=l(this.hex,0,[0],"30"),n=new f.crypto.Signature({alg:t});return n.init(e),n.updateHex(r),n.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=r(a,t)}else{a=fe(e);var l=h(a,0,[0,3,0,0],"06");if("2a864886f70d01090e"!=n(a,l))return void(this.aExtInfo=new Array);t=h(a,0,[0,3,0,1,0],"30"),o=r(a,t),this.hex=a}this.aExtInfo=new Array;for(var u=0;u<o.length;u++){var c={critical:!1},p=0;3===r(a,o[u]).length&&(c.critical=!0,p=1),c.oid=i.hextooidstr(s(a,o[u],[0],"06"));var f=h(a,o[u],[1+p]);c.vidx=d(a,f),this.aExtInfo.push(c)}},this.getExtInfo=function(e){var t=this.aExtInfo,i=e;if(e.match(/^[0-9.]+$/)||(i=f.asn1.x509.OID.name2oid(e)),""!==i)for(var r=0;r<t.length;r++)if(t[r].oid===i)return t[r]},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 r={extname:"basicConstraints"};if(t&&(r.critical=!0),"3000"===e)return r;if("30030101ff"===e)return r.cA=!0,r;if("30060101ff02"===e.substr(0,12)){var s=n(e,10),a=parseInt(s,16);return r.cA=!0,r.pathLen=a,r}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 r={extname:"keyUsage"};return t&&(r.critical=!0),r.names=this.getExtKeyUsageString(e).split(","),r},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,r=0;r<t.length;r++)"1"==t.substr(r,1)&&i.push(Be.KEYUSAGE_NAME[r]);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 r={extname:"subjectKeyIdentifier"};t&&(r.critical=!0);var s=n(e,0);return r.kid={hex:s},r},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=r(e,0),l=0;l<a.length;l++){var u=e.substr(a[l],2);if("80"===u&&(s.kid={hex:n(e,a[l])}),"a1"===u){var h=o(e,a[l]),c=this.getGeneralNames(h);s.issuer=c[0].dn}"82"===u&&(s.sn={hex:n(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=r(e,0),l=0;l<a.length;l++)s.array.push(A(n(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=r(i,0),a=0;a<s.length;a++)t.push(A(n(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 r={extname:"subjectAltName",array:[]};return t&&(r.critical=!0),r.array=this.getGeneralNames(e),r},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 r={extname:"issuerAltName",array:[]};return t&&(r.critical=!0),r.array=this.getGeneralNames(e),r},this.getGeneralNames=function(e){for(var t=r(e,0),i=[],n=0;n<t.length;n++){var s=this.getGeneralName(o(e,t[n]));void 0!==s&&i.push(s)}return i},this.getGeneralName=function(e){var t=e.substr(0,2),i=n(e,0),r=ce(i);return"81"==t?{rfc822:r}:"82"==t?{dns:r}:"86"==t?{uri:r}:"87"==t?{ip:ge(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=r(l,0),h=0;h<u.length;h++)i=l.substr(u[h],2),e=n(l,u[h]),"81"===i&&(t=he(e),a.push(["MAIL",t])),"82"===i&&(t=he(e),a.push(["DNS",t])),"84"===i&&(t=Be.hex2dn(e,0),a.push(["DN",t])),"86"===i&&(t=he(e),a.push(["URI",t])),"87"===i&&(t=ge(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 n={extname:"cRLDistributionPoints",array:[]};t&&(n.critical=!0);for(var s=r(e,0),a=0;a<s.length;a++){var l=o(e,s[a]);n.array.push(this.getDistributionPoint(l))}return n},this.getDistributionPoint=function(e){for(var t={},i=r(e,0),n=0;n<i.length;n++){var s=e.substr(i[n],2),a=o(e,i[n]);"a0"==s&&(t.dpname=this.getDistributionPointName(a))}return t},this.getDistributionPointName=function(e){for(var t={},i=r(e,0),n=0;n<i.length;n++){var s=e.substr(i[n],2),a=o(e,i[n]);"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=r(this.hex,e.vidx),n=0;n<i.length;n++)try{var o=he(s(this.hex,i[n],[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=r(this.hex,e.vidx),n=0;n<i.length;n++){var o=s(this.hex,i[n],[0],"06"),a=s(this.hex,i[n],[1],"86");"2b06010505073001"===o&&t.ocsp.push(he(a)),"2b06010505073002"===o&&t.caissuer.push(he(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 n={extname:"authorityInfoAccess",array:[]};t&&(n.critical=!0);for(var l=r(e,0),u=0;u<l.length;u++){var h=a(e,l[u],[0],"06"),c=he(s(e,l[u],[1],"86"));if("2b06010505073001"==h)n.array.push({ocsp:c});else{if("2b06010505073002"!=h)throw new Error("unknown method: "+h);n.array.push({caissuer:c})}}return n},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 n={extname:"certificatePolicies",array:[]};t&&(n.critical=!0);for(var s=r(e,0),a=0;a<s.length;a++){var l=o(e,s[a]),u=this.getPolicyInformation(l);n.array.push(u)}return n},this.getPolicyInformation=function(e){var t={},i=s(e,0,[0],"06");t.policyoid=A(i);var n=c(e,0,[1],"30");if(-1!=n){t.array=[];for(var a=r(e,n),l=0;l<a.length;l++){var u=o(e,a[l]),h=this.getPolicyQualifierInfo(u);t.array.push(h)}}return t},this.getPolicyQualifierInfo=function(e){var t={},i=s(e,0,[0],"06");if("2b06010505070201"===i){var r=a(e,0,[1],"16");t.cps=ce(r)}else if("2b06010505070202"===i){var n=l(e,0,[1],"30");t.unotice=this.getUserNotice(n)}return t},this.getUserNotice=function(e){for(var t={},i=r(e,0),n=0;n<i.length;n++){var s=o(e,i[n]);"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=ce(n(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:n(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(n(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 r=n(e,0);return i.hex=r,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 n={extname:"adobeTimeStamp"};t&&(n.critical=!0);var s=r(e,0);if(s.length>1){var a=o(e,s[1]),l=this.getGeneralName(a);null!=l.uri&&(n.uri=l.uri)}if(s.length>2){var u=o(e,s[2]);"0101ff"==u&&(n.reqauth=!0),"010100"==u&&(n.reqauth=!1)}return n},this.getX500NameRule=function(e){for(var t=null,i=[],r=0;r<e.length;r++)for(var n=e[r],o=0;o<n.length;o++)i.push(n[o]);for(r=0;r<i.length;r++){var s=i[r],a=s.ds,l=s.value,u=s.type;if("prn"!=a&&"utf8"!=a&&"ia5"!=a)return"mixed";if("ia5"==a){if("CN"!=u)return"mixed";if(f.lang.String.isMail(l))continue;return"mixed"}if("C"==u){if("prn"==a)continue;return"mixed"}if(null==t)t=a;else if(t!==a)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=r(e,0),n=0;n<i.length;n++)t.push(this.getRDN(o(e,i[n])));return t},this.getRDN=function(e){for(var t=[],i=r(e,0),n=0;n<i.length;n++)t.push(this.getAttrTypeAndValue(o(e,i[n])));return t},this.getAttrTypeAndValue=function(e){var t={type:null,value:null,ds:null},i=r(e,0),n=s(e,i[0],[],"06"),o=s(e,i[1],[]),a=f.asn1.ASN1Util.oidHexToInt(n);return t.type=f.asn1.x509.OID.oid2atype(a),t.ds=this.HEX2STAG[e.substr(i[1],2)],"bmp"!=t.ds?t.value=he(o):t.value=me(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=pe(this.getPublicKeyHex(),"PUBLIC KEY"),this.aExtInfo.length>0&&(e.ext=this.getExtParamArray()),e.sighex=this.getSignatureValueHex(),e},this.getExtParamArray=function(e){null==e&&-1!=c(this.hex,0,[0,"[3]"])&&(e=u(this.hex,0,[0,"[3]",0],"30"));for(var t=[],i=r(e,0),n=0;n<i.length;n++){var s=o(e,i[n]),a=this.getExtParam(s);null!=a&&t.push(a)}return t},this.getExtParam=function(e){var t=r(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")),n=!1;3==t&&"0101ff"==l(e,0,[1])&&(n=!0);var o=l(e,0,[t-1,0]),a=void 0;if("2.5.29.14"==i?a=this.getExtSubjectKeyIdentifier(o,n):"2.5.29.15"==i?a=this.getExtKeyUsage(o,n):"2.5.29.17"==i?a=this.getExtSubjectAltName(o,n):"2.5.29.18"==i?a=this.getExtIssuerAltName(o,n):"2.5.29.19"==i?a=this.getExtBasicConstraints(o,n):"2.5.29.31"==i?a=this.getExtCRLDistributionPoints(o,n):"2.5.29.32"==i?a=this.getExtCertificatePolicies(o,n):"2.5.29.35"==i?a=this.getExtAuthorityKeyIdentifier(o,n):"2.5.29.37"==i?a=this.getExtExtKeyUsage(o,n):"1.3.6.1.5.5.7.1.1"==i?a=this.getExtAuthorityInfoAccess(o,n):"2.5.29.20"==i?a=this.getExtCRLNumber(o,n):"2.5.29.21"==i?a=this.getExtCRLReason(o,n):"1.3.6.1.5.5.7.48.1.2"==i?a=this.getExtOcspNonce(o,n):"1.3.6.1.5.5.7.48.1.5"==i?a=this.getExtOcspNoCheck(o,n):"1.2.840.113583.1.1.9.1"==i&&(a=this.getExtAdobeTimeStamp(o,n)),null!=a)return a;var u={extname:i,extn:o};return n&&(u.critical=!0),u},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 r=i.array,n=0;n<r.length;n++)if(null!=r[n].dpname&&null!=r[n].dpname.full)for(var o=r[n].dpname.full,s=0;s<o.length;s++){var a=o[n];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 r=i.array,n=0;n<r.length;n++)null!=r[n].ocsp&&(r[n].ocsp=t)},this.updateExtAIACAIssuer=function(e,t){var i=this.findExt(e,"authorityInfoAccess");if(null!=i&&null!=i.array)for(var r=i.array,n=0;n<r.length;n++)null!=r[n].caissuer&&(r[n].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,r,n=function(e){for(var t="",i=e.array,r=0;r<i.length;r++){var n=i[r];if(t+=" policy oid: "+n.policyoid+"\n",void 0!==n.array)for(var o=0;o<n.array.length;o++){var s=n.array[o];void 0!==s.cps&&(t+=" cps: "+s.cps+"\n")}}return t},o=function(e){for(var t="",i=e.array,r=0;r<i.length;r++){var n=i[r];try{void 0!==n.dpname.full[0].uri&&(t+=" "+n.dpname.full[0].uri+"\n")}catch(e){}try{void 0!==n.dname.full[0].dn.hex&&(t+=" "+Be.hex2dn(n.dpname.full[0].dn.hex)+"\n")}catch(e){}}return t},s=function(e){for(var t="",i=e.array,r=0;r<i.length;r++){var n=i[r];void 0!==n.caissuer&&(t+=" caissuer: "+n.caissuer+"\n"),void 0!==n.ocsp&&(t+=" ocsp: "+n.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="+be(t.n.toString(16)).substr(0,16)+"...\n",e+=" e="+be(t.e.toString(16))+"\n"),null!=(i=this.aExtInfo)){e+="X509v3 Extensions:\n";for(var a=0;a<i.length;a++){var l=i[a],u=f.asn1.x509.OID.oid2name(l.oid);""===u&&(u=l.oid);var h="";if(!0===l.critical&&(h="CRITICAL"),e+=" "+u+" "+h+":\n","basicConstraints"===u){var c=this.getExtBasicConstraints();void 0===c.cA?e+=" {}\n":(e+=" cA=true",void 0!==c.pathLen&&(e+=", pathLen="+c.pathLen),e+="\n")}else if("keyUsage"===u)e+=" "+this.getExtKeyUsageString()+"\n";else if("subjectKeyIdentifier"===u)e+=" "+this.getExtSubjectKeyIdentifier().kid.hex+"\n";else if("authorityKeyIdentifier"===u){var d=this.getExtAuthorityKeyIdentifier();void 0!==d.kid&&(e+=" kid="+d.kid.hex+"\n")}else"extKeyUsage"===u?e+=" "+this.getExtExtKeyUsage().array.join(", ")+"\n":"subjectAltName"===u?e+=" "+(r=this.getExtSubjectAltName(),JSON.stringify(r.array).replace(/[\[\]\{\}\"]/g,"")+"\n"):"cRLDistributionPoints"===u?e+=o(this.getExtCRLDistributionPoints()):"authorityInfoAccess"===u?e+=s(this.getExtAuthorityInfoAccess()):"certificatePolicies"===u&&(e+=n(this.getExtCertificatePolicies()))}}return(e+="signature algorithm: "+this.getSignatureAlgorithmName()+"\n")+"signature: "+this.getSignatureValueHex().substr(0,16)+"...\n"},"string"==typeof e&&(-1!=e.indexOf("-----BEGIN")?this.readCertPEM(e):f.lang.String.isHex(e)&&this.readCertHex(e))}function Te(e){return g.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 m(i.substr(2),16):new m(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),r=Me.getVblen(e,t);return e.substr(i,2*r)},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,r,n,o=Me,s=[];i=o.getVidx(e,t),r=2*o.getVblen(e,t),"03"==e.substr(t,2)&&(i+=2,r-=2),n=0;for(var a=i;n<=r;){var l=o.getTLVblen(e,a);if((n+=l)<=r&&s.push(a),a+=l,n>=r)break}return s},Me.getNthChildIdx=function(e,t,i){return Me.getChildIdx(e,t)[i]},Me.getIdxbyList=function(e,t,i,r){var n,o,s=Me;return 0==i.length?void 0!==r&&e.substr(t,2)!==r?-1:t:(n=i.shift())>=(o=s.getChildIdx(e,t)).length?-1:s.getIdxbyList(e,o[n],i,r)},Me.getIdxbyListEx=function(e,t,i,r){var n,o,s=Me;if(0==i.length)return void 0!==r&&e.substr(t,2)!==r?-1:t;n=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 n&&!s.isContextTag(u)&&a==n||"string"==typeof n&&s.isContextTag(u,n))return s.getIdxbyListEx(e,o[l],i,r);s.isContextTag(u)||a++}return-1},Me.getTLVbyList=function(e,t,i,r){var n=Me,o=n.getIdxbyList(e,t,i,r);return-1==o||o>=e.length?null:n.getTLV(e,o)},Me.getTLVbyListEx=function(e,t,i,r){var n=Me,o=n.getIdxbyListEx(e,t,i,r);return-1==o?null:n.getTLV(e,o)},Me.getVbyList=function(e,t,i,r,n){var o,s,a=Me;return-1==(o=a.getIdxbyList(e,t,i,r))||o>=e.length?null:(s=a.getV(e,o),!0===n&&(s=s.substr(2)),s)},Me.getVbyListEx=function(e,t,i,r,n){var o,s,a=Me;return-1==(o=a.getIdxbyListEx(e,t,i,r))?null:(s=a.getV(e,o),"03"==e.substr(o,2)&&!1!==n&&(s=s.substr(2)),s)},Me.getInt=function(e,t,i){null==i&&(i=-1);try{var r=e.substr(t,2);if("02"!=r&&"03"!=r)return i;var n=Me.getV(e,t);return"02"==r?parseInt(n,16):function(e){try{var t=e.substr(0,2);if("00"==t)return parseInt(e.substr(2),16);var i=parseInt(t,16),r=e.substr(2),n=parseInt(r,16).toString(2);return"0"==n&&(n="00000000"),n=n.slice(0,0-i),parseInt(n,2)}catch(e){return-1}}(n)}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(!ye(e))return null;try{var t=[],i=e.substr(0,2),r=parseInt(i,16);t[0]=new String(Math.floor(r/40)),t[1]=new String(r%40);for(var n=e.substr(2),o=[],s=0;s<n.length/2;s++)o.push(parseInt(n.substr(2*s,2),16));var a=[],l="";for(s=0;s<o.length;s++)128&o[s]?l+=xe((127&o[s]).toString(2),7):(l+=xe((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 r=Me.getOID(e,t,i);if(r==i)return i;var n=f.asn1.x509.OID.oid2name(r);return""==n?r:n}catch(e){return i}},Me.getString=function(e,t,i){null==i&&(i=null);try{return ce(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=[],r=e.substr(0,2),n=parseInt(r,16);i[0]=new String(Math.floor(n/40)),i[1]=new String(n%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 h=i.join(".");return l.length>0&&(h=h+"."+l.join(".")),h},Me.dump=function(e,t,i,r){var n=Me,o=n.getV,s=n.dump,a=n.getChildIdx,l=e;e instanceof f.asn1.ASN1Object&&(l=e.getEncodedHex());var u=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===r&&(r="");var h,c=t.ommit_long_octet;if("01"==(h=l.substr(i,2)))return"00"==(d=o(l,i))?r+"BOOLEAN FALSE\n":r+"BOOLEAN TRUE\n";if("02"==h)return r+"INTEGER "+u(d=o(l,i),c)+"\n";if("03"==h){var d=o(l,i);return n.isASN1HEX(d.substr(2))?(w=r+"BITSTRING, encapsulates\n")+s(d.substr(2),t,0,r+" "):r+"BITSTRING "+u(d,c)+"\n"}if("04"==h)return d=o(l,i),n.isASN1HEX(d)?(w=r+"OCTETSTRING, encapsulates\n")+s(d,t,0,r+" "):r+"OCTETSTRING "+u(d,c)+"\n";if("05"==h)return r+"NULL\n";if("06"==h){var p=o(l,i),A=f.asn1.ASN1Util.oidHexToInt(p),g=f.asn1.x509.OID.oid2name(A),m=A.replace(/\./g," ");return""!=g?r+"ObjectIdentifier "+g+" ("+m+")\n":r+"ObjectIdentifier ("+m+")\n"}if("0a"==h)return r+"ENUMERATED "+parseInt(o(l,i))+"\n";if("0c"==h)return r+"UTF8String '"+he(o(l,i))+"'\n";if("13"==h)return r+"PrintableString '"+he(o(l,i))+"'\n";if("14"==h)return r+"TeletexString '"+he(o(l,i))+"'\n";if("16"==h)return r+"IA5String '"+he(o(l,i))+"'\n";if("17"==h)return r+"UTCTime "+he(o(l,i))+"\n";if("18"==h)return r+"GeneralizedTime "+he(o(l,i))+"\n";if("1a"==h)return r+"VisualString '"+he(o(l,i))+"'\n";if("1e"==h)return r+"BMPString '"+me(o(l,i))+"'\n";if("30"==h){if("3000"==l.substr(i,4))return r+"SEQUENCE {}\n";w=r+"SEQUENCE\n";var v=t;if((2==(x=a(l,i)).length||3==x.length)&&"06"==l.substr(x[0],2)&&"04"==l.substr(x[x.length-1],2)){g=n.oidname(o(l,x[0]));var y=JSON.parse(JSON.stringify(t));y.x509ExtName=g,v=y}for(var b=0;b<x.length;b++)w+=s(l,v,x[b],r+" ");return w}if("31"==h){w=r+"SET\n";var x=a(l,i);for(b=0;b<x.length;b++)w+=s(l,t,x[b],r+" ");return w}if(0!=(128&(h=parseInt(h,16)))){var w,E=31&h;if(0!=(32&h)){for(w=r+"["+E+"]\n",x=a(l,i),b=0;b<x.length;b++)w+=s(l,t,x[b],r+" ");return w}return d=o(l,i),Me.isASN1HEX(d)?(w=r+"["+E+"]\n")+s(d,t,0,r+" "):(("68747470"==d.substr(0,8)||"subjectAltName"===t.x509ExtName&&2==E)&&(d=he(d)),r+"["+E+"] "+d+"\n")}return r+"UNKNOWN("+h+") "+o(l,i)+"\n"},Me.isContextTag=function(e,t){var i,r;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]+\]$/)&&!((r=parseInt(t.substr(1,t.length-1),10))>31)&&128==(192&i)&&(31&i)==r}catch(e){return!1}},Me.isASN1HEX=function(e){var t=Me;if(e.length%2==1)return!1;var i=t.getVblen(e,0),r=e.substr(0,2),n=t.getL(e,0);return e.length-r.length-n.length==2*i},Me.checkStrictDER=function(e,t,i,r,n){var o=Me;if(void 0===i){if("string"!=typeof e)throw new Error("not hex string");if(e=e.toLowerCase(),!f.lang.String.isHex(e))throw new Error("not hex string");i=e.length,n=(r=e.length/2)<128?1:Math.ceil(r.toString(16))+1}if(o.getL(e,t).length>2*n)throw new Error("L of TLV too long: idx="+t);var s=o.getVblen(e,t);if(s>r)throw new Error("value of L too long than hex: idx="+t);var a=o.getTLV(e,t),l=a.length-2-o.getL(e,t).length;if(l!==2*s)throw new Error("V string length and L's value not the same:"+l+"/"+2*s);if(0===t&&e.length!=a.length)throw new Error("total length and TLV length unmatch:"+e.length+"!="+a.length);var u=e.substr(t,2);if("02"===u){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(u,16)){for(var c=o.getVblen(e,t),d=0,p=o.getChildIdx(e,t),A=0;A<p.length;A++)d+=o.getTLV(e,p[A]).length,o.checkStrictDER(e,p[A],i,r,n);if(2*c!=d)throw new Error("sum of children's TLV length and L unmatch: "+2*c+"!="+d)}},Me.oidname=function(e){var t=f.asn1;f.lang.String.isHex(e)&&(e=t.ASN1Util.oidHexToInt(e));var i=t.x509.OID.oid2name(e);return""===i&&(i=e),i},void 0!==f.asn1&&f.asn1||(f.asn1={}),void 0!==f.asn1.x509&&f.asn1.x509||(f.asn1.x509={}),f.asn1.x509.Certificate=function(e){f.asn1.x509.Certificate.superclass.constructor.call(this);var t=f.asn1,i=t.DERBitString,r=t.DERSequence,n=t.x509,o=n.TBSCertificate,s=n.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(),r=new f.crypto.Signature({alg:t});r.init(e.cakey),r.updateHex(i),e.sighex=r.sign()},this.getPEM=function(){return pe(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 r({array:t}).getEncodedHex()},null!=e&&(this.params=e)},we(f.asn1.x509.Certificate,f.asn1.ASN1Object),f.asn1.x509.TBSCertificate=function(e){f.asn1.x509.TBSCertificate.superclass.constructor.call(this);var t=f.asn1,i=t.x509,r=t.DERTaggedObject,n=t.DERInteger,o=t.DERSequence,s=i.AlgorithmIdentifier,a=i.Time,l=i.X500Name,u=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 c=new r({obj:new n({int:i})});e.push(c)}return e.push(new n(t.serial)),e.push(new s({name:t.sigalg})),e.push(new l(t.issuer)),e.push(new o({array:[new a(t.notbefore),new a(t.notafter)]})),e.push(new l(t.subject)),e.push(new h(Ee.getKey(t.sbjpubkey))),void 0!==t.ext&&t.ext.length>0&&e.push(new r({tag:"a3",obj:new u(t.ext)})),new f.asn1.DERSequence({array:e}).getEncodedHex()},void 0!==e&&this.setByParam(e)},we(f.asn1.x509.TBSCertificate,f.asn1.ASN1Object),f.asn1.x509.Extensions=function(e){f.asn1.x509.Extensions.superclass.constructor.call(this);var t=f.asn1,i=t.DERSequence,r=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 n=this.aParam[t],o=n.extname,s=null;if(null!=n.extn)s=new r.PrivateExtension(n);else if("subjectKeyIdentifier"==o)s=new r.SubjectKeyIdentifier(n);else if("keyUsage"==o)s=new r.KeyUsage(n);else if("subjectAltName"==o)s=new r.SubjectAltName(n);else if("issuerAltName"==o)s=new r.IssuerAltName(n);else if("basicConstraints"==o)s=new r.BasicConstraints(n);else if("cRLDistributionPoints"==o)s=new r.CRLDistributionPoints(n);else if("certificatePolicies"==o)s=new r.CertificatePolicies(n);else if("authorityKeyIdentifier"==o)s=new r.AuthorityKeyIdentifier(n);else if("extKeyUsage"==o)s=new r.ExtKeyUsage(n);else if("authorityInfoAccess"==o)s=new r.AuthorityInfoAccess(n);else if("cRLNumber"==o)s=new r.CRLNumber(n);else if("cRLReason"==o)s=new r.CRLReason(n);else if("ocspNonce"==o)s=new r.OCSPNonce(n);else if("ocspNoCheck"==o)s=new r.OCSPNoCheck(n);else if("adobeTimeStamp"==o)s=new r.AdobeTimeStamp(n);else{if("subjectDirectoryAttributes"!=o)throw new Error("extension not supported:"+JSON.stringify(n));s=new r.SubjectDirectoryAttributes(n)}null!=s&&e.push(s)}return new i({array:e}).getEncodedHex()},null!=e&&this.setByParam(e)},we(f.asn1.x509.Extensions,f.asn1.ASN1Object),f.asn1.x509.Extension=function(e){f.asn1.x509.Extension.superclass.constructor.call(this);var t=f.asn1,i=t.DERObjectIdentifier,r=t.DEROctetString,n=(t.DERBitString,t.DERBoolean),o=t.DERSequence;this.getEncodedHex=function(){var e=new i({oid:this.oid}),t=new r({hex:this.getExtnValueHex()}),s=new Array;return s.push(e),this.critical&&s.push(new n),s.push(t),new o({array:s}).getEncodedHex()},this.critical=!1,void 0!==e&&void 0!==e.critical&&(this.critical=e.critical)},we(f.asn1.x509.Extension,f.asn1.ASN1Object),f.asn1.x509.KeyUsage=function(e){f.asn1.x509.KeyUsage.superclass.constructor.call(this,e);var t=Be.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 f.asn1.DERBitString(e)),void 0!==e.names&&void 0!==e.names.length)){for(var i=e.names,r="000000000",n=0;n<i.length;n++)for(var o=0;o<t.length;o++)i[n]===t[o]&&(r=r.substring(0,o)+"1"+r.substring(o+1,r.length));this.asn1ExtnValue=new f.asn1.DERBitString({bin:r})}},we(f.asn1.x509.KeyUsage,f.asn1.x509.Extension),f.asn1.x509.BasicConstraints=function(e){f.asn1.x509.BasicConstraints.superclass.constructor.call(this,e);var t=f.asn1,i=t.DERBoolean,r=t.DERInteger,n=t.DERSequence;this.getExtnValueHex=function(){var e=new Array;this.cA&&e.push(new i),this.pathLen>-1&&e.push(new r({int:this.pathLen}));var t=new n({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))},we(f.asn1.x509.BasicConstraints,f.asn1.x509.Extension),f.asn1.x509.CRLDistributionPoints=function(e){f.asn1.x509.CRLDistributionPoints.superclass.constructor.call(this,e);var t=f.asn1,i=t.x509;this.getExtnValueHex=function(){return this.asn1ExtnValue.getEncodedHex()},this.setByDPArray=function(e){for(var r=[],n=0;n<e.length;n++)if(e[n]instanceof f.asn1.ASN1Object)r.push(e[n]);else{var o=new i.DistributionPoint(e[n]);r.push(o)}this.asn1ExtnValue=new t.DERSequence({array:r})},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))},we(f.asn1.x509.CRLDistributionPoints,f.asn1.x509.Extension),f.asn1.x509.DistributionPoint=function(e){f.asn1.x509.DistributionPoint.superclass.constructor.call(this);var t=f.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}]})))},we(f.asn1.x509.DistributionPoint,f.asn1.ASN1Object),f.asn1.x509.DistributionPointName=function(e){f.asn1.x509.DistributionPointName.superclass.constructor.call(this);var t=f.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)}},we(f.asn1.x509.DistributionPointName,f.asn1.ASN1Object),f.asn1.x509.CertificatePolicies=function(e){f.asn1.x509.CertificatePolicies.superclass.constructor.call(this,e);var t=f.asn1,i=t.x509,r=t.DERSequence,n=i.PolicyInformation;this.params=null,this.getExtnValueHex=function(){for(var e=[],t=0;t<this.params.array.length;t++)e.push(new n(this.params.array[t]));var i=new r({array:e});return this.asn1ExtnValue=i,this.asn1ExtnValue.getEncodedHex()},this.oid="2.5.29.32",void 0!==e&&(this.params=e)},we(f.asn1.x509.CertificatePolicies,f.asn1.x509.Extension),f.asn1.x509.PolicyInformation=function(e){f.asn1.x509.PolicyInformation.superclass.constructor.call(this,e);var t=f.asn1,i=t.DERSequence,r=t.DERObjectIdentifier,n=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 r(this.params.policyoid)];if(void 0!==this.params.array){for(var t=[],o=0;o<this.params.array.length;o++)t.push(new n(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)},we(f.asn1.x509.PolicyInformation,f.asn1.ASN1Object),f.asn1.x509.PolicyQualifierInfo=function(e){f.asn1.x509.PolicyQualifierInfo.superclass.constructor.call(this,e);var t=f.asn1,i=t.DERSequence,r=t.DERIA5String,n=t.DERObjectIdentifier,o=t.x509.UserNotice;this.params=null,this.getEncodedHex=function(){return void 0!==this.params.cps?new i({array:[new n({oid:"1.3.6.1.5.5.7.2.1"}),new r({str:this.params.cps})]}).getEncodedHex():null!=this.params.unotice?new i({array:[new n({oid:"1.3.6.1.5.5.7.2.2"}),new o(this.params.unotice)]}).getEncodedHex():void 0},void 0!==e&&(this.params=e)},we(f.asn1.x509.PolicyQualifierInfo,f.asn1.ASN1Object),f.asn1.x509.UserNotice=function(e){f.asn1.x509.UserNotice.superclass.constructor.call(this,e);var t=f.asn1.DERSequence,i=(f.asn1.DERInteger,f.asn1.x509.DisplayText),r=f.asn1.x509.NoticeReference;this.params=null,this.getEncodedHex=function(){var e=[];return void 0!==this.params.noticeref&&e.push(new r(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)},we(f.asn1.x509.UserNotice,f.asn1.ASN1Object),f.asn1.x509.NoticeReference=function(e){f.asn1.x509.NoticeReference.superclass.constructor.call(this,e);var t=f.asn1.DERSequence,i=f.asn1.DERInteger,r=f.asn1.x509.DisplayText;this.params=null,this.getEncodedHex=function(){var e=[];if(void 0!==this.params.org&&e.push(new r(this.params.org)),void 0!==this.params.noticenum){for(var n=[],o=this.params.noticenum,s=0;s<o.length;s++)n.push(new i(o[s]));e.push(new t({array:n}))}if(0==e.length)throw new Error("parameter is empty");return new t({array:e}).getEncodedHex()},void 0!==e&&(this.params=e)},we(f.asn1.x509.NoticeReference,f.asn1.ASN1Object),f.asn1.x509.DisplayText=function(e){f.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"))},we(f.asn1.x509.DisplayText,f.asn1.DERAbstractString),f.asn1.x509.ExtKeyUsage=function(e){f.asn1.x509.ExtKeyUsage.superclass.constructor.call(this,e);var t=f.asn1;this.setPurposeArray=function(e){this.asn1ExtnValue=new t.DERSequence;for(var i=0;i<e.length;i++){var r=new t.DERObjectIdentifier(e[i]);this.asn1ExtnValue.appendASN1Object(r)}},this.getExtnValueHex=function(){return this.asn1ExtnValue.getEncodedHex()},this.oid="2.5.29.37",void 0!==e&&void 0!==e.array&&this.setPurposeArray(e.array)},we(f.asn1.x509.ExtKeyUsage,f.asn1.x509.Extension),f.asn1.x509.AuthorityKeyIdentifier=function(e){f.asn1.x509.AuthorityKeyIdentifier.superclass.constructor.call(this,e);var t=f,i=t.asn1,r=i.DERTaggedObject,n=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 r({explicit:!1,tag:"80",obj:this.asn1KID})),this.asn1CertIssuer&&e.push(new r({explicit:!1,tag:"a1",obj:new n([{dn:this.asn1CertIssuer}])})),this.asn1CertSN&&e.push(new r({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 f.asn1.DEROctetString(e);else if("object"==typeof e&&f.crypto.Util.isKey(e)||"string"==typeof e&&-1!=e.indexOf("BEGIN ")){var t=e;"string"==typeof e&&(t=Ee.getKey(e));var i=Ee.getKeyID(t);this.asn1KID=new f.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 f.asn1.x509.X500Name(e):"string"==typeof e&&-1!=e.indexOf("BEGIN ")&&-1!=e.indexOf("CERTIFICATE")&&(this.asn1CertIssuer=new f.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 f.asn1.DERInteger(e);else if("string"==typeof e&&-1!=e.indexOf("BEGIN ")&&e.indexOf("CERTIFICATE")){var t=new Be;t.readCertPEM(e);var i=t.getSerialNumberHex();this.asn1CertSN=new f.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)))},we(f.asn1.x509.AuthorityKeyIdentifier,f.asn1.x509.Extension),f.asn1.x509.SubjectKeyIdentifier=function(e){f.asn1.x509.SubjectKeyIdentifier.superclass.constructor.call(this,e);var t=f.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&&f.crypto.Util.isKey(e)||"string"==typeof e&&-1!=e.indexOf("BEGIN")){var i=e;"string"==typeof e&&(i=Ee.getKey(e));var r=Ee.getKeyID(i);this.asn1KID=new f.asn1.DEROctetString({hex:r})}},this.oid="2.5.29.14",void 0!==e&&void 0!==e.kid&&this.setKIDByParam(e.kid)},we(f.asn1.x509.SubjectKeyIdentifier,f.asn1.x509.Extension),f.asn1.x509.AuthorityInfoAccess=function(e){f.asn1.x509.AuthorityInfoAccess.superclass.constructor.call(this,e),this.setAccessDescriptionArray=function(e){for(var t=new Array,i=f.asn1,r=i.DERSequence,n=i.DERObjectIdentifier,o=i.x509.GeneralName,s=0;s<e.length;s++){var a,l=e[s];if(void 0!==l.ocsp)a=new r({array:[new n({oid:"1.3.6.1.5.5.7.48.1"}),new o({uri:l.ocsp})]});else{if(void 0===l.caissuer)throw new Error("unknown AccessMethod parameter: "+JSON.stringify(l));a=new r({array:[new n({oid:"1.3.6.1.5.5.7.48.2"}),new o({uri:l.caissuer})]})}t.push(a)}this.asn1ExtnValue=new r({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)},we(f.asn1.x509.AuthorityInfoAccess,f.asn1.x509.Extension),f.asn1.x509.SubjectAltName=function(e){f.asn1.x509.SubjectAltName.superclass.constructor.call(this,e),this.setNameArray=function(e){this.asn1ExtnValue=new f.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)},we(f.asn1.x509.SubjectAltName,f.asn1.x509.Extension),f.asn1.x509.IssuerAltName=function(e){f.asn1.x509.IssuerAltName.superclass.constructor.call(this,e),this.setNameArray=function(e){this.asn1ExtnValue=new f.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)},we(f.asn1.x509.IssuerAltName,f.asn1.x509.Extension),f.asn1.x509.SubjectDirectoryAttributes=function(e){f.asn1.x509.SubjectDirectoryAttributes.superclass.constructor.call(this,e);var t=f.asn1,i=t.DERSequence,r=t.ASN1Util.newObject,n=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=n(o.attr),s.seq[1].set[0]={gentime:o.str};else if("placeOfBirth"==o.attr)s.seq[0].oid=n(o.attr),s.seq[1].set[0]={utf8str:o.str};else if("gender"==o.attr)s.seq[0].oid=n(o.attr),s.seq[1].set[0]={prnstr:o.str};else if("countryOfCitizenship"==o.attr)s.seq[0].oid=n(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=n(o.attr),s.seq[1].set[0]={prnstr:o.str}}e.push(new r(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)},we(f.asn1.x509.SubjectDirectoryAttributes,f.asn1.x509.Extension),f.asn1.x509.PrivateExtension=function(e){f.asn1.x509.PrivateExtension.superclass.constructor.call(this,e);var t=f,i=t.lang.String.isHex,r=t.asn1,n=r.x509.OID.name2oid,o=r.ASN1Util.newObject;this.params=null,this.setByParam=function(e){this.oid=n(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)},we(f.asn1.x509.PrivateExtension,f.asn1.x509.Extension),f.asn1.x509.CRL=function(e){f.asn1.x509.CRL.superclass.constructor.call(this);var t=f.asn1,i=t.DERSequence,r=t.DERBitString,n=t.x509,o=n.AlgorithmIdentifier,s=n.TBSCertList;this.params=void 0,this.setByParam=function(e){this.params=e},this.sign=function(){var e=new s(this.params).getEncodedHex(),t=new f.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 pe(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 r({hex:"00"+e.sighex})),new i({array:t}).getEncodedHex()},null!=e&&(this.params=e)},we(f.asn1.x509.CRL,f.asn1.ASN1Object),f.asn1.x509.TBSCertList=function(e){f.asn1.x509.TBSCertList.superclass.constructor.call(this);var t=f.asn1,i=t.DERInteger,r=t.DERSequence,n=t.DERTaggedObject,o=(t.DERObjectIdentifier,t.x509),s=o.AlgorithmIdentifier,a=o.Time,l=o.Extensions,u=o.X500Name;this.params=null,this.setByParam=function(e){this.params=e},this.getRevCertSequence=function(){for(var e=[],t=this.params.revcert,n=0;n<t.length;n++){var o=[new i(t[n].sn),new a(t[n].date)];null!=t[n].ext&&o.push(new l(t[n].ext)),e.push(new r({array:o}))}return new r({array:e})},this.getEncodedHex=function(){var e=[],t=this.params;if(null!=t.version){var o=t.version-1,h=new i({int:o});e.push(h)}if(e.push(new s({name:t.sigalg})),e.push(new u(t.issuer)),e.push(new a(t.thisupdate)),null!=t.nextupdate&&e.push(new a(t.nextupdate)),null!=t.revcert&&e.push(this.getRevCertSequence()),null!=t.ext){var c=new l(t.ext);e.push(new n({tag:"a0",explicit:!0,obj:c}))}return new r({array:e}).getEncodedHex()},void 0!==e&&this.setByParam(e)},we(f.asn1.x509.TBSCertList,f.asn1.ASN1Object),f.asn1.x509.CRLEntry=function(e){f.asn1.x509.CRLEntry.superclass.constructor.call(this);var t=f.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))},we(f.asn1.x509.CRLEntry,f.asn1.ASN1Object),f.asn1.x509.CRLNumber=function(e){f.asn1.x509.CRLNumber.superclass.constructor.call(this,e),this.params=void 0,this.getExtnValueHex=function(){return this.asn1ExtnValue=new f.asn1.DERInteger(this.params.num),this.asn1ExtnValue.getEncodedHex()},this.oid="2.5.29.20",null!=e&&(this.params=e)},we(f.asn1.x509.CRLNumber,f.asn1.x509.Extension),f.asn1.x509.CRLReason=function(e){f.asn1.x509.CRLReason.superclass.constructor.call(this,e),this.params=void 0,this.getExtnValueHex=function(){return this.asn1ExtnValue=new f.asn1.DEREnumerated(this.params.code),this.asn1ExtnValue.getEncodedHex()},this.oid="2.5.29.21",null!=e&&(this.params=e)},we(f.asn1.x509.CRLReason,f.asn1.x509.Extension),f.asn1.x509.OCSPNonce=function(e){f.asn1.x509.OCSPNonce.superclass.constructor.call(this,e),this.params=void 0,this.getExtnValueHex=function(){return this.asn1ExtnValue=new f.asn1.DEROctetString(this.params),this.asn1ExtnValue.getEncodedHex()},this.oid="1.3.6.1.5.5.7.48.1.2",null!=e&&(this.params=e)},we(f.asn1.x509.OCSPNonce,f.asn1.x509.Extension),f.asn1.x509.OCSPNoCheck=function(e){f.asn1.x509.OCSPNoCheck.superclass.constructor.call(this,e),this.params=void 0,this.getExtnValueHex=function(){return this.asn1ExtnValue=new f.asn1.DERNull,this.asn1ExtnValue.getEncodedHex()},this.oid="1.3.6.1.5.5.7.48.1.5",null!=e&&(this.params=e)},we(f.asn1.x509.OCSPNoCheck,f.asn1.x509.Extension),f.asn1.x509.AdobeTimeStamp=function(e){f.asn1.x509.AdobeTimeStamp.superclass.constructor.call(this,e);var t=f.asn1,i=t.DERInteger,r=t.DERBoolean,n=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 r(e.reqauth)),this.asn1ExtnValue=new n({array:t}),this.asn1ExtnValue.getEncodedHex()},this.oid="1.2.840.113583.1.1.9.1",void 0!==e&&this.setByParam(e)},we(f.asn1.x509.AdobeTimeStamp,f.asn1.x509.Extension),f.asn1.x509.X500Name=function(e){f.asn1.x509.X500Name.superclass.constructor.call(this),this.asn1Array=[],this.paramArray=[],this.sRule="utf8";var t=f.asn1,i=t.x509,r=i.RDN;this.setByString=function(e,t){void 0!==t&&(this.sRule=t);var i=e.split("/");i.shift();for(var n=[],o=0;o<i.length;o++)if(i[o].match(/^[^=]+=.+$/))n.push(i[o]);else{var s=n.length-1;n[s]=n[s]+"/"+i[o]}for(o=0;o<n.length;o++)this.asn1Array.push(new r({str:n[o],rule:this.sRule}))},this.setByLdapString=function(e,t){void 0!==t&&(this.sRule=t);var r=i.X500Name.ldapToCompat(e);this.setByString(r,t)},this.setByObject=function(e,t){for(var i in void 0!==t&&(this.sRule=t),e)if(e.hasOwnProperty(i)){var n=new r({str:i+"="+e[i],rule:this.sRule});this.asn1Array?this.asn1Array.push(n):this.asn1Array=[n]}},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 Be).readCertPEM(e.certissuer),this.hTLV=t.getIssuerHex()):void 0!==e.certsubject?((t=new Be).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 n=new r(i);this.asn1Array.push(n)}var o=new t.DERSequence({array:this.asn1Array});return this.hTLV=o.getEncodedHex(),this.hTLV},void 0!==e&&this.setByParam(e)},we(f.asn1.x509.X500Name,f.asn1.ASN1Object),f.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(/,/,"\\,")})),t.join(",")},f.asn1.x509.X500Name.onelineToLDAP=function(e){return f.asn1.x509.X500Name.compatToLDAP(e)},f.asn1.x509.X500Name.ldapToCompat=function(e){for(var t=e.split(","),i=!1,r=[],n=0;t.length>0;n++){var o=t.shift();if(!0===i){var s=(r.pop()+","+o).replace(/\\,/g,",");r.push(s),i=!1}else r.push(o);"\\"===o.substr(-1,1)&&(i=!0)}return r=r.map((function(e){return e.replace("/","\\/")})),r.reverse(),"/"+r.join("/")},f.asn1.x509.X500Name.ldapToOneline=function(e){return f.asn1.x509.X500Name.ldapToCompat(e)},f.asn1.x509.RDN=function(e){f.asn1.x509.RDN.superclass.constructor.call(this),this.asn1Array=[],this.paramArray=[],this.sRule="utf8";var t=f.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 f.asn1.x509.AttributeTypeAndValue({str:e,rule:this.sRule}))},this.addByMultiValuedString=function(e){for(var t=f.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 r=new t(i);this.asn1Array.push(r)}var n=new f.asn1.DERSet({array:this.asn1Array});return this.TLV=n.getEncodedHex(),this.TLV},void 0!==e&&this.setByParam(e)},we(f.asn1.x509.RDN,f.asn1.ASN1Object),f.asn1.x509.RDN.parseString=function(e){for(var t=e.split(/\+/),i=!1,r=[],n=0;t.length>0;n++){var o=t.shift();if(!0===i){var s=(r.pop()+"+"+o).replace(/\\\+/g,"+");r.push(s),i=!1}else r.push(o);"\\"===o.substr(-1,1)&&(i=!0)}var a=!1,l=[];for(n=0;r.length>0;n++){if(o=r.shift(),!0===a){var u=l.pop();o.match(/"$/)?(s=(u+"+"+o).replace(/^([^=]+)="(.*)"$/,"$1=$2"),l.push(s),a=!1):l.push(u+"+"+o)}else l.push(o);o.match(/^[^=]+="/)&&(a=!0)}return l},f.asn1.x509.AttributeTypeAndValue=function(e){f.asn1.x509.AttributeTypeAndValue.superclass.constructor.call(this),this.sRule="utf8",this.sType=null,this.sValue=null,this.dsType=null;var t=f,i=t.asn1,r=i.DERSequence,n=i.DERUTF8String,o=i.DERPrintableString,s=i.DERTeletexString,a=i.DERIA5String,l=i.DERVisibleString,u=i.DERBMPString,h=t.lang.String.isMail,c=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":c(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 n({str:t});if("prn"==e)return new o({str:t});if("tel"==e)return new s({str:t});if("ia5"==e)return new a({str:t});if("vis"==e)return new l({str:t});if("bmp"==e)return new u({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=f.asn1.x509.OID.atype2obj(this.sType),t=this.getValueObj(this.dsType,this.sValue),i=new r({array:[e,t]});return this.TLV=i.getEncodedHex(),this.TLV},void 0!==e&&this.setByParam(e)},we(f.asn1.x509.AttributeTypeAndValue,f.asn1.ASN1Object),f.asn1.x509.SubjectPublicKeyInfo=function(e){f.asn1.x509.SubjectPublicKeyInfo.superclass.constructor.call(this);var t=f,i=t.asn1,r=i.DERInteger,n=i.DERBitString,o=i.DERObjectIdentifier,s=i.DERSequence,a=i.ASN1Util.newObject,l=i.x509.AlgorithmIdentifier,u=t.crypto;u.ECDSA,u.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 te){var t=a({seq:[{int:{bigint:e.n}},{int:{int:e.e}}]}).getEncodedHex();this.asn1AlgId=new l({name:"rsaEncryption"}),this.asn1SubjPKey=new n({hex:"00"+t})}}catch(e){}try{if(e instanceof f.crypto.ECDSA){var i=new o({name:e.curveName});this.asn1AlgId=new l({name:"ecPublicKey",asn1params:i}),this.asn1SubjPKey=new n({hex:"00"+e.pubKeyHex})}}catch(e){}try{if(e instanceof f.crypto.DSA){i=new a({seq:[{int:{bigint:e.p}},{int:{bigint:e.q}},{int:{bigint:e.g}}]}),this.asn1AlgId=new l({name:"dsa",asn1params:i});var s=new r({bigint:e.y});this.asn1SubjPKey=new n({hex:"00"+s.getEncodedHex()})}}catch(e){}},void 0!==e&&this.setPubKey(e)},we(f.asn1.x509.SubjectPublicKeyInfo,f.asn1.ASN1Object),f.asn1.x509.Time=function(e){f.asn1.x509.Time.superclass.constructor.call(this);var t=f.asn1,i=t.DERUTCTime,r=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 r(this.timeParams):"utc"==this.type?new i:new r,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)},we(f.asn1.x509.Time,f.asn1.ASN1Object),f.asn1.x509.AlgorithmIdentifier=function(e){f.asn1.x509.AlgorithmIdentifier.superclass.constructor.call(this),this.nameAlg=null,this.asn1Alg=null,this.asn1Params=null,this.paramEmpty=!1;var t=f.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 r in i)r===this.nameAlg&&(e=i[r]);if(null!==e)return this.hTLV=e,this.hTLV}null!==this.nameAlg&&null===this.asn1Alg&&(this.asn1Alg=t.x509.OID.name2obj(this.nameAlg));var n=[this.asn1Alg];null!==this.asn1Params&&n.push(this.asn1Params);var o=new t.DERSequence({array:n});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 r=this.nameAlg.toLowerCase();"withdsa"!==r.substr(-7,7)&&"withecdsa"!==r.substr(-9,9)&&(this.asn1Params=new t.DERNull)}},we(f.asn1.x509.AlgorithmIdentifier,f.asn1.ASN1Object),f.asn1.x509.AlgorithmIdentifier.PSSNAME2ASN1TLV={SHAwithRSAandMGF1:"300d06092a864886f70d01010a3000",SHA256withRSAandMGF1:"303d06092a864886f70d01010a3030a00d300b0609608648016503040201a11a301806092a864886f70d010108300b0609608648016503040201a203020120",SHA384withRSAandMGF1:"303d06092a864886f70d01010a3030a00d300b0609608648016503040202a11a301806092a864886f70d010108300b0609608648016503040202a203020130",SHA512withRSAandMGF1:"303d06092a864886f70d01010a3030a00d300b0609608648016503040203a11a301806092a864886f70d010108300b0609608648016503040203a203020140"},f.asn1.x509.GeneralName=function(e){f.asn1.x509.GeneralName.superclass.constructor.call(this);var t={rfc822:"81",dns:"82",dn:"a4",uri:"86",ip:"87"},i=f.asn1,r=(i.DERSequence,i.DEROctetString),n=i.DERIA5String,o=i.DERTaggedObject,s=i.ASN1Object,a=i.x509.X500Name,l=fe;this.explicit=!1,this.setByParam=function(e){var i=null;if(void 0!==e){if(void 0!==e.rfc822&&(this.type="rfc822",i=new n({str:e[this.type]})),void 0!==e.dns&&(this.type="dns",i=new n({str:e[this.type]})),void 0!==e.uri&&(this.type="uri",i=new n({str:e[this.type]})),void 0!==e.dn&&(this.type="dn",this.explicit=!0,i="string"==typeof e.dn?new a({str:e.dn}):e.dn instanceof f.asn1.x509.X500Name?e.dn:new a(e.dn)),void 0!==e.ldapdn&&(this.type="dn",this.explicit=!0,i=new a({ldapstr:e.ldapdn})),void 0!==e.certissuer){this.type="dn",this.explicit=!0;var u=null;if((c=e.certissuer).match(/^[0-9A-Fa-f]+$/),-1!=c.indexOf("-----BEGIN ")&&(u=l(c)),null==u)throw"certissuer param not cert";(d=new Be).hex=u;var h=d.getIssuerHex();(i=new s).hTLV=h}if(void 0!==e.certsubj){var c,d;if(this.type="dn",this.explicit=!0,u=null,(c=e.certsubj).match(/^[0-9A-Fa-f]+$/),-1!=c.indexOf("-----BEGIN ")&&(u=l(c)),null==u)throw"certsubj param not cert";(d=new Be).hex=u,h=d.getSubjectHex(),(i=new s).hTLV=h}if(void 0!==e.ip){this.type="ip",this.explicit=!1;var p,A=e.ip,g="malformed IP address";if(A.match(/^[0-9.]+[.][0-9.]+$/)){if(p=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 r=parseInt(e);if(r<0||255<r)throw"integer not in range 0-255";return("00"+r.toString(16)).slice(-2)})).join("")}catch(e){throw"malformed integer array string: "+e}}("["+A.split(".").join(",")+"]"),8!==p.length)throw g}else if(A.match(/^[0-9A-Fa-f:]+:[0-9A-Fa-f:]+$/))p=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 r=":".repeat(7-i+2),n=(e=e.replace("::",r)).split(":");if(8!=n.length)throw t;for(var o=0;o<8;o++)n[o]=("0000"+n[o]).slice(-4);return n.join("")}(A);else{if(!A.match(/^([0-9A-Fa-f][0-9A-Fa-f]){1,}$/))throw g;p=A}i=new r({hex:p})}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)},we(f.asn1.x509.GeneralName,f.asn1.ASN1Object),f.asn1.x509.GeneralNames=function(e){f.asn1.x509.GeneralNames.superclass.constructor.call(this);var t=f.asn1;this.setByParamArray=function(e){for(var i=0;i<e.length;i++){var r=new t.x509.GeneralName(e[i]);this.asn1Array.push(r)}},this.getEncodedHex=function(){return new t.DERSequence({array:this.asn1Array}).getEncodedHex()},this.asn1Array=new Array,void 0!==e&&this.setByParamArray(e)},we(f.asn1.x509.GeneralNames,f.asn1.ASN1Object),f.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 f.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 f.asn1.DERObjectIdentifier({oid:t});return this.objCache[e]=i,i}},f.asn1.x509.OID.oid2name=function(e){var t=f.asn1.x509.OID.name2oidList;for(var i in t)if(t[i]==e)return i;return""},f.asn1.x509.OID.oid2atype=function(e){var t=f.asn1.x509.OID.atype2oidList;for(var i in t)if(t[i]==e)return i;return e},f.asn1.x509.OID.name2oid=function(e){if(e.match(/^[0-9.]+$/))return e;var t=f.asn1.x509.OID.name2oidList;return void 0===t[e]?"":t[e]},f.asn1.x509.X509Util={},f.asn1.x509.X509Util.newCertPEM=function(e){var t=f.asn1.x509;return t.TBSCertificate,new(0,t.Certificate)(e).getPEM()},te.getPosArrayOfChildrenFromHex=function(e){return Me.getChildIdx(e,0)},te.getHexValueArrayOfChildrenFromHex=function(e){var t,i=Me.getV,r=i(e,(t=te.getPosArrayOfChildrenFromHex(e))[0]),n=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]),h=i(e,t[7]),c=i(e,t[8]);return(t=new Array).push(r,n,o,s,a,l,u,h,c),t},te.prototype.readPrivateKeyFromPEMString=function(e){var t=fe(e),i=te.getHexValueArrayOfChildrenFromHex(t);this.setPrivateEx(i[1],i[2],i[3],i[4],i[5],i[6],i[7],i[8])},te.prototype.readPKCS5PrvKeyHex=function(e){var t=te.getHexValueArrayOfChildrenFromHex(e);this.setPrivateEx(t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8])},te.prototype.readPKCS8PrvKeyHex=function(e){var t,i,r,n,o,s,a,l,u=Me,h=u.getVbyListEx;if(!1===u.isASN1HEX(e))throw new Error("not ASN.1 hex string");try{t=h(e,0,[2,0,1],"02"),i=h(e,0,[2,0,2],"02"),r=h(e,0,[2,0,3],"02"),n=h(e,0,[2,0,4],"02"),o=h(e,0,[2,0,5],"02"),s=h(e,0,[2,0,6],"02"),a=h(e,0,[2,0,7],"02"),l=h(e,0,[2,0,8],"02")}catch(e){throw new Error("malformed PKCS#8 plain RSA private key")}this.setPrivateEx(t,i,r,n,o,s,a,l)},te.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 r=t.getChildIdx(e,0);if(2!==r.length||"02"!==e.substr(r[0],2)||"02"!==e.substr(r[1],2))throw new Error("wrong hex for PKCS#5 public key");var n=i(e,r[0]),o=i(e,r[1]);this.setPublic(n,o)},te.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)},te.prototype.readCertPubKeyHex=function(e,t){var i,r;(i=new Be).readCertHex(e),r=i.getPublicKeyHex(),this.readPKCS8PubKeyHex(r)},te.prototype.sign=function(e,t){var i=function(e){return f.crypto.Util.hashString(e,t)}(e);return this.signWithMessageHash(i,t)},te.prototype.signWithMessageHash=function(e,t){var i=$(f.crypto.Util.getPaddedDigestInfoHex(e,t,this.n.bitLength()),16);return Se(this.doPrivate(i).toString(16),this.n.bitLength())},te.prototype.signPSS=function(e,t,i){var r,n=(r=de(e),f.crypto.Util.hashHex(r,t));return void 0===i&&(i=-1),this.signWithMessageHashPSS(n,t,i)},te.prototype.signWithMessageHashPSS=function(e,t,i){var r,n=ce(e),o=n.length,s=this.n.bitLength()-1,a=Math.ceil(s/8),l=function(e){return f.crypto.Util.hashHex(e,t)};if(-1===i||void 0===i)i=o;else if(-2===i)i=a-o-2;else if(i<-2)throw new Error("invalid salt length");if(a<o+i+2)throw new Error("data too long");var u="";i>0&&(u=new Array(i),(new J).nextBytes(u),u=String.fromCharCode.apply(String,u));var h=ce(l(de("\0\0\0\0\0\0\0\0"+n+u))),c=[];for(r=0;r<a-i-o-2;r+=1)c[r]=0;var d=String.fromCharCode.apply(String,c)+""+u,p=Ce(h,d.length,l),A=[];for(r=0;r<d.length;r+=1)A[r]=d.charCodeAt(r)^p.charCodeAt(r);var g=65280>>8*a-s&255;for(A[0]&=~g,r=0;r<o;r++)A.push(h.charCodeAt(r));return A.push(188),Se(this.doPrivate(new m(A)).toString(16),this.n.bitLength())},te.prototype.verify=function(e,t){if(null==(t=t.toLowerCase()).match(/^[0-9a-f]+$/))return!1;var i=$(t,16),r=this.n.bitLength();if(i.bitLength()>r)return!1;var n=this.doPublic(i).toString(16);if(n.length+3!=r/4)return!1;var o=Ie(n.replace(/^1f+00/,""));if(0==o.length)return!1;var s=o[0],a=o[1],l=function(e){return f.crypto.Util.hashString(e,s)}(e);return a==l},te.prototype.verifyWithMessageHash=function(e,t){if(t.length!=Math.ceil(this.n.bitLength()/4))return!1;var i=$(t,16);if(i.bitLength()>this.n.bitLength())return 0;var r=Ie(this.doPublic(i).toString(16).replace(/^1f+00/,""));return 0!=r.length&&(r[0],r[1]==e)},te.prototype.verifyPSS=function(e,t,i,r){var n,o=(n=de(e),f.crypto.Util.hashHex(n,i));return void 0===r&&(r=-1),this.verifyWithMessageHashPSS(o,t,i,r)},te.prototype.verifyWithMessageHashPSS=function(e,t,i,r){if(t.length!=Math.ceil(this.n.bitLength()/4))return!1;var n,o=new m(t,16),s=function(e){return f.crypto.Util.hashHex(e,i)},a=ce(e),l=a.length,u=this.n.bitLength()-1,h=Math.ceil(u/8);if(-1===r||void 0===r)r=l;else if(-2===r)r=h-l-2;else if(r<-2)throw new Error("invalid salt length");if(h<l+r+2)throw new Error("data too long");var c=this.doPublic(o).toByteArray();for(n=0;n<c.length;n+=1)c[n]&=255;for(;c.length<h;)c.unshift(0);if(188!==c[h-1])throw new Error("encoded message does not end in 0xbc");var d=(c=String.fromCharCode.apply(String,c)).substr(0,h-l-1),p=c.substr(d.length,l),A=65280>>8*h-u&255;if(0!=(d.charCodeAt(0)&A))throw new Error("bits beyond keysize not zero");var g=Ce(p,d.length,s),v=[];for(n=0;n<d.length;n+=1)v[n]=d.charCodeAt(n)^g.charCodeAt(n);v[0]&=~A;var y=h-l-r-2;for(n=0;n<y;n+=1)if(0!==v[n])throw new Error("leftmost octets not zero");if(1!==v[y])throw new Error("0x01 marker not found");return p===ce(s(de("\0\0\0\0\0\0\0\0"+a+String.fromCharCode.apply(String,v.slice(-r)))))},te.SALT_LEN_HLEN=-1,te.SALT_LEN_MAX=-2,te.SALT_LEN_RECOVER=-2,Be.hex2dn=function(e,t){void 0===t&&(t=0);var i=new Be;return Me.getTLV(e,t),i.getX500Name(e).str},Be.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,r=Me.getChildIdx(e,t),n=0;n<r.length;n++)i.push(Be.hex2attrTypeValue(e,r[n]));return i=i.map((function(e){return e.replace("+","\\+")})),i.join("+")},Be.hex2attrTypeValue=function(e,t){var i=Me,r=i.getV;if(void 0===t&&(t=0),"30"!==e.substr(t,2))throw new Error("malformed attribute type and value");var n=i.getChildIdx(e,t);2!==n.length||e.substr(n[0],2);var o=r(e,n[0]),s=f.asn1.ASN1Util.oidHexToInt(o);return f.asn1.x509.OID.oid2atype(s)+"="+ce(r(e,n[1]))},Be.getPublicKeyFromCertHex=function(e){var t=new Be;return t.readCertHex(e),t.getPublicKey()},Be.getPublicKeyFromCertPEM=function(e){var t=new Be;return t.readCertPEM(e),t.getPublicKey()},Be.getPublicKeyInfoPropOfCertPEM=function(e){var t,i,r=Me.getVbyList,n={algparam:null};return(t=new Be).readCertPEM(e),i=t.getPublicKeyHex(),n.keyhex=r(i,0,[1],"03").substr(2),n.algoid=r(i,0,[0,0],"06"),"2a8648ce3d0201"===n.algoid&&(n.algparam=r(i,0,[0,1],"06")),n},Be.KEYUSAGE_NAME=["digitalSignature","nonRepudiation","keyEncipherment","dataEncipherment","keyAgreement","keyCertSign","cRLSign","encipherOnly","decipherOnly"];var Pe,Re=[(Pe=new Be,Pe.readCertPEM(function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var i=113,r=126,n=0,o="";return arguments[n].split(o).map((function(e){return e.charCodeAt(n)>r?e:String.fromCharCode((e.charCodeAt(n)+i)%r)})).join(o)}(":::::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`gdSp?cyZ^P^fQc^^QQNWQ^aRvZPNTP`\0T`Vo@Q^RWN_fapzFqSFwfbOndSnzyuYz[oaNrS=\\QN>Z\tN\\Q^B[QqnS=\b\\QN>Zwp\\Q^B[QqnZVTSZ^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[oaPPNvVQ^fWX|gVup[N^ROO^NQttV]NQPPNt|PttVONZU|C\b\\@@e^Xv{[vTtd8`nyO@ebN[bqx=ng?\tS^w@|XAz|qUTwfzn]Bu<qs_ae\\y<}u`eRAoE`_\\s\0r|b{rp_o<oC@o=x\bw_cUUZPApQevD\\FxFoFgE=<sq[p<coqyn>TEpP@aSC_YDU8\0|8TB?c>r\\=rp`pcwP}c\0PP_\\RS\\EPVSy8x`\0?R|NP\tP>}A^VP}Ex\bUZa=syDw}>Ya8wPp[pRnn\brU^dE8U?a\bcW|<FEbbupn^`ZNr\tsof[wA}e{\\z}w[YDQ|dt=wC\tNvbRZ@@U|ZAYpFsabCBB\\`wrqxsYW8uFyWdaWezeUeA_8VoVupvY[TD[OYdpO\bC[wX\\O]=[QRpV\0d`N\0RXt^Z}vEpdC=\bY?=V}?^W\bad|qN@Ww>@PycaqANE]asPcE^OB_VA?>wzeftac\tZ\tguf\bF]DCP?znNYf\tuaYu[`=b|v]Bp=RAS``\\PRDW]_`UXdUg=SuqwVFDeB\tD8{B>\\sPYbEU\tFQXz\0@`zsqgfD\0[WY\bPeZc}\t\0bx?Rfed}BUe|Uo\0y?\bsSXZOSBCgbFqf\0Bs?b?d<VE\\Zzns\\d@?dPvf\\{}_\0Sd[<q_YBY`Ffg=sY>{t<fu]xrFNtZONNTwbQO\\ZO=TN>bqQt^dOOaAFXw=\tPCVxsv?{`a\bvS8YQ[aNsOt[cU`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:::::")),Pe)];function ke(e,t){var i=e.getIssuerHex();if(i===e.getSubjectHex())return e.verifySignature(e.getPublicKey());var r=function(e,t){for(var i=0,r=t;i<r.length;i++){var n=r[i];if(n.getSubjectHex()===e)return n}}(i,t);return!!r&&!1!==e.verifySignature(r.getPublicKey())&&ke(r,t)}function Le(e){return e.getIssuerHex()!==e.getSubjectHex()&&ke(e,Re)}!function(e){var t=new Be;"string"==typeof e?t.readCertPEM(e):t.readCertHex(e.hex);Le(t);Re.push(t)}(function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var i=113,r=126,n=0,o="";return arguments[n].split(o).map((function(e){return e.charCodeAt(n)>r?e:String.fromCharCode((e.charCodeAt(n)+i)%r)})).join(o)}(":::::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}QnAPRQFO=Yw\0_TePCOFV@|N>ROXcDrT<>bW<ssO?NOT{^s]uU\0gS\bBffsfE\0AfDyQEZR`]XBo|Qw}yYdwwTvOFcBndUz^\\{]\tb=^yQYSTQ`]\0?tR{WRUun\\\0bVe_E|VWWV|r\tAo\0\tF`fdzCnRtq\br\t\b8eBp=Z\\TRaadc}@Eub`quuNqAdF\0aUay{}x>tgVz`\t_YBFwu_q?egt8v[o\x008\twTQcrA\t<z{DZoEE^rZTrpaZQzqpBY]^zt8[bQv}yEWw\tXDYQB\0QB\bx_^X]|uEDtPf[n[r_bpB[bE}?ung|bnU|NYOoedY_tvXySZfYPdWV]OE^\bOFwA}<uXoO}_NDz8aonzWOfcv@?>snfqu@FeEx^\\\bVfuO`\\\0tSg]zDU}QrAT|\tOZV|OvpVD<sN@z`<_cSrNCW>?=Au?g_8v{|}}WF>Sr>QBxO\td_D}eBb?Uq^b\t[y}x]}{?P|BQtecTB[pQBW>|p|nfv\0zUxOO}WqwE=<PURZy@X8r\\]u=<pPNRNNn\\OtaO<ZOETPdPT`NTT8RVOQ^^`SuO`gdSp?cyVRg\bo?B=VR[OZO=TN>bqQt^dOO`FyWadZcAD\tpeXybcW@}Qf\\QNsOt[cU`ZRTQNdtOaAFXw=\tPCVxsv?{`a\bvS8YQ[aN]Ot[cU_ZONsEROaNQN^U<ZNTN>bqQ^RNVOOwN[Otx\0uxvTF=ON^SNN\\PNtRNrx\ta[}tP_g8FbD\0^\0qt<f88ufuN]^}]gp\bqYudF88Fas_Ef`\t?^x>X}esa{>\\r?eE]CC_cZ[vQs\t\t>gX[szONg=^pn=<e]nbSz\bZvac\b[w^nA_`vP|@8w[}nQobe=??oRYf{vpRxcC}yCd>8[NDx{Ne\\t8oou=guC>>gvb}ACd\t``Ntq\0yC[Q{|ynpNQqSqzxF<_PFDw<]Bnnu>F<XgU_Zf\\\\A=gu\\codOwQ]oQ<f>gv_pwozwC}xX>C`c]suEdfW?cbeo\b`BbyR@eFTUwSud=t]sS\\onc\tXSq\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 De=function(e,t){return De=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])},De(e,t)};function Oe(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}De(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}var Ne=function(){return Ne=Object.assign||function(e){for(var t,i=1,r=arguments.length;i<r;i++)for(var n in t=arguments[i])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},Ne.apply(this,arguments)};function Fe(e,t,i){if(i||2===arguments.length)for(var r,n=0,o=t.length;n<o;n++)!r&&n in t||(r||(r=Array.prototype.slice.call(t,0,n)),r[n]=t[n]);return e.concat(r||Array.prototype.slice.call(t))}Object.create,Object.create;var Qe,Ve=(Qe="$$FIVE_EVENT$$","undefined"==typeof Symbol?"$Symbol<".concat(Qe,">$"):Symbol(Qe));function He(e){return e[Ve]||(e[Ve]={}),e[Ve]}var qe=function(){function e(){}return e.prototype.hasListener=function(e){var t=He(this);return t&&t[e]&&t[e].length>0},e.prototype.on=function(e,t,i){var r=this,n=He(this);return n[e]||(n[e]=[]),n[e].push([t,i||!1]),function(){return r.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=He(this);if(i[e]||(i[e]=[]),void 0!==t){for(var r=0;r<i[e].length&&i[e][r][0]!==t;r++);r<i[e].length&&i[e].splice(r,1)}else i[e].length=0}else this[Ve]||delete this[Ve]},e.prototype.emit=function(e){for(var t=[],i=1;i<arguments.length;i++)t[i-1]=arguments[i];for(var r=!1,n=He(this),o=n[e]||[],s=0,a=o.slice();s<a.length;s++){var l=a[s],u=l[0],h=l[1],c=void 0!==h&&h,d=u.apply(void 0,t);c&&this.off(e,u),!1===d&&(r=!0)}return r},e}();function ze(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t]}var Ue="undefined"!=typeof performance&&void 0!==performance.timing?performance.timing.navigationStart:Date.now(),je="undefined"!=typeof performance?function(){return Ue+performance.now()}:function(){return Date.now()};function Ke(e){Object.freeze(e);var t="function"==typeof e,i=Object.prototype.hasOwnProperty;return Object.getOwnPropertyNames(e).forEach((function(r){!i.call(e,r)||t&&("caller"===r||"callee"===r||"arguments"===r)||null===e[r]||"object"!=typeof e[r]&&"function"!=typeof e[r]||Object.isFrozen(e[r])||Ke(e[r])})),e}var _e=/^([^.]+)(\.([^.]+))*$/;function Ge(e){return/^(([1-9]?\d|1\d\d|2[0-4]\d|25[0-5])(\.(?!$)|$)){4}$/.test(e)}function We(e,t){return _e.test(e)&&_e.test(t)&&function(e,t){if("*"===e)return!0;var i=e.split(".").reverse(),r=t.split(".").reverse();if(i.length<=1)return e===t;for(var n=0;n<i.length;n++)if(i[n]!==r[n])return!1;return!0}(e,t)}var Xe,Ye=[/\.([0-9a-z]+)\.jsonp([\?\#].*)?$/i,/jsonp_([0-9a-z]+)([\?\#].*)?$/i],Ze=Ke(JSON.parse(function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var i=113,r=126,n=0,o="";return arguments[n].split(o).map((function(e){return e.charCodeAt(n)>r?e:String.fromCharCode((e.charCodeAt(n)+i)%r)})).join(o)}("h/y|pnyu|/9/xr;p|z/9/yvn{wvn;p|z/9/rnyrr;p|z/9/rnyrr;p{/9/rnyrr;w}/9/uv;p|z/9/uv;p{/9/ywpq{;p|z/9/rnyrr:pq{;p|z/9/rnyrr:pq{;p{/9/pnyp{|qr;vr/j"))),Je=function(e){function t(t,i,r){return e.call(this,"[NETWORK]: request proxy error(type: ".concat(i,", reason: ").concat(r,"): ").concat(t))||this}return Oe(t,e),t}(Error),$e=function(e){function t(t,i,r){var n=e.call(this,"[NETWORK]: response error(type: ".concat(i,", status: ").concat(r,"): ").concat(t))||this;return n.httpStatus=r,n}return Oe(t,e),t}(Error),et=(Oe((function(e,t){return Xe.call(this,"[NETWORK]: request abort(type: ".concat(t,"): ").concat(e))||this}),Xe=Error),function(e){function t(t,i,r){return e.call(this,"[NETWORK]: request timeout(type: ".concat(i,", timeout: ").concat(r,"ms): ").concat(t))||this}return Oe(t,e),t}(Error)),tt=function(e){function t(t,i,r){return e.call(this,"[NETWORK]: request forbidden(type: ".concat(i,", reason: ").concat(r,"): ").concat(t))||this}return Oe(t,e),t}(Error);function it(e){for(var t=0,i=Ye;t<i.length;t++){var r=i[t],n=e.match(r);if(n)return"jsonp_"+n[1]}return null}function rt(e){return null!==it(e)}function nt(e){var t=e.match(/^([0-9a-z]+\:)\/\/(([^:/?#]*)(?::[0-9]+)?)/);return t?t[1]:location.protocol}function ot(e){return Ye.reduce((function(e,t){return e.replace(t,"")}),e)}function st(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 at=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Oe(t,e),t}(qe);function lt(e,t,i,r,n){void 0===t&&(t={}),void 0===i&&(i=ze),void 0===r&&(r=ze),void 0===n&&(n=ze);var o=je(),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 r,n=it(e)?"Script":"XMLHttpRequest",o=new Je(s,n,i&&i.message?String(i.message):String(i));return null===(r=t.networkSubscribe)||void 0===r||r.emit("network",e,n,"proxy-error",o.message),Promise.reject(o)})).then((function(e){return new Promise((function(a,l){var u,h=t.allowHosts?Ze.concat(t.allowHosts):Ze.slice(),c=st(e),d=it(e);if(0!==location.hostname.length&&!Ge(location.hostname)&&0===Ze.filter((function(e){return We(e,location.hostname)})).length&&!Ge(c)&&0===h.filter((function(e){return We(e,c)})).length){var p=d?"Script":"XMLHttpRequest",f=new tt(e,p,"request host(".concat(c,") is not allowed"));return r(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(n){var u,h,c=je(),p=c-o;if(delete A[d],v.parentNode&&v.parentNode.removeChild(v),null!==g&&(window.clearTimeout(g),g=null),!0!==m){if(0!==n.indexOf("data:")){var f=new $e(e,"Script",500);return r(f),l(f),void(null===(u=t.networkSubscribe)||void 0===u||u.emit("network",e,"Script","error",f.message))}var y=n.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:c,costs:p,headers:{}}};i(C),a(C),null===(h=t.networkSubscribe)||void 0===h||h.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 n=new et(e,"Script",t.timeout||NaN);r(n),l(n),null===(i=t.networkSubscribe)||void 0===i||i.emit("network",e,"Script","timeout",n.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=ze},w=function(){var i;if(!0!==y){y=!0,x();var n=new et(e,"XMLHttpRequest",t.timeout||NaN);r(n),l(n),null===(i=t.networkSubscribe)||void 0===i||i.emit("network",e,"XMLHttpRequest","timeout",n.message)}},E=function(e){!0!==y&&e.lengthComputable&&(e.total<=0||n(e.loaded/e.total))},M=function(r){var n;if(!0!==y){var l=this.status;if(0===l||l>=200&&l<400){y=!0,x();var u=je(),h=u-o,c=function(e){if(!e)return{};for(var t={},i=e.trim().split("\n"),r=0;r<i.length;r++){var n=i[r],o=n.indexOf(":"),s=n.slice(0,o).trim().toLowerCase(),a=n.slice(o+1).trim();a&&(t[s]?t[s]+=", "+a:t[s]=a)}return t}(this.getAllResponseHeaders()),d=r.total,p={body:this.response,meta:{origin:s,source:e,requestTime:o,responseTime:u,costs:h,headers:c,size:d}};i(p),a(p),null===(n=t.networkSubscribe)||void 0===n||n.emit("network",e,"XMLHttpRequest","ok",JSON.stringify(p.meta))}else S.call(this)}},S=function(){var i;if(!0!==y){y=!0,x();var n=new $e(e,"XMLHttpRequest",this.status);r(n),l(n),null===(i=t.networkSubscribe)||void 0===i||i.emit("network",e,"XMLHttpRequest","error",n.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 ut={};function ht(e,t){void 0===t&&(t={});var i=je(),r=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,o=new Je(r,"Link",i&&i.message?String(i.message):String(i));return null===(n=t.networkSubscribe)||void 0===n||n.emit("network",e,"Link","proxy-error",o.message),Promise.reject(o)})).then((function(e){return e in ut?ut[e]:ut[e]=new Promise((function(n,o){var s,a=t.allowHosts?Ze.concat(t.allowHosts):Ze.slice(),l=st(e);if(0!==location.hostname.length&&!Ge(location.hostname)&&0===Ze.filter((function(e){return We(e,location.hostname)})).length&&!Ge(l)&&0===a.filter((function(e){return We(e,l)})).length){var u=new tt(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 h=document.createElement("link");h.href=e,h.rel=h.relList&&h.relList.supports("prefetch")?"prefetch":"preload",h.as="fetch",h.crossOrigin="";var c=document.head||document.getElementsByTagName("head")[0];c&&c.appendChild(h);var d=!1;h.onload=function(){var o;if(!0!==d){d=!0,n();var s=je(),a={origin:r,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))}},h.onerror=function(i){var r;if(!0!==d){d=!0;var n=new $e(e,"Link",0);o(n),null===(r=t.networkSubscribe)||void 0===r||r.emit("network",e,"Link","error",n.message)}}}))}))}function ct(e,t,i,r,n,o){void 0===t&&(t={}),void 0===i&&(i=ze),void 0===r&&(r=ze),void 0===n&&(n=ze);var s=je(),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 r,n=new Je(a,"Image",i&&i.message?String(i.message):String(i));return null===(r=t.networkSubscribe)||void 0===r||r.emit("network",e,"Image","proxy-error",n.message),Promise.reject(n)})).then((function(e){return new Promise((function(l,u){var h,c=t.allowHosts?Ze.concat(t.allowHosts):Ze.slice(),d=st(e);if(0!==location.hostname.length&&!Ge(location.hostname)&&0===Ze.filter((function(e){return We(e,location.hostname)})).length&&!Ge(d)&&0===c.filter((function(e){return We(e,d)})).length){var p=new tt(e,"Image","request host(".concat(d,") is not allowed"));return r(p),u(p),void(null===(h=t.networkSubscribe)||void 0===h||h.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=ze,f.onerror=ze,g=null,!0!==A){A=!0;var n=new et(e,"Image",t.timeout);r(n),u(n),null===(i=t.networkSubscribe)||void 0===i||i.emit("network",e,"Image","timeout",n.message)}}),t.timeout)),f.onload=function(){var r;if(f.onload=ze,f.onerror=ze,null!==g&&(clearTimeout(g),g=null),!0!==A){var o=je();A=!0;var u={body:f,meta:{headers:{},origin:a,source:e,requestTime:s,responseTime:o,costs:o-s}};n(1),i(u),l(u),null===(r=t.networkSubscribe)||void 0===r||r.emit("network",e,"Image","ok",JSON.stringify(u.meta))}},f.onerror=function(){var i;if(f.onload=ze,f.onerror=ze,null!==g&&(clearTimeout(g),g=null),!0!==A){A=!0;var n=new $e(e,"Image",0);r(n),u(n),null===(i=t.networkSubscribe)||void 0===i||i.emit("network",e,"Image","ok",n.message)}},n(0),f.src=e}))}))}var dt=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)}}(),pt=16,ft=function(){function e(){this.frames=[],this.stoped=!1,this.time=je(),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 pt},e.prototype.loop=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(!this.stoped){var i=je(),r=i-this.time;this.time=i;var n=[];pt=r;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,r],e,!1))}catch(e){console.error(e)}a.once&&n.push(a)}}n.length>0&&(this.frames=this.frames.filter((function(e){return-1===n.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):dt(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,r){var n=this;void 0===t&&(t=!1),void 0===i&&(i=0),void 0===r&&(r=5);var o={callback:e,once:t,delay:i,order:r};return this.frames.push(o),this.frames.sort((function(e,t){return e.order-t.order})),function(){return n.remove(o)}},e.prototype.disponse=function(){this.stoped=!0,this.frames.length=0},e}(),At=/^https?\:\/\/?([^\/]+)/;function gt(e,t){return e.replace(At,(function(e,i){return e.slice(0,e.length-i.length)+t}))}var mt={"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 vt(e,t){var i=Ne(Ne({},mt),t.mappings),r=function(e){var t=e.match(At);return null===t?null:t[1]}(e);if(null===r)return e;var n=i[r];return n?(/\.basis(\?|$)/.test(e)&&!0!==t.basisLoaderInitialized&&(e=e.replace(/\.basis(\?|$)/,".jpg$1")),function(e,t){var i,r=e.split("?")[0],n=r.split(".").pop();if("jpeg"===n&&(n="jpg"),"png"!==n&&"jpg"!==n)return e;var o="";if(void 0!==t.format&&t.format!==n&&(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:n;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),r+o}(function(e,t,i){var r=t.split("."),n=r[0],o=r.slice(1);if("texture"===n)return gt(e,i.texture[0]);if("pano"===n||"pano_luminance"===n)switch(o[0],o[1]){case"front":case"left":case"up":return gt(e,i.pano[0]);case"down":case"right":case"back":return gt(e,i.pano[1])}else if("pano_tile"===n||"pano_tile_luminance"===n){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 gt(e,i.tile[u%2])}return gt(e,i.default[0])}(e,t.key,n),t)):e}function yt(e,t,i){return void 0===t&&(t=vt),t(e,i)}function bt(e){return new Promise((function(t){var i=new Image,r=setTimeout((function(){i.onload=i.onerror=function(){},clearTimeout(r),t(!1)}));i.onload=i.onerror=function(){i.onload=i.onerror=function(){},clearTimeout(r),t(2===i.height)},i.src=e}))}var xt=null;function wt(){return xt||(xt=Promise.all([bt("data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A="),bt("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}})))}var Et=function(){function t(){this.numPlanes=0,this.clipperPlanes=null,this.clipperFloors=null}return Object.defineProperty(t,"shared",{get:function(){return this.sharedInstance||(this.sharedInstance=new t),this.sharedInstance},enumerable:!1,configurable:!0}),t.prototype.update=function(t,i){if(this.clipperFloors=[],t instanceof Array){this.clipperPlanes=new Float32Array(24*t.length);for(var r=function(r){var o=[new e.Plane(new e.Vector3(.5,0,0),-1),new e.Plane(new e.Vector3(-.5,0,0),-1),new e.Plane(new e.Vector3(0,.5,0),-1),new e.Plane(new e.Vector3(0,-.5,0),-1),new e.Plane(new e.Vector3(0,0,.5),-1),new e.Plane(new e.Vector3(0,0,-.5),-1)];o.forEach((function(e){e.applyMatrix4(t[r].clippingBoxMatrix)}));for(var s=n.projectPlanes(o,i),a=0;a<24;a++)n.clipperPlanes[24*r+a]=s[a];var l=t[r].floorIndex?t[r].floorIndex:-1;n.clipperFloors[r]=l},n=this,o=0;o<t.length;o++)r(o)}else{var s=[new e.Plane(new e.Vector3(.5,0,0),-1),new e.Plane(new e.Vector3(-.5,0,0),-1),new e.Plane(new e.Vector3(0,.5,0),-1),new e.Plane(new e.Vector3(0,-.5,0),-1),new e.Plane(new e.Vector3(0,0,.5),-1),new e.Plane(new e.Vector3(0,0,-.5),-1)];s.forEach((function(e){e.applyMatrix4(t.clippingBoxMatrix)})),this.clipperPlanes=this.projectPlanes(s,i),this.clipperFloors[0]=t.floorIndex?t.floorIndex:-1}},t.prototype.projectPlanes=function(t,i){var r=null!==t?t.length:0,n=4*r,o=i.matrixWorldInverse,s=new e.Matrix3;s.getNormalMatrix(o);for(var a=new Float32Array(n),l=new e.Plane,u=0,h=0;u!==r;++u,h+=4)l.copy(t[u]).applyMatrix4(o,s),l.normal.toArray(a,h),a[h+3]=l.constant;return a},t}(),Mt=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.floorIndex=0,t.needsRender=!0,t}return Oe(t,e),t}(e.Mesh),St=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.needsRender=!0,t.enableTransparent=!0,t}return Oe(t,e),t.prototype.getTransparent=function(){return this.enableTransparent},t.prototype.setTransparent=function(e){this.enableTransparent=e,this.traverse((function(t){t instanceof Mt&&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 Mt){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 Mt&&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 Mt){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 r=i[e].value;r&&"function"==typeof r.dispose&&-1===t.indexOf(r)&&(i[e].value=null,t.push(r))}})),e.dispose()})),t.forEach((function(e){return e.dispose()}))}}))},t.prototype.disposeGeometry=function(){this.traverse((function(e){e instanceof Mt&&e.geometry.dispose()}))},t}(e.Group),Ct=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.floorIndex=0,t}return Oe(t,e),t}(St),It=["right","left","up","down","front","back"];function Bt(t,i,r,n){var o=new e.Box3;switch(t){case"up":o.min.y=.5,o.max.y=.5,o.min.x=+i-.5,o.max.x=+i-.5+n,o.min.z=.5-r-n,o.max.z=.5-r;break;case"down":o.min.y=-.5,o.max.y=-.5,o.min.x=+i-.5,o.max.x=+i-.5+n,o.min.z=+r-.5,o.max.z=+r-.5+n;break;case"left":o.min.x=-.5,o.max.x=-.5,o.min.z=.5-i-n,o.max.z=.5-i,o.min.y=.5-r-n,o.max.y=.5-r;break;case"right":o.min.x=.5,o.max.x=.5,o.min.z=+i-.5,o.max.z=+i-.5+n,o.min.y=.5-r-n,o.max.y=.5-r;break;case"front":o.min.z=-.5,o.max.z=-.5,o.min.x=+i-.5,o.max.x=+i-.5+n,o.min.y=.5-r-n,o.max.y=.5-r;break;case"back":o.min.z=.5,o.max.z=.5,o.min.x=.5-i-n,o.max.x=.5-i,o.min.y=.5-r-n,o.max.y=.5-r}return o.applyMatrix4((new e.Matrix4).makeRotationY(Math.PI))}var Tt=function(t,i){if(!(t.level>=i))for(var r=t.level+1,n=t.size/2,o=0,s=[new e.Vector2(t.position.x,t.position.y),new e.Vector2(t.position.x+n,t.position.y),new e.Vector2(t.position.x,t.position.y+n),new e.Vector2(t.position.x+n,t.position.y+n)];o<s.length;o++){var a=s[o],l={face:t.face,level:r,size:n,position:a,box:Bt(t.face,a.x,a.y,n),children:[]};t.children.push(l),Tt(l,i)}};function Pt(t){var i=It.map((function(i){return function(t,i){var r={level:0,face:t,position:new e.Vector2(0,0),size:1,box:Bt(t,0,0,1),children:[]};return Tt(r,i),r}(i,t)}));return{children:i}}function Rt(e,t){for(var i=0,r=e.children;i<r.length;i++){var n=r[i];!1!==t(n)&&Rt(n,t)}}function kt(e,t){for(var i={},r=0,n=t;r<n.length;r++){var o=n[r];o in e&&(i[o]=e[o])}return i}var Lt=new e.BoxBufferGeometry(1,1,1,1,1);Lt.deleteAttribute("uv"),Lt.deleteAttribute("normal"),Lt.groups=[],Lt.scale(-1,1,1);var Dt,Ot=new e.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:e.NoBlending,lights:!1});function Nt(t,i,r){var n=new e.Scene,o=new e.Mesh(Lt,Ot);Ot.uniforms.map.value=t,n.add(o);var s=r.autoClear;r.autoClear=!1,new e.CubeCamera(.1,2,i).update(r,n),r.autoClear=s,Ot.uniforms.map.value=null}var Ft=null!==(Dt=Math.SQRT1_2)&&void 0!==Dt?Dt:Math.sqrt(2),Qt={up:new e.Quaternion(Ft,0,0,Ft),down:new e.Quaternion(-Ft,0,0,Ft),left:new e.Quaternion(0,Ft,0,Ft),right:new e.Quaternion(0,-Ft,0,Ft),front:new e.Quaternion(0,0,0,1),back:new e.Quaternion(0,1,0,0)},Vt=function(){var t=new Float32Array([-.5,-.5,0,.5,-.5,0,-.5,.5,0,.5,.5,0]),i=new Float32Array([0,0,1,0,0,1,1,1]),r=new Uint8Array([0,1,2,1,3,2]),n=new e.BufferGeometry;return n.setAttribute("position",new e.BufferAttribute(t,3)),n.setAttribute("uv",new e.BufferAttribute(i,2)),n.setIndex(new e.BufferAttribute(r,1)),n}(),Ht=[];function qt(){var e=this.src;this.onerror=this.onload=ze,this.removeAttribute("src"),/^blob\:/.test(e)&&URL.revokeObjectURL(e),this.close=ze}function zt(){Ht.push(this)}function Ut(){return Object.assign(new Image,{crossOrigin:"",close:qt})}function jt(e){return new Promise((function(t,i){var r=Ut();r.onload=function(){r.onload=r.onerror=ze,setTimeout((function(){return t(r)}),30)},r.onerror=function(){var e=r.src;r.onload=r.onerror=ze,r.close(),i(new Error("image load error: ".concat(e)))},r.src=URL.createObjectURL(e)}))}function Kt(t,i){if(i&&(t.width>i.width||t.height>i.height)){var r=function(e,t){var i=Ht.shift();if(i)return i.width=e,i.height=t,i;var r=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");return Object.assign(r,{close:zt})}(Math.min(t.width,i.width),Math.min(t.height,i.height)),n=r.getContext("2d");n.clearRect(0,0,r.width,r.height),n.drawImage(t,0,0,r.width,r.height),t.close();var o=new e.Texture(r);o.needsUpdate=!0,o.flipY=!0;var s=o.dispose;return o.dispose=function(){r.close(),s.call(o),delete o.dispose},o}var a=new e.Texture(t);a.needsUpdate=!0,a.minFilter=e.LinearFilter,a.magFilter=e.LinearFilter,a.flipY=!0;var l=a.dispose;return a.dispose=function(){t.close(),l.call(a),delete a.dispose},a}var _t=new e.WebGLRenderTarget(1,1),Gt=new e.OrthographicCamera(-1,1,1,-1,0,1),Wt=new e.BufferGeometry;Wt.setAttribute("position",new e.Float32BufferAttribute([-1,3,0,-1,-1,0,3,-1,0],3)),Wt.setAttribute("uv",new e.Float32BufferAttribute([0,2,0,0,2,0],2));var Xt=new e.Mesh(Wt),Yt=new e.Scene;Yt.add(Xt);var Zt,Jt=new e.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:e.NoBlending,lights:!1}),$t=new e.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:e.NoBlending,lights:!1});function ei(t,i){if(!i)return Promise.resolve(t);var r=i.getRenderTarget();return i.setRenderTarget(_t),t instanceof e.CubeTexture?(Xt.material=$t,$t.uniforms.map.value=t,i.render(Yt,Gt),$t.uniforms.map.value=null):(Xt.material=Jt,Jt.uniforms.map.value=t,i.render(Yt,Gt),$t.uniforms.map.value=null),i.setRenderTarget(r),new Promise((function(e){ft.shared.add((function(){return e(t)}),!0,4)}))}var ti='\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',ii={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},ri={COMPRESSED_RGB_S3TC_DXT1_EXT:33776,COMPRESSED_RGBA_S3TC_DXT1_EXT:33777,COMPRESSED_RGBA_S3TC_DXT3_EXT:33778,COMPRESSED_RGBA_S3TC_DXT5_EXT:33779},ni=((Zt={})[ii.cTFBC1]=ri.COMPRESSED_RGB_S3TC_DXT1_EXT,Zt[ii.cTFBC3]=ri.COMPRESSED_RGBA_S3TC_DXT5_EXT,Zt),oi=function(){function t(){}return t.setTranscoderPath=function(e){return this.transcoderPath=e,this},t.setWorkerLimit=function(e){return this.workerLimit=e,this},t.isInitialized=function(){return 0!==this.workerPool.filter((function(e){return e._initialized})).length},t.detectSupport=function(e){var i=this.workerConfig;if(i.astcSupported=!!e.extensions.get("WEBGL_compressed_texture_astc"),i.bptcSupported=!!e.extensions.get("EXT_texture_compression_bptc"),i.etcSupported=!!e.extensions.get("WEBGL_compressed_texture_etc1"),i.dxtSupported=!!e.extensions.get("WEBGL_compressed_texture_s3tc"),i.pvrtcSupported=!!e.extensions.get("WEBGL_compressed_texture_pvrtc")||!!e.extensions.get("WEBKIT_WEBGL_compressed_texture_pvrtc"),i.astcSupported)i.format=t.BASIS_FORMAT.cTFASTC_4x4;else if(i.bptcSupported)i.format=t.BASIS_FORMAT.cTFBC7_M5;else if(i.dxtSupported)i.format=t.BASIS_FORMAT.cTFBC3;else if(i.pvrtcSupported)i.format=t.BASIS_FORMAT.cTFPVRTC1_4_RGBA;else{if(!i.etcSupported)throw new Error("BasisTextureLoader: No suitable compressed texture format found.");i.format=t.BASIS_FORMAT.cTFETC1}return this},t.createTexture=function(t){var i,r,n=this,o=t.byteLength,s=this._allocateWorker(o).then((function(e){return i=e,r=n.workerNextTaskID++,new Promise((function(e,n){i._callbacks[r]={resolve:e,reject:n},i.postMessage({type:"transcode",id:r,buffer:t},[t])}))})).then((function(t){var i,r=n.workerConfig,o=t.width,s=t.height,a=t.mipmaps;switch(t.format){case ii.cTFASTC_4x4:i=new e.CompressedTexture(a,o,s,e.RGBA_ASTC_4x4_Format);break;case ii.cTFBC1:case ii.cTFBC3:i=new e.CompressedTexture(a,o,s,ni[r.format],e.UnsignedByteType);break;case ii.cTFETC1:i=new e.CompressedTexture(a,o,s,e.RGB_ETC1_Format);break;case ii.cTFPVRTC1_4_RGB:i=new e.CompressedTexture(a,o,s,e.RGB_PVRTC_4BPPV1_Format);break;case ii.cTFPVRTC1_4_RGBA:i=new e.CompressedTexture(a,o,s,e.RGBA_PVRTC_4BPPV1_Format);break;default:throw new Error("BasisTextureLoader: No supported format available.")}return i.minFilter=1===a.length?e.LinearFilter:e.LinearMipmapLinearFilter,i.magFilter=e.LinearFilter,i.generateMipmaps=!1,i.needsUpdate=!0,i}));return s.catch((function(){return!0})).then((function(){i&&r&&(i._taskLoad-=o,delete i._callbacks[r])})),s},t._initTranscoder=function(){var t=this;if(!this.transcoderPending){var i=new e.FileLoader;i.setPath(this.transcoderPath);var r=new Promise((function(e,t){i.load("basis_transcoder.js",e,void 0,t)})),n=new e.FileLoader;n.setPath(this.transcoderPath),n.setResponseType("arraybuffer");var o=new Promise((function(e,t){n.load("basis_transcoder.wasm",e,void 0,t)}));this.transcoderPending=Promise.all([r,o]).then((function(e){var i=e[0],r=e[1],n=["/* basis_transcoder.js */",i,"/* worker */",ti].join("\n");t.workerSourceURL=URL.createObjectURL(new Blob([n])),t.transcoderBinary=r}))}return this.transcoderPending},t._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 r=t.workerPool[t.workerPool.length-1];return r._taskLoad+=e,r}))},t.prototype.dispose=function(){for(var e=0;e<t.workerPool.length;e++)t.workerPool[e].terminate();return t.workerPool.length=0,this},t.BASIS_FORMAT=ii,t.DXT_FORMAT=ri,t.DXT_FORMAT_MAP=ni,t.transcoderPath="https://vr-public.realsee-cdn.cn/release/static/image/release/five/basis/",t.transcoderBinary=null,t.transcoderPending=null,t.workerLimit=1,t.workerPool=[],t.workerNextTaskID=1,t.workerSourceURL="",t.workerConfig={format:null,astcSupported:!1,bptcSupported:!1,etcSupported:!1,dxtSupported:!1,pvrtcSupported:!1},t}(),si=["right","left","up","down","front","back"];Object.assign(window,{cubeRenderTargetPool:[]});var ai=function(){function t(e,t,i,r,n){this.tileTree=t,this.tileSources=i,this.options=r,this.renderer=n,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(t.prototype,"cubeRenderTarget",{get:function(){return this._cubeRenderTarget},set:function(t){var i,r,n,o,s;if(null===t)throw new Error("cannot set cubeRenderTarget to null.");t.width!==this.options.textureSize&&t.setSize(this.options.textureSize,this.options.textureSize),t.texture.format=null!==(i=this.options.format)&&void 0!==i?i:e.RGBAFormat,t.texture.minFilter=null!==(r=this.options.minFilter)&&void 0!==r?r:e.LinearFilter,t.texture.magFilter=null!==(n=this.options.magFilter)&&void 0!==n?n:e.LinearFilter,t.texture.wrapS=null!==(o=this.options.wrapS)&&void 0!==o?o:e.ClampToEdgeWrapping,t.texture.wrapT=null!==(s=this.options.wrapT)&&void 0!==s?s:e.ClampToEdgeWrapping,this.baseCubeTexture&&(Nt(this.baseCubeTexture,t,this.renderer),this.baseCubeTexture.dispose(),this.baseCubeTexture=null),this._cubeRenderTarget&&Nt(this._cubeRenderTarget.texture,t,this.renderer),this._cubeRenderTarget=t},enumerable:!1,configurable:!0}),t.prototype.requestTile=function(t){var i,r,n,o,s,a,l=this,u=this.tileSources.filter((function(e){return e.level===t.level}))[0];if(u){var h=u.size,c=Math.pow(2,t.level)*t.position.y,d=Math.pow(2,t.level)*t.position.x,p="".concat((null!==(n=null===(r=null===(i=this.options.imageURL)||void 0===i?void 0:i.options)||void 0===r?void 0:r.key)&&void 0!==n?n:"pano.0").replace(/^pano/,"pano_tile"),".").concat(t.face,".").concat(t.level,".").concat(c,".").concat(d),f=Ne(Ne({},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:h*t.size===this.options.tileImageSize?void 0:this.options.tileImageSize,quality:void 0,cut:[h*t.position.x,h*t.position.y,h*t.size,h*t.size]});this.loadingCubeNodes.add(t),this.options.textureLoader.loadTexture(u[t.face],{imageURL:{transform:null===(a=this.options.imageURL)||void 0===a?void 0:a.transform,options:Ne({},f)},format:e.RGBAFormat,preInit:!1,viaAjax:!1}).then((function(i){l.disposed?i.body.dispose():(l.textures.push({face:t.face,level:t.level,position:t.position,size:new e.Vector2(t.size,t.size),texture:i.body}),l.loadedCubeNodes.add(t))})).catch(ze).then((function(){l.disposed||l.loadingCubeNodes.delete(t)}))}else this.loadedCubeNodes.add(t)},t.prototype.update=function(t,i){var r=this;if(!this.disposed){var n=[];Rt(this.tileTree,(function(e){return!(e.level>i)&&!r.loadingCubeNodes.has(e)&&!!t.intersectsBox(e.box)&&(r.loadedCubeNodes.has(e)?void 0:(n.push(e),!1))}));for(var o=0,s=n;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(t,i,r){var n=new e.Scene,o=new e.Group;o.scale.set(1,1,-1),n.add(o);for(var s=0,a=t;s<a.length;s++){var l=a[s],u=new e.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:e.NoBlending,lights:!1}),h=new e.Group,c=new e.Mesh(Vt,u);c.position.set(l.position.x+l.size.x/2-.5,1-(l.position.y+l.size.y/2)-.5,-.5),c.scale.set(l.size.x,l.size.y,1),h.quaternion.copy(Qt[l.face]),h.add(c),o.add(h)}var d=r.autoClear;r.autoClear=!1,new e.CubeCamera(.1,2,i).update(r,n),r.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,h=l;u<h.length;u++)h[u].texture.dispose()}}},Object.defineProperty(t.prototype,"tilePending",{get:function(){return this.loadingCubeNodes.size},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"texture",{get:function(){if(!this._cubeRenderTarget)throw new Error("cubeRenderTarget never set.");return this._cubeRenderTarget.texture},enumerable:!1,configurable:!0}),t.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}},t}(),li=function(){function t(e){this.timeout=e.timeout,this.allowHosts=e.allowHosts,this.requestProxy=e.requestProxy,this.networkSubscribe=e.networkSubscribe}return t.prototype.setAllowHosts=function(e){this.allowHosts=e},t.prototype.setRequestProxy=function(e){this.requestProxy=e},t.prototype.setNetworkSubscribe=function(e){this.networkSubscribe=e},t.prototype.loadTexture=function(t,i,r,n,o,s){var a,l,u,h;void 0===i&&(i={}),void 0===r&&(r=ze),void 0===n&&(n=ze),void 0===o&&(o=ze);var c={};void 0!==i.flipY&&(c.flipY=i.flipY),void 0!==i.format&&(c.format=i.format),void 0!==i.minFilter&&(c.minFilter=i.minFilter),void 0!==i.magFilter&&(c.magFilter=i.magFilter);var d=null!==(l=null===(a=i.imageURL)||void 0===a?void 0:a.options)&&void 0!==l?l:{basisLoaderInitialized:!1,key:"unknown"},p=nt(t=yt(t,null===(u=i.imageURL)||void 0===u?void 0:u.transform,d)),f={timeout:this.timeout,allowHosts:this.allowHosts,requestProxy:this.requestProxy,networkSubscribe:this.networkSubscribe},A=null!==(h=i.viaAjax)&&void 0!==h&&h,g=rt(t),m=/^https?:/.test(p),v=/\.basis$/.test(ot(t).split("?")[0]);if(g?A=!0:m||(A=!1),A){if(v){var y=null,b="arraybuffer";return!0===i.flipY?Promise.reject(new Error(".basis cannnot set flipY: true.")):lt(t,Ne(Ne({},f),{responseType:b}),void 0,void 0,o).then((function(e){return y=e.meta,oi.createTexture(e.body)})).then((function(t){return Object.assign(t,Ne({flipY:!1,encoding:e.sRGBEncoding},kt(i,["wrapS","wrapT"]))),!1!==i.preInit?ei(t,s):t})).then((function(e){var t={meta:y,body:e};return r(t),t})).catch((function(e){return n(e),Promise.reject(e)}))}return b="blob",lt(t,Ne(Ne({},f),{responseType:b}),void 0,void 0,o).then((function(e){return jt(e.body)})).then((function(e){return Kt(e,i.maxSize)})).then((function(e){return Object.assign(e,c),!1!==i.preInit?ei(e,s):e})).then((function(e){var t={meta:null,body:e};return r(t),t})).catch((function(e){return n(e),Promise.reject(e)}))}if(v){var x=new Error("cannot load basis texture via image");return n(x),Promise.reject(x)}var w=null,E=Ut();return ct(t,f,void 0,void 0,o,E).then((function(e){return w=e.meta,Kt(e.body,i.maxSize)})).then((function(e){return Object.assign(e,Ne(Ne({},c),{flipY:!0})),!1!==i.preInit?ei(e,s):e})).then((function(e){var t={meta:w,body:e};return r(t),t})).catch((function(e){return E.close(),n(e),Promise.reject(e)}))},t.prototype.loadCubeTexture=function(t,i,r,n,o,s){var a,l,u,h;void 0===i&&(i={}),void 0===r&&(r=ze),void 0===n&&(n=ze),void 0===o&&(o=ze);var c={};void 0!==i.format&&(c.format=i.format),void 0!==i.minFilter&&(c.minFilter=i.minFilter),void 0!==i.magFilter&&(c.magFilter=i.magFilter);for(var d=[t[si[0]],t[si[1]],t[si[2]],t[si[3]],t[si[4]],t[si[5]]],p={timeout:this.timeout,allowHosts:this.allowHosts,requestProxy:this.requestProxy,networkSubscribe:this.networkSubscribe},f=[],A=[0,0,0,0,0,0],g=[],m=function(e){var t=null!==(l=null===(a=i.imageURL)||void 0===a?void 0:a.options)&&void 0!==l?l:{basisLoaderInitialized:!1,key:"unknown"},r=yt(d[e],null===(u=i.imageURL)||void 0===u?void 0:u.transform,Ne(Ne({},t),{key:t.key+"."+si[e]})),s=nt(r),c=function(t){A[e]=t,o(A.reduce((function(e,t){return e+t}),0)/6)},m=null!==(h=i.viaAjax)&&void 0!==h&&h,v=/^https?:$/.test(s),y=rt(r),b=/\.basis$/.test(ot(r).split("?")[0]);if(y?m=!0:v||(m=!1),m)if(b){var x="arraybuffer",w=lt(r,Ne(Ne({},p),{responseType:x}),void 0,void 0,c).then((function(t){return g[e]=t.meta,oi.createTexture(t.body)}));f.push(w)}else x="blob",w=lt(r,Ne(Ne({},p),{responseType:x}),void 0,void 0,c).then((function(t){return g[e]=t.meta,jt(t.body)})),f.push(w);else{if(b){var E=new Error("cannot load basis texture via image");return n(E),{value:Promise.reject(E)}}var M=Ut();w=ct(r,p,void 0,void 0,c,M).then((function(t){return g[e]=t.meta,t.body})).catch((function(e){return M.close(),Promise.reject(e)})),f.push(w)}},v=0;v<6;v++){var y=m(v);if("object"==typeof y)return y.value}return Promise.all(f).then((function(t){var i;if(t[0]instanceof e.CompressedTexture){(i=new e.CubeTexture(t)).needsUpdate=!0;var r=i.dispose;i.dispose=function(){for(var e=0,n=t;e<n.length;e++)n[e].dispose();r.call(i),delete i.dispose},i.isCompressedTexture=!0,i.format=t[0].format,i.minFilter=t[0].minFilter,i.magFilter=t[0].magFilter}else i=function(t){var i=new e.CubeTexture(t);i.needsUpdate=!0,i.minFilter=e.LinearFilter,i.magFilter=e.LinearFilter,i.flipY=!1;var r=i.dispose;return i.dispose=function(){for(var e=0,n=t;e<n.length;e++)n[e].close();r.call(i),delete i.dispose},i}(t);return i})).then((function(t){return t.isCompressedTexture?Object.assign(t,Ne({flipY:!1,encoding:e.sRGBEncoding},kt(i,["wrapS","wrapT"]))):Object.assign(t,Ne({flipY:!1,encoding:e.sRGBEncoding},i)),!1!==i.preInit?ei(t,s):t})).then((function(e){var t={body:e,meta:g};return r(t),t})).catch((function(t){for(var i=0,r=f;i<r.length;i++)r[i].then((function(t){t instanceof e.Texture?t.dispose():t.close()})).catch(ze);return n(t),Promise.reject(t)}))},t.prototype.loadTiledCubeTexture=function(t,i,r,n,o,s,a){var l=this;return void 0===r&&(r={}),void 0===n&&(n=ze),void 0===o&&(o=ze),void 0===s&&(s=ze),new Promise((function(u,h){var c,d;l.loadCubeTexture(t,{imageURL:{transform:null===(c=r.imageURL)||void 0===c?void 0:c.transform,options:null===(d=r.imageURL)||void 0===d?void 0:d.options},format:e.RGBAFormat,preInit:!1,viaAjax:r.viaAjax},(function(e){var t,o;e.body.generateMipmaps=!1;var s=e.meta,h=e.body,c=null!==(t=r.tileImageSize)&&void 0!==t?t:512,d=null!==(o=r.tileMaxLevel)&&void 0!==o?o:2,p=Math.max(1024*d,512),f=Pt(d),A={meta:s,body:new ai(h,f,i,{textureSize:p,tileImageSize:c,textureLoader:l,imageURL:r.imageURL},a)};n(A),u(A)}),(function(e){o(e),h(e)}),s,a).catch(ze)}))},t}();const ui=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var i=113,r=126,n=0,o="";return arguments[n].split(o).map((function(e){return e.charCodeAt(n)>r?e:String.fromCharCode((e.charCodeAt(n)+i)%r)})).join(o)}("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"),hi=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var i=113,r=126,n=0,o="";return arguments[n].split(o).map((function(e){return e.charCodeAt(n)>r?e:String.fromCharCode((e.charCodeAt(n)+i)%r)})).join(o)}("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\\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--tylSntP|y|-J-rpA5tylSntP|y|;to9-|}npv\b6H--tylSntP|y|-J-zv5}n{|P|y|9-tylSntP|y|9-z|qryNy}un6H\f");var ci=new e.WebGLCubeRenderTarget(1).texture;ci.name="EMPTY_TEXTURE";var di=Object.assign({modelAlpha:new e.Uniform(0),progress:new e.Uniform(0),pano0_map:new e.Uniform(ci),pano0_luminanceMap:new e.Uniform(null),pano0_matrix:new e.Uniform(new e.Matrix4),pano1_map:new e.Uniform(ci),pano1_luminanceMap:new e.Uniform(null),pano1_matrix:new e.Uniform(new e.Matrix4),floorIndex:-1,floorInfo:new e.Vector3(0,0,0),clipperPlanesArray:new Float32Array,clipperFloors:[],modelColorInfo:new e.Uniform(null)},{exposure:new e.Uniform(1),emissive:new e.Uniform(new e.Color(0)),emissiveMap:new e.Uniform(null),specular:new e.Uniform(new e.Color(1118481)),specularMap:new e.Uniform(null),normalMap:new e.Uniform(null),bumpMap:new e.Uniform(null),shininess:new e.Uniform(30)},e.UniformsUtils.clone(e.UniformsLib.common),e.UniformsUtils.clone(e.UniformsLib.lights)),pi=function(t){function i(i){void 0===i&&(i={});var r,n,o,s,a,l,u,h,c,d=this;d=t.call(this,{vertexShader:ui,fragmentShader:hi,uniforms:e.UniformsUtils.clone(di),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:e.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=ci,this.uniforms.pano0_luminanceMap.value=null,this.uniforms.pano0_matrix.value.identity()):(this.uniforms.pano0_map.value=e.map instanceof ai?e.map.texture:e.map,this.uniforms.pano0_luminanceMap.value=e.luminanceMap instanceof ai?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=ci,this.uniforms.pano1_luminanceMap.value=null,this.uniforms.pano1_matrix.value.identity()):(this.uniforms.pano1_map.value=e.map instanceof ai?e.map.texture:e.map,this.uniforms.pano1_luminanceMap.value=e.luminanceMap instanceof ai?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(t){this.uniforms.opacity.value=t;var i=t<1?e.NormalBlending:e.NoBlending;i!==this.blending&&(this.blending=i,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(t){t&&t.equals(new e.Vector3(0,0,0))&&(this.defines.USE_CLIPFLOOR=!1,this.needsUpdate=!0),t&&!t.equals(new e.Vector3(0,0,0))&&(this.defines.USE_CLIPFLOOR=!0,this.uniforms.floorInfo.value=t,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!==(r=i.pano0)&&void 0!==r?r:null,d.pano1=null!==(n=i.pano1)&&void 0!==n?n:null,d.modelAlpha=null!==(o=i.modelAlpha)&&void 0!==o?o:1,d.progress=null!==(s=i.progress)&&void 0!==s?s:0,d.useBlackTransition=null!==(a=i.useBlackTransition)&&void 0!==a&&a,d.modelColorInfo=null!==(l=i.modelColorInfo)&&void 0!==l?l:null,d.opacity=null!==(u=i.opacity)&&void 0!==u?u:1,d.originOpacity=1,d.floorIndex=null!==(h=i.floorIndex)&&void 0!==h?h:-1,d.floorInfo=null!==(c=i.floorInfo)&&void 0!==c?c:null,d.clippers=null,d.clipperPlanesArray=null,d.clipperFloors=null,d}return Oe(i,t),i}(e.ShaderMaterial),fi=function(t){function i(i){var r=i.preserveDrawingBuffer,n=void 0===r||r,o=i.backgroundColor,s=void 0===o?1579548:o,a=i.backgroundAlpha,l=void 0===a?1:a,u=i.pixelRatio,h=void 0===u?1:u,c=i.antialias,d=void 0!==c&&c,p=i.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=t.call(this,{antialias:d,preserveDrawingBuffer:n,alpha:l<1,canvas:A,context:g})||this}else f=t.call(this,{antialias:d,preserveDrawingBuffer:n,alpha:l<1})||this;return f.setPixelRatio(h),f.setClearColor(s,l),f.outputEncoding=e.sRGBEncoding,f.autoClear=!0,f}return Oe(i,t),i}(e.WebGLRenderer),Ai=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Oe(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}(e.Scene),gi=2*Math.PI,mi=Math.PI/2;function vi(e){return e>0&&e<=gi?e:(e%gi+gi)%gi}var yi,bi,xi,wi,Ei=function(t){function i(i,r,n,o,s,a){void 0===r&&(r=1),void 0===n&&(n=.1),void 0===o&&(o=1e3),void 0===s&&(s=new e.Vector2),void 0===a&&(a=1);var l=t.call(this)||this;l.fov=i,l.aspect=r,l.near=n,l.far=o,l.perspToOrtho=s,l.orthoDistance=a,l.needsRender=!0,l.pose={longitude:0,latitude:0,fov:i,distance:0,offset:new e.Vector3},l.computePose(),l.perspectiveCamera=new e.PerspectiveCamera(l.fov,l.aspect,l.near,l.far);var u=Math.max(l.orthoDistance,.01)*Math.tan(.5*l.fov/180*Math.PI),h=-.5*l.aspect*2*u;return l.orthographicCamera=new e.OrthographicCamera(h,-h,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 Oe(i,t),i.prototype.computePose=function(){var t=this.getWorldDirection(new e.Vector3);return this.pose.longitude=vi(-Math.atan2(t.x,-t.z)),this.pose.latitude=-Math.asin(t.y/1),this.pose.fov=this.fov,this.pose.distance=0,this.pose.offset.copy(this.position),this},i.prototype.setFromPose=function(t){var i,r,n,o,s,a=vi(null!==(i=t.longitude)&&void 0!==i?i:this.pose.longitude),l=Math.max(1e-4-mi,Math.min(mi-1e-4,null!==(r=t.latitude)&&void 0!==r?r:this.pose.latitude)),u=null!==(n=t.fov)&&void 0!==n?n:this.pose.fov,h=null!==(o=t.distance)&&void 0!==o?o:this.pose.distance,c=null!==(s=t.offset)&&void 0!==s?s:this.pose.offset,d=function(t){var i=Math.abs(Math.cos(t.latitude));return new e.Vector3(-Math.sin(t.longitude)*i,-Math.sin(t.latitude),-Math.cos(t.longitude)*i)}({longitude:a,latitude:l}).normalize();return this.position.set(0,0,0),this.lookAt(d),this.position.add(c).sub(d.clone().setLength(h)),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=h,this.pose.offset.copy(c),this.needsRender=!0,this},i.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()}},i.prototype.computeProjectionMatrix=function(){!function(e,t,i,r){i=Math.pow(i,2);for(var n=0;n<16;n++)r.elements[n]=e.elements[n]+(t.elements[n]-e.elements[n])*i}(this.orthographicCamera.projectionMatrix,this.perspectiveCamera.projectionMatrix,1-this.perspToOrtho.x,this.projectionMatrix),this.projectionMatrixInverse.getInverse(this.projectionMatrix),this.needsRender=!0},i.prototype.setViewOffset=function(e,t,i,r,n,o){this.perspectiveCamera.setViewOffset(e,t,i,r,n,o),this.orthographicCamera.setViewOffset(e,t,i,r,n,o),this.computeProjectionMatrix()},i.prototype.clearViewOffset=function(){this.perspectiveCamera.clearViewOffset(),this.orthographicCamera.clearViewOffset(),this.computeProjectionMatrix()},i.prototype.updateProjectionMatrix=function(){this.perspectiveCamera.updateProjectionMatrix(),this.orthographicCamera.updateProjectionMatrix(),this.computeProjectionMatrix()},Object.defineProperty(i.prototype,"perspectiveProjectionMatrix",{get:function(){return this.perspectiveCamera.projectionMatrix},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"perspectiveProjectionMatrixInverse",{get:function(){return this.perspectiveCamera.projectionMatrixInverse},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"orthographicProjectionMatrix",{get:function(){return this.orthographicCamera.projectionMatrix},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"orthographicProjectionMatrixInverse",{get:function(){return this.orthographicCamera.projectionMatrixInverse},enumerable:!1,configurable:!0}),i.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 r=Math.max(this.orthoDistance,.01)*Math.tan(.5*this.fov/180*Math.PI),n=-.5*this.aspect*2*r;this.orthographicCamera.left=n,this.orthographicCamera.right=-n,this.orthographicCamera.top=r,this.orthographicCamera.bottom=-r,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(i.prototype,"isPerspectiveCamera",{get:function(){return this.perspToOrtho.x<1},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"isOrthographicCamera",{get:function(){return this.perspToOrtho.x>=1},enumerable:!1,configurable:!0}),i.prototype.copy=function(e,i){return t.prototype.copy.call(this,e,i),this.fov=e.fov,this.aspect=e.aspect,this.near=e.near,this.far=e.far,this.perspToOrtho.copy(e.perspToOrtho),this.orthoDistance=e.orthoDistance,this.updateTime(je(),0),this},i}(e.Camera),Mi=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,r=this.z;return this.x=i*e.z-r*e.y,this.y=r*e.x-t*e.z,this.z=t*e.y-i*e.x,this},e.prototype.crossVectors=function(e,t){var i=e.x,r=e.y,n=e.z,o=t.x,s=t.y,a=t.z;return this.x=r*a-n*s,this.y=n*o-i*a,this.z=i*s-r*o,this},e.prototype.clone=function(){return new e(this.x,this.y,this.z)},e}(),Si=function(e,t,i){this.extents=e,this.startIndex=t,this.endIndex=i},Ci=function(e,t){this.triangle=e,this.intersectionPoint=t},Ii=(yi=new Mi(0,0,0),bi=new Mi(0,0,0),xi=new Mi(0,0,0),wi=new Mi(0,0,0),function(e,t,i,r,n,o){bi.subVectors(t,e),xi.subVectors(i,e),wi.crossVectors(bi,xi);var s,a=n.dot(wi);if(a>0){if(o)return null;s=1}else{if(!(a<0))return null;s=-1,a=-a}yi.subVectors(r,e);var l=s*n.dot(xi.crossVectors(yi,xi));if(l<0)return null;var u=s*n.dot(bi.cross(yi));if(u<0)return null;if(l+u>a)return null;var h=-s*yi.dot(wi);if(h<0)return null;var c=h/a;return new Mi(0,0,0).copy(n).multiplyScalar(c).add(r)}),Bi=function(e,t){this.min=e,this.max=t};function Ti(e,t,i){var r=new Bi(0,0);t.x>=0?(r.min=(i.extents[0]-e.x)*t.x,r.max=(i.extents[3]-e.x)*t.x):(r.min=(i.extents[3]-e.x)*t.x,r.max=(i.extents[0]-e.x)*t.x);var n=new Bi(0,0);if(t.y>=0?(n.min=(i.extents[1]-e.y)*t.y,n.max=(i.extents[4]-e.y)*t.y):(n.min=(i.extents[4]-e.y)*t.y,n.max=(i.extents[1]-e.y)*t.y),r.min>n.max||n.min>r.max)return!1;n.min>r.min&&(r.min=n.min),n.max<r.max&&(r.max=n.max);var o=new Bi(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),!(r.min>o.max||o.min>r.max||(o.min>r.min&&(r.min=o.min),o.max<r.max&&(r.max=o.max),r.max<0))}function Pi(e,t,i,r,n){if(i>=r)return[0,0,0,0,0,0];for(var o=1/0,s=1/0,a=1/0,l=-1/0,u=-1/0,h=-1/0,c=i,d=void 0,p=void 0;c<r;c++)(p=t[d=6*e[c]])<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])>h&&(h=p);return[o-n,s-n,a-n,l+n,u+n,h+n]}var Ri=1e-6,ki=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,r=new Uint32Array(i),n=new Float32Array(6*i),o=[],s=1/0,a=1/0,l=1/0,u=-1/0,h=-1/0,c=-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)r[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>h&&(h=y),m<l&&(l=m),b>c&&(c=b),n[p]=A,n[p+1]=g,n[p+2]=m,n[p+3]=v,n[p+4]=y,n[p+5]=b;var w,E=new Si([s,a,l,u,h,c],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]})),h=0;h<3;h++){for(var c=u[h],d=a[c]+a[c+3],p=i,f=s-1,A=-1,g=void 0;p<=f;)-1===A?(g=r[p],n[6*g+c]+n[6*g+c+3]<d?p++:A=g):(g=r[f],n[6*g+c]+n[6*g+c+3]>=d||(r[p]=g,r[f]=A,A=-1,p++),f--);if(p>i&&p<s){var m=new Si(Pi(r,n,i,p,Ri),i,p);m.endIndex-m.startIndex>e&&o.push(m);var v=new Si(Pi(r,n,p,s,Ri),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(E);w=o.pop();)M(w);return this.offsetArray=r,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 r,n=this.trianglesArray,o=this.offsetArray,s=this.rootNode,a=[],l=[],u=new Mi(1/t.x,1/t.y,1/t.z),h=[s];r=h.pop();)if(Ti(e,u,r)){r.node0&&h.push(r.node0),r.node1&&h.push(r.node1);for(var c=r.startIndex;c<r.endIndex;c++)a.push(o[c])}for(var d=new Mi(0,0,0),p=new Mi(0,0,0),f=new Mi(0,0,0),A=new Mi(e.x,e.y,e.z),g=new Mi(t.x,t.y,t.z),m=void(c=0),v=a.length;c<v;c++){m=9*a[c],d.x=n[m],d.y=n[m+1],d.z=n[m+2],p.x=n[m+3],p.y=n[m+3+1],p.z=n[m+3+2],f.x=n[m+6],f.y=n[m+6+1],f.z=n[m+6+2];var y=Ii(d,p,f,A,g,i);y&&l.push(new Ci([d.clone(),p.clone(),f.clone()],y))}return l},e.prototype.dispose=function(){delete this.offsetArray,delete this.rootNode},e}(),Li=!1,Di=[];function Oi(e){if(void 0===e&&(e=!1),e||!Li){Li=!0;var t=Di.shift();if(t){try{t()}catch(e){}ft.shared.add((function(){return Oi(!0)}),!0,2)}else Li=!1}}function Ni(e){return new Promise((function(t,i){Di.push((function(){try{t(e())}catch(e){i(e)}})),Oi()}))}function Fi(){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,r=e;r--;)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],r=(this._range>>>11)*i;return(2147483648^this._code)<(2147483648^r)?(this._range=r,e[t]+=2048-i>>>5,0==(4278190080&this._range)&&(this._code=this._code<<8|this._stream.readByte(),this._range<<=8),0):(this._range-=r,this._code-=r,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,r=0,n=0;n<this._numBitLevels;++n)i=i<<1|(t=e.decodeBit(this._models,i)),r|=t<<n;return r},e.reverseDecode2=function(e,t,i,r){for(var n,o=1,s=0,a=0;a<r;++a)o=o<<1|(n=i.decodeBit(e,t+o)),s|=n<<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,r,n=1;do{if(i=t>>7&1,t<<=1,n=n<<1|(r=e.decodeBit(this._decoders,(1+i<<8)+n)),i!==r){for(;n<256;)n=n<<1|e.decodeBit(this._decoders,n);break}}while(n<256);return 255&n},e.LiteralDecoder=function(){},e.LiteralDecoder.prototype.create=function(t,i){var r;if(!this._coders||this._numPrevBits!==i||this._numPosBits!==t)for(this._numPosBits=t,this._posMask=(1<<t)-1,this._numPrevBits=i,this._coders=[],r=1<<this._numPrevBits+this._numPosBits;r--;)this._coders[r]=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 r=1<<i;return!(e>8||t>4||i>4||(this._literalDecoder.create(t,e),this._lenDecoder.create(r),this._repLenDecoder.create(r),this._posStateMask=r-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,r){var n,o,s,a,l,u,h=0,c=0,d=0,p=0,f=0,A=0,g=0;for(this._rangeDecoder.setStream(t),this._outWindow.setStream(i),this.init();r<0||A<r;)if(n=A&this._posStateMask,0===this._rangeDecoder.decodeBit(this._isMatchDecoders,(h<<4)+n))o=this._literalDecoder.getDecoder(A++,g),g=h>=7?o.decodeWithMatchByte(this._rangeDecoder,this._outWindow.getByte(c)):o.decodeNormal(this._rangeDecoder),this._outWindow.putByte(g),h=h<4?0:h-(h<10?3:6);else{if(1===this._rangeDecoder.decodeBit(this._isRepDecoders,h))s=0,0===this._rangeDecoder.decodeBit(this._isRepG0Decoders,h)?0===this._rangeDecoder.decodeBit(this._isRep0LongDecoders,(h<<4)+n)&&(h=h<7?9:11,s=1):(0===this._rangeDecoder.decodeBit(this._isRepG1Decoders,h)?a=d:(0===this._rangeDecoder.decodeBit(this._isRepG2Decoders,h)?a=p:(a=f,f=p),p=d),d=c,c=a),0===s&&(s=2+this._repLenDecoder.decode(this._rangeDecoder,n),h=h<7?8:11);else if(f=p,p=d,d=c,s=2+this._lenDecoder.decode(this._rangeDecoder,n),h=h<7?7:10,(l=this._posSlotDecoder[s<=5?s-2:3].decode(this._rangeDecoder))>=4){if(c=(2|1&l)<<(u=(l>>1)-1),l<14)c+=e.reverseDecode2(this._posDecoders,c-l-1,this._rangeDecoder,u);else if(c+=this._rangeDecoder.decodeDirectBits(u-4)<<4,(c+=this._posAlignDecoder.reverseDecode(this._rangeDecoder))<0){if(-1===c)break;return!1}}else c=l;if(c>=A||c>=this._dictionarySizeCheck)return!1;this._outWindow.copyBlock(c,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,r,n,o;return!(e.size<5)&&(i=(t=e.readByte())%9,r=(t=~~(t/9))%5,n=~~(t/5),!!this.setLcLpPb(i,r,n)&&(o=e.readByte(),o|=e.readByte()<<8,o|=e.readByte()<<16,o+=16777216*e.readByte(),this.setDictionarySize(o)))},e.decompress=function(t,i,r,n){var o=new e.Decoder;if(!o.setDecoderProperties(t))throw"Incorrect stream properties";if(!o.decode(i,r,n))throw"Error in data stream";return!0},e.decompressFile=function(t,i){var r,n=new e.Decoder;if(!n.setDecoderProperties(t))throw"Incorrect stream properties";if(r=t.readByte(),r|=t.readByte()<<8,r|=t.readByte()<<16,r+=16777216*t.readByte(),t.readByte(),t.readByte(),t.readByte(),t.readByte(),!n.decode(t,i,r))throw"Error in data stream";return!0},e}var Qi=Fi(),Vi="\nvar decodeLZMA = (function() {\n var LZMA = (".concat(Fi.toString(),")();\n return function(data, callback) {\n return (").concat(function(e,t,i){try{var r={data:t,offset:0,readByte:function(){return this.data[this.offset++]}},n=r.data.length,o={data:[],offset:0,writeByte:function(e){var t=Math.floor(this.offset/n);this.data[t]||(this.data[t]=new Uint8Array(n)),this.data[t][this.offset%n]=e,this.offset++}};e.decompressFile(r,o);for(var s=new Uint8Array(o.offset),a=0;a<o.offset;a++)s[a]=o.data[Math.floor(a/n)][a%n];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),r=0;r<t.length;r++)i[t.charCodeAt(r)]=r;var n,o,s,a,l,u=.75*e.length,h=e.length,c=0;"="===e[e.length-1]&&(u--,"="===e[e.length-2]&&u--);var d=new ArrayBuffer(u),p=new Uint8Array(d);for(n=0;n<h;n+=4)o=i[e.charCodeAt(n)],s=i[e.charCodeAt(n+1)],a=i[e.charCodeAt(n+2)],l=i[e.charCodeAt(n+3)],p[c++]=o<<2|s>>4,p[c++]=(15&s)<<4|a>>2,p[c++]=(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///wNLBEBBAEHAAEEXQSIQAAALIAEQAiICQQhqIAEQAyAARQRAQQwQASEACyAAQQA2AgAgAEEANgIEIABBADYCCCAAIAI2AgAgAEEANgIEIAAgATYCCCAACwoAQQwQASAAEA4LBgAgABAPCyoAIAEgACgCCE8EQEEAQcAAQSdBPxAAAAsgACgCBCABIAAoAgBqai0ACAssACABIAAoAghPBEBBAEHAAEEyQT8QAAALIAAoAgQgASAAKAIAamogAjoACAtkAQJ/QQ0QDyECA0AgAUENSARAIAIgASAAIAEQEUH/AXEQEiABQQFqIQEMAQsLQQAhAEEAIQEDQCABQQhIBEAgAiABQQVqEBFB/wFxIAFBA3R0IAByIQAgAUEBaiEBDAELCyAACwYAIAAQEwsnACAAIAEQDzYCCCAAQQA2AgwgACABNgIUIABBADoAGCAAQQA2AgALJAAgACgCCCAAKAIYEBUgAEGABiAAKAIMIAAtABRqdBAGNgIgC5UBAQR/IAEhBSAAIgYoAgAhASAAKAIEIQcgACgCCEEBdiEEIAJBAEgEfyACIARqIgBBACAAQQBKGwUgAiIAIAQgACAESBsLIQIgA0EASAR/IAMgBGoiAEEAIABBAEobBSADIgAgBCAAIARIGwshAwNAIAIgA05FBEAgAkEBdCABaiAHaiAFOwEIIAJBAWohAgwBCwsgBgssAQF/AkACQAJAIwRBAWsOAwEBAgALAAtB/////wchAQsgAEGACEEAIAEQFwvBAQECfyAAQQIQBjYCACAAKAIAIgEoAgAgASgCBGpBgAg7AQggACgCACICKAIAIQEgAigCBCABQQJqakGACDsBCCAAKAIMKAIAQQEkBBAYGkEAIQIDQCACQRBIBEAgAiAAKAIEKAIAIgEoAgBBAnZJBH8gAkECdCABaigCCAUACygCAEEBJAQQGBogAiAAKAIIKAIAIgEoAgBBAnZJBH8gAkECdCABaigCCAUACygCAEEBJAQQGBogAkEBaiECDAELCwuHAgEFfyAAIQJBgAYgACgCDCAALQAUanQhAQNAIAMgAUgEQCACKAIgIgQoAgAhBSAEKAIEIANBAXQgBWpqQYAIOwEIIANBAWohAwwBCwsgAiEBQQAhAgNAIAJBBEkEQCACIAEoAiQoAgAiAygCAEECdkkEfyACQQJ0IANqKAIIBQALKAIAQQEkBBAYGiACQQFqIQIMAQsLIAEoAigoAgBBASQEEBgaIAEoAixBASQEEBgaIAAoAjBBASQEEBgaIAAoAjRBASQEEBgaIAAoAjhBASQEEBgaIAAoAjxBASQEEBgaIAAoAkBBASQEEBgaIAAoAkRBASQEEBgaIAAoAkgQGSAAKAJMEBkLyAwBA38DQCABQQNxIAIgAhsEQCAAIgRBAWohACABIgNBAWohASAEIAMtAAA6AAAgAkEBayECDAELCyAAQQNxRQRAA0AgAkEQTwRAIAAgASgCADYCACAAQQRqIAFBBGooAgA2AgAgAEEIaiABQQhqKAIANgIAIABBDGogAUEMaigCADYCACABQRBqIQEgAEEQaiEAIAJBEGshAgwBCwsgAkEIcQRAIAAgASgCADYCACAAQQRqIAFBBGooAgA2AgAgAUEIaiEBIABBCGohAAsgAkEEcQRAIAAgASgCADYCACABQQRqIQEgAEEEaiEACyACQQJxBEAgACABLwEAOwEAIAFBAmohASAAQQJqIQALIAJBAXEEQCAAIAEtAAA6AAALDwsgAkEgTwRAAkACQAJAIABBA3EiA0EBRwRAIANBAkYNASADQQNGDQIMAwsgASgCACEFIAAgASIDLQAAOgAAIABBAWoiASABIANBAWoiAS0AADoAAEEBaiIEQQFqIQAgAUEBaiIDQQFqIQEgBCADLQAAOgAAIAJBA2shAgNAIAJBEU8EQCAAIAFBAWooAgAiA0EIdCAFQRh2cjYCACAAQQRqIAFBBWooAgAiBUEIdCADQRh2cjYCACAAQQhqIAFBCWooAgAiA0EIdCAFQRh2cjYCACAAQQxqIAFBDWooAgAiBUEIdCADQRh2cjYCACABQRBqIQEgAEEQaiEAIAJBEGshAgwBCwsMAgsgASgCACEFIAAgAS0AADoAACAAQQFqIgRBAWohACABQQFqIgNBAWohASAEIAMtAAA6AAAgAkECayECA0AgAkESTwRAIAAgAUECaigCACIDQRB0IAVBEHZyNgIAIABBBGogAUEGaigCACIFQRB0IANBEHZyNgIAIABBCGogAUEKaigCACIDQRB0IAVBEHZyNgIAIABBDGogAUEOaigCACIFQRB0IANBEHZyNgIAIAFBEGohASAAQRBqIQAgAkEQayECDAELCwwBCyABKAIAIQUgACIEQQFqIQAgASIDQQFqIQEgBCADLQAAOgAAIAJBAWshAgNAIAJBE08EQCAAIAFBA2ooAgAiA0EYdCAFQQh2cjYCACAAQQRqIAFBB2ooAgAiBUEYdCADQQh2cjYCACAAQQhqIAFBC2ooAgAiA0EY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")}.toString(),")();\n return function(data, callback) {\n return (").concat(function(e,t,i){try{var r=new WebAssembly.Memory({initial:16}),n=new WebAssembly.Module(e),o=new WebAssembly.Instance(n,{env:{memory:r,abort:function(){i(new Error("webAssembly abort"))}}}).exports,s=o.newU8Array(t.length);new Uint8Array(r.buffer,s+24,t.length).set(t);var a=o.decode(s),l=new Uint32Array(r.buffer,a,4),u=l[0],h=l[2],c=l[3];u?i(null,new Uint8Array(r.buffer,c+24,h).slice(0,h)):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'),Hi="undefined"!=typeof Worker&&"undefined"!=typeof Blob,qi="";if(Hi)try{var zi=new Blob([Vi],{type:"text/javascript"});qi=URL.createObjectURL(zi)}catch(e){}var Ui=function(){function e(){var e=this;if(!Hi)throw new Error("LZMAWorker cannot work in this broswer.");this.callCounter=0,this.requests={};var t=this.worker=new Worker(qi);t.onmessage=function(t){var i=t.data,r=i.id,n=i.result,o=i.error,s=e.getKey(r);e.requests[s]&&(o?e.requests[s](new Error(o)):e.requests[s](null,n),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=Hi,e}();function ji(e){return Array.prototype.reduce.call(e,(function(e,t,i){return e|t<<8*i}),0)}function Ki(e){var t=new Uint8Array(e),i=ji(t.slice(0,4));if(i>10)return Promise.reject(new Error("LZMA got too many sub chunks."));for(var r=[],n=[],o=4+4*i,s=0;s<i;s++)n[s]=ji(t.slice(4+4*s,8+4*s)),r[s]=s===i-1?t.subarray(o,o+n[s]):t.slice(o,o+n[s]),o+=n[s];return Ui.support?function(e){for(var t=[],i=e.length,r=function(i){t.push(new Promise((function(t,r){var n=new Ui;n.decompress(e[i],(function(e,i){if(n.terminate(),e)return r(e);t(i)}))})))},n=0;n<i;n++)r(n);return Promise.all(t)}(r):Promise.resolve(function(e){for(var t,i=[],r=e.length,n=function(r){var n={data:e[r],offset:0,readByte:function(){return this.data[this.offset++]}},o=n.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++}};Qi.decompressFile(n,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<r;o++)n(o);return i}(r))}function _i(){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 r=0;r<e.length;r++){var n=0===r,o=r===e.length-1,s=e[r];n||(s=s.replace(/^\/+/,"")),o||(s=s.replace(/\/+$/,"")),i.push(s)}return i.join("/")}var Gi=__webpack_require__(967);const Wi=Gi.Reader,Xi=Gi.util,Yi=Gi.roots["@REALSEE/FIVE:five/loaders/model/proto/pbm.proto"]||(Gi.roots["@REALSEE/FIVE:five/loaders/model/proto/pbm.proto"]={}),Zi=Yi.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=Xi.emptyArray,e.decode=function(e,t){e instanceof Wi||(e=Wi.create(e));let i=void 0===t?e.len:e.pos+t,r=new Yi.Model;for(;e.pos<i;){let t=e.uint32();t>>>3==1?(r.chunks&&r.chunks.length||(r.chunks=[]),r.chunks.push(Yi.Chunk.decode(e,e.uint32()))):e.skipType(7&t)}return r},e})();Yi.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 Wi||(e=Wi.create(e));let i=void 0===t?e.len:e.pos+t,r=new Yi.Chunk;for(;e.pos<i;){let t=e.uint32();switch(t>>>3){case 1:r.vertices=Yi.Vertices.decode(e,e.uint32());break;case 2:r.faces=Yi.Faces.decode(e,e.uint32());break;case 3:r.name=e.string();break;case 4:r.texture=e.string();break;default:e.skipType(7&t)}}if(!r.hasOwnProperty("vertices"))throw Xi.ProtocolError("missing required 'vertices'",{instance:r});if(!r.hasOwnProperty("faces"))throw Xi.ProtocolError("missing required 'faces'",{instance:r});if(!r.hasOwnProperty("name"))throw Xi.ProtocolError("missing required 'name'",{instance:r});return r},e})(),Yi.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=Xi.emptyArray,e.prototype.uvs=Xi.emptyArray,e.decode=function(e,t){e instanceof Wi||(e=Wi.create(e));let i=void 0===t?e.len:e.pos+t,r=new Yi.Vertices;for(;e.pos<i;){let t=e.uint32();switch(t>>>3){case 1:if(r.xyz&&r.xyz.length||(r.xyz=[]),2==(7&t)){let t=e.uint32()+e.pos;for(;e.pos<t;)r.xyz.push(e.float())}else r.xyz.push(e.float());break;case 2:if(r.uvs&&r.uvs.length||(r.uvs=[]),2==(7&t)){let t=e.uint32()+e.pos;for(;e.pos<t;)r.uvs.push(e.float())}else r.uvs.push(e.float());break;default:e.skipType(7&t)}}return r},e})(),Yi.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=Xi.emptyArray,e.prototype.normals=Xi.emptyArray,e.decode=function(e,t){e instanceof Wi||(e=Wi.create(e));let i=void 0===t?e.len:e.pos+t,r=new Yi.Faces;for(;e.pos<i;){let t=e.uint32();switch(t>>>3){case 1:if(r.indices&&r.indices.length||(r.indices=[]),2==(7&t)){let t=e.uint32()+e.pos;for(;e.pos<t;)r.indices.push(e.uint32())}else r.indices.push(e.uint32());break;case 2:if(r.normals&&r.normals.length||(r.normals=[]),2==(7&t)){let t=e.uint32()+e.pos;for(;e.pos<t;)r.normals.push(e.float())}else r.normals.push(e.float());break;default:e.skipType(7&t)}}return r},e})();var Ji=(new e.Matrix4).set(1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1).elements;function $i(e){var t=e.match(/(group|floor)-?(\d+)/);return t?parseInt(t[2],10):0}function er(e){var t=e.match(/(chunk)-?(\d+)/);return t?parseInt(t[2],10):0}function tr(e){var t=$i(e.name),i=er(e.name),r=function(e){var t=e.match(/(sub)-?(\d+)/);return t?parseInt(t[2],10):0}(e.name);return 1e6*t+1e3*i+r}function ir(t,i,r,n,o){var s=Ne({key:"texture.pbm",basisLoaderInitialized:oi.isInitialized()},kt(i,["format","quality","size","sharpen","mappings"]));return new li({allowHosts:r,requestProxy:n,networkSubscribe:o}).loadTexture(t,{imageURL:{transform:i.transform,options:s},wrapS:e.ClampToEdgeWrapping,wrapT:e.ClampToEdgeWrapping,minFilter:e.LinearFilter,maxSize:"number"==typeof s.size?new e.Vector2(s.size,s.size):void 0,preInit:!0}).then((function(e){var t=e.body;return t.needsUpdate=!0,t}))}function rr(t,i,r,n,o,s,a,l){void 0===o&&(o={});for(var u=function(e){for(var t,i,r=[],n=!0,o=0,s=e.chunks;o<s.length;o++)if(!($=s[o]).faces.normals||0===$.faces.normals.length){n=!1;break}for(var a=e.chunks.sort((function(e,t){return tr(e)-tr(t)})),l=[],u=0,h=a;u<h.length;u++){var c=$i(($=h[u]).name);l[c]||(l[c]=[]),l[c].push($)}for(var d=0;d<l.length;d++){var p=l[d];if(p)if(n){for(var f=0,A=0;A<p.length;A++)f+=($=p[A]).faces.indices.length;for(var g=3*f,m=2*f,v=3*f,y=new ArrayBuffer(4*g+4*m+4*v),b=new Float32Array(y,0,g),x=new Float32Array(y,4*g,m),w=new Float32Array(y,4*g+4*m,v),E=[],M=[1/0,1/0,1/0,-1/0,-1/0,-1/0],S=0,C=0;C<p.length;C++){var I=[1/0,1/0,1/0,-1/0,-1/0,-1/0],B=($=p[C]).vertices.xyz,T=$.vertices.uvs,P=$.faces.indices,R=$.faces.normals,k=P.length;for(A=0;A<k;A++){var L=P[A],D=B[3*L],O=B[3*L+1],N=B[3*L+2],F=1/(Ji[3]*D+Ji[7]*O+Ji[11]*N+Ji[15]),Q=(Ji[0]*D+Ji[4]*O+Ji[8]*N+Ji[12])*F,V=(Ji[1]*D+Ji[5]*O+Ji[9]*N+Ji[13])*F,H=(Ji[2]*D+Ji[6]*O+Ji[10]*N+Ji[14])*F;b[3*S+3*A]=Q,b[3*S+3*A+1]=V,b[3*S+3*A+2]=H,x[2*S+2*A]=T[2*L],x[2*S+2*A+1]=T[2*L+1];var q=3*Math.floor(A/3),z=R[q],U=R[q+1],j=R[q+2],K=1/(Ji[3]*z+Ji[7]*U+Ji[11]*j+Ji[15]),_=(Ji[0]*z+Ji[4]*U+Ji[8]*j+Ji[12])*K,G=(Ji[1]*z+Ji[5]*U+Ji[9]*j+Ji[13])*K,W=(Ji[2]*z+Ji[6]*U+Ji[10]*j+Ji[14])*K;w[3*S+3*A]=_,w[3*S+3*A+1]=G,w[3*S+3*A+2]=W,Q<I[0]&&(I[0]=Q),V<I[1]&&(I[1]=V),H<I[2]&&(I[2]=H),Q>I[3]&&(I[3]=Q),V>I[4]&&(I[4]=V),H>I[5]&&(I[5]=H)}I[0]<M[0]&&(M[0]=I[0]),I[1]<M[1]&&(M[1]=I[1]),I[2]<M[2]&&(M[2]=I[2]),I[3]>M[3]&&(M[3]=I[3]),I[4]>M[4]&&(M[4]=I[4]),I[5]>M[5]&&(M[5]=I[5]),E.push({materialIndex:C,name:$.name,chunkName:er($.name),start:S,count:$.faces.indices.length,texture:null!==(t=$.texture)&&void 0!==t?t:void 0}),S+=k}r.push({floorIndex:d,vertices:b,uvs:x,indices:null,normals:w,groups:E,extents:M})}else{f=0;var X=0;for(A=0;A<p.length;A++)X+=($=p[A]).vertices.xyz.length/3,f+=$.faces.indices.length;g=3*X,m=2*X,v=3*X;var Y=f,Z=(y=new ArrayBuffer(4*g+4*m+4*v+4*Y),b=new Float32Array(y,0,g),x=new Float32Array(y,4*g,m),w=new Float32Array(y,4*g+4*m,v),new Uint32Array(y,4*g+4*m+4*v,Y)),J=(E=[],M=[1/0,1/0,1/0,-1/0,-1/0,-1/0],0);for(S=0,C=0;C<p.length;C++){I=[1/0,1/0,1/0,-1/0,-1/0,-1/0],B=($=p[C]).vertices.xyz,T=$.vertices.uvs,P=$.faces.indices;var $,ee=B.length/3;for(k=P.length,A=0;A<ee;A++)D=B[3*A],O=B[3*A+1],N=B[3*A+2],F=1/(Ji[3]*D+Ji[7]*O+Ji[11]*N+Ji[15]),Q=(Ji[0]*D+Ji[4]*O+Ji[8]*N+Ji[12])*F,V=(Ji[1]*D+Ji[5]*O+Ji[9]*N+Ji[13])*F,H=(Ji[2]*D+Ji[6]*O+Ji[10]*N+Ji[14])*F,b[3*S+3*A]=Q,b[3*S+3*A+1]=V,b[3*S+3*A+2]=H,x[2*S+2*A]=T[2*A],x[2*S+2*A+1]=T[2*A+1],Q<I[0]&&(I[0]=Q),V<I[1]&&(I[1]=V),H<I[2]&&(I[2]=H),Q>I[3]&&(I[3]=Q),V>I[4]&&(I[4]=V),H>I[5]&&(I[5]=H);for(I[0]<M[0]&&(M[0]=I[0]),I[1]<M[1]&&(M[1]=I[1]),I[2]<M[2]&&(M[2]=I[2]),I[3]>M[3]&&(M[3]=I[3]),I[4]>M[4]&&(M[4]=I[4]),I[5]>M[5]&&(M[5]=I[5]),A=0;A<k;A++)Z[J+A]=S+P[A];E.push({materialIndex:C,name:$.name,chunkName:er($.name),start:J,count:$.faces.indices.length,texture:null!==(i=$.texture)&&void 0!==i?i:void 0}),S+=ee,J+=k}for(A=0;A<f;A+=3){var te,ie,re,ne,oe,se,ae,le,ue,he,ce,de,pe,fe,Ae,ge;z=void 0,U=void 0,j=void 0,te=3*Z[A],ie=3*Z[A+1],re=3*Z[A+2],ne=b[te],oe=b[te+1],se=b[te+2],ae=b[ie],le=b[ie+1],ue=b[ie+2],he=b[re],z=(de=b[re+1]-le)*(ge=se-ue)-(pe=b[re+2]-ue)*(Ae=oe-le),U=pe*(fe=ne-ae)-(ce=he-ae)*ge,j=ce*Ae-de*fe,w[te]+=z,w[te+1]+=U,w[te+2]+=j,w[ie]+=z,w[ie+1]+=U,w[ie+2]+=j,w[re]+=z,w[re+1]+=U,w[re+2]+=j}r.push({floorIndex:d,vertices:b,uvs:x,indices:Z,normals:w,groups:E,extents:M})}}return r}(t),h=[],c=0,d=u;c<d.length;c++){var p=d[c],f=p.floorIndex,A=p.vertices,g=p.uvs,m=p.indices,v=p.normals,y=p.groups,b=p.extents,x=new e.Box3;x.min.x=b[0],x.min.y=b[1],x.min.z=b[2],x.max.x=b[3],x.max.y=b[4],x.max.z=b[5];var w=new e.BufferGeometry;w.setAttribute("position",new e.BufferAttribute(A,3)),w.setAttribute("uv",new e.BufferAttribute(g,2)),w.setAttribute("normal",new e.BufferAttribute(v,3)),m&&w.setIndex(new e.BufferAttribute(m,1)),w.boundingBox=x,w.boundingSphere=x.getBoundingSphere(new e.Sphere);for(var E=0,M=y;E<M.length;E++){var S=M[E];w.addGroup(S.start,S.count,S.materialIndex)}for(var C=[],I=function(t){var u=r[t.chunkName]||(t.texture?_i(i,t.texture):void 0),h=new pi;if(C.push(h),u){var c=void 0;u in o?c=o[u]:(c=ir(u,n,s,a,l),o[u]=c),c.then((function(e){h.uniforms.map.value=e,h.uniforms.exposure.value=3.3}),(function(){h.defines.USE_MAP=!1,h.uniforms.diffuse.value=new e.Color(16777215)}))}else h.defines.USE_MAP=!1,h.uniforms.diffuse.value=new e.Color(16777215);h.uniforms.floorIndex.value=f},B=0,T=y;B<T.length;B++)I(S=T[B]);var P=new Mt(w,C);P.name="model_floor_"+f,P.floorIndex=f,h.push(P)}return{objects:h,texturePromise:Promise.all(Object.keys(o).map((function(e){return o[e].catch(ze)}))).then(ze)}}function nr(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 or(e){return 0===e.indexOf("//")||/^[0-9a-z]+\:/i.test(e)}const sr=Gi.Reader,ar=Gi.util,lr=Gi.roots["@REALSEE/FIVE:five/loaders/model/proto/dome.proto"]||(Gi.roots["@REALSEE/FIVE:five/loaders/model/proto/dome.proto"]={}),ur=lr.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=ar.emptyArray,e.decode=function(e,t){e instanceof sr||(e=sr.create(e));let i=void 0===t?e.len:e.pos+t,r=new lr.Model;for(;e.pos<i;){let t=e.uint32();t>>>3==1?(r.meshes&&r.meshes.length||(r.meshes=[]),r.meshes.push(lr.Mesh.decode(e,e.uint32()))):e.skipType(7&t)}return r},e})();function hr(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 cr(t){var i=t.position,r=t.normal,n=t.uv,o=t.uv2,s=t.groups,a=new e.BufferGeometry;a.setAttribute("position",new e.BufferAttribute(new Float32Array(i.array),3)),r&&a.setAttribute("normal",new e.BufferAttribute(new Float32Array(r.array),3)),n&&a.setAttribute("uv",new e.BufferAttribute(new Float32Array(n.array),2)),o&&a.setAttribute("uv2",new e.BufferAttribute(new Float32Array(o.array),2));for(var l=0,u=s;l<u.length;l++){var h=u[l];a.addGroup(h.start,h.count,h.materialIndex)}return a}function dr(t,i,r,n,o,s){if(s.hasOwnProperty(t))return s[t];or(t=t.split("?")[0])||(t=_i(i,t)),0===(t=t.replace(/\/\/vrlab-image\d*.ljcdn.com\//,"//vrlab-public.ljcdn.com/")).indexOf("//")&&(t="https:"+t);var a=Ne({key:"texture.dome",size:64,basisLoaderInitialized:oi.isInitialized()},kt(r,["quality","format","sharpen","mappings"]));return s[t]=o.loadTexture(t,{imageURL:{transform:r.transform,options:a},wrapS:e.RepeatWrapping,wrapT:e.RepeatWrapping}).then((function(e){var t=e.body;return n&&t.repeat.copy(n),t.needsUpdate=!0,t.updateMatrix(),t}))}function pr(t,i,r,n,o){var s=[],a=new pi,l=a.uniforms;l.exposure.value=4.3;var u=a.defines;if(u.USE_MAP=!1,u.USE_UV=!1,t.kd&&(l.diffuse.value=(new e.Color).fromArray(t.kd.rgb)),t.mapkd){var h=null;if(t.mapkdrepeat){var c=t.mapkdrepeat.split(/\s+/).map((function(e){return Number(e)})),d=c[0],p=c[1];h=new e.Vector2(d,p)}s.push(dr(t.mapkd,i,r,h,n,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(ze))}if(t.ks&&(l.specular.value=(new e.Color).fromArray(t.ks.rgb)),t.mapks&&s.push(dr(t.mapks,i,r,null,n,o).then((function(e){l.specularMap.value=e})).catch(ze)),t.ke&&(l.emissive.value=(new e.Color).fromArray(t.ke.rgb)),t.mapke&&s.push(dr(t.mapke,i,r,null,n,o).then((function(e){l.emissiveMap.value=e})).catch(ze)),t.norm&&s.push(dr(t.norm,i,r,null,n,o).then((function(e){l.normalMap.value=e})).catch(ze)),t.mapbump&&s.push(dr(t.mapbump,i,r,null,n,o).then((function(e){l.bumpMap.value=e})).catch(ze)),t.bump&&s.push(dr(t.bump,i,r,null,n,o).then((function(e){l.bumpMap.value=e})).catch(ze)),"number"==typeof t.ns&&(l.shininess.value=t.ns),"number"==typeof t.d){var f=t.d;f>0&&f<1&&(a.originOpacity=f,a.opacity=f)}return{material:a,textureReady:Promise.all(s).then(ze)}}function fr(t,i,r,n,o,s){for(var a,l=[],u=[],h=(a=t,ur.decode(a).meshes),c=new li({allowHosts:n,requestProxy:o,networkSubscribe:s}),d=new e.Matrix4,p=new e.Vector3,f=new e.Quaternion,A=new e.Vector3,g={},m=0,v=h;m<v.length;m++){var y=v[m],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 Ct;C.renderOrder=-3;for(var I=0;I<x.length;I++){var B=cr(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&&hr(B);for(var T=[],P=0,R=x[I].material;P<R.length;P++){var k=pr(R[P],i,r,c,g),L=k.material,D=k.textureReady;u.push(D),T.push(L)}var O=new Mt(B,T);O.name="chunk_"+I,C.add(O)}C.floorIndex=0,C.name=b,l.push(C)}}return{objects:l,texturePromise:Promise.all(u).catch(ze)}}lr.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=ar.emptyArray,e.prototype.matrix=ar.emptyArray,e.decode=function(e,t){e instanceof sr||(e=sr.create(e));let i=void 0===t?e.len:e.pos+t,r=new lr.Mesh;for(;e.pos<i;){let t=e.uint32();switch(t>>>3){case 1:r.name=e.string();break;case 2:r.chunks&&r.chunks.length||(r.chunks=[]),r.chunks.push(lr.Chunk.decode(e,e.uint32()));break;case 3:r.matrix&&r.matrix.length||(r.matrix=[]),r.matrix.push(lr.Matrix.decode(e,e.uint32()));break;default:e.skipType(7&t)}}if(!r.hasOwnProperty("name"))throw ar.ProtocolError("missing required 'name'",{instance:r});return r},e})(),lr.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=ar.emptyArray,e.decode=function(e,t){e instanceof sr||(e=sr.create(e));let i=void 0===t?e.len:e.pos+t,r=new lr.Matrix;for(;e.pos<i;){let t=e.uint32();if(t>>>3==1)if(r.elements&&r.elements.length||(r.elements=[]),2==(7&t)){let t=e.uint32()+e.pos;for(;e.pos<t;)r.elements.push(e.float())}else r.elements.push(e.float());else e.skipType(7&t)}return r},e})(),lr.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=ar.emptyArray,e.decode=function(e,t){e instanceof sr||(e=sr.create(e));let i=void 0===t?e.len:e.pos+t,r=new lr.Chunk;for(;e.pos<i;){let t=e.uint32();switch(t>>>3){case 2:r.geometry=lr.Geometry.decode(e,e.uint32());break;case 3:r.material&&r.material.length||(r.material=[]),r.material.push(lr.Material.decode(e,e.uint32()));break;default:e.skipType(7&t)}}if(!r.hasOwnProperty("geometry"))throw ar.ProtocolError("missing required 'geometry'",{instance:r});return r},e})(),lr.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=ar.emptyArray,e.decode=function(e,t){e instanceof sr||(e=sr.create(e));let i=void 0===t?e.len:e.pos+t,r=new lr.Geometry;for(;e.pos<i;){let t=e.uint32();switch(t>>>3){case 1:r.position=lr.Position.decode(e,e.uint32());break;case 2:r.uv=lr.UV.decode(e,e.uint32());break;case 3:r.uv2=lr.UV.decode(e,e.uint32());break;case 4:r.normal=lr.Normal.decode(e,e.uint32());break;case 5:r.groups&&r.groups.length||(r.groups=[]),r.groups.push(lr.Group.decode(e,e.uint32()));break;default:e.skipType(7&t)}}if(!r.hasOwnProperty("position"))throw ar.ProtocolError("missing required 'position'",{instance:r});if(!r.hasOwnProperty("normal"))throw ar.ProtocolError("missing required 'normal'",{instance:r});return r},e})(),lr.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=ar.emptyArray,e.decode=function(e,t){e instanceof sr||(e=sr.create(e));let i=void 0===t?e.len:e.pos+t,r=new lr.Position;for(;e.pos<i;){let t=e.uint32();if(t>>>3==1)if(r.array&&r.array.length||(r.array=[]),2==(7&t)){let t=e.uint32()+e.pos;for(;e.pos<t;)r.array.push(e.float())}else r.array.push(e.float());else e.skipType(7&t)}return r},e})(),lr.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=ar.emptyArray,e.decode=function(e,t){e instanceof sr||(e=sr.create(e));let i=void 0===t?e.len:e.pos+t,r=new lr.UV;for(;e.pos<i;){let t=e.uint32();if(t>>>3==1)if(r.array&&r.array.length||(r.array=[]),2==(7&t)){let t=e.uint32()+e.pos;for(;e.pos<t;)r.array.push(e.float())}else r.array.push(e.float());else e.skipType(7&t)}return r},e})(),lr.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=ar.emptyArray,e.decode=function(e,t){e instanceof sr||(e=sr.create(e));let i=void 0===t?e.len:e.pos+t,r=new lr.Normal;for(;e.pos<i;){let t=e.uint32();if(t>>>3==1)if(r.array&&r.array.length||(r.array=[]),2==(7&t)){let t=e.uint32()+e.pos;for(;e.pos<t;)r.array.push(e.float())}else r.array.push(e.float());else e.skipType(7&t)}return r},e})(),lr.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 sr||(e=sr.create(e));let i=void 0===t?e.len:e.pos+t,r=new lr.Group;for(;e.pos<i;){let t=e.uint32();switch(t>>>3){case 1:r.start=e.uint32();break;case 2:r.count=e.uint32();break;case 3:r.materialIndex=e.uint32();break;default:e.skipType(7&t)}}if(!r.hasOwnProperty("start"))throw ar.ProtocolError("missing required 'start'",{instance:r});if(!r.hasOwnProperty("count"))throw ar.ProtocolError("missing required 'count'",{instance:r});if(!r.hasOwnProperty("materialIndex"))throw ar.ProtocolError("missing required 'materialIndex'",{instance:r});return r},e})(),lr.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 sr||(e=sr.create(e));let i=void 0===t?e.len:e.pos+t,r=new lr.Material;for(;e.pos<i;){let t=e.uint32();switch(t>>>3){case 1:r.kd=lr.Color.decode(e,e.uint32());break;case 2:r.ks=lr.Color.decode(e,e.uint32());break;case 3:r.ke=lr.Color.decode(e,e.uint32());break;case 4:r.mapkd=e.string();break;case 5:r.mapks=e.string();break;case 6:r.mapke=e.string();break;case 7:r.norm=e.string();break;case 8:r.mapbump=e.string();break;case 9:r.bump=e.string();break;case 10:r.mapd=e.string();break;case 11:r.ns=e.float();break;case 12:r.d=e.float();break;case 13:r.tr=e.float();break;case 14:r.mapkdrepeat=e.string();break;default:e.skipType(7&t)}}return r},e})(),lr.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=ar.emptyArray,e.decode=function(e,t){e instanceof sr||(e=sr.create(e));let i=void 0===t?e.len:e.pos+t,r=new lr.Color;for(;e.pos<i;){let t=e.uint32();if(t>>>3==1)if(r.rgb&&r.rgb.length||(r.rgb=[]),2==(7&t)){let t=e.uint32()+e.pos;for(;e.pos<t;)r.rgb.push(e.float())}else r.rgb.push(e.float());else e.skipType(7&t)}return r},e})(),Math.PI,Math.PI;const Ar={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0};function gr(e,{precision:t=Ar.precision}={}){return e=function(e){return Math.round(e/Ar.EPSILON)*Ar.EPSILON}(e),"".concat(parseFloat(e.toPrecision(t)))}function mr(e){return Array.isArray(e)||ArrayBuffer.isView(e)&&!(e instanceof DataView)}function vr(e,t,i){const r=Ar.EPSILON;i&&(Ar.EPSILON=i);try{if(e===t)return!0;if(mr(e)&&mr(t)){if(e.length!==t.length)return!1;for(let i=0;i<e.length;++i)if(!vr(e[i],t[i]))return!1;return!0}return e&&e.equals?e.equals(t):t&&t.equals?t.equals(e):"number"==typeof e&&"number"==typeof t&&Math.abs(e-t)<=Ar.EPSILON*Math.max(1,Math.abs(e),Math.abs(t))}finally{Ar.EPSILON=r}}class yr extends(function(e){function t(){var t=Reflect.construct(e,Array.from(arguments));return Object.setPrototypeOf(t,Object.getPrototypeOf(this)),t}return t.prototype=Object.create(e.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e,t}(Array)){clone(){return(new this.constructor).copy(this)}fromArray(e,t=0){for(let i=0;i<this.ELEMENTS;++i)this[i]=e[i+t];return this.check()}toArray(e=[],t=0){for(let i=0;i<this.ELEMENTS;++i)e[t+i]=this[i];return e}from(e){return Array.isArray(e)?this.copy(e):this.fromObject(e)}to(e){return e===this?this:mr(e)?this.toArray(e):this.toObject(e)}toTarget(e){return e?this.to(e):this}toFloat32Array(){return new Float32Array(this)}toString(){return this.formatString(Ar)}formatString(e){let t="";for(let i=0;i<this.ELEMENTS;++i)t+=(i>0?", ":"")+gr(this[i],e);return"".concat(e.printTypes?this.constructor.name:"","[").concat(t,"]")}equals(e){if(!e||this.length!==e.length)return!1;for(let t=0;t<this.ELEMENTS;++t)if(!vr(this[t],e[t]))return!1;return!0}exactEquals(e){if(!e||this.length!==e.length)return!1;for(let t=0;t<this.ELEMENTS;++t)if(this[t]!==e[t])return!1;return!0}negate(){for(let e=0;e<this.ELEMENTS;++e)this[e]=-this[e];return this.check()}lerp(e,t,i){if(void 0===i)return this.lerp(this,e,t);for(let r=0;r<this.ELEMENTS;++r){const n=e[r];this[r]=n+i*(t[r]-n)}return this.check()}min(e){for(let t=0;t<this.ELEMENTS;++t)this[t]=Math.min(e[t],this[t]);return this.check()}max(e){for(let t=0;t<this.ELEMENTS;++t)this[t]=Math.max(e[t],this[t]);return this.check()}clamp(e,t){for(let i=0;i<this.ELEMENTS;++i)this[i]=Math.min(Math.max(this[i],e[i]),t[i]);return this.check()}add(...e){for(const t of e)for(let e=0;e<this.ELEMENTS;++e)this[e]+=t[e];return this.check()}subtract(...e){for(const t of e)for(let e=0;e<this.ELEMENTS;++e)this[e]-=t[e];return this.check()}scale(e){if("number"==typeof e)for(let t=0;t<this.ELEMENTS;++t)this[t]*=e;else for(let t=0;t<this.ELEMENTS&&t<e.length;++t)this[t]*=e[t];return this.check()}multiplyByScalar(e){for(let t=0;t<this.ELEMENTS;++t)this[t]*=e;return this.check()}check(){if(Ar.debug&&!this.validate())throw new Error("math.gl: ".concat(this.constructor.name," some fields set to invalid numbers'"));return this}validate(){let e=this.length===this.ELEMENTS;for(let t=0;t<this.ELEMENTS;++t)e=e&&Number.isFinite(this[t]);return e}sub(e){return this.subtract(e)}setScalar(e){for(let t=0;t<this.ELEMENTS;++t)this[t]=e;return this.check()}addScalar(e){for(let t=0;t<this.ELEMENTS;++t)this[t]+=e;return this.check()}subScalar(e){return this.addScalar(-e)}multiplyScalar(e){for(let t=0;t<this.ELEMENTS;++t)this[t]*=e;return this.check()}divideScalar(e){return this.multiplyByScalar(1/e)}clampScalar(e,t){for(let i=0;i<this.ELEMENTS;++i)this[i]=Math.min(Math.max(this[i],e),t);return this.check()}get elements(){return this}}function br(e){if(!Number.isFinite(e))throw new Error("Invalid number ".concat(e));return e}function xr(e,t,i=""){if(Ar.debug&&!function(e,t){if(e.length!==t)return!1;for(let t=0;t<e.length;++t)if(!Number.isFinite(e[t]))return!1;return!0}(e,t))throw new Error("math.gl: ".concat(i," some fields set to invalid numbers'"));return e}function wr(e,t){if(!e)throw new Error("math.gl assertion ".concat(t))}class Er extends yr{get x(){return this[0]}set x(e){this[0]=br(e)}get y(){return this[1]}set y(e){this[1]=br(e)}len(){return Math.sqrt(this.lengthSquared())}magnitude(){return this.len()}lengthSquared(){let e=0;for(let t=0;t<this.ELEMENTS;++t)e+=this[t]*this[t];return e}magnitudeSquared(){return this.lengthSquared()}distance(e){return Math.sqrt(this.distanceSquared(e))}distanceSquared(e){let t=0;for(let i=0;i<this.ELEMENTS;++i){const r=this[i]-e[i];t+=r*r}return br(t)}dot(e){let t=0;for(let i=0;i<this.ELEMENTS;++i)t+=this[i]*e[i];return br(t)}normalize(){const e=this.magnitude();if(0!==e)for(let t=0;t<this.ELEMENTS;++t)this[t]/=e;return this.check()}multiply(...e){for(const t of e)for(let e=0;e<this.ELEMENTS;++e)this[e]*=t[e];return this.check()}divide(...e){for(const t of e)for(let e=0;e<this.ELEMENTS;++e)this[e]/=t[e];return this.check()}lengthSq(){return this.lengthSquared()}distanceTo(e){return this.distance(e)}distanceToSquared(e){return this.distanceSquared(e)}getComponent(e){return wr(e>=0&&e<this.ELEMENTS,"index is out of range"),br(this[e])}setComponent(e,t){return wr(e>=0&&e<this.ELEMENTS,"index is out of range"),this[e]=t,this.check()}addVectors(e,t){return this.copy(e).add(t)}subVectors(e,t){return this.copy(e).subtract(t)}multiplyVectors(e,t){return this.copy(e).multiply(t)}addScaledVector(e,t){return this.add(new this.constructor(e).multiplyScalar(t))}}var Mr=1e-6,Sr="undefined"!=typeof Float32Array?Float32Array:Array;function Cr(){var e=new Sr(3);return Sr!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function Ir(e,t,i){var r=new Sr(3);return r[0]=e,r[1]=t,r[2]=i,r}function Br(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function Tr(e,t,i){var r=t[0],n=t[1],o=t[2],s=i[0],a=i[1],l=i[2];return e[0]=n*l-o*a,e[1]=o*s-r*l,e[2]=r*a-n*s,e}function Pr(e,t,i){var r=t[0],n=t[1],o=t[2],s=i[3]*r+i[7]*n+i[11]*o+i[15];return s=s||1,e[0]=(i[0]*r+i[4]*n+i[8]*o+i[12])/s,e[1]=(i[1]*r+i[5]*n+i[9]*o+i[13])/s,e[2]=(i[2]*r+i[6]*n+i[10]*o+i[14])/s,e}function Rr(e,t,i){var r=t[0],n=t[1],o=t[2];return e[0]=r*i[0]+n*i[3]+o*i[6],e[1]=r*i[1]+n*i[4]+o*i[7],e[2]=r*i[2]+n*i[5]+o*i[8],e}function kr(e,t,i){var r=i[0],n=i[1],o=i[2],s=i[3],a=t[0],l=t[1],u=t[2],h=n*u-o*l,c=o*a-r*u,d=r*l-n*a,p=n*d-o*c,f=o*h-r*d,A=r*c-n*h,g=2*s;return h*=g,c*=g,d*=g,p*=2,f*=2,A*=2,e[0]=a+h+p,e[1]=l+c+f,e[2]=u+d+A,e}Math.random,Math.PI,Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)});function Lr(e,t,i){const r=t[0],n=t[1],o=t[2],s=i[3]*r+i[7]*n+i[11]*o||1;return e[0]=(i[0]*r+i[4]*n+i[8]*o)/s,e[1]=(i[1]*r+i[5]*n+i[9]*o)/s,e[2]=(i[2]*r+i[6]*n+i[10]*o)/s,e}function Dr(e,t,i){const r=t[0],n=t[1],o=t[2];return e[0]=i[0]*r+i[3]*n+i[6]*o,e[1]=i[1]*r+i[4]*n+i[7]*o,e[2]=i[2]*r+i[5]*n+i[8]*o,e[3]=t[3],e}Cr();const Or=[0,0,0];let Nr;class Fr extends Er{static get ZERO(){return Nr||(Nr=new Fr(0,0,0),Object.freeze(Nr)),Nr}constructor(e=0,t=0,i=0){super(-0,-0,-0),1===arguments.length&&mr(e)?this.copy(e):(Ar.debug&&(br(e),br(t),br(i)),this[0]=e,this[1]=t,this[2]=i)}set(e,t,i){return this[0]=e,this[1]=t,this[2]=i,this.check()}copy(e){return this[0]=e[0],this[1]=e[1],this[2]=e[2],this.check()}fromObject(e){return Ar.debug&&(br(e.x),br(e.y),br(e.z)),this[0]=e.x,this[1]=e.y,this[2]=e.z,this.check()}toObject(e){return e.x=this[0],e.y=this[1],e.z=this[2],e}get ELEMENTS(){return 3}get z(){return this[2]}set z(e){this[2]=br(e)}angle(e){return function(e,t){var i=e[0],r=e[1],n=e[2],o=t[0],s=t[1],a=t[2],l=Math.sqrt(i*i+r*r+n*n)*Math.sqrt(o*o+s*s+a*a),u=l&&Br(e,t)/l;return Math.acos(Math.min(Math.max(u,-1),1))}(this,e)}cross(e){return Tr(this,this,e),this.check()}rotateX({radians:e,origin:t=Or}){return function(e,t,i,r){var n=[],o=[];n[0]=t[0]-i[0],n[1]=t[1]-i[1],n[2]=t[2]-i[2],o[0]=n[0],o[1]=n[1]*Math.cos(r)-n[2]*Math.sin(r),o[2]=n[1]*Math.sin(r)+n[2]*Math.cos(r),e[0]=o[0]+i[0],e[1]=o[1]+i[1],e[2]=o[2]+i[2]}(this,this,t,e),this.check()}rotateY({radians:e,origin:t=Or}){return function(e,t,i,r){var n=[],o=[];n[0]=t[0]-i[0],n[1]=t[1]-i[1],n[2]=t[2]-i[2],o[0]=n[2]*Math.sin(r)+n[0]*Math.cos(r),o[1]=n[1],o[2]=n[2]*Math.cos(r)-n[0]*Math.sin(r),e[0]=o[0]+i[0],e[1]=o[1]+i[1],e[2]=o[2]+i[2]}(this,this,t,e),this.check()}rotateZ({radians:e,origin:t=Or}){return function(e,t,i,r){var n=[],o=[];n[0]=t[0]-i[0],n[1]=t[1]-i[1],n[2]=t[2]-i[2],o[0]=n[0]*Math.cos(r)-n[1]*Math.sin(r),o[1]=n[0]*Math.sin(r)+n[1]*Math.cos(r),o[2]=n[2],e[0]=o[0]+i[0],e[1]=o[1]+i[1],e[2]=o[2]+i[2]}(this,this,t,e),this.check()}transform(e){return this.transformAsPoint(e)}transformAsPoint(e){return Pr(this,this,e),this.check()}transformAsVector(e){return Lr(this,this,e),this.check()}transformByMatrix3(e){return Rr(this,this,e),this.check()}transformByMatrix2(e){return function(e,t,i){const r=t[0],n=t[1];e[0]=i[0]*r+i[2]*n,e[1]=i[1]*r+i[3]*n,e[2]=t[2]}(this,this,e),this.check()}transformByQuaternion(e){return kr(this,this,e),this.check()}}var Qr={throttleRequests:!0,maxRequests:5},Vr=function(){function e(e){void 0===e&&(e={}),this.props=Ne(Ne({},Qr),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(){}},r=new Promise((function(e){return i.resolve=e}));return this.requestQueue.push(i),this.requestMap.set(e,r),this.issueNewRequests(),r},e.prototype.issueRequest=function(e){var t=this,i=e.identiy,r=e.resolve,n=!1;this.activeRequestCount++,r({done:function(){n||(n=!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}(),Hr=function(e,t,i){this.item=e,this.previous=t,this.next=i},qr=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 Hr(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}(),zr=function(){function e(){this.list=new qr,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 r=i.item;i=i.next,this.unloadTile(r,t)}},e}();class Ur extends yr{toString(){let e="[";if(Ar.printRowMajor){e+="row-major:";for(let t=0;t<this.RANK;++t)for(let i=0;i<this.RANK;++i)e+=" ".concat(this[i*this.RANK+t])}else{e+="column-major:";for(let t=0;t<this.ELEMENTS;++t)e+=" ".concat(this[t])}return e+="]",e}getElementIndex(e,t){return t*this.RANK+e}getElement(e,t){return this[t*this.RANK+e]}setElement(e,t,i){return this[t*this.RANK+e]=br(i),this}getColumn(e,t=new Array(this.RANK).fill(-0)){const i=e*this.RANK;for(let e=0;e<this.RANK;++e)t[e]=this[i+e];return t}setColumn(e,t){const i=e*this.RANK;for(let e=0;e<this.RANK;++e)this[i+e]=t[e];return this}}function jr(e,t,i){var r=t[0],n=t[1],o=t[2],s=t[3],a=t[4],l=t[5],u=t[6],h=t[7],c=t[8],d=t[9],p=t[10],f=t[11],A=t[12],g=t[13],m=t[14],v=t[15],y=i[0],b=i[1],x=i[2],w=i[3];return e[0]=y*r+b*a+x*c+w*A,e[1]=y*n+b*l+x*d+w*g,e[2]=y*o+b*u+x*p+w*m,e[3]=y*s+b*h+x*f+w*v,y=i[4],b=i[5],x=i[6],w=i[7],e[4]=y*r+b*a+x*c+w*A,e[5]=y*n+b*l+x*d+w*g,e[6]=y*o+b*u+x*p+w*m,e[7]=y*s+b*h+x*f+w*v,y=i[8],b=i[9],x=i[10],w=i[11],e[8]=y*r+b*a+x*c+w*A,e[9]=y*n+b*l+x*d+w*g,e[10]=y*o+b*u+x*p+w*m,e[11]=y*s+b*h+x*f+w*v,y=i[12],b=i[13],x=i[14],w=i[15],e[12]=y*r+b*a+x*c+w*A,e[13]=y*n+b*l+x*d+w*g,e[14]=y*o+b*u+x*p+w*m,e[15]=y*s+b*h+x*f+w*v,e}var Kr;!function(){var e;e=new Sr(2),Sr!=Float32Array&&(e[0]=0,e[1]=0)}(),function(){var e;e=new Sr(4),Sr!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0)}(),function(e){e[e.COL0ROW0=0]="COL0ROW0",e[e.COL0ROW1=1]="COL0ROW1",e[e.COL0ROW2=2]="COL0ROW2",e[e.COL0ROW3=3]="COL0ROW3",e[e.COL1ROW0=4]="COL1ROW0",e[e.COL1ROW1=5]="COL1ROW1",e[e.COL1ROW2=6]="COL1ROW2",e[e.COL1ROW3=7]="COL1ROW3",e[e.COL2ROW0=8]="COL2ROW0",e[e.COL2ROW1=9]="COL2ROW1",e[e.COL2ROW2=10]="COL2ROW2",e[e.COL2ROW3=11]="COL2ROW3",e[e.COL3ROW0=12]="COL3ROW0",e[e.COL3ROW1=13]="COL3ROW1",e[e.COL3ROW2=14]="COL3ROW2",e[e.COL3ROW3=15]="COL3ROW3"}(Kr||(Kr={}));const _r=45*Math.PI/180,Gr=1,Wr=.1,Xr=500,Yr=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]);class Zr extends Ur{static get IDENTITY(){return $r||($r=new Zr,Object.freeze($r)),$r}static get ZERO(){return Jr||(Jr=new Zr([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Object.freeze(Jr)),Jr}get ELEMENTS(){return 16}get RANK(){return 4}get INDICES(){return Kr}constructor(e){super(-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0),1===arguments.length&&Array.isArray(e)?this.copy(e):this.identity()}copy(e){return this[0]=e[0],this[1]=e[1],this[2]=e[2],this[3]=e[3],this[4]=e[4],this[5]=e[5],this[6]=e[6],this[7]=e[7],this[8]=e[8],this[9]=e[9],this[10]=e[10],this[11]=e[11],this[12]=e[12],this[13]=e[13],this[14]=e[14],this[15]=e[15],this.check()}set(e,t,i,r,n,o,s,a,l,u,h,c,d,p,f,A){return this[0]=e,this[1]=t,this[2]=i,this[3]=r,this[4]=n,this[5]=o,this[6]=s,this[7]=a,this[8]=l,this[9]=u,this[10]=h,this[11]=c,this[12]=d,this[13]=p,this[14]=f,this[15]=A,this.check()}setRowMajor(e,t,i,r,n,o,s,a,l,u,h,c,d,p,f,A){return this[0]=e,this[1]=n,this[2]=l,this[3]=d,this[4]=t,this[5]=o,this[6]=u,this[7]=p,this[8]=i,this[9]=s,this[10]=h,this[11]=f,this[12]=r,this[13]=a,this[14]=c,this[15]=A,this.check()}toRowMajor(e){return e[0]=this[0],e[1]=this[4],e[2]=this[8],e[3]=this[12],e[4]=this[1],e[5]=this[5],e[6]=this[9],e[7]=this[13],e[8]=this[2],e[9]=this[6],e[10]=this[10],e[11]=this[14],e[12]=this[3],e[13]=this[7],e[14]=this[11],e[15]=this[15],e}identity(){return this.copy(Yr)}fromObject(e){return this.check()}fromQuaternion(e){return function(e,t){var i=t[0],r=t[1],n=t[2],o=t[3],s=i+i,a=r+r,l=n+n,u=i*s,h=r*s,c=r*a,d=n*s,p=n*a,f=n*l,A=o*s,g=o*a,m=o*l;e[0]=1-c-f,e[1]=h+m,e[2]=d-g,e[3]=0,e[4]=h-m,e[5]=1-u-f,e[6]=p+A,e[7]=0,e[8]=d+g,e[9]=p-A,e[10]=1-u-c,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1}(this,e),this.check()}frustum(e){const{left:t,right:i,bottom:r,top:n,near:o=Wr,far:s=Xr}=e;return s===1/0?function(e,t,i,r,n,o){const s=2*o/(i-t),a=2*o/(n-r),l=(i+t)/(i-t),u=(n+r)/(n-r),h=-2*o;e[0]=s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a,e[6]=0,e[7]=0,e[8]=l,e[9]=u,e[10]=-1,e[11]=-1,e[12]=0,e[13]=0,e[14]=h,e[15]=0}(this,t,i,r,n,o):function(e,t,i,r,n,o,s){var a=1/(i-t),l=1/(n-r),u=1/(o-s);e[0]=2*o*a,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=2*o*l,e[6]=0,e[7]=0,e[8]=(i+t)*a,e[9]=(n+r)*l,e[10]=(s+o)*u,e[11]=-1,e[12]=0,e[13]=0,e[14]=s*o*2*u,e[15]=0}(this,t,i,r,n,o,s),this.check()}lookAt(e){const{eye:t,center:i=[0,0,0],up:r=[0,1,0]}=e;return function(e,t,i,r){var n,o,s,a,l,u,h,c,d,p,f=t[0],A=t[1],g=t[2],m=r[0],v=r[1],y=r[2],b=i[0],x=i[1],w=i[2];Math.abs(f-b)<Mr&&Math.abs(A-x)<Mr&&Math.abs(g-w)<Mr?function(e){e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1}(e):(h=f-b,c=A-x,d=g-w,n=v*(d*=p=1/Math.hypot(h,c,d))-y*(c*=p),o=y*(h*=p)-m*d,s=m*c-v*h,(p=Math.hypot(n,o,s))?(n*=p=1/p,o*=p,s*=p):(n=0,o=0,s=0),a=c*s-d*o,l=d*n-h*s,u=h*o-c*n,(p=Math.hypot(a,l,u))?(a*=p=1/p,l*=p,u*=p):(a=0,l=0,u=0),e[0]=n,e[1]=a,e[2]=h,e[3]=0,e[4]=o,e[5]=l,e[6]=c,e[7]=0,e[8]=s,e[9]=u,e[10]=d,e[11]=0,e[12]=-(n*f+o*A+s*g),e[13]=-(a*f+l*A+u*g),e[14]=-(h*f+c*A+d*g),e[15]=1)}(this,t,i,r),this.check()}ortho(e){const{left:t,right:i,bottom:r,top:n,near:o=Wr,far:s=Xr}=e;return function(e,t,i,r,n,o,s){var a=1/(t-i),l=1/(r-n),u=1/(o-s);e[0]=-2*a,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*l,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*u,e[11]=0,e[12]=(t+i)*a,e[13]=(n+r)*l,e[14]=(s+o)*u,e[15]=1}(this,t,i,r,n,o,s),this.check()}orthographic(e){const{fovy:t=_r,aspect:i=Gr,focalDistance:r=1,near:n=Wr,far:o=Xr}=e;en(t);const s=t/2,a=r*Math.tan(s),l=a*i;return this.ortho({left:-l,right:l,bottom:-a,top:a,near:n,far:o})}perspective(e){const{fovy:t=45*Math.PI/180,aspect:i=1,near:r=.1,far:n=500}=e;return en(t),function(e,t,i,r,n){var o,s=1/Math.tan(t/2);e[0]=s/i,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=s,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,null!=n&&n!==1/0?(o=1/(r-n),e[10]=(n+r)*o,e[14]=2*n*r*o):(e[10]=-1,e[14]=-2*r)}(this,t,i,r,n),this.check()}determinant(){return function(e){var t=e[0],i=e[1],r=e[2],n=e[3],o=e[4],s=e[5],a=e[6],l=e[7],u=e[8],h=e[9],c=e[10],d=e[11],p=e[12],f=e[13],A=e[14],g=e[15];return(t*s-i*o)*(c*g-d*A)-(t*a-r*o)*(h*g-d*f)+(t*l-n*o)*(h*A-c*f)+(i*a-r*s)*(u*g-d*p)-(i*l-n*s)*(u*A-c*p)+(r*l-n*a)*(u*f-h*p)}(this)}getScale(e=[-0,-0,-0]){return e[0]=Math.sqrt(this[0]*this[0]+this[1]*this[1]+this[2]*this[2]),e[1]=Math.sqrt(this[4]*this[4]+this[5]*this[5]+this[6]*this[6]),e[2]=Math.sqrt(this[8]*this[8]+this[9]*this[9]+this[10]*this[10]),e}getTranslation(e=[-0,-0,-0]){return e[0]=this[12],e[1]=this[13],e[2]=this[14],e}getRotation(e,t){e=e||[-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0],t=t||[-0,-0,-0];const i=this.getScale(t),r=1/i[0],n=1/i[1],o=1/i[2];return e[0]=this[0]*r,e[1]=this[1]*n,e[2]=this[2]*o,e[3]=0,e[4]=this[4]*r,e[5]=this[5]*n,e[6]=this[6]*o,e[7]=0,e[8]=this[8]*r,e[9]=this[9]*n,e[10]=this[10]*o,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}getRotationMatrix3(e,t){e=e||[-0,-0,-0,-0,-0,-0,-0,-0,-0],t=t||[-0,-0,-0];const i=this.getScale(t),r=1/i[0],n=1/i[1],o=1/i[2];return e[0]=this[0]*r,e[1]=this[1]*n,e[2]=this[2]*o,e[3]=this[4]*r,e[4]=this[5]*n,e[5]=this[6]*o,e[6]=this[8]*r,e[7]=this[9]*n,e[8]=this[10]*o,e}transpose(){return function(e,t){if(e===t){var i=t[1],r=t[2],n=t[3],o=t[6],s=t[7],a=t[11];e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=i,e[6]=t[9],e[7]=t[13],e[8]=r,e[9]=o,e[11]=t[14],e[12]=n,e[13]=s,e[14]=a}else e[0]=t[0],e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=t[1],e[5]=t[5],e[6]=t[9],e[7]=t[13],e[8]=t[2],e[9]=t[6],e[10]=t[10],e[11]=t[14],e[12]=t[3],e[13]=t[7],e[14]=t[11],e[15]=t[15]}(this,this),this.check()}invert(){return function(e,t){var i=t[0],r=t[1],n=t[2],o=t[3],s=t[4],a=t[5],l=t[6],u=t[7],h=t[8],c=t[9],d=t[10],p=t[11],f=t[12],A=t[13],g=t[14],m=t[15],v=i*a-r*s,y=i*l-n*s,b=i*u-o*s,x=r*l-n*a,w=r*u-o*a,E=n*u-o*l,M=h*A-c*f,S=h*g-d*f,C=h*m-p*f,I=c*g-d*A,B=c*m-p*A,T=d*m-p*g,P=v*T-y*B+b*I+x*C-w*S+E*M;P&&(P=1/P,e[0]=(a*T-l*B+u*I)*P,e[1]=(n*B-r*T-o*I)*P,e[2]=(A*E-g*w+m*x)*P,e[3]=(d*w-c*E-p*x)*P,e[4]=(l*C-s*T-u*S)*P,e[5]=(i*T-n*C+o*S)*P,e[6]=(g*b-f*E-m*y)*P,e[7]=(h*E-d*b+p*y)*P,e[8]=(s*B-a*C+u*M)*P,e[9]=(r*C-i*B-o*M)*P,e[10]=(f*w-A*b+m*v)*P,e[11]=(c*b-h*w-p*v)*P,e[12]=(a*S-s*I-l*M)*P,e[13]=(i*I-r*S+n*M)*P,e[14]=(A*y-f*x-g*v)*P,e[15]=(h*x-c*y+d*v)*P)}(this,this),this.check()}multiplyLeft(e){return jr(this,e,this),this.check()}multiplyRight(e){return jr(this,this,e),this.check()}rotateX(e){return function(e,t,i){var r=Math.sin(i),n=Math.cos(i),o=t[4],s=t[5],a=t[6],l=t[7],u=t[8],h=t[9],c=t[10],d=t[11];t!==e&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[4]=o*n+u*r,e[5]=s*n+h*r,e[6]=a*n+c*r,e[7]=l*n+d*r,e[8]=u*n-o*r,e[9]=h*n-s*r,e[10]=c*n-a*r,e[11]=d*n-l*r}(this,this,e),this.check()}rotateY(e){return function(e,t,i){var r=Math.sin(i),n=Math.cos(i),o=t[0],s=t[1],a=t[2],l=t[3],u=t[8],h=t[9],c=t[10],d=t[11];t!==e&&(e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=o*n-u*r,e[1]=s*n-h*r,e[2]=a*n-c*r,e[3]=l*n-d*r,e[8]=o*r+u*n,e[9]=s*r+h*n,e[10]=a*r+c*n,e[11]=l*r+d*n}(this,this,e),this.check()}rotateZ(e){return function(e,t,i){var r=Math.sin(i),n=Math.cos(i),o=t[0],s=t[1],a=t[2],l=t[3],u=t[4],h=t[5],c=t[6],d=t[7];t!==e&&(e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=o*n+u*r,e[1]=s*n+h*r,e[2]=a*n+c*r,e[3]=l*n+d*r,e[4]=u*n-o*r,e[5]=h*n-s*r,e[6]=c*n-a*r,e[7]=d*n-l*r}(this,this,e),this.check()}rotateXYZ(e){return this.rotateX(e[0]).rotateY(e[1]).rotateZ(e[2])}rotateAxis(e,t){return function(e,t,i,r){var n,o,s,a,l,u,h,c,d,p,f,A,g,m,v,y,b,x,w,E,M,S,C,I,B=r[0],T=r[1],P=r[2],R=Math.hypot(B,T,P);R<Mr||(B*=R=1/R,T*=R,P*=R,n=Math.sin(i),s=1-(o=Math.cos(i)),a=t[0],l=t[1],u=t[2],h=t[3],c=t[4],d=t[5],p=t[6],f=t[7],A=t[8],g=t[9],m=t[10],v=t[11],y=B*B*s+o,b=T*B*s+P*n,x=P*B*s-T*n,w=B*T*s-P*n,E=T*T*s+o,M=P*T*s+B*n,S=B*P*s+T*n,C=T*P*s-B*n,I=P*P*s+o,e[0]=a*y+c*b+A*x,e[1]=l*y+d*b+g*x,e[2]=u*y+p*b+m*x,e[3]=h*y+f*b+v*x,e[4]=a*w+c*E+A*M,e[5]=l*w+d*E+g*M,e[6]=u*w+p*E+m*M,e[7]=h*w+f*E+v*M,e[8]=a*S+c*C+A*I,e[9]=l*S+d*C+g*I,e[10]=u*S+p*C+m*I,e[11]=h*S+f*C+v*I,t!==e&&(e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]))}(this,this,e,t),this.check()}scale(e){return function(e,t,i){var r=i[0],n=i[1],o=i[2];e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*n,e[5]=t[5]*n,e[6]=t[6]*n,e[7]=t[7]*n,e[8]=t[8]*o,e[9]=t[9]*o,e[10]=t[10]*o,e[11]=t[11]*o,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]}(this,this,Array.isArray(e)?e:[e,e,e]),this.check()}translate(e){return function(e,t,i){var r,n,o,s,a,l,u,h,c,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]):(r=t[0],n=t[1],o=t[2],s=t[3],a=t[4],l=t[5],u=t[6],h=t[7],c=t[8],d=t[9],p=t[10],f=t[11],e[0]=r,e[1]=n,e[2]=o,e[3]=s,e[4]=a,e[5]=l,e[6]=u,e[7]=h,e[8]=c,e[9]=d,e[10]=p,e[11]=f,e[12]=r*A+a*g+c*m+t[12],e[13]=n*A+l*g+d*m+t[13],e[14]=o*A+u*g+p*m+t[14],e[15]=s*A+h*g+f*m+t[15])}(this,this,e),this.check()}transform(e,t){return 4===e.length?(t=function(e,t,i){var r=t[0],n=t[1],o=t[2],s=t[3];return e[0]=i[0]*r+i[4]*n+i[8]*o+i[12]*s,e[1]=i[1]*r+i[5]*n+i[9]*o+i[13]*s,e[2]=i[2]*r+i[6]*n+i[10]*o+i[14]*s,e[3]=i[3]*r+i[7]*n+i[11]*o+i[15]*s,e}(t||[-0,-0,-0,-0],e,this),xr(t,4),t):this.transformAsPoint(e,t)}transformAsPoint(e,t){const{length:i}=e;let r;switch(i){case 2:r=function(e,t,i){var r=t[0],n=t[1];return e[0]=i[0]*r+i[4]*n+i[12],e[1]=i[1]*r+i[5]*n+i[13],e}(t||[-0,-0],e,this);break;case 3:r=Pr(t||[-0,-0,-0],e,this);break;default:throw new Error("Illegal vector")}return xr(r,e.length),r}transformAsVector(e,t){let i;switch(e.length){case 2:i=function(e,t,i){const r=t[0],n=t[1],o=i[3]*r+i[7]*n||1;return e[0]=(i[0]*r+i[4]*n)/o,e[1]=(i[1]*r+i[5]*n)/o,e}(t||[-0,-0],e,this);break;case 3:i=Lr(t||[-0,-0,-0],e,this);break;default:throw new Error("Illegal vector")}return xr(i,e.length),i}transformPoint(e,t){return this.transformAsPoint(e,t)}transformVector(e,t){return this.transformAsPoint(e,t)}transformDirection(e,t){return this.transformAsVector(e,t)}makeRotationX(e){return this.identity().rotateX(e)}makeTranslation(e,t,i){return this.identity().translate([e,t,i])}}let Jr,$r;function en(e){if(e>2*Math.PI)throw Error("expected radians")}var tn=new Fr,rn=new Fr,nn=function(){function e(e,t){void 0===e&&(e=[0,0,1]),void 0===t&&(t=0),this.normal=new Fr,this.distance=-0,this.fromNormalDistance(e,t)}return e.prototype.fromNormalDistance=function(e,t){return this.normal.from(e).normalize(),this.distance=t,this},e.prototype.fromPointNormal=function(e,t){e=tn.from(e),this.normal.from(t).normalize();var i=-this.normal.dot(e);return this.distance=i,this},e.prototype.fromCoefficients=function(e,t,i,r){return this.normal.set(e,t,i),this.distance=r,this},e.prototype.clone=function(){return new e(this.normal,this.distance)},e.prototype.equals=function(e){return this.distance===e.distance&&this.normal.equals(e.normal)},e.prototype.getPointDistance=function(e){return this.normal.dot(e)+this.distance},e.prototype.transform=function(e){var t=rn.copy(this.normal).transformAsVector(e).normalize(),i=this.normal.scale(-this.distance).transform(e);return this.fromPointNormal(i,t)},e.prototype.projectPointOntoPlane=function(e,t){void 0===t&&(t=[0,0,0]),e=tn.from(e);var i=this.getPointDistance(e),r=rn.copy(this.normal).scale(i);return e.subtract(r).to(t)},e}(),on=Object.freeze({OUTSIDE:-1,INTERSECTING:0,INSIDE:1}),sn=[new Fr([1,0,0]),new Fr([0,1,0]),new Fr([0,0,1])],an=new Fr,ln=new Fr,un=function(){function e(e){void 0===e&&(e=[]),this.planes=e}return Object.defineProperty(e,"MASK_OUTSIDE",{get:function(){return 4294967295},enumerable:!1,configurable:!0}),Object.defineProperty(e,"MASK_INSIDE",{get:function(){return 0},enumerable:!1,configurable:!0}),Object.defineProperty(e,"MASK_INDETERMINATE",{get:function(){return 2147483647},enumerable:!1,configurable:!0}),e.prototype.fromBoundingSphere=function(e){this.planes.length=2*sn.length;for(var t=e.center,i=e.radius,r=0,n=0,o=sn;n<o.length;n++){var s=o[n],a=this.planes[r],l=this.planes[r+1];a||(a=this.planes[r]=new nn),l||(l=this.planes[r+1]=new nn);var u=an.copy(s).scale(-i).add(t);a.fromPointNormal(u,s);var h=an.copy(s).scale(i).add(t),c=ln.copy(s).negate();l.fromPointNormal(h,c),r+=2}return this},e.prototype.computeVisibilityWithPlaneMask=function(t,i){if(i===e.MASK_OUTSIDE||i===e.MASK_INSIDE)return i;for(var r=e.MASK_INSIDE,n=this.planes,o=0;o<this.planes.length;++o){var s=o<31?1<<o:0;if(!(o<31&&0==(i&s))){var a=n[o],l=t.intersectPlane(a);if(l===on.OUTSIDE)return e.MASK_OUTSIDE;l===on.INTERSECTING&&(r|=s)}}return r},e}();let hn;class cn extends Er{static get ZERO(){return hn||(hn=new cn(0,0,0,0),Object.freeze(hn)),hn}constructor(e=0,t=0,i=0,r=0){super(-0,-0,-0,-0),mr(e)&&1===arguments.length?this.copy(e):(Ar.debug&&(br(e),br(t),br(i),br(r)),this[0]=e,this[1]=t,this[2]=i,this[3]=r)}set(e,t,i,r){return this[0]=e,this[1]=t,this[2]=i,this[3]=r,this.check()}copy(e){return this[0]=e[0],this[1]=e[1],this[2]=e[2],this[3]=e[3],this.check()}fromObject(e){return Ar.debug&&(br(e.x),br(e.y),br(e.z),br(e.w)),this[0]=e.x,this[1]=e.y,this[2]=e.z,this[3]=e.w,this}toObject(e){return e.x=this[0],e.y=this[1],e.z=this[2],e.w=this[3],e}get ELEMENTS(){return 4}get z(){return this[2]}set z(e){this[2]=br(e)}get w(){return this[3]}set w(e){this[3]=br(e)}transform(e){return Pr(this,this,e),this.check()}transformByMatrix3(e){return Dr(this,this,e),this.check()}transformByMatrix2(e){return function(e,t,i){const r=t[0],n=t[1];e[0]=i[0]*r+i[2]*n,e[1]=i[1]*r+i[3]*n,e[2]=t[2],e[3]=t[3]}(this,this,e),this.check()}transformByQuaternion(e){return kr(this,this,e),this.check()}applyMatrix4(e){return e.transform(this,this),this}}function dn(e,t,i){var r=t[0],n=t[1],o=t[2],s=t[3],a=t[4],l=t[5],u=t[6],h=t[7],c=t[8],d=i[0],p=i[1],f=i[2],A=i[3],g=i[4],m=i[5],v=i[6],y=i[7],b=i[8];return e[0]=d*r+p*s+f*u,e[1]=d*n+p*a+f*h,e[2]=d*o+p*l+f*c,e[3]=A*r+g*s+m*u,e[4]=A*n+g*a+m*h,e[5]=A*o+g*l+m*c,e[6]=v*r+y*s+b*u,e[7]=v*n+y*a+b*h,e[8]=v*o+y*l+b*c,e}function pn(e,t,i){var r=i[0],n=i[1];return e[0]=r*t[0],e[1]=r*t[1],e[2]=r*t[2],e[3]=n*t[3],e[4]=n*t[4],e[5]=n*t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e}function fn(){var e=new Sr(4);return Sr!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function An(e,t,i){i*=.5;var r=Math.sin(i);return e[0]=r*t[0],e[1]=r*t[1],e[2]=r*t[2],e[3]=Math.cos(i),e}function gn(e,t,i){var r=t[0],n=t[1],o=t[2],s=t[3],a=i[0],l=i[1],u=i[2],h=i[3];return e[0]=r*h+s*a+n*u-o*l,e[1]=n*h+s*l+o*a-r*u,e[2]=o*h+s*u+r*l-n*a,e[3]=s*h-r*a-n*l-o*u,e}var mn,vn,yn,bn,xn=function(e){var t=e[0],i=e[1],r=e[2],n=e[3];return Math.hypot(t,i,r,n)},wn=function(e){var t=e[0],i=e[1],r=e[2],n=e[3];return t*t+i*i+r*r+n*n},En=(mn=Cr(),vn=Ir(1,0,0),yn=Ir(0,1,0),function(e,t,i){var r=Br(t,i);return r<-.999999?(Tr(mn,vn,t),function(e){var t=e[0],i=e[1],r=e[2];return Math.hypot(t,i,r)}(mn)<1e-6&&Tr(mn,yn,t),function(e,t){var i=t[0],r=t[1],n=t[2],o=i*i+r*r+n*n;o>0&&(o=1/Math.sqrt(o)),e[0]=t[0]*o,e[1]=t[1]*o,e[2]=t[2]*o}(mn,mn),An(e,mn,Math.PI),e):r>.999999?(e[0]=0,e[1]=0,e[2]=0,e[3]=1,e):(Tr(mn,t,i),e[0]=mn[0],e[1]=mn[1],e[2]=mn[2],e[3]=1+r,function(e,t){var i=t[0],r=t[1],n=t[2],o=t[3],s=i*i+r*r+n*n+o*o;return s>0&&(s=1/Math.sqrt(s)),e[0]=i*s,e[1]=r*s,e[2]=n*s,e[3]=o*s,e}(e,e))});fn(),fn(),bn=new Sr(9),Sr!=Float32Array&&(bn[1]=0,bn[2]=0,bn[3]=0,bn[5]=0,bn[6]=0,bn[7]=0),bn[0]=1,bn[4]=1,bn[8]=1;const Mn=[0,0,0,1];class Sn extends yr{constructor(e=0,t=0,i=0,r=1){super(-0,-0,-0,-0),Array.isArray(e)&&1===arguments.length?this.copy(e):this.set(e,t,i,r)}copy(e){return this[0]=e[0],this[1]=e[1],this[2]=e[2],this[3]=e[3],this.check()}set(e,t,i,r){return this[0]=e,this[1]=t,this[2]=i,this[3]=r,this.check()}fromObject(e){return this[0]=e.x,this[1]=e.y,this[2]=e.z,this[3]=e.w,this.check()}fromMatrix3(e){return function(e,t){var i,r=t[0]+t[4]+t[8];if(r>0)i=Math.sqrt(r+1),e[3]=.5*i,i=.5/i,e[0]=(t[5]-t[7])*i,e[1]=(t[6]-t[2])*i,e[2]=(t[1]-t[3])*i;else{var n=0;t[4]>t[0]&&(n=1),t[8]>t[3*n+n]&&(n=2);var o=(n+1)%3,s=(n+2)%3;i=Math.sqrt(t[3*n+n]-t[3*o+o]-t[3*s+s]+1),e[n]=.5*i,i=.5/i,e[3]=(t[3*o+s]-t[3*s+o])*i,e[o]=(t[3*o+n]+t[3*n+o])*i,e[s]=(t[3*s+n]+t[3*n+s])*i}}(this,e),this.check()}fromAxisRotation(e,t){return An(this,e,t),this.check()}identity(){return function(e){e[0]=0,e[1]=0,e[2]=0,e[3]=1}(this),this.check()}setAxisAngle(e,t){return this.fromAxisRotation(e,t)}get ELEMENTS(){return 4}get x(){return this[0]}set x(e){this[0]=br(e)}get y(){return this[1]}set y(e){this[1]=br(e)}get z(){return this[2]}set z(e){this[2]=br(e)}get w(){return this[3]}set w(e){this[3]=br(e)}len(){return xn(this)}lengthSquared(){return wn(this)}dot(e){return function(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]}(this,e)}rotationTo(e,t){return En(this,e,t),this.check()}add(e){return function(e,t,i){e[0]=t[0]+i[0],e[1]=t[1]+i[1],e[2]=t[2]+i[2],e[3]=t[3]+i[3]}(this,this,e),this.check()}calculateW(){return function(e,t){var i=t[0],r=t[1],n=t[2];e[0]=i,e[1]=r,e[2]=n,e[3]=Math.sqrt(Math.abs(1-i*i-r*r-n*n))}(this,this),this.check()}conjugate(){return function(e,t){e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3]}(this,this),this.check()}invert(){return function(e,t){var i=t[0],r=t[1],n=t[2],o=t[3],s=i*i+r*r+n*n+o*o,a=s?1/s:0;e[0]=-i*a,e[1]=-r*a,e[2]=-n*a,e[3]=o*a}(this,this),this.check()}lerp(e,t,i){return void 0===i?this.lerp(this,e,t):(function(e,t,i,r){var n=t[0],o=t[1],s=t[2],a=t[3];e[0]=n+r*(i[0]-n),e[1]=o+r*(i[1]-o),e[2]=s+r*(i[2]-s),e[3]=a+r*(i[3]-a)}(this,e,t,i),this.check())}multiplyRight(e){return gn(this,this,e),this.check()}multiplyLeft(e){return gn(this,e,this),this.check()}normalize(){const e=this.len(),t=e>0?1/e:0;return this[0]=this[0]*t,this[1]=this[1]*t,this[2]=this[2]*t,this[3]=this[3]*t,0===e&&(this[3]=1),this.check()}rotateX(e){return function(e,t,i){i*=.5;var r=t[0],n=t[1],o=t[2],s=t[3],a=Math.sin(i),l=Math.cos(i);e[0]=r*l+s*a,e[1]=n*l+o*a,e[2]=o*l-n*a,e[3]=s*l-r*a}(this,this,e),this.check()}rotateY(e){return function(e,t,i){i*=.5;var r=t[0],n=t[1],o=t[2],s=t[3],a=Math.sin(i),l=Math.cos(i);e[0]=r*l-o*a,e[1]=n*l+s*a,e[2]=o*l+r*a,e[3]=s*l-n*a}(this,this,e),this.check()}rotateZ(e){return function(e,t,i){i*=.5;var r=t[0],n=t[1],o=t[2],s=t[3],a=Math.sin(i),l=Math.cos(i);e[0]=r*l+n*a,e[1]=n*l-r*a,e[2]=o*l+s*a,e[3]=s*l-o*a}(this,this,e),this.check()}scale(e){return function(e,t,i){e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e[3]=t[3]*i}(this,this,e),this.check()}slerp(e,t,i){let r,n,o;switch(arguments.length){case 1:({start:r=Mn,target:n,ratio:o}=e);break;case 2:r=this,n=e,o=t;break;default:r=e,n=t,o=i}return function(e,t,i,r){var n,o,s,a,l,u=t[0],h=t[1],c=t[2],d=t[3],p=i[0],f=i[1],A=i[2],g=i[3];(o=u*p+h*f+c*A+d*g)<0&&(o=-o,p=-p,f=-f,A=-A,g=-g),1-o>Mr?(n=Math.acos(o),s=Math.sin(n),a=Math.sin((1-r)*n)/s,l=Math.sin(r*n)/s):(a=1-r,l=r),e[0]=a*u+l*p,e[1]=a*h+l*f,e[2]=a*c+l*A,e[3]=a*d+l*g}(this,r,n,o),this.check()}transformVector4(e,t=new cn){return function(e,t,i){var r=t[0],n=t[1],o=t[2],s=i[0],a=i[1],l=i[2],u=i[3],h=u*r+a*o-l*n,c=u*n+l*r-s*o,d=u*o+s*n-a*r,p=-s*r-a*n-l*o;e[0]=h*u+p*-s+c*-l-d*-a,e[1]=c*u+p*-a+d*-s-h*-l,e[2]=d*u+p*-l+h*-a-c*-s,e[3]=t[3]}(t,e,this),xr(t,4)}lengthSq(){return this.lengthSquared()}setFromAxisAngle(e,t){return this.setAxisAngle(e,t)}premultiply(e){return this.multiplyLeft(e)}multiply(e){return this.multiplyRight(e)}}var Cn;!function(e){e[e.COL0ROW0=0]="COL0ROW0",e[e.COL0ROW1=1]="COL0ROW1",e[e.COL0ROW2=2]="COL0ROW2",e[e.COL1ROW0=3]="COL1ROW0",e[e.COL1ROW1=4]="COL1ROW1",e[e.COL1ROW2=5]="COL1ROW2",e[e.COL2ROW0=6]="COL2ROW0",e[e.COL2ROW1=7]="COL2ROW1",e[e.COL2ROW2=8]="COL2ROW2"}(Cn||(Cn={}));const In=Object.freeze([1,0,0,0,1,0,0,0,1]);class Bn extends Ur{static get IDENTITY(){return Pn||(Pn=new Bn,Object.freeze(Pn)),Pn}static get ZERO(){return Tn||(Tn=new Bn([0,0,0,0,0,0,0,0,0]),Object.freeze(Tn)),Tn}get ELEMENTS(){return 9}get RANK(){return 3}get INDICES(){return Cn}constructor(e,...t){super(-0,-0,-0,-0,-0,-0,-0,-0,-0),1===arguments.length&&Array.isArray(e)?this.copy(e):t.length>0?this.copy([e,...t]):this.identity()}copy(e){return this[0]=e[0],this[1]=e[1],this[2]=e[2],this[3]=e[3],this[4]=e[4],this[5]=e[5],this[6]=e[6],this[7]=e[7],this[8]=e[8],this.check()}identity(){return this.copy(In)}fromObject(e){return this.check()}fromQuaternion(e){return function(e,t){var i=t[0],r=t[1],n=t[2],o=t[3],s=i+i,a=r+r,l=n+n,u=i*s,h=r*s,c=r*a,d=n*s,p=n*a,f=n*l,A=o*s,g=o*a,m=o*l;e[0]=1-c-f,e[3]=h-m,e[6]=d+g,e[1]=h+m,e[4]=1-u-f,e[7]=p-A,e[2]=d-g,e[5]=p+A,e[8]=1-u-c}(this,e),this.check()}set(e,t,i,r,n,o,s,a,l){return this[0]=e,this[1]=t,this[2]=i,this[3]=r,this[4]=n,this[5]=o,this[6]=s,this[7]=a,this[8]=l,this.check()}setRowMajor(e,t,i,r,n,o,s,a,l){return this[0]=e,this[1]=r,this[2]=s,this[3]=t,this[4]=n,this[5]=a,this[6]=i,this[7]=o,this[8]=l,this.check()}determinant(){return function(e){var t=e[0],i=e[1],r=e[2],n=e[3],o=e[4],s=e[5],a=e[6],l=e[7],u=e[8];return t*(u*o-s*l)+i*(-u*n+s*a)+r*(l*n-o*a)}(this)}transpose(){return function(e,t){if(e===t){var i=t[1],r=t[2],n=t[5];e[1]=t[3],e[2]=t[6],e[3]=i,e[5]=t[7],e[6]=r,e[7]=n}else e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8]}(this,this),this.check()}invert(){return function(e,t){var i=t[0],r=t[1],n=t[2],o=t[3],s=t[4],a=t[5],l=t[6],u=t[7],h=t[8],c=h*s-a*u,d=-h*o+a*l,p=u*o-s*l,f=i*c+r*d+n*p;f&&(f=1/f,e[0]=c*f,e[1]=(-h*r+n*u)*f,e[2]=(a*r-n*s)*f,e[3]=d*f,e[4]=(h*i-n*l)*f,e[5]=(-a*i+n*o)*f,e[6]=p*f,e[7]=(-u*i+r*l)*f,e[8]=(s*i-r*o)*f)}(this,this),this.check()}multiplyLeft(e){return dn(this,e,this),this.check()}multiplyRight(e){return dn(this,this,e),this.check()}rotate(e){return function(e,t,i){var r=t[0],n=t[1],o=t[2],s=t[3],a=t[4],l=t[5],u=t[6],h=t[7],c=t[8],d=Math.sin(i),p=Math.cos(i);e[0]=p*r+d*s,e[1]=p*n+d*a,e[2]=p*o+d*l,e[3]=p*s-d*r,e[4]=p*a-d*n,e[5]=p*l-d*o,e[6]=u,e[7]=h,e[8]=c}(this,this,e),this.check()}scale(e){return Array.isArray(e)?pn(this,this,e):pn(this,this,[e,e]),this.check()}translate(e){return function(e,t,i){var r=t[0],n=t[1],o=t[2],s=t[3],a=t[4],l=t[5],u=t[6],h=t[7],c=t[8],d=i[0],p=i[1];e[0]=r,e[1]=n,e[2]=o,e[3]=s,e[4]=a,e[5]=l,e[6]=d*r+p*s+u,e[7]=d*n+p*a+h,e[8]=d*o+p*l+c}(this,this,e),this.check()}transform(e,t){let i;switch(e.length){case 2:i=function(e,t,i){var r=t[0],n=t[1];return e[0]=i[0]*r+i[3]*n+i[6],e[1]=i[1]*r+i[4]*n+i[7],e}(t||[-0,-0],e,this);break;case 3:i=Rr(t||[-0,-0,-0],e,this);break;case 4:i=Dr(t||[-0,-0,-0,-0],e,this);break;default:throw new Error("Illegal vector")}return xr(i,e.length),i}transformVector(e,t){return this.transform(e,t)}transformVector2(e,t){return this.transform(e,t)}transformVector3(e,t){return this.transform(e,t)}}let Tn,Pn;var Rn=Object.freeze({OUTSIDE:-1,INTERSECTING:0,INSIDE:1}),kn=new Fr,Ln=new Fr,Dn=function(){function e(e,t){void 0===e&&(e=[0,0,0]),void 0===t&&(t=0),this.radius=-0,this.center=new Fr,this.fromCenterRadius(e,t)}return e.prototype.fromCenterRadius=function(e,t){return this.center.from(e),this.radius=t,this},e.prototype.fromCornerPoints=function(e,t){return t=kn.from(t),this.center=(new Fr).from(e).add(t).scale(.5),this.radius=this.center.distance(t),this},e.prototype.equals=function(e){return this===e||Boolean(e)&&this.center.equals(e.center)&&this.radius===e.radius},e.prototype.clone=function(){return new e(this.center,this.radius)},e.prototype.union=function(e){var t=this.center,i=this.radius,r=e.center,n=e.radius,o=kn.copy(r).subtract(t),s=o.magnitude();if(i>=s+n)return this.clone();if(n>=s+i)return e.clone();var a=.5*(i+s+n);return Ln.copy(o).scale((-i+a)/s).add(t),this.center.copy(Ln),this.radius=a,this},e.prototype.expand=function(e){var t=(e=kn.from(e)).subtract(this.center).magnitude();return t>this.radius&&(this.radius=t),this},e.prototype.transform=function(e){this.center.transform(e);var t=function(e,t){var i=t[0],r=t[1],n=t[2],o=t[4],s=t[5],a=t[6],l=t[8],u=t[9],h=t[10];return e[0]=Math.hypot(i,r,n),e[1]=Math.hypot(o,s,a),e[2]=Math.hypot(l,u,h),e}(kn,e);return this.radius=Math.max(t[0],Math.max(t[1],t[2]))*this.radius,this},e.prototype.distanceSquaredTo=function(e){var t=this.distanceTo(e);return t*t},e.prototype.distanceTo=function(e){var t=(e=kn.from(e)).subtract(this.center);return Math.max(0,t.len()-this.radius)},e.prototype.intersectPlane=function(e){var t=this.center,i=this.radius,r=e.normal.dot(t)+e.distance;return r<-i?Rn.OUTSIDE:r<i?Rn.INTERSECTING:Rn.INSIDE},e}(),On=Object.freeze({OUTSIDE:-1,INTERSECTING:0,INSIDE:1}),Nn=new Fr,Fn=new Fr,Qn=new Fr,Vn=new Fr,Hn=new Fr,qn=new Fr,zn=new Fr,Un=function(){function e(e,t){void 0===e&&(e=[0,0,0]),void 0===t&&(t=[0,0,0,0,0,0,0,0,0]),this.center=(new Fr).from(e),this.halfAxes=new Bn(t)}return Object.defineProperty(e.prototype,"halfSize",{get:function(){var e=this.halfAxes.getColumn(0),t=this.halfAxes.getColumn(1),i=this.halfAxes.getColumn(2);return[new Fr(e).len(),new Fr(t).len(),new Fr(i).len()]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"quaternion",{get:function(){var e=this.halfAxes.getColumn(0),t=this.halfAxes.getColumn(1),i=this.halfAxes.getColumn(2),r=new Fr(e).normalize(),n=new Fr(t).normalize(),o=new Fr(i).normalize();return(new Sn).fromMatrix3(new Bn(Fe(Fe(Fe([],r,!0),n,!0),o,!0)))},enumerable:!1,configurable:!0}),e.prototype.fromCenterHalfSizeQuaternion=function(e,t,i){var r=new Sn(i),n=(new Bn).fromQuaternion(r);return n[0]=n[0]*t[0],n[1]=n[1]*t[0],n[2]=n[2]*t[0],n[3]=n[3]*t[1],n[4]=n[4]*t[1],n[5]=n[5]*t[1],n[6]=n[6]*t[2],n[7]=n[7]*t[2],n[8]=n[8]*t[2],this.center=(new Fr).from(e),this.halfAxes=n,this},e.prototype.clone=function(){return new e(this.center,this.halfAxes)},e.prototype.equals=function(e){return this===e||Boolean(e)&&this.center.equals(e.center)&&this.halfAxes.equals(e.halfAxes)},e.prototype.getBoundingSphere=function(e){void 0===e&&(e=new Dn);var t=this.halfAxes,i=t.getColumn(0,Qn),r=t.getColumn(1,Vn),n=t.getColumn(2,Hn),o=Nn.copy(i).add(r).add(n);return e.center.copy(this.center),e.radius=o.magnitude(),e},e.prototype.intersectPlane=function(e){var t=this.center,i=e.normal,r=this.halfAxes,n=i.x,o=i.y,s=i.z,a=Math.abs(n*r[0]+o*r[1]+s*r[2])+Math.abs(n*r[3]+o*r[4]+s*r[5])+Math.abs(n*r[6]+o*r[7]+s*r[8]),l=i.dot(t)+e.distance;return l<=-a?On.OUTSIDE:l>=a?On.INSIDE:On.INTERSECTING},e.prototype.distanceTo=function(e){return Math.sqrt(this.distanceSquaredTo(e))},e.prototype.distanceSquaredTo=function(e){var t=Fn.from(e).subtract(this.center),i=this.halfAxes,r=i.getColumn(0,Qn),n=i.getColumn(1,Vn),o=i.getColumn(2,Hn),s=r.magnitude(),a=n.magnitude(),l=o.magnitude();r.normalize(),n.normalize(),o.normalize();var u,h=0;return(u=Math.abs(t.dot(r))-s)>0&&(h+=u*u),(u=Math.abs(t.dot(n))-a)>0&&(h+=u*u),(u=Math.abs(t.dot(o))-l)>0&&(h+=u*u),h},e.prototype.computePlaneDistances=function(e,t,i){void 0===i&&(i=[-0,-0]);var r=Number.POSITIVE_INFINITY,n=Number.NEGATIVE_INFINITY,o=this.center,s=this.halfAxes,a=s.getColumn(0,Qn),l=s.getColumn(1,Vn),u=s.getColumn(2,Hn),h=qn.copy(a).add(l).add(u).add(o),c=zn.copy(h).subtract(e),d=t.dot(c);return r=Math.min(d,r),n=Math.max(d,n),h.copy(o).add(a).add(l).subtract(u),c.copy(h).subtract(e),d=t.dot(c),r=Math.min(d,r),n=Math.max(d,n),h.copy(o).add(a).subtract(l).add(u),c.copy(h).subtract(e),d=t.dot(c),r=Math.min(d,r),n=Math.max(d,n),h.copy(o).add(a).subtract(l).subtract(u),c.copy(h).subtract(e),d=t.dot(c),r=Math.min(d,r),n=Math.max(d,n),o.copy(h).subtract(a).add(l).add(u),c.copy(h).subtract(e),d=t.dot(c),r=Math.min(d,r),n=Math.max(d,n),o.copy(h).subtract(a).add(l).subtract(u),c.copy(h).subtract(e),d=t.dot(c),r=Math.min(d,r),n=Math.max(d,n),o.copy(h).subtract(a).subtract(l).add(u),c.copy(h).subtract(e),d=t.dot(c),r=Math.min(d,r),n=Math.max(d,n),o.copy(h).subtract(a).subtract(l).subtract(u),c.copy(h).subtract(e),d=t.dot(c),r=Math.min(d,r),n=Math.max(d,n),i[0]=r,i[1]=n,i},e.prototype.transform=function(e){this.center.transformAsPoint(e);var t=this.halfAxes.getColumn(0,Qn);t.transformAsPoint(e);var i=this.halfAxes.getColumn(1,Vn);i.transformAsPoint(e);var r=this.halfAxes.getColumn(2,Hn);return r.transformAsPoint(e),this.halfAxes=new Bn(Fe(Fe(Fe([],t,!0),i,!0),r,!0)),this},e}();function jn(e,t){if(e.box)return function(e,t){var i=new Fr(e[0],e[1],e[2]);t.transform(i,i);var r=[];if(10===e.length){var n=e.slice(3,6),o=new Sn;o.fromArray(e,6);var s=new Fr([1,0,0]),a=new Fr([0,1,0]),l=new Fr([0,0,1]);s.transformByQuaternion(o),s.scale(n[0]),a.transformByQuaternion(o),a.scale(n[1]),l.transformByQuaternion(o),l.scale(n[2]),r=Fe(Fe(Fe([],s.toArray(),!0),a.toArray(),!0),l.toArray(),!0)}else r=Fe(Fe(Fe([],e.slice(3,6),!0),e.slice(6,9),!0),e.slice(9,12),!0);var u=t.transformAsVector(r.slice(0,3),[0,0,0]),h=t.transformAsVector(r.slice(3,6),[0,0,0]),c=t.transformAsVector(r.slice(6,9),[0,0,0]),d=new Bn([u[0],u[1],u[2],h[0],h[1],h[2],c[0],c[1],c[2]]);return new Un(i,d)}(e.box,t);throw new Error("3D Tile: boundingVolume must only can be box")}function Kn(e,t,i){var r=new TextDecoder("utf8"),n=new Uint8Array(e,t,i);return r.decode(n)}function _n(e,t,i){i=function(e,t,i){void 0===i&&(i=0);var r=new DataView(t);if(e.magic=r.getUint32(i,!0),i+=4,e.version=r.getUint32(i,!0),i+=4,e.byteLength=r.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 r,n=new DataView(t);e.header=e.header||{};var o=n.getUint32(i,!0);i+=4;var s=n.getUint32(i,!0);i+=4;var a=n.getUint32(i,!0);i+=4;var l=n.getUint32(i,!0);return i+=4,a>=570425344?(i-=8,r=o,a=s,l=0,o=0,s=0,console.warn("b3dm tile in legacy format.")):l>=570425344&&(i-=4,r=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=r,i}(e,t,i),i=function(e,t,i){void 0===i&&(i=0);var r=e.byteOffset+e.byteLength-i;if(0===r)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 r=void 0!==i?new Uint8Array(e).subarray(t,t+i):new Uint8Array(e).subarray(t);return new Uint8Array(r).buffer}(t,i,r),e.gltfByteOffset=0,e.gltfByteLength=r,i%4==0||console.warn("".concat(e.type,": embedded glb is not aligned to a 4-byte boundary.")),e.byteOffset+e.byteLength}(e,t,i=function(e,t,i){return void 0===i&&(i=0),i=function(e,t,i){void 0===i&&(i=0);var r=e.header,n=r.featureTableJsonByteLength,o=r.featureTableBinaryByteLength,s=r.batchLength;if(e.featureTableJson={BATCH_LENGTH:s||0},n>0){var a=Kn(t,i,n);e.featureTableJson=JSON.parse(a)}return i+=n,e.featureTableBinary=new Uint8Array(t,i,o),i+o}(e,t,i),i=function(e,t,i){void 0===i&&(i=0);var r=e.header,n=r.batchTableJsonByteLength,o=r.batchTableBinaryByteLength;if(n>0){var s=Kn(t,i,n);e.batchTableJson=JSON.parse(s),i+=n,o>0&&(e.batchTableBinary=new Uint8Array(t,i,o),e.batchTableBinary=new Uint8Array(e.batchTableBinary),i+=o)}return i}(e,t,i),i}(e,t,i));var r=e.featureTableJson.RTC_CENTER;return r&&Number.isFinite(r.byteOffset)&&(e.rtcCenter=new Float32Array(e.featureTableBinary.buffer,e.featureTableBinary.buffer.byteOffset+r.byteOffset,3)),i}var Gn=function(){function e(e,t,i){this.header=t,this.tileset=e,this.parent=i,this.children=[],this.contentState="UNLOADED",this.transform=this.header.transform?new Zr(this.header.transform.slice()):new Zr;var r=this.parent&&this.parent.computedTransform?this.parent.computedTransform.clone():e.modelMatrix.clone();this.computedTransform=new Zr(r).multiplyRight(this.transform),this.boundingVolume=jn(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=un.MASK_INDETERMINATE,this.visible=!1,this.selectionDepth=0,this.frameNumber=0,this.touchedFrameNumber=0,this.selectedFrameNumber=0,this.requestedFrameNumber=0}return Object.defineProperty(e.prototype,"id",{get:function(){return this.header.id},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"refine",{get:function(){return this.header.refine||this.parent&&this.parent.refine||"REPLACE"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"type",{get:function(){return this.header.type},enumerable:!1,configurable:!0}),Object.defineProperty(e.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 r=i.slice(4);i="https"+r}return i}return this.header.contentUrl},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lodMetricType",{get:function(){return this.header.lodMetricType},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lodMetricValue",{get:function(){return this.header.lodMetricValue},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasEmptyContent",{get:function(){return!this.header.contentUrl},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"selected",{get:function(){return this.selectedFrameNumber===this.tileset.frameNumber},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasRenderContent",{get:function(){return!this.hasEmptyContent},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasChildren",{get:function(){return this.children.length>0||this.header.children&&this.header.children.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"contentReady",{get:function(){return"READY"===this.contentState||this.hasEmptyContent},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"contentAvailable",{get:function(){return Boolean(this.contentReady&&this.hasRenderContent||!1)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasUnloadedContent",{get:function(){return this.hasRenderContent&&this.contentUnloaded},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"contentUnloaded",{get:function(){return"UNLOADED"===this.contentState},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"contentFailed",{get:function(){return"FAILED"===this.contentState},enumerable:!1,configurable:!0}),e.prototype.getScreenSpaceError=function(e,t){if("TILES3D"===this.tileset.type)return function(e,t,i){var r=e.tileset,n=e.parent&&e.parent.lodMetricValue||e.lodMetricValue,o=i?n:e.lodMetricValue;if(0===o)return 0;var s=Math.max(e.distanceToCamera,1e-7),a=r.options.viewDistanceScale;return o*t.height*a/(s*t.sseDenominator)-function(e,t){if(e.dynamicScreenSpaceError&&e.dynamicScreenSpaceErrorComputedDensity){var i=e.dynamicScreenSpaceErrorComputedDensity,r=e.dynamicScreenSpaceErrorFactor,n=function(e,t){var i=e*t;return 1-Math.exp(-i*i)}(t,i)*r;return n}return 0}(r,s)}(this,e,t);throw new Error("Unsupported tileset type")},e.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 r=this.parent,n=!r||i&&0!==this.screenSpaceError?this.screenSpaceError:r.screenSpaceError,o=e.root?e.root.screenSpaceError:0;return Math.max(o-n,0)},e.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?lt(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 _n(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))})))},e.prototype.unloadContent=function(){this.content=void 0,this.contentState="UNLOADED"},e.prototype.updateVisibility=function(e){if(this.frameNumber!==e.frameNumber){var t=this.parent,i=t?t.visibilityPlaneMask:un.MASK_INDETERMINATE,r=t?t.computedTransform:this.tileset.modelMatrix;this.updateTransform(r),this.distanceToCamera=this.distanceToTile(e),this.screenSpaceError=this.getScreenSpaceError(e,!1),this.visibilityPlaneMask=this.visibility(e,i),this.visible=this.visibilityPlaneMask!==un.MASK_OUTSIDE,this.frameNumber=e.frameNumber}},e.prototype.visibility=function(e,t){return e.cullingVolume.computeVisibilityWithPlaneMask(this.boundingVolume,t)},e.prototype.distanceToTile=function(e){return Math.sqrt(Math.max(this.boundingVolume.distanceSquaredTo(e.camera.position),0))},e.prototype.updateTransform=function(e){void 0===e&&(e=new Zr);var t=e.clone().multiplyRight(this.transform);!t.equals(this.computedTransform)&&(this.computedTransform.copy(t),this.boundingVolume=jn(this.header.boundingVolume,this.computedTransform))},e}(),Wn=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}(),Xn=function(){function e(e){this.options=e,this._traversalStack=new Wn,this._emptyTraversalStack=new Wn,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 r=i.pop(),n=!1;if(this.canTraverse(r,t)){this.updateChildTiles(r,t);var o=r.hasRenderContent?r.selectionDepth+1:r.selectionDepth;n=this.updateAndPushChildren(r,t,i,o)}var s=r.parent,a=Boolean(!s||s.shouldRefine),l=!n;r.hasRenderContent?"ADD"===r.refine?(this.loadTile(r,t),this.selectTile(r,t)):"REPLACE"===r.refine&&(this.loadTile(r,t),l&&this.selectTile(r,t)):(this.emptyTiles[r.id]=r,this.loadTile(r,t),l&&this.selectTile(r,t)),this.touchTile(r,t),r.shouldRefine=n&&a}this.options.onTraversalEnd(t)},e.prototype.updateChildTiles=function(e,t){for(var i=0,r=e.children;i<r.length;i++){var n=r[i];this.updateTile(n,t)}return!0},e.prototype.updateAndPushChildren=function(e,t,i,r){var n=this.options,o=n.loadSiblings,s=n.skipLevelOfDetail,a=e.children;a.sort(this.compareDistanceToCamera.bind(this));for(var l="REPLACE"===e.refine&&e.hasRenderContent&&!s,u=!1,h=!0,c=0,d=a;c<d.length;c++){var p=d[c];if(p.selectionDepth=r,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;if(f=p.hasRenderContent?p.contentAvailable:this.executeEmptyTraversal(p,t),!(h=h&&f))return!1}}return u||(h=!1),h},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,r){return void 0===i&&(i=!1),void 0===r&&(r=!1),!!e.hasChildren&&!(!r&&!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 r=e.screenSpaceError;return i&&(r=e.getScreenSpaceError(t,!0)),r>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,r=0,n=e.children;r<n.length;r++){var o=n[r];o.updateVisibility(t),i=i||o.visible}return i},e.prototype.everyChildrenVisibleIsLoaded=function(e){for(var t=!0,i=0,r=e.children;i<r.length;i++){var n=r[i];n.visible&&"READY"!==n.contentState&&(t=!1)}return t},e.prototype.executeEmptyTraversal=function(e,t){var i=!0,r=this._emptyTraversalStack;for(r.push(e);r.length>0&&i;){var n=r.pop();if(this.updateTile(n,t),n.visible||this.loadTile(n,t),this.touchTile(n,t),!n.hasRenderContent&&this.canTraverse(n,t,!1,!0))for(var o=0,s=n.children;o<s.length;o++){var a=s[o];r.find(a)&&r.delete(a),r.push(a)}else n.contentAvailable||(i=!1)}return i},e}();function Yn(e){for(var t=[],i=0,r=Object.keys(e);i<r.length;i++){var n=r[i];t.push(e[n])}return t}var Zn=function(){function e(e,t){var i=this;this.rawJson=e,this.b3dmMapping=e.b3dmMapping,this.options=t,this.traverser=new Xn({loadSiblings:!1,maxScreenSpaceError:this.options.maxScreenSpaceError,skipLevelOfDetail:!1,maxDepth:this.options.maxDepth,onTraversalEnd:function(e){return i.onTraversalEnd(e)}}),this.cache=new zr,this.requestScheduler=new Vr({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 Gn(this,e.root);for(var r=[this.root];r.length>0;)for(var n=r.pop(),o=0,s=n.header.children||[];o<s.length;o++){var a=s[o],l=new Gn(this,a,n);l.depth=n.depth+1,n.children.push(l),r.push(l)}}return Object.defineProperty(e.prototype,"maxMemoryUsage",{get:function(){return this.options.maxMemoryUsage},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"asset",{get:function(){return this.rawJson.asset},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"type",{get:function(){return this.rawJson.type},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"basePath",{get:function(){return this.rawJson.basePath},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"modelMatrix",{get:function(){return this.options.modelMatrix},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"geometricError",{get:function(){return this.rawJson.geometricError},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lodMetricType",{get:function(){return this.rawJson.lodMetricType},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lodMetricValue",{get:function(){return this.rawJson.lodMetricValue},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"refine",{get:function(){return this.rawJson.root.refine},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"tiles",{get:function(){return Yn(this._tiles)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"floorInfo",{get:function(){return this.rawJson.floorInfo||this.rawJson.floor_info||[]},enumerable:!1,configurable:!0}),e.prototype.reset=function(){for(var e=[this.root];e.length>0;){for(var t=e.pop(),i=0,r=t.children;i<r.length;i++){var n=r[i];e.push(n)}this.cache.unloadTile(t),this.unloadTile(t)}this.cache.reset(),this.traverser.reset(),this.selectedTiles=[],this.requestedTiles=[]},e.prototype.isLoaded=function(){return 0===this.pendingCount&&0!==this.frameNumber},e.prototype.onTraversalEnd=function(e){var t=this,i=new Fr(e.camera.position);this.selectedTiles=this.options.onTraversalComplete(Yn(this.traverser.selectedTiles)),this.requestedTiles=Yn(this.traverser.requestedTiles).slice().sort((function(e,t){return e.boundingVolume.center.distanceTo(i)-t.boundingVolume.center.distanceTo(i)}));for(var r=0,n=this.selectedTiles;r<n.length;r++){var o=n[r];this._tiles[o.id]=o}for(var s=0,a=this.requestedTiles;s<a.length;s++)(o=a[s]).contentUnloaded&&this.loadTile(o);this.cache.unloadTiles((function(){return t.memoryUsageInBytes>1024*t.maxMemoryUsage*1024}),(function(e){return t.unloadTile(e)}))},e.prototype.loadTile=function(e){var t=this;this.pendingCount++,e.loadContent().catch((function(i){var r=i.message||i.toString();return console.error("A 3D tile failed to load: ".concat(e.id," ").concat(r)),t.options.onTileError(e,r),!1})).then((function(i){t.pendingCount--,i&&(t.cache.add(e,(function(){e.content&&(t.memoryUsageInBytes+=e.content.byteLength||0)})),t.options.onTileLoad(e))}))},e.prototype.unloadTile=function(e){this.memoryUsageInBytes-=e.content&&e.content.byteLength||0,this.options.onTileUnload(e),e.unloadContent()},e}();function Jn(){return(65536*(1+Math.random())|0).toString(16).substring(1)}function $n(){return(Jn()+Jn()+"-"+Jn()+"-4"+Jn().substr(0,3)+"-"+Jn()+"-"+Jn()+Jn()+Jn()).toLowerCase()}function eo(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:"+$n(),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}var to=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,r,n){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){n?n(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)}}),r,a)},setDRACOLoader:function(e){return this.dracoLoader=e,this},setDDSLoader:function(e){return this.ddsLoader=e,this},parse:function(t,i,d,A){var g,m={};if("string"==typeof t)g=t;else if(e.LoaderUtils.decodeText(new Uint8Array(t,0,4))===l){try{m[r.KHR_BINARY_GLTF]=new u(t)}catch(e){return void(A&&A(e))}g=m[r.KHR_BINARY_GLTF].content}else g=e.LoaderUtils.decodeText(new Uint8Array(t));var v=JSON.parse(g);if(void 0===v.asset||v.asset.version[0]<2)A&&A(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 r.KHR_LIGHTS_PUNCTUAL:m[b]=new o(v);break;case r.KHR_MATERIALS_CLEARCOAT:m[b]=new a;break;case r.KHR_MATERIALS_UNLIT:m[b]=new s;break;case r.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:m[b]=new p;break;case r.KHR_DRACO_MESH_COMPRESSION:m[b]=new h(v,this.dracoLoader);break;case r.MSFT_TEXTURE_DDS:m[b]=new n(this.ddsLoader);break;case r.KHR_TEXTURE_TRANSFORM:m[b]=new c;break;case r.KHR_MESH_QUANTIZATION:m[b]=new f;break;default:x.indexOf(b)>=0&&console.warn('THREE.GLTFLoader: Unknown extension "'+b+'".')}}var w=new T(v,m,{path:i||this.resourcePath||"",crossOrigin:this.crossOrigin,manager:this.manager});w.fileLoader.setRequestHeader(this.requestHeader),w.parse(d,A)}}});var r={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 n(e){if(!e)throw new Error("THREE.GLTFLoader: Attempting to load .dds texture without importing DDSLoader");this.name=r.MSFT_TEXTURE_DDS,this.ddsLoader=e}function o(e){this.name=r.KHR_LIGHTS_PUNCTUAL;var t=e.extensions&&e.extensions[r.KHR_LIGHTS_PUNCTUAL]||{};this.lightDefs=t.lights||[]}function s(){this.name=r.KHR_MATERIALS_UNLIT}function a(){this.name=r.KHR_MATERIALS_CLEARCOAT}o.prototype.loadLight=function(t){var i,r=this.lightDefs[t],n=new e.Color(16777215);void 0!==r.color&&n.fromArray(r.color);var o=void 0!==r.range?r.range:0;switch(r.type){case"directional":(i=new e.DirectionalLight(n)).target.position.set(0,0,-1),i.add(i.target);break;case"point":(i=new e.PointLight(n)).distance=o;break;case"spot":(i=new e.SpotLight(n)).distance=o,r.spot=r.spot||{},r.spot.innerConeAngle=void 0!==r.spot.innerConeAngle?r.spot.innerConeAngle:0,r.spot.outerConeAngle=void 0!==r.spot.outerConeAngle?r.spot.outerConeAngle:Math.PI/4,i.angle=r.spot.outerConeAngle,i.penumbra=1-r.spot.innerConeAngle/r.spot.outerConeAngle,i.target.position.set(0,0,-1),i.add(i.target);break;default:throw new Error('THREE.GLTFLoader: Unexpected light type, "'+r.type+'".')}return i.position.set(0,0,0),i.decay=2,void 0!==r.intensity&&(i.intensity=r.intensity),i.name=r.name||"light_"+t,Promise.resolve(i)},s.prototype.getMaterialType=function(){return e.MeshBasicMaterial},s.prototype.extendParams=function(t,i,r){var n=[];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&&n.push(r.assignTexture(t,"map",o.baseColorTexture))}return Promise.all(n)},a.prototype.getMaterialType=function(){return e.MeshPhysicalMaterial},a.prototype.extendParams=function(t,i,r){var n=[],o=i.extensions[this.name];if(void 0!==o.clearcoatFactor&&(t.clearcoat=o.clearcoatFactor),void 0!==o.clearcoatTexture&&n.push(r.assignTexture(t,"clearcoatMap",o.clearcoatTexture)),void 0!==o.clearcoatRoughnessFactor&&(t.clearcoatRoughness=o.clearcoatRoughnessFactor),void 0!==o.clearcoatRoughnessTexture&&n.push(r.assignTexture(t,"clearcoatRoughnessMap",o.clearcoatRoughnessTexture)),void 0!==o.clearcoatNormalTexture&&(n.push(r.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(n)};var l="glTF";function u(t){this.name=r.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 n=new DataView(t,12),o=0;o<n.byteLength;){var s=n.getUint32(o,!0);o+=4;var a=n.getUint32(o,!0);if(o+=4,1313821514===a){var u=new Uint8Array(t,12+o,s);this.content=e.LoaderUtils.decodeText(u)}else if(5130562===a){var h=12+o;this.body=t.slice(h,h+s)}o+=s}if(null===this.content)throw new Error("THREE.GLTFLoader: JSON content not found.")}function h(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=r.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}function c(){this.name=r.KHR_TEXTURE_TRANSFORM}function d(t){e.MeshStandardMaterial.call(this),this.isGLTFSpecularGlossinessMaterial=!0;var i=["#ifdef USE_SPECULARMAP","\tuniform sampler2D specularMap;","#endif"].join("\n"),r=["#ifdef USE_GLOSSINESSMAP","\tuniform sampler2D glossinessMap;","#endif"].join("\n"),n=["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>",r),e.fragmentShader=e.fragmentShader.replace("#include <roughnessmap_fragment>",n),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 p(){return{name:r.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 d},extendParams:function(t,i,r){var n=i.extensions[this.name];t.color=new e.Color(1,1,1),t.opacity=1;var o=[];if(Array.isArray(n.diffuseFactor)){var s=n.diffuseFactor;t.color.fromArray(s),t.opacity=s[3]}if(void 0!==n.diffuseTexture&&o.push(r.assignTexture(t,"map",n.diffuseTexture)),t.emissive=new e.Color(0,0,0),t.glossiness=void 0!==n.glossinessFactor?n.glossinessFactor:1,t.specular=new e.Color(1,1,1),Array.isArray(n.specularFactor)&&t.specular.fromArray(n.specularFactor),void 0!==n.specularGlossinessTexture){var a=n.specularGlossinessTexture;o.push(r.assignTexture(t,"glossinessMap",a)),o.push(r.assignTexture(t,"specularMap",a))}return Promise.all(o)},createMaterial:function(t){var i=new d(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 f(){this.name=r.KHR_MESH_QUANTIZATION}function A(t,i,r,n){e.Interpolant.call(this,t,i,r,n)}h.prototype.decodePrimitive=function(e,t){var i=this.json,r=this.dracoLoader,n=e.extensions[this.name].bufferView,o=e.extensions[this.name].attributes,s={},a={},l={};for(var u in o){var h=b[u]||u.toLowerCase();s[h]=o[u]}for(u in e.attributes)if(h=b[u]||u.toLowerCase(),void 0!==o[u]){var c=i.accessors[e.attributes[u]],d=g[c.componentType];l[h]=d,a[h]=!0===c.normalized}return t.getDependency("bufferView",n).then((function(e){return new Promise((function(t){r.decodeDracoFile(e,(function(e){for(var i in e.attributes){var r=e.attributes[i],n=a[i];void 0!==n&&(r.normalized=n)}t(e)}),s,l)}))}))},c.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},d.prototype=Object.create(e.MeshStandardMaterial.prototype),d.prototype.constructor=d,d.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},A.prototype=Object.create(e.Interpolant.prototype),A.prototype.constructor=A,A.prototype.copySampleValue_=function(e){for(var t=this.resultBuffer,i=this.sampleValues,r=this.valueSize,n=e*r*3+r,o=0;o!==r;o++)t[o]=i[n+o];return t},A.prototype.beforeStart_=A.prototype.copySampleValue_,A.prototype.afterEnd_=A.prototype.copySampleValue_,A.prototype.interpolate_=function(e,t,i,r){for(var n=this.resultBuffer,o=this.sampleValues,s=this.valueSize,a=2*s,l=3*s,u=r-t,h=(i-t)/u,c=h*h,d=c*h,p=e*l,f=p-l,A=-2*d+3*c,g=d-c,m=1-A,v=g-c+h,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;n[y]=m*b+v*x+A*w+g*E}return n};var g={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},m={9728:e.NearestFilter,9729:e.LinearFilter,9984:e.NearestMipmapNearestFilter,9985:e.LinearMipmapNearestFilter,9986:e.NearestMipmapLinearFilter,9987:e.LinearMipmapLinearFilter},v={33071:e.ClampToEdgeWrapping,33648:e.MirroredRepeatWrapping,10497:e.RepeatWrapping},y={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},b={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv2",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},x={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},w={CUBICSPLINE:void 0,LINEAR:e.InterpolateLinear,STEP:e.InterpolateDiscrete},E={"image/png":e.RGBAFormat,"image/jpeg":e.RGBFormat};function M(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 S(e,t,i){for(var r in i.extensions)void 0===e[r]&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[r]=i.extensions[r])}function C(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 I(e,t){if(e.updateMorphTargets(),void 0!==t.weights)for(var i=0,r=t.weights.length;i<r;i++)e.morphTargetInfluences[i]=t.weights[i];if(t.extras&&Array.isArray(t.extras.targetNames)){var n=t.extras.targetNames;if(e.morphTargetInfluences.length===n.length)for(e.morphTargetDictionary={},i=0,r=n.length;i<r;i++)e.morphTargetDictionary[n[i]]=i;else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function B(e){for(var t="",i=Object.keys(e).sort(),r=0,n=i.length;r<n;r++)t+=i[r]+":"+e[i[r]]+";";return t}function T(t,r,n){this.json=t||{},this.extensions=r||{},this.options=n||{},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 P(t,i,r){var n=i.attributes,o=[];function s(e,i){return r.getDependency("accessor",e).then((function(e){t.setAttribute(i,e)}))}for(var a in n){var l=b[a]||a.toLowerCase();l in t.attributes||o.push(s(n[a],l))}if(void 0!==i.indices&&!t.index){var u=r.getDependency("accessor",i.indices).then((function(e){t.setIndex(e)}));o.push(u)}return C(t,i),function(t,i,r){var n=i.attributes,o=new e.Box3;if(void 0!==n.POSITION){var s=(p=r.json.accessors[n.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,h=new e.Vector3,c=0,d=l.length;c<d;c++){var p,f=l[c];void 0!==f.POSITION&&(s=(p=r.json.accessors[f.POSITION]).min,a=p.max,void 0!==s&&void 0!==a?(h.setX(Math.max(Math.abs(s[0]),Math.abs(a[0]))),h.setY(Math.max(Math.abs(s[1]),Math.abs(a[1]))),h.setZ(Math.max(Math.abs(s[2]),Math.abs(a[2]))),u.max(h)):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,r),Promise.all(o).then((function(){return void 0!==i.targets?function(e,t,i){for(var r=!1,n=!1,o=0,s=t.length;o<s&&(void 0!==(u=t[o]).POSITION&&(r=!0),void 0!==u.NORMAL&&(n=!0),!r||!n);o++);if(!r&&!n)return Promise.resolve(e);var a=[],l=[];for(o=0,s=t.length;o<s;o++){var u=t[o];if(r){var h=void 0!==u.POSITION?i.getDependency("accessor",u.POSITION):e.attributes.position;a.push(h)}n&&(h=void 0!==u.NORMAL?i.getDependency("accessor",u.NORMAL):e.attributes.normal,l.push(h))}return Promise.all([Promise.all(a),Promise.all(l)]).then((function(t){var i=t[0],o=t[1];return r&&(e.morphAttributes.position=i),n&&(e.morphAttributes.normal=o),e.morphTargetsRelative=!0,e}))}(t,i.targets,r):t}))}function R(t,i){var r=t.getIndex();if(null===r){var n=[],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++)n.push(s);t.setIndex(n),r=t.getIndex()}var a=r.count-2,l=[];if(i===e.TriangleFanDrawMode)for(s=1;s<=a;s++)l.push(r.getX(0)),l.push(r.getX(s)),l.push(r.getX(s+1));else for(s=0;s<a;s++)s%2==0?(l.push(r.getX(s)),l.push(r.getX(s+1)),l.push(r.getX(s+2))):(l.push(r.getX(s+2)),l.push(r.getX(s+1)),l.push(r.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 T.prototype.parse=function(e,t){var i=this,r=this.json,n=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][r.scene||0],scenes:t[0],animations:t[1],cameras:t[2],asset:r.asset,parser:i,userData:{}};S(n,o,r),C(o,r),e(o)})).catch(t)},T.prototype.markDefs=function(){for(var e=this.json.nodes||[],t=this.json.skins||[],i=this.json.meshes||[],r={},n={},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 h=0,c=e.length;h<c;h++){var d=e[h];void 0!==d.mesh&&(void 0===r[d.mesh]&&(r[d.mesh]=n[d.mesh]=0),r[d.mesh]++,void 0!==d.skin&&(i[d.mesh].isSkinnedMesh=!0))}this.json.meshReferences=r,this.json.meshUses=n},T.prototype.getDependency=function(e,t){var i=e+":"+t,n=this.cache.get(i);if(!n){switch(e){case"scene":n=this.loadScene(t);break;case"node":n=this.loadNode(t);break;case"mesh":n=this.loadMesh(t);break;case"accessor":n=this.loadAccessor(t);break;case"bufferView":n=this.loadBufferView(t);break;case"buffer":n=this.loadBuffer(t);break;case"material":n=this.loadMaterial(t);break;case"texture":n=this.loadTexture(t);break;case"skin":n=this.loadSkin(t);break;case"animation":n=this.loadAnimation(t);break;case"camera":n=this.loadCamera(t);break;case"light":n=this.extensions[r.KHR_LIGHTS_PUNCTUAL].loadLight(t);break;default:throw new Error("Unknown type: "+e)}this.cache.add(i,n)}return n},T.prototype.getDependencies=function(e){var t=this.cache.get(e);if(!t){var i=this,r=this.json[e+("mesh"===e?"es":"s")]||[];t=Promise.all(r.map((function(t,r){return i.getDependency(e,r)}))),this.cache.add(e,t)}return t},T.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[r.KHR_BINARY_GLTF].body);var n=this.options;return new Promise((function(e,r){i.load(M(t.uri,n.path),e,void 0,(function(){r(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))}))}))},T.prototype.loadBufferView=function(e){var t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then((function(e){var i=t.byteLength||0,r=t.byteOffset||0;return e.slice(r,r+i)}))},T.prototype.loadAccessor=function(t){var i=this,r=this.json,n=this.json.accessors[t];if(void 0===n.bufferView&&void 0===n.sparse)return Promise.resolve(null);var o=[];return void 0!==n.bufferView?o.push(this.getDependency("bufferView",n.bufferView)):o.push(null),void 0!==n.sparse&&(o.push(this.getDependency("bufferView",n.sparse.indices.bufferView)),o.push(this.getDependency("bufferView",n.sparse.values.bufferView))),Promise.all(o).then((function(t){var o,s,a=t[0],l=y[n.type],u=g[n.componentType],h=u.BYTES_PER_ELEMENT,c=h*l,d=n.byteOffset||0,p=void 0!==n.bufferView?r.bufferViews[n.bufferView].byteStride:void 0,f=!0===n.normalized;if(p&&p!==c){var A=Math.floor(d/p),m="InterleavedBuffer:"+n.bufferView+":"+n.componentType+":"+A+":"+n.count,v=i.cache.get(m);v||(o=new u(a,A*p,n.count*p/h),v=new e.InterleavedBuffer(o,p/h),i.cache.add(m,v)),s=new e.InterleavedBufferAttribute(v,l,d%p/h,f)}else o=null===a?new u(n.count*l):new u(a,d,n.count*l),s=new e.BufferAttribute(o,l,f);if(void 0!==n.sparse){var b=y.SCALAR,x=g[n.sparse.indices.componentType],w=n.sparse.indices.byteOffset||0,E=n.sparse.values.byteOffset||0,M=new x(t[1],w,n.sparse.count*b),S=new u(t[2],E,n.sparse.count*l);null!==a&&(s=new e.BufferAttribute(s.array.slice(),s.itemSize,s.normalized));for(var C=0,I=M.length;C<I;C++){var B=M[C];if(s.setX(B,S[C*l]),l>=2&&s.setY(B,S[C*l+1]),l>=3&&s.setZ(B,S[C*l+2]),l>=4&&s.setW(B,S[C*l+3]),l>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return s}))},T.prototype.loadTexture=function(t){var i,n=this,o=this.json,s=this.options,a=this.textureLoader,l=self.URL||self.webkitURL,u=o.textures[t],h=u.extensions||{},c=(i=h[r.MSFT_TEXTURE_DDS]?o.images[h[r.MSFT_TEXTURE_DDS].source]:o.images[u.source]).uri,d=!1;return void 0!==i.bufferView&&(c=n.getDependency("bufferView",i.bufferView).then((function(e){d=!0;var t=new Blob([e],{type:i.mimeType});return c=l.createObjectURL(t)}))),Promise.resolve(c).then((function(e){var t=s.manager.getHandler(e);return t||(t=h[r.MSFT_TEXTURE_DDS]?n.extensions[r.MSFT_TEXTURE_DDS].ddsLoader:a),new Promise((function(i,r){t.load(M(e,s.path),i,void 0,r)}))})).then((function(r){!0===d&&l.revokeObjectURL(c),r.flipY=!1,u.name&&(r.name=u.name),i.mimeType in E&&(r.format=E[i.mimeType]);var s=(o.samplers||{})[u.sampler]||{};return r.magFilter=m[s.magFilter]||e.LinearFilter,r.minFilter=m[s.minFilter]||e.LinearMipmapLinearFilter,r.wrapS=v[s.wrapS]||e.RepeatWrapping,r.wrapT=v[s.wrapT]||e.RepeatWrapping,n.associations.set(r,{type:"textures",index:t}),r}))},T.prototype.assignTexture=function(t,i,n){var o=this;return this.getDependency("texture",n.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===n.texCoord||0==n.texCoord||"aoMap"===i&&1==n.texCoord||console.warn("THREE.GLTFLoader: Custom UV set "+n.texCoord+" for texture "+i+" not yet supported."),o.extensions[r.KHR_TEXTURE_TRANSFORM]){var a=void 0!==n.extensions?n.extensions[r.KHR_TEXTURE_TRANSFORM]:void 0;if(a){var l=this.associations.get(s);s=o.extensions[r.KHR_TEXTURE_TRANSFORM].extendTexture(s,a),this.associations.set(s,l)}}t[i]=s}))},T.prototype.assignFinalMaterial=function(t){var i=t.geometry,r=t.material,n=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 h="PointsMaterial:"+r.uuid,c=this.cache.get(h);c||(c=new e.PointsMaterial,e.Material.prototype.copy.call(c,r),c.color.copy(r.color),c.map=r.map,c.sizeAttenuation=!1,this.cache.add(h,c)),r=c}else if(t.isLine){h="LineBasicMaterial:"+r.uuid;var d=this.cache.get(h);d||(d=new e.LineBasicMaterial,e.Material.prototype.copy.call(d,r),d.color.copy(r.color),this.cache.add(h,d)),r=d}if(n||o||s||a||l){h="ClonedMaterial:"+r.uuid+":",r.isGLTFSpecularGlossinessMaterial&&(h+="specular-glossiness:"),a&&(h+="skinning:"),n&&(h+="vertex-tangents:"),o&&(h+="vertex-colors:"),s&&(h+="flat-shading:"),l&&(h+="morph-targets:"),u&&(h+="morph-normals:");var p=this.cache.get(h);p||(p=r.clone(),a&&(p.skinning=!0),n&&(p.vertexTangents=!0),o&&(p.vertexColors=!0),s&&(p.flatShading=!0),l&&(p.morphTargets=!0),u&&(p.morphNormals=!0),this.cache.add(h,p),this.associations.set(p,this.associations.get(r))),r=p}r.aoMap&&void 0===i.attributes.uv2&&void 0!==i.attributes.uv&&i.setAttribute("uv2",i.attributes.uv),r.normalScale&&!n&&(r.normalScale.y=-r.normalScale.y),r.clearcoatNormalScale&&!n&&(r.clearcoatNormalScale.y=-r.clearcoatNormalScale.y),t.material=r},T.prototype.loadMaterial=function(t){var i,n=this,o=this.json,s=this.extensions,a=o.materials[t],l={},u=a.extensions||{},h=[];if(u[r.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS]){var c=s[r.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS];i=c.getMaterialType(),h.push(c.extendParams(l,a,n))}else if(u[r.KHR_MATERIALS_UNLIT]){var p=s[r.KHR_MATERIALS_UNLIT];i=p.getMaterialType(),h.push(p.extendParams(l,a,n))}else{i=e.MeshStandardMaterial;var f=a.pbrMetallicRoughness||{};if(l.color=new e.Color(1,1,1),l.opacity=1,Array.isArray(f.baseColorFactor)){var A=f.baseColorFactor;l.color.fromArray(A),l.opacity=A[3]}void 0!==f.baseColorTexture&&h.push(n.assignTexture(l,"map",f.baseColorTexture)),l.metalness=void 0!==f.metallicFactor?f.metallicFactor:1,l.roughness=void 0!==f.roughnessFactor?f.roughnessFactor:1,void 0!==f.metallicRoughnessTexture&&(h.push(n.assignTexture(l,"metalnessMap",f.metallicRoughnessTexture)),h.push(n.assignTexture(l,"roughnessMap",f.metallicRoughnessTexture)))}!0===a.doubleSided&&(l.side=e.DoubleSide);var g=a.alphaMode||"OPAQUE";if("BLEND"===g?(l.transparent=!0,l.depthWrite=!1):(l.transparent=!1,"MASK"===g&&(l.alphaTest=void 0!==a.alphaCutoff?a.alphaCutoff:.5)),void 0!==a.normalTexture&&i!==e.MeshBasicMaterial&&(h.push(n.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&&(h.push(n.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&&h.push(n.assignTexture(l,"emissiveMap",a.emissiveTexture)),u[r.KHR_MATERIALS_CLEARCOAT]){var m=s[r.KHR_MATERIALS_CLEARCOAT];i=m.getMaterialType(),h.push(m.extendParams(l,{extensions:u},n))}return Promise.all(h).then((function(){var o;return o=i===d?s[r.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),C(o,a),n.associations.set(o,{type:"materials",index:t}),a.extensions&&S(s,o,a),o}))},T.prototype.loadGeometries=function(t){var i=this,n=this.extensions,o=this.primitiveCache;function s(e){return n[r.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,i).then((function(t){return P(t,e,i)}))}for(var a,l,u=[],h=0,c=t.length;h<c;h++){var d,p=t[h],f=(void 0,(l=(a=p).extensions&&a.extensions[r.KHR_DRACO_MESH_COMPRESSION])?"draco:"+l.bufferView+":"+l.indices+":"+B(l.attributes):a.indices+":"+B(a.attributes)+":"+a.mode),A=o[f];A?u.push(A.promise):(d=p.extensions&&p.extensions[r.KHR_DRACO_MESH_COMPRESSION]?s(p):P(new e.BufferGeometry,p,i),o[f]={primitive:p,promise:d},u.push(d))}return Promise.all(u)},T.prototype.loadMesh=function(t){for(var i,r=this,n=this.json.meshes[t],o=n.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(r.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,h=a.length;u<h;u++){var c,d=a[u],p=o[u],f=s[u];if(4===p.mode||5===p.mode||6===p.mode||void 0===p.mode)!0!==(c=!0===n.isSkinnedMesh?new e.SkinnedMesh(d,f):new e.Mesh(d,f)).isSkinnedMesh||c.geometry.attributes.skinWeight.normalized||c.normalizeSkinWeights(),5===p.mode?c.geometry=R(c.geometry,e.TriangleStripDrawMode):6===p.mode&&(c.geometry=R(c.geometry,e.TriangleFanDrawMode));else if(1===p.mode)c=new e.LineSegments(d,f);else if(3===p.mode)c=new e.Line(d,f);else if(2===p.mode)c=new e.LineLoop(d,f);else{if(0!==p.mode)throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+p.mode);c=new e.Points(d,f)}Object.keys(c.geometry.morphAttributes).length>0&&I(c,n),c.name=n.name||"mesh_"+t,a.length>1&&(c.name+="_"+u),C(c,n),r.assignFinalMaterial(c),l.push(c)}if(1===l.length)return l[0];var A=new e.Group;for(u=0,h=l.length;u<h;u++)A.add(l[u]);return A}))},T.prototype.loadCamera=function(t){var i,r=this.json.cameras[t],n=r[r.type];if(n)return"perspective"===r.type?i=new e.PerspectiveCamera(e.MathUtils.radToDeg(n.yfov),n.aspectRatio||1,n.znear||1,n.zfar||2e6):"orthographic"===r.type&&(i=new e.OrthographicCamera(-n.xmag,n.xmag,n.ymag,-n.ymag,n.znear,n.zfar)),r.name&&(i.name=r.name),C(i,r),Promise.resolve(i);console.warn("THREE.GLTFLoader: Missing camera parameters.")},T.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}))},T.prototype.loadAnimation=function(t){for(var i=this.json.animations[t],r=[],n=[],o=[],s=[],a=[],l=0,u=i.channels.length;l<u;l++){var h=i.channels[l],c=i.samplers[h.sampler],d=h.target,p=void 0!==d.node?d.node:d.id,f=void 0!==i.parameters?i.parameters[c.input]:c.input,g=void 0!==i.parameters?i.parameters[c.output]:c.output;r.push(this.getDependency("node",p)),n.push(this.getDependency("accessor",f)),o.push(this.getDependency("accessor",g)),s.push(c),a.push(d)}return Promise.all([Promise.all(r),Promise.all(n),Promise.all(o),Promise.all(s),Promise.all(a)]).then((function(r){for(var n=r[0],o=r[1],s=r[2],a=r[3],l=r[4],u=[],h=0,c=n.length;h<c;h++){var d=n[h],p=o[h],f=s[h],g=a[h],m=l[h];if(void 0!==d){var v;switch(d.updateMatrix(),d.matrixAutoUpdate=!0,x[m.path]){case x.weights:v=e.NumberKeyframeTrack;break;case x.rotation:v=e.QuaternionKeyframeTrack;break;default:v=e.VectorKeyframeTrack}var y=d.name?d.name:d.uuid,b=void 0!==g.interpolation?w[g.interpolation]:e.InterpolateLinear,E=[];x[m.path]===x.weights?d.traverse((function(e){!0===e.isMesh&&e.morphTargetInfluences&&E.push(e.name?e.name:e.uuid)})):E.push(y);var M=f.array;if(f.normalized){var S;if(M.constructor===Int8Array)S=1/127;else if(M.constructor===Uint8Array)S=1/255;else if(M.constructor==Int16Array)S=1/32767;else{if(M.constructor!==Uint16Array)throw new Error("THREE.GLTFLoader: Unsupported output accessor component type.");S=1/65535}for(var C=new Float32Array(M.length),I=0,B=M.length;I<B;I++)C[I]=M[I]*S;M=C}for(I=0,B=E.length;I<B;I++){var T=new v(E[I]+"."+x[m.path],p.array,M,b);"CUBICSPLINE"===g.interpolation&&(T.createInterpolant=function(e){return new A(this.times,this.values,this.getValueSize()/3,e)},T.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0),u.push(T)}}}var P=i.name?i.name:"animation_"+t;return new e.AnimationClip(P,void 0,u)}))},T.prototype.loadNode=function(t){var i,n=this.json,o=this.extensions,s=this,a=n.meshReferences,l=n.meshUses,u=n.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[r.KHR_LIGHTS_PUNCTUAL]&&void 0!==u.extensions[r.KHR_LIGHTS_PUNCTUAL].light&&i.push(s.getDependency("light",u.extensions[r.KHR_LIGHTS_PUNCTUAL].light)),Promise.all(i)).then((function(i){var r;if((r=!0===u.isBone?new e.Bone:i.length>1?new e.Group:1===i.length?i[0]:new e.Object3D)!==i[0])for(var n=0,a=i.length;n<a;n++)r.add(i[n]);if(u.name&&(r.userData.name=u.name,r.name=e.PropertyBinding.sanitizeNodeName(u.name)),C(r,u),u.extensions&&S(o,r,u),void 0!==u.matrix){var l=new e.Matrix4;l.fromArray(u.matrix),r.applyMatrix4(l)}else void 0!==u.translation&&r.position.fromArray(u.translation),void 0!==u.rotation&&r.quaternion.fromArray(u.rotation),void 0!==u.scale&&r.scale.fromArray(u.scale);return s.associations.set(r,{type:"nodes",index:t}),r}))},T.prototype.loadScene=function(){function t(i,r,n,o){var s=n.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=[],r=0,n=(i=e).joints.length;r<n;r++)t.push(o.getDependency("node",i.joints[r]));return Promise.all(t)})).then((function(r){return t.traverse((function(t){if(t.isMesh){for(var n=[],o=[],s=0,a=r.length;s<a;s++){var l=r[s];if(l){n.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(n,o),t.matrixWorld)}})),t}));var i})).then((function(e){r.add(e);var i=[];if(s.children)for(var a=s.children,l=0,u=a.length;l<u;l++){var h=a[l];i.push(t(h,e,n,o))}return Promise.all(i)}))}return function(i){var r=this.json,n=this.extensions,o=this.json.scenes[i],s=new e.Group;o.name&&(s.name=o.name),C(s,o),o.extensions&&S(n,s,o);for(var a=o.nodes||[],l=[],u=0,h=a.length;u<h;u++)l.push(t(a[u],s,r,this));return Promise.all(l).then((function(){return s}))}}(),t}(),io=new to,ro=(new e.Matrix4).makeRotationAxis(new e.Vector3(1,0,0),Math.PI/2);function no(t){function i(e){if(e.isMesh)return function(e){var t=new Mt;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 pi;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 t=function(e){var t=new Ct;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),r=0;r<e.children.length;r++){var n=i(e.children[r]);t.add(n)}return t}return new Ct}return new Promise((function(r,n){var o,s=(new e.Matrix4).fromArray(t.computedTransform);if("Z"!==(null===(o=t.tileset.asset)||void 0===o?void 0:o.gltfUpAxis)&&s.multiply(ro),t.content){var a=t.content.gltfArrayBuffer,l=t.contentUrl?t.contentUrl.slice(0,t.contentUrl.lastIndexOf("/")+1):"";io.parse(a,l,(function(e){var t=e.scene,n=new Ct,o=i(t);o.applyMatrix4(s),n.add(o),r(n)}),(function(e){n(new Error("error parsing gltf in tile ".concat(t.id,": ").concat(e.message)))}))}else r(new Ct)}))}function oo(e){e.traverse((function(e){if(e instanceof Mt){e.geometry.dispose();for(var t=0,i=e.material;t<i.length;t++){var r=i[t];r.uniforms.map&&r.uniforms.map.value&&(r.uniforms.map.value.dispose(),r.uniforms.map.value=null)}}}))}function so(t){return(new e.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])}function ao(e){return new Zr(e.toArray())}var lo=new e.EdgesGeometry(new e.BoxBufferGeometry(1,1,1)),uo=new e.LineBasicMaterial({color:new e.Color(1,1,0),transparent:!0});function ho(t){t.updateMatrix(),t.updateMatrixWorld(),t.matrixWorld.getInverse(t.matrixWorldInverse);var i=(new e.Matrix4).multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse);return(new e.Frustum).setFromProjectionMatrix(i)}var co={throttleRequests:!0,maxRequests:64,updateInterval:.1,maxScreenSpaceError:8,maxMemoryUsage:32,viewDistanceScale:.2,onNodeCreated:function(){}},po=function(t){function i(i){void 0===i&&(i={});var r=t.call(this)||this;return r.options=Ne(Ne({},co),i),r.clock=new e.Clock,r.timer=0,r.unloadTileQueue=[],r.nodes={},r.boundings={},r.nodeGroup=new e.Group,r.boundingGroup=new e.Group,r.add(r.nodeGroup),r.sseDenominator=null,r.lastCameraTransform=new e.Matrix4,r.lastCameraAspect=1,r.lastCameraFov=null,r.lastCamera=null,r.lastRenderer=null,r.enabled=!1,r}return Oe(i,t),Object.defineProperty(i.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}),i.prototype.load=function(t){var i=this,r=t.tileset_url,n=(t.tileset_url_md5,t.b3md_mappings_url),o=(t.b3md_mappings_url_md5,{modelMatrix:ao((new e.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(t){var r=function(t){var i=t.boundingVolume,r=new e.LineSegments(lo,uo);return r.applyMatrix4(so(i.halfAxes)),r.position.set(i.center[0],i.center[1],i.center[2]),r}(t);return r.visible=!1,i.boundings[t.id]=r,i.boundingGroup.add(r),r.updateMatrixWorld(!0),"SCENEGRAPH"===t.type||"MESH"===t.type?no(t).then((function(e){void 0===i.tileset?oo(e):(e.visible=!1,i.nodes[t.id]=e,i.nodeGroup.add(e),i.options.onNodeCreated(e),e.updateMatrixWorld(!0))})):Promise.resolve()},onTileLoad:function(){i.enabled&&i.tileset&&i.lastRenderer&&i.lastCamera&&(i.tileset.frameNumber++,i.tilesetUpdate(i.tileset,i.lastRenderer,i.lastCamera)),i.enabled||i.reset()},onTileUnload:function(e){i.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=r.split("/").slice(0,-1).join("/"),a=lt(r,{allowHosts:this.options.allowHosts,networkSubscribe:this.options.networkSubscribe,requestProxy:this.options.requestProxy}).then((function(e){return JSON.parse(e.body)})).then((function(e){return function(e,t){var i,r=JSON.parse(JSON.stringify(e));return r.basePath=t,r.root=function(e,t){e=eo(e,t);var i=[];for(i.push(e);i.length>0;)for(var r=0,n=(i.pop()||{}).children||[];r<n.length;r++){var o=n[r];eo(o,t),i.push(o)}return e}(r.root,t),r.type="TILES3D",r.lodMetricType="geometricError",r.lodMetricValue=(null===(i=r.root)||void 0===i?void 0:i.lodMetricValue)||0,r}(e,s)})),l=lt(n,{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(t){var r=t[0],n=t[1];r.b3dmMapping=n;var s=i.tileset=new Zn(r,o),a=new e.Matrix4;if(s.root&&s.root.boundingVolume){var l=s.root.boundingVolume,u=l.halfAxes,h=l.center;a.extractRotation(so(u)),a.setPosition(h[0],h[1],h[2])}s.modelMatrix.copy(ao((new e.Matrix4).getInverse(a)))}))},i.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))))},i.prototype.tilesetUpdate=function(t,i,r){this.sseDenominator&&r.aspect===this.lastCameraAspect&&r.fov===this.lastCameraFov||(this.sseDenominator=function(e){var t=e.aspect,i=e.fov/180*Math.PI,r=e.aspect<=1?i:2*Math.atan(Math.tan(.5*i)/t);return 2*Math.tan(.5*r)}(r),this.lastCameraAspect=r.aspect,this.lastCameraFov=r.fov);var n,o,s,a={camera:{position:r.getWorldPosition(new e.Vector3).toArray(),direction:r.getWorldDirection(new e.Vector3).toArray(),up:r.up.toArray()},height:i.getSize(new e.Vector2).height,frameNumber:t.frameNumber,sseDenominator:this.sseDenominator,cullingVolume:(o=ho(r),s=o.planes.map((function(e){return new nn(e.normal.toArray(),e.constant)})),new un(s))};t.cache.reset(),t.traverser.traverse(t.root,a);for(var l=0,u=t.tiles;l<u.length;l++){var h=u[l],c=h.selected,d=h.id;this.nodes[d]&&this.nodes[d].visible!==c&&(this.nodes[d].visible=c,c&&(this.nodes[d].needsRender=!0)),this.boundings[d]&&this.boundings[d].visible!==c&&(this.boundings[d].visible=c)}for(;n=this.unloadTileQueue.pop();){if(d=n.id,this.nodes[d]){var p=this.nodes[d];this.nodeGroup.remove(p),oo(p),delete this.nodes[d]}this.boundings[d]&&(p=this.boundings[d],this.boundingGroup.remove(p),delete this.boundings[d])}},i.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),oo(i),delete this.nodes[t]}this.boundings[t]&&(i=this.boundings[t],this.boundingGroup.remove(i),delete this.boundings[t])}for(var r=0,n=Object.keys(this.nodes);r<n.length;r++){t=n[r];var o=this.nodes[t];this.nodeGroup.remove(o),oo(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]}},i}(St);function fo(e){return null==e}var Ao=function(t,i){void 0===i&&(i=1e-4),i=Math.max(i,Number.EPSILON);for(var r={},n=t.getIndex(),o=t.getAttribute("position"),s=n?n.count:o.count,a=0,l=Object.keys(t.attributes),u={},h={},c=[],d=["getX","getY","getZ","getW"],p=0,f=l.length;p<f;p++)u[b=l[p]]=[],(M=t.morphAttributes[b])&&(h[b]=new Array(M.length).fill().map((function(){return[]})));var A=Math.log10(1/i),g=Math.pow(10,A);for(p=0;p<s;p++){var m=n?n.getX(p):p,v="",y=0;for(f=l.length;y<f;y++)for(var b=l[y],x=(E=t.getAttribute(b)).itemSize,w=0;w<x;w++)v+="".concat(~~(E[d[w]](m)*g),",");if(v in r)c.push(r[v]);else{for(y=0,f=l.length;y<f;y++){b=l[y];var E=t.getAttribute(b),M=t.morphAttributes[b],S=(x=E.itemSize,u[b]),C=h[b];for(w=0;w<x;w++){var I=d[w];if(S.push(E[I](m)),M)for(var B=0,T=M.length;B<T;B++)C[B].push(M[B][I](m))}}r[v]=a,c.push(a),a++}}var P=t.clone();for(p=0,f=l.length;p<f;p++){b=l[p];var R=t.getAttribute(b),k=new R.array.constructor(u[b]);if(E=new e.BufferAttribute(k,R.itemSize,R.normalized),P.setAttribute(b,E),b in h)for(y=0;y<h[b].length;y++){var L=t.morphAttributes[b][y],D=(k=new L.array.constructor(h[b][y]),new e.BufferAttribute(k,L.itemSize,L.normalized));P.morphAttributes[b][y]=D}}return P.setIndex(c),P};function go(t){var i;return new((i=e.Triangle).bind.apply(i,Fe([void 0],t.map((function(t){return new e.Vector3(t.x,t.y,t.z)})),!1)))}var mo={at3d:function(e,t){for(var i=nr(t.textureOptions,e.textures.length),r={},n=0,o=e.textures;n<o.length;n++){var s=o[n];r[s]=ir(s,i,t.allowHosts,t.requestProxy,t.networkSubscribe)}return Promise.resolve().then((function(){return lt(e.file,{responseType:"arraybuffer",allowHosts:t.allowHosts,requestProxy:t.requestProxy,networkSubscribe:t.networkSubscribe})})).then((function(e){return Ki(e.body)})).then((function(e){return Ni((function(){for(var t,i={chunks:[]},r=0,n=e;r<n.length;r++){var o=n[r],s=Zi.decode(o);s.chunks.length&&(t=i.chunks).push.apply(t,s.chunks)}return i}))})).then((function(n){return Ni((function(){return rr(n,e.textureBase,e.textures.slice(),i,r,t.allowHosts,t.requestProxy,t.networkSubscribe)}))}))},pbm:function(e,t){for(var i=nr(t.textureOptions,e.textures.length),r={},n=0,o=e.textures;n<o.length;n++){var s=o[n];r[s]=ir(s,i,t.allowHosts,t.requestProxy,t.networkSubscribe)}return Promise.resolve().then((function(){return lt(e.file,{responseType:"arraybuffer",allowHosts:t.allowHosts,requestProxy:t.requestProxy,networkSubscribe:t.networkSubscribe})})).then((function(e){return Ni((function(){var t=new Uint8Array(e.body);return Zi.decode(t)}))})).then((function(n){return Ni((function(){return rr(n,e.textureBase,e.textures.slice(),i,r,t.allowHosts,t.requestProxy,t.networkSubscribe)}))}))},dome:function(e,t){return Promise.resolve().then((function(){return lt(e.file,{responseType:"arraybuffer",allowHosts:t.allowHosts,requestProxy:t.requestProxy,networkSubscribe:t.networkSubscribe})})).then((function(i){return fr(new Uint8Array(i.body),e.textureBase,t.textureOptions,t.allowHosts,t.requestProxy,t.networkSubscribe)}))},domez:function(e,t){return Promise.resolve().then((function(){return lt(e.file,{responseType:"arraybuffer",allowHosts:t.allowHosts,requestProxy:t.requestProxy,networkSubscribe:t.networkSubscribe})})).then((function(e){return Ki(e.body)})).then((function(e){var t=e.reduce((function(e,t){return e+t.length}),0),i=new Uint8Array(t),r=0;return e.forEach((function(e){i.set(e,r),r+=e.length})),i})).then((function(i){return fr(i,e.textureBase,t.textureOptions,t.allowHosts,t.requestProxy,t.networkSubscribe)}))}},vo=function(t){function i(i){void 0===i&&(i={});var r=t.call(this)||this;return r.empty=!0,r.name="model",r.loaded=!1,r.bvhs=Object.assign([],{loaded:!1}),r.bounding=new e.Box3,r.shownFloor=null,r.floorLength=0,r.requestProxy=i.requestProxy,r.networkSubscribe=i.networkSubscribe,r.allowHosts=i.allowHosts,r.renderOrder=-3,r}return Oe(i,t),Object.defineProperty(i.prototype,"shownfloor",{get:function(){return this.shownFloor},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"hasTiles",{get:function(){return void 0!==this.tiledModel},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"enableTiles",{get:function(){return!!this.tiledModel&&this.tiledModel.enable},set:function(e){this.tiledModel&&(this.tiledModel.enable=e)},enumerable:!1,configurable:!0}),i.prototype.getEdges=function(t){var i;if(void 0===t&&(t=30/180*Math.PI),!this.originModel)return[];for(var r=Math.cos(t),n=[],o=0,s=this.originModel.children;o<s.length;o++){var a=s[o];if(a instanceof Mt){for(var l={},u=["a","b","c"],h=Ao(a.geometry),c=h.getAttribute("position").array,d=(null===(i=h.getIndex())||void 0===i?void 0:i.array)||[],p=[],f=[],A=0,g=c.length;A<g;A+=3)p.push(new e.Vector3(c[A],c[A+1],c[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 e.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 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)<=r){var B=p[I.index1],T=p[I.index2];n.push(new e.Line3(B,T))}}h.dispose(),p.length=0,f.length=0}}return n},i.prototype.hasFloors=function(){return this.hasFloors_()},i.prototype.hasFloors_=function(){var e=[];return this.traverse((function(t){t instanceof Mt&&(e[t.floorIndex]=!0)})),e.length},i.prototype.show=function(){for(var t,i,r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var o=this.shownFloor,s=null,a=null!==(t=r[1])&&void 0!==t?t:.1,l=0!==r.length;this.shownFloor=s=l?r[0]:null,this.setMaterial({opacity:1,floorInfo:new e.Vector3(0,0,0)}),(null===(i=this.tiledModel)||void 0===i?void 0:i.enable)?this.b3dmShow(o,s):this.at3dShow(o,s,a)},i.prototype.at3dShow=function(e,t,i){this.traverse((function(e){e instanceof Mt&&e.material.forEach((function(r){null===t||t===e.floorIndex?r.opacity=1*r.originOpacity:r.opacity=r.originOpacity*i}))})),e!==this.shownFloor&&this.emit("shownFloorChange",this.shownFloor,this.floorLength),this.needsRender=!0},i.prototype.b3dmShow=function(t,i){var r,n;if(null===(n=null===(r=this.tiledModel)||void 0===r?void 0:r.tileset)||void 0===n?void 0:n.floorInfo){if("number"==typeof i&&i>=0&&i<this.tiledModel.tileset.floorInfo.length){var o=this.tiledModel.tileset.floorInfo,s=-o[i].ground,a=o[i].height+s;this.setMaterial({opacity:1,floorInfo:new e.Vector3(s,a,0)})}else this.setMaterial({opacity:1,floorInfo:new e.Vector3(0,0,0)});t!==this.shownFloor&&this.emit("shownFloorChange",this.shownFloor,this.floorLength),this.needsRender=!0}},i.prototype.intersectRaycaster=function(t,i){var r=t.ray,n=r.origin,o=r.direction;if(fo(i))if(fo(this.shownFloor)){var s=this.floorLength;i=[];for(var a=-1;a<s;a++)i.push(a)}else i=[this.shownFloor];var l=[],u=[];Array.isArray(i)?u.push.apply(u,i):u.push(i);for(var h=function(i){var r=c.bvhs&&c.bvhs[i];if(r){var s=new Mi(n.x,n.y,n.z),a=new Mi(o.x,o.y,o.z),u=r.intersectRay(s,a,!0).map((function(t){var i=t.intersectionPoint,r=t.triangle,o=new e.Vector3(i.x,i.y,i.z);return{point:o,face:{normal:go(r).getNormal(new e.Vector3)},distance:n.distanceTo(o)}}));u.length&&l.push.apply(l,u)}else if(c.originModel){var h=[];c.originModel.traverse((function(e){e instanceof Mt&&e.floorIndex===i&&h.push(e)})),(u=t.intersectObjects(h).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)}},c=this,d=0,p=u;d<p.length;d++)h(p[d]);return l.filter((function(e){var i=e.distance;return i<=t.far&&i>=t.near})).sort((function(e,t){return e.distance-t.distance}))},i.prototype.buildBVH=function(){if(!this.bvhs.loaded&&this.originModel){var e=[];this.originModel.traverse((function(t){t instanceof Mt&&(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 r=i[t],n=0;if(r){for(var o=0,s=r;o<s.length;o++){var a;a=(d=s[o]).index?d.index.array.length:d.attributes.position.array.length/3,n+=3*Math.floor(a/3)}for(var l=new Float32Array(3*n),u=0,h=0,c=r;h<c.length;h++){var d,p=(d=c[h]).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 ki).create(l).splitNode(50);this.bvhs.push(y)}}this.bvhs.loaded=!0,this.emit("bvhLoaded")}},i.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 r=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 r=0,n=String(i[1]).trim().split(".").slice(1).reverse();r<n.length;r++){var o=n[r],s=t.indexOf(o);if(s>=0)return t[s]}return""}(e.file,Object.keys(mo)),n=mo[r];if(!n)throw new Error("[MODEL LOAD ERROR]: file type(".concat(r,") does not support."));return this.name=e.file,n(e,{textureOptions:t,allowHosts:this.allowHosts,requestProxy:this.requestProxy,networkSubscribe:this.networkSubscribe}).then((function(t){var r=t.objects,n=t.texturePromise;i.bounding.makeEmpty();var o=i.originModel=new St;o.renderOrder=-3;for(var s=0,a=r;s<a.length;s++){var l=a[s];l.traverse((function(e){if(e instanceof Mt){var t=e.geometry;t.boundingBox||t.computeBoundingBox(),t.boundingSphere||t.computeBoundingSphere(),i.bounding.union(t.boundingBox)}})),o.add(l)}if(i.add(o),i.floorLength=i.hasFloors_(),i.empty=!1,i.loaded=!0,e.tiles&&e.tiles.tileset_url&&e.tiles.b3md_mappings_url){var u=i.tiledModel=new po({onNodeCreated:function(e){var t=o.getMaterial();t&&(e.setMaterial(t),e.renderOrder=-3)},allowHosts:i.allowHosts,networkSubscribe:i.networkSubscribe,requestProxy:i.requestProxy});u.renderOrder=-3,i.add(u),u.load(e.tiles)}e.bvh&&i.buildBVH(),Ni((function(){i.emit("geometryLoaded"),n.then((function(){i.emit("materialLoaded"),i.emit("loaded")}))}))})).catch((function(e){return i.name="",i.emit("error",e),Promise.reject(e)}))},i.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 r=this.tiledModel.tileset.root;r.content&&"READY"===r.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)}},i.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},i}(St);Object.assign(vo.prototype,{on:qe.prototype.on,once:qe.prototype.once,off:qe.prototype.off,emit:qe.prototype.emit,hasListener:qe.prototype.hasListener});var yo="Panorama";function bo(e,t,i){return e<t?t:e>i?i:e}function xo(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,r,n;if(Array.isArray(e)){if((i=e.length)!=t.length)return!1;for(r=i;0!=r--;)if(!xo(e[r],t[r]))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=(n=Object.keys(e)).length)!==Object.keys(t).length)return!1;for(r=i;0!=r--;)if(!Object.prototype.hasOwnProperty.call(t,n[r]))return!1;for(r=i;0!=r--;){var o=n[r];if(!xo(e[o],t[o]))return!1}return!0}return e!=e&&t!=t}function wo(e){return"number"==typeof e}var Eo=function(){return new Error("Invalid input.")},Mo=function(){return new Error("Invalid certificate.")},So=function(){return new Error("Invalid signature.")};function Co(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 r="[",n=e.length-1,o=0;o<n;o++)r+=Co(e[o],!1)+",";return n>-1&&(r+=Co(e[o],!1)),r+"]"}if(e instanceof Object){if("function"==typeof e.toJSON)return Co(e.toJSON(),t);var s=Object.keys(e).sort(),a=s.length;for(r="",o=0;o<a;){var l=s[o],u=Co(e[l],!0);void 0!==u&&(o&&""!==r&&(r+=","),r+=JSON.stringify(l)+":"+u),o++}return"{"+r+"}"}switch(i){case"function":case"undefined":return t?void 0:null;case"number":return 0;default:return isFinite(e)?e:null}}function Io(e){return String(Co(e,!1))}function Bo(e){var t,i,r;if(Array.isArray(e)){var n,o,s=void 0;if(e.length<=0)return Eo();for(var a=function(t){var i=Bo(e[t]);if(i instanceof Error)return{value:i};if(s){if(s!==i.issuer)return{value:Mo()}}else s=i.issuer;n?i.expire.getTime()<n.getTime()&&(n=i.expire):n=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 Ke({issuer:s,expire:n,allowHosts:o})}var h=JSON.parse(e),c="undefined"!=typeof location?location.hostname:"",d=Date.now();if("object"!=typeof h)return Eo();var p=new Date("string"==typeof h.expire_at&&/^\d+$/.test(h.expire_at)?Number(h.expire_at):h.expire_at),f=Array.isArray(h.allow_hosts)?h.allow_hosts:[];if(0===c.length||Ge(c)||Ze.filter((function(e){return We(e,c)})).length>0){var A=String(null!==(t=h.certificate)&&void 0!==t?t:"");if(A){var g=new Be;return g.readCertPEM(A),Ke({issuer:g.getSubjectString(),expire:p,allowHosts:f})}return Ke({issuer:"none",expire:p,allowHosts:f})}var m=String(null!==(i=h.certificate)&&void 0!==i?i:"");if(!m)return Mo();var v=new Be;v.readCertPEM(m);var y=String(null!==(r=h._signature)&&void 0!==r?r:"");if(!y)return So();var b=Io(function(e,t){for(var i={},r=0,n=Object.keys(e);r<n.length;r++){var o=n[r];-1===t.indexOf(o)&&(i[o]=e[o])}return i}(h,["_signature"]));return!1===function(e,t,i){var r=new Be;if("string"==typeof i?r.readCertPEM(i):r.readCertHex(i.hex),!1===Le(r))return!1;var n=new te;return n.readCertPubKeyHex(r.hex,6),!!n.verify(e,j(t))}(b,y,v)?So():d<p.getTime()?0===f.filter((function(e){return We(e,c)})).length?function(e){return new Error("host(".concat(JSON.stringify(e),") is not allowed."))}(c):Ke({issuer:v.getSubjectString(),expire:p,allowHosts:f}):function(e){return new Error("date(".concat(e.toString(),") expired."))}(p)}var To=new WeakMap,Po=function(){function e(){this.name="",this.workCode="",this.expire=new Date,this.allowHosts=[],this.initial={mode:yo,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=Do,e}();function Ro(e){return null==e?"null":Array.isArray(e)?"array":"object"==typeof e?"dict":"value"}function ko(e,t){var i=Ro(e),r=Ro(t);if("null"===r)return e;if("value"===r)return t;if(r!==i)return JSON.parse(JSON.stringify(t));if("array"===r)for(var n=0;n<t.length;n++)e[n]=ko(e[n],t[n]);else if("dict"===r)for(var o in t)e[o]=ko(e[o],t[o]);return e}function Lo(t,i,r){for(var n,o=JSON.stringify(i),s=[],a=0,l=[].concat(t);a<l.length;a++){var u=l[a];u instanceof Po?s.push.apply(s,u.raw.works):"string"==typeof u?s.push(u):s.push(JSON.stringify(u))}var h=Bo(s);if(h instanceof Error)return h;i=JSON.parse(o),t=s.map((function(e){return JSON.parse(e)})).reduce((function(e,t){return ko(e,t)}));var c=new Po;if(h instanceof Error)return h;c.issuer=h.issuer,c.expire=h.expire,c.allowHosts=h.allowHosts,c.raw={works:s,options:o};var d=null!==(n=t.base_url)&&void 0!==n?n:"";d&&"/"!==d[d.length-1]&&(d+="/");var p=function(e,t){return 0===e.indexOf(t)},f=function(e,t){var n,o=e;if(!0===i.jsonp){o=e.replace(/([\?\#].*)?$/i,"");var s=Te("".concat(o)).slice(0,7);o="".concat(o,".").concat(s,".jsonp")}if(!0===i.shortPath){var a=o.replace(d,"").split("."),l=null!==(n=a.shift())&&void 0!==n?n:"",u=a.join(".");o=_i(d,Te(l))+(u?"."+u:"")}var h=o.replace(d,"");return i.baseURL&&(o=_i(i.baseURL,h)),r&&r(e,o,h,t),o},A=function(e,i){var r,n,o,s,a,l,u=e;if(!or(e)){var h=null!==(l=null!==(s=null!==(n=null===(r=t.panorama)||void 0===r?void 0:r.pano_high_cube_base_url)&&void 0!==n?n:null===(o=t.panorama)||void 0===o?void 0:o.pano_cube_base_url)&&void 0!==s?s:null===(a=t.panorama)||void 0===a?void 0:a.base_url)&&void 0!==l?l:"";h&&(h=_i(h,String(i))),u=_i(h,u)}return or(u)||(u=_i(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 or(t)||(t=_i(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 or(i)||(i=_i(t,i)),or(i)||(i=_i(d,i)),p(i,d)||console.warn("".concat(i," is not start with base_url(").concat(d,").")),f(i,"texture")};if(h instanceof Error)return h;if(c.workCode=String(t.work_code||t.code||t.vr_code||t.workCode),c.name=String(t.name),h instanceof Error)return h;if(t.model){var v={bvh:!0,async:!1,textureBase:"",textures:[]};"boolean"==typeof i.modelBvh?v.bvh=i.modelBvh:"boolean"==typeof t.model.bvh?v.bvh=t.model.bvh:"boolean"==typeof t.bvh&&(v.bvh=t.bvh),t.model.file?v.file=g(t.model.file):t.model.file_url&&(v.file=g(t.model.file_url)),t.model.textureBase?v.textureBase=m("",t.model.textureBase):t.model.material_base_url?v.textureBase=m("",t.model.material_base_url):v.file&&(v.textureBase=v.file.split("/").slice(0,-1).join("/").replace("/model/","/materials/")),Array.isArray(t.model.textures)?v.textures=t.model.textures.map((function(e){var i,r;return m(e,null!==(r=null!==(i=t.model.textureBase)&&void 0!==i?i:t.model.material_base_url)&&void 0!==r?r:"")})):Array.isArray(t.model.material_textures)&&(v.textures=t.model.material_textures.map((function(e){var i,r;return m(e,null!==(r=null!==(i=t.model.textureBase)&&void 0!==i?i:t.model.material_base_url)&&void 0!==r?r:"")}))),t.model.tiles&&(v.tiles=t.model.tiles),v.file&&(c.model=v)}if(h instanceof Error)return h;if(t.observers&&Array.isArray(t.observers)){var y=[];t.panorama&&(Array.isArray(t.panorama)?y=t.panorama:Array.isArray(t.panorama.list)?y=t.panorama.list:Array.isArray(t.panorama.info)&&(y=t.panorama.info));for(var b=0;b<t.observers.length;b++){var x={},w=t.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,i=e.match(/\/cube_(\d+)\//);if(i){var r=Number(i[1]);if(0==((t=r)&t-1)&&0!==t)return r}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 k=R[P];if("number"==typeof k){var L=k,D=B(x.images.front);if(!1===D)continue;if((q=Math.max(D,512*Math.pow(2,L)))>2048){var O=T(x.images.up,q),N=T(x.images.down,q),F=T(x.images.right,q),Q=T(x.images.left,q),V=T(x.images.front,q),H=T(x.images.back,q);I.push({level:L,size:q,up:O,down:N,right:F,left:Q,front:V,back:H})}else O=x.images.up,N=x.images.down,F=x.images.right,Q=x.images.left,V=x.images.front,H=x.images.back,I.push({level:L,size:q,up:O,down:N,right:F,left:Q,front:V,back:H})}else{var q;if("number"!=typeof(L=k.level))continue;if("number"!=typeof(q=k.size))continue;O=A(k.up,b),N=A(k.down,b),F=A(k.right,b),Q=A(k.left,b),V=A(k.front,b),H=A(k.back,b),I.push({level:L,size:q,up:O,down:N,right:F,left:Q,front:V,back:H})}}I.sort((function(e,t){return e.level-t.level})),x.images.tiles=I}if(w.position instanceof e.Vector3)x.position=w.position.clone();else{if(!Array.isArray(w.position))break;x.position=(new e.Vector3).fromArray(w.position)}if(w.standingPosition instanceof e.Vector3)x.standingPosition=w.standingPosition.clone();else if(Array.isArray(w.standingPosition))x.standingPosition=(new e.Vector3).fromArray(w.standingPosition);else if(w.standing_position instanceof e.Vector3)x.standingPosition=w.standing_position.clone();else{if(!Array.isArray(w.standing_position))break;x.standingPosition=(new e.Vector3).fromArray(w.standing_position)}if(w.quaternion instanceof e.Quaternion)x.quaternion=w.quaternion.clone();else if(Array.isArray(w.quaternion))x.quaternion=(new e.Quaternion).fromArray(w.quaternion);else{if(!w.quaternion)break;var z=w.quaternion,U=z.x,j=z.y,K=z.z,_=z.w;x.quaternion=new e.Quaternion(U,j,K,_)}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()),wo(w.floorIndex)?x.floorIndex=w.floorIndex:wo(w.floor_index)?x.floorIndex=w.floor_index:x.floorIndex=0,w.video){var G={};"string"==typeof w.video.source&&(G.source=w.video.source),w.video.matrix instanceof e.Matrix4?G.matrix=w.video.matrix.clone():Array.isArray(w.video.matrix)&&(G.matrix=(new e.Matrix4).fromArray(w.video.matrix)),w.video.size instanceof e.Vector2?G.size=w.video.size.clone():Array.isArray(w.video.size)&&(G.size=(new e.Vector2).fromArray(w.video.size)),G.source&&G.matrix&&G.size&&(x.video=G)}c.observers[b]=x}}if(h instanceof Error)return h;for(var W=0,X=c.observers;W<X.length;W++){if((x=X[W]).accessibleNodes)x.accessibleNodes=x.accessibleNodes.filter((function(e){return e<c.observers.length}));else{x.accessibleNodes=[];for(var Y=0;Y<c.observers.length;Y++)c.observers[Y]!==x&&x.accessibleNodes.push(Y)}if(x.visibleNodes)x.visibleNodes=x.visibleNodes.filter((function(e){return e<c.observers.length}));else for(x.visibleNodes=[],Y=0;Y<c.observers.length;Y++)c.observers[Y]!==x&&x.visibleNodes.push(Y)}if(h instanceof Error)return h;if(t.initial)if("Floorplan"!==t.initial.mode&&"Topview"!==t.initial.mode&&"Panorama"!==t.initial.mode&&"VRPanorama"!==t.initial.mode&&"Model"!==t.initial.mode&&"DepthPanorama"!==t.initial.mode||(c.initial.mode=t.initial.mode),wo(t.initial.latitude)&&(c.initial.latitude=t.initial.latitude),wo(t.initial.longitude)?c.initial.longitude=t.initial.longitude:wo(t.initial.heading)&&(c.initial.longitude=-(360*(t.initial.heading-.25)+90)/180*Math.PI),wo(t.initial.fov)&&(c.initial.fov=t.initial.fov),wo(t.initial.panoIndex)){var Z=c.observers.length>0?c.observers.length-1:0;c.initial.panoIndex=bo(t.initial.panoIndex,0,Z)}else wo(t.initial.pano_index)?(Z=c.observers.length>0?c.observers.length-1:0,c.initial.panoIndex=bo(t.initial.pano_index,0,Z)):wo(t.initial.pano)&&(Z=c.observers.length>0?c.observers.length-1:0,c.initial.panoIndex=bo(t.initial.pano,0,Z));if(h instanceof Error)return h;var J=Ke(c);return To.set(J,{works:s,options:o}),J}function Do(e,t,i){"string"==typeof e&&"{"===e.trim()[0]&&(e=JSON.parse(e));var r=To.get(e);if(r){if(t&&!xo(JSON.parse(r.options),t))throw new Error("[PARSE FAILED]: work is parsed with different options.");return e}var n=Lo(e,null!=t?t:{},i);if(n instanceof Error)throw new Error("[PARSE FAILED]: "+n.message);return n}function Oo(){return"undefined"==typeof document?{}:document.createElementNS("http://www.w3.org/1999/xhtml","img")}function No(e,t,i){return e+(t-e)*i}function Fo(e,t){var i=t[1]-t[0];return e<t[0]?Fo(e+i,t):e>=t[1]?Fo(e-i,t):e}function Qo(e,t,i,r){return r?function(e,t,i,r){var n=r[1]-r[0];return e=Fo(e,r),No((t=Fo(t,r))-e>n/2?e+n:e-t>n/2?e-n:e,t,i)}(e,t,i,r):No(e,t,i)}var Vo=function(){function e(e){for(var t in this.config={},this.progress=1,this.ended=!0,this.value={},this.startTime=je(),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:Ne({},this.value)},{progress:1,value:Ne({},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,r){var n=(t*i+2)/Math.pow(i,3),o=-(2*t*i+3)/Math.pow(i,2),s=t;return n*Math.pow(r,3)+o*Math.pow(r,2)+s*r+1}(0,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],r=this.keyframes[t],n={};for(var o in this.config){var s=(e-i.progress)/(r.progress-i.progress);n[o]=Qo(i.value[o],r.value[o],s,this.config[o].circle)}return n}return Ne({},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,r){var n=(t*i+2)/Math.pow(i,3),o=-(2*t*i+3)/Math.pow(i,2),s=t;return 3*n*Math.pow(r,2)+2*o*r+s}(0,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,r){var n;void 0===i&&(i=0),isNaN(t)&&(t=0),isNaN(i)&&(i=0),r=null!=r?r:je();var o=this.getProgress(r),s=this.getValue(o),a={};for(var l in this.config)a[l]=null!==(n=e[l])&&void 0!==n?n:s[l];var u=[{progress:0,value:s},{progress:1,value:a}];return this.setKeyframes(u,t,i,r)},e.prototype.setKeyframes=function(e,t,i,r){var n=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){r=null!=r?r:je(),n.progress=0,n.ended=!1,n.startTime=r,n.startVelocity=i,n.keyframes=e,n.duration=t,0===t?(n.progress=1,n.value=Ne({},e[e.length-1].value)):n.value=Ne({},e[0].value),n.callbacks=[o,s]}))},e.prototype.dispose=function(){this.callbacks&&(this.callbacks[1](new Error("motion dispose.")),this.callbacks=void 0)},e}(),Ho=Oo(),qo=new e.Texture(Ho);Ho.onload=function(){return qo.needsUpdate=!0},Ho.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAR9JREFUOBF10kFOAzEMBdCZFhCbrrgAN+NqHIULsWKDKO3gF+VHoZpa+rXjfH87nq7btr0ty3KZ8FsxnHeQPL748lA/x0Jsq+AwYe0X8nDtGA33BEJUHIEKW/EorHOLI7BHNlkEbju38YkQAIRZxFkHz2HOirKDxNcIzG+fu/6oLiNmqc5ZrlwTeKyAgJF14tMZmSn87pBrxeX/CRABgk/dl1s+C18dio2Pp9nmCQru2UtdvN+7lI9AFsgb3zNMcSp8FF4LYs3UhLfOAvkDJffci8q1J/ByRLKnQ8gUJUFOd2SeZYliCxwiyJCxCbhUGFKF4zPm61hiq7sVyJnPmATyR5IzLSNyDNEFRCDnkAmA8U2RfCsIefYhDeKOQLv7A+l1ZTyjymNxAAAAAElFTkSuQmCC";var zo=new e.RingBufferGeometry(.06,.07,32).rotateX(-Math.PI/2),Uo=new e.MeshBasicMaterial({map:qo,transparent:!0}),jo=new e.SphereBufferGeometry(.12,16,16),Ko=new e.MeshBasicMaterial({color:16777215,opacity:0,transparent:!0});function _o(){if("undefined"==typeof document){var t=new e.Texture;return Object.assign(t,{draw:function(e){},retain:!1,pool:!1})}var i=document.createElement("canvas"),r=512,n=256,o=190;i.setAttribute("width",String(r)),i.setAttribute("height",String(r));var s=new e.Texture(i),a=i.getContext("2d");if(!a)throw Error("cannot create canvas context");var l=a.createRadialGradient(n,n,150,n,n,0);function u(){var e=Math.PI/12,t=2*Math.PI/3;a&&(a.beginPath(),a.arc(n,n,o,0*t,1*t-e),a.stroke(),a.beginPath(),a.arc(n,n,o,1*t,2*t-e),a.stroke(),a.beginPath(),a.arc(n,n,o,2*t,3*t-e),a.stroke())}function h(e){a&&(a.clearRect(0,0,r,r),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(n,n,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(n,n,150,0,2*Math.PI),a.closePath(),a.fillStyle=l,a.fill(),a.fillStyle="rgba(255, 255, 255, 0.01)",a.fillRect(0,0,r,r),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)"),h(0),Object.assign(s,{draw:h,retain:!1,pool:!1})}var Go=[],Wo=_o();Wo.draw(0);var Xo=_o();Xo.draw(1);var Yo=_o();Yo.draw(-1);var Zo=new e.CircleBufferGeometry(.12,32).rotateX(-Math.PI/2);var Jo=function(t){function i(){var i=t.call(this)||this;return i.loading=!1,i.disabled=!1,i.current=!1,i.progress=0,i.opacity=0,i.hitTestMesh=new e.Mesh(jo,Ko),i.add(i.hitTestMesh),i.centerMesh=new e.Mesh(Zo,new e.MeshBasicMaterial({map:Wo,transparent:!0})),i.centerMesh.position.y+=.01,i.add(i.centerMesh),i.loadingMesh=new e.Mesh(zo,Uo),i.loadingMesh.position.y+=.011,i.progressMotion=new Vo({progress:i.progress}),i.opacityMotion=new Vo({opacity:i.opacity}),i.needsRender=!0,i.renderOrder=-2,i}return Oe(i,t),i.prototype.setLoading=function(t){var i=this;this.loading=t,this.stopInterval&&this.stopInterval(),t?(this.add(this.loadingMesh),this.stopInterval=ft.shared.add((function(){i.loadingMesh.rotateOnAxis(new e.Vector3(0,1,0),.1),i.needsRender=!0}))):this.remove(this.loadingMesh),this.needsRender=!0},i.prototype.setDisabled=function(e){this.disabled=e,function(e,t){var i=e.map;!0===i.pool&&(i.retain=!1),e.map=t?Yo:Wo}(this.centerMesh.material,e),this.needsRender=!0},i.prototype.setProgress=function(e){this.setLoading(!1),this.setDisabled(!1),this.progress=e=bo(e,0,1),e!==this.progressMotion.getTargetKeyframe().value.progress&&this.progressMotion.set({progress:e},120).catch(ze)},i.prototype.setOpacity=function(e){this.opacity=e=bo(e,0,1),this.current&&(e=1),e!==this.opacityMotion.getTargetKeyframe().value.opacity&&this.opacityMotion.set({opacity:e},500).catch(ze)},i.prototype.setCurrent=function(e){this.current!==e&&(this.current=e,this.setOpacity(this.opacity))},i.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),function(e,t){var i=e.map;0===t||1===t?(!0===i.pool&&(i.retain=!1),0===t&&(e.map=Wo),1===t&&(e.map=Xo)):(!0!==i.pool&&(e.map=function(){for(var e=0,t=Go;e<t.length;e++){var i=t[e];if(!1===i.retain)return i}var r=_o();return r.pool=!0,r.retain=!0,Go.push(r),r}()),e.map.draw(t))}(this.centerMesh.material,this.progressMotion.value.progress),this.needsRender=!0)},i.prototype.dispose=function(){this.setLoading(!1),this.remove(this.hitTestMesh),this.remove(this.centerMesh),this.remove(this.loadingMesh),this.centerMesh.material.dispose()},i}(e.Object3D),$o=function(e){return 2*e-e*e*e},es=new Float32Array([-.13,0,-.13,.13,0,-.13,-.13,0,.13,.13,0,.13]),ts=new Float32Array([0,1,1,1,0,0,1,0]),is=new Uint8Array([0,2,1,2,3,1]),rs=new e.BufferGeometry;rs.setAttribute("position",new e.BufferAttribute(es,3)),rs.setAttribute("uv",new e.BufferAttribute(ts,2)),rs.setIndex(new e.BufferAttribute(is,1));var ns,os,ss,as=(ns=Oo(),os=new e.Texture,ss=256,128,ns.onload=function(){if("undefined"!=typeof document){var e=document.createElement("canvas");e.setAttribute("width",String(ss)),e.setAttribute("height",String(ss));var t=e.getContext("2d");t&&(t.save(),t.drawImage(ns,0,0,ss,ss),t.globalCompositeOperation="source-out",t.beginPath(),t.arc(128,128,84.48,0,2*Math.PI),t.lineWidth=29.952,t.strokeStyle="rgba(255, 255, 255, 0.5)",t.stroke(),t.restore(),os.image=e,os.needsUpdate=!0)}},ns.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAR9JREFUOBF10kFOAzEMBdCZFhCbrrgAN+NqHIULsWKDKO3gF+VHoZpa+rXjfH87nq7btr0ty3KZ8FsxnHeQPL748lA/x0Jsq+AwYe0X8nDtGA33BEJUHIEKW/EorHOLI7BHNlkEbju38YkQAIRZxFkHz2HOirKDxNcIzG+fu/6oLiNmqc5ZrlwTeKyAgJF14tMZmSn87pBrxeX/CRABgk/dl1s+C18dio2Pp9nmCQru2UtdvN+7lI9AFsgb3zNMcSp8FF4LYs3UhLfOAvkDJffci8q1J/ByRLKnQ8gUJUFOd2SeZYliCxwiyJCxCbhUGFKF4zPm61hiq7sVyJnPmATyR5IzLSNyDNEFRCDnkAmA8U2RfCsIefYhDeKOQLv7A+l1ZTyjymNxAAAAAElFTkSuQmCC",os),ls=function(){if("undefined"!=typeof document){var t=256,i=199.68,r=document.createElement("canvas");r.setAttribute("width",String(512)),r.setAttribute("height",String(512));var n=r.getContext("2d");if(n){n.save(),n.beginPath(),n.arc(t,t,i,0,2*Math.PI),n.fillStyle="rgba(255, 255, 255, 0.1)",n.fill(),n.beginPath(),n.arc(t,t,i,0,2*Math.PI),n.strokeStyle="rgba(255, 255, 255, 0.5)",n.lineWidth=10.24,n.stroke(),n.restore();var o=new e.CanvasTexture(r);return o.generateMipmaps=!0,o}}return null}(),us=function(){if("undefined"!=typeof document){var t=256,i=128,r=document.createElement("canvas");r.setAttribute("width",String(512)),r.setAttribute("height",String(512));var n=r.getContext("2d");if(n){n.save(),n.beginPath(),n.arc(t,t,i,0,2*Math.PI);var o=n.createLinearGradient(t-Math.cos(Math.PI/4)*i,t-Math.sin(Math.PI/4)*i,t+Math.cos(Math.PI/4)*i,t+Math.sin(Math.PI/4)*i);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)"),n.strokeStyle=o,n.lineWidth=40.96,n.shadowBlur=25.6,n.shadowColor="rgba(0, 0, 0, 0.1)",n.stroke(),n.restore();var s=new e.CanvasTexture(r);return s.generateMipmaps=!0,s}}return null}(),hs=function(){if("undefined"!=typeof document){var t=256,i=199.68,r=document.createElement("canvas");r.setAttribute("width",String(512)),r.setAttribute("height",String(512));var n=r.getContext("2d");if(n){n.save(),n.beginPath(),n.arc(t,t,i,0,2*Math.PI);var o=n.createLinearGradient(t+Math.cos(Math.PI/4)*i,t-Math.sin(Math.PI/4)*i,t-Math.cos(Math.PI/4)*i,t+Math.sin(Math.PI/4)*i);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)"),n.strokeStyle=o,n.lineWidth=15.36,n.shadowBlur=25.6,n.shadowColor="rgba(0, 0, 0, 0.2)",n.stroke(),n.restore();var s=new e.CanvasTexture(r);return s.generateMipmaps=!0,s}}return null}(),cs=function(){if("undefined"!=typeof document){var t=256,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(t,t,153.6,0,2*Math.PI);var n=r.createRadialGradient(t,t,153.6,t,t,0);n.addColorStop(0,"rgba(255, 255, 255, 0.9)"),n.addColorStop(.3,"rgba(255, 255, 255, 0.0)"),r.fillStyle=n,r.fill(),r.restore();var o=new e.CanvasTexture(i);return o.generateMipmaps=!0,o}}return null}(),ds=function(e,t){e.save(),e.clearRect(0,0,256,256),e.beginPath(),e.arc(128,128,88.32,0,2*Math.PI*t),e.lineWidth=30.72,e.strokeStyle="rgba(255, 255, 255, 0.4)",e.stroke(),e.restore()},ps=function(){if("undefined"!=typeof document){var t=document.createElement("canvas");t.setAttribute("width",String(256)),t.setAttribute("height",String(256));var i=t.getContext("2d");i&&ds(i,2*Math.PI);var r=new e.CanvasTexture(t);return Object.assign(r,{setProgress:function(e){i&&(ds(i,e),r.needsUpdate=!0)}})}return null},fs=[],As=ps(),gs=function(t){function i(){var i=t.call(this)||this;i.progress=0,i.opacity=0,i.loading=!1,i.current=!1,i.disabled=!1,i.currentMotion=new Vo({progress:0}),i.ringMotion=new Vo({scale:1,opacity:1}),i.tapMotion=new Vo({scale:1,opacity:1}),i.progressMotion=new Vo({progress:0}),i.progressOpacityMotion=new Vo({opacity:0}),i.opacityMotion=new Vo({opacity:0});var r={blending:e.CustomBlending,blendSrc:e.SrcAlphaFactor,blendDst:e.OneMinusSrcAlphaFactor,blendSrcAlpha:e.OneFactor,blendDstAlpha:e.OneMinusSrcAlphaFactor,depthWrite:!1};return i.centerMesh=new e.Mesh(rs,new e.MeshBasicMaterial(Ne(Ne({},r),{map:us,opacity:0}))),i.ringMesh=new e.Mesh(rs,new e.MeshBasicMaterial(Ne(Ne({},r),{map:hs,opacity:0}))),i.loadingMesh=new e.Mesh(rs,new e.MeshBasicMaterial(Ne(Ne({},r),{map:as,opacity:.5}))),i.disableMesh=new e.Mesh(rs,new e.MeshBasicMaterial(Ne(Ne({},r),{map:ls,opacity:0}))),i.progressMesh=new e.Mesh(rs,new e.MeshBasicMaterial(Ne(Ne({},r),{map:As,opacity:0}))),i.expandMesh=new e.Mesh(rs,new e.MeshBasicMaterial(Ne(Ne({},r),{map:cs,opacity:0}))),i.expandMesh2=new e.Mesh(rs,new e.MeshBasicMaterial(Ne(Ne({},r),{map:cs,opacity:0}))),i.loadingMesh.visible=!1,i.disableMesh.visible=!1,i.ringMesh.position.y=.003,i.disableMesh.position.y=.003,i.centerMesh.position.y=.004,i.loadingMesh.position.y=.003,i.progressMesh.position.y=.003,i.expandMesh.position.y=.002,i.expandMesh2.position.y=.002,i.centerMesh.frustumCulled=!1,i.ringMesh.frustumCulled=!1,i.progressMesh.frustumCulled=!1,i.loadingMesh.frustumCulled=!1,i.disableMesh.frustumCulled=!1,i.expandMesh.frustumCulled=!1,i.expandMesh2.frustumCulled=!1,i.container=new e.Group,i.renderOrder=-2,i.container.renderOrder=-2,i.container.add(i.centerMesh),i.container.add(i.ringMesh),i.container.add(i.progressMesh),i.container.add(i.loadingMesh),i.container.add(i.disableMesh),i.add(i.container),i.add(i.expandMesh),i.add(i.expandMesh2),i.currentStartTime=je(),i.needsRender=!0,i}return Oe(i,t),i.prototype.setProgress=function(e){this.setDisabled(!1),this.setLoading(!1),this.progress!==e&&(e=bo(e,0,1),this.tapMotion.ended&&(0===this.progress&&this.progressOpacityMotion.set({opacity:1},300).catch(ze),0===e?(this.progressOpacityMotion.set({opacity:0},300).catch(ze),this.progressMotion.set({progress:bo(1.2*e,0,1)},0).catch(ze)):this.progressMotion.set({progress:bo(1.2*e,0,1)},100).catch(ze)),this.progress=e)},i.prototype.setOpacity=function(e){this.opacity!==e&&(this.opacity=e=bo(e,0,1),this.opacityMotion.set({opacity:e},500).catch(ze))},i.prototype.setCurrent=function(e){this.current!==e&&(this.currentMotion.set({progress:e?1:0},1e3).catch(ze),this.current=e,!0===this.current&&(this.currentStartTime=je()))},i.prototype.setLoading=function(e){this.loading!==e&&(this.loading=e,!0===this.disabled&&this.setDisabled(!1),this.loadingMesh.visible=e,this.needsRender=!0)},i.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)},i.prototype.tap=function(){var e=this;return this.tapMotion.ended?(this.progressOpacityMotion.set({opacity:0},0).catch(ze),this.progressMotion.set({progress:0},0).catch(ze),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(ze),e.progressMotion.set({progress:e.progress},120).catch(ze)})).catch(ze)):Promise.resolve()},i.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!==As&&(fs.push(this.progressMesh.material.map),this.progressMesh.material.map=As);else if(1===r)this.progressMesh.material.map!==As&&(fs.push(this.progressMesh.material.map),this.progressMesh.material.map=As);else{if(this.progressMesh.material.map===As){var n=fs.pop()||ps();this.progressMesh.material.map=n}null===(i=this.progressMesh.material.map)||void 0===i||i.setProgress(r)}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-$o(s))/4*this.currentMotion.progress*this.opacityMotion.value.opacity,s=(e-480)/2e3%1,this.expandMesh2.material.opacity=(1-$o(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(ze):1!==this.ringMotion.getTargetKeyframe().value.scale&&this.ringMotion.set({scale:1,opacity:1},500).catch(ze)}else 1!==this.ringMotion.getTargetKeyframe().value.scale&&this.ringMotion.set({scale:1,opacity:1},500).catch(ze);if(this.current||!this.currentMotion.ended){this.currentMotion.update(e);var h=(e-this.currentStartTime)/2e3;Math.ceil(h)%5<3&&(a=1+Math.sin(Math.PI*h)/25*this.currentMotion.value.progress,this.centerMesh.scale.set(a,1,a),this.needsRender=!0);var c=(e-this.currentStartTime)/2e3;Math.ceil(c)%5<3&&(a=1+.8*$o(s=c%1)*this.currentMotion.value.progress,this.expandMesh.scale.set(a,1,a),this.expandMesh.material.opacity=(1-$o(s))*this.currentMotion.value.progress*this.opacityMotion.value.opacity,this.needsRender=!0);var d=(e-this.currentStartTime-500)/2e3;Math.ceil(d)%5<3&&(a=1+.8*$o(s=d%1)*this.currentMotion.value.progress,this.expandMesh2.scale.set(a,1,a),this.expandMesh2.material.opacity=(1-$o(s))/2*this.currentMotion.value.progress*this.opacityMotion.value.opacity,this.needsRender=!0)}},i.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!==As&&(fs.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()},i}(e.Object3D),ms=new Float32Array([-.13,0,-.13,.13,0,-.13,-.13,0,.13,.13,0,.13]),vs=new Float32Array([0,1,1,1,0,0,1,0]),ys=new Uint8Array([0,2,1,2,3,1]),bs=new e.BufferGeometry;bs.setAttribute("position",new e.BufferAttribute(ms,3)),bs.setAttribute("uv",new e.BufferAttribute(vs,2)),bs.setIndex(new e.BufferAttribute(ys,1));var xs=function(){var t=Oo(),i=new e.Texture;return t.onload=function(){if("undefined"!=typeof document){var e=256,r=document.createElement("canvas");r.setAttribute("width",String(e)),r.setAttribute("height",String(e));var n=r.getContext("2d");if(n){n.drawImage(t,0,0,e,e),n.globalCompositeOperation="source-out";n.beginPath(),n.lineWidth=29.952,n.arc(128,128,84.48,0,2*Math.PI),n.strokeStyle="rgba(255, 255, 255, 0.5)",n.closePath(),n.stroke(),i.image=r,i.needsUpdate=!0}}},t.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAR9JREFUOBF10kFOAzEMBdCZFhCbrrgAN+NqHIULsWKDKO3gF+VHoZpa+rXjfH87nq7btr0ty3KZ8FsxnHeQPL748lA/x0Jsq+AwYe0X8nDtGA33BEJUHIEKW/EorHOLI7BHNlkEbju38YkQAIRZxFkHz2HOirKDxNcIzG+fu/6oLiNmqc5ZrlwTeKyAgJF14tMZmSn87pBrxeX/CRABgk/dl1s+C18dio2Pp9nmCQru2UtdvN+7lI9AFsgb3zNMcSp8FF4LYs3UhLfOAvkDJffci8q1J/ByRLKnQ8gUJUFOd2SeZYliCxwiyJCxCbhUGFKF4zPm61hiq7sVyJnPmATyR5IzLSNyDNEFRCDnkAmA8U2RfCsIefYhDeKOQLv7A+l1ZTyjymNxAAAAAElFTkSuQmCC",i}(),ws=function(){if("undefined"!=typeof document){var t=document.createElement("canvas");t.setAttribute("width",String(512)),t.setAttribute("height",String(512));var i=t.getContext("2d");if(i){var r=256,n=199.68;return i.beginPath(),i.arc(r,r,n,0,2*Math.PI),i.fillStyle="rgba(255, 255, 255, 0.1)",i.closePath(),i.fill(),i.save(),i.beginPath(),i.arc(r,r,n,0,2*Math.PI),i.strokeStyle="rgba(255, 255, 255, 0.5)",i.lineWidth=10.24,i.closePath(),i.stroke(),new e.CanvasTexture(t)}}return null}(),Es=function(){if("undefined"!=typeof document){var t=document.createElement("canvas");t.setAttribute("width",String(512)),t.setAttribute("height",String(512));var i=t.getContext("2d");if(i)return i.beginPath(),i.arc(256,256,199.68,0,2*Math.PI),i.fillStyle="rgba(0, 0, 0, 0.2)",i.closePath(),i.fill(),new e.CanvasTexture(t)}return null}(),Ms=function(){if("undefined"!=typeof document){var t=document.createElement("canvas");t.setAttribute("width",String(512)),t.setAttribute("height",String(512));var i=t.getContext("2d");if(i){var r=256,n=138.24,o=i.createLinearGradient(r-Math.cos(Math.PI/4)*n,r-Math.sin(Math.PI/4)*n,r+Math.cos(Math.PI/4)*n,r+Math.sin(Math.PI/4)*n);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)"),i.beginPath(),i.lineWidth=33.28,i.arc(r,r,n,0,2*Math.PI),i.strokeStyle=o,i.shadowBlur=38.4,i.shadowColor="rgba(0, 0, 0, 0.3)",i.closePath(),i.stroke(),new e.CanvasTexture(t)}}return null}(),Ss=function(){if("undefined"!=typeof document){var t=document.createElement("canvas");t.setAttribute("width",String(512)),t.setAttribute("height",String(512));var i=t.getContext("2d");if(i){var r=256,n=199.68,o=i.createLinearGradient(r+Math.cos(Math.PI/4)*n,r-Math.sin(Math.PI/4)*n,r-Math.cos(Math.PI/4)*n,r+Math.sin(Math.PI/4)*n);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)"),i.beginPath(),i.lineWidth=15.36,i.arc(r,r,n,0,2*Math.PI),i.strokeStyle=o,i.shadowBlur=25.6,i.shadowColor="rgba(0, 0, 0, 0.5)",i.closePath(),i.stroke(),new e.CanvasTexture(t)}}return null}(),Cs=function(e,t){e.clearRect(0,0,256,256),e.beginPath(),e.lineWidth=29.44,e.arc(128,128,84.48,0,2*Math.PI*t),e.strokeStyle="rgba(255, 255, 255, 0.2)",e.stroke()},Is=function(){if("undefined"!=typeof document){var t=document.createElement("canvas");t.setAttribute("width",String(256)),t.setAttribute("height",String(256));var i=t.getContext("2d");i&&Cs(i,2*Math.PI);var r=new e.CanvasTexture(t);return Object.assign(r,{setProgress:function(e){i&&(Cs(i,e),r.needsUpdate=!0)}})}return null},Bs=[],Ts=Is(),Ps=function(t){function i(){var i=t.call(this)||this;i.progress=0,i.opacity=0,i.loading=!1,i.current=!1,i.disabled=!1,i.ringRotateMotion=new Vo({angle:0}),i.tapMotion=new Vo({scale:1,opacity:1}),i.progressMotion=new Vo({progress:0}),i.progressOpacityMotion=new Vo({opacity:0}),i.opacityMotion=new Vo({opacity:0});var r={blending:e.CustomBlending,blendSrc:e.SrcAlphaFactor,blendDst:e.OneMinusSrcAlphaFactor,blendSrcAlpha:e.OneFactor,blendDstAlpha:e.OneMinusSrcAlphaFactor,depthWrite:!1};return i.backgroundMesh=new e.Mesh(bs,new e.MeshBasicMaterial(Ne(Ne({},r),{map:Es,opacity:1}))),i.centerMesh=new e.Mesh(bs,new e.MeshBasicMaterial(Ne(Ne({},r),{map:Ms,opacity:0}))),i.ringMesh=new e.Mesh(bs,new e.MeshBasicMaterial(Ne(Ne({},r),{map:Ss,opacity:0}))),i.loadingMesh=new e.Mesh(bs,new e.MeshBasicMaterial(Ne(Ne({},r),{map:xs,opacity:.5}))),i.disableMesh=new e.Mesh(bs,new e.MeshBasicMaterial(Ne(Ne({},r),{map:ws,opacity:0}))),i.progressMesh=new e.Mesh(bs,new e.MeshBasicMaterial(Ne(Ne({},r),{map:Ts,opacity:0}))),i.loadingMesh.visible=!1,i.disableMesh.visible=!1,i.backgroundMesh.position.y=.0018,i.ringMesh.position.y=.003,i.disableMesh.position.y=.002,i.centerMesh.position.y=.002,i.loadingMesh.position.y=.005,i.progressMesh.position.y=.004,i.centerMesh.frustumCulled=!1,i.ringMesh.frustumCulled=!1,i.progressMesh.frustumCulled=!1,i.loadingMesh.frustumCulled=!1,i.disableMesh.frustumCulled=!1,i.container=new e.Group,i.renderOrder=-2,i.container.renderOrder=-2,i.container.add(i.backgroundMesh),i.container.add(i.centerMesh),i.container.add(i.ringMesh),i.container.add(i.progressMesh),i.container.add(i.loadingMesh),i.container.add(i.disableMesh),i.add(i.container),i.needsRender=!0,i}return Oe(i,t),i.prototype.setProgress=function(e){this.setDisabled(!1),this.setLoading(!1),this.progress!==e&&(e=bo(e,0,1),this.tapMotion.ended&&(0===this.progress&&this.progressOpacityMotion.set({opacity:1},300).catch(ze),0===e?(this.progressOpacityMotion.set({opacity:0},300).catch(ze),this.progressMotion.set({progress:bo(1.2*e,0,1)},0).catch(ze)):this.progressMotion.set({progress:bo(1.2*e,0,1)},100).catch(ze)),this.progress=e)},i.prototype.setOpacity=function(e){this.opacity!==e&&(this.opacity=e=bo(e,0,1),this.opacityMotion.set({opacity:e},500).catch(ze))},i.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(ze)}this.current=e}},i.prototype.setLoading=function(e){this.loading!==e&&(this.loading=e,!0===this.disabled&&this.setDisabled(!1),this.loadingMesh.visible=e,this.needsRender=!0)},i.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)},i.prototype.tap=function(){var e=this;return this.tapMotion.ended?(this.progressOpacityMotion.set({opacity:0},0).catch(ze),this.progressMotion.set({progress:0},0).catch(ze),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(ze),e.progressMotion.set({progress:e.progress},120).catch(ze)})).catch(ze)):Promise.resolve()},i.prototype.updateTime=function(t,i){var r;if(!this.progressMotion.ended){this.progressMotion.update(t);var n=this.progressMotion.value.progress;if(null!==this.progressMesh.material.map)if(0===n)this.progressMesh.material.map!==Ts&&(Bs.push(this.progressMesh.material.map),this.progressMesh.material.map=Ts);else if(1===n)this.progressMesh.material.map!==Ts&&(Bs.push(this.progressMesh.material.map),this.progressMesh.material.map=Ts);else{if(this.progressMesh.material.map===Ts){var o=Bs.pop()||Is();this.progressMesh.material.map=o}null===(r=this.progressMesh.material.map)||void 0===r||r.setProgress(n)}this.needsRender=!0}if(!this.progressOpacityMotion.ended){this.progressOpacityMotion.update(t);var s=this.progressOpacityMotion.value.opacity;this.progressMesh.material.opacity=s,this.needsRender=!0}if(this.opacityMotion.ended||(this.opacityMotion.update(t),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),!0===this.loadingMesh.visible&&(this.loadingMesh.rotateY(-i/120),this.needsRender=!0),!this.tapMotion.ended){this.tapMotion.update(t);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(t),this.ringMesh.quaternion.setFromEuler(new e.Euler(0,this.ringRotateMotion.value.angle,0)),this.needsRender=!0)},i.prototype.dispose=function(){this.ringRotateMotion.dispose(),this.tapMotion.dispose(),this.progressMotion.dispose(),this.progressOpacityMotion.dispose(),this.opacityMotion.dispose(),this.progressMesh.material.map!==Ts&&(Bs.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()},i}(e.Object3D),Rs=function(e){return 2*e-e*e*e},ks=new Float32Array([-.13,0,-.13,.13,0,-.13,-.13,0,.13,.13,0,.13]),Ls=new Float32Array([0,1,1,1,0,0,1,0]),Ds=new Uint8Array([0,2,1,2,3,1]),Os=new e.BufferGeometry;Os.setAttribute("position",new e.BufferAttribute(ks,3)),Os.setAttribute("uv",new e.BufferAttribute(Ls,2)),Os.setIndex(new e.BufferAttribute(Ds,1));var Ns=function(){var t=Oo(),i=new e.Texture,r=256;return t.onload=function(){if("undefined"!=typeof document){var e=document.createElement("canvas");e.setAttribute("width",String(r)),e.setAttribute("height",String(r));var n=e.getContext("2d");n&&(n.save(),n.clearRect(0,0,r,r),n.drawImage(t,0,0,r,r),n.globalCompositeOperation="source-out",n.beginPath(),n.lineWidth=29.44,n.arc(128,128,84.48,0,2*Math.PI),n.strokeStyle="rgba(255, 255, 255, 0.7)",n.stroke(),n.restore(),i.image=e,i.needsUpdate=!0)}},t.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAR9JREFUOBF10kFOAzEMBdCZFhCbrrgAN+NqHIULsWKDKO3gF+VHoZpa+rXjfH87nq7btr0ty3KZ8FsxnHeQPL748lA/x0Jsq+AwYe0X8nDtGA33BEJUHIEKW/EorHOLI7BHNlkEbju38YkQAIRZxFkHz2HOirKDxNcIzG+fu/6oLiNmqc5ZrlwTeKyAgJF14tMZmSn87pBrxeX/CRABgk/dl1s+C18dio2Pp9nmCQru2UtdvN+7lI9AFsgb3zNMcSp8FF4LYs3UhLfOAvkDJffci8q1J/ByRLKnQ8gUJUFOd2SeZYliCxwiyJCxCbhUGFKF4zPm61hiq7sVyJnPmATyR5IzLSNyDNEFRCDnkAmA8U2RfCsIefYhDeKOQLv7A+l1ZTyjymNxAAAAAElFTkSuQmCC",i}(),Fs=function(){if("undefined"!=typeof document){var t=256,i=199.68,r=document.createElement("canvas");r.setAttribute("width",String(512)),r.setAttribute("height",String(512));var n=r.getContext("2d");if(n)return n.save(),n.beginPath(),n.arc(t,t,i,0,2*Math.PI),n.fillStyle="rgba(255, 255, 255, 0.1)",n.fill(),n.beginPath(),n.arc(t,t,i,0,2*Math.PI),n.strokeStyle="rgba(255, 255, 255, 0.5)",n.lineWidth=10.24,n.stroke(),n.restore(),new e.CanvasTexture(r)}return null}(),Qs=function(){if("undefined"!=typeof document){var 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(128,128,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 e.CanvasTexture(t)}return null}(),Vs=function(){if("undefined"!=typeof document){var t=256,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(t,t,204.8,0,2*Math.PI);var n=r.createRadialGradient(t,t,204.8,t,t,0);n.addColorStop(0,"rgba(255, 255, 255, 0.9)"),n.addColorStop(.3,"rgba(255, 255, 255, 0.0)"),r.fillStyle=n,r.fill(),r.restore();var o=new e.CanvasTexture(i);return o.generateMipmaps=!0,o}}return null}(),Hs=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()},qs=function(){if("undefined"!=typeof document){var t=document.createElement("canvas");t.setAttribute("width",String(256)),t.setAttribute("height",String(256));var i=t.getContext("2d");i&&Hs(i,2*Math.PI);var r=new e.CanvasTexture(t);return Object.assign(r,{setProgress:function(e){i&&(Hs(i,e),r.needsUpdate=!0)}})}return null},zs=[],Us=qs(),js=function(t){function i(){var i=t.call(this)||this;i.progress=0,i.opacity=0,i.loading=!1,i.current=!1,i.disabled=!1,i.currentMotion=new Vo({progress:0}),i.tapMotion=new Vo({scale:1,opacity:1}),i.progressMotion=new Vo({progress:0}),i.progressOpacityMotion=new Vo({opacity:0}),i.opacityMotion=new Vo({opacity:0});var r={blending:e.CustomBlending,blendSrc:e.SrcAlphaFactor,blendDst:e.OneMinusSrcAlphaFactor,blendSrcAlpha:e.OneFactor,blendDstAlpha:e.OneMinusSrcAlphaFactor,depthWrite:!1};return i.centerMesh=new e.Mesh(Os,new e.MeshBasicMaterial(Ne(Ne({},r),{map:Qs,opacity:0}))),i.loadingMesh=new e.Mesh(Os,new e.MeshBasicMaterial(Ne(Ne({},r),{map:Ns,opacity:.5}))),i.disableMesh=new e.Mesh(Os,new e.MeshBasicMaterial(Ne(Ne({},r),{map:Fs,opacity:0}))),i.progressMesh=new e.Mesh(Os,new e.MeshBasicMaterial(Ne(Ne({},r),{map:Us,opacity:0}))),i.expandMesh=new e.Mesh(Os,new e.MeshBasicMaterial(Ne(Ne({},r),{map:Vs,opacity:0}))),i.expandMesh2=new e.Mesh(Os,new e.MeshBasicMaterial(Ne(Ne({},r),{map:Vs,opacity:0}))),i.loadingMesh.visible=!1,i.disableMesh.visible=!1,i.disableMesh.position.y=.003,i.centerMesh.position.y=.003,i.loadingMesh.position.y=.005,i.progressMesh.position.y=.004,i.expandMesh.position.y=.002,i.expandMesh2.position.y=.002,i.centerMesh.frustumCulled=!1,i.progressMesh.frustumCulled=!1,i.loadingMesh.frustumCulled=!1,i.disableMesh.frustumCulled=!1,i.expandMesh.frustumCulled=!1,i.expandMesh2.frustumCulled=!1,i.container=new e.Group,i.renderOrder=-2,i.container.renderOrder=-2,i.container.add(i.centerMesh),i.container.add(i.progressMesh),i.container.add(i.loadingMesh),i.container.add(i.disableMesh),i.add(i.container),i.add(i.expandMesh),i.add(i.expandMesh2),i.currentStartTime=je(),i.needsRender=!0,i}return Oe(i,t),i.prototype.setProgress=function(e){this.setDisabled(!1),this.setLoading(!1),this.progress!==e&&(e=bo(e,0,1),this.tapMotion.ended&&(0===this.progress&&this.progressOpacityMotion.set({opacity:1},300).catch(ze),0===e?(this.progressOpacityMotion.set({opacity:0},300).catch(ze),this.progressMotion.set({progress:bo(1.2*e,0,1)},0).catch(ze)):this.progressMotion.set({progress:bo(1.2*e,0,1)},100).catch(ze)),this.progress=e)},i.prototype.setOpacity=function(e){e>0&&(e=1),this.opacity!==e&&(this.opacity=e=bo(e,0,1),this.opacityMotion.set({opacity:e},500).catch(ze))},i.prototype.setCurrent=function(e){this.current!==e&&(this.currentMotion.set({progress:e?1:0},1e3).catch(ze),this.current=e,!0===this.current&&(this.currentStartTime=je()))},i.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(ze),this.needsRender=!0)},i.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)},i.prototype.tap=function(){var e=this;return this.tapMotion.ended?(this.progressOpacityMotion.set({opacity:0},0).catch(ze),this.progressMotion.set({progress:0},0).catch(ze),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(ze),e.progressMotion.set({progress:e.progress},120).catch(ze)})).catch(ze)):Promise.resolve()},i.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!==Us&&(zs.push(this.progressMesh.material.map),this.progressMesh.material.map=Us);else if(1===r)this.progressMesh.material.map!==Us&&(zs.push(this.progressMesh.material.map),this.progressMesh.material.map=Us);else{if(this.progressMesh.material.map===Us){var n=zs.pop()||qs();this.progressMesh.material.map=n}null===(i=this.progressMesh.material.map)||void 0===i||i.setProgress(r)}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;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;Math.ceil(l)%5<3&&(s=1+.8*Rs(u=l%1)*this.currentMotion.value.progress,this.expandMesh.scale.set(s,1,s),this.expandMesh.material.opacity=(1-Rs(u))*this.currentMotion.value.progress*this.opacityMotion.value.opacity,this.needsRender=!0);var u,h=(e-this.currentStartTime-500)/2e3;if(Math.ceil(h)%5<3)s=1+.8*Rs(u=h%1)*this.currentMotion.value.progress,this.expandMesh2.scale.set(s,1,s),this.expandMesh2.material.opacity=(1-Rs(u))/2*this.currentMotion.value.progress*this.opacityMotion.value.opacity,this.needsRender=!0}},i.prototype.dispose=function(){this.currentMotion.dispose(),this.tapMotion.dispose(),this.progressMotion.dispose(),this.progressOpacityMotion.dispose(),this.opacityMotion.dispose(),this.progressMesh.material.map!==Us&&(zs.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()},i}(e.Object3D),Ks=new e.CircleBufferGeometry(.1,16),_s=function(){if("undefined"!=typeof document){var t=document.createElement("canvas");t.setAttribute("width",String(512)),t.setAttribute("height",String(512));var i=t.getContext("2d");if(i){var r=256;i.lineWidth=76.8,i.arc(r,r,192,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=76.8,i.arc(r,r,192,0,2*Math.PI);var n=i.createRadialGradient(r,r,153.6,r,r,230.4);n.addColorStop(0,"rgba(255, 255, 255, 0.3)"),n.addColorStop(.3,"rgba(255, 255, 255, 0.0)"),n.addColorStop(.7,"rgba(255, 255, 255, 0.0)"),n.addColorStop(1,"rgba(255, 255, 255, 0.3)"),i.strokeStyle=n,i.stroke(),i.beginPath(),i.lineWidth=4.8,i.arc(r,r,228,0,2*Math.PI);var o=i.createLinearGradient(0,0,512,0);return o.addColorStop(.02,"rgba(255, 255, 255, 1.0)"),o.addColorStop(.08,"rgba(255, 255, 255, 0.0)"),o.addColorStop(.92,"rgba(255, 255, 255, 0.0)"),o.addColorStop(.98,"rgba(255, 255, 255, 1.0)"),i.strokeStyle=o,i.stroke(),new e.CanvasTexture(t)}}return null}(),Gs=new e.MeshBasicMaterial({map:_s,transparent:!0}),Ws=function(t){function i(){var i=t.call(this)||this;return i.ringMesh=new e.Mesh(Ks,Gs),i.ringMesh.renderOrder=-3,i.add(i.ringMesh),i}return Oe(i,t),i.prototype.dispose=function(){this.remove(this.ringMesh)},i}(e.Object3D);function Xs(e,t,i){var r=Math.abs(e-t);return r<.001||void 0!==i&&Math.abs(i-r)<.001}function Ys(e,t,i){return!Xs(e,t,i)}function Zs(e,t){return e.distanceTo(t)<.001}function Js(e,t){return!Zs(e,t)}var $s=new e.Vector3(0,0,0),ea=function(t){function i(i,r){void 0===r&&(r=$s);var n=t.call(this)||this,o=new e.BoxBufferGeometry(i.max.x-i.min.x+2*r.x,i.max.y-i.min.y+2*r.y,i.max.z-i.min.z+2*r.z,1,1);o.groups.length=0,o.groups.push({start:0,count:36,materialIndex:0}),o.applyMatrix4((new e.Matrix4).makeScale(-1,1,1)),o.computeVertexNormals();var s=new pi;s.defines.USE_MAP=!1,s.defines.USE_UV=!1,s.uniforms.diffuse.value=new e.Color(16777215);var a=new Mt(o,[s]);return a.floorIndex=-1,a.position.copy(i.getCenter(new e.Vector3)),a.frustumCulled=!1,n.renderOrder=-3,n.add(a),n.boundingBox=new e.Box3,n.computeBoundingBox(),n}return Oe(i,t),i.prototype.computeBoundingBox=function(){this.boundingBox.setFromObject(this)},i.prototype.dispose=function(){this.disposeMaterial(),this.disposeGeometry()},i}(Ct);function ta(e,t){return void 0===t&&(t=$s),new ea(e,t)}function ia(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 ra=2*Math.PI;function na(e){return e>=0&&e<ra?e:(e%ra+ra)%ra}var oa=Math.PI,sa=2*oa;function aa(e,t,i){if(e===t)return t;var r=t-e;return Math.abs(r)<=i?t:e+(r>0?1:-1)*i}(function(){try{var e=document.createElement("canvas");!window.WebGLRenderingContext||!e.getContext("webgl")&&e.getContext("experimental-webgl")}catch(e){return!1}})(),"undefined"!=typeof history&&"pushState"in history&&"replaceState"in history&&history;var la=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 ua(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 ha(e,t){return e.panoIndex===t.panoIndex&&e.mode===t.mode&&Xs(e.longitude,t.longitude,2*Math.PI)&&Xs(e.latitude,t.latitude)&&Xs(e.fov,t.fov)&&Zs(e.offset,t.offset)}var ca=function(e){return Number(e)};function da(e,t,i){var r;void 0===t&&(t=ca),void 0===i&&(i=!1);for(var n,o=1/0,s=0,a=e;s<a.length;s++){var l=a[s],u=t(l);u<=o&&(n=(r=[l,u])[0],o=r[1])}return i?[n,o]:n}function pa(e){for(var t in e)return!1;return!0}function fa(e){return{longitude:e.longitude,latitude:e.latitude,fov:e.fov,offset:e.offset.clone(),distance:e.distance}}var Aa=function(e,t,i,r){var n,o=["","webkit","Moz","MS","ms","o"],s=t.createElement?t.createElement("div"):r,a=Math.round,l=Math.abs,u=Date.now;function h(e,t,i){return setTimeout(m(e,i),t)}function c(e,t,i){return!!Array.isArray(e)&&(d(e,i[t],i),!0)}function d(e,t,i){var n;if(e)if(e.forEach)e.forEach(t,i);else if(e.length!==r)for(n=0;n<e.length;)t.call(i,e[n],n,e),n++;else for(n in e)e.hasOwnProperty(n)&&t.call(i,e[n],n,e)}function p(t,i,r){var n="DEPRECATED METHOD: "+i+"\n"+r+" AT \n";return function(){var i=new Error("get-stack-trace"),r=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,n,r),t.apply(this,arguments)}}n="function"!=typeof Object.assign?function(e){if(e===r||null===e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),i=1;i<arguments.length;i++){var n=arguments[i];if(n!==r&&null!==n)for(var o in n)n.hasOwnProperty(o)&&(t[o]=n[o])}return t}:Object.assign;var f=p((function(e,t,i){for(var n=Object.keys(t),o=0;o<n.length;)(!i||i&&e[n[o]]===r)&&(e[n[o]]=t[n[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 r,o=t.prototype;(r=e.prototype=Object.create(o)).constructor=e,r._super=o,i&&n(r,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]||r,t):e}function y(e,t){return e===r?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 r=0;r<e.length;){if(i&&e[r][i]==t||!i&&e[r]===t)return r;r++}return-1}function C(e){return Array.prototype.slice.call(e,0)}function I(e,t,i){for(var r=[],n=[],o=0;o<e.length;){var s=t?e[o][t]:e[o];S(n,s)<0&&r.push(e[o]),n[o]=s,o++}return i&&(r=t?r.sort((function(e,i){return e[t]>i[t]})):r.sort()),r}function B(e,t){for(var i,n,s=t[0].toUpperCase()+t.slice(1),a=0;a<o.length;){if((n=(i=o[a])?i+s:t)in e)return n;a++}return r}var T=1;function P(t){var i=t.ownerDocument||t;return i.defaultView||i.parentWindow||e}var R="ontouchstart"in e,k=B(e,"PointerEvent")!==r,L=R&&/mobile|tablet|ip(ad|hone|od)|android/i.test(navigator.userAgent),D="touch",O="mouse",N=["x","y"],F=["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 V(e,t,i){var n=i.pointers.length,o=i.changedPointers.length,s=1&t&&n-o==0,a=12&t&&n-o==0;i.isFirst=!!s,i.isFinal=!!a,s&&(e.session={}),i.eventType=t,function(e,t){var i=e.session,n=t.pointers,o=n.length;i.firstInput||(i.firstInput=H(t)),o>1&&!i.firstMultiple?i.firstMultiple=H(t):1===o&&(i.firstMultiple=!1);var s=i.firstInput,a=i.firstMultiple,h=a?a.center:s.center,c=t.center=q(n);t.timeStamp=u(),t.deltaTime=t.timeStamp-s.timeStamp,t.angle=K(h,c),t.distance=j(h,c),function(e,t){var i=t.center,r=e.offsetDelta||{},n=e.prevDelta||{},o=e.prevInput||{};1!==t.eventType&&4!==o.eventType||(n=e.prevDelta={x:o.deltaX||0,y:o.deltaY||0},r=e.offsetDelta={x:i.x,y:i.y}),t.deltaX=n.x+(i.x-r.x),t.deltaY=n.y+(i.y-r.y)}(i,t),t.offsetDirection=U(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 j(t[0],t[1],F)/j(e[0],e[1],F)}(a.pointers,n):1,t.rotation=a?function(e,t){return K(t[1],t[0],F)+K(e[1],e[0],F)}(a.pointers,n):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,n,o,s,a=e.lastInterval||t,u=t.timeStamp-a.timeStamp;if(8!=t.eventType&&(u>25||a.velocity===r)){var h=t.deltaX-a.deltaX,c=t.deltaY-a.deltaY,d=z(u,h,c);n=d.x,o=d.y,i=l(d.x)>l(d.y)?d.x:d.y,s=U(h,c),e.lastInterval=t}else i=a.velocity,n=a.velocityX,o=a.velocityY,s=a.direction;t.velocity=i,t.velocityX=n,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 H(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:q(t),deltaX:e.deltaX,deltaY:e.deltaY}}function q(e){var t=e.length;if(1===t)return{x:a(e[0].clientX),y:a(e[0].clientY)};for(var i=0,r=0,n=0;n<t;)i+=e[n].clientX,r+=e[n].clientY,n++;return{x:a(i/t),y:a(r/t)}}function z(e,t,i){return{x:t/e||0,y:i/e||0}}function U(e,t){return e===t?1:l(e)>=l(t)?e<0?2:4:t<0?8:16}function j(e,t,i){i||(i=N);var r=t[i[0]]-e[i[0]],n=t[i[1]]-e[i[1]];return Math.sqrt(r*r+n*n)}function K(e,t,i){i||(i=N);var r=t[i[0]]-e[i[0]],n=t[i[1]]-e[i[1]];return 180*Math.atan2(n,r)/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},G="mousedown",W="mousemove mouseup";function X(){this.evEl=G,this.evWin=W,this.pressed=!1,Q.apply(this,arguments)}g(X,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 Y={pointerdown:1,pointermove:2,pointerup:4,pointercancel:8,pointerout:8},Z={2:D,3:"pen",4:O,5:"kinect"},J="pointerdown",$="pointermove pointerup pointercancel";function ee(){this.evEl=J,this.evWin=$,Q.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}e.MSPointerEvent&&!e.PointerEvent&&(J="MSPointerDown",$="MSPointerMove MSPointerUp MSPointerCancel"),g(ee,Q,{handler:function(e){var t=this.store,i=!1,r=!1,n=e.type.toLowerCase().replace("ms",""),o=Y[n],s=Z[e.pointerType]||e.pointerType,a=s==D,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,r=!0,o=Y.pointerup),l<0||(r||(t[l]=e),this.callback(this.manager,o,{pointers:t,changedPointers:[e],pointerType:s,srcEvent:t[l]}),i&&t.splice(l,1))}});var te={touchstart:1,touchmove:2,touchend:4,touchcancel:8},ie="touchstart",re="touchstart touchmove touchend touchcancel";function ne(){this.evTarget=ie,this.evWin=re,this.started=!1,Q.apply(this,arguments)}function oe(e,t){var i=C(e.touches),r=C(e.changedTouches);return 12&t&&(i=I(i.concat(r),"identifier",!0)),[i,r]}g(ne,Q,{handler:function(e){var t=te[e.type];if(1===t&&(this.started=!0),this.started){var i=oe.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:D,srcEvent:e})}}});var se={touchstart:1,touchmove:2,touchend:4,touchcancel:8},ae="touchstart touchmove touchend touchcancel";function le(){this.evTarget=ae,this.targetIds={},Q.apply(this,arguments)}function ue(e,t){var i=C(e.touches),r=this.targetIds;if(3&t&&1===i.length)return r[i[0].identifier]=!0,[i,i];var n,o,s=C(e.changedTouches),a=[],l=this.target;if(o=i.filter((function(e){return w(e.target,l)})),1===t)for(n=0;n<o.length;)r[o[n].identifier]=!0,n++;for(n=0;n<s.length;)r[s[n].identifier]&&a.push(s[n]),12&t&&delete r[s[n].identifier],n++;return a.length?[I(o.concat(a),"identifier",!0),a]:void 0}function he(){Q.apply(this,arguments);var e=m(this.handler,this);this.touch=new le(this.manager,e),this.mouse=new X(this.manager,e),this.primaryTouch=null,this.lastTouches=[]}function ce(e,t){1&e?(this.primaryTouch=t.changedPointers[0].identifier,de.call(this,t)):12&e&&de.call(this,t)}function de(e){var t=e.changedPointers[0];if(t.identifier===this.primaryTouch){var i={x:t.clientX,y:t.clientY};this.lastTouches.push(i);var r=this.lastTouches;setTimeout((function(){var e=r.indexOf(i);e>-1&&r.splice(e,1)}),2500)}}function pe(e){for(var t=e.srcEvent.clientX,i=e.srcEvent.clientY,r=0;r<this.lastTouches.length;r++){var n=this.lastTouches[r],o=Math.abs(t-n.x),s=Math.abs(i-n.y);if(o<=25&&s<=25)return!0}return!1}g(le,Q,{handler:function(e){var t=se[e.type],i=ue.call(this,e,t);i&&this.callback(this.manager,t,{pointers:i[0],changedPointers:i[1],pointerType:D,srcEvent:e})}}),g(he,Q,{handler:function(e,t,i){var r=i.pointerType==D,n=i.pointerType==O;if(!(n&&i.sourceCapabilities&&i.sourceCapabilities.firesTouchEvents)){if(r)ce.call(this,t,i);else if(n&&pe.call(this,i))return;this.callback(e,t,i)}},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});var fe=s?B(s.style,"touchAction"):r,Ae=fe!==r,ge="compute",me="auto",ve="manipulation",ye="none",be="pan-x",xe="pan-y",we=function(){if(!Ae)return!1;var t={},i=e.CSS&&e.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach((function(r){t[r]=!i||e.CSS.supports("touch-action",r)})),t}();function Ee(e,t){this.manager=e,this.set(t)}Ee.prototype={set:function(e){e==ge&&(e=this.compute()),Ae&&this.manager.element.style&&we[e]&&(this.manager.element.style[fe]=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,ye))return ye;var t=E(e,be),i=E(e,xe);return t&&i?ye:t||i?t?be:xe:E(e,ve)?ve:me}(e.join(" "))},preventDefaults:function(e){var t=e.srcEvent,i=e.offsetDirection;if(this.manager.session.prevented)t.preventDefault();else{var r=this.actions,n=E(r,ye)&&!we.none,o=E(r,xe)&&!we["pan-y"],s=E(r,be)&&!we["pan-x"];if(n){var a=1===e.pointers.length,l=e.distance<2,u=e.deltaTime<250;if(a&&l&&u)return}if(!s||!o)return n||o&&6&i||s&&24&i?this.preventSrc(t):void 0}},preventSrc:function(e){this.manager.session.prevented=!0,e.preventDefault()}};var Me=32;function Se(e){this.options=n({},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 Ce(e){return 16&e?"cancel":8&e?"end":4&e?"move":2&e?"start":""}function Ie(e){return 16==e?"down":8==e?"up":2==e?"left":4==e?"right":""}function Be(e,t){var i=t.manager;return i?i.get(e):e}function Te(){Se.apply(this,arguments)}function Pe(){Te.apply(this,arguments),this.pX=null,this.pY=null}function Re(){Te.apply(this,arguments)}function ke(){Se.apply(this,arguments),this._timer=null,this._input=null}function Le(){Te.apply(this,arguments)}function De(){Te.apply(this,arguments)}function Oe(){Se.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 Fe(e,t)}function Fe(e,t){this.options=n({},Ne.defaults,t||{}),this.options.inputTarget=this.options.inputTarget||e,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=e,this.input=new(this.options.inputClass||(k?ee:L?le:R?he:X))(this,V),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,r=e.element;r.style&&(d(e.options.cssProps,(function(n,o){i=B(r.style,o),t?(e.oldCssProps[i]=r.style[i],r.style[i]=n):r.style[i]=e.oldCssProps[i]||""})),t||(e.oldCssProps={}))}return Se.prototype={defaults:{},set:function(e){return n(this.options,e),this.manager&&this.manager.touchAction.update(),this},recognizeWith:function(e){if(c(e,"recognizeWith",this))return this;var t=this.simultaneous;return t[(e=Be(e,this)).id]||(t[e.id]=e,e.recognizeWith(this)),this},dropRecognizeWith:function(e){return c(e,"dropRecognizeWith",this)||(e=Be(e,this),delete this.simultaneous[e.id]),this},requireFailure:function(e){if(c(e,"requireFailure",this))return this;var t=this.requireFail;return-1===S(t,e=Be(e,this))&&(t.push(e),e.requireFailure(this)),this},dropRequireFailure:function(e){if(c(e,"dropRequireFailure",this))return this;e=Be(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 r(i){t.manager.emit(i,e)}i<8&&r(t.options.event+Ce(i)),r(t.options.event),e.additionalEvent&&r(e.additionalEvent),i>=8&&r(t.options.event+Ce(i))},tryEmit:function(e){if(this.canEmit())return this.emit(e);this.state=Me},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=n({},e);if(!v(this.options.enable,[this,t]))return this.reset(),void(this.state=Me);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(Te,Se,{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,r=6&t,n=this.attrTest(e);return r&&(8&i||!n)?16|t:r||n?4&i?8|t:2&t?4|t:2:Me}}),g(Pe,Te,{defaults:{event:"pan",threshold:10,pointers:1,direction:30},getTouchAction:function(){var e=this.options.direction,t=[];return 6&e&&t.push(xe),24&e&&t.push(be),t},directionTest:function(e){var t=this.options,i=!0,r=e.distance,n=e.direction,o=e.deltaX,s=e.deltaY;return n&t.direction||(6&t.direction?(n=0===o?1:o<0?2:4,i=o!=this.pX,r=Math.abs(e.deltaX)):(n=0===s?1:s<0?8:16,i=s!=this.pY,r=Math.abs(e.deltaY))),e.direction=n,i&&r>t.threshold&&n&t.direction},attrTest:function(e){return Te.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=Ie(e.direction);t&&(e.additionalEvent=this.options.event+t),this._super.emit.call(this,e)}}),g(Re,Te,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[ye]},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(ke,Se,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[me]},process:function(e){var t=this.options,i=e.pointers.length===t.pointers,r=e.distance<t.threshold,n=e.deltaTime>t.time;if(this._input=e,!r||!i||12&e.eventType&&!n)this.reset();else if(1&e.eventType)this.reset(),this._timer=h((function(){this.state=8,this.tryEmit()}),t.time,this);else if(4&e.eventType)return 8;return Me},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(Le,Te,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[ye]},attrTest:function(e){return this._super.attrTest.call(this,e)&&(Math.abs(e.rotation)>this.options.threshold||2&this.state)}}),g(De,Te,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:30,pointers:1},getTouchAction:function(){return Pe.prototype.getTouchAction.call(this)},attrTest:function(e){var t,i=this.options.direction;return 30&i?t=e.overallVelocity:6&i?t=e.overallVelocityX:24&i&&(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=Ie(e.offsetDirection);t&&this.manager.emit(this.options.event+t,e),this.manager.emit(this.options.event,e)}}),g(Oe,Se,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[ve]},process:function(e){var t=this.options,i=e.pointers.length===t.pointers,r=e.distance<t.threshold,n=e.deltaTime<t.time;if(this.reset(),1&e.eventType&&0===this.count)return this.failTimeout();if(r&&n&&i){if(4!=e.eventType)return this.failTimeout();var o=!this.pTime||e.timeStamp-this.pTime<t.interval,s=!this.pCenter||j(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=h((function(){this.state=8,this.tryEmit()}),t.interval,this),2):8}return Me},failTimeout:function(){return this._timer=h((function(){this.state=Me}),this.options.interval,this),Me},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:[[Le,{enable:!1}],[Re,{enable:!1},["rotate"]],[De,{direction:6}],[Pe,{direction:6},["swipe"]],[Oe],[Oe,{event:"doubletap",taps:2},["tap"]],[ke]],cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}},Fe.prototype={set:function(e){return n(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 r=this.recognizers,n=t.curRecognizer;(!n||n&&8&n.state)&&(n=t.curRecognizer=null);for(var o=0;o<r.length;)i=r[o],2===t.stopped||n&&i!=n&&!i.canRecognizeWith(n)?i.reset():i.recognize(e),!n&&14&i.state&&(n=t.curRecognizer=i),o++}},get:function(e){if(e instanceof Se)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(c(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(c(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!==r&&t!==r){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!==r){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 r=t.createEvent("Event");r.initEvent(e,!0,!0),r.gesture=i,i.target.dispatchEvent(r)}(e,i);var r=this.handlers[e]&&this.handlers[e].slice();if(r&&r.length){i.type=e,i.preventDefault=function(){i.srcEvent.preventDefault()};for(var n=0;n<r.length;)r[n](i),n++}},destroy:function(){this.element&&Qe(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}},n(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:Me,DIRECTION_NONE:1,DIRECTION_LEFT:2,DIRECTION_RIGHT:4,DIRECTION_UP:8,DIRECTION_DOWN:16,DIRECTION_HORIZONTAL:6,DIRECTION_VERTICAL:24,DIRECTION_ALL:30,Manager:Fe,Input:Q,TouchAction:Ee,TouchInput:le,MouseInput:X,PointerEventInput:ee,TouchMouseInput:he,SingleTouchInput:ne,Recognizer:Se,AttrRecognizer:Te,Tap:Oe,Pan:Pe,Swipe:De,Pinch:Re,Rotate:Le,Press:ke,on:b,off:x,each:d,merge:A,extend:f,assign:n,inherit:g,bindFn:m,prefixed:B}),Ne}("undefined"!=typeof window?window:{},"undefined"!=typeof document?document:{});const ga=Aa;function ma(t,i,r){var n=i.getBoundingClientRect(),o=n.top,s=n.left,a=n.width,l=n.height;return r&&(s+=a*r.left,o+=l*(1-r.bottom-r.height),a*=r.width,l*=r.height),new e.Vector2((t.x-s)/a*2-1,-(t.y-o)/l*2+1)}var va=new e.OrthographicCamera(-1,1,1,-1,0,1),ya=new e.BufferGeometry;ya.setAttribute("position",new e.Float32BufferAttribute([-1,3,0,-1,-1,0,3,-1,0],3)),ya.setAttribute("uv",new e.Float32BufferAttribute([0,2,0,0,2,0],2));var ba=new e.Mesh(ya),xa=new e.Scene;xa.add(ba);var wa=function(){function t(t,i){var r;this.renderer=t,this.material=new e.ShaderMaterial({vertexShader:null!==(r=i.vertex)&&void 0!==r?r:"\nvarying vec2 vUv;\nvoid main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}\n",fragmentShader:i.fragment,uniforms:Object.assign({inputBuffer:new e.Uniform(null)},i.uniforms),defines:Object.assign({},i.defines),blending:e.NoBlending,depthWrite:!1,depthTest:!1})}return t.prototype.render=function(e,t){var i=this.renderer.getRenderTarget(),r=ba.material;this.material.uniforms.inputBuffer.value=e.texture,ba.material=this.material,this.renderer.setRenderTarget(t||null),this.renderer.render(xa,va),this.renderer.setRenderTarget(i),ba.material=r},t.prototype.dispose=function(){this.material.dispose()},t}(),Ea=function(){function t(t){this.renderer=t,this.material=new e.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 e.Uniform(new e.Vector3)}),blending:e.NoBlending,depthWrite:!1,depthTest:!1})}return t.prototype.render=function(e,t){var i=this.renderer.getRenderTarget(),r=ba.material;this.material.uniforms.inputValue.value.copy(e),ba.material=this.material,this.renderer.setRenderTarget(t||null),this.renderer.render(xa,va),this.renderer.setRenderTarget(i),ba.material=r},t.prototype.dispose=function(){this.material.dispose()},t}(),Ma=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 Oe(t,e),t}(wa),Sa=function(){function e(e){this.enable=!0,this.renderer=e,this.copyPass=new Ma(this.renderer)}return e.prototype.render=function(e,t){this.copyPass.render(e,t)},e.prototype.dispose=function(){this.copyPass.dispose()},e}(),Ca=function(e){function t(i){var r,n=this;n=e.call(this)||this;var o=t.parseArgs(i);return n.pending=!0,n.userAction=o.initial[3],n.destroyed=!1,n.ident=o.ident,n.scene=o.scene,n.parallaxScene=o.parallaxScene,n.helper=o.helper,n.camera=o.camera,n.renderer=o.renderer,n.scissor=o.scissor,n.element=o.element,n.model=o.model,n.enableIOSEDR=null!==(r=o.enableIOSEDR)&&void 0!==r&&r,n.work=o.work,n.imageOptions=o.imageOptions,n.videoTexture=o.videoTexture,n.networkSubscribe=o.networkSubscribe,n.requestProxy=o.requestProxy,n.needsRender=!0,n.maxFov=120,n.minFov=40,n.maxLatitude=+Math.PI/2,n.minLatitude=-Math.PI/2,n.cameraMotion=new Vo({longitude:{value:n.camera.pose.longitude,circle:[0,2*Math.PI]},latitude:n.camera.pose.latitude,fov:n.camera.pose.fov}),n.eventUnbinds=[o.element].concat(o.extraElements||[]).map((function(e){return n.bindEvents(e)})),ft.shared.add((function(){return n.initAnimation.apply(n,o.initial)}),!0),n}return Oe(t,e),t.parseArgs=function(e){return Ne({},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,r=this.eventUnbinds;i<r.length;i++){var n=r[i];n.element===e?n():t.push(n)}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,r,n){return this.work=e,this.userAction=n,!1},t.prototype.updateTime=function(e,t){for(var i=[],r=2;r<arguments.length;r++)i[r-2]=arguments[r];if(!this.destroyed){var n={};this.cameraMotion.ended&&(this.cameraMotion.update(e),n.longitude=this.cameraMotion.value.longitude,n.latitude=this.cameraMotion.value.latitude,n.fov=this.cameraMotion.value.fov),pa(n)&&this.setCamera(n)}},t.prototype.render=function(){this.renderer.render(this.scene,this.camera)},t.prototype.postProcessing=function(e,t){this.destroyed||(this.copyEffect||(this.copyEffect=new Sa(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(je())[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 r={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,r),this.emit("moveToPano",e,this.userAction),this.emit("panoWillArrive",e,r,this.userAction),this.emit("panoArrived",e,r,this.userAction),t.moveEndCallback&&t.moveEndCallback(e,r)},t.prototype.initAnimation=function(e,t,i,r){this.pending=!1,this.userAction=r},t.prototype.setCamera=function(e){var t,i,r,n,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!==(r=e.fov)&&void 0!==r?r:this.camera.pose.fov,u=null!==(n=e.distance)&&void 0!==n?n:this.camera.pose.distance,h=null!==(o=e.offset)&&void 0!==o?o:this.camera.pose.offset,c=this.camera.position.clone(),d=Ys(s,this.camera.pose.longitude,2*Math.PI)||Ys(a,this.camera.pose.latitude),p=Ys(l,this.camera.pose.fov),f=Ys(u,this.camera.pose.distance),A=Js(h,this.camera.pose.offset);this.camera.setFromPose({longitude:s,latitude:a,fov:l,distance:u,offset:h});var g=Js(c,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:h,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 r=e.pointers.map((function(e){return kt(e,["x","y"])}));this.emit("wantsGesture","pan",r,e.isFinal)||this.emit("gesture","pan",r,e.isFinal)}},t.prototype.onTapGesture=function(e){var t=e.pointers.map((function(e){return kt(e,["x","y"])}));this.emit("wantsGesture","tap",t,!0)||this.emit("gesture","tap",t,!0)},t.prototype.onPressGesture=function(e,t){var i,r=[e];if(this.emit("wantsGesture","press",r,t))return null===(i=this.pressState)||void 0===i||i.stop(),void delete this.pressState;this.emit("gesture","press",r,t)},t.prototype.onPinchGesture=function(e){var t=e.pointers.map((function(e){return kt(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 ma(e,this.element,this.scissor)},t.prototype.bindEvents=function(e){var t=this,i=function(e){var i=ma(e,t.element,t.scissor);return!(Math.abs(i.x)>1||Math.abs(i.y)>1)},r=new ga.Manager(e),n=function(e){return e.session.firstInput||null};r.add(new ga.Pan({threshold:10,pointers:0})),r.add(new ga.Tap({interval:410})),r.add(new ga.Pinch({threshold:0,pointers:2})),r.on("panstart pan",(function(e){var o=n(r);o&&!i(o.center)||(t.onPanGesture(e),f())})),r.on("tap",(function(e){if("mouse"!==e.pointerType||0===e.srcEvent.button){var o=n(r);o&&!i(o.center)||(t.onTapGesture(e),f())}})),r.on("pinchstart pinch pinchend",(function(e){var o=n(r);o&&!i(o.center)||(t.onPinchGesture(e),f())}));var o=null,s=null,a=function(e,t,i){var r="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:bo(r,.1,10),center:{x:i.clientX,y:i.clientY},velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0}},l=function(e){var r,n={x:e.clientX,y:e.clientY};if(i(n)){if(e.preventDefault(),e.ctrlKey){var l=null!==(r=null==o?void 0:o.prevInput.scale)&&void 0!==r?r: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 r=null!==(i=null==o?void 0:o.prevInput.scale)&&void 0!==i?i:1,n=a("pinchend",r,e);o=null,t.onPinchGesture(n)}),200)}else t.onMouseWheel(e);f()}},u=function(e){if(!la()){var r={x:e.clientX,y:e.clientY};i(r)?(t.onMouseMove(e),t.pressState&&Math.abs(e.clientX-t.pressState.x)>10&&Math.abs(e.clientY-t.pressState.y)>10&&f()):t.onMouseOut()}},h=function(){t.onMouseOut(),f()},c=function(e,r){if(i(e)){t.pressState={x:e.x,y:e.y,time:t.pressState?t.pressState.time:r,stop:ze};var n=r-t.pressState.time;t.onPressGesture({x:e.x,y:e.y,delta:n},!1),t.pressState&&(t.pressState.stop=ft.shared.add((function(t){return c({x:e.x,y:e.y},t)}),!0,1))}else f()},d=function(e){f(),e.touches.length>1||e.changedTouches.length<=0||c({x:e.changedTouches[0].clientX,y:e.changedTouches[0].clientY},je())},p=function(e){f(),c({x:e.clientX,y:e.clientY},je())},f=function(){var e;if(t.pressState){var i=je()-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",r=!1,n=!1;switch(e.type){case"gesturestart":i="pinchstart",r=!0;break;case"gestureend":i="pinchend",n=!0}return{type:i,target:e.target,pointerType:"mouse",srcEvent:e,pointers:[{x:e.clientX,y:e.clientY}],isFirst:r,isFinal:n,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(),!la()){var r=g(e),n=(A={firstInput:r}).firstInput;n&&!i(n.center)||t.onPinchGesture(r)}},v=function(e){if(e.preventDefault(),!la()&&A){var r=g(e),n=A.firstInput;n&&!i(n.center)||t.onPinchGesture(r)}},y=function(e){if(e.preventDefault(),!la()&&A){var r=g(e),n=A.firstInput;A=null,n&&!i(n.center)||t.onPinchGesture(r)}},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())}};return e.addEventListener("wheel",l,{passive:!1}),e.addEventListener("mousemove",u,!1),e.addEventListener("mouseout",h,!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),Object.assign((function(){r.destroy(),e.removeEventListener("wheel",l,!1),e.removeEventListener("mousemove",u,!1),e.removeEventListener("mouseout",h,!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}(qe),Ia=function(t){function i(e){var r,n,o=this,s=i.parseArgs(e);return(o=t.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 Vo({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!==(n=null===(r=o.model.getMaterial())||void 0===r?void 0:r.modelAlpha)&&void 0!==n?n: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 Oe(i,t),i.distanceFromModel=function(e,t,i){var r=e.bounding,n=Math.pow(Math.pow(r.max.x-r.min.x+1,2)+Math.pow(r.max.y-r.min.y+1,2)+Math.pow(r.max.z-r.min.z+1,2),.5),o=n/2/Math.tan(Math.PI*t/360);return i<1&&(o/=i),isNaN(o)?n:o},i.parseArgs=function(e){var i,r,n,o,s,a,l,u,h=t.parseArgs.call(this,e);return Ne(Ne({},h),{defaultLongitude:null!==(i=e.defaultLongitude)&&void 0!==i?i:Math.PI/4,defaultLatitude:null!==(r=e.defaultLatitude)&&void 0!==r?r:Math.PI/4,defaultFov:null!==(n=e.defaultFov)&&void 0!==n?n:80,maxFov:null!==(o=e.maxFov)&&void 0!==o?o:120,minFov:null!==(s=e.minFov)&&void 0!==s?s:40,maxLatitude:null!==(a=e.maxLatitude)&&void 0!==a?a:+Math.PI/2,minLatitude:null!==(l=e.minLatitude)&&void 0!==l?l:-Math.PI/2,intersectMeshCreator:null!==(u=e.intersectMeshCreator)&&void 0!==u?u:function(){return new Ws}})},i.initAnimationEndPose=function(t){var r,n,o,s=this.parseArgs(t),a=t.initial[1];return{longitude:null!==(r=a.longitude)&&void 0!==r?r:s.defaultLongitude,latitude:bo(null!==(n=a.latitude)&&void 0!==n?n:s.defaultLatitude,s.minLatitude,s.maxLatitude),fov:null!==(o=a.fov)&&void 0!==o?o:s.defaultFov,offset:t.model.bounding.getCenter(new e.Vector3),distance:i.distanceFromModel(s.model,s.defaultFov,s.camera.aspect)}},i.prototype.destroy=function(){t.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)},i.prototype.isReady=function(){return!1!==this.locationMotion.ended&&t.prototype.isReady.call(this)},i.prototype.updateWork=function(e,t,i,r,n){return this.work=e,this.updateCamera(i,null!=r?r:0,n),!0},i.prototype.updateModel=function(r){t.prototype.updateModel.call(this,r);var n=r.bounding.getCenter(new e.Vector3),o=i.distanceFromModel(r,this.defaultFov,this.camera.aspect);this.locationMotion.set({x:n.x,y:n.y,z:n.z,distance:o},0).catch(ze)},i.prototype.updateTime=function(t,i){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];if(!this.destroyed){var o={},s={};this.locationMotion.ended||(this.locationMotion.update(t),o.modelAlpha=this.locationMotion.value.modelAlpha,this.camera.perspToOrtho.setScalar(bo(this.locationMotion.value.perspToOrtho,0,1)),this.camera.orthoDistance=this.locationMotion.value.orthoDistance,s.distance=this.locationMotion.value.distance,s.offset=new e.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z)),this.cameraMotion.ended||(this.cameraMotion.update(t),s.longitude=this.cameraMotion.value.longitude,s.latitude=this.cameraMotion.value.latitude,s.fov=this.cameraMotion.value.fov),pa(o)||this.model.setMaterial(o),pa(s)||this.setCamera(s)}},i.prototype.getTargetPose=function(){var t=this.cameraMotion.getKeyFrameSegment(je())[1],i=this.locationMotion.getKeyFrameSegment(je())[1];return{longitude:t.value.longitude,latitude:t.value.latitude,fov:t.value.fov,offset:new e.Vector3(i.value.x,i.value.y,i.value.z),distance:i.value.distance}},i.prototype.initAnimation=function(t,r,n,o){var s,a,l,u=this;if(!this.destroyed){this.pending=!1,this.userAction=o;var h={longitude:null!==(s=r.longitude)&&void 0!==s?s:this.defaultLongitude,latitude:bo(null!==(a=r.latitude)&&void 0!==a?a:this.defaultLatitude,this.minLatitude,this.maxLatitude),fov:bo(null!==(l=r.fov)&&void 0!==l?l:this.defaultFov,this.minFov,this.maxFov),offset:this.model.bounding.getCenter(new e.Vector3),distance:i.distanceFromModel(this.model,this.defaultFov,this.camera.aspect)},c=kt(h,["longitude","latitude","fov"]),d={x:h.offset.x,y:h.offset.y,z:h.offset.z,distance:h.distance,modelAlpha:1,perspToOrtho:0,orthoDistance:h.distance};this.emit("initAnimationWillStart",t,h,this.userAction),this.cameraMotion.set(c,n).catch(ze),this.locationMotion.set(d,n).then((function(){u.emit("initAnimationEnded",t,h,u.userAction)}),(function(e){var i=fa(u.camera.pose);u.emit("initAnimationEnded",t,i,u.userAction)})).catch(ze)}},i.prototype.updateRenderSize=function(){this.locationMotion.set({distance:i.distanceFromModel(this.model,this.defaultFov,this.camera.aspect)},0).catch(ze)},i.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 r=da(t,(function(e){return e.standingPosition.distanceTo(i.point)}),!0),n=r[0];return r[1]<5?this.work.observers.indexOf(n):null},i.prototype.coordinatesForOffset=function(t){var i=this.renderer.getSize(new e.Vector2);return{longitude:2*t.x/(i.x*this.scissor.width),latitude:2*t.y/(i.y*this.scissor.height)}},i.prototype.requestInteriaMovement=function(e,t){var i=this;if(!1!==this.interiaMovement){for(var r=Ne({},e),n={longitude:0,latitude:0},o=0;o<t;o++)r.longitude*=.996,r.latitude*=.994008,n.longitude+=r.longitude,n.latitude+=r.latitude;var s=na(this.cameraMotion.value.longitude+n.longitude),a=bo(this.cameraMotion.value.latitude+n.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(ze);var u=r.longitude>1e-4||r.longitude<-1e-4||r.latitude>1e-4||r.latitude<-1e-4;this.emit("interiaPan",l,!u),u?ft.shared.add((function(e,t){i.requestInteriaMovement(r,0|t)}),!0,1):this.interiaMovement=!1}},i.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 kt(e,["x","y"])}));if(!this.emit("wantsGesture","pan",r,e.isFinal)){var n={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;n.x*=s;var a=this.coordinatesForOffset(n),l=na(this.cameraMotion.value.longitude+a.longitude),u=bo(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 h={longitude:l,latitude:u,fov:this.camera.pose.fov,offset:this.camera.pose.offset,distance:this.camera.pose.distance};if(!this.emit("wantsPanGesture",h,e.isFinal)&&(this.emit("gesture","pan",r,e.isFinal),this.emit("panGesture",h,e.isFinal),this.userAction=!0,this.interiaMovement=!1,this.hideIntersectMesh(),this.cameraMotion.set({longitude:h.longitude,latitude:h.latitude},0).catch(ze),e.isFinal&&!this.emit("wantsInteriaPan",h))){this.interiaMovement=!0;var c=e.velocityX*s,d=e.velocityY;this.requestInteriaMovement(this.coordinatesForOffset({x:c,y:d}),0)}}}},i.prototype.onPinchGesture=function(e){var t,i=null===(t=this.pinchState)||void 0===t?void 0:t.fov,r=!1;if("pinchstart"!==e.type){if("pinchend"===e.type&&(r=!0,delete this.panState,delete this.pinchState),void 0!==i){var n=e.pointers.map((function(e){return kt(e,["x","y"])}));if(!this.emit("wantsGesture","pinch",n,r)){var o=bo(i/e.scale,this.minFov,this.maxFov);this.emit("wantsPinchGesture",e.scale,o,r)||this.emit("wantsChangeCameraFov",o)||(this.emit("gesture","pinch",n,r),this.emit("pinchGesture",e.scale,o,r),this.userAction=!0,this.interiaMovement=!1,this.cameraMotion.set({fov:o},0).catch(ze),this.onPanGesture(e))}}}else this.pinchState={fov:this.cameraMotion.value.fov}},i.prototype.onMouseMove=function(t){if(this.intersectMesh.parent&&!this.model.empty&&this.model.bvhs&&!0===this.model.bvhs.loaded&&!this.panState){var i=this.relativeClientPosition({x:t.clientX,y:t.clientY}),r=new e.Raycaster;if(r.setFromCamera(i,this.camera),this.emit("wantsShowIntersectionOnModel",r))this.hideIntersectMesh();else{var n=this.model.intersectRaycaster(r)[0];if(n&&n.face){var o=n.face.normal,s=o.clone().multiplyScalar(.05),a=n.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",n,this.intersectMesh)}else this.hideIntersectMesh();this.mouseMoveState={clientX:t.clientX,clientY:t.clientY}}}},i.prototype.onMouseOut=function(){this.intersectMesh.parent&&!0===this.intersectMesh.visible&&this.hideIntersectMesh()},i.prototype.onMouseWheel=function(e){var t=this,i=(Math.abs(e.deltaY)>Math.abs(e.deltaX)?e.deltaY:e.deltaX)/-60,r=[{x:e.clientX,y:e.clientY,delta:i}];if(!this.emit("wantsGesture","mouseWheel",r,!1)){var n=this.minFov,o=this.maxFov,s=bo(this.camera.fov-i,n,o);this.emit("wantsMouseWheel",i,s,!1)||this.emit("wantsChangeCameraFov",s)||(this.emit("gesture","mouseWheel",r,!1),this.emit("mouseWheel",i,s,!1),this.userAction=!0,this.interiaMovement=!1,this.cameraMotion.set({fov:s},0).catch(ze),this.mouseWheelState&&clearTimeout(this.mouseWheelState.timer),this.mouseWheelState={timer:window.setTimeout((function(){delete t.mouseWheelState,t.emit("wantsGesture","mouseWheel",r,!0)||t.emit("wantsMouseWheel",i,s,!0)||(t.emit("gesture","mouseWheel",r,!0),t.emit("mouseWheel",0,s,!0))}),200)})}},i.prototype.onTapGesture=function(t){var i=this,r=t.pointers.map((function(e){return kt(e,["x","y"])}));if(!this.emit("wantsGesture","tap",r,!0)){var n=this.relativeClientPosition(t.center),o=new e.Raycaster;if(o.setFromCamera(n,this.camera),!this.emit("wantsTapGesture",o,n,!0)){this.emit("gesture","tap",r,!0),this.emit("tapGesture",o,n,!0),this.interiaMovement=!1;var s=this.getForwardPanoIndexOrNot(o);if(!fo(s)){this.emit("panoSelected",s);var a={longitude:this.camera.pose.longitude,latitude:0};this.currentTapPanoIndex=s,this.preloadPano(s).then((function(e){i.currentTapPanoIndex===e&&i.emit("wantsMoveToPano",e,a,!0)}))}}}},i.prototype.onPressGesture=function(t,i){var r,n,o=[t];if(this.emit("wantsGesture","press",o,i))return null===(r=this.pressState)||void 0===r||r.stop(),void delete this.pressState;var s=this.relativeClientPosition(t),a=new e.Raycaster;if(a.setFromCamera(s,this.camera),this.emit("wantsPressGesture",a,s,t.delta,i))return null===(n=this.pressState)||void 0===n||n.stop(),void delete this.pressState;this.emit("gesture","press",o,i),this.emit("pressGesture",a,s,t.delta,i)},i.prototype.preloadPano=function(e,t){var i=this;void 0===t&&(t=ze);var r=this.work.observers[e],n=this.work.allowHosts;return Promise.all(["right","left","up","down","front","back"].map((function(t){var o=Ne({key:"pano.".concat(e,".").concat(t),basisLoaderInitialized:oi.isInitialized()},kt(i.imageOptions,["size","format","quality","mappings"])),s=r.images[t];return ht(i.imageOptions.transform?i.imageOptions.transform(s,o):vt(s,o),{allowHosts:n,requestProxy:i.requestProxy,networkSubscribe:i.networkSubscribe})}))).then((function(){return t(e),e}))},i.prototype.hideIntersectMesh=function(){this.intersectMesh.visible=!1,this.emit("intersectionHidden"),this.needsRender=!0},i}(Ca),Ba=0,Ta=Math.PI/2,Pa=0,Ra=0,ka=Math.PI/2,La=0,Da=Math.PI,Oa=0,Na=1.5*Math.PI,Fa=0,Qa=function(t){function i(e){var r=i.parseArgs(e);return t.call(this,r)||this}return Oe(i,t),i.parseArgs=function(e){var i=[e.initial[0],Ne(Ne({},e.initial[1]),{longitude:0,latitude:Math.PI/2}),e.initial[2],e.initial[3]],r=Ne(Ne({},e),{initial:i,maxLatitude:Math.PI/2,minLatitude:Math.PI/2,defaultLongitude:0,defaultLatitude:Math.PI/2});return t.parseArgs.call(this,r)},i.initAnimationEndPose=function(e){var i=this.parseArgs(e);return t.initAnimationEndPose.call(this,i)},i.prototype.updateModel=function(t){this.model=t,this.needsRender=!0;var i=t.bounding.getCenter(new e.Vector3);this.locationMotion.set({x:i.x,y:i.y,z:i.z,distance:Ia.distanceFromModel(this.model,this.defaultFov,this.camera.aspect)},0).catch(ze)},i.prototype.initAnimation=function(t,i,r,n){var o,s=this;if(!this.destroyed){this.pending=!1,this.userAction=n;var a={longitude:0,latitude:Math.PI/2,fov:bo(null!==(o=i.fov)&&void 0!==o?o:this.defaultFov,this.minFov,this.maxFov),offset:this.model.bounding.getCenter(new e.Vector3),distance:Ia.distanceFromModel(this.model,this.defaultFov,this.camera.aspect)},l=kt(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,r).catch(ze),this.locationMotion.set(u,r).then((function(){s.emit("initAnimationEnded",t,a,s.userAction)}),(function(e){var i=fa(s.camera.pose);s.emit("initAnimationEnded",t,i,s.userAction)}))}},i.prototype.getZoomOffsetFromFov=function(t,i,r){var n=this.camera.getWorldDirection(new e.Vector3),o=Math.tan(r/2*Math.PI/180),s=Math.tan(i.fov/2*Math.PI/180),a=(s-o)/s,l=new e.Raycaster;l.setFromCamera(t,i);var u=l.ray.direction,h=u.angleTo(n),c=Ia.distanceFromModel(this.model,this.defaultFov,this.camera.aspect),d=c*Math.tan(h),p=u.clone().setLength(c*Math.cos(h)).projectOnPlane(n),f=p.length(),A=a/f*p.x*d,g=a/f*p.z*d,m=a/f*p.y*d;return new e.Vector3(A,m,g)},i.prototype.requestInteriaMovement=function(e,t){},i.prototype.onPanGesture=function(t){var i=this.panState,r=t.pointers.length;if(t.isFinal?delete this.panState:this.panState={pointerLength:r,x:t.center.x,y:t.center.y},void 0!==i&&i.pointerLength===r){var n=t.pointers.map((function(e){return kt(e,["x","y"])}));if(!this.emit("wantsGesture","pan",n,t.isFinal)){var o=t.center.x-i.x,s=t.center.y-i.y,a=new e.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z),l=this.model.bounding,u=l.getCenter(new e.Vector3),h=(l.max.x-l.min.x)/this.defaultFov*this.cameraMotion.value.fov,c=(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 e.Vector3,up:new e.Vector3,cameraDirection:"y"};this.cameraMotion.value.longitude===Ba&&this.cameraMotion.value.latitude===Ta?(p.left.set(1,0,0),p.up.set(0,0,-1),p.cameraDirection="y"):this.cameraMotion.value.longitude===Pa&&this.cameraMotion.value.latitude===Ra?(p.left.set(1,0,0),p.up.set(0,1,0),p.cameraDirection="z"):this.cameraMotion.value.longitude===Da&&this.cameraMotion.value.latitude===Oa?(p.left.set(1,0,0),p.up.set(0,-1,0),p.cameraDirection="z"):this.cameraMotion.value.longitude===Na&&this.cameraMotion.value.latitude===Fa?(p.left.set(0,0,-1),p.up.set(0,-1,0),p.cameraDirection="x"):this.cameraMotion.value.longitude===ka&&this.cameraMotion.value.latitude===La&&(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 e.Vector2);a.add(function(t,i){var r=(new e.Vector3).copy(i);return r.multiplyScalar(-t),r}(2*o*f/A.y,p.left)),a.add(function(t,i){var r=(new e.Vector3).copy(i);return r.multiplyScalar(t),r}(2*s*f/A.y,p.up)),a.x=bo(a.x,u.x-h,u.x+h),a.y=bo(a.y,u.y-c,u.y+c),a.z=bo(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,t.isFinal)||(this.emit("gesture","pan",n,t.isFinal),this.emit("panGesture",g,t.isFinal),this.userAction=!0,this.locationMotion.set({x:a.x,y:a.y,z:a.z},0).catch(ze))}}},i.prototype.onPinchGesture=function(e){var t,i=null===(t=this.pinchState)||void 0===t?void 0:t.fov,r=!1;if("pinchstart"!==e.type){if("pinchend"===e.type&&(r=!0,delete this.pinchState),void 0!==i){var n=e.pointers.map((function(e){return kt(e,["x","y"])}));if(!this.emit("wantsGesture","pinch",n,r)){var o=bo(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===Ba&&this.cameraMotion.value.latitude===Ta?a.y=0:this.cameraMotion.value.longitude===Pa&&this.cameraMotion.value.latitude===Ra||this.cameraMotion.value.longitude===Da&&this.cameraMotion.value.latitude===Oa?a.z=0:(this.cameraMotion.value.longitude===Na&&this.cameraMotion.value.latitude===Fa||this.cameraMotion.value.longitude===ka&&this.cameraMotion.value.latitude===La)&&(a.x=0);var l=this.camera.pose.offset.clone().add(a);this.emit("wantsPinchGesture",e.scale,o,r)||this.emit("wantsChangeCameraFov",o)||(this.emit("gesture","pinch",n,r),this.emit("pinchGesture",e.scale,o,r),this.userAction=!0,this.locationMotion.set({x:l.x,y:l.y,z:l.z},0).catch(ze),this.cameraMotion.set({longitude:this.cameraMotion.value.longitude,latitude:this.cameraMotion.value.latitude,fov:o},0).catch(ze),this.onPanGesture(e))}}}else this.pinchState={fov:this.cameraMotion.value.fov}},i.prototype.onMouseWheel=function(e){var t=this,i=(Math.abs(e.deltaY)>Math.abs(e.deltaX)?e.deltaY:e.deltaX)/-60,r=[{x:e.clientX,y:e.clientY,delta:i}];if(!this.emit("wantsGesture","mouseWheel",r,!1)){var n=bo(this.cameraMotion.value.fov-i,this.minFov,this.maxFov),o=this.relativeClientPosition({x:e.clientX,y:e.clientY}),s=this.getZoomOffsetFromFov(o,this.camera,n);this.cameraMotion.value.longitude===Ba&&this.cameraMotion.value.latitude===Ta?s.y=0:this.cameraMotion.value.longitude===Pa&&this.cameraMotion.value.latitude===Ra||this.cameraMotion.value.longitude===Da&&this.cameraMotion.value.latitude===Oa?s.z=0:(this.cameraMotion.value.longitude===Na&&this.cameraMotion.value.latitude===Fa||this.cameraMotion.value.longitude===ka&&this.cameraMotion.value.latitude===La)&&(s.x=0);var a=this.camera.pose.offset.clone().add(s);this.emit("wantsMouseWheel",i,n,!1)||this.emit("wantsChangeCameraFov",n)||(this.emit("gesture","mouseWheel",r,!1),this.emit("mouseWheel",i,n,!1),this.userAction=!0,this.locationMotion.set({x:a.x,y:a.y,z:a.z},0).catch(ze),this.cameraMotion.set({longitude:this.cameraMotion.value.longitude,latitude:this.cameraMotion.value.latitude,fov:n},0).catch(ze),this.mouseWheelState&&clearTimeout(this.mouseWheelState.timer),this.mouseWheelState={timer:window.setTimeout((function(){delete t.mouseWheelState,t.emit("wantsGesture","mouseWheel",r,!0)||t.emit("wantsMouseWheel",i,n,!0)||t.emit("wantsChangeCameraFov",n)||(t.emit("gesture","mouseWheel",r,!0),t.emit("mouseWheel",0,n,!0))}),200)})}},i}(Ia);function Va(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 r="[",n=e.length-1,o=0;o<n;o++)r+=Va(e[o],!1)+",";return n>-1&&(r+=Va(e[o],!1)),r+"]"}if(e instanceof Object){if("function"==typeof e.toJSON)return Va(e.toJSON(),t);var s=Object.keys(e).sort(),a=s.length;for(r="",o=0;o<a;){var l=s[o],u=Va(e[l],!0);void 0!==u&&(o&&""!==r&&(r+=","),r+=JSON.stringify(l)+":"+u),o++}return"{"+r+"}"}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 Ha(e){return Te(String(Va(e,!1)))}var qa,za=function(t){function i(e){var r=this,n=i.parseArgs(e);return(r=t.call(this,n)||this).defaultLongitude=n.defaultLongitude,r.defaultLatitude=n.defaultLongitude,r.defaultFov=n.defaultFov,r.maxFov=n.maxFov,r.minFov=n.minFov,r.maxLatitude=n.maxLatitude,r.minLatitude=n.minLatitude,r.moveSpeed=n.moveSpeed,r.intersectMeshCreator=n.intersectMeshCreator,r.interiaMovement=!1,r.intersectMesh=r.intersectMeshCreator(),r.intersectMesh.name="intersect",r.intersectMesh.visible=!1,r.helper.add(r.intersectMesh),r}return Oe(i,t),i.parseArgs=function(e){var i,r,n,o,s,a,l,u,h,c=t.parseArgs.call(this,e);return Ne(Ne({},c),{defaultLongitude:null!==(i=e.defaultLongitude)&&void 0!==i?i:0,defaultLatitude:null!==(r=e.defaultLatitude)&&void 0!==r?r:0,defaultFov:null!==(n=e.defaultFov)&&void 0!==n?n:90,maxFov:null!==(o=e.maxFov)&&void 0!==o?o:120,minFov:null!==(s=e.minFov)&&void 0!==s?s:40,maxLatitude:null!==(a=e.maxLatitude)&&void 0!==a?a:+Math.PI/2,minLatitude:null!==(l=e.minLatitude)&&void 0!==l?l:-Math.PI/2,moveSpeed:null!==(u=e.moveSpeed)&&void 0!==u?u:3.2,intersectMeshCreator:null!==(h=e.intersectMeshCreator)&&void 0!==h?h:function(){return new Ws}})},i.initAnimationEndPose=function(e){var t,i,r,n=this.parseArgs(e),o=e.initial,s=o[0],a=o[1];return{longitude:null!==(t=a.longitude)&&void 0!==t?t:n.defaultLongitude,latitude:bo(null!==(i=a.latitude)&&void 0!==i?i:n.defaultLatitude,n.minLatitude,n.maxLatitude),fov:bo(null!==(r=a.fov)&&void 0!==r?r:n.defaultFov,n.minFov,n.maxFov),offset:n.work.observers[s].position.clone(),distance:0}},i.prototype.destroy=function(){t.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},i.prototype.isReady=function(){return!this.interiaMovement&&!this.panState&&!this.pinchState&&!this.mouseWheelState&&t.prototype.isReady.call(this)},i.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 bo(t,2,5)/this.moveSpeed*1e3}},i.prototype.hideIntersectMesh=function(){this.intersectMesh.visible=!1,this.emit("intersectionHidden"),this.needsRender=!0},i.prototype.coordinatesForOffset=function(t){var i=this.cameraMotion.value.fov,r=this.camera.aspect,n=this.renderer.getSize(new e.Vector2);return{longitude:2*t.x/(n.x*this.scissor.width)*i/95*r,latitude:-2*t.y/(n.y*this.scissor.height)*i/95}},i.prototype.cameraBounce=function(){var e=this.cameraMotion.value,t=e.longitude,i=e.latitude,r=e.fov,n=[{progress:0,value:{longitude:t,latitude:i,fov:r}},{progress:.5,value:{longitude:t,latitude:i,fov:.98*r}},{progress:1,value:{longitude:t,latitude:i,fov:r}}];this.cameraMotion.setKeyframes(n,500).catch(ze)},i.prototype.requestInteriaMovement=function(e,t){var i=this;if(!1!==this.interiaMovement){for(var r=Ne({},e),n={longitude:0,latitude:0},o=0;o<t;o++)r.longitude*=.996,r.latitude*=.98604,n.longitude+=r.longitude,n.latitude+=r.latitude;var s=na(this.cameraMotion.value.longitude+n.longitude),a=bo(this.cameraMotion.value.latitude+n.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(ze);var u=r.longitude>1e-4||r.longitude<-1e-4||r.latitude>1e-4||r.latitude<-1e-4;this.emit("interiaPan",l,!u),u?ft.shared.add((function(e,t){i.requestInteriaMovement(r,0|t)}),!0,1):this.interiaMovement=!1}},i.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 kt(e,["x","y"])}));if(!this.emit("wantsGesture","pan",r,e.isFinal)){var n={x:e.center.x-t.x,y:e.center.y-t.y},o=this.coordinatesForOffset(n),s=na(this.cameraMotion.value.longitude+o.longitude),a=bo(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",r,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(ze),e.isFinal&&!this.emit("wantsInteriaPan",l)){this.interiaMovement=!0;var h=e.velocityX,c=.6*e.velocityY;Math.abs(c)>.5&&Math.abs(h)<.5&&(h=0),this.requestInteriaMovement(this.coordinatesForOffset({x:h,y:c}),0)}}}}},i.prototype.onPinchGesture=function(e){var t,i=null===(t=this.pinchState)||void 0===t?void 0:t.fov,r=e.scale,n=!1;if("pinchstart"!==e.type){if("pinchend"===e.type&&(n=!0,delete this.pinchState),void 0!==i){var o=e.pointers.map((function(e){return kt(e,["x","y"])}));if(!this.emit("wantsGesture","pinch",o,n)){var s=bo(i/r,this.minFov,this.maxFov);this.emit("wantsPinchGesture",r,s,n)||this.emit("wantsChangeCameraFov",s)||(this.emit("gesture","pinch",o,n),this.emit("pinchGesture",r,s,n),this.userAction=!0,this.interiaMovement=!1,this.cameraMotion.set({fov:s},0).catch(ze),this.onPanGesture(e))}}}else this.pinchState={fov:this.cameraMotion.value.fov}},i.prototype.onMouseWheel=function(e){var t=this,i=(Math.abs(e.deltaY)>Math.abs(e.deltaX)?e.deltaY:e.deltaX)/-60,r=[{x:e.clientX,y:e.clientY,delta:i}];if(!this.emit("wantsGesture","mouseWheel",r,!1)){var n=bo(this.cameraMotion.value.fov-i,this.minFov,this.maxFov);this.emit("wantsMouseWheel",i,n,!1)||this.emit("wantsChangeCameraFov",n)||(this.emit("gesture","mouseWheel",r,!1),this.emit("mouseWheel",i,n,!1),this.userAction=!0,this.interiaMovement=!1,this.cameraMotion.set({fov:n},0).catch(ze),this.mouseWheelState&&clearTimeout(this.mouseWheelState.timer),this.mouseWheelState={timer:window.setTimeout((function(){delete t.mouseWheelState,t.emit("wantsGesture","mouseWheel",r,!0)||t.emit("wantsMouseWheel",i,n,!0)||t.emit("wantsChangeCameraFov",n)||(t.emit("gesture","mouseWheel",r,!0),t.emit("mouseWheel",0,n,!0))}),200)})}},i.prototype.onMouseMove=function(t){if(this.intersectMesh.parent&&!this.model.empty&&this.model.bvhs&&!0===this.model.bvhs.loaded&&!this.panState){var i=this.relativeClientPosition({x:t.clientX,y:t.clientY}),r=new e.Raycaster;if(r.setFromCamera(i,this.camera),this.emit("wantsShowIntersectionOnModel",r))this.hideIntersectMesh();else{var n=this.model.intersectRaycaster(r)[0];if(n&&n.face){var o=n.face.normal,s=o.clone().multiplyScalar(.05),a=n.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",n,this.intersectMesh)}else this.hideIntersectMesh();this.mouseMoveState={clientX:t.clientX,clientY:t.clientY}}}},i.prototype.onMouseOut=function(){this.intersectMesh.parent&&!0===this.intersectMesh.visible&&this.hideIntersectMesh()},i.prototype.onPressGesture=function(t,i){var r,n,o=[t];if(this.emit("wantsGesture","press",o,i))return null===(r=this.pressState)||void 0===r||r.stop(),void delete this.pressState;var s=this.relativeClientPosition(t),a=new e.Raycaster;if(a.setFromCamera(s,this.camera),this.emit("wantsPressGesture",a,s,t.delta,i))return null===(n=this.pressState)||void 0===n||n.stop(),void delete this.pressState;this.emit("gesture","press",o,i),this.emit("pressGesture",a,s,t.delta,i)},i}(Ca);function Ua(){return qa||(qa=new Promise((function(e){var t,i=document.createElement("video");i.muted=!0,i.src="data:video/mp4;base64,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",i.addEventListener("timeupdate",(function r(){i.removeEventListener("timeupdate",r,!1),clearTimeout(t);var n=document.createElement("canvas");n.width=n.height=1;var o=n.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 ja,Ka=function(t){function i(i,r){return void 0===r&&(r=.5),t.call(this,i,{uniforms:{inputBuffer:new e.Uniform(null),scale:new e.Uniform(r)},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 Oe(i,t),i}(wa),_a=function(t){function i(i,r){void 0===r&&(r=.002);var n=t.call(this,i,{uniforms:{targetBuffer:new e.Uniform(null),inputBuffer:new e.Uniform(null),step:new e.Uniform(r)},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 n.material.extensions.shaderTextureLOD=!0,n}return Oe(i,t),Object.defineProperty(i.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(i.prototype,"step",{get:function(){return this.material.uniforms.step.value},set:function(e){this.material.uniforms.step.value=e},enumerable:!1,configurable:!0}),i}(wa),Ga=function(t){function i(i){var r=t.call(this,i,{uniforms:{inputBuffer:new e.Uniform(null),luminanceAdaptiveBuffer:new e.Uniform(null),progress:new e.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 r.material.transparent=!0,r}return Oe(i,t),Object.defineProperty(i.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(i.prototype,"progress",{get:function(){return this.material.uniforms.progress.value},set:function(e){this.material.uniforms.progress.value=e},enumerable:!1,configurable:!0}),i}(wa),Wa=function(t){function i(e){var i=t.call(this,e)||this;return i.enableTime=je(),i.renderer=e,i.valuePass=new Ea(i.renderer),i.luminancePass=new Ka(i.renderer,Math.sqrt(1/3)),i.nextStepPass=new _a(i.renderer,.01),i.luminanceAdaptivePass=new Ga(i.renderer),i}return Oe(i,t),i.prototype.render=function(t,i){if(!this.enable)return this.enableTime=null,void this.copyPass.render(t,i);null===this.enableTime&&(this.enableTime=je()),this.luminanceTargetBuffer||(this.luminanceTargetBuffer=new e.WebGLRenderTarget(128,128,{minFilter:e.LinearMipmapLinearFilter,magFilter:e.LinearFilter,encoding:this.renderer.outputEncoding,stencilBuffer:!1,depthBuffer:!1,format:e.RGBAFormat,generateMipmaps:!0}),this.nextStepPass.targetBuffer=this.luminanceTargetBuffer.texture),this.luminancePass.render(t,this.luminanceTargetBuffer),this.luminancePrevBuffer||(this.luminancePrevBuffer=new e.WebGLRenderTarget(1,1,{minFilter:e.NearestFilter,magFilter:e.NearestFilter,type:e.HalfFloatType,encoding:this.renderer.outputEncoding,stencilBuffer:!1,depthBuffer:!1}),this.valuePass.render(new e.Vector3(.5,.5,.5),this.luminancePrevBuffer)),this.luminanceNextBuffer||(this.luminanceNextBuffer=new e.WebGLRenderTarget(1,1,{minFilter:e.NearestFilter,magFilter:e.NearestFilter,type:e.HalfFloatType,encoding:this.renderer.outputEncoding,stencilBuffer:!1,depthBuffer:!1}),this.valuePass.render(new e.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((je()-this.enableTime)/100,1),this.luminanceAdaptivePass.render(t,i)},i.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()},i}(Sa),Xa=null!==(ja=Math.SQRT1_2)&&void 0!==ja?ja:Math.sqrt(2),Ya={up:new e.Quaternion(Xa,0,0,Xa),down:new e.Quaternion(-Xa,0,0,Xa),left:new e.Quaternion(0,Xa,0,Xa),right:new e.Quaternion(0,-Xa,0,Xa),front:new e.Quaternion(0,0,0,1),back:new e.Quaternion(0,1,0,0)},Za=new Float32Array([-.5,-.5,0,.5,-.5,0,-.5,.5,0,.5,.5,0]),Ja=new Float32Array([0,0,1,0,0,1,1,1]),$a=new Uint8Array([0,1,2,1,3,2]),el=new e.BufferGeometry;el.setAttribute("position",new e.BufferAttribute(Za,3)),el.setAttribute("uv",new e.BufferAttribute(Ja,2)),el.setIndex(new e.BufferAttribute($a,1));var tl=function(t){function i(){var i=t.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 i.depthTest=!1,i.depthWrite=!1,i.blending=e.NoBlending,i.map=i.uniforms.map.value,i.luminanceMap=i.uniforms.luminanceMap.value,Object.defineProperties(i,{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}}}),i}return Oe(i,t),i}(e.ShaderMaterial),il=function(t){function i(i,r){var n=t.call(this,el,new tl)||this;return i.box.getCenter(n.position),n.quaternion.multiplyQuaternions((new e.Quaternion).setFromAxisAngle(new e.Vector3(0,1,0),-Math.PI),Ya[i.face]),n.scale.setScalar(i.size),n.node=i,n.name="tiling:tile",n.material.visible=!1,n.activeTime=-1,n.disposed=!1,n.needsRender=!1,n.frustumCulled=!1,r.then((function(e){var t=e[0],i=e[1];n.disposed?(t.dispose(),null==i||i.dispose()):(n.material.map=t,n.material.luminanceMap=i,n.material.needsUpdate=!0,n.material.visible=!0,n.needsRender=!0)})).catch(ze),n}return Oe(i,t),i.prototype.updateTime=function(e){},i.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()},i}(e.Mesh),rl=function(e){function t(){var t=e.call(this)||this;return t.needsRender=!1,t.name="tiling",t}return Oe(t,e),t}(e.Group),nl=function(){function t(e,t,i){this.disposed=!1,this.textureLoader=new li(e),this.minLevel=t,this.level=0,this.panoIndex=0,this.pedding=0,this.tileTree=Pt(this.minLevel),this.tileMeshes=new Map,this.resource=[],this.luminance=null,this.imageOptions=i,this.object=new rl,this.object.renderOrder=-2}return t.prototype.setAllowHosts=function(e){this.textureLoader.setAllowHosts(e)},t.prototype.setRequestProxy=function(e){this.textureLoader.setRequestProxy(e)},t.prototype.setNetworkSubscribe=function(e){this.textureLoader.setNetworkSubscribe(e)},t.prototype.cleanup=function(){var e=this;this.tileMeshes.forEach((function(t){t.dispose(),e.object.remove(t),e.object.needsRender=!0})),this.tileMeshes.clear()},t.prototype.setRotation=function(e){this.disposed||this.object.quaternion.equals(e)||(this.object.quaternion.copy(e),this.object.needsRender=!0)},t.prototype.setPosition=function(e){this.disposed||this.object.position.equals(e)||(this.object.position.copy(e),this.object.needsRender=!0)},t.prototype.setResource=function(e,t){var i,r;if(!this.disposed&&(this.resource!==e||this.luminance!==t)){this.cleanup(),this.resource=e;var n=null!==(r=null===(i=e.slice().sort((function(e,t){return t.level-e.level}))[0])||void 0===i?void 0:i.level)&&void 0!==r?r:0;this.tileTree=Pt(n),this.luminance=t,this.object.needsRender=!0}},t.prototype.update=function(t,i,r){var n=this;if(!this.disposed){this.level=i;var o=t.planes[5].normal,s=[];i>=this.minLevel&&Rt(this.tileTree,(function(e){if(!(e.level<n.minLevel))return!(e.level>i)&&!!t.intersectsBox(e.box)&&void s.push(e)}));var a=new e.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=h.resource.filter((function(t){return t.level===e.level}))[0];if(!t)return"continue";if(l.add(e),h.tileMeshes.has(e))return h.tileMeshes.get(e).activeTime=r,"continue";var i=t.size,o=h.imageOptions.transform,s=Math.pow(2,e.level)*e.position.y,a=Math.pow(2,e.level)*e.position.x,u="".concat(h.panoIndex,".").concat(e.face,".").concat(e.level,".").concat(s,".").concat(a),c=Ne(Ne({key:"pano_tile.".concat(u),basisLoaderInitialized:oi.isInitialized()},kt(h.imageOptions,["format","size","quality","sharpen","mappings"])),{size:i*e.size==512?void 0:512,cut:[i*e.position.x,i*e.position.y,i*e.size,i*e.size]}),d=h.textureLoader.loadTexture(t[e.face],{imageURL:{transform:o,options:c},preInit:!0}).then((function(e){return e.body})),p=null;if(h.luminance){var f=h.luminance[e.face],A=f.match(/\/cube_(\d+)\//),g=!!A&&Number(A[1]);if(!1!==g){var m=Ne(Ne({},c),{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=h.textureLoader.loadTexture(f,{imageURL:{transform:h.imageOptions.transform,options:m},preInit:!0}).then((function(e){return e.body})).catch((function(){return null}))}}h.pedding++;var v=Promise.all([d,p]).then((function(e){return n.pedding--,e}),(function(e){return n.pedding--,Promise.reject(e)})),y=new il(e,v);y.name="tiling:tile-".concat(u),y.activeTime=r,y.renderOrder=e.level,h.tileMeshes.set(e,y),h.object.needsRender=!0,h.object.add(y)},h=this,c=0,d=s;c<d.length;c++)u(m=d[c]);var p=[];this.tileMeshes.forEach((function(e,t){l.has(t)||p.push(t)}));for(var f=p.sort((function(e,t){var i,r,o,s;return(null!==(r=null===(i=n.tileMeshes.get(t))||void 0===i?void 0:i.activeTime)&&void 0!==r?r:0)-(null!==(s=null===(o=n.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)}}},t.prototype.dispose=function(){this.cleanup(),this.resource=[],this.disposed=!0},t}(),ol=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]),sl=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]),al=new e.BufferGeometry;al.setAttribute("position",new e.BufferAttribute(ol,3)),al.setIndex(new e.BufferAttribute(sl,1));var ll,ul,hl=function(){function t(){this.material=new e.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 e.Uniform(null),matrix:new e.Uniform(null),alpha:new e.Uniform(null),map:new e.Uniform(null)},depthTest:!1,depthWrite:!1,defines:{USE_PANO_VIDEO:!1},blending:e.CustomBlending,blendSrc:e.SrcAlphaFactor,blendDst:e.OneMinusSrcAlphaFactor,blendSrcAlpha:e.OneFactor,blendDstAlpha:e.OneMinusSrcAlphaFactor}),this.object=new e.Mesh(al,this.material),this.object.visible=!1,this.object.renderOrder=-1,this.object.frustumCulled=!1,this.alphaMotion=new Vo({alpha:0})}return t.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(ze),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(ze));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)},t.prototype.updateTime=function(e){this.alphaMotion.ended||(this.alphaMotion.update(e),this.material.uniforms.alpha.value=this.alphaMotion.value.alpha)},t.prototype.dispose=function(){this.material.dispose()},t}(),cl=(new e.Matrix4).makeRotationAxis(new e.Vector3(0,1,0),Math.PI),dl=new e.Vector3(-1,1,1),pl=function(){function t(e){void 0===e&&(e=0),this.width=e,this.pool=[]}return Object.defineProperty(t.prototype,"size",{get:function(){return this.pool.length},enumerable:!1,configurable:!0}),t.prototype.pop=function(){return this.pool.pop()||new e.WebGLCubeRenderTarget(this.width,{stencilBuffer:!1,depthBuffer:!1})},t.prototype.push=function(e){-1===this.pool.indexOf(e)&&this.pool.push(e)},t.prototype.clear=function(){for(var e=0,t=this.pool;e<t.length;e++)t[e].dispose();this.pool.length=0},t}(),fl=function(t){function i(e){var r,n,o,s,a=this,l=i.parseArgs(e);(a=t.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 pl,a.luminanceCubeRenderTargetPool=new pl;var u=a.model.getMaterial()||{},h=u.pano0,c=u.pano1;h&&(null==c?void 0:c.map)!==h.map&&(a.model.setMaterial({pano0:c}),h.map.dispose(),h.map instanceof ai&&h.map.cubeRenderTarget&&a.colorCubeRenderTargetPool.push(h.map.cubeRenderTarget),h.luminanceMap&&(h.luminanceMap.dispose(),h.luminanceMap instanceof ai&&h.luminanceMap.cubeRenderTarget&&a.luminanceCubeRenderTargetPool.push(h.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 Vo({count:0,distance:a.camera.pose.distance,modelAlpha:null!==(n=null===(r=a.model.getMaterial())||void 0===r?void 0:r.modelAlpha)&&void 0!==n?n:0,perspToOrtho:a.camera.perspToOrtho.x,orthoDistance:a.camera.orthoDistance}),a.panoResources={},a.panoResources[a.locationMotion.keyframes[0].key=a.locationMotion.keyframes[1].key=$n()]={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 li(d),a.tiling=new nl(d,a.TILED_CUBE_TEXTURE_LEVEL+1,a.imageOptions),a.scene.add(a.tiling.object),a.panoVideo=new hl,a.scene.add(a.panoVideo.object),a}return Oe(i,t),i.parseArgs=function(e){var i,r,n,o,s,a=t.parseArgs.call(this,e);return Ne(Ne({},a),{maxAccessibleDistance:null!==(i=e.maxAccessibleDistance)&&void 0!==i?i:5,panoTapTriggerRadius:null!==(r=e.panoTapTriggerRadius)&&void 0!==r?r:.5,panoCircleMeshCreator:null!==(n=e.panoCircleMeshCreator)&&void 0!==n?n:function(){return new gs},tileLevelForFov:null!==(o=e.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,r=Math.max(t.width/i,t.height/e);return r>80?4:r>48?3:r>18?2:r>12?1:0},luminanceAdaptiveEffectEnable:null===(s=e.luminanceAdaptiveEffectEnable)||void 0===s||s})},i.initAnimationEndPose=function(e){var i=this.parseArgs(e);return t.initAnimationEndPose.call(this,i)},i.prototype.destroy=function(){var e,i,r=this;t.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){r.helper.remove(e),e.dispose()})),this.panoMeshes.length=0),this.interiaMovement=!1;var n=this.videoTexture.image;n.pause(),n.oncanplay=function(){},n.ontimeupdate=function(){},this.scene.remove(this.panoVideo.object),this.panoVideo.setMaterial(null),this.panoVideo.dispose();for(var o=null!==(e=this.model.getMaterial())&&void 0!==e?e:{},s=o.pano0,a=o.pano1,l=0,u=Object.keys(this.panoResources);l<u.length;l++){var h=u[l],c=this.panoResources[h];if(c.panoPicture){var d=c.panoPicture.map;d&&d!==(null==s?void 0:s.map)&&d!==(null==a?void 0:a.map)&&(d.dispose(),null===(i=c.panoPicture.luminanceMap)||void 0===i||i.dispose(),c.panoPicture=null)}delete this.panoResources[h]}this.luminanceAdaptiveEffect&&(this.luminanceAdaptiveEffect.dispose(),delete this.luminanceAdaptiveEffect)},i.prototype.isReady=function(){return!0===this.locationMotion.ended&&t.prototype.isReady.call(this)},i.prototype.isTileReady=function(){var e,t,i,r=this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[this.locationMotion.keyframes.length-1]),n=(null===(e=r.panoPicture)||void 0===e?void 0:e.map)instanceof ai&&null!==(i=null===(t=r.panoPicture)||void 0===t?void 0:t.map.tilePending)&&void 0!==i?i:0,o=this.tiling.pedding;return this.initAnimationed&&n<=0&&o<=0},i.prototype.updateWork=function(e,t,i,r,n){var o=this;this.userAction=n,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:r,longitude:i.longitude,latitude:i.latitude,fov:i.fov,moveEndCallback:function(){o.initAnimationed=!0},moveCancelCallback:function(){o.initAnimationed=!0}},n),!0},i.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()},i.prototype.updateTime=function(t,i){for(var r,n,o,s,a,l,u,h,c,d,p,f=this,A=[],g=2;g<arguments.length;g++)A[g-2]=arguments[g];if(!this.destroyed){var m={},v={},y=this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[0]),b=this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[this.locationMotion.keyframes.length-1]),x=!1;if(!1===this.locationMotion.ended){this.locationMotion.update(t);var w=this.locationMotion.getKeyFrameSegment(t),E=w[0],M=w[1],S=this.panoResourceFromLocationMotionKeyframe(E),C=this.panoResourceFromLocationMotionKeyframe(M),I=(new e.Vector3).copy(S.position),B=(new e.Vector3).copy(C.position),T=this.locationMotion.value.count-M.value.count+1;m.progress=T,m.modelAlpha=this.locationMotion.value.modelAlpha,this.camera.perspToOrtho.setScalar(bo(this.locationMotion.value.perspToOrtho,0,1)),this.camera.orthoDistance=this.locationMotion.value.orthoDistance,C.panoPicture&&(T<1?S.panoPicture&&(m.pano0=S.panoPicture):m.pano0=C.panoPicture,m.pano1=C.panoPicture),x=m.useBlackTransition="instant"===C.effect||"montage"===C.effect,"fade"!==C.effect&&"montage"!==C.effect||(m.pano0&&S.panoPicture&&(m.pano0={map:m.pano0.map,luminanceMap:m.pano0.luminanceMap,matrix:S.panoPicture.matrix.clone().setPosition(C.position)}),I.copy(B)),v.distance=this.locationMotion.value.distance,v.offset=new e.Vector3(I.x+(B.x-I.x)*T,I.y+(B.y-I.y)*T,I.z+(B.z-I.z)*T);for(var P=[],R=[],k=0,L=this.locationMotion.keyframes;k<L.length;k++){var D=L[k],O=D.key,N=D.progress;void 0!==O&&(P.push(O),N>=this.locationMotion.progress&&R.push(O))}for(var F=0,Q=Object.keys(this.panoResources);F<Q.length;F++){var V=Q[F];if(!(R.indexOf(V)>=0)){var H=this.panoResources[V];if(H.panoPicture){var q=H.panoPicture.map,z=H.panoPicture.luminanceMap;if(q){if(q===(null===(r=m.pano0)||void 0===r?void 0:r.map))continue;if(q===(null===(n=m.pano1)||void 0===n?void 0:n.map))continue;q instanceof ai&&q.cubeRenderTarget&&this.colorCubeRenderTargetPool.push(q.cubeRenderTarget),q.dispose(),z&&(z instanceof ai&&z.cubeRenderTarget&&this.luminanceCubeRenderTargetPool.push(z.cubeRenderTarget),z.dispose()),H.panoPicture=null}}P.indexOf(V)>=0||delete this.panoResources[V]}}S.workCode===C.workCode?this.currentPanoIndex=T<.5?S.panoIndex:C.panoIndex:this.currentPanoIndex=C.panoIndex,this.emit("movingToPano",b.panoIndex,y.panoIndex,this.locationMotion.progress)}if(!1===this.cameraMotion.ended&&(this.cameraMotion.update(t),v.longitude=this.cameraMotion.value.longitude,v.latitude=this.cameraMotion.value.latitude,v.fov=this.cameraMotion.value.fov),!1===pa(m)&&((null===(o=m.pano0)||void 0===o?void 0:o.map)&&m.pano0.map instanceof ai&&!m.pano0.map.cubeRenderTarget&&(m.pano0.map.cubeRenderTarget=this.colorCubeRenderTargetPool.pop()),(null===(s=m.pano0)||void 0===s?void 0:s.luminanceMap)&&m.pano0.luminanceMap instanceof ai&&!m.pano0.luminanceMap.cubeRenderTarget&&(m.pano0.luminanceMap.cubeRenderTarget=this.luminanceCubeRenderTargetPool.pop()),(null===(a=m.pano1)||void 0===a?void 0:a.map)&&m.pano1.map instanceof ai&&!m.pano1.map.cubeRenderTarget&&(m.pano1.map.cubeRenderTarget=this.colorCubeRenderTargetPool.pop()),(null===(l=m.pano1)||void 0===l?void 0:l.luminanceMap)&&m.pano1.luminanceMap instanceof ai&&!m.pano1.luminanceMap.cubeRenderTarget&&(m.pano1.luminanceMap.cubeRenderTarget=this.luminanceCubeRenderTargetPool.pop()),this.model.setMaterial(m),this.boundingMesh.setMaterial(m)),!1===pa(v)&&this.setCamera(v),this.camera.pose.distance>.1)for(var U=0;U<this.work.observers.length;U++)(X=this.panoMeshes[U])&&(X.visible=!1);else{var j=this.work.observers[this.currentPanoIndex];if(j){var K=da(j.visibleNodes,(function(e){return j.standingPosition.distanceTo(f.work.observers[e].standingPosition)}),!0),_=K[1];_=bo(_,3,1/0);var G=j.visibleNodes.concat(this.currentPanoIndex),W=this.getForwardPanoIndexOrNot();for(U=0;U<this.work.observers.length;U++){var X,Y=this.work.observers[U];if(X=this.panoMeshes[U])if(Y.loadable||Y.active)if(-1!==G.indexOf(U))if(x)X.visible=!1,X.setOpacity(0);else{X.visible=!0;var Z=X.position.clone().setY(this.camera.position.y).distanceTo(this.camera.position);X.setCurrent(!X.loading&&0===X.progress&&W===U),X.setOpacity(Z<.01?0:bo(_/Z*1.2,.75,.98)),X.updateTime&&X.updateTime(t,i)}else X.visible=!1,X.setOpacity(0);else X.visible=!1,X.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 J=this.tileLevel=function(){if(!1===f.tileLevelForFov)return 0;var t=f.renderer.getDrawingBufferSize(new e.Vector2);t.width*=f.scissor.width,t.height*=f.scissor.height;var i=b.panoIndex,r=f.work.observers[i],n=f.imageOptions.size;if(void 0===n&&r){var o=r.images.up.match(/\/cube_(\d+)\//);o&&(n=Number(o[1]))}void 0===n&&(n=2048);var s=0;n>=1024&&(s=1),n>=2048&&(s=2),n>=4096&&(s=3),n>=8192&&(s=4);var a=f.tileLevelForFov(f.camera.fov,t);return a>s?a:0}(),$=function(){var t,i=(new e.Camera).copy(f.camera);return i.position.set(0,0,0),i.quaternion.premultiply((null!==(t=f.work.observers[b.panoIndex])&&void 0!==t?t:f.work.observers[f.currentPanoIndex]).quaternion.clone().inverse()),i.updateMatrixWorld(!0),(new e.Frustum).setFromProjectionMatrix((new e.Matrix4).multiplyMatrices(f.camera.projectionMatrix,i.matrixWorldInverse))}();b.panoIndex===this.currentPanoIndex&&((null===(h=b.panoPicture)||void 0===h?void 0:h.map)instanceof ai&&(b.panoPicture.map.update($,J),!0===b.panoPicture.map.needsRender&&(b.panoPicture.map.needsRender=!1,this.needsRender=!0)),(null===(c=b.panoPicture)||void 0===c?void 0:c.luminanceMap)instanceof ai&&(b.panoPicture.luminanceMap.update($,J),!0===b.panoPicture.luminanceMap.needsRender&&(b.panoPicture.luminanceMap.needsRender=!1,this.needsRender=!0)));var ee=this.tiling.object.visible;if(this.initAnimationed){var te=b.panoIndex,ie=this.work.observers[te];ie&&Zs(this.camera.position,ie.position)&&this.locationMotion.ended?(this.tiling.object.visible=!0,this.tiling.panoIndex!==te&&this.tiling.cleanup(),this.tiling.panoIndex=te,this.tiling.setResource(null!==(p=null===(d=ie.images)||void 0===d?void 0:d.tiles)&&void 0!==p?p:[],this.enableIOSEDR&&ie.images.luminance?ie.images.luminance:null),this.tiling.setRotation(ie.quaternion),this.tiling.setPosition(ie.position),J>this.TILED_CUBE_TEXTURE_LEVEL?this.tiling.update($,J,t):this.tiling.update($,0,t)):this.tiling.object.visible=!1}else this.tiling.object.visible=!1;ee!==this.tiling.object.visible&&(this.tiling.object.needsRender=!0),this.panoVideo.object.position.copy(this.camera.position),this.panoVideo.updateTime(t)}},i.prototype.render=function(){var e=this.work.observers[this.currentPanoIndex];e&&e.video&&(this.needsRender=!0),t.prototype.render.call(this)},i.prototype.postProcessing=function(e,t){if(!this.destroyed)return this.luminanceAdaptiveEffect||(this.luminanceAdaptiveEffect=new Wa(this.renderer),this.luminanceAdaptiveEffect.enable=this.luminanceAdaptiveEffectEnable),this.luminanceAdaptiveEffect.render(e,t)},i.prototype.getTargetPose=function(){var e=this.cameraMotion.getKeyFrameSegment(je())[1],t=this.locationMotion.getKeyFrameSegment(je())[1],i=this.panoResourceFromLocationMotionKeyframe(t),r=this.work.observers[i.panoIndex];return{longitude:e.value.longitude,latitude:e.value.latitude,fov:e.value.fov,offset:r?r.position.clone():this.camera.position.clone(),distance:this.locationMotion.value.distance}},i.prototype.moveToPano=function(t,i,r){var n,o,s,a,l=this,u=this.work.observers[t],h=this.imageOptions.size;if(void 0===h&&u){var c=u.images.up.match(/\/cube_(\d+)\//);c&&(h=Number(c[1]))}void 0===h&&(h=2048);var d=this.imageOptions.transform,p=Ne({key:"pano.".concat(t),basisLoaderInitialized:oi.isInitialized()},kt(this.imageOptions,["format","size","quality","sharpen","mappings"])),f=u.images,A=null!==(o=null===(n=u.images.tiles)||void 0===n?void 0:n.filter((function(e){return e.size>h})))&&void 0!==o?o:null,g=d,m={key:"pano_luminance.".concat(t),basisLoaderInitialized:oi.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:"+Ha([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:t,workCode:this.work.workCode,effect:null!==(a=i.effect)&&void 0!==a?a:"fly",panoPicture:{map:w.map,luminanceMap:w.luminanceMap,matrix:(new e.Matrix4).compose(u.position,u.quaternion,dl)},position:u.position.clone()};ft.shared.add((function(){l.pending=!1,l.emit("panoLoaded",t),l.doMoveToPano(t,C,i,r)}),!0,1)}else{this.pendingTextureTask={panoIndex:t,hash:b,onLoad:function(n,o){var s,a;if(l.pending=!1,l.destroyed)n.body.dispose();else{n.body.name=b,l.emit("panoLoaded",t);var h={panoIndex:t,workCode:l.work.workCode,effect:null!==(s=i.effect)&&void 0!==s?s:"fly",panoPicture:{map:n.body,luminanceMap:null!==(a=null==o?void 0:o.body)&&void 0!==a?a:null,matrix:(new e.Matrix4).compose(u.position,u.quaternion,dl)},position:u.position.clone()};l.doMoveToPano(t,h,i,r)}},onError:function(e){l.pending=!1,i.moveCancelCallback&&i.moveCancelCallback(),l.emit("panoLoadError",e,t),l.emit("moveToPanoCanceled",t)}};var I=this.panoMeshes[t];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:e.RGBAFormat,viaAjax:!0},void 0,void 0,(function(e){var i,r;l.emit("textureLoading",e,t,u),(null===(i=l.pendingTextureTask)||void 0===i?void 0:i.hash)===b&&(null===(r=l.panoMeshes[t])||void 0===r||r.setProgress(e))}),this.renderer):this.textureLoader.loadCubeTexture(f,{imageURL:{transform:d,options:p},format:e.RGBAFormat,viaAjax:!0,preInit:!0},void 0,void 0,(function(e){var i,r;l.emit("textureLoading",e,t,u),(null===(i=l.pendingTextureTask)||void 0===i?void 0:i.hash)===b&&(null===(r=l.panoMeshes[t])||void 0===r||r.setProgress(e))}),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(e){var i,r,n=e[0],o=e[1];(null===(i=l.pendingTextureTask)||void 0===i?void 0:i.hash)===b?(l.pendingTextureTask.onLoad(n,o),null===(r=l.panoMeshes[t])||void 0===r||r.setProgress(0),delete l.pendingTextureTask,l.emit("textureLoaded",t,u,n.meta)):(n.body.dispose(),null==o||o.body.dispose())})).catch((function(e){var i,r;(null===(i=l.pendingTextureTask)||void 0===i?void 0:i.hash)===b&&(l.pendingTextureTask.onError(e),null===(r=l.panoMeshes[t])||void 0===r||r.setProgress(0),delete l.pendingTextureTask,l.emit("textureError",e,t,u),l.emit("error",e))})),this.emit("textureStartLoad",t,u)}},i.prototype.initAnimation=function(e,t,i,r){var n,o,s,a=this;if(!this.destroyed){var l=!1;this.pending=!1,this.userAction=r,this.moveToPano(e,{longitude:null!==(n=t.longitude)&&void 0!==n?n:this.defaultLongitude,latitude:bo(null!==(o=t.latitude)&&void 0!==o?o:this.defaultLatitude,this.minLatitude,this.maxLatitude),fov:bo(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}},r)}},i.prototype.panoResourceFromLocationMotionKeyframe=function(e){return this.panoResources[e.key]},i.prototype.locationMotionKeyframesLength=function(e){for(var t=0,i=1;i<e.length;i++){var r=this.panoResourceFromLocationMotionKeyframe(e[i-1]).position,n=this.panoResourceFromLocationMotionKeyframe(e[i]).position;t+=r.distanceTo(n)*(e[i].value.count-e[i-1].value.count)}return t},i.prototype.updatePanoMeshes=function(t){var i=this;void 0===t&&(t=!0);for(var r={},n=0,o=this.panoMeshes;n<o.length;n++)r[(A=o[n]).name]=A;this.panoMeshes.length=0;for(var s=1,a={},l=function(e){var t=da(e.accessibleNodes,(function(t){return bo(i.work.observers[t].standingPosition.distanceTo(e.standingPosition),1,1/0)}),!0),r=t[1];void 0===a[e.panoIndex]&&(a[e.panoIndex]=r)},u=0,h=this.work.observers;u<h.length;u++)l(f=h[u]);var c=Object.keys(a).map((function(e){return a[e]}));c.length&&(s=bo(c.reduce((function(e,t){return e+t}),0)/c.length*.6,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(r[p]?(!0===(A=r[p]).loading&&!1===f.loadable&&A.setLoading(!1),delete r[p]):((A=this.panoCircleMeshCreator()).name=p,this.helper.add(A)),A.scale.set(s,1,s),A.position.copy(f.standingPosition),t&&this.model.loaded&&this.model.bvhs.loaded){var g=new e.Vector3(0,-1,0),m=new e.Vector3(0,.1,0).add(A.position),v=new e.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(r);b<x.length;b++){var w=x[b];this.helper.remove(r[w]),r[w].dispose(),delete r[w]}},i.prototype.generateBoundingMesh=function(t){void 0===t&&(t=!1);for(var i=this.model.bounding.clone(),r=0,n=this.work.observers;r<n.length;r++){var o=n[r];i.expandByPoint(o.standingPosition),i.expandByPoint((new e.Vector3).fromArray([o.position.x,2*o.position.y-o.standingPosition.y,o.position.z]))}t&&i.expandByPoint(this.camera.position);var s=ta(i,new e.Vector3(1,0,1));return s.name="panorama_bounding",s},i.prototype.doMoveToPano=function(t,i,r,n){var o,s,a,l=this;void 0===r&&(r={}),this.userAction=n;var u,h,c,d=je(),p=$n();if(this.tiling.cleanup(),this.panoResources[p]=i,this.locationMotion.ended){var f=this.locationMotion.getKeyFrameSegment(d),A=(f[0],f[1]),g=this.locationMotion.value,m=this.panoResourceFromLocationMotionKeyframe(A).position,v=i.position;u=Math.max(m.distanceTo(v),1),h=[{key:A.key,progress:0,value:Ne(Ne({},g),{count:0})},{key:p,progress:1,value:{distance:0,perspToOrtho:0,orthoDistance:1,modelAlpha:0,count:1}}],c=0}else{var y=this.locationMotion.getKeyFrameSegment(d),b=y[0],x=(A=y[1],g=this.locationMotion.value,this.panoResourceFromLocationMotionKeyframe(b).position),w=(m=this.panoResourceFromLocationMotionKeyframe(A).position,v=i.position,A.value.count-g.count),E=Math.max(x.distanceTo(m),1)*w;u=E+Math.max(m.distanceTo(v),1),h=[{key:b.key,progress:0,value:Ne({},g)},{key:A.key,progress:E/u,value:A.value},{key:p,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(h);c=0===M||0===M?0:this.locationMotion.getProgressVelocity(d)*M/S}var C=this.calculateMovingDuration(r.duration,"fade"===r.effect||"montage"===r.effect?0:u),I={longitude:r.longitude,latitude:r.latitude,fov:r.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:i.position.clone(),distance:this.camera.pose.distance};r.moveStartCallback&&r.moveStartCallback(t,B),this.emit("panoWillArrive",t,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=ze,this.videoTexture.needsUpdate=!0),this.panoVideo.setMaterial(null),this.cameraMotion.set(I,C).catch(ze),this.locationMotion.setKeyframes(h,C,c).then((function(){var i,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};r.moveEndCallback&&r.moveEndCallback(t,a),l.emit("panoArrived",t,a,n);var u=l.work.observers[l.currentPanoIndex];if(u&&u.video&&l.videoTexture&&l.videoTexture.image instanceof HTMLVideoElement){var h=cl.clone().multiply(null!==(s=null===(o=null===(i=l.model.getMaterial())||void 0===i?void 0:i.pano1)||void 0===o?void 0:o.matrix)&&void 0!==s?s:new e.Matrix4).multiply(u.video.matrix),c={map:l.videoTexture,size:u.video.size,matrix:h,alpha:1},d=$n(),p=l.videoTexture.image;p.setAttribute("uuid",d),Ua().then((function(e){e&&u.video&&p.getAttribute("uuid")===d&&(p.oncanplay=function(){p.oncanplay=ze,p.play()},p.ontimeupdate=function(){p.currentTime>.5&&(p.ontimeupdate=ze,l.panoVideo.setMaterial(c))},p.src=u.video.source)})).catch((function(){p.removeAttribute("uuid")}))}}),(function(){r.moveCancelCallback&&r.moveCancelCallback(),l.emit("moveToPanoCanceled",t)}))},i.prototype.getForwardPanoIndexOrNot=function(t){var i=this,r=this.work.observers[this.currentPanoIndex];if(!r)return null;var n=null!=t?t:new e.Raycaster(this.camera.position.clone(),this.camera.getWorldDirection(new e.Vector3)),o=new e.Vector3,s=this.model.intersectRaycaster(new e.Raycaster(n.ray.origin,new e.Vector3(0,-1,0)))[0];s&&s.distance<=2?o.copy(s.point):o.copy(n.ray.origin).add(new e.Vector3(0,-1.5,0));var a=this.model.intersectRaycaster(n)[0],l=(a?a.point:n.ray.origin.clone().add(n.ray.direction.clone().normalize().multiplyScalar(3))).clone().sub(o).normalize();if(0===l.length())return null;for(var u=r.accessibleNodes.filter((function(e){if(e===i.currentPanoIndex)return!1;var t=i.work.observers[e],r=t.standingPosition.clone().project(i.camera);return!(Math.abs(r.z)>1)&&!(Math.abs(r.x)>1)&&!(Math.abs(r.y)>1)&&(t.loadable||t.active)})),h=u.slice().sort((function(e,t){return i.work.observers[e].standingPosition.clone().distanceTo(o)-i.work.observers[t].standingPosition.clone().distanceTo(o)})),c=0,d=[Math.PI/8,Math.PI/6,Math.PI/4,Math.PI/3];c<d.length;c++)for(var p=d[c],f=0,A=h;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},i.prototype.onTapGesture=function(t){var i=this,r=t.pointers.map((function(e){return kt(e,["x","y"])}));if(!this.emit("wantsGesture","tap",r,!0)){var n=this.relativeClientPosition(t.center),o=new e.Raycaster;if(o.setFromCamera(n,this.camera),!this.emit("wantsTapGesture",o,n,!0)){this.emit("gesture","tap",r,!0),this.emit("tapGesture",o,n,!0),this.interiaMovement=!1;var s=this.camera.getWorldDirection(new e.Vector3).setY(0),a=null,l=this.work.observers[this.currentPanoIndex];if(l){var u=l.accessibleNodes.filter((function(e){if(e===i.currentPanoIndex)return!1;var t=i.work.observers[e];return!(t.position.distanceTo(i.camera.position)>i.maxAccessibleDistance)&&(t.loadable||t.active)})),h=this.model.intersectRaycaster(o)[0];if(h){var c=da(u,(function(e){var t=i.work.observers[e].standingPosition.clone();return t.clone().sub(i.camera.position).setY(0).angleTo(s)>Math.PI/2?1/0:t.distanceTo(h.point)}),!0),d=c[0];c[1]<this.panoTapTriggerRadius&&(a=d)}fo(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),fo(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=[],E=0,M=m.accessibleNodes;E<M.length;E++)if((d=M[E])!==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=bo(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))}}}}},i}(za),Al=Math.PI/180,gl=180/Math.PI,ml=function(){var e="undefined"!=typeof navigator&&/iPad|iPhone|iPod/.test(navigator.platform);return function(){return e}}(),vl=function(){var e="undefined"!=typeof navigator&&/^((?!chrome|android).)*safari/i.test(navigator.userAgent);return function(){return e}}(),yl=function(){var e="undefined"!=typeof navigator&&-1!==navigator.userAgent.indexOf("Firefox")&&-1!==navigator.userAgent.indexOf("Android");return function(){return e}}(),bl=(ll="undefined"!=typeof navigator?navigator.userAgent.match(/.*Chrome\/([0-9]+)/):null,ul=ll?parseInt(ll[1],10):null,function(){return ul}),xl=function(){var e=!1;if(65===bl()){var t="undefined"!=typeof navigator?navigator.userAgent.match(/.*Chrome\/([0-9\.]*)/):null;if(t){var i=t[1].split("."),r=(i[0],i[1],i[2]),n=i[3];e=3325===parseInt(r,10)&&parseInt(n,10)<148}}return function(){return e}}(),wl=function(){var e=ml()&&vl()&&"undefined"!=typeof navigator&&-1!==navigator.userAgent.indexOf("13_4");return function(){return e}}(),El=function(){var e="undefined"!=typeof navigator&&-1!==navigator.userAgent.indexOf("R7 Build");return function(){return e}}();function Ml(){var e="undefined"!=typeof window&&(90==window.orientation||-90==window.orientation);return El()?!e:e}var Sl,Cl=(Sl={},function(e,t){void 0===Sl[e]&&(console.warn("cardboard: "+t),Sl[e]=!0)});function Il(e){var t,i=e.indexOf("://");t=-1!==i?i+3:0;var r=e.indexOf("/",t);return-1===r&&(r=e.length),e.substring(0,r)}var Bl,Tl=function(e,t,i){!function(e,t,i){var r=t?t[0]:0,n=t?t[1]:0,o=t?t[2]:0,s=t?t[3]:1,a=r+r,l=n+n,u=o+o,h=r*a,c=r*l,d=r*u,p=n*l,f=n*u,A=o*u,g=s*a,m=s*l,v=s*u;e[0]=1-(p+A),e[1]=c+v,e[2]=d-m,e[3]=0,e[4]=c-v,e[5]=1-(h+A),e[6]=f+g,e[7]=0,e[8]=d+m,e[9]=f-g,e[10]=1-(h+p),e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1}(e,t),i&&function(e,t,i){var r,n,o,s,a,l,u,h,c,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]):(r=t[0],n=t[1],o=t[2],s=t[3],a=t[4],l=t[5],u=t[6],h=t[7],c=t[8],d=t[9],p=t[10],f=t[11],e[0]=r,e[1]=n,e[2]=o,e[3]=s,e[4]=a,e[5]=l,e[6]=u,e[7]=h,e[8]=c,e[9]=d,e[10]=p,e[11]=f,e[12]=r*A+a*g+c*m+t[12],e[13]=n*A+l*g+d*m+t[13],e[14]=o*A+u*g+p*m+t[14],e[15]=s*A+h*g+f*m+t[15])}(e,e,i),function(e,t){var i=t[0],r=t[1],n=t[2],o=t[3],s=t[4],a=t[5],l=t[6],u=t[7],h=t[8],c=t[9],d=t[10],p=t[11],f=t[12],A=t[13],g=t[14],m=t[15],v=i*a-r*s,y=i*l-n*s,b=i*u-o*s,x=r*l-n*a,w=r*u-o*a,E=n*u-o*l,M=h*A-c*f,S=h*g-d*f,C=h*m-p*f,I=c*g-d*A,B=c*m-p*A,T=d*m-p*g,P=v*T-y*B+b*I+x*C-w*S+E*M;P&&(P=1/P,e[0]=(a*T-l*B+u*I)*P,e[1]=(n*B-r*T-o*I)*P,e[2]=(A*E-g*w+m*x)*P,e[3]=(d*w-c*E-p*x)*P,e[4]=(l*C-s*T-u*S)*P,e[5]=(i*T-n*C+o*S)*P,e[6]=(g*b-f*E-m*y)*P,e[7]=(h*E-d*b+p*y)*P,e[8]=(s*B-a*C+u*M)*P,e[9]=(r*C-i*B-o*M)*P,e[10]=(f*w-A*b+m*v)*P,e[11]=(c*b-h*w-p*v)*P,e[12]=(a*S-s*I-l*M)*P,e[13]=(i*I-r*S+n*M)*P,e[14]=(A*y-f*x-g*v)*P,e[15]=(h*x-c*y+d*v)*P)}(e,e)},Pl=function(){function t(t,i){void 0===t&&(t=new e.Vector3),void 0===i&&(i=0),this.sample=t,this.timestampS=i}return t.prototype.set=function(e,t){this.sample=e,this.timestampS=t},t.prototype.copy=function(e){this.set(e.sample,e.timestampS)},t}(),Rl=function(){function t(t,i){this.kFilter=t,this.isDebug=i,this.currentAccelMeasurement=new Pl,this.currentGyroMeasurement=new Pl,this.previousGyroMeasurement=new Pl,ml()?this.filterQ=new e.Quaternion(-1,0,0,1):this.filterQ=new e.Quaternion(1,0,0,1),this.previousFilterQ=new e.Quaternion,this.previousFilterQ.copy(this.filterQ),this.accelQ=new e.Quaternion,this.isOrientationInitialized=!1,this.estimatedGravity=new e.Vector3,this.measuredGravity=new e.Vector3,this.gyroIntegralQ=new e.Quaternion}return t.prototype.addAccelMeasurement=function(e,t){this.currentAccelMeasurement.set(e,t)},t.prototype.addGyroMeasurement=function(e,t){var i;this.currentGyroMeasurement.set(e,t),i=t-this.previousGyroMeasurement.timestampS,isNaN(i)||i<=.001||i>1||this.run_(),this.previousGyroMeasurement.copy(this.currentGyroMeasurement)},t.prototype.getOrientation=function(){return this.filterQ},t.prototype.run_=function(){if(!this.isOrientationInitialized)return this.accelQ=this.accelToQuaternion_(this.currentAccelMeasurement.sample),this.previousFilterQ.copy(this.accelQ),void(this.isOrientationInitialized=!0);var t=this.currentGyroMeasurement.timestampS-this.previousGyroMeasurement.timestampS,i=this.gyroToQuaternionDelta_(this.currentGyroMeasurement.sample,t);this.gyroIntegralQ.multiply(i),this.filterQ.copy(this.previousFilterQ),this.filterQ.multiply(i);var r=new e.Quaternion;r.copy(this.filterQ),r.inverse(),this.estimatedGravity.set(0,0,-1),this.estimatedGravity.applyQuaternion(r),this.estimatedGravity.normalize(),this.measuredGravity.copy(this.currentAccelMeasurement.sample),this.measuredGravity.normalize();var n,o=new e.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)",gl*((n=o).w>1?0:2*Math.acos(n.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 e.Quaternion;s.copy(this.filterQ),s.multiply(o),this.filterQ.slerp(s,1-this.kFilter),this.previousFilterQ.copy(this.filterQ)},t.prototype.accelToQuaternion_=function(t){var i=new e.Vector3;i.copy(t),i.normalize();var r=new e.Quaternion;return r.setFromUnitVectors(new e.Vector3(0,0,-1),i),r.inverse(),r},t.prototype.gyroToQuaternionDelta_=function(t,i){var r=new e.Quaternion,n=new e.Vector3;return n.copy(t),n.normalize(),r.setFromAxisAngle(n,t.length()*i),r},t}(),kl=function(){function t(t,i){this.predictionTimeS=t,this.isDebug=i,this.previousQ=new e.Quaternion,this.previousTimestampS=null,this.deltaQ=new e.Quaternion,this.outQ=new e.Quaternion}return t.prototype.getPrediction=function(t,i,r){if(!this.previousTimestampS)return this.previousQ.copy(t),this.previousTimestampS=r,t;var n=new e.Vector3;n.copy(i),n.normalize();var o=i.length();if(o<20*Al)return this.isDebug&&console.log("Moving slowly, at %s deg/s: no prediction",(gl*o).toFixed(1)),this.outQ.copy(t),this.previousQ.copy(t),this.outQ;var s=o*this.predictionTimeS;return this.deltaQ.setFromAxisAngle(n,s),this.outQ.copy(this.previousQ),this.outQ.multiply(this.deltaQ),this.previousQ.copy(t),this.previousTimestampS=r,this.outQ},t}(),Ll=function(){function e(e){this.coefficients=e}return e.prototype.distortInverse=function(e){for(var t=0,i=1,r=e-this.distort(t);Math.abs(i-t)>1e-4;){var n=e-this.distort(i),o=i-n*((i-t)/(n-r));t=i,i=o,r=n}return i},e.prototype.distort=function(e){for(var t=e*e,i=0,r=0;r<this.coefficients.length;r++)i=t*(i+this.coefficients[r]);return(i+1)*e},e}(),Dl=function(){this.angularAcceleration=null,this.angularVelocity=null,this.linearAcceleration=null,this.linearVelocity=null,this.orientation=null,this.position=null},Ol=function(){this.leftDegrees=0,this.rightDegrees=0,this.upDegrees=0,this.downDegrees=0},Nl=function(){function t(t,i,r,n){this.viewer={id:"CardboardV1",label:"Cardboard I/O 2014",fov:40,interLensDistance:.06,baselineLensDistance:.035,screenLensDistance:.042,distortionCoefficients:[.441,.156],inverseCoefficients:[-.4410035,.42756155,-.4804439,.5460139,-.58821183,.5733938,-.48303202,.33299083,-.17573841,.0651772,-.01488963,.001559834]},this.device={widthMeters:.11,heightMeters:.062,bevelMeters:.004},this.depthNear=.01,this.depthFar=1e4,this.yawOnly=r,this.accelerometer=new e.Vector3,this.gyroscope=new e.Vector3,this.filter=new Rl(t,n),this.posePredictor=new kl(i,n),this.isFirefoxAndroid=yl(),this.isIOS=ml();var o=bl();this.isDeviceMotionInRadians=!this.isIOS&&null!==o&&o<66,this.isWithoutDeviceMotion=xl()||wl(),this.filterToWorldQ=new e.Quaternion,ml()?this.filterToWorldQ.setFromAxisAngle(new e.Vector3(1,0,0),Math.PI/2):this.filterToWorldQ.setFromAxisAngle(new e.Vector3(1,0,0),-Math.PI/2),this.inverseWorldToScreenQ=new e.Quaternion,this.worldToScreenQ=new e.Quaternion,this.originalPoseAdjustQ=new e.Quaternion;var s="undefined"!=typeof window?-window.orientation*Math.PI/180:0;this.originalPoseAdjustQ.setFromAxisAngle(new e.Vector3(0,0,1),s),this.setScreenTransform_(),Ml()&&this.filterToWorldQ.multiply(this.inverseWorldToScreenQ),this.resetQ=new e.Quaternion,this.orientationOut_=new Float32Array(4),this.previousTimestampS=Date.now()}return t.prototype.getPosition=function(){return null},t.prototype.getOrientation=function(){var t;if(this.isWithoutDeviceMotion&&this._deviceOrientationQ){this.deviceOrientationFixQ=this.deviceOrientationFixQ||function(){var t=(new e.Quaternion).setFromAxisAngle(new e.Vector3(0,0,-1),0),i=new e.Quaternion;return"undefined"!=typeof window&&-90===window.orientation?i.setFromAxisAngle(new e.Vector3(0,1,0),Math.PI/-2):i.setFromAxisAngle(new e.Vector3(0,1,0),Math.PI/2),t.multiply(i)}(),this.deviceOrientationFilterToWorldQ=this.deviceOrientationFilterToWorldQ||((r=new e.Quaternion).setFromAxisAngle(new e.Vector3(1,0,0),-Math.PI/2),r),t=this._deviceOrientationQ;var i=new e.Quaternion;return i.copy(t),i.multiply(this.deviceOrientationFilterToWorldQ),i.multiply(this.resetQ),i.multiply(this.worldToScreenQ),i.multiplyQuaternions(this.deviceOrientationFixQ,i),this.yawOnly&&(i.x=0,i.z=0,i.normalize()),this.orientationOut_[0]=i.x,this.orientationOut_[1]=i.y,this.orientationOut_[2]=i.z,this.orientationOut_[3]=i.w,this.orientationOut_}var r,n=this.filter.getOrientation();t=this.posePredictor.getPrediction(n,this.gyroscope,this.previousTimestampS);var o=new e.Quaternion;return o.copy(this.filterToWorldQ),o.multiply(this.resetQ),o.multiply(t),o.multiply(this.worldToScreenQ),this.yawOnly&&(o.x=0,o.z=0,o.normalize()),this.orientationOut_[0]=o.x,this.orientationOut_[1]=o.y,this.orientationOut_[2]=o.z,this.orientationOut_[3]=o.w,this.orientationOut_},t.prototype.getPose=function(){var e=new Dl;return e.orientation=this.getOrientation(),e},t.prototype.resetPose=function(){this.resetQ.copy(this.filter.getOrientation()),this.resetQ.x=0,this.resetQ.y=0,this.resetQ.z*=-1,this.resetQ.normalize(),Ml()&&this.resetQ.multiply(this.inverseWorldToScreenQ),this.resetQ.multiply(this.originalPoseAdjustQ)},t.prototype.getFrameData=function(e){var t=this.getOrientation(),i=this.getEyeOffset(),r=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(r.left),e.rightProjectionMatrix.set(r.right),Tl(e.leftViewMatrix,t,i.left),Tl(e.rightViewMatrix,t,i.right),e},t.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),r=this.onDeviceOrientation_.bind(this);return ml()&&function(){if("undefined"==typeof window)return!1;if("undefined"==typeof document)return!1;var e=window.self!==window.top,t=Il(document.referrer),i=Il(window.location.href);return e&&t!==i}()&&window.addEventListener("message",i),window.addEventListener("orientationchange",t),this.isWithoutDeviceMotion?window.addEventListener("deviceorientation",r):window.addEventListener("devicemotion",e),function(){window.removeEventListener("devicemotion",e),window.removeEventListener("deviceorientation",t),window.removeEventListener("orientationchange",t),window.removeEventListener("message",i)}},t.prototype.getEyeOffset=function(){return{left:[.5*-this.viewer.interLensDistance,0,0],right:[.5*this.viewer.interLensDistance,0,0]}},t.prototype.getEyeProjectionMatrix=function(){var e,t,i=this.getEyeFieldOfView(),r=this.depthNear,n=this.depthFar,o={left:[],right:[]},s=i.left.upDegrees*Al,a=i.left.downDegrees*Al,l=2/((e=i.left.leftDegrees*Al)+(t=i.left.rightDegrees*Al)),u=2/(s+a);return o.left[0]=l,o.left[1]=0,o.left[2]=0,o.left[3]=0,o.left[4]=0,o.left[5]=u,o.left[6]=0,o.left[7]=0,o.left[8]=-(e-t)*l*.5,o.left[9]=(s-a)*u*.5,o.left[10]=n/(r-n),o.left[11]=-1,o.left[12]=0,o.left[13]=0,o.left[14]=n*r/(r-n),o.left[15]=0,s=i.right.upDegrees*Al,a=i.right.downDegrees*Al,l=2/((e=i.right.leftDegrees*Al)+(t=i.right.rightDegrees*Al)),u=2/(s+a),o.right[0]=l,o.right[1]=0,o.right[2]=0,o.right[3]=0,o.right[4]=0,o.right[5]=u,o.right[6]=0,o.right[7]=0,o.right[8]=-(e-t)*l*.5,o.right[9]=(s-a)*u*.5,o.right[10]=n/(r-n),o.right[11]=-1,o.right[12]=0,o.right[13]=0,o.right[14]=n*r/(r-n),o.right[15]=0,o},t.prototype.getEyeFieldOfView=function(){var e=this.viewer,t=this.device,i=new Ll(e.distortionCoefficients),r=e.screenLensDistance,n=(t.widthMeters-e.interLensDistance)/2,o=e.interLensDistance/2,s=e.baselineLensDistance-t.bevelMeters,a=t.heightMeters-s,l=gl*Math.atan(i.distort(n/r)),u=gl*Math.atan(i.distort(o/r)),h=gl*Math.atan(i.distort(s/r)),c=gl*Math.atan(i.distort(a/r)),d=new Ol,p=new Ol;return d.leftDegrees=Math.min(l,e.fov),d.rightDegrees=Math.min(u,e.fov),d.downDegrees=Math.min(h,e.fov),d.upDegrees=Math.min(c,e.fov),p.leftDegrees=d.rightDegrees,p.rightDegrees=d.leftDegrees,p.upDegrees=d.upDegrees,p.downDegrees=d.downDegrees,{left:d,right:p}},t.prototype.onDeviceOrientation_=function(t){this._deviceOrientationQ=this._deviceOrientationQ||new e.Quaternion;var i=t.alpha,r=t.beta,n=t.gamma;i=(i||0)*Math.PI/180,r=(r||0)*Math.PI/180,n=(n||0)*Math.PI/180,this._deviceOrientationQ.setFromEuler(new e.Euler(i,r,-n,"YXZ"))},t.prototype.onDeviceMotion_=function(e){this.updateDeviceMotion_(e)},t.prototype.updateDeviceMotion_=function(e){var t=e.accelerationIncludingGravity,i=e.rotationRate,r=e.timeStamp/1e3,n=r-this.previousTimestampS;return n<0?(Cl("fusion-pose-sensor:invalid:non-monotonic","Invalid timestamps detected: non-monotonic timestamp from devicemotion"),void(this.previousTimestampS=r)):n<=.001||n>1?(Cl("fusion-pose-sensor:invalid:outside-threshold","Invalid timestamps detected: Timestamp from devicemotion outside expected range."),void(this.previousTimestampS=r)):(t&&(this.accelerometer.set(-t.x,-t.y,-t.z),i&&(El()?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,r)),this.filter.addAccelMeasurement(this.accelerometer,r)),void(this.previousTimestampS=r))},t.prototype.onOrientationChange_=function(){this.setScreenTransform_()},t.prototype.onMessage_=function(e){var t=e.data;t&&t.type&&"devicemotion"===t.type.toLowerCase()&&this.updateDeviceMotion_(t.deviceMotionEvent)},t.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 e.Vector3(0,0,1),-Math.PI/2);break;case-90:this.worldToScreenQ.setFromAxisAngle(new e.Vector3(0,0,1),Math.PI/2)}this.inverseWorldToScreenQ.copy(this.worldToScreenQ),this.inverseWorldToScreenQ.inverse()},t}(),Fl=[0,0,.5,1],Ql=[.5,0,.5,1],Vl=function(){function t(t){var i=this;this.renderer=t,this.sensor=new Nl(.98,.04,!1,!1),this.scale=1,this.cameraL=new e.PerspectiveCamera,this.cameraR=new e.PerspectiveCamera;var r=this.sensor.start();this.dispose=function(){var t=i.renderer.getSize(new e.Vector2);i.renderer.setScissor(0,0,t.width,t.height),i.renderer.setViewport(0,0,t.width,t.height),i.renderer.setScissorTest(!1),r()}}return t.prototype.render=function(t,i){var r=this.renderer.getSize(new e.Vector2);if(r.width>r.height){var n=t.autoUpdate;n&&(t.updateMatrixWorld(),t.autoUpdate=!1);var o={x:Math.round(r.width*Fl[0]),y:Math.round(r.height*Fl[1]),width:Math.round(r.width*Fl[2]),height:Math.round(r.height*Fl[3])},s={x:Math.round(r.width*Ql[0]),y:Math.round(r.height*Ql[1]),width:Math.round(r.width*Ql[2]),height:Math.round(r.height*Ql[3])};this.renderer.setScissorTest(!0),this.renderer.autoClear&&this.renderer.clear(),null===i.parent&&i.updateMatrixWorld(),i.matrixWorld.decompose(this.cameraL.position,this.cameraL.quaternion,this.cameraL.scale),i.matrixWorld.decompose(this.cameraR.position,this.cameraR.quaternion,this.cameraR.scale);var a=this.sensor.getEyeOffset();this.cameraL.translateOnAxis((new e.Vector3).fromArray(a.left),this.scale),this.cameraR.translateOnAxis((new e.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(t,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(t,this.cameraR),this.renderer.setViewport(0,0,r.width,r.height),this.renderer.setScissor(0,0,r.width,r.height),this.renderer.setScissorTest(!1),n&&(t.autoUpdate=!0)}else this.renderer.render(t,i)},t.prototype.dispose=function(){},t}(),Hl={zh:{TITLE:"眼镜模式",HIT:"请将手机横屏放入 VR 眼镜中"},en:{TITLE:"GLASSES MODE",HIT:"Please put the mobile phone horizontally into the VR glasses."},ja:{TITLE:"メガネモード",HIT:"携帯電話をVRメガネに水平に入れてください。"}},ql="undefined"!=typeof navigator&&null!==(Bl=Hl[navigator.language.split("-")[0]])&&void 0!==Bl?Bl:Hl.zh,zl="\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,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",");\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,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",');\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(ql.TITLE,'</div>\n <div class="$id-modal-content-hit">').concat(ql.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');var Ul=new e.CircleBufferGeometry(.12,16),jl=function(){var t=Oo(),i=new e.Texture;return t.onload=function(){if("undefined"!=typeof document){var e=256,r=document.createElement("canvas");r.setAttribute("width",String(e)),r.setAttribute("height",String(e));var n=r.getContext("2d");if(n){n.drawImage(t,0,0,e,e),n.globalCompositeOperation="source-out";n.beginPath(),n.lineWidth=6.4,n.arc(128,128,83.2,0,2*Math.PI),n.strokeStyle="rgba(255, 255, 255, 1.0)",n.closePath(),n.stroke(),i.image=r,i.needsUpdate=!0}}},t.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAR9JREFUOBF10kFOAzEMBdCZFhCbrrgAN+NqHIULsWKDKO3gF+VHoZpa+rXjfH87nq7btr0ty3KZ8FsxnHeQPL748lA/x0Jsq+AwYe0X8nDtGA33BEJUHIEKW/EorHOLI7BHNlkEbju38YkQAIRZxFkHz2HOirKDxNcIzG+fu/6oLiNmqc5ZrlwTeKyAgJF14tMZmSn87pBrxeX/CRABgk/dl1s+C18dio2Pp9nmCQru2UtdvN+7lI9AFsgb3zNMcSp8FF4LYs3UhLfOAvkDJffci8q1J/ByRLKnQ8gUJUFOd2SeZYliCxwiyJCxCbhUGFKF4zPm61hiq7sVyJnPmATyR5IzLSNyDNEFRCDnkAmA8U2RfCsIefYhDeKOQLv7A+l1ZTyjymNxAAAAAElFTkSuQmCC",i}(),Kl=function(){if("undefined"!=typeof document){var t=document.createElement("canvas");t.setAttribute("width",String(512)),t.setAttribute("height",String(512));var i=t.getContext("2d");if(i){var r=256;return i.beginPath(),i.arc(r,r,192,0,2*Math.PI),i.fillStyle="rgba(255, 255, 255, 0.1)",i.closePath(),i.fill(),i.save(),i.beginPath(),i.arc(r,r,192,0,2*Math.PI),i.strokeStyle="rgba(255, 255, 255, 0.5)",i.lineWidth=10.24,i.closePath(),i.stroke(),new e.CanvasTexture(t)}}return null}(),_l=function(){if("undefined"!=typeof document){var t=document.createElement("canvas");t.setAttribute("width",String(512)),t.setAttribute("height",String(512));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 n=i.createRadialGradient(r,r,0,r,r,r);n.addColorStop(0,"rgba(255, 255, 255, 0.0)"),n.addColorStop(.5,"rgba(255, 255, 255, 0.0)"),n.addColorStop(1,"rgba(255, 255, 255, 0.2)"),i.fillStyle=n,i.fill(),i.lineWidth=4.8,i.arc(r,r,187.2,0,2*Math.PI);var o=i.createLinearGradient(0,0,0,512);return o.addColorStop(.02,"rgba(255, 255, 255, 1.0)"),o.addColorStop(.2,"rgba(255, 255, 255, 0.0)"),o.addColorStop(.8,"rgba(255, 255, 255, 0.0)"),o.addColorStop(.98,"rgba(255, 255, 255, 1.0)"),i.strokeStyle=o,i.stroke(),new e.CanvasTexture(t)}}return null}(),Gl=function(){if("undefined"!=typeof document){var t=document.createElement("canvas");t.setAttribute("width",String(512)),t.setAttribute("height",String(512));var i=t.getContext("2d");if(i){var r=256,n=179.2;i.arc(r,r,n,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,n,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.5)"),i.fillStyle=o,i.fill(),i.lineWidth=4.8,i.arc(r,r,n-4.8,0,2*Math.PI);var s=i.createLinearGradient(0,0,0,512);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 e.CanvasTexture(t)}}return null}(),Wl=function(){if("undefined"!=typeof document){var t=document.createElement("canvas");t.setAttribute("width",String(512)),t.setAttribute("height",String(512));var i=t.getContext("2d");if(i){var r=256;i.lineWidth=64,i.arc(r,r,217.6,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=64,i.arc(r,r,217.6,0,2*Math.PI);var n=i.createRadialGradient(r,r,185.6,r,r,249.6);n.addColorStop(0,"rgba(255, 255, 255, 0.5)"),n.addColorStop(.3,"rgba(255, 255, 255, 0.0)"),n.addColorStop(.7,"rgba(255, 255, 255, 0.0)"),n.addColorStop(1,"rgba(255, 255, 255, 0.5)"),i.strokeStyle=n,i.stroke(),i.beginPath(),i.lineWidth=4,i.arc(r,r,245.6,0,2*Math.PI);var o=i.createLinearGradient(0,0,512,0);return o.addColorStop(.02,"rgba(255, 255, 255, 1.0)"),o.addColorStop(.1,"rgba(255, 255, 255, 0.0)"),o.addColorStop(.9,"rgba(255, 255, 255, 0.0)"),o.addColorStop(.98,"rgba(255, 255, 255, 1.0)"),i.strokeStyle=o,i.stroke(),new e.CanvasTexture(t)}}return null}(),Xl=function(t){function i(){var i=t.call(this)||this;i.progress=0,i.opacity=0,i.loading=!1,i.current=!1,i.disabled=!1,i.opacityMotion=new Vo({opacity:0}),i.loadingMotion=new Vo({opacity:0}),i.currentMotion=new Vo({ringScale:1.1,ringOpacity:0,circleFade:0,circleOpacity:.5,circleScale:1});var r={blending:e.CustomBlending,blendSrc:e.SrcAlphaFactor,blendDst:e.OneMinusSrcAlphaFactor,blendSrcAlpha:e.OneFactor,blendDstAlpha:e.OneMinusSrcAlphaFactor,depthWrite:!1,transparent:!0};return i.hitTestMesh=new e.Mesh(Ul,new e.MeshBasicMaterial(Ne(Ne({},r),{color:0,opacity:0}))),i.hitTestMesh.scale.set(1.5,1.5,1.5),i.centerMesh=new e.Mesh(Ul,new e.MeshBasicMaterial(Ne(Ne({},r),{map:_l,opacity:0}))),i.centerMesh2=new e.Mesh(Ul,new e.MeshBasicMaterial(Ne(Ne({},r),{map:Gl,opacity:0}))),i.ringMesh=new e.Mesh(Ul,new e.MeshBasicMaterial(Ne(Ne({},r),{map:Wl,opacity:0}))),i.loadingMesh=new e.Mesh(Ul,new e.MeshBasicMaterial(Ne(Ne({},r),{map:jl,opacity:.8}))),i.disableMesh=new e.Mesh(Ul,new e.MeshBasicMaterial(Ne(Ne({},r),{map:Kl}))),i.loadingMesh.visible=!1,i.disableMesh.visible=!1,i.hitTestMesh.position.z=0,i.ringMesh.position.z=.003,i.disableMesh.position.z=.002,i.centerMesh.position.z=.002,i.centerMesh2.position.z=.002,i.loadingMesh.position.z=.005,i.hitTestMesh.frustumCulled=!1,i.centerMesh.frustumCulled=!1,i.centerMesh2.frustumCulled=!1,i.ringMesh.frustumCulled=!1,i.loadingMesh.frustumCulled=!1,i.disableMesh.frustumCulled=!1,i.add(i.hitTestMesh),i.add(i.centerMesh),i.add(i.centerMesh2),i.add(i.ringMesh),i.add(i.loadingMesh),i.add(i.disableMesh),i.renderOrder=1e4,i.needsRender=!0,i}return Oe(i,t),i.prototype.setProgress=function(e){this.progress=e,this.setLoading(e>0)},i.prototype.setOpacity=function(e){this.opacity!==e&&(this.opacity=e=bo(e,0,1),this.opacityMotion.set({opacity:e},30).catch(ze))},i.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(ze)}else t=[{progress:0,value:Ne({},this.currentMotion.value)},{progress:1,value:{ringScale:1.1,ringOpacity:0,circleFade:0,circleOpacity:.5,circleScale:1}}],this.currentMotion.setKeyframes(t,200).catch(ze);this.current=e}},i.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)},i.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)},i.prototype.tap=function(){return Promise.resolve()},i.prototype.updateTime=function(e,t){this.opacityMotion.update(e),this.currentMotion.update(e),this.loadingMotion.update(e);var i=this.opacityMotion.value.opacity,r=this.currentMotion.value,n=r.ringScale,o=r.ringOpacity,s=r.circleFade,a=r.circleOpacity,l=r.circleScale;if(this.ringMesh.scale.set(n,n,n),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,h=1.1;this.centerMesh.scale.set(h,h,h),this.centerMesh2.scale.set(h,h,h),this.centerMesh.material.opacity=0*u,this.centerMesh2.material.opacity=.2*u}else this.loadingMesh.visible=!1;this.needsRender=!0},i.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()},i}(e.Object3D),Yl=function(t){function i(e){var r=this,n=i.parseArgs(e);(r=t.call(this,n)||this).cardboard=new Vl(r.renderer);var o,s,a,l=(s=function(e){for(var t=1,i=document.getElementsByTagName("meta"),r=0;r<i.length;r++){var n=i[r];if("viewport"===n.getAttribute("name")){var o=(n.getAttribute("content")||"").match(/initial\-scale\=([\d|\.]+)/);o&&(t=Number(o[1])),isNaN(t)&&(t=1)}}return zl.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))}))}(o="five_vr_helper_"+$n()),(a=document.createElement("div")).className=o,a.innerHTML=s,a);r.helperElement=l;var u=new ga(l);return r.element.parentNode&&(r.element.parentNode.insertBefore(l,r.element),r.setHelperElementSize(),u.on("tap",(function(){return r.emit("vrWantsToExit")}))),r.destroyHelper=function(){u.destroy(),l.parentNode&&l.parentNode.removeChild(l),delete r.helperElement},r.boundingMesh.visible=!0,r}return Oe(i,t),i.parseArgs=function(e){var i=Ne(Ne({},e),{maxLatitude:Math.PI/2,minLatitude:-Math.PI/2});return t.parseArgs.call(this,i)},i.initAnimationEndPose=function(e){var i=this.parseArgs(e);return t.initAnimationEndPose.call(this,i)},i.prototype.destroy=function(){t.prototype.destroy.call(this),this.cardboard.dispose(),this.destroyHelper();for(var e=0,i=this.panoMeshes;e<i.length;e++){var r=i[e];this.helper.remove(r),r.dispose()}this.panoMeshes.length=0},i.prototype.isReady=function(){return!1},i.prototype.updateRenderSize=function(){this.needsRender=!0,this.setHelperElementSize()},i.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],r=new Xl;r.name="panoSphere_".concat(this.work.workCode,"_").concat(t),r.position.copy(i.position),r.needsRender=!0,this.helper.add(r),this.panoMeshes[t]=r}},i.prototype.updateTime=function(t,i){for(var r,n,o=[],s=2;s<arguments.length;s++)o[s-2]=arguments[s];if(!this.destroyed){this.needsRender=!0;var a={},l={};if(!1===this.locationMotion.ended){this.locationMotion.update(t);var u=this.locationMotion.getKeyFrameSegment(t),h=u[0],c=u[1],d=this.panoResourceFromLocationMotionKeyframe(h),p=this.panoResourceFromLocationMotionKeyframe(c),f=this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[0]),A=this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[this.locationMotion.keyframes.length-1]),g=d.position,m=p.position,v=this.locationMotion.value.count-c.value.count+1;a.modelAlpha=this.locationMotion.value.modelAlpha,this.camera.perspToOrtho.setScalar(bo(this.locationMotion.value.perspToOrtho,0,1)),this.camera.orthoDistance=this.locationMotion.value.orthoDistance,a.useBlackTransition="instant"===p.effect,p.panoPicture&&(v<1?d.panoPicture&&(a.pano0=d.panoPicture):a.pano0=p.panoPicture,a.pano1=p.panoPicture),"fade"===p.effect&&(a.pano0&&d.panoPicture&&(a.pano0={map:a.pano0.map,luminanceMap:a.pano0.luminanceMap,matrix:d.panoPicture.matrix.clone().setPosition(p.position)}),g.copy(m)),a.progress=v,l.distance=this.locationMotion.value.distance,l.offset=new e.Vector3(g.x+(m.x-g.x)*v,g.y+(m.y-g.y)*v,g.z+(m.z-g.z)*v);for(var y=[],b=[],x=0,w=this.locationMotion.keyframes;x<w.length;x++){var E=w[x],M=E.key,S=E.progress;void 0!==M&&(y.push(M),S>=this.locationMotion.progress&&b.push(M))}for(var C=0,I=Object.keys(this.panoResources);C<I.length;C++){var B=I[C];if(!(b.indexOf(B)>=0)){var T=this.panoResources[B];if(T.panoPicture){var P=T.panoPicture.map;if(P){if(P===(null===(r=a.pano0)||void 0===r?void 0:r.map))continue;if(P===(null===(n=a.pano1)||void 0===n?void 0:n.map))continue;P.dispose(),T.panoPicture=null}}y.indexOf(B)>=0||delete this.panoResources[B]}}this.currentPanoIndex=v<.5?d.panoIndex:p.panoIndex,this.emit("movingToPano",A.panoIndex,f.panoIndex,this.locationMotion.progress)}!1===pa(a)&&(this.model.setMaterial(a),this.boundingMesh.setMaterial(a)),l.offset&&this.camera.position.copy(l.offset);var R=this.camera.pose.longitude,k=this.camera.pose.latitude;this.camera.quaternion.fromArray(this.cardboard.sensor.getOrientation()),this.camera.updateMatrixWorld(),this.camera.computePose();for(var L=this.work.observers[this.currentPanoIndex].visibleNodes.concat(this.currentPanoIndex),D=0;D<this.work.observers.length;D++){var O=this.work.observers[D];if((Q=this.panoMeshes[D]).visible=!0,O.loadable||O.active){if(-1===L.indexOf(D))Q.visible=!1;else{Q.visible=!0;var N=Q.position.clone().setY(this.camera.position.y).distanceTo(this.camera.position);N<.05?Q.setOpacity(0):Q.setOpacity(bo(1.5/N,0,1)),this.currentPanoIndex===D&&Q.setOpacity(0)}Q.lookAt(this.camera.position)}else Q.visible=!0}var F=this.intersect(t);for(D=0;D<this.work.observers.length;D++)null==(Q=this.panoMeshes[D])||Q.setCurrent(Q===F);for(D=0;D<this.work.observers.length;D++){var Q;(Q=this.panoMeshes[D])&&Q.updateTime&&Q.updateTime(t,i)}R===this.camera.pose.longitude&&k===this.camera.pose.latitude||(this.cameraMotion.set(kt(this.camera.pose,["longitude","latitude"]),0).catch(ze),this.emit("cameraDirectionUpdate",kt(this.camera.pose,["longitude","latitude"]),!0),this.emit("cameraUpdate",fa(kt(this.camera.pose,["longitude","latitude","fov","offset","distance"])),!0))}},i.prototype.render=function(){this.cardboard.render(this.scene,this.camera)},i.prototype.setCamera=function(e){void 0===e&&(e={})},i.prototype.destroyHelper=function(){},i.prototype.setHelperElementSize=function(){if(this.helperElement){var t=new e.Vector2(this.element.offsetWidth,this.element.offsetHeight),i=t.x*this.scissor.left,r=t.y*(1-this.scissor.bottom-this.scissor.height),n=t.x*this.scissor.width,o=t.y*this.scissor.height;this.helperElement.style.marginLeft=i+"px",this.helperElement.style.marginTop=r+"px",this.helperElement.style.width=n+"px",this.helperElement.style.height=o+"px"}},i.prototype.intersect=function(t){var i;if(!1===this.locationMotion.ended)return this.intersectMesh.visible=!1,delete this.activePanoMesh,void delete this.activeTime;if(this.activePanoMesh&&this.activeTime&&t-this.activeTime>1500){var r=this.activePanoMesh;return(u=this.panoMeshes.indexOf(r))>=0&&this.moveToPano(u,{},!0),delete this.activePanoMesh,delete this.activeTime,r}for(var n=this.camera.getWorldDirection(new e.Vector3),o=new e.Raycaster(this.camera.position,n),s=void 0,a=[],l=this.work.observers[this.currentPanoIndex].visibleNodes,u=0;u<this.work.observers.length;u++){var h=this.panoMeshes[u];if(-1!==l.indexOf(u)){var c=o.intersectObject(null!==(i=h.hitTestMesh)&&void 0!==i?i:h,!0)[0];c&&a.push({panoMesh:h,intersection:c})}}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=t),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 e.Quaternion;f.setFromUnitVectors(new e.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},i.prototype.onPanGesture=function(){},i.prototype.onTapGesture=function(){},i.prototype.onPinchGesture=function(){},i.prototype.onMouseMove=function(){},i.prototype.onMouseOut=function(){},i}(fl),Zl=function(t){function i(e){var r,n,o=this,s=i.parseArgs(e);return(o=t.call(this,s)||this).currentPanoIndex=s.initial[0],o.locationMotion=new Vo({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!==(n=null===(r=o.model.getMaterial())||void 0===r?void 0:r.modelAlpha)&&void 0!==n?n:0,perspToOrtho:o.camera.perspToOrtho.x,orthoDistance:o.camera.orthoDistance}),o}return Oe(i,t),i.parseArgs=function(e){return t.parseArgs.call(this,e)},i.initAnimationEndPose=function(e){var i=this.parseArgs(e);return t.initAnimationEndPose.call(this,i)},i.prototype.destroy=function(){t.prototype.destroy.call(this),this.locationMotion.dispose()},i.prototype.isReady=function(){return!1!==this.locationMotion.ended&&t.prototype.isReady.call(this)},i.prototype.updateWork=function(e,t,i,r,n){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,n),!0},i.prototype.updateTime=function(t,i){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];if(!this.destroyed){var o={},s={};if(!this.locationMotion.ended){this.locationMotion.update(t),o.modelAlpha=this.locationMotion.value.modelAlpha,this.camera.perspToOrtho.setScalar(bo(this.locationMotion.value.perspToOrtho,0,1)),this.camera.orthoDistance=this.locationMotion.value.orthoDistance,s.distance=this.locationMotion.value.distance,s.offset=new e.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z);var a=new e.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z),l=da(this.work.observers,(function(e){return e.position.distanceTo(a)}));this.currentPanoIndex=this.work.observers.indexOf(l)}this.cameraMotion.ended||(this.cameraMotion.update(t),s.longitude=this.cameraMotion.value.longitude,s.latitude=this.cameraMotion.value.latitude,s.fov=this.cameraMotion.value.fov),pa(o)||this.model.setMaterial(o),pa(s)||this.setCamera(s)}},i.prototype.initAnimation=function(e,t,i,r){var n,o,s,a=this;this.destroyed||(this.pending=!1,this.userAction=r,this.moveToPano(e,{longitude:null!==(n=t.longitude)&&void 0!==n?n:this.defaultLongitude,latitude:bo(null!==(o=t.latitude)&&void 0!==o?o:this.defaultLatitude,this.minLatitude,this.maxLatitude),fov:bo(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)}},r))},i.prototype.getTargetPose=function(){var t=this.cameraMotion.getKeyFrameSegment(je())[1],i=this.locationMotion.getKeyFrameSegment(je())[1];return{longitude:t.value.longitude,latitude:t.value.latitude,fov:t.value.fov,offset:new e.Vector3(i.value.x,i.value.y,i.value.z),distance:i.value.distance}},i.prototype.moveToPano=function(e,t,i){void 0===t&&(t={});var r=this.work.observers[e];r&&this.moveToPosition(r.position,t,i)},i.prototype.moveToPosition=function(t,i,r){var n,o,s,a=this;void 0===i&&(i={}),this.userAction=r;for(var l=je(),u=new e.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z).distanceTo(t),h=this.locationMotion.getProgressVelocity(l),c=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;c+=Math.sqrt(Math.pow(v-f,2)+Math.pow(y-A,2)+Math.pow(b-g,2))}var x=0===u?0:h*c/u,w=this.calculateMovingDuration(i.duration,u),E={x:t.x,y:t.y,z:t.z,distance:0,modelAlpha:1,perspToOrtho:0,orthoDistance:1},M={longitude:i.longitude,latitude:i.latitude,fov:i.fov},S={longitude:null!==(n=M.longitude)&&void 0!==n?n: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:t.clone(),distance:0},C=da(this.work.observers,(function(e){return e.position.distanceTo(t)})),I=this.work.observers.indexOf(C);this.emit("moveToPano",I,this.userAction),i.moveStartCallback&&i.moveStartCallback(I,S),this.emit("panoWillArrive",I,S,this.userAction),this.cameraMotion.set(M,w).catch(ze),this.locationMotion.set(E,w,x).then((function(){var e=fa(a.camera.pose);i.moveEndCallback&&i.moveEndCallback(I,e),a.emit("panoArrived",I,e,a.userAction)}),(function(){i.moveCancelCallback&&i.moveCancelCallback(),a.emit("moveToPanoCanceled",I)}))},i.prototype.onTapGesture=function(t){var i=t.pointers.map((function(e){return kt(e,["x","y"])}));if(!this.emit("wantsGesture","tap",i,!0)){var r=this.relativeClientPosition(t.center),n=new e.Raycaster;if(n.setFromCamera(r,this.camera),!this.emit("wantsTapGesture",n,r,!0)){this.emit("gesture","tap",i,!0),this.emit("tapGesture",n,r,!0),this.interiaMovement=!1;var o=this.model.intersectRaycaster(n)[0];if(o&&o.face){var s=o.face.normal,a=o.point;if(new e.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),h=a.clone().sub(u);n.set(h,new e.Vector3(0,-1,0)),o=this.model.intersectRaycaster(n)[0]}}if(o){var c=o.point.clone(),d=da(this.work.observers.filter((function(e){return Math.abs(e.standingPosition.y-c.y)<1})),(function(e){return e.standingPosition.distanceTo(c)}));if(d)return c.y=d.position.y,void this.moveToPosition(c,{},!0)}this.cameraBounce()}}},i}(za);const Jl=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var i=113,r=126,n=0,o="";return arguments[n].split(o).map((function(e){return e.charCodeAt(n)>r?e:String.fromCharCode((e.charCodeAt(n)+i)%r)})).join(o)}("{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"),$l=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var i=113,r=126,n=0,o="";return arguments[n].split(o).map((function(e){return e.charCodeAt(n)>r?e:String.fromCharCode((e.charCodeAt(n)+i)%r)})).join(o)}("{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");var eu=Object.assign({opacity:new e.Uniform(1),scale:new e.Uniform(13.1),panoMap:new e.Uniform(null),panoDisplacementMap:new e.Uniform(null),panoPosition:new e.Uniform(new e.Vector3),panoMatrix:new e.Uniform(new e.Matrix4)},{emissive:new e.Uniform(new e.Color(0)),emissiveMap:new e.Uniform(null),specular:new e.Uniform(new e.Color(1118481)),specularMap:new e.Uniform(null),normalMap:new e.Uniform(null),bumpMap:new e.Uniform(null),shininess:new e.Uniform(30)},e.UniformsLib.common,e.UniformsLib.lights),tu=new e.SphereBufferGeometry(.01,128,128),iu=function(){function t(e){void 0===e&&(e={}),this.textureLoader=new li({allowHosts:this.allowHosts,requestProxy:this.requestProxy,networkSubscribe:this.networkSubscribe}),this.allowHosts=e.allowHosts,this.requestProxy=e.requestProxy,this.networkSubscribe=e.networkSubscribe}return t.prototype.setAllowHosts=function(e){this.allowHosts=e,this.textureLoader.setAllowHosts(e)},t.prototype.setRequestProxy=function(e){this.requestProxy=e,this.textureLoader.setRequestProxy(e)},t.prototype.setNetworkSubscribe=function(e){this.networkSubscribe=e,this.textureLoader.setNetworkSubscribe(e)},t.prototype.load=function(t,i,r,n,o,s,a,l,u){var h=[0,0],c=function(e,t){h[t]=e,l(.8*h[0]+.2*h[1])},d=[this.textureLoader.loadTexture(t,{imageURL:r,viaAjax:!0},void 0,void 0,(function(e){return c(e,1)}),u),this.textureLoader.loadCubeTexture(i,{imageURL:r,viaAjax:!0},void 0,void 0,(function(e){return c(e,0)}),u)];return Promise.all(d).then((function(t){var i=t[0],r=t[1],a=function(t,i,r,n){var o=new e.ShaderMaterial({side:e.BackSide,vertexShader:Jl,fragmentShader:$l,transparent:!0,uniforms:e.UniformsUtils.clone(eu)}),s=i;return s.needsUpdate=!0,s.minFilter=e.LinearFilter,s.magFilter=e.LinearFilter,t.needsUpdate=!0,t.minFilter=e.LinearFilter,t.magFilter=e.LinearFilter,o.uniforms.opacity.value=0,o.uniforms.panoMap.value=s,o.uniforms.panoDisplacementMap.value=t,o.uniforms.panoPosition.value=r,o.uniforms.panoMatrix.value=n,Object.assign(new e.Mesh(tu,o),{frustumCulled:!1,dispose:function(){this.material instanceof e.ShaderMaterial&&(this.material.uniforms.panoDisplacementMap.value.dispose(),this.material.uniforms.panoDisplacementMap.value=null,this.material.dispose())}})}(i.body,r.body,n,o),l={body:a,meta:Fe([i.meta],r.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(ze);return a(e),Promise.reject(e)}))},t}(),ru=new e.Vector3(-1,1,1),nu=function(t){function i(r){var n,o,s,a,l,u=this,h=i.parseArgs(r);return(u=t.call(this,h)||this).currentPanoIndex=h.initial[0],u.maxAccessibleDistance=h.maxAccessibleDistance,u.panoTapTriggerRadius=h.panoTapTriggerRadius,u.panoCircleMeshCreator=h.panoCircleMeshCreator,u.boundingMesh=u.generateBoundingMesh(),u.boundingMesh.setMaterial(u.model.getMaterial()||{}),u.boundingMesh.visible=!1,u.scene.add(u.boundingMesh),u.panoModelGroup=new e.Group,u.panoModelGroup.name="panoModels",u.scene.add(u.panoModelGroup),u.panoMeshes=[],u.updatePanoMeshes(),u.helper.remove(u.intersectMesh),u.locationMotion=new Vo({count:0,distance:u.camera.pose.distance,modelAlpha:null!==(o=null===(n=u.model.getMaterial())||void 0===n?void 0:n.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=$n()]={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 e.Matrix4,position:u.camera.pose.offset.clone(),effect:"fly"},u.depthTextureLoader=new iu({allowHosts:u.work.allowHosts,requestProxy:u.requestProxy,networkSubscribe:u.networkSubscribe}),u}return Oe(i,t),i.parseArgs=function(e){var i,r,n,o=t.parseArgs.call(this,e);return Ne(Ne({},o),{maxAccessibleDistance:null!==(i=e.maxAccessibleDistance)&&void 0!==i?i:5,panoTapTriggerRadius:null!==(r=e.panoTapTriggerRadius)&&void 0!==r?r:1,panoCircleMeshCreator:null!==(n=e.panoCircleMeshCreator)&&void 0!==n?n:function(){return new gs}})},i.initAnimationEndPose=function(e){var i=this.parseArgs(e);return t.initAnimationEndPose.call(this,i)},i.prototype.destroy=function(){var e,i=this;if(t.prototype.destroy.call(this),this.locationMotion.dispose(),delete this.pendingTextureTask,this.model&&(this.model.visible=!0),this.panoModelGroup){for(var r=0,n=this.panoModelGroup.children;r<n.length;r++){var o=n[r];"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!==(e=this.model.getMaterial())&&void 0!==e?e:{},a=s.pano0,l=s.pano1,u=0,h=Object.keys(this.panoResources);u<h.length;u++){var c=h[u],d=this.panoResources[c];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[c]}this.interiaMovement=!1},i.prototype.isReady=function(){return!1===this.locationMotion.ended&&t.prototype.isReady.call(this)},i.prototype.updateWork=function(e,t,i,r,n){this.userAction=n,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:r,longitude:i.longitude,latitude:i.latitude,fov:i.fov},n),!0},i.prototype.updateTime=function(t,i){for(var r,n,o,s=this,a=[],l=2;l<arguments.length;l++)a[l-2]=arguments[l];if(!this.destroyed){var u={},h={},c=this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[0]),d=this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[this.locationMotion.keyframes.length-1]),p=!1;if(!1===this.locationMotion.ended){this.locationMotion.update(t);var f=this.locationMotion.getKeyFrameSegment(t),A=f[0],g=f[1],m=this.panoResourceFromLocationMotionKeyframe(A),v=this.panoResourceFromLocationMotionKeyframe(g),y=(new e.Vector3).copy(m.position),b=(new e.Vector3).copy(v.position),x=this.locationMotion.value.count-g.value.count+1;u.progress=x,u.modelAlpha=this.locationMotion.value.modelAlpha,this.camera.perspToOrtho.setScalar(bo(this.locationMotion.value.perspToOrtho,0,1)),this.camera.orthoDistance=this.locationMotion.value.orthoDistance;for(var w=0,E=this.panoModelGroup.children;w<E.length;w++){var M=E[w];M.visible=M===m.panoModel||M===v.panoModel}m.panoModel&&(m.panoModel.material.uniforms.opacity.value=1-x,m.panoModel.material.depthTest=0!==x),v.panoModel&&(v.panoModel.material.uniforms.opacity.value=x,v.panoModel.material.depthTest=1!==x),v.panoModel&&(x<1?m.panoModel&&(u.pano0={map:m.panoModel.material.uniforms.panoMap.value,luminanceMap:null,matrix:m.matrix}):u.pano0={map:v.panoModel.material.uniforms.panoMap.value,luminanceMap:null,matrix:v.matrix},u.pano1={map:v.panoModel.material.uniforms.panoMap.value,luminanceMap:null,matrix:v.matrix}),p=u.useBlackTransition="instant"===v.effect||"montage"===v.effect,"fade"!==v.effect&&"montage"!==v.effect||(u.pano0&&(u.pano0={map:u.pano0.map,luminanceMap:null,matrix:m.matrix.clone().setPosition(v.position)}),y.copy(b)),h.distance=this.locationMotion.value.distance,h.offset=new e.Vector3(y.x+(b.x-y.x)*x,y.y+(b.y-y.y)*x,y.z+(b.z-y.z)*x);for(var S=[],C=[],I=0,B=this.locationMotion.keyframes;I<B.length;I++){var T=B[I],P=T.key,R=T.progress;void 0!==P&&(S.push(P),R>=this.locationMotion.progress&&C.push(P))}for(var k=0,L=Object.keys(this.panoResources);k<L.length;k++){var D=L[k];if(!(C.indexOf(D)>=0)){var O=this.panoResources[D];if(O.panoModel){if(O.panoModel.material.uniforms.panoMap.value===(null===(r=u.pano0)||void 0===r?void 0:r.map))continue;if(O.panoModel.material.uniforms.panoMap.value===(null===(n=u.pano1)||void 0===n?void 0:n.map))continue;this.panoModelGroup.remove(O.panoModel),O.panoModel.material.uniforms.panoMap.value.dispose(),O.panoModel.dispose(),delete O.panoModel}S.indexOf(D)>=0||delete this.panoResources[D]}}m.workCode===v.workCode?this.currentPanoIndex=x<.5?m.panoIndex:v.panoIndex:this.currentPanoIndex=v.panoIndex,this.emit("movingToPano",d.panoIndex,c.panoIndex,this.locationMotion.progress)}if(!1===this.cameraMotion.ended&&(this.cameraMotion.update(t),h.longitude=this.cameraMotion.value.longitude,h.latitude=this.cameraMotion.value.latitude,h.fov=this.cameraMotion.value.fov),!1===pa(u)&&(this.model.setMaterial(u),this.boundingMesh.setMaterial(u)),!1===pa(h)&&this.setCamera(h),this.camera.pose.distance>.1)for(var N=0;N<this.work.observers.length;N++)(z=this.panoMeshes[N])&&(z.visible=!1);else{var F=this.work.observers[this.currentPanoIndex];if(F){var Q=da(F.visibleNodes,(function(e){return F.standingPosition.distanceTo(s.work.observers[e].standingPosition)}),!0),V=Q[1];V=bo(V,3,1/0);var H=F.visibleNodes.concat(this.currentPanoIndex),q=this.getForwardPanoIndexOrNot();for(N=0;N<this.work.observers.length;N++){var z,U=this.work.observers[N];if(z=this.panoMeshes[N])if(U.loadable||U.active)if(-1!==H.indexOf(N))if(p)z.visible=!1,z.setOpacity(0);else{z.visible=!0;var j=z.position.clone().setY(this.camera.position.y).distanceTo(this.camera.position);z.setCurrent(!z.loading&&0===z.progress&&q===N),z.setOpacity(j<.01?0:bo(V/j*1.2,.75,.98)),z.updateTime&&z.updateTime(t,i)}else z.visible=!1,z.setOpacity(0);else z.visible=!1,z.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)}},i.prototype.getTargetPose=function(){var e=this.cameraMotion.getKeyFrameSegment(je())[1],t=this.locationMotion.getKeyFrameSegment(je())[1],i=this.panoResourceFromLocationMotionKeyframe(t),r=this.work.observers[i.panoIndex];return{longitude:e.value.longitude,latitude:e.value.latitude,fov:e.value.fov,offset:r?r.position.clone():this.camera.position.clone(),distance:0}},i.prototype.moveToPano=function(t,i,r){var n,o=this;void 0===i&&(i={});var s=this.work.observers[t].images.depth,a=Ne({key:"pano.".concat(t),basisLoaderInitialized:oi.isInitialized()},kt(this.imageOptions,["format","size","quality","sharpen","mappings"])),l=this.imageOptions.transform,u=this.work.observers[t].images,h=this.work.observers[t],c=h.position,d=h.quaternion,p=(new e.Matrix4).compose(c,d,new e.Vector3(-1,1,1)),f="pano:"+Ha(u);if(this.pendingTextureTask){if(this.pendingTextureTask.hash===f)return;var A=this.pendingTextureTask.panoIndex;null===(n=this.panoMeshes[A])||void 0===n||n.setProgress(0),this.emit("textureAbort",A,this.work.observers[A]),this.pendingTextureTask.onError(new Error("texture aborted"))}this.pending=!0,this.pendingTextureTask={panoIndex:t,hash:f,onLoad:function(e){o.pending=!1,o.destroyed?e.body.dispose():(e.body.name=f,o.emit("panoLoaded",t),o.doMoveToPano(t,e.body,i,r))},onError:function(e){o.pending=!1,i.moveCancelCallback&&i.moveCancelCallback(),o.emit("panoLoadError",e,t),o.emit("moveToPanoCanceled",t)}};var g=this.panoMeshes[t];g&&g.tap&&g.tap(),this.depthTextureLoader.load(s,u,{transform:l,options:a},c,p,(function(e){var i,r;(null===(i=o.pendingTextureTask)||void 0===i?void 0:i.hash)===f?(o.pendingTextureTask.onLoad(e),null===(r=o.panoMeshes[t])||void 0===r||r.setProgress(0),delete o.pendingTextureTask,o.emit("textureLoaded",t,o.work.observers[t],e.meta)):e.body.dispose()}),(function(e){var i,r;(null===(i=o.pendingTextureTask)||void 0===i?void 0:i.hash)===f&&(o.pendingTextureTask.onError(e),null===(r=o.panoMeshes[t])||void 0===r||r.setProgress(0),delete o.pendingTextureTask,o.emit("textureError",e,t,o.work.observers[t]),o.emit("error",e))}),(function(e){var i,r;o.emit("textureLoading",e,t,o.work.observers[t]),(null===(i=o.pendingTextureTask)||void 0===i?void 0:i.hash)===f&&(null===(r=o.panoMeshes[t])||void 0===r||r.setProgress(e))}),this.renderer),this.emit("textureStartLoad",t,this.work.observers[t])},i.prototype.initAnimation=function(e,t,i,r){var n,o,s,a=this;if(!this.destroyed){var l=!1;this.pending=!1,this.userAction=r,this.moveToPano(e,{longitude:null!==(n=t.longitude)&&void 0!==n?n:this.defaultLongitude,latitude:bo(null!==(o=t.latitude)&&void 0!==o?o:this.defaultLatitude,this.minLatitude,this.maxLatitude),fov:bo(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=fa(a.camera.pose);!1===l&&a.emit("initAnimationWillStart",a.currentPanoIndex,e,a.userAction),a.emit("initAnimationEnded",a.currentPanoIndex,e,a.userAction)}},r)}},i.prototype.panoResourceFromLocationMotionKeyframe=function(e){return this.panoResources[e.key]},i.prototype.locationMotionKeyframesLength=function(e){for(var t=0,i=1;i<e.length;i++){var r=this.panoResourceFromLocationMotionKeyframe(e[i-1]).position,n=this.panoResourceFromLocationMotionKeyframe(e[i]).position;t+=r.distanceTo(n)*(e[i].value.count-e[i-1].value.count)}return t},i.prototype.updatePanoMeshes=function(){for(var e=this,t={},i=0,r=this.panoMeshes;i<r.length;i++)t[(p=r[i]).name]=p;this.panoMeshes.length=0;for(var n=1,o={},s=function(t){var i=da(t.accessibleNodes,(function(i){return bo(e.work.observers[i].standingPosition.distanceTo(t.standingPosition),1,1/0)}),!0),r=i[1];void 0===o[t.panoIndex]&&(o[t.panoIndex]=r)},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&&(n=bo(u.reduce((function(e,t){return e+t}),0)/u.length*.6,1,3));for(var h=0;h<this.work.observers.length;h++){var c="panoCircle_".concat(this.work.workCode,"_").concat(h),d=this.work.observers[h],p=void 0;t[c]?(!0===(p=t[c]).loading&&!1===d.loadable&&p.setLoading(!1),delete t[c]):((p=this.panoCircleMeshCreator()).name=c,this.helper.add(p)),p.scale.set(n,1,n),p.position.copy(d.standingPosition),this.panoMeshes[h]=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]}},i.prototype.generateBoundingMesh=function(t){void 0===t&&(t=!1);for(var i=this.model.bounding.clone(),r=0,n=this.work.observers;r<n.length;r++){var o=n[r];i.expandByPoint(o.standingPosition),i.expandByPoint((new e.Vector3).fromArray([o.position.x,2*o.position.y-o.standingPosition.y,o.position.z]))}t&&i.expandByPoint(this.camera.position);var s=ta(i,new e.Vector3(1,0,1));return s.name="panorama_bounding",s.frustumCulled=!1,s},i.prototype.doMoveToPano=function(t,i,r,n){var o,s,a,l,u=this;void 0===r&&(r={}),this.userAction=n;var h,c,d,p=je(),f=$n(),A=this.work.observers[t],g=this.panoResources[f]={panoIndex:t,workCode:this.work.workCode,effect:null!==(o=r.effect)&&void 0!==o?o:"fly",panoModel:i,matrix:(new e.Matrix4).compose(A.position,A.quaternion,ru),position:A.position.clone()};if(i.visible=!1,i.renderOrder=-1,this.panoModelGroup.add(i),this.locationMotion.ended){var m=this.locationMotion.getKeyFrameSegment(p),v=(m[0],m[1]),y=this.locationMotion.value,b=this.panoResourceFromLocationMotionKeyframe(v).position,x=g.position;h=Math.max(b.distanceTo(x),1),c=[{key:v.key,progress:0,value:Ne(Ne({},y),{count:0})},{key:f,progress:1,value:{distance:0,perspToOrtho:0,modelAlpha:0,orthoDistance:1,count:1}}],d=0}else{var w=this.locationMotion.getKeyFrameSegment(p),E=w[0],M=(v=w[1],y=this.locationMotion.value,this.panoResourceFromLocationMotionKeyframe(E).position),S=(b=this.panoResourceFromLocationMotionKeyframe(v).position,x=g.position,v.value.count-y.count),C=Math.max(M.distanceTo(b),1)*S;h=C+Math.max(b.distanceTo(x),1),c=[{key:E.key,progress:0,value:Ne({},y)},{key:v.key,progress:C/h,value:v.value},{key:f,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(c);d=0===I||0===I?0:this.locationMotion.getProgressVelocity(p)*I/B}var T=this.calculateMovingDuration(r.duration,"fade"===r.effect||"montage"===r.effect?0:h),P={longitude:r.longitude,latitude:r.latitude,fov:r.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:A.position.clone(),distance:this.camera.pose.distance};r.moveStartCallback&&r.moveStartCallback(t,R),this.emit("panoWillArrive",t,R,this.userAction),this.cameraMotion.set(P,T).catch(ze),this.locationMotion.setKeyframes(c,T,d).then((function(){var e={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};r.moveEndCallback&&r.moveEndCallback(t,e),u.emit("panoArrived",t,e,n)}),(function(){r.moveCancelCallback&&r.moveCancelCallback(),u.emit("moveToPanoCanceled",t)}))},i.prototype.getForwardPanoIndexOrNot=function(t){var i=this,r=this.camera.getWorldDirection(new e.Vector3),n=this.camera.position.clone(),o=this.work.observers[this.currentPanoIndex];if(!o)return null;var s=o.accessibleNodes.filter((function(t){if(t===i.currentPanoIndex)return!1;var r=i.work.observers[t],o=r.standingPosition.clone().sub(n);return 0!==o.length()&&!(o.angleTo(new e.Vector3(0,-1,0))<Math.PI/12)&&(r.loadable||r.active)})),a=(t?t.ray.direction.clone():r.clone()).setY(0);if(0===a.length())return null;for(var l=s.slice().sort((function(e,t){var r=i.work.observers[e].position.clone().setY(n.y),o=i.work.observers[t].position.clone().setY(n.y);return r.distanceTo(n)-o.distanceTo(n)})),u=0,h=[Math.PI/8,Math.PI/6,Math.PI/4,Math.PI/3];u<h.length;u++)for(var c=h[u],d=0,p=l;d<p.length;d++){var f=p[d],A=this.work.observers[f].position.clone().setY(n.y).sub(n);if(0!==A.length()&&a.angleTo(A)<c)return f}return null},i.prototype.onTapGesture=function(t){var i=this,r=t.pointers.map((function(e){return kt(e,["x","y"])}));if(!this.emit("wantsGesture","tap",r,!0)){var n=this.relativeClientPosition(t.center),o=new e.Raycaster;if(o.setFromCamera(n,this.camera),!this.emit("wantsTapGesture",o,n,!0)){this.emit("gesture","tap",r,!0),this.emit("tapGesture",o,n,!0),this.interiaMovement=!1;var s=this.camera.getWorldDirection(new e.Vector3).setY(0),a=null,l=this.work.observers[this.currentPanoIndex];if(l){var u=l.accessibleNodes.filter((function(e){if(e===i.currentPanoIndex)return!1;var t=i.work.observers[e];return!(t.position.distanceTo(i.camera.position)>i.maxAccessibleDistance)&&(t.loadable||t.active)})),h=o.intersectObject(this.boundingMesh,!0)[0];if(h){var c=da(u,(function(e){var t=i.work.observers[e].standingPosition.clone();return t.clone().sub(i.camera.position).setY(0).angleTo(s)>Math.PI/2?1/0:t.distanceTo(h.point)}),!0),d=c[0];c[1]<this.panoTapTriggerRadius&&(a=d)}fo(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),fo(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 e.Vector3(0,1,0),w=m.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=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):E.angleTo(P)<y?S.push(P):M.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=bo(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))}}}}},i}(za),ou=90;function su(t,i){var r=new e.Vector3;return r.setFromMatrixColumn(i,0),r.multiplyScalar(-t),r}function au(t,i,r){var n=new e.Vector3;return n.setFromMatrixColumn(r,0),n.crossVectors(i,n),n.multiplyScalar(t),n}var lu=function(t){function i(e){var r,n,o=this,s=i.parseArgs(e);return(o=t.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 Vo({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!==(n=null===(r=o.model.getMaterial())||void 0===r?void 0:r.modelAlpha)&&void 0!==n?n:0,perspToOrtho:o.camera.perspToOrtho.x,orthoDistance:o.camera.orthoDistance}),o}return Oe(i,t),i.parseArgs=function(e){var i,r,n,o,s,a,l,u=t.parseArgs.call(this,e);return Ne(Ne({},u),{defaultLongitude:null!==(i=e.defaultLongitude)&&void 0!==i?i:Math.PI/4,defaultLatitude:null!==(r=e.defaultLatitude)&&void 0!==r?r:Math.PI/4,defaultDistance:null!==(n=e.defaultDistance)&&void 0!==n?n:100,maxLatitude:null!==(o=e.maxLatitude)&&void 0!==o?o:+Math.PI/2,minLatitude:null!==(s=e.minLatitude)&&void 0!==s?s:0,maxDistance:null!==(a=e.maxDistance)&&void 0!==a?a:100,minDistance:null!==(l=e.minDistance)&&void 0!==l?l:2})},i.distanceFromModel=function(e,t,i){var r=e.bounding,n=Math.pow(Math.pow(r.max.x-r.min.x+1,2)+Math.pow(r.max.y-r.min.y+1,2)+Math.pow(r.max.z-r.min.z+1,2),.5),o=n/2/Math.tan(Math.PI*t/360);return i<1&&(o/=i),isNaN(o)?n:o},i.initAnimationEndPose=function(e){var t,r,n=this.parseArgs(e),o=e.initial[0],s=e.initial[1];return{longitude:null!==(t=s.longitude)&&void 0!==t?t:n.defaultLongitude,latitude:bo(null!==(r=s.latitude)&&void 0!==r?r:n.defaultLatitude,n.minLatitude,n.maxLatitude),fov:ou,offset:n.work.observers[o].position.clone(),distance:i.distanceFromModel(n.model,ou,n.camera.aspect)}},i.prototype.destroy=function(){t.prototype.destroy.call(this),this.model.enableTiles=!1,this.locationMotion.dispose(),this.mouseWheelState&&clearTimeout(this.mouseWheelState.timer),delete this.mouseWheelState,delete this.panState},i.prototype.isReady=function(){return!1!==this.locationMotion.ended&&t.prototype.isReady.call(this)},i.prototype.updateWork=function(e,t,i,r,n){return this.work=e,this.updateCamera(i,r,n),!0},i.prototype.updateModel=function(i){t.prototype.updateModel.call(this,i);var r=i.bounding.getCenter(new e.Vector3);this.locationMotion.set({x:r.x,y:r.y,z:r.z},0).catch(ze),this.model.enableTiles=!0},i.prototype.updateTime=function(t,i){if(!this.destroyed){var r={},n={};this.locationMotion.ended||(this.locationMotion.update(t),r.modelAlpha=this.locationMotion.value.modelAlpha,this.camera.perspToOrtho.setScalar(bo(this.locationMotion.value.perspToOrtho,0,1)),this.camera.orthoDistance=this.locationMotion.value.orthoDistance,n.distance=this.locationMotion.value.distance,n.offset=new e.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z)),this.cameraMotion.ended||(this.cameraMotion.update(t),n.longitude=this.cameraMotion.value.longitude,n.latitude=this.cameraMotion.value.latitude,n.fov=this.cameraMotion.value.fov),pa(r)||this.model.setMaterial(r),pa(n)||this.setCamera(n)}},i.prototype.setCamera=function(i){t.prototype.setCamera.call(this,i);var r=this.camera.pose.offset.clone();if(this.model.bvhs.loaded){var n=new e.Raycaster(this.camera.getWorldPosition(new e.Vector3),this.camera.getWorldDirection(new e.Vector3)),o=this.model.intersectRaycaster(n)[0];o&&r.copy(o.point)}var s=da(this.work.observers,(function(e){return e.position.distanceTo(r)})),a=this.work.observers.indexOf(s);a!==this.currentPanoIndex&&(this.emit("moveToPano",a,this.userAction),this.emit("panoWillArrive",a,fa(this.camera.pose),this.userAction),this.currentPanoIndex=a,this.emit("panoArrived",a,fa(this.camera.pose),this.userAction))},i.prototype.getTargetPose=function(){var t=this.cameraMotion.getKeyFrameSegment(je())[1],i=this.locationMotion.getKeyFrameSegment(je())[1];return{longitude:t.value.longitude,latitude:t.value.latitude,fov:t.value.fov,distance:i.value.distance,offset:new e.Vector3(i.value.x,i.value.y,i.value.z)}},i.prototype.initAnimation=function(t,r,n,o){var s,a,l=this;if(!this.destroyed){this.pending=!1,this.userAction=o;var u={longitude:null!==(s=r.longitude)&&void 0!==s?s:this.defaultLongitude,latitude:bo(null!==(a=r.latitude)&&void 0!==a?a:this.defaultLatitude,this.minLatitude,this.maxLatitude),fov:ou,offset:this.model.bounding.getCenter(new e.Vector3),distance:i.distanceFromModel(this.model,ou,this.camera.aspect)},h=kt(u,["longitude","latitude","fov"]),c={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",t,u,this.userAction),this.cameraMotion.set(h,n).catch(ze),this.locationMotion.set(c,n).then((function(){l.emit("initAnimationEnded",t,u,l.userAction)}),(function(e){var i=fa(l.camera.pose);l.emit("initAnimationEnded",t,i,l.userAction)})).then((function(){l.model.enableTiles=!0}))}},i.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 r=da(t,(function(e){return e.standingPosition.distanceTo(i.point)}),!0),n=r[0];return r[1]<5?this.work.observers.indexOf(n):null},i.prototype.coordinatesForOffset=function(t){var i=this.cameraMotion.value.fov,r=this.camera.aspect,n=this.renderer.getSize(new e.Vector2);return{longitude:2*t.x/(n.x*this.scissor.width)*i/95*r,latitude:-2*t.y/(n.y*this.scissor.height)*i/95}},i.prototype.onPanGesture=function(t){var i=this.panState,r=t.pointers.length;if(t.isFinal?delete this.panState:this.panState={pointerLength:r,x:t.center.x,y:t.center.y},void 0!==i&&i.pointerLength===r){var n=t.pointers.map((function(e){return kt(e,["x","y"])}));if(!this.emit("wantsGesture","pan",n,t.isFinal))if("mouse"===t.pointerType&&2===t.srcEvent.buttons){var o={x:t.center.x-i.x,y:t.center.y-i.y},s=new e.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z),a=this.model.bounding,l=a.getCenter(new e.Vector3),u={x:(a.max.x-a.min.x)/ou*this.cameraMotion.value.fov,y:(a.max.y-a.min.y)/ou*this.cameraMotion.value.fov,z:(a.max.z-a.min.z)/ou*this.cameraMotion.value.fov},h=(this.camera.position.y-a.min.y)*Math.tan(this.camera.fov/2*Math.PI/180),c=this.renderer.getSize(new e.Vector2);s.add(su(2*o.x*h/c.y,this.camera.matrix)),s.add(au(2*o.y*h/c.y,this.camera.up,this.camera.matrix)),s.x=bo(s.x,l.x-u.x,l.x+u.x),s.z=bo(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,t.isFinal))return;this.emit("gesture","pan",n,t.isFinal),this.emit("panGesture",d,t.isFinal),this.userAction=!0,this.locationMotion.set({x:s.x,y:s.y,z:s.z},0).catch(ze)}else{s={x:t.center.x-i.x,y:t.center.y-i.y};var p=this.coordinatesForOffset(s),f=na(this.cameraMotion.value.longitude+-1*p.longitude),A=bo(this.cameraMotion.value.latitude+-1*p.latitude,this.minLatitude,this.maxLatitude);if(this.camera.aspect<1&&Math.abs(t.overallVelocityX)>.2&&Math.atan2(Math.abs(t.overallVelocityY),Math.abs(t.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},this.emit("wantsPanGesture",d,t.isFinal))return;this.emit("gesture","pan",n,t.isFinal),this.emit("panGesture",d,t.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(ze),t.isFinal&&!this.emit("wantsInteriaPan",d)){this.interiaMovement=!0;var m=t.velocityX,v=.6*t.velocityY;Math.abs(v)>.5&&Math.abs(m)<.5&&(m=0)}}}},i.prototype.onPinchGesture=function(t){var i=this.pinchState||{},r=i.distance,n=(i.offsetY,!1);if("pinchstart"!==t.type){if("pinchend"===t.type&&(n=!0,delete this.pinchState),void 0!==r){this.pinchState={distance:r};var o=t.pointers.map((function(e){return kt(e,["x","y"])}));if(this.emit("wantsGesture","pinch",o,n))return;var s=bo(r/t.scale,this.minDistance,this.maxDistance);if(this.emit("wantsPinchGesture",t.scale,this.camera.pose.fov,n))return;this.emit("gesture","pinch",o,n),this.emit("pinchGesture",t.scale,this.camera.pose.fov,n),this.userAction=!0,this.locationMotion.set({distance:s},0).catch(ze)}var a=this.panState,l=t.pointers.length;if(t.isFinal?delete this.panState:this.panState={pointerLength:l,x:t.center.x,y:t.center.y},void 0!==a&&a.pointerLength===l){var u=t.pointers.map((function(e){return kt(e,["x","y"])}));if(!this.emit("wantsGesture","pinch",u,n)){var h=t.pointers.map((function(e){return kt(e,["x","y"])}));if(!this.emit("wantsGesture","pinch",h,n)){var c={x:t.center.x-a.x,y:t.center.y-a.y},d=new e.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z),p=this.model.bounding,f=p.getCenter(new e.Vector3),A={x:(p.max.x-p.min.x)/ou*this.cameraMotion.value.fov,y:(p.max.y-p.min.y)/ou*this.cameraMotion.value.fov,z:(p.max.z-p.min.z)/ou*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 e.Vector2);d.add(su(2*c.x*g/m.y,this.camera.matrix)),d.add(au(2*c.y*g/m.y,this.camera.up,this.camera.matrix)),d.x=bo(d.x,f.x-A.x,f.x+A.x),d.z=bo(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,t.isFinal)||(this.emit("gesture","pan",h,t.isFinal),this.emit("panGesture",v,t.isFinal),this.userAction=!0,this.locationMotion.set({x:d.x,y:d.y,z:d.z},0).catch(ze))}}}}else this.pinchState={distance:this.locationMotion.value.distance}},i.prototype.onMouseWheel=function(e){var t=this,i=(Math.abs(e.deltaY)>Math.abs(e.deltaX)?e.deltaY:e.deltaX)/-60,r=[{x:e.clientX,y:e.clientY,delta:i}];if(!this.emit("wantsGesture","mouseWheel",r,!1)){var n=bo(this.locationMotion.value.distance-i/2,this.minDistance,this.maxDistance);this.emit("wantsMouseWheel",i,this.camera.pose.fov,!1)||(this.emit("gesture","mouseWheel",r,!1),this.emit("mouseWheel",i,this.camera.pose.fov,!1),this.userAction=!0,this.locationMotion.set({distance:n},0).catch(ze),this.mouseWheelState&&clearTimeout(this.mouseWheelState.timer),this.mouseWheelState={timer:window.setTimeout((function(){delete t.mouseWheelState,t.emit("wantsGesture","mouseWheel",r,!0)||t.emit("wantsMouseWheel",i,t.camera.pose.fov,!0)||(t.emit("gesture","mouseWheel",r,!0),t.emit("mouseWheel",0,t.camera.pose.fov,!0))}),200)})}},i.prototype.onTapGesture=function(t){var i=t.pointers.map((function(e){return kt(e,["x","y"])}));if(!this.emit("wantsGesture","tap",i,!0)){var r=this.relativeClientPosition(t.center),n=new e.Raycaster;if(n.setFromCamera(r,this.camera),!this.emit("wantsTapGesture",n,r,!0)){this.emit("gesture","tap",i,!0),this.emit("tapGesture",n,r,!0),this.interiaMovement=!1;var o=this.getForwardPanoIndexOrNot(n);if(!fo(o)){this.emit("panoSelected",o);var s={longitude:this.camera.pose.longitude,latitude:0};this.emit("wantsMoveToPano",o,s,!0)}}}},i.prototype.onPressGesture=function(t,i){var r,n,o=[t];if(this.emit("wantsGesture","press",o,i))return null===(r=this.pressState)||void 0===r||r.stop(),void delete this.pressState;var s=this.relativeClientPosition(t),a=new e.Raycaster;if(a.setFromCamera(s,this.camera),this.emit("wantsPressGesture",a,s,t.delta,i))return null===(n=this.pressState)||void 0===n||n.stop(),void delete this.pressState;this.emit("gesture","press",o,i),this.emit("pressGesture",a,s,t.delta,i)},i}(Ca),uu={type:"move"},hu=function(){function t(){this._targetRay=null,this._grip=null,this._hand=null,this._axes=[0,0]}return t.prototype.getHandSpace=function(){return null===this._hand&&(this._hand=new e.Group,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand},t.prototype.getTargetRaySpace=function(){return null===this._targetRay&&(this._targetRay=new e.Group,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new e.Vector3,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new e.Vector3),this._targetRay},t.prototype.getGripSpace=function(){return null===this._grip&&(this._grip=new e.Group,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new e.Vector3,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new e.Vector3),this._grip},t.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},t.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},t.prototype.getAxes=function(){return this._axes},t.prototype.update=function(t,i,r){var n=null,o=null,s=null,a=this._targetRay,l=this._grip,u=this._hand;if(t&&t.gamepad&&t.gamepad.axes&&(this._axes=[t.gamepad.axes[2],t.gamepad.axes[3]]),t&&"visible-blurred"!==i.session.visibilityState)if(null!==a&&null!==(n=i.getPose(t.targetRaySpace,r))&&(a.matrix.fromArray(n.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),n.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(n.linearVelocity)):a.hasLinearVelocity=!1,n.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(n.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(uu)),u&&t.hand){s=!0;for(var h=0,c=t.hand.values();h<c.length;h++){var d=c[h],p=i.getJointPose(d,r);if(void 0===u.joints[d.jointName]){var f=new e.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:t.handedness,target:this})):!u.inputState.pinching&&v<=.015&&(u.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else null!==l&&t.gripSpace&&null!==(o=i.getPose(t.gripSpace,r))&&(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!==n),null!==l&&(l.visible=null!==o),null!==u&&(u.visible=null!==s),this},t}(),cu=function(t){function i(i,r,n){var o,s,a,l=this;return(l=t.call(this)||this).isPanorama=null===(o=null==n?void 0:n.isPanorama)||void 0===o||o,l.machineType=null!==(s=null==n?void 0:n.machineType)&&void 0!==s?s:"Pico",l.renderer=i,l.gl=r,l.enabled=!1,l.session=null,l.referenceSpaceType=null!==(a=null==n?void 0:n.referenceSpaceType)&&void 0!==a?a:"local-floor",l.referenceSpace=null,l.controllers=[new hu,new hu],l.inputSourcesMap=new Map,l.cameraVR=new e.ArrayCamera,l.cameraL=new e.PerspectiveCamera,l.cameraR=new e.PerspectiveCamera,l.cameraL.viewport=new e.Vector4,l.cameraR.viewport=new e.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 e.Vector3,l.cameraRPos=new e.Vector3,l}return Oe(i,t),i.prototype.getController=function(e){var t=this.controllers[e];return t||console.warn("no controller find"),t.getTargetRaySpace()},i.prototype.getCameras=function(){return{cameraL:this.cameraL,cameraR:this.cameraR,cameraVR:this.cameraVR}},i.prototype.updateCamera=function(e,t){null===t?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(t.matrixWorld,e.matrix),e.matrixWorldInverse.getInverse(e.matrixWorld)},i.prototype.setProjectionFromUnion=function(e,t,i){this.cameraLPos.setFromMatrixPosition(t.matrixWorld),this.cameraRPos.setFromMatrixPosition(i.matrixWorld);var r=this.cameraLPos.distanceTo(this.cameraRPos),n=t.projectionMatrix.elements,o=i.projectionMatrix.elements,s=n[14]/(n[10]-1),a=n[14]/(n[10]+1),l=(n[9]+1)/n[5],u=(n[9]-1)/n[5],h=(n[8]-1)/n[0],c=(o[8]+1)/o[0],d=s*h,p=s*c,f=r/(-h+c),A=f*-h;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+(r-A),b=l*a/m*g,x=u*a/m*g;e.projectionMatrix.makePerspective(v,y,b,x,g,m)},i.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 r=0;r<i.length;r++)this.updateCamera(i[r],t);e.matrixWorld.copy(this.cameraVR.matrixWorld);for(var n=e.children,o=(r=0,n.length);r<o;r++)n[r].updateMatrixWorld(!0);return 2===i.length?this.setProjectionFromUnion(this.cameraVR,this.cameraL,this.cameraR):this.cameraVR.projectionMatrix.copy(this.cameraL.projectionMatrix),this.cameraVR},i.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 r=e.removed[i];(n=this.inputSourcesMap.get(r))&&(n.dispatchEvent({type:"disconnected",data:r}),this.inputSourcesMap.delete(r))}for(i=0;i<e.added.length;i++){var n;r=e.added[i],(n=this.inputSourcesMap.get(r))&&n.dispatchEvent({type:"connected",data:r})}}else console.warn("session is lose!")},i.prototype.onSessionEvent=function(e){var t=this.inputSourcesMap.get(e.inputSource);t&&t.dispatchEvent({type:e.type})},i.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,ft.shared.setContext(null),this.emit("webXRSessionEnd")},i.prototype.onRequestReferenceSpace=function(e){this.referenceSpace=e,this.isPresenting=!0,this.emit("webXRSessionStart")},i.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!")}))}},i}(qe),du=["webXRSessionStart","webXRSessionEnd"],pu=function(t){function i(){var i=t.call(this)||this;return i.type="LineSegmentsGeometry",i.setIndex([0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5]),i.setAttribute("position",new e.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)),i.setAttribute("uv",new e.Float32BufferAttribute([-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],2)),i}return Oe(i,t),i.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},i.prototype.setPositions=function(t){var i;i=t instanceof Float32Array?t:Array.isArray(t)?new Float32Array(t):new Float32Array;var r=new e.InstancedInterleavedBuffer(i,6,1);return this.setAttribute("instanceStart",new e.InterleavedBufferAttribute(r,3,0)),this.setAttribute("instanceEnd",new e.InterleavedBufferAttribute(r,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this},i.prototype.setColors=function(t){var i;i=t instanceof Float32Array?t:Array.isArray(t)?new Float32Array(t):new Float32Array;var r=new e.InstancedInterleavedBuffer(i,6,1);return this.setAttribute("instanceColorStart",new e.InterleavedBufferAttribute(r,3,0)),this.setAttribute("instanceColorEnd",new e.InterleavedBufferAttribute(r,3,3)),this},i.prototype.fromWireframeGeometry=function(e){return this.setPositions(e.attributes.position.array),this},i.prototype.fromEdgesGeometry=function(e){return this.setPositions(e.attributes.position.array),this},i.prototype.fromMesh=function(t){return this.fromWireframeGeometry(new e.WireframeGeometry(t.geometry)),this},i.prototype.fromLineSegments=function(t){var i=t.geometry;if(i instanceof e.Geometry){var r=(new e.BufferGeometry).fromGeometry(i);this.setPositions(r.attributes.position.array)}else i instanceof e.BufferGeometry&&this.setPositions(i.attributes.position.array);return this},i.prototype.computeBoundingBox=function(){null===this.boundingBox&&(this.boundingBox=new e.Box3);var t=this.attributes.instanceStart,i=this.attributes.instanceEnd;if(void 0!==t&&void 0!==i){var r=new e.Box3;this.boundingBox.setFromBufferAttribute(t),r.setFromBufferAttribute(i),this.boundingBox.union(r)}},i.prototype.computeBoundingSphere=function(){null===this.boundingSphere&&(this.boundingSphere=new e.Sphere),null===this.boundingBox&&this.computeBoundingBox();var t=this.attributes.instanceStart,i=this.attributes.instanceEnd;if(void 0!==t&&void 0!==i){var r=this.boundingSphere.center;this.boundingBox.getCenter(r);for(var n=0,o=new e.Vector3,s=0,a=t.count;s<a;s++)o.fromBufferAttribute(t,s),n=Math.max(n,r.distanceToSquared(o)),o.fromBufferAttribute(i,s),n=Math.max(n,r.distanceToSquared(o));this.boundingSphere.radius=Math.sqrt(n),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}},i.prototype.toJSON=function(){},i}(e.InstancedBufferGeometry);Object.assign(pu.prototype,{isLineSegmentsGeometry:!0});var fu={uniforms:e.UniformsUtils.merge([e.UniformsLib.common,e.UniformsLib.fog,{linewidth:{value:1},resolution:{value:new e.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"},Au=function(t){function i(i){var r=t.call(this,{uniforms:e.UniformsUtils.clone(fu.uniforms),vertexShader:fu.vertexShader,fragmentShader:fu.fragmentShader,clipping:!0})||this;return r.type="LineMaterial",r.dashed=!1,Object.defineProperties(r,{color:{enumerable:!0,get:function(){return this.uniforms.diffuse.value},set:function(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)}}}),r.setValues(i),r}return Oe(i,t),i}(e.ShaderMaterial);Object.assign(Au.prototype,{isLineMaterial:!0});var gu=function(t){function i(e,i){var r=t.call(this)||this;return r.type="LineSegments2",r.geometry=void 0!==e?e:new pu,r.material=void 0!==i?i:new Au({color:16777215*Math.random()}),r}return Oe(i,t),i.prototype.computeLineDistances=function(){for(var t=this.geometry,i=t.attributes.instanceStart,r=t.attributes.instanceEnd,n=new Float32Array(2*i.count),o=new e.Vector3,s=new e.Vector3,a=0,l=0,u=i.count;a<u;a++,l+=2)o.fromBufferAttribute(i,a),s.fromBufferAttribute(r,a),n[l]=0===l?0:n[l-1],n[l+1]=n[l]+o.distanceTo(s);var h=new e.InstancedInterleavedBuffer(n,2,1);return t.setAttribute("instanceDistanceStart",new e.InterleavedBufferAttribute(h,1,0)),t.setAttribute("instanceDistanceEnd",new e.InterleavedBufferAttribute(h,1,1)),this},i.prototype.raycast=function(t,i){null===t.camera&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2.');var r=t.ray,n=t.camera,o=n.projectionMatrix,s=this.geometry,a=this.material,l=a.resolution,u=a.linewidth,h=s.attributes.instanceStart,c=s.attributes.instanceEnd,d=new e.Vector4,p=new e.Vector4,f=new e.Vector4,A=new e.Vector3,g=new e.Matrix4,m=new e.Line3,v=new e.Vector3;r.at(1,f),f.w=1,f.applyMatrix4(n.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(n.matrixWorldInverse,y);for(var b=0,x=h.count;b<x;b++){d.fromBufferAttribute(h,b),p.fromBufferAttribute(c,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,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,m.start.copy(d),m.start.z=0,m.end.copy(p),m.end.z=0;var M=m.closestPointToPointParameter(A,!0);m.at(M,v);var S=e.MathUtils.lerp(d.z,p.z,M),C=S>=-1&&S<=1,I=A.distanceTo(v)<.5*u;if(C&&I){m.start.fromBufferAttribute(h,b),m.end.fromBufferAttribute(c,b),m.start.applyMatrix4(y),m.end.applyMatrix4(y);var B=new e.Vector3,T=new e.Vector3;r.distanceSqToSegment(m.start,m.end,T,B),i.push({point:T,pointOnLine:B,distance:r.origin.distanceTo(T),object:this,faceIndex:b})}}}},i}(e.Mesh);Object.assign(gu.prototype,{isLineSegments2:!0});var mu=function(e){function t(t,i){var r=e.call(this,t,i)||this;return r.type="Line2",r}return Oe(t,e),t}(gu);Object.assign(mu.prototype,{isLine2:!0});var vu=function(t){function i(){var e=t.call(this)||this;return e.type="LineGeometry",e}return Oe(i,t),i.prototype.setPositions=function(e){for(var i=e.length-3,r=new Float32Array(2*i),n=0;n<i;n+=3)r[2*n]=e[n],r[2*n+1]=e[n+1],r[2*n+2]=e[n+2],r[2*n+3]=e[n+3],r[2*n+4]=e[n+4],r[2*n+5]=e[n+5];return t.prototype.setPositions.call(this,r),this},i.prototype.setColors=function(e){for(var i=e.length-3,r=new Float32Array(2*i),n=0;n<i;n+=3)r[2*n]=e[n],r[2*n+1]=e[n+1],r[2*n+2]=e[n+2],r[2*n+3]=e[n+3],r[2*n+4]=e[n+4],r[2*n+5]=e[n+5];return t.prototype.setColors.call(this,r),this},i.prototype.fromLine=function(t){var i=t.geometry;if(i instanceof e.Geometry){var r=(new e.BufferGeometry).fromGeometry(i);this.setPositions(r.attributes.position.array)}else i instanceof e.BufferGeometry&&this.setPositions(i.attributes.position.array);return this},i.prototype.copy=function(){return this},i}(pu);Object.assign(vu.prototype,{isLineGeometry:!0});var yu=14467195,bu=null,xu=function(t){function i(i,r){void 0===i&&(i=new e.Vector3),void 0===r&&(r=new e.Vector3);var n=t.call(this)||this;n.type="FiveLine",n.needsRender=!0;var o=new vu,s=new Au({color:yu,linewidth:2,dashScale:20,dashed:!1});n.line=new mu(o,s);var a=new e.BufferGeometry,l=new e.PointsMaterial({color:yu,size:8,map:bu||(bu=(new e.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 n.points=new e.Points(a,l),n.points.renderOrder=11,n.points.frustumCulled=!1,n.setPoints(i,r),n.add(n.line,n.points),n}return Oe(i,t),Object.defineProperty(i,"version",{get:function(){return"5.0.0-alpha.162"},enumerable:!1,configurable:!0}),i.prototype.setPoints=function(t,i){var r=[].concat(t.toArray(),i.toArray());this.points.geometry.setAttribute("position",new e.BufferAttribute(new Float32Array(r),3)),this.line.geometry.setPositions(r),this.line.computeLineDistances(),this.needsRender=!0},i.prototype.getPoints=function(){var t=this.points.geometry.attributes.position.array;return[new e.Vector3(t[0],t[1],t[2]),new e.Vector3(t[3],t[4],t[5])]},i.prototype.setMaterial=function(e){var t=this.line.material;for(var i in e)if(e.hasOwnProperty(i)){var r=e[i];"dashed"===i?(t.dashed=r,r?t.defines.USE_DASH="":delete t.defines.USE_DASH,t.needsUpdate=!0):t[i]=e[i]}this.needsRender=!0},i.prototype.setResolution=function(e,t){var i=this.line.material.resolution;i.x===e&&i.y===t||(i.set(e,t),this.needsRender=!0)},i}(e.Object3D);Object.assign(xu.prototype,{isFiveLine:!0});var wu=300,Eu=(new e.Matrix4).makeRotationAxis(new e.Vector3(0,1,0),Math.PI),Mu=new e.Vector3(-1,1,1),Su=function(t){function i(i){var r=t.call(this,i)||this;r.xrManager=new cu(r.renderer,r.renderer.getContext()),r.xrControllerRay=new e.Raycaster,r.pointerLine=new xu,r.scene.add(r.pointerLine),r.pointerLine.line.material.depthTest=!1,r.pointerLine.points.material instanceof Array?r.pointerLine.points.material.forEach((function(e){e.depthTest=!1})):r.pointerLine.points.material.depthTest=!1,r.pointerLine.setMaterial({color:new e.Vector3(1,1,1)}),r.boundingMesh.visible=!0,r.panoResources={},r.panoResources[r.locationMotion.keyframes[0].key=r.locationMotion.keyframes[1].key=$n()]={panoIndex:r.currentPanoIndex,workCode:r.work.workCode,leftPanoPicture:null,position:r.camera.pose.offset.clone(),effect:"fade"},r.parallaxCameraMatrixs=[];var n=ft.shared.getContext();if(!n)return console.error("获取session失败,请退出重试"),r;r.xrManager.setSession(n),r.on("webXRSelected",(function(e){"Select"===e&&r.checkSelectedPano()}));for(var o=function(e){s.xrManager.on(e,(function(){for(var t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];r.emit.apply(r,Fe([e],t,!1))}))},s=this,a=0,l=du;a<l.length;a++)o(l[a]);return r.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}},r}return Oe(i,t),i.parseArgs=function(e){var i=Ne(Ne({},e),{maxLatitude:Math.PI/2,minLatitude:-Math.PI/2});return t.parseArgs.call(this,i)},i.initAnimationEndPose=function(e){var i=this.parseArgs(e);return t.initAnimationEndPose.call(this,i)},i.prototype.moveToPano=function(t,i,r){var n,o,s,a,l=this,u=this.work.observers[t],h=this.imageOptions.size;if(void 0===h&&u){var c=u.images.up.match(/\/cube_(\d+)\//);c&&(h=Number(c[1]))}void 0===h&&(h=2048);var d=this.imageOptions.transform,p=function(e,t){return yt(e,d,t)},f=Ne({key:"pano.".concat(t),basisLoaderInitialized:oi.isInitialized()},kt(this.imageOptions,["format","size","quality"])),A=u.images,g=null!==(o=null===(n=u.images.tiles)||void 0===n?void 0:n.filter((function(e){return e.size>h})))&&void 0!==o?o:null,m="pano:"+Ha([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 E={panoIndex:t,workCode:this.work.workCode,effect:null!==(a=i.effect)&&void 0!==a?a:"fade",leftPanoPicture:{map:y.map,luminanceMap:y.luminanceMap,matrix:(new e.Matrix4).compose(u.position,u.quaternion,Mu)},position:u.position.clone()};this.doMoveToPano(t,E,i,r)}else this.pending=!0,this.pendingTextureTask={panoIndex:t,hash:m,onLoad:function(n){var o;if(l.pending=!1,l.destroyed)n.body.dispose();else{n.body.name=m;var s={panoIndex:t,workCode:l.work.workCode,effect:null!==(o=i.effect)&&void 0!==o?o:"fade",leftPanoPicture:{map:n.body,luminanceMap:null,matrix:(new e.Matrix4).compose(u.position,u.quaternion,Mu)},position:u.position.clone()};l.doMoveToPano(t,s,i,r)}},onError:function(e){l.pending=!1,i.moveCancelCallback&&i.moveCancelCallback(),l.emit("panoLoadError",e,t),l.emit("moveToPanoCanceled",t)}},Promise.all([this.tileLevelForFov&&g&&g.length?this.textureLoader.loadTiledCubeTexture(A,g,{tileMaxLevel:this.TILED_CUBE_TEXTURE_LEVEL,imageURL:{transform:p,options:f},format:e.RGBAFormat,viaAjax:!0},void 0,void 0,(function(e){var i,r;l.emit("textureLoading",e,t,u),(null===(i=l.pendingTextureTask)||void 0===i?void 0:i.hash)===m&&(null===(r=l.panoMeshes[t])||void 0===r||r.setProgress(e))}),this.renderer):this.textureLoader.loadCubeTexture(A,{imageURL:{transform:p,options:f},format:e.RGBAFormat},void 0,void 0,(function(e){var i,r;(null===(i=l.pendingTextureTask)||void 0===i?void 0:i.hash)===m&&(null===(r=l.panoMeshes[t])||void 0===r||r.setProgress(e)),l.emit("textureLoading",e,t,u)}),this.renderer)]).then((function(e){var i,r,n=e[0];(null===(i=l.pendingTextureTask)||void 0===i?void 0:i.hash)===m?(l.pendingTextureTask.onLoad(n),null===(r=l.panoMeshes[t])||void 0===r||r.setProgress(0),delete l.pendingTextureTask,l.emit("textureLoaded",t,u,n.meta)):n.body.dispose()})).catch((function(e){var i,r;(null===(i=l.pendingTextureTask)||void 0===i?void 0:i.hash)===m&&(l.pendingTextureTask.onError(e),null===(r=l.panoMeshes[t])||void 0===r||r.setProgress(0),delete l.pendingTextureTask,l.emit("textureError",e,t,u),l.emit("error",e))})),this.emit("textureStartLoad",t,u)},i.prototype.doMoveToPano=function(t,i,r,n){var o,s,a,l=this;void 0===r&&(r={}),this.userAction=n;var u,h,c,d=je(),p=$n();if(this.panoResources[p]=i,this.locationMotion.ended){var f=this.locationMotion.getKeyFrameSegment(d),A=(f[0],f[1]),g=this.locationMotion.value,m=this.panoResourceFromLocationMotionKeyframe(A).position,v=i.position;u=Math.max(m.distanceTo(v),1),h=[{key:A.key,progress:0,value:Ne(Ne({},g),{count:0})},{key:p,progress:1,value:{distance:0,perspToOrtho:0,orthoDistance:1,modelAlpha:0,count:1}}],c=0}else{var y=this.locationMotion.getKeyFrameSegment(d),b=y[0],x=(A=y[1],g=this.locationMotion.value,this.panoResourceFromLocationMotionKeyframe(b).position),w=(m=this.panoResourceFromLocationMotionKeyframe(A).position,v=i.position,A.value.count-g.count),E=Math.max(x.distanceTo(m),1)*w;u=E+Math.max(m.distanceTo(v),1),h=[{key:b.key,progress:0,value:Ne({},g)},{key:A.key,progress:E/u,value:A.value},{key:p,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(h);c=this.locationMotion.getProgressVelocity(d)*M/S}var C=this.calculateMovingDuration(r.duration,u),I={longitude:r.longitude,latitude:r.latitude,fov:r.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:i.position.clone(),distance:0};r.moveStartCallback&&r.moveStartCallback(t,B),this.emit("panoWillArrive",t,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=ze,this.videoTexture.needsUpdate=!0),this.panoVideo.setMaterial(null),this.cameraMotion.set(I,C).catch(ze),this.locationMotion.setKeyframes(h,C,c).then((function(){var i,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};r.moveEndCallback&&r.moveEndCallback(t,a),l.emit("panoArrived",t,a,n);var u=l.work.observers[l.currentPanoIndex];if(u&&u.video&&l.videoTexture&&l.videoTexture.image instanceof HTMLVideoElement){var h=Eu.clone().multiply(null!==(s=null===(o=null===(i=l.model.getMaterial())||void 0===i?void 0:i.pano1)||void 0===o?void 0:o.matrix)&&void 0!==s?s:new e.Matrix4).multiply(u.video.matrix),c={map:l.videoTexture,size:u.video.size,matrix:h,alpha:1},d=$n(),p=l.videoTexture.image;p.setAttribute("uuid",d),Ua().then((function(e){e&&u.video&&p.getAttribute("uuid")===d&&(p.oncanplay=function(){p.oncanplay=ze,p.play()},p.ontimeupdate=function(){p.currentTime>.5&&(p.ontimeupdate=ze,l.panoVideo.setMaterial(c))},p.src=u.video.source)})).catch((function(){p.removeAttribute("uuid")}))}}),(function(){r.moveCancelCallback&&r.moveCancelCallback(),l.emit("moveToPanoCanceled",t)}))},i.prototype.checkSelectedPano=function(){var t=this,i=this.xrControllerRay;this.interiaMovement=!1;var r=this.camera.getWorldDirection(new e.Vector3).setY(0),n=null,o=this.work.observers[this.currentPanoIndex];if(!o)return n;var s=o.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)})),a=this.model.intersectRaycaster(i)[0];if(a){var l=da(s,(function(e){var i=t.work.observers[e].standingPosition.clone();return i.clone().sub(t.camera.position).setY(0).angleTo(r)>Math.PI/2?1/0:i.distanceTo(a.point)}),!0),u=l[0];l[1]<this.panoTapTriggerRadius&&(n=u)}fo(n)&&(n=this.getForwardPanoIndexOrNot(i));for(var h=0,c=this.locationMotion.keyframes;h<c.length;h++){var d=c[h],p=this.panoResourceFromLocationMotionKeyframe(d);if(!(d.progress<this.locationMotion.progress)&&p.panoIndex===n){n=null;break}}if(this.emit("panoSelected",n),fo(n))return!0===this.locationMotion.ended&&this.cameraBounce(),n;var f=this.work.observers[n];if(!f.active)return this.panoMeshes[n]&&(this.panoMeshes[n].setDisabled(!1),this.panoMeshes[n].setLoading(!0)),n;for(var A={effect:"fade"},g=Math.PI/6,m=Math.PI/12,v=new e.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=[],E=[],M=[],S=0,C=f.accessibleNodes;S<C.length;S++)if((u=C[S])!==this.currentPanoIndex&&u!==n){var I=this.work.observers[u].position.clone().sub(f.position).setY(0);y.angleTo(I)<g?M.push(I):b.angleTo(I)<g?w.push(I):x.angleTo(I)<g&&E.push(I)}var B=(M.length>0?M:Fe(Fe([],w,!0),E,!0)).slice().sort((function(e,t){return e.angleTo(y)-t.angleTo(y)}))[0];return B&&B.angleTo(r)>m&&(A.longitude=Math.atan2(-B.x,-B.z)),this.cameraMotion.value.latitude<-Math.PI/4&&(A.latitude=bo(0,this.minLatitude,this.maxLatitude)),this.cameraMotion.value.fov<60&&(A.fov=this.defaultFov),this.emit("wantsMoveToPano",n,A,!0),n},i.prototype.destroy=function(){t.prototype.destroy.call(this)},i.prototype.isReady=function(){return!1},i.prototype.updateTime=function(t,i){for(var r,n,o,s,a,l,u,h,c=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(t);var y=this.locationMotion.getKeyFrameSegment(t),b=y[0],x=y[1],w=this.panoResourceFromLocationMotionKeyframe(b),E=this.panoResourceFromLocationMotionKeyframe(x),M=(new e.Vector3).copy(w.position),S=(new e.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(bo(this.locationMotion.value.perspToOrtho,0,1)),this.camera.orthoDistance=this.locationMotion.value.orthoDistance,E.leftPanoPicture&&(C<1?w.leftPanoPicture&&(f.pano0=w.leftPanoPicture):f.pano0=E.leftPanoPicture,f.pano1=E.leftPanoPicture),v=f.useBlackTransition="instant"===E.effect||"montage"===E.effect,"fade"!==E.effect&&"montage"!==E.effect||(f.pano0&&w.leftPanoPicture&&(f.pano0={map:f.pano0.map,luminanceMap:f.pano0.luminanceMap,matrix:w.leftPanoPicture.matrix.clone().setPosition(E.position)}),M.copy(S)),A.distance=this.locationMotion.value.distance,A.offset=new e.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],k=R.key,L=R.progress;void 0!==k&&(I.push(k),L>=this.locationMotion.progress&&B.push(k))}for(var D=0,O=Object.keys(this.panoResources);D<O.length;D++){var N=O[D];if(!(B.indexOf(N)>=0)){var F=this.panoResources[N];if(F.leftPanoPicture){var Q=F.leftPanoPicture.map;if(Q){if(Q===(null===(r=f.pano0)||void 0===r?void 0:r.map))continue;if(Q===(null===(n=f.pano1)||void 0===n?void 0:n.map))continue;Q instanceof ai&&Q.cubeRenderTarget&&this.colorCubeRenderTargetPool.push(Q.cubeRenderTarget),Q.dispose(),F.leftPanoPicture=null}}I.indexOf(N)>=0||delete this.panoResources[N]}}w.workCode===E.workCode?this.currentPanoIndex=C<.5?w.panoIndex:E.panoIndex:this.currentPanoIndex=E.panoIndex,this.emit("movingToPano",m.panoIndex,g.panoIndex,this.locationMotion.progress)}!1===this.cameraMotion.ended&&(this.cameraMotion.update(t),A.longitude=this.cameraMotion.value.longitude,A.latitude=this.cameraMotion.value.latitude,A.fov=this.cameraMotion.value.fov),!1===pa(f)&&((null===(o=f.pano0)||void 0===o?void 0:o.map)&&f.pano0.map instanceof ai&&!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 ai&&!f.pano1.map.cubeRenderTarget&&(f.pano1.map.cubeRenderTarget=this.colorCubeRenderTargetPool.pop()),this.model.setMaterial(f),this.boundingMesh.setMaterial(f)),!1===pa(A)&&this.setCamera(A),d[0];var V=d[1];if(V)if(this.xrManager.session){var H=this.xrManager.referenceSpace;if(H){var q=this.xrManager.cameraVR,z=this.xrManager.cameraL,U=this.xrManager.cameraR,j=[z,U],K=V.getViewerPose(H),_=new e.Vector3(0,0,0);if(K){var G=void 0;switch(this.xrManager.machineType){case"Pico":G=this.xrManager.session.renderState.baseLayer;break;case"Oculus":var W=this.xrManager.session.renderState.layers;W&&(G=W[0]);break;default:this.xrManager.machineType}var X=K.views;if(!G)return void console.error("no layer found");this.renderer.setFramebuffer(G.framebuffer);var Y=!1;X.length!==q.cameras.length&&(q.cameras.length=0,Y=!0),this.parallaxCameraMatrixs=[];var Z=new e.Vector3,J=new e.Vector3;(new e.Matrix4).fromArray(X[0].transform.matrix).decompose(Z,new e.Quaternion,new e.Vector3),(new e.Matrix4).fromArray(X[1].transform.matrix).decompose(J,new e.Quaternion,new e.Vector3),J.clone().sub(Z).normalize();var $=new e.Vector3,ee=new e.Quaternion,te=new e.Vector3;this.camera.matrix.decompose($,ee,te);for(var ie=0;ie<X.length;ie++){var re=X[ie],ne=G.getViewport(re),oe=j[ie];oe.matrix.fromArray(re.transform.matrix);var se=new e.Vector3,ae=new e.Quaternion,le=new e.Vector3;oe.matrix.decompose(se,ae,le),_.copy($),oe.position.copy($),oe.quaternion.copy(ae),oe.scale.copy(le),oe.updateMatrix(),oe.projectionMatrix.fromArray(re.projectionMatrix),oe.viewport.set(ne.x,ne.y,ne.width,ne.height),!0===Y&&q.cameras.push(oe)}}var ue=this.xrManager.session.inputSources;for(ie=0;ie<this.xrManager.controllers.length;ie++){var he=this.xrManager.controllers[ie],ce=ue[ie];he.update(ce,V,H)}var de=this.xrManager.getController(0),pe=de.position.clone().add(_).sub(new e.Vector3(0,1.35,0));this.xrControllerRay.set(pe,new e.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++)(Me=this.panoMeshes[be])&&(Me.visible=!1);else{var xe=this.work.observers[this.currentPanoIndex];if(xe){var we=xe.visibleNodes.concat(this.currentPanoIndex),Ee=this.getForwardPanoIndexOrNot();for(be=0;be<this.work.observers.length;be++){var Me,Se=this.work.observers[be];if(Me=this.panoMeshes[be])if(Se.loadable||Se.active)if(-1!==we.indexOf(be))if(v)Me.visible=!1,Me.setOpacity(0);else{Me.visible=!0;var Ce=Me.position.clone().setY(this.camera.position.y).distanceTo(this.camera.position);Me.setCurrent(Ee===be),Me.setOpacity(Ce<.01?0:bo(1.4/Ce,.5,.7)),Me.updateTime&&Me.updateTime(t,i)}else Me.visible=!1,Me.setOpacity(0);else Me.visible=!1,Me.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===c.tileLevelForFov)return 0;var t=new e.Vector2(4e3,4e3),i=m.panoIndex,r=c.work.observers[i],n=c.imageOptions.size;if(void 0===n&&r){var o=r.images.up.match(/\/cube_(\d+)\//);o&&(n=Number(o[1]))}void 0===n&&(n=2048);var s=0;n>=1024&&(s=1),n>=2048&&(s=2),n>=4096&&(s=3),n>=8192&&(s=4);var a=c.tileLevelForFov(z.fov,t);return a>s?a:0}(),Te=((Ie=new e.PerspectiveCamera).applyMatrix4(q.matrix),Ie.position.set(0,0,0),Ie.quaternion.premultiply(c.work.observers[m.panoIndex].quaternion.clone().inverse()),Ie.updateProjectionMatrix(),Ie.updateMatrixWorld(!0),(new e.Frustum).setFromProjectionMatrix((new e.Matrix4).multiplyMatrices(Ie.projectionMatrix,Ie.matrixWorldInverse)));m.panoIndex===this.currentPanoIndex&&(null===(l=m.leftPanoPicture)||void 0===l?void 0:l.map)instanceof ai&&(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,ke=this.work.observers[Re];ke&&Zs(this.camera.position,ke.position)&&this.locationMotion.ended?(this.tiling.object.visible=!0,this.tiling.panoIndex!==Re&&this.tiling.cleanup(),this.tiling.panoIndex=Re,this.tiling.setResource(null!==(h=null===(u=ke.images)||void 0===u?void 0:u.tiles)&&void 0!==h?h:[],this.enableIOSEDR&&ke.images.luminance?ke.images.luminance:null),this.tiling.setRotation(ke.quaternion),this.tiling.setPosition(ke.position),this.tiling.update(Te,Be,t)):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(t);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 De=t-this.xrControllerState.axes[2].left.startTime;De>=wu&&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=t-this.xrControllerState.axes[2].right.startTime;Oe>=wu&&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 Ne=t-this.xrControllerState.axes[3].up.startTime;Ne>=wu&&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 Fe=t-this.xrControllerState.axes[3].down.startTime;Fe>=wu&&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 Qe=t-this.xrControllerState.select.startTime;Qe>=wu&&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 Ve=t-this.xrControllerState.squeeze.startTime;Ve>=wu&&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=t-this.xrControllerState.leftButtonA.startTime;He>=wu&&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=t-this.xrControllerState.leftButtonB.startTime;qe>=wu&&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 ze=t-this.xrControllerState.rightButtonA.startTime;ze>=wu&&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 Ue=t-this.xrControllerState.rightButtonB.startTime;Ue>=wu&&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丢失,请重试")},i.prototype.render=function(){var e=this.xrManager.getCamera(this.camera);this.renderer.render(this.scene,e)},i.prototype.onPanGesture=function(){},i.prototype.onTapGesture=function(){},i.prototype.onPinchGesture=function(){},i.prototype.onMouseMove=function(){},i.prototype.onMouseOut=function(){},i.prototype.panoResourceFromLocationMotionKeyframe=function(e){return this.panoResources[e.key]},i}(fl),Cu=["Panorama","DepthPanorama","Model"],Iu={Floorplan:Ia,Topview:Qa,Panorama:fl,VRPanorama:Yl,Model:Zl,DepthPanorama:nu,Mapview:lu,XRPanorama:Su};function Bu(e){for(var t=0,i=Cu;t<i.length;t++){var r=i[t];if("string"==typeof e){if(r===e)return!0}else if(e instanceof Ca&&e instanceof Iu[r])return!0}return!1}var Tu=["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 Pu(e){for(var t,i,r={},n=0,o=e.split(/(\;|\,)/);n<o.length;n++){var s=o[n].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&&(r[a]=l)}return r}function Ru(){for(var e,t=document.getElementsByTagName("meta"),i=0;i<t.length;i++){var r=t[i];if("viewport"===r.getAttribute("name")){var n=Pu(null!==(e=r.getAttribute("content"))&&void 0!==e?e:""),o=Number(n["initial-scale"]);if(!isNaN(o))return o}}return 1}var ku=[351,63],Lu=[20,20],Du=new Float32Array([-.5,-.5,0,.5,-.5,0,-.5,.5,0,.5,.5,0]),Ou=new Float32Array([0,0,1,0,0,1,1,1]),Nu=new Uint8Array([0,1,2,1,3,2]),Fu=new e.BufferGeometry;Fu.setAttribute("position",new e.BufferAttribute(Du,3)),Fu.setAttribute("uv",new e.BufferAttribute(Ou,2)),Fu.setIndex(new e.BufferAttribute(Nu,1));var Qu=new e.MeshBasicMaterial({transparent:!0,depthTest:!1}),Vu=new e.Mesh(Fu,Qu),Hu=new e.Scene;Hu.add(Vu);var qu=new e.OrthographicCamera(-.5,.5,.5,-.5,.1,1);qu.position.set(0,0,.5),qu.lookAt(0,0,0);var zu=new e.Vector4,Uu=new e.Vector4;function ju(t){if(Qu.map){var i=t.getViewport(zu),r=t.getScissor(Uu),n=t.getScissorTest(),o=t.autoClear;t.setViewport(r.x+Lu[0]/3,r.y+Lu[1]/3,ku[0]/3,ku[1]/3),t.setScissor(r.x+Lu[0]/3,r.y+Lu[1]/3,ku[0]/3,ku[1]/3),t.setScissorTest(!0),t.autoClear=!1,t.render(Hu,qu),t.setViewport(i),t.setScissor(r),t.setScissorTest(n),t.autoClear=o}else{var s=new e.Texture,a=new Image;a.onload=function(){s.image=a,s.wrapS=e.ClampToEdgeWrapping,s.wrapT=e.ClampToEdgeWrapping,s.minFilter=e.LinearFilter,s.needsUpdate=!0,Qu.needsUpdate=!0,a.onload=function(){}},a.src="data:image/png;base64,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",Qu.map=s}}var Ku=new e.Box3(new e.Vector3(-50,-50,-50),new e.Vector3(50,50,50)),_u=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/")},Gu=new e.Vector2,Wu=new e.Frustum,Xu=new e.Matrix4,Yu=new WeakMap,Zu=new WeakMap,Ju=function(t){function i(i){void 0===i&&(i={});var r,n,o,s,a,l,u,h,c,d,p,f=this;if((f=t.call(this)||this).ident=$n(),$u.instances[f.ident]=f,f.renderSwitch01=0,f.panoIndex=0,f.needsRender=!1,f.onlyRenderIfNeeds=null===(r=i.onlyRenderIfNeeds)||void 0===r||r,f.imageOptions=Ne({},null!==(n=i.imageOptions)&&void 0!==n?n:{}),f.textureOptions=Ne({},null!==(o=i.textureOptions)&&void 0!==o?o:{}),f.poweredByRealsee=null===(s=i.poweredByRealsee)||void 0===s||s,f.extraElements=[],f.controllerInits={Panorama:Object.assign({},i.panorama),Model:Object.assign({},i.model),Floorplan:Object.assign({},i.floorplan),Topview:Object.assign({},i.topview),Mapview:Object.assign({},i.mapview),DepthPanorama:Object.assign({},i.depthPanorama),VRPanorama:Object.assign({},i.vrPanorama),XRPanorama:Object.assign({},i.xrPanorama)},f.fps={testCount:0,testTime:je()},f.modeChangeDuration=null!==(a=i.modeChangeDuration)&&void 0!==a?a:800,f.panoramaLikeSavedPose={},"undefined"!=typeof window)if(i.renderer)i.renderer instanceof fi&&f.throwError(new Error("cannot render a internal renderer")),f.renderer=i.renderer;else try{f.renderer=new fi({preserveDrawingBuffer:i.preserveDrawingBuffer,backgroundColor:i.backgroundColor,backgroundAlpha:i.backgroundAlpha,antialias:i.antialias,webgl2:null==i?void 0:i.webgl2});var A=Ru();f.renderer.setPixelRatio(1===A?window.devicePixelRatio:1),f.renderer.setSize(512,512)}catch(e){e instanceof Error&&f.throwError(e)}f.copyEffect=new Sa(f.renderer),f.getPixelsRenderTarget=new e.WebGLRenderTarget(1,1,{encoding:null!==(u=null===(l=f.renderer)||void 0===l?void 0:l.outputEncoding)&&void 0!==u?u:e.sRGBEncoding}),f.scissor=Object.assign({left:0,bottom:0,width:1,height:1},i.scissor),f.camera=new Ei(80),f.scene=new Ai,f.parallaxScene=new Ai,f.lastLoadWorkTask=Promise.resolve(),f.requestProxy=null!==(h=i.requestProxy)&&void 0!==h?h:_u,f.networkSubscribe=new at,f.networkSubscribe.on("network",(function(e,t,i,r){var n;f.emit("network",e,t,i,r),null===(n=f.analysis)||void 0===n||n.network(f.work,e,t,i,r)})),f.model=new vo({allowHosts:[],requestProxy:f.requestProxy,networkSubscribe:f.networkSubscribe});var g=ta(Ku);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 e.Group,f.helperGroup.name="helper",f.scene.add(f.helperGroup),f.videoTexture=new e.VideoTexture(i.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(t){(i=new e.DirectionalLight(16777215,.5)).position.copy(new e.Vector3(1,1,1)),t.add(i);var i=new e.DirectionalLight(16777215,.3);t.add(i),i=new e.AmbientLight(16777215,.3),t.add(i)}(f.scene),f.state={mode:null!==(c=f.currentMode)&&void 0!==c?c:yo,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!==i.play&&f.play(),!1!==(null!==(p=i.initialBasisLoader)&&void 0!==p&&p)&&("string"==typeof i.initialBasisLoader?f.initBasisLoader(i.initialBasisLoader):f.initBasisLoader()),f.stopAnimationLoop=ft.shared.add((function(e,t){for(var i=[],r=2;r<arguments.length;r++)i[r-2]=arguments[r];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={},i.plugins&&i.plugins.length)for(var v=0,y=i.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 e.WebGLRenderTarget(1,1),f.meshReplaceMaterialMap=new Map,f.meshOriginMaterialMap=new Map,f}return Oe(i,t),Object.defineProperty(i,"version",{get:function(){return"5.0.0-alpha.162"},enumerable:!1,configurable:!0}),i.prototype.getGPUPicking=function(t,i,r,n,o){var s=this;if(void 0===n&&(n=1),void 0===o&&(o=new e.Vector3(0,0,0)),!this.renderer)throw new Error("renderer is not initialized.");this.model.setMaterial({modelColorInfo:o}),this.scene.traverse((function(t){if(t instanceof e.Mesh&&!(t instanceof Mt)){var i=Object.keys(r).filter((function(e){return e===t.uuid}))[0];if(i)if(s.meshOriginMaterialMap.set(i,t.material),s.meshReplaceMaterialMap.get(i))t.material=s.meshReplaceMaterialMap.get(i);else{var n=new e.ShaderMaterial({uniforms:{color:{value:r[i]}},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 "});n.depthTest=t.material.depthTest,n.side=t.material.side,s.meshReplaceMaterialMap.set(i,n),t.material=n}}}));var a=this.renderer.getSize(new e.Vector2);this.camera.setViewOffset(a.width,a.height,t*n,i*n,1,1),this.renderer.setRenderTarget(this.gpuPickingRenderTarget),this.render();var l=new Uint8Array(4);return this.renderer.readRenderTargetPixels(this.gpuPickingRenderTarget,0,0,1,1,l),this.renderer.setRenderTarget(null),this.camera.clearViewOffset(),this.scene.traverse((function(t){t instanceof e.Mesh&&!(t instanceof Mt)&&s.meshOriginMaterialMap.get(t.uuid)&&(t.material=s.meshOriginMaterialMap.get(t.uuid))})),this.model.setMaterial({modelColorInfo:null}),Object.keys(r).filter((function(t){return r[t].equals((new e.Color).setRGB(l[0]/255,l[1]/255,l[2]/255))}))[0]||!1},i.prototype.dispose=function(){var e,t;if(!0!==this.destroyed){delete $u.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 r=this.model.getMaterial();r&&(r.pano0&&r.pano0.map.dispose(),r.pano1&&r.pano1.map!==(null===(t=r.pano0)||void 0===t?void 0:t.map)&&r.pano1.map.dispose()),this.model.dispose(),this.diposeGPUPickingMaterial(),this.renderer instanceof fi&&this.renderer.forceContextLoss&&this.renderer.forceContextLoss()}},i.prototype.setScissor=function(e){Object.assign(this.scissor,e),this.controller&&this.controller.updateRenderSize&&this.controller.updateRenderSize()},Object.defineProperty(i.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(i.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(i.prototype,"enablePostProcessing",{get:function(){return void 0!==this.screenBuffers},set:function(t){var i,r,n,o;if(t){if(!this.screenBuffers){var s=this.getDrawingBufferSize(Gu);this.screenBuffers=[new e.WebGLRenderTarget(s.x,s.y,{encoding:null!==(r=null===(i=this.renderer)||void 0===i?void 0:i.outputEncoding)&&void 0!==r?r:e.sRGBEncoding}),new e.WebGLRenderTarget(s.x,s.y,{encoding:null!==(o=null===(n=this.renderer)||void 0===n?void 0:n.outputEncoding)&&void 0!==o?o:e.sRGBEncoding})]}}else this.screenBuffers&&(this.screenBuffers[0].dispose(),this.screenBuffers[1].dispose(),delete this.screenBuffers);this.needsRender=!0},enumerable:!1,configurable:!0}),i.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)},i.prototype.appendTo=function(e,t){if(void 0===t&&(t={}),this.renderer)if(this.renderer instanceof fi){var i=this.getElement();if(i){e.appendChild(i),this.refresh(t);var r=window.getComputedStyle(e).position;"relative"!==r&&"absolute"!==r&&"fixed"!==r&&"sticky"!==r&&(e.style.position="relative")}}else this.throwError(new Error("cannot call appendTo method when render a external renderer"))},i.prototype.refresh=function(t,i){if(void 0===t&&(t={}),this.renderer){var r=this.getElement();if(r){var n=r.parentNode;if(n&&n.nodeName){var o=t.width,s=void 0===o?n.offsetWidth:o,a=t.height,l=void 0===a?n.offsetHeight:a;if(this.renderer instanceof fi){if(i)this.renderer.setPixelRatio(i);else{if((i=1===Ru()?Math.floor(window.devicePixelRatio):1)>1)for(;i>1&&s*l*i*i>7372800;)i--;this.renderer.setPixelRatio(i)}this.renderer.setSize(s,l)}}var u=this.renderer.getSize(new e.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}}},i.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)}},i.prototype.removeExtraElement=function(e){var t=this.extraElements.indexOf(e);-1!==t&&(this.extraElements.splice(t,1),this.controller&&this.controller.unbindExtraElement(e))},i.prototype.getPose=function(){var e=this.camera.copyPose(),t=e.longitude,i=e.latitude,r=e.fov,n=e.offset,o=e.distance;return{longitude:t,latitude:i,fov:r,offset:n.clone(),distance:o}},i.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},i.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},i.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."))},i.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."))},i.prototype.getLongitudeAndLatitude=function(){var e=this.getPose();return{longitude:e.longitude,latitude:e.latitude}},i.prototype.getOffset=function(){return this.getPose().offset},i.prototype.getCameraLocal=function(){if("number"==typeof this.panoIndex&&this.controller&&this.work){var t=this.work.observers[this.panoIndex],i=new e.Object3D;return i.position.copy(t.position),i.quaternion.copy(t.quaternion),i.scale.set(1,1,1),i.updateMatrixWorld(!0),function(t,i){var r=new e.Vector3(0,0,-1);r.applyQuaternion(t.quaternion);var n=i.quaternion.clone().inverse();return r.applyQuaternion(n),{theta:Math.atan2(r.x,-r.z),phi:-Math.asin(r.y),lookAtVector:r}}(this.camera,i)}},i.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&&oi.setTranscoderPath(e),oi.workerConfig.format||oi.detectSupport(this.renderer),oi._allocateWorker(0)}catch(e){e instanceof Error&&this.throwError(e)}},Object.defineProperty(i.prototype,"work",{get:function(){var e=Zu.get(this);if(e&&To.get(e))return e},enumerable:!1,configurable:!0}),i.prototype.load=function(e,t,i,r){var n=this;if(void 0===r&&(r=!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?n.load_(e,t,i,r):e.then((function(e){return n.load_(e,t,i,r)}));var o}));return this.lastLoadWorkTask=o.catch((function(e){n.throwError(e)})),o},i.prototype.load_=function(e,t,r,n){var o,s,a,l,u,h,c,d,p,f=this;void 0===n&&(n=!0);var A,g,m,v=Do(e),y=this.work;void 0===t&&(t=y?"inherit":"initial"),"inherit"===t?(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"===t?(g=null!==(s=this.currentMode)&&void 0!==s?s:v.initial.mode,A=v.initial.panoIndex,m=g===i.Mode.Panorama||g===i.Mode.DepthPanorama||g===i.Mode.Model||g===i.Mode.VRPanorama||g===i.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=t.panoIndex)&&void 0!==a?a:v.initial.panoIndex,g=null!==(u=null!==(l=t.mode)&&void 0!==l?l:this.currentMode)&&void 0!==u?u:yo,m={longitude:null!==(h=t.longitude)&&void 0!==h?h:v.initial.longitude,latitude:null!==(c=t.latitude)&&void 0!==c?c:v.initial.latitude,fov:null!==(d=t.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!=r?r:f.modeChangeDuration:0,o=Ne(Ne({initial:[A,m,i,n]},f.commonParams()),f.controllerInits[g]);f.controller?!1===f.controller.updateWork(v,A,m,i,n)&&(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=ze),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 Zu.set(this,v),g===i.Mode.Floorplan||g===i.Mode.Topview||g===i.Mode.Mapview||g===i.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(),n),x()}))),this.ready().then((function(){f.emit("loaded",e,f.work)}))},i.prototype.changeMode=function(e,t,r,n,o){var s=this;if(void 0===t&&(t={}),void 0===r&&(r=this.modeChangeDuration),void 0===n&&(n=!0),void 0===o&&(o=!1),!this.renderer)throw new Error("renderer is not initialized.");return new Promise((function(a,l){if(!i.Mode.hasOwnProperty(e)){var u=new Error('mode "'.concat(e,'" is not existed'));return s.throwError(u),void l(u)}if((e===i.Mode.Floorplan||e===i.Mode.Topview||e===i.Mode.Mapview||e===i.Mode.Model)&&(fo(s.model)||!0!==s.model.loaded))return u=new Error("model is not ready."),s.throwError(u),void l(u);if(fo(s.controller))return u=new Error("controller is not ready."),s.throwError(u),void l(u);var h=s.controller,c=s.currentMode,d=function(){var u,d,p,f;if(s.emit("wantsChangeMode",e,c))l(new Error("change mode canceled."));else{if(s.controller&&!1===o&&c===e)e===i.Mode.Panorama||e===i.Mode.DepthPanorama||e===i.Mode.Model||e===i.Mode.VRPanorama||e===i.Mode.XRPanorama?"number"==typeof t.panoIndex&&t.panoIndex!==s.panoIndex?s.controller.moveToPano(null!==(d=null!==(u=t.panoIndex)&&void 0!==u?u:s.panoIndex)&&void 0!==d?d:0,Ne({duration:r},t),n):s.controller.updateCamera(t,r,n).catch(ze):("number"==typeof t.panoIndex&&t.panoIndex!==s.panoIndex&&(s.panoIndex=t.panoIndex),s.controller.updateCamera(t,r,n).catch(ze));else{h.destroy();var A=null!==(f=null!==(p=t.panoIndex)&&void 0!==p?p:s.panoIndex)&&void 0!==f?f:0,g=Bu(e)?s.panoramaLikeSavedPose:{};e===i.Mode.Mapview&&(g.longitude=s.panoramaLikeSavedPose.longitude),"number"!=typeof t.longitude&&"number"!=typeof t.latitude||(g.longitude=t.longitude,g.latitude=t.latitude),"number"==typeof t.fov&&(g.fov=t.fov);var m=Ne(Ne({initial:[A,g,r,n]},s.commonParams()),s.controllerInits[e]);s.saveControllerPose(h),s.controller=s.applyController(e,m);var v=Iu[e].initAnimationEndPose(m);s.emit("modeChange",e,c,A,v,n)}a()}};if(e===i.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===i.Mode.XRPanorama){var p=ft.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){ft.shared.setContext(e),d()})).catch((function(e){e instanceof Error&&(s.throwError(e),l(e))}))}else d()}))},i.prototype.getPixels=function(t,i,r,n,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 e.Vector2);t=bo(t,Math.floor(r/2),Math.floor(a.x-r)),i=bo(i,Math.floor(n/2),Math.floor(a.y-n)),s.setSize(r*o,n*o),this.renderer.setRenderTarget(s),this.camera.setViewOffset(a.width,a.height,t,a.height-i-n,r,n),this.controller?this.controller.render():this.renderer.render(this.scene,this.camera);var l=new Uint8Array(r*o*n*o*4);return this.renderer.readRenderTargetPixels(s,0,0,r*o,n*o,l),this.renderer.setRenderTarget(null),this.camera.clearViewOffset(),l},i.prototype.getElement=function(){var e;return null===(e=this.renderer)||void 0===e?void 0:e.domElement},i.prototype.render=function(e,t){var i,r=this;if(void 0===t&&(t=!1),!this.renderer)return null;var n=Et.shared,o=null===(i=this.model.getMaterial())||void 0===i?void 0:i.clippers;if(o&&n.update(o,this.camera),this.model.setMaterial({clipperPlanesArray:o?n.clipperPlanes:null,clipperFloors:o?n.clipperFloors:null}),t){var s=this.renderer.getSize(Gu);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(Gu);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&&ju(this.renderer),this.renderer.setRenderTarget(null),e&&ft.shared.add(e,!0),this.screenBuffers[0]}return this.aroundScissor((function(){r.renderer&&(r.controller?r.controller.render():r.renderer.render(r.scene,r.camera),r.poweredByRealsee&&"VRPanorama"!==r.currentMode&&"XRPanorama"!==r.currentMode&&ju(r.renderer)),e&&ft.shared.add(e,!0)})),null},i.prototype.updateTime=function(t,i){for(var r,n=this,o=[],s=2;s<arguments.length;s++)o[s-2]=arguments[s];if(!this.destroyed){this.syncingState=this.syncState(t,i),this.controller&&(r=this.controller).updateTime.apply(r,Fe([t,i],o,!1)),this.camera.updateTime(t,i),this.syncingState=!1;var a=new e.Vector2(512,512),l=new e.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(Xu.multiplyMatrices(this.camera.projectionMatrix,this.camera.matrixWorldInverse),this.renderer&&this.model.update(this.renderer,this.camera),Wu.setFromProjectionMatrix(Xu),this.scene.traverse((function(i){if(i.setResolution&&i.setResolution(a.x,a.y),i.setTime&&i.setTime(t),i.mixer instanceof e.AnimationMixer){var r=Yu.get(i.mixer);r||(r=new e.Clock,Yu.set(i.mixer,r)),i.mixer.update(r.getDelta())}(i instanceof e.Mesh||i instanceof e.Line||i instanceof e.Points)&&(i instanceof e.ImmediateRenderObject||!i.frustumCulled||Wu.intersectsObject(i))&&u.push(i)})),l.width*l.height>8388608?this.renderSwitch01=1^this.renderSwitch01:this.renderSwitch01=0,this.renderer&&!1===this.paused&&0===this.renderSwitch01){var h=void 0;if(!0!==this.onlyRenderIfNeeds)h=this.render();else{for(var c=0,d=u;c<d.length;c++){var p=d[c],f=function(e){!0===e.needsRender?(e.needsRender=!1,n.needsRender=!0):e.mixer&&e.mixer.stats.actions.inUse>0&&(n.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&&(h=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]),n.copyEffect.render(g[1],void 0)}))}this.hasListener("renderFrame")&&this.emit("renderFrame",void 0!==h)}if(this.fps.testTime&&t-this.fps.testTime<1e3)this.fps.testCount++;else if(this.emit("fps",this.fps.testCount),this.fps.testTime=t,this.fps.testCount=0,this.renderer){var m=this.renderer.getContext(),v=ia(m);v&&this.throwError(v)}}},i.prototype.pause=function(){this.paused=!0,this.renderer&&this.renderer instanceof fi&&this.renderer.clear(!0,!0,!0)},i.prototype.play=function(){this.needsRender=!0,this.paused=!1},i.prototype.moveToPano=function(e,t,r){var n=this;void 0===t&&(t={}),void 0===r&&(r=!0);var o=this,s=o.controller,a=o.currentMode,l=o.renderer;return s?l?(a===i.Mode.Floorplan||a===i.Mode.Topview||a===i.Mode.Mapview?fo(e)||(this.panoIndex=e,this.once("initAnimationWillStart",(function(e,r){n.currentMode===i.Mode.Panorama&&t.moveStartCallback&&t.moveStartCallback(e,r)})),this.once("initAnimationEnded",(function(e,r){n.currentMode===i.Mode.Panorama&&t.moveEndCallback&&t.moveEndCallback(e,r)})),this.changeMode(i.Mode.Panorama,t,void 0,r)):s.moveToPano(e,t,r),this.ready()):(this.throwError(new Error("renderer is not initialized.")),Promise.resolve()):(this.throwError(new Error("controller is not initialized.")),Promise.resolve())},i.prototype.preloadPano=function(e,t){var i=this;if(void 0===t&&(t=ze),!this.work)return Promise.reject(new Error("work never loaded"));var r=this.work.observers[e],n=this.work.allowHosts,o=je();return Promise.all(["right","left","up","down","front","back"].map((function(t){var o=Ne({key:"pano.".concat(e,".").concat(t),basisLoaderInitialized:oi.isInitialized()},kt(i.imageOptions,["size","format","quality","mappings"])),s=r.images[t];return ht(i.imageOptions.transform?i.imageOptions.transform(s,o):vt(s,o),{allowHosts:n,requestProxy:i.requestProxy,networkSubscribe:i.networkSubscribe})}))).then((function(){var e=je()-o;return t(e),e}))},i.prototype.project2d=function(t,i){if(void 0===i&&(i=!1),!this.renderer)return null;if(!1===this.model.empty&&i){var r=this.camera.position,n=t.clone().sub(r),o=new e.Raycaster(r,n.clone().normalize()),s=this.model.intersectRaycaster(o)[0];if(s&&s.distance+.01<n.length())return null}var a=t.clone().project(this.camera);if(Math.abs(a.z)>1)return null;var l=this.renderer.getSize(new e.Vector2),u=l.x*this.scissor.width,h=l.y*this.scissor.height,c=l.x*this.scissor.left+(a.x+1)/2*u,d=l.y*(1-this.scissor.bottom-this.scissor.height)+(1-a.y)/2*h;return new e.Vector2(c,d)},i.prototype.getRenderObjects=function(t){Xu.multiplyMatrices(this.camera.projectionMatrix,this.camera.matrixWorldInverse),Wu.setFromProjectionMatrix(Xu),t||(t=this.scene);var i=[];return t.traverseVisible((function(t){(t instanceof e.Mesh||t instanceof e.Line||t instanceof e.Points)&&(t instanceof e.ImmediateRenderObject||!t.frustumCulled||Wu.intersectsObject(t))&&i.push(t)})),i},i.prototype.getCurrentState=function(){return Ne(Ne({},this.getPose()),{mode:this.currentMode||i.Mode.Panorama,panoIndex:this.panoIndex||0})},i.prototype.setState=function(t,r,n){var o,s,a,l,u,h,c,d,p;void 0===r&&(r=!1),void 0===n&&(n=!0),!(t=Object.assign({},t)).offset||t instanceof e.Vector3||(t.offset=new e.Vector3(t.offset.x,t.offset.y,t.offset.z));var f,A,g,m,v,y=null!==(o=t.panoIndex)&&void 0!==o?o:this.state.panoIndex,b=null!==(s=t.mode)&&void 0!==s?s:this.state.mode;if(this.work)if(this.work.observers[y])if(t.mode!==i.Mode.Floorplan&&t.mode!==i.Mode.Topview&&t.mode!==i.Mode.Mapview&&t.mode!==i.Mode.Model||!fo(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=Bu(this.state.mode)&&Bu(b)?Ne({},this.state):Bu(b)?Ne({},this.panoramaLikeSavedPose):b===i.Mode.Mapview?{longitude:this.panoramaLikeSavedPose.latitude}:Ne({},t),"number"==typeof t.longitude&&(x.longitude=t.longitude),"number"==typeof t.latitude&&(x.latitude=t.latitude),"number"==typeof t.fov&&(x.fov=t.fov);var w=Ne(Ne({initial:[y,x,this.modeChangeDuration,!1]},this.commonParams()),this.controllerInits[b]),E=Iu[b].initAnimationEndPose(w);f=E.longitude,A=E.latitude,g=E.fov,m=E.offset,v=E.distance}else f=null!==(a=t.longitude)&&void 0!==a?a:this.state.longitude,A=null!==(l=t.latitude)&&void 0!==l?l:this.state.latitude,g=null!==(u=t.fov)&&void 0!==u?u:this.state.fov,m=null!==(h=t.offset)&&void 0!==h?h:this.state.offset,v=null!==(c=t.distance)&&void 0!==c?c:this.state.distance;var M={panoIndex:y,mode:b,longitude:f,latitude:A,fov:g,offset:m,distance:v};this.emit("setState",M),ha(this.state,M)||(this.controller&&"VRPanorama"===M.mode&&M.mode!==this.state.mode?(ua(this.state,M),this.changeMode("VRPanorama")):this.controller&&"XRPanorama"===M.mode&&M.mode!==this.state.mode?(ua(this.state,M),this.changeMode("XRPanorama")):(ua(this.state,M),this.controller&&(this.controller.userAction=n),r&&this.state.mode===M.mode&&(this.syncingState=this.syncState(je(),0,r),this.syncingState&&(null===(d=this.controller)||void 0===d||d.updateTime(je(),0),this.syncingState=!1)),this.emit("stateChange",this.state,n),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."))},i.prototype.aroundScissor=function(t){if(this.renderer)if("XRPanorama"!==this.state.mode){var i=new e.Vector2,r=0!==this.scissor.left||0!==this.scissor.bottom||1!==this.scissor.width||1!==this.scissor.height;if(r){this.renderer.getSize(i);var n=Math.floor(i.x*this.scissor.left),o=Math.floor(i.y*this.scissor.bottom),s=Math.floor(i.x*this.scissor.width),a=Math.floor(i.y*this.scissor.height);this.renderer.setViewport(n,o,s,a),this.renderer.setScissor(n,o,s,a),this.renderer.setScissorTest(!0)}t(),r&&(this.renderer.setViewport(0,0,i.x,i.y),this.renderer.setScissor(0,0,i.x,i.y),this.renderer.setScissorTest(!1))}else t()},i.prototype.syncState=function(t,r,n){void 0===n&&(n=!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 Iu.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)return a={longitude:this.state.longitude,latitude:this.state.latitude,fov:this.state.fov,offset:this.state.offset,distance:this.state.distance},this.controller.moveToPano(this.state.panoIndex,a,!1),!0;if(this.controller instanceof Iu.Topview||this.controller instanceof Iu.Mapview){var l=1,u=n?this.state.fov:aa(this.camera.pose.fov,this.state.fov,l),h=n?new e.Vector3(this.state.offset.x,this.state.offset.y,this.state.offset.z):new e.Vector3(aa(this.camera.pose.offset.x,this.state.offset.x,.2),aa(this.camera.pose.offset.y,this.state.offset.y,.2),aa(this.camera.pose.offset.z,this.state.offset.z,.2));if(Ys(u,this.camera.pose.fov)||Js(h,this.camera.pose.offset))return this.controller.cameraMotion.set({fov:u},0).catch(ze),this.controller.locationMotion.set({x:h.x,y:h.y,z:h.z},0).catch(ze),!0}else{l=1;var c=Math.PI/45,d=(u=n?this.state.fov:aa(this.camera.pose.fov,this.state.fov,l),n?{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 r=na(e.longitude),n=e.latitude,o=na(t.longitude),s=t.latitude;o-r>oa?r+=sa:r-o>oa&&(r-=sa);var a=i/Math.sqrt(Math.pow(o-r,2)+Math.pow(s-n,2));return a>=1?{longitude:t.longitude,latitude:t.latitude}:{longitude:r+(o-r)*a,latitude:n+(s-n)*a}}({longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude},{longitude:this.state.longitude,latitude:this.state.latitude},c)),p=d.longitude,f=d.latitude;if(Ys(p,this.camera.pose.longitude,2*Math.PI)||Ys(f,this.camera.pose.latitude)||Ys(u,this.camera.pose.fov))return this.controller.cameraMotion.set({longitude:p,latitude:f,fov:u},0).catch(ze),!0}if(this.stateSynced=!0,!1===o&&this.emit("stateSynced",this.state),this.readyCallbacks.length&&this.stateSynced){var A=this.currentMode;if(A!==i.Mode.Floorplan&&A!==i.Mode.Topview&&A!==i.Mode.Mapview&&A!==i.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 Iu.Panorama?!0!==y.tile||this.controller.isTileReady()?y():this.readyCallbacks.push(y):y()}}}return!1},i.prototype.ready=function(e){var t=this;return void 0===e&&(e={}),new Promise((function(i){var r;t.readyCallbacks.push(Object.assign(i,{tile:null!==(r=e.tile)&&void 0!==r&&r}))}))},i.prototype.requestFullscreen=function(){var e;if(la()){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()}},i.prototype.exitFullscreen=function(){"undefined"!=typeof document&&document.fullscreenElement&&"exitFullscreen"in document&&document.exitFullscreen()},i.prototype.throwError=function(e){this.hasListener("error")?this.emit("error",e):console.error(e)},i.prototype.loadModel=function(t,i,r,n){var o=this,s=t.file;this.emit("modelWillLoad",t);var a=new vo({allowHosts:i,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,i,n;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===(i=o.controller)||void 0===i||i.updateModel(a),null===(n=o.renderer)||void 0===n||n.compile(o.scene,o.camera),o.needsRender=!0,o.modelPending=!1,r(),o.emit("modelLoaded",a)}})),a.on("shownFloorChange",(function(e,t){var i,r;o.destroyed||s===(null===(r=null===(i=o.work)||void 0===i?void 0:i.model)||void 0===r?void 0:r.file)&&o.emit("modelShownFloorChange",e,t)})),a.on("error",(function(t){var i,n,l,u;if(!o.destroyed&&s===(null===(n=null===(i=o.work)||void 0===i?void 0:i.model)||void 0===n?void 0:n.file)){a.bounding.makeEmpty();for(var h=0,c=o.work.observers;h<c.length;h++){var d=c[h];a.bounding.expandByPoint(d.standingPosition),a.bounding.expandByPoint((new e.Vector3).fromArray([d.position.x,2*d.position.y-d.standingPosition.y,d.position.z]))}var p=ta(a.bounding,new e.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",t,a),o.throwError(t),o.modelPending=!1,r()}})),this.modelPending=!0,a.load(t,this.textureOptions).catch(ze)},i.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}},i.prototype.saveControllerPose=function(e){void 0===e&&(e=this.controller),e&&Bu(e)&&(this.panoramaLikeSavedPose.longitude=this.camera.pose.longitude,this.panoramaLikeSavedPose.latitude=this.camera.pose.latitude,this.panoramaLikeSavedPose.fov=this.camera.pose.fov)},i.prototype.applyController=function(e,t){var r=this;if(!this.renderer)throw new Error("renderer is not initialized.");var n=Iu[e];e===this.currentMode||this.model.empty||this.model.show(),this.model.setTransparent(e===i.Mode.Floorplan||e===i.Mode.Topview||e===i.Mode.Model||e===i.Mode.Mapview),this.currentMode=e;for(var o=new n(t),s=function(e){o.on(e,(function(){for(var t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];var n=r.emit.apply(r,Fe([e],t,!1));if(n)return!1}))},a=0,l=Tu;a<l.length;a++)s(l[a]);var u=Iu[e].initAnimationEndPose(t),h=t.initial[3],c={panoIndex:t.initial[0],mode:e,longitude:u.longitude,latitude:u.latitude,fov:u.fov,offset:u.offset,distance:u.distance};return ha(this.state,c)||(ua(this.state,c),this.emit("stateChange",this.state,h)),this.emit("currentStateChange",this.getCurrentState(),h),o.on("cameraUpdate",(function(t,i){var n;if(r.controller){var o=Ne(Ne({},r.controller.getTargetPose()),{panoIndex:r.panoIndex,mode:e});i&&!1===r.syncingState&&r.state.mode===o.mode&&!ha(r.state,o)&&(ua(r.state,o),r.emit("stateChange",r.state,i),null===(n=r.analysis)||void 0===n||n.state(r.work,r.state))}r.emit("currentStateChange",r.getCurrentState(),i)})),o.on("initAnimationWillStart",(function(t,i,n){var o,s=Ne(Ne({},i),{panoIndex:t,mode:e});n&&r.state.mode===s.mode&&!ha(r.state,s)&&(ua(r.state,s),r.emit("stateChange",r.state,n),null===(o=r.analysis)||void 0===o||o.state(r.work,r.state))})),o.on("initAnimationEnded",(function(t,i,n){var o,s=Ne(Ne({},i),{panoIndex:t,mode:e});n&&r.state.mode===s.mode&&!ha(r.state,s)&&(ua(r.state,s),r.emit("stateChange",r.state,n),null===(o=r.analysis)||void 0===o||o.state(r.work,r.state))})),o.on("panoWillArrive",(function(t,i,n){var o;r.panoIndex=t;var s=Ne(Ne({},i),{panoIndex:t,mode:e});n&&r.state.mode===s.mode&&!ha(r.state,s)&&(ua(r.state,s),r.emit("stateChange",r.state,n),null===(o=r.analysis)||void 0===o||o.state(r.work,r.state))})),o.on("panoArrived",(function(t,i,n){var o,s=Ne(Ne({},i),{panoIndex:t,mode:e});n&&r.state.mode===s.mode&&!ha(r.state,s)&&(ua(r.state,s),r.emit("stateChange",r.state,n),null===(o=r.analysis)||void 0===o||o.state(r.work,r.state))})),o.on("moveToPano",(function(e,t){r.emit("currentStateChange",r.getCurrentState(),t)})),o.on("wantsMoveToPano",(function(e,t,i){var n=r.emit("wantsMoveToPano",e,t,i);n||(n=r.emit("wantsToMoveToPano",e,t,i)),n||r.moveToPano(e,t,i)})),o.on("vrWantsToExit",(function(){r.currentMode===i.Mode.VRPanorama&&(r.exitFullscreen(),r.changeMode(i.Mode.Panorama))})),o.on("error",(function(e){return r.throwError(e)})),o},i.prototype.removeEventListeners=function(){},i.prototype.diposeGPUPickingMaterial=function(){this.meshReplaceMaterialMap.forEach((function(e){e.dispose()})),this.meshOriginMaterialMap.forEach((function(e){e.dispose()}))},i.Mode={Panorama:"Panorama",Model:"Model",Floorplan:"Floorplan",Topview:"Topview",Mapview:"Mapview",DepthPanorama:"DepthPanorama",VRPanorama:"VRPanorama",XRPanorama:"XRPanorama"},i.Line=null,i}(qe),$u={instances:{},constructor:Ju};"undefined"!=typeof window&&Object.assign(window,{__FIVE_DEBUG__:$u});var eh=function(){function e(){}return e.createButton=function(e){var t=document.createElement("button");function i(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",i(t),navigator.xr.isSessionSupported("immersive-vr").then((function(i){i?(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()}):(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")})),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",i(r),r},e}()})(),__webpack_exports__})()));
|
|
2
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.FiveSDK=t():e.FiveSDK=t()}(self,(()=>(()=>{var __webpack_modules__={438:e=>{if(!("THREE"in window))throw new Error('"THREE" is not available. Please include "three.js" in your HTML.');const t=Number(THREE.REVISION);if(t<115||t>117)throw new Error('"Five" needs "THREE.js" version between 125 - 117.');e.exports=window.THREE},383:e=>{"use strict";e.exports=function(e,t){for(var i=new Array(arguments.length-1),r=0,n=2,o=!0;n<arguments.length;)i[r++]=arguments[n++];return new Promise((function(n,s){i[r]=function(e){if(o)if(o=!1,e)s(e);else{for(var t=new Array(arguments.length-1),i=0;i<t.length;)t[i++]=arguments[i];n.apply(null,t)}};try{e.apply(t||null,i)}catch(e){o&&(o=!1,s(e))}}))}},417:(e,t)=>{"use strict";var i=t;i.length=function(e){var t=e.length;if(!t)return 0;for(var i=0;--t%4>1&&"="===e.charAt(t);)++i;return Math.ceil(3*e.length)/4-i};for(var r=new Array(64),n=new Array(123),o=0;o<64;)n[r[o]=o<26?o+65:o<52?o+71:o<62?o-4:o-59|43]=o++;i.encode=function(e,t,i){for(var n,o=null,s=[],a=0,l=0;t<i;){var u=e[t++];switch(l){case 0:s[a++]=r[u>>2],n=(3&u)<<4,l=1;break;case 1:s[a++]=r[n|u>>4],n=(15&u)<<2,l=2;break;case 2:s[a++]=r[n|u>>6],s[a++]=r[63&u],l=0}a>8191&&((o||(o=[])).push(String.fromCharCode.apply(String,s)),a=0)}return l&&(s[a++]=r[n],s[a++]=61,1===l&&(s[a++]=61)),o?(a&&o.push(String.fromCharCode.apply(String,s.slice(0,a))),o.join("")):String.fromCharCode.apply(String,s.slice(0,a))};var s="invalid encoding";i.decode=function(e,t,i){for(var r,o=i,a=0,l=0;l<e.length;){var u=e.charCodeAt(l++);if(61===u&&a>1)break;if(void 0===(u=n[u]))throw Error(s);switch(a){case 0:r=u,a=1;break;case 1:t[i++]=r<<2|(48&u)>>4,r=u,a=2;break;case 2:t[i++]=(15&r)<<4|(60&u)>>2,r=u,a=3;break;case 3:t[i++]=(3&r)<<6|u,a=0}}if(1===a)throw Error(s);return i-o},i.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}},516:e=>{"use strict";function t(){this._listeners={}}e.exports=t,t.prototype.on=function(e,t,i){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:t,ctx:i||this}),this},t.prototype.off=function(e,t){if(void 0===e)this._listeners={};else if(void 0===t)this._listeners[e]=[];else for(var i=this._listeners[e],r=0;r<i.length;)i[r].fn===t?i.splice(r,1):++r;return this},t.prototype.emit=function(e){var t=this._listeners[e];if(t){for(var i=[],r=1;r<arguments.length;)i.push(arguments[r++]);for(r=0;r<t.length;)t[r].fn.apply(t[r++].ctx,i)}return this}},787:e=>{"use strict";function t(e){return"undefined"!=typeof Float32Array?function(){var t=new Float32Array([-0]),i=new Uint8Array(t.buffer),r=128===i[3];function n(e,r,n){t[0]=e,r[n]=i[0],r[n+1]=i[1],r[n+2]=i[2],r[n+3]=i[3]}function o(e,r,n){t[0]=e,r[n]=i[3],r[n+1]=i[2],r[n+2]=i[1],r[n+3]=i[0]}function s(e,r){return i[0]=e[r],i[1]=e[r+1],i[2]=e[r+2],i[3]=e[r+3],t[0]}function a(e,r){return i[3]=e[r],i[2]=e[r+1],i[1]=e[r+2],i[0]=e[r+3],t[0]}e.writeFloatLE=r?n:o,e.writeFloatBE=r?o:n,e.readFloatLE=r?s:a,e.readFloatBE=r?a:s}():function(){function t(e,t,i,r){var n=t<0?1:0;if(n&&(t=-t),0===t)e(1/t>0?0:2147483648,i,r);else if(isNaN(t))e(2143289344,i,r);else if(t>34028234663852886e22)e((n<<31|2139095040)>>>0,i,r);else if(t<11754943508222875e-54)e((n<<31|Math.round(t/1401298464324817e-60))>>>0,i,r);else{var o=Math.floor(Math.log(t)/Math.LN2);e((n<<31|o+127<<23|8388607&Math.round(t*Math.pow(2,-o)*8388608))>>>0,i,r)}}function s(e,t,i){var r=e(t,i),n=2*(r>>31)+1,o=r>>>23&255,s=8388607&r;return 255===o?s?NaN:n*(1/0):0===o?1401298464324817e-60*n*s:n*Math.pow(2,o-150)*(s+8388608)}e.writeFloatLE=t.bind(null,i),e.writeFloatBE=t.bind(null,r),e.readFloatLE=s.bind(null,n),e.readFloatBE=s.bind(null,o)}(),"undefined"!=typeof Float64Array?function(){var t=new Float64Array([-0]),i=new Uint8Array(t.buffer),r=128===i[7];function n(e,r,n){t[0]=e,r[n]=i[0],r[n+1]=i[1],r[n+2]=i[2],r[n+3]=i[3],r[n+4]=i[4],r[n+5]=i[5],r[n+6]=i[6],r[n+7]=i[7]}function o(e,r,n){t[0]=e,r[n]=i[7],r[n+1]=i[6],r[n+2]=i[5],r[n+3]=i[4],r[n+4]=i[3],r[n+5]=i[2],r[n+6]=i[1],r[n+7]=i[0]}function s(e,r){return i[0]=e[r],i[1]=e[r+1],i[2]=e[r+2],i[3]=e[r+3],i[4]=e[r+4],i[5]=e[r+5],i[6]=e[r+6],i[7]=e[r+7],t[0]}function a(e,r){return i[7]=e[r],i[6]=e[r+1],i[5]=e[r+2],i[4]=e[r+3],i[3]=e[r+4],i[2]=e[r+5],i[1]=e[r+6],i[0]=e[r+7],t[0]}e.writeDoubleLE=r?n:o,e.writeDoubleBE=r?o:n,e.readDoubleLE=r?s:a,e.readDoubleBE=r?a:s}():function(){function t(e,t,i,r,n,o){var s=r<0?1:0;if(s&&(r=-r),0===r)e(0,n,o+t),e(1/r>0?0:2147483648,n,o+i);else if(isNaN(r))e(0,n,o+t),e(2146959360,n,o+i);else if(r>17976931348623157e292)e(0,n,o+t),e((s<<31|2146435072)>>>0,n,o+i);else{var a;if(r<22250738585072014e-324)e((a=r/5e-324)>>>0,n,o+t),e((s<<31|a/4294967296)>>>0,n,o+i);else{var l=Math.floor(Math.log(r)/Math.LN2);1024===l&&(l=1023),e(4503599627370496*(a=r*Math.pow(2,-l))>>>0,n,o+t),e((s<<31|l+1023<<20|1048576*a&1048575)>>>0,n,o+i)}}}function s(e,t,i,r,n){var o=e(r,n+t),s=e(r,n+i),a=2*(s>>31)+1,l=s>>>20&2047,u=4294967296*(1048575&s)+o;return 2047===l?u?NaN:a*(1/0):0===l?5e-324*a*u:a*Math.pow(2,l-1075)*(u+4503599627370496)}e.writeDoubleLE=t.bind(null,i,0,4),e.writeDoubleBE=t.bind(null,r,4,0),e.readDoubleLE=s.bind(null,n,0,4),e.readDoubleBE=s.bind(null,o,4,0)}(),e}function i(e,t,i){t[i]=255&e,t[i+1]=e>>>8&255,t[i+2]=e>>>16&255,t[i+3]=e>>>24}function r(e,t,i){t[i]=e>>>24,t[i+1]=e>>>16&255,t[i+2]=e>>>8&255,t[i+3]=255&e}function n(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}function o(e,t){return(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}e.exports=t(t)},795:module=>{"use strict";function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(e){}return null}module.exports=inquire},476:e=>{"use strict";e.exports=function(e,t,i){var r=i||8192,n=r>>>1,o=null,s=r;return function(i){if(i<1||i>n)return e(i);s+i>r&&(o=e(r),s=0);var a=t.call(o,s,s+=i);return 7&s&&(s=1+(7|s)),a}}},893:(e,t)=>{"use strict";var i=t;i.length=function(e){for(var t=0,i=0,r=0;r<e.length;++r)(i=e.charCodeAt(r))<128?t+=1:i<2048?t+=2:55296==(64512&i)&&56320==(64512&e.charCodeAt(r+1))?(++r,t+=4):t+=3;return t},i.read=function(e,t,i){if(i-t<1)return"";for(var r,n=null,o=[],s=0;t<i;)(r=e[t++])<128?o[s++]=r:r>191&&r<224?o[s++]=(31&r)<<6|63&e[t++]:r>239&&r<365?(r=((7&r)<<18|(63&e[t++])<<12|(63&e[t++])<<6|63&e[t++])-65536,o[s++]=55296+(r>>10),o[s++]=56320+(1023&r)):o[s++]=(15&r)<<12|(63&e[t++])<<6|63&e[t++],s>8191&&((n||(n=[])).push(String.fromCharCode.apply(String,o)),s=0);return n?(s&&n.push(String.fromCharCode.apply(String,o.slice(0,s))),n.join("")):String.fromCharCode.apply(String,o.slice(0,s))},i.write=function(e,t,i){for(var r,n,o=i,s=0;s<e.length;++s)(r=e.charCodeAt(s))<128?t[i++]=r:r<2048?(t[i++]=r>>6|192,t[i++]=63&r|128):55296==(64512&r)&&56320==(64512&(n=e.charCodeAt(s+1)))?(r=65536+((1023&r)<<10)+(1023&n),++s,t[i++]=r>>18|240,t[i++]=r>>12&63|128,t[i++]=r>>6&63|128,t[i++]=63&r|128):(t[i++]=r>>12|224,t[i++]=r>>6&63|128,t[i++]=63&r|128);return i-o}},967:(e,t,i)=>{"use strict";e.exports=i(365)},365:(e,t,i)=>{"use strict";var r=t;function n(){r.util._configure(),r.Writer._configure(r.BufferWriter),r.Reader._configure(r.BufferReader)}r.build="minimal",r.Writer=i(147),r.BufferWriter=i(55),r.Reader=i(74),r.BufferReader=i(69),r.util=i(835),r.rpc=i(876),r.roots=i(7),r.configure=n,n()},74:(e,t,i)=>{"use strict";e.exports=l;var r,n=i(835),o=n.LongBits,s=n.utf8;function a(e,t){return RangeError("index out of range: "+e.pos+" + "+(t||1)+" > "+e.len)}function l(e){this.buf=e,this.pos=0,this.len=e.length}var u,c="undefined"!=typeof Uint8Array?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new l(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new l(e);throw Error("illegal buffer")},h=function(){return n.Buffer?function(e){return(l.create=function(e){return n.Buffer.isBuffer(e)?new r(e):c(e)})(e)}:c};function d(){var e=new o(0,0),t=0;if(!(this.len-this.pos>4)){for(;t<3;++t){if(this.pos>=this.len)throw a(this);if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e}return e.lo=(e.lo|(127&this.buf[this.pos++])<<7*t)>>>0,e}for(;t<4;++t)if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e;if(e.lo=(e.lo|(127&this.buf[this.pos])<<28)>>>0,e.hi=(e.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return e;if(t=0,this.len-this.pos>4){for(;t<5;++t)if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}else for(;t<5;++t){if(this.pos>=this.len)throw a(this);if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}throw Error("invalid varint encoding")}function p(e,t){return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0}function f(){if(this.pos+8>this.len)throw a(this,8);return new o(p(this.buf,this.pos+=4),p(this.buf,this.pos+=4))}l.create=h(),l.prototype._slice=n.Array.prototype.subarray||n.Array.prototype.slice,l.prototype.uint32=(u=4294967295,function(){if(u=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128)return u;if(u=(u|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)return u;if(u=(u|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)return u;if(u=(u|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)return u;if(u=(u|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128)return u;if((this.pos+=5)>this.len)throw this.pos=this.len,a(this,10);return u}),l.prototype.int32=function(){return 0|this.uint32()},l.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(1&e)|0},l.prototype.bool=function(){return 0!==this.uint32()},l.prototype.fixed32=function(){if(this.pos+4>this.len)throw a(this,4);return p(this.buf,this.pos+=4)},l.prototype.sfixed32=function(){if(this.pos+4>this.len)throw a(this,4);return 0|p(this.buf,this.pos+=4)},l.prototype.float=function(){if(this.pos+4>this.len)throw a(this,4);var e=n.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e},l.prototype.double=function(){if(this.pos+8>this.len)throw a(this,4);var e=n.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e},l.prototype.bytes=function(){var e=this.uint32(),t=this.pos,i=this.pos+e;if(i>this.len)throw a(this,e);return this.pos+=e,Array.isArray(this.buf)?this.buf.slice(t,i):t===i?new this.buf.constructor(0):this._slice.call(this.buf,t,i)},l.prototype.string=function(){var e=this.bytes();return s.read(e,0,e.length)},l.prototype.skip=function(e){if("number"==typeof e){if(this.pos+e>this.len)throw a(this,e);this.pos+=e}else do{if(this.pos>=this.len)throw a(this)}while(128&this.buf[this.pos++]);return this},l.prototype.skipType=function(e){switch(e){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;4!=(e=7&this.uint32());)this.skipType(e);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+e+" at offset "+this.pos)}return this},l._configure=function(e){r=e,l.create=h(),r._configure();var t=n.Long?"toLong":"toNumber";n.merge(l.prototype,{int64:function(){return d.call(this)[t](!1)},uint64:function(){return d.call(this)[t](!0)},sint64:function(){return d.call(this).zzDecode()[t](!1)},fixed64:function(){return f.call(this)[t](!0)},sfixed64:function(){return f.call(this)[t](!1)}})}},69:(e,t,i)=>{"use strict";e.exports=o;var r=i(74);(o.prototype=Object.create(r.prototype)).constructor=o;var n=i(835);function o(e){r.call(this,e)}o._configure=function(){n.Buffer&&(o.prototype._slice=n.Buffer.prototype.slice)},o.prototype.string=function(){var e=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+e,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+e,this.len))},o._configure()},7:e=>{"use strict";e.exports={}},876:(e,t,i)=>{"use strict";t.Service=i(380)},380:(e,t,i)=>{"use strict";e.exports=n;var r=i(835);function n(e,t,i){if("function"!=typeof e)throw TypeError("rpcImpl must be a function");r.EventEmitter.call(this),this.rpcImpl=e,this.requestDelimited=Boolean(t),this.responseDelimited=Boolean(i)}(n.prototype=Object.create(r.EventEmitter.prototype)).constructor=n,n.prototype.rpcCall=function e(t,i,n,o,s){if(!o)throw TypeError("request must be specified");var a=this;if(!s)return r.asPromise(e,a,t,i,n,o);if(a.rpcImpl)try{return a.rpcImpl(t,i[a.requestDelimited?"encodeDelimited":"encode"](o).finish(),(function(e,i){if(e)return a.emit("error",e,t),s(e);if(null!==i){if(!(i instanceof n))try{i=n[a.responseDelimited?"decodeDelimited":"decode"](i)}catch(e){return a.emit("error",e,t),s(e)}return a.emit("data",i,t),s(null,i)}a.end(!0)}))}catch(e){return a.emit("error",e,t),void setTimeout((function(){s(e)}),0)}else setTimeout((function(){s(Error("already ended"))}),0)},n.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}},600:(e,t,i)=>{"use strict";e.exports=n;var r=i(835);function n(e,t){this.lo=e>>>0,this.hi=t>>>0}var o=n.zero=new n(0,0);o.toNumber=function(){return 0},o.zzEncode=o.zzDecode=function(){return this},o.length=function(){return 1};var s=n.zeroHash="\0\0\0\0\0\0\0\0";n.fromNumber=function(e){if(0===e)return o;var t=e<0;t&&(e=-e);var i=e>>>0,r=(e-i)/4294967296>>>0;return t&&(r=~r>>>0,i=~i>>>0,++i>4294967295&&(i=0,++r>4294967295&&(r=0))),new n(i,r)},n.from=function(e){if("number"==typeof e)return n.fromNumber(e);if(r.isString(e)){if(!r.Long)return n.fromNumber(parseInt(e,10));e=r.Long.fromString(e)}return e.low||e.high?new n(e.low>>>0,e.high>>>0):o},n.prototype.toNumber=function(e){if(!e&&this.hi>>>31){var t=1+~this.lo>>>0,i=~this.hi>>>0;return t||(i=i+1>>>0),-(t+4294967296*i)}return this.lo+4294967296*this.hi},n.prototype.toLong=function(e){return r.Long?new r.Long(0|this.lo,0|this.hi,Boolean(e)):{low:0|this.lo,high:0|this.hi,unsigned:Boolean(e)}};var a=String.prototype.charCodeAt;n.fromHash=function(e){return e===s?o:new n((a.call(e,0)|a.call(e,1)<<8|a.call(e,2)<<16|a.call(e,3)<<24)>>>0,(a.call(e,4)|a.call(e,5)<<8|a.call(e,6)<<16|a.call(e,7)<<24)>>>0)},n.prototype.toHash=function(){return String.fromCharCode(255&this.lo,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,255&this.hi,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},n.prototype.zzEncode=function(){var e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this},n.prototype.zzDecode=function(){var e=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this},n.prototype.length=function(){var e=this.lo,t=(this.lo>>>28|this.hi<<4)>>>0,i=this.hi>>>24;return 0===i?0===t?e<16384?e<128?1:2:e<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:i<128?9:10}},835:function(e,t,i){"use strict";var r=t;function n(e,t,i){for(var r=Object.keys(t),n=0;n<r.length;++n)void 0!==e[r[n]]&&i||(e[r[n]]=t[r[n]]);return e}function o(e){function t(e,i){if(!(this instanceof t))return new t(e,i);Object.defineProperty(this,"message",{get:function(){return e}}),Error.captureStackTrace?Error.captureStackTrace(this,t):Object.defineProperty(this,"stack",{value:(new Error).stack||""}),i&&n(this,i)}return(t.prototype=Object.create(Error.prototype)).constructor=t,Object.defineProperty(t.prototype,"name",{get:function(){return e}}),t.prototype.toString=function(){return this.name+": "+this.message},t}r.asPromise=i(383),r.base64=i(417),r.EventEmitter=i(516),r.float=i(787),r.inquire=i(795),r.utf8=i(893),r.pool=i(476),r.LongBits=i(600),r.isNode=Boolean(void 0!==i.g&&i.g&&i.g.process&&i.g.process.versions&&i.g.process.versions.node),r.global=r.isNode&&i.g||"undefined"!=typeof window&&window||"undefined"!=typeof self&&self||this,r.emptyArray=Object.freeze?Object.freeze([]):[],r.emptyObject=Object.freeze?Object.freeze({}):{},r.isInteger=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e},r.isString=function(e){return"string"==typeof e||e instanceof String},r.isObject=function(e){return e&&"object"==typeof e},r.isset=r.isSet=function(e,t){var i=e[t];return!(null==i||!e.hasOwnProperty(t))&&("object"!=typeof i||(Array.isArray(i)?i.length:Object.keys(i).length)>0)},r.Buffer=function(){try{var e=r.inquire("buffer").Buffer;return e.prototype.utf8Write?e:null}catch(e){return null}}(),r._Buffer_from=null,r._Buffer_allocUnsafe=null,r.newBuffer=function(e){return"number"==typeof e?r.Buffer?r._Buffer_allocUnsafe(e):new r.Array(e):r.Buffer?r._Buffer_from(e):"undefined"==typeof Uint8Array?e:new Uint8Array(e)},r.Array="undefined"!=typeof Uint8Array?Uint8Array:Array,r.Long=r.global.dcodeIO&&r.global.dcodeIO.Long||r.global.Long||r.inquire("long"),r.key2Re=/^true|false|0|1$/,r.key32Re=/^-?(?:0|[1-9][0-9]*)$/,r.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,r.longToHash=function(e){return e?r.LongBits.from(e).toHash():r.LongBits.zeroHash},r.longFromHash=function(e,t){var i=r.LongBits.fromHash(e);return r.Long?r.Long.fromBits(i.lo,i.hi,t):i.toNumber(Boolean(t))},r.merge=n,r.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)},r.newError=o,r.ProtocolError=o("ProtocolError"),r.oneOfGetter=function(e){for(var t={},i=0;i<e.length;++i)t[e[i]]=1;return function(){for(var e=Object.keys(this),i=e.length-1;i>-1;--i)if(1===t[e[i]]&&void 0!==this[e[i]]&&null!==this[e[i]])return e[i]}},r.oneOfSetter=function(e){return function(t){for(var i=0;i<e.length;++i)e[i]!==t&&delete this[e[i]]}},r.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},r._configure=function(){var e=r.Buffer;e?(r._Buffer_from=e.from!==Uint8Array.from&&e.from||function(t,i){return new e(t,i)},r._Buffer_allocUnsafe=e.allocUnsafe||function(t){return new e(t)}):r._Buffer_from=r._Buffer_allocUnsafe=null}},147:(e,t,i)=>{"use strict";e.exports=h;var r,n=i(835),o=n.LongBits,s=n.base64,a=n.utf8;function l(e,t,i){this.fn=e,this.len=t,this.next=void 0,this.val=i}function u(){}function c(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}function h(){this.len=0,this.head=new l(u,0,0),this.tail=this.head,this.states=null}var d=function(){return n.Buffer?function(){return(h.create=function(){return new r})()}:function(){return new h}};function p(e,t,i){t[i]=255&e}function f(e,t){this.len=e,this.next=void 0,this.val=t}function A(e,t,i){for(;e.hi;)t[i++]=127&e.lo|128,e.lo=(e.lo>>>7|e.hi<<25)>>>0,e.hi>>>=7;for(;e.lo>127;)t[i++]=127&e.lo|128,e.lo=e.lo>>>7;t[i++]=e.lo}function g(e,t,i){t[i]=255&e,t[i+1]=e>>>8&255,t[i+2]=e>>>16&255,t[i+3]=e>>>24}h.create=d(),h.alloc=function(e){return new n.Array(e)},n.Array!==Array&&(h.alloc=n.pool(h.alloc,n.Array.prototype.subarray)),h.prototype._push=function(e,t,i){return this.tail=this.tail.next=new l(e,t,i),this.len+=t,this},f.prototype=Object.create(l.prototype),f.prototype.fn=function(e,t,i){for(;e>127;)t[i++]=127&e|128,e>>>=7;t[i]=e},h.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new f((e>>>=0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this},h.prototype.int32=function(e){return e<0?this._push(A,10,o.fromNumber(e)):this.uint32(e)},h.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)},h.prototype.uint64=function(e){var t=o.from(e);return this._push(A,t.length(),t)},h.prototype.int64=h.prototype.uint64,h.prototype.sint64=function(e){var t=o.from(e).zzEncode();return this._push(A,t.length(),t)},h.prototype.bool=function(e){return this._push(p,1,e?1:0)},h.prototype.fixed32=function(e){return this._push(g,4,e>>>0)},h.prototype.sfixed32=h.prototype.fixed32,h.prototype.fixed64=function(e){var t=o.from(e);return this._push(g,4,t.lo)._push(g,4,t.hi)},h.prototype.sfixed64=h.prototype.fixed64,h.prototype.float=function(e){return this._push(n.float.writeFloatLE,4,e)},h.prototype.double=function(e){return this._push(n.float.writeDoubleLE,8,e)};var m=n.Array.prototype.set?function(e,t,i){t.set(e,i)}:function(e,t,i){for(var r=0;r<e.length;++r)t[i+r]=e[r]};h.prototype.bytes=function(e){var t=e.length>>>0;if(!t)return this._push(p,1,0);if(n.isString(e)){var i=h.alloc(t=s.length(e));s.decode(e,i,0),e=i}return this.uint32(t)._push(m,t,e)},h.prototype.string=function(e){var t=a.length(e);return t?this.uint32(t)._push(a.write,t,e):this._push(p,1,0)},h.prototype.fork=function(){return this.states=new c(this),this.head=this.tail=new l(u,0,0),this.len=0,this},h.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new l(u,0,0),this.len=0),this},h.prototype.ldelim=function(){var e=this.head,t=this.tail,i=this.len;return this.reset().uint32(i),i&&(this.tail.next=e.next,this.tail=t,this.len+=i),this},h.prototype.finish=function(){for(var e=this.head.next,t=this.constructor.alloc(this.len),i=0;e;)e.fn(e.val,t,i),i+=e.len,e=e.next;return t},h._configure=function(e){r=e,h.create=d(),r._configure()}},55:(e,t,i)=>{"use strict";e.exports=o;var r=i(147);(o.prototype=Object.create(r.prototype)).constructor=o;var n=i(835);function o(){r.call(this)}function s(e,t,i){e.length<40?n.utf8.write(e,t,i):t.utf8Write?t.utf8Write(e,i):t.write(e,i)}o._configure=function(){o.alloc=n._Buffer_allocUnsafe,o.writeBytesBuffer=n.Buffer&&n.Buffer.prototype instanceof Uint8Array&&"set"===n.Buffer.prototype.set.name?function(e,t,i){t.set(e,i)}:function(e,t,i){if(e.copy)e.copy(t,i,0,e.length);else for(var r=0;r<e.length;)t[i++]=e[r++]}},o.prototype.bytes=function(e){n.isString(e)&&(e=n._Buffer_from(e,"base64"));var t=e.length>>>0;return this.uint32(t),t&&this._push(o.writeBytesBuffer,t,e),this},o.prototype.string=function(e){var t=n.Buffer.byteLength(e);return this.uint32(t),t&&this._push(s,t,e),this},o._configure()}},__webpack_module_cache__={};function __webpack_require__(e){var t=__webpack_module_cache__[e];if(void 0!==t)return t.exports;var i=__webpack_module_cache__[e]={exports:{}};return __webpack_modules__[e].call(i.exports,i,i.exports,__webpack_require__),i.exports}__webpack_require__.d=(e,t)=>{for(var i in t)__webpack_require__.o(t,i)&&!__webpack_require__.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},__webpack_require__.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),__webpack_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),__webpack_require__.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var __webpack_exports__={};return(()=>{"use strict";__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{AnimationFrameLoop:()=>ft,BVH:()=>Di,BVHIntersect:()=>Ci,BVHNode:()=>Si,BVHVector3:()=>Ei,Camera:()=>Mi,Clipper:()=>Mt,Five:()=>Yl,InternalWebGLRenderer:()=>fi,IntersectMesh:()=>Ko,LegacyPanoCircleMesh:()=>Xn,Model:()=>fn,NetworkSubscribe:()=>at,PBMContainer:()=>St,PBMGroup:()=>Ct,PBMMaterial:()=>pi,PBMMesh:()=>Et,PROXY_CONTROLLER_EVENT_NAMES:()=>Il,PanoCircleMesh:()=>fo,PanoCircleMeshDark:()=>Bo,PanoCircleMeshSolid:()=>Uo,Scene:()=>Ai,Subscribe:()=>qe,TextureLoader:()=>li,Tile3D:()=>jr,Tile3DModel:()=>un,TileBoundingSphere:()=>Br,TileCacheNode:()=>mr,TileCubeTextureTarget:()=>ai,TileCullingVolume:()=>Er,TileOrientedBoundingBox:()=>Vr,TileRequestScheduler:()=>gr,Tileset3D:()=>Wr,Tileset3DTraverser:()=>Kr,TilesetCache:()=>yr,Work:()=>Cn,XRButton:()=>Jl,defaultImageURLTransform:()=>vt,getViewportScale:()=>Tl,imageSupport:()=>wt,parseWork:()=>Pn});var e=__webpack_require__(438),t=Number(e.REVISION);if(t<115||t>117)throw new Error('"Five" needs "THREE.js" version between 125 - 117.');var i,r,n,o,s,a,l,u,c,h,d,p,f={},A={},g=g||(i=Math,n=(r={}).lib={},o=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)}}}(),s=n.WordArray=o.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:4*e.length},toString:function(e){return(e||l).stringify(this)},concat:function(e){var t=this.words,i=e.words,r=this.sigBytes,n=e.sigBytes;if(this.clamp(),r%4)for(var o=0;o<n;o++){var s=i[o>>>2]>>>24-o%4*8&255;t[r+o>>>2]|=s<<24-(r+o)%4*8}else for(o=0;o<n;o+=4)t[r+o>>>2]=i[o>>>2];return this.sigBytes+=n,this},clamp:function(){var e=this.words,t=this.sigBytes;e[t>>>2]&=4294967295<<32-t%4*8,e.length=i.ceil(t/4)},clone:function(){var e=o.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var t=[],r=0;r<e;r+=4)t.push(4294967296*i.random()|0);return new s.init(t,e)}}),a=r.enc={},l=a.Hex={stringify:function(e){for(var t=e.words,i=e.sigBytes,r=[],n=0;n<i;n++){var o=t[n>>>2]>>>24-n%4*8&255;r.push((o>>>4).toString(16)),r.push((15&o).toString(16))}return r.join("")},parse:function(e){for(var t=e.length,i=[],r=0;r<t;r+=2)i[r>>>3]|=parseInt(e.substr(r,2),16)<<24-r%8*4;return new s.init(i,t/2)}},u=a.Latin1={stringify:function(e){for(var t=e.words,i=e.sigBytes,r=[],n=0;n<i;n++){var o=t[n>>>2]>>>24-n%4*8&255;r.push(String.fromCharCode(o))}return r.join("")},parse:function(e){for(var t=e.length,i=[],r=0;r<t;r++)i[r>>>2]|=(255&e.charCodeAt(r))<<24-r%4*8;return new s.init(i,t)}},c=a.Utf8={stringify:function(e){try{return decodeURIComponent(escape(u.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return u.parse(unescape(encodeURIComponent(e)))}},h=n.BufferedBlockAlgorithm=o.extend({reset:function(){this._data=new s.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=c.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(e){var t=this._data,r=t.words,n=t.sigBytes,o=this.blockSize,a=n/(4*o),l=(a=e?i.ceil(a):i.max((0|a)-this._minBufferSize,0))*o,u=i.min(4*l,n);if(l){for(var c=0;c<l;c+=o)this._doProcessBlock(r,c);var h=r.splice(0,l);t.sigBytes-=u}return new s.init(h,u)},clone:function(){var e=o.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0}),n.Hasher=h.extend({cfg:o.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){h.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 d.HMAC.init(e,i).finalize(t)}}}),d=r.algo={},r);function m(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 v(){return new m(null)}!function(e){for(var t=g,i=(n=t.lib).WordArray,r=n.Hasher,n=t.algo,o=[],s=[],a=function(e){return 4294967296*(e-(0|e))|0},l=2,u=0;64>u;){var c;e:{c=l;for(var h=e.sqrt(c),d=2;d<=h;d++)if(!(c%d)){c=!1;break e}c=!0}c&&(8>u&&(o[u]=a(e.pow(l,.5))),s[u]=a(e.pow(l,1/3)),u++),l++}var p=[];n=n.SHA256=r.extend({_doReset:function(){this._hash=new i.init(o.slice(0))},_doProcessBlock:function(e,t){for(var i=this._hash.words,r=i[0],n=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)p[d]=0|e[t+d];else{var f=p[d-15],A=p[d-2];p[d]=((f<<25|f>>>7)^(f<<14|f>>>18)^f>>>3)+p[d-7]+((A<<15|A>>>17)^(A<<13|A>>>19)^A>>>10)+p[d-16]}f=h+((l<<26|l>>>6)^(l<<21|l>>>11)^(l<<7|l>>>25))+(l&u^~l&c)+s[d]+p[d],A=((r<<30|r>>>2)^(r<<19|r>>>13)^(r<<10|r>>>22))+(r&n^r&o^n&o),h=c,c=u,u=l,l=a+f|0,a=o,o=n,n=r,r=f+A|0}i[0]=i[0]+r|0,i[1]=i[1]+n|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,r=8*this._nDataBytes,n=8*t.sigBytes;return i[n>>>5]|=128<<24-n%32,i[14+(n+64>>>9<<4)]=e.floor(r/4294967296),i[15+(n+64>>>9<<4)]=r,t.sigBytes=4*i.length,this._process(),this._hash},clone:function(){var e=r.clone.call(this);return e._hash=this._hash.clone(),e}}),t.SHA256=r._createHelper(n),t.HmacSHA256=r._createHmacHelper(n)}(Math),g.lib.Cipher||function(e){var t=(p=g).lib,i=t.Base,r=t.WordArray,n=t.BufferedBlockAlgorithm,o=p.enc.Base64,s=p.algo.EvpKDF,a=t.Cipher=n.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(){n.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,r){return("string"==typeof i?f:d).encrypt(e,t,i,r)},decrypt:function(t,i,r){return("string"==typeof i?f:d).decrypt(e,t,i,r)}}}});t.StreamCipher=a.extend({_doFinalize:function(){return this._process(!0)},blockSize:1});var l=p.mode={},u=function(e,t,i){var r=this._iv;r?this._iv=void 0:r=this._prevBlock;for(var n=0;n<i;n++)e[t+n]^=r[n]},c=(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();c.Encryptor=c.extend({processBlock:function(e,t){var i=this._cipher,r=i.blockSize;u.call(this,e,t,r),i.encryptBlock(e,t),this._prevBlock=e.slice(t,t+r)}}),c.Decryptor=c.extend({processBlock:function(e,t){var i=this._cipher,r=i.blockSize,n=e.slice(t,t+r);i.decryptBlock(e,t),u.call(this,e,t,r),this._prevBlock=n}}),l=l.CBC=c,c=(p.pad={}).Pkcs7={pad:function(e,t){for(var i,n=(i=(i=4*t)-e.sigBytes%i)<<24|i<<16|i<<8|i,o=[],s=0;s<i;s+=4)o.push(n);i=r.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:c}),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 h=t.CipherParams=i.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}}),d=(l=(p.format={}).OpenSSL={stringify:function(e){var t=e.ciphertext;return((e=e.salt)?r.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=r.create(t.slice(2,4));t.splice(0,4),e.sigBytes-=16}return h.create({ciphertext:e,salt:i})}},t.SerializableCipher=i.extend({cfg:i.extend({format:l}),encrypt:function(e,t,i,r){r=this.cfg.extend(r);var n=e.createEncryptor(i,r);return t=n.finalize(t),n=n.cfg,h.create({ciphertext:t,key:i,iv:n.iv,algorithm:e,mode:n.mode,padding:n.padding,blockSize:e.blockSize,formatter:r.format})},decrypt:function(e,t,i,r){return r=this.cfg.extend(r),t=this._parse(t,r.format),e.createDecryptor(i,r).finalize(t.ciphertext)},_parse:function(e,t){return"string"==typeof e?t.parse(e,this):e}})),p=(p.kdf={}).OpenSSL={execute:function(e,t,i,n){return n||(n=r.random(8)),e=s.create({keySize:t+i}).compute(e,n),i=r.create(e.words.slice(t),4*i),e.sigBytes=4*t,h.create({key:e,iv:i,salt:n})}},f=t.PasswordBasedCipher=d.extend({cfg:d.cfg.extend({kdf:p}),encrypt:function(e,t,i,r){return i=(r=this.cfg.extend(r)).kdf.execute(i,e.keySize,e.ivSize),r.iv=i.iv,(e=d.encrypt.call(this,e,t,i.key,r)).mixIn(i),e},decrypt:function(e,t,i,r){return r=this.cfg.extend(r),t=this._parse(t,r.format),i=r.kdf.execute(i,e.keySize,e.ivSize,t.salt),r.iv=i.iv,d.decrypt.call(this,e,t,i.key,r)}})}(),function(){for(var e=g,t=e.lib.BlockCipher,i=e.algo,r=[],n=[],o=[],s=[],a=[],l=[],u=[],c=[],h=[],d=[],p=[],f=0;256>f;f++)p[f]=128>f?f<<1:f<<1^283;var A=0,m=0;for(f=0;256>f;f++){var v=(v=m^m<<1^m<<2^m<<3^m<<4)>>>8^255&v^99;r[A]=v,n[v]=A;var y=p[A],b=p[y],x=p[b],w=257*p[v]^16843008*v;o[A]=w<<24|w>>>8,s[A]=w<<16|w>>>16,a[A]=w<<8|w>>>24,l[A]=w,w=16843009*x^65537*b^257*y^16843008*A,u[v]=w<<24|w>>>8,c[v]=w<<16|w>>>16,h[v]=w<<8|w>>>24,d[v]=w,A?(A=y^p[p[p[x^y]]],m^=p[p[m]]):A=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),n=this._keySchedule=[],o=0;o<i;o++)if(o<t)n[o]=e[o];else{var s=n[o-1];o%t?6<t&&4==o%t&&(s=r[s>>>24]<<24|r[s>>>16&255]<<16|r[s>>>8&255]<<8|r[255&s]):(s=r[(s=s<<8|s>>>24)>>>24]<<24|r[s>>>16&255]<<16|r[s>>>8&255]<<8|r[255&s],s^=M[o/t|0]<<24),n[o]=n[o-t]^s}for(e=this._invKeySchedule=[],t=0;t<i;t++)o=i-t,s=t%4?n[o]:n[o-4],e[t]=4>t||4>=o?s:u[r[s>>>24]]^c[r[s>>>16&255]]^h[r[s>>>8&255]]^d[r[255&s]]},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,o,s,a,l,r)},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,u,c,h,d,n),i=e[t+1],e[t+1]=e[t+3],e[t+3]=i},_doCryptBlock:function(e,t,i,r,n,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=r[u>>>24]^n[c>>>16&255]^o[h>>>8&255]^s[255&d]^i[p++],g=r[c>>>24]^n[h>>>16&255]^o[d>>>8&255]^s[255&u]^i[p++],m=r[h>>>24]^n[d>>>16&255]^o[u>>>8&255]^s[255&c]^i[p++];d=r[d>>>24]^n[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)}(),A.lang={extend:function(e,t,i){if(!t||!e)throw new Error("YAHOO.lang.extend failed, please check that all dependencies are included.");var r=function(){};if(r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e,e.superclass=t.prototype,t.prototype.constructor==Object.prototype.constructor&&(t.prototype.constructor=t),i){var n;for(n in i)e.prototype[n]=i[n];var o=function(){},s=["toString","valueOf"];try{/MSIE/.test("undefined"!=typeof navigator?navigator.userAgent:"node")&&(o=function(e,t){for(n=0;n<s.length;n+=1){var i=s[n],r=t[i];"function"==typeof r&&r!=Object.prototype[i]&&(e[i]=r)}})}catch(e){}o(e.prototype,i)}}},"undefined"!=typeof navigator&&"Microsoft Internet Explorer"==navigator.appName?(m.prototype.am=function(e,t,i,r,n,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;n=((l=s*l+((32767&c)<<15)+i[r]+(1073741823&n))>>>30)+(c>>>15)+a*u+(n>>>30),i[r++]=1073741823&l}return n},p=30):"undefined"!=typeof navigator&&"Netscape"!=navigator.appName?(m.prototype.am=function(e,t,i,r,n,o){for(;--o>=0;){var s=t*this[e++]+i[r]+n;n=Math.floor(s/67108864),i[r++]=67108863&s}return n},p=26):(m.prototype.am=function(e,t,i,r,n,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;n=((l=s*l+((16383&c)<<14)+i[r]+n)>>28)+(c>>14)+a*u,i[r++]=268435455&l}return n},p=28),m.prototype.DB=p,m.prototype.DM=(1<<p)-1,m.prototype.DV=1<<p,m.prototype.FV=Math.pow(2,52),m.prototype.F1=52-p,m.prototype.F2=2*p-52;var y,b,x=new Array;for(y="0".charCodeAt(0),b=0;b<=9;++b)x[y++]=b;for(y="a".charCodeAt(0),b=10;b<36;++b)x[y++]=b;for(y="A".charCodeAt(0),b=10;b<36;++b)x[y++]=b;function w(e){return"0123456789abcdefghijklmnopqrstuvwxyz".charAt(e)}function M(e,t){var i=x[e.charCodeAt(t)];return null==i?-1:i}function E(e){var t=v();return t.fromInt(e),t}function S(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 C(e){this.m=e}function I(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 B(e,t){return e&t}function T(e,t){return e|t}function P(e,t){return e^t}function R(e,t){return e&~t}function D(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 k(e){for(var t=0;0!=e;)e&=e-1,++t;return t}function L(){}function O(e){return e}function F(e){this.r2=v(),this.q3=v(),m.ONE.dlShiftTo(2*e.t,this.r2),this.mu=this.r2.divide(e),this.m=e}C.prototype.convert=function(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e},C.prototype.revert=function(e){return e},C.prototype.reduce=function(e){e.divRemTo(this.m,null,e)},C.prototype.mulTo=function(e,t,i){e.multiplyTo(t,i),this.reduce(i)},C.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},I.prototype.convert=function(e){var t=v();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(m.ZERO)>0&&this.m.subTo(t,t),t},I.prototype.revert=function(e){var t=v();return e.copyTo(t),this.reduce(t),t},I.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],r=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,r,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)},I.prototype.mulTo=function(e,t,i){e.multiplyTo(t,i),this.reduce(i)},I.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},m.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},m.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},m.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 r=e.length,n=!1,o=0;--r>=0;){var s=8==i?255&e[r]:M(e,r);s<0?"-"==e.charAt(r)&&(n=!0):(n=!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(),n&&m.ZERO.subTo(this,this)},m.prototype.clamp=function(){for(var e=this.s&this.DM;this.t>0&&this[this.t-1]==e;)--this.t},m.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},m.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},m.prototype.lShiftTo=function(e,t){var i,r=e%this.DB,n=this.DB-r,o=(1<<n)-1,s=Math.floor(e/this.DB),a=this.s<<r&this.DM;for(i=this.t-1;i>=0;--i)t[i+s+1]=this[i]>>n|a,a=(this[i]&o)<<r;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()},m.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 r=e%this.DB,n=this.DB-r,o=(1<<r)-1;t[0]=this[i]>>r;for(var s=i+1;s<this.t;++s)t[s-i-1]|=(this[s]&o)<<n,t[s-i]=this[s]>>r;r>0&&(t[this.t-i-1]|=(this.s&o)<<n),t.t=this.t-i,t.clamp()}},m.prototype.subTo=function(e,t){for(var i=0,r=0,n=Math.min(e.t,this.t);i<n;)r+=this[i]-e[i],t[i++]=r&this.DM,r>>=this.DB;if(e.t<this.t){for(r-=e.s;i<this.t;)r+=this[i],t[i++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;i<e.t;)r-=e[i],t[i++]=r&this.DM,r>>=this.DB;r-=e.s}t.s=r<0?-1:0,r<-1?t[i++]=this.DV+r:r>0&&(t[i++]=r),t.t=i,t.clamp()},m.prototype.multiplyTo=function(e,t){var i=this.abs(),r=e.abs(),n=i.t;for(t.t=n+r.t;--n>=0;)t[n]=0;for(n=0;n<r.t;++n)t[n+i.t]=i.am(0,r[n],t,n,0,i.t);t.s=0,t.clamp(),this.s!=e.s&&m.ZERO.subTo(t,t)},m.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 r=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,r,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()},m.prototype.divRemTo=function(e,t,i){var r=e.abs();if(!(r.t<=0)){var n=this.abs();if(n.t<r.t)return null!=t&&t.fromInt(0),void(null!=i&&this.copyTo(i));null==i&&(i=v());var o=v(),s=this.s,a=e.s,l=this.DB-S(r[r.t-1]);l>0?(r.lShiftTo(l,o),n.lShiftTo(l,i)):(r.copyTo(o),n.copyTo(i));var u=o.t,c=o[u-1];if(0!=c){var h=c*(1<<this.F1)+(u>1?o[u-2]>>this.F2:0),d=this.FV/h,p=(1<<this.F1)/h,f=1<<this.F2,A=i.t,g=A-u,y=null==t?v():t;for(o.dlShiftTo(g,y),i.compareTo(y)>=0&&(i[i.t++]=1,i.subTo(y,i)),m.ONE.dlShiftTo(u,y),y.subTo(o,o);o.t<u;)o[o.t++]=0;for(;--g>=0;){var b=i[--A]==c?this.DM:Math.floor(i[A]*d+(i[A-1]+f)*p);if((i[A]+=o.am(0,b,i,g,0,u))<b)for(o.dlShiftTo(g,y),i.subTo(y,i);i[A]<--b;)i.subTo(y,i)}null!=t&&(i.drShiftTo(u,t),s!=a&&m.ZERO.subTo(t,t)),i.t=u,i.clamp(),l>0&&i.rShiftTo(l,i),s<0&&m.ZERO.subTo(i,i)}}},m.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},m.prototype.isEven=function(){return 0==(this.t>0?1&this[0]:this.s)},m.prototype.exp=function(e,t){if(e>4294967295||e<1)return m.ONE;var i=v(),r=v(),n=t.convert(this),o=S(e)-1;for(n.copyTo(i);--o>=0;)if(t.sqrTo(i,r),(e&1<<o)>0)t.mulTo(r,n,i);else{var s=i;i=r,r=s}return t.revert(i)},m.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,r=(1<<t)-1,n=!1,o="",s=this.t,a=this.DB-s*this.DB%t;if(s-- >0)for(a<this.DB&&(i=this[s]>>a)>0&&(n=!0,o=w(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)&r,a<=0&&(a+=this.DB,--s)),i>0&&(n=!0),n&&(o+=w(i));return n?o:"0"},m.prototype.negate=function(){var e=v();return m.ZERO.subTo(this,e),e},m.prototype.abs=function(){return this.s<0?this.negate():this},m.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},m.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+S(this[this.t-1]^this.s&this.DM)},m.prototype.mod=function(e){var t=v();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(m.ZERO)>0&&e.subTo(t,t),t},m.prototype.modPowInt=function(e,t){var i;return i=e<256||t.isEven()?new C(t):new I(t),this.exp(e,i)},m.ZERO=E(0),m.ONE=E(1),L.prototype.convert=O,L.prototype.revert=O,L.prototype.mulTo=function(e,t,i){e.multiplyTo(t,i)},L.prototype.sqrTo=function(e,t){e.squareTo(t)},F.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=v();return e.copyTo(t),this.reduce(t),t},F.prototype.revert=function(e){return e},F.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)},F.prototype.mulTo=function(e,t,i){e.multiplyTo(t,i),this.reduce(i)},F.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)};var N=[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],V=(1<<26)/N[N.length-1];m.prototype.chunkSize=function(e){return Math.floor(Math.LN2*this.DB/Math.log(e))},m.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),r=E(i),n=v(),o=v(),s="";for(this.divRemTo(r,n,o);n.signum()>0;)s=(i+o.intValue()).toString(e).substr(1)+s,n.divRemTo(r,n,o);return o.intValue().toString(e)+s},m.prototype.fromRadix=function(e,t){this.fromInt(0),null==t&&(t=10);for(var i=this.chunkSize(t),r=Math.pow(t,i),n=!1,o=0,s=0,a=0;a<e.length;++a){var l=M(e,a);l<0?"-"==e.charAt(a)&&0==this.signum()&&(n=!0):(s=t*s+l,++o>=i&&(this.dMultiply(r),this.dAddOffset(s,0),o=0,s=0))}o>0&&(this.dMultiply(Math.pow(t,o)),this.dAddOffset(s,0)),n&&m.ZERO.subTo(this,this)},m.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(m.ONE.shiftLeft(e-1),T,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(t);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(m.ONE.shiftLeft(e-1),this);else{var r=new Array,n=7&e;r.length=1+(e>>3),t.nextBytes(r),n>0?r[0]&=(1<<n)-1:r[0]=0,this.fromString(r,256)}},m.prototype.bitwiseTo=function(e,t,i){var r,n,o=Math.min(e.t,this.t);for(r=0;r<o;++r)i[r]=t(this[r],e[r]);if(e.t<this.t){for(n=e.s&this.DM,r=o;r<this.t;++r)i[r]=t(this[r],n);i.t=this.t}else{for(n=this.s&this.DM,r=o;r<e.t;++r)i[r]=t(n,e[r]);i.t=e.t}i.s=t(this.s,e.s),i.clamp()},m.prototype.changeBit=function(e,t){var i=m.ONE.shiftLeft(e);return this.bitwiseTo(i,t,i),i},m.prototype.addTo=function(e,t){for(var i=0,r=0,n=Math.min(e.t,this.t);i<n;)r+=this[i]+e[i],t[i++]=r&this.DM,r>>=this.DB;if(e.t<this.t){for(r+=e.s;i<this.t;)r+=this[i],t[i++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;i<e.t;)r+=e[i],t[i++]=r&this.DM,r>>=this.DB;r+=e.s}t.s=r<0?-1:0,r>0?t[i++]=r:r<-1&&(t[i++]=this.DV+r),t.t=i,t.clamp()},m.prototype.dMultiply=function(e){this[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()},m.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]}},m.prototype.multiplyLowerTo=function(e,t,i){var r,n=Math.min(this.t+e.t,t);for(i.s=0,i.t=n;n>0;)i[--n]=0;for(r=i.t-this.t;n<r;++n)i[n+this.t]=this.am(0,e[n],i,n,0,this.t);for(r=Math.min(e.t,t);n<r;++n)this.am(0,e[n],i,n,0,t-n);i.clamp()},m.prototype.multiplyUpperTo=function(e,t,i){--t;var r=i.t=this.t+e.t-t;for(i.s=0;--r>=0;)i[r]=0;for(r=Math.max(t-this.t,0);r<e.t;++r)i[this.t+r-t]=this.am(t-r,e[r],i,0,0,this.t+r-t);i.clamp(),i.drShiftTo(1,i)},m.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 r=this.t-1;r>=0;--r)i=(t*i+this[r])%e;return i},m.prototype.millerRabin=function(e){var t=this.subtract(m.ONE),i=t.getLowestSetBit();if(i<=0)return!1;var r=t.shiftRight(i);(e=e+1>>1)>N.length&&(e=N.length);for(var n=v(),o=0;o<e;++o){n.fromInt(N[Math.floor(Math.random()*N.length)]);var s=n.modPow(r,this);if(0!=s.compareTo(m.ONE)&&0!=s.compareTo(t)){for(var a=1;a++<i&&0!=s.compareTo(t);)if(0==(s=s.modPowInt(2,this)).compareTo(m.ONE))return!1;if(0!=s.compareTo(t))return!1}}return!0},m.prototype.clone=function(){var e=v();return this.copyTo(e),e},m.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]},m.prototype.byteValue=function(){return 0==this.t?this.s:this[0]<<24>>24},m.prototype.shortValue=function(){return 0==this.t?this.s:this[0]<<16>>16},m.prototype.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1},m.prototype.toByteArray=function(){var e=this.t,t=new Array;t[0]=this.s;var i,r=this.DB-e*this.DB%8,n=0;if(e-- >0)for(r<this.DB&&(i=this[e]>>r)!=(this.s&this.DM)>>r&&(t[n++]=i|this.s<<this.DB-r);e>=0;)r<8?(i=(this[e]&(1<<r)-1)<<8-r,i|=this[--e]>>(r+=this.DB-8)):(i=this[e]>>(r-=8)&255,r<=0&&(r+=this.DB,--e)),0!=(128&i)&&(i|=-256),0==n&&(128&this.s)!=(128&i)&&++n,(n>0||i!=this.s)&&(t[n++]=i);return t},m.prototype.equals=function(e){return 0==this.compareTo(e)},m.prototype.min=function(e){return this.compareTo(e)<0?this:e},m.prototype.max=function(e){return this.compareTo(e)>0?this:e},m.prototype.and=function(e){var t=v();return this.bitwiseTo(e,B,t),t},m.prototype.or=function(e){var t=v();return this.bitwiseTo(e,T,t),t},m.prototype.xor=function(e){var t=v();return this.bitwiseTo(e,P,t),t},m.prototype.andNot=function(e){var t=v();return this.bitwiseTo(e,R,t),t},m.prototype.not=function(){for(var e=v(),t=0;t<this.t;++t)e[t]=this.DM&~this[t];return e.t=this.t,e.s=~this.s,e},m.prototype.shiftLeft=function(e){var t=v();return e<0?this.rShiftTo(-e,t):this.lShiftTo(e,t),t},m.prototype.shiftRight=function(e){var t=v();return e<0?this.lShiftTo(-e,t):this.rShiftTo(e,t),t},m.prototype.getLowestSetBit=function(){for(var e=0;e<this.t;++e)if(0!=this[e])return e*this.DB+D(this[e]);return this.s<0?this.t*this.DB:-1},m.prototype.bitCount=function(){for(var e=0,t=this.s&this.DM,i=0;i<this.t;++i)e+=k(this[i]^t);return e},m.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)},m.prototype.setBit=function(e){return this.changeBit(e,T)},m.prototype.clearBit=function(e){return this.changeBit(e,R)},m.prototype.flipBit=function(e){return this.changeBit(e,P)},m.prototype.add=function(e){var t=v();return this.addTo(e,t),t},m.prototype.subtract=function(e){var t=v();return this.subTo(e,t),t},m.prototype.multiply=function(e){var t=v();return this.multiplyTo(e,t),t},m.prototype.divide=function(e){var t=v();return this.divRemTo(e,t,null),t},m.prototype.remainder=function(e){var t=v();return this.divRemTo(e,null,t),t},m.prototype.divideAndRemainder=function(e){var t=v(),i=v();return this.divRemTo(e,t,i),new Array(t,i)},m.prototype.modPow=function(e,t){var i,r,n=e.bitLength(),o=E(1);if(n<=0)return o;i=n<18?1:n<48?3:n<144?4:n<768?5:6,r=n<8?new C(t):t.isEven()?new F(t):new I(t);var s=new Array,a=3,l=i-1,u=(1<<i)-1;if(s[1]=r.convert(this),i>1){var c=v();for(r.sqrTo(s[1],c);a<=u;)s[a]=v(),r.mulTo(c,s[a-2],s[a]),a+=2}var h,d,p=e.t-1,f=!0,A=v();for(n=S(e[p])-1;p>=0;){for(n>=l?h=e[p]>>n-l&u:(h=(e[p]&(1<<n+1)-1)<<l-n,p>0&&(h|=e[p-1]>>this.DB+n-l)),a=i;0==(1&h);)h>>=1,--a;if((n-=a)<0&&(n+=this.DB,--p),f)s[h].copyTo(o),f=!1;else{for(;a>1;)r.sqrTo(o,A),r.sqrTo(A,o),a-=2;a>0?r.sqrTo(o,A):(d=o,o=A,A=d),r.mulTo(A,s[h],o)}for(;p>=0&&0==(e[p]&1<<n);)r.sqrTo(o,A),d=o,o=A,A=d,--n<0&&(n=this.DB-1,--p)}return r.revert(o)},m.prototype.modInverse=function(e){var t=e.isEven();if(this.isEven()&&t||0==e.signum())return m.ZERO;for(var i=e.clone(),r=this.clone(),n=E(1),o=E(0),s=E(0),a=E(1);0!=i.signum();){for(;i.isEven();)i.rShiftTo(1,i),t?(n.isEven()&&o.isEven()||(n.addTo(this,n),o.subTo(e,o)),n.rShiftTo(1,n)):o.isEven()||o.subTo(e,o),o.rShiftTo(1,o);for(;r.isEven();)r.rShiftTo(1,r),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(r)>=0?(i.subTo(r,i),t&&n.subTo(s,n),o.subTo(a,o)):(r.subTo(i,r),t&&s.subTo(n,s),a.subTo(o,a))}return 0!=r.compareTo(m.ONE)?m.ZERO:a.compareTo(e)>=0?a.subtract(e):a.signum()<0?(a.addTo(e,a),a.signum()<0?a.add(e):a):a},m.prototype.pow=function(e){return this.exp(e,new L)},m.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 r=t;t=i,i=r}var n=t.getLowestSetBit(),o=i.getLowestSetBit();if(o<0)return t;for(n<o&&(o=n),o>0&&(t.rShiftTo(o,t),i.rShiftTo(o,i));t.signum()>0;)(n=t.getLowestSetBit())>0&&t.rShiftTo(n,t),(n=i.getLowestSetBit())>0&&i.rShiftTo(n,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},m.prototype.isProbablePrime=function(e){var t,i=this.abs();if(1==i.t&&i[0]<=N[N.length-1]){for(t=0;t<N.length;++t)if(i[0]==N[t])return!0;return!1}if(i.isEven())return!1;for(t=1;t<N.length;){for(var r=N[t],n=t+1;n<N.length&&r<V;)r*=N[n++];for(r=i.modInt(r);t<n;)if(r%N[t++]==0)return!1}return i.millerRabin(e)},m.prototype.square=function(){var e=v();return this.squareTo(e),e};var Q,H,q,U="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function z(e){var t,i,r="";for(t=0;t+3<=e.length;t+=3)i=parseInt(e.substring(t,t+3),16),r+=U.charAt(i>>6)+U.charAt(63&i);for(t+1==e.length?(i=parseInt(e.substring(t,t+1),16),r+=U.charAt(i<<2)):t+2==e.length&&(i=parseInt(e.substring(t,t+2),16),r+=U.charAt(i>>2)+U.charAt((3&i)<<4));(3&r.length)>0;)r+="=";return r}function j(e){var t,i,r,n="",o=0;for(t=0;t<e.length&&"="!=e.charAt(t);++t)(r=U.indexOf(e.charAt(t)))<0||(0==o?(n+=w(r>>2),i=3&r,o=1):1==o?(n+=w(i<<2|r>>4),i=15&r,o=2):2==o?(n+=w(i),n+=w(r>>2),i=3&r,o=3):(n+=w(i<<2|r>>4),n+=w(15&r),o=0));return 1==o&&(n+=w(i<<2)),n}function _(){this.i=0,this.j=0,this.S=new Array}function K(){!function(e){H[q++]^=255&e,H[q++]^=e>>8&255,H[q++]^=e>>16&255,H[q++]^=e>>24&255,q>=256&&(q-=256)}((new Date).getTime())}if(_.prototype.init=function(e){var t,i,r;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,r=this.S[t],this.S[t]=this.S[i],this.S[i]=r;this.i=0,this.j=0},_.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]},null==H){var G;if(H=new Array,q=0,"undefined"!=typeof window&&(void 0!==window.crypto||void 0!==window.msCrypto)){var W=window.crypto||window.msCrypto;if(W.getRandomValues){var X=new Uint8Array(32);for(W.getRandomValues(X),G=0;G<32;++G)H[q++]=X[G]}else if("undefined"!=typeof navigator&&"Netscape"==navigator.appName&&navigator.appVersion<"5"){var Y=window.crypto.random(32);for(G=0;G<Y.length;++G)H[q++]=255&Y.charCodeAt(G)}}for(;q<256;)G=Math.floor(65536*Math.random()),H[q++]=G>>>8,H[q++]=255&G;q=0,K()}function Z(){if(null==Q){for(K(),(Q=new _).init(H),q=0;q<H.length;++q)H[q]=0;q=0}return Q.next()}function J(){}function $(e,t){return new m(e,t)}function ee(e,t,i){for(var r="",n=0;r.length<t;)r+=i(String.fromCharCode.apply(String,e.concat([(4278190080&n)>>24,(16711680&n)>>16,(65280&n)>>8,255&n]))),n+=1;return r}function te(){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 ie(e,t,i){for(var r="",n=0;r.length<t;)r+=i(e+String.fromCharCode.apply(String,[(4278190080&n)>>24,(16711680&n)>>16,(65280&n)>>8,255&n])),n+=1;return r}function re(e){for(var t="",i=0;i<e.length;i++){var r=e[i].toString(16);1==r.length&&(r="0"+r),t+=r}return t}function ne(e){return re(function(e){for(var t=new Array,i=0;i<e.length;i++)t[i]=e.charCodeAt(i);return t}(e))}function oe(e){return(e=(e=e.replace(/\=/g,"")).replace(/\+/g,"-")).replace(/\//g,"_")}function se(e){return e.length%4==2?e+="==":e.length%4==3&&(e+="="),(e=e.replace(/-/g,"+")).replace(/_/g,"/")}function ae(e){return e.length%2==1&&(e="0"+e),oe(z(e))}function le(e){return j(se(e))}function ue(e){return Ae(ve(e))}function ce(e){return decodeURIComponent(function(e){return e.replace(/(..)/g,"%$1")}(e))}function he(e){for(var t="",i=0;i<e.length-1;i+=2)t+=String.fromCharCode(parseInt(e.substr(i,2),16));return t}function de(e){for(var t="",i=0;i<e.length;i++)t+=("0"+e.charCodeAt(i).toString(16)).slice(-2);return t}function pe(e,t){return"-----BEGIN "+t+"-----\r\n"+function(e){var t=function(e){return z(e)}(e).replace(/(.{64})/g,"$1\r\n");return t.replace(/\r\n$/,"")}(e)+"\r\n-----END "+t+"-----\r\n"}function fe(e,t){if(-1==e.indexOf("-----BEGIN "))throw"can't find PEM header: "+t;return function(e){return j(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 Ae(e){return e.replace(/%/g,"")}function ge(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 r=(e=":"+t.join(":")+":").match(/:(0:){2,}/g);if(null===r)return e.slice(1,-1);var n="";for(i=0;i<r.length;i++)r[i].length>n.length&&(n=r[i]);return(e=e.replace(n,"::")).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 me(e){var t=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 r=128|63&i;return ce((192|(7&t)<<3|(192&i)>>6).toString(16)+r.toString(16))}r=128|(15&t)<<2|(192&i)>>6;var n=128|63&i;return ce((224|(240&t)>>4).toString(16)+r.toString(16)+n.toString(16))}));return t.join("")}function ve(e){for(var t=encodeURIComponent(e),i="",r=0;r<t.length;r++)"%"==t[r]?(i+=t.substr(r,3),r+=2):i=i+"%"+ne(t[r]);return i}function ye(e){return!(e.length%2!=0||!e.match(/^[0-9a-f]+$/)&&!e.match(/^[0-9A-F]+$/))}function be(e){return e.length%2==1?"0"+e:e.substr(0,1)>"7"?"00"+e:e}J.prototype.nextBytes=function(e){var t;for(t=0;t<e.length;++t)e[t]=Z()},te.prototype.doPublic=function(e){return e.modPowInt(this.e,this.n)},te.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=$(e,16),this.e=parseInt(t,16)}},te.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,r=e.length-1;r>=0&&t>0;){var n=e.charCodeAt(r--);n<128?i[--t]=n:n>127&&n<2048?(i[--t]=63&n|128,i[--t]=n>>6|192):(i[--t]=63&n|128,i[--t]=n>>6&63|128,i[--t]=n>>12|224)}i[--t]=0;for(var o=new J,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 m(i)}(e,this.n.bitLength()+7>>3);if(null==t)return null;var i=this.doPublic(t);if(null==i)return null;var r=i.toString(16);return 0==(1&r.length)?r:"0"+r},te.prototype.encryptOAEP=function(e,t,i){var r=function(e,t,i,r){var n=f.crypto.MessageDigest,o=f.crypto.Util,s=null;if(i||(i="sha1"),"string"==typeof i&&(s=n.getCanonicalAlgName(i),r=n.getHashLength(s),i=function(e){return he(o.hashHex(de(e),s))}),e.length+2*r+2>t)throw"Message too long for RSA";var a,l="";for(a=0;a<t-e.length-2*r-2;a+=1)l+="\0";var u=i("")+l+""+e,c=new Array(r);(new J).nextBytes(c);var h=ee(c,u.length,i),d=[];for(a=0;a<u.length;a+=1)d[a]=u.charCodeAt(a)^h.charCodeAt(a);var p=ee(d,c.length,i),A=[0];for(a=0;a<c.length;a+=1)A[a+1]=c[a]^p.charCodeAt(a);return new m(A.concat(d))}(e,this.n.bitLength()+7>>3,t,i);if(null==r)return null;var n=this.doPublic(r);if(null==n)return null;var o=n.toString(16);return 0==(1&o.length)?o:"0"+o},te.prototype.type="RSA",te.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)},te.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=$(e,16),this.e=parseInt(t,16),this.d=$(i,16)}},te.prototype.setPrivateEx=function(e,t,i,r,n,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=$(e,16),this.e=parseInt(t,16),this.d=$(i,16),this.p=$(r,16),this.q=$(n,16),this.dmp1=$(o,16),this.dmq1=$(s,16),this.coeff=$(a,16)},te.prototype.generate=function(e,t){var i=new J,r=e>>1;this.e=parseInt(t,16);for(var n=new m(t,16);;){for(;this.p=new m(e-r,1,i),0!=this.p.subtract(m.ONE).gcd(n).compareTo(m.ONE)||!this.p.isProbablePrime(10););for(;this.q=new m(r,1,i),0!=this.q.subtract(m.ONE).gcd(n).compareTo(m.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(m.ONE),a=this.q.subtract(m.ONE),l=s.multiply(a);if(0==l.gcd(n).compareTo(m.ONE)&&(this.n=this.p.multiply(this.q),this.n.bitLength()==e)){this.d=n.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},te.prototype.decrypt=function(e){if(e.length!=Math.ceil(this.n.bitLength()/4))throw new Error("wrong ctext length");var t=$(e,16),i=this.doPrivate(t);return null==i?null:function(e,t){for(var i=e.toByteArray(),r=0;r<i.length&&0==i[r];)++r;if(i.length-r!=t-1||2!=i[r])return null;for(++r;0!=i[r];)if(++r>=i.length)return null;for(var n="";++r<i.length;){var o=255&i[r];o<128?n+=String.fromCharCode(o):o>191&&o<224?(n+=String.fromCharCode((31&o)<<6|63&i[r+1]),++r):(n+=String.fromCharCode((15&o)<<12|(63&i[r+1])<<6|63&i[r+2]),r+=2)}return n}(i,this.n.bitLength()+7>>3)},te.prototype.decryptOAEP=function(e,t,i){if(e.length!=Math.ceil(this.n.bitLength()/4))throw new Error("wrong ctext length");var r=$(e,16),n=this.doPrivate(r);return null==n?null:function(e,t,i,r){var n=f.crypto.MessageDigest,o=f.crypto.Util,s=null;for(i||(i="sha1"),"string"==typeof i&&(s=n.getCanonicalAlgName(i),r=n.getHashLength(s),i=function(e){return he(o.hashHex(de(e),s))}),e=e.toByteArray(),a=0;a<e.length;a+=1)e[a]&=255;for(;e.length<t;)e.unshift(0);if((e=String.fromCharCode.apply(String,e)).length<2*r+2)throw"Cipher too short";var a,l=e.substr(1,r),u=e.substr(r+1),c=ie(u,r,i),h=[];for(a=0;a<l.length;a+=1)h[a]=l.charCodeAt(a)^c.charCodeAt(a);var d=ie(String.fromCharCode.apply(String,h),e.length-r,i),p=[];for(a=0;a<u.length;a+=1)p[a]=u.charCodeAt(a)^d.charCodeAt(a);if((p=String.fromCharCode.apply(String,p)).substr(0,r)!==i(""))throw"Hash mismatch";var A=(p=p.substr(r)).indexOf("");if((-1!=A?p.substr(0,A).lastIndexOf("\0"):-1)+1!=A)throw"Malformed data";return p.substr(A+1)}(n,this.n.bitLength()+7>>3,t,i)},void 0!==f.lang&&f.lang||(f.lang={}),f.lang.String=function(){},f.lang.String.isInteger=function(e){return!!e.match(/^[0-9]+$/)||!!e.match(/^-[0-9]+$/)},f.lang.String.isHex=function(e){return ye(e)},f.lang.String.isBase64=function(e){return!(!(e=e.replace(/\s+/g,"")).match(/^[0-9A-Za-z+\/]+={0,3}$/)||e.length%4!=0)},f.lang.String.isBase64URL=function(e){return!e.match(/[+/=]/)&&(e=se(e),f.lang.String.isBase64(e))},f.lang.String.isIntegerArray=function(e){return!!(e=e.replace(/\s+/g,"")).match(/^\[[0-9,]+\]$/)},f.lang.String.isPrintable=function(e){return null!==e.match(/^[0-9A-Za-z '()+,-./:=?]*$/)},f.lang.String.isIA5=function(e){return null!==e.match(/^[\x20-\x21\x23-\x7f]*$/)},f.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 xe=function(e,t,i){return null==i&&(i="0"),e.length>=t?e:new Array(t-e.length+1).join(i)+e};function we(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!==f.crypto&&f.crypto||(f.crypto={}),f.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:g.algo.MD5,sha1:g.algo.SHA1,sha224:g.algo.SHA224,sha256:g.algo.SHA256,sha384:g.algo.SHA384,sha512:g.algo.SHA512,ripemd160:g.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 r=this.getDigestInfoHex(e,t),n=i/4;if(r.length+22>n)throw"key is too short for SigAlg: keylen="+i+","+t;for(var o="0001",s="00"+r,a="",l=n-o.length-s.length,u=0;u<l;u+=2)a+="ff";return o+a+s},this.hashString=function(e,t){return new f.crypto.MessageDigest({alg:t}).digestString(e)},this.hashHex=function(e,t){return new f.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 te||e instanceof f.crypto.DSA||e instanceof f.crypto.ECDSA}},f.crypto.Util.md5=function(e){return new f.crypto.MessageDigest({alg:"md5",prov:"cryptojs"}).digestString(e)},f.crypto.Util.ripemd160=function(e){return new f.crypto.MessageDigest({alg:"ripemd160",prov:"cryptojs"}).digestString(e)},f.crypto.Util.SECURERANDOMGEN=new J,f.crypto.Util.getRandomHexOfNbytes=function(e){var t=new Array(e);return f.crypto.Util.SECURERANDOMGEN.nextBytes(t),re(t)},f.crypto.Util.getRandomBigIntegerOfNbytes=function(e){return new m(f.crypto.Util.getRandomHexOfNbytes(e),16)},f.crypto.Util.getRandomHexOfNbits=function(e){var t=e%8,i=new Array((e-t)/8+1);return f.crypto.Util.SECURERANDOMGEN.nextBytes(i),i[0]=(255<<t&255^255)&i[0],re(i)},f.crypto.Util.getRandomBigIntegerOfNbits=function(e){return new m(f.crypto.Util.getRandomHexOfNbits(e),16)},f.crypto.Util.getRandomBigIntegerZeroToMax=function(e){for(var t=e.bitLength();;){var i=f.crypto.Util.getRandomBigIntegerOfNbits(t);if(-1!=e.compareTo(i))return i}},f.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 r=t.subtract(e);return f.crypto.Util.getRandomBigIntegerZeroToMax(r).add(e)},f.crypto.MessageDigest=function(e){this.setAlgAndProvider=function(e,t){if(null!==(e=f.crypto.MessageDigest.getCanonicalAlgName(e))&&void 0===t&&(t=f.crypto.Util.DEFAULTPROVIDER[e]),-1!=":md5:sha1:sha224:sha256:sha384:sha512:ripemd160:".indexOf(e)&&"cryptojs"==t){try{this.md=f.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=g.enc.Hex.parse(e);this.md.update(t)},this.digest=function(){return this.md.finalize().toString(g.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=f.crypto.Util.DEFAULTPROVIDER[this.algName]),this.setAlgAndProvider(this.algName,this.provName))},f.crypto.MessageDigest.getCanonicalAlgName=function(e){return"string"==typeof e&&(e=(e=e.toLowerCase()).replace(/-/,"")),e},f.crypto.MessageDigest.getHashLength=function(e){var t=f.crypto.MessageDigest,i=t.getCanonicalAlgName(e);if(void 0===t.HASHLENGTH[i])throw"not supported algorithm: "+e;return t.HASHLENGTH[i]},f.crypto.MessageDigest.HASHLENGTH={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,ripemd160:20},f.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=f.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 r=f.crypto.Util.CRYPTOJSMESSAGEDIGESTNAME[i];this.mac=g.algo.HMAC.create(r,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=g.enc.Hex.parse(e);this.mac.update(t)},this.doFinal=function(){return this.mac.finalize().toString(g.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=de(e)),void(this.pass=g.enc.Hex.parse(t))}if("object"!=typeof e)throw"KJUR.crypto.Mac unsupported password type: "+e;if(t=null,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=ue(e.utf8)),void 0!==e.rstr&&(t=de(e.rstr)),void 0!==e.b64&&(t=j(e.b64)),void 0!==e.b64u&&(t=le(e.b64u)),null==t)throw"KJUR.crypto.Mac unsupported password type: "+e;this.pass=g.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=f.crypto.Util.DEFAULTPROVIDER[this.algName]),this.setAlgAndProvider(this.algName,this.provName)))},f.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="",r=t/4-e.length,n=0;n<r;n++)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 f.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?Me.getKey(e):Me.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!==f.crypto.ECDSA&&(this.prvKey=new f.crypto.ECDSA({curve:this.eccurvename,prv:this.ecprvhex})),this.prvKey instanceof te&&"rsaandmgf1"===this.pubkeyAlgName)this.hSign=this.prvKey.signWithMessageHashPSS(this.sHashHex,this.mdAlgName,this.pssSaltLen);else if(this.prvKey instanceof te&&"rsa"===this.pubkeyAlgName)this.hSign=this.prvKey.signWithMessageHash(this.sHashHex,this.mdAlgName);else if(this.prvKey instanceof f.crypto.ECDSA)this.hSign=this.prvKey.signWithMessageHash(this.sHashHex);else{if(!(this.prvKey instanceof f.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!==f.crypto.ECDSA&&(this.pubKey=new f.crypto.ECDSA({curve:this.eccurvename,pub:this.ecpubhex})),this.pubKey instanceof te&&"rsaandmgf1"===this.pubkeyAlgName)return this.pubKey.verifyWithMessageHashPSS(this.sHashHex,e,this.mdAlgName,this.pssSaltLen);if(this.pubKey instanceof te&&"rsa"===this.pubkeyAlgName)return this.pubKey.verifyWithMessageHash(this.sHashHex,e);if(void 0!==f.crypto.ECDSA&&this.pubKey instanceof f.crypto.ECDSA)return this.pubKey.verifyWithMessageHash(this.sHashHex,e);if(void 0!==f.crypto.DSA&&this.pubKey instanceof f.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=f.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=Me.getKey(e.prvkeypem),this.init(t)}catch(e){throw"fatal error to load pem private key: "+e}}},f.crypto.Cipher=function(e){},f.crypto.Cipher.encrypt=function(e,t,i){if(t instanceof te&&t.isPublic){var r=f.crypto.Cipher.getAlgByKeyAndName(t,i);if("RSA"===r)return t.encrypt(e);if("RSAOAEP"===r)return t.encryptOAEP(e,"sha1");var n=r.match(/^RSAOAEP(\d+)$/);if(null!==n)return t.encryptOAEP(e,"sha"+n[1]);throw"Cipher.encrypt: unsupported algorithm for RSAKey: "+i}throw"Cipher.encrypt: unsupported key or algorithm"},f.crypto.Cipher.decrypt=function(e,t,i){if(t instanceof te&&t.isPrivate){var r=f.crypto.Cipher.getAlgByKeyAndName(t,i);if("RSA"===r)return t.decrypt(e);if("RSAOAEP"===r)return t.decryptOAEP(e,"sha1");var n=r.match(/^RSAOAEP(\d+)$/);if(null!==n)return t.decryptOAEP(e,"sha"+n[1]);throw"Cipher.decrypt: unsupported algorithm for RSAKey: "+i}throw"Cipher.decrypt: unsupported key or algorithm"},f.crypto.Cipher.getAlgByKeyAndName=function(e,t){if(e instanceof te){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},f.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 Me=function(){var e=function(e,i,r){return t(g.AES,e,i,r)},t=function(e,t,i,r){var n=g.enc.Hex.parse(t),o=g.enc.Hex.parse(i),s=g.enc.Hex.parse(r),a={};a.key=o,a.iv=s,a.ciphertext=n;var l=e.decrypt(a,o,{iv:s});return g.enc.Hex.stringify(l)},i=function(e,t,i){return r(g.AES,e,t,i)},r=function(e,t,i,r){var n=g.enc.Hex.parse(t),o=g.enc.Hex.parse(i),s=g.enc.Hex.parse(r),a=e.encrypt(n,o,{iv:s}),l=g.enc.Hex.parse(a.toString());return g.enc.Base64.stringify(l)},n={"AES-256-CBC":{proc:e,eproc:i,keylen:32,ivlen:16},"AES-192-CBC":{proc:e,eproc:i,keylen:24,ivlen:16},"AES-128-CBC":{proc:e,eproc:i,keylen:16,ivlen:16},"DES-EDE3-CBC":{proc:function(e,i,r){return t(g.TripleDES,e,i,r)},eproc:function(e,t,i){return r(g.TripleDES,e,t,i)},keylen:24,ivlen:8},"DES-CBC":{proc:function(e,i,r){return t(g.DES,e,i,r)},eproc:function(e,t,i){return r(g.DES,e,t,i)},keylen:8,ivlen:8}},o=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 r=e.match(new RegExp("-----BEGIN ([A-Z]+) PRIVATE KEY-----"));r&&(t.type=r[1]);var n=-1,o=0;-1!=e.indexOf("\r\n\r\n")&&(n=e.indexOf("\r\n\r\n"),o=2),-1!=e.indexOf("\n\n")&&(n=e.indexOf("\n\n"),o=1);var s=e.indexOf("-----END");if(-1!=n&&-1!=s){var a=e.substring(n+2*o,s-o);a=a.replace(/\s+/g,""),t.data=a}return t},s=function(e,t,i){for(var r=i.substring(0,16),o=g.enc.Hex.parse(r),s=g.enc.Utf8.parse(t),a=n[e].keylen+n[e].ivlen,l="",u=null;;){var c=g.algo.MD5.create();if(null!=u&&c.update(u),c.update(s),c.update(o),u=c.finalize(),(l+=g.enc.Hex.stringify(u)).length>=2*a)break}var h={};return h.keyhex=l.substr(0,2*n[e].keylen),h.ivhex=l.substr(2*n[e].keylen,2*n[e].ivlen),h},a=function(e,t,i,r){var o=g.enc.Base64.parse(e),s=g.enc.Hex.stringify(o);return(0,n[t].proc)(s,i,r)};return{version:"1.0.0",parsePKCS5PEM:function(e){return o(e)},getKeyAndUnusedIvByPasscodeAndIvsalt:function(e,t,i){return s(e,t,i)},decryptKeyB64:function(e,t,i,r){return a(e,t,i,r)},getDecryptedKeyHex:function(e,t){var i=o(e),r=(i.type,i.cipher),n=i.ivsalt,l=i.data,u=s(r,t,n).keyhex;return a(l,r,u,n)},getEncryptedPKCS5PEMFromPrvKeyHex:function(e,t,i,r,o){var a="";if(void 0!==r&&null!=r||(r="AES-256-CBC"),void 0===n[r])throw"KEYUTIL unsupported algorithm: "+r;if(void 0===o||null==o){var l=function(e){var t=g.lib.WordArray.random(e);return g.enc.Hex.stringify(t)}(n[r].ivlen);o=l.toUpperCase()}var u=function(e,t,i,r){return(0,n[t].eproc)(e,i,r)}(t,r,s(r,i,o).keyhex,o);return a="-----BEGIN "+e+" PRIVATE KEY-----\r\n",a+="Proc-Type: 4,ENCRYPTED\r\n",a+="DEK-Info: "+r+","+o+"\r\n",a+="\r\n",(a+=u.replace(/(.{64})/g,"$1\r\n"))+"\r\n-----END "+e+" PRIVATE KEY-----\r\n"},parseHexOfEncryptedPKCS8:function(e){var t=Ee,i=t.getChildIdx,r=t.getV,n={},o=i(e,0);if(2!=o.length)throw"malformed format: SEQUENCE(0).items != 2: "+o.length;n.ciphertext=r(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"!=r(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"!=r(e,l[0]))throw"this only supports TripleDES";n.encryptionSchemeAlg="TripleDES",n.encryptionSchemeIV=r(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"!=r(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;n.pbkdf2Salt=r(e,c[0]);var h=r(e,c[1]);try{n.pbkdf2Iter=parseInt(h,16)}catch(e){throw"malformed format pbkdf2Iter: "+h}return n},getPBKDF2KeyHexFromParam:function(e,t){var i=g.enc.Hex.parse(e.pbkdf2Salt),r=e.pbkdf2Iter,n=g.PBKDF2(t,i,{keySize:6,iterations:r});return g.enc.Hex.stringify(n)},_getPlainPKCS8HexFromEncryptedPKCS8PEM:function(e,t){var i=fe(e,"ENCRYPTED PRIVATE KEY"),r=this.parseHexOfEncryptedPKCS8(i),n=Me.getPBKDF2KeyHexFromParam(r,t),o={};o.ciphertext=g.enc.Hex.parse(r.ciphertext);var s=g.enc.Hex.parse(n),a=g.enc.Hex.parse(r.encryptionSchemeIV),l=g.TripleDES.decrypt(o,s,{iv:a});return g.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,r=t.getV,n={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(n.algoid=r(e,s[0]),"06"==e.substr(s[1],2)&&(n.algparam=r(e,s[1])),"04"!=e.substr(o[2],2))throw new Error("malformed PKCS8 private key(code:006)");return n.keyidx=t.getVidx(e,o[2]),n},getKeyFromPlainPrivatePKCS8PEM:function(e){var t=fe(e,"PRIVATE KEY");return this.getKeyFromPlainPrivatePKCS8Hex(t)},getKeyFromPlainPrivatePKCS8Hex:function(e){var t,i=this.parsePlainPrivatePKCS8Hex(e);if("2a864886f70d010101"==i.algoid)t=new te;else if("2a8648ce380401"==i.algoid)t=new f.crypto.DSA;else{if("2a8648ce3d0201"!=i.algoid)throw"unsupported private key algorithm";t=new f.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 te;else if("2a8648ce380401"===i)t=new f.crypto.DSA;else{if("2a8648ce3d0201"!==i)throw"unsupported PKCS#8 public key hex";t=new f.crypto.ECDSA}return t.readPKCS8PubKeyHex(e),t},parsePublicRawRSAKeyHex:function(e){var t=Ee,i=t.getChildIdx,r=t.getV,n={};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(n.n=r(e,o[0]),"02"!=e.substr(o[1],2))throw"malformed RSA key(code:004)";return n.e=r(e,o[1]),n},parsePublicPKCS8Hex:function(e){var t=Ee,i=t.getChildIdx,r=t.getV,n={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(n.algoid=r(e,a[0]),"06"==e.substr(a[1],2)?n.algparam=r(e,a[1]):"30"==e.substr(a[1],2)&&(n.algparam={},n.algparam.p=t.getVbyList(e,a[1],[0],"02"),n.algparam.q=t.getVbyList(e,a[1],[1],"02"),n.algparam.g=t.getVbyList(e,a[1],[2],"02")),"03"!=e.substr(o[1],2))throw"malformed PKCS8 public key(code:004)";return n.key=r(e,o[1]).substr(2),n}}}();Me.getKey=function(e,t,i){var r,n=(y=Ee).getChildIdx,o=(y.getV,y.getVbyList),s=f.crypto,a=s.ECDSA,l=s.DSA,u=te,c=fe,h=Me;if(void 0!==u&&e instanceof u)return e;if(void 0!==a&&e instanceof a)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 a({pub:e.xy,curve:e.curve});if(void 0!==e.curve&&void 0!==e.d)return new a({prv:e.d,curve:e.curve});if(void 0===e.kty&&void 0!==e.n&&void 0!==e.e&&void 0===e.d)return(P=new u).setPublic(e.n,e.e),P;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(P=new u).setPrivateEx(e.n,e.e,e.d,e.p,e.q,e.dp,e.dq,e.co),P;if(void 0===e.kty&&void 0!==e.n&&void 0!==e.e&&void 0!==e.d&&void 0===e.p)return(P=new u).setPrivate(e.n,e.e,e.d),P;if(void 0!==e.p&&void 0!==e.q&&void 0!==e.g&&void 0!==e.y&&void 0===e.x)return(P=new l).setPublic(e.p,e.q,e.g,e.y),P;if(void 0!==e.p&&void 0!==e.q&&void 0!==e.g&&void 0!==e.y&&void 0!==e.x)return(P=new l).setPrivate(e.p,e.q,e.g,e.y,e.x),P;if("RSA"===e.kty&&void 0!==e.n&&void 0!==e.e&&void 0===e.d)return(P=new u).setPublic(le(e.n),le(e.e)),P;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(P=new u).setPrivateEx(le(e.n),le(e.e),le(e.d),le(e.p),le(e.q),le(e.dp),le(e.dq),le(e.qi)),P;if("RSA"===e.kty&&void 0!==e.n&&void 0!==e.e&&void 0!==e.d)return(P=new u).setPrivate(le(e.n),le(e.e),le(e.d)),P;if("EC"===e.kty&&void 0!==e.crv&&void 0!==e.x&&void 0!==e.y&&void 0===e.d){var d=(T=new a({curve:e.crv})).ecparams.keylen/4,p="04"+("0000000000"+le(e.x)).slice(-d)+("0000000000"+le(e.y)).slice(-d);return T.setPublicKeyHex(p),T}if("EC"===e.kty&&void 0!==e.crv&&void 0!==e.x&&void 0!==e.y&&void 0!==e.d){d=(T=new a({curve:e.crv})).ecparams.keylen/4,p="04"+("0000000000"+le(e.x)).slice(-d)+("0000000000"+le(e.y)).slice(-d);var A=("0000000000"+le(e.d)).slice(-d);return T.setPublicKeyHex(p),T.setPrivateKeyHex(A),T}if("pkcs5prv"===i){var g,v=e,y=Ee;if(9===(g=n(v,0)).length)(P=new u).readPKCS5PrvKeyHex(v);else if(6===g.length)(P=new l).readPKCS5PrvKeyHex(v);else{if(!(g.length>2&&"04"===v.substr(g[1],2)))throw"unsupported PKCS#1/5 hexadecimal key";(P=new a).readPKCS5PrvKeyHex(v)}return P}if("pkcs8prv"===i)return h.getKeyFromPlainPrivatePKCS8Hex(e);if("pkcs8pub"===i)return h._getKeyFromPublicPKCS8Hex(e);if("x509pub"===i)return Be.getPublicKeyFromCertHex(e);if(-1!=e.indexOf("-END CERTIFICATE-",0)||-1!=e.indexOf("-END X509 CERTIFICATE-",0)||-1!=e.indexOf("-END TRUSTED CERTIFICATE-",0))return Be.getPublicKeyFromCertPEM(e);if(-1!=e.indexOf("-END PUBLIC KEY-")){var b=fe(e,"PUBLIC KEY");return h._getKeyFromPublicPKCS8Hex(b)}if(-1!=e.indexOf("-END RSA PRIVATE KEY-")&&-1==e.indexOf("4,ENCRYPTED")){var x=c(e,"RSA PRIVATE KEY");return h.getKey(x,null,"pkcs5prv")}if(-1!=e.indexOf("-END DSA PRIVATE KEY-")&&-1==e.indexOf("4,ENCRYPTED")){var w=o(r=c(e,"DSA PRIVATE KEY"),0,[1],"02"),M=o(r,0,[2],"02"),E=o(r,0,[3],"02"),S=o(r,0,[4],"02"),C=o(r,0,[5],"02");return(P=new l).setPrivate(new m(w,16),new m(M,16),new m(E,16),new m(S,16),new m(C,16)),P}if(-1!=e.indexOf("-END EC PRIVATE KEY-")&&-1==e.indexOf("4,ENCRYPTED"))return x=c(e,"EC PRIVATE KEY"),h.getKey(x,null,"pkcs5prv");if(-1!=e.indexOf("-END PRIVATE KEY-"))return h.getKeyFromPlainPrivatePKCS8PEM(e);if(-1!=e.indexOf("-END RSA PRIVATE KEY-")&&-1!=e.indexOf("4,ENCRYPTED")){var I=h.getDecryptedKeyHex(e,t),B=new te;return B.readPKCS5PrvKeyHex(I),B}if(-1!=e.indexOf("-END EC PRIVATE KEY-")&&-1!=e.indexOf("4,ENCRYPTED")){var T,P=o(r=h.getDecryptedKeyHex(e,t),0,[1],"04"),R=o(r,0,[2,0],"06"),D=o(r,0,[3,0],"03").substr(2);if(void 0===f.crypto.OID.oidhex2name[R])throw"undefined OID(hex) in KJUR.crypto.OID: "+R;return(T=new a({curve:f.crypto.OID.oidhex2name[R]})).setPublicKeyHex(D),T.setPrivateKeyHex(P),T.isPublic=!1,T}if(-1!=e.indexOf("-END DSA PRIVATE KEY-")&&-1!=e.indexOf("4,ENCRYPTED"))return w=o(r=h.getDecryptedKeyHex(e,t),0,[1],"02"),M=o(r,0,[2],"02"),E=o(r,0,[3],"02"),S=o(r,0,[4],"02"),C=o(r,0,[5],"02"),(P=new l).setPrivate(new m(w,16),new m(M,16),new m(E,16),new m(S,16),new m(C,16)),P;if(-1!=e.indexOf("-END ENCRYPTED PRIVATE KEY-"))return h.getKeyFromEncryptedPKCS8PEM(e,t);throw new Error("not supported argument")},Me.generateKeypair=function(e,t){if("RSA"==e){var i=t;(s=new te).generate(i,"10001"),s.isPrivate=!0,s.isPublic=!0;var r=new te,n=s.n.toString(16),o=s.e.toString(16);return r.setPublic(n,o),r.isPrivate=!1,r.isPublic=!0,(a={}).prvKeyObj=s,a.pubKeyObj=r,a}if("EC"==e){var s,a,l=t,u=new f.crypto.ECDSA({curve:l}).generateKeyPairHex();return(s=new f.crypto.ECDSA({curve:l})).setPublicKeyHex(u.ecpubhex),s.setPrivateKeyHex(u.ecprvhex),s.isPrivate=!0,s.isPublic=!1,(r=new f.crypto.ECDSA({curve:l})).setPublicKeyHex(u.ecpubhex),r.isPrivate=!1,r.isPublic=!0,(a={}).prvKeyObj=s,a.pubKeyObj=r,a}throw"unknown algorithm: "+e},Me.getPEM=function(e,t,i,r,n,o){var s=f,a=s.asn1,l=a.DERObjectIdentifier,u=a.DERInteger,c=a.ASN1Util.newObject,h=a.x509.SubjectPublicKeyInfo,d=s.crypto,p=d.DSA,A=d.ECDSA,m=te;function v(e){return c({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 c({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 c({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!==p&&e instanceof p||void 0!==A&&e instanceof A)&&1==e.isPublic&&(void 0===t||"PKCS8PUB"==t))return pe(E=new h(e).getEncodedHex(),"PUBLIC KEY");if("PKCS1PRV"==t&&void 0!==m&&e instanceof m&&(void 0===i||null==i)&&1==e.isPrivate)return pe(E=v(e).getEncodedHex(),"RSA PRIVATE KEY");if("PKCS1PRV"==t&&void 0!==A&&e instanceof A&&(void 0===i||null==i)&&1==e.isPrivate){var x=new l({name:e.curveName}).getEncodedHex(),w=y(e).getEncodedHex(),M="";return(M+=pe(x,"EC PARAMETERS"))+pe(w,"EC PRIVATE KEY")}if("PKCS1PRV"==t&&void 0!==p&&e instanceof p&&(void 0===i||null==i)&&1==e.isPrivate)return pe(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===r&&(r="DES-EDE3-CBC"),this.getEncryptedPKCS5PEMFromPrvKeyHex("RSA",E,i,r,o)}if("PKCS5PRV"==t&&void 0!==A&&e instanceof A&&void 0!==i&&null!=i&&1==e.isPrivate)return E=y(e).getEncodedHex(),void 0===r&&(r="DES-EDE3-CBC"),this.getEncryptedPKCS5PEMFromPrvKeyHex("EC",E,i,r,o);if("PKCS5PRV"==t&&void 0!==p&&e instanceof p&&void 0!==i&&null!=i&&1==e.isPrivate)return E=b(e).getEncodedHex(),void 0===r&&(r="DES-EDE3-CBC"),this.getEncryptedPKCS5PEMFromPrvKeyHex("DSA",E,i,r,o);var S=function(e,t){var i=C(e,t);return new c({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=g.lib.WordArray.random(8),r=g.lib.WordArray.random(8),n=g.PBKDF2(t,i,{keySize:6,iterations:100}),o=g.enc.Hex.parse(e),s=g.TripleDES.encrypt(o,n,{iv:r})+"",a={};return a.ciphertext=s,a.pbkdf2Salt=g.enc.Hex.stringify(i),a.pbkdf2Iter=100,a.encryptionSchemeAlg="DES-EDE3-CBC",a.encryptionSchemeIV=g.enc.Hex.stringify(r),a};if("PKCS8PRV"==t&&null!=m&&e instanceof m&&1==e.isPrivate){var I=v(e).getEncodedHex();return E=c({seq:[{int:0},{seq:[{oid:{name:"rsaEncryption"}},{null:!0}]},{octstr:{hex:I}}]}).getEncodedHex(),void 0===i||null==i?pe(E,"PRIVATE KEY"):pe(w=S(E,i),"ENCRYPTED PRIVATE KEY")}if("PKCS8PRV"==t&&void 0!==A&&e instanceof A&&1==e.isPrivate)return I=new c({seq:[{int:1},{octstr:{hex:e.prvKeyHex}},{tag:["a1",!0,{bitstr:{hex:"00"+e.pubKeyHex}}]}]}).getEncodedHex(),E=c({seq:[{int:0},{seq:[{oid:{name:"ecPublicKey"}},{oid:{name:e.curveName}}]},{octstr:{hex:I}}]}).getEncodedHex(),void 0===i||null==i?pe(E,"PRIVATE KEY"):pe(w=S(E,i),"ENCRYPTED PRIVATE KEY");if("PKCS8PRV"==t&&void 0!==p&&e instanceof p&&1==e.isPrivate)return I=new u({bigint:e.x}).getEncodedHex(),E=c({seq:[{int:0},{seq:[{oid:{name:"dsa"}},{seq:[{int:{bigint:e.p}},{int:{bigint:e.q}},{int:{bigint:e.g}}]}]},{octstr:{hex:I}}]}).getEncodedHex(),void 0===i||null==i?pe(E,"PRIVATE KEY"):pe(w=S(E,i),"ENCRYPTED PRIVATE KEY");throw new Error("unsupported object nor format")},Me.getKeyFromCSRPEM=function(e){var t=fe(e,"CERTIFICATE REQUEST");return Me.getKeyFromCSRHex(t)},Me.getKeyFromCSRHex=function(e){var t=Me.parseCSRHex(e);return Me.getKey(t.p8pubkeyhex,null,"pkcs8pub")},Me.parseCSRHex=function(e){var t=Ee,i=t.getChildIdx,r=t.getTLV,n={},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 n.p8pubkeyhex=r(o,a[2]),n},Me.getKeyID=function(e){var t=Me,i=Ee;"string"==typeof e&&-1!=e.indexOf("BEGIN ")&&(e=t.getKey(e));var r=fe(t.getPEM(e)),n=i.getIdxbyList(r,0,[1]),o=i.getV(r,n).substring(2);return f.crypto.Util.hashHex(o,"sha1")},Me.getJWKFromKey=function(e){var t={};if(e instanceof te&&e.isPrivate)return t.kty="RSA",t.n=ae(e.n.toString(16)),t.e=ae(e.e.toString(16)),t.d=ae(e.d.toString(16)),t.p=ae(e.p.toString(16)),t.q=ae(e.q.toString(16)),t.dp=ae(e.dmp1.toString(16)),t.dq=ae(e.dmq1.toString(16)),t.qi=ae(e.coeff.toString(16)),t;if(e instanceof te&&e.isPublic)return t.kty="RSA",t.n=ae(e.n.toString(16)),t.e=ae(e.e.toString(16)),t;if(e instanceof f.crypto.ECDSA&&e.isPrivate){if("P-256"!==(r=e.getShortNISTPCurveName())&&"P-384"!==r)throw"unsupported curve name for JWT: "+r;var i=e.getPublicKeyXYHex();return t.kty="EC",t.crv=r,t.x=ae(i.x),t.y=ae(i.y),t.d=ae(e.prvKeyHex),t}if(e instanceof f.crypto.ECDSA&&e.isPublic){var r;if("P-256"!==(r=e.getShortNISTPCurveName())&&"P-384"!==r)throw"unsupported curve name for JWT: "+r;return i=e.getPublicKeyXYHex(),t.kty="EC",t.crv=r,t.x=ae(i.x),t.y=ae(i.y),t}throw"not supported key object"},void 0!==f.asn1&&f.asn1||(f.asn1={}),f.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 r="",n=0;n<i;n++)r+="f";t=new m(r,16).xor(e).add(m.ONE).toString(16).replace(/^-/,"")}return t},this.getPEMStringFromHex=function(e,t){return pe(e,t)},this.newObject=function(e){var t=f.asn1,i=t.ASN1Object,r=t.DERBoolean,n=t.DERInteger,o=t.DERBitString,s=t.DEROctetString,a=t.DERNull,l=t.DERObjectIdentifier,u=t.DEREnumerated,c=t.DERUTF8String,h=t.DERNumericString,d=t.DERPrintableString,p=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 r(e[S]);if("int"==S)return new n(e[S]);if("bitstr"==S)return new o(e[S]);if("octstr"==S)return new s(e[S]);if("null"==S)return new a(e[S]);if("oid"==S)return new l(e[S]);if("enum"==S)return new u(e[S]);if("utf8str"==S)return new c(e[S]);if("numstr"==S)return new h(e[S]);if("prnstr"==S)return new d(e[S]);if("telstr"==S)return new p(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()}},f.asn1.ASN1Util.oidHexToInt=function(e){for(var t="",i=parseInt(e.substr(0,2),16),r=(t=Math.floor(i/40)+"."+i%40,""),n=2;n<e.length;n+=2){var o=("00000000"+parseInt(e.substr(n,2),16).toString(2)).slice(-8);r+=o.substr(1,7),"0"==o.substr(0,1)&&(t=t+"."+new m(r,2).toString(10),r="")}return t},f.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="",r=new m(e,10).toString(2),n=7-r.length%7;7==n&&(n=0);for(var o="",s=0;s<n;s++)o+="0";for(r=o+r,s=0;s<r.length-1;s+=7){var a=r.substr(s,7);s!=r.length-7&&(a="1"+a),i+=t(parseInt(a,2))}return i};if(!e.match(/^[0-9.]+$/))throw"malformed oid string: "+e;var r="",n=e.split("."),o=40*parseInt(n[0])+parseInt(n[1]);r+=t(o),n.splice(0,2);for(var s=0;s<n.length;s++)r+=i(n[s]);return r},f.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)},f.asn1.DERAbstractString=function(e){f.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=ue(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))},A.lang.extend(f.asn1.DERAbstractString,f.asn1.ASN1Object),f.asn1.DERAbstractTime=function(e){f.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 r=this.zeroPadding,n=this.localDateToUTC(e),o=String(n.getFullYear());"utc"==t&&(o=o.substr(2,2));var s=o+r(String(n.getMonth()+1),2)+r(String(n.getDate()),2)+r(String(n.getHours()),2)+r(String(n.getMinutes()),2)+r(String(n.getSeconds()),2);if(!0===i){var a=n.getMilliseconds();if(0!=a){var l=r(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=ne(e)},this.setByDateValue=function(e,t,i,r,n,o){var s=new Date(Date.UTC(e,t-1,i,r,n,o,0));this.setByDate(s)},this.getFreshValueHex=function(){return this.hV}},A.lang.extend(f.asn1.DERAbstractTime,f.asn1.ASN1Object),f.asn1.DERAbstractStructured=function(e){f.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)},A.lang.extend(f.asn1.DERAbstractStructured,f.asn1.ASN1Object),f.asn1.DERBoolean=function(e){f.asn1.DERBoolean.superclass.constructor.call(this),this.hT="01",this.hTLV=0==e?"010100":"0101ff"},A.lang.extend(f.asn1.DERBoolean,f.asn1.ASN1Object),f.asn1.DERInteger=function(e){f.asn1.DERInteger.superclass.constructor.call(this),this.hT="02",this.setByBigInteger=function(e){this.hTLV=null,this.isModified=!0,this.hV=f.asn1.ASN1Util.bigIntToMinTwosComplementsHex(e)},this.setByInteger=function(e){var t=new m(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))},A.lang.extend(f.asn1.DERInteger,f.asn1.ASN1Object),f.asn1.DERBitString=function(e){if(void 0!==e&&void 0!==e.obj){var t=f.asn1.ASN1Util.newObject(e.obj);e.hex="00"+t.getEncodedHex()}f.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 r="";for(i=0;i<e.length-1;i+=8){var n=e.substr(i,8),o=parseInt(n,2).toString(16);1==o.length&&(o="0"+o),r+=o}this.hTLV=null,this.isModified=!0,this.hV="0"+t+r},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))},A.lang.extend(f.asn1.DERBitString,f.asn1.ASN1Object),f.asn1.DEROctetString=function(e){if(void 0!==e&&void 0!==e.obj){var t=f.asn1.ASN1Util.newObject(e.obj);e.hex=t.getEncodedHex()}f.asn1.DEROctetString.superclass.constructor.call(this,e),this.hT="04"},A.lang.extend(f.asn1.DEROctetString,f.asn1.DERAbstractString),f.asn1.DERNull=function(){f.asn1.DERNull.superclass.constructor.call(this),this.hT="05",this.hTLV="0500"},A.lang.extend(f.asn1.DERNull,f.asn1.ASN1Object),f.asn1.DERObjectIdentifier=function(e){f.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="",r=parseInt(e,10).toString(2),n=7-r.length%7;7==n&&(n=0);for(var o="",s=0;s<n;s++)o+="0";for(r=o+r,s=0;s<r.length-1;s+=7){var a=r.substr(s,7);s!=r.length-7&&(a="1"+a),i+=t(parseInt(a,2))}return i};try{if(!e.match(/^[0-9.]+$/))return null;var r="",n=e.split("."),o=40*parseInt(n[0],10)+parseInt(n[1],10);r+=t(o),n.splice(0,2);for(var s=0;s<n.length;s++)r+=i(n[s]);return r}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=f.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)},A.lang.extend(f.asn1.DERObjectIdentifier,f.asn1.ASN1Object),f.asn1.DEREnumerated=function(e){f.asn1.DEREnumerated.superclass.constructor.call(this),this.hT="0a",this.setByBigInteger=function(e){this.hTLV=null,this.isModified=!0,this.hV=f.asn1.ASN1Util.bigIntToMinTwosComplementsHex(e)},this.setByInteger=function(e){var t=new m(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))},A.lang.extend(f.asn1.DEREnumerated,f.asn1.ASN1Object),f.asn1.DERUTF8String=function(e){f.asn1.DERUTF8String.superclass.constructor.call(this,e),this.hT="0c"},A.lang.extend(f.asn1.DERUTF8String,f.asn1.DERAbstractString),f.asn1.DERNumericString=function(e){f.asn1.DERNumericString.superclass.constructor.call(this,e),this.hT="12"},A.lang.extend(f.asn1.DERNumericString,f.asn1.DERAbstractString),f.asn1.DERPrintableString=function(e){f.asn1.DERPrintableString.superclass.constructor.call(this,e),this.hT="13"},A.lang.extend(f.asn1.DERPrintableString,f.asn1.DERAbstractString),f.asn1.DERTeletexString=function(e){f.asn1.DERTeletexString.superclass.constructor.call(this,e),this.hT="14"},A.lang.extend(f.asn1.DERTeletexString,f.asn1.DERAbstractString),f.asn1.DERIA5String=function(e){f.asn1.DERIA5String.superclass.constructor.call(this,e),this.hT="16"},A.lang.extend(f.asn1.DERIA5String,f.asn1.DERAbstractString),f.asn1.DERVisibleString=function(e){f.asn1.DERIA5String.superclass.constructor.call(this,e),this.hT="1a"},A.lang.extend(f.asn1.DERVisibleString,f.asn1.DERAbstractString),f.asn1.DERBMPString=function(e){f.asn1.DERBMPString.superclass.constructor.call(this,e),this.hT="1e"},A.lang.extend(f.asn1.DERBMPString,f.asn1.DERAbstractString),f.asn1.DERUTCTime=function(e){f.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=ne(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=ne(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))},A.lang.extend(f.asn1.DERUTCTime,f.asn1.DERAbstractTime),f.asn1.DERGeneralizedTime=function(e){f.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=ne(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=ne(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))},A.lang.extend(f.asn1.DERGeneralizedTime,f.asn1.DERAbstractTime),f.asn1.DERSequence=function(e){f.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}},A.lang.extend(f.asn1.DERSequence,f.asn1.DERAbstractStructured),f.asn1.DERSet=function(e){f.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)},A.lang.extend(f.asn1.DERSet,f.asn1.DERAbstractStructured),f.asn1.DERTaggedObject=function(e){f.asn1.DERTaggedObject.superclass.constructor.call(this);var t=f.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)},A.lang.extend(f.asn1.DERTaggedObject,f.asn1.ASN1Object);var Ee=new function(){};function Se(e,t){for(var i="",r=t/4-e.length,n=0;n<r;n++)i+="0";return i+e}function Ce(e,t,i){for(var r="",n=0;r.length<t;)r+=he(i(de(e+String.fromCharCode.apply(String,[(4278190080&n)>>24,(16711680&n)>>16,(65280&n)>>8,255&n])))),n+=1;return r}function Ie(e){for(var t in f.crypto.Util.DIGESTINFOHEAD){var i=f.crypto.Util.DIGESTINFOHEAD[t],r=i.length;if(e.substring(0,r)==i)return[t,e.substring(r)]}return[]}function Be(e){var t,i=Ee,r=i.getChildIdx,n=i.getV,o=i.getTLV,s=i.getVbyList,a=i.getVbyListEx,l=i.getTLVbyList,u=i.getTLVbyListEx,c=i.getIdxbyList,h=i.getIdxbyListEx,d=i.getVidx,p=i.getInt,A=i.oidname,g=i.hextooidstr,m=fe;try{t=f.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=l(this.hex,0,[0,0]);if("a0"==e.substr(0,2)){var t=l(e,0,[0]),i=p(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 a(this.hex,0,[0,0],"02")},this.getSignatureAlgorithmField=function(){var e=u(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(a(e,0,[0],"06"))},this.getIssuer=function(){return this.getX500Name(this.getIssuerHex())},this.getIssuerHex=function(){return l(this.hex,0,[0,3+this.foffset],"30")},this.getIssuerString=function(){return this.getIssuer().str},this.getSubject=function(){return this.getX500Name(this.getSubjectHex())},this.getSubjectHex=function(){return l(this.hex,0,[0,5+this.foffset],"30")},this.getSubjectString=function(){return this.getSubject().str},this.getNotBefore=function(){var e=s(this.hex,0,[0,4+this.foffset,0]);return e=e.replace(/(..)/g,"%$1"),decodeURIComponent(e)},this.getNotAfter=function(){var e=s(this.hex,0,[0,4+this.foffset,1]);return e=e.replace(/(..)/g,"%$1"),decodeURIComponent(e)},this.getPublicKeyHex=function(){return i.getTLVbyList(this.hex,0,[0,6+this.foffset],"30")},this.getPublicKeyIdx=function(){return c(this.hex,0,[0,6+this.foffset],"30")},this.getPublicKeyContentIdx=function(){var e=this.getPublicKeyIdx();return c(this.hex,e,[1,0],"30")},this.getPublicKey=function(){return Me.getKey(this.getPublicKeyHex(),null,"pkcs8pub")},this.getSignatureAlgorithmName=function(){var e=l(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(),r=l(this.hex,0,[0],"30"),n=new f.crypto.Signature({alg:t});return n.init(e),n.updateHex(r),n.verify(i)},this.parseExt=function(e){var t,o,a;if(void 0===e){if(a=this.hex,3!==this.version)return-1;t=c(a,0,[0,7,0],"30"),o=r(a,t)}else{a=fe(e);var l=c(a,0,[0,3,0,0],"06");if("2a864886f70d01090e"!=n(a,l))return void(this.aExtInfo=new Array);t=c(a,0,[0,3,0,1,0],"30"),o=r(a,t),this.hex=a}this.aExtInfo=new Array;for(var u=0;u<o.length;u++){var h={critical:!1},p=0;3===r(a,o[u]).length&&(h.critical=!0,p=1),h.oid=i.hextooidstr(s(a,o[u],[0],"06"));var f=c(a,o[u],[1+p]);h.vidx=d(a,f),this.aExtInfo.push(h)}},this.getExtInfo=function(e){var t=this.aExtInfo,i=e;if(e.match(/^[0-9.]+$/)||(i=f.asn1.x509.OID.name2oid(e)),""!==i)for(var r=0;r<t.length;r++)if(t[r].oid===i)return t[r]},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 r={extname:"basicConstraints"};if(t&&(r.critical=!0),"3000"===e)return r;if("30030101ff"===e)return r.cA=!0,r;if("30060101ff02"===e.substr(0,12)){var s=n(e,10),a=parseInt(s,16);return r.cA=!0,r.pathLen=a,r}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 r={extname:"keyUsage"};return t&&(r.critical=!0),r.names=this.getExtKeyUsageString(e).split(","),r},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,r=0;r<t.length;r++)"1"==t.substr(r,1)&&i.push(Be.KEYUSAGE_NAME[r]);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 r={extname:"subjectKeyIdentifier"};t&&(r.critical=!0);var s=n(e,0);return r.kid={hex:s},r},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=r(e,0),l=0;l<a.length;l++){var u=e.substr(a[l],2);if("80"===u&&(s.kid={hex:n(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:n(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=r(e,0),l=0;l<a.length;l++)s.array.push(A(n(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=r(i,0),a=0;a<s.length;a++)t.push(A(n(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 r={extname:"subjectAltName",array:[]};return t&&(r.critical=!0),r.array=this.getGeneralNames(e),r},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 r={extname:"issuerAltName",array:[]};return t&&(r.critical=!0),r.array=this.getGeneralNames(e),r},this.getGeneralNames=function(e){for(var t=r(e,0),i=[],n=0;n<t.length;n++){var s=this.getGeneralName(o(e,t[n]));void 0!==s&&i.push(s)}return i},this.getGeneralName=function(e){var t=e.substr(0,2),i=n(e,0),r=he(i);return"81"==t?{rfc822:r}:"82"==t?{dns:r}:"86"==t?{uri:r}:"87"==t?{ip:ge(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=r(l,0),c=0;c<u.length;c++)i=l.substr(u[c],2),e=n(l,u[c]),"81"===i&&(t=ce(e),a.push(["MAIL",t])),"82"===i&&(t=ce(e),a.push(["DNS",t])),"84"===i&&(t=Be.hex2dn(e,0),a.push(["DN",t])),"86"===i&&(t=ce(e),a.push(["URI",t])),"87"===i&&(t=ge(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 n={extname:"cRLDistributionPoints",array:[]};t&&(n.critical=!0);for(var s=r(e,0),a=0;a<s.length;a++){var l=o(e,s[a]);n.array.push(this.getDistributionPoint(l))}return n},this.getDistributionPoint=function(e){for(var t={},i=r(e,0),n=0;n<i.length;n++){var s=e.substr(i[n],2),a=o(e,i[n]);"a0"==s&&(t.dpname=this.getDistributionPointName(a))}return t},this.getDistributionPointName=function(e){for(var t={},i=r(e,0),n=0;n<i.length;n++){var s=e.substr(i[n],2),a=o(e,i[n]);"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=r(this.hex,e.vidx),n=0;n<i.length;n++)try{var o=ce(s(this.hex,i[n],[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=r(this.hex,e.vidx),n=0;n<i.length;n++){var o=s(this.hex,i[n],[0],"06"),a=s(this.hex,i[n],[1],"86");"2b06010505073001"===o&&t.ocsp.push(ce(a)),"2b06010505073002"===o&&t.caissuer.push(ce(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 n={extname:"authorityInfoAccess",array:[]};t&&(n.critical=!0);for(var l=r(e,0),u=0;u<l.length;u++){var c=a(e,l[u],[0],"06"),h=ce(s(e,l[u],[1],"86"));if("2b06010505073001"==c)n.array.push({ocsp:h});else{if("2b06010505073002"!=c)throw new Error("unknown method: "+c);n.array.push({caissuer:h})}}return n},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 n={extname:"certificatePolicies",array:[]};t&&(n.critical=!0);for(var s=r(e,0),a=0;a<s.length;a++){var l=o(e,s[a]),u=this.getPolicyInformation(l);n.array.push(u)}return n},this.getPolicyInformation=function(e){var t={},i=s(e,0,[0],"06");t.policyoid=A(i);var n=h(e,0,[1],"30");if(-1!=n){t.array=[];for(var a=r(e,n),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 r=a(e,0,[1],"16");t.cps=he(r)}else if("2b06010505070202"===i){var n=l(e,0,[1],"30");t.unotice=this.getUserNotice(n)}return t},this.getUserNotice=function(e){for(var t={},i=r(e,0),n=0;n<i.length;n++){var s=o(e,i[n]);"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=he(n(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:n(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(n(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 r=n(e,0);return i.hex=r,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 n={extname:"adobeTimeStamp"};t&&(n.critical=!0);var s=r(e,0);if(s.length>1){var a=o(e,s[1]),l=this.getGeneralName(a);null!=l.uri&&(n.uri=l.uri)}if(s.length>2){var u=o(e,s[2]);"0101ff"==u&&(n.reqauth=!0),"010100"==u&&(n.reqauth=!1)}return n},this.getX500NameRule=function(e){for(var t=null,i=[],r=0;r<e.length;r++)for(var n=e[r],o=0;o<n.length;o++)i.push(n[o]);for(r=0;r<i.length;r++){var s=i[r],a=s.ds,l=s.value,u=s.type;if("prn"!=a&&"utf8"!=a&&"ia5"!=a)return"mixed";if("ia5"==a){if("CN"!=u)return"mixed";if(f.lang.String.isMail(l))continue;return"mixed"}if("C"==u){if("prn"==a)continue;return"mixed"}if(null==t)t=a;else if(t!==a)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=r(e,0),n=0;n<i.length;n++)t.push(this.getRDN(o(e,i[n])));return t},this.getRDN=function(e){for(var t=[],i=r(e,0),n=0;n<i.length;n++)t.push(this.getAttrTypeAndValue(o(e,i[n])));return t},this.getAttrTypeAndValue=function(e){var t={type:null,value:null,ds:null},i=r(e,0),n=s(e,i[0],[],"06"),o=s(e,i[1],[]),a=f.asn1.ASN1Util.oidHexToInt(n);return t.type=f.asn1.x509.OID.oid2atype(a),t.ds=this.HEX2STAG[e.substr(i[1],2)],"bmp"!=t.ds?t.value=ce(o):t.value=me(o),t},this.readCertPEM=function(e){this.readCertHex(m(e))},this.readCertHex=function(e){this.hex=e,this.getVersion();try{c(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=pe(this.getPublicKeyHex(),"PUBLIC KEY"),this.aExtInfo.length>0&&(e.ext=this.getExtParamArray()),e.sighex=this.getSignatureValueHex(),e},this.getExtParamArray=function(e){null==e&&-1!=h(this.hex,0,[0,"[3]"])&&(e=u(this.hex,0,[0,"[3]",0],"30"));for(var t=[],i=r(e,0),n=0;n<i.length;n++){var s=o(e,i[n]),a=this.getExtParam(s);null!=a&&t.push(a)}return t},this.getExtParam=function(e){var t=r(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")),n=!1;3==t&&"0101ff"==l(e,0,[1])&&(n=!0);var o=l(e,0,[t-1,0]),a=void 0;if("2.5.29.14"==i?a=this.getExtSubjectKeyIdentifier(o,n):"2.5.29.15"==i?a=this.getExtKeyUsage(o,n):"2.5.29.17"==i?a=this.getExtSubjectAltName(o,n):"2.5.29.18"==i?a=this.getExtIssuerAltName(o,n):"2.5.29.19"==i?a=this.getExtBasicConstraints(o,n):"2.5.29.31"==i?a=this.getExtCRLDistributionPoints(o,n):"2.5.29.32"==i?a=this.getExtCertificatePolicies(o,n):"2.5.29.35"==i?a=this.getExtAuthorityKeyIdentifier(o,n):"2.5.29.37"==i?a=this.getExtExtKeyUsage(o,n):"1.3.6.1.5.5.7.1.1"==i?a=this.getExtAuthorityInfoAccess(o,n):"2.5.29.20"==i?a=this.getExtCRLNumber(o,n):"2.5.29.21"==i?a=this.getExtCRLReason(o,n):"1.3.6.1.5.5.7.48.1.2"==i?a=this.getExtOcspNonce(o,n):"1.3.6.1.5.5.7.48.1.5"==i?a=this.getExtOcspNoCheck(o,n):"1.2.840.113583.1.1.9.1"==i&&(a=this.getExtAdobeTimeStamp(o,n)),null!=a)return a;var u={extname:i,extn:o};return n&&(u.critical=!0),u},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 r=i.array,n=0;n<r.length;n++)if(null!=r[n].dpname&&null!=r[n].dpname.full)for(var o=r[n].dpname.full,s=0;s<o.length;s++){var a=o[n];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 r=i.array,n=0;n<r.length;n++)null!=r[n].ocsp&&(r[n].ocsp=t)},this.updateExtAIACAIssuer=function(e,t){var i=this.findExt(e,"authorityInfoAccess");if(null!=i&&null!=i.array)for(var r=i.array,n=0;n<r.length;n++)null!=r[n].caissuer&&(r[n].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,r,n=function(e){for(var t="",i=e.array,r=0;r<i.length;r++){var n=i[r];if(t+=" policy oid: "+n.policyoid+"\n",void 0!==n.array)for(var o=0;o<n.array.length;o++){var s=n.array[o];void 0!==s.cps&&(t+=" cps: "+s.cps+"\n")}}return t},o=function(e){for(var t="",i=e.array,r=0;r<i.length;r++){var n=i[r];try{void 0!==n.dpname.full[0].uri&&(t+=" "+n.dpname.full[0].uri+"\n")}catch(e){}try{void 0!==n.dname.full[0].dn.hex&&(t+=" "+Be.hex2dn(n.dpname.full[0].dn.hex)+"\n")}catch(e){}}return t},s=function(e){for(var t="",i=e.array,r=0;r<i.length;r++){var n=i[r];void 0!==n.caissuer&&(t+=" caissuer: "+n.caissuer+"\n"),void 0!==n.ocsp&&(t+=" ocsp: "+n.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="+be(t.n.toString(16)).substr(0,16)+"...\n",e+=" e="+be(t.e.toString(16))+"\n"),null!=(i=this.aExtInfo)){e+="X509v3 Extensions:\n";for(var a=0;a<i.length;a++){var l=i[a],u=f.asn1.x509.OID.oid2name(l.oid);""===u&&(u=l.oid);var c="";if(!0===l.critical&&(c="CRITICAL"),e+=" "+u+" "+c+":\n","basicConstraints"===u){var h=this.getExtBasicConstraints();void 0===h.cA?e+=" {}\n":(e+=" cA=true",void 0!==h.pathLen&&(e+=", pathLen="+h.pathLen),e+="\n")}else if("keyUsage"===u)e+=" "+this.getExtKeyUsageString()+"\n";else if("subjectKeyIdentifier"===u)e+=" "+this.getExtSubjectKeyIdentifier().kid.hex+"\n";else if("authorityKeyIdentifier"===u){var d=this.getExtAuthorityKeyIdentifier();void 0!==d.kid&&(e+=" kid="+d.kid.hex+"\n")}else"extKeyUsage"===u?e+=" "+this.getExtExtKeyUsage().array.join(", ")+"\n":"subjectAltName"===u?e+=" "+(r=this.getExtSubjectAltName(),JSON.stringify(r.array).replace(/[\[\]\{\}\"]/g,"")+"\n"):"cRLDistributionPoints"===u?e+=o(this.getExtCRLDistributionPoints()):"authorityInfoAccess"===u?e+=s(this.getExtAuthorityInfoAccess()):"certificatePolicies"===u&&(e+=n(this.getExtCertificatePolicies()))}}return(e+="signature algorithm: "+this.getSignatureAlgorithmName()+"\n")+"signature: "+this.getSignatureValueHex().substr(0,16)+"...\n"},"string"==typeof e&&(-1!=e.indexOf("-----BEGIN")?this.readCertPEM(e):f.lang.String.isHex(e)&&this.readCertHex(e))}function Te(e){return g.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 m(i.substr(2),16):new m(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),r=Ee.getVblen(e,t);return e.substr(i,2*r)},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,r,n,o=Ee,s=[];i=o.getVidx(e,t),r=2*o.getVblen(e,t),"03"==e.substr(t,2)&&(i+=2,r-=2),n=0;for(var a=i;n<=r;){var l=o.getTLVblen(e,a);if((n+=l)<=r&&s.push(a),a+=l,n>=r)break}return s},Ee.getNthChildIdx=function(e,t,i){return Ee.getChildIdx(e,t)[i]},Ee.getIdxbyList=function(e,t,i,r){var n,o,s=Ee;return 0==i.length?void 0!==r&&e.substr(t,2)!==r?-1:t:(n=i.shift())>=(o=s.getChildIdx(e,t)).length?-1:s.getIdxbyList(e,o[n],i,r)},Ee.getIdxbyListEx=function(e,t,i,r){var n,o,s=Ee;if(0==i.length)return void 0!==r&&e.substr(t,2)!==r?-1:t;n=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 n&&!s.isContextTag(u)&&a==n||"string"==typeof n&&s.isContextTag(u,n))return s.getIdxbyListEx(e,o[l],i,r);s.isContextTag(u)||a++}return-1},Ee.getTLVbyList=function(e,t,i,r){var n=Ee,o=n.getIdxbyList(e,t,i,r);return-1==o||o>=e.length?null:n.getTLV(e,o)},Ee.getTLVbyListEx=function(e,t,i,r){var n=Ee,o=n.getIdxbyListEx(e,t,i,r);return-1==o?null:n.getTLV(e,o)},Ee.getVbyList=function(e,t,i,r,n){var o,s,a=Ee;return-1==(o=a.getIdxbyList(e,t,i,r))||o>=e.length?null:(s=a.getV(e,o),!0===n&&(s=s.substr(2)),s)},Ee.getVbyListEx=function(e,t,i,r,n){var o,s,a=Ee;return-1==(o=a.getIdxbyListEx(e,t,i,r))?null:(s=a.getV(e,o),"03"==e.substr(o,2)&&!1!==n&&(s=s.substr(2)),s)},Ee.getInt=function(e,t,i){null==i&&(i=-1);try{var r=e.substr(t,2);if("02"!=r&&"03"!=r)return i;var n=Ee.getV(e,t);return"02"==r?parseInt(n,16):function(e){try{var t=e.substr(0,2);if("00"==t)return parseInt(e.substr(2),16);var i=parseInt(t,16),r=e.substr(2),n=parseInt(r,16).toString(2);return"0"==n&&(n="00000000"),n=n.slice(0,0-i),parseInt(n,2)}catch(e){return-1}}(n)}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(!ye(e))return null;try{var t=[],i=e.substr(0,2),r=parseInt(i,16);t[0]=new String(Math.floor(r/40)),t[1]=new String(r%40);for(var n=e.substr(2),o=[],s=0;s<n.length/2;s++)o.push(parseInt(n.substr(2*s,2),16));var a=[],l="";for(s=0;s<o.length;s++)128&o[s]?l+=xe((127&o[s]).toString(2),7):(l+=xe((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 r=Ee.getOID(e,t,i);if(r==i)return i;var n=f.asn1.x509.OID.oid2name(r);return""==n?r:n}catch(e){return i}},Ee.getString=function(e,t,i){null==i&&(i=null);try{return he(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=[],r=e.substr(0,2),n=parseInt(r,16);i[0]=new String(Math.floor(n/40)),i[1]=new String(n%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,r){var n=Ee,o=n.getV,s=n.dump,a=n.getChildIdx,l=e;e instanceof f.asn1.ASN1Object&&(l=e.getEncodedHex());var u=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===r&&(r="");var c,h=t.ommit_long_octet;if("01"==(c=l.substr(i,2)))return"00"==(d=o(l,i))?r+"BOOLEAN FALSE\n":r+"BOOLEAN TRUE\n";if("02"==c)return r+"INTEGER "+u(d=o(l,i),h)+"\n";if("03"==c){var d=o(l,i);return n.isASN1HEX(d.substr(2))?(w=r+"BITSTRING, encapsulates\n")+s(d.substr(2),t,0,r+" "):r+"BITSTRING "+u(d,h)+"\n"}if("04"==c)return d=o(l,i),n.isASN1HEX(d)?(w=r+"OCTETSTRING, encapsulates\n")+s(d,t,0,r+" "):r+"OCTETSTRING "+u(d,h)+"\n";if("05"==c)return r+"NULL\n";if("06"==c){var p=o(l,i),A=f.asn1.ASN1Util.oidHexToInt(p),g=f.asn1.x509.OID.oid2name(A),m=A.replace(/\./g," ");return""!=g?r+"ObjectIdentifier "+g+" ("+m+")\n":r+"ObjectIdentifier ("+m+")\n"}if("0a"==c)return r+"ENUMERATED "+parseInt(o(l,i))+"\n";if("0c"==c)return r+"UTF8String '"+ce(o(l,i))+"'\n";if("13"==c)return r+"PrintableString '"+ce(o(l,i))+"'\n";if("14"==c)return r+"TeletexString '"+ce(o(l,i))+"'\n";if("16"==c)return r+"IA5String '"+ce(o(l,i))+"'\n";if("17"==c)return r+"UTCTime "+ce(o(l,i))+"\n";if("18"==c)return r+"GeneralizedTime "+ce(o(l,i))+"\n";if("1a"==c)return r+"VisualString '"+ce(o(l,i))+"'\n";if("1e"==c)return r+"BMPString '"+me(o(l,i))+"'\n";if("30"==c){if("3000"==l.substr(i,4))return r+"SEQUENCE {}\n";w=r+"SEQUENCE\n";var v=t;if((2==(x=a(l,i)).length||3==x.length)&&"06"==l.substr(x[0],2)&&"04"==l.substr(x[x.length-1],2)){g=n.oidname(o(l,x[0]));var y=JSON.parse(JSON.stringify(t));y.x509ExtName=g,v=y}for(var b=0;b<x.length;b++)w+=s(l,v,x[b],r+" ");return w}if("31"==c){w=r+"SET\n";var x=a(l,i);for(b=0;b<x.length;b++)w+=s(l,t,x[b],r+" ");return w}if(0!=(128&(c=parseInt(c,16)))){var w,M=31&c;if(0!=(32&c)){for(w=r+"["+M+"]\n",x=a(l,i),b=0;b<x.length;b++)w+=s(l,t,x[b],r+" ");return w}return d=o(l,i),Ee.isASN1HEX(d)?(w=r+"["+M+"]\n")+s(d,t,0,r+" "):(("68747470"==d.substr(0,8)||"subjectAltName"===t.x509ExtName&&2==M)&&(d=ce(d)),r+"["+M+"] "+d+"\n")}return r+"UNKNOWN("+c+") "+o(l,i)+"\n"},Ee.isContextTag=function(e,t){var i,r;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]+\]$/)&&!((r=parseInt(t.substr(1,t.length-1),10))>31)&&128==(192&i)&&(31&i)==r}catch(e){return!1}},Ee.isASN1HEX=function(e){var t=Ee;if(e.length%2==1)return!1;var i=t.getVblen(e,0),r=e.substr(0,2),n=t.getL(e,0);return e.length-r.length-n.length==2*i},Ee.checkStrictDER=function(e,t,i,r,n){var o=Ee;if(void 0===i){if("string"!=typeof e)throw new Error("not hex string");if(e=e.toLowerCase(),!f.lang.String.isHex(e))throw new Error("not hex string");i=e.length,n=(r=e.length/2)<128?1:Math.ceil(r.toString(16))+1}if(o.getL(e,t).length>2*n)throw new Error("L of TLV too long: idx="+t);var s=o.getVblen(e,t);if(s>r)throw new Error("value of L too long than hex: idx="+t);var a=o.getTLV(e,t),l=a.length-2-o.getL(e,t).length;if(l!==2*s)throw new Error("V string length and L's value not the same:"+l+"/"+2*s);if(0===t&&e.length!=a.length)throw new Error("total length and TLV length unmatch:"+e.length+"!="+a.length);var u=e.substr(t,2);if("02"===u){var c=o.getVidx(e,t);if("00"==e.substr(c,2)&&e.charCodeAt(c+2)<56)throw new Error("not least zeros for DER INTEGER")}if(32&parseInt(u,16)){for(var h=o.getVblen(e,t),d=0,p=o.getChildIdx(e,t),A=0;A<p.length;A++)d+=o.getTLV(e,p[A]).length,o.checkStrictDER(e,p[A],i,r,n);if(2*h!=d)throw new Error("sum of children's TLV length and L unmatch: "+2*h+"!="+d)}},Ee.oidname=function(e){var t=f.asn1;f.lang.String.isHex(e)&&(e=t.ASN1Util.oidHexToInt(e));var i=t.x509.OID.oid2name(e);return""===i&&(i=e),i},void 0!==f.asn1&&f.asn1||(f.asn1={}),void 0!==f.asn1.x509&&f.asn1.x509||(f.asn1.x509={}),f.asn1.x509.Certificate=function(e){f.asn1.x509.Certificate.superclass.constructor.call(this);var t=f.asn1,i=t.DERBitString,r=t.DERSequence,n=t.x509,o=n.TBSCertificate,s=n.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(),r=new f.crypto.Signature({alg:t});r.init(e.cakey),r.updateHex(i),e.sighex=r.sign()},this.getPEM=function(){return pe(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 r({array:t}).getEncodedHex()},null!=e&&(this.params=e)},we(f.asn1.x509.Certificate,f.asn1.ASN1Object),f.asn1.x509.TBSCertificate=function(e){f.asn1.x509.TBSCertificate.superclass.constructor.call(this);var t=f.asn1,i=t.x509,r=t.DERTaggedObject,n=t.DERInteger,o=t.DERSequence,s=i.AlgorithmIdentifier,a=i.Time,l=i.X500Name,u=i.Extensions,c=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 h=new r({obj:new n({int:i})});e.push(h)}return e.push(new n(t.serial)),e.push(new s({name:t.sigalg})),e.push(new l(t.issuer)),e.push(new o({array:[new a(t.notbefore),new a(t.notafter)]})),e.push(new l(t.subject)),e.push(new c(Me.getKey(t.sbjpubkey))),void 0!==t.ext&&t.ext.length>0&&e.push(new r({tag:"a3",obj:new u(t.ext)})),new f.asn1.DERSequence({array:e}).getEncodedHex()},void 0!==e&&this.setByParam(e)},we(f.asn1.x509.TBSCertificate,f.asn1.ASN1Object),f.asn1.x509.Extensions=function(e){f.asn1.x509.Extensions.superclass.constructor.call(this);var t=f.asn1,i=t.DERSequence,r=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 n=this.aParam[t],o=n.extname,s=null;if(null!=n.extn)s=new r.PrivateExtension(n);else if("subjectKeyIdentifier"==o)s=new r.SubjectKeyIdentifier(n);else if("keyUsage"==o)s=new r.KeyUsage(n);else if("subjectAltName"==o)s=new r.SubjectAltName(n);else if("issuerAltName"==o)s=new r.IssuerAltName(n);else if("basicConstraints"==o)s=new r.BasicConstraints(n);else if("cRLDistributionPoints"==o)s=new r.CRLDistributionPoints(n);else if("certificatePolicies"==o)s=new r.CertificatePolicies(n);else if("authorityKeyIdentifier"==o)s=new r.AuthorityKeyIdentifier(n);else if("extKeyUsage"==o)s=new r.ExtKeyUsage(n);else if("authorityInfoAccess"==o)s=new r.AuthorityInfoAccess(n);else if("cRLNumber"==o)s=new r.CRLNumber(n);else if("cRLReason"==o)s=new r.CRLReason(n);else if("ocspNonce"==o)s=new r.OCSPNonce(n);else if("ocspNoCheck"==o)s=new r.OCSPNoCheck(n);else if("adobeTimeStamp"==o)s=new r.AdobeTimeStamp(n);else{if("subjectDirectoryAttributes"!=o)throw new Error("extension not supported:"+JSON.stringify(n));s=new r.SubjectDirectoryAttributes(n)}null!=s&&e.push(s)}return new i({array:e}).getEncodedHex()},null!=e&&this.setByParam(e)},we(f.asn1.x509.Extensions,f.asn1.ASN1Object),f.asn1.x509.Extension=function(e){f.asn1.x509.Extension.superclass.constructor.call(this);var t=f.asn1,i=t.DERObjectIdentifier,r=t.DEROctetString,n=(t.DERBitString,t.DERBoolean),o=t.DERSequence;this.getEncodedHex=function(){var e=new i({oid:this.oid}),t=new r({hex:this.getExtnValueHex()}),s=new Array;return s.push(e),this.critical&&s.push(new n),s.push(t),new o({array:s}).getEncodedHex()},this.critical=!1,void 0!==e&&void 0!==e.critical&&(this.critical=e.critical)},we(f.asn1.x509.Extension,f.asn1.ASN1Object),f.asn1.x509.KeyUsage=function(e){f.asn1.x509.KeyUsage.superclass.constructor.call(this,e);var t=Be.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 f.asn1.DERBitString(e)),void 0!==e.names&&void 0!==e.names.length)){for(var i=e.names,r="000000000",n=0;n<i.length;n++)for(var o=0;o<t.length;o++)i[n]===t[o]&&(r=r.substring(0,o)+"1"+r.substring(o+1,r.length));this.asn1ExtnValue=new f.asn1.DERBitString({bin:r})}},we(f.asn1.x509.KeyUsage,f.asn1.x509.Extension),f.asn1.x509.BasicConstraints=function(e){f.asn1.x509.BasicConstraints.superclass.constructor.call(this,e);var t=f.asn1,i=t.DERBoolean,r=t.DERInteger,n=t.DERSequence;this.getExtnValueHex=function(){var e=new Array;this.cA&&e.push(new i),this.pathLen>-1&&e.push(new r({int:this.pathLen}));var t=new n({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))},we(f.asn1.x509.BasicConstraints,f.asn1.x509.Extension),f.asn1.x509.CRLDistributionPoints=function(e){f.asn1.x509.CRLDistributionPoints.superclass.constructor.call(this,e);var t=f.asn1,i=t.x509;this.getExtnValueHex=function(){return this.asn1ExtnValue.getEncodedHex()},this.setByDPArray=function(e){for(var r=[],n=0;n<e.length;n++)if(e[n]instanceof f.asn1.ASN1Object)r.push(e[n]);else{var o=new i.DistributionPoint(e[n]);r.push(o)}this.asn1ExtnValue=new t.DERSequence({array:r})},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))},we(f.asn1.x509.CRLDistributionPoints,f.asn1.x509.Extension),f.asn1.x509.DistributionPoint=function(e){f.asn1.x509.DistributionPoint.superclass.constructor.call(this);var t=f.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}]})))},we(f.asn1.x509.DistributionPoint,f.asn1.ASN1Object),f.asn1.x509.DistributionPointName=function(e){f.asn1.x509.DistributionPointName.superclass.constructor.call(this);var t=f.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)}},we(f.asn1.x509.DistributionPointName,f.asn1.ASN1Object),f.asn1.x509.CertificatePolicies=function(e){f.asn1.x509.CertificatePolicies.superclass.constructor.call(this,e);var t=f.asn1,i=t.x509,r=t.DERSequence,n=i.PolicyInformation;this.params=null,this.getExtnValueHex=function(){for(var e=[],t=0;t<this.params.array.length;t++)e.push(new n(this.params.array[t]));var i=new r({array:e});return this.asn1ExtnValue=i,this.asn1ExtnValue.getEncodedHex()},this.oid="2.5.29.32",void 0!==e&&(this.params=e)},we(f.asn1.x509.CertificatePolicies,f.asn1.x509.Extension),f.asn1.x509.PolicyInformation=function(e){f.asn1.x509.PolicyInformation.superclass.constructor.call(this,e);var t=f.asn1,i=t.DERSequence,r=t.DERObjectIdentifier,n=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 r(this.params.policyoid)];if(void 0!==this.params.array){for(var t=[],o=0;o<this.params.array.length;o++)t.push(new n(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)},we(f.asn1.x509.PolicyInformation,f.asn1.ASN1Object),f.asn1.x509.PolicyQualifierInfo=function(e){f.asn1.x509.PolicyQualifierInfo.superclass.constructor.call(this,e);var t=f.asn1,i=t.DERSequence,r=t.DERIA5String,n=t.DERObjectIdentifier,o=t.x509.UserNotice;this.params=null,this.getEncodedHex=function(){return void 0!==this.params.cps?new i({array:[new n({oid:"1.3.6.1.5.5.7.2.1"}),new r({str:this.params.cps})]}).getEncodedHex():null!=this.params.unotice?new i({array:[new n({oid:"1.3.6.1.5.5.7.2.2"}),new o(this.params.unotice)]}).getEncodedHex():void 0},void 0!==e&&(this.params=e)},we(f.asn1.x509.PolicyQualifierInfo,f.asn1.ASN1Object),f.asn1.x509.UserNotice=function(e){f.asn1.x509.UserNotice.superclass.constructor.call(this,e);var t=f.asn1.DERSequence,i=(f.asn1.DERInteger,f.asn1.x509.DisplayText),r=f.asn1.x509.NoticeReference;this.params=null,this.getEncodedHex=function(){var e=[];return void 0!==this.params.noticeref&&e.push(new r(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)},we(f.asn1.x509.UserNotice,f.asn1.ASN1Object),f.asn1.x509.NoticeReference=function(e){f.asn1.x509.NoticeReference.superclass.constructor.call(this,e);var t=f.asn1.DERSequence,i=f.asn1.DERInteger,r=f.asn1.x509.DisplayText;this.params=null,this.getEncodedHex=function(){var e=[];if(void 0!==this.params.org&&e.push(new r(this.params.org)),void 0!==this.params.noticenum){for(var n=[],o=this.params.noticenum,s=0;s<o.length;s++)n.push(new i(o[s]));e.push(new t({array:n}))}if(0==e.length)throw new Error("parameter is empty");return new t({array:e}).getEncodedHex()},void 0!==e&&(this.params=e)},we(f.asn1.x509.NoticeReference,f.asn1.ASN1Object),f.asn1.x509.DisplayText=function(e){f.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"))},we(f.asn1.x509.DisplayText,f.asn1.DERAbstractString),f.asn1.x509.ExtKeyUsage=function(e){f.asn1.x509.ExtKeyUsage.superclass.constructor.call(this,e);var t=f.asn1;this.setPurposeArray=function(e){this.asn1ExtnValue=new t.DERSequence;for(var i=0;i<e.length;i++){var r=new t.DERObjectIdentifier(e[i]);this.asn1ExtnValue.appendASN1Object(r)}},this.getExtnValueHex=function(){return this.asn1ExtnValue.getEncodedHex()},this.oid="2.5.29.37",void 0!==e&&void 0!==e.array&&this.setPurposeArray(e.array)},we(f.asn1.x509.ExtKeyUsage,f.asn1.x509.Extension),f.asn1.x509.AuthorityKeyIdentifier=function(e){f.asn1.x509.AuthorityKeyIdentifier.superclass.constructor.call(this,e);var t=f,i=t.asn1,r=i.DERTaggedObject,n=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 r({explicit:!1,tag:"80",obj:this.asn1KID})),this.asn1CertIssuer&&e.push(new r({explicit:!1,tag:"a1",obj:new n([{dn:this.asn1CertIssuer}])})),this.asn1CertSN&&e.push(new r({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 f.asn1.DEROctetString(e);else if("object"==typeof e&&f.crypto.Util.isKey(e)||"string"==typeof e&&-1!=e.indexOf("BEGIN ")){var t=e;"string"==typeof e&&(t=Me.getKey(e));var i=Me.getKeyID(t);this.asn1KID=new f.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 f.asn1.x509.X500Name(e):"string"==typeof e&&-1!=e.indexOf("BEGIN ")&&-1!=e.indexOf("CERTIFICATE")&&(this.asn1CertIssuer=new f.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 f.asn1.DERInteger(e);else if("string"==typeof e&&-1!=e.indexOf("BEGIN ")&&e.indexOf("CERTIFICATE")){var t=new Be;t.readCertPEM(e);var i=t.getSerialNumberHex();this.asn1CertSN=new f.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)))},we(f.asn1.x509.AuthorityKeyIdentifier,f.asn1.x509.Extension),f.asn1.x509.SubjectKeyIdentifier=function(e){f.asn1.x509.SubjectKeyIdentifier.superclass.constructor.call(this,e);var t=f.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&&f.crypto.Util.isKey(e)||"string"==typeof e&&-1!=e.indexOf("BEGIN")){var i=e;"string"==typeof e&&(i=Me.getKey(e));var r=Me.getKeyID(i);this.asn1KID=new f.asn1.DEROctetString({hex:r})}},this.oid="2.5.29.14",void 0!==e&&void 0!==e.kid&&this.setKIDByParam(e.kid)},we(f.asn1.x509.SubjectKeyIdentifier,f.asn1.x509.Extension),f.asn1.x509.AuthorityInfoAccess=function(e){f.asn1.x509.AuthorityInfoAccess.superclass.constructor.call(this,e),this.setAccessDescriptionArray=function(e){for(var t=new Array,i=f.asn1,r=i.DERSequence,n=i.DERObjectIdentifier,o=i.x509.GeneralName,s=0;s<e.length;s++){var a,l=e[s];if(void 0!==l.ocsp)a=new r({array:[new n({oid:"1.3.6.1.5.5.7.48.1"}),new o({uri:l.ocsp})]});else{if(void 0===l.caissuer)throw new Error("unknown AccessMethod parameter: "+JSON.stringify(l));a=new r({array:[new n({oid:"1.3.6.1.5.5.7.48.2"}),new o({uri:l.caissuer})]})}t.push(a)}this.asn1ExtnValue=new r({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)},we(f.asn1.x509.AuthorityInfoAccess,f.asn1.x509.Extension),f.asn1.x509.SubjectAltName=function(e){f.asn1.x509.SubjectAltName.superclass.constructor.call(this,e),this.setNameArray=function(e){this.asn1ExtnValue=new f.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)},we(f.asn1.x509.SubjectAltName,f.asn1.x509.Extension),f.asn1.x509.IssuerAltName=function(e){f.asn1.x509.IssuerAltName.superclass.constructor.call(this,e),this.setNameArray=function(e){this.asn1ExtnValue=new f.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)},we(f.asn1.x509.IssuerAltName,f.asn1.x509.Extension),f.asn1.x509.SubjectDirectoryAttributes=function(e){f.asn1.x509.SubjectDirectoryAttributes.superclass.constructor.call(this,e);var t=f.asn1,i=t.DERSequence,r=t.ASN1Util.newObject,n=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=n(o.attr),s.seq[1].set[0]={gentime:o.str};else if("placeOfBirth"==o.attr)s.seq[0].oid=n(o.attr),s.seq[1].set[0]={utf8str:o.str};else if("gender"==o.attr)s.seq[0].oid=n(o.attr),s.seq[1].set[0]={prnstr:o.str};else if("countryOfCitizenship"==o.attr)s.seq[0].oid=n(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=n(o.attr),s.seq[1].set[0]={prnstr:o.str}}e.push(new r(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)},we(f.asn1.x509.SubjectDirectoryAttributes,f.asn1.x509.Extension),f.asn1.x509.PrivateExtension=function(e){f.asn1.x509.PrivateExtension.superclass.constructor.call(this,e);var t=f,i=t.lang.String.isHex,r=t.asn1,n=r.x509.OID.name2oid,o=r.ASN1Util.newObject;this.params=null,this.setByParam=function(e){this.oid=n(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)},we(f.asn1.x509.PrivateExtension,f.asn1.x509.Extension),f.asn1.x509.CRL=function(e){f.asn1.x509.CRL.superclass.constructor.call(this);var t=f.asn1,i=t.DERSequence,r=t.DERBitString,n=t.x509,o=n.AlgorithmIdentifier,s=n.TBSCertList;this.params=void 0,this.setByParam=function(e){this.params=e},this.sign=function(){var e=new s(this.params).getEncodedHex(),t=new f.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 pe(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 r({hex:"00"+e.sighex})),new i({array:t}).getEncodedHex()},null!=e&&(this.params=e)},we(f.asn1.x509.CRL,f.asn1.ASN1Object),f.asn1.x509.TBSCertList=function(e){f.asn1.x509.TBSCertList.superclass.constructor.call(this);var t=f.asn1,i=t.DERInteger,r=t.DERSequence,n=t.DERTaggedObject,o=(t.DERObjectIdentifier,t.x509),s=o.AlgorithmIdentifier,a=o.Time,l=o.Extensions,u=o.X500Name;this.params=null,this.setByParam=function(e){this.params=e},this.getRevCertSequence=function(){for(var e=[],t=this.params.revcert,n=0;n<t.length;n++){var o=[new i(t[n].sn),new a(t[n].date)];null!=t[n].ext&&o.push(new l(t[n].ext)),e.push(new r({array:o}))}return new r({array:e})},this.getEncodedHex=function(){var e=[],t=this.params;if(null!=t.version){var o=t.version-1,c=new i({int:o});e.push(c)}if(e.push(new s({name:t.sigalg})),e.push(new u(t.issuer)),e.push(new a(t.thisupdate)),null!=t.nextupdate&&e.push(new a(t.nextupdate)),null!=t.revcert&&e.push(this.getRevCertSequence()),null!=t.ext){var h=new l(t.ext);e.push(new n({tag:"a0",explicit:!0,obj:h}))}return new r({array:e}).getEncodedHex()},void 0!==e&&this.setByParam(e)},we(f.asn1.x509.TBSCertList,f.asn1.ASN1Object),f.asn1.x509.CRLEntry=function(e){f.asn1.x509.CRLEntry.superclass.constructor.call(this);var t=f.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))},we(f.asn1.x509.CRLEntry,f.asn1.ASN1Object),f.asn1.x509.CRLNumber=function(e){f.asn1.x509.CRLNumber.superclass.constructor.call(this,e),this.params=void 0,this.getExtnValueHex=function(){return this.asn1ExtnValue=new f.asn1.DERInteger(this.params.num),this.asn1ExtnValue.getEncodedHex()},this.oid="2.5.29.20",null!=e&&(this.params=e)},we(f.asn1.x509.CRLNumber,f.asn1.x509.Extension),f.asn1.x509.CRLReason=function(e){f.asn1.x509.CRLReason.superclass.constructor.call(this,e),this.params=void 0,this.getExtnValueHex=function(){return this.asn1ExtnValue=new f.asn1.DEREnumerated(this.params.code),this.asn1ExtnValue.getEncodedHex()},this.oid="2.5.29.21",null!=e&&(this.params=e)},we(f.asn1.x509.CRLReason,f.asn1.x509.Extension),f.asn1.x509.OCSPNonce=function(e){f.asn1.x509.OCSPNonce.superclass.constructor.call(this,e),this.params=void 0,this.getExtnValueHex=function(){return this.asn1ExtnValue=new f.asn1.DEROctetString(this.params),this.asn1ExtnValue.getEncodedHex()},this.oid="1.3.6.1.5.5.7.48.1.2",null!=e&&(this.params=e)},we(f.asn1.x509.OCSPNonce,f.asn1.x509.Extension),f.asn1.x509.OCSPNoCheck=function(e){f.asn1.x509.OCSPNoCheck.superclass.constructor.call(this,e),this.params=void 0,this.getExtnValueHex=function(){return this.asn1ExtnValue=new f.asn1.DERNull,this.asn1ExtnValue.getEncodedHex()},this.oid="1.3.6.1.5.5.7.48.1.5",null!=e&&(this.params=e)},we(f.asn1.x509.OCSPNoCheck,f.asn1.x509.Extension),f.asn1.x509.AdobeTimeStamp=function(e){f.asn1.x509.AdobeTimeStamp.superclass.constructor.call(this,e);var t=f.asn1,i=t.DERInteger,r=t.DERBoolean,n=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 r(e.reqauth)),this.asn1ExtnValue=new n({array:t}),this.asn1ExtnValue.getEncodedHex()},this.oid="1.2.840.113583.1.1.9.1",void 0!==e&&this.setByParam(e)},we(f.asn1.x509.AdobeTimeStamp,f.asn1.x509.Extension),f.asn1.x509.X500Name=function(e){f.asn1.x509.X500Name.superclass.constructor.call(this),this.asn1Array=[],this.paramArray=[],this.sRule="utf8";var t=f.asn1,i=t.x509,r=i.RDN;this.setByString=function(e,t){void 0!==t&&(this.sRule=t);var i=e.split("/");i.shift();for(var n=[],o=0;o<i.length;o++)if(i[o].match(/^[^=]+=.+$/))n.push(i[o]);else{var s=n.length-1;n[s]=n[s]+"/"+i[o]}for(o=0;o<n.length;o++)this.asn1Array.push(new r({str:n[o],rule:this.sRule}))},this.setByLdapString=function(e,t){void 0!==t&&(this.sRule=t);var r=i.X500Name.ldapToCompat(e);this.setByString(r,t)},this.setByObject=function(e,t){for(var i in void 0!==t&&(this.sRule=t),e)if(e.hasOwnProperty(i)){var n=new r({str:i+"="+e[i],rule:this.sRule});this.asn1Array?this.asn1Array.push(n):this.asn1Array=[n]}},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 Be).readCertPEM(e.certissuer),this.hTLV=t.getIssuerHex()):void 0!==e.certsubject?((t=new Be).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 n=new r(i);this.asn1Array.push(n)}var o=new t.DERSequence({array:this.asn1Array});return this.hTLV=o.getEncodedHex(),this.hTLV},void 0!==e&&this.setByParam(e)},we(f.asn1.x509.X500Name,f.asn1.ASN1Object),f.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(/,/,"\\,")})),t.join(",")},f.asn1.x509.X500Name.onelineToLDAP=function(e){return f.asn1.x509.X500Name.compatToLDAP(e)},f.asn1.x509.X500Name.ldapToCompat=function(e){for(var t=e.split(","),i=!1,r=[],n=0;t.length>0;n++){var o=t.shift();if(!0===i){var s=(r.pop()+","+o).replace(/\\,/g,",");r.push(s),i=!1}else r.push(o);"\\"===o.substr(-1,1)&&(i=!0)}return r=r.map((function(e){return e.replace("/","\\/")})),r.reverse(),"/"+r.join("/")},f.asn1.x509.X500Name.ldapToOneline=function(e){return f.asn1.x509.X500Name.ldapToCompat(e)},f.asn1.x509.RDN=function(e){f.asn1.x509.RDN.superclass.constructor.call(this),this.asn1Array=[],this.paramArray=[],this.sRule="utf8";var t=f.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 f.asn1.x509.AttributeTypeAndValue({str:e,rule:this.sRule}))},this.addByMultiValuedString=function(e){for(var t=f.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 r=new t(i);this.asn1Array.push(r)}var n=new f.asn1.DERSet({array:this.asn1Array});return this.TLV=n.getEncodedHex(),this.TLV},void 0!==e&&this.setByParam(e)},we(f.asn1.x509.RDN,f.asn1.ASN1Object),f.asn1.x509.RDN.parseString=function(e){for(var t=e.split(/\+/),i=!1,r=[],n=0;t.length>0;n++){var o=t.shift();if(!0===i){var s=(r.pop()+"+"+o).replace(/\\\+/g,"+");r.push(s),i=!1}else r.push(o);"\\"===o.substr(-1,1)&&(i=!0)}var a=!1,l=[];for(n=0;r.length>0;n++){if(o=r.shift(),!0===a){var u=l.pop();o.match(/"$/)?(s=(u+"+"+o).replace(/^([^=]+)="(.*)"$/,"$1=$2"),l.push(s),a=!1):l.push(u+"+"+o)}else l.push(o);o.match(/^[^=]+="/)&&(a=!0)}return l},f.asn1.x509.AttributeTypeAndValue=function(e){f.asn1.x509.AttributeTypeAndValue.superclass.constructor.call(this),this.sRule="utf8",this.sType=null,this.sValue=null,this.dsType=null;var t=f,i=t.asn1,r=i.DERSequence,n=i.DERUTF8String,o=i.DERPrintableString,s=i.DERTeletexString,a=i.DERIA5String,l=i.DERVisibleString,u=i.DERBMPString,c=t.lang.String.isMail,h=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&&c(t)?"ia5":h(t)?"prn":"utf8":"utf8"===i?"CN"==e&&c(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 n({str:t});if("prn"==e)return new o({str:t});if("tel"==e)return new s({str:t});if("ia5"==e)return new a({str:t});if("vis"==e)return new l({str:t});if("bmp"==e)return new u({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=f.asn1.x509.OID.atype2obj(this.sType),t=this.getValueObj(this.dsType,this.sValue),i=new r({array:[e,t]});return this.TLV=i.getEncodedHex(),this.TLV},void 0!==e&&this.setByParam(e)},we(f.asn1.x509.AttributeTypeAndValue,f.asn1.ASN1Object),f.asn1.x509.SubjectPublicKeyInfo=function(e){f.asn1.x509.SubjectPublicKeyInfo.superclass.constructor.call(this);var t=f,i=t.asn1,r=i.DERInteger,n=i.DERBitString,o=i.DERObjectIdentifier,s=i.DERSequence,a=i.ASN1Util.newObject,l=i.x509.AlgorithmIdentifier,u=t.crypto;u.ECDSA,u.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 te){var t=a({seq:[{int:{bigint:e.n}},{int:{int:e.e}}]}).getEncodedHex();this.asn1AlgId=new l({name:"rsaEncryption"}),this.asn1SubjPKey=new n({hex:"00"+t})}}catch(e){}try{if(e instanceof f.crypto.ECDSA){var i=new o({name:e.curveName});this.asn1AlgId=new l({name:"ecPublicKey",asn1params:i}),this.asn1SubjPKey=new n({hex:"00"+e.pubKeyHex})}}catch(e){}try{if(e instanceof f.crypto.DSA){i=new a({seq:[{int:{bigint:e.p}},{int:{bigint:e.q}},{int:{bigint:e.g}}]}),this.asn1AlgId=new l({name:"dsa",asn1params:i});var s=new r({bigint:e.y});this.asn1SubjPKey=new n({hex:"00"+s.getEncodedHex()})}}catch(e){}},void 0!==e&&this.setPubKey(e)},we(f.asn1.x509.SubjectPublicKeyInfo,f.asn1.ASN1Object),f.asn1.x509.Time=function(e){f.asn1.x509.Time.superclass.constructor.call(this);var t=f.asn1,i=t.DERUTCTime,r=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 r(this.timeParams):"utc"==this.type?new i:new r,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)},we(f.asn1.x509.Time,f.asn1.ASN1Object),f.asn1.x509.AlgorithmIdentifier=function(e){f.asn1.x509.AlgorithmIdentifier.superclass.constructor.call(this),this.nameAlg=null,this.asn1Alg=null,this.asn1Params=null,this.paramEmpty=!1;var t=f.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 r in i)r===this.nameAlg&&(e=i[r]);if(null!==e)return this.hTLV=e,this.hTLV}null!==this.nameAlg&&null===this.asn1Alg&&(this.asn1Alg=t.x509.OID.name2obj(this.nameAlg));var n=[this.asn1Alg];null!==this.asn1Params&&n.push(this.asn1Params);var o=new t.DERSequence({array:n});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 r=this.nameAlg.toLowerCase();"withdsa"!==r.substr(-7,7)&&"withecdsa"!==r.substr(-9,9)&&(this.asn1Params=new t.DERNull)}},we(f.asn1.x509.AlgorithmIdentifier,f.asn1.ASN1Object),f.asn1.x509.AlgorithmIdentifier.PSSNAME2ASN1TLV={SHAwithRSAandMGF1:"300d06092a864886f70d01010a3000",SHA256withRSAandMGF1:"303d06092a864886f70d01010a3030a00d300b0609608648016503040201a11a301806092a864886f70d010108300b0609608648016503040201a203020120",SHA384withRSAandMGF1:"303d06092a864886f70d01010a3030a00d300b0609608648016503040202a11a301806092a864886f70d010108300b0609608648016503040202a203020130",SHA512withRSAandMGF1:"303d06092a864886f70d01010a3030a00d300b0609608648016503040203a11a301806092a864886f70d010108300b0609608648016503040203a203020140"},f.asn1.x509.GeneralName=function(e){f.asn1.x509.GeneralName.superclass.constructor.call(this);var t={rfc822:"81",dns:"82",dn:"a4",uri:"86",ip:"87"},i=f.asn1,r=(i.DERSequence,i.DEROctetString),n=i.DERIA5String,o=i.DERTaggedObject,s=i.ASN1Object,a=i.x509.X500Name,l=fe;this.explicit=!1,this.setByParam=function(e){var i=null;if(void 0!==e){if(void 0!==e.rfc822&&(this.type="rfc822",i=new n({str:e[this.type]})),void 0!==e.dns&&(this.type="dns",i=new n({str:e[this.type]})),void 0!==e.uri&&(this.type="uri",i=new n({str:e[this.type]})),void 0!==e.dn&&(this.type="dn",this.explicit=!0,i="string"==typeof e.dn?new a({str:e.dn}):e.dn instanceof f.asn1.x509.X500Name?e.dn:new a(e.dn)),void 0!==e.ldapdn&&(this.type="dn",this.explicit=!0,i=new a({ldapstr:e.ldapdn})),void 0!==e.certissuer){this.type="dn",this.explicit=!0;var u=null;if((h=e.certissuer).match(/^[0-9A-Fa-f]+$/),-1!=h.indexOf("-----BEGIN ")&&(u=l(h)),null==u)throw"certissuer param not cert";(d=new Be).hex=u;var c=d.getIssuerHex();(i=new s).hTLV=c}if(void 0!==e.certsubj){var h,d;if(this.type="dn",this.explicit=!0,u=null,(h=e.certsubj).match(/^[0-9A-Fa-f]+$/),-1!=h.indexOf("-----BEGIN ")&&(u=l(h)),null==u)throw"certsubj param not cert";(d=new Be).hex=u,c=d.getSubjectHex(),(i=new s).hTLV=c}if(void 0!==e.ip){this.type="ip",this.explicit=!1;var p,A=e.ip,g="malformed IP address";if(A.match(/^[0-9.]+[.][0-9.]+$/)){if(p=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 r=parseInt(e);if(r<0||255<r)throw"integer not in range 0-255";return("00"+r.toString(16)).slice(-2)})).join("")}catch(e){throw"malformed integer array string: "+e}}("["+A.split(".").join(",")+"]"),8!==p.length)throw g}else if(A.match(/^[0-9A-Fa-f:]+:[0-9A-Fa-f:]+$/))p=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 r=":".repeat(7-i+2),n=(e=e.replace("::",r)).split(":");if(8!=n.length)throw t;for(var o=0;o<8;o++)n[o]=("0000"+n[o]).slice(-4);return n.join("")}(A);else{if(!A.match(/^([0-9A-Fa-f][0-9A-Fa-f]){1,}$/))throw g;p=A}i=new r({hex:p})}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)},we(f.asn1.x509.GeneralName,f.asn1.ASN1Object),f.asn1.x509.GeneralNames=function(e){f.asn1.x509.GeneralNames.superclass.constructor.call(this);var t=f.asn1;this.setByParamArray=function(e){for(var i=0;i<e.length;i++){var r=new t.x509.GeneralName(e[i]);this.asn1Array.push(r)}},this.getEncodedHex=function(){return new t.DERSequence({array:this.asn1Array}).getEncodedHex()},this.asn1Array=new Array,void 0!==e&&this.setByParamArray(e)},we(f.asn1.x509.GeneralNames,f.asn1.ASN1Object),f.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 f.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 f.asn1.DERObjectIdentifier({oid:t});return this.objCache[e]=i,i}},f.asn1.x509.OID.oid2name=function(e){var t=f.asn1.x509.OID.name2oidList;for(var i in t)if(t[i]==e)return i;return""},f.asn1.x509.OID.oid2atype=function(e){var t=f.asn1.x509.OID.atype2oidList;for(var i in t)if(t[i]==e)return i;return e},f.asn1.x509.OID.name2oid=function(e){if(e.match(/^[0-9.]+$/))return e;var t=f.asn1.x509.OID.name2oidList;return void 0===t[e]?"":t[e]},f.asn1.x509.X509Util={},f.asn1.x509.X509Util.newCertPEM=function(e){var t=f.asn1.x509;return t.TBSCertificate,new(0,t.Certificate)(e).getPEM()},te.getPosArrayOfChildrenFromHex=function(e){return Ee.getChildIdx(e,0)},te.getHexValueArrayOfChildrenFromHex=function(e){var t,i=Ee.getV,r=i(e,(t=te.getPosArrayOfChildrenFromHex(e))[0]),n=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(r,n,o,s,a,l,u,c,h),t},te.prototype.readPrivateKeyFromPEMString=function(e){var t=fe(e),i=te.getHexValueArrayOfChildrenFromHex(t);this.setPrivateEx(i[1],i[2],i[3],i[4],i[5],i[6],i[7],i[8])},te.prototype.readPKCS5PrvKeyHex=function(e){var t=te.getHexValueArrayOfChildrenFromHex(e);this.setPrivateEx(t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8])},te.prototype.readPKCS8PrvKeyHex=function(e){var t,i,r,n,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"),r=c(e,0,[2,0,3],"02"),n=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,r,n,o,s,a,l)},te.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 r=t.getChildIdx(e,0);if(2!==r.length||"02"!==e.substr(r[0],2)||"02"!==e.substr(r[1],2))throw new Error("wrong hex for PKCS#5 public key");var n=i(e,r[0]),o=i(e,r[1]);this.setPublic(n,o)},te.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)},te.prototype.readCertPubKeyHex=function(e,t){var i,r;(i=new Be).readCertHex(e),r=i.getPublicKeyHex(),this.readPKCS8PubKeyHex(r)},te.prototype.sign=function(e,t){var i=function(e){return f.crypto.Util.hashString(e,t)}(e);return this.signWithMessageHash(i,t)},te.prototype.signWithMessageHash=function(e,t){var i=$(f.crypto.Util.getPaddedDigestInfoHex(e,t,this.n.bitLength()),16);return Se(this.doPrivate(i).toString(16),this.n.bitLength())},te.prototype.signPSS=function(e,t,i){var r,n=(r=de(e),f.crypto.Util.hashHex(r,t));return void 0===i&&(i=-1),this.signWithMessageHashPSS(n,t,i)},te.prototype.signWithMessageHashPSS=function(e,t,i){var r,n=he(e),o=n.length,s=this.n.bitLength()-1,a=Math.ceil(s/8),l=function(e){return f.crypto.Util.hashHex(e,t)};if(-1===i||void 0===i)i=o;else if(-2===i)i=a-o-2;else if(i<-2)throw new Error("invalid salt length");if(a<o+i+2)throw new Error("data too long");var u="";i>0&&(u=new Array(i),(new J).nextBytes(u),u=String.fromCharCode.apply(String,u));var c=he(l(de("\0\0\0\0\0\0\0\0"+n+u))),h=[];for(r=0;r<a-i-o-2;r+=1)h[r]=0;var d=String.fromCharCode.apply(String,h)+""+u,p=Ce(c,d.length,l),A=[];for(r=0;r<d.length;r+=1)A[r]=d.charCodeAt(r)^p.charCodeAt(r);var g=65280>>8*a-s&255;for(A[0]&=~g,r=0;r<o;r++)A.push(c.charCodeAt(r));return A.push(188),Se(this.doPrivate(new m(A)).toString(16),this.n.bitLength())},te.prototype.verify=function(e,t){if(null==(t=t.toLowerCase()).match(/^[0-9a-f]+$/))return!1;var i=$(t,16),r=this.n.bitLength();if(i.bitLength()>r)return!1;var n=this.doPublic(i).toString(16);if(n.length+3!=r/4)return!1;var o=Ie(n.replace(/^1f+00/,""));if(0==o.length)return!1;var s=o[0],a=o[1],l=function(e){return f.crypto.Util.hashString(e,s)}(e);return a==l},te.prototype.verifyWithMessageHash=function(e,t){if(t.length!=Math.ceil(this.n.bitLength()/4))return!1;var i=$(t,16);if(i.bitLength()>this.n.bitLength())return 0;var r=Ie(this.doPublic(i).toString(16).replace(/^1f+00/,""));return 0!=r.length&&(r[0],r[1]==e)},te.prototype.verifyPSS=function(e,t,i,r){var n,o=(n=de(e),f.crypto.Util.hashHex(n,i));return void 0===r&&(r=-1),this.verifyWithMessageHashPSS(o,t,i,r)},te.prototype.verifyWithMessageHashPSS=function(e,t,i,r){if(t.length!=Math.ceil(this.n.bitLength()/4))return!1;var n,o=new m(t,16),s=function(e){return f.crypto.Util.hashHex(e,i)},a=he(e),l=a.length,u=this.n.bitLength()-1,c=Math.ceil(u/8);if(-1===r||void 0===r)r=l;else if(-2===r)r=c-l-2;else if(r<-2)throw new Error("invalid salt length");if(c<l+r+2)throw new Error("data too long");var h=this.doPublic(o).toByteArray();for(n=0;n<h.length;n+=1)h[n]&=255;for(;h.length<c;)h.unshift(0);if(188!==h[c-1])throw new Error("encoded message does not end in 0xbc");var d=(h=String.fromCharCode.apply(String,h)).substr(0,c-l-1),p=h.substr(d.length,l),A=65280>>8*c-u&255;if(0!=(d.charCodeAt(0)&A))throw new Error("bits beyond keysize not zero");var g=Ce(p,d.length,s),v=[];for(n=0;n<d.length;n+=1)v[n]=d.charCodeAt(n)^g.charCodeAt(n);v[0]&=~A;var y=c-l-r-2;for(n=0;n<y;n+=1)if(0!==v[n])throw new Error("leftmost octets not zero");if(1!==v[y])throw new Error("0x01 marker not found");return p===he(s(de("\0\0\0\0\0\0\0\0"+a+String.fromCharCode.apply(String,v.slice(-r)))))},te.SALT_LEN_HLEN=-1,te.SALT_LEN_MAX=-2,te.SALT_LEN_RECOVER=-2,Be.hex2dn=function(e,t){void 0===t&&(t=0);var i=new Be;return Ee.getTLV(e,t),i.getX500Name(e).str},Be.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,r=Ee.getChildIdx(e,t),n=0;n<r.length;n++)i.push(Be.hex2attrTypeValue(e,r[n]));return i=i.map((function(e){return e.replace("+","\\+")})),i.join("+")},Be.hex2attrTypeValue=function(e,t){var i=Ee,r=i.getV;if(void 0===t&&(t=0),"30"!==e.substr(t,2))throw new Error("malformed attribute type and value");var n=i.getChildIdx(e,t);2!==n.length||e.substr(n[0],2);var o=r(e,n[0]),s=f.asn1.ASN1Util.oidHexToInt(o);return f.asn1.x509.OID.oid2atype(s)+"="+he(r(e,n[1]))},Be.getPublicKeyFromCertHex=function(e){var t=new Be;return t.readCertHex(e),t.getPublicKey()},Be.getPublicKeyFromCertPEM=function(e){var t=new Be;return t.readCertPEM(e),t.getPublicKey()},Be.getPublicKeyInfoPropOfCertPEM=function(e){var t,i,r=Ee.getVbyList,n={algparam:null};return(t=new Be).readCertPEM(e),i=t.getPublicKeyHex(),n.keyhex=r(i,0,[1],"03").substr(2),n.algoid=r(i,0,[0,0],"06"),"2a8648ce3d0201"===n.algoid&&(n.algparam=r(i,0,[0,1],"06")),n},Be.KEYUSAGE_NAME=["digitalSignature","nonRepudiation","keyEncipherment","dataEncipherment","keyAgreement","keyCertSign","cRLSign","encipherOnly","decipherOnly"];var Pe,Re=[(Pe=new Be,Pe.readCertPEM(function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var i=113,r=126,n=0,o="";return arguments[n].split(o).map((function(e){return e.charCodeAt(n)>r?e:String.fromCharCode((e.charCodeAt(n)+i)%r)})).join(o)}(":::::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`gdSp?cyZ^P^fQc^^QQNWQ^aRvZPNTP`\0T`Vo@Q^RWN_fapzFqSFwfbOndSnzyuYz[oaNrS=\\QN>Z\tN\\Q^B[QqnS=\b\\QN>Zwp\\Q^B[QqnZVTSZ^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[oaPPNvVQ^fWX|gVup[N^ROO^NQttV]NQPPNt|PttVONZU|C\b\\@@e^Xv{[vTtd8`nyO@ebN[bqx=ng?\tS^w@|XAz|qUTwfzn]Bu<qs_ae\\y<}u`eRAoE`_\\s\0r|b{rp_o<oC@o=x\bw_cUUZPApQevD\\FxFoFgE=<sq[p<coqyn>TEpP@aSC_YDU8\0|8TB?c>r\\=rp`pcwP}c\0PP_\\RS\\EPVSy8x`\0?R|NP\tP>}A^VP}Ex\bUZa=syDw}>Ya8wPp[pRnn\brU^dE8U?a\bcW|<FEbbupn^`ZNr\tsof[wA}e{\\z}w[YDQ|dt=wC\tNvbRZ@@U|ZAYpFsabCBB\\`wrqxsYW8uFyWdaWezeUeA_8VoVupvY[TD[OYdpO\bC[wX\\O]=[QRpV\0d`N\0RXt^Z}vEpdC=\bY?=V}?^W\bad|qN@Ww>@PycaqANE]asPcE^OB_VA?>wzeftac\tZ\tguf\bF]DCP?znNYf\tuaYu[`=b|v]Bp=RAS``\\PRDW]_`UXdUg=SuqwVFDeB\tD8{B>\\sPYbEU\tFQXz\0@`zsqgfD\0[WY\bPeZc}\t\0bx?Rfed}BUe|Uo\0y?\bsSXZOSBCgbFqf\0Bs?b?d<VE\\Zzns\\d@?dPvf\\{}_\0Sd[<q_YBY`Ffg=sY>{t<fu]xrFNtZONNTwbQO\\ZO=TN>bqQt^dOOaAFXw=\tPCVxsv?{`a\bvS8YQ[aNsOt[cU`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:::::")),Pe)];function De(e,t){var i=e.getIssuerHex();if(i===e.getSubjectHex())return e.verifySignature(e.getPublicKey());var r=function(e,t){for(var i=0,r=t;i<r.length;i++){var n=r[i];if(n.getSubjectHex()===e)return n}}(i,t);return!!r&&!1!==e.verifySignature(r.getPublicKey())&&De(r,t)}function ke(e){return e.getIssuerHex()!==e.getSubjectHex()&&De(e,Re)}!function(e){var t=new Be;"string"==typeof e?t.readCertPEM(e):t.readCertHex(e.hex);ke(t);Re.push(t)}(function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var i=113,r=126,n=0,o="";return arguments[n].split(o).map((function(e){return e.charCodeAt(n)>r?e:String.fromCharCode((e.charCodeAt(n)+i)%r)})).join(o)}(":::::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}QnAPRQFO=Yw\0_TePCOFV@|N>ROXcDrT<>bW<ssO?NOT{^s]uU\0gS\bBffsfE\0AfDyQEZR`]XBo|Qw}yYdwwTvOFcBndUz^\\{]\tb=^yQYSTQ`]\0?tR{WRUun\\\0bVe_E|VWWV|r\tAo\0\tF`fdzCnRtq\br\t\b8eBp=Z\\TRaadc}@Eub`quuNqAdF\0aUay{}x>tgVz`\t_YBFwu_q?egt8v[o\x008\twTQcrA\t<z{DZoEE^rZTrpaZQzqpBY]^zt8[bQv}yEWw\tXDYQB\0QB\bx_^X]|uEDtPf[n[r_bpB[bE}?ung|bnU|NYOoedY_tvXySZfYPdWV]OE^\bOFwA}<uXoO}_NDz8aonzWOfcv@?>snfqu@FeEx^\\\bVfuO`\\\0tSg]zDU}QrAT|\tOZV|OvpVD<sN@z`<_cSrNCW>?=Au?g_8v{|}}WF>Sr>QBxO\td_D}eBb?Uq^b\t[y}x]}{?P|BQtecTB[pQBW>|p|nfv\0zUxOO}WqwE=<PURZy@X8r\\]u=<pPNRNNn\\OtaO<ZOETPdPT`NTT8RVOQ^^`SuO`gdSp?cyVRg\bo?B=VR[OZO=TN>bqQt^dOO`FyWadZcAD\tpeXybcW@}Qf\\QNsOt[cU`ZRTQNdtOaAFXw=\tPCVxsv?{`a\bvS8YQ[aN]Ot[cU_ZONsEROaNQN^U<ZNTN>bqQ^RNVOOwN[Otx\0uxvTF=ON^SNN\\PNtRNrx\ta[}tP_g8FbD\0^\0qt<f88ufuN]^}]gp\bqYudF88Fas_Ef`\t?^x>X}esa{>\\r?eE]CC_cZ[vQs\t\t>gX[szONg=^pn=<e]nbSz\bZvac\b[w^nA_`vP|@8w[}nQobe=??oRYf{vpRxcC}yCd>8[NDx{Ne\\t8oou=guC>>gvb}ACd\t``Ntq\0yC[Q{|ynpNQqSqzxF<_PFDw<]Bnnu>F<XgU_Zf\\\\A=gu\\codOwQ]oQ<f>gv_pwozwC}xX>C`c]suEdfW?cbeo\b`BbyR@eFTUwSud=t]sS\\onc\tXSq\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 Oe(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,r=arguments.length;i<r;i++)for(var n in t=arguments[i])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},Fe.apply(this,arguments)};function Ne(e,t,i){if(i||2===arguments.length)for(var r,n=0,o=t.length;n<o;n++)!r&&n in t||(r||(r=Array.prototype.slice.call(t,0,n)),r[n]=t[n]);return e.concat(r||Array.prototype.slice.call(t))}Object.create,Object.create;var Ve,Qe=(Ve="$$FIVE_EVENT$$","undefined"==typeof Symbol?"$Symbol<".concat(Ve,">$"):Symbol(Ve));function He(e){return e[Qe]||(e[Qe]={}),e[Qe]}var qe=function(){function e(){}return e.prototype.hasListener=function(e){var t=He(this);return t&&t[e]&&t[e].length>0},e.prototype.on=function(e,t,i){var r=this,n=He(this);return n[e]||(n[e]=[]),n[e].push([t,i||!1]),function(){return r.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=He(this);if(i[e]||(i[e]=[]),void 0!==t){for(var r=0;r<i[e].length&&i[e][r][0]!==t;r++);r<i[e].length&&i[e].splice(r,1)}else i[e].length=0}else this[Qe]||delete this[Qe]},e.prototype.emit=function(e){for(var t=[],i=1;i<arguments.length;i++)t[i-1]=arguments[i];for(var r=!1,n=He(this),o=n[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&&(r=!0)}return r},e}();function Ue(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t]}var ze="undefined"!=typeof performance&&void 0!==performance.timing?performance.timing.navigationStart:Date.now(),je="undefined"!=typeof performance?function(){return ze+performance.now()}:function(){return Date.now()};function _e(e){Object.freeze(e);var t="function"==typeof e,i=Object.prototype.hasOwnProperty;return Object.getOwnPropertyNames(e).forEach((function(r){!i.call(e,r)||t&&("caller"===r||"callee"===r||"arguments"===r)||null===e[r]||"object"!=typeof e[r]&&"function"!=typeof e[r]||Object.isFrozen(e[r])||_e(e[r])})),e}var Ke=/^([^.]+)(\.([^.]+))*$/;function Ge(e){return/^(([1-9]?\d|1\d\d|2[0-4]\d|25[0-5])(\.(?!$)|$)){4}$/.test(e)}function We(e,t){return Ke.test(e)&&Ke.test(t)&&function(e,t){if("*"===e)return!0;var i=e.split(".").reverse(),r=t.split(".").reverse();if(i.length<=1)return e===t;for(var n=0;n<i.length;n++)if(i[n]!==r[n])return!1;return!0}(e,t)}var Xe,Ye=[/\.([0-9a-z]+)\.jsonp([\?\#].*)?$/i,/jsonp_([0-9a-z]+)([\?\#].*)?$/i],Ze=_e(JSON.parse(function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var i=113,r=126,n=0,o="";return arguments[n].split(o).map((function(e){return e.charCodeAt(n)>r?e:String.fromCharCode((e.charCodeAt(n)+i)%r)})).join(o)}("h/y|pnyu|/9/xr;p|z/9/yvn{wvn;p|z/9/rnyrr;p|z/9/rnyrr;p{/9/rnyrr;w}/9/uv;p|z/9/uv;p{/9/ywpq{;p|z/9/rnyrr:pq{;p|z/9/rnyrr:pq{;p{/9/pnyp{|qr;vr/j"))),Je=function(e){function t(t,i,r){return e.call(this,"[NETWORK]: request proxy error(type: ".concat(i,", reason: ").concat(r,"): ").concat(t))||this}return Oe(t,e),t}(Error),$e=function(e){function t(t,i,r){var n=e.call(this,"[NETWORK]: response error(type: ".concat(i,", status: ").concat(r,"): ").concat(t))||this;return n.httpStatus=r,n}return Oe(t,e),t}(Error),et=(Oe((function(e,t){return Xe.call(this,"[NETWORK]: request abort(type: ".concat(t,"): ").concat(e))||this}),Xe=Error),function(e){function t(t,i,r){return e.call(this,"[NETWORK]: request timeout(type: ".concat(i,", timeout: ").concat(r,"ms): ").concat(t))||this}return Oe(t,e),t}(Error)),tt=function(e){function t(t,i,r){return e.call(this,"[NETWORK]: request forbidden(type: ".concat(i,", reason: ").concat(r,"): ").concat(t))||this}return Oe(t,e),t}(Error);function it(e){for(var t=0,i=Ye;t<i.length;t++){var r=i[t],n=e.match(r);if(n)return"jsonp_"+n[1]}return null}function rt(e){return null!==it(e)}function nt(e){var t=e.match(/^([0-9a-z]+\:)\/\/(([^:/?#]*)(?::[0-9]+)?)/);return t?t[1]:location.protocol}function ot(e){return Ye.reduce((function(e,t){return e.replace(t,"")}),e)}function st(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 at=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Oe(t,e),t}(qe);function lt(e,t,i,r,n){void 0===t&&(t={}),void 0===i&&(i=Ue),void 0===r&&(r=Ue),void 0===n&&(n=Ue);var o=je(),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 r,n=it(e)?"Script":"XMLHttpRequest",o=new Je(s,n,i&&i.message?String(i.message):String(i));return null===(r=t.networkSubscribe)||void 0===r||r.emit("network",e,n,"proxy-error",o.message),Promise.reject(o)})).then((function(e){return new Promise((function(a,l){var u,c=t.allowHosts?Ze.concat(t.allowHosts):Ze.slice(),h=st(e),d=it(e);if(0!==location.hostname.length&&!Ge(location.hostname)&&0===Ze.filter((function(e){return We(e,location.hostname)})).length&&!Ge(h)&&0===c.filter((function(e){return We(e,h)})).length){var p=d?"Script":"XMLHttpRequest",f=new tt(e,p,"request host(".concat(h,") is not allowed"));return r(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(n){var u,c,h=je(),p=h-o;if(delete A[d],v.parentNode&&v.parentNode.removeChild(v),null!==g&&(window.clearTimeout(g),g=null),!0!==m){if(0!==n.indexOf("data:")){var f=new $e(e,"Script",500);return r(f),l(f),void(null===(u=t.networkSubscribe)||void 0===u||u.emit("network",e,"Script","error",f.message))}var y=n.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 n=new et(e,"Script",t.timeout||NaN);r(n),l(n),null===(i=t.networkSubscribe)||void 0===i||i.emit("network",e,"Script","timeout",n.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=Ue},w=function(){var i;if(!0!==y){y=!0,x();var n=new et(e,"XMLHttpRequest",t.timeout||NaN);r(n),l(n),null===(i=t.networkSubscribe)||void 0===i||i.emit("network",e,"XMLHttpRequest","timeout",n.message)}},M=function(e){!0!==y&&e.lengthComputable&&(e.total<=0||n(e.loaded/e.total))},E=function(r){var n;if(!0!==y){var l=this.status;if(0===l||l>=200&&l<400){y=!0,x();var u=je(),c=u-o,h=function(e){if(!e)return{};for(var t={},i=e.trim().split("\n"),r=0;r<i.length;r++){var n=i[r],o=n.indexOf(":"),s=n.slice(0,o).trim().toLowerCase(),a=n.slice(o+1).trim();a&&(t[s]?t[s]+=", "+a:t[s]=a)}return t}(this.getAllResponseHeaders()),d=r.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===(n=t.networkSubscribe)||void 0===n||n.emit("network",e,"XMLHttpRequest","ok",JSON.stringify(p.meta))}else S.call(this)}},S=function(){var i;if(!0!==y){y=!0,x();var n=new $e(e,"XMLHttpRequest",this.status);r(n),l(n),null===(i=t.networkSubscribe)||void 0===i||i.emit("network",e,"XMLHttpRequest","error",n.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 ut={};function ct(e,t){void 0===t&&(t={});var i=je(),r=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,o=new Je(r,"Link",i&&i.message?String(i.message):String(i));return null===(n=t.networkSubscribe)||void 0===n||n.emit("network",e,"Link","proxy-error",o.message),Promise.reject(o)})).then((function(e){return e in ut?ut[e]:ut[e]=new Promise((function(n,o){var s,a=t.allowHosts?Ze.concat(t.allowHosts):Ze.slice(),l=st(e);if(0!==location.hostname.length&&!Ge(location.hostname)&&0===Ze.filter((function(e){return We(e,location.hostname)})).length&&!Ge(l)&&0===a.filter((function(e){return We(e,l)})).length){var u=new tt(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,n();var s=je(),a={origin:r,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 r;if(!0!==d){d=!0;var n=new $e(e,"Link",0);o(n),null===(r=t.networkSubscribe)||void 0===r||r.emit("network",e,"Link","error",n.message)}}}))}))}function ht(e,t,i,r,n,o){void 0===t&&(t={}),void 0===i&&(i=Ue),void 0===r&&(r=Ue),void 0===n&&(n=Ue);var s=je(),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 r,n=new Je(a,"Image",i&&i.message?String(i.message):String(i));return null===(r=t.networkSubscribe)||void 0===r||r.emit("network",e,"Image","proxy-error",n.message),Promise.reject(n)})).then((function(e){return new Promise((function(l,u){var c,h=t.allowHosts?Ze.concat(t.allowHosts):Ze.slice(),d=st(e);if(0!==location.hostname.length&&!Ge(location.hostname)&&0===Ze.filter((function(e){return We(e,location.hostname)})).length&&!Ge(d)&&0===h.filter((function(e){return We(e,d)})).length){var p=new tt(e,"Image","request host(".concat(d,") is not allowed"));return r(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=Ue,f.onerror=Ue,g=null,!0!==A){A=!0;var n=new et(e,"Image",t.timeout);r(n),u(n),null===(i=t.networkSubscribe)||void 0===i||i.emit("network",e,"Image","timeout",n.message)}}),t.timeout)),f.onload=function(){var r;if(f.onload=Ue,f.onerror=Ue,null!==g&&(clearTimeout(g),g=null),!0!==A){var o=je();A=!0;var u={body:f,meta:{headers:{},origin:a,source:e,requestTime:s,responseTime:o,costs:o-s}};n(1),i(u),l(u),null===(r=t.networkSubscribe)||void 0===r||r.emit("network",e,"Image","ok",JSON.stringify(u.meta))}},f.onerror=function(){var i;if(f.onload=Ue,f.onerror=Ue,null!==g&&(clearTimeout(g),g=null),!0!==A){A=!0;var n=new $e(e,"Image",0);r(n),u(n),null===(i=t.networkSubscribe)||void 0===i||i.emit("network",e,"Image","ok",n.message)}},n(0),f.src=e}))}))}var dt=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)}}(),pt=16,ft=function(){function e(){this.frames=[],this.stoped=!1,this.time=je(),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 pt},e.prototype.loop=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(!this.stoped){var i=je(),r=i-this.time;this.time=i;var n=[];pt=r;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,Ne([i,r],e,!1))}catch(e){console.error(e)}a.once&&n.push(a)}}n.length>0&&(this.frames=this.frames.filter((function(e){return-1===n.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):dt(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,r){var n=this;void 0===t&&(t=!1),void 0===i&&(i=0),void 0===r&&(r=5);var o={callback:e,once:t,delay:i,order:r};return this.frames.push(o),this.frames.sort((function(e,t){return e.order-t.order})),function(){return n.remove(o)}},e.prototype.disponse=function(){this.stoped=!0,this.frames.length=0},e}(),At=/^https?\:\/\/?([^\/]+)/;function gt(e,t){return e.replace(At,(function(e,i){return e.slice(0,e.length-i.length)+t}))}var mt={"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 vt(e,t){var i=Fe(Fe({},mt),t.mappings),r=function(e){var t=e.match(At);return null===t?null:t[1]}(e);if(null===r)return e;var n=i[r];return n?(/\.basis(\?|$)/.test(e)&&!0!==t.basisLoaderInitialized&&(e=e.replace(/\.basis(\?|$)/,".jpg$1")),function(e,t){var i,r=e.split("?")[0],n=r.split(".").pop();if("jpeg"===n&&(n="jpg"),"png"!==n&&"jpg"!==n)return e;var o="";if(void 0!==t.format&&t.format!==n&&(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:n;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),r+o}(function(e,t,i){var r=t.split("."),n=r[0],o=r.slice(1);if("texture"===n)return gt(e,i.texture[0]);if("pano"===n||"pano_luminance"===n)switch(o[0],o[1]){case"front":case"left":case"up":return gt(e,i.pano[0]);case"down":case"right":case"back":return gt(e,i.pano[1])}else if("pano_tile"===n||"pano_tile_luminance"===n){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 gt(e,i.tile[u%2])}return gt(e,i.default[0])}(e,t.key,n),t)):e}function yt(e,t,i){return void 0===t&&(t=vt),t(e,i)}function bt(e){return new Promise((function(t){var i=new Image,r=setTimeout((function(){i.onload=i.onerror=function(){},clearTimeout(r),t(!1)}));i.onload=i.onerror=function(){i.onload=i.onerror=function(){},clearTimeout(r),t(2===i.height)},i.src=e}))}var xt=null;function wt(){return xt||(xt=Promise.all([bt("data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A="),bt("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}})))}var Mt=function(){function t(){this.numPlanes=0,this.clipperPlanes=null,this.clipperFloors=null}return Object.defineProperty(t,"shared",{get:function(){return this.sharedInstance||(this.sharedInstance=new t),this.sharedInstance},enumerable:!1,configurable:!0}),t.prototype.update=function(t,i){if(this.clipperFloors=[],t instanceof Array){this.clipperPlanes=new Float32Array(24*t.length);for(var r=function(r){var o=[new e.Plane(new e.Vector3(.5,0,0),-1),new e.Plane(new e.Vector3(-.5,0,0),-1),new e.Plane(new e.Vector3(0,.5,0),-1),new e.Plane(new e.Vector3(0,-.5,0),-1),new e.Plane(new e.Vector3(0,0,.5),-1),new e.Plane(new e.Vector3(0,0,-.5),-1)];o.forEach((function(e){e.applyMatrix4(t[r].clippingBoxMatrix)}));for(var s=n.projectPlanes(o,i),a=0;a<24;a++)n.clipperPlanes[24*r+a]=s[a];var l=t[r].floorIndex?t[r].floorIndex:-1;n.clipperFloors[r]=l},n=this,o=0;o<t.length;o++)r(o)}else{var s=[new e.Plane(new e.Vector3(.5,0,0),-1),new e.Plane(new e.Vector3(-.5,0,0),-1),new e.Plane(new e.Vector3(0,.5,0),-1),new e.Plane(new e.Vector3(0,-.5,0),-1),new e.Plane(new e.Vector3(0,0,.5),-1),new e.Plane(new e.Vector3(0,0,-.5),-1)];s.forEach((function(e){e.applyMatrix4(t.clippingBoxMatrix)})),this.clipperPlanes=this.projectPlanes(s,i),this.clipperFloors[0]=t.floorIndex?t.floorIndex:-1}},t.prototype.projectPlanes=function(t,i){var r=null!==t?t.length:0,n=4*r,o=i.matrixWorldInverse,s=new e.Matrix3;s.getNormalMatrix(o);for(var a=new Float32Array(n),l=new e.Plane,u=0,c=0;u!==r;++u,c+=4)l.copy(t[u]).applyMatrix4(o,s),l.normal.toArray(a,c),a[c+3]=l.constant;return a},t}(),Et=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.floorIndex=0,t.needsRender=!0,t}return Oe(t,e),t}(e.Mesh),St=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.needsRender=!0,t.enableTransparent=!0,t}return Oe(t,e),t.prototype.getTransparent=function(){return this.enableTransparent},t.prototype.setTransparent=function(e){this.enableTransparent=e,this.traverse((function(t){t instanceof Et&&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 Et){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 Et&&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 Et){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 r=i[e].value;r&&"function"==typeof r.dispose&&-1===t.indexOf(r)&&(i[e].value=null,t.push(r))}})),e.dispose()})),t.forEach((function(e){return e.dispose()}))}}))},t.prototype.disposeGeometry=function(){this.traverse((function(e){e instanceof Et&&e.geometry.dispose()}))},t}(e.Group),Ct=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.floorIndex=0,t}return Oe(t,e),t}(St),It=["right","left","up","down","front","back"];function Bt(t,i,r,n){var o=new e.Box3;switch(t){case"up":o.min.y=.5,o.max.y=.5,o.min.x=+i-.5,o.max.x=+i-.5+n,o.min.z=.5-r-n,o.max.z=.5-r;break;case"down":o.min.y=-.5,o.max.y=-.5,o.min.x=+i-.5,o.max.x=+i-.5+n,o.min.z=+r-.5,o.max.z=+r-.5+n;break;case"left":o.min.x=-.5,o.max.x=-.5,o.min.z=.5-i-n,o.max.z=.5-i,o.min.y=.5-r-n,o.max.y=.5-r;break;case"right":o.min.x=.5,o.max.x=.5,o.min.z=+i-.5,o.max.z=+i-.5+n,o.min.y=.5-r-n,o.max.y=.5-r;break;case"front":o.min.z=-.5,o.max.z=-.5,o.min.x=+i-.5,o.max.x=+i-.5+n,o.min.y=.5-r-n,o.max.y=.5-r;break;case"back":o.min.z=.5,o.max.z=.5,o.min.x=.5-i-n,o.max.x=.5-i,o.min.y=.5-r-n,o.max.y=.5-r}return o.applyMatrix4((new e.Matrix4).makeRotationY(Math.PI))}var Tt=function(t,i){if(!(t.level>=i))for(var r=t.level+1,n=t.size/2,o=0,s=[new e.Vector2(t.position.x,t.position.y),new e.Vector2(t.position.x+n,t.position.y),new e.Vector2(t.position.x,t.position.y+n),new e.Vector2(t.position.x+n,t.position.y+n)];o<s.length;o++){var a=s[o],l={face:t.face,level:r,size:n,position:a,box:Bt(t.face,a.x,a.y,n),children:[]};t.children.push(l),Tt(l,i)}};function Pt(t){var i=It.map((function(i){return function(t,i){var r={level:0,face:t,position:new e.Vector2(0,0),size:1,box:Bt(t,0,0,1),children:[]};return Tt(r,i),r}(i,t)}));return{children:i}}function Rt(e,t){for(var i=0,r=e.children;i<r.length;i++){var n=r[i];!1!==t(n)&&Rt(n,t)}}function Dt(e,t){for(var i={},r=0,n=t;r<n.length;r++){var o=n[r];o in e&&(i[o]=e[o])}return i}var kt=new e.BoxBufferGeometry(1,1,1,1,1);kt.deleteAttribute("uv"),kt.deleteAttribute("normal"),kt.groups=[],kt.scale(-1,1,1);var Lt,Ot=new e.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:e.NoBlending,lights:!1});function Ft(t,i,r){var n=new e.Scene,o=new e.Mesh(kt,Ot);Ot.uniforms.map.value=t,n.add(o);var s=r.autoClear;r.autoClear=!1,new e.CubeCamera(.1,2,i).update(r,n),r.autoClear=s,Ot.uniforms.map.value=null}var Nt=null!==(Lt=Math.SQRT1_2)&&void 0!==Lt?Lt:Math.sqrt(2),Vt={up:new e.Quaternion(Nt,0,0,Nt),down:new e.Quaternion(-Nt,0,0,Nt),left:new e.Quaternion(0,Nt,0,Nt),right:new e.Quaternion(0,-Nt,0,Nt),front:new e.Quaternion(0,0,0,1),back:new e.Quaternion(0,1,0,0)},Qt=function(){var t=new Float32Array([-.5,-.5,0,.5,-.5,0,-.5,.5,0,.5,.5,0]),i=new Float32Array([0,0,1,0,0,1,1,1]),r=new Uint8Array([0,1,2,1,3,2]),n=new e.BufferGeometry;return n.setAttribute("position",new e.BufferAttribute(t,3)),n.setAttribute("uv",new e.BufferAttribute(i,2)),n.setIndex(new e.BufferAttribute(r,1)),n}(),Ht=[];function qt(){var e=this.src;this.onerror=this.onload=Ue,this.removeAttribute("src"),/^blob\:/.test(e)&&URL.revokeObjectURL(e),this.close=Ue}function Ut(){Ht.push(this)}function zt(){return Object.assign(new Image,{crossOrigin:"",close:qt})}function jt(e){return new Promise((function(t,i){var r=zt();r.onload=function(){r.onload=r.onerror=Ue,setTimeout((function(){return t(r)}),30)},r.onerror=function(){var e=r.src;r.onload=r.onerror=Ue,r.close(),i(new Error("image load error: ".concat(e)))},r.src=URL.createObjectURL(e)}))}function _t(t,i){if(i&&(t.width>i.width||t.height>i.height)){var r=function(e,t){var i=Ht.shift();if(i)return i.width=e,i.height=t,i;var r=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");return Object.assign(r,{close:Ut})}(Math.min(t.width,i.width),Math.min(t.height,i.height)),n=r.getContext("2d");n.clearRect(0,0,r.width,r.height),n.drawImage(t,0,0,r.width,r.height),t.close();var o=new e.Texture(r);o.needsUpdate=!0,o.flipY=!0;var s=o.dispose;return o.dispose=function(){r.close(),s.call(o),delete o.dispose},o}var a=new e.Texture(t);a.needsUpdate=!0,a.minFilter=e.LinearFilter,a.magFilter=e.LinearFilter,a.flipY=!0;var l=a.dispose;return a.dispose=function(){t.close(),l.call(a),delete a.dispose},a}var Kt=new e.WebGLRenderTarget(1,1),Gt=new e.OrthographicCamera(-1,1,1,-1,0,1),Wt=new e.BufferGeometry;Wt.setAttribute("position",new e.Float32BufferAttribute([-1,3,0,-1,-1,0,3,-1,0],3)),Wt.setAttribute("uv",new e.Float32BufferAttribute([0,2,0,0,2,0],2));var Xt=new e.Mesh(Wt),Yt=new e.Scene;Yt.add(Xt);var Zt,Jt=new e.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:e.NoBlending,lights:!1}),$t=new e.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:e.NoBlending,lights:!1});function ei(t,i){if(!i)return Promise.resolve(t);var r=i.getRenderTarget();return i.setRenderTarget(Kt),t instanceof e.CubeTexture?(Xt.material=$t,$t.uniforms.map.value=t,i.render(Yt,Gt),$t.uniforms.map.value=null):(Xt.material=Jt,Jt.uniforms.map.value=t,i.render(Yt,Gt),$t.uniforms.map.value=null),i.setRenderTarget(r),new Promise((function(e){ft.shared.add((function(){return e(t)}),!0,4)}))}var ti='\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',ii={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},ri={COMPRESSED_RGB_S3TC_DXT1_EXT:33776,COMPRESSED_RGBA_S3TC_DXT1_EXT:33777,COMPRESSED_RGBA_S3TC_DXT3_EXT:33778,COMPRESSED_RGBA_S3TC_DXT5_EXT:33779},ni=((Zt={})[ii.cTFBC1]=ri.COMPRESSED_RGB_S3TC_DXT1_EXT,Zt[ii.cTFBC3]=ri.COMPRESSED_RGBA_S3TC_DXT5_EXT,Zt),oi=function(){function t(){}return t.setTranscoderPath=function(e){return this.transcoderPath=e,this},t.setWorkerLimit=function(e){return this.workerLimit=e,this},t.isInitialized=function(){return 0!==this.workerPool.filter((function(e){return e._initialized})).length},t.detectSupport=function(e){var i=this.workerConfig;if(i.astcSupported=!!e.extensions.get("WEBGL_compressed_texture_astc"),i.bptcSupported=!!e.extensions.get("EXT_texture_compression_bptc"),i.etcSupported=!!e.extensions.get("WEBGL_compressed_texture_etc1"),i.dxtSupported=!!e.extensions.get("WEBGL_compressed_texture_s3tc"),i.pvrtcSupported=!!e.extensions.get("WEBGL_compressed_texture_pvrtc")||!!e.extensions.get("WEBKIT_WEBGL_compressed_texture_pvrtc"),i.astcSupported)i.format=t.BASIS_FORMAT.cTFASTC_4x4;else if(i.bptcSupported)i.format=t.BASIS_FORMAT.cTFBC7_M5;else if(i.dxtSupported)i.format=t.BASIS_FORMAT.cTFBC3;else if(i.pvrtcSupported)i.format=t.BASIS_FORMAT.cTFPVRTC1_4_RGBA;else{if(!i.etcSupported)throw new Error("BasisTextureLoader: No suitable compressed texture format found.");i.format=t.BASIS_FORMAT.cTFETC1}return this},t.createTexture=function(t){var i,r,n=this,o=t.byteLength,s=this._allocateWorker(o).then((function(e){return i=e,r=n.workerNextTaskID++,new Promise((function(e,n){i._callbacks[r]={resolve:e,reject:n},i.postMessage({type:"transcode",id:r,buffer:t},[t])}))})).then((function(t){var i,r=n.workerConfig,o=t.width,s=t.height,a=t.mipmaps;switch(t.format){case ii.cTFASTC_4x4:i=new e.CompressedTexture(a,o,s,e.RGBA_ASTC_4x4_Format);break;case ii.cTFBC1:case ii.cTFBC3:i=new e.CompressedTexture(a,o,s,ni[r.format],e.UnsignedByteType);break;case ii.cTFETC1:i=new e.CompressedTexture(a,o,s,e.RGB_ETC1_Format);break;case ii.cTFPVRTC1_4_RGB:i=new e.CompressedTexture(a,o,s,e.RGB_PVRTC_4BPPV1_Format);break;case ii.cTFPVRTC1_4_RGBA:i=new e.CompressedTexture(a,o,s,e.RGBA_PVRTC_4BPPV1_Format);break;default:throw new Error("BasisTextureLoader: No supported format available.")}return i.minFilter=1===a.length?e.LinearFilter:e.LinearMipmapLinearFilter,i.magFilter=e.LinearFilter,i.generateMipmaps=!1,i.needsUpdate=!0,i}));return s.catch((function(){return!0})).then((function(){i&&r&&(i._taskLoad-=o,delete i._callbacks[r])})),s},t._initTranscoder=function(){var t=this;if(!this.transcoderPending){var i=new e.FileLoader;i.setPath(this.transcoderPath);var r=new Promise((function(e,t){i.load("basis_transcoder.js",e,void 0,t)})),n=new e.FileLoader;n.setPath(this.transcoderPath),n.setResponseType("arraybuffer");var o=new Promise((function(e,t){n.load("basis_transcoder.wasm",e,void 0,t)}));this.transcoderPending=Promise.all([r,o]).then((function(e){var i=e[0],r=e[1],n=["/* basis_transcoder.js */",i,"/* worker */",ti].join("\n");t.workerSourceURL=URL.createObjectURL(new Blob([n])),t.transcoderBinary=r}))}return this.transcoderPending},t._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 r=t.workerPool[t.workerPool.length-1];return r._taskLoad+=e,r}))},t.prototype.dispose=function(){for(var e=0;e<t.workerPool.length;e++)t.workerPool[e].terminate();return t.workerPool.length=0,this},t.BASIS_FORMAT=ii,t.DXT_FORMAT=ri,t.DXT_FORMAT_MAP=ni,t.transcoderPath="https://vr-public.realsee-cdn.cn/release/static/image/release/five/basis/",t.transcoderBinary=null,t.transcoderPending=null,t.workerLimit=1,t.workerPool=[],t.workerNextTaskID=1,t.workerSourceURL="",t.workerConfig={format:null,astcSupported:!1,bptcSupported:!1,etcSupported:!1,dxtSupported:!1,pvrtcSupported:!1},t}(),si=["right","left","up","down","front","back"];Object.assign(window,{cubeRenderTargetPool:[]});var ai=function(){function t(e,t,i,r,n){this.tileTree=t,this.tileSources=i,this.options=r,this.renderer=n,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(t.prototype,"cubeRenderTarget",{get:function(){return this._cubeRenderTarget},set:function(t){var i,r,n,o,s;if(null===t)throw new Error("cannot set cubeRenderTarget to null.");t.width!==this.options.textureSize&&t.setSize(this.options.textureSize,this.options.textureSize),t.texture.format=null!==(i=this.options.format)&&void 0!==i?i:e.RGBAFormat,t.texture.minFilter=null!==(r=this.options.minFilter)&&void 0!==r?r:e.LinearFilter,t.texture.magFilter=null!==(n=this.options.magFilter)&&void 0!==n?n:e.LinearFilter,t.texture.wrapS=null!==(o=this.options.wrapS)&&void 0!==o?o:e.ClampToEdgeWrapping,t.texture.wrapT=null!==(s=this.options.wrapT)&&void 0!==s?s:e.ClampToEdgeWrapping,this.baseCubeTexture&&(Ft(this.baseCubeTexture,t,this.renderer),this.baseCubeTexture.dispose(),this.baseCubeTexture=null),this._cubeRenderTarget&&Ft(this._cubeRenderTarget.texture,t,this.renderer),this._cubeRenderTarget=t},enumerable:!1,configurable:!0}),t.prototype.requestTile=function(t){var i,r,n,o,s,a,l=this,u=this.tileSources.filter((function(e){return e.level===t.level}))[0];if(u){var c=u.size,h=Math.pow(2,t.level)*t.position.y,d=Math.pow(2,t.level)*t.position.x,p="".concat((null!==(n=null===(r=null===(i=this.options.imageURL)||void 0===i?void 0:i.options)||void 0===r?void 0:r.key)&&void 0!==n?n:"pano.0").replace(/^pano/,"pano_tile"),".").concat(t.face,".").concat(t.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*t.size===this.options.tileImageSize?void 0:this.options.tileImageSize,quality:void 0,cut:[c*t.position.x,c*t.position.y,c*t.size,c*t.size]});this.loadingCubeNodes.add(t),this.options.textureLoader.loadTexture(u[t.face],{imageURL:{transform:null===(a=this.options.imageURL)||void 0===a?void 0:a.transform,options:Fe({},f)},format:e.RGBAFormat,preInit:!1,viaAjax:!1}).then((function(i){l.disposed?i.body.dispose():(l.textures.push({face:t.face,level:t.level,position:t.position,size:new e.Vector2(t.size,t.size),texture:i.body}),l.loadedCubeNodes.add(t))})).catch(Ue).then((function(){l.disposed||l.loadingCubeNodes.delete(t)}))}else this.loadedCubeNodes.add(t)},t.prototype.update=function(t,i){var r=this;if(!this.disposed){var n=[];Rt(this.tileTree,(function(e){return!(e.level>i)&&!r.loadingCubeNodes.has(e)&&!!t.intersectsBox(e.box)&&(r.loadedCubeNodes.has(e)?void 0:(n.push(e),!1))}));for(var o=0,s=n;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(t,i,r){var n=new e.Scene,o=new e.Group;o.scale.set(1,1,-1),n.add(o);for(var s=0,a=t;s<a.length;s++){var l=a[s],u=new e.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:e.NoBlending,lights:!1}),c=new e.Group,h=new e.Mesh(Qt,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(Vt[l.face]),c.add(h),o.add(c)}var d=r.autoClear;r.autoClear=!1,new e.CubeCamera(.1,2,i).update(r,n),r.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(t.prototype,"tilePending",{get:function(){return this.loadingCubeNodes.size},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"texture",{get:function(){if(!this._cubeRenderTarget)throw new Error("cubeRenderTarget never set.");return this._cubeRenderTarget.texture},enumerable:!1,configurable:!0}),t.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}},t}(),li=function(){function t(e){this.timeout=e.timeout,this.allowHosts=e.allowHosts,this.requestProxy=e.requestProxy,this.networkSubscribe=e.networkSubscribe}return t.prototype.setAllowHosts=function(e){this.allowHosts=e},t.prototype.setRequestProxy=function(e){this.requestProxy=e},t.prototype.setNetworkSubscribe=function(e){this.networkSubscribe=e},t.prototype.loadTexture=function(t,i,r,n,o,s){var a,l,u,c;void 0===i&&(i={}),void 0===r&&(r=Ue),void 0===n&&(n=Ue),void 0===o&&(o=Ue);var h={};void 0!==i.flipY&&(h.flipY=i.flipY),void 0!==i.format&&(h.format=i.format),void 0!==i.minFilter&&(h.minFilter=i.minFilter),void 0!==i.magFilter&&(h.magFilter=i.magFilter);var d=null!==(l=null===(a=i.imageURL)||void 0===a?void 0:a.options)&&void 0!==l?l:{basisLoaderInitialized:!1,key:"unknown"},p=nt(t=yt(t,null===(u=i.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=i.viaAjax)&&void 0!==c&&c,g=rt(t),m=/^https?:/.test(p),v=/\.basis$/.test(ot(t).split("?")[0]);if(g?A=!0:m||(A=!1),A){if(v){var y=null,b="arraybuffer";return!0===i.flipY?Promise.reject(new Error(".basis cannnot set flipY: true.")):lt(t,Fe(Fe({},f),{responseType:b}),void 0,void 0,o).then((function(e){return y=e.meta,oi.createTexture(e.body)})).then((function(t){return Object.assign(t,Fe({flipY:!1,encoding:e.sRGBEncoding},Dt(i,["wrapS","wrapT"]))),!1!==i.preInit?ei(t,s):t})).then((function(e){var t={meta:y,body:e};return r(t),t})).catch((function(e){return n(e),Promise.reject(e)}))}return b="blob",lt(t,Fe(Fe({},f),{responseType:b}),void 0,void 0,o).then((function(e){return jt(e.body)})).then((function(e){return _t(e,i.maxSize)})).then((function(e){return Object.assign(e,h),!1!==i.preInit?ei(e,s):e})).then((function(e){var t={meta:null,body:e};return r(t),t})).catch((function(e){return n(e),Promise.reject(e)}))}if(v){var x=new Error("cannot load basis texture via image");return n(x),Promise.reject(x)}var w=null,M=zt();return ht(t,f,void 0,void 0,o,M).then((function(e){return w=e.meta,_t(e.body,i.maxSize)})).then((function(e){return Object.assign(e,Fe(Fe({},h),{flipY:!0})),!1!==i.preInit?ei(e,s):e})).then((function(e){var t={meta:w,body:e};return r(t),t})).catch((function(e){return M.close(),n(e),Promise.reject(e)}))},t.prototype.loadCubeTexture=function(t,i,r,n,o,s){var a,l,u,c;void 0===i&&(i={}),void 0===r&&(r=Ue),void 0===n&&(n=Ue),void 0===o&&(o=Ue);var h={};void 0!==i.format&&(h.format=i.format),void 0!==i.minFilter&&(h.minFilter=i.minFilter),void 0!==i.magFilter&&(h.magFilter=i.magFilter);for(var d=[t[si[0]],t[si[1]],t[si[2]],t[si[3]],t[si[4]],t[si[5]]],p={timeout:this.timeout,allowHosts:this.allowHosts,requestProxy:this.requestProxy,networkSubscribe:this.networkSubscribe},f=[],A=[0,0,0,0,0,0],g=[],m=function(e){var t=null!==(l=null===(a=i.imageURL)||void 0===a?void 0:a.options)&&void 0!==l?l:{basisLoaderInitialized:!1,key:"unknown"},r=yt(d[e],null===(u=i.imageURL)||void 0===u?void 0:u.transform,Fe(Fe({},t),{key:t.key+"."+si[e]})),s=nt(r),h=function(t){A[e]=t,o(A.reduce((function(e,t){return e+t}),0)/6)},m=null!==(c=i.viaAjax)&&void 0!==c&&c,v=/^https?:$/.test(s),y=rt(r),b=/\.basis$/.test(ot(r).split("?")[0]);if(y?m=!0:v||(m=!1),m)if(b){var x="arraybuffer",w=lt(r,Fe(Fe({},p),{responseType:x}),void 0,void 0,h).then((function(t){return g[e]=t.meta,oi.createTexture(t.body)}));f.push(w)}else x="blob",w=lt(r,Fe(Fe({},p),{responseType:x}),void 0,void 0,h).then((function(t){return g[e]=t.meta,jt(t.body)})),f.push(w);else{if(b){var M=new Error("cannot load basis texture via image");return n(M),{value:Promise.reject(M)}}var E=zt();w=ht(r,p,void 0,void 0,h,E).then((function(t){return g[e]=t.meta,t.body})).catch((function(e){return E.close(),Promise.reject(e)})),f.push(w)}},v=0;v<6;v++){var y=m(v);if("object"==typeof y)return y.value}return Promise.all(f).then((function(t){var i;if(t[0]instanceof e.CompressedTexture){(i=new e.CubeTexture(t)).needsUpdate=!0;var r=i.dispose;i.dispose=function(){for(var e=0,n=t;e<n.length;e++)n[e].dispose();r.call(i),delete i.dispose},i.isCompressedTexture=!0,i.format=t[0].format,i.minFilter=t[0].minFilter,i.magFilter=t[0].magFilter}else i=function(t){var i=new e.CubeTexture(t);i.needsUpdate=!0,i.minFilter=e.LinearFilter,i.magFilter=e.LinearFilter,i.flipY=!1;var r=i.dispose;return i.dispose=function(){for(var e=0,n=t;e<n.length;e++)n[e].close();r.call(i),delete i.dispose},i}(t);return i})).then((function(t){return t.isCompressedTexture?Object.assign(t,Fe({flipY:!1,encoding:e.sRGBEncoding},Dt(i,["wrapS","wrapT"]))):Object.assign(t,Fe({flipY:!1,encoding:e.sRGBEncoding},i)),!1!==i.preInit?ei(t,s):t})).then((function(e){var t={body:e,meta:g};return r(t),t})).catch((function(t){for(var i=0,r=f;i<r.length;i++)r[i].then((function(t){t instanceof e.Texture?t.dispose():t.close()})).catch(Ue);return n(t),Promise.reject(t)}))},t.prototype.loadTiledCubeTexture=function(t,i,r,n,o,s,a){var l=this;return void 0===r&&(r={}),void 0===n&&(n=Ue),void 0===o&&(o=Ue),void 0===s&&(s=Ue),new Promise((function(u,c){var h,d;l.loadCubeTexture(t,{imageURL:{transform:null===(h=r.imageURL)||void 0===h?void 0:h.transform,options:null===(d=r.imageURL)||void 0===d?void 0:d.options},format:e.RGBAFormat,preInit:!1,viaAjax:r.viaAjax},(function(e){var t,o;e.body.generateMipmaps=!1;var s=e.meta,c=e.body,h=null!==(t=r.tileImageSize)&&void 0!==t?t:512,d=null!==(o=r.tileMaxLevel)&&void 0!==o?o:2,p=Math.max(1024*d,512),f=Pt(d),A={meta:s,body:new ai(c,f,i,{textureSize:p,tileImageSize:h,textureLoader:l,imageURL:r.imageURL},a)};n(A),u(A)}),(function(e){o(e),c(e)}),s,a).catch(Ue)}))},t}();const ui=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var i=113,r=126,n=0,o="";return arguments[n].split(o).map((function(e){return e.charCodeAt(n)>r?e:String.fromCharCode((e.charCodeAt(n)+i)%r)})).join(o)}("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"),ci=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var i=113,r=126,n=0,o="";return arguments[n].split(o).map((function(e){return e.charCodeAt(n)>r?e:String.fromCharCode((e.charCodeAt(n)+i)%r)})).join(o)}("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\\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--tylSntP|y|-J-rpA5tylSntP|y|;to9-|}npv\b6H--tylSntP|y|-J-zv5}n{|P|y|9-tylSntP|y|9-z|qryNy}un6H\f");var hi=new e.WebGLCubeRenderTarget(1).texture;hi.name="EMPTY_TEXTURE";var di=Object.assign({modelAlpha:new e.Uniform(0),progress:new e.Uniform(0),pano0_map:new e.Uniform(hi),pano0_luminanceMap:new e.Uniform(null),pano0_matrix:new e.Uniform(new e.Matrix4),pano1_map:new e.Uniform(hi),pano1_luminanceMap:new e.Uniform(null),pano1_matrix:new e.Uniform(new e.Matrix4),floorIndex:-1,floorInfo:new e.Vector3(0,0,0),clipperPlanesArray:new Float32Array,clipperFloors:[],modelColorInfo:new e.Uniform(null)},{exposure:new e.Uniform(1),emissive:new e.Uniform(new e.Color(0)),emissiveMap:new e.Uniform(null),specular:new e.Uniform(new e.Color(1118481)),specularMap:new e.Uniform(null),normalMap:new e.Uniform(null),bumpMap:new e.Uniform(null),shininess:new e.Uniform(30)},e.UniformsUtils.clone(e.UniformsLib.common),e.UniformsUtils.clone(e.UniformsLib.lights)),pi=function(t){function i(i){void 0===i&&(i={});var r,n,o,s,a,l,u,c,h,d=this;d=t.call(this,{vertexShader:ui,fragmentShader:ci,uniforms:e.UniformsUtils.clone(di),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:e.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=hi,this.uniforms.pano0_luminanceMap.value=null,this.uniforms.pano0_matrix.value.identity()):(this.uniforms.pano0_map.value=e.map instanceof ai?e.map.texture:e.map,this.uniforms.pano0_luminanceMap.value=e.luminanceMap instanceof ai?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=hi,this.uniforms.pano1_luminanceMap.value=null,this.uniforms.pano1_matrix.value.identity()):(this.uniforms.pano1_map.value=e.map instanceof ai?e.map.texture:e.map,this.uniforms.pano1_luminanceMap.value=e.luminanceMap instanceof ai?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(t){this.uniforms.opacity.value=t;var i=t<1?e.NormalBlending:e.NoBlending;i!==this.blending&&(this.blending=i,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(t){t&&t.equals(new e.Vector3(0,0,0))&&(this.defines.USE_CLIPFLOOR=!1,this.needsUpdate=!0),t&&!t.equals(new e.Vector3(0,0,0))&&(this.defines.USE_CLIPFLOOR=!0,this.uniforms.floorInfo.value=t,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!==(r=i.pano0)&&void 0!==r?r:null,d.pano1=null!==(n=i.pano1)&&void 0!==n?n:null,d.modelAlpha=null!==(o=i.modelAlpha)&&void 0!==o?o:1,d.progress=null!==(s=i.progress)&&void 0!==s?s:0,d.useBlackTransition=null!==(a=i.useBlackTransition)&&void 0!==a&&a,d.modelColorInfo=null!==(l=i.modelColorInfo)&&void 0!==l?l:null,d.opacity=null!==(u=i.opacity)&&void 0!==u?u:1,d.originOpacity=1,d.floorIndex=null!==(c=i.floorIndex)&&void 0!==c?c:-1,d.floorInfo=null!==(h=i.floorInfo)&&void 0!==h?h:null,d.clippers=null,d.clipperPlanesArray=null,d.clipperFloors=null,d}return Oe(i,t),i}(e.ShaderMaterial),fi=function(t){function i(i){var r=i.preserveDrawingBuffer,n=void 0===r||r,o=i.backgroundColor,s=void 0===o?1579548:o,a=i.backgroundAlpha,l=void 0===a?1:a,u=i.pixelRatio,c=void 0===u?1:u,h=i.antialias,d=void 0!==h&&h,p=i.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=t.call(this,{antialias:d,preserveDrawingBuffer:n,alpha:l<1,canvas:A,context:g})||this}else f=t.call(this,{antialias:d,preserveDrawingBuffer:n,alpha:l<1})||this;return f.setPixelRatio(c),f.setClearColor(s,l),f.outputEncoding=e.sRGBEncoding,f.autoClear=!0,f}return Oe(i,t),i}(e.WebGLRenderer),Ai=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Oe(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}(e.Scene),gi=2*Math.PI,mi=Math.PI/2;function vi(e){return e>0&&e<=gi?e:(e%gi+gi)%gi}var yi,bi,xi,wi,Mi=function(t){function i(i,r,n,o,s,a){void 0===r&&(r=1),void 0===n&&(n=.1),void 0===o&&(o=1e3),void 0===s&&(s=new e.Vector2),void 0===a&&(a=1);var l=t.call(this)||this;l.fov=i,l.aspect=r,l.near=n,l.far=o,l.perspToOrtho=s,l.orthoDistance=a,l.needsRender=!0,l.pose={longitude:0,latitude:0,fov:i,distance:0,offset:new e.Vector3},l.computePose(),l.perspectiveCamera=new e.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 e.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 Oe(i,t),i.prototype.computePose=function(){var t=this.getWorldDirection(new e.Vector3);return this.pose.longitude=vi(-Math.atan2(t.x,-t.z)),this.pose.latitude=-Math.asin(t.y/1),this.pose.fov=this.fov,this.pose.distance=0,this.pose.offset.copy(this.position),this},i.prototype.setFromPose=function(t){var i,r,n,o,s,a=vi(null!==(i=t.longitude)&&void 0!==i?i:this.pose.longitude),l=Math.max(1e-4-mi,Math.min(mi-1e-4,null!==(r=t.latitude)&&void 0!==r?r:this.pose.latitude)),u=null!==(n=t.fov)&&void 0!==n?n:this.pose.fov,c=null!==(o=t.distance)&&void 0!==o?o:this.pose.distance,h=null!==(s=t.offset)&&void 0!==s?s:this.pose.offset,d=function(t){var i=Math.abs(Math.cos(t.latitude));return new e.Vector3(-Math.sin(t.longitude)*i,-Math.sin(t.latitude),-Math.cos(t.longitude)*i)}({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},i.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()}},i.prototype.computeProjectionMatrix=function(){!function(e,t,i,r){i=Math.pow(i,2);for(var n=0;n<16;n++)r.elements[n]=e.elements[n]+(t.elements[n]-e.elements[n])*i}(this.orthographicCamera.projectionMatrix,this.perspectiveCamera.projectionMatrix,1-this.perspToOrtho.x,this.projectionMatrix),this.projectionMatrixInverse.getInverse(this.projectionMatrix),this.needsRender=!0},i.prototype.setViewOffset=function(e,t,i,r,n,o){this.perspectiveCamera.setViewOffset(e,t,i,r,n,o),this.orthographicCamera.setViewOffset(e,t,i,r,n,o),this.computeProjectionMatrix()},i.prototype.clearViewOffset=function(){this.perspectiveCamera.clearViewOffset(),this.orthographicCamera.clearViewOffset(),this.computeProjectionMatrix()},i.prototype.updateProjectionMatrix=function(){this.perspectiveCamera.updateProjectionMatrix(),this.orthographicCamera.updateProjectionMatrix(),this.computeProjectionMatrix()},Object.defineProperty(i.prototype,"perspectiveProjectionMatrix",{get:function(){return this.perspectiveCamera.projectionMatrix},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"perspectiveProjectionMatrixInverse",{get:function(){return this.perspectiveCamera.projectionMatrixInverse},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"orthographicProjectionMatrix",{get:function(){return this.orthographicCamera.projectionMatrix},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"orthographicProjectionMatrixInverse",{get:function(){return this.orthographicCamera.projectionMatrixInverse},enumerable:!1,configurable:!0}),i.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 r=Math.max(this.orthoDistance,.01)*Math.tan(.5*this.fov/180*Math.PI),n=-.5*this.aspect*2*r;this.orthographicCamera.left=n,this.orthographicCamera.right=-n,this.orthographicCamera.top=r,this.orthographicCamera.bottom=-r,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(i.prototype,"isPerspectiveCamera",{get:function(){return this.perspToOrtho.x<1},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"isOrthographicCamera",{get:function(){return this.perspToOrtho.x>=1},enumerable:!1,configurable:!0}),i.prototype.copy=function(e,i){return t.prototype.copy.call(this,e,i),this.fov=e.fov,this.aspect=e.aspect,this.near=e.near,this.far=e.far,this.perspToOrtho.copy(e.perspToOrtho),this.orthoDistance=e.orthoDistance,this.updateTime(je(),0),this},i}(e.Camera),Ei=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,r=this.z;return this.x=i*e.z-r*e.y,this.y=r*e.x-t*e.z,this.z=t*e.y-i*e.x,this},e.prototype.crossVectors=function(e,t){var i=e.x,r=e.y,n=e.z,o=t.x,s=t.y,a=t.z;return this.x=r*a-n*s,this.y=n*o-i*a,this.z=i*s-r*o,this},e.prototype.clone=function(){return new e(this.x,this.y,this.z)},e}(),Si=function(e,t,i){this.extents=e,this.startIndex=t,this.endIndex=i},Ci=function(e,t){this.triangle=e,this.intersectionPoint=t},Ii=(yi=new Ei(0,0,0),bi=new Ei(0,0,0),xi=new Ei(0,0,0),wi=new Ei(0,0,0),function(e,t,i,r,n,o){bi.subVectors(t,e),xi.subVectors(i,e),wi.crossVectors(bi,xi);var s,a=n.dot(wi);if(a>0){if(o)return null;s=1}else{if(!(a<0))return null;s=-1,a=-a}yi.subVectors(r,e);var l=s*n.dot(xi.crossVectors(yi,xi));if(l<0)return null;var u=s*n.dot(bi.cross(yi));if(u<0)return null;if(l+u>a)return null;var c=-s*yi.dot(wi);if(c<0)return null;var h=c/a;return new Ei(0,0,0).copy(n).multiplyScalar(h).add(r)}),Bi=function(e,t){this.min=e,this.max=t};function Ti(e,t,i){var r=new Bi(0,0);t.x>=0?(r.min=(i.extents[0]-e.x)*t.x,r.max=(i.extents[3]-e.x)*t.x):(r.min=(i.extents[3]-e.x)*t.x,r.max=(i.extents[0]-e.x)*t.x);var n=new Bi(0,0);if(t.y>=0?(n.min=(i.extents[1]-e.y)*t.y,n.max=(i.extents[4]-e.y)*t.y):(n.min=(i.extents[4]-e.y)*t.y,n.max=(i.extents[1]-e.y)*t.y),r.min>n.max||n.min>r.max)return!1;n.min>r.min&&(r.min=n.min),n.max<r.max&&(r.max=n.max);var o=new Bi(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),!(r.min>o.max||o.min>r.max||(o.min>r.min&&(r.min=o.min),o.max<r.max&&(r.max=o.max),r.max<0))}function Pi(e,t,i,r,n){if(i>=r)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<r;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-n,s-n,a-n,l+n,u+n,c+n]}var Ri=1e-6,Di=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,r=new Uint32Array(i),n=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)r[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),n[p]=A,n[p+1]=g,n[p+2]=m,n[p+3]=v,n[p+4]=y,n[p+5]=b;var w,M=new Si([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=r[p],n[6*g+h]+n[6*g+h+3]<d?p++:A=g):(g=r[f],n[6*g+h]+n[6*g+h+3]>=d||(r[p]=g,r[f]=A,A=-1,p++),f--);if(p>i&&p<s){var m=new Si(Pi(r,n,i,p,Ri),i,p);m.endIndex-m.startIndex>e&&o.push(m);var v=new Si(Pi(r,n,p,s,Ri),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=r,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 r,n=this.trianglesArray,o=this.offsetArray,s=this.rootNode,a=[],l=[],u=new Ei(1/t.x,1/t.y,1/t.z),c=[s];r=c.pop();)if(Ti(e,u,r)){r.node0&&c.push(r.node0),r.node1&&c.push(r.node1);for(var h=r.startIndex;h<r.endIndex;h++)a.push(o[h])}for(var d=new Ei(0,0,0),p=new Ei(0,0,0),f=new Ei(0,0,0),A=new Ei(e.x,e.y,e.z),g=new Ei(t.x,t.y,t.z),m=void(h=0),v=a.length;h<v;h++){m=9*a[h],d.x=n[m],d.y=n[m+1],d.z=n[m+2],p.x=n[m+3],p.y=n[m+3+1],p.z=n[m+3+2],f.x=n[m+6],f.y=n[m+6+1],f.z=n[m+6+2];var y=Ii(d,p,f,A,g,i);y&&l.push(new Ci([d.clone(),p.clone(),f.clone()],y))}return l},e.prototype.dispose=function(){delete this.offsetArray,delete this.rootNode},e}(),ki=!1,Li=[];function Oi(e){if(void 0===e&&(e=!1),e||!ki){ki=!0;var t=Li.shift();if(t){try{t()}catch(e){}ft.shared.add((function(){return Oi(!0)}),!0,2)}else ki=!1}}function Fi(e){return new Promise((function(t,i){Li.push((function(){try{t(e())}catch(e){i(e)}})),Oi()}))}function Ni(){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,r=e;r--;)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],r=(this._range>>>11)*i;return(2147483648^this._code)<(2147483648^r)?(this._range=r,e[t]+=2048-i>>>5,0==(4278190080&this._range)&&(this._code=this._code<<8|this._stream.readByte(),this._range<<=8),0):(this._range-=r,this._code-=r,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,r=0,n=0;n<this._numBitLevels;++n)i=i<<1|(t=e.decodeBit(this._models,i)),r|=t<<n;return r},e.reverseDecode2=function(e,t,i,r){for(var n,o=1,s=0,a=0;a<r;++a)o=o<<1|(n=i.decodeBit(e,t+o)),s|=n<<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,r,n=1;do{if(i=t>>7&1,t<<=1,n=n<<1|(r=e.decodeBit(this._decoders,(1+i<<8)+n)),i!==r){for(;n<256;)n=n<<1|e.decodeBit(this._decoders,n);break}}while(n<256);return 255&n},e.LiteralDecoder=function(){},e.LiteralDecoder.prototype.create=function(t,i){var r;if(!this._coders||this._numPrevBits!==i||this._numPosBits!==t)for(this._numPosBits=t,this._posMask=(1<<t)-1,this._numPrevBits=i,this._coders=[],r=1<<this._numPrevBits+this._numPosBits;r--;)this._coders[r]=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 r=1<<i;return!(e>8||t>4||i>4||(this._literalDecoder.create(t,e),this._lenDecoder.create(r),this._repLenDecoder.create(r),this._posStateMask=r-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,r){var n,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();r<0||A<r;)if(n=A&this._posStateMask,0===this._rangeDecoder.decodeBit(this._isMatchDecoders,(c<<4)+n))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)+n)&&(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,n),c=c<7?8:11);else if(f=p,p=d,d=h,s=2+this._lenDecoder.decode(this._rangeDecoder,n),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,r,n,o;return!(e.size<5)&&(i=(t=e.readByte())%9,r=(t=~~(t/9))%5,n=~~(t/5),!!this.setLcLpPb(i,r,n)&&(o=e.readByte(),o|=e.readByte()<<8,o|=e.readByte()<<16,o+=16777216*e.readByte(),this.setDictionarySize(o)))},e.decompress=function(t,i,r,n){var o=new e.Decoder;if(!o.setDecoderProperties(t))throw"Incorrect stream properties";if(!o.decode(i,r,n))throw"Error in data stream";return!0},e.decompressFile=function(t,i){var r,n=new e.Decoder;if(!n.setDecoderProperties(t))throw"Incorrect stream properties";if(r=t.readByte(),r|=t.readByte()<<8,r|=t.readByte()<<16,r+=16777216*t.readByte(),t.readByte(),t.readByte(),t.readByte(),t.readByte(),!n.decode(t,i,r))throw"Error in data stream";return!0},e}var Vi=Ni(),Qi="\nvar decodeLZMA = (function() {\n var LZMA = (".concat(Ni.toString(),")();\n return function(data, callback) {\n return (").concat(function(e,t,i){try{var r={data:t,offset:0,readByte:function(){return this.data[this.offset++]}},n=r.data.length,o={data:[],offset:0,writeByte:function(e){var t=Math.floor(this.offset/n);this.data[t]||(this.data[t]=new Uint8Array(n)),this.data[t][this.offset%n]=e,this.offset++}};e.decompressFile(r,o);for(var s=new Uint8Array(o.offset),a=0;a<o.offset;a++)s[a]=o.data[Math.floor(a/n)][a%n];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),r=0;r<t.length;r++)i[t.charCodeAt(r)]=r;var n,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(n=0;n<c;n+=4)o=i[e.charCodeAt(n)],s=i[e.charCodeAt(n+1)],a=i[e.charCodeAt(n+2)],l=i[e.charCodeAt(n+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///wNLBEBBAEHAAEEXQSIQAAALIAEQAiICQQhqIAEQAyAARQRAQQwQASEACyAAQQA2AgAgAEEANgIEIABBADYCCCAAIAI2AgAgAEEANgIEIAAgATYCCCAACwoAQQwQASAAEA4LBgAgABAPCyoAIAEgACgCCE8EQEEAQcAAQSdBPxAAAAsgACgCBCABIAAoAgBqai0ACAssACABIAAoAghPBEBBAEHAAEEyQT8QAAALIAAoAgQgASAAKAIAamogAjoACAtkAQJ/QQ0QDyECA0AgAUENSARAIAIgASAAIAEQEUH/AXEQEiABQQFqIQEMAQsLQQAhAEEAIQEDQCABQQhIBEAgAiABQQVqEBFB/wFxIAFBA3R0IAByIQAgAUEBaiEBDAELCyAACwYAIAAQEwsnACAAIAEQDzYCCCAAQQA2AgwgACABNgIUIABBADoAGCAAQQA2AgALJAAgACgCCCAAKAIYEBUgAEGABiAAKAIMIAAtABRqdBAGNgIgC5UBAQR/IAEhBSAAIgYoAgAhASAAKAIEIQcgACgCCEEBdiEEIAJBAEgEfyACIARqIgBBACAAQQBKGwUgAiIAIAQgACAESBsLIQIgA0EASAR/IAMgBGoiAEEAIABBAEobBSADIgAgBCAAIARIGwshAwNAIAIgA05FBEAgAkEBdCABaiAHaiAFOwEIIAJBAWohAgwBCwsgBgssAQF/AkACQAJAIwRBAWsOAwEBAgALAAtB/////wchAQsgAEGACEEAIAEQFwvBAQECfyAAQQIQBjYCACAAKAIAIgEoAgAgASgCBGpBgAg7AQggACgCACICKAIAIQEgAigCBCABQQJqakGACDsBCCAAKAIMKAIAQQEkBBAYGkEAIQIDQCACQRBIBEAgAiAAKAIEKAIAIgEoAgBBAnZJBH8gAkECdCABaigCCAUACygCAEEBJAQQGBogAiAAKAIIKAIAIgEoAgBBAnZJBH8gAkECdCABaigCCAUACygCAEEBJAQQGBogAkEBaiECDAELCwuHAgEFfyAAIQJBgAYgACgCDCAALQAUanQhAQNAIAMgAUgEQCACKAIgIgQoAgAhBSAEKAIEIANBAXQgBWpqQYAIOwEIIANBAWohAwwBCwsgAiEBQQAhAgNAIAJBBEkEQCACIAEoAiQoAgAiAygCAEECdkkEfyACQQJ0IANqKAIIBQALKAIAQQEkBBAYGiACQQFqIQIMAQsLIAEoAigoAgBBASQEEBgaIAEoAixBASQEEBgaIAAoAjBBASQEEBgaIAAoAjRBASQEEBgaIAAoAjhBASQEEBgaIAAoAjxBASQEEBgaIAAoAkBBASQEEBgaIAAoAkRBASQEEBgaIAAoAkgQGSAAKAJMEBkLyAwBA38DQCABQQNxIAIgAhsEQCAAIgRBAWohACABIgNBAWohASAEIAMtAAA6AAAgAkEBayECDAELCyAAQQNxRQRAA0AgAkEQTwRAIAAgASgCADYCACAAQQRqIAFBBGooAgA2AgAgAEEIaiABQQhqKAIANgIAIABBDGogAUEMaigCADYCACABQRBqIQEgAEEQaiEAIAJBEGshAgwBCwsgAkEIcQRAIAAgASgCADYCACAAQQRqIAFBBGooAgA2AgAgAUEIaiEBIABBCGohAAsgAkEEcQRAIAAgASgCADYCACABQQRqIQEgAEEEaiEACyACQQJxBEAgACABLwEAOwEAIAFBAmohASAAQQJqIQALIAJBAXEEQCAAIAEtAAA6AAALDwsgAkEgTwRAAkACQAJAIABBA3EiA0EBRwRAIANBAkYNASADQQNGDQIMAwsgASgCACEFIAAgASIDLQAAOgAAIABBAWoiASABIANBAWoiAS0AADoAAEEBaiIEQQFqIQAgAUEBaiIDQQFqIQEgBCADLQAAOgAAIAJBA2shAgNAIAJBEU8EQCAAIAFBAWooAgAiA0EIdCAFQRh2cjYCACAAQQRqIAFBBWooAgAiBUEIdCADQRh2cjYCACAAQQhqIAFBCWooAgAiA0EIdCAFQRh2cjYCACAAQQxqIAFBDWooAgAiBUEIdCADQRh2cjYCACABQRBqIQEgAEEQaiEAIAJBEGshAgwBCwsMAgsgASgCACEFIAAgAS0AADoAACAAQQFqIgRBAWohACABQQFqIgNBAWohASAEIAMtAAA6AAAgAkECayECA0AgAkESTwRAIAAgAUECaigCACIDQRB0IAVBEHZyNgIAIABBBGogAUEGaigCACIFQRB0IANBEHZyNgIAIABBCGogAUEKaigCACIDQRB0IAVBEHZyNgIAIABBDGogAUEOaigCACIFQRB0IANBEHZyNgIAIAFBEGohASAAQRBqIQAgAkEQayECDAELCwwBCyABKAIAIQUgACIEQQFqIQAgASIDQQFqIQEgBCADLQAAOgAAIAJBAWshAgNAIAJBE08EQCAAIAFBA2ooAgAiA0EYdCAFQQh2cjYCACAAQQRqIAFBB2ooAgAiBUEYdCADQQh2cjYCACAAQQhqIAFBC2ooAgAiA0EY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")}.toString(),")();\n return function(data, callback) {\n return (").concat(function(e,t,i){try{var r=new WebAssembly.Memory({initial:16}),n=new WebAssembly.Module(e),o=new WebAssembly.Instance(n,{env:{memory:r,abort:function(){i(new Error("webAssembly abort"))}}}).exports,s=o.newU8Array(t.length);new Uint8Array(r.buffer,s+24,t.length).set(t);var a=o.decode(s),l=new Uint32Array(r.buffer,a,4),u=l[0],c=l[2],h=l[3];u?i(null,new Uint8Array(r.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'),Hi="undefined"!=typeof Worker&&"undefined"!=typeof Blob,qi="";if(Hi)try{var Ui=new Blob([Qi],{type:"text/javascript"});qi=URL.createObjectURL(Ui)}catch(e){}var zi=function(){function e(){var e=this;if(!Hi)throw new Error("LZMAWorker cannot work in this broswer.");this.callCounter=0,this.requests={};var t=this.worker=new Worker(qi);t.onmessage=function(t){var i=t.data,r=i.id,n=i.result,o=i.error,s=e.getKey(r);e.requests[s]&&(o?e.requests[s](new Error(o)):e.requests[s](null,n),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=Hi,e}();function ji(e){return Array.prototype.reduce.call(e,(function(e,t,i){return e|t<<8*i}),0)}function _i(e){var t=new Uint8Array(e),i=ji(t.slice(0,4));if(i>10)return Promise.reject(new Error("LZMA got too many sub chunks."));for(var r=[],n=[],o=4+4*i,s=0;s<i;s++)n[s]=ji(t.slice(4+4*s,8+4*s)),r[s]=s===i-1?t.subarray(o,o+n[s]):t.slice(o,o+n[s]),o+=n[s];return zi.support?function(e){for(var t=[],i=e.length,r=function(i){t.push(new Promise((function(t,r){var n=new zi;n.decompress(e[i],(function(e,i){if(n.terminate(),e)return r(e);t(i)}))})))},n=0;n<i;n++)r(n);return Promise.all(t)}(r):Promise.resolve(function(e){for(var t,i=[],r=e.length,n=function(r){var n={data:e[r],offset:0,readByte:function(){return this.data[this.offset++]}},o=n.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++}};Vi.decompressFile(n,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<r;o++)n(o);return i}(r))}function Ki(){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 r=0;r<e.length;r++){var n=0===r,o=r===e.length-1,s=e[r];n||(s=s.replace(/^\/+/,"")),o||(s=s.replace(/\/+$/,"")),i.push(s)}return i.join("/")}var Gi=__webpack_require__(967);const Wi=Gi.Reader,Xi=Gi.util,Yi=Gi.roots["@REALSEE/FIVE:five/loaders/model/proto/pbm.proto"]||(Gi.roots["@REALSEE/FIVE:five/loaders/model/proto/pbm.proto"]={}),Zi=Yi.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=Xi.emptyArray,e.prototype.createAt=Xi.Long?Xi.Long.fromBits(0,0,!0):0,e.prototype.description="",e.decode=function(e,t){e instanceof Wi||(e=Wi.create(e));let i=void 0===t?e.len:e.pos+t,r=new Yi.Model;for(;e.pos<i;){let t=e.uint32();switch(t>>>3){case 1:r.chunks&&r.chunks.length||(r.chunks=[]),r.chunks.push(Yi.Chunk.decode(e,e.uint32()));break;case 2:r.createAt=e.uint64();break;case 3:r.description=e.string();break;default:e.skipType(7&t)}}return r},e})();Yi.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 Wi||(e=Wi.create(e));let i=void 0===t?e.len:e.pos+t,r=new Yi.Chunk;for(;e.pos<i;){let t=e.uint32();switch(t>>>3){case 1:r.vertices=Yi.Vertices.decode(e,e.uint32());break;case 2:r.faces=Yi.Faces.decode(e,e.uint32());break;case 3:r.name=e.string();break;case 4:r.texture=e.string();break;default:e.skipType(7&t)}}if(!r.hasOwnProperty("vertices"))throw Xi.ProtocolError("missing required 'vertices'",{instance:r});if(!r.hasOwnProperty("faces"))throw Xi.ProtocolError("missing required 'faces'",{instance:r});if(!r.hasOwnProperty("name"))throw Xi.ProtocolError("missing required 'name'",{instance:r});return r},e})(),Yi.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=Xi.emptyArray,e.prototype.uvs=Xi.emptyArray,e.decode=function(e,t){e instanceof Wi||(e=Wi.create(e));let i=void 0===t?e.len:e.pos+t,r=new Yi.Vertices;for(;e.pos<i;){let t=e.uint32();switch(t>>>3){case 1:if(r.xyz&&r.xyz.length||(r.xyz=[]),2==(7&t)){let t=e.uint32()+e.pos;for(;e.pos<t;)r.xyz.push(e.float())}else r.xyz.push(e.float());break;case 2:if(r.uvs&&r.uvs.length||(r.uvs=[]),2==(7&t)){let t=e.uint32()+e.pos;for(;e.pos<t;)r.uvs.push(e.float())}else r.uvs.push(e.float());break;default:e.skipType(7&t)}}return r},e})(),Yi.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=Xi.emptyArray,e.prototype.normals=Xi.emptyArray,e.decode=function(e,t){e instanceof Wi||(e=Wi.create(e));let i=void 0===t?e.len:e.pos+t,r=new Yi.Faces;for(;e.pos<i;){let t=e.uint32();switch(t>>>3){case 1:if(r.indices&&r.indices.length||(r.indices=[]),2==(7&t)){let t=e.uint32()+e.pos;for(;e.pos<t;)r.indices.push(e.uint32())}else r.indices.push(e.uint32());break;case 2:if(r.normals&&r.normals.length||(r.normals=[]),2==(7&t)){let t=e.uint32()+e.pos;for(;e.pos<t;)r.normals.push(e.float())}else r.normals.push(e.float());break;default:e.skipType(7&t)}}return r},e})();var Ji=(new e.Matrix4).set(1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1).elements;function $i(e){var t=e.match(/(group|floor)-?(\d+)/);return t?parseInt(t[2],10):0}function er(e){var t=e.match(/(chunk)-?(\d+)/);return t?parseInt(t[2],10):0}function tr(e){var t=$i(e.name),i=er(e.name),r=function(e){var t=e.match(/(sub)-?(\d+)/);return t?parseInt(t[2],10):0}(e.name);return 1e6*t+1e3*i+r}function ir(t,i,r,n,o){var s=Fe({key:"texture.pbm",basisLoaderInitialized:oi.isInitialized()},Dt(i,["format","quality","size","sharpen","mappings"]));return new li({allowHosts:r,requestProxy:n,networkSubscribe:o}).loadTexture(t,{imageURL:{transform:i.transform,options:s},wrapS:e.ClampToEdgeWrapping,wrapT:e.ClampToEdgeWrapping,minFilter:e.LinearFilter,maxSize:"number"==typeof s.size?new e.Vector2(s.size,s.size):void 0,preInit:!0}).then((function(e){var t=e.body;return t.needsUpdate=!0,t}))}function rr(t,i,r,n,o,s,a,l){void 0===o&&(o={});for(var u=function(e){for(var t,i,r,n="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 tr(e)-tr(t)})),h=[],d=0,p=c;d<p.length;d++){var f=$i((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,k=ie.faces.indices,L=ie.faces.normals,O=k.length;for(v=0;v<O;v++){var F=k[v],N=R[3*F],V=R[3*F+1],Q=R[3*F+2],H=1/(Ji[3]*N+Ji[7]*V+Ji[11]*Q+Ji[15]),q=(Ji[0]*N+Ji[4]*V+Ji[8]*Q+Ji[12])*H,U=(Ji[1]*N+Ji[5]*V+Ji[9]*Q+Ji[13])*H,z=(Ji[2]*N+Ji[6]*V+Ji[10]*Q+Ji[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),_=L[j],K=L[j+1],G=L[j+2],W=1/(Ji[3]*_+Ji[7]*K+Ji[11]*G+Ji[15]),X=(Ji[0]*_+Ji[4]*K+Ji[8]*G+Ji[12])*W,Y=(Ji[1]*_+Ji[5]*K+Ji[9]*G+Ji[13])*W,Z=(Ji[2]*_+Ji[6]*K+Ji[10]*G+Ji[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:er(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:n,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,k=ie.faces.indices;var ie,re=R.length/3;for(O=k.length,v=0;v<re;v++)N=R[3*v],V=R[3*v+1],Q=R[3*v+2],H=1/(Ji[3]*N+Ji[7]*V+Ji[11]*Q+Ji[15]),q=(Ji[0]*N+Ji[4]*V+Ji[8]*Q+Ji[12])*H,U=(Ji[1]*N+Ji[5]*V+Ji[9]*Q+Ji[13])*H,z=(Ji[2]*N+Ji[6]*V+Ji[10]*Q+Ji[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+k[v];C.push({materialIndex:T,name:ie.name,chunkName:er(ie.name),start:te,count:ie.faces.indices.length,texture:null!==(r=ie.texture)&&void 0!==r?r:void 0}),B+=re,te+=O}for(v=0;v<m;v+=3){var ne,oe,se,ae,le,ue,ce,he,de,pe,fe,Ae,ge,me,ve,ye;_=void 0,K=void 0,G=void 0,ne=3*ee[v],oe=3*ee[v+1],se=3*ee[v+2],ae=M[ne],le=M[ne+1],ue=M[ne+2],ce=M[oe],he=M[oe+1],de=M[oe+2],pe=M[se],_=(Ae=M[se+1]-he)*(ye=ue-de)-(ge=M[se+2]-de)*(ve=le-he),K=ge*(me=ae-ce)-(fe=pe-ce)*ye,G=fe*ve-Ae*me,S[ne]+=_,S[ne+1]+=K,S[ne+2]+=G,S[oe]+=_,S[oe+1]+=K,S[oe+2]+=G,S[se]+=_,S[se+1]+=K,S[se+2]+=G}s.push({createAt:n,description:o,floorIndex:A,vertices:M,uvs:E,indices:ee,normals:S,groups:C,extents:I})}}return s}(t),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 e.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 e.BufferGeometry;C.setAttribute("position",new e.BufferAttribute(y,3)),C.setAttribute("uv",new e.BufferAttribute(b,2)),C.setAttribute("normal",new e.BufferAttribute(w,3)),x&&C.setIndex(new e.BufferAttribute(x,1)),C.boundingBox=S,C.boundingSphere=S.getBoundingSphere(new e.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(t){var u=r[t.chunkName]||(t.texture?Ki(i,t.texture):void 0),c=new pi;if(P.push(c),u){var h=void 0;u in o?h=o[u]:(h=ir(u,n,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 e.Color(16777215)}))}else c.defines.USE_MAP=!1,c.uniforms.diffuse.value=new e.Color(16777215);c.uniforms.floorIndex.value=v},D=0,k=M;D<k.length;D++)R(T=k[D]);var L=new Et(C,P);L.name="model_floor_"+v,L.floorIndex=v,L.userData.createAt=g,L.userData.description=m,c=g,h=m,d.push(L)}return{createAt:c,description:h,objects:d,texturePromise:Promise.all(Object.keys(o).map((function(e){return o[e].catch(Ue)}))).then(Ue)}}function nr(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 or(e){return 0===e.indexOf("//")||/^[0-9a-z]+\:/i.test(e)}const sr=Gi.Reader,ar=Gi.util,lr=Gi.roots["@REALSEE/FIVE:five/loaders/model/proto/dome.proto"]||(Gi.roots["@REALSEE/FIVE:five/loaders/model/proto/dome.proto"]={}),ur=lr.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=ar.emptyArray,e.decode=function(e,t){e instanceof sr||(e=sr.create(e));let i=void 0===t?e.len:e.pos+t,r=new lr.Model;for(;e.pos<i;){let t=e.uint32();t>>>3==1?(r.meshes&&r.meshes.length||(r.meshes=[]),r.meshes.push(lr.Mesh.decode(e,e.uint32()))):e.skipType(7&t)}return r},e})();function cr(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 hr(t){var i=t.position,r=t.normal,n=t.uv,o=t.uv2,s=t.groups,a=new e.BufferGeometry;a.setAttribute("position",new e.BufferAttribute(new Float32Array(i.array),3)),r&&a.setAttribute("normal",new e.BufferAttribute(new Float32Array(r.array),3)),n&&a.setAttribute("uv",new e.BufferAttribute(new Float32Array(n.array),2)),o&&a.setAttribute("uv2",new e.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 dr(t,i,r,n,o,s){if(s.hasOwnProperty(t))return s[t];or(t=t.split("?")[0])||(t=Ki(i,t)),0===(t=t.replace(/\/\/vrlab-image\d*.ljcdn.com\//,"//vrlab-public.ljcdn.com/")).indexOf("//")&&(t="https:"+t);var a=Fe({key:"texture.dome",size:64,basisLoaderInitialized:oi.isInitialized()},Dt(r,["quality","format","sharpen","mappings"]));return s[t]=o.loadTexture(t,{imageURL:{transform:r.transform,options:a},wrapS:e.RepeatWrapping,wrapT:e.RepeatWrapping}).then((function(e){var t=e.body;return n&&t.repeat.copy(n),t.needsUpdate=!0,t.updateMatrix(),t}))}function pr(t,i,r,n,o){var s=[],a=new pi,l=a.uniforms;l.exposure.value=4.3;var u=a.defines;if(u.USE_MAP=!1,u.USE_UV=!1,t.kd&&(l.diffuse.value=(new e.Color).fromArray(t.kd.rgb)),t.mapkd){var c=null;if(t.mapkdrepeat){var h=t.mapkdrepeat.split(/\s+/).map((function(e){return Number(e)})),d=h[0],p=h[1];c=new e.Vector2(d,p)}s.push(dr(t.mapkd,i,r,c,n,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(Ue))}if(t.ks&&(l.specular.value=(new e.Color).fromArray(t.ks.rgb)),t.mapks&&s.push(dr(t.mapks,i,r,null,n,o).then((function(e){l.specularMap.value=e})).catch(Ue)),t.ke&&(l.emissive.value=(new e.Color).fromArray(t.ke.rgb)),t.mapke&&s.push(dr(t.mapke,i,r,null,n,o).then((function(e){l.emissiveMap.value=e})).catch(Ue)),t.norm&&s.push(dr(t.norm,i,r,null,n,o).then((function(e){l.normalMap.value=e})).catch(Ue)),t.mapbump&&s.push(dr(t.mapbump,i,r,null,n,o).then((function(e){l.bumpMap.value=e})).catch(Ue)),t.bump&&s.push(dr(t.bump,i,r,null,n,o).then((function(e){l.bumpMap.value=e})).catch(Ue)),"number"==typeof t.ns&&(l.shininess.value=t.ns),"number"==typeof t.d){var f=t.d;f>0&&f<1&&(a.originOpacity=f,a.opacity=f)}return{material:a,textureReady:Promise.all(s).then(Ue)}}function fr(t,i,r,n,o,s){for(var a,l=[],u=[],c=(a=t,ur.decode(a).meshes),h=new li({allowHosts:n,requestProxy:o,networkSubscribe:s}),d=new e.Matrix4,p=new e.Vector3,f=new e.Quaternion,A=new e.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 Ct;C.renderOrder=-3;for(var I=0;I<x.length;I++){var B=hr(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&&cr(B);for(var T=[],P=0,R=x[I].material;P<R.length;P++){var D=pr(R[P],i,r,h,g),k=D.material,L=D.textureReady;u.push(L),T.push(k)}var O=new Et(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(Ue)}}lr.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=ar.emptyArray,e.prototype.matrix=ar.emptyArray,e.decode=function(e,t){e instanceof sr||(e=sr.create(e));let i=void 0===t?e.len:e.pos+t,r=new lr.Mesh;for(;e.pos<i;){let t=e.uint32();switch(t>>>3){case 1:r.name=e.string();break;case 2:r.chunks&&r.chunks.length||(r.chunks=[]),r.chunks.push(lr.Chunk.decode(e,e.uint32()));break;case 3:r.matrix&&r.matrix.length||(r.matrix=[]),r.matrix.push(lr.Matrix.decode(e,e.uint32()));break;default:e.skipType(7&t)}}if(!r.hasOwnProperty("name"))throw ar.ProtocolError("missing required 'name'",{instance:r});return r},e})(),lr.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=ar.emptyArray,e.decode=function(e,t){e instanceof sr||(e=sr.create(e));let i=void 0===t?e.len:e.pos+t,r=new lr.Matrix;for(;e.pos<i;){let t=e.uint32();if(t>>>3==1)if(r.elements&&r.elements.length||(r.elements=[]),2==(7&t)){let t=e.uint32()+e.pos;for(;e.pos<t;)r.elements.push(e.float())}else r.elements.push(e.float());else e.skipType(7&t)}return r},e})(),lr.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=ar.emptyArray,e.decode=function(e,t){e instanceof sr||(e=sr.create(e));let i=void 0===t?e.len:e.pos+t,r=new lr.Chunk;for(;e.pos<i;){let t=e.uint32();switch(t>>>3){case 2:r.geometry=lr.Geometry.decode(e,e.uint32());break;case 3:r.material&&r.material.length||(r.material=[]),r.material.push(lr.Material.decode(e,e.uint32()));break;default:e.skipType(7&t)}}if(!r.hasOwnProperty("geometry"))throw ar.ProtocolError("missing required 'geometry'",{instance:r});return r},e})(),lr.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=ar.emptyArray,e.decode=function(e,t){e instanceof sr||(e=sr.create(e));let i=void 0===t?e.len:e.pos+t,r=new lr.Geometry;for(;e.pos<i;){let t=e.uint32();switch(t>>>3){case 1:r.position=lr.Position.decode(e,e.uint32());break;case 2:r.uv=lr.UV.decode(e,e.uint32());break;case 3:r.uv2=lr.UV.decode(e,e.uint32());break;case 4:r.normal=lr.Normal.decode(e,e.uint32());break;case 5:r.groups&&r.groups.length||(r.groups=[]),r.groups.push(lr.Group.decode(e,e.uint32()));break;default:e.skipType(7&t)}}if(!r.hasOwnProperty("position"))throw ar.ProtocolError("missing required 'position'",{instance:r});if(!r.hasOwnProperty("normal"))throw ar.ProtocolError("missing required 'normal'",{instance:r});return r},e})(),lr.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=ar.emptyArray,e.decode=function(e,t){e instanceof sr||(e=sr.create(e));let i=void 0===t?e.len:e.pos+t,r=new lr.Position;for(;e.pos<i;){let t=e.uint32();if(t>>>3==1)if(r.array&&r.array.length||(r.array=[]),2==(7&t)){let t=e.uint32()+e.pos;for(;e.pos<t;)r.array.push(e.float())}else r.array.push(e.float());else e.skipType(7&t)}return r},e})(),lr.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=ar.emptyArray,e.decode=function(e,t){e instanceof sr||(e=sr.create(e));let i=void 0===t?e.len:e.pos+t,r=new lr.UV;for(;e.pos<i;){let t=e.uint32();if(t>>>3==1)if(r.array&&r.array.length||(r.array=[]),2==(7&t)){let t=e.uint32()+e.pos;for(;e.pos<t;)r.array.push(e.float())}else r.array.push(e.float());else e.skipType(7&t)}return r},e})(),lr.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=ar.emptyArray,e.decode=function(e,t){e instanceof sr||(e=sr.create(e));let i=void 0===t?e.len:e.pos+t,r=new lr.Normal;for(;e.pos<i;){let t=e.uint32();if(t>>>3==1)if(r.array&&r.array.length||(r.array=[]),2==(7&t)){let t=e.uint32()+e.pos;for(;e.pos<t;)r.array.push(e.float())}else r.array.push(e.float());else e.skipType(7&t)}return r},e})(),lr.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 sr||(e=sr.create(e));let i=void 0===t?e.len:e.pos+t,r=new lr.Group;for(;e.pos<i;){let t=e.uint32();switch(t>>>3){case 1:r.start=e.uint32();break;case 2:r.count=e.uint32();break;case 3:r.materialIndex=e.uint32();break;default:e.skipType(7&t)}}if(!r.hasOwnProperty("start"))throw ar.ProtocolError("missing required 'start'",{instance:r});if(!r.hasOwnProperty("count"))throw ar.ProtocolError("missing required 'count'",{instance:r});if(!r.hasOwnProperty("materialIndex"))throw ar.ProtocolError("missing required 'materialIndex'",{instance:r});return r},e})(),lr.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 sr||(e=sr.create(e));let i=void 0===t?e.len:e.pos+t,r=new lr.Material;for(;e.pos<i;){let t=e.uint32();switch(t>>>3){case 1:r.kd=lr.Color.decode(e,e.uint32());break;case 2:r.ks=lr.Color.decode(e,e.uint32());break;case 3:r.ke=lr.Color.decode(e,e.uint32());break;case 4:r.mapkd=e.string();break;case 5:r.mapks=e.string();break;case 6:r.mapke=e.string();break;case 7:r.norm=e.string();break;case 8:r.mapbump=e.string();break;case 9:r.bump=e.string();break;case 10:r.mapd=e.string();break;case 11:r.ns=e.float();break;case 12:r.d=e.float();break;case 13:r.tr=e.float();break;case 14:r.mapkdrepeat=e.string();break;default:e.skipType(7&t)}}return r},e})(),lr.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=ar.emptyArray,e.decode=function(e,t){e instanceof sr||(e=sr.create(e));let i=void 0===t?e.len:e.pos+t,r=new lr.Color;for(;e.pos<i;){let t=e.uint32();if(t>>>3==1)if(r.rgb&&r.rgb.length||(r.rgb=[]),2==(7&t)){let t=e.uint32()+e.pos;for(;e.pos<t;)r.rgb.push(e.float())}else r.rgb.push(e.float());else e.skipType(7&t)}return r},e})();var Ar={throttleRequests:!0,maxRequests:5},gr=function(){function e(e){void 0===e&&(e={}),this.props=Fe(Fe({},Ar),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(){}},r=new Promise((function(e){return i.resolve=e}));return this.requestQueue.push(i),this.requestMap.set(e,r),this.issueNewRequests(),r},e.prototype.issueRequest=function(e){var t=this,i=e.identiy,r=e.resolve,n=!1;this.activeRequestCount++,r({done:function(){n||(n=!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}(),mr=function(e,t,i){this.item=e,this.previous=t,this.next=i},vr=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 mr(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}(),yr=function(){function e(){this.list=new vr,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 r=i.item;i=i.next,this.unloadTile(r,t)}},e}(),br=Object.freeze({OUTSIDE:-1,INTERSECTING:0,INSIDE:1}),xr=[new e.Vector3(1,0,0),new e.Vector3(0,1,0),new e.Vector3(0,0,1)],wr=new e.Vector3,Mr=new e.Vector3,Er=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*xr.length;for(var i=t.center,r=t.radius,n=0,o=0,s=xr;o<s.length;o++){var a=s[o],l=this.planes[n],u=this.planes[n+1];l||(l=this.planes[n]=new e.Plane),u||(u=this.planes[n+1]=new e.Plane);var c=wr.copy(a).multiplyScalar(-r).add(i);l.setFromNormalAndCoplanarPoint(a,c);var h=wr.copy(a).multiplyScalar(r).add(i),d=Mr.copy(a).negate();u.setFromNormalAndCoplanarPoint(d,h),n+=2}return this},t.prototype.computeVisibilityWithPlaneMask=function(e,i){if(i===t.MASK_OUTSIDE||i===t.MASK_INSIDE)return i;for(var r=t.MASK_INSIDE,n=this.planes,o=0;o<this.planes.length;++o){var s=o<31?1<<o:0;if(!(o<31&&0==(i&s))){var a=n[o],l=e.intersectPlane(a);if(l===br.OUTSIDE)return t.MASK_OUTSIDE;l===br.INTERSECTING&&(r|=s)}}return r},t}(),Sr=Object.freeze({OUTSIDE:-1,INTERSECTING:0,INSIDE:1}),Cr=new e.Vector3,Ir=new e.Vector3,Br=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 r=Cr.fromArray(i);return this.center=(new e.Vector3).fromArray(t).add((new e.Vector3).fromArray(i)).multiplyScalar(.5),this.radius=this.center.distanceTo(r),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,r=e.center,n=e.radius,o=Cr.copy(r).sub(t),s=o.length();if(i>=s+n)return this.clone();if(n>=s+i)return e.clone();var a=.5*(i+s+n);return Ir.copy(o).multiplyScalar((-i+a)/s).add(t),this.center.copy(Ir),this.radius=a,this},t.prototype.expand=function(e){var t=Cr.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,r,n,o,s,a,l,u,c,h,d=(t=Cr.toArray(),r=(i=e.toArray())[0],n=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(r,n,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=Cr.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,r=e.normal.dot(t)+e.constant;return r<-i?Sr.OUTSIDE:r<i?Sr.INTERSECTING:Sr.INSIDE},t}(),Tr=Object.freeze({OUTSIDE:-1,INTERSECTING:0,INSIDE:1}),Pr=new e.Vector3,Rr=new e.Vector3,Dr=new e.Vector3,kr=new e.Vector3,Lr=new e.Vector3,Or=new e.Vector3,Fr=new e.Vector3;function Nr(t,i,r){void 0===r&&(r=new e.Vector3);for(var n=3*i,o=new Array(3),s=0;s<3;++s)o[s]=t.toArray()[n+s];return r.fromArray(o)}var Vr=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 Br);var t=this.halfAxes,i=Nr(t,0,Dr),r=Nr(t,1,kr),n=Nr(t,2,Lr),o=Pr.copy(i).add(r).add(n);return e.center.copy(this.center),e.radius=o.length(),e},t.prototype.intersectPlane=function(e){var t=this.center,i=e.normal,r=this.halfAxes.toArray(),n=i.x,o=i.y,s=i.z,a=Math.abs(n*r[0]+o*r[1]+s*r[2])+Math.abs(n*r[3]+o*r[4]+s*r[5])+Math.abs(n*r[6]+o*r[7]+s*r[8]),l=i.dot(t)+e.constant;return l<=-a?Tr.OUTSIDE:l>=a?Tr.INSIDE:Tr.INTERSECTING},t.prototype.distanceTo=function(e){return Math.sqrt(this.distanceSquaredTo(e))},t.prototype.distanceSquaredTo=function(e){var t=Rr.fromArray(e).sub(this.center),i=this.halfAxes,r=Nr(i,0,Dr),n=Nr(i,1,kr),o=Nr(i,2,Lr),s=r.length(),a=n.length(),l=o.length();r.normalize(),n.normalize(),o.normalize();var u,c=0;return(u=Math.abs(t.dot(r))-s)>0&&(c+=u*u),(u=Math.abs(t.dot(n))-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 r=Number.POSITIVE_INFINITY,n=Number.NEGATIVE_INFINITY,o=this.center,s=this.halfAxes,a=Nr(s,0,Dr),l=Nr(s,1,kr),u=Nr(s,2,Lr),c=Or.copy(a).add(l).add(u).add(o),h=Fr.copy(c).sub(e),d=t.dot(h);return r=Math.min(d,r),n=Math.max(d,n),c.copy(o).add(a).add(l).sub(u),h.copy(c).sub(e),d=t.dot(h),r=Math.min(d,r),n=Math.max(d,n),c.copy(o).add(a).sub(l).add(u),h.copy(c).sub(e),d=t.dot(h),r=Math.min(d,r),n=Math.max(d,n),c.copy(o).add(a).sub(l).sub(u),h.copy(c).sub(e),d=t.dot(h),r=Math.min(d,r),n=Math.max(d,n),o.copy(c).sub(a).add(l).add(u),h.copy(c).sub(e),d=t.dot(h),r=Math.min(d,r),n=Math.max(d,n),o.copy(c).sub(a).add(l).sub(u),h.copy(c).sub(e),d=t.dot(h),r=Math.min(d,r),n=Math.max(d,n),o.copy(c).sub(a).sub(l).add(u),h.copy(c).sub(e),d=t.dot(h),r=Math.min(d,r),n=Math.max(d,n),o.copy(c).sub(a).sub(l).sub(u),h.copy(c).sub(e),d=t.dot(h),r=Math.min(d,r),n=Math.max(d,n),i[0]=r,i[1]=n,i},t.prototype.transform=function(t){var i=(new e.Matrix4).fromArray(t);this.center.applyMatrix4(i);var r=Nr(this.halfAxes,0,Dr);r.applyMatrix4(i);var n=Nr(this.halfAxes,1,kr);n.applyMatrix4(i);var o=Nr(this.halfAxes,2,Lr);return o.applyMatrix4(i),this.halfAxes=(new e.Matrix3).fromArray(Ne(Ne(Ne([],r.toArray(),!0),n.toArray(),!0),o.toArray(),!0)),this},t}();function Qr(t,i){var r=i.toArray(),n=t.toArray(),o=[0,0,0],s=n[0],a=n[1],l=n[2],u=r[3]*s+r[7]*a+r[11]*l||1;return o[0]=(r[0]*s+r[4]*a+r[8]*l)/u,o[1]=(r[1]*s+r[5]*a+r[9]*l)/u,o[2]=(r[2]*s+r[6]*a+r[10]*l)/u,(new e.Vector3).fromArray(o)}function Hr(e,t){var i=function(e,t,i){var r=i[0],n=i[1],o=i[2],s=i[3],a=t[0],l=t[1],u=t[2],c=n*u-o*l,h=o*a-r*u,d=r*l-n*a,p=n*d-o*h,f=o*c-r*d,A=r*h-n*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 qr(t,i){if(t.box)return function(t,i){var r=new e.Vector3(t[0],t[1],t[2]);r.applyMatrix4(i);var n=[];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);Hr(a,s),a.multiplyScalar(o[0]),Hr(l,s),l.multiplyScalar(o[1]),Hr(u,s),u.multiplyScalar(o[2]),n=Ne(Ne(Ne([],a.toArray(),!0),l.toArray(),!0),u.toArray(),!0)}else n=Ne(Ne(Ne([],t.slice(3,6),!0),t.slice(6,9),!0),t.slice(9,12),!0);var c=Qr((new e.Vector3).fromArray(n.slice(0,3)),i).toArray(),h=Qr((new e.Vector3).fromArray(n.slice(3,6)),i).toArray(),d=Qr((new e.Vector3).fromArray(n.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 Vr(r.toArray(),p.toArray())}(t.box,i);throw new Error("3D Tile: boundingVolume must only can be box")}function Ur(e,t,i){var r=new TextDecoder("utf8"),n=new Uint8Array(e,t,i);return r.decode(n)}function zr(e,t,i){i=function(e,t,i){void 0===i&&(i=0);var r=new DataView(t);if(e.magic=r.getUint32(i,!0),i+=4,e.version=r.getUint32(i,!0),i+=4,e.byteLength=r.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 r,n=new DataView(t);e.header=e.header||{};var o=n.getUint32(i,!0);i+=4;var s=n.getUint32(i,!0);i+=4;var a=n.getUint32(i,!0);i+=4;var l=n.getUint32(i,!0);return i+=4,a>=570425344?(i-=8,r=o,a=s,l=0,o=0,s=0,console.warn("b3dm tile in legacy format.")):l>=570425344&&(i-=4,r=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=r,i}(e,t,i),i=function(e,t,i){void 0===i&&(i=0);var r=e.byteOffset+e.byteLength-i;if(0===r)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 r=void 0!==i?new Uint8Array(e).subarray(t,t+i):new Uint8Array(e).subarray(t);return new Uint8Array(r).buffer}(t,i,r),e.gltfByteOffset=0,e.gltfByteLength=r,i%4==0||console.warn("".concat(e.type,": embedded glb is not aligned to a 4-byte boundary.")),e.byteOffset+e.byteLength}(e,t,i=function(e,t,i){return void 0===i&&(i=0),i=function(e,t,i){void 0===i&&(i=0);var r=e.header,n=r.featureTableJsonByteLength,o=r.featureTableBinaryByteLength,s=r.batchLength;if(e.featureTableJson={BATCH_LENGTH:s||0},n>0){var a=Ur(t,i,n);e.featureTableJson=JSON.parse(a)}return i+=n,e.featureTableBinary=new Uint8Array(t,i,o),i+o}(e,t,i),i=function(e,t,i){void 0===i&&(i=0);var r=e.header,n=r.batchTableJsonByteLength,o=r.batchTableBinaryByteLength;if(n>0){var s=Ur(t,i,n);e.batchTableJson=JSON.parse(s),i+=n,o>0&&(e.batchTableBinary=new Uint8Array(t,i,o),e.batchTableBinary=new Uint8Array(e.batchTableBinary),i+=o)}return i}(e,t,i),i}(e,t,i));var r=e.featureTableJson.RTC_CENTER;return r&&Number.isFinite(r.byteOffset)&&(e.rtcCenter=new Float32Array(e.featureTableBinary.buffer,e.featureTableBinary.buffer.byteOffset+r.byteOffset,3)),i}var jr=function(){function t(t,i,r){this.header=i,this.tileset=t,this.parent=r,this.children=[],this.contentState="UNLOADED",this.transform=this.header.transform?(new e.Matrix4).fromArray(this.header.transform.slice()):new e.Matrix4;var n=this.parent&&this.parent.computedTransform?this.parent.computedTransform.clone():t.modelMatrix.clone();this.computedTransform=n.clone().multiply(this.transform),this.boundingVolume=qr(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=Er.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 r=i.slice(4);i="https"+r}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 r=e.tileset,n=e.parent&&e.parent.lodMetricValue||e.lodMetricValue,o=i?n:e.lodMetricValue;if(0===o)return 0;var s=Math.max(e.distanceToCamera,1e-7),a=r.options.viewDistanceScale;return o*t.height*a/(s*t.sseDenominator)-function(e,t){if(e.dynamicScreenSpaceError&&e.dynamicScreenSpaceErrorComputedDensity){var i=e.dynamicScreenSpaceErrorComputedDensity,r=e.dynamicScreenSpaceErrorFactor,n=function(e,t){var i=e*t;return 1-Math.exp(-i*i)}(t,i)*r;return n}return 0}(r,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 r=this.parent,n=!r||i&&0!==this.screenSpaceError?this.screenSpaceError:r.screenSpaceError,o=e.root?e.root.screenSpaceError:0;return Math.max(o-n,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?lt(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 zr(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:Er.MASK_INDETERMINATE,r=t?t.computedTransform:this.tileset.modelMatrix;this.updateTransform(r),this.distanceToCamera=this.distanceToTile(e),this.screenSpaceError=this.getScreenSpaceError(e,!1),this.visibilityPlaneMask=this.visibility(e,i),this.visible=this.visibilityPlaneMask!==Er.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=qr(this.header.boundingVolume,this.computedTransform))},t}(),_r=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}(),Kr=function(){function e(e){this.options=e,this._traversalStack=new _r,this._emptyTraversalStack=new _r,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 r=i.pop(),n=!1;if(this.canTraverse(r,t)){this.updateChildTiles(r,t);var o=r.hasRenderContent?r.selectionDepth+1:r.selectionDepth;n=this.updateAndPushChildren(r,t,i,o)}var s=r.parent,a=Boolean(!s||s.shouldRefine),l=!n;r.hasRenderContent?"ADD"===r.refine?(this.loadTile(r,t),this.selectTile(r,t)):"REPLACE"===r.refine&&(this.loadTile(r,t),l&&this.selectTile(r,t)):(this.emptyTiles[r.id]=r,this.loadTile(r,t),l&&this.selectTile(r,t)),this.touchTile(r,t),r.shouldRefine=n&&a}this.options.onTraversalEnd(t)},e.prototype.updateChildTiles=function(e,t){for(var i=0,r=e.children;i<r.length;i++){var n=r[i];this.updateTile(n,t)}return!0},e.prototype.updateAndPushChildren=function(e,t,i,r){var n=this.options,o=n.loadSiblings,s=n.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=r,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;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,r){return void 0===i&&(i=!1),void 0===r&&(r=!1),!!e.hasChildren&&!(!r&&!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 r=e.screenSpaceError;return i&&(r=e.getScreenSpaceError(t,!0)),r>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,r=0,n=e.children;r<n.length;r++){var o=n[r];o.updateVisibility(t),i=i||o.visible}return i},e.prototype.everyChildrenVisibleIsLoaded=function(e){for(var t=!0,i=0,r=e.children;i<r.length;i++){var n=r[i];n.visible&&"READY"!==n.contentState&&(t=!1)}return t},e.prototype.executeEmptyTraversal=function(e,t){var i=!0,r=this._emptyTraversalStack;for(r.push(e);r.length>0&&i;){var n=r.pop();if(this.updateTile(n,t),n.visible||this.loadTile(n,t),this.touchTile(n,t),!n.hasRenderContent&&this.canTraverse(n,t,!1,!0))for(var o=0,s=n.children;o<s.length;o++){var a=s[o];r.find(a)&&r.delete(a),r.push(a)}else n.contentAvailable||(i=!1)}return i},e}();function Gr(e){for(var t=[],i=0,r=Object.keys(e);i<r.length;i++){var n=r[i];t.push(e[n])}return t}var Wr=function(){function t(e,t){var i=this;this.rawJson=e,this.b3dmMapping=e.b3dmMapping,this.options=t,this.traverser=new Kr({loadSiblings:!1,maxScreenSpaceError:this.options.maxScreenSpaceError,skipLevelOfDetail:!1,maxDepth:this.options.maxDepth,onTraversalEnd:function(e){return i.onTraversalEnd(e)}}),this.cache=new yr,this.requestScheduler=new gr({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 jr(this,e.root);for(var r=[this.root];r.length>0;)for(var n=r.pop(),o=0,s=n.header.children||[];o<s.length;o++){var a=s[o],l=new jr(this,a,n);l.depth=n.depth+1,n.children.push(l),r.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 Gr(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,r=t.children;i<r.length;i++){var n=r[i];e.push(n)}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,r=(new e.Vector3).fromArray(t.camera.position);this.selectedTiles=this.options.onTraversalComplete(Gr(this.traverser.selectedTiles)),this.requestedTiles=Gr(this.traverser.requestedTiles).slice().sort((function(e,t){return e.boundingVolume.center.distanceTo(r)-t.boundingVolume.center.distanceTo(r)}));for(var n=0,o=this.selectedTiles;n<o.length;n++){var s=o[n];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 r=i.message||i.toString();return console.error("A 3D tile failed to load: ".concat(e.id," ").concat(r)),t.options.onTileError(e,r),!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 Xr(){return(65536*(1+Math.random())|0).toString(16).substring(1)}function Yr(){return(Xr()+Xr()+"-"+Xr()+"-4"+Xr().substr(0,3)+"-"+Xr()+"-"+Xr()+Xr()+Xr()).toLowerCase()}function Zr(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:"+Yr(),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}var Jr=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,r,n){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){n?n(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)}}),r,a)},setDRACOLoader:function(e){return this.dracoLoader=e,this},setDDSLoader:function(e){return this.ddsLoader=e,this},parse:function(t,i,d,A){var g,m={};if("string"==typeof t)g=t;else if(e.LoaderUtils.decodeText(new Uint8Array(t,0,4))===l){try{m[r.KHR_BINARY_GLTF]=new u(t)}catch(e){return void(A&&A(e))}g=m[r.KHR_BINARY_GLTF].content}else g=e.LoaderUtils.decodeText(new Uint8Array(t));var v=JSON.parse(g);if(void 0===v.asset||v.asset.version[0]<2)A&&A(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 r.KHR_LIGHTS_PUNCTUAL:m[b]=new o(v);break;case r.KHR_MATERIALS_CLEARCOAT:m[b]=new a;break;case r.KHR_MATERIALS_UNLIT:m[b]=new s;break;case r.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:m[b]=new p;break;case r.KHR_DRACO_MESH_COMPRESSION:m[b]=new c(v,this.dracoLoader);break;case r.MSFT_TEXTURE_DDS:m[b]=new n(this.ddsLoader);break;case r.KHR_TEXTURE_TRANSFORM:m[b]=new h;break;case r.KHR_MESH_QUANTIZATION:m[b]=new f;break;default:x.indexOf(b)>=0&&console.warn('THREE.GLTFLoader: Unknown extension "'+b+'".')}}var w=new T(v,m,{path:i||this.resourcePath||"",crossOrigin:this.crossOrigin,manager:this.manager});w.fileLoader.setRequestHeader(this.requestHeader),w.parse(d,A)}}});var r={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 n(e){if(!e)throw new Error("THREE.GLTFLoader: Attempting to load .dds texture without importing DDSLoader");this.name=r.MSFT_TEXTURE_DDS,this.ddsLoader=e}function o(e){this.name=r.KHR_LIGHTS_PUNCTUAL;var t=e.extensions&&e.extensions[r.KHR_LIGHTS_PUNCTUAL]||{};this.lightDefs=t.lights||[]}function s(){this.name=r.KHR_MATERIALS_UNLIT}function a(){this.name=r.KHR_MATERIALS_CLEARCOAT}o.prototype.loadLight=function(t){var i,r=this.lightDefs[t],n=new e.Color(16777215);void 0!==r.color&&n.fromArray(r.color);var o=void 0!==r.range?r.range:0;switch(r.type){case"directional":(i=new e.DirectionalLight(n)).target.position.set(0,0,-1),i.add(i.target);break;case"point":(i=new e.PointLight(n)).distance=o;break;case"spot":(i=new e.SpotLight(n)).distance=o,r.spot=r.spot||{},r.spot.innerConeAngle=void 0!==r.spot.innerConeAngle?r.spot.innerConeAngle:0,r.spot.outerConeAngle=void 0!==r.spot.outerConeAngle?r.spot.outerConeAngle:Math.PI/4,i.angle=r.spot.outerConeAngle,i.penumbra=1-r.spot.innerConeAngle/r.spot.outerConeAngle,i.target.position.set(0,0,-1),i.add(i.target);break;default:throw new Error('THREE.GLTFLoader: Unexpected light type, "'+r.type+'".')}return i.position.set(0,0,0),i.decay=2,void 0!==r.intensity&&(i.intensity=r.intensity),i.name=r.name||"light_"+t,Promise.resolve(i)},s.prototype.getMaterialType=function(){return e.MeshBasicMaterial},s.prototype.extendParams=function(t,i,r){var n=[];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&&n.push(r.assignTexture(t,"map",o.baseColorTexture))}return Promise.all(n)},a.prototype.getMaterialType=function(){return e.MeshPhysicalMaterial},a.prototype.extendParams=function(t,i,r){var n=[],o=i.extensions[this.name];if(void 0!==o.clearcoatFactor&&(t.clearcoat=o.clearcoatFactor),void 0!==o.clearcoatTexture&&n.push(r.assignTexture(t,"clearcoatMap",o.clearcoatTexture)),void 0!==o.clearcoatRoughnessFactor&&(t.clearcoatRoughness=o.clearcoatRoughnessFactor),void 0!==o.clearcoatRoughnessTexture&&n.push(r.assignTexture(t,"clearcoatRoughnessMap",o.clearcoatRoughnessTexture)),void 0!==o.clearcoatNormalTexture&&(n.push(r.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(n)};var l="glTF";function u(t){this.name=r.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 n=new DataView(t,12),o=0;o<n.byteLength;){var s=n.getUint32(o,!0);o+=4;var a=n.getUint32(o,!0);if(o+=4,1313821514===a){var u=new Uint8Array(t,12+o,s);this.content=e.LoaderUtils.decodeText(u)}else if(5130562===a){var c=12+o;this.body=t.slice(c,c+s)}o+=s}if(null===this.content)throw new Error("THREE.GLTFLoader: JSON content not found.")}function c(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=r.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}function h(){this.name=r.KHR_TEXTURE_TRANSFORM}function d(t){e.MeshStandardMaterial.call(this),this.isGLTFSpecularGlossinessMaterial=!0;var i=["#ifdef USE_SPECULARMAP","\tuniform sampler2D specularMap;","#endif"].join("\n"),r=["#ifdef USE_GLOSSINESSMAP","\tuniform sampler2D glossinessMap;","#endif"].join("\n"),n=["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>",r),e.fragmentShader=e.fragmentShader.replace("#include <roughnessmap_fragment>",n),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 p(){return{name:r.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 d},extendParams:function(t,i,r){var n=i.extensions[this.name];t.color=new e.Color(1,1,1),t.opacity=1;var o=[];if(Array.isArray(n.diffuseFactor)){var s=n.diffuseFactor;t.color.fromArray(s),t.opacity=s[3]}if(void 0!==n.diffuseTexture&&o.push(r.assignTexture(t,"map",n.diffuseTexture)),t.emissive=new e.Color(0,0,0),t.glossiness=void 0!==n.glossinessFactor?n.glossinessFactor:1,t.specular=new e.Color(1,1,1),Array.isArray(n.specularFactor)&&t.specular.fromArray(n.specularFactor),void 0!==n.specularGlossinessTexture){var a=n.specularGlossinessTexture;o.push(r.assignTexture(t,"glossinessMap",a)),o.push(r.assignTexture(t,"specularMap",a))}return Promise.all(o)},createMaterial:function(t){var i=new d(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 f(){this.name=r.KHR_MESH_QUANTIZATION}function A(t,i,r,n){e.Interpolant.call(this,t,i,r,n)}c.prototype.decodePrimitive=function(e,t){var i=this.json,r=this.dracoLoader,n=e.extensions[this.name].bufferView,o=e.extensions[this.name].attributes,s={},a={},l={};for(var u in o){var c=b[u]||u.toLowerCase();s[c]=o[u]}for(u in e.attributes)if(c=b[u]||u.toLowerCase(),void 0!==o[u]){var h=i.accessors[e.attributes[u]],d=g[h.componentType];l[c]=d,a[c]=!0===h.normalized}return t.getDependency("bufferView",n).then((function(e){return new Promise((function(t){r.decodeDracoFile(e,(function(e){for(var i in e.attributes){var r=e.attributes[i],n=a[i];void 0!==n&&(r.normalized=n)}t(e)}),s,l)}))}))},h.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},d.prototype=Object.create(e.MeshStandardMaterial.prototype),d.prototype.constructor=d,d.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},A.prototype=Object.create(e.Interpolant.prototype),A.prototype.constructor=A,A.prototype.copySampleValue_=function(e){for(var t=this.resultBuffer,i=this.sampleValues,r=this.valueSize,n=e*r*3+r,o=0;o!==r;o++)t[o]=i[n+o];return t},A.prototype.beforeStart_=A.prototype.copySampleValue_,A.prototype.afterEnd_=A.prototype.copySampleValue_,A.prototype.interpolate_=function(e,t,i,r){for(var n=this.resultBuffer,o=this.sampleValues,s=this.valueSize,a=2*s,l=3*s,u=r-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;n[y]=m*b+v*x+A*w+g*M}return n};var g={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},m={9728:e.NearestFilter,9729:e.LinearFilter,9984:e.NearestMipmapNearestFilter,9985:e.LinearMipmapNearestFilter,9986:e.NearestMipmapLinearFilter,9987:e.LinearMipmapLinearFilter},v={33071:e.ClampToEdgeWrapping,33648:e.MirroredRepeatWrapping,10497:e.RepeatWrapping},y={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},b={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv2",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},x={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},w={CUBICSPLINE:void 0,LINEAR:e.InterpolateLinear,STEP:e.InterpolateDiscrete},M={"image/png":e.RGBAFormat,"image/jpeg":e.RGBFormat};function E(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 S(e,t,i){for(var r in i.extensions)void 0===e[r]&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[r]=i.extensions[r])}function C(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 I(e,t){if(e.updateMorphTargets(),void 0!==t.weights)for(var i=0,r=t.weights.length;i<r;i++)e.morphTargetInfluences[i]=t.weights[i];if(t.extras&&Array.isArray(t.extras.targetNames)){var n=t.extras.targetNames;if(e.morphTargetInfluences.length===n.length)for(e.morphTargetDictionary={},i=0,r=n.length;i<r;i++)e.morphTargetDictionary[n[i]]=i;else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function B(e){for(var t="",i=Object.keys(e).sort(),r=0,n=i.length;r<n;r++)t+=i[r]+":"+e[i[r]]+";";return t}function T(t,r,n){this.json=t||{},this.extensions=r||{},this.options=n||{},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 P(t,i,r){var n=i.attributes,o=[];function s(e,i){return r.getDependency("accessor",e).then((function(e){t.setAttribute(i,e)}))}for(var a in n){var l=b[a]||a.toLowerCase();l in t.attributes||o.push(s(n[a],l))}if(void 0!==i.indices&&!t.index){var u=r.getDependency("accessor",i.indices).then((function(e){t.setIndex(e)}));o.push(u)}return C(t,i),function(t,i,r){var n=i.attributes,o=new e.Box3;if(void 0!==n.POSITION){var s=(p=r.json.accessors[n.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];void 0!==f.POSITION&&(s=(p=r.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,r),Promise.all(o).then((function(){return void 0!==i.targets?function(e,t,i){for(var r=!1,n=!1,o=0,s=t.length;o<s&&(void 0!==(u=t[o]).POSITION&&(r=!0),void 0!==u.NORMAL&&(n=!0),!r||!n);o++);if(!r&&!n)return Promise.resolve(e);var a=[],l=[];for(o=0,s=t.length;o<s;o++){var u=t[o];if(r){var c=void 0!==u.POSITION?i.getDependency("accessor",u.POSITION):e.attributes.position;a.push(c)}n&&(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 r&&(e.morphAttributes.position=i),n&&(e.morphAttributes.normal=o),e.morphTargetsRelative=!0,e}))}(t,i.targets,r):t}))}function R(t,i){var r=t.getIndex();if(null===r){var n=[],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++)n.push(s);t.setIndex(n),r=t.getIndex()}var a=r.count-2,l=[];if(i===e.TriangleFanDrawMode)for(s=1;s<=a;s++)l.push(r.getX(0)),l.push(r.getX(s)),l.push(r.getX(s+1));else for(s=0;s<a;s++)s%2==0?(l.push(r.getX(s)),l.push(r.getX(s+1)),l.push(r.getX(s+2))):(l.push(r.getX(s+2)),l.push(r.getX(s+1)),l.push(r.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 T.prototype.parse=function(e,t){var i=this,r=this.json,n=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][r.scene||0],scenes:t[0],animations:t[1],cameras:t[2],asset:r.asset,parser:i,userData:{}};S(n,o,r),C(o,r),e(o)})).catch(t)},T.prototype.markDefs=function(){for(var e=this.json.nodes||[],t=this.json.skins||[],i=this.json.meshes||[],r={},n={},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===r[d.mesh]&&(r[d.mesh]=n[d.mesh]=0),r[d.mesh]++,void 0!==d.skin&&(i[d.mesh].isSkinnedMesh=!0))}this.json.meshReferences=r,this.json.meshUses=n},T.prototype.getDependency=function(e,t){var i=e+":"+t,n=this.cache.get(i);if(!n){switch(e){case"scene":n=this.loadScene(t);break;case"node":n=this.loadNode(t);break;case"mesh":n=this.loadMesh(t);break;case"accessor":n=this.loadAccessor(t);break;case"bufferView":n=this.loadBufferView(t);break;case"buffer":n=this.loadBuffer(t);break;case"material":n=this.loadMaterial(t);break;case"texture":n=this.loadTexture(t);break;case"skin":n=this.loadSkin(t);break;case"animation":n=this.loadAnimation(t);break;case"camera":n=this.loadCamera(t);break;case"light":n=this.extensions[r.KHR_LIGHTS_PUNCTUAL].loadLight(t);break;default:throw new Error("Unknown type: "+e)}this.cache.add(i,n)}return n},T.prototype.getDependencies=function(e){var t=this.cache.get(e);if(!t){var i=this,r=this.json[e+("mesh"===e?"es":"s")]||[];t=Promise.all(r.map((function(t,r){return i.getDependency(e,r)}))),this.cache.add(e,t)}return t},T.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[r.KHR_BINARY_GLTF].body);var n=this.options;return new Promise((function(e,r){i.load(E(t.uri,n.path),e,void 0,(function(){r(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))}))}))},T.prototype.loadBufferView=function(e){var t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then((function(e){var i=t.byteLength||0,r=t.byteOffset||0;return e.slice(r,r+i)}))},T.prototype.loadAccessor=function(t){var i=this,r=this.json,n=this.json.accessors[t];if(void 0===n.bufferView&&void 0===n.sparse)return Promise.resolve(null);var o=[];return void 0!==n.bufferView?o.push(this.getDependency("bufferView",n.bufferView)):o.push(null),void 0!==n.sparse&&(o.push(this.getDependency("bufferView",n.sparse.indices.bufferView)),o.push(this.getDependency("bufferView",n.sparse.values.bufferView))),Promise.all(o).then((function(t){var o,s,a=t[0],l=y[n.type],u=g[n.componentType],c=u.BYTES_PER_ELEMENT,h=c*l,d=n.byteOffset||0,p=void 0!==n.bufferView?r.bufferViews[n.bufferView].byteStride:void 0,f=!0===n.normalized;if(p&&p!==h){var A=Math.floor(d/p),m="InterleavedBuffer:"+n.bufferView+":"+n.componentType+":"+A+":"+n.count,v=i.cache.get(m);v||(o=new u(a,A*p,n.count*p/c),v=new e.InterleavedBuffer(o,p/c),i.cache.add(m,v)),s=new e.InterleavedBufferAttribute(v,l,d%p/c,f)}else o=null===a?new u(n.count*l):new u(a,d,n.count*l),s=new e.BufferAttribute(o,l,f);if(void 0!==n.sparse){var b=y.SCALAR,x=g[n.sparse.indices.componentType],w=n.sparse.indices.byteOffset||0,M=n.sparse.values.byteOffset||0,E=new x(t[1],w,n.sparse.count*b),S=new u(t[2],M,n.sparse.count*l);null!==a&&(s=new e.BufferAttribute(s.array.slice(),s.itemSize,s.normalized));for(var C=0,I=E.length;C<I;C++){var B=E[C];if(s.setX(B,S[C*l]),l>=2&&s.setY(B,S[C*l+1]),l>=3&&s.setZ(B,S[C*l+2]),l>=4&&s.setW(B,S[C*l+3]),l>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return s}))},T.prototype.loadTexture=function(t){var i,n=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[r.MSFT_TEXTURE_DDS]?o.images[c[r.MSFT_TEXTURE_DDS].source]:o.images[u.source]).uri,d=!1;return void 0!==i.bufferView&&(h=n.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[r.MSFT_TEXTURE_DDS]?n.extensions[r.MSFT_TEXTURE_DDS].ddsLoader:a),new Promise((function(i,r){t.load(E(e,s.path),i,void 0,r)}))})).then((function(r){!0===d&&l.revokeObjectURL(h),r.flipY=!1,u.name&&(r.name=u.name),i.mimeType in M&&(r.format=M[i.mimeType]);var s=(o.samplers||{})[u.sampler]||{};return r.magFilter=m[s.magFilter]||e.LinearFilter,r.minFilter=m[s.minFilter]||e.LinearMipmapLinearFilter,r.wrapS=v[s.wrapS]||e.RepeatWrapping,r.wrapT=v[s.wrapT]||e.RepeatWrapping,n.associations.set(r,{type:"textures",index:t}),r}))},T.prototype.assignTexture=function(t,i,n){var o=this;return this.getDependency("texture",n.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===n.texCoord||0==n.texCoord||"aoMap"===i&&1==n.texCoord||console.warn("THREE.GLTFLoader: Custom UV set "+n.texCoord+" for texture "+i+" not yet supported."),o.extensions[r.KHR_TEXTURE_TRANSFORM]){var a=void 0!==n.extensions?n.extensions[r.KHR_TEXTURE_TRANSFORM]:void 0;if(a){var l=this.associations.get(s);s=o.extensions[r.KHR_TEXTURE_TRANSFORM].extendTexture(s,a),this.associations.set(s,l)}}t[i]=s}))},T.prototype.assignFinalMaterial=function(t){var i=t.geometry,r=t.material,n=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:"+r.uuid,h=this.cache.get(c);h||(h=new e.PointsMaterial,e.Material.prototype.copy.call(h,r),h.color.copy(r.color),h.map=r.map,h.sizeAttenuation=!1,this.cache.add(c,h)),r=h}else if(t.isLine){c="LineBasicMaterial:"+r.uuid;var d=this.cache.get(c);d||(d=new e.LineBasicMaterial,e.Material.prototype.copy.call(d,r),d.color.copy(r.color),this.cache.add(c,d)),r=d}if(n||o||s||a||l){c="ClonedMaterial:"+r.uuid+":",r.isGLTFSpecularGlossinessMaterial&&(c+="specular-glossiness:"),a&&(c+="skinning:"),n&&(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=r.clone(),a&&(p.skinning=!0),n&&(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(r))),r=p}r.aoMap&&void 0===i.attributes.uv2&&void 0!==i.attributes.uv&&i.setAttribute("uv2",i.attributes.uv),r.normalScale&&!n&&(r.normalScale.y=-r.normalScale.y),r.clearcoatNormalScale&&!n&&(r.clearcoatNormalScale.y=-r.clearcoatNormalScale.y),t.material=r},T.prototype.loadMaterial=function(t){var i,n=this,o=this.json,s=this.extensions,a=o.materials[t],l={},u=a.extensions||{},c=[];if(u[r.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS]){var h=s[r.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS];i=h.getMaterialType(),c.push(h.extendParams(l,a,n))}else if(u[r.KHR_MATERIALS_UNLIT]){var p=s[r.KHR_MATERIALS_UNLIT];i=p.getMaterialType(),c.push(p.extendParams(l,a,n))}else{i=e.MeshStandardMaterial;var f=a.pbrMetallicRoughness||{};if(l.color=new e.Color(1,1,1),l.opacity=1,Array.isArray(f.baseColorFactor)){var A=f.baseColorFactor;l.color.fromArray(A),l.opacity=A[3]}void 0!==f.baseColorTexture&&c.push(n.assignTexture(l,"map",f.baseColorTexture)),l.metalness=void 0!==f.metallicFactor?f.metallicFactor:1,l.roughness=void 0!==f.roughnessFactor?f.roughnessFactor:1,void 0!==f.metallicRoughnessTexture&&(c.push(n.assignTexture(l,"metalnessMap",f.metallicRoughnessTexture)),c.push(n.assignTexture(l,"roughnessMap",f.metallicRoughnessTexture)))}!0===a.doubleSided&&(l.side=e.DoubleSide);var g=a.alphaMode||"OPAQUE";if("BLEND"===g?(l.transparent=!0,l.depthWrite=!1):(l.transparent=!1,"MASK"===g&&(l.alphaTest=void 0!==a.alphaCutoff?a.alphaCutoff:.5)),void 0!==a.normalTexture&&i!==e.MeshBasicMaterial&&(c.push(n.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(n.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(n.assignTexture(l,"emissiveMap",a.emissiveTexture)),u[r.KHR_MATERIALS_CLEARCOAT]){var m=s[r.KHR_MATERIALS_CLEARCOAT];i=m.getMaterialType(),c.push(m.extendParams(l,{extensions:u},n))}return Promise.all(c).then((function(){var o;return o=i===d?s[r.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),C(o,a),n.associations.set(o,{type:"materials",index:t}),a.extensions&&S(s,o,a),o}))},T.prototype.loadGeometries=function(t){var i=this,n=this.extensions,o=this.primitiveCache;function s(e){return n[r.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,i).then((function(t){return P(t,e,i)}))}for(var a,l,u=[],c=0,h=t.length;c<h;c++){var d,p=t[c],f=(void 0,(l=(a=p).extensions&&a.extensions[r.KHR_DRACO_MESH_COMPRESSION])?"draco:"+l.bufferView+":"+l.indices+":"+B(l.attributes):a.indices+":"+B(a.attributes)+":"+a.mode),A=o[f];A?u.push(A.promise):(d=p.extensions&&p.extensions[r.KHR_DRACO_MESH_COMPRESSION]?s(p):P(new e.BufferGeometry,p,i),o[f]={primitive:p,promise:d},u.push(d))}return Promise.all(u)},T.prototype.loadMesh=function(t){for(var i,r=this,n=this.json.meshes[t],o=n.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(r.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(4===p.mode||5===p.mode||6===p.mode||void 0===p.mode)!0!==(h=!0===n.isSkinnedMesh?new e.SkinnedMesh(d,f):new e.Mesh(d,f)).isSkinnedMesh||h.geometry.attributes.skinWeight.normalized||h.normalizeSkinWeights(),5===p.mode?h.geometry=R(h.geometry,e.TriangleStripDrawMode):6===p.mode&&(h.geometry=R(h.geometry,e.TriangleFanDrawMode));else if(1===p.mode)h=new e.LineSegments(d,f);else if(3===p.mode)h=new e.Line(d,f);else if(2===p.mode)h=new e.LineLoop(d,f);else{if(0!==p.mode)throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+p.mode);h=new e.Points(d,f)}Object.keys(h.geometry.morphAttributes).length>0&&I(h,n),h.name=n.name||"mesh_"+t,a.length>1&&(h.name+="_"+u),C(h,n),r.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}))},T.prototype.loadCamera=function(t){var i,r=this.json.cameras[t],n=r[r.type];if(n)return"perspective"===r.type?i=new e.PerspectiveCamera(e.MathUtils.radToDeg(n.yfov),n.aspectRatio||1,n.znear||1,n.zfar||2e6):"orthographic"===r.type&&(i=new e.OrthographicCamera(-n.xmag,n.xmag,n.ymag,-n.ymag,n.znear,n.zfar)),r.name&&(i.name=r.name),C(i,r),Promise.resolve(i);console.warn("THREE.GLTFLoader: Missing camera parameters.")},T.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}))},T.prototype.loadAnimation=function(t){for(var i=this.json.animations[t],r=[],n=[],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,g=void 0!==i.parameters?i.parameters[h.output]:h.output;r.push(this.getDependency("node",p)),n.push(this.getDependency("accessor",f)),o.push(this.getDependency("accessor",g)),s.push(h),a.push(d)}return Promise.all([Promise.all(r),Promise.all(n),Promise.all(o),Promise.all(s),Promise.all(a)]).then((function(r){for(var n=r[0],o=r[1],s=r[2],a=r[3],l=r[4],u=[],c=0,h=n.length;c<h;c++){var d=n[c],p=o[c],f=s[c],g=a[c],m=l[c];if(void 0!==d){var v;switch(d.updateMatrix(),d.matrixAutoUpdate=!0,x[m.path]){case x.weights:v=e.NumberKeyframeTrack;break;case x.rotation:v=e.QuaternionKeyframeTrack;break;default:v=e.VectorKeyframeTrack}var y=d.name?d.name:d.uuid,b=void 0!==g.interpolation?w[g.interpolation]:e.InterpolateLinear,M=[];x[m.path]===x.weights?d.traverse((function(e){!0===e.isMesh&&e.morphTargetInfluences&&M.push(e.name?e.name:e.uuid)})):M.push(y);var E=f.array;if(f.normalized){var S;if(E.constructor===Int8Array)S=1/127;else if(E.constructor===Uint8Array)S=1/255;else if(E.constructor==Int16Array)S=1/32767;else{if(E.constructor!==Uint16Array)throw new Error("THREE.GLTFLoader: Unsupported output accessor component type.");S=1/65535}for(var C=new Float32Array(E.length),I=0,B=E.length;I<B;I++)C[I]=E[I]*S;E=C}for(I=0,B=M.length;I<B;I++){var T=new v(M[I]+"."+x[m.path],p.array,E,b);"CUBICSPLINE"===g.interpolation&&(T.createInterpolant=function(e){return new A(this.times,this.values,this.getValueSize()/3,e)},T.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0),u.push(T)}}}var P=i.name?i.name:"animation_"+t;return new e.AnimationClip(P,void 0,u)}))},T.prototype.loadNode=function(t){var i,n=this.json,o=this.extensions,s=this,a=n.meshReferences,l=n.meshUses,u=n.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[r.KHR_LIGHTS_PUNCTUAL]&&void 0!==u.extensions[r.KHR_LIGHTS_PUNCTUAL].light&&i.push(s.getDependency("light",u.extensions[r.KHR_LIGHTS_PUNCTUAL].light)),Promise.all(i)).then((function(i){var r;if((r=!0===u.isBone?new e.Bone:i.length>1?new e.Group:1===i.length?i[0]:new e.Object3D)!==i[0])for(var n=0,a=i.length;n<a;n++)r.add(i[n]);if(u.name&&(r.userData.name=u.name,r.name=e.PropertyBinding.sanitizeNodeName(u.name)),C(r,u),u.extensions&&S(o,r,u),void 0!==u.matrix){var l=new e.Matrix4;l.fromArray(u.matrix),r.applyMatrix4(l)}else void 0!==u.translation&&r.position.fromArray(u.translation),void 0!==u.rotation&&r.quaternion.fromArray(u.rotation),void 0!==u.scale&&r.scale.fromArray(u.scale);return s.associations.set(r,{type:"nodes",index:t}),r}))},T.prototype.loadScene=function(){function t(i,r,n,o){var s=n.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=[],r=0,n=(i=e).joints.length;r<n;r++)t.push(o.getDependency("node",i.joints[r]));return Promise.all(t)})).then((function(r){return t.traverse((function(t){if(t.isMesh){for(var n=[],o=[],s=0,a=r.length;s<a;s++){var l=r[s];if(l){n.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(n,o),t.matrixWorld)}})),t}));var i})).then((function(e){r.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,n,o))}return Promise.all(i)}))}return function(i){var r=this.json,n=this.extensions,o=this.json.scenes[i],s=new e.Group;o.name&&(s.name=o.name),C(s,o),o.extensions&&S(n,s,o);for(var a=o.nodes||[],l=[],u=0,c=a.length;u<c;u++)l.push(t(a[u],s,r,this));return Promise.all(l).then((function(){return s}))}}(),t}(),$r=new Jr,en=(new e.Matrix4).makeRotationAxis(new e.Vector3(1,0,0),Math.PI/2);function tn(t){function i(e){if(e.isMesh)return function(e){var t=new Et;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 pi;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 t=function(e){var t=new Ct;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),r=0;r<e.children.length;r++){var n=i(e.children[r]);t.add(n)}return t}return new Ct}return new Promise((function(r,n){var o,s=(new e.Matrix4).copy(t.computedTransform);if("Z"!==(null===(o=t.tileset.asset)||void 0===o?void 0:o.gltfUpAxis)&&s.multiply(en),t.content){var a=t.content.gltfArrayBuffer,l=t.contentUrl?t.contentUrl.slice(0,t.contentUrl.lastIndexOf("/")+1):"";$r.parse(a,l,(function(e){var t=e.scene,n=new Ct,o=i(t);o.applyMatrix4(s),n.add(o),r(n)}),(function(e){n(new Error("error parsing gltf in tile ".concat(t.id,": ").concat(e.message)))}))}else r(new Ct)}))}function rn(e){e.traverse((function(e){if(e instanceof Et){e.geometry.dispose();for(var t=0,i=e.material;t<i.length;t++){var r=i[t];r.uniforms.map&&r.uniforms.map.value&&(r.uniforms.map.value.dispose(),r.uniforms.map.value=null)}}}))}function nn(t){var i=t.toArray();return(new e.Matrix4).fromArray([2*i[0],2*i[1],2*i[2],0,2*i[3],2*i[4],2*i[5],0,2*i[6],2*i[7],2*i[8],0,0,0,0,1])}var on=new e.EdgesGeometry(new e.BoxBufferGeometry(1,1,1)),sn=new e.LineBasicMaterial({color:new e.Color(1,1,0),transparent:!0});function an(t){t.updateMatrix(),t.updateMatrixWorld(),t.matrixWorld.getInverse(t.matrixWorldInverse);var i=(new e.Matrix4).multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse);return(new e.Frustum).setFromProjectionMatrix(i)}var ln={throttleRequests:!0,maxRequests:64,updateInterval:.1,maxScreenSpaceError:8,maxMemoryUsage:32,viewDistanceScale:.2,onNodeCreated:function(){}},un=function(t){function i(i){void 0===i&&(i={});var r=t.call(this)||this;return r.options=Fe(Fe({},ln),i),r.clock=new e.Clock,r.timer=0,r.unloadTileQueue=[],r.nodes={},r.boundings={},r.nodeGroup=new e.Group,r.boundingGroup=new e.Group,r.add(r.nodeGroup),r.sseDenominator=null,r.lastCameraTransform=new e.Matrix4,r.lastCameraAspect=1,r.lastCameraFov=null,r.lastCamera=null,r.lastRenderer=null,r.enabled=!1,r}return Oe(i,t),Object.defineProperty(i.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}),i.prototype.load=function(t){var i=this,r=t.tileset_url,n=(t.tileset_url_md5,t.b3md_mappings_url),o=(t.b3md_mappings_url_md5,{modelMatrix:(new e.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(t){var r=function(t){var i=t.boundingVolume,r=new e.LineSegments(on,sn);return r.applyMatrix4(nn(i.halfAxes)),r.position.set(i.center.x,i.center.y,i.center.z),r}(t);return r.visible=!1,i.boundings[t.id]=r,i.boundingGroup.add(r),r.updateMatrixWorld(!0),"SCENEGRAPH"===t.type||"MESH"===t.type?tn(t).then((function(e){void 0===i.tileset?rn(e):(e.visible=!1,i.nodes[t.id]=e,i.nodeGroup.add(e),i.options.onNodeCreated(e),e.updateMatrixWorld(!0))})):Promise.resolve()},onTileLoad:function(){i.enabled&&i.tileset&&i.lastRenderer&&i.lastCamera&&(i.tileset.frameNumber++,i.tilesetUpdate(i.tileset,i.lastRenderer,i.lastCamera)),i.enabled||i.reset()},onTileUnload:function(e){i.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=r.split("/").slice(0,-1).join("/"),a=lt(r,{allowHosts:this.options.allowHosts,networkSubscribe:this.options.networkSubscribe,requestProxy:this.options.requestProxy}).then((function(e){return JSON.parse(e.body)})).then((function(e){return function(e,t){var i,r=JSON.parse(JSON.stringify(e));return r.basePath=t,r.root=function(e,t){e=Zr(e,t);var i=[];for(i.push(e);i.length>0;)for(var r=0,n=(i.pop()||{}).children||[];r<n.length;r++){var o=n[r];Zr(o,t),i.push(o)}return e}(r.root,t),r.type="TILES3D",r.lodMetricType="geometricError",r.lodMetricValue=(null===(i=r.root)||void 0===i?void 0:i.lodMetricValue)||0,r}(e,s)})),l=lt(n,{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(t){var r=t[0],n=t[1];r.b3dmMapping=n;var s=i.tileset=new Wr(r,o),a=new e.Matrix4;if(s.root&&s.root.boundingVolume){var l=s.root.boundingVolume,u=l.halfAxes,c=l.center;a.extractRotation(nn(u)),a.setPosition(c.x,c.y,c.z)}s.modelMatrix.copy((new e.Matrix4).getInverse(a))}))},i.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))))},i.prototype.tilesetUpdate=function(t,i,r){this.sseDenominator&&r.aspect===this.lastCameraAspect&&r.fov===this.lastCameraFov||(this.sseDenominator=function(e){var t=e.aspect,i=e.fov/180*Math.PI,r=e.aspect<=1?i:2*Math.atan(Math.tan(.5*i)/t);return 2*Math.tan(.5*r)}(r),this.lastCameraAspect=r.aspect,this.lastCameraFov=r.fov);var n,o,s,a={camera:{position:r.getWorldPosition(new e.Vector3).toArray(),direction:r.getWorldDirection(new e.Vector3).toArray(),up:r.up.toArray()},height:i.getSize(new e.Vector2).height,frameNumber:t.frameNumber,sseDenominator:this.sseDenominator,cullingVolume:(n=an(r),o=n.planes.map((function(t){return new e.Plane(t.normal,t.constant)})),new Er(o))};t.cache.reset(),t.traverser.traverse(t.root,a);for(var l=0,u=t.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();){if(d=s.id,this.nodes[d]){var p=this.nodes[d];this.nodeGroup.remove(p),rn(p),delete this.nodes[d]}this.boundings[d]&&(p=this.boundings[d],this.boundingGroup.remove(p),delete this.boundings[d])}},i.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),rn(i),delete this.nodes[t]}this.boundings[t]&&(i=this.boundings[t],this.boundingGroup.remove(i),delete this.boundings[t])}for(var r=0,n=Object.keys(this.nodes);r<n.length;r++){t=n[r];var o=this.nodes[t];this.nodeGroup.remove(o),rn(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]}},i}(St);function cn(e){return null==e}var hn=function(t,i){void 0===i&&(i=1e-4),i=Math.max(i,Number.EPSILON);for(var r={},n=t.getIndex(),o=t.getAttribute("position"),s=n?n.count:o.count,a=0,l=Object.keys(t.attributes),u={},c={},h=[],d=["getX","getY","getZ","getW"],p=0,f=l.length;p<f;p++)u[b=l[p]]=[],(E=t.morphAttributes[b])&&(c[b]=new Array(E.length).fill().map((function(){return[]})));var A=Math.log10(1/i),g=Math.pow(10,A);for(p=0;p<s;p++){var m=n?n.getX(p):p,v="",y=0;for(f=l.length;y<f;y++)for(var b=l[y],x=(M=t.getAttribute(b)).itemSize,w=0;w<x;w++)v+="".concat(~~(M[d[w]](m)*g),",");if(v in r)h.push(r[v]);else{for(y=0,f=l.length;y<f;y++){b=l[y];var M=t.getAttribute(b),E=t.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))}}r[v]=a,h.push(a),a++}}var P=t.clone();for(p=0,f=l.length;p<f;p++){b=l[p];var R=t.getAttribute(b),D=new R.array.constructor(u[b]);if(M=new e.BufferAttribute(D,R.itemSize,R.normalized),P.setAttribute(b,M),b in c)for(y=0;y<c[b].length;y++){var k=t.morphAttributes[b][y],L=(D=new k.array.constructor(c[b][y]),new e.BufferAttribute(D,k.itemSize,k.normalized));P.morphAttributes[b][y]=L}}return P.setIndex(h),P};function dn(t){var i;return new((i=e.Triangle).bind.apply(i,Ne([void 0],t.map((function(t){return new e.Vector3(t.x,t.y,t.z)})),!1)))}var pn={at3d:function(e,t){for(var i=nr(t.textureOptions,e.textures.length),r={},n=0,o=e.textures;n<o.length;n++){var s=o[n];r[s]=ir(s,i,t.allowHosts,t.requestProxy,t.networkSubscribe)}return Promise.resolve().then((function(){return lt(e.file,{responseType:"arraybuffer",allowHosts:t.allowHosts,requestProxy:t.requestProxy,networkSubscribe:t.networkSubscribe})})).then((function(e){return _i(e.body)})).then((function(e){return Fi((function(){for(var t,i={chunks:[],createAt:void 0,description:void 0},r=0,n=e;r<n.length;r++){var o=n[r],s=Zi.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(n){return Fi((function(){return rr(n,e.textureBase,e.textures.slice(),i,r,t.allowHosts,t.requestProxy,t.networkSubscribe)}))}))},pbm:function(e,t){for(var i=nr(t.textureOptions,e.textures.length),r={},n=0,o=e.textures;n<o.length;n++){var s=o[n];r[s]=ir(s,i,t.allowHosts,t.requestProxy,t.networkSubscribe)}return Promise.resolve().then((function(){return lt(e.file,{responseType:"arraybuffer",allowHosts:t.allowHosts,requestProxy:t.requestProxy,networkSubscribe:t.networkSubscribe})})).then((function(e){return Fi((function(){var t=new Uint8Array(e.body);return Zi.decode(t)}))})).then((function(n){return Fi((function(){return rr(n,e.textureBase,e.textures.slice(),i,r,t.allowHosts,t.requestProxy,t.networkSubscribe)}))}))},dome:function(e,t){return Promise.resolve().then((function(){return lt(e.file,{responseType:"arraybuffer",allowHosts:t.allowHosts,requestProxy:t.requestProxy,networkSubscribe:t.networkSubscribe})})).then((function(i){return fr(new Uint8Array(i.body),e.textureBase,t.textureOptions,t.allowHosts,t.requestProxy,t.networkSubscribe)}))},domez:function(e,t){return Promise.resolve().then((function(){return lt(e.file,{responseType:"arraybuffer",allowHosts:t.allowHosts,requestProxy:t.requestProxy,networkSubscribe:t.networkSubscribe})})).then((function(e){return _i(e.body)})).then((function(e){var t=e.reduce((function(e,t){return e+t.length}),0),i=new Uint8Array(t),r=0;return e.forEach((function(e){i.set(e,r),r+=e.length})),i})).then((function(i){return fr(i,e.textureBase,t.textureOptions,t.allowHosts,t.requestProxy,t.networkSubscribe)}))}},fn=function(t){function i(i){void 0===i&&(i={});var r=t.call(this)||this;return r.empty=!0,r.name="model",r.loaded=!1,r.bvhs=Object.assign([],{loaded:!1}),r.bounding=new e.Box3,r.shownFloor=null,r.floorLength=0,r.requestProxy=i.requestProxy,r.networkSubscribe=i.networkSubscribe,r.allowHosts=i.allowHosts,r.renderOrder=-3,r}return Oe(i,t),Object.defineProperty(i.prototype,"shownfloor",{get:function(){return this.shownFloor},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"hasTiles",{get:function(){return void 0!==this.tiledModel},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"enableTiles",{get:function(){return!!this.tiledModel&&this.tiledModel.enable},set:function(e){this.tiledModel&&(this.tiledModel.enable=e)},enumerable:!1,configurable:!0}),i.prototype.getEdges=function(t){var i;if(void 0===t&&(t=30/180*Math.PI),!this.originModel)return[];for(var r=Math.cos(t),n=[],o=0,s=this.originModel.children;o<s.length;o++){var a=s[o];if(a instanceof Et){for(var l={},u=["a","b","c"],c=hn(a.geometry),h=c.getAttribute("position").array,d=(null===(i=c.getIndex())||void 0===i?void 0:i.array)||[],p=[],f=[],A=0,g=h.length;A<g;A+=3)p.push(new e.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 e.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)<=r){var B=p[I.index1],T=p[I.index2];n.push(new e.Line3(B,T))}}c.dispose(),p.length=0,f.length=0}}return n},i.prototype.hasFloors=function(){return this.hasFloors_()},i.prototype.hasFloors_=function(){var e=[];return this.traverse((function(t){t instanceof Et&&(e[t.floorIndex]=!0)})),e.length},i.prototype.show=function(){for(var t,i,r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var o=this.shownFloor,s=null,a=null!==(t=r[1])&&void 0!==t?t:.1,l=0!==r.length;this.shownFloor=s=l?r[0]:null,this.setMaterial({opacity:1,floorInfo:new e.Vector3(0,0,0)}),(null===(i=this.tiledModel)||void 0===i?void 0:i.enable)?this.b3dmShow(o,s):this.at3dShow(o,s,a)},i.prototype.at3dShow=function(e,t,i){this.traverse((function(e){e instanceof Et&&e.material.forEach((function(r){null===t||t===e.floorIndex?r.opacity=1*r.originOpacity:r.opacity=r.originOpacity*i}))})),e!==this.shownFloor&&this.emit("shownFloorChange",this.shownFloor,this.floorLength),this.needsRender=!0},i.prototype.b3dmShow=function(t,i){var r,n;if(null===(n=null===(r=this.tiledModel)||void 0===r?void 0:r.tileset)||void 0===n?void 0:n.floorInfo){if("number"==typeof i&&i>=0&&i<this.tiledModel.tileset.floorInfo.length){var o=this.tiledModel.tileset.floorInfo,s=-o[i].ground,a=o[i].height+s;this.setMaterial({opacity:1,floorInfo:new e.Vector3(s,a,0)})}else this.setMaterial({opacity:1,floorInfo:new e.Vector3(0,0,0)});t!==this.shownFloor&&this.emit("shownFloorChange",this.shownFloor,this.floorLength),this.needsRender=!0}},i.prototype.intersectRaycaster=function(t,i){var r=t.ray,n=r.origin,o=r.direction;if(cn(i))if(cn(this.shownFloor)){var s=this.floorLength;i=[];for(var a=-1;a<s;a++)i.push(a)}else i=[this.shownFloor];var l=[],u=[];Array.isArray(i)?u.push.apply(u,i):u.push(i);for(var c=function(i){var r=h.bvhs&&h.bvhs[i];if(r){var s=new Ei(n.x,n.y,n.z),a=new Ei(o.x,o.y,o.z),u=r.intersectRay(s,a,!0).map((function(t){var i=t.intersectionPoint,r=t.triangle,o=new e.Vector3(i.x,i.y,i.z);return{point:o,face:{normal:dn(r).getNormal(new e.Vector3)},distance:n.distanceTo(o)}}));u.length&&l.push.apply(l,u)}else if(h.originModel){var c=[];h.originModel.traverse((function(e){e instanceof Et&&e.floorIndex===i&&c.push(e)})),(u=t.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(e){var i=e.distance;return i<=t.far&&i>=t.near})).sort((function(e,t){return e.distance-t.distance}))},i.prototype.buildBVH=function(){if(!this.bvhs.loaded&&this.originModel){var e=[];this.originModel.traverse((function(t){t instanceof Et&&(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 r=i[t],n=0;if(r){for(var o=0,s=r;o<s.length;o++){var a;a=(d=s[o]).index?d.index.array.length:d.attributes.position.array.length/3,n+=3*Math.floor(a/3)}for(var l=new Float32Array(3*n),u=0,c=0,h=r;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 Di).create(l).splitNode(50);this.bvhs.push(y)}}this.bvhs.loaded=!0,this.emit("bvhLoaded")}},i.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 r=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 r=0,n=String(i[1]).trim().split(".").slice(1).reverse();r<n.length;r++){var o=n[r],s=t.indexOf(o);if(s>=0)return t[s]}return""}(e.file,Object.keys(pn)),n=pn[r];if(!n)throw new Error("[MODEL LOAD ERROR]: file type(".concat(r,") does not support."));return this.name=e.file,n(e,{textureOptions:t,allowHosts:this.allowHosts,requestProxy:this.requestProxy,networkSubscribe:this.networkSubscribe}).then((function(t){var r=t.createAt,n=t.description,o=t.objects,s=t.texturePromise;i.userData.createAt=r,i.userData.description=n,i.bounding.makeEmpty();var a=i.originModel=new St;a.renderOrder=-3;for(var l=0,u=o;l<u.length;l++){var c=u[l];c.traverse((function(e){if(e instanceof Et){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 un({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(),Fi((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)}))},i.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 r=this.tiledModel.tileset.root;r.content&&"READY"===r.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)}},i.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},i}(St);Object.assign(fn.prototype,{on:qe.prototype.on,once:qe.prototype.once,off:qe.prototype.off,emit:qe.prototype.emit,hasListener:qe.prototype.hasListener});var An="Panorama";function gn(e,t,i){return e<t?t:e>i?i:e}function mn(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,r,n;if(Array.isArray(e)){if((i=e.length)!=t.length)return!1;for(r=i;0!=r--;)if(!mn(e[r],t[r]))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=(n=Object.keys(e)).length)!==Object.keys(t).length)return!1;for(r=i;0!=r--;)if(!Object.prototype.hasOwnProperty.call(t,n[r]))return!1;for(r=i;0!=r--;){var o=n[r];if(!mn(e[o],t[o]))return!1}return!0}return e!=e&&t!=t}function vn(e){return"number"==typeof e}var yn=function(){return new Error("Invalid input.")},bn=function(){return new Error("Invalid certificate.")},xn=function(){return new Error("Invalid signature.")};function wn(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 r="[",n=e.length-1,o=0;o<n;o++)r+=wn(e[o],!1)+",";return n>-1&&(r+=wn(e[o],!1)),r+"]"}if(e instanceof Object){if("function"==typeof e.toJSON)return wn(e.toJSON(),t);var s=Object.keys(e).sort(),a=s.length;for(r="",o=0;o<a;){var l=s[o],u=wn(e[l],!0);void 0!==u&&(o&&""!==r&&(r+=","),r+=JSON.stringify(l)+":"+u),o++}return"{"+r+"}"}switch(i){case"function":case"undefined":return t?void 0:null;case"number":return 0;default:return isFinite(e)?e:null}}function Mn(e){return String(wn(e,!1))}function En(e){var t,i,r;if(Array.isArray(e)){var n,o,s=void 0;if(e.length<=0)return yn();for(var a=function(t){var i=En(e[t]);if(i instanceof Error)return{value:i};if(s){if(s!==i.issuer)return{value:bn()}}else s=i.issuer;n?i.expire.getTime()<n.getTime()&&(n=i.expire):n=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 _e({issuer:s,expire:n,allowHosts:o})}var c=JSON.parse(e),h="undefined"!=typeof location?location.hostname:"",d=Date.now();if("object"!=typeof c)return yn();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)||Ze.filter((function(e){return We(e,h)})).length>0){var A=String(null!==(t=c.certificate)&&void 0!==t?t:"");if(A){var g=new Be;return g.readCertPEM(A),_e({issuer:g.getSubjectString(),expire:p,allowHosts:f})}return _e({issuer:"none",expire:p,allowHosts:f})}var m=String(null!==(i=c.certificate)&&void 0!==i?i:"");if(!m)return bn();var v=new Be;v.readCertPEM(m);var y=String(null!==(r=c._signature)&&void 0!==r?r:"");if(!y)return xn();var b=Mn(function(e,t){for(var i={},r=0,n=Object.keys(e);r<n.length;r++){var o=n[r];-1===t.indexOf(o)&&(i[o]=e[o])}return i}(c,["_signature"]));return!1===function(e,t,i){var r=new Be;if("string"==typeof i?r.readCertPEM(i):r.readCertHex(i.hex),!1===ke(r))return!1;var n=new te;return n.readCertPubKeyHex(r.hex,6),!!n.verify(e,j(t))}(b,y,v)?xn():d<p.getTime()?0===f.filter((function(e){return We(e,h)})).length?function(e){return new Error("host(".concat(JSON.stringify(e),") is not allowed."))}(h):_e({issuer:v.getSubjectString(),expire:p,allowHosts:f}):function(e){return new Error("date(".concat(e.toString(),") expired."))}(p)}var Sn=new WeakMap,Cn=function(){function e(){this.name="",this.workCode="",this.expire=new Date,this.allowHosts=[],this.initial={mode:An,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=Pn,e}();function In(e){return null==e?"null":Array.isArray(e)?"array":"object"==typeof e?"dict":"value"}function Bn(e,t){var i=In(e),r=In(t);if("null"===r)return e;if("value"===r)return t;if(r!==i)return JSON.parse(JSON.stringify(t));if("array"===r)for(var n=0;n<t.length;n++)e[n]=Bn(e[n],t[n]);else if("dict"===r)for(var o in t)e[o]=Bn(e[o],t[o]);return e}function Tn(t,i,r){for(var n,o=JSON.stringify(i),s=[],a=0,l=[].concat(t);a<l.length;a++){var u=l[a];u instanceof Cn?s.push.apply(s,u.raw.works):"string"==typeof u?s.push(u):s.push(JSON.stringify(u))}var c=En(s);if(c instanceof Error)return c;i=JSON.parse(o),t=s.map((function(e){return JSON.parse(e)})).reduce((function(e,t){return Bn(e,t)}));var h=new Cn;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!==(n=t.base_url)&&void 0!==n?n:"";d&&"/"!==d[d.length-1]&&(d+="/");var p=function(e,t){return 0===e.indexOf(t)},f=function(e,t){var n,o=e;if(!0===i.jsonp){o=e.replace(/([\?\#].*)?$/i,"");var s=Te("".concat(o)).slice(0,7);o="".concat(o,".").concat(s,".jsonp")}if(!0===i.shortPath){var a=o.replace(d,"").split("."),l=null!==(n=a.shift())&&void 0!==n?n:"",u=a.join(".");o=Ki(d,Te(l))+(u?"."+u:"")}var c=o.replace(d,"");return i.baseURL&&(o=Ki(i.baseURL,c)),r&&r(e,o,c,t),o},A=function(e,i){var r,n,o,s,a,l,u=e;if(!or(e)){var c=null!==(l=null!==(s=null!==(n=null===(r=t.panorama)||void 0===r?void 0:r.pano_high_cube_base_url)&&void 0!==n?n:null===(o=t.panorama)||void 0===o?void 0:o.pano_cube_base_url)&&void 0!==s?s:null===(a=t.panorama)||void 0===a?void 0:a.base_url)&&void 0!==l?l:"";c&&(c=Ki(c,String(i))),u=Ki(c,u)}return or(u)||(u=Ki(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 or(t)||(t=Ki(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 or(i)||(i=Ki(t,i)),or(i)||(i=Ki(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(t.work_code||t.code||t.vr_code||t.workCode),h.name=String(t.name),c instanceof Error)return c;if(t.model){var v={bvh:!0,async:!1,textureBase:"",textures:[]};"boolean"==typeof i.modelBvh?v.bvh=i.modelBvh:"boolean"==typeof t.model.bvh?v.bvh=t.model.bvh:"boolean"==typeof t.bvh&&(v.bvh=t.bvh),t.model.file?v.file=g(t.model.file):t.model.file_url&&(v.file=g(t.model.file_url)),t.model.textureBase?v.textureBase=m("",t.model.textureBase):t.model.material_base_url?v.textureBase=m("",t.model.material_base_url):v.file&&(v.textureBase=v.file.split("/").slice(0,-1).join("/").replace("/model/","/materials/")),Array.isArray(t.model.textures)?v.textures=t.model.textures.map((function(e){var i,r;return m(e,null!==(r=null!==(i=t.model.textureBase)&&void 0!==i?i:t.model.material_base_url)&&void 0!==r?r:"")})):Array.isArray(t.model.material_textures)&&(v.textures=t.model.material_textures.map((function(e){var i,r;return m(e,null!==(r=null!==(i=t.model.textureBase)&&void 0!==i?i:t.model.material_base_url)&&void 0!==r?r:"")}))),t.model.tiles&&(v.tiles=t.model.tiles),v.file&&(h.model=v)}if(c instanceof Error)return c;if(t.observers&&Array.isArray(t.observers)){var y=[];t.panorama&&(Array.isArray(t.panorama)?y=t.panorama:Array.isArray(t.panorama.list)?y=t.panorama.list:Array.isArray(t.panorama.info)&&(y=t.panorama.info));for(var b=0;b<t.observers.length;b++){var x={},w=t.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,i=e.match(/\/cube_(\d+)\//);if(i){var r=Number(i[1]);if(0==((t=r)&t-1)&&0!==t)return r}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 k=D,L=B(x.images.front);if(!1===L)continue;if((q=Math.max(L,512*Math.pow(2,k)))>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:k,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:k,size:q,up:O,down:F,right:N,left:V,front:Q,back:H})}else{var q;if("number"!=typeof(k=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:k,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 e.Vector3)x.position=w.position.clone();else{if(!Array.isArray(w.position))break;x.position=(new e.Vector3).fromArray(w.position)}if(w.standingPosition instanceof e.Vector3)x.standingPosition=w.standingPosition.clone();else if(Array.isArray(w.standingPosition))x.standingPosition=(new e.Vector3).fromArray(w.standingPosition);else if(w.standing_position instanceof e.Vector3)x.standingPosition=w.standing_position.clone();else{if(!Array.isArray(w.standing_position))break;x.standingPosition=(new e.Vector3).fromArray(w.standing_position)}if(w.quaternion instanceof e.Quaternion)x.quaternion=w.quaternion.clone();else if(Array.isArray(w.quaternion))x.quaternion=(new e.Quaternion).fromArray(w.quaternion);else{if(!w.quaternion)break;var U=w.quaternion,z=U.x,j=U.y,_=U.z,K=U.w;x.quaternion=new e.Quaternion(z,j,_,K)}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()),vn(w.floorIndex)?x.floorIndex=w.floorIndex:vn(w.floor_index)?x.floorIndex=w.floor_index:x.floorIndex=0,w.video){var G={};"string"==typeof w.video.source&&(G.source=w.video.source),w.video.matrix instanceof e.Matrix4?G.matrix=w.video.matrix.clone():Array.isArray(w.video.matrix)&&(G.matrix=(new e.Matrix4).fromArray(w.video.matrix)),w.video.size instanceof e.Vector2?G.size=w.video.size.clone():Array.isArray(w.video.size)&&(G.size=(new e.Vector2).fromArray(w.video.size)),G.source&&G.matrix&&G.size&&(x.video=G)}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 for(x.visibleNodes=[],Y=0;Y<h.observers.length;Y++)h.observers[Y]!==x&&x.visibleNodes.push(Y)}if(c instanceof Error)return c;if(t.initial)if("Floorplan"!==t.initial.mode&&"Topview"!==t.initial.mode&&"Panorama"!==t.initial.mode&&"VRPanorama"!==t.initial.mode&&"Model"!==t.initial.mode&&"DepthPanorama"!==t.initial.mode||(h.initial.mode=t.initial.mode),vn(t.initial.latitude)&&(h.initial.latitude=t.initial.latitude),vn(t.initial.longitude)?h.initial.longitude=t.initial.longitude:vn(t.initial.heading)&&(h.initial.longitude=-(360*(t.initial.heading-.25)+90)/180*Math.PI),vn(t.initial.fov)&&(h.initial.fov=t.initial.fov),vn(t.initial.panoIndex)){var Z=h.observers.length>0?h.observers.length-1:0;h.initial.panoIndex=gn(t.initial.panoIndex,0,Z)}else vn(t.initial.pano_index)?(Z=h.observers.length>0?h.observers.length-1:0,h.initial.panoIndex=gn(t.initial.pano_index,0,Z)):vn(t.initial.pano)&&(Z=h.observers.length>0?h.observers.length-1:0,h.initial.panoIndex=gn(t.initial.pano,0,Z));if(c instanceof Error)return c;var J=_e(h);return Sn.set(J,{works:s,options:o}),J}function Pn(e,t,i){"string"==typeof e&&"{"===e.trim()[0]&&(e=JSON.parse(e));var r=Sn.get(e);if(r){if(t&&!mn(JSON.parse(r.options),t))throw new Error("[PARSE FAILED]: work is parsed with different options.");return e}var n=Tn(e,null!=t?t:{},i);if(n instanceof Error)throw new Error("[PARSE FAILED]: "+n.message+"\nError work input:\n"+JSON.stringify(e));return n}function Rn(){return"undefined"==typeof document?{}:document.createElementNS("http://www.w3.org/1999/xhtml","img")}function Dn(e,t,i){return e+(t-e)*i}function kn(e,t){var i=t[1]-t[0];return e<t[0]?kn(e+i,t):e>=t[1]?kn(e-i,t):e}function Ln(e,t,i,r){return r?function(e,t,i,r){var n=r[1]-r[0];return e=kn(e,r),Dn((t=kn(t,r))-e>n/2?e+n:e-t>n/2?e-n:e,t,i)}(e,t,i,r):Dn(e,t,i)}var On=function(){function e(e){for(var t in this.config={},this.progress=1,this.ended=!0,this.value={},this.startTime=je(),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,r){var n=(t*i+2)/Math.pow(i,3),o=-(2*t*i+3)/Math.pow(i,2),s=t;return n*Math.pow(r,3)+o*Math.pow(r,2)+s*r+1}(0,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],r=this.keyframes[t],n={};for(var o in this.config){var s=(e-i.progress)/(r.progress-i.progress);n[o]=Ln(i.value[o],r.value[o],s,this.config[o].circle)}return n}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,r){var n=(t*i+2)/Math.pow(i,3),o=-(2*t*i+3)/Math.pow(i,2),s=t;return 3*n*Math.pow(r,2)+2*o*r+s}(0,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,r){var n;void 0===i&&(i=0),isNaN(t)&&(t=0),isNaN(i)&&(i=0),r=null!=r?r:je();var o=this.getProgress(r),s=this.getValue(o),a={};for(var l in this.config)a[l]=null!==(n=e[l])&&void 0!==n?n:s[l];var u=[{progress:0,value:s},{progress:1,value:a}];return this.setKeyframes(u,t,i,r)},e.prototype.setKeyframes=function(e,t,i,r){var n=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){r=null!=r?r:je(),n.progress=0,n.ended=!1,n.startTime=r,n.startVelocity=i,n.keyframes=e,n.duration=t,0===t?(n.progress=1,n.value=Fe({},e[e.length-1].value)):n.value=Fe({},e[0].value),n.callbacks=[o,s]}))},e.prototype.dispose=function(){this.callbacks&&(this.callbacks[1](new Error("motion dispose.")),this.callbacks=void 0)},e}();const Fn="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAR9JREFUOBF10kFOAzEMBdCZFhCbrrgAN+NqHIULsWKDKO3gF+VHoZpa+rXjfH87nq7btr0ty3KZ8FsxnHeQPL748lA/x0Jsq+AwYe0X8nDtGA33BEJUHIEKW/EorHOLI7BHNlkEbju38YkQAIRZxFkHz2HOirKDxNcIzG+fu/6oLiNmqc5ZrlwTeKyAgJF14tMZmSn87pBrxeX/CRABgk/dl1s+C18dio2Pp9nmCQru2UtdvN+7lI9AFsgb3zNMcSp8FF4LYs3UhLfOAvkDJffci8q1J/ByRLKnQ8gUJUFOd2SeZYliCxwiyJCxCbhUGFKF4zPm61hiq7sVyJnPmATyR5IzLSNyDNEFRCDnkAmA8U2RfCsIefYhDeKOQLv7A+l1ZTyjymNxAAAAAElFTkSuQmCC";var Nn=Rn(),Vn=new e.Texture(Nn);Nn.onload=function(){return Vn.needsUpdate=!0},Nn.src=Fn;var Qn=new e.RingBufferGeometry(.06,.07,32).rotateX(-Math.PI/2),Hn=new e.MeshBasicMaterial({map:Vn,transparent:!0}),qn=new e.SphereBufferGeometry(.12,16,16),Un=new e.MeshBasicMaterial({color:16777215,opacity:0,transparent:!0});function zn(){if("undefined"==typeof document){var t=new e.Texture;return Object.assign(t,{draw:function(e){},retain:!1,pool:!1})}var i=document.createElement("canvas"),r=512,n=256,o=190;i.setAttribute("width",String(r)),i.setAttribute("height",String(r));var s=new e.Texture(i),a=i.getContext("2d");if(!a)throw Error("cannot create canvas context");var l=a.createRadialGradient(n,n,150,n,n,0);function u(){var e=Math.PI/12,t=2*Math.PI/3;a&&(a.beginPath(),a.arc(n,n,o,0*t,1*t-e),a.stroke(),a.beginPath(),a.arc(n,n,o,1*t,2*t-e),a.stroke(),a.beginPath(),a.arc(n,n,o,2*t,3*t-e),a.stroke())}function c(e){a&&(a.clearRect(0,0,r,r),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(n,n,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(n,n,150,0,2*Math.PI),a.closePath(),a.fillStyle=l,a.fill(),a.fillStyle="rgba(255, 255, 255, 0.01)",a.fillRect(0,0,r,r),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 jn=[],_n=zn();_n.draw(0);var Kn=zn();Kn.draw(1);var Gn=zn();Gn.draw(-1);var Wn=new e.CircleBufferGeometry(.12,32).rotateX(-Math.PI/2);var Xn=function(t){function i(){var i=t.call(this)||this;return i.loading=!1,i.disabled=!1,i.current=!1,i.progress=0,i.opacity=0,i.hitTestMesh=new e.Mesh(qn,Un),i.add(i.hitTestMesh),i.centerMesh=new e.Mesh(Wn,new e.MeshBasicMaterial({map:_n,transparent:!0})),i.centerMesh.position.y+=.01,i.add(i.centerMesh),i.loadingMesh=new e.Mesh(Qn,Hn),i.loadingMesh.position.y+=.011,i.progressMotion=new On({progress:i.progress}),i.opacityMotion=new On({opacity:i.opacity}),i.needsRender=!0,i.renderOrder=-2,i}return Oe(i,t),i.prototype.setLoading=function(t){var i=this;this.loading=t,this.stopInterval&&this.stopInterval(),t?(this.add(this.loadingMesh),this.stopInterval=ft.shared.add((function(){i.loadingMesh.rotateOnAxis(new e.Vector3(0,1,0),.1),i.needsRender=!0}))):this.remove(this.loadingMesh),this.needsRender=!0},i.prototype.setDisabled=function(e){this.disabled=e,function(e,t){var i=e.map;!0===i.pool&&(i.retain=!1),e.map=t?Gn:_n}(this.centerMesh.material,e),this.needsRender=!0},i.prototype.setProgress=function(e){this.setLoading(!1),this.setDisabled(!1),this.progress=e=gn(e,0,1),e!==this.progressMotion.getTargetKeyframe().value.progress&&this.progressMotion.set({progress:e},120).catch(Ue)},i.prototype.setOpacity=function(e){this.opacity=e=gn(e,0,1),this.current&&(e=1),e!==this.opacityMotion.getTargetKeyframe().value.opacity&&this.opacityMotion.set({opacity:e},500).catch(Ue)},i.prototype.setCurrent=function(e){this.current!==e&&(this.current=e,this.setOpacity(this.opacity))},i.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),function(e,t){var i=e.map;0===t||1===t?(!0===i.pool&&(i.retain=!1),0===t&&(e.map=_n),1===t&&(e.map=Kn)):(!0!==i.pool&&(e.map=function(){for(var e=0,t=jn;e<t.length;e++){var i=t[e];if(!1===i.retain)return i}var r=zn();return r.pool=!0,r.retain=!0,jn.push(r),r}()),e.map.draw(t))}(this.centerMesh.material,this.progressMotion.value.progress),this.needsRender=!0)},i.prototype.dispose=function(){this.setLoading(!1),this.remove(this.hitTestMesh),this.remove(this.centerMesh),this.remove(this.loadingMesh),this.centerMesh.material.dispose()},i}(e.Object3D),Yn=function(e){return 2*e-e*e*e},Zn=new Float32Array([-.13,0,-.13,.13,0,-.13,-.13,0,.13,.13,0,.13]),Jn=new Float32Array([0,1,1,1,0,0,1,0]),$n=new Uint8Array([0,2,1,2,3,1]),eo=new e.BufferGeometry;eo.setAttribute("position",new e.BufferAttribute(Zn,3)),eo.setAttribute("uv",new e.BufferAttribute(Jn,2)),eo.setIndex(new e.BufferAttribute($n,1));var to,io,ro,no=(to=Rn(),io=new e.Texture,ro=256,128,to.onload=function(){if("undefined"!=typeof document){var e=document.createElement("canvas");e.setAttribute("width",String(ro)),e.setAttribute("height",String(ro));var t=e.getContext("2d");t&&(t.save(),t.drawImage(to,0,0,ro,ro),t.globalCompositeOperation="source-out",t.beginPath(),t.arc(128,128,84.48,0,2*Math.PI),t.lineWidth=29.952,t.strokeStyle="rgba(255, 255, 255, 0.5)",t.stroke(),t.restore(),io.image=e,io.needsUpdate=!0)}},to.src=Fn,io),oo=function(){if("undefined"!=typeof document){var t=256,i=199.68,r=document.createElement("canvas");r.setAttribute("width",String(512)),r.setAttribute("height",String(512));var n=r.getContext("2d");if(n){n.save(),n.beginPath(),n.arc(t,t,i,0,2*Math.PI),n.fillStyle="rgba(255, 255, 255, 0.1)",n.fill(),n.beginPath(),n.arc(t,t,i,0,2*Math.PI),n.strokeStyle="rgba(255, 255, 255, 0.5)",n.lineWidth=10.24,n.stroke(),n.restore();var o=new e.CanvasTexture(r);return o.generateMipmaps=!0,o}}return null}(),so=function(){if("undefined"!=typeof document){var t=256,i=128,r=document.createElement("canvas");r.setAttribute("width",String(512)),r.setAttribute("height",String(512));var n=r.getContext("2d");if(n){n.save(),n.beginPath(),n.arc(t,t,i,0,2*Math.PI);var o=n.createLinearGradient(t-Math.cos(Math.PI/4)*i,t-Math.sin(Math.PI/4)*i,t+Math.cos(Math.PI/4)*i,t+Math.sin(Math.PI/4)*i);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)"),n.strokeStyle=o,n.lineWidth=40.96,n.shadowBlur=25.6,n.shadowColor="rgba(0, 0, 0, 0.1)",n.stroke(),n.restore();var s=new e.CanvasTexture(r);return s.generateMipmaps=!0,s}}return null}(),ao=function(){if("undefined"!=typeof document){var t=256,i=199.68,r=document.createElement("canvas");r.setAttribute("width",String(512)),r.setAttribute("height",String(512));var n=r.getContext("2d");if(n){n.save(),n.beginPath(),n.arc(t,t,i,0,2*Math.PI);var o=n.createLinearGradient(t+Math.cos(Math.PI/4)*i,t-Math.sin(Math.PI/4)*i,t-Math.cos(Math.PI/4)*i,t+Math.sin(Math.PI/4)*i);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)"),n.strokeStyle=o,n.lineWidth=15.36,n.shadowBlur=25.6,n.shadowColor="rgba(0, 0, 0, 0.2)",n.stroke(),n.restore();var s=new e.CanvasTexture(r);return s.generateMipmaps=!0,s}}return null}(),lo=function(){if("undefined"!=typeof document){var t=256,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(t,t,153.6,0,2*Math.PI);var n=r.createRadialGradient(t,t,153.6,t,t,0);n.addColorStop(0,"rgba(255, 255, 255, 0.9)"),n.addColorStop(.3,"rgba(255, 255, 255, 0.0)"),r.fillStyle=n,r.fill(),r.restore();var o=new e.CanvasTexture(i);return o.generateMipmaps=!0,o}}return null}(),uo=function(e,t){e.save(),e.clearRect(0,0,256,256),e.beginPath(),e.arc(128,128,88.32,0,2*Math.PI*t),e.lineWidth=30.72,e.strokeStyle="rgba(255, 255, 255, 0.4)",e.stroke(),e.restore()},co=function(){if("undefined"!=typeof document){var t=document.createElement("canvas");t.setAttribute("width",String(256)),t.setAttribute("height",String(256));var i=t.getContext("2d");i&&uo(i,2*Math.PI);var r=new e.CanvasTexture(t);return Object.assign(r,{setProgress:function(e){i&&(uo(i,e),r.needsUpdate=!0)}})}return null},ho=[],po=co(),fo=function(t){function i(){var i=t.call(this)||this;i.progress=0,i.opacity=0,i.loading=!1,i.current=!1,i.disabled=!1,i.currentMotion=new On({progress:0}),i.ringMotion=new On({scale:1,opacity:1}),i.tapMotion=new On({scale:1,opacity:1}),i.progressMotion=new On({progress:0}),i.progressOpacityMotion=new On({opacity:0}),i.opacityMotion=new On({opacity:0});var r={blending:e.CustomBlending,blendSrc:e.SrcAlphaFactor,blendDst:e.OneMinusSrcAlphaFactor,blendSrcAlpha:e.OneFactor,blendDstAlpha:e.OneMinusSrcAlphaFactor,depthWrite:!1};return i.centerMesh=new e.Mesh(eo,new e.MeshBasicMaterial(Fe(Fe({},r),{map:so,opacity:0}))),i.ringMesh=new e.Mesh(eo,new e.MeshBasicMaterial(Fe(Fe({},r),{map:ao,opacity:0}))),i.loadingMesh=new e.Mesh(eo,new e.MeshBasicMaterial(Fe(Fe({},r),{map:no,opacity:.5}))),i.disableMesh=new e.Mesh(eo,new e.MeshBasicMaterial(Fe(Fe({},r),{map:oo,opacity:0}))),i.progressMesh=new e.Mesh(eo,new e.MeshBasicMaterial(Fe(Fe({},r),{map:po,opacity:0}))),i.expandMesh=new e.Mesh(eo,new e.MeshBasicMaterial(Fe(Fe({},r),{map:lo,opacity:0}))),i.expandMesh2=new e.Mesh(eo,new e.MeshBasicMaterial(Fe(Fe({},r),{map:lo,opacity:0}))),i.loadingMesh.visible=!1,i.disableMesh.visible=!1,i.ringMesh.position.y=.003,i.disableMesh.position.y=.003,i.centerMesh.position.y=.004,i.loadingMesh.position.y=.003,i.progressMesh.position.y=.003,i.expandMesh.position.y=.002,i.expandMesh2.position.y=.002,i.centerMesh.frustumCulled=!1,i.ringMesh.frustumCulled=!1,i.progressMesh.frustumCulled=!1,i.loadingMesh.frustumCulled=!1,i.disableMesh.frustumCulled=!1,i.expandMesh.frustumCulled=!1,i.expandMesh2.frustumCulled=!1,i.container=new e.Group,i.renderOrder=-2,i.container.renderOrder=-2,i.container.add(i.centerMesh),i.container.add(i.ringMesh),i.container.add(i.progressMesh),i.container.add(i.loadingMesh),i.container.add(i.disableMesh),i.add(i.container),i.add(i.expandMesh),i.add(i.expandMesh2),i.currentStartTime=je(),i.needsRender=!0,i}return Oe(i,t),i.prototype.setProgress=function(e){this.setDisabled(!1),this.setLoading(!1),this.progress!==e&&(e=gn(e,0,1),this.tapMotion.ended&&(0===this.progress&&this.progressOpacityMotion.set({opacity:1},300).catch(Ue),0===e?(this.progressOpacityMotion.set({opacity:0},300).catch(Ue),this.progressMotion.set({progress:gn(1.2*e,0,1)},0).catch(Ue)):this.progressMotion.set({progress:gn(1.2*e,0,1)},100).catch(Ue)),this.progress=e)},i.prototype.setOpacity=function(e){this.opacity!==e&&(this.opacity=e=gn(e,0,1),this.opacityMotion.set({opacity:e},500).catch(Ue))},i.prototype.setCurrent=function(e){this.current!==e&&(this.currentMotion.set({progress:e?1:0},1e3).catch(Ue),this.current=e,!0===this.current&&(this.currentStartTime=je()))},i.prototype.setLoading=function(e){this.loading!==e&&(this.loading=e,!0===this.disabled&&this.setDisabled(!1),this.loadingMesh.visible=e,this.needsRender=!0)},i.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)},i.prototype.tap=function(){var e=this;return this.tapMotion.ended?(this.progressOpacityMotion.set({opacity:0},0).catch(Ue),this.progressMotion.set({progress:0},0).catch(Ue),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(Ue),e.progressMotion.set({progress:e.progress},120).catch(Ue)})).catch(Ue)):Promise.resolve()},i.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!==po&&(ho.push(this.progressMesh.material.map),this.progressMesh.material.map=po);else if(1===r)this.progressMesh.material.map!==po&&(ho.push(this.progressMesh.material.map),this.progressMesh.material.map=po);else{if(this.progressMesh.material.map===po){var n=ho.pop()||co();this.progressMesh.material.map=n}null===(i=this.progressMesh.material.map)||void 0===i||i.setProgress(r)}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-Yn(s))/4*this.currentMotion.progress*this.opacityMotion.value.opacity,s=(e-480)/2e3%1,this.expandMesh2.material.opacity=(1-Yn(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(Ue):1!==this.ringMotion.getTargetKeyframe().value.scale&&this.ringMotion.set({scale:1,opacity:1},500).catch(Ue)}else 1!==this.ringMotion.getTargetKeyframe().value.scale&&this.ringMotion.set({scale:1,opacity:1},500).catch(Ue);if(this.current||!this.currentMotion.ended){this.currentMotion.update(e);var c=(e-this.currentStartTime)/2e3;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;Math.ceil(h)%5<3&&(a=1+.8*Yn(s=h%1)*this.currentMotion.value.progress,this.expandMesh.scale.set(a,1,a),this.expandMesh.material.opacity=(1-Yn(s))*this.currentMotion.value.progress*this.opacityMotion.value.opacity,this.needsRender=!0);var d=(e-this.currentStartTime-500)/2e3;Math.ceil(d)%5<3&&(a=1+.8*Yn(s=d%1)*this.currentMotion.value.progress,this.expandMesh2.scale.set(a,1,a),this.expandMesh2.material.opacity=(1-Yn(s))/2*this.currentMotion.value.progress*this.opacityMotion.value.opacity,this.needsRender=!0)}},i.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!==po&&(ho.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()},i}(e.Object3D),Ao=new Float32Array([-.13,0,-.13,.13,0,-.13,-.13,0,.13,.13,0,.13]),go=new Float32Array([0,1,1,1,0,0,1,0]),mo=new Uint8Array([0,2,1,2,3,1]),vo=new e.BufferGeometry;vo.setAttribute("position",new e.BufferAttribute(Ao,3)),vo.setAttribute("uv",new e.BufferAttribute(go,2)),vo.setIndex(new e.BufferAttribute(mo,1));var yo=function(){var t=Rn(),i=new e.Texture;return t.onload=function(){if("undefined"!=typeof document){var e=256,r=document.createElement("canvas");r.setAttribute("width",String(e)),r.setAttribute("height",String(e));var n=r.getContext("2d");if(n){n.drawImage(t,0,0,e,e),n.globalCompositeOperation="source-out";n.beginPath(),n.lineWidth=29.952,n.arc(128,128,84.48,0,2*Math.PI),n.strokeStyle="rgba(255, 255, 255, 0.5)",n.closePath(),n.stroke(),i.image=r,i.needsUpdate=!0}}},t.src=Fn,i}(),bo=function(){if("undefined"!=typeof document){var t=document.createElement("canvas");t.setAttribute("width",String(512)),t.setAttribute("height",String(512));var i=t.getContext("2d");if(i){var r=256,n=199.68;return i.beginPath(),i.arc(r,r,n,0,2*Math.PI),i.fillStyle="rgba(255, 255, 255, 0.1)",i.closePath(),i.fill(),i.save(),i.beginPath(),i.arc(r,r,n,0,2*Math.PI),i.strokeStyle="rgba(255, 255, 255, 0.5)",i.lineWidth=10.24,i.closePath(),i.stroke(),new e.CanvasTexture(t)}}return null}(),xo=function(){if("undefined"!=typeof document){var t=document.createElement("canvas");t.setAttribute("width",String(512)),t.setAttribute("height",String(512));var i=t.getContext("2d");if(i)return i.beginPath(),i.arc(256,256,199.68,0,2*Math.PI),i.fillStyle="rgba(0, 0, 0, 0.2)",i.closePath(),i.fill(),new e.CanvasTexture(t)}return null}(),wo=function(){if("undefined"!=typeof document){var t=document.createElement("canvas");t.setAttribute("width",String(512)),t.setAttribute("height",String(512));var i=t.getContext("2d");if(i){var r=256,n=138.24,o=i.createLinearGradient(r-Math.cos(Math.PI/4)*n,r-Math.sin(Math.PI/4)*n,r+Math.cos(Math.PI/4)*n,r+Math.sin(Math.PI/4)*n);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)"),i.beginPath(),i.lineWidth=33.28,i.arc(r,r,n,0,2*Math.PI),i.strokeStyle=o,i.shadowBlur=38.4,i.shadowColor="rgba(0, 0, 0, 0.3)",i.closePath(),i.stroke(),new e.CanvasTexture(t)}}return null}(),Mo=function(){if("undefined"!=typeof document){var t=document.createElement("canvas");t.setAttribute("width",String(512)),t.setAttribute("height",String(512));var i=t.getContext("2d");if(i){var r=256,n=199.68,o=i.createLinearGradient(r+Math.cos(Math.PI/4)*n,r-Math.sin(Math.PI/4)*n,r-Math.cos(Math.PI/4)*n,r+Math.sin(Math.PI/4)*n);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)"),i.beginPath(),i.lineWidth=15.36,i.arc(r,r,n,0,2*Math.PI),i.strokeStyle=o,i.shadowBlur=25.6,i.shadowColor="rgba(0, 0, 0, 0.5)",i.closePath(),i.stroke(),new e.CanvasTexture(t)}}return null}(),Eo=function(e,t){e.clearRect(0,0,256,256),e.beginPath(),e.lineWidth=29.44,e.arc(128,128,84.48,0,2*Math.PI*t),e.strokeStyle="rgba(255, 255, 255, 0.2)",e.stroke()},So=function(){if("undefined"!=typeof document){var t=document.createElement("canvas");t.setAttribute("width",String(256)),t.setAttribute("height",String(256));var i=t.getContext("2d");i&&Eo(i,2*Math.PI);var r=new e.CanvasTexture(t);return Object.assign(r,{setProgress:function(e){i&&(Eo(i,e),r.needsUpdate=!0)}})}return null},Co=[],Io=So(),Bo=function(t){function i(){var i=t.call(this)||this;i.progress=0,i.opacity=0,i.loading=!1,i.current=!1,i.disabled=!1,i.ringRotateMotion=new On({angle:0}),i.tapMotion=new On({scale:1,opacity:1}),i.progressMotion=new On({progress:0}),i.progressOpacityMotion=new On({opacity:0}),i.opacityMotion=new On({opacity:0});var r={blending:e.CustomBlending,blendSrc:e.SrcAlphaFactor,blendDst:e.OneMinusSrcAlphaFactor,blendSrcAlpha:e.OneFactor,blendDstAlpha:e.OneMinusSrcAlphaFactor,depthWrite:!1};return i.backgroundMesh=new e.Mesh(vo,new e.MeshBasicMaterial(Fe(Fe({},r),{map:xo,opacity:1}))),i.centerMesh=new e.Mesh(vo,new e.MeshBasicMaterial(Fe(Fe({},r),{map:wo,opacity:0}))),i.ringMesh=new e.Mesh(vo,new e.MeshBasicMaterial(Fe(Fe({},r),{map:Mo,opacity:0}))),i.loadingMesh=new e.Mesh(vo,new e.MeshBasicMaterial(Fe(Fe({},r),{map:yo,opacity:.5}))),i.disableMesh=new e.Mesh(vo,new e.MeshBasicMaterial(Fe(Fe({},r),{map:bo,opacity:0}))),i.progressMesh=new e.Mesh(vo,new e.MeshBasicMaterial(Fe(Fe({},r),{map:Io,opacity:0}))),i.loadingMesh.visible=!1,i.disableMesh.visible=!1,i.backgroundMesh.position.y=.0018,i.ringMesh.position.y=.003,i.disableMesh.position.y=.002,i.centerMesh.position.y=.002,i.loadingMesh.position.y=.005,i.progressMesh.position.y=.004,i.centerMesh.frustumCulled=!1,i.ringMesh.frustumCulled=!1,i.progressMesh.frustumCulled=!1,i.loadingMesh.frustumCulled=!1,i.disableMesh.frustumCulled=!1,i.container=new e.Group,i.renderOrder=-2,i.container.renderOrder=-2,i.container.add(i.backgroundMesh),i.container.add(i.centerMesh),i.container.add(i.ringMesh),i.container.add(i.progressMesh),i.container.add(i.loadingMesh),i.container.add(i.disableMesh),i.add(i.container),i.needsRender=!0,i}return Oe(i,t),i.prototype.setProgress=function(e){this.setDisabled(!1),this.setLoading(!1),this.progress!==e&&(e=gn(e,0,1),this.tapMotion.ended&&(0===this.progress&&this.progressOpacityMotion.set({opacity:1},300).catch(Ue),0===e?(this.progressOpacityMotion.set({opacity:0},300).catch(Ue),this.progressMotion.set({progress:gn(1.2*e,0,1)},0).catch(Ue)):this.progressMotion.set({progress:gn(1.2*e,0,1)},100).catch(Ue)),this.progress=e)},i.prototype.setOpacity=function(e){this.opacity!==e&&(this.opacity=e=gn(e,0,1),this.opacityMotion.set({opacity:e},500).catch(Ue))},i.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(Ue)}this.current=e}},i.prototype.setLoading=function(e){this.loading!==e&&(this.loading=e,!0===this.disabled&&this.setDisabled(!1),this.loadingMesh.visible=e,this.needsRender=!0)},i.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)},i.prototype.tap=function(){var e=this;return this.tapMotion.ended?(this.progressOpacityMotion.set({opacity:0},0).catch(Ue),this.progressMotion.set({progress:0},0).catch(Ue),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(Ue),e.progressMotion.set({progress:e.progress},120).catch(Ue)})).catch(Ue)):Promise.resolve()},i.prototype.updateTime=function(t,i){var r;if(!this.progressMotion.ended){this.progressMotion.update(t);var n=this.progressMotion.value.progress;if(null!==this.progressMesh.material.map)if(0===n)this.progressMesh.material.map!==Io&&(Co.push(this.progressMesh.material.map),this.progressMesh.material.map=Io);else if(1===n)this.progressMesh.material.map!==Io&&(Co.push(this.progressMesh.material.map),this.progressMesh.material.map=Io);else{if(this.progressMesh.material.map===Io){var o=Co.pop()||So();this.progressMesh.material.map=o}null===(r=this.progressMesh.material.map)||void 0===r||r.setProgress(n)}this.needsRender=!0}if(!this.progressOpacityMotion.ended){this.progressOpacityMotion.update(t);var s=this.progressOpacityMotion.value.opacity;this.progressMesh.material.opacity=s,this.needsRender=!0}if(this.opacityMotion.ended||(this.opacityMotion.update(t),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),!0===this.loadingMesh.visible&&(this.loadingMesh.rotateY(-i/120),this.needsRender=!0),!this.tapMotion.ended){this.tapMotion.update(t);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(t),this.ringMesh.quaternion.setFromEuler(new e.Euler(0,this.ringRotateMotion.value.angle,0)),this.needsRender=!0)},i.prototype.dispose=function(){this.ringRotateMotion.dispose(),this.tapMotion.dispose(),this.progressMotion.dispose(),this.progressOpacityMotion.dispose(),this.opacityMotion.dispose(),this.progressMesh.material.map!==Io&&(Co.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()},i}(e.Object3D),To=function(e){return 2*e-e*e*e},Po=new Float32Array([-.13,0,-.13,.13,0,-.13,-.13,0,.13,.13,0,.13]),Ro=new Float32Array([0,1,1,1,0,0,1,0]),Do=new Uint8Array([0,2,1,2,3,1]),ko=new e.BufferGeometry;ko.setAttribute("position",new e.BufferAttribute(Po,3)),ko.setAttribute("uv",new e.BufferAttribute(Ro,2)),ko.setIndex(new e.BufferAttribute(Do,1));var Lo=function(){var t=Rn(),i=new e.Texture,r=256;return t.onload=function(){if("undefined"!=typeof document){var e=document.createElement("canvas");e.setAttribute("width",String(r)),e.setAttribute("height",String(r));var n=e.getContext("2d");n&&(n.save(),n.clearRect(0,0,r,r),n.drawImage(t,0,0,r,r),n.globalCompositeOperation="source-out",n.beginPath(),n.lineWidth=29.44,n.arc(128,128,84.48,0,2*Math.PI),n.strokeStyle="rgba(255, 255, 255, 0.7)",n.stroke(),n.restore(),i.image=e,i.needsUpdate=!0)}},t.src=Fn,i}(),Oo=function(){if("undefined"!=typeof document){var t=256,i=199.68,r=document.createElement("canvas");r.setAttribute("width",String(512)),r.setAttribute("height",String(512));var n=r.getContext("2d");if(n)return n.save(),n.beginPath(),n.arc(t,t,i,0,2*Math.PI),n.fillStyle="rgba(255, 255, 255, 0.1)",n.fill(),n.beginPath(),n.arc(t,t,i,0,2*Math.PI),n.strokeStyle="rgba(255, 255, 255, 0.5)",n.lineWidth=10.24,n.stroke(),n.restore(),new e.CanvasTexture(r)}return null}(),Fo=function(){if("undefined"!=typeof document){var 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(128,128,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 e.CanvasTexture(t)}return null}(),No=function(){if("undefined"!=typeof document){var t=256,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(t,t,204.8,0,2*Math.PI);var n=r.createRadialGradient(t,t,204.8,t,t,0);n.addColorStop(0,"rgba(255, 255, 255, 0.9)"),n.addColorStop(.3,"rgba(255, 255, 255, 0.0)"),r.fillStyle=n,r.fill(),r.restore();var o=new e.CanvasTexture(i);return o.generateMipmaps=!0,o}}return null}(),Vo=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()},Qo=function(){if("undefined"!=typeof document){var t=document.createElement("canvas");t.setAttribute("width",String(256)),t.setAttribute("height",String(256));var i=t.getContext("2d");i&&Vo(i,2*Math.PI);var r=new e.CanvasTexture(t);return Object.assign(r,{setProgress:function(e){i&&(Vo(i,e),r.needsUpdate=!0)}})}return null},Ho=[],qo=Qo(),Uo=function(t){function i(){var i=t.call(this)||this;i.progress=0,i.opacity=0,i.loading=!1,i.current=!1,i.disabled=!1,i.currentMotion=new On({progress:0}),i.tapMotion=new On({scale:1,opacity:1}),i.progressMotion=new On({progress:0}),i.progressOpacityMotion=new On({opacity:0}),i.opacityMotion=new On({opacity:0});var r={blending:e.CustomBlending,blendSrc:e.SrcAlphaFactor,blendDst:e.OneMinusSrcAlphaFactor,blendSrcAlpha:e.OneFactor,blendDstAlpha:e.OneMinusSrcAlphaFactor,depthWrite:!1};return i.centerMesh=new e.Mesh(ko,new e.MeshBasicMaterial(Fe(Fe({},r),{map:Fo,opacity:0}))),i.loadingMesh=new e.Mesh(ko,new e.MeshBasicMaterial(Fe(Fe({},r),{map:Lo,opacity:.5}))),i.disableMesh=new e.Mesh(ko,new e.MeshBasicMaterial(Fe(Fe({},r),{map:Oo,opacity:0}))),i.progressMesh=new e.Mesh(ko,new e.MeshBasicMaterial(Fe(Fe({},r),{map:qo,opacity:0}))),i.expandMesh=new e.Mesh(ko,new e.MeshBasicMaterial(Fe(Fe({},r),{map:No,opacity:0}))),i.expandMesh2=new e.Mesh(ko,new e.MeshBasicMaterial(Fe(Fe({},r),{map:No,opacity:0}))),i.loadingMesh.visible=!1,i.disableMesh.visible=!1,i.disableMesh.position.y=.003,i.centerMesh.position.y=.003,i.loadingMesh.position.y=.005,i.progressMesh.position.y=.004,i.expandMesh.position.y=.002,i.expandMesh2.position.y=.002,i.centerMesh.frustumCulled=!1,i.progressMesh.frustumCulled=!1,i.loadingMesh.frustumCulled=!1,i.disableMesh.frustumCulled=!1,i.expandMesh.frustumCulled=!1,i.expandMesh2.frustumCulled=!1,i.container=new e.Group,i.renderOrder=-2,i.container.renderOrder=-2,i.container.add(i.centerMesh),i.container.add(i.progressMesh),i.container.add(i.loadingMesh),i.container.add(i.disableMesh),i.add(i.container),i.add(i.expandMesh),i.add(i.expandMesh2),i.currentStartTime=je(),i.needsRender=!0,i}return Oe(i,t),i.prototype.setProgress=function(e){this.setDisabled(!1),this.setLoading(!1),this.progress!==e&&(e=gn(e,0,1),this.tapMotion.ended&&(0===this.progress&&this.progressOpacityMotion.set({opacity:1},300).catch(Ue),0===e?(this.progressOpacityMotion.set({opacity:0},300).catch(Ue),this.progressMotion.set({progress:gn(1.2*e,0,1)},0).catch(Ue)):this.progressMotion.set({progress:gn(1.2*e,0,1)},100).catch(Ue)),this.progress=e)},i.prototype.setOpacity=function(e){e>0&&(e=1),this.opacity!==e&&(this.opacity=e=gn(e,0,1),this.opacityMotion.set({opacity:e},500).catch(Ue))},i.prototype.setCurrent=function(e){this.current!==e&&(this.currentMotion.set({progress:e?1:0},1e3).catch(Ue),this.current=e,!0===this.current&&(this.currentStartTime=je()))},i.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(Ue),this.needsRender=!0)},i.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)},i.prototype.tap=function(){var e=this;return this.tapMotion.ended?(this.progressOpacityMotion.set({opacity:0},0).catch(Ue),this.progressMotion.set({progress:0},0).catch(Ue),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(Ue),e.progressMotion.set({progress:e.progress},120).catch(Ue)})).catch(Ue)):Promise.resolve()},i.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!==qo&&(Ho.push(this.progressMesh.material.map),this.progressMesh.material.map=qo);else if(1===r)this.progressMesh.material.map!==qo&&(Ho.push(this.progressMesh.material.map),this.progressMesh.material.map=qo);else{if(this.progressMesh.material.map===qo){var n=Ho.pop()||Qo();this.progressMesh.material.map=n}null===(i=this.progressMesh.material.map)||void 0===i||i.setProgress(r)}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;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;Math.ceil(l)%5<3&&(s=1+.8*To(u=l%1)*this.currentMotion.value.progress,this.expandMesh.scale.set(s,1,s),this.expandMesh.material.opacity=(1-To(u))*this.currentMotion.value.progress*this.opacityMotion.value.opacity,this.needsRender=!0);var u,c=(e-this.currentStartTime-500)/2e3;if(Math.ceil(c)%5<3)s=1+.8*To(u=c%1)*this.currentMotion.value.progress,this.expandMesh2.scale.set(s,1,s),this.expandMesh2.material.opacity=(1-To(u))/2*this.currentMotion.value.progress*this.opacityMotion.value.opacity,this.needsRender=!0}},i.prototype.dispose=function(){this.currentMotion.dispose(),this.tapMotion.dispose(),this.progressMotion.dispose(),this.progressOpacityMotion.dispose(),this.opacityMotion.dispose(),this.progressMesh.material.map!==qo&&(Ho.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()},i}(e.Object3D),zo=new e.CircleBufferGeometry(.1,16),jo=function(){if("undefined"!=typeof document){var t=document.createElement("canvas");t.setAttribute("width",String(512)),t.setAttribute("height",String(512));var i=t.getContext("2d");if(i){var r=256;i.lineWidth=76.8,i.arc(r,r,192,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=76.8,i.arc(r,r,192,0,2*Math.PI);var n=i.createRadialGradient(r,r,153.6,r,r,230.4);n.addColorStop(0,"rgba(255, 255, 255, 0.3)"),n.addColorStop(.3,"rgba(255, 255, 255, 0.0)"),n.addColorStop(.7,"rgba(255, 255, 255, 0.0)"),n.addColorStop(1,"rgba(255, 255, 255, 0.3)"),i.strokeStyle=n,i.stroke(),i.beginPath(),i.lineWidth=4.8,i.arc(r,r,228,0,2*Math.PI);var o=i.createLinearGradient(0,0,512,0);return o.addColorStop(.02,"rgba(255, 255, 255, 1.0)"),o.addColorStop(.08,"rgba(255, 255, 255, 0.0)"),o.addColorStop(.92,"rgba(255, 255, 255, 0.0)"),o.addColorStop(.98,"rgba(255, 255, 255, 1.0)"),i.strokeStyle=o,i.stroke(),new e.CanvasTexture(t)}}return null}(),_o=new e.MeshBasicMaterial({map:jo,transparent:!0}),Ko=function(t){function i(){var i=t.call(this)||this;return i.ringMesh=new e.Mesh(zo,_o),i.ringMesh.renderOrder=-3,i.add(i.ringMesh),i}return Oe(i,t),i.prototype.dispose=function(){this.remove(this.ringMesh)},i}(e.Object3D);function Go(e,t,i){var r=Math.abs(e-t);return r<.001||void 0!==i&&Math.abs(i-r)<.001}function Wo(e,t,i){return!Go(e,t,i)}function Xo(e,t){return e.distanceTo(t)<.001}function Yo(e,t){return!Xo(e,t)}var Zo=new e.Vector3(0,0,0),Jo=function(t){function i(i,r){void 0===r&&(r=Zo);var n=t.call(this)||this,o=new e.BoxBufferGeometry(i.max.x-i.min.x+2*r.x,i.max.y-i.min.y+2*r.y,i.max.z-i.min.z+2*r.z,1,1);o.groups.length=0,o.groups.push({start:0,count:36,materialIndex:0}),o.applyMatrix4((new e.Matrix4).makeScale(-1,1,1)),o.computeVertexNormals();var s=new pi;s.defines.USE_MAP=!1,s.defines.USE_UV=!1,s.uniforms.diffuse.value=new e.Color(16777215);var a=new Et(o,[s]);return a.floorIndex=-1,a.position.copy(i.getCenter(new e.Vector3)),a.frustumCulled=!1,n.renderOrder=-3,n.add(a),n.boundingBox=new e.Box3,n.computeBoundingBox(),n}return Oe(i,t),i.prototype.computeBoundingBox=function(){this.boundingBox.setFromObject(this)},i.prototype.dispose=function(){this.disposeMaterial(),this.disposeGeometry()},i}(Ct);function $o(e,t){return void 0===t&&(t=Zo),new Jo(e,t)}function es(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 ts=2*Math.PI;function is(e){return e>=0&&e<ts?e:(e%ts+ts)%ts}var rs=Math.PI,ns=2*rs;function os(e,t,i){if(e===t)return t;var r=t-e;return Math.abs(r)<=i?t:e+(r>0?1:-1)*i}(function(){try{var e=document.createElement("canvas");!window.WebGLRenderingContext||!e.getContext("webgl")&&e.getContext("experimental-webgl")}catch(e){return!1}})(),"undefined"!=typeof history&&"pushState"in history&&"replaceState"in history&&history;var ss=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 as(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 ls(e,t){return e.panoIndex===t.panoIndex&&e.mode===t.mode&&Go(e.longitude,t.longitude,2*Math.PI)&&Go(e.latitude,t.latitude)&&Go(e.fov,t.fov)&&Xo(e.offset,t.offset)}var us=function(e){return Number(e)};function cs(e,t,i){var r;void 0===t&&(t=us),void 0===i&&(i=!1);for(var n,o=1/0,s=0,a=e;s<a.length;s++){var l=a[s],u=t(l);u<=o&&(n=(r=[l,u])[0],o=r[1])}return isFinite(o)&&(o=0),i?[n,o]:n}function hs(e){for(var t in e)return!1;return!0}function ds(e){return{longitude:e.longitude,latitude:e.latitude,fov:e.fov,offset:e.offset.clone(),distance:e.distance}}var ps=function(e,t,i,r){var n,o=["","webkit","Moz","MS","ms","o"],s=t.createElement?t.createElement("div"):r,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 n;if(e)if(e.forEach)e.forEach(t,i);else if(e.length!==r)for(n=0;n<e.length;)t.call(i,e[n],n,e),n++;else for(n in e)e.hasOwnProperty(n)&&t.call(i,e[n],n,e)}function p(t,i,r){var n="DEPRECATED METHOD: "+i+"\n"+r+" AT \n";return function(){var i=new Error("get-stack-trace"),r=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,n,r),t.apply(this,arguments)}}n="function"!=typeof Object.assign?function(e){if(e===r||null===e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),i=1;i<arguments.length;i++){var n=arguments[i];if(n!==r&&null!==n)for(var o in n)n.hasOwnProperty(o)&&(t[o]=n[o])}return t}:Object.assign;var f=p((function(e,t,i){for(var n=Object.keys(t),o=0;o<n.length;)(!i||i&&e[n[o]]===r)&&(e[n[o]]=t[n[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 r,o=t.prototype;(r=e.prototype=Object.create(o)).constructor=e,r._super=o,i&&n(r,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]||r,t):e}function y(e,t){return e===r?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 r=0;r<e.length;){if(i&&e[r][i]==t||!i&&e[r]===t)return r;r++}return-1}function C(e){return Array.prototype.slice.call(e,0)}function I(e,t,i){for(var r=[],n=[],o=0;o<e.length;){var s=t?e[o][t]:e[o];S(n,s)<0&&r.push(e[o]),n[o]=s,o++}return i&&(r=t?r.sort((function(e,i){return e[t]>i[t]})):r.sort()),r}function B(e,t){for(var i,n,s=t[0].toUpperCase()+t.slice(1),a=0;a<o.length;){if((n=(i=o[a])?i+s:t)in e)return n;a++}return r}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")!==r,k=R&&/mobile|tablet|ip(ad|hone|od)|android/i.test(navigator.userAgent),L="touch",O="mouse",F=["x","y"],N=["clientX","clientY"];function V(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 Q(e,t,i){var n=i.pointers.length,o=i.changedPointers.length,s=1&t&&n-o==0,a=12&t&&n-o==0;i.isFirst=!!s,i.isFinal=!!a,s&&(e.session={}),i.eventType=t,function(e,t){var i=e.session,n=t.pointers,o=n.length;i.firstInput||(i.firstInput=H(t)),o>1&&!i.firstMultiple?i.firstMultiple=H(t):1===o&&(i.firstMultiple=!1);var s=i.firstInput,a=i.firstMultiple,c=a?a.center:s.center,h=t.center=q(n);t.timeStamp=u(),t.deltaTime=t.timeStamp-s.timeStamp,t.angle=_(c,h),t.distance=j(c,h),function(e,t){var i=t.center,r=e.offsetDelta||{},n=e.prevDelta||{},o=e.prevInput||{};1!==t.eventType&&4!==o.eventType||(n=e.prevDelta={x:o.deltaX||0,y:o.deltaY||0},r=e.offsetDelta={x:i.x,y:i.y}),t.deltaX=n.x+(i.x-r.x),t.deltaY=n.y+(i.y-r.y)}(i,t),t.offsetDirection=z(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 j(t[0],t[1],N)/j(e[0],e[1],N)}(a.pointers,n):1,t.rotation=a?function(e,t){return _(t[1],t[0],N)+_(e[1],e[0],N)}(a.pointers,n):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,n,o,s,a=e.lastInterval||t,u=t.timeStamp-a.timeStamp;if(8!=t.eventType&&(u>25||a.velocity===r)){var c=t.deltaX-a.deltaX,h=t.deltaY-a.deltaY,d=U(u,c,h);n=d.x,o=d.y,i=l(d.x)>l(d.y)?d.x:d.y,s=z(c,h),e.lastInterval=t}else i=a.velocity,n=a.velocityX,o=a.velocityY,s=a.direction;t.velocity=i,t.velocityX=n,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 H(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:q(t),deltaX:e.deltaX,deltaY:e.deltaY}}function q(e){var t=e.length;if(1===t)return{x:a(e[0].clientX),y:a(e[0].clientY)};for(var i=0,r=0,n=0;n<t;)i+=e[n].clientX,r+=e[n].clientY,n++;return{x:a(i/t),y:a(r/t)}}function U(e,t,i){return{x:t/e||0,y:i/e||0}}function z(e,t){return e===t?1:l(e)>=l(t)?e<0?2:4:t<0?8:16}function j(e,t,i){i||(i=F);var r=t[i[0]]-e[i[0]],n=t[i[1]]-e[i[1]];return Math.sqrt(r*r+n*n)}function _(e,t,i){i||(i=F);var r=t[i[0]]-e[i[0]],n=t[i[1]]-e[i[1]];return 180*Math.atan2(n,r)/Math.PI}V.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 K={mousedown:1,mousemove:2,mouseup:4},G="mousedown",W="mousemove mouseup";function X(){this.evEl=G,this.evWin=W,this.pressed=!1,V.apply(this,arguments)}g(X,V,{handler:function(e){var t=K[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 Y={pointerdown:1,pointermove:2,pointerup:4,pointercancel:8,pointerout:8},Z={2:L,3:"pen",4:O,5:"kinect"},J="pointerdown",$="pointermove pointerup pointercancel";function ee(){this.evEl=J,this.evWin=$,V.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}e.MSPointerEvent&&!e.PointerEvent&&(J="MSPointerDown",$="MSPointerMove MSPointerUp MSPointerCancel"),g(ee,V,{handler:function(e){var t=this.store,i=!1,r=!1,n=e.type.toLowerCase().replace("ms",""),o=Y[n],s=Z[e.pointerType]||e.pointerType,a=s==L,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,r=!0,o=Y.pointerup),l<0||(r||(t[l]=e),this.callback(this.manager,o,{pointers:t,changedPointers:[e],pointerType:s,srcEvent:t[l]}),i&&t.splice(l,1))}});var te={touchstart:1,touchmove:2,touchend:4,touchcancel:8},ie="touchstart",re="touchstart touchmove touchend touchcancel";function ne(){this.evTarget=ie,this.evWin=re,this.started=!1,V.apply(this,arguments)}function oe(e,t){var i=C(e.touches),r=C(e.changedTouches);return 12&t&&(i=I(i.concat(r),"identifier",!0)),[i,r]}g(ne,V,{handler:function(e){var t=te[e.type];if(1===t&&(this.started=!0),this.started){var i=oe.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:L,srcEvent:e})}}});var se={touchstart:1,touchmove:2,touchend:4,touchcancel:8},ae="touchstart touchmove touchend touchcancel";function le(){this.evTarget=ae,this.targetIds={},V.apply(this,arguments)}function ue(e,t){var i=C(e.touches),r=this.targetIds;if(3&t&&1===i.length)return r[i[0].identifier]=!0,[i,i];var n,o,s=C(e.changedTouches),a=[],l=this.target;if(o=i.filter((function(e){return w(e.target,l)})),1===t)for(n=0;n<o.length;)r[o[n].identifier]=!0,n++;for(n=0;n<s.length;)r[s[n].identifier]&&a.push(s[n]),12&t&&delete r[s[n].identifier],n++;return a.length?[I(o.concat(a),"identifier",!0),a]:void 0}function ce(){V.apply(this,arguments);var e=m(this.handler,this);this.touch=new le(this.manager,e),this.mouse=new X(this.manager,e),this.primaryTouch=null,this.lastTouches=[]}function he(e,t){1&e?(this.primaryTouch=t.changedPointers[0].identifier,de.call(this,t)):12&e&&de.call(this,t)}function de(e){var t=e.changedPointers[0];if(t.identifier===this.primaryTouch){var i={x:t.clientX,y:t.clientY};this.lastTouches.push(i);var r=this.lastTouches;setTimeout((function(){var e=r.indexOf(i);e>-1&&r.splice(e,1)}),2500)}}function pe(e){for(var t=e.srcEvent.clientX,i=e.srcEvent.clientY,r=0;r<this.lastTouches.length;r++){var n=this.lastTouches[r],o=Math.abs(t-n.x),s=Math.abs(i-n.y);if(o<=25&&s<=25)return!0}return!1}g(le,V,{handler:function(e){var t=se[e.type],i=ue.call(this,e,t);i&&this.callback(this.manager,t,{pointers:i[0],changedPointers:i[1],pointerType:L,srcEvent:e})}}),g(ce,V,{handler:function(e,t,i){var r=i.pointerType==L,n=i.pointerType==O;if(!(n&&i.sourceCapabilities&&i.sourceCapabilities.firesTouchEvents)){if(r)he.call(this,t,i);else if(n&&pe.call(this,i))return;this.callback(e,t,i)}},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});var fe=s?B(s.style,"touchAction"):r,Ae=fe!==r,ge="compute",me="auto",ve="manipulation",ye="none",be="pan-x",xe="pan-y",we=function(){if(!Ae)return!1;var t={},i=e.CSS&&e.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach((function(r){t[r]=!i||e.CSS.supports("touch-action",r)})),t}();function Me(e,t){this.manager=e,this.set(t)}Me.prototype={set:function(e){e==ge&&(e=this.compute()),Ae&&this.manager.element.style&&we[e]&&(this.manager.element.style[fe]=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,ye))return ye;var t=M(e,be),i=M(e,xe);return t&&i?ye:t||i?t?be:xe:M(e,ve)?ve:me}(e.join(" "))},preventDefaults:function(e){var t=e.srcEvent,i=e.offsetDirection;if(this.manager.session.prevented)t.preventDefault();else{var r=this.actions,n=M(r,ye)&&!we.none,o=M(r,xe)&&!we["pan-y"],s=M(r,be)&&!we["pan-x"];if(n){var a=1===e.pointers.length,l=e.distance<2,u=e.deltaTime<250;if(a&&l&&u)return}if(!s||!o)return n||o&&6&i||s&&24&i?this.preventSrc(t):void 0}},preventSrc:function(e){this.manager.session.prevented=!0,e.preventDefault()}};var Ee=32;function Se(e){this.options=n({},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 Ce(e){return 16&e?"cancel":8&e?"end":4&e?"move":2&e?"start":""}function Ie(e){return 16==e?"down":8==e?"up":2==e?"left":4==e?"right":""}function Be(e,t){var i=t.manager;return i?i.get(e):e}function Te(){Se.apply(this,arguments)}function Pe(){Te.apply(this,arguments),this.pX=null,this.pY=null}function Re(){Te.apply(this,arguments)}function De(){Se.apply(this,arguments),this._timer=null,this._input=null}function ke(){Te.apply(this,arguments)}function Le(){Te.apply(this,arguments)}function Oe(){Se.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}function Fe(e,t){return(t=t||{}).recognizers=y(t.recognizers,Fe.defaults.preset),new Ne(e,t)}function Ne(e,t){this.options=n({},Fe.defaults,t||{}),this.options.inputTarget=this.options.inputTarget||e,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=e,this.input=new(this.options.inputClass||(D?ee:k?le:R?ce:X))(this,Q),this.touchAction=new Me(this,this.options.touchAction),Ve(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 Ve(e,t){var i,r=e.element;r.style&&(d(e.options.cssProps,(function(n,o){i=B(r.style,o),t?(e.oldCssProps[i]=r.style[i],r.style[i]=n):r.style[i]=e.oldCssProps[i]||""})),t||(e.oldCssProps={}))}return Se.prototype={defaults:{},set:function(e){return n(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=Be(e,this)).id]||(t[e.id]=e,e.recognizeWith(this)),this},dropRecognizeWith:function(e){return h(e,"dropRecognizeWith",this)||(e=Be(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=Be(e,this))&&(t.push(e),e.requireFailure(this)),this},dropRequireFailure:function(e){if(h(e,"dropRequireFailure",this))return this;e=Be(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 r(i){t.manager.emit(i,e)}i<8&&r(t.options.event+Ce(i)),r(t.options.event),e.additionalEvent&&r(e.additionalEvent),i>=8&&r(t.options.event+Ce(i))},tryEmit:function(e){if(this.canEmit())return this.emit(e);this.state=Ee},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=n({},e);if(!v(this.options.enable,[this,t]))return this.reset(),void(this.state=Ee);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(Te,Se,{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,r=6&t,n=this.attrTest(e);return r&&(8&i||!n)?16|t:r||n?4&i?8|t:2&t?4|t:2:Ee}}),g(Pe,Te,{defaults:{event:"pan",threshold:10,pointers:1,direction:30},getTouchAction:function(){var e=this.options.direction,t=[];return 6&e&&t.push(xe),24&e&&t.push(be),t},directionTest:function(e){var t=this.options,i=!0,r=e.distance,n=e.direction,o=e.deltaX,s=e.deltaY;return n&t.direction||(6&t.direction?(n=0===o?1:o<0?2:4,i=o!=this.pX,r=Math.abs(e.deltaX)):(n=0===s?1:s<0?8:16,i=s!=this.pY,r=Math.abs(e.deltaY))),e.direction=n,i&&r>t.threshold&&n&t.direction},attrTest:function(e){return Te.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=Ie(e.direction);t&&(e.additionalEvent=this.options.event+t),this._super.emit.call(this,e)}}),g(Re,Te,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[ye]},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(De,Se,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[me]},process:function(e){var t=this.options,i=e.pointers.length===t.pointers,r=e.distance<t.threshold,n=e.deltaTime>t.time;if(this._input=e,!r||!i||12&e.eventType&&!n)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 Ee},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,Te,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[ye]},attrTest:function(e){return this._super.attrTest.call(this,e)&&(Math.abs(e.rotation)>this.options.threshold||2&this.state)}}),g(Le,Te,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:30,pointers:1},getTouchAction:function(){return Pe.prototype.getTouchAction.call(this)},attrTest:function(e){var t,i=this.options.direction;return 30&i?t=e.overallVelocity:6&i?t=e.overallVelocityX:24&i&&(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=Ie(e.offsetDirection);t&&this.manager.emit(this.options.event+t,e),this.manager.emit(this.options.event,e)}}),g(Oe,Se,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[ve]},process:function(e){var t=this.options,i=e.pointers.length===t.pointers,r=e.distance<t.threshold,n=e.deltaTime<t.time;if(this.reset(),1&e.eventType&&0===this.count)return this.failTimeout();if(r&&n&&i){if(4!=e.eventType)return this.failTimeout();var o=!this.pTime||e.timeStamp-this.pTime<t.interval,s=!this.pCenter||j(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 Ee},failTimeout:function(){return this._timer=c((function(){this.state=Ee}),this.options.interval,this),Ee},reset:function(){clearTimeout(this._timer)},emit:function(){8==this.state&&(this._input.tapCount=this.count,this.manager.emit(this.options.event,this._input))}}),Fe.VERSION="2.0.7",Fe.defaults={domEvents:!1,touchAction:ge,enable:!0,inputTarget:null,inputClass:null,preset:[[ke,{enable:!1}],[Re,{enable:!1},["rotate"]],[Le,{direction:6}],[Pe,{direction:6},["swipe"]],[Oe],[Oe,{event:"doubletap",taps:2},["tap"]],[De]],cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}},Ne.prototype={set:function(e){return n(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 r=this.recognizers,n=t.curRecognizer;(!n||n&&8&n.state)&&(n=t.curRecognizer=null);for(var o=0;o<r.length;)i=r[o],2===t.stopped||n&&i!=n&&!i.canRecognizeWith(n)?i.reset():i.recognize(e),!n&&14&i.state&&(n=t.curRecognizer=i),o++}},get:function(e){if(e instanceof Se)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!==r&&t!==r){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!==r){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 r=t.createEvent("Event");r.initEvent(e,!0,!0),r.gesture=i,i.target.dispatchEvent(r)}(e,i);var r=this.handlers[e]&&this.handlers[e].slice();if(r&&r.length){i.type=e,i.preventDefault=function(){i.srcEvent.preventDefault()};for(var n=0;n<r.length;)r[n](i),n++}},destroy:function(){this.element&&Ve(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}},n(Fe,{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:Ee,DIRECTION_NONE:1,DIRECTION_LEFT:2,DIRECTION_RIGHT:4,DIRECTION_UP:8,DIRECTION_DOWN:16,DIRECTION_HORIZONTAL:6,DIRECTION_VERTICAL:24,DIRECTION_ALL:30,Manager:Ne,Input:V,TouchAction:Me,TouchInput:le,MouseInput:X,PointerEventInput:ee,TouchMouseInput:ce,SingleTouchInput:ne,Recognizer:Se,AttrRecognizer:Te,Tap:Oe,Pan:Pe,Swipe:Le,Pinch:Re,Rotate:ke,Press:De,on:b,off:x,each:d,merge:A,extend:f,assign:n,inherit:g,bindFn:m,prefixed:B}),Fe}("undefined"!=typeof window?window:{},"undefined"!=typeof document?document:{});const fs=ps;function As(t,i,r){var n=i.getBoundingClientRect(),o=n.top,s=n.left,a=n.width,l=n.height;return r&&(s+=a*r.left,o+=l*(1-r.bottom-r.height),a*=r.width,l*=r.height),new e.Vector2((t.x-s)/a*2-1,-(t.y-o)/l*2+1)}var gs=new e.OrthographicCamera(-1,1,1,-1,0,1),ms=new e.BufferGeometry;ms.setAttribute("position",new e.Float32BufferAttribute([-1,3,0,-1,-1,0,3,-1,0],3)),ms.setAttribute("uv",new e.Float32BufferAttribute([0,2,0,0,2,0],2));var vs=new e.Mesh(ms),ys=new e.Scene;ys.add(vs);var bs=function(){function t(t,i){var r;this.renderer=t,this.material=new e.ShaderMaterial({vertexShader:null!==(r=i.vertex)&&void 0!==r?r:"\nvarying vec2 vUv;\nvoid main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}\n",fragmentShader:i.fragment,uniforms:Object.assign({inputBuffer:new e.Uniform(null)},i.uniforms),defines:Object.assign({},i.defines),blending:e.NoBlending,depthWrite:!1,depthTest:!1})}return t.prototype.render=function(e,t){var i=this.renderer.getRenderTarget(),r=vs.material;this.material.uniforms.inputBuffer.value=e.texture,vs.material=this.material,this.renderer.setRenderTarget(t||null),this.renderer.render(ys,gs),this.renderer.setRenderTarget(i),vs.material=r},t.prototype.dispose=function(){this.material.dispose()},t}(),xs=function(){function t(t){this.renderer=t,this.material=new e.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 e.Uniform(new e.Vector3)}),blending:e.NoBlending,depthWrite:!1,depthTest:!1})}return t.prototype.render=function(e,t){var i=this.renderer.getRenderTarget(),r=vs.material;this.material.uniforms.inputValue.value.copy(e),vs.material=this.material,this.renderer.setRenderTarget(t||null),this.renderer.render(ys,gs),this.renderer.setRenderTarget(i),vs.material=r},t.prototype.dispose=function(){this.material.dispose()},t}(),ws=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 Oe(t,e),t}(bs),Ms=function(){function e(e){this.enable=!0,this.renderer=e,this.copyPass=new ws(this.renderer)}return e.prototype.render=function(e,t){this.copyPass.render(e,t)},e.prototype.dispose=function(){this.copyPass.dispose()},e}(),Es=function(e){function t(i){var r,n=this;n=e.call(this)||this;var o=t.parseArgs(i);return n.pending=!0,n.userAction=o.initial[3],n.destroyed=!1,n.ident=o.ident,n.scene=o.scene,n.parallaxScene=o.parallaxScene,n.helper=o.helper,n.camera=o.camera,n.renderer=o.renderer,n.scissor=o.scissor,n.element=o.element,n.model=o.model,n.enableIOSEDR=null!==(r=o.enableIOSEDR)&&void 0!==r&&r,n.work=o.work,n.imageOptions=o.imageOptions,n.videoTexture=o.videoTexture,n.networkSubscribe=o.networkSubscribe,n.requestProxy=o.requestProxy,n.needsRender=!0,n.maxFov=120,n.minFov=40,n.maxLatitude=+Math.PI/2,n.minLatitude=-Math.PI/2,n.cameraMotion=new On({longitude:{value:n.camera.pose.longitude,circle:[0,2*Math.PI]},latitude:n.camera.pose.latitude,fov:n.camera.pose.fov}),n.eventUnbinds=[o.element].concat(o.extraElements||[]).map((function(e){return n.bindEvents(e)})),ft.shared.add((function(){return n.initAnimation.apply(n,o.initial)}),!0),n}return Oe(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,r=this.eventUnbinds;i<r.length;i++){var n=r[i];n.element===e?n():t.push(n)}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,r,n){return this.work=e,this.userAction=n,!1},t.prototype.updateTime=function(e,t){for(var i=[],r=2;r<arguments.length;r++)i[r-2]=arguments[r];if(!this.destroyed){var n={};this.cameraMotion.ended&&(this.cameraMotion.update(e),n.longitude=this.cameraMotion.value.longitude,n.latitude=this.cameraMotion.value.latitude,n.fov=this.cameraMotion.value.fov),hs(n)&&this.setCamera(n)}},t.prototype.render=function(){this.renderer.render(this.scene,this.camera)},t.prototype.postProcessing=function(e,t){this.destroyed||(this.copyEffect||(this.copyEffect=new Ms(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(je())[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 r={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,r),this.emit("moveToPano",e,this.userAction),this.emit("panoWillArrive",e,r,this.userAction),this.emit("panoArrived",e,r,this.userAction),t.moveEndCallback&&t.moveEndCallback(e,r)},t.prototype.initAnimation=function(e,t,i,r){this.pending=!1,this.userAction=r},t.prototype.setCamera=function(e){var t,i,r,n,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!==(r=e.fov)&&void 0!==r?r:this.camera.pose.fov,u=null!==(n=e.distance)&&void 0!==n?n:this.camera.pose.distance,c=null!==(o=e.offset)&&void 0!==o?o:this.camera.pose.offset,h=this.camera.position.clone(),d=Wo(s,this.camera.pose.longitude,2*Math.PI)||Wo(a,this.camera.pose.latitude),p=Wo(l,this.camera.pose.fov),f=Wo(u,this.camera.pose.distance),A=Yo(c,this.camera.pose.offset);this.camera.setFromPose({longitude:s,latitude:a,fov:l,distance:u,offset:c});var g=Yo(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 r=e.pointers.map((function(e){return Dt(e,["x","y"])}));this.emit("wantsGesture","pan",r,e.isFinal)||this.emit("gesture","pan",r,e.isFinal)}},t.prototype.onTapGesture=function(e){var t=e.pointers.map((function(e){return Dt(e,["x","y"])}));this.emit("wantsGesture","tap",t,!0)||this.emit("gesture","tap",t,!0)},t.prototype.onPressGesture=function(e,t){var i,r=[e];if(this.emit("wantsGesture","press",r,t))return null===(i=this.pressState)||void 0===i||i.stop(),void delete this.pressState;this.emit("gesture","press",r,t)},t.prototype.onPinchGesture=function(e){var t=e.pointers.map((function(e){return Dt(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 As(e,this.element,this.scissor)},t.prototype.bindEvents=function(e){var t=this,i=function(e){var i=As(e,t.element,t.scissor);return!(Math.abs(i.x)>1||Math.abs(i.y)>1)},r=new fs.Manager(e),n=function(e){return e.session.firstInput||null};r.add(new fs.Pan({threshold:10,pointers:0})),r.add(new fs.Tap({interval:410})),r.add(new fs.Pinch({threshold:0,pointers:2})),r.on("panstart pan",(function(e){var o=n(r);o&&!i(o.center)||(t.onPanGesture(e),f())})),r.on("tap",(function(e){if("mouse"!==e.pointerType||0===e.srcEvent.button){var o=n(r);o&&!i(o.center)||(t.onTapGesture(e),f())}})),r.on("pinchstart pinch pinchend",(function(e){var o=n(r);o&&!i(o.center)||(t.onPinchGesture(e),f())}));var o=null,s=null,a=function(e,t,i){var r="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:gn(r,.1,10),center:{x:i.clientX,y:i.clientY},velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0}},l=function(e){var r,n={x:e.clientX,y:e.clientY};if(i(n)){if(e.preventDefault(),e.ctrlKey){var l=null!==(r=null==o?void 0:o.prevInput.scale)&&void 0!==r?r: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 r=null!==(i=null==o?void 0:o.prevInput.scale)&&void 0!==i?i:1,n=a("pinchend",r,e);o=null,t.onPinchGesture(n)}),200)}else t.onMouseWheel(e);f()}},u=function(e){if(!ss()){var r={x:e.clientX,y:e.clientY};i(r)?(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,r){if(i(e)){t.pressState={x:e.x,y:e.y,time:t.pressState?t.pressState.time:r,stop:Ue};var n=r-t.pressState.time;t.onPressGesture({x:e.x,y:e.y,delta:n},!1),t.pressState&&(t.pressState.stop=ft.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},je())},p=function(e){f(),h({x:e.clientX,y:e.clientY},je())},f=function(){var e;if(t.pressState){var i=je()-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",r=!1,n=!1;switch(e.type){case"gesturestart":i="pinchstart",r=!0;break;case"gestureend":i="pinchend",n=!0}return{type:i,target:e.target,pointerType:"mouse",srcEvent:e,pointers:[{x:e.clientX,y:e.clientY}],isFirst:r,isFinal:n,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(),!ss()){var r=g(e),n=(A={firstInput:r}).firstInput;n&&!i(n.center)||t.onPinchGesture(r)}},v=function(e){if(e.preventDefault(),!ss()&&A){var r=g(e),n=A.firstInput;n&&!i(n.center)||t.onPinchGesture(r)}},y=function(e){if(e.preventDefault(),!ss()&&A){var r=g(e),n=A.firstInput;A=null,n&&!i(n.center)||t.onPinchGesture(r)}},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())}};return 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),Object.assign((function(){r.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}(qe),Ss=function(t){function i(e){var r,n,o=this,s=i.parseArgs(e);return(o=t.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 On({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!==(n=null===(r=o.model.getMaterial())||void 0===r?void 0:r.modelAlpha)&&void 0!==n?n: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 Oe(i,t),i.distanceFromModel=function(e,t,i){var r=e.bounding,n=Math.pow(Math.pow(r.max.x-r.min.x+1,2)+Math.pow(r.max.y-r.min.y+1,2)+Math.pow(r.max.z-r.min.z+1,2),.5),o=n/2/Math.tan(Math.PI*t/360);return i<1&&(o/=i),isNaN(o)?n:o},i.parseArgs=function(e){var i,r,n,o,s,a,l,u,c=t.parseArgs.call(this,e);return Fe(Fe({},c),{defaultLongitude:null!==(i=e.defaultLongitude)&&void 0!==i?i:Math.PI/4,defaultLatitude:null!==(r=e.defaultLatitude)&&void 0!==r?r:Math.PI/4,defaultFov:null!==(n=e.defaultFov)&&void 0!==n?n:80,maxFov:null!==(o=e.maxFov)&&void 0!==o?o:120,minFov:null!==(s=e.minFov)&&void 0!==s?s:40,maxLatitude:null!==(a=e.maxLatitude)&&void 0!==a?a:+Math.PI/2,minLatitude:null!==(l=e.minLatitude)&&void 0!==l?l:-Math.PI/2,intersectMeshCreator:null!==(u=e.intersectMeshCreator)&&void 0!==u?u:function(){return new Ko}})},i.initAnimationEndPose=function(t){var r,n,o,s=this.parseArgs(t),a=t.initial[1];return{longitude:null!==(r=a.longitude)&&void 0!==r?r:s.defaultLongitude,latitude:gn(null!==(n=a.latitude)&&void 0!==n?n:s.defaultLatitude,s.minLatitude,s.maxLatitude),fov:null!==(o=a.fov)&&void 0!==o?o:s.defaultFov,offset:t.model.bounding.getCenter(new e.Vector3),distance:i.distanceFromModel(s.model,s.defaultFov,s.camera.aspect)}},i.prototype.destroy=function(){t.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)},i.prototype.isReady=function(){return!1!==this.locationMotion.ended&&t.prototype.isReady.call(this)},i.prototype.updateWork=function(e,t,i,r,n){return this.work=e,this.updateCamera(i,null!=r?r:0,n),!0},i.prototype.updateModel=function(r){t.prototype.updateModel.call(this,r);var n=r.bounding.getCenter(new e.Vector3),o=i.distanceFromModel(r,this.defaultFov,this.camera.aspect);this.locationMotion.set({x:n.x,y:n.y,z:n.z,distance:o},0).catch(Ue)},i.prototype.updateTime=function(t,i){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];if(!this.destroyed){var o={},s={};this.locationMotion.ended||(this.locationMotion.update(t),o.modelAlpha=this.locationMotion.value.modelAlpha,this.camera.perspToOrtho.setScalar(gn(this.locationMotion.value.perspToOrtho,0,1)),this.camera.orthoDistance=this.locationMotion.value.orthoDistance,s.distance=this.locationMotion.value.distance,s.offset=new e.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z)),this.cameraMotion.ended||(this.cameraMotion.update(t),s.longitude=this.cameraMotion.value.longitude,s.latitude=this.cameraMotion.value.latitude,s.fov=this.cameraMotion.value.fov),hs(o)||this.model.setMaterial(o),hs(s)||this.setCamera(s)}},i.prototype.getTargetPose=function(){var t=this.cameraMotion.getKeyFrameSegment(je())[1],i=this.locationMotion.getKeyFrameSegment(je())[1];return{longitude:t.value.longitude,latitude:t.value.latitude,fov:t.value.fov,offset:new e.Vector3(i.value.x,i.value.y,i.value.z),distance:i.value.distance}},i.prototype.initAnimation=function(t,r,n,o){var s,a,l,u=this;if(!this.destroyed){this.pending=!1,this.userAction=o;var c={longitude:null!==(s=r.longitude)&&void 0!==s?s:this.defaultLongitude,latitude:gn(null!==(a=r.latitude)&&void 0!==a?a:this.defaultLatitude,this.minLatitude,this.maxLatitude),fov:gn(null!==(l=r.fov)&&void 0!==l?l:this.defaultFov,this.minFov,this.maxFov),offset:this.model.bounding.getCenter(new e.Vector3),distance:i.distanceFromModel(this.model,this.defaultFov,this.camera.aspect)},h=Dt(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",t,c,this.userAction),this.cameraMotion.set(h,n).catch(Ue),this.locationMotion.set(d,n).then((function(){u.emit("initAnimationEnded",t,c,u.userAction)}),(function(e){var i=ds(u.camera.pose);u.emit("initAnimationEnded",t,i,u.userAction)})).catch(Ue)}},i.prototype.updateRenderSize=function(){this.locationMotion.set({distance:i.distanceFromModel(this.model,this.defaultFov,this.camera.aspect)},0).catch(Ue)},i.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 r=cs(t,(function(e){return e.standingPosition.distanceTo(i.point)}),!0),n=r[0];return r[1]<5?this.work.observers.indexOf(n):null},i.prototype.coordinatesForOffset=function(t){var i=this.renderer.getSize(new e.Vector2);return{longitude:2*t.x/(i.x*this.scissor.width),latitude:2*t.y/(i.y*this.scissor.height)}},i.prototype.requestInteriaMovement=function(e,t){var i=this;if(!1!==this.interiaMovement){for(var r=Fe({},e),n={longitude:0,latitude:0},o=0;o<t;o++)r.longitude*=.996,r.latitude*=.994008,n.longitude+=r.longitude,n.latitude+=r.latitude;var s=is(this.cameraMotion.value.longitude+n.longitude),a=gn(this.cameraMotion.value.latitude+n.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(Ue);var u=r.longitude>1e-4||r.longitude<-1e-4||r.latitude>1e-4||r.latitude<-1e-4;this.emit("interiaPan",l,!u),u?ft.shared.add((function(e,t){i.requestInteriaMovement(r,0|t)}),!0,1):this.interiaMovement=!1}},i.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 Dt(e,["x","y"])}));if(!this.emit("wantsGesture","pan",r,e.isFinal)){var n={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;n.x*=s;var a=this.coordinatesForOffset(n),l=is(this.cameraMotion.value.longitude+a.longitude),u=gn(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)&&(this.emit("gesture","pan",r,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(Ue),e.isFinal&&!this.emit("wantsInteriaPan",c))){this.interiaMovement=!0;var h=e.velocityX*s,d=e.velocityY;this.requestInteriaMovement(this.coordinatesForOffset({x:h,y:d}),0)}}}},i.prototype.onPinchGesture=function(e){var t,i=null===(t=this.pinchState)||void 0===t?void 0:t.fov,r=!1;if("pinchstart"!==e.type){if("pinchend"===e.type&&(r=!0,delete this.panState,delete this.pinchState),void 0!==i){var n=e.pointers.map((function(e){return Dt(e,["x","y"])}));if(!this.emit("wantsGesture","pinch",n,r)){var o=gn(i/e.scale,this.minFov,this.maxFov);this.emit("wantsPinchGesture",e.scale,o,r)||this.emit("wantsChangeCameraFov",o)||(this.emit("gesture","pinch",n,r),this.emit("pinchGesture",e.scale,o,r),this.userAction=!0,this.interiaMovement=!1,this.cameraMotion.set({fov:o},0).catch(Ue),this.onPanGesture(e))}}}else this.pinchState={fov:this.cameraMotion.value.fov}},i.prototype.onMouseMove=function(t){if(this.intersectMesh.parent&&!this.model.empty&&this.model.bvhs&&!0===this.model.bvhs.loaded&&!this.panState){var i=this.relativeClientPosition({x:t.clientX,y:t.clientY}),r=new e.Raycaster;if(r.setFromCamera(i,this.camera),this.emit("wantsShowIntersectionOnModel",r))this.hideIntersectMesh();else{var n=this.model.intersectRaycaster(r)[0];if(n&&n.face){var o=n.face.normal,s=o.clone().multiplyScalar(.05),a=n.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",n,this.intersectMesh)}else this.hideIntersectMesh();this.mouseMoveState={clientX:t.clientX,clientY:t.clientY}}}},i.prototype.onMouseOut=function(){this.intersectMesh.parent&&!0===this.intersectMesh.visible&&this.hideIntersectMesh()},i.prototype.onMouseWheel=function(e){var t=this,i=(Math.abs(e.deltaY)>Math.abs(e.deltaX)?e.deltaY:e.deltaX)/-60,r=[{x:e.clientX,y:e.clientY,delta:i}];if(!this.emit("wantsGesture","mouseWheel",r,!1)){var n=this.minFov,o=this.maxFov,s=gn(this.camera.fov-i,n,o);this.emit("wantsMouseWheel",i,s,!1)||this.emit("wantsChangeCameraFov",s)||(this.emit("gesture","mouseWheel",r,!1),this.emit("mouseWheel",i,s,!1),this.userAction=!0,this.interiaMovement=!1,this.cameraMotion.set({fov:s},0).catch(Ue),this.mouseWheelState&&clearTimeout(this.mouseWheelState.timer),this.mouseWheelState={timer:window.setTimeout((function(){delete t.mouseWheelState,t.emit("wantsGesture","mouseWheel",r,!0)||t.emit("wantsMouseWheel",i,s,!0)||(t.emit("gesture","mouseWheel",r,!0),t.emit("mouseWheel",0,s,!0))}),200)})}},i.prototype.onTapGesture=function(t){var i=this,r=t.pointers.map((function(e){return Dt(e,["x","y"])}));if(!this.emit("wantsGesture","tap",r,!0)){var n=this.relativeClientPosition(t.center),o=new e.Raycaster;if(o.setFromCamera(n,this.camera),!this.emit("wantsTapGesture",o,n,!0)){this.emit("gesture","tap",r,!0),this.emit("tapGesture",o,n,!0),this.interiaMovement=!1;var s=this.getForwardPanoIndexOrNot(o);if(!cn(s)){this.emit("panoSelected",s);var a={longitude:this.camera.pose.longitude,latitude:0};this.currentTapPanoIndex=s,this.preloadPano(s).then((function(e){i.currentTapPanoIndex===e&&i.emit("wantsMoveToPano",e,a,!0)}))}}}},i.prototype.onPressGesture=function(t,i){var r,n,o=[t];if(this.emit("wantsGesture","press",o,i))return null===(r=this.pressState)||void 0===r||r.stop(),void delete this.pressState;var s=this.relativeClientPosition(t),a=new e.Raycaster;if(a.setFromCamera(s,this.camera),this.emit("wantsPressGesture",a,s,t.delta,i))return null===(n=this.pressState)||void 0===n||n.stop(),void delete this.pressState;this.emit("gesture","press",o,i),this.emit("pressGesture",a,s,t.delta,i)},i.prototype.preloadPano=function(e,t){var i=this;void 0===t&&(t=Ue);var r=this.work.observers[e],n=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:oi.isInitialized()},Dt(i.imageOptions,["size","format","quality","mappings"])),s=r.images[t];return ct(i.imageOptions.transform?i.imageOptions.transform(s,o):vt(s,o),{allowHosts:n,requestProxy:i.requestProxy,networkSubscribe:i.networkSubscribe})}))).then((function(){return t(e),e}))},i.prototype.hideIntersectMesh=function(){this.intersectMesh.visible=!1,this.emit("intersectionHidden"),this.needsRender=!0},i}(Es),Cs=0,Is=Math.PI/2,Bs=0,Ts=0,Ps=Math.PI/2,Rs=0,Ds=Math.PI,ks=0,Ls=1.5*Math.PI,Os=0,Fs=function(t){function i(e){var r=i.parseArgs(e);return t.call(this,r)||this}return Oe(i,t),i.parseArgs=function(e){var i=[e.initial[0],Fe(Fe({},e.initial[1]),{longitude:0,latitude:Math.PI/2}),e.initial[2],e.initial[3]],r=Fe(Fe({},e),{initial:i,maxLatitude:Math.PI/2,minLatitude:Math.PI/2,defaultLongitude:0,defaultLatitude:Math.PI/2});return t.parseArgs.call(this,r)},i.initAnimationEndPose=function(e){var i=this.parseArgs(e);return t.initAnimationEndPose.call(this,i)},i.prototype.updateModel=function(t){this.model=t,this.needsRender=!0;var i=t.bounding.getCenter(new e.Vector3);this.locationMotion.set({x:i.x,y:i.y,z:i.z,distance:Ss.distanceFromModel(this.model,this.defaultFov,this.camera.aspect)},0).catch(Ue)},i.prototype.initAnimation=function(t,i,r,n){var o,s=this;if(!this.destroyed){this.pending=!1,this.userAction=n;var a={longitude:0,latitude:Math.PI/2,fov:gn(null!==(o=i.fov)&&void 0!==o?o:this.defaultFov,this.minFov,this.maxFov),offset:this.model.bounding.getCenter(new e.Vector3),distance:Ss.distanceFromModel(this.model,this.defaultFov,this.camera.aspect)},l=Dt(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,r).catch(Ue),this.locationMotion.set(u,r).then((function(){s.emit("initAnimationEnded",t,a,s.userAction)}),(function(e){var i=ds(s.camera.pose);s.emit("initAnimationEnded",t,i,s.userAction)}))}},i.prototype.getZoomOffsetFromFov=function(t,i,r){var n=this.camera.getWorldDirection(new e.Vector3),o=Math.tan(r/2*Math.PI/180),s=Math.tan(i.fov/2*Math.PI/180),a=(s-o)/s,l=new e.Raycaster;l.setFromCamera(t,i);var u=l.ray.direction,c=u.angleTo(n),h=Ss.distanceFromModel(this.model,this.defaultFov,this.camera.aspect),d=h*Math.tan(c),p=u.clone().setLength(h*Math.cos(c)).projectOnPlane(n),f=p.length(),A=a/f*p.x*d,g=a/f*p.z*d,m=a/f*p.y*d;return new e.Vector3(A,m,g)},i.prototype.requestInteriaMovement=function(e,t){},i.prototype.onPanGesture=function(t){var i=this.panState,r=t.pointers.length;if(t.isFinal?delete this.panState:this.panState={pointerLength:r,x:t.center.x,y:t.center.y},void 0!==i&&i.pointerLength===r){var n=t.pointers.map((function(e){return Dt(e,["x","y"])}));if(!this.emit("wantsGesture","pan",n,t.isFinal)){var o=t.center.x-i.x,s=t.center.y-i.y,a=new e.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z),l=this.model.bounding,u=l.getCenter(new e.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 e.Vector3,up:new e.Vector3,cameraDirection:"y"};this.cameraMotion.value.longitude===Cs&&this.cameraMotion.value.latitude===Is?(p.left.set(1,0,0),p.up.set(0,0,-1),p.cameraDirection="y"):this.cameraMotion.value.longitude===Bs&&this.cameraMotion.value.latitude===Ts?(p.left.set(1,0,0),p.up.set(0,1,0),p.cameraDirection="z"):this.cameraMotion.value.longitude===Ds&&this.cameraMotion.value.latitude===ks?(p.left.set(1,0,0),p.up.set(0,-1,0),p.cameraDirection="z"):this.cameraMotion.value.longitude===Ls&&this.cameraMotion.value.latitude===Os?(p.left.set(0,0,-1),p.up.set(0,-1,0),p.cameraDirection="x"):this.cameraMotion.value.longitude===Ps&&this.cameraMotion.value.latitude===Rs&&(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 e.Vector2);a.add(function(t,i){var r=(new e.Vector3).copy(i);return r.multiplyScalar(-t),r}(2*o*f/A.y,p.left)),a.add(function(t,i){var r=(new e.Vector3).copy(i);return r.multiplyScalar(t),r}(2*s*f/A.y,p.up)),a.x=gn(a.x,u.x-c,u.x+c),a.y=gn(a.y,u.y-h,u.y+h),a.z=gn(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,t.isFinal)||(this.emit("gesture","pan",n,t.isFinal),this.emit("panGesture",g,t.isFinal),this.userAction=!0,this.locationMotion.set({x:a.x,y:a.y,z:a.z},0).catch(Ue))}}},i.prototype.onPinchGesture=function(e){var t,i=null===(t=this.pinchState)||void 0===t?void 0:t.fov,r=!1;if("pinchstart"!==e.type){if("pinchend"===e.type&&(r=!0,delete this.pinchState),void 0!==i){var n=e.pointers.map((function(e){return Dt(e,["x","y"])}));if(!this.emit("wantsGesture","pinch",n,r)){var o=gn(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===Cs&&this.cameraMotion.value.latitude===Is?a.y=0:this.cameraMotion.value.longitude===Bs&&this.cameraMotion.value.latitude===Ts||this.cameraMotion.value.longitude===Ds&&this.cameraMotion.value.latitude===ks?a.z=0:(this.cameraMotion.value.longitude===Ls&&this.cameraMotion.value.latitude===Os||this.cameraMotion.value.longitude===Ps&&this.cameraMotion.value.latitude===Rs)&&(a.x=0);var l=this.camera.pose.offset.clone().add(a);this.emit("wantsPinchGesture",e.scale,o,r)||this.emit("wantsChangeCameraFov",o)||(this.emit("gesture","pinch",n,r),this.emit("pinchGesture",e.scale,o,r),this.userAction=!0,this.locationMotion.set({x:l.x,y:l.y,z:l.z},0).catch(Ue),this.cameraMotion.set({longitude:this.cameraMotion.value.longitude,latitude:this.cameraMotion.value.latitude,fov:o},0).catch(Ue),this.onPanGesture(e))}}}else this.pinchState={fov:this.cameraMotion.value.fov}},i.prototype.onMouseWheel=function(e){var t=this,i=(Math.abs(e.deltaY)>Math.abs(e.deltaX)?e.deltaY:e.deltaX)/-60,r=[{x:e.clientX,y:e.clientY,delta:i}];if(!this.emit("wantsGesture","mouseWheel",r,!1)){var n=gn(this.cameraMotion.value.fov-i,this.minFov,this.maxFov),o=this.relativeClientPosition({x:e.clientX,y:e.clientY}),s=this.getZoomOffsetFromFov(o,this.camera,n);this.cameraMotion.value.longitude===Cs&&this.cameraMotion.value.latitude===Is?s.y=0:this.cameraMotion.value.longitude===Bs&&this.cameraMotion.value.latitude===Ts||this.cameraMotion.value.longitude===Ds&&this.cameraMotion.value.latitude===ks?s.z=0:(this.cameraMotion.value.longitude===Ls&&this.cameraMotion.value.latitude===Os||this.cameraMotion.value.longitude===Ps&&this.cameraMotion.value.latitude===Rs)&&(s.x=0);var a=this.camera.pose.offset.clone().add(s);this.emit("wantsMouseWheel",i,n,!1)||this.emit("wantsChangeCameraFov",n)||(this.emit("gesture","mouseWheel",r,!1),this.emit("mouseWheel",i,n,!1),this.userAction=!0,this.locationMotion.set({x:a.x,y:a.y,z:a.z},0).catch(Ue),this.cameraMotion.set({longitude:this.cameraMotion.value.longitude,latitude:this.cameraMotion.value.latitude,fov:n},0).catch(Ue),this.mouseWheelState&&clearTimeout(this.mouseWheelState.timer),this.mouseWheelState={timer:window.setTimeout((function(){delete t.mouseWheelState,t.emit("wantsGesture","mouseWheel",r,!0)||t.emit("wantsMouseWheel",i,n,!0)||t.emit("wantsChangeCameraFov",n)||(t.emit("gesture","mouseWheel",r,!0),t.emit("mouseWheel",0,n,!0))}),200)})}},i}(Ss);function Ns(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 r="[",n=e.length-1,o=0;o<n;o++)r+=Ns(e[o],!1)+",";return n>-1&&(r+=Ns(e[o],!1)),r+"]"}if(e instanceof Object){if("function"==typeof e.toJSON)return Ns(e.toJSON(),t);var s=Object.keys(e).sort(),a=s.length;for(r="",o=0;o<a;){var l=s[o],u=Ns(e[l],!0);void 0!==u&&(o&&""!==r&&(r+=","),r+=JSON.stringify(l)+":"+u),o++}return"{"+r+"}"}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 Vs(e){return Te(String(Ns(e,!1)))}var Qs,Hs=function(t){function i(e){var r=this,n=i.parseArgs(e);return(r=t.call(this,n)||this).defaultLongitude=n.defaultLongitude,r.defaultLatitude=n.defaultLongitude,r.defaultFov=n.defaultFov,r.maxFov=n.maxFov,r.minFov=n.minFov,r.maxLatitude=n.maxLatitude,r.minLatitude=n.minLatitude,r.moveSpeed=n.moveSpeed,r.intersectMeshCreator=n.intersectMeshCreator,r.interiaMovement=!1,r.intersectMesh=r.intersectMeshCreator(),r.intersectMesh.name="intersect",r.intersectMesh.visible=!1,r.helper.add(r.intersectMesh),r}return Oe(i,t),i.parseArgs=function(e){var i,r,n,o,s,a,l,u,c,h=t.parseArgs.call(this,e);return Fe(Fe({},h),{defaultLongitude:null!==(i=e.defaultLongitude)&&void 0!==i?i:0,defaultLatitude:null!==(r=e.defaultLatitude)&&void 0!==r?r:0,defaultFov:null!==(n=e.defaultFov)&&void 0!==n?n:90,maxFov:null!==(o=e.maxFov)&&void 0!==o?o:120,minFov:null!==(s=e.minFov)&&void 0!==s?s:40,maxLatitude:null!==(a=e.maxLatitude)&&void 0!==a?a:+Math.PI/2,minLatitude:null!==(l=e.minLatitude)&&void 0!==l?l:-Math.PI/2,moveSpeed:null!==(u=e.moveSpeed)&&void 0!==u?u:3.2,intersectMeshCreator:null!==(c=e.intersectMeshCreator)&&void 0!==c?c:function(){return new Ko}})},i.initAnimationEndPose=function(e){var t,i,r,n=this.parseArgs(e),o=e.initial,s=o[0],a=o[1];return{longitude:null!==(t=a.longitude)&&void 0!==t?t:n.defaultLongitude,latitude:gn(null!==(i=a.latitude)&&void 0!==i?i:n.defaultLatitude,n.minLatitude,n.maxLatitude),fov:gn(null!==(r=a.fov)&&void 0!==r?r:n.defaultFov,n.minFov,n.maxFov),offset:n.work.observers[s].position.clone(),distance:0}},i.prototype.destroy=function(){t.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},i.prototype.isReady=function(){return!this.interiaMovement&&!this.panState&&!this.pinchState&&!this.mouseWheelState&&t.prototype.isReady.call(this)},i.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 gn(t,2,5)/this.moveSpeed*1e3}},i.prototype.hideIntersectMesh=function(){this.intersectMesh.visible=!1,this.emit("intersectionHidden"),this.needsRender=!0},i.prototype.coordinatesForOffset=function(t){var i=this.cameraMotion.value.fov,r=this.camera.aspect,n=this.renderer.getSize(new e.Vector2);return{longitude:2*t.x/(n.x*this.scissor.width)*i/95*r,latitude:-2*t.y/(n.y*this.scissor.height)*i/95}},i.prototype.cameraBounce=function(){var e=this.cameraMotion.value,t=e.longitude,i=e.latitude,r=e.fov,n=[{progress:0,value:{longitude:t,latitude:i,fov:r}},{progress:.5,value:{longitude:t,latitude:i,fov:.98*r}},{progress:1,value:{longitude:t,latitude:i,fov:r}}];this.cameraMotion.setKeyframes(n,500).catch(Ue)},i.prototype.requestInteriaMovement=function(e,t){var i=this;if(!1!==this.interiaMovement){for(var r=Fe({},e),n={longitude:0,latitude:0},o=0;o<t;o++)r.longitude*=.996,r.latitude*=.98604,n.longitude+=r.longitude,n.latitude+=r.latitude;var s=is(this.cameraMotion.value.longitude+n.longitude),a=gn(this.cameraMotion.value.latitude+n.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(Ue);var u=r.longitude>1e-4||r.longitude<-1e-4||r.latitude>1e-4||r.latitude<-1e-4;this.emit("interiaPan",l,!u),u?ft.shared.add((function(e,t){i.requestInteriaMovement(r,0|t)}),!0,1):this.interiaMovement=!1}},i.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 Dt(e,["x","y"])}));if(!this.emit("wantsGesture","pan",r,e.isFinal)){var n={x:e.center.x-t.x,y:e.center.y-t.y},o=this.coordinatesForOffset(n),s=is(this.cameraMotion.value.longitude+o.longitude),a=gn(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",r,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(Ue),e.isFinal&&!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)}}}}},i.prototype.onPinchGesture=function(e){var t,i=null===(t=this.pinchState)||void 0===t?void 0:t.fov,r=e.scale,n=!1;if("pinchstart"!==e.type){if("pinchend"===e.type&&(n=!0,delete this.pinchState),void 0!==i){var o=e.pointers.map((function(e){return Dt(e,["x","y"])}));if(!this.emit("wantsGesture","pinch",o,n)){var s=gn(i/r,this.minFov,this.maxFov);this.emit("wantsPinchGesture",r,s,n)||this.emit("wantsChangeCameraFov",s)||(this.emit("gesture","pinch",o,n),this.emit("pinchGesture",r,s,n),this.userAction=!0,this.interiaMovement=!1,this.cameraMotion.set({fov:s},0).catch(Ue),this.onPanGesture(e))}}}else this.pinchState={fov:this.cameraMotion.value.fov}},i.prototype.onMouseWheel=function(e){var t=this,i=(Math.abs(e.deltaY)>Math.abs(e.deltaX)?e.deltaY:e.deltaX)/-60,r=[{x:e.clientX,y:e.clientY,delta:i}];if(!this.emit("wantsGesture","mouseWheel",r,!1)){var n=gn(this.cameraMotion.value.fov-i,this.minFov,this.maxFov);this.emit("wantsMouseWheel",i,n,!1)||this.emit("wantsChangeCameraFov",n)||(this.emit("gesture","mouseWheel",r,!1),this.emit("mouseWheel",i,n,!1),this.userAction=!0,this.interiaMovement=!1,this.cameraMotion.set({fov:n},0).catch(Ue),this.mouseWheelState&&clearTimeout(this.mouseWheelState.timer),this.mouseWheelState={timer:window.setTimeout((function(){delete t.mouseWheelState,t.emit("wantsGesture","mouseWheel",r,!0)||t.emit("wantsMouseWheel",i,n,!0)||t.emit("wantsChangeCameraFov",n)||(t.emit("gesture","mouseWheel",r,!0),t.emit("mouseWheel",0,n,!0))}),200)})}},i.prototype.onMouseMove=function(t){if(this.intersectMesh.parent&&!this.model.empty&&this.model.bvhs&&!0===this.model.bvhs.loaded&&!this.panState){var i=this.relativeClientPosition({x:t.clientX,y:t.clientY}),r=new e.Raycaster;if(r.setFromCamera(i,this.camera),this.emit("wantsShowIntersectionOnModel",r))this.hideIntersectMesh();else{var n=this.model.intersectRaycaster(r)[0];if(n&&n.face){var o=n.face.normal,s=o.clone().multiplyScalar(.05),a=n.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",n,this.intersectMesh)}else this.hideIntersectMesh();this.mouseMoveState={clientX:t.clientX,clientY:t.clientY}}}},i.prototype.onMouseOut=function(){this.intersectMesh.parent&&!0===this.intersectMesh.visible&&this.hideIntersectMesh()},i.prototype.onPressGesture=function(t,i){var r,n,o=[t];if(this.emit("wantsGesture","press",o,i))return null===(r=this.pressState)||void 0===r||r.stop(),void delete this.pressState;var s=this.relativeClientPosition(t),a=new e.Raycaster;if(a.setFromCamera(s,this.camera),this.emit("wantsPressGesture",a,s,t.delta,i))return null===(n=this.pressState)||void 0===n||n.stop(),void delete this.pressState;this.emit("gesture","press",o,i),this.emit("pressGesture",a,s,t.delta,i)},i}(Es);function qs(){return Qs||(Qs=new Promise((function(e){var t,i=document.createElement("video");i.muted=!0,i.src="data:video/mp4;base64,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",i.addEventListener("timeupdate",(function r(){i.removeEventListener("timeupdate",r,!1),clearTimeout(t);var n=document.createElement("canvas");n.width=n.height=1;var o=n.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 Us,zs=function(t){function i(i,r){return void 0===r&&(r=.5),t.call(this,i,{uniforms:{inputBuffer:new e.Uniform(null),scale:new e.Uniform(r)},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 Oe(i,t),i}(bs),js=function(t){function i(i,r){void 0===r&&(r=.002);var n=t.call(this,i,{uniforms:{targetBuffer:new e.Uniform(null),inputBuffer:new e.Uniform(null),step:new e.Uniform(r)},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 n.material.extensions.shaderTextureLOD=!0,n}return Oe(i,t),Object.defineProperty(i.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(i.prototype,"step",{get:function(){return this.material.uniforms.step.value},set:function(e){this.material.uniforms.step.value=e},enumerable:!1,configurable:!0}),i}(bs),_s=function(t){function i(i){var r=t.call(this,i,{uniforms:{inputBuffer:new e.Uniform(null),luminanceAdaptiveBuffer:new e.Uniform(null),progress:new e.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 r.material.transparent=!0,r}return Oe(i,t),Object.defineProperty(i.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(i.prototype,"progress",{get:function(){return this.material.uniforms.progress.value},set:function(e){this.material.uniforms.progress.value=e},enumerable:!1,configurable:!0}),i}(bs),Ks=function(t){function i(e){var i=t.call(this,e)||this;return i.enableTime=je(),i.renderer=e,i.valuePass=new xs(i.renderer),i.luminancePass=new zs(i.renderer,Math.sqrt(1/3)),i.nextStepPass=new js(i.renderer,.01),i.luminanceAdaptivePass=new _s(i.renderer),i}return Oe(i,t),i.prototype.render=function(t,i){if(!this.enable)return this.enableTime=null,void this.copyPass.render(t,i);null===this.enableTime&&(this.enableTime=je()),this.luminanceTargetBuffer||(this.luminanceTargetBuffer=new e.WebGLRenderTarget(128,128,{minFilter:e.LinearMipmapLinearFilter,magFilter:e.LinearFilter,encoding:this.renderer.outputEncoding,stencilBuffer:!1,depthBuffer:!1,format:e.RGBAFormat,generateMipmaps:!0}),this.nextStepPass.targetBuffer=this.luminanceTargetBuffer.texture),this.luminancePass.render(t,this.luminanceTargetBuffer),this.luminancePrevBuffer||(this.luminancePrevBuffer=new e.WebGLRenderTarget(1,1,{minFilter:e.NearestFilter,magFilter:e.NearestFilter,type:e.HalfFloatType,encoding:this.renderer.outputEncoding,stencilBuffer:!1,depthBuffer:!1}),this.valuePass.render(new e.Vector3(.5,.5,.5),this.luminancePrevBuffer)),this.luminanceNextBuffer||(this.luminanceNextBuffer=new e.WebGLRenderTarget(1,1,{minFilter:e.NearestFilter,magFilter:e.NearestFilter,type:e.HalfFloatType,encoding:this.renderer.outputEncoding,stencilBuffer:!1,depthBuffer:!1}),this.valuePass.render(new e.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((je()-this.enableTime)/100,1),this.luminanceAdaptivePass.render(t,i)},i.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()},i}(Ms),Gs=null!==(Us=Math.SQRT1_2)&&void 0!==Us?Us:Math.sqrt(2),Ws={up:new e.Quaternion(Gs,0,0,Gs),down:new e.Quaternion(-Gs,0,0,Gs),left:new e.Quaternion(0,Gs,0,Gs),right:new e.Quaternion(0,-Gs,0,Gs),front:new e.Quaternion(0,0,0,1),back:new e.Quaternion(0,1,0,0)},Xs=new Float32Array([-.5,-.5,0,.5,-.5,0,-.5,.5,0,.5,.5,0]),Ys=new Float32Array([0,0,1,0,0,1,1,1]),Zs=new Uint8Array([0,1,2,1,3,2]),Js=new e.BufferGeometry;Js.setAttribute("position",new e.BufferAttribute(Xs,3)),Js.setAttribute("uv",new e.BufferAttribute(Ys,2)),Js.setIndex(new e.BufferAttribute(Zs,1));var $s=function(t){function i(){var i=t.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 i.depthTest=!1,i.depthWrite=!1,i.blending=e.NoBlending,i.map=i.uniforms.map.value,i.luminanceMap=i.uniforms.luminanceMap.value,Object.defineProperties(i,{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}}}),i}return Oe(i,t),i}(e.ShaderMaterial),ea=function(t){function i(i,r){var n=t.call(this,Js,new $s)||this;return i.box.getCenter(n.position),n.quaternion.multiplyQuaternions((new e.Quaternion).setFromAxisAngle(new e.Vector3(0,1,0),-Math.PI),Ws[i.face]),n.scale.setScalar(i.size),n.node=i,n.name="tiling:tile",n.material.visible=!1,n.activeTime=-1,n.disposed=!1,n.needsRender=!1,n.frustumCulled=!1,r.then((function(e){var t=e[0],i=e[1];n.disposed?(t.dispose(),null==i||i.dispose()):(n.material.map=t,n.material.luminanceMap=i,n.material.needsUpdate=!0,n.material.visible=!0,n.needsRender=!0)})).catch(Ue),n}return Oe(i,t),i.prototype.updateTime=function(e){},i.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()},i}(e.Mesh),ta=function(e){function t(){var t=e.call(this)||this;return t.needsRender=!1,t.name="tiling",t}return Oe(t,e),t}(e.Group),ia=function(){function t(e,t,i){this.disposed=!1,this.textureLoader=new li(e),this.minLevel=t,this.level=0,this.panoIndex=0,this.pedding=0,this.tileTree=Pt(this.minLevel),this.tileMeshes=new Map,this.resource=[],this.luminance=null,this.imageOptions=i,this.object=new ta,this.object.renderOrder=-2}return t.prototype.setAllowHosts=function(e){this.textureLoader.setAllowHosts(e)},t.prototype.setRequestProxy=function(e){this.textureLoader.setRequestProxy(e)},t.prototype.setNetworkSubscribe=function(e){this.textureLoader.setNetworkSubscribe(e)},t.prototype.cleanup=function(){var e=this;this.tileMeshes.forEach((function(t){t.dispose(),e.object.remove(t),e.object.needsRender=!0})),this.tileMeshes.clear()},t.prototype.setRotation=function(e){this.disposed||this.object.quaternion.equals(e)||(this.object.quaternion.copy(e),this.object.needsRender=!0)},t.prototype.setPosition=function(e){this.disposed||this.object.position.equals(e)||(this.object.position.copy(e),this.object.needsRender=!0)},t.prototype.setResource=function(e,t){var i,r;if(!this.disposed&&(this.resource!==e||this.luminance!==t)){this.cleanup(),this.resource=e;var n=null!==(r=null===(i=e.slice().sort((function(e,t){return t.level-e.level}))[0])||void 0===i?void 0:i.level)&&void 0!==r?r:0;this.tileTree=Pt(n),this.luminance=t,this.object.needsRender=!0}},t.prototype.update=function(t,i,r){var n=this;if(!this.disposed){this.level=i;var o=t.planes[5].normal,s=[];i>=this.minLevel&&Rt(this.tileTree,(function(e){if(!(e.level<n.minLevel))return!(e.level>i)&&!!t.intersectsBox(e.box)&&void s.push(e)}));var a=new e.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=r,"continue";var i=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:oi.isInitialized()},Dt(c.imageOptions,["format","size","quality","sharpen","mappings"])),{size:i*e.size==512?void 0:512,cut:[i*e.position.x,i*e.position.y,i*e.size,i*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=Fe(Fe({},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 n.pedding--,e}),(function(e){return n.pedding--,Promise.reject(e)})),y=new ea(e,v);y.name="tiling:tile-".concat(u),y.activeTime=r,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,r,o,s;return(null!==(r=null===(i=n.tileMeshes.get(t))||void 0===i?void 0:i.activeTime)&&void 0!==r?r:0)-(null!==(s=null===(o=n.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)}}},t.prototype.dispose=function(){this.cleanup(),this.resource=[],this.disposed=!0},t}(),ra=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]),na=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]),oa=new e.BufferGeometry;oa.setAttribute("position",new e.BufferAttribute(ra,3)),oa.setIndex(new e.BufferAttribute(na,1));var sa,aa,la=function(){function t(){this.material=new e.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 e.Uniform(null),matrix:new e.Uniform(null),alpha:new e.Uniform(null),map:new e.Uniform(null)},depthTest:!1,depthWrite:!1,defines:{USE_PANO_VIDEO:!1},blending:e.CustomBlending,blendSrc:e.SrcAlphaFactor,blendDst:e.OneMinusSrcAlphaFactor,blendSrcAlpha:e.OneFactor,blendDstAlpha:e.OneMinusSrcAlphaFactor}),this.object=new e.Mesh(oa,this.material),this.object.visible=!1,this.object.renderOrder=-1,this.object.frustumCulled=!1,this.alphaMotion=new On({alpha:0})}return t.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(Ue),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(Ue));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)},t.prototype.updateTime=function(e){this.alphaMotion.ended||(this.alphaMotion.update(e),this.material.uniforms.alpha.value=this.alphaMotion.value.alpha)},t.prototype.dispose=function(){this.material.dispose()},t}(),ua=(new e.Matrix4).makeRotationAxis(new e.Vector3(0,1,0),Math.PI),ca=new e.Vector3(-1,1,1),ha=function(){function t(e){void 0===e&&(e=0),this.width=e,this.pool=[]}return Object.defineProperty(t.prototype,"size",{get:function(){return this.pool.length},enumerable:!1,configurable:!0}),t.prototype.pop=function(){return this.pool.pop()||new e.WebGLCubeRenderTarget(this.width,{stencilBuffer:!1,depthBuffer:!1})},t.prototype.push=function(e){-1===this.pool.indexOf(e)&&this.pool.push(e)},t.prototype.clear=function(){for(var e=0,t=this.pool;e<t.length;e++)t[e].dispose();this.pool.length=0},t}(),da=function(t){function i(e){var r,n,o,s,a=this,l=i.parseArgs(e);(a=t.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 ha,a.luminanceCubeRenderTargetPool=new ha;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 ai&&c.map.cubeRenderTarget&&a.colorCubeRenderTargetPool.push(c.map.cubeRenderTarget),c.luminanceMap&&(c.luminanceMap.dispose(),c.luminanceMap instanceof ai&&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 On({count:0,distance:a.camera.pose.distance,modelAlpha:null!==(n=null===(r=a.model.getMaterial())||void 0===r?void 0:r.modelAlpha)&&void 0!==n?n:0,perspToOrtho:a.camera.perspToOrtho.x,orthoDistance:a.camera.orthoDistance}),a.panoResources={},a.panoResources[a.locationMotion.keyframes[0].key=a.locationMotion.keyframes[1].key=Yr()]={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 li(d),a.tiling=new ia(d,a.TILED_CUBE_TEXTURE_LEVEL+1,a.imageOptions),a.scene.add(a.tiling.object),a.panoVideo=new la,a.scene.add(a.panoVideo.object),a}return Oe(i,t),i.parseArgs=function(e){var i,r,n,o,s,a=t.parseArgs.call(this,e);return Fe(Fe({},a),{maxAccessibleDistance:null!==(i=e.maxAccessibleDistance)&&void 0!==i?i:5,panoTapTriggerRadius:null!==(r=e.panoTapTriggerRadius)&&void 0!==r?r:.5,panoCircleMeshCreator:null!==(n=e.panoCircleMeshCreator)&&void 0!==n?n:function(){return new fo},tileLevelForFov:null!==(o=e.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,r=Math.max(t.width/i,t.height/e);return r>80?4:r>48?3:r>18?2:r>12?1:0},luminanceAdaptiveEffectEnable:null===(s=e.luminanceAdaptiveEffectEnable)||void 0===s||s})},i.initAnimationEndPose=function(e){var i=this.parseArgs(e);return t.initAnimationEndPose.call(this,i)},i.prototype.destroy=function(){var e,i,r=this;t.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){r.helper.remove(e),e.dispose()})),this.panoMeshes.length=0),this.interiaMovement=!1;var n=this.videoTexture.image;n.pause(),n.oncanplay=function(){},n.ontimeupdate=function(){},this.scene.remove(this.panoVideo.object),this.panoVideo.setMaterial(null),this.panoVideo.dispose();for(var o=null!==(e=this.model.getMaterial())&&void 0!==e?e:{},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)},i.prototype.isReady=function(){return!0===this.locationMotion.ended&&t.prototype.isReady.call(this)},i.prototype.isTileReady=function(){var e,t,i,r=this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[this.locationMotion.keyframes.length-1]),n=(null===(e=r.panoPicture)||void 0===e?void 0:e.map)instanceof ai&&null!==(i=null===(t=r.panoPicture)||void 0===t?void 0:t.map.tilePending)&&void 0!==i?i:0,o=this.tiling.pedding;return this.initAnimationed&&n<=0&&o<=0},i.prototype.updateWork=function(e,t,i,r,n){var o=this;this.userAction=n,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:r,longitude:i.longitude,latitude:i.latitude,fov:i.fov,moveEndCallback:function(){o.initAnimationed=!0},moveCancelCallback:function(){o.initAnimationed=!0}},n),!0},i.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()},i.prototype.updateTime=function(t,i){for(var r,n,o,s,a,l,u,c,h,d,p,f=this,A=[],g=2;g<arguments.length;g++)A[g-2]=arguments[g];if(!this.destroyed){var m={},v={},y=this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[0]),b=this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[this.locationMotion.keyframes.length-1]),x=!1;if(!1===this.locationMotion.ended){this.locationMotion.update(t);var w=this.locationMotion.getKeyFrameSegment(t),M=w[0],E=w[1],S=this.panoResourceFromLocationMotionKeyframe(M),C=this.panoResourceFromLocationMotionKeyframe(E),I=(new e.Vector3).copy(S.position),B=(new e.Vector3).copy(C.position),T=this.locationMotion.value.count-E.value.count+1;m.progress=T,m.modelAlpha=this.locationMotion.value.modelAlpha,this.camera.perspToOrtho.setScalar(gn(this.locationMotion.value.perspToOrtho,0,1)),this.camera.orthoDistance=this.locationMotion.value.orthoDistance,C.panoPicture&&(T<1?S.panoPicture&&(m.pano0=S.panoPicture):m.pano0=C.panoPicture,m.pano1=C.panoPicture),x=m.useBlackTransition="instant"===C.effect||"montage"===C.effect,"fade"!==C.effect&&"montage"!==C.effect||(m.pano0&&S.panoPicture&&(m.pano0={map:m.pano0.map,luminanceMap:m.pano0.luminanceMap,matrix:S.panoPicture.matrix.clone().setPosition(C.position)}),I.copy(B)),v.distance=this.locationMotion.value.distance,v.offset=new e.Vector3(I.x+(B.x-I.x)*T,I.y+(B.y-I.y)*T,I.z+(B.z-I.z)*T);for(var P=[],R=[],D=0,k=this.locationMotion.keyframes;D<k.length;D++){var L=k[D],O=L.key,F=L.progress;void 0!==O&&(P.push(O),F>=this.locationMotion.progress&&R.push(O))}for(var N=0,V=Object.keys(this.panoResources);N<V.length;N++){var Q=V[N];if(!(R.indexOf(Q)>=0)){var H=this.panoResources[Q];if(H.panoPicture){var q=H.panoPicture.map,U=H.panoPicture.luminanceMap;if(q){if(q===(null===(r=m.pano0)||void 0===r?void 0:r.map))continue;if(q===(null===(n=m.pano1)||void 0===n?void 0:n.map))continue;q instanceof ai&&q.cubeRenderTarget&&this.colorCubeRenderTargetPool.push(q.cubeRenderTarget),q.dispose(),U&&(U instanceof ai&&U.cubeRenderTarget&&this.luminanceCubeRenderTargetPool.push(U.cubeRenderTarget),U.dispose()),H.panoPicture=null}}P.indexOf(Q)>=0||delete this.panoResources[Q]}}S.workCode===C.workCode?this.currentPanoIndex=T<.5?S.panoIndex:C.panoIndex:this.currentPanoIndex=C.panoIndex,this.emit("movingToPano",b.panoIndex,y.panoIndex,this.locationMotion.progress)}if(!1===this.cameraMotion.ended&&(this.cameraMotion.update(t),v.longitude=this.cameraMotion.value.longitude,v.latitude=this.cameraMotion.value.latitude,v.fov=this.cameraMotion.value.fov),!1===hs(m)&&((null===(o=m.pano0)||void 0===o?void 0:o.map)&&m.pano0.map instanceof ai&&!m.pano0.map.cubeRenderTarget&&(m.pano0.map.cubeRenderTarget=this.colorCubeRenderTargetPool.pop()),(null===(s=m.pano0)||void 0===s?void 0:s.luminanceMap)&&m.pano0.luminanceMap instanceof ai&&!m.pano0.luminanceMap.cubeRenderTarget&&(m.pano0.luminanceMap.cubeRenderTarget=this.luminanceCubeRenderTargetPool.pop()),(null===(a=m.pano1)||void 0===a?void 0:a.map)&&m.pano1.map instanceof ai&&!m.pano1.map.cubeRenderTarget&&(m.pano1.map.cubeRenderTarget=this.colorCubeRenderTargetPool.pop()),(null===(l=m.pano1)||void 0===l?void 0:l.luminanceMap)&&m.pano1.luminanceMap instanceof ai&&!m.pano1.luminanceMap.cubeRenderTarget&&(m.pano1.luminanceMap.cubeRenderTarget=this.luminanceCubeRenderTargetPool.pop()),this.model.setMaterial(m),this.boundingMesh.setMaterial(m)),!1===hs(v)&&this.setCamera(v),this.camera.pose.distance>.1)for(var z=0;z<this.work.observers.length;z++)(X=this.panoMeshes[z])&&(X.visible=!1);else{var j=this.work.observers[this.currentPanoIndex];if(j){var _=cs(j.visibleNodes,(function(e){return j.standingPosition.distanceTo(f.work.observers[e].standingPosition)}),!0),K=_[1];K=gn(K,2.5,1/0);var G=j.visibleNodes.concat(this.currentPanoIndex),W=this.getForwardPanoIndexOrNot();for(z=0;z<this.work.observers.length;z++){var X,Y=this.work.observers[z];if(X=this.panoMeshes[z])if(Y.loadable||Y.active)if(-1!==G.indexOf(z))if(x)X.visible=!1,X.setOpacity(0);else{X.visible=!0;var Z=X.position.clone().setY(this.camera.position.y).distanceTo(this.camera.position);X.setCurrent(!X.loading&&0===X.progress&&W===z),X.setOpacity(Z<.01?0:gn(K/Z*1.2,.65,.98)),X.updateTime&&X.updateTime(t,i)}else X.visible=!1,X.setOpacity(0);else X.visible=!1,X.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 J=this.tileLevel=function(){if(!1===f.tileLevelForFov)return 0;var t=f.renderer.getDrawingBufferSize(new e.Vector2);t.width*=f.scissor.width,t.height*=f.scissor.height;var i=b.panoIndex,r=f.work.observers[i],n=f.imageOptions.size;if(void 0===n&&r){var o=r.images.up.match(/\/cube_(\d+)\//);o&&(n=Number(o[1]))}void 0===n&&(n=2048);var s=0;n>=1024&&(s=1),n>=2048&&(s=2),n>=4096&&(s=3),n>=8192&&(s=4);var a=f.tileLevelForFov(f.camera.fov,t);return a>s?a:0}(),$=function(){var t,i=(new e.Camera).copy(f.camera);return i.position.set(0,0,0),i.quaternion.premultiply((null!==(t=f.work.observers[b.panoIndex])&&void 0!==t?t:f.work.observers[f.currentPanoIndex]).quaternion.clone().inverse()),i.updateMatrixWorld(!0),(new e.Frustum).setFromProjectionMatrix((new e.Matrix4).multiplyMatrices(f.camera.projectionMatrix,i.matrixWorldInverse))}();b.panoIndex===this.currentPanoIndex&&((null===(c=b.panoPicture)||void 0===c?void 0:c.map)instanceof ai&&(b.panoPicture.map.update($,J),!0===b.panoPicture.map.needsRender&&(b.panoPicture.map.needsRender=!1,this.needsRender=!0)),(null===(h=b.panoPicture)||void 0===h?void 0:h.luminanceMap)instanceof ai&&(b.panoPicture.luminanceMap.update($,J),!0===b.panoPicture.luminanceMap.needsRender&&(b.panoPicture.luminanceMap.needsRender=!1,this.needsRender=!0)));var ee=this.tiling.object.visible;if(this.initAnimationed){var te=b.panoIndex,ie=this.work.observers[te];ie&&Xo(this.camera.position,ie.position)&&this.locationMotion.ended?(this.tiling.object.visible=!0,this.tiling.panoIndex!==te&&this.tiling.cleanup(),this.tiling.panoIndex=te,this.tiling.setResource(null!==(p=null===(d=ie.images)||void 0===d?void 0:d.tiles)&&void 0!==p?p:[],this.enableIOSEDR&&ie.images.luminance?ie.images.luminance:null),this.tiling.setRotation(ie.quaternion),this.tiling.setPosition(ie.position),J>this.TILED_CUBE_TEXTURE_LEVEL?this.tiling.update($,J,t):this.tiling.update($,0,t)):this.tiling.object.visible=!1}else this.tiling.object.visible=!1;ee!==this.tiling.object.visible&&(this.tiling.object.needsRender=!0),this.panoVideo.object.position.copy(this.camera.position),this.panoVideo.updateTime(t)}},i.prototype.render=function(){var e=this.work.observers[this.currentPanoIndex];e&&e.video&&(this.needsRender=!0),t.prototype.render.call(this)},i.prototype.postProcessing=function(e,t){if(!this.destroyed)return this.luminanceAdaptiveEffect||(this.luminanceAdaptiveEffect=new Ks(this.renderer),this.luminanceAdaptiveEffect.enable=this.luminanceAdaptiveEffectEnable),this.luminanceAdaptiveEffect.render(e,t)},i.prototype.getTargetPose=function(){var e=this.cameraMotion.getKeyFrameSegment(je())[1],t=this.locationMotion.getKeyFrameSegment(je())[1],i=this.panoResourceFromLocationMotionKeyframe(t),r=this.work.observers[i.panoIndex];return{longitude:e.value.longitude,latitude:e.value.latitude,fov:e.value.fov,offset:r?r.position.clone():this.camera.position.clone(),distance:this.locationMotion.value.distance}},i.prototype.moveToPano=function(t,i,r){var n,o,s,a,l=this,u=this.work.observers[t],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(t),basisLoaderInitialized:oi.isInitialized()},Dt(this.imageOptions,["format","size","quality","sharpen","mappings"])),f=u.images,A=null!==(o=null===(n=u.images.tiles)||void 0===n?void 0:n.filter((function(e){return e.size>c})))&&void 0!==o?o:null,g=d,m={key:"pano_luminance.".concat(t),basisLoaderInitialized:oi.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:"+Vs([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:t,workCode:this.work.workCode,effect:null!==(a=i.effect)&&void 0!==a?a:"fly",panoPicture:{map:w.map,luminanceMap:w.luminanceMap,matrix:(new e.Matrix4).compose(u.position,u.quaternion,ca)},position:u.position.clone()};ft.shared.add((function(){l.pending=!1,l.emit("panoLoaded",t),l.doMoveToPano(t,C,i,r)}),!0,1)}else{this.pendingTextureTask={panoIndex:t,hash:b,onLoad:function(n,o){var s,a;if(l.pending=!1,l.destroyed)n.body.dispose();else{n.body.name=b,l.emit("panoLoaded",t);var c={panoIndex:t,workCode:l.work.workCode,effect:null!==(s=i.effect)&&void 0!==s?s:"fly",panoPicture:{map:n.body,luminanceMap:null!==(a=null==o?void 0:o.body)&&void 0!==a?a:null,matrix:(new e.Matrix4).compose(u.position,u.quaternion,ca)},position:u.position.clone()};l.doMoveToPano(t,c,i,r)}},onError:function(e){l.pending=!1,i.moveCancelCallback&&i.moveCancelCallback(),l.emit("panoLoadError",e,t),l.emit("moveToPanoCanceled",t)}};var I=this.panoMeshes[t];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:e.RGBAFormat,viaAjax:!0},void 0,void 0,(function(e){var i,r;l.emit("textureLoading",e,t,u),(null===(i=l.pendingTextureTask)||void 0===i?void 0:i.hash)===b&&(null===(r=l.panoMeshes[t])||void 0===r||r.setProgress(e))}),this.renderer):this.textureLoader.loadCubeTexture(f,{imageURL:{transform:d,options:p},format:e.RGBAFormat,viaAjax:!0,preInit:!0},void 0,void 0,(function(e){var i,r;l.emit("textureLoading",e,t,u),(null===(i=l.pendingTextureTask)||void 0===i?void 0:i.hash)===b&&(null===(r=l.panoMeshes[t])||void 0===r||r.setProgress(e))}),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(e){var i,r,n=e[0],o=e[1];(null===(i=l.pendingTextureTask)||void 0===i?void 0:i.hash)===b?(l.pendingTextureTask.onLoad(n,o),null===(r=l.panoMeshes[t])||void 0===r||r.setProgress(0),delete l.pendingTextureTask,l.emit("textureLoaded",t,u,n.meta)):(n.body.dispose(),null==o||o.body.dispose())})).catch((function(e){var i,r;(null===(i=l.pendingTextureTask)||void 0===i?void 0:i.hash)===b&&(l.pendingTextureTask.onError(e),null===(r=l.panoMeshes[t])||void 0===r||r.setProgress(0),delete l.pendingTextureTask,l.emit("textureError",e,t,u),l.emit("error",e))})),this.emit("textureStartLoad",t,u)}},i.prototype.initAnimation=function(e,t,i,r){var n,o,s,a=this;if(!this.destroyed){var l=!1;this.pending=!1,this.userAction=r,this.moveToPano(e,{longitude:null!==(n=t.longitude)&&void 0!==n?n:this.defaultLongitude,latitude:gn(null!==(o=t.latitude)&&void 0!==o?o:this.defaultLatitude,this.minLatitude,this.maxLatitude),fov:gn(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}},r)}},i.prototype.panoResourceFromLocationMotionKeyframe=function(e){return this.panoResources[e.key]},i.prototype.locationMotionKeyframesLength=function(e){for(var t=0,i=1;i<e.length;i++){var r=this.panoResourceFromLocationMotionKeyframe(e[i-1]).position,n=this.panoResourceFromLocationMotionKeyframe(e[i]).position;t+=r.distanceTo(n)*(e[i].value.count-e[i-1].value.count)}return t},i.prototype.updatePanoMeshes=function(t){var i=this;void 0===t&&(t=!0);for(var r={},n=0,o=this.panoMeshes;n<o.length;n++)r[(A=o[n]).name]=A;this.panoMeshes.length=0;for(var s=1,a={},l=function(e){if(e.accessibleNodes.length){var t=cs(e.accessibleNodes,(function(t){return gn(i.work.observers[t].standingPosition.distanceTo(e.standingPosition),1,1/0)}),!0),r=t[1];void 0===a[e.panoIndex]&&(a[e.panoIndex]=r)}},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=gn(h.reduce((function(e,t){return e+t}),0)/h.length*.6,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(r[p]?(!0===(A=r[p]).loading&&!1===f.loadable&&A.setLoading(!1),delete r[p]):((A=this.panoCircleMeshCreator()).name=p,this.helper.add(A)),A.scale.set(s,1,s),A.position.copy(f.standingPosition),t&&this.model.loaded&&this.model.bvhs.loaded){var g=new e.Vector3(0,-1,0),m=new e.Vector3(0,.1,0).add(A.position),v=new e.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(r);b<x.length;b++){var w=x[b];this.helper.remove(r[w]),r[w].dispose(),delete r[w]}},i.prototype.generateBoundingMesh=function(t){void 0===t&&(t=!1);for(var i=this.model.bounding.clone(),r=0,n=this.work.observers;r<n.length;r++){var o=n[r];i.expandByPoint(o.standingPosition),i.expandByPoint((new e.Vector3).fromArray([o.position.x,2*o.position.y-o.standingPosition.y,o.position.z]))}t&&i.expandByPoint(this.camera.position);var s=$o(i,new e.Vector3(1,0,1));return s.name="panorama_bounding",s},i.prototype.doMoveToPano=function(t,i,r,n){var o,s,a,l=this;void 0===r&&(r={}),this.userAction=n;var u,c,h,d=je(),p=Yr();if(this.tiling.cleanup(),this.panoResources[p]=i,this.locationMotion.ended){var f=this.locationMotion.getKeyFrameSegment(d),A=(f[0],f[1]),g=this.locationMotion.value,m=this.panoResourceFromLocationMotionKeyframe(A).position,v=i.position;u=Math.max(m.distanceTo(v),1),c=[{key:A.key,progress:0,value:Fe(Fe({},g),{count:0})},{key:p,progress:1,value:{distance:0,perspToOrtho:0,orthoDistance:1,modelAlpha:0,count:1}}],h=0}else{var y=this.locationMotion.getKeyFrameSegment(d),b=y[0],x=(A=y[1],g=this.locationMotion.value,this.panoResourceFromLocationMotionKeyframe(b).position),w=(m=this.panoResourceFromLocationMotionKeyframe(A).position,v=i.position,A.value.count-g.count),M=Math.max(x.distanceTo(m),1)*w;u=M+Math.max(m.distanceTo(v),1),c=[{key:b.key,progress:0,value:Fe({},g)},{key:A.key,progress:M/u,value:A.value},{key:p,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(c);h=0===E||0===E?0:this.locationMotion.getProgressVelocity(d)*E/S}var C=this.calculateMovingDuration(r.duration,"fade"===r.effect||"montage"===r.effect?0:u),I={longitude:r.longitude,latitude:r.latitude,fov:r.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:i.position.clone(),distance:this.camera.pose.distance};this.emit("moveToPano",t,n),r.moveStartCallback&&r.moveStartCallback(t,B),this.emit("panoWillArrive",t,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=Ue,this.videoTexture.needsUpdate=!0),this.panoVideo.setMaterial(null),this.cameraMotion.set(I,C).catch(Ue),this.locationMotion.setKeyframes(c,C,h).then((function(){var i,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};r.moveEndCallback&&r.moveEndCallback(t,a),l.emit("panoArrived",t,a,n);var u=l.work.observers[l.currentPanoIndex];if(u&&u.video&&l.videoTexture&&l.videoTexture.image instanceof HTMLVideoElement){var c=ua.clone().multiply(null!==(s=null===(o=null===(i=l.model.getMaterial())||void 0===i?void 0:i.pano1)||void 0===o?void 0:o.matrix)&&void 0!==s?s:new e.Matrix4).multiply(u.video.matrix),h={map:l.videoTexture,size:u.video.size,matrix:c,alpha:1},d=Yr(),p=l.videoTexture.image;p.setAttribute("uuid",d),qs().then((function(e){e&&u.video&&p.getAttribute("uuid")===d&&(p.oncanplay=function(){p.oncanplay=Ue,p.play()},p.ontimeupdate=function(){p.currentTime>.5&&(p.ontimeupdate=Ue,l.panoVideo.setMaterial(h))},p.src=u.video.source)})).catch((function(){p.removeAttribute("uuid")}))}}),(function(){r.moveCancelCallback&&r.moveCancelCallback(),l.emit("moveToPanoCanceled",t)}))},i.prototype.getForwardPanoIndexOrNot=function(t){var i=this,r=this.work.observers[this.currentPanoIndex];if(!r)return null;var n=null!=t?t:new e.Raycaster(this.camera.position.clone(),this.camera.getWorldDirection(new e.Vector3)),o=new e.Vector3,s=this.model.intersectRaycaster(new e.Raycaster(n.ray.origin,new e.Vector3(0,-1,0)))[0];s&&s.distance<=2?o.copy(s.point):o.copy(n.ray.origin).add(new e.Vector3(0,-1.5,0));var a=this.model.intersectRaycaster(n)[0],l=(a?a.point:n.ray.origin.clone().add(n.ray.direction.clone().normalize().multiplyScalar(3))).clone().sub(o).normalize();if(0===l.length())return null;for(var u=r.accessibleNodes.filter((function(e){if(e===i.currentPanoIndex)return!1;var t=i.work.observers[e],r=t.standingPosition.clone().project(i.camera);return!(Math.abs(r.z)>1)&&!(Math.abs(r.x)>1)&&!(Math.abs(r.y)>1)&&(t.loadable||t.active)})),c=u.slice().sort((function(e,t){return i.work.observers[e].standingPosition.clone().distanceTo(o)-i.work.observers[t].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},i.prototype.onTapGesture=function(t){var i=this,r=t.pointers.map((function(e){return Dt(e,["x","y"])}));if(!this.emit("wantsGesture","tap",r,!0)){var n=this.relativeClientPosition(t.center),o=new e.Raycaster;if(o.setFromCamera(n,this.camera),!this.emit("wantsTapGesture",o,n,!0)){this.emit("gesture","tap",r,!0),this.emit("tapGesture",o,n,!0),this.interiaMovement=!1;var s=this.camera.getWorldDirection(new e.Vector3).setY(0),a=null,l=this.work.observers[this.currentPanoIndex];if(l){var u=l.accessibleNodes.filter((function(e){if(e===i.currentPanoIndex)return!1;var t=i.work.observers[e];return!(t.position.distanceTo(i.camera.position)>i.maxAccessibleDistance)&&(t.loadable||t.active)})),c=this.model.intersectRaycaster(o)[0];if(c){var h=cs(u,(function(e){var t=i.work.observers[e].standingPosition.clone();return t.clone().sub(i.camera.position).setY(0).angleTo(s)>Math.PI/2?1/0:t.distanceTo(c.point)}),!0),d=h[0];h[1]<this.panoTapTriggerRadius&&(a=d)}cn(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),cn(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:Ne(Ne([],[],!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=gn(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))}}}}},i}(Hs),pa=Math.PI/180,fa=180/Math.PI,Aa=function(){var e="undefined"!=typeof navigator&&/iPad|iPhone|iPod/.test(navigator.platform);return function(){return e}}(),ga=function(){var e="undefined"!=typeof navigator&&/^((?!chrome|android).)*safari/i.test(navigator.userAgent);return function(){return e}}(),ma=function(){var e="undefined"!=typeof navigator&&-1!==navigator.userAgent.indexOf("Firefox")&&-1!==navigator.userAgent.indexOf("Android");return function(){return e}}(),va=(sa="undefined"!=typeof navigator?navigator.userAgent.match(/.*Chrome\/([0-9]+)/):null,aa=sa?parseInt(sa[1],10):null,function(){return aa}),ya=function(){var e=!1;if(65===va()){var t="undefined"!=typeof navigator?navigator.userAgent.match(/.*Chrome\/([0-9\.]*)/):null;if(t){var i=t[1].split("."),r=(i[0],i[1],i[2]),n=i[3];e=3325===parseInt(r,10)&&parseInt(n,10)<148}}return function(){return e}}(),ba=function(){var e=Aa()&&ga()&&"undefined"!=typeof navigator&&-1!==navigator.userAgent.indexOf("13_4");return function(){return e}}(),xa=function(){var e="undefined"!=typeof navigator&&-1!==navigator.userAgent.indexOf("R7 Build");return function(){return e}}();function wa(){var e="undefined"!=typeof window&&(90==window.orientation||-90==window.orientation);return xa()?!e:e}var Ma,Ea=(Ma={},function(e,t){void 0===Ma[e]&&(console.warn("cardboard: "+t),Ma[e]=!0)});function Sa(e){var t,i=e.indexOf("://");t=-1!==i?i+3:0;var r=e.indexOf("/",t);return-1===r&&(r=e.length),e.substring(0,r)}var Ca,Ia=function(e,t,i){!function(e,t,i){var r=t?t[0]:0,n=t?t[1]:0,o=t?t[2]:0,s=t?t[3]:1,a=r+r,l=n+n,u=o+o,c=r*a,h=r*l,d=r*u,p=n*l,f=n*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]=0,e[13]=0,e[14]=0,e[15]=1}(e,t),i&&function(e,t,i){var r,n,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]):(r=t[0],n=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]=r,e[1]=n,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]=r*A+a*g+h*m+t[12],e[13]=n*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),function(e,t){var i=t[0],r=t[1],n=t[2],o=t[3],s=t[4],a=t[5],l=t[6],u=t[7],c=t[8],h=t[9],d=t[10],p=t[11],f=t[12],A=t[13],g=t[14],m=t[15],v=i*a-r*s,y=i*l-n*s,b=i*u-o*s,x=r*l-n*a,w=r*u-o*a,M=n*u-o*l,E=c*A-h*f,S=c*g-d*f,C=c*m-p*f,I=h*g-d*A,B=h*m-p*A,T=d*m-p*g,P=v*T-y*B+b*I+x*C-w*S+M*E;P&&(P=1/P,e[0]=(a*T-l*B+u*I)*P,e[1]=(n*B-r*T-o*I)*P,e[2]=(A*M-g*w+m*x)*P,e[3]=(d*w-h*M-p*x)*P,e[4]=(l*C-s*T-u*S)*P,e[5]=(i*T-n*C+o*S)*P,e[6]=(g*b-f*M-m*y)*P,e[7]=(c*M-d*b+p*y)*P,e[8]=(s*B-a*C+u*E)*P,e[9]=(r*C-i*B-o*E)*P,e[10]=(f*w-A*b+m*v)*P,e[11]=(h*b-c*w-p*v)*P,e[12]=(a*S-s*I-l*E)*P,e[13]=(i*I-r*S+n*E)*P,e[14]=(A*y-f*x-g*v)*P,e[15]=(c*x-h*y+d*v)*P)}(e,e)},Ba=function(){function t(t,i){void 0===t&&(t=new e.Vector3),void 0===i&&(i=0),this.sample=t,this.timestampS=i}return t.prototype.set=function(e,t){this.sample=e,this.timestampS=t},t.prototype.copy=function(e){this.set(e.sample,e.timestampS)},t}(),Ta=function(){function t(t,i){this.kFilter=t,this.isDebug=i,this.currentAccelMeasurement=new Ba,this.currentGyroMeasurement=new Ba,this.previousGyroMeasurement=new Ba,Aa()?this.filterQ=new e.Quaternion(-1,0,0,1):this.filterQ=new e.Quaternion(1,0,0,1),this.previousFilterQ=new e.Quaternion,this.previousFilterQ.copy(this.filterQ),this.accelQ=new e.Quaternion,this.isOrientationInitialized=!1,this.estimatedGravity=new e.Vector3,this.measuredGravity=new e.Vector3,this.gyroIntegralQ=new e.Quaternion}return t.prototype.addAccelMeasurement=function(e,t){this.currentAccelMeasurement.set(e,t)},t.prototype.addGyroMeasurement=function(e,t){var i;this.currentGyroMeasurement.set(e,t),i=t-this.previousGyroMeasurement.timestampS,isNaN(i)||i<=.001||i>1||this.run_(),this.previousGyroMeasurement.copy(this.currentGyroMeasurement)},t.prototype.getOrientation=function(){return this.filterQ},t.prototype.run_=function(){if(!this.isOrientationInitialized)return this.accelQ=this.accelToQuaternion_(this.currentAccelMeasurement.sample),this.previousFilterQ.copy(this.accelQ),void(this.isOrientationInitialized=!0);var t=this.currentGyroMeasurement.timestampS-this.previousGyroMeasurement.timestampS,i=this.gyroToQuaternionDelta_(this.currentGyroMeasurement.sample,t);this.gyroIntegralQ.multiply(i),this.filterQ.copy(this.previousFilterQ),this.filterQ.multiply(i);var r=new e.Quaternion;r.copy(this.filterQ),r.inverse(),this.estimatedGravity.set(0,0,-1),this.estimatedGravity.applyQuaternion(r),this.estimatedGravity.normalize(),this.measuredGravity.copy(this.currentAccelMeasurement.sample),this.measuredGravity.normalize();var n,o=new e.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)",fa*((n=o).w>1?0:2*Math.acos(n.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 e.Quaternion;s.copy(this.filterQ),s.multiply(o),this.filterQ.slerp(s,1-this.kFilter),this.previousFilterQ.copy(this.filterQ)},t.prototype.accelToQuaternion_=function(t){var i=new e.Vector3;i.copy(t),i.normalize();var r=new e.Quaternion;return r.setFromUnitVectors(new e.Vector3(0,0,-1),i),r.inverse(),r},t.prototype.gyroToQuaternionDelta_=function(t,i){var r=new e.Quaternion,n=new e.Vector3;return n.copy(t),n.normalize(),r.setFromAxisAngle(n,t.length()*i),r},t}(),Pa=function(){function t(t,i){this.predictionTimeS=t,this.isDebug=i,this.previousQ=new e.Quaternion,this.previousTimestampS=null,this.deltaQ=new e.Quaternion,this.outQ=new e.Quaternion}return t.prototype.getPrediction=function(t,i,r){if(!this.previousTimestampS)return this.previousQ.copy(t),this.previousTimestampS=r,t;var n=new e.Vector3;n.copy(i),n.normalize();var o=i.length();if(o<20*pa)return this.isDebug&&console.log("Moving slowly, at %s deg/s: no prediction",(fa*o).toFixed(1)),this.outQ.copy(t),this.previousQ.copy(t),this.outQ;var s=o*this.predictionTimeS;return this.deltaQ.setFromAxisAngle(n,s),this.outQ.copy(this.previousQ),this.outQ.multiply(this.deltaQ),this.previousQ.copy(t),this.previousTimestampS=r,this.outQ},t}(),Ra=function(){function e(e){this.coefficients=e}return e.prototype.distortInverse=function(e){for(var t=0,i=1,r=e-this.distort(t);Math.abs(i-t)>1e-4;){var n=e-this.distort(i),o=i-n*((i-t)/(n-r));t=i,i=o,r=n}return i},e.prototype.distort=function(e){for(var t=e*e,i=0,r=0;r<this.coefficients.length;r++)i=t*(i+this.coefficients[r]);return(i+1)*e},e}(),Da=function(){this.angularAcceleration=null,this.angularVelocity=null,this.linearAcceleration=null,this.linearVelocity=null,this.orientation=null,this.position=null},ka=function(){this.leftDegrees=0,this.rightDegrees=0,this.upDegrees=0,this.downDegrees=0},La=function(){function t(t,i,r,n){this.viewer={id:"CardboardV1",label:"Cardboard I/O 2014",fov:40,interLensDistance:.06,baselineLensDistance:.035,screenLensDistance:.042,distortionCoefficients:[.441,.156],inverseCoefficients:[-.4410035,.42756155,-.4804439,.5460139,-.58821183,.5733938,-.48303202,.33299083,-.17573841,.0651772,-.01488963,.001559834]},this.device={widthMeters:.11,heightMeters:.062,bevelMeters:.004},this.depthNear=.01,this.depthFar=1e4,this.yawOnly=r,this.accelerometer=new e.Vector3,this.gyroscope=new e.Vector3,this.filter=new Ta(t,n),this.posePredictor=new Pa(i,n),this.isFirefoxAndroid=ma(),this.isIOS=Aa();var o=va();this.isDeviceMotionInRadians=!this.isIOS&&null!==o&&o<66,this.isWithoutDeviceMotion=ya()||ba(),this.filterToWorldQ=new e.Quaternion,Aa()?this.filterToWorldQ.setFromAxisAngle(new e.Vector3(1,0,0),Math.PI/2):this.filterToWorldQ.setFromAxisAngle(new e.Vector3(1,0,0),-Math.PI/2),this.inverseWorldToScreenQ=new e.Quaternion,this.worldToScreenQ=new e.Quaternion,this.originalPoseAdjustQ=new e.Quaternion;var s="undefined"!=typeof window?-window.orientation*Math.PI/180:0;this.originalPoseAdjustQ.setFromAxisAngle(new e.Vector3(0,0,1),s),this.setScreenTransform_(),wa()&&this.filterToWorldQ.multiply(this.inverseWorldToScreenQ),this.resetQ=new e.Quaternion,this.orientationOut_=new Float32Array(4),this.previousTimestampS=Date.now()}return t.prototype.getPosition=function(){return null},t.prototype.getOrientation=function(){var t;if(this.isWithoutDeviceMotion&&this._deviceOrientationQ){this.deviceOrientationFixQ=this.deviceOrientationFixQ||function(){var t=(new e.Quaternion).setFromAxisAngle(new e.Vector3(0,0,-1),0),i=new e.Quaternion;return"undefined"!=typeof window&&-90===window.orientation?i.setFromAxisAngle(new e.Vector3(0,1,0),Math.PI/-2):i.setFromAxisAngle(new e.Vector3(0,1,0),Math.PI/2),t.multiply(i)}(),this.deviceOrientationFilterToWorldQ=this.deviceOrientationFilterToWorldQ||((r=new e.Quaternion).setFromAxisAngle(new e.Vector3(1,0,0),-Math.PI/2),r),t=this._deviceOrientationQ;var i=new e.Quaternion;return i.copy(t),i.multiply(this.deviceOrientationFilterToWorldQ),i.multiply(this.resetQ),i.multiply(this.worldToScreenQ),i.multiplyQuaternions(this.deviceOrientationFixQ,i),this.yawOnly&&(i.x=0,i.z=0,i.normalize()),this.orientationOut_[0]=i.x,this.orientationOut_[1]=i.y,this.orientationOut_[2]=i.z,this.orientationOut_[3]=i.w,this.orientationOut_}var r,n=this.filter.getOrientation();t=this.posePredictor.getPrediction(n,this.gyroscope,this.previousTimestampS);var o=new e.Quaternion;return o.copy(this.filterToWorldQ),o.multiply(this.resetQ),o.multiply(t),o.multiply(this.worldToScreenQ),this.yawOnly&&(o.x=0,o.z=0,o.normalize()),this.orientationOut_[0]=o.x,this.orientationOut_[1]=o.y,this.orientationOut_[2]=o.z,this.orientationOut_[3]=o.w,this.orientationOut_},t.prototype.getPose=function(){var e=new Da;return e.orientation=this.getOrientation(),e},t.prototype.resetPose=function(){this.resetQ.copy(this.filter.getOrientation()),this.resetQ.x=0,this.resetQ.y=0,this.resetQ.z*=-1,this.resetQ.normalize(),wa()&&this.resetQ.multiply(this.inverseWorldToScreenQ),this.resetQ.multiply(this.originalPoseAdjustQ)},t.prototype.getFrameData=function(e){var t=this.getOrientation(),i=this.getEyeOffset(),r=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(r.left),e.rightProjectionMatrix.set(r.right),Ia(e.leftViewMatrix,t,i.left),Ia(e.rightViewMatrix,t,i.right),e},t.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),r=this.onDeviceOrientation_.bind(this);return Aa()&&function(){if("undefined"==typeof window)return!1;if("undefined"==typeof document)return!1;var e=window.self!==window.top,t=Sa(document.referrer),i=Sa(window.location.href);return e&&t!==i}()&&window.addEventListener("message",i),window.addEventListener("orientationchange",t),this.isWithoutDeviceMotion?window.addEventListener("deviceorientation",r):window.addEventListener("devicemotion",e),function(){window.removeEventListener("devicemotion",e),window.removeEventListener("deviceorientation",t),window.removeEventListener("orientationchange",t),window.removeEventListener("message",i)}},t.prototype.getEyeOffset=function(){return{left:[.5*-this.viewer.interLensDistance,0,0],right:[.5*this.viewer.interLensDistance,0,0]}},t.prototype.getEyeProjectionMatrix=function(){var e,t,i=this.getEyeFieldOfView(),r=this.depthNear,n=this.depthFar,o={left:[],right:[]},s=i.left.upDegrees*pa,a=i.left.downDegrees*pa,l=2/((e=i.left.leftDegrees*pa)+(t=i.left.rightDegrees*pa)),u=2/(s+a);return o.left[0]=l,o.left[1]=0,o.left[2]=0,o.left[3]=0,o.left[4]=0,o.left[5]=u,o.left[6]=0,o.left[7]=0,o.left[8]=-(e-t)*l*.5,o.left[9]=(s-a)*u*.5,o.left[10]=n/(r-n),o.left[11]=-1,o.left[12]=0,o.left[13]=0,o.left[14]=n*r/(r-n),o.left[15]=0,s=i.right.upDegrees*pa,a=i.right.downDegrees*pa,l=2/((e=i.right.leftDegrees*pa)+(t=i.right.rightDegrees*pa)),u=2/(s+a),o.right[0]=l,o.right[1]=0,o.right[2]=0,o.right[3]=0,o.right[4]=0,o.right[5]=u,o.right[6]=0,o.right[7]=0,o.right[8]=-(e-t)*l*.5,o.right[9]=(s-a)*u*.5,o.right[10]=n/(r-n),o.right[11]=-1,o.right[12]=0,o.right[13]=0,o.right[14]=n*r/(r-n),o.right[15]=0,o},t.prototype.getEyeFieldOfView=function(){var e=this.viewer,t=this.device,i=new Ra(e.distortionCoefficients),r=e.screenLensDistance,n=(t.widthMeters-e.interLensDistance)/2,o=e.interLensDistance/2,s=e.baselineLensDistance-t.bevelMeters,a=t.heightMeters-s,l=fa*Math.atan(i.distort(n/r)),u=fa*Math.atan(i.distort(o/r)),c=fa*Math.atan(i.distort(s/r)),h=fa*Math.atan(i.distort(a/r)),d=new ka,p=new ka;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}},t.prototype.onDeviceOrientation_=function(t){this._deviceOrientationQ=this._deviceOrientationQ||new e.Quaternion;var i=t.alpha,r=t.beta,n=t.gamma;i=(i||0)*Math.PI/180,r=(r||0)*Math.PI/180,n=(n||0)*Math.PI/180,this._deviceOrientationQ.setFromEuler(new e.Euler(i,r,-n,"YXZ"))},t.prototype.onDeviceMotion_=function(e){this.updateDeviceMotion_(e)},t.prototype.updateDeviceMotion_=function(e){var t=e.accelerationIncludingGravity,i=e.rotationRate,r=e.timeStamp/1e3,n=r-this.previousTimestampS;return n<0?(Ea("fusion-pose-sensor:invalid:non-monotonic","Invalid timestamps detected: non-monotonic timestamp from devicemotion"),void(this.previousTimestampS=r)):n<=.001||n>1?(Ea("fusion-pose-sensor:invalid:outside-threshold","Invalid timestamps detected: Timestamp from devicemotion outside expected range."),void(this.previousTimestampS=r)):(t&&(this.accelerometer.set(-t.x,-t.y,-t.z),i&&(xa()?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,r)),this.filter.addAccelMeasurement(this.accelerometer,r)),void(this.previousTimestampS=r))},t.prototype.onOrientationChange_=function(){this.setScreenTransform_()},t.prototype.onMessage_=function(e){var t=e.data;t&&t.type&&"devicemotion"===t.type.toLowerCase()&&this.updateDeviceMotion_(t.deviceMotionEvent)},t.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 e.Vector3(0,0,1),-Math.PI/2);break;case-90:this.worldToScreenQ.setFromAxisAngle(new e.Vector3(0,0,1),Math.PI/2)}this.inverseWorldToScreenQ.copy(this.worldToScreenQ),this.inverseWorldToScreenQ.inverse()},t}(),Oa=[0,0,.5,1],Fa=[.5,0,.5,1],Na=function(){function t(t){var i=this;this.renderer=t,this.sensor=new La(.98,.04,!1,!1),this.scale=1,this.cameraL=new e.PerspectiveCamera,this.cameraR=new e.PerspectiveCamera;var r=this.sensor.start();this.dispose=function(){var t=i.renderer.getSize(new e.Vector2);i.renderer.setScissor(0,0,t.width,t.height),i.renderer.setViewport(0,0,t.width,t.height),i.renderer.setScissorTest(!1),r()}}return t.prototype.render=function(t,i){var r=this.renderer.getSize(new e.Vector2);if(r.width>r.height){var n=t.autoUpdate;n&&(t.updateMatrixWorld(),t.autoUpdate=!1);var o={x:Math.round(r.width*Oa[0]),y:Math.round(r.height*Oa[1]),width:Math.round(r.width*Oa[2]),height:Math.round(r.height*Oa[3])},s={x:Math.round(r.width*Fa[0]),y:Math.round(r.height*Fa[1]),width:Math.round(r.width*Fa[2]),height:Math.round(r.height*Fa[3])};this.renderer.setScissorTest(!0),this.renderer.autoClear&&this.renderer.clear(),null===i.parent&&i.updateMatrixWorld(),i.matrixWorld.decompose(this.cameraL.position,this.cameraL.quaternion,this.cameraL.scale),i.matrixWorld.decompose(this.cameraR.position,this.cameraR.quaternion,this.cameraR.scale);var a=this.sensor.getEyeOffset();this.cameraL.translateOnAxis((new e.Vector3).fromArray(a.left),this.scale),this.cameraR.translateOnAxis((new e.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(t,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(t,this.cameraR),this.renderer.setViewport(0,0,r.width,r.height),this.renderer.setScissor(0,0,r.width,r.height),this.renderer.setScissorTest(!1),n&&(t.autoUpdate=!0)}else this.renderer.render(t,i)},t.prototype.dispose=function(){},t}(),Va={zh:{TITLE:"眼镜模式",HIT:"请将手机横屏放入 VR 眼镜中"},en:{TITLE:"GLASSES MODE",HIT:"Please put the mobile phone horizontally into the VR glasses."},ja:{TITLE:"メガネモード",HIT:"携帯電話をVRメガネに水平に入れてください。"}},Qa="undefined"!=typeof navigator&&null!==(Ca=Va[navigator.language.split("-")[0]])&&void 0!==Ca?Ca:Va.zh,Ha="\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,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",");\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,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",');\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(Qa.TITLE,'</div>\n <div class="$id-modal-content-hit">').concat(Qa.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');var qa=new e.CircleBufferGeometry(.12,16),Ua=function(){var t=Rn(),i=new e.Texture;return t.onload=function(){if("undefined"!=typeof document){var e=256,r=document.createElement("canvas");r.setAttribute("width",String(e)),r.setAttribute("height",String(e));var n=r.getContext("2d");if(n){n.drawImage(t,0,0,e,e),n.globalCompositeOperation="source-out";n.beginPath(),n.lineWidth=6.4,n.arc(128,128,83.2,0,2*Math.PI),n.strokeStyle="rgba(255, 255, 255, 1.0)",n.closePath(),n.stroke(),i.image=r,i.needsUpdate=!0}}},t.src=Fn,i}(),za=function(){if("undefined"!=typeof document){var t=document.createElement("canvas");t.setAttribute("width",String(512)),t.setAttribute("height",String(512));var i=t.getContext("2d");if(i){var r=256;return i.beginPath(),i.arc(r,r,192,0,2*Math.PI),i.fillStyle="rgba(255, 255, 255, 0.1)",i.closePath(),i.fill(),i.save(),i.beginPath(),i.arc(r,r,192,0,2*Math.PI),i.strokeStyle="rgba(255, 255, 255, 0.5)",i.lineWidth=10.24,i.closePath(),i.stroke(),new e.CanvasTexture(t)}}return null}(),ja=function(){if("undefined"!=typeof document){var t=document.createElement("canvas");t.setAttribute("width",String(512)),t.setAttribute("height",String(512));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 n=i.createRadialGradient(r,r,0,r,r,r);n.addColorStop(0,"rgba(255, 255, 255, 0.0)"),n.addColorStop(.5,"rgba(255, 255, 255, 0.0)"),n.addColorStop(1,"rgba(255, 255, 255, 0.2)"),i.fillStyle=n,i.fill(),i.lineWidth=4.8,i.arc(r,r,187.2,0,2*Math.PI);var o=i.createLinearGradient(0,0,0,512);return o.addColorStop(.02,"rgba(255, 255, 255, 1.0)"),o.addColorStop(.2,"rgba(255, 255, 255, 0.0)"),o.addColorStop(.8,"rgba(255, 255, 255, 0.0)"),o.addColorStop(.98,"rgba(255, 255, 255, 1.0)"),i.strokeStyle=o,i.stroke(),new e.CanvasTexture(t)}}return null}(),_a=function(){if("undefined"!=typeof document){var t=document.createElement("canvas");t.setAttribute("width",String(512)),t.setAttribute("height",String(512));var i=t.getContext("2d");if(i){var r=256,n=179.2;i.arc(r,r,n,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,n,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.5)"),i.fillStyle=o,i.fill(),i.lineWidth=4.8,i.arc(r,r,n-4.8,0,2*Math.PI);var s=i.createLinearGradient(0,0,0,512);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 e.CanvasTexture(t)}}return null}(),Ka=function(){if("undefined"!=typeof document){var t=document.createElement("canvas");t.setAttribute("width",String(512)),t.setAttribute("height",String(512));var i=t.getContext("2d");if(i){var r=256;i.lineWidth=64,i.arc(r,r,217.6,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=64,i.arc(r,r,217.6,0,2*Math.PI);var n=i.createRadialGradient(r,r,185.6,r,r,249.6);n.addColorStop(0,"rgba(255, 255, 255, 0.5)"),n.addColorStop(.3,"rgba(255, 255, 255, 0.0)"),n.addColorStop(.7,"rgba(255, 255, 255, 0.0)"),n.addColorStop(1,"rgba(255, 255, 255, 0.5)"),i.strokeStyle=n,i.stroke(),i.beginPath(),i.lineWidth=4,i.arc(r,r,245.6,0,2*Math.PI);var o=i.createLinearGradient(0,0,512,0);return o.addColorStop(.02,"rgba(255, 255, 255, 1.0)"),o.addColorStop(.1,"rgba(255, 255, 255, 0.0)"),o.addColorStop(.9,"rgba(255, 255, 255, 0.0)"),o.addColorStop(.98,"rgba(255, 255, 255, 1.0)"),i.strokeStyle=o,i.stroke(),new e.CanvasTexture(t)}}return null}(),Ga=function(t){function i(){var i=t.call(this)||this;i.progress=0,i.opacity=0,i.loading=!1,i.current=!1,i.disabled=!1,i.opacityMotion=new On({opacity:0}),i.loadingMotion=new On({opacity:0}),i.currentMotion=new On({ringScale:1.1,ringOpacity:0,circleFade:0,circleOpacity:.5,circleScale:1});var r={blending:e.CustomBlending,blendSrc:e.SrcAlphaFactor,blendDst:e.OneMinusSrcAlphaFactor,blendSrcAlpha:e.OneFactor,blendDstAlpha:e.OneMinusSrcAlphaFactor,depthWrite:!1,transparent:!0};return i.hitTestMesh=new e.Mesh(qa,new e.MeshBasicMaterial(Fe(Fe({},r),{color:0,opacity:0}))),i.hitTestMesh.scale.set(1.5,1.5,1.5),i.centerMesh=new e.Mesh(qa,new e.MeshBasicMaterial(Fe(Fe({},r),{map:ja,opacity:0}))),i.centerMesh2=new e.Mesh(qa,new e.MeshBasicMaterial(Fe(Fe({},r),{map:_a,opacity:0}))),i.ringMesh=new e.Mesh(qa,new e.MeshBasicMaterial(Fe(Fe({},r),{map:Ka,opacity:0}))),i.loadingMesh=new e.Mesh(qa,new e.MeshBasicMaterial(Fe(Fe({},r),{map:Ua,opacity:.8}))),i.disableMesh=new e.Mesh(qa,new e.MeshBasicMaterial(Fe(Fe({},r),{map:za}))),i.loadingMesh.visible=!1,i.disableMesh.visible=!1,i.hitTestMesh.position.z=0,i.ringMesh.position.z=.003,i.disableMesh.position.z=.002,i.centerMesh.position.z=.002,i.centerMesh2.position.z=.002,i.loadingMesh.position.z=.005,i.hitTestMesh.frustumCulled=!1,i.centerMesh.frustumCulled=!1,i.centerMesh2.frustumCulled=!1,i.ringMesh.frustumCulled=!1,i.loadingMesh.frustumCulled=!1,i.disableMesh.frustumCulled=!1,i.add(i.hitTestMesh),i.add(i.centerMesh),i.add(i.centerMesh2),i.add(i.ringMesh),i.add(i.loadingMesh),i.add(i.disableMesh),i.renderOrder=1e4,i.needsRender=!0,i}return Oe(i,t),i.prototype.setProgress=function(e){this.progress=e,this.setLoading(e>0)},i.prototype.setOpacity=function(e){this.opacity!==e&&(this.opacity=e=gn(e,0,1),this.opacityMotion.set({opacity:e},30).catch(Ue))},i.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(Ue)}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(Ue);this.current=e}},i.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)},i.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)},i.prototype.tap=function(){return Promise.resolve()},i.prototype.updateTime=function(e,t){this.opacityMotion.update(e),this.currentMotion.update(e),this.loadingMotion.update(e);var i=this.opacityMotion.value.opacity,r=this.currentMotion.value,n=r.ringScale,o=r.ringOpacity,s=r.circleFade,a=r.circleOpacity,l=r.circleScale;if(this.ringMesh.scale.set(n,n,n),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},i.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()},i}(e.Object3D),Wa=function(t){function i(e){var r=this,n=i.parseArgs(e);(r=t.call(this,n)||this).cardboard=new Na(r.renderer);var o,s,a,l=(s=function(e){for(var t=1,i=document.getElementsByTagName("meta"),r=0;r<i.length;r++){var n=i[r];if("viewport"===n.getAttribute("name")){var o=(n.getAttribute("content")||"").match(/initial\-scale\=([\d|\.]+)/);o&&(t=Number(o[1])),isNaN(t)&&(t=1)}}return Ha.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))}))}(o="five_vr_helper_"+Yr()),(a=document.createElement("div")).className=o,a.innerHTML=s,a);r.helperElement=l;var u=new fs(l);return r.element.parentNode&&(r.element.parentNode.insertBefore(l,r.element),r.setHelperElementSize(),u.on("tap",(function(){return r.emit("vrWantsToExit")}))),r.destroyHelper=function(){u.destroy(),l.parentNode&&l.parentNode.removeChild(l),delete r.helperElement},r.boundingMesh.visible=!0,r}return Oe(i,t),i.parseArgs=function(e){var i=Fe(Fe({},e),{maxLatitude:Math.PI/2,minLatitude:-Math.PI/2});return t.parseArgs.call(this,i)},i.initAnimationEndPose=function(e){var i=this.parseArgs(e);return t.initAnimationEndPose.call(this,i)},i.prototype.destroy=function(){t.prototype.destroy.call(this),this.cardboard.dispose(),this.destroyHelper();for(var e=0,i=this.panoMeshes;e<i.length;e++){var r=i[e];this.helper.remove(r),r.dispose()}this.panoMeshes.length=0},i.prototype.isReady=function(){return!1},i.prototype.updateRenderSize=function(){this.needsRender=!0,this.setHelperElementSize()},i.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],r=new Ga;r.name="panoSphere_".concat(this.work.workCode,"_").concat(t),r.position.copy(i.position),r.needsRender=!0,this.helper.add(r),this.panoMeshes[t]=r}},i.prototype.updateTime=function(t,i){for(var r,n,o=[],s=2;s<arguments.length;s++)o[s-2]=arguments[s];if(!this.destroyed){this.needsRender=!0;var a={},l={};if(!1===this.locationMotion.ended){this.locationMotion.update(t);var u=this.locationMotion.getKeyFrameSegment(t),c=u[0],h=u[1],d=this.panoResourceFromLocationMotionKeyframe(c),p=this.panoResourceFromLocationMotionKeyframe(h),f=this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[0]),A=this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[this.locationMotion.keyframes.length-1]),g=d.position,m=p.position,v=this.locationMotion.value.count-h.value.count+1;a.modelAlpha=this.locationMotion.value.modelAlpha,this.camera.perspToOrtho.setScalar(gn(this.locationMotion.value.perspToOrtho,0,1)),this.camera.orthoDistance=this.locationMotion.value.orthoDistance,a.useBlackTransition="instant"===p.effect,p.panoPicture&&(v<1?d.panoPicture&&(a.pano0=d.panoPicture):a.pano0=p.panoPicture,a.pano1=p.panoPicture),"fade"===p.effect&&(a.pano0&&d.panoPicture&&(a.pano0={map:a.pano0.map,luminanceMap:a.pano0.luminanceMap,matrix:d.panoPicture.matrix.clone().setPosition(p.position)}),g.copy(m)),a.progress=v,l.distance=this.locationMotion.value.distance,l.offset=new e.Vector3(g.x+(m.x-g.x)*v,g.y+(m.y-g.y)*v,g.z+(m.z-g.z)*v);for(var y=[],b=[],x=0,w=this.locationMotion.keyframes;x<w.length;x++){var M=w[x],E=M.key,S=M.progress;void 0!==E&&(y.push(E),S>=this.locationMotion.progress&&b.push(E))}for(var C=0,I=Object.keys(this.panoResources);C<I.length;C++){var B=I[C];if(!(b.indexOf(B)>=0)){var T=this.panoResources[B];if(T.panoPicture){var P=T.panoPicture.map;if(P){if(P===(null===(r=a.pano0)||void 0===r?void 0:r.map))continue;if(P===(null===(n=a.pano1)||void 0===n?void 0:n.map))continue;P.dispose(),T.panoPicture=null}}y.indexOf(B)>=0||delete this.panoResources[B]}}this.currentPanoIndex=v<.5?d.panoIndex:p.panoIndex,this.emit("movingToPano",A.panoIndex,f.panoIndex,this.locationMotion.progress)}!1===hs(a)&&(this.model.setMaterial(a),this.boundingMesh.setMaterial(a)),l.offset&&this.camera.position.copy(l.offset);var R=this.camera.pose.longitude,D=this.camera.pose.latitude;this.camera.quaternion.fromArray(this.cardboard.sensor.getOrientation()),this.camera.updateMatrixWorld(),this.camera.computePose();for(var k=this.work.observers[this.currentPanoIndex].visibleNodes.concat(this.currentPanoIndex),L=0;L<this.work.observers.length;L++){var O=this.work.observers[L];if((V=this.panoMeshes[L]).visible=!0,O.loadable||O.active){if(-1===k.indexOf(L))V.visible=!1;else{V.visible=!0;var F=V.position.clone().setY(this.camera.position.y).distanceTo(this.camera.position);F<.05?V.setOpacity(0):V.setOpacity(gn(1.5/F,0,1)),this.currentPanoIndex===L&&V.setOpacity(0)}V.lookAt(this.camera.position)}else V.visible=!0}var N=this.intersect(t);for(L=0;L<this.work.observers.length;L++)null==(V=this.panoMeshes[L])||V.setCurrent(V===N);for(L=0;L<this.work.observers.length;L++){var V;(V=this.panoMeshes[L])&&V.updateTime&&V.updateTime(t,i)}R===this.camera.pose.longitude&&D===this.camera.pose.latitude||(this.cameraMotion.set(Dt(this.camera.pose,["longitude","latitude"]),0).catch(Ue),this.emit("cameraDirectionUpdate",Dt(this.camera.pose,["longitude","latitude"]),!0),this.emit("cameraUpdate",ds(Dt(this.camera.pose,["longitude","latitude","fov","offset","distance"])),!0))}},i.prototype.render=function(){this.cardboard.render(this.scene,this.camera)},i.prototype.setCamera=function(e){void 0===e&&(e={})},i.prototype.destroyHelper=function(){},i.prototype.setHelperElementSize=function(){if(this.helperElement){var t=new e.Vector2(this.element.offsetWidth,this.element.offsetHeight),i=t.x*this.scissor.left,r=t.y*(1-this.scissor.bottom-this.scissor.height),n=t.x*this.scissor.width,o=t.y*this.scissor.height;this.helperElement.style.marginLeft=i+"px",this.helperElement.style.marginTop=r+"px",this.helperElement.style.width=n+"px",this.helperElement.style.height=o+"px"}},i.prototype.intersect=function(t){var i;if(!1===this.locationMotion.ended)return this.intersectMesh.visible=!1,delete this.activePanoMesh,void delete this.activeTime;if(this.activePanoMesh&&this.activeTime&&t-this.activeTime>1500){var r=this.activePanoMesh;return(u=this.panoMeshes.indexOf(r))>=0&&this.moveToPano(u,{},!0),delete this.activePanoMesh,delete this.activeTime,r}for(var n=this.camera.getWorldDirection(new e.Vector3),o=new e.Raycaster(this.camera.position,n),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!==(i=c.hitTestMesh)&&void 0!==i?i: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=t),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 e.Quaternion;f.setFromUnitVectors(new e.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},i.prototype.onPanGesture=function(){},i.prototype.onTapGesture=function(){},i.prototype.onPinchGesture=function(){},i.prototype.onMouseMove=function(){},i.prototype.onMouseOut=function(){},i}(da),Xa=function(t){function i(e){var r,n,o=this,s=i.parseArgs(e);return(o=t.call(this,s)||this).currentPanoIndex=s.initial[0],o.locationMotion=new On({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!==(n=null===(r=o.model.getMaterial())||void 0===r?void 0:r.modelAlpha)&&void 0!==n?n:0,perspToOrtho:o.camera.perspToOrtho.x,orthoDistance:o.camera.orthoDistance}),o}return Oe(i,t),i.parseArgs=function(e){return t.parseArgs.call(this,e)},i.initAnimationEndPose=function(e){var i=this.parseArgs(e);return t.initAnimationEndPose.call(this,i)},i.prototype.destroy=function(){t.prototype.destroy.call(this),this.locationMotion.dispose()},i.prototype.isReady=function(){return!1!==this.locationMotion.ended&&t.prototype.isReady.call(this)},i.prototype.updateWork=function(e,t,i,r,n){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,n),!0},i.prototype.updateTime=function(t,i){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];if(!this.destroyed){var o={},s={};if(!this.locationMotion.ended){this.locationMotion.update(t),o.modelAlpha=this.locationMotion.value.modelAlpha,this.camera.perspToOrtho.setScalar(gn(this.locationMotion.value.perspToOrtho,0,1)),this.camera.orthoDistance=this.locationMotion.value.orthoDistance,s.distance=this.locationMotion.value.distance,s.offset=new e.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z);var a=new e.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z),l=cs(this.work.observers,(function(e){return e.position.distanceTo(a)}));this.currentPanoIndex=this.work.observers.indexOf(l)}this.cameraMotion.ended||(this.cameraMotion.update(t),s.longitude=this.cameraMotion.value.longitude,s.latitude=this.cameraMotion.value.latitude,s.fov=this.cameraMotion.value.fov),hs(o)||this.model.setMaterial(o),hs(s)||this.setCamera(s)}},i.prototype.initAnimation=function(e,t,i,r){var n,o,s,a=this;this.destroyed||(this.pending=!1,this.userAction=r,this.moveToPano(e,{longitude:null!==(n=t.longitude)&&void 0!==n?n:this.defaultLongitude,latitude:gn(null!==(o=t.latitude)&&void 0!==o?o:this.defaultLatitude,this.minLatitude,this.maxLatitude),fov:gn(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)}},r))},i.prototype.getTargetPose=function(){var t=this.cameraMotion.getKeyFrameSegment(je())[1],i=this.locationMotion.getKeyFrameSegment(je())[1];return{longitude:t.value.longitude,latitude:t.value.latitude,fov:t.value.fov,offset:new e.Vector3(i.value.x,i.value.y,i.value.z),distance:i.value.distance}},i.prototype.moveToPano=function(e,t,i){void 0===t&&(t={});var r=this.work.observers[e];r&&this.moveToPosition(r.position,t,i)},i.prototype.moveToPosition=function(t,i,r){var n,o,s,a=this;void 0===i&&(i={}),this.userAction=r;for(var l=je(),u=new e.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z).distanceTo(t),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(i.duration,u),M={x:t.x,y:t.y,z:t.z,distance:0,modelAlpha:1,perspToOrtho:0,orthoDistance:1},E={longitude:i.longitude,latitude:i.latitude,fov:i.fov},S={longitude:null!==(n=E.longitude)&&void 0!==n?n: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:t.clone(),distance:0},C=cs(this.work.observers,(function(e){return e.position.distanceTo(t)})),I=this.work.observers.indexOf(C);this.emit("moveToPano",I,this.userAction),i.moveStartCallback&&i.moveStartCallback(I,S),this.emit("panoWillArrive",I,S,this.userAction),this.cameraMotion.set(E,w).catch(Ue),this.locationMotion.set(M,w,x).then((function(){var e=ds(a.camera.pose);i.moveEndCallback&&i.moveEndCallback(I,e),a.emit("panoArrived",I,e,a.userAction)}),(function(){i.moveCancelCallback&&i.moveCancelCallback(),a.emit("moveToPanoCanceled",I)}))},i.prototype.onTapGesture=function(t){var i=t.pointers.map((function(e){return Dt(e,["x","y"])}));if(!this.emit("wantsGesture","tap",i,!0)){var r=this.relativeClientPosition(t.center),n=new e.Raycaster;if(n.setFromCamera(r,this.camera),!this.emit("wantsTapGesture",n,r,!0)){this.emit("gesture","tap",i,!0),this.emit("tapGesture",n,r,!0),this.interiaMovement=!1;var o=this.model.intersectRaycaster(n)[0];if(o&&o.face){var s=o.face.normal,a=o.point;if(new e.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);n.set(c,new e.Vector3(0,-1,0)),o=this.model.intersectRaycaster(n)[0]}}if(o){var h=o.point.clone(),d=cs(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()}}},i}(Hs);const Ya=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var i=113,r=126,n=0,o="";return arguments[n].split(o).map((function(e){return e.charCodeAt(n)>r?e:String.fromCharCode((e.charCodeAt(n)+i)%r)})).join(o)}("{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"),Za=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var i=113,r=126,n=0,o="";return arguments[n].split(o).map((function(e){return e.charCodeAt(n)>r?e:String.fromCharCode((e.charCodeAt(n)+i)%r)})).join(o)}("{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");var Ja=Object.assign({opacity:new e.Uniform(1),scale:new e.Uniform(13.1),panoMap:new e.Uniform(null),panoDisplacementMap:new e.Uniform(null),panoPosition:new e.Uniform(new e.Vector3),panoMatrix:new e.Uniform(new e.Matrix4)},{emissive:new e.Uniform(new e.Color(0)),emissiveMap:new e.Uniform(null),specular:new e.Uniform(new e.Color(1118481)),specularMap:new e.Uniform(null),normalMap:new e.Uniform(null),bumpMap:new e.Uniform(null),shininess:new e.Uniform(30)},e.UniformsLib.common,e.UniformsLib.lights),$a=new e.SphereBufferGeometry(.01,128,128),el=function(){function t(e){void 0===e&&(e={}),this.textureLoader=new li({allowHosts:this.allowHosts,requestProxy:this.requestProxy,networkSubscribe:this.networkSubscribe}),this.allowHosts=e.allowHosts,this.requestProxy=e.requestProxy,this.networkSubscribe=e.networkSubscribe}return t.prototype.setAllowHosts=function(e){this.allowHosts=e,this.textureLoader.setAllowHosts(e)},t.prototype.setRequestProxy=function(e){this.requestProxy=e,this.textureLoader.setRequestProxy(e)},t.prototype.setNetworkSubscribe=function(e){this.networkSubscribe=e,this.textureLoader.setNetworkSubscribe(e)},t.prototype.load=function(t,i,r,n,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(t,{imageURL:r,viaAjax:!0},void 0,void 0,(function(e){return h(e,1)}),u),this.textureLoader.loadCubeTexture(i,{imageURL:r,viaAjax:!0},void 0,void 0,(function(e){return h(e,0)}),u)];return Promise.all(d).then((function(t){var i=t[0],r=t[1],a=function(t,i,r,n){var o=new e.ShaderMaterial({side:e.BackSide,vertexShader:Ya,fragmentShader:Za,transparent:!0,uniforms:e.UniformsUtils.clone(Ja)}),s=i;return s.needsUpdate=!0,s.minFilter=e.LinearFilter,s.magFilter=e.LinearFilter,t.needsUpdate=!0,t.minFilter=e.LinearFilter,t.magFilter=e.LinearFilter,o.uniforms.opacity.value=0,o.uniforms.panoMap.value=s,o.uniforms.panoDisplacementMap.value=t,o.uniforms.panoPosition.value=r,o.uniforms.panoMatrix.value=n,Object.assign(new e.Mesh($a,o),{frustumCulled:!1,dispose:function(){this.material instanceof e.ShaderMaterial&&(this.material.uniforms.panoDisplacementMap.value.dispose(),this.material.uniforms.panoDisplacementMap.value=null,this.material.dispose())}})}(i.body,r.body,n,o),l={body:a,meta:Ne([i.meta],r.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(Ue);return a(e),Promise.reject(e)}))},t}(),tl=new e.Vector3(-1,1,1),il=function(t){function i(r){var n,o,s,a,l,u=this,c=i.parseArgs(r);return(u=t.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 e.Group,u.panoModelGroup.name="panoModels",u.scene.add(u.panoModelGroup),u.panoMeshes=[],u.updatePanoMeshes(),u.helper.remove(u.intersectMesh),u.locationMotion=new On({count:0,distance:u.camera.pose.distance,modelAlpha:null!==(o=null===(n=u.model.getMaterial())||void 0===n?void 0:n.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=Yr()]={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 e.Matrix4,position:u.camera.pose.offset.clone(),effect:"fly"},u.depthTextureLoader=new el({allowHosts:u.work.allowHosts,requestProxy:u.requestProxy,networkSubscribe:u.networkSubscribe}),u}return Oe(i,t),i.parseArgs=function(e){var i,r,n,o=t.parseArgs.call(this,e);return Fe(Fe({},o),{maxAccessibleDistance:null!==(i=e.maxAccessibleDistance)&&void 0!==i?i:5,panoTapTriggerRadius:null!==(r=e.panoTapTriggerRadius)&&void 0!==r?r:1,panoCircleMeshCreator:null!==(n=e.panoCircleMeshCreator)&&void 0!==n?n:function(){return new fo}})},i.initAnimationEndPose=function(e){var i=this.parseArgs(e);return t.initAnimationEndPose.call(this,i)},i.prototype.destroy=function(){var e,i=this;if(t.prototype.destroy.call(this),this.locationMotion.dispose(),delete this.pendingTextureTask,this.model&&(this.model.visible=!0),this.panoModelGroup){for(var r=0,n=this.panoModelGroup.children;r<n.length;r++){var o=n[r];"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!==(e=this.model.getMaterial())&&void 0!==e?e:{},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},i.prototype.isReady=function(){return!1===this.locationMotion.ended&&t.prototype.isReady.call(this)},i.prototype.updateWork=function(e,t,i,r,n){this.userAction=n,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:r,longitude:i.longitude,latitude:i.latitude,fov:i.fov},n),!0},i.prototype.updateTime=function(t,i){for(var r,n,o,s=this,a=[],l=2;l<arguments.length;l++)a[l-2]=arguments[l];if(!this.destroyed){var u={},c={},h=this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[0]),d=this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[this.locationMotion.keyframes.length-1]),p=!1;if(!1===this.locationMotion.ended){this.locationMotion.update(t);var f=this.locationMotion.getKeyFrameSegment(t),A=f[0],g=f[1],m=this.panoResourceFromLocationMotionKeyframe(A),v=this.panoResourceFromLocationMotionKeyframe(g),y=(new e.Vector3).copy(m.position),b=(new e.Vector3).copy(v.position),x=this.locationMotion.value.count-g.value.count+1;u.progress=x,u.modelAlpha=this.locationMotion.value.modelAlpha,this.camera.perspToOrtho.setScalar(gn(this.locationMotion.value.perspToOrtho,0,1)),this.camera.orthoDistance=this.locationMotion.value.orthoDistance;for(var w=0,M=this.panoModelGroup.children;w<M.length;w++){var E=M[w];E.visible=E===m.panoModel||E===v.panoModel}m.panoModel&&(m.panoModel.material.uniforms.opacity.value=1-x,m.panoModel.material.depthTest=0!==x),v.panoModel&&(v.panoModel.material.uniforms.opacity.value=x,v.panoModel.material.depthTest=1!==x),v.panoModel&&(x<1?m.panoModel&&(u.pano0={map:m.panoModel.material.uniforms.panoMap.value,luminanceMap:null,matrix:m.matrix}):u.pano0={map:v.panoModel.material.uniforms.panoMap.value,luminanceMap:null,matrix:v.matrix},u.pano1={map:v.panoModel.material.uniforms.panoMap.value,luminanceMap:null,matrix:v.matrix}),p=u.useBlackTransition="instant"===v.effect||"montage"===v.effect,"fade"!==v.effect&&"montage"!==v.effect||(u.pano0&&(u.pano0={map:u.pano0.map,luminanceMap:null,matrix:m.matrix.clone().setPosition(v.position)}),y.copy(b)),c.distance=this.locationMotion.value.distance,c.offset=new e.Vector3(y.x+(b.x-y.x)*x,y.y+(b.y-y.y)*x,y.z+(b.z-y.z)*x);for(var S=[],C=[],I=0,B=this.locationMotion.keyframes;I<B.length;I++){var T=B[I],P=T.key,R=T.progress;void 0!==P&&(S.push(P),R>=this.locationMotion.progress&&C.push(P))}for(var D=0,k=Object.keys(this.panoResources);D<k.length;D++){var L=k[D];if(!(C.indexOf(L)>=0)){var O=this.panoResources[L];if(O.panoModel){if(O.panoModel.material.uniforms.panoMap.value===(null===(r=u.pano0)||void 0===r?void 0:r.map))continue;if(O.panoModel.material.uniforms.panoMap.value===(null===(n=u.pano1)||void 0===n?void 0:n.map))continue;this.panoModelGroup.remove(O.panoModel),O.panoModel.material.uniforms.panoMap.value.dispose(),O.panoModel.dispose(),delete O.panoModel}S.indexOf(L)>=0||delete this.panoResources[L]}}m.workCode===v.workCode?this.currentPanoIndex=x<.5?m.panoIndex:v.panoIndex:this.currentPanoIndex=v.panoIndex,this.emit("movingToPano",d.panoIndex,h.panoIndex,this.locationMotion.progress)}if(!1===this.cameraMotion.ended&&(this.cameraMotion.update(t),c.longitude=this.cameraMotion.value.longitude,c.latitude=this.cameraMotion.value.latitude,c.fov=this.cameraMotion.value.fov),!1===hs(u)&&(this.model.setMaterial(u),this.boundingMesh.setMaterial(u)),!1===hs(c)&&this.setCamera(c),this.camera.pose.distance>.1)for(var F=0;F<this.work.observers.length;F++)(U=this.panoMeshes[F])&&(U.visible=!1);else{var N=this.work.observers[this.currentPanoIndex];if(N){var V=cs(N.visibleNodes,(function(e){return N.standingPosition.distanceTo(s.work.observers[e].standingPosition)}),!0),Q=V[1];Q=gn(Q,3,1/0);var H=N.visibleNodes.concat(this.currentPanoIndex),q=this.getForwardPanoIndexOrNot();for(F=0;F<this.work.observers.length;F++){var U,z=this.work.observers[F];if(U=this.panoMeshes[F])if(z.loadable||z.active)if(-1!==H.indexOf(F))if(p)U.visible=!1,U.setOpacity(0);else{U.visible=!0;var j=U.position.clone().setY(this.camera.position.y).distanceTo(this.camera.position);U.setCurrent(!U.loading&&0===U.progress&&q===F),U.setOpacity(j<.01?0:gn(Q/j*1.2,.75,.98)),U.updateTime&&U.updateTime(t,i)}else U.visible=!1,U.setOpacity(0);else U.visible=!1,U.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)}},i.prototype.getTargetPose=function(){var e=this.cameraMotion.getKeyFrameSegment(je())[1],t=this.locationMotion.getKeyFrameSegment(je())[1],i=this.panoResourceFromLocationMotionKeyframe(t),r=this.work.observers[i.panoIndex];return{longitude:e.value.longitude,latitude:e.value.latitude,fov:e.value.fov,offset:r?r.position.clone():this.camera.position.clone(),distance:0}},i.prototype.moveToPano=function(t,i,r){var n,o=this;void 0===i&&(i={});var s=this.work.observers[t].images.depth,a=Fe({key:"pano.".concat(t),basisLoaderInitialized:oi.isInitialized()},Dt(this.imageOptions,["format","size","quality","sharpen","mappings"])),l=this.imageOptions.transform,u=this.work.observers[t].images,c=this.work.observers[t],h=c.position,d=c.quaternion,p=(new e.Matrix4).compose(h,d,new e.Vector3(-1,1,1)),f="pano:"+Vs(u);if(this.pendingTextureTask){if(this.pendingTextureTask.hash===f)return;var A=this.pendingTextureTask.panoIndex;null===(n=this.panoMeshes[A])||void 0===n||n.setProgress(0),this.emit("textureAbort",A,this.work.observers[A]),this.pendingTextureTask.onError(new Error("texture aborted"))}this.pending=!0,this.pendingTextureTask={panoIndex:t,hash:f,onLoad:function(e){o.pending=!1,o.destroyed?e.body.dispose():(e.body.name=f,o.emit("panoLoaded",t),o.doMoveToPano(t,e.body,i,r))},onError:function(e){o.pending=!1,i.moveCancelCallback&&i.moveCancelCallback(),o.emit("panoLoadError",e,t),o.emit("moveToPanoCanceled",t)}};var g=this.panoMeshes[t];g&&g.tap&&g.tap(),this.depthTextureLoader.load(s,u,{transform:l,options:a},h,p,(function(e){var i,r;(null===(i=o.pendingTextureTask)||void 0===i?void 0:i.hash)===f?(o.pendingTextureTask.onLoad(e),null===(r=o.panoMeshes[t])||void 0===r||r.setProgress(0),delete o.pendingTextureTask,o.emit("textureLoaded",t,o.work.observers[t],e.meta)):e.body.dispose()}),(function(e){var i,r;(null===(i=o.pendingTextureTask)||void 0===i?void 0:i.hash)===f&&(o.pendingTextureTask.onError(e),null===(r=o.panoMeshes[t])||void 0===r||r.setProgress(0),delete o.pendingTextureTask,o.emit("textureError",e,t,o.work.observers[t]),o.emit("error",e))}),(function(e){var i,r;o.emit("textureLoading",e,t,o.work.observers[t]),(null===(i=o.pendingTextureTask)||void 0===i?void 0:i.hash)===f&&(null===(r=o.panoMeshes[t])||void 0===r||r.setProgress(e))}),this.renderer),this.emit("textureStartLoad",t,this.work.observers[t])},i.prototype.initAnimation=function(e,t,i,r){var n,o,s,a=this;if(!this.destroyed){var l=!1;this.pending=!1,this.userAction=r,this.moveToPano(e,{longitude:null!==(n=t.longitude)&&void 0!==n?n:this.defaultLongitude,latitude:gn(null!==(o=t.latitude)&&void 0!==o?o:this.defaultLatitude,this.minLatitude,this.maxLatitude),fov:gn(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=ds(a.camera.pose);!1===l&&a.emit("initAnimationWillStart",a.currentPanoIndex,e,a.userAction),a.emit("initAnimationEnded",a.currentPanoIndex,e,a.userAction)}},r)}},i.prototype.panoResourceFromLocationMotionKeyframe=function(e){return this.panoResources[e.key]},i.prototype.locationMotionKeyframesLength=function(e){for(var t=0,i=1;i<e.length;i++){var r=this.panoResourceFromLocationMotionKeyframe(e[i-1]).position,n=this.panoResourceFromLocationMotionKeyframe(e[i]).position;t+=r.distanceTo(n)*(e[i].value.count-e[i-1].value.count)}return t},i.prototype.updatePanoMeshes=function(){for(var e=this,t={},i=0,r=this.panoMeshes;i<r.length;i++)t[(p=r[i]).name]=p;this.panoMeshes.length=0;for(var n=1,o={},s=function(t){var i=cs(t.accessibleNodes,(function(i){return gn(e.work.observers[i].standingPosition.distanceTo(t.standingPosition),1,1/0)}),!0),r=i[1];void 0===o[t.panoIndex]&&(o[t.panoIndex]=r)},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&&(n=gn(u.reduce((function(e,t){return e+t}),0)/u.length*.6,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(n,1,n),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]}},i.prototype.generateBoundingMesh=function(t){void 0===t&&(t=!1);for(var i=this.model.bounding.clone(),r=0,n=this.work.observers;r<n.length;r++){var o=n[r];i.expandByPoint(o.standingPosition),i.expandByPoint((new e.Vector3).fromArray([o.position.x,2*o.position.y-o.standingPosition.y,o.position.z]))}t&&i.expandByPoint(this.camera.position);var s=$o(i,new e.Vector3(1,0,1));return s.name="panorama_bounding",s.frustumCulled=!1,s},i.prototype.doMoveToPano=function(t,i,r,n){var o,s,a,l,u=this;void 0===r&&(r={}),this.userAction=n;var c,h,d,p=je(),f=Yr(),A=this.work.observers[t],g=this.panoResources[f]={panoIndex:t,workCode:this.work.workCode,effect:null!==(o=r.effect)&&void 0!==o?o:"fly",panoModel:i,matrix:(new e.Matrix4).compose(A.position,A.quaternion,tl),position:A.position.clone()};if(i.visible=!1,i.renderOrder=-1,this.panoModelGroup.add(i),this.locationMotion.ended){var m=this.locationMotion.getKeyFrameSegment(p),v=(m[0],m[1]),y=this.locationMotion.value,b=this.panoResourceFromLocationMotionKeyframe(v).position,x=g.position;c=Math.max(b.distanceTo(x),1),h=[{key:v.key,progress:0,value:Fe(Fe({},y),{count:0})},{key:f,progress:1,value:{distance:0,perspToOrtho:0,modelAlpha:0,orthoDistance:1,count:1}}],d=0}else{var w=this.locationMotion.getKeyFrameSegment(p),M=w[0],E=(v=w[1],y=this.locationMotion.value,this.panoResourceFromLocationMotionKeyframe(M).position),S=(b=this.panoResourceFromLocationMotionKeyframe(v).position,x=g.position,v.value.count-y.count),C=Math.max(E.distanceTo(b),1)*S;c=C+Math.max(b.distanceTo(x),1),h=[{key:M.key,progress:0,value:Fe({},y)},{key:v.key,progress:C/c,value:v.value},{key:f,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(h);d=0===I||0===I?0:this.locationMotion.getProgressVelocity(p)*I/B}var T=this.calculateMovingDuration(r.duration,"fade"===r.effect||"montage"===r.effect?0:c),P={longitude:r.longitude,latitude:r.latitude,fov:r.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:A.position.clone(),distance:this.camera.pose.distance};this.emit("moveToPano",t,this.userAction),r.moveStartCallback&&r.moveStartCallback(t,R),this.emit("panoWillArrive",t,R,this.userAction),this.cameraMotion.set(P,T).catch(Ue),this.locationMotion.setKeyframes(h,T,d).then((function(){var e={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};r.moveEndCallback&&r.moveEndCallback(t,e),u.emit("panoArrived",t,e,n)}),(function(){r.moveCancelCallback&&r.moveCancelCallback(),u.emit("moveToPanoCanceled",t)}))},i.prototype.getForwardPanoIndexOrNot=function(t){var i=this,r=this.camera.getWorldDirection(new e.Vector3),n=this.camera.position.clone(),o=this.work.observers[this.currentPanoIndex];if(!o)return null;var s=o.accessibleNodes.filter((function(t){if(t===i.currentPanoIndex)return!1;var r=i.work.observers[t],o=r.standingPosition.clone().sub(n);return 0!==o.length()&&!(o.angleTo(new e.Vector3(0,-1,0))<Math.PI/12)&&(r.loadable||r.active)})),a=(t?t.ray.direction.clone():r.clone()).setY(0);if(0===a.length())return null;for(var l=s.slice().sort((function(e,t){var r=i.work.observers[e].position.clone().setY(n.y),o=i.work.observers[t].position.clone().setY(n.y);return r.distanceTo(n)-o.distanceTo(n)})),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(n.y).sub(n);if(0!==A.length()&&a.angleTo(A)<h)return f}return null},i.prototype.onTapGesture=function(t){var i=this,r=t.pointers.map((function(e){return Dt(e,["x","y"])}));if(!this.emit("wantsGesture","tap",r,!0)){var n=this.relativeClientPosition(t.center),o=new e.Raycaster;if(o.setFromCamera(n,this.camera),!this.emit("wantsTapGesture",o,n,!0)){this.emit("gesture","tap",r,!0),this.emit("tapGesture",o,n,!0),this.interiaMovement=!1;var s=this.camera.getWorldDirection(new e.Vector3).setY(0),a=null,l=this.work.observers[this.currentPanoIndex];if(l){var u=l.accessibleNodes.filter((function(e){if(e===i.currentPanoIndex)return!1;var t=i.work.observers[e];return!(t.position.distanceTo(i.camera.position)>i.maxAccessibleDistance)&&(t.loadable||t.active)})),c=o.intersectObject(this.boundingMesh,!0)[0];if(c){var h=cs(u,(function(e){var t=i.work.observers[e].standingPosition.clone();return t.clone().sub(i.camera.position).setY(0).angleTo(s)>Math.PI/2?1/0:t.distanceTo(c.point)}),!0),d=h[0];h[1]<this.panoTapTriggerRadius&&(a=d)}cn(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),cn(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 e.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:Ne(Ne([],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=gn(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))}}}}},i}(Hs),rl=90;function nl(t,i){var r=new e.Vector3;return r.setFromMatrixColumn(i,0),r.multiplyScalar(-t),r}function ol(t,i,r){var n=new e.Vector3;return n.setFromMatrixColumn(r,0),n.crossVectors(i,n),n.multiplyScalar(t),n}var sl=function(t){function i(e){var r,n,o=this,s=i.parseArgs(e);return(o=t.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 On({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!==(n=null===(r=o.model.getMaterial())||void 0===r?void 0:r.modelAlpha)&&void 0!==n?n:0,perspToOrtho:o.camera.perspToOrtho.x,orthoDistance:o.camera.orthoDistance}),o}return Oe(i,t),i.parseArgs=function(e){var i,r,n,o,s,a,l,u=t.parseArgs.call(this,e);return Fe(Fe({},u),{defaultLongitude:null!==(i=e.defaultLongitude)&&void 0!==i?i:Math.PI/4,defaultLatitude:null!==(r=e.defaultLatitude)&&void 0!==r?r:Math.PI/4,defaultDistance:null!==(n=e.defaultDistance)&&void 0!==n?n:100,maxLatitude:null!==(o=e.maxLatitude)&&void 0!==o?o:+Math.PI/2,minLatitude:null!==(s=e.minLatitude)&&void 0!==s?s:0,maxDistance:null!==(a=e.maxDistance)&&void 0!==a?a:100,minDistance:null!==(l=e.minDistance)&&void 0!==l?l:2})},i.distanceFromModel=function(e,t,i){var r=e.bounding,n=Math.pow(Math.pow(r.max.x-r.min.x+1,2)+Math.pow(r.max.y-r.min.y+1,2)+Math.pow(r.max.z-r.min.z+1,2),.5),o=n/2/Math.tan(Math.PI*t/360);return i<1&&(o/=i),isNaN(o)?n:o},i.initAnimationEndPose=function(e){var t,r,n=this.parseArgs(e),o=e.initial[0],s=e.initial[1];return{longitude:null!==(t=s.longitude)&&void 0!==t?t:n.defaultLongitude,latitude:gn(null!==(r=s.latitude)&&void 0!==r?r:n.defaultLatitude,n.minLatitude,n.maxLatitude),fov:rl,offset:n.work.observers[o].position.clone(),distance:i.distanceFromModel(n.model,rl,n.camera.aspect)}},i.prototype.destroy=function(){t.prototype.destroy.call(this),this.model.enableTiles=!1,this.locationMotion.dispose(),this.mouseWheelState&&clearTimeout(this.mouseWheelState.timer),delete this.mouseWheelState,delete this.panState},i.prototype.isReady=function(){return!1!==this.locationMotion.ended&&t.prototype.isReady.call(this)},i.prototype.updateWork=function(e,t,i,r,n){return this.work=e,this.updateCamera(i,r,n),!0},i.prototype.updateModel=function(i){t.prototype.updateModel.call(this,i);var r=i.bounding.getCenter(new e.Vector3);this.locationMotion.set({x:r.x,y:r.y,z:r.z},0).catch(Ue),this.model.enableTiles=!0},i.prototype.updateTime=function(t,i){if(!this.destroyed){var r={},n={};this.locationMotion.ended||(this.locationMotion.update(t),r.modelAlpha=this.locationMotion.value.modelAlpha,this.camera.perspToOrtho.setScalar(gn(this.locationMotion.value.perspToOrtho,0,1)),this.camera.orthoDistance=this.locationMotion.value.orthoDistance,n.distance=this.locationMotion.value.distance,n.offset=new e.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z)),this.cameraMotion.ended||(this.cameraMotion.update(t),n.longitude=this.cameraMotion.value.longitude,n.latitude=this.cameraMotion.value.latitude,n.fov=this.cameraMotion.value.fov),hs(r)||this.model.setMaterial(r),hs(n)||this.setCamera(n)}},i.prototype.setCamera=function(i){t.prototype.setCamera.call(this,i);var r=this.camera.pose.offset.clone();if(this.model.bvhs.loaded){var n=new e.Raycaster(this.camera.getWorldPosition(new e.Vector3),this.camera.getWorldDirection(new e.Vector3)),o=this.model.intersectRaycaster(n)[0];o&&r.copy(o.point)}var s=cs(this.work.observers,(function(e){return e.position.distanceTo(r)})),a=this.work.observers.indexOf(s);a!==this.currentPanoIndex&&(this.emit("moveToPano",a,this.userAction),this.emit("panoWillArrive",a,ds(this.camera.pose),this.userAction),this.currentPanoIndex=a,this.emit("panoArrived",a,ds(this.camera.pose),this.userAction))},i.prototype.getTargetPose=function(){var t=this.cameraMotion.getKeyFrameSegment(je())[1],i=this.locationMotion.getKeyFrameSegment(je())[1];return{longitude:t.value.longitude,latitude:t.value.latitude,fov:t.value.fov,distance:i.value.distance,offset:new e.Vector3(i.value.x,i.value.y,i.value.z)}},i.prototype.initAnimation=function(t,r,n,o){var s,a,l=this;if(!this.destroyed){this.pending=!1,this.userAction=o;var u={longitude:null!==(s=r.longitude)&&void 0!==s?s:this.defaultLongitude,latitude:gn(null!==(a=r.latitude)&&void 0!==a?a:this.defaultLatitude,this.minLatitude,this.maxLatitude),fov:rl,offset:this.model.bounding.getCenter(new e.Vector3),distance:i.distanceFromModel(this.model,rl,this.camera.aspect)},c=Dt(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",t,u,this.userAction),this.cameraMotion.set(c,n).catch(Ue),this.locationMotion.set(h,n).then((function(){l.emit("initAnimationEnded",t,u,l.userAction)}),(function(e){var i=ds(l.camera.pose);l.emit("initAnimationEnded",t,i,l.userAction)})).then((function(){l.model.enableTiles=!0}))}},i.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 r=cs(t,(function(e){return e.standingPosition.distanceTo(i.point)}),!0),n=r[0];return r[1]<5?this.work.observers.indexOf(n):null},i.prototype.coordinatesForOffset=function(t){var i=this.cameraMotion.value.fov,r=this.camera.aspect,n=this.renderer.getSize(new e.Vector2);return{longitude:2*t.x/(n.x*this.scissor.width)*i/95*r,latitude:-2*t.y/(n.y*this.scissor.height)*i/95}},i.prototype.onPanGesture=function(t){var i=this.panState,r=t.pointers.length;if(t.isFinal?delete this.panState:this.panState={pointerLength:r,x:t.center.x,y:t.center.y},void 0!==i&&i.pointerLength===r){var n=t.pointers.map((function(e){return Dt(e,["x","y"])}));if(!this.emit("wantsGesture","pan",n,t.isFinal))if("mouse"===t.pointerType&&2===t.srcEvent.buttons){var o={x:t.center.x-i.x,y:t.center.y-i.y},s=new e.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z),a=this.model.bounding,l=a.getCenter(new e.Vector3),u={x:(a.max.x-a.min.x)/rl*this.cameraMotion.value.fov,y:(a.max.y-a.min.y)/rl*this.cameraMotion.value.fov,z:(a.max.z-a.min.z)/rl*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 e.Vector2);s.add(nl(2*o.x*c/h.y,this.camera.matrix)),s.add(ol(2*o.y*c/h.y,this.camera.up,this.camera.matrix)),s.x=gn(s.x,l.x-u.x,l.x+u.x),s.z=gn(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,t.isFinal))return;this.emit("gesture","pan",n,t.isFinal),this.emit("panGesture",d,t.isFinal),this.userAction=!0,this.locationMotion.set({x:s.x,y:s.y,z:s.z},0).catch(Ue)}else{s={x:t.center.x-i.x,y:t.center.y-i.y};var p=this.coordinatesForOffset(s),f=is(this.cameraMotion.value.longitude+-1*p.longitude),A=gn(this.cameraMotion.value.latitude+-1*p.latitude,this.minLatitude,this.maxLatitude);if(this.camera.aspect<1&&Math.abs(t.overallVelocityX)>.2&&Math.atan2(Math.abs(t.overallVelocityY),Math.abs(t.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},this.emit("wantsPanGesture",d,t.isFinal))return;this.emit("gesture","pan",n,t.isFinal),this.emit("panGesture",d,t.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(Ue),t.isFinal&&!this.emit("wantsInteriaPan",d)){this.interiaMovement=!0;var m=t.velocityX,v=.6*t.velocityY;Math.abs(v)>.5&&Math.abs(m)<.5&&(m=0)}}}},i.prototype.onPinchGesture=function(t){var i=this.pinchState||{},r=i.distance,n=(i.offsetY,!1);if("pinchstart"!==t.type){if("pinchend"===t.type&&(n=!0,delete this.pinchState),void 0!==r){this.pinchState={distance:r};var o=t.pointers.map((function(e){return Dt(e,["x","y"])}));if(this.emit("wantsGesture","pinch",o,n))return;var s=gn(r/t.scale,this.minDistance,this.maxDistance);if(this.emit("wantsPinchGesture",t.scale,this.camera.pose.fov,n))return;this.emit("gesture","pinch",o,n),this.emit("pinchGesture",t.scale,this.camera.pose.fov,n),this.userAction=!0,this.locationMotion.set({distance:s},0).catch(Ue)}var a=this.panState,l=t.pointers.length;if(t.isFinal?delete this.panState:this.panState={pointerLength:l,x:t.center.x,y:t.center.y},void 0!==a&&a.pointerLength===l){var u=t.pointers.map((function(e){return Dt(e,["x","y"])}));if(!this.emit("wantsGesture","pinch",u,n)){var c=t.pointers.map((function(e){return Dt(e,["x","y"])}));if(!this.emit("wantsGesture","pinch",c,n)){var h={x:t.center.x-a.x,y:t.center.y-a.y},d=new e.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z),p=this.model.bounding,f=p.getCenter(new e.Vector3),A={x:(p.max.x-p.min.x)/rl*this.cameraMotion.value.fov,y:(p.max.y-p.min.y)/rl*this.cameraMotion.value.fov,z:(p.max.z-p.min.z)/rl*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 e.Vector2);d.add(nl(2*h.x*g/m.y,this.camera.matrix)),d.add(ol(2*h.y*g/m.y,this.camera.up,this.camera.matrix)),d.x=gn(d.x,f.x-A.x,f.x+A.x),d.z=gn(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,t.isFinal)||(this.emit("gesture","pan",c,t.isFinal),this.emit("panGesture",v,t.isFinal),this.userAction=!0,this.locationMotion.set({x:d.x,y:d.y,z:d.z},0).catch(Ue))}}}}else this.pinchState={distance:this.locationMotion.value.distance}},i.prototype.onMouseWheel=function(e){var t=this,i=(Math.abs(e.deltaY)>Math.abs(e.deltaX)?e.deltaY:e.deltaX)/-60,r=[{x:e.clientX,y:e.clientY,delta:i}];if(!this.emit("wantsGesture","mouseWheel",r,!1)){var n=gn(this.locationMotion.value.distance-i/2,this.minDistance,this.maxDistance);this.emit("wantsMouseWheel",i,this.camera.pose.fov,!1)||(this.emit("gesture","mouseWheel",r,!1),this.emit("mouseWheel",i,this.camera.pose.fov,!1),this.userAction=!0,this.locationMotion.set({distance:n},0).catch(Ue),this.mouseWheelState&&clearTimeout(this.mouseWheelState.timer),this.mouseWheelState={timer:window.setTimeout((function(){delete t.mouseWheelState,t.emit("wantsGesture","mouseWheel",r,!0)||t.emit("wantsMouseWheel",i,t.camera.pose.fov,!0)||(t.emit("gesture","mouseWheel",r,!0),t.emit("mouseWheel",0,t.camera.pose.fov,!0))}),200)})}},i.prototype.onTapGesture=function(t){var i=t.pointers.map((function(e){return Dt(e,["x","y"])}));if(!this.emit("wantsGesture","tap",i,!0)){var r=this.relativeClientPosition(t.center),n=new e.Raycaster;if(n.setFromCamera(r,this.camera),!this.emit("wantsTapGesture",n,r,!0)){this.emit("gesture","tap",i,!0),this.emit("tapGesture",n,r,!0),this.interiaMovement=!1;var o=this.getForwardPanoIndexOrNot(n);if(!cn(o)){this.emit("panoSelected",o);var s={longitude:this.camera.pose.longitude,latitude:0};this.emit("wantsMoveToPano",o,s,!0)}}}},i.prototype.onPressGesture=function(t,i){var r,n,o=[t];if(this.emit("wantsGesture","press",o,i))return null===(r=this.pressState)||void 0===r||r.stop(),void delete this.pressState;var s=this.relativeClientPosition(t),a=new e.Raycaster;if(a.setFromCamera(s,this.camera),this.emit("wantsPressGesture",a,s,t.delta,i))return null===(n=this.pressState)||void 0===n||n.stop(),void delete this.pressState;this.emit("gesture","press",o,i),this.emit("pressGesture",a,s,t.delta,i)},i}(Es),al={type:"move"},ll=function(){function t(){this._targetRay=null,this._grip=null,this._hand=null,this._axes=[0,0]}return t.prototype.getHandSpace=function(){return null===this._hand&&(this._hand=new e.Group,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand},t.prototype.getTargetRaySpace=function(){return null===this._targetRay&&(this._targetRay=new e.Group,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new e.Vector3,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new e.Vector3),this._targetRay},t.prototype.getGripSpace=function(){return null===this._grip&&(this._grip=new e.Group,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new e.Vector3,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new e.Vector3),this._grip},t.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},t.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},t.prototype.getAxes=function(){return this._axes},t.prototype.update=function(t,i,r){var n=null,o=null,s=null,a=this._targetRay,l=this._grip,u=this._hand;if(t&&t.gamepad&&t.gamepad.axes&&(this._axes=[t.gamepad.axes[2],t.gamepad.axes[3]]),t&&"visible-blurred"!==i.session.visibilityState)if(null!==a&&null!==(n=i.getPose(t.targetRaySpace,r))&&(a.matrix.fromArray(n.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),n.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(n.linearVelocity)):a.hasLinearVelocity=!1,n.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(n.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(al)),u&&t.hand){s=!0;for(var c=0,h=t.hand.values();c<h.length;c++){var d=h[c],p=i.getJointPose(d,r);if(void 0===u.joints[d.jointName]){var f=new e.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:t.handedness,target:this})):!u.inputState.pinching&&v<=.015&&(u.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else null!==l&&t.gripSpace&&null!==(o=i.getPose(t.gripSpace,r))&&(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!==n),null!==l&&(l.visible=null!==o),null!==u&&(u.visible=null!==s),this},t}(),ul=function(t){function i(i,r,n){var o,s,a,l=this;return(l=t.call(this)||this).isPanorama=null===(o=null==n?void 0:n.isPanorama)||void 0===o||o,l.machineType=null!==(s=null==n?void 0:n.machineType)&&void 0!==s?s:"Pico",l.renderer=i,l.gl=r,l.enabled=!1,l.session=null,l.referenceSpaceType=null!==(a=null==n?void 0:n.referenceSpaceType)&&void 0!==a?a:"local-floor",l.referenceSpace=null,l.controllers=[new ll,new ll],l.inputSourcesMap=new Map,l.cameraVR=new e.ArrayCamera,l.cameraL=new e.PerspectiveCamera,l.cameraR=new e.PerspectiveCamera,l.cameraL.viewport=new e.Vector4,l.cameraR.viewport=new e.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 e.Vector3,l.cameraRPos=new e.Vector3,l}return Oe(i,t),i.prototype.getController=function(e){var t=this.controllers[e];return t||console.warn("no controller find"),t.getTargetRaySpace()},i.prototype.getCameras=function(){return{cameraL:this.cameraL,cameraR:this.cameraR,cameraVR:this.cameraVR}},i.prototype.updateCamera=function(e,t){null===t?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(t.matrixWorld,e.matrix),e.matrixWorldInverse.getInverse(e.matrixWorld)},i.prototype.setProjectionFromUnion=function(e,t,i){this.cameraLPos.setFromMatrixPosition(t.matrixWorld),this.cameraRPos.setFromMatrixPosition(i.matrixWorld);var r=this.cameraLPos.distanceTo(this.cameraRPos),n=t.projectionMatrix.elements,o=i.projectionMatrix.elements,s=n[14]/(n[10]-1),a=n[14]/(n[10]+1),l=(n[9]+1)/n[5],u=(n[9]-1)/n[5],c=(n[8]-1)/n[0],h=(o[8]+1)/o[0],d=s*c,p=s*h,f=r/(-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+(r-A),b=l*a/m*g,x=u*a/m*g;e.projectionMatrix.makePerspective(v,y,b,x,g,m)},i.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 r=0;r<i.length;r++)this.updateCamera(i[r],t);e.matrixWorld.copy(this.cameraVR.matrixWorld);for(var n=e.children,o=(r=0,n.length);r<o;r++)n[r].updateMatrixWorld(!0);return 2===i.length?this.setProjectionFromUnion(this.cameraVR,this.cameraL,this.cameraR):this.cameraVR.projectionMatrix.copy(this.cameraL.projectionMatrix),this.cameraVR},i.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 r=e.removed[i];(n=this.inputSourcesMap.get(r))&&(n.dispatchEvent({type:"disconnected",data:r}),this.inputSourcesMap.delete(r))}for(i=0;i<e.added.length;i++){var n;r=e.added[i],(n=this.inputSourcesMap.get(r))&&n.dispatchEvent({type:"connected",data:r})}}else console.warn("session is lose!")},i.prototype.onSessionEvent=function(e){var t=this.inputSourcesMap.get(e.inputSource);t&&t.dispatchEvent({type:e.type})},i.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,ft.shared.setContext(null),this.emit("webXRSessionEnd")},i.prototype.onRequestReferenceSpace=function(e){this.referenceSpace=e,this.isPresenting=!0,this.emit("webXRSessionStart")},i.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!")}))}},i}(qe),cl=["webXRSessionStart","webXRSessionEnd"],hl=function(t){function i(){var i=t.call(this)||this;return i.type="LineSegmentsGeometry",i.setIndex([0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5]),i.setAttribute("position",new e.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)),i.setAttribute("uv",new e.Float32BufferAttribute([-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],2)),i}return Oe(i,t),i.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},i.prototype.setPositions=function(t){var i;i=t instanceof Float32Array?t:Array.isArray(t)?new Float32Array(t):new Float32Array;var r=new e.InstancedInterleavedBuffer(i,6,1);return this.setAttribute("instanceStart",new e.InterleavedBufferAttribute(r,3,0)),this.setAttribute("instanceEnd",new e.InterleavedBufferAttribute(r,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this},i.prototype.setColors=function(t){var i;i=t instanceof Float32Array?t:Array.isArray(t)?new Float32Array(t):new Float32Array;var r=new e.InstancedInterleavedBuffer(i,6,1);return this.setAttribute("instanceColorStart",new e.InterleavedBufferAttribute(r,3,0)),this.setAttribute("instanceColorEnd",new e.InterleavedBufferAttribute(r,3,3)),this},i.prototype.fromWireframeGeometry=function(e){return this.setPositions(e.attributes.position.array),this},i.prototype.fromEdgesGeometry=function(e){return this.setPositions(e.attributes.position.array),this},i.prototype.fromMesh=function(t){return this.fromWireframeGeometry(new e.WireframeGeometry(t.geometry)),this},i.prototype.fromLineSegments=function(t){var i=t.geometry;if(i instanceof e.Geometry){var r=(new e.BufferGeometry).fromGeometry(i);this.setPositions(r.attributes.position.array)}else i instanceof e.BufferGeometry&&this.setPositions(i.attributes.position.array);return this},i.prototype.computeBoundingBox=function(){null===this.boundingBox&&(this.boundingBox=new e.Box3);var t=this.attributes.instanceStart,i=this.attributes.instanceEnd;if(void 0!==t&&void 0!==i){var r=new e.Box3;this.boundingBox.setFromBufferAttribute(t),r.setFromBufferAttribute(i),this.boundingBox.union(r)}},i.prototype.computeBoundingSphere=function(){null===this.boundingSphere&&(this.boundingSphere=new e.Sphere),null===this.boundingBox&&this.computeBoundingBox();var t=this.attributes.instanceStart,i=this.attributes.instanceEnd;if(void 0!==t&&void 0!==i){var r=this.boundingSphere.center;this.boundingBox.getCenter(r);for(var n=0,o=new e.Vector3,s=0,a=t.count;s<a;s++)o.fromBufferAttribute(t,s),n=Math.max(n,r.distanceToSquared(o)),o.fromBufferAttribute(i,s),n=Math.max(n,r.distanceToSquared(o));this.boundingSphere.radius=Math.sqrt(n),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}},i.prototype.toJSON=function(){},i}(e.InstancedBufferGeometry);Object.assign(hl.prototype,{isLineSegmentsGeometry:!0});var dl={uniforms:e.UniformsUtils.merge([e.UniformsLib.common,e.UniformsLib.fog,{linewidth:{value:1},resolution:{value:new e.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"},pl=function(t){function i(i){var r=t.call(this,{uniforms:e.UniformsUtils.clone(dl.uniforms),vertexShader:dl.vertexShader,fragmentShader:dl.fragmentShader,clipping:!0})||this;return r.type="LineMaterial",r.dashed=!1,Object.defineProperties(r,{color:{enumerable:!0,get:function(){return this.uniforms.diffuse.value},set:function(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)}}}),r.setValues(i),r}return Oe(i,t),i}(e.ShaderMaterial);Object.assign(pl.prototype,{isLineMaterial:!0});var fl=function(t){function i(e,i){var r=t.call(this)||this;return r.type="LineSegments2",r.geometry=void 0!==e?e:new hl,r.material=void 0!==i?i:new pl({color:16777215*Math.random()}),r}return Oe(i,t),i.prototype.computeLineDistances=function(){for(var t=this.geometry,i=t.attributes.instanceStart,r=t.attributes.instanceEnd,n=new Float32Array(2*i.count),o=new e.Vector3,s=new e.Vector3,a=0,l=0,u=i.count;a<u;a++,l+=2)o.fromBufferAttribute(i,a),s.fromBufferAttribute(r,a),n[l]=0===l?0:n[l-1],n[l+1]=n[l]+o.distanceTo(s);var c=new e.InstancedInterleavedBuffer(n,2,1);return t.setAttribute("instanceDistanceStart",new e.InterleavedBufferAttribute(c,1,0)),t.setAttribute("instanceDistanceEnd",new e.InterleavedBufferAttribute(c,1,1)),this},i.prototype.raycast=function(t,i){null===t.camera&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2.');var r=t.ray,n=t.camera,o=n.projectionMatrix,s=this.geometry,a=this.material,l=a.resolution,u=a.linewidth,c=s.attributes.instanceStart,h=s.attributes.instanceEnd,d=new e.Vector4,p=new e.Vector4,f=new e.Vector4,A=new e.Vector3,g=new e.Matrix4,m=new e.Line3,v=new e.Vector3;r.at(1,f),f.w=1,f.applyMatrix4(n.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(n.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=e.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 e.Vector3,T=new e.Vector3;r.distanceSqToSegment(m.start,m.end,T,B),i.push({point:T,pointOnLine:B,distance:r.origin.distanceTo(T),object:this,faceIndex:b})}}}},i}(e.Mesh);Object.assign(fl.prototype,{isLineSegments2:!0});var Al=function(e){function t(t,i){var r=e.call(this,t,i)||this;return r.type="Line2",r}return Oe(t,e),t}(fl);Object.assign(Al.prototype,{isLine2:!0});var gl=function(t){function i(){var e=t.call(this)||this;return e.type="LineGeometry",e}return Oe(i,t),i.prototype.setPositions=function(e){for(var i=e.length-3,r=new Float32Array(2*i),n=0;n<i;n+=3)r[2*n]=e[n],r[2*n+1]=e[n+1],r[2*n+2]=e[n+2],r[2*n+3]=e[n+3],r[2*n+4]=e[n+4],r[2*n+5]=e[n+5];return t.prototype.setPositions.call(this,r),this},i.prototype.setColors=function(e){for(var i=e.length-3,r=new Float32Array(2*i),n=0;n<i;n+=3)r[2*n]=e[n],r[2*n+1]=e[n+1],r[2*n+2]=e[n+2],r[2*n+3]=e[n+3],r[2*n+4]=e[n+4],r[2*n+5]=e[n+5];return t.prototype.setColors.call(this,r),this},i.prototype.fromLine=function(t){var i=t.geometry;if(i instanceof e.Geometry){var r=(new e.BufferGeometry).fromGeometry(i);this.setPositions(r.attributes.position.array)}else i instanceof e.BufferGeometry&&this.setPositions(i.attributes.position.array);return this},i.prototype.copy=function(){return this},i}(hl);Object.assign(gl.prototype,{isLineGeometry:!0});var ml=14467195,vl=null,yl=function(t){function i(i,r){void 0===i&&(i=new e.Vector3),void 0===r&&(r=new e.Vector3);var n=t.call(this)||this;n.type="FiveLine",n.needsRender=!0;var o=new gl,s=new pl({color:ml,linewidth:2,dashScale:20,dashed:!1});n.line=new Al(o,s);var a=new e.BufferGeometry,l=new e.PointsMaterial({color:ml,size:8,map:vl||(vl=(new e.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 n.points=new e.Points(a,l),n.points.renderOrder=11,n.points.frustumCulled=!1,n.setPoints(i,r),n.add(n.line,n.points),n}return Oe(i,t),Object.defineProperty(i,"version",{get:function(){return"5.0.0-alpha.164"},enumerable:!1,configurable:!0}),i.prototype.setPoints=function(t,i){var r=[].concat(t.toArray(),i.toArray());this.points.geometry.setAttribute("position",new e.BufferAttribute(new Float32Array(r),3)),this.line.geometry.setPositions(r),this.line.computeLineDistances(),this.needsRender=!0},i.prototype.getPoints=function(){var t=this.points.geometry.attributes.position.array;return[new e.Vector3(t[0],t[1],t[2]),new e.Vector3(t[3],t[4],t[5])]},i.prototype.setMaterial=function(e){var t=this.line.material;for(var i in e)if(e.hasOwnProperty(i)){var r=e[i];"dashed"===i?(t.dashed=r,r?t.defines.USE_DASH="":delete t.defines.USE_DASH,t.needsUpdate=!0):t[i]=e[i]}this.needsRender=!0},i.prototype.setResolution=function(e,t){var i=this.line.material.resolution;i.x===e&&i.y===t||(i.set(e,t),this.needsRender=!0)},i}(e.Object3D);Object.assign(yl.prototype,{isFiveLine:!0});var bl=300,xl=(new e.Matrix4).makeRotationAxis(new e.Vector3(0,1,0),Math.PI),wl=new e.Vector3(-1,1,1),Ml=function(t){function i(i){var r=t.call(this,i)||this;r.xrManager=new ul(r.renderer,r.renderer.getContext()),r.xrControllerRay=new e.Raycaster,r.pointerLine=new yl,r.scene.add(r.pointerLine),r.pointerLine.line.material.depthTest=!1,r.pointerLine.points.material instanceof Array?r.pointerLine.points.material.forEach((function(e){e.depthTest=!1})):r.pointerLine.points.material.depthTest=!1,r.pointerLine.setMaterial({color:new e.Vector3(1,1,1)}),r.boundingMesh.visible=!0,r.panoResources={},r.panoResources[r.locationMotion.keyframes[0].key=r.locationMotion.keyframes[1].key=Yr()]={panoIndex:r.currentPanoIndex,workCode:r.work.workCode,leftPanoPicture:null,position:r.camera.pose.offset.clone(),effect:"fade"},r.parallaxCameraMatrixs=[];var n=ft.shared.getContext();if(!n)return console.error("获取session失败,请退出重试"),r;r.xrManager.setSession(n),r.on("webXRSelected",(function(e){"Select"===e&&r.checkSelectedPano()}));for(var o=function(e){s.xrManager.on(e,(function(){for(var t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];r.emit.apply(r,Ne([e],t,!1))}))},s=this,a=0,l=cl;a<l.length;a++)o(l[a]);return r.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}},r}return Oe(i,t),i.parseArgs=function(e){var i=Fe(Fe({},e),{maxLatitude:Math.PI/2,minLatitude:-Math.PI/2});return t.parseArgs.call(this,i)},i.initAnimationEndPose=function(e){var i=this.parseArgs(e);return t.initAnimationEndPose.call(this,i)},i.prototype.moveToPano=function(t,i,r){var n,o,s,a,l=this,u=this.work.observers[t],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 yt(e,d,t)},f=Fe({key:"pano.".concat(t),basisLoaderInitialized:oi.isInitialized()},Dt(this.imageOptions,["format","size","quality"])),A=u.images,g=null!==(o=null===(n=u.images.tiles)||void 0===n?void 0:n.filter((function(e){return e.size>c})))&&void 0!==o?o:null,m="pano:"+Vs([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:t,workCode:this.work.workCode,effect:null!==(a=i.effect)&&void 0!==a?a:"fade",leftPanoPicture:{map:y.map,luminanceMap:y.luminanceMap,matrix:(new e.Matrix4).compose(u.position,u.quaternion,wl)},position:u.position.clone()};this.doMoveToPano(t,M,i,r)}else this.pending=!0,this.pendingTextureTask={panoIndex:t,hash:m,onLoad:function(n){var o;if(l.pending=!1,l.destroyed)n.body.dispose();else{n.body.name=m;var s={panoIndex:t,workCode:l.work.workCode,effect:null!==(o=i.effect)&&void 0!==o?o:"fade",leftPanoPicture:{map:n.body,luminanceMap:null,matrix:(new e.Matrix4).compose(u.position,u.quaternion,wl)},position:u.position.clone()};l.doMoveToPano(t,s,i,r)}},onError:function(e){l.pending=!1,i.moveCancelCallback&&i.moveCancelCallback(),l.emit("panoLoadError",e,t),l.emit("moveToPanoCanceled",t)}},Promise.all([this.tileLevelForFov&&g&&g.length?this.textureLoader.loadTiledCubeTexture(A,g,{tileMaxLevel:this.TILED_CUBE_TEXTURE_LEVEL,imageURL:{transform:p,options:f},format:e.RGBAFormat,viaAjax:!0},void 0,void 0,(function(e){var i,r;l.emit("textureLoading",e,t,u),(null===(i=l.pendingTextureTask)||void 0===i?void 0:i.hash)===m&&(null===(r=l.panoMeshes[t])||void 0===r||r.setProgress(e))}),this.renderer):this.textureLoader.loadCubeTexture(A,{imageURL:{transform:p,options:f},format:e.RGBAFormat},void 0,void 0,(function(e){var i,r;(null===(i=l.pendingTextureTask)||void 0===i?void 0:i.hash)===m&&(null===(r=l.panoMeshes[t])||void 0===r||r.setProgress(e)),l.emit("textureLoading",e,t,u)}),this.renderer)]).then((function(e){var i,r,n=e[0];(null===(i=l.pendingTextureTask)||void 0===i?void 0:i.hash)===m?(l.pendingTextureTask.onLoad(n),null===(r=l.panoMeshes[t])||void 0===r||r.setProgress(0),delete l.pendingTextureTask,l.emit("textureLoaded",t,u,n.meta)):n.body.dispose()})).catch((function(e){var i,r;(null===(i=l.pendingTextureTask)||void 0===i?void 0:i.hash)===m&&(l.pendingTextureTask.onError(e),null===(r=l.panoMeshes[t])||void 0===r||r.setProgress(0),delete l.pendingTextureTask,l.emit("textureError",e,t,u),l.emit("error",e))})),this.emit("textureStartLoad",t,u)},i.prototype.doMoveToPano=function(t,i,r,n){var o,s,a,l=this;void 0===r&&(r={}),this.userAction=n;var u,c,h,d=je(),p=Yr();if(this.panoResources[p]=i,this.locationMotion.ended){var f=this.locationMotion.getKeyFrameSegment(d),A=(f[0],f[1]),g=this.locationMotion.value,m=this.panoResourceFromLocationMotionKeyframe(A).position,v=i.position;u=Math.max(m.distanceTo(v),1),c=[{key:A.key,progress:0,value:Fe(Fe({},g),{count:0})},{key:p,progress:1,value:{distance:0,perspToOrtho:0,orthoDistance:1,modelAlpha:0,count:1}}],h=0}else{var y=this.locationMotion.getKeyFrameSegment(d),b=y[0],x=(A=y[1],g=this.locationMotion.value,this.panoResourceFromLocationMotionKeyframe(b).position),w=(m=this.panoResourceFromLocationMotionKeyframe(A).position,v=i.position,A.value.count-g.count),M=Math.max(x.distanceTo(m),1)*w;u=M+Math.max(m.distanceTo(v),1),c=[{key:b.key,progress:0,value:Fe({},g)},{key:A.key,progress:M/u,value:A.value},{key:p,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(c);h=this.locationMotion.getProgressVelocity(d)*E/S}var C=this.calculateMovingDuration(r.duration,u),I={longitude:r.longitude,latitude:r.latitude,fov:r.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:i.position.clone(),distance:0};this.emit("moveToPano",t,this.userAction),r.moveStartCallback&&r.moveStartCallback(t,B),this.emit("panoWillArrive",t,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=Ue,this.videoTexture.needsUpdate=!0),this.panoVideo.setMaterial(null),this.cameraMotion.set(I,C).catch(Ue),this.locationMotion.setKeyframes(c,C,h).then((function(){var i,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};r.moveEndCallback&&r.moveEndCallback(t,a),l.emit("panoArrived",t,a,n);var u=l.work.observers[l.currentPanoIndex];if(u&&u.video&&l.videoTexture&&l.videoTexture.image instanceof HTMLVideoElement){var c=xl.clone().multiply(null!==(s=null===(o=null===(i=l.model.getMaterial())||void 0===i?void 0:i.pano1)||void 0===o?void 0:o.matrix)&&void 0!==s?s:new e.Matrix4).multiply(u.video.matrix),h={map:l.videoTexture,size:u.video.size,matrix:c,alpha:1},d=Yr(),p=l.videoTexture.image;p.setAttribute("uuid",d),qs().then((function(e){e&&u.video&&p.getAttribute("uuid")===d&&(p.oncanplay=function(){p.oncanplay=Ue,p.play()},p.ontimeupdate=function(){p.currentTime>.5&&(p.ontimeupdate=Ue,l.panoVideo.setMaterial(h))},p.src=u.video.source)})).catch((function(){p.removeAttribute("uuid")}))}}),(function(){r.moveCancelCallback&&r.moveCancelCallback(),l.emit("moveToPanoCanceled",t)}))},i.prototype.checkSelectedPano=function(){var t=this,i=this.xrControllerRay;this.interiaMovement=!1;var r=this.camera.getWorldDirection(new e.Vector3).setY(0),n=null,o=this.work.observers[this.currentPanoIndex];if(!o)return n;var s=o.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)})),a=this.model.intersectRaycaster(i)[0];if(a){var l=cs(s,(function(e){var i=t.work.observers[e].standingPosition.clone();return i.clone().sub(t.camera.position).setY(0).angleTo(r)>Math.PI/2?1/0:i.distanceTo(a.point)}),!0),u=l[0];l[1]<this.panoTapTriggerRadius&&(n=u)}cn(n)&&(n=this.getForwardPanoIndexOrNot(i));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===n){n=null;break}}if(this.emit("panoSelected",n),cn(n))return!0===this.locationMotion.ended&&this.cameraBounce(),n;var f=this.work.observers[n];if(!f.active)return this.panoMeshes[n]&&(this.panoMeshes[n].setDisabled(!1),this.panoMeshes[n].setLoading(!0)),n;for(var A={effect:"fade"},g=Math.PI/6,m=Math.PI/12,v=new e.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!==n){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:Ne(Ne([],w,!0),M,!0)).slice().sort((function(e,t){return e.angleTo(y)-t.angleTo(y)}))[0];return B&&B.angleTo(r)>m&&(A.longitude=Math.atan2(-B.x,-B.z)),this.cameraMotion.value.latitude<-Math.PI/4&&(A.latitude=gn(0,this.minLatitude,this.maxLatitude)),this.cameraMotion.value.fov<60&&(A.fov=this.defaultFov),this.emit("wantsMoveToPano",n,A,!0),n},i.prototype.destroy=function(){t.prototype.destroy.call(this)},i.prototype.isReady=function(){return!1},i.prototype.updateTime=function(t,i){for(var r,n,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(t);var y=this.locationMotion.getKeyFrameSegment(t),b=y[0],x=y[1],w=this.panoResourceFromLocationMotionKeyframe(b),M=this.panoResourceFromLocationMotionKeyframe(x),E=(new e.Vector3).copy(w.position),S=(new e.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(gn(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 e.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,k=R.progress;void 0!==D&&(I.push(D),k>=this.locationMotion.progress&&B.push(D))}for(var L=0,O=Object.keys(this.panoResources);L<O.length;L++){var F=O[L];if(!(B.indexOf(F)>=0)){var N=this.panoResources[F];if(N.leftPanoPicture){var V=N.leftPanoPicture.map;if(V){if(V===(null===(r=f.pano0)||void 0===r?void 0:r.map))continue;if(V===(null===(n=f.pano1)||void 0===n?void 0:n.map))continue;V instanceof ai&&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(t),A.longitude=this.cameraMotion.value.longitude,A.latitude=this.cameraMotion.value.latitude,A.fov=this.cameraMotion.value.fov),!1===hs(f)&&((null===(o=f.pano0)||void 0===o?void 0:o.map)&&f.pano0.map instanceof ai&&!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 ai&&!f.pano1.map.cubeRenderTarget&&(f.pano1.map.cubeRenderTarget=this.colorCubeRenderTargetPool.pop()),this.model.setMaterial(f),this.boundingMesh.setMaterial(f)),!1===hs(A)&&this.setCamera(A),d[0];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],_=Q.getViewerPose(H),K=new e.Vector3(0,0,0);if(_){var G=void 0;switch(this.xrManager.machineType){case"Pico":G=this.xrManager.session.renderState.baseLayer;break;case"Oculus":var W=this.xrManager.session.renderState.layers;W&&(G=W[0]);break;default:this.xrManager.machineType}var X=_.views;if(!G)return void console.error("no layer found");this.renderer.setFramebuffer(G.framebuffer);var Y=!1;X.length!==q.cameras.length&&(q.cameras.length=0,Y=!0),this.parallaxCameraMatrixs=[];var Z=new e.Vector3,J=new e.Vector3;(new e.Matrix4).fromArray(X[0].transform.matrix).decompose(Z,new e.Quaternion,new e.Vector3),(new e.Matrix4).fromArray(X[1].transform.matrix).decompose(J,new e.Quaternion,new e.Vector3),J.clone().sub(Z).normalize();var $=new e.Vector3,ee=new e.Quaternion,te=new e.Vector3;this.camera.matrix.decompose($,ee,te);for(var ie=0;ie<X.length;ie++){var re=X[ie],ne=G.getViewport(re),oe=j[ie];oe.matrix.fromArray(re.transform.matrix);var se=new e.Vector3,ae=new e.Quaternion,le=new e.Vector3;oe.matrix.decompose(se,ae,le),K.copy($),oe.position.copy($),oe.quaternion.copy(ae),oe.scale.copy(le),oe.updateMatrix(),oe.projectionMatrix.fromArray(re.projectionMatrix),oe.viewport.set(ne.x,ne.y,ne.width,ne.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(K).sub(new e.Vector3(0,1.35,0));this.xrControllerRay.set(pe,new e.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:gn(1.4/Ce,.5,.7)),Ee.updateTime&&Ee.updateTime(t,i)}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 t=new e.Vector2(4e3,4e3),i=m.panoIndex,r=h.work.observers[i],n=h.imageOptions.size;if(void 0===n&&r){var o=r.images.up.match(/\/cube_(\d+)\//);o&&(n=Number(o[1]))}void 0===n&&(n=2048);var s=0;n>=1024&&(s=1),n>=2048&&(s=2),n>=4096&&(s=3),n>=8192&&(s=4);var a=h.tileLevelForFov(U.fov,t);return a>s?a:0}(),Te=((Ie=new e.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 e.Frustum).setFromProjectionMatrix((new e.Matrix4).multiplyMatrices(Ie.projectionMatrix,Ie.matrixWorldInverse)));m.panoIndex===this.currentPanoIndex&&(null===(l=m.leftPanoPicture)||void 0===l?void 0:l.map)instanceof ai&&(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&&Xo(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,t)):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(t);var ke=ue[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 Le=t-this.xrControllerState.axes[2].left.startTime;Le>=bl&&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=t-this.xrControllerState.axes[2].right.startTime;Oe>=bl&&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 Fe=t-this.xrControllerState.axes[3].up.startTime;Fe>=bl&&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 Ne=t-this.xrControllerState.axes[3].down.startTime;Ne>=bl&&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 Ve=t-this.xrControllerState.select.startTime;Ve>=bl&&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 Qe=t-this.xrControllerState.squeeze.startTime;Qe>=bl&&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 He=t-this.xrControllerState.leftButtonA.startTime;He>=bl&&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 qe=t-this.xrControllerState.leftButtonB.startTime;qe>=bl&&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=t-this.xrControllerState.rightButtonA.startTime;Ue>=bl&&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 ze=t-this.xrControllerState.rightButtonB.startTime;ze>=bl&&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丢失,请重试")},i.prototype.render=function(){var e=this.xrManager.getCamera(this.camera);this.renderer.render(this.scene,e)},i.prototype.onPanGesture=function(){},i.prototype.onTapGesture=function(){},i.prototype.onPinchGesture=function(){},i.prototype.onMouseMove=function(){},i.prototype.onMouseOut=function(){},i.prototype.panoResourceFromLocationMotionKeyframe=function(e){return this.panoResources[e.key]},i}(da),El=["Panorama","DepthPanorama","Model"],Sl={Floorplan:Ss,Topview:Fs,Panorama:da,VRPanorama:Wa,Model:Xa,DepthPanorama:il,Mapview:sl,XRPanorama:Ml};function Cl(e){for(var t=0,i=El;t<i.length;t++){var r=i[t];if("string"==typeof e){if(r===e)return!0}else if(e instanceof Es&&e instanceof Sl[r])return!0}return!1}var Il=["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 Bl(e){for(var t,i,r={},n=0,o=e.split(/(\;|\,)/);n<o.length;n++){var s=o[n].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&&(r[a]=l)}return r}function Tl(){for(var e,t=document.getElementsByTagName("meta"),i=0;i<t.length;i++){var r=t[i];if("viewport"===r.getAttribute("name")){var n=Bl(null!==(e=r.getAttribute("content"))&&void 0!==e?e:""),o=Number(n["initial-scale"]);if(!isNaN(o))return o}}return 1}var Pl=[351,63],Rl=[20,20],Dl=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]),Ll=new Uint8Array([0,1,2,1,3,2]),Ol=new e.BufferGeometry;Ol.setAttribute("position",new e.BufferAttribute(Dl,3)),Ol.setAttribute("uv",new e.BufferAttribute(kl,2)),Ol.setIndex(new e.BufferAttribute(Ll,1));var Fl=new e.MeshBasicMaterial({transparent:!0,depthTest:!1}),Nl=new e.Mesh(Ol,Fl),Vl=new e.Scene;Vl.add(Nl);var Ql=new e.OrthographicCamera(-.5,.5,.5,-.5,.1,1);Ql.position.set(0,0,.5),Ql.lookAt(0,0,0);var Hl=new e.Vector4,ql=new e.Vector4;function Ul(t){if(Fl.map){var i=t.getViewport(Hl),r=t.getScissor(ql),n=t.getScissorTest(),o=t.autoClear;t.setViewport(r.x+Rl[0]/3,r.y+Rl[1]/3,Pl[0]/3,Pl[1]/3),t.setScissor(r.x+Rl[0]/3,r.y+Rl[1]/3,Pl[0]/3,Pl[1]/3),t.setScissorTest(!0),t.autoClear=!1,t.render(Vl,Ql),t.setViewport(i),t.setScissor(r),t.setScissorTest(n),t.autoClear=o}else{var s=new e.Texture,a=new Image;a.onload=function(){s.image=a,s.wrapS=e.ClampToEdgeWrapping,s.wrapT=e.ClampToEdgeWrapping,s.minFilter=e.LinearFilter,s.needsUpdate=!0,Fl.needsUpdate=!0,a.onload=function(){}},a.src="data:image/png;base64,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",Fl.map=s}}var zl=new e.Box3(new e.Vector3(-50,-50,-50),new e.Vector3(50,50,50)),jl=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/")},_l=new e.Vector2,Kl=new e.Frustum,Gl=new e.Matrix4,Wl=new WeakMap,Xl=new WeakMap,Yl=function(t){function i(i){void 0===i&&(i={});var r,n,o,s,a,l,u,c,h,d,p,f=this;if((f=t.call(this)||this).ident=Yr(),Zl.instances[f.ident]=f,f.renderSwitch01=0,f.panoIndex=0,f.needsRender=!1,f.onlyRenderIfNeeds=null===(r=i.onlyRenderIfNeeds)||void 0===r||r,f.imageOptions=Fe({},null!==(n=i.imageOptions)&&void 0!==n?n:{}),f.textureOptions=Fe({},null!==(o=i.textureOptions)&&void 0!==o?o:{}),f.poweredByRealsee=null===(s=i.poweredByRealsee)||void 0===s||s,f.extraElements=[],f.controllerInits={Panorama:Object.assign({},i.panorama),Model:Object.assign({},i.model),Floorplan:Object.assign({},i.floorplan),Topview:Object.assign({},i.topview),Mapview:Object.assign({},i.mapview),DepthPanorama:Object.assign({},i.depthPanorama),VRPanorama:Object.assign({},i.vrPanorama),XRPanorama:Object.assign({},i.xrPanorama)},f.fps={testCount:0,testTime:je()},f.modeChangeDuration=null!==(a=i.modeChangeDuration)&&void 0!==a?a:800,f.panoramaLikeSavedPose={},"undefined"!=typeof window)if(i.renderer)i.renderer instanceof fi&&f.throwError(new Error("cannot render a internal renderer")),f.renderer=i.renderer;else try{f.renderer=new fi({preserveDrawingBuffer:i.preserveDrawingBuffer,backgroundColor:i.backgroundColor,backgroundAlpha:i.backgroundAlpha,antialias:i.antialias,webgl2:null==i?void 0:i.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 Ms(f.renderer),f.getPixelsRenderTarget=new e.WebGLRenderTarget(1,1,{encoding:null!==(u=null===(l=f.renderer)||void 0===l?void 0:l.outputEncoding)&&void 0!==u?u:e.sRGBEncoding}),f.scissor=Object.assign({left:0,bottom:0,width:1,height:1},i.scissor),f.camera=new Mi(80),f.scene=new Ai,f.parallaxScene=new Ai,f.lastLoadWorkTask=Promise.resolve(),f.requestProxy=null!==(c=i.requestProxy)&&void 0!==c?c:jl,f.networkSubscribe=new at,f.networkSubscribe.on("network",(function(e,t,i,r){var n;f.emit("network",e,t,i,r),null===(n=f.analysis)||void 0===n||n.network(f.work,e,t,i,r)})),f.model=new fn({allowHosts:[],requestProxy:f.requestProxy,networkSubscribe:f.networkSubscribe});var g=$o(zl);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 e.Group,f.helperGroup.name="helper",f.scene.add(f.helperGroup),f.videoTexture=new e.VideoTexture(i.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(t){(i=new e.DirectionalLight(16777215,.5)).position.copy(new e.Vector3(1,1,1)),t.add(i);var i=new e.DirectionalLight(16777215,.3);t.add(i),i=new e.AmbientLight(16777215,.3),t.add(i)}(f.scene),f.state={mode:null!==(h=f.currentMode)&&void 0!==h?h:An,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!==i.play&&f.play(),!1!==(null!==(p=i.initialBasisLoader)&&void 0!==p&&p)&&("string"==typeof i.initialBasisLoader?f.initBasisLoader(i.initialBasisLoader):f.initBasisLoader()),f.stopAnimationLoop=ft.shared.add((function(e,t){for(var i=[],r=2;r<arguments.length;r++)i[r-2]=arguments[r];f.updateTime.apply(f,Ne([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={},i.plugins&&i.plugins.length)for(var v=0,y=i.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 e.WebGLRenderTarget(1,1),f.meshReplaceMaterialMap=new Map,f.meshOriginMaterialMap=new Map,f}return Oe(i,t),Object.defineProperty(i,"version",{get:function(){return"5.0.0-alpha.164"},enumerable:!1,configurable:!0}),i.prototype.getGPUPicking=function(t,i,r,n,o){var s=this;if(void 0===n&&(n=1),void 0===o&&(o=new e.Vector3(0,0,0)),!this.renderer)throw new Error("renderer is not initialized.");this.model.setMaterial({modelColorInfo:o}),this.scene.traverse((function(t){if(t instanceof e.Mesh&&!(t instanceof Et)){var i=Object.keys(r).filter((function(e){return e===t.uuid}))[0];if(i)if(s.meshOriginMaterialMap.set(i,t.material),s.meshReplaceMaterialMap.get(i))t.material=s.meshReplaceMaterialMap.get(i);else{var n=new e.ShaderMaterial({uniforms:{color:{value:r[i]}},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 "});n.depthTest=t.material.depthTest,n.side=t.material.side,s.meshReplaceMaterialMap.set(i,n),t.material=n}}}));var a=this.renderer.getSize(new e.Vector2);this.camera.setViewOffset(a.width,a.height,t*n,i*n,1,1),this.renderer.setRenderTarget(this.gpuPickingRenderTarget),this.render();var l=new Uint8Array(4);return this.renderer.readRenderTargetPixels(this.gpuPickingRenderTarget,0,0,1,1,l),this.renderer.setRenderTarget(null),this.camera.clearViewOffset(),this.scene.traverse((function(t){t instanceof e.Mesh&&!(t instanceof Et)&&s.meshOriginMaterialMap.get(t.uuid)&&(t.material=s.meshOriginMaterialMap.get(t.uuid))})),this.model.setMaterial({modelColorInfo:null}),Object.keys(r).filter((function(t){return r[t].equals((new e.Color).setRGB(l[0]/255,l[1]/255,l[2]/255))}))[0]||!1},i.prototype.dispose=function(){var e,t;if(!0!==this.destroyed){delete Zl.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 r=this.model.getMaterial();r&&(r.pano0&&r.pano0.map.dispose(),r.pano1&&r.pano1.map!==(null===(t=r.pano0)||void 0===t?void 0:t.map)&&r.pano1.map.dispose()),this.model.dispose(),this.diposeGPUPickingMaterial(),this.renderer instanceof fi&&this.renderer.forceContextLoss&&this.renderer.forceContextLoss()}},i.prototype.setScissor=function(e){Object.assign(this.scissor,e),this.controller&&this.controller.updateRenderSize&&this.controller.updateRenderSize()},Object.defineProperty(i.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(i.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(i.prototype,"enablePostProcessing",{get:function(){return void 0!==this.screenBuffers},set:function(t){var i,r,n,o;if(t){if(!this.screenBuffers){var s=this.getDrawingBufferSize(_l);this.screenBuffers=[new e.WebGLRenderTarget(s.x,s.y,{encoding:null!==(r=null===(i=this.renderer)||void 0===i?void 0:i.outputEncoding)&&void 0!==r?r:e.sRGBEncoding}),new e.WebGLRenderTarget(s.x,s.y,{encoding:null!==(o=null===(n=this.renderer)||void 0===n?void 0:n.outputEncoding)&&void 0!==o?o:e.sRGBEncoding})]}}else this.screenBuffers&&(this.screenBuffers[0].dispose(),this.screenBuffers[1].dispose(),delete this.screenBuffers);this.needsRender=!0},enumerable:!1,configurable:!0}),i.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)},i.prototype.appendTo=function(e,t){if(void 0===t&&(t={}),this.renderer)if(this.renderer instanceof fi){var i=this.getElement();if(i){e.appendChild(i),this.refresh(t);var r=window.getComputedStyle(e).position;"relative"!==r&&"absolute"!==r&&"fixed"!==r&&"sticky"!==r&&(e.style.position="relative")}}else this.throwError(new Error("cannot call appendTo method when render a external renderer"))},i.prototype.refresh=function(t,i){if(void 0===t&&(t={}),this.renderer){var r=this.getElement();if(r){var n=r.parentNode;if(n&&n.nodeName){var o=t.width,s=void 0===o?n.offsetWidth:o,a=t.height,l=void 0===a?n.offsetHeight:a;if(this.renderer instanceof fi){if(i)this.renderer.setPixelRatio(i);else{if((i=1===Tl()?Math.floor(window.devicePixelRatio):1)>1)for(;i>1&&s*l*i*i>7372800;)i--;this.renderer.setPixelRatio(i)}this.renderer.setSize(s,l)}}var u=this.renderer.getSize(new e.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}}},i.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)}},i.prototype.removeExtraElement=function(e){var t=this.extraElements.indexOf(e);-1!==t&&(this.extraElements.splice(t,1),this.controller&&this.controller.unbindExtraElement(e))},i.prototype.getPose=function(){var e=this.camera.copyPose(),t=e.longitude,i=e.latitude,r=e.fov,n=e.offset,o=e.distance;return{longitude:t,latitude:i,fov:r,offset:n.clone(),distance:o}},i.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},i.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},i.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."))},i.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."))},i.prototype.getLongitudeAndLatitude=function(){var e=this.getPose();return{longitude:e.longitude,latitude:e.latitude}},i.prototype.getOffset=function(){return this.getPose().offset},i.prototype.getCameraLocal=function(){if("number"==typeof this.panoIndex&&this.controller&&this.work){var t=this.work.observers[this.panoIndex],i=new e.Object3D;return i.position.copy(t.position),i.quaternion.copy(t.quaternion),i.scale.set(1,1,1),i.updateMatrixWorld(!0),function(t,i){var r=new e.Vector3(0,0,-1);r.applyQuaternion(t.quaternion);var n=i.quaternion.clone().inverse();return r.applyQuaternion(n),{theta:Math.atan2(r.x,-r.z),phi:-Math.asin(r.y),lookAtVector:r}}(this.camera,i)}},i.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&&oi.setTranscoderPath(e),oi.workerConfig.format||oi.detectSupport(this.renderer),oi._allocateWorker(0)}catch(e){e instanceof Error&&this.throwError(e)}},Object.defineProperty(i.prototype,"work",{get:function(){var e=Xl.get(this);if(e&&Sn.get(e))return e},enumerable:!1,configurable:!0}),i.prototype.load=function(e,t,i,r){var n=this;if(void 0===r&&(r=!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?n.load_(e,t,i,r):e.then((function(e){return n.load_(e,t,i,r)}));var o}));return this.lastLoadWorkTask=o.catch((function(e){n.throwError(e)})),o},i.prototype.load_=function(e,t,r,n){var o,s,a,l,u,c,h,d,p,f=this;void 0===n&&(n=!0);var A,g,m,v=Pn(e),y=this.work;void 0===t&&(t=y?"inherit":"initial"),"inherit"===t?(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"===t?(g=null!==(s=this.currentMode)&&void 0!==s?s:v.initial.mode,A=v.initial.panoIndex,m=g===i.Mode.Panorama||g===i.Mode.DepthPanorama||g===i.Mode.Model||g===i.Mode.VRPanorama||g===i.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=t.panoIndex)&&void 0!==a?a:v.initial.panoIndex,g=null!==(u=null!==(l=t.mode)&&void 0!==l?l:this.currentMode)&&void 0!==u?u:An,m={longitude:null!==(c=t.longitude)&&void 0!==c?c:v.initial.longitude,latitude:null!==(h=t.latitude)&&void 0!==h?h:v.initial.latitude,fov:null!==(d=t.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!=r?r:f.modeChangeDuration:0,o=Fe(Fe({initial:[A,m,i,n]},f.commonParams()),f.controllerInits[g]);f.controller?!1===f.controller.updateWork(v,A,m,i,n)&&(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=Ue),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 Xl.set(this,v),g===i.Mode.Floorplan||g===i.Mode.Topview||g===i.Mode.Mapview||g===i.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(),n),x()}))),this.ready().then((function(){f.emit("loaded",e,f.work)}))},i.prototype.changeMode=function(e,t,r,n,o){var s=this;if(void 0===t&&(t={}),void 0===r&&(r=this.modeChangeDuration),void 0===n&&(n=!0),void 0===o&&(o=!1),!this.renderer)throw new Error("renderer is not initialized.");return new Promise((function(a,l){if(!i.Mode.hasOwnProperty(e)){var u=new Error('mode "'.concat(e,'" is not existed'));return s.throwError(u),void l(u)}if((e===i.Mode.Floorplan||e===i.Mode.Topview||e===i.Mode.Mapview||e===i.Mode.Model)&&(cn(s.model)||!0!==s.model.loaded))return u=new Error("model is not ready."),s.throwError(u),void l(u);if(cn(s.controller))return u=new Error("controller is not ready."),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===i.Mode.Panorama||e===i.Mode.DepthPanorama||e===i.Mode.Model||e===i.Mode.VRPanorama||e===i.Mode.XRPanorama?"number"==typeof t.panoIndex&&t.panoIndex!==s.panoIndex?s.controller.moveToPano(null!==(d=null!==(u=t.panoIndex)&&void 0!==u?u:s.panoIndex)&&void 0!==d?d:0,Fe({duration:r},t),n):s.controller.updateCamera(t,r,n).catch(Ue):("number"==typeof t.panoIndex&&t.panoIndex!==s.panoIndex&&(s.panoIndex=t.panoIndex),s.controller.updateCamera(t,r,n).catch(Ue));else{c.destroy();var A=null!==(f=null!==(p=t.panoIndex)&&void 0!==p?p:s.panoIndex)&&void 0!==f?f:0,g=Cl(e)?s.panoramaLikeSavedPose:{};e===i.Mode.Mapview&&(g.longitude=s.panoramaLikeSavedPose.longitude),"number"!=typeof t.longitude&&"number"!=typeof t.latitude||(g.longitude=t.longitude,g.latitude=t.latitude),"number"==typeof t.fov&&(g.fov=t.fov);var m=Fe(Fe({initial:[A,g,r,n]},s.commonParams()),s.controllerInits[e]);s.saveControllerPose(c),s.controller=s.applyController(e,m);var v=Sl[e].initAnimationEndPose(m);s.emit("modeChange",e,h,A,v,n)}a()}};if(e===i.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===i.Mode.XRPanorama){var p=ft.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){ft.shared.setContext(e),d()})).catch((function(e){e instanceof Error&&(s.throwError(e),l(e))}))}else d()}))},i.prototype.getPixels=function(t,i,r,n,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 e.Vector2);t=gn(t,Math.floor(r/2),Math.floor(a.x-r)),i=gn(i,Math.floor(n/2),Math.floor(a.y-n)),s.setSize(r*o,n*o),this.renderer.setRenderTarget(s),this.camera.setViewOffset(a.width,a.height,t,a.height-i-n,r,n),this.controller?this.controller.render():this.renderer.render(this.scene,this.camera);var l=new Uint8Array(r*o*n*o*4);return this.renderer.readRenderTargetPixels(s,0,0,r*o,n*o,l),this.renderer.setRenderTarget(null),this.camera.clearViewOffset(),l},i.prototype.getElement=function(){var e;return null===(e=this.renderer)||void 0===e?void 0:e.domElement},i.prototype.render=function(e,t){var i,r=this;if(void 0===t&&(t=!1),!this.renderer)return null;var n=Mt.shared,o=null===(i=this.model.getMaterial())||void 0===i?void 0:i.clippers;if(o&&n.update(o,this.camera),this.model.setMaterial({clipperPlanesArray:o?n.clipperPlanes:null,clipperFloors:o?n.clipperFloors:null}),t){var s=this.renderer.getSize(_l);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(_l);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&&Ul(this.renderer),this.renderer.setRenderTarget(null),e&&ft.shared.add(e,!0),this.screenBuffers[0]}return this.aroundScissor((function(){r.renderer&&(r.controller?r.controller.render():r.renderer.render(r.scene,r.camera),r.poweredByRealsee&&"VRPanorama"!==r.currentMode&&"XRPanorama"!==r.currentMode&&Ul(r.renderer)),e&&ft.shared.add(e,!0)})),null},i.prototype.updateTime=function(t,i){for(var r,n=this,o=[],s=2;s<arguments.length;s++)o[s-2]=arguments[s];if(!this.destroyed){this.syncingState=this.syncState(t,i),this.controller&&(r=this.controller).updateTime.apply(r,Ne([t,i],o,!1)),this.camera.updateTime(t,i),this.syncingState=!1;var a=new e.Vector2(512,512),l=new e.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(Gl.multiplyMatrices(this.camera.projectionMatrix,this.camera.matrixWorldInverse),this.renderer&&this.model.update(this.renderer,this.camera),Kl.setFromProjectionMatrix(Gl),this.scene.traverse((function(i){if(i.setResolution&&i.setResolution(a.x,a.y),i.setTime&&i.setTime(t),i.mixer instanceof e.AnimationMixer){var r=Wl.get(i.mixer);r||(r=new e.Clock,Wl.set(i.mixer,r)),i.mixer.update(r.getDelta())}(i instanceof e.Mesh||i instanceof e.Line||i instanceof e.Points)&&(i instanceof e.ImmediateRenderObject||!i.frustumCulled||Kl.intersectsObject(i))&&u.push(i)})),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,n.needsRender=!0):e.mixer&&e.mixer.stats.actions.inUse>0&&(n.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]),n.copyEffect.render(g[1],void 0)}))}this.hasListener("renderFrame")&&this.emit("renderFrame",void 0!==c)}if(this.fps.testTime&&t-this.fps.testTime<1e3)this.fps.testCount++;else if(this.emit("fps",this.fps.testCount),this.fps.testTime=t,this.fps.testCount=0,this.renderer){var m=this.renderer.getContext(),v=es(m);v&&this.throwError(v)}}},i.prototype.pause=function(){this.paused=!0,this.renderer&&this.renderer instanceof fi&&this.renderer.clear(!0,!0,!0)},i.prototype.play=function(){this.needsRender=!0,this.paused=!1},i.prototype.moveToPano=function(e,t,r){var n=this;void 0===t&&(t={}),void 0===r&&(r=!0);var o=this,s=o.controller,a=o.currentMode,l=o.renderer;return s?l?(a===i.Mode.Floorplan||a===i.Mode.Topview||a===i.Mode.Mapview?cn(e)||(this.panoIndex=e,this.once("initAnimationWillStart",(function(e,r){n.currentMode===i.Mode.Panorama&&t.moveStartCallback&&t.moveStartCallback(e,r)})),this.once("initAnimationEnded",(function(e,r){n.currentMode===i.Mode.Panorama&&t.moveEndCallback&&t.moveEndCallback(e,r)})),this.changeMode(i.Mode.Panorama,t,void 0,r)):s.moveToPano(e,t,r),this.ready()):(this.throwError(new Error("renderer is not initialized.")),Promise.resolve()):(this.throwError(new Error("controller is not initialized.")),Promise.resolve())},i.prototype.preloadPano=function(e,t){var i=this;if(void 0===t&&(t=Ue),!this.work)return Promise.reject(new Error("work never loaded"));var r=this.work.observers[e],n=this.work.allowHosts,o=je();return Promise.all(["right","left","up","down","front","back"].map((function(t){var o=Fe({key:"pano.".concat(e,".").concat(t),basisLoaderInitialized:oi.isInitialized()},Dt(i.imageOptions,["size","format","quality","mappings"])),s=r.images[t];return ct(i.imageOptions.transform?i.imageOptions.transform(s,o):vt(s,o),{allowHosts:n,requestProxy:i.requestProxy,networkSubscribe:i.networkSubscribe})}))).then((function(){var e=je()-o;return t(e),e}))},i.prototype.project2d=function(t,i){if(void 0===i&&(i=!1),!this.renderer)return null;if(!1===this.model.empty&&i){var r=this.camera.position,n=t.clone().sub(r),o=new e.Raycaster(r,n.clone().normalize()),s=this.model.intersectRaycaster(o)[0];if(s&&s.distance+.01<n.length())return null}var a=t.clone().project(this.camera);if(Math.abs(a.z)>1)return null;var l=this.renderer.getSize(new e.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 e.Vector2(h,d)},i.prototype.getRenderObjects=function(t){Gl.multiplyMatrices(this.camera.projectionMatrix,this.camera.matrixWorldInverse),Kl.setFromProjectionMatrix(Gl),t||(t=this.scene);var i=[];return t.traverseVisible((function(t){(t instanceof e.Mesh||t instanceof e.Line||t instanceof e.Points)&&(t instanceof e.ImmediateRenderObject||!t.frustumCulled||Kl.intersectsObject(t))&&i.push(t)})),i},i.prototype.getCurrentState=function(){return Fe(Fe({},this.getPose()),{mode:this.currentMode||i.Mode.Panorama,panoIndex:this.panoIndex||0})},i.prototype.setState=function(t,r,n){var o,s,a,l,u,c,h,d,p;void 0===r&&(r=!1),void 0===n&&(n=!0),!(t=Object.assign({},t)).offset||t instanceof e.Vector3||(t.offset=new e.Vector3(t.offset.x,t.offset.y,t.offset.z));var f,A,g,m,v,y=null!==(o=t.panoIndex)&&void 0!==o?o:this.state.panoIndex,b=null!==(s=t.mode)&&void 0!==s?s:this.state.mode;if(this.work)if(this.work.observers[y])if(t.mode!==i.Mode.Floorplan&&t.mode!==i.Mode.Topview&&t.mode!==i.Mode.Mapview&&t.mode!==i.Mode.Model||!cn(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=Cl(this.state.mode)&&Cl(b)?Fe({},this.state):Cl(b)?Fe({},this.panoramaLikeSavedPose):b===i.Mode.Mapview?{longitude:this.panoramaLikeSavedPose.latitude}:Fe({},t),"number"==typeof t.longitude&&(x.longitude=t.longitude),"number"==typeof t.latitude&&(x.latitude=t.latitude),"number"==typeof t.fov&&(x.fov=t.fov);var w=Fe(Fe({initial:[y,x,this.modeChangeDuration,!1]},this.commonParams()),this.controllerInits[b]),M=Sl[b].initAnimationEndPose(w);f=M.longitude,A=M.latitude,g=M.fov,m=M.offset,v=M.distance}else f=null!==(a=t.longitude)&&void 0!==a?a:this.state.longitude,A=null!==(l=t.latitude)&&void 0!==l?l:this.state.latitude,g=null!==(u=t.fov)&&void 0!==u?u:this.state.fov,m=null!==(c=t.offset)&&void 0!==c?c:this.state.offset,v=null!==(h=t.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),ls(this.state,E)||(this.controller&&"VRPanorama"===E.mode&&E.mode!==this.state.mode?(as(this.state,E),this.changeMode("VRPanorama")):this.controller&&"XRPanorama"===E.mode&&E.mode!==this.state.mode?(as(this.state,E),this.changeMode("XRPanorama")):(as(this.state,E),this.controller&&(this.controller.userAction=n),r&&this.state.mode===E.mode&&(this.syncingState=this.syncState(je(),0,r),this.syncingState&&(null===(d=this.controller)||void 0===d||d.updateTime(je(),0),this.syncingState=!1)),this.emit("stateChange",this.state,n),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."))},i.prototype.aroundScissor=function(t){if(this.renderer)if("XRPanorama"!==this.state.mode){var i=new e.Vector2,r=0!==this.scissor.left||0!==this.scissor.bottom||1!==this.scissor.width||1!==this.scissor.height;if(r){this.renderer.getSize(i);var n=Math.floor(i.x*this.scissor.left),o=Math.floor(i.y*this.scissor.bottom),s=Math.floor(i.x*this.scissor.width),a=Math.floor(i.y*this.scissor.height);this.renderer.setViewport(n,o,s,a),this.renderer.setScissor(n,o,s,a),this.renderer.setScissorTest(!0)}t(),r&&(this.renderer.setViewport(0,0,i.x,i.y),this.renderer.setScissor(0,0,i.x,i.y),this.renderer.setScissorTest(!1))}else t()},i.prototype.syncState=function(t,r,n){void 0===n&&(n=!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 Sl.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)return a={longitude:this.state.longitude,latitude:this.state.latitude,fov:this.state.fov,offset:this.state.offset,distance:this.state.distance},this.controller.moveToPano(this.state.panoIndex,a,!1),!0;if(this.controller instanceof Sl.Topview||this.controller instanceof Sl.Mapview){var l=1,u=n?this.state.fov:os(this.camera.pose.fov,this.state.fov,l),c=n?new e.Vector3(this.state.offset.x,this.state.offset.y,this.state.offset.z):new e.Vector3(os(this.camera.pose.offset.x,this.state.offset.x,.2),os(this.camera.pose.offset.y,this.state.offset.y,.2),os(this.camera.pose.offset.z,this.state.offset.z,.2));if(Wo(u,this.camera.pose.fov)||Yo(c,this.camera.pose.offset))return this.controller.cameraMotion.set({fov:u},0).catch(Ue),this.controller.locationMotion.set({x:c.x,y:c.y,z:c.z},0).catch(Ue),!0}else{l=1;var h=Math.PI/45,d=(u=n?this.state.fov:os(this.camera.pose.fov,this.state.fov,l),n?{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 r=is(e.longitude),n=e.latitude,o=is(t.longitude),s=t.latitude;o-r>rs?r+=ns:r-o>rs&&(r-=ns);var a=i/Math.sqrt(Math.pow(o-r,2)+Math.pow(s-n,2));return a>=1?{longitude:t.longitude,latitude:t.latitude}:{longitude:r+(o-r)*a,latitude:n+(s-n)*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(Wo(p,this.camera.pose.longitude,2*Math.PI)||Wo(f,this.camera.pose.latitude)||Wo(u,this.camera.pose.fov))return this.controller.cameraMotion.set({longitude:p,latitude:f,fov:u},0).catch(Ue),!0}if(this.stateSynced=!0,!1===o&&this.emit("stateSynced",this.state),this.readyCallbacks.length&&this.stateSynced){var A=this.currentMode;if(A!==i.Mode.Floorplan&&A!==i.Mode.Topview&&A!==i.Mode.Mapview&&A!==i.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 Sl.Panorama?!0!==y.tile||this.controller.isTileReady()?y():this.readyCallbacks.push(y):y()}}}return!1},i.prototype.ready=function(e){var t=this;return void 0===e&&(e={}),new Promise((function(i){var r;t.readyCallbacks.push(Object.assign(i,{tile:null!==(r=e.tile)&&void 0!==r&&r}))}))},i.prototype.requestFullscreen=function(){var e;if(ss()){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()}},i.prototype.exitFullscreen=function(){"undefined"!=typeof document&&document.fullscreenElement&&"exitFullscreen"in document&&document.exitFullscreen()},i.prototype.throwError=function(e){this.hasListener("error")?this.emit("error",e):console.error(e)},i.prototype.loadModel=function(t,i,r,n){var o=this,s=t.file;this.emit("modelWillLoad",t);var a=new fn({allowHosts:i,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,i,n;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===(i=o.controller)||void 0===i||i.updateModel(a),null===(n=o.renderer)||void 0===n||n.compile(o.scene,o.camera),o.needsRender=!0,o.modelPending=!1,r(),o.emit("modelLoaded",a)}})),a.on("shownFloorChange",(function(e,t){var i,r;o.destroyed||s===(null===(r=null===(i=o.work)||void 0===i?void 0:i.model)||void 0===r?void 0:r.file)&&o.emit("modelShownFloorChange",e,t)})),a.on("error",(function(t){var i,n,l,u;if(!o.destroyed&&s===(null===(n=null===(i=o.work)||void 0===i?void 0:i.model)||void 0===n?void 0:n.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 e.Vector3).fromArray([d.position.x,2*d.position.y-d.standingPosition.y,d.position.z]))}var p=$o(a.bounding,new e.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",t,a),o.throwError(t),o.modelPending=!1,r()}})),this.modelPending=!0,a.load(t,this.textureOptions).catch(Ue)},i.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}},i.prototype.saveControllerPose=function(e){void 0===e&&(e=this.controller),e&&Cl(e)&&(this.panoramaLikeSavedPose.longitude=this.camera.pose.longitude,this.panoramaLikeSavedPose.latitude=this.camera.pose.latitude,this.panoramaLikeSavedPose.fov=this.camera.pose.fov)},i.prototype.applyController=function(e,t){var r=this;if(!this.renderer)throw new Error("renderer is not initialized.");var n=Sl[e];e===this.currentMode||this.model.empty||this.model.show(),this.model.setTransparent(e===i.Mode.Floorplan||e===i.Mode.Topview||e===i.Mode.Model||e===i.Mode.Mapview),this.currentMode=e;for(var o=new n(t),s=function(e){o.on(e,(function(){for(var t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];var n=r.emit.apply(r,Ne([e],t,!1));if(n)return!1}))},a=0,l=Il;a<l.length;a++)s(l[a]);var u=Sl[e].initAnimationEndPose(t),c=t.initial[3],h={panoIndex:t.initial[0],mode:e,longitude:u.longitude,latitude:u.latitude,fov:u.fov,offset:u.offset,distance:u.distance};return ls(this.state,h)||(as(this.state,h),this.emit("stateChange",this.state,c)),this.emit("currentStateChange",this.getCurrentState(),c),o.on("cameraUpdate",(function(t,i){var n;if(r.controller){var o=Fe(Fe({},r.controller.getTargetPose()),{panoIndex:r.panoIndex,mode:e});i&&!1===r.syncingState&&r.state.mode===o.mode&&!ls(r.state,o)&&(as(r.state,o),r.emit("stateChange",r.state,i),null===(n=r.analysis)||void 0===n||n.state(r.work,r.state))}r.emit("currentStateChange",r.getCurrentState(),i)})),o.on("initAnimationWillStart",(function(t,i,n){var o,s=Fe(Fe({},i),{panoIndex:t,mode:e});n&&r.state.mode===s.mode&&!ls(r.state,s)&&(as(r.state,s),r.emit("stateChange",r.state,n),null===(o=r.analysis)||void 0===o||o.state(r.work,r.state))})),o.on("initAnimationEnded",(function(t,i,n){var o,s=Fe(Fe({},i),{panoIndex:t,mode:e});n&&r.state.mode===s.mode&&!ls(r.state,s)&&(as(r.state,s),r.emit("stateChange",r.state,n),null===(o=r.analysis)||void 0===o||o.state(r.work,r.state))})),o.on("panoWillArrive",(function(t,i,n){var o;r.panoIndex=t;var s=Fe(Fe({},i),{panoIndex:t,mode:e});n&&r.state.mode===s.mode&&!ls(r.state,s)&&(as(r.state,s),r.emit("stateChange",r.state,n),null===(o=r.analysis)||void 0===o||o.state(r.work,r.state))})),o.on("panoArrived",(function(t,i,n){var o,s=Fe(Fe({},i),{panoIndex:t,mode:e});n&&r.state.mode===s.mode&&!ls(r.state,s)&&(as(r.state,s),r.emit("stateChange",r.state,n),null===(o=r.analysis)||void 0===o||o.state(r.work,r.state))})),o.on("moveToPano",(function(e,t){r.emit("currentStateChange",r.getCurrentState(),t)})),o.on("wantsMoveToPano",(function(e,t,i){var n=r.emit("wantsMoveToPano",e,t,i);n||(n=r.emit("wantsToMoveToPano",e,t,i)),n||r.moveToPano(e,t,i)})),o.on("vrWantsToExit",(function(){r.currentMode===i.Mode.VRPanorama&&(r.exitFullscreen(),r.changeMode(i.Mode.Panorama))})),o.on("error",(function(e){return r.throwError(e)})),o},i.prototype.removeEventListeners=function(){},i.prototype.diposeGPUPickingMaterial=function(){this.meshReplaceMaterialMap.forEach((function(e){e.dispose()})),this.meshOriginMaterialMap.forEach((function(e){e.dispose()}))},i.Mode={Panorama:"Panorama",Model:"Model",Floorplan:"Floorplan",Topview:"Topview",Mapview:"Mapview",DepthPanorama:"DepthPanorama",VRPanorama:"VRPanorama",XRPanorama:"XRPanorama"},i.Line=null,i}(qe),Zl={instances:{},constructor:Yl};"undefined"!=typeof window&&Object.assign(window,{__FIVE_DEBUG__:Zl});var Jl=function(){function e(){}return e.createButton=function(e){var t=document.createElement("button");function i(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",i(t),navigator.xr.isSessionSupported("immersive-vr").then((function(i){i?(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()}):(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")})),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",i(r),r},e}()})(),__webpack_exports__})()));
|