@realsee/five 6.4.1 → 6.4.3

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 CHANGED
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * @license
3
3
  * @realsee/five
4
- * Generated: 2025/6/17
5
- * Version: 6.4.1
4
+ * Generated: 6/24/2025
5
+ * Version: 6.4.3
6
6
  * Terms:
7
7
  * Realsee SDK License Agreement
8
8
  * Update: July 28, 2021
@@ -1033,7 +1033,7 @@ void main() {
1033
1033
  #include <fog_fragment>
1034
1034
  #include <premultiplied_alpha_fragment>
1035
1035
  }
1036
- `,uniforms:{diffuse:{value:new THREE__namespace.Color},opacity:{value:1},displacementScalar:{value:0}}};function createPipeBufferGeometry(n,t,e,r){for(var o=new Float32Array((e+1)*(r+1)*3),s=new Float32Array((e+1)*(r+1)*3),u=new Float32Array((e+1)*(r+1)*2),l=new Uint32Array(e*r*6),c=n.computeFrenetFrames(e),f=new THREE__namespace.Vector3,d=new THREE__namespace.Vector3,p=new THREE__namespace.Vector2,v=new THREE__namespace.Vector3,A=0;A<=e;A++){v=n.getPointAt(A/e,v);for(var g=c.normals[A],h=c.binormals[A],y=0;y<=r;y++){var m=A*(r+1)+y,E=y/r*Math.PI*2,b=Math.sin(E),T=-Math.cos(E);d.x=T*g.x+b*h.x,d.y=T*g.y+b*h.y,d.z=T*g.z+b*h.z,d.normalize(),d.toArray(s,m*3),f.x=v.x+t*d.x,f.y=v.y+t*d.y,f.z=v.z+t*d.z,f.toArray(o,m*3),p.x=A/e,p.y=y/r,p.toArray(u,m*2)}}for(var A=0;A<e;A++)for(var y=0;y<r;y++){var _=(A*r+y)*6,R=(r+1)*A+y,S=(r+1)*(A+1)+y,C=(r+1)*(A+1)+(y+1),B=(r+1)*A+(y+1);l[_]=R,l[_+1]=S,l[_+2]=B,l[_+3]=S,l[_+4]=C,l[_+5]=B}var L=new THREE__namespace.BufferGeometry;return L.setIndex(new THREE__namespace.BufferAttribute(l,1)),L.setAttribute("position",new THREE__namespace.BufferAttribute(o,3)),L.setAttribute("normal",new THREE__namespace.BufferAttribute(s,3)),L.setAttribute("uv",new THREE__namespace.BufferAttribute(u,2)),L}function parseTrajectoryObject(n,t){for(var e=new THREE__namespace.Color(0).convertSRGBToLinear(),r=new THREE__namespace.Color(52949).convertSRGBToLinear(),o=new THREE__namespace.Color(3370495).convertSRGBToLinear(),s=new THREE__namespace.Color(16777215).convertSRGBToLinear(),u=0,l=new THREE__namespace.CurvePath,c=n.length,f=3;f<c;f+=3){var d=new THREE__namespace.Vector3().fromArray(n,f-3),p=new THREE__namespace.Vector3().fromArray(n,f);u+=d.distanceTo(p);var v=new THREE__namespace.LineCurve3(d,p);l.add(v)}var A=.03,g=Math.ceil(u*100),h=6,y=createPipeBufferGeometry(l,A,g,h);y.clearGroups(),y.addGroup(0,y.index?y.index.count:y.attributes.position.count,0),y.addGroup(0,y.index?y.index.count:y.attributes.position.count,1),y.addGroup(0,y.index?y.index.count:y.attributes.position.count,2);var m=new THREE__namespace.ShaderMaterial({vertexShader:TRAJECTOR_PIPE_SHADER.vertexShader,fragmentShader:TRAJECTOR_PIPE_SHADER.fragmentShader,uniforms:THREE__namespace.UniformsUtils.clone(TRAJECTOR_PIPE_SHADER.uniforms),side:THREE__namespace.BackSide});m.uniforms.totalLength.value=u,m.uniforms.diffuse.value=e,m.uniforms.diffuse2.value=e,m.uniforms.opacity.value=.5,m.transparent=!0;var E=new THREE__namespace.ShaderMaterial({vertexShader:TRAJECTOR_PIPE_SHADER.vertexShader,fragmentShader:TRAJECTOR_PIPE_SHADER.fragmentShader,uniforms:THREE__namespace.UniformsUtils.clone(TRAJECTOR_PIPE_SHADER.uniforms),side:THREE__namespace.BackSide});E.uniforms.totalLength.value=u,E.uniforms.displacementScalar.value=-.01,E.uniforms.diffuse.value=r,E.uniforms.diffuse2.value=o;var b=new THREE__namespace.ShaderMaterial({vertexShader:TRAJECTOR_PIPE_SHADER.vertexShader,fragmentShader:TRAJECTOR_PIPE_SHADER.fragmentShader,uniforms:THREE__namespace.UniformsUtils.clone(TRAJECTOR_PIPE_SHADER.uniforms),side:THREE__namespace.DoubleSide});b.uniforms.totalLength.value=u,b.uniforms.displacementScalar.value=-.026,b.uniforms.dashSize.value=new THREE__namespace.Vector2(.06,.09),b.uniforms.diffuse.value=s,b.uniforms.diffuse2.value=s;var T=new THREE__namespace.Mesh(y,[m,E,b]),_=.08,R=24,S=new THREE__namespace.SphereBufferGeometry(_,R,R);S.clearGroups(),S.addGroup(0,y.index?y.index.count:y.attributes.position.count,0),S.addGroup(0,y.index?y.index.count:y.attributes.position.count,1);var C=new THREE__namespace.ShaderMaterial({vertexShader:TRAJECTOR_SPHERE_SHADER.vertexShader,fragmentShader:TRAJECTOR_SPHERE_SHADER.fragmentShader,uniforms:THREE__namespace.UniformsUtils.clone(TRAJECTOR_SPHERE_SHADER.uniforms),side:THREE__namespace.BackSide});C.uniforms.diffuse.value=e,C.uniforms.opacity.value=.5,C.transparent=!0;var B=new THREE__namespace.ShaderMaterial({vertexShader:TRAJECTOR_SPHERE_SHADER.vertexShader,fragmentShader:TRAJECTOR_SPHERE_SHADER.fragmentShader,uniforms:THREE__namespace.UniformsUtils.clone(TRAJECTOR_SPHERE_SHADER.uniforms),side:THREE__namespace.FrontSide});B.uniforms.displacementScalar.value=-.01,B.uniforms.diffuse.value=r;var L=new THREE__namespace.Mesh(S,[C,B]);L.position.fromArray(n,0),T.add(L);var M=new THREE__namespace.ShaderMaterial({vertexShader:TRAJECTOR_SPHERE_SHADER.vertexShader,fragmentShader:TRAJECTOR_SPHERE_SHADER.fragmentShader,uniforms:THREE__namespace.UniformsUtils.clone(TRAJECTOR_SPHERE_SHADER.uniforms),side:THREE__namespace.FrontSide});M.uniforms.displacementScalar.value=-.01,M.uniforms.diffuse.value=o;var w=new THREE__namespace.Mesh(S,[C,M]);return w.position.fromArray(n,n.length-3),T.add(w),{scene:T,dispose:function(){y.dispose(),m.dispose(),E.dispose(),b.dispose(),S.dispose(),C.dispose(),B.dispose(),M.dispose()}}}function loadTrajectory(n,t){var e=n.name,r=appendSearch(n.content.uri,t.search),o=imageURL(r,{key:"model.0"});return n.content.loadState="LOADING",n.content.loadStateUpdateTime=now(),loadPly(o,{type:"geometry",customPropertyMapping:{time:{itemType:"uint32",itemNames:["time_milisec"]}},fetcher:t.fetcher}).then(function(s){var u,l,c,f,d=(l=(u=s.scene.attributes)===null||u===void 0?void 0:u.time.array)!==null&&l!==void 0?l:[],p=(f=(c=s.scene.attributes)===null||c===void 0?void 0:c.position.array)!==null&&f!==void 0?f:[],v=s.byteLength,A=s.memoryUsage,g=parseTrajectoryObject(p);g.scene.applyMatrix4(n.transform),g.scene.updateWorldMatrix(!1,!0),g.scene.matrixAutoUpdate=!1;var h=new TrajectoryNode(e,g.scene);return n.content.data={uri:o,byteLength:v,memoryUsage:A,positionArray:p,timeArray:d,object:h},n.content.byteLength=v,n.content.memoryUsage=A,n.content.loadState="READY",n.content.loadStateUpdateTime=now(),n}).catch(function(s){return n.content.data=void 0,n.content.loadState="FAILED",n.content.loadStateUpdateTime=now(),s instanceof NetworkResponseError&&s.httpStatus===0||s instanceof NetworkTimeoutError||s instanceof NetworkProxyError?n.content.loadfailRetryDelay=clamp$1(n.content.loadfailRetryDelay+RETRY_DELAY_STEP,RETRY_DELAY_STEP,MAX_RETRY_DELAY):n.content.loadfailRetryDelay=1/0,Promise.reject(s)})}function unloadTrajectory(n){n.content&&(n.content.data&&n.content.data.object.dispose(),n.content.data=void 0,n.content.loadState="UNLOADED",n.content.loadStateUpdateTime=now(),n.content.byteLength=0,n.content.memoryUsage=0)}var scratchVector3$1=new THREE__namespace.Vector3,scratchMatrix3=new THREE__namespace.Matrix3,scratchMatrix4$2=new THREE__namespace.Matrix4,a=6378137,invF=298.257223563;function ecefToLla(n){for(var t=a-a/invF,e=(a*a-t*t)/(a*a),r=Math.sqrt(n.x*n.x+n.y*n.y),o=1e-12,s=1e3,u=0,l=Math.atan2(n.z,r),c=0;u++<s;){var f=Math.sin(l),d=a/Math.sqrt(1-e*f*f);c=r/Math.cos(l)-d;var p=Math.atan2(n.z/(d*(1-e)+c),r/(d+c));if(isNaN(p))break;var v=Math.abs(p-l);if(v<o)break;l=p}return n.set(l,Math.atan2(n.y,n.x),c)}function llaToEcef(n){var t=n.x,e=n.y,r=n.z,o=a-a/invF,s=(a*a-o*o)/(a*a),u=Math.sin(t),l=Math.cos(t),c=Math.sin(e),f=Math.cos(e),d=a/Math.sqrt(1-s*u*u),p=(d+r)*l*f,v=(d+r)*l*c,A=(o*o/(a*a)*d+r)*u;return n.set(p,v,A)}function getEcefToEnuMatrix(n,t){var e=ecefToLla(scratchVector3$1.copy(n)),r=e.x,o=e.y,s=e.z,u=Math.sin(r),l=Math.sin(o),c=Math.cos(r),f=Math.cos(o);t.fromArray([-l,-u*f,c*f,0,+f,-u*l,c*l,0,0,c,u,0,0,0,0,1]);var d=scratchMatrix3.setFromMatrix4(t),p=scratchVector3$1.copy(n).applyMatrix3(d).multiplyScalar(-1);t.setPosition(p);var v=scratchMatrix4$2.fromArray([1,0,0,0,0,1,0,0,0,0,1,0,0,0,s,1]);return t.premultiply(v),t}var StencilConstants={TILE_MASK:128,SKIP_LOD_MASK:112,SKIP_LOD_BIT_SHIFT:4,CLASSIFICATION_MASK:15},SKIP_BACKFACE_MATERIAL=function(){var n=new THREE__namespace.MeshBasicMaterial;return n.side=THREE__namespace.BackSide,n.color.setHex(16711935),n.colorWrite=!1,n.stencilWrite=!0,n.polygonOffset=!0,n.polygonOffsetFactor=2,n.polygonOffsetUnits=2,n.stencilRef=StencilConstants.TILE_MASK,n.stencilFunc=THREE__namespace.AlwaysStencilFunc,n.stencilFuncMask=StencilConstants.TILE_MASK,n.stencilZPass=THREE__namespace.ReplaceStencilOp,n.stencilWriteMask=StencilConstants.TILE_MASK,n}(),SKIP_BACKFACE_TRANSPARENT_MATERIAL=function(){var n=new THREE__namespace.MeshBasicMaterial;return n.visible=!1,n}(),CLEAR_STENCIL_GEOMETRY=new THREE__namespace.BufferGeometry,CLEAR_STENCIL_MATERIAL=new THREE__namespace.MeshBasicMaterial,Tile3DModel=function(n){__extends(t,n);function t(e,r,o){var s,u,l,c=n.call(this)||this;return c.modelIndex=0,c.renderObjects=[],c.backfaceObjects=[],c.debugObjects=[],c.tileObjects=[],c.debug="none",c.name=o.name,c.type=o.type,c.light=o.light,c.upAxis=o.upAxis,c.model=e,c.fetcher=o.fetcher,c.search=(s=o.search)!==null&&s!==void 0?s:"",c.groundHeight=o.groundHeight,c.coordinateTransform=o.coordinateTransform,c.boundingBox=new THREE__namespace.Box3,c.minLevelOfDetail=t.DEFAULT_MIN_LEVEL_OF_DETAIL,c.maxLevelOfDetail=t.DEFAULT_MAX_LEVEL_OF_DETAIL,c.minGeometricError=t.DEFAULT_MIN_GEOMETRIC_ERROR,c.maxGeometricError=t.DEFAULT_MAX_GEOMETRIC_ERROR,c.panoramaMinGeometricError=t.DEFAULT_PANORAMA_MIN_GEOMETRIC_ERROR,c.needsRefined=!0,c.refined=!1,c.refineProgress=[0,0],c.loaded=!1,c.modelsLoaded=!1,c.disposed=!1,c.needsRender=!0,c.lastRenderHash="",c.matrixAutoUpdate=!1,c.cacheCameras=[],c.clearStencilObject=new THREE__namespace.Mesh(CLEAR_STENCIL_GEOMETRY,CLEAR_STENCIL_MATERIAL),c.clearStencilObject.frustumCulled=!1,c.clearStencilObject.onAfterRender=function(f){return f.clearStencil()},c.tileset=new Tileset((l=(u=c.model.work)===null||u===void 0?void 0:u.workCode)!==null&&l!==void 0?l:"",r,{referer:o.referer,tileLoader:function(f){return c.loadContent(f)},tileUnloader:function(f){return c.unloadContent(f)},onTileLoad:function(){},onTileUnload:function(f){},onTileError:function(f,d){o.onError&&o.onError(Object.assign(d,{error:d})),console.error("Tile error",f.id,d)},trajectoryLoader:function(f){return c.loadTrajectory(f)},trajectoryUnloader:function(f){return c.unloadTrajectory(f)},onTrajectoryLoad:function(){},onTrajectoryUnload:function(f){},onTrajectoryError:function(f,d){o.onError&&o.onError(Object.assign(d,{error:d})),console.error("Trajectory error",f,d)}}),c.tileset.root.boundingVolume&&c.tileset.root.boundingVolume.getBoundingBox(c.boundingBox),c}return t.prototype.getRecommendProps=function(e){var r,o,s;e===void 0&&(e={});var u,l,c,f=128;e.powerPreference==="high"&&(f=512);var d=typeof this.tileset.rootMeta.creationTime=="string";if(d){var p=typeof this.tileset.rootMeta.numTotalPoints=="number"&&this.tileset.rootMeta.numTotalPoints>0;if(p){c=4,e.powerPreference==="high"&&(c=2),u=c/1.6;var v=0;if(((r=this.tileset.rootMeta.taskParameters)===null||r===void 0?void 0:r.point_homogenization)==="1"&&(!((o=this.tileset.rootMeta.taskParameters)===null||o===void 0)&&o.homo_point_density)){var A=Number((s=this.tileset.rootMeta.taskParameters)===null||s===void 0?void 0:s.homo_point_density);isFinite(A)&&!isNaN(A)&&(v=A)}v<=0&&(v=.02),l=v*1.4}else c=5,e.powerPreference==="high"&&(c=4),u=1,l=.03}else c=6,u=1,l=.03,this.name==="aerophoto"?(c=12,e.powerPreference==="high"&&(c=10)):this.tileset.asset.extras&&typeof this.tileset.asset.extras.name=="string"&&/^matterport\b/i.test(this.tileset.asset.extras.name)&&(c=5,e.powerPreference==="high"&&(c=4));return{pointScale:l,pointMinPixel:u,maxScreenSpaceError:c,maxMemoryUsage:f}},t.prototype.getRenderHash=function(){return jsonHash([this.tileset.id,this.tileset.skipLevelOfDetail,this.tileset.selectedTiles.map(function(e){return e.id}),this.tileset.selectedTrajectories.map(function(e){return e.index}),this.debug])},Object.defineProperty(t.prototype,"maxMemoryUsage",{get:function(){return this.tileset.maxMemoryUsage},set:function(e){this.tileset.maxMemoryUsage=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"maxRequests",{get:function(){return this.tileset.maxRequests},set:function(e){this.tileset.maxRequests=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"requestOrder",{get:function(){return this.tileset.tileRequestOrder},set:function(e){this.tileset.tileRequestOrder=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"skipLevelOfDetail",{get:function(){return this.tileset.skipLevelOfDetail},set:function(e){this.tileset.skipLevelOfDetail=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"mostDetail",{get:function(){return this.tileset.mostDetail},set:function(e){this.tileset.mostDetail=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"loadSiblings",{get:function(){return this.tileset.loadSiblings},set:function(e){this.tileset.loadSiblings=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"loadAll",{get:function(){return this.tileset.loadAll},set:function(e){this.tileset.loadAll=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"maxScreenSpaceError",{get:function(){return this.tileset.maxScreenSpaceError},set:function(e){this.tileset.maxScreenSpaceError=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"currentMaxScreenSpaceError",{get:function(){return this.tileset.currentMaxScreenSpaceError},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"trajectories",{get:function(){return this.tileset.trajectories},enumerable:!1,configurable:!0}),t.prototype.localToEnu=function(e){return e.applyMatrix4(this.coordinateTransform.localToEnuMatrix)},t.prototype.enuToLocal=function(e){return e.applyMatrix4(this.coordinateTransform.enuToLocalMatrix)},t.prototype.localToEcef=function(e){return e.applyMatrix4(this.coordinateTransform.localToEcefMatrix)},t.prototype.ecefToLocal=function(e){return e.applyMatrix4(this.coordinateTransform.ecefToLocalMatrix)},t.prototype.localToLla=function(e){return ecefToLla(this.localToEcef(e))},t.prototype.llaToLocal=function(e){return this.ecefToLocal(llaToEcef(e))},t.prototype.worldToEnu=function(e){return this.localToEnu(this.worldToLocal(e))},t.prototype.enuToWorld=function(e){return this.localToWorld(this.enuToLocal(e))},t.prototype.worldToEcef=function(e){return this.localToEcef(this.worldToLocal(e))},t.prototype.ecefToWorld=function(e){return this.localToWorld(this.ecefToLocal(e))},t.prototype.worldToLla=function(e){return this.localToLla(this.worldToLocal(e))},t.prototype.llaToWorld=function(e){return this.localToWorld(this.llaToLocal(e))},t.prototype.loadContent=function(e){var r=this;return loadTileContent(e,{light:this.light,fetcher:this.fetcher,search:this.search,renderer:this.renderer}).then(function(o){e.type==="SCENEGRAPH"&&(r.disposed||!e.content?unloadTileContent(e):e.content.data&&r.boundingBox.expandByObject(e.content.data.object))})},t.prototype.unloadContent=function(e){return unloadTileContent(e),Promise.resolve()},t.prototype.loadAllTilesets=function(){var e=this,r=function(o){var s=[];return e.tileset.root.traverse(function(u){var l;u.type==="TILESET"&&((l=u.content)===null||l===void 0?void 0:l.loadState)!=="READY"&&s.push(u)}),Promise.all(s.map(function(u){return e.loadContent(u).then(function(){return r()})})).then(function(){})};return r(this.tileset.root)},t.prototype.loadTrajectory=function(e){var r=this;return loadTrajectory(e,{fetcher:this.fetcher,search:this.search,renderer:this.renderer}).then(function(o){r.disposed&&unloadTrajectory(o)})},t.prototype.unloadTrajectory=function(e){return unloadTrajectory(e),Promise.resolve()},t.prototype.intersectRaycaster=function(e,r,o){var s=this;r===void 0&&(r=!0),o===void 0&&(o=[]);for(var u=[this.tileset.root],l=this.tileset.transform,c=this.tileset.transformIsIdentity,f,d=[];f=u.pop();){var p=void 0;if(f.boundingVolume){var v=c?f.boundingVolume:f.boundingVolume.clone().applyMatrix4(l);p=v.intersectRay(e.ray,e.far)}else p=!0;if(p){for(var A=0,g=f.children.length;A<g;A++)u.push(f.children[A]);f.selected&&f.content&&f.content.data&&f.content.data.object.visible&&f.content.data.object.intersectRaycaster(e,!1,d)}}return this.model.shownFloorIndex>=0&&(d=d.filter(function(h){return h.floor===s.model.shownFloorIndex})),r&&d.sort(function(h,y){return h.distance-y.distance}),d.map(function(h){h.model=s.model,h.viewLayer=s.viewLayer}),o.push.apply(o,d),o},t.prototype.cloneSkipBackfaceObject=function(e){var r;e instanceof THREE__namespace.Mesh?r=new THREE__namespace.Mesh(e.geometry,Array.isArray(e.material)?e.material.map(function(l){return l.transparent?SKIP_BACKFACE_TRANSPARENT_MATERIAL:SKIP_BACKFACE_MATERIAL}):e.material&&e.material.transparent?SKIP_BACKFACE_TRANSPARENT_MATERIAL:SKIP_BACKFACE_MATERIAL):e instanceof THREE__namespace.Group?r=new THREE__namespace.Group:r=new THREE__namespace.Object3D,r.copy(e,!1);for(var o=0,s=e.children;o<s.length;o++){var u=s[o];r.add(this.cloneSkipBackfaceObject(u))}return r},t.prototype.update=function(e,r,o){var s,u,l,c=this,f,d,p;this.renderObjects.length=0,this.backfaceObjects.length=0,this.debugObjects.length=0,this.tileObjects.length=0,this.renderer=e,this.updateMatrixWorld(!0),this.tileset.transform.equals(this.matrixWorld)||this.tileset.transform.copy(this.matrixWorld),this.tileset.cache.reset();var v=this.tileset.frameNumber+1,A=this.maxLevelOfDetail;A=Math.max(A,0);var g=Math.min(this.minLevelOfDetail,A);(!this.visible||!this.loaded||!this.modelsLoaded)&&(A=Math.max(g,0));var h=this.minGeometricError,y=this.maxGeometricError;if(y=Math.max(h,y),o==="Panorama"||o==="VRPanorama"||o==="XRPanorama"){var m=this.model.getMaterial().modelAlpha;m<.1&&(h=this.panoramaMinGeometricError)}var E={time:now(),camera:{type:r.type,position:new THREE__namespace.Vector3().copy(r.position),direction:r.getDirection(new THREE__namespace.Vector3),up:new THREE__namespace.Vector3().copy(r.up).applyQuaternion(r.quaternion),projectionMatrix:r.projectionMatrix.clone(),visible:r.visible,refine:r.refineModel},minLevelOfDetail:g,maxLevelOfDetail:A,minGeometricError:h,maxGeometricError:y,height:r.resolution.height,pixelRatio:r.pixelRatio,frameNumber:v,sseDenominator:2*Math.tan(.5*r.fov/180*Math.PI),cullingVolume:new CullingVolume().setFromCamera(r)},b=this.cacheCameras.map(function(j){return j.updateProjectionMatrix(),__assign(__assign({},E),{camera:{type:r.type,position:new THREE__namespace.Vector3().copy(j.position),direction:j.getWorldDirection(new THREE__namespace.Vector3),up:new THREE__namespace.Vector3().copy(j.up),projectionMatrix:j.projectionMatrix.clone(),visible:j.visible,refine:!0},cullingVolume:new CullingVolume().setFromCamera(j)})});if(this.needsRefined&&this.tileset.update(E,b),this.refined=!0,this.refineProgress[0]=0,this.refineProgress[1]=0,this.tileset.needsRefinedTiles.forEach(function(j){if(c.refineProgress[1]++,j.content){var se=j.content.loadState;if(se==="UNLOADED"||se==="LOADING"){c.refined=!1;return}}c.refineProgress[0]++}),this.loaded===!1&&this.needsRefined){this.loaded=!0;var T=!1;this.tileset.needsRefinedTiles.forEach(function(j){if(c.loaded!==!1&&j.content){if(T=!0,c.tileset.skipLevelOfDetail){if(j.state.finalResolution){var se=j.state.ancestorWithContentAvailable,ie=se&&se.content?se.content:j.content,ue=ie.loadState;(ue==="UNLOADED"||ue==="LOADING")&&(c.loaded=!1)}}else if(j.state.visible&&j.levelOfContent<=0){var ue=j.content.loadState;(ue==="UNLOADED"||ue==="LOADING")&&(c.loaded=!1)}}}),T&&this.tileset.selectedTiles.length===0&&(this.loaded=!1),this.loaded===!0&&(this.refined=!1,this.refineProgress[1]++)}this.remove.apply(this,this.children),this.tileset.skipLevelOfDetail||this.tileset.selectedTiles.sort(function(j,se){return j.floor!==se.floor?j.floor-se.floor:j.levelOfContent!==se.levelOfContent?se.levelOfContent-j.levelOfContent:j.state.distanceToCamera!==se.state.distanceToCamera?j.state.distanceToCamera-se.state.distanceToCamera:j.state.centerZDepth-se.state.centerZDepth}),this.debug==="root-bounding-volume"&&this.tileset.root.boundingVolumeDebugObject&&this.debugObjects.push(this.tileset.root.boundingVolumeDebugObject);for(var _=0,R=this.tileset.selectedTiles;_<R.length;_++){var S=R[_];this.debug==="selected-bounding-volume"&&S.boundingVolumeDebugObject&&this.debugObjects.push(S.boundingVolumeDebugObject);var C=(d=(f=S.content)===null||f===void 0?void 0:f.data)===null||d===void 0?void 0:d.object;if(C){if(C.update(e,r,this.model,S),this.tileset.hasMixedContent&&this.tileset.skipLevelOfDetail){if(!S.state.finalResolution){var B=this.cloneSkipBackfaceObject(C);this.backfaceObjects.push(B)}for(var L=S.state.selectionDepth,M=StencilConstants.TILE_MASK|L<<StencilConstants.SKIP_LOD_BIT_SHIFT,w=THREE__namespace.GreaterEqualStencilFunc,H=StencilConstants.SKIP_LOD_MASK,O=THREE__namespace.ReplaceStencilOp,I=StencilConstants.TILE_MASK|StencilConstants.SKIP_LOD_MASK,N=0,k=C.materials;N<k.length;N++){var U=k[N];U.stencilWrite=!0,U.stencilRef=M,U.stencilFunc=w,U.stencilFuncMask=H,U.stencilZPass=O,U.stencilWriteMask=I}}else for(var D=0,q=C.materials;D<q.length;D++){var U=q[D];U.stencilWrite=!1,U.stencilRef=StencilConstants.TILE_MASK,U.stencilFunc=THREE__namespace.AlwaysStencilFunc,U.stencilFuncMask=StencilConstants.TILE_MASK,U.stencilZPass=THREE__namespace.ReplaceStencilOp,U.stencilWriteMask=StencilConstants.TILE_MASK}this.tileObjects.push(C)}}this.tileset.skipLevelOfDetail&&this.backfaceObjects.length&&(s=this.renderObjects).push.apply(s,this.backfaceObjects),this.tileObjects.length&&(u=this.renderObjects).push.apply(u,this.tileObjects),this.tileset.skipLevelOfDetail&&this.renderObjects.push(this.clearStencilObject);for(var z=0,Q=this.tileset.selectedTrajectories;z<Q.length;z++){var G=Q[z],X=(p=G.content.data)===null||p===void 0?void 0:p.object;X&&(X.update(e,r,this.model),this.renderObjects.push(X))}this.debug&&(l=this.renderObjects).push.apply(l,this.debugObjects);for(var $=this.modelIndex*1e4,W=function(j){var se=oe.renderObjects[j],ie=j+$;se.traverse(function(ue){(ue instanceof THREE__namespace.Mesh||ue instanceof THREE__namespace.Line||ue instanceof THREE__namespace.Points)&&(ue.renderOrder=ie)}),oe.add(se)},oe=this,ae=0;ae<this.renderObjects.length;ae++)W(ae);var re=this.getRenderHash();this.lastRenderHash!==re&&(this.needsRender=!0,this.lastRenderHash=re)},t.prototype.dispose=function(){this.disposed=!0,this.viewLayer=void 0,this.tileset.reset(),this.remove.apply(this,this.children),this.refineProgress[0]=0,this.refineProgress[1]=0,this.refined=!1,this.loaded=!1},t.DEFAULT_PANORAMA_MIN_GEOMETRIC_ERROR=1,t.DEFAULT_MIN_LEVEL_OF_DETAIL=0,t.DEFAULT_MAX_LEVEL_OF_DETAIL=20,t.DEFAULT_MIN_GEOMETRIC_ERROR=0,t.DEFAULT_MAX_GEOMETRIC_ERROR=1e4,t.DEFAULT_MAX_MEMORY_USAGE=16,t.DEFAULT_MAX_SCREEN_SPACE_ERROR=Tileset.DEFAULT_MAX_SCREEN_SPACE_ERROR,t.DEFAULT_SKIP_LEVEL_OF_DETAIL=Tileset.DEFAULT_SKIP_LEVEL_OF_DETAIL,t.DEFAULT_MOST_DETAIL=Tileset.DEFAULT_MOST_DETAIL,t.DEFAULT_LOAD_SIBLINGS=Tileset.DEFAULT_LOAD_SIBLINGS,t.DEFAULT_LOAD_ALL=Tileset.DEFAULT_LOAD_ALL,t.DEFAULT_MAX_REQUESTS=Tileset.DEFAULT_MAX_REQUESTS,t.DEFAULT_REQUEST_ORDER=Tileset.DEFAULT_REQUEST_ORDER,t}(THREE__namespace.Object3D);function headingToLongitude(n){return-((n-.25)*360+90)/180*Math.PI}function equal(n,t){if(n===t)return!0;if(n&&t&&typeof n=="object"&&typeof t=="object"){if(n.constructor!==t.constructor)return!1;var e,r,o;if(Array.isArray(n)){if(e=n.length,e!=t.length)return!1;for(r=e;r--!==0;)if(!equal(n[r],t[r]))return!1;return!0}if(n.constructor===RegExp)return n.source===t.source&&n.flags===t.flags;if(n.valueOf!==Object.prototype.valueOf)return n.valueOf()===t.valueOf();if(n.toString!==Object.prototype.toString)return n.toString()===t.toString();if(o=Object.keys(n),e=o.length,e!==Object.keys(t).length)return!1;for(r=e;r--!==0;)if(!Object.prototype.hasOwnProperty.call(t,o[r]))return!1;for(r=e;r--!==0;){var s=o[r];if(!equal(n[s],t[s]))return!1}return!0}return n!==n&&t!==t}function isNumber(n){return typeof n=="number"}function S4(){return((1+Math.random())*65536|0).toString(16).substring(1)}function createUuid(){return(S4()+S4()+"-"+S4()+"-4"+S4().substr(0,3)+"-"+S4()+"-"+S4()+S4()+S4()).toLowerCase()}var error_invalid_input=function(){return new Error("Invalid input.")},error_invalid_certificate=function(){return new Error("Invalid certificate.")},error_invalid_signature=function(){return new Error("Invalid signature.")},error_date_expired=function(n){return new Error("date(".concat(n.toString(),") expired."))},error_host_not_allowed=function(n){return new Error("host(".concat(JSON.stringify(n),") is not allowed."))};function ObjectOmit(n,t){for(var e={},r=0,o=Object.keys(n);r<o.length;r++){var s=o[r];t.indexOf(s)===-1&&(e[s]=n[s])}return e}function jsonStableNoneNumberStrinfiy_(n,t){t===void 0&&(t=!1);var e=typeof n;if(e==="string")return JSON.stringify(n);if(n===!0)return"true";if(n===!1)return"false";if(n===null)return"null";if(n instanceof Array){for(var r="[",o=n.length-1,s=0;s<o;s++)r+=jsonStableNoneNumberStrinfiy_(n[s],!1)+",";return o>-1&&(r+=jsonStableNoneNumberStrinfiy_(n[s],!1)),r+"]"}if(n instanceof Object){if(typeof n.toJSON=="function")return jsonStableNoneNumberStrinfiy_(n.toJSON(),t);for(var u=Object.keys(n).sort(),l=u.length,r="",s=0;s<l;){var c=u[s],f=jsonStableNoneNumberStrinfiy_(n[c],!0);f!==void 0&&(s&&r!==""&&(r+=","),r+=JSON.stringify(c)+":"+f),s++}return"{"+r+"}"}switch(e){case"function":case"undefined":return t?void 0:null;case"number":return 0;default:return isFinite(n)?n:null}}function jsonStableNoneNumberStrinfiy(n){return String(jsonStableNoneNumberStrinfiy_(n,!1))}function verify(n){var t,e,r;if(Array.isArray(n)){var o=void 0,s,u;if(n.length<=0)return error_invalid_input();for(var l=function(_){var R=verify(n[_]);if(R instanceof Error)return{value:R};if(!o)o=R.issuer;else if(o!==R.issuer)return{value:error_invalid_certificate()};s?R.expire.getTime()<s.getTime()&&(s=R.expire):s=R.expire,u?u=u.filter(function(S){return R.allowHosts.indexOf(S)!==-1}):u=R.allowHosts},c=0;c<n.length;c++){var f=l(c);if(typeof f=="object")return f.value}return deepFreeze({issuer:o,expire:s,allowHosts:u})}var d=JSON.parse(n),p=typeof location!="undefined"?location.hostname:"",v=Date.now();if(typeof d!="object")return error_invalid_input();var A=new Date(typeof d.expire_at=="string"&&/^\d+$/.test(d.expire_at)?Number(d.expire_at):d.expire_at),g=Array.isArray(d.allow_hosts)?d.allow_hosts:[];if(p.length===0||isIPDomain(p)||BUILDIN_ALLOW_HOST.filter(function(_){return matchDomain(_,p)}).length>0){var h=String((t=d.certificate)!==null&&t!==void 0?t:"");if(h){var y=new X509;return y.readCertPEM(h),deepFreeze({issuer:y.getSubjectString(),expire:A,allowHosts:g})}return deepFreeze({issuer:"none",expire:A,allowHosts:g})}var m=String((e=d.certificate)!==null&&e!==void 0?e:"");if(!m)return error_invalid_certificate();var E=new X509;E.readCertPEM(m);var b=String((r=d._signature)!==null&&r!==void 0?r:"");if(!b)return error_invalid_signature();var T=jsonStableNoneNumberStrinfiy(ObjectOmit(d,["_signature"]));return verifyMessage(T,b,E)===!1?error_invalid_signature():v<A.getTime()?g.filter(function(_){return matchDomain(_,p)}).length===0?error_host_not_allowed(p):deepFreeze({issuer:E.getSubjectString(),expire:A,allowHosts:g}):error_date_expired(A)}var scratchMatrix4$1=new THREE__namespace.Matrix4,workRawMapping=new WeakMap,needsUpdateWorkCodeSet=new Set,Work=function(){function n(t,e){this.name="",this.baseURL="",this.workCode="",this.expire=new Date,this.allowHosts=[],this.initial={work:this},this.observers=[],this.issuer="none",this.raw={works:[""],options:""},this.transform=new THREE__namespace.Matrix4;{var r=this;this.options={get transform(){return r.transform},set transform(s){r.transform.copy(s)}}}if(t!==null)if("up"in t&&typeof t.up=="string"&&"down"in t&&typeof t.down=="string"&&"right"in t&&typeof t.right=="string"&&"left"in t&&typeof t.left=="string"&&"front"in t&&typeof t.front=="string"&&"back"in t&&typeof t.back=="string"&&"size"in t&&typeof t.size=="number")parsePanoWork(t,this);else{var o=parse(t,e,this);if(o instanceof Error)throw new Error("[PARSE FAILED]: "+o.message+`
1036
+ `,uniforms:{diffuse:{value:new THREE__namespace.Color},opacity:{value:1},displacementScalar:{value:0}}};function createPipeBufferGeometry(n,t,e,r){for(var o=new Float32Array((e+1)*(r+1)*3),s=new Float32Array((e+1)*(r+1)*3),u=new Float32Array((e+1)*(r+1)*2),l=new Uint32Array(e*r*6),c=n.computeFrenetFrames(e),f=new THREE__namespace.Vector3,d=new THREE__namespace.Vector3,p=new THREE__namespace.Vector2,v=new THREE__namespace.Vector3,A=0;A<=e;A++){v=n.getPointAt(A/e,v);for(var g=c.normals[A],h=c.binormals[A],y=0;y<=r;y++){var m=A*(r+1)+y,E=y/r*Math.PI*2,b=Math.sin(E),T=-Math.cos(E);d.x=T*g.x+b*h.x,d.y=T*g.y+b*h.y,d.z=T*g.z+b*h.z,d.normalize(),d.toArray(s,m*3),f.x=v.x+t*d.x,f.y=v.y+t*d.y,f.z=v.z+t*d.z,f.toArray(o,m*3),p.x=A/e,p.y=y/r,p.toArray(u,m*2)}}for(var A=0;A<e;A++)for(var y=0;y<r;y++){var _=(A*r+y)*6,R=(r+1)*A+y,S=(r+1)*(A+1)+y,C=(r+1)*(A+1)+(y+1),B=(r+1)*A+(y+1);l[_]=R,l[_+1]=S,l[_+2]=B,l[_+3]=S,l[_+4]=C,l[_+5]=B}var L=new THREE__namespace.BufferGeometry;return L.setIndex(new THREE__namespace.BufferAttribute(l,1)),L.setAttribute("position",new THREE__namespace.BufferAttribute(o,3)),L.setAttribute("normal",new THREE__namespace.BufferAttribute(s,3)),L.setAttribute("uv",new THREE__namespace.BufferAttribute(u,2)),L}function parseTrajectoryObject(n,t){for(var e=new THREE__namespace.Color(0).convertSRGBToLinear(),r=new THREE__namespace.Color(52949).convertSRGBToLinear(),o=new THREE__namespace.Color(3370495).convertSRGBToLinear(),s=new THREE__namespace.Color(16777215).convertSRGBToLinear(),u=0,l=new THREE__namespace.CurvePath,c=n.length,f=3;f<c;f+=3){var d=new THREE__namespace.Vector3().fromArray(n,f-3),p=new THREE__namespace.Vector3().fromArray(n,f);u+=d.distanceTo(p);var v=new THREE__namespace.LineCurve3(d,p);l.add(v)}var A=.03,g=Math.ceil(u*100),h=6,y=createPipeBufferGeometry(l,A,g,h);y.clearGroups(),y.addGroup(0,y.index?y.index.count:y.attributes.position.count,0),y.addGroup(0,y.index?y.index.count:y.attributes.position.count,1),y.addGroup(0,y.index?y.index.count:y.attributes.position.count,2);var m=new THREE__namespace.ShaderMaterial({vertexShader:TRAJECTOR_PIPE_SHADER.vertexShader,fragmentShader:TRAJECTOR_PIPE_SHADER.fragmentShader,uniforms:THREE__namespace.UniformsUtils.clone(TRAJECTOR_PIPE_SHADER.uniforms),side:THREE__namespace.BackSide});m.uniforms.totalLength.value=u,m.uniforms.diffuse.value=e,m.uniforms.diffuse2.value=e,m.uniforms.opacity.value=.5,m.transparent=!0;var E=new THREE__namespace.ShaderMaterial({vertexShader:TRAJECTOR_PIPE_SHADER.vertexShader,fragmentShader:TRAJECTOR_PIPE_SHADER.fragmentShader,uniforms:THREE__namespace.UniformsUtils.clone(TRAJECTOR_PIPE_SHADER.uniforms),side:THREE__namespace.BackSide});E.uniforms.totalLength.value=u,E.uniforms.displacementScalar.value=-.01,E.uniforms.diffuse.value=r,E.uniforms.diffuse2.value=o;var b=new THREE__namespace.ShaderMaterial({vertexShader:TRAJECTOR_PIPE_SHADER.vertexShader,fragmentShader:TRAJECTOR_PIPE_SHADER.fragmentShader,uniforms:THREE__namespace.UniformsUtils.clone(TRAJECTOR_PIPE_SHADER.uniforms),side:THREE__namespace.DoubleSide});b.uniforms.totalLength.value=u,b.uniforms.displacementScalar.value=-.026,b.uniforms.dashSize.value=new THREE__namespace.Vector2(.06,.09),b.uniforms.diffuse.value=s,b.uniforms.diffuse2.value=s;var T=new THREE__namespace.Mesh(y,[m,E,b]),_=.08,R=24,S=new THREE__namespace.SphereBufferGeometry(_,R,R);S.clearGroups(),S.addGroup(0,y.index?y.index.count:y.attributes.position.count,0),S.addGroup(0,y.index?y.index.count:y.attributes.position.count,1);var C=new THREE__namespace.ShaderMaterial({vertexShader:TRAJECTOR_SPHERE_SHADER.vertexShader,fragmentShader:TRAJECTOR_SPHERE_SHADER.fragmentShader,uniforms:THREE__namespace.UniformsUtils.clone(TRAJECTOR_SPHERE_SHADER.uniforms),side:THREE__namespace.BackSide});C.uniforms.diffuse.value=e,C.uniforms.opacity.value=.5,C.transparent=!0;var B=new THREE__namespace.ShaderMaterial({vertexShader:TRAJECTOR_SPHERE_SHADER.vertexShader,fragmentShader:TRAJECTOR_SPHERE_SHADER.fragmentShader,uniforms:THREE__namespace.UniformsUtils.clone(TRAJECTOR_SPHERE_SHADER.uniforms),side:THREE__namespace.FrontSide});B.uniforms.displacementScalar.value=-.01,B.uniforms.diffuse.value=r;var L=new THREE__namespace.Mesh(S,[C,B]);L.position.fromArray(n,0),T.add(L);var M=new THREE__namespace.ShaderMaterial({vertexShader:TRAJECTOR_SPHERE_SHADER.vertexShader,fragmentShader:TRAJECTOR_SPHERE_SHADER.fragmentShader,uniforms:THREE__namespace.UniformsUtils.clone(TRAJECTOR_SPHERE_SHADER.uniforms),side:THREE__namespace.FrontSide});M.uniforms.displacementScalar.value=-.01,M.uniforms.diffuse.value=o;var w=new THREE__namespace.Mesh(S,[C,M]);return w.position.fromArray(n,n.length-3),T.add(w),{scene:T,dispose:function(){y.dispose(),m.dispose(),E.dispose(),b.dispose(),S.dispose(),C.dispose(),B.dispose(),M.dispose()}}}function loadTrajectory(n,t){var e=n.name,r=appendSearch(n.content.uri,t.search),o=imageURL(r,{key:"model.0"});return n.content.loadState="LOADING",n.content.loadStateUpdateTime=now(),loadPly(o,{type:"geometry",customPropertyMapping:{time:{itemType:"uint32",itemNames:["time_milisec"]}},fetcher:t.fetcher}).then(function(s){var u,l,c,f,d=(l=(u=s.scene.attributes)===null||u===void 0?void 0:u.time.array)!==null&&l!==void 0?l:[],p=(f=(c=s.scene.attributes)===null||c===void 0?void 0:c.position.array)!==null&&f!==void 0?f:[],v=s.byteLength,A=s.memoryUsage,g=parseTrajectoryObject(p);g.scene.applyMatrix4(n.transform),g.scene.updateWorldMatrix(!1,!0),g.scene.matrixAutoUpdate=!1;var h=new TrajectoryNode(e,g.scene);return n.content.data={uri:o,byteLength:v,memoryUsage:A,positionArray:p,timeArray:d,object:h},n.content.byteLength=v,n.content.memoryUsage=A,n.content.loadState="READY",n.content.loadStateUpdateTime=now(),n}).catch(function(s){return n.content.data=void 0,n.content.loadState="FAILED",n.content.loadStateUpdateTime=now(),s instanceof NetworkResponseError&&s.httpStatus===0||s instanceof NetworkTimeoutError||s instanceof NetworkProxyError?n.content.loadfailRetryDelay=clamp$1(n.content.loadfailRetryDelay+RETRY_DELAY_STEP,RETRY_DELAY_STEP,MAX_RETRY_DELAY):n.content.loadfailRetryDelay=1/0,Promise.reject(s)})}function unloadTrajectory(n){n.content&&(n.content.data&&n.content.data.object.dispose(),n.content.data=void 0,n.content.loadState="UNLOADED",n.content.loadStateUpdateTime=now(),n.content.byteLength=0,n.content.memoryUsage=0)}var scratchVector3$1=new THREE__namespace.Vector3,scratchMatrix3=new THREE__namespace.Matrix3,scratchMatrix4$2=new THREE__namespace.Matrix4,a=6378137,invF=298.257223563;function ecefToLla(n){for(var t=a-a/invF,e=(a*a-t*t)/(a*a),r=Math.sqrt(n.x*n.x+n.y*n.y),o=1e-12,s=1e3,u=0,l=Math.atan2(n.z,r),c=0;u++<s;){var f=Math.sin(l),d=a/Math.sqrt(1-e*f*f);c=r/Math.cos(l)-d;var p=Math.atan2(n.z/(d*(1-e)+c),r/(d+c));if(isNaN(p))break;var v=Math.abs(p-l);if(v<o)break;l=p}return n.set(l,Math.atan2(n.y,n.x),c)}function llaToEcef(n){var t=n.x,e=n.y,r=n.z,o=a-a/invF,s=(a*a-o*o)/(a*a),u=Math.sin(t),l=Math.cos(t),c=Math.sin(e),f=Math.cos(e),d=a/Math.sqrt(1-s*u*u),p=(d+r)*l*f,v=(d+r)*l*c,A=(o*o/(a*a)*d+r)*u;return n.set(p,v,A)}function getEcefToEnuMatrix(n,t){var e=ecefToLla(scratchVector3$1.copy(n)),r=e.x,o=e.y,s=e.z,u=Math.sin(r),l=Math.sin(o),c=Math.cos(r),f=Math.cos(o);t.fromArray([-l,-u*f,c*f,0,+f,-u*l,c*l,0,0,c,u,0,0,0,0,1]);var d=scratchMatrix3.setFromMatrix4(t),p=scratchVector3$1.copy(n).applyMatrix3(d).multiplyScalar(-1);t.setPosition(p);var v=scratchMatrix4$2.fromArray([1,0,0,0,0,1,0,0,0,0,1,0,0,0,s,1]);return t.premultiply(v),t}var StencilConstants={TILE_MASK:128,SKIP_LOD_MASK:112,SKIP_LOD_BIT_SHIFT:4,CLASSIFICATION_MASK:15},SKIP_BACKFACE_MATERIAL=function(){var n=new THREE__namespace.MeshBasicMaterial;return n.side=THREE__namespace.BackSide,n.color.setHex(16711935),n.colorWrite=!1,n.stencilWrite=!0,n.polygonOffset=!0,n.polygonOffsetFactor=2,n.polygonOffsetUnits=2,n.stencilRef=StencilConstants.TILE_MASK,n.stencilFunc=THREE__namespace.AlwaysStencilFunc,n.stencilFuncMask=StencilConstants.TILE_MASK,n.stencilZPass=THREE__namespace.ReplaceStencilOp,n.stencilWriteMask=StencilConstants.TILE_MASK,n}(),SKIP_BACKFACE_TRANSPARENT_MATERIAL=function(){var n=new THREE__namespace.MeshBasicMaterial;return n.visible=!1,n}(),CLEAR_STENCIL_GEOMETRY=new THREE__namespace.BufferGeometry,CLEAR_STENCIL_MATERIAL=new THREE__namespace.MeshBasicMaterial,Tile3DModel=function(n){__extends(t,n);function t(e,r,o){var s,u,l,c=n.call(this)||this;return c.modelIndex=0,c.renderObjects=[],c.backfaceObjects=[],c.debugObjects=[],c.tileObjects=[],c.debug="none",c.name=o.name,c.type=o.type,c.light=o.light,c.upAxis=o.upAxis,c.model=e,c.fetcher=o.fetcher,c.search=(s=o.search)!==null&&s!==void 0?s:"",c.groundHeight=o.groundHeight,c.coordinateTransform=o.coordinateTransform,c.boundingBox=new THREE__namespace.Box3,c.minLevelOfDetail=t.DEFAULT_MIN_LEVEL_OF_DETAIL,c.maxLevelOfDetail=t.DEFAULT_MAX_LEVEL_OF_DETAIL,c.minGeometricError=t.DEFAULT_MIN_GEOMETRIC_ERROR,c.maxGeometricError=t.DEFAULT_MAX_GEOMETRIC_ERROR,c.panoramaMinGeometricError=t.DEFAULT_PANORAMA_MIN_GEOMETRIC_ERROR,c.needsRefined=!0,c.refined=!1,c.refineProgress=[0,0],c.loaded=!1,c.modelsLoaded=!1,c.disposed=!1,c.needsRender=!0,c.lastRenderHash="",c.matrixAutoUpdate=!1,c.cacheCameras=[],c.clearStencilObject=new THREE__namespace.Mesh(CLEAR_STENCIL_GEOMETRY,CLEAR_STENCIL_MATERIAL),c.clearStencilObject.frustumCulled=!1,c.clearStencilObject.onAfterRender=function(f){return f.clearStencil()},c.tileset=new Tileset((l=(u=c.model.work)===null||u===void 0?void 0:u.workCode)!==null&&l!==void 0?l:"",r,{referer:o.referer,tileLoader:function(f){return c.loadContent(f)},tileUnloader:function(f){return c.unloadContent(f)},onTileLoad:function(){},onTileUnload:function(f){},onTileError:function(f,d){o.onError&&o.onError(Object.assign(d,{error:d})),console.error("Tile error",f.id,d)},trajectoryLoader:function(f){return c.loadTrajectory(f)},trajectoryUnloader:function(f){return c.unloadTrajectory(f)},onTrajectoryLoad:function(){},onTrajectoryUnload:function(f){},onTrajectoryError:function(f,d){o.onError&&o.onError(Object.assign(d,{error:d})),console.error("Trajectory error",f,d)}}),c.tileset.root.boundingVolume&&c.tileset.root.boundingVolume.getBoundingBox(c.boundingBox),c}return t.prototype.getRecommendProps=function(e){var r,o,s;e===void 0&&(e={});var u,l,c,f=128;e.powerPreference==="high"&&(f=512);var d=typeof this.tileset.rootMeta.creationTime=="string";if(d){var p=typeof this.tileset.rootMeta.numTotalPoints=="number"&&this.tileset.rootMeta.numTotalPoints>0;if(p){c=4,e.powerPreference==="high"&&(c=2),u=c/1.6;var v=0;if(((r=this.tileset.rootMeta.taskParameters)===null||r===void 0?void 0:r.point_homogenization)==="1"&&(!((o=this.tileset.rootMeta.taskParameters)===null||o===void 0)&&o.homo_point_density)){var A=Number((s=this.tileset.rootMeta.taskParameters)===null||s===void 0?void 0:s.homo_point_density);isFinite(A)&&!isNaN(A)&&(v=A)}v<=0&&(v=.02),l=v*1.4}else c=5,e.powerPreference==="high"&&(c=4),u=1,l=.03}else c=6,u=1,l=.03,this.name==="aerophoto"?(c=12,e.powerPreference==="high"&&(c=10)):this.tileset.asset.extras&&typeof this.tileset.asset.extras.name=="string"&&/^matterport\b/i.test(this.tileset.asset.extras.name)&&(c=5,e.powerPreference==="high"&&(c=4));return{pointScale:l,pointMinPixel:u,maxScreenSpaceError:c,maxMemoryUsage:f}},t.prototype.getRenderHash=function(){return jsonHash([this.tileset.id,this.tileset.skipLevelOfDetail,this.tileset.selectedTiles.map(function(e){return e.id}),this.tileset.selectedTrajectories.map(function(e){return e.index}),this.debug])},Object.defineProperty(t.prototype,"maxMemoryUsage",{get:function(){return this.tileset.maxMemoryUsage},set:function(e){this.tileset.maxMemoryUsage=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"maxRequests",{get:function(){return this.tileset.maxRequests},set:function(e){this.tileset.maxRequests=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"requestOrder",{get:function(){return this.tileset.tileRequestOrder},set:function(e){this.tileset.tileRequestOrder=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"skipLevelOfDetail",{get:function(){return this.tileset.skipLevelOfDetail},set:function(e){this.tileset.skipLevelOfDetail=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"mostDetail",{get:function(){return this.tileset.mostDetail},set:function(e){this.tileset.mostDetail=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"loadSiblings",{get:function(){return this.tileset.loadSiblings},set:function(e){this.tileset.loadSiblings=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"loadAll",{get:function(){return this.tileset.loadAll},set:function(e){this.tileset.loadAll=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"maxScreenSpaceError",{get:function(){return this.tileset.maxScreenSpaceError},set:function(e){this.tileset.maxScreenSpaceError=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"currentMaxScreenSpaceError",{get:function(){return this.tileset.currentMaxScreenSpaceError},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"trajectories",{get:function(){return this.tileset.trajectories},enumerable:!1,configurable:!0}),t.prototype.localToEnu=function(e){return e.applyMatrix4(this.coordinateTransform.localToEnuMatrix)},t.prototype.enuToLocal=function(e){return e.applyMatrix4(this.coordinateTransform.enuToLocalMatrix)},t.prototype.localToEcef=function(e){return e.applyMatrix4(this.coordinateTransform.localToEcefMatrix)},t.prototype.ecefToLocal=function(e){return e.applyMatrix4(this.coordinateTransform.ecefToLocalMatrix)},t.prototype.localToLla=function(e){return ecefToLla(this.localToEcef(e))},t.prototype.llaToLocal=function(e){return this.ecefToLocal(llaToEcef(e))},t.prototype.worldToEnu=function(e){return this.localToEnu(this.worldToLocal(e))},t.prototype.enuToWorld=function(e){return this.localToWorld(this.enuToLocal(e))},t.prototype.worldToEcef=function(e){return this.localToEcef(this.worldToLocal(e))},t.prototype.ecefToWorld=function(e){return this.localToWorld(this.ecefToLocal(e))},t.prototype.worldToLla=function(e){return this.localToLla(this.worldToLocal(e))},t.prototype.llaToWorld=function(e){return this.localToWorld(this.llaToLocal(e))},t.prototype.loadContent=function(e){var r=this;return loadTileContent(e,{light:this.light,fetcher:this.fetcher,search:this.search,renderer:this.renderer}).then(function(o){e.type==="SCENEGRAPH"&&(r.disposed||!e.content?unloadTileContent(e):e.content.data&&r.boundingBox.expandByObject(e.content.data.object))})},t.prototype.unloadContent=function(e){return unloadTileContent(e),Promise.resolve()},t.prototype.loadAllTilesets=function(){var e=this,r=function(o){var s=[];return e.tileset.root.traverse(function(u){var l;u.type==="TILESET"&&((l=u.content)===null||l===void 0?void 0:l.loadState)!=="READY"&&s.push(u)}),Promise.all(s.map(function(u){return e.loadContent(u).then(function(){return r()})})).then(function(){})};return r(this.tileset.root)},t.prototype.loadTrajectory=function(e){var r=this;return loadTrajectory(e,{fetcher:this.fetcher,search:this.search,renderer:this.renderer}).then(function(o){r.disposed&&unloadTrajectory(o)})},t.prototype.unloadTrajectory=function(e){return unloadTrajectory(e),Promise.resolve()},t.prototype.intersectRaycaster=function(e,r,o){var s=this;r===void 0&&(r=!0),o===void 0&&(o=[]);for(var u=[this.tileset.root],l=this.tileset.transform,c=this.tileset.transformIsIdentity,f,d=[];f=u.pop();){var p=void 0;if(f.boundingVolume){var v=c?f.boundingVolume:f.boundingVolume.clone().applyMatrix4(l);p=v.intersectRay(e.ray,e.far)}else p=!0;if(p){for(var A=0,g=f.children.length;A<g;A++)u.push(f.children[A]);f.selected&&f.content&&f.content.data&&f.content.data.object.visible&&f.content.data.object.intersectRaycaster(e,!1,d)}}return this.model.shownFloorIndex>=0&&(d=d.filter(function(h){return h.floor===s.model.shownFloorIndex})),r&&d.sort(function(h,y){return h.distance-y.distance}),d.map(function(h){h.model=s.model,h.viewLayer=s.viewLayer}),o.push.apply(o,d),o},t.prototype.cloneSkipBackfaceObject=function(e){var r;e instanceof THREE__namespace.Mesh?r=new THREE__namespace.Mesh(e.geometry,Array.isArray(e.material)?e.material.map(function(l){return l.transparent?SKIP_BACKFACE_TRANSPARENT_MATERIAL:SKIP_BACKFACE_MATERIAL}):e.material&&e.material.transparent?SKIP_BACKFACE_TRANSPARENT_MATERIAL:SKIP_BACKFACE_MATERIAL):e instanceof THREE__namespace.Group?r=new THREE__namespace.Group:r=new THREE__namespace.Object3D,r.copy(e,!1);for(var o=0,s=e.children;o<s.length;o++){var u=s[o];r.add(this.cloneSkipBackfaceObject(u))}return r},t.prototype.update=function(e,r,o){var s,u,l,c=this,f,d,p;this.renderObjects.length=0,this.backfaceObjects.length=0,this.debugObjects.length=0,this.tileObjects.length=0,this.renderer=e,this.updateMatrixWorld(!0),this.tileset.transform.equals(this.matrixWorld)||this.tileset.transform.copy(this.matrixWorld),this.tileset.cache.reset();var v=this.tileset.frameNumber+1,A=this.maxLevelOfDetail;A=Math.max(A,0);var g=Math.min(this.minLevelOfDetail,A);(!this.visible||!this.loaded||!this.modelsLoaded)&&(A=Math.max(g,0));var h=this.minGeometricError,y=this.maxGeometricError;if(y=Math.max(h,y),o==="Panorama"||o==="VRPanorama"||o==="XRPanorama"){var m=this.model.getMaterial().modelAlpha;m<.1&&(h=this.panoramaMinGeometricError)}var E={time:now(),camera:{type:r.type,position:new THREE__namespace.Vector3().copy(r.position),direction:r.getDirection(new THREE__namespace.Vector3),up:new THREE__namespace.Vector3().copy(r.up).applyQuaternion(r.quaternion),projectionMatrix:r.projectionMatrix.clone(),visible:r.visible,refine:r.refineModel},minLevelOfDetail:g,maxLevelOfDetail:A,minGeometricError:h,maxGeometricError:y,height:r.resolution.height,pixelRatio:r.pixelRatio,frameNumber:v,sseDenominator:2*Math.tan(.5*r.fov/180*Math.PI),cullingVolume:new CullingVolume().setFromCamera(r)},b=this.cacheCameras.map(function(j){return j.updateProjectionMatrix(),__assign(__assign({},E),{camera:{type:r.type,position:new THREE__namespace.Vector3().copy(j.position),direction:j.getWorldDirection(new THREE__namespace.Vector3),up:new THREE__namespace.Vector3().copy(j.up),projectionMatrix:j.projectionMatrix.clone(),visible:j.visible,refine:!0},cullingVolume:new CullingVolume().setFromCamera(j)})});if(this.needsRefined&&this.tileset.update(E,b),this.refined=!0,this.refineProgress[0]=0,this.refineProgress[1]=0,this.tileset.needsRefinedTiles.forEach(function(j){if(c.refineProgress[1]++,j.content){var se=j.content.loadState;if(se==="UNLOADED"||se==="LOADING"){c.refined=!1;return}}c.refineProgress[0]++}),this.loaded===!1&&this.needsRefined){this.loaded=!0;var T=!1;this.tileset.needsRefinedTiles.forEach(function(j){if(c.loaded!==!1&&j.content){if(j.state.visible&&(T=!0),c.tileset.skipLevelOfDetail){if(j.state.finalResolution){var se=j.state.ancestorWithContentAvailable,ie=se&&se.content?se.content:j.content,ue=ie.loadState;(ue==="UNLOADED"||ue==="LOADING")&&(c.loaded=!1)}}else if(j.state.visible&&j.levelOfContent<=0){var ue=j.content.loadState;(ue==="UNLOADED"||ue==="LOADING")&&(c.loaded=!1)}}}),T&&this.tileset.selectedTiles.length===0&&this.tileset.frameNumber<500&&(this.loaded=!1),this.loaded===!0&&(this.refined=!1,this.refineProgress[1]++)}this.remove.apply(this,this.children),this.tileset.skipLevelOfDetail||this.tileset.selectedTiles.sort(function(j,se){return j.floor!==se.floor?j.floor-se.floor:j.levelOfContent!==se.levelOfContent?se.levelOfContent-j.levelOfContent:j.state.distanceToCamera!==se.state.distanceToCamera?j.state.distanceToCamera-se.state.distanceToCamera:j.state.centerZDepth-se.state.centerZDepth}),this.debug==="root-bounding-volume"&&this.tileset.root.boundingVolumeDebugObject&&this.debugObjects.push(this.tileset.root.boundingVolumeDebugObject);for(var _=0,R=this.tileset.selectedTiles;_<R.length;_++){var S=R[_];this.debug==="selected-bounding-volume"&&S.boundingVolumeDebugObject&&this.debugObjects.push(S.boundingVolumeDebugObject);var C=(d=(f=S.content)===null||f===void 0?void 0:f.data)===null||d===void 0?void 0:d.object;if(C){if(C.update(e,r,this.model,S),this.tileset.hasMixedContent&&this.tileset.skipLevelOfDetail){if(!S.state.finalResolution){var B=this.cloneSkipBackfaceObject(C);this.backfaceObjects.push(B)}for(var L=S.state.selectionDepth,M=StencilConstants.TILE_MASK|L<<StencilConstants.SKIP_LOD_BIT_SHIFT,w=THREE__namespace.GreaterEqualStencilFunc,H=StencilConstants.SKIP_LOD_MASK,O=THREE__namespace.ReplaceStencilOp,I=StencilConstants.TILE_MASK|StencilConstants.SKIP_LOD_MASK,N=0,k=C.materials;N<k.length;N++){var U=k[N];U.stencilWrite=!0,U.stencilRef=M,U.stencilFunc=w,U.stencilFuncMask=H,U.stencilZPass=O,U.stencilWriteMask=I}}else for(var D=0,q=C.materials;D<q.length;D++){var U=q[D];U.stencilWrite=!1,U.stencilRef=StencilConstants.TILE_MASK,U.stencilFunc=THREE__namespace.AlwaysStencilFunc,U.stencilFuncMask=StencilConstants.TILE_MASK,U.stencilZPass=THREE__namespace.ReplaceStencilOp,U.stencilWriteMask=StencilConstants.TILE_MASK}this.tileObjects.push(C)}}this.tileset.skipLevelOfDetail&&this.backfaceObjects.length&&(s=this.renderObjects).push.apply(s,this.backfaceObjects),this.tileObjects.length&&(u=this.renderObjects).push.apply(u,this.tileObjects),this.tileset.skipLevelOfDetail&&this.renderObjects.push(this.clearStencilObject);for(var z=0,Q=this.tileset.selectedTrajectories;z<Q.length;z++){var G=Q[z],X=(p=G.content.data)===null||p===void 0?void 0:p.object;X&&(X.update(e,r,this.model),this.renderObjects.push(X))}this.debug&&(l=this.renderObjects).push.apply(l,this.debugObjects);for(var $=this.modelIndex*1e4,W=function(j){var se=oe.renderObjects[j],ie=j+$;se.traverse(function(ue){(ue instanceof THREE__namespace.Mesh||ue instanceof THREE__namespace.Line||ue instanceof THREE__namespace.Points)&&(ue.renderOrder=ie)}),oe.add(se)},oe=this,ae=0;ae<this.renderObjects.length;ae++)W(ae);var re=this.getRenderHash();this.lastRenderHash!==re&&(this.needsRender=!0,this.lastRenderHash=re)},t.prototype.dispose=function(){this.disposed=!0,this.viewLayer=void 0,this.tileset.reset(),this.remove.apply(this,this.children),this.refineProgress[0]=0,this.refineProgress[1]=0,this.refined=!1,this.loaded=!1},t.DEFAULT_PANORAMA_MIN_GEOMETRIC_ERROR=1,t.DEFAULT_MIN_LEVEL_OF_DETAIL=0,t.DEFAULT_MAX_LEVEL_OF_DETAIL=20,t.DEFAULT_MIN_GEOMETRIC_ERROR=0,t.DEFAULT_MAX_GEOMETRIC_ERROR=1e4,t.DEFAULT_MAX_MEMORY_USAGE=16,t.DEFAULT_MAX_SCREEN_SPACE_ERROR=Tileset.DEFAULT_MAX_SCREEN_SPACE_ERROR,t.DEFAULT_SKIP_LEVEL_OF_DETAIL=Tileset.DEFAULT_SKIP_LEVEL_OF_DETAIL,t.DEFAULT_MOST_DETAIL=Tileset.DEFAULT_MOST_DETAIL,t.DEFAULT_LOAD_SIBLINGS=Tileset.DEFAULT_LOAD_SIBLINGS,t.DEFAULT_LOAD_ALL=Tileset.DEFAULT_LOAD_ALL,t.DEFAULT_MAX_REQUESTS=Tileset.DEFAULT_MAX_REQUESTS,t.DEFAULT_REQUEST_ORDER=Tileset.DEFAULT_REQUEST_ORDER,t}(THREE__namespace.Object3D);function headingToLongitude(n){return-((n-.25)*360+90)/180*Math.PI}function equal(n,t){if(n===t)return!0;if(n&&t&&typeof n=="object"&&typeof t=="object"){if(n.constructor!==t.constructor)return!1;var e,r,o;if(Array.isArray(n)){if(e=n.length,e!=t.length)return!1;for(r=e;r--!==0;)if(!equal(n[r],t[r]))return!1;return!0}if(n.constructor===RegExp)return n.source===t.source&&n.flags===t.flags;if(n.valueOf!==Object.prototype.valueOf)return n.valueOf()===t.valueOf();if(n.toString!==Object.prototype.toString)return n.toString()===t.toString();if(o=Object.keys(n),e=o.length,e!==Object.keys(t).length)return!1;for(r=e;r--!==0;)if(!Object.prototype.hasOwnProperty.call(t,o[r]))return!1;for(r=e;r--!==0;){var s=o[r];if(!equal(n[s],t[s]))return!1}return!0}return n!==n&&t!==t}function isNumber(n){return typeof n=="number"}function S4(){return((1+Math.random())*65536|0).toString(16).substring(1)}function createUuid(){return(S4()+S4()+"-"+S4()+"-4"+S4().substr(0,3)+"-"+S4()+"-"+S4()+S4()+S4()).toLowerCase()}var error_invalid_input=function(){return new Error("Invalid input.")},error_invalid_certificate=function(){return new Error("Invalid certificate.")},error_invalid_signature=function(){return new Error("Invalid signature.")},error_date_expired=function(n){return new Error("date(".concat(n.toString(),") expired."))},error_host_not_allowed=function(n){return new Error("host(".concat(JSON.stringify(n),") is not allowed."))};function ObjectOmit(n,t){for(var e={},r=0,o=Object.keys(n);r<o.length;r++){var s=o[r];t.indexOf(s)===-1&&(e[s]=n[s])}return e}function jsonStableNoneNumberStrinfiy_(n,t){t===void 0&&(t=!1);var e=typeof n;if(e==="string")return JSON.stringify(n);if(n===!0)return"true";if(n===!1)return"false";if(n===null)return"null";if(n instanceof Array){for(var r="[",o=n.length-1,s=0;s<o;s++)r+=jsonStableNoneNumberStrinfiy_(n[s],!1)+",";return o>-1&&(r+=jsonStableNoneNumberStrinfiy_(n[s],!1)),r+"]"}if(n instanceof Object){if(typeof n.toJSON=="function")return jsonStableNoneNumberStrinfiy_(n.toJSON(),t);for(var u=Object.keys(n).sort(),l=u.length,r="",s=0;s<l;){var c=u[s],f=jsonStableNoneNumberStrinfiy_(n[c],!0);f!==void 0&&(s&&r!==""&&(r+=","),r+=JSON.stringify(c)+":"+f),s++}return"{"+r+"}"}switch(e){case"function":case"undefined":return t?void 0:null;case"number":return 0;default:return isFinite(n)?n:null}}function jsonStableNoneNumberStrinfiy(n){return String(jsonStableNoneNumberStrinfiy_(n,!1))}function verify(n){var t,e,r;if(Array.isArray(n)){var o=void 0,s,u;if(n.length<=0)return error_invalid_input();for(var l=function(_){var R=verify(n[_]);if(R instanceof Error)return{value:R};if(!o)o=R.issuer;else if(o!==R.issuer)return{value:error_invalid_certificate()};s?R.expire.getTime()<s.getTime()&&(s=R.expire):s=R.expire,u?u=u.filter(function(S){return R.allowHosts.indexOf(S)!==-1}):u=R.allowHosts},c=0;c<n.length;c++){var f=l(c);if(typeof f=="object")return f.value}return deepFreeze({issuer:o,expire:s,allowHosts:u})}var d=JSON.parse(n),p=typeof location!="undefined"?location.hostname:"",v=Date.now();if(typeof d!="object")return error_invalid_input();var A=new Date(typeof d.expire_at=="string"&&/^\d+$/.test(d.expire_at)?Number(d.expire_at):d.expire_at),g=Array.isArray(d.allow_hosts)?d.allow_hosts:[];if(p.length===0||isIPDomain(p)||BUILDIN_ALLOW_HOST.filter(function(_){return matchDomain(_,p)}).length>0){var h=String((t=d.certificate)!==null&&t!==void 0?t:"");if(h){var y=new X509;return y.readCertPEM(h),deepFreeze({issuer:y.getSubjectString(),expire:A,allowHosts:g})}return deepFreeze({issuer:"none",expire:A,allowHosts:g})}var m=String((e=d.certificate)!==null&&e!==void 0?e:"");if(!m)return error_invalid_certificate();var E=new X509;E.readCertPEM(m);var b=String((r=d._signature)!==null&&r!==void 0?r:"");if(!b)return error_invalid_signature();var T=jsonStableNoneNumberStrinfiy(ObjectOmit(d,["_signature"]));return verifyMessage(T,b,E)===!1?error_invalid_signature():v<A.getTime()?g.filter(function(_){return matchDomain(_,p)}).length===0?error_host_not_allowed(p):deepFreeze({issuer:E.getSubjectString(),expire:A,allowHosts:g}):error_date_expired(A)}var scratchMatrix4$1=new THREE__namespace.Matrix4,workRawMapping=new WeakMap,needsUpdateWorkCodeSet=new Set,Work=function(){function n(t,e){this.name="",this.baseURL="",this.workCode="",this.expire=new Date,this.allowHosts=[],this.initial={work:this},this.observers=[],this.issuer="none",this.raw={works:[""],options:""},this.transform=new THREE__namespace.Matrix4;{var r=this;this.options={get transform(){return r.transform},set transform(s){r.transform.copy(s)}}}if(t!==null)if("up"in t&&typeof t.up=="string"&&"down"in t&&typeof t.down=="string"&&"right"in t&&typeof t.right=="string"&&"left"in t&&typeof t.left=="string"&&"front"in t&&typeof t.front=="string"&&"back"in t&&typeof t.back=="string"&&"size"in t&&typeof t.size=="number")parsePanoWork(t,this);else{var o=parse(t,e,this);if(o instanceof Error)throw new Error("[PARSE FAILED]: "+o.message+`
1037
1037
  Error work input:
