@realsee/five 6.7.0-alpha.34 → 6.7.0-alpha.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/five/index.js +3 -3
- package/five/index.mjs +6 -4
- package/gltf-loader/index.js +2 -2
- package/gltf-loader/index.mjs +2 -2
- package/line/index.js +2 -2
- package/line/index.mjs +2 -2
- package/package.json +1 -1
- package/plugins/index.js +1 -1
- package/plugins/index.mjs +1 -1
- package/react/index.js +1 -1
- package/react/index.mjs +1 -1
- package/shader-lib/index.js +1 -1
- package/shader-lib/index.mjs +1 -1
- package/sticker/index.js +2 -2
- package/sticker/index.mjs +2 -2
- package/umd/five-gltf-loader.js +2 -2
- package/umd/five-line.js +2 -2
- package/umd/five-plugins.js +1 -1
- package/umd/five-react.js +1 -1
- package/umd/five-shader-lib.js +1 -1
- package/umd/five-sticker.js +2 -2
- package/umd/five-vfx.js +1 -1
- package/umd/five-vue.js +1 -1
- package/umd/five.js +3 -3
- package/vfx/index.js +1 -1
- package/vfx/index.mjs +1 -1
- package/vue/index.js +1 -1
- package/vue/index.mjs +1 -1
- package/work-downloader/index.js +1 -1
- package/work-downloader/index.mjs +1 -1
package/five/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @license
|
|
3
3
|
* @realsee/five
|
|
4
4
|
* Generated: 12/23/2025
|
|
5
|
-
* Version: 6.7.0-alpha.
|
|
5
|
+
* Version: 6.7.0-alpha.35
|
|
6
6
|
* Terms:
|
|
7
7
|
* Realsee SDK License Agreement
|
|
8
8
|
* Update: July 28, 2021
|
|
@@ -2148,7 +2148,7 @@ void main() {
|
|
|
2148
2148
|
|
|
2149
2149
|
gl_FragColor = vec4(gl_FragColor.rgb, gl_FragColor.a * opacity * outside * inside);
|
|
2150
2150
|
}
|
|
2151
|
-
`,PanoSphereMesh=(function(n){__extends(t,n);function t(){var e=n.call(this)||this;e.progress=0,e.opacity=0,e.loading=!1,e.current=!1,e.disabled=!1,e.currentMotion=new Motion({ringScale:1.1,ringOpacity:0,circleFade:0,circleOpacity:.85,circleScale:1}),e.opacityMotion=new Motion({opacity:0}),e.loadingMotion=new Motion({opacity:0}),e.disableMotion=new Motion({opacity:0});var r={blending:THREE__namespace.CustomBlending,blendSrc:THREE__namespace.SrcAlphaFactor,blendDst:THREE__namespace.OneMinusSrcAlphaFactor,blendSrcAlpha:THREE__namespace.OneFactor,blendDstAlpha:THREE__namespace.OneMinusSrcAlphaFactor,depthWrite:!1,transparent:!0};return e.hitTestMesh=new THREE__namespace.Mesh(sharedGeometry,new THREE__namespace.MeshBasicMaterial(__assign(__assign({},r),{color:0,opacity:0}))),e.hitTestMesh.scale.set(1.5,1.5,1.5),e.ringMesh=new THREE__namespace.Mesh(sharedGeometry,new THREE__namespace.ShaderMaterial(__assign(__assign({},r),{vertexShader:ringVertexShader,fragmentShader:ringFragmentShader,uniforms:{opacity:{value:0}}}))),e.panoMesh=new THREE__namespace.Mesh(sharedGeometry,new THREE__namespace.ShaderMaterial(__assign(__assign({},r),{vertexShader,fragmentShader,uniforms:{circleScale:{value:1.1},circleFade:{value:0},circleOpacity:{value:.5},loadingAngle:{value:0},loadingOpacity:{value:0},opacity:{value:0},disable:{value:0}}}))),e.add(e.hitTestMesh),e.add(e.ringMesh),e.add(e.panoMesh),e.renderOrder=1e4,e.needsRender=!0,e}return t.prototype.setProgress=function(e){this.progress=e,this.setLoading(e>0)},t.prototype.setOpacity=function(e){this.opacity!==e&&(this.opacity=e=clamp$1(e,0,1),this.opacityMotion.set({opacity:e},30).catch(noop))},t.prototype.setCurrent=function(e){if(this.current!==e){if(e){var r=[{progress:0,value:{ringScale:2,ringOpacity:0,circleFade:0,circleOpacity:.85,circleScale:1}},{progress:.05,value:{ringScale:1,ringOpacity:1,circleFade:0,circleOpacity:.85,circleScale:1}},{progress:.15,value:{ringScale:1.2,ringOpacity:1,circleFade:0,circleOpacity:.85,circleScale:1}},{progress:.25,value:{ringScale:1.1,ringOpacity:1,circleFade:0,circleOpacity:.85,circleScale:1}},{progress:.8,value:{ringScale:1.1,ringOpacity:1,circleFade:1,circleOpacity:.85,circleScale:1}},{progress:.9,value:{ringScale:1.1,ringOpacity:1,circleFade:1,circleOpacity:.65,circleScale:.8}},{progress:.92,value:{ringScale:1.1,ringOpacity:1,circleFade:1,circleOpacity:.65,circleScale:.8}},{progress:1,value:{ringScale:1.1,ringOpacity:1,circleFade:1,circleOpacity:.85,circleScale:1.1}}];this.currentMotion.setKeyframes(r,1500).catch(noop)}else{var r=[{progress:0,value:__assign({},this.currentMotion.value)},{progress:1,value:{ringScale:1.1,ringOpacity:0,circleFade:0,circleOpacity:.85,circleScale:1}}];this.currentMotion.setKeyframes(r,200).catch(noop)}this.current=e}},t.prototype.setLoading=function(e){this.loading!==e&&(e?this.loadingMotion.setKeyframes([{progress:0,value:{opacity:0}},{progress:.3,value:{opacity:0}},{progress:1,value:{opacity:.8}}],500).catch(noop):this.loadingMotion.set({opacity:0},0).catch(noop),this.loading=e,this.disabled===!0&&this.setDisabled(!1),this.needsRender=!0)},t.prototype.setDisabled=function(e){this.disabled!==e&&(this.disabled=e,this.loading===!0&&this.setLoading(!1),this.disableMotion.set({opacity:e?1:0},300).catch(noop),this.needsRender=!0)},t.prototype.tap=function(){return Promise.resolve()},t.prototype.updateTime=function(e,r){this.opacityMotion.update(e),this.currentMotion.update(e),this.loadingMotion.update(e);var o=this.opacityMotion.value.opacity;this.visible=o!==0;var s=this.currentMotion.value,u=s.ringScale,l=s.ringOpacity,c=s.circleFade,f=s.circleOpacity,p=s.circleScale;this.ringMesh.scale.set(u,1,u),this.ringMesh.material.uniforms.opacity.value=l*o,this.panoMesh.material.uniforms.opacity.value=o,this.panoMesh.material.uniforms.circleOpacity.value=f,this.panoMesh.material.uniforms.circleScale.value=p,this.panoMesh.material.uniforms.circleFade.value=c,this.panoMesh.material.uniforms.loadingOpacity.value=this.loadingMotion.value.opacity,this.panoMesh.material.uniforms.disable.value=this.disableMotion.value.opacity,this.panoMesh.material.uniforms.loadingAngle.value=e/120%(Math.PI*2),this.needsRender=!0},t.prototype.dispose=function(){this.hitTestMesh.material.dispose(),this.ringMesh.material.dispose(),this.panoMesh.material.dispose()},t})(THREE__namespace.Object3D),ACTIVE_TO_CURRENT_DELAY=1500,defaultVRPanoramaControllerCustomInitArgs=__assign({},omit(defaultPanoramaControllerCustomInitArgs,["maxLatitude","minLatitude"])),VRPanoramaController=(function(n){__extends(t,n);function t(e){var r=this,o=t.parseArgs(e);r=n.call(this,o)||this,r.mode="VRPanorama",r.cardboard=new Cardboard(r.renderer);var s=createHelper();r.helperElement=s;var u=new Hammer(s);return r.element.parentNode&&(r.element.parentNode.insertBefore(s,r.element),r.updateHelperElementSize(),u.on("tap",function(){return r.emit("vr.requestExit",createEvent("vr.requestExit",{}))})),r.destroyHelper=function(){u.destroy(),s.parentNode&&s.parentNode.removeChild(s),r.helperElement=void 0},r}return t.parseArgs=function(e){if(e instanceof t)return e;var r=__assign(__assign({},e),{maxLatitude:Math.PI/2,minLatitude:-Math.PI/2});return n.parseArgs.call(this,r)},t.initAnimationEndState=function(e){var r=this.parseArgs(e),o=n.initAnimationEndState.call(this,r);return __assign(__assign({},o),{mode:"VRPanorama"})},t.prototype.updateConfiguration=function(e){return n.prototype.updateConfiguration.call(this,__assign(__assign({},e),{maxLatitude:Math.PI/2,minLatitude:-Math.PI/2}))},t.prototype.destroy=function(){n.prototype.destroy.call(this),this.cardboard.dispose(),this.destroyHelper()},t.prototype.isReady=function(){return!1},t.prototype.updateRenderSize=function(){this.needsRender=!0},t.prototype.updateCamera=function(e,r,o){return Promise.resolve()},t.prototype.updateCameraWithKeyframes=function(e,r,o){return Promise.resolve()},t.prototype.updateTime=function(e,r){var o=this,s,u,l,c,f,p;if(!this.destroyed){this.updateHelperElementSize(),this.userAction=!0,this.needsRender=!0;var d={},h={},g=this.locationMotion.keyframes[0],m=this.locationMotion.keyframes[this.locationMotion.keyframes.length-1],E=this.locationMotion.getKeyFrameSegment(e),y=E[0],v=E[1],A=this.panoResourceFromLocationMotionKeyframe(y),b=this.panoResourceFromLocationMotionKeyframe(v),T=this.panoResourceFromLocationMotionKeyframe(g),_=this.panoResourceFromLocationMotionKeyframe(m),S=!1;if(this.modelAlphaMotion.ended===!1&&(this.modelAlphaMotion.update(e),d.modelAlpha=this.modelAlphaMotion.value.modelAlpha),this.perspToOrthoMotion.ended===!1&&(this.perspToOrthoMotion.update(e),this.camera.perspToOrtho.setScalar(clamp$1(this.perspToOrthoMotion.value.perspToOrtho,0,1))),this.locationMotion.ended===!1){this.locationMotion.update(e);var w=this.locationMotion.value.count-v.value.count+1,R=new THREE__namespace.Vector3().copy(A.position),I=new THREE__namespace.Vector3().copy(b.position);if(d.progress=w,w>=.01&&w<=.99&&(d.progress=clamp$1(b.effectEasing(w),.01,.99)),b.panoPicture&&(w<1?A.panoPicture&&(d.pano0=A.panoPicture):d.pano0=b.panoPicture,d.pano1=b.panoPicture),b.effect==="montage"?d.transition="BLACK":b.effect==="spread"?d.transition="SPREAD":d.transition="FADE",b.effect==="zoomin"||b.effect==="zoomout")d.progress=Math.pow(w,3);else if(b.effect==="model"&&this.camera.pose.distance<.01){var H=1-Math.pow(clamp$1(Math.abs(w-.5)*2,0,1),4);d.modelAlpha=H}if(w<1&&b.effect!=="fly"){if(d.pano0&&A.panoPicture){var C={panoId:d.pano0.panoId,map:d.pano0.map,mapSize:d.pano0.mapSize,zoom:d.pano0.zoom,matrix:A.panoPicture.matrix.clone().setPosition(b.position)},M=this.panoPictureObserverMap.get(d.pano0);M&&this.panoPictureObserverMap.set(C,M),d.pano0=C}R.copy(I),S=!0}h.distance=this.locationMotion.value.distance,h.offset=new THREE__namespace.Vector3(R.x+(I.x-R.x)*w,R.y+(I.y-R.y)*w,R.z+(I.z-R.z)*w);for(var B=[],L=[],O=0,k=this.locationMotion.keyframes;O<k.length;O++){var D=k[O],q=D.key,z=D.progress;q!==void 0&&(B.push(q),z>this.locationMotion.progress&&L.push(q))}for(var J=0,V=Object.keys(this.panoResources);J<V.length;J++){var U=V[J];if(!(L.indexOf(U)>=0)){var j=this.panoResources[U];if(j.panoPicture){var K=j.panoPicture.map;if(K){if(K===((s=d.pano0)===null||s===void 0?void 0:s.map)||K===((u=d.pano1)===null||u===void 0?void 0:u.map))continue;K.dispose(),j.panoPicture=null}}B.indexOf(U)>=0||delete this.panoResources[U]}}this.currentPano=panoParse(b.panoId),this.emit("pano.moving",createEvent("pano.moving",{userAction:this.userAction,prevPano:panoParse(T.panoId),state:__assign(__assign(__assign(__assign({},panoParse(_.panoId)),{mode:this.mode}),clonePose(this.camera.pose)),h),options:{},progress:this.locationMotion.progress,error:null}))}isEmptyObject(d)===!1&&this.modelScene.parameter.set(d),h.offset&&this.camera.position.copy(h.offset);var ae=this.camera.pose.longitude,re=this.camera.pose.latitude;this.camera.quaternion.fromArray(this.cardboard.sensor.getOrientation()),this.camera.computePose(),(ae!==this.camera.pose.longitude||re!==this.camera.pose.latitude)&&(this.cameraMotion.set(pick(this.camera.pose,["longitude","latitude"]),0).catch(noop),this.emit("camera.update",createEvent("camera.update",{userAction:!0,state:__assign(__assign(__assign({},this.currentPano),{mode:this.mode}),clonePose(this.camera.pose))}))),this.works.getObserver(this.currentPano);var ee=this.works.getObserver(A.panoId),Z=this.works.getObserver(b.panoId),X=new Map;if(ee)for(var se=0,G=ee.accessibleNodes;se<G.length;se++){var W=G[se],M=ee.work.observers[W];if(M){var $=panoStringify({panoIndex:M.panoIndex,workCode:M.work.workCode});X.set($,M)}}if(Z)for(var ne=0,te=Z.accessibleNodes;ne<te.length;ne++){var W=te[ne],M=Z.work.observers[W];if(M){var $=panoStringify({panoIndex:M.panoIndex,workCode:M.work.workCode});X.set($,M)}}if(this.panoMeshes.forEach(function(Se,ze){var Fe=X.get(ze);Fe?(Se.position.copy(Fe.position).applyMatrix4(Fe.work.transform),X.delete(ze)):(o.helper.remove(Se),Se.dispose(),o.panoMeshes.delete(ze))}),X.forEach(function(Se,ze){var Fe=new PanoSphereMesh;Fe.position.copy(Se.position).applyMatrix4(Se.work.transform);var Oe=Se.position.distanceTo(Se.standingPosition)>o.aerialObserverMinHeight;Oe?Fe.scale.setScalar(15):Fe.scale.setScalar(1),o.panoMeshes.set(ze,Fe),o.helper.add(Fe),X.delete(ze)}),this.camera.pose.distance>.1||S?this.panoMeshes.forEach(function(Se,ze){Se.setOpacity(0),Se.updateTime&&Se.updateTime(e,r),Se.visible=!1}):this.panoMeshes.forEach(function(Se,ze){var Fe=panoParse(ze),Oe=o.works.getObserver(Fe);if(Oe){if(!Oe.loadable&&!Oe.active){Se.setOpacity(0);return}var Le=Se.position.clone().setY(o.camera.position.y).distanceTo(o.camera.position);Le<.05?Se.setOpacity(0):Se.setOpacity(clamp$1(1.5/Le,0,1)),panoEqual(o.currentPano,Fe)&&Se.setOpacity(0),Se.lookAt(o.camera.position)}}),this.locationMotion.ended){var ve=this.intersect(e);this.panoMeshes.forEach(function(Se,ze){Se.setCurrent(Se===ve),Se.updateTime&&Se.updateTime(e,r)})}{var w=(l=this.modelScene.parameter.progress)!==null&&l!==void 0?l:1,oe=Math.round(w),fe=this.modelScene.parameter.pano0,be=this.modelScene.parameter.pano1,ie=oe===0?fe:be,M=void 0;if(ie&&(M=this.works.getObserver(ie.panoId),M||(M=this.panoPictureObserverMap.get(ie))),this.tiling.appearDuration=this.tileAppearDuration,this.tiling.maxRequest=w<(canUseNativeImageBitmap()?.6:.99)?0:this.tileMaxRequest,this.tiling.imageOptions=this.imageOptions,!M||!ie||this.tileLevelForFov===!1||this.camera.perspToOrtho.x>0){this.tiling.setObserver(null);var ue={renderer:this.renderer,resolution:this.camera.resolution,pixelRatio:this.camera.pixelRatio,time:this.camera.time,cameraMatrix:this.camera.matrixWorld,cameraProjectionMatrix:this.camera.projectionMatrix,panoMap:null,panoMatrix:new THREE__namespace.Matrix4,panoZoom:1,minLevel:0,level:0};this.tiling.update(ue),this.modelScene.parameter.set("refinedScreen",null)}else{var me=getImageSizeLevel(ie.mapSize),ge=me+1,Ae=new THREE__namespace.Vector2().copy(this.camera.resolution).multiplyScalar(this.camera.pixelRatio),xe=Math.floor(this.tileLevelForFov(this.camera.fov,Ae)),de=xe>me?xe:0;this.tiling.setObserver(M);var ue={renderer:this.renderer,resolution:this.camera.resolution,pixelRatio:this.camera.pixelRatio,time:this.camera.time,cameraMatrix:this.camera.matrixWorld,cameraProjectionMatrix:this.camera.projectionMatrix,panoMap:ie.map,panoMatrix:ie.matrix,panoZoom:ie.zoom,minLevel:ge,level:de},_e=this.tiling.update(ue),He={map:this.tiling.renderTarget.texture,matrixInverse:this.tiling.camera.matrixWorldInverse,projectionMatrix:this.tiling.camera.projectionMatrix,pano:oe,opacity:(fe==null?void 0:fe.panoId)===(be==null?void 0:be.panoId)?1:easeInQuart(Math.abs(((c=this.modelScene.parameter.progress)!==null&&c!==void 0?c:0)-.5)*2)},Ee=this.modelScene.parameter.refinedScreen;(_e||He.pano!==(Ee==null?void 0:Ee.pano)||He.opacity!==(Ee==null?void 0:Ee.opacity))&&this.modelScene.parameter.set("refinedScreen",He)}}this.panoVideo.object.position.copy(this.camera.position),this.panoVideo.updateTime(e);{var pe=b.effect,Ve=this.modelScene.parameter,fe=Ve.pano0,be=Ve.pano1;if(fe&&be&&fe!==be&&(pe==="fly"||pe==="model")&&this.flyEffectUseDepthBuffer){if(((f=this.modelScene.parameter.pano0Depth)===null||f===void 0?void 0:f.panoId)!==fe.panoId||((p=this.modelScene.parameter.pano1Depth)===null||p===void 0?void 0:p.panoId)!==be.panoId){var ye=500,Pe=512;this.pano0DepthCubeRenderTarget?this.pano0DepthCubeRenderTarget.width!==Pe&&this.pano0DepthCubeRenderTarget.setSize(Pe,Pe):this.pano0DepthCubeRenderTarget=new THREE__namespace.WebGLCubeRenderTarget(Pe,{minFilter:THREE__namespace.NearestFilter,magFilter:THREE__namespace.NearestFilter,generateMipmaps:!1}),this.pano1DepthCubeRenderTarget?this.pano1DepthCubeRenderTarget.width!==Pe&&this.pano1DepthCubeRenderTarget.setSize(Pe,Pe):this.pano1DepthCubeRenderTarget=new THREE__namespace.WebGLCubeRenderTarget(Pe,{minFilter:THREE__namespace.NearestFilter,magFilter:THREE__namespace.NearestFilter,generateMipmaps:!1});var Ce=new THREE__namespace.CubeCamera(this.camera.near,this.camera.far,this.pano0DepthCubeRenderTarget);Ce.matrix.copy(fe.matrix),Ce.matrixWorld.copy(Ce.matrix),Ce.matrixAutoUpdate=!1,renderDepthCube(this.renderer,this.modelScene,Ce,ye);var $e=new THREE__namespace.CubeCamera(this.camera.near,this.camera.far,this.pano1DepthCubeRenderTarget);$e.matrix.copy(be.matrix),$e.matrixWorld.copy($e.matrix),$e.matrixAutoUpdate=!1,renderDepthCube(this.renderer,this.modelScene,$e,ye),this.modelScene.parameter.set({pano0Depth:{panoId:fe.panoId,map:this.pano0DepthCubeRenderTarget.texture,mapSize:this.pano0DepthCubeRenderTarget.width,maxDepth:ye},pano1Depth:{panoId:be.panoId,map:this.pano1DepthCubeRenderTarget.texture,mapSize:this.pano1DepthCubeRenderTarget.width,maxDepth:ye}})}}else this.modelScene.parameter.set({pano0Depth:null,pano1Depth:null}),this.flyEffectUseDepthBuffer||(this.pano0DepthCubeRenderTarget&&(this.pano0DepthCubeRenderTarget.dispose(),this.pano0DepthCubeRenderTarget=void 0),this.pano1DepthCubeRenderTarget&&(this.pano1DepthCubeRenderTarget.dispose(),this.pano1DepthCubeRenderTarget=void 0))}}},t.prototype.render=function(){return this.renderer.setRenderTarget(null),this.renderer.setScissorTest(!1),this.cardboard.render(this.scene,this.camera),!0},t.prototype.setCamera=function(e){},t.prototype.destroyHelper=function(){},t.prototype.updateHelperElementSize=function(){if(this.helperElement){var e=new THREE__namespace.Vector2(this.element.offsetWidth,this.element.offsetHeight),r=e.x*this.viewport.left,o=e.y*(1-this.viewport.bottom-this.viewport.height),s=e.x*this.viewport.width,u=e.y*this.viewport.height;this.helperElement.style.marginLeft!==r+"px"&&(this.helperElement.style.marginLeft=r+"px"),this.helperElement.style.marginTop!==o+"px"&&(this.helperElement.style.marginTop=o+"px"),this.helperElement.style.width!==s+"px"&&(this.helperElement.style.width=s+"px"),this.helperElement.style.height!==u+"px"&&(this.helperElement.style.height=u+"px")}},t.prototype.intersect=function(e){var r,o;if(this.locationMotion.ended===!1){this.intersectMesh.visible=!1,this.activePanoMesh=void 0,this.activeTime=void 0;return}if(this.activePanoMesh&&this.activeTime&&e-this.activeTime>ACTIVE_TO_CURRENT_DELAY){var s=this.activePanoMesh,u=null;return this.panoMeshes.forEach(function(R,I){R===s&&(u=I)}),u!==null&&this.moveToPano(panoParse(u),{},!0),this.activePanoMesh=void 0,this.activeTime=void 0,s}var l=this.camera.getDirection(new THREE__namespace.Vector3),c=new THREE__namespace.Raycaster(this.camera.position,l);c.params.Points={threshold:.1},c.firstHitOnly=!0,c.floorIndex=-1;for(var f=void 0,p=[],d=this.works.getObserver(this.currentPano),h=d?d.accessibleNodes.map(function(R){return panoStringify({panoIndex:R,workCode:d.work.workCode})}):[],g=0,m=h;g<m.length;g++){var E=m[g],y=this.panoMeshes.get(E);if(y){var v=c.intersectObject((r=y.hitTestMesh)!==null&&r!==void 0?r:y,!0)[0];if(v){var A=(o=d==null?void 0:d.floorIndex)!==null&&o!==void 0?o:0;p.push({panoMesh:y,intersection:__assign({floorIndex:A,floor:A},v)})}}}var b=p.sort(function(R,I){return R.intersection.distance-I.intersection.distance})[0];b?(f=b.intersection,this.activePanoMesh!==b.panoMesh&&(this.activePanoMesh=b.panoMesh,this.activeTime=e),this.intersectMesh.position.copy(b.panoMesh.position),this.intersectMesh.lookAt(this.camera.position)):(this.activePanoMesh=void 0,this.activeTime=void 0),f||(f=this.modelScene.intersectRaycaster(c)[0]);var T=createEvent("intersect.update",{raycaster:c,intersection:f!=null?f:null,object:this.intersectMesh});if(this.emit("intersect.update",T),T.defaultPrevented){this.hideIntersectMesh();return}if(f&&f.face){var _=f.face.normal,S=new THREE__namespace.Quaternion;S.setFromUnitVectors(new THREE__namespace.Vector3(0,0,1),_),this.intersectMesh.quaternion.copy(S);var w=f.point.clone();this.intersectMesh.position.copy(w),b?this.intersectMesh.visible=!1:this.intersectMesh.visible=!0}else this.intersectMesh.visible=!1;return b==null?void 0:b.panoMesh},t.prototype.onPanGesture=function(){},t.prototype.onTapGesture=function(){},t.prototype.onPinchGesture=function(){},t.prototype.onMouseMove=function(){},t.prototype.onMouseOut=function(){},t})(PanoramaController),HUMAN_EYE_POSITION=new THREE__namespace.Vector3(0,1.6,0),scratchObserverBox$1=new THREE__namespace.Box3,scratchVector3$2=new THREE__namespace.Vector3,defaultModelControllerCustomInitArgs=__assign({},defaultPanoramaLikeControllerCustomInitArgs),ModelController=(function(n){__extends(t,n);function t(e){var r=this,o=t.parseArgs(e);return r=n.call(this,o)||this,r.mode="Model",r.locationMotion=new Motion({x:r.camera.pose.offset.x,y:r.camera.pose.offset.y,z:r.camera.pose.offset.z,distance:r.camera.pose.distance}),r.modelAlphaMotion=new Motion({modelAlpha:r.modelScene.parameter.resolveValue().modelAlpha}),r.perspToOrthoMotion=new Motion({perspToOrtho:r.camera.perspToOrtho.x}),r}return t.parseArgs=function(e){return e instanceof t?e:n.parseArgs.call(this,e)},t.initAnimationEndState=function(e){var r,o,s,u,l,c,f=this.parseArgs(e),p=f.works,d=e.initial,h=d.state,g=d.currentState,m=typeof h.panoIndex=="number"?{workCode:(s=(r=h.workCode)!==null&&r!==void 0?r:(o=f.works[0])===null||o===void 0?void 0:o.workCode)!==null&&s!==void 0?s:"",panoIndex:h.panoIndex}:{workCode:g.workCode,panoIndex:g.panoIndex},E=p.getObserver(m),y=clamp$1((u=h.fov)!==null&&u!==void 0?u:!E||isFristPersonMode(g.mode)?g.fov:f.defaultFov,f.minFov,f.maxFov),v=(l=h.longitude)!==null&&l!==void 0?l:g.longitude,A=clamp$1(typeof f.minLatitude=="function"?f.minLatitude(y):f.minLatitude,-Math.PI/2,Math.PI/2),b=clamp$1(typeof f.maxLatitude=="function"?f.maxLatitude(y):f.maxLatitude,-Math.PI/2,Math.PI/2),T=clamp$1((c=h.latitude)!==null&&c!==void 0?c:!E||isFristPersonMode(g.mode)?g.latitude:f.defaultLatitude,A,b),_=new THREE__namespace.Vector3;if(f.initial.state.offset)_.copy(f.initial.state.offset);else if(E)_.copy(E.position).applyMatrix4(E.work.transform);else{var S=coordinatesToVector(g).setLength(g.distance);_.copy(f.initial.currentState.offset).sub(S)}return{workCode:m.workCode,panoIndex:m.panoIndex,mode:"Model",longitude:v,latitude:T,fov:y,offset:_,distance:0}},t.prototype.updateConfiguration=function(e){return n.prototype.updateConfiguration.call(this,e)},t.prototype.destroy=function(){n.prototype.destroy.call(this),this.locationMotion.dispose()},t.prototype.isReady=function(){return this.locationMotion.ended===!1?!1:n.prototype.isReady.call(this)},t.prototype.updateWork=function(e,r,o,s){this.works=e;var u=t.initAnimationEndState(__assign(__assign({},this),{initial:{currentState:__assign(__assign({},this.currentPano),this.camera.pose),duration:o.duration,effect:o.effect,state:r,userAction:s}}));return(u.workCode!==this.currentPano.workCode||u.panoIndex!==this.currentPano.panoIndex||u.longitude!==this.cameraMotion.value.longitude||u.latitude!==this.cameraMotion.value.latitude||u.fov!==this.cameraMotion.value.fov)&&this.moveToPosition(u.offset,{duration:0,longitude:u.longitude,latitude:u.latitude,fov:u.fov},s),!0},t.prototype.updateCamera=function(e,r,o){var s=this;return this.initAnimationReady.then(function(){s.userAction=o,s.stopMomentumMovement();var u={},l={};return u.distance=0,e.offset!==void 0&&(u.x=e.offset.x,u.y=e.offset.y,u.z=e.offset.z),e.longitude!==void 0&&(l.longitude=e.longitude),e.latitude!==void 0&&(l.latitude=e.latitude),e.fov!==void 0&&(l.fov=e.fov),s.locationMotion.set(u,r).catch(noop),s.cameraMotion.set(l,r).catch(noop)})},t.prototype.updateCameraWithKeyframes=function(e,r,o){var s=this;return this.initAnimationReady.then(function(){s.userAction=o,s.stopMomentumMovement();for(var u=[],l=[],c=0,f=e;c<f.length;c++){var p=f[c];u.push({key:p.key,progress:p.progress,value:{distance:0,x:p.value.offset.x,y:p.value.offset.x,z:p.value.offset.x}}),l.push({key:p.key,progress:p.progress,value:{longitude:p.value.longitude,latitude:p.value.latitude,fov:p.value.fov}})}return s.locationMotion.setKeyframes(u,r).catch(noop),s.cameraMotion.setKeyframes(e,r)})},t.prototype.updateTime=function(e,r){if(!this.destroyed){var o={},s={};if(this.modelAlphaMotion.ended||(this.modelAlphaMotion.update(e),o.modelAlpha=this.modelAlphaMotion.value.modelAlpha),this.modelScene.parameter.modelAlpha===0&&this.modelScene.parameter.progress!==1){var u=this.modelScene.parameter,l=u.pano0,c=u.pano1;l&&l.map!==(c==null?void 0:c.map)&&l.map.dispose(),o.progress=1,o.pano0=o.pano1=c}if(this.perspToOrthoMotion.ended||(this.perspToOrthoMotion.update(e),this.camera.perspToOrtho.setScalar(clamp$1(this.perspToOrthoMotion.value.perspToOrtho,0,1))),!this.locationMotion.ended){this.locationMotion.update(e),s.distance=this.locationMotion.value.distance,s.offset=new THREE__namespace.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z);for(var f=new THREE__namespace.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z),p=[],d=function(_){var S=h.modelScene.models.find(function(H){return H.work===_});if(!S||S.visible===!1||_.observers.length<=0)return"continue";if(scratchObserverBox$1.copy(_.observerBox).expandByScalar(10).applyMatrix4(_.transform),scratchObserverBox$1.containsPoint(f))for(var w=0,R=_.observers;w<R.length;w++){var I=R[w];p.push(I)}},h=this,g=0,m=this.works;g<m.length;g++){var E=m[g];d(E)}var y=arrayMin(p,function(_){return scratchVector3$2.copy(_.position).applyMatrix4(_.work.transform).distanceTo(f)});this.currentPano=y?{workCode:y.work.workCode,panoIndex:y.panoIndex}:{workCode:"",panoIndex:0}}this.cameraMotion.ended||(this.cameraMotion.update(e),s.longitude=this.cameraMotion.value.longitude,s.latitude=this.cameraMotion.value.latitude,s.fov=this.cameraMotion.value.fov),isEmptyObject(o)||this.modelScene.parameter.set(o),isEmptyObject(s)||this.setCamera(s);var v=this.works.getObserver(this.currentPano);if(this.intersectMesh&&this.intersectMesh.parent&&v&&v.position.y-v.standingPosition.y>10){var A=this.camera.position.distanceTo(this.intersectMesh.position),b=2*Math.tan(.5*this.camera.fov/180*Math.PI),T=clamp$1(A*b/5,.5);this.intersectMesh.scale.setScalar(T)}else this.intersectMesh.scale.setScalar(1)}},t.prototype.initAnimation=function(){var e=this;return this.destroyed?Promise.resolve():new Promise(function(r){var o=e.initial;o.state,o.currentState;var s=o.duration,u=o.userAction;e.userAction=u;var l=t.initAnimationEndState(e),c={modelAlpha:1},f={perspToOrtho:0},p={longitude:l.longitude,latitude:l.latitude,fov:l.fov,duration:s,moveStartCallback:function(d){e.perspToOrthoMotion.set(f,s).catch(noop),e.modelAlphaMotion.set(c,s).catch(noop),e.emit("initAnimation.start",createEvent("initAnimation.start",{state:d,userAction:e.userAction}))},moveEndCallback:function(d){e.emit("initAnimation.end",createEvent("initAnimation.end",{state:d,userAction:e.userAction})),r()},moveCancelCallback:function(){var d=e.currentPano,h=__assign(__assign({},d),{mode:e.mode,longitude:e.camera.pose.longitude,latitude:e.camera.pose.latitude,fov:e.camera.pose.fov,offset:e.camera.pose.offset.clone(),distance:e.camera.pose.distance});e.emit("initAnimation.end",createEvent("initAnimation.end",{state:h,userAction:e.userAction})),r()}};e.moveToPosition(l.offset,p,u)})},t.prototype.getTargetState=function(){var e=this.cameraMotion.getKeyFrameSegment(now())[1],r=this.locationMotion.getKeyFrameSegment(now())[1];return __assign(__assign({},this.currentPano),{mode:this.mode,longitude:e.value.longitude,latitude:e.value.latitude,fov:e.value.fov,offset:new THREE__namespace.Vector3(r.value.x,r.value.y,r.value.z),distance:r.value.distance})},t.prototype.moveToPano=function(e,r,o){r===void 0&&(r={});var s=this.works.getObserver(e);if(s){var u=new THREE__namespace.Vector3().copy(s.position).applyMatrix4(s.work.transform);this.moveToPosition(u,r,o)}},t.prototype.moveToPosition=function(e,r,o){var s=this,u,l,c;r===void 0&&(r={}),this.userAction=o,this.stopMomentumMovement();for(var f=now(),p=new THREE__namespace.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z),d=p.distanceTo(e),h=this.locationMotion.getProgressVelocity(f),g=0,m=1;m<this.locationMotion.keyframes.length;m++){var E=this.locationMotion.keyframes[m-1].value,y=E.x,v=E.y,A=E.z,b=this.locationMotion.keyframes[m].value,T=b.x,_=b.y,S=b.z;g+=Math.sqrt(Math.pow(T-y,2)+Math.pow(_-v,2)+Math.pow(S-A,2))}for(var w=d===0?0:h*g/d,R=this.calculateMovingDuration(r.duration,d),I={x:e.x,y:e.y,z:e.z,distance:0},H={longitude:r.longitude,latitude:r.latitude,fov:r.fov},C=[],M=function(V){var U=B.modelScene.models.find(function(re){return re.work===V});if(!U||U.visible===!1||V.observers.length<=0)return"continue";if(scratchObserverBox$1.copy(V.observerBox).expandByScalar(10).applyMatrix4(V.transform),scratchObserverBox$1.containsPoint(p))for(var j=0,K=V.observers;j<K.length;j++){var ae=K[j];C.push(ae)}},B=this,L=0,O=this.works;L<O.length;L++){var k=O[L];M(k)}var D=arrayMin(C,function(V){return scratchVector3$2.copy(V.position).applyMatrix4(V.work.transform).distanceTo(p)}),q=D?{workCode:D.work.workCode,panoIndex:D.panoIndex}:{workCode:"",panoIndex:0},z=__assign(__assign({},q),{mode:this.mode,longitude:(u=H.longitude)!==null&&u!==void 0?u:this.camera.pose.longitude,latitude:(l=H.latitude)!==null&&l!==void 0?l:this.camera.pose.latitude,fov:(c=H.fov)!==null&&c!==void 0?c:this.camera.pose.fov,offset:e.clone(),distance:0}),J=this.currentPano;this.emit("pano.moveTo",createEvent("pano.moveTo",{options:r,prevPano:J,progress:0,state:z,userAction:this.userAction,error:null})),r.moveStartCallback&&r.moveStartCallback(z),this.cameraMotion.set(H,R).catch(noop),this.locationMotion.set(I,R,w).then(function(){for(var V=0,U=s.modelScene.children;V<U.length;V++){var j=U[V];j instanceof Model&&j.show()}var K=__assign(__assign(__assign({},q),{mode:s.mode}),clonePose(s.camera.pose));s.emit("pano.arrived",createEvent("pano.arrived",{options:r,prevPano:J,progress:0,state:K,userAction:s.userAction,error:null})),r.moveEndCallback&&r.moveEndCallback(K)},function(){r.moveCancelCallback&&r.moveCancelCallback(),s.emit("pano.cancel",createEvent("pano.cancel",{options:r,prevPano:J,progress:0,state:z,userAction:s.userAction,error:null}))})},t.prototype.onTapGesture=function(e){var r=e.center.raycaster;this.stopMomentumMovement();var o=this.modelScene.intersectRaycaster(r)[0];if(o&&o.face){var s=o.face.normal,u=o.point;if(new THREE__namespace.Vector3(0,1,0).angleTo(s)>Math.PI/3){var l=new THREE__namespace.Raycaster;l.firstHitOnly=!0;var c=s.clone().setLength(.3).add(u);l.set(c,new THREE__namespace.Vector3(0,-1,0)),o=this.modelScene.intersectRaycaster(l)[0]}}if(o){for(var f=new THREE__namespace.Vector3().copy(o.point).add(HUMAN_EYE_POSITION),p=[],d=function(T){var _=h.modelScene.models.find(function(I){return I.work===T});if(!_||_.visible===!1||T.observers.length<=0)return"continue";if(scratchObserverBox$1.copy(T.observerBox).expandByScalar(10).applyMatrix4(T.transform),scratchObserverBox$1.containsPoint(f))for(var S=0,w=T.observers;S<w.length;S++){var R=w[S];p.push(R)}},h=this,g=0,m=this.works;g<m.length;g++){var E=m[g];d(E)}var y=arrayMin(p,function(T){return scratchVector3$2.copy(T.position).applyMatrix4(T.work.transform).distanceTo(f)},!0),v=y[0],A=y[1];if(v&&A<5){var b=scratchVector3$2.copy(v.position).applyMatrix4(v.work.transform);f.y=b.y}e.state.offset.copy(f),e.state.distance=0,this.emit("gesture.tap",e),e.defaultPrevented||this.moveToPosition(f,{},!0)}else this.emit("gesture.tap",e),e.defaultPrevented||this.cameraBounce()},t})(PanoramaLikeController),scratchObserverBox=new THREE__namespace.Box3,scratchVector3$1=new THREE__namespace.Vector3,minDistance=.5,PANGESTURE_FORWARD_ANGLE=Math.PI/7,defaultMapviewControllerCustomInitArgs={defaultLongitude:Math.PI/4,defaultLatitude:Math.PI/4,defaultDistance:150,maxLatitude:+Math.PI/2,minLatitude:0,cameraType:"auto",cameraFence:null,intersectMeshCreator:function(){return new IntersectMesh}},MapviewController=(function(n){__extends(t,n);function t(e){var r=this,o=t.parseArgs(e);return r=n.call(this,o)||this,r.mode="Mapview",r.defaultLongitude=o.defaultLongitude,r.defaultLatitude=o.defaultLatitude,r.defaultDistance=o.defaultDistance,r.maxLatitude=o.maxLatitude,r.minLatitude=o.minLatitude,r.cameraType=o.cameraType,r.cameraFence=o.cameraFence,r.locationMotion=new Motion({x:r.camera.pose.offset.x,y:r.camera.pose.offset.y,z:r.camera.pose.offset.z,distance:r.camera.pose.distance}),r.modelAlphaMotion=new Motion({modelAlpha:r.modelScene.parameter.resolveValue().modelAlpha}),r.perspToOrthoMotion=new Motion({perspToOrtho:r.camera.perspToOrtho.x}),r.pendingTextureId=null,r.textureLoader=new TextureLoader,r.intersectMeshCreator=o.intersectMeshCreator,r.intersectMesh=r.intersectMeshCreator(),r.intersectMesh.name="intersect",r.intersectMesh.visible=!1,r.helper.add(r.intersectMesh),r}return t.parseArgs=function(e){var r,o,s,u,l,c,f,p;if(e instanceof t)return e;var d=n.parseArgs.call(this,e);return __assign(__assign({},d),{defaultLongitude:(r=e.defaultLongitude)!==null&&r!==void 0?r:defaultMapviewControllerCustomInitArgs.defaultLongitude,defaultLatitude:(o=e.defaultLatitude)!==null&&o!==void 0?o:defaultMapviewControllerCustomInitArgs.defaultLatitude,defaultDistance:(s=e.defaultDistance)!==null&&s!==void 0?s:defaultMapviewControllerCustomInitArgs.defaultDistance,maxLatitude:(u=e.maxLatitude)!==null&&u!==void 0?u:defaultMapviewControllerCustomInitArgs.maxLatitude,minLatitude:(l=e.minLatitude)!==null&&l!==void 0?l:defaultMapviewControllerCustomInitArgs.minLatitude,cameraType:(c=e.cameraType)!==null&&c!==void 0?c:defaultMapviewControllerCustomInitArgs.cameraType,cameraFence:(f=e.cameraFence)!==null&&f!==void 0?f:defaultMapviewControllerCustomInitArgs.cameraFence,intersectMeshCreator:(p=e.intersectMeshCreator)!==null&&p!==void 0?p:defaultMapviewControllerCustomInitArgs.intersectMeshCreator})},t.distanceFromModel=function(e,r,o){var s=e.boundingBox,u=s.isEmpty()?10:Math.pow(Math.pow(s.max.x-s.min.x+1,2)+Math.pow(s.max.y-s.min.y+1,2)+Math.pow(s.max.z-s.min.z+1,2),1/2);u=isNaN(u)||!isFinite(u)?1:u;var l=u/2/Math.tan(Math.PI*r/360);return o<1&&(l=l/o),isNaN(l)||!isFinite(l)?u:l},t.initAnimationEndState=function(e){var r,o,s,u,l,c,f,p=this.parseArgs(e),d=p.works,h=p.modelScene,g=e.initial,m=g.state,E=g.currentState,y=typeof m.panoIndex=="number"?{workCode:(s=(r=m.workCode)!==null&&r!==void 0?r:(o=p.works[0])===null||o===void 0?void 0:o.workCode)!==null&&s!==void 0?s:"",panoIndex:m.panoIndex}:{workCode:E.workCode,panoIndex:E.panoIndex},v=(u=m.fov)!==null&&u!==void 0?u:60,A=clamp$1(typeof p.minLatitude=="function"?p.minLatitude(v):p.minLatitude,-Math.PI/2,Math.PI/2),b=clamp$1(typeof p.maxLatitude=="function"?p.maxLatitude(v):p.maxLatitude,-Math.PI/2,Math.PI/2),T=clamp$1((l=m.latitude)!==null&&l!==void 0?l:isThirdPersonMode(E.mode)?E.latitude:p.defaultLatitude,A,b),_=t.distanceFromModel(p.modelScene,v,p.camera.aspect),S=new THREE__namespace.Vector3,w=(c=m.distance)!==null&&c!==void 0?c:Math.min(p.defaultDistance,_),R=(f=m.longitude)!==null&&f!==void 0?f:isThirdPersonMode(E.mode)?E.longitude:p.defaultLongitude;if(m.offset)S.copy(m.offset);else{var I=d.getObserver(y);p.defaultDistance<_&&I?(S.copy(I.position).applyMatrix4(I.work.transform),m.longitude===void 0&&(R=E.longitude)):(h.boundingBox.getCenter(S),w=_)}return __assign(__assign({},y),{mode:"Mapview",longitude:R,latitude:T,fov:v,offset:S,distance:w})},t.prototype.updateConfiguration=function(e){var r=n.prototype.updateConfiguration.call(this,e);if(r===!1)return!1;if(e.defaultLongitude!==void 0&&this.defaultLongitude!==e.defaultLongitude&&(this.defaultLongitude=e.defaultLongitude),e.defaultLatitude!==void 0&&this.defaultLatitude!==e.defaultLatitude&&(this.defaultLatitude=e.defaultLatitude),e.defaultDistance!==void 0&&this.defaultDistance!==e.defaultDistance&&(this.defaultDistance=e.defaultDistance),e.maxLatitude!==void 0&&this.maxLatitude!==e.maxLatitude&&(this.maxLatitude=e.maxLatitude),e.minLatitude!==void 0&&this.minLatitude!==e.minLatitude&&(this.minLatitude=e.minLatitude),e.cameraType!==void 0&&this.cameraType!==e.cameraType&&(this.cameraType=e.cameraType),this.cameraFence instanceof THREE__namespace.Box3&&e.cameraFence instanceof THREE__namespace.Box3?this.cameraFence.equals(e.cameraFence)||(this.cameraFence=e.cameraFence):this.cameraFence instanceof THREE__namespace.Sphere&&e.cameraFence instanceof THREE__namespace.Sphere?this.cameraFence.equals(e.cameraFence)||(this.cameraFence=e.cameraFence):e.cameraFence!==void 0&&(this.cameraFence=e.cameraFence),e.intersectMeshCreator!==void 0&&this.intersectMeshCreator!==e.intersectMeshCreator){this.intersectMeshCreator=e.intersectMeshCreator;var o=this.intersectMesh;this.intersectMesh=this.intersectMeshCreator(),this.intersectMesh.name=o.name,this.intersectMesh.visible=o.visible;var s=this.intersectMesh.parent;s&&s.add(this.intersectMesh),o.dispose()}return!0},t.prototype.destroy=function(){n.prototype.destroy.call(this),this.pendingTextureId=null,this.locationMotion.dispose(),this.panState=void 0,this.intersectMesh.dispose(),this.helper.remove(this.intersectMesh)},t.prototype.isReady=function(){return this.locationMotion.ended===!1?!1:n.prototype.isReady.call(this)},t.prototype.updateWork=function(e,r,o,s){this.userAction=s,this.works=e;var u=t.initAnimationEndState(__assign(__assign({},this),{initial:{currentState:__assign(__assign({},this.currentPano),this.camera.pose),duration:o.duration,effect:o.effect,state:r,userAction:s}}));this.currentPano={workCode:u.workCode,panoIndex:u.panoIndex};var l={longitude:u.longitude,latitude:u.latitude,fov:u.fov},c={x:u.offset.x,y:u.offset.y,z:u.offset.z,distance:u.distance};return(l.longitude!==this.cameraMotion.value.longitude||l.latitude!==this.cameraMotion.value.latitude||l.fov!==this.cameraMotion.value.fov)&&this.cameraMotion.set(l,o.duration).catch(noop),(c.x!==this.locationMotion.value.x||c.y!==this.locationMotion.value.y||c.z!==this.locationMotion.value.z||c.distance!==this.locationMotion.value.distance)&&this.locationMotion.set(c,o.duration).catch(noop),!0},t.prototype.updateModel=function(e){n.prototype.updateModel.call(this,e),this.hideIntersectMesh()},t.prototype.updateCamera=function(e,r,o){var s=this;return this.initAnimationReady.then(function(){s.userAction=o,s.stopMomentumMovement();var u={},l={};return e.distance!==void 0&&(u.distance=e.distance),e.offset!==void 0&&(u.x=e.offset.x,u.y=e.offset.y,u.z=e.offset.z),e.longitude!==void 0&&(l.longitude=e.longitude),e.latitude!==void 0&&(l.latitude=e.latitude),e.fov!==void 0&&(l.fov=e.fov),s.locationMotion.set(u,r).catch(noop),s.cameraMotion.set(l,r).catch(noop)})},t.prototype.updateCameraWithKeyframes=function(e,r,o){var s=this;return this.initAnimationReady.then(function(){s.userAction=o,s.stopMomentumMovement();for(var u=[],l=[],c=0,f=e;c<f.length;c++){var p=f[c];u.push({key:p.key,progress:p.progress,value:{distance:p.value.distance,x:p.value.offset.x,y:p.value.offset.x,z:p.value.offset.x}}),l.push({key:p.key,progress:p.progress,value:{longitude:p.value.longitude,latitude:p.value.latitude,fov:p.value.fov}})}return s.locationMotion.setKeyframes(u,r).catch(noop),s.cameraMotion.setKeyframes(e,r)})},t.prototype.updateTime=function(e,r){if(!this.destroyed){var o={},s={};if(this.locationMotion.ended||(this.locationMotion.update(e),s.distance=this.locationMotion.value.distance,s.offset=new THREE__namespace.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z)),this.cameraMotion.ended||(this.cameraMotion.update(e),s.longitude=this.cameraMotion.value.longitude,s.latitude=this.cameraMotion.value.latitude,s.fov=this.cameraMotion.value.fov),this.modelAlphaMotion.ended||(this.modelAlphaMotion.update(e),o.modelAlpha=this.modelAlphaMotion.value.modelAlpha),this.modelScene.parameter.modelAlpha===0&&this.modelScene.parameter.progress!==1){var u=this.modelScene.parameter,l=u.pano0,c=u.pano1;l&&l.map!==(c==null?void 0:c.map)&&l.map.dispose(),o.progress=1,o.pano0=o.pano1=c}var f=0;if(this.cameraType==="auto"?f=Math.abs(Math.PI/2-this.cameraMotion.value.latitude)<.02||Math.abs(-Math.PI/2-this.cameraMotion.value.latitude)<.02?1:0:this.cameraType==="perspective"?f=0:this.cameraType==="orthographic"&&(f=1),this.perspToOrthoMotion.getTargetKeyframe().value.perspToOrtho!==f&&this.perspToOrthoMotion.set({perspToOrtho:f},500).catch(noop),this.perspToOrthoMotion.ended||(this.perspToOrthoMotion.update(e),this.camera.perspToOrtho.setScalar(clamp$1(this.perspToOrthoMotion.value.perspToOrtho,0,1))),isEmptyObject(o)||this.modelScene.parameter.set(o),isEmptyObject(s)||this.setCamera(s),this.cameraFence&&!this.panState&&!this.pinchState&&!this.mouseWheelState&&!this.inMomentumMovement&&this.locationMotion.ended&&this.perspToOrthoMotion.ended&&this.cameraMotion.ended){var p=coordinatesToVector(this.camera.pose,new THREE__namespace.Vector3),d=new THREE__namespace.Vector3().copy(this.camera.pose.offset).sub(p.clone().multiplyScalar(this.camera.pose.distance));if(this.cameraFence.distanceToPoint(d)>.01){var h=this.cameraFence.clampPoint(d,new THREE__namespace.Vector3),g=this.camera.pose.offset.clone().add(h).sub(d),m=__assign(__assign({},this.currentPano),{mode:this.mode,longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude,fov:this.camera.pose.fov,offset:g,distance:this.camera.pose.distance});this.fixFinalState(m),this.locationMotion.set({x:m.offset.x,y:m.offset.y,z:m.offset.z,distance:m.distance},300).catch(noop)}}if(this.intersectMesh&&this.intersectMesh.parent){var E=this.camera.position.distanceTo(this.intersectMesh.position),y=2*Math.tan(.5*this.camera.fov/180*Math.PI),v=clamp$1(E*y/5,.5);this.intersectMesh.scale.setScalar(v)}else this.intersectMesh.scale.setScalar(1)}},t.prototype.getTargetState=function(){var e=this.cameraMotion.getKeyFrameSegment(now())[1],r=this.locationMotion.getKeyFrameSegment(now())[1];return __assign(__assign({},this.currentPano),{mode:this.mode,longitude:e.value.longitude,latitude:e.value.latitude,fov:e.value.fov,distance:r.value.distance,offset:new THREE__namespace.Vector3(r.value.x,r.value.y,r.value.z)})},t.prototype.initAnimation=function(){var e=this;return this.destroyed?Promise.resolve():new Promise(function(r){var o=e.initial;o.state,o.currentState;var s=o.duration,u=o.userAction;e.userAction=u;var l=t.initAnimationEndState(e),c={longitude:l.longitude,latitude:l.latitude,fov:l.fov},f={x:l.offset.x,y:l.offset.y,z:l.offset.z,distance:l.distance},p={modelAlpha:1},d={perspToOrtho:0};e.emit("initAnimation.start",createEvent("initAnimation.start",{state:l,userAction:e.userAction})),e.perspToOrthoMotion.set(d,s).catch(noop),e.modelAlphaMotion.set(p,s/3).catch(noop),e.cameraMotion.set(c,s).catch(noop),e.locationMotion.set(f,s).then(function(){e.emit("initAnimation.end",createEvent("initAnimation.end",{state:l,userAction:e.userAction}))},function(h){var g=__assign(__assign(__assign({},e.currentPano),{mode:e.mode}),clonePose(e.camera.pose));e.emit("initAnimation.end",createEvent("initAnimation.end",{state:g,userAction:e.userAction}))}).then(function(){r()})})},t.prototype.getForwardObserverOrNot=function(e){var r=this.modelScene.intersectRaycaster(e)[0];if(!r)return null;for(var o=[],s=function(g){var m=u.modelScene.models.find(function(A){return A.work===g});if(!m||m.visible===!1||g.observers.length<=0)return"continue";if(scratchObserverBox.copy(g.observerBox).expandByScalar(10).applyMatrix4(g.transform),scratchObserverBox.containsPoint(e.ray.origin)||e.ray.intersectsBox(scratchObserverBox))for(var E=0,y=g.observers;E<y.length;E++){var v=y[E];o.push(v)}},u=this,l=0,c=this.works;l<c.length;l++){var f=c[l];s(f)}var p=arrayMin(o,function(g){return scratchVector3$1.copy(g.standingPosition).applyMatrix4(g.work.transform).distanceTo(r.point)},!0),d=p[0],h=p[1];return d&&h<Math.max(d.standingPosition.distanceTo(this.camera.position)/5,10)?d:null},t.prototype.coordinatesForOffset=function(e){var r=this.renderer.getSize(new THREE__namespace.Vector2);return{longitude:-2*e.x/(r.x*this.viewport.width),latitude:2*e.y/(r.y*this.viewport.height)}},t.prototype.requestMomentumMovement=function(e,r,o,s){var u=this;if(this.inMomentumMovement!==null){s=Math.max(s,1);for(var l=__assign({},o),c={longitude:0,latitude:0,x:0,y:0,z:0},f=0;f<s;f++)l.longitude*=.996,l.latitude*=.996*.998,l.x*=.99,l.y*=.99,l.z*=.99,c.longitude+=l.longitude,c.latitude+=l.latitude,c.x+=l.x,c.y+=l.y,c.z+=l.z;var p=this.cameraMotion.value.fov,d=formatRad$1(this.cameraMotion.value.longitude+c.longitude),h=clamp$1(typeof this.minLatitude=="function"?this.minLatitude(p):this.minLatitude,-Math.PI/2,Math.PI/2),g=clamp$1(typeof this.maxLatitude=="function"?this.maxLatitude(p):this.maxLatitude,-Math.PI/2,Math.PI/2),m=clamp$1(this.cameraMotion.value.latitude+c.latitude,h,g),E=new THREE__namespace.Vector3(this.locationMotion.value.x+c.x,this.locationMotion.value.y+c.y,this.locationMotion.value.z+c.z),y=__assign(__assign({},this.currentPano),{mode:this.mode,longitude:d,latitude:m,offset:E,fov:p,distance:this.locationMotion.value.distance}),v=e.state.offset.clone().sub(coordinatesToVector(e.state).setLength(y.distance)),A=!(Math.abs(l.longitude)>1e-4||Math.abs(l.latitude)>1e-4||Math.abs(l.x)>1e-4||Math.abs(l.y)>1e-4||Math.abs(l.z)>1e-4),b=this.cameraFence?this.cameraFence.containsPoint(v):!0;b===!1&&(A=!0);var T=createEvent("gesture.momentum",__assign(__assign({},e),{isFirst:r,isFinal:A,state:y}));if(this.inMomentumMovement.event=T,this.emit("gesture.momentum",T),e.defaultPrevented){this.inMomentumMovement=null;return}this.inMomentumMovement&&(this.cameraMotion.set({longitude:d,latitude:m},0).catch(noop),this.locationMotion.set({x:y.offset.x,y:y.offset.y,z:y.offset.z,distance:y.distance},0).catch(noop),A?this.inMomentumMovement=null:AnimationFrameLoop.shared.add(function(_,S){u.requestMomentumMovement(e,!1,l,S)},!0))}},t.prototype.fixFinalState=function(e){if(this.perspToOrthoMotion.getTargetKeyframe().value.perspToOrtho!==1){var r=coordinatesToVector(e,new THREE__namespace.Vector3),o=new THREE__namespace.Vector3().copy(e.offset).sub(r.clone().multiplyScalar(e.distance)),s=new THREE__namespace.Raycaster(o,r);s.params.Points={threshold:.1},s.firstHitOnly=!0,s.near=this.camera.near,s.far=this.camera.far;var u;if(u=this.modelScene.intersectRaycaster(s)[0],!u){var l=new THREE__namespace.Plane(new THREE__namespace.Vector3(0,1,0),-this.modelScene.boundingBox.min.y),c=s.ray.intersectPlane(l,new THREE__namespace.Vector3);if(c){var f=c.distanceTo(s.ray.origin);f<1e3&&f>=s.near&&(u={distance:f,floorIndex:0,floor:0,point:c,object:this.scene,face:null})}}if(!u){var p=Math.max(e.distance,3);u={distance:p,floorIndex:0,floor:0,point:s.ray.direction.clone().setLength(p).add(s.ray.origin),object:this.scene,face:null}}u&&(e.distance=clamp$1(u.distance,0,1/0),e.offset.copy(o).add(r.clone().multiplyScalar(e.distance)))}},t.prototype.onPanGesture=function(e){this.userAction=e.userAction,this.stopMomentumMovement(),this.hideIntersectMesh();var r=e.pointers.length,o=this.panState,s=0,u=!1;e.pointerType==="mouse"&&(s=e.srcEvent.buttons,u=e.srcEvent.shiftKey),o&&s===0&&o.buttons!==0&&(s=o.buttons);var l=o==null?void 0:o.target;if(!l){var c=this.relativeClientPosition(e.center),f=this.createRaycasterFromCamera(c,this.camera);l=new THREE__namespace.Vector3().copy(f.ray.direction).multiplyScalar(3).add(f.ray.origin);var p=this.modelScene.intersectRaycaster(f)[0];if(!p&&f.ray.direction.y<-.3){var d=new THREE__namespace.Plane(new THREE__namespace.Vector3(0,1,0),0),h=f.ray.intersectPlane(d,new THREE__namespace.Vector3);if(h){var g=h.distanceTo(f.ray.origin);g<1e4&&g>=f.near&&(p={distance:g,floorIndex:0,floor:0,point:h,object:this.scene})}}if(p)l.copy(p.point);else{var m=new THREE__namespace.Vector3().copy(this.camera.pose.offset).sub(this.camera.position).normalize(),d=new THREE__namespace.Plane().setFromNormalAndCoplanarPoint(m,this.camera.pose.offset);f.ray.intersectPlane(d,l)}}if(e.isFinal?this.panState=void 0:this.panState={target:l,buttons:s,pointerLength:r,x:e.center.x,y:e.center.y},!(typeof o=="undefined"||o.pointerLength!==r)){var E=r>1||s===2||u;if(E){var y={x:e.center.x-o.x,y:e.center.y-o.y},v=new THREE__namespace.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z),A=coordinatesToVector(this.cameraMotion.value).setLength(this.locationMotion.value.distance).add(v),b=new THREE__namespace.Vector3().copy(A).sub(o.target).length();b*=Math.tan(this.camera.pose.fov/2*Math.PI/180);var T=this.renderer.getSize(new THREE__namespace.Vector2),_=2*y.x*b/T.y,S=2*y.y*b/T.y,w=new THREE__namespace.Vector3;w.setFromMatrixColumn(this.camera.matrix,0),w.multiplyScalar(-_),v.add(w),this.camera.pose.latitude<PANGESTURE_FORWARD_ANGLE?w.setFromMatrixColumn(this.camera.matrix,1):(w.setFromMatrixColumn(this.camera.matrix,0),w.crossVectors(this.camera.up,w)),w.multiplyScalar(S),v.add(w);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:v,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),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)),e.isFinal){var I=this.renderer.getSize(new THREE__namespace.Vector2),H=2*e.velocityX*b/I.y,C=2*e.velocityY*b/I.y,M=new THREE__namespace.Vector3,B=new THREE__namespace.Vector3;M.setFromMatrixColumn(this.camera.matrix,0),M.multiplyScalar(-H),B.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(C),B.add(M),this.inMomentumMovement={uuid:createUuid()},this.requestMomentumMovement(e,!0,{longitude:0,latitude:0,x:B.x,y:B.y,z:B.z},0)}}else{var y={x:e.center.x-o.x,y:e.center.y-o.y},L=this.coordinatesForOffset(y),O=formatRad$1(this.cameraMotion.value.longitude+L.longitude),k=this.camera.pose.fov,D=clamp$1(typeof this.minLatitude=="function"?this.minLatitude(k):this.minLatitude,-Math.PI/2,Math.PI/2),q=clamp$1(typeof this.maxLatitude=="function"?this.maxLatitude(k):this.maxLatitude,-Math.PI/2,Math.PI/2),z=clamp$1(this.cameraMotion.value.latitude+L.latitude,D,q);this.camera.aspect<1&&Math.abs(e.overallVelocityX)>.2&&Math.atan2(Math.abs(e.overallVelocityY),Math.abs(e.overallVelocityX))<Math.PI/6.923&&(z=this.cameraMotion.value.latitude);var R=__assign(__assign({},this.currentPano),{mode:this.mode,longitude:O,latitude:z,fov:k,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):this.cameraMotion.set({longitude:R.longitude,latitude:R.latitude},0).catch(noop),e.isFinal){var J=e.velocityX,V=e.velocityY;this.inMomentumMovement={uuid:createUuid()},this.requestMomentumMovement(e,!0,__assign(__assign({},this.coordinatesForOffset({x:J,y:V})),{x:0,y:0,z:0}),0)}}}},t.prototype.onPinchGesture=function(e){var r;if(this.initAnimationIsReady){this.userAction=e.userAction,this.stopMomentumMovement(),this.hideIntersectMesh();var o=(r=this.pinchState)===null||r===void 0?void 0:r.distance;if(e.isFirst){this.pinchState={x:e.center.x,y:e.center.y,scale:1,distance:this.locationMotion.value.distance};return}if(typeof o!="undefined"){var s=this.modelScene.boundingBox.getCenter(new THREE__namespace.Vector3),u=t.distanceFromModel(this.modelScene,this.cameraMotion.value.fov,this.camera.aspect),l=clamp$1(o/e.scale,minDistance,1/0),c=e.state.offset.clone().sub(coordinatesToVector(e.state).setLength(l)),f=this.modelScene.boundingBox.containsPoint(c),p;if(!f&&this.pinchState&&this.pinchState.scale>e.scale&&s.distanceTo(c)>u?p=e.state.distance:(p=l,this.pinchState&&(this.pinchState.scale=e.scale)),e.state.distance=p,this.emit("gesture.pinch",e),!e.defaultPrevented&&(this.locationMotion.set({distance:e.state.distance},0).catch(noop),e.pointerType!=="mouse"&&(e.type="gesture.pan",this.onPanGesture(e)),e.isFinal)){if(!("__fixFinalState"in e)){var d=e.state;this.fixFinalState(e.state);var h={x:d.offset.x,y:d.offset.y,z:d.offset.z,distance:d.distance};this.locationMotion.set(h,0).catch(noop)}this.panState=void 0,this.pinchState=void 0}}}},t.prototype.onMouseMove=function(e){var r,o;if(this.intersectMesh.parent&&!this.panState&&!this.pinchState&&!this.mouseWheelState&&(this.emit("gesture.mousemove",e),!e.defaultPrevented)){var s=e.center.raycaster;if(e.isFinal&&this.intersectMesh.parent&&this.intersectMesh.visible===!0){this.hideIntersectMesh();return}var u=this.modelScene.intersectRaycaster(s)[0],l=createEvent("intersect.update",{raycaster:s,intersection:u!=null?u:null,object:this.intersectMesh});if(this.emit("intersect.update",l),l.defaultPrevented){this.hideIntersectMesh();return}if(u){var c=(o=(r=u.face)===null||r===void 0?void 0:r.normal)!==null&&o!==void 0?o:new THREE__namespace.Vector3().copy(s.ray.direction).multiplyScalar(-1),f=c.clone(),p=u.point.clone();this.intersectMesh.position.copy(p);var d=p.clone().add(f);if(this.intersectMesh.lookAt(d),Math.abs(c.y)>.99){var h=this.camera.position.clone().sub(p);this.intersectMesh.rotation.z=-Math.atan2(h.z,h.x)}this.intersectMesh.visible=!0,this.needsRender=!0}else this.hideIntersectMesh()}},t.prototype.onMouseWheel=function(e){if(this.initAnimationIsReady)if(this.userAction=e.userAction,this.stopMomentumMovement(),this.hideIntersectMesh(),e.isFinal){var r=e.state;if(this.fixFinalState(r),this.emit("gesture.mousewheel",e),e.defaultPrevented)return;var o={x:r.offset.x,y:r.offset.y,z:r.offset.z,distance:r.distance};this.locationMotion.set(o,0).catch(noop)}else{var s=t.distanceFromModel(this.modelScene,this.cameraMotion.value.fov,this.camera.aspect),u=new THREE__namespace.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z),l=coordinatesToVector(this.cameraMotion.value,new THREE__namespace.Vector3).negate(),c=new THREE__namespace.Ray(u,l).intersectBox(this.modelScene.boundingBox,new THREE__namespace.Vector3);c&&(s+=c.distanceTo(u));var f=Math.max(this.locationMotion.value.distance-this.camera.near,0),p=e.center.delta/10*Math.max(f/5,.1);if(f<=s||p>0)if(this.locationMotion.value.distance-p>=minDistance){var d=this.locationMotion.value.distance-p;e.state.distance=d}else{var h=coordinatesToVector(this.cameraMotion.value);h.setLength(p),e.state.offset.add(h)}if(this.emit("gesture.mousewheel",e),e.defaultPrevented)return;this.locationMotion.set({distance:e.state.distance,x:e.state.offset.x,y:e.state.offset.y,z:e.state.offset.z},0).catch(noop)}},t.prototype.onTapGesture=function(e){var r=this,o;this.userAction=e.userAction,this.stopMomentumMovement();var s=e.center.raycaster,u=this.getForwardObserverOrNot(s);if(!u)this.emit("gesture.tap",e);else{var l={longitude:this.camera.pose.longitude,latitude:0},c=__assign(__assign({},e.state),{mode:"Panorama",workCode:u.work.workCode,panoIndex:u.panoIndex,longitude:l.longitude,latitude:l.latitude,offset:u?u.position.clone():new THREE__namespace.Vector3,distance:0});if(e.state=c,this.emit("gesture.tap",e),!e.defaultPrevented&&(this.emit("pano.select",createEvent("pano.select",{prevPano:this.currentPano,state:c,userAction:e.userAction,options:l,progress:0,error:null})),u&&u.active)){var f=this.pendingTextureId=createUuid(),p={panoIndex:u.panoIndex,workCode:u.work.workCode},d=panoStringify(p),h={right:u.images.work.getURL(u.images.right),left:u.images.work.getURL(u.images.left),up:u.images.work.getURL(u.images.up),down:u.images.work.getURL(u.images.down),front:u.images.work.getURL(u.images.front),back:u.images.work.getURL(u.images.back)},g=this.imageOptions.transform,m=__assign({key:"pano.".concat(d)},pick(this.imageOptions,["format","size","quality","sharpen","forceUseExifOrientation","mappings"])),E="pano:"+jsonHash([h,m,g]),y=this.modelScene.parameter,v=void 0;y.pano0&&y.pano0.map.name===E?v=y.pano0:y.pano1&&y.pano1.map.name===E&&(v=y.pano1),v?(y.pano0&&y.pano0.map!==v.map&&y.pano0.map.dispose(),y.pano1&&y.pano1.map!==v.map&&y.pano1.map!==((o=y.pano0)===null||o===void 0?void 0:o.map)&&y.pano1.map.dispose(),y.set({pano0:v,pano1:v}),this.emit("pano.request",createEvent("pano.request",{userAction:!0,prevPano:this.currentPano,progress:0,state:c,options:l,error:null}))):this.textureLoader.loadCubeTexture(h,{imageURL:{transform:g,options:m},format:THREE__namespace.RGBFormat,viaAjax:!0,fetcher:getFetcher(this.fiveId,u.work)},void 0,void 0,void 0,this.renderer).then(function(A){var b,T,_=A.body;if(r.destroyed||r.pendingTextureId!==f){_.dispose();return}r.pendingTextureId=null,_.name=E;var S=Array.isArray(_.image)?_.image[0]:_.image,w=(b=S==null?void 0:S.width)!==null&&b!==void 0?b:2048,R={panoId:d,map:_,mapSize:w,matrix:u.matrix.clone().premultiply(u.work.transform),zoom:1};y.pano0&&y.pano0.map.dispose(),y.pano1&&y.pano1.map!==((T=y.pano0)===null||T===void 0?void 0:T.map)&&y.pano1.map.dispose(),y.set({pano0:R,pano1:R}),r.emit("pano.request",createEvent("pano.request",{userAction:!0,prevPano:r.currentPano,progress:0,state:c,options:l,error:null}))}).catch(function(A){r.destroyed||r.pendingTextureId!==f||(r.pendingTextureId=null)})}}},t.prototype.onDblTapGesture=function(e){if(this.initAnimationIsReady){this.userAction=e.userAction,this.stopMomentumMovement(),this.hideIntersectMesh();var r=e.state,o=e.center.raycaster,s=o.ray.origin.clone().add(o.ray.direction.clone().setLength(3)),u=1,l=3,c=u,f=this.modelScene.intersectRaycaster(o)[0];if(f&&(s=f.point.clone(),f.distance>(u+l)/2?c=u:c=l),e.state.distance=c,e.state.offset=s,this.emit("gesture.dbltap",e),!e.defaultPrevented){var p={x:r.offset.x,y:r.offset.y,z:r.offset.z,distance:r.distance};this.locationMotion.set(p,360).catch(noop),this.hideIntersectMesh()}}},t.prototype.hideIntersectMesh=function(){this.intersectMesh.visible===!0&&(this.intersectMesh.visible=!1,this.needsRender=!0)},t})(BaseController);function isNil(n){return n==null}var _moveEvent={type:"move"},XRController=(function(){function n(){this._targetRay=null,this._grip=null,this._hand=null,this._axes=[0,0]}return n.prototype.getHandSpace=function(){return this._hand===null&&(this._hand=new THREE__namespace.Group,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand},n.prototype.getTargetRaySpace=function(){return this._targetRay===null&&(this._targetRay=new THREE__namespace.Group,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new THREE__namespace.Vector3,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new THREE__namespace.Vector3),this._targetRay},n.prototype.getGripSpace=function(){return this._grip===null&&(this._grip=new THREE__namespace.Group,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new THREE__namespace.Vector3,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new THREE__namespace.Vector3),this._grip},n.prototype.dispatchEvent=function(t){return this._targetRay!==null&&this._targetRay.dispatchEvent(t),this._grip!==null&&this._grip.dispatchEvent(t),this._hand!==null&&this._hand.dispatchEvent(t),this},n.prototype.disconnect=function(t){return this.dispatchEvent({type:"disconnected",data:t}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this},n.prototype.getAxes=function(){return this._axes},n.prototype.update=function(t,e,r){var o=null,s=null,u=null,l=this._targetRay,c=this._grip,f=this._hand;if(t&&t.gamepad&&t.gamepad.axes&&(this._axes=[t.gamepad.axes[2],t.gamepad.axes[3]]),t&&e.session.visibilityState!=="visible-blurred")if(l!==null&&(o=e.getPose(t.targetRaySpace,r),o!==null&&(l.matrix.fromArray(o.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),o.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(o.linearVelocity)):l.hasLinearVelocity=!1,o.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(o.angularVelocity)):l.hasAngularVelocity=!1,this.dispatchEvent(_moveEvent))),f&&t.hand){u=!0;for(var p=0,d=t.hand.values();p<d.length;p++){var h=d[p],g=e.getJointPose(h,r);if(f.joints[h.jointName]===void 0){var m=new THREE__namespace.Group;m.matrixAutoUpdate=!1,m.visible=!1,f.joints[h.jointName]=m,f.add(m)}var E=f.joints[h.jointName];g!==null&&(E.matrix.fromArray(g.transform.matrix),E.matrix.decompose(E.position,E.rotation,E.scale),E.jointRadius=g.radius),E.visible=g!==null}var y=f.joints["index-finger-tip"],v=f.joints["thumb-tip"],A=y.position.distanceTo(v.position),b=.02,T=.005;f.inputState.pinching&&A>b+T?(f.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!f.inputState.pinching&&A<=b-T&&(f.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else c!==null&&t.gripSpace&&(s=e.getPose(t.gripSpace,r),s!==null&&(c.matrix.fromArray(s.transform.matrix),c.matrix.decompose(c.position,c.rotation,c.scale),s.linearVelocity?(c.hasLinearVelocity=!0,c.linearVelocity.copy(s.linearVelocity)):c.hasLinearVelocity=!1,s.angularVelocity?(c.hasAngularVelocity=!0,c.angularVelocity.copy(s.angularVelocity)):c.hasAngularVelocity=!1));return l!==null&&(l.visible=o!==null),c!==null&&(c.visible=s!==null),f!==null&&(f.visible=u!==null),this},n})(),framebufferScaleFactor=1,isAppleVisionPro=function(){try{var n=/Macintosh/i.test(navigator.userAgent),t=navigator.maxTouchPoints===5;return n&&t}catch(e){return console.error("Error determining if the device is an Apple Vision Pro: ",e),!1}},isOculus=function(){try{return/Oculus/i.test(navigator.userAgent)}catch(n){return console.error("Error determining if the device is an Oculus: ",n),!1}},XRManager=(function(){function n(t,e,r){var o,s,u,l,c;this.isPanorama=(o=r==null?void 0:r.isPanorama)!==null&&o!==void 0?o:!0,navigator.userAgent.toLowerCase();var f;isAppleVisionPro()?f="VP":isOculus()?f="Oculus":f="Pico",this.machineType=(s=r==null?void 0:r.machineType)!==null&&s!==void 0?s:f,this.renderer=t,this.gl=e,this.enabled=!1,this.session=null,this.referenceSpaceType=(u=r==null?void 0:r.referenceSpaceType)!==null&&u!==void 0?u:"local-floor",this.referenceSpace=null,this.onSessionStartCallback=(l=r==null?void 0:r.onSessionStart)!==null&&l!==void 0?l:noop,this.onSessionEndCallback=(c=r==null?void 0:r.onSessionEnd)!==null&&c!==void 0?c:noop,this.controllers=[new XRController,new XRController],this.inputSourcesMap=new Map,this.cameraVR=new THREE__namespace.ArrayCamera,this.cameraL=new THREE__namespace.PerspectiveCamera,this.cameraR=new THREE__namespace.PerspectiveCamera,this.cameraVR.cameras.push(this.cameraL,this.cameraR),this.cameraL.viewport=new THREE__namespace.Vector4,this.cameraR.viewport=new THREE__namespace.Vector4,this.cameraL.layers.enable(1),this.cameraR.layers.enable(2),this.cameraVR.layers.enable(1),this.cameraVR.layers.enable(2),this.isPresenting=!1,this.currentDepthNear=null,this.currentDepthFar=null,this.cameraLPos=new THREE__namespace.Vector3,this.cameraRPos=new THREE__namespace.Vector3}return n.prototype.getController=function(t){var e=this.controllers[t];return e||console.warn("no controller find"),e.getTargetRaySpace()},n.prototype.getRightController=function(){if(!this.session||!this.session.inputSources)return null;var t=void 0;if(this.session.inputSources.forEach(function(r,o){r.handedness==="right"&&(t=o)}),t===void 0)return console.warn("no inputSource for right hand"),null;var e=this.controllers[t];return e?e.getTargetRaySpace():(console.warn("right controller not find"),null)},n.prototype.getLeftController=function(){if(!this.session||!this.session.inputSources)return null;var t=void 0;if(this.session.inputSources.forEach(function(r,o){r.handedness==="left"&&(t=o)}),t===void 0)return console.warn("no inputSource for left hand"),null;var e=this.controllers[t];return e?e.getTargetRaySpace():(console.warn("left controller not find"),null)},n.prototype.getControllerGrip=function(t){var e=this.controllers[t];return e||console.warn("no controller find"),e.getGripSpace()},n.prototype.getCameras=function(){return{cameraL:this.cameraL,cameraR:this.cameraR,cameraVR:this.cameraVR}},n.prototype.updateCamera=function(t,e){e===null?t.matrixWorld.copy(t.matrix):t.matrixWorld.multiplyMatrices(e.matrixWorld,t.matrix),t.matrixWorldInverse.getInverse(t.matrixWorld)},n.prototype.setProjectionFromUnion=function(t,e,r){this.cameraLPos.setFromMatrixPosition(e.matrixWorld),this.cameraRPos.setFromMatrixPosition(r.matrixWorld);var o=this.cameraLPos.distanceTo(this.cameraRPos),s=e.projectionMatrix.elements,u=r.projectionMatrix.elements,l=s[14]/(s[10]-1),c=s[14]/(s[10]+1),f=(s[9]+1)/s[5],p=(s[9]-1)/s[5],d=(s[8]-1)/s[0],h=(u[8]+1)/u[0],g=l*d,m=l*h,E=o/(-d+h),y=E*-d;e.matrixWorld.decompose(t.position,t.quaternion,t.scale),t.translateX(y),t.translateZ(E),t.matrixWorld.compose(t.position,t.quaternion,t.scale),t.matrixWorldInverse.getInverse(t.matrixWorld);var v=l+E,A=c+E,b=g-y,T=m+(o-y),_=f*c/A*v,S=p*c/A*v;t.projectionMatrix.makePerspective(b,T,_,S,v,A)},n.prototype.getCamera=function(t){this.cameraVR.near=this.cameraR.near=this.cameraL.near=t.near,this.cameraVR.far=this.cameraR.far=this.cameraL.far=t.far,this.session&&(this.currentDepthNear!==this.cameraVR.near||this.currentDepthFar!==this.cameraVR.far)&&(this.session.updateRenderState({depthNear:this.cameraVR.near,depthFar:this.cameraVR.far}),this.currentDepthNear=this.cameraVR.near,this.currentDepthFar=this.cameraVR.far);var e=t.parent,r=this.cameraVR.cameras;this.updateCamera(this.cameraVR,e);for(var o=0;o<r.length;o++)this.updateCamera(r[o],e);t.matrixWorld.copy(this.cameraVR.matrixWorld);for(var s=t.children,o=0,u=s.length;o<u;o++)s[o].updateMatrixWorld(!0);return r.length===2?this.setProjectionFromUnion(this.cameraVR,this.cameraL,this.cameraR):this.cameraVR.projectionMatrix.copy(this.cameraL.projectionMatrix),this.cameraVR},n.prototype.updateInputSources=function(t){if(!this.session){console.warn("session is lose!");return}for(var e=this.session.inputSources,r=0;r<this.controllers.length;r++)this.inputSourcesMap.set(e[r],this.controllers[r]);for(var r=0;r<t.removed.length;r++){var o=t.removed[r],s=this.inputSourcesMap.get(o);s&&(s.dispatchEvent({type:"disconnected",data:o}),this.inputSourcesMap.delete(o))}for(var r=0;r<t.added.length;r++){var o=t.added[r],s=this.inputSourcesMap.get(o);s&&s.dispatchEvent({type:"connected",data:o})}},n.prototype.onSessionEvent=function(t){var e=this.inputSourcesMap.get(t.inputSource);e&&e.dispatchEvent({type:t.type})},n.prototype.onSessionEnd=function(){this.inputSourcesMap.forEach(function(t,e){t.disconnect(e)}),this.inputSourcesMap.clear(),this.isPresenting=!1,this.session=null,AnimationFrameLoop.shared.setContext(null),this.onSessionEndCallback()},n.prototype.onRequestReferenceSpace=function(t){this.referenceSpace=t,this.isPresenting=!0,this.session&&this.onSessionStartCallback(this.session)},n.prototype.setSession=function(t){var e=this;if(this.session=t,this.session){this.session.addEventListener("select",function(o){e.onSessionEvent(o)}),this.session.addEventListener("selectstart",function(o){e.onSessionEvent(o)}),this.session.addEventListener("selectend",function(o){e.onSessionEvent(o)}),this.session.addEventListener("squeeze",function(o){e.onSessionEvent(o)}),this.session.addEventListener("squeezestart",function(o){e.onSessionEvent(o)}),this.session.addEventListener("squeezeend",function(o){e.onSessionEvent(o)}),this.session.addEventListener("end",function(o){e.onSessionEnd()});var r=this.gl.getContextAttributes();this.gl.makeXRCompatible().then(function(){var o={antialias:r==null?void 0:r.antialias,alpha:r==null?void 0:r.alpha,depth:r==null?void 0:r.depth,stencil:r==null?void 0:r.stencil,framebufferScaleFactor};if(!e.session){console.error("session is lose while set session!");return}switch(e.machineType){case"Pico":case"VP":e.session.updateRenderState({baseLayer:new XRWebGLLayer(e.session,e.gl,o)});break;case"Oculus":e.session.updateRenderState({baseLayer:new XRWebGLLayer(e.session,e.gl,o)});break;default:e.machineType;break}e.session.requestReferenceSpace(e.referenceSpaceType).then(function(s){e.onRequestReferenceSpace(s)}),e.session.addEventListener("inputsourceschange",function(s){e.updateInputSources(s)})})}},n})(),LineSegmentsGeometry=(function(n){__extends(t,n);function t(){var e=n.call(this)||this;e.type="LineSegmentsGeometry";var r=[-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],o=[-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],s=[0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5];return e.setIndex(s),e.setAttribute("position",new THREE__namespace.Float32BufferAttribute(r,3)),e.setAttribute("uv",new THREE__namespace.Float32BufferAttribute(o,2)),e}return t.prototype.applyMatrix4=function(e){var r=this.attributes.instanceStart,o=this.attributes.instanceEnd;return r!==void 0&&(r.applyMatrix4(e),o.applyMatrix4(e),r.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this},t.prototype.setPositions=function(e){var r;e instanceof Float32Array?r=e:Array.isArray(e)?r=new Float32Array(e):r=new Float32Array;var o=new THREE__namespace.InstancedInterleavedBuffer(r,6,1);return this.setAttribute("instanceStart",new THREE__namespace.InterleavedBufferAttribute(o,3,0)),this.setAttribute("instanceEnd",new THREE__namespace.InterleavedBufferAttribute(o,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this},t.prototype.setColors=function(e){var r;e instanceof Float32Array?r=e:Array.isArray(e)?r=new Float32Array(e):r=new Float32Array;var o=new THREE__namespace.InstancedInterleavedBuffer(r,6,1);return this.setAttribute("instanceColorStart",new THREE__namespace.InterleavedBufferAttribute(o,3,0)),this.setAttribute("instanceColorEnd",new THREE__namespace.InterleavedBufferAttribute(o,3,3)),this},t.prototype.fromWireframeGeometry=function(e){return this.setPositions(e.attributes.position.array),this},t.prototype.fromEdgesGeometry=function(e){return this.setPositions(e.attributes.position.array),this},t.prototype.fromMesh=function(e){return this.fromWireframeGeometry(new THREE__namespace.WireframeGeometry(e.geometry)),this},t.prototype.fromLineSegments=function(e){var r=e.geometry;if(r instanceof THREE__namespace.Geometry){var o=new THREE__namespace.BufferGeometry().fromGeometry(r);this.setPositions(o.attributes.position.array)}else r instanceof THREE__namespace.BufferGeometry&&this.setPositions(r.attributes.position.array);return this},t.prototype.computeBoundingBox=function(){this.boundingBox===null&&(this.boundingBox=new THREE__namespace.Box3);var e=this.attributes.instanceStart,r=this.attributes.instanceEnd;if(e!==void 0&&r!==void 0){var o=new THREE__namespace.Box3;this.boundingBox.setFromBufferAttribute(e),o.setFromBufferAttribute(r),this.boundingBox.union(o)}},t.prototype.computeBoundingSphere=function(){this.boundingSphere===null&&(this.boundingSphere=new THREE__namespace.Sphere),this.boundingBox===null&&this.computeBoundingBox();var e=this.attributes.instanceStart,r=this.attributes.instanceEnd;if(e!==void 0&&r!==void 0){var o=this.boundingSphere.center;this.boundingBox.getCenter(o);for(var s=0,u=new THREE__namespace.Vector3,l=0,c=e.count;l<c;l++)u.fromBufferAttribute(e,l),s=Math.max(s,o.distanceToSquared(u)),u.fromBufferAttribute(r,l),s=Math.max(s,o.distanceToSquared(u));this.boundingSphere.radius=Math.sqrt(s),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}},t.prototype.toJSON=function(){},t})(THREE__namespace.InstancedBufferGeometry);Object.assign(LineSegmentsGeometry.prototype,{isLineSegmentsGeometry:!0});var lineShader={uniforms:THREE__namespace.UniformsUtils.merge([THREE__namespace.UniformsLib.common,THREE__namespace.UniformsLib.fog,{linewidth:{value:1},resolution:{value:new THREE__namespace.Vector2(1,1)},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1},opacity:{value:1}}]),vertexShader:`
|
|
2151
|
+
`,PanoSphereMesh=(function(n){__extends(t,n);function t(){var e=n.call(this)||this;e.progress=0,e.opacity=0,e.loading=!1,e.current=!1,e.disabled=!1,e.currentMotion=new Motion({ringScale:1.1,ringOpacity:0,circleFade:0,circleOpacity:.85,circleScale:1}),e.opacityMotion=new Motion({opacity:0}),e.loadingMotion=new Motion({opacity:0}),e.disableMotion=new Motion({opacity:0});var r={blending:THREE__namespace.CustomBlending,blendSrc:THREE__namespace.SrcAlphaFactor,blendDst:THREE__namespace.OneMinusSrcAlphaFactor,blendSrcAlpha:THREE__namespace.OneFactor,blendDstAlpha:THREE__namespace.OneMinusSrcAlphaFactor,depthWrite:!1,transparent:!0};return e.hitTestMesh=new THREE__namespace.Mesh(sharedGeometry,new THREE__namespace.MeshBasicMaterial(__assign(__assign({},r),{color:0,opacity:0}))),e.hitTestMesh.scale.set(1.5,1.5,1.5),e.ringMesh=new THREE__namespace.Mesh(sharedGeometry,new THREE__namespace.ShaderMaterial(__assign(__assign({},r),{vertexShader:ringVertexShader,fragmentShader:ringFragmentShader,uniforms:{opacity:{value:0}}}))),e.panoMesh=new THREE__namespace.Mesh(sharedGeometry,new THREE__namespace.ShaderMaterial(__assign(__assign({},r),{vertexShader,fragmentShader,uniforms:{circleScale:{value:1.1},circleFade:{value:0},circleOpacity:{value:.5},loadingAngle:{value:0},loadingOpacity:{value:0},opacity:{value:0},disable:{value:0}}}))),e.add(e.hitTestMesh),e.add(e.ringMesh),e.add(e.panoMesh),e.renderOrder=1e4,e.needsRender=!0,e}return t.prototype.setProgress=function(e){this.progress=e,this.setLoading(e>0)},t.prototype.setOpacity=function(e){this.opacity!==e&&(this.opacity=e=clamp$1(e,0,1),this.opacityMotion.set({opacity:e},30).catch(noop))},t.prototype.setCurrent=function(e){if(this.current!==e){if(e){var r=[{progress:0,value:{ringScale:2,ringOpacity:0,circleFade:0,circleOpacity:.85,circleScale:1}},{progress:.05,value:{ringScale:1,ringOpacity:1,circleFade:0,circleOpacity:.85,circleScale:1}},{progress:.15,value:{ringScale:1.2,ringOpacity:1,circleFade:0,circleOpacity:.85,circleScale:1}},{progress:.25,value:{ringScale:1.1,ringOpacity:1,circleFade:0,circleOpacity:.85,circleScale:1}},{progress:.8,value:{ringScale:1.1,ringOpacity:1,circleFade:1,circleOpacity:.85,circleScale:1}},{progress:.9,value:{ringScale:1.1,ringOpacity:1,circleFade:1,circleOpacity:.65,circleScale:.8}},{progress:.92,value:{ringScale:1.1,ringOpacity:1,circleFade:1,circleOpacity:.65,circleScale:.8}},{progress:1,value:{ringScale:1.1,ringOpacity:1,circleFade:1,circleOpacity:.85,circleScale:1.1}}];this.currentMotion.setKeyframes(r,1500).catch(noop)}else{var r=[{progress:0,value:__assign({},this.currentMotion.value)},{progress:1,value:{ringScale:1.1,ringOpacity:0,circleFade:0,circleOpacity:.85,circleScale:1}}];this.currentMotion.setKeyframes(r,200).catch(noop)}this.current=e}},t.prototype.setLoading=function(e){this.loading!==e&&(e?this.loadingMotion.setKeyframes([{progress:0,value:{opacity:0}},{progress:.3,value:{opacity:0}},{progress:1,value:{opacity:.8}}],500).catch(noop):this.loadingMotion.set({opacity:0},0).catch(noop),this.loading=e,this.disabled===!0&&this.setDisabled(!1),this.needsRender=!0)},t.prototype.setDisabled=function(e){this.disabled!==e&&(this.disabled=e,this.loading===!0&&this.setLoading(!1),this.disableMotion.set({opacity:e?1:0},300).catch(noop),this.needsRender=!0)},t.prototype.tap=function(){return Promise.resolve()},t.prototype.updateTime=function(e,r){this.opacityMotion.update(e),this.currentMotion.update(e),this.loadingMotion.update(e);var o=this.opacityMotion.value.opacity;this.visible=o!==0;var s=this.currentMotion.value,u=s.ringScale,l=s.ringOpacity,c=s.circleFade,f=s.circleOpacity,p=s.circleScale;this.ringMesh.scale.set(u,1,u),this.ringMesh.material.uniforms.opacity.value=l*o,this.panoMesh.material.uniforms.opacity.value=o,this.panoMesh.material.uniforms.circleOpacity.value=f,this.panoMesh.material.uniforms.circleScale.value=p,this.panoMesh.material.uniforms.circleFade.value=c,this.panoMesh.material.uniforms.loadingOpacity.value=this.loadingMotion.value.opacity,this.panoMesh.material.uniforms.disable.value=this.disableMotion.value.opacity,this.panoMesh.material.uniforms.loadingAngle.value=e/120%(Math.PI*2),this.needsRender=!0},t.prototype.dispose=function(){this.hitTestMesh.material.dispose(),this.ringMesh.material.dispose(),this.panoMesh.material.dispose()},t})(THREE__namespace.Object3D),ACTIVE_TO_CURRENT_DELAY=1500,defaultVRPanoramaControllerCustomInitArgs=__assign({},omit(defaultPanoramaControllerCustomInitArgs,["maxLatitude","minLatitude"])),VRPanoramaController=(function(n){__extends(t,n);function t(e){var r=this,o=t.parseArgs(e);r=n.call(this,o)||this,r.mode="VRPanorama",r.cardboard=new Cardboard(r.renderer);var s=createHelper();r.helperElement=s;var u=new Hammer(s);return r.element.parentNode&&(r.element.parentNode.insertBefore(s,r.element),r.updateHelperElementSize(),u.on("tap",function(){return r.emit("vr.requestExit",createEvent("vr.requestExit",{}))})),r.destroyHelper=function(){u.destroy(),s.parentNode&&s.parentNode.removeChild(s),r.helperElement=void 0},r}return t.parseArgs=function(e){if(e instanceof t)return e;var r=__assign(__assign({},e),{maxLatitude:Math.PI/2,minLatitude:-Math.PI/2});return n.parseArgs.call(this,r)},t.initAnimationEndState=function(e){var r=this.parseArgs(e),o=n.initAnimationEndState.call(this,r);return __assign(__assign({},o),{mode:"VRPanorama"})},t.prototype.updateConfiguration=function(e){return n.prototype.updateConfiguration.call(this,__assign(__assign({},e),{maxLatitude:Math.PI/2,minLatitude:-Math.PI/2}))},t.prototype.destroy=function(){n.prototype.destroy.call(this),this.cardboard.dispose(),this.destroyHelper()},t.prototype.isReady=function(){return!1},t.prototype.updateRenderSize=function(){this.needsRender=!0},t.prototype.updateCamera=function(e,r,o){return Promise.resolve()},t.prototype.updateCameraWithKeyframes=function(e,r,o){return Promise.resolve()},t.prototype.updateTime=function(e,r){var o=this,s,u,l,c,f,p;if(!this.destroyed){this.updateHelperElementSize(),this.userAction=!0,this.needsRender=!0;var d={},h={},g=this.locationMotion.keyframes[0],m=this.locationMotion.keyframes[this.locationMotion.keyframes.length-1],E=this.locationMotion.getKeyFrameSegment(e),y=E[0],v=E[1],A=this.panoResourceFromLocationMotionKeyframe(y),b=this.panoResourceFromLocationMotionKeyframe(v),T=this.panoResourceFromLocationMotionKeyframe(g),_=this.panoResourceFromLocationMotionKeyframe(m),S=!1;if(this.modelAlphaMotion.ended===!1&&(this.modelAlphaMotion.update(e),d.modelAlpha=this.modelAlphaMotion.value.modelAlpha),this.perspToOrthoMotion.ended===!1&&(this.perspToOrthoMotion.update(e),this.camera.perspToOrtho.setScalar(clamp$1(this.perspToOrthoMotion.value.perspToOrtho,0,1))),this.locationMotion.ended===!1){this.locationMotion.update(e);var w=this.locationMotion.value.count-v.value.count+1,R=new THREE__namespace.Vector3().copy(A.position),I=new THREE__namespace.Vector3().copy(b.position);if(d.progress=w,w>=.01&&w<=.99&&(d.progress=clamp$1(b.effectEasing(w),.01,.99)),b.panoPicture&&(w<1?A.panoPicture&&(d.pano0=A.panoPicture):d.pano0=b.panoPicture,d.pano1=b.panoPicture),b.effect==="montage"?d.transition="BLACK":b.effect==="spread"?d.transition="SPREAD":d.transition="FADE",b.effect==="zoomin"||b.effect==="zoomout")d.progress=Math.pow(w,3);else if(b.effect==="model"&&this.camera.pose.distance<.01){var H=1-Math.pow(clamp$1(Math.abs(w-.5)*2,0,1),4);d.modelAlpha=H}if(w<1&&b.effect!=="fly"){if(d.pano0&&A.panoPicture){var C={panoId:d.pano0.panoId,map:d.pano0.map,mapSize:d.pano0.mapSize,zoom:d.pano0.zoom,matrix:A.panoPicture.matrix.clone().setPosition(b.position)},M=this.panoPictureObserverMap.get(d.pano0);M&&this.panoPictureObserverMap.set(C,M),d.pano0=C}R.copy(I),S=!0}h.distance=this.locationMotion.value.distance,h.offset=new THREE__namespace.Vector3(R.x+(I.x-R.x)*w,R.y+(I.y-R.y)*w,R.z+(I.z-R.z)*w);for(var B=[],L=[],O=0,k=this.locationMotion.keyframes;O<k.length;O++){var D=k[O],q=D.key,z=D.progress;q!==void 0&&(B.push(q),z>this.locationMotion.progress&&L.push(q))}for(var J=0,V=Object.keys(this.panoResources);J<V.length;J++){var U=V[J];if(!(L.indexOf(U)>=0)){var j=this.panoResources[U];if(j.panoPicture){var K=j.panoPicture.map;if(K){if(K===((s=d.pano0)===null||s===void 0?void 0:s.map)||K===((u=d.pano1)===null||u===void 0?void 0:u.map))continue;K.dispose(),j.panoPicture=null}}B.indexOf(U)>=0||delete this.panoResources[U]}}this.currentPano=panoParse(b.panoId),this.emit("pano.moving",createEvent("pano.moving",{userAction:this.userAction,prevPano:panoParse(T.panoId),state:__assign(__assign(__assign(__assign({},panoParse(_.panoId)),{mode:this.mode}),clonePose(this.camera.pose)),h),options:{},progress:this.locationMotion.progress,error:null}))}isEmptyObject(d)===!1&&this.modelScene.parameter.set(d),h.offset&&this.camera.position.copy(h.offset);var ae=this.camera.pose.longitude,re=this.camera.pose.latitude;this.camera.quaternion.fromArray(this.cardboard.sensor.getOrientation()),this.camera.computePose(),(ae!==this.camera.pose.longitude||re!==this.camera.pose.latitude)&&(this.cameraMotion.set(pick(this.camera.pose,["longitude","latitude"]),0).catch(noop),this.emit("camera.update",createEvent("camera.update",{userAction:!0,state:__assign(__assign(__assign({},this.currentPano),{mode:this.mode}),clonePose(this.camera.pose))}))),this.works.getObserver(this.currentPano);var ee=this.works.getObserver(A.panoId),Z=this.works.getObserver(b.panoId),X=new Map;if(ee)for(var se=0,G=ee.accessibleNodes;se<G.length;se++){var W=G[se],M=ee.work.observers[W];if(M){var $=panoStringify({panoIndex:M.panoIndex,workCode:M.work.workCode});X.set($,M)}}if(Z)for(var ne=0,te=Z.accessibleNodes;ne<te.length;ne++){var W=te[ne],M=Z.work.observers[W];if(M){var $=panoStringify({panoIndex:M.panoIndex,workCode:M.work.workCode});X.set($,M)}}if(this.panoMeshes.forEach(function(Se,ze){var Fe=X.get(ze);Fe?(Se.position.copy(Fe.position).applyMatrix4(Fe.work.transform),X.delete(ze)):(o.helper.remove(Se),Se.dispose(),o.panoMeshes.delete(ze))}),X.forEach(function(Se,ze){var Fe=new PanoSphereMesh;Fe.position.copy(Se.position).applyMatrix4(Se.work.transform);var Oe=Se.position.distanceTo(Se.standingPosition)>o.aerialObserverMinHeight;Oe?Fe.scale.setScalar(15):Fe.scale.setScalar(1),o.panoMeshes.set(ze,Fe),o.helper.add(Fe),X.delete(ze)}),this.camera.pose.distance>.1||S?this.panoMeshes.forEach(function(Se,ze){Se.setOpacity(0),Se.updateTime&&Se.updateTime(e,r),Se.visible=!1}):this.panoMeshes.forEach(function(Se,ze){var Fe=panoParse(ze),Oe=o.works.getObserver(Fe);if(Oe){if(!Oe.loadable&&!Oe.active){Se.setOpacity(0);return}var Le=Se.position.clone().setY(o.camera.position.y).distanceTo(o.camera.position);Le<.05?Se.setOpacity(0):Se.setOpacity(clamp$1(1.5/Le,0,1)),panoEqual(o.currentPano,Fe)&&Se.setOpacity(0),Se.lookAt(o.camera.position)}}),this.locationMotion.ended){var ve=this.intersect(e);this.panoMeshes.forEach(function(Se,ze){Se.setCurrent(Se===ve),Se.updateTime&&Se.updateTime(e,r)})}{var w=(l=this.modelScene.parameter.progress)!==null&&l!==void 0?l:1,oe=Math.round(w),fe=this.modelScene.parameter.pano0,be=this.modelScene.parameter.pano1,ie=oe===0?fe:be,M=void 0;if(ie&&(M=this.works.getObserver(ie.panoId),M||(M=this.panoPictureObserverMap.get(ie))),this.tiling.appearDuration=this.tileAppearDuration,this.tiling.maxRequest=w<(canUseNativeImageBitmap()?.6:.99)?0:this.tileMaxRequest,this.tiling.imageOptions=this.imageOptions,!M||!ie||this.tileLevelForFov===!1||this.camera.perspToOrtho.x>0){this.tiling.setObserver(null);var ue={renderer:this.renderer,resolution:this.camera.resolution,pixelRatio:this.camera.pixelRatio,time:this.camera.time,cameraMatrix:this.camera.matrixWorld,cameraProjectionMatrix:this.camera.projectionMatrix,panoMap:null,panoMatrix:new THREE__namespace.Matrix4,panoZoom:1,minLevel:0,level:0};this.tiling.update(ue),this.modelScene.parameter.set("refinedScreen",null)}else{var me=getImageSizeLevel(ie.mapSize),ge=me+1,Ae=new THREE__namespace.Vector2().copy(this.camera.resolution).multiplyScalar(this.camera.pixelRatio),xe=Math.floor(this.tileLevelForFov(this.camera.fov,Ae)),de=xe>me?xe:0;this.tiling.setObserver(M);var ue={renderer:this.renderer,resolution:this.camera.resolution,pixelRatio:this.camera.pixelRatio,time:this.camera.time,cameraMatrix:this.camera.matrixWorld,cameraProjectionMatrix:this.camera.projectionMatrix,panoMap:ie.map,panoMatrix:ie.matrix,panoZoom:ie.zoom,minLevel:ge,level:de},_e=this.tiling.update(ue),He={map:this.tiling.renderTarget.texture,matrixInverse:this.tiling.camera.matrixWorldInverse,projectionMatrix:this.tiling.camera.projectionMatrix,pano:oe,opacity:(fe==null?void 0:fe.panoId)===(be==null?void 0:be.panoId)?1:easeInQuart(Math.abs(((c=this.modelScene.parameter.progress)!==null&&c!==void 0?c:0)-.5)*2)},Ee=this.modelScene.parameter.refinedScreen;(_e||He.pano!==(Ee==null?void 0:Ee.pano)||He.opacity!==(Ee==null?void 0:Ee.opacity))&&this.modelScene.parameter.set("refinedScreen",He)}}this.panoVideo.object.position.copy(this.camera.position),this.panoVideo.updateTime(e);{var pe=b.effect,Ve=this.modelScene.parameter,fe=Ve.pano0,be=Ve.pano1;if(fe&&be&&fe!==be&&(pe==="fly"||pe==="model")&&this.flyEffectUseDepthBuffer){if(((f=this.modelScene.parameter.pano0Depth)===null||f===void 0?void 0:f.panoId)!==fe.panoId||((p=this.modelScene.parameter.pano1Depth)===null||p===void 0?void 0:p.panoId)!==be.panoId){var ye=500,Pe=512;this.pano0DepthCubeRenderTarget?this.pano0DepthCubeRenderTarget.width!==Pe&&this.pano0DepthCubeRenderTarget.setSize(Pe,Pe):this.pano0DepthCubeRenderTarget=new THREE__namespace.WebGLCubeRenderTarget(Pe,{minFilter:THREE__namespace.NearestFilter,magFilter:THREE__namespace.NearestFilter,generateMipmaps:!1}),this.pano1DepthCubeRenderTarget?this.pano1DepthCubeRenderTarget.width!==Pe&&this.pano1DepthCubeRenderTarget.setSize(Pe,Pe):this.pano1DepthCubeRenderTarget=new THREE__namespace.WebGLCubeRenderTarget(Pe,{minFilter:THREE__namespace.NearestFilter,magFilter:THREE__namespace.NearestFilter,generateMipmaps:!1});var Ce=new THREE__namespace.CubeCamera(this.camera.near,this.camera.far,this.pano0DepthCubeRenderTarget);Ce.matrix.copy(fe.matrix),Ce.matrixWorld.copy(Ce.matrix),Ce.matrixAutoUpdate=!1,renderDepthCube(this.renderer,this.modelScene,Ce,ye);var $e=new THREE__namespace.CubeCamera(this.camera.near,this.camera.far,this.pano1DepthCubeRenderTarget);$e.matrix.copy(be.matrix),$e.matrixWorld.copy($e.matrix),$e.matrixAutoUpdate=!1,renderDepthCube(this.renderer,this.modelScene,$e,ye),this.modelScene.parameter.set({pano0Depth:{panoId:fe.panoId,map:this.pano0DepthCubeRenderTarget.texture,mapSize:this.pano0DepthCubeRenderTarget.width,maxDepth:ye},pano1Depth:{panoId:be.panoId,map:this.pano1DepthCubeRenderTarget.texture,mapSize:this.pano1DepthCubeRenderTarget.width,maxDepth:ye}})}}else this.modelScene.parameter.set({pano0Depth:null,pano1Depth:null}),this.flyEffectUseDepthBuffer||(this.pano0DepthCubeRenderTarget&&(this.pano0DepthCubeRenderTarget.dispose(),this.pano0DepthCubeRenderTarget=void 0),this.pano1DepthCubeRenderTarget&&(this.pano1DepthCubeRenderTarget.dispose(),this.pano1DepthCubeRenderTarget=void 0))}}},t.prototype.render=function(){return this.renderer.setRenderTarget(null),this.renderer.setScissorTest(!1),this.cardboard.render(this.scene,this.camera),!0},t.prototype.setCamera=function(e){},t.prototype.destroyHelper=function(){},t.prototype.updateHelperElementSize=function(){if(this.helperElement){var e=new THREE__namespace.Vector2(this.element.offsetWidth,this.element.offsetHeight),r=e.x*this.viewport.left,o=e.y*(1-this.viewport.bottom-this.viewport.height),s=e.x*this.viewport.width,u=e.y*this.viewport.height;this.helperElement.style.marginLeft!==r+"px"&&(this.helperElement.style.marginLeft=r+"px"),this.helperElement.style.marginTop!==o+"px"&&(this.helperElement.style.marginTop=o+"px"),this.helperElement.style.width!==s+"px"&&(this.helperElement.style.width=s+"px"),this.helperElement.style.height!==u+"px"&&(this.helperElement.style.height=u+"px")}},t.prototype.intersect=function(e){var r,o;if(this.locationMotion.ended===!1){this.intersectMesh.visible=!1,this.activePanoMesh=void 0,this.activeTime=void 0;return}if(this.activePanoMesh&&this.activeTime&&e-this.activeTime>ACTIVE_TO_CURRENT_DELAY){var s=this.activePanoMesh,u=null;return this.panoMeshes.forEach(function(R,I){R===s&&(u=I)}),u!==null&&this.moveToPano(panoParse(u),{},!0),this.activePanoMesh=void 0,this.activeTime=void 0,s}var l=this.camera.getDirection(new THREE__namespace.Vector3),c=new THREE__namespace.Raycaster(this.camera.position,l);c.params.Points={threshold:.1},c.firstHitOnly=!0,c.floorIndex=-1;for(var f=void 0,p=[],d=this.works.getObserver(this.currentPano),h=d?d.accessibleNodes.map(function(R){return panoStringify({panoIndex:R,workCode:d.work.workCode})}):[],g=0,m=h;g<m.length;g++){var E=m[g],y=this.panoMeshes.get(E);if(y){var v=c.intersectObject((r=y.hitTestMesh)!==null&&r!==void 0?r:y,!0)[0];if(v){var A=(o=d==null?void 0:d.floorIndex)!==null&&o!==void 0?o:0;p.push({panoMesh:y,intersection:__assign({floorIndex:A,floor:A},v)})}}}var b=p.sort(function(R,I){return R.intersection.distance-I.intersection.distance})[0];b?(f=b.intersection,this.activePanoMesh!==b.panoMesh&&(this.activePanoMesh=b.panoMesh,this.activeTime=e),this.intersectMesh.position.copy(b.panoMesh.position),this.intersectMesh.lookAt(this.camera.position)):(this.activePanoMesh=void 0,this.activeTime=void 0),f||(f=this.modelScene.intersectRaycaster(c)[0]);var T=createEvent("intersect.update",{raycaster:c,intersection:f!=null?f:null,object:this.intersectMesh});if(this.emit("intersect.update",T),T.defaultPrevented){this.hideIntersectMesh();return}if(f&&f.face){var _=f.face.normal,S=new THREE__namespace.Quaternion;S.setFromUnitVectors(new THREE__namespace.Vector3(0,0,1),_),this.intersectMesh.quaternion.copy(S);var w=f.point.clone();this.intersectMesh.position.copy(w),b?this.intersectMesh.visible=!1:this.intersectMesh.visible=!0}else this.intersectMesh.visible=!1;return b==null?void 0:b.panoMesh},t.prototype.onPanGesture=function(){},t.prototype.onTapGesture=function(){},t.prototype.onPinchGesture=function(){},t.prototype.onMouseMove=function(){},t.prototype.onMouseOut=function(){},t})(PanoramaController),HUMAN_EYE_POSITION=new THREE__namespace.Vector3(0,1.6,0),scratchObserverBox$1=new THREE__namespace.Box3,scratchVector3$2=new THREE__namespace.Vector3,defaultModelControllerCustomInitArgs=__assign({},defaultPanoramaLikeControllerCustomInitArgs),ModelController=(function(n){__extends(t,n);function t(e){var r=this,o=t.parseArgs(e);return r=n.call(this,o)||this,r.mode="Model",r.locationMotion=new Motion({x:r.camera.pose.offset.x,y:r.camera.pose.offset.y,z:r.camera.pose.offset.z,distance:r.camera.pose.distance}),r.modelAlphaMotion=new Motion({modelAlpha:r.modelScene.parameter.resolveValue().modelAlpha}),r.perspToOrthoMotion=new Motion({perspToOrtho:r.camera.perspToOrtho.x}),r}return t.parseArgs=function(e){return e instanceof t?e:n.parseArgs.call(this,e)},t.initAnimationEndState=function(e){var r,o,s,u,l,c,f=this.parseArgs(e),p=f.works,d=e.initial,h=d.state,g=d.currentState,m=typeof h.panoIndex=="number"?{workCode:(s=(r=h.workCode)!==null&&r!==void 0?r:(o=f.works[0])===null||o===void 0?void 0:o.workCode)!==null&&s!==void 0?s:"",panoIndex:h.panoIndex}:{workCode:g.workCode,panoIndex:g.panoIndex},E=p.getObserver(m),y=clamp$1((u=h.fov)!==null&&u!==void 0?u:!E||isFristPersonMode(g.mode)?g.fov:f.defaultFov,f.minFov,f.maxFov),v=(l=h.longitude)!==null&&l!==void 0?l:g.longitude,A=clamp$1(typeof f.minLatitude=="function"?f.minLatitude(y):f.minLatitude,-Math.PI/2,Math.PI/2),b=clamp$1(typeof f.maxLatitude=="function"?f.maxLatitude(y):f.maxLatitude,-Math.PI/2,Math.PI/2),T=clamp$1((c=h.latitude)!==null&&c!==void 0?c:!E||isFristPersonMode(g.mode)?g.latitude:f.defaultLatitude,A,b),_=new THREE__namespace.Vector3;if(f.initial.state.offset)_.copy(f.initial.state.offset);else if(E)_.copy(E.position).applyMatrix4(E.work.transform);else{var S=coordinatesToVector(g).setLength(g.distance);_.copy(f.initial.currentState.offset).sub(S)}return{workCode:m.workCode,panoIndex:m.panoIndex,mode:"Model",longitude:v,latitude:T,fov:y,offset:_,distance:0}},t.prototype.updateConfiguration=function(e){return n.prototype.updateConfiguration.call(this,e)},t.prototype.destroy=function(){n.prototype.destroy.call(this),this.locationMotion.dispose()},t.prototype.isReady=function(){return this.locationMotion.ended===!1?!1:n.prototype.isReady.call(this)},t.prototype.updateWork=function(e,r,o,s){this.works=e;var u=t.initAnimationEndState(__assign(__assign({},this),{initial:{currentState:__assign(__assign({},this.currentPano),this.camera.pose),duration:o.duration,effect:o.effect,state:r,userAction:s}}));return(u.workCode!==this.currentPano.workCode||u.panoIndex!==this.currentPano.panoIndex||u.longitude!==this.cameraMotion.value.longitude||u.latitude!==this.cameraMotion.value.latitude||u.fov!==this.cameraMotion.value.fov)&&this.moveToPosition(u.offset,{duration:0,longitude:u.longitude,latitude:u.latitude,fov:u.fov},s),!0},t.prototype.updateCamera=function(e,r,o){var s=this;return this.initAnimationReady.then(function(){s.userAction=o,s.stopMomentumMovement();var u={},l={};return u.distance=0,e.offset!==void 0&&(u.x=e.offset.x,u.y=e.offset.y,u.z=e.offset.z),e.longitude!==void 0&&(l.longitude=e.longitude),e.latitude!==void 0&&(l.latitude=e.latitude),e.fov!==void 0&&(l.fov=e.fov),s.locationMotion.set(u,r).catch(noop),s.cameraMotion.set(l,r).catch(noop)})},t.prototype.updateCameraWithKeyframes=function(e,r,o){var s=this;return this.initAnimationReady.then(function(){s.userAction=o,s.stopMomentumMovement();for(var u=[],l=[],c=0,f=e;c<f.length;c++){var p=f[c];u.push({key:p.key,progress:p.progress,value:{distance:0,x:p.value.offset.x,y:p.value.offset.x,z:p.value.offset.x}}),l.push({key:p.key,progress:p.progress,value:{longitude:p.value.longitude,latitude:p.value.latitude,fov:p.value.fov}})}return s.locationMotion.setKeyframes(u,r).catch(noop),s.cameraMotion.setKeyframes(e,r)})},t.prototype.updateTime=function(e,r){if(!this.destroyed){var o={},s={};if(this.modelAlphaMotion.ended||(this.modelAlphaMotion.update(e),o.modelAlpha=this.modelAlphaMotion.value.modelAlpha),this.modelScene.parameter.modelAlpha===0&&this.modelScene.parameter.progress!==1){var u=this.modelScene.parameter,l=u.pano0,c=u.pano1;l&&l.map!==(c==null?void 0:c.map)&&l.map.dispose(),o.progress=1,o.pano0=o.pano1=c}if(this.perspToOrthoMotion.ended||(this.perspToOrthoMotion.update(e),this.camera.perspToOrtho.setScalar(clamp$1(this.perspToOrthoMotion.value.perspToOrtho,0,1))),!this.locationMotion.ended){this.locationMotion.update(e),s.distance=this.locationMotion.value.distance,s.offset=new THREE__namespace.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z);for(var f=new THREE__namespace.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z),p=[],d=function(_){var S=h.modelScene.models.find(function(H){return H.work===_});if(!S||S.visible===!1||_.observers.length<=0)return"continue";if(scratchObserverBox$1.copy(_.observerBox).expandByScalar(10).applyMatrix4(_.transform),scratchObserverBox$1.containsPoint(f))for(var w=0,R=_.observers;w<R.length;w++){var I=R[w];p.push(I)}},h=this,g=0,m=this.works;g<m.length;g++){var E=m[g];d(E)}var y=arrayMin(p,function(_){return scratchVector3$2.copy(_.position).applyMatrix4(_.work.transform).distanceTo(f)});this.currentPano=y?{workCode:y.work.workCode,panoIndex:y.panoIndex}:{workCode:"",panoIndex:0}}this.cameraMotion.ended||(this.cameraMotion.update(e),s.longitude=this.cameraMotion.value.longitude,s.latitude=this.cameraMotion.value.latitude,s.fov=this.cameraMotion.value.fov),isEmptyObject(o)||this.modelScene.parameter.set(o),isEmptyObject(s)||this.setCamera(s);var v=this.works.getObserver(this.currentPano);if(this.intersectMesh&&this.intersectMesh.parent&&v&&v.position.y-v.standingPosition.y>10){var A=this.camera.position.distanceTo(this.intersectMesh.position),b=2*Math.tan(.5*this.camera.fov/180*Math.PI),T=clamp$1(A*b/5,.5);this.intersectMesh.scale.setScalar(T)}else this.intersectMesh.scale.setScalar(1)}},t.prototype.initAnimation=function(){var e=this;return this.destroyed?Promise.resolve():new Promise(function(r){var o=e.initial;o.state,o.currentState;var s=o.duration,u=o.userAction;e.userAction=u;var l=t.initAnimationEndState(e),c={modelAlpha:1},f={perspToOrtho:0},p={longitude:l.longitude,latitude:l.latitude,fov:l.fov,duration:s,moveStartCallback:function(d){e.perspToOrthoMotion.set(f,s).catch(noop),e.modelAlphaMotion.set(c,s).catch(noop),e.emit("initAnimation.start",createEvent("initAnimation.start",{state:d,userAction:e.userAction}))},moveEndCallback:function(d){e.emit("initAnimation.end",createEvent("initAnimation.end",{state:d,userAction:e.userAction})),r()},moveCancelCallback:function(){var d=e.currentPano,h=__assign(__assign({},d),{mode:e.mode,longitude:e.camera.pose.longitude,latitude:e.camera.pose.latitude,fov:e.camera.pose.fov,offset:e.camera.pose.offset.clone(),distance:e.camera.pose.distance});e.emit("initAnimation.end",createEvent("initAnimation.end",{state:h,userAction:e.userAction})),r()}};e.moveToPosition(l.offset,p,u)})},t.prototype.getTargetState=function(){var e=this.cameraMotion.getKeyFrameSegment(now())[1],r=this.locationMotion.getKeyFrameSegment(now())[1];return __assign(__assign({},this.currentPano),{mode:this.mode,longitude:e.value.longitude,latitude:e.value.latitude,fov:e.value.fov,offset:new THREE__namespace.Vector3(r.value.x,r.value.y,r.value.z),distance:r.value.distance})},t.prototype.moveToPano=function(e,r,o){r===void 0&&(r={});var s=this.works.getObserver(e);if(s){var u=new THREE__namespace.Vector3().copy(s.position).applyMatrix4(s.work.transform);this.moveToPosition(u,r,o)}},t.prototype.moveToPosition=function(e,r,o){var s=this,u,l,c;r===void 0&&(r={}),this.userAction=o,this.stopMomentumMovement();for(var f=now(),p=new THREE__namespace.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z),d=p.distanceTo(e),h=this.locationMotion.getProgressVelocity(f),g=0,m=1;m<this.locationMotion.keyframes.length;m++){var E=this.locationMotion.keyframes[m-1].value,y=E.x,v=E.y,A=E.z,b=this.locationMotion.keyframes[m].value,T=b.x,_=b.y,S=b.z;g+=Math.sqrt(Math.pow(T-y,2)+Math.pow(_-v,2)+Math.pow(S-A,2))}for(var w=d===0?0:h*g/d,R=this.calculateMovingDuration(r.duration,d),I={x:e.x,y:e.y,z:e.z,distance:0},H={longitude:r.longitude,latitude:r.latitude,fov:r.fov},C=[],M=function(V){var U=B.modelScene.models.find(function(re){return re.work===V});if(!U||U.visible===!1||V.observers.length<=0)return"continue";if(scratchObserverBox$1.copy(V.observerBox).expandByScalar(10).applyMatrix4(V.transform),scratchObserverBox$1.containsPoint(p))for(var j=0,K=V.observers;j<K.length;j++){var ae=K[j];C.push(ae)}},B=this,L=0,O=this.works;L<O.length;L++){var k=O[L];M(k)}var D=arrayMin(C,function(V){return scratchVector3$2.copy(V.position).applyMatrix4(V.work.transform).distanceTo(p)}),q=D?{workCode:D.work.workCode,panoIndex:D.panoIndex}:{workCode:"",panoIndex:0},z=__assign(__assign({},q),{mode:this.mode,longitude:(u=H.longitude)!==null&&u!==void 0?u:this.camera.pose.longitude,latitude:(l=H.latitude)!==null&&l!==void 0?l:this.camera.pose.latitude,fov:(c=H.fov)!==null&&c!==void 0?c:this.camera.pose.fov,offset:e.clone(),distance:0}),J=this.currentPano;this.emit("pano.moveTo",createEvent("pano.moveTo",{options:r,prevPano:J,progress:0,state:z,userAction:this.userAction,error:null})),r.moveStartCallback&&r.moveStartCallback(z),this.cameraMotion.set(H,R).catch(noop),this.locationMotion.set(I,R,w).then(function(){for(var V=0,U=s.modelScene.children;V<U.length;V++){var j=U[V];j instanceof Model&&j.show()}var K=__assign(__assign(__assign({},q),{mode:s.mode}),clonePose(s.camera.pose));s.emit("pano.arrived",createEvent("pano.arrived",{options:r,prevPano:J,progress:0,state:K,userAction:s.userAction,error:null})),r.moveEndCallback&&r.moveEndCallback(K)},function(){r.moveCancelCallback&&r.moveCancelCallback(),s.emit("pano.cancel",createEvent("pano.cancel",{options:r,prevPano:J,progress:0,state:z,userAction:s.userAction,error:null}))})},t.prototype.onTapGesture=function(e){var r=e.center.raycaster;this.stopMomentumMovement();var o=this.modelScene.intersectRaycaster(r)[0];if(o&&o.face){var s=o.face.normal,u=o.point;if(new THREE__namespace.Vector3(0,1,0).angleTo(s)>Math.PI/3){var l=new THREE__namespace.Raycaster;l.firstHitOnly=!0;var c=s.clone().setLength(.3).add(u);l.set(c,new THREE__namespace.Vector3(0,-1,0)),o=this.modelScene.intersectRaycaster(l)[0]}}if(o){for(var f=new THREE__namespace.Vector3().copy(o.point).add(HUMAN_EYE_POSITION),p=[],d=function(T){var _=h.modelScene.models.find(function(I){return I.work===T});if(!_||_.visible===!1||T.observers.length<=0)return"continue";if(scratchObserverBox$1.copy(T.observerBox).expandByScalar(10).applyMatrix4(T.transform),scratchObserverBox$1.containsPoint(f))for(var S=0,w=T.observers;S<w.length;S++){var R=w[S];p.push(R)}},h=this,g=0,m=this.works;g<m.length;g++){var E=m[g];d(E)}var y=arrayMin(p,function(T){return scratchVector3$2.copy(T.position).applyMatrix4(T.work.transform).distanceTo(f)},!0),v=y[0],A=y[1];if(v&&A<5){var b=scratchVector3$2.copy(v.position).applyMatrix4(v.work.transform);f.y=b.y}e.state.offset.copy(f),e.state.distance=0,this.emit("gesture.tap",e),e.defaultPrevented||this.moveToPosition(f,{},!0)}else this.emit("gesture.tap",e),e.defaultPrevented||this.cameraBounce()},t})(PanoramaLikeController),scratchObserverBox=new THREE__namespace.Box3,scratchVector3$1=new THREE__namespace.Vector3,minDistance=.5,PANGESTURE_FORWARD_ANGLE=Math.PI/7,defaultMapviewControllerCustomInitArgs={defaultLongitude:Math.PI/4,defaultLatitude:Math.PI/4,defaultDistance:150,maxLatitude:+Math.PI/2,minLatitude:0,cameraType:"auto",cameraFence:null,intersectMeshCreator:function(){return new IntersectMesh}},MapviewController=(function(n){__extends(t,n);function t(e){var r=this,o=t.parseArgs(e);return r=n.call(this,o)||this,r.mode="Mapview",r.defaultLongitude=o.defaultLongitude,r.defaultLatitude=o.defaultLatitude,r.defaultDistance=o.defaultDistance,r.maxLatitude=o.maxLatitude,r.minLatitude=o.minLatitude,r.cameraType=o.cameraType,r.cameraFence=o.cameraFence,r.locationMotion=new Motion({x:r.camera.pose.offset.x,y:r.camera.pose.offset.y,z:r.camera.pose.offset.z,distance:r.camera.pose.distance}),r.modelAlphaMotion=new Motion({modelAlpha:r.modelScene.parameter.resolveValue().modelAlpha}),r.perspToOrthoMotion=new Motion({perspToOrtho:r.camera.perspToOrtho.x}),r.pendingTextureId=null,r.textureLoader=new TextureLoader,r.intersectMeshCreator=o.intersectMeshCreator,r.intersectMesh=r.intersectMeshCreator(),r.intersectMesh.name="intersect",r.intersectMesh.visible=!1,r.helper.add(r.intersectMesh),r}return t.parseArgs=function(e){var r,o,s,u,l,c,f,p;if(e instanceof t)return e;var d=n.parseArgs.call(this,e);return __assign(__assign({},d),{defaultLongitude:(r=e.defaultLongitude)!==null&&r!==void 0?r:defaultMapviewControllerCustomInitArgs.defaultLongitude,defaultLatitude:(o=e.defaultLatitude)!==null&&o!==void 0?o:defaultMapviewControllerCustomInitArgs.defaultLatitude,defaultDistance:(s=e.defaultDistance)!==null&&s!==void 0?s:defaultMapviewControllerCustomInitArgs.defaultDistance,maxLatitude:(u=e.maxLatitude)!==null&&u!==void 0?u:defaultMapviewControllerCustomInitArgs.maxLatitude,minLatitude:(l=e.minLatitude)!==null&&l!==void 0?l:defaultMapviewControllerCustomInitArgs.minLatitude,cameraType:(c=e.cameraType)!==null&&c!==void 0?c:defaultMapviewControllerCustomInitArgs.cameraType,cameraFence:(f=e.cameraFence)!==null&&f!==void 0?f:defaultMapviewControllerCustomInitArgs.cameraFence,intersectMeshCreator:(p=e.intersectMeshCreator)!==null&&p!==void 0?p:defaultMapviewControllerCustomInitArgs.intersectMeshCreator})},t.distanceFromModel=function(e,r,o){var s=e.boundingBox,u=s.isEmpty()?10:Math.pow(Math.pow(s.max.x-s.min.x+1,2)+Math.pow(s.max.y-s.min.y+1,2)+Math.pow(s.max.z-s.min.z+1,2),1/2);u=isNaN(u)||!isFinite(u)?1:u;var l=u/2/Math.tan(Math.PI*r/360);return o<1&&(l=l/o),isNaN(l)||!isFinite(l)?u:l},t.initAnimationEndState=function(e){var r,o,s,u,l,c,f,p=this.parseArgs(e),d=p.works,h=p.modelScene,g=e.initial,m=g.state,E=g.currentState,y=typeof m.panoIndex=="number"?{workCode:(s=(r=m.workCode)!==null&&r!==void 0?r:(o=p.works[0])===null||o===void 0?void 0:o.workCode)!==null&&s!==void 0?s:"",panoIndex:m.panoIndex}:{workCode:E.workCode,panoIndex:E.panoIndex},v=(u=m.fov)!==null&&u!==void 0?u:60,A=clamp$1(typeof p.minLatitude=="function"?p.minLatitude(v):p.minLatitude,-Math.PI/2,Math.PI/2),b=clamp$1(typeof p.maxLatitude=="function"?p.maxLatitude(v):p.maxLatitude,-Math.PI/2,Math.PI/2),T=clamp$1((l=m.latitude)!==null&&l!==void 0?l:isThirdPersonMode(E.mode)?E.latitude:p.defaultLatitude,A,b),_=t.distanceFromModel(p.modelScene,v,p.camera.aspect),S=new THREE__namespace.Vector3,w=(c=m.distance)!==null&&c!==void 0?c:Math.min(p.defaultDistance,_),R=(f=m.longitude)!==null&&f!==void 0?f:isThirdPersonMode(E.mode)?E.longitude:p.defaultLongitude;if(m.offset)S.copy(m.offset);else{var I=d.getObserver(y);p.defaultDistance<_&&I?(S.copy(I.position).applyMatrix4(I.work.transform),m.longitude===void 0&&(R=E.longitude)):(h.boundingBox.getCenter(S),w=_)}return __assign(__assign({},y),{mode:"Mapview",longitude:R,latitude:T,fov:v,offset:S,distance:w})},t.prototype.updateConfiguration=function(e){var r=n.prototype.updateConfiguration.call(this,e);if(r===!1)return!1;if(e.defaultLongitude!==void 0&&this.defaultLongitude!==e.defaultLongitude&&(this.defaultLongitude=e.defaultLongitude),e.defaultLatitude!==void 0&&this.defaultLatitude!==e.defaultLatitude&&(this.defaultLatitude=e.defaultLatitude),e.defaultDistance!==void 0&&this.defaultDistance!==e.defaultDistance&&(this.defaultDistance=e.defaultDistance),e.maxLatitude!==void 0&&this.maxLatitude!==e.maxLatitude&&(this.maxLatitude=e.maxLatitude),e.minLatitude!==void 0&&this.minLatitude!==e.minLatitude&&(this.minLatitude=e.minLatitude),e.cameraType!==void 0&&this.cameraType!==e.cameraType&&(this.cameraType=e.cameraType),this.cameraFence instanceof THREE__namespace.Box3&&e.cameraFence instanceof THREE__namespace.Box3?this.cameraFence.equals(e.cameraFence)||(this.cameraFence=e.cameraFence):this.cameraFence instanceof THREE__namespace.Sphere&&e.cameraFence instanceof THREE__namespace.Sphere?this.cameraFence.equals(e.cameraFence)||(this.cameraFence=e.cameraFence):e.cameraFence!==void 0&&(this.cameraFence=e.cameraFence),e.intersectMeshCreator!==void 0&&this.intersectMeshCreator!==e.intersectMeshCreator){this.intersectMeshCreator=e.intersectMeshCreator;var o=this.intersectMesh;this.intersectMesh=this.intersectMeshCreator(),this.intersectMesh.name=o.name,this.intersectMesh.visible=o.visible;var s=this.intersectMesh.parent;s&&s.add(this.intersectMesh),o.dispose()}return!0},t.prototype.destroy=function(){n.prototype.destroy.call(this),this.pendingTextureId=null,this.locationMotion.dispose(),this.panState=void 0,this.intersectMesh.dispose(),this.helper.remove(this.intersectMesh)},t.prototype.isReady=function(){return this.locationMotion.ended===!1?!1:n.prototype.isReady.call(this)},t.prototype.updateWork=function(e,r,o,s){this.userAction=s,this.works=e;var u=t.initAnimationEndState(__assign(__assign({},this),{initial:{currentState:__assign(__assign({},this.currentPano),this.camera.pose),duration:o.duration,effect:o.effect,state:r,userAction:s}}));this.currentPano={workCode:u.workCode,panoIndex:u.panoIndex};var l={longitude:u.longitude,latitude:u.latitude,fov:u.fov},c={x:u.offset.x,y:u.offset.y,z:u.offset.z,distance:u.distance};return(l.longitude!==this.cameraMotion.value.longitude||l.latitude!==this.cameraMotion.value.latitude||l.fov!==this.cameraMotion.value.fov)&&this.cameraMotion.set(l,o.duration).catch(noop),(c.x!==this.locationMotion.value.x||c.y!==this.locationMotion.value.y||c.z!==this.locationMotion.value.z||c.distance!==this.locationMotion.value.distance)&&this.locationMotion.set(c,o.duration).catch(noop),!0},t.prototype.updateModel=function(e){n.prototype.updateModel.call(this,e),this.hideIntersectMesh()},t.prototype.updateCamera=function(e,r,o){var s=this;return this.initAnimationReady.then(function(){s.userAction=o,s.stopMomentumMovement();var u={},l={};return e.distance!==void 0&&(u.distance=e.distance),e.offset!==void 0&&(u.x=e.offset.x,u.y=e.offset.y,u.z=e.offset.z),e.longitude!==void 0&&(l.longitude=e.longitude),e.latitude!==void 0&&(l.latitude=e.latitude),e.fov!==void 0&&(l.fov=e.fov),s.locationMotion.set(u,r).catch(noop),s.cameraMotion.set(l,r).catch(noop)})},t.prototype.updateCameraWithKeyframes=function(e,r,o){var s=this;return this.initAnimationReady.then(function(){s.userAction=o,s.stopMomentumMovement();for(var u=[],l=[],c=0,f=e;c<f.length;c++){var p=f[c];u.push({key:p.key,progress:p.progress,value:{distance:p.value.distance,x:p.value.offset.x,y:p.value.offset.x,z:p.value.offset.x}}),l.push({key:p.key,progress:p.progress,value:{longitude:p.value.longitude,latitude:p.value.latitude,fov:p.value.fov}})}return s.locationMotion.setKeyframes(u,r).catch(noop),s.cameraMotion.setKeyframes(e,r)})},t.prototype.updateTime=function(e,r){if(!this.destroyed){var o={},s={};if(this.locationMotion.ended||(this.locationMotion.update(e),s.distance=this.locationMotion.value.distance,s.offset=new THREE__namespace.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z)),this.cameraMotion.ended||(this.cameraMotion.update(e),s.longitude=this.cameraMotion.value.longitude,s.latitude=this.cameraMotion.value.latitude,s.fov=this.cameraMotion.value.fov),this.modelAlphaMotion.ended||(this.modelAlphaMotion.update(e),o.modelAlpha=this.modelAlphaMotion.value.modelAlpha),this.modelScene.parameter.modelAlpha===0&&this.modelScene.parameter.progress!==1){var u=this.modelScene.parameter,l=u.pano0,c=u.pano1;l&&l.map!==(c==null?void 0:c.map)&&l.map.dispose(),o.progress=1,o.pano0=o.pano1=c}var f=0;if(this.cameraType==="auto"?f=Math.abs(Math.PI/2-this.cameraMotion.value.latitude)<.02||Math.abs(-Math.PI/2-this.cameraMotion.value.latitude)<.02?1:0:this.cameraType==="perspective"?f=0:this.cameraType==="orthographic"&&(f=1),this.perspToOrthoMotion.getTargetKeyframe().value.perspToOrtho!==f&&this.perspToOrthoMotion.set({perspToOrtho:f},500).catch(noop),this.perspToOrthoMotion.ended||(this.perspToOrthoMotion.update(e),this.camera.perspToOrtho.setScalar(clamp$1(this.perspToOrthoMotion.value.perspToOrtho,0,1))),isEmptyObject(o)||this.modelScene.parameter.set(o),isEmptyObject(s)||this.setCamera(s),this.cameraFence&&!this.panState&&!this.pinchState&&!this.mouseWheelState&&!this.inMomentumMovement&&this.locationMotion.ended&&this.perspToOrthoMotion.ended&&this.cameraMotion.ended){var p=coordinatesToVector(this.camera.pose,new THREE__namespace.Vector3),d=new THREE__namespace.Vector3().copy(this.camera.pose.offset).sub(p.clone().multiplyScalar(this.camera.pose.distance));if(this.cameraFence.distanceToPoint(d)>.01){var h=this.cameraFence.clampPoint(d,new THREE__namespace.Vector3),g=this.camera.pose.offset.clone().add(h).sub(d),m=__assign(__assign({},this.currentPano),{mode:this.mode,longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude,fov:this.camera.pose.fov,offset:g,distance:this.camera.pose.distance});this.fixFinalState(m),this.locationMotion.set({x:m.offset.x,y:m.offset.y,z:m.offset.z,distance:m.distance},300).catch(noop)}}if(this.intersectMesh&&this.intersectMesh.parent){var E=this.camera.position.distanceTo(this.intersectMesh.position),y=2*Math.tan(.5*this.camera.fov/180*Math.PI),v=clamp$1(E*y/5,.5);this.intersectMesh.scale.setScalar(v)}else this.intersectMesh.scale.setScalar(1)}},t.prototype.getTargetState=function(){var e=this.cameraMotion.getKeyFrameSegment(now())[1],r=this.locationMotion.getKeyFrameSegment(now())[1];return __assign(__assign({},this.currentPano),{mode:this.mode,longitude:e.value.longitude,latitude:e.value.latitude,fov:e.value.fov,distance:r.value.distance,offset:new THREE__namespace.Vector3(r.value.x,r.value.y,r.value.z)})},t.prototype.initAnimation=function(){var e=this;return this.destroyed?Promise.resolve():new Promise(function(r){var o=e.initial;o.state,o.currentState;var s=o.duration,u=o.userAction;e.userAction=u;var l=t.initAnimationEndState(e),c={longitude:l.longitude,latitude:l.latitude,fov:l.fov},f={x:l.offset.x,y:l.offset.y,z:l.offset.z,distance:l.distance},p={modelAlpha:1},d={perspToOrtho:0};e.emit("initAnimation.start",createEvent("initAnimation.start",{state:l,userAction:e.userAction})),e.perspToOrthoMotion.set(d,s).catch(noop),e.modelAlphaMotion.set(p,s/3).catch(noop),e.cameraMotion.set(c,s).catch(noop),e.locationMotion.set(f,s).then(function(){e.emit("initAnimation.end",createEvent("initAnimation.end",{state:l,userAction:e.userAction}))},function(h){var g=__assign(__assign(__assign({},e.currentPano),{mode:e.mode}),clonePose(e.camera.pose));e.emit("initAnimation.end",createEvent("initAnimation.end",{state:g,userAction:e.userAction}))}).then(function(){r()})})},t.prototype.getForwardObserverOrNot=function(e){var r=this.modelScene.intersectRaycaster(e)[0];if(!r)return null;for(var o=[],s=function(g){var m=u.modelScene.models.find(function(A){return A.work===g});if(!m||m.visible===!1||g.observers.length<=0)return"continue";if(scratchObserverBox.copy(g.observerBox).expandByScalar(10).applyMatrix4(g.transform),scratchObserverBox.containsPoint(e.ray.origin)||e.ray.intersectsBox(scratchObserverBox))for(var E=0,y=g.observers;E<y.length;E++){var v=y[E];o.push(v)}},u=this,l=0,c=this.works;l<c.length;l++){var f=c[l];s(f)}var p=arrayMin(o,function(g){return scratchVector3$1.copy(g.standingPosition).applyMatrix4(g.work.transform).distanceTo(r.point)},!0),d=p[0],h=p[1];return d&&h<Math.max(d.standingPosition.distanceTo(this.camera.position)/5,10)?d:null},t.prototype.coordinatesForOffset=function(e){var r=this.renderer.getSize(new THREE__namespace.Vector2);return{longitude:-2*e.x/(r.x*this.viewport.width),latitude:2*e.y/(r.y*this.viewport.height)}},t.prototype.requestMomentumMovement=function(e,r,o,s){var u=this;if(this.inMomentumMovement!==null){s=Math.max(s,1);for(var l=__assign({},o),c={longitude:0,latitude:0,x:0,y:0,z:0},f=0;f<s;f++)l.longitude*=.996,l.latitude*=.996*.998,l.x*=.99,l.y*=.99,l.z*=.99,c.longitude+=l.longitude,c.latitude+=l.latitude,c.x+=l.x,c.y+=l.y,c.z+=l.z;var p=this.cameraMotion.value.fov,d=formatRad$1(this.cameraMotion.value.longitude+c.longitude),h=clamp$1(typeof this.minLatitude=="function"?this.minLatitude(p):this.minLatitude,-Math.PI/2,Math.PI/2),g=clamp$1(typeof this.maxLatitude=="function"?this.maxLatitude(p):this.maxLatitude,-Math.PI/2,Math.PI/2),m=clamp$1(this.cameraMotion.value.latitude+c.latitude,h,g),E=new THREE__namespace.Vector3(this.locationMotion.value.x+c.x,this.locationMotion.value.y+c.y,this.locationMotion.value.z+c.z),y=__assign(__assign({},this.currentPano),{mode:this.mode,longitude:d,latitude:m,offset:E,fov:p,distance:this.locationMotion.value.distance}),v=e.state.offset.clone().sub(coordinatesToVector(e.state).setLength(y.distance)),A=!(Math.abs(l.longitude)>1e-4||Math.abs(l.latitude)>1e-4||Math.abs(l.x)>1e-4||Math.abs(l.y)>1e-4||Math.abs(l.z)>1e-4),b=this.cameraFence?this.cameraFence.containsPoint(v):!0;b===!1&&(A=!0);var T=createEvent("gesture.momentum",__assign(__assign({},e),{isFirst:r,isFinal:A,state:y}));if(this.inMomentumMovement.event=T,this.emit("gesture.momentum",T),e.defaultPrevented){this.inMomentumMovement=null;return}this.inMomentumMovement&&(this.cameraMotion.set({longitude:d,latitude:m},0).catch(noop),this.locationMotion.set({x:y.offset.x,y:y.offset.y,z:y.offset.z,distance:y.distance},0).catch(noop),A?this.inMomentumMovement=null:AnimationFrameLoop.shared.add(function(_,S){u.requestMomentumMovement(e,!1,l,S)},!0))}},t.prototype.fixFinalState=function(e){if(this.perspToOrthoMotion.getTargetKeyframe().value.perspToOrtho!==1){var r=coordinatesToVector(e,new THREE__namespace.Vector3),o=new THREE__namespace.Vector3().copy(e.offset).sub(r.clone().multiplyScalar(e.distance)),s=new THREE__namespace.Raycaster(o,r);s.params.Points={threshold:.1},s.firstHitOnly=!0,s.hitFilter=function(d){return d.distance>minDistance+s.near},s.near=this.camera.near,s.far=this.camera.far;var u;if(u=this.modelScene.intersectRaycaster(s)[0],!u){var l=new THREE__namespace.Plane(new THREE__namespace.Vector3(0,1,0),-this.modelScene.boundingBox.min.y),c=s.ray.intersectPlane(l,new THREE__namespace.Vector3);if(c){var f=c.distanceTo(s.ray.origin);f<1e3&&f>=s.near&&(u={distance:f,floorIndex:0,floor:0,point:c,object:this.scene,face:null})}}if(!u){var p=Math.max(e.distance,3);u={distance:p,floorIndex:0,floor:0,point:s.ray.direction.clone().setLength(p).add(s.ray.origin),object:this.scene,face:null}}u&&(e.distance=clamp$1(u.distance,0,1/0),e.offset.copy(o).add(r.clone().multiplyScalar(e.distance)))}},t.prototype.onPanGesture=function(e){this.userAction=e.userAction,this.stopMomentumMovement(),this.hideIntersectMesh();var r=e.pointers.length,o=this.panState,s=0,u=!1;e.pointerType==="mouse"&&(s=e.srcEvent.buttons,u=e.srcEvent.shiftKey),o&&s===0&&o.buttons!==0&&(s=o.buttons);var l=o==null?void 0:o.target;if(!l){var c=this.relativeClientPosition(e.center),f=this.createRaycasterFromCamera(c,this.camera);l=new THREE__namespace.Vector3().copy(f.ray.direction).multiplyScalar(3).add(f.ray.origin);var p=this.modelScene.intersectRaycaster(f)[0];if(!p&&f.ray.direction.y<-.3){var d=new THREE__namespace.Plane(new THREE__namespace.Vector3(0,1,0),0),h=f.ray.intersectPlane(d,new THREE__namespace.Vector3);if(h){var g=h.distanceTo(f.ray.origin);g<1e4&&g>=f.near&&(p={distance:g,floorIndex:0,floor:0,point:h,object:this.scene})}}if(p)l.copy(p.point);else{var m=new THREE__namespace.Vector3().copy(this.camera.pose.offset).sub(this.camera.position).normalize(),d=new THREE__namespace.Plane().setFromNormalAndCoplanarPoint(m,this.camera.pose.offset);f.ray.intersectPlane(d,l)}}if(e.isFinal?this.panState=void 0:this.panState={target:l,buttons:s,pointerLength:r,x:e.center.x,y:e.center.y},!(typeof o=="undefined"||o.pointerLength!==r)){var E=r>1||s===2||u;if(E){var y={x:e.center.x-o.x,y:e.center.y-o.y},v=new THREE__namespace.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z),A=coordinatesToVector(this.cameraMotion.value).setLength(this.locationMotion.value.distance).add(v),b=new THREE__namespace.Vector3().copy(A).sub(o.target).length();b*=Math.tan(this.camera.pose.fov/2*Math.PI/180);var T=this.renderer.getSize(new THREE__namespace.Vector2),_=2*y.x*b/T.y,S=2*y.y*b/T.y,w=new THREE__namespace.Vector3;w.setFromMatrixColumn(this.camera.matrix,0),w.multiplyScalar(-_),v.add(w),this.camera.pose.latitude<PANGESTURE_FORWARD_ANGLE?w.setFromMatrixColumn(this.camera.matrix,1):(w.setFromMatrixColumn(this.camera.matrix,0),w.crossVectors(this.camera.up,w)),w.multiplyScalar(S),v.add(w);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:v,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),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)),e.isFinal){var I=this.renderer.getSize(new THREE__namespace.Vector2),H=2*e.velocityX*b/I.y,C=2*e.velocityY*b/I.y,M=new THREE__namespace.Vector3,B=new THREE__namespace.Vector3;M.setFromMatrixColumn(this.camera.matrix,0),M.multiplyScalar(-H),B.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(C),B.add(M),this.inMomentumMovement={uuid:createUuid()},this.requestMomentumMovement(e,!0,{longitude:0,latitude:0,x:B.x,y:B.y,z:B.z},0)}}else{var y={x:e.center.x-o.x,y:e.center.y-o.y},L=this.coordinatesForOffset(y),O=formatRad$1(this.cameraMotion.value.longitude+L.longitude),k=this.camera.pose.fov,D=clamp$1(typeof this.minLatitude=="function"?this.minLatitude(k):this.minLatitude,-Math.PI/2,Math.PI/2),q=clamp$1(typeof this.maxLatitude=="function"?this.maxLatitude(k):this.maxLatitude,-Math.PI/2,Math.PI/2),z=clamp$1(this.cameraMotion.value.latitude+L.latitude,D,q);this.camera.aspect<1&&Math.abs(e.overallVelocityX)>.2&&Math.atan2(Math.abs(e.overallVelocityY),Math.abs(e.overallVelocityX))<Math.PI/6.923&&(z=this.cameraMotion.value.latitude);var R=__assign(__assign({},this.currentPano),{mode:this.mode,longitude:O,latitude:z,fov:k,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):this.cameraMotion.set({longitude:R.longitude,latitude:R.latitude},0).catch(noop),e.isFinal){var J=e.velocityX,V=e.velocityY;this.inMomentumMovement={uuid:createUuid()},this.requestMomentumMovement(e,!0,__assign(__assign({},this.coordinatesForOffset({x:J,y:V})),{x:0,y:0,z:0}),0)}}}},t.prototype.onPinchGesture=function(e){var r;if(this.initAnimationIsReady){this.userAction=e.userAction,this.stopMomentumMovement(),this.hideIntersectMesh();var o=(r=this.pinchState)===null||r===void 0?void 0:r.distance;if(e.isFirst){this.pinchState={x:e.center.x,y:e.center.y,scale:1,distance:this.locationMotion.value.distance};return}if(typeof o!="undefined"){var s=this.modelScene.boundingBox.getCenter(new THREE__namespace.Vector3),u=t.distanceFromModel(this.modelScene,this.cameraMotion.value.fov,this.camera.aspect),l=clamp$1(o/e.scale,minDistance,1/0),c=e.state.offset.clone().sub(coordinatesToVector(e.state).setLength(l)),f=this.modelScene.boundingBox.containsPoint(c),p;if(!f&&this.pinchState&&this.pinchState.scale>e.scale&&s.distanceTo(c)>u?p=e.state.distance:(p=l,this.pinchState&&(this.pinchState.scale=e.scale)),e.state.distance=p,this.emit("gesture.pinch",e),!e.defaultPrevented&&(this.locationMotion.set({distance:e.state.distance},0).catch(noop),e.pointerType!=="mouse"&&(e.type="gesture.pan",this.onPanGesture(e)),e.isFinal)){if(!("__fixFinalState"in e)){var d=e.state;this.fixFinalState(e.state);var h={x:d.offset.x,y:d.offset.y,z:d.offset.z,distance:d.distance};this.locationMotion.set(h,0).catch(noop)}this.panState=void 0,this.pinchState=void 0}}}},t.prototype.onMouseMove=function(e){var r,o;if(this.intersectMesh.parent&&!this.panState&&!this.pinchState&&!this.mouseWheelState&&(this.emit("gesture.mousemove",e),!e.defaultPrevented)){var s=e.center.raycaster;if(e.isFinal&&this.intersectMesh.parent&&this.intersectMesh.visible===!0){this.hideIntersectMesh();return}var u=this.modelScene.intersectRaycaster(s)[0],l=createEvent("intersect.update",{raycaster:s,intersection:u!=null?u:null,object:this.intersectMesh});if(this.emit("intersect.update",l),l.defaultPrevented){this.hideIntersectMesh();return}if(u){var c=(o=(r=u.face)===null||r===void 0?void 0:r.normal)!==null&&o!==void 0?o:new THREE__namespace.Vector3().copy(s.ray.direction).multiplyScalar(-1),f=c.clone(),p=u.point.clone();this.intersectMesh.position.copy(p);var d=p.clone().add(f);if(this.intersectMesh.lookAt(d),Math.abs(c.y)>.99){var h=this.camera.position.clone().sub(p);this.intersectMesh.rotation.z=-Math.atan2(h.z,h.x)}this.intersectMesh.visible=!0,this.needsRender=!0}else this.hideIntersectMesh()}},t.prototype.onMouseWheel=function(e){if(this.initAnimationIsReady)if(this.userAction=e.userAction,this.stopMomentumMovement(),this.hideIntersectMesh(),e.isFinal){var r=e.state;if(this.fixFinalState(r),this.emit("gesture.mousewheel",e),e.defaultPrevented)return;var o={x:r.offset.x,y:r.offset.y,z:r.offset.z,distance:r.distance};this.locationMotion.set(o,0).catch(noop)}else{var s=t.distanceFromModel(this.modelScene,this.cameraMotion.value.fov,this.camera.aspect),u=new THREE__namespace.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z),l=coordinatesToVector(this.cameraMotion.value,new THREE__namespace.Vector3).negate(),c=new THREE__namespace.Ray(u,l).intersectBox(this.modelScene.boundingBox,new THREE__namespace.Vector3);c&&(s+=c.distanceTo(u));var f=Math.max(this.locationMotion.value.distance-this.camera.near,0),p=e.center.delta/10*Math.max(f/5,.1);if(f<=s||p>0)if(this.locationMotion.value.distance-p>=minDistance){var d=this.locationMotion.value.distance-p;e.state.distance=d}else{var h=coordinatesToVector(this.cameraMotion.value);h.setLength(p),e.state.offset.add(h)}if(this.emit("gesture.mousewheel",e),e.defaultPrevented)return;this.locationMotion.set({distance:e.state.distance,x:e.state.offset.x,y:e.state.offset.y,z:e.state.offset.z},0).catch(noop)}},t.prototype.onTapGesture=function(e){var r=this,o;this.userAction=e.userAction,this.stopMomentumMovement();var s=e.center.raycaster,u=this.getForwardObserverOrNot(s);if(!u)this.emit("gesture.tap",e);else{var l={longitude:this.camera.pose.longitude,latitude:0},c=__assign(__assign({},e.state),{mode:"Panorama",workCode:u.work.workCode,panoIndex:u.panoIndex,longitude:l.longitude,latitude:l.latitude,offset:u?u.position.clone():new THREE__namespace.Vector3,distance:0});if(e.state=c,this.emit("gesture.tap",e),!e.defaultPrevented&&(this.emit("pano.select",createEvent("pano.select",{prevPano:this.currentPano,state:c,userAction:e.userAction,options:l,progress:0,error:null})),u&&u.active)){var f=this.pendingTextureId=createUuid(),p={panoIndex:u.panoIndex,workCode:u.work.workCode},d=panoStringify(p),h={right:u.images.work.getURL(u.images.right),left:u.images.work.getURL(u.images.left),up:u.images.work.getURL(u.images.up),down:u.images.work.getURL(u.images.down),front:u.images.work.getURL(u.images.front),back:u.images.work.getURL(u.images.back)},g=this.imageOptions.transform,m=__assign({key:"pano.".concat(d)},pick(this.imageOptions,["format","size","quality","sharpen","forceUseExifOrientation","mappings"])),E="pano:"+jsonHash([h,m,g]),y=this.modelScene.parameter,v=void 0;y.pano0&&y.pano0.map.name===E?v=y.pano0:y.pano1&&y.pano1.map.name===E&&(v=y.pano1),v?(y.pano0&&y.pano0.map!==v.map&&y.pano0.map.dispose(),y.pano1&&y.pano1.map!==v.map&&y.pano1.map!==((o=y.pano0)===null||o===void 0?void 0:o.map)&&y.pano1.map.dispose(),y.set({pano0:v,pano1:v}),this.emit("pano.request",createEvent("pano.request",{userAction:!0,prevPano:this.currentPano,progress:0,state:c,options:l,error:null}))):this.textureLoader.loadCubeTexture(h,{imageURL:{transform:g,options:m},format:THREE__namespace.RGBFormat,viaAjax:!0,fetcher:getFetcher(this.fiveId,u.work)},void 0,void 0,void 0,this.renderer).then(function(A){var b,T,_=A.body;if(r.destroyed||r.pendingTextureId!==f){_.dispose();return}r.pendingTextureId=null,_.name=E;var S=Array.isArray(_.image)?_.image[0]:_.image,w=(b=S==null?void 0:S.width)!==null&&b!==void 0?b:2048,R={panoId:d,map:_,mapSize:w,matrix:u.matrix.clone().premultiply(u.work.transform),zoom:1};y.pano0&&y.pano0.map.dispose(),y.pano1&&y.pano1.map!==((T=y.pano0)===null||T===void 0?void 0:T.map)&&y.pano1.map.dispose(),y.set({pano0:R,pano1:R}),r.emit("pano.request",createEvent("pano.request",{userAction:!0,prevPano:r.currentPano,progress:0,state:c,options:l,error:null}))}).catch(function(A){r.destroyed||r.pendingTextureId!==f||(r.pendingTextureId=null)})}}},t.prototype.onDblTapGesture=function(e){if(this.initAnimationIsReady){this.userAction=e.userAction,this.stopMomentumMovement(),this.hideIntersectMesh();var r=e.state,o=e.center.raycaster,s=o.ray.origin.clone().add(o.ray.direction.clone().setLength(3)),u=1,l=3,c=u,f=this.modelScene.intersectRaycaster(o)[0];if(f&&(s=f.point.clone(),f.distance>(u+l)/2?c=u:c=l),e.state.distance=c,e.state.offset=s,this.emit("gesture.dbltap",e),!e.defaultPrevented){var p={x:r.offset.x,y:r.offset.y,z:r.offset.z,distance:r.distance};this.locationMotion.set(p,360).catch(noop),this.hideIntersectMesh()}}},t.prototype.hideIntersectMesh=function(){this.intersectMesh.visible===!0&&(this.intersectMesh.visible=!1,this.needsRender=!0)},t})(BaseController);function isNil(n){return n==null}var _moveEvent={type:"move"},XRController=(function(){function n(){this._targetRay=null,this._grip=null,this._hand=null,this._axes=[0,0]}return n.prototype.getHandSpace=function(){return this._hand===null&&(this._hand=new THREE__namespace.Group,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand},n.prototype.getTargetRaySpace=function(){return this._targetRay===null&&(this._targetRay=new THREE__namespace.Group,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new THREE__namespace.Vector3,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new THREE__namespace.Vector3),this._targetRay},n.prototype.getGripSpace=function(){return this._grip===null&&(this._grip=new THREE__namespace.Group,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new THREE__namespace.Vector3,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new THREE__namespace.Vector3),this._grip},n.prototype.dispatchEvent=function(t){return this._targetRay!==null&&this._targetRay.dispatchEvent(t),this._grip!==null&&this._grip.dispatchEvent(t),this._hand!==null&&this._hand.dispatchEvent(t),this},n.prototype.disconnect=function(t){return this.dispatchEvent({type:"disconnected",data:t}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this},n.prototype.getAxes=function(){return this._axes},n.prototype.update=function(t,e,r){var o=null,s=null,u=null,l=this._targetRay,c=this._grip,f=this._hand;if(t&&t.gamepad&&t.gamepad.axes&&(this._axes=[t.gamepad.axes[2],t.gamepad.axes[3]]),t&&e.session.visibilityState!=="visible-blurred")if(l!==null&&(o=e.getPose(t.targetRaySpace,r),o!==null&&(l.matrix.fromArray(o.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),o.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(o.linearVelocity)):l.hasLinearVelocity=!1,o.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(o.angularVelocity)):l.hasAngularVelocity=!1,this.dispatchEvent(_moveEvent))),f&&t.hand){u=!0;for(var p=0,d=t.hand.values();p<d.length;p++){var h=d[p],g=e.getJointPose(h,r);if(f.joints[h.jointName]===void 0){var m=new THREE__namespace.Group;m.matrixAutoUpdate=!1,m.visible=!1,f.joints[h.jointName]=m,f.add(m)}var E=f.joints[h.jointName];g!==null&&(E.matrix.fromArray(g.transform.matrix),E.matrix.decompose(E.position,E.rotation,E.scale),E.jointRadius=g.radius),E.visible=g!==null}var y=f.joints["index-finger-tip"],v=f.joints["thumb-tip"],A=y.position.distanceTo(v.position),b=.02,T=.005;f.inputState.pinching&&A>b+T?(f.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!f.inputState.pinching&&A<=b-T&&(f.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else c!==null&&t.gripSpace&&(s=e.getPose(t.gripSpace,r),s!==null&&(c.matrix.fromArray(s.transform.matrix),c.matrix.decompose(c.position,c.rotation,c.scale),s.linearVelocity?(c.hasLinearVelocity=!0,c.linearVelocity.copy(s.linearVelocity)):c.hasLinearVelocity=!1,s.angularVelocity?(c.hasAngularVelocity=!0,c.angularVelocity.copy(s.angularVelocity)):c.hasAngularVelocity=!1));return l!==null&&(l.visible=o!==null),c!==null&&(c.visible=s!==null),f!==null&&(f.visible=u!==null),this},n})(),framebufferScaleFactor=1,isAppleVisionPro=function(){try{var n=/Macintosh/i.test(navigator.userAgent),t=navigator.maxTouchPoints===5;return n&&t}catch(e){return console.error("Error determining if the device is an Apple Vision Pro: ",e),!1}},isOculus=function(){try{return/Oculus/i.test(navigator.userAgent)}catch(n){return console.error("Error determining if the device is an Oculus: ",n),!1}},XRManager=(function(){function n(t,e,r){var o,s,u,l,c;this.isPanorama=(o=r==null?void 0:r.isPanorama)!==null&&o!==void 0?o:!0,navigator.userAgent.toLowerCase();var f;isAppleVisionPro()?f="VP":isOculus()?f="Oculus":f="Pico",this.machineType=(s=r==null?void 0:r.machineType)!==null&&s!==void 0?s:f,this.renderer=t,this.gl=e,this.enabled=!1,this.session=null,this.referenceSpaceType=(u=r==null?void 0:r.referenceSpaceType)!==null&&u!==void 0?u:"local-floor",this.referenceSpace=null,this.onSessionStartCallback=(l=r==null?void 0:r.onSessionStart)!==null&&l!==void 0?l:noop,this.onSessionEndCallback=(c=r==null?void 0:r.onSessionEnd)!==null&&c!==void 0?c:noop,this.controllers=[new XRController,new XRController],this.inputSourcesMap=new Map,this.cameraVR=new THREE__namespace.ArrayCamera,this.cameraL=new THREE__namespace.PerspectiveCamera,this.cameraR=new THREE__namespace.PerspectiveCamera,this.cameraVR.cameras.push(this.cameraL,this.cameraR),this.cameraL.viewport=new THREE__namespace.Vector4,this.cameraR.viewport=new THREE__namespace.Vector4,this.cameraL.layers.enable(1),this.cameraR.layers.enable(2),this.cameraVR.layers.enable(1),this.cameraVR.layers.enable(2),this.isPresenting=!1,this.currentDepthNear=null,this.currentDepthFar=null,this.cameraLPos=new THREE__namespace.Vector3,this.cameraRPos=new THREE__namespace.Vector3}return n.prototype.getController=function(t){var e=this.controllers[t];return e||console.warn("no controller find"),e.getTargetRaySpace()},n.prototype.getRightController=function(){if(!this.session||!this.session.inputSources)return null;var t=void 0;if(this.session.inputSources.forEach(function(r,o){r.handedness==="right"&&(t=o)}),t===void 0)return console.warn("no inputSource for right hand"),null;var e=this.controllers[t];return e?e.getTargetRaySpace():(console.warn("right controller not find"),null)},n.prototype.getLeftController=function(){if(!this.session||!this.session.inputSources)return null;var t=void 0;if(this.session.inputSources.forEach(function(r,o){r.handedness==="left"&&(t=o)}),t===void 0)return console.warn("no inputSource for left hand"),null;var e=this.controllers[t];return e?e.getTargetRaySpace():(console.warn("left controller not find"),null)},n.prototype.getControllerGrip=function(t){var e=this.controllers[t];return e||console.warn("no controller find"),e.getGripSpace()},n.prototype.getCameras=function(){return{cameraL:this.cameraL,cameraR:this.cameraR,cameraVR:this.cameraVR}},n.prototype.updateCamera=function(t,e){e===null?t.matrixWorld.copy(t.matrix):t.matrixWorld.multiplyMatrices(e.matrixWorld,t.matrix),t.matrixWorldInverse.getInverse(t.matrixWorld)},n.prototype.setProjectionFromUnion=function(t,e,r){this.cameraLPos.setFromMatrixPosition(e.matrixWorld),this.cameraRPos.setFromMatrixPosition(r.matrixWorld);var o=this.cameraLPos.distanceTo(this.cameraRPos),s=e.projectionMatrix.elements,u=r.projectionMatrix.elements,l=s[14]/(s[10]-1),c=s[14]/(s[10]+1),f=(s[9]+1)/s[5],p=(s[9]-1)/s[5],d=(s[8]-1)/s[0],h=(u[8]+1)/u[0],g=l*d,m=l*h,E=o/(-d+h),y=E*-d;e.matrixWorld.decompose(t.position,t.quaternion,t.scale),t.translateX(y),t.translateZ(E),t.matrixWorld.compose(t.position,t.quaternion,t.scale),t.matrixWorldInverse.getInverse(t.matrixWorld);var v=l+E,A=c+E,b=g-y,T=m+(o-y),_=f*c/A*v,S=p*c/A*v;t.projectionMatrix.makePerspective(b,T,_,S,v,A)},n.prototype.getCamera=function(t){this.cameraVR.near=this.cameraR.near=this.cameraL.near=t.near,this.cameraVR.far=this.cameraR.far=this.cameraL.far=t.far,this.session&&(this.currentDepthNear!==this.cameraVR.near||this.currentDepthFar!==this.cameraVR.far)&&(this.session.updateRenderState({depthNear:this.cameraVR.near,depthFar:this.cameraVR.far}),this.currentDepthNear=this.cameraVR.near,this.currentDepthFar=this.cameraVR.far);var e=t.parent,r=this.cameraVR.cameras;this.updateCamera(this.cameraVR,e);for(var o=0;o<r.length;o++)this.updateCamera(r[o],e);t.matrixWorld.copy(this.cameraVR.matrixWorld);for(var s=t.children,o=0,u=s.length;o<u;o++)s[o].updateMatrixWorld(!0);return r.length===2?this.setProjectionFromUnion(this.cameraVR,this.cameraL,this.cameraR):this.cameraVR.projectionMatrix.copy(this.cameraL.projectionMatrix),this.cameraVR},n.prototype.updateInputSources=function(t){if(!this.session){console.warn("session is lose!");return}for(var e=this.session.inputSources,r=0;r<this.controllers.length;r++)this.inputSourcesMap.set(e[r],this.controllers[r]);for(var r=0;r<t.removed.length;r++){var o=t.removed[r],s=this.inputSourcesMap.get(o);s&&(s.dispatchEvent({type:"disconnected",data:o}),this.inputSourcesMap.delete(o))}for(var r=0;r<t.added.length;r++){var o=t.added[r],s=this.inputSourcesMap.get(o);s&&s.dispatchEvent({type:"connected",data:o})}},n.prototype.onSessionEvent=function(t){var e=this.inputSourcesMap.get(t.inputSource);e&&e.dispatchEvent({type:t.type})},n.prototype.onSessionEnd=function(){this.inputSourcesMap.forEach(function(t,e){t.disconnect(e)}),this.inputSourcesMap.clear(),this.isPresenting=!1,this.session=null,AnimationFrameLoop.shared.setContext(null),this.onSessionEndCallback()},n.prototype.onRequestReferenceSpace=function(t){this.referenceSpace=t,this.isPresenting=!0,this.session&&this.onSessionStartCallback(this.session)},n.prototype.setSession=function(t){var e=this;if(this.session=t,this.session){this.session.addEventListener("select",function(o){e.onSessionEvent(o)}),this.session.addEventListener("selectstart",function(o){e.onSessionEvent(o)}),this.session.addEventListener("selectend",function(o){e.onSessionEvent(o)}),this.session.addEventListener("squeeze",function(o){e.onSessionEvent(o)}),this.session.addEventListener("squeezestart",function(o){e.onSessionEvent(o)}),this.session.addEventListener("squeezeend",function(o){e.onSessionEvent(o)}),this.session.addEventListener("end",function(o){e.onSessionEnd()});var r=this.gl.getContextAttributes();this.gl.makeXRCompatible().then(function(){var o={antialias:r==null?void 0:r.antialias,alpha:r==null?void 0:r.alpha,depth:r==null?void 0:r.depth,stencil:r==null?void 0:r.stencil,framebufferScaleFactor};if(!e.session){console.error("session is lose while set session!");return}switch(e.machineType){case"Pico":case"VP":e.session.updateRenderState({baseLayer:new XRWebGLLayer(e.session,e.gl,o)});break;case"Oculus":e.session.updateRenderState({baseLayer:new XRWebGLLayer(e.session,e.gl,o)});break;default:e.machineType;break}e.session.requestReferenceSpace(e.referenceSpaceType).then(function(s){e.onRequestReferenceSpace(s)}),e.session.addEventListener("inputsourceschange",function(s){e.updateInputSources(s)})})}},n})(),LineSegmentsGeometry=(function(n){__extends(t,n);function t(){var e=n.call(this)||this;e.type="LineSegmentsGeometry";var r=[-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],o=[-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],s=[0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5];return e.setIndex(s),e.setAttribute("position",new THREE__namespace.Float32BufferAttribute(r,3)),e.setAttribute("uv",new THREE__namespace.Float32BufferAttribute(o,2)),e}return t.prototype.applyMatrix4=function(e){var r=this.attributes.instanceStart,o=this.attributes.instanceEnd;return r!==void 0&&(r.applyMatrix4(e),o.applyMatrix4(e),r.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this},t.prototype.setPositions=function(e){var r;e instanceof Float32Array?r=e:Array.isArray(e)?r=new Float32Array(e):r=new Float32Array;var o=new THREE__namespace.InstancedInterleavedBuffer(r,6,1);return this.setAttribute("instanceStart",new THREE__namespace.InterleavedBufferAttribute(o,3,0)),this.setAttribute("instanceEnd",new THREE__namespace.InterleavedBufferAttribute(o,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this},t.prototype.setColors=function(e){var r;e instanceof Float32Array?r=e:Array.isArray(e)?r=new Float32Array(e):r=new Float32Array;var o=new THREE__namespace.InstancedInterleavedBuffer(r,6,1);return this.setAttribute("instanceColorStart",new THREE__namespace.InterleavedBufferAttribute(o,3,0)),this.setAttribute("instanceColorEnd",new THREE__namespace.InterleavedBufferAttribute(o,3,3)),this},t.prototype.fromWireframeGeometry=function(e){return this.setPositions(e.attributes.position.array),this},t.prototype.fromEdgesGeometry=function(e){return this.setPositions(e.attributes.position.array),this},t.prototype.fromMesh=function(e){return this.fromWireframeGeometry(new THREE__namespace.WireframeGeometry(e.geometry)),this},t.prototype.fromLineSegments=function(e){var r=e.geometry;if(r instanceof THREE__namespace.Geometry){var o=new THREE__namespace.BufferGeometry().fromGeometry(r);this.setPositions(o.attributes.position.array)}else r instanceof THREE__namespace.BufferGeometry&&this.setPositions(r.attributes.position.array);return this},t.prototype.computeBoundingBox=function(){this.boundingBox===null&&(this.boundingBox=new THREE__namespace.Box3);var e=this.attributes.instanceStart,r=this.attributes.instanceEnd;if(e!==void 0&&r!==void 0){var o=new THREE__namespace.Box3;this.boundingBox.setFromBufferAttribute(e),o.setFromBufferAttribute(r),this.boundingBox.union(o)}},t.prototype.computeBoundingSphere=function(){this.boundingSphere===null&&(this.boundingSphere=new THREE__namespace.Sphere),this.boundingBox===null&&this.computeBoundingBox();var e=this.attributes.instanceStart,r=this.attributes.instanceEnd;if(e!==void 0&&r!==void 0){var o=this.boundingSphere.center;this.boundingBox.getCenter(o);for(var s=0,u=new THREE__namespace.Vector3,l=0,c=e.count;l<c;l++)u.fromBufferAttribute(e,l),s=Math.max(s,o.distanceToSquared(u)),u.fromBufferAttribute(r,l),s=Math.max(s,o.distanceToSquared(u));this.boundingSphere.radius=Math.sqrt(s),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}},t.prototype.toJSON=function(){},t})(THREE__namespace.InstancedBufferGeometry);Object.assign(LineSegmentsGeometry.prototype,{isLineSegmentsGeometry:!0});var lineShader={uniforms:THREE__namespace.UniformsUtils.merge([THREE__namespace.UniformsLib.common,THREE__namespace.UniformsLib.fog,{linewidth:{value:1},resolution:{value:new THREE__namespace.Vector2(1,1)},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1},opacity:{value:1}}]),vertexShader:`
|
|
2152
2152
|
#include <common>
|
|
2153
2153
|
#include <color_pars_vertex>
|
|
2154
2154
|
#include <fog_pars_vertex>
|
|
@@ -2347,4 +2347,4 @@ void main() {
|
|
|
2347
2347
|
#include <premultiplied_alpha_fragment>
|
|
2348
2348
|
|
|
2349
2349
|
}
|
|
2350
|
-
`},LineMaterial=(function(n){__extends(t,n);function t(e){var r=n.call(this,{uniforms:THREE__namespace.UniformsUtils.clone(lineShader.uniforms),vertexShader:lineShader.vertexShader,fragmentShader:lineShader.fragmentShader,clipping:!0})||this;return r.type="LineMaterial",r.dashed=!1,Object.defineProperties(r,{color:{enumerable:!0,get:function(){return this.uniforms.diffuse.value},set:function(o){this.uniforms.diffuse.value=o}},linewidth:{enumerable:!0,get:function(){return this.uniforms.linewidth.value},set:function(o){this.uniforms.linewidth.value=o}},dashScale:{enumerable:!0,get:function(){return this.uniforms.dashScale.value},set:function(o){this.uniforms.dashScale.value=o}},dashSize:{enumerable:!0,get:function(){return this.uniforms.dashSize.value},set:function(o){this.uniforms.dashSize.value=o}},gapSize:{enumerable:!0,get:function(){return this.uniforms.gapSize.value},set:function(o){this.uniforms.gapSize.value=o}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(o){this.uniforms.opacity.value=o}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(o){this.uniforms.resolution.value.copy(o)}}}),r.setValues(e),r}return t})(THREE__namespace.ShaderMaterial);Object.assign(LineMaterial.prototype,{isLineMaterial:!0});var LineSegments2=(function(n){__extends(t,n);function t(e,r){var o=n.call(this)||this;return o.type="LineSegments2",o.geometry=e!==void 0?e:new LineSegmentsGeometry,o.material=r!==void 0?r:new LineMaterial({color:Math.random()*16777215}),o}return t.prototype.computeLineDistances=function(){for(var e=this.geometry,r=e.attributes.instanceStart,o=e.attributes.instanceEnd,s=new Float32Array(2*r.count),u=new THREE__namespace.Vector3,l=new THREE__namespace.Vector3,c=0,f=0,p=r.count;c<p;c++,f+=2)u.fromBufferAttribute(r,c),l.fromBufferAttribute(o,c),s[f]=f===0?0:s[f-1],s[f+1]=s[f]+u.distanceTo(l);var d=new THREE__namespace.InstancedInterleavedBuffer(s,2,1);return e.setAttribute("instanceDistanceStart",new THREE__namespace.InterleavedBufferAttribute(d,1,0)),e.setAttribute("instanceDistanceEnd",new THREE__namespace.InterleavedBufferAttribute(d,1,1)),this},t.prototype.raycast=function(e,r){e.camera===null&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2.');var o=e.ray,s=e.camera,u=s.projectionMatrix,l=this.geometry,c=this.material,f=c.resolution,p=c.linewidth,d=l.attributes.instanceStart,h=l.attributes.instanceEnd,g=new THREE__namespace.Vector4,m=new THREE__namespace.Vector4,E=new THREE__namespace.Vector4,y=new THREE__namespace.Vector3,v=new THREE__namespace.Matrix4,A=new THREE__namespace.Line3,b=new THREE__namespace.Vector3;o.at(1,E),E.w=1,E.applyMatrix4(s.matrixWorldInverse),E.applyMatrix4(u),E.multiplyScalar(1/E.w),E.x*=f.x/2,E.y*=f.y/2,E.z=0,y.copy(E);var T=this.matrixWorld;v.multiplyMatrices(s.matrixWorldInverse,T);for(var _=0,S=d.count;_<S;_++){g.fromBufferAttribute(d,_),m.fromBufferAttribute(h,_),g.w=1,m.w=1,g.applyMatrix4(v),m.applyMatrix4(v),g.applyMatrix4(u),m.applyMatrix4(u),g.multiplyScalar(1/g.w),m.multiplyScalar(1/m.w);var w=g.z<-1&&m.z<-1,R=g.z>1&&m.z>1;if(!(w||R)){g.x*=f.x/2,g.y*=f.y/2,m.x*=f.x/2,m.y*=f.y/2,A.start.copy(g),A.start.z=0,A.end.copy(m),A.end.z=0;var I=A.closestPointToPointParameter(y,!0);A.at(I,b);var H=THREE__namespace.MathUtils.lerp(g.z,m.z,I),C=H>=-1&&H<=1,M=y.distanceTo(b)<p*.5;if(C&&M){A.start.fromBufferAttribute(d,_),A.end.fromBufferAttribute(h,_),A.start.applyMatrix4(T),A.end.applyMatrix4(T);var B=new THREE__namespace.Vector3,L=new THREE__namespace.Vector3;o.distanceSqToSegment(A.start,A.end,L,B),r.push({point:L,pointOnLine:B,distance:o.origin.distanceTo(L),object:this,faceIndex:_})}}}},t})(THREE__namespace.Mesh);Object.assign(LineSegments2.prototype,{isLineSegments2:!0});var Line2=(function(n){__extends(t,n);function t(e,r){var o=n.call(this,e,r)||this;return o.type="Line2",o}return t})(LineSegments2);Object.assign(Line2.prototype,{isLine2:!0});var LineGeometry=(function(n){__extends(t,n);function t(){var e=n.call(this)||this;return e.type="LineGeometry",e}return t.prototype.setPositions=function(e){for(var r=e.length-3,o=new Float32Array(2*r),s=0;s<r;s+=3)o[2*s]=e[s],o[2*s+1]=e[s+1],o[2*s+2]=e[s+2],o[2*s+3]=e[s+3],o[2*s+4]=e[s+4],o[2*s+5]=e[s+5];return n.prototype.setPositions.call(this,o),this},t.prototype.setColors=function(e){for(var r=e.length-3,o=new Float32Array(2*r),s=0;s<r;s+=3)o[2*s]=e[s],o[2*s+1]=e[s+1],o[2*s+2]=e[s+2],o[2*s+3]=e[s+3],o[2*s+4]=e[s+4],o[2*s+5]=e[s+5];return n.prototype.setColors.call(this,o),this},t.prototype.fromLine=function(e){var r=e.geometry;if(r instanceof THREE__namespace.Geometry){var o=new THREE__namespace.BufferGeometry().fromGeometry(r);this.setPositions(o.attributes.position.array)}else r instanceof THREE__namespace.BufferGeometry&&this.setPositions(r.attributes.position.array);return this},t.prototype.copy=function(){return this},t})(LineSegmentsGeometry);Object.assign(LineGeometry.prototype,{isLineGeometry:!0});var circleImageURL="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAAZiS0dEAAAAAAAA+UO7fwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sHDgwCEMBJZu0AAAAdaVRYdENvbW1lbnQAAAAAAENyZWF0ZWQgd2l0aCBHSU1QZC5lBwAABM5JREFUWMO1V0tPG2cUPZ4Hxh6DazIOrjFNqJs0FIMqWFgWQkatsmvVbtggKlSVRVf5AWz4AWz4AUSKEChll19QJYSXkECuhFxsHjEhxCYm+DWGMZ5HF72DJq4bAzFXurI0M/I5997v3u9cC65vTJVn2lX/xHINQOYSBLTLEuIuCWw4Z3IGAEvf6ASmVHjNzHCXBG4A0AjACsAOwEbO0nsFQBnAGYASAIl+ZRMR7SolMEdsByD09fV5R0ZGgg8ePPjW5/N1iqLYpuu6RZblciKR2I9Go69evnwZnZ+fjwI4IS8AKBIRzeQfJWCANwKwh0KhtrGxsYehUOin1tbW+zzP23ietzY2NnIAoGmaLsuyUiqVyvl8XtrY2NiamZn589mzZxsAUgCOAeQAnFI2tI+VxIjaAeDzoaGh7xYWFuZOTk6OZVk+12uYqqq6JEnn0Wg0OT4+/geAXwGEAdwDIFJQXC1wO4DWR48e/RCPxxclSSroVzRFUbSDg4P848ePFwH8DuAhkWih83TRQWxFOXgAwvDwcOfo6OhvXV1d39tsNtuVBwTDWBwOh1UUxVsMw1hXVlbSdCgNV43uYSvrHg6H24aHh38eHBz85TrgF9FYLHA4HLzH43FvbW2d7u/vG+dANp8FpqIlbd3d3V8Fg8EfBUFw4BONZVmL3+9vHhkZCQL4AoAHgJPK8G+yzC0XDofdoVAo5PP5vkadTBAEtr+/39ff3x8gAp/RPOEqx2qjx+NpvXv3bk9DQ0NDvQgwDIOWlhZrMBj8kgi0UJdxRgYMArzL5XJ7vd57qLPZ7Xamp6fnNgBXtQxcjFuHw+Hyer3t9SYgCAITCAScAJoBNNEY/08GOFVVrfVMv7kMNDntFD1vjIAPrlRN0xjckOm6biFQ3jwNPwDMZrOnqVTqfb3Bi8Wivru7W/VCYkwPlKOjo0IikXh7EwQikYgE4Nw0CfXKDCipVCoTj8df3QABbW1tLUc6oUgkFPMkVACUNjc337148eKvw8PDbJ2jP1taWkoCyNDVXDSECmNSK4qiKNLq6urW8+fPI/UicHx8rD59+jSVy+WOAKSJhKENwFItLtoxk8mwsixzHR0dHe3t7c5PAU+n09rs7OzJkydPYqVSaQfANoDXALIk31S2smU1TWMPDg7K5XKZ7+3t9TudTut1U7+wsFCcmJiIpdPpbQBxADsAknQWymYCOukBHYCuKApisdhpMpnURFEU79y503TVyKenpzOTk5M7e3t7MQKPV0Zv1gNm+awB0MvlshqLxfLb29uyJElWURSbXC4XXyvqxcXFs6mpqeTc3Nzu3t7e3wQcA7BPZ8Cov1pNlJplmQtAG8MwHV6v95tAINA5MDBwPxAIuLu6upr8fr/VAN3c3JQjkcjZ+vp6fnl5+d2bN29SuVzuNYAEpf01CdRChUL+X1VskHACuA3Ay3Fcu9vt7nA6nZ7m5uYWQRCaNE3jVVW15PP580KhIGUymWw2m00DOAJwSP4WwPtq4LX2Ao6USxNlQyS/RcQcdLGwlNIz6vEMAaZpNzCk2Pll94LK/cDYimxERiBwG10sxjgvEZBE0UpE6vxj+0Ct5bTaXthgEhRmja8QWNkkPGsuIpfdjpkK+cZUWTC0KredVmtD/gdlSl6EG4AMvQAAAABJRU5ErkJggg==",DEFAULT_COLOR=14467195,POINT_SIZE=8,DEFAULT_LINEWIDTH=2,DEFAULT_DASHSCALE=20,sharedCircleTexture=null,FiveLine=(function(n){__extends(t,n);function t(e,r){e===void 0&&(e=new THREE__namespace.Vector3),r===void 0&&(r=new THREE__namespace.Vector3);var o=n.call(this)||this;o.type="FiveLine",o.needsRender=!0;var s=new LineGeometry,u=new LineMaterial({color:DEFAULT_COLOR,linewidth:DEFAULT_LINEWIDTH,dashScale:DEFAULT_DASHSCALE,dashed:!1});o.line=new Line2(s,u);var l=new THREE__namespace.BufferGeometry,c=new THREE__namespace.PointsMaterial({color:DEFAULT_COLOR,size:POINT_SIZE,map:sharedCircleTexture||(sharedCircleTexture=new THREE__namespace.TextureLoader().load(circleImageURL)),sizeAttenuation:!1,transparent:!0});return o.points=new THREE__namespace.Points(l,c),o.points.renderOrder=11,o.points.frustumCulled=!1,o.setPoints(e,r),o.add(o.line,o.points),o}return Object.defineProperty(t,"version",{get:function(){return"6.7.0-alpha.34"},enumerable:!1,configurable:!0}),t.prototype.setPoints=function(e,r){var o=[].concat(e.toArray(),r.toArray());this.points.geometry.setAttribute("position",new THREE__namespace.BufferAttribute(new Float32Array(o),3)),this.line.geometry.setPositions(o),this.line.computeLineDistances(),this.needsRender=!0},t.prototype.getPoints=function(){var e=this.points.geometry.attributes.position.array;return[new THREE__namespace.Vector3(e[0],e[1],e[2]),new THREE__namespace.Vector3(e[3],e[4],e[5])]},t.prototype.setMaterial=function(e){var r=this.line.material;for(var o in e)if(e.hasOwnProperty(o)){var s=e[o];o==="dashed"?(r.dashed=s,s?r.defines.USE_DASH="":delete r.defines.USE_DASH,r.needsUpdate=!0):r[o]=e[o]}this.needsRender=!0},t.prototype.setResolution=function(e,r){var o=this.line.material.resolution;(o.x!==e||o.y!==r)&&(o.set(e,r),this.needsRender=!0)},t})(THREE__namespace.Object3D);Object.assign(FiveLine.prototype,{isFiveLine:!0});var Constants={ComponentState:Object.freeze({DEFAULT:"default",TOUCHED:"touched",PRESSED:"pressed"}),ComponentProperty:Object.freeze({BUTTON:"button",X_AXIS:"xAxis",Y_AXIS:"yAxis",STATE:"state"}),ComponentType:Object.freeze({TRIGGER:"trigger",SQUEEZE:"squeeze",TOUCHPAD:"touchpad",THUMBSTICK:"thumbstick",BUTTON:"button"}),ButtonTouchThreshold:.05,AxisTouchThreshold:.1,VisualResponseProperty:Object.freeze({TRANSFORM:"transform",VISIBILITY:"visibility"})};function fetchJsonFile(n){return __awaiter(this,void 0,void 0,function(){var t;return __generator(this,function(e){switch(e.label){case 0:return[4,fetch(n)];case 1:if(t=e.sent(),t.ok)return[2,t.json()];throw new Error(t.statusText)}})})}function fetchProfilesList(n){return __awaiter(this,void 0,void 0,function(){var t,e;return __generator(this,function(r){switch(r.label){case 0:if(!n)throw new Error("No basePath supplied");return t="profilesList.json",[4,fetchJsonFile("".concat(n,"/").concat(t))];case 1:return e=r.sent(),[2,e]}})})}function fetchProfile(n,t){return __awaiter(this,arguments,void 0,function(e,r,o,s){var u,l,c,f,p,d;return o===void 0&&(o=null),s===void 0&&(s=!0),__generator(this,function(h){switch(h.label){case 0:if(!e)throw new Error("No xrInputSource supplied");if(!r)throw new Error("No basePath supplied");return[4,fetchProfilesList(r)];case 1:if(u=h.sent(),e.profiles.some(function(g){var m=u[g];return m&&(l={profileId:g,profilePath:"".concat(r,"/").concat(m.path),deprecated:!!m.deprecated}),!!l}),!l){if(!o)throw new Error("No matching profile name found");if(c=u[o],!c)throw new Error('No matching profile name found and default profile "'.concat(o,'" missing.'));l={profileId:o,profilePath:"".concat(r,"/").concat(c.path),deprecated:!!c.deprecated}}return[4,fetchJsonFile(l.profilePath)];case 2:if(f=h.sent(),s){if(d=void 0,d=f.layouts[e.handedness],!d)throw new Error("No matching handedness, ".concat(e.handedness,", in profile ").concat(l.profileId));d.assetPath&&(p=l.profilePath.replace("profile.json",d.assetPath))}return[2,{profile:f,assetPath:p}]}})})}var defaultComponentValues={xAxis:0,yAxis:0,button:0,state:Constants.ComponentState.DEFAULT};function normalizeAxes(n,t){n===void 0&&(n=0),t===void 0&&(t=0);var e=n,r=t,o=Math.sqrt(n*n+t*t);if(o>1){var s=Math.atan2(t,n);e=Math.cos(s),r=Math.sin(s)}var u={normalizedXAxis:e*.5+.5,normalizedYAxis:r*.5+.5};return u}var VisualResponse=(function(){function n(t){this.componentProperty=t.componentProperty,this.states=t.states,this.valueNodeName=t.valueNodeName,this.valueNodeProperty=t.valueNodeProperty,this.valueNodeProperty===Constants.VisualResponseProperty.TRANSFORM&&(this.minNodeName=t.minNodeName,this.maxNodeName=t.maxNodeName),this.value=0,this.updateFromComponent(defaultComponentValues)}return n.prototype.updateFromComponent=function(t){var e=t.xAxis,r=t.yAxis,o=t.button,s=t.state,u=normalizeAxes(e,r),l=u.normalizedXAxis,c=u.normalizedYAxis;switch(this.componentProperty){case Constants.ComponentProperty.X_AXIS:this.value=this.states.includes(s)?l:.5;break;case Constants.ComponentProperty.Y_AXIS:this.value=this.states.includes(s)?c:.5;break;case Constants.ComponentProperty.BUTTON:this.value=this.states.includes(s)?o:0;break;case Constants.ComponentProperty.STATE:this.valueNodeProperty===Constants.VisualResponseProperty.VISIBILITY?this.value=this.states.includes(s):this.value=this.states.includes(s)?1:0;break;default:throw new Error("Unexpected visualResponse componentProperty ".concat(this.componentProperty))}},n})(),Component=(function(){function n(t,e){var r=this;if(!t||!e||!e.visualResponses||!e.gamepadIndices||Object.keys(e.gamepadIndices).length===0)throw new Error("Invalid arguments supplied");this.id=t,this.type=e.type,this.rootNodeName=e.rootNodeName,this.touchPointNodeName=e.touchPointNodeName,this.visualResponses={},Object.keys(e.visualResponses).forEach(function(o){var s=new VisualResponse(e.visualResponses[o]);r.visualResponses[o]=s}),this.gamepadIndices=Object.assign({},e.gamepadIndices),this.values={state:Constants.ComponentState.DEFAULT,button:this.gamepadIndices.button!==void 0?0:void 0,xAxis:this.gamepadIndices.xAxis!==void 0?0:void 0,yAxis:this.gamepadIndices.yAxis!==void 0?0:void 0}}return Object.defineProperty(n.prototype,"data",{get:function(){var t=__assign({id:this.id},this.values);return t},enumerable:!1,configurable:!0}),n.prototype.updateFromGamepad=function(t){var e=this;if(this.values.state=Constants.ComponentState.DEFAULT,this.gamepadIndices.button!==void 0&&t.buttons.length>this.gamepadIndices.button){var r=t.buttons[this.gamepadIndices.button];this.values.button=r.value,this.values.button=this.values.button<0?0:this.values.button,this.values.button=this.values.button>1?1:this.values.button,r.pressed||this.values.button===1?this.values.state=Constants.ComponentState.PRESSED:(r.touched||this.values.button>Constants.ButtonTouchThreshold)&&(this.values.state=Constants.ComponentState.TOUCHED)}this.gamepadIndices.xAxis!==void 0&&t.axes.length>this.gamepadIndices.xAxis&&(this.values.xAxis=t.axes[this.gamepadIndices.xAxis],this.values.xAxis=this.values.xAxis<-1?-1:this.values.xAxis,this.values.xAxis=this.values.xAxis>1?1:this.values.xAxis,this.values.state===Constants.ComponentState.DEFAULT&&Math.abs(this.values.xAxis)>Constants.AxisTouchThreshold&&(this.values.state=Constants.ComponentState.TOUCHED)),this.gamepadIndices.yAxis!==void 0&&t.axes.length>this.gamepadIndices.yAxis&&(this.values.yAxis=t.axes[this.gamepadIndices.yAxis],this.values.yAxis=this.values.yAxis<-1?-1:this.values.yAxis,this.values.yAxis=this.values.yAxis>1?1:this.values.yAxis,this.values.state===Constants.ComponentState.DEFAULT&&Math.abs(this.values.yAxis)>Constants.AxisTouchThreshold&&(this.values.state=Constants.ComponentState.TOUCHED)),Object.values(this.visualResponses).forEach(function(o){o.updateFromComponent(e.values)})},n})(),MotionController=(function(){function n(t,e,r){var o=this;if(!t)throw new Error("No xrInputSource supplied");if(!e)throw new Error("No profile supplied");this.xrInputSource=t,this.assetUrl=r,this.id=e.profileId,this.layoutDescription=e.layouts[t.handedness],this.components={},Object.keys(this.layoutDescription.components).forEach(function(s){var u=o.layoutDescription.components[s];o.components[s]=new Component(s,u)}),this.updateFromGamepad()}return Object.defineProperty(n.prototype,"gripSpace",{get:function(){return this.xrInputSource.gripSpace},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"targetRaySpace",{get:function(){return this.xrInputSource.targetRaySpace},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"data",{get:function(){var t=[];return Object.values(this.components).forEach(function(e){t.push(e.data)}),t},enumerable:!1,configurable:!0}),n.prototype.updateFromGamepad=function(){var t=this;Object.values(this.components).forEach(function(e){e.updateFromGamepad(t.xrInputSource.gamepad)})},n})(),DEFAULT_PROFILES_PATH="https://cdn.jsdelivr.net/npm/@webxr-input-profiles/assets@1.0/dist/profiles",DEFAULT_PROFILE="generic-trigger",XRControllerModel=(function(n){__extends(t,n);function t(){var e=n.call(this)||this;return e.motionController=null,e.envMap=null,e}return t.prototype.setEnvironmentMap=function(e){var r=this;return this.envMap==e?this:(this.envMap=e,this.traverse(function(o){o instanceof THREE__namespace.Mesh&&o.isMesh&&(o.material.envMap=r.envMap,o.material.needsUpdate=!0)}),this)},t.prototype.updateMatrixWorld=function(e){n.prototype.updateMatrixWorld.call(this,e),this.motionController&&(this.motionController.updateFromGamepad(),Object.values(this.motionController.components).forEach(function(r){Object.values(r.visualResponses).forEach(function(o){var s=o.valueNode,u=o.minNode,l=o.maxNode,c=o.value,f=o.valueNodeProperty;s&&(f===Constants.VisualResponseProperty.VISIBILITY?s.visible=c:f===Constants.VisualResponseProperty.TRANSFORM&&(s.quaternion.copy(u.quaternion).slerp(l.quaternion,c),s.position.lerpVectors(u.position,l.position,c)))})}))},t})(THREE.Object3D);function findNodes(n,t){Object.values(n.components).forEach(function(e){var r=e.type,o=e.touchPointNodeName,s=e.visualResponses;if(r===Constants.ComponentType.TOUCHPAD)if(e.touchPointNode=t.getObjectByName(o),e.touchPointNode){var u=new THREE.SphereGeometry(.001),l=new THREE.MeshBasicMaterial({color:255}),c=new THREE.Mesh(u,l);e.touchPointNode.add(c)}else console.warn("Could not find touch dot, ".concat(e.touchPointNodeName,", in touchpad component ").concat(e.id));Object.values(s).forEach(function(f){var p=f.valueNodeName,d=f.minNodeName,h=f.maxNodeName,g=f.valueNodeProperty;if(g===Constants.VisualResponseProperty.TRANSFORM){if(f.minNode=t.getObjectByName(d),f.maxNode=t.getObjectByName(h),!f.minNode){console.warn("Could not find ".concat(d," in the model"));return}if(!f.maxNode){console.warn("Could not find ".concat(h," in the model"));return}}f.valueNode=t.getObjectByName(p),f.valueNode||console.warn("Could not find ".concat(p," in the model"))})})}function addAssetSceneToControllerModel(n,t){findNodes(n.motionController,t),n.envMap&&t.traverse(function(e){e instanceof THREE__namespace.Mesh&&e.isMesh&&(e.material.envMap=n.envMap,e.material.needsUpdate=!0)}),n.add(t)}var XRControllerModelFactory=(function(){function n(t){t===void 0&&(t=null),this.gltfLoader=t,this.path=DEFAULT_PROFILES_PATH,this._assetCache={}}return n.prototype.createControllerModel=function(t){var e=this,r=new XRControllerModel,o=null;return t.addEventListener("connected",function(s){var u=s.data;u.targetRayMode!=="tracked-pointer"||!u.gamepad||fetchProfile(u,e.path,DEFAULT_PROFILE).then(function(l){var c=l.profile,f=l.assetPath;r.motionController=new MotionController(u,c,f);var p=e._assetCache[r.motionController.assetUrl];if(p)o=p.scene.clone(),addAssetSceneToControllerModel(r,o);else{if(!e.gltfLoader)throw new Error("GLTFLoader not set.");e.gltfLoader.load(r.motionController.assetUrl,function(d){e._assetCache[r.motionController.assetUrl]=d,o=d.scene.clone(),addAssetSceneToControllerModel(r,o)})}}).catch(function(l){console.warn(l)})}),t.addEventListener("disconnected",function(){r.motionController=null,r.remove(o),o=null}),r},n})(),defaultXRPanoramaControllerInitArgs=__assign({},omit(defaultPanoramaControllerCustomInitArgs,["maxLatitude","minLatitude"]));function mapPanoResource(n,t){return n}var CONTROLLER_EVNET_DELTA_TIME=300,scratchRaycaster=new THREE__namespace.Raycaster,scratchVector3=new THREE__namespace.Vector3,XRPanoramaController=(function(n){__extends(t,n);function t(e){var r=n.call(this,e)||this;r.xrManager=new XRManager(r.renderer,r.renderer.getContext(),{onSessionStart:function(c){r.emit("xr.session.start",createEvent("xr.session.start",{session:c,machineType:r.xrManager.machineType}))},onSessionEnd:function(){r.emit("xr.session.end",createEvent("xr.session.end",{session:null,machineType:r.xrManager.machineType}))}}),r.xrControllerRay={left:new THREE__namespace.Raycaster,right:new THREE__namespace.Raycaster},r.xrControllerRay.left.params.Points={threshold:.1},r.xrControllerRay.left.firstHitOnly=!0,r.xrControllerRay.left.floorIndex=-1,r.xrControllerRay.right.params.Points={threshold:.1},r.xrControllerRay.right.firstHitOnly=!0,r.xrControllerRay.right.floorIndex=-1,r.gazeRay=null,r.pointerLines={left:new FiveLine,right:new FiveLine},r.pointerLines.left.visible=!1,r.pointerLines.right.visible=!0,r.pointerLines.left.setMaterial({color:new THREE__namespace.Vector3(1,1,1)}),r.pointerLines.left.points.material.depthTest=!1,r.pointerLines.right.setMaterial({color:new THREE__namespace.Vector3(1,1,1)}),r.pointerLines.right.points.material.depthTest=!1,r.controllerWrappers=[new THREE__namespace.Group,new THREE__namespace.Group];var o=r.xrManager.getController(0);r.controllerWrappers[0].add(o);var s=r.xrManager.getController(1);r.controllerWrappers[1].add(s);var u=new XRControllerModelFactory;u.gltfLoader={load:function(c,f){internalFetcher.ajax(c,{responseType:"arraybuffer"}).then(function(p){var d;return parseGltf(p.body,{resourcePath:c.slice(0,c.lastIndexOf("/")+1),search:(d=c.split("?")[1])!==null&&d!==void 0?d:"",fetcher:internalFetcher})}).then(function(p){return f(p)})}},(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",effectEasing:defaultEffectEase,fixCameraTransform:new THREE__namespace.Matrix4},r.parallaxCameraMatrixs=[];var l=AnimationFrameLoop.shared.getContext();return l?(r.on("xr.session.end",function(){r.scene.remove(r.pointerLines.left,r.pointerLines.right)}),r.xrManager.setSession(l),r.on("xr.session.start",function(){var c=r.xrManager.getControllerGrip(0);c.add(u.createControllerModel(c)),r.controllerWrappers[0].add(c);var f=r.xrManager.getControllerGrip(1);f.add(u.createControllerModel(f)),r.controllerWrappers[1].add(f)}),r.xrHandleState={LeftAxesUp:{touchStartTime:0,touchStart:!1},LeftAxesDown:{touchStartTime:0,touchStart:!1},LeftAxesLeft:{touchStartTime:0,touchStart:!1},LeftAxesRight:{touchStartTime:0,touchStart:!1},LeftTrigger:{touchStartTime:0,touchStart:!1},LeftPinch:{touchStartTime:0,touchStart:!1},RightAxesUp:{touchStartTime:0,touchStart:!1},RightAxesDown:{touchStartTime:0,touchStart:!1},RightAxesLeft:{touchStartTime:0,touchStart:!1},RightAxesRight:{touchStartTime:0,touchStart:!1},RightTrigger:{touchStartTime:0,touchStart:!1},RightPinch:{touchStartTime:0,touchStart:!1},Y:{touchStartTime:0,touchStart:!1},X:{touchStartTime:0,touchStart:!1},A:{touchStartTime:0,touchStart:!1},B:{touchStartTime:0,touchStart:!1}},r.xrManager.machineType==="VP"&&r.initHandEvent(),r):(console.error("获取session失败,请退出重试"),r)}return t.parseArgs=function(e){if(e instanceof t)return e;var r=__assign(__assign({},e),{maxLatitude:Math.PI/2,minLatitude:-Math.PI/2});return n.parseArgs.call(this,r)},t.initAnimationEndState=function(e){var r=this.parseArgs(e),o=n.initAnimationEndState.call(this,r);return __assign(__assign({},o),{mode:"XRPanorama"})},t.prototype.updateConfiguration=function(e){return n.prototype.updateConfiguration.call(this,__assign(__assign({},e),{maxLatitude:Math.PI/2,minLatitude:-Math.PI/2}))},t.prototype.moveToPano=function(e,r,o){var s=this,u,l,c,f=(u=r.effect)!==null&&u!==void 0?u:"fade";this.userAction=o,this.stopMomentumMovement();var p=panoStringify(e),d=this.works.getObserver(e);if(!d)throw new Error("Invalid PanoIndex");getImageSizeFromURL(d.images.up),this.imageOptions.size;var h=this.imageOptions.transform,g=function(I,H){return mapPanoResource(applyImageURLOptions(I,h,H))},m=__assign({key:"pano.".concat(p)},pick(this.imageOptions,["format","size","quality"])),E={right:d.images.work.getURL(d.images.right),left:d.images.work.getURL(d.images.left),up:d.images.work.getURL(d.images.up),down:d.images.work.getURL(d.images.down),front:d.images.work.getURL(d.images.front),back:d.images.work.getURL(d.images.back)},y="pano:"+jsonHash([E,m,h]);if(this.pendingTextureTask){if(this.pendingTextureTask.hash===y)return;var v=this.pendingTextureTask.panoId;(l=this.panoMeshes.get(v))===null||l===void 0||l.setProgress(0),this.emit("pano.texture.abort",createEvent("pano.texture.abort",{error:null,progress:0,meta:null,pano:e}))}var A=this.modelScene.parameter.resolveValue(),b=A.pano0,T=A.pano1,_;if((b==null?void 0:b.map.name)===y?_=b:(T==null?void 0:T.map.name)===y&&(_=T),_){var S={panoId:p,effect:f,effectEasing:(c=r.effectEasing)!==null&&c!==void 0?c:defaultEffectEase,leftPanoPicture:{panoId:_.panoId,map:_.map,mapSize:_.mapSize,matrix:d.matrix.clone().premultiply(d.work.transform),zoom:1},position:d.position.clone().applyMatrix4(d.work.transform),fixCameraTransform:new THREE__namespace.Matrix4};this.doMoveToPano(e,S,r);return}var w="move-to-pano-"+p;this.pending.add(w),this.pendingTextureTask={panoId:p,hash:y,onLoad:function(I){var H,C,M=I.body;if(s.destroyed)M.dispose();else{M.name=y;var B=Array.isArray(M.image)?M.image[0]:M.image,L=(H=B==null?void 0:B.width)!==null&&H!==void 0?H:2048,O={panoId:p,effect:f,effectEasing:(C=r.effectEasing)!==null&&C!==void 0?C:defaultEffectEase,leftPanoPicture:{panoId:p,map:M,mapSize:L,matrix:d.matrix.clone(),zoom:1},position:d.position.clone(),fixCameraTransform:new THREE__namespace.Matrix4};s.doMoveToPano(e,O,r)}},onError:function(I){var H=__assign(__assign(__assign({},e),{mode:s.mode}),clonePose(s.camera.pose));s.emit("pano.error",createEvent("pano.error",{error:I,userAction:s.userAction,options:r,prevPano:s.currentPano,progress:0,state:H})),s.emit("pano.cancel",createEvent("pano.cancel",{error:null,userAction:s.userAction,options:r,prevPano:s.currentPano,progress:0,state:H})),r.moveCancelCallback&&r.moveCancelCallback()}};var R=this.panoMeshes.get(p);R&&R.tap&&R.tap(),this.textureLoader.loadCubeTexture(E,{imageURL:{transform:g,options:m},format:THREE__namespace.RGBFormat,fetcher:getFetcher(this.fiveId,d.work)},void 0,void 0,function(I){var H,C;((H=s.pendingTextureTask)===null||H===void 0?void 0:H.hash)===y&&((C=s.panoMeshes.get(p))===null||C===void 0||C.setProgress(I)),s.emit("pano.texture.progress",createEvent("pano.texture.progress",{error:null,progress:I,meta:null,pano:e}))},this.renderer).then(function(I){var H,C;s.pending.delete(w),((H=s.pendingTextureTask)===null||H===void 0?void 0:H.hash)===y?(s.pendingTextureTask.onLoad(I),s.pendingTextureTask=void 0,(C=s.panoMeshes.get(p))===null||C===void 0||C.setProgress(0)):I.body.dispose(),s.emit("pano.texture.success",createEvent("pano.texture.success",{error:null,progress:1,meta:I.meta,pano:e}))}).catch(function(I){var H,C;s.pending.delete(w),((H=s.pendingTextureTask)===null||H===void 0?void 0:H.hash)===y&&(s.pendingTextureTask.onError(I),s.pendingTextureTask=void 0,(C=s.panoMeshes.get(p))===null||C===void 0||C.setProgress(0)),s.emit("pano.texture.error",createEvent("pano.texture.error",{error:I,progress:0,meta:null,pano:e})),s.emit("error",I)}),this.emit("pano.texture.load",createEvent("pano.texture.load",{error:null,progress:0,meta:null,pano:e}))},t.prototype.doMoveToPano=function(e,r,o){var s=this,u,l,c,f,p,d,h,g,m,E;o===void 0&&(o={});var y=now(),v=createUuid();this.panoResources[v]=r;var A=1,b,T,_;if(this.locationMotion.ended){var S=this.locationMotion.getKeyFrameSegment(y);S[0];var w=S[1],R=this.locationMotion.value,I=this.panoResourceFromLocationMotionKeyframe(w).position,H=r.position;b=Math.max(I.distanceTo(H),A),T=[{key:w.key,progress:0,value:__assign(__assign({},R),{count:0})},{key:v,progress:1,value:{distance:0,count:1}}],_=0}else{var C=this.locationMotion.getKeyFrameSegment(y),M=C[0],w=C[1],R=this.locationMotion.value,B=this.panoResourceFromLocationMotionKeyframe(M).position,I=this.panoResourceFromLocationMotionKeyframe(w).position,H=r.position,L=w.value.count-R.count,O=Math.max(B.distanceTo(I),A)*L,k=Math.max(I.distanceTo(H),A);b=O+k,T=[{key:M.key,progress:0,value:__assign({},R)},{key:w.key,progress:O/b,value:w.value},{key:v,progress:1,value:{count:w.value.count+1,distance:0}}];var D=this.locationMotionKeyframesLength(this.locationMotion.keyframes),q=this.locationMotionKeyframesLength(T);_=this.locationMotion.getProgressVelocity(y)*D/q}var z=r.effect==="instant"?0:this.calculateMovingDuration(o.duration,r.effect==="fly"||r.effect==="model"?b:0),J={longitude:o.longitude,latitude:o.latitude,fov:o.fov},V=__assign(__assign({},e),{mode:this.mode,longitude:(u=J.longitude)!==null&&u!==void 0?u:this.camera.pose.longitude,latitude:(l=J.latitude)!==null&&l!==void 0?l:this.camera.pose.latitude,fov:(c=J.fov)!==null&&c!==void 0?c:this.camera.pose.fov,offset:r.position.clone(),distance:0}),U=this.currentPano;if(this.emit("pano.moveTo",createEvent("pano.moveTo",{options:o,prevPano:U,progress:0,state:V,userAction:this.userAction,error:null})),o.moveStartCallback&&o.moveStartCallback(V),this.videoTexture&&this.videoTexture.image instanceof HTMLVideoElement&&this.videoTexture.image.getAttribute("src")&&(this.videoTexture.image.pause(),this.videoTexture.image.removeAttribute("uuid"),this.videoTexture.image.removeAttribute("src"),this.videoTexture.image.oncanplay=noop,this.videoTexture.needsUpdate=!0),this.panoVideo.setMaterial(null),r.effect==="fly"||r.effect==="model")this.cameraMotion.set(J,z).catch(noop);else{var j=coordinatesToVector({longitude:this.cameraMotion.value.longitude,latitude:this.cameraMotion.value.latitude}),K=coordinatesToVector({longitude:(f=J.longitude)!==null&&f!==void 0?f:this.cameraMotion.value.longitude,latitude:(p=J.latitude)!==null&&p!==void 0?p:this.cameraMotion.value.latitude}),ae=new THREE__namespace.Object3D;ae.lookAt(j);var re=new THREE__namespace.Matrix4().makeRotationFromQuaternion(ae.quaternion);ae.lookAt(K);var ee=new THREE__namespace.Matrix4().makeRotationFromQuaternion(ae.quaternion),Z=new THREE__namespace.Matrix4().getInverse(re).premultiply(ee),X=this.cameraMotion.value.fov,se=(d=J.fov)!==null&&d!==void 0?d:this.cameraMotion.value.fov,G=1;r.effect==="zoomin"?G=1.5:r.effect==="zoomout"&&(G=.4);for(var W=se*G,$=0;$<T.length-1;$++){var ne=T[$].key;if(ne){var te=this.panoResources[ne];te&&(te.fixCameraTransform.copy(Z),te.leftPanoPicture&&(te.leftPanoPicture.zoom=Math.tan(W/2/180*Math.PI)/Math.tan(X/2/180*Math.PI)))}}this.cameraMotion.setKeyframes([{progress:0,value:{longitude:this.cameraMotion.value.longitude,latitude:this.cameraMotion.value.latitude,fov:this.cameraMotion.value.fov}},{progress:0,value:{longitude:(h=J.longitude)!==null&&h!==void 0?h:this.cameraMotion.value.longitude,latitude:(g=J.latitude)!==null&&g!==void 0?g:this.cameraMotion.value.latitude,fov:W}},{progress:1,value:{longitude:(m=J.longitude)!==null&&m!==void 0?m:this.cameraMotion.value.longitude,latitude:(E=J.latitude)!==null&&E!==void 0?E:this.cameraMotion.value.latitude,fov:se}}],z).catch(noop)}var ve=this.locationMotion.setKeyframes(T,z,_);ve.then(function(){for(var oe=0,fe=s.modelScene.children;oe<fe.length;oe++){var be=fe[oe];be instanceof Model&&be.show()}var ie=__assign(__assign({},e),{mode:s.mode,longitude:s.camera.pose.longitude,latitude:s.camera.pose.latitude,fov:s.camera.pose.fov,offset:s.camera.pose.offset.clone(),distance:0});s.emit("pano.arrived",createEvent("pano.arrived",{options:o,prevPano:U,progress:1,state:ie,userAction:s.userAction,error:null})),o.moveEndCallback&&o.moveEndCallback(ie);var ue=s.works.getObserver(s.currentPano);if(ue&&ue.images.video&&s.videoTexture&&s.videoTexture.image instanceof HTMLVideoElement){var me={map:s.videoTexture,size:ue.images.video.size.clone(),matrix:ue.images.video.matrix.clone(),panoMatrix:ue.matrix.clone().premultiply(ue.work.transform),alpha:1},ge=createUuid(),Ae=s.videoTexture.image;Ae.setAttribute("uuid",ge),canplayVideo().then(function(xe){xe&&ue.images.video&&Ae.getAttribute("uuid")===ge&&(Ae.oncanplay=function(){Ae.oncanplay=noop,Ae.play()},Ae.ontimeupdate=function(){Ae.currentTime>.5&&(Ae.ontimeupdate=noop,s.panoVideo.setMaterial(me))},Ae.src=ue.images.video.source)}).catch((function(){Ae.removeAttribute("uuid")}))}},function(){s.emit("pano.cancel",createEvent("pano.cancel",{options:o,prevPano:U,progress:0,state:V,userAction:s.userAction,error:null})),o.moveCancelCallback&&o.moveCancelCallback()})},t.prototype.checkSelectedPano=function(e){var r=this,o;this.stopMomentumMovement(),this.camera.getDirection(new THREE__namespace.Vector3).setY(0);var s=null,u=this.works.getObserver(this.currentPano);if(!u)return null;var l=u.work.observers,c=u.accessibleNodes.filter(function(_){if(_===r.currentPano.panoIndex&&u.work.workCode===r.currentPano.workCode)return!1;var S=l[_];if(!S)return!1;var w=scratchVector3.copy(S.position).applyMatrix4(S.work.transform);return w.distanceTo(r.camera.position)>r.maxAccessibleDistance?!1:S.loadable||S.active}),f=this.modelScene.intersectRaycaster(e)[0];if(f){var p=arrayMin(c,function(_){var S=l[_];if(!S)return 1/0;var w=scratchVector3.copy(S.standingPosition).applyMatrix4(S.work.transform);return w.distanceTo(f.point)},!0),d=p[0],h=p[1];typeof d=="number"&&h<this.panoTapTriggerRadius&&(s=(o=l[d])!==null&&o!==void 0?o:null)}if(isNil(s)){var g=this.getForwardObserverOrNot(this.xrManager.cameraVR,e);g&&(s=g)}for(var m=0,E=this.locationMotion.keyframes;m<E.length;m++){var y=E[m],v=this.panoResourceFromLocationMotionKeyframe(y);if(!(y.progress<this.locationMotion.progress)&&s){var A=panoStringify({panoIndex:s.panoIndex,workCode:s.work.workCode});if(v.panoId===A){s=null;break}}}if(isNil(s))return this.locationMotion.ended===!0&&this.cameraBounce(),null;if(!s.active){var A=panoStringify({panoIndex:s.panoIndex,workCode:s.work.workCode}),b=this.panoMeshes.get(A);b&&(b.setDisabled(!1),b.setLoading(!0))}var T={workCode:s.work.workCode,panoIndex:s.panoIndex,mode:this.mode,longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude,fov:this.camera.pose.fov,distance:0,offset:s?s.position.clone():new THREE__namespace.Vector3};return this.emit("pano.select",createEvent("pano.select",{prevPano:this.currentPano,state:T,userAction:!0,options:{},progress:0,error:null})),s&&s.active?(this.emit("pano.request",createEvent("pano.request",{userAction:!0,prevPano:this.currentPano,progress:0,state:T,options:{},error:null})),{workCode:s.work.workCode,panoIndex:s.panoIndex}):null},t.prototype.destroy=function(){n.prototype.destroy.call(this)},t.prototype.isReady=function(){return!1},t.prototype.updateCamera=function(e,r,o){return Promise.resolve()},t.prototype.updateCameraWithKeyframes=function(e,r,o){return Promise.resolve()},t.prototype.updateTime=function(e,r){for(var o=this,s,u,l,c,f,p,d,h,g,m=[],E=2;E<arguments.length;E++)m[E-2]=arguments[E];this.userAction=!0;var y={},v={},A=this.camera.getDirection(new THREE__namespace.Vector3),b=this.locationMotion.keyframes[0],T=this.locationMotion.keyframes[this.locationMotion.keyframes.length-1],_=this.locationMotion.getKeyFrameSegment(e),S=_[0],w=_[1],R=this.panoResourceFromLocationMotionKeyframe(S),I=this.panoResourceFromLocationMotionKeyframe(w),H=this.panoResourceFromLocationMotionKeyframe(b),C=this.panoResourceFromLocationMotionKeyframe(T),M=!1;if(this.cameraMotion.ended===!1&&(this.cameraMotion.update(e),v.fov=this.cameraMotion.value.fov),this.modelAlphaMotion.ended===!1&&(this.modelAlphaMotion.update(e),y.modelAlpha=this.modelAlphaMotion.value.modelAlpha),this.perspToOrthoMotion.ended===!1&&(this.perspToOrthoMotion.update(e),this.camera.perspToOrtho.setScalar(clamp$1(this.perspToOrthoMotion.value.perspToOrtho,0,1))),this.locationMotion.ended===!1){this.locationMotion.update(e);var B=this.locationMotion.value.count-w.value.count+1,L=new THREE__namespace.Vector3().copy(R.position),O=new THREE__namespace.Vector3().copy(I.position);if(y.progress=B,B>=.01&&B<=.99&&(y.progress=clamp$1(I.effectEasing(B),.01,.99)),I.leftPanoPicture&&(B<1?R.leftPanoPicture&&(y.pano0=R.leftPanoPicture):y.pano0=I.leftPanoPicture,y.pano1=I.leftPanoPicture),I.effect==="montage"?y.transition="BLACK":I.effect==="spread"?y.transition="SPREAD":y.transition="FADE",I.effect==="zoomin"||I.effect==="zoomout")y.progress=Math.pow(B,3);else if(I.effect==="model"&&this.camera.pose.distance<.01){var k=1-Math.pow(clamp$1(Math.abs(B-.5)*2,0,1),4);y.modelAlpha=k}if(B<1&&I.effect!=="fly"){if(y.pano0&&R.leftPanoPicture){var D={panoId:y.pano0.panoId,map:y.pano0.map,mapSize:y.pano0.mapSize,zoom:y.pano0.zoom,matrix:R.leftPanoPicture.matrix.clone().setPosition(I.position)},q=this.panoPictureObserverMap.get(y.pano0);q&&this.panoPictureObserverMap.set(D,q),y.pano0=D}L.copy(O),M=!0}v.distance=this.locationMotion.value.distance,v.offset=new THREE__namespace.Vector3(L.x+(O.x-L.x)*B,L.y+(O.y-L.y)*B,L.z+(O.z-L.z)*B);for(var z=[],J=[],V=0,U=this.locationMotion.keyframes;V<U.length;V++){var j=U[V],K=j.key,ae=j.progress;K!==void 0&&(z.push(K),ae>this.locationMotion.progress&&J.push(K))}for(var re=0,ee=Object.keys(this.panoResources);re<ee.length;re++){var Z=ee[re];if(!(J.indexOf(Z)>=0)){var X=this.panoResources[Z];if(X.leftPanoPicture){var se=X.leftPanoPicture.map;if(se){if(se===((s=y.pano0)===null||s===void 0?void 0:s.map)||se===((u=y.pano1)===null||u===void 0?void 0:u.map))continue;se.dispose(),X.leftPanoPicture=null}}z.indexOf(Z)>=0||delete this.panoResources[Z]}}var G=panoParse(I.panoId);G!==this.currentPano&&(this.currentPano=G,this.accessibleObserverFloorCheckCount=0),this.emit("pano.moving",createEvent("pano.moving",{userAction:this.userAction,prevPano:panoParse(H.panoId),state:__assign(__assign(__assign(__assign({},panoParse(C.panoId)),{mode:this.mode}),clonePose(this.camera.pose)),v),options:{},progress:this.locationMotion.progress,error:null}))}this.camera.setFromPose(v),this.xrManager.cameraVR.projectionMatrix.copy(this.camera.projectionMatrix),this.xrManager.cameraVR.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),this.xrManager.cameraVR.matrix.copy(this.camera.matrix),this.xrManager.cameraVR.position.copy(this.camera.position),this.xrManager.cameraVR.quaternion.copy(this.camera.quaternion),this.xrManager.cameraVR.scale.copy(this.camera.scale),this.xrManager.cameraVR.matrixAutoUpdate=!1,this.xrManager.cameraVR.matrixWorld.copy(this.camera.matrixWorld);var W=m,$=W[1],ne=new THREE__namespace.Vector3(0,0,0),te=new THREE__namespace.Vector2().copy(this.camera.resolution);if($&&this.xrManager.session&&this.xrManager.referenceSpace&&this.xrManager.session.renderState.baseLayer){for(var ve=this.xrManager.cameraVR,oe=this.xrManager.referenceSpace,fe=this.xrManager.session.renderState.baseLayer,be=$.getViewerPose(oe),ie=(l=be==null?void 0:be.views)!==null&&l!==void 0?l:[],ue=0;ue<ie.length;ue++){var me=ie[ue],ge=ve.cameras[ue],Ae=fe.getViewport(me);Ae&&(ge.projectionMatrix.fromArray(me.projectionMatrix),ge.projectionMatrixInverse.getInverse(ge.projectionMatrix),ge.matrix.fromArray(me.transform.matrix),ge.matrix.setPosition(this.camera.position),ge.matrix.decompose(ge.position,ge.quaternion,ge.scale),ge.matrixWorld.copy(ge.matrix),ge.matrixWorldInverse.getInverse(ge.matrixWorld),ge.matrixAutoUpdate=!1,ne.copy(ge.position),ge.viewport.set(Ae.x,Ae.y,Ae.width,Ae.height),te.set(Ae.width,Ae.height))}if(this.xrManager.setProjectionFromUnion(this.xrManager.cameraVR,this.xrManager.cameraL,this.xrManager.cameraR),this.camera.quaternion.copy(this.xrManager.cameraVR.quaternion),this.camera.scale.copy(this.xrManager.cameraVR.scale),this.camera.matrix.compose(this.camera.position,this.camera.quaternion,this.camera.scale),this.camera.computePose((c=v.distance)!==null&&c!==void 0?c:this.camera.pose.distance),this.xrManager.session.inputSources){for(var ue=0;ue<this.xrManager.session.inputSources.length;ue++)if(this.xrManager.session.inputSources[ue]&&this.xrManager.session.inputSources[ue].targetRayMode==="transient-pointer"){var xe=$.getPose(this.xrManager.session.inputSources[ue].targetRaySpace,oe);if(xe){var de=xe.transform.orientation,_e=new THREE__namespace.Quaternion(de.x,de.y,de.z,de.w),He=new THREE__namespace.Vector3(0,0,-1).applyQuaternion(_e),Ee=new THREE__namespace.Raycaster(this.camera.position,He);this.gazeRay=Ee}}}if(this.xrManager.machineType==="Oculus"||this.xrManager.machineType==="Pico"){for(var pe=this.xrManager.session.inputSources,Ve=function(he){var Ie=ye.xrManager.controllers[he],Re=pe[he];if(!Re)return"continue";Ie&&Ie.update(Re,$,oe);var qe=ye.xrManager.getController(he),Ye=new THREE__namespace.Vector3(0,1.2,0),ut=qe.position.clone().add(ne).sub(Ye);Re.handedness==="left"?ye.xrControllerRay.left.set(ut,new THREE__namespace.Vector3(0,0,-1).applyEuler(qe.rotation)):Re.handedness==="right"&&ye.xrControllerRay.right.set(ut,new THREE__namespace.Vector3(0,0,-1).applyEuler(qe.rotation)),ye.controllerWrappers[he].position.copy(new THREE__namespace.Vector3(0,0,0).add(ne).sub(Ye));var Ke=ye.modelScene.intersectRaycaster(ye.xrControllerRay.right);if(Ke.length===0){var dt=ye.works.getResolvedObserver(ye.currentPano);Ke=ye.xrControllerRay.right.intersectObject(ye.modelScene.boundingMesh,!0).map(function(Ge){var Ze,De=(Ze=dt==null?void 0:dt.floorIndex)!==null&&Ze!==void 0?Ze:0;return __assign({floorIndex:De,floor:De},Ge)})}if(Ke.length>=1&&Ke[0].face)if(Re.handedness==="right"){var Pt=ye.xrControllerRay.right.intersectObject(ye.xrCustomObjectsScene,!0),P=Ke[0].face.normal,F=P.clone(),N=Ke[0].point.clone();ye.intersectMesh.position.copy(N);var Q=N.clone().add(F);if(ye.intersectMesh.lookAt(Q),Math.abs(P.y)>.99){var Y=ye.camera.position.clone().sub(N);ye.intersectMesh.rotation.z=-Math.atan2(Y.z,Y.x)}ye.intersectMesh.visible=!0,ye.needsRender=!0,Pt.length>0?(ye.pointerLines.right.setPoints(ut,Pt[0].point),ye.pointerLines.right.points.visible=!0,ye.intersectMesh.visible=!1):(ye.pointerLines.right.points.visible=!1,ye.pointerLines.right.setPoints(ut,Ke[0].point));var le=Ke[0],Te=createEvent("intersect.update",{raycaster:(f=ye.xrControllerRay.right)!==null&&f!==void 0?f:null,intersection:le!=null?le:null,object:ye.intersectMesh});if(ye.emit("intersect.update",Te),Te.defaultPrevented)return ye.hideIntersectMesh(),{value:void 0}}else ye.pointerLines.left.setPoints(ut,Ke[0].point)},ye=this,ue=0;ue<pe.length;ue++){var Pe=Ve(ue);if(typeof Pe=="object")return Pe.value}this.updateControllerHelper(pe,e,r)}}else $||console.error("xrFrame丢失,请重试"),this.xrManager.session||console.error("session丢失,请重试"),this.xrManager.session&&!this.xrManager.session.renderState.baseLayer&&console.error("no layer found");isEmptyObject(y)===!1&&this.modelScene.parameter.set(y),this.emit("camera.update",createEvent("camera.update",{userAction:this.userAction,state:__assign(__assign(__assign({},this.currentPano),{mode:this.mode}),clonePose(this.camera.pose))}));var Ce=this.works.getResolvedObserver(this.currentPano),$e=this.locationMotion.ended?this.getForwardObserverOrNot(this.xrManager.cameraVR):null,Se=this.works.getObserver(R.panoId),ze=this.works.getObserver(I.panoId);if(this.adjustPanoCircleMeshPositionBasedOnModel&&this.helper.visible&&Ce){for(var Fe=[],Oe=Ce.work.observers,Le=0,Ue=Ce.accessibleNodes;Le<Ue.length;Le++){var tt=Ue[Le],q=Oe[tt];q&&Fe.push(q)}var lt=new Map;if(Fe.sort(function(he,Ie){var Re=lt.get(he);typeof Re=="undefined"&&(Re=he.standingPosition.distanceTo(Ce.standingPosition),lt.set(he,Re));var qe=lt.get(he);return typeof qe=="undefined"&&(qe=Ie.standingPosition.distanceTo(Ce.standingPosition),lt.set(Ie,qe)),Re-qe}),Fe.length){this.accessibleObserverFloorCheckCount=this.accessibleObserverFloorCheckCount%Fe.length;var nt=Fe[this.accessibleObserverFloorCheckCount],ot=this.modelScene.models.find(function(he){return he.work===(nt==null?void 0:nt.work)});if(nt&&ot&&ot.visible){var At=.3,We=.05,Mt=.005,Be=nt.standingPosition.clone().applyMatrix4(nt.work.transform),Ne=panoStringify({panoIndex:nt.panoIndex,workCode:nt.work.workCode}),bt=adjustPanoCircleMeshVectors.map(function(he){scratchRaycaster.ray.origin.copy(Be),scratchRaycaster.ray.origin.add(scratchVector3.copy(he).setY(At)),scratchRaycaster.ray.direction.set(0,-1,0),scratchRaycaster.firstHitOnly=!0,scratchRaycaster.floorIndex=-1;var Ie=ot.intersectRaycaster(scratchRaycaster)[0];return Ie&&Ie.distance-Mt<=At?new THREE__namespace.Vector3().copy(Be).setY(Ie.point.y+Mt):Be});bt.sort(function(he,Ie){return Ie.y-he.y});var Ct=bt[Math.floor(bt.length/2)],xt=bt.filter(function(he){return he.distanceTo(Ct)<=We})[0];if(xt){var yt=new THREE__namespace.Vector4(Be.x,Be.y,Be.z,xt.y-Be.y),St=this.adjustPanoCircleMeshPositionFix.get(Ne);St&&!yt.equals(St)&&(this.needsRender=!0),this.adjustPanoCircleMeshPositionFix.set(Ne,yt)}}this.accessibleObserverFloorCheckCount++}}var rt=new Map;if(Se)for(var at=0,ct=Se.accessibleNodes;at<ct.length;at++){var tt=ct[at],q=Se.work.observers[tt];if(q){var Ne=panoStringify({panoIndex:q.panoIndex,workCode:q.work.workCode});rt.set(Ne,q)}}if(ze)for(var Xe=0,ce=ze.accessibleNodes;Xe<ce.length;Xe++){var tt=ce[Xe],q=ze.work.observers[tt];if(q){var Ne=panoStringify({panoIndex:q.panoIndex,workCode:q.work.workCode});rt.set(Ne,q)}}if(this.panoMeshes.forEach(function(he,Ie){var Re=rt.get(Ie);Re?rt.delete(Ie):(o.helper.remove(he),he.dispose(),o.panoMeshes.delete(Ie))}),rt.forEach(function(he,Ie){var Re=o.panoCircleMeshCreator(he,{aerialObserverMinHeight:o.aerialObserverMinHeight});o.panoMeshes.set(Ie,Re),o.helper.add(Re),rt.delete(Ie)}),this.panoMeshes.forEach(function(he,Ie){var Re=o.works.getObserver(Ie);if(Re){var qe=Re.position.distanceTo(Re.standingPosition)>o.aerialObserverMinHeight;if(qe)he.position.copy(Re.position).applyMatrix4(Re.work.transform),he.scale.setScalar(18);else{he.position.copy(Re.standingPosition).applyMatrix4(Re.work.transform);var Ye=o.adjustPanoCircleMeshPositionFix.get(Re.panoId);Ye&&(scratchVector3.set(Ye.x,Ye.y,Ye.z),scratchVector3.equals(he.position)&&(he.position.y+=Ye.w)),he.scale.setScalar(1.2)}var ut=o.camera.position.clone().setY(he.position.y),Ke=new THREE__namespace.Vector3().copy(he.position).sub(ut).normalize();if(Ie===panoStringify(o.currentPano)){var dt=clamp$1((.5-ut.distanceTo(he.position))/.5,0,1);Ke.multiplyScalar(1-dt).add(A.clone().multiplyScalar(dt))}if(Ke.length()>0){var Pt=qe?-Math.PI/2:0,P=Math.atan2(Ke.x,Ke.z);he.quaternion.setFromEuler(new THREE__namespace.Euler(Pt,P,0,"YXZ"))}}else he.visible=!1}),this.camera.pose.distance>.1||M)this.panoMeshes.forEach(function(he){he.setOpacity(0),he.setCurrent(!1),he.updateTime&&he.updateTime(e,r),he.visible=!1});else if(Ce){var we=Ce.work.observers,Me=arrayMin(Ce.accessibleNodes,function(he){var Ie=we[he];return Ie?Ce.standingPosition.distanceTo(Ie.standingPosition):1/0},!0),ke=Me[1];ke=clamp$1(ke,2.5,1/0);var je=Ce.accessibleNodes.concat(Ce.panoIndex).map(function(he){return panoStringify({panoIndex:he,workCode:Ce.work.workCode})});this.panoMeshes.forEach(function(he,Ie){var Re=o.works.getObserver(Ie),qe=!1,Ye=1;if(je.indexOf(Ie)===-1)qe=!1,Ye=0;else if(!Re)qe=!1,Ye=0;else if(!Re.loadable&&!Re.active)qe=!1,Ye=0;else{var ut=he.position.clone().project(o.camera),Ke=Math.abs(ut.x)<1&&Math.abs(ut.y)<1&&Math.abs(ut.z)<1;qe=Ke&&!he.loading&&he.progress===0&&$e!==null&&panoStringify({panoIndex:$e.panoIndex,workCode:$e.work.workCode})===Ie;var dt=he.position.clone().setY(o.camera.position.y).distanceTo(o.camera.position);Ye=dt<.01?0:clamp$1(ke/dt,.1,.85)}if(Re&&Re===ze){var Pt=Re.position.distanceTo(Re.standingPosition)>o.aerialObserverMinHeight;if(Pt){var dt=he.position.distanceTo(o.camera.position);dt<35&&(Ye=0)}}o.modelScene.parameter.resolveValue().modelAlpha>0&&(Ye=0),he.setCurrent(qe),he.setOpacity(Ye),he.updateTime&&he.updateTime(e,r)})}{var B=(p=this.modelScene.parameter.progress)!==null&&p!==void 0?p:1,st=Math.round(B),Qe=this.modelScene.parameter.pano0,Je=this.modelScene.parameter.pano1,ft=st===0?Qe:Je,q=void 0;if(ft&&(q=this.works.getObserver(ft.panoId),q||(q=this.panoPictureObserverMap.get(ft))),this.tiling.appearDuration=this.tileAppearDuration,this.tiling.maxRequest=B<(canUseNativeImageBitmap()?.6:.99)?0:this.tileMaxRequest,this.tiling.imageOptions=this.imageOptions,!q||!ft||this.tileLevelForFov===!1||this.camera.perspToOrtho.x>0){this.tiling.setObserver(null);var Bt={renderer:this.renderer,resolution:te,pixelRatio:1,time:this.camera.time,cameraMatrix:this.xrManager.cameraVR.matrixWorld,cameraProjectionMatrix:this.xrManager.cameraVR.projectionMatrix,panoMap:null,panoMatrix:new THREE__namespace.Matrix4,panoZoom:1,minLevel:0,level:0};this.tiling.update(Bt),this.modelScene.parameter.set("refinedScreen",null)}else{var Ft=getImageSizeLevel(ft.mapSize),pt=Ft+1,It=4;this.tiling.setObserver(q);var Bt={renderer:this.renderer,resolution:te,pixelRatio:1,time:this.camera.time,cameraMatrix:this.xrManager.cameraVR.matrixWorld,cameraProjectionMatrix:this.xrManager.cameraVR.projectionMatrix,panoMap:ft.map,panoMatrix:ft.matrix,panoZoom:ft.zoom,minLevel:pt,level:It},Tt=this.tiling.update(Bt),ht={map:this.tiling.renderTarget.texture,matrixInverse:this.tiling.camera.matrixWorldInverse,projectionMatrix:this.tiling.camera.projectionMatrix,pano:st,opacity:(Qe==null?void 0:Qe.panoId)===(Je==null?void 0:Je.panoId)?1:easeInQuart(Math.abs(((d=this.modelScene.parameter.progress)!==null&&d!==void 0?d:0)-.5)*2)},mt=this.modelScene.parameter.refinedScreen;(Tt||ht.pano!==(mt==null?void 0:mt.pano)||ht.opacity!==(mt==null?void 0:mt.opacity))&&this.modelScene.parameter.set("refinedScreen",ht)}}if(this.panoVideo.object.position.copy(this.camera.position),this.panoVideo.updateTime(e),this.intersectMesh&&this.intersectMesh.parent&&Ce&&Ce.position.y-Ce.standingPosition.y>10){var gt=this.camera.position.distanceTo(this.intersectMesh.position),Et=2*Math.tan(.5*this.camera.fov/180*Math.PI),Lt=clamp$1(gt*Et/5,.5);this.intersectMesh.scale.setScalar(Lt)}else this.intersectMesh.scale.setScalar(1);{var Ot=I.effect,Ht=this.modelScene.parameter,Qe=Ht.pano0,Je=Ht.pano1;if(Qe&&Je&&Qe!==Je&&(Ot==="fly"||Ot==="model")&&this.flyEffectUseDepthBuffer){if(((h=this.modelScene.parameter.pano0Depth)===null||h===void 0?void 0:h.panoId)!==Qe.panoId||((g=this.modelScene.parameter.pano1Depth)===null||g===void 0?void 0:g.panoId)!==Je.panoId){var it=500,vt=512;this.pano0DepthCubeRenderTarget?this.pano0DepthCubeRenderTarget.width!==vt&&this.pano0DepthCubeRenderTarget.setSize(vt,vt):this.pano0DepthCubeRenderTarget=new THREE__namespace.WebGLCubeRenderTarget(vt,{minFilter:THREE__namespace.NearestFilter,magFilter:THREE__namespace.NearestFilter,generateMipmaps:!1}),this.pano1DepthCubeRenderTarget?this.pano1DepthCubeRenderTarget.width!==vt&&this.pano1DepthCubeRenderTarget.setSize(vt,vt):this.pano1DepthCubeRenderTarget=new THREE__namespace.WebGLCubeRenderTarget(vt,{minFilter:THREE__namespace.NearestFilter,magFilter:THREE__namespace.NearestFilter,generateMipmaps:!1});var Rt=new THREE__namespace.CubeCamera(this.camera.near,this.camera.far,this.pano0DepthCubeRenderTarget);Rt.matrix.copy(Qe.matrix),Rt.matrixWorld.copy(Rt.matrix),Rt.matrixAutoUpdate=!1,renderDepthCube(this.renderer,this.modelScene,Rt,it);var wt=new THREE__namespace.CubeCamera(this.camera.near,this.camera.far,this.pano1DepthCubeRenderTarget);wt.matrix.copy(Je.matrix),wt.matrixWorld.copy(wt.matrix),wt.matrixAutoUpdate=!1,renderDepthCube(this.renderer,this.modelScene,wt,it),this.modelScene.parameter.set({pano0Depth:{panoId:Qe.panoId,map:this.pano0DepthCubeRenderTarget.texture,mapSize:this.pano0DepthCubeRenderTarget.width,maxDepth:it},pano1Depth:{panoId:Je.panoId,map:this.pano1DepthCubeRenderTarget.texture,mapSize:this.pano1DepthCubeRenderTarget.width,maxDepth:it}})}}else this.modelScene.parameter.set({pano0Depth:null,pano1Depth:null}),this.flyEffectUseDepthBuffer||(this.pano0DepthCubeRenderTarget&&(this.pano0DepthCubeRenderTarget.dispose(),this.pano0DepthCubeRenderTarget=void 0),this.pano1DepthCubeRenderTarget&&(this.pano1DepthCubeRenderTarget.dispose(),this.pano1DepthCubeRenderTarget=void 0))}},t.prototype.render=function(){if(this.xrManager.session&&this.xrManager.session.renderState.baseLayer){var e=this.xrManager.session.renderState.baseLayer;return this.renderer.setRenderTarget(null),this.renderer.setScissorTest(!1),this.renderer.setFramebuffer(e.framebuffer),this.renderer.render(this.scene,this.xrManager.cameraVR),this.renderer.setFramebuffer(null),!0}return!1},t.prototype.onPanGesture=function(){},t.prototype.onTapGesture=function(){},t.prototype.onPinchGesture=function(){},t.prototype.onMouseMove=function(){},t.prototype.onMouseOut=function(){},t.prototype.panoResourceFromLocationMotionKeyframe=function(e){return this.panoResources[e.key]},t.prototype.updateControllerHelper=function(e,r,o){var s=this.xrControllerRay.left,u=this.xrControllerRay.right;if(!(!e||e.length===0)){for(var l={buttons:{X:!1,Y:!1,LeftTrigger:!1,LeftPinch:!1,A:!1,B:!1,RightTrigger:!1,RightPinch:!1}},c=0;c<e.length;c++){var f=e[c].handedness,p=e[c].gamepad;switch(f){case"left":p.axes&&(this.emitHandleEvent(p.axes[2]===-1,"LeftAxesLeft",r),this.emitHandleEvent(p.axes[2]===1,"LeftAxesRight",r),this.emitHandleEvent(p.axes[3]===-1,"LeftAxesUp",r),this.emitHandleEvent(p.axes[3]===1,"LeftAxesDown",r)),p!=null&&p.buttons&&(p.buttons[4]&&this.emitHandleEvent(p.buttons[4].pressed,"X",r),p.buttons[5]&&this.emitHandleEvent(p.buttons[5].pressed,"Y",r),p.buttons[0]&&this.emitHandleEvent(p.buttons[0].pressed,"LeftTrigger",r),p.buttons[1]&&this.emitHandleEvent(p.buttons[1].pressed,"LeftPinch",r));var d={raycaster:s,axes:{up:p.axes&&p.axes[3]<0?Math.abs(p.axes[3]):0,down:p.axes&&p.axes[3]<0?0:Math.abs(p.axes[3]),left:p.axes&&p.axes[2]<0?Math.abs(p.axes[2]):0,right:p.axes&&p.axes[2]<0?0:Math.abs(p.axes[2])},deltaTime:o};l.buttons.X=p.buttons&&p.buttons[4]?p.buttons[4].pressed:!1,l.buttons.Y=p.buttons&&p.buttons[5]?p==null?void 0:p.buttons[5].pressed:!1,l.buttons.LeftTrigger=p.buttons&&p.buttons[0]?p==null?void 0:p.buttons[0].pressed:!1,l.buttons.LeftPinch=p.buttons&&p.buttons[1]?p==null?void 0:p.buttons[1].pressed:!1,l.left=d;break;case"right":p.axes&&(this.emitHandleEvent(p.axes[2]===-1,"RightAxesLeft",r),this.emitHandleEvent(p.axes[2]===1,"RightAxesRight",r),this.emitHandleEvent(p.axes[3]===-1,"RightAxesUp",r),this.emitHandleEvent(p.axes[3]===1,"RightAxesDown",r)),p.buttons&&(p.buttons[4]&&this.emitHandleEvent(p.buttons[4].pressed,"A",r),p.buttons[5]&&this.emitHandleEvent(p.buttons[5].pressed,"B",r),p.buttons[0]&&this.emitHandleEvent(p.buttons[0].pressed,"RightTrigger",r),p.buttons[1]&&this.emitHandleEvent(p.buttons[1].pressed,"RightPinch",r));var h={raycaster:u,axes:{up:p.axes&&p.axes[3]<0?Math.abs(p.axes[3]):0,down:p.axes&&p.axes[3]<0?0:Math.abs(p.axes[3]),left:p.axes&&p.axes[2]<0?Math.abs(p.axes[2]):0,right:p.axes&&p.axes[2]<0?0:Math.abs(p.axes[2])},deltaTime:o};l.right=h,l.buttons.A=p.buttons&&p.buttons[4]?p==null?void 0:p.buttons[4].pressed:!1,l.buttons.B=p.buttons&&p.buttons[5]?p==null?void 0:p.buttons[5].pressed:!1,l.buttons.RightTrigger=p.buttons&&p.buttons[0]?p==null?void 0:p.buttons[0].pressed:!1,l.buttons.RightPinch=p.buttons&&p.buttons[1]?p==null?void 0:p.buttons[1].pressed:!1;break}}this.emit("xr.controller.update",createEvent("xr.controller.update",l))}},t.prototype.emitHandleEvent=function(e,r,o){var s=this.xrControllerRay.left,u=this.xrControllerRay.right;if(e)if(this.xrHandleState[r].touchStart===!1)this.xrHandleState[r].touchStartTime=o,this.xrHandleState[r].touchStart=!0,this.emit("xr.gesture.buttonDown",createEvent("xr.gesture.buttonDown",{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:r,isFinal:!1,isFirst:!0,controllers:{raycaster:{leftRay:s,rightRay:u}}}));else{var l=o-this.xrHandleState[r].touchStartTime;l>CONTROLLER_EVNET_DELTA_TIME&&this.emit("xr.gesture.press",createEvent("xr.gesture.tap",{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:r,isFinal:!0,isFirst:!0,controllers:{raycaster:{leftRay:s,rightRay:u}}}))}else if(this.xrHandleState[r].touchStart===!0){this.emit("xr.gesture.buttonUp",createEvent("xr.gesture.buttonUp",{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:r,isFinal:!0,isFirst:!1,controllers:{raycaster:{leftRay:s,rightRay:u}}}));var l=o-this.xrHandleState[r].touchStartTime;if(l<=CONTROLLER_EVNET_DELTA_TIME){var c=createEvent("xr.gesture.tap",{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:r,isFinal:!0,isFirst:!1,controllers:{raycaster:{leftRay:s,rightRay:u}}}),f=this.emit("xr.gesture.tap",c);!f&&!c.defaultPrevented&&r==="RightTrigger"&&this.checkSelectedPano(this.xrControllerRay.right)}this.xrHandleState[r].touchStart=!1,this.xrHandleState[r].touchStartTime=0}},t.prototype.initHandEvent=function(){var e=this;if(!this.xrManager.session)throw new Error("初始化失败");this.xrManager.session.addEventListener("select",function(r){e.gazeRay&&e.checkSelectedPano(e.gazeRay)})},t})(PanoramaController),Controllers={Floorplan:FloorplanController,Topview:TopviewController,Panorama:PanoramaController,VRPanorama:VRPanoramaController,Model:ModelController,Mapview:MapviewController,XRPanorama:XRPanoramaController},controllersDefaultInitArgs={Floorplan:defaultFloorplanControllerCustomInitArgs,Topview:defaultTopviewControllerCustomInitArgs,Panorama:defaultPanoramaControllerCustomInitArgs,VRPanorama:defaultVRPanoramaControllerCustomInitArgs,Model:defaultModelControllerCustomInitArgs,Mapview:defaultMapviewControllerCustomInitArgs,XRPanorama:defaultXRPanoramaControllerInitArgs},PROXY_CONTROLLER_EVENT_NAMES=["gesture.pan","gesture.tap","gesture.dbltap","gesture.press","gesture.pinch","gesture.mousewheel","gesture.mousemove","gesture.momentum","initAnimation.start","initAnimation.end","camera.update","intersect.update","pano.select","pano.moveTo","pano.moving","pano.arrived","pano.cancel","pano.error","pano.texture.load","pano.texture.progress","pano.texture.success","pano.texture.error","pano.texture.abort","xr.session.start","xr.session.end","xr.gesture.tap","xr.gesture.press","xr.gesture.buttonUp","xr.gesture.buttonDown","xr.controller.update"];function initLegacyEvent(n){n.on("initAnimation.start",function(t){n.emit("initAnimationWillStart",t.state.panoIndex,t.state,t.userAction)}),n.on("initAnimation.end",function(t){n.emit("initAnimationEnded",t.state.panoIndex,t.state,t.userAction)}),n.on("gesture.pan",function(t){var e=!1;e=n.emit("wantsGesture","pan",t.pointers,t.isFinal),e&&t.preventDefault(),e=n.emit("wantsPanGesture",t.state,t.isFinal),e&&t.preventDefault(),t.defaultPrevented||(n.emit("gesture","pan",t.pointers,t.isFinal),n.emit("panGesture",t.state,t.isFinal))}),n.on("gesture.tap",function(t){var e=!1;e=n.emit("wantsGesture","tap",t.pointers,t.isFinal),e&&t.preventDefault(),e=n.emit("wantsTapGesture",t.center.raycaster,t.center.coords,t.isFinal),e&&t.preventDefault(),t.defaultPrevented||(n.emit("gesture","tap",t.pointers,t.isFinal),n.emit("tapGesture",t.center.raycaster,t.center.coords,t.isFinal))}),n.on("gesture.dbltap",function(t){var e=!1;e=n.emit("wantsGesture","dbltap",t.pointers,t.isFinal),e&&t.preventDefault(),e=n.emit("wantsDblTapGesture",t.center.raycaster,t.center.coords,t.isFinal),e&&t.preventDefault(),t.defaultPrevented||(n.emit("gesture","dbltap",t.pointers,t.isFinal),n.emit("dblTapGesture",t.center.raycaster,t.center.coords,t.isFinal))}),n.on("gesture.press",function(t){var e=!1;e=n.emit("wantsGesture","press",t.pointers,t.isFinal),e&&t.preventDefault(),e=n.emit("wantsPressGesture",t.center.raycaster,t.center.coords,t.center.delta,t.isFinal),e&&t.preventDefault(),t.defaultPrevented||(n.emit("gesture","press",t.pointers,t.isFinal),n.emit("pressGesture",t.center.raycaster,t.center.coords,t.center.delta,t.isFinal))}),n.on("gesture.pinch",function(t){var e=!1;e=n.emit("wantsGesture","pinch",t.pointers,t.isFinal),e&&t.preventDefault(),e=n.emit("wantsPinchGesture",t.scale,t.state.fov,t.isFinal),e&&t.preventDefault(),t.defaultPrevented||(n.emit("gesture","pinch",t.pointers,t.isFinal),n.emit("pinchGesture",t.scale,t.state.fov,t.isFinal))}),n.on("gesture.mousewheel",function(t){var e=!1;e=n.emit("wantsGesture","mouseWheel",t.pointers,t.isFinal),e&&t.preventDefault(),e=n.emit("wantsMouseWheel",t.center.delta,t.state.fov,t.isFinal),e&&t.preventDefault(),t.defaultPrevented||(n.emit("gesture","mouseWheel",t.pointers,t.isFinal),n.emit("mouseWheel",t.center.delta,t.state.fov,t.isFinal))}),n.on("gesture.mousemove",function(t){var e=!1;e=n.emit("wantsGesture","mouseMove",t.pointers,t.isFinal),e&&t.preventDefault(),t.defaultPrevented||(n.emit("gesture","mouseMove",t.pointers,t.isFinal),e=n.emit("wantsChangeCameraFov",t.state.fov),e&&t.preventDefault())}),n.on("gesture.momentum",function(t){var e=!1;e=n.emit("wantsInteriaPan",t.state),e&&t.preventDefault(),t.defaultPrevented||n.emit("interiaPan",t.state,t.isFinal)}),n.on("camera.update",function(t){n.emit("cameraFovUpdate",t.state.fov,t.userAction),n.emit("cameraDirectionUpdate",t.state,t.userAction);var e=coordinatesToVector(t.state);e.setLength(t.state.distance);var r=t.state.offset.clone().sub(e);n.emit("cameraPositionUpdate",r,t.userAction),n.emit("cameraUpdate",t.state,t.userAction)}),n.on("intersect.update",function(t){if(t.intersection){var e=!1;e=n.emit("wantsShowIntersectionOnModel",t.raycaster),e&&t.preventDefault(),t.defaultPrevented||n.emit("intersectionOnModelUpdate",t.intersection,t.object)}else n.emit("intersectionHidden")}),n.on("pano.request",function(t){var e=n.emit("wantsMoveToPano",t.state.panoIndex,t.options,t.userAction);e||(e=n.emit("wantsToMoveToPano",t.state.panoIndex,t.options,t.userAction)),e&&t.preventDefault(),t.defaultPrevented||n.emit("panoWillLoad",t.state.panoIndex)}),n.on("pano.select",function(t){n.emit("panoSelected",t.state.panoIndex)}),n.on("pano.moveTo",function(t){n.emit("panoLoaded",t.state.panoIndex),n.emit("moveToPano",t.state.panoIndex,t.userAction),n.emit("panoWillArrive",t.state.panoIndex,t.state,t.userAction)}),n.on("pano.moving",function(t){n.emit("movingToPano",t.state.panoIndex,t.prevPano.panoIndex,t.progress)}),n.on("pano.arrived",function(t){n.emit("panoArrived",t.state.panoIndex,t.state,t.userAction)}),n.on("pano.cancel",function(t){n.emit("moveToPanoCanceled",t.state.panoIndex)}),n.on("pano.error",function(t){n.emit("panoLoadError",t.error,t.state.panoIndex)}),n.on("pano.texture.load",function(t){n.emit("textureStartLoad",t.pano.panoIndex)}),n.on("pano.texture.success",function(t){n.emit("textureLoaded",t.pano.panoIndex,t.meta)}),n.on("pano.texture.error",function(t){n.emit("textureError",t.error,t.pano.panoIndex)}),n.on("pano.texture.abort",function(t){n.emit("textureAbort",t.pano.panoIndex)}),n.on("pano.texture.progress",function(t){n.emit("textureLoading",t.progress,t.pano.panoIndex)}),n.on("xr.session.start",function(t){n.emit("webXRSessionStart")}),n.on("xr.session.end",function(t){n.emit("webXRSessionEnd")}),n.on("xr.gesture.tap",function(t){n.emit("webXRControllerEvent","tap",t.buttons,{raycaster:t.controllers.raycaster})}),n.on("xr.gesture.press",function(t){n.emit("webXRControllerEvent","press",t.buttons,{raycaster:t.controllers.raycaster})}),n.on("xr.gesture.buttonUp",function(t){n.emit("webXRControllerEvent","buttonUp",t.buttons,{raycaster:t.controllers.raycaster})}),n.on("xr.gesture.buttonDown",function(t){n.emit("webXRControllerEvent","buttonDown",t.buttons,{raycaster:t.controllers.raycaster})}),n.on("xr.controller.update",function(t){n.emit("webXRControllerRayUpdate",{leftRay:t.left?t.left.raycaster:void 0,rightRay:t.right?t.right.raycaster:void 0}),t.left&&n.emit("webXRAxesUpdate","left",{raycaster:{leftRay:t.left?t.left.raycaster:void 0,rightRay:t.right?t.right.raycaster:void 0},axesState:{up:t.left.axes.up,down:t.left.axes.down,left:t.left.axes.left,right:t.left.axes.right},deltaTime:t.left.deltaTime}),t.right&&n.emit("webXRAxesUpdate","right",{raycaster:{leftRay:t.left?t.left.raycaster:void 0,rightRay:t.right?t.right.raycaster:void 0},axesState:{up:t.right.axes.up,down:t.right.axes.down,left:t.right.axes.left,right:t.right.axes.right},deltaTime:t.right.deltaTime})}),n.on("works.request",function(t){n.emit("willLoad",t.input,t.works[0],n.getCurrentState())}),n.on("works.load",function(t){n.emit("load",t.input,t.works[0],n.getCurrentState())}),n.on("works.ready",function(t){n.emit("loaded",t.input,t.works[0])}),n.on("state.change",function(t){n.emit("stateChange",t.state,t.userAction)}),n.on("currentState.change",function(t){n.emit("currentStateChange",t.state,t.userAction)}),n.on("state.set",function(t){n.emit("setState",t.state)}),n.on("state.synced",function(t){n.emit("stateSynced",t.state)}),n.on("model.request",function(t){n.emit("modelWillLoad",t.work.model)}),n.on("model.error",function(t){n.emit("modelLoadError",t.error,t.model)}),n.on("model.load",function(t){n.emit("modelLoaded",t.model)}),n.on("model.changeShownFloor",function(t){n.emit("modelShownFloorChange",t.model.shownFloor,t.model.floorLength)}),n.on("render",function(t){n.emit("renderFrame",t.needsRender)}),n.on("mode.change.request",function(t){n.emit("wantsChangeMode",t.mode,t.prevMode)}),n.on("mode.change",function(t){n.emit("modeChange",t.mode,t.prevMode,t.state.panoIndex,t.state,t.userAction)}),n.on("helpers.visible",function(t){n.emit("helpersVisibleChange",t.object.visible)}),n.on("network.resource",function(t){n.emit("network",t.source,t.requestType,t.requestState,t.detail)})}function generateDefaultVideoElement(){if(typeof window!="undefined"){var n=document.createElement("video");n.loop=!0,n.autoplay=!0,n.playsInline=!0,n.muted=!0,n.crossOrigin="";var t=function(){document.removeEventListener("touchstart",t,!1),document.removeEventListener("mousedown",t,!1),n.muted=!1};return document.addEventListener("touchstart",t,!1),document.addEventListener("mousedown",t,!1),n}else return{}}function initLights(){var n=new THREE__namespace.Group;n.name="internalLights";{var t=new THREE__namespace.DirectionalLight(16777215,.1);t.name="direction0",t.position.copy(new THREE__namespace.Vector3(0,1,0)),n.add(t)}{var t=new THREE__namespace.DirectionalLight(16777215,.1);t.name="direction1",t.position.copy(new THREE__namespace.Vector3(-1,-1,-1)),n.add(t)}{var t=new THREE__namespace.DirectionalLight(16777215,.3);t.name="direction2",t.position.copy(new THREE__namespace.Vector3(1,1,1)),n.add(t)}{var t=new THREE__namespace.AmbientLight(16777215,.6);t.name="ambient0",n.add(t)}return n}function parseKeyValue(n){for(var t,e,r={},o=n.split(/(\;|\,)/),s=0,u=o;s<u.length;s++){var l=u[s],c=l.split("="),f=(t=c[0])===null||t===void 0?void 0:t.trim(),p=(e=c[1])===null||e===void 0?void 0:e.trim();f&&p&&(r[f]=p)}return r}function getViewportScale(){var n;if(typeof document!="undefined")for(var t=document.getElementsByTagName("meta"),e=0;e<t.length;e++){var r=t[e];if(r.getAttribute("name")==="viewport"){var o=parseKeyValue((n=r.getAttribute("content"))!==null&&n!==void 0?n:""),s=Number(o["initial-scale"]);if(!isNaN(s))return s}}return 1}const textureURL="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAV8AAAA/CAQAAADtPwPkAAAR+0lEQVR4AezYg3LEQACH8d1cbdu23Q5qG9G47z/TN/h6tn2b/H+TUTLc7yjcOXV46OUAnUs6EbUp022ZBXc1NhoZYYd7fjDRvdcHAwrlK2QBVJ4sgoqONmY45RUT23sZ6H42F2hK5CtkMbjhZlDmUUcvq1zyieUVyjbE4I1GBfItwxG56YaUZTQwyh4P6NgJ4YYYvCuQb5kOyI03pORjiqe4Lwpq5pt1vJqfUwKWJVbSMYfppYconG+maNNQOWBZuwHTzicGel75NtFOkxr5apmV8cikcko0DrDQs863AeGl0cE0+1xy573m0/wf0cEKW6H7BWtggiMG8sy3oHRDpJMw4NWb6am/bv9znkqEzjd61t5oo5clTrjhwevO75EJRBKSRt745Z16ZEjcM73sccZplBPm8PyTcxZAkSRdHm/acJ0Z3JZhHB0BxqDHgWFZFmm0ZbCw87twI/zc3e/Cz93vPneXtU/WdQS3oTviXdY/q5PsJKfoGuQjZuO/0in1qsj85cuXrxqeAOJpGqdJOqrUutgVl2Qb0BWqp/RE8AWWVB7t2KrIzY2Wx2fWKl7yfswgxqj8lYummYa3hfwF9MuQRmbfQE4ocPDjtUWQ6Tq1M2w7gC2EcrMGtWS6xlpGKEDDcb1vUQ25zT4lrC2s0dU4gFPppKkbeIYr7NMpqjStuFg5rNU9epGyt8PXyfX4DE1bKLhR/1XPxwJhp5DAV67T9ZPwFdovhBMIGUYoRBN4wim6S3eoXVEHXdLgmwY0x6BQnO4xPJ0Ar5OVxhQF0L9UslRM4yaQQfQImnBegi8vhY2A1k6YLlrj61TwDdNQnIISwiPvpD7TwYQTssZXK47vg8y9Gp2nxRcATkozOEmdCeObSt3IIo+xf/00IDRKAaZ89PBTkHqpkA5LagKeNZKlIhqX8RcQ95GHtdYA62Y6rOg5LLsOSnoyvk4V38hFhytef+V9/3DER1P48W89o1GxE9o5vns2Mk+F7yiftafEN4nhmUv9DKEeyqI0U+l0CQg+B//sZ5+6lOuqKaTgm0LH41RHw/CsLZRk4huiYxrvP2SNr1OSS+Dr1ulBMR+K9SqHa58Oec49VgL3mXHvDr7QfuM7LMNrH1/IS30Moe64SLYBuFVJ+MbnJY7L+GrVQkFcl4ISx/fEll4ZWnz18DpcSzUCX602LqD9svDLzmdaLkP28P1+VsJjsx/4hmh6x/gmm/i6pbrGneCL9iCOg0dQUvF1UwEdVvG19r2uTXxXLz0J37eLjfZoF++tTtPnU/cWp5e8n3An0m/G+U7qjiy4PpHyV16HKx5flCxAV/H9A88nUnZ7l7KN78SBxPcQgzLAepxEScU3l7pZ6fL2+Dot8fXECfj+QRoGYAwlAfBSPrXQXQri0Pd85NJKcVw8XUdt1LZapk7YRhO1RdpmFJwW8ozekYvx2/fjM5Hr5MfQ95HvcY2a/9hoNK4yEntL+dEuGseTdNmxIPqd5v2YRjeaX8pQ8IW2ohuP7+dTN87RMK4aitx8XPsH0r2oBqNRqrv7+gmjjY7uIr6TBxBfL2MlxNRKSVp8S5CTuGgHXxfkFvh69Pq3LD4pkkd2bdRvHaSNC3/l2sQXAccdlIS+lc57qhPJwxPybT7XSxnUrdqnXuHlJHS+mjZfJfUZR9s2FuQR+EQKdSi9Am8UTnsEvlYS+L6TFwW6kl74Vjr6AFHsX89rgg8njRltK0XPOL7NyDL0IurV4VtMwafB1709vu9X4OjWHoP3z1Ii7eaQdG00Lx5n8HXyDSva/dU0Pq2vZnKYxHYMYRo1WY5ov1G7Vh4r3y+kMdgbilxeOrV0aqOFenFl8GGJig7rG0bbPRqiSRpP2AL0w+yon9dHbi43zFetnKcuw9ZLeSa+7kTw/TDfuFu0Z7Vp/uhyHfPkAZ5ufP9wLIfD49E3clR818rR089Lzyy+VRREPneICnYLX9cT8PVKQs36TbQ3i6NcCwYkxEAQ3phN4CjAvC4mFr5vrlKe7AizBKj8cu33s7i9GbeY7BHYujTjjd3Bx54SSyT4m8mxOoYOAGX/DtwvnGE1M+5v5Bgt1hbkJRW9Cxv9X81GL2i5jqaoJ4avBcCsLYp+Ru+VC5sWPpFhXt8/EPvJL2F/alJDEeIjUhcrP5P45rDeATPj+wKl7gBf1fcq+HpVnfHO1vEf//UCHgt/OxfDE3onj5UkfTaThrg3NCGoBUCtZjvgMnwQB0bG5XENeraJ5XEWvtiHkqSVRqN+uQ4lEx2o+69SeY1dC++Wcsj+LCW+H0ZE4KtDWHkGwCtrxstbFqr51e9wbz42E2fpjRQsqEn50PnM4eumO9IbujCi393Hd+3q72TI+p9DPyyfraF+c3rOx0KJyB2z7Fa1yCO8HoHzlDFhPiWD8XoB3aPppRrUQdRp1D8qE9exdgr+Zbpqf8BLfmZ/bMYbh87k58VCSswCjQoLPPw4Jnp4uFi/YQlfKB5eBd/gr6aqB973zbDAF+v5PN+NZEvm+84bSkhxUPE9C9wqbeJ7Hi+gA9Jr5ZM7x9el4mulyK0Bb2xiMTj3/iBtK77Tnii27H/MlCfsjcJY+2oTg2/U4TYWQERE0r+aCouBcx5zEZzEYrqui8JXsQW/X8FLHJ3IVbWXhQV3zAJCjFQst1F25y1arlXwhRR4Bb4rZ3VPy5d+bHEtHIPF27K16ItYuKXM5kHD10M9DKFeSpbqLlOYAlRiC99yCiDmbUf0206jPPO7b/iud71avBkHf+kQP0OrWHBFrhmt75ZyPzbLg5KmWK9oH4Oq1eFZOm0c6n48mdfer46HcLUZU3pGB8R9IDBbJ+N7v1q0J2xhudZ45tcL8PN16vq9WizwtRLwFQtKER+NDypj4QQOdJNY3NC7GEsaGtiSmDsA+CZhyx+hXFHjYrgGGXpZNvDNpn5gWWuiWkUtyEB0UcrO8Y2L9KI9K+cXLmxqruGd6pcKfycj/ij3URVgu6bPUaycN1qXTHD+KoOmjGORnH57q8rh+e9sTHk5r1+7zpEXk36bp7iiXRrBW61e5k/D0fn+EXF/OxYEypFW3ZH1HzPt4Pv5PN2Rd7VJLDZeboGnbpSPwPDcBw5f6AIysadFOR9Hr7vksoFvE91jdbdYvzpYqyIvdQPU87uKL45u3u213CA8qkYPT6H1YgwIfkz7RI5xJdomfjoV4PXjfjgaRkNGhHwG1mNt1oq0y/j+SaZ5pV0LnrlG89Dl1YkmEsc3nKKzMKskJD+fx6NhlFiohdTe5EsZIig5WPgWUYCC9Dx5TG/sA5x15LCBbzXDtx/+uh74VmMZjLDamh8JvhzQtSsoeVTNNXB/Euv96LRR/qjO+By5xTxxJ683/FB00Pj0fZz9F2GPa70Ld2hbbVptWmjWabbGCl/ZAiTsbJa5hQ9OK/eWFE4xva9nG3z1zwCtnFXjYr6c3ykxPn9QiYWEWPhA4uuiDnzBpt4EMcg0QOm28M0gP76hJuELbIdZi4PqaILpJI+RYz4ZV42y+q49wBcxIbyXTmtXgevRWPl3MmjSSJU5vB3J0TA2Uu8mtP+R5/Au4iiF6NrUUiuCieOiJpnJq8gSXzwFLFiLP8X6bV0bYvzt8TXj75eLtKPRauY1RM1HR7GwEHpFbonIWAPwjxpfqJSCyBVUsk/DFOChhC18kyiPHFvwdVGh6XFbmfLx+RRi4jaqYiCnUDO1wc4u4ovo7pfS+XFD32e9GzndwxJiHcbQ/Vz6JrBMDGYyYK5l7YOsfkS2MVePfGkLsNXLGl9hIVbWXAv9fQ5i/j6UFL1RaQffB9qlwn3tS4WxMhaxETCMz6T9ZTqCk5FznoOKL9SEXMMIUwAZW6dNfCEVX61azdxwmIbg4aHdwtcj5KVBeNiqrb2+g5M8hTskSB6exHZ5bMEIF/wCoOT128zvdXziMLbvuDu/Usmh0oG7doMmafKNSmt8hQWUnmzhjJf/RskXCzQL8aYNfLG/QPGLY5KjKtcuNPGsyGytmj0/kPi6qdXwwJCPvOTYI3zTaICCNEh9FGSWM54OX4+A1UI80RV98czWKceJf65ervsleJm164/7ganACHHn+IPz8Nby1ptcnRztRWbipArvp4/gRchodbIFvsBSWPBaW+CHtzWfauFfcmnKRuyr+Fiu1WbzGKtCPWWMHjIgU1/Mgn2B74GKfbkajHwtVIHy3uBbh0Ocj9oplCC+kIJvYuKvI9bbkUUQ2+JaG7AeknwvhLd0YUxx+SZIf4XkGeqHUCNt9N8sQdvYlwtl9H4hMzqI5dHosMIX2taCl2s6LRowaubPyld/IgcvHBJPnKGnHDLh0ArfqzlYtkv5D8++4RsAvPbwTaJzgDcIDzxIRXuEbx4NIsYupjt7gi/6idL3j1AIqPY+OPH5PGO67x/jUS9NvF6hTte7x2kaCvtSZJiMlxjxMSqEtqXr3GPMn/9y4cXUypS/ymPxbIAvmurtYl9o7dqmBV9KdbLOgsik4B3d6xW/lO7w/kfe+yfx7bFuGkwY3/C6sURDj8584rCxJH5QtnYFVrFQVL35HNoQgO0jvt228XVRC4WQPLtANyiEzb1gD/BNoy5kHa5QEnUmiq/uG2fubeXh+kwuNj8IRxAoOqiLIqfTaNw84SfLWsDmqo08k30prHVKbHuYDo7ez6U7EsLX0oJX1ltV2AOg2KfoMPPA/sTx/ZPMqF9YiN11AsHLFrHgaAT3GBvw7hO+U9TH4bX10rgVx7YgMr0p7Pow4tL8XcY3l1kJMfVQmsA3fa/wFQh3JK9eivtV+tCaD4cUjdZvIRI9BfDUDd6PkkbfKhVbOJf/jUpuQcXXlgVNv68ejr4gTflk5AZ71+jR4AvEdPg6PDNpaz6a2AQm2otoWKvVS+LVTyL4OnaE7wSNUjfdpnZb+KbQdcA7Jr5ek0od8MD9dNjiN43t4etk1v0ITfyw6gS+Q4l5XwGwbXli+u/sj6pWGu9XfyYXx75d18+lf6t0tnau/pXKv8+xzorIkltn0l4r2dYCXlO8XDRbu9xw/9g/Zko2FXSFtKPxOxn3q+caluteK5lJsboXwVP/S27cPVz28X3i3/Ll/v8eDVMPDmzwvDbwddMt+NoROhq3yXcC4D7KpmTyA+XnqEzSFQrawDeLrsNemHrEL2+24r7NlENZUMa2vyxkH2DIs628e669ubdsR4VXC7C9u79eIVJtOwgdgO/dOICHGK6jQHaIwdXN4Lwt0LWHr4d6kX8tV+ozqAs+uYCSmO2w+jd4zGNeUYL4nqZxeN5WKVgooSAClmEaYhqhdit89QC7niSbCEM2sdkBuHYxQg9ri5ZjkuhI6DMP+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),o=n.getScissor(prevScissor),s=n.getScissorTest(),u=n.autoClear,l=o.x+imageOffset[0]/3,c=o.y+imageOffset[1]/3,f=imageSize[0]/3,p=imageSize[1]/3;n.setViewport(l,c,f,p),n.setScissor(l,c,f,p),n.setScissorTest(!0),n.autoClear=!1,n.render(scene,camera),n.setViewport(r),n.setScissor(o),n.setScissorTest(s),n.autoClear=u}else{var t=new THREE__namespace.Texture,e=new Image;e.onload=function(){t.image=e,t.wrapS=THREE__namespace.ClampToEdgeWrapping,t.wrapT=THREE__namespace.ClampToEdgeWrapping,t.minFilter=THREE__namespace.LinearFilter,t.needsUpdate=!0,t.generateMipmaps=!1,material.needsUpdate=!0,e.onload=noop},e.src=textureURL,material.map=t}}var DEFAULT_MODE_CHANGE_DURATION=1e3,DEFAULT_CAMERA_FOV=90,DEFAULT_REQUEST_PROXY=function(n){return n.replace("//vrlab-public.ljcdn.com/","//vr-public.realsee-cdn.cn/").replace("//vrlab-image4.ljcdn.com/","//vr-image-4.realsee-cdn.cn/").replace("//vrlab-image3.ljcdn.com/","//vr-image-3.realsee-cdn.cn/").replace("//vrlab-image2.ljcdn.com/","//vr-image-2.realsee-cdn.cn/").replace("//vrlab-image1.ljcdn.com/","//vr-image-1.realsee-cdn.cn/")},scratchSphere=new THREE__namespace.Sphere,scratchBox3=new THREE__namespace.Box3,scratchViewport=new THREE__namespace.Vector4,scratchScissor=new THREE__namespace.Vector4,scratchClearColor=new THREE__namespace.Color,scratchRenderSize=new THREE__namespace.Vector2,worksMap=new WeakMap,emptyWorks=createWorks([parseWork(null)]),Five_Instances={},Five=(function(n){__extends(t,n);function t(e){e===void 0&&(e={});var r,o,s,u,l,c,f,p,d,h,g,m=n.call(this)||this;if(m.fiveId=createUuid(),Five_Instances[m.fiveId]=m,m.currentUpdateArgs={time:now(),args:[]},m.currentMode="Panorama",m.pano={workCode:"",panoIndex:0},m.needsRender=!1,m.onlyRenderIfNeeds=(r=e.onlyRenderIfNeeds)!==null&&r!==void 0?r:!0,m.imageOptions=__assign({},(o=e.imageOptions)!==null&&o!==void 0?o:{}),m.textureOptions=__assign({},(s=e.textureOptions)!==null&&s!==void 0?s:{}),m.poweredByRealsee=(u=e.poweredByRealsee)!==null&&u!==void 0?u:!0,m.backgroundColor=new THREE__namespace.Color((l=e.backgroundColor)!==null&&l!==void 0?l:1579548),m.backgroundAlpha=(c=e.backgroundAlpha)!==null&&c!==void 0?c:1,m.extraElements=[],m.controllerInits={Panorama:Object.assign({},e.panorama),Model:Object.assign({},e.model),Floorplan:Object.assign({},e.floorplan),Topview:Object.assign({},e.topview),Mapview:Object.assign({},e.mapview),VRPanorama:Object.assign({},e.vrPanorama),XRPanorama:Object.assign({},e.xrPanorama)},m.fps={testCount:0,testTime:now()},m.modeChangeDuration=(f=e.modeChangeDuration)!==null&&f!==void 0?f:DEFAULT_MODE_CHANGE_DURATION,m.enableWheel=(p=e.enableWheel)!==null&&p!==void 0?p:!0,typeof window!="undefined")if("renderer"in e)e.renderer instanceof InternalWebGLRenderer&&m.throwError(new Error("cannot render a internal renderer")),m.renderer=e.renderer;else try{m.renderer=new InternalWebGLRenderer({preserveDrawingBuffer:e.preserveDrawingBuffer,antialias:e.antialias,webgl2:e.webgl2,logarithmicDepthBuffer:e.logarithmicDepthBuffer,precision:e.precision,powerPreference:e.powerPreference});var E=getViewportScale();m.renderer.setPixelRatio(E===1?window.devicePixelRatio:1),m.renderer.setSize(512,512),m.renderer.setClearColor(m.backgroundColor,m.backgroundAlpha)}catch(M){var y=M instanceof Error?M:new Error(String(M));m.throwError(y)}m.getPixelsRenderTarget=new THREE__namespace.WebGLRenderTarget(1,1,{encoding:(h=(d=m.renderer)===null||d===void 0?void 0:d.outputEncoding)!==null&&h!==void 0?h:THREE__namespace.sRGBEncoding,generateMipmaps:!1}),m.viewport=Object.assign({left:0,bottom:0,width:1,height:1},e.viewport),m.camera=new Camera(DEFAULT_CAMERA_FOV),m.scene=new Scene,m.xrCustomObjectsScene=new THREE__namespace.Scene,m.scene.add(m.xrCustomObjectsScene),m.scene.matrixAutoUpdate=!1,m.loadWorkTask=Promise.resolve(),m.requestProxy=(g=e.requestProxy)!==null&&g!==void 0?g:DEFAULT_REQUEST_PROXY,m.networkSubscribe=new NetworkSubscribe,m.networkSubscribe.on("network",function(M,B,L,O){var k;m.emit("network.resource",createEvent("network.resource",{source:M,requestType:B,requestState:L,detail:O})),(k=m.analysis)===null||k===void 0||k.network(m.works,M,B,L,O)}),m.readyCallbacks=[],m.syncingState=!1,m.helperGroup=new THREE__namespace.Group,m.helperGroup.name="helper",m.helperGroup.matrixAutoUpdate=!1,m.scene.add(m.helperGroup),worksMap.set(m,emptyWorks),m.modelScene=new ModelScene({fiveId:m.fiveId}),m.modelScene.addEventListener("model.create",function(M){m.bindModel(M.model)}),m.scene.add(m.modelScene);var v=m.modelScene.setModels(emptyWorks,{forceReplaceImmediately:!0})[0];defineProperty(v,"loaded",{get:function(){return!1},set:function(M){}}),m.videoTexture=new THREE__namespace.VideoTexture(e.videoInstance||generateDefaultVideoElement());var A=initLights();m.scene.add(A),m.state={mode:m.currentMode,workCode:m.pano.workCode,panoIndex:m.pano.panoIndex,longitude:m.camera.pose.longitude,latitude:m.camera.pose.latitude,fov:m.camera.pose.fov,offset:m.camera.pose.offset.clone(),distance:m.camera.pose.distance},m.stateSynced=!1,m.destroyed=!1,m.paused=!0,typeof window!="undefined"&&(e.play!==!1&&m.play(),m.stopAnimationLoop=AnimationFrameLoop.shared.add(function(M,B){for(var L=[],O=2;O<arguments.length;O++)L[O-2]=arguments[O];m.updateTime.apply(m,__spreadArray([M,B],L,!1))},!1,0,10));var b=function(){typeof document!="undefined"&&document.fullscreenElement===null&&m.currentMode==="VRPanorama"&&m.controller.emit("vr.requestExit",createEvent("vr.requestExit",{}))},T=function(){m.needsRender=!0};if(typeof document!="undefined"&&document.addEventListener("fullscreenchange",b,!1),m.renderer&&m.renderer.domElement.addEventListener("webglcontextrestored",T,!1),m.removeEventListeners=function(){typeof document!="undefined"&&document.removeEventListener("fullscreenchange",b,!1),m.renderer&&m.renderer.domElement.removeEventListener("webglcontextrestored",T,!1)},m.plugins={},e.plugins&&e.plugins.length)for(var _=0,S=e.plugins;_<S.length;_++){var w=S[_];if(typeof w=="function")w(m);else if(Array.isArray(w)){var R=w[0],I=w[1],H=w[2];if(typeof R=="function"){var C=R(m,H);typeof I=="string"&&(m.plugins[I]?m.throwError(new Error("plugin name ".concat(I," is exists."))):m.plugins[I]=C)}}}return initLegacyEvent(m),m.fiveRenderer=new FiveRenderer,m.adaptiveLuminancePass=new AdaptiveLuminancePass,m.adaptiveLuminancePass.enabled=!1,m.fiveRenderer.composer.addPass(m.adaptiveLuminancePass),m.eyeDomeLightingPass=new EyeDomeLightingPass(m.camera),m.eyeDomeLightingPass.enabled=!1,m.fiveRenderer.composer.addPass(m.eyeDomeLightingPass),m}return Object.defineProperty(t,"version",{get:function(){return"6.7.0-alpha.34"},enumerable:!1,configurable:!0}),Object.defineProperty(t,"dracoPath",{get:function(){return draco.decoderPath},set:function(e){draco.setDecoderPath(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t,"ktx2Path",{get:function(){return ktx2.transcoderPath},set:function(e){ktx2.setTranscoderPath(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t,"useNativeImageBitmap",{get:function(){return canUseNativeImageBitmap()},set:function(e){useNativeImageBitmap(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"ident",{get:function(){return this.fiveId},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"panoIndex",{get:function(){return this.pano.panoIndex},enumerable:!1,configurable:!0}),t.prototype.dispose=function(){var e;if(this.destroyed!==!0){delete Five_Instances[this.fiveId],this.emit("dispose"),this.destroyed=!0,this.pause(),this.stopAnimationLoop&&(this.stopAnimationLoop(),this.stopAnimationLoop=void 0),this.off(),this.networkSubscribe.off(),this.controller&&(this.controller.destroy(),this.controller=void 0);var r=this.getElement();r&&r.parentNode&&r.parentNode.removeChild(r);var o=this.modelScene.parameter;o.pano0&&o.pano0.map.dispose(),o.pano1&&o.pano1.map!==((e=o.pano0)===null||e===void 0?void 0:e.map)&&o.pano1.map.dispose(),o.reset("pano0","pano1"),this.modelScene.dispose(),this.scene.dispose(),this.xrCustomObjectsScene.dispose(),worksMap.set(this,emptyWorks),this.renderer&&this.renderer.render(new THREE__namespace.Scene,new THREE__namespace.Camera),this.fiveRenderer.dispose(),this.renderer instanceof InternalWebGLRenderer&&(this.renderer.forceContextLoss&&this.renderer.forceContextLoss(),this.renderer.dispose())}},t.prototype.setViewport=function(e){Object.assign(this.viewport,e),this.needsRender=!0},Object.defineProperty(t.prototype,"boundingMesh",{get:function(){return this.modelScene.boundingMesh},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"helperVisible",{get:function(){return this.helperGroup.visible},set:function(e){this.helperGroup.visible!==e&&(this.helperGroup.visible=e,this.emit("helpers.visible",createEvent("helpers.visible",{object:this.helperGroup})),this.needsRender=!0)},enumerable:!1,configurable:!0}),t.prototype.updateConfiguration=function(e,r){r===void 0&&(r=!0);var o=!1,s=!1;if(e.panorama&&(Object.assign(this.controllerInits.Panorama,omitUndefinedFields(e.panorama)),this.currentMode==="Panorama"&&(o=!0)),e.model&&(Object.assign(this.controllerInits.Model,omitUndefinedFields(e.model)),this.currentMode==="Model"&&(o=!0)),e.floorplan&&(Object.assign(this.controllerInits.Floorplan,omitUndefinedFields(e.floorplan)),this.currentMode==="Floorplan"&&(o=!0)),e.topview&&(Object.assign(this.controllerInits.Topview,omitUndefinedFields(e.topview)),this.currentMode==="Topview"&&(o=!0)),e.mapview&&(Object.assign(this.controllerInits.Mapview,omitUndefinedFields(e.mapview)),this.currentMode==="Mapview"&&(o=!0)),e.vrPanorama&&(Object.assign(this.controllerInits.VRPanorama,omitUndefinedFields(e.vrPanorama)),this.currentMode==="VRPanorama"&&(o=!0)),e.imageOptions&&(Object.assign(this.imageOptions,e.imageOptions),(this.currentMode==="Panorama"||this.currentMode==="VRPanorama")&&(s=!0,o=!0)),e.textureOptions&&Object.assign(this.textureOptions,e.textureOptions),r&&o&&this.controller&&this.currentMode){var u=this.controller.updateConfiguration(this.controllerInits[this.currentMode]);(!u||s)&&this.changeMode(this.currentMode,this.getCurrentState(),0,!1,!0)}},t.prototype.appendTo=function(e,r){if(r===void 0&&(r={}),!!this.renderer){if(!(this.renderer instanceof InternalWebGLRenderer)){this.throwError(new Error("cannot call appendTo method when render a external renderer"));return}var o=this.getElement();if(o){e.appendChild(o),this.refresh(r);var s=window.getComputedStyle(e).position;s!=="relative"&&s!=="absolute"&&s!=="fixed"&&s!=="sticky"&&(e.style.position="relative")}}},t.prototype.refresh=function(e,r){var o,s,u;if(e===void 0&&(e={}),!!this.renderer){var l=this.renderer.domElement,c=l.parentNode,f=e.width,p=f===void 0?(o=c==null?void 0:c.offsetWidth)!==null&&o!==void 0?o:512:f,d=e.height,h=d===void 0?(s=c==null?void 0:c.offsetHeight)!==null&&s!==void 0?s:512:d;if(p=Math.max(1,p),h=Math.max(1,h),!r){var g=getViewportScale(),m=typeof window!="undefined"?window.devicePixelRatio:1;if(r=(u=g===1?m:1)!==null&&u!==void 0?u:1,r>1){var E=Math.max(p,h)*r,y=Math.min(this.renderer.capabilities.maxTextureSize,4096);E>y&&(r=Math.max(r/E*y,1),r=Math.floor(r*100)/100)}}this.renderer.setPixelRatio(r),this.renderer.setSize(p,h),this.needsRender=!0;var v=now(),A=v-this.currentUpdateArgs.time,b=this.currentUpdateArgs.args;this.updateTime.apply(this,__spreadArray([v,A],b,!1))}},t.prototype.addExtraElement=function(e){var r=this;return this.extraElements.indexOf(e)===-1&&(this.extraElements.push(e),this.controller&&this.controller.bindExtraElement(e)),function(){return r.removeExtraElement(e)}},t.prototype.removeExtraElement=function(e){var r=this.extraElements.indexOf(e);r!==-1&&(this.extraElements.splice(r,1),this.controller&&this.controller.unbindExtraElement(e))},t.prototype.getSize=function(e){if(!this.renderer)throw new Error("renderer is not initialized");return this.renderer.getSize(e),e.x*=this.viewport.width,e.y*=this.viewport.height,e},t.prototype.getDrawingBufferSize=function(e){if(!this.renderer)throw new Error("renderer is not initialized");return this.renderer.getDrawingBufferSize(e),e.x*=this.viewport.width,e.y*=this.viewport.height,e},t.prototype.updateCamera=function(e,r,o){if(o===void 0&&(o=!0),!this.controller)throw new Error("controller is not initialized.");return this.controller.updateCamera(e,r,o)},t.prototype.updateCameraWithKeyframes=function(e,r,o){if(o===void 0&&(o=!0),!this.controller)throw new Error("controller is not initialized.");return this.controller.updateCameraWithKeyframes(e,r,o)},Object.defineProperty(t.prototype,"works",{get:function(){var e=worksMap.get(this);return e||emptyWorks},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"work",{get:function(){return this.works[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"observers",{get:function(){return this.work.observers},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"models",{get:function(){return this.modelScene.models},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"model",{get:function(){return this.modelScene.models[0]},enumerable:!1,configurable:!0}),t.prototype.load=function(e,r,o,s){var u=this;if(s===void 0&&(s=!0),!this.renderer)throw new Error("renderer is not initialized");var l=this.loadWorkTask.then(function(){return isPromise(e)?e.then(function(c){return u.load_(c,r,o,s)}):u.load_(e,r,o,s)});return this.loadWorkTask=l.catch(function(c){u.throwError(c)}),l},t.prototype.load_=function(e,r,o,s){var u=this,l,c,f,p,d,h,g,m,E,y;s===void 0&&(s=!0);var v={};typeof o=="number"?v.duration=o:typeof o=="object"&&Object.assign(v,o),this.works===emptyWorks&&(v.duration===void 0&&(v.duration=0),v.effect===void 0&&(v.effect="instant"));var A={};Object.assign(A,v.model),!A["3d-tiles"]&&v["3d-tiles"]&&(A["3d-tiles"]=v["3d-tiles"]),!A.textureOptions&&v.textureOptions&&(A.textureOptions=v.textureOptions),!A.textureOptions&&this.textureOptions&&(A.textureOptions=this.textureOptions);var b=[];if(Array.isArray(e))for(var T=0,_=e;T<_.length;T++){var S=_[T];S instanceof Work?b.push(S):typeof S!="string"&&"work"in S?b.push(parseWork(S.work,S)):b.push(parseWork(S))}else e instanceof Work?b.push(e):b.push(parseWork(e));v.mode==="add"&&(b=[].concat(this.works,b));var w;try{w=createWorks(b)}catch(Z){return this.throwError(Z),Promise.reject(Z)}for(var R=0,I=w;R<I.length;R++){var H=I[R];this.bindWorkFetcher(H)}r===void 0&&(r="inherit"),r==="inherit"&&this.works===emptyWorks&&(r="initial");var C=this.currentMode,M=w.initial,B=M.work.observers[0],L=B?{workCode:B.work.workCode,panoIndex:B.panoIndex}:{workCode:M.work.workCode,panoIndex:0},O=(l=M.mode)!==null&&l!==void 0?l:B?"Panorama":"Mapview",k={};if(r==="inherit"){var D=this.getCurrentState(),q=w.filter(function(Z){return Z.workCode===D.workCode})[0];if(q)L={workCode:D.workCode,panoIndex:D.panoIndex},O=D.mode,k={longitude:D.latitude,latitude:D.latitude,fov:D.fov,distance:D.distance,offset:D.offset.clone()};else{r={mode:C};var z=(f=(c=w[0])===null||c===void 0?void 0:c.observers)===null||f===void 0?void 0:f[this.panoIndex];z?(r.workCode=z.work.workCode,r.panoIndex=z.panoIndex):typeof w.initial.panoIndex=="number"?(r.workCode=w.initial.work.workCode,r.panoIndex=w.initial.panoIndex):(r.mode==="Panorama"||r.mode==="VRPanorama"||r.mode==="XRPanorama")&&(r.mode="Mapview"),r.mode===C&&(r.longitude=this.camera.pose.longitude,r.latitude=this.camera.pose.latitude,r.fov=this.camera.pose.fov)}}if(r==="initial"&&(typeof M.panoIndex=="number"&&(L={workCode:M.work.workCode,panoIndex:M.panoIndex}),M.mode&&(O=M.mode),k={longitude:M.longitude,latitude:M.latitude,fov:M.fov,distance:M.distance,offset:(p=M.offset)===null||p===void 0?void 0:p.clone()}),typeof r=="object"){if(O=(d=r.mode)!==null&&d!==void 0?d:C,typeof r.panoIndex=="number"){var z=w.getObserver({workCode:(g=(h=r.workCode)!==null&&h!==void 0?h:M.work.workCode)!==null&&g!==void 0?g:"",panoIndex:r.panoIndex});z&&(L={workCode:z.work.workCode,panoIndex:z.panoIndex})}k={longitude:r.longitude,latitude:r.latitude,fov:r.fov,distance:r.distance,offset:r.offset?new THREE__namespace.Vector3().copy(r.offset):void 0}}var J=(m=v.duration)!==null&&m!==void 0?m:this.modeChangeDuration;(O==="Floorplan"||O==="Topview"||O==="Mapview")&&C===O&&(J=0);var V="fly";(O==="Panorama"||O==="VRPanorama"||O==="XRPanorama")&&C===O&&(V=(E=v.effect)!==null&&E!==void 0?E:"fade"),this.emit("works.request",createEvent("works.request",{input:e,works:w,userAction:s}));var U=function(Z,X,se){var G=u.getCurrentState(),W=__assign(__assign({mode:Z},X),se);r==="inherit"&&(W=u.getCurrentState()),u.pano=X;var $=__assign(__assign({initial:{state:W,currentState:G,duration:J,effect:V,userAction:s}},u.commonParams()),u.controllerInits[Z]),ne=Controllers[W.mode].initAnimationEndState($);if(u.controller&&C===Z)u.controller.updateWork(w,ne,{effect:V,duration:J},s)===!1&&(u.controller.destroy(),u.controller=u.applyController(Z,$));else{if(u.controller)u.controller.destroy();else{var te=Controllers[Z].initAnimationEndState($);u.camera.setFromPose(te),u.emit("camera.update",createEvent("camera.update",{state:u.getCurrentState(),userAction:s}))}u.controller=u.applyController(Z,$);var ve=createEvent("mode.change",{prevMode:C,mode:Z,state:ne,userAction:s});try{u.emit("mode.change",ve)}catch(oe){console.error(oe)}}u.updateTime.apply(u,__spreadArray([u.currentUpdateArgs.time,0],u.currentUpdateArgs.args,!1))};worksMap.set(this,w);var j=Promise.resolve();if(O===t.Mode.Floorplan||O===t.Mode.Topview||O===t.Mode.Mapview||O===t.Mode.Model){this.modelScene.loaded===!1&&(this.camera.setFromPose(k),assignPose(this.state,this.camera.pose));var K=this.modelScene.setModels(w,A);j=Promise.all(K.map(function(Z){return Z.loadedReady})).then(function(){u.needsRender=!0,U(O,L,k),u.emit("camera.update",createEvent("camera.update",{state:u.getCurrentState(),userAction:s}))})}else{U(O,L,k);var ae=this.controller,re=!1;this.modelScene.autoRefine=!1;var ee=function(){u.works===w&&re===!1&&(u.needsRender=!0,u.emit("camera.update",createEvent("camera.update",{state:u.getCurrentState(),userAction:s})),re=!0,u.modelScene.autoRefine=!0),ae.off("pano.arrived",ee),ae.off("pano.cancel",ee)},K=this.modelScene.setModels(w,A);j=Promise.all(K.map(function(X){return X.initReady})).then(noop),ae.once("pano.arrived",ee),ae.once("pano.cancel",ee),setTimeout(ee,((y=v.duration)!==null&&y!==void 0?y:this.modeChangeDuration)+1e3)}return this.emit("works.load",createEvent("works.load",{input:e,userAction:s,works:w})),j.then(function(){return u.ready()}).then(function(){var Z;u.emit("works.ready",createEvent("works.ready",{input:e,userAction:s,works:w})),(Z=u.analysis)===null||Z===void 0||Z.work(w)})},t.prototype.reset=function(){var e=this,r=this.loadWorkTask.then(function(){return e.reset_()});return this.loadWorkTask=r.catch(function(o){e.throwError(o)}),r},t.prototype.reset_=function(){var e=this;return new Promise(function(r){var o;e.controller&&(e.controller.destroy(),e.controller=void 0);var s=e.modelScene.parameter;s.pano0&&s.pano0.map.dispose(),s.pano1&&s.pano1.map!==((o=s.pano0)===null||o===void 0?void 0:o.map)&&s.pano1.map.dispose(),s.set({pano0:null,pano1:null,modelAlpha:1}),worksMap.set(e,emptyWorks),e.modelScene.setModels(emptyWorks,{forceReplaceImmediately:!0}),e.renderer&&e.modelScene.update(e.renderer,e.camera),e.needsRender=!0,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.camera.needsRender=!1,e.needsRender=!1,r()})},t.prototype.changeMode=function(e,r,o,s,u){var l=this;return r===void 0&&(r={}),s===void 0&&(s=!0),u===void 0&&(u=!1),new Promise(function(c,f){var p,d,h,g;if(!l.renderer)throw new Error("renderer is not initialized.");r=__assign({},r);var m=0;l.controller&&(typeof o=="number"?m=o:m=(p=o==null?void 0:o.duration)!==null&&p!==void 0?p:l.modeChangeDuration);var E="fly";l.controller&&typeof o=="object"&&o.effect&&(E=o.effect);var y=typeof r.panoIndex=="number"?{workCode:(g=(d=r.workCode)!==null&&d!==void 0?d:(h=l.work)===null||h===void 0?void 0:h.workCode)!==null&&g!==void 0?g:"",panoIndex:r.panoIndex}:l.pano;if(!t.Mode.hasOwnProperty(e)){var v=new Error('mode "'.concat(e,'" is not existed'));l.throwError(v),f(v);return}if((e===t.Mode.Panorama||e===t.Mode.VRPanorama||e===t.Mode.XRPanorama)&&!l.works.getObserver(y)){var v=new Error("PanoId ".concat(panoStringify(y)," not existed."));l.throwError(v),f(v);return}(e===t.Mode.Floorplan||e===t.Mode.Topview||e===t.Mode.Mapview||e===t.Mode.Model)&&l.modelScene.empty&&(m=0);var A=l.controller,b=l.currentMode,T=function(){if(l.controller&&l.controller.stopMomentumMovement(),l.controller&&u===!1&&b===e)e===t.Mode.Panorama||e===t.Mode.Model||e===t.Mode.VRPanorama||e===t.Mode.XRPanorama?!panoEqual(l.pano,y)&&"moveToPano"in l.controller&&typeof l.controller.moveToPano=="function"?l.controller.moveToPano(y,__assign({duration:m},r),s):l.controller.updateCamera(r,m,s).catch(noop):(panoEqual(l.pano,y)||(l.pano=y),l.controller.updateCamera(r,m,s).catch(noop));else{var S=__assign(__assign({},r),y),w=__assign(__assign({initial:{state:S,currentState:l.getCurrentState(),duration:m,effect:E,userAction:s}},l.commonParams()),l.controllerInits[e]),R=Controllers[e].initAnimationEndState(w),I=createEvent("mode.change.request",{prevMode:l.currentMode,mode:e,state:R,userAction:s});if(l.emit("mode.change.request",I),!I.defaultPrevented){A&&A.destroy(),l.controller=l.applyController(e,w);var H=createEvent("mode.change",{prevMode:l.currentMode,mode:e,state:R,userAction:s});l.emit("mode.change",H)}}c()},_=AnimationFrameLoop.shared.getContext();_&&(typeof XRSession!="undefined"&&_ instanceof XRSession&&_.end(),AnimationFrameLoop.shared.setContext(null)),e===t.Mode.VRPanorama?(l.requestFullscreen(),requestDeviceOrientationPermission().then(function(){return T()}).catch(function(S){var w=S instanceof Error?S:new Error(String(S));l.exitFullscreen(),l.throwError(w),f(w)})):e===t.Mode.XRPanorama?requestXRSessionPermission().then(function(S){AnimationFrameLoop.shared.setContext(S),u=!0,T()}).catch(function(S){var w=S instanceof Error?S:new Error(String(S));l.throwError(w),f(w)}):T()})},t.prototype.getPixels=function(e,r,o,s,u,l,c){if(!this.renderer)throw new Error("renderer is not initialized.");var f=now(),p=this.renderer.getPixelRatio(),d=this.renderer.getRenderTarget(),h=this.getSize(new THREE__namespace.Vector2),g=0,m=0,E=1,y=1,v,A,b,T,_;typeof e=="number"?(g=e,typeof r=="number"&&(m=r),typeof o=="number"&&(E=o),typeof s=="number"&&(y=s),v=u,A=l,_=c):(g=e.x,m=e.y,E=e.width,y=e.height,v=e.pixelRatio,A=e.flipY,b=e.helperVisible,T=e.skipPanorama,_=e.buffer),g=Math.floor(g),m=Math.floor(m),E=Math.floor(E),y=Math.floor(y),v=Math.floor(v!=null?v:p),A=A!=null?A:!1;var S=this.helperVisible,w=this.modelScene.parameter.modelAlpha;this.helperVisible=b!=null?b:this.helperVisible,T&&(this.controller instanceof Controllers.Panorama||this.controller instanceof Controllers.VRPanorama||this.controller instanceof Controllers.XRPanorama)&&T===!0&&this.modelScene.parameter.set("modelAlpha",1),this.modelScene.update(this.renderer,this.camera);var R=this.getPixelsRenderTarget;R.setSize(E*v,y*v),this.renderer.setRenderTarget(R),this.camera.pixelRatio=v,this.camera.resolution.set(E,y),this.camera.setViewOffset(h.width,h.height,g,h.height-m-y,E,y),this.camera.aspect=h.width/h.height,this.camera.updateTime(f),this.scene.update(this.renderer,this.camera);var I=this.renderer.autoClear,H=this.renderer.autoClearColor,C=this.renderer.autoClearDepth,M=this.renderer.autoClearStencil,B=scratchClearColor.copy(this.renderer.getClearColor()),L=this.renderer.getClearAlpha(),O=this.renderer.getScissorTest();this.renderer.autoClear=!0,this.renderer.autoClearColor=!0,this.renderer.autoClearDepth=!0,this.renderer.autoClearStencil=!0,this.renderer.setScissorTest(!1);var k=this.scene.background;this.scene.background=this.camera.isOrthographicCamera?null:k,this.renderer.render(this.scene,this.camera),this.scene.background=k,this.renderer.autoClear=I,this.renderer.autoClearColor=H,this.renderer.autoClearDepth=C,this.renderer.autoClearStencil=M,this.renderer.setClearColor(B,L),this.renderer.setScissorTest(O),this.helperVisible=S,w===void 0?this.modelScene.parameter.reset("modelAlpha"):this.modelScene.parameter.set("modelAlpha",w),this.renderer.setRenderTarget(d),this.camera.clearViewOffset(),this.camera.pixelRatio=p,this.camera.resolution.copy(h),this.camera.aspect=this.camera.resolution.width/this.camera.resolution.height,this.camera.updateTime(f),this.modelScene.update(this.renderer,this.camera),this.scene.update(this.renderer,this.camera);var D=E*v,q=y*v,z=D*q,J=z*4;if(_){if(_.length!==J)throw new Error("buffer length is not equals pixels ".concat(J))}else _=new Uint8Array(J);if(this.renderer.readRenderTargetPixels(R,0,0,E*v,y*v,_),A)for(var V=z/2,U=0,j=0,K=0,ae=0;j<V;j++)for(ae=(q-Math.floor(j/D)-1)*D+j%D,K=0;K<4;K++)U=_[j*4+K],_[j*4+K]=_[ae*4+K],_[ae*4+K]=U;return _},t.prototype.getElement=function(){var e;return(e=this.renderer)===null||e===void 0?void 0:e.domElement},t.prototype.render=function(e){var r=this.renderer;if(r){var o=r.getRenderTarget();r.setRenderTarget(null);var s=r.autoClear,u=r.autoClearColor,l=r.autoClearDepth,c=r.autoClearStencil,f=scratchClearColor.copy(r.getClearColor()),p=r.getClearAlpha(),d=r.getViewport(scratchViewport),h=r.getScissor(scratchScissor),g=r.getScissorTest();r.autoClear=!0,r.autoClearColor=!0,r.autoClearDepth=!0,r.autoClearStencil=!0;var m=r.getSize(scratchRenderSize),E=Math.floor(m.x*this.viewport.left),y=Math.floor(m.y*this.viewport.bottom),v=Math.floor(m.x*this.viewport.width),A=Math.floor(m.y*this.viewport.height);r.setClearColor(this.backgroundColor,this.backgroundAlpha),r.setViewport(E,y,v,A),r.setScissor(E,y,v,A);var b=this.viewport.bottom!==0||this.viewport.left!==0||this.viewport.width!==1||this.viewport.height!==1;r.setScissorTest(b);var T=this.scene.background;this.scene.background=this.camera.isOrthographicCamera?null:T;var _=!0;if(this.controller){var S=this.controller.render();S&&(_=!1)}if(_){var w=this.fiveRenderer.render(r,this.scene,this.modelScene,this.camera,this.needsRender);this.poweredByRealsee&&w&&renderPoweredByRealsee(r)}this.scene.background=T,r.autoClear=s,r.autoClearColor=u,r.autoClearDepth=l,r.autoClearStencil=c,r.setClearColor(f,p),r.setViewport(d),r.setScissor(h),r.setScissorTest(g),r.setRenderTarget(o),e&&AnimationFrameLoop.shared.add(e,!0)}},t.prototype.updateTime=function(e,r){for(var o,s=this,u=[],l=2;l<arguments.length;l++)u[l-2]=arguments[l];if(this.currentUpdateArgs={time:e,args:u},!this.destroyed){if(this.renderer&&ktx2.detectSupport(this.renderer),this.syncingState=this.syncState(e,r),this.controller&&(o=this.controller).updateTime.apply(o,__spreadArray([e,r],u,!1)),this.renderer&&(this.camera.pixelRatio=this.renderer.getPixelRatio(),this.getSize(this.camera.resolution),this.camera.aspect=this.camera.resolution.width/this.camera.resolution.height),this.camera.controllerMode=this.currentMode,this.camera.updateTime(e),this.renderer){var c=this.modelScene.loaded,f=this.modelScene.refined;this.modelScene.update(this.renderer,this.camera),c===!1&&this.modelScene.loaded===!0&&(this.controller&&this.controller.updateModel(this.modelScene),AnimationFrameLoop.shared.add(function(){s.emit("models.load",createEvent("models.load",{modelScene:s.modelScene}))},!0,0,10)),f===!1&&this.modelScene.refined===!0&&AnimationFrameLoop.shared.add(function(){s.emit("models.refined",createEvent("models.refined",{modelScene:s.modelScene}))},!0,0,10)}if(this.camera.autoNearFar){scratchBox3.makeEmpty(),scratchBox3.expandByObject(this.modelScene.boundingMesh);var p=scratchBox3.getBoundingSphere(scratchSphere),d=p.radius*2;p.containsPoint(this.camera.position)||(d=this.camera.position.distanceTo(p.center)+p.radius),d=clamp$1(d,800);var h=d/1e4;h=clamp$1(h,.03,.1),this.camera.near!==h&&(this.camera.near=h),this.camera.far!==d&&(this.camera.far=d),this.camera.updateTime(e)}if(this.renderer){var g=this.modelScene.visible;this.modelScene.visible=!1,this.scene.update(this.renderer,this.camera),this.modelScene.visible=g}if(this.syncingState=!1,this.controller&&this.controller.needsRender===!0&&(this.controller.needsRender=!1,this.needsRender=!0),this.camera.needsRender===!0&&(this.camera.needsRender=!1,this.needsRender=!0),this.modelScene.needsRender===!0&&(this.modelScene.needsRender=!1,this.needsRender=!0),this.scene.needsRender===!0&&(this.scene.needsRender=!1,this.needsRender=!0),this.onlyRenderIfNeeds!==!0&&(this.needsRender=!0),this.paused!==!0){var m=createEvent("render.prepare",{needsRender:this.needsRender});this.emit("render.prepare",m),m.defaultPrevented&&(this.needsRender=!1);var E=this.needsRender;this.render(),this.needsRender=!1,this.emit("render",createEvent("render",{needsRender:E})),this.hasListener("fps")&&(this.fps.testTime&&e-this.fps.testTime<1e3?this.fps.testCount++:(this.emit("fps",this.fps.testCount),this.fps.testTime=e,this.fps.testCount=0))}}},t.prototype.pause=function(){this.paused=!0,this.renderer&&this.renderer instanceof InternalWebGLRenderer&&this.renderer.clear(!0,!0,!0)},t.prototype.play=function(){this.needsRender=!0,this.paused=!1},t.prototype.moveToPano=function(e,r,o){r===void 0&&(r={}),o===void 0&&(o=!0);var s=this,u=s.controller,l=s.renderer;if(!u)return this.throwError(new Error("controller is not initialized.")),Promise.resolve();if(!l)return this.throwError(new Error("renderer is not initialized.")),Promise.resolve();typeof e=="number"&&this.pano.workCode&&(e={workCode:this.pano.workCode,panoIndex:e});var c=this.works.getObserver(e);if(!c)return this.throwError(new Error("pano ".concat(JSON.stringify(e)," not existed."))),Promise.resolve();var f={workCode:c.work.workCode,panoIndex:c.panoIndex};return"moveToPano"in u&&typeof u.moveToPano=="function"?u.moveToPano(f,r,o):c&&(this.pano=f,this.once("initAnimation.start",function(p){r.moveStartCallback&&r.moveStartCallback(p.state)}),this.once("initAnimation.end",function(p){r.moveEndCallback&&r.moveEndCallback(p.state)}),this.changeMode(t.Mode.Panorama,r,{effect:r.effect},o)),this.ready()},t.prototype.preloadPano=function(e,r){var o=this;r===void 0&&(r=noop);var s=this.works.getObserver(e);if(!s)return Promise.reject(new Error("Pano ".concat(JSON.stringify(e)," never found")));var u=["right","left","up","down","front","back"],l=now();return Promise.all(u.map(function(c){var f=panoStringify({panoIndex:s.panoIndex,workCode:s.work.workCode}),p=__assign({key:"pano.".concat(f,".").concat(c)},pick(o.imageOptions,["size","format","quality","forceUseExifOrientation","mappings"])),d=s.work.getURL(s.images[c]),h=o.imageOptions.transform?o.imageOptions.transform(d,p):imageURL(d,p);return getFetcher(o.fiveId,s.work).preload(h)})).then(function(){var c=now()-l;return r(c),c})},t.prototype.project2d=function(e,r){if(r===void 0&&(r=!1),!this.renderer)return null;if(r){var o=this.camera.position,s=e.clone().sub(o),u=new THREE__namespace.Raycaster(o,s.clone().normalize());u.params.Points={threshold:.1};var l=this.modelScene.intersectRaycaster(u)[0];if(l&&l.distance+.01<s.length())return null}var c=e.clone().project(this.camera);if(Math.abs(c.z)>1)return null;var f=this.renderer.getSize(new THREE__namespace.Vector2),p=f.x*this.viewport.width,d=f.y*this.viewport.height,h=f.x*this.viewport.left+(c.x+1)/2*p,g=f.y*(1-this.viewport.bottom-this.viewport.height)+(-c.y+1)/2*d;return new THREE__namespace.Vector2(h,g)},t.prototype.getCurrentState=function(){return __assign(__assign({},this.camera.copyPose()),{mode:this.currentMode,workCode:this.pano.workCode,panoIndex:this.pano.panoIndex})},t.prototype.setState=function(e,r,o){var s,u,l,c,f,p,d,h,g,m;r===void 0&&(r=!1),o===void 0&&(o=!0),e=pick(e,["mode","workCode","panoIndex","longitude","latitude","fov","offset","distance"]),e.offset&&!(e instanceof THREE__namespace.Vector3)&&(e.offset=new THREE__namespace.Vector3(e.offset.x,e.offset.y,e.offset.z));var E;if(typeof e.panoIndex=="number")if(e.workCode)E={workCode:e.workCode,panoIndex:e.panoIndex};else{var y=(u=(s=this.work)===null||s===void 0?void 0:s.workCode)!==null&&u!==void 0?u:"",v=this.state.workCode;this.works.filter(function(M){return M.workCode===v}).length>0&&(y=v),E={workCode:y,panoIndex:e.panoIndex}}var A=(l=e.mode)!==null&&l!==void 0?l:this.state.mode,b,T,_,S,w;if(this.controller&&this.controller.stopMomentumMovement(),this.state.mode!==A){if(A==="VRPanorama"){this.changeMode("VRPanorama",void 0,void 0,!0);return}var R={workCode:E==null?void 0:E.workCode,panoIndex:E==null?void 0:E.panoIndex};typeof e.longitude=="number"&&(R.longitude=e.longitude),typeof e.latitude=="number"&&(R.latitude=e.latitude),typeof e.fov=="number"&&(R.fov=e.fov),typeof e.distance=="number"&&(R.distance=e.distance),e.offset instanceof THREE__namespace.Vector3&&(R.offset=e.offset);var I=__assign(__assign({initial:{state:R,currentState:this.getCurrentState(),duration:this.modeChangeDuration,effect:"fly",userAction:!1}},this.commonParams()),this.controllerInits[A]),H=Controllers[A].initAnimationEndState(I);b=H.longitude,T=H.latitude,_=H.fov,S=H.offset,w=H.distance}else b=(c=e.longitude)!==null&&c!==void 0?c:this.state.longitude,T=(f=e.latitude)!==null&&f!==void 0?f:this.state.latitude,_=(p=e.fov)!==null&&p!==void 0?p:this.state.fov,S=(d=e.offset)!==null&&d!==void 0?d:this.state.offset,w=(h=e.distance)!==null&&h!==void 0?h:this.state.distance;var C={workCode:(E!=null?E:this.pano).workCode,panoIndex:(E!=null?E:this.pano).panoIndex,mode:A,longitude:b,latitude:T,fov:_,offset:S,distance:w};this.emit("state.set",createEvent("state.set",{userAction:o,state:C})),stateEqual(this.state,C)||(this.controller&&C.mode==="VRPanorama"&&C.mode!==this.state.mode?(assignState(this.state,C),this.changeMode("VRPanorama")):this.controller&&C.mode==="XRPanorama"&&C.mode!==this.state.mode?(assignState(this.state,C),this.changeMode("XRPanorama")):(assignState(this.state,C),this.controller&&o&&(this.controller.userAction=!1),r&&this.state.mode===C.mode&&(this.syncingState=this.syncState(now(),0,r),this.syncingState&&((g=this.controller)===null||g===void 0||g.updateTime(now(),0),this.syncingState=!1)),this.emit("state.change",createEvent("state.change",{userAction:o,state:this.state})),(m=this.analysis)===null||m===void 0||m.state(this.works,this.state)))},t.prototype.syncState=function(e,r,o){o===void 0&&(o=!1);var s=this.stateSynced;if(this.stateSynced=!1,!this.controller)return!1;if(this.state.mode!==this.currentMode){var u={mode:this.state.mode,workCode:this.state.workCode,panoIndex:this.state.panoIndex,longitude:this.state.longitude,latitude:this.state.latitude,fov:this.state.fov,offset:this.state.offset,distance:this.state.distance};return this.changeMode(this.state.mode,u,this.modeChangeDuration,this.controller.userAction),!0}if(!this.controller.isReady())return!1;if(this.controller instanceof Controllers.Model){if(notSimilarVector3(this.camera.pose.offset,this.state.offset)){var l={longitude:this.state.longitude,latitude:this.state.latitude,fov:this.state.fov,offset:this.state.offset};return this.controller.moveToPosition(this.state.offset,__assign(__assign({},l),{duration:o?0:void 0}),!1),!0}}else{var c={workCode:this.state.workCode,panoIndex:this.state.panoIndex};if(!panoEqual(c,this.pano)&&"moveToPano"in this.controller&&typeof this.controller.moveToPano=="function"){var l={longitude:this.state.longitude,latitude:this.state.latitude,fov:this.state.fov,offset:this.state.offset,distance:this.state.distance};return this.controller.moveToPano(c,l,!1),!0}}if(this.controller instanceof Controllers.Floorplan||this.controller instanceof Controllers.Topview||this.controller instanceof Controllers.Mapview){var f=1,p=.2,d=.2,h=Math.PI/45,g=o?this.state.fov:stepNumber(this.camera.pose.fov,this.state.fov,f),m=Math.abs(this.camera.pose.distance-this.state.distance),E=m>d*15?m/15:p,y=o?this.state.distance:stepNumber(this.camera.pose.distance,this.state.distance,E),v=this.camera.pose.offset.distanceTo(this.state.offset),A=v>d*15?v/15:d,b=o?new THREE__namespace.Vector3().copy(this.state.offset):stepVector(this.camera.pose.offset,this.state.offset,A),T=o?{longitude:this.state.longitude,latitude:this.state.latitude}:stepCoordinates({longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude},{longitude:this.state.longitude,latitude:this.state.latitude},h),_=T.longitude,S=T.latitude;if(notSimilarValue(g,this.camera.pose.fov)||notSimilarVector3(b,this.camera.pose.offset)||notSimilarValue(y,this.camera.pose.distance)||notSimilarValue(_,this.camera.pose.longitude,Math.PI*2)||notSimilarValue(S,this.camera.pose.latitude)){var w={x:b.x,y:b.y,z:b.z},R={fov:g};return Object.assign(w,{distance:y}),Object.assign(R,{longitude:_,latitude:S}),this.controller.stopMomentumMovement(),this.controller.cameraMotion.set(R,0).catch(noop),this.controller.locationMotion.set(w,0).catch(noop),!0}}else{var I=1,H=Math.PI/45,g=o?this.state.fov:stepNumber(this.camera.pose.fov,this.state.fov,I),C=o?{longitude:this.state.longitude,latitude:this.state.latitude}:stepCoordinates({longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude},{longitude:this.state.longitude,latitude:this.state.latitude},H),_=C.longitude,S=C.latitude,y=this.state.distance,b=new THREE__namespace.Vector3().copy(this.state.offset);if(notSimilarValue(y,this.camera.pose.distance)&&(this.state.distance=this.camera.pose.distance),notSimilarVector3(b,this.camera.pose.offset)&&(this.state.offset=this.camera.pose.offset.clone()),notSimilarValue(_,this.camera.pose.longitude,Math.PI*2)||notSimilarValue(S,this.camera.pose.latitude)||notSimilarValue(g,this.camera.pose.fov))return this.controller.stopMomentumMovement(),this.controller.cameraMotion.set({longitude:_,latitude:S,fov:g},0).catch(noop),!0}if(this.stateSynced=!0,s===!1&&this.emit("state.synced",createEvent("state.synced",{userAction:!1,state:this.state})),this.readyCallbacks.length&&this.stateSynced){var M=this.currentMode,B=M===t.Mode.Floorplan||M===t.Mode.Topview||M===t.Mode.Mapview||M===t.Mode.Model;if(!B||this.modelScene.loaded){var L=this.readyCallbacks.slice();this.readyCallbacks.length=0;for(var O=0,k=L;O<k.length;O++){var D=k[O];this.controller instanceof Controllers.Panorama&&D.tile===!0&&!this.controller.isTileReady()?this.readyCallbacks.push(D):D()}}}return!1},t.prototype.ready=function(e){var r=this;return e===void 0&&(e={}),new Promise(function(o){var s;r.readyCallbacks.push(Object.assign(o,{tile:(s=e.tile)!==null&&s!==void 0?s:!1}))}).then(function(){return r.model.initReady}).then(noop)},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.bindModel=function(e){var r=this,o=function(){AnimationFrameLoop.shared.add(function(){r.emit("model.load",createEvent("model.load",{work:e.work,model:e,error:null}))},!0)},s=function(c){var f=c.error;r.emit("model.error",createEvent("model.error",{work:e.work,model:e,error:f})),r.throwError(f)},u=function(){r.emit("model.changeShownFloor",createEvent("model.changeShownFloor",{work:e.work,model:e,error:null}))},l=function(){e.removeEventListener("load",o),e.removeEventListener("error",s),e.removeEventListener("changeShownFloor",u),e.removeEventListener("dispose",l)};e.addEventListener("load",o),e.addEventListener("error",s),e.addEventListener("changeShownFloor",u),e.addEventListener("dispose",l),this.emit("model.request",createEvent("model.request",{work:e.work,model:e,error:null}))},t.prototype.bindWorkFetcher=function(e){var r=this,o=e.workCode,s=e.allowHosts,u=new Fetcher({get networkSubscribe(){return r.networkSubscribe},requestProxy:function(l){return Promise.resolve(l).then(function(c){return r.requestProxy(c,o)}).then(function(c){var f=verifyURL(c,s);return f instanceof Error?Promise.reject(f):f})}});registerFetcher(this.fiveId,e,u)},t.prototype.commonParams=function(){return{fiveId:this.fiveId,scene:this.scene,xrCustomObjectsScene:this.xrCustomObjectsScene,helper:this.helperGroup,camera:this.camera,renderer:this.renderer,viewport:this.viewport,element:this.getElement(),works:this.works,imageOptions:this.imageOptions,enableWheel:this.enableWheel,extraElements:this.extraElements,videoTexture:this.videoTexture,modelScene:this.modelScene}},t.prototype.applyController=function(e,r){var o=this;if(!this.renderer)throw new Error("renderer is not initialized.");var s=Controllers[e];this.currentMode=e;for(var u=new s(r),l=function(g){u.on(g,function(){for(var m=[],E=0;E<arguments.length;E++)m[E]=arguments[E];var y=o.emit.apply(o,__spreadArray([g],m,!1));if(y)return!1})},c=0,f=PROXY_CONTROLLER_EVENT_NAMES;c<f.length;c++){var p=f[c];l(p)}{var d=Controllers[e].initAnimationEndState(r),h=r.initial.userAction;stateEqual(this.state,d)||(assignState(this.state,d),this.emit("state.change",createEvent("state.change",{userAction:h,state:this.state}))),this.emit("currentState.change",createEvent("currentState.change",{userAction:h,state:this.getCurrentState()}))}return u.on("camera.update",function(g){var m;if(o.controller){var E=o.controller.getTargetState();g.userAction&&o.syncingState===!1&&o.state.mode===E.mode&&!stateEqual(o.state,E)&&(assignState(o.state,E),o.emit("state.change",createEvent("state.change",{userAction:g.userAction,state:o.state})),(m=o.analysis)===null||m===void 0||m.state(o.works,o.state))}o.emit("currentState.change",createEvent("currentState.change",{userAction:g.userAction,state:o.getCurrentState()}))}),u.on("initAnimation.start",function(g){var m,E=g.state,y=g.userAction;y&&o.state.mode===E.mode&&!stateEqual(o.state,E)&&(assignState(o.state,E),o.emit("state.change",createEvent("state.change",{userAction:y,state:o.state})),(m=o.analysis)===null||m===void 0||m.state(o.works,o.state))}),u.on("initAnimation.end",function(g){var m,E=g.state,y=g.userAction;o.pano={workCode:E.workCode,panoIndex:E.panoIndex},y&&o.state.mode===E.mode&&!stateEqual(o.state,E)&&(assignState(o.state,E),o.emit("state.change",createEvent("state.change",{userAction:y,state:o.state})),(m=o.analysis)===null||m===void 0||m.state(o.works,o.state))}),u.on("pano.moveTo",function(g){var m,E=g.state,y=g.userAction;o.pano={workCode:E.workCode,panoIndex:E.panoIndex},y&&o.state.mode===E.mode&&!stateEqual(o.state,E)&&(assignState(o.state,E),o.emit("state.change",createEvent("state.change",{userAction:y,state:o.state})),(m=o.analysis)===null||m===void 0||m.state(o.works,o.state))}),u.on("pano.arrived",function(g){var m,E=g.state,y=g.userAction;o.pano={workCode:E.workCode,panoIndex:E.panoIndex},y&&o.state.mode===E.mode&&!stateEqual(o.state,E)&&(assignState(o.state,E),o.emit("state.change",createEvent("state.change",{userAction:y,state:o.state})),(m=o.analysis)===null||m===void 0||m.state(o.works,o.state))}),u.on("pano.cancel",function(g){var m,E=g.state,y=g.userAction;y&&o.state.mode===E.mode&&!stateEqual(o.state,E)&&(assignState(o.state,E),o.emit("state.change",createEvent("state.change",{userAction:y,state:o.state})),(m=o.analysis)===null||m===void 0||m.state(o.works,o.state))}),u.on("pano.moveTo",function(g){var m=g.userAction;o.emit("currentState.change",createEvent("currentState.change",{userAction:m,state:o.getCurrentState()}))}),u.on("pano.request",function(g){o.emit("pano.request",g),g.defaultPrevented||o.moveToPano(g.state,g.options,g.userAction)}),u.on("vr.requestExit",function(){o.currentMode===t.Mode.VRPanorama&&(o.exitFullscreen(),o.changeMode(t.Mode.Panorama))}),u.on("error",function(g){return o.throwError(g)}),u},t.prototype.removeEventListeners=function(){},Object.defineProperty(t.prototype,"internalLightsEnabled",{get:function(){var e=this.scene.children.find(function(r){return r.name==="internalLights"});return e?e.visible:!1},set:function(e){var r=this.scene.children.find(function(o){return o.name==="internalLights"});r&&(r.visible=e),r=this.modelScene.children.find(function(o){return o.name==="internalLights"}),r&&(r.visible=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"scissor",{get:function(){return this.viewport},enumerable:!1,configurable:!0}),t.prototype.setScissor=function(e){return this.setViewport(e)},t.prototype.getPose=function(){var e=this.camera.copyPose(),r=e.longitude,o=e.latitude,s=e.fov,u=e.offset,l=e.distance;return{longitude:r,latitude:o,fov:s,offset:u.clone(),distance:l}},t.prototype.getLongitudeAndLatitude=function(){var e=this.getPose(),r=e.longitude,o=e.latitude;return{longitude:r,latitude:o}},t.prototype.getOffset=function(){return this.getPose().offset},t.prototype.getCameraLocal=function(){if(this.pano.workCode&&this.controller&&this.works){var e=this.works.getObserver(this.pano);if(e){var r=new THREE__namespace.Object3D;r.matrix.copy(e.matrix).premultiply(e.work.transform),r.matrix.decompose(r.position,r.quaternion,r.scale),r.matrixAutoUpdate=!1;var o=new THREE__namespace.Vector3(0,0,-1);o.applyQuaternion(this.camera.quaternion);var s=r.quaternion.clone().inverse();o.applyQuaternion(s);var u=Math.atan2(o.x,-o.z),l=-Math.asin(o.y);return{theta:u,phi:l,lookAtVector:o}}}return null},t.prototype.addPass=function(e){this.fiveRenderer.composer.addPass(e)},t.prototype.removePass=function(e){var r=this.fiveRenderer.composer.passes.indexOf(e);r!==-1&&this.fiveRenderer.composer.passes.splice(r,1)},t.prototype.insertPass=function(e,r){this.fiveRenderer.composer.insertPass(e,r)},Object.defineProperty(t.prototype,"renderMode",{get:function(){return this.fiveRenderer.renderMode},set:function(e){this.fiveRenderer.renderMode=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enableHQ",{get:function(){return this.fiveRenderer.renderMode==="point-cloud-high-quality"},set:function(e){this.fiveRenderer.renderMode=e?"point-cloud-high-quality":"default",this.needsRender=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enableEDL",{get:function(){return this.eyeDomeLightingPass.enabled},set:function(e){this.eyeDomeLightingPass.enabled=e,this.needsRender=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enableAdaptiveLuminance",{get:function(){return this.adaptiveLuminancePass.enabled},set:function(e){this.adaptiveLuminancePass.enabled=e,this.needsRender=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enableIOSEDR",{get:function(){return!1},set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enablePostProcessing",{get:function(){return!0},set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"modelSceneNeedsRender",{get:function(){return this.modelScene.needsRender},set:function(e){this.modelScene.needsRender=e},enumerable:!1,configurable:!0}),t.Mode={Panorama:"Panorama",Model:"Model",Floorplan:"Floorplan",Topview:"Topview",Mapview:"Mapview",VRPanorama:"VRPanorama",XRPanorama:"XRPanorama"},t})(Subscribe);if(typeof window!="undefined"){var __FIVE_DEBUG__={THREE:THREE__namespace,constructor:Five,instances:Five_Instances};Object.assign(window,{__FIVE_DEBUG__})}var XRButton=(function(){function n(){}return n.createButton=function(t){var e=document.createElement("button");function r(){e.style.display="",e.style.cursor="pointer",e.style.left="calc(50% - 50px)",e.style.width="100px",e.textContent="ENTER VR",e.onmouseenter=function(){e.style.opacity="1.0"},e.onmouseleave=function(){e.style.opacity="0.5"},e.onclick=function(){t&&t()}}function o(){e.style.display="",e.style.cursor="auto",e.style.left="calc(50% - 75px)",e.style.width="150px",e.onmouseenter=null,e.onmouseleave=null,e.onclick=null}function s(){o(),e.textContent="VR NOT SUPPORTED"}function u(c){c.style.position="absolute",c.style.bottom="20px",c.style.padding="12px 6px",c.style.border="1px solid #fff",c.style.borderRadius="4px",c.style.background="rgba(0,0,0,0.1)",c.style.color="#fff",c.style.font="normal 13px sans-serif",c.style.textAlign="center",c.style.opacity="0.5",c.style.outline="none",c.style.zIndex="999"}if("xr"in navigator)return e.id="VRButton",e.style.display="none",u(e),navigator.xr.isSessionSupported("immersive-vr").then(function(c){c?r():s()}),e;var l=document.createElement("a");return window.isSecureContext===!1?(l.href=document.location.href.replace(/^http:/,"https:"),l.innerHTML="WEBXR NEEDS HTTPS"):(l.href="https://immersiveweb.dev/",l.innerHTML="WEBXR NOT AVAILABLE"),l.style.left="calc(50% - 90px)",l.style.width="180px",l.style.textDecoration="none",u(l),l},n})();exports.AdaptiveLuminancePass=AdaptiveLuminancePass;exports.AnimationFrameLoop=AnimationFrameLoop;exports.BoundingMesh=BoundingMesh$1;exports.Camera=Camera;exports.CustomShader=PBMCustomShader;exports.EffectComposer=EffectComposer;exports.EyeDomeLightingPass=EyeDomeLightingPass;exports.Fetcher=Fetcher;exports.Five=Five;exports.FivePass=FivePass;exports.FiveRenderer=FiveRenderer;exports.FullScreenQuad=FullScreenQuad;exports.InternalWebGLRenderer=InternalWebGLRenderer;exports.Model=Model;exports.ModelScene=ModelScene;exports.Motion=Motion;exports.NetworkSubscribe=NetworkSubscribe;exports.PBMContainer=PBMContainer;exports.PBMCustomShader=PBMCustomShader;exports.PBMGroup=PBMGroup;exports.PBMMesh=PBMMesh;exports.PBMMeshMaterial=PBMMeshMaterial;exports.PBMPointCloud=PBMPointCloud;exports.PBMPointCloudMaterial=PBMPointCloudMaterial;exports.PBMSkinnedMesh=PBMSkinnedMesh;exports.PROXY_CONTROLLER_EVENT_NAMES=PROXY_CONTROLLER_EVENT_NAMES;exports.PanoCircleMesh=PanoCircleMesh;exports.PanoCircleMeshCustom=PanoCircleMeshCustom;exports.PanoCircleMeshSolid=PanoCircleMeshSolid;exports.Parameter=Parameter;exports.Scene=Scene;exports.Subscribe=Subscribe;exports.TextureLoader=TextureLoader;exports.Tile=Tile;exports.Tile3D=Tile3D;exports.Tile3DModel=Tile3D;exports.TileCache=TileCache;exports.TileNode=TileNode;exports.TileRequestScheduler=TileRequestScheduler;exports.Tileset=Tileset;exports.Trajectory=Trajectory;exports.TrajectoryNode=TrajectoryNode;exports.Work=Work;exports.WorkResolvedObserver=WorkResolvedObserver;exports.XRButton=XRButton;exports.controllersDefaultInitArgs=controllersDefaultInitArgs;exports.coordinatesToVector=coordinatesToVector;exports.createDebugBoundingMesh=createDebugBoundingMesh;exports.createWorks=createWorks;exports.defaultImageURLTransform=imageURL;exports.draco=draco;exports.getViewportScale=getViewportScale;exports.headingToLongitude=headingToLongitude;exports.imageSupport=imageSupport;exports.isBoundingVolume=isBoundingVolume;exports.isPanoId=isPanoId;exports.ktx2=ktx2;exports.loadAt3d=loadAt3d;exports.loadB3dm=loadB3dm;exports.loadDome=loadDome;exports.loadDomez=loadDomez;exports.loadFbx=loadFbx;exports.loadGltf=loadGltf;exports.loadPbm=loadPbm;exports.loadPly=loadPly;exports.loadPnts=loadPnts;exports.loadX3p=loadX3p;exports.longitudeToHeading=longitudeToHeading;exports.makeBoundingVolume=makeBoundingVolume;exports.panoEqual=panoEqual;exports.panoParse=panoParse;exports.panoStringify=panoStringify;exports.parseWork=parseWork;exports.vectorToCoordinates=vectorToCoordinates;exports.workToJson=workToJson;
|
|
2350
|
+
`},LineMaterial=(function(n){__extends(t,n);function t(e){var r=n.call(this,{uniforms:THREE__namespace.UniformsUtils.clone(lineShader.uniforms),vertexShader:lineShader.vertexShader,fragmentShader:lineShader.fragmentShader,clipping:!0})||this;return r.type="LineMaterial",r.dashed=!1,Object.defineProperties(r,{color:{enumerable:!0,get:function(){return this.uniforms.diffuse.value},set:function(o){this.uniforms.diffuse.value=o}},linewidth:{enumerable:!0,get:function(){return this.uniforms.linewidth.value},set:function(o){this.uniforms.linewidth.value=o}},dashScale:{enumerable:!0,get:function(){return this.uniforms.dashScale.value},set:function(o){this.uniforms.dashScale.value=o}},dashSize:{enumerable:!0,get:function(){return this.uniforms.dashSize.value},set:function(o){this.uniforms.dashSize.value=o}},gapSize:{enumerable:!0,get:function(){return this.uniforms.gapSize.value},set:function(o){this.uniforms.gapSize.value=o}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(o){this.uniforms.opacity.value=o}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(o){this.uniforms.resolution.value.copy(o)}}}),r.setValues(e),r}return t})(THREE__namespace.ShaderMaterial);Object.assign(LineMaterial.prototype,{isLineMaterial:!0});var LineSegments2=(function(n){__extends(t,n);function t(e,r){var o=n.call(this)||this;return o.type="LineSegments2",o.geometry=e!==void 0?e:new LineSegmentsGeometry,o.material=r!==void 0?r:new LineMaterial({color:Math.random()*16777215}),o}return t.prototype.computeLineDistances=function(){for(var e=this.geometry,r=e.attributes.instanceStart,o=e.attributes.instanceEnd,s=new Float32Array(2*r.count),u=new THREE__namespace.Vector3,l=new THREE__namespace.Vector3,c=0,f=0,p=r.count;c<p;c++,f+=2)u.fromBufferAttribute(r,c),l.fromBufferAttribute(o,c),s[f]=f===0?0:s[f-1],s[f+1]=s[f]+u.distanceTo(l);var d=new THREE__namespace.InstancedInterleavedBuffer(s,2,1);return e.setAttribute("instanceDistanceStart",new THREE__namespace.InterleavedBufferAttribute(d,1,0)),e.setAttribute("instanceDistanceEnd",new THREE__namespace.InterleavedBufferAttribute(d,1,1)),this},t.prototype.raycast=function(e,r){e.camera===null&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2.');var o=e.ray,s=e.camera,u=s.projectionMatrix,l=this.geometry,c=this.material,f=c.resolution,p=c.linewidth,d=l.attributes.instanceStart,h=l.attributes.instanceEnd,g=new THREE__namespace.Vector4,m=new THREE__namespace.Vector4,E=new THREE__namespace.Vector4,y=new THREE__namespace.Vector3,v=new THREE__namespace.Matrix4,A=new THREE__namespace.Line3,b=new THREE__namespace.Vector3;o.at(1,E),E.w=1,E.applyMatrix4(s.matrixWorldInverse),E.applyMatrix4(u),E.multiplyScalar(1/E.w),E.x*=f.x/2,E.y*=f.y/2,E.z=0,y.copy(E);var T=this.matrixWorld;v.multiplyMatrices(s.matrixWorldInverse,T);for(var _=0,S=d.count;_<S;_++){g.fromBufferAttribute(d,_),m.fromBufferAttribute(h,_),g.w=1,m.w=1,g.applyMatrix4(v),m.applyMatrix4(v),g.applyMatrix4(u),m.applyMatrix4(u),g.multiplyScalar(1/g.w),m.multiplyScalar(1/m.w);var w=g.z<-1&&m.z<-1,R=g.z>1&&m.z>1;if(!(w||R)){g.x*=f.x/2,g.y*=f.y/2,m.x*=f.x/2,m.y*=f.y/2,A.start.copy(g),A.start.z=0,A.end.copy(m),A.end.z=0;var I=A.closestPointToPointParameter(y,!0);A.at(I,b);var H=THREE__namespace.MathUtils.lerp(g.z,m.z,I),C=H>=-1&&H<=1,M=y.distanceTo(b)<p*.5;if(C&&M){A.start.fromBufferAttribute(d,_),A.end.fromBufferAttribute(h,_),A.start.applyMatrix4(T),A.end.applyMatrix4(T);var B=new THREE__namespace.Vector3,L=new THREE__namespace.Vector3;o.distanceSqToSegment(A.start,A.end,L,B),r.push({point:L,pointOnLine:B,distance:o.origin.distanceTo(L),object:this,faceIndex:_})}}}},t})(THREE__namespace.Mesh);Object.assign(LineSegments2.prototype,{isLineSegments2:!0});var Line2=(function(n){__extends(t,n);function t(e,r){var o=n.call(this,e,r)||this;return o.type="Line2",o}return t})(LineSegments2);Object.assign(Line2.prototype,{isLine2:!0});var LineGeometry=(function(n){__extends(t,n);function t(){var e=n.call(this)||this;return e.type="LineGeometry",e}return t.prototype.setPositions=function(e){for(var r=e.length-3,o=new Float32Array(2*r),s=0;s<r;s+=3)o[2*s]=e[s],o[2*s+1]=e[s+1],o[2*s+2]=e[s+2],o[2*s+3]=e[s+3],o[2*s+4]=e[s+4],o[2*s+5]=e[s+5];return n.prototype.setPositions.call(this,o),this},t.prototype.setColors=function(e){for(var r=e.length-3,o=new Float32Array(2*r),s=0;s<r;s+=3)o[2*s]=e[s],o[2*s+1]=e[s+1],o[2*s+2]=e[s+2],o[2*s+3]=e[s+3],o[2*s+4]=e[s+4],o[2*s+5]=e[s+5];return n.prototype.setColors.call(this,o),this},t.prototype.fromLine=function(e){var r=e.geometry;if(r instanceof THREE__namespace.Geometry){var o=new THREE__namespace.BufferGeometry().fromGeometry(r);this.setPositions(o.attributes.position.array)}else r instanceof THREE__namespace.BufferGeometry&&this.setPositions(r.attributes.position.array);return this},t.prototype.copy=function(){return this},t})(LineSegmentsGeometry);Object.assign(LineGeometry.prototype,{isLineGeometry:!0});var circleImageURL="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAAZiS0dEAAAAAAAA+UO7fwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sHDgwCEMBJZu0AAAAdaVRYdENvbW1lbnQAAAAAAENyZWF0ZWQgd2l0aCBHSU1QZC5lBwAABM5JREFUWMO1V0tPG2cUPZ4Hxh6DazIOrjFNqJs0FIMqWFgWQkatsmvVbtggKlSVRVf5AWz4AWz4AUSKEChll19QJYSXkECuhFxsHjEhxCYm+DWGMZ5HF72DJq4bAzFXurI0M/I5997v3u9cC65vTJVn2lX/xHINQOYSBLTLEuIuCWw4Z3IGAEvf6ASmVHjNzHCXBG4A0AjACsAOwEbO0nsFQBnAGYASAIl+ZRMR7SolMEdsByD09fV5R0ZGgg8ePPjW5/N1iqLYpuu6RZblciKR2I9Go69evnwZnZ+fjwI4IS8AKBIRzeQfJWCANwKwh0KhtrGxsYehUOin1tbW+zzP23ietzY2NnIAoGmaLsuyUiqVyvl8XtrY2NiamZn589mzZxsAUgCOAeQAnFI2tI+VxIjaAeDzoaGh7xYWFuZOTk6OZVk+12uYqqq6JEnn0Wg0OT4+/geAXwGEAdwDIFJQXC1wO4DWR48e/RCPxxclSSroVzRFUbSDg4P848ePFwH8DuAhkWih83TRQWxFOXgAwvDwcOfo6OhvXV1d39tsNtuVBwTDWBwOh1UUxVsMw1hXVlbSdCgNV43uYSvrHg6H24aHh38eHBz85TrgF9FYLHA4HLzH43FvbW2d7u/vG+dANp8FpqIlbd3d3V8Fg8EfBUFw4BONZVmL3+9vHhkZCQL4AoAHgJPK8G+yzC0XDofdoVAo5PP5vkadTBAEtr+/39ff3x8gAp/RPOEqx2qjx+NpvXv3bk9DQ0NDvQgwDIOWlhZrMBj8kgi0UJdxRgYMArzL5XJ7vd57qLPZ7Xamp6fnNgBXtQxcjFuHw+Hyer3t9SYgCAITCAScAJoBNNEY/08GOFVVrfVMv7kMNDntFD1vjIAPrlRN0xjckOm6biFQ3jwNPwDMZrOnqVTqfb3Bi8Wivru7W/VCYkwPlKOjo0IikXh7EwQikYgE4Nw0CfXKDCipVCoTj8df3QABbW1tLUc6oUgkFPMkVACUNjc337148eKvw8PDbJ2jP1taWkoCyNDVXDSECmNSK4qiKNLq6urW8+fPI/UicHx8rD59+jSVy+WOAKSJhKENwFItLtoxk8mwsixzHR0dHe3t7c5PAU+n09rs7OzJkydPYqVSaQfANoDXALIk31S2smU1TWMPDg7K5XKZ7+3t9TudTut1U7+wsFCcmJiIpdPpbQBxADsAknQWymYCOukBHYCuKApisdhpMpnURFEU79y503TVyKenpzOTk5M7e3t7MQKPV0Zv1gNm+awB0MvlshqLxfLb29uyJElWURSbXC4XXyvqxcXFs6mpqeTc3Nzu3t7e3wQcA7BPZ8Cov1pNlJplmQtAG8MwHV6v95tAINA5MDBwPxAIuLu6upr8fr/VAN3c3JQjkcjZ+vp6fnl5+d2bN29SuVzuNYAEpf01CdRChUL+X1VskHACuA3Ay3Fcu9vt7nA6nZ7m5uYWQRCaNE3jVVW15PP580KhIGUymWw2m00DOAJwSP4WwPtq4LX2Ao6USxNlQyS/RcQcdLGwlNIz6vEMAaZpNzCk2Pll94LK/cDYimxERiBwG10sxjgvEZBE0UpE6vxj+0Ct5bTaXthgEhRmja8QWNkkPGsuIpfdjpkK+cZUWTC0KredVmtD/gdlSl6EG4AMvQAAAABJRU5ErkJggg==",DEFAULT_COLOR=14467195,POINT_SIZE=8,DEFAULT_LINEWIDTH=2,DEFAULT_DASHSCALE=20,sharedCircleTexture=null,FiveLine=(function(n){__extends(t,n);function t(e,r){e===void 0&&(e=new THREE__namespace.Vector3),r===void 0&&(r=new THREE__namespace.Vector3);var o=n.call(this)||this;o.type="FiveLine",o.needsRender=!0;var s=new LineGeometry,u=new LineMaterial({color:DEFAULT_COLOR,linewidth:DEFAULT_LINEWIDTH,dashScale:DEFAULT_DASHSCALE,dashed:!1});o.line=new Line2(s,u);var l=new THREE__namespace.BufferGeometry,c=new THREE__namespace.PointsMaterial({color:DEFAULT_COLOR,size:POINT_SIZE,map:sharedCircleTexture||(sharedCircleTexture=new THREE__namespace.TextureLoader().load(circleImageURL)),sizeAttenuation:!1,transparent:!0});return o.points=new THREE__namespace.Points(l,c),o.points.renderOrder=11,o.points.frustumCulled=!1,o.setPoints(e,r),o.add(o.line,o.points),o}return Object.defineProperty(t,"version",{get:function(){return"6.7.0-alpha.35"},enumerable:!1,configurable:!0}),t.prototype.setPoints=function(e,r){var o=[].concat(e.toArray(),r.toArray());this.points.geometry.setAttribute("position",new THREE__namespace.BufferAttribute(new Float32Array(o),3)),this.line.geometry.setPositions(o),this.line.computeLineDistances(),this.needsRender=!0},t.prototype.getPoints=function(){var e=this.points.geometry.attributes.position.array;return[new THREE__namespace.Vector3(e[0],e[1],e[2]),new THREE__namespace.Vector3(e[3],e[4],e[5])]},t.prototype.setMaterial=function(e){var r=this.line.material;for(var o in e)if(e.hasOwnProperty(o)){var s=e[o];o==="dashed"?(r.dashed=s,s?r.defines.USE_DASH="":delete r.defines.USE_DASH,r.needsUpdate=!0):r[o]=e[o]}this.needsRender=!0},t.prototype.setResolution=function(e,r){var o=this.line.material.resolution;(o.x!==e||o.y!==r)&&(o.set(e,r),this.needsRender=!0)},t})(THREE__namespace.Object3D);Object.assign(FiveLine.prototype,{isFiveLine:!0});var Constants={ComponentState:Object.freeze({DEFAULT:"default",TOUCHED:"touched",PRESSED:"pressed"}),ComponentProperty:Object.freeze({BUTTON:"button",X_AXIS:"xAxis",Y_AXIS:"yAxis",STATE:"state"}),ComponentType:Object.freeze({TRIGGER:"trigger",SQUEEZE:"squeeze",TOUCHPAD:"touchpad",THUMBSTICK:"thumbstick",BUTTON:"button"}),ButtonTouchThreshold:.05,AxisTouchThreshold:.1,VisualResponseProperty:Object.freeze({TRANSFORM:"transform",VISIBILITY:"visibility"})};function fetchJsonFile(n){return __awaiter(this,void 0,void 0,function(){var t;return __generator(this,function(e){switch(e.label){case 0:return[4,fetch(n)];case 1:if(t=e.sent(),t.ok)return[2,t.json()];throw new Error(t.statusText)}})})}function fetchProfilesList(n){return __awaiter(this,void 0,void 0,function(){var t,e;return __generator(this,function(r){switch(r.label){case 0:if(!n)throw new Error("No basePath supplied");return t="profilesList.json",[4,fetchJsonFile("".concat(n,"/").concat(t))];case 1:return e=r.sent(),[2,e]}})})}function fetchProfile(n,t){return __awaiter(this,arguments,void 0,function(e,r,o,s){var u,l,c,f,p,d;return o===void 0&&(o=null),s===void 0&&(s=!0),__generator(this,function(h){switch(h.label){case 0:if(!e)throw new Error("No xrInputSource supplied");if(!r)throw new Error("No basePath supplied");return[4,fetchProfilesList(r)];case 1:if(u=h.sent(),e.profiles.some(function(g){var m=u[g];return m&&(l={profileId:g,profilePath:"".concat(r,"/").concat(m.path),deprecated:!!m.deprecated}),!!l}),!l){if(!o)throw new Error("No matching profile name found");if(c=u[o],!c)throw new Error('No matching profile name found and default profile "'.concat(o,'" missing.'));l={profileId:o,profilePath:"".concat(r,"/").concat(c.path),deprecated:!!c.deprecated}}return[4,fetchJsonFile(l.profilePath)];case 2:if(f=h.sent(),s){if(d=void 0,d=f.layouts[e.handedness],!d)throw new Error("No matching handedness, ".concat(e.handedness,", in profile ").concat(l.profileId));d.assetPath&&(p=l.profilePath.replace("profile.json",d.assetPath))}return[2,{profile:f,assetPath:p}]}})})}var defaultComponentValues={xAxis:0,yAxis:0,button:0,state:Constants.ComponentState.DEFAULT};function normalizeAxes(n,t){n===void 0&&(n=0),t===void 0&&(t=0);var e=n,r=t,o=Math.sqrt(n*n+t*t);if(o>1){var s=Math.atan2(t,n);e=Math.cos(s),r=Math.sin(s)}var u={normalizedXAxis:e*.5+.5,normalizedYAxis:r*.5+.5};return u}var VisualResponse=(function(){function n(t){this.componentProperty=t.componentProperty,this.states=t.states,this.valueNodeName=t.valueNodeName,this.valueNodeProperty=t.valueNodeProperty,this.valueNodeProperty===Constants.VisualResponseProperty.TRANSFORM&&(this.minNodeName=t.minNodeName,this.maxNodeName=t.maxNodeName),this.value=0,this.updateFromComponent(defaultComponentValues)}return n.prototype.updateFromComponent=function(t){var e=t.xAxis,r=t.yAxis,o=t.button,s=t.state,u=normalizeAxes(e,r),l=u.normalizedXAxis,c=u.normalizedYAxis;switch(this.componentProperty){case Constants.ComponentProperty.X_AXIS:this.value=this.states.includes(s)?l:.5;break;case Constants.ComponentProperty.Y_AXIS:this.value=this.states.includes(s)?c:.5;break;case Constants.ComponentProperty.BUTTON:this.value=this.states.includes(s)?o:0;break;case Constants.ComponentProperty.STATE:this.valueNodeProperty===Constants.VisualResponseProperty.VISIBILITY?this.value=this.states.includes(s):this.value=this.states.includes(s)?1:0;break;default:throw new Error("Unexpected visualResponse componentProperty ".concat(this.componentProperty))}},n})(),Component=(function(){function n(t,e){var r=this;if(!t||!e||!e.visualResponses||!e.gamepadIndices||Object.keys(e.gamepadIndices).length===0)throw new Error("Invalid arguments supplied");this.id=t,this.type=e.type,this.rootNodeName=e.rootNodeName,this.touchPointNodeName=e.touchPointNodeName,this.visualResponses={},Object.keys(e.visualResponses).forEach(function(o){var s=new VisualResponse(e.visualResponses[o]);r.visualResponses[o]=s}),this.gamepadIndices=Object.assign({},e.gamepadIndices),this.values={state:Constants.ComponentState.DEFAULT,button:this.gamepadIndices.button!==void 0?0:void 0,xAxis:this.gamepadIndices.xAxis!==void 0?0:void 0,yAxis:this.gamepadIndices.yAxis!==void 0?0:void 0}}return Object.defineProperty(n.prototype,"data",{get:function(){var t=__assign({id:this.id},this.values);return t},enumerable:!1,configurable:!0}),n.prototype.updateFromGamepad=function(t){var e=this;if(this.values.state=Constants.ComponentState.DEFAULT,this.gamepadIndices.button!==void 0&&t.buttons.length>this.gamepadIndices.button){var r=t.buttons[this.gamepadIndices.button];this.values.button=r.value,this.values.button=this.values.button<0?0:this.values.button,this.values.button=this.values.button>1?1:this.values.button,r.pressed||this.values.button===1?this.values.state=Constants.ComponentState.PRESSED:(r.touched||this.values.button>Constants.ButtonTouchThreshold)&&(this.values.state=Constants.ComponentState.TOUCHED)}this.gamepadIndices.xAxis!==void 0&&t.axes.length>this.gamepadIndices.xAxis&&(this.values.xAxis=t.axes[this.gamepadIndices.xAxis],this.values.xAxis=this.values.xAxis<-1?-1:this.values.xAxis,this.values.xAxis=this.values.xAxis>1?1:this.values.xAxis,this.values.state===Constants.ComponentState.DEFAULT&&Math.abs(this.values.xAxis)>Constants.AxisTouchThreshold&&(this.values.state=Constants.ComponentState.TOUCHED)),this.gamepadIndices.yAxis!==void 0&&t.axes.length>this.gamepadIndices.yAxis&&(this.values.yAxis=t.axes[this.gamepadIndices.yAxis],this.values.yAxis=this.values.yAxis<-1?-1:this.values.yAxis,this.values.yAxis=this.values.yAxis>1?1:this.values.yAxis,this.values.state===Constants.ComponentState.DEFAULT&&Math.abs(this.values.yAxis)>Constants.AxisTouchThreshold&&(this.values.state=Constants.ComponentState.TOUCHED)),Object.values(this.visualResponses).forEach(function(o){o.updateFromComponent(e.values)})},n})(),MotionController=(function(){function n(t,e,r){var o=this;if(!t)throw new Error("No xrInputSource supplied");if(!e)throw new Error("No profile supplied");this.xrInputSource=t,this.assetUrl=r,this.id=e.profileId,this.layoutDescription=e.layouts[t.handedness],this.components={},Object.keys(this.layoutDescription.components).forEach(function(s){var u=o.layoutDescription.components[s];o.components[s]=new Component(s,u)}),this.updateFromGamepad()}return Object.defineProperty(n.prototype,"gripSpace",{get:function(){return this.xrInputSource.gripSpace},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"targetRaySpace",{get:function(){return this.xrInputSource.targetRaySpace},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"data",{get:function(){var t=[];return Object.values(this.components).forEach(function(e){t.push(e.data)}),t},enumerable:!1,configurable:!0}),n.prototype.updateFromGamepad=function(){var t=this;Object.values(this.components).forEach(function(e){e.updateFromGamepad(t.xrInputSource.gamepad)})},n})(),DEFAULT_PROFILES_PATH="https://cdn.jsdelivr.net/npm/@webxr-input-profiles/assets@1.0/dist/profiles",DEFAULT_PROFILE="generic-trigger",XRControllerModel=(function(n){__extends(t,n);function t(){var e=n.call(this)||this;return e.motionController=null,e.envMap=null,e}return t.prototype.setEnvironmentMap=function(e){var r=this;return this.envMap==e?this:(this.envMap=e,this.traverse(function(o){o instanceof THREE__namespace.Mesh&&o.isMesh&&(o.material.envMap=r.envMap,o.material.needsUpdate=!0)}),this)},t.prototype.updateMatrixWorld=function(e){n.prototype.updateMatrixWorld.call(this,e),this.motionController&&(this.motionController.updateFromGamepad(),Object.values(this.motionController.components).forEach(function(r){Object.values(r.visualResponses).forEach(function(o){var s=o.valueNode,u=o.minNode,l=o.maxNode,c=o.value,f=o.valueNodeProperty;s&&(f===Constants.VisualResponseProperty.VISIBILITY?s.visible=c:f===Constants.VisualResponseProperty.TRANSFORM&&(s.quaternion.copy(u.quaternion).slerp(l.quaternion,c),s.position.lerpVectors(u.position,l.position,c)))})}))},t})(THREE.Object3D);function findNodes(n,t){Object.values(n.components).forEach(function(e){var r=e.type,o=e.touchPointNodeName,s=e.visualResponses;if(r===Constants.ComponentType.TOUCHPAD)if(e.touchPointNode=t.getObjectByName(o),e.touchPointNode){var u=new THREE.SphereGeometry(.001),l=new THREE.MeshBasicMaterial({color:255}),c=new THREE.Mesh(u,l);e.touchPointNode.add(c)}else console.warn("Could not find touch dot, ".concat(e.touchPointNodeName,", in touchpad component ").concat(e.id));Object.values(s).forEach(function(f){var p=f.valueNodeName,d=f.minNodeName,h=f.maxNodeName,g=f.valueNodeProperty;if(g===Constants.VisualResponseProperty.TRANSFORM){if(f.minNode=t.getObjectByName(d),f.maxNode=t.getObjectByName(h),!f.minNode){console.warn("Could not find ".concat(d," in the model"));return}if(!f.maxNode){console.warn("Could not find ".concat(h," in the model"));return}}f.valueNode=t.getObjectByName(p),f.valueNode||console.warn("Could not find ".concat(p," in the model"))})})}function addAssetSceneToControllerModel(n,t){findNodes(n.motionController,t),n.envMap&&t.traverse(function(e){e instanceof THREE__namespace.Mesh&&e.isMesh&&(e.material.envMap=n.envMap,e.material.needsUpdate=!0)}),n.add(t)}var XRControllerModelFactory=(function(){function n(t){t===void 0&&(t=null),this.gltfLoader=t,this.path=DEFAULT_PROFILES_PATH,this._assetCache={}}return n.prototype.createControllerModel=function(t){var e=this,r=new XRControllerModel,o=null;return t.addEventListener("connected",function(s){var u=s.data;u.targetRayMode!=="tracked-pointer"||!u.gamepad||fetchProfile(u,e.path,DEFAULT_PROFILE).then(function(l){var c=l.profile,f=l.assetPath;r.motionController=new MotionController(u,c,f);var p=e._assetCache[r.motionController.assetUrl];if(p)o=p.scene.clone(),addAssetSceneToControllerModel(r,o);else{if(!e.gltfLoader)throw new Error("GLTFLoader not set.");e.gltfLoader.load(r.motionController.assetUrl,function(d){e._assetCache[r.motionController.assetUrl]=d,o=d.scene.clone(),addAssetSceneToControllerModel(r,o)})}}).catch(function(l){console.warn(l)})}),t.addEventListener("disconnected",function(){r.motionController=null,r.remove(o),o=null}),r},n})(),defaultXRPanoramaControllerInitArgs=__assign({},omit(defaultPanoramaControllerCustomInitArgs,["maxLatitude","minLatitude"]));function mapPanoResource(n,t){return n}var CONTROLLER_EVNET_DELTA_TIME=300,scratchRaycaster=new THREE__namespace.Raycaster,scratchVector3=new THREE__namespace.Vector3,XRPanoramaController=(function(n){__extends(t,n);function t(e){var r=n.call(this,e)||this;r.xrManager=new XRManager(r.renderer,r.renderer.getContext(),{onSessionStart:function(c){r.emit("xr.session.start",createEvent("xr.session.start",{session:c,machineType:r.xrManager.machineType}))},onSessionEnd:function(){r.emit("xr.session.end",createEvent("xr.session.end",{session:null,machineType:r.xrManager.machineType}))}}),r.xrControllerRay={left:new THREE__namespace.Raycaster,right:new THREE__namespace.Raycaster},r.xrControllerRay.left.params.Points={threshold:.1},r.xrControllerRay.left.firstHitOnly=!0,r.xrControllerRay.left.floorIndex=-1,r.xrControllerRay.right.params.Points={threshold:.1},r.xrControllerRay.right.firstHitOnly=!0,r.xrControllerRay.right.floorIndex=-1,r.gazeRay=null,r.pointerLines={left:new FiveLine,right:new FiveLine},r.pointerLines.left.visible=!1,r.pointerLines.right.visible=!0,r.pointerLines.left.setMaterial({color:new THREE__namespace.Vector3(1,1,1)}),r.pointerLines.left.points.material.depthTest=!1,r.pointerLines.right.setMaterial({color:new THREE__namespace.Vector3(1,1,1)}),r.pointerLines.right.points.material.depthTest=!1,r.controllerWrappers=[new THREE__namespace.Group,new THREE__namespace.Group];var o=r.xrManager.getController(0);r.controllerWrappers[0].add(o);var s=r.xrManager.getController(1);r.controllerWrappers[1].add(s);var u=new XRControllerModelFactory;u.gltfLoader={load:function(c,f){internalFetcher.ajax(c,{responseType:"arraybuffer"}).then(function(p){var d;return parseGltf(p.body,{resourcePath:c.slice(0,c.lastIndexOf("/")+1),search:(d=c.split("?")[1])!==null&&d!==void 0?d:"",fetcher:internalFetcher})}).then(function(p){return f(p)})}},(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",effectEasing:defaultEffectEase,fixCameraTransform:new THREE__namespace.Matrix4},r.parallaxCameraMatrixs=[];var l=AnimationFrameLoop.shared.getContext();return l?(r.on("xr.session.end",function(){r.scene.remove(r.pointerLines.left,r.pointerLines.right)}),r.xrManager.setSession(l),r.on("xr.session.start",function(){var c=r.xrManager.getControllerGrip(0);c.add(u.createControllerModel(c)),r.controllerWrappers[0].add(c);var f=r.xrManager.getControllerGrip(1);f.add(u.createControllerModel(f)),r.controllerWrappers[1].add(f)}),r.xrHandleState={LeftAxesUp:{touchStartTime:0,touchStart:!1},LeftAxesDown:{touchStartTime:0,touchStart:!1},LeftAxesLeft:{touchStartTime:0,touchStart:!1},LeftAxesRight:{touchStartTime:0,touchStart:!1},LeftTrigger:{touchStartTime:0,touchStart:!1},LeftPinch:{touchStartTime:0,touchStart:!1},RightAxesUp:{touchStartTime:0,touchStart:!1},RightAxesDown:{touchStartTime:0,touchStart:!1},RightAxesLeft:{touchStartTime:0,touchStart:!1},RightAxesRight:{touchStartTime:0,touchStart:!1},RightTrigger:{touchStartTime:0,touchStart:!1},RightPinch:{touchStartTime:0,touchStart:!1},Y:{touchStartTime:0,touchStart:!1},X:{touchStartTime:0,touchStart:!1},A:{touchStartTime:0,touchStart:!1},B:{touchStartTime:0,touchStart:!1}},r.xrManager.machineType==="VP"&&r.initHandEvent(),r):(console.error("获取session失败,请退出重试"),r)}return t.parseArgs=function(e){if(e instanceof t)return e;var r=__assign(__assign({},e),{maxLatitude:Math.PI/2,minLatitude:-Math.PI/2});return n.parseArgs.call(this,r)},t.initAnimationEndState=function(e){var r=this.parseArgs(e),o=n.initAnimationEndState.call(this,r);return __assign(__assign({},o),{mode:"XRPanorama"})},t.prototype.updateConfiguration=function(e){return n.prototype.updateConfiguration.call(this,__assign(__assign({},e),{maxLatitude:Math.PI/2,minLatitude:-Math.PI/2}))},t.prototype.moveToPano=function(e,r,o){var s=this,u,l,c,f=(u=r.effect)!==null&&u!==void 0?u:"fade";this.userAction=o,this.stopMomentumMovement();var p=panoStringify(e),d=this.works.getObserver(e);if(!d)throw new Error("Invalid PanoIndex");getImageSizeFromURL(d.images.up),this.imageOptions.size;var h=this.imageOptions.transform,g=function(I,H){return mapPanoResource(applyImageURLOptions(I,h,H))},m=__assign({key:"pano.".concat(p)},pick(this.imageOptions,["format","size","quality"])),E={right:d.images.work.getURL(d.images.right),left:d.images.work.getURL(d.images.left),up:d.images.work.getURL(d.images.up),down:d.images.work.getURL(d.images.down),front:d.images.work.getURL(d.images.front),back:d.images.work.getURL(d.images.back)},y="pano:"+jsonHash([E,m,h]);if(this.pendingTextureTask){if(this.pendingTextureTask.hash===y)return;var v=this.pendingTextureTask.panoId;(l=this.panoMeshes.get(v))===null||l===void 0||l.setProgress(0),this.emit("pano.texture.abort",createEvent("pano.texture.abort",{error:null,progress:0,meta:null,pano:e}))}var A=this.modelScene.parameter.resolveValue(),b=A.pano0,T=A.pano1,_;if((b==null?void 0:b.map.name)===y?_=b:(T==null?void 0:T.map.name)===y&&(_=T),_){var S={panoId:p,effect:f,effectEasing:(c=r.effectEasing)!==null&&c!==void 0?c:defaultEffectEase,leftPanoPicture:{panoId:_.panoId,map:_.map,mapSize:_.mapSize,matrix:d.matrix.clone().premultiply(d.work.transform),zoom:1},position:d.position.clone().applyMatrix4(d.work.transform),fixCameraTransform:new THREE__namespace.Matrix4};this.doMoveToPano(e,S,r);return}var w="move-to-pano-"+p;this.pending.add(w),this.pendingTextureTask={panoId:p,hash:y,onLoad:function(I){var H,C,M=I.body;if(s.destroyed)M.dispose();else{M.name=y;var B=Array.isArray(M.image)?M.image[0]:M.image,L=(H=B==null?void 0:B.width)!==null&&H!==void 0?H:2048,O={panoId:p,effect:f,effectEasing:(C=r.effectEasing)!==null&&C!==void 0?C:defaultEffectEase,leftPanoPicture:{panoId:p,map:M,mapSize:L,matrix:d.matrix.clone(),zoom:1},position:d.position.clone(),fixCameraTransform:new THREE__namespace.Matrix4};s.doMoveToPano(e,O,r)}},onError:function(I){var H=__assign(__assign(__assign({},e),{mode:s.mode}),clonePose(s.camera.pose));s.emit("pano.error",createEvent("pano.error",{error:I,userAction:s.userAction,options:r,prevPano:s.currentPano,progress:0,state:H})),s.emit("pano.cancel",createEvent("pano.cancel",{error:null,userAction:s.userAction,options:r,prevPano:s.currentPano,progress:0,state:H})),r.moveCancelCallback&&r.moveCancelCallback()}};var R=this.panoMeshes.get(p);R&&R.tap&&R.tap(),this.textureLoader.loadCubeTexture(E,{imageURL:{transform:g,options:m},format:THREE__namespace.RGBFormat,fetcher:getFetcher(this.fiveId,d.work)},void 0,void 0,function(I){var H,C;((H=s.pendingTextureTask)===null||H===void 0?void 0:H.hash)===y&&((C=s.panoMeshes.get(p))===null||C===void 0||C.setProgress(I)),s.emit("pano.texture.progress",createEvent("pano.texture.progress",{error:null,progress:I,meta:null,pano:e}))},this.renderer).then(function(I){var H,C;s.pending.delete(w),((H=s.pendingTextureTask)===null||H===void 0?void 0:H.hash)===y?(s.pendingTextureTask.onLoad(I),s.pendingTextureTask=void 0,(C=s.panoMeshes.get(p))===null||C===void 0||C.setProgress(0)):I.body.dispose(),s.emit("pano.texture.success",createEvent("pano.texture.success",{error:null,progress:1,meta:I.meta,pano:e}))}).catch(function(I){var H,C;s.pending.delete(w),((H=s.pendingTextureTask)===null||H===void 0?void 0:H.hash)===y&&(s.pendingTextureTask.onError(I),s.pendingTextureTask=void 0,(C=s.panoMeshes.get(p))===null||C===void 0||C.setProgress(0)),s.emit("pano.texture.error",createEvent("pano.texture.error",{error:I,progress:0,meta:null,pano:e})),s.emit("error",I)}),this.emit("pano.texture.load",createEvent("pano.texture.load",{error:null,progress:0,meta:null,pano:e}))},t.prototype.doMoveToPano=function(e,r,o){var s=this,u,l,c,f,p,d,h,g,m,E;o===void 0&&(o={});var y=now(),v=createUuid();this.panoResources[v]=r;var A=1,b,T,_;if(this.locationMotion.ended){var S=this.locationMotion.getKeyFrameSegment(y);S[0];var w=S[1],R=this.locationMotion.value,I=this.panoResourceFromLocationMotionKeyframe(w).position,H=r.position;b=Math.max(I.distanceTo(H),A),T=[{key:w.key,progress:0,value:__assign(__assign({},R),{count:0})},{key:v,progress:1,value:{distance:0,count:1}}],_=0}else{var C=this.locationMotion.getKeyFrameSegment(y),M=C[0],w=C[1],R=this.locationMotion.value,B=this.panoResourceFromLocationMotionKeyframe(M).position,I=this.panoResourceFromLocationMotionKeyframe(w).position,H=r.position,L=w.value.count-R.count,O=Math.max(B.distanceTo(I),A)*L,k=Math.max(I.distanceTo(H),A);b=O+k,T=[{key:M.key,progress:0,value:__assign({},R)},{key:w.key,progress:O/b,value:w.value},{key:v,progress:1,value:{count:w.value.count+1,distance:0}}];var D=this.locationMotionKeyframesLength(this.locationMotion.keyframes),q=this.locationMotionKeyframesLength(T);_=this.locationMotion.getProgressVelocity(y)*D/q}var z=r.effect==="instant"?0:this.calculateMovingDuration(o.duration,r.effect==="fly"||r.effect==="model"?b:0),J={longitude:o.longitude,latitude:o.latitude,fov:o.fov},V=__assign(__assign({},e),{mode:this.mode,longitude:(u=J.longitude)!==null&&u!==void 0?u:this.camera.pose.longitude,latitude:(l=J.latitude)!==null&&l!==void 0?l:this.camera.pose.latitude,fov:(c=J.fov)!==null&&c!==void 0?c:this.camera.pose.fov,offset:r.position.clone(),distance:0}),U=this.currentPano;if(this.emit("pano.moveTo",createEvent("pano.moveTo",{options:o,prevPano:U,progress:0,state:V,userAction:this.userAction,error:null})),o.moveStartCallback&&o.moveStartCallback(V),this.videoTexture&&this.videoTexture.image instanceof HTMLVideoElement&&this.videoTexture.image.getAttribute("src")&&(this.videoTexture.image.pause(),this.videoTexture.image.removeAttribute("uuid"),this.videoTexture.image.removeAttribute("src"),this.videoTexture.image.oncanplay=noop,this.videoTexture.needsUpdate=!0),this.panoVideo.setMaterial(null),r.effect==="fly"||r.effect==="model")this.cameraMotion.set(J,z).catch(noop);else{var j=coordinatesToVector({longitude:this.cameraMotion.value.longitude,latitude:this.cameraMotion.value.latitude}),K=coordinatesToVector({longitude:(f=J.longitude)!==null&&f!==void 0?f:this.cameraMotion.value.longitude,latitude:(p=J.latitude)!==null&&p!==void 0?p:this.cameraMotion.value.latitude}),ae=new THREE__namespace.Object3D;ae.lookAt(j);var re=new THREE__namespace.Matrix4().makeRotationFromQuaternion(ae.quaternion);ae.lookAt(K);var ee=new THREE__namespace.Matrix4().makeRotationFromQuaternion(ae.quaternion),Z=new THREE__namespace.Matrix4().getInverse(re).premultiply(ee),X=this.cameraMotion.value.fov,se=(d=J.fov)!==null&&d!==void 0?d:this.cameraMotion.value.fov,G=1;r.effect==="zoomin"?G=1.5:r.effect==="zoomout"&&(G=.4);for(var W=se*G,$=0;$<T.length-1;$++){var ne=T[$].key;if(ne){var te=this.panoResources[ne];te&&(te.fixCameraTransform.copy(Z),te.leftPanoPicture&&(te.leftPanoPicture.zoom=Math.tan(W/2/180*Math.PI)/Math.tan(X/2/180*Math.PI)))}}this.cameraMotion.setKeyframes([{progress:0,value:{longitude:this.cameraMotion.value.longitude,latitude:this.cameraMotion.value.latitude,fov:this.cameraMotion.value.fov}},{progress:0,value:{longitude:(h=J.longitude)!==null&&h!==void 0?h:this.cameraMotion.value.longitude,latitude:(g=J.latitude)!==null&&g!==void 0?g:this.cameraMotion.value.latitude,fov:W}},{progress:1,value:{longitude:(m=J.longitude)!==null&&m!==void 0?m:this.cameraMotion.value.longitude,latitude:(E=J.latitude)!==null&&E!==void 0?E:this.cameraMotion.value.latitude,fov:se}}],z).catch(noop)}var ve=this.locationMotion.setKeyframes(T,z,_);ve.then(function(){for(var oe=0,fe=s.modelScene.children;oe<fe.length;oe++){var be=fe[oe];be instanceof Model&&be.show()}var ie=__assign(__assign({},e),{mode:s.mode,longitude:s.camera.pose.longitude,latitude:s.camera.pose.latitude,fov:s.camera.pose.fov,offset:s.camera.pose.offset.clone(),distance:0});s.emit("pano.arrived",createEvent("pano.arrived",{options:o,prevPano:U,progress:1,state:ie,userAction:s.userAction,error:null})),o.moveEndCallback&&o.moveEndCallback(ie);var ue=s.works.getObserver(s.currentPano);if(ue&&ue.images.video&&s.videoTexture&&s.videoTexture.image instanceof HTMLVideoElement){var me={map:s.videoTexture,size:ue.images.video.size.clone(),matrix:ue.images.video.matrix.clone(),panoMatrix:ue.matrix.clone().premultiply(ue.work.transform),alpha:1},ge=createUuid(),Ae=s.videoTexture.image;Ae.setAttribute("uuid",ge),canplayVideo().then(function(xe){xe&&ue.images.video&&Ae.getAttribute("uuid")===ge&&(Ae.oncanplay=function(){Ae.oncanplay=noop,Ae.play()},Ae.ontimeupdate=function(){Ae.currentTime>.5&&(Ae.ontimeupdate=noop,s.panoVideo.setMaterial(me))},Ae.src=ue.images.video.source)}).catch((function(){Ae.removeAttribute("uuid")}))}},function(){s.emit("pano.cancel",createEvent("pano.cancel",{options:o,prevPano:U,progress:0,state:V,userAction:s.userAction,error:null})),o.moveCancelCallback&&o.moveCancelCallback()})},t.prototype.checkSelectedPano=function(e){var r=this,o;this.stopMomentumMovement(),this.camera.getDirection(new THREE__namespace.Vector3).setY(0);var s=null,u=this.works.getObserver(this.currentPano);if(!u)return null;var l=u.work.observers,c=u.accessibleNodes.filter(function(_){if(_===r.currentPano.panoIndex&&u.work.workCode===r.currentPano.workCode)return!1;var S=l[_];if(!S)return!1;var w=scratchVector3.copy(S.position).applyMatrix4(S.work.transform);return w.distanceTo(r.camera.position)>r.maxAccessibleDistance?!1:S.loadable||S.active}),f=this.modelScene.intersectRaycaster(e)[0];if(f){var p=arrayMin(c,function(_){var S=l[_];if(!S)return 1/0;var w=scratchVector3.copy(S.standingPosition).applyMatrix4(S.work.transform);return w.distanceTo(f.point)},!0),d=p[0],h=p[1];typeof d=="number"&&h<this.panoTapTriggerRadius&&(s=(o=l[d])!==null&&o!==void 0?o:null)}if(isNil(s)){var g=this.getForwardObserverOrNot(this.xrManager.cameraVR,e);g&&(s=g)}for(var m=0,E=this.locationMotion.keyframes;m<E.length;m++){var y=E[m],v=this.panoResourceFromLocationMotionKeyframe(y);if(!(y.progress<this.locationMotion.progress)&&s){var A=panoStringify({panoIndex:s.panoIndex,workCode:s.work.workCode});if(v.panoId===A){s=null;break}}}if(isNil(s))return this.locationMotion.ended===!0&&this.cameraBounce(),null;if(!s.active){var A=panoStringify({panoIndex:s.panoIndex,workCode:s.work.workCode}),b=this.panoMeshes.get(A);b&&(b.setDisabled(!1),b.setLoading(!0))}var T={workCode:s.work.workCode,panoIndex:s.panoIndex,mode:this.mode,longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude,fov:this.camera.pose.fov,distance:0,offset:s?s.position.clone():new THREE__namespace.Vector3};return this.emit("pano.select",createEvent("pano.select",{prevPano:this.currentPano,state:T,userAction:!0,options:{},progress:0,error:null})),s&&s.active?(this.emit("pano.request",createEvent("pano.request",{userAction:!0,prevPano:this.currentPano,progress:0,state:T,options:{},error:null})),{workCode:s.work.workCode,panoIndex:s.panoIndex}):null},t.prototype.destroy=function(){n.prototype.destroy.call(this)},t.prototype.isReady=function(){return!1},t.prototype.updateCamera=function(e,r,o){return Promise.resolve()},t.prototype.updateCameraWithKeyframes=function(e,r,o){return Promise.resolve()},t.prototype.updateTime=function(e,r){for(var o=this,s,u,l,c,f,p,d,h,g,m=[],E=2;E<arguments.length;E++)m[E-2]=arguments[E];this.userAction=!0;var y={},v={},A=this.camera.getDirection(new THREE__namespace.Vector3),b=this.locationMotion.keyframes[0],T=this.locationMotion.keyframes[this.locationMotion.keyframes.length-1],_=this.locationMotion.getKeyFrameSegment(e),S=_[0],w=_[1],R=this.panoResourceFromLocationMotionKeyframe(S),I=this.panoResourceFromLocationMotionKeyframe(w),H=this.panoResourceFromLocationMotionKeyframe(b),C=this.panoResourceFromLocationMotionKeyframe(T),M=!1;if(this.cameraMotion.ended===!1&&(this.cameraMotion.update(e),v.fov=this.cameraMotion.value.fov),this.modelAlphaMotion.ended===!1&&(this.modelAlphaMotion.update(e),y.modelAlpha=this.modelAlphaMotion.value.modelAlpha),this.perspToOrthoMotion.ended===!1&&(this.perspToOrthoMotion.update(e),this.camera.perspToOrtho.setScalar(clamp$1(this.perspToOrthoMotion.value.perspToOrtho,0,1))),this.locationMotion.ended===!1){this.locationMotion.update(e);var B=this.locationMotion.value.count-w.value.count+1,L=new THREE__namespace.Vector3().copy(R.position),O=new THREE__namespace.Vector3().copy(I.position);if(y.progress=B,B>=.01&&B<=.99&&(y.progress=clamp$1(I.effectEasing(B),.01,.99)),I.leftPanoPicture&&(B<1?R.leftPanoPicture&&(y.pano0=R.leftPanoPicture):y.pano0=I.leftPanoPicture,y.pano1=I.leftPanoPicture),I.effect==="montage"?y.transition="BLACK":I.effect==="spread"?y.transition="SPREAD":y.transition="FADE",I.effect==="zoomin"||I.effect==="zoomout")y.progress=Math.pow(B,3);else if(I.effect==="model"&&this.camera.pose.distance<.01){var k=1-Math.pow(clamp$1(Math.abs(B-.5)*2,0,1),4);y.modelAlpha=k}if(B<1&&I.effect!=="fly"){if(y.pano0&&R.leftPanoPicture){var D={panoId:y.pano0.panoId,map:y.pano0.map,mapSize:y.pano0.mapSize,zoom:y.pano0.zoom,matrix:R.leftPanoPicture.matrix.clone().setPosition(I.position)},q=this.panoPictureObserverMap.get(y.pano0);q&&this.panoPictureObserverMap.set(D,q),y.pano0=D}L.copy(O),M=!0}v.distance=this.locationMotion.value.distance,v.offset=new THREE__namespace.Vector3(L.x+(O.x-L.x)*B,L.y+(O.y-L.y)*B,L.z+(O.z-L.z)*B);for(var z=[],J=[],V=0,U=this.locationMotion.keyframes;V<U.length;V++){var j=U[V],K=j.key,ae=j.progress;K!==void 0&&(z.push(K),ae>this.locationMotion.progress&&J.push(K))}for(var re=0,ee=Object.keys(this.panoResources);re<ee.length;re++){var Z=ee[re];if(!(J.indexOf(Z)>=0)){var X=this.panoResources[Z];if(X.leftPanoPicture){var se=X.leftPanoPicture.map;if(se){if(se===((s=y.pano0)===null||s===void 0?void 0:s.map)||se===((u=y.pano1)===null||u===void 0?void 0:u.map))continue;se.dispose(),X.leftPanoPicture=null}}z.indexOf(Z)>=0||delete this.panoResources[Z]}}var G=panoParse(I.panoId);G!==this.currentPano&&(this.currentPano=G,this.accessibleObserverFloorCheckCount=0),this.emit("pano.moving",createEvent("pano.moving",{userAction:this.userAction,prevPano:panoParse(H.panoId),state:__assign(__assign(__assign(__assign({},panoParse(C.panoId)),{mode:this.mode}),clonePose(this.camera.pose)),v),options:{},progress:this.locationMotion.progress,error:null}))}this.camera.setFromPose(v),this.xrManager.cameraVR.projectionMatrix.copy(this.camera.projectionMatrix),this.xrManager.cameraVR.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),this.xrManager.cameraVR.matrix.copy(this.camera.matrix),this.xrManager.cameraVR.position.copy(this.camera.position),this.xrManager.cameraVR.quaternion.copy(this.camera.quaternion),this.xrManager.cameraVR.scale.copy(this.camera.scale),this.xrManager.cameraVR.matrixAutoUpdate=!1,this.xrManager.cameraVR.matrixWorld.copy(this.camera.matrixWorld);var W=m,$=W[1],ne=new THREE__namespace.Vector3(0,0,0),te=new THREE__namespace.Vector2().copy(this.camera.resolution);if($&&this.xrManager.session&&this.xrManager.referenceSpace&&this.xrManager.session.renderState.baseLayer){for(var ve=this.xrManager.cameraVR,oe=this.xrManager.referenceSpace,fe=this.xrManager.session.renderState.baseLayer,be=$.getViewerPose(oe),ie=(l=be==null?void 0:be.views)!==null&&l!==void 0?l:[],ue=0;ue<ie.length;ue++){var me=ie[ue],ge=ve.cameras[ue],Ae=fe.getViewport(me);Ae&&(ge.projectionMatrix.fromArray(me.projectionMatrix),ge.projectionMatrixInverse.getInverse(ge.projectionMatrix),ge.matrix.fromArray(me.transform.matrix),ge.matrix.setPosition(this.camera.position),ge.matrix.decompose(ge.position,ge.quaternion,ge.scale),ge.matrixWorld.copy(ge.matrix),ge.matrixWorldInverse.getInverse(ge.matrixWorld),ge.matrixAutoUpdate=!1,ne.copy(ge.position),ge.viewport.set(Ae.x,Ae.y,Ae.width,Ae.height),te.set(Ae.width,Ae.height))}if(this.xrManager.setProjectionFromUnion(this.xrManager.cameraVR,this.xrManager.cameraL,this.xrManager.cameraR),this.camera.quaternion.copy(this.xrManager.cameraVR.quaternion),this.camera.scale.copy(this.xrManager.cameraVR.scale),this.camera.matrix.compose(this.camera.position,this.camera.quaternion,this.camera.scale),this.camera.computePose((c=v.distance)!==null&&c!==void 0?c:this.camera.pose.distance),this.xrManager.session.inputSources){for(var ue=0;ue<this.xrManager.session.inputSources.length;ue++)if(this.xrManager.session.inputSources[ue]&&this.xrManager.session.inputSources[ue].targetRayMode==="transient-pointer"){var xe=$.getPose(this.xrManager.session.inputSources[ue].targetRaySpace,oe);if(xe){var de=xe.transform.orientation,_e=new THREE__namespace.Quaternion(de.x,de.y,de.z,de.w),He=new THREE__namespace.Vector3(0,0,-1).applyQuaternion(_e),Ee=new THREE__namespace.Raycaster(this.camera.position,He);this.gazeRay=Ee}}}if(this.xrManager.machineType==="Oculus"||this.xrManager.machineType==="Pico"){for(var pe=this.xrManager.session.inputSources,Ve=function(he){var Ie=ye.xrManager.controllers[he],Re=pe[he];if(!Re)return"continue";Ie&&Ie.update(Re,$,oe);var qe=ye.xrManager.getController(he),Ye=new THREE__namespace.Vector3(0,1.2,0),ut=qe.position.clone().add(ne).sub(Ye);Re.handedness==="left"?ye.xrControllerRay.left.set(ut,new THREE__namespace.Vector3(0,0,-1).applyEuler(qe.rotation)):Re.handedness==="right"&&ye.xrControllerRay.right.set(ut,new THREE__namespace.Vector3(0,0,-1).applyEuler(qe.rotation)),ye.controllerWrappers[he].position.copy(new THREE__namespace.Vector3(0,0,0).add(ne).sub(Ye));var Ke=ye.modelScene.intersectRaycaster(ye.xrControllerRay.right);if(Ke.length===0){var dt=ye.works.getResolvedObserver(ye.currentPano);Ke=ye.xrControllerRay.right.intersectObject(ye.modelScene.boundingMesh,!0).map(function(Ge){var Ze,De=(Ze=dt==null?void 0:dt.floorIndex)!==null&&Ze!==void 0?Ze:0;return __assign({floorIndex:De,floor:De},Ge)})}if(Ke.length>=1&&Ke[0].face)if(Re.handedness==="right"){var Pt=ye.xrControllerRay.right.intersectObject(ye.xrCustomObjectsScene,!0),P=Ke[0].face.normal,F=P.clone(),N=Ke[0].point.clone();ye.intersectMesh.position.copy(N);var Q=N.clone().add(F);if(ye.intersectMesh.lookAt(Q),Math.abs(P.y)>.99){var Y=ye.camera.position.clone().sub(N);ye.intersectMesh.rotation.z=-Math.atan2(Y.z,Y.x)}ye.intersectMesh.visible=!0,ye.needsRender=!0,Pt.length>0?(ye.pointerLines.right.setPoints(ut,Pt[0].point),ye.pointerLines.right.points.visible=!0,ye.intersectMesh.visible=!1):(ye.pointerLines.right.points.visible=!1,ye.pointerLines.right.setPoints(ut,Ke[0].point));var le=Ke[0],Te=createEvent("intersect.update",{raycaster:(f=ye.xrControllerRay.right)!==null&&f!==void 0?f:null,intersection:le!=null?le:null,object:ye.intersectMesh});if(ye.emit("intersect.update",Te),Te.defaultPrevented)return ye.hideIntersectMesh(),{value:void 0}}else ye.pointerLines.left.setPoints(ut,Ke[0].point)},ye=this,ue=0;ue<pe.length;ue++){var Pe=Ve(ue);if(typeof Pe=="object")return Pe.value}this.updateControllerHelper(pe,e,r)}}else $||console.error("xrFrame丢失,请重试"),this.xrManager.session||console.error("session丢失,请重试"),this.xrManager.session&&!this.xrManager.session.renderState.baseLayer&&console.error("no layer found");isEmptyObject(y)===!1&&this.modelScene.parameter.set(y),this.emit("camera.update",createEvent("camera.update",{userAction:this.userAction,state:__assign(__assign(__assign({},this.currentPano),{mode:this.mode}),clonePose(this.camera.pose))}));var Ce=this.works.getResolvedObserver(this.currentPano),$e=this.locationMotion.ended?this.getForwardObserverOrNot(this.xrManager.cameraVR):null,Se=this.works.getObserver(R.panoId),ze=this.works.getObserver(I.panoId);if(this.adjustPanoCircleMeshPositionBasedOnModel&&this.helper.visible&&Ce){for(var Fe=[],Oe=Ce.work.observers,Le=0,Ue=Ce.accessibleNodes;Le<Ue.length;Le++){var tt=Ue[Le],q=Oe[tt];q&&Fe.push(q)}var lt=new Map;if(Fe.sort(function(he,Ie){var Re=lt.get(he);typeof Re=="undefined"&&(Re=he.standingPosition.distanceTo(Ce.standingPosition),lt.set(he,Re));var qe=lt.get(he);return typeof qe=="undefined"&&(qe=Ie.standingPosition.distanceTo(Ce.standingPosition),lt.set(Ie,qe)),Re-qe}),Fe.length){this.accessibleObserverFloorCheckCount=this.accessibleObserverFloorCheckCount%Fe.length;var nt=Fe[this.accessibleObserverFloorCheckCount],ot=this.modelScene.models.find(function(he){return he.work===(nt==null?void 0:nt.work)});if(nt&&ot&&ot.visible){var At=.3,We=.05,Mt=.005,Be=nt.standingPosition.clone().applyMatrix4(nt.work.transform),Ne=panoStringify({panoIndex:nt.panoIndex,workCode:nt.work.workCode}),bt=adjustPanoCircleMeshVectors.map(function(he){scratchRaycaster.ray.origin.copy(Be),scratchRaycaster.ray.origin.add(scratchVector3.copy(he).setY(At)),scratchRaycaster.ray.direction.set(0,-1,0),scratchRaycaster.firstHitOnly=!0,scratchRaycaster.floorIndex=-1;var Ie=ot.intersectRaycaster(scratchRaycaster)[0];return Ie&&Ie.distance-Mt<=At?new THREE__namespace.Vector3().copy(Be).setY(Ie.point.y+Mt):Be});bt.sort(function(he,Ie){return Ie.y-he.y});var Ct=bt[Math.floor(bt.length/2)],xt=bt.filter(function(he){return he.distanceTo(Ct)<=We})[0];if(xt){var yt=new THREE__namespace.Vector4(Be.x,Be.y,Be.z,xt.y-Be.y),St=this.adjustPanoCircleMeshPositionFix.get(Ne);St&&!yt.equals(St)&&(this.needsRender=!0),this.adjustPanoCircleMeshPositionFix.set(Ne,yt)}}this.accessibleObserverFloorCheckCount++}}var rt=new Map;if(Se)for(var at=0,ct=Se.accessibleNodes;at<ct.length;at++){var tt=ct[at],q=Se.work.observers[tt];if(q){var Ne=panoStringify({panoIndex:q.panoIndex,workCode:q.work.workCode});rt.set(Ne,q)}}if(ze)for(var Xe=0,ce=ze.accessibleNodes;Xe<ce.length;Xe++){var tt=ce[Xe],q=ze.work.observers[tt];if(q){var Ne=panoStringify({panoIndex:q.panoIndex,workCode:q.work.workCode});rt.set(Ne,q)}}if(this.panoMeshes.forEach(function(he,Ie){var Re=rt.get(Ie);Re?rt.delete(Ie):(o.helper.remove(he),he.dispose(),o.panoMeshes.delete(Ie))}),rt.forEach(function(he,Ie){var Re=o.panoCircleMeshCreator(he,{aerialObserverMinHeight:o.aerialObserverMinHeight});o.panoMeshes.set(Ie,Re),o.helper.add(Re),rt.delete(Ie)}),this.panoMeshes.forEach(function(he,Ie){var Re=o.works.getObserver(Ie);if(Re){var qe=Re.position.distanceTo(Re.standingPosition)>o.aerialObserverMinHeight;if(qe)he.position.copy(Re.position).applyMatrix4(Re.work.transform),he.scale.setScalar(18);else{he.position.copy(Re.standingPosition).applyMatrix4(Re.work.transform);var Ye=o.adjustPanoCircleMeshPositionFix.get(Re.panoId);Ye&&(scratchVector3.set(Ye.x,Ye.y,Ye.z),scratchVector3.equals(he.position)&&(he.position.y+=Ye.w)),he.scale.setScalar(1.2)}var ut=o.camera.position.clone().setY(he.position.y),Ke=new THREE__namespace.Vector3().copy(he.position).sub(ut).normalize();if(Ie===panoStringify(o.currentPano)){var dt=clamp$1((.5-ut.distanceTo(he.position))/.5,0,1);Ke.multiplyScalar(1-dt).add(A.clone().multiplyScalar(dt))}if(Ke.length()>0){var Pt=qe?-Math.PI/2:0,P=Math.atan2(Ke.x,Ke.z);he.quaternion.setFromEuler(new THREE__namespace.Euler(Pt,P,0,"YXZ"))}}else he.visible=!1}),this.camera.pose.distance>.1||M)this.panoMeshes.forEach(function(he){he.setOpacity(0),he.setCurrent(!1),he.updateTime&&he.updateTime(e,r),he.visible=!1});else if(Ce){var we=Ce.work.observers,Me=arrayMin(Ce.accessibleNodes,function(he){var Ie=we[he];return Ie?Ce.standingPosition.distanceTo(Ie.standingPosition):1/0},!0),ke=Me[1];ke=clamp$1(ke,2.5,1/0);var je=Ce.accessibleNodes.concat(Ce.panoIndex).map(function(he){return panoStringify({panoIndex:he,workCode:Ce.work.workCode})});this.panoMeshes.forEach(function(he,Ie){var Re=o.works.getObserver(Ie),qe=!1,Ye=1;if(je.indexOf(Ie)===-1)qe=!1,Ye=0;else if(!Re)qe=!1,Ye=0;else if(!Re.loadable&&!Re.active)qe=!1,Ye=0;else{var ut=he.position.clone().project(o.camera),Ke=Math.abs(ut.x)<1&&Math.abs(ut.y)<1&&Math.abs(ut.z)<1;qe=Ke&&!he.loading&&he.progress===0&&$e!==null&&panoStringify({panoIndex:$e.panoIndex,workCode:$e.work.workCode})===Ie;var dt=he.position.clone().setY(o.camera.position.y).distanceTo(o.camera.position);Ye=dt<.01?0:clamp$1(ke/dt,.1,.85)}if(Re&&Re===ze){var Pt=Re.position.distanceTo(Re.standingPosition)>o.aerialObserverMinHeight;if(Pt){var dt=he.position.distanceTo(o.camera.position);dt<35&&(Ye=0)}}o.modelScene.parameter.resolveValue().modelAlpha>0&&(Ye=0),he.setCurrent(qe),he.setOpacity(Ye),he.updateTime&&he.updateTime(e,r)})}{var B=(p=this.modelScene.parameter.progress)!==null&&p!==void 0?p:1,st=Math.round(B),Qe=this.modelScene.parameter.pano0,Je=this.modelScene.parameter.pano1,ft=st===0?Qe:Je,q=void 0;if(ft&&(q=this.works.getObserver(ft.panoId),q||(q=this.panoPictureObserverMap.get(ft))),this.tiling.appearDuration=this.tileAppearDuration,this.tiling.maxRequest=B<(canUseNativeImageBitmap()?.6:.99)?0:this.tileMaxRequest,this.tiling.imageOptions=this.imageOptions,!q||!ft||this.tileLevelForFov===!1||this.camera.perspToOrtho.x>0){this.tiling.setObserver(null);var Bt={renderer:this.renderer,resolution:te,pixelRatio:1,time:this.camera.time,cameraMatrix:this.xrManager.cameraVR.matrixWorld,cameraProjectionMatrix:this.xrManager.cameraVR.projectionMatrix,panoMap:null,panoMatrix:new THREE__namespace.Matrix4,panoZoom:1,minLevel:0,level:0};this.tiling.update(Bt),this.modelScene.parameter.set("refinedScreen",null)}else{var Ft=getImageSizeLevel(ft.mapSize),pt=Ft+1,It=4;this.tiling.setObserver(q);var Bt={renderer:this.renderer,resolution:te,pixelRatio:1,time:this.camera.time,cameraMatrix:this.xrManager.cameraVR.matrixWorld,cameraProjectionMatrix:this.xrManager.cameraVR.projectionMatrix,panoMap:ft.map,panoMatrix:ft.matrix,panoZoom:ft.zoom,minLevel:pt,level:It},Tt=this.tiling.update(Bt),ht={map:this.tiling.renderTarget.texture,matrixInverse:this.tiling.camera.matrixWorldInverse,projectionMatrix:this.tiling.camera.projectionMatrix,pano:st,opacity:(Qe==null?void 0:Qe.panoId)===(Je==null?void 0:Je.panoId)?1:easeInQuart(Math.abs(((d=this.modelScene.parameter.progress)!==null&&d!==void 0?d:0)-.5)*2)},mt=this.modelScene.parameter.refinedScreen;(Tt||ht.pano!==(mt==null?void 0:mt.pano)||ht.opacity!==(mt==null?void 0:mt.opacity))&&this.modelScene.parameter.set("refinedScreen",ht)}}if(this.panoVideo.object.position.copy(this.camera.position),this.panoVideo.updateTime(e),this.intersectMesh&&this.intersectMesh.parent&&Ce&&Ce.position.y-Ce.standingPosition.y>10){var gt=this.camera.position.distanceTo(this.intersectMesh.position),Et=2*Math.tan(.5*this.camera.fov/180*Math.PI),Lt=clamp$1(gt*Et/5,.5);this.intersectMesh.scale.setScalar(Lt)}else this.intersectMesh.scale.setScalar(1);{var Ot=I.effect,Ht=this.modelScene.parameter,Qe=Ht.pano0,Je=Ht.pano1;if(Qe&&Je&&Qe!==Je&&(Ot==="fly"||Ot==="model")&&this.flyEffectUseDepthBuffer){if(((h=this.modelScene.parameter.pano0Depth)===null||h===void 0?void 0:h.panoId)!==Qe.panoId||((g=this.modelScene.parameter.pano1Depth)===null||g===void 0?void 0:g.panoId)!==Je.panoId){var it=500,vt=512;this.pano0DepthCubeRenderTarget?this.pano0DepthCubeRenderTarget.width!==vt&&this.pano0DepthCubeRenderTarget.setSize(vt,vt):this.pano0DepthCubeRenderTarget=new THREE__namespace.WebGLCubeRenderTarget(vt,{minFilter:THREE__namespace.NearestFilter,magFilter:THREE__namespace.NearestFilter,generateMipmaps:!1}),this.pano1DepthCubeRenderTarget?this.pano1DepthCubeRenderTarget.width!==vt&&this.pano1DepthCubeRenderTarget.setSize(vt,vt):this.pano1DepthCubeRenderTarget=new THREE__namespace.WebGLCubeRenderTarget(vt,{minFilter:THREE__namespace.NearestFilter,magFilter:THREE__namespace.NearestFilter,generateMipmaps:!1});var Rt=new THREE__namespace.CubeCamera(this.camera.near,this.camera.far,this.pano0DepthCubeRenderTarget);Rt.matrix.copy(Qe.matrix),Rt.matrixWorld.copy(Rt.matrix),Rt.matrixAutoUpdate=!1,renderDepthCube(this.renderer,this.modelScene,Rt,it);var wt=new THREE__namespace.CubeCamera(this.camera.near,this.camera.far,this.pano1DepthCubeRenderTarget);wt.matrix.copy(Je.matrix),wt.matrixWorld.copy(wt.matrix),wt.matrixAutoUpdate=!1,renderDepthCube(this.renderer,this.modelScene,wt,it),this.modelScene.parameter.set({pano0Depth:{panoId:Qe.panoId,map:this.pano0DepthCubeRenderTarget.texture,mapSize:this.pano0DepthCubeRenderTarget.width,maxDepth:it},pano1Depth:{panoId:Je.panoId,map:this.pano1DepthCubeRenderTarget.texture,mapSize:this.pano1DepthCubeRenderTarget.width,maxDepth:it}})}}else this.modelScene.parameter.set({pano0Depth:null,pano1Depth:null}),this.flyEffectUseDepthBuffer||(this.pano0DepthCubeRenderTarget&&(this.pano0DepthCubeRenderTarget.dispose(),this.pano0DepthCubeRenderTarget=void 0),this.pano1DepthCubeRenderTarget&&(this.pano1DepthCubeRenderTarget.dispose(),this.pano1DepthCubeRenderTarget=void 0))}},t.prototype.render=function(){if(this.xrManager.session&&this.xrManager.session.renderState.baseLayer){var e=this.xrManager.session.renderState.baseLayer;return this.renderer.setRenderTarget(null),this.renderer.setScissorTest(!1),this.renderer.setFramebuffer(e.framebuffer),this.renderer.render(this.scene,this.xrManager.cameraVR),this.renderer.setFramebuffer(null),!0}return!1},t.prototype.onPanGesture=function(){},t.prototype.onTapGesture=function(){},t.prototype.onPinchGesture=function(){},t.prototype.onMouseMove=function(){},t.prototype.onMouseOut=function(){},t.prototype.panoResourceFromLocationMotionKeyframe=function(e){return this.panoResources[e.key]},t.prototype.updateControllerHelper=function(e,r,o){var s=this.xrControllerRay.left,u=this.xrControllerRay.right;if(!(!e||e.length===0)){for(var l={buttons:{X:!1,Y:!1,LeftTrigger:!1,LeftPinch:!1,A:!1,B:!1,RightTrigger:!1,RightPinch:!1}},c=0;c<e.length;c++){var f=e[c].handedness,p=e[c].gamepad;switch(f){case"left":p.axes&&(this.emitHandleEvent(p.axes[2]===-1,"LeftAxesLeft",r),this.emitHandleEvent(p.axes[2]===1,"LeftAxesRight",r),this.emitHandleEvent(p.axes[3]===-1,"LeftAxesUp",r),this.emitHandleEvent(p.axes[3]===1,"LeftAxesDown",r)),p!=null&&p.buttons&&(p.buttons[4]&&this.emitHandleEvent(p.buttons[4].pressed,"X",r),p.buttons[5]&&this.emitHandleEvent(p.buttons[5].pressed,"Y",r),p.buttons[0]&&this.emitHandleEvent(p.buttons[0].pressed,"LeftTrigger",r),p.buttons[1]&&this.emitHandleEvent(p.buttons[1].pressed,"LeftPinch",r));var d={raycaster:s,axes:{up:p.axes&&p.axes[3]<0?Math.abs(p.axes[3]):0,down:p.axes&&p.axes[3]<0?0:Math.abs(p.axes[3]),left:p.axes&&p.axes[2]<0?Math.abs(p.axes[2]):0,right:p.axes&&p.axes[2]<0?0:Math.abs(p.axes[2])},deltaTime:o};l.buttons.X=p.buttons&&p.buttons[4]?p.buttons[4].pressed:!1,l.buttons.Y=p.buttons&&p.buttons[5]?p==null?void 0:p.buttons[5].pressed:!1,l.buttons.LeftTrigger=p.buttons&&p.buttons[0]?p==null?void 0:p.buttons[0].pressed:!1,l.buttons.LeftPinch=p.buttons&&p.buttons[1]?p==null?void 0:p.buttons[1].pressed:!1,l.left=d;break;case"right":p.axes&&(this.emitHandleEvent(p.axes[2]===-1,"RightAxesLeft",r),this.emitHandleEvent(p.axes[2]===1,"RightAxesRight",r),this.emitHandleEvent(p.axes[3]===-1,"RightAxesUp",r),this.emitHandleEvent(p.axes[3]===1,"RightAxesDown",r)),p.buttons&&(p.buttons[4]&&this.emitHandleEvent(p.buttons[4].pressed,"A",r),p.buttons[5]&&this.emitHandleEvent(p.buttons[5].pressed,"B",r),p.buttons[0]&&this.emitHandleEvent(p.buttons[0].pressed,"RightTrigger",r),p.buttons[1]&&this.emitHandleEvent(p.buttons[1].pressed,"RightPinch",r));var h={raycaster:u,axes:{up:p.axes&&p.axes[3]<0?Math.abs(p.axes[3]):0,down:p.axes&&p.axes[3]<0?0:Math.abs(p.axes[3]),left:p.axes&&p.axes[2]<0?Math.abs(p.axes[2]):0,right:p.axes&&p.axes[2]<0?0:Math.abs(p.axes[2])},deltaTime:o};l.right=h,l.buttons.A=p.buttons&&p.buttons[4]?p==null?void 0:p.buttons[4].pressed:!1,l.buttons.B=p.buttons&&p.buttons[5]?p==null?void 0:p.buttons[5].pressed:!1,l.buttons.RightTrigger=p.buttons&&p.buttons[0]?p==null?void 0:p.buttons[0].pressed:!1,l.buttons.RightPinch=p.buttons&&p.buttons[1]?p==null?void 0:p.buttons[1].pressed:!1;break}}this.emit("xr.controller.update",createEvent("xr.controller.update",l))}},t.prototype.emitHandleEvent=function(e,r,o){var s=this.xrControllerRay.left,u=this.xrControllerRay.right;if(e)if(this.xrHandleState[r].touchStart===!1)this.xrHandleState[r].touchStartTime=o,this.xrHandleState[r].touchStart=!0,this.emit("xr.gesture.buttonDown",createEvent("xr.gesture.buttonDown",{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:r,isFinal:!1,isFirst:!0,controllers:{raycaster:{leftRay:s,rightRay:u}}}));else{var l=o-this.xrHandleState[r].touchStartTime;l>CONTROLLER_EVNET_DELTA_TIME&&this.emit("xr.gesture.press",createEvent("xr.gesture.tap",{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:r,isFinal:!0,isFirst:!0,controllers:{raycaster:{leftRay:s,rightRay:u}}}))}else if(this.xrHandleState[r].touchStart===!0){this.emit("xr.gesture.buttonUp",createEvent("xr.gesture.buttonUp",{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:r,isFinal:!0,isFirst:!1,controllers:{raycaster:{leftRay:s,rightRay:u}}}));var l=o-this.xrHandleState[r].touchStartTime;if(l<=CONTROLLER_EVNET_DELTA_TIME){var c=createEvent("xr.gesture.tap",{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:r,isFinal:!0,isFirst:!1,controllers:{raycaster:{leftRay:s,rightRay:u}}}),f=this.emit("xr.gesture.tap",c);!f&&!c.defaultPrevented&&r==="RightTrigger"&&this.checkSelectedPano(this.xrControllerRay.right)}this.xrHandleState[r].touchStart=!1,this.xrHandleState[r].touchStartTime=0}},t.prototype.initHandEvent=function(){var e=this;if(!this.xrManager.session)throw new Error("初始化失败");this.xrManager.session.addEventListener("select",function(r){e.gazeRay&&e.checkSelectedPano(e.gazeRay)})},t})(PanoramaController),Controllers={Floorplan:FloorplanController,Topview:TopviewController,Panorama:PanoramaController,VRPanorama:VRPanoramaController,Model:ModelController,Mapview:MapviewController,XRPanorama:XRPanoramaController},controllersDefaultInitArgs={Floorplan:defaultFloorplanControllerCustomInitArgs,Topview:defaultTopviewControllerCustomInitArgs,Panorama:defaultPanoramaControllerCustomInitArgs,VRPanorama:defaultVRPanoramaControllerCustomInitArgs,Model:defaultModelControllerCustomInitArgs,Mapview:defaultMapviewControllerCustomInitArgs,XRPanorama:defaultXRPanoramaControllerInitArgs},PROXY_CONTROLLER_EVENT_NAMES=["gesture.pan","gesture.tap","gesture.dbltap","gesture.press","gesture.pinch","gesture.mousewheel","gesture.mousemove","gesture.momentum","initAnimation.start","initAnimation.end","camera.update","intersect.update","pano.select","pano.moveTo","pano.moving","pano.arrived","pano.cancel","pano.error","pano.texture.load","pano.texture.progress","pano.texture.success","pano.texture.error","pano.texture.abort","xr.session.start","xr.session.end","xr.gesture.tap","xr.gesture.press","xr.gesture.buttonUp","xr.gesture.buttonDown","xr.controller.update"];function initLegacyEvent(n){n.on("initAnimation.start",function(t){n.emit("initAnimationWillStart",t.state.panoIndex,t.state,t.userAction)}),n.on("initAnimation.end",function(t){n.emit("initAnimationEnded",t.state.panoIndex,t.state,t.userAction)}),n.on("gesture.pan",function(t){var e=!1;e=n.emit("wantsGesture","pan",t.pointers,t.isFinal),e&&t.preventDefault(),e=n.emit("wantsPanGesture",t.state,t.isFinal),e&&t.preventDefault(),t.defaultPrevented||(n.emit("gesture","pan",t.pointers,t.isFinal),n.emit("panGesture",t.state,t.isFinal))}),n.on("gesture.tap",function(t){var e=!1;e=n.emit("wantsGesture","tap",t.pointers,t.isFinal),e&&t.preventDefault(),e=n.emit("wantsTapGesture",t.center.raycaster,t.center.coords,t.isFinal),e&&t.preventDefault(),t.defaultPrevented||(n.emit("gesture","tap",t.pointers,t.isFinal),n.emit("tapGesture",t.center.raycaster,t.center.coords,t.isFinal))}),n.on("gesture.dbltap",function(t){var e=!1;e=n.emit("wantsGesture","dbltap",t.pointers,t.isFinal),e&&t.preventDefault(),e=n.emit("wantsDblTapGesture",t.center.raycaster,t.center.coords,t.isFinal),e&&t.preventDefault(),t.defaultPrevented||(n.emit("gesture","dbltap",t.pointers,t.isFinal),n.emit("dblTapGesture",t.center.raycaster,t.center.coords,t.isFinal))}),n.on("gesture.press",function(t){var e=!1;e=n.emit("wantsGesture","press",t.pointers,t.isFinal),e&&t.preventDefault(),e=n.emit("wantsPressGesture",t.center.raycaster,t.center.coords,t.center.delta,t.isFinal),e&&t.preventDefault(),t.defaultPrevented||(n.emit("gesture","press",t.pointers,t.isFinal),n.emit("pressGesture",t.center.raycaster,t.center.coords,t.center.delta,t.isFinal))}),n.on("gesture.pinch",function(t){var e=!1;e=n.emit("wantsGesture","pinch",t.pointers,t.isFinal),e&&t.preventDefault(),e=n.emit("wantsPinchGesture",t.scale,t.state.fov,t.isFinal),e&&t.preventDefault(),t.defaultPrevented||(n.emit("gesture","pinch",t.pointers,t.isFinal),n.emit("pinchGesture",t.scale,t.state.fov,t.isFinal))}),n.on("gesture.mousewheel",function(t){var e=!1;e=n.emit("wantsGesture","mouseWheel",t.pointers,t.isFinal),e&&t.preventDefault(),e=n.emit("wantsMouseWheel",t.center.delta,t.state.fov,t.isFinal),e&&t.preventDefault(),t.defaultPrevented||(n.emit("gesture","mouseWheel",t.pointers,t.isFinal),n.emit("mouseWheel",t.center.delta,t.state.fov,t.isFinal))}),n.on("gesture.mousemove",function(t){var e=!1;e=n.emit("wantsGesture","mouseMove",t.pointers,t.isFinal),e&&t.preventDefault(),t.defaultPrevented||(n.emit("gesture","mouseMove",t.pointers,t.isFinal),e=n.emit("wantsChangeCameraFov",t.state.fov),e&&t.preventDefault())}),n.on("gesture.momentum",function(t){var e=!1;e=n.emit("wantsInteriaPan",t.state),e&&t.preventDefault(),t.defaultPrevented||n.emit("interiaPan",t.state,t.isFinal)}),n.on("camera.update",function(t){n.emit("cameraFovUpdate",t.state.fov,t.userAction),n.emit("cameraDirectionUpdate",t.state,t.userAction);var e=coordinatesToVector(t.state);e.setLength(t.state.distance);var r=t.state.offset.clone().sub(e);n.emit("cameraPositionUpdate",r,t.userAction),n.emit("cameraUpdate",t.state,t.userAction)}),n.on("intersect.update",function(t){if(t.intersection){var e=!1;e=n.emit("wantsShowIntersectionOnModel",t.raycaster),e&&t.preventDefault(),t.defaultPrevented||n.emit("intersectionOnModelUpdate",t.intersection,t.object)}else n.emit("intersectionHidden")}),n.on("pano.request",function(t){var e=n.emit("wantsMoveToPano",t.state.panoIndex,t.options,t.userAction);e||(e=n.emit("wantsToMoveToPano",t.state.panoIndex,t.options,t.userAction)),e&&t.preventDefault(),t.defaultPrevented||n.emit("panoWillLoad",t.state.panoIndex)}),n.on("pano.select",function(t){n.emit("panoSelected",t.state.panoIndex)}),n.on("pano.moveTo",function(t){n.emit("panoLoaded",t.state.panoIndex),n.emit("moveToPano",t.state.panoIndex,t.userAction),n.emit("panoWillArrive",t.state.panoIndex,t.state,t.userAction)}),n.on("pano.moving",function(t){n.emit("movingToPano",t.state.panoIndex,t.prevPano.panoIndex,t.progress)}),n.on("pano.arrived",function(t){n.emit("panoArrived",t.state.panoIndex,t.state,t.userAction)}),n.on("pano.cancel",function(t){n.emit("moveToPanoCanceled",t.state.panoIndex)}),n.on("pano.error",function(t){n.emit("panoLoadError",t.error,t.state.panoIndex)}),n.on("pano.texture.load",function(t){n.emit("textureStartLoad",t.pano.panoIndex)}),n.on("pano.texture.success",function(t){n.emit("textureLoaded",t.pano.panoIndex,t.meta)}),n.on("pano.texture.error",function(t){n.emit("textureError",t.error,t.pano.panoIndex)}),n.on("pano.texture.abort",function(t){n.emit("textureAbort",t.pano.panoIndex)}),n.on("pano.texture.progress",function(t){n.emit("textureLoading",t.progress,t.pano.panoIndex)}),n.on("xr.session.start",function(t){n.emit("webXRSessionStart")}),n.on("xr.session.end",function(t){n.emit("webXRSessionEnd")}),n.on("xr.gesture.tap",function(t){n.emit("webXRControllerEvent","tap",t.buttons,{raycaster:t.controllers.raycaster})}),n.on("xr.gesture.press",function(t){n.emit("webXRControllerEvent","press",t.buttons,{raycaster:t.controllers.raycaster})}),n.on("xr.gesture.buttonUp",function(t){n.emit("webXRControllerEvent","buttonUp",t.buttons,{raycaster:t.controllers.raycaster})}),n.on("xr.gesture.buttonDown",function(t){n.emit("webXRControllerEvent","buttonDown",t.buttons,{raycaster:t.controllers.raycaster})}),n.on("xr.controller.update",function(t){n.emit("webXRControllerRayUpdate",{leftRay:t.left?t.left.raycaster:void 0,rightRay:t.right?t.right.raycaster:void 0}),t.left&&n.emit("webXRAxesUpdate","left",{raycaster:{leftRay:t.left?t.left.raycaster:void 0,rightRay:t.right?t.right.raycaster:void 0},axesState:{up:t.left.axes.up,down:t.left.axes.down,left:t.left.axes.left,right:t.left.axes.right},deltaTime:t.left.deltaTime}),t.right&&n.emit("webXRAxesUpdate","right",{raycaster:{leftRay:t.left?t.left.raycaster:void 0,rightRay:t.right?t.right.raycaster:void 0},axesState:{up:t.right.axes.up,down:t.right.axes.down,left:t.right.axes.left,right:t.right.axes.right},deltaTime:t.right.deltaTime})}),n.on("works.request",function(t){n.emit("willLoad",t.input,t.works[0],n.getCurrentState())}),n.on("works.load",function(t){n.emit("load",t.input,t.works[0],n.getCurrentState())}),n.on("works.ready",function(t){n.emit("loaded",t.input,t.works[0])}),n.on("state.change",function(t){n.emit("stateChange",t.state,t.userAction)}),n.on("currentState.change",function(t){n.emit("currentStateChange",t.state,t.userAction)}),n.on("state.set",function(t){n.emit("setState",t.state)}),n.on("state.synced",function(t){n.emit("stateSynced",t.state)}),n.on("model.request",function(t){n.emit("modelWillLoad",t.work.model)}),n.on("model.error",function(t){n.emit("modelLoadError",t.error,t.model)}),n.on("model.load",function(t){n.emit("modelLoaded",t.model)}),n.on("model.changeShownFloor",function(t){n.emit("modelShownFloorChange",t.model.shownFloor,t.model.floorLength)}),n.on("render",function(t){n.emit("renderFrame",t.needsRender)}),n.on("mode.change.request",function(t){n.emit("wantsChangeMode",t.mode,t.prevMode)}),n.on("mode.change",function(t){n.emit("modeChange",t.mode,t.prevMode,t.state.panoIndex,t.state,t.userAction)}),n.on("helpers.visible",function(t){n.emit("helpersVisibleChange",t.object.visible)}),n.on("network.resource",function(t){n.emit("network",t.source,t.requestType,t.requestState,t.detail)})}function generateDefaultVideoElement(){if(typeof window!="undefined"){var n=document.createElement("video");n.loop=!0,n.autoplay=!0,n.playsInline=!0,n.muted=!0,n.crossOrigin="";var t=function(){document.removeEventListener("touchstart",t,!1),document.removeEventListener("mousedown",t,!1),n.muted=!1};return document.addEventListener("touchstart",t,!1),document.addEventListener("mousedown",t,!1),n}else return{}}function initLights(){var n=new THREE__namespace.Group;n.name="internalLights";{var t=new THREE__namespace.DirectionalLight(16777215,.1);t.name="direction0",t.position.copy(new THREE__namespace.Vector3(0,1,0)),n.add(t)}{var t=new THREE__namespace.DirectionalLight(16777215,.1);t.name="direction1",t.position.copy(new THREE__namespace.Vector3(-1,-1,-1)),n.add(t)}{var t=new THREE__namespace.DirectionalLight(16777215,.3);t.name="direction2",t.position.copy(new THREE__namespace.Vector3(1,1,1)),n.add(t)}{var t=new THREE__namespace.AmbientLight(16777215,.6);t.name="ambient0",n.add(t)}return n}function parseKeyValue(n){for(var t,e,r={},o=n.split(/(\;|\,)/),s=0,u=o;s<u.length;s++){var l=u[s],c=l.split("="),f=(t=c[0])===null||t===void 0?void 0:t.trim(),p=(e=c[1])===null||e===void 0?void 0:e.trim();f&&p&&(r[f]=p)}return r}function getViewportScale(){var n;if(typeof document!="undefined")for(var t=document.getElementsByTagName("meta"),e=0;e<t.length;e++){var r=t[e];if(r.getAttribute("name")==="viewport"){var o=parseKeyValue((n=r.getAttribute("content"))!==null&&n!==void 0?n:""),s=Number(o["initial-scale"]);if(!isNaN(s))return s}}return 1}const textureURL="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAV8AAAA/CAQAAADtPwPkAAAR+0lEQVR4AezYg3LEQACH8d1cbdu23Q5qG9G47z/TN/h6tn2b/H+TUTLc7yjcOXV46OUAnUs6EbUp022ZBXc1NhoZYYd7fjDRvdcHAwrlK2QBVJ4sgoqONmY45RUT23sZ6H42F2hK5CtkMbjhZlDmUUcvq1zyieUVyjbE4I1GBfItwxG56YaUZTQwyh4P6NgJ4YYYvCuQb5kOyI03pORjiqe4Lwpq5pt1vJqfUwKWJVbSMYfppYconG+maNNQOWBZuwHTzicGel75NtFOkxr5apmV8cikcko0DrDQs863AeGl0cE0+1xy573m0/wf0cEKW6H7BWtggiMG8sy3oHRDpJMw4NWb6am/bv9znkqEzjd61t5oo5clTrjhwevO75EJRBKSRt745Z16ZEjcM73sccZplBPm8PyTcxZAkSRdHm/acJ0Z3JZhHB0BxqDHgWFZFmm0ZbCw87twI/zc3e/Cz93vPneXtU/WdQS3oTviXdY/q5PsJKfoGuQjZuO/0in1qsj85cuXrxqeAOJpGqdJOqrUutgVl2Qb0BWqp/RE8AWWVB7t2KrIzY2Wx2fWKl7yfswgxqj8lYummYa3hfwF9MuQRmbfQE4ocPDjtUWQ6Tq1M2w7gC2EcrMGtWS6xlpGKEDDcb1vUQ25zT4lrC2s0dU4gFPppKkbeIYr7NMpqjStuFg5rNU9epGyt8PXyfX4DE1bKLhR/1XPxwJhp5DAV67T9ZPwFdovhBMIGUYoRBN4wim6S3eoXVEHXdLgmwY0x6BQnO4xPJ0Ar5OVxhQF0L9UslRM4yaQQfQImnBegi8vhY2A1k6YLlrj61TwDdNQnIISwiPvpD7TwYQTssZXK47vg8y9Gp2nxRcATkozOEmdCeObSt3IIo+xf/00IDRKAaZ89PBTkHqpkA5LagKeNZKlIhqX8RcQ95GHtdYA62Y6rOg5LLsOSnoyvk4V38hFhytef+V9/3DER1P48W89o1GxE9o5vns2Mk+F7yiftafEN4nhmUv9DKEeyqI0U+l0CQg+B//sZ5+6lOuqKaTgm0LH41RHw/CsLZRk4huiYxrvP2SNr1OSS+Dr1ulBMR+K9SqHa58Oec49VgL3mXHvDr7QfuM7LMNrH1/IS30Moe64SLYBuFVJ+MbnJY7L+GrVQkFcl4ISx/fEll4ZWnz18DpcSzUCX602LqD9svDLzmdaLkP28P1+VsJjsx/4hmh6x/gmm/i6pbrGneCL9iCOg0dQUvF1UwEdVvG19r2uTXxXLz0J37eLjfZoF++tTtPnU/cWp5e8n3An0m/G+U7qjiy4PpHyV16HKx5flCxAV/H9A88nUnZ7l7KN78SBxPcQgzLAepxEScU3l7pZ6fL2+Dot8fXECfj+QRoGYAwlAfBSPrXQXQri0Pd85NJKcVw8XUdt1LZapk7YRhO1RdpmFJwW8ozekYvx2/fjM5Hr5MfQ95HvcY2a/9hoNK4yEntL+dEuGseTdNmxIPqd5v2YRjeaX8pQ8IW2ohuP7+dTN87RMK4aitx8XPsH0r2oBqNRqrv7+gmjjY7uIr6TBxBfL2MlxNRKSVp8S5CTuGgHXxfkFvh69Pq3LD4pkkd2bdRvHaSNC3/l2sQXAccdlIS+lc57qhPJwxPybT7XSxnUrdqnXuHlJHS+mjZfJfUZR9s2FuQR+EQKdSi9Am8UTnsEvlYS+L6TFwW6kl74Vjr6AFHsX89rgg8njRltK0XPOL7NyDL0IurV4VtMwafB1709vu9X4OjWHoP3z1Ii7eaQdG00Lx5n8HXyDSva/dU0Pq2vZnKYxHYMYRo1WY5ov1G7Vh4r3y+kMdgbilxeOrV0aqOFenFl8GGJig7rG0bbPRqiSRpP2AL0w+yon9dHbi43zFetnKcuw9ZLeSa+7kTw/TDfuFu0Z7Vp/uhyHfPkAZ5ufP9wLIfD49E3clR818rR089Lzyy+VRREPneICnYLX9cT8PVKQs36TbQ3i6NcCwYkxEAQ3phN4CjAvC4mFr5vrlKe7AizBKj8cu33s7i9GbeY7BHYujTjjd3Bx54SSyT4m8mxOoYOAGX/DtwvnGE1M+5v5Bgt1hbkJRW9Cxv9X81GL2i5jqaoJ4avBcCsLYp+Ru+VC5sWPpFhXt8/EPvJL2F/alJDEeIjUhcrP5P45rDeATPj+wKl7gBf1fcq+HpVnfHO1vEf//UCHgt/OxfDE3onj5UkfTaThrg3NCGoBUCtZjvgMnwQB0bG5XENeraJ5XEWvtiHkqSVRqN+uQ4lEx2o+69SeY1dC++Wcsj+LCW+H0ZE4KtDWHkGwCtrxstbFqr51e9wbz42E2fpjRQsqEn50PnM4eumO9IbujCi393Hd+3q72TI+p9DPyyfraF+c3rOx0KJyB2z7Fa1yCO8HoHzlDFhPiWD8XoB3aPppRrUQdRp1D8qE9exdgr+Zbpqf8BLfmZ/bMYbh87k58VCSswCjQoLPPw4Jnp4uFi/YQlfKB5eBd/gr6aqB973zbDAF+v5PN+NZEvm+84bSkhxUPE9C9wqbeJ7Hi+gA9Jr5ZM7x9el4mulyK0Bb2xiMTj3/iBtK77Tnii27H/MlCfsjcJY+2oTg2/U4TYWQERE0r+aCouBcx5zEZzEYrqui8JXsQW/X8FLHJ3IVbWXhQV3zAJCjFQst1F25y1arlXwhRR4Bb4rZ3VPy5d+bHEtHIPF27K16ItYuKXM5kHD10M9DKFeSpbqLlOYAlRiC99yCiDmbUf0206jPPO7b/iud71avBkHf+kQP0OrWHBFrhmt75ZyPzbLg5KmWK9oH4Oq1eFZOm0c6n48mdfer46HcLUZU3pGB8R9IDBbJ+N7v1q0J2xhudZ45tcL8PN16vq9WizwtRLwFQtKER+NDypj4QQOdJNY3NC7GEsaGtiSmDsA+CZhyx+hXFHjYrgGGXpZNvDNpn5gWWuiWkUtyEB0UcrO8Y2L9KI9K+cXLmxqruGd6pcKfycj/ij3URVgu6bPUaycN1qXTHD+KoOmjGORnH57q8rh+e9sTHk5r1+7zpEXk36bp7iiXRrBW61e5k/D0fn+EXF/OxYEypFW3ZH1HzPt4Pv5PN2Rd7VJLDZeboGnbpSPwPDcBw5f6AIysadFOR9Hr7vksoFvE91jdbdYvzpYqyIvdQPU87uKL45u3u213CA8qkYPT6H1YgwIfkz7RI5xJdomfjoV4PXjfjgaRkNGhHwG1mNt1oq0y/j+SaZ5pV0LnrlG89Dl1YkmEsc3nKKzMKskJD+fx6NhlFiohdTe5EsZIig5WPgWUYCC9Dx5TG/sA5x15LCBbzXDtx/+uh74VmMZjLDamh8JvhzQtSsoeVTNNXB/Euv96LRR/qjO+By5xTxxJ683/FB00Pj0fZz9F2GPa70Ld2hbbVptWmjWabbGCl/ZAiTsbJa5hQ9OK/eWFE4xva9nG3z1zwCtnFXjYr6c3ykxPn9QiYWEWPhA4uuiDnzBpt4EMcg0QOm28M0gP76hJuELbIdZi4PqaILpJI+RYz4ZV42y+q49wBcxIbyXTmtXgevRWPl3MmjSSJU5vB3J0TA2Uu8mtP+R5/Au4iiF6NrUUiuCieOiJpnJq8gSXzwFLFiLP8X6bV0bYvzt8TXj75eLtKPRauY1RM1HR7GwEHpFbonIWAPwjxpfqJSCyBVUsk/DFOChhC18kyiPHFvwdVGh6XFbmfLx+RRi4jaqYiCnUDO1wc4u4ovo7pfS+XFD32e9GzndwxJiHcbQ/Vz6JrBMDGYyYK5l7YOsfkS2MVePfGkLsNXLGl9hIVbWXAv9fQ5i/j6UFL1RaQffB9qlwn3tS4WxMhaxETCMz6T9ZTqCk5FznoOKL9SEXMMIUwAZW6dNfCEVX61azdxwmIbg4aHdwtcj5KVBeNiqrb2+g5M8hTskSB6exHZ5bMEIF/wCoOT128zvdXziMLbvuDu/Usmh0oG7doMmafKNSmt8hQWUnmzhjJf/RskXCzQL8aYNfLG/QPGLY5KjKtcuNPGsyGytmj0/kPi6qdXwwJCPvOTYI3zTaICCNEh9FGSWM54OX4+A1UI80RV98czWKceJf65ervsleJm164/7ganACHHn+IPz8Nby1ptcnRztRWbipArvp4/gRchodbIFvsBSWPBaW+CHtzWfauFfcmnKRuyr+Fiu1WbzGKtCPWWMHjIgU1/Mgn2B74GKfbkajHwtVIHy3uBbh0Ocj9oplCC+kIJvYuKvI9bbkUUQ2+JaG7AeknwvhLd0YUxx+SZIf4XkGeqHUCNt9N8sQdvYlwtl9H4hMzqI5dHosMIX2taCl2s6LRowaubPyld/IgcvHBJPnKGnHDLh0ArfqzlYtkv5D8++4RsAvPbwTaJzgDcIDzxIRXuEbx4NIsYupjt7gi/6idL3j1AIqPY+OPH5PGO67x/jUS9NvF6hTte7x2kaCvtSZJiMlxjxMSqEtqXr3GPMn/9y4cXUypS/ymPxbIAvmurtYl9o7dqmBV9KdbLOgsik4B3d6xW/lO7w/kfe+yfx7bFuGkwY3/C6sURDj8584rCxJH5QtnYFVrFQVL35HNoQgO0jvt228XVRC4WQPLtANyiEzb1gD/BNoy5kHa5QEnUmiq/uG2fubeXh+kwuNj8IRxAoOqiLIqfTaNw84SfLWsDmqo08k30prHVKbHuYDo7ez6U7EsLX0oJX1ltV2AOg2KfoMPPA/sTx/ZPMqF9YiN11AsHLFrHgaAT3GBvw7hO+U9TH4bX10rgVx7YgMr0p7Pow4tL8XcY3l1kJMfVQmsA3fa/wFQh3JK9eivtV+tCaD4cUjdZvIRI9BfDUDd6PkkbfKhVbOJf/jUpuQcXXlgVNv68ejr4gTflk5AZ71+jR4AvEdPg6PDNpaz6a2AQm2otoWKvVS+LVTyL4OnaE7wSNUjfdpnZb+KbQdcA7Jr5ek0od8MD9dNjiN43t4etk1v0ITfyw6gS+Q4l5XwGwbXli+u/sj6pWGu9XfyYXx75d18+lf6t0tnau/pXKv8+xzorIkltn0l4r2dYCXlO8XDRbu9xw/9g/Zko2FXSFtKPxOxn3q+caluteK5lJsboXwVP/S27cPVz28X3i3/Ll/v8eDVMPDmzwvDbwddMt+NoROhq3yXcC4D7KpmTyA+XnqEzSFQrawDeLrsNemHrEL2+24r7NlENZUMa2vyxkH2DIs628e669ubdsR4VXC7C9u79eIVJtOwgdgO/dOICHGK6jQHaIwdXN4Lwt0LWHr4d6kX8tV+ozqAs+uYCSmO2w+jd4zGNeUYL4nqZxeN5WKVgooSAClmEaYhqhdit89QC7niSbCEM2sdkBuHYxQg9ri5ZjkuhI6DMP+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),o=n.getScissor(prevScissor),s=n.getScissorTest(),u=n.autoClear,l=o.x+imageOffset[0]/3,c=o.y+imageOffset[1]/3,f=imageSize[0]/3,p=imageSize[1]/3;n.setViewport(l,c,f,p),n.setScissor(l,c,f,p),n.setScissorTest(!0),n.autoClear=!1,n.render(scene,camera),n.setViewport(r),n.setScissor(o),n.setScissorTest(s),n.autoClear=u}else{var t=new THREE__namespace.Texture,e=new Image;e.onload=function(){t.image=e,t.wrapS=THREE__namespace.ClampToEdgeWrapping,t.wrapT=THREE__namespace.ClampToEdgeWrapping,t.minFilter=THREE__namespace.LinearFilter,t.needsUpdate=!0,t.generateMipmaps=!1,material.needsUpdate=!0,e.onload=noop},e.src=textureURL,material.map=t}}var DEFAULT_MODE_CHANGE_DURATION=1e3,DEFAULT_CAMERA_FOV=90,DEFAULT_REQUEST_PROXY=function(n){return n.replace("//vrlab-public.ljcdn.com/","//vr-public.realsee-cdn.cn/").replace("//vrlab-image4.ljcdn.com/","//vr-image-4.realsee-cdn.cn/").replace("//vrlab-image3.ljcdn.com/","//vr-image-3.realsee-cdn.cn/").replace("//vrlab-image2.ljcdn.com/","//vr-image-2.realsee-cdn.cn/").replace("//vrlab-image1.ljcdn.com/","//vr-image-1.realsee-cdn.cn/")},scratchSphere=new THREE__namespace.Sphere,scratchBox3=new THREE__namespace.Box3,scratchViewport=new THREE__namespace.Vector4,scratchScissor=new THREE__namespace.Vector4,scratchClearColor=new THREE__namespace.Color,scratchRenderSize=new THREE__namespace.Vector2,worksMap=new WeakMap,emptyWorks=createWorks([parseWork(null)]),Five_Instances={},Five=(function(n){__extends(t,n);function t(e){e===void 0&&(e={});var r,o,s,u,l,c,f,p,d,h,g,m=n.call(this)||this;if(m.fiveId=createUuid(),Five_Instances[m.fiveId]=m,m.currentUpdateArgs={time:now(),args:[]},m.currentMode="Panorama",m.pano={workCode:"",panoIndex:0},m.needsRender=!1,m.onlyRenderIfNeeds=(r=e.onlyRenderIfNeeds)!==null&&r!==void 0?r:!0,m.imageOptions=__assign({},(o=e.imageOptions)!==null&&o!==void 0?o:{}),m.textureOptions=__assign({},(s=e.textureOptions)!==null&&s!==void 0?s:{}),m.poweredByRealsee=(u=e.poweredByRealsee)!==null&&u!==void 0?u:!0,m.backgroundColor=new THREE__namespace.Color((l=e.backgroundColor)!==null&&l!==void 0?l:1579548),m.backgroundAlpha=(c=e.backgroundAlpha)!==null&&c!==void 0?c:1,m.extraElements=[],m.controllerInits={Panorama:Object.assign({},e.panorama),Model:Object.assign({},e.model),Floorplan:Object.assign({},e.floorplan),Topview:Object.assign({},e.topview),Mapview:Object.assign({},e.mapview),VRPanorama:Object.assign({},e.vrPanorama),XRPanorama:Object.assign({},e.xrPanorama)},m.fps={testCount:0,testTime:now()},m.modeChangeDuration=(f=e.modeChangeDuration)!==null&&f!==void 0?f:DEFAULT_MODE_CHANGE_DURATION,m.enableWheel=(p=e.enableWheel)!==null&&p!==void 0?p:!0,typeof window!="undefined")if("renderer"in e)e.renderer instanceof InternalWebGLRenderer&&m.throwError(new Error("cannot render a internal renderer")),m.renderer=e.renderer;else try{m.renderer=new InternalWebGLRenderer({preserveDrawingBuffer:e.preserveDrawingBuffer,antialias:e.antialias,webgl2:e.webgl2,logarithmicDepthBuffer:e.logarithmicDepthBuffer,precision:e.precision,powerPreference:e.powerPreference});var E=getViewportScale();m.renderer.setPixelRatio(E===1?window.devicePixelRatio:1),m.renderer.setSize(512,512),m.renderer.setClearColor(m.backgroundColor,m.backgroundAlpha)}catch(M){var y=M instanceof Error?M:new Error(String(M));m.throwError(y)}m.getPixelsRenderTarget=new THREE__namespace.WebGLRenderTarget(1,1,{encoding:(h=(d=m.renderer)===null||d===void 0?void 0:d.outputEncoding)!==null&&h!==void 0?h:THREE__namespace.sRGBEncoding,generateMipmaps:!1}),m.viewport=Object.assign({left:0,bottom:0,width:1,height:1},e.viewport),m.camera=new Camera(DEFAULT_CAMERA_FOV),m.scene=new Scene,m.xrCustomObjectsScene=new THREE__namespace.Scene,m.scene.add(m.xrCustomObjectsScene),m.scene.matrixAutoUpdate=!1,m.loadWorkTask=Promise.resolve(),m.requestProxy=(g=e.requestProxy)!==null&&g!==void 0?g:DEFAULT_REQUEST_PROXY,m.networkSubscribe=new NetworkSubscribe,m.networkSubscribe.on("network",function(M,B,L,O){var k;m.emit("network.resource",createEvent("network.resource",{source:M,requestType:B,requestState:L,detail:O})),(k=m.analysis)===null||k===void 0||k.network(m.works,M,B,L,O)}),m.readyCallbacks=[],m.syncingState=!1,m.helperGroup=new THREE__namespace.Group,m.helperGroup.name="helper",m.helperGroup.matrixAutoUpdate=!1,m.scene.add(m.helperGroup),worksMap.set(m,emptyWorks),m.modelScene=new ModelScene({fiveId:m.fiveId}),m.modelScene.addEventListener("model.create",function(M){m.bindModel(M.model)}),m.scene.add(m.modelScene);var v=m.modelScene.setModels(emptyWorks,{forceReplaceImmediately:!0})[0];defineProperty(v,"loaded",{get:function(){return!1},set:function(M){}}),m.videoTexture=new THREE__namespace.VideoTexture(e.videoInstance||generateDefaultVideoElement());var A=initLights();m.scene.add(A),m.state={mode:m.currentMode,workCode:m.pano.workCode,panoIndex:m.pano.panoIndex,longitude:m.camera.pose.longitude,latitude:m.camera.pose.latitude,fov:m.camera.pose.fov,offset:m.camera.pose.offset.clone(),distance:m.camera.pose.distance},m.stateSynced=!1,m.destroyed=!1,m.paused=!0,typeof window!="undefined"&&(e.play!==!1&&m.play(),m.stopAnimationLoop=AnimationFrameLoop.shared.add(function(M,B){for(var L=[],O=2;O<arguments.length;O++)L[O-2]=arguments[O];m.updateTime.apply(m,__spreadArray([M,B],L,!1))},!1,0,10));var b=function(){typeof document!="undefined"&&document.fullscreenElement===null&&m.currentMode==="VRPanorama"&&m.controller.emit("vr.requestExit",createEvent("vr.requestExit",{}))},T=function(){m.needsRender=!0};if(typeof document!="undefined"&&document.addEventListener("fullscreenchange",b,!1),m.renderer&&m.renderer.domElement.addEventListener("webglcontextrestored",T,!1),m.removeEventListeners=function(){typeof document!="undefined"&&document.removeEventListener("fullscreenchange",b,!1),m.renderer&&m.renderer.domElement.removeEventListener("webglcontextrestored",T,!1)},m.plugins={},e.plugins&&e.plugins.length)for(var _=0,S=e.plugins;_<S.length;_++){var w=S[_];if(typeof w=="function")w(m);else if(Array.isArray(w)){var R=w[0],I=w[1],H=w[2];if(typeof R=="function"){var C=R(m,H);typeof I=="string"&&(m.plugins[I]?m.throwError(new Error("plugin name ".concat(I," is exists."))):m.plugins[I]=C)}}}return initLegacyEvent(m),m.fiveRenderer=new FiveRenderer,m.adaptiveLuminancePass=new AdaptiveLuminancePass,m.adaptiveLuminancePass.enabled=!1,m.fiveRenderer.composer.addPass(m.adaptiveLuminancePass),m.eyeDomeLightingPass=new EyeDomeLightingPass(m.camera),m.eyeDomeLightingPass.enabled=!1,m.fiveRenderer.composer.addPass(m.eyeDomeLightingPass),m}return Object.defineProperty(t,"version",{get:function(){return"6.7.0-alpha.35"},enumerable:!1,configurable:!0}),Object.defineProperty(t,"dracoPath",{get:function(){return draco.decoderPath},set:function(e){draco.setDecoderPath(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t,"ktx2Path",{get:function(){return ktx2.transcoderPath},set:function(e){ktx2.setTranscoderPath(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t,"useNativeImageBitmap",{get:function(){return canUseNativeImageBitmap()},set:function(e){useNativeImageBitmap(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"ident",{get:function(){return this.fiveId},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"panoIndex",{get:function(){return this.pano.panoIndex},enumerable:!1,configurable:!0}),t.prototype.dispose=function(){var e;if(this.destroyed!==!0){delete Five_Instances[this.fiveId],this.emit("dispose"),this.destroyed=!0,this.pause(),this.stopAnimationLoop&&(this.stopAnimationLoop(),this.stopAnimationLoop=void 0),this.off(),this.networkSubscribe.off(),this.controller&&(this.controller.destroy(),this.controller=void 0);var r=this.getElement();r&&r.parentNode&&r.parentNode.removeChild(r);var o=this.modelScene.parameter;o.pano0&&o.pano0.map.dispose(),o.pano1&&o.pano1.map!==((e=o.pano0)===null||e===void 0?void 0:e.map)&&o.pano1.map.dispose(),o.reset("pano0","pano1"),this.modelScene.dispose(),this.scene.dispose(),this.xrCustomObjectsScene.dispose(),worksMap.set(this,emptyWorks),this.renderer&&this.renderer.render(new THREE__namespace.Scene,new THREE__namespace.Camera),this.fiveRenderer.dispose(),this.renderer instanceof InternalWebGLRenderer&&(this.renderer.forceContextLoss&&this.renderer.forceContextLoss(),this.renderer.dispose())}},t.prototype.setViewport=function(e){Object.assign(this.viewport,e),this.needsRender=!0},Object.defineProperty(t.prototype,"boundingMesh",{get:function(){return this.modelScene.boundingMesh},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"helperVisible",{get:function(){return this.helperGroup.visible},set:function(e){this.helperGroup.visible!==e&&(this.helperGroup.visible=e,this.emit("helpers.visible",createEvent("helpers.visible",{object:this.helperGroup})),this.needsRender=!0)},enumerable:!1,configurable:!0}),t.prototype.updateConfiguration=function(e,r){r===void 0&&(r=!0);var o=!1,s=!1;if(e.panorama&&(Object.assign(this.controllerInits.Panorama,omitUndefinedFields(e.panorama)),this.currentMode==="Panorama"&&(o=!0)),e.model&&(Object.assign(this.controllerInits.Model,omitUndefinedFields(e.model)),this.currentMode==="Model"&&(o=!0)),e.floorplan&&(Object.assign(this.controllerInits.Floorplan,omitUndefinedFields(e.floorplan)),this.currentMode==="Floorplan"&&(o=!0)),e.topview&&(Object.assign(this.controllerInits.Topview,omitUndefinedFields(e.topview)),this.currentMode==="Topview"&&(o=!0)),e.mapview&&(Object.assign(this.controllerInits.Mapview,omitUndefinedFields(e.mapview)),this.currentMode==="Mapview"&&(o=!0)),e.vrPanorama&&(Object.assign(this.controllerInits.VRPanorama,omitUndefinedFields(e.vrPanorama)),this.currentMode==="VRPanorama"&&(o=!0)),e.imageOptions&&(Object.assign(this.imageOptions,e.imageOptions),(this.currentMode==="Panorama"||this.currentMode==="VRPanorama")&&(s=!0,o=!0)),e.textureOptions&&Object.assign(this.textureOptions,e.textureOptions),r&&o&&this.controller&&this.currentMode){var u=this.controller.updateConfiguration(this.controllerInits[this.currentMode]);(!u||s)&&this.changeMode(this.currentMode,this.getCurrentState(),0,!1,!0)}},t.prototype.appendTo=function(e,r){if(r===void 0&&(r={}),!!this.renderer){if(!(this.renderer instanceof InternalWebGLRenderer)){this.throwError(new Error("cannot call appendTo method when render a external renderer"));return}var o=this.getElement();if(o){e.appendChild(o),this.refresh(r);var s=window.getComputedStyle(e).position;s!=="relative"&&s!=="absolute"&&s!=="fixed"&&s!=="sticky"&&(e.style.position="relative")}}},t.prototype.refresh=function(e,r){var o,s,u;if(e===void 0&&(e={}),!!this.renderer){var l=this.renderer.domElement,c=l.parentNode,f=e.width,p=f===void 0?(o=c==null?void 0:c.offsetWidth)!==null&&o!==void 0?o:512:f,d=e.height,h=d===void 0?(s=c==null?void 0:c.offsetHeight)!==null&&s!==void 0?s:512:d;if(p=Math.max(1,p),h=Math.max(1,h),!r){var g=getViewportScale(),m=typeof window!="undefined"?window.devicePixelRatio:1;if(r=(u=g===1?m:1)!==null&&u!==void 0?u:1,r>1){var E=Math.max(p,h)*r,y=Math.min(this.renderer.capabilities.maxTextureSize,4096);E>y&&(r=Math.max(r/E*y,1),r=Math.floor(r*100)/100)}}this.renderer.setPixelRatio(r),this.renderer.setSize(p,h),this.needsRender=!0;var v=now(),A=v-this.currentUpdateArgs.time,b=this.currentUpdateArgs.args;this.updateTime.apply(this,__spreadArray([v,A],b,!1))}},t.prototype.addExtraElement=function(e){var r=this;return this.extraElements.indexOf(e)===-1&&(this.extraElements.push(e),this.controller&&this.controller.bindExtraElement(e)),function(){return r.removeExtraElement(e)}},t.prototype.removeExtraElement=function(e){var r=this.extraElements.indexOf(e);r!==-1&&(this.extraElements.splice(r,1),this.controller&&this.controller.unbindExtraElement(e))},t.prototype.getSize=function(e){if(!this.renderer)throw new Error("renderer is not initialized");return this.renderer.getSize(e),e.x*=this.viewport.width,e.y*=this.viewport.height,e},t.prototype.getDrawingBufferSize=function(e){if(!this.renderer)throw new Error("renderer is not initialized");return this.renderer.getDrawingBufferSize(e),e.x*=this.viewport.width,e.y*=this.viewport.height,e},t.prototype.updateCamera=function(e,r,o){if(o===void 0&&(o=!0),!this.controller)throw new Error("controller is not initialized.");return this.controller.updateCamera(e,r,o)},t.prototype.updateCameraWithKeyframes=function(e,r,o){if(o===void 0&&(o=!0),!this.controller)throw new Error("controller is not initialized.");return this.controller.updateCameraWithKeyframes(e,r,o)},Object.defineProperty(t.prototype,"works",{get:function(){var e=worksMap.get(this);return e||emptyWorks},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"work",{get:function(){return this.works[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"observers",{get:function(){return this.work.observers},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"models",{get:function(){return this.modelScene.models},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"model",{get:function(){return this.modelScene.models[0]},enumerable:!1,configurable:!0}),t.prototype.load=function(e,r,o,s){var u=this;if(s===void 0&&(s=!0),!this.renderer)throw new Error("renderer is not initialized");var l=this.loadWorkTask.then(function(){return isPromise(e)?e.then(function(c){return u.load_(c,r,o,s)}):u.load_(e,r,o,s)});return this.loadWorkTask=l.catch(function(c){u.throwError(c)}),l},t.prototype.load_=function(e,r,o,s){var u=this,l,c,f,p,d,h,g,m,E,y;s===void 0&&(s=!0);var v={};typeof o=="number"?v.duration=o:typeof o=="object"&&Object.assign(v,o),this.works===emptyWorks&&(v.duration===void 0&&(v.duration=0),v.effect===void 0&&(v.effect="instant"));var A={};Object.assign(A,v.model),!A["3d-tiles"]&&v["3d-tiles"]&&(A["3d-tiles"]=v["3d-tiles"]),!A.textureOptions&&v.textureOptions&&(A.textureOptions=v.textureOptions),!A.textureOptions&&this.textureOptions&&(A.textureOptions=this.textureOptions);var b=[];if(Array.isArray(e))for(var T=0,_=e;T<_.length;T++){var S=_[T];S instanceof Work?b.push(S):typeof S!="string"&&"work"in S?b.push(parseWork(S.work,S)):b.push(parseWork(S))}else e instanceof Work?b.push(e):b.push(parseWork(e));v.mode==="add"&&(b=[].concat(this.works,b));var w;try{w=createWorks(b)}catch(Z){return this.throwError(Z),Promise.reject(Z)}for(var R=0,I=w;R<I.length;R++){var H=I[R];this.bindWorkFetcher(H)}r===void 0&&(r="inherit"),r==="inherit"&&this.works===emptyWorks&&(r="initial");var C=this.currentMode,M=w.initial,B=M.work.observers[0],L=B?{workCode:B.work.workCode,panoIndex:B.panoIndex}:{workCode:M.work.workCode,panoIndex:0},O=(l=M.mode)!==null&&l!==void 0?l:B?"Panorama":"Mapview",k={};if(r==="inherit"){var D=this.getCurrentState(),q=w.filter(function(Z){return Z.workCode===D.workCode})[0];if(q)L={workCode:D.workCode,panoIndex:D.panoIndex},O=D.mode,k={longitude:D.latitude,latitude:D.latitude,fov:D.fov,distance:D.distance,offset:D.offset.clone()};else{r={mode:C};var z=(f=(c=w[0])===null||c===void 0?void 0:c.observers)===null||f===void 0?void 0:f[this.panoIndex];z?(r.workCode=z.work.workCode,r.panoIndex=z.panoIndex):typeof w.initial.panoIndex=="number"?(r.workCode=w.initial.work.workCode,r.panoIndex=w.initial.panoIndex):(r.mode==="Panorama"||r.mode==="VRPanorama"||r.mode==="XRPanorama")&&(r.mode="Mapview"),r.mode===C&&(r.longitude=this.camera.pose.longitude,r.latitude=this.camera.pose.latitude,r.fov=this.camera.pose.fov)}}if(r==="initial"&&(typeof M.panoIndex=="number"&&(L={workCode:M.work.workCode,panoIndex:M.panoIndex}),M.mode&&(O=M.mode),k={longitude:M.longitude,latitude:M.latitude,fov:M.fov,distance:M.distance,offset:(p=M.offset)===null||p===void 0?void 0:p.clone()}),typeof r=="object"){if(O=(d=r.mode)!==null&&d!==void 0?d:C,typeof r.panoIndex=="number"){var z=w.getObserver({workCode:(g=(h=r.workCode)!==null&&h!==void 0?h:M.work.workCode)!==null&&g!==void 0?g:"",panoIndex:r.panoIndex});z&&(L={workCode:z.work.workCode,panoIndex:z.panoIndex})}k={longitude:r.longitude,latitude:r.latitude,fov:r.fov,distance:r.distance,offset:r.offset?new THREE__namespace.Vector3().copy(r.offset):void 0}}var J=(m=v.duration)!==null&&m!==void 0?m:this.modeChangeDuration;(O==="Floorplan"||O==="Topview"||O==="Mapview")&&C===O&&(J=0);var V="fly";(O==="Panorama"||O==="VRPanorama"||O==="XRPanorama")&&C===O&&(V=(E=v.effect)!==null&&E!==void 0?E:"fade"),this.emit("works.request",createEvent("works.request",{input:e,works:w,userAction:s}));var U=function(Z,X,se){var G=u.getCurrentState(),W=__assign(__assign({mode:Z},X),se);r==="inherit"&&(W=u.getCurrentState()),u.pano=X;var $=__assign(__assign({initial:{state:W,currentState:G,duration:J,effect:V,userAction:s}},u.commonParams()),u.controllerInits[Z]),ne=Controllers[W.mode].initAnimationEndState($);if(u.controller&&C===Z)u.controller.updateWork(w,ne,{effect:V,duration:J},s)===!1&&(u.controller.destroy(),u.controller=u.applyController(Z,$));else{if(u.controller)u.controller.destroy();else{var te=Controllers[Z].initAnimationEndState($);u.camera.setFromPose(te),u.emit("camera.update",createEvent("camera.update",{state:u.getCurrentState(),userAction:s}))}u.controller=u.applyController(Z,$);var ve=createEvent("mode.change",{prevMode:C,mode:Z,state:ne,userAction:s});try{u.emit("mode.change",ve)}catch(oe){console.error(oe)}}u.updateTime.apply(u,__spreadArray([u.currentUpdateArgs.time,0],u.currentUpdateArgs.args,!1))};worksMap.set(this,w);var j=Promise.resolve();if(O===t.Mode.Floorplan||O===t.Mode.Topview||O===t.Mode.Mapview||O===t.Mode.Model){this.modelScene.loaded===!1&&(this.camera.setFromPose(k),assignPose(this.state,this.camera.pose));var K=this.modelScene.setModels(w,A);j=Promise.all(K.map(function(Z){return Z.loadedReady})).then(function(){u.needsRender=!0,U(O,L,k),u.emit("camera.update",createEvent("camera.update",{state:u.getCurrentState(),userAction:s}))})}else{U(O,L,k);var ae=this.controller,re=!1;this.modelScene.autoRefine=!1;var ee=function(){u.works===w&&re===!1&&(u.needsRender=!0,u.emit("camera.update",createEvent("camera.update",{state:u.getCurrentState(),userAction:s})),re=!0,u.modelScene.autoRefine=!0),ae.off("pano.arrived",ee),ae.off("pano.cancel",ee)},K=this.modelScene.setModels(w,A);j=Promise.all(K.map(function(X){return X.initReady})).then(noop),ae.once("pano.arrived",ee),ae.once("pano.cancel",ee),setTimeout(ee,((y=v.duration)!==null&&y!==void 0?y:this.modeChangeDuration)+1e3)}return this.emit("works.load",createEvent("works.load",{input:e,userAction:s,works:w})),j.then(function(){return u.ready()}).then(function(){var Z;u.emit("works.ready",createEvent("works.ready",{input:e,userAction:s,works:w})),(Z=u.analysis)===null||Z===void 0||Z.work(w)})},t.prototype.reset=function(){var e=this,r=this.loadWorkTask.then(function(){return e.reset_()});return this.loadWorkTask=r.catch(function(o){e.throwError(o)}),r},t.prototype.reset_=function(){var e=this;return new Promise(function(r){var o;e.controller&&(e.controller.destroy(),e.controller=void 0);var s=e.modelScene.parameter;s.pano0&&s.pano0.map.dispose(),s.pano1&&s.pano1.map!==((o=s.pano0)===null||o===void 0?void 0:o.map)&&s.pano1.map.dispose(),s.set({pano0:null,pano1:null,modelAlpha:1}),worksMap.set(e,emptyWorks),e.modelScene.setModels(emptyWorks,{forceReplaceImmediately:!0}),e.renderer&&e.modelScene.update(e.renderer,e.camera),e.needsRender=!0,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.camera.needsRender=!1,e.needsRender=!1,r()})},t.prototype.changeMode=function(e,r,o,s,u){var l=this;return r===void 0&&(r={}),s===void 0&&(s=!0),u===void 0&&(u=!1),new Promise(function(c,f){var p,d,h,g;if(!l.renderer)throw new Error("renderer is not initialized.");r=__assign({},r);var m=0;l.controller&&(typeof o=="number"?m=o:m=(p=o==null?void 0:o.duration)!==null&&p!==void 0?p:l.modeChangeDuration);var E="fly";l.controller&&typeof o=="object"&&o.effect&&(E=o.effect);var y=typeof r.panoIndex=="number"?{workCode:(g=(d=r.workCode)!==null&&d!==void 0?d:(h=l.work)===null||h===void 0?void 0:h.workCode)!==null&&g!==void 0?g:"",panoIndex:r.panoIndex}:l.pano;if(!t.Mode.hasOwnProperty(e)){var v=new Error('mode "'.concat(e,'" is not existed'));l.throwError(v),f(v);return}if((e===t.Mode.Panorama||e===t.Mode.VRPanorama||e===t.Mode.XRPanorama)&&!l.works.getObserver(y)){var v=new Error("PanoId ".concat(panoStringify(y)," not existed."));l.throwError(v),f(v);return}(e===t.Mode.Floorplan||e===t.Mode.Topview||e===t.Mode.Mapview||e===t.Mode.Model)&&l.modelScene.empty&&(m=0);var A=l.controller,b=l.currentMode,T=function(){if(l.controller&&l.controller.stopMomentumMovement(),l.controller&&u===!1&&b===e)e===t.Mode.Panorama||e===t.Mode.Model||e===t.Mode.VRPanorama||e===t.Mode.XRPanorama?!panoEqual(l.pano,y)&&"moveToPano"in l.controller&&typeof l.controller.moveToPano=="function"?l.controller.moveToPano(y,__assign({duration:m},r),s):l.controller.updateCamera(r,m,s).catch(noop):(panoEqual(l.pano,y)||(l.pano=y),l.controller.updateCamera(r,m,s).catch(noop));else{var S=__assign(__assign({},r),y),w=__assign(__assign({initial:{state:S,currentState:l.getCurrentState(),duration:m,effect:E,userAction:s}},l.commonParams()),l.controllerInits[e]),R=Controllers[e].initAnimationEndState(w),I=createEvent("mode.change.request",{prevMode:l.currentMode,mode:e,state:R,userAction:s});if(l.emit("mode.change.request",I),!I.defaultPrevented){A&&A.destroy(),l.controller=l.applyController(e,w);var H=createEvent("mode.change",{prevMode:l.currentMode,mode:e,state:R,userAction:s});l.emit("mode.change",H)}}c()},_=AnimationFrameLoop.shared.getContext();_&&(typeof XRSession!="undefined"&&_ instanceof XRSession&&_.end(),AnimationFrameLoop.shared.setContext(null)),e===t.Mode.VRPanorama?(l.requestFullscreen(),requestDeviceOrientationPermission().then(function(){return T()}).catch(function(S){var w=S instanceof Error?S:new Error(String(S));l.exitFullscreen(),l.throwError(w),f(w)})):e===t.Mode.XRPanorama?requestXRSessionPermission().then(function(S){AnimationFrameLoop.shared.setContext(S),u=!0,T()}).catch(function(S){var w=S instanceof Error?S:new Error(String(S));l.throwError(w),f(w)}):T()})},t.prototype.getPixels=function(e,r,o,s,u,l,c){if(!this.renderer)throw new Error("renderer is not initialized.");var f=now(),p=this.renderer.getPixelRatio(),d=this.renderer.getRenderTarget(),h=this.getSize(new THREE__namespace.Vector2),g=0,m=0,E=1,y=1,v,A,b,T,_;typeof e=="number"?(g=e,typeof r=="number"&&(m=r),typeof o=="number"&&(E=o),typeof s=="number"&&(y=s),v=u,A=l,_=c):(g=e.x,m=e.y,E=e.width,y=e.height,v=e.pixelRatio,A=e.flipY,b=e.helperVisible,T=e.skipPanorama,_=e.buffer),g=Math.floor(g),m=Math.floor(m),E=Math.floor(E),y=Math.floor(y),v=Math.floor(v!=null?v:p),A=A!=null?A:!1;var S=this.helperVisible,w=this.modelScene.parameter.modelAlpha;this.helperVisible=b!=null?b:this.helperVisible,T&&(this.controller instanceof Controllers.Panorama||this.controller instanceof Controllers.VRPanorama||this.controller instanceof Controllers.XRPanorama)&&T===!0&&this.modelScene.parameter.set("modelAlpha",1),this.modelScene.update(this.renderer,this.camera);var R=this.getPixelsRenderTarget;R.setSize(E*v,y*v),this.renderer.setRenderTarget(R),this.camera.pixelRatio=v,this.camera.resolution.set(E,y),this.camera.setViewOffset(h.width,h.height,g,h.height-m-y,E,y),this.camera.aspect=h.width/h.height,this.camera.updateTime(f),this.scene.update(this.renderer,this.camera);var I=this.renderer.autoClear,H=this.renderer.autoClearColor,C=this.renderer.autoClearDepth,M=this.renderer.autoClearStencil,B=scratchClearColor.copy(this.renderer.getClearColor()),L=this.renderer.getClearAlpha(),O=this.renderer.getScissorTest();this.renderer.autoClear=!0,this.renderer.autoClearColor=!0,this.renderer.autoClearDepth=!0,this.renderer.autoClearStencil=!0,this.renderer.setScissorTest(!1);var k=this.scene.background;this.scene.background=this.camera.isOrthographicCamera?null:k,this.renderer.render(this.scene,this.camera),this.scene.background=k,this.renderer.autoClear=I,this.renderer.autoClearColor=H,this.renderer.autoClearDepth=C,this.renderer.autoClearStencil=M,this.renderer.setClearColor(B,L),this.renderer.setScissorTest(O),this.helperVisible=S,w===void 0?this.modelScene.parameter.reset("modelAlpha"):this.modelScene.parameter.set("modelAlpha",w),this.renderer.setRenderTarget(d),this.camera.clearViewOffset(),this.camera.pixelRatio=p,this.camera.resolution.copy(h),this.camera.aspect=this.camera.resolution.width/this.camera.resolution.height,this.camera.updateTime(f),this.modelScene.update(this.renderer,this.camera),this.scene.update(this.renderer,this.camera);var D=E*v,q=y*v,z=D*q,J=z*4;if(_){if(_.length!==J)throw new Error("buffer length is not equals pixels ".concat(J))}else _=new Uint8Array(J);if(this.renderer.readRenderTargetPixels(R,0,0,E*v,y*v,_),A)for(var V=z/2,U=0,j=0,K=0,ae=0;j<V;j++)for(ae=(q-Math.floor(j/D)-1)*D+j%D,K=0;K<4;K++)U=_[j*4+K],_[j*4+K]=_[ae*4+K],_[ae*4+K]=U;return _},t.prototype.getElement=function(){var e;return(e=this.renderer)===null||e===void 0?void 0:e.domElement},t.prototype.render=function(e){var r=this.renderer;if(r){var o=r.getRenderTarget();r.setRenderTarget(null);var s=r.autoClear,u=r.autoClearColor,l=r.autoClearDepth,c=r.autoClearStencil,f=scratchClearColor.copy(r.getClearColor()),p=r.getClearAlpha(),d=r.getViewport(scratchViewport),h=r.getScissor(scratchScissor),g=r.getScissorTest();r.autoClear=!0,r.autoClearColor=!0,r.autoClearDepth=!0,r.autoClearStencil=!0;var m=r.getSize(scratchRenderSize),E=Math.floor(m.x*this.viewport.left),y=Math.floor(m.y*this.viewport.bottom),v=Math.floor(m.x*this.viewport.width),A=Math.floor(m.y*this.viewport.height);r.setClearColor(this.backgroundColor,this.backgroundAlpha),r.setViewport(E,y,v,A),r.setScissor(E,y,v,A);var b=this.viewport.bottom!==0||this.viewport.left!==0||this.viewport.width!==1||this.viewport.height!==1;r.setScissorTest(b);var T=this.scene.background;this.scene.background=this.camera.isOrthographicCamera?null:T;var _=!0;if(this.controller){var S=this.controller.render();S&&(_=!1)}if(_){var w=this.fiveRenderer.render(r,this.scene,this.modelScene,this.camera,this.needsRender);this.poweredByRealsee&&w&&renderPoweredByRealsee(r)}this.scene.background=T,r.autoClear=s,r.autoClearColor=u,r.autoClearDepth=l,r.autoClearStencil=c,r.setClearColor(f,p),r.setViewport(d),r.setScissor(h),r.setScissorTest(g),r.setRenderTarget(o),e&&AnimationFrameLoop.shared.add(e,!0)}},t.prototype.updateTime=function(e,r){for(var o,s=this,u=[],l=2;l<arguments.length;l++)u[l-2]=arguments[l];if(this.currentUpdateArgs={time:e,args:u},!this.destroyed){if(this.renderer&&ktx2.detectSupport(this.renderer),this.syncingState=this.syncState(e,r),this.controller&&(o=this.controller).updateTime.apply(o,__spreadArray([e,r],u,!1)),this.renderer&&(this.camera.pixelRatio=this.renderer.getPixelRatio(),this.getSize(this.camera.resolution),this.camera.aspect=this.camera.resolution.width/this.camera.resolution.height),this.camera.controllerMode=this.currentMode,this.camera.updateTime(e),this.renderer){var c=this.modelScene.loaded,f=this.modelScene.refined;this.modelScene.update(this.renderer,this.camera),c===!1&&this.modelScene.loaded===!0&&(this.controller&&this.controller.updateModel(this.modelScene),AnimationFrameLoop.shared.add(function(){s.emit("models.load",createEvent("models.load",{modelScene:s.modelScene}))},!0,0,10)),f===!1&&this.modelScene.refined===!0&&AnimationFrameLoop.shared.add(function(){s.emit("models.refined",createEvent("models.refined",{modelScene:s.modelScene}))},!0,0,10)}if(this.camera.autoNearFar){scratchBox3.makeEmpty(),scratchBox3.expandByObject(this.modelScene.boundingMesh);var p=scratchBox3.getBoundingSphere(scratchSphere),d=p.radius*2;p.containsPoint(this.camera.position)||(d=this.camera.position.distanceTo(p.center)+p.radius),d=clamp$1(d,800);var h=d/1e4;h=clamp$1(h,.03,.1),this.camera.near!==h&&(this.camera.near=h),this.camera.far!==d&&(this.camera.far=d),this.camera.updateTime(e)}if(this.renderer){var g=this.modelScene.visible;this.modelScene.visible=!1,this.scene.update(this.renderer,this.camera),this.modelScene.visible=g}if(this.syncingState=!1,this.controller&&this.controller.needsRender===!0&&(this.controller.needsRender=!1,this.needsRender=!0),this.camera.needsRender===!0&&(this.camera.needsRender=!1,this.needsRender=!0),this.modelScene.needsRender===!0&&(this.modelScene.needsRender=!1,this.needsRender=!0),this.scene.needsRender===!0&&(this.scene.needsRender=!1,this.needsRender=!0),this.onlyRenderIfNeeds!==!0&&(this.needsRender=!0),this.paused!==!0){var m=createEvent("render.prepare",{needsRender:this.needsRender});this.emit("render.prepare",m),m.defaultPrevented&&(this.needsRender=!1);var E=this.needsRender;this.render(),this.needsRender=!1,this.emit("render",createEvent("render",{needsRender:E})),this.hasListener("fps")&&(this.fps.testTime&&e-this.fps.testTime<1e3?this.fps.testCount++:(this.emit("fps",this.fps.testCount),this.fps.testTime=e,this.fps.testCount=0))}}},t.prototype.pause=function(){this.paused=!0,this.renderer&&this.renderer instanceof InternalWebGLRenderer&&this.renderer.clear(!0,!0,!0)},t.prototype.play=function(){this.needsRender=!0,this.paused=!1},t.prototype.moveToPano=function(e,r,o){r===void 0&&(r={}),o===void 0&&(o=!0);var s=this,u=s.controller,l=s.renderer;if(!u)return this.throwError(new Error("controller is not initialized.")),Promise.resolve();if(!l)return this.throwError(new Error("renderer is not initialized.")),Promise.resolve();typeof e=="number"&&this.pano.workCode&&(e={workCode:this.pano.workCode,panoIndex:e});var c=this.works.getObserver(e);if(!c)return this.throwError(new Error("pano ".concat(JSON.stringify(e)," not existed."))),Promise.resolve();var f={workCode:c.work.workCode,panoIndex:c.panoIndex};return"moveToPano"in u&&typeof u.moveToPano=="function"?u.moveToPano(f,r,o):c&&(this.pano=f,this.once("initAnimation.start",function(p){r.moveStartCallback&&r.moveStartCallback(p.state)}),this.once("initAnimation.end",function(p){r.moveEndCallback&&r.moveEndCallback(p.state)}),this.changeMode(t.Mode.Panorama,r,{effect:r.effect},o)),this.ready()},t.prototype.preloadPano=function(e,r){var o=this;r===void 0&&(r=noop);var s=this.works.getObserver(e);if(!s)return Promise.reject(new Error("Pano ".concat(JSON.stringify(e)," never found")));var u=["right","left","up","down","front","back"],l=now();return Promise.all(u.map(function(c){var f=panoStringify({panoIndex:s.panoIndex,workCode:s.work.workCode}),p=__assign({key:"pano.".concat(f,".").concat(c)},pick(o.imageOptions,["size","format","quality","forceUseExifOrientation","mappings"])),d=s.work.getURL(s.images[c]),h=o.imageOptions.transform?o.imageOptions.transform(d,p):imageURL(d,p);return getFetcher(o.fiveId,s.work).preload(h)})).then(function(){var c=now()-l;return r(c),c})},t.prototype.project2d=function(e,r){if(r===void 0&&(r=!1),!this.renderer)return null;if(r){var o=this.camera.position,s=e.clone().sub(o),u=new THREE__namespace.Raycaster(o,s.clone().normalize());u.params.Points={threshold:.1};var l=this.modelScene.intersectRaycaster(u)[0];if(l&&l.distance+.01<s.length())return null}var c=e.clone().project(this.camera);if(Math.abs(c.z)>1)return null;var f=this.renderer.getSize(new THREE__namespace.Vector2),p=f.x*this.viewport.width,d=f.y*this.viewport.height,h=f.x*this.viewport.left+(c.x+1)/2*p,g=f.y*(1-this.viewport.bottom-this.viewport.height)+(-c.y+1)/2*d;return new THREE__namespace.Vector2(h,g)},t.prototype.getCurrentState=function(){return __assign(__assign({},this.camera.copyPose()),{mode:this.currentMode,workCode:this.pano.workCode,panoIndex:this.pano.panoIndex})},t.prototype.setState=function(e,r,o){var s,u,l,c,f,p,d,h,g,m;r===void 0&&(r=!1),o===void 0&&(o=!0),e=pick(e,["mode","workCode","panoIndex","longitude","latitude","fov","offset","distance"]),e.offset&&!(e instanceof THREE__namespace.Vector3)&&(e.offset=new THREE__namespace.Vector3(e.offset.x,e.offset.y,e.offset.z));var E;if(typeof e.panoIndex=="number")if(e.workCode)E={workCode:e.workCode,panoIndex:e.panoIndex};else{var y=(u=(s=this.work)===null||s===void 0?void 0:s.workCode)!==null&&u!==void 0?u:"",v=this.state.workCode;this.works.filter(function(M){return M.workCode===v}).length>0&&(y=v),E={workCode:y,panoIndex:e.panoIndex}}var A=(l=e.mode)!==null&&l!==void 0?l:this.state.mode,b,T,_,S,w;if(this.controller&&this.controller.stopMomentumMovement(),this.state.mode!==A){if(A==="VRPanorama"){this.changeMode("VRPanorama",void 0,void 0,!0);return}var R={workCode:E==null?void 0:E.workCode,panoIndex:E==null?void 0:E.panoIndex};typeof e.longitude=="number"&&(R.longitude=e.longitude),typeof e.latitude=="number"&&(R.latitude=e.latitude),typeof e.fov=="number"&&(R.fov=e.fov),typeof e.distance=="number"&&(R.distance=e.distance),e.offset instanceof THREE__namespace.Vector3&&(R.offset=e.offset);var I=__assign(__assign({initial:{state:R,currentState:this.getCurrentState(),duration:this.modeChangeDuration,effect:"fly",userAction:!1}},this.commonParams()),this.controllerInits[A]),H=Controllers[A].initAnimationEndState(I);b=H.longitude,T=H.latitude,_=H.fov,S=H.offset,w=H.distance}else b=(c=e.longitude)!==null&&c!==void 0?c:this.state.longitude,T=(f=e.latitude)!==null&&f!==void 0?f:this.state.latitude,_=(p=e.fov)!==null&&p!==void 0?p:this.state.fov,S=(d=e.offset)!==null&&d!==void 0?d:this.state.offset,w=(h=e.distance)!==null&&h!==void 0?h:this.state.distance;var C={workCode:(E!=null?E:this.pano).workCode,panoIndex:(E!=null?E:this.pano).panoIndex,mode:A,longitude:b,latitude:T,fov:_,offset:S,distance:w};this.emit("state.set",createEvent("state.set",{userAction:o,state:C})),stateEqual(this.state,C)||(this.controller&&C.mode==="VRPanorama"&&C.mode!==this.state.mode?(assignState(this.state,C),this.changeMode("VRPanorama")):this.controller&&C.mode==="XRPanorama"&&C.mode!==this.state.mode?(assignState(this.state,C),this.changeMode("XRPanorama")):(assignState(this.state,C),this.controller&&o&&(this.controller.userAction=!1),r&&this.state.mode===C.mode&&(this.syncingState=this.syncState(now(),0,r),this.syncingState&&((g=this.controller)===null||g===void 0||g.updateTime(now(),0),this.syncingState=!1)),this.emit("state.change",createEvent("state.change",{userAction:o,state:this.state})),(m=this.analysis)===null||m===void 0||m.state(this.works,this.state)))},t.prototype.syncState=function(e,r,o){o===void 0&&(o=!1);var s=this.stateSynced;if(this.stateSynced=!1,!this.controller)return!1;if(this.state.mode!==this.currentMode){var u={mode:this.state.mode,workCode:this.state.workCode,panoIndex:this.state.panoIndex,longitude:this.state.longitude,latitude:this.state.latitude,fov:this.state.fov,offset:this.state.offset,distance:this.state.distance};return this.changeMode(this.state.mode,u,this.modeChangeDuration,this.controller.userAction),!0}if(!this.controller.isReady())return!1;if(this.controller instanceof Controllers.Model){if(notSimilarVector3(this.camera.pose.offset,this.state.offset)){var l={longitude:this.state.longitude,latitude:this.state.latitude,fov:this.state.fov,offset:this.state.offset};return this.controller.moveToPosition(this.state.offset,__assign(__assign({},l),{duration:o?0:void 0}),!1),!0}}else{var c={workCode:this.state.workCode,panoIndex:this.state.panoIndex};if(!panoEqual(c,this.pano)&&"moveToPano"in this.controller&&typeof this.controller.moveToPano=="function"){var l={longitude:this.state.longitude,latitude:this.state.latitude,fov:this.state.fov,offset:this.state.offset,distance:this.state.distance};return this.controller.moveToPano(c,l,!1),!0}}if(this.controller instanceof Controllers.Floorplan||this.controller instanceof Controllers.Topview||this.controller instanceof Controllers.Mapview){var f=1,p=.2,d=.2,h=Math.PI/45,g=o?this.state.fov:stepNumber(this.camera.pose.fov,this.state.fov,f),m=Math.abs(this.camera.pose.distance-this.state.distance),E=m>d*15?m/15:p,y=o?this.state.distance:stepNumber(this.camera.pose.distance,this.state.distance,E),v=this.camera.pose.offset.distanceTo(this.state.offset),A=v>d*15?v/15:d,b=o?new THREE__namespace.Vector3().copy(this.state.offset):stepVector(this.camera.pose.offset,this.state.offset,A),T=o?{longitude:this.state.longitude,latitude:this.state.latitude}:stepCoordinates({longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude},{longitude:this.state.longitude,latitude:this.state.latitude},h),_=T.longitude,S=T.latitude;if(notSimilarValue(g,this.camera.pose.fov)||notSimilarVector3(b,this.camera.pose.offset)||notSimilarValue(y,this.camera.pose.distance)||notSimilarValue(_,this.camera.pose.longitude,Math.PI*2)||notSimilarValue(S,this.camera.pose.latitude)){var w={x:b.x,y:b.y,z:b.z},R={fov:g};return Object.assign(w,{distance:y}),Object.assign(R,{longitude:_,latitude:S}),this.controller.stopMomentumMovement(),this.controller.cameraMotion.set(R,0).catch(noop),this.controller.locationMotion.set(w,0).catch(noop),!0}}else{var I=1,H=Math.PI/45,g=o?this.state.fov:stepNumber(this.camera.pose.fov,this.state.fov,I),C=o?{longitude:this.state.longitude,latitude:this.state.latitude}:stepCoordinates({longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude},{longitude:this.state.longitude,latitude:this.state.latitude},H),_=C.longitude,S=C.latitude,y=this.state.distance,b=new THREE__namespace.Vector3().copy(this.state.offset);if(notSimilarValue(y,this.camera.pose.distance)&&(this.state.distance=this.camera.pose.distance),notSimilarVector3(b,this.camera.pose.offset)&&(this.state.offset=this.camera.pose.offset.clone()),notSimilarValue(_,this.camera.pose.longitude,Math.PI*2)||notSimilarValue(S,this.camera.pose.latitude)||notSimilarValue(g,this.camera.pose.fov))return this.controller.stopMomentumMovement(),this.controller.cameraMotion.set({longitude:_,latitude:S,fov:g},0).catch(noop),!0}if(this.stateSynced=!0,s===!1&&this.emit("state.synced",createEvent("state.synced",{userAction:!1,state:this.state})),this.readyCallbacks.length&&this.stateSynced){var M=this.currentMode,B=M===t.Mode.Floorplan||M===t.Mode.Topview||M===t.Mode.Mapview||M===t.Mode.Model;if(!B||this.modelScene.loaded){var L=this.readyCallbacks.slice();this.readyCallbacks.length=0;for(var O=0,k=L;O<k.length;O++){var D=k[O];this.controller instanceof Controllers.Panorama&&D.tile===!0&&!this.controller.isTileReady()?this.readyCallbacks.push(D):D()}}}return!1},t.prototype.ready=function(e){var r=this;return e===void 0&&(e={}),new Promise(function(o){var s;r.readyCallbacks.push(Object.assign(o,{tile:(s=e.tile)!==null&&s!==void 0?s:!1}))}).then(function(){return r.model.initReady}).then(noop)},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.bindModel=function(e){var r=this,o=function(){AnimationFrameLoop.shared.add(function(){r.emit("model.load",createEvent("model.load",{work:e.work,model:e,error:null}))},!0)},s=function(c){var f=c.error;r.emit("model.error",createEvent("model.error",{work:e.work,model:e,error:f})),r.throwError(f)},u=function(){r.emit("model.changeShownFloor",createEvent("model.changeShownFloor",{work:e.work,model:e,error:null}))},l=function(){e.removeEventListener("load",o),e.removeEventListener("error",s),e.removeEventListener("changeShownFloor",u),e.removeEventListener("dispose",l)};e.addEventListener("load",o),e.addEventListener("error",s),e.addEventListener("changeShownFloor",u),e.addEventListener("dispose",l),this.emit("model.request",createEvent("model.request",{work:e.work,model:e,error:null}))},t.prototype.bindWorkFetcher=function(e){var r=this,o=e.workCode,s=e.allowHosts,u=new Fetcher({get networkSubscribe(){return r.networkSubscribe},requestProxy:function(l){return Promise.resolve(l).then(function(c){return r.requestProxy(c,o)}).then(function(c){var f=verifyURL(c,s);return f instanceof Error?Promise.reject(f):f})}});registerFetcher(this.fiveId,e,u)},t.prototype.commonParams=function(){return{fiveId:this.fiveId,scene:this.scene,xrCustomObjectsScene:this.xrCustomObjectsScene,helper:this.helperGroup,camera:this.camera,renderer:this.renderer,viewport:this.viewport,element:this.getElement(),works:this.works,imageOptions:this.imageOptions,enableWheel:this.enableWheel,extraElements:this.extraElements,videoTexture:this.videoTexture,modelScene:this.modelScene}},t.prototype.applyController=function(e,r){var o=this;if(!this.renderer)throw new Error("renderer is not initialized.");var s=Controllers[e];this.currentMode=e;for(var u=new s(r),l=function(g){u.on(g,function(){for(var m=[],E=0;E<arguments.length;E++)m[E]=arguments[E];var y=o.emit.apply(o,__spreadArray([g],m,!1));if(y)return!1})},c=0,f=PROXY_CONTROLLER_EVENT_NAMES;c<f.length;c++){var p=f[c];l(p)}{var d=Controllers[e].initAnimationEndState(r),h=r.initial.userAction;stateEqual(this.state,d)||(assignState(this.state,d),this.emit("state.change",createEvent("state.change",{userAction:h,state:this.state}))),this.emit("currentState.change",createEvent("currentState.change",{userAction:h,state:this.getCurrentState()}))}return u.on("camera.update",function(g){var m;if(o.controller){var E=o.controller.getTargetState();g.userAction&&o.syncingState===!1&&o.state.mode===E.mode&&!stateEqual(o.state,E)&&(assignState(o.state,E),o.emit("state.change",createEvent("state.change",{userAction:g.userAction,state:o.state})),(m=o.analysis)===null||m===void 0||m.state(o.works,o.state))}o.emit("currentState.change",createEvent("currentState.change",{userAction:g.userAction,state:o.getCurrentState()}))}),u.on("initAnimation.start",function(g){var m,E=g.state,y=g.userAction;y&&o.state.mode===E.mode&&!stateEqual(o.state,E)&&(assignState(o.state,E),o.emit("state.change",createEvent("state.change",{userAction:y,state:o.state})),(m=o.analysis)===null||m===void 0||m.state(o.works,o.state))}),u.on("initAnimation.end",function(g){var m,E=g.state,y=g.userAction;o.pano={workCode:E.workCode,panoIndex:E.panoIndex},y&&o.state.mode===E.mode&&!stateEqual(o.state,E)&&(assignState(o.state,E),o.emit("state.change",createEvent("state.change",{userAction:y,state:o.state})),(m=o.analysis)===null||m===void 0||m.state(o.works,o.state))}),u.on("pano.moveTo",function(g){var m,E=g.state,y=g.userAction;o.pano={workCode:E.workCode,panoIndex:E.panoIndex},y&&o.state.mode===E.mode&&!stateEqual(o.state,E)&&(assignState(o.state,E),o.emit("state.change",createEvent("state.change",{userAction:y,state:o.state})),(m=o.analysis)===null||m===void 0||m.state(o.works,o.state))}),u.on("pano.arrived",function(g){var m,E=g.state,y=g.userAction;o.pano={workCode:E.workCode,panoIndex:E.panoIndex},y&&o.state.mode===E.mode&&!stateEqual(o.state,E)&&(assignState(o.state,E),o.emit("state.change",createEvent("state.change",{userAction:y,state:o.state})),(m=o.analysis)===null||m===void 0||m.state(o.works,o.state))}),u.on("pano.cancel",function(g){var m,E=g.state,y=g.userAction;y&&o.state.mode===E.mode&&!stateEqual(o.state,E)&&(assignState(o.state,E),o.emit("state.change",createEvent("state.change",{userAction:y,state:o.state})),(m=o.analysis)===null||m===void 0||m.state(o.works,o.state))}),u.on("pano.moveTo",function(g){var m=g.userAction;o.emit("currentState.change",createEvent("currentState.change",{userAction:m,state:o.getCurrentState()}))}),u.on("pano.request",function(g){o.emit("pano.request",g),g.defaultPrevented||o.moveToPano(g.state,g.options,g.userAction)}),u.on("vr.requestExit",function(){o.currentMode===t.Mode.VRPanorama&&(o.exitFullscreen(),o.changeMode(t.Mode.Panorama))}),u.on("error",function(g){return o.throwError(g)}),u},t.prototype.removeEventListeners=function(){},Object.defineProperty(t.prototype,"internalLightsEnabled",{get:function(){var e=this.scene.children.find(function(r){return r.name==="internalLights"});return e?e.visible:!1},set:function(e){var r=this.scene.children.find(function(o){return o.name==="internalLights"});r&&(r.visible=e),r=this.modelScene.children.find(function(o){return o.name==="internalLights"}),r&&(r.visible=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"scissor",{get:function(){return this.viewport},enumerable:!1,configurable:!0}),t.prototype.setScissor=function(e){return this.setViewport(e)},t.prototype.getPose=function(){var e=this.camera.copyPose(),r=e.longitude,o=e.latitude,s=e.fov,u=e.offset,l=e.distance;return{longitude:r,latitude:o,fov:s,offset:u.clone(),distance:l}},t.prototype.getLongitudeAndLatitude=function(){var e=this.getPose(),r=e.longitude,o=e.latitude;return{longitude:r,latitude:o}},t.prototype.getOffset=function(){return this.getPose().offset},t.prototype.getCameraLocal=function(){if(this.pano.workCode&&this.controller&&this.works){var e=this.works.getObserver(this.pano);if(e){var r=new THREE__namespace.Object3D;r.matrix.copy(e.matrix).premultiply(e.work.transform),r.matrix.decompose(r.position,r.quaternion,r.scale),r.matrixAutoUpdate=!1;var o=new THREE__namespace.Vector3(0,0,-1);o.applyQuaternion(this.camera.quaternion);var s=r.quaternion.clone().inverse();o.applyQuaternion(s);var u=Math.atan2(o.x,-o.z),l=-Math.asin(o.y);return{theta:u,phi:l,lookAtVector:o}}}return null},t.prototype.addPass=function(e){this.fiveRenderer.composer.addPass(e)},t.prototype.removePass=function(e){var r=this.fiveRenderer.composer.passes.indexOf(e);r!==-1&&this.fiveRenderer.composer.passes.splice(r,1)},t.prototype.insertPass=function(e,r){this.fiveRenderer.composer.insertPass(e,r)},Object.defineProperty(t.prototype,"renderMode",{get:function(){return this.fiveRenderer.renderMode},set:function(e){this.fiveRenderer.renderMode=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enableHQ",{get:function(){return this.fiveRenderer.renderMode==="point-cloud-high-quality"},set:function(e){this.fiveRenderer.renderMode=e?"point-cloud-high-quality":"default",this.needsRender=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enableEDL",{get:function(){return this.eyeDomeLightingPass.enabled},set:function(e){this.eyeDomeLightingPass.enabled=e,this.needsRender=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enableAdaptiveLuminance",{get:function(){return this.adaptiveLuminancePass.enabled},set:function(e){this.adaptiveLuminancePass.enabled=e,this.needsRender=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enableIOSEDR",{get:function(){return!1},set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enablePostProcessing",{get:function(){return!0},set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"modelSceneNeedsRender",{get:function(){return this.modelScene.needsRender},set:function(e){this.modelScene.needsRender=e},enumerable:!1,configurable:!0}),t.Mode={Panorama:"Panorama",Model:"Model",Floorplan:"Floorplan",Topview:"Topview",Mapview:"Mapview",VRPanorama:"VRPanorama",XRPanorama:"XRPanorama"},t})(Subscribe);if(typeof window!="undefined"){var __FIVE_DEBUG__={THREE:THREE__namespace,constructor:Five,instances:Five_Instances};Object.assign(window,{__FIVE_DEBUG__})}var XRButton=(function(){function n(){}return n.createButton=function(t){var e=document.createElement("button");function r(){e.style.display="",e.style.cursor="pointer",e.style.left="calc(50% - 50px)",e.style.width="100px",e.textContent="ENTER VR",e.onmouseenter=function(){e.style.opacity="1.0"},e.onmouseleave=function(){e.style.opacity="0.5"},e.onclick=function(){t&&t()}}function o(){e.style.display="",e.style.cursor="auto",e.style.left="calc(50% - 75px)",e.style.width="150px",e.onmouseenter=null,e.onmouseleave=null,e.onclick=null}function s(){o(),e.textContent="VR NOT SUPPORTED"}function u(c){c.style.position="absolute",c.style.bottom="20px",c.style.padding="12px 6px",c.style.border="1px solid #fff",c.style.borderRadius="4px",c.style.background="rgba(0,0,0,0.1)",c.style.color="#fff",c.style.font="normal 13px sans-serif",c.style.textAlign="center",c.style.opacity="0.5",c.style.outline="none",c.style.zIndex="999"}if("xr"in navigator)return e.id="VRButton",e.style.display="none",u(e),navigator.xr.isSessionSupported("immersive-vr").then(function(c){c?r():s()}),e;var l=document.createElement("a");return window.isSecureContext===!1?(l.href=document.location.href.replace(/^http:/,"https:"),l.innerHTML="WEBXR NEEDS HTTPS"):(l.href="https://immersiveweb.dev/",l.innerHTML="WEBXR NOT AVAILABLE"),l.style.left="calc(50% - 90px)",l.style.width="180px",l.style.textDecoration="none",u(l),l},n})();exports.AdaptiveLuminancePass=AdaptiveLuminancePass;exports.AnimationFrameLoop=AnimationFrameLoop;exports.BoundingMesh=BoundingMesh$1;exports.Camera=Camera;exports.CustomShader=PBMCustomShader;exports.EffectComposer=EffectComposer;exports.EyeDomeLightingPass=EyeDomeLightingPass;exports.Fetcher=Fetcher;exports.Five=Five;exports.FivePass=FivePass;exports.FiveRenderer=FiveRenderer;exports.FullScreenQuad=FullScreenQuad;exports.InternalWebGLRenderer=InternalWebGLRenderer;exports.Model=Model;exports.ModelScene=ModelScene;exports.Motion=Motion;exports.NetworkSubscribe=NetworkSubscribe;exports.PBMContainer=PBMContainer;exports.PBMCustomShader=PBMCustomShader;exports.PBMGroup=PBMGroup;exports.PBMMesh=PBMMesh;exports.PBMMeshMaterial=PBMMeshMaterial;exports.PBMPointCloud=PBMPointCloud;exports.PBMPointCloudMaterial=PBMPointCloudMaterial;exports.PBMSkinnedMesh=PBMSkinnedMesh;exports.PROXY_CONTROLLER_EVENT_NAMES=PROXY_CONTROLLER_EVENT_NAMES;exports.PanoCircleMesh=PanoCircleMesh;exports.PanoCircleMeshCustom=PanoCircleMeshCustom;exports.PanoCircleMeshSolid=PanoCircleMeshSolid;exports.Parameter=Parameter;exports.Scene=Scene;exports.Subscribe=Subscribe;exports.TextureLoader=TextureLoader;exports.Tile=Tile;exports.Tile3D=Tile3D;exports.Tile3DModel=Tile3D;exports.TileCache=TileCache;exports.TileNode=TileNode;exports.TileRequestScheduler=TileRequestScheduler;exports.Tileset=Tileset;exports.Trajectory=Trajectory;exports.TrajectoryNode=TrajectoryNode;exports.Work=Work;exports.WorkResolvedObserver=WorkResolvedObserver;exports.XRButton=XRButton;exports.controllersDefaultInitArgs=controllersDefaultInitArgs;exports.coordinatesToVector=coordinatesToVector;exports.createDebugBoundingMesh=createDebugBoundingMesh;exports.createWorks=createWorks;exports.defaultImageURLTransform=imageURL;exports.draco=draco;exports.getViewportScale=getViewportScale;exports.headingToLongitude=headingToLongitude;exports.imageSupport=imageSupport;exports.isBoundingVolume=isBoundingVolume;exports.isPanoId=isPanoId;exports.ktx2=ktx2;exports.loadAt3d=loadAt3d;exports.loadB3dm=loadB3dm;exports.loadDome=loadDome;exports.loadDomez=loadDomez;exports.loadFbx=loadFbx;exports.loadGltf=loadGltf;exports.loadPbm=loadPbm;exports.loadPly=loadPly;exports.loadPnts=loadPnts;exports.loadX3p=loadX3p;exports.longitudeToHeading=longitudeToHeading;exports.makeBoundingVolume=makeBoundingVolume;exports.panoEqual=panoEqual;exports.panoParse=panoParse;exports.panoStringify=panoStringify;exports.parseWork=parseWork;exports.vectorToCoordinates=vectorToCoordinates;exports.workToJson=workToJson;
|