@realsee/five 6.2.3 → 6.2.5

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/umd/five.js CHANGED
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * @license
3
3
  * @realsee/five
4
- * Generated: 2024/11/8
5
- * Version: 6.2.3
4
+ * Generated: 2024/11/26
5
+ * Version: 6.2.5
6
6
  * Terms:
7
7
  * Realsee SDK License Agreement
8
8
  * Update: July 28, 2021
@@ -414,7 +414,7 @@ varying vec2 vUv;
414
414
  void main() {
415
415
  gl_FragColor = texture2D(map, vUv);
416
416
  }
417
- `,cacheMaterials=[],cameraPX=new THREE__namespace.PerspectiveCamera(90,1,.1,2);cameraPX.up.set(0,-1,0),cameraPX.lookAt(new THREE__namespace.Vector3(1,0,0)),cameraPX.updateMatrix(),cameraPX.matrixAutoUpdate=!1;var cameraNX=new THREE__namespace.PerspectiveCamera(90,1,.1,2);cameraNX.up.set(0,-1,0),cameraNX.lookAt(new THREE__namespace.Vector3(-1,0,0)),cameraNX.updateMatrix(),cameraNX.matrixAutoUpdate=!1;var cameraPY=new THREE__namespace.PerspectiveCamera(90,1,.1,2);cameraPY.up.set(0,0,1),cameraPY.lookAt(new THREE__namespace.Vector3(0,1,0)),cameraPY.updateMatrix(),cameraPY.matrixAutoUpdate=!1;var cameraNY=new THREE__namespace.PerspectiveCamera(90,1,.1,2);cameraNY.up.set(0,0,-1),cameraNY.lookAt(new THREE__namespace.Vector3(0,-1,0)),cameraNY.updateMatrix(),cameraNY.matrixAutoUpdate=!1;var cameraPZ=new THREE__namespace.PerspectiveCamera(90,1,.1,2);cameraPZ.up.set(0,-1,0),cameraPZ.lookAt(new THREE__namespace.Vector3(0,0,1)),cameraPZ.updateMatrix(),cameraPZ.matrixAutoUpdate=!1;var cameraNZ=new THREE__namespace.PerspectiveCamera(90,1,.1,2);cameraNZ.up.set(0,-1,0),cameraNZ.lookAt(new THREE__namespace.Vector3(0,0,-1)),cameraNZ.updateMatrix(),cameraNZ.matrixAutoUpdate=!1;var FACES={front:{camera:cameraPZ,index:4},back:{camera:cameraNZ,index:5},up:{camera:cameraPY,index:2},down:{camera:cameraNY,index:3},left:{camera:cameraNX,index:1},right:{camera:cameraPX,index:0}};function getMaterial(){var n=cacheMaterials.pop();return n||new THREE__namespace.ShaderMaterial({uniforms:{map:{value:null},flipY:{value:0}},vertexShader:PLANE_VERTEX_SHADER,fragmentShader:PLANE_FRAGMENT_SHADER,depthTest:!1,depthWrite:!1,stencilWrite:!1,blending:THREE__namespace.NoBlending,lights:!1,toneMapped:!1,fog:!1})}function releaseMaterial(n){n.uniforms.map.value=null,cacheMaterials.push(n)}function renderTexturesToCubeRenderTarget(n,t,e){var r=new THREE__namespace.Scene;r.matrixAutoUpdate=!1;var i=new THREE__namespace.Group;i.scale.set(1,1,-1),r.add(i);for(var o=[],s=new Set,u=0,c=n;u<c.length;u++){var l=c[u];s.add(l.face);var d=getMaterial();o.push(d),d.uniforms.map.value=l.texture,d.uniforms.flipY.value=l.flipY?1:0;var f=new THREE__namespace.Group,v=new THREE__namespace.Mesh(PLAME_GEOMETRY,d);v.position.set(l.position.x+l.size.x/2-.5,1-(l.position.y+l.size.y/2)-.5,-.5),v.scale.set(l.size.x,l.size.y,1),f.quaternion.copy(QUATERNION[l.face]),f.add(v),i.add(f)}var A=e.autoClear,h=e.sortObjects,p=e.xr.enabled,y=t.texture.generateMipmaps;e.autoClear=!1,e.sortObjects=!1,e.xr.enabled=!1,t.texture.generateMipmaps=!1;var m=e.getRenderTarget(),g=0;s.forEach(function(T){++g===s.size&&(t.texture.generateMipmaps=y),e.setRenderTarget(t,FACES[T].index),e.render(r,FACES[T].camera)}),e.setRenderTarget(m),e.autoClear=A,e.sortObjects=h,e.xr.enabled=p;for(var E=0,b=o;E<b.length;E++){var d=b[E];releaseMaterial(d)}}var canUseNativeImageBitmap=function(){return!1}();function createImageBitmapLikeImage(n){n===void 0&&(n={});var t=Object.assign(document.createElementNS("http://www.w3.org/1999/xhtml","img"),{crossOrigin:"",close:function(){n.onClose&&n.onClose.call(this),this.onerror=this.onload=this.close=noop$1,this.removeAttribute("src")}});return t}function createImageBitmapLike(n){return new Promise(function(t,e){var r=URL.createObjectURL(n),i=createImageBitmapLikeImage({onClose:function(){this.src===r&&URL.revokeObjectURL(r)}});i.onload=function(){i.src===r&&URL.revokeObjectURL(r),i.onload=i.onerror=noop$1,setTimeout(function(){t(i)},10)},i.onerror=function(){var o=i.src;i.onload=i.onerror=noop$1,i.close(),e(new Error("image load error: ".concat(o)))},i.decoding="async",i.src=r})}var canvasPool=[];function createCanvas(n,t){var e=canvasPool.shift();if(e)return e.width=n,e.height=t,e;var r=Object.assign(document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),{close:function(){r.close=noop$1,canvasPool.push(r)}});return r}function poolImageToTexture(n,t){if(t&&(n.width>t.width||n.height>t.height)){var e=createCanvas(Math.min(n.width,t.width),Math.min(n.height,t.height)),r=e.getContext("2d");r.clearRect(0,0,e.width,e.height),r.drawImage(n,0,0,e.width,e.height),n.close();var i=new THREE__namespace.Texture(e);i.needsUpdate=!0,i.flipY=!0;var o=i.dispose;return i.dispose=function(){e.close(),o.call(i),i.dispose=o},i}else{var s=new THREE__namespace.Texture(n);s.needsUpdate=!0,typeof ImageBitmap!="undefined"&&n instanceof ImageBitmap?s.flipY=!1:s.flipY=!0;var u=s.dispose;return s.dispose=function(){n.close(),u.call(s),s.dispose=u},s}}function poolImagesToCubeTexture(n){var t=new THREE__namespace.CubeTexture(n);t.needsUpdate=!0,t.flipY=!1;var e=t.dispose;return t.dispose=function(){for(var r=0,i=n;r<i.length;r++){var o=i[r];o.close()}e.call(t),t.dispose=e},t}var sharedSortVector3$1=new THREE__namespace.Vector3,FACE_ORDER=["right","left","up","down","front","back"],TileCubeTextureTarget=function(){function n(t,e,r,i,o){this.tileTree=e,this.tileSources=r,this.options=i,this.renderer=o,this.name="",this.needsRender=!1,this.maxRequest=n.DEFAULT_MAX_REQUEST,this.disposed=!1,this.loadedCubeNodes=new Set,this.loadingCubeNodes=new Set,this.drawedCubeNodes=new Set,this.baseCubeTexture=null,this._cubeRenderTarget=null,this.prepareToRender=[],this.baseCubeTexture=t}return Object.defineProperty(n.prototype,"cubeRenderTarget",{get:function(){return this._cubeRenderTarget},set:function(t){var e,r,i,o,s,u;if(t===null)throw new Error("cannot set cubeRenderTarget to null.");t.width!==this.options.textureSize&&t.setSize(this.options.textureSize,this.options.textureSize),t.texture.format=(e=this.options.format)!==null&&e!==void 0?e:THREE__namespace.RGBAFormat,t.texture.minFilter=(r=this.options.minFilter)!==null&&r!==void 0?r:THREE__namespace.LinearFilter,t.texture.magFilter=(i=this.options.magFilter)!==null&&i!==void 0?i:THREE__namespace.LinearFilter,t.texture.wrapS=(o=this.options.wrapS)!==null&&o!==void 0?o:THREE__namespace.ClampToEdgeWrapping,t.texture.wrapT=(s=this.options.wrapT)!==null&&s!==void 0?s:THREE__namespace.ClampToEdgeWrapping,t.texture.generateMipmaps=(u=this.options.generateMipmaps)!==null&&u!==void 0?u:!0,this.baseCubeTexture&&(renderCubeTextureToCubeRenderTarget(this.baseCubeTexture,t,this.renderer),this.baseCubeTexture.dispose(),this.baseCubeTexture=null),this._cubeRenderTarget&&renderCubeTextureToCubeRenderTarget(this._cubeRenderTarget.texture,t,this.renderer),this._cubeRenderTarget=t},enumerable:!1,configurable:!0}),n.prototype.requestTile=function(t){var e=this,r,i,o,s,u,c,l=this.tileSources.filter(function(p){return p.level===t.level})[0];if(!l)return this.loadedCubeNodes.add(t),this.prepareToRender.push({node:t,texture:null}),!1;var d=l.size,f=Math.pow(2,t.level)*t.position.y,v=Math.pow(2,t.level)*t.position.x,A="".concat(((o=(i=(r=this.options.imageURL)===null||r===void 0?void 0:r.options)===null||i===void 0?void 0:i.key)!==null&&o!==void 0?o:"pano.0").replace(/^pano/,"pano_tile"),".").concat(t.face,".").concat(t.level,".").concat(f,".").concat(v),h=__assign(__assign({},(u=(s=this.options.imageURL)===null||s===void 0?void 0:s.options)!==null&&u!==void 0?u:{key:"unknown"}),{key:A,size:l.scale>=1?void 0:d*t.size*l.scale,quality:void 0,cut:[d*t.position.x,d*t.position.y,d*t.size,d*t.size]});return this.loadingCubeNodes.add(t),this.options.textureLoader.loadTexture(l[t.face],{imageURL:{transform:(c=this.options.imageURL)===null||c===void 0?void 0:c.transform,options:__assign({},h)},format:THREE__namespace.RGBAFormat,timeout:this.options.timeout,magFilter:this.options.magFilter,minFilter:this.options.minFilter,fetcher:this.options.fetcher}).then(function(p){if(e.disposed){p.body.dispose();return}e.prepareToRender.push({node:t,texture:p.body}),e.loadedCubeNodes.add(t)}).catch(noop$1).then(function(){e.disposed||e.loadingCubeNodes.delete(t)}),!0},n.prototype.update=function(t,e){var r=this;if(!this.disposed){var i=t.planes[5].normal,o=Math.max(this.maxRequest-this.loadingCubeNodes.size,0),s=[];traverseTileCubeNode(this.tileTree,function(p){if(p.level>e||!t.intersectsBox(p.box))return!1;!r.loadedCubeNodes.has(p)&&!r.loadingCubeNodes.has(p)&&s.push(p)}),s.sort(function(p,y){return p.level!==y.level?p.level-y.level:p.box.getCenter(sharedSortVector3$1).angleTo(i)-y.box.getCenter(sharedSortVector3$1).angleTo(i)});for(var u=0,c=s;u<c.length;u++){var l=c[u];if(o<=0)break;var d=this.requestTile(l);d&&o--}if(this.cubeRenderTarget&&this.prepareToRender.length){this.prepareToRender.sort(function(p,y){return p.node.level-y.node.level});for(var f=[],v=0;v<this.prepareToRender.length;v++){var A=this.prepareToRender[v],l=A.node,h=A.texture;(l.parent===null||this.drawedCubeNodes.has(l.parent))&&(this.drawedCubeNodes.add(l),h&&f.push({face:l.face,position:l.position,size:new THREE__namespace.Vector2(l.size,l.size),texture:h,flipY:!h.flipY}),this.prepareToRender.splice(v,1),v--)}f.length&&(renderTexturesToCubeRenderTarget(f,this.cubeRenderTarget,this.renderer),this.needsRender=!0)}}},Object.defineProperty(n.prototype,"tilePending",{get:function(){return this.loadingCubeNodes.size},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"texture",{get:function(){if(!this._cubeRenderTarget)throw new Error("cubeRenderTarget never set.");return this._cubeRenderTarget.texture},enumerable:!1,configurable:!0}),n.prototype.dispose=function(){if(!this.disposed){this.disposed=!0,this.baseCubeTexture&&(this.baseCubeTexture.dispose(),this.baseCubeTexture=null),this.loadingCubeNodes.clear(),this.loadedCubeNodes.clear();for(var t=0,e=this.prepareToRender;t<e.length;t++){var r=e[t];r.texture&&r.texture.dispose()}this.prepareToRender.length=0}},n.DEFAULT_MAX_REQUEST=3,n}(),TextureLoader=function(){function n(){}return n.prototype.loadTexture=function(t,e,r,i,o,s){var u,c,l,d,f,v,A;r===void 0&&(r=noop$1),i===void 0&&(i=noop$1),o===void 0&&(o=noop$1);var h={};typeof e.flipY!="undefined"&&(h.flipY=e.flipY),typeof e.format!="undefined"&&(h.format=e.format),typeof e.encoding!="undefined"&&(h.encoding=e.encoding),h.generateMipmaps=(u=e.generateMipmaps)!==null&&u!==void 0?u:!1,h.minFilter=(c=e.minFilter)!==null&&c!==void 0?c:THREE__namespace.LinearFilter,h.magFilter=(l=e.magFilter)!==null&&l!==void 0?l:THREE__namespace.LinearFilter;var p=(f=(d=e.imageURL)===null||d===void 0?void 0:d.options)!==null&&f!==void 0?f:{key:"unknown"};t=applyImageURLOptions(t,(v=e.imageURL)===null||v===void 0?void 0:v.transform,p);var y=getProtocol(t),m=(A=e.viaAjax)!==null&&A!==void 0?A:canUseNativeImageBitmap,g=isJsonpSource(t),E=/^https?:/.test(y);if(g?m=!0:E||(m=!1),m){var b=null,T="blob";return e.fetcher.ajax(t,{timeout:e.timeout,responseType:T},void 0,void 0,o).then(function(R){return createImageBitmapLike(R.body)}).then(function(R){return poolImageToTexture(R,e.maxSize)}).then(function(R){return Object.assign(R,h),R}).then(function(R){var B={meta:b,body:R};return r(B),B}).catch(function(R){return i(R),Promise.reject(R)})}else{var _=null,S;return Promise.resolve().then(function(){return createImageBitmapLikeImage()}).then(function(R){return S=R,e.fetcher.loadImage(t,{timeout:e.timeout},void 0,void 0,o,R)}).then(function(R){return _=R.meta,poolImageToTexture(R.body,e.maxSize)}).then(function(R){return Object.assign(R,h),R}).then(function(R){var B={meta:_,body:R};return r(B),B}).catch(function(R){return S&&S.close(),i(R),Promise.reject(R)})}},n.prototype.loadCubeTexture=function(t,e,r,i,o,s){var u,c,l,d,f,v,A;r===void 0&&(r=noop$1),i===void 0&&(i=noop$1),o===void 0&&(o=noop$1);var h={};typeof e.format!="undefined"&&(h.format=e.format),h.generateMipmaps=(u=e.generateMipmaps)!==null&&u!==void 0?u:!1,h.minFilter=(c=e.minFilter)!==null&&c!==void 0?c:THREE__namespace.LinearFilter,h.magFilter=(l=e.magFilter)!==null&&l!==void 0?l:THREE__namespace.LinearFilter;for(var p=[t[FACE_ORDER[0]],t[FACE_ORDER[1]],t[FACE_ORDER[2]],t[FACE_ORDER[3]],t[FACE_ORDER[4]],t[FACE_ORDER[5]]],y=[],m=[0,0,0,0,0,0],g=[],E=function(T){var _=(f=(d=e.imageURL)===null||d===void 0?void 0:d.options)!==null&&f!==void 0?f:{key:"unknown"},S=applyImageURLOptions(p[T],(v=e.imageURL)===null||v===void 0?void 0:v.transform,__assign(__assign({},_),{key:_.key+"."+FACE_ORDER[T]})),R=getProtocol(S),B=function(F){m[T]=F,o(m.reduce(function(O,G){return O+G},0)/6)},I=(A=e.viaAjax)!==null&&A!==void 0?A:!1,x=/^https?:$/.test(R),M=isJsonpSource(S);if(M?I=!0:x||(I=!1),I){var L="blob",C=e.fetcher.ajax(S,{timeout:e.timeout,responseType:L},void 0,void 0,B).then(function(F){return g[T]=F.meta,createImageBitmapLike(F.body)});y.push(C)}else{var H,C=Promise.resolve().then(function(){return createImageBitmapLikeImage()}).then(function(O){return H=O,e.fetcher.loadImage(S,{timeout:e.timeout},void 0,void 0,B,O)}).then(function(O){return g[T]=O.meta,O.body}).catch(function(O){return H&&H.close(),Promise.reject(O)});y.push(C)}},b=0;b<6;b++)E(b);return Promise.all(y).then(function(T){return poolImagesToCubeTexture(T)}).then(function(T){return Object.assign(T,__assign({encoding:THREE__namespace.sRGBEncoding},h)),T}).then(function(T){var _={body:T,meta:g};return r(_),_}).catch(function(T){for(var _=0,S=y;_<S.length;_++){var R=S[_];R.then(function(B){return B.close()}).catch(noop$1)}return i(T),Promise.reject(T)})},n.prototype.loadTiledCubeTexture=function(t,e,r,i,o,s,u){var c=this;return i===void 0&&(i=noop$1),o===void 0&&(o=noop$1),s===void 0&&(s=noop$1),new Promise(function(l,d){var f,v;c.loadCubeTexture(t,{imageURL:{transform:(f=r.imageURL)===null||f===void 0?void 0:f.transform,options:(v=r.imageURL)===null||v===void 0?void 0:v.options},format:THREE__namespace.RGBAFormat,viaAjax:r.viaAjax,timeout:r.timeout,fetcher:r.fetcher,magFilter:r.magFilter,minFilter:r.minFilter,generateMipmaps:r.generateMipmaps},function(A){var h,p=A.meta,y=A.body,m=(h=r.tileMaxLevel)!==null&&h!==void 0?h:2,g=Math.max(1024*m,512),E=createTileCubeTree(m),b=new TileCubeTextureTarget(y,E,e,{textureSize:g,textureLoader:c,imageURL:r.imageURL,magFilter:r.magFilter,minFilter:r.minFilter,generateMipmaps:r.generateMipmaps,timeout:r.timeout,fetcher:r.fetcher},u),T={meta:p,body:b};i(T),l(T)},function(A){o(A),d(A)},s,u).catch(noop$1)})},n}();const meshNoneVertexShader=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=113,i=126,o=0,s="";return t[o].split(s).map(function(u){return u.charCodeAt(o)>i?u:String.fromCharCode((u.charCodeAt(o)+r)%i)}).join(s)}("n\bv{t-rpA-d|yq]|vv|{Hn\bv{t-rp@-PnzrnQvrpv|{H0v{pyqr-Ip|zz|{K0v{pyqr-Iz|}untrl}nlrr\x07K0v{pyqr-Ixv{{v{tl}nlrr\x07K0v{pyqr-Iy|tqr}uosl}nlrr\x07K0v{pyqr-Ipyv}}v{tl}yn{rl}nlrr\x07K|vq-znv{56-\n--0v{pyqr-Ixv{onrlrr\x07K--0v{pyqr-Iortv{lrr\x07K--0v{pyqr-Iz|}untrlrr\x07K--0v{pyqr-Ixv{{v{tlrr\x07K--0v{pyqr-I}|wrplrr\x07K--0v{pyqr-Iy|tqr}uoslrr\x07K--0v{pyqr-Ipyv}}v{tl}yn{rlrr\x07K--d|yq]|vv|{-J-rpA5n{s|zrq9->;=6H--0vsqrs-b`RlV[`aN[PV[T----d|yq]|vv|{-J-v{n{prZnv\x07-7-d|yq]|vv|{H--0r{qvs--d|yq]|vv|{-J-z|qryZnv\x07-7-d|yq]|vv|{H--zn@-pnzrn_|nv|{Znv\x07-J-zn@5vrZnv\x07h=jh=j9-vrZnv\x07h>jh=j9-vrZnv\x07h?jh=j9-vrZnv\x07h=jh>j9-vrZnv\x07h>jh>j9-vrZnv\x07h?jh>j9-vrZnv\x07h=jh?j9-vrZnv\x07h>jh?j9-vrZnv\x07h?jh?j6H--PnzrnQvrpv|{-J-{|znyv r5pnzrn_|nv|{Znv\x07-7-rp@5=;=9-=;=9-:>;=66H--0v{pyqr-I|yq}|lrr\x07K--0v{pyqr-Is|tlrr\x07K\f"),meshNoneFragmentShader=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=113,i=126,o=0,s="";return t[o].split(s).map(function(u){return u.charCodeAt(o)>i?u:String.fromCharCode((u.charCodeAt(o)+r)%i)}).join(s)}("0qrsv{r-OYNPXlP\\Y\\_-rpA5=;=EC9-=;>=C9-=;>AF9->;=6{vs|z-nz}yrPor-}n{|=lzn}H{vs|z-znA-}n{|=lznv\x07H{vs|z-sy|n-}n{|=l ||zH0vs-qrsv{rq5b`RlYbZV[N[PR6--{vs|z-nz}yrPor-}n{|=lyzv{n{prZn}H0r{qvs{vs|z-nz}yrPor-}n{|>lzn}H{vs|z-znA-}n{|>lznv\x07H{vs|z-sy|n-}n{|>l ||zH0vs-qrsv{rq5b`RlYbZV[N[PR6--{vs|z-nz}yrPor-}n{|>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p@-}n{|>a|crr\x07-J-{|znyv r5d|yq]|vv|{;\x07\b -:-}n{|>lznv\x07h@j;\x07\b 6H--}n{|>a|crr\x07-J- ||zcrp|5PnzrnQvrpv|{9-}n{|>a|crr\x079-}n{|>l ||z6H--}n{|>a|crr\x07-J-}n{|>a|crr\x07-7-zn@5}n{|>lznv\x076H--rpA-}n{|P|y|H--rpA-}n{|=P|y|-J-r\x07rPor5}n{|=lzn}9-}n{|=a|crr\x076H--rpA-}n{|>P|y|-J-r\x07rPor5}n{|>lzn}9-}n{|>a|crr\x076H--0vs-qrsv{rq5b`RlYbZV[N[PR6----}n{|=P|y|;n-J->;=-:-r\x07rPor5}n{|=lyzv{n{prZn}9-}n{|=a|crr\x076;H----}n{|>P|y|;n-J->;=-:-r\x07rPor5}n{|>lyzv{n{prZn}9-}n{|>a|crr\x076;H--0r{qvs--0vs-qrsv{rq5b`RlOYNPXla_N[`VaV\\[6----sy|n-oynpx]|tr-J-np|5:?;=-7-}|tr-8->;=6H----}n{|P|y|-J-zv\x075}n{|=P|y|9-OYNPXlP\\Y\\_9-zv{5>;=9-oynpx]|tr66H----}n{|P|y|-J-zv\x075}n{|P|y|9-}n{|>P|y|9-zn\x075=;=9-oynpx]|tr-:-]V-8->;=66H--0ryvs-qrsv{rq5b`Rl`]_RNQla_N[`VaV\\[6----rp?-prr{Pr{rP||q-J-r|yv|{-7-}v\x07ry_nv|-<-?;=H----sy|n-n{vv|{_nqv-J-qvn{pr5rp?5=;=9-=;=69-prr{Pr{rP||q6-7->;?H----sy|n-n{vv|{]|tr-J--qvn{pr5tylSntP||q;\x07\b9-prr{Pr{rP||q6-<-n{vv|{_nqvH----}n{|P|y|-J-zv\x075}n{|=P|y|9-}n{|>P|y|9-z||ur}5=;=9-=;?9-}|tr-:-n{vv|{]|tr66H--0ryr----}n{|P|y|-J-zv\x075}n{|=P|y|9-}n{|>P|y|9-}|tr6H--0r{qvs--tylSntP|y|-J-zv\x075}n{|P|y|9-tylSntP|y|9-z|qryNy}un6H--tylSntP|y|;n-J-|}npv\b-7-ovtu{rH--<<-JJJJJJJJJJJJJJJJ--0v{pyqr-Is|tlsntzr{K--0v{pyqr-I}rzyv}yvrqlny}unlsntzr{K--0v{pyqr-Iqvurv{tlsntzr{K\f"),meshBasicVertexShader=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=113,i=126,o=0,s="";return t[o].split(s).map(function(u){return u.charCodeAt(o)>i?u:String.fromCharCode((u.charCodeAt(o)+r)%i)}).join(s)}("0vs-qrsv{rq5b`RlRQY6--n\bv{t-sy|n-Y|tQr}uH0r{qvs0vs-qrsv{rq5b`RlcR_aRelZN_X6--nvor-sy|n-znxH0r{qvsn\bv{t-sy|n-V_||sZnxHn\bv{t-rpA-d|yq]|vv|{Hn\bv{t-rp@-PnzrnQvrpv|{Hn\bv{t-rp@-cvr]|vv|{H0v{pyqr-Ip|zz|{K0v{pyqr-Il}nlrr\x07K0v{pyqr-I?l}nlrr\x07K0v{pyqr-Ir{zn}l}nlrr\x07K0v{pyqr-Ip|y|l}nlrr\x07K0v{pyqr-Is|tl}nlrr\x07K0v{pyqr-Iz|}untrl}nlrr\x07K0v{pyqr-Ixv{{v{tl}nlrr\x07K0v{pyqr-Iy|tqr}uosl}nlrr\x07K0v{pyqr-Ipyv}}v{tl}yn{rl}nlrr\x07K|vq-znv{56-\n--0v{pyqr-Ilrr\x07K--0v{pyqr-I?lrr\x07K--0v{pyqr-Ip|y|lrr\x07K--0v{pyqr-Ixv{onrlrr\x07K--0vsqrs-b`RlR[cZN]--0v{pyqr-Iortv{{|znylrr\x07K--0v{pyqr-Iz|}u{|znylrr\x07K--0v{pyqr-Ixv{{|znylrr\x07K--0v{pyqr-Iqrsny{|znylrr\x07K--0r{qvs--0v{pyqr-Iortv{lrr\x07K--0v{pyqr-Iz|}untrlrr\x07K--0v{pyqr-Ixv{{v{tlrr\x07K--0v{pyqr-I}|wrplrr\x07K--0v{pyqr-Iy|tqr}uoslrr\x07K--0v{pyqr-Ipyv}}v{tl}yn{rlrr\x07K--cvr]|vv|{-J-:z]|vv|{;\x07\b H--d|yq]|vv|{-J-rpA5n{s|zrq9->;=6H--0vsqrs-b`RlV[`aN[PV[T----d|yq]|vv|{-J-v{n{prZnv\x07-7-d|yq]|vv|{H--0r{qvs--d|yq]|vv|{-J-z|qryZnv\x07-7-d|yq]|vv|{H--zn@-pnzrn_|nv|{Znv\x07-J-zn@5vrZnv\x07h=jh=j9-vrZnv\x07h>jh=j9-vrZnv\x07h?jh=j9-vrZnv\x07h=jh>j9-vrZnv\x07h>jh>j9-vrZnv\x07h?jh>j9-vrZnv\x07h=jh?j9-vrZnv\x07h>jh?j9-vrZnv\x07h?jh?j6H--PnzrnQvrpv|{-J-{|znyv r5pnzrn_|nv|{Znv\x07-7-rp@5=;=9-=;=9-:>;=66H--0vs-qrsv{rq5b`RlRQY6----Y|tQr}u-J-y|t?5:z]|vv|{; 6H--0r{qvs--V_||sZnx-J-=;=H--0vs-qrsv{rq5b`RlcR_aRelZN_X6----V_||sZnx-J-r}5no5znx-:->;=69-=;>6H--0r{qvs--0v{pyqr-I|yq}|lrr\x07K--0v{pyqr-Ir{zn}lrr\x07K--0v{pyqr-Is|tlrr\x07K\f"),meshBasicFragmentShader=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=113,i=126,o=0,s="";return t[o].split(s).map(function(u){return u.charCodeAt(o)>i?u:String.fromCharCode((u.charCodeAt(o)+r)%i)}).join(s)}("0qrsv{r-OYNPXlP\\Y\\_-rpA5=;=EC9-=;>=C9-=;>AF9->;=6{vs|z-sy|n-sy||H{vs|z-nz}yrPor-}n{|=lzn}H{vs|z-znA-}n{|=lznv\x07H{vs|z-sy|n-}n{|=l ||zH0vs-qrsv{rq5b`RlYbZV[N[PR6--{vs|z-nz}yrPor-}n{|=lyzv{n{prZn}H0r{qvs{vs|z-nz}yrPor-}n{|>lzn}H{vs|z-znA-}n{|>lznv\x07H{vs|z-sy|n-}n{|>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p@-rp|9-sy|n- ||z6-\n--sy|n-urn-J-q|5qvrpv|{9-rp|6H--rp@-q-J-qvrpv|{-7-urnH--rp@-}-J-rp|-:-qH--rp@-\0-J-}-7- ||zH--r{-{|znyv r5q-8-\x006H\f|vq-znv{56-\n--<<-JJJ-顶部裁切-JJJ--sy|n-||sP]|tr-J-}|5pynz}5:PnzrnQvrpv|{;\b9-=;=9->;=69-@;=6H--vs-5----V_||sZnx-K-=;B-33----d|yq]|vv|{;\b-K-z|qryO|{qv{tZn\x07;\b-:-||sP]|tr-7-5z|qryO|{qv{tZn\x07;\b-:-z|qryO|{qv{tZv{;\b6--6-\n----qvpnqH--\f--<<-JJJJJJJJJJJJJJ--<<-JJJ-前置裁切计算-JJJ--0vs-[bZlPYV]]R_`-K-=----o||y-pyv}}rqH----rpA-pyv}}r]|vv|{H----0}ntzn-{|yyly||}ln----s|-5-v{-v-J-=H-v-I-[bZlPYV]]R_`H-v-88-6-\n------pyv}}r]|vv|{-J-pyv}}rh-v-j;znv\x07V{rr-7-d|yq]|vv|{H------pyv}}rq-J-5pyv}}rh-v-j;sy||V{qr\x07-I-=;=-\v\v-no5sy||-:-pyv}}rh-v-j;sy||V{qr\x076-I->;=6H------pyv}}rq-J-pyv}}rq-33-pyv}}r]|vv|{;\x07-K-:=;B-33-pyv}}r]|vv|{;\x07-I-=;BH------pyv}}rq-J-pyv}}rq-33-pyv}}r]|vv|{;\b-K-:=;B-33-pyv}}r]|vv|{;\b-I-=;BH------pyv}}rq-J-pyv}}rq-33-pyv}}r]|vv|{; -K-:=;B-33-pyv}}r]|vv|{; -I-=;BH------vs-5pyv}}rq6-\n--------qvpnqH------\f----\f----0}ntzn-{|yyly||}lr{q--0r{qvs--<<-JJJJJJJJJJJJJJJJJJ--0v{pyqr-Ipyv}}v{tl}yn{rlsntzr{K--rpA-qvssrP|y|-J-rpA5-qvssr9-|}npv\b-6H--0v{pyqr-Iy|tqr}uoslsntzr{K--0v{pyqr-Izn}lsntzr{K--0v{pyqr-Ip|y|lsntzr{K--0v{pyqr-Iny}unzn}lsntzr{K--0v{pyqr-Iny}unrlsntzr{K--0v{pyqr-I}rpynzn}lsntzr{K--_rsyrprqYvtu-rsyrprqYvtu-J-_rsyrprqYvtu5-rp@5-=;=-69-rp@5-=;=-69-rp@5-=;=-69-rp@5-=;=-6-6H--<<-nppzynv|{-5onxrq-v{qvrp-yvtuv{t-|{y\b6--0vsqrs-b`RlYVTUaZN]----rpA-yvtuZn}ar\x07ryJ-r\x07r?Q5-yvtuZn}9-b?-6H----rsyrprqYvtu;v{qvrpQvssr-8J-yvtuZn}ar\x07rya|Yv{rn5-yvtuZn}ar\x07ry-6;to-7-yvtuZn}V{r{v\bH--0ryr----rsyrprqYvtu;v{qvrpQvssr-8J-rp@5->;=-6H--0r{qvs--<<-z|qynv|{--0v{pyqr-In|zn}lsntzr{K--rsyrprqYvtu;v{qvrpQvssr-7J-qvssrP|y|;toH--rp@-|t|v{tYvtu-J-rsyrprqYvtu;v{qvrpQvssrH--0v{pyqr-Ir{zn}lsntzr{K--tylSntP|y|-J-rpA5-|t|v{tYvtu9-qvssrP|y|;n-6H--<<-JJJ-纯色-JJJ--0vs-qrsv{rq5b`RlP\\[`aN[alP\\Y\\_6----tylSntP|y|-J-rpA5p|{n{P|y|;9-p|{n{P|y|;t9-p|{n{P|y|;o9-|}npv\b6H--0r{qvs--<<-JJJJJJJJJJJ--<<-JJJ-楼层显示-JJJ--sy|n-sy||\\}npv\b-J->;=H--vs-5u|{Sy||V{qr\x07-K-:=;=>-33-no5sy||-:-u|{Sy||V{qr\x076-K-=;FF6-\n----sy||\\}npv\b-J-=;?-7-zv{55>;=-8-PnzrnQvrpv|{;\b69->;=6H--\f--tylSntP|y|;n-J-tylSntP|y|;n-7-sy||\\}npv\b-7-ovtu{rH--<<-JJJJJJJJJJJJJJ--0v{pyqr-I|{rzn}}v{tlsntzr{K--0v{pyqr-Ir{p|qv{tlsntzr{K--<<-JJJ-全景图-JJJ--rp@-}n{|=a|crr\x07-J-{|znyv r5d|yq]|vv|{;\x07\b -:-}n{|=lznv\x07h@j;\x07\b 6H--}n{|=a|crr\x07-J- ||zcrp|5PnzrnQvrpv|{9-}n{|=a|crr\x079-}n{|=l ||z6H--}n{|=a|crr\x07-J-}n{|=a|crr\x07-7-zn@5}n{|=lznv\x076H--rp@-}n{|>a|crr\x07-J-{|znyv r5d|yq]|vv|{;\x07\b -:-}n{|>lznv\x07h@j;\x07\b 6H--}n{|>a|crr\x07-J- ||zcrp|5PnzrnQvrpv|{9-}n{|>a|crr\x079-}n{|>l ||z6H--}n{|>a|crr\x07-J-}n{|>a|crr\x07-7-zn@5}n{|>lznv\x076H--rpA-}n{|P|y|H--rpA-}n{|=P|y|-J-r\x07rPor5}n{|=lzn}9-}n{|=a|crr\x076H--rpA-}n{|>P|y|-J-r\x07rPor5}n{|>lzn}9-}n{|>a|crr\x076H--0vs-qrsv{rq5b`RlYbZV[N[PR6----}n{|=P|y|;n-J->;=-:-r\x07rPor5}n{|=lyzv{n{prZn}9-}n{|=a|crr\x076;H----}n{|>P|y|;n-J->;=-:-r\x07rPor5}n{|>lyzv{n{prZn}9-}n{|>a|crr\x076;H--0r{qvs--0vs-qrsv{rq5b`RlOYNPXla_N[`VaV\\[6----sy|n-oynpx]|tr-J-np|5:?;=-7-}|tr-8->;=6H----}n{|P|y|-J-zv\x075}n{|=P|y|9-OYNPXlP\\Y\\_9-zv{5>;=9-oynpx]|tr66H----}n{|P|y|-J-zv\x075}n{|P|y|9-}n{|>P|y|9-zn\x075=;=9-oynpx]|tr-:-]V-8->;=66H--0ryvs-qrsv{rq5b`Rl`]_RNQla_N[`VaV\\[6----rp?-prr{Pr{rP||q-J-r|yv|{-7-}v\x07ry_nv|-<-?;=H----sy|n-n{vv|{_nqv-J-qvn{pr5rp?5=;=9-=;=69-prr{Pr{rP||q6-7->;?H----sy|n-n{vv|{]|tr-J-qvn{pr5tylSntP||q;\x07\b9-prr{Pr{rP||q6-<-n{vv|{_nqvH----}n{|P|y|-J-zv\x075}n{|=P|y|9-}n{|>P|y|9-z||ur}5=;=9-=;?9-}|tr-:-n{vv|{]|tr66H--0ryr----}n{|P|y|-J-zv\x075}n{|=P|y|9-}n{|>P|y|9-}|tr6H--0r{qvs--tylSntP|y|-J-zv\x075}n{|P|y|9-tylSntP|y|9-z|qryNy}un6H--<<-JJJJJJJJJJJJJ--0v{pyqr-Is|tlsntzr{K--0v{pyqr-I}rzyv}yvrqlny}unlsntzr{K--0v{pyqr-Iqvurv{tlsntzr{K--0vs-qrsv{rq5b`RlRQY6----tylSntP|y|;n-J-Y|tQr}uH--0r{qvs\f"),meshPhongVertexShader=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=113,i=126,o=0,s="";return t[o].split(s).map(function(u){return u.charCodeAt(o)>i?u:String.fromCharCode((u.charCodeAt(o)+r)%i)}).join(s)}("0qrsv{r-]U\\[T0vs-qrsv{rq5b`RlRQY6--n\bv{t-sy|n-Y|tQr}uH0r{qvs0vs-qrsv{rq5b`RlcR_aRelZN_X6--nvor-sy|n-znxH0r{qvsn\bv{t-sy|n-V_||sZnxHn\bv{t-rpA-d|yq]|vv|{Hn\bv{t-rp@-PnzrnQvrpv|{Hn\bv{t-rp@-cvr]|vv|{H0vs{qrs-SYNal`UNQRQ--n\bv{t-rp@-[|znyH0r{qvs0v{pyqr-Ip|zz|{K0v{pyqr-Il}nlrr\x07K0v{pyqr-I?l}nlrr\x07K0v{pyqr-Iqv}ynprzr{zn}l}nlrr\x07K0v{pyqr-Ir{zn}l}nlrr\x07K0v{pyqr-Ip|y|l}nlrr\x07K0v{pyqr-Is|tl}nlrr\x07K0v{pyqr-Iz|}untrl}nlrr\x07K0v{pyqr-Ixv{{v{tl}nlrr\x07K0v{pyqr-Iunq|zn}l}nlrr\x07K0v{pyqr-Iy|tqr}uosl}nlrr\x07K0v{pyqr-Ipyv}}v{tl}yn{rl}nlrr\x07K|vq-znv{56-\n--0v{pyqr-Ilrr\x07K--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qr-Iunq|zn}lrr\x07K--0v{pyqr-Is|tlrr\x07K\f"),meshPhongFragmentShader=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=113,i=126,o=0,s="";return t[o].split(s).map(function(u){return u.charCodeAt(o)>i?u:String.fromCharCode((u.charCodeAt(o)+r)%i)}).join(s)}("0qrsv{r-]U\\[T0qrsv{r-OYNPXlP\\Y\\_-rpA5=;=EC9-=;>=C9-=;>AF9->;=6{vs|z-sy|n-sy||H{vs|z-nz}yrPor-}n{|=lzn}H{vs|z-znA-}n{|=lznv\x07H{vs|z-sy|n-}n{|=l ||zH0vs-qrsv{rq5b`RlYbZV[N[PR6--{vs|z-nz}yrPor-}n{|=lyzv{n{prZn}H0r{qvs{vs|z-nz}yrPor-}n{|>lzn}H{vs|z-znA-}n{|>lznv\x07H{vs|z-sy|n-}n{|>l ||zH0vs-qrsv{rq5b`RlYbZV[N[PR6--{vs|z-nz}yrPor-}n{|>lyzv{n{prZn}H0r{qvs{vs|z-sy|n-z|qryNy}unH{vs|z-sy|n-}|trH0vs-qrsv{rq5b`RlP\\[`aN[alP\\Y\\_6--{vs|z-rp@-p|{n{P|y|H0r{qvsp-Pyv}}r-\n--znA-znv\x07V{rrH--sy|n-sy||V{qr\x07H\fH0vs-[bZlPYV]]R_`-K-=--{vs|z-Pyv}}r-pyv}}rh[bZlPYV]]R_`jH0r{qvs0vs-qrsv{rq5b`RlRQY6--n\bv{t-sy|n-Y|tQr}uH0r{qvsn\bv{t-rpA-d|yq]|vv|{Hn\bv{t-rp@-PnzrnQvrpv|{Hn\bv{t-sy|n-V_||sZnxH{vs|z-sy|n-u|{Sy||V{qr\x07H{vs|z-rp?-r|yv|{H{vs|z-sy|n-}v\x07ry_nv|H{vs|z-rp@-qvssrH{vs|z-rp@-rzvvrH{vs|z-rp@-}rpynH{vs|z-sy|n-uv{v{rH{vs|z-sy|n-|}npv\bH{vs|z-sy|n-ovtu{rH{vs|z-rp@-z|qryO|{qv{tZn\x07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V]]R_`-K-=----o||y-pyv}}rqH----rpA-pyv}}r]|vv|{H----0}ntzn-{|yyly||}ln----s|-5-v{-v-J-=H-v-I-[bZlPYV]]R_`H-v-88-6-\n------pyv}}r]|vv|{-J-pyv}}rh-v-j;znv\x07V{rr-7-d|yq]|vv|{H------pyv}}rq-J-5pyv}}rh-v-j;sy||V{qr\x07-I-=;=-\v\v-no5sy||-:-pyv}}rh-v-j;sy||V{qr\x076-I->;=6H------pyv}}rq-J-pyv}}rq-33-pyv}}r]|vv|{;\x07-K-:=;B-33-pyv}}r]|vv|{;\x07-I-=;BH------pyv}}rq-J-pyv}}rq-33-pyv}}r]|vv|{;\b-K-:=;B-33-pyv}}r]|vv|{;\b-I-=;BH------pyv}}rq-J-pyv}}rq-33-pyv}}r]|vv|{; -K-:=;B-33-pyv}}r]|vv|{; -I-=;BH------vs-5pyv}}rq6-\n--------qvpnqH------\f----\f----0}ntzn-{|yyly||}lr{q--0r{qvs--<<-JJJJJJJJJJJJJJJJ--0v{pyqr-Ipyv}}v{tl}yn{rlsntzr{K--rpA-qvssrP|y|-J-rpA5-qvssr9-|}npv\b-6H--_rsyrprqYvtu-rsyrprqYvtu-J-_rsyrprqYvtu5-rp@5-=;=-69-rp@5-=;=-69-rp@5-=;=-69-rp@5-=;=-6-6H--rp@-|nyRzvvr_nqvn{pr-J-rzvvrH--0v{pyqr-Iy|tqr}uoslsntzr{K--0v{pyqr-Izn}lsntzr{K--0v{pyqr-Ip|y|lsntzr{K--0v{pyqr-Iny}unzn}lsntzr{K--0v{pyqr-Iny}unrlsntzr{K--0v{pyqr-I}rpynzn}lsntzr{K--0v{pyqr-I{|znylsntzr{lortv{K--0v{pyqr-I{|znylsntzr{lzn}K--0v{pyqr-Irzvvrzn}lsntzr{K--<<-nppzynv|{--0v{pyqr-Iyvtul}u|{tlsntzr{K--0v{pyqr-Iyvtulsntzr{lortv{K--0v{pyqr-Iyvtulsntzr{lzn}K--0v{pyqr-Iyvtulsntzr{lr{qK--<<-z|qynv|{--0v{pyqr-In|zn}lsntzr{K--rp@-|t|v{tYvtu-J-rsyrprqYvtu;qvrpQvssr-8-rsyrprqYvtu;v{qvrpQvssr-8-rsyrprqYvtu;qvrp`}rpyn-8-rsyrprqYvtu;v{qvrp`}rpyn-8-|nyRzvvr_nqvn{prH--0v{pyqr-Ir{zn}lsntzr{K--tylSntP|y|-J-rpA5-|t|v{tYvtu9-qvssrP|y|;n-6H--<<-JJJ-纯色-JJJ--0vs-qrsv{rq5b`RlP\\[`aN[alP\\Y\\_6----tylSntP|y|-J-rpA5p|{n{P|y|;9-p|{n{P|y|;t9-p|{n{P|y|;o9-|}npv\b6H--0r{qvs--<<-JJJJJJJJJJJ--<<-JJJ-楼层显示-JJJ--sy|n-sy||\\}npv\b-J->;=H--vs-5u|{Sy||V{qr\x07-K-:=;=>-33-no5sy||-:-u|{Sy||V{qr\x076-K-=;FF6-\n----sy||\\}npv\b-J-=;?-7-zv{55>;=-8-PnzrnQvrpv|{;\b69->;=6H--\f--tylSntP|y|;n-J-tylSntP|y|;n-7-sy||\\}npv\b-7-ovtu{rH--<<-JJJJJJJJJJJJJJ--0v{pyqr-I|{rzn}}v{tlsntzr{K--0v{pyqr-Ir{p|qv{tlsntzr{K--<<-JJJ-全景图-JJJ--rp@-}n{|=a|crr\x07-J-{|znyv r5d|yq]|vv|{;\x07\b -:-}n{|=lznv\x07h@j;\x07\b 6H--}n{|=a|crr\x07-J- ||zcrp|5PnzrnQvrpv|{9-}n{|=a|crr\x079-}n{|=l ||z6H--}n{|=a|crr\x07-J-}n{|=a|crr\x07-7-zn@5}n{|=lznv\x076H--rp@-}n{|>a|crr\x07-J-{|znyv r5d|yq]|vv|{;\x07\b -:-}n{|>lznv\x07h@j;\x07\b 6H--}n{|>a|crr\x07-J- ||zcrp|5PnzrnQvrpv|{9-}n{|>a|crr\x079-}n{|>l ||z6H--}n{|>a|crr\x07-J-}n{|>a|crr\x07-7-zn@5}n{|>lznv\x076H--rpA-}n{|P|y|H--rpA-}n{|=P|y|-J-r\x07rPor5}n{|=lzn}9-}n{|=a|crr\x076H--rpA-}n{|>P|y|-J-r\x07rPor5}n{|>lzn}9-}n{|>a|crr\x076H--0vs-qrsv{rq5b`RlYbZV[N[PR6----}n{|=P|y|;n-J->;=-:-r\x07rPor5}n{|=lyzv{n{prZn}9-}n{|=a|crr\x076;H----}n{|>P|y|;n-J->;=-:-r\x07rPor5}n{|>lyzv{n{prZn}9-}n{|>a|crr\x076;H--0r{qvs--0vs-qrsv{rq5b`RlOYNPXla_N[`VaV\\[6----sy|n-oynpx]|tr-J-np|5:?;=-7-}|tr-8->;=6H----}n{|P|y|-J-zv\x075}n{|=P|y|9-OYNPXlP\\Y\\_9-zv{5>;=9-oynpx]|tr66H----}n{|P|y|-J-zv\x075}n{|P|y|9-}n{|>P|y|9-zn\x075=;=9-oynpx]|tr-:-]V-8->;=66H--0ryvs-qrsv{rq5b`Rl`]_RNQla_N[`VaV\\[6----rp?-prr{Pr{rP||q-J-r|yv|{-7-}v\x07ry_nv|-<-?;=H----sy|n-n{vv|{_nqv-J-qvn{pr5rp?5=;=9-=;=69-prr{Pr{rP||q6-7->;?H----sy|n-n{vv|{]|tr-J-qvn{pr5tylSntP||q;\x07\b9-prr{Pr{rP||q6-<-n{vv|{_nqvH----}n{|P|y|-J-zv\x075}n{|=P|y|9-}n{|>P|y|9-z||ur}5=;=9-=;?9-}|tr-:-n{vv|{]|tr66H--0ryr----}n{|P|y|-J-zv\x075}n{|=P|y|9-}n{|>P|y|9-}|tr6H--0r{qvs--tylSntP|y|-J-zv\x075}n{|P|y|9-tylSntP|y|9-z|qryNy}un6H--<<-JJJJJJJJJJJJJJ--0v{pyqr-Is|tlsntzr{K--0v{pyqr-I}rzyv}yvrqlny}unlsntzr{K--0v{pyqr-Iqvurv{tlsntzr{K--0vs-qrsv{rq5b`RlRQY6----tylSntP|y|;n-J-Y|tQr}uH--0r{qvs\f");function coordinatesToVector(n,t){var e=Math.abs(Math.cos(n.latitude)),r=-Math.sin(n.longitude)*e,i=-Math.sin(n.latitude),o=-Math.cos(n.longitude)*e;return t?t.set(r,i,o):new THREE__namespace.Vector3(r,i,o)}var DEFAULT_ASPECT=1,DEFAULT_NEAR=.1,DEFAULT_FAR=2e3,TAU$2=Math.PI*2,PI_2=Math.PI/2;function formatRad$1(n){return n>0&&n<=TAU$2?n:(n%TAU$2+TAU$2)%TAU$2}function matrixLerp(n,t,e,r){e=Math.pow(e,4);for(var i=0;i<16;i++)r.elements[i]=n.elements[i]+(t.elements[i]-n.elements[i])*e;return r}var Camera=function(n){__extends(t,n);function t(e,r,i,o,s,u,c){r===void 0&&(r=DEFAULT_ASPECT),i===void 0&&(i=DEFAULT_NEAR),o===void 0&&(o=DEFAULT_FAR),s===void 0&&(s=new THREE__namespace.Vector2),u===void 0&&(u=new THREE__namespace.Vector2(512,512)),c===void 0&&(c=1);var l=n.call(this)||this;l.fov=e,l.aspect=r,l.near=i,l.far=o,l.perspToOrtho=s,l.resolution=u,l.pixelRatio=c,l.needsRender=!0,l.refineModel=!0,l.pose={longitude:0,latitude:0,fov:e,distance:0,offset:new THREE__namespace.Vector3},l.computePose(),l.perspectiveCamera=new THREE__namespace.PerspectiveCamera(l.fov,l.aspect,.001,l.far);var d=Math.max(l.orthoDistance,.01)*Math.tan(.5*l.fov/180*Math.PI),f=-.5*l.aspect*2*d;return l.orthographicCamera=new THREE__namespace.OrthographicCamera(f,-f,d,-d,.001,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,orthoDistance:l.orthoDistance,perspToOrtho:l.perspToOrtho.clone()},l.type=l.perspToOrtho.x<1?"PerspectiveCamera":"OrthographicCamera",l}return Object.defineProperty(t.prototype,"orthoDistance",{get:function(){return this.pose.distance>1?this.pose.distance:1+(this.pose.distance-1)*this.perspToOrtho.x},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"zoom",{get:function(){return this.type==="OrthographicCamera"?this.orthographicCamera.zoom:this.type==="PerspectiveCamera"?this.perspectiveCamera.zoom:1},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"top",{get:function(){return this.type==="OrthographicCamera"?this.orthographicCamera.top:0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"bottom",{get:function(){return this.type==="OrthographicCamera"?this.orthographicCamera.bottom:0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"left",{get:function(){return this.type==="OrthographicCamera"?this.orthographicCamera.left:0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"right",{get:function(){return this.type==="OrthographicCamera"?this.orthographicCamera.right:0},enumerable:!1,configurable:!0}),t.prototype.getDirection=function(e){return coordinatesToVector(this.pose,e)},t.prototype.computePose=function(e){e===void 0&&(e=0),this.updateMatrix();var r=this.matrix.elements;return this.pose.latitude=Math.asin(clamp$1(r[9],-1,1)),Math.abs(r[9])<.9999999?this.pose.longitude=formatRad$1(Math.atan2(r[8],r[10])):this.pose.longitude=formatRad$1(Math.atan2(-r[2],r[0])),this.pose.fov=this.fov,this.pose.distance=e,this.pose.offset=new THREE__namespace.Vector3(-r[8],-r[9],-r[10]).setLength(this.pose.distance).add(this.position),this},t.prototype.setFromPose=function(e){var r,i,o,s,u,c=formatRad$1((r=e.longitude)!==null&&r!==void 0?r:this.pose.longitude),l=Math.max(-PI_2+1e-4,Math.min(PI_2-1e-4,(i=e.latitude)!==null&&i!==void 0?i:this.pose.latitude)),d=(o=e.fov)!==null&&o!==void 0?o:this.pose.fov,f=(s=e.distance)!==null&&s!==void 0?s:this.pose.distance,v=(u=e.offset)!==null&&u!==void 0?u:this.pose.offset,A=coordinatesToVector({longitude:c,latitude:l}).normalize();return this.position.set(0,0,0),this.lookAt(A),this.position.add(v).sub(A.clone().setLength(f)),this.fov!==d&&(this.fov=d,this.updateProjectionMatrix()),this.updateMatrixWorld(),this.pose.longitude=c,this.pose.latitude=l,this.pose.fov=d,this.pose.distance=f,this.pose.offset.copy(v),this.needsRender=!0,this},t.prototype.copyPose=function(){return{longitude:this.pose.longitude,latitude:this.pose.latitude,fov:this.pose.fov,distance:this.pose.distance,offset:this.pose.offset.clone()}},t.prototype.computeProjectionMatrix=function(){matrixLerp(this.orthographicCamera.projectionMatrix,this.perspectiveCamera.projectionMatrix,1-this.perspToOrtho.x,this.projectionMatrix),this.projectionMatrixInverse.getInverse(this.projectionMatrix),this.needsRender=!0},t.prototype.setViewOffset=function(e,r,i,o,s,u){this.perspectiveCamera.setViewOffset(e,r,i,o,s,u),this.orthographicCamera.setViewOffset(e,r,i,o,s,u),this.computeProjectionMatrix()},t.prototype.clearViewOffset=function(){this.perspectiveCamera.clearViewOffset(),this.orthographicCamera.clearViewOffset(),this.computeProjectionMatrix()},t.prototype.updateProjectionMatrix=function(){this.perspectiveCamera.updateProjectionMatrix(),this.orthographicCamera.updateProjectionMatrix(),this.computeProjectionMatrix()},Object.defineProperty(t.prototype,"perspectiveProjectionMatrix",{get:function(){return this.perspectiveCamera.projectionMatrix},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"perspectiveProjectionMatrixInverse",{get:function(){return this.perspectiveCamera.projectionMatrixInverse},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"orthographicProjectionMatrix",{get:function(){return this.orthographicCamera.projectionMatrix},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"orthographicProjectionMatrixInverse",{get:function(){return this.orthographicCamera.projectionMatrixInverse},enumerable:!1,configurable:!0}),t.prototype.updateTime=function(e,r){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.perspToOrtho.equals(this.perspToOrtho)||this.lastValues.fov!==this.fov||this.lastValues.near!==this.near||this.lastValues.far!==this.far||this.lastValues.orthoDistance!==this.orthoDistance||this.lastValues.aspect!==this.aspect){var o=Math.max(this.orthoDistance,.01)*Math.tan(.5*this.fov/180*Math.PI),s=-.5*this.aspect*2*o;this.orthographicCamera.left=s,this.orthographicCamera.right=-s,this.orthographicCamera.top=o,this.orthographicCamera.bottom=-o,this.orthographicCamera.near=this.near,this.orthographicCamera.far=this.far,this.orthographicCamera.updateProjectionMatrix(),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.orthoDistance=this.orthoDistance,this.lastValues.perspToOrtho.copy(this.perspToOrtho),this.type=this.perspToOrtho.x<1?"PerspectiveCamera":"OrthographicCamera"},Object.defineProperty(t.prototype,"isPerspectiveCamera",{get:function(){return this.perspToOrtho.x<1},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isOrthographicCamera",{get:function(){return this.perspToOrtho.x>=1},enumerable:!1,configurable:!0}),t.prototype.copy=function(e,r){return n.prototype.copy.call(this,e,r),this.fov=e.fov,this.aspect=e.aspect,this.near=e.near,this.far=e.far,this.perspToOrtho.copy(e.perspToOrtho),this.updateTime(now(),0),this},t}(THREE__namespace.Camera),scratchVector4$1=new THREE__namespace.Vector4,pbmUniforms={modelAlpha:new THREE__namespace.Uniform(0),progress:new THREE__namespace.Uniform(0),pano0_map:new THREE__namespace.Uniform(null),pano0_luminanceMap:new THREE__namespace.Uniform(null),pano0_matrix:new THREE__namespace.Uniform(new THREE__namespace.Matrix4),pano0_zoom:new THREE__namespace.Uniform(1),pano1_map:new THREE__namespace.Uniform(null),pano1_luminanceMap:new THREE__namespace.Uniform(null),pano1_matrix:new THREE__namespace.Uniform(new THREE__namespace.Matrix4),pano1_zoom:new THREE__namespace.Uniform(1),clippers:new THREE__namespace.Uniform([]),shownFloorIndex:new THREE__namespace.Uniform(-1),constantColor:new THREE__namespace.Uniform(null),geometricError:new THREE__namespace.Uniform(0),pixelRatio:new THREE__namespace.Uniform(1),resolution:new THREE__namespace.Uniform(new THREE__namespace.Vector2(512,512)),floor:new THREE__namespace.Uniform(0),brightness:new THREE__namespace.Uniform(1),modelBoundingMin:new THREE__namespace.Uniform(new THREE__namespace.Vector3),modelBoundingMax:new THREE__namespace.Uniform(new THREE__namespace.Vector3)},shaderLib={none:{vertexShader:meshNoneVertexShader,fragmentShader:meshNoneFragmentShader,uniforms:THREE__namespace.UniformsUtils.merge([pbmUniforms,{opacity:{value:1}},THREE__namespace.UniformsLib.fog]),lights:!1},basic:{vertexShader:meshBasicVertexShader,fragmentShader:meshBasicFragmentShader,uniforms:THREE__namespace.UniformsUtils.merge([pbmUniforms,THREE__namespace.ShaderLib.basic.uniforms]),lights:!1},phong:{vertexShader:meshPhongVertexShader,fragmentShader:meshPhongFragmentShader,uniforms:THREE__namespace.UniformsUtils.merge([pbmUniforms,THREE__namespace.ShaderLib.phong.uniforms]),lights:!0}},PBMMeshMaterial=function(n){__extends(t,n);function t(e,r){e===void 0&&(e="basic"),r===void 0&&(r={});var i=this,o,s,u,c,l,d,f,v,A,h,p,y,m,g,E,b,T,_,S,R,B,I=shaderLib[e];i=n.call(this,{vertexShader:I.vertexShader,fragmentShader:I.fragmentShader,uniforms:THREE__namespace.UniformsUtils.clone(I.uniforms),lights:I.lights,defines:{USE_CONSTANT_COLOR:!1,USE_EDL:!1,USE_HQ_WEIGHT:!1,USE_HQ_DEPTH:!1,NUM_CLIPPING_BOX:!1,USE_CLIPFLOOR:!1,USE_VERTEX_MARK:!1,USE_LUMINANCE:!1,USE_PANO_OPACITY:!1,USE_BLACK_TRANSITION:!1,USE_SPREAD_TRANSITION:!1,USE_POINT_NORMAL:!1,USE_POINT_CIRCLE:!1,USE_POINT_ADAPTIVE_SIZE:!1,USE_POINT_COLOR_ALTITUDE:!1}})||this,i.shaderType=e,i.color=new THREE__namespace.Color(16777215),i.map=null,i.lightMap=null,i.lightMapIntensity=1,i.aoMap=null,i.aoMapIntensity=1,i.specularMap=null,i.specular=new THREE__namespace.Color(1118481),i.alphaMap=null,i.envMap=null,i.reflectivity=1,i.refractionRatio=.98,i.emissiveMap=null,i.emissive=new THREE__namespace.Color(0),i.emissiveIntensity=1,i.bumpMap=null,i.bumpScale=1,i.normalMap=null,i.normalMapType=THREE__namespace.TangentSpaceNormalMap,i.normalScale=new THREE__namespace.Vector2(1,1),i.displacementMap=null,i.displacementScale=1,i.displacementBias=0,i.shininess=30;var x,M=null,L=null;return Object.defineProperties(i,{pano0:{get:function(){return M},set:function(C){if(M!==C){M=C,C===null?(this.uniforms.pano0_map.value=null,this.uniforms.pano0_luminanceMap.value=null,this.uniforms.pano0_matrix.value.identity(),this.uniforms.pano0_zoom.value=1):(this.uniforms.pano0_map.value=C.map instanceof TileCubeTextureTarget?C.map.texture:C.map,this.uniforms.pano0_luminanceMap.value=C.luminanceMap instanceof TileCubeTextureTarget?C.luminanceMap.texture:C.luminanceMap,this.uniforms.pano0_matrix.value.copy(C.matrix),this.uniforms.pano0_zoom.value=C.zoom);var H=this.uniforms.pano0_luminanceMap.value!==null&&this.uniforms.pano1_luminanceMap.value!==null,F=this.defines.USE_LUMINANCE;F!==H&&(this.defines.USE_LUMINANCE=H,this.needsUpdate=!0)}}},pano1:{get:function(){return L},set:function(C){if(L!==C){L=C,C===null?(this.uniforms.pano1_map.value=null,this.uniforms.pano1_luminanceMap.value=null,this.uniforms.pano1_matrix.value.identity(),this.uniforms.pano1_zoom.value=1):(this.uniforms.pano1_map.value=C.map instanceof TileCubeTextureTarget?C.map.texture:C.map,this.uniforms.pano1_luminanceMap.value=C.luminanceMap instanceof TileCubeTextureTarget?C.luminanceMap.texture:C.luminanceMap,this.uniforms.pano1_matrix.value.copy(C.matrix),this.uniforms.pano1_zoom.value=C.zoom);var H=this.uniforms.pano0_luminanceMap.value!==null&&this.uniforms.pano1_luminanceMap.value!==null,F=this.defines.USE_LUMINANCE;F!==H&&(this.defines.USE_LUMINANCE=H,this.needsUpdate=!0)}}},modelAlpha:{get:function(){return this.uniforms.modelAlpha.value},set:function(C){this.uniforms.modelAlpha.value=C}},progress:{get:function(){return this.uniforms.progress.value},set:function(C){this.uniforms.progress.value=C}},transition:{get:function(){return this.defines.USE_BLACK_TRANSITION?"BLACK":this.defines.USE_SPREAD_TRANSITION?"SPREAD":"FADE"},set:function(C){var H=this.defines.USE_BLACK_TRANSITION,F=this.defines.USE_SPREAD_TRANSITION;this.defines.USE_BLACK_TRANSITION=!1,this.defines.USE_SPREAD_TRANSITION=!1,this.defines["USE_".concat(C,"_TRANSITION")]=!0;var O=!1;H!==this.defines.USE_BLACK_TRANSITION&&(O=!0),F!==this.defines.USE_SPREAD_TRANSITION&&(O=!0),O&&(this.needsUpdate=!0)}},constantColor:{get:function(){return this.uniforms.constantColor.value},set:function(C){this.uniforms.constantColor.value=C;var H=this.defines.USE_CONSTANT_COLOR,F=C!==null;H!==F&&(this.defines.USE_CONSTANT_COLOR=F,this.needsUpdate=!0)}},opacity:{get:function(){return this.uniforms.opacity.value},set:function(C){this.uniforms.opacity.value=C}},shownFloorIndex:{get:function(){return this.uniforms.shownFloorIndex.value},set:function(C){this.uniforms.shownFloorIndex.value=C}},brightness:{get:function(){return this.uniforms.brightness.value},set:function(C){this.uniforms.brightness.value=C}},clippers:{get:function(){return x},set:function(C){x!==C&&(x=C,this.uniforms.clippers.value=(x||[]).map(function(H){var F=typeof H.floorIndex=="number"?H.floorIndex:-1,O=new THREE__namespace.Matrix4().getInverse(H.clippingBoxMatrix);return{matrixInverse:O,floorIndex:F}}),this.needsUpdate=!0)}},useEDL:{get:function(){return this.defines.USE_EDL},set:function(C){C!==this.defines.USE_EDL&&(this.defines.USE_EDL=C,this.needsUpdate=!0)}},useHQWeight:{get:function(){return this.defines.USE_HQ_WEIGHT},set:function(C){C!==this.defines.USE_HQ_WEIGHT&&(this.defines.USE_HQ_WEIGHT=C,this.needsUpdate=!0)}},useHQDepth:{get:function(){return this.defines.USE_HQ_DEPTH},set:function(C){C!==this.defines.USE_HQ_DEPTH&&(this.defines.USE_HQ_DEPTH=C,this.needsUpdate=!0)}},floor:{get:function(){return this.uniforms.floor.value},set:function(C){this.uniforms.floor.value=C}}}),i.pano0=(o=r.pano0)!==null&&o!==void 0?o:defaultPbmParameters.pano0,i.pano1=(s=r.pano1)!==null&&s!==void 0?s:defaultPbmParameters.pano1,i.modelAlpha=(u=r.modelAlpha)!==null&&u!==void 0?u:defaultPbmParameters.modelAlpha,i.progress=(c=r.progress)!==null&&c!==void 0?c:defaultPbmParameters.progress,i.transition=(l=r.transition)!==null&&l!==void 0?l:defaultPbmParameters.transition,i.constantColor=(d=r.constantColor)!==null&&d!==void 0?d:defaultPbmParameters.constantColor,i.opacity=(f=r.opacity)!==null&&f!==void 0?f:defaultPbmParameters.opacity,i.shownFloorIndex=(v=r.shownFloorIndex)!==null&&v!==void 0?v:defaultPbmParameters.shownFloorIndex,i.clippers=(A=r.clippers)!==null&&A!==void 0?A:defaultPbmParameters.clippers,i.useEDL=(h=r.useEDL)!==null&&h!==void 0?h:defaultPbmParameters.useEDL,i.useHQWeight=(p=r.useHQWeight)!==null&&p!==void 0?p:defaultPbmParameters.useHQWeight,i.useHQDepth=(y=r.useHQDepth)!==null&&y!==void 0?y:defaultPbmParameters.useHQDepth,i.pointSize=(m=r.pointSize)!==null&&m!==void 0?m:defaultPbmParameters.pointSize,i.pointColor=(g=r.pointColor)!==null&&g!==void 0?g:defaultPbmParameters.pointColor,i.pointShape=(E=r.pointShape)!==null&&E!==void 0?E:defaultPbmParameters.pointShape,i.pointScale=(b=r.pointScale)!==null&&b!==void 0?b:defaultPbmParameters.pointScale,i.pointBack=(T=r.pointBack)!==null&&T!==void 0?T:defaultPbmParameters.pointBack,i.pointMinPixel=(_=r.pointMinPixel)!==null&&_!==void 0?_:defaultPbmParameters.pointMinPixel,i.pointMaxPixel=(S=r.pointMaxPixel)!==null&&S!==void 0?S:defaultPbmParameters.pointMaxPixel,i.gradientTexture=(R=r.gradientTexture)!==null&&R!==void 0?R:defaultPbmParameters.gradientTexture,i.brightness=(B=r.brightness)!==null&&B!==void 0?B:defaultPbmParameters.brightness,i.floor=0,i.transparent=!0,i}return t.prototype.onBeforeCompile=function(e,r){var i,o,s=String((o=(i=this.clippers)===null||i===void 0?void 0:i.length)!==null&&o!==void 0?o:0);e.vertexShader=e.vertexShader.replace(/NUM_CLIPPERS/g,s),e.fragmentShader=e.fragmentShader.replace(/NUM_CLIPPERS/g,s)},t.prototype.refreshUniforms=function(e){var r,i,o=this.uniforms;o.diffuse&&o.diffuse.value.copy(this.color),o.opacity&&(o.opacity.value=this.opacity),o.color&&o.diffuse.value.copy(this.color),o.emissive&&o.emissive.value.copy(this.emissive).multiplyScalar(this.emissiveIntensity),o.map&&(o.map.value=this.map),o.alphaMap&&(o.alphaMap.value=this.alphaMap),o.specularMap&&(o.specularMap.value=this.specularMap),o.envMap&&(o.envMap.value=this.envMap,o.flipEnvMap.value=!((r=this.envMap)===null||r===void 0)&&r.isCubeTexture?-1:1,o.reflectivity.value=this.reflectivity,o.refractionRatio.value=this.refractionRatio,o.maxMipLevel.value=this.envMap&&(i=e.properties.get(this.envMap).__maxMipLevel)!==null&&i!==void 0?i:0),o.lightMap&&(o.lightMap.value=this.lightMap,o.lightMapIntensity.value=this.lightMapIntensity),o.aoMap&&(o.aoMap.value=this.aoMap,o.aoMapIntensity.value=this.aoMapIntensity),o.specular&&o.specular.value.copy(this.specular),o.shininess&&(o.shininess.value=Math.max(this.shininess,1e-4)),o.emissiveMap&&(o.emissiveMap.value=this.emissiveMap),o.bumpMap&&(o.bumpMap.value=this.bumpMap,o.bumpScale.value=this.bumpScale,this.side===THREE__namespace.BackSide&&(o.bumpScale.value*=-1)),o.normalMap&&(o.normalMap.value=this.normalMap,o.normalScale.value.copy(this.normalScale),this.side===THREE__namespace.BackSide&&o.normalScale.value.negate()),o.displacementMap&&(o.displacementMap.value=this.displacementMap,o.displacementScale.value=this.displacementScale,o.displacementBias.value=this.displacementBias);var s;this.map?s=this.map:this.specularMap?s=this.specularMap:this.displacementMap?s=this.displacementMap:this.normalMap?s=this.normalMap:this.bumpMap?s=this.bumpMap:this.alphaMap?s=this.alphaMap:this.emissiveMap&&(s=this.emissiveMap),s!==void 0&&(s.matrixAutoUpdate===!0&&s.updateMatrix(),o.uvTransform.value.copy(s.matrix));var u;this.aoMap?u=this.aoMap:this.lightMap&&(u=this.lightMap),u!==void 0&&(u.matrixAutoUpdate===!0&&u.updateMatrix(),o.uv2Transform.value.copy(u.matrix))},t.prototype.update=function(e,r){if(this.refreshUniforms(e),this.transparent=!1,this.shownFloorIndex>-1&&(this.transparent=this.shownFloorIndex!==this.floor),this.opacity<1&&(this.transparent=!0),this.alphaMap&&(this.transparent=!0),this.brightness<1&&(this.transparent=!0),this.depthTest=!0,this.depthWrite=!0,this.shaderType==="none"?this.depthWrite=!1:this.transparent&&(this.depthWrite=!1),r instanceof Camera)this.uniforms.pixelRatio.value=r.pixelRatio,this.uniforms.resolution.value.copy(r.resolution);else{this.uniforms.pixelRatio.value=e.getPixelRatio();var i=e.getViewport(scratchVector4$1);this.uniforms.resolution.value.set(i.z,i.w)}},t.prototype.syncModel=function(e){var r="".concat(e.id,":").concat(e.materialVersion);r!==this.syncModelVersion&&(Object.assign(this,e.getMaterial()),this.uniforms.modelBoundingMax.value.copy(e.bounding.max),this.uniforms.modelBoundingMin.value.copy(e.bounding.min),this.syncModelVersion=r)},t.prototype.copy=function(e){return n.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.specular.copy(e.specular),this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.emissiveMap=e.emissiveMap,this.emissive.copy(e.emissive),this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.shininess=e.shininess,this.pano0=e.pano0,this.pano1=e.pano1,this.modelAlpha=e.modelAlpha,this.progress=e.progress,this.transition=e.transition,this.opacity=e.opacity,this.constantColor=e.constantColor,this.shownFloorIndex=e.shownFloorIndex,this.brightness=e.brightness,this.clippers=e.clippers,this.useEDL=e.useEDL,this.useHQWeight=e.useHQWeight,this.useHQDepth=e.useHQDepth,this.pointColor=e.pointColor,this.pointSize=e.pointSize,this.pointShape=e.pointShape,this.pointScale=e.pointScale,this.pointBack=e.pointBack,this.pointMinPixel=e.pointMinPixel,this.pointMaxPixel=e.pointMaxPixel,this.gradientTexture=e.gradientTexture,this.floor=e.floor,this},t}(THREE__namespace.ShaderMaterial),InternalWebGLRenderer=function(n){__extends(t,n);function t(e){var r=e.preserveDrawingBuffer,i=r===void 0?!0:r,o=e.premultipliedAlpha,s=o===void 0?!0:o,u=e.stencil,c=u===void 0?!0:u,l=e.backgroundColor,d=l===void 0?1579548:l,f=e.backgroundAlpha,v=f===void 0?1:f,A=e.pixelRatio,h=A===void 0?1:A,p=e.antialias,y=e.webgl2,m=e.logarithmicDepthBuffer,g=e.precision,E=this,b={antialias:p,alpha:!0,depth:!0,preserveDrawingBuffer:i,stencil:c,premultipliedAlpha:s,powerPreference:"high-performance"},T={logarithmicDepthBuffer:m,precision:g};if(y){var _=document.createElement("canvas"),S=_.getContext("webgl2",b);S?E=n.call(this,__assign(__assign(__assign({},b),T),{antialias:!0,canvas:_,context:S}))||this:(console.error("error occurred when getting webgl2 canvas context, mybe webgl2 not support, fallback to webgl."),E=n.call(this,__assign(__assign({},b),T))||this)}else E=n.call(this,__assign(__assign({},b),T))||this;return E.setPixelRatio(h),E.setClearColor(d,v),E.outputEncoding=THREE__namespace.sRGBEncoding,E.autoClear=!0,E}return t}(THREE__namespace.WebGLRenderer),Scene=function(n){__extends(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t.prototype.add=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return n.prototype.add.apply(this,e)},t.prototype.remove=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return n.prototype.remove.apply(this,e)},t}(THREE__namespace.Scene),VolumePlaneIntersect;(function(n){n[n.Outside=-1]="Outside",n[n.Intersecting=0]="Intersecting",n[n.Inside=1]="Inside"})(VolumePlaneIntersect||(VolumePlaneIntersect={}));var EPSILON$2=1e-6,scratchVector=new THREE__namespace.Vector3,scratchMatrix4$4=new THREE__namespace.Matrix4,scratchXAxis=new THREE__namespace.Vector3,scratchYAxis=new THREE__namespace.Vector3,scratchZAxis=new THREE__namespace.Vector3,scratchSize=new THREE__namespace.Vector3,scratchBox3=new THREE__namespace.Box3,scratchSphere$1=new THREE__namespace.Sphere,scratchMatrix4Inverse$1=new THREE__namespace.Matrix4,scratchRay$1=new THREE__namespace.Ray,scratchObject3D=new THREE__namespace.Object3D,scratchFrustum=new THREE__namespace.Frustum;function quaternionFromMatrix3(n,t){var e=n.elements;return t.setFromRotationMatrix(scratchMatrix4$4.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1)),t}var CullingVolume=function(){function n(t){t===void 0&&(t=[]),this.planes=t}return Object.defineProperty(n,"MASK_OUTSIDE",{get:function(){return 4294967295},enumerable:!1,configurable:!0}),Object.defineProperty(n,"MASK_INSIDE",{get:function(){return 0},enumerable:!1,configurable:!0}),Object.defineProperty(n,"MASK_INDETERMINATE",{get:function(){return 2147483647},enumerable:!1,configurable:!0}),n.prototype.setFromFrustum=function(t){return this.planes=t.planes.map(function(e){return e.clone()}),this},n.prototype.setFromCamera=function(t){return scratchMatrix4$4.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),scratchFrustum.setFromProjectionMatrix(scratchMatrix4$4),this.setFromFrustum(scratchFrustum),this},n.prototype.applyMatrix4=function(t){for(var e=0,r=this.planes;e<r.length;e++){var i=r[e];i.applyMatrix4(t)}},n.prototype.copy=function(t){return this.planes=t.planes.map(function(e){return e.clone()}),this},n.prototype.clone=function(){return new n().copy(this)},n.prototype.computeVisibility=function(t){for(var e=VolumePlaneIntersect.Inside,r=0,i=this.planes;r<i.length;r++){var o=i[r],s=t.intersectPlane(o);switch(s){case VolumePlaneIntersect.Outside:return VolumePlaneIntersect.Outside;case VolumePlaneIntersect.Intersecting:e=VolumePlaneIntersect.Intersecting;break}}return e},n.prototype.computeVisibilityWithPlaneMask=function(t,e){if(e===n.MASK_OUTSIDE||e===n.MASK_INSIDE)return e;for(var r=n.MASK_INSIDE,i=Math.min(32,this.planes.length),o=0;o<i;++o){var s=1<<o;if(e&s){var u=this.planes[o],c=t.intersectPlane(u);if(c===VolumePlaneIntersect.Outside)return n.MASK_OUTSIDE;c===VolumePlaneIntersect.Intersecting&&(r|=s)}}return r},n}(),BoxBoundingVolume=function(){function n(){this.type="box",this.center=new THREE__namespace.Vector3,this.halfSize=new THREE__namespace.Vector3,this.rotation=new THREE__namespace.Matrix3}return n.prototype.fromJson=function(t){var e=t.box;this.center.set(e[0],e[1],e[2]);var r=e[3],i=e[4],o=e[5],s=e[6],u=e[7],c=e[8],l=e[9],d=e[10],f=e[11],v=Math.sqrt(r*r+i*i+o*o),A=Math.sqrt(s*s+u*u+c*c),h=Math.sqrt(l*l+d*d+f*f);this.halfSize.set(v,A,h);var p=this.halfSize.toArray().reduce(function(y,m){return y+m},0);return(isNaN(p)||p<=0)&&this.halfSize.setScalar(EPSILON$2),this.rotation.fromArray([r/v,i/v,o/v,s/A,u/A,c/A,l/h,d/h,f/h]),isNaN(this.rotation.toArray().reduce(function(y,m){return y+m},0))&&this.rotation.identity(),this},n.prototype.toJson=function(){return this.rotation.extractBasis(scratchXAxis,scratchYAxis,scratchZAxis),{box:__spreadArray(__spreadArray(__spreadArray(__spreadArray([],this.center.toArray(),!0),scratchXAxis.multiplyScalar(this.halfSize.x).toArray(),!0),scratchYAxis.multiplyScalar(this.halfSize.y).toArray(),!0),scratchZAxis.multiplyScalar(this.halfSize.z).toArray(),!0)}},n.prototype.copy=function(t){return this.center.copy(t.center),this.halfSize.copy(t.halfSize),this.rotation.copy(t.rotation),this},n.prototype.clone=function(){return new n().copy(this)},n.prototype.applyMatrix4=function(t){return scratchObject3D.position.copy(this.center),quaternionFromMatrix3(this.rotation,scratchObject3D.quaternion),scratchObject3D.scale.copy(this.halfSize),scratchObject3D.matrix.compose(scratchObject3D.position,scratchObject3D.quaternion,scratchObject3D.scale),scratchObject3D.matrix.premultiply(t),scratchObject3D.matrix.decompose(scratchObject3D.position,scratchObject3D.quaternion,scratchObject3D.scale),this.center.copy(scratchObject3D.position),this.rotation.setFromMatrix4(scratchMatrix4$4.makeRotationFromQuaternion(scratchObject3D.quaternion)),this.halfSize.copy(scratchObject3D.scale),this},n.prototype.getCenter=function(t){return t.copy(this.center)},n.prototype.distanceSquaredToPoint=function(t){var e=this.rotation.elements,r=t.x-this.center.x,i=t.y-this.center.y,o=t.z-this.center.z,s=0,u;return u=r*e[0]+i*e[1]+o*e[2],u<0&&(u=-u),u-=this.halfSize.x,u>0&&(s+=u*u),u=r*e[3]+i*e[4]+o*e[5],u<0&&(u=-u),u-=this.halfSize.y,u>0&&(s+=u*u),u=r*e[6]+i*e[7]+o*e[8],u<0&&(u=-u),u-=this.halfSize.z,u>0&&(s+=u*u),s},n.prototype.distanceToPoint=function(t){return Math.sqrt(this.distanceSquaredToPoint(t))},n.prototype.distanceToPlane=function(t){var e=t.projectPoint(this.center,new THREE__namespace.Vector3);return this.distanceToPoint(e)},n.prototype.getBoundingBox=function(t){return t.makeEmpty(),this.rotation.extractBasis(scratchXAxis,scratchYAxis,scratchZAxis),scratchXAxis.setLength(this.halfSize.x),scratchYAxis.setLength(this.halfSize.y),scratchZAxis.setLength(this.halfSize.z),t.expandByPoint(scratchVector.copy(this.center).add(scratchXAxis)),t.expandByPoint(scratchVector.copy(this.center).sub(scratchXAxis)),t.expandByPoint(scratchVector.copy(this.center).add(scratchYAxis)),t.expandByPoint(scratchVector.copy(this.center).sub(scratchYAxis)),t.expandByPoint(scratchVector.copy(this.center).add(scratchZAxis)),t.expandByPoint(scratchVector.copy(this.center).sub(scratchZAxis)),t},n.prototype.toGeometry=function(){var t=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),e=new Float32Array(8*3);scratchVector.set(this.halfSize.x,this.halfSize.y,this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,0),scratchVector.set(-this.halfSize.x,this.halfSize.y,this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,3),scratchVector.set(-this.halfSize.x,-this.halfSize.y,this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,6),scratchVector.set(this.halfSize.x,-this.halfSize.y,this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,9),scratchVector.set(this.halfSize.x,this.halfSize.y,-this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,12),scratchVector.set(-this.halfSize.x,this.halfSize.y,-this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,15),scratchVector.set(-this.halfSize.x,-this.halfSize.y,-this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,18),scratchVector.set(this.halfSize.x,-this.halfSize.y,-this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,21);var r=new THREE__namespace.BufferGeometry;return r.setIndex(new THREE__namespace.BufferAttribute(t,1)),r.setAttribute("position",new THREE__namespace.BufferAttribute(e,3)),r.computeBoundingBox(),r.computeBoundingSphere(),r},n.prototype.intersectPlane=function(t){var e=this.center,r=t.normal,i=this.rotation.elements,o=this.halfSize,s=r.x,u=r.y,c=r.z,l=Math.abs(s*i[0]*o.x+u*i[1]*o.x+c*i[2]*o.x)+Math.abs(s*i[3]*o.y+u*i[4]*o.y+c*i[5]*o.y)+Math.abs(s*i[6]*o.z+u*i[7]*o.z+c*i[8]*o.z),d=r.dot(e)+t.constant;return d<=-l?VolumePlaneIntersect.Outside:d>=l?VolumePlaneIntersect.Inside:VolumePlaneIntersect.Intersecting},n.prototype.intersectRay=function(t,e){if(scratchSize.copy(this.halfSize).multiplyScalar(2),scratchBox3.setFromCenterAndSize(scratchVector.set(0,0,0),scratchSize),this.rotation.extractBasis(scratchXAxis,scratchYAxis,scratchZAxis),scratchMatrix4$4.makeBasis(scratchXAxis,scratchYAxis,scratchZAxis),scratchMatrix4$4.setPosition(this.center),scratchMatrix4Inverse$1.getInverse(scratchMatrix4$4),scratchRay$1.copy(t).applyMatrix4(scratchMatrix4Inverse$1),scratchBox3.containsPoint(scratchRay$1.origin))return!0;var r=scratchRay$1.intersectBox(scratchBox3,scratchVector);return r?e!==void 0?r.applyMatrix4(scratchMatrix4$4).distanceTo(t.origin)<e:!0:!1},n}(),SphereBoundingVolume=function(){function n(){this.type="sphere",this.center=new THREE__namespace.Vector3,this.radius=-1}return n.prototype.fromJson=function(t){var e=t.sphere;return this.center.set(e[0],e[1],e[2]),this.radius=Math.max(e[3],EPSILON$2),this},n.prototype.toJson=function(){return{sphere:__spreadArray(__spreadArray([],this.center.toArray(),!0),[this.radius],!1)}},n.prototype.copy=function(t){return this.center.copy(t.center),this.radius=t.radius,this},n.prototype.clone=function(){return new n().copy(this)},n.prototype.getBoundingBox=function(t){return t.setFromCenterAndSize(this.center,scratchSize.set(1,1,1).multiplyScalar(this.radius*2)),t},n.prototype.toGeometry=function(){for(var t=32,e=new Float32Array(t*3*2*2),r=0;r<=t;r++){var i=0;i=r/t*Math.PI*2,e[r*6+0]=this.center.x+Math.cos(i)*this.radius,e[r*6+1]=this.center.y+Math.sin(i)*this.radius,e[r*6+2]=this.center.z+0,i=(r+1)/t*Math.PI*2,e[r*6+3]=this.center.x+Math.cos(i)*this.radius,e[r*6+4]=this.center.y+Math.sin(i)*this.radius,e[r*6+5]=this.center.z+0}for(var r=t;r<=t*2;r++){var i=0;i=r/t*Math.PI*2,e[r*6+0]=this.center.x+Math.cos(i)*this.radius,e[r*6+1]=this.center.y+0,e[r*6+2]=this.center.z+Math.sin(i)*this.radius,i=(r+1)/t*Math.PI*2,e[r*6+3]=this.center.x+Math.cos(i)*this.radius,e[r*6+4]=this.center.y+0,e[r*6+5]=this.center.z+Math.sin(i)*this.radius}var o=new THREE__namespace.BufferGeometry;return o.setAttribute("position",new THREE__namespace.BufferAttribute(e,3)),o.computeBoundingBox(),o.computeBoundingSphere(),o},n.prototype.applyMatrix4=function(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this},n.prototype.getCenter=function(t){return t.copy(this.center)},n.prototype.distanceSquaredToPoint=function(t){var e=this.distanceToPoint(t);return e*e},n.prototype.distanceToPoint=function(t){var e=this.center.distanceTo(t)-this.radius;return e<=0?0:e},n.prototype.distanceToPlane=function(t){var e=Math.abs(t.distanceToPoint(this.center));return Math.max(0,e-this.radius)},n.prototype.intersectPlane=function(t){var e=this.center,r=this.radius,i=t.normal,o=i.dot(e)+t.constant;return o<-r?VolumePlaneIntersect.Outside:o<r?VolumePlaneIntersect.Intersecting:VolumePlaneIntersect.Inside},n.prototype.intersectRay=function(t,e){if(scratchSphere$1.set(this.center,this.radius),scratchSphere$1.containsPoint(t.origin))return!0;var r=t.intersectSphere(scratchSphere$1,scratchVector);return r?e!==void 0?t.origin.distanceTo(r)<e:!0:!1},n}(),RegionBoundingVolume=function(){function n(){throw this.type="regin",this.west=0,this.south=0,this.east=0,this.north=0,this.minHeight=0,this.maxHeight=0,new Error("Region bounding volume not supported.")}return n.prototype.fromJson=function(t){var e=t.region;return this.west=e[0],this.south=e[1],this.east=e[2],this.north=e[3],this.minHeight=e[4],this.maxHeight=e[5],this},n.prototype.toJson=function(){return{region:[this.west,this.south,this.east,this.north,this.minHeight,this.maxHeight]}},n.prototype.copy=function(t){return this.west=t.west,this.south=t.south,this.east=t.east,this.north=t.north,this.minHeight=t.minHeight,this.maxHeight=t.maxHeight,this},n.prototype.clone=function(){return new n().copy(this)},n.prototype.getBoundingBox=function(t){throw new Error("not implemented")},n.prototype.toGeometry=function(){throw new Error("not implemented")},n.prototype.applyMatrix4=function(t){throw new Error("not implemented")},n.prototype.getCenter=function(t){throw new Error("not implemented")},n.prototype.distanceToPoint=function(t){throw new Error("not implemented")},n.prototype.distanceSquaredToPoint=function(t){throw new Error("not implemented")},n.prototype.distanceToPlane=function(t){throw new Error("not implemented")},n.prototype.intersectPlane=function(t){throw new Error("not implemented")},n.prototype.intersectRay=function(t){throw new Error("not implemented")},n}();function makeBoundingVolume(n){if("box"in n)return new BoxBoundingVolume().fromJson(n);if("sphere"in n)return new SphereBoundingVolume().fromJson(n);if("region"in n)return new RegionBoundingVolume().fromJson(n);throw new Error("BoundingVolume ".concat(JSON.stringify(n)," never suppored."))}var debugMaterials=[4821759,8191922,16637280,16739958,5822969,376977,16747077,9259235,14514687].map(function(n){return new THREE__namespace.LineBasicMaterial({color:n,depthWrite:!1,depthTest:!1,transparent:!0})}),debugBoxGeometry=function(){var n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),t=new Float32Array(8*3);scratchVector.set(1,1,1).toArray(t,0),scratchVector.set(-1,1,1).toArray(t,3),scratchVector.set(-1,-1,1).toArray(t,6),scratchVector.set(1,-1,1).toArray(t,9),scratchVector.set(1,1,-1).toArray(t,12),scratchVector.set(-1,1,-1).toArray(t,15),scratchVector.set(-1,-1,-1).toArray(t,18),scratchVector.set(1,-1,-1).toArray(t,21);var e=new THREE__namespace.BufferGeometry;return e.setIndex(new THREE__namespace.BufferAttribute(n,1)),e.setAttribute("position",new THREE__namespace.BufferAttribute(t,3)),e.computeBoundingBox(),e.computeBoundingSphere(),e}(),debugSphereGeometry=function(){for(var n=32,t=new Float32Array(n*3*2*2),e=0;e<=n;e++){var r=0;r=e/n*Math.PI*2,t[e*6+0]=Math.cos(r),t[e*6+1]=Math.sin(r),t[e*6+2]=0,r=(e+1)/n*Math.PI*2,t[e*6+3]=Math.cos(r),t[e*6+4]=Math.sin(r),t[e*6+5]=0}for(var e=n;e<=n*2;e++){var r=0;r=e/n*Math.PI*2,t[e*6+0]=Math.cos(r),t[e*6+1]=0,t[e*6+2]=Math.sin(r),r=(e+1)/n*Math.PI*2,t[e*6+3]=Math.cos(r),t[e*6+4]=0,t[e*6+5]=Math.sin(r)}var i=new THREE__namespace.BufferGeometry;return i.setAttribute("position",new THREE__namespace.BufferAttribute(t,3)),i.computeBoundingBox(),i.computeBoundingSphere(),i}();function createDebugBoundingMesh(n,t){if(n instanceof BoxBoundingVolume){var e=new THREE__namespace.LineSegments(debugBoxGeometry,debugMaterials[Math.min(t,debugMaterials.length-1)]);return e.position.copy(n.center),quaternionFromMatrix3(n.rotation,e.quaternion),e.scale.set(n.halfSize.x,n.halfSize.y,n.halfSize.z),e.matrix.compose(e.position,e.quaternion,e.scale),e}else if(n instanceof SphereBoundingVolume){var e=new THREE__namespace.LineSegments(debugSphereGeometry,debugMaterials[Math.min(t,debugMaterials.length-1)]);return e.position.copy(n.center),e.scale.set(n.radius,n.radius,n.radius),e.matrix.compose(e.position,e.quaternion,e.scale),e}throw new Error("never")}var scratchVector3$4=new THREE__namespace.Vector3,Tile=function(){function n(t,e,r,i){var o=this,s,u,c,l;this.parent=null,this.floor=0,this.id=t,this.state={visible:!1,frameNumber:0,selectedFrameNumber:0,requestedFrameNumber:0,touchedFrameNumber:0,distanceToCamera:0,centerZDepth:0,screenSpaceError:0,visibilityPlaneMask:0,inRequestVolume:!1,shouldRefine:!1,stackLength:0,finalResolution:!0,selectionDepth:0,shouldSelect:!1,lastSelect:!1,ancestorWithContent:null,ancestorWithContentAvailable:null},this.parent=i!=null?i:null,this.level=this.parent?this.parent.level+1:0,this.tileset=r,this.refine=(s=e.refine)!==null&&s!==void 0?s:this.parent?this.parent.refine:"REPLACE",this.transform=new THREE__namespace.Matrix4,e.transform&&this.transform.fromArray(e.transform),this.parent&&this.transform.premultiply(this.parent.transform),typeof e.geometricError=="number"?this.geometricError=e.geometricError*this.transform.getMaxScaleOnAxis():this.geometricError=(c=(u=this.parent)===null||u===void 0?void 0:u.geometricError)!==null&&c!==void 0?c:0,e.content&&e.content.uri?(this.content={uri:e.content.uri,loadState:"UNLOADED",byteLength:0},e.content.group!==void 0&&(this.content.group=e.content.group),e.content.boundingVolume&&(this.content.boundingVolume=makeBoundingVolume(e.content.boundingVolume).applyMatrix4(this.transform)),/\.json$/.test(this.content.uri)?this.type="TILESET":this.type="SCENEGRAPH"):(this.content=null,this.type="EMPTY"),this.levelOfContent=this.parent?this.parent.levelOfContent:-1,this.type==="SCENEGRAPH"&&(this.levelOfContent=this.levelOfContent+1),e.boundingVolume&&(this.boundingVolume=makeBoundingVolume(e.boundingVolume).applyMatrix4(this.transform)),e.viewerRequestVolume&&(this.viewerRequestVolume=makeBoundingVolume(e.viewerRequestVolume).applyMatrix4(this.transform)),this.extras=(l=e.extras)!==null&&l!==void 0?l:{},typeof this.extras.floor!="number"&&i&&typeof i.extras.floor=="number"&&(this.extras.floor=i.extras.floor),typeof this.extras.floor=="number"&&(this.floor=this.extras.floor),this.boundingVolume&&(this.boundingVolumeDebugObject=createDebugBoundingMesh(this.boundingVolume,this.levelOfContent)),e.children?this.children=e.children.map(function(d,f){return new n("".concat(o.id,".").concat(f),d,r,o)}):this.children=[]}return n.prototype.traverse=function(t){t(this);for(var e=0,r=this.children;e<r.length;e++){var i=r[e];i.traverse(t)}},n.prototype.updateState=function(t){this.state.frameNumber=t.frameNumber;var e=this.tileset.transformIsIdentity?null:this.tileset.transform;if(this.boundingVolume){var r=e?this.boundingVolume.clone().applyMatrix4(e):this.boundingVolume;if(t.camera.type==="OrthographicCamera"){var i=new THREE__namespace.Plane().setFromNormalAndCoplanarPoint(t.camera.direction,t.camera.position);this.state.distanceToCamera=r.distanceToPlane(i)}else this.state.distanceToCamera=r.distanceToPoint(t.camera.position);var o=r.getCenter(scratchVector3$4).sub(t.camera.position);this.state.centerZDepth=t.camera.direction.dot(o);var s=this.parent?this.parent.state.visibilityPlaneMask:CullingVolume.MASK_INDETERMINATE;this.state.visibilityPlaneMask=t.cullingVolume.computeVisibilityWithPlaneMask(r,s),this.state.visible=this.state.visibilityPlaneMask!==CullingVolume.MASK_OUTSIDE}else this.state.distanceToCamera=0,this.state.centerZDepth=0,this.state.visibilityPlaneMask=CullingVolume.MASK_INDETERMINATE,this.state.visible=!0;if(this.state.distanceToCamera<t.camera.near&&(this.state.distanceToCamera=t.camera.near),this.levelOfContent<=0&&(this.state.visible=!0),this.viewerRequestVolume){var u=e?this.viewerRequestVolume.clone().applyMatrix4(e):this.viewerRequestVolume;this.state.inRequestVolume=u.distanceSquaredToPoint(t.camera.position)<=0}else this.state.inRequestVolume=!0;this.state.screenSpaceError=this.getScreenSpaceError(t,this.state.distanceToCamera,!1)},Object.defineProperty(n.prototype,"selected",{get:function(){return this.state.selectedFrameNumber===this.tileset.frameNumber},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"hasChildren",{get:function(){return this.children.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"siblingIndex",{get:function(){var t,e;return(e=(t=this.parent)===null||t===void 0?void 0:t.children.indexOf(this))!==null&&e!==void 0?e:0},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"hasTilesetContent",{get:function(){return this.children.length>0&&this.type==="TILESET"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"hasRenderContent",{get:function(){return this.type==="SCENEGRAPH"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"contentAvailable",{get:function(){var t;return this.hasRenderContent&&((t=this.content)===null||t===void 0?void 0:t.loadState)==="READY"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"hasUnloadedContent",{get:function(){var t;return((t=this.content)===null||t===void 0?void 0:t.loadState)==="UNLOADED"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"hasEmptyContent",{get:function(){return this.type==="EMPTY"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"contentReady",{get:function(){var t;return((t=this.content)===null||t===void 0?void 0:t.loadState)==="READY"||this.hasEmptyContent},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"contentByteLength",{get:function(){return this.content?this.content.byteLength:0},enumerable:!1,configurable:!0}),n.prototype.loadContent=function(){var t=this,e;if(this.hasEmptyContent||!(!((e=this.content)===null||e===void 0)&&e.uri))return Promise.resolve(!1);var r=this.content;return r.data?Promise.resolve(!0):(r.loadState="LOADING",this.tileset.requestScheduler.scheduleRequest(this.id,function(){return t.getPriority()}).then(function(i){return i?t.tileset.options.contentLoader(t).then(function(o){return i.done(),r.loadState=o?"READY":"UNLOADED",o}).catch(function(o){return r.loadState="FAILED",i.done(),Promise.reject(o)}):(r.loadState="UNLOADED",Promise.resolve(!1))}))},n.prototype.unloadContent=function(){return this.content&&(this.content.loadState="UNLOADED",this.content.byteLength=0),!0},n.prototype.getScreenSpaceError=function(t,e,r){var i=this.tileset.transformIsIdentity?1:this.tileset.transform.getMaxScaleOnAxis(),o=this.parent?this.parent.geometricError:this.tileset.geometricError,s=i*(r?o:this.geometricError);if(s===0)return 0;var u=Math.max(e,.001),c=s*t.height/(u*t.sseDenominator);return c},n.prototype.getPriority=function(){var t=this.refine==="ADD"||this.tileset.skipLevelOfDetail;if(t&&!this.state.visible||this.tileset.frameNumber-this.state.touchedFrameNumber>=1||this.content.loadState==="UNLOADED")return-1;var e=this.parent,r=e&&(!t||this.state.screenSpaceError===0),i=r?e.state.screenSpaceError:this.state.screenSpaceError,o=this.tileset.root?this.tileset.root.state.screenSpaceError:0,s=Math.max(o-i,0);return s},n}(),TileRequestScheduler=function(){function n(t){this.tileset=t,this.activeRequests=0,this.requestQueue=[],this.requestMap=new Map,this.deferred=null}return n.prototype.scheduleRequest=function(t,e){var r=this.requestMap.get(t);if(r)return r;var i={identiy:t,priority:0,getPriority:e,resolve:function(){}},o=new Promise(function(s){return i.resolve=s});return this.requestQueue.push(i),this.requestMap.set(t,o),this.issueNewRequests(),o},n.prototype.reset=function(){for(var t=0,e=this.requestQueue;t<e.length;t++){var r=e[t];r.resolve(null)}this.requestQueue.length=0,this.requestMap.clear(),this.activeRequests=0},n.prototype.issueRequest=function(t){var e=this,r=t.identiy,i=t.resolve,o=!1,s=function(){o||(o=!0,e.requestMap.delete(r),e.activeRequests--,e.issueNewRequests())};this.activeRequests++,i({done:s})},n.prototype.issueNewRequests=function(){var t=this;this.deferred||(this.deferred=setTimeout(function(){return t.issueNewRequestsAsync()},0))},n.prototype.issueNewRequestsAsync=function(){this.deferred=null;var t=Math.max(this.tileset.maxRequests-this.activeRequests,0);if(t!==0){this.updateAllRequests();for(var e=0;e<t;e++){var r=this.requestQueue.shift();if(r)this.issueRequest(r);else break}}},n.prototype.updateAllRequests=function(){for(var t=this.requestQueue,e=0;e<t.length;e++){var r=t[e];this.updateRequest(r)===!1&&(t.splice(e,1),this.requestMap.delete(r.identiy),e--)}t.sort(function(i,o){return i.priority-o.priority})},n.prototype.updateRequest=function(t){return t.priority=t.getPriority(t.identiy),t.priority<0?(t.resolve(null),!1):!0},n}(),CacheNode=function(){function n(t,e,r){this.item=t,this.previous=e,this.next=r}return n}(),CacheNodeList=function(){function n(){this.head=null,this.tail=null,this._length=0}return Object.defineProperty(n.prototype,"length",{get:function(){return this._length},enumerable:!1,configurable:!0}),n.prototype.add=function(t){var e=new CacheNode(t,this.tail,null);return this.tail?(this.tail.next=e,this.tail=e):(this.head=e,this.tail=e),this._length++,e},n.prototype.remove=function(t){t.previous&&t.next?(t.previous.next=t.next,t.next.previous=t.previous):t.previous?(t.previous.next=null,this.tail=t.previous):t.next?(t.next.previous=null,this.head=t.next):(this.head=null,this.tail=null),t.next=null,t.previous=null,this._length--},n.prototype.splice=function(t,e){t!==e&&(this.remove(e),this.insert(t,e))},n.prototype.insert=function(t,e){var r=t.next;t.next=e,this.tail===t?this.tail=e:r.previous=e,e.next=r,e.previous=t,this._length++},n.prototype.toArray=function(){for(var t=[],e=this.head;e;)t.push(e),e=e.next;return t},n}(),TileCache=function(){function n(){this.cacheNodeMap=new Map,this.list=new CacheNodeList,this.sentinel=this.list.add("sentinel")}return n.prototype.reset=function(){this.list.tail&&this.list.splice(this.list.tail,this.sentinel)},n.prototype.touch=function(t){var e=this.cacheNodeMap.get(t);e&&this.list.splice(this.sentinel,e)},n.prototype.add=function(t,e){if(!this.cacheNodeMap.has(t)){var r=this.list.add(t);this.cacheNodeMap.set(t,r),e&&e(t)}},n.prototype.unloadTile=function(t,e){var r=this.cacheNodeMap.get(t);r&&(this.list.remove(r),this.cacheNodeMap.delete(t),e&&e(t))},n.prototype.unloadTiles=function(t,e){for(var r=this.list.head;r!==this.sentinel&&t();){var i=r.item;r=r.next,this.unloadTile(i,e)}},n.prototype.toArray=function(){for(var t=[],e=0,r=this.list.toArray();e<r.length;e++){var i=r[e];i.item!=="sentinel"&&t.push(i.item)}return t},n}(),ManagedArray=function(){function n(){this.map=new Map,this.array=[],this._length=0}return Object.defineProperty(n.prototype,"length",{get:function(){return this._length},enumerable:!1,configurable:!0}),n.prototype.get=function(t){return this.array[t]},n.prototype.set=function(t,e){t>=this.length&&(this._length=t+1),this.map.has(this.array[t])&&this.map.delete(this.array[t]),this.array[t]=e,this.map.set(e,t)},n.prototype.delete=function(t){var e=this.map.get(t);e!==void 0&&e>=0&&(this.array.splice(e,1),this.map.delete(t),this._length--)},n.prototype.push=function(t){if(!this.map.has(t)){var e=this._length++;this.array[e]=t,this.map.set(t,e)}},n.prototype.pop=function(){var t=this.array[--this._length];return this.map.delete(t),this.array[this._length]=void 0,t},n.prototype.reset=function(){this.array=[],this.map=new Map,this._length=0},n.prototype.find=function(t){return this.map.has(t)},n.prototype.peek=function(){return this.array[this._length-1]},n}(),TilesetBaseTraverser=function(){function n(t){this.tileset=t,this._canSelectTile=!0,this.root=null}return n.prototype.traverse=function(t,e,r){this.root=t,this.reset()},n.prototype.reset=function(){this.tileset.hasMixedContent=!1,this.tileset.needsRefinedTiles.clear(),this.tileset.requestedTiles.length=0,this.tileset.selectedTiles.length=0},n.prototype.updateTile=function(t,e){this.updateTileVisibility(t,e),t.state.shouldSelect=!1,t.state.finalResolution=!0},n.prototype.selectTile=function(t,e){var r=t.contentAvailable&&this._canSelectTile;r&&(t.state.selectedFrameNumber=e.frameNumber,this.tileset.selectedTiles.push(t),this.tileset.needsRefinedTiles.add(t))},n.prototype.loadTile=function(t,e){t.hasUnloadedContent&&(t.state.requestedFrameNumber=e.frameNumber,this.tileset.requestedTiles.push(t)),this.tileset.needsRefinedTiles.add(t)},n.prototype.touchTile=function(t,e){this.tileset.cache.touch(t),t.state.touchedFrameNumber=e.frameNumber},n.prototype.canTraverse=function(t,e){return t.levelOfContent>=e.maxLevelOfDetail||t.children.length===0?!1:t.levelOfContent<=e.minLevelOfDetail||t.hasTilesetContent?!0:t.state.screenSpaceError>e.maxScreenSpaceError},n.prototype.updateTileVisibility=function(t,e){if(t.updateState(e),!(!t.state.visible||!t.state.inRequestVolume)){var r=t.children.length>0;if(t.hasTilesetContent&&r){var i=t.children[0];this.updateTileVisibility(i,e),t.state.visible=i.state.visible;return}if(this.meetsScreenSpaceErrorEarly(t,e)){t.state.visible=!1;return}var o=t.refine==="REPLACE";if(o&&r&&!this.anyChildrenVisible(t,e)){t.state.visible=!1;return}}},n.prototype.anyChildrenVisible=function(t,e){for(var r=!1,i=t.children,o=0,s=i;o<s.length;o++){var u=s[o];u.updateState(e),r=r||u.state.visible}return r},n.prototype.meetsScreenSpaceErrorEarly=function(t,e){var r=t.parent;return!r||r.refine!=="ADD"||r.levelOfContent<e.minLevelOfDetail?!1:r.levelOfContent>e.maxLevelOfDetail?!0:t.getScreenSpaceError(e,t.state.distanceToCamera,!0)<e.maxScreenSpaceError},n.prototype.sortTilesByDistanceToCamera=function(t){t.sort(function(e,r){return r.state.distanceToCamera===0&&e.state.distanceToCamera===0?r.state.centerZDepth-e.state.centerZDepth:r.state.distanceToCamera-e.state.distanceToCamera})},n}(),TilesetNormalTraverser=function(n){__extends(t,n);function t(e){var r=n.call(this,e)||this;return r.tileset=e,r._traversalStack=new ManagedArray,r._emptyTraversalStack=new ManagedArray,r}return t.prototype.traverse=function(e,r,i){i===void 0&&(i=[]),n.prototype.traverse.call(this,e,r,i);for(var o=0,s=i;o<s.length;o++){var u=s[o];this._traversalStack.reset(),this._emptyTraversalStack.reset(),u.camera.refine&&(this._canSelectTile=u.camera.visible,this.updateTile(e,u),this.executeTraversal(e,u))}this._traversalStack.reset(),this._emptyTraversalStack.reset(),r.camera.refine&&(this._canSelectTile=r.camera.visible,this.updateTile(e,r),this.executeTraversal(e,r))},t.prototype.reset=function(){n.prototype.reset.call(this),this._traversalStack.reset(),this._emptyTraversalStack.reset()},t.prototype.executeTraversal=function(e,r){var i=this._traversalStack;for(e.state.visible&&e.state.inRequestVolume&&i.push(e);i.length>0;){var o=i.pop(),s=o.parent,u=!s||s.state.shouldRefine,c=!1;this.canTraverse(o,r)&&(c=this.updateAndPushChildren(o,r,i)&&u);var l=!c&&u;o.hasRenderContent?o.refine==="ADD"?(this.loadTile(o,r),this.selectDesiredTile(o,r)):o.refine==="REPLACE"&&(this.loadTile(o,r),l&&this.selectDesiredTile(o,r)):(this.loadTile(o,r),l&&this.selectDesiredTile(o,r)),this.touchTile(o,r),o.state.shouldRefine=c}},t.prototype.updateAndPushChildren=function(e,r,i){for(var o=e.children,s=0,u=o;s<u.length;s++){var c=u[s];this.updateTile(c,r)}this.sortTilesByDistanceToCamera(o);for(var l=e.refine==="REPLACE"&&e.hasRenderContent,d=!1,f=!0,v=0,A=o;v<A.length;v++){var c=A[v];if(c.state.visible&&c.state.inRequestVolume?(i.find(c)&&i.delete(c),i.push(c),d===!1&&(d=!0)):(l||this.tileset.loadSiblings)&&(this.loadTile(c,r),this.touchTile(c,r)),l){var h=void 0;c.state.inRequestVolume?c.hasRenderContent?h=c.contentAvailable:h=this.executeEmptyTraversal(c,r):h=!1,f=f&&h}}return d||(f=!1),f},t.prototype.selectDesiredTile=function(e,r){e.contentAvailable&&n.prototype.selectTile.call(this,e,r)},t.prototype.executeEmptyTraversal=function(e,r){var i=!0,o=this._emptyTraversalStack;for(o.push(e);o.length>0&&i;){var s=o.pop(),u=!s.hasRenderContent&&this.canTraverse(s,r);if(!u&&!s.contentAvailable&&(i=!1),this.updateTile(s,r),s.state.visible||(this.loadTile(s,r),this.touchTile(s,r)),u)for(var c=s.children,l=0,d=c;l<d.length;l++){var f=d[l];o.find(f)&&o.delete(f),o.push(f)}}return i},t}(TilesetBaseTraverser),TilesetSkipTraverser=function(n){__extends(t,n);function t(e){var r=n.call(this,e)||this;return r.tileset=e,r.baseScreenSpaceError=1024,r.skipScreenSpaceErrorFactor=16,r.skipLevels=1,r._traversalStack=new ManagedArray,r._descendantTraversalStack=new ManagedArray,r._selectionTraversalStack=new ManagedArray,r._selectionTraversalancestorStack=new ManagedArray,r}return t.prototype.traverse=function(e,r,i){i===void 0&&(i=[]),n.prototype.traverse.call(this,e,r,i);for(var o=0,s=i;o<s.length;o++){var u=s[o];this._traversalStack.reset(),u.camera.refine&&(this._canSelectTile=u.camera.visible,this.updateTile(e,u),this.executeTraversal(e,u),this.traverseAndSelect(e,u))}this.tileset.hasMixedContent=!1,this._traversalStack.reset(),this._descendantTraversalStack.reset(),this._selectionTraversalStack.reset(),this._selectionTraversalancestorStack.reset(),r.camera.refine&&(this._canSelectTile=r.camera.visible,this.updateTile(e,r),this.executeTraversal(e,r),this.traverseAndSelect(e,r))},t.prototype.reset=function(){n.prototype.reset.call(this),this._traversalStack.reset(),this._descendantTraversalStack.reset(),this._selectionTraversalStack.reset(),this._selectionTraversalancestorStack.reset()},t.prototype.executeTraversal=function(e,r){var i=this._traversalStack;for(e.state.visible&&e.state.inRequestVolume&&i.push(e);i.length>0;){var o=i.pop();this.updateTileAncestorContentLinks(o,r);var s=o.parent,u=!s||s.state.shouldRefine,c=!1;this.canTraverse(o,r)&&(c=this.updateAndPushChildren(o,r,i)&&u);var l=!c&&u;o.hasRenderContent?o.refine==="ADD"?(this.loadTile(o,r),this.selectDesiredTile(o,r)):o.refine==="REPLACE"&&(this.inBaseTraversal(o,this.baseScreenSpaceError)?(this.loadTile(o,r),l&&this.selectDesiredTile(o,r)):l?(this.loadTile(o,r),this.selectDesiredTile(o,r)):this.reachedSkippingThreshold(o)&&this.loadTile(o,r)):(this.loadTile(o,r),l&&this.selectDesiredTile(o,r)),this.touchTile(o,r),o.state.shouldRefine=c}},t.prototype.updateAndPushChildren=function(e,r,i){for(var o=e.children,s=0,u=o;s<u.length;s++){var c=u[s];this.updateTile(c,r)}this.sortTilesByDistanceToCamera(o);for(var l=!1,d=0,f=o;d<f.length;d++){var c=f[d];c.state.visible&&c.state.inRequestVolume?(i.push(c),l===!1&&(l=!0)):this.tileset.loadSiblings&&(this.loadTile(c,r),this.touchTile(c,r))}return l},t.prototype.selectDesiredTile=function(e,r){var i=e.contentAvailable?e:e.state.ancestorWithContentAvailable;i&&(i.state.shouldSelect=!0),e.contentAvailable||this.selectDescendants(e,r)},t.prototype.selectDescendants=function(e,r){var i=this._descendantTraversalStack;for(i.push(e);i.length>0;)for(var o=i.pop(),s=o.children,u=0,c=s;u<c.length;u++){var l=c[u];l.state.visible&&(l.contentAvailable?(this.updateTile(l,r),this.touchTile(l,r),this.selectTile(l,r)):i.push(l))}},t.prototype.reachedSkippingThreshold=function(e){var r=e.state.ancestorWithContent,i=r!==null&&e.state.screenSpaceError<r.state.screenSpaceError/this.skipScreenSpaceErrorFactor&&e.levelOfContent>r.levelOfContent+this.skipLevels;return i},t.prototype.updateTileAncestorContentLinks=function(e,r){e.state.ancestorWithContent=null,e.state.ancestorWithContentAvailable=null;var i=e.parent;if(i){var o=!(i.hasRenderContent&&i.hasUnloadedContent)||i.state.requestedFrameNumber===r.frameNumber;e.state.ancestorWithContent=o?i:i.state.ancestorWithContent,e.state.ancestorWithContentAvailable=i.contentAvailable?i:i.state.ancestorWithContentAvailable}},t.prototype.inBaseTraversal=function(e,r){return e.state.ancestorWithContent?e.parent&&e.state.screenSpaceError===0?e.parent.state.screenSpaceError>r:e.state.screenSpaceError>r:!0},t.prototype.traverseAndSelect=function(e,r){var i=this._selectionTraversalStack,o=this._selectionTraversalancestorStack,s;for(i.push(e);i.length>0||o.length>0;){if(o.length>0){var u=o.peek();if(u.state.stackLength===i.length){o.pop(),u!==s&&(u.state.finalResolution=!1),this.selectTile(u,r);continue}}var c=i.pop();if(c){var l=this.canTraverse(c,r);if(c.state.shouldSelect)if(c.refine==="ADD")this.selectTile(c,r);else{if(c.state.selectionDepth=o.length,c.state.selectionDepth>0&&(c.tileset.hasMixedContent=!0),s=c,!l){this.selectTile(c,r);continue}o.push(c),c.state.stackLength=i.length}if(l)for(var d=0,f=c.children;d<f.length;d++){var v=f[d];v.state.visible&&i.push(v)}}}},t}(TilesetBaseTraverser),identityMatrix4=new THREE__namespace.Matrix4,Tileset=function(){function n(t,e,r){var i,o,s,u,c;this.id=t,this.transform=new THREE__namespace.Matrix4,this.transformIsIdentity=!0,this.hasMixedContent=!1,this.url=(i=r.url)!==null&&i!==void 0?i:"",this.referer=(o=r.referer)!==null&&o!==void 0?o:"",this.asset={version:e.asset.version,tilesetVersion:e.asset.tilesetVersion||"",gltfUpAxis:(s=e.asset.gltfUpAxis)!==null&&s!==void 0?s:"Y",overview:e.asset.overview},this.rootMeta=(u=e.rootMeta)!==null&&u!==void 0?u:{},this.properties=(c=e.properties)!==null&&c!==void 0?c:{},this.options=r,this.maxMemoryUsage=n.DEFAULT_MAX_MEMORY_USAGE,this.maxScreenSpaceError=n.DEFAULT_MAX_SCREEN_SPACE_ERROR,this.skipLevelOfDetail=n.DEFAULT_SKIP_LEVEL_OF_DETAIL,this.loadSiblings=n.DEFAULT_LOAD_SIBLINGS,this.maxRequests=n.DEFAULT_MAX_REQUESTS,this.requestedTiles=[],this.selectedTiles=[],this.needsRefinedTiles=new Set,this.cache=new TileCache,this.normalTraverser=new TilesetNormalTraverser(this),this.skipTraverser=new TilesetSkipTraverser(this),this.requestScheduler=new TileRequestScheduler(this),this.frameNumber=0,this.pendingCount=0,this.loadedTiles=new Set,this.memoryUsageInBytes=0,this.root=new Tile("".concat(this.id,".0"),e.root,this),this.geometricError=e.geometricError}return Object.defineProperty(n.prototype,"traverser",{get:function(){return this.skipLevelOfDetail?this.skipTraverser:this.normalTraverser},enumerable:!1,configurable:!0}),n.prototype.reset=function(){for(var t=this,e=[this.root],r;r=e.pop();){for(var i=0,o=r.children.length;i<o;i++)e.push(r.children[i]);this.cache.unloadTile(r,function(s){return t.unloadTile(s)})}this.cache.reset(),this.traverser.reset(),this.requestScheduler.reset(),this.loadedTiles.clear()},n.prototype.isLoaded=function(){return this.pendingCount===0&&this.frameNumber!==0},n.prototype.traverse=function(t,e){var r=this;e===void 0&&(e=[]),this.transformIsIdentity=this.transform.equals(identityMatrix4),this.traverser.traverse(this.root,t,e),this.requestedTiles.forEach(function(i){i.hasUnloadedContent&&r.loadTile(i)}),this.cache.unloadTiles(function(){var i=r.memoryUsageInBytes>r.maxMemoryUsage*1024*1024;return i},function(i){r.unloadTile(i),r.loadedTiles.delete(i)})},n.prototype.loadTile=function(t){var e=this;this.pendingCount++,t.loadContent().catch(function(r){return e.options.onTileError(t,r),!1}).then(function(r){var i;e.pendingCount--,r&&(!((i=t.content)===null||i===void 0)&&i.data&&(e.loadedTiles.add(t),e.cache.add(t,function(){e.memoryUsageInBytes+=t.contentByteLength})),e.options.onTileLoad(t))})},n.prototype.unloadTile=function(t){this.memoryUsageInBytes-=t.contentByteLength,this.options.onTileUnload(t),t.unloadContent()},n.DEFAULT_MAX_MEMORY_USAGE=16,n.DEFAULT_MAX_SCREEN_SPACE_ERROR=4,n.DEFAULT_SKIP_LEVEL_OF_DETAIL=!1,n.DEFAULT_LOAD_SIBLINGS=!1,n.DEFAULT_MAX_REQUESTS=6,n}(),BVHObject=function(){function n(t,e){this.position=t,this.indices=e}return n.prototype.getPositionCount=function(){var t,e,r=this.indices,i=this.position;return r?r.array.length/((t=r.stride)!==null&&t!==void 0?t:1):i.array.length/((e=i.stride)!==null&&e!==void 0?e:3)},n.prototype.getPositionByIndex=function(t,e){var r,i,o,s,u=this.indices,c=this.position,l=t;if(u){var d=u.array,f=(r=u.stride)!==null&&r!==void 0?r:1,v=(i=u.offset)!==null&&i!==void 0?i:0;l=d[t*f+v]}var A=c.array,h=(o=c.stride)!==null&&o!==void 0?o:3,p=(s=c.offset)!==null&&s!==void 0?s:0;return l=l*h+p,e.x=A[l],e.y=A[l+1],e.z=A[l+2],e},n.prototype.createTree=function(t,e,r){throw new Error("not implemented")},n.prototype.trianglesInSphere=function(t,e){throw new Error("not implemented")},n.prototype.intersectRay=function(t,e,r,i){throw new Error("not implemented")},n}(),BVHNode=function(){function n(t,e,r,i,o){this.id=t,this.extents=e,this.startIndex=r,this.endIndex=i,this.deepth=o}return n}(),BYTES_PER_NODE=6*4+4+4+2+2;function packBVHNode(n,t){for(var e=new ArrayBuffer(t*BYTES_PER_NODE),r=new Float32Array(e),i=new Uint32Array(e),o=new Uint16Array(e),s=[n],u,c;u=s.pop();)c=u.id*BYTES_PER_NODE/4,r[c]=u.extents[0],r[c+1]=u.extents[1],r[c+2]=u.extents[2],r[c+3]=u.extents[3],r[c+4]=u.extents[4],r[c+5]=u.extents[5],i[c+6]=u.startIndex,i[c+7]=u.endIndex,c=u.id*BYTES_PER_NODE/2,u.node0&&(o[c+16]=u.node0.id,s.push(u.node0)),u.node1&&(o[c+17]=u.node1.id,s.push(u.node1));return e}function intersectNodeBox(n,t,e,r,i,o,s,u,c){c===void 0&&(c=0),e=e-c,r=r-c,i=i-c,o=o+c,s=s+c,u=u+c;var l=0,d=0,f=0,v=0,A=0,h=0;return t.x>=0?(l=(e-n.x)*t.x,d=(o-n.x)*t.x):(l=(o-n.x)*t.x,d=(e-n.x)*t.x),t.y>=0?(f=(r-n.y)*t.y,v=(s-n.y)*t.y):(f=(s-n.y)*t.y,v=(r-n.y)*t.y),!(l>v||f>d||(f>l&&(l=f),v<d&&(d=v),t.z>=0?(A=(i-n.z)*t.z,h=(u-n.z)*t.z):(A=(u-n.z)*t.z,h=(i-n.z)*t.z),l>h||A>d)||(A>l&&(l=A),h<d&&(d=h),d<0))}var BVHVector3=function(){function n(t,e,r){this.x=t,this.y=e,this.z=r}return n.prototype.copy=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},n.prototype.set=function(t,e,r){return this.x=t,this.y=e,this.z=r,this},n.prototype.fromArray=function(t,e){return e===void 0&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this},n.prototype.toArray=function(t,e){return t===void 0&&(t=[]),e===void 0&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t},n.prototype.add=function(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this},n.prototype.multiplyScalar=function(t){return this.x*=t,this.y*=t,this.z*=t,this},n.prototype.subVectors=function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this},n.prototype.addScaledVector=function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this},n.prototype.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z},n.prototype.cross=function(t){var e=this.x,r=this.y,i=this.z;return this.x=r*t.z-i*t.y,this.y=i*t.x-e*t.z,this.z=e*t.y-r*t.x,this},n.prototype.crossVectors=function(t,e){var r=t.x,i=t.y,o=t.z,s=e.x,u=e.y,c=e.z;return this.x=i*c-o*u,this.y=o*s-r*c,this.z=r*u-i*s,this},n.prototype.distanceTo=function(t){return Math.sqrt(this.distanceToSquared(t))},n.prototype.distanceToSquared=function(t){var e=this.x-t.x,r=this.y-t.y,i=this.z-t.z;return e*e+r*r+i*i},n.prototype.clone=function(){return new n(this.x,this.y,this.z)},n}(),BVHIntersect=function(){function n(t,e,r){this.triangle=t,this.intersectionPoint=e,this.index=r}return n}(),EPSILON$1=1e-6,scratchVector3$3=new BVHVector3(0,0,0),scratchVector3A=new BVHVector3(0,0,0),scratchVector3B=new BVHVector3(0,0,0),scratchVector3C=new BVHVector3(0,0,0),BVHMesh=function(n){__extends(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t.prototype.createTree=function(e,r,i){r=Math.min(r,16);var o=this.getPositionCount()/3,s=o>65535?new Uint32Array(o):new Uint16Array(o),u=new Float32Array(o*6),c=[],l=0,d=-1;if(i)for(var f=0,v=0,A=0,h=void 0,p=void 0,y=void 0,m=void 0,g=void 0,E=void 0,b=void 0;f<o;f+=1,v+=3,A+=6)s[f]=f,this.getPositionByIndex(v,scratchVector3A),this.getPositionByIndex(v+1,scratchVector3B),this.getPositionByIndex(v+2,scratchVector3C),h=m=scratchVector3A.x,b=scratchVector3B.x,b<h&&(h=b),b>m&&(m=b),b=scratchVector3C.x,b<h&&(h=b),b>m&&(m=b),p=g=scratchVector3A.y,b=scratchVector3B.y,b<p&&(p=b),b>g&&(g=b),b=scratchVector3C.y,b<p&&(p=b),b>g&&(g=b),y=E=scratchVector3A.z,b=scratchVector3B.z,b<y&&(y=b),b>E&&(E=b),b=scratchVector3C.z,b<y&&(y=b),b>E&&(E=b),u[A]=h,u[A+1]=p,u[A+2]=y,u[A+3]=m,u[A+4]=g,u[A+5]=E;else{for(var T=1/0,_=1/0,S=1/0,R=-1/0,B=-1/0,I=-1/0,f=0,v=0,A=0,h=void 0,p=void 0,y=void 0,m=void 0,g=void 0,E=void 0,b=void 0;f<o;f+=1,v+=3,A+=6)s[f]=f,this.getPositionByIndex(v,scratchVector3A),this.getPositionByIndex(v+1,scratchVector3B),this.getPositionByIndex(v+2,scratchVector3C),h=m=scratchVector3A.x,b=scratchVector3B.x,b<h&&(h=b),b>m&&(m=b),b=scratchVector3C.x,b<h&&(h=b),b>m&&(m=b),p=g=scratchVector3A.y,b=scratchVector3B.y,b<p&&(p=b),b>g&&(g=b),b=scratchVector3C.y,b<p&&(p=b),b>g&&(g=b),y=E=scratchVector3A.z,b=scratchVector3B.z,b<y&&(y=b),b>E&&(E=b),b=scratchVector3C.z,b<y&&(y=b),b>E&&(E=b),u[A]=h,u[A+1]=p,u[A+2]=y,u[A+3]=m,u[A+4]=g,u[A+5]=E,h<T&&(T=h),m>R&&(R=m),p<_&&(_=p),g>B&&(B=g),y<S&&(S=y),E>I&&(I=E);i=[T,_,S,R,B,I]}var x=new BVHNode(++d,i,0,o,0);c[l++]=x;var M=[],L=[0,1,2],C=function(F,O){return M[O]-M[F]};function H(F){var O=F.startIndex,G=F.endIndex,Q=F.extents;M[0]=Q[3]-Q[0],M[1]=Q[4]-Q[1],M[2]=Q[5]-Q[2],L.sort(C);for(var U=0;U<3;U++){for(var D=L[U],q=Q[D]+Q[D+3],z=O,K=G-1,J=-1,j=void 0;z<=K;)J===-1?(j=s[z],u[j*6+D]+u[j*6+D+3]<q?z++:J=j):(j=s[K],u[j*6+D]+u[j*6+D+3]>=q||(s[z]=j,s[K]=J,J=-1,z++),K--);if(z>O&&z<G){var re=new BVHNode(++d,calcExtents(s,u,O,z,EPSILON$1),O,z,F.deepth+1);re.deepth<r&&re.endIndex-re.startIndex>e&&(c[l++]=re);var W=new BVHNode(++d,calcExtents(s,u,z,G,EPSILON$1),z,G,F.deepth+1);W.deepth<r&&W.endIndex-W.startIndex>e&&(c[l++]=W),F.node0=re,F.node1=W,F.startIndex=0,F.endIndex=0;break}}}for(;l;)H(c[--l]);return this.offsetArray=s,this.rootNodePacked=packBVHNode(x,d+1),c.length=0,this},t.prototype.trianglesInSphere=function(e,r){for(var i=this.offsetArray,o=this.rootNodePacked,s=new Float32Array(o),u=new Uint32Array(o),c=new Uint16Array(o),l=[0],d=[],f,v,A,h;(f=l.pop())!==void 0;){h=f*BYTES_PER_NODE/4;var p=clamp(e.x,s[h],s[h+3])-e.x,y=clamp(e.y,s[h+1],s[h+4])-e.y,m=clamp(e.z,s[h+2],s[h+5])-e.z;if(p*p+y*y+m*m<=r*r){for(var g=u[h+6];g<u[h+7];g++)d.push(i[g]);h=f*BYTES_PER_NODE/2,v=c[h+16],A=c[h+17],v&&l.push(v),A&&l.push(A)}}for(var E=d.length,b=new Float32Array(E*9),g=0;g<E;g++){var T=d[g];this.getPositionByIndex(T,scratchVector3$3),b[g*9]=scratchVector3$3.x,b[g*9+1]=scratchVector3$3.y,b[g*9+2]=scratchVector3$3.z,this.getPositionByIndex(T+1,scratchVector3$3),b[g*9+3]=scratchVector3$3.x,b[g*9+4]=scratchVector3$3.y,b[g*9+5]=scratchVector3$3.z,this.getPositionByIndex(T+2,scratchVector3$3),b[g*9+6]=scratchVector3$3.x,b[g*9+7]=scratchVector3$3.y,b[g*9+8]=scratchVector3$3.z}return b},t.prototype.intersectRay=function(e,r,i,o){for(var s=this.offsetArray,u=this.rootNodePacked,c=new Float32Array(u),l=new Uint32Array(u),d=new Uint16Array(u),f=new BVHVector3(1/r.x,1/r.y,1/r.z),v=[0],A,h,p,y;(A=v.pop())!==void 0;)if(y=A*BYTES_PER_NODE/4,intersectNodeBox(e,f,c[y],c[y+1],c[y+2],c[y+3],c[y+4],c[y+5])){for(var m=l[y+6],g=l[y+7],E=void 0,b=void 0,T=void 0,_=e.x,S=e.y,R=e.z,B=r.x,I=r.y,x=r.z,M=void 0,L=void 0,C=void 0,H=void 0,F=void 0,O=void 0,G=void 0,Q=void 0,U=void 0,D=void 0,q=void 0,z=void 0,K=void 0,J=void 0,j=void 0,re=void 0,W=void 0,te=void 0,$=void 0,ne=void 0,ee=void 0,ce=void 0,ae=void 0,se=void 0,Ae=void 0,he=void 0,me=void 0;m<g;m++){if(E=s[m],b=E*3,this.getPositionByIndex(b,scratchVector3$3),M=scratchVector3$3.x,L=scratchVector3$3.y,C=scratchVector3$3.z,this.getPositionByIndex(b+1,scratchVector3$3),H=scratchVector3$3.x,F=scratchVector3$3.y,O=scratchVector3$3.z,this.getPositionByIndex(b+2,scratchVector3$3),G=scratchVector3$3.x,Q=scratchVector3$3.y,U=scratchVector3$3.z,D=H-M,q=F-L,z=O-C,K=G-M,J=Q-L,j=U-C,re=q*j-z*J,W=z*K-D*j,te=D*J-q*K,ae=B*re+I*W+x*te,ae>0)ce=1;else if(ae<0)ce=-1,ae=-ae;else continue;$=_-M,ne=S-L,ee=R-C,se=ce*(B*(ne*j-ee*J)+I*(ee*K-$*j)+x*($*J-ne*K)),!(se<0)&&(Ae=ce*(B*(q*ee-z*ne)+I*(z*$-D*ee)+x*(D*ne-q*$)),!(Ae<0)&&(se+Ae>ae||(he=-ce*($*re+ne*W+ee*te),!(he<0)&&(me=he/ae,o.push(new BVHIntersect([M,L,C,H,F,O,G,Q,U],[_+B*me,S+I*me,R+x*me],E))))))}y=A*BYTES_PER_NODE/2,h=d[y+16],p=d[y+17],h&&v.push(h),p&&v.push(p)}return o},t}(BVHObject);function clamp(n,t,e){return n<t?t:n>e?e:n}function calcExtents(n,t,e,r,i){if(e>=r)return[0,0,0,0,0,0];for(var o=1/0,s=1/0,u=1/0,c=-1/0,l=-1/0,d=-1/0,f=e,v=void 0,A=void 0;f<r;f++)v=n[f]*6,A=t[v],A<o&&(o=A),A=t[v+1],A<s&&(s=A),A=t[v+2],A<u&&(u=A),A=t[v+3],A>c&&(c=A),A=t[v+4],A>l&&(l=A),A=t[v+5],A>d&&(d=A);return[o-i,s-i,u-i,c+i,l+i,d+i]}var EPSILON=1e-6,ORDER_AXISES=["x","y","z"],scratchVector3$2=new BVHVector3(0,0,0),BVHPoints=function(n){__extends(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t.prototype.createTree=function(e,r,i){r=Math.min(r,16);var o=this.getPositionByIndex.bind(this),s=this.getPositionCount(),u=s>65535?new Uint32Array(s):new Uint16Array(s),c=[],l=0,d=-1;if(i)for(var f=0;f<s;f+=1)u[f]=f;else{o(0,scratchVector3$2);for(var v=scratchVector3$2.x,A=scratchVector3$2.y,h=scratchVector3$2.z,p=v,y=A,m=h,f=0,g=void 0,E=void 0,b=void 0;f<s;f+=1)u[f]=f,o(f,scratchVector3$2),g=scratchVector3$2.x,E=scratchVector3$2.y,b=scratchVector3$2.z,g<v?v=g:g>p&&(p=g),E<A?A=E:E>y&&(y=E),b<h?h=b:b>m&&(m=b);i=[v,A,h,p,y,m]}var T=new BVHNode(++d,i,0,s,0);c[l++]=T;var _=[],S=[0,1,2],R=function(I,x){return _[x]-_[I]};function B(I){var x=I.startIndex,M=I.endIndex,L=I.extents;_[0]=L[3]-L[0],_[1]=L[4]-L[1],_[2]=L[5]-L[2];for(var C=S.sort(R)[0],H=ORDER_AXISES[C],F=(L[C]+L[C+3])/2,O=x,G=M-1,Q=-1,U;O<=G;)Q===-1?(U=u[O],o(U,scratchVector3$2),scratchVector3$2[H]<F?O++:Q=U):(U=u[G],o(U,scratchVector3$2),scratchVector3$2[H]>=F||(u[O]=U,u[G]=Q,Q=-1,O++),G--);if(O>x){var D=L.slice();D[C+3]=F+EPSILON;var q=new BVHNode(++d,D,x,O,I.deepth+1);q.deepth<r&&q.endIndex-q.startIndex>e&&(c[l++]=q),I.node0=q}if(M>O){var z=L.slice();z[C]=F-EPSILON;var K=new BVHNode(++d,z,O,M,I.deepth+1);K.deepth<r&&K.endIndex-K.startIndex>e&&(c[l++]=K),I.node1=K}I.startIndex=0,I.endIndex=0}for(;l;)B(c[--l]);return this.offsetArray=u,this.rootNodePacked=packBVHNode(T,d+1),c.length=0,this},t.prototype.intersectRay=function(e,r,i,o){for(var s=this.offsetArray,u=this.rootNodePacked,c=new Float32Array(u),l=new Uint32Array(u),d=new Uint16Array(u),f=i*i,v=new BVHVector3(1/r.x,1/r.y,1/r.z),A=[0],h,p,y,m;(h=A.pop())!==void 0;)if(m=h*BYTES_PER_NODE/4,intersectNodeBox(e,v,c[m],c[m+1],c[m+2],c[m+3],c[m+4],c[m+5],i)){for(var g=l[m+6],E=l[m+7],b=void 0,T=void 0,_=void 0,S=void 0,R=void 0,B=void 0,I=void 0,x=void 0,M=void 0,L=void 0,C=void 0,H=void 0;g<E;g++)b=s[g],this.getPositionByIndex(b,scratchVector3$2),T=scratchVector3$2.x,_=scratchVector3$2.y,S=scratchVector3$2.z,R=e.x,B=e.y,I=e.z,x=r.x,M=r.y,L=r.z,C=x*(T-R)+M*(_-B)+L*(S-I),C>0&&(R+=x*C,B+=M*C,I+=L*C),x=T-R,M=_-B,L=S-I,C=x*x+M*M+L*L,C<=f&&o.push(new BVHIntersect([T,_,S,T,_,S,T,_,S],[R,B,I],b));m=h*BYTES_PER_NODE/2,p=d[m+16],y=d[m+17],p&&A.push(p),y&&A.push(y)}return o},t}(BVHObject);const encodedJs$1="KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO3ZhciBlcj1mdW5jdGlvbihlLHIpe3JldHVybiBlcj1PYmplY3Quc2V0UHJvdG90eXBlT2Z8fHtfX3Byb3RvX186W119aW5zdGFuY2VvZiBBcnJheSYmZnVuY3Rpb24odCxvKXt0Ll9fcHJvdG9fXz1vfXx8ZnVuY3Rpb24odCxvKXtmb3IodmFyIGYgaW4gbylPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwobyxmKSYmKHRbZl09b1tmXSl9LGVyKGUscil9O2Z1bmN0aW9uIGhyKGUscil7aWYodHlwZW9mIHIhPSJmdW5jdGlvbiImJnIhPT1udWxsKXRocm93IG5ldyBUeXBlRXJyb3IoIkNsYXNzIGV4dGVuZHMgdmFsdWUgIitTdHJpbmcocikrIiBpcyBub3QgYSBjb25zdHJ1Y3RvciBvciBudWxsIik7ZXIoZSxyKTtmdW5jdGlvbiB0KCl7dGhpcy5jb25zdHJ1Y3Rvcj1lfWUucHJvdG90eXBlPXI9PT1udWxsP09iamVjdC5jcmVhdGUocik6KHQucHJvdG90eXBlPXIucHJvdG90eXBlLG5ldyB0KX10eXBlb2YgU3VwcHJlc3NlZE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ZlcjpBcnJheS5mcm9tKG8pfX0pfSl9KSgpOwo=",decodeBase64$1=n=>Uint8Array.from(atob(n),t=>t.charCodeAt(0)),blob$2=typeof self!="undefined"&&self.Blob&&new Blob([decodeBase64$1(encodedJs$1)],{type:"text/javascript;charset=utf-8"});function WorkerWrapper$1(n){let t;try{if(t=blob$2&&(self.URL||self.webkitURL).createObjectURL(blob$2),!t)throw"";const e=new Worker(t,{name:n==null?void 0:n.name});return e.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),e}catch(e){return new Worker("data:text/javascript;base64,"+encodedJs$1,{name:n==null?void 0:n.name})}finally{t&&(self.URL||self.webkitURL).revokeObjectURL(t)}}var WorkerPool$1=function(){function n(t,e){this.pool=e,this.workerCreator=t,this.queue=[],this.workers=[],this.workersResolver=[],this.workerStatus=0}return n.prototype.initWorker=function(t){if(this.workerCreator&&!this.workers[t]){var e=this.workerCreator();e.addEventListener("message",this.onMessage.bind(this,t)),this.workers[t]=e}},n.prototype.getIdleWorker=function(){for(var t=0;t<this.pool;t++)if(!(this.workerStatus&1<<t))return t;return-1},n.prototype.onMessage=function(t,e){var r=this.workersResolver[t],i=r.resolve,o=r.reject;if(e.data&&"$$error"in e.data?o(e.data.$$error):i(e.data),this.queue.length){var s=this.queue.shift(),u=s.resolve,c=s.reject,l=s.input,d=s.transfer;this.workersResolver[t]={resolve:u,reject:c},this.workers[t].postMessage(l,d)}else this.workerStatus^=1<<t},n.prototype.postMessage=function(t,e){var r=this;return e===void 0&&(e=[]),new Promise(function(i,o){var s=r.getIdleWorker();s!==-1?(r.initWorker(s),r.workerStatus|=1<<s,r.workersResolver[s]={resolve:i,reject:o},r.workers[s].postMessage(t,e)):r.queue.push({resolve:i,reject:o,input:t,transfer:e})})},n.prototype.dispose=function(){this.workers.forEach(function(t){return t.terminate()}),this.workersResolver.length=0,this.workers.length=0,this.queue.length=0,this.workerStatus=0},n}(),bvhWorkerPool=new WorkerPool$1(function(){return new WorkerWrapper$1},4),bvhMeshMap=new Map,scratchRay=new THREE__namespace.Ray,scratchNormalMatrix=new THREE__namespace.Matrix3,scratchInverseMatrix=new THREE__namespace.Matrix4,scratchIntersectionFaceA=new THREE__namespace.Vector3,scratchIntersectionFaceB=new THREE__namespace.Vector3,scratchIntersectionFaceC=new THREE__namespace.Vector3,scratchIntersectionTriangle=new THREE__namespace.Triangle;function raycastMesh(n,t,e,r){var i,o=n.matrixWorld;scratchInverseMatrix.getInverse(o),scratchRay.copy(e.ray).applyMatrix4(scratchInverseMatrix);for(var s=t.intersectRay(scratchRay.origin,scratchRay.direction,0,[]),u=n.geometry,c=n.material,l=u.groups,d=u.index,f=0,v=s.length;f<v;f++){var A=s[f],h=A.triangle,p=A.index,y=A.intersectionPoint,m=new THREE__namespace.Vector3(y[0],y[1],y[2]).applyMatrix4(o),g=e.ray.origin.distanceTo(m);if(!(g<e.near||g>e.far)){var E=void 0;if(Array.isArray(c)){if(l)for(var b=p*3,T=0,_=l;T<_.length;T++){var S=_[T];if(b>=S.start&&b-S.start<S.count){E=c[(i=S.materialIndex)!==null&&i!==void 0?i:0];break}}}else E=c;if(E){var R=scratchIntersectionTriangle.set(scratchIntersectionFaceA.set(h[0],h[1],h[2]).applyMatrix4(o),scratchIntersectionFaceB.set(h[3],h[4],h[5]).applyMatrix4(o),scratchIntersectionFaceC.set(h[6],h[7],h[8]).applyMatrix4(o)).getNormal(new THREE__namespace.Vector3),B=p*3,I=new THREE__namespace.Face3(d?d.array[B]:B,d?d.array[B+1]:B+1,d?d.array[B+2]:B+2,R),x=e.ray.direction.dot(R);E.side===THREE__namespace.FrontSide&&x>=0||E.side===THREE__namespace.BackSide&&x<=0||r.push({distance:g,object:n,face:I,point:m,distanceToRay:0,faceIndex:p})}}}}function raycastPoints(n,t,e,r){var i,o,s=n.matrixWorld;scratchNormalMatrix.getNormalMatrix(s),scratchInverseMatrix.getInverse(s);var u=((o=(i=e.params.Points)===null||i===void 0?void 0:i.threshold)!==null&&o!==void 0?o:1)*scratchInverseMatrix.getMaxScaleOnAxis();scratchRay.copy(e.ray).applyMatrix4(scratchInverseMatrix);for(var c=t.intersectRay(scratchRay.origin,scratchRay.direction,u,[]),l=n.geometry,d=l.index,f=l.getAttribute("normal"),v=0,A=c.length;v<A;v++){var h=c[v],p=h.triangle,y=h.index,m=h.intersectionPoint,g=new THREE__namespace.Vector3(m[0],m[1],m[2]).applyMatrix4(s),E=e.ray.origin.distanceTo(g);if(!(E<e.near||E>e.far)){var b=scratchIntersectionFaceA.set(p[0],p[1],p[2]).applyMatrix4(s),T=d?d.array[y]:y,_=void 0;f instanceof THREE__namespace.BufferAttribute&&(_=new THREE__namespace.Vector3().fromBufferAttribute(f,T).applyNormalMatrix(scratchNormalMatrix));var S=new THREE__namespace.Face3(T,T,T,_);r.push({distance:E,object:n,face:S,point:g,distanceToRay:g.distanceTo(b),index:y})}}}var BVH_MESH_PROP="__bvh_mesh__",originMeshRaycast=THREE__namespace.Mesh.prototype.raycast;function overrideMeshRaycast(n,t){var e=getBvhTreeForMesh(this);e?raycastMesh(this,e,n,t):originMeshRaycast.call(this,n,t)}function getBvhTreeForMesh(n){var t=n[BVH_MESH_PROP];return t instanceof BVHMesh,t}function bindBvhTreeForMesh(n,t){var e;Object.assign(n,(e={},e[BVH_MESH_PROP]=t,e.raycast=overrideMeshRaycast,e))}var BVH_POINTS_PROP="__bvh_points__",originPointsRaycast=THREE__namespace.Points.prototype.raycast;function overridePointsRaycast(n,t){var e=getBvhTreeForPoints(this);e?raycastPoints(this,e,n,t):originPointsRaycast.call(this,n,t)}function getBvhTreeForPoints(n){var t=n[BVH_POINTS_PROP];return t instanceof BVHPoints,t}function bindBvhTreeForPoints(n,t){var e;Object.assign(n,(e={},e[BVH_POINTS_PROP]=t,e.raycast=overridePointsRaycast,e))}function generateBvhTree(n,t,e,r){var i=[];return n.traverse(function(o){(o instanceof THREE__namespace.Mesh||o instanceof THREE__namespace.Points)&&o.geometry instanceof THREE__namespace.BufferGeometry&&i.push(o)}),Promise.resolve().then(function(){for(var o=[],s=new Set,u=null,c=0;c<i.length;c++){var l=i[c],d=l.geometry;if(d instanceof THREE__namespace.BufferGeometry){var f=void 0;if(l instanceof THREE__namespace.Mesh?f="mesh":l instanceof THREE__namespace.Points&&(f="points"),!!f){var v=d.boundingBox,A=v?[v.min.x,v.min.y,v.min.z,v.max.x,v.max.y,v.max.z]:void 0,h={};for(var p in d.attributes){var y=d.attributes[p];y instanceof THREE__namespace.InterleavedBufferAttribute?(h[p]={array:y.data.array,stride:y.data.stride,offset:y.offset},u=y.data.array,u&&u.buffer instanceof ArrayBuffer&&s.add(u.buffer)):(h[p]={array:y.array},u=y.array,u&&u.buffer instanceof ArrayBuffer&&s.add(u.buffer))}var m=void 0,g=d.getIndex();g&&(g instanceof THREE__namespace.InterleavedBufferAttribute?(m={array:g.data.array,stride:g.data.stride,offset:g.offset},u=g.data.array,u&&u.buffer instanceof ArrayBuffer&&s.add(u.buffer)):(m={array:g.array},u=g.array,u&&u.buffer instanceof ArrayBuffer&&s.add(u.buffer)));var E={type:f,attributes:h,indices:m,maxItemPerNode:e,maxTreeDepth:r,extents:A};o.push(E)}}}return bvhWorkerPool.postMessage(o,Array.from(s))}).then(function(o){for(var s=0;s<i.length;s++){var u=i[s],c=u.geometry,l=o[s];if(c instanceof THREE__namespace.BufferGeometry){for(var d in l.attributes){var f=l.attributes[d].array,v=c.attributes[d];v instanceof THREE__namespace.InterleavedBufferAttribute?v.data.array=f:v.array=f}var A=c.getIndex();if(A&&l.indices){var f=l.indices.array;A instanceof THREE__namespace.InterleavedBufferAttribute?A.data.array=f:A.array=f}if(u instanceof THREE__namespace.Mesh){var h=new BVHMesh(l.attributes.position,l.indices);h.offsetArray=l.offsetArray,h.rootNodePacked=l.rootNodePacked,bindBvhTreeForMesh(u,h)}else if(u instanceof THREE__namespace.Points){var h=new BVHPoints(l.attributes.position,l.indices);h.offsetArray=l.offsetArray,h.rootNodePacked=l.rootNodePacked,bindBvhTreeForPoints(u,h)}}}return n})}new THREE__namespace.Vector3,new THREE__namespace.Vector3,new THREE__namespace.Vector3;var TileNode=function(n){__extends(t,n);function t(e,r){r===void 0&&(r=noop$1);var i=n.call(this)||this;return i.contentObject=e,i.disposer=r,i.disposers=[r],i.add(e),i}return t.prototype.generateBvhTree=function(){return generateBvhTree(this,!0,200,10)},t.prototype.intersectRaycaster=function(e,r,i){r===void 0&&(r=!0),i===void 0&&(i=[]);for(var o=this.children.slice(),s,u=[];s=o.pop();)if(s.visible){s.raycast(e,u);for(var c=0,l=s.children.length;c<l;c++)o.push(s.children[c])}return u.forEach(function(d){var f=0;if((d.object instanceof PBMMesh||d.object instanceof PBMPointCloud)&&d.face){var v=Array.isArray(d.object.material)?d.object.material[d.face.materialIndex]:d.object.material;v&&(f=v.floor)}d.floor=f}),r&&u.sort(function(d,f){return d.distance-f.distance}),i.push.apply(i,u),i},t.prototype.dispose=function(){for(var e=0,r=this.disposers;e<r.length;e++){var i=r[e];i()}this.disposers.length=0},t.prototype.clone=function(){return new t(this.contentObject,this.disposer)},t}(THREE__namespace.Group);function pathJoin(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];var e=[];n=n.map(function(u){return(u!=null?u:"").trim()}).filter(function(u){return u.length>0&&!/^\/+$/.test(u)});for(var r=0;r<n.length;r++){var i=r===0,o=r===n.length-1,s=n[r];i||(s=s.replace(/^\.\//,"").replace(/^\/+/,"")),o||(s=s.replace(/\/+$/,"")),e.push(s)}return e.join("/")}function normalizeURL(n){var t,e=/^(http\:|https\:|file\:)?\/\/[^/]/.exec(n);if(!e)return n;var r=e[1]||"",i=n.slice(r.length+2),o=i.indexOf("#");o>=0&&(n.slice(o),i=n.slice(0,o));var s=i.indexOf("?");s>=0&&(n.slice(s),i=n.slice(0,s));for(var u=i.split("/"),c=u.shift(),l=(t=u.pop())!==null&&t!==void 0?t:"",d=[],f=0,v=u;f<v.length;f++){var A=v[f];if(!(A===""||A===".")){if(A===".."){d.pop();continue}d.push(A)}}return r+"//"+c+"/"+d.join("/")+"/"+l}function isAbsoluteURL(n){return n.indexOf("//")===0||/^[0-9a-z]+\:/i.test(n)}function normalizeTileHeader(n,t,e){if(n.content&&n.content.uri&&(isAbsoluteURL(n.content.uri)||(n.content.uri=normalizeURL(pathJoin(t,n.content.uri)))),n.transform){for(var r=!1,i=0;i<16;i++){var o=n.transform[i];if(typeof o!="number"||isNaN(o)||!isFinite(o)){r=!0;break}}if(n.transform[15]===0&&(r=!0),r)throw new Error("Invalid Tile Transform: "+JSON.stringify(n.transform))}if(n.children)for(var s=0,u=n.children;s<u.length;s++){var c=u[s];normalizeTileHeader(c,t)}return n}function normalizeTilesetHeader(n,t){return n.asset||(n.asset={}),n.rootMeta||(n.rootMeta={}),n.asset.overview&&(isAbsoluteURL(n.asset.overview.imageFile)||(n.asset.overview.imageFile=normalizeURL(pathJoin(t,n.asset.overview.imageFile))),isAbsoluteURL(n.asset.overview.worldFile)||(n.asset.overview.worldFile=normalizeURL(pathJoin(t,n.asset.overview.worldFile)))),normalizeTileHeader(n.root,t),n}function initTextures(n,t,e){for(var r,i,o=Promise.resolve(),s=n.slice(),u=function(){for(var c=[],l=0,d=void 0;d=s.shift();){c.push(d);var f=((r=d.image)===null||r===void 0?void 0:r.width)*((i=d.image)===null||i===void 0?void 0:i.height);if(!isNaN(f)&&isFinite(f)&&(l+=f),l>=e)break}o=o.then(function(){return new Promise(function(v){AnimationFrameLoop.shared.add(function(){for(var A=0,h=c;A<h.length;A++){var p=h[A];t.initTexture(p)}v()},!0)})}).catch(function(){})};s.length>0;)u();return o}function appendSearch(n,t){if(t===void 0&&(t=""),(t[0]==="?"||t[0]==="&")&&(t=t.slice(1)),!t)return n;var e=n.indexOf("#"),r="";return e>=0&&(r=n.slice(e),n=n.slice(0,e)),(n[n.length-1]==="?"||n[n.length-1]==="&")&&(n=n.slice(0,-1)),n.indexOf("?")>=0?"".concat(n,"&").concat(t).concat(r):"".concat(n,"?").concat(t).concat(r)}const pointCloudFragmentShader=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=113,i=126,o=0,s="";return t[o].split(s).map(function(u){return u.charCodeAt(o)>i?u:String.fromCharCode((u.charCodeAt(o)+r)%i)}).join(s)}("{vs|z-sy|n-sy||H0vs-qrsv{rq5b`RlP\\[`aN[alP\\Y\\_6--{vs|z-rp@-p|{n{P|y|H0r{qvs0vs-qrsv{rq5b`Rl]\\V[al[\\_ZNY6--n\bv{t-rp@-[|znyH0r{qvs0vs-qrsv{rq5b`RlRQY6--n\bv{t-sy|n-Y|tQr}uH0r{qvsp-Pyv}}r-\n--znA-znv\x07V{rrH--sy|n-sy||V{qr\x07H\fH0vs-[bZlPYV]]R_`-K-=--{vs|z-Pyv}}r-pyv}}rh[bZlPYV]]R_`jH0r{qvsn\bv{t-rpA-d|yq]|vv|{Hn\bv{t-rp@-PnzrnQvrpv|{Hn\bv{t-rp@-P|y|Hn\bv{t-sy|n-]|v{`v rH{vs|z-sy|n-|}npv\bH{vs|z-sy|n-z|qryNy}unH{vs|z-sy|n-u|{Sy||V{qr\x07H0v{pyqr-Ip|zz|{K0v{pyqr-Is|tl}nlsntzr{K0v{pyqr-Iy|tqr}uosl}nlsntzr{K0v{pyqr-Ipyv}}v{tl}yn{rl}nlsntzr{K|vq-znv{56-\n--<<-JJJ-前置裁切计算-JJJ--0vs-[bZlPYV]]R_`-K-=----o||y-pyv}}rqH----rpA-pyv}}r]|vv|{H----0}ntzn-{|yyly||}ln----s|-5-v{-v-J-=H-v-I-[bZlPYV]]R_`H-v-88-6-\n------pyv}}r]|vv|{-J-pyv}}rh-v-j;znv\x07V{rr-7-d|yq]|vv|{H------pyv}}rq-J-5pyv}}rh-v-j;sy||V{qr\x07-I-=;=-\v\v-no5sy||-:-pyv}}rh-v-j;sy||V{qr\x076-I->;=6H------pyv}}rq-J-pyv}}rq-33-pyv}}r]|vv|{;\x07-K-:=;B-33-pyv}}r]|vv|{;\x07-I-=;BH------pyv}}rq-J-pyv}}rq-33-pyv}}r]|vv|{;\b-K-:=;B-33-pyv}}r]|vv|{;\b-I-=;BH------pyv}}rq-J-pyv}}rq-33-pyv}}r]|vv|{; -K-:=;B-33-pyv}}r]|vv|{; -I-=;BH------vs-5pyv}}rq6-\n--------qvpnqH------\f----\f----0}ntzn-{|yyly||}lr{q--0r{qvs--<<-JJJJJJJJJJJJJJJJ--<<-JJJ-形状裁切-JJJ--0vs-qrsv{rq5b`Rl]\\V[al`UN]RlPV_PYR6----sy|n--J-?;=-7-tyl]|v{P||q;\x07-:->;=H----sy|n--J-?;=-7-tyl]|v{P||q;\b-:->;=H----sy|n-pp-J-7-8-7H----vs-5]|v{`v r-K-E;=-33-pp-K->;=6-\n------qvpnqH----\f--0r{qvs--<<-JJJJJJJJJJJJJ--0v{pyqr-Iy|tqr}uoslsntzr{K--<<-JJJ-颜色-JJJ--rpA-sv{nyP|y|-J-_TOa|Yv{rn5rpA5P|y|9-|}npv\b66H--0vs-qrsv{rq5b`Rl]\\V[al[\\_ZNY6----0vs-qrsv{rq5b`Rl]\\V[alONPXlUVQQR[6------rp@-pnzrnQvrpv|{-J-{|znyv r5pnzrn]|vv|{-:-d|yq]|vv|{;\x07\b 6H------vs-5q|5pnzrnQvrpv|{9-[|zny6-I-=;=6-\n--------qvpnqH------\f----0ryvs-qrsv{rq5b`Rl]\\V[alONPXlQN_X6------rp@-pnzrnQvrpv|{-J-{|znyv r5pnzrn]|vv|{-:-d|yq]|vv|{;\x07\b 6H------vs-5q|5pnzrnQvrpv|{9-[|zny6-I-=;=6-\n--------sv{nyP|y|;\x07\b -J-sv{nyP|y|;\x07\b -7-=;EH------\f----0r{qvs--0r{qvs--tylSntP|y|-J-sv{nyP|y|H--<<-JJJJJJJJJJJ--<<-JJJ-纯色-JJJ--0vs-qrsv{rq5b`RlP\\[`aN[alP\\Y\\_6----tylSntP|y|-J-rpA5p|{n{P|y|;9-p|{n{P|y|;t9-p|{n{P|y|;o9-|}npv\b6H--0r{qvs--<<-JJJJJJJJJJJ--<<-JJJ-楼层显示-JJJ--sy|n-sy||\\}npv\b-J->;=H--vs-5u|{Sy||V{qr\x07-K-:=;=>-33-no5sy||-:-u|{Sy||V{qr\x076-K-=;FF6-\n----sy||\\}npv\b-J-=;>-7-zv{55>;=-8-PnzrnQvrpv|{;\b69->;=6H--\f--tylSntP|y|;n-J-tylSntP|y|;n-7-sy||\\}npv\bH--<<-JJJJJJJJJJJJJJ--tylSntP|y|;n-J-tylSntP|y|;n-7-z|qryNy}unH--0v{pyqr-I|{rzn}}v{tlsntzr{K--0v{pyqr-Ir{p|qv{tlsntzr{K--0v{pyqr-Is|tlsntzr{K--0v{pyqr-I}rzyv}yvrqlny}unlsntzr{K--0vs-qrsv{rq5b`RlRQY6----tylSntP|y|;n-J-Y|tQr}uH--0r{qvs--0vs-qrsv{rq5b`RlU^ldRVTUa6----sy|n-qvn{pr-J-?;=-7-yr{tu5tyl]|v{P||q;\x07\b-:-=;B6H----sy|n-rvtu-J-zn\x075=;=9->;=-:-qvn{pr6H----rvtu-J-}|5rvtu9->;B6H----tylSntP|y|;n-J-rvtuH----tylSntP|y|;\x07\b -J-tylSntP|y|;\x07\b -7-rvtuH--0r{qvs\f"),pointCloudVertexShader=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=113,i=126,o=0,s="";return t[o].split(s).map(function(u){return u.charCodeAt(o)>i?u:String.fromCharCode((u.charCodeAt(o)+r)%i)}).join(s)}("nvor-rp@-p|y|H0vs-qrsv{rq5b`Rl]\\V[alP\\Y\\_lNYaVabQR6--{vs|z-nz}yr?Q-tnqvr{ar\x07rH0r{qvs{vs|z-sy|n-sy||H0vs-qrsv{rq5b`RlRQY6--n\bv{t-sy|n-Y|tQr}uH0r{qvs{vs|z-rp?-r|yv|{H{vs|z-sy|n-}v\x07ry_nv|H{vs|z-sy|n-}|v{`pnyrH{vs|z-sy|n-}|v{Zv{]v\x07ryH{vs|z-sy|n-}|v{Zn\x07]v\x07ryH{vs|z-sy|n-|}npv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>;=66H--<<传递nvor的p|y|到s里使用--<<动态调整}|v{`v r--sy|n-rny]|v{`v r-J-}|v{`pnyr-7-}v\x07ry_nv|H--0vs-qrsv{rq5b`Rl]\\V[al`VgRlTR\\ZRa_VP6----rny]|v{`v r-7J-tr|zrvpR|H----sy|n-urvtu-J->;=-<-}|wrpv|{Znv\x07h>jh>j-7-zv\x075>;=9-:z]|vv|{; 9-:}|wrpv|{Znv\x07h?jh@j6-7-?;=H----rny]|v{`v r-J-r|yv|{;\b-7-rny]|v{`v r-<-urvtuH--0ryvs-qrsv{rq5b`Rl]\\V[al`VgRlNaaR[bNaV\\[6----sy|n-urvtu-J->;=-<-}|wrpv|{Znv\x07h>jh>j-7-zv\x075>;=9-:z]|vv|{; 9-:}|wrpv|{Znv\x07h?jh@j6-7-?;=H----rny]|v{`v r-J-r|yv|{;\b-7-rny]|v{`v r-<-urvtuH--0r{qvs--tyl]|v{`v r-J-pynz}5rny]|v{`v r9-}|v{Zv{]v\x07ry-7-}v\x07ry_nv|9-}|v{Zn\x07]v\x07ry-7-}v\x07ry_nv|6H--]|v{`v r-J-tyl]|v{`v rH--0vs-qrsv{rq5b`Rl]\\V[alP\\Y\\_lNYaVabQR6----P|y|-J-trP|y|O\bUrvtu5tnqvr{ar\x07r9-d|yq]|vv|{6H--0ryr----P|y|-J-p|y|H--0r{qvs--0vs-qrsv{rq5b`Rl]\\V[al[\\_ZNY6----[|zny-J-{|znyv r5zn@5z|qryZnv\x076-7-{|zny6H--0r{qvs--0vs-qrsv{rq5b`RlRQY6----Y|tQr}u-J-y|t?5:z]|vv|{; 6H--0r{qvs--0vs-qrsv{rq5b`RlU^lQR]aU6----<<-sy|n-}|wSnp|-J-:=;B-7-r|yv|{;\b-<-5n{5s|-<-?;=6-7-z]|vv|{; 6H----<<-sy|n-_nqv-J-rny]|v{`v r-<-}|wSnp|H----sy|n-|vtv{nyQr}u-J-tyl]|vv|{;H----sy|n-nqwrqQr}u-J-|vtv{nyQr}u-8-=;>H----sy|n-nqw-J-nqwrqQr}u-<-|vtv{nyQr}uH----z]|vv|{;\x07\b -J-z]|vv|{;\x07\b -7-nqwH----tyl]|vv|{-J-}|wrpv|{Znv\x07-7-z]|vv|{H--0r{qvs--0v{pyqr-I|yq}|lrr\x07K--0v{pyqr-Is|tlrr\x07K\f");var scratchVector4=new THREE__namespace.Vector4,shaderUniforms=Object.assign({pointScale:new THREE__namespace.Uniform(1),pointMinPixel:new THREE__namespace.Uniform(1),pointMaxPixel:new THREE__namespace.Uniform(1),opacity:new THREE__namespace.Uniform(1),gradientTexture:new THREE__namespace.Uniform(null),modelAlpha:new THREE__namespace.Uniform(0),clippers:new THREE__namespace.Uniform([]),shownFloorIndex:new THREE__namespace.Uniform(-1),constantColor:new THREE__namespace.Uniform(null),geometricError:new THREE__namespace.Uniform(0),pixelRatio:new THREE__namespace.Uniform(1),resolution:new THREE__namespace.Uniform(new THREE__namespace.Vector2(512,512)),floor:new THREE__namespace.Uniform(0),brightness:new THREE__namespace.Uniform(1),modelBoundingMin:new THREE__namespace.Uniform(new THREE__namespace.Vector3),modelBoundingMax:new THREE__namespace.Uniform(new THREE__namespace.Vector3)},THREE__namespace.UniformsUtils.clone(THREE__namespace.UniformsLib.fog)),PBMPointCloudMaterial=function(n){__extends(t,n);function t(e){e===void 0&&(e={});var r,i,o,s,u,c,l,d,f,v,A,h,p,y,m,g,E,b,T,_,S,R=n.call(this,{vertexShader:pointCloudVertexShader,fragmentShader:pointCloudFragmentShader,uniforms:THREE__namespace.UniformsUtils.clone(shaderUniforms),lights:!1,defines:{USE_CONSTANT_COLOR:!1,USE_EDL:!1,USE_HQ_WEIGHT:!1,USE_HQ_DEPTH:!1,NUM_CLIPPING_BOX:!1,USE_CLIPFLOOR:!1,USE_VERTEX_MARK:!1,USE_MAP:!0,USE_UV:!0,USE_LUMINANCE:!1,USE_PANO_OPACITY:!1,USE_BLACK_TRANSITION:!1,USE_POINT_NORMAL:!1,USE_POINT_SHAPE_CIRCLE:!1,USE_POINT_SIZE_ATTENUATION:!1,USE_POINT_SIZE_GEOMETRIC:!1,USE_POINT_BACK_HIDDEN:!1,USE_POINT_BACK_DARK:!1}})||this,B;return Object.defineProperties(R,{constantColor:{get:function(){return this.uniforms.constantColor.value},set:function(I){this.uniforms.constantColor.value=I;var x=this.defines.USE_CONSTANT_COLOR,M=I!==null;x!==M&&(this.defines.USE_CONSTANT_COLOR=M,this.needsUpdate=!0)}},opacity:{get:function(){return this.uniforms.opacity.value},set:function(I){this.uniforms.opacity.value=I}},modelAlpha:{get:function(){return this.uniforms.modelAlpha.value},set:function(I){this.uniforms.modelAlpha.value=I}},shownFloorIndex:{get:function(){return this.uniforms.shownFloorIndex.value},set:function(I){this.uniforms.shownFloorIndex.value=I}},clippers:{get:function(){return B},set:function(I){B!==I&&(B=I,this.uniforms.clippers.value=(B||[]).map(function(x){var M=typeof x.floorIndex=="number"?x.floorIndex:-1,L=new THREE__namespace.Matrix4().getInverse(x.clippingBoxMatrix);return{matrixInverse:L,floorIndex:M}}),this.needsUpdate=!0)}},pointColor:{get:function(){return this.defines.USE_POINT_COLOR_ALTITUDE===!0?"ALTITUDE":"RGB"},set:function(I){var x=I==="ALTITUDE";this.defines.USE_POINT_COLOR_ALTITUDE!==x&&(this.defines.USE_POINT_COLOR_ALTITUDE=x,this.needsUpdate=!0)}},pointSize:{get:function(){return this.defines.USE_POINT_SIZE_GEOMETRIC===!0?"GEOMETRIC":this.defines.USE_POINT_SIZE_ATTENUATION===!0?"ATTENUATION":"FIXED"},set:function(I){var x=I==="ATTENUATION",M=I==="GEOMETRIC";this.defines.USE_POINT_SIZE_GEOMETRIC!==M&&(this.defines.USE_POINT_SIZE_GEOMETRIC=M,this.needsUpdate=!0),this.defines.USE_POINT_SIZE_ATTENUATION!==x&&(this.defines.USE_POINT_SIZE_ATTENUATION=x,this.needsUpdate=!0)}},pointShape:{get:function(){return this.defines.USE_POINT_SHAPE_CIRCLE===!0?"CIRCLE":"SQUARE"},set:function(I){var x=I==="CIRCLE";this.defines.USE_POINT_SHAPE_CIRCLE!==x&&(this.defines.USE_POINT_SHAPE_CIRCLE=x,this.needsUpdate=!0)}},pointScale:{get:function(){return this.uniforms.pointScale.value},set:function(I){this.uniforms.pointScale.value=I}},pointBack:{get:function(){return this.defines.USE_POINT_BACK_HIDDEN===!0?"HIDDEN":this.defines.USE_POINT_BACK_DARK===!0?"DARK":"VISIBLE"},set:function(I){var x=I==="HIDDEN",M=I==="DARK";this.defines.USE_POINT_BACK_HIDDEN!==x&&(this.defines.USE_POINT_BACK_HIDDEN=x,this.needsUpdate=!0),this.defines.USE_POINT_BACK_DARK!==M&&(this.defines.USE_POINT_BACK_DARK=M,this.needsUpdate=!0)}},pointMinPixel:{get:function(){return this.uniforms.pointMinPixel.value},set:function(I){this.uniforms.pointMinPixel.value=I}},pointMaxPixel:{get:function(){return this.uniforms.pointMaxPixel.value},set:function(I){this.uniforms.pointMaxPixel.value=I}},useEDL:{get:function(){return this.defines.USE_EDL},set:function(I){I!==this.defines.USE_EDL&&(this.defines.USE_EDL=I,this.needsUpdate=!0)}},useHQWeight:{get:function(){return this.defines.USE_HQ_WEIGHT},set:function(I){I!==this.defines.USE_HQ_WEIGHT&&(this.defines.USE_HQ_WEIGHT=I,this.needsUpdate=!0)}},useHQDepth:{get:function(){return this.defines.USE_HQ_DEPTH},set:function(I){I!==this.defines.USE_HQ_DEPTH&&(this.defines.USE_HQ_DEPTH=I,this.needsUpdate=!0)}},gradientTexture:{get:function(){return this.uniforms.gradientTexture.value},set:function(I){this.uniforms.gradientTexture.value=I}},floor:{get:function(){return this.uniforms.floor.value},set:function(I){this.uniforms.floor.value=I}},brightness:{get:function(){return this.uniforms.brightness.value},set:function(I){this.uniforms.brightness.value=I}}}),R.pano0=(r=e.pano0)!==null&&r!==void 0?r:defaultPbmParameters.pano0,R.pano1=(i=e.pano1)!==null&&i!==void 0?i:defaultPbmParameters.pano1,R.modelAlpha=(o=e.modelAlpha)!==null&&o!==void 0?o:defaultPbmParameters.modelAlpha,R.progress=(s=e.progress)!==null&&s!==void 0?s:defaultPbmParameters.progress,R.transition=(u=e.transition)!==null&&u!==void 0?u:defaultPbmParameters.transition,R.constantColor=(c=e.constantColor)!==null&&c!==void 0?c:defaultPbmParameters.constantColor,R.opacity=(l=e.opacity)!==null&&l!==void 0?l:defaultPbmParameters.opacity,R.shownFloorIndex=(d=e.shownFloorIndex)!==null&&d!==void 0?d:defaultPbmParameters.shownFloorIndex,R.clippers=(f=e.clippers)!==null&&f!==void 0?f:defaultPbmParameters.clippers,R.useEDL=(v=e.useEDL)!==null&&v!==void 0?v:defaultPbmParameters.useEDL,R.useHQWeight=(A=e.useHQWeight)!==null&&A!==void 0?A:defaultPbmParameters.useHQWeight,R.useHQDepth=(h=e.useHQDepth)!==null&&h!==void 0?h:defaultPbmParameters.useHQDepth,R.pointColor=(p=e.pointColor)!==null&&p!==void 0?p:defaultPbmParameters.pointColor,R.pointShape=(y=e.pointShape)!==null&&y!==void 0?y:defaultPbmParameters.pointShape,R.pointSize=(m=e.pointSize)!==null&&m!==void 0?m:defaultPbmParameters.pointSize,R.pointScale=(g=e.pointScale)!==null&&g!==void 0?g:defaultPbmParameters.pointScale,R.pointBack=(E=e.pointBack)!==null&&E!==void 0?E:defaultPbmParameters.pointBack,R.pointMinPixel=(b=e.pointMinPixel)!==null&&b!==void 0?b:defaultPbmParameters.pointMinPixel,R.pointMaxPixel=(T=e.pointMaxPixel)!==null&&T!==void 0?T:defaultPbmParameters.pointMaxPixel,R.gradientTexture=(_=e.gradientTexture)!==null&&_!==void 0?_:defaultPbmParameters.gradientTexture,R.brightness=(S=e.brightness)!==null&&S!==void 0?S:defaultPbmParameters.brightness,R.floor=0,R.transparent=!0,R}return t.prototype.onBeforeCompile=function(e,r){var i,o,s=String((o=(i=this.clippers)===null||i===void 0?void 0:i.length)!==null&&o!==void 0?o:0);e.vertexShader=e.vertexShader.replace(/NUM_CLIPPERS/g,s),e.fragmentShader=e.fragmentShader.replace(/NUM_CLIPPERS/g,s)},t.prototype.update=function(e,r){if(r instanceof Camera)this.uniforms.pixelRatio.value=r.pixelRatio,this.uniforms.resolution.value.copy(r.resolution);else{this.uniforms.pixelRatio.value=e.getPixelRatio();var i=e.getViewport(scratchVector4);this.uniforms.resolution.value.set(i.z,i.w)}this.transparent=!1,this.shownFloorIndex>-1&&(this.transparent=this.shownFloorIndex!==this.floor),this.modelAlpha<1&&(this.transparent=!0),this.opacity<1&&(this.transparent=!0),this.brightness<1&&(this.transparent=!0),this.depthWrite=!0,this.depthTest=!0,this.useEDL&&(this.transparent=!1),this.useHQWeight?(this.depthWrite=!1,this.blending=THREE__namespace.CustomBlending,this.blendSrc=THREE__namespace.SrcAlphaFactor,this.blendSrcAlpha=THREE__namespace.SrcAlphaFactor,this.blendDst=THREE__namespace.OneFactor,this.blendDstAlpha=THREE__namespace.OneFactor):(this.blending=THREE__namespace.NormalBlending,this.blendDst=THREE__namespace.OneMinusSrcAlphaFactor,this.blendEquation=THREE__namespace.AddEquation,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null)},t.prototype.syncModel=function(e){var r="".concat(e.id,":").concat(e.materialVersion);r!==this.syncModelVersion&&(Object.assign(this,e.getMaterial()),this.uniforms.modelBoundingMax.value.copy(e.bounding.max),this.uniforms.modelBoundingMin.value.copy(e.bounding.min),this.syncModelVersion=r)},t.prototype.copy=function(e){return n.prototype.copy.call(this,this),this.pano0=e.pano0,this.pano1=e.pano1,this.progress=e.progress,this.transition=e.transition,this.shownFloorIndex=e.shownFloorIndex,this.brightness=e.brightness,this.clippers=e.clippers,this.constantColor=e.constantColor,this.modelAlpha=e.modelAlpha,this.useEDL=e.useEDL,this.useHQWeight=e.useHQWeight,this.useHQDepth=e.useHQDepth,this.pointColor=e.pointColor,this.pointSize=e.pointSize,this.pointShape=e.pointShape,this.pointScale=e.pointScale,this.pointBack=e.pointBack,this.pointMinPixel=e.pointMinPixel,this.pointMaxPixel=e.pointMaxPixel,this.gradientTexture=e.gradientTexture,this},t}(THREE__namespace.ShaderMaterial),SIZEOF_UINT32$1=4;function parseHeader(n,t,e){var r=new DataView(t);if(n.magic=r.getUint32(e,!0),e+=SIZEOF_UINT32$1,n.version=r.getUint32(e,!0),e+=SIZEOF_UINT32$1,n.byteLength=r.getUint32(e,!0),e+=SIZEOF_UINT32$1,n.version!==1)throw new Error("3D Tile Version ".concat(n.version," not supported"));return e}var _a$3,GL_TYPE;(function(n){n[n.BYTE=5120]="BYTE",n[n.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",n[n.SHORT=5122]="SHORT",n[n.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",n[n.INT=5124]="INT",n[n.UNSIGNED_INT=5125]="UNSIGNED_INT",n[n.FLOAT=5126]="FLOAT",n[n.DOUBLE=5130]="DOUBLE"})(GL_TYPE||(GL_TYPE={}));var GL_TYPE_TO_ARRAY_TYPE=(_a$3={},_a$3[GL_TYPE.DOUBLE]=Float64Array,_a$3[GL_TYPE.FLOAT]=Float32Array,_a$3[GL_TYPE.UNSIGNED_SHORT]=Uint16Array,_a$3[GL_TYPE.UNSIGNED_INT]=Uint32Array,_a$3[GL_TYPE.UNSIGNED_BYTE]=Uint8Array,_a$3[GL_TYPE.BYTE]=Int8Array,_a$3[GL_TYPE.SHORT]=Int16Array,_a$3[GL_TYPE.INT]=Int32Array,_a$3),NAME_TO_GL_TYPE={DOUBLE:GL_TYPE.DOUBLE,FLOAT:GL_TYPE.FLOAT,UNSIGNED_SHORT:GL_TYPE.UNSIGNED_SHORT,UNSIGNED_INT:GL_TYPE.UNSIGNED_INT,UNSIGNED_BYTE:GL_TYPE.UNSIGNED_BYTE,BYTE:GL_TYPE.BYTE,SHORT:GL_TYPE.SHORT,INT:GL_TYPE.INT};function getArrayType(n){var t=GL_TYPE_TO_ARRAY_TYPE[n];if(!t)throw new Error("Failed to convert GL type");return t}function getByteSize(n){var t=getArrayType(n);return t.BYTES_PER_ELEMENT}function createTypedArray(n,t,e,r){e===void 0&&(e=0);var i=getArrayType(n);if(e%getByteSize(n)!==0){var o=r?t.slice(e,e+r*getByteSize(n)):t.slice(e);return new i(o)}else return new i(t,e,r!=null?r:(t.byteLength-e)/getByteSize(n))}function glTypeFromName(n){var t=NAME_TO_GL_TYPE[n];if(!t)throw new Error("Failed to convert GL type");return t}var FeatureTable=function(){function n(t,e){this.featuresLength=0,this.cachedTypedArrays={},this.json=t,this.buffer=e;var r=this.getGlobalProperty("POINTS_LENGTH",GL_TYPE.UNSIGNED_INT,1);r&&r.length&&(this.featuresLength=r[0])}return n.prototype.getExtension=function(t){return this.json.extensions&&this.json.extensions[t]},n.prototype.hasProperty=function(t){return!!this.json[t]},n.prototype.getGlobalProperty=function(t,e,r){var i=this.json[t];if(typeof i=="number"){var o=getArrayType(e);return new o([i])}else if(Array.isArray(i)){var o=getArrayType(e);return new o(i)}else if(i&&Number.isFinite(i.byteOffset))return this.getTypedArrayFromBinary(t,e,r,1,i.byteOffset);return null},n.prototype.getPropertyArray=function(t,e,r){var i=this.json[t];return i&&Number.isFinite(i.byteOffset)?("componentType"in i&&(e=glTypeFromName(i.componentType)),this.getTypedArrayFromBinary(t,e,r,this.featuresLength,i.byteOffset)):this.getTypedArrayFromArray(t,e,i)},n.prototype.getProperty=function(t,e,r,i,o){var s=this.json[t];if(!s)return null;var u=this.getPropertyArray(t,e,r);if(r===1)return o[0]=u[i],o;for(var c=0;c<r;++c)o[c]=u[r*i+c];return o},n.prototype.getTypedArrayFromBinary=function(t,e,r,i,o){var s=this.cachedTypedArrays,u=s[t];return u||(u=createTypedArray(e,this.buffer.buffer,this.buffer.byteOffset+o,i*r),s[t]=u),u},n.prototype.getTypedArrayFromArray=function(t,e,r){var i=this.cachedTypedArrays,o=i[t];return o||(o=createTypedArray(e,r),i[t]=o),o},n}(),SIZEOF_UINT32=4,DEPRECATION_WARNING="b3dm tile in legacy format.";function getStringFromArrayBuffer(n,t,e){var r=new TextDecoder("utf8"),i=new Uint8Array(n,t,e),o=r.decode(i);return o}function parseTable(n,t,e){return e=parseTablesHeader(n,t,e),e=parseFeatureTable(n,t,e),e=parseBatchTable(n,t,e),e}function parseTablesHeader(n,t,e){var r=new DataView(t),i=0;n.header=n.header||{};var o=r.getUint32(e,!0);e+=SIZEOF_UINT32;var s=r.getUint32(e,!0);e+=SIZEOF_UINT32;var u=r.getUint32(e,!0);e+=SIZEOF_UINT32;var c=r.getUint32(e,!0);return e+=SIZEOF_UINT32,u>=570425344?(e-=SIZEOF_UINT32*2,i=o,u=s,c=0,o=0,s=0,console.warn(DEPRECATION_WARNING)):c>=570425344&&(e-=SIZEOF_UINT32,i=u,u=o,c=s,o=0,s=0,console.warn(DEPRECATION_WARNING)),n.header.featureTableJsonByteLength=o,n.header.featureTableBinaryByteLength=s,n.header.batchTableJsonByteLength=u,n.header.batchTableBinaryByteLength=c,n.header.batchLength=i,e}function parseFeatureTable(n,t,e){var r=n.header||{},i=r.featureTableJsonByteLength,o=r.featureTableBinaryByteLength,s=r.batchLength;if(n.featureTableJson={BATCH_LENGTH:s||0},i&&i>0){var u=getStringFromArrayBuffer(t,e,i);n.featureTableJson=JSON.parse(u)}e+=i||0,n.featureTableBinary=new Uint8Array(t,e,o),e+=o||0,n.rtcCenter=[0,0,0];var c=new FeatureTable(n.featureTableJson,n.featureTableBinary);if(Array.isArray(c.json.RTC_CENTER)){var l=c.json.RTC_CENTER;n.rtcCenter[0]=l[0],n.rtcCenter[1]=l[1],n.rtcCenter[2]=l[2]}else{var l=c.getGlobalProperty("RTC_CENTER",GL_TYPE.FLOAT,3);l&&(n.rtcCenter[0]=l[0],n.rtcCenter[1]=l[1],n.rtcCenter[2]=l[2])}return e}function parseBatchTable(n,t,e){var r=n.header||{},i=r.batchTableJsonByteLength,o=r.batchTableBinaryByteLength;if(i&&i>0){var s=getStringFromArrayBuffer(t,e,i);n.batchTableJson=JSON.parse(s),e+=i,o&&o>0&&(n.batchTableBinary=new Uint8Array(t,e,o),n.batchTableBinary=new Uint8Array(n.batchTableBinary),e+=o)}return e}function sliceArrayBuffer(n,t,e){var r=e!==void 0?new Uint8Array(n).subarray(t,t+e):new Uint8Array(n).subarray(t),i=new Uint8Array(r);return i.buffer}function parseGlTFArrayBuffer(n,t,e){var r=n.byteLength-e;if(r===0)throw new Error("glTF byte length must be greater than 0.");return e%4!==0&&console.warn("".concat(n.type,": embedded glb is not aligned to a 4-byte boundary.")),n.gltfArrayBuffer=sliceArrayBuffer(t,e,r),n.byteLength}function decodeText(n){if(typeof TextDecoder!="undefined")return new TextDecoder().decode(n);for(var t="",e=0,r=n.length;e<r;e++)t+=String.fromCharCode(n[e]);try{return decodeURIComponent(escape(t))}catch(i){return t}}var WEBGL_CONSTANTS={FLOAT:5126,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,LINEAR:9729,REPEAT:10497,SAMPLER_2D:35678,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123},WEBGL_COMPONENT_TYPES={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},WEBGL_FILTERS={9728:THREE__namespace.NearestFilter,9729:THREE__namespace.LinearFilter,9984:THREE__namespace.NearestMipmapNearestFilter,9985:THREE__namespace.LinearMipmapNearestFilter,9986:THREE__namespace.NearestMipmapLinearFilter,9987:THREE__namespace.LinearMipmapLinearFilter},WEBGL_WRAPPINGS={33071:THREE__namespace.ClampToEdgeWrapping,33648:THREE__namespace.MirroredRepeatWrapping,10497:THREE__namespace.RepeatWrapping},WEBGL_TYPE_SIZES={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},ATTRIBUTES={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv2",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},PATH_PROPERTIES={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},INTERPOLATION={CUBICSPLINE:void 0,LINEAR:THREE__namespace.InterpolateLinear,STEP:THREE__namespace.InterpolateDiscrete},ALPHA_MODES={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function values(n){var t=[];for(var e in n)t.push(n[e]);return t}function composeDsiposeSet(n){var t=Array.from(n);return function(){for(var e=0,r=t;e<r.length;e++){var i=r[e];typeof i.dispose=="function"&&i.dispose(),typeof i.close=="function"&&i.close()}}}var Parser=function(){function n(t,e,r){this.json=t,this.extensions=e,this.options=r,this.cache=new Map,this.disposeSet=new Set,this.textureSet=new Set,this.nodeNamesUsed={}}return n.prototype.dispose=function(){this.cache.clear(),this.disposeSet.forEach(function(t){typeof t.dispose=="function"&&t.dispose(),typeof t.close=="function"&&t.close()}),this.disposeSet.clear(),this.textureSet.clear(),this.extensions={},this.json={asset:{version:"unknown"}}},n.prototype.markDefs=function(){for(var t=this.json.nodes||[],e=this.json.skins||[],r=this.json.meshes||[],i=0,o=e.length;i<o;i++)for(var s=e[i].joints,u=0,c=s.length;u<c;u++)t[s[u]].isBone=!0;for(var l=0,d=t.length;l<d;l++){var f=t[l];f.mesh!==void 0&&f.skin!==void 0&&(r[f.mesh].isSkinnedMesh=!0)}},n.prototype.parse=function(){var t=this,e=this.json,r=this.extensions;this.markDefs();for(var i=0,o=values(r);i<o.length;i++){var s=o[i];s.markDefs(this)}return Promise.all(values(r).map(function(u){return u.prepare(t)})).then(function(){var u,c,l;return Promise.all([Promise.all(((u=e.scenes)!==null&&u!==void 0?u:[]).map(function(d,f){return t.loadScene(f)})),Promise.all(((c=e.animations)!==null&&c!==void 0?c:[]).map(function(d,f){return t.loadAnimation(f)})),Promise.all(((l=e.cameras)!==null&&l!==void 0?l:[]).map(function(d,f){return t.loadCamera(f)}))])}).then(function(u){var c=u[0],l=u[1],d=u[2],f={json:e,scene:c[e.scene||0],scenes:c,animations:l,cameras:d,textures:[],dispose:noop$1};return f}).then(function(u){return Promise.all(values(r).map(function(c){return c.emitResult(u,t)})).then(function(){return u})}).then(function(u){var c=Array.from(t.textureSet),l=composeDsiposeSet(t.disposeSet);return Object.assign(u,{textures:c,dispose:l}),t.textureSet.clear(),t.disposeSet.clear(),t.dispose(),u})},n.prototype.loadCamera=function(t){var e="camera:"+t,r=this.cache.get(e);if(r)return r;for(var i=null,o=0,s=values(this.extensions);o<s.length;o++){var u=s[o];if(i=u.loadCamera(t,this),i)break}if(!i){var c=void 0,l=this.json.cameras[t],d=l[l.type];d?l.type==="perspective"?c=new THREE__namespace.PerspectiveCamera(THREE__namespace.MathUtils.radToDeg(d.yfov),d.aspectRatio||1,d.znear||1,d.zfar||2e6):l.type==="orthographic"?c=new THREE__namespace.OrthographicCamera(-d.xmag,d.xmag,d.ymag,-d.ymag,d.znear,d.zfar):(console.warn("glTF: Invalid camera type ".concat(l.type,".")),c=new THREE__namespace.Camera):(console.warn("glTF: Missing camera parameters."),c=new THREE__namespace.Camera),l.name&&(c.name=this.createUniqueName(l.name)),i=Promise.resolve(c)}return this.cache.set(e,i),i},n.prototype.loadSkin=function(t){var e="animation:"+t,r=this.cache.get(e);if(r)return r;var i,o=this.json.skins[t],s={joints:o.joints};return o.inverseBindMatrices===void 0?i=Promise.resolve(s):i=this.loadAccessor(o.inverseBindMatrices).then(function(u){return u&&(s.inverseBindMatrices=u),s}),this.cache.set(e,i),i},n.prototype.loadAnimation=function(t){var e="animation:"+t,r=this.cache.get(e);if(r)return r;for(var i=null,o=0,s=values(this.extensions);o<s.length;o++){var u=s[o];if(i=u.loadAnimation(t,this),i)break}if(!i){for(var c=this.json,l=c.animations[t],d=[],f=[],v=[],A=[],h=[],p=0,y=l.channels.length;p<y;p++){var m=l.channels[p],g=l.samplers[m.sampler],E=m.target,b=E.node!==void 0?E.node:E.id,T=l.parameters!==void 0?l.parameters[g.input]:g.input,_=l.parameters!==void 0?l.parameters[g.output]:g.output;d.push(this.loadNode(b)),f.push(this.loadAccessor(T)),v.push(this.loadAccessor(_)),A.push(g),h.push(E)}i=Promise.all([Promise.all(d),Promise.all(f),Promise.all(v),Promise.all(A),Promise.all(h)]).then(function(S){for(var R=S[0],B=S[1],I=S[2],x=S[3],M=S[4],L=[],C=function(G,Q){var U=R[G],D=B[G],q=I[G],z=x[G],K=M[G];if(U===void 0)return"continue";U.updateMatrix(),U.matrixAutoUpdate=!0;var J=void 0;switch(PATH_PROPERTIES[K.path]){case PATH_PROPERTIES.weights:J=THREE__namespace.NumberKeyframeTrack;break;case PATH_PROPERTIES.rotation:J=THREE__namespace.QuaternionKeyframeTrack;break;case PATH_PROPERTIES.position:case PATH_PROPERTIES.scale:default:J=THREE__namespace.VectorKeyframeTrack;break}var j=U.name?U.name:U.uuid,re=z.interpolation!==void 0?INTERPOLATION[z.interpolation]:THREE__namespace.InterpolateLinear,W=[];PATH_PROPERTIES[K.path]===PATH_PROPERTIES.weights?U.traverse(function(se){se.morphTargetInfluences&&W.push(se.name?se.name:se.uuid)}):W.push(j);var te=q.array;if(q.normalized){for(var $=getNormalizedComponentScale(te.constructor),ne=new Float32Array(te.length),ee=0,ce=te.length;ee<ce;ee++)ne[ee]=te[ee]*$;te=ne}for(var ee=0,ce=W.length;ee<ce;ee++){var ae=new J(W[ee]+"."+PATH_PROPERTIES[K.path],D.array,te,re);L.push(ae)}},H=0,F=R.length;H<F;H++)C(H);var O=l.name?l.name:"animation_"+t;return new THREE__namespace.AnimationClip(O,void 0,L)})}return this.cache.set(e,i),i},n.prototype.loadBuffer=function(t){var e=this.json.buffers[t];if(e.type&&e.type!=="arraybuffer")throw new Error("glTF: "+e.type+" buffer type is not supported.");var r="buffer:"+t,i=this.cache.get(r);if(i)return i;for(var o=null,s=0,u=values(this.extensions);s<u.length;s++){var c=u[s];if(o=c.loadBuffer(t,this),o)break}if(!o){var l=this.json.buffers[t];o=this.options.fetcher.ajax(this.resolveResouce(l.uri),{responseType:"arraybuffer"}).then(function(d){return d.body})}return this.cache.set(r,o),o},n.prototype.loadBufferView=function(t){var e="bufferView:"+t,r=this.cache.get(e);if(r)return r;for(var i=null,o=0,s=values(this.extensions);o<s.length;o++){var u=s[o];if(i=u.loadBufferView(t,this),i)break}if(!i){var c=this.json.bufferViews[t];i=this.loadBuffer(c.buffer).then(function(l){var d=c.byteLength||0,f=c.byteOffset||0;return l.slice(f,f+d)})}return this.cache.set(e,i),i},n.prototype.loadAccessor=function(t){var e=this,r="accessor:"+t,i=this.cache.get(r);if(i)return i;var o=null;if(!o){var s=this.json.accessors[t];if(s.bufferView===void 0&&s.sparse===void 0)o=Promise.resolve(null);else{var u=[];s.bufferView!==void 0?u.push(this.loadBufferView(s.bufferView)):u.push(Promise.resolve(null)),s.sparse!==void 0&&(u.push(this.loadBufferView(s.sparse.indices.bufferView)),u.push(this.loadBufferView(s.sparse.values.bufferView))),o=Promise.all(u).then(function(c){var l=c[0],d=WEBGL_TYPE_SIZES[s.type],f=WEBGL_COMPONENT_TYPES[s.componentType],v=f.BYTES_PER_ELEMENT,A=v*d,h=s.byteOffset||0,p=s.bufferView!==void 0?e.json.bufferViews[s.bufferView].byteStride:void 0,y=s.normalized===!0,m,g;if(p&&p!==A){var E=Math.floor(h/p),b="InterleavedBuffer:"+s.bufferView+":"+s.componentType+":"+E+":"+s.count,T=e.cache.get(b);T||(m=new f(l,E*p,s.count*p/v),T=new THREE__namespace.InterleavedBuffer(m,p/v),e.cache.set(b,T)),g=new THREE__namespace.InterleavedBufferAttribute(T,d,h%p/v,y)}else l===null?m=new f(s.count*d):m=new f(l,h,s.count*d),g=new THREE__namespace.BufferAttribute(m,d,y);if(s.sparse!==void 0){var _=WEBGL_TYPE_SIZES.SCALAR,S=WEBGL_COMPONENT_TYPES[s.sparse.indices.componentType],R=s.sparse.indices.byteOffset||0,B=s.sparse.values.byteOffset||0,I=new S(c[1],R,s.sparse.count*_),x=new f(c[2],B,s.sparse.count*d);l!==null&&(g=new THREE__namespace.BufferAttribute(g.array.slice(),g.itemSize,g.normalized));for(var M=0,L=I.length;M<L;M++){var C=I[M];if(g.setX(C,x[M*d]),d>=2&&g.setY(C,x[M*d+1]),d>=3&&g.setZ(C,x[M*d+2]),d>=4&&g.setW(C,x[M*d+3]),d>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return g})}}return this.cache.set(r,o),o},n.prototype.createPrimitiveKey=function(t){for(var e=0,r=values(this.extensions);e<r.length;e++){var i=r[e],o=i.createPrimitiveKey(t,this);if(o)return o}for(var s="",u=Object.keys(t.attributes).sort(),c=0,l=u.length;c<l;c++)s+=u[c]+":"+t.attributes[u[c]]+";";return t.indices+":"+s+":"+t.mode},n.prototype.loadGeometry=function(t){for(var e=this,r=null,i=0,o=values(this.extensions);i<o.length;i++){var s=o[i];if(r=s.loadGeometry(t,this),r)break}return r||(r=this.addGeometryPrimitiveAttributes(new THREE__namespace.BufferGeometry,t)),r=r.then(function(u){return e.disposeSet.add(u),u}),r},n.prototype.loadImage=function(t){for(var e=this,r=null,i=0,o=values(this.extensions);i<o.length;i++){var s=o[i];if(r=s.loadImage(t,this),r)break}if(!r){var u=this.json.images[t];if(u.bufferView!==void 0){var c=this.json.bufferViews[u.bufferView];r=this.loadBuffer(c.buffer).then(function(d){var f=c.byteOffset||0,v=c.byteLength||0,A=new Uint8Array(d,f,v),h=new Blob([A],{type:u.mimeType});return createImageBitmapLike(h)})}else if(u.uri){var l=this.resolveResouce(u.uri);r=this.options.fetcher.loadImage(l,{},void 0,void 0,void 0,createImageBitmapLikeImage()).then(function(d){return d.body})}else throw new Error("glTF: Invalid image defs.")}return r=r.then(function(d){return e.disposeSet.add(d),d}),r},n.prototype.loadMaterialAsMeshStandardMaterial=function(t){var e=this,r=[],i=new THREE__namespace.MeshStandardMaterial;if(i.color=new THREE__namespace.Color(1,1,1),i.opacity=1,Object.keys(t.attributes).filter(function(d){return ATTRIBUTES[d]==="color"}).length>0&&(i.vertexColors=!0),Object.keys(t.attributes).filter(function(d){return ATTRIBUTES[d]==="normal"}).length===0&&(i.flatShading=!0),Object.keys(t.attributes).filter(function(d){return ATTRIBUTES[d]==="tangent"}).length===0&&(i.normalScale&&(i.normalScale.y*=-1),i.clearcoatNormalScale&&(i.clearcoatNormalScale.y*=-1)),t.material!==void 0){var o=this.json.materials[t.material];o.name&&(i.name=o.name);var s=o.pbrMetallicRoughness||{};if(Array.isArray(s.baseColorFactor)){var u=s.baseColorFactor;i.color.fromArray(u),i.opacity=u[3]}s.baseColorTexture!==void 0&&r.push(this.createMaterialTexture(s.baseColorTexture).then(function(d){d.encoding=THREE__namespace.sRGBEncoding,i.map=d,e.disposeSet.add(d)})),i.metalness=s.metallicFactor!==void 0?s.metallicFactor:1,i.roughness=s.roughnessFactor!==void 0?s.roughnessFactor:1,s.metallicRoughnessTexture!==void 0&&r.push(this.createMaterialTexture(s.metallicRoughnessTexture).then(function(d){d.encoding=THREE__namespace.sRGBEncoding,i.metalnessMap=d,i.roughnessMap=d,e.disposeSet.add(d)})),o.doubleSided===!0&&(i.side=THREE__namespace.DoubleSide);var c=o.alphaMode||ALPHA_MODES.OPAQUE;if(c===ALPHA_MODES.BLEND?(i.transparent=!0,i.depthWrite=!1):(i.transparent=!1,c===ALPHA_MODES.MASK&&(i.alphaTest=o.alphaCutoff!==void 0?o.alphaCutoff:.5)),o.normalTexture!==void 0&&(r.push(this.createMaterialTexture(o.normalTexture).then(function(d){i.normalMap=d,e.disposeSet.add(d)})),i.normalScale=new THREE__namespace.Vector2(1,1),o.normalTexture.scale!==void 0)){var l=o.normalTexture.scale;i.normalScale.set(l,l)}o.occlusionTexture!==void 0&&(r.push(this.createMaterialTexture(o.occlusionTexture).then(function(d){i.aoMap=d,e.disposeSet.add(d)})),o.occlusionTexture.strength!==void 0&&(i.aoMapIntensity=o.occlusionTexture.strength)),o.emissiveFactor!==void 0&&(i.emissive=new THREE__namespace.Color().fromArray(o.emissiveFactor)),o.emissiveTexture!==void 0&&r.push(this.createMaterialTexture(o.emissiveTexture).then(function(d){i.emissiveMap=d,e.disposeSet.add(d)}))}return this.disposeSet.add(i),Promise.all(r).then(function(){return i})},n.prototype.loadMaterialAsLineBasicMaterial=function(t){var e=[],r=new THREE__namespace.LineBasicMaterial;if(r.color=new THREE__namespace.Color(1,1,1),r.opacity=1,Object.keys(t.attributes).filter(function(c){return ATTRIBUTES[c]==="color"}).length>0&&(r.vertexColors=!0),Object.keys(t.attributes).filter(function(c){return ATTRIBUTES[c]==="tangent"}).length===0&&(r.normalScale&&(r.normalScale.y*=-1),r.clearcoatNormalScale&&(r.clearcoatNormalScale.y*=-1)),t.material!==void 0){var i=this.json.materials[t.material];i.name&&(r.name=i.name);var o=i.pbrMetallicRoughness||{};if(Array.isArray(o.baseColorFactor)){var s=o.baseColorFactor;r.color.fromArray(s),r.opacity=s[3]}i.doubleSided===!0&&(r.side=THREE__namespace.DoubleSide);var u=i.alphaMode||ALPHA_MODES.OPAQUE;u===ALPHA_MODES.BLEND?(r.transparent=!0,r.depthWrite=!1):(r.transparent=!1,u===ALPHA_MODES.MASK&&(r.alphaTest=i.alphaCutoff!==void 0?i.alphaCutoff:.5))}return this.disposeSet.add(r),Promise.all(e).then(function(){return r})},n.prototype.loadMaterialAsPointsMaterial=function(t){var e=this,r=[],i=new THREE__namespace.PointsMaterial;if(i.color=new THREE__namespace.Color(1,1,1),i.opacity=1,i.sizeAttenuation=!1,Object.keys(t.attributes).filter(function(l){return ATTRIBUTES[l]==="color"}).length>0&&(i.vertexColors=!0),Object.keys(t.attributes).filter(function(l){return ATTRIBUTES[l]==="tangent"}).length===0&&(i.normalScale&&(i.normalScale.y*=-1),i.clearcoatNormalScale&&(i.clearcoatNormalScale.y*=-1)),t.material!==void 0){var o=this.json.materials[t.material];o.name&&(i.name=o.name);var s=o.pbrMetallicRoughness||{};if(Array.isArray(s.baseColorFactor)){var u=s.baseColorFactor;i.color.fromArray(u),i.opacity=u[3]}s.baseColorTexture!==void 0&&r.push(this.createMaterialTexture(s.baseColorTexture).then(function(l){l.encoding=THREE__namespace.sRGBEncoding,i.map=l,e.disposeSet.add(l)})),o.doubleSided===!0&&(i.side=THREE__namespace.DoubleSide);var c=o.alphaMode||ALPHA_MODES.OPAQUE;c===ALPHA_MODES.BLEND?(i.transparent=!0,i.depthWrite=!1):(i.transparent=!1,c===ALPHA_MODES.MASK&&(i.alphaTest=o.alphaCutoff!==void 0?o.alphaCutoff:.5))}return this.disposeSet.add(i),Promise.all(r).then(function(){return i})},n.prototype.loadMaterial=function(t){var e,r=(e=t.mode)!==null&&e!==void 0?e:WEBGL_CONSTANTS.TRIANGLES,i="material:"+this.createPrimitiveKey(t),o=this.cache.get(i);if(o)return o;for(var s=null,u=0,c=values(this.extensions);u<c.length;u++){var l=c[u];if(s=l.loadMaterial(t,this),s)break}if(r===WEBGL_CONSTANTS.TRIANGLES||r===WEBGL_CONSTANTS.TRIANGLE_STRIP||r===WEBGL_CONSTANTS.TRIANGLE_FAN)s=this.loadMaterialAsMeshStandardMaterial(t);else if(r===WEBGL_CONSTANTS.LINES||r===WEBGL_CONSTANTS.LINE_STRIP||r===WEBGL_CONSTANTS.LINE_LOOP)s=this.loadMaterialAsLineBasicMaterial(t);else if(r===WEBGL_CONSTANTS.POINTS)s=this.loadMaterialAsPointsMaterial(t);else throw new Error("glTF: Primitive mode unsupported: "+r);return this.cache.set(i,s),s},n.prototype.loadTexture=function(t){var e=this,r="texture:"+t,i=this.cache.get(r);if(i)return i;for(var o=null,s=0,u=values(this.extensions);s<u.length;s++){var c=u[s];if(o=c.loadTexture(t,this),o)break}if(!o){var l=this.json.textures[t];o=this.loadImage(l.source).then(function(d){var f=new THREE__namespace.Texture(d);f.needsUpdate=!0,f.flipY=!1,l.name&&(f.name=l.name);var v=e.json.samplers||{},A=v[l.sampler]||{};return f.magFilter=WEBGL_FILTERS[A.magFilter]||THREE__namespace.LinearFilter,f.minFilter=WEBGL_FILTERS[A.minFilter]||THREE__namespace.LinearMipmapLinearFilter,f.wrapS=WEBGL_WRAPPINGS[A.wrapS]||THREE__namespace.RepeatWrapping,f.wrapT=WEBGL_WRAPPINGS[A.wrapT]||THREE__namespace.RepeatWrapping,f.onUpdate=function(){d.close()},f})}return o=o.then(function(d){return e.disposeSet.add(d),d}),this.cache.set(r,o),o},n.prototype.loadMesh=function(t){for(var e=this,r=null,i=0,o=values(this.extensions);i<o.length;i++){var s=o[i];if(r=s.loadMesh(t,this),r)break}if(!r){var u=this.json.meshes[t],c=u.primitives,l=Promise.all(c.map(function(f){return e.loadGeometry(f)})),d=Promise.all(c.map(function(f){return e.loadMaterial(f)}));r=Promise.all([l,d]).then(function(f){for(var v=f[0],A=f[1],h=[],p=0;p<c.length;p++){var y=c[p],m=v[p],g=A[p],E=y.mode||WEBGL_CONSTANTS.TRIANGLES,b=void 0;if(E===WEBGL_CONSTANTS.TRIANGLES||E===WEBGL_CONSTANTS.TRIANGLE_STRIP||E===WEBGL_CONSTANTS.TRIANGLE_FAN)if(E===WEBGL_CONSTANTS.TRIANGLE_STRIP?m=e.toGeometryTrianglesDrawMode(m,THREE__namespace.TriangleStripDrawMode):E===WEBGL_CONSTANTS.TRIANGLE_FAN&&(m=e.toGeometryTrianglesDrawMode(m,THREE__namespace.TriangleFanDrawMode)),e.disposeSet.add(m),u.isSkinnedMesh){var T=new THREE__namespace.SkinnedMesh(m,g);m.attributes.skinWeight.normalized||T.normalizeSkinWeights(),b=T}else b=new THREE__namespace.Mesh(m,g);else if(E===WEBGL_CONSTANTS.POINTS)b=new THREE__namespace.Points(m,g);else if(E===WEBGL_CONSTANTS.LINES)b=new THREE__namespace.LineSegments(m,g);else if(E===WEBGL_CONSTANTS.LINE_STRIP)b=new THREE__namespace.Line(m,g);else if(E===WEBGL_CONSTANTS.LINE_LOOP)b=new THREE__namespace.LineLoop(m,g);else throw new Error("glTF: Primitive mode unsupported: "+E);if(Object.keys(m.morphAttributes).length>0){if(u.weights!==void 0)for(var _=0,S=u.weights.length;_<S;_++)b.morphTargetInfluences[_]=u.weights[_];if(u.extras&&Array.isArray(u.extras.targetNames)){var R=u.extras.targetNames;if(b.morphTargetInfluences.length===R.length){b.morphTargetDictionary={};for(var _=0,S=R.length;_<S;_++)b.morphTargetDictionary[R[_]]=_}else console.warn("glTF: Invalid extras.targetNames length. Ignoring names.")}}b.name=e.createUniqueName(u.name||"mesh_"+t),h.push(b)}if(h.length===1)return h[0];for(var B=new THREE__namespace.Group,I=0,x=h;I<x.length;I++){var b=x[I];B.add(b)}return B})}return r},n.prototype.loadNodeAttachments=function(t){for(var e=[],r=0,i=values(this.extensions);r<i.length;r++){var o=i[r],s=o.loadNodeAttachments(t,this);s&&e.push(s)}return e},n.prototype.loadNode=function(t){var e="node:"+t,r=this.cache.get(e);if(r)return r;var i=this.json,o=i.nodes[t],s=o.name?this.createUniqueName(o.name):"",u=[];o.mesh!==void 0&&u.push(this.loadMesh(o.mesh).then(function(v){if(o.weights!==void 0){var A=o.weights;v.traverse(function(h){if(h instanceof THREE__namespace.Mesh||h instanceof THREE__namespace.Line||h instanceof THREE__namespace.Points)for(var p=0,y=A.length;p<y;p++)h.morphTargetInfluences[p]=A[p]})}return v})),o.camera!==void 0&&u.push(this.loadCamera(o.camera));for(var c=this.loadNodeAttachments(t),l=0,d=c;l<d.length;l++){var f=d[l];u.push(f)}return Promise.all(u).then(function(v){var A;if(o.isBone===!0?A=new THREE__namespace.Bone:v.length>1?A=new THREE__namespace.Group:v.length===1?A=v[0]:A=new THREE__namespace.Object3D,A!==v[0])for(var h=0,p=v.length;h<p;h++)A.add(v[h]);if(o.name&&(A.name=s),o.matrix!==void 0){var y=new THREE__namespace.Matrix4;y.fromArray(o.matrix),A.applyMatrix4(y)}else o.translation!==void 0&&A.position.fromArray(o.translation),o.rotation!==void 0&&A.quaternion.fromArray(o.rotation),o.scale!==void 0&&A.scale.fromArray(o.scale);return A})},n.prototype.loadScene=function(t){var e=this.json,r=e.scenes[t],i=new THREE__namespace.Group;r.name&&(i.name=this.createUniqueName(r.name));for(var o=r.nodes||[],s=[],u=0,c=o.length;u<c;u++)s.push(this.buildNodeHierarchy(o[u],i));return Promise.all(s).then(function(){return i})},n.prototype.createMaterialTexture=function(t){var e=this;return this.loadTexture(t.index).then(function(r){for(var i=0,o=values(e.extensions);i<o.length;i++){var s=o[i],u=s.extendTexture(r,t,e);u&&(r=u,e.disposeSet.add(r))}return e.textureSet.add(r),r})},n.prototype.addGeometryPrimitiveAttributes=function(t,e){var r=this,i=e.attributes,o=[],s=function(T){var _=ATTRIBUTES[T]||T.toLowerCase();if(_ in t.attributes)return"continue";o.push(u.loadAccessor(i[T]).then(function(S){S&&t.setAttribute(_,S)}))},u=this;for(var c in i)s(c);e.indices!==void 0&&!t.index&&o.push(this.loadAccessor(e.indices).then(function(T){T&&t.setIndex(T)}));var l=new THREE__namespace.Box3;if(i.POSITION!==void 0){var d=this.json.accessors[i.POSITION],f=d.min,v=d.max;if(f!==void 0&&v!==void 0){if(l.set(new THREE__namespace.Vector3(f[0],f[1],f[2]),new THREE__namespace.Vector3(v[0],v[1],v[2])),d.normalized){var A=getNormalizedComponentScale(WEBGL_COMPONENT_TYPES[d.componentType]);l.min.multiplyScalar(A),l.max.multiplyScalar(A)}}else console.warn("glTF: Missing min/max properties for accessor POSITION.")}var h=e.targets;if(h!==void 0){for(var p=new THREE__namespace.Vector3,y=new THREE__namespace.Vector3,m=0,g=h.length;m<g;m++){var E=h[m];if(E.POSITION!==void 0){var d=this.json.accessors[E.POSITION],f=d.min,v=d.max;if(f!==void 0&&v!==void 0){if(y.setX(Math.max(Math.abs(f[0]),Math.abs(v[0]))),y.setY(Math.max(Math.abs(f[1]),Math.abs(v[1]))),y.setZ(Math.max(Math.abs(f[2]),Math.abs(v[2]))),d.normalized){var A=getNormalizedComponentScale(WEBGL_COMPONENT_TYPES[d.componentType]);y.multiplyScalar(A)}p.max(y)}else console.warn("glTF: Missing min/max properties for accessor POSITION.")}}l.expandByVector(p)}t.boundingBox=l;var b=new THREE__namespace.Sphere;return l.getCenter(b.center),b.radius=l.min.distanceTo(l.max)/2,t.boundingSphere=b,Promise.all(o).then(function(){if(t.attributes.uv&&!t.attributes.uv2&&r.options.copyUV2&&t.setAttribute("uv2",t.attributes.uv),e.targets){for(var T=!1,_=!1,S=0,R=e.targets.length;S<R;S++){var B=e.targets[S];if(B.POSITION!==void 0&&(T=!0),B.NORMAL!==void 0&&(_=!0),T&&_)break}if(!T&&!_)return t;var I=[];t.morphTargetsRelative=!0;for(var x=function(M,L){var C=e.targets[M];T?I.push(r.loadAccessor(C.POSITION).then(function(H){H&&(t.morphAttributes.position[M]=H)})):t.morphAttributes.position[M]=t.attributes.position,_?I.push(r.loadAccessor(C.NORMAL).then(function(H){H&&(t.morphAttributes.normal[M]=H)})):t.morphAttributes.normal[M]=t.attributes.normal},S=0,R=e.targets.length;S<R;S++)x(S,R);return Promise.all(I).then(function(){return t})}else return t})},n.prototype.buildNodeHierarchy=function(t,e){var r=this,i=this.json.nodes[t];return this.loadNode(t).then(function(o){if(i.skin===void 0)return o;var s;return r.loadSkin(i.skin).then(function(u){s=u;for(var c=[],l=0,d=s.joints.length;l<d;l++)c.push(r.loadNode(s.joints[l]));return Promise.all(c)}).then(function(u){return o.traverse(function(c){if(c instanceof THREE__namespace.SkinnedMesh){for(var l=[],d=[],f=0,v=u.length;f<v;f++){var A=u[f];if(A instanceof THREE__namespace.Bone){l.push(A);var h=new THREE__namespace.Matrix4;s.inverseBindMatrices!==void 0&&h.fromArray(s.inverseBindMatrices.array,f*16),d.push(h)}else console.warn('glTF: Joint "%s" could not be found.',s.joints[f])}c.bind(new THREE__namespace.Skeleton(l,d),c.matrixWorld)}}),o})}).then(function(o){e.add(o);var s=[];if(i.children)for(var u=i.children,c=0,l=u.length;c<l;c++){var d=u[c];s.push(r.buildNodeHierarchy(d,o))}return Promise.all(s).then(function(){return o})})},n.prototype.createUniqueName=function(t){for(var e=THREE__namespace.PropertyBinding.sanitizeNodeName(t||""),r=e,i=1;this.nodeNamesUsed[r];++i)r=e+"_"+i;return this.nodeNamesUsed[r]=!0,r},n.prototype.resolveResouce=function(t){return pathJoin(this.options.resourcePath,appendSearch(t,this.options.search))},n.prototype.toGeometryTrianglesDrawMode=function(t,e){var r=t.getIndex();if(r===null){var i=[],o=t.getAttribute("position");if(o!==void 0){for(var s=0;s<o.count;s++)i.push(s);t.setIndex(i),r=t.getIndex()}}if(r===null)return console.error("glTF: Undefined position attribute. Processing not possible."),t;var u=r.count-2,c=[];if(e===THREE__namespace.TriangleFanDrawMode)for(var s=1;s<=u;s++)c.push(r.getX(0)),c.push(r.getX(s)),c.push(r.getX(s+1));else for(var s=0;s<u;s++)s%2===0?(c.push(r.getX(s)),c.push(r.getX(s+1)),c.push(r.getX(s+2))):(c.push(r.getX(s+2)),c.push(r.getX(s+1)),c.push(r.getX(s)));c.length/3!==u&&console.error("glTF: Unable to generate correct amount of triangles.");var l=t.clone();return l.setIndex(c),this.disposeSet.add(l),l},n}();function getNormalizedComponentScale(n){switch(n){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("glTF: Unsupported normalized accessor component type.")}}var BaseExtension=function(){function n(){}return n.prototype.markDefs=function(t){},n.prototype.prepare=function(t){},n.prototype.emitResult=function(t,e){},n.prototype.createPrimitiveKey=function(t,e){},n.prototype.extendTexture=function(t,e,r){return null},n.prototype.loadBuffer=function(t,e){return null},n.prototype.loadBufferView=function(t,e){return null},n.prototype.loadImage=function(t,e){return null},n.prototype.loadTexture=function(t,e){return null},n.prototype.loadGeometry=function(t,e){return null},n.prototype.loadMaterial=function(t,e){return null},n.prototype.loadMesh=function(t,e){return null},n.prototype.loadNodeAttachments=function(t,e){return null},n.prototype.loadCamera=function(t,e){return null},n.prototype.loadAnimation=function(t,e){return null},n}(),KHR_binary_glTF=function(n){__extends(t,n);function t(){var e=n.call(this)||this;return e.header={magic:"",version:0,length:0},e.content="",e.body=null,e}return t.getMagic=function(e){return decodeText(new Uint8Array(e.slice(0,4)))},t.prototype.loadGlbBinary=function(e){var r=new DataView(e,0,t.HEADER_LENGTH);if(this.header={magic:t.getMagic(e),version:r.getUint32(4,!0),length:r.getUint32(8,!0)},this.header.magic!==t.HEADER_MAGIC)throw new Error("glTF:KHR_binary_glTF: Unsupported.");if(this.header.version<2)throw new Error("glTF:KHR_binary_glTF: Legacy binary file detected.");for(var i=new DataView(e,t.HEADER_LENGTH),o=0,s=null,u=null;o<i.byteLength;){var c=i.getUint32(o,!0);if(o+=4,c!==0){var l=i.getUint32(o,!0);if(o+=4,l===t.CHUNK_TYPES.JSON){var d=new Uint8Array(e,t.HEADER_LENGTH+o,c);s=decodeText(d)}else if(l===t.CHUNK_TYPES.BIN){var f=t.HEADER_LENGTH+o;u=e.slice(f,f+c)}o+=c}}if(s===null)throw new Error("glTF:KHR_binary_glTF: JSON content not found.");this.content=s,this.body=u},t.prototype.loadBuffer=function(e,r){var i=r.json.buffers[e];return i.uri===void 0&&e===0&&this.body?Promise.resolve(this.body):null},t.prototype.clear=function(){this.body=null,this.content=""},t.HEADER_MAGIC="glTF",t.HEADER_LENGTH=12,t.CHUNK_TYPES={JSON:1313821514,BIN:5130562},t}(BaseExtension),defaultDecoderPath="https://vr-public.realsee-cdn.cn/release/static/image/release/five/resource/draco/1.5.6/",defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"},Draco=function(){function n(){this.decoderPath=defaultDecoderPath,this.decoderConfig={},this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL=""}return n.prototype.setDecoderPath=function(t){this.decoderPath=t},n.prototype.setDecoderConfig=function(t){return this.decoderConfig=t,this},n.prototype.setWorkerLimit=function(t){return this.workerLimit=t,this},n.prototype.decodeDracoFile=function(t,e,r,i){var o={attributeIDs:r||defaultAttributeIDs,attributeTypes:i||defaultAttributeTypes,useUniqueIDs:!!r};this.decodeGeometry(t,o).then(e)},n.prototype.decodeGeometry=function(t,e){var r=this;e===void 0&&(e={attributeIDs:defaultAttributeIDs,attributeTypes:defaultAttributeTypes,useUniqueIDs:!1});for(var i in e.attributeTypes){var o=e.attributeTypes[i];o.BYTES_PER_ELEMENT!==void 0&&(e.attributeTypes[i]=o.name)}var s,u=this.workerNextTaskID++,c=t.byteLength,l=this._getWorker(u,c).then(function(d){return s=d,new Promise(function(f,v){s._callbacks[u]={resolve:f,reject:v},s.postMessage({type:"decode",id:u,taskConfig:e,buffer:t},[t])})}).then(function(d){return r._createGeometry(d.geometry)});return l.catch(function(){return!0}).then(function(){s&&u&&r._releaseTask(s,u)}),l},n.prototype._createGeometry=function(t){var e=new THREE__namespace.BufferGeometry;t.index&&e.setIndex(new THREE__namespace.BufferAttribute(t.index.array,1));for(var r=0;r<t.attributes.length;r++){var i=t.attributes[r],o=i.name,s=i.array,u=i.itemSize;e.setAttribute(o,new THREE__namespace.BufferAttribute(s,u))}return e},n.prototype._initDecoder=function(){var t=this;if(this.decoderPending)return this.decoderPending;var e=typeof WebAssembly!="object"||this.decoderConfig.type==="js";if(e){var r=ajax(this.decoderPath+"draco_decoder.js",{responseType:"text"}).then(function(o){return o.body});this.decoderPending=r.then(function(o){var s=["/* draco decoder */",o,"","/* worker */",DRACOWorker].join(`
417
+ `,cacheMaterials=[],cameraPX=new THREE__namespace.PerspectiveCamera(90,1,.1,2);cameraPX.up.set(0,-1,0),cameraPX.lookAt(new THREE__namespace.Vector3(1,0,0)),cameraPX.updateMatrix(),cameraPX.matrixAutoUpdate=!1;var cameraNX=new THREE__namespace.PerspectiveCamera(90,1,.1,2);cameraNX.up.set(0,-1,0),cameraNX.lookAt(new THREE__namespace.Vector3(-1,0,0)),cameraNX.updateMatrix(),cameraNX.matrixAutoUpdate=!1;var cameraPY=new THREE__namespace.PerspectiveCamera(90,1,.1,2);cameraPY.up.set(0,0,1),cameraPY.lookAt(new THREE__namespace.Vector3(0,1,0)),cameraPY.updateMatrix(),cameraPY.matrixAutoUpdate=!1;var cameraNY=new THREE__namespace.PerspectiveCamera(90,1,.1,2);cameraNY.up.set(0,0,-1),cameraNY.lookAt(new THREE__namespace.Vector3(0,-1,0)),cameraNY.updateMatrix(),cameraNY.matrixAutoUpdate=!1;var cameraPZ=new THREE__namespace.PerspectiveCamera(90,1,.1,2);cameraPZ.up.set(0,-1,0),cameraPZ.lookAt(new THREE__namespace.Vector3(0,0,1)),cameraPZ.updateMatrix(),cameraPZ.matrixAutoUpdate=!1;var cameraNZ=new THREE__namespace.PerspectiveCamera(90,1,.1,2);cameraNZ.up.set(0,-1,0),cameraNZ.lookAt(new THREE__namespace.Vector3(0,0,-1)),cameraNZ.updateMatrix(),cameraNZ.matrixAutoUpdate=!1;var FACES={front:{camera:cameraPZ,index:4},back:{camera:cameraNZ,index:5},up:{camera:cameraPY,index:2},down:{camera:cameraNY,index:3},left:{camera:cameraNX,index:1},right:{camera:cameraPX,index:0}};function getMaterial(){var n=cacheMaterials.pop();return n||new THREE__namespace.ShaderMaterial({uniforms:{map:{value:null},flipY:{value:0}},vertexShader:PLANE_VERTEX_SHADER,fragmentShader:PLANE_FRAGMENT_SHADER,depthTest:!1,depthWrite:!1,stencilWrite:!1,blending:THREE__namespace.NoBlending,lights:!1,toneMapped:!1,fog:!1})}function releaseMaterial(n){n.uniforms.map.value=null,cacheMaterials.push(n)}function renderTexturesToCubeRenderTarget(n,t,e){var r=new THREE__namespace.Scene;r.matrixAutoUpdate=!1;var i=new THREE__namespace.Group;i.scale.set(1,1,-1),r.add(i);for(var o=[],s=new Set,u=0,c=n;u<c.length;u++){var l=c[u];s.add(l.face);var d=getMaterial();o.push(d),d.uniforms.map.value=l.texture,d.uniforms.flipY.value=l.flipY?1:0;var f=new THREE__namespace.Group,v=new THREE__namespace.Mesh(PLAME_GEOMETRY,d);v.position.set(l.position.x+l.size.x/2-.5,1-(l.position.y+l.size.y/2)-.5,-.5),v.scale.set(l.size.x,l.size.y,1),f.quaternion.copy(QUATERNION[l.face]),f.add(v),i.add(f)}var A=e.autoClear,h=e.sortObjects,p=e.xr.enabled,y=t.texture.generateMipmaps;e.autoClear=!1,e.sortObjects=!1,e.xr.enabled=!1,t.texture.generateMipmaps=!1;var m=e.getRenderTarget(),g=0;s.forEach(function(T){++g===s.size&&(t.texture.generateMipmaps=y),e.setRenderTarget(t,FACES[T].index),e.render(r,FACES[T].camera)}),e.setRenderTarget(m),e.autoClear=A,e.sortObjects=h,e.xr.enabled=p;for(var E=0,b=o;E<b.length;E++){var d=b[E];releaseMaterial(d)}}var canUseNativeImageBitmap=function(){return!1}();function createImageBitmapLikeImage(n){n===void 0&&(n={});var t=Object.assign(document.createElementNS("http://www.w3.org/1999/xhtml","img"),{crossOrigin:"",close:function(){n.onClose&&n.onClose.call(this),this.onerror=this.onload=this.close=noop$1,this.removeAttribute("src")}});return t}function createImageBitmapLike(n){return new Promise(function(t,e){var r=URL.createObjectURL(n),i=createImageBitmapLikeImage({onClose:function(){this.src===r&&URL.revokeObjectURL(r)}});i.onload=function(){i.src===r&&URL.revokeObjectURL(r),i.onload=i.onerror=noop$1,setTimeout(function(){t(i)},10)},i.onerror=function(){var o=i.src;i.onload=i.onerror=noop$1,i.close(),e(new Error("image load error: ".concat(o)))},i.decoding="async",i.src=r})}var canvasPool=[];function createCanvas(n,t){var e=canvasPool.shift();if(e)return e.width=n,e.height=t,e;var r=Object.assign(document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),{close:function(){r.close=noop$1,canvasPool.push(r)}});return r}function poolImageToTexture(n,t){if(t&&(n.width>t.width||n.height>t.height)){var e=createCanvas(Math.min(n.width,t.width),Math.min(n.height,t.height)),r=e.getContext("2d");r.clearRect(0,0,e.width,e.height),r.drawImage(n,0,0,e.width,e.height),n.close();var i=new THREE__namespace.Texture(e);i.needsUpdate=!0,i.flipY=!0;var o=i.dispose;return i.dispose=function(){e.close(),o.call(i),i.dispose=o},i}else{var s=new THREE__namespace.Texture(n);s.needsUpdate=!0,typeof ImageBitmap!="undefined"&&n instanceof ImageBitmap?s.flipY=!1:s.flipY=!0;var u=s.dispose;return s.dispose=function(){n.close(),u.call(s),s.dispose=u},s}}function poolImagesToCubeTexture(n){var t=new THREE__namespace.CubeTexture(n);t.needsUpdate=!0,t.flipY=!1;var e=t.dispose;return t.dispose=function(){for(var r=0,i=n;r<i.length;r++){var o=i[r];o.close()}e.call(t),t.dispose=e},t}var sharedSortVector3$1=new THREE__namespace.Vector3,FACE_ORDER=["right","left","up","down","front","back"],TileCubeTextureTarget=function(){function n(t,e,r,i,o){this.tileTree=e,this.tileSources=r,this.options=i,this.renderer=o,this.name="",this.needsRender=!1,this.maxRequest=n.DEFAULT_MAX_REQUEST,this.disposed=!1,this.loadedCubeNodes=new Set,this.loadingCubeNodes=new Set,this.drawedCubeNodes=new Set,this.baseCubeTexture=null,this._cubeRenderTarget=null,this.prepareToRender=[],this.baseCubeTexture=t}return Object.defineProperty(n.prototype,"cubeRenderTarget",{get:function(){return this._cubeRenderTarget},set:function(t){var e,r,i,o,s,u;if(t===null)throw new Error("cannot set cubeRenderTarget to null.");t.width!==this.options.textureSize&&t.setSize(this.options.textureSize,this.options.textureSize),t.texture.format=(e=this.options.format)!==null&&e!==void 0?e:THREE__namespace.RGBAFormat,t.texture.minFilter=(r=this.options.minFilter)!==null&&r!==void 0?r:THREE__namespace.LinearFilter,t.texture.magFilter=(i=this.options.magFilter)!==null&&i!==void 0?i:THREE__namespace.LinearFilter,t.texture.wrapS=(o=this.options.wrapS)!==null&&o!==void 0?o:THREE__namespace.ClampToEdgeWrapping,t.texture.wrapT=(s=this.options.wrapT)!==null&&s!==void 0?s:THREE__namespace.ClampToEdgeWrapping,t.texture.generateMipmaps=(u=this.options.generateMipmaps)!==null&&u!==void 0?u:!0,this.baseCubeTexture&&(renderCubeTextureToCubeRenderTarget(this.baseCubeTexture,t,this.renderer),this.baseCubeTexture.dispose(),this.baseCubeTexture=null),this._cubeRenderTarget&&renderCubeTextureToCubeRenderTarget(this._cubeRenderTarget.texture,t,this.renderer),this._cubeRenderTarget=t},enumerable:!1,configurable:!0}),n.prototype.requestTile=function(t){var e=this,r,i,o,s,u,c,l=this.tileSources.filter(function(p){return p.level===t.level})[0];if(!l)return this.loadedCubeNodes.add(t),this.prepareToRender.push({node:t,texture:null}),!1;var d=l.size,f=Math.pow(2,t.level)*t.position.y,v=Math.pow(2,t.level)*t.position.x,A="".concat(((o=(i=(r=this.options.imageURL)===null||r===void 0?void 0:r.options)===null||i===void 0?void 0:i.key)!==null&&o!==void 0?o:"pano.0").replace(/^pano/,"pano_tile"),".").concat(t.face,".").concat(t.level,".").concat(f,".").concat(v),h=__assign(__assign({},(u=(s=this.options.imageURL)===null||s===void 0?void 0:s.options)!==null&&u!==void 0?u:{key:"unknown"}),{key:A,size:l.scale>=1?void 0:d*t.size*l.scale,quality:void 0,cut:[d*t.position.x,d*t.position.y,d*t.size,d*t.size]});return this.loadingCubeNodes.add(t),this.options.textureLoader.loadTexture(l[t.face],{imageURL:{transform:(c=this.options.imageURL)===null||c===void 0?void 0:c.transform,options:__assign({},h)},format:THREE__namespace.RGBAFormat,timeout:this.options.timeout,magFilter:this.options.magFilter,minFilter:this.options.minFilter,fetcher:this.options.fetcher}).then(function(p){if(e.disposed){p.body.dispose();return}e.prepareToRender.push({node:t,texture:p.body}),e.loadedCubeNodes.add(t)}).catch(noop$1).then(function(){e.disposed||e.loadingCubeNodes.delete(t)}),!0},n.prototype.update=function(t,e){var r=this;if(!this.disposed){var i=t.planes[5].normal,o=Math.max(this.maxRequest-this.loadingCubeNodes.size,0),s=[];traverseTileCubeNode(this.tileTree,function(p){if(p.level>e||!t.intersectsBox(p.box))return!1;!r.loadedCubeNodes.has(p)&&!r.loadingCubeNodes.has(p)&&s.push(p)}),s.sort(function(p,y){return p.level!==y.level?p.level-y.level:p.box.getCenter(sharedSortVector3$1).angleTo(i)-y.box.getCenter(sharedSortVector3$1).angleTo(i)});for(var u=0,c=s;u<c.length;u++){var l=c[u];if(o<=0)break;var d=this.requestTile(l);d&&o--}if(this.cubeRenderTarget&&this.prepareToRender.length){this.prepareToRender.sort(function(p,y){return p.node.level-y.node.level});for(var f=[],v=0;v<this.prepareToRender.length;v++){var A=this.prepareToRender[v],l=A.node,h=A.texture;(l.parent===null||this.drawedCubeNodes.has(l.parent))&&(this.drawedCubeNodes.add(l),h&&f.push({face:l.face,position:l.position,size:new THREE__namespace.Vector2(l.size,l.size),texture:h,flipY:!h.flipY}),this.prepareToRender.splice(v,1),v--)}f.length&&(renderTexturesToCubeRenderTarget(f,this.cubeRenderTarget,this.renderer),this.needsRender=!0)}}},Object.defineProperty(n.prototype,"tilePending",{get:function(){return this.loadingCubeNodes.size},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"texture",{get:function(){if(!this._cubeRenderTarget)throw new Error("cubeRenderTarget never set.");return this._cubeRenderTarget.texture},enumerable:!1,configurable:!0}),n.prototype.dispose=function(){if(!this.disposed){this.disposed=!0,this.baseCubeTexture&&(this.baseCubeTexture.dispose(),this.baseCubeTexture=null),this.loadingCubeNodes.clear(),this.loadedCubeNodes.clear();for(var t=0,e=this.prepareToRender;t<e.length;t++){var r=e[t];r.texture&&r.texture.dispose()}this.prepareToRender.length=0}},n.DEFAULT_MAX_REQUEST=3,n}(),TextureLoader=function(){function n(){}return n.prototype.loadTexture=function(t,e,r,i,o,s){var u,c,l,d,f,v,A;r===void 0&&(r=noop$1),i===void 0&&(i=noop$1),o===void 0&&(o=noop$1);var h={};typeof e.flipY!="undefined"&&(h.flipY=e.flipY),typeof e.format!="undefined"&&(h.format=e.format),typeof e.encoding!="undefined"&&(h.encoding=e.encoding),h.generateMipmaps=(u=e.generateMipmaps)!==null&&u!==void 0?u:!1,h.minFilter=(c=e.minFilter)!==null&&c!==void 0?c:THREE__namespace.LinearFilter,h.magFilter=(l=e.magFilter)!==null&&l!==void 0?l:THREE__namespace.LinearFilter;var p=(f=(d=e.imageURL)===null||d===void 0?void 0:d.options)!==null&&f!==void 0?f:{key:"unknown"};t=applyImageURLOptions(t,(v=e.imageURL)===null||v===void 0?void 0:v.transform,p);var y=getProtocol(t),m=(A=e.viaAjax)!==null&&A!==void 0?A:canUseNativeImageBitmap,g=isJsonpSource(t),E=/^https?:/.test(y);if(g?m=!0:E||(m=!1),m){var b=null,T="blob";return e.fetcher.ajax(t,{timeout:e.timeout,responseType:T},void 0,void 0,o).then(function(R){return createImageBitmapLike(R.body)}).then(function(R){return poolImageToTexture(R,e.maxSize)}).then(function(R){return Object.assign(R,h),R}).then(function(R){var B={meta:b,body:R};return r(B),B}).catch(function(R){return i(R),Promise.reject(R)})}else{var _=null,S;return Promise.resolve().then(function(){return createImageBitmapLikeImage()}).then(function(R){return S=R,e.fetcher.loadImage(t,{timeout:e.timeout},void 0,void 0,o,R)}).then(function(R){return _=R.meta,poolImageToTexture(R.body,e.maxSize)}).then(function(R){return Object.assign(R,h),R}).then(function(R){var B={meta:_,body:R};return r(B),B}).catch(function(R){return S&&S.close(),i(R),Promise.reject(R)})}},n.prototype.loadCubeTexture=function(t,e,r,i,o,s){var u,c,l,d,f,v,A;r===void 0&&(r=noop$1),i===void 0&&(i=noop$1),o===void 0&&(o=noop$1);var h={};typeof e.format!="undefined"&&(h.format=e.format),h.generateMipmaps=(u=e.generateMipmaps)!==null&&u!==void 0?u:!1,h.minFilter=(c=e.minFilter)!==null&&c!==void 0?c:THREE__namespace.LinearFilter,h.magFilter=(l=e.magFilter)!==null&&l!==void 0?l:THREE__namespace.LinearFilter;for(var p=[t[FACE_ORDER[0]],t[FACE_ORDER[1]],t[FACE_ORDER[2]],t[FACE_ORDER[3]],t[FACE_ORDER[4]],t[FACE_ORDER[5]]],y=[],m=[0,0,0,0,0,0],g=[],E=function(T){var _=(f=(d=e.imageURL)===null||d===void 0?void 0:d.options)!==null&&f!==void 0?f:{key:"unknown"},S=applyImageURLOptions(p[T],(v=e.imageURL)===null||v===void 0?void 0:v.transform,__assign(__assign({},_),{key:_.key+"."+FACE_ORDER[T]})),R=getProtocol(S),B=function(F){m[T]=F,o(m.reduce(function(O,G){return O+G},0)/6)},I=(A=e.viaAjax)!==null&&A!==void 0?A:!1,x=/^https?:$/.test(R),M=isJsonpSource(S);if(M?I=!0:x||(I=!1),I){var L="blob",C=e.fetcher.ajax(S,{timeout:e.timeout,responseType:L},void 0,void 0,B).then(function(F){return g[T]=F.meta,createImageBitmapLike(F.body)});y.push(C)}else{var H,C=Promise.resolve().then(function(){return createImageBitmapLikeImage()}).then(function(O){return H=O,e.fetcher.loadImage(S,{timeout:e.timeout},void 0,void 0,B,O)}).then(function(O){return g[T]=O.meta,O.body}).catch(function(O){return H&&H.close(),Promise.reject(O)});y.push(C)}},b=0;b<6;b++)E(b);return Promise.all(y).then(function(T){return poolImagesToCubeTexture(T)}).then(function(T){return Object.assign(T,__assign({encoding:THREE__namespace.sRGBEncoding},h)),T}).then(function(T){var _={body:T,meta:g};return r(_),_}).catch(function(T){for(var _=0,S=y;_<S.length;_++){var R=S[_];R.then(function(B){return B.close()}).catch(noop$1)}return i(T),Promise.reject(T)})},n.prototype.loadTiledCubeTexture=function(t,e,r,i,o,s,u){var c=this;return i===void 0&&(i=noop$1),o===void 0&&(o=noop$1),s===void 0&&(s=noop$1),new Promise(function(l,d){var f,v;c.loadCubeTexture(t,{imageURL:{transform:(f=r.imageURL)===null||f===void 0?void 0:f.transform,options:(v=r.imageURL)===null||v===void 0?void 0:v.options},format:THREE__namespace.RGBAFormat,viaAjax:r.viaAjax,timeout:r.timeout,fetcher:r.fetcher,magFilter:r.magFilter,minFilter:r.minFilter,generateMipmaps:r.generateMipmaps},function(A){var h,p=A.meta,y=A.body,m=(h=r.tileMaxLevel)!==null&&h!==void 0?h:2,g=Math.max(1024*m,512),E=createTileCubeTree(m),b=new TileCubeTextureTarget(y,E,e,{textureSize:g,textureLoader:c,imageURL:r.imageURL,magFilter:r.magFilter,minFilter:r.minFilter,generateMipmaps:r.generateMipmaps,timeout:r.timeout,fetcher:r.fetcher},u),T={meta:p,body:b};i(T),l(T)},function(A){o(A),d(A)},s,u).catch(noop$1)})},n}();const meshNoneVertexShader=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=113,i=126,o=0,s="";return t[o].split(s).map(function(u){return u.charCodeAt(o)>i?u:String.fromCharCode((u.charCodeAt(o)+r)%i)}).join(s)}("n\bv{t-rpA-d|yq]|vv|{Hn\bv{t-rp@-PnzrnQvrpv|{H0v{pyqr-Ip|zz|{K0v{pyqr-Iz|}untrl}nlrr\x07K0v{pyqr-Ixv{{v{tl}nlrr\x07K0v{pyqr-Iy|tqr}uosl}nlrr\x07K0v{pyqr-Ipyv}}v{tl}yn{rl}nlrr\x07K|vq-znv{56-\n--0v{pyqr-Ixv{onrlrr\x07K--0v{pyqr-Iortv{lrr\x07K--0v{pyqr-Iz|}untrlrr\x07K--0v{pyqr-Ixv{{v{tlrr\x07K--0v{pyqr-I}|wrplrr\x07K--0v{pyqr-Iy|tqr}uoslrr\x07K--0v{pyqr-Ipyv}}v{tl}yn{rlrr\x07K--d|yq]|vv|{-J-rpA5n{s|zrq9->;=6H--0vsqrs-b`RlV[`aN[PV[T----d|yq]|vv|{-J-v{n{prZnv\x07-7-d|yq]|vv|{H--0r{qvs--d|yq]|vv|{-J-z|qryZnv\x07-7-d|yq]|vv|{H--zn@-pnzrn_|nv|{Znv\x07-J-zn@5vrZnv\x07h=jh=j9-vrZnv\x07h>jh=j9-vrZnv\x07h?jh=j9-vrZnv\x07h=jh>j9-vrZnv\x07h>jh>j9-vrZnv\x07h?jh>j9-vrZnv\x07h=jh?j9-vrZnv\x07h>jh?j9-vrZnv\x07h?jh?j6H--PnzrnQvrpv|{-J-{|znyv r5pnzrn_|nv|{Znv\x07-7-rp@5=;=9-=;=9-:>;=66H--0v{pyqr-I|yq}|lrr\x07K--0v{pyqr-Is|tlrr\x07K\f"),meshNoneFragmentShader=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=113,i=126,o=0,s="";return t[o].split(s).map(function(u){return u.charCodeAt(o)>i?u:String.fromCharCode((u.charCodeAt(o)+r)%i)}).join(s)}("0qrsv{r-OYNPXlP\\Y\\_-rpA5=;=EC9-=;>=C9-=;>AF9->;=6{vs|z-nz}yrPor-}n{|=lzn}H{vs|z-znA-}n{|=lznv\x07H{vs|z-sy|n-}n{|=l ||zH0vs-qrsv{rq5b`RlYbZV[N[PR6--{vs|z-nz}yrPor-}n{|=lyzv{n{prZn}H0r{qvs{vs|z-nz}yrPor-}n{|>lzn}H{vs|z-znA-}n{|>lznv\x07H{vs|z-sy|n-}n{|>l ||zH0vs-qrsv{rq5b`RlYbZV[N[PR6--{vs|z-nz}yrPor-}n{|>lyzv{n{prZn}H0r{qvs{vs|z-sy|n-z|qryNy}unH{vs|z-sy|n-}|trH0vs-qrsv{rq5b`RlP\\[`aN[alP\\Y\\_6--{vs|z-rp@-p|{n{P|y|H0r{qvsn\bv{t-rpA-d|yq]|vv|{Hn\bv{t-rp@-PnzrnQvrpv|{H{vs|z-sy|n-u|{Sy||V{qr\x07H{vs|z-rp?-r|yv|{H{vs|z-sy|n-}v\x07ry_nv|H{vs|z-sy|n-|}npv\bH{vs|z-sy|n-ovtu{rH0vs{qrs-SYNal`UNQRQ--n\bv{t-rp@-[|znyH0r{qvs0v{pyqr-Ip|zz|{K0v{pyqr-Iqvurv{tl}nlsntzr{K0v{pyqr-Is|tl}nlsntzr{K0v{pyqr-I}rpynzn}l}nlsntzr{K0v{pyqr-Iy|tqr}uosl}nlsntzr{K0v{pyqr-Ipyv}}v{tl}yn{rl}nlsntzr{Krp@- ||zcrp|5rp@-qvrpv|{9-rp@-rp|9-sy|n- ||z6-\n--sy|n-urn-J-q|5qvrpv|{9-rp|6H--rp@-q-J-qvrpv|{-7-urnH--rp@-}-J-rp|-:-qH--rp@-\0-J-}-7- ||zH--r{-{|znyv r5q-8-\x006H\f|vq-znv{56-\n--0v{pyqr-Ipyv}}v{tl}yn{rlsntzr{K--tylSntP|y|-J-rpA5>;=9->;=9->;=9-|}npv\b6H--<<-JJJ-纯色-JJJ--0vs-qrsv{rq5b`RlP\\[`aN[alP\\Y\\_6----tylSntP|y|-J-rpA5p|{n{P|y|;9-p|{n{P|y|;t9-p|{n{P|y|;o9-|}npv\b6H--0r{qvs--<<-JJJJJJJJJJJ--<<-JJJ-全景图-JJJ--rp@-}n{|=a|crr\x07-J-{|znyv r5d|yq]|vv|{;\x07\b -:-}n{|=lznv\x07h@j;\x07\b 6H--}n{|=a|crr\x07-J- ||zcrp|5PnzrnQvrpv|{9-}n{|=a|crr\x079-}n{|=l ||z6H--}n{|=a|crr\x07-J-}n{|=a|crr\x07-7-zn@5}n{|=lznv\x076H--rp@-}n{|>a|crr\x07-J-{|znyv r5d|yq]|vv|{;\x07\b -:-}n{|>lznv\x07h@j;\x07\b 6H--}n{|>a|crr\x07-J- ||zcrp|5PnzrnQvrpv|{9-}n{|>a|crr\x079-}n{|>l ||z6H--}n{|>a|crr\x07-J-}n{|>a|crr\x07-7-zn@5}n{|>lznv\x076H--rpA-}n{|P|y|H--rpA-}n{|=P|y|-J-r\x07rPor5}n{|=lzn}9-}n{|=a|crr\x076H--rpA-}n{|>P|y|-J-r\x07rPor5}n{|>lzn}9-}n{|>a|crr\x076H--0vs-qrsv{rq5b`RlYbZV[N[PR6----}n{|=P|y|;n-J->;=-:-r\x07rPor5}n{|=lyzv{n{prZn}9-}n{|=a|crr\x076;H----}n{|>P|y|;n-J->;=-:-r\x07rPor5}n{|>lyzv{n{prZn}9-}n{|>a|crr\x076;H--0r{qvs--0vs-qrsv{rq5b`RlOYNPXla_N[`VaV\\[6----sy|n-oynpx]|tr-J-np|5:?;=-7-}|tr-8->;=6H----}n{|P|y|-J-zv\x075}n{|=P|y|9-OYNPXlP\\Y\\_9-zv{5>;=9-oynpx]|tr66H----}n{|P|y|-J-zv\x075}n{|P|y|9-}n{|>P|y|9-zn\x075=;=9-oynpx]|tr-:-]V-8->;=66H--0ryvs-qrsv{rq5b`Rl`]_RNQla_N[`VaV\\[6----rp?-prr{Pr{rP||q-J-r|yv|{-7-}v\x07ry_nv|-<-?;=H----sy|n-n{vv|{_nqv-J-qvn{pr5rp?5=;=9-=;=69-prr{Pr{rP||q6-7->;?H----sy|n-n{vv|{]|tr-J--qvn{pr5tylSntP||q;\x07\b9-prr{Pr{rP||q6-<-n{vv|{_nqvH----}n{|P|y|-J-zv\x075}n{|=P|y|9-}n{|>P|y|9-z||ur}5=;=9-=;?9-}|tr-:-n{vv|{]|tr66H--0ryr----}n{|P|y|-J-zv\x075}n{|=P|y|9-}n{|>P|y|9-}|tr6H--0r{qvs--tylSntP|y|-J-zv\x075}n{|P|y|9-tylSntP|y|9-z|qryNy}un6H--tylSntP|y|;n-J-|}npv\b-7-ovtu{rH--<<-JJJJJJJJJJJJJJJJ--0v{pyqr-Is|tlsntzr{K--0v{pyqr-I}rzyv}yvrqlny}unlsntzr{K--0v{pyqr-Iqvurv{tlsntzr{K\f"),meshBasicVertexShader=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=113,i=126,o=0,s="";return t[o].split(s).map(function(u){return u.charCodeAt(o)>i?u:String.fromCharCode((u.charCodeAt(o)+r)%i)}).join(s)}("0vs-qrsv{rq5b`RlRQY6--n\bv{t-sy|n-Y|tQr}uH0r{qvs0vs-qrsv{rq5b`RlcR_aRelZN_X6--nvor-sy|n-znxH0r{qvsn\bv{t-sy|n-V_||sZnxHn\bv{t-rpA-d|yq]|vv|{Hn\bv{t-rp@-PnzrnQvrpv|{Hn\bv{t-rp@-cvr]|vv|{H0v{pyqr-Ip|zz|{K0v{pyqr-Il}nlrr\x07K0v{pyqr-I?l}nlrr\x07K0v{pyqr-Ir{zn}l}nlrr\x07K0v{pyqr-Ip|y|l}nlrr\x07K0v{pyqr-Is|tl}nlrr\x07K0v{pyqr-Iz|}untrl}nlrr\x07K0v{pyqr-Ixv{{v{tl}nlrr\x07K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\x07K\f"),meshBasicFragmentShader=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=113,i=126,o=0,s="";return t[o].split(s).map(function(u){return u.charCodeAt(o)>i?u:String.fromCharCode((u.charCodeAt(o)+r)%i)}).join(s)}("0qrsv{r-OYNPXlP\\Y\\_-rpA5=;=EC9-=;>=C9-=;>AF9->;=6{vs|z-sy|n-sy||H{vs|z-nz}yrPor-}n{|=lzn}H{vs|z-znA-}n{|=lznv\x07H{vs|z-sy|n-}n{|=l ||zH0vs-qrsv{rq5b`RlYbZV[N[PR6--{vs|z-nz}yrPor-}n{|=lyzv{n{prZn}H0r{qvs{vs|z-nz}yrPor-}n{|>lzn}H{vs|z-znA-}n{|>lznv\x07H{vs|z-sy|n-}n{|>l ||zH0vs-qrsv{rq5b`RlYbZV[N[PR6--{vs|z-nz}yrPor-}n{|>lyzv{n{prZn}H0r{qvs{vs|z-sy|n-z|qryNy}unH{vs|z-sy|n-}|trH0vs-qrsv{rq5b`RlP\\[`aN[alP\\Y\\_6--{vs|z-rp@-p|{n{P|y|H0r{qvsp-Pyv}}r-\n--znA-znv\x07V{rrH--sy|n-sy||V{qr\x07H\fH0vs-[bZlPYV]]R_`-K-=--{vs|z-Pyv}}r-pyv}}rh[bZlPYV]]R_`jH0r{qvs0vs-qrsv{rq5b`RlRQY6--n\bv{t-sy|n-Y|tQr}uH0r{qvsn\bv{t-rpA-d|yq]|vv|{Hn\bv{t-rp@-PnzrnQvrpv|{Hn\bv{t-sy|n-V_||sZnxH{vs|z-sy|n-u|{Sy||V{qr\x07H{vs|z-rp?-r|yv|{H{vs|z-sy|n-}v\x07ry_nv|H{vs|z-rp@-qvssrH{vs|z-sy|n-|}npv\bH{vs|z-sy|n-ovtu{rH{vs|z-rp@-z|qryO|{qv{tZn\x07H{vs|z-rp@-z|qryO|{qv{tZv{H0vs{qrs-SYNal`UNQRQ--n\bv{t-rp@-[|znyH0r{qvs0v{pyqr-Ip|zz|{K0v{pyqr-Iqvurv{tl}nlsntzr{K0v{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-Ir{zn}lp|zz|{l}nlsntzr{K0v{pyqr-Ir{zn}l}nlsntzr{K0v{pyqr-Iporllrsyrpv|{lsntzr{K0v{pyqr-Is|tl}nlsntzr{K0v{pyqr-I}rpynzn}l}nlsntzr{K0v{pyqr-Iy|tqr}uosl}nlsntzr{K0v{pyqr-Ipyv}}v{tl}yn{rl}nlsntzr{Krp@- ||zcrp|5rp@-qvrpv|{9-rp@-rp|9-sy|n- ||z6-\n--sy|n-urn-J-q|5qvrpv|{9-rp|6H--rp@-q-J-qvrpv|{-7-urnH--rp@-}-J-rp|-:-qH--rp@-\0-J-}-7- ||zH--r{-{|znyv r5q-8-\x006H\f|vq-znv{56-\n--<<-JJJ-顶部裁切-JJJ--sy|n-||sP]|tr-J-}|5pynz}5:PnzrnQvrpv|{;\b9-=;=9->;=69-@;=6H--vs-5----V_||sZnx-K-=;B-33----d|yq]|vv|{;\b-K-z|qryO|{qv{tZn\x07;\b-:-||sP]|tr-7-5z|qryO|{qv{tZn\x07;\b-:-z|qryO|{qv{tZv{;\b6--6-\n----qvpnqH--\f--<<-JJJJJJJJJJJJJJ--<<-JJJ-前置裁切计算-JJJ--0vs-[bZlPYV]]R_`-K-=----o||y-pyv}}rqH----rpA-pyv}}r]|vv|{H----0}ntzn-{|yyly||}ln----s|-5-v{-v-J-=H-v-I-[bZlPYV]]R_`H-v-88-6-\n------pyv}}r]|vv|{-J-pyv}}rh-v-j;znv\x07V{rr-7-d|yq]|vv|{H------pyv}}rq-J-5pyv}}rh-v-j;sy||V{qr\x07-I-=;=-\v\v-no5sy||-:-pyv}}rh-v-j;sy||V{qr\x076-I->;=6H------pyv}}rq-J-pyv}}rq-33-pyv}}r]|vv|{;\x07-K-:=;B-33-pyv}}r]|vv|{;\x07-I-=;BH------pyv}}rq-J-pyv}}rq-33-pyv}}r]|vv|{;\b-K-:=;B-33-pyv}}r]|vv|{;\b-I-=;BH------pyv}}rq-J-pyv}}rq-33-pyv}}r]|vv|{; -K-:=;B-33-pyv}}r]|vv|{; -I-=;BH------vs-5pyv}}rq6-\n--------qvpnqH------\f----\f----0}ntzn-{|yyly||}lr{q--0r{qvs--<<-JJJJJJJJJJJJJJJJJJ--0v{pyqr-Ipyv}}v{tl}yn{rlsntzr{K--rpA-qvssrP|y|-J-rpA5-qvssr9-|}npv\b-6H--0v{pyqr-Iy|tqr}uoslsntzr{K--0v{pyqr-Izn}lsntzr{K--0v{pyqr-Ip|y|lsntzr{K--0v{pyqr-Iny}unzn}lsntzr{K--0v{pyqr-Iny}unrlsntzr{K--0v{pyqr-I}rpynzn}lsntzr{K--_rsyrprqYvtu-rsyrprqYvtu-J-_rsyrprqYvtu5-rp@5-=;=-69-rp@5-=;=-69-rp@5-=;=-69-rp@5-=;=-6-6H--<<-nppzynv|{-5onxrq-v{qvrp-yvtuv{t-|{y\b6--0vsqrs-b`RlYVTUaZN]----rpA-yvtuZn}ar\x07ryJ-r\x07r?Q5-yvtuZn}9-b?-6H----rsyrprqYvtu;v{qvrpQvssr-8J-yvtuZn}ar\x07rya|Yv{rn5-yvtuZn}ar\x07ry-6;to-7-yvtuZn}V{r{v\bH--0ryr----rsyrprqYvtu;v{qvrpQvssr-8J-rp@5->;=-6H--0r{qvs--<<-z|qynv|{--0v{pyqr-In|zn}lsntzr{K--rsyrprqYvtu;v{qvrpQvssr-7J-qvssrP|y|;toH--rp@-|t|v{tYvtu-J-rsyrprqYvtu;v{qvrpQvssrH--0v{pyqr-Ir{zn}lsntzr{K--tylSntP|y|-J-rpA5-|t|v{tYvtu9-qvssrP|y|;n-6H--<<-JJJ-纯色-JJJ--0vs-qrsv{rq5b`RlP\\[`aN[alP\\Y\\_6----tylSntP|y|-J-rpA5p|{n{P|y|;9-p|{n{P|y|;t9-p|{n{P|y|;o9-|}npv\b6H--0r{qvs--<<-JJJJJJJJJJJ--<<-JJJ-楼层显示-JJJ--sy|n-sy||\\}npv\b-J->;=H--vs-5u|{Sy||V{qr\x07-K-:=;=>-33-no5sy||-:-u|{Sy||V{qr\x076-K-=;FF6-\n----sy||\\}npv\b-J-=;?-7-zv{55>;=-8-PnzrnQvrpv|{;\b69->;=6H--\f--tylSntP|y|;n-J-tylSntP|y|;n-7-sy||\\}npv\b-7-ovtu{rH--<<-JJJJJJJJJJJJJJ--0v{pyqr-I|{rzn}}v{tlsntzr{K--0v{pyqr-Ir{p|qv{tlsntzr{K--<<-JJJ-全景图-JJJ--rp@-}n{|=a|crr\x07-J-{|znyv r5d|yq]|vv|{;\x07\b -:-}n{|=lznv\x07h@j;\x07\b 6H--}n{|=a|crr\x07-J- ||zcrp|5PnzrnQvrpv|{9-}n{|=a|crr\x079-}n{|=l ||z6H--}n{|=a|crr\x07-J-}n{|=a|crr\x07-7-zn@5}n{|=lznv\x076H--rp@-}n{|>a|crr\x07-J-{|znyv r5d|yq]|vv|{;\x07\b -:-}n{|>lznv\x07h@j;\x07\b 6H--}n{|>a|crr\x07-J- ||zcrp|5PnzrnQvrpv|{9-}n{|>a|crr\x079-}n{|>l ||z6H--}n{|>a|crr\x07-J-}n{|>a|crr\x07-7-zn@5}n{|>lznv\x076H--rpA-}n{|P|y|H--rpA-}n{|=P|y|-J-r\x07rPor5}n{|=lzn}9-}n{|=a|crr\x076H--rpA-}n{|>P|y|-J-r\x07rPor5}n{|>lzn}9-}n{|>a|crr\x076H--0vs-qrsv{rq5b`RlYbZV[N[PR6----}n{|=P|y|;n-J->;=-:-r\x07rPor5}n{|=lyzv{n{prZn}9-}n{|=a|crr\x076;H----}n{|>P|y|;n-J->;=-:-r\x07rPor5}n{|>lyzv{n{prZn}9-}n{|>a|crr\x076;H--0r{qvs--0vs-qrsv{rq5b`RlOYNPXla_N[`VaV\\[6----sy|n-oynpx]|tr-J-np|5:?;=-7-}|tr-8->;=6H----}n{|P|y|-J-zv\x075}n{|=P|y|9-OYNPXlP\\Y\\_9-zv{5>;=9-oynpx]|tr66H----}n{|P|y|-J-zv\x075}n{|P|y|9-}n{|>P|y|9-zn\x075=;=9-oynpx]|tr-:-]V-8->;=66H--0ryvs-qrsv{rq5b`Rl`]_RNQla_N[`VaV\\[6----rp?-prr{Pr{rP||q-J-r|yv|{-7-}v\x07ry_nv|-<-?;=H----sy|n-n{vv|{_nqv-J-qvn{pr5rp?5=;=9-=;=69-prr{Pr{rP||q6-7->;?H----sy|n-n{vv|{]|tr-J-qvn{pr5tylSntP||q;\x07\b9-prr{Pr{rP||q6-<-n{vv|{_nqvH----}n{|P|y|-J-zv\x075}n{|=P|y|9-}n{|>P|y|9-z||ur}5=;=9-=;?9-}|tr-:-n{vv|{]|tr66H--0ryr----}n{|P|y|-J-zv\x075}n{|=P|y|9-}n{|>P|y|9-}|tr6H--0r{qvs--tylSntP|y|-J-zv\x075}n{|P|y|9-tylSntP|y|9-z|qryNy}un6H--<<-JJJJJJJJJJJJJ--0v{pyqr-Is|tlsntzr{K--0v{pyqr-I}rzyv}yvrqlny}unlsntzr{K--0v{pyqr-Iqvurv{tlsntzr{K--0vs-qrsv{rq5b`RlRQY6----tylSntP|y|;n-J-Y|tQr}uH--0r{qvs\f"),meshPhongVertexShader=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=113,i=126,o=0,s="";return t[o].split(s).map(function(u){return u.charCodeAt(o)>i?u:String.fromCharCode((u.charCodeAt(o)+r)%i)}).join(s)}("0qrsv{r-]U\\[T0vs-qrsv{rq5b`RlRQY6--n\bv{t-sy|n-Y|tQr}uH0r{qvs0vs-qrsv{rq5b`RlcR_aRelZN_X6--nvor-sy|n-znxH0r{qvsn\bv{t-sy|n-V_||sZnxHn\bv{t-rpA-d|yq]|vv|{Hn\bv{t-rp@-PnzrnQvrpv|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vrZnv\x07h=jh=j9-vrZnv\x07h>jh=j9-vrZnv\x07h?jh=j9-vrZnv\x07h=jh>j9-vrZnv\x07h>jh>j9-vrZnv\x07h?jh>j9-vrZnv\x07h=jh?j9-vrZnv\x07h>jh?j9-vrZnv\x07h?jh?j6H--PnzrnQvrpv|{-J-{|znyv r5pnzrn_|nv|{Znv\x07-7-rp@5=;=9-=;=9-:>;=66H--0vs-qrsv{rq5b`RlRQY6----Y|tQr}u-J-y|t?5:z]|vv|{; 6H--0r{qvs--V_||sZnx-J-=;=H--0vs-qrsv{rq5b`RlcR_aRelZN_X6----V_||sZnx-J-r}5no5znx-:->;=69-=;>6H--0r{qvs--0v{pyqr-I|yq}|lrr\x07K--0v{pyqr-Ir{zn}lrr\x07K--0v{pyqr-Iunq|zn}lrr\x07K--0v{pyqr-Is|tlrr\x07K\f"),meshPhongFragmentShader=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=113,i=126,o=0,s="";return t[o].split(s).map(function(u){return u.charCodeAt(o)>i?u:String.fromCharCode((u.charCodeAt(o)+r)%i)}).join(s)}("0qrsv{r-]U\\[T0qrsv{r-OYNPXlP\\Y\\_-rpA5=;=EC9-=;>=C9-=;>AF9->;=6{vs|z-sy|n-sy||H{vs|z-nz}yrPor-}n{|=lzn}H{vs|z-znA-}n{|=lznv\x07H{vs|z-sy|n-}n{|=l ||zH0vs-qrsv{rq5b`RlYbZV[N[PR6--{vs|z-nz}yrPor-}n{|=lyzv{n{prZn}H0r{qvs{vs|z-nz}yrPor-}n{|>lzn}H{vs|z-znA-}n{|>lznv\x07H{vs|z-sy|n-}n{|>l ||zH0vs-qrsv{rq5b`RlYbZV[N[PR6--{vs|z-nz}yrPor-}n{|>lyzv{n{prZn}H0r{qvs{vs|z-sy|n-z|qryNy}unH{vs|z-sy|n-}|trH0vs-qrsv{rq5b`RlP\\[`aN[alP\\Y\\_6--{vs|z-rp@-p|{n{P|y|H0r{qvsp-Pyv}}r-\n--znA-znv\x07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|{9-rp@-rp|9-sy|n- ||z6-\n--sy|n-urn-J-q|5qvrpv|{9-rp|6H--rp@-q-J-qvrpv|{-7-urnH--rp@-}-J-rp|-:-qH--rp@-\0-J-}-7- ||zH--r{-{|znyv r5q-8-\x006H\f|vq-znv{56-\n--<<-JJJ-顶部裁切-JJJ--sy|n-||sP]|tr-J-}|5pynz}5:PnzrnQvrpv|{;\b9-=;=9->;=69-@;=6H--vs-5----V_||sZnx-K-=;B-33----d|yq]|vv|{;\b-K-z|qryO|{qv{tZn\x07;\b-:-||sP]|tr-7-5z|qryO|{qv{tZn\x07;\b-:-z|qryO|{qv{tZv{;\b6--6-\n----qvpnqH--\f--<<-JJJJJJJJJJJJJJ--<<-JJJ-前置裁切计算-JJJ--0vs-[bZlPYV]]R_`-K-=----o||y-pyv}}rqH----rpA-pyv}}r]|vv|{H----0}ntzn-{|yyly||}ln----s|-5-v{-v-J-=H-v-I-[bZlPYV]]R_`H-v-88-6-\n------pyv}}r]|vv|{-J-pyv}}rh-v-j;znv\x07V{rr-7-d|yq]|vv|{H------pyv}}rq-J-5pyv}}rh-v-j;sy||V{qr\x07-I-=;=-\v\v-no5sy||-:-pyv}}rh-v-j;sy||V{qr\x076-I->;=6H------pyv}}rq-J-pyv}}rq-33-pyv}}r]|vv|{;\x07-K-:=;B-33-pyv}}r]|vv|{;\x07-I-=;BH------pyv}}rq-J-pyv}}rq-33-pyv}}r]|vv|{;\b-K-:=;B-33-pyv}}r]|vv|{;\b-I-=;BH------pyv}}rq-J-pyv}}rq-33-pyv}}r]|vv|{; -K-:=;B-33-pyv}}r]|vv|{; -I-=;BH------vs-5pyv}}rq6-\n--------qvpnqH------\f----\f----0}ntzn-{|yyly||}lr{q--0r{qvs--<<-JJJJJJJJJJJJJJJJ--0v{pyqr-Ipyv}}v{tl}yn{rlsntzr{K--rpA-qvssrP|y|-J-rpA5-qvssr9-|}npv\b-6H--_rsyrprqYvtu-rsyrprqYvtu-J-_rsyrprqYvtu5-rp@5-=;=-69-rp@5-=;=-69-rp@5-=;=-69-rp@5-=;=-6-6H--rp@-|nyRzvvr_nqvn{pr-J-rzvvrH--0v{pyqr-Iy|tqr}uoslsntzr{K--0v{pyqr-Izn}lsntzr{K--0v{pyqr-Ip|y|lsntzr{K--0v{pyqr-Iny}unzn}lsntzr{K--0v{pyqr-Iny}unrlsntzr{K--0v{pyqr-I}rpynzn}lsntzr{K--0v{pyqr-I{|znylsntzr{lortv{K--0v{pyqr-I{|znylsntzr{lzn}K--0v{pyqr-Irzvvrzn}lsntzr{K--<<-nppzynv|{--0v{pyqr-Iyvtul}u|{tlsntzr{K--0v{pyqr-Iyvtulsntzr{lortv{K--0v{pyqr-Iyvtulsntzr{lzn}K--0v{pyqr-Iyvtulsntzr{lr{qK--<<-z|qynv|{--0v{pyqr-In|zn}lsntzr{K--rp@-|t|v{tYvtu-J-rsyrprqYvtu;qvrpQvssr-8-rsyrprqYvtu;v{qvrpQvssr-8-rsyrprqYvtu;qvrp`}rpyn-8-rsyrprqYvtu;v{qvrp`}rpyn-8-|nyRzvvr_nqvn{prH--0v{pyqr-Ir{zn}lsntzr{K--tylSntP|y|-J-rpA5-|t|v{tYvtu9-qvssrP|y|;n-6H--<<-JJJ-纯色-JJJ--0vs-qrsv{rq5b`RlP\\[`aN[alP\\Y\\_6----tylSntP|y|-J-rpA5p|{n{P|y|;9-p|{n{P|y|;t9-p|{n{P|y|;o9-|}npv\b6H--0r{qvs--<<-JJJJJJJJJJJ--<<-JJJ-楼层显示-JJJ--sy|n-sy||\\}npv\b-J->;=H--vs-5u|{Sy||V{qr\x07-K-:=;=>-33-no5sy||-:-u|{Sy||V{qr\x076-K-=;FF6-\n----sy||\\}npv\b-J-=;?-7-zv{55>;=-8-PnzrnQvrpv|{;\b69->;=6H--\f--tylSntP|y|;n-J-tylSntP|y|;n-7-sy||\\}npv\b-7-ovtu{rH--<<-JJJJJJJJJJJJJJ--0v{pyqr-I|{rzn}}v{tlsntzr{K--0v{pyqr-Ir{p|qv{tlsntzr{K--<<-JJJ-全景图-JJJ--rp@-}n{|=a|crr\x07-J-{|znyv r5d|yq]|vv|{;\x07\b -:-}n{|=lznv\x07h@j;\x07\b 6H--}n{|=a|crr\x07-J- ||zcrp|5PnzrnQvrpv|{9-}n{|=a|crr\x079-}n{|=l ||z6H--}n{|=a|crr\x07-J-}n{|=a|crr\x07-7-zn@5}n{|=lznv\x076H--rp@-}n{|>a|crr\x07-J-{|znyv r5d|yq]|vv|{;\x07\b -:-}n{|>lznv\x07h@j;\x07\b 6H--}n{|>a|crr\x07-J- ||zcrp|5PnzrnQvrpv|{9-}n{|>a|crr\x079-}n{|>l ||z6H--}n{|>a|crr\x07-J-}n{|>a|crr\x07-7-zn@5}n{|>lznv\x076H--rpA-}n{|P|y|H--rpA-}n{|=P|y|-J-r\x07rPor5}n{|=lzn}9-}n{|=a|crr\x076H--rpA-}n{|>P|y|-J-r\x07rPor5}n{|>lzn}9-}n{|>a|crr\x076H--0vs-qrsv{rq5b`RlYbZV[N[PR6----}n{|=P|y|;n-J->;=-:-r\x07rPor5}n{|=lyzv{n{prZn}9-}n{|=a|crr\x076;H----}n{|>P|y|;n-J->;=-:-r\x07rPor5}n{|>lyzv{n{prZn}9-}n{|>a|crr\x076;H--0r{qvs--0vs-qrsv{rq5b`RlOYNPXla_N[`VaV\\[6----sy|n-oynpx]|tr-J-np|5:?;=-7-}|tr-8->;=6H----}n{|P|y|-J-zv\x075}n{|=P|y|9-OYNPXlP\\Y\\_9-zv{5>;=9-oynpx]|tr66H----}n{|P|y|-J-zv\x075}n{|P|y|9-}n{|>P|y|9-zn\x075=;=9-oynpx]|tr-:-]V-8->;=66H--0ryvs-qrsv{rq5b`Rl`]_RNQla_N[`VaV\\[6----rp?-prr{Pr{rP||q-J-r|yv|{-7-}v\x07ry_nv|-<-?;=H----sy|n-n{vv|{_nqv-J-qvn{pr5rp?5=;=9-=;=69-prr{Pr{rP||q6-7->;?H----sy|n-n{vv|{]|tr-J-qvn{pr5tylSntP||q;\x07\b9-prr{Pr{rP||q6-<-n{vv|{_nqvH----}n{|P|y|-J-zv\x075}n{|=P|y|9-}n{|>P|y|9-z||ur}5=;=9-=;?9-}|tr-:-n{vv|{]|tr66H--0ryr----}n{|P|y|-J-zv\x075}n{|=P|y|9-}n{|>P|y|9-}|tr6H--0r{qvs--tylSntP|y|-J-zv\x075}n{|P|y|9-tylSntP|y|9-z|qryNy}un6H--<<-JJJJJJJJJJJJJJ--0v{pyqr-Is|tlsntzr{K--0v{pyqr-I}rzyv}yvrqlny}unlsntzr{K--0v{pyqr-Iqvurv{tlsntzr{K--0vs-qrsv{rq5b`RlRQY6----tylSntP|y|;n-J-Y|tQr}uH--0r{qvs\f");function coordinatesToVector(n,t){var e=Math.abs(Math.cos(n.latitude)),r=-Math.sin(n.longitude)*e,i=-Math.sin(n.latitude),o=-Math.cos(n.longitude)*e;return t?t.set(r,i,o):new THREE__namespace.Vector3(r,i,o)}var DEFAULT_ASPECT=1,DEFAULT_NEAR=.1,DEFAULT_FAR=2e3,TAU$2=Math.PI*2,PI_2=Math.PI/2;function formatRad$1(n){return n>0&&n<=TAU$2?n:(n%TAU$2+TAU$2)%TAU$2}function matrixLerp(n,t,e,r){e=Math.pow(e,4);for(var i=0;i<16;i++)r.elements[i]=n.elements[i]+(t.elements[i]-n.elements[i])*e;return r}var Camera=function(n){__extends(t,n);function t(e,r,i,o,s,u,c){r===void 0&&(r=DEFAULT_ASPECT),i===void 0&&(i=DEFAULT_NEAR),o===void 0&&(o=DEFAULT_FAR),s===void 0&&(s=new THREE__namespace.Vector2),u===void 0&&(u=new THREE__namespace.Vector2(512,512)),c===void 0&&(c=1);var l=n.call(this)||this;l.fov=e,l.aspect=r,l.near=i,l.far=o,l.perspToOrtho=s,l.resolution=u,l.pixelRatio=c,l.needsRender=!0,l.refineModel=!0,l.pose={longitude:0,latitude:0,fov:e,distance:0,offset:new THREE__namespace.Vector3},l.computePose(),l.perspectiveCamera=new THREE__namespace.PerspectiveCamera(l.fov,l.aspect,.001,l.far);var d=Math.max(l.orthoDistance,.01)*Math.tan(.5*l.fov/180*Math.PI),f=-.5*l.aspect*2*d;return l.orthographicCamera=new THREE__namespace.OrthographicCamera(f,-f,d,-d,.001,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,orthoDistance:l.orthoDistance,perspToOrtho:l.perspToOrtho.clone()},l.type=l.perspToOrtho.x<1?"PerspectiveCamera":"OrthographicCamera",l}return Object.defineProperty(t.prototype,"orthoDistance",{get:function(){return this.pose.distance>1?this.pose.distance:1+(this.pose.distance-1)*this.perspToOrtho.x},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"zoom",{get:function(){return this.type==="OrthographicCamera"?this.orthographicCamera.zoom:this.type==="PerspectiveCamera"?this.perspectiveCamera.zoom:1},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"top",{get:function(){return this.type==="OrthographicCamera"?this.orthographicCamera.top:0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"bottom",{get:function(){return this.type==="OrthographicCamera"?this.orthographicCamera.bottom:0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"left",{get:function(){return this.type==="OrthographicCamera"?this.orthographicCamera.left:0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"right",{get:function(){return this.type==="OrthographicCamera"?this.orthographicCamera.right:0},enumerable:!1,configurable:!0}),t.prototype.getDirection=function(e){return coordinatesToVector(this.pose,e)},t.prototype.computePose=function(e){e===void 0&&(e=0),this.updateMatrix();var r=this.matrix.elements;return this.pose.latitude=Math.asin(clamp$1(r[9],-1,1)),Math.abs(r[9])<.9999999?this.pose.longitude=formatRad$1(Math.atan2(r[8],r[10])):this.pose.longitude=formatRad$1(Math.atan2(-r[2],r[0])),this.pose.fov=this.fov,this.pose.distance=e,this.pose.offset=new THREE__namespace.Vector3(-r[8],-r[9],-r[10]).setLength(this.pose.distance).add(this.position),this},t.prototype.setFromPose=function(e){var r,i,o,s,u,c=formatRad$1((r=e.longitude)!==null&&r!==void 0?r:this.pose.longitude),l=Math.max(-PI_2+1e-4,Math.min(PI_2-1e-4,(i=e.latitude)!==null&&i!==void 0?i:this.pose.latitude)),d=(o=e.fov)!==null&&o!==void 0?o:this.pose.fov,f=(s=e.distance)!==null&&s!==void 0?s:this.pose.distance,v=(u=e.offset)!==null&&u!==void 0?u:this.pose.offset,A=coordinatesToVector({longitude:c,latitude:l}).normalize();return this.position.set(0,0,0),this.lookAt(A),this.position.add(v).sub(A.clone().setLength(f)),this.fov!==d&&(this.fov=d,this.updateProjectionMatrix()),this.updateMatrixWorld(),this.pose.longitude=c,this.pose.latitude=l,this.pose.fov=d,this.pose.distance=f,this.pose.offset.copy(v),this.needsRender=!0,this},t.prototype.copyPose=function(){return{longitude:this.pose.longitude,latitude:this.pose.latitude,fov:this.pose.fov,distance:this.pose.distance,offset:this.pose.offset.clone()}},t.prototype.computeProjectionMatrix=function(){matrixLerp(this.orthographicCamera.projectionMatrix,this.perspectiveCamera.projectionMatrix,1-this.perspToOrtho.x,this.projectionMatrix),this.projectionMatrixInverse.getInverse(this.projectionMatrix),this.needsRender=!0},t.prototype.setViewOffset=function(e,r,i,o,s,u){this.perspectiveCamera.setViewOffset(e,r,i,o,s,u),this.orthographicCamera.setViewOffset(e,r,i,o,s,u),this.computeProjectionMatrix()},t.prototype.clearViewOffset=function(){this.perspectiveCamera.clearViewOffset(),this.orthographicCamera.clearViewOffset(),this.computeProjectionMatrix()},t.prototype.updateProjectionMatrix=function(){this.perspectiveCamera.updateProjectionMatrix(),this.orthographicCamera.updateProjectionMatrix(),this.computeProjectionMatrix()},Object.defineProperty(t.prototype,"perspectiveProjectionMatrix",{get:function(){return this.perspectiveCamera.projectionMatrix},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"perspectiveProjectionMatrixInverse",{get:function(){return this.perspectiveCamera.projectionMatrixInverse},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"orthographicProjectionMatrix",{get:function(){return this.orthographicCamera.projectionMatrix},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"orthographicProjectionMatrixInverse",{get:function(){return this.orthographicCamera.projectionMatrixInverse},enumerable:!1,configurable:!0}),t.prototype.updateTime=function(e,r){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.perspToOrtho.equals(this.perspToOrtho)||this.lastValues.fov!==this.fov||this.lastValues.near!==this.near||this.lastValues.far!==this.far||this.lastValues.orthoDistance!==this.orthoDistance||this.lastValues.aspect!==this.aspect){var o=Math.max(this.orthoDistance,.01)*Math.tan(.5*this.fov/180*Math.PI),s=-.5*this.aspect*2*o;this.orthographicCamera.left=s,this.orthographicCamera.right=-s,this.orthographicCamera.top=o,this.orthographicCamera.bottom=-o,this.orthographicCamera.near=this.near,this.orthographicCamera.far=this.far,this.orthographicCamera.updateProjectionMatrix(),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.orthoDistance=this.orthoDistance,this.lastValues.perspToOrtho.copy(this.perspToOrtho),this.type=this.perspToOrtho.x<1?"PerspectiveCamera":"OrthographicCamera"},Object.defineProperty(t.prototype,"isPerspectiveCamera",{get:function(){return this.perspToOrtho.x<1},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isOrthographicCamera",{get:function(){return this.perspToOrtho.x>=1},enumerable:!1,configurable:!0}),t.prototype.copy=function(e,r){return n.prototype.copy.call(this,e,r),this.fov=e.fov,this.aspect=e.aspect,this.near=e.near,this.far=e.far,this.perspToOrtho.copy(e.perspToOrtho),this.updateTime(now(),0),this},t}(THREE__namespace.Camera),scratchVector4$1=new THREE__namespace.Vector4,pbmUniforms={modelAlpha:new THREE__namespace.Uniform(0),progress:new THREE__namespace.Uniform(0),pano0_map:new THREE__namespace.Uniform(null),pano0_luminanceMap:new THREE__namespace.Uniform(null),pano0_matrix:new THREE__namespace.Uniform(new THREE__namespace.Matrix4),pano0_zoom:new THREE__namespace.Uniform(1),pano1_map:new THREE__namespace.Uniform(null),pano1_luminanceMap:new THREE__namespace.Uniform(null),pano1_matrix:new THREE__namespace.Uniform(new THREE__namespace.Matrix4),pano1_zoom:new THREE__namespace.Uniform(1),clippers:new THREE__namespace.Uniform([]),shownFloorIndex:new THREE__namespace.Uniform(-1),constantColor:new THREE__namespace.Uniform(null),geometricError:new THREE__namespace.Uniform(0),pixelRatio:new THREE__namespace.Uniform(1),resolution:new THREE__namespace.Uniform(new THREE__namespace.Vector2(512,512)),floor:new THREE__namespace.Uniform(0),brightness:new THREE__namespace.Uniform(1),modelBoundingMin:new THREE__namespace.Uniform(new THREE__namespace.Vector3),modelBoundingMax:new THREE__namespace.Uniform(new THREE__namespace.Vector3)},shaderLib={none:{vertexShader:meshNoneVertexShader,fragmentShader:meshNoneFragmentShader,uniforms:THREE__namespace.UniformsUtils.merge([pbmUniforms,{opacity:{value:1}},THREE__namespace.UniformsLib.fog]),lights:!1},basic:{vertexShader:meshBasicVertexShader,fragmentShader:meshBasicFragmentShader,uniforms:THREE__namespace.UniformsUtils.merge([pbmUniforms,THREE__namespace.ShaderLib.basic.uniforms]),lights:!1},phong:{vertexShader:meshPhongVertexShader,fragmentShader:meshPhongFragmentShader,uniforms:THREE__namespace.UniformsUtils.merge([pbmUniforms,THREE__namespace.ShaderLib.phong.uniforms]),lights:!0}},PBMMeshMaterial=function(n){__extends(t,n);function t(e,r){e===void 0&&(e="basic"),r===void 0&&(r={});var i=this,o,s,u,c,l,d,f,v,A,h,p,y,m,g,E,b,T,_,S,R,B,I=shaderLib[e];i=n.call(this,{vertexShader:I.vertexShader,fragmentShader:I.fragmentShader,uniforms:THREE__namespace.UniformsUtils.clone(I.uniforms),lights:I.lights,defines:{USE_CONSTANT_COLOR:!1,USE_EDL:!1,USE_HQ_WEIGHT:!1,USE_HQ_DEPTH:!1,NUM_CLIPPING_BOX:!1,USE_CLIPFLOOR:!1,USE_VERTEX_MARK:!1,USE_LUMINANCE:!1,USE_PANO_OPACITY:!1,USE_BLACK_TRANSITION:!1,USE_SPREAD_TRANSITION:!1,USE_POINT_NORMAL:!1,USE_POINT_CIRCLE:!1,USE_POINT_ADAPTIVE_SIZE:!1,USE_POINT_COLOR_ALTITUDE:!1}})||this,i.shaderType=e,i.color=new THREE__namespace.Color(16777215),i.map=null,i.lightMap=null,i.lightMapIntensity=1,i.aoMap=null,i.aoMapIntensity=1,i.specularMap=null,i.specular=new THREE__namespace.Color(1118481),i.alphaMap=null,i.envMap=null,i.reflectivity=1,i.refractionRatio=.98,i.emissiveMap=null,i.emissive=new THREE__namespace.Color(0),i.emissiveIntensity=1,i.bumpMap=null,i.bumpScale=1,i.normalMap=null,i.normalMapType=THREE__namespace.TangentSpaceNormalMap,i.normalScale=new THREE__namespace.Vector2(1,1),i.displacementMap=null,i.displacementScale=1,i.displacementBias=0,i.shininess=30;var x,M=null,L=null;return Object.defineProperties(i,{pano0:{get:function(){return M},set:function(C){if(M!==C){M=C,C===null?(this.uniforms.pano0_map.value=null,this.uniforms.pano0_luminanceMap.value=null,this.uniforms.pano0_matrix.value.identity(),this.uniforms.pano0_zoom.value=1):(this.uniforms.pano0_map.value=C.map instanceof TileCubeTextureTarget?C.map.texture:C.map,this.uniforms.pano0_luminanceMap.value=C.luminanceMap instanceof TileCubeTextureTarget?C.luminanceMap.texture:C.luminanceMap,this.uniforms.pano0_matrix.value.copy(C.matrix),this.uniforms.pano0_zoom.value=C.zoom);var H=this.uniforms.pano0_luminanceMap.value!==null&&this.uniforms.pano1_luminanceMap.value!==null,F=this.defines.USE_LUMINANCE;F!==H&&(this.defines.USE_LUMINANCE=H,this.needsUpdate=!0)}}},pano1:{get:function(){return L},set:function(C){if(L!==C){L=C,C===null?(this.uniforms.pano1_map.value=null,this.uniforms.pano1_luminanceMap.value=null,this.uniforms.pano1_matrix.value.identity(),this.uniforms.pano1_zoom.value=1):(this.uniforms.pano1_map.value=C.map instanceof TileCubeTextureTarget?C.map.texture:C.map,this.uniforms.pano1_luminanceMap.value=C.luminanceMap instanceof TileCubeTextureTarget?C.luminanceMap.texture:C.luminanceMap,this.uniforms.pano1_matrix.value.copy(C.matrix),this.uniforms.pano1_zoom.value=C.zoom);var H=this.uniforms.pano0_luminanceMap.value!==null&&this.uniforms.pano1_luminanceMap.value!==null,F=this.defines.USE_LUMINANCE;F!==H&&(this.defines.USE_LUMINANCE=H,this.needsUpdate=!0)}}},modelAlpha:{get:function(){return this.uniforms.modelAlpha.value},set:function(C){this.uniforms.modelAlpha.value=C}},progress:{get:function(){return this.uniforms.progress.value},set:function(C){this.uniforms.progress.value=C}},transition:{get:function(){return this.defines.USE_BLACK_TRANSITION?"BLACK":this.defines.USE_SPREAD_TRANSITION?"SPREAD":"FADE"},set:function(C){var H=this.defines.USE_BLACK_TRANSITION,F=this.defines.USE_SPREAD_TRANSITION;this.defines.USE_BLACK_TRANSITION=!1,this.defines.USE_SPREAD_TRANSITION=!1,this.defines["USE_".concat(C,"_TRANSITION")]=!0;var O=!1;H!==this.defines.USE_BLACK_TRANSITION&&(O=!0),F!==this.defines.USE_SPREAD_TRANSITION&&(O=!0),O&&(this.needsUpdate=!0)}},constantColor:{get:function(){return this.uniforms.constantColor.value},set:function(C){this.uniforms.constantColor.value=C;var H=this.defines.USE_CONSTANT_COLOR,F=C!==null;H!==F&&(this.defines.USE_CONSTANT_COLOR=F,this.needsUpdate=!0)}},opacity:{get:function(){return this.uniforms.opacity.value},set:function(C){this.uniforms.opacity.value=C}},shownFloorIndex:{get:function(){return this.uniforms.shownFloorIndex.value},set:function(C){this.uniforms.shownFloorIndex.value=C}},brightness:{get:function(){return this.uniforms.brightness.value},set:function(C){this.uniforms.brightness.value=C}},clippers:{get:function(){return x},set:function(C){x!==C&&(x=C,this.uniforms.clippers.value=(x||[]).map(function(H){var F=typeof H.floorIndex=="number"?H.floorIndex:-1,O=new THREE__namespace.Matrix4().getInverse(H.clippingBoxMatrix);return{matrixInverse:O,floorIndex:F}}),this.needsUpdate=!0)}},useEDL:{get:function(){return this.defines.USE_EDL},set:function(C){C!==this.defines.USE_EDL&&(this.defines.USE_EDL=C,this.needsUpdate=!0)}},useHQWeight:{get:function(){return this.defines.USE_HQ_WEIGHT},set:function(C){C!==this.defines.USE_HQ_WEIGHT&&(this.defines.USE_HQ_WEIGHT=C,this.needsUpdate=!0)}},useHQDepth:{get:function(){return this.defines.USE_HQ_DEPTH},set:function(C){C!==this.defines.USE_HQ_DEPTH&&(this.defines.USE_HQ_DEPTH=C,this.needsUpdate=!0)}},floor:{get:function(){return this.uniforms.floor.value},set:function(C){this.uniforms.floor.value=C}}}),i.pano0=(o=r.pano0)!==null&&o!==void 0?o:defaultPbmParameters.pano0,i.pano1=(s=r.pano1)!==null&&s!==void 0?s:defaultPbmParameters.pano1,i.modelAlpha=(u=r.modelAlpha)!==null&&u!==void 0?u:defaultPbmParameters.modelAlpha,i.progress=(c=r.progress)!==null&&c!==void 0?c:defaultPbmParameters.progress,i.transition=(l=r.transition)!==null&&l!==void 0?l:defaultPbmParameters.transition,i.constantColor=(d=r.constantColor)!==null&&d!==void 0?d:defaultPbmParameters.constantColor,i.opacity=(f=r.opacity)!==null&&f!==void 0?f:defaultPbmParameters.opacity,i.shownFloorIndex=(v=r.shownFloorIndex)!==null&&v!==void 0?v:defaultPbmParameters.shownFloorIndex,i.clippers=(A=r.clippers)!==null&&A!==void 0?A:defaultPbmParameters.clippers,i.useEDL=(h=r.useEDL)!==null&&h!==void 0?h:defaultPbmParameters.useEDL,i.useHQWeight=(p=r.useHQWeight)!==null&&p!==void 0?p:defaultPbmParameters.useHQWeight,i.useHQDepth=(y=r.useHQDepth)!==null&&y!==void 0?y:defaultPbmParameters.useHQDepth,i.pointSize=(m=r.pointSize)!==null&&m!==void 0?m:defaultPbmParameters.pointSize,i.pointColor=(g=r.pointColor)!==null&&g!==void 0?g:defaultPbmParameters.pointColor,i.pointShape=(E=r.pointShape)!==null&&E!==void 0?E:defaultPbmParameters.pointShape,i.pointScale=(b=r.pointScale)!==null&&b!==void 0?b:defaultPbmParameters.pointScale,i.pointBack=(T=r.pointBack)!==null&&T!==void 0?T:defaultPbmParameters.pointBack,i.pointMinPixel=(_=r.pointMinPixel)!==null&&_!==void 0?_:defaultPbmParameters.pointMinPixel,i.pointMaxPixel=(S=r.pointMaxPixel)!==null&&S!==void 0?S:defaultPbmParameters.pointMaxPixel,i.gradientTexture=(R=r.gradientTexture)!==null&&R!==void 0?R:defaultPbmParameters.gradientTexture,i.brightness=(B=r.brightness)!==null&&B!==void 0?B:defaultPbmParameters.brightness,i.floor=0,i.transparent=!0,i}return t.prototype.onBeforeCompile=function(e,r){var i,o,s=String((o=(i=this.clippers)===null||i===void 0?void 0:i.length)!==null&&o!==void 0?o:0);e.vertexShader=e.vertexShader.replace(/NUM_CLIPPERS/g,s),e.fragmentShader=e.fragmentShader.replace(/NUM_CLIPPERS/g,s)},t.prototype.refreshUniforms=function(e){var r,i,o=this.uniforms;o.diffuse&&o.diffuse.value.copy(this.color),o.opacity&&(o.opacity.value=this.opacity),o.color&&o.diffuse.value.copy(this.color),o.emissive&&o.emissive.value.copy(this.emissive).multiplyScalar(this.emissiveIntensity),o.map&&(o.map.value=this.map),o.alphaMap&&(o.alphaMap.value=this.alphaMap),o.specularMap&&(o.specularMap.value=this.specularMap),o.envMap&&(o.envMap.value=this.envMap,o.flipEnvMap.value=!((r=this.envMap)===null||r===void 0)&&r.isCubeTexture?-1:1,o.reflectivity.value=this.reflectivity,o.refractionRatio.value=this.refractionRatio,o.maxMipLevel.value=this.envMap&&(i=e.properties.get(this.envMap).__maxMipLevel)!==null&&i!==void 0?i:0),o.lightMap&&(o.lightMap.value=this.lightMap,o.lightMapIntensity.value=this.lightMapIntensity),o.aoMap&&(o.aoMap.value=this.aoMap,o.aoMapIntensity.value=this.aoMapIntensity),o.specular&&o.specular.value.copy(this.specular),o.shininess&&(o.shininess.value=Math.max(this.shininess,1e-4)),o.emissiveMap&&(o.emissiveMap.value=this.emissiveMap),o.bumpMap&&(o.bumpMap.value=this.bumpMap,o.bumpScale.value=this.bumpScale,this.side===THREE__namespace.BackSide&&(o.bumpScale.value*=-1)),o.normalMap&&(o.normalMap.value=this.normalMap,o.normalScale.value.copy(this.normalScale),this.side===THREE__namespace.BackSide&&o.normalScale.value.negate()),o.displacementMap&&(o.displacementMap.value=this.displacementMap,o.displacementScale.value=this.displacementScale,o.displacementBias.value=this.displacementBias);var s;this.map?s=this.map:this.specularMap?s=this.specularMap:this.displacementMap?s=this.displacementMap:this.normalMap?s=this.normalMap:this.bumpMap?s=this.bumpMap:this.alphaMap?s=this.alphaMap:this.emissiveMap&&(s=this.emissiveMap),s!==void 0&&(s.matrixAutoUpdate===!0&&s.updateMatrix(),o.uvTransform.value.copy(s.matrix));var u;this.aoMap?u=this.aoMap:this.lightMap&&(u=this.lightMap),u!==void 0&&(u.matrixAutoUpdate===!0&&u.updateMatrix(),o.uv2Transform.value.copy(u.matrix))},t.prototype.update=function(e,r){if(this.refreshUniforms(e),this.transparent=!1,this.shownFloorIndex>-1&&(this.transparent=this.shownFloorIndex!==this.floor),this.opacity<1&&(this.transparent=!0),this.alphaMap&&(this.transparent=!0),this.brightness<1&&(this.transparent=!0),this.depthTest=!0,this.depthWrite=!0,this.shaderType==="none"?this.depthWrite=!1:this.transparent&&(this.depthWrite=!1),r instanceof Camera)this.uniforms.pixelRatio.value=r.pixelRatio,this.uniforms.resolution.value.copy(r.resolution);else{this.uniforms.pixelRatio.value=e.getPixelRatio();var i=e.getViewport(scratchVector4$1);this.uniforms.resolution.value.set(i.z,i.w)}},t.prototype.syncModel=function(e){var r="".concat(e.id,":").concat(e.materialVersion);r!==this.syncModelVersion&&(Object.assign(this,e.getMaterial()),this.uniforms.modelBoundingMax.value.copy(e.bounding.max),this.uniforms.modelBoundingMin.value.copy(e.bounding.min),this.syncModelVersion=r)},t.prototype.copy=function(e){return n.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.specular.copy(e.specular),this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.emissiveMap=e.emissiveMap,this.emissive.copy(e.emissive),this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.shininess=e.shininess,this.pano0=e.pano0,this.pano1=e.pano1,this.modelAlpha=e.modelAlpha,this.progress=e.progress,this.transition=e.transition,this.opacity=e.opacity,this.constantColor=e.constantColor,this.shownFloorIndex=e.shownFloorIndex,this.brightness=e.brightness,this.clippers=e.clippers,this.useEDL=e.useEDL,this.useHQWeight=e.useHQWeight,this.useHQDepth=e.useHQDepth,this.pointColor=e.pointColor,this.pointSize=e.pointSize,this.pointShape=e.pointShape,this.pointScale=e.pointScale,this.pointBack=e.pointBack,this.pointMinPixel=e.pointMinPixel,this.pointMaxPixel=e.pointMaxPixel,this.gradientTexture=e.gradientTexture,this.floor=e.floor,this},t}(THREE__namespace.ShaderMaterial),InternalWebGLRenderer=function(n){__extends(t,n);function t(e){var r=e.preserveDrawingBuffer,i=r===void 0?!0:r,o=e.premultipliedAlpha,s=o===void 0?!0:o,u=e.stencil,c=u===void 0?!0:u,l=e.backgroundColor,d=l===void 0?1579548:l,f=e.backgroundAlpha,v=f===void 0?1:f,A=e.pixelRatio,h=A===void 0?1:A,p=e.antialias,y=e.webgl2,m=e.logarithmicDepthBuffer,g=e.precision,E=this,b={antialias:p,alpha:!0,depth:!0,preserveDrawingBuffer:i,stencil:c,premultipliedAlpha:s,powerPreference:"high-performance"},T={logarithmicDepthBuffer:m,precision:g};if(y){var _=document.createElement("canvas"),S=_.getContext("webgl2",b);S?E=n.call(this,__assign(__assign(__assign({},b),T),{antialias:!0,canvas:_,context:S}))||this:(console.error("error occurred when getting webgl2 canvas context, mybe webgl2 not support, fallback to webgl."),E=n.call(this,__assign(__assign({},b),T))||this)}else E=n.call(this,__assign(__assign({},b),T))||this;return E.setPixelRatio(h),E.setClearColor(d,v),E.outputEncoding=THREE__namespace.sRGBEncoding,E.autoClear=!0,E}return t}(THREE__namespace.WebGLRenderer),Scene=function(n){__extends(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t.prototype.add=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return n.prototype.add.apply(this,e)},t.prototype.remove=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return n.prototype.remove.apply(this,e)},t}(THREE__namespace.Scene),VolumePlaneIntersect;(function(n){n[n.Outside=-1]="Outside",n[n.Intersecting=0]="Intersecting",n[n.Inside=1]="Inside"})(VolumePlaneIntersect||(VolumePlaneIntersect={}));var EPSILON$2=1e-6,scratchVector=new THREE__namespace.Vector3,scratchMatrix4$4=new THREE__namespace.Matrix4,scratchXAxis=new THREE__namespace.Vector3,scratchYAxis=new THREE__namespace.Vector3,scratchZAxis=new THREE__namespace.Vector3,scratchSize=new THREE__namespace.Vector3,scratchBox3=new THREE__namespace.Box3,scratchSphere$1=new THREE__namespace.Sphere,scratchMatrix4Inverse$1=new THREE__namespace.Matrix4,scratchRay$1=new THREE__namespace.Ray,scratchObject3D=new THREE__namespace.Object3D,scratchFrustum=new THREE__namespace.Frustum;function quaternionFromMatrix3(n,t){var e=n.elements;return t.setFromRotationMatrix(scratchMatrix4$4.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1)),t}var CullingVolume=function(){function n(t){t===void 0&&(t=[]),this.planes=t}return Object.defineProperty(n,"MASK_OUTSIDE",{get:function(){return 4294967295},enumerable:!1,configurable:!0}),Object.defineProperty(n,"MASK_INSIDE",{get:function(){return 0},enumerable:!1,configurable:!0}),Object.defineProperty(n,"MASK_INDETERMINATE",{get:function(){return 2147483647},enumerable:!1,configurable:!0}),n.prototype.setFromFrustum=function(t){return this.planes=t.planes.map(function(e){return e.clone()}),this},n.prototype.setFromCamera=function(t){return scratchMatrix4$4.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),scratchFrustum.setFromProjectionMatrix(scratchMatrix4$4),this.setFromFrustum(scratchFrustum),this},n.prototype.applyMatrix4=function(t){for(var e=0,r=this.planes;e<r.length;e++){var i=r[e];i.applyMatrix4(t)}},n.prototype.copy=function(t){return this.planes=t.planes.map(function(e){return e.clone()}),this},n.prototype.clone=function(){return new n().copy(this)},n.prototype.computeVisibility=function(t){for(var e=VolumePlaneIntersect.Inside,r=0,i=this.planes;r<i.length;r++){var o=i[r],s=t.intersectPlane(o);switch(s){case VolumePlaneIntersect.Outside:return VolumePlaneIntersect.Outside;case VolumePlaneIntersect.Intersecting:e=VolumePlaneIntersect.Intersecting;break}}return e},n.prototype.computeVisibilityWithPlaneMask=function(t,e){if(e===n.MASK_OUTSIDE||e===n.MASK_INSIDE)return e;for(var r=n.MASK_INSIDE,i=Math.min(32,this.planes.length),o=0;o<i;++o){var s=1<<o;if(e&s){var u=this.planes[o],c=t.intersectPlane(u);if(c===VolumePlaneIntersect.Outside)return n.MASK_OUTSIDE;c===VolumePlaneIntersect.Intersecting&&(r|=s)}}return r},n}(),BoxBoundingVolume=function(){function n(){this.type="box",this.center=new THREE__namespace.Vector3,this.halfSize=new THREE__namespace.Vector3,this.rotation=new THREE__namespace.Matrix3}return n.prototype.fromJson=function(t){var e=t.box;this.center.set(e[0],e[1],e[2]);var r=e[3],i=e[4],o=e[5],s=e[6],u=e[7],c=e[8],l=e[9],d=e[10],f=e[11],v=Math.sqrt(r*r+i*i+o*o),A=Math.sqrt(s*s+u*u+c*c),h=Math.sqrt(l*l+d*d+f*f);this.halfSize.set(v,A,h);var p=this.halfSize.toArray().reduce(function(y,m){return y+m},0);return(isNaN(p)||p<=0)&&this.halfSize.setScalar(EPSILON$2),this.rotation.fromArray([r/v,i/v,o/v,s/A,u/A,c/A,l/h,d/h,f/h]),isNaN(this.rotation.toArray().reduce(function(y,m){return y+m},0))&&this.rotation.identity(),this},n.prototype.toJson=function(){return this.rotation.extractBasis(scratchXAxis,scratchYAxis,scratchZAxis),{box:__spreadArray(__spreadArray(__spreadArray(__spreadArray([],this.center.toArray(),!0),scratchXAxis.multiplyScalar(this.halfSize.x).toArray(),!0),scratchYAxis.multiplyScalar(this.halfSize.y).toArray(),!0),scratchZAxis.multiplyScalar(this.halfSize.z).toArray(),!0)}},n.prototype.copy=function(t){return this.center.copy(t.center),this.halfSize.copy(t.halfSize),this.rotation.copy(t.rotation),this},n.prototype.clone=function(){return new n().copy(this)},n.prototype.applyMatrix4=function(t){return scratchObject3D.position.copy(this.center),quaternionFromMatrix3(this.rotation,scratchObject3D.quaternion),scratchObject3D.scale.copy(this.halfSize),scratchObject3D.matrix.compose(scratchObject3D.position,scratchObject3D.quaternion,scratchObject3D.scale),scratchObject3D.matrix.premultiply(t),scratchObject3D.matrix.decompose(scratchObject3D.position,scratchObject3D.quaternion,scratchObject3D.scale),this.center.copy(scratchObject3D.position),this.rotation.setFromMatrix4(scratchMatrix4$4.makeRotationFromQuaternion(scratchObject3D.quaternion)),this.halfSize.copy(scratchObject3D.scale),this},n.prototype.getCenter=function(t){return t.copy(this.center)},n.prototype.distanceSquaredToPoint=function(t){var e=this.rotation.elements,r=t.x-this.center.x,i=t.y-this.center.y,o=t.z-this.center.z,s=0,u;return u=r*e[0]+i*e[1]+o*e[2],u<0&&(u=-u),u-=this.halfSize.x,u>0&&(s+=u*u),u=r*e[3]+i*e[4]+o*e[5],u<0&&(u=-u),u-=this.halfSize.y,u>0&&(s+=u*u),u=r*e[6]+i*e[7]+o*e[8],u<0&&(u=-u),u-=this.halfSize.z,u>0&&(s+=u*u),s},n.prototype.distanceToPoint=function(t){return Math.sqrt(this.distanceSquaredToPoint(t))},n.prototype.distanceToPlane=function(t){var e=t.projectPoint(this.center,new THREE__namespace.Vector3);return this.distanceToPoint(e)},n.prototype.getBoundingBox=function(t){return t.makeEmpty(),this.rotation.extractBasis(scratchXAxis,scratchYAxis,scratchZAxis),scratchXAxis.setLength(this.halfSize.x),scratchYAxis.setLength(this.halfSize.y),scratchZAxis.setLength(this.halfSize.z),t.expandByPoint(scratchVector.copy(this.center).add(scratchXAxis)),t.expandByPoint(scratchVector.copy(this.center).sub(scratchXAxis)),t.expandByPoint(scratchVector.copy(this.center).add(scratchYAxis)),t.expandByPoint(scratchVector.copy(this.center).sub(scratchYAxis)),t.expandByPoint(scratchVector.copy(this.center).add(scratchZAxis)),t.expandByPoint(scratchVector.copy(this.center).sub(scratchZAxis)),t},n.prototype.toGeometry=function(){var t=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),e=new Float32Array(8*3);scratchVector.set(this.halfSize.x,this.halfSize.y,this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,0),scratchVector.set(-this.halfSize.x,this.halfSize.y,this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,3),scratchVector.set(-this.halfSize.x,-this.halfSize.y,this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,6),scratchVector.set(this.halfSize.x,-this.halfSize.y,this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,9),scratchVector.set(this.halfSize.x,this.halfSize.y,-this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,12),scratchVector.set(-this.halfSize.x,this.halfSize.y,-this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,15),scratchVector.set(-this.halfSize.x,-this.halfSize.y,-this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,18),scratchVector.set(this.halfSize.x,-this.halfSize.y,-this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,21);var r=new THREE__namespace.BufferGeometry;return r.setIndex(new THREE__namespace.BufferAttribute(t,1)),r.setAttribute("position",new THREE__namespace.BufferAttribute(e,3)),r.computeBoundingBox(),r.computeBoundingSphere(),r},n.prototype.intersectPlane=function(t){var e=this.center,r=t.normal,i=this.rotation.elements,o=this.halfSize,s=r.x,u=r.y,c=r.z,l=Math.abs(s*i[0]*o.x+u*i[1]*o.x+c*i[2]*o.x)+Math.abs(s*i[3]*o.y+u*i[4]*o.y+c*i[5]*o.y)+Math.abs(s*i[6]*o.z+u*i[7]*o.z+c*i[8]*o.z),d=r.dot(e)+t.constant;return d<=-l?VolumePlaneIntersect.Outside:d>=l?VolumePlaneIntersect.Inside:VolumePlaneIntersect.Intersecting},n.prototype.intersectRay=function(t,e){if(scratchSize.copy(this.halfSize).multiplyScalar(2),scratchBox3.setFromCenterAndSize(scratchVector.set(0,0,0),scratchSize),this.rotation.extractBasis(scratchXAxis,scratchYAxis,scratchZAxis),scratchMatrix4$4.makeBasis(scratchXAxis,scratchYAxis,scratchZAxis),scratchMatrix4$4.setPosition(this.center),scratchMatrix4Inverse$1.getInverse(scratchMatrix4$4),scratchRay$1.copy(t).applyMatrix4(scratchMatrix4Inverse$1),scratchBox3.containsPoint(scratchRay$1.origin))return!0;var r=scratchRay$1.intersectBox(scratchBox3,scratchVector);return r?e!==void 0?r.applyMatrix4(scratchMatrix4$4).distanceTo(t.origin)<e:!0:!1},n}(),SphereBoundingVolume=function(){function n(){this.type="sphere",this.center=new THREE__namespace.Vector3,this.radius=-1}return n.prototype.fromJson=function(t){var e=t.sphere;return this.center.set(e[0],e[1],e[2]),this.radius=Math.max(e[3],EPSILON$2),this},n.prototype.toJson=function(){return{sphere:__spreadArray(__spreadArray([],this.center.toArray(),!0),[this.radius],!1)}},n.prototype.copy=function(t){return this.center.copy(t.center),this.radius=t.radius,this},n.prototype.clone=function(){return new n().copy(this)},n.prototype.getBoundingBox=function(t){return t.setFromCenterAndSize(this.center,scratchSize.set(1,1,1).multiplyScalar(this.radius*2)),t},n.prototype.toGeometry=function(){for(var t=32,e=new Float32Array(t*3*2*2),r=0;r<=t;r++){var i=0;i=r/t*Math.PI*2,e[r*6+0]=this.center.x+Math.cos(i)*this.radius,e[r*6+1]=this.center.y+Math.sin(i)*this.radius,e[r*6+2]=this.center.z+0,i=(r+1)/t*Math.PI*2,e[r*6+3]=this.center.x+Math.cos(i)*this.radius,e[r*6+4]=this.center.y+Math.sin(i)*this.radius,e[r*6+5]=this.center.z+0}for(var r=t;r<=t*2;r++){var i=0;i=r/t*Math.PI*2,e[r*6+0]=this.center.x+Math.cos(i)*this.radius,e[r*6+1]=this.center.y+0,e[r*6+2]=this.center.z+Math.sin(i)*this.radius,i=(r+1)/t*Math.PI*2,e[r*6+3]=this.center.x+Math.cos(i)*this.radius,e[r*6+4]=this.center.y+0,e[r*6+5]=this.center.z+Math.sin(i)*this.radius}var o=new THREE__namespace.BufferGeometry;return o.setAttribute("position",new THREE__namespace.BufferAttribute(e,3)),o.computeBoundingBox(),o.computeBoundingSphere(),o},n.prototype.applyMatrix4=function(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this},n.prototype.getCenter=function(t){return t.copy(this.center)},n.prototype.distanceSquaredToPoint=function(t){var e=this.distanceToPoint(t);return e*e},n.prototype.distanceToPoint=function(t){var e=this.center.distanceTo(t)-this.radius;return e<=0?0:e},n.prototype.distanceToPlane=function(t){var e=Math.abs(t.distanceToPoint(this.center));return Math.max(0,e-this.radius)},n.prototype.intersectPlane=function(t){var e=this.center,r=this.radius,i=t.normal,o=i.dot(e)+t.constant;return o<-r?VolumePlaneIntersect.Outside:o<r?VolumePlaneIntersect.Intersecting:VolumePlaneIntersect.Inside},n.prototype.intersectRay=function(t,e){if(scratchSphere$1.set(this.center,this.radius),scratchSphere$1.containsPoint(t.origin))return!0;var r=t.intersectSphere(scratchSphere$1,scratchVector);return r?e!==void 0?t.origin.distanceTo(r)<e:!0:!1},n}(),RegionBoundingVolume=function(){function n(){throw this.type="regin",this.west=0,this.south=0,this.east=0,this.north=0,this.minHeight=0,this.maxHeight=0,new Error("Region bounding volume not supported.")}return n.prototype.fromJson=function(t){var e=t.region;return this.west=e[0],this.south=e[1],this.east=e[2],this.north=e[3],this.minHeight=e[4],this.maxHeight=e[5],this},n.prototype.toJson=function(){return{region:[this.west,this.south,this.east,this.north,this.minHeight,this.maxHeight]}},n.prototype.copy=function(t){return this.west=t.west,this.south=t.south,this.east=t.east,this.north=t.north,this.minHeight=t.minHeight,this.maxHeight=t.maxHeight,this},n.prototype.clone=function(){return new n().copy(this)},n.prototype.getBoundingBox=function(t){throw new Error("not implemented")},n.prototype.toGeometry=function(){throw new Error("not implemented")},n.prototype.applyMatrix4=function(t){throw new Error("not implemented")},n.prototype.getCenter=function(t){throw new Error("not implemented")},n.prototype.distanceToPoint=function(t){throw new Error("not implemented")},n.prototype.distanceSquaredToPoint=function(t){throw new Error("not implemented")},n.prototype.distanceToPlane=function(t){throw new Error("not implemented")},n.prototype.intersectPlane=function(t){throw new Error("not implemented")},n.prototype.intersectRay=function(t){throw new Error("not implemented")},n}();function makeBoundingVolume(n){if("box"in n)return new BoxBoundingVolume().fromJson(n);if("sphere"in n)return new SphereBoundingVolume().fromJson(n);if("region"in n)return new RegionBoundingVolume().fromJson(n);throw new Error("BoundingVolume ".concat(JSON.stringify(n)," never suppored."))}var debugMaterials=[4821759,8191922,16637280,16739958,5822969,376977,16747077,9259235,14514687].map(function(n){return new THREE__namespace.LineBasicMaterial({color:n,depthWrite:!1,depthTest:!1,transparent:!0})}),debugBoxGeometry=function(){var n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),t=new Float32Array(8*3);scratchVector.set(1,1,1).toArray(t,0),scratchVector.set(-1,1,1).toArray(t,3),scratchVector.set(-1,-1,1).toArray(t,6),scratchVector.set(1,-1,1).toArray(t,9),scratchVector.set(1,1,-1).toArray(t,12),scratchVector.set(-1,1,-1).toArray(t,15),scratchVector.set(-1,-1,-1).toArray(t,18),scratchVector.set(1,-1,-1).toArray(t,21);var e=new THREE__namespace.BufferGeometry;return e.setIndex(new THREE__namespace.BufferAttribute(n,1)),e.setAttribute("position",new THREE__namespace.BufferAttribute(t,3)),e.computeBoundingBox(),e.computeBoundingSphere(),e}(),debugSphereGeometry=function(){for(var n=32,t=new Float32Array(n*3*2*2),e=0;e<=n;e++){var r=0;r=e/n*Math.PI*2,t[e*6+0]=Math.cos(r),t[e*6+1]=Math.sin(r),t[e*6+2]=0,r=(e+1)/n*Math.PI*2,t[e*6+3]=Math.cos(r),t[e*6+4]=Math.sin(r),t[e*6+5]=0}for(var e=n;e<=n*2;e++){var r=0;r=e/n*Math.PI*2,t[e*6+0]=Math.cos(r),t[e*6+1]=0,t[e*6+2]=Math.sin(r),r=(e+1)/n*Math.PI*2,t[e*6+3]=Math.cos(r),t[e*6+4]=0,t[e*6+5]=Math.sin(r)}var i=new THREE__namespace.BufferGeometry;return i.setAttribute("position",new THREE__namespace.BufferAttribute(t,3)),i.computeBoundingBox(),i.computeBoundingSphere(),i}();function createDebugBoundingMesh(n,t){if(n instanceof BoxBoundingVolume){var e=new THREE__namespace.LineSegments(debugBoxGeometry,debugMaterials[Math.min(t,debugMaterials.length-1)]);return e.position.copy(n.center),quaternionFromMatrix3(n.rotation,e.quaternion),e.scale.set(n.halfSize.x,n.halfSize.y,n.halfSize.z),e.matrix.compose(e.position,e.quaternion,e.scale),e}else if(n instanceof SphereBoundingVolume){var e=new THREE__namespace.LineSegments(debugSphereGeometry,debugMaterials[Math.min(t,debugMaterials.length-1)]);return e.position.copy(n.center),e.scale.set(n.radius,n.radius,n.radius),e.matrix.compose(e.position,e.quaternion,e.scale),e}throw new Error("never")}var scratchVector3$4=new THREE__namespace.Vector3,Tile=function(){function n(t,e,r,i){var o=this,s,u,c,l;this.parent=null,this.floor=0,this.id=t,this.state={visible:!1,frameNumber:0,selectedFrameNumber:0,requestedFrameNumber:0,touchedFrameNumber:0,distanceToCamera:0,centerZDepth:0,screenSpaceError:0,visibilityPlaneMask:0,inRequestVolume:!1,shouldRefine:!1,stackLength:0,finalResolution:!0,selectionDepth:0,shouldSelect:!1,lastSelect:!1,ancestorWithContent:null,ancestorWithContentAvailable:null},this.parent=i!=null?i:null,this.level=this.parent?this.parent.level+1:0,this.tileset=r,this.refine=(s=e.refine)!==null&&s!==void 0?s:this.parent?this.parent.refine:"REPLACE",this.transform=new THREE__namespace.Matrix4,e.transform&&this.transform.fromArray(e.transform),this.parent&&this.transform.premultiply(this.parent.transform),typeof e.geometricError=="number"?this.geometricError=e.geometricError*this.transform.getMaxScaleOnAxis():this.geometricError=(c=(u=this.parent)===null||u===void 0?void 0:u.geometricError)!==null&&c!==void 0?c:0,e.content&&e.content.uri?(this.content={uri:e.content.uri,loadState:"UNLOADED",byteLength:0},e.content.group!==void 0&&(this.content.group=e.content.group),e.content.boundingVolume&&(this.content.boundingVolume=makeBoundingVolume(e.content.boundingVolume).applyMatrix4(this.transform)),/\.json$/.test(this.content.uri)?this.type="TILESET":this.type="SCENEGRAPH"):(this.content=null,this.type="EMPTY"),this.levelOfContent=this.parent?this.parent.levelOfContent:-1,this.type==="SCENEGRAPH"&&(this.levelOfContent=this.levelOfContent+1),e.boundingVolume&&(this.boundingVolume=makeBoundingVolume(e.boundingVolume).applyMatrix4(this.transform)),e.viewerRequestVolume&&(this.viewerRequestVolume=makeBoundingVolume(e.viewerRequestVolume).applyMatrix4(this.transform)),this.extras=(l=e.extras)!==null&&l!==void 0?l:{},typeof this.extras.floor!="number"&&i&&typeof i.extras.floor=="number"&&(this.extras.floor=i.extras.floor),typeof this.extras.floor=="number"&&(this.floor=this.extras.floor),this.boundingVolume&&(this.boundingVolumeDebugObject=createDebugBoundingMesh(this.boundingVolume,this.levelOfContent)),e.children?this.children=e.children.map(function(d,f){return new n("".concat(o.id,".").concat(f),d,r,o)}):this.children=[]}return n.prototype.traverse=function(t){t(this);for(var e=0,r=this.children;e<r.length;e++){var i=r[e];i.traverse(t)}},n.prototype.updateState=function(t){this.state.frameNumber=t.frameNumber;var e=this.tileset.transformIsIdentity?null:this.tileset.transform;if(this.boundingVolume){var r=e?this.boundingVolume.clone().applyMatrix4(e):this.boundingVolume;if(t.camera.type==="OrthographicCamera"){var i=new THREE__namespace.Plane().setFromNormalAndCoplanarPoint(t.camera.direction,t.camera.position);this.state.distanceToCamera=r.distanceToPlane(i)}else this.state.distanceToCamera=r.distanceToPoint(t.camera.position);var o=r.getCenter(scratchVector3$4).sub(t.camera.position);this.state.centerZDepth=t.camera.direction.dot(o);var s=this.parent?this.parent.state.visibilityPlaneMask:CullingVolume.MASK_INDETERMINATE;this.state.visibilityPlaneMask=t.cullingVolume.computeVisibilityWithPlaneMask(r,s),this.state.visible=this.state.visibilityPlaneMask!==CullingVolume.MASK_OUTSIDE}else this.state.distanceToCamera=0,this.state.centerZDepth=0,this.state.visibilityPlaneMask=CullingVolume.MASK_INDETERMINATE,this.state.visible=!0;if(this.state.distanceToCamera<t.camera.near&&(this.state.distanceToCamera=t.camera.near),this.levelOfContent<=t.minLevelOfDetail&&(this.state.visible=!0),this.viewerRequestVolume){var u=e?this.viewerRequestVolume.clone().applyMatrix4(e):this.viewerRequestVolume;this.state.inRequestVolume=u.distanceSquaredToPoint(t.camera.position)<=0}else this.state.inRequestVolume=!0;this.state.screenSpaceError=this.getScreenSpaceError(t,this.state.distanceToCamera,!1)},Object.defineProperty(n.prototype,"selected",{get:function(){return this.state.selectedFrameNumber===this.tileset.frameNumber},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"hasChildren",{get:function(){return this.children.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"siblingIndex",{get:function(){var t,e;return(e=(t=this.parent)===null||t===void 0?void 0:t.children.indexOf(this))!==null&&e!==void 0?e:0},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"hasTilesetContent",{get:function(){return this.children.length>0&&this.type==="TILESET"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"hasRenderContent",{get:function(){return this.type==="SCENEGRAPH"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"contentAvailable",{get:function(){var t;return this.hasRenderContent&&((t=this.content)===null||t===void 0?void 0:t.loadState)==="READY"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"hasUnloadedContent",{get:function(){var t;return((t=this.content)===null||t===void 0?void 0:t.loadState)==="UNLOADED"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"hasEmptyContent",{get:function(){return this.type==="EMPTY"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"contentReady",{get:function(){var t;return((t=this.content)===null||t===void 0?void 0:t.loadState)==="READY"||this.hasEmptyContent},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"contentByteLength",{get:function(){return this.content?this.content.byteLength:0},enumerable:!1,configurable:!0}),n.prototype.loadContent=function(){var t=this,e;if(this.hasEmptyContent||!(!((e=this.content)===null||e===void 0)&&e.uri))return Promise.resolve(!1);var r=this.content;return r.data?Promise.resolve(!0):(r.loadState="LOADING",this.tileset.requestScheduler.scheduleRequest(this.id,function(){return t.getPriority()}).then(function(i){return i?t.tileset.options.contentLoader(t).then(function(o){return i.done(),r.loadState=o?"READY":"UNLOADED",o}).catch(function(o){return r.loadState="FAILED",i.done(),Promise.reject(o)}):(r.loadState="UNLOADED",Promise.resolve(!1))}))},n.prototype.unloadContent=function(){return this.content&&(this.content.loadState="UNLOADED",this.content.byteLength=0),!0},n.prototype.getScreenSpaceError=function(t,e,r){var i=this.tileset.transformIsIdentity?1:this.tileset.transform.getMaxScaleOnAxis(),o=this.parent?this.parent.geometricError:this.tileset.geometricError,s=i*(r?o:this.geometricError);if(s===0)return 0;var u=Math.max(e,.001),c=s*t.height/(u*t.sseDenominator);return c},n.prototype.getPriority=function(){var t=this.refine==="ADD"||this.tileset.skipLevelOfDetail;if(t&&!this.state.visible||this.tileset.frameNumber-this.state.touchedFrameNumber>=1||this.content.loadState==="UNLOADED")return-1;var e=this.parent,r=e&&(!t||this.state.screenSpaceError===0),i=r?e.state.screenSpaceError:this.state.screenSpaceError,o=this.tileset.root?this.tileset.root.state.screenSpaceError:0,s=Math.max(o-i,0);return s},n}(),TileRequestScheduler=function(){function n(t){this.tileset=t,this.activeRequests=0,this.requestQueue=[],this.requestMap=new Map,this.deferred=null}return n.prototype.scheduleRequest=function(t,e){var r=this.requestMap.get(t);if(r)return r;var i={identiy:t,priority:0,getPriority:e,resolve:function(){}},o=new Promise(function(s){return i.resolve=s});return this.requestQueue.push(i),this.requestMap.set(t,o),this.issueNewRequests(),o},n.prototype.reset=function(){for(var t=0,e=this.requestQueue;t<e.length;t++){var r=e[t];r.resolve(null)}this.requestQueue.length=0,this.requestMap.clear(),this.activeRequests=0},n.prototype.issueRequest=function(t){var e=this,r=t.identiy,i=t.resolve,o=!1,s=function(){o||(o=!0,e.requestMap.delete(r),e.activeRequests--,e.issueNewRequests())};this.activeRequests++,i({done:s})},n.prototype.issueNewRequests=function(){var t=this;this.deferred||(this.deferred=setTimeout(function(){return t.issueNewRequestsAsync()},0))},n.prototype.issueNewRequestsAsync=function(){this.deferred=null;var t=Math.max(this.tileset.maxRequests-this.activeRequests,0);if(t!==0){this.updateAllRequests();for(var e=0;e<t;e++){var r=this.requestQueue.shift();if(r)this.issueRequest(r);else break}}},n.prototype.updateAllRequests=function(){for(var t=this.requestQueue,e=0;e<t.length;e++){var r=t[e];this.updateRequest(r)===!1&&(t.splice(e,1),this.requestMap.delete(r.identiy),e--)}t.sort(function(i,o){return i.priority-o.priority})},n.prototype.updateRequest=function(t){return t.priority=t.getPriority(t.identiy),t.priority<0?(t.resolve(null),!1):!0},n}(),CacheNode=function(){function n(t,e,r){this.item=t,this.previous=e,this.next=r}return n}(),CacheNodeList=function(){function n(){this.head=null,this.tail=null,this._length=0}return Object.defineProperty(n.prototype,"length",{get:function(){return this._length},enumerable:!1,configurable:!0}),n.prototype.add=function(t){var e=new CacheNode(t,this.tail,null);return this.tail?(this.tail.next=e,this.tail=e):(this.head=e,this.tail=e),this._length++,e},n.prototype.remove=function(t){t.previous&&t.next?(t.previous.next=t.next,t.next.previous=t.previous):t.previous?(t.previous.next=null,this.tail=t.previous):t.next?(t.next.previous=null,this.head=t.next):(this.head=null,this.tail=null),t.next=null,t.previous=null,this._length--},n.prototype.splice=function(t,e){t!==e&&(this.remove(e),this.insert(t,e))},n.prototype.insert=function(t,e){var r=t.next;t.next=e,this.tail===t?this.tail=e:r.previous=e,e.next=r,e.previous=t,this._length++},n.prototype.toArray=function(){for(var t=[],e=this.head;e;)t.push(e),e=e.next;return t},n}(),TileCache=function(){function n(){this.cacheNodeMap=new Map,this.list=new CacheNodeList,this.sentinel=this.list.add("sentinel")}return n.prototype.reset=function(){this.list.tail&&this.list.splice(this.list.tail,this.sentinel)},n.prototype.touch=function(t){var e=this.cacheNodeMap.get(t);e&&this.list.splice(this.sentinel,e)},n.prototype.add=function(t,e){if(!this.cacheNodeMap.has(t)){var r=this.list.add(t);this.cacheNodeMap.set(t,r),e&&e(t)}},n.prototype.unloadTile=function(t,e){var r=this.cacheNodeMap.get(t);r&&(this.list.remove(r),this.cacheNodeMap.delete(t),e&&e(t))},n.prototype.unloadTiles=function(t,e){for(var r=this.list.head;r!==this.sentinel&&t();){var i=r.item;r=r.next,this.unloadTile(i,e)}},n.prototype.toArray=function(){for(var t=[],e=0,r=this.list.toArray();e<r.length;e++){var i=r[e];i.item!=="sentinel"&&t.push(i.item)}return t},n}(),ManagedArray=function(){function n(){this.map=new Map,this.array=[],this._length=0}return Object.defineProperty(n.prototype,"length",{get:function(){return this._length},enumerable:!1,configurable:!0}),n.prototype.get=function(t){return this.array[t]},n.prototype.set=function(t,e){t>=this.length&&(this._length=t+1),this.map.has(this.array[t])&&this.map.delete(this.array[t]),this.array[t]=e,this.map.set(e,t)},n.prototype.delete=function(t){var e=this.map.get(t);e!==void 0&&e>=0&&(this.array.splice(e,1),this.map.delete(t),this._length--)},n.prototype.push=function(t){if(!this.map.has(t)){var e=this._length++;this.array[e]=t,this.map.set(t,e)}},n.prototype.pop=function(){var t=this.array[--this._length];return this.map.delete(t),this.array[this._length]=void 0,t},n.prototype.reset=function(){this.array=[],this.map=new Map,this._length=0},n.prototype.find=function(t){return this.map.has(t)},n.prototype.peek=function(){return this.array[this._length-1]},n}(),TilesetBaseTraverser=function(){function n(t){this.tileset=t,this._canSelectTile=!0,this.root=null}return n.prototype.traverse=function(t,e,r){this.root=t,this.reset()},n.prototype.reset=function(){this.tileset.hasMixedContent=!1,this.tileset.needsRefinedTiles.clear(),this.tileset.requestedTiles.length=0,this.tileset.selectedTiles.length=0},n.prototype.updateTile=function(t,e){this.updateTileVisibility(t,e),t.state.shouldSelect=!1,t.state.finalResolution=!0},n.prototype.selectTile=function(t,e){var r=t.contentAvailable&&this._canSelectTile;r&&(t.state.selectedFrameNumber=e.frameNumber,this.tileset.selectedTiles.push(t),this.tileset.needsRefinedTiles.add(t))},n.prototype.loadTile=function(t,e){t.hasUnloadedContent&&(t.state.requestedFrameNumber=e.frameNumber,this.tileset.requestedTiles.push(t)),this.tileset.needsRefinedTiles.add(t)},n.prototype.touchTile=function(t,e){this.tileset.cache.touch(t),t.state.touchedFrameNumber=e.frameNumber},n.prototype.canTraverse=function(t,e){return t.levelOfContent>=e.maxLevelOfDetail||t.children.length===0?!1:t.levelOfContent<=e.minLevelOfDetail||t.hasTilesetContent?!0:t.state.screenSpaceError>e.maxScreenSpaceError},n.prototype.updateTileVisibility=function(t,e){if(t.updateState(e),!(!t.state.visible||!t.state.inRequestVolume)){var r=t.children.length>0;if(t.hasTilesetContent&&r){var i=t.children[0];this.updateTileVisibility(i,e),t.state.visible=i.state.visible;return}if(this.meetsScreenSpaceErrorEarly(t,e)){t.state.visible=!1;return}var o=t.refine==="REPLACE";if(o&&r&&!this.anyChildrenVisible(t,e)){t.state.visible=!1;return}}},n.prototype.anyChildrenVisible=function(t,e){for(var r=!1,i=t.children,o=0,s=i;o<s.length;o++){var u=s[o];u.updateState(e),r=r||u.state.visible}return r},n.prototype.meetsScreenSpaceErrorEarly=function(t,e){var r=t.parent;return!r||r.refine!=="ADD"||r.levelOfContent<e.minLevelOfDetail?!1:r.levelOfContent>e.maxLevelOfDetail?!0:t.getScreenSpaceError(e,t.state.distanceToCamera,!0)<e.maxScreenSpaceError},n.prototype.sortTilesByDistanceToCamera=function(t){t.sort(function(e,r){return r.state.distanceToCamera===0&&e.state.distanceToCamera===0?r.state.centerZDepth-e.state.centerZDepth:r.state.distanceToCamera-e.state.distanceToCamera})},n}(),TilesetNormalTraverser=function(n){__extends(t,n);function t(e){var r=n.call(this,e)||this;return r.tileset=e,r._traversalStack=new ManagedArray,r._emptyTraversalStack=new ManagedArray,r}return t.prototype.traverse=function(e,r,i){i===void 0&&(i=[]),n.prototype.traverse.call(this,e,r,i);for(var o=0,s=i;o<s.length;o++){var u=s[o];this._traversalStack.reset(),this._emptyTraversalStack.reset(),u.camera.refine&&(this._canSelectTile=u.camera.visible,this.updateTile(e,u),this.executeTraversal(e,u))}this._traversalStack.reset(),this._emptyTraversalStack.reset(),r.camera.refine&&(this._canSelectTile=r.camera.visible,this.updateTile(e,r),this.executeTraversal(e,r))},t.prototype.reset=function(){n.prototype.reset.call(this),this._traversalStack.reset(),this._emptyTraversalStack.reset()},t.prototype.executeTraversal=function(e,r){var i=this._traversalStack;for(e.state.visible&&e.state.inRequestVolume&&i.push(e);i.length>0;){var o=i.pop(),s=o.parent,u=!s||s.state.shouldRefine,c=!1;this.canTraverse(o,r)&&(c=this.updateAndPushChildren(o,r,i)&&u);var l=!c&&u;o.hasRenderContent?o.refine==="ADD"?(this.loadTile(o,r),this.selectDesiredTile(o,r)):o.refine==="REPLACE"&&(this.loadTile(o,r),l&&this.selectDesiredTile(o,r)):(this.loadTile(o,r),l&&this.selectDesiredTile(o,r)),this.touchTile(o,r),o.state.shouldRefine=c}},t.prototype.updateAndPushChildren=function(e,r,i){for(var o=e.children,s=0,u=o;s<u.length;s++){var c=u[s];this.updateTile(c,r)}this.sortTilesByDistanceToCamera(o);for(var l=e.refine==="REPLACE"&&e.hasRenderContent,d=!1,f=!0,v=0,A=o;v<A.length;v++){var c=A[v];if(c.levelOfContent<=r.minLevelOfDetail||c.state.visible&&c.state.inRequestVolume?(i.find(c)&&i.delete(c),i.push(c),d===!1&&(d=!0)):(l||this.tileset.loadSiblings)&&(this.loadTile(c,r),this.touchTile(c,r)),l){var h=void 0;c.state.inRequestVolume?c.hasRenderContent?h=c.contentAvailable:h=this.executeEmptyTraversal(c,r):h=!1,f=f&&h}}return d||(f=!1),f},t.prototype.selectDesiredTile=function(e,r){e.contentAvailable&&n.prototype.selectTile.call(this,e,r)},t.prototype.executeEmptyTraversal=function(e,r){var i=!0,o=this._emptyTraversalStack;for(o.push(e);o.length>0&&i;){var s=o.pop(),u=!s.hasRenderContent&&this.canTraverse(s,r);if(!u&&!s.contentAvailable&&(i=!1),this.updateTile(s,r),s.state.visible||(this.loadTile(s,r),this.touchTile(s,r)),u)for(var c=s.children,l=0,d=c;l<d.length;l++){var f=d[l];o.find(f)&&o.delete(f),o.push(f)}}return i},t}(TilesetBaseTraverser),TilesetSkipTraverser=function(n){__extends(t,n);function t(e){var r=n.call(this,e)||this;return r.tileset=e,r.baseScreenSpaceError=1024,r.skipScreenSpaceErrorFactor=16,r.skipLevels=1,r._traversalStack=new ManagedArray,r._descendantTraversalStack=new ManagedArray,r._selectionTraversalStack=new ManagedArray,r._selectionTraversalancestorStack=new ManagedArray,r}return t.prototype.traverse=function(e,r,i){i===void 0&&(i=[]),n.prototype.traverse.call(this,e,r,i);for(var o=0,s=i;o<s.length;o++){var u=s[o];this._traversalStack.reset(),u.camera.refine&&(this._canSelectTile=u.camera.visible,this.updateTile(e,u),this.executeTraversal(e,u),this.traverseAndSelect(e,u))}this.tileset.hasMixedContent=!1,this._traversalStack.reset(),this._descendantTraversalStack.reset(),this._selectionTraversalStack.reset(),this._selectionTraversalancestorStack.reset(),r.camera.refine&&(this._canSelectTile=r.camera.visible,this.updateTile(e,r),this.executeTraversal(e,r),this.traverseAndSelect(e,r))},t.prototype.reset=function(){n.prototype.reset.call(this),this._traversalStack.reset(),this._descendantTraversalStack.reset(),this._selectionTraversalStack.reset(),this._selectionTraversalancestorStack.reset()},t.prototype.executeTraversal=function(e,r){var i=this._traversalStack;for(e.state.visible&&e.state.inRequestVolume&&i.push(e);i.length>0;){var o=i.pop();this.updateTileAncestorContentLinks(o,r);var s=o.parent,u=!s||s.state.shouldRefine,c=!1;this.canTraverse(o,r)&&(c=this.updateAndPushChildren(o,r,i)&&u);var l=!c&&u;o.hasRenderContent?o.refine==="ADD"?(this.loadTile(o,r),this.selectDesiredTile(o,r)):o.refine==="REPLACE"&&(this.inBaseTraversal(o,this.baseScreenSpaceError)?(this.loadTile(o,r),l&&this.selectDesiredTile(o,r)):l?(this.loadTile(o,r),this.selectDesiredTile(o,r)):this.reachedSkippingThreshold(o)&&this.loadTile(o,r)):(this.loadTile(o,r),l&&this.selectDesiredTile(o,r)),this.touchTile(o,r),o.state.shouldRefine=c}},t.prototype.updateAndPushChildren=function(e,r,i){for(var o=e.children,s=0,u=o;s<u.length;s++){var c=u[s];this.updateTile(c,r)}this.sortTilesByDistanceToCamera(o);for(var l=!1,d=0,f=o;d<f.length;d++){var c=f[d];c.levelOfContent<=r.minLevelOfDetail||c.state.visible&&c.state.inRequestVolume?(i.push(c),l===!1&&(l=!0)):this.tileset.loadSiblings&&(this.loadTile(c,r),this.touchTile(c,r))}return l},t.prototype.selectDesiredTile=function(e,r){var i=e.contentAvailable?e:e.state.ancestorWithContentAvailable;i&&(i.state.shouldSelect=!0),e.contentAvailable||this.selectDescendants(e,r)},t.prototype.selectDescendants=function(e,r){var i=this._descendantTraversalStack;for(i.push(e);i.length>0;)for(var o=i.pop(),s=o.children,u=0,c=s;u<c.length;u++){var l=c[u];l.state.visible&&(l.contentAvailable?(this.updateTile(l,r),this.touchTile(l,r),this.selectTile(l,r)):i.push(l))}},t.prototype.reachedSkippingThreshold=function(e){var r=e.state.ancestorWithContent,i=r!==null&&e.state.screenSpaceError<r.state.screenSpaceError/this.skipScreenSpaceErrorFactor&&e.levelOfContent>r.levelOfContent+this.skipLevels;return i},t.prototype.updateTileAncestorContentLinks=function(e,r){e.state.ancestorWithContent=null,e.state.ancestorWithContentAvailable=null;var i=e.parent;if(i){var o=!(i.hasRenderContent&&i.hasUnloadedContent)||i.state.requestedFrameNumber===r.frameNumber;e.state.ancestorWithContent=o?i:i.state.ancestorWithContent,e.state.ancestorWithContentAvailable=i.contentAvailable?i:i.state.ancestorWithContentAvailable}},t.prototype.inBaseTraversal=function(e,r){return e.state.ancestorWithContent?e.parent&&e.state.screenSpaceError===0?e.parent.state.screenSpaceError>r:e.state.screenSpaceError>r:!0},t.prototype.traverseAndSelect=function(e,r){var i=this._selectionTraversalStack,o=this._selectionTraversalancestorStack,s;for(i.push(e);i.length>0||o.length>0;){if(o.length>0){var u=o.peek();if(u.state.stackLength===i.length){o.pop(),u!==s&&(u.state.finalResolution=!1),this.selectTile(u,r);continue}}var c=i.pop();if(c){var l=this.canTraverse(c,r);if(c.state.shouldSelect)if(c.refine==="ADD")this.selectTile(c,r);else{if(c.state.selectionDepth=o.length,c.state.selectionDepth>0&&(c.tileset.hasMixedContent=!0),s=c,!l){this.selectTile(c,r);continue}o.push(c),c.state.stackLength=i.length}if(l)for(var d=0,f=c.children;d<f.length;d++){var v=f[d];v.state.visible&&i.push(v)}}}},t}(TilesetBaseTraverser),identityMatrix4=new THREE__namespace.Matrix4,Tileset=function(){function n(t,e,r){var i,o,s,u,c;this.id=t,this.transform=new THREE__namespace.Matrix4,this.transformIsIdentity=!0,this.hasMixedContent=!1,this.url=(i=r.url)!==null&&i!==void 0?i:"",this.referer=(o=r.referer)!==null&&o!==void 0?o:"",this.asset={version:e.asset.version,tilesetVersion:e.asset.tilesetVersion||"",gltfUpAxis:(s=e.asset.gltfUpAxis)!==null&&s!==void 0?s:"Y",overview:e.asset.overview},this.rootMeta=(u=e.rootMeta)!==null&&u!==void 0?u:{},this.properties=(c=e.properties)!==null&&c!==void 0?c:{},this.options=r,this.maxMemoryUsage=n.DEFAULT_MAX_MEMORY_USAGE,this.maxScreenSpaceError=n.DEFAULT_MAX_SCREEN_SPACE_ERROR,this.skipLevelOfDetail=n.DEFAULT_SKIP_LEVEL_OF_DETAIL,this.loadSiblings=n.DEFAULT_LOAD_SIBLINGS,this.maxRequests=n.DEFAULT_MAX_REQUESTS,this.requestedTiles=[],this.selectedTiles=[],this.needsRefinedTiles=new Set,this.cache=new TileCache,this.normalTraverser=new TilesetNormalTraverser(this),this.skipTraverser=new TilesetSkipTraverser(this),this.requestScheduler=new TileRequestScheduler(this),this.frameNumber=0,this.pendingCount=0,this.loadedTiles=new Set,this.memoryUsageInBytes=0,this.root=new Tile("".concat(this.id,".0"),e.root,this),this.geometricError=e.geometricError}return Object.defineProperty(n.prototype,"traverser",{get:function(){return this.skipLevelOfDetail?this.skipTraverser:this.normalTraverser},enumerable:!1,configurable:!0}),n.prototype.reset=function(){for(var t=this,e=[this.root],r;r=e.pop();){for(var i=0,o=r.children.length;i<o;i++)e.push(r.children[i]);this.cache.unloadTile(r,function(s){return t.unloadTile(s)})}this.cache.reset(),this.traverser.reset(),this.requestScheduler.reset(),this.loadedTiles.clear()},n.prototype.isLoaded=function(){return this.pendingCount===0&&this.frameNumber!==0},n.prototype.traverse=function(t,e){var r=this;e===void 0&&(e=[]),this.transformIsIdentity=this.transform.equals(identityMatrix4),this.traverser.traverse(this.root,t,e),this.requestedTiles.forEach(function(i){i.hasUnloadedContent&&r.loadTile(i)}),this.cache.unloadTiles(function(){var i=r.memoryUsageInBytes>r.maxMemoryUsage*1024*1024;return i},function(i){r.unloadTile(i),r.loadedTiles.delete(i)})},n.prototype.loadTile=function(t){var e=this;this.pendingCount++,t.loadContent().catch(function(r){return e.options.onTileError(t,r),!1}).then(function(r){var i;e.pendingCount--,r&&(!((i=t.content)===null||i===void 0)&&i.data&&(e.loadedTiles.add(t),e.cache.add(t,function(){e.memoryUsageInBytes+=t.contentByteLength})),e.options.onTileLoad(t))})},n.prototype.unloadTile=function(t){this.memoryUsageInBytes-=t.contentByteLength,this.options.onTileUnload(t),t.unloadContent()},n.DEFAULT_MAX_MEMORY_USAGE=16,n.DEFAULT_MAX_SCREEN_SPACE_ERROR=4,n.DEFAULT_SKIP_LEVEL_OF_DETAIL=!1,n.DEFAULT_LOAD_SIBLINGS=!1,n.DEFAULT_MAX_REQUESTS=6,n}(),BVHObject=function(){function n(t,e){this.position=t,this.indices=e}return n.prototype.getPositionCount=function(){var t,e,r=this.indices,i=this.position;return r?r.array.length/((t=r.stride)!==null&&t!==void 0?t:1):i.array.length/((e=i.stride)!==null&&e!==void 0?e:3)},n.prototype.getPositionByIndex=function(t,e){var r,i,o,s,u=this.indices,c=this.position,l=t;if(u){var d=u.array,f=(r=u.stride)!==null&&r!==void 0?r:1,v=(i=u.offset)!==null&&i!==void 0?i:0;l=d[t*f+v]}var A=c.array,h=(o=c.stride)!==null&&o!==void 0?o:3,p=(s=c.offset)!==null&&s!==void 0?s:0;return l=l*h+p,e.x=A[l],e.y=A[l+1],e.z=A[l+2],e},n.prototype.createTree=function(t,e,r){throw new Error("not implemented")},n.prototype.trianglesInSphere=function(t,e){throw new Error("not implemented")},n.prototype.intersectRay=function(t,e,r,i){throw new Error("not implemented")},n}(),BVHNode=function(){function n(t,e,r,i,o){this.id=t,this.extents=e,this.startIndex=r,this.endIndex=i,this.deepth=o}return n}(),BYTES_PER_NODE=6*4+4+4+2+2;function packBVHNode(n,t){for(var e=new ArrayBuffer(t*BYTES_PER_NODE),r=new Float32Array(e),i=new Uint32Array(e),o=new Uint16Array(e),s=[n],u,c;u=s.pop();)c=u.id*BYTES_PER_NODE/4,r[c]=u.extents[0],r[c+1]=u.extents[1],r[c+2]=u.extents[2],r[c+3]=u.extents[3],r[c+4]=u.extents[4],r[c+5]=u.extents[5],i[c+6]=u.startIndex,i[c+7]=u.endIndex,c=u.id*BYTES_PER_NODE/2,u.node0&&(o[c+16]=u.node0.id,s.push(u.node0)),u.node1&&(o[c+17]=u.node1.id,s.push(u.node1));return e}function intersectNodeBox(n,t,e,r,i,o,s,u,c){c===void 0&&(c=0),e=e-c,r=r-c,i=i-c,o=o+c,s=s+c,u=u+c;var l=0,d=0,f=0,v=0,A=0,h=0;return t.x>=0?(l=(e-n.x)*t.x,d=(o-n.x)*t.x):(l=(o-n.x)*t.x,d=(e-n.x)*t.x),t.y>=0?(f=(r-n.y)*t.y,v=(s-n.y)*t.y):(f=(s-n.y)*t.y,v=(r-n.y)*t.y),!(l>v||f>d||(f>l&&(l=f),v<d&&(d=v),t.z>=0?(A=(i-n.z)*t.z,h=(u-n.z)*t.z):(A=(u-n.z)*t.z,h=(i-n.z)*t.z),l>h||A>d)||(A>l&&(l=A),h<d&&(d=h),d<0))}var BVHVector3=function(){function n(t,e,r){this.x=t,this.y=e,this.z=r}return n.prototype.copy=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},n.prototype.set=function(t,e,r){return this.x=t,this.y=e,this.z=r,this},n.prototype.fromArray=function(t,e){return e===void 0&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this},n.prototype.toArray=function(t,e){return t===void 0&&(t=[]),e===void 0&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t},n.prototype.add=function(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this},n.prototype.multiplyScalar=function(t){return this.x*=t,this.y*=t,this.z*=t,this},n.prototype.subVectors=function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this},n.prototype.addScaledVector=function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this},n.prototype.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z},n.prototype.cross=function(t){var e=this.x,r=this.y,i=this.z;return this.x=r*t.z-i*t.y,this.y=i*t.x-e*t.z,this.z=e*t.y-r*t.x,this},n.prototype.crossVectors=function(t,e){var r=t.x,i=t.y,o=t.z,s=e.x,u=e.y,c=e.z;return this.x=i*c-o*u,this.y=o*s-r*c,this.z=r*u-i*s,this},n.prototype.distanceTo=function(t){return Math.sqrt(this.distanceToSquared(t))},n.prototype.distanceToSquared=function(t){var e=this.x-t.x,r=this.y-t.y,i=this.z-t.z;return e*e+r*r+i*i},n.prototype.clone=function(){return new n(this.x,this.y,this.z)},n}(),BVHIntersect=function(){function n(t,e,r){this.triangle=t,this.intersectionPoint=e,this.index=r}return n}(),EPSILON$1=1e-6,scratchVector3$3=new BVHVector3(0,0,0),scratchVector3A=new BVHVector3(0,0,0),scratchVector3B=new BVHVector3(0,0,0),scratchVector3C=new BVHVector3(0,0,0),BVHMesh=function(n){__extends(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t.prototype.createTree=function(e,r,i){r=Math.min(r,16);var o=this.getPositionCount()/3,s=o>65535?new Uint32Array(o):new Uint16Array(o),u=new Float32Array(o*6),c=[],l=0,d=-1;if(i)for(var f=0,v=0,A=0,h=void 0,p=void 0,y=void 0,m=void 0,g=void 0,E=void 0,b=void 0;f<o;f+=1,v+=3,A+=6)s[f]=f,this.getPositionByIndex(v,scratchVector3A),this.getPositionByIndex(v+1,scratchVector3B),this.getPositionByIndex(v+2,scratchVector3C),h=m=scratchVector3A.x,b=scratchVector3B.x,b<h&&(h=b),b>m&&(m=b),b=scratchVector3C.x,b<h&&(h=b),b>m&&(m=b),p=g=scratchVector3A.y,b=scratchVector3B.y,b<p&&(p=b),b>g&&(g=b),b=scratchVector3C.y,b<p&&(p=b),b>g&&(g=b),y=E=scratchVector3A.z,b=scratchVector3B.z,b<y&&(y=b),b>E&&(E=b),b=scratchVector3C.z,b<y&&(y=b),b>E&&(E=b),u[A]=h,u[A+1]=p,u[A+2]=y,u[A+3]=m,u[A+4]=g,u[A+5]=E;else{for(var T=1/0,_=1/0,S=1/0,R=-1/0,B=-1/0,I=-1/0,f=0,v=0,A=0,h=void 0,p=void 0,y=void 0,m=void 0,g=void 0,E=void 0,b=void 0;f<o;f+=1,v+=3,A+=6)s[f]=f,this.getPositionByIndex(v,scratchVector3A),this.getPositionByIndex(v+1,scratchVector3B),this.getPositionByIndex(v+2,scratchVector3C),h=m=scratchVector3A.x,b=scratchVector3B.x,b<h&&(h=b),b>m&&(m=b),b=scratchVector3C.x,b<h&&(h=b),b>m&&(m=b),p=g=scratchVector3A.y,b=scratchVector3B.y,b<p&&(p=b),b>g&&(g=b),b=scratchVector3C.y,b<p&&(p=b),b>g&&(g=b),y=E=scratchVector3A.z,b=scratchVector3B.z,b<y&&(y=b),b>E&&(E=b),b=scratchVector3C.z,b<y&&(y=b),b>E&&(E=b),u[A]=h,u[A+1]=p,u[A+2]=y,u[A+3]=m,u[A+4]=g,u[A+5]=E,h<T&&(T=h),m>R&&(R=m),p<_&&(_=p),g>B&&(B=g),y<S&&(S=y),E>I&&(I=E);i=[T,_,S,R,B,I]}var x=new BVHNode(++d,i,0,o,0);c[l++]=x;var M=[],L=[0,1,2],C=function(F,O){return M[O]-M[F]};function H(F){var O=F.startIndex,G=F.endIndex,Q=F.extents;M[0]=Q[3]-Q[0],M[1]=Q[4]-Q[1],M[2]=Q[5]-Q[2],L.sort(C);for(var U=0;U<3;U++){for(var D=L[U],q=Q[D]+Q[D+3],z=O,K=G-1,J=-1,j=void 0;z<=K;)J===-1?(j=s[z],u[j*6+D]+u[j*6+D+3]<q?z++:J=j):(j=s[K],u[j*6+D]+u[j*6+D+3]>=q||(s[z]=j,s[K]=J,J=-1,z++),K--);if(z>O&&z<G){var re=new BVHNode(++d,calcExtents(s,u,O,z,EPSILON$1),O,z,F.deepth+1);re.deepth<r&&re.endIndex-re.startIndex>e&&(c[l++]=re);var W=new BVHNode(++d,calcExtents(s,u,z,G,EPSILON$1),z,G,F.deepth+1);W.deepth<r&&W.endIndex-W.startIndex>e&&(c[l++]=W),F.node0=re,F.node1=W,F.startIndex=0,F.endIndex=0;break}}}for(;l;)H(c[--l]);return this.offsetArray=s,this.rootNodePacked=packBVHNode(x,d+1),c.length=0,this},t.prototype.trianglesInSphere=function(e,r){for(var i=this.offsetArray,o=this.rootNodePacked,s=new Float32Array(o),u=new Uint32Array(o),c=new Uint16Array(o),l=[0],d=[],f,v,A,h;(f=l.pop())!==void 0;){h=f*BYTES_PER_NODE/4;var p=clamp(e.x,s[h],s[h+3])-e.x,y=clamp(e.y,s[h+1],s[h+4])-e.y,m=clamp(e.z,s[h+2],s[h+5])-e.z;if(p*p+y*y+m*m<=r*r){for(var g=u[h+6];g<u[h+7];g++)d.push(i[g]);h=f*BYTES_PER_NODE/2,v=c[h+16],A=c[h+17],v&&l.push(v),A&&l.push(A)}}for(var E=d.length,b=new Float32Array(E*9),g=0;g<E;g++){var T=d[g];this.getPositionByIndex(T,scratchVector3$3),b[g*9]=scratchVector3$3.x,b[g*9+1]=scratchVector3$3.y,b[g*9+2]=scratchVector3$3.z,this.getPositionByIndex(T+1,scratchVector3$3),b[g*9+3]=scratchVector3$3.x,b[g*9+4]=scratchVector3$3.y,b[g*9+5]=scratchVector3$3.z,this.getPositionByIndex(T+2,scratchVector3$3),b[g*9+6]=scratchVector3$3.x,b[g*9+7]=scratchVector3$3.y,b[g*9+8]=scratchVector3$3.z}return b},t.prototype.intersectRay=function(e,r,i,o){for(var s=this.offsetArray,u=this.rootNodePacked,c=new Float32Array(u),l=new Uint32Array(u),d=new Uint16Array(u),f=new BVHVector3(1/r.x,1/r.y,1/r.z),v=[0],A,h,p,y;(A=v.pop())!==void 0;)if(y=A*BYTES_PER_NODE/4,intersectNodeBox(e,f,c[y],c[y+1],c[y+2],c[y+3],c[y+4],c[y+5])){for(var m=l[y+6],g=l[y+7],E=void 0,b=void 0,T=void 0,_=e.x,S=e.y,R=e.z,B=r.x,I=r.y,x=r.z,M=void 0,L=void 0,C=void 0,H=void 0,F=void 0,O=void 0,G=void 0,Q=void 0,U=void 0,D=void 0,q=void 0,z=void 0,K=void 0,J=void 0,j=void 0,re=void 0,W=void 0,te=void 0,$=void 0,ne=void 0,ee=void 0,ce=void 0,ae=void 0,se=void 0,Ae=void 0,he=void 0,me=void 0;m<g;m++){if(E=s[m],b=E*3,this.getPositionByIndex(b,scratchVector3$3),M=scratchVector3$3.x,L=scratchVector3$3.y,C=scratchVector3$3.z,this.getPositionByIndex(b+1,scratchVector3$3),H=scratchVector3$3.x,F=scratchVector3$3.y,O=scratchVector3$3.z,this.getPositionByIndex(b+2,scratchVector3$3),G=scratchVector3$3.x,Q=scratchVector3$3.y,U=scratchVector3$3.z,D=H-M,q=F-L,z=O-C,K=G-M,J=Q-L,j=U-C,re=q*j-z*J,W=z*K-D*j,te=D*J-q*K,ae=B*re+I*W+x*te,ae>0)ce=1;else if(ae<0)ce=-1,ae=-ae;else continue;$=_-M,ne=S-L,ee=R-C,se=ce*(B*(ne*j-ee*J)+I*(ee*K-$*j)+x*($*J-ne*K)),!(se<0)&&(Ae=ce*(B*(q*ee-z*ne)+I*(z*$-D*ee)+x*(D*ne-q*$)),!(Ae<0)&&(se+Ae>ae||(he=-ce*($*re+ne*W+ee*te),!(he<0)&&(me=he/ae,o.push(new BVHIntersect([M,L,C,H,F,O,G,Q,U],[_+B*me,S+I*me,R+x*me],E))))))}y=A*BYTES_PER_NODE/2,h=d[y+16],p=d[y+17],h&&v.push(h),p&&v.push(p)}return o},t}(BVHObject);function clamp(n,t,e){return n<t?t:n>e?e:n}function calcExtents(n,t,e,r,i){if(e>=r)return[0,0,0,0,0,0];for(var o=1/0,s=1/0,u=1/0,c=-1/0,l=-1/0,d=-1/0,f=e,v=void 0,A=void 0;f<r;f++)v=n[f]*6,A=t[v],A<o&&(o=A),A=t[v+1],A<s&&(s=A),A=t[v+2],A<u&&(u=A),A=t[v+3],A>c&&(c=A),A=t[v+4],A>l&&(l=A),A=t[v+5],A>d&&(d=A);return[o-i,s-i,u-i,c+i,l+i,d+i]}var EPSILON=1e-6,ORDER_AXISES=["x","y","z"],scratchVector3$2=new BVHVector3(0,0,0),BVHPoints=function(n){__extends(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t.prototype.createTree=function(e,r,i){r=Math.min(r,16);var o=this.getPositionByIndex.bind(this),s=this.getPositionCount(),u=s>65535?new Uint32Array(s):new Uint16Array(s),c=[],l=0,d=-1;if(i)for(var f=0;f<s;f+=1)u[f]=f;else{o(0,scratchVector3$2);for(var v=scratchVector3$2.x,A=scratchVector3$2.y,h=scratchVector3$2.z,p=v,y=A,m=h,f=0,g=void 0,E=void 0,b=void 0;f<s;f+=1)u[f]=f,o(f,scratchVector3$2),g=scratchVector3$2.x,E=scratchVector3$2.y,b=scratchVector3$2.z,g<v?v=g:g>p&&(p=g),E<A?A=E:E>y&&(y=E),b<h?h=b:b>m&&(m=b);i=[v,A,h,p,y,m]}var T=new BVHNode(++d,i,0,s,0);c[l++]=T;var _=[],S=[0,1,2],R=function(I,x){return _[x]-_[I]};function B(I){var x=I.startIndex,M=I.endIndex,L=I.extents;_[0]=L[3]-L[0],_[1]=L[4]-L[1],_[2]=L[5]-L[2];for(var C=S.sort(R)[0],H=ORDER_AXISES[C],F=(L[C]+L[C+3])/2,O=x,G=M-1,Q=-1,U;O<=G;)Q===-1?(U=u[O],o(U,scratchVector3$2),scratchVector3$2[H]<F?O++:Q=U):(U=u[G],o(U,scratchVector3$2),scratchVector3$2[H]>=F||(u[O]=U,u[G]=Q,Q=-1,O++),G--);if(O>x){var D=L.slice();D[C+3]=F+EPSILON;var q=new BVHNode(++d,D,x,O,I.deepth+1);q.deepth<r&&q.endIndex-q.startIndex>e&&(c[l++]=q),I.node0=q}if(M>O){var z=L.slice();z[C]=F-EPSILON;var K=new BVHNode(++d,z,O,M,I.deepth+1);K.deepth<r&&K.endIndex-K.startIndex>e&&(c[l++]=K),I.node1=K}I.startIndex=0,I.endIndex=0}for(;l;)B(c[--l]);return this.offsetArray=u,this.rootNodePacked=packBVHNode(T,d+1),c.length=0,this},t.prototype.intersectRay=function(e,r,i,o){for(var s=this.offsetArray,u=this.rootNodePacked,c=new Float32Array(u),l=new Uint32Array(u),d=new Uint16Array(u),f=i*i,v=new BVHVector3(1/r.x,1/r.y,1/r.z),A=[0],h,p,y,m;(h=A.pop())!==void 0;)if(m=h*BYTES_PER_NODE/4,intersectNodeBox(e,v,c[m],c[m+1],c[m+2],c[m+3],c[m+4],c[m+5],i)){for(var g=l[m+6],E=l[m+7],b=void 0,T=void 0,_=void 0,S=void 0,R=void 0,B=void 0,I=void 0,x=void 0,M=void 0,L=void 0,C=void 0,H=void 0;g<E;g++)b=s[g],this.getPositionByIndex(b,scratchVector3$2),T=scratchVector3$2.x,_=scratchVector3$2.y,S=scratchVector3$2.z,R=e.x,B=e.y,I=e.z,x=r.x,M=r.y,L=r.z,C=x*(T-R)+M*(_-B)+L*(S-I),C>0&&(R+=x*C,B+=M*C,I+=L*C),x=T-R,M=_-B,L=S-I,C=x*x+M*M+L*L,C<=f&&o.push(new BVHIntersect([T,_,S,T,_,S,T,_,S],[R,B,I],b));m=h*BYTES_PER_NODE/2,p=d[m+16],y=d[m+17],p&&A.push(p),y&&A.push(y)}return o},t}(BVHObject);const encodedJs$1="KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO3ZhciBlcj1mdW5jdGlvbihlLHIpe3JldHVybiBlcj1PYmplY3Quc2V0UHJvdG90eXBlT2Z8fHtfX3Byb3RvX186W119aW5zdGFuY2VvZiBBcnJheSYmZnVuY3Rpb24odCxvKXt0Ll9fcHJvdG9fXz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4ub2Zmc2V0QXJyYXkscm9vdE5vZGVQYWNrZWQ6bi5yb290Tm9kZVBhY2tlZH07dC5wdXNoKHMpO3ZhciB1PXZvaWQgMDtmb3IodmFyIHcgaW4gcy5hdHRyaWJ1dGVzKXt2YXIgeT1zLmF0dHJpYnV0ZXNbd107eSYmeS5idWZmZXIgaW5zdGFuY2VvZiBBcnJheUJ1ZmZlciYmby5hZGQoeS5idWZmZXIpfXU9cy5pbmRpY2VzLHUmJnUuYnVmZmVyIGluc3RhbmNlb2YgQXJyYXlCdWZmZXImJm8uYWRkKHUuYnVmZmVyKSx1PXMub2Zmc2V0QXJyYXksdSYmdS5idWZmZXIgaW5zdGFuY2VvZiBBcnJheUJ1ZmZlciYmby5hZGQodS5idWZmZXIpLG8uYWRkKHMucm9vdE5vZGVQYWNrZWQpfXJldHVybntvdXRwdXQ6dCx0cmFuc2ZlcjpBcnJheS5mcm9tKG8pfX0pfSl9KSgpOwo=",decodeBase64$1=n=>Uint8Array.from(atob(n),t=>t.charCodeAt(0)),blob$2=typeof self!="undefined"&&self.Blob&&new Blob([decodeBase64$1(encodedJs$1)],{type:"text/javascript;charset=utf-8"});function WorkerWrapper$1(n){let t;try{if(t=blob$2&&(self.URL||self.webkitURL).createObjectURL(blob$2),!t)throw"";const e=new Worker(t,{name:n==null?void 0:n.name});return e.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),e}catch(e){return new Worker("data:text/javascript;base64,"+encodedJs$1,{name:n==null?void 0:n.name})}finally{t&&(self.URL||self.webkitURL).revokeObjectURL(t)}}var WorkerPool$1=function(){function n(t,e){this.pool=e,this.workerCreator=t,this.queue=[],this.workers=[],this.workersResolver=[],this.workerStatus=0}return n.prototype.initWorker=function(t){if(this.workerCreator&&!this.workers[t]){var e=this.workerCreator();e.addEventListener("message",this.onMessage.bind(this,t)),this.workers[t]=e}},n.prototype.getIdleWorker=function(){for(var t=0;t<this.pool;t++)if(!(this.workerStatus&1<<t))return t;return-1},n.prototype.onMessage=function(t,e){var r=this.workersResolver[t],i=r.resolve,o=r.reject;if(e.data&&"$$error"in e.data?o(e.data.$$error):i(e.data),this.queue.length){var s=this.queue.shift(),u=s.resolve,c=s.reject,l=s.input,d=s.transfer;this.workersResolver[t]={resolve:u,reject:c},this.workers[t].postMessage(l,d)}else this.workerStatus^=1<<t},n.prototype.postMessage=function(t,e){var r=this;return e===void 0&&(e=[]),new Promise(function(i,o){var s=r.getIdleWorker();s!==-1?(r.initWorker(s),r.workerStatus|=1<<s,r.workersResolver[s]={resolve:i,reject:o},r.workers[s].postMessage(t,e)):r.queue.push({resolve:i,reject:o,input:t,transfer:e})})},n.prototype.dispose=function(){this.workers.forEach(function(t){return t.terminate()}),this.workersResolver.length=0,this.workers.length=0,this.queue.length=0,this.workerStatus=0},n}(),bvhWorkerPool=new WorkerPool$1(function(){return new WorkerWrapper$1},4),bvhMeshMap=new Map,scratchRay=new THREE__namespace.Ray,scratchNormalMatrix=new THREE__namespace.Matrix3,scratchInverseMatrix=new THREE__namespace.Matrix4,scratchIntersectionFaceA=new THREE__namespace.Vector3,scratchIntersectionFaceB=new THREE__namespace.Vector3,scratchIntersectionFaceC=new THREE__namespace.Vector3,scratchIntersectionTriangle=new THREE__namespace.Triangle;function raycastMesh(n,t,e,r){var i,o=n.matrixWorld;scratchInverseMatrix.getInverse(o),scratchRay.copy(e.ray).applyMatrix4(scratchInverseMatrix);for(var s=t.intersectRay(scratchRay.origin,scratchRay.direction,0,[]),u=n.geometry,c=n.material,l=u.groups,d=u.index,f=0,v=s.length;f<v;f++){var A=s[f],h=A.triangle,p=A.index,y=A.intersectionPoint,m=new THREE__namespace.Vector3(y[0],y[1],y[2]).applyMatrix4(o),g=e.ray.origin.distanceTo(m);if(!(g<e.near||g>e.far)){var E=void 0;if(Array.isArray(c)){if(l)for(var b=p*3,T=0,_=l;T<_.length;T++){var S=_[T];if(b>=S.start&&b-S.start<S.count){E=c[(i=S.materialIndex)!==null&&i!==void 0?i:0];break}}}else E=c;if(E){var R=scratchIntersectionTriangle.set(scratchIntersectionFaceA.set(h[0],h[1],h[2]).applyMatrix4(o),scratchIntersectionFaceB.set(h[3],h[4],h[5]).applyMatrix4(o),scratchIntersectionFaceC.set(h[6],h[7],h[8]).applyMatrix4(o)).getNormal(new THREE__namespace.Vector3),B=p*3,I=new THREE__namespace.Face3(d?d.array[B]:B,d?d.array[B+1]:B+1,d?d.array[B+2]:B+2,R),x=e.ray.direction.dot(R);E.side===THREE__namespace.FrontSide&&x>=0||E.side===THREE__namespace.BackSide&&x<=0||r.push({distance:g,object:n,face:I,point:m,distanceToRay:0,faceIndex:p})}}}}function raycastPoints(n,t,e,r){var i,o,s=n.matrixWorld;scratchNormalMatrix.getNormalMatrix(s),scratchInverseMatrix.getInverse(s);var u=((o=(i=e.params.Points)===null||i===void 0?void 0:i.threshold)!==null&&o!==void 0?o:1)*scratchInverseMatrix.getMaxScaleOnAxis();scratchRay.copy(e.ray).applyMatrix4(scratchInverseMatrix);for(var c=t.intersectRay(scratchRay.origin,scratchRay.direction,u,[]),l=n.geometry,d=l.index,f=l.getAttribute("normal"),v=0,A=c.length;v<A;v++){var h=c[v],p=h.triangle,y=h.index,m=h.intersectionPoint,g=new THREE__namespace.Vector3(m[0],m[1],m[2]).applyMatrix4(s),E=e.ray.origin.distanceTo(g);if(!(E<e.near||E>e.far)){var b=scratchIntersectionFaceA.set(p[0],p[1],p[2]).applyMatrix4(s),T=d?d.array[y]:y,_=void 0;f instanceof THREE__namespace.BufferAttribute&&(_=new THREE__namespace.Vector3().fromBufferAttribute(f,T).applyNormalMatrix(scratchNormalMatrix));var S=new THREE__namespace.Face3(T,T,T,_);r.push({distance:E,object:n,face:S,point:g,distanceToRay:g.distanceTo(b),index:y})}}}var BVH_MESH_PROP="__bvh_mesh__",originMeshRaycast=THREE__namespace.Mesh.prototype.raycast;function overrideMeshRaycast(n,t){var e=getBvhTreeForMesh(this);e?raycastMesh(this,e,n,t):originMeshRaycast.call(this,n,t)}function getBvhTreeForMesh(n){var t=n[BVH_MESH_PROP];return t instanceof BVHMesh,t}function bindBvhTreeForMesh(n,t){var e;Object.assign(n,(e={},e[BVH_MESH_PROP]=t,e.raycast=overrideMeshRaycast,e))}var BVH_POINTS_PROP="__bvh_points__",originPointsRaycast=THREE__namespace.Points.prototype.raycast;function overridePointsRaycast(n,t){var e=getBvhTreeForPoints(this);e?raycastPoints(this,e,n,t):originPointsRaycast.call(this,n,t)}function getBvhTreeForPoints(n){var t=n[BVH_POINTS_PROP];return t instanceof BVHPoints,t}function bindBvhTreeForPoints(n,t){var e;Object.assign(n,(e={},e[BVH_POINTS_PROP]=t,e.raycast=overridePointsRaycast,e))}function generateBvhTree(n,t,e,r){var i=[];return n.traverse(function(o){(o instanceof THREE__namespace.Mesh||o instanceof THREE__namespace.Points)&&o.geometry instanceof THREE__namespace.BufferGeometry&&i.push(o)}),Promise.resolve().then(function(){for(var o=[],s=new Set,u=null,c=0;c<i.length;c++){var l=i[c],d=l.geometry;if(d instanceof THREE__namespace.BufferGeometry){var f=void 0;if(l instanceof THREE__namespace.Mesh?f="mesh":l instanceof THREE__namespace.Points&&(f="points"),!!f){var v=d.boundingBox,A=v?[v.min.x,v.min.y,v.min.z,v.max.x,v.max.y,v.max.z]:void 0,h={};for(var p in d.attributes){var y=d.attributes[p];y instanceof THREE__namespace.InterleavedBufferAttribute?(h[p]={array:y.data.array,stride:y.data.stride,offset:y.offset},u=y.data.array,u&&u.buffer instanceof ArrayBuffer&&s.add(u.buffer)):(h[p]={array:y.array},u=y.array,u&&u.buffer instanceof ArrayBuffer&&s.add(u.buffer))}var m=void 0,g=d.getIndex();g&&(g instanceof THREE__namespace.InterleavedBufferAttribute?(m={array:g.data.array,stride:g.data.stride,offset:g.offset},u=g.data.array,u&&u.buffer instanceof ArrayBuffer&&s.add(u.buffer)):(m={array:g.array},u=g.array,u&&u.buffer instanceof ArrayBuffer&&s.add(u.buffer)));var E={type:f,attributes:h,indices:m,maxItemPerNode:e,maxTreeDepth:r,extents:A};o.push(E)}}}return bvhWorkerPool.postMessage(o,Array.from(s))}).then(function(o){for(var s=0;s<i.length;s++){var u=i[s],c=u.geometry,l=o[s];if(c instanceof THREE__namespace.BufferGeometry){for(var d in l.attributes){var f=l.attributes[d].array,v=c.attributes[d];v instanceof THREE__namespace.InterleavedBufferAttribute?v.data.array=f:v.array=f}var A=c.getIndex();if(A&&l.indices){var f=l.indices.array;A instanceof THREE__namespace.InterleavedBufferAttribute?A.data.array=f:A.array=f}if(u instanceof THREE__namespace.Mesh){var h=new BVHMesh(l.attributes.position,l.indices);h.offsetArray=l.offsetArray,h.rootNodePacked=l.rootNodePacked,bindBvhTreeForMesh(u,h)}else if(u instanceof THREE__namespace.Points){var h=new BVHPoints(l.attributes.position,l.indices);h.offsetArray=l.offsetArray,h.rootNodePacked=l.rootNodePacked,bindBvhTreeForPoints(u,h)}}}return n})}new THREE__namespace.Vector3,new THREE__namespace.Vector3,new THREE__namespace.Vector3;var TileNode=function(n){__extends(t,n);function t(e,r){r===void 0&&(r=noop$1);var i=n.call(this)||this;return i.contentObject=e,i.disposer=r,i.disposers=[r],i.add(e),i}return t.prototype.generateBvhTree=function(){return generateBvhTree(this,!0,200,10)},t.prototype.intersectRaycaster=function(e,r,i){r===void 0&&(r=!0),i===void 0&&(i=[]);for(var o=this.children.slice(),s,u=[];s=o.pop();)if(s.visible){s.raycast(e,u);for(var c=0,l=s.children.length;c<l;c++)o.push(s.children[c])}return u.forEach(function(d){var f=0;if((d.object instanceof PBMMesh||d.object instanceof PBMPointCloud)&&d.face){var v=Array.isArray(d.object.material)?d.object.material[d.face.materialIndex]:d.object.material;v&&(f=v.floor)}d.floor=f}),r&&u.sort(function(d,f){return d.distance-f.distance}),i.push.apply(i,u),i},t.prototype.dispose=function(){for(var e=0,r=this.disposers;e<r.length;e++){var i=r[e];i()}this.disposers.length=0},t.prototype.clone=function(){return new t(this.contentObject,this.disposer)},t}(THREE__namespace.Group);function pathJoin(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];var e=[];n=n.map(function(u){return(u!=null?u:"").trim()}).filter(function(u){return u.length>0&&!/^\/+$/.test(u)});for(var r=0;r<n.length;r++){var i=r===0,o=r===n.length-1,s=n[r];i||(s=s.replace(/^\.\//,"").replace(/^\/+/,"")),o||(s=s.replace(/\/+$/,"")),e.push(s)}return e.join("/")}function normalizeURL(n){var t,e=/^(http\:|https\:|file\:)?\/\/[^/]/.exec(n);if(!e)return n;var r=e[1]||"",i=n.slice(r.length+2),o=i.indexOf("#");o>=0&&(n.slice(o),i=n.slice(0,o));var s=i.indexOf("?");s>=0&&(n.slice(s),i=n.slice(0,s));for(var u=i.split("/"),c=u.shift(),l=(t=u.pop())!==null&&t!==void 0?t:"",d=[],f=0,v=u;f<v.length;f++){var A=v[f];if(!(A===""||A===".")){if(A===".."){d.pop();continue}d.push(A)}}return r+"//"+c+"/"+d.join("/")+"/"+l}function isAbsoluteURL(n){return n.indexOf("//")===0||/^[0-9a-z]+\:/i.test(n)}function normalizeTileHeader(n,t,e){if(n.content&&n.content.uri&&(isAbsoluteURL(n.content.uri)||(n.content.uri=normalizeURL(pathJoin(t,n.content.uri)))),n.transform){for(var r=!1,i=0;i<16;i++){var o=n.transform[i];if(typeof o!="number"||isNaN(o)||!isFinite(o)){r=!0;break}}if(n.transform[15]===0&&(r=!0),r)throw new Error("Invalid Tile Transform: "+JSON.stringify(n.transform))}if(n.children)for(var s=0,u=n.children;s<u.length;s++){var c=u[s];normalizeTileHeader(c,t)}return n}function normalizeTilesetHeader(n,t){return n.asset||(n.asset={}),n.rootMeta||(n.rootMeta={}),n.asset.overview&&(isAbsoluteURL(n.asset.overview.imageFile)||(n.asset.overview.imageFile=normalizeURL(pathJoin(t,n.asset.overview.imageFile))),isAbsoluteURL(n.asset.overview.worldFile)||(n.asset.overview.worldFile=normalizeURL(pathJoin(t,n.asset.overview.worldFile)))),normalizeTileHeader(n.root,t),n}function initTextures(n,t,e){for(var r,i,o=Promise.resolve(),s=n.slice(),u=function(){for(var c=[],l=0,d=void 0;d=s.shift();){c.push(d);var f=((r=d.image)===null||r===void 0?void 0:r.width)*((i=d.image)===null||i===void 0?void 0:i.height);if(!isNaN(f)&&isFinite(f)&&(l+=f),l>=e)break}o=o.then(function(){return new Promise(function(v){AnimationFrameLoop.shared.add(function(){for(var A=0,h=c;A<h.length;A++){var p=h[A];t.initTexture(p)}v()},!0)})}).catch(function(){})};s.length>0;)u();return o}function appendSearch(n,t){if(t===void 0&&(t=""),(t[0]==="?"||t[0]==="&")&&(t=t.slice(1)),!t)return n;var e=n.indexOf("#"),r="";return e>=0&&(r=n.slice(e),n=n.slice(0,e)),(n[n.length-1]==="?"||n[n.length-1]==="&")&&(n=n.slice(0,-1)),n.indexOf("?")>=0?"".concat(n,"&").concat(t).concat(r):"".concat(n,"?").concat(t).concat(r)}const pointCloudFragmentShader=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=113,i=126,o=0,s="";return t[o].split(s).map(function(u){return u.charCodeAt(o)>i?u:String.fromCharCode((u.charCodeAt(o)+r)%i)}).join(s)}("{vs|z-sy|n-sy||H0vs-qrsv{rq5b`RlP\\[`aN[alP\\Y\\_6--{vs|z-rp@-p|{n{P|y|H0r{qvs0vs-qrsv{rq5b`Rl]\\V[al[\\_ZNY6--n\bv{t-rp@-[|znyH0r{qvs0vs-qrsv{rq5b`RlRQY6--n\bv{t-sy|n-Y|tQr}uH0r{qvsp-Pyv}}r-\n--znA-znv\x07V{rrH--sy|n-sy||V{qr\x07H\fH0vs-[bZlPYV]]R_`-K-=--{vs|z-Pyv}}r-pyv}}rh[bZlPYV]]R_`jH0r{qvsn\bv{t-rpA-d|yq]|vv|{Hn\bv{t-rp@-PnzrnQvrpv|{Hn\bv{t-rp@-P|y|Hn\bv{t-sy|n-]|v{`v rH{vs|z-sy|n-|}npv\bH{vs|z-sy|n-z|qryNy}unH{vs|z-sy|n-u|{Sy||V{qr\x07H0v{pyqr-Ip|zz|{K0v{pyqr-Is|tl}nlsntzr{K0v{pyqr-Iy|tqr}uosl}nlsntzr{K0v{pyqr-Ipyv}}v{tl}yn{rl}nlsntzr{K|vq-znv{56-\n--<<-JJJ-前置裁切计算-JJJ--0vs-[bZlPYV]]R_`-K-=----o||y-pyv}}rqH----rpA-pyv}}r]|vv|{H----0}ntzn-{|yyly||}ln----s|-5-v{-v-J-=H-v-I-[bZlPYV]]R_`H-v-88-6-\n------pyv}}r]|vv|{-J-pyv}}rh-v-j;znv\x07V{rr-7-d|yq]|vv|{H------pyv}}rq-J-5pyv}}rh-v-j;sy||V{qr\x07-I-=;=-\v\v-no5sy||-:-pyv}}rh-v-j;sy||V{qr\x076-I->;=6H------pyv}}rq-J-pyv}}rq-33-pyv}}r]|vv|{;\x07-K-:=;B-33-pyv}}r]|vv|{;\x07-I-=;BH------pyv}}rq-J-pyv}}rq-33-pyv}}r]|vv|{;\b-K-:=;B-33-pyv}}r]|vv|{;\b-I-=;BH------pyv}}rq-J-pyv}}rq-33-pyv}}r]|vv|{; -K-:=;B-33-pyv}}r]|vv|{; -I-=;BH------vs-5pyv}}rq6-\n--------qvpnqH------\f----\f----0}ntzn-{|yyly||}lr{q--0r{qvs--<<-JJJJJJJJJJJJJJJJ--<<-JJJ-形状裁切-JJJ--0vs-qrsv{rq5b`Rl]\\V[al`UN]RlPV_PYR6----sy|n--J-?;=-7-tyl]|v{P||q;\x07-:->;=H----sy|n--J-?;=-7-tyl]|v{P||q;\b-:->;=H----sy|n-pp-J-7-8-7H----vs-5]|v{`v r-K-E;=-33-pp-K->;=6-\n------qvpnqH----\f--0r{qvs--<<-JJJJJJJJJJJJJ--0v{pyqr-Iy|tqr}uoslsntzr{K--<<-JJJ-颜色-JJJ--rpA-sv{nyP|y|-J-_TOa|Yv{rn5rpA5P|y|9-|}npv\b66H--0vs-qrsv{rq5b`Rl]\\V[al[\\_ZNY6----0vs-qrsv{rq5b`Rl]\\V[alONPXlUVQQR[6------rp@-pnzrnQvrpv|{-J-{|znyv r5pnzrn]|vv|{-:-d|yq]|vv|{;\x07\b 6H------vs-5q|5pnzrnQvrpv|{9-[|zny6-I-=;=6-\n--------qvpnqH------\f----0ryvs-qrsv{rq5b`Rl]\\V[alONPXlQN_X6------rp@-pnzrnQvrpv|{-J-{|znyv r5pnzrn]|vv|{-:-d|yq]|vv|{;\x07\b 6H------vs-5q|5pnzrnQvrpv|{9-[|zny6-I-=;=6-\n--------sv{nyP|y|;\x07\b -J-sv{nyP|y|;\x07\b -7-=;EH------\f----0r{qvs--0r{qvs--tylSntP|y|-J-sv{nyP|y|H--<<-JJJJJJJJJJJ--<<-JJJ-纯色-JJJ--0vs-qrsv{rq5b`RlP\\[`aN[alP\\Y\\_6----tylSntP|y|-J-rpA5p|{n{P|y|;9-p|{n{P|y|;t9-p|{n{P|y|;o9-|}npv\b6H--0r{qvs--<<-JJJJJJJJJJJ--<<-JJJ-楼层显示-JJJ--sy|n-sy||\\}npv\b-J->;=H--vs-5u|{Sy||V{qr\x07-K-:=;=>-33-no5sy||-:-u|{Sy||V{qr\x076-K-=;FF6-\n----sy||\\}npv\b-J-=;>-7-zv{55>;=-8-PnzrnQvrpv|{;\b69->;=6H--\f--tylSntP|y|;n-J-tylSntP|y|;n-7-sy||\\}npv\bH--<<-JJJJJJJJJJJJJJ--tylSntP|y|;n-J-tylSntP|y|;n-7-z|qryNy}unH--0v{pyqr-I|{rzn}}v{tlsntzr{K--0v{pyqr-Ir{p|qv{tlsntzr{K--0v{pyqr-Is|tlsntzr{K--0v{pyqr-I}rzyv}yvrqlny}unlsntzr{K--0vs-qrsv{rq5b`RlRQY6----tylSntP|y|;n-J-Y|tQr}uH--0r{qvs--0vs-qrsv{rq5b`RlU^ldRVTUa6----sy|n-qvn{pr-J-?;=-7-yr{tu5tyl]|v{P||q;\x07\b-:-=;B6H----sy|n-rvtu-J-zn\x075=;=9->;=-:-qvn{pr6H----rvtu-J-}|5rvtu9->;B6H----tylSntP|y|;n-J-rvtuH----tylSntP|y|;\x07\b -J-tylSntP|y|;\x07\b -7-rvtuH--0r{qvs\f"),pointCloudVertexShader=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=113,i=126,o=0,s="";return t[o].split(s).map(function(u){return u.charCodeAt(o)>i?u:String.fromCharCode((u.charCodeAt(o)+r)%i)}).join(s)}("nvor-rp@-p|y|H0vs-qrsv{rq5b`Rl]\\V[alP\\Y\\_lNYaVabQR6--{vs|z-nz}yr?Q-tnqvr{ar\x07rH0r{qvs{vs|z-sy|n-sy||H0vs-qrsv{rq5b`RlRQY6--n\bv{t-sy|n-Y|tQr}uH0r{qvs{vs|z-rp?-r|yv|{H{vs|z-sy|n-}v\x07ry_nv|H{vs|z-sy|n-}|v{`pnyrH{vs|z-sy|n-}|v{Zv{]v\x07ryH{vs|z-sy|n-}|v{Zn\x07]v\x07ryH{vs|z-sy|n-|}npv\bH{vs|z-sy|n-tr|zrvpR|H{vs|z-rp@-z|qryO|{qv{tZn\x07H{vs|z-rp@-z|qryO|{qv{tZv{Hn\bv{t-rpA-d|yq]|vv|{Hn\bv{t-rp@-PnzrnQvrpv|{Hn\bv{t-rp@-P|y|Hn\bv{t-sy|n-]|v{`v rH0vs-qrsv{rq5b`Rl]\\V[al[\\_ZNY6--n\bv{t-rp@-[|znyH0r{qvs0v{pyqr-Is|tl}nlrr\x07K0v{pyqr-Iz|}untrl}nlrr\x07K0v{pyqr-Iy|tqr}uosl}nlrr\x07K0v{pyqr-Ipyv}}v{tl}yn{rl}nlrr\x07Krp@-trP|y|O\bUrvtu5nz}yr?Q-tnqvr{ar\x07r9-rpA-d|yq]|vv|{6-\n--<<-sy|n--J-5d|yq]|vv|{;\b-:-z|qryO|{qv{tZv{;\b6-<-5z|qryO|{qv{tZn\x07;\b-:-z|qryO|{qv{tZv{;\b6H--sy|n--J-d|yq]|vv|{;\b-<->=;=H--r{-r\x07r?Q5tnqvr{ar\x07r9-rp?59-=;B66;toH\f|vq-znv{56-\n--0v{pyqr-Iortv{lrr\x07K--0v{pyqr-I}|wrplrr\x07K--0v{pyqr-Iy|tqr}uoslrr\x07K--0v{pyqr-Ipyv}}v{tl}yn{rlrr\x07K--d|yq]|vv|{-J-rpA5n{s|zrq9->;=6H--0vsqrs-b`RlV[`aN[PV[T----d|yq]|vv|{-J-v{n{prZnv\x07-7-d|yq]|vv|{H--0r{qvs--d|yq]|vv|{-J-z|qryZnv\x07-7-d|yq]|vv|{H--zn@-pnzrn_|nv|{Znv\x07-J-zn@5vrZnv\x07h=jh=j9-vrZnv\x07h>jh=j9-vrZnv\x07h?jh=j9-vrZnv\x07h=jh>j9-vrZnv\x07h>jh>j9-vrZnv\x07h?jh>j9-vrZnv\x07h=jh?j9-vrZnv\x07h>jh?j9-vrZnv\x07h?jh?j6H--PnzrnQvrpv|{-J-{|znyv r5pnzrn_|nv|{Znv\x07-7-rp@5=;=9-=;=9-:>;=66H--<<传递nvor的p|y|到s里使用--<<动态调整}|v{`v r--sy|n-rny]|v{`v r-J-}|v{`pnyr-7-}v\x07ry_nv|H--0vs-qrsv{rq5b`Rl]\\V[al`VgRlTR\\ZRa_VP6----rny]|v{`v r-7J-tr|zrvpR|H----sy|n-urvtu-J->;=-<-}|wrpv|{Znv\x07h>jh>j-7-zv\x075>;=9-:z]|vv|{; 9-:}|wrpv|{Znv\x07h?jh@j6-7-?;=H----rny]|v{`v r-J-r|yv|{;\b-7-rny]|v{`v r-<-urvtuH--0ryvs-qrsv{rq5b`Rl]\\V[al`VgRlNaaR[bNaV\\[6----sy|n-urvtu-J->;=-<-}|wrpv|{Znv\x07h>jh>j-7-zv\x075>;=9-:z]|vv|{; 9-:}|wrpv|{Znv\x07h?jh@j6-7-?;=H----rny]|v{`v r-J-r|yv|{;\b-7-rny]|v{`v r-<-urvtuH--0r{qvs--tyl]|v{`v r-J-pynz}5rny]|v{`v r9-}|v{Zv{]v\x07ry-7-}v\x07ry_nv|9-}|v{Zn\x07]v\x07ry-7-}v\x07ry_nv|6H--]|v{`v r-J-tyl]|v{`v rH--0vs-qrsv{rq5b`Rl]\\V[alP\\Y\\_lNYaVabQR6----P|y|-J-trP|y|O\bUrvtu5tnqvr{ar\x07r9-d|yq]|vv|{6H--0ryr----P|y|-J-p|y|H--0r{qvs--0vs-qrsv{rq5b`Rl]\\V[al[\\_ZNY6----[|zny-J-{|znyv r5zn@5z|qryZnv\x076-7-{|zny6H--0r{qvs--0vs-qrsv{rq5b`RlRQY6----Y|tQr}u-J-y|t?5:z]|vv|{; 6H--0r{qvs--0vs-qrsv{rq5b`RlU^lQR]aU6----<<-sy|n-}|wSnp|-J-:=;B-7-r|yv|{;\b-<-5n{5s|-<-?;=6-7-z]|vv|{; 6H----<<-sy|n-_nqv-J-rny]|v{`v r-<-}|wSnp|H----sy|n-|vtv{nyQr}u-J-tyl]|vv|{;H----sy|n-nqwrqQr}u-J-|vtv{nyQr}u-8-=;>H----sy|n-nqw-J-nqwrqQr}u-<-|vtv{nyQr}uH----z]|vv|{;\x07\b -J-z]|vv|{;\x07\b -7-nqwH----tyl]|vv|{-J-}|wrpv|{Znv\x07-7-z]|vv|{H--0r{qvs--0v{pyqr-I|yq}|lrr\x07K--0v{pyqr-Is|tlrr\x07K\f");var scratchVector4=new THREE__namespace.Vector4,shaderUniforms=Object.assign({pointScale:new THREE__namespace.Uniform(1),pointMinPixel:new THREE__namespace.Uniform(1),pointMaxPixel:new THREE__namespace.Uniform(1),opacity:new THREE__namespace.Uniform(1),gradientTexture:new THREE__namespace.Uniform(null),modelAlpha:new THREE__namespace.Uniform(0),clippers:new THREE__namespace.Uniform([]),shownFloorIndex:new THREE__namespace.Uniform(-1),constantColor:new THREE__namespace.Uniform(null),geometricError:new THREE__namespace.Uniform(0),pixelRatio:new THREE__namespace.Uniform(1),resolution:new THREE__namespace.Uniform(new THREE__namespace.Vector2(512,512)),floor:new THREE__namespace.Uniform(0),brightness:new THREE__namespace.Uniform(1),modelBoundingMin:new THREE__namespace.Uniform(new THREE__namespace.Vector3),modelBoundingMax:new THREE__namespace.Uniform(new THREE__namespace.Vector3)},THREE__namespace.UniformsUtils.clone(THREE__namespace.UniformsLib.fog)),PBMPointCloudMaterial=function(n){__extends(t,n);function t(e){e===void 0&&(e={});var r,i,o,s,u,c,l,d,f,v,A,h,p,y,m,g,E,b,T,_,S,R=n.call(this,{vertexShader:pointCloudVertexShader,fragmentShader:pointCloudFragmentShader,uniforms:THREE__namespace.UniformsUtils.clone(shaderUniforms),lights:!1,defines:{USE_CONSTANT_COLOR:!1,USE_EDL:!1,USE_HQ_WEIGHT:!1,USE_HQ_DEPTH:!1,NUM_CLIPPING_BOX:!1,USE_CLIPFLOOR:!1,USE_VERTEX_MARK:!1,USE_MAP:!0,USE_UV:!0,USE_LUMINANCE:!1,USE_PANO_OPACITY:!1,USE_BLACK_TRANSITION:!1,USE_POINT_NORMAL:!1,USE_POINT_SHAPE_CIRCLE:!1,USE_POINT_SIZE_ATTENUATION:!1,USE_POINT_SIZE_GEOMETRIC:!1,USE_POINT_BACK_HIDDEN:!1,USE_POINT_BACK_DARK:!1}})||this,B;return Object.defineProperties(R,{constantColor:{get:function(){return this.uniforms.constantColor.value},set:function(I){this.uniforms.constantColor.value=I;var x=this.defines.USE_CONSTANT_COLOR,M=I!==null;x!==M&&(this.defines.USE_CONSTANT_COLOR=M,this.needsUpdate=!0)}},opacity:{get:function(){return this.uniforms.opacity.value},set:function(I){this.uniforms.opacity.value=I}},modelAlpha:{get:function(){return this.uniforms.modelAlpha.value},set:function(I){this.uniforms.modelAlpha.value=I}},shownFloorIndex:{get:function(){return this.uniforms.shownFloorIndex.value},set:function(I){this.uniforms.shownFloorIndex.value=I}},clippers:{get:function(){return B},set:function(I){B!==I&&(B=I,this.uniforms.clippers.value=(B||[]).map(function(x){var M=typeof x.floorIndex=="number"?x.floorIndex:-1,L=new THREE__namespace.Matrix4().getInverse(x.clippingBoxMatrix);return{matrixInverse:L,floorIndex:M}}),this.needsUpdate=!0)}},pointColor:{get:function(){return this.defines.USE_POINT_COLOR_ALTITUDE===!0?"ALTITUDE":"RGB"},set:function(I){var x=I==="ALTITUDE";this.defines.USE_POINT_COLOR_ALTITUDE!==x&&(this.defines.USE_POINT_COLOR_ALTITUDE=x,this.needsUpdate=!0)}},pointSize:{get:function(){return this.defines.USE_POINT_SIZE_GEOMETRIC===!0?"GEOMETRIC":this.defines.USE_POINT_SIZE_ATTENUATION===!0?"ATTENUATION":"FIXED"},set:function(I){var x=I==="ATTENUATION",M=I==="GEOMETRIC";this.defines.USE_POINT_SIZE_GEOMETRIC!==M&&(this.defines.USE_POINT_SIZE_GEOMETRIC=M,this.needsUpdate=!0),this.defines.USE_POINT_SIZE_ATTENUATION!==x&&(this.defines.USE_POINT_SIZE_ATTENUATION=x,this.needsUpdate=!0)}},pointShape:{get:function(){return this.defines.USE_POINT_SHAPE_CIRCLE===!0?"CIRCLE":"SQUARE"},set:function(I){var x=I==="CIRCLE";this.defines.USE_POINT_SHAPE_CIRCLE!==x&&(this.defines.USE_POINT_SHAPE_CIRCLE=x,this.needsUpdate=!0)}},pointScale:{get:function(){return this.uniforms.pointScale.value},set:function(I){this.uniforms.pointScale.value=I}},pointBack:{get:function(){return this.defines.USE_POINT_BACK_HIDDEN===!0?"HIDDEN":this.defines.USE_POINT_BACK_DARK===!0?"DARK":"VISIBLE"},set:function(I){var x=I==="HIDDEN",M=I==="DARK";this.defines.USE_POINT_BACK_HIDDEN!==x&&(this.defines.USE_POINT_BACK_HIDDEN=x,this.needsUpdate=!0),this.defines.USE_POINT_BACK_DARK!==M&&(this.defines.USE_POINT_BACK_DARK=M,this.needsUpdate=!0)}},pointMinPixel:{get:function(){return this.uniforms.pointMinPixel.value},set:function(I){this.uniforms.pointMinPixel.value=I}},pointMaxPixel:{get:function(){return this.uniforms.pointMaxPixel.value},set:function(I){this.uniforms.pointMaxPixel.value=I}},useEDL:{get:function(){return this.defines.USE_EDL},set:function(I){I!==this.defines.USE_EDL&&(this.defines.USE_EDL=I,this.needsUpdate=!0)}},useHQWeight:{get:function(){return this.defines.USE_HQ_WEIGHT},set:function(I){I!==this.defines.USE_HQ_WEIGHT&&(this.defines.USE_HQ_WEIGHT=I,this.needsUpdate=!0)}},useHQDepth:{get:function(){return this.defines.USE_HQ_DEPTH},set:function(I){I!==this.defines.USE_HQ_DEPTH&&(this.defines.USE_HQ_DEPTH=I,this.needsUpdate=!0)}},gradientTexture:{get:function(){return this.uniforms.gradientTexture.value},set:function(I){this.uniforms.gradientTexture.value=I}},floor:{get:function(){return this.uniforms.floor.value},set:function(I){this.uniforms.floor.value=I}},brightness:{get:function(){return this.uniforms.brightness.value},set:function(I){this.uniforms.brightness.value=I}}}),R.pano0=(r=e.pano0)!==null&&r!==void 0?r:defaultPbmParameters.pano0,R.pano1=(i=e.pano1)!==null&&i!==void 0?i:defaultPbmParameters.pano1,R.modelAlpha=(o=e.modelAlpha)!==null&&o!==void 0?o:defaultPbmParameters.modelAlpha,R.progress=(s=e.progress)!==null&&s!==void 0?s:defaultPbmParameters.progress,R.transition=(u=e.transition)!==null&&u!==void 0?u:defaultPbmParameters.transition,R.constantColor=(c=e.constantColor)!==null&&c!==void 0?c:defaultPbmParameters.constantColor,R.opacity=(l=e.opacity)!==null&&l!==void 0?l:defaultPbmParameters.opacity,R.shownFloorIndex=(d=e.shownFloorIndex)!==null&&d!==void 0?d:defaultPbmParameters.shownFloorIndex,R.clippers=(f=e.clippers)!==null&&f!==void 0?f:defaultPbmParameters.clippers,R.useEDL=(v=e.useEDL)!==null&&v!==void 0?v:defaultPbmParameters.useEDL,R.useHQWeight=(A=e.useHQWeight)!==null&&A!==void 0?A:defaultPbmParameters.useHQWeight,R.useHQDepth=(h=e.useHQDepth)!==null&&h!==void 0?h:defaultPbmParameters.useHQDepth,R.pointColor=(p=e.pointColor)!==null&&p!==void 0?p:defaultPbmParameters.pointColor,R.pointShape=(y=e.pointShape)!==null&&y!==void 0?y:defaultPbmParameters.pointShape,R.pointSize=(m=e.pointSize)!==null&&m!==void 0?m:defaultPbmParameters.pointSize,R.pointScale=(g=e.pointScale)!==null&&g!==void 0?g:defaultPbmParameters.pointScale,R.pointBack=(E=e.pointBack)!==null&&E!==void 0?E:defaultPbmParameters.pointBack,R.pointMinPixel=(b=e.pointMinPixel)!==null&&b!==void 0?b:defaultPbmParameters.pointMinPixel,R.pointMaxPixel=(T=e.pointMaxPixel)!==null&&T!==void 0?T:defaultPbmParameters.pointMaxPixel,R.gradientTexture=(_=e.gradientTexture)!==null&&_!==void 0?_:defaultPbmParameters.gradientTexture,R.brightness=(S=e.brightness)!==null&&S!==void 0?S:defaultPbmParameters.brightness,R.floor=0,R.transparent=!0,R}return t.prototype.onBeforeCompile=function(e,r){var i,o,s=String((o=(i=this.clippers)===null||i===void 0?void 0:i.length)!==null&&o!==void 0?o:0);e.vertexShader=e.vertexShader.replace(/NUM_CLIPPERS/g,s),e.fragmentShader=e.fragmentShader.replace(/NUM_CLIPPERS/g,s)},t.prototype.update=function(e,r){if(r instanceof Camera)this.uniforms.pixelRatio.value=r.pixelRatio,this.uniforms.resolution.value.copy(r.resolution);else{this.uniforms.pixelRatio.value=e.getPixelRatio();var i=e.getViewport(scratchVector4);this.uniforms.resolution.value.set(i.z,i.w)}this.transparent=!1,this.shownFloorIndex>-1&&(this.transparent=this.shownFloorIndex!==this.floor),this.modelAlpha<1&&(this.transparent=!0),this.opacity<1&&(this.transparent=!0),this.brightness<1&&(this.transparent=!0),this.depthWrite=!0,this.depthTest=!0,this.useEDL&&(this.transparent=!1),this.useHQWeight?(this.depthWrite=!1,this.blending=THREE__namespace.CustomBlending,this.blendSrc=THREE__namespace.SrcAlphaFactor,this.blendSrcAlpha=THREE__namespace.SrcAlphaFactor,this.blendDst=THREE__namespace.OneFactor,this.blendDstAlpha=THREE__namespace.OneFactor):(this.blending=THREE__namespace.NormalBlending,this.blendDst=THREE__namespace.OneMinusSrcAlphaFactor,this.blendEquation=THREE__namespace.AddEquation,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null)},t.prototype.syncModel=function(e){var r="".concat(e.id,":").concat(e.materialVersion);r!==this.syncModelVersion&&(Object.assign(this,e.getMaterial()),this.uniforms.modelBoundingMax.value.copy(e.bounding.max),this.uniforms.modelBoundingMin.value.copy(e.bounding.min),this.syncModelVersion=r)},t.prototype.copy=function(e){return n.prototype.copy.call(this,this),this.pano0=e.pano0,this.pano1=e.pano1,this.progress=e.progress,this.transition=e.transition,this.shownFloorIndex=e.shownFloorIndex,this.brightness=e.brightness,this.clippers=e.clippers,this.constantColor=e.constantColor,this.modelAlpha=e.modelAlpha,this.useEDL=e.useEDL,this.useHQWeight=e.useHQWeight,this.useHQDepth=e.useHQDepth,this.pointColor=e.pointColor,this.pointSize=e.pointSize,this.pointShape=e.pointShape,this.pointScale=e.pointScale,this.pointBack=e.pointBack,this.pointMinPixel=e.pointMinPixel,this.pointMaxPixel=e.pointMaxPixel,this.gradientTexture=e.gradientTexture,this},t}(THREE__namespace.ShaderMaterial),SIZEOF_UINT32$1=4;function parseHeader(n,t,e){var r=new DataView(t);if(n.magic=r.getUint32(e,!0),e+=SIZEOF_UINT32$1,n.version=r.getUint32(e,!0),e+=SIZEOF_UINT32$1,n.byteLength=r.getUint32(e,!0),e+=SIZEOF_UINT32$1,n.version!==1)throw new Error("3D Tile Version ".concat(n.version," not supported"));return e}var _a$3,GL_TYPE;(function(n){n[n.BYTE=5120]="BYTE",n[n.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",n[n.SHORT=5122]="SHORT",n[n.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",n[n.INT=5124]="INT",n[n.UNSIGNED_INT=5125]="UNSIGNED_INT",n[n.FLOAT=5126]="FLOAT",n[n.DOUBLE=5130]="DOUBLE"})(GL_TYPE||(GL_TYPE={}));var GL_TYPE_TO_ARRAY_TYPE=(_a$3={},_a$3[GL_TYPE.DOUBLE]=Float64Array,_a$3[GL_TYPE.FLOAT]=Float32Array,_a$3[GL_TYPE.UNSIGNED_SHORT]=Uint16Array,_a$3[GL_TYPE.UNSIGNED_INT]=Uint32Array,_a$3[GL_TYPE.UNSIGNED_BYTE]=Uint8Array,_a$3[GL_TYPE.BYTE]=Int8Array,_a$3[GL_TYPE.SHORT]=Int16Array,_a$3[GL_TYPE.INT]=Int32Array,_a$3),NAME_TO_GL_TYPE={DOUBLE:GL_TYPE.DOUBLE,FLOAT:GL_TYPE.FLOAT,UNSIGNED_SHORT:GL_TYPE.UNSIGNED_SHORT,UNSIGNED_INT:GL_TYPE.UNSIGNED_INT,UNSIGNED_BYTE:GL_TYPE.UNSIGNED_BYTE,BYTE:GL_TYPE.BYTE,SHORT:GL_TYPE.SHORT,INT:GL_TYPE.INT};function getArrayType(n){var t=GL_TYPE_TO_ARRAY_TYPE[n];if(!t)throw new Error("Failed to convert GL type");return t}function getByteSize(n){var t=getArrayType(n);return t.BYTES_PER_ELEMENT}function createTypedArray(n,t,e,r){e===void 0&&(e=0);var i=getArrayType(n);if(e%getByteSize(n)!==0){var o=r?t.slice(e,e+r*getByteSize(n)):t.slice(e);return new i(o)}else return new i(t,e,r!=null?r:(t.byteLength-e)/getByteSize(n))}function glTypeFromName(n){var t=NAME_TO_GL_TYPE[n];if(!t)throw new Error("Failed to convert GL type");return t}var FeatureTable=function(){function n(t,e){this.featuresLength=0,this.cachedTypedArrays={},this.json=t,this.buffer=e;var r=this.getGlobalProperty("POINTS_LENGTH",GL_TYPE.UNSIGNED_INT,1);r&&r.length&&(this.featuresLength=r[0])}return n.prototype.getExtension=function(t){return this.json.extensions&&this.json.extensions[t]},n.prototype.hasProperty=function(t){return!!this.json[t]},n.prototype.getGlobalProperty=function(t,e,r){var i=this.json[t];if(typeof i=="number"){var o=getArrayType(e);return new o([i])}else if(Array.isArray(i)){var o=getArrayType(e);return new o(i)}else if(i&&Number.isFinite(i.byteOffset))return this.getTypedArrayFromBinary(t,e,r,1,i.byteOffset);return null},n.prototype.getPropertyArray=function(t,e,r){var i=this.json[t];return i&&Number.isFinite(i.byteOffset)?("componentType"in i&&(e=glTypeFromName(i.componentType)),this.getTypedArrayFromBinary(t,e,r,this.featuresLength,i.byteOffset)):this.getTypedArrayFromArray(t,e,i)},n.prototype.getProperty=function(t,e,r,i,o){var s=this.json[t];if(!s)return null;var u=this.getPropertyArray(t,e,r);if(r===1)return o[0]=u[i],o;for(var c=0;c<r;++c)o[c]=u[r*i+c];return o},n.prototype.getTypedArrayFromBinary=function(t,e,r,i,o){var s=this.cachedTypedArrays,u=s[t];return u||(u=createTypedArray(e,this.buffer.buffer,this.buffer.byteOffset+o,i*r),s[t]=u),u},n.prototype.getTypedArrayFromArray=function(t,e,r){var i=this.cachedTypedArrays,o=i[t];return o||(o=createTypedArray(e,r),i[t]=o),o},n}(),SIZEOF_UINT32=4,DEPRECATION_WARNING="b3dm tile in legacy format.";function getStringFromArrayBuffer(n,t,e){var r=new TextDecoder("utf8"),i=new Uint8Array(n,t,e),o=r.decode(i);return o}function parseTable(n,t,e){return e=parseTablesHeader(n,t,e),e=parseFeatureTable(n,t,e),e=parseBatchTable(n,t,e),e}function parseTablesHeader(n,t,e){var r=new DataView(t),i=0;n.header=n.header||{};var o=r.getUint32(e,!0);e+=SIZEOF_UINT32;var s=r.getUint32(e,!0);e+=SIZEOF_UINT32;var u=r.getUint32(e,!0);e+=SIZEOF_UINT32;var c=r.getUint32(e,!0);return e+=SIZEOF_UINT32,u>=570425344?(e-=SIZEOF_UINT32*2,i=o,u=s,c=0,o=0,s=0,console.warn(DEPRECATION_WARNING)):c>=570425344&&(e-=SIZEOF_UINT32,i=u,u=o,c=s,o=0,s=0,console.warn(DEPRECATION_WARNING)),n.header.featureTableJsonByteLength=o,n.header.featureTableBinaryByteLength=s,n.header.batchTableJsonByteLength=u,n.header.batchTableBinaryByteLength=c,n.header.batchLength=i,e}function parseFeatureTable(n,t,e){var r=n.header||{},i=r.featureTableJsonByteLength,o=r.featureTableBinaryByteLength,s=r.batchLength;if(n.featureTableJson={BATCH_LENGTH:s||0},i&&i>0){var u=getStringFromArrayBuffer(t,e,i);n.featureTableJson=JSON.parse(u)}e+=i||0,n.featureTableBinary=new Uint8Array(t,e,o),e+=o||0,n.rtcCenter=[0,0,0];var c=new FeatureTable(n.featureTableJson,n.featureTableBinary);if(Array.isArray(c.json.RTC_CENTER)){var l=c.json.RTC_CENTER;n.rtcCenter[0]=l[0],n.rtcCenter[1]=l[1],n.rtcCenter[2]=l[2]}else{var l=c.getGlobalProperty("RTC_CENTER",GL_TYPE.FLOAT,3);l&&(n.rtcCenter[0]=l[0],n.rtcCenter[1]=l[1],n.rtcCenter[2]=l[2])}return e}function parseBatchTable(n,t,e){var r=n.header||{},i=r.batchTableJsonByteLength,o=r.batchTableBinaryByteLength;if(i&&i>0){var s=getStringFromArrayBuffer(t,e,i);n.batchTableJson=JSON.parse(s),e+=i,o&&o>0&&(n.batchTableBinary=new Uint8Array(t,e,o),n.batchTableBinary=new Uint8Array(n.batchTableBinary),e+=o)}return e}function sliceArrayBuffer(n,t,e){var r=e!==void 0?new Uint8Array(n).subarray(t,t+e):new Uint8Array(n).subarray(t),i=new Uint8Array(r);return i.buffer}function parseGlTFArrayBuffer(n,t,e){var r=n.byteLength-e;if(r===0)throw new Error("glTF byte length must be greater than 0.");return e%4!==0&&console.warn("".concat(n.type,": embedded glb is not aligned to a 4-byte boundary.")),n.gltfArrayBuffer=sliceArrayBuffer(t,e,r),n.byteLength}function decodeText(n){if(typeof TextDecoder!="undefined")return new TextDecoder().decode(n);for(var t="",e=0,r=n.length;e<r;e++)t+=String.fromCharCode(n[e]);try{return decodeURIComponent(escape(t))}catch(i){return t}}var WEBGL_CONSTANTS={FLOAT:5126,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,LINEAR:9729,REPEAT:10497,SAMPLER_2D:35678,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123},WEBGL_COMPONENT_TYPES={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},WEBGL_FILTERS={9728:THREE__namespace.NearestFilter,9729:THREE__namespace.LinearFilter,9984:THREE__namespace.NearestMipmapNearestFilter,9985:THREE__namespace.LinearMipmapNearestFilter,9986:THREE__namespace.NearestMipmapLinearFilter,9987:THREE__namespace.LinearMipmapLinearFilter},WEBGL_WRAPPINGS={33071:THREE__namespace.ClampToEdgeWrapping,33648:THREE__namespace.MirroredRepeatWrapping,10497:THREE__namespace.RepeatWrapping},WEBGL_TYPE_SIZES={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},ATTRIBUTES={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv2",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},PATH_PROPERTIES={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},INTERPOLATION={CUBICSPLINE:void 0,LINEAR:THREE__namespace.InterpolateLinear,STEP:THREE__namespace.InterpolateDiscrete},ALPHA_MODES={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function values(n){var t=[];for(var e in n)t.push(n[e]);return t}function composeDsiposeSet(n){var t=Array.from(n);return function(){for(var e=0,r=t;e<r.length;e++){var i=r[e];typeof i.dispose=="function"&&i.dispose(),typeof i.close=="function"&&i.close()}}}var Parser=function(){function n(t,e,r){this.json=t,this.extensions=e,this.options=r,this.cache=new Map,this.disposeSet=new Set,this.textureSet=new Set,this.nodeNamesUsed={}}return n.prototype.dispose=function(){this.cache.clear(),this.disposeSet.forEach(function(t){typeof t.dispose=="function"&&t.dispose(),typeof t.close=="function"&&t.close()}),this.disposeSet.clear(),this.textureSet.clear(),this.extensions={},this.json={asset:{version:"unknown"}}},n.prototype.markDefs=function(){for(var t=this.json.nodes||[],e=this.json.skins||[],r=this.json.meshes||[],i=0,o=e.length;i<o;i++)for(var s=e[i].joints,u=0,c=s.length;u<c;u++)t[s[u]].isBone=!0;for(var l=0,d=t.length;l<d;l++){var f=t[l];f.mesh!==void 0&&f.skin!==void 0&&(r[f.mesh].isSkinnedMesh=!0)}},n.prototype.parse=function(){var t=this,e=this.json,r=this.extensions;this.markDefs();for(var i=0,o=values(r);i<o.length;i++){var s=o[i];s.markDefs(this)}return Promise.all(values(r).map(function(u){return u.prepare(t)})).then(function(){var u,c,l;return Promise.all([Promise.all(((u=e.scenes)!==null&&u!==void 0?u:[]).map(function(d,f){return t.loadScene(f)})),Promise.all(((c=e.animations)!==null&&c!==void 0?c:[]).map(function(d,f){return t.loadAnimation(f)})),Promise.all(((l=e.cameras)!==null&&l!==void 0?l:[]).map(function(d,f){return t.loadCamera(f)}))])}).then(function(u){var c=u[0],l=u[1],d=u[2],f={json:e,scene:c[e.scene||0],scenes:c,animations:l,cameras:d,textures:[],dispose:noop$1};return f}).then(function(u){return Promise.all(values(r).map(function(c){return c.emitResult(u,t)})).then(function(){return u})}).then(function(u){var c=Array.from(t.textureSet),l=composeDsiposeSet(t.disposeSet);return Object.assign(u,{textures:c,dispose:l}),t.textureSet.clear(),t.disposeSet.clear(),t.dispose(),u})},n.prototype.loadCamera=function(t){var e="camera:"+t,r=this.cache.get(e);if(r)return r;for(var i=null,o=0,s=values(this.extensions);o<s.length;o++){var u=s[o];if(i=u.loadCamera(t,this),i)break}if(!i){var c=void 0,l=this.json.cameras[t],d=l[l.type];d?l.type==="perspective"?c=new THREE__namespace.PerspectiveCamera(THREE__namespace.MathUtils.radToDeg(d.yfov),d.aspectRatio||1,d.znear||1,d.zfar||2e6):l.type==="orthographic"?c=new THREE__namespace.OrthographicCamera(-d.xmag,d.xmag,d.ymag,-d.ymag,d.znear,d.zfar):(console.warn("glTF: Invalid camera type ".concat(l.type,".")),c=new THREE__namespace.Camera):(console.warn("glTF: Missing camera parameters."),c=new THREE__namespace.Camera),l.name&&(c.name=this.createUniqueName(l.name)),i=Promise.resolve(c)}return this.cache.set(e,i),i},n.prototype.loadSkin=function(t){var e="animation:"+t,r=this.cache.get(e);if(r)return r;var i,o=this.json.skins[t],s={joints:o.joints};return o.inverseBindMatrices===void 0?i=Promise.resolve(s):i=this.loadAccessor(o.inverseBindMatrices).then(function(u){return u&&(s.inverseBindMatrices=u),s}),this.cache.set(e,i),i},n.prototype.loadAnimation=function(t){var e="animation:"+t,r=this.cache.get(e);if(r)return r;for(var i=null,o=0,s=values(this.extensions);o<s.length;o++){var u=s[o];if(i=u.loadAnimation(t,this),i)break}if(!i){for(var c=this.json,l=c.animations[t],d=[],f=[],v=[],A=[],h=[],p=0,y=l.channels.length;p<y;p++){var m=l.channels[p],g=l.samplers[m.sampler],E=m.target,b=E.node!==void 0?E.node:E.id,T=l.parameters!==void 0?l.parameters[g.input]:g.input,_=l.parameters!==void 0?l.parameters[g.output]:g.output;d.push(this.loadNode(b)),f.push(this.loadAccessor(T)),v.push(this.loadAccessor(_)),A.push(g),h.push(E)}i=Promise.all([Promise.all(d),Promise.all(f),Promise.all(v),Promise.all(A),Promise.all(h)]).then(function(S){for(var R=S[0],B=S[1],I=S[2],x=S[3],M=S[4],L=[],C=function(G,Q){var U=R[G],D=B[G],q=I[G],z=x[G],K=M[G];if(U===void 0)return"continue";U.updateMatrix(),U.matrixAutoUpdate=!0;var J=void 0;switch(PATH_PROPERTIES[K.path]){case PATH_PROPERTIES.weights:J=THREE__namespace.NumberKeyframeTrack;break;case PATH_PROPERTIES.rotation:J=THREE__namespace.QuaternionKeyframeTrack;break;case PATH_PROPERTIES.position:case PATH_PROPERTIES.scale:default:J=THREE__namespace.VectorKeyframeTrack;break}var j=U.name?U.name:U.uuid,re=z.interpolation!==void 0?INTERPOLATION[z.interpolation]:THREE__namespace.InterpolateLinear,W=[];PATH_PROPERTIES[K.path]===PATH_PROPERTIES.weights?U.traverse(function(se){se.morphTargetInfluences&&W.push(se.name?se.name:se.uuid)}):W.push(j);var te=q.array;if(q.normalized){for(var $=getNormalizedComponentScale(te.constructor),ne=new Float32Array(te.length),ee=0,ce=te.length;ee<ce;ee++)ne[ee]=te[ee]*$;te=ne}for(var ee=0,ce=W.length;ee<ce;ee++){var ae=new J(W[ee]+"."+PATH_PROPERTIES[K.path],D.array,te,re);L.push(ae)}},H=0,F=R.length;H<F;H++)C(H);var O=l.name?l.name:"animation_"+t;return new THREE__namespace.AnimationClip(O,void 0,L)})}return this.cache.set(e,i),i},n.prototype.loadBuffer=function(t){var e=this.json.buffers[t];if(e.type&&e.type!=="arraybuffer")throw new Error("glTF: "+e.type+" buffer type is not supported.");var r="buffer:"+t,i=this.cache.get(r);if(i)return i;for(var o=null,s=0,u=values(this.extensions);s<u.length;s++){var c=u[s];if(o=c.loadBuffer(t,this),o)break}if(!o){var l=this.json.buffers[t];o=this.options.fetcher.ajax(this.resolveResouce(l.uri),{responseType:"arraybuffer"}).then(function(d){return d.body})}return this.cache.set(r,o),o},n.prototype.loadBufferView=function(t){var e="bufferView:"+t,r=this.cache.get(e);if(r)return r;for(var i=null,o=0,s=values(this.extensions);o<s.length;o++){var u=s[o];if(i=u.loadBufferView(t,this),i)break}if(!i){var c=this.json.bufferViews[t];i=this.loadBuffer(c.buffer).then(function(l){var d=c.byteLength||0,f=c.byteOffset||0;return l.slice(f,f+d)})}return this.cache.set(e,i),i},n.prototype.loadAccessor=function(t){var e=this,r="accessor:"+t,i=this.cache.get(r);if(i)return i;var o=null;if(!o){var s=this.json.accessors[t];if(s.bufferView===void 0&&s.sparse===void 0)o=Promise.resolve(null);else{var u=[];s.bufferView!==void 0?u.push(this.loadBufferView(s.bufferView)):u.push(Promise.resolve(null)),s.sparse!==void 0&&(u.push(this.loadBufferView(s.sparse.indices.bufferView)),u.push(this.loadBufferView(s.sparse.values.bufferView))),o=Promise.all(u).then(function(c){var l=c[0],d=WEBGL_TYPE_SIZES[s.type],f=WEBGL_COMPONENT_TYPES[s.componentType],v=f.BYTES_PER_ELEMENT,A=v*d,h=s.byteOffset||0,p=s.bufferView!==void 0?e.json.bufferViews[s.bufferView].byteStride:void 0,y=s.normalized===!0,m,g;if(p&&p!==A){var E=Math.floor(h/p),b="InterleavedBuffer:"+s.bufferView+":"+s.componentType+":"+E+":"+s.count,T=e.cache.get(b);T||(m=new f(l,E*p,s.count*p/v),T=new THREE__namespace.InterleavedBuffer(m,p/v),e.cache.set(b,T)),g=new THREE__namespace.InterleavedBufferAttribute(T,d,h%p/v,y)}else l===null?m=new f(s.count*d):m=new f(l,h,s.count*d),g=new THREE__namespace.BufferAttribute(m,d,y);if(s.sparse!==void 0){var _=WEBGL_TYPE_SIZES.SCALAR,S=WEBGL_COMPONENT_TYPES[s.sparse.indices.componentType],R=s.sparse.indices.byteOffset||0,B=s.sparse.values.byteOffset||0,I=new S(c[1],R,s.sparse.count*_),x=new f(c[2],B,s.sparse.count*d);l!==null&&(g=new THREE__namespace.BufferAttribute(g.array.slice(),g.itemSize,g.normalized));for(var M=0,L=I.length;M<L;M++){var C=I[M];if(g.setX(C,x[M*d]),d>=2&&g.setY(C,x[M*d+1]),d>=3&&g.setZ(C,x[M*d+2]),d>=4&&g.setW(C,x[M*d+3]),d>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return g})}}return this.cache.set(r,o),o},n.prototype.createPrimitiveKey=function(t){for(var e=0,r=values(this.extensions);e<r.length;e++){var i=r[e],o=i.createPrimitiveKey(t,this);if(o)return o}for(var s="",u=Object.keys(t.attributes).sort(),c=0,l=u.length;c<l;c++)s+=u[c]+":"+t.attributes[u[c]]+";";return t.indices+":"+s+":"+t.mode},n.prototype.loadGeometry=function(t){for(var e=this,r=null,i=0,o=values(this.extensions);i<o.length;i++){var s=o[i];if(r=s.loadGeometry(t,this),r)break}return r||(r=this.addGeometryPrimitiveAttributes(new THREE__namespace.BufferGeometry,t)),r=r.then(function(u){return e.disposeSet.add(u),u}),r},n.prototype.loadImage=function(t){for(var e=this,r=null,i=0,o=values(this.extensions);i<o.length;i++){var s=o[i];if(r=s.loadImage(t,this),r)break}if(!r){var u=this.json.images[t];if(u.bufferView!==void 0){var c=this.json.bufferViews[u.bufferView];r=this.loadBuffer(c.buffer).then(function(d){var f=c.byteOffset||0,v=c.byteLength||0,A=new Uint8Array(d,f,v),h=new Blob([A],{type:u.mimeType});return createImageBitmapLike(h)})}else if(u.uri){var l=this.resolveResouce(u.uri);r=this.options.fetcher.loadImage(l,{},void 0,void 0,void 0,createImageBitmapLikeImage()).then(function(d){return d.body})}else throw new Error("glTF: Invalid image defs.")}return r=r.then(function(d){return e.disposeSet.add(d),d}),r},n.prototype.loadMaterialAsMeshStandardMaterial=function(t){var e=this,r=[],i=new THREE__namespace.MeshStandardMaterial;if(i.color=new THREE__namespace.Color(1,1,1),i.opacity=1,Object.keys(t.attributes).filter(function(d){return ATTRIBUTES[d]==="color"}).length>0&&(i.vertexColors=!0),Object.keys(t.attributes).filter(function(d){return ATTRIBUTES[d]==="normal"}).length===0&&(i.flatShading=!0),Object.keys(t.attributes).filter(function(d){return ATTRIBUTES[d]==="tangent"}).length===0&&(i.normalScale&&(i.normalScale.y*=-1),i.clearcoatNormalScale&&(i.clearcoatNormalScale.y*=-1)),t.material!==void 0){var o=this.json.materials[t.material];o.name&&(i.name=o.name);var s=o.pbrMetallicRoughness||{};if(Array.isArray(s.baseColorFactor)){var u=s.baseColorFactor;i.color.fromArray(u),i.opacity=u[3]}s.baseColorTexture!==void 0&&r.push(this.createMaterialTexture(s.baseColorTexture).then(function(d){d.encoding=THREE__namespace.sRGBEncoding,i.map=d,e.disposeSet.add(d)})),i.metalness=s.metallicFactor!==void 0?s.metallicFactor:1,i.roughness=s.roughnessFactor!==void 0?s.roughnessFactor:1,s.metallicRoughnessTexture!==void 0&&r.push(this.createMaterialTexture(s.metallicRoughnessTexture).then(function(d){d.encoding=THREE__namespace.sRGBEncoding,i.metalnessMap=d,i.roughnessMap=d,e.disposeSet.add(d)})),o.doubleSided===!0&&(i.side=THREE__namespace.DoubleSide);var c=o.alphaMode||ALPHA_MODES.OPAQUE;if(c===ALPHA_MODES.BLEND?(i.transparent=!0,i.depthWrite=!1):(i.transparent=!1,c===ALPHA_MODES.MASK&&(i.alphaTest=o.alphaCutoff!==void 0?o.alphaCutoff:.5)),o.normalTexture!==void 0&&(r.push(this.createMaterialTexture(o.normalTexture).then(function(d){i.normalMap=d,e.disposeSet.add(d)})),i.normalScale=new THREE__namespace.Vector2(1,1),o.normalTexture.scale!==void 0)){var l=o.normalTexture.scale;i.normalScale.set(l,l)}o.occlusionTexture!==void 0&&(r.push(this.createMaterialTexture(o.occlusionTexture).then(function(d){i.aoMap=d,e.disposeSet.add(d)})),o.occlusionTexture.strength!==void 0&&(i.aoMapIntensity=o.occlusionTexture.strength)),o.emissiveFactor!==void 0&&(i.emissive=new THREE__namespace.Color().fromArray(o.emissiveFactor)),o.emissiveTexture!==void 0&&r.push(this.createMaterialTexture(o.emissiveTexture).then(function(d){i.emissiveMap=d,e.disposeSet.add(d)}))}return this.disposeSet.add(i),Promise.all(r).then(function(){return i})},n.prototype.loadMaterialAsLineBasicMaterial=function(t){var e=[],r=new THREE__namespace.LineBasicMaterial;if(r.color=new THREE__namespace.Color(1,1,1),r.opacity=1,Object.keys(t.attributes).filter(function(c){return ATTRIBUTES[c]==="color"}).length>0&&(r.vertexColors=!0),Object.keys(t.attributes).filter(function(c){return ATTRIBUTES[c]==="tangent"}).length===0&&(r.normalScale&&(r.normalScale.y*=-1),r.clearcoatNormalScale&&(r.clearcoatNormalScale.y*=-1)),t.material!==void 0){var i=this.json.materials[t.material];i.name&&(r.name=i.name);var o=i.pbrMetallicRoughness||{};if(Array.isArray(o.baseColorFactor)){var s=o.baseColorFactor;r.color.fromArray(s),r.opacity=s[3]}i.doubleSided===!0&&(r.side=THREE__namespace.DoubleSide);var u=i.alphaMode||ALPHA_MODES.OPAQUE;u===ALPHA_MODES.BLEND?(r.transparent=!0,r.depthWrite=!1):(r.transparent=!1,u===ALPHA_MODES.MASK&&(r.alphaTest=i.alphaCutoff!==void 0?i.alphaCutoff:.5))}return this.disposeSet.add(r),Promise.all(e).then(function(){return r})},n.prototype.loadMaterialAsPointsMaterial=function(t){var e=this,r=[],i=new THREE__namespace.PointsMaterial;if(i.color=new THREE__namespace.Color(1,1,1),i.opacity=1,i.sizeAttenuation=!1,Object.keys(t.attributes).filter(function(l){return ATTRIBUTES[l]==="color"}).length>0&&(i.vertexColors=!0),Object.keys(t.attributes).filter(function(l){return ATTRIBUTES[l]==="tangent"}).length===0&&(i.normalScale&&(i.normalScale.y*=-1),i.clearcoatNormalScale&&(i.clearcoatNormalScale.y*=-1)),t.material!==void 0){var o=this.json.materials[t.material];o.name&&(i.name=o.name);var s=o.pbrMetallicRoughness||{};if(Array.isArray(s.baseColorFactor)){var u=s.baseColorFactor;i.color.fromArray(u),i.opacity=u[3]}s.baseColorTexture!==void 0&&r.push(this.createMaterialTexture(s.baseColorTexture).then(function(l){l.encoding=THREE__namespace.sRGBEncoding,i.map=l,e.disposeSet.add(l)})),o.doubleSided===!0&&(i.side=THREE__namespace.DoubleSide);var c=o.alphaMode||ALPHA_MODES.OPAQUE;c===ALPHA_MODES.BLEND?(i.transparent=!0,i.depthWrite=!1):(i.transparent=!1,c===ALPHA_MODES.MASK&&(i.alphaTest=o.alphaCutoff!==void 0?o.alphaCutoff:.5))}return this.disposeSet.add(i),Promise.all(r).then(function(){return i})},n.prototype.loadMaterial=function(t){var e,r=(e=t.mode)!==null&&e!==void 0?e:WEBGL_CONSTANTS.TRIANGLES,i="material:"+this.createPrimitiveKey(t),o=this.cache.get(i);if(o)return o;for(var s=null,u=0,c=values(this.extensions);u<c.length;u++){var l=c[u];if(s=l.loadMaterial(t,this),s)break}if(r===WEBGL_CONSTANTS.TRIANGLES||r===WEBGL_CONSTANTS.TRIANGLE_STRIP||r===WEBGL_CONSTANTS.TRIANGLE_FAN)s=this.loadMaterialAsMeshStandardMaterial(t);else if(r===WEBGL_CONSTANTS.LINES||r===WEBGL_CONSTANTS.LINE_STRIP||r===WEBGL_CONSTANTS.LINE_LOOP)s=this.loadMaterialAsLineBasicMaterial(t);else if(r===WEBGL_CONSTANTS.POINTS)s=this.loadMaterialAsPointsMaterial(t);else throw new Error("glTF: Primitive mode unsupported: "+r);return this.cache.set(i,s),s},n.prototype.loadTexture=function(t){var e=this,r="texture:"+t,i=this.cache.get(r);if(i)return i;for(var o=null,s=0,u=values(this.extensions);s<u.length;s++){var c=u[s];if(o=c.loadTexture(t,this),o)break}if(!o){var l=this.json.textures[t];o=this.loadImage(l.source).then(function(d){var f=new THREE__namespace.Texture(d);f.needsUpdate=!0,f.flipY=!1,l.name&&(f.name=l.name);var v=e.json.samplers||{},A=v[l.sampler]||{};return f.magFilter=WEBGL_FILTERS[A.magFilter]||THREE__namespace.LinearFilter,f.minFilter=WEBGL_FILTERS[A.minFilter]||THREE__namespace.LinearMipmapLinearFilter,f.wrapS=WEBGL_WRAPPINGS[A.wrapS]||THREE__namespace.RepeatWrapping,f.wrapT=WEBGL_WRAPPINGS[A.wrapT]||THREE__namespace.RepeatWrapping,f.onUpdate=function(){d.close()},f})}return o=o.then(function(d){return e.disposeSet.add(d),d}),this.cache.set(r,o),o},n.prototype.loadMesh=function(t){for(var e=this,r=null,i=0,o=values(this.extensions);i<o.length;i++){var s=o[i];if(r=s.loadMesh(t,this),r)break}if(!r){var u=this.json.meshes[t],c=u.primitives,l=Promise.all(c.map(function(f){return e.loadGeometry(f)})),d=Promise.all(c.map(function(f){return e.loadMaterial(f)}));r=Promise.all([l,d]).then(function(f){for(var v=f[0],A=f[1],h=[],p=0;p<c.length;p++){var y=c[p],m=v[p],g=A[p],E=y.mode||WEBGL_CONSTANTS.TRIANGLES,b=void 0;if(E===WEBGL_CONSTANTS.TRIANGLES||E===WEBGL_CONSTANTS.TRIANGLE_STRIP||E===WEBGL_CONSTANTS.TRIANGLE_FAN)if(E===WEBGL_CONSTANTS.TRIANGLE_STRIP?m=e.toGeometryTrianglesDrawMode(m,THREE__namespace.TriangleStripDrawMode):E===WEBGL_CONSTANTS.TRIANGLE_FAN&&(m=e.toGeometryTrianglesDrawMode(m,THREE__namespace.TriangleFanDrawMode)),e.disposeSet.add(m),u.isSkinnedMesh){var T=new THREE__namespace.SkinnedMesh(m,g);m.attributes.skinWeight.normalized||T.normalizeSkinWeights(),b=T}else b=new THREE__namespace.Mesh(m,g);else if(E===WEBGL_CONSTANTS.POINTS)b=new THREE__namespace.Points(m,g);else if(E===WEBGL_CONSTANTS.LINES)b=new THREE__namespace.LineSegments(m,g);else if(E===WEBGL_CONSTANTS.LINE_STRIP)b=new THREE__namespace.Line(m,g);else if(E===WEBGL_CONSTANTS.LINE_LOOP)b=new THREE__namespace.LineLoop(m,g);else throw new Error("glTF: Primitive mode unsupported: "+E);if(Object.keys(m.morphAttributes).length>0){if(u.weights!==void 0)for(var _=0,S=u.weights.length;_<S;_++)b.morphTargetInfluences[_]=u.weights[_];if(u.extras&&Array.isArray(u.extras.targetNames)){var R=u.extras.targetNames;if(b.morphTargetInfluences.length===R.length){b.morphTargetDictionary={};for(var _=0,S=R.length;_<S;_++)b.morphTargetDictionary[R[_]]=_}else console.warn("glTF: Invalid extras.targetNames length. Ignoring names.")}}b.name=e.createUniqueName(u.name||"mesh_"+t),h.push(b)}if(h.length===1)return h[0];for(var B=new THREE__namespace.Group,I=0,x=h;I<x.length;I++){var b=x[I];B.add(b)}return B})}return r},n.prototype.loadNodeAttachments=function(t){for(var e=[],r=0,i=values(this.extensions);r<i.length;r++){var o=i[r],s=o.loadNodeAttachments(t,this);s&&e.push(s)}return e},n.prototype.loadNode=function(t){var e="node:"+t,r=this.cache.get(e);if(r)return r;var i=this.json,o=i.nodes[t],s=o.name?this.createUniqueName(o.name):"",u=[];o.mesh!==void 0&&u.push(this.loadMesh(o.mesh).then(function(v){if(o.weights!==void 0){var A=o.weights;v.traverse(function(h){if(h instanceof THREE__namespace.Mesh||h instanceof THREE__namespace.Line||h instanceof THREE__namespace.Points)for(var p=0,y=A.length;p<y;p++)h.morphTargetInfluences[p]=A[p]})}return v})),o.camera!==void 0&&u.push(this.loadCamera(o.camera));for(var c=this.loadNodeAttachments(t),l=0,d=c;l<d.length;l++){var f=d[l];u.push(f)}return Promise.all(u).then(function(v){var A;if(o.isBone===!0?A=new THREE__namespace.Bone:v.length>1?A=new THREE__namespace.Group:v.length===1?A=v[0]:A=new THREE__namespace.Object3D,A!==v[0])for(var h=0,p=v.length;h<p;h++)A.add(v[h]);if(o.name&&(A.name=s),o.matrix!==void 0){var y=new THREE__namespace.Matrix4;y.fromArray(o.matrix),A.applyMatrix4(y)}else o.translation!==void 0&&A.position.fromArray(o.translation),o.rotation!==void 0&&A.quaternion.fromArray(o.rotation),o.scale!==void 0&&A.scale.fromArray(o.scale);return A})},n.prototype.loadScene=function(t){var e=this.json,r=e.scenes[t],i=new THREE__namespace.Group;r.name&&(i.name=this.createUniqueName(r.name));for(var o=r.nodes||[],s=[],u=0,c=o.length;u<c;u++)s.push(this.buildNodeHierarchy(o[u],i));return Promise.all(s).then(function(){return i})},n.prototype.createMaterialTexture=function(t){var e=this;return this.loadTexture(t.index).then(function(r){for(var i=0,o=values(e.extensions);i<o.length;i++){var s=o[i],u=s.extendTexture(r,t,e);u&&(r=u,e.disposeSet.add(r))}return e.textureSet.add(r),r})},n.prototype.addGeometryPrimitiveAttributes=function(t,e){var r=this,i=e.attributes,o=[],s=function(T){var _=ATTRIBUTES[T]||T.toLowerCase();if(_ in t.attributes)return"continue";o.push(u.loadAccessor(i[T]).then(function(S){S&&t.setAttribute(_,S)}))},u=this;for(var c in i)s(c);e.indices!==void 0&&!t.index&&o.push(this.loadAccessor(e.indices).then(function(T){T&&t.setIndex(T)}));var l=new THREE__namespace.Box3;if(i.POSITION!==void 0){var d=this.json.accessors[i.POSITION],f=d.min,v=d.max;if(f!==void 0&&v!==void 0){if(l.set(new THREE__namespace.Vector3(f[0],f[1],f[2]),new THREE__namespace.Vector3(v[0],v[1],v[2])),d.normalized){var A=getNormalizedComponentScale(WEBGL_COMPONENT_TYPES[d.componentType]);l.min.multiplyScalar(A),l.max.multiplyScalar(A)}}else console.warn("glTF: Missing min/max properties for accessor POSITION.")}var h=e.targets;if(h!==void 0){for(var p=new THREE__namespace.Vector3,y=new THREE__namespace.Vector3,m=0,g=h.length;m<g;m++){var E=h[m];if(E.POSITION!==void 0){var d=this.json.accessors[E.POSITION],f=d.min,v=d.max;if(f!==void 0&&v!==void 0){if(y.setX(Math.max(Math.abs(f[0]),Math.abs(v[0]))),y.setY(Math.max(Math.abs(f[1]),Math.abs(v[1]))),y.setZ(Math.max(Math.abs(f[2]),Math.abs(v[2]))),d.normalized){var A=getNormalizedComponentScale(WEBGL_COMPONENT_TYPES[d.componentType]);y.multiplyScalar(A)}p.max(y)}else console.warn("glTF: Missing min/max properties for accessor POSITION.")}}l.expandByVector(p)}t.boundingBox=l;var b=new THREE__namespace.Sphere;return l.getCenter(b.center),b.radius=l.min.distanceTo(l.max)/2,t.boundingSphere=b,Promise.all(o).then(function(){if(t.attributes.uv&&!t.attributes.uv2&&r.options.copyUV2&&t.setAttribute("uv2",t.attributes.uv),e.targets){for(var T=!1,_=!1,S=0,R=e.targets.length;S<R;S++){var B=e.targets[S];if(B.POSITION!==void 0&&(T=!0),B.NORMAL!==void 0&&(_=!0),T&&_)break}if(!T&&!_)return t;var I=[];t.morphTargetsRelative=!0;for(var x=function(M,L){var C=e.targets[M];T?I.push(r.loadAccessor(C.POSITION).then(function(H){H&&(t.morphAttributes.position[M]=H)})):t.morphAttributes.position[M]=t.attributes.position,_?I.push(r.loadAccessor(C.NORMAL).then(function(H){H&&(t.morphAttributes.normal[M]=H)})):t.morphAttributes.normal[M]=t.attributes.normal},S=0,R=e.targets.length;S<R;S++)x(S,R);return Promise.all(I).then(function(){return t})}else return t})},n.prototype.buildNodeHierarchy=function(t,e){var r=this,i=this.json.nodes[t];return this.loadNode(t).then(function(o){if(i.skin===void 0)return o;var s;return r.loadSkin(i.skin).then(function(u){s=u;for(var c=[],l=0,d=s.joints.length;l<d;l++)c.push(r.loadNode(s.joints[l]));return Promise.all(c)}).then(function(u){return o.traverse(function(c){if(c instanceof THREE__namespace.SkinnedMesh){for(var l=[],d=[],f=0,v=u.length;f<v;f++){var A=u[f];if(A instanceof THREE__namespace.Bone){l.push(A);var h=new THREE__namespace.Matrix4;s.inverseBindMatrices!==void 0&&h.fromArray(s.inverseBindMatrices.array,f*16),d.push(h)}else console.warn('glTF: Joint "%s" could not be found.',s.joints[f])}c.bind(new THREE__namespace.Skeleton(l,d),c.matrixWorld)}}),o})}).then(function(o){e.add(o);var s=[];if(i.children)for(var u=i.children,c=0,l=u.length;c<l;c++){var d=u[c];s.push(r.buildNodeHierarchy(d,o))}return Promise.all(s).then(function(){return o})})},n.prototype.createUniqueName=function(t){for(var e=THREE__namespace.PropertyBinding.sanitizeNodeName(t||""),r=e,i=1;this.nodeNamesUsed[r];++i)r=e+"_"+i;return this.nodeNamesUsed[r]=!0,r},n.prototype.resolveResouce=function(t){return pathJoin(this.options.resourcePath,appendSearch(t,this.options.search))},n.prototype.toGeometryTrianglesDrawMode=function(t,e){var r=t.getIndex();if(r===null){var i=[],o=t.getAttribute("position");if(o!==void 0){for(var s=0;s<o.count;s++)i.push(s);t.setIndex(i),r=t.getIndex()}}if(r===null)return console.error("glTF: Undefined position attribute. Processing not possible."),t;var u=r.count-2,c=[];if(e===THREE__namespace.TriangleFanDrawMode)for(var s=1;s<=u;s++)c.push(r.getX(0)),c.push(r.getX(s)),c.push(r.getX(s+1));else for(var s=0;s<u;s++)s%2===0?(c.push(r.getX(s)),c.push(r.getX(s+1)),c.push(r.getX(s+2))):(c.push(r.getX(s+2)),c.push(r.getX(s+1)),c.push(r.getX(s)));c.length/3!==u&&console.error("glTF: Unable to generate correct amount of triangles.");var l=t.clone();return l.setIndex(c),this.disposeSet.add(l),l},n}();function getNormalizedComponentScale(n){switch(n){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("glTF: Unsupported normalized accessor component type.")}}var BaseExtension=function(){function n(){}return n.prototype.markDefs=function(t){},n.prototype.prepare=function(t){},n.prototype.emitResult=function(t,e){},n.prototype.createPrimitiveKey=function(t,e){},n.prototype.extendTexture=function(t,e,r){return null},n.prototype.loadBuffer=function(t,e){return null},n.prototype.loadBufferView=function(t,e){return null},n.prototype.loadImage=function(t,e){return null},n.prototype.loadTexture=function(t,e){return null},n.prototype.loadGeometry=function(t,e){return null},n.prototype.loadMaterial=function(t,e){return null},n.prototype.loadMesh=function(t,e){return null},n.prototype.loadNodeAttachments=function(t,e){return null},n.prototype.loadCamera=function(t,e){return null},n.prototype.loadAnimation=function(t,e){return null},n}(),KHR_binary_glTF=function(n){__extends(t,n);function t(){var e=n.call(this)||this;return e.header={magic:"",version:0,length:0},e.content="",e.body=null,e}return t.getMagic=function(e){return decodeText(new Uint8Array(e.slice(0,4)))},t.prototype.loadGlbBinary=function(e){var r=new DataView(e,0,t.HEADER_LENGTH);if(this.header={magic:t.getMagic(e),version:r.getUint32(4,!0),length:r.getUint32(8,!0)},this.header.magic!==t.HEADER_MAGIC)throw new Error("glTF:KHR_binary_glTF: Unsupported.");if(this.header.version<2)throw new Error("glTF:KHR_binary_glTF: Legacy binary file detected.");for(var i=new DataView(e,t.HEADER_LENGTH),o=0,s=null,u=null;o<i.byteLength;){var c=i.getUint32(o,!0);if(o+=4,c!==0){var l=i.getUint32(o,!0);if(o+=4,l===t.CHUNK_TYPES.JSON){var d=new Uint8Array(e,t.HEADER_LENGTH+o,c);s=decodeText(d)}else if(l===t.CHUNK_TYPES.BIN){var f=t.HEADER_LENGTH+o;u=e.slice(f,f+c)}o+=c}}if(s===null)throw new Error("glTF:KHR_binary_glTF: JSON content not found.");this.content=s,this.body=u},t.prototype.loadBuffer=function(e,r){var i=r.json.buffers[e];return i.uri===void 0&&e===0&&this.body?Promise.resolve(this.body):null},t.prototype.clear=function(){this.body=null,this.content=""},t.HEADER_MAGIC="glTF",t.HEADER_LENGTH=12,t.CHUNK_TYPES={JSON:1313821514,BIN:5130562},t}(BaseExtension),defaultDecoderPath="https://vr-public.realsee-cdn.cn/release/static/image/release/five/resource/draco/1.5.6/",defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"},Draco=function(){function n(){this.decoderPath=defaultDecoderPath,this.decoderConfig={},this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL=""}return n.prototype.setDecoderPath=function(t){this.decoderPath=t},n.prototype.setDecoderConfig=function(t){return this.decoderConfig=t,this},n.prototype.setWorkerLimit=function(t){return this.workerLimit=t,this},n.prototype.decodeDracoFile=function(t,e,r,i){var o={attributeIDs:r||defaultAttributeIDs,attributeTypes:i||defaultAttributeTypes,useUniqueIDs:!!r};this.decodeGeometry(t,o).then(e)},n.prototype.decodeGeometry=function(t,e){var r=this;e===void 0&&(e={attributeIDs:defaultAttributeIDs,attributeTypes:defaultAttributeTypes,useUniqueIDs:!1});for(var i in e.attributeTypes){var o=e.attributeTypes[i];o.BYTES_PER_ELEMENT!==void 0&&(e.attributeTypes[i]=o.name)}var s,u=this.workerNextTaskID++,c=t.byteLength,l=this._getWorker(u,c).then(function(d){return s=d,new Promise(function(f,v){s._callbacks[u]={resolve:f,reject:v},s.postMessage({type:"decode",id:u,taskConfig:e,buffer:t},[t])})}).then(function(d){return r._createGeometry(d.geometry)});return l.catch(function(){return!0}).then(function(){s&&u&&r._releaseTask(s,u)}),l},n.prototype._createGeometry=function(t){var e=new THREE__namespace.BufferGeometry;t.index&&e.setIndex(new THREE__namespace.BufferAttribute(t.index.array,1));for(var r=0;r<t.attributes.length;r++){var i=t.attributes[r],o=i.name,s=i.array,u=i.itemSize;e.setAttribute(o,new THREE__namespace.BufferAttribute(s,u))}return e},n.prototype._initDecoder=function(){var t=this;if(this.decoderPending)return this.decoderPending;var e=typeof WebAssembly!="object"||this.decoderConfig.type==="js";if(e){var r=ajax(this.decoderPath+"draco_decoder.js",{responseType:"text"}).then(function(o){return o.body});this.decoderPending=r.then(function(o){var s=["/* draco decoder */",o,"","/* worker */",DRACOWorker].join(`
418
418
  `);t.workerSourceURL=URL.createObjectURL(new Blob([s]))})}else{var r=ajax(this.decoderPath+"draco_wasm_wrapper.js",{responseType:"text"}).then(function(s){return s.body}),i=ajax(this.decoderPath+"draco_decoder.wasm",{responseType:"arraybuffer"}).then(function(s){return s.body});this.decoderPending=Promise.all([r,i]).then(function(s){var u=s[0],c=s[1];t.decoderConfig.wasmBinary=c;var l=["/* draco decoder */",u,"","/* worker */",DRACOWorker].join(`
419
419
  `);t.workerSourceURL=URL.createObjectURL(new Blob([l]))})}return this.decoderPending},n.prototype._getWorker=function(t,e){var r=this;return this._initDecoder().then(function(){if(r.workerPool.length<r.workerLimit){var i=new Worker(r.workerSourceURL);i._callbacks={},i._taskCosts={},i._taskLoad=0,i.postMessage({type:"init",decoderConfig:r.decoderConfig}),i.onmessage=function(s){var u=s.data;switch(u.type){case"decode":i._callbacks[u.id].resolve(u);break;case"error":i._callbacks[u.id].reject(u);break;default:console.error('DRACO: Unexpected message, "'+u.type+'"')}},r.workerPool.push(i)}else r.workerPool.sort(function(s,u){return s._taskLoad>u._taskLoad?-1:1});var o=r.workerPool[r.workerPool.length-1];return o._taskCosts[t]=e,o._taskLoad+=e,o})},n.prototype._releaseTask=function(t,e){t._taskLoad-=t._taskCosts[e],delete t._callbacks[e],delete t._taskCosts[e]},n.prototype.dispose=function(){for(var t=0;t<this.workerPool.length;++t)this.workerPool[t].terminate();return this.workerPool.length=0,this},n}(),draco=new Draco,DRACOWorker=`
420
420
  let decoderConfig;
@@ -1859,7 +1859,7 @@ void main() {
1859
1859
  `,e},t.prototype.updateShaderSource=function(){var e=this.getDefines()+edlVertexShader,r=this.getDefines()+edlFragmentShader;this.setValues({vertexShader:e,fragmentShader:r}),this.needsUpdate=!0},__decorate([uniform$1("screenWidth"),__metadata("design:type",Number)],t.prototype,"screenWidth",void 0),__decorate([uniform$1("screenHeight"),__metadata("design:type",Number)],t.prototype,"screenHeight",void 0),__decorate([uniform$1("edlStrength"),__metadata("design:type",Number)],t.prototype,"edlStrength",void 0),__decorate([uniform$1("uNear"),__metadata("design:type",Number)],t.prototype,"uNear",void 0),__decorate([uniform$1("uFar"),__metadata("design:type",Number)],t.prototype,"uFar",void 0),__decorate([uniform$1("radius"),__metadata("design:type",Number)],t.prototype,"radius",void 0),__decorate([uniform$1("neighbours",!0),__metadata("design:type",Float32Array)],t.prototype,"neighbours",void 0),__decorate([uniform$1("depthMap"),__metadata("design:type",THREE__namespace.Texture)],t.prototype,"depthMap",void 0),__decorate([uniform$1("uEDLColor"),__metadata("design:type",THREE__namespace.Texture)],t.prototype,"uEDLColor",void 0),__decorate([uniform$1("uEDLDepth"),__metadata("design:type",THREE__namespace.Texture)],t.prototype,"uEDLDepth",void 0),__decorate([uniform$1("uProj"),__metadata("design:type",Array)],t.prototype,"uProj",void 0),t}(THREE__namespace.RawShaderMaterial);function makeUniform$1(n,t){return{type:n,value:t}}function uniform$1(n,t){return t===void 0&&(t=!1),function(e,r){Object.defineProperty(e,r,{get:function(){return this.getUniform(n)},set:function(i){i!==this.getUniform(n)&&(this.setUniform(n,i),t&&this.updateShaderSource())}})}}var passCamera$1=new THREE__namespace.OrthographicCamera(-1,1,1,-1,0,1),geometry$2=new THREE__namespace.BufferGeometry;geometry$2.setAttribute("position",new THREE__namespace.Float32BufferAttribute([-1,3,0,-1,-1,0,3,-1,0],3)),geometry$2.setAttribute("uv",new THREE__namespace.Float32BufferAttribute([0,2,0,0,2,0],2));var mesh$2=new THREE__namespace.Mesh(geometry$2),edlEffectScene=new THREE__namespace.Scene;edlEffectScene.add(mesh$2);var EDLEffect=function(n){__extends(t,n);function t(e,r,i,o){var s=n.call(this,e,r,i,o)||this;return s.sharedV2=new THREE__namespace.Vector2,s.renderer=e,s.material=new EDLMaterial,mesh$2.material=s.material,s.material.needsUpdate=!0,s}return t.prototype.render=function(e){this.renderer.autoClearColor=!0,this.renderer.autoClearDepth=!0,this.renderer.setRenderTarget(e[0]),this.renderer.render(this.scene,this.camera);var r=this.camera,i=this.material.uniforms,o=this.renderer.getSize(this.sharedV2);i.screenWidth.value=o.x,i.screenHeight.value=o.y;var s=r.projectionMatrix,u=new Float32Array(16);u.set(s.elements);for(var c=new Float32Array(this.material.neighbourCount*2),l=0;l<this.material.neighbourCount;l++)c[2*l+0]=Math.cos(2*l*Math.PI/this.material.neighbourCount),c[2*l+1]=Math.sin(2*l*Math.PI/this.material.neighbourCount);i.neighbours.value=c,i.uNear.value=r.near,i.uFar.value=r.far,i.uEDLColor.value=e[0].texture,i.uProj.value=u,i.edlStrength.value=.25,i.radius.value=1,i.opacity.value=1,this.renderer.setRenderTarget(e[1]),this.renderer.render(edlEffectScene,passCamera$1)},t.prototype.dispose=function(){this.copyPass.dispose()},t}(Effect);const fragment=function n(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=113,i=126,o=0,s="";return t[o].split(s).map(function(u){return u.charCodeAt(o)>i?u:String.fromCharCode((u.charCodeAt(o)+r)%i)}).join(s)}(`}rpvv|{-zrqvz}-sy|nH}rpvv|{-zrqvz}-v{H{vs|z-nz}yr?Q-drvtuZn}H{vs|z-nz}yr?Q-Qr}uZn}Hn\bv{t-rp?-bH|vq-znv{56-
1860
1860
  sy|n-qr}u-J-r\x07r?Q5Qr}uZn}9-b6;Hvs5qr}u-KJ->;=6
1861
1861
  qvpnqH\frpA-p|y|-J-r\x07r?Q5drvtuZn}9-b6H-p|y|-J-p|y|-<-p|y|;HtylSntP|y|-J-rpA5p|y|;\x07\b 9->;=6H-\f`),vertex=function n(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=113,i=126,o=0,s="";return t[o].split(s).map(function(u){return u.charCodeAt(o)>i?u:String.fromCharCode((u.charCodeAt(o)+r)%i)}).join(s)}(`}rpvv|{-zrqvz}-sy|nH}rpvv|{-zrqvz}-v{Hnvor-rp@-}|vv|{Hnvor-rp?-H{vs|z-znA-}|wrpv|{Znv\x07H{vs|z-znA-z|qrycvrZnv\x07Hn\bv{t-rp?-bH|vq-znv{56-
1862
- b-J-Htyl]|vv|{-J-}|wrpv|{Znv\x07-7-z|qrycvrZnv\x07-7-rpA5}|vv|{9>;=6H\f`);var HQMaterial=function(n){__extends(t,n);function t(e){var r=n.call(this,{vertexShader:vertex,fragmentShader:fragment})||this;return r.uniforms={uDepthMap:makeUniform("t",null),uWeightMap:makeUniform("t",null)},r.depthTest=!0,r.depthWrite=!0,r.opacity=1,r}return t.prototype.getUniform=function(e){return this.uniforms===void 0?void 0:this.uniforms[e].value},t.prototype.setUniform=function(e,r){if(this.uniforms!==void 0){var i=this.uniforms[e];i.value=r}},__decorate([uniform("uDepthMap"),__metadata("design:type",Number)],t.prototype,"uDepthMap",void 0),__decorate([uniform("uWeightMap"),__metadata("design:type",Number)],t.prototype,"uWeightMap",void 0),t}(THREE__namespace.RawShaderMaterial);function makeUniform(n,t){return{type:n,value:t}}function uniform(n,t){return t===void 0&&(t=!1),function(e,r){Object.defineProperty(e,r,{get:function(){return this.getUniform(n)},set:function(i){i!==this.getUniform(n)&&(this.setUniform(n,i),t&&this.updateShaderSource())}})}}var passCamera=new THREE__namespace.OrthographicCamera(-1,1,1,-1,0,1),geometry$1=new THREE__namespace.BufferGeometry;geometry$1.setAttribute("position",new THREE__namespace.Float32BufferAttribute([-1,3,0,-1,-1,0,3,-1,0],3)),geometry$1.setAttribute("uv",new THREE__namespace.Float32BufferAttribute([0,2,0,0,2,0],2));var mesh$1=new THREE__namespace.Mesh(geometry$1),hqScene=new THREE__namespace.Scene;hqScene.add(mesh$1);var HQEffect=function(n){__extends(t,n);function t(e,r,i,o){var s=n.call(this,e,r,i,o)||this;return s.sharedV2=new THREE__namespace.Vector2,s.renderer=e,s.material=new HQMaterial,s.camera=i,mesh$1.material=s.material,s}return t.prototype.render=function(e){this.models.setMaterial({useHQDepth:!0,useHQWeight:!1}),this.models.update(this.renderer,this.camera,"Mapview"),this.renderer.autoClearColor=!0,this.renderer.autoClearDepth=!0,this.renderer.setRenderTarget(e[0]),this.renderer.render(this.scene,this.camera),this.models.setMaterial({useHQWeight:!0,useHQDepth:!1}),this.models.update(this.renderer,this.camera,"Mapview"),this.renderer.autoClearDepth=!1,this.renderer.autoClearColor=!0,this.renderer.setClearColor(new THREE__namespace.Color(0,0,0)),this.renderer.setClearAlpha(0),this.renderer.setRenderTarget(e[1]),this.renderer.render(this.scene,this.camera),this.material.uniforms.uWeightMap.value=e[1].texture,this.material.uniforms.uDepthMap.value=e[0].depthTexture,this.renderer.autoClearDepth=!0,this.renderer.autoClearColor=!0,this.renderer.setClearColor(new THREE__namespace.Color(0,0,0)),this.renderer.setClearAlpha(1),this.renderer.setRenderTarget(e[2]),this.renderer.render(hqScene,passCamera)},t.prototype.dispose=function(){this.copyPass.dispose()},t}(Effect),RAYCASTER_NEAR=.5,minDistance=.5,PANGESTURE_FORWARD_ANGLE=Math.PI/7,MapviewController=function(n){__extends(t,n);function t(e){var r=this,i,o=t.parseArgs(e);return r=n.call(this,o)||this,r.mode="Mapview",r.defaultLongitude=o.defaultLongitude,r.defaultLatitude=o.defaultLatitude,r.defaultDistance=o.defaultDistance,r.maxLatitude=o.maxLatitude,r.minLatitude=o.minLatitude,r.cameraType=o.cameraType,r.modelInScreen=o.modelInScreen,r.locationMotion=new Motion({x:r.camera.pose.offset.x,y:r.camera.pose.offset.y,z:r.camera.pose.offset.z,distance:r.camera.pose.distance}),r.modelAlphaMotion=new Motion({modelAlpha:(i=r.models.getMaterial().modelAlpha)!==null&&i!==void 0?i:0}),r.perspToOrthoMotion=new Motion({perspToOrtho:r.camera.perspToOrtho.x}),r.intersectMeshCreator=o.intersectMeshCreator,r.intersectMesh=r.intersectMeshCreator(),r.intersectMesh.name="intersect",r.intersectMesh.visible=!1,r.currentTapId=null,r.helper.add(r.intersectMesh),r.edlTarget=new THREE__namespace.WebGLRenderTarget(1024,1024,{generateMipmaps:!1,minFilter:THREE__namespace.NearestFilter,magFilter:THREE__namespace.NearestFilter,format:THREE__namespace.RGBAFormat,type:THREE__namespace.FloatType,depthTexture:new THREE__namespace.DepthTexture(1024,1024,THREE__namespace.UnsignedIntType)}),r.edlEffect=new EDLEffect(r.renderer,r.modelScene,r.camera,r.models),r.hqEffect=new HQEffect(r.renderer,r.modelScene,r.camera,r.models),r}return t.parseArgs=function(e){var r,i,o,s,u,c,l,d;if(e instanceof t)return e;var f=n.parseArgs.call(this,e);return __assign(__assign({},f),{defaultLongitude:(r=e.defaultLongitude)!==null&&r!==void 0?r:Math.PI/4,defaultLatitude:(i=e.defaultLatitude)!==null&&i!==void 0?i:Math.PI/4,defaultDistance:(o=e.defaultDistance)!==null&&o!==void 0?o:150,maxLatitude:(s=e.maxLatitude)!==null&&s!==void 0?s:+Math.PI/2,minLatitude:(u=e.minLatitude)!==null&&u!==void 0?u:0,cameraType:(c=e.cameraType)!==null&&c!==void 0?c:"auto",modelInScreen:(l=e.modelInScreen)!==null&&l!==void 0?l:"boundingbox-center",intersectMeshCreator:(d=e.intersectMeshCreator)!==null&&d!==void 0?d:function(){return new IntersectMesh}})},t.distanceFromModel=function(e,r,i){var o=e.bounding,s=Math.pow(Math.pow(o.max.x-o.min.x+1,2)+Math.pow(o.max.y-o.min.y+1,2)+Math.pow(o.max.z-o.min.z+1,2),1/2),u=s/2/Math.tan(Math.PI*r/360);return i<1&&(u=u/i),isNaN(u)?s:u},t.initAnimationEndState=function(e){var r,i,o,s,u,c,l,d=this.parseArgs(e),f=d.works,v=d.models,A=e.initial,h=A.state,p=A.currentState,y=typeof h.panoIndex=="number"?{workCode:(o=(r=h.workCode)!==null&&r!==void 0?r:(i=d.works[0])===null||i===void 0?void 0:i.workCode)!==null&&o!==void 0?o:"",panoIndex:h.panoIndex}:{workCode:p.workCode,panoIndex:p.panoIndex},m=f.getResolvedObserver(y),g=(s=h.fov)!==null&&s!==void 0?s:60,E=clamp$1((u=h.latitude)!==null&&u!==void 0?u:isThirdPersonMode(p.mode)?p.latitude:d.defaultLatitude,d.minLatitude,d.maxLatitude),b=t.distanceFromModel(d.models,g,d.camera.aspect),T=new THREE__namespace.Vector3,_=(c=h.distance)!==null&&c!==void 0?c:Math.min(d.defaultDistance,b),S=(l=h.longitude)!==null&&l!==void 0?l:isThirdPersonMode(p.mode)?p.longitude:d.defaultLongitude;return h.offset?T.copy(h.offset):d.defaultDistance<b&&m?(T.copy(m.position),h.longitude===void 0&&(S=p.longitude)):T.copy(v.bounding.getCenter(T)),v.bounding.containsPoint(T)||v.bounding.getCenter(T),__assign(__assign({},y),{mode:"Mapview",longitude:S,latitude:E,fov:g,offset:T,distance:_})},t.prototype.destroy=function(){n.prototype.destroy.call(this),this.locationMotion.dispose(),delete this.panState,this.intersectMesh.dispose(),this.helper.remove(this.intersectMesh)},t.prototype.isReady=function(){return this.locationMotion.ended===!1?!1:n.prototype.isReady.call(this)},t.prototype.updateWork=function(e,r,i,o){this.userAction=o,this.works=e;var s=t.initAnimationEndState(__assign(__assign({},this),{initial:{currentState:__assign(__assign({},this.currentPano),this.camera.pose),duration:i.duration,effect:i.effect,state:r,userAction:o}}));this.currentPano={workCode:s.workCode,panoIndex:s.panoIndex};var u={longitude:s.longitude,latitude:s.latitude,fov:s.fov},c={x:s.offset.x,y:s.offset.y,z:s.offset.z,distance:s.distance,orthoDistance:s.distance};return this.locationMotion.set(c,i.duration).catch(noop$1),this.cameraMotion.set(u,i.duration).catch(noop$1),!0},t.prototype.updateModel=function(e){n.prototype.updateModel.call(this,e)},t.prototype.updateCamera=function(e,r,i){var o=this;return this.initAnimationReady.then(function(){o.userAction=i,o.stopMomentumMovement();var s={},u={};return e.distance!==void 0&&(s.distance=e.distance),e.offset!==void 0&&(s.x=e.offset.x,s.y=e.offset.y,s.z=e.offset.z),e.longitude!==void 0&&(u.longitude=e.longitude),e.latitude!==void 0&&(u.latitude=e.latitude),e.fov!==void 0&&(u.fov=e.fov),o.locationMotion.set(s,r).catch(noop$1),o.cameraMotion.set(u,r).catch(noop$1)})},t.prototype.updateCameraWithKeyframes=function(e,r,i){var o=this;return this.initAnimationReady.then(function(){o.userAction=i,o.stopMomentumMovement();for(var s=[],u=[],c=0,l=e;c<l.length;c++){var d=l[c];s.push({key:d.key,progress:d.progress,value:{distance:d.value.distance,x:d.value.offset.x,y:d.value.offset.x,z:d.value.offset.x}}),u.push({key:d.key,progress:d.progress,value:{longitude:d.value.longitude,latitude:d.value.latitude,fov:d.value.fov}})}return o.locationMotion.setKeyframes(s,r).catch(noop$1),o.cameraMotion.setKeyframes(e,r)})},t.prototype.updateTime=function(e,r){if(!this.destroyed){var i={},o={};this.locationMotion.ended||(this.locationMotion.update(e),o.distance=this.locationMotion.value.distance,o.offset=new THREE__namespace.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z)),this.cameraMotion.ended||(this.cameraMotion.update(e),o.longitude=this.cameraMotion.value.longitude,o.latitude=this.cameraMotion.value.latitude,o.fov=this.cameraMotion.value.fov),this.modelAlphaMotion.ended||(this.modelAlphaMotion.update(e),i.modelAlpha=this.modelAlphaMotion.value.modelAlpha);var s=0;this.cameraType==="auto"?s=Math.PI/2-this.cameraMotion.value.latitude<.02?1:0:this.cameraType==="perspective"?s=0:this.cameraType==="orthographic"&&(s=1),this.perspToOrthoMotion.getTargetKeyframe().value.perspToOrtho!==s&&this.perspToOrthoMotion.set({perspToOrtho:s},500).catch(noop$1),this.perspToOrthoMotion.ended||(this.perspToOrthoMotion.update(e),this.camera.perspToOrtho.setScalar(clamp$1(this.perspToOrthoMotion.value.perspToOrtho,0,1))),isEmptyObject(i)||this.models.setMaterial(i),isEmptyObject(o)||this.setCamera(o)}},t.prototype.getTargetState=function(){var e=this.cameraMotion.getKeyFrameSegment(now())[1],r=this.locationMotion.getKeyFrameSegment(now())[1];return __assign(__assign({},this.currentPano),{mode:this.mode,longitude:e.value.longitude,latitude:e.value.latitude,fov:e.value.fov,distance:r.value.distance,offset:new THREE__namespace.Vector3(r.value.x,r.value.y,r.value.z)})},t.prototype.initAnimation=function(){var e=this;return this.destroyed?Promise.resolve():new Promise(function(r){var i=e.initial;i.state,i.currentState;var o=i.duration,s=i.userAction;e.userAction=s;var u=t.initAnimationEndState(e),c={longitude:u.longitude,latitude:u.latitude,fov:u.fov},l={x:u.offset.x,y:u.offset.y,z:u.offset.z,distance:u.distance},d={modelAlpha:1},f={perspToOrtho:0};e.emit("initAnimation.start",createEvent("initAnimation.start",{state:u,userAction:e.userAction})),e.perspToOrthoMotion.set(f,o).catch(noop$1),e.modelAlphaMotion.set(d,o/3).catch(noop$1),e.cameraMotion.set(c,o).catch(noop$1),e.locationMotion.set(l,o).then(function(){e.emit("initAnimation.end",createEvent("initAnimation.end",{state:u,userAction:e.userAction}))},function(v){var A=__assign(__assign(__assign({},e.currentPano),{mode:e.mode}),clonePose(e.camera.pose));e.emit("initAnimation.end",createEvent("initAnimation.end",{state:A,userAction:e.userAction}))}).then(function(){r()})})},t.prototype.getForwardObserverOrNot=function(e){var r=this,i=this.models.intersectRaycaster(e)[0];if(!i)return null;var o=this.works.resolvedObservers.filter(function(l){for(var d,f=0,v=r.models;f<v.length;f++){var A=v[f];if(A.visible&&((d=A.work)===null||d===void 0?void 0:d.workCode)===l.work.workCode)return!0}return!1}),s=arrayMin(o,function(l){return l.standingPosition.distanceTo(i.point)},!0),u=s[0],c=s[1];return u&&c<10?u:null},t.prototype.coordinatesForOffset=function(e){var r=this.renderer.getSize(new THREE__namespace.Vector2);return{longitude:-2*e.x/(r.x*this.scissor.width),latitude:2*e.y/(r.y*this.scissor.height)}},t.prototype.requestMomentumMovement=function(e,r,i,o){var s=this;if(this.inMomentumMovement!==null){for(var u=__assign({},i),c={longitude:0,latitude:0,x:0,y:0,z:0},l=0;l<o;l++)u.longitude*=.996,u.latitude*=.996*.998,u.x*=.99,u.y*=.99,u.z*=.99,c.longitude+=u.longitude,c.latitude+=u.latitude,c.x+=u.x,c.y+=u.y,c.z+=u.z;var d=formatRad(this.cameraMotion.value.longitude+c.longitude),f=clamp$1(this.cameraMotion.value.latitude+c.latitude,this.minLatitude,this.maxLatitude),v=new THREE__namespace.Vector3(this.locationMotion.value.x+c.x,this.locationMotion.value.y+c.y,this.locationMotion.value.z+c.z),A=__assign(__assign({},this.currentPano),{mode:this.mode,longitude:d,latitude:f,offset:v,fov:this.cameraMotion.value.fov,distance:this.camera.pose.distance}),h=!(Math.abs(u.longitude)>1e-4||Math.abs(u.latitude)>1e-4||Math.abs(u.x)>1e-4||Math.abs(u.y)>1e-4||Math.abs(u.z)>1e-4),p=createEvent("gesture.momentum",__assign(__assign({},e),{isFirst:r,isFinal:h,state:A}));if(this.inMomentumMovement.event=p,this.emit("gesture.momentum",p),e.defaultPrevented){this.inMomentumMovement=null;return}this.inMomentumMovement&&(this.cameraMotion.set({longitude:d,latitude:f},0).catch(noop$1),this.locationMotion.set({x:A.offset.x,y:A.offset.y,z:A.offset.z},0).catch(noop$1),h?this.inMomentumMovement=null:AnimationFrameLoop.shared.add(function(y,m){s.requestMomentumMovement(e,!1,u,m|0)},!0,1))}},t.prototype.fixFinalState=function(e){if(this.perspToOrthoMotion.getTargetKeyframe().value.perspToOrtho!==1){var r=coordinatesToVector(e,new THREE__namespace.Vector3),i=new THREE__namespace.Vector3().copy(e.offset).sub(r.clone().multiplyScalar(e.distance)),o=new THREE__namespace.Raycaster(i,r);o.params.Points={threshold:.1},o.near=RAYCASTER_NEAR;var s;if(o.ray.direction.y<-.3&&(s=this.models.intersectRaycaster(o).filter(function(f){var v,A=(v=f.face)===null||v===void 0?void 0:v.normal;return A&&o.ray.direction.dot(A)>=0?!1:f.distance>minDistance+o.near})[0],!s)){var u=new THREE__namespace.Plane(new THREE__namespace.Vector3(0,1,0),-this.models.bounding.min.y),c=o.ray.intersectPlane(u,new THREE__namespace.Vector3);if(c){var l=c.distanceTo(o.ray.origin);l<1e4&&l>=o.near&&(s={distance:l,floor:0,point:c,object:this.scene,face:null})}}if(!s){var d=Math.max(e.distance,3);s={distance:d,floor:0,point:o.ray.direction.clone().setLength(d).add(o.ray.origin),object:this.scene,face:null}}s&&(e.distance=clamp$1(s.distance,0,1/0),e.offset.copy(i).add(r.clone().multiplyScalar(e.distance)))}},t.prototype.onPanGesture=function(e){this.userAction=e.userAction,this.stopMomentumMovement(),this.hideIntersectMesh();var r=e.pointers.length,i=this.panState,o=0;e.pointerType==="mouse"&&(o=e.srcEvent.buttons),i&&o===0&&i.buttons!==0&&(o=i.buttons);var s=i==null?void 0:i.target;if(!s){var u=this.relativeClientPosition(e.center),c=new THREE__namespace.Raycaster;c.params.Points={threshold:.1},c.setFromCamera(u,this.camera),c.near=RAYCASTER_NEAR,s=new THREE__namespace.Vector3().copy(c.ray.direction).multiplyScalar(3).add(c.ray.origin);var l=this.models.intersectRaycaster(c)[0];if(!l&&c.ray.direction.y<-.3){var d=new THREE__namespace.Plane(new THREE__namespace.Vector3(0,1,0),0),f=c.ray.intersectPlane(d,new THREE__namespace.Vector3);if(f){var v=f.distanceTo(c.ray.origin);v<1e4&&v>=c.near&&(l={distance:v,floor:0,point:f,object:this.scene})}}if(l)s.copy(l.point);else{var A=new THREE__namespace.Vector3().copy(this.camera.pose.offset).sub(this.camera.position).normalize(),d=new THREE__namespace.Plane().setFromNormalAndCoplanarPoint(A,this.camera.pose.offset);c.ray.intersectPlane(d,s)}}if(e.isFinal?delete this.panState:this.panState={target:s,buttons:o,pointerLength:r,x:e.center.x,y:e.center.y},!(typeof i=="undefined"||i.pointerLength!==r)){var h=r>1||o===2;if(h){var p={x:e.center.x-i.x,y:e.center.y-i.y},y=new THREE__namespace.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z),m=coordinatesToVector(this.cameraMotion.value).setLength(this.locationMotion.value.distance).add(y),g=new THREE__namespace.Vector3().copy(m).sub(i.target).length();g*=Math.tan(this.camera.pose.fov/2*Math.PI/180);var E=this.renderer.getSize(new THREE__namespace.Vector2),b=2*p.x*g/E.y,T=2*p.y*g/E.y,_=new THREE__namespace.Vector3;if(_.setFromMatrixColumn(this.camera.matrix,0),_.multiplyScalar(-b),y.add(_),this.camera.pose.latitude<PANGESTURE_FORWARD_ANGLE?_.setFromMatrixColumn(this.camera.matrix,1):(_.setFromMatrixColumn(this.camera.matrix,0),_.crossVectors(this.camera.up,_)),_.multiplyScalar(T),y.add(_),this.modelInScreen==="boundingbox-center"){var S=this.models.bounding.clone();S.expandByScalar(this.camera.pose.distance),y.clamp(S.min,S.max)}var R=__assign(__assign({},this.currentPano),{mode:this.mode,longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude,fov:this.camera.pose.fov,offset:y,distance:this.camera.pose.distance});if(e.state=R,this.emit("gesture.pan",e),e.defaultPrevented)return;if(this.locationMotion.set({x:R.offset.x,y:R.offset.y,z:R.offset.z},0).catch(noop$1),e.isFinal&&(this.fixFinalState(R),Object.assign(e,{__fixFinalState:!0}),this.locationMotion.set({distance:R.distance,x:R.offset.x,y:R.offset.y,z:R.offset.z},0).catch(noop$1)),e.isFinal){var B=this.renderer.getSize(new THREE__namespace.Vector2),I=2*e.velocityX*g/B.y,x=2*e.velocityY*g/B.y,M=new THREE__namespace.Vector3,L=new THREE__namespace.Vector3;M.setFromMatrixColumn(this.camera.matrix,0),M.multiplyScalar(-I),L.add(M),this.camera.pose.latitude<PANGESTURE_FORWARD_ANGLE?M.setFromMatrixColumn(this.camera.matrix,1):(M.setFromMatrixColumn(this.camera.matrix,0),M.crossVectors(this.camera.up,M)),M.multiplyScalar(x),L.add(M),this.inMomentumMovement={uuid:createUuid()},this.requestMomentumMovement(e,!0,{longitude:0,latitude:0,x:L.x,y:L.y,z:L.z},0)}}else{var p={x:e.center.x-i.x,y:e.center.y-i.y},C=this.coordinatesForOffset(p),H=formatRad(this.cameraMotion.value.longitude+C.longitude),F=clamp$1(this.cameraMotion.value.latitude+C.latitude,this.minLatitude,this.maxLatitude);this.camera.aspect<1&&Math.abs(e.overallVelocityX)>.2&&Math.atan2(Math.abs(e.overallVelocityY),Math.abs(e.overallVelocityX))<Math.PI/6.923&&(F=this.cameraMotion.value.latitude);var R=__assign(__assign({},this.currentPano),{mode:this.mode,longitude:H,latitude:F,fov:this.camera.pose.fov,offset:this.camera.pose.offset,distance:this.camera.pose.distance});if(e.isFinal&&Object.assign(e,{__fixFinalState:!0}),e.state=R,this.emit("gesture.pan",e),e.defaultPrevented)return;if(e.isFinal?this.locationMotion.set({distance:R.distance,x:R.offset.x,y:R.offset.y,z:R.offset.z},0).catch(noop$1):this.cameraMotion.set({longitude:R.longitude,latitude:R.latitude},0).catch(noop$1),e.isFinal){var O=e.velocityX,G=e.velocityY;this.inMomentumMovement={uuid:createUuid()},this.requestMomentumMovement(e,!0,__assign(__assign({},this.coordinatesForOffset({x:O,y:G})),{x:0,y:0,z:0}),0)}}}},t.prototype.onPinchGesture=function(e){var r;if(this.initAnimationIsReady){this.userAction=e.userAction,this.stopMomentumMovement(),this.hideIntersectMesh();var i=(r=this.pinchState)===null||r===void 0?void 0:r.distance;if(e.isFirst){this.pinchState={x:e.center.x,y:e.center.y,scale:1,distance:this.locationMotion.value.distance};return}if(typeof i!="undefined"){var o=this.models.bounding.getCenter(new THREE__namespace.Vector3),s=t.distanceFromModel(this.models,this.cameraMotion.value.fov,this.camera.aspect),u=clamp$1(i/e.scale,minDistance,1/0),c=e.state.offset.clone().sub(coordinatesToVector(e.state).setLength(u)),l=this.models.bounding.containsPoint(c),d;if(!l&&this.pinchState&&this.pinchState.scale>e.scale&&o.distanceTo(c)>s?d=e.state.distance:(d=u,this.pinchState&&(this.pinchState.scale=e.scale)),e.state.distance=d,this.emit("gesture.pinch",e),!e.defaultPrevented&&(this.locationMotion.set({distance:e.state.distance},0).catch(noop$1),e.pointerType!=="mouse"&&(e.type="gesture.pan",this.onPanGesture(e)),e.isFinal)){if(!("__fixFinalState"in e)){var f=e.state;this.fixFinalState(e.state);var v={x:f.offset.x,y:f.offset.y,z:f.offset.z,distance:f.distance};this.locationMotion.set(v,0).catch(noop$1)}delete this.panState,delete this.pinchState}}}},t.prototype.onMouseMove=function(e){var r,i;if(this.intersectMesh.parent&&!this.panState&&!this.pinchState&&!this.mouseWheelState&&(this.emit("gesture.mousemove",e),!e.defaultPrevented)){var o=e.center.raycaster;if(o.near=RAYCASTER_NEAR,o.far=500,e.isFinal&&this.intersectMesh.parent&&this.intersectMesh.visible===!0){this.hideIntersectMesh();return}var s=this.models.intersectRaycaster(o)[0],u=createEvent("intersect.update",{raycaster:o,intersection:s!=null?s:null,object:this.intersectMesh});if(this.emit("intersect.update",u),u.defaultPrevented){this.hideIntersectMesh();return}if(s){var c=(i=(r=s.face)===null||r===void 0?void 0:r.normal)!==null&&i!==void 0?i:new THREE__namespace.Vector3().copy(o.ray.direction).multiplyScalar(-1),l=c.clone(),d=s.point.clone();this.intersectMesh.position.copy(d);var f=o.ray.origin.distanceTo(d),v=2*Math.tan(.5*this.camera.fov/180*Math.PI),A=Math.max(f*v/10,1);this.intersectMesh.scale.set(A,A,A);var h=d.clone().add(l);if(this.intersectMesh.lookAt(h),Math.abs(c.y)>.99){var p=this.camera.position.clone().sub(d);this.intersectMesh.rotation.z=-Math.atan2(p.z,p.x)}this.intersectMesh.visible=!0,this.needsRender=!0}else this.hideIntersectMesh()}},t.prototype.onMouseWheel=function(e){if(this.initAnimationIsReady)if(this.userAction=e.userAction,this.stopMomentumMovement(),this.hideIntersectMesh(),e.isFinal){var r=e.state;if(this.fixFinalState(r),this.emit("gesture.mousewheel",e),e.defaultPrevented)return;var i={x:r.offset.x,y:r.offset.y,z:r.offset.z,distance:r.distance};this.locationMotion.set(i,0).catch(noop$1)}else{var o=e.center.delta/2*Math.max(Math.log(this.locationMotion.value.distance),1),s=this.models.bounding.getCenter(new THREE__namespace.Vector3),u=t.distanceFromModel(this.models,this.cameraMotion.value.fov,this.camera.aspect),c=clamp$1(this.locationMotion.value.distance-o,minDistance,1/0),l=e.state.offset.clone().sub(coordinatesToVector(e.state).setLength(c)),d=this.models.bounding.containsPoint(l);if(this.modelInScreen!=="none"&&(c=!d&&o<0&&s.distanceTo(l)>u?e.state.distance:c),e.state.distance=c,this.emit("gesture.mousewheel",e),e.defaultPrevented)return;this.locationMotion.set({distance:c},0).catch(noop$1)}},t.prototype.onTapGesture=function(e){var r=this;this.userAction=e.userAction,this.stopMomentumMovement();var i=e.center.raycaster,o=this.getForwardObserverOrNot(i);if(!o)this.emit("gesture.tap",e);else{var s={longitude:this.camera.pose.longitude,latitude:0},u=__assign(__assign({},e.state),{mode:"Panorama",workCode:o.pano.workCode,panoIndex:o.pano.panoIndex,longitude:s.longitude,latitude:s.latitude,offset:o?o.position.clone():new THREE__namespace.Vector3,distance:0});if(e.state=u,this.emit("gesture.tap",e),!e.defaultPrevented&&(this.emit("pano.select",createEvent("pano.select",{prevPano:this.currentPano,state:u,userAction:e.userAction,options:s,progress:0,error:null})),o&&o.active)){var c=this.currentTapId=createUuid();this.preloadPano(o.pano).then(function(l){r.currentTapId===c&&r.emit("pano.request",createEvent("pano.request",{userAction:!0,prevPano:r.currentPano,progress:0,state:u,options:s,error:null}))})}}},t.prototype.onDblTapGesture=function(e){if(this.initAnimationIsReady){this.userAction=e.userAction,this.stopMomentumMovement(),this.hideIntersectMesh();var r=e.state,i=e.center.raycaster,o=i.ray.origin.clone().add(i.ray.direction.clone().setLength(3)),s=1,u=3,c=s,l=this.models.intersectRaycaster(i)[0];if(l&&(o=l.point.clone(),l.distance>(s+u)/2?c=s:c=u),e.state.distance=c,e.state.offset=o,this.emit("gesture.dbltap",e),!e.defaultPrevented){var d={x:r.offset.x,y:r.offset.y,z:r.offset.z,distance:r.distance};this.locationMotion.set(d,360).catch(noop$1),this.hideIntersectMesh()}}},t.prototype.hideIntersectMesh=function(){this.intersectMesh.visible=!1,this.needsRender=!0},t.prototype.render=function(e,r){var i=this.renderer.getRenderTarget();this.updateScreenBuffer(r),e&&(r==="edl"?this.edlEffect.render(this.screenBuffers):r==="hq"?this.hqEffect.render(this.screenBuffers):(this.renderer.setRenderTarget(this.modelRenderTarget),this.renderer.render(this.modelScene,this.camera))),this.depthCopyPass.render(this.modelRenderTarget.depthTexture,i),this.renderer.autoClearDepth=!1,this.renderer.autoClearColor=!0,this.copyPass.render(this.modelRenderTarget,i),this.renderer.setRenderTarget(i),this.renderer.autoClearColor=!1,this.renderer.autoClearDepth=!1,this.renderer.render(this.scene,this.camera),this.renderer.autoClearColor=!0,this.renderer.autoClearDepth=!0},t}(BaseController);function isNil(n){return n==null}var _moveEvent={type:"move"},XRController=function(){function n(){this._targetRay=null,this._grip=null,this._hand=null,this._axes=[0,0]}return n.prototype.getHandSpace=function(){return this._hand===null&&(this._hand=new THREE__namespace.Group,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand},n.prototype.getTargetRaySpace=function(){return this._targetRay===null&&(this._targetRay=new THREE__namespace.Group,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new THREE__namespace.Vector3,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new THREE__namespace.Vector3),this._targetRay},n.prototype.getGripSpace=function(){return this._grip===null&&(this._grip=new THREE__namespace.Group,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new THREE__namespace.Vector3,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new THREE__namespace.Vector3),this._grip},n.prototype.dispatchEvent=function(t){return this._targetRay!==null&&this._targetRay.dispatchEvent(t),this._grip!==null&&this._grip.dispatchEvent(t),this._hand!==null&&this._hand.dispatchEvent(t),this},n.prototype.disconnect=function(t){return this.dispatchEvent({type:"disconnected",data:t}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this},n.prototype.getAxes=function(){return this._axes},n.prototype.update=function(t,e,r){var i=null,o=null,s=null,u=this._targetRay,c=this._grip,l=this._hand;if(t&&t.gamepad&&t.gamepad.axes&&(this._axes=[t.gamepad.axes[2],t.gamepad.axes[3]]),t&&e.session.visibilityState!=="visible-blurred")if(u!==null&&(i=e.getPose(t.targetRaySpace,r),i!==null&&(u.matrix.fromArray(i.transform.matrix),u.matrix.decompose(u.position,u.rotation,u.scale),i.linearVelocity?(u.hasLinearVelocity=!0,u.linearVelocity.copy(i.linearVelocity)):u.hasLinearVelocity=!1,i.angularVelocity?(u.hasAngularVelocity=!0,u.angularVelocity.copy(i.angularVelocity)):u.hasAngularVelocity=!1,this.dispatchEvent(_moveEvent))),l&&t.hand){s=!0;for(var d=0,f=t.hand.values();d<f.length;d++){var v=f[d],A=e.getJointPose(v,r);if(l.joints[v.jointName]===void 0){var h=new THREE__namespace.Group;h.matrixAutoUpdate=!1,h.visible=!1,l.joints[v.jointName]=h,l.add(h)}var p=l.joints[v.jointName];A!==null&&(p.matrix.fromArray(A.transform.matrix),p.matrix.decompose(p.position,p.rotation,p.scale),p.jointRadius=A.radius),p.visible=A!==null}var y=l.joints["index-finger-tip"],m=l.joints["thumb-tip"],g=y.position.distanceTo(m.position),E=.02,b=.005;l.inputState.pinching&&g>E+b?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!l.inputState.pinching&&g<=E-b&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else c!==null&&t.gripSpace&&(o=e.getPose(t.gripSpace,r),o!==null&&(c.matrix.fromArray(o.transform.matrix),c.matrix.decompose(c.position,c.rotation,c.scale),o.linearVelocity?(c.hasLinearVelocity=!0,c.linearVelocity.copy(o.linearVelocity)):c.hasLinearVelocity=!1,o.angularVelocity?(c.hasAngularVelocity=!0,c.angularVelocity.copy(o.angularVelocity)):c.hasAngularVelocity=!1));return u!==null&&(u.visible=i!==null),c!==null&&(c.visible=o!==null),l!==null&&(l.visible=s!==null),this},n}(),framebufferScaleFactor=1,XRManager=function(){function n(t,e,r){var i,o,s,u,c;this.isPanorama=(i=r==null?void 0:r.isPanorama)!==null&&i!==void 0?i:!0;var l=navigator.userAgent.toLowerCase(),d;l.includes("pico")?d="Pico":l.includes("oculus")?d="Oculus":d="VP",this.machineType=(o=r==null?void 0:r.machineType)!==null&&o!==void 0?o:d,this.renderer=t,this.gl=e,this.enabled=!1,this.session=null,this.referenceSpaceType=(s=r==null?void 0:r.referenceSpaceType)!==null&&s!==void 0?s:"local-floor",this.referenceSpace=null,this.onSessionStartCallback=(u=r==null?void 0:r.onSessionStart)!==null&&u!==void 0?u:noop$1,this.onSessionEndCallback=(c=r==null?void 0:r.onSessionEnd)!==null&&c!==void 0?c:noop$1,this.controllers=[new XRController,new XRController],this.inputSourcesMap=new Map,this.cameraVR=new THREE__namespace.ArrayCamera,this.cameraL=new THREE__namespace.PerspectiveCamera,this.cameraR=new THREE__namespace.PerspectiveCamera,this.cameraL.viewport=new THREE__namespace.Vector4,this.cameraR.viewport=new THREE__namespace.Vector4,this.cameraL.layers.enable(1),this.cameraR.layers.enable(2),this.cameraVR.layers.enable(1),this.cameraVR.layers.enable(2),this.isPresenting=!1,this.currentDepthNear=null,this.currentDepthFar=null,this.cameraLPos=new THREE__namespace.Vector3,this.cameraRPos=new THREE__namespace.Vector3}return n.prototype.getController=function(t){var e=this.controllers[t];return e||console.warn("no controller find"),e.getTargetRaySpace()},n.prototype.getRightController=function(){if(!this.session)return null;var t=this.session.inputSources[0].handedness==="right"?0:1,e=this.controllers[t];return e||console.warn("no controller find"),e.getTargetRaySpace()},n.prototype.getLeftController=function(){if(!this.session)return null;var t=this.session.inputSources[0].handedness==="left"?0:1,e=this.controllers[t];return e||console.warn("no controller find"),e.getTargetRaySpace()},n.prototype.getControllerGrip=function(t){var e=this.controllers[t];return e||console.warn("no controller find"),e.getGripSpace()},n.prototype.getCameras=function(){return{cameraL:this.cameraL,cameraR:this.cameraR,cameraVR:this.cameraVR}},n.prototype.updateCamera=function(t,e){e===null?t.matrixWorld.copy(t.matrix):t.matrixWorld.multiplyMatrices(e.matrixWorld,t.matrix),t.matrixWorldInverse.getInverse(t.matrixWorld)},n.prototype.setProjectionFromUnion=function(t,e,r){this.cameraLPos.setFromMatrixPosition(e.matrixWorld),this.cameraRPos.setFromMatrixPosition(r.matrixWorld);var i=this.cameraLPos.distanceTo(this.cameraRPos),o=e.projectionMatrix.elements,s=r.projectionMatrix.elements,u=o[14]/(o[10]-1),c=o[14]/(o[10]+1),l=(o[9]+1)/o[5],d=(o[9]-1)/o[5],f=(o[8]-1)/o[0],v=(s[8]+1)/s[0],A=u*f,h=u*v,p=i/(-f+v),y=p*-f;e.matrixWorld.decompose(t.position,t.quaternion,t.scale),t.translateX(y),t.translateZ(p),t.matrixWorld.compose(t.position,t.quaternion,t.scale),t.matrixWorldInverse.getInverse(t.matrixWorld);var m=u+p,g=c+p,E=A-y,b=h+(i-y),T=l*c/g*m,_=d*c/g*m;t.projectionMatrix.makePerspective(E,b,T,_,m,g)},n.prototype.getCamera=function(t){this.cameraVR.near=this.cameraR.near=this.cameraL.near=t.near,this.cameraVR.far=this.cameraR.far=this.cameraL.far=t.far,this.session&&(this.currentDepthNear!==this.cameraVR.near||this.currentDepthFar!==this.cameraVR.far)&&(this.session.updateRenderState({depthNear:this.cameraVR.near,depthFar:this.cameraVR.far}),this.currentDepthNear=this.cameraVR.near,this.currentDepthFar=this.cameraVR.far);var e=t.parent,r=this.cameraVR.cameras;this.updateCamera(this.cameraVR,e);for(var i=0;i<r.length;i++)this.updateCamera(r[i],e);t.matrixWorld.copy(this.cameraVR.matrixWorld);for(var o=t.children,i=0,s=o.length;i<s;i++)o[i].updateMatrixWorld(!0);return r.length===2?this.setProjectionFromUnion(this.cameraVR,this.cameraL,this.cameraR):this.cameraVR.projectionMatrix.copy(this.cameraL.projectionMatrix),this.cameraVR},n.prototype.updateInputSources=function(t){if(!this.session){console.warn("session is lose!");return}for(var e=this.session.inputSources,r=0;r<this.controllers.length;r++)this.inputSourcesMap.set(e[r],this.controllers[r]);for(var r=0;r<t.removed.length;r++){var i=t.removed[r],o=this.inputSourcesMap.get(i);o&&(o.dispatchEvent({type:"disconnected",data:i}),this.inputSourcesMap.delete(i))}for(var r=0;r<t.added.length;r++){var i=t.added[r],o=this.inputSourcesMap.get(i);o&&o.dispatchEvent({type:"connected",data:i})}},n.prototype.onSessionEvent=function(t){var e=this.inputSourcesMap.get(t.inputSource);e&&e.dispatchEvent({type:t.type})},n.prototype.onSessionEnd=function(){this.inputSourcesMap.forEach(function(t,e){t.disconnect(e)}),this.inputSourcesMap.clear(),this.renderer.setFramebuffer(null),this.renderer.setRenderTarget(this.renderer.getRenderTarget()),this.isPresenting=!1,this.session=null,AnimationFrameLoop.shared.setContext(null),this.onSessionEndCallback()},n.prototype.onRequestReferenceSpace=function(t){this.referenceSpace=t,this.isPresenting=!0,this.session&&this.onSessionStartCallback(this.session)},n.prototype.setSession=function(t){var e=this;if(this.session=t,this.session){this.session.addEventListener("select",function(i){e.onSessionEvent(i)}),this.session.addEventListener("selectstart",function(i){e.onSessionEvent(i)}),this.session.addEventListener("selectend",function(i){e.onSessionEvent(i)}),this.session.addEventListener("squeeze",function(i){e.onSessionEvent(i)}),this.session.addEventListener("squeezestart",function(i){e.onSessionEvent(i)}),this.session.addEventListener("squeezeend",function(i){e.onSessionEvent(i)}),this.session.addEventListener("end",function(i){e.onSessionEnd()});var r=this.gl.getContextAttributes();this.gl.makeXRCompatible().then(function(){var i={antialias:r==null?void 0:r.antialias,alpha:r==null?void 0:r.alpha,depth:r==null?void 0:r.depth,stencil:r==null?void 0:r.stencil,framebufferScaleFactor};if(!e.session){console.error("session is lose while set session!");return}switch(e.machineType){case"Pico":case"VP":e.session.updateRenderState({baseLayer:new XRWebGLLayer(e.session,e.gl,i)});break;case"Oculus":e.session.updateRenderState({layers:[new XRWebGLLayer(e.session,e.gl,i)]});break;default:e.machineType;break}e.session.requestReferenceSpace(e.referenceSpaceType).then(function(o){e.onRequestReferenceSpace(o)}),e.session.addEventListener("inputsourceschange",function(o){e.updateInputSources(o)})})}},n}(),LineSegmentsGeometry=function(n){__extends(t,n);function t(){var e=n.call(this)||this;e.type="LineSegmentsGeometry";var r=[-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],i=[-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],o=[0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5];return e.setIndex(o),e.setAttribute("position",new THREE__namespace.Float32BufferAttribute(r,3)),e.setAttribute("uv",new THREE__namespace.Float32BufferAttribute(i,2)),e}return t.prototype.applyMatrix4=function(e){var r=this.attributes.instanceStart,i=this.attributes.instanceEnd;return r!==void 0&&(r.applyMatrix4(e),i.applyMatrix4(e),r.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this},t.prototype.setPositions=function(e){var r;e instanceof Float32Array?r=e:Array.isArray(e)?r=new Float32Array(e):r=new Float32Array;var i=new THREE__namespace.InstancedInterleavedBuffer(r,6,1);return this.setAttribute("instanceStart",new THREE__namespace.InterleavedBufferAttribute(i,3,0)),this.setAttribute("instanceEnd",new THREE__namespace.InterleavedBufferAttribute(i,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this},t.prototype.setColors=function(e){var r;e instanceof Float32Array?r=e:Array.isArray(e)?r=new Float32Array(e):r=new Float32Array;var i=new THREE__namespace.InstancedInterleavedBuffer(r,6,1);return this.setAttribute("instanceColorStart",new THREE__namespace.InterleavedBufferAttribute(i,3,0)),this.setAttribute("instanceColorEnd",new THREE__namespace.InterleavedBufferAttribute(i,3,3)),this},t.prototype.fromWireframeGeometry=function(e){return this.setPositions(e.attributes.position.array),this},t.prototype.fromEdgesGeometry=function(e){return this.setPositions(e.attributes.position.array),this},t.prototype.fromMesh=function(e){return this.fromWireframeGeometry(new THREE__namespace.WireframeGeometry(e.geometry)),this},t.prototype.fromLineSegments=function(e){var r=e.geometry;if(r instanceof THREE__namespace.Geometry){var i=new THREE__namespace.BufferGeometry().fromGeometry(r);this.setPositions(i.attributes.position.array)}else r instanceof THREE__namespace.BufferGeometry&&this.setPositions(r.attributes.position.array);return this},t.prototype.computeBoundingBox=function(){this.boundingBox===null&&(this.boundingBox=new THREE__namespace.Box3);var e=this.attributes.instanceStart,r=this.attributes.instanceEnd;if(e!==void 0&&r!==void 0){var i=new THREE__namespace.Box3;this.boundingBox.setFromBufferAttribute(e),i.setFromBufferAttribute(r),this.boundingBox.union(i)}},t.prototype.computeBoundingSphere=function(){this.boundingSphere===null&&(this.boundingSphere=new THREE__namespace.Sphere),this.boundingBox===null&&this.computeBoundingBox();var e=this.attributes.instanceStart,r=this.attributes.instanceEnd;if(e!==void 0&&r!==void 0){var i=this.boundingSphere.center;this.boundingBox.getCenter(i);for(var o=0,s=new THREE__namespace.Vector3,u=0,c=e.count;u<c;u++)s.fromBufferAttribute(e,u),o=Math.max(o,i.distanceToSquared(s)),s.fromBufferAttribute(r,u),o=Math.max(o,i.distanceToSquared(s));this.boundingSphere.radius=Math.sqrt(o),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}},t.prototype.toJSON=function(){},t}(THREE__namespace.InstancedBufferGeometry);Object.assign(LineSegmentsGeometry.prototype,{isLineSegmentsGeometry:!0});var lineShader={uniforms:THREE__namespace.UniformsUtils.merge([THREE__namespace.UniformsLib.common,THREE__namespace.UniformsLib.fog,{linewidth:{value:1},resolution:{value:new THREE__namespace.Vector2(1,1)},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1},opacity:{value:1}}]),vertexShader:`
1862
+ b-J-Htyl]|vv|{-J-}|wrpv|{Znv\x07-7-z|qrycvrZnv\x07-7-rpA5}|vv|{9>;=6H\f`);var HQMaterial=function(n){__extends(t,n);function t(e){var r=n.call(this,{vertexShader:vertex,fragmentShader:fragment})||this;return r.uniforms={uDepthMap:makeUniform("t",null),uWeightMap:makeUniform("t",null)},r.depthTest=!0,r.depthWrite=!0,r.opacity=1,r}return t.prototype.getUniform=function(e){return this.uniforms===void 0?void 0:this.uniforms[e].value},t.prototype.setUniform=function(e,r){if(this.uniforms!==void 0){var i=this.uniforms[e];i.value=r}},__decorate([uniform("uDepthMap"),__metadata("design:type",Number)],t.prototype,"uDepthMap",void 0),__decorate([uniform("uWeightMap"),__metadata("design:type",Number)],t.prototype,"uWeightMap",void 0),t}(THREE__namespace.RawShaderMaterial);function makeUniform(n,t){return{type:n,value:t}}function uniform(n,t){return t===void 0&&(t=!1),function(e,r){Object.defineProperty(e,r,{get:function(){return this.getUniform(n)},set:function(i){i!==this.getUniform(n)&&(this.setUniform(n,i),t&&this.updateShaderSource())}})}}var passCamera=new THREE__namespace.OrthographicCamera(-1,1,1,-1,0,1),geometry$1=new THREE__namespace.BufferGeometry;geometry$1.setAttribute("position",new THREE__namespace.Float32BufferAttribute([-1,3,0,-1,-1,0,3,-1,0],3)),geometry$1.setAttribute("uv",new THREE__namespace.Float32BufferAttribute([0,2,0,0,2,0],2));var mesh$1=new THREE__namespace.Mesh(geometry$1),hqScene=new THREE__namespace.Scene;hqScene.add(mesh$1);var HQEffect=function(n){__extends(t,n);function t(e,r,i,o){var s=n.call(this,e,r,i,o)||this;return s.sharedV2=new THREE__namespace.Vector2,s.renderer=e,s.material=new HQMaterial,s.camera=i,mesh$1.material=s.material,s}return t.prototype.render=function(e){this.models.setMaterial({useHQDepth:!0,useHQWeight:!1}),this.models.update(this.renderer,this.camera,"Mapview"),this.renderer.autoClearColor=!0,this.renderer.autoClearDepth=!0,this.renderer.setRenderTarget(e[0]),this.renderer.render(this.scene,this.camera),this.models.setMaterial({useHQWeight:!0,useHQDepth:!1}),this.models.update(this.renderer,this.camera,"Mapview"),this.renderer.autoClearDepth=!1,this.renderer.autoClearColor=!0,this.renderer.setClearColor(new THREE__namespace.Color(0,0,0)),this.renderer.setClearAlpha(0),this.renderer.setRenderTarget(e[1]),this.renderer.render(this.scene,this.camera),this.material.uniforms.uWeightMap.value=e[1].texture,this.material.uniforms.uDepthMap.value=e[0].depthTexture,this.renderer.autoClearDepth=!0,this.renderer.autoClearColor=!0,this.renderer.setClearColor(new THREE__namespace.Color(0,0,0)),this.renderer.setClearAlpha(1),this.renderer.setRenderTarget(e[2]),this.renderer.render(hqScene,passCamera)},t.prototype.dispose=function(){this.copyPass.dispose()},t}(Effect),RAYCASTER_NEAR=.5,minDistance=.5,PANGESTURE_FORWARD_ANGLE=Math.PI/7,MapviewController=function(n){__extends(t,n);function t(e){var r=this,i,o=t.parseArgs(e);return r=n.call(this,o)||this,r.mode="Mapview",r.defaultLongitude=o.defaultLongitude,r.defaultLatitude=o.defaultLatitude,r.defaultDistance=o.defaultDistance,r.maxLatitude=o.maxLatitude,r.minLatitude=o.minLatitude,r.cameraType=o.cameraType,r.modelInScreen=o.modelInScreen,r.locationMotion=new Motion({x:r.camera.pose.offset.x,y:r.camera.pose.offset.y,z:r.camera.pose.offset.z,distance:r.camera.pose.distance}),r.modelAlphaMotion=new Motion({modelAlpha:(i=r.models.getMaterial().modelAlpha)!==null&&i!==void 0?i:0}),r.perspToOrthoMotion=new Motion({perspToOrtho:r.camera.perspToOrtho.x}),r.intersectMeshCreator=o.intersectMeshCreator,r.intersectMesh=r.intersectMeshCreator(),r.intersectMesh.name="intersect",r.intersectMesh.visible=!1,r.currentTapId=null,r.helper.add(r.intersectMesh),r.edlTarget=new THREE__namespace.WebGLRenderTarget(1024,1024,{generateMipmaps:!1,minFilter:THREE__namespace.NearestFilter,magFilter:THREE__namespace.NearestFilter,format:THREE__namespace.RGBAFormat,type:THREE__namespace.FloatType,depthTexture:new THREE__namespace.DepthTexture(1024,1024,THREE__namespace.UnsignedIntType)}),r.edlEffect=new EDLEffect(r.renderer,r.modelScene,r.camera,r.models),r.hqEffect=new HQEffect(r.renderer,r.modelScene,r.camera,r.models),r}return t.parseArgs=function(e){var r,i,o,s,u,c,l,d;if(e instanceof t)return e;var f=n.parseArgs.call(this,e);return __assign(__assign({},f),{defaultLongitude:(r=e.defaultLongitude)!==null&&r!==void 0?r:Math.PI/4,defaultLatitude:(i=e.defaultLatitude)!==null&&i!==void 0?i:Math.PI/4,defaultDistance:(o=e.defaultDistance)!==null&&o!==void 0?o:150,maxLatitude:(s=e.maxLatitude)!==null&&s!==void 0?s:+Math.PI/2,minLatitude:(u=e.minLatitude)!==null&&u!==void 0?u:0,cameraType:(c=e.cameraType)!==null&&c!==void 0?c:"auto",modelInScreen:(l=e.modelInScreen)!==null&&l!==void 0?l:"boundingbox-center",intersectMeshCreator:(d=e.intersectMeshCreator)!==null&&d!==void 0?d:function(){return new IntersectMesh}})},t.distanceFromModel=function(e,r,i){var o=e.bounding,s=Math.pow(Math.pow(o.max.x-o.min.x+1,2)+Math.pow(o.max.y-o.min.y+1,2)+Math.pow(o.max.z-o.min.z+1,2),1/2),u=s/2/Math.tan(Math.PI*r/360);return i<1&&(u=u/i),isNaN(u)?s:u},t.initAnimationEndState=function(e){var r,i,o,s,u,c,l,d=this.parseArgs(e),f=d.works,v=d.models,A=e.initial,h=A.state,p=A.currentState,y=typeof h.panoIndex=="number"?{workCode:(o=(r=h.workCode)!==null&&r!==void 0?r:(i=d.works[0])===null||i===void 0?void 0:i.workCode)!==null&&o!==void 0?o:"",panoIndex:h.panoIndex}:{workCode:p.workCode,panoIndex:p.panoIndex},m=f.getResolvedObserver(y),g=(s=h.fov)!==null&&s!==void 0?s:60,E=clamp$1((u=h.latitude)!==null&&u!==void 0?u:isThirdPersonMode(p.mode)?p.latitude:d.defaultLatitude,d.minLatitude,d.maxLatitude),b=t.distanceFromModel(d.models,g,d.camera.aspect),T=new THREE__namespace.Vector3,_=(c=h.distance)!==null&&c!==void 0?c:Math.min(d.defaultDistance,b),S=(l=h.longitude)!==null&&l!==void 0?l:isThirdPersonMode(p.mode)?p.longitude:d.defaultLongitude;return h.offset?T.copy(h.offset):d.defaultDistance<b&&m?(T.copy(m.position),h.longitude===void 0&&(S=p.longitude)):T.copy(v.bounding.getCenter(T)),v.bounding.containsPoint(T)||v.bounding.getCenter(T),__assign(__assign({},y),{mode:"Mapview",longitude:S,latitude:E,fov:g,offset:T,distance:_})},t.prototype.destroy=function(){n.prototype.destroy.call(this),this.locationMotion.dispose(),delete this.panState,this.intersectMesh.dispose(),this.helper.remove(this.intersectMesh)},t.prototype.isReady=function(){return this.locationMotion.ended===!1?!1:n.prototype.isReady.call(this)},t.prototype.updateWork=function(e,r,i,o){this.userAction=o,this.works=e;var s=t.initAnimationEndState(__assign(__assign({},this),{initial:{currentState:__assign(__assign({},this.currentPano),this.camera.pose),duration:i.duration,effect:i.effect,state:r,userAction:o}}));this.currentPano={workCode:s.workCode,panoIndex:s.panoIndex};var u={longitude:s.longitude,latitude:s.latitude,fov:s.fov},c={x:s.offset.x,y:s.offset.y,z:s.offset.z,distance:s.distance,orthoDistance:s.distance};return this.locationMotion.set(c,i.duration).catch(noop$1),this.cameraMotion.set(u,i.duration).catch(noop$1),!0},t.prototype.updateModel=function(e){n.prototype.updateModel.call(this,e)},t.prototype.updateCamera=function(e,r,i){var o=this;return this.initAnimationReady.then(function(){o.userAction=i,o.stopMomentumMovement();var s={},u={};return e.distance!==void 0&&(s.distance=e.distance),e.offset!==void 0&&(s.x=e.offset.x,s.y=e.offset.y,s.z=e.offset.z),e.longitude!==void 0&&(u.longitude=e.longitude),e.latitude!==void 0&&(u.latitude=e.latitude),e.fov!==void 0&&(u.fov=e.fov),o.locationMotion.set(s,r).catch(noop$1),o.cameraMotion.set(u,r).catch(noop$1)})},t.prototype.updateCameraWithKeyframes=function(e,r,i){var o=this;return this.initAnimationReady.then(function(){o.userAction=i,o.stopMomentumMovement();for(var s=[],u=[],c=0,l=e;c<l.length;c++){var d=l[c];s.push({key:d.key,progress:d.progress,value:{distance:d.value.distance,x:d.value.offset.x,y:d.value.offset.x,z:d.value.offset.x}}),u.push({key:d.key,progress:d.progress,value:{longitude:d.value.longitude,latitude:d.value.latitude,fov:d.value.fov}})}return o.locationMotion.setKeyframes(s,r).catch(noop$1),o.cameraMotion.setKeyframes(e,r)})},t.prototype.updateTime=function(e,r){if(!this.destroyed){var i={},o={};this.locationMotion.ended||(this.locationMotion.update(e),o.distance=this.locationMotion.value.distance,o.offset=new THREE__namespace.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z)),this.cameraMotion.ended||(this.cameraMotion.update(e),o.longitude=this.cameraMotion.value.longitude,o.latitude=this.cameraMotion.value.latitude,o.fov=this.cameraMotion.value.fov),this.modelAlphaMotion.ended||(this.modelAlphaMotion.update(e),i.modelAlpha=this.modelAlphaMotion.value.modelAlpha);var s=0;this.cameraType==="auto"?s=Math.PI/2-this.cameraMotion.value.latitude<.02?1:0:this.cameraType==="perspective"?s=0:this.cameraType==="orthographic"&&(s=1),this.perspToOrthoMotion.getTargetKeyframe().value.perspToOrtho!==s&&this.perspToOrthoMotion.set({perspToOrtho:s},500).catch(noop$1),this.perspToOrthoMotion.ended||(this.perspToOrthoMotion.update(e),this.camera.perspToOrtho.setScalar(clamp$1(this.perspToOrthoMotion.value.perspToOrtho,0,1))),isEmptyObject(i)||this.models.setMaterial(i),isEmptyObject(o)||this.setCamera(o)}},t.prototype.getTargetState=function(){var e=this.cameraMotion.getKeyFrameSegment(now())[1],r=this.locationMotion.getKeyFrameSegment(now())[1];return __assign(__assign({},this.currentPano),{mode:this.mode,longitude:e.value.longitude,latitude:e.value.latitude,fov:e.value.fov,distance:r.value.distance,offset:new THREE__namespace.Vector3(r.value.x,r.value.y,r.value.z)})},t.prototype.initAnimation=function(){var e=this;return this.destroyed?Promise.resolve():new Promise(function(r){var i=e.initial;i.state,i.currentState;var o=i.duration,s=i.userAction;e.userAction=s;var u=t.initAnimationEndState(e),c={longitude:u.longitude,latitude:u.latitude,fov:u.fov},l={x:u.offset.x,y:u.offset.y,z:u.offset.z,distance:u.distance},d={modelAlpha:1},f={perspToOrtho:0};e.emit("initAnimation.start",createEvent("initAnimation.start",{state:u,userAction:e.userAction})),e.perspToOrthoMotion.set(f,o).catch(noop$1),e.modelAlphaMotion.set(d,o/3).catch(noop$1),e.cameraMotion.set(c,o).catch(noop$1),e.locationMotion.set(l,o).then(function(){e.emit("initAnimation.end",createEvent("initAnimation.end",{state:u,userAction:e.userAction}))},function(v){var A=__assign(__assign(__assign({},e.currentPano),{mode:e.mode}),clonePose(e.camera.pose));e.emit("initAnimation.end",createEvent("initAnimation.end",{state:A,userAction:e.userAction}))}).then(function(){r()})})},t.prototype.getForwardObserverOrNot=function(e){var r=this,i=this.models.intersectRaycaster(e)[0];if(!i)return null;var o=this.works.resolvedObservers.filter(function(l){for(var d,f=0,v=r.models;f<v.length;f++){var A=v[f];if(A.visible&&((d=A.work)===null||d===void 0?void 0:d.workCode)===l.work.workCode)return!0}return!1}),s=arrayMin(o,function(l){return l.standingPosition.distanceTo(i.point)},!0),u=s[0],c=s[1];return u&&c<10?u:null},t.prototype.coordinatesForOffset=function(e){var r=this.renderer.getSize(new THREE__namespace.Vector2);return{longitude:-2*e.x/(r.x*this.scissor.width),latitude:2*e.y/(r.y*this.scissor.height)}},t.prototype.requestMomentumMovement=function(e,r,i,o){var s=this;if(this.inMomentumMovement!==null){for(var u=__assign({},i),c={longitude:0,latitude:0,x:0,y:0,z:0},l=0;l<o;l++)u.longitude*=.996,u.latitude*=.996*.998,u.x*=.99,u.y*=.99,u.z*=.99,c.longitude+=u.longitude,c.latitude+=u.latitude,c.x+=u.x,c.y+=u.y,c.z+=u.z;var d=formatRad(this.cameraMotion.value.longitude+c.longitude),f=clamp$1(this.cameraMotion.value.latitude+c.latitude,this.minLatitude,this.maxLatitude),v=new THREE__namespace.Vector3(this.locationMotion.value.x+c.x,this.locationMotion.value.y+c.y,this.locationMotion.value.z+c.z),A=__assign(__assign({},this.currentPano),{mode:this.mode,longitude:d,latitude:f,offset:v,fov:this.cameraMotion.value.fov,distance:this.camera.pose.distance}),h=!(Math.abs(u.longitude)>1e-4||Math.abs(u.latitude)>1e-4||Math.abs(u.x)>1e-4||Math.abs(u.y)>1e-4||Math.abs(u.z)>1e-4),p=createEvent("gesture.momentum",__assign(__assign({},e),{isFirst:r,isFinal:h,state:A}));if(this.inMomentumMovement.event=p,this.emit("gesture.momentum",p),e.defaultPrevented){this.inMomentumMovement=null;return}this.inMomentumMovement&&(this.cameraMotion.set({longitude:d,latitude:f},0).catch(noop$1),this.locationMotion.set({x:A.offset.x,y:A.offset.y,z:A.offset.z},0).catch(noop$1),h?this.inMomentumMovement=null:AnimationFrameLoop.shared.add(function(y,m){s.requestMomentumMovement(e,!1,u,m|0)},!0,1))}},t.prototype.fixFinalState=function(e){if(this.perspToOrthoMotion.getTargetKeyframe().value.perspToOrtho!==1){var r=coordinatesToVector(e,new THREE__namespace.Vector3),i=new THREE__namespace.Vector3().copy(e.offset).sub(r.clone().multiplyScalar(e.distance)),o=new THREE__namespace.Raycaster(i,r);o.params.Points={threshold:.1},o.near=RAYCASTER_NEAR;var s;if(o.ray.direction.y<-.3&&(s=this.models.intersectRaycaster(o).filter(function(f){var v,A=(v=f.face)===null||v===void 0?void 0:v.normal;return A&&o.ray.direction.dot(A)>=0?!1:f.distance>minDistance+o.near})[0],!s)){var u=new THREE__namespace.Plane(new THREE__namespace.Vector3(0,1,0),-this.models.bounding.min.y),c=o.ray.intersectPlane(u,new THREE__namespace.Vector3);if(c){var l=c.distanceTo(o.ray.origin);l<1e4&&l>=o.near&&(s={distance:l,floor:0,point:c,object:this.scene,face:null})}}if(!s){var d=Math.max(e.distance,3);s={distance:d,floor:0,point:o.ray.direction.clone().setLength(d).add(o.ray.origin),object:this.scene,face:null}}s&&(e.distance=clamp$1(s.distance,0,1/0),e.offset.copy(i).add(r.clone().multiplyScalar(e.distance)))}},t.prototype.onPanGesture=function(e){this.userAction=e.userAction,this.stopMomentumMovement(),this.hideIntersectMesh();var r=e.pointers.length,i=this.panState,o=0;e.pointerType==="mouse"&&(o=e.srcEvent.buttons),i&&o===0&&i.buttons!==0&&(o=i.buttons);var s=i==null?void 0:i.target;if(!s){var u=this.relativeClientPosition(e.center),c=new THREE__namespace.Raycaster;c.params.Points={threshold:.1},c.setFromCamera(u,this.camera),c.near=RAYCASTER_NEAR,s=new THREE__namespace.Vector3().copy(c.ray.direction).multiplyScalar(3).add(c.ray.origin);var l=this.models.intersectRaycaster(c)[0];if(!l&&c.ray.direction.y<-.3){var d=new THREE__namespace.Plane(new THREE__namespace.Vector3(0,1,0),0),f=c.ray.intersectPlane(d,new THREE__namespace.Vector3);if(f){var v=f.distanceTo(c.ray.origin);v<1e4&&v>=c.near&&(l={distance:v,floor:0,point:f,object:this.scene})}}if(l)s.copy(l.point);else{var A=new THREE__namespace.Vector3().copy(this.camera.pose.offset).sub(this.camera.position).normalize(),d=new THREE__namespace.Plane().setFromNormalAndCoplanarPoint(A,this.camera.pose.offset);c.ray.intersectPlane(d,s)}}if(e.isFinal?delete this.panState:this.panState={target:s,buttons:o,pointerLength:r,x:e.center.x,y:e.center.y},!(typeof i=="undefined"||i.pointerLength!==r)){var h=r>1||o===2;if(h){var p={x:e.center.x-i.x,y:e.center.y-i.y},y=new THREE__namespace.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z),m=coordinatesToVector(this.cameraMotion.value).setLength(this.locationMotion.value.distance).add(y),g=new THREE__namespace.Vector3().copy(m).sub(i.target).length();g*=Math.tan(this.camera.pose.fov/2*Math.PI/180);var E=this.renderer.getSize(new THREE__namespace.Vector2),b=2*p.x*g/E.y,T=2*p.y*g/E.y,_=new THREE__namespace.Vector3;if(_.setFromMatrixColumn(this.camera.matrix,0),_.multiplyScalar(-b),y.add(_),this.camera.pose.latitude<PANGESTURE_FORWARD_ANGLE?_.setFromMatrixColumn(this.camera.matrix,1):(_.setFromMatrixColumn(this.camera.matrix,0),_.crossVectors(this.camera.up,_)),_.multiplyScalar(T),y.add(_),this.modelInScreen==="boundingbox-center"){var S=this.models.bounding.clone();S.expandByScalar(this.camera.pose.distance),y.clamp(S.min,S.max)}var R=__assign(__assign({},this.currentPano),{mode:this.mode,longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude,fov:this.camera.pose.fov,offset:y,distance:this.camera.pose.distance});if(e.state=R,this.emit("gesture.pan",e),e.defaultPrevented)return;if(this.locationMotion.set({x:R.offset.x,y:R.offset.y,z:R.offset.z},0).catch(noop$1),e.isFinal&&(this.fixFinalState(R),Object.assign(e,{__fixFinalState:!0}),this.locationMotion.set({distance:R.distance,x:R.offset.x,y:R.offset.y,z:R.offset.z},0).catch(noop$1)),e.isFinal){var B=this.renderer.getSize(new THREE__namespace.Vector2),I=2*e.velocityX*g/B.y,x=2*e.velocityY*g/B.y,M=new THREE__namespace.Vector3,L=new THREE__namespace.Vector3;M.setFromMatrixColumn(this.camera.matrix,0),M.multiplyScalar(-I),L.add(M),this.camera.pose.latitude<PANGESTURE_FORWARD_ANGLE?M.setFromMatrixColumn(this.camera.matrix,1):(M.setFromMatrixColumn(this.camera.matrix,0),M.crossVectors(this.camera.up,M)),M.multiplyScalar(x),L.add(M),this.inMomentumMovement={uuid:createUuid()},this.requestMomentumMovement(e,!0,{longitude:0,latitude:0,x:L.x,y:L.y,z:L.z},0)}}else{var p={x:e.center.x-i.x,y:e.center.y-i.y},C=this.coordinatesForOffset(p),H=formatRad(this.cameraMotion.value.longitude+C.longitude),F=clamp$1(this.cameraMotion.value.latitude+C.latitude,this.minLatitude,this.maxLatitude);this.camera.aspect<1&&Math.abs(e.overallVelocityX)>.2&&Math.atan2(Math.abs(e.overallVelocityY),Math.abs(e.overallVelocityX))<Math.PI/6.923&&(F=this.cameraMotion.value.latitude);var R=__assign(__assign({},this.currentPano),{mode:this.mode,longitude:H,latitude:F,fov:this.camera.pose.fov,offset:this.camera.pose.offset,distance:this.camera.pose.distance});if(e.isFinal&&Object.assign(e,{__fixFinalState:!0}),e.state=R,this.emit("gesture.pan",e),e.defaultPrevented)return;if(e.isFinal?this.locationMotion.set({distance:R.distance,x:R.offset.x,y:R.offset.y,z:R.offset.z},0).catch(noop$1):this.cameraMotion.set({longitude:R.longitude,latitude:R.latitude},0).catch(noop$1),e.isFinal){var O=e.velocityX,G=e.velocityY;this.inMomentumMovement={uuid:createUuid()},this.requestMomentumMovement(e,!0,__assign(__assign({},this.coordinatesForOffset({x:O,y:G})),{x:0,y:0,z:0}),0)}}}},t.prototype.onPinchGesture=function(e){var r;if(this.initAnimationIsReady){this.userAction=e.userAction,this.stopMomentumMovement(),this.hideIntersectMesh();var i=(r=this.pinchState)===null||r===void 0?void 0:r.distance;if(e.isFirst){this.pinchState={x:e.center.x,y:e.center.y,scale:1,distance:this.locationMotion.value.distance};return}if(typeof i!="undefined"){var o=this.models.bounding.getCenter(new THREE__namespace.Vector3),s=t.distanceFromModel(this.models,this.cameraMotion.value.fov,this.camera.aspect),u=clamp$1(i/e.scale,minDistance,1/0),c=e.state.offset.clone().sub(coordinatesToVector(e.state).setLength(u)),l=this.models.bounding.containsPoint(c),d;if(!l&&this.pinchState&&this.pinchState.scale>e.scale&&o.distanceTo(c)>s?d=e.state.distance:(d=u,this.pinchState&&(this.pinchState.scale=e.scale)),e.state.distance=d,this.emit("gesture.pinch",e),!e.defaultPrevented&&(this.locationMotion.set({distance:e.state.distance},0).catch(noop$1),e.pointerType!=="mouse"&&(e.type="gesture.pan",this.onPanGesture(e)),e.isFinal)){if(!("__fixFinalState"in e)){var f=e.state;this.fixFinalState(e.state);var v={x:f.offset.x,y:f.offset.y,z:f.offset.z,distance:f.distance};this.locationMotion.set(v,0).catch(noop$1)}delete this.panState,delete this.pinchState}}}},t.prototype.onMouseMove=function(e){var r,i;if(this.intersectMesh.parent&&!this.panState&&!this.pinchState&&!this.mouseWheelState&&(this.emit("gesture.mousemove",e),!e.defaultPrevented)){var o=e.center.raycaster;if(o.near=RAYCASTER_NEAR,o.far=500,e.isFinal&&this.intersectMesh.parent&&this.intersectMesh.visible===!0){this.hideIntersectMesh();return}var s=this.models.intersectRaycaster(o)[0],u=createEvent("intersect.update",{raycaster:o,intersection:s!=null?s:null,object:this.intersectMesh});if(this.emit("intersect.update",u),u.defaultPrevented){this.hideIntersectMesh();return}if(s){var c=(i=(r=s.face)===null||r===void 0?void 0:r.normal)!==null&&i!==void 0?i:new THREE__namespace.Vector3().copy(o.ray.direction).multiplyScalar(-1),l=c.clone(),d=s.point.clone();this.intersectMesh.position.copy(d);var f=o.ray.origin.distanceTo(d),v=2*Math.tan(.5*this.camera.fov/180*Math.PI),A=Math.max(f*v/10,1);this.intersectMesh.scale.set(A,A,A);var h=d.clone().add(l);if(this.intersectMesh.lookAt(h),Math.abs(c.y)>.99){var p=this.camera.position.clone().sub(d);this.intersectMesh.rotation.z=-Math.atan2(p.z,p.x)}this.intersectMesh.visible=!0,this.needsRender=!0}else this.hideIntersectMesh()}},t.prototype.onMouseWheel=function(e){if(this.initAnimationIsReady)if(this.userAction=e.userAction,this.stopMomentumMovement(),this.hideIntersectMesh(),e.isFinal){var r=e.state;if(this.fixFinalState(r),this.emit("gesture.mousewheel",e),e.defaultPrevented)return;var i={x:r.offset.x,y:r.offset.y,z:r.offset.z,distance:r.distance};this.locationMotion.set(i,0).catch(noop$1)}else{var o=e.center.delta/2*Math.max(Math.log(this.locationMotion.value.distance),1),s=this.models.bounding.getCenter(new THREE__namespace.Vector3),u=t.distanceFromModel(this.models,this.cameraMotion.value.fov,this.camera.aspect),c=clamp$1(this.locationMotion.value.distance-o,minDistance,1/0),l=e.state.offset.clone().sub(coordinatesToVector(e.state).setLength(c)),d=this.models.bounding.containsPoint(l);if(this.modelInScreen!=="none"&&(c=!d&&o<0&&s.distanceTo(l)>u?e.state.distance:c),e.state.distance=c,this.emit("gesture.mousewheel",e),e.defaultPrevented)return;this.locationMotion.set({distance:c},0).catch(noop$1)}},t.prototype.onTapGesture=function(e){var r=this;this.userAction=e.userAction,this.stopMomentumMovement();var i=e.center.raycaster,o=this.getForwardObserverOrNot(i);if(!o)this.emit("gesture.tap",e);else{var s={longitude:this.camera.pose.longitude,latitude:0},u=__assign(__assign({},e.state),{mode:"Panorama",workCode:o.pano.workCode,panoIndex:o.pano.panoIndex,longitude:s.longitude,latitude:s.latitude,offset:o?o.position.clone():new THREE__namespace.Vector3,distance:0});if(e.state=u,this.emit("gesture.tap",e),!e.defaultPrevented&&(this.emit("pano.select",createEvent("pano.select",{prevPano:this.currentPano,state:u,userAction:e.userAction,options:s,progress:0,error:null})),o&&o.active)){var c=this.currentTapId=createUuid();this.preloadPano(o.pano).then(function(l){r.currentTapId===c&&r.emit("pano.request",createEvent("pano.request",{userAction:!0,prevPano:r.currentPano,progress:0,state:u,options:s,error:null}))})}}},t.prototype.onDblTapGesture=function(e){if(this.initAnimationIsReady){this.userAction=e.userAction,this.stopMomentumMovement(),this.hideIntersectMesh();var r=e.state,i=e.center.raycaster,o=i.ray.origin.clone().add(i.ray.direction.clone().setLength(3)),s=1,u=3,c=s,l=this.models.intersectRaycaster(i)[0];if(l&&(o=l.point.clone(),l.distance>(s+u)/2?c=s:c=u),e.state.distance=c,e.state.offset=o,this.emit("gesture.dbltap",e),!e.defaultPrevented){var d={x:r.offset.x,y:r.offset.y,z:r.offset.z,distance:r.distance};this.locationMotion.set(d,360).catch(noop$1),this.hideIntersectMesh()}}},t.prototype.hideIntersectMesh=function(){this.intersectMesh.visible=!1,this.needsRender=!0},t.prototype.render=function(e,r){var i=this.renderer.getRenderTarget();this.updateScreenBuffer(r),e&&(r==="edl"?this.edlEffect.render(this.screenBuffers):r==="hq"?this.hqEffect.render(this.screenBuffers):(this.renderer.setRenderTarget(this.modelRenderTarget),this.renderer.render(this.modelScene,this.camera))),this.depthCopyPass.render(this.modelRenderTarget.depthTexture,i),this.renderer.autoClearDepth=!1,this.renderer.autoClearColor=!0,this.copyPass.render(this.modelRenderTarget,i),this.renderer.setRenderTarget(i),this.renderer.autoClearColor=!1,this.renderer.autoClearDepth=!1,this.renderer.render(this.scene,this.camera),this.renderer.autoClearColor=!0,this.renderer.autoClearDepth=!0},t}(BaseController);function isNil(n){return n==null}var _moveEvent={type:"move"},XRController=function(){function n(){this._targetRay=null,this._grip=null,this._hand=null,this._axes=[0,0]}return n.prototype.getHandSpace=function(){return this._hand===null&&(this._hand=new THREE__namespace.Group,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand},n.prototype.getTargetRaySpace=function(){return this._targetRay===null&&(this._targetRay=new THREE__namespace.Group,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new THREE__namespace.Vector3,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new THREE__namespace.Vector3),this._targetRay},n.prototype.getGripSpace=function(){return this._grip===null&&(this._grip=new THREE__namespace.Group,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new THREE__namespace.Vector3,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new THREE__namespace.Vector3),this._grip},n.prototype.dispatchEvent=function(t){return this._targetRay!==null&&this._targetRay.dispatchEvent(t),this._grip!==null&&this._grip.dispatchEvent(t),this._hand!==null&&this._hand.dispatchEvent(t),this},n.prototype.disconnect=function(t){return this.dispatchEvent({type:"disconnected",data:t}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this},n.prototype.getAxes=function(){return this._axes},n.prototype.update=function(t,e,r){var i=null,o=null,s=null,u=this._targetRay,c=this._grip,l=this._hand;if(t&&t.gamepad&&t.gamepad.axes&&(this._axes=[t.gamepad.axes[2],t.gamepad.axes[3]]),t&&e.session.visibilityState!=="visible-blurred")if(u!==null&&(i=e.getPose(t.targetRaySpace,r),i!==null&&(u.matrix.fromArray(i.transform.matrix),u.matrix.decompose(u.position,u.rotation,u.scale),i.linearVelocity?(u.hasLinearVelocity=!0,u.linearVelocity.copy(i.linearVelocity)):u.hasLinearVelocity=!1,i.angularVelocity?(u.hasAngularVelocity=!0,u.angularVelocity.copy(i.angularVelocity)):u.hasAngularVelocity=!1,this.dispatchEvent(_moveEvent))),l&&t.hand){s=!0;for(var d=0,f=t.hand.values();d<f.length;d++){var v=f[d],A=e.getJointPose(v,r);if(l.joints[v.jointName]===void 0){var h=new THREE__namespace.Group;h.matrixAutoUpdate=!1,h.visible=!1,l.joints[v.jointName]=h,l.add(h)}var p=l.joints[v.jointName];A!==null&&(p.matrix.fromArray(A.transform.matrix),p.matrix.decompose(p.position,p.rotation,p.scale),p.jointRadius=A.radius),p.visible=A!==null}var y=l.joints["index-finger-tip"],m=l.joints["thumb-tip"],g=y.position.distanceTo(m.position),E=.02,b=.005;l.inputState.pinching&&g>E+b?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!l.inputState.pinching&&g<=E-b&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else c!==null&&t.gripSpace&&(o=e.getPose(t.gripSpace,r),o!==null&&(c.matrix.fromArray(o.transform.matrix),c.matrix.decompose(c.position,c.rotation,c.scale),o.linearVelocity?(c.hasLinearVelocity=!0,c.linearVelocity.copy(o.linearVelocity)):c.hasLinearVelocity=!1,o.angularVelocity?(c.hasAngularVelocity=!0,c.angularVelocity.copy(o.angularVelocity)):c.hasAngularVelocity=!1));return u!==null&&(u.visible=i!==null),c!==null&&(c.visible=o!==null),l!==null&&(l.visible=s!==null),this},n}(),framebufferScaleFactor=1,XRManager=function(){function n(t,e,r){var i,o,s,u,c;this.isPanorama=(i=r==null?void 0:r.isPanorama)!==null&&i!==void 0?i:!0;var l=navigator.userAgent.toLowerCase(),d;l.includes("pico")?d="Pico":l.includes("oculus")?d="Oculus":d="VP",this.machineType=(o=r==null?void 0:r.machineType)!==null&&o!==void 0?o:d,this.renderer=t,this.gl=e,this.enabled=!1,this.session=null,this.referenceSpaceType=(s=r==null?void 0:r.referenceSpaceType)!==null&&s!==void 0?s:"local-floor",this.referenceSpace=null,this.onSessionStartCallback=(u=r==null?void 0:r.onSessionStart)!==null&&u!==void 0?u:noop$1,this.onSessionEndCallback=(c=r==null?void 0:r.onSessionEnd)!==null&&c!==void 0?c:noop$1,this.controllers=[new XRController,new XRController],this.inputSourcesMap=new Map,this.cameraVR=new THREE__namespace.ArrayCamera,this.cameraL=new THREE__namespace.PerspectiveCamera,this.cameraR=new THREE__namespace.PerspectiveCamera,this.cameraL.viewport=new THREE__namespace.Vector4,this.cameraR.viewport=new THREE__namespace.Vector4,this.cameraL.layers.enable(1),this.cameraR.layers.enable(2),this.cameraVR.layers.enable(1),this.cameraVR.layers.enable(2),this.isPresenting=!1,this.currentDepthNear=null,this.currentDepthFar=null,this.cameraLPos=new THREE__namespace.Vector3,this.cameraRPos=new THREE__namespace.Vector3}return n.prototype.getController=function(t){var e=this.controllers[t];return e||console.warn("no controller find"),e.getTargetRaySpace()},n.prototype.getRightController=function(){if(!this.session)return null;var t=this.session.inputSources[0].handedness==="right"?0:1,e=this.controllers[t];return e||console.warn("no controller find"),e.getTargetRaySpace()},n.prototype.getLeftController=function(){if(!this.session)return null;var t=this.session.inputSources[0].handedness==="left"?0:1,e=this.controllers[t];return e||console.warn("no controller find"),e.getTargetRaySpace()},n.prototype.getControllerGrip=function(t){var e=this.controllers[t];return e||console.warn("no controller find"),e.getGripSpace()},n.prototype.getCameras=function(){return{cameraL:this.cameraL,cameraR:this.cameraR,cameraVR:this.cameraVR}},n.prototype.updateCamera=function(t,e){e===null?t.matrixWorld.copy(t.matrix):t.matrixWorld.multiplyMatrices(e.matrixWorld,t.matrix),t.matrixWorldInverse.getInverse(t.matrixWorld)},n.prototype.setProjectionFromUnion=function(t,e,r){this.cameraLPos.setFromMatrixPosition(e.matrixWorld),this.cameraRPos.setFromMatrixPosition(r.matrixWorld);var i=this.cameraLPos.distanceTo(this.cameraRPos),o=e.projectionMatrix.elements,s=r.projectionMatrix.elements,u=o[14]/(o[10]-1),c=o[14]/(o[10]+1),l=(o[9]+1)/o[5],d=(o[9]-1)/o[5],f=(o[8]-1)/o[0],v=(s[8]+1)/s[0],A=u*f,h=u*v,p=i/(-f+v),y=p*-f;e.matrixWorld.decompose(t.position,t.quaternion,t.scale),t.translateX(y),t.translateZ(p),t.matrixWorld.compose(t.position,t.quaternion,t.scale),t.matrixWorldInverse.getInverse(t.matrixWorld);var m=u+p,g=c+p,E=A-y,b=h+(i-y),T=l*c/g*m,_=d*c/g*m;t.projectionMatrix.makePerspective(E,b,T,_,m,g)},n.prototype.getCamera=function(t){this.cameraVR.near=this.cameraR.near=this.cameraL.near=t.near,this.cameraVR.far=this.cameraR.far=this.cameraL.far=t.far,this.session&&(this.currentDepthNear!==this.cameraVR.near||this.currentDepthFar!==this.cameraVR.far)&&(this.session.updateRenderState({depthNear:this.cameraVR.near,depthFar:this.cameraVR.far}),this.currentDepthNear=this.cameraVR.near,this.currentDepthFar=this.cameraVR.far);var e=t.parent,r=this.cameraVR.cameras;this.updateCamera(this.cameraVR,e);for(var i=0;i<r.length;i++)this.updateCamera(r[i],e);t.matrixWorld.copy(this.cameraVR.matrixWorld);for(var o=t.children,i=0,s=o.length;i<s;i++)o[i].updateMatrixWorld(!0);return r.length===2?this.setProjectionFromUnion(this.cameraVR,this.cameraL,this.cameraR):this.cameraVR.projectionMatrix.copy(this.cameraL.projectionMatrix),this.cameraVR},n.prototype.updateInputSources=function(t){if(!this.session){console.warn("session is lose!");return}for(var e=this.session.inputSources,r=0;r<this.controllers.length;r++)this.inputSourcesMap.set(e[r],this.controllers[r]);for(var r=0;r<t.removed.length;r++){var i=t.removed[r],o=this.inputSourcesMap.get(i);o&&(o.dispatchEvent({type:"disconnected",data:i}),this.inputSourcesMap.delete(i))}for(var r=0;r<t.added.length;r++){var i=t.added[r],o=this.inputSourcesMap.get(i);o&&o.dispatchEvent({type:"connected",data:i})}},n.prototype.onSessionEvent=function(t){var e=this.inputSourcesMap.get(t.inputSource);e&&e.dispatchEvent({type:t.type})},n.prototype.onSessionEnd=function(){this.inputSourcesMap.forEach(function(t,e){t.disconnect(e)}),this.inputSourcesMap.clear(),this.renderer.setFramebuffer(null),this.renderer.setRenderTarget(this.renderer.getRenderTarget()),this.isPresenting=!1,this.session=null,AnimationFrameLoop.shared.setContext(null),this.onSessionEndCallback()},n.prototype.onRequestReferenceSpace=function(t){this.referenceSpace=t,this.isPresenting=!0,this.session&&this.onSessionStartCallback(this.session)},n.prototype.setSession=function(t){var e=this;if(this.session=t,this.session){this.session.addEventListener("select",function(i){e.onSessionEvent(i)}),this.session.addEventListener("selectstart",function(i){e.onSessionEvent(i)}),this.session.addEventListener("selectend",function(i){e.onSessionEvent(i)}),this.session.addEventListener("squeeze",function(i){e.onSessionEvent(i)}),this.session.addEventListener("squeezestart",function(i){e.onSessionEvent(i)}),this.session.addEventListener("squeezeend",function(i){e.onSessionEvent(i)}),this.session.addEventListener("end",function(i){e.onSessionEnd()});var r=this.gl.getContextAttributes();this.gl.makeXRCompatible().then(function(){var i={antialias:r==null?void 0:r.antialias,alpha:r==null?void 0:r.alpha,depth:r==null?void 0:r.depth,stencil:r==null?void 0:r.stencil,framebufferScaleFactor};if(!e.session){console.error("session is lose while set session!");return}switch(e.machineType){case"Pico":case"VP":e.session.updateRenderState({baseLayer:new XRWebGLLayer(e.session,e.gl,i)});break;case"Oculus":e.session.updateRenderState({baseLayer:new XRWebGLLayer(e.session,e.gl,i)});break;default:e.machineType;break}e.session.requestReferenceSpace(e.referenceSpaceType).then(function(o){e.onRequestReferenceSpace(o)}),e.session.addEventListener("inputsourceschange",function(o){e.updateInputSources(o)})})}},n}(),LineSegmentsGeometry=function(n){__extends(t,n);function t(){var e=n.call(this)||this;e.type="LineSegmentsGeometry";var r=[-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],i=[-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],o=[0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5];return e.setIndex(o),e.setAttribute("position",new THREE__namespace.Float32BufferAttribute(r,3)),e.setAttribute("uv",new THREE__namespace.Float32BufferAttribute(i,2)),e}return t.prototype.applyMatrix4=function(e){var r=this.attributes.instanceStart,i=this.attributes.instanceEnd;return r!==void 0&&(r.applyMatrix4(e),i.applyMatrix4(e),r.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this},t.prototype.setPositions=function(e){var r;e instanceof Float32Array?r=e:Array.isArray(e)?r=new Float32Array(e):r=new Float32Array;var i=new THREE__namespace.InstancedInterleavedBuffer(r,6,1);return this.setAttribute("instanceStart",new THREE__namespace.InterleavedBufferAttribute(i,3,0)),this.setAttribute("instanceEnd",new THREE__namespace.InterleavedBufferAttribute(i,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this},t.prototype.setColors=function(e){var r;e instanceof Float32Array?r=e:Array.isArray(e)?r=new Float32Array(e):r=new Float32Array;var i=new THREE__namespace.InstancedInterleavedBuffer(r,6,1);return this.setAttribute("instanceColorStart",new THREE__namespace.InterleavedBufferAttribute(i,3,0)),this.setAttribute("instanceColorEnd",new THREE__namespace.InterleavedBufferAttribute(i,3,3)),this},t.prototype.fromWireframeGeometry=function(e){return this.setPositions(e.attributes.position.array),this},t.prototype.fromEdgesGeometry=function(e){return this.setPositions(e.attributes.position.array),this},t.prototype.fromMesh=function(e){return this.fromWireframeGeometry(new THREE__namespace.WireframeGeometry(e.geometry)),this},t.prototype.fromLineSegments=function(e){var r=e.geometry;if(r instanceof THREE__namespace.Geometry){var i=new THREE__namespace.BufferGeometry().fromGeometry(r);this.setPositions(i.attributes.position.array)}else r instanceof THREE__namespace.BufferGeometry&&this.setPositions(r.attributes.position.array);return this},t.prototype.computeBoundingBox=function(){this.boundingBox===null&&(this.boundingBox=new THREE__namespace.Box3);var e=this.attributes.instanceStart,r=this.attributes.instanceEnd;if(e!==void 0&&r!==void 0){var i=new THREE__namespace.Box3;this.boundingBox.setFromBufferAttribute(e),i.setFromBufferAttribute(r),this.boundingBox.union(i)}},t.prototype.computeBoundingSphere=function(){this.boundingSphere===null&&(this.boundingSphere=new THREE__namespace.Sphere),this.boundingBox===null&&this.computeBoundingBox();var e=this.attributes.instanceStart,r=this.attributes.instanceEnd;if(e!==void 0&&r!==void 0){var i=this.boundingSphere.center;this.boundingBox.getCenter(i);for(var o=0,s=new THREE__namespace.Vector3,u=0,c=e.count;u<c;u++)s.fromBufferAttribute(e,u),o=Math.max(o,i.distanceToSquared(s)),s.fromBufferAttribute(r,u),o=Math.max(o,i.distanceToSquared(s));this.boundingSphere.radius=Math.sqrt(o),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}},t.prototype.toJSON=function(){},t}(THREE__namespace.InstancedBufferGeometry);Object.assign(LineSegmentsGeometry.prototype,{isLineSegmentsGeometry:!0});var lineShader={uniforms:THREE__namespace.UniformsUtils.merge([THREE__namespace.UniformsLib.common,THREE__namespace.UniformsLib.fog,{linewidth:{value:1},resolution:{value:new THREE__namespace.Vector2(1,1)},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1},opacity:{value:1}}]),vertexShader:`
1863
1863
  #include <common>
1864
1864
  #include <color_pars_vertex>
1865
1865
  #include <fog_pars_vertex>
@@ -2058,7 +2058,7 @@ void main() {
2058
2058
  #include <premultiplied_alpha_fragment>
2059
2059
 
2060
2060
  }
2061
- `},LineMaterial=function(n){__extends(t,n);function t(e){var r=n.call(this,{uniforms:THREE__namespace.UniformsUtils.clone(lineShader.uniforms),vertexShader:lineShader.vertexShader,fragmentShader:lineShader.fragmentShader,clipping:!0})||this;return r.type="LineMaterial",r.dashed=!1,Object.defineProperties(r,{color:{enumerable:!0,get:function(){return this.uniforms.diffuse.value},set:function(i){this.uniforms.diffuse.value=i}},linewidth:{enumerable:!0,get:function(){return this.uniforms.linewidth.value},set:function(i){this.uniforms.linewidth.value=i}},dashScale:{enumerable:!0,get:function(){return this.uniforms.dashScale.value},set:function(i){this.uniforms.dashScale.value=i}},dashSize:{enumerable:!0,get:function(){return this.uniforms.dashSize.value},set:function(i){this.uniforms.dashSize.value=i}},gapSize:{enumerable:!0,get:function(){return this.uniforms.gapSize.value},set:function(i){this.uniforms.gapSize.value=i}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(i){this.uniforms.opacity.value=i}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(i){this.uniforms.resolution.value.copy(i)}}}),r.setValues(e),r}return t}(THREE__namespace.ShaderMaterial);Object.assign(LineMaterial.prototype,{isLineMaterial:!0});var LineSegments2=function(n){__extends(t,n);function t(e,r){var i=n.call(this)||this;return i.type="LineSegments2",i.geometry=e!==void 0?e:new LineSegmentsGeometry,i.material=r!==void 0?r:new LineMaterial({color:Math.random()*16777215}),i}return t.prototype.computeLineDistances=function(){for(var e=this.geometry,r=e.attributes.instanceStart,i=e.attributes.instanceEnd,o=new Float32Array(2*r.count),s=new THREE__namespace.Vector3,u=new THREE__namespace.Vector3,c=0,l=0,d=r.count;c<d;c++,l+=2)s.fromBufferAttribute(r,c),u.fromBufferAttribute(i,c),o[l]=l===0?0:o[l-1],o[l+1]=o[l]+s.distanceTo(u);var f=new THREE__namespace.InstancedInterleavedBuffer(o,2,1);return e.setAttribute("instanceDistanceStart",new THREE__namespace.InterleavedBufferAttribute(f,1,0)),e.setAttribute("instanceDistanceEnd",new THREE__namespace.InterleavedBufferAttribute(f,1,1)),this},t.prototype.raycast=function(e,r){e.camera===null&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2.');var i=e.ray,o=e.camera,s=o.projectionMatrix,u=this.geometry,c=this.material,l=c.resolution,d=c.linewidth,f=u.attributes.instanceStart,v=u.attributes.instanceEnd,A=new THREE__namespace.Vector4,h=new THREE__namespace.Vector4,p=new THREE__namespace.Vector4,y=new THREE__namespace.Vector3,m=new THREE__namespace.Matrix4,g=new THREE__namespace.Line3,E=new THREE__namespace.Vector3;i.at(1,p),p.w=1,p.applyMatrix4(o.matrixWorldInverse),p.applyMatrix4(s),p.multiplyScalar(1/p.w),p.x*=l.x/2,p.y*=l.y/2,p.z=0,y.copy(p);var b=this.matrixWorld;m.multiplyMatrices(o.matrixWorldInverse,b);for(var T=0,_=f.count;T<_;T++){A.fromBufferAttribute(f,T),h.fromBufferAttribute(v,T),A.w=1,h.w=1,A.applyMatrix4(m),h.applyMatrix4(m),A.applyMatrix4(s),h.applyMatrix4(s),A.multiplyScalar(1/A.w),h.multiplyScalar(1/h.w);var S=A.z<-1&&h.z<-1,R=A.z>1&&h.z>1;if(!(S||R)){A.x*=l.x/2,A.y*=l.y/2,h.x*=l.x/2,h.y*=l.y/2,g.start.copy(A),g.start.z=0,g.end.copy(h),g.end.z=0;var B=g.closestPointToPointParameter(y,!0);g.at(B,E);var I=THREE__namespace.MathUtils.lerp(A.z,h.z,B),x=I>=-1&&I<=1,M=y.distanceTo(E)<d*.5;if(x&&M){g.start.fromBufferAttribute(f,T),g.end.fromBufferAttribute(v,T),g.start.applyMatrix4(b),g.end.applyMatrix4(b);var L=new THREE__namespace.Vector3,C=new THREE__namespace.Vector3;i.distanceSqToSegment(g.start,g.end,C,L),r.push({point:C,pointOnLine:L,distance:i.origin.distanceTo(C),object:this,faceIndex:T})}}}},t}(THREE__namespace.Mesh);Object.assign(LineSegments2.prototype,{isLineSegments2:!0});var Line2=function(n){__extends(t,n);function t(e,r){var i=n.call(this,e,r)||this;return i.type="Line2",i}return t}(LineSegments2);Object.assign(Line2.prototype,{isLine2:!0});var LineGeometry=function(n){__extends(t,n);function t(){var e=n.call(this)||this;return e.type="LineGeometry",e}return t.prototype.setPositions=function(e){for(var r=e.length-3,i=new Float32Array(2*r),o=0;o<r;o+=3)i[2*o]=e[o],i[2*o+1]=e[o+1],i[2*o+2]=e[o+2],i[2*o+3]=e[o+3],i[2*o+4]=e[o+4],i[2*o+5]=e[o+5];return n.prototype.setPositions.call(this,i),this},t.prototype.setColors=function(e){for(var r=e.length-3,i=new Float32Array(2*r),o=0;o<r;o+=3)i[2*o]=e[o],i[2*o+1]=e[o+1],i[2*o+2]=e[o+2],i[2*o+3]=e[o+3],i[2*o+4]=e[o+4],i[2*o+5]=e[o+5];return n.prototype.setColors.call(this,i),this},t.prototype.fromLine=function(e){var r=e.geometry;if(r instanceof THREE__namespace.Geometry){var i=new THREE__namespace.BufferGeometry().fromGeometry(r);this.setPositions(i.attributes.position.array)}else r instanceof THREE__namespace.BufferGeometry&&this.setPositions(r.attributes.position.array);return this},t.prototype.copy=function(){return this},t}(LineSegmentsGeometry);Object.assign(LineGeometry.prototype,{isLineGeometry:!0});var circleImageURL="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAAZiS0dEAAAAAAAA+UO7fwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sHDgwCEMBJZu0AAAAdaVRYdENvbW1lbnQAAAAAAENyZWF0ZWQgd2l0aCBHSU1QZC5lBwAABM5JREFUWMO1V0tPG2cUPZ4Hxh6DazIOrjFNqJs0FIMqWFgWQkatsmvVbtggKlSVRVf5AWz4AWz4AUSKEChll19QJYSXkECuhFxsHjEhxCYm+DWGMZ5HF72DJq4bAzFXurI0M/I5997v3u9cC65vTJVn2lX/xHINQOYSBLTLEuIuCWw4Z3IGAEvf6ASmVHjNzHCXBG4A0AjACsAOwEbO0nsFQBnAGYASAIl+ZRMR7SolMEdsByD09fV5R0ZGgg8ePPjW5/N1iqLYpuu6RZblciKR2I9Go69evnwZnZ+fjwI4IS8AKBIRzeQfJWCANwKwh0KhtrGxsYehUOin1tbW+zzP23ietzY2NnIAoGmaLsuyUiqVyvl8XtrY2NiamZn589mzZxsAUgCOAeQAnFI2tI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JwSP4WwPtq4LX2Ao6USxNlQyS/RcQcdLGwlNIz6vEMAaZpNzCk2Pll94LK/cDYimxERiBwG10sxjgvEZBE0UpE6vxj+0Ct5bTaXthgEhRmja8QWNkkPGsuIpfdjpkK+cZUWTC0KredVmtD/gdlSl6EG4AMvQAAAABJRU5ErkJggg==",DEFAULT_COLOR=14467195,POINT_SIZE=8,DEFAULT_LINEWIDTH=2,DEFAULT_DASHSCALE=20,sharedCircleTexture=null,FiveLine=function(n){__extends(t,n);function t(e,r){e===void 0&&(e=new THREE__namespace.Vector3),r===void 0&&(r=new THREE__namespace.Vector3);var i=n.call(this)||this;i.type="FiveLine",i.needsRender=!0;var o=new LineGeometry,s=new LineMaterial({color:DEFAULT_COLOR,linewidth:DEFAULT_LINEWIDTH,dashScale:DEFAULT_DASHSCALE,dashed:!1});i.line=new Line2(o,s);var u=new THREE__namespace.BufferGeometry,c=new THREE__namespace.PointsMaterial({color:DEFAULT_COLOR,size:POINT_SIZE,map:sharedCircleTexture||(sharedCircleTexture=new THREE__namespace.TextureLoader().load(circleImageURL)),sizeAttenuation:!1,transparent:!0});return i.points=new THREE__namespace.Points(u,c),i.points.renderOrder=11,i.points.frustumCulled=!1,i.setPoints(e,r),i.add(i.line,i.points),i}return Object.defineProperty(t,"version",{get:function(){return"6.2.3"},enumerable:!1,configurable:!0}),t.prototype.setPoints=function(e,r){var i=[].concat(e.toArray(),r.toArray());this.points.geometry.setAttribute("position",new THREE__namespace.BufferAttribute(new Float32Array(i),3)),this.line.geometry.setPositions(i),this.line.computeLineDistances(),this.needsRender=!0},t.prototype.getPoints=function(){var e=this.points.geometry.attributes.position.array;return[new THREE__namespace.Vector3(e[0],e[1],e[2]),new THREE__namespace.Vector3(e[3],e[4],e[5])]},t.prototype.setMaterial=function(e){var r=this.line.material;for(var i in e)if(e.hasOwnProperty(i)){var o=e[i];i==="dashed"?(r.dashed=o,o?r.defines.USE_DASH="":delete r.defines.USE_DASH,r.needsUpdate=!0):r[i]=e[i]}this.needsRender=!0},t.prototype.setResolution=function(e,r){var i=this.line.material.resolution;(i.x!==e||i.y!==r)&&(i.set(e,r),this.needsRender=!0)},t}(THREE__namespace.Object3D);Object.assign(FiveLine.prototype,{isFiveLine:!0});var Constants={Handedness:Object.freeze({NONE:"none",LEFT:"left",RIGHT:"right"}),ComponentState:Object.freeze({DEFAULT:"default",TOUCHED:"touched",PRESSED:"pressed"}),ComponentProperty:Object.freeze({BUTTON:"button",X_AXIS:"xAxis",Y_AXIS:"yAxis",STATE:"state"}),ComponentType:Object.freeze({TRIGGER:"trigger",SQUEEZE:"squeeze",TOUCHPAD:"touchpad",THUMBSTICK:"thumbstick",BUTTON:"button"}),ButtonTouchThreshold:.05,AxisTouchThreshold:.1,VisualResponseProperty:Object.freeze({TRANSFORM:"transform",VISIBILITY:"visibility"})};function fetchJsonFile(n){return __awaiter(this,void 0,void 0,function(){var t;return __generator(this,function(e){switch(e.label){case 0:return[4,fetch(n)];case 1:if(t=e.sent(),t.ok)return[2,t.json()];throw new Error(t.statusText)}})})}function fetchProfilesList(n){return __awaiter(this,void 0,void 0,function(){var t,e;return __generator(this,function(r){switch(r.label){case 0:if(!n)throw new Error("No basePath supplied");return t="profilesList.json",[4,fetchJsonFile("".concat(n,"/").concat(t))];case 1:return e=r.sent(),[2,e]}})})}function fetchProfile(n,t){return __awaiter(this,arguments,void 0,function(e,r,i,o){var s,u,c,l,d,f;return i===void 0&&(i=null),o===void 0&&(o=!0),__generator(this,function(v){switch(v.label){case 0:if(!e)throw new Error("No xrInputSource supplied");if(!r)throw new Error("No basePath supplied");return[4,fetchProfilesList(r)];case 1:if(s=v.sent(),e.profiles.some(function(A){var h=s[A];return h&&(u={profileId:A,profilePath:"".concat(r,"/").concat(h.path),deprecated:!!h.deprecated}),!!u}),!u){if(!i)throw new Error("No matching profile name found");if(c=s[i],!c)throw new Error('No matching profile name found and default profile "'.concat(i,'" missing.'));u={profileId:i,profilePath:"".concat(r,"/").concat(c.path),deprecated:!!c.deprecated}}return[4,fetchJsonFile(u.profilePath)];case 2:if(l=v.sent(),o){if(f=void 0,f=l.layouts[e.handedness],!f)throw new Error("No matching handedness, ".concat(e.handedness,", in profile ").concat(u.profileId));f.assetPath&&(d=u.profilePath.replace("profile.json",f.assetPath))}return[2,{profile:l,assetPath:d}]}})})}var defaultComponentValues={xAxis:0,yAxis:0,button:0,state:Constants.ComponentState.DEFAULT};function normalizeAxes(n,t){n===void 0&&(n=0),t===void 0&&(t=0);var e=n,r=t,i=Math.sqrt(n*n+t*t);if(i>1){var o=Math.atan2(t,n);e=Math.cos(o),r=Math.sin(o)}var s={normalizedXAxis:e*.5+.5,normalizedYAxis:r*.5+.5};return s}var VisualResponse=function(){function n(t){this.componentProperty=t.componentProperty,this.states=t.states,this.valueNodeName=t.valueNodeName,this.valueNodeProperty=t.valueNodeProperty,this.valueNodeProperty===Constants.VisualResponseProperty.TRANSFORM&&(this.minNodeName=t.minNodeName,this.maxNodeName=t.maxNodeName),this.value=0,this.updateFromComponent(defaultComponentValues)}return n.prototype.updateFromComponent=function(t){var e=t.xAxis,r=t.yAxis,i=t.button,o=t.state,s=normalizeAxes(e,r),u=s.normalizedXAxis,c=s.normalizedYAxis;switch(this.componentProperty){case Constants.ComponentProperty.X_AXIS:this.value=this.states.includes(o)?u:.5;break;case Constants.ComponentProperty.Y_AXIS:this.value=this.states.includes(o)?c:.5;break;case Constants.ComponentProperty.BUTTON:this.value=this.states.includes(o)?i:0;break;case Constants.ComponentProperty.STATE:this.valueNodeProperty===Constants.VisualResponseProperty.VISIBILITY?this.value=this.states.includes(o):this.value=this.states.includes(o)?1:0;break;default:throw new Error("Unexpected visualResponse componentProperty ".concat(this.componentProperty))}},n}(),Component=function(){function n(t,e){var r=this;if(!t||!e||!e.visualResponses||!e.gamepadIndices||Object.keys(e.gamepadIndices).length===0)throw new Error("Invalid arguments supplied");this.id=t,this.type=e.type,this.rootNodeName=e.rootNodeName,this.touchPointNodeName=e.touchPointNodeName,this.visualResponses={},Object.keys(e.visualResponses).forEach(function(i){var o=new VisualResponse(e.visualResponses[i]);r.visualResponses[i]=o}),this.gamepadIndices=Object.assign({},e.gamepadIndices),this.values={state:Constants.ComponentState.DEFAULT,button:this.gamepadIndices.button!==void 0?0:void 0,xAxis:this.gamepadIndices.xAxis!==void 0?0:void 0,yAxis:this.gamepadIndices.yAxis!==void 0?0:void 0}}return Object.defineProperty(n.prototype,"data",{get:function(){var t=__assign({id:this.id},this.values);return t},enumerable:!1,configurable:!0}),n.prototype.updateFromGamepad=function(t){var e=this;if(this.values.state=Constants.ComponentState.DEFAULT,this.gamepadIndices.button!==void 0&&t.buttons.length>this.gamepadIndices.button){var r=t.buttons[this.gamepadIndices.button];this.values.button=r.value,this.values.button=this.values.button<0?0:this.values.button,this.values.button=this.values.button>1?1:this.values.button,r.pressed||this.values.button===1?this.values.state=Constants.ComponentState.PRESSED:(r.touched||this.values.button>Constants.ButtonTouchThreshold)&&(this.values.state=Constants.ComponentState.TOUCHED)}this.gamepadIndices.xAxis!==void 0&&t.axes.length>this.gamepadIndices.xAxis&&(this.values.xAxis=t.axes[this.gamepadIndices.xAxis],this.values.xAxis=this.values.xAxis<-1?-1:this.values.xAxis,this.values.xAxis=this.values.xAxis>1?1:this.values.xAxis,this.values.state===Constants.ComponentState.DEFAULT&&Math.abs(this.values.xAxis)>Constants.AxisTouchThreshold&&(this.values.state=Constants.ComponentState.TOUCHED)),this.gamepadIndices.yAxis!==void 0&&t.axes.length>this.gamepadIndices.yAxis&&(this.values.yAxis=t.axes[this.gamepadIndices.yAxis],this.values.yAxis=this.values.yAxis<-1?-1:this.values.yAxis,this.values.yAxis=this.values.yAxis>1?1:this.values.yAxis,this.values.state===Constants.ComponentState.DEFAULT&&Math.abs(this.values.yAxis)>Constants.AxisTouchThreshold&&(this.values.state=Constants.ComponentState.TOUCHED)),Object.values(this.visualResponses).forEach(function(i){i.updateFromComponent(e.values)})},n}(),MotionController=function(){function n(t,e,r){var i=this;if(!t)throw new Error("No xrInputSource supplied");if(!e)throw new Error("No profile supplied");this.xrInputSource=t,this.assetUrl=r,this.id=e.profileId,this.layoutDescription=e.layouts[t.handedness],this.components={},Object.keys(this.layoutDescription.components).forEach(function(o){var s=i.layoutDescription.components[o];i.components[o]=new Component(o,s)}),this.updateFromGamepad()}return Object.defineProperty(n.prototype,"gripSpace",{get:function(){return this.xrInputSource.gripSpace},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"targetRaySpace",{get:function(){return this.xrInputSource.targetRaySpace},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"data",{get:function(){var t=[];return Object.values(this.components).forEach(function(e){t.push(e.data)}),t},enumerable:!1,configurable:!0}),n.prototype.updateFromGamepad=function(){var t=this;Object.values(this.components).forEach(function(e){e.updateFromGamepad(t.xrInputSource.gamepad)})},n}(),DEFAULT_PROFILES_PATH="https://cdn.jsdelivr.net/npm/@webxr-input-profiles/assets@1.0/dist/profiles",DEFAULT_PROFILE="generic-trigger",XRControllerModel=function(n){__extends(t,n);function t(){var e=n.call(this)||this;return e.motionController=null,e.envMap=null,e}return t.prototype.setEnvironmentMap=function(e){var r=this;return this.envMap==e?this:(this.envMap=e,this.traverse(function(i){i instanceof THREE__namespace.Mesh&&i.isMesh&&(i.material.envMap=r.envMap,i.material.needsUpdate=!0)}),this)},t.prototype.updateMatrixWorld=function(e){n.prototype.updateMatrixWorld.call(this,e),this.motionController&&(this.motionController.updateFromGamepad(),Object.values(this.motionController.components).forEach(function(r){Object.values(r.visualResponses).forEach(function(i){var o=i.valueNode,s=i.minNode,u=i.maxNode,c=i.value,l=i.valueNodeProperty;o&&(l===Constants.VisualResponseProperty.VISIBILITY?o.visible=c:l===Constants.VisualResponseProperty.TRANSFORM&&(o.quaternion.copy(s.quaternion).slerp(u.quaternion,c),o.position.lerpVectors(s.position,u.position,c)))})}))},t}(THREE.Object3D);function findNodes(n,t){Object.values(n.components).forEach(function(e){var r=e.type,i=e.touchPointNodeName,o=e.visualResponses;if(r===Constants.ComponentType.TOUCHPAD)if(e.touchPointNode=t.getObjectByName(i),e.touchPointNode){var s=new THREE.SphereGeometry(.001),u=new THREE.MeshBasicMaterial({color:255}),c=new THREE.Mesh(s,u);e.touchPointNode.add(c)}else console.warn("Could not find touch dot, ".concat(e.touchPointNodeName,", in touchpad component ").concat(e.id));Object.values(o).forEach(function(l){var d=l.valueNodeName,f=l.minNodeName,v=l.maxNodeName,A=l.valueNodeProperty;if(A===Constants.VisualResponseProperty.TRANSFORM){if(l.minNode=t.getObjectByName(f),l.maxNode=t.getObjectByName(v),!l.minNode){console.warn("Could not find ".concat(f," in the model"));return}if(!l.maxNode){console.warn("Could not find ".concat(v," in the model"));return}}l.valueNode=t.getObjectByName(d),l.valueNode||console.warn("Could not find ".concat(d," in the model"))})})}function addAssetSceneToControllerModel(n,t){findNodes(n.motionController,t),n.envMap&&t.traverse(function(e){e instanceof THREE__namespace.Mesh&&e.isMesh&&(e.material.envMap=n.envMap,e.material.needsUpdate=!0)}),n.add(t)}var XRControllerModelFactory=function(){function n(t){t===void 0&&(t=null),this.gltfLoader=t,this.path=DEFAULT_PROFILES_PATH,this._assetCache={}}return n.prototype.createControllerModel=function(t){var e=this,r=new XRControllerModel,i=null;return t.addEventListener("connected",function(o){var s=o.data;s.targetRayMode!=="tracked-pointer"||!s.gamepad||fetchProfile(s,e.path,DEFAULT_PROFILE).then(function(u){var c=u.profile,l=u.assetPath;r.motionController=new MotionController(s,c,l);var d=e._assetCache[r.motionController.assetUrl];if(d)i=d.scene.clone(),addAssetSceneToControllerModel(r,i);else{if(!e.gltfLoader)throw new Error("GLTFLoader not set.");e.gltfLoader.load(r.motionController.assetUrl,function(f){e._assetCache[r.motionController.assetUrl]=f,i=f.scene.clone(),addAssetSceneToControllerModel(r,i)})}}).catch(function(u){console.warn(u)})}),t.addEventListener("disconnected",function(){r.motionController=null,r.remove(i),i=null}),r},n}();function mapPanoResource(n,t){return n}var CONTROLLER_EVNET_DELTA_TIME=300,ROTATE_Y_PI_MATRIX=new THREE__namespace.Matrix4().makeRotationAxis(new THREE__namespace.Vector3(0,1,0),Math.PI),PANO_TEXTURE_SCALE=new THREE__namespace.Vector3(-1,1,1),XRPanoramaController=function(n){__extends(t,n);function t(e){var r=n.call(this,e)||this;r.xrManager=new XRManager(r.renderer,r.renderer.getContext(),{onSessionStart:function(c){r.emit("xr.session.start",createEvent("xr.session.start",{session:c,machineType:r.xrManager.machineType}))},onSessionEnd:function(){r.emit("xr.session.end",createEvent("xr.session.end",{session:null,machineType:r.xrManager.machineType}))}}),r.xrControllerRay={left:new THREE__namespace.Raycaster,right:new THREE__namespace.Raycaster},r.xrControllerRay.left.params.Points={threshold:.1},r.xrControllerRay.right.params.Points={threshold:.1},r.gazeRay=null,r.pointerLines={left:new FiveLine,right:new FiveLine},r.pointerLines.left.visible=!1,r.pointerLines.right.visible=!0,r.pointerLines.left.setMaterial({color:new THREE__namespace.Vector3(1,1,1)}),r.pointerLines.left.points.material.depthTest=!1,r.pointerLines.right.setMaterial({color:new THREE__namespace.Vector3(1,1,1)}),r.pointerLines.right.points.material.depthTest=!1,r.controllerWrappers=[new THREE__namespace.Group,new THREE__namespace.Group];var i=r.xrManager.getController(0);r.controllerWrappers[0].add(i);var o=r.xrManager.getController(1);r.controllerWrappers[1].add(o);var s=new XRControllerModelFactory;s.gltfLoader={load:function(c,l){internalFetcher.ajax(c,{responseType:"arraybuffer"}).then(function(d){var f;return parseGltf(d.body,{resourcePath:c.slice(0,c.lastIndexOf("/")+1),search:(f=c.split("?")[1])!==null&&f!==void 0?f:"",fetcher:internalFetcher})}).then(function(d){return l(d)})}},(r.xrManager.machineType==="Oculus"||r.xrManager.machineType==="Pico")&&r.scene.add(r.pointerLines.left,r.pointerLines.right,r.controllerWrappers[0],r.controllerWrappers[1]),r.panoResources={},r.panoResources[r.locationMotion.keyframes[0].key=r.locationMotion.keyframes[1].key=createUuid()]={panoId:panoStringify(r.currentPano),leftPanoPicture:null,position:r.camera.pose.offset.clone(),effect:"fade",fixCameraTransform:new THREE__namespace.Matrix4},r.parallaxCameraMatrixs=[];var u=AnimationFrameLoop.shared.getContext();return u?(r.on("xr.session.end",function(){r.scene.remove(r.pointerLines.left,r.pointerLines.right)}),r.xrManager.setSession(u),r.on("xr.session.start",function(){var c=r.xrManager.getControllerGrip(0);c.add(s.createControllerModel(c)),r.controllerWrappers[0].add(c);var l=r.xrManager.getControllerGrip(1);l.add(s.createControllerModel(l)),r.controllerWrappers[1].add(l)}),r.xrHandleState={LeftAxesUp:{touchStartTime:0,touchStart:!1},LeftAxesDown:{touchStartTime:0,touchStart:!1},LeftAxesLeft:{touchStartTime:0,touchStart:!1},LeftAxesRight:{touchStartTime:0,touchStart:!1},LeftTrigger:{touchStartTime:0,touchStart:!1},LeftPinch:{touchStartTime:0,touchStart:!1},RightAxesUp:{touchStartTime:0,touchStart:!1},RightAxesDown:{touchStartTime:0,touchStart:!1},RightAxesLeft:{touchStartTime:0,touchStart:!1},RightAxesRight:{touchStartTime:0,touchStart:!1},RightTrigger:{touchStartTime:0,touchStart:!1},RightPinch:{touchStartTime:0,touchStart:!1},Y:{touchStartTime:0,touchStart:!1},X:{touchStartTime:0,touchStart:!1},A:{touchStartTime:0,touchStart:!1},B:{touchStartTime:0,touchStart:!1}},r.xrManager.machineType==="VP"&&r.initHandEvent(),r):(console.error("获取session失败,请退出重试"),r)}return t.parseArgs=function(e){if(e instanceof t)return e;var r=__assign(__assign({},e),{maxLatitude:Math.PI/2,minLatitude:-Math.PI/2});return n.parseArgs.call(this,r)},t.initAnimationEndState=function(e){var r=this.parseArgs(e),i=n.initAnimationEndState.call(this,r);return __assign(__assign({},i),{mode:"XRPanorama"})},t.prototype.moveToPano=function(e,r,i){var o=this,s,u,c,l,d=(s=r.effect)!==null&&s!==void 0?s:"fade";this.userAction=i,this.stopMomentumMovement();var f=this.works.getResolvedObserver(e);if(!f)throw new Error("Invalid PanoIndex");var v=getImageSizeFromURL(f.images.up),A=this.imageOptions.size;typeof A=="undefined"&&f&&v&&(A=Number(v)),typeof A=="undefined"&&(A=2048);var h=this.imageOptions.transform,p=function(x,M){return mapPanoResource(applyImageURLOptions(x,h,M))},y=__assign({key:"pano.".concat(f.panoId)},pick(this.imageOptions,["format","size","quality"])),m=f.images,g=(c=(u=f.images.tiles)===null||u===void 0?void 0:u.filter(function(x){return x.size>A}))!==null&&c!==void 0?c:null,E="pano:"+jsonHash([m,y,h]);if(this.pendingTextureTask){if(this.pendingTextureTask.hash===E)return;var b=this.pendingTextureTask.panoId;(l=this.panoMeshes[b])===null||l===void 0||l.setProgress(0),this.emit("pano.texture.abort",createEvent("pano.texture.abort",{error:null,progress:0,meta:null,pano:f.pano}))}var T=this.models.getMaterial()||{},_=T.pano0,S=T.pano1,R;if((_==null?void 0:_.map.name)===E?R=_:(S==null?void 0:S.map.name)===E&&(R=S),R){var B={panoId:f.panoId,effect:d,leftPanoPicture:{zoom:1,map:R.map,luminanceMap:R.luminanceMap,matrix:new THREE__namespace.Matrix4().compose(f.position,f.quaternion,PANO_TEXTURE_SCALE)},position:f.position.clone(),fixCameraTransform:new THREE__namespace.Matrix4};this.doMoveToPano(f.pano,B,r);return}var I="move-to-pano-"+f.panoId;this.pending.add(I),this.pendingTextureTask={panoId:f.panoId,hash:E,onLoad:function(x){if(o.pending.delete(I),o.destroyed)x.body.dispose();else{x.body.name=E;var M={panoId:f.panoId,effect:d,leftPanoPicture:{zoom:1,map:x.body,luminanceMap:null,matrix:new THREE__namespace.Matrix4().compose(f.position,f.quaternion,PANO_TEXTURE_SCALE)},position:f.position.clone(),fixCameraTransform:new THREE__namespace.Matrix4};o.doMoveToPano(f.pano,M,r)}},onError:function(x){o.pending.delete(I);var M=__assign(__assign(__assign({},f.pano),{mode:o.mode}),clonePose(o.camera.pose));o.emit("pano.error",createEvent("pano.error",{error:x,userAction:o.userAction,options:r,prevPano:o.currentPano,progress:0,state:M})),o.emit("pano.cancel",createEvent("pano.cancel",{error:null,userAction:o.userAction,options:r,prevPano:o.currentPano,progress:0,state:M})),r.moveCancelCallback&&r.moveCancelCallback()}},Promise.all([this.tileLevelForFov&&g&&g.length?this.textureLoader.loadTiledCubeTexture(m,g,{tileMaxLevel:this.TILED_CUBE_TEXTURE_LEVEL,imageURL:{transform:p,options:y},format:THREE__namespace.RGBAFormat,minFilter:THREE__namespace.LinearFilter,magFilter:THREE__namespace.LinearFilter,generateMipmaps:!1,viaAjax:!0,fetcher:getFetcher(f.work)},void 0,void 0,function(x){var M,L;o.emit("pano.texture.progress",createEvent("pano.texture.progress",{error:null,progress:x,meta:null,pano:f.pano})),((M=o.pendingTextureTask)===null||M===void 0?void 0:M.hash)===E&&((L=o.panoMeshes[f.panoId])===null||L===void 0||L.setProgress(x))},this.renderer):this.textureLoader.loadCubeTexture(m,{imageURL:{transform:p,options:y},format:THREE__namespace.RGBAFormat,fetcher:getFetcher(f.work)},void 0,void 0,function(x){var M,L;((M=o.pendingTextureTask)===null||M===void 0?void 0:M.hash)===E&&((L=o.panoMeshes[f.panoId])===null||L===void 0||L.setProgress(x)),o.emit("pano.texture.progress",createEvent("pano.texture.progress",{error:null,progress:x,meta:null,pano:f.pano}))},this.renderer)]).then(function(x){var M,L,C=x[0];((M=o.pendingTextureTask)===null||M===void 0?void 0:M.hash)===E?(o.pendingTextureTask.onLoad(C),(L=o.panoMeshes[f.panoId])===null||L===void 0||L.setProgress(0),delete o.pendingTextureTask,o.emit("pano.texture.success",createEvent("pano.texture.success",{error:null,progress:1,meta:C.meta,pano:f.pano}))):C.body.dispose()}).catch(function(x){var M,L;((M=o.pendingTextureTask)===null||M===void 0?void 0:M.hash)===E&&(o.pendingTextureTask.onError(x),(L=o.panoMeshes[f.panoId])===null||L===void 0||L.setProgress(0),delete o.pendingTextureTask,o.emit("pano.texture.error",createEvent("pano.texture.error",{error:x,progress:0,meta:null,pano:f.pano})),o.emit("error",x))}),this.emit("pano.texture.load",createEvent("pano.texture.load",{error:null,progress:0,meta:null,pano:f.pano}))},t.prototype.doMoveToPano=function(e,r,i){var o=this,s,u,c,l,d,f,v,A,h,p;i===void 0&&(i={});var y=now(),m=createUuid();this.panoResources[m]=r;var g=1,E,b,T;if(this.locationMotion.ended){var _=this.locationMotion.getKeyFrameSegment(y);_[0];var S=_[1],R=this.locationMotion.value,B=this.panoResourceFromLocationMotionKeyframe(S).position,I=r.position;E=Math.max(B.distanceTo(I),g),b=[{key:S.key,progress:0,value:__assign(__assign({},R),{count:0})},{key:m,progress:1,value:{distance:0,count:1}}],T=0}else{var x=this.locationMotion.getKeyFrameSegment(y),M=x[0],S=x[1],R=this.locationMotion.value,L=this.panoResourceFromLocationMotionKeyframe(M).position,B=this.panoResourceFromLocationMotionKeyframe(S).position,I=r.position,C=S.value.count-R.count,H=Math.max(L.distanceTo(B),g)*C,F=Math.max(B.distanceTo(I),g);E=H+F,b=[{key:M.key,progress:0,value:__assign({},R)},{key:S.key,progress:H/E,value:S.value},{key:m,progress:1,value:{count:S.value.count+1,distance:0}}];var O=this.locationMotionKeyframesLength(this.locationMotion.keyframes),G=this.locationMotionKeyframesLength(b);T=this.locationMotion.getProgressVelocity(y)*O/G}var Q=r.effect==="instant"?0:this.calculateMovingDuration(i.duration,r.effect==="fly"?E:0),U={longitude:i.longitude,latitude:i.latitude,fov:i.fov},D=__assign(__assign({},e),{mode:this.mode,longitude:(s=U.longitude)!==null&&s!==void 0?s:this.camera.pose.longitude,latitude:(u=U.latitude)!==null&&u!==void 0?u:this.camera.pose.latitude,fov:(c=U.fov)!==null&&c!==void 0?c:this.camera.pose.fov,offset:r.position.clone(),distance:0}),q=this.currentPano;if(this.emit("pano.moveTo",createEvent("pano.moveTo",{options:i,prevPano:q,progress:0,state:D,userAction:this.userAction,error:null})),i.moveStartCallback&&i.moveStartCallback(D),this.videoTexture&&this.videoTexture.image instanceof HTMLVideoElement&&this.videoTexture.image.getAttribute("src")&&(this.videoTexture.image.pause(),this.videoTexture.image.removeAttribute("uuid"),this.videoTexture.image.removeAttribute("src"),this.videoTexture.image.oncanplay=noop$1,this.videoTexture.needsUpdate=!0),this.panoVideo.setMaterial(null),r.effect==="fly")this.cameraMotion.set(U,Q).catch(noop$1);else{var z=coordinatesToVector({longitude:this.cameraMotion.value.longitude,latitude:this.cameraMotion.value.latitude}),K=coordinatesToVector({longitude:(l=U.longitude)!==null&&l!==void 0?l:this.cameraMotion.value.longitude,latitude:(d=U.latitude)!==null&&d!==void 0?d:this.cameraMotion.value.latitude}),J=new THREE__namespace.Object3D;J.lookAt(z);var j=new THREE__namespace.Matrix4().makeRotationFromQuaternion(J.quaternion);J.lookAt(K);var re=new THREE__namespace.Matrix4().makeRotationFromQuaternion(J.quaternion),W=new THREE__namespace.Matrix4().getInverse(j).premultiply(re),te=this.cameraMotion.value.fov,$=(f=U.fov)!==null&&f!==void 0?f:this.cameraMotion.value.fov,ne=1;r.effect==="zoomin"?ne=1.5:r.effect==="zoomout"&&(ne=.4);for(var ee=$*ne,ce=0;ce<b.length-1;ce++){var ae=b[ce].key;if(ae){var se=this.panoResources[ae];se&&(se.fixCameraTransform.copy(W),se.leftPanoPicture&&(se.leftPanoPicture.zoom=Math.tan(te/2/180*Math.PI)/Math.tan(ee/2/180*Math.PI)))}}this.cameraMotion.setKeyframes([{progress:0,value:{longitude:this.cameraMotion.value.longitude,latitude:this.cameraMotion.value.latitude,fov:this.cameraMotion.value.fov}},{progress:0,value:{longitude:(v=U.longitude)!==null&&v!==void 0?v:this.cameraMotion.value.longitude,latitude:(A=U.latitude)!==null&&A!==void 0?A:this.cameraMotion.value.latitude,fov:ee}},{progress:1,value:{longitude:(h=U.longitude)!==null&&h!==void 0?h:this.cameraMotion.value.longitude,latitude:(p=U.latitude)!==null&&p!==void 0?p:this.cameraMotion.value.latitude,fov:$}}],Q).catch(noop$1)}var Ae=this.locationMotion.setKeyframes(b,Q,T);Ae.then(function(){for(var he,me,Z,Y=0,N=o.models;Y<N.length;Y++){var Ee=N[Y];Ee.show()}var ge=__assign(__assign({},e),{mode:o.mode,longitude:o.camera.pose.longitude,latitude:o.camera.pose.latitude,fov:o.camera.pose.fov,offset:o.camera.pose.offset.clone(),distance:0});o.emit("pano.arrived",createEvent("pano.arrived",{options:i,prevPano:q,progress:1,state:ge,userAction:o.userAction,error:null})),i.moveEndCallback&&i.moveEndCallback(ge);var ve=o.works.getResolvedObserver(o.currentPano);if(ve&&ve.video&&o.videoTexture&&o.videoTexture.image instanceof HTMLVideoElement){var xe=ROTATE_Y_PI_MATRIX.clone().multiply((Z=(me=(he=o.models.getMaterial())===null||he===void 0?void 0:he.pano1)===null||me===void 0?void 0:me.matrix)!==null&&Z!==void 0?Z:new THREE__namespace.Matrix4).multiply(ve.video.matrix),fe={map:o.videoTexture,size:ve.video.size,matrix:xe,alpha:1},de=createUuid(),le=o.videoTexture.image;le.setAttribute("uuid",de),canplayVideo().then(function(ue){ue&&ve.video&&le.getAttribute("uuid")===de&&(le.oncanplay=function(){le.oncanplay=noop$1,le.play()},le.ontimeupdate=function(){le.currentTime>.5&&(le.ontimeupdate=noop$1,o.panoVideo.setMaterial(fe))},le.src=ve.video.source)}).catch(function(){le.removeAttribute("uuid")})}},function(){o.emit("pano.cancel",createEvent("pano.cancel",{options:i,prevPano:q,progress:0,state:D,userAction:o.userAction,error:null})),i.moveCancelCallback&&i.moveCancelCallback()})},t.prototype.checkSelectedPano=function(e){var r=this,i,o,s,u;this.stopMomentumMovement();var c=this.camera.getDirection(new THREE__namespace.Vector3).setY(0),l=null,d=this.works.getResolvedObserver(this.currentPano);if(!d)return null;var f=d.accessibleIds.filter(function(K){var J=panoParse(K);if(panoEqual(J,r.currentPano))return!1;var j=r.works.getResolvedObserver(J);return!j||j.position.distanceTo(r.camera.position)>r.maxAccessibleDistance?!1:j.loadable||j.active}),v=this.models.intersectRaycaster(e)[0];if(v){var A=arrayMin(f,function(K){var J=r.works.getResolvedObserver(K);if(!J)return 1/0;var j=J.standingPosition.clone();return j.distanceTo(v.point)},!0),h=A[0],p=A[1];h&&p<this.panoTapTriggerRadius&&(l=(i=this.works.getResolvedObserver(h))!==null&&i!==void 0?i:null)}if(isNil(l)){var y=this.getForwardObserverOrNot(e);y&&(l=y)}for(var m=0,g=this.locationMotion.keyframes;m<g.length;m++){var E=g[m],b=this.panoResourceFromLocationMotionKeyframe(E);if(!(E.progress<this.locationMotion.progress)&&l&&b.panoId===l.panoId){l=null;break}}if(isNil(l))return this.locationMotion.ended===!0&&this.cameraBounce(),null;if(l&&!l.active){var T=l.panoId;this.panoMeshes[T]&&(this.panoMeshes[T].setDisabled(!1),this.panoMeshes[T].setLoading(!0))}var _={};if(l){for(var S=Math.PI/6,R=Math.PI/12,B=new THREE__namespace.Vector3(0,1,0),I=l.position.clone().setY(0).sub(d.position.clone().setY(0)).normalize(),x=I.clone().applyAxisAngle(B,S),M=I.clone().applyAxisAngle(B,-S),L=[],C=[],H=[],F=0,O=l.accessibleIds;F<O.length;F++){var h=O[F],G=panoParse(h);if(!(panoEqual(G,this.currentPano)||panoEqual(G,l.pano))){var Q=this.works.getResolvedObserver(h);if(Q){var U=Q.position.clone().sub(l.position).setY(0);I.angleTo(U)<S?H.push(U):x.angleTo(U)<S?L.push(U):M.angleTo(U)<S&&C.push(U)}}}var D=H.length>0?H:__spreadArray(__spreadArray([],L,!0),C,!0),q=D.slice().sort(function(K,J){return K.angleTo(I)-J.angleTo(I)})[0];q&&q.angleTo(c)>R&&(_.longitude=Math.atan2(-q.x,-q.z))}this.cameraMotion.value.latitude<-Math.PI/4&&(_.latitude=clamp$1(0,this.minLatitude,this.maxLatitude)),this.cameraMotion.value.fov<60&&(_.fov=this.defaultFov);var z={workCode:l.pano.workCode,panoIndex:l.pano.panoIndex,mode:this.mode,longitude:(o=_.longitude)!==null&&o!==void 0?o:this.camera.pose.longitude,latitude:(s=_.latitude)!==null&&s!==void 0?s:this.camera.pose.latitude,fov:(u=_.fov)!==null&&u!==void 0?u:this.camera.pose.fov,distance:0,offset:l?l.position.clone():new THREE__namespace.Vector3};return this.emit("pano.select",createEvent("pano.select",{prevPano:this.currentPano,state:z,userAction:!0,options:_,progress:0,error:null})),l&&l.active?(this.emit("pano.request",createEvent("pano.request",{userAction:!0,prevPano:this.currentPano,progress:0,state:z,options:_,error:null})),l.pano):null},t.prototype.destroy=function(){n.prototype.destroy.call(this)},t.prototype.isReady=function(){return!1},t.prototype.updateCamera=function(e,r,i){return Promise.resolve()},t.prototype.updateCameraWithKeyframes=function(e,r,i){return Promise.resolve()},t.prototype.updateTime=function(e,r){for(var i=this,o,s,u,c,l,d,f,v,A=[],h=2;h<arguments.length;h++)A[h-2]=arguments[h];this.userAction=!0;var p={},y={},m=this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[0]),g=this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[this.locationMotion.keyframes.length-1]),E=!1;if(this.cameraMotion.ended===!1&&(this.cameraMotion.update(e),y.longitude=this.cameraMotion.value.longitude,y.latitude=this.cameraMotion.value.latitude,y.fov=this.cameraMotion.value.fov),this.modelAlphaMotion.ended===!1&&(this.modelAlphaMotion.update(e),p.modelAlpha=this.modelAlphaMotion.value.modelAlpha),this.perspToOrthoMotion.ended===!1&&(this.perspToOrthoMotion.update(e),this.camera.perspToOrtho.setScalar(clamp$1(this.perspToOrthoMotion.value.perspToOrtho,0,1))),this.locationMotion.ended===!1){this.locationMotion.update(e);var b=this.locationMotion.getKeyFrameSegment(e),T=b[0],_=b[1],S=this.panoResourceFromLocationMotionKeyframe(T),R=this.panoResourceFromLocationMotionKeyframe(_),B=new THREE__namespace.Vector3().copy(S.position),I=new THREE__namespace.Vector3().copy(R.position),x=this.locationMotion.value.count-_.value.count+1;p.progress=x,R.leftPanoPicture&&(x<1?S.leftPanoPicture&&(p.pano0=S.leftPanoPicture):p.pano0=R.leftPanoPicture,p.pano1=R.leftPanoPicture),R.effect==="montage"?p.transition="BLACK":R.effect==="spread"?p.transition="SPREAD":p.transition="FADE",(R.effect==="zoomin"||R.effect==="zoomout")&&(p.progress=Math.pow(x,3)),x<1&&R.effect!=="fly"&&(p.pano0&&S.leftPanoPicture&&(p.pano0={map:p.pano0.map,zoom:p.pano0.zoom,luminanceMap:p.pano0.luminanceMap,matrix:S.leftPanoPicture.matrix.clone().setPosition(R.position)}),B.copy(I),E=!0),y.distance=this.locationMotion.value.distance,y.offset=new THREE__namespace.Vector3(B.x+(I.x-B.x)*x,B.y+(I.y-B.y)*x,B.z+(I.z-B.z)*x);for(var M=[],L=[],C=0,H=this.locationMotion.keyframes;C<H.length;C++){var F=H[C],O=F.key,G=F.progress;O!==void 0&&(M.push(O),G>this.locationMotion.progress&&L.push(O))}for(var Q=0,U=Object.keys(this.panoResources);Q<U.length;Q++){var D=U[Q];if(!(L.indexOf(D)>=0)){var q=this.panoResources[D];if(q.leftPanoPicture){var z=q.leftPanoPicture.map;if(z){if(z===((o=p.pano0)===null||o===void 0?void 0:o.map)||z===((s=p.pano1)===null||s===void 0?void 0:s.map))continue;z instanceof TileCubeTextureTarget&&z.cubeRenderTarget&&this.colorCubeRenderTargetPool.push(z.cubeRenderTarget),z.dispose(),q.leftPanoPicture=null}}M.indexOf(D)>=0||delete this.panoResources[D]}}this.currentPano=panoParse(R.panoId),this.emit("pano.moving",createEvent("pano.moving",{userAction:this.userAction,prevPano:panoParse(m.panoId),state:__assign(__assign(__assign(__assign({},panoParse(g.panoId)),{mode:this.mode}),clonePose(this.camera.pose)),y),options:{},progress:this.locationMotion.progress,error:null}))}isEmptyObject(p)===!1&&(!((u=p.pano0)===null||u===void 0)&&u.map&&p.pano0.map instanceof TileCubeTextureTarget&&!p.pano0.map.cubeRenderTarget&&(p.pano0.map.cubeRenderTarget=this.colorCubeRenderTargetPool.pop()),!((c=p.pano1)===null||c===void 0)&&c.map&&p.pano1.map instanceof TileCubeTextureTarget&&!p.pano1.map.cubeRenderTarget&&(p.pano1.map.cubeRenderTarget=this.colorCubeRenderTargetPool.pop()),this.models.setMaterial(p)),isEmptyObject(y)===!1&&this.setCamera(y);var K=this.works.getResolvedObserver(this.currentPano),J=A[1];if(!J){console.error("xrFrame丢失,请重试");return}if(!this.xrManager.session){console.error("session丢失,请重试");return}var j=this.xrManager.referenceSpace;if(j){var re=this.xrManager.cameraVR,W=this.xrManager.cameraL,te=this.xrManager.cameraR,$=[W,te],ne=J.getViewerPose(j),ee=new THREE__namespace.Vector3(0,0,0);if(ne){var ce;ce=this.xrManager.session.renderState.baseLayer;var ae=ne.views;if(!ce){console.error("no layer found");return}this.renderer.setFramebuffer(ce.framebuffer);var se=!1;ae.length!==re.cameras.length&&(re.cameras.length=0,se=!0),this.parallaxCameraMatrixs=[];var Ae=new THREE__namespace.Vector3,he=new THREE__namespace.Vector3;new THREE__namespace.Matrix4().fromArray(ae[0].transform.matrix).decompose(Ae,new THREE__namespace.Quaternion,new THREE__namespace.Vector3),new THREE__namespace.Matrix4().fromArray(ae[1].transform.matrix).decompose(he,new THREE__namespace.Quaternion,new THREE__namespace.Vector3),he.clone().sub(Ae).normalize();var me=new THREE__namespace.Vector3,Z=new THREE__namespace.Quaternion,Y=new THREE__namespace.Vector3;this.camera.matrix.decompose(me,Z,Y);for(var N=0;N<ae.length;N++){var Ee=ae[N],ge=ce.getViewport(Ee),ve=$[N];ve.matrix.fromArray(Ee.transform.matrix);var xe=new THREE__namespace.Vector3,fe=new THREE__namespace.Quaternion,de=new THREE__namespace.Vector3;ve.matrix.decompose(xe,fe,de),ee.copy(me),ve.position.copy(me),ve.quaternion.copy(fe),ve.scale.copy(de),ve.updateMatrix(),ve.projectionMatrix.fromArray(Ee.projectionMatrix),ve.viewport.set(ge.x,ge.y,ge.width,ge.height),se===!0&&re.cameras.push(ve)}if(this.xrManager.session&&this.xrManager.session.inputSources){for(var N=0;N<this.xrManager.session.inputSources.length;N++)if(this.xrManager.session.inputSources[N]&&this.xrManager.session.inputSources[N].targetRayMode==="transient-pointer"){var le=J.getPose(this.xrManager.session.inputSources[N].targetRaySpace,j);if(le){var ue=new THREE__namespace.Vector3(0,0,-1).applyQuaternion(le.transform.orientation),oe=new THREE__namespace.Raycaster(this.camera.position,ue);this.gazeRay=oe}}}if(this.xrManager.machineType==="Oculus"||this.xrManager.machineType==="Pico"){for(var Te=this.xrManager.session.inputSources,N=0;N<Te.length;N++){var Re=this.xrManager.controllers[N],Ie=Te[N];if(Ie){Re&&Re.update(Ie,J,j);var oe=this.xrManager.getController(N),lt=new THREE__namespace.Vector3(0,1.2,0),ye=oe.position.clone().add(ee).sub(lt);Ie.handedness==="left"?this.xrControllerRay.left.set(ye,new THREE__namespace.Vector3(0,0,-1).applyEuler(oe.rotation)):Ie.handedness==="right"&&this.xrControllerRay.right.set(ye,new THREE__namespace.Vector3(0,0,-1).applyEuler(oe.rotation)),this.controllerWrappers[N].position.copy(new THREE__namespace.Vector3(0,0,0).add(ee).sub(lt));var we=this.models.intersectRaycaster(this.xrControllerRay.right);if(we.length===0&&(we=this.xrControllerRay.right.intersectObject(this.boundingMesh,!0).map(function(st){var ft;return __assign({floor:(ft=K==null?void 0:K.floorIndex)!==null&&ft!==void 0?ft:0},st)})),we.length>=1&&we[0].face)if(Ie.handedness==="right"){var Be=this.xrControllerRay.right.intersectObject(this.xrCustomObjectsScene,!0),Je=we[0].face.normal,ht=Je.clone(),Xe=we[0].point.clone();this.intersectMesh.position.copy(Xe);var Ve=Xe.clone().add(ht);if(this.intersectMesh.lookAt(Ve),Math.abs(Je.y)>.99){var je=this.camera.position.clone().sub(Xe);this.intersectMesh.rotation.z=-Math.atan2(je.z,je.x)}this.intersectMesh.visible=!0,this.needsRender=!0,Be.length>0?(this.pointerLines.right.setPoints(ye,Be[0].point),this.pointerLines.right.points.visible=!0,this.intersectMesh.visible=!1):(this.pointerLines.right.points.visible=!1,this.pointerLines.right.setPoints(ye,we[0].point));var at=we[0],Ue=createEvent("intersect.update",{raycaster:(l=this.xrControllerRay.right)!==null&&l!==void 0?l:null,intersection:at!=null?at:null,object:this.intersectMesh});if(this.emit("intersect.update",Ue),Ue.defaultPrevented){this.hideIntersectMesh();return}}else this.pointerLines.left.setPoints(ye,we[0].point)}}this.updateControllerHelper(Te,e,r)}if(this.camera.pose.distance>.1||E)for(var We=0,ze=Object.keys(this.panoMeshes);We<ze.length;We++){var He=ze[We],be=this.panoMeshes[He];be.setOpacity(0),be.setCurrent(!1),be.updateTime&&be.updateTime(e,r),be.visible=!1}else if(K){var $e=arrayMin(K.visibleIds,function(Le){var qe=i.works.getResolvedObserver(Le);return qe?K.standingPosition.distanceTo(qe.standingPosition):1/0},!0),Fe=$e[1];Fe=clamp$1(Fe,2.5,1/0);for(var et=K.visibleIds.concat(panoStringify(this.currentPano)),tt=this.getForwardObserverOrNot(),Qe=this.camera.getDirection(new THREE__namespace.Vector3),Ne=0,rt=Object.keys(this.panoMeshes);Ne<rt.length;Ne++){var He=rt[Ne],be=this.panoMeshes[He],ot=this.works.getResolvedObserver(He);if(et.indexOf(He)===-1)be.setCurrent(!1),be.setOpacity(0);else if(!ot)be.setCurrent(!1),be.setOpacity(0);else if(!ot.loadable&&!ot.active)be.setCurrent(!1),be.setOpacity(0);else{var pt=be.position.clone().setY(this.camera.position.y).distanceTo(this.camera.position);be.setCurrent(!be.loading&&be.progress===0&&tt!==null&&tt.panoId===He),be.setOpacity(pt<.01?0:clamp$1(Fe/pt*1.2,.65,.98));var ct=this.camera.position.clone().setY(be.position.y),ue=new THREE__namespace.Vector3().copy(be.position).sub(ct).normalize();if(He===panoStringify(this.currentPano)){var dt=clamp$1((.5-ct.distanceTo(be.position))/.5,0,1);ue.multiplyScalar(1-dt).add(Qe.clone().multiplyScalar(dt))}ue.length()>0&&be.quaternion.setFromEuler(new THREE__namespace.Euler(0,Math.atan2(ue.x,ue.z),0))}be.updateTime&&be.updateTime(e,r)}}var Ge=function(){return 4}(),Me=function(){var Le=new THREE__namespace.PerspectiveCamera;Le.applyMatrix4(re.matrix),Le.position.set(0,0,0);var qe=i.works.getResolvedObserver(g.panoId),st=qe!=null?qe:K;st&&Le.quaternion.premultiply(st.quaternion.clone().inverse()),Le.updateProjectionMatrix(),Le.updateMatrixWorld(!0);var ft=new THREE__namespace.Frustum().setFromProjectionMatrix(new THREE__namespace.Matrix4().multiplyMatrices(Le.projectionMatrix,Le.matrixWorldInverse));return ft}();g.panoId===panoStringify(this.currentPano)&&((d=g.leftPanoPicture)===null||d===void 0?void 0:d.map)instanceof TileCubeTextureTarget&&(g.leftPanoPicture.map.maxRequest=this.tileMaxRequest,g.leftPanoPicture.map.update(Me,Ge),g.leftPanoPicture.map.needsRender===!0&&(this.needsRender=!0,this.modelSceneNeedsRender=!0));{var _e=this.tiling.object.visible;if(this.initAnimationed){var Pe=g.panoId,ke=this.works.getResolvedObserver(Pe);ke?isSimilarVector3(this.camera.position,ke.position)&&this.locationMotion.ended?(this.tiling.object.visible=!0,this.tiling.panoId!==Pe&&this.tiling.cleanup(),this.tiling.panoId=Pe,this.tiling.setResource((v=(f=ke.images)===null||f===void 0?void 0:f.tiles)!==null&&v!==void 0?v:[],this.enableIOSEDR&&ke.images.luminance?ke.images.luminance:null),this.tiling.setFetcher(getFetcher(ke.work)),this.tiling.setRotation(ke.quaternion),this.tiling.setPosition(ke.position),this.tiling.maxRequest=this.tileMaxRequest,Ge>this.TILED_CUBE_TEXTURE_LEVEL?this.tiling.update(Me,Ge,e):this.tiling.update(Me,0,e)):this.tiling.object.visible=!1:this.tiling.object.visible=!1}else this.tiling.object.visible=!1;_e!==this.tiling.object.visible&&(this.tiling.object.needsRender=!0,this.modelSceneNeedsRender=!0)}this.panoVideo.object.position.copy(this.camera.position),this.panoVideo.updateTime(e)}}},t.prototype.render=function(){var e=this.xrManager.getCamera(this.camera);this.renderer.render(this.modelScene,e),this.renderer.autoClearColor=!1,this.renderer.autoClearDepth=!1,this.renderer.render(this.scene,e),this.renderer.autoClearColor=!0,this.renderer.autoClearDepth=!0},t.prototype.onPanGesture=function(){},t.prototype.onTapGesture=function(){},t.prototype.onPinchGesture=function(){},t.prototype.onMouseMove=function(){},t.prototype.onMouseOut=function(){},t.prototype.panoResourceFromLocationMotionKeyframe=function(e){return this.panoResources[e.key]},t.prototype.updateControllerHelper=function(e,r,i){var o=this.xrControllerRay.left,s=this.xrControllerRay.right;if(!(!e||e.length===0)){for(var u={buttons:{X:!1,Y:!1,LeftTrigger:!1,LeftPinch:!1,A:!1,B:!1,RightTrigger:!1,RightPinch:!1}},c=0;c<e.length;c++){var l=e[c].handedness,d=e[c].gamepad;switch(l){case"left":d.axes&&(this.emitHandleEvent(d.axes[2]===-1,"LeftAxesLeft",r),this.emitHandleEvent(d.axes[2]===1,"LeftAxesRight",r),this.emitHandleEvent(d.axes[3]===-1,"LeftAxesUp",r),this.emitHandleEvent(d.axes[3]===1,"LeftAxesDown",r)),d!=null&&d.buttons&&(d.buttons[4]&&this.emitHandleEvent(d.buttons[4].pressed,"X",r),d.buttons[5]&&this.emitHandleEvent(d.buttons[5].pressed,"Y",r),d.buttons[0]&&this.emitHandleEvent(d.buttons[0].pressed,"LeftTrigger",r),d.buttons[1]&&this.emitHandleEvent(d.buttons[1].pressed,"LeftPinch",r));var f={raycaster:o,axes:{up:d.axes&&d.axes[3]<0?Math.abs(d.axes[3]):0,down:d.axes&&d.axes[3]<0?0:Math.abs(d.axes[3]),left:d.axes&&d.axes[2]<0?Math.abs(d.axes[2]):0,right:d.axes&&d.axes[2]<0?0:Math.abs(d.axes[2])},deltaTime:i};u.buttons.X=d.buttons&&d.buttons[4]?d.buttons[4].pressed:!1,u.buttons.Y=d.buttons&&d.buttons[5]?d==null?void 0:d.buttons[5].pressed:!1,u.buttons.LeftTrigger=d.buttons&&d.buttons[0]?d==null?void 0:d.buttons[0].pressed:!1,u.buttons.LeftPinch=d.buttons&&d.buttons[1]?d==null?void 0:d.buttons[1].pressed:!1,u.left=f;break;case"right":d.axes&&(this.emitHandleEvent(d.axes[2]===-1,"RightAxesLeft",r),this.emitHandleEvent(d.axes[2]===1,"RightAxesRight",r),this.emitHandleEvent(d.axes[3]===-1,"RightAxesUp",r),this.emitHandleEvent(d.axes[3]===1,"RightAxesDown",r)),d.buttons&&(d.buttons[4]&&this.emitHandleEvent(d.buttons[4].pressed,"A",r),d.buttons[5]&&this.emitHandleEvent(d.buttons[5].pressed,"B",r),d.buttons[0]&&this.emitHandleEvent(d.buttons[0].pressed,"RightTrigger",r),d.buttons[1]&&this.emitHandleEvent(d.buttons[1].pressed,"RightPinch",r));var v={raycaster:s,axes:{up:d.axes&&d.axes[3]<0?Math.abs(d.axes[3]):0,down:d.axes&&d.axes[3]<0?0:Math.abs(d.axes[3]),left:d.axes&&d.axes[2]<0?Math.abs(d.axes[2]):0,right:d.axes&&d.axes[2]<0?0:Math.abs(d.axes[2])},deltaTime:i};u.right=v,u.buttons.A=d.buttons&&d.buttons[4]?d==null?void 0:d.buttons[4].pressed:!1,u.buttons.B=d.buttons&&d.buttons[5]?d==null?void 0:d.buttons[5].pressed:!1,u.buttons.RightTrigger=d.buttons&&d.buttons[0]?d==null?void 0:d.buttons[0].pressed:!1,u.buttons.RightPinch=d.buttons&&d.buttons[1]?d==null?void 0:d.buttons[1].pressed:!1;break}}this.emit("xr.controller.update",createEvent("xr.controller.update",u))}},t.prototype.emitHandleEvent=function(e,r,i){var o=this.xrControllerRay.left,s=this.xrControllerRay.right;if(e)if(this.xrHandleState[r].touchStart===!1)this.xrHandleState[r].touchStartTime=i,this.xrHandleState[r].touchStart=!0,this.emit("xr.gesture.buttonDown",createEvent("xr.gesture.buttonDown",{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:r,isFinal:!1,isFirst:!0,controllers:{raycaster:{leftRay:o,rightRay:s}}}));else{var u=i-this.xrHandleState[r].touchStartTime;u>CONTROLLER_EVNET_DELTA_TIME&&this.emit("xr.gesture.press",createEvent("xr.gesture.tap",{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:r,isFinal:!0,isFirst:!0,controllers:{raycaster:{leftRay:o,rightRay:s}}}))}else if(this.xrHandleState[r].touchStart===!0){this.emit("xr.gesture.buttonUp",createEvent("xr.gesture.buttonUp",{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:r,isFinal:!0,isFirst:!1,controllers:{raycaster:{leftRay:o,rightRay:s}}}));var u=i-this.xrHandleState[r].touchStartTime;if(u<=CONTROLLER_EVNET_DELTA_TIME){var c=createEvent("xr.gesture.tap",{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:r,isFinal:!0,isFirst:!1,controllers:{raycaster:{leftRay:o,rightRay:s}}}),l=this.emit("xr.gesture.tap",c);!l&&!c.defaultPrevented&&r==="RightTrigger"&&this.checkSelectedPano(this.xrControllerRay.right)}this.xrHandleState[r].touchStart=!1,this.xrHandleState[r].touchStartTime=0}},t.prototype.initHandEvent=function(){var e=this;if(!this.xrManager.session)throw new Error("初始化失败");this.xrManager.session.addEventListener("select",function(r){e.gazeRay&&e.checkSelectedPano(e.gazeRay)})},t}(PanoramaController),Controllers={Floorplan:FloorplanController,Topview:TopviewController,Panorama:PanoramaController,VRPanorama:VRPanoramaController,Model:ModelController,Mapview:MapviewController,XRPanorama:XRPanoramaController},PROXY_CONTROLLER_EVENT_NAMES=["gesture.pan","gesture.tap","gesture.dbltap","gesture.press","gesture.pinch","gesture.mousewheel","gesture.mousemove","gesture.momentum","initAnimation.start","initAnimation.end","camera.update","intersect.update","pano.select","pano.moveTo","pano.moving","pano.arrived","pano.cancel","pano.error","pano.texture.load","pano.texture.progress","pano.texture.success","pano.texture.error","pano.texture.abort","xr.session.start","xr.session.end","xr.gesture.tap","xr.gesture.press","xr.gesture.buttonUp","xr.gesture.buttonDown","xr.controller.update"];function initLegacyEvent(n){n.on("initAnimation.start",function(t){n.emit("initAnimationWillStart",t.state.panoIndex,t.state,t.userAction)}),n.on("initAnimation.end",function(t){n.emit("initAnimationEnded",t.state.panoIndex,t.state,t.userAction)}),n.on("gesture.pan",function(t){var e=!1;e=n.emit("wantsGesture","pan",t.pointers,t.isFinal),e&&t.preventDefault(),e=n.emit("wantsPanGesture",t.state,t.isFinal),e&&t.preventDefault(),t.defaultPrevented||(n.emit("gesture","pan",t.pointers,t.isFinal),n.emit("panGesture",t.state,t.isFinal))}),n.on("gesture.tap",function(t){var e=!1;e=n.emit("wantsGesture","tap",t.pointers,t.isFinal),e&&t.preventDefault(),e=n.emit("wantsTapGesture",t.center.raycaster,t.center.coords,t.isFinal),e&&t.preventDefault(),t.defaultPrevented||(n.emit("gesture","tap",t.pointers,t.isFinal),n.emit("tapGesture",t.center.raycaster,t.center.coords,t.isFinal))}),n.on("gesture.dbltap",function(t){var e=!1;e=n.emit("wantsGesture","dbltap",t.pointers,t.isFinal),e&&t.preventDefault(),e=n.emit("wantsDblTapGesture",t.center.raycaster,t.center.coords,t.isFinal),e&&t.preventDefault(),t.defaultPrevented||(n.emit("gesture","dbltap",t.pointers,t.isFinal),n.emit("dblTapGesture",t.center.raycaster,t.center.coords,t.isFinal))}),n.on("gesture.press",function(t){var e=!1;e=n.emit("wantsGesture","press",t.pointers,t.isFinal),e&&t.preventDefault(),e=n.emit("wantsPressGesture",t.center.raycaster,t.center.coords,t.center.delta,t.isFinal),e&&t.preventDefault(),t.defaultPrevented||(n.emit("gesture","press",t.pointers,t.isFinal),n.emit("pressGesture",t.center.raycaster,t.center.coords,t.center.delta,t.isFinal))}),n.on("gesture.pinch",function(t){var e=!1;e=n.emit("wantsGesture","pinch",t.pointers,t.isFinal),e&&t.preventDefault(),e=n.emit("wantsPinchGesture",t.scale,t.state.fov,t.isFinal),e&&t.preventDefault(),t.defaultPrevented||(n.emit("gesture","pinch",t.pointers,t.isFinal),n.emit("pinchGesture",t.scale,t.state.fov,t.isFinal))}),n.on("gesture.mousewheel",function(t){var e=!1;e=n.emit("wantsGesture","mouseWheel",t.pointers,t.isFinal),e&&t.preventDefault(),e=n.emit("wantsMouseWheel",t.center.delta,t.state.fov,t.isFinal),e&&t.preventDefault(),t.defaultPrevented||(n.emit("gesture","mouseWheel",t.pointers,t.isFinal),n.emit("mouseWheel",t.center.delta,t.state.fov,t.isFinal))}),n.on("gesture.mousemove",function(t){var e=!1;e=n.emit("wantsGesture","mouseMove",t.pointers,t.isFinal),e&&t.preventDefault(),t.defaultPrevented||(n.emit("gesture","mouseMove",t.pointers,t.isFinal),e=n.emit("wantsChangeCameraFov",t.state.fov),e&&t.preventDefault())}),n.on("gesture.momentum",function(t){var e=!1;e=n.emit("wantsInteriaPan",t.state),e&&t.preventDefault(),t.defaultPrevented||n.emit("interiaPan",t.state,t.isFinal)}),n.on("camera.update",function(t){n.emit("cameraFovUpdate",t.state.fov,t.userAction),n.emit("cameraDirectionUpdate",t.state,t.userAction);var e=coordinatesToVector(t.state);e.setLength(t.state.distance);var r=t.state.offset.clone().sub(e);n.emit("cameraPositionUpdate",r,t.userAction),n.emit("cameraUpdate",t.state,t.userAction)}),n.on("intersect.update",function(t){if(t.intersection){var e=!1;e=n.emit("wantsShowIntersectionOnModel",t.raycaster),e&&t.preventDefault(),t.defaultPrevented||n.emit("intersectionOnModelUpdate",t.intersection,t.object)}else n.emit("intersectionHidden")}),n.on("pano.request",function(t){var e=n.emit("wantsMoveToPano",t.state.panoIndex,t.options,t.userAction);e||(e=n.emit("wantsToMoveToPano",t.state.panoIndex,t.options,t.userAction)),e&&t.preventDefault(),t.defaultPrevented||n.emit("panoWillLoad",t.state.panoIndex)}),n.on("pano.select",function(t){n.emit("panoSelected",t.state.panoIndex)}),n.on("pano.moveTo",function(t){n.emit("panoLoaded",t.state.panoIndex),n.emit("moveToPano",t.state.panoIndex,t.userAction),n.emit("panoWillArrive",t.state.panoIndex,t.state,t.userAction)}),n.on("pano.moving",function(t){n.emit("movingToPano",t.state.panoIndex,t.prevPano.panoIndex,t.progress)}),n.on("pano.arrived",function(t){n.emit("panoArrived",t.state.panoIndex,t.state,t.userAction)}),n.on("pano.cancel",function(t){n.emit("moveToPanoCanceled",t.state.panoIndex)}),n.on("pano.error",function(t){n.emit("panoLoadError",t.error,t.state.panoIndex)}),n.on("pano.texture.load",function(t){n.emit("textureStartLoad",t.pano.panoIndex)}),n.on("pano.texture.success",function(t){n.emit("textureLoaded",t.pano.panoIndex,t.meta)}),n.on("pano.texture.error",function(t){n.emit("textureError",t.error,t.pano.panoIndex)}),n.on("pano.texture.abort",function(t){n.emit("textureAbort",t.pano.panoIndex)}),n.on("pano.texture.progress",function(t){n.emit("textureLoading",t.progress,t.pano.panoIndex)}),n.on("xr.session.start",function(t){n.emit("webXRSessionStart")}),n.on("xr.session.end",function(t){n.emit("webXRSessionEnd")}),n.on("xr.gesture.tap",function(t){n.emit("webXRControllerEvent","tap",t.buttons,{raycaster:t.controllers.raycaster})}),n.on("xr.gesture.press",function(t){n.emit("webXRControllerEvent","press",t.buttons,{raycaster:t.controllers.raycaster})}),n.on("xr.gesture.buttonUp",function(t){n.emit("webXRControllerEvent","buttonUp",t.buttons,{raycaster:t.controllers.raycaster})}),n.on("xr.gesture.buttonDown",function(t){n.emit("webXRControllerEvent","buttonDown",t.buttons,{raycaster:t.controllers.raycaster})}),n.on("xr.controller.update",function(t){n.emit("webXRControllerRayUpdate",{leftRay:t.left?t.left.raycaster:void 0,rightRay:t.right?t.right.raycaster:void 0}),t.left&&n.emit("webXRAxesUpdate","left",{raycaster:{leftRay:t.left?t.left.raycaster:void 0,rightRay:t.right?t.right.raycaster:void 0},axesState:{up:t.left.axes.up,down:t.left.axes.down,left:t.left.axes.left,right:t.left.axes.right},deltaTime:t.left.deltaTime}),t.right&&n.emit("webXRAxesUpdate","right",{raycaster:{leftRay:t.left?t.left.raycaster:void 0,rightRay:t.right?t.right.raycaster:void 0},axesState:{up:t.right.axes.up,down:t.right.axes.down,left:t.right.axes.left,right:t.right.axes.right},deltaTime:t.right.deltaTime})}),n.on("works.request",function(t){n.emit("willLoad",t.input,t.works[0],t.state)}),n.on("works.load",function(t){n.emit("load",t.input,t.works[0],t.state)}),n.on("works.ready",function(t){n.emit("loaded",t.input,t.works[0])}),n.on("state.change",function(t){n.emit("stateChange",t.state,t.userAction)}),n.on("currentState.change",function(t){n.emit("currentStateChange",t.state,t.userAction)}),n.on("state.set",function(t){n.emit("setState",t.state)}),n.on("state.synced",function(t){n.emit("stateSynced",t.state)}),n.on("model.request",function(t){n.emit("modelWillLoad",t.work.model)}),n.on("model.error",function(t){n.emit("modelLoadError",t.error,t.model)}),n.on("model.load",function(t){n.emit("modelLoaded",t.model)}),n.on("model.changeShownFloor",function(t){n.emit("modelShownFloorChange",t.model.shownFloor,t.model.floorLength)}),n.on("render",function(t){n.emit("renderFrame",t.needsRender)}),n.on("mode.change.request",function(t){n.emit("wantsChangeMode",t.mode,t.prevMode)}),n.on("mode.change",function(t){n.emit("modeChange",t.mode,t.prevMode,t.state.panoIndex,t.state,t.userAction)}),n.on("helpers.visible",function(t){n.emit("helpersVisibleChange",t.object.visible)}),n.on("network.resource",function(t){n.emit("network",t.source,t.requestType,t.requestState,t.detail)})}function generateDefaultVideoElement(){if(typeof window!="undefined"){var n=document.createElement("video");n.loop=!0,n.autoplay=!0,n.playsInline=!0,n.muted=!0,n.crossOrigin="";var t=function(){document.removeEventListener("touchstart",t,!1),document.removeEventListener("mousedown",t,!1),n.muted=!1};return document.addEventListener("touchstart",t,!1),document.addEventListener("mousedown",t,!1),n}else return{}}function initLights(n){{var t=new THREE__namespace.DirectionalLight(16777215,.3);t.position.copy(new THREE__namespace.Vector3(1,1,1)),n.add(t)}{var t=new THREE__namespace.DirectionalLight(16777215,.1);t.position.copy(new THREE__namespace.Vector3(-1,-1,-1)),n.add(t)}{var t=new THREE__namespace.DirectionalLight(16777215,.1);n.add(t)}{var t=new THREE__namespace.AmbientLight(16777215,.6);n.add(t)}}function parseKeyValue(n){for(var t,e,r={},i=n.split(/(\;|\,)/),o=0,s=i;o<s.length;o++){var u=s[o],c=u.split("="),l=(t=c[0])===null||t===void 0?void 0:t.trim(),d=(e=c[1])===null||e===void 0?void 0:e.trim();l&&d&&(r[l]=d)}return r}function getViewportScale(){var n;if(typeof document!="undefined")for(var t=document.getElementsByTagName("meta"),e=0;e<t.length;e++){var r=t[e];if(r.getAttribute("name")==="viewport"){var i=parseKeyValue((n=r.getAttribute("content"))!==null&&n!==void 0?n:""),o=Number(i["initial-scale"]);if(!isNaN(o))return o}}return 1}const textureURL="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAV8AAAA/CAQAAADtPwPkAAAR+0lEQVR4AezYg3LEQACH8d1cbdu23Q5qG9G47z/TN/h6tn2b/H+TUTLc7yjcOXV46OUAnUs6EbUp022ZBXc1NhoZYYd7fjDRvdcHAwrlK2QBVJ4sgoqONmY45RUT23sZ6H42F2hK5CtkMbjhZlDmUUcvq1zyieUVyjbE4I1GBfItwxG56YaUZTQwyh4P6NgJ4YYYvCuQb5kOyI03pORjiqe4Lwpq5pt1vJqfUwKWJVbSMYfppYconG+maNNQOWBZuwHTzicGel75NtFOkxr5apmV8cikcko0DrDQs863AeGl0cE0+1xy573m0/wf0cEKW6H7BWtggiMG8sy3oHRDpJMw4NWb6am/bv9znkqEzjd61t5oo5clTrjhwevO75EJRBKSRt745Z16ZEjcM73sccZplBPm8PyTcxZAkSRdHm/acJ0Z3JZhHB0BxqDHgWFZFmm0ZbCw87twI/zc3e/Cz93vPneXtU/WdQS3oTviXdY/q5PsJKfoGuQjZuO/0in1qsj85cuXrxqeAOJpGqdJOqrUutgVl2Qb0BWqp/RE8AWWVB7t2KrIzY2Wx2fWKl7yfswgxqj8lYummYa3hfwF9MuQRmbfQE4ocPDjtUWQ6Tq1M2w7gC2EcrMGtWS6xlpGKEDDcb1vUQ25zT4lrC2s0dU4gFPppKkbeIYr7NMpqjStuFg5rNU9epGyt8PXyfX4DE1bKLhR/1XPxwJhp5DAV67T9ZPwFdovhBMIGUYoRBN4wim6S3eoXVEHXdLgmwY0x6BQnO4xPJ0Ar5OVxhQF0L9UslRM4yaQQfQImnBegi8vhY2A1k6YLlrj61TwDdNQnIISwiPvpD7TwYQTssZXK47vg8y9Gp2nxRcATkozOEmdCeObSt3IIo+xf/00IDRKAaZ89PBTkHqpkA5LagKeNZKlIhqX8RcQ95GHtdYA62Y6rOg5LLsOSnoyvk4V38hFhytef+V9/3DER1P48W89o1GxE9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SAClmEaYhqhdit89QC7niSbCEM2sdkBuHYxQg9ri5ZjkuhI6DMP+J7cTvEtokEx0aPscyddoFJKpSZqV7G1GTxcpmEthpnw5058c6GfwqpwzGOtGjXSJI3FLYhc+O+jSr9aGhPWQlRshS8AticLX7wnsgbXxt6gsWCpRBa0vRGQM8oB9dhmP3QAwFX4c079dJNq6Qi5xbuyTmpPSJ1Ur4UtF7GoTtmUL3zxaWqMU8P/k3cXSQ1EQRjHGdzdHTa4u7tzBs7CedhykNwF2/5jq56iU11db6Lv2yTj8hs3JoiU9sZZp5/62J5v1z9NjrDHaSbnbFMf52sHrDUVaidDxNG0o9+uLjfosfdb3jT5d5j757riJgst9NIZQ2Pn+ySZll80vjI6Wz/hQJG4vPG0L/H6poQch/dW3vL3B0u8jl0HvVj5PvHCElEF8DUAFikVYTcvmfBdDzQlvvMXSV5lP5zrXj/fJ54zuWaeeuoqkW8AwCIaqeTZKkmYrpPwR2eqN9X72W7EG57vU67OBeuMV8KXLUzv93UTTj42tvaFS++GVsc5JRyLSLJ8nzO555hFBmiSRCqMr4GwrcmGkib5xSvcwmzFK6e8s7DMa2xH4YZdZumSOwsVzFeBWdr37tpIhOpSwXqONNgZq/2KgvBt54znHN1HzlljTO4oVD5fb+prNIJXQNL1ofDKQisbPLJDv3jNSLq9OkYBEIihKIj3v7S1TRQCX5Kdl1ZQlol7LF+E++fwirfiq2sf4cTXxc6hzxffPuLEeqSWrPGWMF58TWr5viyJAP5/4EV4KePiaSE8eNRgjDy8/tyRW+FZjhS+2tlovNJovtJovNJ0uhK6Wo64SDdxEbM//KesjwAAAABJRU5ErkJggg==";var imageSize=[351,63],imageOffset=[20,20],vertices=new Float32Array([-.5,-.5,0,.5,-.5,0,-.5,.5,0,.5,.5,0]),uvs=new Float32Array([0,0,1,0,0,1,1,1]),index=new Uint8Array([0,1,2,1,3,2]),geometry=new THREE__namespace.BufferGeometry;geometry.setAttribute("position",new THREE__namespace.BufferAttribute(vertices,3)),geometry.setAttribute("uv",new THREE__namespace.BufferAttribute(uvs,2)),geometry.setIndex(new THREE__namespace.BufferAttribute(index,1));var material=new THREE__namespace.MeshBasicMaterial({transparent:!0,depthTest:!1,depthWrite:!1,stencilWrite:!1,fog:!1}),mesh=new THREE__namespace.Mesh(geometry,material);mesh.matrixAutoUpdate=!1;var scene=new THREE__namespace.Scene;scene.add(mesh),scene.matrixAutoUpdate=!1;var camera=new THREE__namespace.OrthographicCamera(-.5,.5,.5,-.5,.1,1);camera.position.set(0,0,.5),camera.lookAt(0,0,0),camera.updateMatrixWorld(!0),camera.matrixAutoUpdate=!1;var prevViewport=new THREE__namespace.Vector4,prevScissor=new THREE__namespace.Vector4;function renderPoweredByRealsee(n){if(material.map){var r=n.getViewport(prevViewport),i=n.getScissor(prevScissor),o=n.getScissorTest(),s=n.autoClear,u=i.x+imageOffset[0]/3,c=i.y+imageOffset[1]/3,l=imageSize[0]/3,d=imageSize[1]/3;n.setViewport(u,c,l,d),n.setScissor(u,c,l,d),n.setScissorTest(!0),n.autoClear=!1,n.render(scene,camera),n.setViewport(r),n.setScissor(i),n.setScissorTest(o),n.autoClear=s}else{var t=new THREE__namespace.Texture,e=new Image;e.onload=function(){t.image=e,t.wrapS=THREE__namespace.ClampToEdgeWrapping,t.wrapT=THREE__namespace.ClampToEdgeWrapping,t.minFilter=THREE__namespace.LinearFilter,t.needsUpdate=!0,t.generateMipmaps=!1,material.needsUpdate=!0,e.onload=noop$1},e.src=textureURL,material.map=t}}var DEFAULT_MODE_CHANGE_DURATION=800,DEFAULT_CAMERA_FOV=90,DEFAULT_REQUEST_PROXY=function(n){return n.replace("//vrlab-public.ljcdn.com/","//vr-public.realsee-cdn.cn/").replace("//vrlab-image4.ljcdn.com/","//vr-image-4.realsee-cdn.cn/").replace("//vrlab-image3.ljcdn.com/","//vr-image-3.realsee-cdn.cn/").replace("//vrlab-image2.ljcdn.com/","//vr-image-2.realsee-cdn.cn/").replace("//vrlab-image1.ljcdn.com/","//vr-image-1.realsee-cdn.cn/")},sharedVector2=new THREE__namespace.Vector2,sharedFrustum=new THREE__namespace.Frustum,sharedProjScreenMatrix=new THREE__namespace.Matrix4,clockForMixer=new WeakMap,worksMap=new WeakMap,emptyWorks=createWorks([]),Five=function(n){__extends(t,n);function t(e){e===void 0&&(e={});var r,i,o,s,u,c,l,d,f,v,A,h=n.call(this)||this;if(h.ident=createUuid(),typeof window!="undefined"&&(__FIVE_DEBUG__.instances[h.ident]=h),h.renderSwitch01=0,h.currentMode="Panorama",h.pano={workCode:"",panoIndex:0},h.needsRender=!1,h.modelSceneNeedsRender=!1,h.onlyRenderIfNeeds=(r=e.onlyRenderIfNeeds)!==null&&r!==void 0?r:!0,h.imageOptions=__assign({},(i=e.imageOptions)!==null&&i!==void 0?i:{}),h.textureOptions=__assign({},(o=e.textureOptions)!==null&&o!==void 0?o:{}),h.poweredByRealsee=(s=e.poweredByRealsee)!==null&&s!==void 0?s:!0,h.extraElements=[],h.controllerInits={Panorama:Object.assign({},e.panorama),Model:Object.assign({},e.model),Floorplan:Object.assign({},e.floorplan),Topview:Object.assign({},e.topview),Mapview:Object.assign({},e.mapview),VRPanorama:Object.assign({},e.vrPanorama),XRPanorama:Object.assign({},e.xrPanorama)},h.fps={testCount:0,testTime:now()},h.info=null,h.modeChangeDuration=(u=e.modeChangeDuration)!==null&&u!==void 0?u:DEFAULT_MODE_CHANGE_DURATION,h.enableWheel=(c=e.enableWheel)!==null&&c!==void 0?c:!0,typeof window!="undefined")if("renderer"in e)e.renderer instanceof InternalWebGLRenderer&&h.throwError(new Error("cannot render a internal renderer")),h.renderer=e.renderer;else try{h.renderer=new InternalWebGLRenderer({preserveDrawingBuffer:e.preserveDrawingBuffer,backgroundColor:e.backgroundColor,backgroundAlpha:e.backgroundAlpha,antialias:e.antialias,webgl2:e.webgl2,logarithmicDepthBuffer:e.logarithmicDepthBuffer,precision:e.precision});var p=getViewportScale();h.renderer.setPixelRatio(p===1?window.devicePixelRatio:1),h.renderer.setSize(512,512)}catch(I){I instanceof Error&&h.throwError(I)}h.getPixelsRenderTarget=new THREE__namespace.WebGLRenderTarget(1,1,{encoding:(d=(l=h.renderer)===null||l===void 0?void 0:l.outputEncoding)!==null&&d!==void 0?d:THREE__namespace.sRGBEncoding,generateMipmaps:!1});var y=new THREE__namespace.DepthTexture(1,1);y.generateMipmaps=!1,y.format=THREE__namespace.DepthStencilFormat,y.type=THREE__namespace.UnsignedInt248Type,h.modelRenderTarget=new THREE__namespace.WebGLRenderTarget(1,1,{encoding:(v=(f=h.renderer)===null||f===void 0?void 0:f.outputEncoding)!==null&&v!==void 0?v:THREE__namespace.sRGBEncoding,depthTexture:y,generateMipmaps:!1,depthBuffer:!0,stencilBuffer:!0}),h.scissor=Object.assign({left:0,bottom:0,width:1,height:1},e.scissor),h.camera=new Camera(DEFAULT_CAMERA_FOV),h.scene=new Scene,h.xrCustomObjectsScene=new THREE__namespace.Scene,h.scene.add(h.xrCustomObjectsScene),h.scene.matrixAutoUpdate=!1,h.lastLoadWorkTask=Promise.resolve(),h.requestProxy=(A=e.requestProxy)!==null&&A!==void 0?A:DEFAULT_REQUEST_PROXY,h.networkSubscribe=new NetworkSubscribe,h.networkSubscribe.on("network",function(I,x,M,L){var C;h.emit("network.resource",createEvent("network.resource",{source:I,requestType:x,requestState:M,detail:L})),(C=h.analysis)===null||C===void 0||C.network(h.works,I,x,M,L)}),h.boundingMesh=generateBoundingMesh(new THREE__namespace.Box3(new THREE__namespace.Vector3(-.5,-.5,-.5),new THREE__namespace.Vector3(.5,.5,.5))),h.boundingMesh.name="bounding",h.models=createModels(),h.models.push(new Model),h.lastModels=createModels(),h.lastWorks=createWorks([]),h.readyCallbacks=[],h.syncingState=!1,h.helperGroup=new THREE__namespace.Group,h.helperGroup.name="helper",h.helperGroup.matrixAutoUpdate=!1,h.scene.add(h.helperGroup),h.modelGroup=new THREE__namespace.Group,h.modelGroup.visible=!1,h.modelGroup.name="model",h.modelGroup.matrixAutoUpdate=!1,h.modelScene=new THREE__namespace.Scene,h.modelScene.add(h.modelGroup),h.modelScene.add(h.boundingMesh),h.modelScene.matrixAutoUpdate=!1,h.videoTexture=new THREE__namespace.VideoTexture(e.videoInstance||generateDefaultVideoElement()),initLights(h.scene),initLights(h.modelScene),h.state={mode:h.currentMode,workCode:h.pano.workCode,panoIndex:h.pano.panoIndex,longitude:h.camera.pose.longitude,latitude:h.camera.pose.latitude,fov:h.camera.pose.fov,offset:h.camera.pose.offset.clone(),distance:h.camera.pose.distance},h.stateSynced=!1,h._enablePostProcessing=!1,h._enableIOSEDR=!1,h._enableEDL=!1,h._enableHQ=!1,h.destroyed=!1,h.paused=!0,typeof window!="undefined"&&(e.play!==!1&&h.play(),h.stopAnimationLoop=AnimationFrameLoop.shared.add(function(I,x){for(var M=[],L=2;L<arguments.length;L++)M[L-2]=arguments[L];h.updateTime.apply(h,__spreadArray([I,x],M,!1))},!1,0,10));var m=function(){typeof document!="undefined"&&document.fullscreenElement===null&&h.currentMode==="VRPanorama"&&h.controller.emit("vr.requestExit",createEvent("vr.requestExit",{}))},g=function(){h.needsRender=!0,h.modelSceneNeedsRender=!0};if(typeof document!="undefined"&&document.addEventListener("fullscreenchange",m,!1),h.renderer&&h.renderer.domElement.addEventListener("webglcontextrestored",g,!1),h.removeEventListeners=function(){typeof document!="undefined"&&document.removeEventListener("fullscreenchange",m,!1),h.renderer&&h.renderer.domElement.removeEventListener("webglcontextrestored",g,!1)},h.plugins={},e.plugins&&e.plugins.length)for(var E=0,b=e.plugins;E<b.length;E++){var T=b[E];if(typeof T=="function")T(h);else if(Array.isArray(T)){var _=T[0],S=T[1],R=T[2];if(typeof _=="function"){var B=_(h,R);typeof S=="string"&&(h.plugins[S]?h.throwError(new Error("plugin name ".concat(S," is exists."))):h.plugins[S]=B)}}}return h.gpuPickingRenderTarget=new THREE__namespace.WebGLRenderTarget(1,1,{generateMipmaps:!1}),h.meshReplaceMaterialMap=new Map,h.meshOriginMaterialMap=new Map,initLegacyEvent(h),h}return Object.defineProperty(t,"version",{get:function(){return"6.2.3"},enumerable:!1,configurable:!0}),Object.defineProperty(t,"dracoPath",{get:function(){return draco.decoderPath},set:function(e){draco.setDecoderPath(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t,"ktx2Path",{get:function(){return ktx2.transcoderPath},set:function(e){ktx2.setTranscoderPath(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"panoIndex",{get:function(){return this.pano.panoIndex},enumerable:!1,configurable:!0}),t.prototype.getGPUPicking=function(e,r,i,o,s){var u=this;if(o===void 0&&(o=1),s===void 0&&(s=new THREE__namespace.Vector3(0,0,0)),!this.renderer)throw new Error("renderer is not initialized.");this.models.setMaterial({constantColor:s}),this.scene.traverse(function(f){if(!(!(f instanceof THREE__namespace.Mesh)||f instanceof PBMMesh)){var v=Object.keys(i).filter(function(h){return h===f.uuid})[0];if(v)if(u.meshOriginMaterialMap.set(v,f.material),u.meshReplaceMaterialMap.get(v))f.material=u.meshReplaceMaterialMap.get(v);else{var A=new THREE__namespace.ShaderMaterial({uniforms:{color:{value:i[v]}},vertexShader:`
2061
+ `},LineMaterial=function(n){__extends(t,n);function t(e){var r=n.call(this,{uniforms:THREE__namespace.UniformsUtils.clone(lineShader.uniforms),vertexShader:lineShader.vertexShader,fragmentShader:lineShader.fragmentShader,clipping:!0})||this;return r.type="LineMaterial",r.dashed=!1,Object.defineProperties(r,{color:{enumerable:!0,get:function(){return this.uniforms.diffuse.value},set:function(i){this.uniforms.diffuse.value=i}},linewidth:{enumerable:!0,get:function(){return this.uniforms.linewidth.value},set:function(i){this.uniforms.linewidth.value=i}},dashScale:{enumerable:!0,get:function(){return this.uniforms.dashScale.value},set:function(i){this.uniforms.dashScale.value=i}},dashSize:{enumerable:!0,get:function(){return this.uniforms.dashSize.value},set:function(i){this.uniforms.dashSize.value=i}},gapSize:{enumerable:!0,get:function(){return this.uniforms.gapSize.value},set:function(i){this.uniforms.gapSize.value=i}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(i){this.uniforms.opacity.value=i}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(i){this.uniforms.resolution.value.copy(i)}}}),r.setValues(e),r}return t}(THREE__namespace.ShaderMaterial);Object.assign(LineMaterial.prototype,{isLineMaterial:!0});var LineSegments2=function(n){__extends(t,n);function t(e,r){var i=n.call(this)||this;return i.type="LineSegments2",i.geometry=e!==void 0?e:new LineSegmentsGeometry,i.material=r!==void 0?r:new LineMaterial({color:Math.random()*16777215}),i}return t.prototype.computeLineDistances=function(){for(var e=this.geometry,r=e.attributes.instanceStart,i=e.attributes.instanceEnd,o=new Float32Array(2*r.count),s=new THREE__namespace.Vector3,u=new THREE__namespace.Vector3,c=0,l=0,d=r.count;c<d;c++,l+=2)s.fromBufferAttribute(r,c),u.fromBufferAttribute(i,c),o[l]=l===0?0:o[l-1],o[l+1]=o[l]+s.distanceTo(u);var f=new THREE__namespace.InstancedInterleavedBuffer(o,2,1);return e.setAttribute("instanceDistanceStart",new THREE__namespace.InterleavedBufferAttribute(f,1,0)),e.setAttribute("instanceDistanceEnd",new THREE__namespace.InterleavedBufferAttribute(f,1,1)),this},t.prototype.raycast=function(e,r){e.camera===null&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2.');var i=e.ray,o=e.camera,s=o.projectionMatrix,u=this.geometry,c=this.material,l=c.resolution,d=c.linewidth,f=u.attributes.instanceStart,v=u.attributes.instanceEnd,A=new THREE__namespace.Vector4,h=new THREE__namespace.Vector4,p=new THREE__namespace.Vector4,y=new THREE__namespace.Vector3,m=new THREE__namespace.Matrix4,g=new THREE__namespace.Line3,E=new THREE__namespace.Vector3;i.at(1,p),p.w=1,p.applyMatrix4(o.matrixWorldInverse),p.applyMatrix4(s),p.multiplyScalar(1/p.w),p.x*=l.x/2,p.y*=l.y/2,p.z=0,y.copy(p);var b=this.matrixWorld;m.multiplyMatrices(o.matrixWorldInverse,b);for(var T=0,_=f.count;T<_;T++){A.fromBufferAttribute(f,T),h.fromBufferAttribute(v,T),A.w=1,h.w=1,A.applyMatrix4(m),h.applyMatrix4(m),A.applyMatrix4(s),h.applyMatrix4(s),A.multiplyScalar(1/A.w),h.multiplyScalar(1/h.w);var S=A.z<-1&&h.z<-1,R=A.z>1&&h.z>1;if(!(S||R)){A.x*=l.x/2,A.y*=l.y/2,h.x*=l.x/2,h.y*=l.y/2,g.start.copy(A),g.start.z=0,g.end.copy(h),g.end.z=0;var B=g.closestPointToPointParameter(y,!0);g.at(B,E);var I=THREE__namespace.MathUtils.lerp(A.z,h.z,B),x=I>=-1&&I<=1,M=y.distanceTo(E)<d*.5;if(x&&M){g.start.fromBufferAttribute(f,T),g.end.fromBufferAttribute(v,T),g.start.applyMatrix4(b),g.end.applyMatrix4(b);var L=new THREE__namespace.Vector3,C=new THREE__namespace.Vector3;i.distanceSqToSegment(g.start,g.end,C,L),r.push({point:C,pointOnLine:L,distance:i.origin.distanceTo(C),object:this,faceIndex:T})}}}},t}(THREE__namespace.Mesh);Object.assign(LineSegments2.prototype,{isLineSegments2:!0});var Line2=function(n){__extends(t,n);function t(e,r){var i=n.call(this,e,r)||this;return i.type="Line2",i}return t}(LineSegments2);Object.assign(Line2.prototype,{isLine2:!0});var LineGeometry=function(n){__extends(t,n);function t(){var e=n.call(this)||this;return e.type="LineGeometry",e}return t.prototype.setPositions=function(e){for(var r=e.length-3,i=new Float32Array(2*r),o=0;o<r;o+=3)i[2*o]=e[o],i[2*o+1]=e[o+1],i[2*o+2]=e[o+2],i[2*o+3]=e[o+3],i[2*o+4]=e[o+4],i[2*o+5]=e[o+5];return n.prototype.setPositions.call(this,i),this},t.prototype.setColors=function(e){for(var r=e.length-3,i=new Float32Array(2*r),o=0;o<r;o+=3)i[2*o]=e[o],i[2*o+1]=e[o+1],i[2*o+2]=e[o+2],i[2*o+3]=e[o+3],i[2*o+4]=e[o+4],i[2*o+5]=e[o+5];return n.prototype.setColors.call(this,i),this},t.prototype.fromLine=function(e){var r=e.geometry;if(r instanceof THREE__namespace.Geometry){var i=new THREE__namespace.BufferGeometry().fromGeometry(r);this.setPositions(i.attributes.position.array)}else r instanceof THREE__namespace.BufferGeometry&&this.setPositions(r.attributes.position.array);return this},t.prototype.copy=function(){return this},t}(LineSegmentsGeometry);Object.assign(LineGeometry.prototype,{isLineGeometry:!0});var circleImageURL="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAAZiS0dEAAAAAAAA+UO7fwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sHDgwCEMBJZu0AAAAdaVRYdENvbW1lbnQAAAAAAENyZWF0ZWQgd2l0aCBHSU1QZC5lBwAABM5JREFUWMO1V0tPG2cUPZ4Hxh6DazIOrjFNqJs0FIMqWFgWQkatsmvVbtggKlSVRVf5AWz4AWz4AUSKEChll19QJYSXkECuhFxsHjEhxCYm+DWGMZ5HF72DJq4bAzFXurI0M/I5997v3u9cC65vTJVn2lX/xHINQOYSBLTLEuIuCWw4Z3IGAEvf6ASmVHjNzHCXBG4A0AjACsAOwEbO0nsFQBnAGYASAIl+ZRMR7SolMEdsByD09fV5R0ZGgg8ePPjW5/N1iqLYpuu6RZblciKR2I9Go69evnwZnZ+fjwI4IS8AKBIRzeQfJWCANwKwh0KhtrGxsYehUOin1tbW+zzP23ietzY2NnIAoGmaLsuyUiqVyvl8XtrY2NiamZn589mzZxsAUgCOAeQAnFI2tI+VxIjaAeDzoaGh7xYWFuZOTk6OZVk+12uYqqq6JEnn0Wg0OT4+/geAXwGEAdwDIFJQXC1wO4DWR48e/RCPxxclSSroVzRFUbSDg4P848ePFwH8DuAhkWih83TRQWxFOXgAwvDwcOfo6OhvXV1d39tsNtuVBwTDWBwOh1UUxVsMw1hXVlbSdCgNV43uYSvrHg6H24aHh38eHBz85TrgF9FYLHA4HLzH43FvbW2d7u/vG+dANp8FpqIlbd3d3V8Fg8EfBUFw4BONZVmL3+9vHhkZCQL4AoAHgJPK8G+yzC0XDofdoVAo5PP5vkadTBAEtr+/39ff3x8gAp/RPOEqx2qjx+NpvXv3bk9DQ0NDvQgwDIOWlhZrMBj8kgi0UJdxRgYMArzL5XJ7vd57qLPZ7Xamp6fnNgBXtQxcjFuHw+Hyer3t9SYgCAITCAScAJoBNNEY/08GOFVVrfVMv7kMNDntFD1vjIAPrlRN0xjckOm6biFQ3jwNPwDMZrOnqVTqfb3Bi8Wivru7W/VCYkwPlKOjo0IikXh7EwQikYgE4Nw0CfXKDCipVCoTj8df3QABbW1tLUc6oUgkFPMkVACUNjc337148eKvw8PDbJ2jP1taWkoCyNDVXDSECmNSK4qiKNLq6urW8+fPI/UicHx8rD59+jSVy+WOAKSJhKENwFItLtoxk8mwsixzHR0dHe3t7c5PAU+n09rs7OzJkydPYqVSaQfANoDXALIk31S2smU1TWMPDg7K5XKZ7+3t9TudTut1U7+wsFCcmJiIpdPpbQBxADsAknQWymYCOukBHYCuKApisdhpMpnURFEU79y503TVyKenpzOTk5M7e3t7MQKPV0Zv1gNm+awB0MvlshqLxfLb29uyJElWURSbXC4XXyvqxcXFs6mpqeTc3Nzu3t7e3wQcA7BPZ8Cov1pNlJplmQtAG8MwHV6v95tAINA5MDBwPxAIuLu6upr8fr/VAN3c3JQjkcjZ+vp6fnl5+d2bN29SuVzuNYAEpf01CdRChUL+X1VskHACuA3Ay3Fcu9vt7nA6nZ7m5uYWQRCaNE3jVVW15PP580KhIGUymWw2m00DOAJwSP4WwPtq4LX2Ao6USxNlQyS/RcQcdLGwlNIz6vEMAaZpNzCk2Pll94LK/cDYimxERiBwG10sxjgvEZBE0UpE6vxj+0Ct5bTaXthgEhRmja8QWNkkPGsuIpfdjpkK+cZUWTC0KredVmtD/gdlSl6EG4AMvQAAAABJRU5ErkJggg==",DEFAULT_COLOR=14467195,POINT_SIZE=8,DEFAULT_LINEWIDTH=2,DEFAULT_DASHSCALE=20,sharedCircleTexture=null,FiveLine=function(n){__extends(t,n);function t(e,r){e===void 0&&(e=new THREE__namespace.Vector3),r===void 0&&(r=new THREE__namespace.Vector3);var i=n.call(this)||this;i.type="FiveLine",i.needsRender=!0;var o=new LineGeometry,s=new LineMaterial({color:DEFAULT_COLOR,linewidth:DEFAULT_LINEWIDTH,dashScale:DEFAULT_DASHSCALE,dashed:!1});i.line=new Line2(o,s);var u=new THREE__namespace.BufferGeometry,c=new THREE__namespace.PointsMaterial({color:DEFAULT_COLOR,size:POINT_SIZE,map:sharedCircleTexture||(sharedCircleTexture=new THREE__namespace.TextureLoader().load(circleImageURL)),sizeAttenuation:!1,transparent:!0});return i.points=new THREE__namespace.Points(u,c),i.points.renderOrder=11,i.points.frustumCulled=!1,i.setPoints(e,r),i.add(i.line,i.points),i}return Object.defineProperty(t,"version",{get:function(){return"6.2.5"},enumerable:!1,configurable:!0}),t.prototype.setPoints=function(e,r){var i=[].concat(e.toArray(),r.toArray());this.points.geometry.setAttribute("position",new THREE__namespace.BufferAttribute(new Float32Array(i),3)),this.line.geometry.setPositions(i),this.line.computeLineDistances(),this.needsRender=!0},t.prototype.getPoints=function(){var e=this.points.geometry.attributes.position.array;return[new THREE__namespace.Vector3(e[0],e[1],e[2]),new THREE__namespace.Vector3(e[3],e[4],e[5])]},t.prototype.setMaterial=function(e){var r=this.line.material;for(var i in e)if(e.hasOwnProperty(i)){var o=e[i];i==="dashed"?(r.dashed=o,o?r.defines.USE_DASH="":delete r.defines.USE_DASH,r.needsUpdate=!0):r[i]=e[i]}this.needsRender=!0},t.prototype.setResolution=function(e,r){var i=this.line.material.resolution;(i.x!==e||i.y!==r)&&(i.set(e,r),this.needsRender=!0)},t}(THREE__namespace.Object3D);Object.assign(FiveLine.prototype,{isFiveLine:!0});var Constants={Handedness:Object.freeze({NONE:"none",LEFT:"left",RIGHT:"right"}),ComponentState:Object.freeze({DEFAULT:"default",TOUCHED:"touched",PRESSED:"pressed"}),ComponentProperty:Object.freeze({BUTTON:"button",X_AXIS:"xAxis",Y_AXIS:"yAxis",STATE:"state"}),ComponentType:Object.freeze({TRIGGER:"trigger",SQUEEZE:"squeeze",TOUCHPAD:"touchpad",THUMBSTICK:"thumbstick",BUTTON:"button"}),ButtonTouchThreshold:.05,AxisTouchThreshold:.1,VisualResponseProperty:Object.freeze({TRANSFORM:"transform",VISIBILITY:"visibility"})};function fetchJsonFile(n){return __awaiter(this,void 0,void 0,function(){var t;return __generator(this,function(e){switch(e.label){case 0:return[4,fetch(n)];case 1:if(t=e.sent(),t.ok)return[2,t.json()];throw new Error(t.statusText)}})})}function fetchProfilesList(n){return __awaiter(this,void 0,void 0,function(){var t,e;return __generator(this,function(r){switch(r.label){case 0:if(!n)throw new Error("No basePath supplied");return t="profilesList.json",[4,fetchJsonFile("".concat(n,"/").concat(t))];case 1:return e=r.sent(),[2,e]}})})}function fetchProfile(n,t){return __awaiter(this,arguments,void 0,function(e,r,i,o){var s,u,c,l,d,f;return i===void 0&&(i=null),o===void 0&&(o=!0),__generator(this,function(v){switch(v.label){case 0:if(!e)throw new Error("No xrInputSource supplied");if(!r)throw new Error("No basePath supplied");return[4,fetchProfilesList(r)];case 1:if(s=v.sent(),e.profiles.some(function(A){var h=s[A];return h&&(u={profileId:A,profilePath:"".concat(r,"/").concat(h.path),deprecated:!!h.deprecated}),!!u}),!u){if(!i)throw new Error("No matching profile name found");if(c=s[i],!c)throw new Error('No matching profile name found and default profile "'.concat(i,'" missing.'));u={profileId:i,profilePath:"".concat(r,"/").concat(c.path),deprecated:!!c.deprecated}}return[4,fetchJsonFile(u.profilePath)];case 2:if(l=v.sent(),o){if(f=void 0,f=l.layouts[e.handedness],!f)throw new Error("No matching handedness, ".concat(e.handedness,", in profile ").concat(u.profileId));f.assetPath&&(d=u.profilePath.replace("profile.json",f.assetPath))}return[2,{profile:l,assetPath:d}]}})})}var defaultComponentValues={xAxis:0,yAxis:0,button:0,state:Constants.ComponentState.DEFAULT};function normalizeAxes(n,t){n===void 0&&(n=0),t===void 0&&(t=0);var e=n,r=t,i=Math.sqrt(n*n+t*t);if(i>1){var o=Math.atan2(t,n);e=Math.cos(o),r=Math.sin(o)}var s={normalizedXAxis:e*.5+.5,normalizedYAxis:r*.5+.5};return s}var VisualResponse=function(){function n(t){this.componentProperty=t.componentProperty,this.states=t.states,this.valueNodeName=t.valueNodeName,this.valueNodeProperty=t.valueNodeProperty,this.valueNodeProperty===Constants.VisualResponseProperty.TRANSFORM&&(this.minNodeName=t.minNodeName,this.maxNodeName=t.maxNodeName),this.value=0,this.updateFromComponent(defaultComponentValues)}return n.prototype.updateFromComponent=function(t){var e=t.xAxis,r=t.yAxis,i=t.button,o=t.state,s=normalizeAxes(e,r),u=s.normalizedXAxis,c=s.normalizedYAxis;switch(this.componentProperty){case Constants.ComponentProperty.X_AXIS:this.value=this.states.includes(o)?u:.5;break;case Constants.ComponentProperty.Y_AXIS:this.value=this.states.includes(o)?c:.5;break;case Constants.ComponentProperty.BUTTON:this.value=this.states.includes(o)?i:0;break;case Constants.ComponentProperty.STATE:this.valueNodeProperty===Constants.VisualResponseProperty.VISIBILITY?this.value=this.states.includes(o):this.value=this.states.includes(o)?1:0;break;default:throw new Error("Unexpected visualResponse componentProperty ".concat(this.componentProperty))}},n}(),Component=function(){function n(t,e){var r=this;if(!t||!e||!e.visualResponses||!e.gamepadIndices||Object.keys(e.gamepadIndices).length===0)throw new Error("Invalid arguments supplied");this.id=t,this.type=e.type,this.rootNodeName=e.rootNodeName,this.touchPointNodeName=e.touchPointNodeName,this.visualResponses={},Object.keys(e.visualResponses).forEach(function(i){var o=new VisualResponse(e.visualResponses[i]);r.visualResponses[i]=o}),this.gamepadIndices=Object.assign({},e.gamepadIndices),this.values={state:Constants.ComponentState.DEFAULT,button:this.gamepadIndices.button!==void 0?0:void 0,xAxis:this.gamepadIndices.xAxis!==void 0?0:void 0,yAxis:this.gamepadIndices.yAxis!==void 0?0:void 0}}return Object.defineProperty(n.prototype,"data",{get:function(){var t=__assign({id:this.id},this.values);return t},enumerable:!1,configurable:!0}),n.prototype.updateFromGamepad=function(t){var e=this;if(this.values.state=Constants.ComponentState.DEFAULT,this.gamepadIndices.button!==void 0&&t.buttons.length>this.gamepadIndices.button){var r=t.buttons[this.gamepadIndices.button];this.values.button=r.value,this.values.button=this.values.button<0?0:this.values.button,this.values.button=this.values.button>1?1:this.values.button,r.pressed||this.values.button===1?this.values.state=Constants.ComponentState.PRESSED:(r.touched||this.values.button>Constants.ButtonTouchThreshold)&&(this.values.state=Constants.ComponentState.TOUCHED)}this.gamepadIndices.xAxis!==void 0&&t.axes.length>this.gamepadIndices.xAxis&&(this.values.xAxis=t.axes[this.gamepadIndices.xAxis],this.values.xAxis=this.values.xAxis<-1?-1:this.values.xAxis,this.values.xAxis=this.values.xAxis>1?1:this.values.xAxis,this.values.state===Constants.ComponentState.DEFAULT&&Math.abs(this.values.xAxis)>Constants.AxisTouchThreshold&&(this.values.state=Constants.ComponentState.TOUCHED)),this.gamepadIndices.yAxis!==void 0&&t.axes.length>this.gamepadIndices.yAxis&&(this.values.yAxis=t.axes[this.gamepadIndices.yAxis],this.values.yAxis=this.values.yAxis<-1?-1:this.values.yAxis,this.values.yAxis=this.values.yAxis>1?1:this.values.yAxis,this.values.state===Constants.ComponentState.DEFAULT&&Math.abs(this.values.yAxis)>Constants.AxisTouchThreshold&&(this.values.state=Constants.ComponentState.TOUCHED)),Object.values(this.visualResponses).forEach(function(i){i.updateFromComponent(e.values)})},n}(),MotionController=function(){function n(t,e,r){var i=this;if(!t)throw new Error("No xrInputSource supplied");if(!e)throw new Error("No profile supplied");this.xrInputSource=t,this.assetUrl=r,this.id=e.profileId,this.layoutDescription=e.layouts[t.handedness],this.components={},Object.keys(this.layoutDescription.components).forEach(function(o){var s=i.layoutDescription.components[o];i.components[o]=new Component(o,s)}),this.updateFromGamepad()}return Object.defineProperty(n.prototype,"gripSpace",{get:function(){return this.xrInputSource.gripSpace},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"targetRaySpace",{get:function(){return this.xrInputSource.targetRaySpace},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"data",{get:function(){var t=[];return Object.values(this.components).forEach(function(e){t.push(e.data)}),t},enumerable:!1,configurable:!0}),n.prototype.updateFromGamepad=function(){var t=this;Object.values(this.components).forEach(function(e){e.updateFromGamepad(t.xrInputSource.gamepad)})},n}(),DEFAULT_PROFILES_PATH="https://cdn.jsdelivr.net/npm/@webxr-input-profiles/assets@1.0/dist/profiles",DEFAULT_PROFILE="generic-trigger",XRControllerModel=function(n){__extends(t,n);function t(){var e=n.call(this)||this;return e.motionController=null,e.envMap=null,e}return t.prototype.setEnvironmentMap=function(e){var r=this;return this.envMap==e?this:(this.envMap=e,this.traverse(function(i){i instanceof THREE__namespace.Mesh&&i.isMesh&&(i.material.envMap=r.envMap,i.material.needsUpdate=!0)}),this)},t.prototype.updateMatrixWorld=function(e){n.prototype.updateMatrixWorld.call(this,e),this.motionController&&(this.motionController.updateFromGamepad(),Object.values(this.motionController.components).forEach(function(r){Object.values(r.visualResponses).forEach(function(i){var o=i.valueNode,s=i.minNode,u=i.maxNode,c=i.value,l=i.valueNodeProperty;o&&(l===Constants.VisualResponseProperty.VISIBILITY?o.visible=c:l===Constants.VisualResponseProperty.TRANSFORM&&(o.quaternion.copy(s.quaternion).slerp(u.quaternion,c),o.position.lerpVectors(s.position,u.position,c)))})}))},t}(THREE.Object3D);function findNodes(n,t){Object.values(n.components).forEach(function(e){var r=e.type,i=e.touchPointNodeName,o=e.visualResponses;if(r===Constants.ComponentType.TOUCHPAD)if(e.touchPointNode=t.getObjectByName(i),e.touchPointNode){var s=new THREE.SphereGeometry(.001),u=new THREE.MeshBasicMaterial({color:255}),c=new THREE.Mesh(s,u);e.touchPointNode.add(c)}else console.warn("Could not find touch dot, ".concat(e.touchPointNodeName,", in touchpad component ").concat(e.id));Object.values(o).forEach(function(l){var d=l.valueNodeName,f=l.minNodeName,v=l.maxNodeName,A=l.valueNodeProperty;if(A===Constants.VisualResponseProperty.TRANSFORM){if(l.minNode=t.getObjectByName(f),l.maxNode=t.getObjectByName(v),!l.minNode){console.warn("Could not find ".concat(f," in the model"));return}if(!l.maxNode){console.warn("Could not find ".concat(v," in the model"));return}}l.valueNode=t.getObjectByName(d),l.valueNode||console.warn("Could not find ".concat(d," in the model"))})})}function addAssetSceneToControllerModel(n,t){findNodes(n.motionController,t),n.envMap&&t.traverse(function(e){e instanceof THREE__namespace.Mesh&&e.isMesh&&(e.material.envMap=n.envMap,e.material.needsUpdate=!0)}),n.add(t)}var XRControllerModelFactory=function(){function n(t){t===void 0&&(t=null),this.gltfLoader=t,this.path=DEFAULT_PROFILES_PATH,this._assetCache={}}return n.prototype.createControllerModel=function(t){var e=this,r=new XRControllerModel,i=null;return t.addEventListener("connected",function(o){var s=o.data;s.targetRayMode!=="tracked-pointer"||!s.gamepad||fetchProfile(s,e.path,DEFAULT_PROFILE).then(function(u){var c=u.profile,l=u.assetPath;r.motionController=new MotionController(s,c,l);var d=e._assetCache[r.motionController.assetUrl];if(d)i=d.scene.clone(),addAssetSceneToControllerModel(r,i);else{if(!e.gltfLoader)throw new Error("GLTFLoader not set.");e.gltfLoader.load(r.motionController.assetUrl,function(f){e._assetCache[r.motionController.assetUrl]=f,i=f.scene.clone(),addAssetSceneToControllerModel(r,i)})}}).catch(function(u){console.warn(u)})}),t.addEventListener("disconnected",function(){r.motionController=null,r.remove(i),i=null}),r},n}();function mapPanoResource(n,t){return n}var CONTROLLER_EVNET_DELTA_TIME=300,ROTATE_Y_PI_MATRIX=new THREE__namespace.Matrix4().makeRotationAxis(new THREE__namespace.Vector3(0,1,0),Math.PI),PANO_TEXTURE_SCALE=new THREE__namespace.Vector3(-1,1,1),XRPanoramaController=function(n){__extends(t,n);function t(e){var r=n.call(this,e)||this;r.xrManager=new XRManager(r.renderer,r.renderer.getContext(),{onSessionStart:function(c){r.emit("xr.session.start",createEvent("xr.session.start",{session:c,machineType:r.xrManager.machineType}))},onSessionEnd:function(){r.emit("xr.session.end",createEvent("xr.session.end",{session:null,machineType:r.xrManager.machineType}))}}),r.xrControllerRay={left:new THREE__namespace.Raycaster,right:new THREE__namespace.Raycaster},r.xrControllerRay.left.params.Points={threshold:.1},r.xrControllerRay.right.params.Points={threshold:.1},r.gazeRay=null,r.pointerLines={left:new FiveLine,right:new FiveLine},r.pointerLines.left.visible=!1,r.pointerLines.right.visible=!0,r.pointerLines.left.setMaterial({color:new THREE__namespace.Vector3(1,1,1)}),r.pointerLines.left.points.material.depthTest=!1,r.pointerLines.right.setMaterial({color:new THREE__namespace.Vector3(1,1,1)}),r.pointerLines.right.points.material.depthTest=!1,r.controllerWrappers=[new THREE__namespace.Group,new THREE__namespace.Group];var i=r.xrManager.getController(0);r.controllerWrappers[0].add(i);var o=r.xrManager.getController(1);r.controllerWrappers[1].add(o);var s=new XRControllerModelFactory;s.gltfLoader={load:function(c,l){internalFetcher.ajax(c,{responseType:"arraybuffer"}).then(function(d){var f;return parseGltf(d.body,{resourcePath:c.slice(0,c.lastIndexOf("/")+1),search:(f=c.split("?")[1])!==null&&f!==void 0?f:"",fetcher:internalFetcher})}).then(function(d){return l(d)})}},(r.xrManager.machineType==="Oculus"||r.xrManager.machineType==="Pico")&&r.scene.add(r.pointerLines.left,r.pointerLines.right,r.controllerWrappers[0],r.controllerWrappers[1]),r.panoResources={},r.panoResources[r.locationMotion.keyframes[0].key=r.locationMotion.keyframes[1].key=createUuid()]={panoId:panoStringify(r.currentPano),leftPanoPicture:null,position:r.camera.pose.offset.clone(),effect:"fade",fixCameraTransform:new THREE__namespace.Matrix4},r.parallaxCameraMatrixs=[];var u=AnimationFrameLoop.shared.getContext();return u?(r.on("xr.session.end",function(){r.scene.remove(r.pointerLines.left,r.pointerLines.right)}),r.xrManager.setSession(u),r.on("xr.session.start",function(){var c=r.xrManager.getControllerGrip(0);c.add(s.createControllerModel(c)),r.controllerWrappers[0].add(c);var l=r.xrManager.getControllerGrip(1);l.add(s.createControllerModel(l)),r.controllerWrappers[1].add(l)}),r.xrHandleState={LeftAxesUp:{touchStartTime:0,touchStart:!1},LeftAxesDown:{touchStartTime:0,touchStart:!1},LeftAxesLeft:{touchStartTime:0,touchStart:!1},LeftAxesRight:{touchStartTime:0,touchStart:!1},LeftTrigger:{touchStartTime:0,touchStart:!1},LeftPinch:{touchStartTime:0,touchStart:!1},RightAxesUp:{touchStartTime:0,touchStart:!1},RightAxesDown:{touchStartTime:0,touchStart:!1},RightAxesLeft:{touchStartTime:0,touchStart:!1},RightAxesRight:{touchStartTime:0,touchStart:!1},RightTrigger:{touchStartTime:0,touchStart:!1},RightPinch:{touchStartTime:0,touchStart:!1},Y:{touchStartTime:0,touchStart:!1},X:{touchStartTime:0,touchStart:!1},A:{touchStartTime:0,touchStart:!1},B:{touchStartTime:0,touchStart:!1}},r.xrManager.machineType==="VP"&&r.initHandEvent(),r):(console.error("获取session失败,请退出重试"),r)}return t.parseArgs=function(e){if(e instanceof t)return e;var r=__assign(__assign({},e),{maxLatitude:Math.PI/2,minLatitude:-Math.PI/2});return n.parseArgs.call(this,r)},t.initAnimationEndState=function(e){var r=this.parseArgs(e),i=n.initAnimationEndState.call(this,r);return __assign(__assign({},i),{mode:"XRPanorama"})},t.prototype.moveToPano=function(e,r,i){var o=this,s,u,c,l,d=(s=r.effect)!==null&&s!==void 0?s:"fade";this.userAction=i,this.stopMomentumMovement();var f=this.works.getResolvedObserver(e);if(!f)throw new Error("Invalid PanoIndex");var v=getImageSizeFromURL(f.images.up),A=this.imageOptions.size;typeof A=="undefined"&&f&&v&&(A=Number(v)),typeof A=="undefined"&&(A=2048);var h=this.imageOptions.transform,p=function(x,M){return mapPanoResource(applyImageURLOptions(x,h,M))},y=__assign({key:"pano.".concat(f.panoId)},pick(this.imageOptions,["format","size","quality"])),m=f.images,g=(c=(u=f.images.tiles)===null||u===void 0?void 0:u.filter(function(x){return x.size>A}))!==null&&c!==void 0?c:null,E="pano:"+jsonHash([m,y,h]);if(this.pendingTextureTask){if(this.pendingTextureTask.hash===E)return;var b=this.pendingTextureTask.panoId;(l=this.panoMeshes[b])===null||l===void 0||l.setProgress(0),this.emit("pano.texture.abort",createEvent("pano.texture.abort",{error:null,progress:0,meta:null,pano:f.pano}))}var T=this.models.getMaterial()||{},_=T.pano0,S=T.pano1,R;if((_==null?void 0:_.map.name)===E?R=_:(S==null?void 0:S.map.name)===E&&(R=S),R){var B={panoId:f.panoId,effect:d,leftPanoPicture:{zoom:1,map:R.map,luminanceMap:R.luminanceMap,matrix:new THREE__namespace.Matrix4().compose(f.position,f.quaternion,PANO_TEXTURE_SCALE)},position:f.position.clone(),fixCameraTransform:new THREE__namespace.Matrix4};this.doMoveToPano(f.pano,B,r);return}var I="move-to-pano-"+f.panoId;this.pending.add(I),this.pendingTextureTask={panoId:f.panoId,hash:E,onLoad:function(x){if(o.pending.delete(I),o.destroyed)x.body.dispose();else{x.body.name=E;var M={panoId:f.panoId,effect:d,leftPanoPicture:{zoom:1,map:x.body,luminanceMap:null,matrix:new THREE__namespace.Matrix4().compose(f.position,f.quaternion,PANO_TEXTURE_SCALE)},position:f.position.clone(),fixCameraTransform:new THREE__namespace.Matrix4};o.doMoveToPano(f.pano,M,r)}},onError:function(x){o.pending.delete(I);var M=__assign(__assign(__assign({},f.pano),{mode:o.mode}),clonePose(o.camera.pose));o.emit("pano.error",createEvent("pano.error",{error:x,userAction:o.userAction,options:r,prevPano:o.currentPano,progress:0,state:M})),o.emit("pano.cancel",createEvent("pano.cancel",{error:null,userAction:o.userAction,options:r,prevPano:o.currentPano,progress:0,state:M})),r.moveCancelCallback&&r.moveCancelCallback()}},Promise.all([this.tileLevelForFov&&g&&g.length?this.textureLoader.loadTiledCubeTexture(m,g,{tileMaxLevel:this.TILED_CUBE_TEXTURE_LEVEL,imageURL:{transform:p,options:y},format:THREE__namespace.RGBAFormat,minFilter:THREE__namespace.LinearFilter,magFilter:THREE__namespace.LinearFilter,generateMipmaps:!1,viaAjax:!0,fetcher:getFetcher(f.work)},void 0,void 0,function(x){var M,L;o.emit("pano.texture.progress",createEvent("pano.texture.progress",{error:null,progress:x,meta:null,pano:f.pano})),((M=o.pendingTextureTask)===null||M===void 0?void 0:M.hash)===E&&((L=o.panoMeshes[f.panoId])===null||L===void 0||L.setProgress(x))},this.renderer):this.textureLoader.loadCubeTexture(m,{imageURL:{transform:p,options:y},format:THREE__namespace.RGBAFormat,fetcher:getFetcher(f.work)},void 0,void 0,function(x){var M,L;((M=o.pendingTextureTask)===null||M===void 0?void 0:M.hash)===E&&((L=o.panoMeshes[f.panoId])===null||L===void 0||L.setProgress(x)),o.emit("pano.texture.progress",createEvent("pano.texture.progress",{error:null,progress:x,meta:null,pano:f.pano}))},this.renderer)]).then(function(x){var M,L,C=x[0];((M=o.pendingTextureTask)===null||M===void 0?void 0:M.hash)===E?(o.pendingTextureTask.onLoad(C),(L=o.panoMeshes[f.panoId])===null||L===void 0||L.setProgress(0),delete o.pendingTextureTask,o.emit("pano.texture.success",createEvent("pano.texture.success",{error:null,progress:1,meta:C.meta,pano:f.pano}))):C.body.dispose()}).catch(function(x){var M,L;((M=o.pendingTextureTask)===null||M===void 0?void 0:M.hash)===E&&(o.pendingTextureTask.onError(x),(L=o.panoMeshes[f.panoId])===null||L===void 0||L.setProgress(0),delete o.pendingTextureTask,o.emit("pano.texture.error",createEvent("pano.texture.error",{error:x,progress:0,meta:null,pano:f.pano})),o.emit("error",x))}),this.emit("pano.texture.load",createEvent("pano.texture.load",{error:null,progress:0,meta:null,pano:f.pano}))},t.prototype.doMoveToPano=function(e,r,i){var o=this,s,u,c,l,d,f,v,A,h,p;i===void 0&&(i={});var y=now(),m=createUuid();this.panoResources[m]=r;var g=1,E,b,T;if(this.locationMotion.ended){var _=this.locationMotion.getKeyFrameSegment(y);_[0];var S=_[1],R=this.locationMotion.value,B=this.panoResourceFromLocationMotionKeyframe(S).position,I=r.position;E=Math.max(B.distanceTo(I),g),b=[{key:S.key,progress:0,value:__assign(__assign({},R),{count:0})},{key:m,progress:1,value:{distance:0,count:1}}],T=0}else{var x=this.locationMotion.getKeyFrameSegment(y),M=x[0],S=x[1],R=this.locationMotion.value,L=this.panoResourceFromLocationMotionKeyframe(M).position,B=this.panoResourceFromLocationMotionKeyframe(S).position,I=r.position,C=S.value.count-R.count,H=Math.max(L.distanceTo(B),g)*C,F=Math.max(B.distanceTo(I),g);E=H+F,b=[{key:M.key,progress:0,value:__assign({},R)},{key:S.key,progress:H/E,value:S.value},{key:m,progress:1,value:{count:S.value.count+1,distance:0}}];var O=this.locationMotionKeyframesLength(this.locationMotion.keyframes),G=this.locationMotionKeyframesLength(b);T=this.locationMotion.getProgressVelocity(y)*O/G}var Q=r.effect==="instant"?0:this.calculateMovingDuration(i.duration,r.effect==="fly"?E:0),U={longitude:i.longitude,latitude:i.latitude,fov:i.fov},D=__assign(__assign({},e),{mode:this.mode,longitude:(s=U.longitude)!==null&&s!==void 0?s:this.camera.pose.longitude,latitude:(u=U.latitude)!==null&&u!==void 0?u:this.camera.pose.latitude,fov:(c=U.fov)!==null&&c!==void 0?c:this.camera.pose.fov,offset:r.position.clone(),distance:0}),q=this.currentPano;if(this.emit("pano.moveTo",createEvent("pano.moveTo",{options:i,prevPano:q,progress:0,state:D,userAction:this.userAction,error:null})),i.moveStartCallback&&i.moveStartCallback(D),this.videoTexture&&this.videoTexture.image instanceof HTMLVideoElement&&this.videoTexture.image.getAttribute("src")&&(this.videoTexture.image.pause(),this.videoTexture.image.removeAttribute("uuid"),this.videoTexture.image.removeAttribute("src"),this.videoTexture.image.oncanplay=noop$1,this.videoTexture.needsUpdate=!0),this.panoVideo.setMaterial(null),r.effect==="fly")this.cameraMotion.set(U,Q).catch(noop$1);else{var z=coordinatesToVector({longitude:this.cameraMotion.value.longitude,latitude:this.cameraMotion.value.latitude}),K=coordinatesToVector({longitude:(l=U.longitude)!==null&&l!==void 0?l:this.cameraMotion.value.longitude,latitude:(d=U.latitude)!==null&&d!==void 0?d:this.cameraMotion.value.latitude}),J=new THREE__namespace.Object3D;J.lookAt(z);var j=new THREE__namespace.Matrix4().makeRotationFromQuaternion(J.quaternion);J.lookAt(K);var re=new THREE__namespace.Matrix4().makeRotationFromQuaternion(J.quaternion),W=new THREE__namespace.Matrix4().getInverse(j).premultiply(re),te=this.cameraMotion.value.fov,$=(f=U.fov)!==null&&f!==void 0?f:this.cameraMotion.value.fov,ne=1;r.effect==="zoomin"?ne=1.5:r.effect==="zoomout"&&(ne=.4);for(var ee=$*ne,ce=0;ce<b.length-1;ce++){var ae=b[ce].key;if(ae){var se=this.panoResources[ae];se&&(se.fixCameraTransform.copy(W),se.leftPanoPicture&&(se.leftPanoPicture.zoom=Math.tan(te/2/180*Math.PI)/Math.tan(ee/2/180*Math.PI)))}}this.cameraMotion.setKeyframes([{progress:0,value:{longitude:this.cameraMotion.value.longitude,latitude:this.cameraMotion.value.latitude,fov:this.cameraMotion.value.fov}},{progress:0,value:{longitude:(v=U.longitude)!==null&&v!==void 0?v:this.cameraMotion.value.longitude,latitude:(A=U.latitude)!==null&&A!==void 0?A:this.cameraMotion.value.latitude,fov:ee}},{progress:1,value:{longitude:(h=U.longitude)!==null&&h!==void 0?h:this.cameraMotion.value.longitude,latitude:(p=U.latitude)!==null&&p!==void 0?p:this.cameraMotion.value.latitude,fov:$}}],Q).catch(noop$1)}var Ae=this.locationMotion.setKeyframes(b,Q,T);Ae.then(function(){for(var he,me,Z,Y=0,N=o.models;Y<N.length;Y++){var Ee=N[Y];Ee.show()}var ge=__assign(__assign({},e),{mode:o.mode,longitude:o.camera.pose.longitude,latitude:o.camera.pose.latitude,fov:o.camera.pose.fov,offset:o.camera.pose.offset.clone(),distance:0});o.emit("pano.arrived",createEvent("pano.arrived",{options:i,prevPano:q,progress:1,state:ge,userAction:o.userAction,error:null})),i.moveEndCallback&&i.moveEndCallback(ge);var ve=o.works.getResolvedObserver(o.currentPano);if(ve&&ve.video&&o.videoTexture&&o.videoTexture.image instanceof HTMLVideoElement){var xe=ROTATE_Y_PI_MATRIX.clone().multiply((Z=(me=(he=o.models.getMaterial())===null||he===void 0?void 0:he.pano1)===null||me===void 0?void 0:me.matrix)!==null&&Z!==void 0?Z:new THREE__namespace.Matrix4).multiply(ve.video.matrix),fe={map:o.videoTexture,size:ve.video.size,matrix:xe,alpha:1},de=createUuid(),le=o.videoTexture.image;le.setAttribute("uuid",de),canplayVideo().then(function(ue){ue&&ve.video&&le.getAttribute("uuid")===de&&(le.oncanplay=function(){le.oncanplay=noop$1,le.play()},le.ontimeupdate=function(){le.currentTime>.5&&(le.ontimeupdate=noop$1,o.panoVideo.setMaterial(fe))},le.src=ve.video.source)}).catch(function(){le.removeAttribute("uuid")})}},function(){o.emit("pano.cancel",createEvent("pano.cancel",{options:i,prevPano:q,progress:0,state:D,userAction:o.userAction,error:null})),i.moveCancelCallback&&i.moveCancelCallback()})},t.prototype.checkSelectedPano=function(e){var r=this,i,o,s,u;this.stopMomentumMovement();var c=this.camera.getDirection(new THREE__namespace.Vector3).setY(0),l=null,d=this.works.getResolvedObserver(this.currentPano);if(!d)return null;var f=d.accessibleIds.filter(function(K){var J=panoParse(K);if(panoEqual(J,r.currentPano))return!1;var j=r.works.getResolvedObserver(J);return!j||j.position.distanceTo(r.camera.position)>r.maxAccessibleDistance?!1:j.loadable||j.active}),v=this.models.intersectRaycaster(e)[0];if(v){var A=arrayMin(f,function(K){var J=r.works.getResolvedObserver(K);if(!J)return 1/0;var j=J.standingPosition.clone();return j.distanceTo(v.point)},!0),h=A[0],p=A[1];h&&p<this.panoTapTriggerRadius&&(l=(i=this.works.getResolvedObserver(h))!==null&&i!==void 0?i:null)}if(isNil(l)){var y=this.getForwardObserverOrNot(e);y&&(l=y)}for(var m=0,g=this.locationMotion.keyframes;m<g.length;m++){var E=g[m],b=this.panoResourceFromLocationMotionKeyframe(E);if(!(E.progress<this.locationMotion.progress)&&l&&b.panoId===l.panoId){l=null;break}}if(isNil(l))return this.locationMotion.ended===!0&&this.cameraBounce(),null;if(l&&!l.active){var T=l.panoId;this.panoMeshes[T]&&(this.panoMeshes[T].setDisabled(!1),this.panoMeshes[T].setLoading(!0))}var _={};if(l){for(var S=Math.PI/6,R=Math.PI/12,B=new THREE__namespace.Vector3(0,1,0),I=l.position.clone().setY(0).sub(d.position.clone().setY(0)).normalize(),x=I.clone().applyAxisAngle(B,S),M=I.clone().applyAxisAngle(B,-S),L=[],C=[],H=[],F=0,O=l.accessibleIds;F<O.length;F++){var h=O[F],G=panoParse(h);if(!(panoEqual(G,this.currentPano)||panoEqual(G,l.pano))){var Q=this.works.getResolvedObserver(h);if(Q){var U=Q.position.clone().sub(l.position).setY(0);I.angleTo(U)<S?H.push(U):x.angleTo(U)<S?L.push(U):M.angleTo(U)<S&&C.push(U)}}}var D=H.length>0?H:__spreadArray(__spreadArray([],L,!0),C,!0),q=D.slice().sort(function(K,J){return K.angleTo(I)-J.angleTo(I)})[0];q&&q.angleTo(c)>R&&(_.longitude=Math.atan2(-q.x,-q.z))}this.cameraMotion.value.latitude<-Math.PI/4&&(_.latitude=clamp$1(0,this.minLatitude,this.maxLatitude)),this.cameraMotion.value.fov<60&&(_.fov=this.defaultFov);var z={workCode:l.pano.workCode,panoIndex:l.pano.panoIndex,mode:this.mode,longitude:(o=_.longitude)!==null&&o!==void 0?o:this.camera.pose.longitude,latitude:(s=_.latitude)!==null&&s!==void 0?s:this.camera.pose.latitude,fov:(u=_.fov)!==null&&u!==void 0?u:this.camera.pose.fov,distance:0,offset:l?l.position.clone():new THREE__namespace.Vector3};return this.emit("pano.select",createEvent("pano.select",{prevPano:this.currentPano,state:z,userAction:!0,options:_,progress:0,error:null})),l&&l.active?(this.emit("pano.request",createEvent("pano.request",{userAction:!0,prevPano:this.currentPano,progress:0,state:z,options:_,error:null})),l.pano):null},t.prototype.destroy=function(){n.prototype.destroy.call(this)},t.prototype.isReady=function(){return!1},t.prototype.updateCamera=function(e,r,i){return Promise.resolve()},t.prototype.updateCameraWithKeyframes=function(e,r,i){return Promise.resolve()},t.prototype.updateTime=function(e,r){for(var i=this,o,s,u,c,l,d,f,v,A=[],h=2;h<arguments.length;h++)A[h-2]=arguments[h];this.userAction=!0;var p={},y={},m=this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[0]),g=this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[this.locationMotion.keyframes.length-1]),E=!1;if(this.cameraMotion.ended===!1&&(this.cameraMotion.update(e),y.longitude=this.cameraMotion.value.longitude,y.latitude=this.cameraMotion.value.latitude,y.fov=this.cameraMotion.value.fov),this.modelAlphaMotion.ended===!1&&(this.modelAlphaMotion.update(e),p.modelAlpha=this.modelAlphaMotion.value.modelAlpha),this.perspToOrthoMotion.ended===!1&&(this.perspToOrthoMotion.update(e),this.camera.perspToOrtho.setScalar(clamp$1(this.perspToOrthoMotion.value.perspToOrtho,0,1))),this.locationMotion.ended===!1){this.locationMotion.update(e);var b=this.locationMotion.getKeyFrameSegment(e),T=b[0],_=b[1],S=this.panoResourceFromLocationMotionKeyframe(T),R=this.panoResourceFromLocationMotionKeyframe(_),B=new THREE__namespace.Vector3().copy(S.position),I=new THREE__namespace.Vector3().copy(R.position),x=this.locationMotion.value.count-_.value.count+1;p.progress=x,R.leftPanoPicture&&(x<1?S.leftPanoPicture&&(p.pano0=S.leftPanoPicture):p.pano0=R.leftPanoPicture,p.pano1=R.leftPanoPicture),R.effect==="montage"?p.transition="BLACK":R.effect==="spread"?p.transition="SPREAD":p.transition="FADE",(R.effect==="zoomin"||R.effect==="zoomout")&&(p.progress=Math.pow(x,3)),x<1&&R.effect!=="fly"&&(p.pano0&&S.leftPanoPicture&&(p.pano0={map:p.pano0.map,zoom:p.pano0.zoom,luminanceMap:p.pano0.luminanceMap,matrix:S.leftPanoPicture.matrix.clone().setPosition(R.position)}),B.copy(I),E=!0),y.distance=this.locationMotion.value.distance,y.offset=new THREE__namespace.Vector3(B.x+(I.x-B.x)*x,B.y+(I.y-B.y)*x,B.z+(I.z-B.z)*x);for(var M=[],L=[],C=0,H=this.locationMotion.keyframes;C<H.length;C++){var F=H[C],O=F.key,G=F.progress;O!==void 0&&(M.push(O),G>this.locationMotion.progress&&L.push(O))}for(var Q=0,U=Object.keys(this.panoResources);Q<U.length;Q++){var D=U[Q];if(!(L.indexOf(D)>=0)){var q=this.panoResources[D];if(q.leftPanoPicture){var z=q.leftPanoPicture.map;if(z){if(z===((o=p.pano0)===null||o===void 0?void 0:o.map)||z===((s=p.pano1)===null||s===void 0?void 0:s.map))continue;z instanceof TileCubeTextureTarget&&z.cubeRenderTarget&&this.colorCubeRenderTargetPool.push(z.cubeRenderTarget),z.dispose(),q.leftPanoPicture=null}}M.indexOf(D)>=0||delete this.panoResources[D]}}this.currentPano=panoParse(R.panoId),this.emit("pano.moving",createEvent("pano.moving",{userAction:this.userAction,prevPano:panoParse(m.panoId),state:__assign(__assign(__assign(__assign({},panoParse(g.panoId)),{mode:this.mode}),clonePose(this.camera.pose)),y),options:{},progress:this.locationMotion.progress,error:null}))}isEmptyObject(p)===!1&&(!((u=p.pano0)===null||u===void 0)&&u.map&&p.pano0.map instanceof TileCubeTextureTarget&&!p.pano0.map.cubeRenderTarget&&(p.pano0.map.cubeRenderTarget=this.colorCubeRenderTargetPool.pop()),!((c=p.pano1)===null||c===void 0)&&c.map&&p.pano1.map instanceof TileCubeTextureTarget&&!p.pano1.map.cubeRenderTarget&&(p.pano1.map.cubeRenderTarget=this.colorCubeRenderTargetPool.pop()),this.models.setMaterial(p)),isEmptyObject(y)===!1&&this.setCamera(y);var K=this.works.getResolvedObserver(this.currentPano),J=A[1];if(!J){console.error("xrFrame丢失,请重试");return}if(!this.xrManager.session){console.error("session丢失,请重试");return}var j=this.xrManager.referenceSpace;if(j){var re=this.xrManager.cameraVR,W=this.xrManager.cameraL,te=this.xrManager.cameraR,$=[W,te],ne=J.getViewerPose(j),ee=new THREE__namespace.Vector3(0,0,0);if(ne){var ce;ce=this.xrManager.session.renderState.baseLayer;var ae=ne.views;if(!ce){console.error("no layer found");return}this.renderer.setFramebuffer(ce.framebuffer);var se=!1;ae.length!==re.cameras.length&&(re.cameras.length=0,se=!0),this.parallaxCameraMatrixs=[];var Ae=new THREE__namespace.Vector3,he=new THREE__namespace.Vector3;new THREE__namespace.Matrix4().fromArray(ae[0].transform.matrix).decompose(Ae,new THREE__namespace.Quaternion,new THREE__namespace.Vector3),new THREE__namespace.Matrix4().fromArray(ae[1].transform.matrix).decompose(he,new THREE__namespace.Quaternion,new THREE__namespace.Vector3),he.clone().sub(Ae).normalize();var me=new THREE__namespace.Vector3,Z=new THREE__namespace.Quaternion,Y=new THREE__namespace.Vector3;this.camera.matrix.decompose(me,Z,Y);for(var N=0;N<ae.length;N++){var Ee=ae[N],ge=ce.getViewport(Ee),ve=$[N];ve.matrix.fromArray(Ee.transform.matrix);var xe=new THREE__namespace.Vector3,fe=new THREE__namespace.Quaternion,de=new THREE__namespace.Vector3;ve.matrix.decompose(xe,fe,de),ee.copy(me),ve.position.copy(me),ve.quaternion.copy(fe),ve.scale.copy(de),ve.updateMatrix(),ve.projectionMatrix.fromArray(Ee.projectionMatrix),ve.viewport.set(ge.x,ge.y,ge.width,ge.height),se===!0&&re.cameras.push(ve)}if(this.xrManager.session&&this.xrManager.session.inputSources){for(var N=0;N<this.xrManager.session.inputSources.length;N++)if(this.xrManager.session.inputSources[N]&&this.xrManager.session.inputSources[N].targetRayMode==="transient-pointer"){var le=J.getPose(this.xrManager.session.inputSources[N].targetRaySpace,j);if(le){var ue=new THREE__namespace.Vector3(0,0,-1).applyQuaternion(le.transform.orientation),oe=new THREE__namespace.Raycaster(this.camera.position,ue);this.gazeRay=oe}}}if(this.xrManager.machineType==="Oculus"||this.xrManager.machineType==="Pico"){for(var Te=this.xrManager.session.inputSources,N=0;N<Te.length;N++){var Re=this.xrManager.controllers[N],Ie=Te[N];if(Ie){Re&&Re.update(Ie,J,j);var oe=this.xrManager.getController(N),lt=new THREE__namespace.Vector3(0,1.2,0),ye=oe.position.clone().add(ee).sub(lt);Ie.handedness==="left"?this.xrControllerRay.left.set(ye,new THREE__namespace.Vector3(0,0,-1).applyEuler(oe.rotation)):Ie.handedness==="right"&&this.xrControllerRay.right.set(ye,new THREE__namespace.Vector3(0,0,-1).applyEuler(oe.rotation)),this.controllerWrappers[N].position.copy(new THREE__namespace.Vector3(0,0,0).add(ee).sub(lt));var we=this.models.intersectRaycaster(this.xrControllerRay.right);if(we.length===0&&(we=this.xrControllerRay.right.intersectObject(this.boundingMesh,!0).map(function(st){var ft;return __assign({floor:(ft=K==null?void 0:K.floorIndex)!==null&&ft!==void 0?ft:0},st)})),we.length>=1&&we[0].face)if(Ie.handedness==="right"){var Be=this.xrControllerRay.right.intersectObject(this.xrCustomObjectsScene,!0),Je=we[0].face.normal,ht=Je.clone(),Xe=we[0].point.clone();this.intersectMesh.position.copy(Xe);var Ve=Xe.clone().add(ht);if(this.intersectMesh.lookAt(Ve),Math.abs(Je.y)>.99){var je=this.camera.position.clone().sub(Xe);this.intersectMesh.rotation.z=-Math.atan2(je.z,je.x)}this.intersectMesh.visible=!0,this.needsRender=!0,Be.length>0?(this.pointerLines.right.setPoints(ye,Be[0].point),this.pointerLines.right.points.visible=!0,this.intersectMesh.visible=!1):(this.pointerLines.right.points.visible=!1,this.pointerLines.right.setPoints(ye,we[0].point));var at=we[0],Ue=createEvent("intersect.update",{raycaster:(l=this.xrControllerRay.right)!==null&&l!==void 0?l:null,intersection:at!=null?at:null,object:this.intersectMesh});if(this.emit("intersect.update",Ue),Ue.defaultPrevented){this.hideIntersectMesh();return}}else this.pointerLines.left.setPoints(ye,we[0].point)}}this.updateControllerHelper(Te,e,r)}if(this.camera.pose.distance>.1||E)for(var We=0,ze=Object.keys(this.panoMeshes);We<ze.length;We++){var He=ze[We],be=this.panoMeshes[He];be.setOpacity(0),be.setCurrent(!1),be.updateTime&&be.updateTime(e,r),be.visible=!1}else if(K){var $e=arrayMin(K.visibleIds,function(Le){var qe=i.works.getResolvedObserver(Le);return qe?K.standingPosition.distanceTo(qe.standingPosition):1/0},!0),Fe=$e[1];Fe=clamp$1(Fe,2.5,1/0);for(var et=K.visibleIds.concat(panoStringify(this.currentPano)),tt=this.getForwardObserverOrNot(),Qe=this.camera.getDirection(new THREE__namespace.Vector3),Ne=0,rt=Object.keys(this.panoMeshes);Ne<rt.length;Ne++){var He=rt[Ne],be=this.panoMeshes[He],ot=this.works.getResolvedObserver(He);if(et.indexOf(He)===-1)be.setCurrent(!1),be.setOpacity(0);else if(!ot)be.setCurrent(!1),be.setOpacity(0);else if(!ot.loadable&&!ot.active)be.setCurrent(!1),be.setOpacity(0);else{var pt=be.position.clone().setY(this.camera.position.y).distanceTo(this.camera.position);be.setCurrent(!be.loading&&be.progress===0&&tt!==null&&tt.panoId===He),be.setOpacity(pt<.01?0:clamp$1(Fe/pt*1.2,.65,.98));var ct=this.camera.position.clone().setY(be.position.y),ue=new THREE__namespace.Vector3().copy(be.position).sub(ct).normalize();if(He===panoStringify(this.currentPano)){var dt=clamp$1((.5-ct.distanceTo(be.position))/.5,0,1);ue.multiplyScalar(1-dt).add(Qe.clone().multiplyScalar(dt))}ue.length()>0&&be.quaternion.setFromEuler(new THREE__namespace.Euler(0,Math.atan2(ue.x,ue.z),0))}be.updateTime&&be.updateTime(e,r)}}var Ge=function(){return 4}(),Me=function(){var Le=new THREE__namespace.PerspectiveCamera;Le.applyMatrix4(re.matrix),Le.position.set(0,0,0);var qe=i.works.getResolvedObserver(g.panoId),st=qe!=null?qe:K;st&&Le.quaternion.premultiply(st.quaternion.clone().inverse()),Le.updateProjectionMatrix(),Le.updateMatrixWorld(!0);var ft=new THREE__namespace.Frustum().setFromProjectionMatrix(new THREE__namespace.Matrix4().multiplyMatrices(Le.projectionMatrix,Le.matrixWorldInverse));return ft}();g.panoId===panoStringify(this.currentPano)&&((d=g.leftPanoPicture)===null||d===void 0?void 0:d.map)instanceof TileCubeTextureTarget&&(g.leftPanoPicture.map.maxRequest=this.tileMaxRequest,g.leftPanoPicture.map.update(Me,Ge),g.leftPanoPicture.map.needsRender===!0&&(this.needsRender=!0,this.modelSceneNeedsRender=!0));{var _e=this.tiling.object.visible;if(this.initAnimationed){var Pe=g.panoId,ke=this.works.getResolvedObserver(Pe);ke?isSimilarVector3(this.camera.position,ke.position)&&this.locationMotion.ended?(this.tiling.object.visible=!0,this.tiling.panoId!==Pe&&this.tiling.cleanup(),this.tiling.panoId=Pe,this.tiling.setResource((v=(f=ke.images)===null||f===void 0?void 0:f.tiles)!==null&&v!==void 0?v:[],this.enableIOSEDR&&ke.images.luminance?ke.images.luminance:null),this.tiling.setFetcher(getFetcher(ke.work)),this.tiling.setRotation(ke.quaternion),this.tiling.setPosition(ke.position),this.tiling.maxRequest=this.tileMaxRequest,Ge>this.TILED_CUBE_TEXTURE_LEVEL?this.tiling.update(Me,Ge,e):this.tiling.update(Me,0,e)):this.tiling.object.visible=!1:this.tiling.object.visible=!1}else this.tiling.object.visible=!1;_e!==this.tiling.object.visible&&(this.tiling.object.needsRender=!0,this.modelSceneNeedsRender=!0)}this.panoVideo.object.position.copy(this.camera.position),this.panoVideo.updateTime(e)}}},t.prototype.render=function(){var e=this.xrManager.getCamera(this.camera);this.renderer.render(this.modelScene,e),this.renderer.autoClearColor=!1,this.renderer.autoClearDepth=!1,this.renderer.render(this.scene,e),this.renderer.autoClearColor=!0,this.renderer.autoClearDepth=!0},t.prototype.onPanGesture=function(){},t.prototype.onTapGesture=function(){},t.prototype.onPinchGesture=function(){},t.prototype.onMouseMove=function(){},t.prototype.onMouseOut=function(){},t.prototype.panoResourceFromLocationMotionKeyframe=function(e){return this.panoResources[e.key]},t.prototype.updateControllerHelper=function(e,r,i){var o=this.xrControllerRay.left,s=this.xrControllerRay.right;if(!(!e||e.length===0)){for(var u={buttons:{X:!1,Y:!1,LeftTrigger:!1,LeftPinch:!1,A:!1,B:!1,RightTrigger:!1,RightPinch:!1}},c=0;c<e.length;c++){var l=e[c].handedness,d=e[c].gamepad;switch(l){case"left":d.axes&&(this.emitHandleEvent(d.axes[2]===-1,"LeftAxesLeft",r),this.emitHandleEvent(d.axes[2]===1,"LeftAxesRight",r),this.emitHandleEvent(d.axes[3]===-1,"LeftAxesUp",r),this.emitHandleEvent(d.axes[3]===1,"LeftAxesDown",r)),d!=null&&d.buttons&&(d.buttons[4]&&this.emitHandleEvent(d.buttons[4].pressed,"X",r),d.buttons[5]&&this.emitHandleEvent(d.buttons[5].pressed,"Y",r),d.buttons[0]&&this.emitHandleEvent(d.buttons[0].pressed,"LeftTrigger",r),d.buttons[1]&&this.emitHandleEvent(d.buttons[1].pressed,"LeftPinch",r));var f={raycaster:o,axes:{up:d.axes&&d.axes[3]<0?Math.abs(d.axes[3]):0,down:d.axes&&d.axes[3]<0?0:Math.abs(d.axes[3]),left:d.axes&&d.axes[2]<0?Math.abs(d.axes[2]):0,right:d.axes&&d.axes[2]<0?0:Math.abs(d.axes[2])},deltaTime:i};u.buttons.X=d.buttons&&d.buttons[4]?d.buttons[4].pressed:!1,u.buttons.Y=d.buttons&&d.buttons[5]?d==null?void 0:d.buttons[5].pressed:!1,u.buttons.LeftTrigger=d.buttons&&d.buttons[0]?d==null?void 0:d.buttons[0].pressed:!1,u.buttons.LeftPinch=d.buttons&&d.buttons[1]?d==null?void 0:d.buttons[1].pressed:!1,u.left=f;break;case"right":d.axes&&(this.emitHandleEvent(d.axes[2]===-1,"RightAxesLeft",r),this.emitHandleEvent(d.axes[2]===1,"RightAxesRight",r),this.emitHandleEvent(d.axes[3]===-1,"RightAxesUp",r),this.emitHandleEvent(d.axes[3]===1,"RightAxesDown",r)),d.buttons&&(d.buttons[4]&&this.emitHandleEvent(d.buttons[4].pressed,"A",r),d.buttons[5]&&this.emitHandleEvent(d.buttons[5].pressed,"B",r),d.buttons[0]&&this.emitHandleEvent(d.buttons[0].pressed,"RightTrigger",r),d.buttons[1]&&this.emitHandleEvent(d.buttons[1].pressed,"RightPinch",r));var v={raycaster:s,axes:{up:d.axes&&d.axes[3]<0?Math.abs(d.axes[3]):0,down:d.axes&&d.axes[3]<0?0:Math.abs(d.axes[3]),left:d.axes&&d.axes[2]<0?Math.abs(d.axes[2]):0,right:d.axes&&d.axes[2]<0?0:Math.abs(d.axes[2])},deltaTime:i};u.right=v,u.buttons.A=d.buttons&&d.buttons[4]?d==null?void 0:d.buttons[4].pressed:!1,u.buttons.B=d.buttons&&d.buttons[5]?d==null?void 0:d.buttons[5].pressed:!1,u.buttons.RightTrigger=d.buttons&&d.buttons[0]?d==null?void 0:d.buttons[0].pressed:!1,u.buttons.RightPinch=d.buttons&&d.buttons[1]?d==null?void 0:d.buttons[1].pressed:!1;break}}this.emit("xr.controller.update",createEvent("xr.controller.update",u))}},t.prototype.emitHandleEvent=function(e,r,i){var o=this.xrControllerRay.left,s=this.xrControllerRay.right;if(e)if(this.xrHandleState[r].touchStart===!1)this.xrHandleState[r].touchStartTime=i,this.xrHandleState[r].touchStart=!0,this.emit("xr.gesture.buttonDown",createEvent("xr.gesture.buttonDown",{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:r,isFinal:!1,isFirst:!0,controllers:{raycaster:{leftRay:o,rightRay:s}}}));else{var u=i-this.xrHandleState[r].touchStartTime;u>CONTROLLER_EVNET_DELTA_TIME&&this.emit("xr.gesture.press",createEvent("xr.gesture.tap",{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:r,isFinal:!0,isFirst:!0,controllers:{raycaster:{leftRay:o,rightRay:s}}}))}else if(this.xrHandleState[r].touchStart===!0){this.emit("xr.gesture.buttonUp",createEvent("xr.gesture.buttonUp",{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:r,isFinal:!0,isFirst:!1,controllers:{raycaster:{leftRay:o,rightRay:s}}}));var u=i-this.xrHandleState[r].touchStartTime;if(u<=CONTROLLER_EVNET_DELTA_TIME){var c=createEvent("xr.gesture.tap",{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:r,isFinal:!0,isFirst:!1,controllers:{raycaster:{leftRay:o,rightRay:s}}}),l=this.emit("xr.gesture.tap",c);!l&&!c.defaultPrevented&&r==="RightTrigger"&&this.checkSelectedPano(this.xrControllerRay.right)}this.xrHandleState[r].touchStart=!1,this.xrHandleState[r].touchStartTime=0}},t.prototype.initHandEvent=function(){var e=this;if(!this.xrManager.session)throw new Error("初始化失败");this.xrManager.session.addEventListener("select",function(r){e.gazeRay&&e.checkSelectedPano(e.gazeRay)})},t}(PanoramaController),Controllers={Floorplan:FloorplanController,Topview:TopviewController,Panorama:PanoramaController,VRPanorama:VRPanoramaController,Model:ModelController,Mapview:MapviewController,XRPanorama:XRPanoramaController},PROXY_CONTROLLER_EVENT_NAMES=["gesture.pan","gesture.tap","gesture.dbltap","gesture.press","gesture.pinch","gesture.mousewheel","gesture.mousemove","gesture.momentum","initAnimation.start","initAnimation.end","camera.update","intersect.update","pano.select","pano.moveTo","pano.moving","pano.arrived","pano.cancel","pano.error","pano.texture.load","pano.texture.progress","pano.texture.success","pano.texture.error","pano.texture.abort","xr.session.start","xr.session.end","xr.gesture.tap","xr.gesture.press","xr.gesture.buttonUp","xr.gesture.buttonDown","xr.controller.update"];function initLegacyEvent(n){n.on("initAnimation.start",function(t){n.emit("initAnimationWillStart",t.state.panoIndex,t.state,t.userAction)}),n.on("initAnimation.end",function(t){n.emit("initAnimationEnded",t.state.panoIndex,t.state,t.userAction)}),n.on("gesture.pan",function(t){var e=!1;e=n.emit("wantsGesture","pan",t.pointers,t.isFinal),e&&t.preventDefault(),e=n.emit("wantsPanGesture",t.state,t.isFinal),e&&t.preventDefault(),t.defaultPrevented||(n.emit("gesture","pan",t.pointers,t.isFinal),n.emit("panGesture",t.state,t.isFinal))}),n.on("gesture.tap",function(t){var e=!1;e=n.emit("wantsGesture","tap",t.pointers,t.isFinal),e&&t.preventDefault(),e=n.emit("wantsTapGesture",t.center.raycaster,t.center.coords,t.isFinal),e&&t.preventDefault(),t.defaultPrevented||(n.emit("gesture","tap",t.pointers,t.isFinal),n.emit("tapGesture",t.center.raycaster,t.center.coords,t.isFinal))}),n.on("gesture.dbltap",function(t){var e=!1;e=n.emit("wantsGesture","dbltap",t.pointers,t.isFinal),e&&t.preventDefault(),e=n.emit("wantsDblTapGesture",t.center.raycaster,t.center.coords,t.isFinal),e&&t.preventDefault(),t.defaultPrevented||(n.emit("gesture","dbltap",t.pointers,t.isFinal),n.emit("dblTapGesture",t.center.raycaster,t.center.coords,t.isFinal))}),n.on("gesture.press",function(t){var e=!1;e=n.emit("wantsGesture","press",t.pointers,t.isFinal),e&&t.preventDefault(),e=n.emit("wantsPressGesture",t.center.raycaster,t.center.coords,t.center.delta,t.isFinal),e&&t.preventDefault(),t.defaultPrevented||(n.emit("gesture","press",t.pointers,t.isFinal),n.emit("pressGesture",t.center.raycaster,t.center.coords,t.center.delta,t.isFinal))}),n.on("gesture.pinch",function(t){var e=!1;e=n.emit("wantsGesture","pinch",t.pointers,t.isFinal),e&&t.preventDefault(),e=n.emit("wantsPinchGesture",t.scale,t.state.fov,t.isFinal),e&&t.preventDefault(),t.defaultPrevented||(n.emit("gesture","pinch",t.pointers,t.isFinal),n.emit("pinchGesture",t.scale,t.state.fov,t.isFinal))}),n.on("gesture.mousewheel",function(t){var e=!1;e=n.emit("wantsGesture","mouseWheel",t.pointers,t.isFinal),e&&t.preventDefault(),e=n.emit("wantsMouseWheel",t.center.delta,t.state.fov,t.isFinal),e&&t.preventDefault(),t.defaultPrevented||(n.emit("gesture","mouseWheel",t.pointers,t.isFinal),n.emit("mouseWheel",t.center.delta,t.state.fov,t.isFinal))}),n.on("gesture.mousemove",function(t){var e=!1;e=n.emit("wantsGesture","mouseMove",t.pointers,t.isFinal),e&&t.preventDefault(),t.defaultPrevented||(n.emit("gesture","mouseMove",t.pointers,t.isFinal),e=n.emit("wantsChangeCameraFov",t.state.fov),e&&t.preventDefault())}),n.on("gesture.momentum",function(t){var e=!1;e=n.emit("wantsInteriaPan",t.state),e&&t.preventDefault(),t.defaultPrevented||n.emit("interiaPan",t.state,t.isFinal)}),n.on("camera.update",function(t){n.emit("cameraFovUpdate",t.state.fov,t.userAction),n.emit("cameraDirectionUpdate",t.state,t.userAction);var e=coordinatesToVector(t.state);e.setLength(t.state.distance);var r=t.state.offset.clone().sub(e);n.emit("cameraPositionUpdate",r,t.userAction),n.emit("cameraUpdate",t.state,t.userAction)}),n.on("intersect.update",function(t){if(t.intersection){var e=!1;e=n.emit("wantsShowIntersectionOnModel",t.raycaster),e&&t.preventDefault(),t.defaultPrevented||n.emit("intersectionOnModelUpdate",t.intersection,t.object)}else n.emit("intersectionHidden")}),n.on("pano.request",function(t){var e=n.emit("wantsMoveToPano",t.state.panoIndex,t.options,t.userAction);e||(e=n.emit("wantsToMoveToPano",t.state.panoIndex,t.options,t.userAction)),e&&t.preventDefault(),t.defaultPrevented||n.emit("panoWillLoad",t.state.panoIndex)}),n.on("pano.select",function(t){n.emit("panoSelected",t.state.panoIndex)}),n.on("pano.moveTo",function(t){n.emit("panoLoaded",t.state.panoIndex),n.emit("moveToPano",t.state.panoIndex,t.userAction),n.emit("panoWillArrive",t.state.panoIndex,t.state,t.userAction)}),n.on("pano.moving",function(t){n.emit("movingToPano",t.state.panoIndex,t.prevPano.panoIndex,t.progress)}),n.on("pano.arrived",function(t){n.emit("panoArrived",t.state.panoIndex,t.state,t.userAction)}),n.on("pano.cancel",function(t){n.emit("moveToPanoCanceled",t.state.panoIndex)}),n.on("pano.error",function(t){n.emit("panoLoadError",t.error,t.state.panoIndex)}),n.on("pano.texture.load",function(t){n.emit("textureStartLoad",t.pano.panoIndex)}),n.on("pano.texture.success",function(t){n.emit("textureLoaded",t.pano.panoIndex,t.meta)}),n.on("pano.texture.error",function(t){n.emit("textureError",t.error,t.pano.panoIndex)}),n.on("pano.texture.abort",function(t){n.emit("textureAbort",t.pano.panoIndex)}),n.on("pano.texture.progress",function(t){n.emit("textureLoading",t.progress,t.pano.panoIndex)}),n.on("xr.session.start",function(t){n.emit("webXRSessionStart")}),n.on("xr.session.end",function(t){n.emit("webXRSessionEnd")}),n.on("xr.gesture.tap",function(t){n.emit("webXRControllerEvent","tap",t.buttons,{raycaster:t.controllers.raycaster})}),n.on("xr.gesture.press",function(t){n.emit("webXRControllerEvent","press",t.buttons,{raycaster:t.controllers.raycaster})}),n.on("xr.gesture.buttonUp",function(t){n.emit("webXRControllerEvent","buttonUp",t.buttons,{raycaster:t.controllers.raycaster})}),n.on("xr.gesture.buttonDown",function(t){n.emit("webXRControllerEvent","buttonDown",t.buttons,{raycaster:t.controllers.raycaster})}),n.on("xr.controller.update",function(t){n.emit("webXRControllerRayUpdate",{leftRay:t.left?t.left.raycaster:void 0,rightRay:t.right?t.right.raycaster:void 0}),t.left&&n.emit("webXRAxesUpdate","left",{raycaster:{leftRay:t.left?t.left.raycaster:void 0,rightRay:t.right?t.right.raycaster:void 0},axesState:{up:t.left.axes.up,down:t.left.axes.down,left:t.left.axes.left,right:t.left.axes.right},deltaTime:t.left.deltaTime}),t.right&&n.emit("webXRAxesUpdate","right",{raycaster:{leftRay:t.left?t.left.raycaster:void 0,rightRay:t.right?t.right.raycaster:void 0},axesState:{up:t.right.axes.up,down:t.right.axes.down,left:t.right.axes.left,right:t.right.axes.right},deltaTime:t.right.deltaTime})}),n.on("works.request",function(t){n.emit("willLoad",t.input,t.works[0],t.state)}),n.on("works.load",function(t){n.emit("load",t.input,t.works[0],t.state)}),n.on("works.ready",function(t){n.emit("loaded",t.input,t.works[0])}),n.on("state.change",function(t){n.emit("stateChange",t.state,t.userAction)}),n.on("currentState.change",function(t){n.emit("currentStateChange",t.state,t.userAction)}),n.on("state.set",function(t){n.emit("setState",t.state)}),n.on("state.synced",function(t){n.emit("stateSynced",t.state)}),n.on("model.request",function(t){n.emit("modelWillLoad",t.work.model)}),n.on("model.error",function(t){n.emit("modelLoadError",t.error,t.model)}),n.on("model.load",function(t){n.emit("modelLoaded",t.model)}),n.on("model.changeShownFloor",function(t){n.emit("modelShownFloorChange",t.model.shownFloor,t.model.floorLength)}),n.on("render",function(t){n.emit("renderFrame",t.needsRender)}),n.on("mode.change.request",function(t){n.emit("wantsChangeMode",t.mode,t.prevMode)}),n.on("mode.change",function(t){n.emit("modeChange",t.mode,t.prevMode,t.state.panoIndex,t.state,t.userAction)}),n.on("helpers.visible",function(t){n.emit("helpersVisibleChange",t.object.visible)}),n.on("network.resource",function(t){n.emit("network",t.source,t.requestType,t.requestState,t.detail)})}function generateDefaultVideoElement(){if(typeof window!="undefined"){var n=document.createElement("video");n.loop=!0,n.autoplay=!0,n.playsInline=!0,n.muted=!0,n.crossOrigin="";var t=function(){document.removeEventListener("touchstart",t,!1),document.removeEventListener("mousedown",t,!1),n.muted=!1};return document.addEventListener("touchstart",t,!1),document.addEventListener("mousedown",t,!1),n}else return{}}function initLights(n){{var t=new THREE__namespace.DirectionalLight(16777215,.3);t.position.copy(new THREE__namespace.Vector3(1,1,1)),n.add(t)}{var t=new THREE__namespace.DirectionalLight(16777215,.1);t.position.copy(new THREE__namespace.Vector3(-1,-1,-1)),n.add(t)}{var t=new THREE__namespace.DirectionalLight(16777215,.1);n.add(t)}{var t=new THREE__namespace.AmbientLight(16777215,.6);n.add(t)}}function parseKeyValue(n){for(var t,e,r={},i=n.split(/(\;|\,)/),o=0,s=i;o<s.length;o++){var u=s[o],c=u.split("="),l=(t=c[0])===null||t===void 0?void 0:t.trim(),d=(e=c[1])===null||e===void 0?void 0:e.trim();l&&d&&(r[l]=d)}return r}function getViewportScale(){var n;if(typeof document!="undefined")for(var t=document.getElementsByTagName("meta"),e=0;e<t.length;e++){var r=t[e];if(r.getAttribute("name")==="viewport"){var i=parseKeyValue((n=r.getAttribute("content"))!==null&&n!==void 0?n:""),o=Number(i["initial-scale"]);if(!isNaN(o))return o}}return 1}const textureURL="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAV8AAAA/CAQAAADtPwPkAAAR+0lEQVR4AezYg3LEQACH8d1cbdu23Q5qG9G47z/TN/h6tn2b/H+TUTLc7yjcOXV46OUAnUs6EbUp022ZBXc1NhoZYYd7fjDRvdcHAwrlK2QBVJ4sgoqONmY45RUT23sZ6H42F2hK5CtkMbjhZlDmUUcvq1zyieUVyjbE4I1GBfItwxG56YaUZTQwyh4P6NgJ4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JoiU9sZZp5/62J5v1z9NjrDHaSbnbFMf52sHrDUVaidDxNG0o9+uLjfosfdb3jT5d5j757riJgst9NIZQ2Pn+ySZll80vjI6Wz/hQJG4vPG0L/H6poQch/dW3vL3B0u8jl0HvVj5PvHCElEF8DUAFikVYTcvmfBdDzQlvvMXSV5lP5zrXj/fJ54zuWaeeuoqkW8AwCIaqeTZKkmYrpPwR2eqN9X72W7EG57vU67OBeuMV8KXLUzv93UTTj42tvaFS++GVsc5JRyLSLJ8nzO555hFBmiSRCqMr4GwrcmGkib5xSvcwmzFK6e8s7DMa2xH4YZdZumSOwsVzFeBWdr37tpIhOpSwXqONNgZq/2KgvBt54znHN1HzlljTO4oVD5fb+prNIJXQNL1ofDKQisbPLJDv3jNSLq9OkYBEIihKIj3v7S1TRQCX5Kdl1ZQlol7LF+E++fwirfiq2sf4cTXxc6hzxffPuLEeqSWrPGWMF58TWr5viyJAP5/4EV4KePiaSE8eNRgjDy8/tyRW+FZjhS+2tlovNJovtJovNJ0uhK6Wo64SDdxEbM//KesjwAAAABJRU5ErkJggg==";var imageSize=[351,63],imageOffset=[20,20],vertices=new Float32Array([-.5,-.5,0,.5,-.5,0,-.5,.5,0,.5,.5,0]),uvs=new Float32Array([0,0,1,0,0,1,1,1]),index=new Uint8Array([0,1,2,1,3,2]),geometry=new THREE__namespace.BufferGeometry;geometry.setAttribute("position",new THREE__namespace.BufferAttribute(vertices,3)),geometry.setAttribute("uv",new THREE__namespace.BufferAttribute(uvs,2)),geometry.setIndex(new THREE__namespace.BufferAttribute(index,1));var material=new THREE__namespace.MeshBasicMaterial({transparent:!0,depthTest:!1,depthWrite:!1,stencilWrite:!1,fog:!1}),mesh=new THREE__namespace.Mesh(geometry,material);mesh.matrixAutoUpdate=!1;var scene=new THREE__namespace.Scene;scene.add(mesh),scene.matrixAutoUpdate=!1;var camera=new THREE__namespace.OrthographicCamera(-.5,.5,.5,-.5,.1,1);camera.position.set(0,0,.5),camera.lookAt(0,0,0),camera.updateMatrixWorld(!0),camera.matrixAutoUpdate=!1;var prevViewport=new THREE__namespace.Vector4,prevScissor=new THREE__namespace.Vector4;function renderPoweredByRealsee(n){if(material.map){var r=n.getViewport(prevViewport),i=n.getScissor(prevScissor),o=n.getScissorTest(),s=n.autoClear,u=i.x+imageOffset[0]/3,c=i.y+imageOffset[1]/3,l=imageSize[0]/3,d=imageSize[1]/3;n.setViewport(u,c,l,d),n.setScissor(u,c,l,d),n.setScissorTest(!0),n.autoClear=!1,n.render(scene,camera),n.setViewport(r),n.setScissor(i),n.setScissorTest(o),n.autoClear=s}else{var t=new THREE__namespace.Texture,e=new Image;e.onload=function(){t.image=e,t.wrapS=THREE__namespace.ClampToEdgeWrapping,t.wrapT=THREE__namespace.ClampToEdgeWrapping,t.minFilter=THREE__namespace.LinearFilter,t.needsUpdate=!0,t.generateMipmaps=!1,material.needsUpdate=!0,e.onload=noop$1},e.src=textureURL,material.map=t}}var DEFAULT_MODE_CHANGE_DURATION=800,DEFAULT_CAMERA_FOV=90,DEFAULT_REQUEST_PROXY=function(n){return n.replace("//vrlab-public.ljcdn.com/","//vr-public.realsee-cdn.cn/").replace("//vrlab-image4.ljcdn.com/","//vr-image-4.realsee-cdn.cn/").replace("//vrlab-image3.ljcdn.com/","//vr-image-3.realsee-cdn.cn/").replace("//vrlab-image2.ljcdn.com/","//vr-image-2.realsee-cdn.cn/").replace("//vrlab-image1.ljcdn.com/","//vr-image-1.realsee-cdn.cn/")},sharedVector2=new THREE__namespace.Vector2,sharedFrustum=new THREE__namespace.Frustum,sharedProjScreenMatrix=new THREE__namespace.Matrix4,clockForMixer=new WeakMap,worksMap=new WeakMap,emptyWorks=createWorks([]),Five=function(n){__extends(t,n);function t(e){e===void 0&&(e={});var r,i,o,s,u,c,l,d,f,v,A,h=n.call(this)||this;if(h.ident=createUuid(),typeof window!="undefined"&&(__FIVE_DEBUG__.instances[h.ident]=h),h.renderSwitch01=0,h.currentMode="Panorama",h.pano={workCode:"",panoIndex:0},h.needsRender=!1,h.modelSceneNeedsRender=!1,h.onlyRenderIfNeeds=(r=e.onlyRenderIfNeeds)!==null&&r!==void 0?r:!0,h.imageOptions=__assign({},(i=e.imageOptions)!==null&&i!==void 0?i:{}),h.textureOptions=__assign({},(o=e.textureOptions)!==null&&o!==void 0?o:{}),h.poweredByRealsee=(s=e.poweredByRealsee)!==null&&s!==void 0?s:!0,h.extraElements=[],h.controllerInits={Panorama:Object.assign({},e.panorama),Model:Object.assign({},e.model),Floorplan:Object.assign({},e.floorplan),Topview:Object.assign({},e.topview),Mapview:Object.assign({},e.mapview),VRPanorama:Object.assign({},e.vrPanorama),XRPanorama:Object.assign({},e.xrPanorama)},h.fps={testCount:0,testTime:now()},h.info=null,h.modeChangeDuration=(u=e.modeChangeDuration)!==null&&u!==void 0?u:DEFAULT_MODE_CHANGE_DURATION,h.enableWheel=(c=e.enableWheel)!==null&&c!==void 0?c:!0,typeof window!="undefined")if("renderer"in e)e.renderer instanceof InternalWebGLRenderer&&h.throwError(new Error("cannot render a internal renderer")),h.renderer=e.renderer;else try{h.renderer=new InternalWebGLRenderer({preserveDrawingBuffer:e.preserveDrawingBuffer,backgroundColor:e.backgroundColor,backgroundAlpha:e.backgroundAlpha,antialias:e.antialias,webgl2:e.webgl2,logarithmicDepthBuffer:e.logarithmicDepthBuffer,precision:e.precision});var p=getViewportScale();h.renderer.setPixelRatio(p===1?window.devicePixelRatio:1),h.renderer.setSize(512,512)}catch(I){I instanceof Error&&h.throwError(I)}h.getPixelsRenderTarget=new THREE__namespace.WebGLRenderTarget(1,1,{encoding:(d=(l=h.renderer)===null||l===void 0?void 0:l.outputEncoding)!==null&&d!==void 0?d:THREE__namespace.sRGBEncoding,generateMipmaps:!1});var y=new THREE__namespace.DepthTexture(1,1);y.generateMipmaps=!1,y.format=THREE__namespace.DepthStencilFormat,y.type=THREE__namespace.UnsignedInt248Type,h.modelRenderTarget=new THREE__namespace.WebGLRenderTarget(1,1,{encoding:(v=(f=h.renderer)===null||f===void 0?void 0:f.outputEncoding)!==null&&v!==void 0?v:THREE__namespace.sRGBEncoding,depthTexture:y,generateMipmaps:!1,depthBuffer:!0,stencilBuffer:!0}),h.scissor=Object.assign({left:0,bottom:0,width:1,height:1},e.scissor),h.camera=new Camera(DEFAULT_CAMERA_FOV),h.scene=new Scene,h.xrCustomObjectsScene=new THREE__namespace.Scene,h.scene.add(h.xrCustomObjectsScene),h.scene.matrixAutoUpdate=!1,h.lastLoadWorkTask=Promise.resolve(),h.requestProxy=(A=e.requestProxy)!==null&&A!==void 0?A:DEFAULT_REQUEST_PROXY,h.networkSubscribe=new NetworkSubscribe,h.networkSubscribe.on("network",function(I,x,M,L){var C;h.emit("network.resource",createEvent("network.resource",{source:I,requestType:x,requestState:M,detail:L})),(C=h.analysis)===null||C===void 0||C.network(h.works,I,x,M,L)}),h.boundingMesh=generateBoundingMesh(new THREE__namespace.Box3(new THREE__namespace.Vector3(-.5,-.5,-.5),new THREE__namespace.Vector3(.5,.5,.5))),h.boundingMesh.name="bounding",h.models=createModels(),h.models.push(new Model),h.lastModels=createModels(),h.lastWorks=createWorks([]),h.readyCallbacks=[],h.syncingState=!1,h.helperGroup=new THREE__namespace.Group,h.helperGroup.name="helper",h.helperGroup.matrixAutoUpdate=!1,h.scene.add(h.helperGroup),h.modelGroup=new THREE__namespace.Group,h.modelGroup.visible=!1,h.modelGroup.name="model",h.modelGroup.matrixAutoUpdate=!1,h.modelScene=new THREE__namespace.Scene,h.modelScene.add(h.modelGroup),h.modelScene.add(h.boundingMesh),h.modelScene.matrixAutoUpdate=!1,h.videoTexture=new THREE__namespace.VideoTexture(e.videoInstance||generateDefaultVideoElement()),initLights(h.scene),initLights(h.modelScene),h.state={mode:h.currentMode,workCode:h.pano.workCode,panoIndex:h.pano.panoIndex,longitude:h.camera.pose.longitude,latitude:h.camera.pose.latitude,fov:h.camera.pose.fov,offset:h.camera.pose.offset.clone(),distance:h.camera.pose.distance},h.stateSynced=!1,h._enablePostProcessing=!1,h._enableIOSEDR=!1,h._enableEDL=!1,h._enableHQ=!1,h.destroyed=!1,h.paused=!0,typeof window!="undefined"&&(e.play!==!1&&h.play(),h.stopAnimationLoop=AnimationFrameLoop.shared.add(function(I,x){for(var M=[],L=2;L<arguments.length;L++)M[L-2]=arguments[L];h.updateTime.apply(h,__spreadArray([I,x],M,!1))},!1,0,10));var m=function(){typeof document!="undefined"&&document.fullscreenElement===null&&h.currentMode==="VRPanorama"&&h.controller.emit("vr.requestExit",createEvent("vr.requestExit",{}))},g=function(){h.needsRender=!0,h.modelSceneNeedsRender=!0};if(typeof document!="undefined"&&document.addEventListener("fullscreenchange",m,!1),h.renderer&&h.renderer.domElement.addEventListener("webglcontextrestored",g,!1),h.removeEventListeners=function(){typeof document!="undefined"&&document.removeEventListener("fullscreenchange",m,!1),h.renderer&&h.renderer.domElement.removeEventListener("webglcontextrestored",g,!1)},h.plugins={},e.plugins&&e.plugins.length)for(var E=0,b=e.plugins;E<b.length;E++){var T=b[E];if(typeof T=="function")T(h);else if(Array.isArray(T)){var _=T[0],S=T[1],R=T[2];if(typeof _=="function"){var B=_(h,R);typeof S=="string"&&(h.plugins[S]?h.throwError(new Error("plugin name ".concat(S," is exists."))):h.plugins[S]=B)}}}return h.gpuPickingRenderTarget=new THREE__namespace.WebGLRenderTarget(1,1,{generateMipmaps:!1}),h.meshReplaceMaterialMap=new Map,h.meshOriginMaterialMap=new Map,initLegacyEvent(h),h}return Object.defineProperty(t,"version",{get:function(){return"6.2.5"},enumerable:!1,configurable:!0}),Object.defineProperty(t,"dracoPath",{get:function(){return draco.decoderPath},set:function(e){draco.setDecoderPath(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t,"ktx2Path",{get:function(){return ktx2.transcoderPath},set:function(e){ktx2.setTranscoderPath(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"panoIndex",{get:function(){return this.pano.panoIndex},enumerable:!1,configurable:!0}),t.prototype.getGPUPicking=function(e,r,i,o,s){var u=this;if(o===void 0&&(o=1),s===void 0&&(s=new THREE__namespace.Vector3(0,0,0)),!this.renderer)throw new Error("renderer is not initialized.");this.models.setMaterial({constantColor:s}),this.scene.traverse(function(f){if(!(!(f instanceof THREE__namespace.Mesh)||f instanceof PBMMesh)){var v=Object.keys(i).filter(function(h){return h===f.uuid})[0];if(v)if(u.meshOriginMaterialMap.set(v,f.material),u.meshReplaceMaterialMap.get(v))f.material=u.meshReplaceMaterialMap.get(v);else{var A=new THREE__namespace.ShaderMaterial({uniforms:{color:{value:i[v]}},vertexShader:`
2062
2062
  void main() {
2063
2063
  vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );
2064
2064
  gl_Position = projectionMatrix * mvPosition;
@@ -2068,4 +2068,4 @@ void main() {
2068
2068
  void main() {
2069
2069
  gl_FragColor = vec4( color, 1.0 );
2070
2070
  }
2071
- `});A.depthTest=f.material.depthTest,A.side=f.material.side,u.meshReplaceMaterialMap.set(v,A),f.material=A}}});var c=this.renderer.getSize(new THREE__namespace.Vector2);this.camera.setViewOffset(c.width,c.height,e*o,r*o,1,1),this.renderer.setRenderTarget(this.gpuPickingRenderTarget),this.render();var l=new Uint8Array(4);this.renderer.readRenderTargetPixels(this.gpuPickingRenderTarget,0,0,1,1,l),this.renderer.setRenderTarget(null),this.camera.clearViewOffset(),this.scene.traverse(function(f){!(f instanceof THREE__namespace.Mesh)||f instanceof PBMMesh||u.meshOriginMaterialMap.get(f.uuid)&&(f.material=u.meshOriginMaterialMap.get(f.uuid))}),this.models.setMaterial({constantColor:null});var d=Object.keys(i).filter(function(f){return i[f].equals(new THREE__namespace.Color().setRGB(l[0]/255,l[1]/255,l[2]/255))})[0];return d||!1},t.prototype.dispose=function(){var e,r;if(this.destroyed!==!0){delete __FIVE_DEBUG__.instances[this.ident],this.emit("dispose"),this.destroyed=!0,this.pause(),this.stopAnimationLoop&&(this.stopAnimationLoop(),delete this.stopAnimationLoop),(e=this.renderer)===null||e===void 0||e.setAnimationLoop(null),this.off(),this.networkSubscribe.off(),this.controller&&(this.controller.destroy(),this.controller=void 0);var i=this.getElement();i&&i.parentNode&&i.parentNode.removeChild(i);var o=this.models.getMaterial();o&&(o.pano0&&o.pano0.map.dispose(),o.pano1&&o.pano1.map!==((r=o.pano0)===null||r===void 0?void 0:r.map)&&o.pano1.map.dispose());for(var s=0,u=this.models;s<u.length;s++){var c=u[s];c.dispose()}this.models.length=0,this.models.setMaterial({pano0:null,pano1:null}),this.meshReplaceMaterialMap.forEach(function(l){l.dispose()}),this.meshOriginMaterialMap.forEach(function(l){l.dispose()}),this.renderer instanceof InternalWebGLRenderer&&this.renderer.forceContextLoss&&this.renderer.forceContextLoss()}},t.prototype.setScissor=function(e){var r;if(Object.assign(this.scissor,e),this.controller&&this.controller.updateRenderSize){var i=new THREE__namespace.Vector2;(r=this.renderer)===null||r===void 0||r.getDrawingBufferSize(i),this.controller.updateRenderSize(i)}},Object.defineProperty(t.prototype,"helperVisible",{get:function(){return this.helperGroup.visible},set:function(e){this.helperGroup.visible!==e&&(this.helperGroup.visible=e,this.emit("helpers.visible",createEvent("helpers.visible",{object:this.helperGroup})),this.needsRender=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enableIOSEDR",{get:function(){return this._enableIOSEDR},set:function(e){this._enableIOSEDR!==e&&(this._enableIOSEDR=e,this.currentMode&&this.currentMode==="Panorama"&&this.changeMode(this.currentMode,this.getCurrentState(),0,!1,!0))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"postProcessingType",{get:function(){return this.currentMode==="Panorama"&&this.enableIOSEDR&&this.enablePostProcessing?"luminance":this.currentMode==="Mapview"&&this.enableEDL?"edl":this.currentMode==="Mapview"&&this.enableHQ?"hq":null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enableEDL",{get:function(){return this._enableEDL},set:function(e){if(e===!0&&this.currentMode!==t.Mode.Mapview)throw new Error("只支持Mapview下开启EDL");this._enableEDL!==e&&(this._enableEDL=e,this.boundingMesh.visible=!e,this.needsRender=!0,this.modelSceneNeedsRender=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enableHQ",{get:function(){return this._enableHQ},set:function(e){if(e===!0&&this.currentMode!==t.Mode.Mapview)throw new Error("只支持Mapview下开启HQ");this._enableHQ!==e&&(this._enableHQ=e,this.boundingMesh.visible=!e,this.needsRender=!0,this.modelSceneNeedsRender=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enablePostProcessing",{get:function(){return this._enablePostProcessing},set:function(e){this._enablePostProcessing!==e&&(this._enablePostProcessing=e),this.needsRender=!0,this.modelSceneNeedsRender=!0},enumerable:!1,configurable:!0}),t.prototype.updateConfiguration=function(e,r){r===void 0&&(r=!0);var i=!1;e.panorama&&(Object.assign(this.controllerInits.Panorama,e.panorama),this.currentMode==="Panorama"&&(i=!0)),e.model&&(Object.assign(this.controllerInits.Model,e.model),this.currentMode==="Model"&&(i=!0)),e.floorplan&&(Object.assign(this.controllerInits.Floorplan,e.floorplan),this.currentMode==="Floorplan"&&(i=!0)),e.topview&&(Object.assign(this.controllerInits.Topview,e.topview),this.currentMode==="Topview"&&(i=!0)),e.mapview&&(Object.assign(this.controllerInits.Mapview,e.mapview),this.currentMode==="Mapview"&&(i=!0)),e.vrPanorama&&(Object.assign(this.controllerInits.VRPanorama,e.vrPanorama),this.currentMode==="VRPanorama"&&(i=!0)),e.imageOptions&&(Object.assign(this.imageOptions,e.imageOptions),(this.currentMode==="Panorama"||this.currentMode==="VRPanorama")&&(i=!0)),e.textureOptions&&Object.assign(this.textureOptions,e.textureOptions),r&&i&&this.controller&&this.currentMode&&this.changeMode(this.currentMode,this.getCurrentState(),0,!1,!0)},t.prototype.appendTo=function(e,r){if(r===void 0&&(r={}),!!this.renderer){if(!(this.renderer instanceof InternalWebGLRenderer)){this.throwError(new Error("cannot call appendTo method when render a external renderer"));return}var i=this.getElement();if(i){e.appendChild(i),this.refresh(r);var o=window.getComputedStyle(e).position;o!=="relative"&&o!=="absolute"&&o!=="fixed"&&o!=="sticky"&&(e.style.position="relative")}}},t.prototype.refresh=function(e,r){if(e===void 0&&(e={}),!!this.renderer){var i=this.getElement();if(i){var o=i.parentNode;if(o&&o.nodeName){var s=e.width,u=s===void 0?o.offsetWidth:s,c=e.height,l=c===void 0?o.offsetHeight:c;this.renderer instanceof InternalWebGLRenderer&&(r&&this.renderer.setPixelRatio(r),this.renderer.setSize(u,l))}var d=new THREE__namespace.Vector2;if(this.renderer.getDrawingBufferSize(d),this.controller&&this.controller.updateRenderSize&&this.controller.updateRenderSize(d),this.modelRenderTarget.width!==d.x||this.modelRenderTarget.height!==d.y){this.modelRenderTarget.setSize(d.x,d.y),this.modelRenderTarget.depthTexture.dispose();var f=new THREE__namespace.DepthTexture(d.x,d.y);f.generateMipmaps=!1,f.format=THREE__namespace.DepthStencilFormat,f.type=THREE__namespace.UnsignedInt248Type,this.modelRenderTarget.depthTexture=f,this.modelRenderTarget.depthTexture.needsUpdate=!0}this.needsRender=!0,this.modelSceneNeedsRender=!0,this.render(noop$1,!0)}}},t.prototype.addExtraElement=function(e){var r=this;return this.extraElements.indexOf(e)===-1&&(this.extraElements.push(e),this.controller&&this.controller.bindExtraElement(e)),function(){return r.removeExtraElement(e)}},t.prototype.removeExtraElement=function(e){var r=this.extraElements.indexOf(e);r!==-1&&(this.extraElements.splice(r,1),this.controller&&this.controller.unbindExtraElement(e))},t.prototype.getPose=function(){var e=this.camera.copyPose(),r=e.longitude,i=e.latitude,o=e.fov,s=e.offset,u=e.distance;return{longitude:r,latitude:i,fov:o,offset:s.clone(),distance:u}},t.prototype.getSize=function(e){if(!this.renderer)throw new Error("renderer is not initialized");return this.renderer.getSize(e),e.x*=this.scissor.width,e.y*=this.scissor.height,e},t.prototype.getDrawingBufferSize=function(e){if(!this.renderer)throw new Error("renderer is not initialized");return this.renderer.getDrawingBufferSize(e),e.x*=this.scissor.width,e.y*=this.scissor.height,e},t.prototype.updateCamera=function(e,r,i){return i===void 0&&(i=!0),this.controller?this.controller.updateCamera(e,r,i):Promise.reject(new Error("controller is not initialized."))},t.prototype.updateCameraWithKeyframes=function(e,r,i){return i===void 0&&(i=!0),this.controller?this.controller.updateCameraWithKeyframes(e,r,i):Promise.reject(new Error("controller is not initialized."))},t.prototype.getLongitudeAndLatitude=function(){var e=this.getPose(),r=e.longitude,i=e.latitude;return{longitude:r,latitude:i}},t.prototype.getOffset=function(){return this.getPose().offset},t.prototype.getCameraLocal=function(){if(this.pano.workCode&&this.controller&&this.works){var e=this.works.getResolvedObserver(this.pano);if(e){var r=new THREE__namespace.Object3D;return r.position.copy(e.position),r.quaternion.copy(e.quaternion),r.scale.set(1,1,1),r.matrix.compose(r.position,r.quaternion,r.scale),r.matrixAutoUpdate=!1,cameraWorldToLocal(this.camera,r)}}return null},Object.defineProperty(t.prototype,"works",{get:function(){var e=worksMap.get(this);if(!e)return emptyWorks;for(var r=0,i=e;r<i.length;r++){var o=i[r];if(!workRawMapping.has(o))return emptyWorks}return e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"work",{get:function(){return this.works[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"model",{get:function(){return this.models[0]},enumerable:!1,configurable:!0}),t.prototype.load=function(e,r,i,o){var s=this;if(o===void 0&&(o=!0),!this.renderer)throw new Error("renderer is not initialized");var u=this.lastLoadWorkTask.then(function(){return isPromise(e)?e.then(function(c){return s.load_(c,r,i,o)}):s.load_(e,r,i,o)});return this.lastLoadWorkTask=u.catch(function(c){s.throwError(c)}),u},t.prototype.load_=function(e,r,i,o){var s=this,u,c,l,d,f,v,A,h,p;o===void 0&&(o=!0);var y={};typeof i=="number"?y.duration=i:typeof i=="object"&&Object.assign(y,i),this.controller||(y.duration=0,y.effect="instant");var m=[];if(Array.isArray(e))for(var g=0,E=e;g<E.length;g++){var b=E[g];typeof b!="string"&&"work"in b?m.push(parseWork(b.work,b)):m.push(parseWork(b))}else m.push(parseWork(e));for(var T=createWorks(m),_=function(J){var j=S,re=new Fetcher({allowHosts:J.allowHosts,get requestProxy(){return j.requestProxy},get networkSubscribe(){return j.networkSubscribe}});registerFetcher(J,re)},S=this,R=0,B=T;R<B.length;R++){var I=B[R];_(I)}this.lastWorks=this.works,r===void 0&&(r="inherit"),r==="inherit"&&this.lastWorks.length===0&&(r="initial");var x=T.initial,M=x.work.observers[0],L=M?{workCode:M.work.workCode,panoIndex:M.panoIndex}:{workCode:x.work.workCode,panoIndex:0},C=(u=x.mode)!==null&&u!==void 0?u:M?"Panorama":"Mapview",H={};if(r==="inherit"){C=this.currentMode;var F=T.resolvedObservers[this.panoIndex];F?L={workCode:F.work.workCode,panoIndex:F.panoIndex}:typeof T.initial.panoIndex=="number"?L={workCode:T.initial.work.workCode,panoIndex:T.initial.panoIndex}:(C==="Panorama"||C==="VRPanorama"||C==="XRPanorama")&&(C="Mapview"),H={longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude,fov:this.camera.pose.fov,distance:this.camera.pose.distance,offset:this.camera.pose.offset.clone()}}else if(r==="initial")typeof x.panoIndex=="number"&&(L={workCode:x.work.workCode,panoIndex:x.panoIndex}),x.mode&&(C=x.mode),H={longitude:x.longitude,latitude:x.latitude,fov:x.fov,distance:x.distance,offset:(c=x.offset)===null||c===void 0?void 0:c.clone()};else{if(C=(l=r.mode)!==null&&l!==void 0?l:this.currentMode,typeof r.panoIndex=="number"){var F=T.getResolvedObserver({workCode:(f=(d=r.workCode)!==null&&d!==void 0?d:x.work.workCode)!==null&&f!==void 0?f:"",panoIndex:r.panoIndex});F&&(L={workCode:F.work.workCode,panoIndex:F.panoIndex})}H={longitude:r.longitude,latitude:r.latitude,fov:r.fov,distance:r.distance,offset:r.offset}}var O=__assign(__assign(__assign({},L),{mode:C}),H);this.emit("works.request",createEvent("works.request",{input:e,works:T,state:O,userAction:o}));var G=function(){var J,j;s.pano=L;var re=(J=y.duration)!==null&&J!==void 0?J:s.modeChangeDuration,W=(j=y.effect)!==null&&j!==void 0?j:"fade",te=__assign(__assign({initial:{state:O,currentState:s.getCurrentState(),duration:re,effect:W,userAction:o}},s.commonParams()),s.controllerInits[C]);if(s.controller&&s.currentMode===C)s.controller.updateWork(T,O,{effect:W,duration:re},o)===!1&&(s.controller.destroy(),s.controller=s.applyController(C,te));else{var $=s.currentMode,ne=Controllers[C].initAnimationEndState(te);if(s.controller)s.controller.destroy();else{var ee=Controllers[C].initAnimationEndState(te);s.camera.setFromPose(ee),s.modelGroup.visible=!0,s.emit("camera.update",createEvent("camera.update",{state:s.getCurrentState(),userAction:o}))}s.controller=s.applyController(C,te);var ce=createEvent("mode.change",{prevMode:$,mode:C,state:ne,userAction:o});s.emit("mode.change",ce)}};if(worksMap.set(this,T),!this.controller){var Q=__assign(__assign({initial:{state:O,currentState:this.getCurrentState(),duration:(v=y.duration)!==null&&v!==void 0?v:this.modeChangeDuration,effect:(A=y.effect)!==null&&A!==void 0?A:"fade",userAction:o}},this.commonParams()),this.controllerInits[C]),U=Controllers[C].initAnimationEndState(Q);this.camera.setFromPose(U),this.emit("camera.update",createEvent("camera.update",{state:this.getCurrentState(),userAction:o}))}if(this.updateConfiguration(y,!1),C===t.Mode.Floorplan||C===t.Mode.Topview||C===t.Mode.Mapview||C===t.Mode.Model)this.loadModel(T,y).then(function(){s.needsRender=!0,s.modelSceneNeedsRender=!0,G(),s.emit("camera.update",createEvent("camera.update",{state:s.getCurrentState(),userAction:o}))});else{if(!this.controller){var D=new THREE__namespace.Vector3,q=T.getResolvedObserver(L);q&&D.copy(q.position),this.camera.setFromPose({fov:H.fov,longitude:H.longitude,latitude:H.latitude,distance:H.distance,offset:(h=H.offset)!==null&&h!==void 0?h:D}),this.needsRender=!0,this.modelSceneNeedsRender=!0}G();var z=!1,K=function(){s.works===T&&z===!1&&(s.needsRender=!0,s.modelSceneNeedsRender=!0,s.emit("camera.update",createEvent("camera.update",{state:s.getCurrentState(),userAction:o})),s.loadModel(T,y),z=!0)};this.controller.once("pano.arrived",K),this.controller.once("pano.cancel",K),setTimeout(K,((p=y.duration)!==null&&p!==void 0?p:this.modeChangeDuration)+1e3)}return this.emit("works.load",createEvent("works.load",{input:e,state:this.getCurrentState(),userAction:o,works:T})),this.ready().then(function(){var J;s.emit("works.ready",createEvent("works.ready",{input:e,state:s.getCurrentState(),userAction:o,works:T})),(J=s.analysis)===null||J===void 0||J.work(T)})},t.prototype.reset=function(){var e=this,r=this.lastLoadWorkTask.then(function(){return e.reset_()});return this.lastLoadWorkTask=r.catch(function(i){e.throwError(i)}),r},t.prototype.reset_=function(){var e=this;return new Promise(function(r){var i;e.controller&&(e.controller.destroy(),e.controller=void 0);var o=e.models.getMaterial();o&&(o.pano0&&o.pano0.map.dispose(),o.pano1&&o.pano1.map!==((i=o.pano0)===null||i===void 0?void 0:i.map)&&o.pano1.map.dispose()),e.models.setMaterial({pano0:null,pano1:null});for(var s=0,u=e.models;s<u.length;s++){var c=u[s];e.lastModels.push(c)}if(e.models.length=0,e.lastModels.length>0){for(var l=0,d=e.lastModels;l<d.length;l++){var c=d[l];e.modelGroup.remove(c),c.dispose(),e.needsRender=!0,e.modelSceneNeedsRender=!0}e.lastModels.length=0}e.lastWorks&&delete e.lastWorks,worksMap.delete(e),e.currentMode="Panorama",e.pano={workCode:"",panoIndex:0},e.camera.setFromPose({distance:0,fov:DEFAULT_CAMERA_FOV,longitude:0,latitude:0,offset:new THREE__namespace.Vector3(0,0,0)}),e.state={mode:e.currentMode,workCode:e.pano.workCode,panoIndex:e.pano.panoIndex,longitude:e.camera.pose.longitude,latitude:e.camera.pose.latitude,fov:e.camera.pose.fov,offset:e.camera.pose.offset.clone(),distance:e.camera.pose.distance},e.models.needsRender=!1,e.camera.needsRender=!1,e.needsRender=!1,e.modelSceneNeedsRender=!1,r()})},t.prototype.changeMode=function(e,r,i,o,s){var u=this;return r===void 0&&(r={}),o===void 0&&(o=!0),s===void 0&&(s=!1),new Promise(function(c,l){var d,f,v,A;if(!u.renderer)throw new Error("renderer is not initialized.");r=__assign({},r);var h=0;u.controller&&(typeof i=="number"?h=i:h=(d=i==null?void 0:i.duration)!==null&&d!==void 0?d:u.modeChangeDuration);var p="fly";u.controller&&typeof i=="object"&&i.effect&&(p=i.effect);var y=typeof r.panoIndex=="number"?{workCode:(A=(f=r.workCode)!==null&&f!==void 0?f:(v=u.work)===null||v===void 0?void 0:v.workCode)!==null&&A!==void 0?A:"",panoIndex:r.panoIndex}:u.pano;if(!t.Mode.hasOwnProperty(e)){var m=new Error('mode "'.concat(e,'" is not existed'));u.throwError(m),l(m);return}if((e===t.Mode.Floorplan||e===t.Mode.Topview||e===t.Mode.Mapview||e===t.Mode.Model)&&!u.models.loaded){var m=new Error("model is not ready.");u.throwError(m),l(m);return}if((e===t.Mode.Panorama||e===t.Mode.VRPanorama||e===t.Mode.XRPanorama)&&!u.works.getResolvedObserver(y)){var m=new Error("PanoId ".concat(panoStringify(y)," not existed."));u.throwError(m),l(m);return}var g=u.controller,E=u.currentMode,b=function(){if(u.controller&&u.controller.stopMomentumMovement(),u.controller&&s===!1&&E===e)e===t.Mode.Panorama||e===t.Mode.Model||e===t.Mode.VRPanorama||e===t.Mode.XRPanorama?panoEqual(u.pano,y)&&"moveToPano"in u.controller&&typeof u.controller.moveToPano=="function"?u.controller.moveToPano(y,__assign({duration:h},r),o):u.controller.updateCamera(r,h,o).catch(noop$1):(panoEqual(u.pano,y)||(u.pano=y),u.controller.updateCamera(r,h,o).catch(noop$1));else{var _=__assign(__assign({},r),y),S=__assign(__assign({initial:{state:_,currentState:u.getCurrentState(),duration:h,effect:p,userAction:o}},u.commonParams()),u.controllerInits[e]),R=Controllers[e].initAnimationEndState(S),B=createEvent("mode.change.request",{prevMode:u.currentMode,mode:e,state:R,userAction:o});if(u.emit("mode.change.request",B),!B.defaultPrevented){g&&g.destroy(),u.controller=u.applyController(e,S);var I=createEvent("mode.change",{prevMode:u.currentMode,mode:e,state:R,userAction:o});u.emit("mode.change",I)}}c()};if(e===t.Mode.VRPanorama)u.requestFullscreen(),requestDeviceOrientationPermission().then(function(){return b()}).catch(function(_){_ instanceof Error&&(u.exitFullscreen(),u.throwError(_),l(_))});else if(e===t.Mode.XRPanorama){var T=AnimationFrameLoop.shared.getContext();T?T.end():requestXRSessionPermission().then(function(_){AnimationFrameLoop.shared.setContext(_),b()}).catch(function(_){_ instanceof Error&&(u.throwError(_),l(_))})}else b()})},t.prototype.getPixels=function(e,r,i,o,s,u,c){if(!this.renderer)throw new Error("renderer is not initialized.");var l=this.renderer.getPixelRatio(),d=this.renderer.getRenderTarget(),f=this.renderer.getSize(new THREE__namespace.Vector2);e=Math.ceil(e),r=Math.ceil(r),i=Math.ceil(i),o=Math.ceil(o),s=Math.ceil(s!=null?s:l),u=u!=null?u:!1;var v=this.getPixelsRenderTarget;v.setSize(i*s,o*s),this.renderer.setRenderTarget(v),this.camera.setViewOffset(f.width,f.height,e,f.height-r-o,i,o),this.camera.pixelRatio=s,this.camera.resolution.set(i,o),this.camera.aspect=this.camera.resolution.width/this.camera.resolution.height;for(var A=0,h=this.scene.children;A<h.length;A++){var p=h[A];p instanceof THREE__namespace.Object3D&&p.traverseVisible(function(x){x.setResolution&&x.setResolution(i*s/l,o*s/l)})}this.controller?(this.controller.updateRenderSize(new THREE__namespace.Vector2(i*s,o*s)),this.controller.render(!0,this.postProcessingType)):(this.renderer.render(this.scene,this.camera),this.renderer.autoClearDepth=!1,this.renderer.autoClearColor=!1,this.renderer.render(this.modelScene,this.camera),this.renderer.autoClearDepth=!0,this.renderer.autoClearColor=!0);var y=i*s,m=o*s,g=y*m,E=g*4,b;try{if(c){if(c.length!==E)throw new Error("buffer length is not equals pixels ".concat(E))}else c=new Uint8Array(E);if(this.renderer.readRenderTargetPixels(v,0,0,i*s,o*s,c),u)for(var T=g/2,_=0,S=0,R=0,B=0;S<T;S++)for(B=(m-Math.floor(S/y)-1)*y+S%y,R=0;R<4;R++)_=c[S*4+R],c[S*4+R]=c[B*4+R],c[B*4+R]=_}catch(x){b=x}if(this.renderer.setRenderTarget(d),this.controller&&this.controller.updateRenderSize){var I=new THREE__namespace.Vector2;this.renderer.getDrawingBufferSize(I),this.controller.updateRenderSize(I)}if(this.camera.clearViewOffset(),this.camera.pixelRatio=l,this.getSize(this.camera.resolution),this.camera.aspect=this.camera.resolution.width/this.camera.resolution.height,b)throw b;return c},t.prototype.getElement=function(){var e;return(e=this.renderer)===null||e===void 0?void 0:e.domElement},Object.defineProperty(t.prototype,"observers",{get:function(){return this.works.resolvedObservers},enumerable:!1,configurable:!0}),t.prototype.render=function(e,r){var i=this;if(r===void 0&&(r=!1),!this.renderer)return null;if(r){var o=this.renderer.getSize(sharedVector2);this.scene.traverseVisible(function(s){s.setResolution&&s.setResolution(o.x,o.y)})}return this.aroundScissor(function(){i.renderer&&(i.controller?(i.controller.render(i.onlyRenderIfNeeds?i.modelSceneNeedsRender:!0,i.postProcessingType),i.info={memory:__assign({},i.controller.renderer.info.memory),render:__assign({},i.controller.renderer.info.render)}):(i.renderer.render(i.scene,i.camera),i.info={memory:__assign({},i.renderer.info.memory),render:__assign({},i.renderer.info.render)}),i.poweredByRealsee&&i.currentMode!=="VRPanorama"&&i.currentMode!=="XRPanorama"&&i.renderer.getRenderTarget()!==i.getPixelsRenderTarget&&renderPoweredByRealsee(i.renderer)),e&&AnimationFrameLoop.shared.add(e,!0)}),null},t.prototype.updateTime=function(e,r){for(var i,o=this,s,u,c=[],l=2;l<arguments.length;l++)c[l-2]=arguments[l];if(!this.destroyed){if(this.works.update(),this.syncingState=this.syncState(e,r),this.controller&&(i=this.controller).updateTime.apply(i,__spreadArray([e,r],c,!1)),this.renderer&&(this.camera.pixelRatio=this.renderer.getPixelRatio(),this.getSize(this.camera.resolution),this.camera.aspect=this.camera.resolution.width/this.camera.resolution.height),this.camera.updateTime(e,r),this.renderer){ktx2.detectSupport(this.renderer);var d=this.models.loaded,f=this.models.refined;if(this.models.update(this.renderer,this.camera,this.currentMode),d===!1&&this.models.loaded===!0&&this.emit("models.load",createEvent("models.load",{models:this.models})),f===!1&&this.models.refined===!0&&this.emit("models.refined",createEvent("models.refined",{models:this.models})),this.models.loaded){for(var v=0,A=this.models;v<A.length;v++){var h=A[v];h.parent!==this.modelGroup&&(this.modelGroup.add(h),this.needsRender=!0,this.modelSceneNeedsRender=!0)}if(this.lastModels.length>0){for(var p=0,y=this.lastModels;p<y.length;p++){var h=y[p];this.modelGroup.remove(h),h.dispose(),this.needsRender=!0,this.modelSceneNeedsRender=!0}this.lastModels.length=0}this.lastWorks&&delete this.lastWorks}this.lastModels.setMaterial(this.models.getMaterial()),this.lastModels.materialVersion=this.models.materialVersion,this.lastModels.update(this.renderer,this.camera,this.currentMode)}this.syncingState=!1;var m=new THREE__namespace.Vector2(512,512),g=new THREE__namespace.Vector2(512,512);this.renderer&&(this.renderer.getSize(m),m.x*=this.scissor.width,m.y*=this.scissor.height,this.renderer.getDrawingBufferSize(g),g.x*=this.scissor.width,g.y*=this.scissor.height);{for(var E=new THREE__namespace.Box3,b=new THREE__namespace.Box3,T=new THREE__namespace.Vector3(4,4,4),_=0,S=this.works.resolvedObservers;_<S.length;_++){var R=S[_];b.setFromCenterAndSize(R.position,T),E.union(b)}if(E.union(this.models.bounding),this.lastWorks)for(var B=0,I=this.lastWorks.resolvedObservers;B<I.length;B++){var R=I[B];b.setFromCenterAndSize(R.position,T),E.union(b)}E.union(this.lastModels.bounding),E.getCenter(this.boundingMesh.position),E.getSize(this.boundingMesh.scale),this.boundingMesh.boundingBox.copy(E);var x=(s=this.models.getMaterial())!==null&&s!==void 0?s:{},M=1-((u=x.modelAlpha)!==null&&u!==void 0?u:0);x.opacity=clamp$1(M*4-3,0,1),x.clippers=null,x.shownFloorIndex=-2,this.boundingMesh.setMaterial(x),this.boundingMesh.needsRender=!1}var L=createEvent("render.prepare",{needsRender:!0,info:null});if(this.emit("render.prepare",L),!L.defaultPrevented){var C=[];sharedProjScreenMatrix.multiplyMatrices(this.camera.projectionMatrix,this.camera.matrixWorldInverse),sharedFrustum.setFromProjectionMatrix(sharedProjScreenMatrix);for(var H=0,F=this.scene.children;H<F.length;H++){var O=F[H];O!==this.modelGroup&&O!==this.boundingMesh&&O instanceof THREE__namespace.Object3D&&O.traverseVisible(function(z){if(z.setResolution&&z.setResolution(m.x,m.y),z.setTime&&z.setTime(e),z.mixer instanceof THREE__namespace.AnimationMixer){var K=clockForMixer.get(z.mixer);K||(K=new THREE__namespace.Clock,clockForMixer.set(z.mixer,K)),z.mixer.update(K.getDelta())}(z instanceof THREE__namespace.Mesh||z instanceof THREE__namespace.Line||z instanceof THREE__namespace.Points)&&(z instanceof THREE__namespace.ImmediateRenderObject||!z.frustumCulled||sharedFrustum.intersectsObject(z))&&C.push(z)})}if(g.width*g.height>4096*2048?this.renderSwitch01=this.renderSwitch01^1:this.renderSwitch01=0,this.renderer&&this.paused===!1&&this.renderSwitch01===0){var G=void 0;if(this.onlyRenderIfNeeds!==!0)G=this.render();else{if(this.controller&&(this.controller.needsRender===!0&&(this.controller.needsRender=!1,this.needsRender=!0),this.controller.modelSceneNeedsRender===!0&&(this.controller.modelSceneNeedsRender=!1,this.modelSceneNeedsRender=!0)),this.camera.needsRender===!0&&(this.camera.needsRender=!1,this.needsRender=!0,this.modelSceneNeedsRender=!0),this.models.needsRender===!0&&(this.models.needsRender=!1,this.needsRender=!0,this.modelSceneNeedsRender=!0),this.needsRender!==!0)for(var Q=0,U=C;Q<U.length;Q++){var D=U[Q],q=function(z){z.needsRender===!0?(z.needsRender=!1,o.needsRender=!0):z.mixer&&z.mixer.stats.actions.inUse>0&&(o.needsRender=!0)};q(D),D.traverseAncestors(q)}(this.needsRender!==!1||this.modelSceneNeedsRender!==!1)&&(G=this.render())}this.needsRender=!1,this.modelSceneNeedsRender=!1,this.hasListener("render")&&this.emit("render",createEvent("render",{needsRender:G!==void 0,info:this.info}))}this.needsRender=!1,this.modelSceneNeedsRender=!1}this.fps.testTime&&e-this.fps.testTime<1e3?this.fps.testCount++:(this.emit("fps",this.fps.testCount),this.fps.testTime=e,this.fps.testCount=0)}},t.prototype.pause=function(){this.paused=!0,this.renderer&&this.renderer instanceof InternalWebGLRenderer&&this.renderer.clear(!0,!0,!0)},t.prototype.play=function(){this.needsRender=!0,this.modelSceneNeedsRender=!0,this.paused=!1},t.prototype.moveToPano=function(e,r,i){r===void 0&&(r={}),i===void 0&&(i=!0);var o=this,s=o.controller,u=o.renderer;if(!s)return this.throwError(new Error("controller is not initialized.")),Promise.resolve();if(!u)return this.throwError(new Error("renderer is not initialized.")),Promise.resolve();var c=this.works.getResolvedObserver(e);if(!c)return this.throwError(new Error("pano ".concat(JSON.stringify(e)," not existed."))),Promise.resolve();var l={workCode:c.work.workCode,panoIndex:c.panoIndex};return"moveToPano"in s&&typeof s.moveToPano=="function"?s.moveToPano(l,r,i):c&&(this.pano=l,this.once("initAnimation.start",function(d){r.moveStartCallback&&r.moveStartCallback(d.state)}),this.once("initAnimation.end",function(d){r.moveEndCallback&&r.moveEndCallback(d.state)}),this.changeMode(t.Mode.Panorama,r,{effect:r.effect},i)),this.ready()},t.prototype.preloadPano=function(e,r){var i=this;r===void 0&&(r=noop$1);var o=this.works.getResolvedObserver(e);if(!o)return Promise.reject(new Error("Pano ".concat(JSON.stringify(e)," never found")));var s=["right","left","up","down","front","back"],u=now();return Promise.all(s.map(function(c){var l=__assign({key:"pano.".concat(o.panoId,".").concat(c)},pick(i.imageOptions,["size","format","quality","mappings"])),d=o.images[c],f=i.imageOptions.transform?i.imageOptions.transform(d,l):imageURL(d,l);return getFetcher(o.work).preload(f)})).then(function(){var c=now()-u;return r(c),c})},t.prototype.project2d=function(e,r){if(r===void 0&&(r=!1),!this.renderer)return null;if(this.models.length>0&&r){var i=this.camera.position,o=e.clone().sub(i),s=new THREE__namespace.Raycaster(i,o.clone().normalize());s.params.Points={threshold:.1};var u=this.models.intersectRaycaster(s)[0];if(u&&u.distance+.01<o.length())return null}var c=e.clone().project(this.camera);if(Math.abs(c.z)>1)return null;var l=this.renderer.getSize(new THREE__namespace.Vector2),d=l.x*this.scissor.width,f=l.y*this.scissor.height,v=l.x*this.scissor.left+(c.x+1)/2*d,A=l.y*(1-this.scissor.bottom-this.scissor.height)+(-c.y+1)/2*f;return new THREE__namespace.Vector2(v,A)},t.prototype.getRenderObjects=function(e){sharedProjScreenMatrix.multiplyMatrices(this.camera.projectionMatrix,this.camera.matrixWorldInverse),sharedFrustum.setFromProjectionMatrix(sharedProjScreenMatrix),e||(e=this.scene);var r=[];return e.traverseVisible(function(i){(i instanceof THREE__namespace.Mesh||i instanceof THREE__namespace.Line||i instanceof THREE__namespace.Points)&&(i instanceof THREE__namespace.ImmediateRenderObject||!i.frustumCulled||sharedFrustum.intersectsObject(i))&&r.push(i)}),r},t.prototype.getCurrentState=function(){return __assign(__assign({},this.getPose()),{mode:this.currentMode,workCode:this.pano.workCode,panoIndex:this.pano.panoIndex})},t.prototype.setState=function(e,r,i){var o,s,u,c,l,d,f,v,A,h;r===void 0&&(r=!1),i===void 0&&(i=!0),e=Object.assign({},e),e.offset&&!(e instanceof THREE__namespace.Vector3)&&(e.offset=new THREE__namespace.Vector3(e.offset.x,e.offset.y,e.offset.z));var p;typeof e.panoIndex=="number"&&(e.workCode?p={workCode:e.workCode,panoIndex:e.panoIndex}:p={workCode:(s=(o=this.work)===null||o===void 0?void 0:o.workCode)!==null&&s!==void 0?s:"",panoIndex:e.panoIndex});var y=(u=e.mode)!==null&&u!==void 0?u:this.state.mode,m,g,E,b,T;if((e.mode===t.Mode.Floorplan||e.mode===t.Mode.Topview||e.mode===t.Mode.Mapview||e.mode===t.Mode.Model)&&!this.models.loaded){this.throwError(new Error("model is not ready."));return}if(this.controller&&this.controller.stopMomentumMovement(),this.state.mode!==y){if(y==="VRPanorama"){this.changeMode("VRPanorama",void 0,void 0,!0);return}var _={workCode:p==null?void 0:p.workCode,panoIndex:p==null?void 0:p.panoIndex};typeof e.longitude=="number"&&(_.longitude=e.longitude),typeof e.latitude=="number"&&(_.latitude=e.latitude),typeof e.fov=="number"&&(_.fov=e.fov),typeof e.distance=="number"&&(_.distance=e.distance),e.offset instanceof THREE__namespace.Vector3&&(_.offset=e.offset);var S=__assign(__assign({initial:{state:_,currentState:this.getCurrentState(),duration:this.modeChangeDuration,effect:"fly",userAction:!1}},this.commonParams()),this.controllerInits[y]),R=Controllers[y].initAnimationEndState(S);m=R.longitude,g=R.latitude,E=R.fov,b=R.offset,T=R.distance}else m=(c=e.longitude)!==null&&c!==void 0?c:this.state.longitude,g=(l=e.latitude)!==null&&l!==void 0?l:this.state.latitude,E=(d=e.fov)!==null&&d!==void 0?d:this.state.fov,b=(f=e.offset)!==null&&f!==void 0?f:this.state.offset,T=(v=e.distance)!==null&&v!==void 0?v:this.state.distance;var B={workCode:(p!=null?p:this.pano).workCode,panoIndex:(p!=null?p:this.pano).panoIndex,mode:y,longitude:m,latitude:g,fov:E,offset:b,distance:T};this.emit("state.set",createEvent("state.set",{userAction:i,state:B})),stateEqual(this.state,B)||(this.controller&&B.mode==="VRPanorama"&&B.mode!==this.state.mode?(assignState(this.state,B),this.changeMode("VRPanorama")):this.controller&&B.mode==="XRPanorama"&&B.mode!==this.state.mode?(assignState(this.state,B),this.changeMode("XRPanorama")):(assignState(this.state,B),this.controller&&i&&(this.controller.userAction=!1),r&&this.state.mode===B.mode&&(this.syncingState=this.syncState(now(),0,r),this.syncingState&&((A=this.controller)===null||A===void 0||A.updateTime(now(),0),this.syncingState=!1)),this.emit("state.change",createEvent("state.change",{userAction:i,state:this.state})),(h=this.analysis)===null||h===void 0||h.state(this.works,this.state)))},t.prototype.aroundScissor=function(e){if(this.renderer){if(this.state.mode==="XRPanorama"){e();return}var r=new THREE__namespace.Vector2,i=this.scissor.left!==0||this.scissor.bottom!==0||this.scissor.width!==1||this.scissor.height!==1;if(i){this.renderer.getSize(r);var o=Math.floor(r.x*this.scissor.left),s=Math.floor(r.y*this.scissor.bottom),u=Math.floor(r.x*this.scissor.width),c=Math.floor(r.y*this.scissor.height);this.renderer.setViewport(o,s,u,c),this.renderer.setScissor(o,s,u,c),this.renderer.setScissorTest(!0)}e(),i&&(this.renderer.setViewport(0,0,r.x,r.y),this.renderer.setScissor(0,0,r.x,r.y),this.renderer.setScissorTest(!1))}},t.prototype.syncState=function(e,r,i){i===void 0&&(i=!1);var o=this.stateSynced;if(this.stateSynced=!1,this.works.length===0||!this.controller)return!1;if(this.state.mode!==this.currentMode){var s={mode:this.state.mode,workCode:this.state.workCode,panoIndex:this.state.panoIndex,longitude:this.state.longitude,latitude:this.state.latitude,fov:this.state.fov,offset:this.state.offset,distance:this.state.distance};return this.changeMode(this.state.mode,s,this.modeChangeDuration,this.controller.userAction),!0}if(!this.controller.isReady())return!1;if(this.controller instanceof Controllers.Model){if(notSimilarVector3(this.camera.pose.offset,this.state.offset)){var u={longitude:this.state.longitude,latitude:this.state.latitude,fov:this.state.fov,offset:this.state.offset};return this.controller.moveToPosition(this.state.offset,__assign(__assign({},u),{duration:i?0:void 0}),!1),!0}}else{var c={workCode:this.state.workCode,panoIndex:this.state.panoIndex};if(!panoEqual(c,this.pano)&&"moveToPano"in this.controller&&typeof this.controller.moveToPano=="function"){var u={longitude:this.state.longitude,latitude:this.state.latitude,fov:this.state.fov,offset:this.state.offset,distance:this.state.distance};return this.controller.moveToPano(c,u,!1),!0}}if(this.controller instanceof Controllers.Floorplan||this.controller instanceof Controllers.Topview||this.controller instanceof Controllers.Mapview){var l=1,d=.2,f=.2,v=Math.PI/45,A=i?this.state.fov:stepNumber(this.camera.pose.fov,this.state.fov,l),h=Math.abs(this.camera.pose.distance-this.state.distance),p=h>f*15?h/15:d,y=i?this.state.distance:stepNumber(this.camera.pose.distance,this.state.distance,p),m=this.camera.pose.offset.distanceTo(this.state.offset),g=m>f*15?m/15:f,E=i?new THREE__namespace.Vector3().copy(this.state.offset):stepVector(this.camera.pose.offset,this.state.offset,g),b=i?{longitude:this.state.longitude,latitude:this.state.latitude}:stepCoordinates({longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude},{longitude:this.state.longitude,latitude:this.state.latitude},v),T=b.longitude,_=b.latitude;if(notSimilarValue(A,this.camera.pose.fov)||notSimilarVector3(E,this.camera.pose.offset)||notSimilarValue(y,this.camera.pose.distance)||notSimilarValue(T,this.camera.pose.longitude,Math.PI*2)||notSimilarValue(_,this.camera.pose.latitude)){var S={x:E.x,y:E.y,z:E.z},R={fov:A};return Object.assign(S,{distance:y}),Object.assign(R,{longitude:T,latitude:_}),this.controller.stopMomentumMovement(),this.controller.cameraMotion.set(R,0).catch(noop$1),this.controller.locationMotion.set(S,0).catch(noop$1),!0}}else{var B=1,I=Math.PI/45,A=i?this.state.fov:stepNumber(this.camera.pose.fov,this.state.fov,B),x=i?{longitude:this.state.longitude,latitude:this.state.latitude}:stepCoordinates({longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude},{longitude:this.state.longitude,latitude:this.state.latitude},I),T=x.longitude,_=x.latitude,y=this.state.distance,E=new THREE__namespace.Vector3().copy(this.state.offset);if(notSimilarValue(y,this.camera.pose.distance)&&(this.state.distance=this.camera.pose.distance),notSimilarVector3(E,this.camera.pose.offset)&&(this.state.offset=this.camera.pose.offset.clone()),notSimilarValue(T,this.camera.pose.longitude,Math.PI*2)||notSimilarValue(_,this.camera.pose.latitude)||notSimilarValue(A,this.camera.pose.fov))return this.controller.stopMomentumMovement(),this.controller.cameraMotion.set({longitude:T,latitude:_,fov:A},0).catch(noop$1),!0}if(this.stateSynced=!0,o===!1&&this.emit("state.synced",createEvent("state.synced",{userAction:!1,state:this.state})),this.readyCallbacks.length&&this.stateSynced){var M=this.currentMode,L=M===t.Mode.Floorplan||M===t.Mode.Topview||M===t.Mode.Mapview||M===t.Mode.Model;if(!L||this.models.loaded){var C=this.readyCallbacks.slice();this.readyCallbacks.length=0;for(var H=0,F=C;H<F.length;H++){var O=F[H];this.controller instanceof Controllers.Panorama&&O.tile===!0&&!this.controller.isTileReady()?this.readyCallbacks.push(O):O()}}}return!1},t.prototype.ready=function(e){var r=this;return e===void 0&&(e={}),new Promise(function(i){var o;r.readyCallbacks.push(Object.assign(i,{tile:(o=e.tile)!==null&&o!==void 0?o:!1}))})},t.prototype.requestFullscreen=function(){var e;if(isMobile){var r=(e=this.getElement())===null||e===void 0?void 0:e.parentNode;r&&"requestFullscreen"in r&&typeof document!="undefined"&&document.fullscreenElement===null&&r.requestFullscreen()}},t.prototype.exitFullscreen=function(){typeof document!="undefined"&&document.fullscreenElement&&"exitFullscreen"in document&&document.exitFullscreen()},t.prototype.throwError=function(e){this.hasListener("error")?this.emit("error",e):console.error(e)},t.prototype.loadModel=function(e,r){for(var i=this,o=[],s=function(y){var m=u.models.filter(function(E){var b;return((b=E.work)===null||b===void 0?void 0:b.workCode)===y.workCode})[0];if(m)m.work=y,o.push(m);else{var g=new Model({onError:function(E){i.emit("model.error",createEvent("model.error",{work:y,model:g,error:E})),i.throwError(E)},onShownFloorChange:function(E){i.emit("model.changeShownFloor",createEvent("model.changeShownFloor",{work:y,model:g,error:null}))},onLoad:function(){i.emit("model.load",createEvent("model.load",{work:y,model:g,error:null}))}});o.push(g),u.emit("model.request",createEvent("model.request",{work:y,model:g,error:null})),g.load(y,{textureOptions:u.textureOptions,"3d-tiles":r["3d-tiles"]})}},u=this,c=0,l=e;c<l.length;c++){var d=l[c];s(d)}if(this.models.length>0){for(var f=0,v=this.models;f<v.length;f++){var A=v[f];o.indexOf(A)===-1&&this.lastModels.push(A)}this.models.length=0}for(var h=0,p=o;h<p.length;h++){var A=p[h];this.models.push(A)}return this.renderer&&(this.models.loaded=!1),new Promise(function(y){i.on("models.load",function(){y()})})},t.prototype.commonParams=function(){return{ident:this.ident,scene:this.scene,xrCustomObjectsScene:this.xrCustomObjectsScene,helper:this.helperGroup,boundingMesh:this.boundingMesh,camera:this.camera,renderer:this.renderer,scissor:this.scissor,element:this.getElement(),models:this.models,works:this.works,imageOptions:this.imageOptions,enableWheel:this.enableWheel,enableIOSEDR:this._enableIOSEDR,enableEDL:this.enableEDL,enableHQ:this.enableHQ,extraElements:this.extraElements,videoTexture:this.videoTexture,modelScene:this.modelScene,modelRenderTarget:this.modelRenderTarget}},t.prototype.applyController=function(e,r){var i=this;if(!this.renderer)throw new Error("renderer is not initialized.");e!==t.Mode.Mapview&&(this.enableEDL=!1,this.enableHQ=!1);var o=Controllers[e];this.currentMode=e;for(var s=new o(r),u=function(A){s.on(A,function(){for(var h=[],p=0;p<arguments.length;p++)h[p]=arguments[p];var y=i.emit.apply(i,__spreadArray([A],h,!1));if(y)return!1})},c=0,l=PROXY_CONTROLLER_EVENT_NAMES;c<l.length;c++){var d=l[c];u(d)}{var f=Controllers[e].initAnimationEndState(r),v=r.initial.userAction;stateEqual(this.state,f)||(assignState(this.state,f),this.emit("state.change",createEvent("state.change",{userAction:v,state:this.state}))),this.emit("currentState.change",createEvent("currentState.change",{userAction:v,state:this.getCurrentState()}))}return s.on("camera.update",function(A){var h;if(i.controller){var p=i.controller.getTargetState();A.userAction&&i.syncingState===!1&&i.state.mode===p.mode&&!stateEqual(i.state,p)&&(assignState(i.state,p),i.emit("state.change",createEvent("state.change",{userAction:A.userAction,state:i.state})),(h=i.analysis)===null||h===void 0||h.state(i.works,i.state))}i.emit("currentState.change",createEvent("currentState.change",{userAction:A.userAction,state:i.getCurrentState()}))}),s.on("initAnimation.start",function(A){var h,p=A.state,y=A.userAction;y&&i.state.mode===p.mode&&!stateEqual(i.state,p)&&(assignState(i.state,p),i.emit("state.change",createEvent("state.change",{userAction:y,state:i.state})),(h=i.analysis)===null||h===void 0||h.state(i.works,i.state))}),s.on("initAnimation.end",function(A){var h,p=A.state,y=A.userAction;y&&i.state.mode===p.mode&&!stateEqual(i.state,p)&&(assignState(i.state,p),i.emit("state.change",createEvent("state.change",{userAction:y,state:i.state})),(h=i.analysis)===null||h===void 0||h.state(i.works,i.state))}),s.on("pano.moveTo",function(A){var h,p=A.state,y=A.userAction;i.pano={workCode:p.workCode,panoIndex:p.panoIndex},y&&i.state.mode===p.mode&&!stateEqual(i.state,p)&&(assignState(i.state,p),i.emit("state.change",createEvent("state.change",{userAction:y,state:i.state})),(h=i.analysis)===null||h===void 0||h.state(i.works,i.state))}),s.on("pano.arrived",function(A){var h,p=A.state,y=A.userAction;y&&i.state.mode===p.mode&&!stateEqual(i.state,p)&&(assignState(i.state,p),i.emit("state.change",createEvent("state.change",{userAction:y,state:i.state})),(h=i.analysis)===null||h===void 0||h.state(i.works,i.state))}),s.on("pano.cancel",function(A){var h,p=A.state,y=A.userAction;y&&i.state.mode===p.mode&&!stateEqual(i.state,p)&&(assignState(i.state,p),i.emit("state.change",createEvent("state.change",{userAction:y,state:i.state})),(h=i.analysis)===null||h===void 0||h.state(i.works,i.state))}),s.on("pano.moveTo",function(A){var h=A.userAction;i.emit("currentState.change",createEvent("currentState.change",{userAction:h,state:i.getCurrentState()}))}),s.on("pano.request",function(A){i.emit("pano.request",A),A.defaultPrevented||i.moveToPano(A.state,A.options,A.userAction)}),s.on("vr.requestExit",function(){i.currentMode===t.Mode.VRPanorama&&(i.exitFullscreen(),i.changeMode(t.Mode.Panorama))}),s.on("error",function(A){return i.throwError(A)}),s},t.prototype.removeEventListeners=function(){},t.prototype.getWorkResources=function(e){var r=this,i,o=this.models.find(function(l){return l.work===e}),s=((i=o==null?void 0:o.viewLayers)!==null&&i!==void 0?i:[]).map(function(l){return l.scene});function u(l){var d=/([0-9a-z\.\_\-]+)([\?\#].*)?$/i.exec(l);if(d){var f=String(d[1]).trim().split(".").slice(1).reverse()[0];if(f)return f}return""}function c(l,d){d===void 0&&(d=0);var f=[];if(l.content&&l.content.uri){var v=u(l.content.uri);if(v==="json"){var A=imageURL(l.content.uri,{key:"model.".concat(d)});f.push({url:A,type:"tileset"})}else if(v==="at3d"&&l.extras[v]){var A=l.content.uri;f.push({url:A,type:"model"});for(var h=l.extras[v],p=h.textureArray,y=h.textureOptions,m=0,g=p;m<g.length;m++){var E=g[m],b=__assign({key:"texture.pbm"},pick(y,["format","quality","size","sharpen","mappings"])),T=applyImageURLOptions(E,y==null?void 0:y.transform,b);f.push({url:T,type:"texture"})}}else{var A=imageURL(l.content.uri,{key:"model.".concat(d)});f.push({url:A,type:"model"})}}if(l.children)for(var _=0;_<l.children.length;_++){var S=l.children[_];f.push.apply(f,c(S,_))}return f}return Promise.all(s.map(function(l){return l.loadAllTilesets()})).then(function(){for(var l=[],d=["right","left","up","down","front","back"],f=0,v=e.observers;f<v.length;f++){for(var A=v[f],h=0,p=d;h<p.length;h++){var y=p[h],m=__assign({key:"pano.".concat(panoStringify(A.pano),".").concat(y)},pick(r.imageOptions,["size","format","quality","mappings"])),g=A.images[y],E=applyImageURLOptions(g,r.imageOptions.transform,m);l.push({url:E,type:"pano"})}if(A.images.tiles)for(var b=0,T=A.images.tiles;b<T.length;b++)for(var _=T[b],S=0,R=d;S<R.length;S++)for(var y=R[S],B=_.size,I=Math.pow(2,_.level),x=1/I,M=0;M<I;M++)for(var L=0;L<I;L++){var C="".concat(A.panoId,".").concat(y,".").concat(_.level,".").concat(M,".").concat(L),m=__assign(__assign({key:"pano_tile.".concat(C)},pick(r.imageOptions,["format","size","quality","sharpen","mappings"])),{size:_.scale>=1?void 0:B*x*_.scale,cut:[B*x*L,B*x*M,B*x,B*x]}),E=applyImageURLOptions(_[y],r.imageOptions.transform,m);l.push({url:E,type:"pano_tile"})}}for(var H=0,F=s;H<F.length;H++){var O=F[H];O.tileset.url&&l.push({url:O.tileset.url,type:"model"}),l.push.apply(l,c(O.tileset.root))}return l})},t.Mode={Panorama:"Panorama",Model:"Model",Floorplan:"Floorplan",Topview:"Topview",Mapview:"Mapview",VRPanorama:"VRPanorama",XRPanorama:"XRPanorama"},t.Line=null,t}(Subscribe),__FIVE_DEBUG__={instances:{},constructor:Five};typeof window!="undefined"&&Object.assign(window,{__FIVE_DEBUG__});var XRButton=function(){function n(){}return n.createButton=function(t){var e=document.createElement("button");function r(){e.style.display="",e.style.cursor="pointer",e.style.left="calc(50% - 50px)",e.style.width="100px",e.textContent="ENTER VR",e.onmouseenter=function(){e.style.opacity="1.0"},e.onmouseleave=function(){e.style.opacity="0.5"},e.onclick=function(){t&&t()}}function i(){e.style.display="",e.style.cursor="auto",e.style.left="calc(50% - 75px)",e.style.width="150px",e.onmouseenter=null,e.onmouseleave=null,e.onclick=null}function o(){i(),e.textContent="VR NOT SUPPORTED"}function s(c){c.style.position="absolute",c.style.bottom="20px",c.style.padding="12px 6px",c.style.border="1px solid #fff",c.style.borderRadius="4px",c.style.background="rgba(0,0,0,0.1)",c.style.color="#fff",c.style.font="normal 13px sans-serif",c.style.textAlign="center",c.style.opacity="0.5",c.style.outline="none",c.style.zIndex="999"}if("xr"in navigator)return e.id="VRButton",e.style.display="none",s(e),navigator.xr.isSessionSupported("immersive-vr").then(function(c){c?r():o()}),e;var u=document.createElement("a");return window.isSecureContext===!1?(u.href=document.location.href.replace(/^http:/,"https:"),u.innerHTML="WEBXR NEEDS HTTPS"):(u.href="https://immersiveweb.dev/",u.innerHTML="WEBXR NOT AVAILABLE"),u.style.left="calc(50% - 90px)",u.style.width="180px",u.style.textDecoration="none",s(u),u},n}();exports.AnimationFrameLoop=AnimationFrameLoop,exports.Camera=Camera,exports.Fetcher=Fetcher,exports.Five=Five,exports.InternalWebGLRenderer=InternalWebGLRenderer,exports.IntersectMesh=IntersectMesh,exports.Model=Model,exports.ModelViewLayer=ModelViewLayer,exports.NetworkSubscribe=NetworkSubscribe,exports.PBMContainer=PBMContainer,exports.PBMGroup=PBMGroup,exports.PBMMesh=PBMMesh,exports.PBMMeshMaterial=PBMMeshMaterial,exports.PROXY_CONTROLLER_EVENT_NAMES=PROXY_CONTROLLER_EVENT_NAMES,exports.PanoCircleMesh=PanoCircleMesh,exports.PanoCircleMeshCustom=PanoCircleMeshCustom,exports.PanoCircleMeshSolid=PanoCircleMeshSolid,exports.Scene=Scene,exports.Subscribe=Subscribe,exports.TextureLoader=TextureLoader,exports.Tile=Tile,exports.Tile3DModel=Tile3DModel,exports.TileCache=TileCache,exports.TileCubeTextureTarget=TileCubeTextureTarget,exports.TileNode=TileNode,exports.TileRequestScheduler=TileRequestScheduler,exports.Tileset=Tileset,exports.Work=Work,exports.XRButton=XRButton,exports.defaultImageURLTransform=imageURL,exports.defaultPbmParameters=defaultPbmParameters,exports.getViewportScale=getViewportScale,exports.imageSupport=imageSupport,exports.isPanoId=isPanoId,exports.loadAt3d=loadAt3d,exports.loadB3dm=loadB3dm,exports.loadDome=loadDome,exports.loadDomez=loadDomez,exports.loadGlb=loadGlb,exports.loadPbm=loadPbm,exports.loadPnts=loadPnts,exports.panoEqual=panoEqual,exports.panoParse=panoParse,exports.panoStringify=panoStringify,exports.parseWork=parseWork,Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"})});
2071
+ `});A.depthTest=f.material.depthTest,A.side=f.material.side,u.meshReplaceMaterialMap.set(v,A),f.material=A}}});var c=this.renderer.getSize(new THREE__namespace.Vector2);this.camera.setViewOffset(c.width,c.height,e*o,r*o,1,1),this.renderer.setRenderTarget(this.gpuPickingRenderTarget),this.render();var l=new Uint8Array(4);this.renderer.readRenderTargetPixels(this.gpuPickingRenderTarget,0,0,1,1,l),this.renderer.setRenderTarget(null),this.camera.clearViewOffset(),this.scene.traverse(function(f){!(f instanceof THREE__namespace.Mesh)||f instanceof PBMMesh||u.meshOriginMaterialMap.get(f.uuid)&&(f.material=u.meshOriginMaterialMap.get(f.uuid))}),this.models.setMaterial({constantColor:null});var d=Object.keys(i).filter(function(f){return i[f].equals(new THREE__namespace.Color().setRGB(l[0]/255,l[1]/255,l[2]/255))})[0];return d||!1},t.prototype.dispose=function(){var e,r;if(this.destroyed!==!0){delete __FIVE_DEBUG__.instances[this.ident],this.emit("dispose"),this.destroyed=!0,this.pause(),this.stopAnimationLoop&&(this.stopAnimationLoop(),delete this.stopAnimationLoop),(e=this.renderer)===null||e===void 0||e.setAnimationLoop(null),this.off(),this.networkSubscribe.off(),this.controller&&(this.controller.destroy(),this.controller=void 0);var i=this.getElement();i&&i.parentNode&&i.parentNode.removeChild(i);var o=this.models.getMaterial();o&&(o.pano0&&o.pano0.map.dispose(),o.pano1&&o.pano1.map!==((r=o.pano0)===null||r===void 0?void 0:r.map)&&o.pano1.map.dispose());for(var s=0,u=this.models;s<u.length;s++){var c=u[s];c.dispose()}this.models.length=0,this.models.setMaterial({pano0:null,pano1:null}),this.meshReplaceMaterialMap.forEach(function(l){l.dispose()}),this.meshOriginMaterialMap.forEach(function(l){l.dispose()}),this.renderer instanceof InternalWebGLRenderer&&this.renderer.forceContextLoss&&this.renderer.forceContextLoss()}},t.prototype.setScissor=function(e){var r;if(Object.assign(this.scissor,e),this.controller&&this.controller.updateRenderSize){var i=new THREE__namespace.Vector2;(r=this.renderer)===null||r===void 0||r.getDrawingBufferSize(i),this.controller.updateRenderSize(i)}},Object.defineProperty(t.prototype,"helperVisible",{get:function(){return this.helperGroup.visible},set:function(e){this.helperGroup.visible!==e&&(this.helperGroup.visible=e,this.emit("helpers.visible",createEvent("helpers.visible",{object:this.helperGroup})),this.needsRender=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enableIOSEDR",{get:function(){return this._enableIOSEDR},set:function(e){this._enableIOSEDR!==e&&(this._enableIOSEDR=e,this.currentMode&&this.currentMode==="Panorama"&&this.changeMode(this.currentMode,this.getCurrentState(),0,!1,!0))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"postProcessingType",{get:function(){return this.currentMode==="Panorama"&&this.enableIOSEDR&&this.enablePostProcessing?"luminance":this.currentMode==="Mapview"&&this.enableEDL?"edl":this.currentMode==="Mapview"&&this.enableHQ?"hq":null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enableEDL",{get:function(){return this._enableEDL},set:function(e){if(e===!0&&this.currentMode!==t.Mode.Mapview)throw new Error("只支持Mapview下开启EDL");this._enableEDL!==e&&(this._enableEDL=e,this.boundingMesh.visible=!e,this.needsRender=!0,this.modelSceneNeedsRender=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enableHQ",{get:function(){return this._enableHQ},set:function(e){if(e===!0&&this.currentMode!==t.Mode.Mapview)throw new Error("只支持Mapview下开启HQ");this._enableHQ!==e&&(this._enableHQ=e,this.boundingMesh.visible=!e,this.needsRender=!0,this.modelSceneNeedsRender=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enablePostProcessing",{get:function(){return this._enablePostProcessing},set:function(e){this._enablePostProcessing!==e&&(this._enablePostProcessing=e),this.needsRender=!0,this.modelSceneNeedsRender=!0},enumerable:!1,configurable:!0}),t.prototype.updateConfiguration=function(e,r){r===void 0&&(r=!0);var i=!1;e.panorama&&(Object.assign(this.controllerInits.Panorama,e.panorama),this.currentMode==="Panorama"&&(i=!0)),e.model&&(Object.assign(this.controllerInits.Model,e.model),this.currentMode==="Model"&&(i=!0)),e.floorplan&&(Object.assign(this.controllerInits.Floorplan,e.floorplan),this.currentMode==="Floorplan"&&(i=!0)),e.topview&&(Object.assign(this.controllerInits.Topview,e.topview),this.currentMode==="Topview"&&(i=!0)),e.mapview&&(Object.assign(this.controllerInits.Mapview,e.mapview),this.currentMode==="Mapview"&&(i=!0)),e.vrPanorama&&(Object.assign(this.controllerInits.VRPanorama,e.vrPanorama),this.currentMode==="VRPanorama"&&(i=!0)),e.imageOptions&&(Object.assign(this.imageOptions,e.imageOptions),(this.currentMode==="Panorama"||this.currentMode==="VRPanorama")&&(i=!0)),e.textureOptions&&Object.assign(this.textureOptions,e.textureOptions),r&&i&&this.controller&&this.currentMode&&this.changeMode(this.currentMode,this.getCurrentState(),0,!1,!0)},t.prototype.appendTo=function(e,r){if(r===void 0&&(r={}),!!this.renderer){if(!(this.renderer instanceof InternalWebGLRenderer)){this.throwError(new Error("cannot call appendTo method when render a external renderer"));return}var i=this.getElement();if(i){e.appendChild(i),this.refresh(r);var o=window.getComputedStyle(e).position;o!=="relative"&&o!=="absolute"&&o!=="fixed"&&o!=="sticky"&&(e.style.position="relative")}}},t.prototype.refresh=function(e,r){if(e===void 0&&(e={}),!!this.renderer){var i=this.getElement();if(i){var o=i.parentNode;if(o&&o.nodeName){var s=e.width,u=s===void 0?o.offsetWidth:s,c=e.height,l=c===void 0?o.offsetHeight:c;this.renderer instanceof InternalWebGLRenderer&&(r&&this.renderer.setPixelRatio(r),this.renderer.setSize(u,l))}var d=new THREE__namespace.Vector2;if(this.renderer.getDrawingBufferSize(d),this.controller&&this.controller.updateRenderSize&&this.controller.updateRenderSize(d),this.modelRenderTarget.width!==d.x||this.modelRenderTarget.height!==d.y){this.modelRenderTarget.setSize(d.x,d.y),this.modelRenderTarget.depthTexture.dispose();var f=new THREE__namespace.DepthTexture(d.x,d.y);f.generateMipmaps=!1,f.format=THREE__namespace.DepthStencilFormat,f.type=THREE__namespace.UnsignedInt248Type,this.modelRenderTarget.depthTexture=f,this.modelRenderTarget.depthTexture.needsUpdate=!0}this.needsRender=!0,this.modelSceneNeedsRender=!0,this.render(noop$1,!0)}}},t.prototype.addExtraElement=function(e){var r=this;return this.extraElements.indexOf(e)===-1&&(this.extraElements.push(e),this.controller&&this.controller.bindExtraElement(e)),function(){return r.removeExtraElement(e)}},t.prototype.removeExtraElement=function(e){var r=this.extraElements.indexOf(e);r!==-1&&(this.extraElements.splice(r,1),this.controller&&this.controller.unbindExtraElement(e))},t.prototype.getPose=function(){var e=this.camera.copyPose(),r=e.longitude,i=e.latitude,o=e.fov,s=e.offset,u=e.distance;return{longitude:r,latitude:i,fov:o,offset:s.clone(),distance:u}},t.prototype.getSize=function(e){if(!this.renderer)throw new Error("renderer is not initialized");return this.renderer.getSize(e),e.x*=this.scissor.width,e.y*=this.scissor.height,e},t.prototype.getDrawingBufferSize=function(e){if(!this.renderer)throw new Error("renderer is not initialized");return this.renderer.getDrawingBufferSize(e),e.x*=this.scissor.width,e.y*=this.scissor.height,e},t.prototype.updateCamera=function(e,r,i){return i===void 0&&(i=!0),this.controller?this.controller.updateCamera(e,r,i):Promise.reject(new Error("controller is not initialized."))},t.prototype.updateCameraWithKeyframes=function(e,r,i){return i===void 0&&(i=!0),this.controller?this.controller.updateCameraWithKeyframes(e,r,i):Promise.reject(new Error("controller is not initialized."))},t.prototype.getLongitudeAndLatitude=function(){var e=this.getPose(),r=e.longitude,i=e.latitude;return{longitude:r,latitude:i}},t.prototype.getOffset=function(){return this.getPose().offset},t.prototype.getCameraLocal=function(){if(this.pano.workCode&&this.controller&&this.works){var e=this.works.getResolvedObserver(this.pano);if(e){var r=new THREE__namespace.Object3D;return r.position.copy(e.position),r.quaternion.copy(e.quaternion),r.scale.set(1,1,1),r.matrix.compose(r.position,r.quaternion,r.scale),r.matrixAutoUpdate=!1,cameraWorldToLocal(this.camera,r)}}return null},Object.defineProperty(t.prototype,"works",{get:function(){var e=worksMap.get(this);if(!e)return emptyWorks;for(var r=0,i=e;r<i.length;r++){var o=i[r];if(!workRawMapping.has(o))return emptyWorks}return e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"work",{get:function(){return this.works[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"model",{get:function(){return this.models[0]},enumerable:!1,configurable:!0}),t.prototype.load=function(e,r,i,o){var s=this;if(o===void 0&&(o=!0),!this.renderer)throw new Error("renderer is not initialized");var u=this.lastLoadWorkTask.then(function(){return isPromise(e)?e.then(function(c){return s.load_(c,r,i,o)}):s.load_(e,r,i,o)});return this.lastLoadWorkTask=u.catch(function(c){s.throwError(c)}),u},t.prototype.load_=function(e,r,i,o){var s=this,u,c,l,d,f,v,A,h,p;o===void 0&&(o=!0);var y={};typeof i=="number"?y.duration=i:typeof i=="object"&&Object.assign(y,i),this.controller||(y.duration=0,y.effect="instant");var m=[];if(Array.isArray(e))for(var g=0,E=e;g<E.length;g++){var b=E[g];typeof b!="string"&&"work"in b?m.push(parseWork(b.work,b)):m.push(parseWork(b))}else m.push(parseWork(e));for(var T=createWorks(m),_=function(J){var j=S,re=new Fetcher({allowHosts:J.allowHosts,get requestProxy(){return j.requestProxy},get networkSubscribe(){return j.networkSubscribe}});registerFetcher(J,re)},S=this,R=0,B=T;R<B.length;R++){var I=B[R];_(I)}this.lastWorks=this.works,r===void 0&&(r="inherit"),r==="inherit"&&this.lastWorks.length===0&&(r="initial");var x=T.initial,M=x.work.observers[0],L=M?{workCode:M.work.workCode,panoIndex:M.panoIndex}:{workCode:x.work.workCode,panoIndex:0},C=(u=x.mode)!==null&&u!==void 0?u:M?"Panorama":"Mapview",H={};if(r==="inherit"){C=this.currentMode;var F=T.resolvedObservers[this.panoIndex];F?L={workCode:F.work.workCode,panoIndex:F.panoIndex}:typeof T.initial.panoIndex=="number"?L={workCode:T.initial.work.workCode,panoIndex:T.initial.panoIndex}:(C==="Panorama"||C==="VRPanorama"||C==="XRPanorama")&&(C="Mapview"),H={longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude,fov:this.camera.pose.fov,distance:this.camera.pose.distance,offset:this.camera.pose.offset.clone()}}else if(r==="initial")typeof x.panoIndex=="number"&&(L={workCode:x.work.workCode,panoIndex:x.panoIndex}),x.mode&&(C=x.mode),H={longitude:x.longitude,latitude:x.latitude,fov:x.fov,distance:x.distance,offset:(c=x.offset)===null||c===void 0?void 0:c.clone()};else{if(C=(l=r.mode)!==null&&l!==void 0?l:this.currentMode,typeof r.panoIndex=="number"){var F=T.getResolvedObserver({workCode:(f=(d=r.workCode)!==null&&d!==void 0?d:x.work.workCode)!==null&&f!==void 0?f:"",panoIndex:r.panoIndex});F&&(L={workCode:F.work.workCode,panoIndex:F.panoIndex})}H={longitude:r.longitude,latitude:r.latitude,fov:r.fov,distance:r.distance,offset:r.offset}}var O=__assign(__assign(__assign({},L),{mode:C}),H);this.emit("works.request",createEvent("works.request",{input:e,works:T,state:O,userAction:o}));var G=function(){var J,j;s.pano=L;var re=(J=y.duration)!==null&&J!==void 0?J:s.modeChangeDuration,W="fly";(s.currentMode==="Panorama"||s.currentMode==="VRPanorama"||s.currentMode==="XRPanorama")&&s.currentMode===C&&(W=(j=y.effect)!==null&&j!==void 0?j:"fade");var te=__assign(__assign({initial:{state:O,currentState:s.getCurrentState(),duration:re,effect:W,userAction:o}},s.commonParams()),s.controllerInits[C]);if(s.controller&&s.currentMode===C)s.controller.updateWork(T,O,{effect:W,duration:re},o)===!1&&(s.controller.destroy(),s.controller=s.applyController(C,te));else{var $=s.currentMode,ne=Controllers[C].initAnimationEndState(te);if(s.controller)s.controller.destroy();else{var ee=Controllers[C].initAnimationEndState(te);s.camera.setFromPose(ee),s.modelGroup.visible=!0,s.emit("camera.update",createEvent("camera.update",{state:s.getCurrentState(),userAction:o}))}s.controller=s.applyController(C,te);var ce=createEvent("mode.change",{prevMode:$,mode:C,state:ne,userAction:o});s.emit("mode.change",ce)}};if(worksMap.set(this,T),!this.controller){var Q=__assign(__assign({initial:{state:O,currentState:this.getCurrentState(),duration:(v=y.duration)!==null&&v!==void 0?v:this.modeChangeDuration,effect:(A=y.effect)!==null&&A!==void 0?A:"fade",userAction:o}},this.commonParams()),this.controllerInits[C]),U=Controllers[C].initAnimationEndState(Q);this.camera.setFromPose(U),this.emit("camera.update",createEvent("camera.update",{state:this.getCurrentState(),userAction:o}))}if(this.updateConfiguration(y,!1),C===t.Mode.Floorplan||C===t.Mode.Topview||C===t.Mode.Mapview||C===t.Mode.Model)this.loadModel(T,y).then(function(){s.needsRender=!0,s.modelSceneNeedsRender=!0,G(),s.emit("camera.update",createEvent("camera.update",{state:s.getCurrentState(),userAction:o}))});else{if(!this.controller){var D=new THREE__namespace.Vector3,q=T.getResolvedObserver(L);q&&D.copy(q.position),this.camera.setFromPose({fov:H.fov,longitude:H.longitude,latitude:H.latitude,distance:H.distance,offset:(h=H.offset)!==null&&h!==void 0?h:D}),this.needsRender=!0,this.modelSceneNeedsRender=!0}G();var z=!1,K=function(){s.works===T&&z===!1&&(s.needsRender=!0,s.modelSceneNeedsRender=!0,s.emit("camera.update",createEvent("camera.update",{state:s.getCurrentState(),userAction:o})),s.loadModel(T,y),z=!0)};this.controller.once("pano.arrived",K),this.controller.once("pano.cancel",K),setTimeout(K,((p=y.duration)!==null&&p!==void 0?p:this.modeChangeDuration)+1e3)}return this.emit("works.load",createEvent("works.load",{input:e,state:this.getCurrentState(),userAction:o,works:T})),this.ready().then(function(){var J;s.emit("works.ready",createEvent("works.ready",{input:e,state:s.getCurrentState(),userAction:o,works:T})),(J=s.analysis)===null||J===void 0||J.work(T)})},t.prototype.reset=function(){var e=this,r=this.lastLoadWorkTask.then(function(){return e.reset_()});return this.lastLoadWorkTask=r.catch(function(i){e.throwError(i)}),r},t.prototype.reset_=function(){var e=this;return new Promise(function(r){var i;e.controller&&(e.controller.destroy(),e.controller=void 0);var o=e.models.getMaterial();o&&(o.pano0&&o.pano0.map.dispose(),o.pano1&&o.pano1.map!==((i=o.pano0)===null||i===void 0?void 0:i.map)&&o.pano1.map.dispose()),e.models.setMaterial({pano0:null,pano1:null});for(var s=0,u=e.models;s<u.length;s++){var c=u[s];e.lastModels.push(c)}if(e.models.length=0,e.lastModels.length>0){for(var l=0,d=e.lastModels;l<d.length;l++){var c=d[l];e.modelGroup.remove(c),c.dispose(),e.needsRender=!0,e.modelSceneNeedsRender=!0}e.lastModels.length=0}e.lastWorks&&delete e.lastWorks,worksMap.delete(e),e.currentMode="Panorama",e.pano={workCode:"",panoIndex:0},e.camera.setFromPose({distance:0,fov:DEFAULT_CAMERA_FOV,longitude:0,latitude:0,offset:new THREE__namespace.Vector3(0,0,0)}),e.state={mode:e.currentMode,workCode:e.pano.workCode,panoIndex:e.pano.panoIndex,longitude:e.camera.pose.longitude,latitude:e.camera.pose.latitude,fov:e.camera.pose.fov,offset:e.camera.pose.offset.clone(),distance:e.camera.pose.distance},e.models.needsRender=!1,e.camera.needsRender=!1,e.needsRender=!1,e.modelSceneNeedsRender=!1,r()})},t.prototype.changeMode=function(e,r,i,o,s){var u=this;return r===void 0&&(r={}),o===void 0&&(o=!0),s===void 0&&(s=!1),new Promise(function(c,l){var d,f,v,A;if(!u.renderer)throw new Error("renderer is not initialized.");r=__assign({},r);var h=0;u.controller&&(typeof i=="number"?h=i:h=(d=i==null?void 0:i.duration)!==null&&d!==void 0?d:u.modeChangeDuration);var p="fly";u.controller&&typeof i=="object"&&i.effect&&(p=i.effect);var y=typeof r.panoIndex=="number"?{workCode:(A=(f=r.workCode)!==null&&f!==void 0?f:(v=u.work)===null||v===void 0?void 0:v.workCode)!==null&&A!==void 0?A:"",panoIndex:r.panoIndex}:u.pano;if(!t.Mode.hasOwnProperty(e)){var m=new Error('mode "'.concat(e,'" is not existed'));u.throwError(m),l(m);return}if((e===t.Mode.Floorplan||e===t.Mode.Topview||e===t.Mode.Mapview||e===t.Mode.Model)&&!u.models.loaded){var m=new Error("model is not ready.");u.throwError(m),l(m);return}if((e===t.Mode.Panorama||e===t.Mode.VRPanorama||e===t.Mode.XRPanorama)&&!u.works.getResolvedObserver(y)){var m=new Error("PanoId ".concat(panoStringify(y)," not existed."));u.throwError(m),l(m);return}var g=u.controller,E=u.currentMode,b=function(){if(u.controller&&u.controller.stopMomentumMovement(),u.controller&&s===!1&&E===e)e===t.Mode.Panorama||e===t.Mode.Model||e===t.Mode.VRPanorama||e===t.Mode.XRPanorama?panoEqual(u.pano,y)&&"moveToPano"in u.controller&&typeof u.controller.moveToPano=="function"?u.controller.moveToPano(y,__assign({duration:h},r),o):u.controller.updateCamera(r,h,o).catch(noop$1):(panoEqual(u.pano,y)||(u.pano=y),u.controller.updateCamera(r,h,o).catch(noop$1));else{var _=__assign(__assign({},r),y),S=__assign(__assign({initial:{state:_,currentState:u.getCurrentState(),duration:h,effect:p,userAction:o}},u.commonParams()),u.controllerInits[e]),R=Controllers[e].initAnimationEndState(S),B=createEvent("mode.change.request",{prevMode:u.currentMode,mode:e,state:R,userAction:o});if(u.emit("mode.change.request",B),!B.defaultPrevented){g&&g.destroy(),u.controller=u.applyController(e,S);var I=createEvent("mode.change",{prevMode:u.currentMode,mode:e,state:R,userAction:o});u.emit("mode.change",I)}}c()};if(e===t.Mode.VRPanorama)u.requestFullscreen(),requestDeviceOrientationPermission().then(function(){return b()}).catch(function(_){_ instanceof Error&&(u.exitFullscreen(),u.throwError(_),l(_))});else if(e===t.Mode.XRPanorama){var T=AnimationFrameLoop.shared.getContext();T?T.end():requestXRSessionPermission().then(function(_){AnimationFrameLoop.shared.setContext(_),b()}).catch(function(_){_ instanceof Error&&(u.throwError(_),l(_))})}else b()})},t.prototype.getPixels=function(e,r,i,o,s,u,c){if(!this.renderer)throw new Error("renderer is not initialized.");var l=this.renderer.getPixelRatio(),d=this.renderer.getRenderTarget(),f=this.renderer.getSize(new THREE__namespace.Vector2);e=Math.ceil(e),r=Math.ceil(r),i=Math.ceil(i),o=Math.ceil(o),s=Math.ceil(s!=null?s:l),u=u!=null?u:!1;var v=this.getPixelsRenderTarget;v.setSize(i*s,o*s),this.renderer.setRenderTarget(v),this.camera.setViewOffset(f.width,f.height,e,f.height-r-o,i,o),this.camera.pixelRatio=s,this.camera.resolution.set(i,o),this.camera.aspect=this.camera.resolution.width/this.camera.resolution.height;for(var A=0,h=this.scene.children;A<h.length;A++){var p=h[A];p instanceof THREE__namespace.Object3D&&p.traverseVisible(function(x){x.setResolution&&x.setResolution(i*s/l,o*s/l)})}this.controller?(this.controller.updateRenderSize(new THREE__namespace.Vector2(i*s,o*s)),this.controller.render(!0,this.postProcessingType)):(this.renderer.render(this.scene,this.camera),this.renderer.autoClearDepth=!1,this.renderer.autoClearColor=!1,this.renderer.render(this.modelScene,this.camera),this.renderer.autoClearDepth=!0,this.renderer.autoClearColor=!0);var y=i*s,m=o*s,g=y*m,E=g*4,b;try{if(c){if(c.length!==E)throw new Error("buffer length is not equals pixels ".concat(E))}else c=new Uint8Array(E);if(this.renderer.readRenderTargetPixels(v,0,0,i*s,o*s,c),u)for(var T=g/2,_=0,S=0,R=0,B=0;S<T;S++)for(B=(m-Math.floor(S/y)-1)*y+S%y,R=0;R<4;R++)_=c[S*4+R],c[S*4+R]=c[B*4+R],c[B*4+R]=_}catch(x){b=x}if(this.renderer.setRenderTarget(d),this.controller&&this.controller.updateRenderSize){var I=new THREE__namespace.Vector2;this.renderer.getDrawingBufferSize(I),this.controller.updateRenderSize(I)}if(this.camera.clearViewOffset(),this.camera.pixelRatio=l,this.getSize(this.camera.resolution),this.camera.aspect=this.camera.resolution.width/this.camera.resolution.height,b)throw b;return c},t.prototype.getElement=function(){var e;return(e=this.renderer)===null||e===void 0?void 0:e.domElement},Object.defineProperty(t.prototype,"observers",{get:function(){return this.works.resolvedObservers},enumerable:!1,configurable:!0}),t.prototype.render=function(e,r){var i=this;if(r===void 0&&(r=!1),!this.renderer)return null;if(r){var o=this.renderer.getSize(sharedVector2);this.scene.traverseVisible(function(s){s.setResolution&&s.setResolution(o.x,o.y)})}return this.aroundScissor(function(){i.renderer&&(i.controller?(i.controller.render(i.onlyRenderIfNeeds?i.modelSceneNeedsRender:!0,i.postProcessingType),i.info={memory:__assign({},i.controller.renderer.info.memory),render:__assign({},i.controller.renderer.info.render)}):(i.renderer.render(i.scene,i.camera),i.info={memory:__assign({},i.renderer.info.memory),render:__assign({},i.renderer.info.render)}),i.poweredByRealsee&&i.currentMode!=="VRPanorama"&&i.currentMode!=="XRPanorama"&&i.renderer.getRenderTarget()!==i.getPixelsRenderTarget&&renderPoweredByRealsee(i.renderer)),e&&AnimationFrameLoop.shared.add(e,!0)}),null},t.prototype.updateTime=function(e,r){for(var i,o=this,s,u,c=[],l=2;l<arguments.length;l++)c[l-2]=arguments[l];if(!this.destroyed){if(this.works.update(),this.syncingState=this.syncState(e,r),this.controller&&(i=this.controller).updateTime.apply(i,__spreadArray([e,r],c,!1)),this.renderer&&(this.camera.pixelRatio=this.renderer.getPixelRatio(),this.getSize(this.camera.resolution),this.camera.aspect=this.camera.resolution.width/this.camera.resolution.height),this.camera.updateTime(e,r),this.renderer){ktx2.detectSupport(this.renderer);var d=this.models.loaded,f=this.models.refined;if(this.models.update(this.renderer,this.camera,this.currentMode),d===!1&&this.models.loaded===!0&&this.emit("models.load",createEvent("models.load",{models:this.models})),f===!1&&this.models.refined===!0&&this.emit("models.refined",createEvent("models.refined",{models:this.models})),this.models.loaded){for(var v=0,A=this.models;v<A.length;v++){var h=A[v];h.parent!==this.modelGroup&&(this.modelGroup.add(h),this.needsRender=!0,this.modelSceneNeedsRender=!0)}if(this.lastModels.length>0){for(var p=0,y=this.lastModels;p<y.length;p++){var h=y[p];this.modelGroup.remove(h),h.dispose(),this.needsRender=!0,this.modelSceneNeedsRender=!0}this.lastModels.length=0}this.lastWorks&&delete this.lastWorks}this.lastModels.setMaterial(this.models.getMaterial()),this.lastModels.materialVersion=this.models.materialVersion,this.lastModels.update(this.renderer,this.camera,this.currentMode)}this.syncingState=!1;var m=new THREE__namespace.Vector2(512,512),g=new THREE__namespace.Vector2(512,512);this.renderer&&(this.renderer.getSize(m),m.x*=this.scissor.width,m.y*=this.scissor.height,this.renderer.getDrawingBufferSize(g),g.x*=this.scissor.width,g.y*=this.scissor.height);{for(var E=new THREE__namespace.Box3,b=new THREE__namespace.Box3,T=new THREE__namespace.Vector3(4,4,4),_=0,S=this.works.resolvedObservers;_<S.length;_++){var R=S[_];b.setFromCenterAndSize(R.position,T),E.union(b)}if(E.union(this.models.bounding),this.lastWorks)for(var B=0,I=this.lastWorks.resolvedObservers;B<I.length;B++){var R=I[B];b.setFromCenterAndSize(R.position,T),E.union(b)}E.union(this.lastModels.bounding),E.getCenter(this.boundingMesh.position),E.getSize(this.boundingMesh.scale),this.boundingMesh.boundingBox.copy(E);var x=(s=this.models.getMaterial())!==null&&s!==void 0?s:{},M=1-((u=x.modelAlpha)!==null&&u!==void 0?u:0);x.opacity=clamp$1(M*4-3,0,1),x.clippers=null,x.shownFloorIndex=-2,this.boundingMesh.setMaterial(x),this.boundingMesh.needsRender=!1}var L=createEvent("render.prepare",{needsRender:!0,info:null});if(this.emit("render.prepare",L),!L.defaultPrevented){var C=[];sharedProjScreenMatrix.multiplyMatrices(this.camera.projectionMatrix,this.camera.matrixWorldInverse),sharedFrustum.setFromProjectionMatrix(sharedProjScreenMatrix);for(var H=0,F=this.scene.children;H<F.length;H++){var O=F[H];O!==this.modelGroup&&O!==this.boundingMesh&&O instanceof THREE__namespace.Object3D&&O.traverseVisible(function(z){if(z.setResolution&&z.setResolution(m.x,m.y),z.setTime&&z.setTime(e),z.mixer instanceof THREE__namespace.AnimationMixer){var K=clockForMixer.get(z.mixer);K||(K=new THREE__namespace.Clock,clockForMixer.set(z.mixer,K)),z.mixer.update(K.getDelta())}(z instanceof THREE__namespace.Mesh||z instanceof THREE__namespace.Line||z instanceof THREE__namespace.Points)&&(z instanceof THREE__namespace.ImmediateRenderObject||!z.frustumCulled||sharedFrustum.intersectsObject(z))&&C.push(z)})}if(g.width*g.height>4096*2048?this.renderSwitch01=this.renderSwitch01^1:this.renderSwitch01=0,this.renderer&&this.paused===!1&&this.renderSwitch01===0){var G=void 0;if(this.onlyRenderIfNeeds!==!0)G=this.render();else{if(this.controller&&(this.controller.needsRender===!0&&(this.controller.needsRender=!1,this.needsRender=!0),this.controller.modelSceneNeedsRender===!0&&(this.controller.modelSceneNeedsRender=!1,this.modelSceneNeedsRender=!0)),this.camera.needsRender===!0&&(this.camera.needsRender=!1,this.needsRender=!0,this.modelSceneNeedsRender=!0),this.models.needsRender===!0&&(this.models.needsRender=!1,this.needsRender=!0,this.modelSceneNeedsRender=!0),this.needsRender!==!0)for(var Q=0,U=C;Q<U.length;Q++){var D=U[Q],q=function(z){z.needsRender===!0?(z.needsRender=!1,o.needsRender=!0):z.mixer&&z.mixer.stats.actions.inUse>0&&(o.needsRender=!0)};q(D),D.traverseAncestors(q)}(this.needsRender!==!1||this.modelSceneNeedsRender!==!1)&&(G=this.render())}this.needsRender=!1,this.modelSceneNeedsRender=!1,this.hasListener("render")&&this.emit("render",createEvent("render",{needsRender:G!==void 0,info:this.info}))}this.needsRender=!1,this.modelSceneNeedsRender=!1}this.fps.testTime&&e-this.fps.testTime<1e3?this.fps.testCount++:(this.emit("fps",this.fps.testCount),this.fps.testTime=e,this.fps.testCount=0)}},t.prototype.pause=function(){this.paused=!0,this.renderer&&this.renderer instanceof InternalWebGLRenderer&&this.renderer.clear(!0,!0,!0)},t.prototype.play=function(){this.needsRender=!0,this.modelSceneNeedsRender=!0,this.paused=!1},t.prototype.moveToPano=function(e,r,i){r===void 0&&(r={}),i===void 0&&(i=!0);var o=this,s=o.controller,u=o.renderer;if(!s)return this.throwError(new Error("controller is not initialized.")),Promise.resolve();if(!u)return this.throwError(new Error("renderer is not initialized.")),Promise.resolve();var c=this.works.getResolvedObserver(e);if(!c)return this.throwError(new Error("pano ".concat(JSON.stringify(e)," not existed."))),Promise.resolve();var l={workCode:c.work.workCode,panoIndex:c.panoIndex};return"moveToPano"in s&&typeof s.moveToPano=="function"?s.moveToPano(l,r,i):c&&(this.pano=l,this.once("initAnimation.start",function(d){r.moveStartCallback&&r.moveStartCallback(d.state)}),this.once("initAnimation.end",function(d){r.moveEndCallback&&r.moveEndCallback(d.state)}),this.changeMode(t.Mode.Panorama,r,{effect:r.effect},i)),this.ready()},t.prototype.preloadPano=function(e,r){var i=this;r===void 0&&(r=noop$1);var o=this.works.getResolvedObserver(e);if(!o)return Promise.reject(new Error("Pano ".concat(JSON.stringify(e)," never found")));var s=["right","left","up","down","front","back"],u=now();return Promise.all(s.map(function(c){var l=__assign({key:"pano.".concat(o.panoId,".").concat(c)},pick(i.imageOptions,["size","format","quality","mappings"])),d=o.images[c],f=i.imageOptions.transform?i.imageOptions.transform(d,l):imageURL(d,l);return getFetcher(o.work).preload(f)})).then(function(){var c=now()-u;return r(c),c})},t.prototype.project2d=function(e,r){if(r===void 0&&(r=!1),!this.renderer)return null;if(this.models.length>0&&r){var i=this.camera.position,o=e.clone().sub(i),s=new THREE__namespace.Raycaster(i,o.clone().normalize());s.params.Points={threshold:.1};var u=this.models.intersectRaycaster(s)[0];if(u&&u.distance+.01<o.length())return null}var c=e.clone().project(this.camera);if(Math.abs(c.z)>1)return null;var l=this.renderer.getSize(new THREE__namespace.Vector2),d=l.x*this.scissor.width,f=l.y*this.scissor.height,v=l.x*this.scissor.left+(c.x+1)/2*d,A=l.y*(1-this.scissor.bottom-this.scissor.height)+(-c.y+1)/2*f;return new THREE__namespace.Vector2(v,A)},t.prototype.getRenderObjects=function(e){sharedProjScreenMatrix.multiplyMatrices(this.camera.projectionMatrix,this.camera.matrixWorldInverse),sharedFrustum.setFromProjectionMatrix(sharedProjScreenMatrix),e||(e=this.scene);var r=[];return e.traverseVisible(function(i){(i instanceof THREE__namespace.Mesh||i instanceof THREE__namespace.Line||i instanceof THREE__namespace.Points)&&(i instanceof THREE__namespace.ImmediateRenderObject||!i.frustumCulled||sharedFrustum.intersectsObject(i))&&r.push(i)}),r},t.prototype.getCurrentState=function(){return __assign(__assign({},this.getPose()),{mode:this.currentMode,workCode:this.pano.workCode,panoIndex:this.pano.panoIndex})},t.prototype.setState=function(e,r,i){var o,s,u,c,l,d,f,v,A,h;r===void 0&&(r=!1),i===void 0&&(i=!0),e=Object.assign({},e),e.offset&&!(e instanceof THREE__namespace.Vector3)&&(e.offset=new THREE__namespace.Vector3(e.offset.x,e.offset.y,e.offset.z));var p;typeof e.panoIndex=="number"&&(e.workCode?p={workCode:e.workCode,panoIndex:e.panoIndex}:p={workCode:(s=(o=this.work)===null||o===void 0?void 0:o.workCode)!==null&&s!==void 0?s:"",panoIndex:e.panoIndex});var y=(u=e.mode)!==null&&u!==void 0?u:this.state.mode,m,g,E,b,T;if((e.mode===t.Mode.Floorplan||e.mode===t.Mode.Topview||e.mode===t.Mode.Mapview||e.mode===t.Mode.Model)&&!this.models.loaded){this.throwError(new Error("model is not ready."));return}if(this.controller&&this.controller.stopMomentumMovement(),this.state.mode!==y){if(y==="VRPanorama"){this.changeMode("VRPanorama",void 0,void 0,!0);return}var _={workCode:p==null?void 0:p.workCode,panoIndex:p==null?void 0:p.panoIndex};typeof e.longitude=="number"&&(_.longitude=e.longitude),typeof e.latitude=="number"&&(_.latitude=e.latitude),typeof e.fov=="number"&&(_.fov=e.fov),typeof e.distance=="number"&&(_.distance=e.distance),e.offset instanceof THREE__namespace.Vector3&&(_.offset=e.offset);var S=__assign(__assign({initial:{state:_,currentState:this.getCurrentState(),duration:this.modeChangeDuration,effect:"fly",userAction:!1}},this.commonParams()),this.controllerInits[y]),R=Controllers[y].initAnimationEndState(S);m=R.longitude,g=R.latitude,E=R.fov,b=R.offset,T=R.distance}else m=(c=e.longitude)!==null&&c!==void 0?c:this.state.longitude,g=(l=e.latitude)!==null&&l!==void 0?l:this.state.latitude,E=(d=e.fov)!==null&&d!==void 0?d:this.state.fov,b=(f=e.offset)!==null&&f!==void 0?f:this.state.offset,T=(v=e.distance)!==null&&v!==void 0?v:this.state.distance;var B={workCode:(p!=null?p:this.pano).workCode,panoIndex:(p!=null?p:this.pano).panoIndex,mode:y,longitude:m,latitude:g,fov:E,offset:b,distance:T};this.emit("state.set",createEvent("state.set",{userAction:i,state:B})),stateEqual(this.state,B)||(this.controller&&B.mode==="VRPanorama"&&B.mode!==this.state.mode?(assignState(this.state,B),this.changeMode("VRPanorama")):this.controller&&B.mode==="XRPanorama"&&B.mode!==this.state.mode?(assignState(this.state,B),this.changeMode("XRPanorama")):(assignState(this.state,B),this.controller&&i&&(this.controller.userAction=!1),r&&this.state.mode===B.mode&&(this.syncingState=this.syncState(now(),0,r),this.syncingState&&((A=this.controller)===null||A===void 0||A.updateTime(now(),0),this.syncingState=!1)),this.emit("state.change",createEvent("state.change",{userAction:i,state:this.state})),(h=this.analysis)===null||h===void 0||h.state(this.works,this.state)))},t.prototype.aroundScissor=function(e){if(this.renderer){if(this.state.mode==="XRPanorama"){e();return}var r=new THREE__namespace.Vector2,i=this.scissor.left!==0||this.scissor.bottom!==0||this.scissor.width!==1||this.scissor.height!==1;if(i){this.renderer.getSize(r);var o=Math.floor(r.x*this.scissor.left),s=Math.floor(r.y*this.scissor.bottom),u=Math.floor(r.x*this.scissor.width),c=Math.floor(r.y*this.scissor.height);this.renderer.setViewport(o,s,u,c),this.renderer.setScissor(o,s,u,c),this.renderer.setScissorTest(!0)}e(),i&&(this.renderer.setViewport(0,0,r.x,r.y),this.renderer.setScissor(0,0,r.x,r.y),this.renderer.setScissorTest(!1))}},t.prototype.syncState=function(e,r,i){i===void 0&&(i=!1);var o=this.stateSynced;if(this.stateSynced=!1,this.works.length===0||!this.controller)return!1;if(this.state.mode!==this.currentMode){var s={mode:this.state.mode,workCode:this.state.workCode,panoIndex:this.state.panoIndex,longitude:this.state.longitude,latitude:this.state.latitude,fov:this.state.fov,offset:this.state.offset,distance:this.state.distance};return this.changeMode(this.state.mode,s,this.modeChangeDuration,this.controller.userAction),!0}if(!this.controller.isReady())return!1;if(this.controller instanceof Controllers.Model){if(notSimilarVector3(this.camera.pose.offset,this.state.offset)){var u={longitude:this.state.longitude,latitude:this.state.latitude,fov:this.state.fov,offset:this.state.offset};return this.controller.moveToPosition(this.state.offset,__assign(__assign({},u),{duration:i?0:void 0}),!1),!0}}else{var c={workCode:this.state.workCode,panoIndex:this.state.panoIndex};if(!panoEqual(c,this.pano)&&"moveToPano"in this.controller&&typeof this.controller.moveToPano=="function"){var u={longitude:this.state.longitude,latitude:this.state.latitude,fov:this.state.fov,offset:this.state.offset,distance:this.state.distance};return this.controller.moveToPano(c,u,!1),!0}}if(this.controller instanceof Controllers.Floorplan||this.controller instanceof Controllers.Topview||this.controller instanceof Controllers.Mapview){var l=1,d=.2,f=.2,v=Math.PI/45,A=i?this.state.fov:stepNumber(this.camera.pose.fov,this.state.fov,l),h=Math.abs(this.camera.pose.distance-this.state.distance),p=h>f*15?h/15:d,y=i?this.state.distance:stepNumber(this.camera.pose.distance,this.state.distance,p),m=this.camera.pose.offset.distanceTo(this.state.offset),g=m>f*15?m/15:f,E=i?new THREE__namespace.Vector3().copy(this.state.offset):stepVector(this.camera.pose.offset,this.state.offset,g),b=i?{longitude:this.state.longitude,latitude:this.state.latitude}:stepCoordinates({longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude},{longitude:this.state.longitude,latitude:this.state.latitude},v),T=b.longitude,_=b.latitude;if(notSimilarValue(A,this.camera.pose.fov)||notSimilarVector3(E,this.camera.pose.offset)||notSimilarValue(y,this.camera.pose.distance)||notSimilarValue(T,this.camera.pose.longitude,Math.PI*2)||notSimilarValue(_,this.camera.pose.latitude)){var S={x:E.x,y:E.y,z:E.z},R={fov:A};return Object.assign(S,{distance:y}),Object.assign(R,{longitude:T,latitude:_}),this.controller.stopMomentumMovement(),this.controller.cameraMotion.set(R,0).catch(noop$1),this.controller.locationMotion.set(S,0).catch(noop$1),!0}}else{var B=1,I=Math.PI/45,A=i?this.state.fov:stepNumber(this.camera.pose.fov,this.state.fov,B),x=i?{longitude:this.state.longitude,latitude:this.state.latitude}:stepCoordinates({longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude},{longitude:this.state.longitude,latitude:this.state.latitude},I),T=x.longitude,_=x.latitude,y=this.state.distance,E=new THREE__namespace.Vector3().copy(this.state.offset);if(notSimilarValue(y,this.camera.pose.distance)&&(this.state.distance=this.camera.pose.distance),notSimilarVector3(E,this.camera.pose.offset)&&(this.state.offset=this.camera.pose.offset.clone()),notSimilarValue(T,this.camera.pose.longitude,Math.PI*2)||notSimilarValue(_,this.camera.pose.latitude)||notSimilarValue(A,this.camera.pose.fov))return this.controller.stopMomentumMovement(),this.controller.cameraMotion.set({longitude:T,latitude:_,fov:A},0).catch(noop$1),!0}if(this.stateSynced=!0,o===!1&&this.emit("state.synced",createEvent("state.synced",{userAction:!1,state:this.state})),this.readyCallbacks.length&&this.stateSynced){var M=this.currentMode,L=M===t.Mode.Floorplan||M===t.Mode.Topview||M===t.Mode.Mapview||M===t.Mode.Model;if(!L||this.models.loaded){var C=this.readyCallbacks.slice();this.readyCallbacks.length=0;for(var H=0,F=C;H<F.length;H++){var O=F[H];this.controller instanceof Controllers.Panorama&&O.tile===!0&&!this.controller.isTileReady()?this.readyCallbacks.push(O):O()}}}return!1},t.prototype.ready=function(e){var r=this;return e===void 0&&(e={}),new Promise(function(i){var o;r.readyCallbacks.push(Object.assign(i,{tile:(o=e.tile)!==null&&o!==void 0?o:!1}))})},t.prototype.requestFullscreen=function(){var e;if(isMobile){var r=(e=this.getElement())===null||e===void 0?void 0:e.parentNode;r&&"requestFullscreen"in r&&typeof document!="undefined"&&document.fullscreenElement===null&&r.requestFullscreen()}},t.prototype.exitFullscreen=function(){typeof document!="undefined"&&document.fullscreenElement&&"exitFullscreen"in document&&document.exitFullscreen()},t.prototype.throwError=function(e){this.hasListener("error")?this.emit("error",e):console.error(e)},t.prototype.loadModel=function(e,r){for(var i=this,o=[],s=function(y){var m=u.models.filter(function(E){var b;return((b=E.work)===null||b===void 0?void 0:b.workCode)===y.workCode})[0];if(m)m.work=y,o.push(m);else{var g=new Model({onError:function(E){i.emit("model.error",createEvent("model.error",{work:y,model:g,error:E})),i.throwError(E)},onShownFloorChange:function(E){i.emit("model.changeShownFloor",createEvent("model.changeShownFloor",{work:y,model:g,error:null}))},onLoad:function(){i.emit("model.load",createEvent("model.load",{work:y,model:g,error:null}))}});o.push(g),u.emit("model.request",createEvent("model.request",{work:y,model:g,error:null})),g.load(y,{textureOptions:u.textureOptions,"3d-tiles":r["3d-tiles"]})}},u=this,c=0,l=e;c<l.length;c++){var d=l[c];s(d)}if(this.models.length>0){for(var f=0,v=this.models;f<v.length;f++){var A=v[f];o.indexOf(A)===-1&&this.lastModels.push(A)}this.models.length=0}for(var h=0,p=o;h<p.length;h++){var A=p[h];this.models.push(A)}return this.renderer&&(this.models.loaded=!1),new Promise(function(y){i.on("models.load",function(){y()})})},t.prototype.commonParams=function(){return{ident:this.ident,scene:this.scene,xrCustomObjectsScene:this.xrCustomObjectsScene,helper:this.helperGroup,boundingMesh:this.boundingMesh,camera:this.camera,renderer:this.renderer,scissor:this.scissor,element:this.getElement(),models:this.models,works:this.works,imageOptions:this.imageOptions,enableWheel:this.enableWheel,enableIOSEDR:this._enableIOSEDR,enableEDL:this.enableEDL,enableHQ:this.enableHQ,extraElements:this.extraElements,videoTexture:this.videoTexture,modelScene:this.modelScene,modelRenderTarget:this.modelRenderTarget}},t.prototype.applyController=function(e,r){var i=this;if(!this.renderer)throw new Error("renderer is not initialized.");e!==t.Mode.Mapview&&(this.enableEDL=!1,this.enableHQ=!1);var o=Controllers[e];this.currentMode=e;for(var s=new o(r),u=function(A){s.on(A,function(){for(var h=[],p=0;p<arguments.length;p++)h[p]=arguments[p];var y=i.emit.apply(i,__spreadArray([A],h,!1));if(y)return!1})},c=0,l=PROXY_CONTROLLER_EVENT_NAMES;c<l.length;c++){var d=l[c];u(d)}{var f=Controllers[e].initAnimationEndState(r),v=r.initial.userAction;stateEqual(this.state,f)||(assignState(this.state,f),this.emit("state.change",createEvent("state.change",{userAction:v,state:this.state}))),this.emit("currentState.change",createEvent("currentState.change",{userAction:v,state:this.getCurrentState()}))}return s.on("camera.update",function(A){var h;if(i.controller){var p=i.controller.getTargetState();A.userAction&&i.syncingState===!1&&i.state.mode===p.mode&&!stateEqual(i.state,p)&&(assignState(i.state,p),i.emit("state.change",createEvent("state.change",{userAction:A.userAction,state:i.state})),(h=i.analysis)===null||h===void 0||h.state(i.works,i.state))}i.emit("currentState.change",createEvent("currentState.change",{userAction:A.userAction,state:i.getCurrentState()}))}),s.on("initAnimation.start",function(A){var h,p=A.state,y=A.userAction;y&&i.state.mode===p.mode&&!stateEqual(i.state,p)&&(assignState(i.state,p),i.emit("state.change",createEvent("state.change",{userAction:y,state:i.state})),(h=i.analysis)===null||h===void 0||h.state(i.works,i.state))}),s.on("initAnimation.end",function(A){var h,p=A.state,y=A.userAction;y&&i.state.mode===p.mode&&!stateEqual(i.state,p)&&(assignState(i.state,p),i.emit("state.change",createEvent("state.change",{userAction:y,state:i.state})),(h=i.analysis)===null||h===void 0||h.state(i.works,i.state))}),s.on("pano.moveTo",function(A){var h,p=A.state,y=A.userAction;i.pano={workCode:p.workCode,panoIndex:p.panoIndex},y&&i.state.mode===p.mode&&!stateEqual(i.state,p)&&(assignState(i.state,p),i.emit("state.change",createEvent("state.change",{userAction:y,state:i.state})),(h=i.analysis)===null||h===void 0||h.state(i.works,i.state))}),s.on("pano.arrived",function(A){var h,p=A.state,y=A.userAction;y&&i.state.mode===p.mode&&!stateEqual(i.state,p)&&(assignState(i.state,p),i.emit("state.change",createEvent("state.change",{userAction:y,state:i.state})),(h=i.analysis)===null||h===void 0||h.state(i.works,i.state))}),s.on("pano.cancel",function(A){var h,p=A.state,y=A.userAction;y&&i.state.mode===p.mode&&!stateEqual(i.state,p)&&(assignState(i.state,p),i.emit("state.change",createEvent("state.change",{userAction:y,state:i.state})),(h=i.analysis)===null||h===void 0||h.state(i.works,i.state))}),s.on("pano.moveTo",function(A){var h=A.userAction;i.emit("currentState.change",createEvent("currentState.change",{userAction:h,state:i.getCurrentState()}))}),s.on("pano.request",function(A){i.emit("pano.request",A),A.defaultPrevented||i.moveToPano(A.state,A.options,A.userAction)}),s.on("vr.requestExit",function(){i.currentMode===t.Mode.VRPanorama&&(i.exitFullscreen(),i.changeMode(t.Mode.Panorama))}),s.on("error",function(A){return i.throwError(A)}),s},t.prototype.removeEventListeners=function(){},t.prototype.getWorkResources=function(e){var r=this,i,o=this.models.find(function(l){return l.work===e}),s=((i=o==null?void 0:o.viewLayers)!==null&&i!==void 0?i:[]).map(function(l){return l.scene});function u(l){var d=/([0-9a-z\.\_\-]+)([\?\#].*)?$/i.exec(l);if(d){var f=String(d[1]).trim().split(".").slice(1).reverse()[0];if(f)return f}return""}function c(l,d){d===void 0&&(d=0);var f=[];if(l.content&&l.content.uri){var v=u(l.content.uri);if(v==="json"){var A=imageURL(l.content.uri,{key:"model.".concat(d)});f.push({url:A,type:"tileset"})}else if(v==="at3d"&&l.extras[v]){var A=l.content.uri;f.push({url:A,type:"model"});for(var h=l.extras[v],p=h.textureArray,y=h.textureOptions,m=0,g=p;m<g.length;m++){var E=g[m],b=__assign({key:"texture.pbm"},pick(y,["format","quality","size","sharpen","mappings"])),T=applyImageURLOptions(E,y==null?void 0:y.transform,b);f.push({url:T,type:"texture"})}}else{var A=imageURL(l.content.uri,{key:"model.".concat(d)});f.push({url:A,type:"model"})}}if(l.children)for(var _=0;_<l.children.length;_++){var S=l.children[_];f.push.apply(f,c(S,_))}return f}return Promise.all(s.map(function(l){return l.loadAllTilesets()})).then(function(){for(var l=[],d=["right","left","up","down","front","back"],f=0,v=e.observers;f<v.length;f++){for(var A=v[f],h=0,p=d;h<p.length;h++){var y=p[h],m=__assign({key:"pano.".concat(panoStringify(A.pano),".").concat(y)},pick(r.imageOptions,["size","format","quality","mappings"])),g=A.images[y],E=applyImageURLOptions(g,r.imageOptions.transform,m);l.push({url:E,type:"pano"})}if(A.images.tiles)for(var b=0,T=A.images.tiles;b<T.length;b++)for(var _=T[b],S=0,R=d;S<R.length;S++)for(var y=R[S],B=_.size,I=Math.pow(2,_.level),x=1/I,M=0;M<I;M++)for(var L=0;L<I;L++){var C="".concat(A.panoId,".").concat(y,".").concat(_.level,".").concat(M,".").concat(L),m=__assign(__assign({key:"pano_tile.".concat(C)},pick(r.imageOptions,["format","size","quality","sharpen","mappings"])),{size:_.scale>=1?void 0:B*x*_.scale,cut:[B*x*L,B*x*M,B*x,B*x]}),E=applyImageURLOptions(_[y],r.imageOptions.transform,m);l.push({url:E,type:"pano_tile"})}}for(var H=0,F=s;H<F.length;H++){var O=F[H];O.tileset.url&&l.push({url:O.tileset.url,type:"model"}),l.push.apply(l,c(O.tileset.root))}return l})},t.Mode={Panorama:"Panorama",Model:"Model",Floorplan:"Floorplan",Topview:"Topview",Mapview:"Mapview",VRPanorama:"VRPanorama",XRPanorama:"XRPanorama"},t.Line=null,t}(Subscribe),__FIVE_DEBUG__={instances:{},constructor:Five};typeof window!="undefined"&&Object.assign(window,{__FIVE_DEBUG__});var XRButton=function(){function n(){}return n.createButton=function(t){var e=document.createElement("button");function r(){e.style.display="",e.style.cursor="pointer",e.style.left="calc(50% - 50px)",e.style.width="100px",e.textContent="ENTER VR",e.onmouseenter=function(){e.style.opacity="1.0"},e.onmouseleave=function(){e.style.opacity="0.5"},e.onclick=function(){t&&t()}}function i(){e.style.display="",e.style.cursor="auto",e.style.left="calc(50% - 75px)",e.style.width="150px",e.onmouseenter=null,e.onmouseleave=null,e.onclick=null}function o(){i(),e.textContent="VR NOT SUPPORTED"}function s(c){c.style.position="absolute",c.style.bottom="20px",c.style.padding="12px 6px",c.style.border="1px solid #fff",c.style.borderRadius="4px",c.style.background="rgba(0,0,0,0.1)",c.style.color="#fff",c.style.font="normal 13px sans-serif",c.style.textAlign="center",c.style.opacity="0.5",c.style.outline="none",c.style.zIndex="999"}if("xr"in navigator)return e.id="VRButton",e.style.display="none",s(e),navigator.xr.isSessionSupported("immersive-vr").then(function(c){c?r():o()}),e;var u=document.createElement("a");return window.isSecureContext===!1?(u.href=document.location.href.replace(/^http:/,"https:"),u.innerHTML="WEBXR NEEDS HTTPS"):(u.href="https://immersiveweb.dev/",u.innerHTML="WEBXR NOT AVAILABLE"),u.style.left="calc(50% - 90px)",u.style.width="180px",u.style.textDecoration="none",s(u),u},n}();exports.AnimationFrameLoop=AnimationFrameLoop,exports.Camera=Camera,exports.Fetcher=Fetcher,exports.Five=Five,exports.InternalWebGLRenderer=InternalWebGLRenderer,exports.IntersectMesh=IntersectMesh,exports.Model=Model,exports.ModelViewLayer=ModelViewLayer,exports.NetworkSubscribe=NetworkSubscribe,exports.PBMContainer=PBMContainer,exports.PBMGroup=PBMGroup,exports.PBMMesh=PBMMesh,exports.PBMMeshMaterial=PBMMeshMaterial,exports.PROXY_CONTROLLER_EVENT_NAMES=PROXY_CONTROLLER_EVENT_NAMES,exports.PanoCircleMesh=PanoCircleMesh,exports.PanoCircleMeshCustom=PanoCircleMeshCustom,exports.PanoCircleMeshSolid=PanoCircleMeshSolid,exports.Scene=Scene,exports.Subscribe=Subscribe,exports.TextureLoader=TextureLoader,exports.Tile=Tile,exports.Tile3DModel=Tile3DModel,exports.TileCache=TileCache,exports.TileCubeTextureTarget=TileCubeTextureTarget,exports.TileNode=TileNode,exports.TileRequestScheduler=TileRequestScheduler,exports.Tileset=Tileset,exports.Work=Work,exports.XRButton=XRButton,exports.defaultImageURLTransform=imageURL,exports.defaultPbmParameters=defaultPbmParameters,exports.getViewportScale=getViewportScale,exports.imageSupport=imageSupport,exports.isPanoId=isPanoId,exports.loadAt3d=loadAt3d,exports.loadB3dm=loadB3dm,exports.loadDome=loadDome,exports.loadDomez=loadDomez,exports.loadGlb=loadGlb,exports.loadPbm=loadPbm,exports.loadPnts=loadPnts,exports.panoEqual=panoEqual,exports.panoParse=panoParse,exports.panoStringify=panoStringify,exports.parseWork=parseWork,Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"})});