1038
1038
  `+JSON.stringify(t))}else parseNull(t,this)}return n.prototype.toJSON=function(){return this.raw},n.parse=parseWork,n}();function getType(n){return n==null?"null":Array.isArray(n)?"array":typeof n=="object"?"dict":"value"}function deepMerge(n,t){var e=getType(n),r=getType(t);if(r==="null")return n;if(r==="value")return t;if(r!==e)return JSON.parse(JSON.stringify(t));if(r==="array")for(var o=0;o<t.length;o++)n[o]=deepMerge(n[o],t[o]);else if(r==="dict")for(var s in t)n[s]=deepMerge(n[s],t[s]);return n}function startWithString(n,t){return n.indexOf(t)===0}function urlWithParseOptions(n,t,e,r){var o,s=t;if(r.jsonp===!0){s=t.replace(/([\?\#].*)?$/i,"");var u=sha256("".concat(s)).slice(0,7);s="".concat(s,".").concat(u,".jsonp")}if(r.shortPath===!0){var l=s.replace(n,"").split("."),c=(o=l.shift())!==null&&o!==void 0?o:"",f=l.join(".");s=pathJoin(n,sha256(c))+(f?"."+f:"")}var d=s.replace(n,"");return r.baseURL&&(s=pathJoin(r.baseURL,d)),r.traverseResource&&r.traverseResource({origin:t,absolute:s,relative:d,type:e}),s}function panoURL(n,t,e,r,o){var s=e;return isAbsoluteURL(e)||(t&&(t=pathJoin(t,String(r))),s=pathJoin(t,s)),isAbsoluteURL(s)||(s=pathJoin(n,s)),startWithString(s,n)||console.warn("".concat(s," is not start with base_url(").concat(n,").")),urlWithParseOptions(n,s,"panorama",o)}function fileURL(n,t,e){var r=t;return isAbsoluteURL(r)||(r=pathJoin(n,t)),startWithString(r,n)||console.warn("".concat(r," is not start with base_url(").concat(n,").")),urlWithParseOptions(n,r,"model",e)}function textureURL$1(n,t,e,r){var o=t;return isAbsoluteURL(o)||(o=pathJoin(e,o)),isAbsoluteURL(o)||(o=pathJoin(n,o)),startWithString(o,n)||console.warn("".concat(o," is not start with base_url(").concat(n,").")),urlWithParseOptions(n,o,"texture",r)}var getTileLevel=function(n){for(var t=10;t>=0;t--){var e=512*Math.pow(2,t);if(e<=n)return t}return null},sortTile=function(n){n=n.slice().sort(function(u,l){return u.level-l.level});for(var t=[],e=0,r=n;e<r.length;e++){var o=r[e];if(t.length===0){t.push(o);continue}var s=t[t.length-1];if(o.level>s.level){t.push(o);continue}if(o.size>s.size){t[t.length-1]=o;continue}}return t};function parse(n,t,e){for(var r,o,s,u,l,c,f,d,p,v,A,g,h,y,m,E,b,T,_,R,S=JSON.stringify(t),C=[],B=0,L=[].concat(n);B<L.length;B++){var M=L[B];M instanceof Work?C.push.apply(C,M.raw.works):typeof M=="string"?C.push(M):C.push(JSON.stringify(M))}var w=verify(C);if(w instanceof Error)return w;Array.isArray(t.transform)?e.transform.fromArray(t.transform):t.transform&&e.transform.copy(t.transform),n=C.map(function(Z){return JSON.parse(Z)}).reduce(function(Z,te){return deepMerge(Z,te)}),Object.defineProperty(e,"raw",{configurable:!1,get:function(){return{works:C,options:S}}});{var H;if(t.workCode&&(typeof t.workCode=="string"?H=t.workCode:typeof t.workCode=="function"&&(H=t.workCode(n))),typeof H=="undefined"&&(H=String(n.resource_code||n.basic_code||n.vr_code||n.code||n.project_id||n.work_code||n.workCode)),typeof H=="undefined")return new Error("WorkCode never matched.");Object.defineProperty(e,"workCode",{configurable:!1,get:function(){return H}})}{var O=String(n.name);Object.defineProperty(e,"name",{configurable:!1,get:function(){return O}})}if(w instanceof Error)return w;Object.defineProperty(e,"issuer",{configurable:!1,get:function(){return w.issuer}}),Object.defineProperty(e,"expire",{configurable:!1,get:function(){return w.expire}}),Object.defineProperty(e,"allowHosts",{configurable:!1,get:function(){return w.allowHosts}});var I=(r=n.base_url)!==null&&r!==void 0?r:"";if(I&&I[I.length-1]!=="/"&&(I+="/"),e.baseURL=(o=t.baseURL)!==null&&o!==void 0?o:I,w instanceof Error)return w;if(n.model){var N={work:e,layers:[]},k;n.model.file?k=fileURL(I,n.model.file,t):n.model.file_url&&(k=fileURL(I,n.model.file_url,t)),Object.defineProperty(N,"file",{configurable:!1,get:function(){return k}});var U;n.model.textureBase?U=textureURL$1(I,"",n.model.textureBase,t):n.model.material_base_url?U=textureURL$1(I,"",n.model.material_base_url,t):N.file&&(U=N.file.split("/").slice(0,-1).join("/").replace("/model/","/materials/")),Object.defineProperty(N,"textureBase",{configurable:!1,get:function(){return U}});var D;Array.isArray(n.model.textures)?(D=n.model.textures.map(function(Z){var te,K;return textureURL$1(I,Z,(K=(te=n.model.textureBase)!==null&&te!==void 0?te:n.model.material_base_url)!==null&&K!==void 0?K:"",t)}),Object.freeze(D)):Array.isArray(n.model.material_textures)&&(D=n.model.material_textures.map(function(Z){var te,K;return textureURL$1(I,Z,(K=(te=n.model.textureBase)!==null&&te!==void 0?te:n.model.material_base_url)!==null&&K!==void 0?K:"",t)}),Object.freeze(D)),Object.defineProperty(N,"textures",{configurable:!1,get:function(){return D}});var q=[];if(Array.isArray(n.model.tiles))for(var z=0,Q=n.model.tiles;z<Q.length;z++){var G=Q[z];G&&(G.tileset||G.tileset_url)&&q.push(Object.freeze({type:(s=G.type)!==null&&s!==void 0?s:"mesh",name:(u=G.name)!==null&&u!==void 0?u:"",upAxis:(c=(l=G.upAxis)!==null&&l!==void 0?l:G.up_axis)!==null&&c!==void 0?c:"-Y",tileset:fileURL(I,G.tileset||G.tileset_url,t)}))}else n.model.tiles&&(n.model.tiles.tileset||n.model.tiles.tileset_url)&&q.push(Object.freeze({type:(f=n.model.tiles.type)!==null&&f!==void 0?f:"mesh",name:(d=n.model.tiles.name)!==null&&d!==void 0?d:"lod",upAxis:(v=(p=n.model.tiles.upAxis)!==null&&p!==void 0?p:n.model.tiles.up_axis)!==null&&v!==void 0?v:"-Y",tileset:fileURL(I,n.model.tiles.tileset||n.model.tiles.tileset_url,t)}));if(Array.isArray(n.model.layers))for(var X=0,$=n.model.layers;X<$.length;X++){var W=$[X];W&&(W.tileset||W.tileset_url)&&q.push(Object.freeze({type:(A=W.type)!==null&&A!==void 0?A:"mesh",name:(g=W.name)!==null&&g!==void 0?g:"",upAxis:(h=W.upAxis)!==null&&h!==void 0?h:W.up_axis,tileset:fileURL(I,W.tileset||W.tileset_url,t)}))}Object.freeze(q),Object.defineProperty(N,"layers",{configurable:!1,get:function(){return q}}),Object.defineProperty(e,"model",{configurable:!1,get:function(){if(N.file||N.layers.length)return N}})}if(w instanceof Error)return w;var oe=new Set,ae=new Set;{var re=[];if(n.observers&&Array.isArray(n.observers)){var j=[];n.panorama&&(Array.isArray(n.panorama)?j=n.panorama:Array.isArray(n.panorama.list)?j=n.panorama.list:Array.isArray(n.panorama.info)&&(j=n.panorama.info));for(var se=function(Z){var te={},K=n.observers[Z];if(!K)return"break";var ye=j[Z];if(!ye)return"break";K=Object.assign({},K,ye,{active:K.active!==!1&&ye.active!==!1}),Object.defineProperty(te,"work",{configurable:!1,get:function(){return e}}),Object.defineProperty(te,"index",{configurable:!1,get:function(){return Z}}),ae.add(Z),Object.defineProperty(te,"panoIndex",{configurable:!1,get:function(){return Z}});var de=panoStringify({workCode:e.workCode,panoIndex:Z});oe.add(de),Object.defineProperty(te,"panoId",{configurable:!1,get:function(){return de}});var xe=Object.freeze({workCode:e.workCode,panoIndex:Z});Object.defineProperty(te,"pano",{configurable:!1,get:function(){return xe}});var Ae=K.active!==!1;Object.defineProperty(te,"active",{configurable:!1,get:function(){return Ae}});var me=K.loadable===!0;Object.defineProperty(te,"loadable",{configurable:!1,get:function(){return me}});var ce=K.derived_id;Object.defineProperty(te,"derivedId",{configurable:!1,get:function(){return ce}});var he=K.derived_id_str;Object.defineProperty(te,"derivedIdStr",{configurable:!1,get:function(){return he}});var ee=(_=(b=(m=(y=n.panorama)===null||y===void 0?void 0:y.pano_high_cube_base_url)!==null&&m!==void 0?m:(E=n.panorama)===null||E===void 0?void 0:E.pano_cube_base_url)!==null&&b!==void 0?b:(T=n.panorama)===null||T===void 0?void 0:T.base_url)!==null&&_!==void 0?_:"",pe={up:panoURL(I,ee,K.images?K.images.up:K.up,Z,t),down:panoURL(I,ee,K.images?K.images.down:K.down,Z,t),right:panoURL(I,ee,K.images?K.images.right:K.right,Z,t),left:panoURL(I,ee,K.images?K.images.left:K.left,Z,t),front:panoURL(I,ee,K.images?K.images.front:K.front,Z,t),back:panoURL(I,ee,K.images?K.images.back:K.back,Z,t)};if(K.size_list)pe.sizeList=K.size_list.slice();else{var Re=getImageSizeFromURL(pe.up);if(Re&&(pe.sizeList=[Re],K.tiles))for(var we=K.tiles.slice().sort(function(Ce,Oe){return Ce-Oe}).map(function(Ce){return 512*Math.pow(2,Ce)}),Ue=0,be=we;Ue<be.length;Ue++){var ge=be[Ue];ge>Re&&pe.sizeList.push(ge)}}var ze=K.images?K.images.luminance:K.luminance;ze&&(pe.luminance=Object.freeze({up:panoURL(I,ee,ze.up,Z,t),down:panoURL(I,ee,ze.down,Z,t),right:panoURL(I,ee,ze.right,Z,t),left:panoURL(I,ee,ze.left,Z,t),front:panoURL(I,ee,ze.front,Z,t),back:panoURL(I,ee,ze.back,Z,t)}));var Ne=void 0;if(K.images)Ne=K.images.tiles;else if(Array.isArray(K.size_list)){var Je=K.size_list.slice().sort(function(Ce,Oe){return Ce-Oe});if(Je[0]){var Ke=getTileLevel(Je[0]);if(Ke)for(var De=Ke-1;De>=0;De--)Je.unshift(512*Math.pow(2,De));Ne=Je}}else if(Array.isArray(K.tiles)&&(Ne=K.tiles.slice(),typeof Ne[0]=="number")){for(var Ye=Ne[0];--Ye>=0;)Ne.unshift(Ye);Ne=Ne.sort(function(Ce,Oe){return Ce-Oe}).map(function(Ce){return 512*Math.pow(2,Ce)})}if(Ne){for(var Ve=[],nt=0,qe=Ne;nt<qe.length;nt++){var ge=qe[nt];if(typeof ge=="number"){var Qe=getTileLevel(ge);if(typeof Qe!="number")continue;var Ie=getImageSizeFromURL(pe.front);if(!Ie)continue;if(ge>Ie){var Se=replaceImageSize(pe.up,ge),Be=replaceImageSize(pe.down,ge),Le=replaceImageSize(pe.right,ge),ot=replaceImageSize(pe.left,ge),$e=replaceImageSize(pe.front,ge),tt=replaceImageSize(pe.back,ge);Ve.push(Object.freeze({level:Qe,size:ge,scale:1,up:Se,down:Be,right:Le,left:ot,front:$e,back:tt}))}else{var Se=pe.up,Be=pe.down,Le=pe.right,ot=pe.left,$e=pe.front,tt=pe.back;Ve.push(Object.freeze({level:Qe,size:Ie,scale:ge/Ie,up:Se,down:Be,right:Le,left:ot,front:$e,back:tt}))}}else{var Qe=ge.level;if(typeof Qe!="number")continue;var Re=ge.size;if(typeof Re!="number")continue;var Se=panoURL(I,ee,ge.up,Z,t),Be=panoURL(I,ee,ge.down,Z,t),Le=panoURL(I,ee,ge.right,Z,t),ot=panoURL(I,ee,ge.left,Z,t),$e=panoURL(I,ee,ge.front,Z,t),tt=panoURL(I,ee,ge.back,Z,t);Ve.push(Object.freeze({level:Qe,size:Re,scale:(R=ge.scale)!==null&&R!==void 0?R:1,up:Se,down:Be,right:Le,left:ot,front:$e,back:tt}))}}Ve=sortTile(Ve),Object.freeze(Ve),Object.defineProperty(pe,"tiles",{configurable:!1,get:function(){return Ve}})}Object.freeze(pe),Object.defineProperty(te,"images",{configurable:!1,get:function(){return pe}});var Xe=new THREE__namespace.Vector3;if(K.position instanceof THREE__namespace.Vector3)Xe.copy(K.position);else if(Array.isArray(K.position))Xe.fromArray(K.position);else return"break";Object.freeze(Xe),Object.defineProperty(te,"position",{configurable:!1,get:function(){return Xe}});var rt=new THREE__namespace.Vector3;if(K.standingPosition instanceof THREE__namespace.Vector3)rt.copy(K.standingPosition);else if(Array.isArray(K.standingPosition))rt.fromArray(K.standingPosition);else if(K.standing_position instanceof THREE__namespace.Vector3)rt.copy(K.standing_position);else if(Array.isArray(K.standing_position))rt.fromArray(K.standing_position);else return"break";Object.freeze(rt),Object.defineProperty(te,"standingPosition",{configurable:!1,get:function(){return rt}});var Ge=new THREE__namespace.Quaternion;if(K.quaternion instanceof THREE__namespace.Quaternion)Ge.copy(K.quaternion);else if(Array.isArray(K.quaternion))Ge.fromArray(K.quaternion);else if(K.quaternion){var st=K.quaternion,ct=st.x,je=st.y,Fe=st.z,We=st.w;Ge.set(ct,je,Fe,We)}else return"break";Object.freeze(Ge),Object.defineProperty(te,"quaternion",{configurable:!1,get:function(){return Ge}});var at=0;isNumber(K.floorIndex)?at=K.floorIndex:isNumber(K.floor_index)?at=K.floor_index:isNumber(K.floor)&&(at=K.floor),Object.defineProperty(te,"floorIndex",{configurable:!1,get:function(){return at}});var Pe;K.video&&(Pe={},typeof K.video.source=="string"&&(Pe.source=K.video.source),K.video.matrix instanceof THREE__namespace.Matrix4?Pe.matrix=K.video.matrix.clone():Array.isArray(K.video.matrix)&&(Pe.matrix=new THREE__namespace.Matrix4().fromArray(K.video.matrix)),K.video.size instanceof THREE__namespace.Vector2?Pe.size=K.video.size.clone():Array.isArray(K.video.size)&&(Pe.size=new THREE__namespace.Vector2().fromArray(K.video.size)),Pe.source&&Pe.matrix&&Pe.size&&(te.video=Pe)),Object.freeze(Pe),Object.defineProperty(te,"video",{configurable:!1,get:function(){return Pe}}),Array.isArray(K.accessibleNodes)?(te.accessibleNodes=K.accessibleNodes.slice(),te.accessibleIds=K.accessibleNodes.map(function(Ce){return panoStringify({workCode:e.workCode,panoIndex:Ce})})):Array.isArray(K.accessible_nodes)&&(te.accessibleNodes=K.accessible_nodes.slice(),te.accessibleIds=K.accessible_nodes.map(function(Ce){return panoStringify({workCode:e.workCode,panoIndex:Ce})})),Array.isArray(K.visibleNodes)?(te.visibleNodes=K.visibleNodes.slice(),te.visibleIds=K.visibleNodes.map(function(Ce){return panoStringify({workCode:e.workCode,panoIndex:Ce})})):Array.isArray(K.visible_nodes)&&(te.visibleNodes=K.visible_nodes.slice(),te.visibleIds=K.visible_nodes.map(function(Ce){return panoStringify({workCode:e.workCode,panoIndex:Ce})})),re[Z]=te},ie=0;ie<n.observers.length;ie++){var ue=se(ie);if(ue==="break")break}}for(var fe=function(Z){if(Z.accessibleIds){var ye=Z.accessibleIds.filter(function(ee){return oe.has(ee)});Object.freeze(ye),Object.defineProperty(Z,"accessibleIds",{configurable:!1,get:function(){return ye}})}else{for(var te=[],K=0;K<re.length;K++)re[K]!==Z&&(Math.abs(re[K].position.y-Z.position.y)>3||re[K].position.distanceTo(Z.position)>10||te.push(re[K].panoId));Object.freeze(te),Object.defineProperty(Z,"accessibleIds",{configurable:!1,get:function(){return te}})}if(Z.accessibleNodes){var xe=Z.accessibleNodes.filter(function(ee){return ae.has(ee)});Object.freeze(xe),Object.defineProperty(Z,"accessibleNodes",{configurable:!1,get:function(){return xe}})}else{for(var de=[],K=0;K<re.length;K++)re[K]!==Z&&(Math.abs(re[K].position.y-Z.position.y)>3||re[K].position.distanceTo(Z.position)>10||de.push(re[K].panoIndex));Object.freeze(de),Object.defineProperty(Z,"accessibleNodes",{configurable:!1,get:function(){return de}})}if(Z.visibleIds){var me=Z.visibleIds.filter(function(ee){return oe.has(ee)});Object.freeze(me),Object.defineProperty(Z,"visibleIds",{configurable:!1,get:function(){return me}})}else{var Ae=Z.accessibleIds.slice();Object.freeze(Ae),Object.defineProperty(Z,"visibleIds",{configurable:!1,get:function(){return Ae}})}if(Z.visibleNodes){var he=Z.visibleNodes.filter(function(ee){return ae.has(ee)});Object.freeze(he),Object.defineProperty(Z,"visibleNodes",{configurable:!1,get:function(){return he}})}else{var ce=Z.accessibleNodes.slice();Object.freeze(ce),Object.defineProperty(Z,"visibleNodes",{configurable:!1,get:function(){return ce}})}},ne=0,Te=re;ne<Te.length;ne++){var _e=Te[ne];fe(_e)}Object.freeze(re),Object.defineProperty(e,"observers",{configurable:!1,get:function(){return re}})}if(w instanceof Error)return w;if(n.initial){if((n.initial.mode==="Panorama"&&e.observers.length===0||n.initial.mode==="Floorplan"||n.initial.mode==="Topview"||n.initial.mode==="Model"||n.initial.mode==="Mapview"||n.initial.mode==="DepthPanorama")&&(e.initial.mode=n.initial.mode),isNumber(n.initial.latitude)&&(e.initial.latitude=n.initial.latitude),isNumber(n.initial.longitude)?e.initial.longitude=n.initial.longitude:isNumber(n.initial.heading)&&(e.initial.longitude=headingToLongitude(n.initial.heading)),isNumber(n.initial.fov)&&(e.initial.fov=n.initial.fov),e.observers.length>0){var ve=void 0;isNumber(n.initial.panoIndex)?ve=n.initial.panoIndex:isNumber(n.initial.pano_index)?ve=n.initial.pano_index:isNumber(n.initial.pano)&&(ve=n.initial.pano),typeof ve=="number"&&(ve=clamp$1(ve,0,e.observers.length-1),e.initial.panoIndex=ve)}if(isNumber(n.initial.distance)&&(e.initial.distance=n.initial.distance),Array.isArray(n.initial.offset)){var Me=[0,0,0].map(function(Z,te){var K=Number(n.initial.offset[te]);return isNaN(K)||!isFinite(K)?0:K});e.initial.offset=new THREE__namespace.Vector3().fromArray(Me)}else typeof n.initial.offset=="object"&&typeof n.initial.offset.x=="number"&&typeof n.initial.offset.y=="number"&&typeof n.initial.offset.z=="number"&&(e.initial.offset=new THREE__namespace.Vector3(n.initial.offset.x,n.initial.offset.y,n.initial.offset.z));!e.initial.mode&&typeof e.initial.panoIndex=="number"&&(e.initial.mode="Panorama")}return w instanceof Error?w:(workRawMapping.set(e,{works:C,options:S}),e)}function parseNull(n,t){return t.issuer="null",deepFreeze(t),workRawMapping.set(t,{works:["null"],options:"{}"}),t}function parsePanoWork(n,t){var e;t.issuer="null",t.allowHosts=["*"],t.workCode=(e=n.code)!==null&&e!==void 0?e:createUuid();var r=[n.size],o=[],s=getTileLevel(r[0]);if(s)for(var u=s-1;u>=0;u--)r.unshift(512*Math.pow(2,u));for(var l=0,c=r;l<c.length;l++){var f=c[l],d=getTileLevel(f);d&&o.push({level:d,size:n.size,scale:f/n.size,up:n.up,down:n.down,right:n.right,left:n.left,front:n.front,back:n.back})}var p={up:n.up,down:n.down,right:n.right,left:n.left,front:n.front,back:n.back,sizeList:r};o&&(p.tiles=o);var v={accessibleIds:[],accessibleNodes:[],active:!0,floorIndex:0,images:p,index:0,loadable:!1,pano:{workCode:t.workCode,panoIndex:0},panoId:"".concat(t.workCode,"[0]"),panoIndex:0,position:new THREE__namespace.Vector3(0,1.5,0),quaternion:new THREE__namespace.Quaternion(0,1,0,0),standingPosition:new THREE__namespace.Vector3(0,0,0),visibleIds:[],visibleNodes:[],work:t};return t.observers=[v],deepFreeze(t),workRawMapping.set(t,{works:[JSON.stringify(n)],options:"{}"}),t}function parseWork(n,t){typeof n=="string"&&n.trim()[0]==="{"&&(n=JSON.parse(n));var e=workRawMapping.get(n);if(e){if(t&&!equal(JSON.parse(e.options),t))throw new Error("[PARSE FAILED]: work is parsed with different options.");return n}else try{return new Work(n,t!=null?t:{})}catch(r){throw new Error("[PARSE FAILED]: "+r.message+`
1039
1039
  Error work input:
@@ -2166,7 +2166,7 @@ void main() {
2166
2166
  #include <premultiplied_alpha_fragment>
2167
2167
 
2168
2168
  }
2169
- `},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,d=r.count;c<d;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 p=new THREE__namespace.InstancedInterleavedBuffer(s,2,1);return e.setAttribute("instanceDistanceStart",new THREE__namespace.InterleavedBufferAttribute(p,1,0)),e.setAttribute("instanceDistanceEnd",new THREE__namespace.InterleavedBufferAttribute(p,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,d=c.linewidth,p=l.attributes.instanceStart,v=l.attributes.instanceEnd,A=new THREE__namespace.Vector4,g=new THREE__namespace.Vector4,h=new THREE__namespace.Vector4,y=new THREE__namespace.Vector3,m=new THREE__namespace.Matrix4,E=new THREE__namespace.Line3,b=new THREE__namespace.Vector3;o.at(1,h),h.w=1,h.applyMatrix4(s.matrixWorldInverse),h.applyMatrix4(u),h.multiplyScalar(1/h.w),h.x*=f.x/2,h.y*=f.y/2,h.z=0,y.copy(h);var T=this.matrixWorld;m.multiplyMatrices(s.matrixWorldInverse,T);for(var _=0,R=p.count;_<R;_++){A.fromBufferAttribute(p,_),g.fromBufferAttribute(v,_),A.w=1,g.w=1,A.applyMatrix4(m),g.applyMatrix4(m),A.applyMatrix4(u),g.applyMatrix4(u),A.multiplyScalar(1/A.w),g.multiplyScalar(1/g.w);var S=A.z<-1&&g.z<-1,C=A.z>1&&g.z>1;if(!(S||C)){A.x*=f.x/2,A.y*=f.y/2,g.x*=f.x/2,g.y*=f.y/2,E.start.copy(A),E.start.z=0,E.end.copy(g),E.end.z=0;var B=E.closestPointToPointParameter(y,!0);E.at(B,b);var L=THREE__namespace.MathUtils.lerp(A.z,g.z,B),M=L>=-1&&L<=1,w=y.distanceTo(b)<d*.5;if(M&&w){E.start.fromBufferAttribute(p,_),E.end.fromBufferAttribute(v,_),E.start.applyMatrix4(T),E.end.applyMatrix4(T);var H=new THREE__namespace.Vector3,O=new THREE__namespace.Vector3;o.distanceSqToSegment(E.start,E.end,O,H),r.push({point:O,pointOnLine:H,distance:o.origin.distanceTo(O),object:this,faceIndex:_})}}}},t}(THREE__namespace.Mesh);Object.assign(LineSegments2.prototype,{isLineSegments2:!0});var Line2=function(n){__extends(t,n);function t(e,r){var o=n.call(this,e,r)||this;return o.type="Line2",o}return t}(LineSegments2);Object.assign(Line2.prototype,{isLine2:!0});var LineGeometry=function(n){__extends(t,n);function t(){var e=n.call(this)||this;return e.type="LineGeometry",e}return t.prototype.setPositions=function(e){for(var r=e.length-3,o=new Float32Array(2*r),s=0;s<r;s+=3)o[2*s]=e[s],o[2*s+1]=e[s+1],o[2*s+2]=e[s+2],o[2*s+3]=e[s+3],o[2*s+4]=e[s+4],o[2*s+5]=e[s+5];return n.prototype.setPositions.call(this,o),this},t.prototype.setColors=function(e){for(var r=e.length-3,o=new Float32Array(2*r),s=0;s<r;s+=3)o[2*s]=e[s],o[2*s+1]=e[s+1],o[2*s+2]=e[s+2],o[2*s+3]=e[s+3],o[2*s+4]=e[s+4],o[2*s+5]=e[s+5];return n.prototype.setColors.call(this,o),this},t.prototype.fromLine=function(e){var r=e.geometry;if(r instanceof THREE__namespace.Geometry){var o=new THREE__namespace.BufferGeometry().fromGeometry(r);this.setPositions(o.attributes.position.array)}else r instanceof THREE__namespace.BufferGeometry&&this.setPositions(r.attributes.position.array);return this},t.prototype.copy=function(){return this},t}(LineSegmentsGeometry);Object.assign(LineGeometry.prototype,{isLineGeometry:!0});var circleImageURL="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAAZiS0dEAAAAAAAA+UO7fwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sHDgwCEMBJZu0AAAAdaVRYdENvbW1lbnQAAAAAAENyZWF0ZWQgd2l0aCBHSU1QZC5lBwAABM5JREFUWMO1V0tPG2cUPZ4Hxh6DazIOrjFNqJs0FIMqWFgWQkatsmvVbtggKlSVRVf5AWz4AWz4AUSKEChll19QJYSXkECuhFxsHjEhxCYm+DWGMZ5HF72DJq4bAzFXurI0M/I5997v3u9cC65vTJVn2lX/xHINQOYSBLTLEuIuCWw4Z3IGAEvf6ASmVHjNzHCXBG4A0AjACsAOwEbO0nsFQBnAGYASAIl+ZRMR7SolMEdsByD09fV5R0ZGgg8ePPjW5/N1iqLYpuu6RZblciKR2I9Go69evnwZnZ+fjwI4IS8AKBIRzeQfJWCANwKwh0KhtrGxsYehUOin1tbW+zzP23ietzY2NnIAoGmaLsuyUiqVyvl8XtrY2NiamZn589mzZxsAUgCOAeQAnFI2tI+VxIjaAeDzoaGh7xYWFuZOTk6OZVk+12uYqqq6JEnn0Wg0OT4+/geAXwGEAdwDIFJQXC1wO4DWR48e/RCPxxclSSroVzRFUbSDg4P848ePFwH8DuAhkWih83TRQWxFOXgAwvDwcOfo6OhvXV1d39tsNtuVBwTDWBwOh1UUxVsMw1hXVlbSdCgNV43uYSvrHg6H24aHh38eHBz85TrgF9FYLHA4HLzH43FvbW2d7u/vG+dANp8FpqIlbd3d3V8Fg8EfBUFw4BONZVmL3+9vHhkZCQL4AoAHgJPK8G+yzC0XDofdoVAo5PP5vkadTBAEtr+/39ff3x8gAp/RPOEqx2qjx+NpvXv3bk9DQ0NDvQgwDIOWlhZrMBj8kgi0UJdxRgYMArzL5XJ7vd57qLPZ7Xamp6fnNgBXtQxcjFuHw+Hyer3t9SYgCAITCAScAJoBNNEY/08GOFVVrfVMv7kMNDntFD1vjIAPrlRN0xjckOm6biFQ3jwNPwDMZrOnqVTqfb3Bi8Wivru7W/VCYkwPlKOjo0IikXh7EwQikYgE4Nw0CfXKDCipVCoTj8df3QABbW1tLUc6oUgkFPMkVACUNjc337148eKvw8PDbJ2jP1taWkoCyNDVXDSECmNSK4qiKNLq6urW8+fPI/UicHx8rD59+jSVy+WOAKSJhKENwFItLtoxk8mwsixzHR0dHe3t7c5PAU+n09rs7OzJkydPYqVSaQfANoDXALIk31S2smU1TWMPDg7K5XKZ7+3t9TudTut1U7+wsFCcmJiIpdPpbQBxADsAknQWymYCOukBHYCuKApisdhpMpnURFEU79y503TVyKenpzOTk5M7e3t7MQKPV0Zv1gNm+awB0MvlshqLxfLb29uyJElWURSbXC4XXyvqxcXFs6mpqeTc3Nzu3t7e3wQcA7BPZ8Cov1pNlJplmQtAG8MwHV6v95tAINA5MDBwPxAIuLu6upr8fr/VAN3c3JQjkcjZ+vp6fnl5+d2bN29SuVzuNYAEpf01CdRChUL+X1VskHACuA3Ay3Fcu9vt7nA6nZ7m5uYWQRCaNE3jVVW15PP580KhIGUymWw2m00DOAJwSP4WwPtq4LX2Ao6USxNlQyS/RcQcdLGwlNIz6vEMAaZpNzCk2Pll94LK/cDYimxERiBwG10sxjgvEZBE0UpE6vxj+0Ct5bTaXthgEhRmja8QWNkkPGsuIpfdjpkK+cZUWTC0KredVmtD/gdlSl6EG4AMvQAAAABJRU5ErkJggg==",DEFAULT_COLOR=14467195,POINT_SIZE=8,DEFAULT_LINEWIDTH=2,DEFAULT_DASHSCALE=20,sharedCircleTexture=null,FiveLine=function(n){__extends(t,n);function t(e,r){e===void 0&&(e=new THREE__namespace.Vector3),r===void 0&&(r=new THREE__namespace.Vector3);var o=n.call(this)||this;o.type="FiveLine",o.needsRender=!0;var s=new LineGeometry,u=new LineMaterial({color:DEFAULT_COLOR,linewidth:DEFAULT_LINEWIDTH,dashScale:DEFAULT_DASHSCALE,dashed:!1});o.line=new Line2(s,u);var l=new THREE__namespace.BufferGeometry,c=new THREE__namespace.PointsMaterial({color:DEFAULT_COLOR,size:POINT_SIZE,map:sharedCircleTexture||(sharedCircleTexture=new THREE__namespace.TextureLoader().load(circleImageURL)),sizeAttenuation:!1,transparent:!0});return o.points=new THREE__namespace.Points(l,c),o.points.renderOrder=11,o.points.frustumCulled=!1,o.setPoints(e,r),o.add(o.line,o.points),o}return Object.defineProperty(t,"version",{get:function(){return"6.4.1"},enumerable:!1,configurable:!0}),t.prototype.setPoints=function(e,r){var o=[].concat(e.toArray(),r.toArray());this.points.geometry.setAttribute("position",new THREE__namespace.BufferAttribute(new Float32Array(o),3)),this.line.geometry.setPositions(o),this.line.computeLineDistances(),this.needsRender=!0},t.prototype.getPoints=function(){var e=this.points.geometry.attributes.position.array;return[new THREE__namespace.Vector3(e[0],e[1],e[2]),new THREE__namespace.Vector3(e[3],e[4],e[5])]},t.prototype.setMaterial=function(e){var r=this.line.material;for(var o in e)if(e.hasOwnProperty(o)){var s=e[o];o==="dashed"?(r.dashed=s,s?r.defines.USE_DASH="":delete r.defines.USE_DASH,r.needsUpdate=!0):r[o]=e[o]}this.needsRender=!0},t.prototype.setResolution=function(e,r){var o=this.line.material.resolution;(o.x!==e||o.y!==r)&&(o.set(e,r),this.needsRender=!0)},t}(THREE__namespace.Object3D);Object.assign(FiveLine.prototype,{isFiveLine:!0});var Constants={Handedness:Object.freeze({NONE:"none",LEFT:"left",RIGHT:"right"}),ComponentState:Object.freeze({DEFAULT:"default",TOUCHED:"touched",PRESSED:"pressed"}),ComponentProperty:Object.freeze({BUTTON:"button",X_AXIS:"xAxis",Y_AXIS:"yAxis",STATE:"state"}),ComponentType:Object.freeze({TRIGGER:"trigger",SQUEEZE:"squeeze",TOUCHPAD:"touchpad",THUMBSTICK:"thumbstick",BUTTON:"button"}),ButtonTouchThreshold:.05,AxisTouchThreshold:.1,VisualResponseProperty:Object.freeze({TRANSFORM:"transform",VISIBILITY:"visibility"})};function fetchJsonFile(n){return __awaiter(this,void 0,void 0,function(){var t;return __generator(this,function(e){switch(e.label){case 0:return[4,fetch(n)];case 1:if(t=e.sent(),t.ok)return[2,t.json()];throw new Error(t.statusText)}})})}function fetchProfilesList(n){return __awaiter(this,void 0,void 0,function(){var t,e;return __generator(this,function(r){switch(r.label){case 0:if(!n)throw new Error("No basePath supplied");return t="profilesList.json",[4,fetchJsonFile("".concat(n,"/").concat(t))];case 1:return e=r.sent(),[2,e]}})})}function fetchProfile(n,t){return __awaiter(this,arguments,void 0,function(e,r,o,s){var u,l,c,f,d,p;return o===void 0&&(o=null),s===void 0&&(s=!0),__generator(this,function(v){switch(v.label){case 0:if(!e)throw new Error("No xrInputSource supplied");if(!r)throw new Error("No basePath supplied");return[4,fetchProfilesList(r)];case 1:if(u=v.sent(),e.profiles.some(function(A){var g=u[A];return g&&(l={profileId:A,profilePath:"".concat(r,"/").concat(g.path),deprecated:!!g.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=v.sent(),s){if(p=void 0,p=f.layouts[e.handedness],!p)throw new Error("No matching handedness, ".concat(e.handedness,", in profile ").concat(l.profileId));p.assetPath&&(d=l.profilePath.replace("profile.json",p.assetPath))}return[2,{profile:f,assetPath:d}]}})})}var defaultComponentValues={xAxis:0,yAxis:0,button:0,state:Constants.ComponentState.DEFAULT};function normalizeAxes(n,t){n===void 0&&(n=0),t===void 0&&(t=0);var e=n,r=t,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 d=f.valueNodeName,p=f.minNodeName,v=f.maxNodeName,A=f.valueNodeProperty;if(A===Constants.VisualResponseProperty.TRANSFORM){if(f.minNode=t.getObjectByName(p),f.maxNode=t.getObjectByName(v),!f.minNode){console.warn("Could not find ".concat(p," in the model"));return}if(!f.maxNode){console.warn("Could not find ".concat(v," in the model"));return}}f.valueNode=t.getObjectByName(d),f.valueNode||console.warn("Could not find ".concat(d," in the model"))})})}function addAssetSceneToControllerModel(n,t){findNodes(n.motionController,t),n.envMap&&t.traverse(function(e){e instanceof THREE__namespace.Mesh&&e.isMesh&&(e.material.envMap=n.envMap,e.material.needsUpdate=!0)}),n.add(t)}var XRControllerModelFactory=function(){function n(t){t===void 0&&(t=null),this.gltfLoader=t,this.path=DEFAULT_PROFILES_PATH,this._assetCache={}}return n.prototype.createControllerModel=function(t){var e=this,r=new XRControllerModel,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 d=e._assetCache[r.motionController.assetUrl];if(d)o=d.scene.clone(),addAssetSceneToControllerModel(r,o);else{if(!e.gltfLoader)throw new Error("GLTFLoader not set.");e.gltfLoader.load(r.motionController.assetUrl,function(p){e._assetCache[r.motionController.assetUrl]=p,o=p.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,ROTATE_Y_PI_MATRIX=new THREE__namespace.Matrix4().makeRotationAxis(new THREE__namespace.Vector3(0,1,0),Math.PI),PANO_TEXTURE_SCALE=new THREE__namespace.Vector3(-1,1,1),XRPanoramaController=function(n){__extends(t,n);function t(e){var r=n.call(this,e)||this;r.xrManager=new XRManager(r.renderer,r.renderer.getContext(),{onSessionStart:function(c){r.emit("xr.session.start",createEvent("xr.session.start",{session:c,machineType:r.xrManager.machineType}))},onSessionEnd:function(){r.emit("xr.session.end",createEvent("xr.session.end",{session:null,machineType:r.xrManager.machineType}))}}),r.xrControllerRay={left:new THREE__namespace.Raycaster,right:new THREE__namespace.Raycaster},r.xrControllerRay.left.params.Points={threshold:.1},r.xrControllerRay.right.params.Points={threshold:.1},r.gazeRay=null,r.pointerLines={left:new FiveLine,right:new FiveLine},r.pointerLines.left.visible=!1,r.pointerLines.right.visible=!0,r.pointerLines.left.setMaterial({color:new THREE__namespace.Vector3(1,1,1)}),r.pointerLines.left.points.material.depthTest=!1,r.pointerLines.right.setMaterial({color:new THREE__namespace.Vector3(1,1,1)}),r.pointerLines.right.points.material.depthTest=!1,r.controllerWrappers=[new THREE__namespace.Group,new THREE__namespace.Group];var 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(d){var p;return parseGltf(d.body,{resourcePath:c.slice(0,c.lastIndexOf("/")+1),search:(p=c.split("?")[1])!==null&&p!==void 0?p:"",fetcher:internalFetcher})}).then(function(d){return f(d)})}},(r.xrManager.machineType==="Oculus"||r.xrManager.machineType==="Pico")&&r.scene.add(r.pointerLines.left,r.pointerLines.right,r.controllerWrappers[0],r.controllerWrappers[1]),r.panoResources={},r.panoResources[r.locationMotion.keyframes[0].key=r.locationMotion.keyframes[1].key=createUuid()]={panoId:panoStringify(r.currentPano),leftPanoPicture:null,position:r.camera.pose.offset.clone(),effect:"fade",fixCameraTransform:new THREE__namespace.Matrix4},r.parallaxCameraMatrixs=[];var 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,d=(u=r.effect)!==null&&u!==void 0?u:"fade";this.userAction=o,this.stopMomentumMovement();var p=this.works.getResolvedObserver(e);if(!p)throw new Error("Invalid PanoIndex");var v=getImageSizeFromURL(p.images.up),A=this.imageOptions.size;typeof A=="undefined"&&p&&v&&(A=Number(v)),typeof A=="undefined"&&(A=2048);var g=this.imageOptions.transform,h=function(M,w){return mapPanoResource(applyImageURLOptions(M,g,w))},y=__assign({key:"pano.".concat(p.panoId)},pick(this.imageOptions,["format","size","quality"])),m=p.images,E=(c=(l=p.images.tiles)===null||l===void 0?void 0:l.filter(function(M){return M.size>A}))!==null&&c!==void 0?c:null,b="pano:"+jsonHash([m,y,g]);if(this.pendingTextureTask){if(this.pendingTextureTask.hash===b)return;var T=this.pendingTextureTask.panoId;(f=this.panoMeshes[T])===null||f===void 0||f.setProgress(0),this.emit("pano.texture.abort",createEvent("pano.texture.abort",{error:null,progress:0,meta:null,pano:p.pano}))}var _=this.models.getMaterial()||{},R=_.pano0,S=_.pano1,C;if((R==null?void 0:R.map.name)===b?C=R:(S==null?void 0:S.map.name)===b&&(C=S),C){var B={panoId:p.panoId,effect:d,leftPanoPicture:{zoom:1,map:C.map,luminanceMap:C.luminanceMap,matrix:new THREE__namespace.Matrix4().compose(p.position,p.quaternion,PANO_TEXTURE_SCALE)},position:p.position.clone(),fixCameraTransform:new THREE__namespace.Matrix4};this.doMoveToPano(p.pano,B,r);return}var L="move-to-pano-"+p.panoId;this.pending.add(L),this.pendingTextureTask={panoId:p.panoId,hash:b,onLoad:function(M){if(s.pending.delete(L),s.destroyed)M.body.dispose();else{M.body.name=b;var w={panoId:p.panoId,effect:d,leftPanoPicture:{zoom:1,map:M.body,luminanceMap:null,matrix:new THREE__namespace.Matrix4().compose(p.position,p.quaternion,PANO_TEXTURE_SCALE)},position:p.position.clone(),fixCameraTransform:new THREE__namespace.Matrix4};s.doMoveToPano(p.pano,w,r)}},onError:function(M){s.pending.delete(L);var w=__assign(__assign(__assign({},p.pano),{mode:s.mode}),clonePose(s.camera.pose));s.emit("pano.error",createEvent("pano.error",{error:M,userAction:s.userAction,options:r,prevPano:s.currentPano,progress:0,state:w})),s.emit("pano.cancel",createEvent("pano.cancel",{error:null,userAction:s.userAction,options:r,prevPano:s.currentPano,progress:0,state:w})),r.moveCancelCallback&&r.moveCancelCallback()}},Promise.all([this.tileLevelForFov&&E&&E.length?this.textureLoader.loadTiledCubeTexture(m,E,{tileMaxLevel:this.tiledCubeTextureLevel,imageURL:{transform:h,options:y},format:THREE__namespace.RGBAFormat,minFilter:THREE__namespace.LinearFilter,magFilter:THREE__namespace.LinearFilter,generateMipmaps:!1,viaAjax:!0,fetcher:getFetcher(p.work)},void 0,void 0,function(M){var w,H;s.emit("pano.texture.progress",createEvent("pano.texture.progress",{error:null,progress:M,meta:null,pano:p.pano})),((w=s.pendingTextureTask)===null||w===void 0?void 0:w.hash)===b&&((H=s.panoMeshes[p.panoId])===null||H===void 0||H.setProgress(M))},this.renderer):this.textureLoader.loadCubeTexture(m,{imageURL:{transform:h,options:y},format:THREE__namespace.RGBAFormat,fetcher:getFetcher(p.work)},void 0,void 0,function(M){var w,H;((w=s.pendingTextureTask)===null||w===void 0?void 0:w.hash)===b&&((H=s.panoMeshes[p.panoId])===null||H===void 0||H.setProgress(M)),s.emit("pano.texture.progress",createEvent("pano.texture.progress",{error:null,progress:M,meta:null,pano:p.pano}))},this.renderer)]).then(function(M){var w,H,O=M[0];((w=s.pendingTextureTask)===null||w===void 0?void 0:w.hash)===b?(s.pendingTextureTask.onLoad(O),(H=s.panoMeshes[p.panoId])===null||H===void 0||H.setProgress(0),delete s.pendingTextureTask,s.emit("pano.texture.success",createEvent("pano.texture.success",{error:null,progress:1,meta:O.meta,pano:p.pano}))):O.body.dispose()}).catch(function(M){var w,H;((w=s.pendingTextureTask)===null||w===void 0?void 0:w.hash)===b&&(s.pendingTextureTask.onError(M),(H=s.panoMeshes[p.panoId])===null||H===void 0||H.setProgress(0),delete s.pendingTextureTask,s.emit("pano.texture.error",createEvent("pano.texture.error",{error:M,progress:0,meta:null,pano:p.pano})),s.emit("error",M))}),this.emit("pano.texture.load",createEvent("pano.texture.load",{error:null,progress:0,meta:null,pano:p.pano}))},t.prototype.doMoveToPano=function(e,r,o){var s=this,u,l,c,f,d,p,v,A,g,h;o===void 0&&(o={});var y=now(),m=createUuid();this.panoResources[m]=r;var E=1,b,T,_;if(this.locationMotion.ended){var R=this.locationMotion.getKeyFrameSegment(y);R[0];var S=R[1],C=this.locationMotion.value,B=this.panoResourceFromLocationMotionKeyframe(S).position,L=r.position;b=Math.max(B.distanceTo(L),E),T=[{key:S.key,progress:0,value:__assign(__assign({},C),{count:0})},{key:m,progress:1,value:{distance:0,count:1}}],_=0}else{var M=this.locationMotion.getKeyFrameSegment(y),w=M[0],S=M[1],C=this.locationMotion.value,H=this.panoResourceFromLocationMotionKeyframe(w).position,B=this.panoResourceFromLocationMotionKeyframe(S).position,L=r.position,O=S.value.count-C.count,I=Math.max(H.distanceTo(B),E)*O,N=Math.max(B.distanceTo(L),E);b=I+N,T=[{key:w.key,progress:0,value:__assign({},C)},{key:S.key,progress:I/b,value:S.value},{key:m,progress:1,value:{count:S.value.count+1,distance:0}}];var k=this.locationMotionKeyframesLength(this.locationMotion.keyframes),U=this.locationMotionKeyframesLength(T);_=this.locationMotion.getProgressVelocity(y)*k/U}var D=r.effect==="instant"?0:this.calculateMovingDuration(o.duration,r.effect==="fly"?b:0),q={longitude:o.longitude,latitude:o.latitude,fov:o.fov},z=__assign(__assign({},e),{mode:this.mode,longitude:(u=q.longitude)!==null&&u!==void 0?u:this.camera.pose.longitude,latitude:(l=q.latitude)!==null&&l!==void 0?l:this.camera.pose.latitude,fov:(c=q.fov)!==null&&c!==void 0?c:this.camera.pose.fov,offset:r.position.clone(),distance:0}),Q=this.currentPano;if(this.emit("pano.moveTo",createEvent("pano.moveTo",{options:o,prevPano:Q,progress:0,state:z,userAction:this.userAction,error:null})),o.moveStartCallback&&o.moveStartCallback(z),this.videoTexture&&this.videoTexture.image instanceof HTMLVideoElement&&this.videoTexture.image.getAttribute("src")&&(this.videoTexture.image.pause(),this.videoTexture.image.removeAttribute("uuid"),this.videoTexture.image.removeAttribute("src"),this.videoTexture.image.oncanplay=noop$1,this.videoTexture.needsUpdate=!0),this.panoVideo.setMaterial(null),r.effect==="fly")this.cameraMotion.set(q,D).catch(noop$1);else{var G=coordinatesToVector({longitude:this.cameraMotion.value.longitude,latitude:this.cameraMotion.value.latitude}),X=coordinatesToVector({longitude:(f=q.longitude)!==null&&f!==void 0?f:this.cameraMotion.value.longitude,latitude:(d=q.latitude)!==null&&d!==void 0?d:this.cameraMotion.value.latitude}),$=new THREE__namespace.Object3D;$.lookAt(G);var W=new THREE__namespace.Matrix4().makeRotationFromQuaternion($.quaternion);$.lookAt(X);var oe=new THREE__namespace.Matrix4().makeRotationFromQuaternion($.quaternion),ae=new THREE__namespace.Matrix4().getInverse(W).premultiply(oe),re=this.cameraMotion.value.fov,j=(p=q.fov)!==null&&p!==void 0?p:this.cameraMotion.value.fov,se=1;r.effect==="zoomin"?se=1.5:r.effect==="zoomout"&&(se=.4);for(var ie=j*se,ue=0;ue<T.length-1;ue++){var fe=T[ue].key;if(fe){var ne=this.panoResources[fe];ne&&(ne.fixCameraTransform.copy(ae),ne.leftPanoPicture&&(ne.leftPanoPicture.zoom=Math.tan(re/2/180*Math.PI)/Math.tan(ie/2/180*Math.PI)))}}this.cameraMotion.setKeyframes([{progress:0,value:{longitude:this.cameraMotion.value.longitude,latitude:this.cameraMotion.value.latitude,fov:this.cameraMotion.value.fov}},{progress:0,value:{longitude:(v=q.longitude)!==null&&v!==void 0?v:this.cameraMotion.value.longitude,latitude:(A=q.latitude)!==null&&A!==void 0?A:this.cameraMotion.value.latitude,fov:ie}},{progress:1,value:{longitude:(g=q.longitude)!==null&&g!==void 0?g:this.cameraMotion.value.longitude,latitude:(h=q.latitude)!==null&&h!==void 0?h:this.cameraMotion.value.latitude,fov:j}}],D).catch(noop$1)}var Te=this.locationMotion.setKeyframes(T,D,_);Te.then(function(){for(var _e,ve,Me,Z=0,te=s.models;Z<te.length;Z++){var K=te[Z];K.show()}var ye=__assign(__assign({},e),{mode:s.mode,longitude:s.camera.pose.longitude,latitude:s.camera.pose.latitude,fov:s.camera.pose.fov,offset:s.camera.pose.offset.clone(),distance:0});s.emit("pano.arrived",createEvent("pano.arrived",{options:o,prevPano:Q,progress:1,state:ye,userAction:s.userAction,error:null})),o.moveEndCallback&&o.moveEndCallback(ye);var de=s.works.getResolvedObserver(s.currentPano);if(de&&de.video&&s.videoTexture&&s.videoTexture.image instanceof HTMLVideoElement){var xe=ROTATE_Y_PI_MATRIX.clone().multiply((Me=(ve=(_e=s.models.getMaterial())===null||_e===void 0?void 0:_e.pano1)===null||ve===void 0?void 0:ve.matrix)!==null&&Me!==void 0?Me:new THREE__namespace.Matrix4).multiply(de.video.matrix),Ae={map:s.videoTexture,size:de.video.size,matrix:xe,alpha:1},me=createUuid(),ce=s.videoTexture.image;ce.setAttribute("uuid",me),canplayVideo().then(function(he){he&&de.video&&ce.getAttribute("uuid")===me&&(ce.oncanplay=function(){ce.oncanplay=noop$1,ce.play()},ce.ontimeupdate=function(){ce.currentTime>.5&&(ce.ontimeupdate=noop$1,s.panoVideo.setMaterial(Ae))},ce.src=de.video.source)}).catch(function(){ce.removeAttribute("uuid")})}},function(){s.emit("pano.cancel",createEvent("pano.cancel",{options:o,prevPano:Q,progress:0,state:z,userAction:s.userAction,error:null})),o.moveCancelCallback&&o.moveCancelCallback()})},t.prototype.checkSelectedPano=function(e){var r=this,o,s,u,l;this.stopMomentumMovement();var c=this.camera.getDirection(new THREE__namespace.Vector3).setY(0),f=null,d=this.works.getResolvedObserver(this.currentPano);if(!d)return null;var p=d.accessibleIds.filter(function(X){var $=panoParse(X);if(panoEqual($,r.currentPano))return!1;var W=r.works.getResolvedObserver($);return!W||W.position.distanceTo(r.camera.position)>r.maxAccessibleDistance?!1:W.loadable||W.active}),v=this.models.intersectRaycaster(e)[0];if(v){var A=arrayMin(p,function(X){var $=r.works.getResolvedObserver(X);if(!$)return 1/0;var W=$.standingPosition.clone();return W.distanceTo(v.point)},!0),g=A[0],h=A[1];g&&h<this.panoTapTriggerRadius&&(f=(o=this.works.getResolvedObserver(g))!==null&&o!==void 0?o:null)}if(isNil(f)){var y=this.getForwardObserverOrNot(e);y&&(f=y)}for(var m=0,E=this.locationMotion.keyframes;m<E.length;m++){var b=E[m],T=this.panoResourceFromLocationMotionKeyframe(b);if(!(b.progress<this.locationMotion.progress)&&f&&T.panoId===f.panoId){f=null;break}}if(isNil(f))return this.locationMotion.ended===!0&&this.cameraBounce(),null;if(f&&!f.active){var _=f.panoId;this.panoMeshes[_]&&(this.panoMeshes[_].setDisabled(!1),this.panoMeshes[_].setLoading(!0))}var R={};if(f){for(var S=Math.PI/6,C=Math.PI/12,B=new THREE__namespace.Vector3(0,1,0),L=f.position.clone().setY(0).sub(d.position.clone().setY(0)).normalize(),M=L.clone().applyAxisAngle(B,S),w=L.clone().applyAxisAngle(B,-S),H=[],O=[],I=[],N=0,k=f.accessibleIds;N<k.length;N++){var g=k[N],U=panoParse(g);if(!(panoEqual(U,this.currentPano)||panoEqual(U,f.pano))){var D=this.works.getResolvedObserver(g);if(D){var q=D.position.clone().sub(f.position).setY(0);L.angleTo(q)<S?I.push(q):M.angleTo(q)<S?H.push(q):w.angleTo(q)<S&&O.push(q)}}}var z=I.length>0?I:__spreadArray(__spreadArray([],H,!0),O,!0),Q=z.slice().sort(function(X,$){return X.angleTo(L)-$.angleTo(L)})[0];Q&&Q.angleTo(c)>C&&(R.longitude=Math.atan2(-Q.x,-Q.z))}this.cameraMotion.value.latitude<-Math.PI/4&&(R.latitude=clamp$1(0,this.minLatitude,this.maxLatitude)),this.cameraMotion.value.fov<60&&(R.fov=this.defaultFov);var G={workCode:f.pano.workCode,panoIndex:f.pano.panoIndex,mode:this.mode,longitude:(s=R.longitude)!==null&&s!==void 0?s:this.camera.pose.longitude,latitude:(u=R.latitude)!==null&&u!==void 0?u:this.camera.pose.latitude,fov:(l=R.fov)!==null&&l!==void 0?l:this.camera.pose.fov,distance:0,offset:f?f.position.clone():new THREE__namespace.Vector3};return this.emit("pano.select",createEvent("pano.select",{prevPano:this.currentPano,state:G,userAction:!0,options:R,progress:0,error:null})),f&&f.active?(this.emit("pano.request",createEvent("pano.request",{userAction:!0,prevPano:this.currentPano,progress:0,state:G,options:R,error:null})),f.pano):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,d,p,v,A=[],g=2;g<arguments.length;g++)A[g-2]=arguments[g];this.userAction=!0;var h={},y={},m=this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[0]),E=this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[this.locationMotion.keyframes.length-1]),b=!1;if(this.cameraMotion.ended===!1&&(this.cameraMotion.update(e),y.longitude=this.cameraMotion.value.longitude,y.latitude=this.cameraMotion.value.latitude,y.fov=this.cameraMotion.value.fov),this.modelAlphaMotion.ended===!1&&(this.modelAlphaMotion.update(e),h.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 T=this.locationMotion.getKeyFrameSegment(e),_=T[0],R=T[1],S=this.panoResourceFromLocationMotionKeyframe(_),C=this.panoResourceFromLocationMotionKeyframe(R),B=new THREE__namespace.Vector3().copy(S.position),L=new THREE__namespace.Vector3().copy(C.position),M=this.locationMotion.value.count-R.value.count+1;h.progress=M,C.leftPanoPicture&&(M<1?S.leftPanoPicture&&(h.pano0=S.leftPanoPicture):h.pano0=C.leftPanoPicture,h.pano1=C.leftPanoPicture),C.effect==="montage"?h.transition="BLACK":C.effect==="spread"?h.transition="SPREAD":h.transition="FADE",(C.effect==="zoomin"||C.effect==="zoomout")&&(h.progress=Math.pow(M,3)),M<1&&C.effect!=="fly"&&(h.pano0&&S.leftPanoPicture&&(h.pano0={map:h.pano0.map,zoom:h.pano0.zoom,luminanceMap:h.pano0.luminanceMap,matrix:S.leftPanoPicture.matrix.clone().setPosition(C.position)}),B.copy(L),b=!0),y.distance=this.locationMotion.value.distance,y.offset=new THREE__namespace.Vector3(B.x+(L.x-B.x)*M,B.y+(L.y-B.y)*M,B.z+(L.z-B.z)*M);for(var w=[],H=[],O=0,I=this.locationMotion.keyframes;O<I.length;O++){var N=I[O],k=N.key,U=N.progress;k!==void 0&&(w.push(k),U>this.locationMotion.progress&&H.push(k))}for(var D=0,q=Object.keys(this.panoResources);D<q.length;D++){var z=q[D];if(!(H.indexOf(z)>=0)){var Q=this.panoResources[z];if(Q.leftPanoPicture){var G=Q.leftPanoPicture.map;if(G){if(G===((s=h.pano0)===null||s===void 0?void 0:s.map)||G===((u=h.pano1)===null||u===void 0?void 0:u.map))continue;G instanceof TileCubeTextureTarget&&G.cubeRenderTarget&&this.colorCubeRenderTargetPool.push(G.cubeRenderTarget),G.dispose(),Q.leftPanoPicture=null}}w.indexOf(z)>=0||delete this.panoResources[z]}}this.currentPano=panoParse(C.panoId),this.emit("pano.moving",createEvent("pano.moving",{userAction:this.userAction,prevPano:panoParse(m.panoId),state:__assign(__assign(__assign(__assign({},panoParse(E.panoId)),{mode:this.mode}),clonePose(this.camera.pose)),y),options:{},progress:this.locationMotion.progress,error:null}))}isEmptyObject(h)===!1&&(!((l=h.pano0)===null||l===void 0)&&l.map&&h.pano0.map instanceof TileCubeTextureTarget&&!h.pano0.map.cubeRenderTarget&&(h.pano0.map.cubeRenderTarget=this.colorCubeRenderTargetPool.pop()),!((c=h.pano1)===null||c===void 0)&&c.map&&h.pano1.map instanceof TileCubeTextureTarget&&!h.pano1.map.cubeRenderTarget&&(h.pano1.map.cubeRenderTarget=this.colorCubeRenderTargetPool.pop()),this.models.setMaterial(h)),isEmptyObject(y)===!1&&this.setCamera(y);var X=this.works.getResolvedObserver(this.currentPano),$=A[1];if(!$){console.error("xrFrame丢失,请重试");return}if(!this.xrManager.session){console.error("session丢失,请重试");return}var W=this.xrManager.referenceSpace;if(W){var oe=this.xrManager.cameraVR,ae=this.xrManager.cameraL,re=this.xrManager.cameraR,j=[ae,re],se=$.getViewerPose(W),ie=new THREE__namespace.Vector3(0,0,0);if(se){var ue;ue=this.xrManager.session.renderState.baseLayer;var fe=se.views;if(!ue){console.error("no layer found");return}this.renderer.setFramebuffer(ue.framebuffer);var ne=!1;fe.length!==oe.cameras.length&&(oe.cameras.length=0,ne=!0),this.parallaxCameraMatrixs=[];var Te=new THREE__namespace.Vector3,_e=new THREE__namespace.Vector3;new THREE__namespace.Matrix4().fromArray(fe[0].transform.matrix).decompose(Te,new THREE__namespace.Quaternion,new THREE__namespace.Vector3),new THREE__namespace.Matrix4().fromArray(fe[1].transform.matrix).decompose(_e,new THREE__namespace.Quaternion,new THREE__namespace.Vector3),_e.clone().sub(Te).normalize();var ve=new THREE__namespace.Vector3,Me=new THREE__namespace.Quaternion,Z=new THREE__namespace.Vector3;this.camera.matrix.decompose(ve,Me,Z);for(var te=0;te<fe.length;te++){var K=fe[te],ye=ue.getViewport(K),de=j[te];de.matrix.fromArray(K.transform.matrix);var xe=new THREE__namespace.Vector3,Ae=new THREE__namespace.Quaternion,me=new THREE__namespace.Vector3;de.matrix.decompose(xe,Ae,me),ie.copy(ve),de.position.copy(ve),de.quaternion.copy(Ae),de.scale.copy(me),de.updateMatrix(),de.projectionMatrix.fromArray(K.projectionMatrix),de.viewport.set(ye.x,ye.y,ye.width,ye.height),ne===!0&&oe.cameras.push(de)}if(this.xrManager.session&&this.xrManager.session.inputSources){for(var te=0;te<this.xrManager.session.inputSources.length;te++)if(this.xrManager.session.inputSources[te]&&this.xrManager.session.inputSources[te].targetRayMode==="transient-pointer"){var ce=$.getPose(this.xrManager.session.inputSources[te].targetRaySpace,W);if(ce){var he=new THREE__namespace.Vector3(0,0,-1).applyQuaternion(ce.transform.orientation),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,te=0;te<pe.length;te++){var Re=this.xrManager.controllers[te],we=pe[te];if(we){Re&&Re.update(we,$,W);var ee=this.xrManager.getController(te),Ue=new THREE__namespace.Vector3(0,1.2,0),be=ee.position.clone().add(ie).sub(Ue);we.handedness==="left"?this.xrControllerRay.left.set(be,new THREE__namespace.Vector3(0,0,-1).applyEuler(ee.rotation)):we.handedness==="right"&&this.xrControllerRay.right.set(be,new THREE__namespace.Vector3(0,0,-1).applyEuler(ee.rotation)),this.controllerWrappers[te].position.copy(new THREE__namespace.Vector3(0,0,0).add(ie).sub(Ue));var ge=this.models.intersectRaycaster(this.xrControllerRay.right);if(ge.length===0&&(ge=this.xrControllerRay.right.intersectObject(this.boundingMesh,!0).map(function(vt){var At;return __assign({floor:(At=X==null?void 0:X.floorIndex)!==null&&At!==void 0?At:0},vt)})),ge.length>=1&&ge[0].face)if(we.handedness==="right"){var ze=this.xrControllerRay.right.intersectObject(this.xrCustomObjectsScene,!0),Ne=ge[0].face.normal,Je=Ne.clone(),Ke=ge[0].point.clone();this.intersectMesh.position.copy(Ke);var De=Ke.clone().add(Je);if(this.intersectMesh.lookAt(De),Math.abs(Ne.y)>.99){var Ye=this.camera.position.clone().sub(Ke);this.intersectMesh.rotation.z=-Math.atan2(Ye.z,Ye.x)}this.intersectMesh.visible=!0,this.needsRender=!0,ze.length>0?(this.pointerLines.right.setPoints(be,ze[0].point),this.pointerLines.right.points.visible=!0,this.intersectMesh.visible=!1):(this.pointerLines.right.points.visible=!1,this.pointerLines.right.setPoints(be,ge[0].point));var Ve=ge[0],nt=createEvent("intersect.update",{raycaster:(f=this.xrControllerRay.right)!==null&&f!==void 0?f:null,intersection:Ve!=null?Ve:null,object:this.intersectMesh});if(this.emit("intersect.update",nt),nt.defaultPrevented){this.hideIntersectMesh();return}}else this.pointerLines.left.setPoints(be,ge[0].point)}}this.updateControllerHelper(pe,e,r)}if(this.camera.pose.distance>.1||b)for(var qe=0,Qe=Object.keys(this.panoMeshes);qe<Qe.length;qe++){var Ie=Qe[qe],Se=this.panoMeshes[Ie];Se.setOpacity(0),Se.setCurrent(!1),Se.updateTime&&Se.updateTime(e,r),Se.visible=!1}else if(X){var Be=arrayMin(X.visibleIds,function(Oe){var ut=o.works.getResolvedObserver(Oe);return ut?X.standingPosition.distanceTo(ut.standingPosition):1/0},!0),Le=Be[1];Le=clamp$1(Le,2.5,1/0);for(var ot=X.visibleIds.concat(panoStringify(this.currentPano)),$e=this.getForwardObserverOrNot(),tt=this.camera.getDirection(new THREE__namespace.Vector3),Xe=0,rt=Object.keys(this.panoMeshes);Xe<rt.length;Xe++){var Ie=rt[Xe],Se=this.panoMeshes[Ie],Ge=this.works.getResolvedObserver(Ie);if(ot.indexOf(Ie)===-1)Se.setCurrent(!1),Se.setOpacity(0);else if(!Ge)Se.setCurrent(!1),Se.setOpacity(0);else if(!Ge.loadable&&!Ge.active)Se.setCurrent(!1),Se.setOpacity(0);else{var st=Se.position.clone().setY(this.camera.position.y).distanceTo(this.camera.position);Se.setCurrent(!Se.loading&&Se.progress===0&&$e!==null&&$e.panoId===Ie),Se.setOpacity(st<.01?0:clamp$1(Le/st*1.2,.65,.98));var ct=this.camera.position.clone().setY(Se.position.y),he=new THREE__namespace.Vector3().copy(Se.position).sub(ct).normalize();if(Ie===panoStringify(this.currentPano)){var je=clamp$1((.5-ct.distanceTo(Se.position))/.5,0,1);he.multiplyScalar(1-je).add(tt.clone().multiplyScalar(je))}he.length()>0&&Se.quaternion.setFromEuler(new THREE__namespace.Euler(0,Math.atan2(he.x,he.z),0))}Se.updateTime&&Se.updateTime(e,r)}}var Fe=function(){return 4}(),We=function(){var Oe=new THREE__namespace.PerspectiveCamera;Oe.applyMatrix4(oe.matrix),Oe.position.set(0,0,0);var ut=o.works.getResolvedObserver(E.panoId),vt=ut!=null?ut:X;vt&&Oe.quaternion.premultiply(vt.quaternion.clone().inverse()),Oe.updateProjectionMatrix(),Oe.updateMatrixWorld(!0);var At=new THREE__namespace.Frustum().setFromProjectionMatrix(new THREE__namespace.Matrix4().multiplyMatrices(Oe.projectionMatrix,Oe.matrixWorldInverse));return At}();E.panoId===panoStringify(this.currentPano)&&((d=E.leftPanoPicture)===null||d===void 0?void 0:d.map)instanceof TileCubeTextureTarget&&(E.leftPanoPicture.map.maxRequest=this.tileMaxRequest,E.leftPanoPicture.map.update(We,Fe),E.leftPanoPicture.map.needsRender===!0&&(this.needsRender=!0,this.modelSceneNeedsRender=!0));{var at=this.tiling.object.visible;if(this.initAnimationed){var Pe=E.panoId,Ce=this.works.getResolvedObserver(Pe);Ce?isSimilarVector3(this.camera.position,Ce.position)&&this.locationMotion.ended?(this.tiling.object.visible=!0,this.tiling.panoId!==Pe&&this.tiling.cleanup(),this.tiling.panoId=Pe,this.tiling.setResource((v=(p=Ce.images)===null||p===void 0?void 0:p.tiles)!==null&&v!==void 0?v:[],this.enableIOSEDR&&Ce.images.luminance?Ce.images.luminance:null),this.tiling.setFetcher(getFetcher(Ce.work)),this.tiling.setRotation(Ce.quaternion),this.tiling.setPosition(Ce.position),this.tiling.maxRequest=this.tileMaxRequest,Fe>this.tiledCubeTextureLevel?this.tiling.update(We,Fe,e):this.tiling.update(We,0,e)):this.tiling.object.visible=!1:this.tiling.object.visible=!1}else this.tiling.object.visible=!1;at!==this.tiling.object.visible&&(this.tiling.object.needsRender=!0,this.modelSceneNeedsRender=!0)}this.panoVideo.object.position.copy(this.camera.position),this.panoVideo.updateTime(e)}}},t.prototype.render=function(){var e=this.xrManager.getCamera(this.camera);this.renderer.render(this.modelScene,e),this.renderer.autoClearColor=!1,this.renderer.autoClearDepth=!1,this.renderer.render(this.scene,e),this.renderer.autoClearColor=!0,this.renderer.autoClearDepth=!0},t.prototype.onPanGesture=function(){},t.prototype.onTapGesture=function(){},t.prototype.onPinchGesture=function(){},t.prototype.onMouseMove=function(){},t.prototype.onMouseOut=function(){},t.prototype.panoResourceFromLocationMotionKeyframe=function(e){return this.panoResources[e.key]},t.prototype.updateControllerHelper=function(e,r,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,d=e[c].gamepad;switch(f){case"left":d.axes&&(this.emitHandleEvent(d.axes[2]===-1,"LeftAxesLeft",r),this.emitHandleEvent(d.axes[2]===1,"LeftAxesRight",r),this.emitHandleEvent(d.axes[3]===-1,"LeftAxesUp",r),this.emitHandleEvent(d.axes[3]===1,"LeftAxesDown",r)),d!=null&&d.buttons&&(d.buttons[4]&&this.emitHandleEvent(d.buttons[4].pressed,"X",r),d.buttons[5]&&this.emitHandleEvent(d.buttons[5].pressed,"Y",r),d.buttons[0]&&this.emitHandleEvent(d.buttons[0].pressed,"LeftTrigger",r),d.buttons[1]&&this.emitHandleEvent(d.buttons[1].pressed,"LeftPinch",r));var p={raycaster:s,axes:{up:d.axes&&d.axes[3]<0?Math.abs(d.axes[3]):0,down:d.axes&&d.axes[3]<0?0:Math.abs(d.axes[3]),left:d.axes&&d.axes[2]<0?Math.abs(d.axes[2]):0,right:d.axes&&d.axes[2]<0?0:Math.abs(d.axes[2])},deltaTime:o};l.buttons.X=d.buttons&&d.buttons[4]?d.buttons[4].pressed:!1,l.buttons.Y=d.buttons&&d.buttons[5]?d==null?void 0:d.buttons[5].pressed:!1,l.buttons.LeftTrigger=d.buttons&&d.buttons[0]?d==null?void 0:d.buttons[0].pressed:!1,l.buttons.LeftPinch=d.buttons&&d.buttons[1]?d==null?void 0:d.buttons[1].pressed:!1,l.left=p;break;case"right":d.axes&&(this.emitHandleEvent(d.axes[2]===-1,"RightAxesLeft",r),this.emitHandleEvent(d.axes[2]===1,"RightAxesRight",r),this.emitHandleEvent(d.axes[3]===-1,"RightAxesUp",r),this.emitHandleEvent(d.axes[3]===1,"RightAxesDown",r)),d.buttons&&(d.buttons[4]&&this.emitHandleEvent(d.buttons[4].pressed,"A",r),d.buttons[5]&&this.emitHandleEvent(d.buttons[5].pressed,"B",r),d.buttons[0]&&this.emitHandleEvent(d.buttons[0].pressed,"RightTrigger",r),d.buttons[1]&&this.emitHandleEvent(d.buttons[1].pressed,"RightPinch",r));var v={raycaster:u,axes:{up:d.axes&&d.axes[3]<0?Math.abs(d.axes[3]):0,down:d.axes&&d.axes[3]<0?0:Math.abs(d.axes[3]),left:d.axes&&d.axes[2]<0?Math.abs(d.axes[2]):0,right:d.axes&&d.axes[2]<0?0:Math.abs(d.axes[2])},deltaTime:o};l.right=v,l.buttons.A=d.buttons&&d.buttons[4]?d==null?void 0:d.buttons[4].pressed:!1,l.buttons.B=d.buttons&&d.buttons[5]?d==null?void 0:d.buttons[5].pressed:!1,l.buttons.RightTrigger=d.buttons&&d.buttons[0]?d==null?void 0:d.buttons[0].pressed:!1,l.buttons.RightPinch=d.buttons&&d.buttons[1]?d==null?void 0:d.buttons[1].pressed:!1;break}}this.emit("xr.controller.update",createEvent("xr.controller.update",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],t.state)}),n.on("works.load",function(t){n.emit("load",t.input,t.works[0],t.state)}),n.on("works.ready",function(t){n.emit("loaded",t.input,t.works[0])}),n.on("state.change",function(t){n.emit("stateChange",t.state,t.userAction)}),n.on("currentState.change",function(t){n.emit("currentStateChange",t.state,t.userAction)}),n.on("state.set",function(t){n.emit("setState",t.state)}),n.on("state.synced",function(t){n.emit("stateSynced",t.state)}),n.on("model.request",function(t){n.emit("modelWillLoad",t.work.model)}),n.on("model.error",function(t){n.emit("modelLoadError",t.error,t.model)}),n.on("model.load",function(t){n.emit("modelLoaded",t.model)}),n.on("model.changeShownFloor",function(t){n.emit("modelShownFloorChange",t.model.shownFloor,t.model.floorLength)}),n.on("render",function(t){n.emit("renderFrame",t.needsRender)}),n.on("mode.change.request",function(t){n.emit("wantsChangeMode",t.mode,t.prevMode)}),n.on("mode.change",function(t){n.emit("modeChange",t.mode,t.prevMode,t.state.panoIndex,t.state,t.userAction)}),n.on("helpers.visible",function(t){n.emit("helpersVisibleChange",t.object.visible)}),n.on("network.resource",function(t){n.emit("network",t.source,t.requestType,t.requestState,t.detail)})}function generateDefaultVideoElement(){if(typeof window!="undefined"){var n=document.createElement("video");n.loop=!0,n.autoplay=!0,n.playsInline=!0,n.muted=!0,n.crossOrigin="";var t=function(){document.removeEventListener("touchstart",t,!1),document.removeEventListener("mousedown",t,!1),n.muted=!1};return document.addEventListener("touchstart",t,!1),document.addEventListener("mousedown",t,!1),n}else return{}}function initLights(n){var t=new THREE__namespace.Group;t.name="internalLights";{var e=new THREE__namespace.DirectionalLight(16777215,.3);e.position.copy(new THREE__namespace.Vector3(1,1,1)),t.add(e)}{var e=new THREE__namespace.DirectionalLight(16777215,.1);e.position.copy(new THREE__namespace.Vector3(-1,-1,-1)),t.add(e)}{var e=new THREE__namespace.DirectionalLight(16777215,.1);t.add(e)}{var e=new THREE__namespace.AmbientLight(16777215,.6);t.add(e)}n.add(t)}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(),d=(e=c[1])===null||e===void 0?void 0:e.trim();f&&d&&(r[f]=d)}return r}function getViewportScale(){var n;if(typeof document!="undefined")for(var t=document.getElementsByTagName("meta"),e=0;e<t.length;e++){var r=t[e];if(r.getAttribute("name")==="viewport"){var 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,d=imageSize[1]/3;n.setViewport(l,c,f,d),n.setScissor(l,c,f,d),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$1},e.src=textureURL,material.map=t}}var DEFAULT_MODE_CHANGE_DURATION=800,DEFAULT_CAMERA_FOV=90,DEFAULT_REQUEST_PROXY=function(n){return n.replace("//vrlab-public.ljcdn.com/","//vr-public.realsee-cdn.cn/").replace("//vrlab-image4.ljcdn.com/","//vr-image-4.realsee-cdn.cn/").replace("//vrlab-image3.ljcdn.com/","//vr-image-3.realsee-cdn.cn/").replace("//vrlab-image2.ljcdn.com/","//vr-image-2.realsee-cdn.cn/").replace("//vrlab-image1.ljcdn.com/","//vr-image-1.realsee-cdn.cn/")},sharedVector2=new THREE__namespace.Vector2,sharedSphere=new THREE__namespace.Sphere,sharedFrustum=new THREE__namespace.Frustum,sharedProjScreenMatrix=new THREE__namespace.Matrix4,clockForMixer=new WeakMap,worksMap=new WeakMap,emptyWorks=createWorks([]);new Scene;var Five=function(n){__extends(t,n);function t(e){e===void 0&&(e={});var r,o,s,u,l,c,f,d,p,v,A,g,h=n.call(this)||this;if(h.ident=createUuid(),typeof window!="undefined"&&(__FIVE_DEBUG__.instances[h.ident]=h),h.renderSwitch01=0,h.currentMode="Panorama",h.pano={workCode:"",panoIndex:0},h.needsRender=!1,h.modelSceneNeedsRender=!1,h.onlyRenderIfNeeds=(r=e.onlyRenderIfNeeds)!==null&&r!==void 0?r:!0,h.imageOptions=__assign({},(o=e.imageOptions)!==null&&o!==void 0?o:{}),h.textureOptions=__assign({},(s=e.textureOptions)!==null&&s!==void 0?s:{}),h.poweredByRealsee=(u=e.poweredByRealsee)!==null&&u!==void 0?u:!0,h.extraElements=[],h.controllerInits={Panorama:Object.assign({},e.panorama),Model:Object.assign({},e.model),Floorplan:Object.assign({},e.floorplan),Topview:Object.assign({},e.topview),Mapview:Object.assign({},e.mapview),VRPanorama:Object.assign({},e.vrPanorama),XRPanorama:Object.assign({},e.xrPanorama)},h.fps={testCount:0,testTime:now()},h.info=null,h.modeChangeDuration=(l=e.modeChangeDuration)!==null&&l!==void 0?l:DEFAULT_MODE_CHANGE_DURATION,h.enableWheel=(c=e.enableWheel)!==null&&c!==void 0?c:!0,typeof window!="undefined")if("renderer"in e)e.renderer instanceof InternalWebGLRenderer&&h.throwError(new Error("cannot render a internal renderer")),h.renderer=e.renderer;else try{h.renderer=new InternalWebGLRenderer({preserveDrawingBuffer:e.preserveDrawingBuffer,backgroundColor:e.backgroundColor,backgroundAlpha:e.backgroundAlpha,antialias:e.antialias,webgl2:e.webgl2,logarithmicDepthBuffer:e.logarithmicDepthBuffer,precision:e.precision,powerPreference:e.powerPreference});var y=getViewportScale();h.renderer.setPixelRatio(y===1?window.devicePixelRatio:1),h.renderer.setSize(512,512)}catch(M){M instanceof Error&&h.throwError(M)}h.getPixelsRenderTarget=new THREE__namespace.WebGLRenderTarget(1,1,{encoding:(d=(f=h.renderer)===null||f===void 0?void 0:f.outputEncoding)!==null&&d!==void 0?d:THREE__namespace.sRGBEncoding,generateMipmaps:!1});var m=new THREE__namespace.DepthTexture(1,1);m.generateMipmaps=!1,m.format=THREE__namespace.DepthStencilFormat,m.type=THREE__namespace.UnsignedInt248Type,h.modelRenderTarget=new THREE__namespace.WebGLRenderTarget(1,1,{encoding:(v=(p=h.renderer)===null||p===void 0?void 0:p.outputEncoding)!==null&&v!==void 0?v:THREE__namespace.sRGBEncoding,depthTexture:m,generateMipmaps:!1,depthBuffer:!0,stencilBuffer:!0}),h.scissor=Object.assign({left:0,bottom:0,width:1,height:1},e.scissor),h.camera=new Camera(DEFAULT_CAMERA_FOV),h.scene=new Scene,h.xrCustomObjectsScene=new THREE__namespace.Scene,h.scene.add(h.xrCustomObjectsScene),h.scene.matrixAutoUpdate=!1,h.lastLoadWorkTask=Promise.resolve(),h.requestProxy=(A=e.requestProxy)!==null&&A!==void 0?A:DEFAULT_REQUEST_PROXY,h.networkSubscribe=new NetworkSubscribe,h.networkSubscribe.on("network",function(M,w,H,O){var I;h.emit("network.resource",createEvent("network.resource",{source:M,requestType:w,requestState:H,detail:O})),(I=h.analysis)===null||I===void 0||I.network(h.works,M,w,H,O)}),h.boundingMesh=generateBoundingMesh(new THREE__namespace.Box3(new THREE__namespace.Vector3(-.5,-.5,-.5),new THREE__namespace.Vector3(.5,.5,.5))),h.boundingMesh.name="bounding",h.models=createModels(),h.models.push(new Model),h.lastModels=createModels(),h.lastWorks=createWorks([]),h.readyCallbacks=[],h.syncingState=!1,h.helperGroup=new THREE__namespace.Group,h.helperGroup.name="helper",h.helperGroup.matrixAutoUpdate=!1,h.scene.add(h.helperGroup),h.modelGroup=new THREE__namespace.Group,h.modelGroup.visible=!1,h.modelGroup.name="model",h.modelGroup.matrixAutoUpdate=!1,h.modelScene=new THREE__namespace.Scene,h.modelScene.add(h.modelGroup),h.modelScene.add(h.boundingMesh),h.modelScene.matrixAutoUpdate=!1,h.videoTexture=new THREE__namespace.VideoTexture(e.videoInstance||generateDefaultVideoElement()),initLights(h.scene),initLights(h.modelScene),h.state={mode:h.currentMode,workCode:h.pano.workCode,panoIndex:h.pano.panoIndex,longitude:h.camera.pose.longitude,latitude:h.camera.pose.latitude,fov:h.camera.pose.fov,offset:h.camera.pose.offset.clone(),distance:h.camera.pose.distance},h.stateSynced=!1,h._enablePostProcessing=!1,h._enableIOSEDR=!1,h._enableEDL=!1,h._enableHQ=!1,h.destroyed=!1,h.paused=!0,typeof window!="undefined"&&(e.play!==!1&&h.play(),h.stopAnimationLoop=AnimationFrameLoop.shared.add(function(M,w){for(var H=[],O=2;O<arguments.length;O++)H[O-2]=arguments[O];h.updateTime.apply(h,__spreadArray([M,w],H,!1))},!1,0,10));var E=function(){typeof document!="undefined"&&document.fullscreenElement===null&&h.currentMode==="VRPanorama"&&h.controller.emit("vr.requestExit",createEvent("vr.requestExit",{}))},b=function(){h.needsRender=!0,h.modelSceneNeedsRender=!0};if(typeof document!="undefined"&&document.addEventListener("fullscreenchange",E,!1),h.renderer&&h.renderer.domElement.addEventListener("webglcontextrestored",b,!1),h.removeEventListeners=function(){typeof document!="undefined"&&document.removeEventListener("fullscreenchange",E,!1),h.renderer&&h.renderer.domElement.removeEventListener("webglcontextrestored",b,!1)},h.plugins={},e.plugins&&e.plugins.length)for(var T=0,_=e.plugins;T<_.length;T++){var R=_[T];if(typeof R=="function")R(h);else if(Array.isArray(R)){var S=R[0],C=R[1],B=R[2];if(typeof S=="function"){var L=S(h,B);typeof C=="string"&&(h.plugins[C]?h.throwError(new Error("plugin name ".concat(C," is exists."))):h.plugins[C]=L)}}}return h.gpuPickingRenderTarget=new THREE__namespace.WebGLRenderTarget(1,1,{generateMipmaps:!1}),h.meshReplaceMaterialMap=new Map,h.meshOriginMaterialMap=new Map,initLegacyEvent(h),h.enableLayeringRendering=(g=e.enableLayeringRendering)!==null&&g!==void 0?g:!1,h}return Object.defineProperty(t,"version",{get:function(){return"6.4.1"},enumerable:!1,configurable:!0}),Object.defineProperty(t,"dracoPath",{get:function(){return draco.decoderPath},set:function(e){draco.setDecoderPath(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t,"ktx2Path",{get:function(){return ktx2.transcoderPath},set:function(e){ktx2.setTranscoderPath(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"panoIndex",{get:function(){return this.pano.panoIndex},enumerable:!1,configurable:!0}),t.prototype.getGPUPicking=function(e,r,o,s,u){var l=this;if(s===void 0&&(s=1),u===void 0&&(u=new THREE__namespace.Vector3(0,0,0)),!this.renderer)throw new Error("renderer is not initialized.");var c=this.models.getMaterial(),f=c.constantColor,d=c.colorStyle;this.models.setMaterial({colorStyle:"CONSTANT",constantColor:u}),this.scene.traverse(function(g){if(!(!(g instanceof THREE__namespace.Mesh)||g instanceof PBMMesh||g instanceof PBMSkinnedMesh)){var h=Object.keys(o).filter(function(m){return m===g.uuid})[0];if(h)if(l.meshOriginMaterialMap.set(h,g.material),l.meshReplaceMaterialMap.get(h))g.material=l.meshReplaceMaterialMap.get(h);else{var y=new THREE__namespace.ShaderMaterial({uniforms:{color:{value:o[h]}},vertexShader:`
2169
+ `},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,d=r.count;c<d;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 p=new THREE__namespace.InstancedInterleavedBuffer(s,2,1);return e.setAttribute("instanceDistanceStart",new THREE__namespace.InterleavedBufferAttribute(p,1,0)),e.setAttribute("instanceDistanceEnd",new THREE__namespace.InterleavedBufferAttribute(p,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,d=c.linewidth,p=l.attributes.instanceStart,v=l.attributes.instanceEnd,A=new THREE__namespace.Vector4,g=new THREE__namespace.Vector4,h=new THREE__namespace.Vector4,y=new THREE__namespace.Vector3,m=new THREE__namespace.Matrix4,E=new THREE__namespace.Line3,b=new THREE__namespace.Vector3;o.at(1,h),h.w=1,h.applyMatrix4(s.matrixWorldInverse),h.applyMatrix4(u),h.multiplyScalar(1/h.w),h.x*=f.x/2,h.y*=f.y/2,h.z=0,y.copy(h);var T=this.matrixWorld;m.multiplyMatrices(s.matrixWorldInverse,T);for(var _=0,R=p.count;_<R;_++){A.fromBufferAttribute(p,_),g.fromBufferAttribute(v,_),A.w=1,g.w=1,A.applyMatrix4(m),g.applyMatrix4(m),A.applyMatrix4(u),g.applyMatrix4(u),A.multiplyScalar(1/A.w),g.multiplyScalar(1/g.w);var S=A.z<-1&&g.z<-1,C=A.z>1&&g.z>1;if(!(S||C)){A.x*=f.x/2,A.y*=f.y/2,g.x*=f.x/2,g.y*=f.y/2,E.start.copy(A),E.start.z=0,E.end.copy(g),E.end.z=0;var B=E.closestPointToPointParameter(y,!0);E.at(B,b);var L=THREE__namespace.MathUtils.lerp(A.z,g.z,B),M=L>=-1&&L<=1,w=y.distanceTo(b)<d*.5;if(M&&w){E.start.fromBufferAttribute(p,_),E.end.fromBufferAttribute(v,_),E.start.applyMatrix4(T),E.end.applyMatrix4(T);var H=new THREE__namespace.Vector3,O=new THREE__namespace.Vector3;o.distanceSqToSegment(E.start,E.end,O,H),r.push({point:O,pointOnLine:H,distance:o.origin.distanceTo(O),object:this,faceIndex:_})}}}},t}(THREE__namespace.Mesh);Object.assign(LineSegments2.prototype,{isLineSegments2:!0});var Line2=function(n){__extends(t,n);function t(e,r){var o=n.call(this,e,r)||this;return o.type="Line2",o}return t}(LineSegments2);Object.assign(Line2.prototype,{isLine2:!0});var LineGeometry=function(n){__extends(t,n);function t(){var e=n.call(this)||this;return e.type="LineGeometry",e}return t.prototype.setPositions=function(e){for(var r=e.length-3,o=new Float32Array(2*r),s=0;s<r;s+=3)o[2*s]=e[s],o[2*s+1]=e[s+1],o[2*s+2]=e[s+2],o[2*s+3]=e[s+3],o[2*s+4]=e[s+4],o[2*s+5]=e[s+5];return n.prototype.setPositions.call(this,o),this},t.prototype.setColors=function(e){for(var r=e.length-3,o=new Float32Array(2*r),s=0;s<r;s+=3)o[2*s]=e[s],o[2*s+1]=e[s+1],o[2*s+2]=e[s+2],o[2*s+3]=e[s+3],o[2*s+4]=e[s+4],o[2*s+5]=e[s+5];return n.prototype.setColors.call(this,o),this},t.prototype.fromLine=function(e){var r=e.geometry;if(r instanceof THREE__namespace.Geometry){var o=new THREE__namespace.BufferGeometry().fromGeometry(r);this.setPositions(o.attributes.position.array)}else r instanceof THREE__namespace.BufferGeometry&&this.setPositions(r.attributes.position.array);return this},t.prototype.copy=function(){return this},t}(LineSegmentsGeometry);Object.assign(LineGeometry.prototype,{isLineGeometry:!0});var circleImageURL="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAAZiS0dEAAAAAAAA+UO7fwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sHDgwCEMBJZu0AAAAdaVRYdENvbW1lbnQAAAAAAENyZWF0ZWQgd2l0aCBHSU1QZC5lBwAABM5JREFUWMO1V0tPG2cUPZ4Hxh6DazIOrjFNqJs0FIMqWFgWQkatsmvVbtggKlSVRVf5AWz4AWz4AUSKEChll19QJYSXkECuhFxsHjEhxCYm+DWGMZ5HF72DJq4bAzFXurI0M/I5997v3u9cC65vTJVn2lX/xHINQOYSBLTLEuIuCWw4Z3IGAEvf6ASmVHjNzHCXBG4A0AjACsAOwEbO0nsFQBnAGYASAIl+ZRMR7SolMEdsByD09fV5R0ZGgg8ePPjW5/N1iqLYpuu6RZblciKR2I9Go69evnwZnZ+fjwI4IS8AKBIRzeQfJWCANwKwh0KhtrGxsYehUOin1tbW+zzP23ietzY2NnIAoGmaLsuyUiqVyvl8XtrY2NiamZn589mzZxsAUgCOAeQAnFI2tI+VxIjaAeDzoaGh7xYWFuZOTk6OZVk+12uYqqq6JEnn0Wg0OT4+/geAXwGEAdwDIFJQXC1wO4DWR48e/RCPxxclSSroVzRFUbSDg4P848ePFwH8DuAhkWih83TRQWxFOXgAwvDwcOfo6OhvXV1d39tsNtuVBwTDWBwOh1UUxVsMw1hXVlbSdCgNV43uYSvrHg6H24aHh38eHBz85TrgF9FYLHA4HLzH43FvbW2d7u/vG+dANp8FpqIlbd3d3V8Fg8EfBUFw4BONZVmL3+9vHhkZCQL4AoAHgJPK8G+yzC0XDofdoVAo5PP5vkadTBAEtr+/39ff3x8gAp/RPOEqx2qjx+NpvXv3bk9DQ0NDvQgwDIOWlhZrMBj8kgi0UJdxRgYMArzL5XJ7vd57qLPZ7Xamp6fnNgBXtQxcjFuHw+Hyer3t9SYgCAITCAScAJoBNNEY/08GOFVVrfVMv7kMNDntFD1vjIAPrlRN0xjckOm6biFQ3jwNPwDMZrOnqVTqfb3Bi8Wivru7W/VCYkwPlKOjo0IikXh7EwQikYgE4Nw0CfXKDCipVCoTj8df3QABbW1tLUc6oUgkFPMkVACUNjc337148eKvw8PDbJ2jP1taWkoCyNDVXDSECmNSK4qiKNLq6urW8+fPI/UicHx8rD59+jSVy+WOAKSJhKENwFItLtoxk8mwsixzHR0dHe3t7c5PAU+n09rs7OzJkydPYqVSaQfANoDXALIk31S2smU1TWMPDg7K5XKZ7+3t9TudTut1U7+wsFCcmJiIpdPpbQBxADsAknQWymYCOukBHYCuKApisdhpMpnURFEU79y503TVyKenpzOTk5M7e3t7MQKPV0Zv1gNm+awB0MvlshqLxfLb29uyJElWURSbXC4XXyvqxcXFs6mpqeTc3Nzu3t7e3wQcA7BPZ8Cov1pNlJplmQtAG8MwHV6v95tAINA5MDBwPxAIuLu6upr8fr/VAN3c3JQjkcjZ+vp6fnl5+d2bN29SuVzuNYAEpf01CdRChUL+X1VskHACuA3Ay3Fcu9vt7nA6nZ7m5uYWQRCaNE3jVVW15PP580KhIGUymWw2m00DOAJwSP4WwPtq4LX2Ao6USxNlQyS/RcQcdLGwlNIz6vEMAaZpNzCk2Pll94LK/cDYimxERiBwG10sxjgvEZBE0UpE6vxj+0Ct5bTaXthgEhRmja8QWNkkPGsuIpfdjpkK+cZUWTC0KredVmtD/gdlSl6EG4AMvQAAAABJRU5ErkJggg==",DEFAULT_COLOR=14467195,POINT_SIZE=8,DEFAULT_LINEWIDTH=2,DEFAULT_DASHSCALE=20,sharedCircleTexture=null,FiveLine=function(n){__extends(t,n);function t(e,r){e===void 0&&(e=new THREE__namespace.Vector3),r===void 0&&(r=new THREE__namespace.Vector3);var o=n.call(this)||this;o.type="FiveLine",o.needsRender=!0;var s=new LineGeometry,u=new LineMaterial({color:DEFAULT_COLOR,linewidth:DEFAULT_LINEWIDTH,dashScale:DEFAULT_DASHSCALE,dashed:!1});o.line=new Line2(s,u);var l=new THREE__namespace.BufferGeometry,c=new THREE__namespace.PointsMaterial({color:DEFAULT_COLOR,size:POINT_SIZE,map:sharedCircleTexture||(sharedCircleTexture=new THREE__namespace.TextureLoader().load(circleImageURL)),sizeAttenuation:!1,transparent:!0});return o.points=new THREE__namespace.Points(l,c),o.points.renderOrder=11,o.points.frustumCulled=!1,o.setPoints(e,r),o.add(o.line,o.points),o}return Object.defineProperty(t,"version",{get:function(){return"6.4.3"},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={Handedness:Object.freeze({NONE:"none",LEFT:"left",RIGHT:"right"}),ComponentState:Object.freeze({DEFAULT:"default",TOUCHED:"touched",PRESSED:"pressed"}),ComponentProperty:Object.freeze({BUTTON:"button",X_AXIS:"xAxis",Y_AXIS:"yAxis",STATE:"state"}),ComponentType:Object.freeze({TRIGGER:"trigger",SQUEEZE:"squeeze",TOUCHPAD:"touchpad",THUMBSTICK:"thumbstick",BUTTON:"button"}),ButtonTouchThreshold:.05,AxisTouchThreshold:.1,VisualResponseProperty:Object.freeze({TRANSFORM:"transform",VISIBILITY:"visibility"})};function fetchJsonFile(n){return __awaiter(this,void 0,void 0,function(){var t;return __generator(this,function(e){switch(e.label){case 0:return[4,fetch(n)];case 1:if(t=e.sent(),t.ok)return[2,t.json()];throw new Error(t.statusText)}})})}function fetchProfilesList(n){return __awaiter(this,void 0,void 0,function(){var t,e;return __generator(this,function(r){switch(r.label){case 0:if(!n)throw new Error("No basePath supplied");return t="profilesList.json",[4,fetchJsonFile("".concat(n,"/").concat(t))];case 1:return e=r.sent(),[2,e]}})})}function fetchProfile(n,t){return __awaiter(this,arguments,void 0,function(e,r,o,s){var u,l,c,f,d,p;return o===void 0&&(o=null),s===void 0&&(s=!0),__generator(this,function(v){switch(v.label){case 0:if(!e)throw new Error("No xrInputSource supplied");if(!r)throw new Error("No basePath supplied");return[4,fetchProfilesList(r)];case 1:if(u=v.sent(),e.profiles.some(function(A){var g=u[A];return g&&(l={profileId:A,profilePath:"".concat(r,"/").concat(g.path),deprecated:!!g.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=v.sent(),s){if(p=void 0,p=f.layouts[e.handedness],!p)throw new Error("No matching handedness, ".concat(e.handedness,", in profile ").concat(l.profileId));p.assetPath&&(d=l.profilePath.replace("profile.json",p.assetPath))}return[2,{profile:f,assetPath:d}]}})})}var defaultComponentValues={xAxis:0,yAxis:0,button:0,state:Constants.ComponentState.DEFAULT};function normalizeAxes(n,t){n===void 0&&(n=0),t===void 0&&(t=0);var e=n,r=t,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 d=f.valueNodeName,p=f.minNodeName,v=f.maxNodeName,A=f.valueNodeProperty;if(A===Constants.VisualResponseProperty.TRANSFORM){if(f.minNode=t.getObjectByName(p),f.maxNode=t.getObjectByName(v),!f.minNode){console.warn("Could not find ".concat(p," in the model"));return}if(!f.maxNode){console.warn("Could not find ".concat(v," in the model"));return}}f.valueNode=t.getObjectByName(d),f.valueNode||console.warn("Could not find ".concat(d," in the model"))})})}function addAssetSceneToControllerModel(n,t){findNodes(n.motionController,t),n.envMap&&t.traverse(function(e){e instanceof THREE__namespace.Mesh&&e.isMesh&&(e.material.envMap=n.envMap,e.material.needsUpdate=!0)}),n.add(t)}var XRControllerModelFactory=function(){function n(t){t===void 0&&(t=null),this.gltfLoader=t,this.path=DEFAULT_PROFILES_PATH,this._assetCache={}}return n.prototype.createControllerModel=function(t){var e=this,r=new XRControllerModel,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 d=e._assetCache[r.motionController.assetUrl];if(d)o=d.scene.clone(),addAssetSceneToControllerModel(r,o);else{if(!e.gltfLoader)throw new Error("GLTFLoader not set.");e.gltfLoader.load(r.motionController.assetUrl,function(p){e._assetCache[r.motionController.assetUrl]=p,o=p.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,ROTATE_Y_PI_MATRIX=new THREE__namespace.Matrix4().makeRotationAxis(new THREE__namespace.Vector3(0,1,0),Math.PI),PANO_TEXTURE_SCALE=new THREE__namespace.Vector3(-1,1,1),XRPanoramaController=function(n){__extends(t,n);function t(e){var r=n.call(this,e)||this;r.xrManager=new XRManager(r.renderer,r.renderer.getContext(),{onSessionStart:function(c){r.emit("xr.session.start",createEvent("xr.session.start",{session:c,machineType:r.xrManager.machineType}))},onSessionEnd:function(){r.emit("xr.session.end",createEvent("xr.session.end",{session:null,machineType:r.xrManager.machineType}))}}),r.xrControllerRay={left:new THREE__namespace.Raycaster,right:new THREE__namespace.Raycaster},r.xrControllerRay.left.params.Points={threshold:.1},r.xrControllerRay.right.params.Points={threshold:.1},r.gazeRay=null,r.pointerLines={left:new FiveLine,right:new FiveLine},r.pointerLines.left.visible=!1,r.pointerLines.right.visible=!0,r.pointerLines.left.setMaterial({color:new THREE__namespace.Vector3(1,1,1)}),r.pointerLines.left.points.material.depthTest=!1,r.pointerLines.right.setMaterial({color:new THREE__namespace.Vector3(1,1,1)}),r.pointerLines.right.points.material.depthTest=!1,r.controllerWrappers=[new THREE__namespace.Group,new THREE__namespace.Group];var 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(d){var p;return parseGltf(d.body,{resourcePath:c.slice(0,c.lastIndexOf("/")+1),search:(p=c.split("?")[1])!==null&&p!==void 0?p:"",fetcher:internalFetcher})}).then(function(d){return f(d)})}},(r.xrManager.machineType==="Oculus"||r.xrManager.machineType==="Pico")&&r.scene.add(r.pointerLines.left,r.pointerLines.right,r.controllerWrappers[0],r.controllerWrappers[1]),r.panoResources={},r.panoResources[r.locationMotion.keyframes[0].key=r.locationMotion.keyframes[1].key=createUuid()]={panoId:panoStringify(r.currentPano),leftPanoPicture:null,position:r.camera.pose.offset.clone(),effect:"fade",fixCameraTransform:new THREE__namespace.Matrix4},r.parallaxCameraMatrixs=[];var 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,d=(u=r.effect)!==null&&u!==void 0?u:"fade";this.userAction=o,this.stopMomentumMovement();var p=this.works.getResolvedObserver(e);if(!p)throw new Error("Invalid PanoIndex");var v=getImageSizeFromURL(p.images.up),A=this.imageOptions.size;typeof A=="undefined"&&p&&v&&(A=Number(v)),typeof A=="undefined"&&(A=2048);var g=this.imageOptions.transform,h=function(M,w){return mapPanoResource(applyImageURLOptions(M,g,w))},y=__assign({key:"pano.".concat(p.panoId)},pick(this.imageOptions,["format","size","quality"])),m=p.images,E=(c=(l=p.images.tiles)===null||l===void 0?void 0:l.filter(function(M){return M.size>A}))!==null&&c!==void 0?c:null,b="pano:"+jsonHash([m,y,g]);if(this.pendingTextureTask){if(this.pendingTextureTask.hash===b)return;var T=this.pendingTextureTask.panoId;(f=this.panoMeshes[T])===null||f===void 0||f.setProgress(0),this.emit("pano.texture.abort",createEvent("pano.texture.abort",{error:null,progress:0,meta:null,pano:p.pano}))}var _=this.models.getMaterial()||{},R=_.pano0,S=_.pano1,C;if((R==null?void 0:R.map.name)===b?C=R:(S==null?void 0:S.map.name)===b&&(C=S),C){var B={panoId:p.panoId,effect:d,leftPanoPicture:{zoom:1,map:C.map,luminanceMap:C.luminanceMap,matrix:new THREE__namespace.Matrix4().compose(p.position,p.quaternion,PANO_TEXTURE_SCALE)},position:p.position.clone(),fixCameraTransform:new THREE__namespace.Matrix4};this.doMoveToPano(p.pano,B,r);return}var L="move-to-pano-"+p.panoId;this.pending.add(L),this.pendingTextureTask={panoId:p.panoId,hash:b,onLoad:function(M){if(s.pending.delete(L),s.destroyed)M.body.dispose();else{M.body.name=b;var w={panoId:p.panoId,effect:d,leftPanoPicture:{zoom:1,map:M.body,luminanceMap:null,matrix:new THREE__namespace.Matrix4().compose(p.position,p.quaternion,PANO_TEXTURE_SCALE)},position:p.position.clone(),fixCameraTransform:new THREE__namespace.Matrix4};s.doMoveToPano(p.pano,w,r)}},onError:function(M){s.pending.delete(L);var w=__assign(__assign(__assign({},p.pano),{mode:s.mode}),clonePose(s.camera.pose));s.emit("pano.error",createEvent("pano.error",{error:M,userAction:s.userAction,options:r,prevPano:s.currentPano,progress:0,state:w})),s.emit("pano.cancel",createEvent("pano.cancel",{error:null,userAction:s.userAction,options:r,prevPano:s.currentPano,progress:0,state:w})),r.moveCancelCallback&&r.moveCancelCallback()}},Promise.all([this.tileLevelForFov&&E&&E.length?this.textureLoader.loadTiledCubeTexture(m,E,{tileMaxLevel:this.tiledCubeTextureLevel,imageURL:{transform:h,options:y},format:THREE__namespace.RGBAFormat,minFilter:THREE__namespace.LinearFilter,magFilter:THREE__namespace.LinearFilter,generateMipmaps:!1,viaAjax:!0,fetcher:getFetcher(p.work)},void 0,void 0,function(M){var w,H;s.emit("pano.texture.progress",createEvent("pano.texture.progress",{error:null,progress:M,meta:null,pano:p.pano})),((w=s.pendingTextureTask)===null||w===void 0?void 0:w.hash)===b&&((H=s.panoMeshes[p.panoId])===null||H===void 0||H.setProgress(M))},this.renderer):this.textureLoader.loadCubeTexture(m,{imageURL:{transform:h,options:y},format:THREE__namespace.RGBAFormat,fetcher:getFetcher(p.work)},void 0,void 0,function(M){var w,H;((w=s.pendingTextureTask)===null||w===void 0?void 0:w.hash)===b&&((H=s.panoMeshes[p.panoId])===null||H===void 0||H.setProgress(M)),s.emit("pano.texture.progress",createEvent("pano.texture.progress",{error:null,progress:M,meta:null,pano:p.pano}))},this.renderer)]).then(function(M){var w,H,O=M[0];((w=s.pendingTextureTask)===null||w===void 0?void 0:w.hash)===b?(s.pendingTextureTask.onLoad(O),(H=s.panoMeshes[p.panoId])===null||H===void 0||H.setProgress(0),delete s.pendingTextureTask,s.emit("pano.texture.success",createEvent("pano.texture.success",{error:null,progress:1,meta:O.meta,pano:p.pano}))):O.body.dispose()}).catch(function(M){var w,H;((w=s.pendingTextureTask)===null||w===void 0?void 0:w.hash)===b&&(s.pendingTextureTask.onError(M),(H=s.panoMeshes[p.panoId])===null||H===void 0||H.setProgress(0),delete s.pendingTextureTask,s.emit("pano.texture.error",createEvent("pano.texture.error",{error:M,progress:0,meta:null,pano:p.pano})),s.emit("error",M))}),this.emit("pano.texture.load",createEvent("pano.texture.load",{error:null,progress:0,meta:null,pano:p.pano}))},t.prototype.doMoveToPano=function(e,r,o){var s=this,u,l,c,f,d,p,v,A,g,h;o===void 0&&(o={});var y=now(),m=createUuid();this.panoResources[m]=r;var E=1,b,T,_;if(this.locationMotion.ended){var R=this.locationMotion.getKeyFrameSegment(y);R[0];var S=R[1],C=this.locationMotion.value,B=this.panoResourceFromLocationMotionKeyframe(S).position,L=r.position;b=Math.max(B.distanceTo(L),E),T=[{key:S.key,progress:0,value:__assign(__assign({},C),{count:0})},{key:m,progress:1,value:{distance:0,count:1}}],_=0}else{var M=this.locationMotion.getKeyFrameSegment(y),w=M[0],S=M[1],C=this.locationMotion.value,H=this.panoResourceFromLocationMotionKeyframe(w).position,B=this.panoResourceFromLocationMotionKeyframe(S).position,L=r.position,O=S.value.count-C.count,I=Math.max(H.distanceTo(B),E)*O,N=Math.max(B.distanceTo(L),E);b=I+N,T=[{key:w.key,progress:0,value:__assign({},C)},{key:S.key,progress:I/b,value:S.value},{key:m,progress:1,value:{count:S.value.count+1,distance:0}}];var k=this.locationMotionKeyframesLength(this.locationMotion.keyframes),U=this.locationMotionKeyframesLength(T);_=this.locationMotion.getProgressVelocity(y)*k/U}var D=r.effect==="instant"?0:this.calculateMovingDuration(o.duration,r.effect==="fly"?b:0),q={longitude:o.longitude,latitude:o.latitude,fov:o.fov},z=__assign(__assign({},e),{mode:this.mode,longitude:(u=q.longitude)!==null&&u!==void 0?u:this.camera.pose.longitude,latitude:(l=q.latitude)!==null&&l!==void 0?l:this.camera.pose.latitude,fov:(c=q.fov)!==null&&c!==void 0?c:this.camera.pose.fov,offset:r.position.clone(),distance:0}),Q=this.currentPano;if(this.emit("pano.moveTo",createEvent("pano.moveTo",{options:o,prevPano:Q,progress:0,state:z,userAction:this.userAction,error:null})),o.moveStartCallback&&o.moveStartCallback(z),this.videoTexture&&this.videoTexture.image instanceof HTMLVideoElement&&this.videoTexture.image.getAttribute("src")&&(this.videoTexture.image.pause(),this.videoTexture.image.removeAttribute("uuid"),this.videoTexture.image.removeAttribute("src"),this.videoTexture.image.oncanplay=noop$1,this.videoTexture.needsUpdate=!0),this.panoVideo.setMaterial(null),r.effect==="fly")this.cameraMotion.set(q,D).catch(noop$1);else{var G=coordinatesToVector({longitude:this.cameraMotion.value.longitude,latitude:this.cameraMotion.value.latitude}),X=coordinatesToVector({longitude:(f=q.longitude)!==null&&f!==void 0?f:this.cameraMotion.value.longitude,latitude:(d=q.latitude)!==null&&d!==void 0?d:this.cameraMotion.value.latitude}),$=new THREE__namespace.Object3D;$.lookAt(G);var W=new THREE__namespace.Matrix4().makeRotationFromQuaternion($.quaternion);$.lookAt(X);var oe=new THREE__namespace.Matrix4().makeRotationFromQuaternion($.quaternion),ae=new THREE__namespace.Matrix4().getInverse(W).premultiply(oe),re=this.cameraMotion.value.fov,j=(p=q.fov)!==null&&p!==void 0?p:this.cameraMotion.value.fov,se=1;r.effect==="zoomin"?se=1.5:r.effect==="zoomout"&&(se=.4);for(var ie=j*se,ue=0;ue<T.length-1;ue++){var fe=T[ue].key;if(fe){var ne=this.panoResources[fe];ne&&(ne.fixCameraTransform.copy(ae),ne.leftPanoPicture&&(ne.leftPanoPicture.zoom=Math.tan(re/2/180*Math.PI)/Math.tan(ie/2/180*Math.PI)))}}this.cameraMotion.setKeyframes([{progress:0,value:{longitude:this.cameraMotion.value.longitude,latitude:this.cameraMotion.value.latitude,fov:this.cameraMotion.value.fov}},{progress:0,value:{longitude:(v=q.longitude)!==null&&v!==void 0?v:this.cameraMotion.value.longitude,latitude:(A=q.latitude)!==null&&A!==void 0?A:this.cameraMotion.value.latitude,fov:ie}},{progress:1,value:{longitude:(g=q.longitude)!==null&&g!==void 0?g:this.cameraMotion.value.longitude,latitude:(h=q.latitude)!==null&&h!==void 0?h:this.cameraMotion.value.latitude,fov:j}}],D).catch(noop$1)}var Te=this.locationMotion.setKeyframes(T,D,_);Te.then(function(){for(var _e,ve,Me,Z=0,te=s.models;Z<te.length;Z++){var K=te[Z];K.show()}var ye=__assign(__assign({},e),{mode:s.mode,longitude:s.camera.pose.longitude,latitude:s.camera.pose.latitude,fov:s.camera.pose.fov,offset:s.camera.pose.offset.clone(),distance:0});s.emit("pano.arrived",createEvent("pano.arrived",{options:o,prevPano:Q,progress:1,state:ye,userAction:s.userAction,error:null})),o.moveEndCallback&&o.moveEndCallback(ye);var de=s.works.getResolvedObserver(s.currentPano);if(de&&de.video&&s.videoTexture&&s.videoTexture.image instanceof HTMLVideoElement){var xe=ROTATE_Y_PI_MATRIX.clone().multiply((Me=(ve=(_e=s.models.getMaterial())===null||_e===void 0?void 0:_e.pano1)===null||ve===void 0?void 0:ve.matrix)!==null&&Me!==void 0?Me:new THREE__namespace.Matrix4).multiply(de.video.matrix),Ae={map:s.videoTexture,size:de.video.size,matrix:xe,alpha:1},me=createUuid(),ce=s.videoTexture.image;ce.setAttribute("uuid",me),canplayVideo().then(function(he){he&&de.video&&ce.getAttribute("uuid")===me&&(ce.oncanplay=function(){ce.oncanplay=noop$1,ce.play()},ce.ontimeupdate=function(){ce.currentTime>.5&&(ce.ontimeupdate=noop$1,s.panoVideo.setMaterial(Ae))},ce.src=de.video.source)}).catch(function(){ce.removeAttribute("uuid")})}},function(){s.emit("pano.cancel",createEvent("pano.cancel",{options:o,prevPano:Q,progress:0,state:z,userAction:s.userAction,error:null})),o.moveCancelCallback&&o.moveCancelCallback()})},t.prototype.checkSelectedPano=function(e){var r=this,o,s,u,l;this.stopMomentumMovement();var c=this.camera.getDirection(new THREE__namespace.Vector3).setY(0),f=null,d=this.works.getResolvedObserver(this.currentPano);if(!d)return null;var p=d.accessibleIds.filter(function(X){var $=panoParse(X);if(panoEqual($,r.currentPano))return!1;var W=r.works.getResolvedObserver($);return!W||W.position.distanceTo(r.camera.position)>r.maxAccessibleDistance?!1:W.loadable||W.active}),v=this.models.intersectRaycaster(e)[0];if(v){var A=arrayMin(p,function(X){var $=r.works.getResolvedObserver(X);if(!$)return 1/0;var W=$.standingPosition.clone();return W.distanceTo(v.point)},!0),g=A[0],h=A[1];g&&h<this.panoTapTriggerRadius&&(f=(o=this.works.getResolvedObserver(g))!==null&&o!==void 0?o:null)}if(isNil(f)){var y=this.getForwardObserverOrNot(e);y&&(f=y)}for(var m=0,E=this.locationMotion.keyframes;m<E.length;m++){var b=E[m],T=this.panoResourceFromLocationMotionKeyframe(b);if(!(b.progress<this.locationMotion.progress)&&f&&T.panoId===f.panoId){f=null;break}}if(isNil(f))return this.locationMotion.ended===!0&&this.cameraBounce(),null;if(f&&!f.active){var _=f.panoId;this.panoMeshes[_]&&(this.panoMeshes[_].setDisabled(!1),this.panoMeshes[_].setLoading(!0))}var R={};if(f){for(var S=Math.PI/6,C=Math.PI/12,B=new THREE__namespace.Vector3(0,1,0),L=f.position.clone().setY(0).sub(d.position.clone().setY(0)).normalize(),M=L.clone().applyAxisAngle(B,S),w=L.clone().applyAxisAngle(B,-S),H=[],O=[],I=[],N=0,k=f.accessibleIds;N<k.length;N++){var g=k[N],U=panoParse(g);if(!(panoEqual(U,this.currentPano)||panoEqual(U,f.pano))){var D=this.works.getResolvedObserver(g);if(D){var q=D.position.clone().sub(f.position).setY(0);L.angleTo(q)<S?I.push(q):M.angleTo(q)<S?H.push(q):w.angleTo(q)<S&&O.push(q)}}}var z=I.length>0?I:__spreadArray(__spreadArray([],H,!0),O,!0),Q=z.slice().sort(function(X,$){return X.angleTo(L)-$.angleTo(L)})[0];Q&&Q.angleTo(c)>C&&(R.longitude=Math.atan2(-Q.x,-Q.z))}this.cameraMotion.value.latitude<-Math.PI/4&&(R.latitude=clamp$1(0,this.minLatitude,this.maxLatitude)),this.cameraMotion.value.fov<60&&(R.fov=this.defaultFov);var G={workCode:f.pano.workCode,panoIndex:f.pano.panoIndex,mode:this.mode,longitude:(s=R.longitude)!==null&&s!==void 0?s:this.camera.pose.longitude,latitude:(u=R.latitude)!==null&&u!==void 0?u:this.camera.pose.latitude,fov:(l=R.fov)!==null&&l!==void 0?l:this.camera.pose.fov,distance:0,offset:f?f.position.clone():new THREE__namespace.Vector3};return this.emit("pano.select",createEvent("pano.select",{prevPano:this.currentPano,state:G,userAction:!0,options:R,progress:0,error:null})),f&&f.active?(this.emit("pano.request",createEvent("pano.request",{userAction:!0,prevPano:this.currentPano,progress:0,state:G,options:R,error:null})),f.pano):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,d,p,v,A=[],g=2;g<arguments.length;g++)A[g-2]=arguments[g];this.userAction=!0;var h={},y={},m=this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[0]),E=this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[this.locationMotion.keyframes.length-1]),b=!1;if(this.cameraMotion.ended===!1&&(this.cameraMotion.update(e),y.longitude=this.cameraMotion.value.longitude,y.latitude=this.cameraMotion.value.latitude,y.fov=this.cameraMotion.value.fov),this.modelAlphaMotion.ended===!1&&(this.modelAlphaMotion.update(e),h.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 T=this.locationMotion.getKeyFrameSegment(e),_=T[0],R=T[1],S=this.panoResourceFromLocationMotionKeyframe(_),C=this.panoResourceFromLocationMotionKeyframe(R),B=new THREE__namespace.Vector3().copy(S.position),L=new THREE__namespace.Vector3().copy(C.position),M=this.locationMotion.value.count-R.value.count+1;h.progress=M,C.leftPanoPicture&&(M<1?S.leftPanoPicture&&(h.pano0=S.leftPanoPicture):h.pano0=C.leftPanoPicture,h.pano1=C.leftPanoPicture),C.effect==="montage"?h.transition="BLACK":C.effect==="spread"?h.transition="SPREAD":h.transition="FADE",(C.effect==="zoomin"||C.effect==="zoomout")&&(h.progress=Math.pow(M,3)),M<1&&C.effect!=="fly"&&(h.pano0&&S.leftPanoPicture&&(h.pano0={map:h.pano0.map,zoom:h.pano0.zoom,luminanceMap:h.pano0.luminanceMap,matrix:S.leftPanoPicture.matrix.clone().setPosition(C.position)}),B.copy(L),b=!0),y.distance=this.locationMotion.value.distance,y.offset=new THREE__namespace.Vector3(B.x+(L.x-B.x)*M,B.y+(L.y-B.y)*M,B.z+(L.z-B.z)*M);for(var w=[],H=[],O=0,I=this.locationMotion.keyframes;O<I.length;O++){var N=I[O],k=N.key,U=N.progress;k!==void 0&&(w.push(k),U>this.locationMotion.progress&&H.push(k))}for(var D=0,q=Object.keys(this.panoResources);D<q.length;D++){var z=q[D];if(!(H.indexOf(z)>=0)){var Q=this.panoResources[z];if(Q.leftPanoPicture){var G=Q.leftPanoPicture.map;if(G){if(G===((s=h.pano0)===null||s===void 0?void 0:s.map)||G===((u=h.pano1)===null||u===void 0?void 0:u.map))continue;G instanceof TileCubeTextureTarget&&G.cubeRenderTarget&&this.colorCubeRenderTargetPool.push(G.cubeRenderTarget),G.dispose(),Q.leftPanoPicture=null}}w.indexOf(z)>=0||delete this.panoResources[z]}}this.currentPano=panoParse(C.panoId),this.emit("pano.moving",createEvent("pano.moving",{userAction:this.userAction,prevPano:panoParse(m.panoId),state:__assign(__assign(__assign(__assign({},panoParse(E.panoId)),{mode:this.mode}),clonePose(this.camera.pose)),y),options:{},progress:this.locationMotion.progress,error:null}))}isEmptyObject(h)===!1&&(!((l=h.pano0)===null||l===void 0)&&l.map&&h.pano0.map instanceof TileCubeTextureTarget&&!h.pano0.map.cubeRenderTarget&&(h.pano0.map.cubeRenderTarget=this.colorCubeRenderTargetPool.pop()),!((c=h.pano1)===null||c===void 0)&&c.map&&h.pano1.map instanceof TileCubeTextureTarget&&!h.pano1.map.cubeRenderTarget&&(h.pano1.map.cubeRenderTarget=this.colorCubeRenderTargetPool.pop()),this.models.setMaterial(h)),isEmptyObject(y)===!1&&this.setCamera(y);var X=this.works.getResolvedObserver(this.currentPano),$=A[1];if(!$){console.error("xrFrame丢失,请重试");return}if(!this.xrManager.session){console.error("session丢失,请重试");return}var W=this.xrManager.referenceSpace;if(W){var oe=this.xrManager.cameraVR,ae=this.xrManager.cameraL,re=this.xrManager.cameraR,j=[ae,re],se=$.getViewerPose(W),ie=new THREE__namespace.Vector3(0,0,0);if(se){var ue;ue=this.xrManager.session.renderState.baseLayer;var fe=se.views;if(!ue){console.error("no layer found");return}this.renderer.setFramebuffer(ue.framebuffer);var ne=!1;fe.length!==oe.cameras.length&&(oe.cameras.length=0,ne=!0),this.parallaxCameraMatrixs=[];var Te=new THREE__namespace.Vector3,_e=new THREE__namespace.Vector3;new THREE__namespace.Matrix4().fromArray(fe[0].transform.matrix).decompose(Te,new THREE__namespace.Quaternion,new THREE__namespace.Vector3),new THREE__namespace.Matrix4().fromArray(fe[1].transform.matrix).decompose(_e,new THREE__namespace.Quaternion,new THREE__namespace.Vector3),_e.clone().sub(Te).normalize();var ve=new THREE__namespace.Vector3,Me=new THREE__namespace.Quaternion,Z=new THREE__namespace.Vector3;this.camera.matrix.decompose(ve,Me,Z);for(var te=0;te<fe.length;te++){var K=fe[te],ye=ue.getViewport(K),de=j[te];de.matrix.fromArray(K.transform.matrix);var xe=new THREE__namespace.Vector3,Ae=new THREE__namespace.Quaternion,me=new THREE__namespace.Vector3;de.matrix.decompose(xe,Ae,me),ie.copy(ve),de.position.copy(ve),de.quaternion.copy(Ae),de.scale.copy(me),de.updateMatrix(),de.projectionMatrix.fromArray(K.projectionMatrix),de.viewport.set(ye.x,ye.y,ye.width,ye.height),ne===!0&&oe.cameras.push(de)}if(this.xrManager.session&&this.xrManager.session.inputSources){for(var te=0;te<this.xrManager.session.inputSources.length;te++)if(this.xrManager.session.inputSources[te]&&this.xrManager.session.inputSources[te].targetRayMode==="transient-pointer"){var ce=$.getPose(this.xrManager.session.inputSources[te].targetRaySpace,W);if(ce){var he=new THREE__namespace.Vector3(0,0,-1).applyQuaternion(ce.transform.orientation),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,te=0;te<pe.length;te++){var Re=this.xrManager.controllers[te],we=pe[te];if(we){Re&&Re.update(we,$,W);var ee=this.xrManager.getController(te),Ue=new THREE__namespace.Vector3(0,1.2,0),be=ee.position.clone().add(ie).sub(Ue);we.handedness==="left"?this.xrControllerRay.left.set(be,new THREE__namespace.Vector3(0,0,-1).applyEuler(ee.rotation)):we.handedness==="right"&&this.xrControllerRay.right.set(be,new THREE__namespace.Vector3(0,0,-1).applyEuler(ee.rotation)),this.controllerWrappers[te].position.copy(new THREE__namespace.Vector3(0,0,0).add(ie).sub(Ue));var ge=this.models.intersectRaycaster(this.xrControllerRay.right);if(ge.length===0&&(ge=this.xrControllerRay.right.intersectObject(this.boundingMesh,!0).map(function(vt){var At;return __assign({floor:(At=X==null?void 0:X.floorIndex)!==null&&At!==void 0?At:0},vt)})),ge.length>=1&&ge[0].face)if(we.handedness==="right"){var ze=this.xrControllerRay.right.intersectObject(this.xrCustomObjectsScene,!0),Ne=ge[0].face.normal,Je=Ne.clone(),Ke=ge[0].point.clone();this.intersectMesh.position.copy(Ke);var De=Ke.clone().add(Je);if(this.intersectMesh.lookAt(De),Math.abs(Ne.y)>.99){var Ye=this.camera.position.clone().sub(Ke);this.intersectMesh.rotation.z=-Math.atan2(Ye.z,Ye.x)}this.intersectMesh.visible=!0,this.needsRender=!0,ze.length>0?(this.pointerLines.right.setPoints(be,ze[0].point),this.pointerLines.right.points.visible=!0,this.intersectMesh.visible=!1):(this.pointerLines.right.points.visible=!1,this.pointerLines.right.setPoints(be,ge[0].point));var Ve=ge[0],nt=createEvent("intersect.update",{raycaster:(f=this.xrControllerRay.right)!==null&&f!==void 0?f:null,intersection:Ve!=null?Ve:null,object:this.intersectMesh});if(this.emit("intersect.update",nt),nt.defaultPrevented){this.hideIntersectMesh();return}}else this.pointerLines.left.setPoints(be,ge[0].point)}}this.updateControllerHelper(pe,e,r)}if(this.camera.pose.distance>.1||b)for(var qe=0,Qe=Object.keys(this.panoMeshes);qe<Qe.length;qe++){var Ie=Qe[qe],Se=this.panoMeshes[Ie];Se.setOpacity(0),Se.setCurrent(!1),Se.updateTime&&Se.updateTime(e,r),Se.visible=!1}else if(X){var Be=arrayMin(X.visibleIds,function(Oe){var ut=o.works.getResolvedObserver(Oe);return ut?X.standingPosition.distanceTo(ut.standingPosition):1/0},!0),Le=Be[1];Le=clamp$1(Le,2.5,1/0);for(var ot=X.visibleIds.concat(panoStringify(this.currentPano)),$e=this.getForwardObserverOrNot(),tt=this.camera.getDirection(new THREE__namespace.Vector3),Xe=0,rt=Object.keys(this.panoMeshes);Xe<rt.length;Xe++){var Ie=rt[Xe],Se=this.panoMeshes[Ie],Ge=this.works.getResolvedObserver(Ie);if(ot.indexOf(Ie)===-1)Se.setCurrent(!1),Se.setOpacity(0);else if(!Ge)Se.setCurrent(!1),Se.setOpacity(0);else if(!Ge.loadable&&!Ge.active)Se.setCurrent(!1),Se.setOpacity(0);else{var st=Se.position.clone().setY(this.camera.position.y).distanceTo(this.camera.position);Se.setCurrent(!Se.loading&&Se.progress===0&&$e!==null&&$e.panoId===Ie),Se.setOpacity(st<.01?0:clamp$1(Le/st*1.2,.65,.98));var ct=this.camera.position.clone().setY(Se.position.y),he=new THREE__namespace.Vector3().copy(Se.position).sub(ct).normalize();if(Ie===panoStringify(this.currentPano)){var je=clamp$1((.5-ct.distanceTo(Se.position))/.5,0,1);he.multiplyScalar(1-je).add(tt.clone().multiplyScalar(je))}he.length()>0&&Se.quaternion.setFromEuler(new THREE__namespace.Euler(0,Math.atan2(he.x,he.z),0))}Se.updateTime&&Se.updateTime(e,r)}}var Fe=function(){return 4}(),We=function(){var Oe=new THREE__namespace.PerspectiveCamera;Oe.applyMatrix4(oe.matrix),Oe.position.set(0,0,0);var ut=o.works.getResolvedObserver(E.panoId),vt=ut!=null?ut:X;vt&&Oe.quaternion.premultiply(vt.quaternion.clone().inverse()),Oe.updateProjectionMatrix(),Oe.updateMatrixWorld(!0);var At=new THREE__namespace.Frustum().setFromProjectionMatrix(new THREE__namespace.Matrix4().multiplyMatrices(Oe.projectionMatrix,Oe.matrixWorldInverse));return At}();E.panoId===panoStringify(this.currentPano)&&((d=E.leftPanoPicture)===null||d===void 0?void 0:d.map)instanceof TileCubeTextureTarget&&(E.leftPanoPicture.map.maxRequest=this.tileMaxRequest,E.leftPanoPicture.map.update(We,Fe),E.leftPanoPicture.map.needsRender===!0&&(this.needsRender=!0,this.modelSceneNeedsRender=!0));{var at=this.tiling.object.visible;if(this.initAnimationed){var Pe=E.panoId,Ce=this.works.getResolvedObserver(Pe);Ce?isSimilarVector3(this.camera.position,Ce.position)&&this.locationMotion.ended?(this.tiling.object.visible=!0,this.tiling.panoId!==Pe&&this.tiling.cleanup(),this.tiling.panoId=Pe,this.tiling.setResource((v=(p=Ce.images)===null||p===void 0?void 0:p.tiles)!==null&&v!==void 0?v:[],this.enableIOSEDR&&Ce.images.luminance?Ce.images.luminance:null),this.tiling.setFetcher(getFetcher(Ce.work)),this.tiling.setRotation(Ce.quaternion),this.tiling.setPosition(Ce.position),this.tiling.maxRequest=this.tileMaxRequest,Fe>this.tiledCubeTextureLevel?this.tiling.update(We,Fe,e):this.tiling.update(We,0,e)):this.tiling.object.visible=!1:this.tiling.object.visible=!1}else this.tiling.object.visible=!1;at!==this.tiling.object.visible&&(this.tiling.object.needsRender=!0,this.modelSceneNeedsRender=!0)}this.panoVideo.object.position.copy(this.camera.position),this.panoVideo.updateTime(e)}}},t.prototype.render=function(){var e=this.xrManager.getCamera(this.camera);this.renderer.render(this.modelScene,e),this.renderer.autoClearColor=!1,this.renderer.autoClearDepth=!1,this.renderer.render(this.scene,e),this.renderer.autoClearColor=!0,this.renderer.autoClearDepth=!0},t.prototype.onPanGesture=function(){},t.prototype.onTapGesture=function(){},t.prototype.onPinchGesture=function(){},t.prototype.onMouseMove=function(){},t.prototype.onMouseOut=function(){},t.prototype.panoResourceFromLocationMotionKeyframe=function(e){return this.panoResources[e.key]},t.prototype.updateControllerHelper=function(e,r,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,d=e[c].gamepad;switch(f){case"left":d.axes&&(this.emitHandleEvent(d.axes[2]===-1,"LeftAxesLeft",r),this.emitHandleEvent(d.axes[2]===1,"LeftAxesRight",r),this.emitHandleEvent(d.axes[3]===-1,"LeftAxesUp",r),this.emitHandleEvent(d.axes[3]===1,"LeftAxesDown",r)),d!=null&&d.buttons&&(d.buttons[4]&&this.emitHandleEvent(d.buttons[4].pressed,"X",r),d.buttons[5]&&this.emitHandleEvent(d.buttons[5].pressed,"Y",r),d.buttons[0]&&this.emitHandleEvent(d.buttons[0].pressed,"LeftTrigger",r),d.buttons[1]&&this.emitHandleEvent(d.buttons[1].pressed,"LeftPinch",r));var p={raycaster:s,axes:{up:d.axes&&d.axes[3]<0?Math.abs(d.axes[3]):0,down:d.axes&&d.axes[3]<0?0:Math.abs(d.axes[3]),left:d.axes&&d.axes[2]<0?Math.abs(d.axes[2]):0,right:d.axes&&d.axes[2]<0?0:Math.abs(d.axes[2])},deltaTime:o};l.buttons.X=d.buttons&&d.buttons[4]?d.buttons[4].pressed:!1,l.buttons.Y=d.buttons&&d.buttons[5]?d==null?void 0:d.buttons[5].pressed:!1,l.buttons.LeftTrigger=d.buttons&&d.buttons[0]?d==null?void 0:d.buttons[0].pressed:!1,l.buttons.LeftPinch=d.buttons&&d.buttons[1]?d==null?void 0:d.buttons[1].pressed:!1,l.left=p;break;case"right":d.axes&&(this.emitHandleEvent(d.axes[2]===-1,"RightAxesLeft",r),this.emitHandleEvent(d.axes[2]===1,"RightAxesRight",r),this.emitHandleEvent(d.axes[3]===-1,"RightAxesUp",r),this.emitHandleEvent(d.axes[3]===1,"RightAxesDown",r)),d.buttons&&(d.buttons[4]&&this.emitHandleEvent(d.buttons[4].pressed,"A",r),d.buttons[5]&&this.emitHandleEvent(d.buttons[5].pressed,"B",r),d.buttons[0]&&this.emitHandleEvent(d.buttons[0].pressed,"RightTrigger",r),d.buttons[1]&&this.emitHandleEvent(d.buttons[1].pressed,"RightPinch",r));var v={raycaster:u,axes:{up:d.axes&&d.axes[3]<0?Math.abs(d.axes[3]):0,down:d.axes&&d.axes[3]<0?0:Math.abs(d.axes[3]),left:d.axes&&d.axes[2]<0?Math.abs(d.axes[2]):0,right:d.axes&&d.axes[2]<0?0:Math.abs(d.axes[2])},deltaTime:o};l.right=v,l.buttons.A=d.buttons&&d.buttons[4]?d==null?void 0:d.buttons[4].pressed:!1,l.buttons.B=d.buttons&&d.buttons[5]?d==null?void 0:d.buttons[5].pressed:!1,l.buttons.RightTrigger=d.buttons&&d.buttons[0]?d==null?void 0:d.buttons[0].pressed:!1,l.buttons.RightPinch=d.buttons&&d.buttons[1]?d==null?void 0:d.buttons[1].pressed:!1;break}}this.emit("xr.controller.update",createEvent("xr.controller.update",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],t.state)}),n.on("works.load",function(t){n.emit("load",t.input,t.works[0],t.state)}),n.on("works.ready",function(t){n.emit("loaded",t.input,t.works[0])}),n.on("state.change",function(t){n.emit("stateChange",t.state,t.userAction)}),n.on("currentState.change",function(t){n.emit("currentStateChange",t.state,t.userAction)}),n.on("state.set",function(t){n.emit("setState",t.state)}),n.on("state.synced",function(t){n.emit("stateSynced",t.state)}),n.on("model.request",function(t){n.emit("modelWillLoad",t.work.model)}),n.on("model.error",function(t){n.emit("modelLoadError",t.error,t.model)}),n.on("model.load",function(t){n.emit("modelLoaded",t.model)}),n.on("model.changeShownFloor",function(t){n.emit("modelShownFloorChange",t.model.shownFloor,t.model.floorLength)}),n.on("render",function(t){n.emit("renderFrame",t.needsRender)}),n.on("mode.change.request",function(t){n.emit("wantsChangeMode",t.mode,t.prevMode)}),n.on("mode.change",function(t){n.emit("modeChange",t.mode,t.prevMode,t.state.panoIndex,t.state,t.userAction)}),n.on("helpers.visible",function(t){n.emit("helpersVisibleChange",t.object.visible)}),n.on("network.resource",function(t){n.emit("network",t.source,t.requestType,t.requestState,t.detail)})}function generateDefaultVideoElement(){if(typeof window!="undefined"){var n=document.createElement("video");n.loop=!0,n.autoplay=!0,n.playsInline=!0,n.muted=!0,n.crossOrigin="";var t=function(){document.removeEventListener("touchstart",t,!1),document.removeEventListener("mousedown",t,!1),n.muted=!1};return document.addEventListener("touchstart",t,!1),document.addEventListener("mousedown",t,!1),n}else return{}}function initLights(n){var t=new THREE__namespace.Group;t.name="internalLights";{var e=new THREE__namespace.DirectionalLight(16777215,.3);e.position.copy(new THREE__namespace.Vector3(1,1,1)),t.add(e)}{var e=new THREE__namespace.DirectionalLight(16777215,.1);e.position.copy(new THREE__namespace.Vector3(-1,-1,-1)),t.add(e)}{var e=new THREE__namespace.DirectionalLight(16777215,.1);t.add(e)}{var e=new THREE__namespace.AmbientLight(16777215,.6);t.add(e)}n.add(t)}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(),d=(e=c[1])===null||e===void 0?void 0:e.trim();f&&d&&(r[f]=d)}return r}function getViewportScale(){var n;if(typeof document!="undefined")for(var t=document.getElementsByTagName("meta"),e=0;e<t.length;e++){var r=t[e];if(r.getAttribute("name")==="viewport"){var o=parseKeyValue((n=r.getAttribute("content"))!==null&&n!==void 0?n:""),s=Number(o["initial-scale"]);if(!isNaN(s))return s}}return 1}const textureURL="data:image/png;base64,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";var imageSize=[351,63],imageOffset=[20,20],vertices=new Float32Array([-.5,-.5,0,.5,-.5,0,-.5,.5,0,.5,.5,0]),uvs=new Float32Array([0,0,1,0,0,1,1,1]),index=new Uint8Array([0,1,2,1,3,2]),geometry=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,d=imageSize[1]/3;n.setViewport(l,c,f,d),n.setScissor(l,c,f,d),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$1},e.src=textureURL,material.map=t}}var DEFAULT_MODE_CHANGE_DURATION=800,DEFAULT_CAMERA_FOV=90,DEFAULT_REQUEST_PROXY=function(n){return n.replace("//vrlab-public.ljcdn.com/","//vr-public.realsee-cdn.cn/").replace("//vrlab-image4.ljcdn.com/","//vr-image-4.realsee-cdn.cn/").replace("//vrlab-image3.ljcdn.com/","//vr-image-3.realsee-cdn.cn/").replace("//vrlab-image2.ljcdn.com/","//vr-image-2.realsee-cdn.cn/").replace("//vrlab-image1.ljcdn.com/","//vr-image-1.realsee-cdn.cn/")},sharedVector2=new THREE__namespace.Vector2,sharedSphere=new THREE__namespace.Sphere,sharedFrustum=new THREE__namespace.Frustum,sharedProjScreenMatrix=new THREE__namespace.Matrix4,clockForMixer=new WeakMap,worksMap=new WeakMap,emptyWorks=createWorks([]);new Scene;var Five=function(n){__extends(t,n);function t(e){e===void 0&&(e={});var r,o,s,u,l,c,f,d,p,v,A,g,h=n.call(this)||this;if(h.ident=createUuid(),typeof window!="undefined"&&(__FIVE_DEBUG__.instances[h.ident]=h),h.renderSwitch01=0,h.currentMode="Panorama",h.pano={workCode:"",panoIndex:0},h.needsRender=!1,h.modelSceneNeedsRender=!1,h.onlyRenderIfNeeds=(r=e.onlyRenderIfNeeds)!==null&&r!==void 0?r:!0,h.imageOptions=__assign({},(o=e.imageOptions)!==null&&o!==void 0?o:{}),h.textureOptions=__assign({},(s=e.textureOptions)!==null&&s!==void 0?s:{}),h.poweredByRealsee=(u=e.poweredByRealsee)!==null&&u!==void 0?u:!0,h.extraElements=[],h.controllerInits={Panorama:Object.assign({},e.panorama),Model:Object.assign({},e.model),Floorplan:Object.assign({},e.floorplan),Topview:Object.assign({},e.topview),Mapview:Object.assign({},e.mapview),VRPanorama:Object.assign({},e.vrPanorama),XRPanorama:Object.assign({},e.xrPanorama)},h.fps={testCount:0,testTime:now()},h.info=null,h.modeChangeDuration=(l=e.modeChangeDuration)!==null&&l!==void 0?l:DEFAULT_MODE_CHANGE_DURATION,h.enableWheel=(c=e.enableWheel)!==null&&c!==void 0?c:!0,typeof window!="undefined")if("renderer"in e)e.renderer instanceof InternalWebGLRenderer&&h.throwError(new Error("cannot render a internal renderer")),h.renderer=e.renderer;else try{h.renderer=new InternalWebGLRenderer({preserveDrawingBuffer:e.preserveDrawingBuffer,backgroundColor:e.backgroundColor,backgroundAlpha:e.backgroundAlpha,antialias:e.antialias,webgl2:e.webgl2,logarithmicDepthBuffer:e.logarithmicDepthBuffer,precision:e.precision,powerPreference:e.powerPreference});var y=getViewportScale();h.renderer.setPixelRatio(y===1?window.devicePixelRatio:1),h.renderer.setSize(512,512)}catch(M){M instanceof Error&&h.throwError(M)}h.getPixelsRenderTarget=new THREE__namespace.WebGLRenderTarget(1,1,{encoding:(d=(f=h.renderer)===null||f===void 0?void 0:f.outputEncoding)!==null&&d!==void 0?d:THREE__namespace.sRGBEncoding,generateMipmaps:!1});var m=new THREE__namespace.DepthTexture(1,1);m.generateMipmaps=!1,m.format=THREE__namespace.DepthStencilFormat,m.type=THREE__namespace.UnsignedInt248Type,h.modelRenderTarget=new THREE__namespace.WebGLRenderTarget(1,1,{encoding:(v=(p=h.renderer)===null||p===void 0?void 0:p.outputEncoding)!==null&&v!==void 0?v:THREE__namespace.sRGBEncoding,depthTexture:m,generateMipmaps:!1,depthBuffer:!0,stencilBuffer:!0}),h.scissor=Object.assign({left:0,bottom:0,width:1,height:1},e.scissor),h.camera=new Camera(DEFAULT_CAMERA_FOV),h.scene=new Scene,h.xrCustomObjectsScene=new THREE__namespace.Scene,h.scene.add(h.xrCustomObjectsScene),h.scene.matrixAutoUpdate=!1,h.lastLoadWorkTask=Promise.resolve(),h.requestProxy=(A=e.requestProxy)!==null&&A!==void 0?A:DEFAULT_REQUEST_PROXY,h.networkSubscribe=new NetworkSubscribe,h.networkSubscribe.on("network",function(M,w,H,O){var I;h.emit("network.resource",createEvent("network.resource",{source:M,requestType:w,requestState:H,detail:O})),(I=h.analysis)===null||I===void 0||I.network(h.works,M,w,H,O)}),h.boundingMesh=generateBoundingMesh(new THREE__namespace.Box3(new THREE__namespace.Vector3(-.5,-.5,-.5),new THREE__namespace.Vector3(.5,.5,.5))),h.boundingMesh.name="bounding",h.models=createModels(),h.models.push(new Model),h.lastModels=createModels(),h.lastWorks=createWorks([]),h.readyCallbacks=[],h.syncingState=!1,h.helperGroup=new THREE__namespace.Group,h.helperGroup.name="helper",h.helperGroup.matrixAutoUpdate=!1,h.scene.add(h.helperGroup),h.modelGroup=new THREE__namespace.Group,h.modelGroup.visible=!1,h.modelGroup.name="model",h.modelGroup.matrixAutoUpdate=!1,h.modelScene=new THREE__namespace.Scene,h.modelScene.add(h.modelGroup),h.modelScene.add(h.boundingMesh),h.modelScene.matrixAutoUpdate=!1,h.videoTexture=new THREE__namespace.VideoTexture(e.videoInstance||generateDefaultVideoElement()),initLights(h.scene),initLights(h.modelScene),h.state={mode:h.currentMode,workCode:h.pano.workCode,panoIndex:h.pano.panoIndex,longitude:h.camera.pose.longitude,latitude:h.camera.pose.latitude,fov:h.camera.pose.fov,offset:h.camera.pose.offset.clone(),distance:h.camera.pose.distance},h.stateSynced=!1,h._enablePostProcessing=!1,h._enableIOSEDR=!1,h._enableEDL=!1,h._enableHQ=!1,h.destroyed=!1,h.paused=!0,typeof window!="undefined"&&(e.play!==!1&&h.play(),h.stopAnimationLoop=AnimationFrameLoop.shared.add(function(M,w){for(var H=[],O=2;O<arguments.length;O++)H[O-2]=arguments[O];h.updateTime.apply(h,__spreadArray([M,w],H,!1))},!1,0,10));var E=function(){typeof document!="undefined"&&document.fullscreenElement===null&&h.currentMode==="VRPanorama"&&h.controller.emit("vr.requestExit",createEvent("vr.requestExit",{}))},b=function(){h.needsRender=!0,h.modelSceneNeedsRender=!0};if(typeof document!="undefined"&&document.addEventListener("fullscreenchange",E,!1),h.renderer&&h.renderer.domElement.addEventListener("webglcontextrestored",b,!1),h.removeEventListeners=function(){typeof document!="undefined"&&document.removeEventListener("fullscreenchange",E,!1),h.renderer&&h.renderer.domElement.removeEventListener("webglcontextrestored",b,!1)},h.plugins={},e.plugins&&e.plugins.length)for(var T=0,_=e.plugins;T<_.length;T++){var R=_[T];if(typeof R=="function")R(h);else if(Array.isArray(R)){var S=R[0],C=R[1],B=R[2];if(typeof S=="function"){var L=S(h,B);typeof C=="string"&&(h.plugins[C]?h.throwError(new Error("plugin name ".concat(C," is exists."))):h.plugins[C]=L)}}}return h.gpuPickingRenderTarget=new THREE__namespace.WebGLRenderTarget(1,1,{generateMipmaps:!1}),h.meshReplaceMaterialMap=new Map,h.meshOriginMaterialMap=new Map,initLegacyEvent(h),h.enableLayeringRendering=(g=e.enableLayeringRendering)!==null&&g!==void 0?g:!1,h}return Object.defineProperty(t,"version",{get:function(){return"6.4.3"},enumerable:!1,configurable:!0}),Object.defineProperty(t,"dracoPath",{get:function(){return draco.decoderPath},set:function(e){draco.setDecoderPath(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t,"ktx2Path",{get:function(){return ktx2.transcoderPath},set:function(e){ktx2.setTranscoderPath(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"panoIndex",{get:function(){return this.pano.panoIndex},enumerable:!1,configurable:!0}),t.prototype.getGPUPicking=function(e,r,o,s,u){var l=this;if(s===void 0&&(s=1),u===void 0&&(u=new THREE__namespace.Vector3(0,0,0)),!this.renderer)throw new Error("renderer is not initialized.");var c=this.models.getMaterial(),f=c.constantColor,d=c.colorStyle;this.models.setMaterial({colorStyle:"CONSTANT",constantColor:u}),this.scene.traverse(function(g){if(!(!(g instanceof THREE__namespace.Mesh)||g instanceof PBMMesh||g instanceof PBMSkinnedMesh)){var h=Object.keys(o).filter(function(m){return m===g.uuid})[0];if(h)if(l.meshOriginMaterialMap.set(h,g.material),l.meshReplaceMaterialMap.get(h))g.material=l.meshReplaceMaterialMap.get(h);else{var y=new THREE__namespace.ShaderMaterial({uniforms:{color:{value:o[h]}},vertexShader:`
2170
2170
  void main() {
2171
2171
  vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );
2172
2172
  gl_Position = projectionMatrix * mvPosition;