From c910fb2a7e462f08e614925422fab906b65e862f Mon Sep 17 00:00:00 2001 From: Bruno Fanini Date: Sun, 17 Nov 2024 20:15:26 +0100 Subject: [PATCH] naming; UI sample --- public/dist/ATON.min.js | 2 +- public/examples/ui-basic/index.html | 8 +++++--- public/res/css/main.css | 6 ++++++ public/src/ATON.ui.js | 26 ++++++++++++++++---------- 4 files changed, 28 insertions(+), 14 deletions(-) diff --git a/public/dist/ATON.min.js b/public/dist/ATON.min.js index 6a5dfdbb..02bab486 100644 --- a/public/dist/ATON.min.js +++ b/public/dist/ATON.min.js @@ -1,2 +1,2 @@ /*! For license information please see ATON.min.js.LICENSE.txt */ -(()=>{"use strict";class e extends THREE.Group{constructor(e,t){super(),this.type=t||ATON.NTYPES.SCENE,this.enablePicking(),this.type===ATON.NTYPES.SCENE&&(this._rootG=ATON._rootVisible,this._nodes=ATON.snodes),this.type===ATON.NTYPES.SEM&&(this._rootG=ATON._rootSem,this._nodes=ATON.semnodes),this.type===ATON.NTYPES.UI&&(this._rootG=ATON._rootUI,this._nodes=ATON.uinodes),this.as(e),this.kwords=void 0,this._bCloneOnLoadHit=!0,this._tlist=void 0,this._aniMixers=void 0,this.castShadow=!1,this.receiveShadow=!1,this._bs=new THREE.Sphere,this.autocenter=!1,this.onHover=void 0,this.onLeave=void 0,this.onSelect=void 0}as(e){if(void 0!==e&&e!==ATON.ROOT_NID)return this._nodes[e]=this,this.nid=e,this.name=e,this}setAsRoot(){return this._nodes[ATON.ROOT_NID]=this,this.nid=ATON.ROOT_NID,this}setCloneOnLoadHit(e){return this._bCloneOnLoadHit=e,this}addKeywords(e){let t=e.split(",");void 0===this.kwords&&(this.kwords={});for(let e in t){let o=t[e].trim();o.length>0&&(this.kwords[o]=!0)}for(let t in this.children){let o=this.children[t];void 0!==o.type&&o.addKeywords(e)}return this}hasKeyword(e){if(void 0!==this.kwords)return void 0!==this.kwords[e]}setDescription(e){return this.userData.description=e,this}getDescription(){return this.userData.description}setAudio(e){return this.userData.audio=e,this}getAudio(){return this.userData.audio}hide(){return this.visible=!1,ATON.Utils.setPicking(this,this.type,!1),ATON._renderer.shadowMap.enabled&&(ATON._dMainL.shadow.needsUpdate=!0),this}show(){return this.visible=!0,ATON.Utils.setPicking(this,this.type,this.bPickable),ATON._renderer.shadowMap.enabled&&void 0!==ATON._dMainL&&void 0!==ATON._dMainL.shadow&&(ATON._dMainL.shadow.needsUpdate=!0),this}toggle(e){return void 0===e?this.visible?this.hide():this.show():e?this.show():this.hide()}disablePicking(){return this.bPickable=!1,ATON.Utils.setPicking(this,this.type,this.bPickable),this}enablePicking(){return this.bPickable=!0,ATON.Utils.setPicking(this,this.type,this.bPickable),this}setPickable(e){return e?this.enablePicking():this.disablePicking(),this}setMaterial(e){this.userData.cMat=e,this.traverse((t=>{t.isMesh&&(t.material=e),t.type&&(this.userData.cMat=e)}));for(let t in this.children){let o=this.children[t];o.setMaterial&&o.setMaterial(e)}return this}getMaterial(){return this.userData.cMat}setDefaultAndHighlightMaterials(e,t){return this.userData.matSTD=e,this.userData.matHL=t,this}highlight(){return this.userData.matHL&&this.setMaterial(this.userData.matHL),this}restoreDefaultMaterial(){return this.userData.matSTD&&this.setMaterial(this.userData.matSTD),this}setOpacity(e){return this.traverse((t=>{t.isMesh&&(t.material.opacity=e)})),this}setShadowCast(e){return this.castShadow=e,this.traverse((t=>{t.isMesh&&(t.castShadow=e)})),this}setShadowReceive(e){return this.receiveShadow=e,this.traverse((t=>{t.isMesh&&(t.receiveShadow=e)})),this}setEnvMap(e){return this.traverse((t=>{t.isMesh&&(t.material.envMap=e)})),this}assignLightProbe(e){return this.traverse((t=>{t.isMesh&&t.geometry&&ATON.Utils.assignLightProbeToMesh(e,t)})),this}assignLightProbesByProximity(){return 0===ATON._lps.length||this.traverse((e=>{if(e.isMesh&&e.geometry){let t,o,i=new THREE.Vector3;(new THREE.Box3).setFromObject(e).getCenter(i);for(let e in ATON._lps){let r=ATON._lps[e],a=i.distanceToSquared(r.pos);(void 0===t||a{e.isMesh&&e.geometry&&(ATON.Utils.clearLightProbeFromMesh(e),e.material&&(e.material.envMap.dispose(),e.material.needsUpdate=!0))})),this}updateLightProbes=()=>(this.traverse((e=>{if(e.isMesh&&e.geometry){let t=e.userData.LP;void 0!==t&&(t.update(),e.material.envMap=t.getEnvTex(),e.material.needsUpdate=!0)}})),this);duplicate(){let e=this.clone();return e.traverse((e=>{e.isMesh&&(e.material=e.material.clone())})),e}delete(){let e=this.parent;void 0!==e&&void 0!==e.nid&&e.removeChild(this)}removeChild(e){if(void 0!==e)return e.nid,void 0!==e.nid&&(this._nodes[e.nid]=void 0),e.parent=void 0,e.traverse((e=>{e.geometry&&e.geometry.dispose(),e.material&&e.material.dispose()})),this.remove(e),this}removeChildren(){for(let e=this.children.length-1;e>=0;e--)this.removeChild(this.children[e]);return this}attachTo(e){let t="string"==typeof e?this._nodes[e]:e;return t&&(t.add(this),void 0!==t.userData.cMat&&(this.userData.cMat=t.userData.cMat),void 0!==t.bPickable&&(this.bPickable=t.bPickable)),t}attachToRoot(){return this._rootG.add(this),void 0!==this._rootG.userData.cMat&&(this.userData.cMat=this._rootG.userData.cMat),void 0!==this._rootG.bPickable&&(this.bPickable=this._rootG.bPickable),this._rootG}getBound(){return this.dirtyBound(),this._bs}dirtyBound(){return(new THREE.Box3).setFromObject(this).getBoundingSphere(this._bs),this}autoFit(e,t){if(this.dirtyBound(),e&&(this.position.copy(this._bs.center),this.position.multiplyScalar(-1)),t&&t>0&&this._bs.radius>0){let e=t/this._bs.radius;this.scale.set(e,e,e)}}setPosition(e,t,o){return e instanceof THREE.Vector3?this.position.copy(e):this.position.set(e,t,o),this}setScale(e,t,o){return e instanceof THREE.Vector3?this.scale.copy(e):(void 0===t&&(t=e,o=e),this.scale.set(e,t,o)),this}setRotation(e,t,o){return e instanceof THREE.Vector3?this.rotation.copy(e):this.rotation.set(e,t,o),this}orientToCamera(){return this.quaternion.copy(ATON.Nav._qOri),this}orientToLocation(e,t,o){return e instanceof THREE.Vector3?this.lookAt(e):this.lookAt(e,t,o),this}orientToNode(e){return e?(this.orientToLocation(e.position),this):this}setYup(){return this.rotation.set(-1.57079632679,0,0),this}addTransform(e){let t;return"string"==typeof e&&(t=ATON.Utils.parseTransformString(e)),void 0===t||(void 0===this._tlist&&(this._tlist=[]),this._tlist.push(t)),this}load(e,t){if(void 0===e)return this;let o=this;if(e=ATON.Utils.resolveCollectionURL(e),ATON.Utils.tryLoadFromService(e,o))return t&&t(),o;if("json"===ATON.Utils.getFileExtension(e))return ATON.MRes.loadTileSetFromURL(e,o),t&&t(),o;if(ATON._resHandler)for(let t in ATON._resHandler)if(ATON._resHandler[t](e,o))return o;if(o._bCloneOnLoadHit&&void 0!==ATON._assetsManager[e])return ATON._assetsManager[e].then((e=>{let i=e.clone();if(ATON.Utils.modelVisitor(o,i),void 0!==o._tlist)for(let e in o._tlist)o._tlist[e].add(i.clone()),o.add(o._tlist[e]);else o.add(i);t&&t()})),o;ATON._assetReqNew(e);let i=new Promise(((i,r)=>{ATON._aLoader.load(e,(r=>{let a=r.scene||r.scene[0];if(ATON.Utils.modelVisitor(o,a),void 0!==o._tlist)for(let e in o._tlist)o._tlist[e].add(a.clone()),o.add(o._tlist[e]);else o.add(a);ATON.Utils.registerAniMixers(o,r),ATON.CC.extract(r),i(a),console.log("%cModel loaded","color:green"),ATON._assetReqComplete(e),o.type===ATON.NTYPES.SCENE&&(ATON._bqScene=!0),o.type===ATON.NTYPES.SEM&&(ATON._bqSem=!0),o.bPickable&&o.enablePicking(),o.dirtyBound(),t&&t()}),void 0,(o=>{console.log("%cError loading model "+e,"color:red"),ATON._assetReqComplete(e),t&&t()}))}));return o._bCloneOnLoadHit&&(ATON._assetsManager[e]=i),this}exportAs(e){return ATON.Utils.exportNode(this,e),this}setOnHover(e){return this.onHover=e,this}setOnLeave(e){return this.onLeave=e,this}setOnSelect(e){return this.onSelect=e,this}loadCesiumIONAsset(e){return ATON.MRes.loadCesiumIONAsset(e,this),this}loadSketchfabAsset(e){let t=ATON.getAPIToken("sketchfab"),o=this;return null==t&&(console.log("A valid Sketchfab token is required"),t=prompt("Please enter a valid Sketchfab token:"),null==t||""==t)||fetch("https://api.sketchfab.com/v3/models/"+e+"/download",{method:"GET",headers:{Authorization:"Token "+t},mode:"cors"}).then((function(e){return e.json()})).then((function(e){if(ATON.setAPIToken("sketchfab",t),e.glb){let t=e.glb.url;return o.load(t),o}})),this}}const t=e;let o={init:()=>{o.evLocal={},o.evNetwork={},ATON.on=o.on,ATON.fireEvent=o.fireEvent,ATON.clearEventHandlers=o.clearEventHandlers},clearEventHandlers:e=>{o.evLocal[e]=[],o.evNetwork[e]=[]},executeHandlers:(e,t)=>{if(e)for(let o=0;o{if(void 0!==t){const i=o.evLocal;void 0===i[e]&&(i[e]=[]),i[e].push(t)}void 0!==i&&ATON.Photon.on(e,i)},fireEvent:(e,t,i)=>{const r=o.evLocal[e];o.executeHandlers(r,t),i&&ATON.Photon.fireEvent(e,t)}};const i=o;let r={init:()=>{r.materials={},r.colors={},r._loader=new THREE.MaterialLoader,r._uSem={time:{type:"float",value:0},tint:{type:"vec4",value:new THREE.Vector4(.2,.2,1,.2)}},r.addDefaults()},getDefVertexShader:()=>"\n varying vec3 vPositionW;\n varying vec3 vNormalW;\n varying vec3 vNormalV;\n varying vec2 vUv;\n\n void main(){\n vUv = uv;\n\n vPositionW = ( modelMatrix * vec4( position, 1.0 )).xyz;\n vNormalV = normalize( vec3( normalMatrix * normal ));\n vNormalW = ( modelMatrix * vec4(normal, 0.0 )).xyz;\n\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n }\n ",addDefaults:()=>{r.colors.white=new THREE.Color(1,1,1),r.colors.black=new THREE.Color(0,0,0),r.colors.green=new THREE.Color(0,1,0),r.colors.yellow=new THREE.Color(1,1,0),r.colors.red=new THREE.Color(1,0,0),r.colors.blue=new THREE.Color(0,0,1),r.colors.orange=new THREE.Color(1,.5,0),r.colors.defUI=new THREE.Color(.85,1,.95),r.colors.sem=new THREE.Color(0,1,.5),r.colors.darksem=new THREE.Color(0,0,.1),r.materials.fullyTransparent=new THREE.MeshBasicMaterial({transparent:!0,depthWrite:!1,opacity:0}),r.materials.defUI=new THREE.ShaderMaterial({uniforms:{tint:{type:"vec3",value:r.colors.defUI},opacity:{type:"float",value:0}},vertexShader:r.getDefVertexShader(),fragmentShader:"\n varying vec3 vPositionW;\n\t\t varying vec3 vNormalW;\n varying vec3 vNormalV;\n uniform vec3 tint;\n //uniform vec3 base;\n uniform float opacity;\n\n\t\t void main(){\n\t\t //vec3 viewDirectionW = normalize(cameraPosition - vPositionW);\n\n float f;\n\t\t //f = dot(vNormalV, viewDirectionW);\n f = dot(vNormalV, vec3(0,0,1));\n\t\t f = clamp(1.0-f, 0.0, 1.0);\n f *= f;\n\n f = mix(opacity, 1.0 + opacity, f);\n f = clamp(f, 0.0,1.0);\n\n //vec3 col = mix(base,tint, f);\n\t\t //gl_FragColor = vec4(col, f * opacity);\n\n gl_FragColor = vec4(tint, f);\n\t\t }\n ",transparent:!0,depthWrite:!1}),r.materials.selector=r.materials.defUI.clone(),r.materials.outline=new THREE.MeshBasicMaterial({color:r.colors.black,side:THREE.BackSide,transparent:!0,depthWrite:!1,opacity:.2}),r.materials.controllerRay=r.materials.defUI.clone(),r.materials.controllerRay.uniforms.tint.value=r.colors.white,r.materials.xray=r.materials.defUI.clone(),r.materials.xray.uniforms.tint.value=r.colors.white,r.materials.xray.uniforms.opacity.value=.5,r.materials.teleportLoc=new THREE.MeshBasicMaterial({transparent:!0,opacity:1,depthWrite:!1,side:THREE.DoubleSide}),ATON.Utils.textureLoader.load(ATON.PATH_RES+"grad.png",(e=>{r.materials.teleportLoc.map=e})),r.materials.measurement=new THREE.MeshBasicMaterial({color:r.colors.white,transparent:!0,depthWrite:!1,opacity:.5,depthTest:!1}),r.materials.semanticShape=new THREE.ShaderMaterial({uniforms:r._uSem,vertexShader:r.getDefVertexShader(),fragmentShader:"\n varying vec3 vPositionW;\n\t\t varying vec3 vNormalW;\n varying vec3 vNormalV;\n\n uniform float time;\n uniform vec4 tint;\n\n\t\t void main(){\n\t\t //vec3 viewDirectionW = normalize(cameraPosition - vPositionW);\n\n //float ff = dot(vNormalV, vec3(0,0,1));\n\t\t //ff = clamp(1.0-ff, 0.0, 1.0);\n\n float f = (1.0 * cos(time*2.0)); // - 0.5;\n //f = cos(time + (vPositionW.y*10.0));\n f = clamp(f, 0.0,1.0);\n\n\t\t gl_FragColor = vec4(tint.rgb, tint.a * f);\n //gl_FragColor = vec4(tint.rgb, ff);\n\t\t }\n ",transparent:!0,depthWrite:!1}),r.materials.semanticShapeHL=new THREE.MeshBasicMaterial({color:r.colors.sem,transparent:!0,depthWrite:!1,opacity:.2}),r.materials.semanticShapeEdit=new THREE.MeshBasicMaterial({color:r.colors.orange,transparent:!0,depthWrite:!1,opacity:.5}),r.materials.transWhite=new THREE.MeshBasicMaterial({color:r.colors.white,transparent:!0,depthWrite:!1,side:THREE.DoubleSide,opacity:.2}),r.materials.transBlack=new THREE.MeshBasicMaterial({color:r.colors.black,transparent:!0,depthWrite:!1,side:THREE.DoubleSide,opacity:.2}),r.materials.wireframe=new THREE.MeshBasicMaterial({color:r.colors.black,transparent:!0,depthWrite:!1,opacity:.1,wireframe:!0}),r.materials.normSlope=new THREE.ShaderMaterial({vertexShader:r.getDefVertexShader(),fragmentShader:"\n varying vec3 vPositionW;\n\t\t varying vec3 vNormalW;\n\n\t\t void main(){\n vec4 A = vec4(0,1,0, 1.0);\n vec4 B = vec4(1,0,0, 1.0);\n\n float f;\n f = dot(vNormalW, vec3(0,1,0));\n\n\t\t gl_FragColor = mix(B,A, f);\n\t\t }\n "}),r.materials.gradient=new THREE.ShaderMaterial({uniforms:{range:{type:"vec2",value:new THREE.Vector2(-4,5)}},vertexShader:r.getDefVertexShader(),fragmentShader:"\n varying vec3 vPositionW;\n\n uniform vec2 range;\n\n\t\t void main(){\n vec4 A = vec4(0,0,0, 1.0);\n vec4 B = vec4(0,0.5,1, 1.0);\n\n float t = (vPositionW.y - range.x)/(range.y - range.x);\n t = clamp(t, 0.0,1.0);\n\n\t\t gl_FragColor = mix(A,B, t);\n\t\t }\n "}),r.materials.lp=new THREE.ShaderMaterial({vertexShader:r.getDefVertexShader(),fragmentShader:"\n varying vec3 vPositionW;\n\t\t varying vec3 vNormalW;\n varying vec3 vNormalV;\n\n\t\t void main(){\n\t\t vec3 viewDirectionW = normalize(cameraPosition - vPositionW);\n\n float f;\n\t\t //f = dot(viewDirectionW, vNormalW);\n f = dot(vNormalV, vec3(0,0,1));\n\t\t f = clamp(1.0 - f, 0.0, 1.0);\n\n\t\t gl_FragColor = vec4(1.0,1.0,1.0, f);\n\t\t }\n ",transparent:!0,depthWrite:!1});let e=(new THREE.TextureLoader).load(ATON.PATH_RES+"point-mask.png");e.generateMipmaps=!1,r.materials.point=new THREE.PointsMaterial({vertexColors:!0,alphaMap:e,alphaTest:.5,depthTest:!0,transparent:!1,size:4,sizeAttenuation:!1}),r.materials.chromakey=new THREE.ShaderMaterial({uniforms:{tBase:{type:"t"},keycolor:{type:"vec4",value:new THREE.Vector4(0,1,0,0)},similarity:{type:"float",value:.4},smoothness:{type:"float",value:.08},spill:{type:"float",value:.1}},vertexShader:r.getDefVertexShader(),fragmentShader:"\n uniform sampler2D tBase;\n uniform vec4 keycolor;\n\n uniform float similarity;\n uniform float smoothness;\n uniform float spill;\n\n varying vec2 vUv;\n\n // From https://github.com/libretro/glsl-shaders/blob/master/nnedi3/shaders/rgb-to-yuv.glsl\n vec2 RGBtoUV(vec3 rgb){\n return vec2(\n rgb.r * -0.169 + rgb.g * -0.331 + rgb.b * 0.5 + 0.5,\n rgb.r * 0.5 + rgb.g * -0.419 + rgb.b * -0.081 + 0.5\n );\n }\n\n // From https://godotshaders.com/shader/green-screen-chromakey/\n\t\t void main(){\n\t\t vec4 frag = texture2D(tBase, vUv);\n vec4 orig = frag;\n\n float chromaDist = distance(RGBtoUV(frag.rgb), RGBtoUV(keycolor.rgb));\n\n float baseMask = chromaDist - similarity;\n float fullMask = pow(clamp(baseMask / smoothness, 0.0,1.0), 1.5);\n frag.a = fullMask;\n \n float spillVal = pow(clamp(baseMask / spill, 0.0,1.0), 1.5);\n float desat = clamp(frag.r * 0.2126 + frag.g * 0.7152 + frag.b * 0.0722, 0.0,1.0);\n frag.rgb = mix(vec3(desat, desat, desat), frag.rgb, spillVal);\n\n frag = mix(orig,frag, keycolor.w);\n\n\t\t gl_FragColor = frag;\n\t\t }\n ",transparent:!0,side:THREE.DoubleSide})},addMaterial:(e,t)=>{r.materials[e]?console.log("MatHub: material "+e+" already registered"):r.materials[e]=t},loadMaterial:(e,t)=>{r._loader.load(t,(t=>{r.addMaterial(e,t)}),void 0,(e=>{console.log(e)}))},getMaterial:e=>r.materials[e],update:()=>{r._uSem.time.value+=ATON._dt}};const a=r;let s={TSTRING_SEPARATOR:" ",VOID_CAST:(e,t)=>{},init:()=>{ATON.device={},s.geomUnitSphere=new THREE.SphereGeometry(1,32,32),s.geomUnitCube=new THREE.BoxGeometry,s.exporterGLTF=void 0,s.exporterOBJ=void 0,s.exporterUSDZ=void 0,s._dlink=document.createElement("a"),s._dlink.style.display="none",document.body.appendChild(s._dlink),s.textureLoader=new THREE.TextureLoader,s._bvhBounds=0,s.stats={},s.stats.numVertices=0,s.stats.numTris=0},generateID:e=>(void 0===e&&(e="id"),e+"-"+Math.random().toString(36).substr(2,9)),goToURL:e=>{window.location.href=e},goToScene:(e,t)=>{if(void 0===e)return;if(e.length<2)return;let o=ATON.PATH_FE+e;void 0!==t&&(o+="&vrc="+t),window.location.href=o},isConnectionSecure:()=>window.isSecureContext,isLocalhost:()=>!!window.location.origin.includes("localhost")||!!window.location.origin.includes("127.0.0.1"),showBVHbounds:e=>{e>0&&(s._bvhBounds=e)},_addBVHbounds:(e,t)=>{if(void 0===e)return;let o=new ThreeMeshBVH.MeshBVHHelper(e,t);o.displayParents=!0,o.update(),e.parent.add(o)},profileDevice:()=>{ATON.device.isMobile=!1,ATON.device.isMobile=!(!/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|ipad|iris|kindle|Android|Silk|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(navigator.userAgent)&&!/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(navigator.userAgent.substr(0,4))),ATON.device.xrSupported={},ATON.device.xrSupported["immersive-vr"]=!1,ATON.device.xrSupported["immersive-ar"]=!1,"xr"in navigator&&(navigator.xr.isSessionSupported("immersive-vr").then((e=>{ATON.device.xrSupported["immersive-vr"]=!!e,console.log("WebXR VR session support: "+ATON.device.xrSupported["immersive-vr"]),ATON.fireEvent("XR_support",{type:"immersive-vr",v:ATON.device.xrSupported["immersive-vr"]})})),navigator.xr.isSessionSupported("immersive-ar").then((e=>{ATON.device.xrSupported["immersive-ar"]=!!e,console.log("WebXR AR session support: "+ATON.device.xrSupported["immersive-ar"]),ATON.fireEvent("XR_support",{type:"immersive-ar",v:ATON.device.xrSupported["immersive-ar"]})})))},profileRenderingCapabilities:()=>{if(void 0===ATON._renderer)return;let e=ATON._renderer.capabilities;void 0!==e&&(ATON.device.lowGPU=!1,e.isWebGL2||(ATON.device.lowGPU=!0),e.maxTextureSize<8192&&(ATON.device.lowGPU=!0),e.maxCubemapSize<4096&&(ATON.device.lowGPU=!0),console.log(e))},isMobile:()=>ATON.device.isMobile,isVRsupported:()=>ATON.device.xrSupported["immersive-vr"],isARsupported:()=>ATON.device.xrSupported["immersive-ar"],getFileExtension:e=>e.substr(e.lastIndexOf(".")+1).toLowerCase(),removeFileExtension:e=>e.replace(/\.[^/.]+$/,""),isVideo:e=>{let t=s.getFileExtension(e);return"mp4"===t||"webm"===t||"m3u8"===t},getBaseFolder:e=>{var t=e.lastIndexOf("/");return-1!==t?e.substring(0,t+1):""},getFilename:e=>e.split(/(\\|\/)/g).pop(),isResourceURL:e=>!!e.startsWith("http://")||!!e.startsWith("https://"),URLify:e=>{if("string"!=typeof e)return e;const t=e.match(/(((ftp|https?):\/\/)[\-\w@:%_\+.~#?,&\/\/=]+)/g);return t&&t.forEach((function(t){e=e.replace(t,"")})),e},resolveCollectionURL:e=>e?(ATON._collMod&&(e=ATON._collMod(e)),e.startsWith("http")?e:ATON.PATH_COLLECTION+e):"",tryLoadFromService:(e,t)=>{if(!t)return!1;if(e.startsWith("https://cesium.com/ion/assets/")||e.startsWith("https://ion.cesium.com/assets/")){let o=e.split("/"),i=o[o.length-1];return t.loadCesiumIONAsset(i),!0}if(e.startsWith("https://assets.cesium.com/")){let o=e.split("/"),i=o[o.length-2];return t.loadCesiumIONAsset(i),!0}if(e.startsWith("https://sketchfab.com/3d-models/")){let o=e.split("-"),i=o[o.length-1];return t.loadSketchfabAsset(i),!0}for(let o in ATON._resMappers){let i=ATON._resMappers[o](e);if(void 0!==i)return t.load(i),!0}return!1},postJSON:(e,t,o,i)=>{$.ajax({url:e,type:"POST",xhrFields:{withCredentials:!0},data:JSON.stringify(t),contentType:"application/json; charset=utf-8",dataType:"json",success:e=>{o&&o(e)}}).fail((e=>{console.log(e),i&&i()}))},runAsync:e=>{const t=new Worker(URL.createObjectURL(new Blob([`postMessage((${e})());`]),{type:"application/javascript; charset=utf-8"}));return new Promise(((e,o)=>{t.onmessage=({data:o})=>{e(o),t.terminate()},t.onerror=e=>{o(e),t.terminate()}}))},mergeObject:e=>{e.updateMatrixWorld(!0);const t=[];e.traverse((e=>{if(e.isMesh){const o=e.geometry;o.applyMatrix4(e.matrixWorld),t.push(o.toNonIndexed())}}));const o=THREE.BufferGeometryUtils.mergeGeometries(t,!1),i=THREE.BufferGeometryUtils.mergeVertices(o).center(),r=new THREE.Group,a=new THREE.Mesh(i);return r.add(a),r},setPicking:(e,t,o)=>{void 0===o&&(o=!0),e.traverse((e=>{o?e.layers.enable(t):e.layers.disable(t)}))},graphPostVisitor:e=>{e.visible?console.log(e):s.setPicking(e,e.type,!1)},rotationBetweenDirections:(e,t)=>{const o=new THREE.Quaternion,i=(new THREE.Vector3).crossVectors(e,t);return o.x=i.x,o.y=i.y,o.z=i.z,o.w=1+e.clone().dot(t),o.normalize(),o},clampValue:(e,t,o)=>Math.min(Math.max(e,t),o),loadTexture:(e,t)=>{e.endsWith(".ktx2")?ATON._ktx2Loader.load(e,t):s.textureLoader.load(e,t)},modelVisitor:(e,t)=>{if(void 0===t)return;if(void 0===e)return;let o=e.type;t.traverse((t=>{t.isMesh&&(o===ATON.NTYPES.SCENE&&(t.castShadow=!0,t.receiveShadow=!0,t.geometry&&(t.geometry.computeBoundsTree(),console.log("Computed visible BVH"),s._bvhBounds>0&&s._addBVHbounds(t,s._bvhBounds)),s.processMaterial(t.material)),o===ATON.NTYPES.SEM&&(t.material=ATON.MatHub.materials.semanticShape,t.geometry&&(t.geometry.computeBoundsTree(),console.log("Computed semantic BVH"))),e.userData.cMat&&(t.material=e.userData.cMat))}))},processMaterial:e=>{void 0!==e&&null!==e.map&&void 0!==e.map&&(e.map.generateMipmaps=!0,e.map.anisotropy=ATON.device.isMobile?0:ATON._maxAnisotropy,e.map.minFilter=THREE.LinearMipmapLinearFilter,e.map.magFilter=THREE.LinearFilter,e.map.colorSpace=ATON._stdEncoding)},cleanupVisitor:e=>{e.traverse((e=>{if(e.material)if(e.material.length)for(let t=0;t{let o=t.scene||t.scene[0],i=!1;if(void 0===t.animations)return;let r=new THREE.AnimationMixer(o);t.animations.forEach((e=>{r.clipAction(e).play(),i=!0})),i&&(ATON._aniMixers.push(r),void 0===e._aniMixers&&(e._aniMixers=[]),e._aniMixers.push(r))},parseTransformString:e=>{let t=new THREE.Group,o=e.split(s.TSTRING_SEPARATOR),i=o.length;return i<3||(t.position.set(parseFloat(o[0]),parseFloat(o[1]),parseFloat(o[2])),i<6||(t.rotation.set(parseFloat(o[3]),parseFloat(o[4]),parseFloat(o[5])),i<9||t.scale.set(parseFloat(o[6]),parseFloat(o[7]),parseFloat(o[8])))),t},setVectorPrecision:(e,t)=>(e.x=parseFloat(e.x.toPrecision(t)),e.y=parseFloat(e.y.toPrecision(t)),e.z=parseFloat(e.z.toPrecision(t)),e),parseMD:e=>(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=e.replace(/^\s*\n\*/gm,"
    \n*")).replace(/^(\*.+)\s*\n([^\*])/gm,"$1\n
\n\n$2")).replace(/^\*(.+)/gm,"
  • $1
  • ")).replace(/^\s*\n\d\./gm,"
      \n1.")).replace(/^(\d\..+)\s*\n([^\d\.])/gm,"$1\n
    \n\n$2")).replace(/^\d\.(.+)/gm,"
  • $1
  • ")).replace(/^\>(.+)/gm,"
    $1
    ")).replace(/[\#]{6}(.+)/g,"
    $1
    ")).replace(/[\#]{5}(.+)/g,"
    $1
    ")).replace(/[\#]{4}(.+)/g,"

    $1

    ")).replace(/[\#]{3}(.+)/g,"

    $1

    ")).replace(/[\#]{2}(.+)/g,"

    $1

    ")).replace(/[\#]{1}(.+)/g,"

    $1

    ")).replace(/^(.+)\n\=+/gm,"

    $1

    ")).replace(/^(.+)\n\-+/gm,"

    $1

    ")).replace(/\!\[([^\]]+)\]\(([^\)]+)\)/g,'$1')).replace(/[\[]{1}([^\]]+)[\]]{1}[\(]{1}([^\)\"]+)(\"(.+)\")?[\)]{1}/g,'$1')).replace(/[\*\_]{2}([^\*\_]+)[\*\_]{2}/g,"$1")).replace(/[\*\_]{1}([^\*\_]+)[\*\_]{1}/g,"$1")).replace(/[\~]{2}([^\~]+)[\~]{2}/g,"$1")).replace(/^\s*\n\`\`\`(([^\s]+))?/gm,'
    ')).replace(/^\`\`\`\s*\n/gm,"
    \n\n")).replace(/[\`]{1}([^\`]+)[\`]{1}/g,"$1")).replace(/^\s*(\n)?(.+)/gm,(function(e){return/\<(\/)?(h\d|ul|ol|li|blockquote|pre|img)/.test(e)?e:"

    "+e+"

    "}))).replace(/(\)\s*\n\(.+)\<\/p\>/gm,"$1$2"),checkAuth:e=>{$.ajax({type:"GET",url:ATON.PATH_RESTAPI+"user",xhrFields:{withCredentials:!0},dataType:"json",success:t=>{e(t)}})},getHumanReadableDistance:e=>{let t=" m";return e<.01?(t=" mm",t=(e*=1e3).toPrecision(3)+t,t):e<1?(t=" cm",t=(e*=100).toPrecision(3)+t,t):e>1e3?(t=" km",t=e.toPrecision(3)+t,t):(t=e.toPrecision(3)+t,t)},stripHTMLtagsFromString:e=>e.replace(/(<([^>]+)>)/gi,""),requestFullscreen:()=>{let e=document.documentElement;return e.requestFullscreen?e.requestFullscreen():e.mozRequestFullScreen?e.mozRequestFullScreen():e.webkitRequestFullscreen?e.webkitRequestFullscreen():e.msRequestFullscreen&&e.msRequestFullscreen(),!0},downloadBlob:(e,t)=>{void 0!==t&&(s._dlink.href=URL.createObjectURL(e),s._dlink.download=t,s._dlink.click())},downloadText:(e,t)=>{s.downloadBlob(new Blob([e],{type:"text/plain"}),t)},downloadJSONobj:(e,t)=>{s.downloadText(JSON.stringify(e),t)},downloadArrayBuffer:(e,t)=>{s.downloadBlob(new Blob([e],{type:"application/octet-stream"}),t)},downloadImageFromCanvas:(e,t)=>{if(!e)return;let o=e.toDataURL();ATON.Utils._dlink.href=o,ATON.Utils._dlink.download=t,ATON.Utils._dlink.click()},exportNode:(e,t)=>{let o=s.getFileExtension(t);if(!(o.length<1)){if("glb"===o||"gltf"===o){let i={binary:"glb"===o};void 0===s.exporterGLTF&&(s.exporterGLTF=new THREE.GLTFExporter),s.exporterGLTF.parse(e,(e=>{e instanceof ArrayBuffer?s.downloadArrayBuffer(e,t):(console.log(e),s.downloadJSONobj(e,t))}),i)}if("obj"===o){void 0===s.exporterOBJ&&(s.exporterOBJ=new THREE.OBJExporter);let o=s.exporterOBJ.parse(e);s.downloadText(o,t)}"usdz"===o&&(void 0===s.exporterUSDZ&&(s.exporterUSDZ=new THREE.USDZExporter),$("#idLoader").show(),s.exporterUSDZ.parse(e).then((e=>{s.downloadArrayBuffer(e,t),$("#idLoader").hide()})))}},takeScreenshot:(e,t)=>{let o=new Image;console.log("Screenshot with size:"+e),ATON.Nav._camera.aspect=1,ATON.Nav._camera.updateProjectionMatrix(),ATON._renderer.setSize(e,e),ATON._renderer.render(ATON._mainRoot,ATON.Nav._camera);let i=ATON._renderer.domElement;if(ATON.FX.composer){if(ATON.FX.composer.setSize(e,e),ATON.FX.passes[ATON.FX.PASS_AA]){let t=ATON.FX.passes[ATON.FX.PASS_AA].material.uniforms;t&&t.resolution.value.set(1/e,1/e)}ATON.FX.composer.render(),i=ATON.FX.composer.renderer.domElement}let r=ATON._renderer.domElement.toDataURL();return o.src=r,t&&(s._dlink.href=r.replace("image/png","image/octet-stream"),s._dlink.download=t,s._dlink.click()),ATON._onResize(),o},assignLightProbeToMesh:(e,t)=>{void 0!==e&&void 0!==t&&(t.noLP||(t.userData.LP=e))},clearLightProbeFromMesh:e=>{void 0!==e&&(e.noLP||(e.userData.LP=null))},vibrate:e=>{void 0===e&&(e=100),window.navigator.vibrate(e)},createATONCube:e=>{let t=new THREE.BoxGeometry(1,1,1),o=new THREE.MeshStandardMaterial;s.textureLoader.load(ATON.PATH_RES+"models/aton-cube.jpg",(e=>{e.colorSpace=ATON._stdEncoding,o.map=e}));let i=ATON.createSceneNode(e);return i.add(new THREE.Mesh(t)),i.setMaterial(o),i.enablePicking(),i},createATONCubePBR:e=>{let t=new THREE.BoxGeometry(1,1,1),o=new THREE.MeshStandardMaterial;o.metalness=1,s.textureLoader.load(ATON.PATH_RES+"models/aton-cube.jpg",(e=>{e.colorSpace=ATON._stdEncoding,o.map=e})),s.textureLoader.load(ATON.PATH_RES+"models/aton-cube-pbr.jpg",(e=>{e.colorSpace=ATON._stdEncoding,o.metalnessMap=e,o.roughnessMap=e})),s.textureLoader.load(ATON.PATH_RES+"models/aton-cube-nrm.png",(e=>{e.colorSpace=ATON._stdEncoding,o.normalMap=e}));let i=ATON.createSceneNode(e);return i.add(new THREE.Mesh(t)),i.setMaterial(o),i.enablePicking(),i},createGround:(e,t,o)=>{void 0===t&&(t=1),void 0===o&&(o=1);let i=new THREE.PlaneGeometry(t,o),r=new THREE.MeshStandardMaterial;void 0!==e&&s.textureLoader.load(e,(e=>{e.colorSpace=ATON._stdEncoding,r.map=e}));let a=ATON.createSceneNode().rotateX(.5*-Math.PI);return a.add(new THREE.Mesh(i,r)),a.enablePicking(),a}};const n=s;let l={MODE_ADD:0,MODE_DEL:1,FLOAT_PREC:5,init:()=>{l.currID=void 0,l.currData=void 0,l._bEdit=!1,l._bLoading=!1,l._title=void 0,l._descr=void 0,l.initBaseParsers()},setEditMode:e=>{l._bEdit=e,console.log("Edit mode:"+e)},load:(e,t,o)=>(l._bLoading=!0,console.log("Loading Scene: "+t),$.getJSON(e,(e=>{l.currData=e,l.currID=t,l._bLoading=!1,l.parseScene(e),o&&o(),ATON.fireEvent("SceneJSONLoaded",t)}))),clearScene:()=>{if(!(ATON._rootVisible.children.length<=0)){ATON._rootVisible.removeChildren();for(let e in ATON.snodes)e!==ATON.ROOT_NID&&delete ATON.snodes[e];ATON.MRes.clear(),ATON.XPFNetwork.clear()}},clearSemantics:()=>{if(!(ATON._rootSem.children.length<=0)){ATON._rootSem.removeChildren();for(let e in ATON.semnodes)e!==ATON.ROOT_NID&&delete ATON.semnodes[e];ATON.SUI.gSemIcons&&ATON.SUI.gSemIcons.removeChildren(),ATON.SemFactory.stopCurrentConvex(),ATON.SemFactory.init()}},clear:()=>{l.clearScene(),l.clearSemantics(),ATON.Nav.clear()},parseScene:e=>{if(void 0!==(e=void 0===e?l.currData:e))for(let t in e)l._jsonParsers[t]&&l._jsonParsers[t](e[t])},getJSONchildren:(e,t)=>{let o;void 0===t&&(t=ATON.NTYPES.SCENE);let i=[];if(t===ATON.NTYPES.SEM&&(o=ATON.getSemanticNode(e)),t===ATON.NTYPES.SCENE&&(o=ATON.getSceneNode(e)),void 0!==o){for(let e in o.children){let t=o.children[e];void 0!==t.nid&&i.push(t.nid)}return i}},getJSONgraphEdges:e=>{void 0===e&&(e=ATON.NTYPES.SCENE);let t=ATON.snodes;e===ATON.NTYPES.SEM&&(t=ATON.semnodes),e===ATON.NTYPES.UI&&(t=ATON.uinodes);let o={};for(let e in t){let i=t[e];i&&i.parent&&i.parent.nid&&(void 0===o[i.parent.nid]&&(o[i.parent.nid]=[]),o[i.parent.nid].push(i.nid))}return o},getJSONsemanticSpheresList:e=>{let t=ATON.getSemanticNode(e);if(void 0===t)return;let o=[];for(let e in t.children){let i=t.children[e];i.type&&o.push([parseFloat(i.position.x.toPrecision(l.FLOAT_PREC)),parseFloat(i.position.y.toPrecision(l.FLOAT_PREC)),parseFloat(i.position.z.toPrecision(l.FLOAT_PREC)),parseFloat(i.scale.x.toPrecision(l.FLOAT_PREC))])}return o},getJSONsemanticConvexShapes:e=>{let t=ATON.getSemanticNode(e);if(void 0===t)return;let o=[];for(let e in t.children){let i=t.children[e];i.userData._convexPoints&&o.push(i.userData._convexPoints)}return o},_applyJSONTransformToNode:(e,t)=>{if(void 0!==e&&void 0!==t){if(e.bUseGeoCoords)return t.bUseGeoCoords=!0,void(e.scale&&t.setScale(e.scale[0],e.scale[1],e.scale[2]));e.autocenter?t.autocenter=!0:e.position&&t.setPosition(e.position[0],e.position[1],e.position[2]),e.rotation&&t.setRotation(e.rotation[0],e.rotation[1],e.rotation[2]),e.scale&&t.setScale(e.scale[0],e.scale[1],e.scale[2]),e.list&&Array.isArray(e.list)}},initBaseParsers:()=>{l._jsonParsers={},l._jsonParsers.title=e=>{void 0!==e&&l.setTitle(e)},l._jsonParsers.description=e=>{void 0!==e&&l.setDescription(e)},l._jsonParsers.fx=e=>{e.ao&&(ATON.FX.togglePass(ATON.FX.PASS_AO,!0),e.ao.i&&ATON.FX.setAOintensity(parseFloat(e.ao.i))),e.bloom&&(ATON.FX.togglePass(ATON.FX.PASS_BLOOM,!0),e.bloom.i&&ATON.FX.setBloomStrength(parseFloat(e.bloom.i)),e.bloom.t&&ATON.FX.setBloomThreshold(parseFloat(e.bloom.t))),e.dof&&(ATON.FX.togglePass(ATON.FX.PASS_DOF,!0),e.dof.f&&ATON.FX.setDOFfocus(parseFloat(e.dof.f)))},l._jsonParsers.environment=e=>{let t=e.mainpano;if(e.mainpano&&(t.url&&ATON.setMainPanorama(t.url),t.rotation&&ATON.setMainPanoramaRotation(t.rotation)),e.bgcolor){let t=new THREE.Color(e.bgcolor[0],e.bgcolor[1],e.bgcolor[2]);ATON.setBackgroundColor(t)}let o=e.mainlight;o?(o.direction&&ATON.setMainLightDirection(new THREE.Vector3(o.direction[0],o.direction[1],o.direction[2])),ATON._dMainL?(o.color&&(ATON._dMainL.color=new THREE.Color(o.color[0],o.color[1],o.color[2])),o.intensity&&(ATON._dMainL.intensity=o.intensity),void 0!==o.shadows?ATON.toggleShadows(o.shadows):ATON.toggleShadows(!1)):ATON.toggleMainLight(!1)):ATON.toggleMainLight(!1);let i=e.lightprobes;if(i&&(void 0!==i.auto&&ATON.setAutoLP(i.auto),i.list))for(let e in i.list){let t=i.list[e],o=new ATON.LightProbe(t.res);t.pos&&o.setPosition(parseFloat(t.pos[0]),parseFloat(t.pos[1]),parseFloat(t.pos[2])),t.near&&o.setNear(parseFloat(t.near)),t.far&&o.setFar(parseFloat(t.far)),ATON.addLightProbe(o),console.log(o)}e.exposure&&ATON.setExposure(e.exposure)},l._jsonParsers.soundscape=e=>{void 0!==e&&e.global&&ATON.setGlobalAudio(e.global.url,e.global.loop)},l._jsonParsers.navmode=e=>{void 0!==e&&ATON.Nav.setNavMode(e)},l._jsonParsers.locomotionGraph=e=>{if(void 0!==e){for(let t in e){let o=e[t];o.pos&&ATON.Nav.addLocomotionNode(parseFloat(o.pos[0]),parseFloat(o.pos[1]),parseFloat(o.pos[2]),!0)}ATON.Nav.setFirstPersonControl(),ATON.Nav.toggleLocomotionValidator(!1)}},l._jsonParsers.measurements=e=>{if(void 0!==e)for(let t in e){let o=e[t];if(o.points&&6===o.points.length){let e=new THREE.Vector3(parseFloat(o.points[0]),parseFloat(o.points[1]),parseFloat(o.points[2])),t=new THREE.Vector3(parseFloat(o.points[3]),parseFloat(o.points[4]),parseFloat(o.points[5]));ATON.SUI.addMeasurementPoint(e),ATON.SUI.addMeasurementPoint(t)}}},l._jsonParsers.viewpoints=e=>{if(void 0!==e)for(let t in e){let o=e[t];"home"===t?ATON.Nav.setHomePOV((new ATON.POV).setPosition(o.position[0],o.position[1],o.position[2]).setTarget(o.target[0],o.target[1],o.target[2]).setFOV(o.fov)):new ATON.POV(t).setPosition(o.position[0],o.position[1],o.position[2]).setTarget(o.target[0],o.target[1],o.target[2]).setFOV(o.fov)}},l._jsonParsers.scenegraph=e=>{if(void 0===e)return;let t=e.nodes,o=e.edges;for(let e in t){let o=t[e],i=ATON.getOrCreateSceneNode(e).removeChildren();l._applyJSONTransformToNode(o.transform,i);let r=o.urls;if(r&&(Array.isArray(r)?r.forEach((e=>{i.load(e)})):i.load(r)),o["cesium.ion"]){let e=o["cesium.ion"];ATON.MRes.loadCesiumIONAsset(e,i)}if(o.stream){let t,r=o.stream;if(r.src.startsWith("#")){let e=parseInt(r.src.substring(1));t=ATON.MediaFlow.getOrCreateVideoStream(e,void 0,!0)}else{let o=ATON.Utils.resolveCollectionURL(r.src);t=ATON.MediaFlow.getOrCreateVideoStream(e,o)}if(r.chromakey){let e=r.chromakey.color;e&&t.matStream.uniforms.keycolor.value.set(parseFloat(e[0]),parseFloat(e[1]),parseFloat(e[2]),parseFloat(e[3])),r.chromakey.smoothness&&(t.matStream.uniforms.smoothness.value=parseFloat(r.chromakey.smoothness)),r.chromakey.spill&&(t.matStream.uniforms.spill.value=parseFloat(r.chromakey.spill)),r.chromakey.similarity&&(t.matStream.uniforms.similarity.value=parseFloat(r.chromakey.similarity))}if(!o.urls){let e=new THREE.PlaneGeometry(1,1),o=new THREE.Mesh(e);o.scale.x=1,o.scale.y=-1,t.el.addEventListener("loadedmetadata",(e=>{let i=t.el.videoWidth/t.el.videoHeight;o.scale.x=i,o.scale.y=-1})),ATON.Utils.modelVisitor(i,o),i.add(o),ATON._bqScene=!0,i.setPickable(!0),i.dirtyBound()}i.setMaterial(t.matStream)}o.shadowcast&&i.setShadowCast(o.shadowcast),o.shadowreceive&&i.setShadowCast(o.shadowreceive),o.toYup&&i.setYup(),o.keywords&&(i.kwords=o.keywords)}for(let e in o){let t=o[e],i=ATON.getSceneNode(e);if(void 0!==i)for(let e in t){let o=t[e],r=ATON.getSceneNode(o);void 0!==r&&r.attachTo(i)}}for(let e in t){let o=t[e],i=ATON.getSceneNode(e);if(void 0!==i&&(void 0!==o.show&&(o.show?(i.show(),console.log("show "+e)):(i.hide(),console.log("hide "+e))),o.material)){let e;"string"==typeof o.material?e=ATON.MatHub.materials[o.material]:o.material.fragmentShader||o.material.vertexShader?(o.material.vertexShader||(o.material.vertexShader=ATON.MatHub.getDefVertexShader()),e=new THREE.ShaderMaterial(o.material)):e=new THREE.MeshStandardMaterial(o.material),e&&i.setMaterial(e)}}},l._jsonParsers.semanticgraph=e=>{if(void 0===e)return;let t=e.nodes,o=e.edges;for(let e in t){let o=t[e],i=ATON.getOrCreateSemanticNode(e).removeChildren(),r=o.urls;r&&(Array.isArray(r)?r.forEach((e=>{i.load(e)})):i.load(r)),o.toYup&&i.setYup(),o.description&&i.setDescription(o.description),o.audio&&i.setAudio(o.audio),o.keywords&&(i.kwords=o.keywords);let a=o.spheres;if(Array.isArray(a))for(let t in a){let o=a[t],i=new THREE.Vector3(parseFloat(o[0]),parseFloat(o[1]),parseFloat(o[2]));ATON.SemFactory.createSphere(e,i,parseFloat(o[3]))}let s=o.convexshapes;if(Array.isArray(s))for(let t in s){let o=s[t],i=[];for(let e=0;e{if(ATON.Nav.setFirstPersonControl(),e.list){let t=e.list,o=t.length;for(let e=0;e{ATON.XPFNetwork.setHomeXPF(0),ATON.XPFNetwork.requestTransitionByIndex(0,0)}))}},addSceneParser:(e,t)=>{l._jsonParsers[e]=t},patch:(e,t,o)=>{if(l._bLoading||!l._bEdit)return;if(void 0===e)return;void 0===t&&(t=l.MODE_ADD);let i=l.currID,r={};r.data=e,r.mode=t===l.MODE_DEL?"DEL":"ADD";let a=JSON.stringify(r);e=null,r=null,$.ajax({url:ATON.PATH_RESTAPI2+"scenes/"+i,type:"PATCH",data:a,contentType:"application/json; charset=utf-8",dataType:"json",success:e=>{e&&(l.currData=e),o&&o()}})}};l.sendEdit=l.patch,l.setVisibility=(e,t)=>{l.currData.visibility=e,l.sendEdit({visibility:e},ATON.SceneHub.MODE_ADD,t)},l.currSceneHasHomeConfig=()=>void 0!==l.currData&&void 0!==l.currData.viewpoints&&void 0!==l.currData.viewpoints.home,l.setTitle=e=>{l._title=e},l.getTitle=()=>l._title,l.setDescription=e=>{l._descr=e},l.getDescription=()=>l._descr;const d=l;let c={init:()=>{c._listener=new THREE.AudioListener,c._loader=new THREE.AudioLoader,c._bGenAuPlaying=!1},playOnceGlobally:(e,t)=>{if(t&&c._bGenAuPlaying)return;e=ATON.Utils.resolveCollectionURL(e);let o=new THREE.Audio(ATON.AudioHub._listener);return c._loader.load(e,(e=>{o.setBuffer(e),o.play(),t&&(c._bGenAuPlaying=!0)})),t&&(o.onEnded=()=>{c._bGenAuPlaying=!1}),o}};const u=c;class _ extends THREE.EventDispatcher{constructor(e){super(),!1===window.isSecureContext&&console.error("DeviceOrientationEvent is only available in secure contexts (https)"),this._zee=new THREE.Vector3(0,0,1),this._euler=new THREE.Euler,this._q0=new THREE.Quaternion,this._q1=new THREE.Quaternion(-Math.sqrt(.5),0,0,Math.sqrt(.5)),this._changeEvent={type:"change"};const t=this,o=new THREE.Quaternion;this.object=e,this.object.rotation.reorder("YXZ"),this.enabled=!0,this.deviceOrientation={},this.screenOrientation=0,this.alphaOffset=0;const i=function(e){t.deviceOrientation=e},r=function(){t.screenOrientation=window.orientation||0};this.connect=function(){r(),void 0!==window.DeviceOrientationEvent&&"function"==typeof window.DeviceOrientationEvent.requestPermission?window.DeviceOrientationEvent.requestPermission().then((function(e){"granted"==e&&(window.addEventListener("orientationchange",r),window.addEventListener("deviceorientation",i))})).catch((function(e){console.error("Unable to use DeviceOrientation API:",e)})):(window.addEventListener("orientationchange",r),window.addEventListener("deviceorientation",i)),t.enabled=!0},this.disconnect=function(){window.removeEventListener("orientationchange",r),window.removeEventListener("deviceorientation",i),t.enabled=!1},this.update=function(){if(!1===t.enabled)return;const e=t.deviceOrientation;if(e){const i=e.alpha?THREE.MathUtils.degToRad(e.alpha)+t.alphaOffset:0,r=e.beta?THREE.MathUtils.degToRad(e.beta):0,a=e.gamma?THREE.MathUtils.degToRad(e.gamma):0,s=t.screenOrientation?THREE.MathUtils.degToRad(t.screenOrientation):0;!function(e,o,i,r,a){t._euler.set(i,o,-r,"YXZ"),e.setFromEuler(t._euler),e.multiply(t._q1),e.multiply(t._q0.setFromAxisAngle(t._zee,-a))}(t.object.quaternion,i,r,a,s),8*(1-o.dot(t.object.quaternion))>1e-6&&(o.copy(t.object.quaternion),t.dispatchEvent(t._changeEvent))}},this.dispose=function(){t.disconnect()},this.connect()}}const p=_;let h={STD_FOV:50,STD_NEAR:.01,STD_FAR:800,FP_EPS:.01,STD_POV_TRANS_DURATION:2,STD_LOCNODE_SIZE:.5,MIN_LOC_VALID_DIST:1.5,MODE_ORBIT:0,MODE_FP:1,MODE_DEVORI:2,LocomotionNode:class{constructor(e){this.pos=new THREE.Vector3(0,0,0),this.id=e,this._iXPF=void 0,this._sui=void 0}setLocation(e,t,o){return e instanceof THREE.Vector3?this.pos.copy(e):this.pos.set(e,t,o),this._sui&&this._sui.position.copy(this.pos),this}getLocation(){return this.pos}realizeSUI(e){return void 0===ATON.SUI.gLocNodes||(this._sui=new THREE.Sprite(ATON.SUI.getOrCreateSpriteWalk()),this._sui.position.copy(this.pos),this._sui.scale.set(ATON.Nav.STD_LOCNODE_SIZE,ATON.Nav.STD_LOCNODE_SIZE,ATON.Nav.STD_LOCNODE_SIZE),ATON.SUI.gLocNodes.add(this._sui)),this}toggleSUI(e){return void 0===this._sui||(this._sui.visible=e),this}},init:()=>{h._mode=void 0,h.POVtransitionDuration=h.STD_POV_TRANS_DURATION,h._rotSpeedOrbit=.4,h._rotSpeedFP=-.2,h._inertia=.08,h._bControl=!0,h._bLocValidator=!0,h._bInteracting=!1,h._prevMode=void 0,h.setOrbitControl(),h._currPOV=(new ATON.POV).setPosition(0,0,0).setTarget(1,0,0).setFOV(ATON.Nav.STD_FOV),h._fromPOV=new ATON.POV,h._reqPOV=new ATON.POV,h.homePOV=void 0,h._tPOVcall=-1,h._tPOVprogress=0,h.povlist={},h._vDir=new THREE.Vector3(1,0,0),h._qOri=new THREE.Quaternion,h._lastPos=new THREE.Vector3(0,0,0),h._lastOri=new THREE.Quaternion,h._dOri=0,h._dPos=0,h._motionAmt=0,h._motionDir=new THREE.Vector3(0,1,0),h._bValidLocomotion=!1,h._locNodes=[],h._prevLN=void 0},getCurrentEyeLocation:()=>h._currPOV.pos,getCurrentDirection:()=>h._vDir,copyCurrentPOV:()=>{let e=new ATON.POV;return e.pos.copy(h._currPOV.pos),e.target.copy(h._currPOV.target),e.fov=h._currPOV.fov,e},addPOV:(e,t)=>{if(void 0!==e)return e.as(t),e},clearPOVs:()=>{for(let e in ATON.Nav.povlist)delete h.povlist[e]},isTransitioning:()=>h._tPOVcall>=0,currentQueryValidForLocomotion:()=>h._bValidLocomotion,locomotionValidator:()=>{if(void 0===ATON._queryDataScene)return void(h._bValidLocomotion=!1);let e=ATON._queryDataScene,t=(e.p,e.n);e.d<=h.MIN_LOC_VALID_DIST?h._bValidLocomotion=!1:t?t.y<=.7?h._bValidLocomotion=!1:h._bValidLocomotion=!0:h._bValidLocomotion=!1},toggleLocomotionValidator:e=>{e?h._bLocValidator=!0:(h._bLocValidator=!1,h._bValidLocomotion=!1)},addLocomotionNode:(e,t,o,i)=>{let r=(new h.LocomotionNode).setLocation(e,t,o);return i&&r.realizeSUI(),h._locNodes.push(r),ATON.fireEvent("LocomotionNodeAdded",r),r},getLocomotionNodeByIndex:e=>h._locNodes[e],clearLocomotionNodes:()=>{h._locNodes=[],h._prevLN=void 0,ATON.SUI.gLocNodes&&ATON.SUI.gLocNodes.removeChildren()},getLocomotionNodeInSight:()=>{let e=h._locNodes.length;if(e<=0)return;if(h.isTransitioning())return;let t,o,i=h._currPOV.pos,r=h._vDir;void 0===h._dirLNode&&(h._dirLNode=new THREE.Vector3);for(let a=0;a.8){let e=i.distanceToSquared(h._posLNode);e>.3&&(void 0===o||e{if(void 0===e)return;if(h._mode===h.MODE_ORBIT)return;let o=ATON.Nav._vDir,i=(new ATON.POV).setPosition(e.pos).setTarget(e.pos.x+o.x,e.pos.y+o.y,e.pos.z+o.z).setFOV(h._currPOV.fov);e.toggleSUI(!1),void 0!==h._prevLN&&h._prevLN.toggleSUI(!0),h.requestPOV(i,t),h._prevLN=e,ATON.fireEvent("LocomotionNodeRequested",e)},requestTransitionToLocomotionNodeInSightIfAny:e=>{let t=ATON.XPFNetwork.getNextXPFindex();if(void 0!==t)return h.requestTransitionToLocomotionNode(ATON.XPFNetwork._list[t]._lnode,e),!0;let o=ATON.Nav.getLocomotionNodeInSight();if(void 0===o)return!1;let i=h._locNodes[o];return h.requestTransitionToLocomotionNode(i,e),!0},requestDeltaRotation:(e,t,o)=>{if(ATON.XR._bPresenting)return;let i=new THREE.Vector3,r=new THREE.Vector3;i.crossVectors(h._vDir,THREE.Object3D.DEFAULT_UP),r.x=h._currPOV.target.x+i.x*e,r.y=h._currPOV.target.y+t,r.z=h._currPOV.target.z+i.z*e;let a=new ATON.POV;a.setTarget(r),a.setPosition(ATON.Nav._currPOV.pos),ATON.Nav.requestPOV(a,o)},setUserControl:e=>{void 0!==e&&e!==h._bControl&&(h._bControl=e,void 0!==h._controls&&(h._controls.enabled=e),h._cOrbit&&(h._cOrbit.enabled=e),h._cFirstPerson&&(h._cFirstPerson.enabled=e),console.log("Nav controls: "+h._bControl))},toggleUserControl:()=>{h.setUserControl(!h._bControl)},isUserControlEnabled:()=>h._bControl,isOrbit:()=>!ATON.XR._bPresenting&&h._mode===h.MODE_ORBIT,isFirstPerson:()=>!ATON.XR._bPresenting&&h._mode===h.MODE_FP,isDevOri:()=>!ATON.XR._bPresenting&&h._mode===h.MODE_DEVORI,setNavMode:e=>{void 0!==e&&(e===h.MODE_ORBIT&&h.setOrbitControl(),e===h.MODE_FP&&h.setFirstPersonControl(),e===h.MODE_DEVORI&&h.setDeviceOrientationControl())},restorePreviousNavMode:()=>{void 0===h._prevMode&&h.setOrbitControl(),h.setNavMode(h._prevMode)},_updCamera:e=>{if(void 0===e&&(e=h._camera),ATON.FX.composer){let t=ATON.FX.composer.passes;if(t)for(let o=0;o{if(!ATON.XR.isPresenting()){if(h._prevMode=h._mode,h._mode=h.MODE_ORBIT,h._bInteracting=!1,ATON.fireEvent("NavInteraction",!1),void 0===h._cOrbit){h._camOrbit=new THREE.PerspectiveCamera(h.STD_FOV,window.innerWidth/window.innerHeight,h.STD_NEAR,h.STD_FAR),h._camOrbit.layers.enableAll(),h._cOrbit=new THREE.OrbitControls(h._camOrbit,ATON._renderer.domElement);let e=h._cOrbit;e.rotateSpeed=h._rotSpeedOrbit,e.enablePan=!0,h._inertia>0&&(e.enableDamping=!0,e.dampingFactor=h._inertia),e.screenSpacePanning=!0,e.enableZoom=!0,e.minDistance=.03,e.maxDistance=300,h._bControl||(e.enabled=!1),e.addEventListener("start",(()=>{h._bInteracting=!0,ATON.fireEvent("NavInteraction",!0)})),e.addEventListener("end",(()=>{h._bInteracting=!1,ATON.fireEvent("NavInteraction",!1)}))}h._controls=h._cOrbit,h._camera=h._camOrbit,ATON.AudioHub._listener&&h._camera.children.length<1&&h._camera.add(ATON.AudioHub._listener),h._updCamera(),h._controls.update(),h._currPOV&&h.syncCurrCamera(),ATON._onResize(),ATON.toggleCenteredQuery(!1),ATON.fireEvent("NavMode",h._mode)}},setFirstPersonControl:()=>{if(!ATON.XR.isPresenting()){if(h._prevMode=h._mode,ATON.SUI.getSelectorRadius()>.1&&ATON.SUI.setSelectorRadius(.1),h._mode=h.MODE_FP,h._bInteracting=!1,ATON.fireEvent("NavInteraction",!1),void 0===h._cFirstPerson){h._camFP=new THREE.PerspectiveCamera(h.STD_FOV,window.innerWidth/window.innerHeight,h.STD_NEAR,h.STD_FAR),h._camFP.layers.enableAll(),h._cFirstPerson=new THREE.OrbitControls(h._camFP,ATON._renderer.domElement);let e=h._cFirstPerson;e.enableZoom=!1,e.enablePan=!1,e.rotateSpeed=h._rotSpeedFP,h._inertia>0&&(e.enableDamping=!0,e.dampingFactor=h._inertia),e.target.copy(h._camera.position),e.minDistance=.01,e.maxDistance=.01,h._bControl||(e.enabled=!1)}h._controls=h._cFirstPerson,h._camera=h._camFP,ATON.AudioHub._listener&&h._camera.children.length<1&&h._camera.add(ATON.AudioHub._listener),h._updCamera(),h._controls.update(),h._currPOV&&h.syncCurrCamera(),ATON._onResize(),ATON.toggleCenteredQuery(!1),ATON.fireEvent("NavMode",h._mode)}},setDeviceOrientationControl:()=>{ATON.Utils.isMobile()&&(h._prevMode=h._mode,h._mode=h.MODE_DEVORI,h._bInteracting=!1,ATON.fireEvent("NavInteraction",!1),ATON._screenPointerCoords.set(0,0),void 0===h._cDevOri&&(h._camDevOri=new THREE.PerspectiveCamera(h.STD_FOV,window.innerWidth/window.innerHeight,h.STD_NEAR,h.STD_FAR),h._camDevOri.layers.enableAll(),h._cDevOri=new p(h._camDevOri,ATON._renderer.domElement),h._cDevOri.alphaOffset=0),h._controls=h._cDevOri,h._camera=h._camDevOri,ATON.AudioHub._listener&&h._camera.children.length<1&&h._camera.add(ATON.AudioHub._listener),h._updCamera(),h._controls.update(),h._currPOV&&h.syncCurrCamera(),ATON._onResize(),ATON.toggleCenteredQuery(!0),ATON.fireEvent("NavMode",h._mode))},useAbsoluteOrientation:e=>{h._cDevOri},setMotionAmount:e=>{h._motionAmt=e},setMotionDirection:e=>{h._motionDir.copy(e)},stop:()=>{h._motionAmt=0},setFOV:e=>{if(ATON.XR.isPresenting())return;h._currPOV.fov=e;let t=h._camera;t.fov=e,t.updateProjectionMatrix()},getFOV:()=>h._currPOV.fov,_deltaMotions:()=>{h._dOri=h._lastOri.angleTo(ATON.Nav._qOri),h._dPos=h._lastPos.distanceToSquared(h._currPOV.pos),h._lastPos.copy(h._currPOV.pos),h._lastOri.copy(ATON.Nav._qOri)},syncCurrPOV:()=>{if(ATON.XR.isPresenting()){const e=ATON._renderer.xr.getCamera().cameras[0];return h._currPOV.pos.copy(e.position),h._qOri.copy(e.quaternion),e.getWorldDirection(h._vDir),h._currPOV.pos.x+=ATON.XR.rig.position.x,h._currPOV.pos.y+=ATON.XR.rig.position.y,h._currPOV.pos.z+=ATON.XR.rig.position.z,void h._deltaMotions()}const e=h._controls,t=h._camera;if(t.getWorldDirection(h._vDir),t.getWorldQuaternion(h._qOri),h._deltaMotions(),h._mode!==h.MODE_DEVORI){if(h._mode===h.MODE_FP)return h._currPOV.pos.copy(e.target),h._currPOV.target.x=h._currPOV.pos.x+h._vDir.x,h._currPOV.target.y=h._currPOV.pos.y+h._vDir.y,void(h._currPOV.target.z=h._currPOV.pos.z+h._vDir.z);h._currPOV.pos.copy(t.position),h._currPOV.target.copy(e.target)}else h._currPOV.pos.copy(t.position)},applyPOVconstraints:e=>{},handlePOV:()=>{ATON.XR.isPresenting()?h.handleXRtransition():h.handlePOVtransition(),h.handleMotion(),h.applyPOVconstraints(h._currPOV)},handleMotion:()=>{if(h.isTransitioning())return;if(0==h._motionAmt)return;ATON.XR.controller0&&ATON.XR.controller0.visible?(ATON.XR.controller0.getWorldDirection(h._motionDir),h._motionDir.negate()):h._motionDir.copy(h._vDir);let e=h._motionAmt*ATON._dt,t=h._motionDir.x*e,o=h._motionDir.y*e,i=h._motionDir.z*e;h._currPOV.pos.x+=t,h._currPOV.pos.y+=o,h._currPOV.pos.z+=i,h._currPOV.target.x+=t,h._currPOV.target.y+=o,h._currPOV.target.z+=i},handlePOVtransition:()=>{if(!(h._tPOVcall<0)){if(h.POVtransitionDuration<=0?h._tPOVprogress=1:h._tPOVprogress=(ATON._clock.elapsedTime-h._tPOVcall)/h.POVtransitionDuration,h._tPOVprogress>=1)return h._tPOVcall=-1,h._currPOV.pos.copy(h._reqPOV.pos),h._currPOV.target.copy(h._reqPOV.target),h._currPOV.fov=h._reqPOV.fov,void ATON.fireEvent("POVTransitionCompleted",h._reqPOV.id);var e;h._tPOVprogress=(e=h._tPOVprogress,(1-Math.cos(e*Math.PI))/2),h._currPOV.pos.lerpVectors(h._fromPOV.pos,h._reqPOV.pos,h._tPOVprogress),h._currPOV.target.lerpVectors(h._fromPOV.target,h._reqPOV.target,h._tPOVprogress),h._fromPOV.fov&&h._reqPOV.fov&&(h._currPOV.fov=THREE.MathUtils.lerp(h._fromPOV.fov,h._reqPOV.fov,h._tPOVprogress),h._camera.fov=h._currPOV.fov,h._camera.updateProjectionMatrix())}},handleXRtransition:()=>{if(!(h._tPOVcall<0)){if(h.POVtransitionDuration<=0?h._tPOVprogress=1:h._tPOVprogress=(ATON._clock.elapsedTime-h._tPOVcall)/h.POVtransitionDuration,h._tPOVprogress>=1)return h._tPOVcall=-1,ATON.XR._currPos.copy(ATON.XR._reqPos),void ATON.fireEvent("POVTransitionCompleted",h._reqPOV.id);ATON.XR._currPos.lerpVectors(ATON.XR._fromPos,ATON.XR._reqPos,h._tPOVprogress)}},syncCurrCamera:()=>{if(ATON.XR.isPresenting())return;let e=h._controls,t=h._camera,o=h._currPOV.pos,i=h._currPOV.target;h._mode!==h.MODE_DEVORI?(h._vDir.subVectors(i,o),h._vDir.normalize(),h._mode===h.MODE_FP?(e.target.copy(o),t.position.x=e.target.x-h._vDir.x*h.FP_EPS,t.position.y=e.target.y-h._vDir.y*h.FP_EPS,t.position.z=e.target.z-h._vDir.z*h.FP_EPS):(t.position.copy(o),e.target.copy(i))):t.position.copy(o)},update:()=>{h.syncCurrPOV(),h.handlePOV(),h.syncCurrCamera()},requestPOV:(e,t,o)=>{ATON._tPOVcall>=0||void 0!==e&&(ATON.XR._bPresenting&&"immersive-ar"===ATON.XR._sessionType||(h.POVtransitionDuration=void 0!==t?t:h.STD_POV_TRANS_DURATION,ATON.XR.isPresenting()?(h._reqPOV.pos.copy(e.pos?e.pos:h._currPOV.pos),h._fromPOV.pos.copy(h._currPOV.pos),ATON.XR._reqPos.copy(e.pos?e.pos:h._currPOV.pos),ATON.XR._fromPos.copy(ATON.XR._currPos)):(h._reqPOV.pos.copy(e.pos?e.pos:h._currPOV.pos),h._reqPOV.target.copy(e.target?e.target:h._currPOV.target),h._reqPOV.fov=e.fov?e.fov:h._currPOV.fov,h._fromPOV.pos.copy(h._currPOV.pos),h._fromPOV.target.copy(h._currPOV.target),h._fromPOV.fov=h._currPOV.fov),o&&(e.pos&&(h._reqPOV.pos.x*=ATON._worldScale,h._reqPOV.pos.y*=ATON._worldScale,h._reqPOV.pos.z*=ATON._worldScale,ATON.XR.isPresenting()&&(ATON.XR._reqPos.x*=ATON._worldScale,ATON.XR._reqPos.y*=ATON._worldScale,ATON.XR._reqPos.z*=ATON._worldScale)),e.target&&(h._reqPOV.target.x*=ATON._worldScale,h._reqPOV.target.y*=ATON._worldScale,h._reqPOV.target.z*=ATON._worldScale)),h._tPOVcall=ATON._clock.elapsedTime,ATON.fireEvent("POVTransitionRequested",e.id)))},requestPOVbyBound:(e,t)=>{if(void 0===e)return;let o=new THREE.Vector3,i=3*e.radius;o.x=e.center.x-i*h._vDir.x,o.y=e.center.y-i*h._vDir.y,o.z=e.center.z-i*h._vDir.z;let r=(new ATON.POV).setPosition(o).setTarget(e.center);h.requestPOV(r,t)},requestPOVbyNode:(e,t)=>{if(void 0===e)return;let o=e.getBound();h.requestPOVbyBound(o,t)},requestPOVbyID:(e,t)=>{if(void 0===e)return;let o=h.povlist[e];void 0!==o&&h.requestPOV(o,t)},requestRetarget:(e,t,o)=>{let i=new THREE.Vector3;if(void 0===t)i.lerpVectors(e,h._currPOV.pos,.8);else{let o=e.distanceTo(h._currPOV.pos);o*=.5,i.x=e.x+t.x*o,i.y=e.y+t.y*o,i.z=e.z+t.z*o}let r=e.distanceTo(i);ATON.FX.setDOFfocus(r);let a=(new ATON.POV).setPosition(i).setTarget(e).setFOV(h._currPOV.fov);h.requestPOV(a,o),console.log(a)},computeDefaultHome:(e,t)=>{void 0===e&&(e=new THREE.Vector3(1,.7,1)),void 0===t&&(t=ATON.getRootScene().getBound());let o=new THREE.Vector3(t.center.x+t.radius*e.x*1.5,t.center.y+t.radius*e.y*1.5,t.center.z+t.radius*e.z*1.5);h.homePOV=(new ATON.POV).setPosition(o).setTarget(t.center)},setHomePOV:e=>{h.homePOV=e},computeAndRequestDefaultHome:(e,t,o)=>{h.computeDefaultHome(t,o),h.requestPOV(h.homePOV,e)},requestHomePOV:e=>{h.requestPOV(h.homePOV,e)}};h.requestHome=h.requestHomePOV,h.setAndRequestHomePOV=(e,t)=>{h.setHomePOV(e),h.requestPOV(e,t)},h.clear=()=>{h.clearPOVs(),h.clearLocomotionNodes()},h.DeviceOrientationControls=function(e){let t=this;this.object=e,this.object.rotation.reorder("YXZ"),this.enabled=!0,this.deviceOrientation={},this.screenOrientation=0,this.alphaOffset=0,this.absolute=!1,this.alphaOffsetDevice=void 0,this.alphaOffsetScreen=void 0;let o=function(e){t.absolute||(t.deviceOrientation=e)},i=function(e){t.deviceOrientation=e,t.absolute=!0},r=function(){t.screenOrientation=window.orientation||0},a=function(){let e=new THREE.Vector3(0,0,1),t=new THREE.Euler,o=new THREE.Quaternion,i=new THREE.Quaternion(-Math.sqrt(.5),0,0,Math.sqrt(.5));return function(r,a,s,n,l){t.set(s,a,-n,"YXZ"),r.setFromEuler(t),r.multiply(i),r.multiply(o.setFromAxisAngle(e,-l))}}();this.connect=function(){r(),window.addEventListener("orientationchange",r,!1),window.addEventListener("deviceorientation",o,!1),window.addEventListener("deviceorientationabsolute",i,!1),t.enabled=!0},this.disconnect=function(){window.removeEventListener("orientationchange",r,!1),window.removeEventListener("deviceorientation",o,!1),window.removeEventListener("deviceorientationabsolute",i,!1),t.enabled=!1},this.update=function(){if(!1===t.enabled)return;let e;if(e=t.deviceOrientation,e){let o=this.getDirection()?THREE.Math.degToRad(this.getDirection())+t.alphaOffset:0,i=e.beta?THREE.Math.degToRad(e.beta):0,r=e.gamma?THREE.Math.degToRad(e.gamma):0,s=t.screenOrientation?THREE.Math.degToRad(t.screenOrientation):0;a(t.object.quaternion,o,i,r,s)}},this.dispose=()=>{t.disconnect()},this.iOSOrientationPermission=()=>{"function"==typeof DeviceOrientationEvent.requestPermission&&DeviceOrientationEvent.requestPermission().then((e=>{console.log(e)})).catch(console.error)},this.getDirection=()=>void 0!==t.deviceOrientation.webkitCompassHeading?t.deviceOrientation.webkitCompassHeading:t.deviceOrientation.alpha,this.getDirectionMap=()=>void 0!==t.deviceOrientation.webkitCompassHeading?360-t.deviceOrientation.webkitCompassHeading:t.deviceOrientation.alpha,this.connect()};const m=h;let v={STD_TELEP_DURATION:.03,HAND_R:0,HAND_L:1,MOBILE_DENSITY_F:.5,MAX_QUERY_DISTANCE:40,init:()=>{ATON._renderer.xr.enabled=!0,ATON._renderer.xr.setReferenceSpaceType("local"),ATON.device.isMobile?ATON._renderer.xr.setFramebufferScaleFactor(ATON._stdpxd*v.MOBILE_DENSITY_F):ATON._renderer.xr.setFramebufferScaleFactor(ATON._stdpxd),v._bPresenting=!1,v.currSession=null,v._sessionType="immersive-vr",v._bReqPresenting=!1,v.rig=new THREE.Group,v.rig.add(ATON.Nav._camera),ATON._rootUI.add(v.rig),v._cam=void 0,v._currPos=v.rig.position,v._fromPos=new THREE.Vector3,v._reqPos=new THREE.Vector3,v.gControllers=void 0,v.controller0=void 0,v.controller1=void 0,v.controller0pos=new THREE.Vector3,v.controller1pos=new THREE.Vector3,v.controller0dir=new THREE.Vector3,v.controller1dir=new THREE.Vector3,v._lastPosR=void 0,v._lastPosL=void 0,v._pointerLineGeom=void 0,v._pointerLineMesh=void 0,v.gpad0=void 0,v.gpad1=void 0,v._urlHand=ATON.PATH_RES+"models/hand/hand.glb",ATON.on("XRselectStart",(e=>{e===v.HAND_R&&ATON._stdActivation()})),ATON.on("XRselectEnd",(e=>{})),ATON.on("XRsqueezeStart",(e=>{e===v.HAND_R&&ATON.Photon.setFocusStreaming(!0)})),ATON.on("XRsqueezeEnd",(e=>{e===v.HAND_R&&ATON.Photon.setFocusStreaming(!1)})),ATON.on("VRC_IDassigned",(e=>{let t=ATON.getUINode("Rhand"),o=ATON.getUINode("Lhand"),i=ATON.MatHub.materials.avatars,r=i[e%i.length];o&&o.setMaterial(r),t&&t.setMaterial(r)}))},setSessionType:e=>{void 0!==e&&("immersive-vr"!==e&&"immersive-ar"!==e||(v._sessionType=e,console.log("Session type: "+e)))},isPresenting:()=>v._bPresenting,teleportOnQueriedPoint:()=>{if(!ATON.Nav.currentQueryValidForLocomotion())return!1;const e=ATON._queryDataScene.p;return ATON.Nav.requestPOV((new ATON.POV).setPosition(e.x,e.y+ATON.userHeight,e.z),v.STD_TELEP_DURATION),!0},setupQueryRay:e=>{void 0!==e&&(v.controller0?e.set(v.controller0pos,v.controller0dir):e.set(ATON.Nav.getCurrentEyeLocation(),ATON.Nav.getCurrentDirection()))},setRefSpaceLocation:e=>{v.rig.position.copy(e)},_setupControllerR:(e,t)=>{v.controller0||(v.controller0=e,console.log("R controller"),e.addEventListener("selectstart",(()=>{ATON.fireEvent("XRselectStart",v.HAND_R)})),e.addEventListener("selectend",(()=>{ATON.fireEvent("XRselectEnd",v.HAND_R)})),e.addEventListener("squeezestart",(()=>{ATON.fireEvent("XRsqueezeStart",v.HAND_R)})),e.addEventListener("squeezeend",(()=>{ATON.fireEvent("XRsqueezeEnd",v.HAND_R)})),v.setupControllerUI(v.HAND_R,t),ATON.fireEvent("XRcontrollerConnected",v.HAND_R))},_setupControllerL:(e,t)=>{v.controller1||(v.controller1=e,console.log("L controller"),e.addEventListener("selectstart",(()=>{ATON.fireEvent("XRselectStart",v.HAND_L)})),e.addEventListener("selectend",(()=>{ATON.fireEvent("XRselectEnd",v.HAND_L)})),e.addEventListener("squeezestart",(()=>{ATON.fireEvent("XRsqueezeStart",v.HAND_L)})),e.addEventListener("squeezeend",(()=>{ATON.fireEvent("XRsqueezeEnd",v.HAND_L)})),v.setupControllerUI(v.HAND_L,t),ATON.fireEvent("XRcontrollerConnected",v.HAND_L))},setupSceneForAR:()=>{if("immersive-ar"!==v._sessionType)return;ATON.recomputeSceneBounds();let e=ATON.bounds.center;ATON._rootVisible.position.x=-e.x,ATON._rootVisible.position.y=-e.y,ATON._rootVisible.position.z=-e.z,ATON._rootSem.position.x=-e.x,ATON._rootSem.position.y=-e.y,ATON._rootSem.position.z=-e.z,ATON.recomputeSceneBounds()},resetSceneOffsets:()=>{ATON._rootVisible.position.set(0,0,0),ATON._rootSem.position.set(0,0,0),ATON.recomputeSceneBounds()},onSessionStarted:e=>{v.currSession||(v._bReqPresenting=!1,e.addEventListener("end",v.onSessionEnded),e.isImmersive=!0,console.log(v._sessionType+" session started."),ATON.MediaFlow.stopAllStreams(),"immersive-ar"===v._sessionType&&ATON._renderer.xr.setReferenceSpaceType("local"),ATON._renderer.xr.setSession(e).then((()=>{if(v.currSession=e,console.log(v.currSession),"immersive-ar"===v._sessionType)ATON._mainRoot.background=null,ATON._mMainPano&&(ATON._mMainPano.visible=!1),ATON._renderer.xr.getController(0)&&ATON.device.isMobile&&(v.controller0=ATON._renderer.xr.getController(0),v.controller0.addEventListener("selectstart",(()=>{ATON.fireEvent("XRselectStart",v.HAND_R),console.log("Head-aligned select")})),v.controller0.addEventListener("selectend",(()=>{ATON.fireEvent("XRselectEnd",v.HAND_R)})),v.gControllers.add(v.controller0));else{for(let e=0;e<2;e++){const t=ATON._renderer.xr.getController(e);void 0===t||t.userData.bXRconfig||(t.visible=!1,t.userData.bXRconfig=!0,t.addEventListener("connected",(e=>{let o=e.data.handedness;t.gm=e.data.gamepad,console.log("Hand "+o),console.log("GamePad "+t.gm),"left"===o?v._setupControllerL(t,!0):"right"===o?v._setupControllerR(t,!0):(t.addEventListener("selectstart",(()=>{ATON.fireEvent("XRselectStart",v.HAND_R),console.log("Head-aligned select")})),t.addEventListener("selectend",(()=>{ATON.fireEvent("XRselectEnd",v.HAND_R)})),ATON.fireEvent("XRcontrollerConnected",v.HAND_R))})))}v.rig.add(ATON.Nav._camera),v.setRefSpaceLocation(ATON.Nav._currPOV.pos)}let t=ATON._renderer.xr.getCamera(ATON.Nav._camera);ATON.Nav._updCamera(t),v._bPresenting=!0,ATON.Nav._bInteracting=!1,console.log("XR now presenting"),ATON.fireEvent("XRmode",!0),ATON.toggleShadows(!1),ATON.SUI.getSelectorRadius()>ATON.FE.STD_SEL_RAD&&ATON.SUI.setSelectorRadius(ATON.FE.STD_SEL_RAD),ATON._qSyncInt=2,ATON.XPFNetwork.getNumXPFs()>0?ATON.setQueryRange(0,100):ATON.setQueryRange(0,v.MAX_QUERY_DISTANCE),ATON.MRes.estimateTSErrorTarget(),setTimeout((()=>{ATON.SUI.getSelectorRadius()>ATON.FE.STD_SEL_RAD&&ATON.SUI.setSelectorRadius(ATON.FE.STD_SEL_RAD)}),2e3)})))},onSessionEnded:()=>{v.currSession.removeEventListener("end",v.onSessionEnded),v.currSession=null,v._bReqPresenting=!1,v._bPresenting=!1,ATON.Nav._bInteracting=!1,"immersive-ar"===v._sessionType&&ATON._mMainPano&&(ATON._mMainPano.visible=!0),v.setRefSpaceLocation(new THREE.Vector3(0,0,0)),ATON.fireEvent("XRmode",!1),ATON._qSyncInt=1,ATON.MediaFlow.stopAllStreams(),ATON.Nav.requestHome(),ATON.Nav._updCamera(),ATON.setQueryRange(0,1/0),ATON.MRes.estimateTSErrorTarget(),console.log("Quit XR")},toggle:e=>{if(v.setSessionType(e),ATON.device.xrSupported[v._sessionType])if(null===v.currSession){let e={optionalFeatures:["high-refresh-rate"]};"immersive-ar"===v._sessionType&&(void 0===e.optionalFeatures&&(e.optionalFeatures=[]),e.optionalFeatures.push("light-estimation")),v._bReqPresenting=!0,navigator.xr.requestSession(v._sessionType,e).then(v.onSessionStarted)}else v.currSession.end()},setupControllerUI:(e,t)=>{let o,i;if(void 0===v.gControllers&&(v.gControllers=ATON.createUINode(),v.gControllers.disablePicking(),v.rig.add(v.gControllers)),e===v.HAND_L?(v.gControllers.add(v.controller1),t&&(i=ATON.createUINode("Lhand").load(v._urlHand).setMaterial(ATON.MatHub.materials.controllerRay).setScale(-1,1,1),v.controller1.add(i))):(v.gControllers.add(v.controller0),t&&(v._pointerLineGeom=new THREE.CylinderGeometry(.003,.003,1,4),v._pointerLineGeom.rotateX(-Math.PI/2),v._pointerLineGeom.translate(0,0,-.5),v._pointerLineMesh=new THREE.Mesh(v._pointerLineGeom,ATON.MatHub.materials.controllerRay),v.controller0.add(v._pointerLineMesh),v._pointerLineMesh.visible=!1,o=ATON.createUINode("Rhand").load(v._urlHand).setMaterial(ATON.MatHub.materials.controllerRay),v.controller0.add(o))),void 0!==ATON.Photon.uid&&t){let t=ATON.MatHub.materials.avatars,r=t[ATON.Photon.uid%t.length];e===v.HAND_L?i.setMaterial(r):o.setMaterial(r)}},switchHands:()=>{let e=v.controller1;v.controller1=v.controller0,v.controller0=e;for(let e in v.controller0.children)v.controller0.remove(v.controller0.children[e]);for(let e in v.controller1.children)v.controller1.remove(v.controller1.children[e]);v.gControllers.removeChildren(),v.setupControllerUI(v.HAND_L),v.setupControllerUI(v.HAND_R),console.log("VR controllers switched")},getControllerSpace:e=>{1===e?v.getControllerGrip(1):v.getControllerGrip(0)},getControllerWorldLocation:e=>1===e?v.controller1pos:v.controller0pos,getControllerWorldDirection:e=>1===e?v.controller1dir:v.controller0dir,_deltaMotionController:e=>{if(e===v.HAND_L&&void 0===v._lastPosL)return;if(e===v.HAND_R&&void 0===v._lastPosR)return;let t=e===v.HAND_L?v.controller1pos:v.controller0pos,o=e===v.HAND_L?v._lastPosL:v._lastPosR;THREE.Vector3(t.x-o.x,t.y-o.y,t.z-o.z).lengthSq(),e===v.HAND_L?v._lastPosL=t:v._lastPosR=t},update:()=>{v.controller0&&v.controller0.visible&&(v.controller0.getWorldPosition(v.controller0pos),v.controller0.getWorldDirection(v.controller0dir),v.controller0dir.negate()),v.controller1&&v.controller1.visible&&(v.controller1.getWorldPosition(v.controller1pos),v.controller1.getWorldDirection(v.controller1dir),v.controller1dir.negate())},getAxisValue:e=>{let t=new THREE.Vector2(0,0),o=e===v.HAND_L?v.controller1:v.controller0;if(void 0===o)return t;if(void 0===o.gm||void 0===o.gm.axes)return t;let i=o.gm.axes[0],r=o.gm.axes[2],a=o.gm.axes[1],s=o.gm.axes[3];return t.x=i>0?-i:r,t.y=a>0?a:-s,t}};const T=v,g=class extends t{constructor(e,t,o){super(e,ATON.NTYPES.UI),this.baseColor=ATON.MatHub.colors.black,this.baseOpacity=.5,this.container=new ThreeMeshUI.Block({width:t||.2,height:o||.05,padding:.001,borderRadius:.01,backgroundColor:this.baseColor,backgroundOpacity:this.baseOpacity,fontFamily:ATON.SUI.PATH_FONT_JSON,fontTexture:ATON.SUI.PATH_FONT_TEX,justifyContent:"center",textAlign:"center"}),this.container.position.z=.03,this.add(this.container),this.uiText=new ThreeMeshUI.Text({content:"Label",fontSize:.03,fontColor:ATON.MatHub.colors.white}),this.container.add(this.uiText),ThreeMeshUI.update()}setBaseColor(e){return this.baseColor=e,this.container.set({backgroundColor:this.baseColor}),ThreeMeshUI.update(),this}setTextColor(e){return this.uiText.set({fontColor:e}),ThreeMeshUI.update(),this}setBackgroundOpacity(e){return this.container.set({backgroundOpacity:e}),this.baseOpacity=e,ThreeMeshUI.update(),this}setText(e){return this.uiText.set({content:e}),ThreeMeshUI.update(),this}};let S={STD_BTN_SIZE:.1,STD_SELECTOR_TICKNESS:1.05};S.Button=class extends t{constructor(e,t=1,o=1){super(e,ATON.NTYPES.UI),this.baseColor=ATON.MatHub.colors.black,this.switchColor=ATON.MatHub.colors.green,this.baseOpacity=.5,this.hoverOpacity=.8,this._bSwitched=!1,this.container=new ThreeMeshUI.Block({width:.1*t,height:.1,padding:.01,borderRadius:.02,backgroundColor:this.baseColor,backgroundOpacity:this.baseOpacity,fontFamily:ATON.SUI.PATH_FONT_JSON,fontTexture:ATON.SUI.PATH_FONT_TEX,justifyContent:"center",textAlign:"center"}),this.add(this.container),this.uiText=new ThreeMeshUI.Text({content:"",fontSize:.02*o,fontColor:ATON.MatHub.colors.white}),this.container.add(this.uiText);let i=.9*ATON.SUI.STD_BTN_SIZE*t,r=.9*ATON.SUI.STD_BTN_SIZE;this._trigger=new THREE.Mesh(new THREE.PlaneGeometry(i,r,2),ATON.MatHub.materials.fullyTransparent),this._trigger.position.set(0,0,.002),this.add(this._trigger),this.onHover=()=>{this.container.set({backgroundOpacity:this.hoverOpacity})},this.onLeave=()=>{this.container.set({backgroundOpacity:this.baseOpacity})},this.enablePicking(),this.traverse((e=>{e.material&&(e.material.depthWrite=!1)})),ThreeMeshUI.update()}setBaseColor(e){return this.baseColor=e,this._bSwitched||this.container.set({backgroundColor:this.baseColor}),ThreeMeshUI.update(),this}setSwitchColor(e){return this.switchColor=e,this._bSwitched&&this.container.set({backgroundColor:this.switchColor}),ThreeMeshUI.update(),this}setBackgroundOpacity(e){return this.container.set({backgroundOpacity:e}),this.baseOpacity=e,ThreeMeshUI.update(),this}setText(e){return this.uiText.set({content:e}),ThreeMeshUI.update(),this}switch(e){return this._bSwitched=e,e?this.container.set({backgroundColor:this.switchColor}):this.container.set({backgroundColor:this.baseColor}),ThreeMeshUI.update(),this}setIcon(e,t){return ATON.Utils.textureLoader.load(e,(e=>{this._trigger.material=new THREE.MeshStandardMaterial({map:e,transparent:!0,depthWrite:!1}),t&&(this.setBackgroundOpacity(0),this.hoverOpacity=0),this.uiText.position.set(0,-.035,0)})),ThreeMeshUI.update(),this}},S.Label=g,S.MediaPanel=class extends t{constructor(e){super(e,ATON.NTYPES.UI),this._resurl=void 0,this._mediamesh=void 0,this._vs=void 0,this._yratio=1,this._titleYoffs=.6,this._color=ATON.MatHub.colors.black;let t=this;this.onSelect=()=>{t._vs&&t._vs.el}}load(e,t){this._yratio=1,this._mediamesh||(this._mediamesh=new THREE.Mesh(new THREE.PlaneGeometry(1,1)),this.add(this._mediamesh)),e=ATON.Utils.resolveCollectionURL(e);let o=this;return ATON.Utils.isVideo(e)?(this._vs=ATON.MediaFlow.getOrCreateVideoStream(this.nid,e,!1),this._mediamesh.material=this._vs.matStream,this._vs.el.addEventListener("loadedmetadata",(i=>{o._yratio=o._vs.el.videoHeight/o._vs.el.videoWidth,o._mediamesh.scale.y=-o._yratio,o._resurl=e,o._onContentLoad(),t&&t()}))):ATON.Utils.loadTexture(e,(i=>{i.image&&(this._yratio=i.image.height/i.image.width),o._mediamesh.scale.y=o._yratio,o._mediamesh.material=ATON.MatHub.materials.chromakey.clone(),o._mediamesh.material.uniforms.tBase.value=i,o._mediamesh.material.needsUpdate=!0,o._resurl=e,o._onContentLoad(),t&&t()})),this.setPickable(!0),this}setColor(e){return this._color=e,this._labelTitle&&this._labelTitle.setBaseColor(e),this._bd&&(this._bd.material.color=e),this}getMaterial(){return this._mediamesh.material}_onContentLoad(){this._labelTitle&&(this._labelTitle.position.y=this._yratio*this._titleYoffs),this._bd&&(this._bd.scale.y=1.05*this._yratio)}setTitle(e){return this._labelTitle||(this._labelTitle=new g(void 0,.5,.07),this._labelTitle.position.z=-.01,this._labelTitle.attachTo(this)),this._labelTitle.setText(e),this._labelTitle.setBaseColor(this._color),this}toggleTitle(e){return this._labelTitle?(this._labelTitle.toggle(e),this):this}setBackdrop(e){return this._bd=new THREE.Mesh(new THREE.PlaneGeometry(1,1)),this._bd.material=new THREE.MeshStandardMaterial({transparent:!0,side:THREE.DoubleSide,color:this._color,opacity:e||.5}),this._bd.scale.x=1.05,this._bd.scale.y=1.05*this._yratio,this._bd.position.z=-.005,this.add(this._bd),this}},S.init=()=>{S.initSelector(),S.fpTeleport=ATON.createUINode();let e=new THREE.CylinderGeometry(.4,.4,.9,32,1,!0),t=new THREE.Mesh(e,ATON.MatHub.getMaterial("teleportLoc"));t.renderOrder=100,S.fpTeleport.add(t),S.fpTeleport.disablePicking(),S.fpTeleport.visible=!1,ATON._rootUI.add(S.fpTeleport),S.PATH_FONT_JSON||(S.PATH_FONT_JSON=ATON.PATH_RES+"fonts/custom-msdf.json"),S.PATH_FONT_TEX||(S.PATH_FONT_TEX=ATON.PATH_RES+"fonts/custom.png"),S.gMeasures=ATON.createUINode(),S._prevMPoint=void 0,S._measLabels=[],ATON._rootUI.add(S.gMeasures);let o=(new THREE.BufferGeometry).setFromPoints([new THREE.Vector3,new THREE.Vector3]);S._measLine=new THREE.Line(o,ATON.MatHub.getMaterial("measurement")),S._measLine.visible=!1,ATON._rootUI.add(S._measLine),S.gPoints=ATON.createUINode(),ATON._rootUI.add(S.gPoints),S.gLocNodes=ATON.createUINode(),ATON._rootUI.add(S.gLocNodes),S.buildInfoNode(),S.bShowInfo=!0,S._labelScale=ATON.Utils.isMobile()?80:90,S._labelScaleVR=2,S.sprites={},S._sync=0},S.getOrCreateSpritePointEdit=()=>(S.sprites.pointEdit||(S.sprites.pointEdit=new THREE.SpriteMaterial({map:(new THREE.TextureLoader).load(ATON.PATH_RES+"sui-point.png"),color:ATON.MatHub.colors.orange,transparent:!0,opacity:1,depthTest:!1})),S.sprites.pointEdit),S.getOrCreateSpriteSemIcon=()=>(S.sprites.semIcon||(S.sprites.semIcon=new THREE.SpriteMaterial({map:(new THREE.TextureLoader).load(ATON.PATH_RES+"sui-sem.png"),transparent:!0,opacity:1,depthWrite:!1,depthTest:!1})),S.sprites.semIcon),S.getOrCreateSpriteLP=()=>(S.sprites.lp||(S.sprites.lp=new THREE.SpriteMaterial({map:(new THREE.TextureLoader).load(ATON.PATH_RES+"sui-lp.png"),transparent:!0,opacity:1,depthWrite:!1}),S.sprites.lp.sizeAttenuation=!1),S.sprites.lp),S.getOrCreateSpriteWalk=()=>(S.sprites.walk||(S.sprites.walk=new THREE.SpriteMaterial({map:(new THREE.TextureLoader).load(ATON.PATH_RES+"sui-walk.png"),transparent:!0,opacity:1,depthWrite:!1})),S.sprites.walk),S.initSelector=()=>{S.mainSelector=ATON.createUINode(),S._mSelectorSphere=new THREE.Mesh(ATON.Utils.geomUnitSphere,ATON.MatHub.getMaterial("selector")),S._mSelectorSphere.renderOrder=100,S.mainSelector.add(S._mSelectorSphere),S.mainSelector.disablePicking(),S.setSelectorRadius(.05),S.mainSelector.visible=!1,ATON._rootUI.add(S.mainSelector),S._selOffset=new THREE.Vector3,S._bShowSelector=!0},S.enableLPIcons=()=>{S.gLPIcons=ATON.createUINode(),S.gLPIcons.disablePicking(),ATON._rootUI.add(S.gLPIcons)},S.enableSemIcons=()=>{S.gSemIcons=ATON.createUINode(),S.gSemIcons.disablePicking(),ATON._rootUI.add(S.gSemIcons)},S.showSelector=e=>{S._bShowSelector=e},S.setSelectorRadius=e=>{S._selectorRad=e,S.mainSelector.scale.set(e,e,e)},S.setSelectorOffset=(e,t,o)=>{void 0!==e&&(S._selOffset.x=e),void 0!==t&&(S._selOffset.y=t),void 0!==o&&(S._selOffset.z=o);let i=ATON.getSceneQueriedPoint();void 0!==i&&(S.mainSelector.position.x=i.x+S._selOffset.x,S.mainSelector.position.y=i.y+S._selOffset.y,S.mainSelector.position.z=i.z+S._selOffset.z)},S.getSelectorRadius=()=>S._selectorRad,S.getSelectorLocation=()=>S.mainSelector.position,S.setSelectorModel=(e,t)=>{void 0!==e&&(S.mainSelector.removeChildren(),S.mainSelector.load(e).disablePicking(),t&&S.mainSelector.setMaterial(ATON.MatHub.getMaterial("selector")))},S.setSelectorColor=(e,t)=>{let o=ATON.MatHub.materials.selector;o.uniforms.tint.value=e,void 0!==t&&(o.uniforms.opacity.value=t)},S.addSemIcon=(e,t)=>{if(void 0===S.gSemIcons)return;let o=(new THREE.Box3).setFromObject(t),i=new THREE.Sphere;o.getBoundingSphere(i);let r=new THREE.Sprite(S.getOrCreateSpriteSemIcon());r.position.copy(i.center),r.scale.set(.8,.8,1),r.name=e,S.gSemIcons.add(r)},S.addLPIcon=e=>{if(void 0===S.gLPIcons)return;let t=e._near,o=new THREE.Sprite(S.getOrCreateSpriteLP());o.position.copy(e.pos),o.scale.set(.1,.1,.1);let i=new THREE.Mesh(ATON.Utils.geomUnitSphere,ATON.MatHub.materials.lp);i.scale.set(t,t,t),i.position.copy(e.pos),S.gLPIcons.add(o),S.gLPIcons.add(i)},S.setSemIconsOpacity=e=>{ATON.MatHub.spriteSemIcon.opacity=void 0===e?1:e},S.buildInfoNode=()=>{S.infoNode=ATON.createUINode(),S.infoNode.attachToRoot(),S.infoContainer=new ThreeMeshUI.Block({width:.2,height:.05,padding:.01,borderRadius:.02,backgroundColor:ATON.MatHub.colors.black,backgroundOpacity:.4,fontFamily:S.PATH_FONT_JSON,fontTexture:S.PATH_FONT_TEX,justifyContent:"center",textAlign:"center"}),S.infoContainer.position.y=.03,S.infoNode.add(S.infoContainer),S.infoNodeText=new ThreeMeshUI.Text({content:"Info",fontSize:.02,fontColor:ATON.MatHub.colors.white}),S.infoContainer.add(S.infoNodeText),ThreeMeshUI.update()},S.getInfoNode=()=>S.infoNode,S.setInfoNodeText=e=>{S.bShowInfo&&(S.infoNodeText.set({content:e}),ThreeMeshUI.update())},S.createToolbar=(e,t,o)=>{let i=ATON.createUINode(),r=e.length,a=.3*S.STD_BTN_SIZE,s=new ThreeMeshUI.Block({width:S.STD_BTN_SIZE*r*1.1+a,height:S.STD_BTN_SIZE+a,padding:.01,borderRadius:.02,backgroundColor:t||ATON.MatHub.colors.black,backgroundOpacity:void 0!==o?o:.3,fontFamily:S.PATH_FONT_JSON,fontTexture:S.PATH_FONT_TEX,justifyContent:"center",textAlign:"center"}),n=.5*r*S.STD_BTN_SIZE*1.1;n-=.5*S.STD_BTN_SIZE;for(let t=0;t{void 0===o&&(o=1),void 0===i&&(i=1);let r=ATON.createUINode(e),a=new THREE.Mesh(new THREE.PlaneGeometry(o,i,2),ATON.MatHub.materials.fullyTransparent);return r.add(a),void 0!==t&&ATON.Utils.textureLoader.load(t,(e=>{a.material=new THREE.MeshStandardMaterial({map:e,transparent:!0,depthWrite:!1,side:THREE.DoubleSide})})),r},S.createLayout=(e,t)=>{let o=e.children.length;for(let i=0;i{if(void 0===e)return;let t=.01,o=.001;if(void 0===S._prevMPoint){S._prevMPoint=e;let t=S._measLine.geometry.attributes.position.array;return t[0]=e.x,t[1]=e.y,void(t[2]=e.z)}S._measLine.visible=!1;let i=S._prevMPoint.distanceTo(e);t*=i,o*=i;let r=new THREE.Mesh(ATON.Utils.geomUnitCube,ATON.MatHub.getMaterial("measurement"));r.position.copy(S._prevMPoint),r.scale.set(t,t,t),S.gMeasures.add(r);let a=new THREE.Mesh(ATON.Utils.geomUnitCube,ATON.MatHub.getMaterial("measurement"));a.position.copy(e),a.scale.set(t,t,t),S.gMeasures.add(a);let s=2*i,n=(new THREE.BufferGeometry).setFromPoints([S._prevMPoint,e]);S.gMeasures.add(new THREE.Line(n,ATON.MatHub.getMaterial("measurement")));let l=new S.Label;l.setBaseColor(ATON.MatHub.colors.white).setTextColor(ATON.MatHub.colors.black),l.userData.vStart=new THREE.Vector3,l.userData.vEnd=new THREE.Vector3,l.userData.vStart.copy(S._prevMPoint),l.userData.vEnd.copy(e),l.userData.vSEdir=new THREE.Vector3,l.userData.vSEdir.x=l.userData.vStart.x-l.userData.vEnd.x,l.userData.vSEdir.y=l.userData.vStart.y-l.userData.vEnd.y,l.userData.vSEdir.z=l.userData.vStart.z-l.userData.vEnd.z,l.userData.vSEdir.normalize(),l.setPosition(.5*(S._prevMPoint.x+e.x),.5*(S._prevMPoint.y+e.y),.5*(S._prevMPoint.z+e.z)),l.setScale(s).setText(ATON.Utils.getHumanReadableDistance(i)),S.gMeasures.add(l),S._measLabels.push(l);let d={};return d.A=l.userData.vStart,d.B=l.userData.vEnd,S._prevMPoint=void 0,d},S.clearMeasurements=()=>{S.gMeasures.removeChildren(),S._measLabels=[]},S._updateMeasurements=()=>{if(!(S._measLabels.length<=0))for(let e in S._measLabels)S._measLabels[e].orientToCamera()},S.update=()=>{if(ATON.Nav.isTransitioning()||ATON._bPauseQuery)S.infoNode.visible=!1;else{if(S._prevMPoint){if(ATON._queryDataScene){let e=S._measLine.geometry.attributes.position.array;e[3]=ATON._queryDataScene.p.x,e[4]=ATON._queryDataScene.p.y,e[5]=ATON._queryDataScene.p.z,S._measLine.geometry.attributes.position.needsUpdate=!0}S._measLine.visible=!0}else S._measLine.visible=!1;if(ATON._queryDataScene&&!ATON.Nav._bInteracting?(S._bShowSelector&&(S.mainSelector.visible=!0),S.mainSelector.position.x=ATON._queryDataScene.p.x+S._selOffset.x,S.mainSelector.position.y=ATON._queryDataScene.p.y+S._selOffset.y,S.mainSelector.position.z=ATON._queryDataScene.p.z+S._selOffset.z):S.mainSelector.visible=!1,S.gSemIcons&&(ATON.Nav._bInteracting?S.gSemIcons.hide():void 0===ATON._hoveredSemNode&&S.gSemIcons.show()),ATON.Nav.isOrbit()&&!ATON.XR._bPresenting||!ATON.Nav.currentQueryValidForLocomotion()?S.fpTeleport.visible=!1:(S.fpTeleport.visible=!0,S.fpTeleport.position.copy(ATON._queryDataScene.p)),ATON.XR._pointerLineMesh){let e=0;ATON._queryDataScene&&(e=ATON._queryDataScene.d),ATON._queryDataUI&&(e<=0||ATON._queryDataUI.d0?(ATON.XR._pointerLineMesh.visible=!0,ATON.XR._pointerLineMesh.scale.set(1,1,e)):ATON.XR._pointerLineMesh.visible=!1}if(S._updateMeasurements(),ATON._queryDataSem)ATON.XR._bPresenting&&(S.bShowInfo&&(S.infoNode.visible=!0),ATON.XR.controller0?(S.infoNode.position.copy(ATON.XR.controller0pos),S.infoNode.position.x-=.1*ATON.XR.controller0dir.x,S.infoNode.position.y-=.1*ATON.XR.controller0dir.y,S.infoNode.position.z-=.1*ATON.XR.controller0dir.z,S.infoNode.setScale(1)):(S.infoNode.position.lerpVectors(ATON._queryDataSem.p,ATON.Nav._currPOV.pos,.1),S.infoNode.setScale(ATON._queryDataSem.d*S._labelScaleVR)),S.infoNode.orientToCamera()),ATON.Photon._bStreamFocus||(S.mainSelector.visible=!1);else if(ATON.XR._bPresenting&&S.bShowInfo&&ATON._queryDataScene&&void 0!==ATON.XPFNetwork._semCurr){S.infoNode.position.lerpVectors(ATON._queryDataScene.p,ATON.Nav._currPOV.pos,.5);const e=ATON._queryDataScene.d*(ATON.Nav._currPOV.fov/S._labelScale);S.infoNode.setScale(e),S.infoNode.orientToCamera(),S.infoNode.visible=!0}else S.infoNode.visible=!1;if(S.mainSelector.visible&&ATON.Photon._bStreamFocus){let e=S._selectorRad*(1+.2*Math.cos(10*ATON._clock.elapsedTime));S.mainSelector.scale.set(e,e,e);let t=ATON.getSceneFocalPoint();void 0!==t&&void 0!==ATON.plight&&(ATON.enablePointLight(),ATON.plight.position.copy(t),ATON.plight.distance=2*S._selectorRad)}}};const N=S;let O={init:()=>{window.bootstrap&&(O.PATH_RES_ICONS=ATON.PATH_RES+"icons/",O._bModal=!1,O._bSidePanel=!1,O._bSemL=!1,O._setupBase())},createElemementFromHTMLString:e=>{const t=document.createElement("div");return t.innerHTML=e,t.firstElementChild},onContextMenu:()=>!1,_setupBase:()=>{document.body.oncontextmenu=O.onContextMenu,document.body.setAttribute("data-bs-theme","dark"),O.elCenteredOverlay=O.createElemementFromHTMLString('\n
    \n
    Loading...
    \n
    \n\t'),document.body.append(O.elCenteredOverlay),O.hideCenteredOverlay(),O.elLabelCon=document.createElement("div"),O.elLabelCon.classList.add("aton-floating-label-container"),O.elLabel=document.createElement("div"),O.elLabel.classList.add("aton-floating-label"),O.elLabelCon.append(O.elLabel),document.body.prepend(O.elLabelCon),O.hideSemLabel(),O.elModal=O.createElemementFromHTMLString('\n \n\t'),O.modal=new bootstrap.Modal(O.elModal),document.body.append(O.elModal),O.elModalContent=document.getElementById("uiModalContent"),O.elSidePanel=O.createElemementFromHTMLString('\n
    \n\t'),O.sidepanel=new bootstrap.Offcanvas(O.elSidePanel),document.body.append(O.elSidePanel)},showCenteredOverlay:e=>{O.elCenteredOverlay.classList.add("d-flex"),O.elCenteredOverlay.classList.remove("d-none")},hideCenteredOverlay:()=>{O.elCenteredOverlay.classList.remove("d-flex"),O.elCenteredOverlay.classList.add("d-none")},showModal:e=>{if(e){if(O.elModalContent.innerHTML="",e.header){let t=document.createElement("div");t.classList.add("modal-header"),t.innerHTML="",O.elModalContent.append(t)}if(e.body){let t=document.createElement("div");t.classList.add("modal-body"),t.append(e.body),O.elModalContent.append(t)}if(e.footer){let t=document.createElement("div");t.classList.add("modal-footer"),t.append(e.footer),O.elModalContent.append(t)}O.modal.show(),O._bModal=!0}},hideModal:()=>{O.modal.hide(),O._bModal=!1},showSidePanel:e=>{if(e){if(O.elSidePanel.innerHTML="",e.header){let t=document.createElement("div");t.classList.add("offcanvas-header"),t.innerHTML="

    "+e.header+"

    ",O.elSidePanel.append(t)}if(e.body){let t=document.createElement("div");t.classList.add("offcanvas-body"),t.append(e.body),O.elSidePanel.append(t)}O.sidepanel.show(),O._bSidePanel=!0}},hideSidePanel:()=>{O.sidepanel.hide(),O._bSidePanel=!1},addBasicEvents:()=>{ATON.on("NodeRequestFired",(()=>{O.showCenteredOverlay()})),ATON.on("AllNodeRequestsCompleted",(()=>{O.hideCenteredOverlay()})),ATON.on("SemanticNodeHover",(e=>{let t=ATON.getSemanticNode(e);void 0!==t&&(O.showSemLabel(e),t.highlight(),$("canvas").css({cursor:"pointer"}),ATON.SUI.gSemIcons&&ATON.SUI.gSemIcons.hide())})),ATON.on("SemanticNodeLeave",(e=>{let t=ATON.getSemanticNode(e);void 0!==t&&(O.hideSemLabel(),t.restoreDefaultMaterial(),$("canvas").css({cursor:"grab"}),ATON.SUI.gSemIcons&&ATON.SUI.gSemIcons.show())})),ATON.on("SemanticMaskHover",(e=>{O.showSemLabel(e),$("canvas").css({cursor:"pointer"})})),ATON.on("SemanticMaskLeave",(e=>{O.hideSemLabel(),$("canvas").css({cursor:"grab"})})),ATON.addUpdateRoutine(O.update)},update:()=>{if(O._bSemL&&!ATON.XR._bPresenting){let e=.5*ATON._screenPointerCoords.x*window.innerWidth,t=.5*(1-ATON._screenPointerCoords.y)*window.innerHeight;t-=35,O.elLabel.style.transform="translate("+e+"px, "+t+"px)"}},showSemLabel:e=>{O.elLabel.innerHTML=e,O.elLabel.style.display="inline-block",O._bSemL=!0},hideSemLabel:()=>{O.elLabel.style.display="none",O._bSemL=!1},loadPartial:(e,t,o,i)=>{$.get(e,(e=>{t?o?$("#"+t).prepend(e):$("#"+t).append(e):o?$("body").prepend(e):$("body").append(e),i&&i()}))},createButton:e=>{let t=document.createElement("button");if(t.classList.add("btn","aton-btn"),t.setAttribute("type","button"),e.variant&&t.classList.add("btn-"+e.variant),e.text&&(t.innerText=e.text),e.icon){let o=O.PATH_RES_ICONS+e.icon+".png";e.icon.includes("/")&&(o=e.icon),t.prepend(O.createElemementFromHTMLString(""))}return e.onpress&&(t.onclick=e.onpress),t},createTabGroup:e=>{let t=ATON.Utils.generateID("tabgroup"),o=document.createElement("div"),i=document.createElement("ul");i.classList.add("nav","nav-tabs","nav-justified"),i.setAttribute("role","tablist");let r=document.createElement("div");r.classList.add("tab-content"),o.append(i),o.append(r);for(let o=0;o"+n+"":"",i.append(c),a=0===o?O.createElemementFromHTMLString("
    "):O.createElemementFromHTMLString("
    "),a.style.padding="10px 0px 10px 0px",a.append(l),r.append(a)}return o}};const A=O;let P={USER_STATE_FREQ:.25,REPLICATED_EVT:"EREP",THRES_STATE_POS:.01,THRES_STATE_ORI:.08};P.Avatar=class extends t{constructor(e){super(void 0,ATON.NTYPES.UI),this.userid=e,this.username=void 0,this.message="...",this.color=ATON.Photon.ucolors[this.userid%ATON.Photon.ucolors.length],this._auTalk=[],this._auTalk.push(new THREE.PositionalAudio(ATON.AudioHub._listener)),this._auTalk.push(new THREE.PositionalAudio(ATON.AudioHub._listener));for(let e=0;e<2;e++)this._auTalk[e].setRefDistance(30),this._auTalk[e].setLoop(!1),this.add(this._auTalk[e]);this._auTalki=0,this.bMuted=!1,this._bPlayingAudio=!1,this._blob=void 0,this._b64=void 0,this._tStateCall=-1,this._tProgress=0,this._tFocCall=-1,this._currFocusPos=new THREE.Vector3,this._tgtFocusPos=new THREE.Vector3,this._currState={position:new THREE.Vector3,quaternion:new THREE.Quaternion,scale:1},this._tgtState={position:new THREE.Vector3,quaternion:new THREE.Quaternion,scale:1},this.userlabelnode=void 0,this.mStream=void 0,this._elVStream=void 0,this.realize()}getColor(){return this.color}setTalkDistance(e){e>0&&this._auTalk.setRefDistance(e)}setMuted(e){this.bMuted=e}getAvatarMaterialByUID(e){let t=ATON.MatHub.materials.avatars;return t[e%t.length]}_buildLabel(){this.userlabelnode=ATON.createUINode(),this.labelcontainer=new ThreeMeshUI.Block({width:.7,height:.25,padding:.03,borderRadius:.05,backgroundColor:ATON.MatHub.colors.black,fontFamily:ATON.SUI.PATH_FONT_JSON,fontTexture:ATON.SUI.PATH_FONT_TEX,justifyContent:"center",textAlign:"center"}),this.userlabelnode.position.y=.4,this.userlabelnode.add(this.labelcontainer),this.usernametext=new ThreeMeshUI.Text({content:"User #"+this.userid,fontSize:.09,fontColor:this.color}),this.usernametext.position.y=0,this.usermessagetext=new ThreeMeshUI.Text({content:"\n...",fontSize:.03,fontColor:ATON.MatHub.colors.white}),this.usermessagetext.position.y=0,this.labelcontainer.add(this.usernametext),this.labelcontainer.add(this.usermessagetext),this.add(this.userlabelnode),ThreeMeshUI.update()}realizeStreamPanel(){let e=ATON.MediaFlow.getOrCreateVideoStream(this.userid,void 0,!0);this._elVStream=e.el;let t=new THREE.PlaneGeometry(1,1);this.mStream=new THREE.Mesh(t,e.matStream),this.mStream.position.y=1;let o=.5625;this.mStream.scale.y=-o,this.mStream.position.y=.8*o,this._elVStream.addEventListener("loadedmetadata",(e=>{o=this._elVStream.videoHeight/this._elVStream.videoWidth,this.mStream.scale.y=-o,this.mStream.position.y=.8*o}))}getStreamPanel(){return this.mStream}toggleStreamPanel(e){void 0!==this.mStream&&(this.mStream.visible=e)}realize(){let e=new THREE.SphereGeometry(.2,16,16);ATON.Photon.customAvatarMaterial?this.usermaterial=ATON.Photon.customAvatarMaterial():this.usermaterial=this.getAvatarMaterialByUID(this.userid);let t=new THREE.Mesh(e,this.usermaterial);this.usermeshnode=ATON.createUINode(),this.usermeshnode.add(t),this.usermeshnode.setMaterial(this.usermaterial),this.usermeshnode.setCloneOnLoadHit(!1),this.add(this.usermeshnode),this.userauinode=new THREE.Sprite(ATON.Photon.uspritemats[this.userid%ATON.Photon.uspritemats.length]),this.userauinode.position.set(0,0,0),this.userauinode.visible=!1,this.add(this.userauinode),this.userfpnode=new THREE.Sprite(ATON.Photon.ufocmats[this.userid%ATON.Photon.ufocmats.length]),this.userfpnode.position.set(0,0,0),this.userfpnode.visible=!1,void 0===ATON.Photon._focNodes[this.userid]&&(ATON.Photon._focNodes[this.userid]=this.userfpnode,ATON.Photon.focGroup.add(this.userfpnode)),this._buildLabel()}loadRepresentation(e){let t=this;return void 0!==t.usermeshnode.children[0]&&t.usermeshnode.remove(t.usermeshnode.children[0]),t.usermeshnode.load(e),this}setUsername(e){return void 0===this.userlabelnode||(this.username=e,this.usernametext.set({content:e}),ThreeMeshUI.update()),this}getUsername(){if(void 0!==this.userid)return void 0===this.username?"User #"+this.userid:this.username}setMessage(e){return void 0===this.userlabelnode||(this.message=e,this.usermessagetext.set({content:"\n"+e}),ThreeMeshUI.update()),this}setTalkVolume(e){if(void 0!==e)if(e>0){this.userauinode.visible=!0;let t=.1+.03*e;this.userauinode.scale.set(t,t,t)}else this.userauinode.visible=!1;else this.userauinode.visible=!1}hideFocalPoint(){this.userfpnode.visible=!1}requestFocus(e){if(void 0===e)return;if(this._tFocCall>=0)return;this._tFocCall=ATON._clock.elapsedTime,this._currFocusPos.copy(this.userfpnode.position);let t=this.scale.x*ATON._worldScale,o=parseFloat(e[0])*t,i=parseFloat(e[1])*t,r=parseFloat(e[2])*t,a=parseFloat(e[3])*t;this._tgtFocusPos.set(o,i,r),this._tgtFocusRad=2*a,this.userfpnode.scale.set(this._tgtFocusRad,this._tgtFocusRad,this._tgtFocusRad),this.userfpnode.visible=!0,ATON.enablePointLight(),ATON.plight.color=this.color,ATON.plight.position.copy(this._tgtFocusPos),ATON.plight.distance=this._tgtFocusRad}handleFocusTransition(){if(this._tFocCall<0)return;let e=ATON.Photon.USER_STATE_FREQ,t=(ATON._clock.elapsedTime-this._tFocCall)/e;if(t>=1)return this._tFocCall=-1,this.userfpnode.position.copy(this._tgtFocusPos),this.userfpnode.scale.set(this._tgtFocusRad,this._tgtFocusRad,this._tgtFocusRad),void(this.userfpnode.visible=!0);this.userfpnode.position.lerpVectors(this._currFocusPos,this._tgtFocusPos,t),ATON.plight.position.copy(this.userfpnode.position),this.userfpnode.visible=!0}requestStateTransition(e){this._tStateCall>=0||void 0!==e&&(this._tStateCall=ATON._clock.elapsedTime,this._currState.position.copy(this.position),this._currState.quaternion.copy(this.quaternion),this._currState.scale=this.scale,this._tgtState.position.copy(e.position),this._tgtState.quaternion.copy(e.quaternion),this._tgtState.scale=1/e.scale)}handleStateTransition(){if(this._tStateCall<0)return;let e=ATON.Photon.USER_STATE_FREQ;this._tProgress=e<=0?1:(ATON._clock.elapsedTime-this._tStateCall)/e;let t=this._currState,o=this._tgtState;if(this._tProgress>=1)return this._tStateCall=-1,this.position.copy(o.position),void this.usermeshnode.quaternion.copy(o.quaternion);this.position.lerpVectors(t.position,o.position,this._tProgress),this.usermeshnode.quaternion.slerp(o.quaternion,this._tProgress)}update(){if(this.handleStateTransition(),this.userfpnode&&this.userfpnode.visible){this.handleFocusTransition();let e=this.userfpnode.scale.x;e>.001?(this.userfpnode.scale.set(.99*e,.99*e,.99*e),ATON.plight.intensity*=.99):(this.userfpnode.visible=!1,ATON.disablePointLight())}let e=ATON.Nav._camera,t=ATON.Nav._currPOV.pos;if(void 0===e||void 0===t)return;this.userlabelnode&&this.userlabelnode.orientToCamera();let o=this.userauinode.scale.x;o*=.99,o>.01?this.userauinode.scale.set(o,o,o):this.userauinode.visible=!1}_handleTalk(){if(this._auTalk.isPlaying)return;if(this._auChunks.length<2)return;let e=this._auChunks[this._iAU];this._auTalk.setBuffer(e),this._auTalk.play(),this.setTalkVolume(5)}_handleTalkOLD(){if(this._bPlayingAudio)return;if(this._auChunks.length<1)return;let e=this._auChunks.shift();this._auTalk.setBuffer(e),this._auTalk.play(),this._bPlayingAudio=!0,this._auTalk.onended=()=>{this._bPlayingAudio=!1,e=null},this.setTalkVolume(5)}},P.init=()=>{P.address=window.location.origin,P.initMaterials(),P.socket=void 0,P._connected=!1,P._reqSSID=void 0,P._username=void 0,P.uid=void 0,P.color=ATON.MatHub.colors.white,P._bStreamFocus=!1,P._numUsers=1,P.avatarList=[],P.avaGroup=ATON.createUINode("avatars"),P.avaGroup.attachToRoot(),P.focGroup=ATON.createUINode("focus"),P.focGroup.attachTo(P.avaGroup),P._focNodes=[],P.bSendState=!0,window.setInterval(P.sendState,1e3*P.USER_STATE_FREQ),P._lastStateSent=void 0,P._bShowAvaG=!0,P._bSpatial=!0,console.log("Photon initialized"),P.enableChatLog(),P._elVStream=void 0,P._decS={quaternion:new THREE.Quaternion,position:new THREE.Vector3},P.customAvatarMaterial=void 0,window.addEventListener("beforeunload",(e=>{P.disconnect()}))},P.setCustomAvatarMaterialRoutine=e=>{P.customAvatarMaterial=e},P.enableChatLog=()=>{P._elChat=$("
    ").text("")},P.getNumUsers=()=>P._numUsers,P.initMaterials=()=>{P.ucolorhex=[],P.ucolorhex.push("#F00"),P.ucolorhex.push("#FF0"),P.ucolorhex.push("#0F0"),P.ucolorhex.push("#0FF"),P.ucolorhex.push("#00F"),P.ucolorhex.push("#F0F"),P.ucolorhex_light=[],P.ucolorhex_light.push("#FAA"),P.ucolorhex_light.push("#FFA"),P.ucolorhex_light.push("#AFA"),P.ucolorhex_light.push("#AFF"),P.ucolorhex_light.push("#AAF"),P.ucolorhex_light.push("#FAF"),P.ucolors=[],P.ucolors.push(new THREE.Color(P.ucolorhex[0])),P.ucolors.push(new THREE.Color(P.ucolorhex[1])),P.ucolors.push(new THREE.Color(P.ucolorhex[2])),P.ucolors.push(new THREE.Color(P.ucolorhex[3])),P.ucolors.push(new THREE.Color(P.ucolorhex[4])),P.ucolors.push(new THREE.Color(P.ucolorhex[5])),P.ucolorsdark=[],P.ucolorsdark.push(new THREE.Color(.2,0,0)),P.ucolorsdark.push(new THREE.Color(.2,.2,0)),P.ucolorsdark.push(new THREE.Color(0,.2,0)),P.ucolorsdark.push(new THREE.Color(0,.2,.2)),P.ucolorsdark.push(new THREE.Color(0,0,.2)),P.ucolorsdark.push(new THREE.Color(.2,0,.2));let e=ATON.MatHub.materials;e.avatars=[];for(let t=0;t{if(!P._connected)return;let o=P.socket;o&&o.emit(P.REPLICATED_EVT,{e,d:t})},P.on=(e,t)=>{if(void 0===t)return;let o=ATON.EventHub.evNetwork;void 0===o[e]&&(o[e]=[]),o[e].push(t)},P.isConnected=()=>void 0!==P.socket&&P._connected,P.hasID=()=>void 0!==P.uid,P.log=e=>{if(!P._connected)return;let t=P.socket;t&&t.emit("UMSG",e)},P.joinSession=e=>{P.socket&&(void 0===e&&(e=ATON.SceneHub.currID),void 0!==e?(console.log("Joining Photon session '"+e+"'..."),P.socket.emit("SENTER",e)):console.log("Photon ERROR: current session ID is undefined"))},P.requestSceneState=()=>{P.socket&&P.socket.emit("SSTATE")},P.setAvatarsVisibility=e=>{P._bShowAvaG=e,e?P.avaGroup.show():P.avaGroup.hide()},P.disableSpatiality=()=>{P._bSpatial=!1},P.enableSpatiality=()=>{P._bSpatial=!0},P.setAddress=e=>{e&&(P.address=e)},P.connect=e=>{if(P._connected)return;P._reqSSID=e;let t={};ATON.Utils.isConnectionSecure()?(t.path="/svrc/socket.io",t.secure=!0,t.rejectUnauthorized=!1):t.path="/vrc/socket.io",P.socket=io.connect(P.address,t),void 0!==P.socket&&(P._connected=P.socket.connected,P._registerSocketHandlers())},P.disconnect=()=>{void 0!==P.socket&&(P._numUsers=1,P.socket.disconnect(),P.color=ATON.MatHub.colors.white,ATON.plight.color=ATON.MatHub.colors.white,P._connected=!1)},P._onConnected=()=>{},P.setUsername=e=>{(e=e.trim()).length<1||(P._username=e,void 0!==P.socket&&void 0!==P.uid&&(P.appendToChatBox("Your username is now: "+e+""),P.socket.emit("UNAME",e)))},P.setMessage=e=>{(e=e.trim()).length<1||e.length>3e3||(P._msg=e,void 0!==P.socket&&void 0!==P.uid&&(P.socket.emit("UMSG",e),P._elChat&&(e=P.chatMessageProcessor(P.uid,e),P.appendToChatBox("
    YOU
    : "+e+""))))},P.appendToChatBox=e=>{P._elChat&&(P._elChat.append("
    "+e+"
    "),P._elChat.scrollTop(P._elChat[0].scrollHeight))},P._registerSocketHandlers=()=>{P.socket.on("connect",(()=>{P._connected=!0,void 0!==P._reqSSID?P.joinSession(P._reqSSID):P.joinSession(ATON.SceneHub.currID),console.log("Connected to Photon service!"),ATON.fireEvent("VRC_Connected"),P._onConnected()})),P.socket.on("disconnect",(()=>{P._connected=!1,P.uid=void 0,P.avaGroup.hide(),P.appendToChatBox("YOU disconnected from the Photon session"),console.log("Disconnected from Photon service!"),ATON.fireEvent("VRC_Disconnected")})),P.socket.on(P.REPLICATED_EVT,(e=>{let t=e.e,o=e.d,i=ATON.EventHub.evNetwork[t];ATON.EventHub.executeHandlers(i,o)})),P.socket.on("ID",(e=>{console.log("Your ID is "+e),P.uid=e,P.color=P.ucolors[P.uid%P.ucolors.length],P._bShowAvaG&&P.avaGroup.show(),P.appendToChatBox("Your ID is #"+e+""),P.requestSceneState(),ATON.fireEvent("VRC_IDassigned",e)})),P.socket.on("SSTATE",(e=>{P._numUsers=e.numUsers,console.log("Num. users: "+P._numUsers),ATON.fireEvent("VRC_SceneState",e)})),P.socket.on("UENTER",(e=>{let t=e;console.log("User #"+t+" entered the session"),P.appendToChatBox("User #"+t+" entered the session"),P.requestSceneState(),ATON.fireEvent("VRC_UserEnter",t)})),P.socket.on("ULEAVE",(e=>{let t=e;if(void 0===t)return;let o=P.avatarList[t];o&&(o.toggleStreamPanel(!1),o.hide()),console.log("User #"+t+" left the session"),P.appendToChatBox("User #"+t+" left the session"),P.requestSceneState(),ATON.fireEvent("VRC_UserLeave",t)})),P.socket.on("USTATE",(e=>{if(!P._bShowAvaG)return;if(!P._bSpatial)return;let t=P.decodeState(e),o=t.userid,i=P.touchAvatar(o);i.requestStateTransition(t);let r=1/t.scale;i.scale.set(r,r,r)})),P.socket.on("UFOCUS",(e=>{if(!P._bSpatial)return;let t=e.uid,o=e.fp;P.touchAvatar(t).requestFocus(o)})),P.socket.on("UNAME",(e=>{let t=e.uid,o=e.name;void 0!==t&&(P.touchAvatar(t).setUsername(o),console.log("User #"+t+" changed username to: "+o),P.appendToChatBox("User #"+t+" changed username to: "+o+""),ATON.fireEvent("VRC_UName",e))})),P.socket.on("UMSG",(e=>{let t=e.uid,o=e.msg;if(void 0===t)return;let i=P.touchAvatar(t);o.length<100&&i.setMessage(o),console.log("User #"+t+": "+o);let r=i.getUsername();o=P.chatMessageProcessor(t,o),P.ucolorhex[t%6];let a=P.ucolorhex_light[t%6];P.appendToChatBox("
    "+r+"
    : "+o+""),ATON.fireEvent("VRC_UMessage",e)})),P.socket.on("UTALK",(e=>{let t=e.uid;if(void 0===t)return;let o=e.audio;if(o){if(P._bSpatial){let e=P.touchAvatar(t);if(e.bMuted)return;ATON.AudioHub._loader.load(o,(t=>{let o=e._auTalk[e._auTalki],i=(e._auTalki+1)%2;o.setBuffer(t),o.isPlaying||o.play(),e.setTalkVolume(5),e._auTalki=i}))}ATON.fireEvent("VRC_UTalk",e),o=null}})),P.socket.on("UTALKSTOP",(e=>{void 0!==e.uid&&ATON.fireEvent("VRC_UTalkStop",e)})),P.socket.on("UVIDEO",(e=>{void 0!==e.uid&&ATON.fireEvent("VRC_UVideo",e)})),P.socket.on("UVIDEOSTOP",(e=>{let t=e.uid;if(void 0===t)return;let o=P.avatarList[t];o&&o.toggleStreamPanel(!1),ATON.fireEvent("VRC_UVideoStop",e)}))},P.chatMessageProcessor=(e,t)=>{const o=(t=String(t)).match(/(((ftp|https?):\/\/)[\-\w@:%_\+.~#?,&\/\/=]+)/g);return o&&o.forEach((e=>{t=t.replace(e,""+e+"")})),t},P.encodeState=e=>{if(!e)return;let t=new Float32Array(5);t[0]=e.position.x,t[1]=e.position.y,t[2]=e.position.z;var o=new Int8Array(t.buffer);return o[12]=128*e.quaternion.x,o[13]=128*e.quaternion.y,o[14]=128*e.quaternion.z,o[15]=128*e.quaternion.w,o[16]=e.userid,o[17]=ATON._ws,o},P.decodeState=e=>{let t=new Int8Array(e);P._decS.userid=t[16];let o=ATON._unpackScale(t[17]);return P._decS.scale=o,P._decS.quaternion.set(parseFloat(t[12])/128,parseFloat(t[13])/128,parseFloat(t[14])/128,parseFloat(t[15])/128),t=new Float32Array(e),P._decS.position.set(parseFloat(t[0])/o,parseFloat(t[1])/o,parseFloat(t[2])/o),P._decS},P.update=()=>{if(P._connected)for(let e=0;e{if(void 0!==e){if(e)return P._bStreamFocus||(ATON.fireEvent("VRC_FocusStreamingStarted"),ATON.enablePointLight(),ATON.plight.color=ATON.Photon.color),void(P._bStreamFocus=!0);{P._bStreamFocus&&(ATON.fireEvent("VRC_FocusStreamingStopped"),ATON.disablePointLight());let e=ATON.SUI._selectorRad;ATON.SUI.mainSelector.scale.set(e,e,e),P._bStreamFocus=!1}}},P.sendState=()=>{if(!P.bSendState||!P._bSpatial)return;if(void 0===P.uid)return;if(!P.socket||!P._connected)return;let e=ATON.Nav._currPOV;if(!e)return;let t=ATON.getSceneFocalPoint();if(P._bStreamFocus&&void 0!==t){let e=t.x.toFixed(3),o=t.y.toFixed(3),i=t.z.toFixed(3),r=ATON.SUI.getSelectorRadius().toFixed(3);P.socket.emit("UFOCUS",[e,o,i,r])}if(!e.pos)return;if(!ATON.Nav._qOri)return;if(void 0!==P._lastStateSent){let t=P._lastStateSent.position,o=P._lastStateSent.quaternion,i=t.distanceToSquared(e.pos),r=o.angleTo(ATON.Nav._qOri);if(iP.avatarList[e],P.touchAvatar=e=>{if(void 0===P.avatarList[e]){let t=new P.Avatar(e);t.attachTo(P.avaGroup),t.loadRepresentation(ATON.PATH_RES+"models/vrc/head.gltf"),P.avatarList[e]=t}let t=P.avatarList[e];return t.visible||ATON.fireEvent("VRC_UserEnter",e),P._bShowAvaG&&t.show(),t},P.destroyAvatar=e=>{let t=P.avatarList[e];void 0!==t&&t.destroy()},P.clearAllAvatars=()=>{for(let e in P.avatarList)P.avatarList[e].hide()};const b=P;let E={FLOAT_PREC:5,init:()=>{E.bConvexBuilding=!1,E.convexPoints=[],E.convexNode=void 0,E.currConvexMesh=void 0,E.currSemNode=ATON.createSemanticNode(),E.currSemNode.disablePicking(),E.currSemNode.attachToRoot(),E.resetMaterial(),E._numShapes=0},resetMaterial:()=>{E.currMaterial=ATON.MatHub.getMaterial("semanticShapeHL")},setMaterial:e=>{void 0!==e&&(E.currMaterial=e)},addConvexPoint:e=>{if(void 0===e)return!1;if(E.convexPoints.length>0){let t=E.convexPoints[E.convexPoints.length-1];if(e.equals(t))return!1}E.convexPoints.push(e);let t=E.convexPoints.length,o=new THREE.Sprite(ATON.SUI.getOrCreateSpritePointEdit()),i=.02*ATON.getSceneQueriedDistance();if(void 0===i&&(i=.02),o.position.copy(e),o.scale.set(i,i,i),ATON.SUI.gPoints.add(o),t<4)return!1;let r=new THREE.ConvexGeometry(E.convexPoints),a=new THREE.Mesh(r,ATON.MatHub.getMaterial("semanticShapeEdit"));if(E.bConvexBuilding){let t=E.currConvexMesh;t.geometry.dispose(),t.geometry=r,ATON.Utils.setVectorPrecision(e,4),t.userData._convexPoints.push(e.x),t.userData._convexPoints.push(e.y),t.userData._convexPoints.push(e.z)}else{E.currSemNode.add(a),a.userData._convexPoints=[];for(let e=0;e{if(0!==E.convexPoints.length&&(E.convexPoints.pop(),E.currConvexMesh)){let e=E.currConvexMesh.userData;e._convexPoints&&e._convexPoints.pop()}},stopCurrentConvex:()=>{E.bConvexBuilding&&(E.convexPoints=[],E.bConvexBuilding=!1,E.currSemNode.removeChildren(),ATON.SUI.gPoints.removeChildren())},getCurrentConvexShape:()=>E.currSemNode,isBuildingShape:()=>E.convexPoints.length>0,completeConvexShape:e=>{if(E.convexPoints=[],E.bConvexBuilding=!1,void 0===E.currSemNode)return;void 0===e&&(e="sem"+E._numShapes);let t=ATON.getSemanticNode(e)||ATON.createSemanticNode(e),o=E.currSemNode.children[0];return ATON.SUI.addSemIcon(e,o),t.add(o),t.setMaterial(ATON.MatHub.materials.semanticShape),t.setDefaultAndHighlightMaterials(ATON.MatHub.materials.semanticShape,E.currMaterial),t.enablePicking(),E.currSemNode.removeChildren(),E._numShapes++,ATON.SUI.gPoints.removeChildren(),ATON._bqSem=!0,t},createConvexShape:(e,t)=>{let o=new THREE.ConvexGeometry(t),i=new THREE.Mesh(o,ATON.MatHub.materials.semanticShape);i.userData._convexPoints=[];for(let e=0;e{if(void 0===ATON._queryDataScene)return!1;void 0===e&&(e=.02);let t=ATON._queryDataScene.p,o=ATON.Nav.getCurrentEyeLocation();return t.lerpVectors(t,o,e),E.addConvexPoint(t),t},createSphere:(e,t,o)=>{if(void 0===t)return;if(void 0===o)return;void 0===e&&(e="sem"+E._numShapes);let i=ATON.getOrCreateSemanticNode(e),r=new THREE.Mesh(ATON.Utils.geomUnitSphere,ATON.MatHub.materials.semanticShape),a=new THREE.Object3D;return a.position.copy(t),a.scale.set(o,o,o),a.add(r),ATON.SUI.addSemIcon(e,a),i.add(a),i.enablePicking(),i.setDefaultAndHighlightMaterials(ATON.MatHub.materials.semanticShape,E.currMaterial),E._numShapes++,ATON._bqSem=!0,i},createSurfaceSphere:e=>{if(!ATON._queryDataScene)return;let t=ATON._queryDataScene.p,o=ATON.SUI.getSelectorRadius();return E.createSphere(e,t,o)},deleteSemanticNode:e=>{let t=ATON.getSemanticNode(e);if(void 0===t)return!1;if(t.removeChildren(),void 0===ATON.SUI.gSemIcons)return!0;for(let t in ATON.SUI.gSemIcons.children){let o=ATON.SUI.gSemIcons.children[t];o&&o.name===e&&ATON.SUI.gSemIcons.removeChild(o)}return!0}};const f=E;let R={SEMSHAPE_SPHERE:0,SEMSHAPE_CONVEX:1,POPUP_DT:500,STD_SEL_RAD:.05,_bRealized:!1,realize:()=>{if(R._bRealized)return;R.PATH_RES_ICONS=ATON.PATH_RES+"icons/",R._bPopup=!1,R._tPopup=void 0,R.popupBlurBG=0,R._userAuth={},R._bControlLight=!1,R._bControlSelScale=!1,R._cLightDir=new THREE.Vector3,R._auSemNode=void 0,R._auSemNodePlaying=!1,R._bReqHome=!1,R._bVRCsetup=!1,R.urlParams=new URLSearchParams(window.location.search),R._uiSetupBase(),R._uiProfiles={},R._uiCurrProfile=void 0,R._selRanges=[.01,50],R._selRefRadius=.5,ATON.realize(),ATON.on("Fullscreen",(e=>{R.uiSwitchButton("fullscreen",e)}));let e=ATON.FE.urlParams.get("d");e&&e>0&&(ATON.setDefaultPixelDensity(e),ATON.toggleAdaptiveDensity(!1));let t=ATON.FE.urlParams.get("dd");t&&t>0&&ATON.toggleAdaptiveDensity(!0),R._canvas=ATON._renderer.domElement,R._bSem=!1,R._bShowSemLabel=!0,R._bRealized=!0,R.loadSceneID=ATON.App.loadScene},_handleHomeReq:()=>{R._bReqHome||ATON.getRootScene().getBound().radius<=0||(R._bReqHome=!0,void 0!==ATON.Nav.homePOV?ATON.Nav.requestHome(1):ATON.Nav.computeAndRequestDefaultHome(.5))},addBasicLoaderEvents:()=>{ATON.on("NodeRequestFired",(()=>{$("#idLoader").show()})),ATON.on("SceneJSONLoaded",(()=>{ATON.SceneHub.getDescription()&&$("#btn-info").show(),void 0!==ATON.Nav.homePOV&&ATON.Nav.requestHome(1),ATON.XPFNetwork._list.length>0&&void 0===ATON.Nav.homePOV&&(ATON.XPFNetwork.setHomeXPF(0),ATON.XPFNetwork.requestTransitionByIndex(0))})),ATON.on("AllNodeRequestsCompleted",(()=>{$("#idLoader").hide(),ATON.CC.anyCopyrightFound()&&$("#btn-cc").show(),R.computeSelectorRanges(),ATON.SUI.setSelectorRadius(Math.min(R.STD_SEL_RAD,R._selRefRadius)),R._handleHomeReq()})),ATON.on("XR_support",(e=>{"immersive-vr"===e.type&&(e.v?$("#btn-vr").show():$("#btn-vr").hide())})),ATON.on("SemanticNodeHover",(e=>{let t=ATON.getSemanticNode(e);void 0!==t&&(R.showSemLabel(e),R._bSem=!0,t.highlight(),$("canvas").css({cursor:"crosshair"}),ATON.SUI.gSemIcons&&ATON.SUI.gSemIcons.hide())})),ATON.on("SemanticNodeLeave",(e=>{let t=ATON.getSemanticNode(e);void 0!==t&&(R.hideSemLabel(),R._bSem=!1,t.restoreDefaultMaterial(),$("canvas").css({cursor:"grab"}),ATON.SUI.gSemIcons&&ATON.SUI.gSemIcons.show())})),ATON.on("SemanticMaskHover",(e=>{R.showSemLabel(e),R._bSem=!0,$("canvas").css({cursor:"crosshair"})})),ATON.on("SemanticMaskLeave",(e=>{R.hideSemLabel(),R._bSem=!1,$("canvas").css({cursor:"grab"})})),ATON.addUpdateRoutine(R._update)},showSemLabel:e=>{R._bShowSemLabel&&($("#idPopupLabel").html(e),$("#idPopupLabel").show(),ATON.SUI.setInfoNodeText(e))},hideSemLabel:()=>{$("#idPopupLabel").hide(),$("#idPopupLabel").html("")},controlLight:e=>{R._bControlLight=e,ATON.Nav.setUserControl(!e)},controlSelectorScale:e=>{R._bControlSelScale=e,ATON._bPauseQuery=e,ATON.Nav.setUserControl(!e)},attachGizmoToNode:e=>{if(void 0===ATON._gizmo)return;let t=ATON.getSceneNode(e);void 0!==t&&ATON._gizmo.attach(t)},useMouseWheelToScaleSelector:e=>{void 0===e&&(e=.9),ATON.on("MouseWheel",(t=>{if(ATON._kModCtrl){let e=ATON.Nav.getFOV();return t>0?e+=1:e-=1,void ATON.Nav.setFOV(e)}if(ATON._kModShift){let o=ATON.SUI.mainSelector.scale.x;return t>0?o*=e:o/=e,oR._selRanges[1]&&(o=R._selRanges[1]),void ATON.SUI.setSelectorRadius(o)}}))},_update:()=>{if(R._bControlLight){const e=ATON._screenPointerCoords.x,t=ATON._screenPointerCoords.y;R._cLightDir.x=-Math.cos(e*Math.PI),R._cLightDir.y=4*-t,R._cLightDir.z=-Math.sin(e*Math.PI),R._cLightDir.normalize(),ATON.setMainLightDirection(R._cLightDir)}if(ATON.XR._bPresenting){let e=ATON.XR.getAxisValue(ATON.XR.HAND_R);if(!ATON.Photon._bStreamFocus){let t=ATON.SUI._selectorRad;t+=.01*e.y,t>.001&&ATON.SUI.setSelectorRadius(t)}}else{if(ATON.Nav.isTransitioning()||ATON.Nav._bInteracting||ATON._bPauseQuery)return void $("#idPopupLabel").hide();if(R._bSem&&R._bShowSemLabel){$("#idPopupLabel").show();let e=.5*ATON._screenPointerCoords.x*window.innerWidth,t=.5*(1-ATON._screenPointerCoords.y)*window.innerHeight;t-=55,$("#idPopupLabel").css("transform","translate("+e+"px, "+t+"px)")}else $("#idPopupLabel").hide()}},uiBasicSetup:()=>{R.uiAddButton("idTopToolbar","fullscreen",ATON.toggleFullScreen),ATON.Utils.isConnectionSecure()&&R.uiAddButton("idTopToolbar","vr",ATON.XR.toggle),R.uiAddButton("idBottomToolbar","home",(()=>{ATON.Nav.requestHome(.1)}))},_uiSetupBase:()=>{$("#idPopup").click(R.popupClose),$("#idLoader").html(""),$("body").prepend("
    "),R.hideSemLabel()},uiAddButton:(e,t,o,i)=>{let r,a;t.endsWith(".png")?(r=t,a=t.slice(0,-4)):(r=R.PATH_RES_ICONS+t+".png",a=t);let s=$("
    ");$("#"+e).append(s),o&&s.click(o),i&&s.attr("title",i)},uiSwitchButton:(e,t)=>{t?$("#btn-"+e).addClass("switchedON"):$("#btn-"+e).removeClass("switchedON")},uiSetButtonHandler:(e,t)=>{$("#"+e).click(t)},uiAddButtonHome:e=>{R.uiAddButton(e,"home",(()=>{ATON.Nav.requestHome(.3)}),"Home viewpoint")},uiAddButtonBack:(e,t)=>{R.uiAddButton(e,"back",(()=>{t&&t.length>1&&t.startsWith("http:")?ATON.Utils.goToURL(t):history.back()}),"Go Back")},uiAddButtonFirstPerson:e=>{R.uiAddButton(e,"fp",(()=>{ATON.Nav.isFirstPerson()?(ATON.Nav.setOrbitControl(),R.uiSwitchButton("fp",!1)):(ATON.Nav.setFirstPersonControl(),R.uiSwitchButton("fp",!0))}),"First-person navigation mode"),ATON.Nav.isFirstPerson()?R.uiSwitchButton("fp",!0):R.uiSwitchButton("fp",!1)},uiAddButtonVR:e=>{ATON.Utils.isConnectionSecure()&&(R.uiAddButton(e,"vr",(()=>{ATON.XR.toggle("immersive-vr")}),"Immersive VR mode"),ATON.Utils.isVRsupported()||$("#btn-vr").hide())},uiAddButtonAR:e=>{ATON.Utils.isConnectionSecure()&&R.uiAddButton(e,"ar",(()=>{ATON.Utils.isARsupported()&&ATON.XR.toggle("immersive-ar")}),"Immersive AR mode")},uiAddButtonDeviceOrientation:e=>{ATON.Utils.isConnectionSecure()&&ATON.Utils.isMobile()&&(R.uiAddButton(e,"devori",(()=>{ATON.Nav.isDevOri()?(ATON.Nav.restorePreviousNavMode(),R.uiSwitchButton("devori",!1)):(ATON.Nav.setDeviceOrientationControl(),R.uiSwitchButton("devori",!0))}),"Device-orientation mode"),ATON.Nav.isDevOri()?R.uiSwitchButton("devori",!0):R.uiSwitchButton("devori",!1))},uiAddButtonNav:e=>{R.uiAddButton(e,"nav",(()=>{R.popupNav()}),"Navigation")},uiAddButtonTalk:e=>{ATON.Utils.isConnectionSecure()&&(R.uiAddButton(e,"talk",(()=>{ATON.MediaFlow.isAudioRecording()?(ATON.MediaFlow.stopAudioStreaming(),$("#btn-talk").removeClass("atonBTN-rec")):(ATON.MediaFlow.startAudioStreaming(),$("#btn-talk").addClass("atonBTN-rec"))}),"Talk ON/OFF"),ATON.MediaFlow.isAudioRecording()?$("#btn-talk").addClass("atonBTN-rec"):$("#btn-talk").removeClass("atonBTN-rec"))},uiAddButtonStreamFocus:e=>{R.uiAddButton(e,"focus",(()=>{ATON.Photon._bStreamFocus?(ATON.Photon.setFocusStreaming(!1),$("#btn-focus").removeClass("atonBTN-rec")):(ATON.Photon.setFocusStreaming(!0),$("#btn-focus").addClass("atonBTN-rec"))}),"Focus streaming ON/OFF"),ATON.Photon._bStreamFocus?$("#btn-focus").addClass("atonBTN-rec"):$("#btn-focus").removeClass("atonBTN-rec")},uiAddButtonMainVideoPanoPlayPause:e=>{R.uiAddButton(e,"playpause",(()=>{ATON._vpanoPlaying?ATON._elPanoVideo&&ATON._elPanoVideo.pause():ATON._elPanoVideo&&ATON._elPanoVideo.play()}),"360 Video play/pause"),ATON._elPanoVideo?$("#btn-playpause").show():$("#btn-playpause").hide()},uiAddButtonQR:e=>{ATON.Utils.isLocalhost()||R.uiAddButton(e,"qr",R.popupQR,"QR-code")},uiAddButtonScreenshot:e=>{R.uiAddButton(e,"sshot",R.popupScreenShot,"Screenshot")},uiAddButtonInfo:e=>{R.uiAddButton(e,"info",ATON.FE.popupSceneInfo,"Scene information"),$("#btn-info").hide()},uiAddButtonFullScreen:e=>{R.uiAddButton(e,"fullscreen",(()=>{ATON.toggleFullScreen()}),"Fullscreen"),R.uiSwitchButton("fullscreen",ATON.isFullscreen())},uiAddKeywordsArea:(e,t,o,i)=>{let r="";r+="Add keyword:

    ",r+="
    ",$("#"+e).html(r),R.uiAttachInputFilterID("idKWordInput"),$.getJSON(ATON.PATH_RESTAPI+"keywords/",(t=>{let o="";for(let e in t)o+="";o+="",$("#"+e).append(o)}));let a={},s=e=>{a[e]||(e=e.toLowerCase().trim(),$("#idKWordInput").val(""),a[e]=1,console.log("Added keyword "+e),o&&o(e),$("#idKWords").append("
    "+e+"
    "),$("#idkw-"+e).click((()=>{$("#idkw-"+e).remove(),a[e]=void 0,console.log("Removed keyword "+e),i&&i(e)})))};if(t)for(let e in t)s(t[e]);$("#idKWordInput").keypress((function(e){if("13"!=(e.keyCode?e.keyCode:e.which))return;let t=$("#idKWordInput").val().toLowerCase().trim();!t||t.length<3||s(t)})),$("#idKWadd").click((()=>{let e=$("#idKWordInput").val().toLowerCase().trim();!e||e.length<3||s(e)}))},uiAttachCollectionItemsToInput:(e,t)=>{let o="";$("#"+e).attr("list",e+"-list"),$("#"+e).attr("name",e+"-list"),$.getJSON(ATON.PATH_RESTAPI+"c/"+t+"/",(t=>{o+="";for(let e in t){let i=t[e];o+=""}o+="",$("#"+e).html(o)}))},getVRCclassFromID:e=>"atonVRCu"+e%6,_setupVRCevents:()=>{R._bVRCsetup||(ATON.on("VRC_IDassigned",(e=>{$("#btn-vrc").addClass(R.getVRCclassFromID(e)),ATON.SUI.setSelectorColor(ATON.Photon.color),ATON.plight.color=ATON.Photon.color,R.checkAuth((e=>{void 0!==e.username&&ATON.Photon.setUsername(e.username)}))})),ATON.on("VRC_SceneState",(e=>{let t=ATON.Photon.getNumUsers();t>1?$("#idVRCnumusers").html(t):$("#idVRCnumusers").html(""),console.log("Users: "+t)})),ATON.on("VRC_Disconnected",(()=>{$("#btn-vrc").attr("class","atonBTN"),ATON.SUI.setSelectorColor(ATON.MatHub.colors.defUI),ATON.MediaFlow.stopAllStreams(),$("#idVRCnumusers").html("")})),R._bVRCsetup=!0)},uiAddButtonPhoton:e=>{R.uiAddButton(e,"vrc",(()=>{ATON.Photon.isConnected()?R.popupVRC():ATON.Photon.connect()}),"Photon (collaborative session)"),$("#btn-vrc").append(""),R._setupVRCevents(),void 0!==ATON.Photon.uid?$("#btn-vrc").addClass(R.getVRCclassFromID(ATON.Photon.uid)):$("#btn-vrc").attr("class","atonBTN")}};R.uiAddButtonVRC=R.uiAddButtonPhoton,R.uiAddButtonUser=e=>{R.uiAddButton(e,"user",(()=>{R.popupUser()}),"User"),R.checkAuth((e=>{void 0!==e.username?$("#btn-user").addClass("switchedON"):$("#btn-user").removeClass("switchedON")}))},R.uiSetEditMode=(e,t)=>{ATON.SceneHub._bEdit=e,R.uiSwitchButton("edit",e),ATON._renderer.domElement,e?$("#"+t).addClass("atonToolbar-bg-edit"):$("#"+t).removeClass("atonToolbar-bg-edit")},R.uiAddButtonEditMode=e=>{R.uiAddButton(e,"edit",(()=>{R.checkAuth((t=>{void 0!==t.username?(ATON.SceneHub._bEdit?R.uiSetEditMode(!1,e):R.uiSetEditMode(!0,e),console.log("Persistent Edit Mode: "+ATON.SceneHub._bEdit)):R.popupUser()}))}),"Persistent Edit Mode"),ATON.SceneHub._bEdit?R.uiSwitchButton("edit",!0):R.uiSwitchButton("edit",!1)},R.uiAddProfile=(e,t)=>{"function"==typeof t&&(R._uiProfiles[e]=t)},R.uiLoadProfile=e=>{let t=R._uiProfiles[e];void 0!==t&&(t(),R._uiCurrProfile=e,console.log("Loaded UI Profile: "+R._uiCurrProfile))},R.getCurrentUIP=()=>R._uiCurrProfile,R.attachHandlerToButton=(e,t)=>{void 0!==t&&$("#"+e).click((()=>{t()}))},R.uiAttachInputFilterID=e=>{$("#"+e).on("keyup change input",(()=>{let t=$("#"+e).val(),o=new RegExp("[^A-Za-z0-9-_]","ig");$("#"+e).val(t.replace(o,""))}))},R.switchNode=(e,t,o)=>{let i;i=o===ATON.NTYPES.SEM?ATON.getSemanticNode(e):ATON.getSceneNode(e),void 0!==i&&(i.toggle(t),ATON.fireEvent("FE_NodeSwitch",{nid:e,t:o,v:t}))},R.uiCreateGraph=e=>{let t=ATON.snodes;e===ATON.NTYPES.SEM&&(t=ATON.semnodes);let o="";for(let i in t){let r=t[i].visible?"checked":"";"."!==i&&(o+="'+i,o+="
    ")}return o},R.setupBasicUISounds=()=>{R.auLib={},R.auLib.switch=new Audio(ATON.PATH_RES+"audio/switch.wav"),R.auLib.switch.loop=!1},R.playAudioFromSemanticNode=e=>{if(void 0===e)return;let t=ATON.getSemanticNode(e);if(void 0===t)return;let o=t.getAudio();void 0!==o&&("string"!=typeof o||o.startsWith("data:audio")||(o=ATON.Utils.resolveCollectionURL(o)),void 0===R._auSemNode||null===R._auSemNode?R._auSemNode=new THREE.Audio(ATON.AudioHub._listener):R._auSemNode.stop(),ATON.AudioHub._loader.load(o,(e=>{R._auSemNode.setBuffer(e),R._auSemNode.setLoop(!1),R._auSemNode.play()})))},R.popupShow=(e,t)=>{if(R._bPopup)return!1;R._tPopup=Date.now();let o="atonPopup ";t&&(o+=t);let i="
    ";return i+=e+"
    ",R._bPopup=!0,ATON._bListenKeyboardEvents=!1,$("#idPopup").html(i),$("#idPopupContent").click((e=>{e.stopPropagation()})),$("#idPopup").show(),R.popupBlurBG>0&&(ATON._renderer.domElement.style.filter="blur("+R.popupBlurBG+"px)"),ATON._bPauseQuery=!0,$("#idTopToolbar").hide(),$("#idBottomToolbar").hide(),$("#idBottomRToolbar").hide(),$("#idPoweredBy").hide(),!0},R.popupClose=e=>{Date.now()-R._tPopup0&&(ATON._renderer.domElement.style.filter="none"),$("#idPopup").hide(),ATON._bPauseQuery=!1,$("#idTopToolbar").show(),$("#idBottomToolbar").show(),$("#idBottomRToolbar").show(),$("#idPoweredBy").show(),ATON.focusOn3DView())},R.subPopup=e=>{ATON.FE.popupClose(),e()},R.popupQR=()=>{let e="
    Share
    ";if(e+="


    ",!ATON.FE.popupShow("
    Share


    "))return;let t=window.location.href;new QRCode(document.getElementById("idQRcode"),t)},R.popupScreenShot=()=>{let e=ATON.Utils.takeScreenshot(256);R.checkAuth((t=>{let o="
    Capture
    ";o+="This is a preview of what your screenshot will look like:

    ",o+="
    ",o+="Resolution: px
    ",o+="
    Screenshot
    ",o+="
    Record video
    ",void 0!==t.username&&(o+="
    Set as Cover
    "),ATON.FE.popupShow(o)&&(ATON.MediaFlow._bScreenRec?$("#btnScreenRec").addClass("atonBTN-rec"):$("#btnScreenRec").removeClass("atonBTN-rec"),$("#btnScreenShot").click((()=>{let e=parseInt($("#isShotSize").val());e<100||(ATON.FE.popupClose(),ATON.Utils.takeScreenshot(e,"shot.png"))})),$("#btnScreenRec").click((()=>{ATON.MediaFlow._bScreenRec||ATON.MediaFlow.startScreenRecording(),ATON.FE.popupClose()})),$("#btnSetCover").click((()=>{ATON.FE.popupClose(),ATON.Utils.postJSON(ATON.PATH_RESTAPI+"cover/scene/",{sid:ATON.SceneHub.currID,img:e.src},(e=>{console.log(e)}))})))}))},R.popupVRC=()=>{let e="",t=ATON.Photon.getNumUsers();e+=t>1?"
    Collaborative Session ("+t+" users)
    ":"
    Collaborative Session
    ",e+="
    ",e+="",e+="",e+="
    LEAVE
    ",e+="
    ",e+="",ATON.FE.popupShow(e,"atonPopupLarge")&&(ATON.checkAuth((e=>{console.log(e),ATON.MediaFlow._bCamStream||ATON.FE.uiAddButton("idCollabTools","screenshare",(()=>{ATON.MediaFlow._bScreenStream?$("#btn-screenshare").addClass("atonBTN-rec"):$("#btn-screenshare").removeClass("atonBTN-rec"),ATON.MediaFlow.startOrStopScreenStreaming(),ATON.FE.popupClose()}),"Share your screen with other participants"),!ATON.MediaFlow._bScreenStream&&ATON.MediaFlow.hasVideoInput()&&ATON.FE.uiAddButton("idCollabTools","camera",(()=>{ATON.MediaFlow._bCamStream?$("#btn-camera").addClass("atonBTN-rec"):$("#btn-camera").removeClass("atonBTN-rec"),ATON.MediaFlow.startOrStopCameraStreaming(),ATON.FE.popupClose()}),"Share your camera with other participants"),ATON.MediaFlow._bScreenStream?$("#btn-screenshare").addClass("atonBTN-rec"):$("#btn-screenshare").removeClass("atonBTN-rec"),ATON.MediaFlow._bCamStream?$("#btn-camera").addClass("atonBTN-rec"):$("#btn-camera").removeClass("atonBTN-rec")})),void 0===ATON.Photon._username?($("#idVRCusername").show(),$("#idVRCusernameBTN").hide()):($("#idVRCusername").val(ATON.Photon._username),$("#idVRCusername").hide(),$("#idVRCusernameBTN").show()),void 0!==ATON.Photon.uid&&$("#idVRCusernameBTN").addClass("atonVRCu"+ATON.Photon.uid%6),$("#idChatBoxPopup").append(ATON.Photon._elChat),$("#idVRCmsg").keypress((e=>{if("13"==(e.keyCode?e.keyCode:e.which)){let e=$("#idVRCmsg").val();ATON.Photon.setMessage(e),$("#idVRCmsg").val("")}})),$("#idVRCusername").keypress((e=>{if("13"==(e.keyCode?e.keyCode:e.which)){let e=$("#idVRCusername").val();ATON.Photon.setUsername(e),$("#idVRCusername").hide(),$("#idVRCusernameBTN").html(ATON.Photon._username),$("#idVRCusernameBTN").show()}})),$("#idVRCusernameBTN").click((()=>{$("#idVRCusername").show(),$("#idVRCusernameBTN").hide()})),$("#idVRCdisconnect").click((()=>{ATON.Photon.disconnect(),ATON.FE.popupClose()})))},R.checkAuth=e=>{ATON.Utils.checkAuth((t=>{R._userAuth=t,void 0!==t.username?($("#btn-user").addClass("switchedON"),void 0===ATON.Photon._username&&ATON.Photon.setUsername(t.username)):$("#btn-user").removeClass("switchedON"),e&&e(t)}))},R.popupUser=()=>{R.checkAuth((e=>{if(void 0!==e.username){let t="
    ";if(t+="'"+e.username+"'

    ",Object.keys(R._uiProfiles).length>0){t+="UI Profile:


    "}if(t+="
    LOGOUT
    ",!ATON.FE.popupShow(t))return;R._uiCurrProfile&&(console.log(R._uiCurrProfile),$("#idUIProfiles").val(R._uiCurrProfile)),$("#idLogoutBTN").click((()=>{$.get(ATON.PATH_RESTAPI+"logout",(e=>{console.log(e),ATON.SceneHub.setEditMode(!1),R.uiSwitchButton("edit",!1),ATON.fireEvent("Logout"),$("#btn-user").removeClass("switchedON")})),ATON.FE.popupClose()})),$("#idSHUscenes").click((()=>{ATON.Utils.goToURL("/shu/scenes/")})),$("#idSHUuser").click((()=>{ATON.Utils.goToURL("/shu/auth/")})),$("#idUIProfiles").on("change",(()=>{let e=$("#idUIProfiles").val();R.uiLoadProfile(e),ATON.FE.popupClose()}))}else{let e="
    ";if(e+="username:
    ",e+="password:
    ",e+="
    LOGIN
    ",!ATON.FE.popupShow(e))return;$("#idLoginBTN").click((()=>{let e=JSON.stringify({username:$("#idUsername").val(),password:$("#idPassword").val()});$.ajax({url:ATON.PATH_RESTAPI+"login",type:"POST",data:e,contentType:"application/json; charset=utf-8",dataType:"json",success:e=>{console.log(e),e&&(ATON.fireEvent("Login",e),$("#btn-user").addClass("switchedON"),ATON.FE.popupClose())}}).fail((e=>{$("#idLoginBTN").html("LOGIN FAILED"),$("#idLoginBTN").attr("class","atonBTN atonBTN-red")}))}))}}))},R.popupSceneInfo=()=>{let e=ATON.SceneHub.getTitle();void 0===e&&(e=ATON.SceneHub.currID);let t=ATON.SceneHub.getDescription(),o="
    "+e+"
    ";t&&(o+="
    "+JSON.parse(t)+"
    "),o+="
    OK
    ",ATON.FE.popupShow(o)&&$("#btnOK").click((()=>{ATON._onUserInteraction(),ATON.FE.popupClose()}))},R.computeSelectorRanges=()=>{let e=ATON.bounds.radius;e<=0||(R._selRanges[0]=.001*e,R._selRefRadius=.01*e,R._selRanges[1]=.5*e)},R.popupSelector=()=>{let e="
    3D Selector
    ",t=ATON.SUI.getSelectorRadius(),o=ATON.Utils.getHumanReadableDistance(t);R.computeSelectorRanges(),e+="Radius ("+o+"):
    ",e+="",ATON.FE.popupShow(e,"atonPopupLarge")&&($("#idSelRad").val(t),$("#idSelRad").on("input change",(()=>{let e=parseFloat($("#idSelRad").val());ATON.SUI.setSelectorRadius(e),$("#idSelRadTxt").html(ATON.Utils.getHumanReadableDistance(e))})))},R.popupNav=()=>{let e="
    Navigation
    ";e+="
    ",e+="
    ",e+="
    Switch between first-person and orbit navigation mode
    ",e+="
    ",ATON.Utils.isConnectionSecure()&&(e+="
    ",e+="
    ",e+="
    Immersive VR mode
    ",e+="
    ",ATON.Utils.isMobile()&&(e+="
    ",e+="
    ",e+="
    Enable or disable device-orientation mode
    ",e+="
    ")),R.popupShow(e)&&(R.uiAddButtonFirstPerson("idNMfp"),R.uiAddButtonDeviceOrientation("idNMdevori"),R.uiAddButtonVR("idNMvr"))},R.popupModalToken=(e,t)=>{if(void 0===t)return;ATON.FE.popupClose();let o="
    Token Required
    ";e&&(o+=e),o+="

    ",o+="
    OK
    ",R.popupShow(o)&&$("#btnTokenOK").click((()=>{let e=$("#idTokStr").val();void 0===e||e.length<2||(ATON.FE.popupClose(),t(e))}))},R.popupNewNode=e=>{void 0===e&&(e=ATON.NTYPES.SCENE);let t="";e===ATON.NTYPES.SCENE&&(t="
    New Scene Node
    "),e===ATON.NTYPES.SEM&&(t="
    New Semantic Node
    "),t+="ID:
    ",t+="
    Add

    ",R.popupShow(t)&&$("#btnNewNID").click((()=>{let t=$("#idNID").val().trim();void 0===t||t.length<3||new ATON.Node(t,e).attachToRoot()}))};const y=R;let w={auType:"audio/wav",auStreamSegmentInterval:200,auStreamNumSegments:2,vidStreamSegmentInterval:300,vidStreamNumSegments:1,auMinVol:1,init:()=>{w._bAudioRecording=!1,w._bAudioStreaming=!1,w._bScreenRec=!1,w._blobOptAudio={type:"audio/wav"},w._blobOptVideo={type:"video/mp4"},w._cAuStream={audio:{channelCount:1,echoCancellation:!0,noiseSuppression:!0}},w._cAuRec={audio:{channelCount:1}},w._cScreenRec={video:{width:1280,height:720,framerate:30}},w._cScreenStream={video:{cursor:"always",width:{max:640},height:{max:360},framerate:15}},w._cCamStream={video:{width:{max:512},height:{max:512}}},w._oStream={audioBitsPerSecond:9e3,videoBitsPerSecond:5e5},w._aurec=void 0,w._sblob=void 0,w._schunks=[],w._bVideoStream=!1,w._vrec=void 0,w._scblob=void 0,w._scchunks=[],w._bCamStream=!1,w._bScreenStream=!1,w._setupFR(),w.detectDevices(),navigator.mediaDevices&&navigator.mediaDevices.addEventListener("devicechange",(e=>{w.detectDevices()})),w._vStreams={}},_setupFR:()=>{w._frAR=new window.FileReader,w._frAR.onloadend=()=>{let e=w._frAR.result;ATON.fireEvent("AudioRecordCompleted",e),w._bAudioRecording=!1},w._frAS=new window.FileReader,w._frAS.onloadend=()=>{if(!w._bAudioStreaming)return;let e=w._frAS.result;ATON.Photon.socket.emit("UTALK",{audio:e,uid:ATON.Photon.uid}),e=null},w._frVS=new window.FileReader,w._frVS.onloadend=()=>{if(!w._bVideoStream)return;let e=w._frVS.result;ATON.Photon.socket.emit("UVIDEO",{video:e,uid:ATON.Photon.uid}),e=null}},detectDevices:()=>{w.audioInputDevices=[],w.videoInputDevices=[],navigator.mediaDevices&&navigator.mediaDevices.enumerateDevices().then((e=>{for(let t in e){let o=e[t];"audioinput"===o.kind&&w.audioInputDevices.push(o),"videoinput"===o.kind&&w.videoInputDevices.push(o)}}))},hasAudioInput:()=>w.audioInputDevices.length>0,hasVideoInput:()=>w.videoInputDevices.length>0,isAudioRecording:()=>w._bAudioRecording,startRecording:()=>{w._bAudioRecording?console.log("Already recording."):navigator.mediaDevices.getUserMedia(w._cAuRec).then((e=>{w._aurec=new MediaRecorder(e),w._aurec.onstart=function(e){console.log("Start recording..."),w._bAudioRecording=!0,w._schunks=[]},w._aurec.ondataavailable=function(e){w._schunks.push(e.data)},w._aurec.onstop=function(e){console.log("Stop recording..."),w._sblob=new Blob(w._schunks,w._blobOptAudio),w._frAR.readAsDataURL(w._sblob)},w._aurec.start()})).catch((e=>{console.log(e)}))},stopRecording:()=>{w._aurec&&w._bAudioRecording&&w._aurec.stop()},startOrStopRecording:()=>{w._bAudioRecording?w.stopRecording():w.startRecording()},startAudioStreaming:()=>{navigator.mediaDevices.getUserMedia(w._cAuStream).then((e=>{w._aurec=new MediaRecorder(e,w._oStream),w._aurec.start(w.auStreamSegmentInterval),console.log("Start audio streaming"),w._aurec.onstart=e=>{w._bAudioStreaming=!0,w._bAudioRecording=!0,w._schunks=[]},w._aurec.ondataavailable=e=>{e.data.size<=0||(w._schunks.push(e.data),w._schunks.length{w._sblob=new Blob(w._schunks,w._blobOptAudio),w._frAS.readAsDataURL(w._sblob),w._bAudioStreaming&&w._aurec.start(w.auStreamSegmentInterval)}})).catch((e=>{console.log(e)}))},stopAudioStreaming:()=>{w._aurec&&w._bAudioStreaming&&("inactive"!==w._aurec.state&&w._aurec.stop(),console.log("Stop audio streaming"),w._bAudioStreaming=!1,w._bAudioRecording=!1,ATON.Photon.socket.emit("UAUDIOSTOP",{uid:ATON.Photon.uid}))},startOrStopAudioStreaming:()=>{w._bAudioRecording?w.stopAudioStreaming():w.startAudioStreaming()},startScreenRecording:()=>{w._bScreenRec||w._bScreenStream||navigator.mediaDevices.getDisplayMedia(w._cScreenRec).then((e=>{w._vrec=new MediaRecorder(e),w._scchunks=[],w._vrec.ondataavailable=e=>{e.data.size>0&&w._scchunks.push(e.data)},w._vrec.onstop=()=>{w._scblob=new Blob(w._scchunks,w._blobOptVideo),console.log(w._scblob.size),ATON.Utils.downloadBlob(w._scblob,"capture.mp4"),w._scchunks=[],w._bScreenRec=!1},w._vrec.start(200),w._bScreenRec=!0})).catch((e=>{console.log(e)}))},stopScreenRecording:()=>{w._bScreenRec&&(w._vrec.stop(),w._bVideoStream=!1,w._bScreenStream=!1,console.log("Stop screen recording"))},startScreenStreaming:()=>{navigator.mediaDevices.getDisplayMedia(w._cScreenStream).then((e=>{w.realizeOrUpdateVStream(e,w.stopScreenStreaming),w._vrec=new MediaRecorder(e,w._oStream),w._vrec.start(w.vidStreamSegmentInterval),console.log("Start screen streaming"),w._vrec.onstart=e=>{w._bVideoStream=!0,w._bScreenStream=!0,w._scchunks=[]},w._vrec.ondataavailable=e=>{e.data.size<1||(w._scchunks.push(e.data),w._scchunks.length{w._scblob=new Blob(w._scchunks,w._blobOptVideo),w._frVS.readAsDataURL(w._scblob),w._bVideoStream&&w._vrec.start(w.vidStreamSegmentInterval)}})).catch((e=>{console.log(e)}))},stopScreenStreaming:()=>{if(w._vrec&&w._bVideoStream&&(w._vrec.stop(),w._bVideoStream=!1,w._bScreenStream=!1,console.log("Stop screen streaming"),void 0!==ATON.Photon.uid)){let e=w.getVideoStream(ATON.Photon.uid);e.el.style.display="none",e.el.pause(),ATON.Photon.socket.emit("UVIDEOSTOP",{uid:ATON.Photon.uid})}},startOrStopScreenStreaming:()=>{w._bVideoStream?w.stopScreenStreaming():w.startScreenStreaming()},startCameraStreaming:()=>{w._bVideoStream||navigator.mediaDevices.getUserMedia(w._cCamStream).then((e=>{w.realizeOrUpdateVStream(e,w.stopCameraStreaming),w._vrec=new MediaRecorder(e,w._oStream),w._vrec.start(w.vidStreamSegmentInterval),console.log("Start camera streaming"),w._vrec.onstart=e=>{w._bVideoStream=!0,w._bCamStream=!0,w._scchunks=[]},w._vrec.ondataavailable=e=>{e.data.size<1||(w._scchunks.push(e.data),w._scchunks.length{w._scblob=new Blob(w._scchunks,w._blobOptVideo),w._frVS.readAsDataURL(w._scblob),w._bVideoStream&&w._vrec.start(w.vidStreamSegmentInterval)}})).catch((e=>{console.log(e)}))},stopCameraStreaming:()=>{if(w._vrec&&w._bVideoStream&&(w._vrec.stop(),w._bVideoStream=!1,w._bCamStream=!1,console.log("Stop camera streaming"),void 0!==ATON.Photon.uid)){let e=w.getVideoStream(ATON.Photon.uid);e.el.style.display="none",e.el.pause(),ATON.Photon.socket.emit("UVIDEOSTOP",{uid:ATON.Photon.uid})}},startOrStopCameraStreaming:()=>{w._bVideoStream?w.stopCameraStreaming():w.startCameraStreaming()},realizeOrUpdateVStream:(e,t)=>{let o=ATON.Photon.uid;if(void 0===o)return;let i=w.getOrCreateVideoStream(o,void 0,!0);i.el.playsinline=!0,i.el.style.display="inline-block",i.el.classList.add("atonVRCvidStream"),i.el.classList.add("atonVRCu"+o%6),t&&(i.el.onclick=t),i.el.srcObject=e},stopAllStreams:()=>{w.stopAudioStreaming(),w.stopCameraStreaming(),w.stopScreenStreaming()},getOrCreateVideoStream:(e,t,o)=>{if(w._vStreams[e])t&&(w._vStreams[e].el.src=t);else{w._vStreams[e]={};let i="vStream-"+e;if(o&&(i="uStream"+e,w._vStreams[e].uid=e),$("").appendTo("body"),w._vStreams[e].el=document.getElementById(i),t)if(t.endsWith("m3u8"))if(Hls.isSupported()){let o=new Hls;o.loadSource(t),o.attachMedia(w._vStreams[e].el)}else w._vStreams[e].el.src=t;else w._vStreams[e].el.src=t;o||(w._vStreams[e].el.loop=!0),w._vStreams[e].texStream=new THREE.VideoTexture(w._vStreams[e].el),w._vStreams[e].texStream.colorSpace=ATON._stdEncoding,w._vStreams[e].texStream.flipY=!1,w._vStreams[e].matStream=ATON.MatHub.materials.chromakey.clone(),w._vStreams[e].matStream.uniforms.tBase.value=w._vStreams[e].texStream}return w._vStreams[e]},getVideoStream:e=>w._vStreams[e],downloadVideoSnapshot:(e,t,o)=>{o||(o=1);let i=e.videoWidth*o,r=e.videoHeight*o,a=document.createElement("canvas");a.width=i,a.height=r,a.getContext("2d").drawImage(e,0,0,i,r),ATON.Utils.downloadImageFromCanvas(a,t)}};const M=w;let L={EARTH_R_KM:6371};L.EARTH_D_KM=2*L.EARTH_R_KM,L.init=()=>{L._bActive=!1,L._wpid=void 0,L._currGeoPos=new THREE.Vector2,L._GeoPOIs=[],L._currGeoPOI=void 0,L._closestGeoPOI=void 0,L._maxGeoError=40},L.enableGeoTracking=()=>{L._bActive||ATON.Utils.isConnectionSecure()&&navigator.geolocation&&(L._wpid=navigator.geolocation.watchPosition(L._onGeoPosition,L._onGeoError,{enableHighAccuracy:!0}),L._bActive=!0)},L.disableGeoTracking=()=>{L._bActive&&(navigator.geolocation.clearWatch(L._wpid),L._bActive=!1)},L.setMaxGeoError=e=>{e>0&&(L._maxGeoError=e)},L._onGeoError=()=>{console.log("Geolocation error")},L._onGeoPosition=e=>{if(!L._bActive)return;if(!e.coords)return;let t=e.coords.accuracy;t&&t>L._maxGeoError||(L._currGeoPos.x=e.coords.latitude,L._currGeoPos.y=e.coords.longitude,ATON.fireEvent("GeoLocation",e),L._handleGeoPOIs())},L._handleGeoPOIs=()=>{let e=L._GeoPOIs.length;if(!(e<=0)){L._closestGeoPOIdist=void 0,L._closestGeoPOI=void 0;for(let t=0;t{if(L._bActive)return L._currGeoPos},L.geolocationFromLatLon=(e,t)=>new THREE.Vector2(e,t),L.geodistance_orig=(e,t)=>{let o=ATON.DEG2RAD*(t.x-e.x),i=ATON.DEG2RAD*(t.y-e.y),r=Math.sin(o/2)*Math.sin(o/2)+Math.cos(ATON.DEG2RAD*e.x)*Math.cos(ATON.DEG2RAD*t.x)*Math.sin(i/2)*Math.sin(i/2),a=2*Math.atan2(Math.sqrt(r),Math.sqrt(1-r));return L.EARTH_R_KM*a*1e3},L.geodistance=(e,t)=>{let o=.5-Math.cos((t.x-e.x)*ATON.DEG2RAD)/2+Math.cos(e.x*ATON.DEG2RAD)*Math.cos(t.x*ATON.DEG2RAD)*(1-Math.cos((t.y-e.y)*ATON.DEG2RAD))/2;return L.EARTH_D_KM*Math.asin(Math.sqrt(o))*1e3},L.addGeoPOI=(e,t)=>{let o={};return o.pos=new THREE.Vector2(e.x,e.y),o.radius=t,L._GeoPOIs.push(o),L._bActive||L.enableTracking(),L._handleGeoPOIs(),L._GeoPOIs.length-1},L.getGeoPOIbyIndex=e=>L._GeoPOIs[e],L.getClosestGeoPOI=()=>L._closestGeoPOI,L.getClosestGeoPOIdistance=()=>L._closestGeoPOIdist;const C=L;let H={};H._id=$("meta[name='aton\\:appid']").attr("content"),H._data={},H.setup=void 0,H.update=void 0,H._bRunning=!1,H._pDeps=[],H._fLoading=0,H._sendDataPatch=(e,t,o)=>new Promise(((i,r)=>{if(void 0===e)return void r("No storage ID specified");if(e.length<3)return void r("Storage ID too short");if(void 0===t)return void r("No storage patch");if(void 0===H._id)return void r("No app-ID");void 0===o&&(o=ATON.PATCH_ADD);let a={};a.wappid=H._id,a.fid=e,a.data=t,a.mode=o===ATON.PATCH_DEL?"DEL":"ADD";let s=JSON.stringify(a);$.ajax({url:ATON.PATH_RESTAPI+"patch/wapp",type:"POST",data:s,contentType:"application/json; charset=utf-8",dataType:"json",success:t=>{void 0!==t?(H._data[e]=t,i(t)):r("Error writing on server")}})})),H.getAppID=()=>H._id,H.addToStorage=(e,t)=>H._sendDataPatch(e,t,ATON.PATCH_ADD),H.deleteFromStorage=(e,t)=>H._sendDataPatch(e,t,ATON.PATCH_DEL),H.getStorage=e=>new Promise(((t,o)=>{void 0!==H._id?void 0!==e?$.getJSON(ATON.PATH_WAPPS+H._id+"/data/"+e+".json",(o=>{console.log(o),H._data[e]=o,t(o)})):o("No storage ID specified"):o()})),H.registerServiceWorker=e=>{if(e)return H.basePath&&(e=H.basePath+e),"serviceWorker"in navigator&&window.addEventListener("load",(()=>{navigator.serviceWorker.register(e).then((e=>console.log("PWA service worker registered"))).catch((e=>console.log("PWA service worker not registered",e)))})),H},H.requireFlares=e=>{if(e)return ATON._fReqList=e,console.log("Required Flares: "+ATON._fReqList),H},H.loadScene=(e,t)=>{void 0!==e&&ATON.SceneHub.load(ATON.PATH_RESTAPI2+"scenes/"+e,e,t)},H.realize=(e,t,o)=>{H.setup=e,H.update=t,H.params=new URLSearchParams(window.location.search),H.basePath=ATON.Utils.getBaseFolder(window.location.href.split("?")[0]),H.registerServiceWorker(o);let i=H.params.get("ff");if(i){let e=String(i).split(",");H.requireFlares(e)}return H},H.realizeAndRun=(e,t,o)=>{H.realize(e,t,o).run()},H.run=()=>!H._bRunning&&(H._bRunning=!0,H.setup?H.setup():(ATON.FE.realize(),console.log("App [Warn]: your App should define a setup() routine")),H.update&&(ATON.addUpdateRoutine(H.update),console.log("App: update routine registered")),ATON._fRequired<=0&&ATON.fireEvent("AllFlaresReady"),!0);const D=H;let x={PASS_BASE:"p_base",PASS_AA:"p_aa",PASS_AO:"p_ao",PASS_SSR:"p_ssr",PASS_BLOOM:"p_bloom",PASS_DOF:"p_dof",PASS_GAMMA:"p_gamma",PASS_SOBEL:"p_sobel",init:()=>{if(void 0===ATON._renderer)return;let e=ATON._renderer.getPixelRatio(),t=ATON._renderer.getSize(new THREE.Vector2);const o=new THREE.WebGLRenderTarget(t.width*e,t.height*e,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat,colorSpace:ATON._stdEncoding});o.texture.name="EffectComposer.rt1",x.composer=new THREE.EffectComposer(ATON._renderer,o),x.passes={},ATON._renderer.autoClear=!1;let i=window.innerWidth*ATON._stdpxd,r=window.innerHeight*ATON._stdpxd;x.passes[x.PASS_BASE]=new THREE.RenderPass(ATON._mainRoot,ATON.Nav._camera),x.composer.addPass(x.passes[x.PASS_BASE]),x.passes[x.PASS_AO]=new THREE.SAOPass(ATON._mainRoot,ATON.Nav._camera,i,r),x.passes[x.PASS_AO].params.saoBias=1,x.passes[x.PASS_AO].params.saoScale=100,x.passes[x.PASS_AO].params.saoIntensity=.2,x.passes[x.PASS_BLOOM]=new THREE.UnrealBloomPass(new THREE.Vector2(i,r),1.5,.4,.85),x.passes[x.PASS_BLOOM].threshold=.9,x.passes[x.PASS_BLOOM].strength=1,x.passes[x.PASS_BLOOM].radius=1.2,x.passes[x.PASS_DOF]=new THREE.BokehPass(ATON._mainRoot,ATON.Nav._camera,{focus:5,aperture:.001,maxblur:.01,width:i,height:r}),x.composer.addPass(x.passes[x.PASS_AO]),x.composer.addPass(x.passes[x.PASS_BLOOM]),x.composer.addPass(x.passes[x.PASS_DOF]),x.togglePass(x.PASS_AO,!1),x.togglePass(x.PASS_BLOOM,!1),x.togglePass(x.PASS_DOF,!1)},togglePass:(e,t)=>{void 0!==x.composer&&(ATON.device.lowGPU||void 0!==x.passes[e]&&(x.passes[e].enabled=void 0===t?!x.passes[e].enabled:t))},isPassEnabled:e=>void 0!==x.composer&&(void 0!==x.passes[e]&&x.passes[e].enabled),setAOintensity:e=>{void 0!==x.composer&&void 0!==x.passes[x.PASS_AO]&&(x.passes[x.PASS_AO].params.saoIntensity=e)},getAOintensity:()=>void 0===x.composer||void 0===x.passes[x.PASS_AO]?0:x.passes[x.PASS_AO].params.saoIntensity,setBloomStrength:e=>{void 0!==x.composer&&void 0!==x.passes[x.PASS_BLOOM]&&(x.passes[x.PASS_BLOOM].strength=e)},getBloomStrength:()=>void 0===x.composer||void 0===x.passes[x.PASS_BLOOM]?0:x.passes[x.PASS_BLOOM].strength,setBloomThreshold:e=>{void 0!==x.composer&&void 0!==x.passes[x.PASS_BLOOM]&&(x.passes[x.PASS_BLOOM].threshold=e)},getBloomThreshold:()=>void 0===x.composer||void 0===x.passes[x.PASS_BLOOM]?0:x.passes[x.PASS_BLOOM].threshold,setDOFfocus:e=>{if(void 0===x.composer)return;if(void 0===x.passes[x.PASS_DOF])return;let t=x.passes[x.PASS_DOF].uniforms;void 0!==t&&(t.focus.value=e)},getDOFfocus:()=>{if(void 0===x.composer)return 0;if(void 0===x.passes[x.PASS_DOF])return 0;let e=x.passes[x.PASS_DOF].uniforms;return void 0===e?0:e.focus.value},setDOFaperture:e=>{if(void 0===x.composer)return;if(void 0===x.passes[x.PASS_DOF])return;let t=x.passes[x.PASS_DOF].uniforms;void 0!==t&&(t.aperture.value=e)}};const F=x;let V={STD_XPF_TRANSITION_DURATION:1,SEM_PREFIX:"XPF",SEMGROUP_PREFIX:"GXPF",init:()=>{V._list=[],V._iCurr=void 0,V._iNext=void 0,V._geom=void 0,V._mesh=void 0,V._mat=void 0,V._size=50,V._gSem=[],V._semIMGMasks={},V._semCanvas=void 0,V._semCTX=void 0,V._semCurr=void 0,V._shColor=new THREE.Color(0,0,1),V._shOpacity=.2,V._txCache={},V._pathMod=void 0,V._realizeBaseMat(),V._elVid=void 0,V._vidPlaying=!1},_realizeBaseMat:()=>{V._uniforms={tBase:{type:"t"},tSem:{type:"t"},tSemHint:{type:"t"},semHL:{type:"vec4",value:new THREE.Vector4(0,1,0,.15)},opacity:{type:"float",value:1},shColor:{type:"vec4",value:new THREE.Vector4(0,0,1,.2)},time:{type:"float",value:0}},V._mat=new THREE.ShaderMaterial({uniforms:V._uniforms,vertexShader:"\n varying vec3 vPositionW;\n varying vec3 vNormalW;\n varying vec3 vNormalV;\n varying vec2 vUv;\n\n void main(){\n vUv = uv;\n\n vPositionW = vec3( vec4( position, 1.0 ) * modelMatrix);\n vNormalW = normalize( vec3( vec4( normal, 0.0 ) * modelMatrix ) );\n vNormalV = normalize( vec3( normalMatrix * normal ));\n\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n }\n ",fragmentShader:"\n varying vec3 vPositionW;\n\t\t varying vec3 vNormalW;\n varying vec3 vNormalV;\n varying vec2 vUv;\n\n uniform float time;\n uniform sampler2D tBase;\n uniform sampler2D tSem;\n uniform sampler2D tSemHint;\n //uniform sampler2D tDepth;\n\n uniform vec4 semHL, shColor;\n uniform float opacity;\n\n\t\t void main(){\n vec4 frag = texture2D(tBase, vUv);\n vec4 sem = texture2D(tSem, vUv);\n vec4 semH = texture2D(tSemHint, vUv);\n float shv = max( max(semH.r,semH.g), semH.b);\n\n float t = (1.0 * cos(time*2.0));\n t = clamp(t, 0.0,1.0);\n\n frag = mix(frag, semHL, (sem.r * semHL.a));\n\n frag = mix(frag, shColor, (t * shv * shColor.a));\n\n frag.a = opacity;\n\n gl_FragColor = frag;\n\t\t }\n ",depthTest:!1,depthWrite:!1}),V.setSemanticHintMapOpacity(.2)},setPathModifier:e=>{if(void 0!==e){V._pathMod=e;for(let t in V.list)V.list[t].setPathModifier(e)}},update:()=>{if(ATON.Nav.isTransitioning())return;if(V._list.length<1)return;let e,t,o,i,r=V._list.length,a=ATON.Nav._currPOV.pos,s=ATON.Nav._vDir;V._uniforms.time.value+=ATON._dt,void 0===V._dirLNode&&(V._dirLNode=new THREE.Vector3);for(let n=0;n.8&&(void 0===o||l{void 0===V._geom&&(V._group=new THREE.Group,ATON._rootVisibleGlobal.add(V._group),V._geom=new THREE.SphereGeometry(1,40,40),V._geom.scale(-V._size,V._size,V._size),V._geom.castShadow=!1,V._geom.receiveShadow=!1,V._mesh=new THREE.Mesh(V._geom,V._mat),V._mesh.frustumCulled=!1,V._mesh.renderOrder=-100,V._mesh.layers.enable(ATON.NTYPES.SCENE),V._group.add(V._mesh),V._mesh.visible=!1)},setBaseGeometry:e=>{},add:e=>{if(void 0===e)return;V.realizeBaseGeometry();let t=V._list.length;V._list.push(e);let o=e.getMesh();o&&V._group.add(o);let i=ATON.getOrCreateSemanticNode(V.SEMGROUP_PREFIX+t);V._gSem.push(i),i.attachToRoot(),t>0||(ATON.Nav.toggleLocomotionValidator(!1),ATON._bqScene=!0)},clear:()=>{V._iCurr=void 0,V._iNext=void 0,V._semCurr=void 0;for(let e=0;eV._list.length,getMainGroup:()=>V._group,getSemanticGroup:e=>V._gSem[e],getCurrentSemanticGroup:()=>{if(void 0!==V._iCurr)return V._gSem[V._iCurr]},_preloadBaseLayer:(e,t)=>{if(void 0!==V._txCache[e])return V._txCache[e];let o=V._list[e]._pathbaselayer;V._pathMod&&(o=V._pathMod(o)),ATON.Utils.textureLoader.load(o,(o=>{o.colorSpace=ATON._stdEncoding,o.generateMipmaps=!0,V._txCache[e]=o,t&&t(o)}))},_clearTexCache:()=>{if(void 0!==V._iCurr)for(let e in V._txCache)V._txCache[e]&&e!==V._iCurr&&(V._txCache[e].dispose(),V._txCache[e]=void 0)},_setBaseLayerTexture:(e,t)=>{V._mat.map=t,V._mat.needsUpdate=!0,V._mesh.position.copy(e.getLocation()),V._mesh.rotation.set(e.getRotation().x,e.getRotation().y,e.getRotation().z)},updateCurrentXPFbaseLayer:e=>{if(void 0===V._iCurr)return;let t=V._list[V._iCurr];if(void 0===t)return;let o=t._pathbaselayer;if(V._pathMod&&(o=V._pathMod(o)),ATON.Utils.isVideo(o)){if(void 0===V._elVid){let e="",$(e).appendTo("body"),V._elVid=document.getElementById("idXPFVideo"),V._elVid.onplaying=()=>{console.log("XPF VideoPano playing"),V._vidPlaying=!0},V._elVid.onpause=()=>{console.log("XPF VideoPano paused"),V._vidPlaying=!1},V._elVid.addEventListener("touchstart",(function(){V._elVid.play()})),enableInlineVideo(V._elVid)}let i=new THREE.VideoTexture(V._elVid);return i.colorSpace=ATON._stdEncoding,V._mat.map=i,V._mat.needsUpdate=!0,V._uniforms.tBase.value=i,V._mesh.position.copy(t.getLocation()),V._mesh.rotation.set(t.getRotation().x,t.getRotation().y,t.getRotation().z),void(e&&e(i))}ATON.Utils.textureLoader.load(o,(o=>{o.colorSpace=ATON._stdEncoding,o.generateMipmaps=!0,V._mat.map=o,V._mat.needsUpdate=!0,V._uniforms.tBase.value=o,V._mesh.position.copy(t.getLocation()),V._mesh.rotation.set(t.getRotation().x,t.getRotation().y,t.getRotation().z),e&&e(o)}))},playOrPauseXPFVideoStream:()=>{void 0!==V._elVid&&(V._vidPlaying?V._elVid.pause():V._elVid.play())},updateCurrentXPFsemLayer:e=>{let t=V._list.indexOf(e);t<0||t===V._iCurr&&V.loadSemanticMasksIfAny(V._iCurr)},setCurrentXPF:(e,t)=>{V.toggleSUI(e,!1),V._iCurr=e,V._iNext=void 0,V._mesh.visible=!0,V._gSem[e].show(),V.updateCurrentXPFbaseLayer(t),ATON.fireEvent("CurrentXPF",e),ATON.fireEvent("NextXPF",void 0),V.loadSemanticMasksIfAny(e)},toggleSUI:(e,t)=>{if(void 0===e)return;let o=V._list[e];void 0!==o&&o._lnode.toggleSUI(t)},loadSemanticMasksIfAny:e=>{let t=V._list[e];if(void 0!==t){V._semIMGMasks={},V._uniforms.tSemHint.value=0,void 0!==t._semHintURL&&(V._uniforms.tSemHint.value=ATON.Utils.textureLoader.load(t._semHintURL));for(let e in t._semMasksURLs){void 0===V._semCanvas&&(V._semCanvas=document.createElement("canvas"),V._semCanvas.width=2048,V._semCanvas.height=2048,V._semCTX=V._semCanvas.getContext("2d",{willReadFrequently:!0}));let o=t._semMasksURLs[e],i=new Image;i.src=o,V._semIMGMasks[e]=i}}},getXPFbyIndex:e=>V._list[e],getCurrentXPFindex:()=>V._iCurr,getCurrentXPF:()=>{if(void 0!==V._iCurr)return V._list[V._iCurr]},getNextXPFindex:()=>V._iNext,getNextXPF:()=>{if(void 0!==V._iNext)return V._list[V._iNext]},getDistanceToXPFindex:e=>{if(void 0===e)return;let t=V._list[e];return void 0!==t?ATON.Nav._currPOV.pos.distanceTo(t.getLocation()):void 0},showSUIonlyForXPF:e=>{let t=V._list.length;if(!(t<1))for(let o=0;o{let o=V._list[e];void 0!==o&&(void 0===t&&(t=V.STD_XPF_TRANSITION_DURATION),ATON.XR._bPresenting&&(t=0),V.setCurrentXPF(e),ATON.Nav.requestTransitionToLocomotionNode(o.getLocomotionNode(),t))},requestTransitionToTarget:(e,t,o)=>{if(void 0===e)return;let i=new ATON.POV;i.setTarget(e),i.setPosition(ATON.Nav._currPOV.pos),t&&i.setFOV(t),ATON.Nav.requestPOV(i,o)},requestTransitionToDirection:(e,t,o)=>{if(void 0===e)return;let i=new THREE.Vector3;i.x=e.x+ATON.Nav._currPOV.pos.x,i.y=e.y+ATON.Nav._currPOV.pos.y,i.z=e.z+ATON.Nav._currPOV.pos.z,V.requestTransitionToTarget(i,t,o)},setHomeXPF:e=>{let t=V._list[e];if(void 0===t)return;let o=t.getLocomotionNode(),i=(new ATON.POV).setPosition(o.pos).setTarget(o.pos.x,o.pos.y,o.pos.z+1);ATON.Nav.setHomePOV(i)},getSemanticMaskURLfromXPFindex:(e,t)=>{let o=V._list[e];if(void 0!==o)return o.getSemanticMaskURL(t)},getSemanticMaskURLfromCurrentXPF:e=>{if(void 0!==V._iCurr)return V.getSemanticMaskURLfromXPFindex(V._iCurr,e)},setSemanticColor:(e,t)=>{void 0===t&&(t=.15),V._uniforms.semHL.value=new THREE.Vector4(e.r,e.g,e.b,t)},setSemanticOpacity:e=>{void 0===e&&(e=.15),V._uniforms.semHL.value.w=e},setSemanticHintMapOpacity:e=>{void 0===e&&(e=.2),V._shOpacity=e,V._uniforms.shColor.value.w=e},setSemanticHintMapColor:(e,t)=>{void 0!==e&&(V._shColor=e,V._uniforms.shColor.value.x=e.r,V._uniforms.shColor.value.y=e.g,V._uniforms.shColor.value.z=e.b,void 0!==t&&V.setSemanticHintMapOpacity(t))},querySemanticMasks:()=>{if(void 0===V._semCTX)return;if(void 0===ATON._queryDataScene)return;if(void 0===ATON._queryDataScene.uv)return;let e,t=V._semCTX,o=ATON._queryDataScene.uv;for(let i in V._semIMGMasks){let r=V._semIMGMasks[i],a=parseInt(r.width*o.x),s=parseInt(r.height*(1-o.y));if(t.drawImage(r,0,0),t.getImageData(a,s,1,1).data[0]>127){e=i;break}}if(void 0===e)return void 0!==V._semCurr&&ATON.fireEvent("SemanticMaskLeave",V._semCurr),V._semCurr=void 0,V._uniforms.tSem.value=0,V._uniforms.shColor.value.w=V._shOpacity,void(V._mat.needsUpdate=!0);V.highlightSemanticMaskInCurrentXPF(e),V._semCurr=e},highlightSemanticMaskInCurrentXPF:e=>{if(void 0===e)return void 0!==V._semCurr&&ATON.fireEvent("SemanticMaskLeave",V._semCurr),V._semCurr=void 0,V._uniforms.tSem.value=0,V._uniforms.shColor.value.w=V._shOpacity,void(V._mat.needsUpdate=!0);if(V._semCurr===e)return;let t=V.getSemanticMaskURLfromCurrentXPF(e);V._uniforms.tSem.value=ATON.Utils.textureLoader.load(t),V._mat.needsUpdate=!0,ATON.fireEvent("SemanticMaskHover",e),V._uniforms.shColor.value.w=0,void 0!==V._semCurr&&ATON.fireEvent("SemanticMaskLeave",V._semCurr)},loadFromPhotoscanFile:(e,t)=>{if(void 0===e)return;e=ATON.Utils.resolveCollectionURL(e);let o=ATON.Utils.getBaseFolder(e),i=0;$.ajax({url:e,dataType:"text",success:function(e){e=e.split(/\r\n|\n/);for(let t in e){let r=e[t];if(!r.startsWith("#")){let e=r.split(/\s{2,}|\t/);if(e.length>10){let t=new ATON.XPF,r=o+e[0],a=parseFloat(e[1]),s=parseFloat(e[2]),n=parseFloat(e[3]),l=ATON.DEG2RAD*parseFloat(e[4]);ATON.DEG2RAD,parseFloat(e[5]),ATON.DEG2RAD,parseFloat(e[6]),t.setLocation(a,n,-s),t.setBaseLayer(r),t.setRotation(0,-l,0),V.add(t),i++}}}console.log("Num panoramas parsed: "+i),t&&t()}})}};const I=V;let U={init:()=>{U.list=[]},anyCopyrightFound:()=>U.list.length>0,extract:e=>{if(void 0===e)return;if(void 0===e.asset)return;let t={};if(e.asset.copyright&&(t.copyright=e.asset.copyright),e.asset.extras)for(let o in e.asset.extras)"string"==typeof e.asset.extras[o]&&(t[o]=e.asset.extras[o]);if(U.extractXMP3DC(e,t),0!==Object.keys(t).length){e.asset.generator&&(t.generator=e.asset.generator);for(let e in U.list){let o=U.list[e];if(U.compare(t,o))return}U.list.push(t),console.log(t)}},compare:(e,t)=>{if(void 0===e||void 0===t)return!1;const o=Object.keys(e),i=Object.keys(t);if(o.length!==i.length)return!1;for(let i of o)if(e[i]!==t[i])return!1;return!0},extractXMP3DC:(e,t)=>{if(void 0===e||void 0===t)return;if(!e.userData)return;let o=e.userData.gltfExtensions;if(!o)return;if(!o.KHR_xmp)return;let i=o.KHR_xmp.packets;if(!i)return;let r=i[0],a="en-us";r["model3d:spdxLicense"]&&(t.license=r["model3d:spdxLicense"]),r["dc:date"]&&(t.date=r["dc:date"]),r["dc:title"]&&(t.title=r["dc:title"][a]),r["dc:description"]&&(t.description=r["dc:description"][a]),r["dc:rights"]&&(t.rights=r["dc:rights"][a]),r["dc:source"]&&(t.source=r["dc:source"]),r["dc:subject"]&&(t.subject=r["dc:subject"]),r["dc:type"]&&(t.type=r["dc:type"]),r["xmpRights:Owner"]&&(t.owner=r["xmpRights:Owner"]),r["xmp:CreatorTool"]&&(t.creatorTool=r["xmp:CreatorTool"])}};const k=U;let B={REST_API_CESIUMION_DEF_TOKEN:"https://api.cesium.com/v2/tokens/default",THRES_ORI:.01,THRES_POS:1e-6,init:()=>{B._tsets=[],B._tsET=20,B._tsB=!1,B._bTileBVH=!0,B._tsTasks=[],B.tsSchedCB=e=>{B._tsTasks.push(e)},B._tseBase=8,B.estimateTSErrorTarget(),B._tsuSync=0,B._bPCs=!1,B._pqLRU=void 0,B._pqDownload=void 0,B._pqParse=void 0,B._numTilesLoaded=0,B._numTSLoaded=0},clear:()=>{for(let e in B._tsets)B._tsets[e]=null;B._tsets=[],B._bPCs=!1},getTSetsErrorTarget:()=>B._tsET,setTSetsErrorTarget:e=>{B._tsET=e;const t=B._tsets.length;if(!(t<=0))for(let o=0;o{B._tsB=e;const t=B._tsets.length;if(!(t<=0))for(let o=0;o{void 0===e&&(e=ATON.Nav._camera);const t=B._tsets.length;if(!(t<=0))for(let o=0;o{B._tseBase=e,console.log(B._tseBase),B.estimateTSErrorTarget()},estimateTSErrorTarget:()=>{let e=B._tseBase;(ATON.device.lowGPU||ATON.device.isMobile)&&(e+=4),ATON.XR._bPresenting&&(e+=3),e<1&&(e=1),e>25&&(e=25),console.log("Estimated TSet error target: "+e),B.setTSetsErrorTarget(e)},loadTileSetFromURL:(e,t,o)=>{if(void 0===t)return;let i=new TILES.TilesRenderer(e);if(!i)return;ATON._assetReqNew(e),i.displayBoxBounds=B._tsB,i.fetchOptions.mode="cors",o&&(i.fetchOptions.headers={},i.fetchOptions.headers.Authorization=`Bearer ${o.accessToken}`,i.preprocessURL=e=>(e=new URL(e),/^http/.test(e.protocol)&&e.searchParams.append("v",o.v),e.toString())),i.errorTarget=B._tsET,i.optimizeRaycast=!1,void 0===B._pqLRU?(i.downloadQueue.schedulingCallback=B.tsSchedCB,i.parseQueue.schedulingCallback=B.tsSchedCB,i.downloadQueue.maxJobs=6,i.parseQueue.maxJobs=1,B._pqLRU=i.lruCache,B._pqDownload=i.downloadQueue,B._pqParse=i.parseQueue):(i.lruCache=B._pqLRU,i.downloadQueue=B._pqDownload,i.parseQueue=B._pqParse),i.setCamera(ATON.Nav._camera),i.setResolutionFromRenderer(ATON.Nav._camera,ATON._renderer),i.manager.addHandler(/\.gltf$/,ATON._aLoader),i.manager.addHandler(/\.ktx2$/,ATON._ktx2Loader),i.manager.addHandler(/\.drc$/,ATON._dracoLoader),t.add(i.group),$.getJSON(e,(e=>{ATON.CC.extract(e)}));let r=new THREE.Box3,a=new THREE.Sphere;new THREE.Matrix4,new THREE.Vector3;let s=!1;i.addEventListener("load-tile-set",(()=>{if(console.log("TileSet loaded"),ATON._assetReqComplete(e),B._numTSLoaded++,o||t.bUseGeoCoords){console.log("TileSet using GeoCoords"),i.getBoundingSphere(a);const e=a.center.clone(),t=e.length(),o=e.normalize(),r=new THREE.Vector3(0,1,0),s=ATON.Utils.rotationBetweenDirections(o,r);i.group.quaternion.x=s.x,i.group.quaternion.y=s.y,i.group.quaternion.z=s.z,i.group.quaternion.w=s.w,i.group.position.y=-t}else i.getBoundingBox(r)?(r.getBoundingSphere(a),t.autocenter?(r.getCenter(i.group.position),i.group.position.multiplyScalar(-1)):void 0===ATON.Nav.homePOV&&ATON.Nav.computeAndRequestDefaultHome(.5,void 0,a)):i.getBoundingSphere(a)&&(t.autocenter?(i.group.position.copy(a.center),i.group.position.multiplyScalar(-1)):void 0===ATON.Nav.homePOV&&ATON.Nav.computeAndRequestDefaultHome(.5,void 0,a))})),i.addEventListener("load-model",(e=>{let o=e.scene;B._numTilesLoaded++,o.traverse((e=>{if(e.layers.enable(t.type),e.isMesh?(e.castShadow=!0,e.receiveShadow=!0,B._bTileBVH&&e.geometry&&(e.geometry.computeVertexNormals(),e.geometry.computeBoundsTree({}),ATON.Utils._bvhBounds>0&&ATON.Utils._addBVHbounds(e,ATON.Utils._bvhBounds)),ATON._bqScene=!0):(s=!0,B._bPCs=!0,e.layers.disable(t.type),e.raycast=ATON.Utils.VOID_CAST,e.material=ATON.MatHub.materials.point),t.userData.cMat&&(e.material=t.userData.cMat),e.material){let t=e.material.map;t&&(t.minFilter=THREE.LinearMipmapLinearFilter,t.magFilter=THREE.LinearFilter,t.colorSpace=ATON._stdEncoding)}})),ATON.fireEvent("TileLoaded",o)})),i.addEventListener("dispose-model",((e,t)=>{ATON.Utils.cleanupVisitor(e.scene),e=null})),s||ATON.Utils.setPicking(t,t.type,!0),B._tsets.push(i)},loadCesiumIONAsset:(e,t)=>{let o=ATON.getAPIToken("cesium.ion");if(null==o&&(console.log("A valid Cesium ION token is required"),o=prompt("Please enter a valid Cesium ION token:"),null==o||""==o))return;let i=new URL(`https://api.cesium.com/v1/assets/${e}/endpoint`);i.searchParams.append("access_token",o),fetch(i,{mode:"cors"}).then((e=>e.ok?e.json():Promise.reject(`${e.status} : ${e.statusText}`))).then((e=>{i=new URL(e.url);const r=i.searchParams.get("v");B.loadTileSetFromURL(i.toString(),t,{accessToken:e.accessToken,v:r}),ATON.setAPIToken("cesium.ion",o)}))},update:()=>{const e=B._tsets.length;if(e<1)return;for(let t=0;t!!ATON.Nav._bControl&&(ATON.Nav._dOri>B.THRES_ORI||ATON.Nav._dPos>B.THRES_POS)};const q=B;let z={};window.ATON=z,z.Node=t,z.POV=class{constructor(e){this.pos=new THREE.Vector3(1,0,0),this.target=new THREE.Vector3(0,0,0),this.up=ATON.STD_UPVECTOR,this.fov=void 0,this.nextPOV=void 0,this.prevPOV=void 0,this.as(e)}as(e){if(void 0!==e)return ATON.Nav.povlist[e]=this,this.id=e,this}setPosition(e,t,o){return e instanceof THREE.Vector3?this.pos.copy(e):this.pos.set(e,t,o),this}setTarget(e,t,o){return e instanceof THREE.Vector3?this.target.copy(e):this.target.set(e,t,o),this}setFOV(e){return this.fov=e,this}addKeywords(e){let t=e.split(",");void 0===this.kwords&&(this.kwords={});for(let e in t){let o=t[e].trim();o.length>0&&(this.kwords[o]=!0)}return this}hasKeyword(e){if(void 0!==this.kwords)return void 0!==this.kwords[e]}setNextPOV(e){if(e)return this.nextPOV=e,this}setPrevPOV(e){if(e)return this.prevPOV=e,this}},z.LightProbe=class{constructor(e,t,o){this.pos=new THREE.Vector3(0,0,0),this._res=void 0!==e?e:128,this._near=void 0!==t?t:1,this._far=void 0!==o?o:ATON.Nav.STD_FAR,this._envtex=void 0,this._CC=void 0,void 0===ATON._pmremGenerator&&(ATON._pmremGenerator=new THREE.PMREMGenerator(ATON._renderer),ATON._pmremGenerator.compileCubemapShader())}setPosition(e,t,o){return e instanceof THREE.Vector3?this.pos.copy(e):this.pos.set(e,t,o),this}setNear(e){return this._near=e,this}setFar(e){return this._far=e,this}_createCCtarget(){this._CCtarget||(this._CCtarget=new THREE.WebGLCubeRenderTarget(this._res,{format:THREE.RGBEFormat,generateMipmaps:!0,minFilter:THREE.LinearMipmapLinearFilter,colorSpace:ATON._stdEncoding}))}update(){return this._envtex&&this._envtex.dispose(),ATON._rootVisibleGlobal.position.set(-this.pos.x,-this.pos.y,-this.pos.z),ATON._render(),this._envtex=ATON._pmremGenerator.fromScene(ATON._mainRoot,0,this._near,this._far).texture,ATON._rootVisibleGlobal.position.set(0,0,0),ATON._renderer.shadowMap.enabled&&ATON._dMainL&&(ATON._dMainL.shadow.needsUpdate=!0),this}getEnvTex(){return this._envtex}assignToNode(e){}},z.XPF=class{constructor(e){this.id=e,this._geom=void 0,this._mesh=void 0,this._pathbaselayer=void 0,this._size=20,this._location=new THREE.Vector3(0,0,0),this._rotation=new THREE.Vector3(0,0,0),this._lnode=ATON.Nav.addLocomotionNode(this._location),this._pathMod=void 0,this._semMasksURLs={},this._semHintURL=void 0}setSize(e){this._size=e}realizeSUI(){return void 0===this._lnode||this._lnode.realizeSUI(),this}realizeGeometry(){return void 0!==this._geom||(this._geom=new THREE.SphereGeometry(1,60,60),this._geom.scale(-this._size,this._size,this._size),this._geom.castShadow=!1,this._geom.receiveShadow=!1,this._mat=new THREE.MeshBasicMaterial({depthTest:!1,depthWrite:!1}),this._mesh=new THREE.Mesh(this._geom,this._mat),this._mesh.frustumCulled=!1,this._mesh.renderOrder=-100),this}getMesh(){return this._mesh}getLocomotionNode(){return this._lnode}setRotation(e,t,o){return e instanceof THREE.Vector3?this._rotation.copy(e):this._rotation.set(e,t,o),void 0===this._mesh||this._mesh.rotation.copy(this._rotation),this}getRotation(){return this._rotation}setLocation(e,t,o){return e instanceof THREE.Vector3?this._location.copy(e):this._location.set(e,t,o),this._lnode&&this._lnode.setLocation(this._location),void 0===this._mesh||this._mesh.position.copy(this._location),this}getLocation(){return this._location}hasGeometry(){return void 0!==this._geom}setPathModifier=e=>(this._pathMod=e,this);updateBaseLayer(){}setBaseLayer(e){if(void 0===e)return this;this._pathbaselayer=ATON.Utils.resolveCollectionURL(e);let t=this;return this._pathMod&&(this._pathbaselayer=this._pathMod(this._pathbaselayer)),this.hasGeometry()?(ATON.Utils.isVideo(this._pathbaselayer)||ATON.Utils.textureLoader.load(t._pathbaselayer,(e=>{e.colorSpace=ATON._stdEncoding,e.generateMipmaps=!0,t._mat.map=e,t._mat.map.needsUpdate=!0,t._mat.needsUpdate=!0,console.log("XPF base layer "+t._pathbaselayer+" loaded")})),this):this}setSemanticMask(e,t){return void 0===e||(this._semMasksURLs[e]=ATON.Utils.resolveCollectionURL(t),ATON.XPFNetwork.updateCurrentXPFsemLayer(this)),this}removeSemanticMask(e){return void 0===e||(this._semMasksURLs[e]=void 0,ATON.XPFNetwork.updateCurrentXPFsemLayer(this)),this}removeAllSemanticMasks(){return this._semMasksURLs={},this}getSemanticMaskURL(e){return this._semMasksURLs[e]}setSemanticHintMap(e){return void 0===e||(this._semHintURL=ATON.Utils.resolveCollectionURL(e),ATON.XPFNetwork.updateCurrentXPFsemLayer(this)),this}removeSemanticHintMap(){return this._semHintURL=void 0,ATON.XPFNetwork.updateCurrentXPFsemLayer(this),this}},z.Flare=class{constructor(e){this._id=void 0,this._bDeployed=!1,e&&this.register(e)}register(e){return e&&(this._id=e),ATON.addFlare(this),this}getID(){return this._id}log(e){return this._id?console.log("[Flare "+this._id+"] "+e):console.log("[Flare]"+e),this}setSetup(e){return this.setup=e,this}setUpdate(e){return this.update=e,this}},z.EventHub=i,z.Utils=n,z.CC=k,z.SceneHub=d,z.MatHub=a,z.Nav=m,z.AudioHub=u,z.XR=T,z.SUI=N,z.UI=A,z.Photon=b,z.SemFactory=f,z.FE=y,z.MediaFlow=M,z.Phygital=C,z.App=D,z.FX=F,z.XPFNetwork=I,z.MRes=q,z.STD_UPVECTOR=new THREE.Vector3(0,1,0),z.ROOT_NID=".",z.RAD2DEG=180/Math.PI,z.DEG2RAD=Math.PI/180,z.PATCH_ADD=0,z.PATCH_DEL=1,z.NTYPES={},z.NTYPES.SCENE=3,z.NTYPES.SEM=4,z.NTYPES.UI=5,z.SHADOWS_NEAR=.1,z.SHADOWS_FAR=50,z.SHADOWS_SIZE=15,z.SHADOWS_RES=1024,z.AMB_L=.2,z.SCALE_DEFAULT=0,z.SCALE_BIG=5,z.SCALE_VERYBIG=10,z.SCALE_SMALL=-5,z.SCALE_VERYSMALL=-10,z.Flares={},z._fReqList=[],z._bInitialized=!1,z._resMappers=[],z.setBaseURL=e=>{z.BASE_URL=e,z.PATH_RESTAPI=`${z.BASE_URL}/api/`,z.PATH_RESTAPI_SCENE=`${z.PATH_RESTAPI}scene/`,z.PATH_RESTAPI2=`${z.BASE_URL}/api/v2/`,z.PATH_WAPPS=`${z.BASE_URL}/a/`,z.PATH_DRACO_LIB=`${z.BASE_URL}/dist/draco/`,z.PATH_BASIS_LIB=`${z.BASE_URL}/dist/basis/`,z.PATH_COLLECTION=`${z.BASE_URL}/collections/`,z.PATH_SCENES=`${z.BASE_URL}/scenes/`,z.PATH_RES=`${z.BASE_URL}/res/`,z.PATH_FE=`${z.BASE_URL}/s/`},z.setBaseURL(window.location.origin),z.setPathCollection=e=>{z.PATH_COLLECTION=e},z.setPathScenes=e=>{z.PATH_SCENES=e},z.setAsStandalone=e=>{e||(e="../"),z.PATH_DRACO_LIB=e+"dist/draco/",z.PATH_BASIS_LIB=e+"dist/basis/",z.PATH_RES=e+"res/"},z.addResourceMapper=e=>{z._resMappers.push(e)},z._onUserInteraction=()=>{z._elPanoVideo&&!z._vpanoPlaying&&z._elPanoVideo.play(),z.XPFNetwork._elVid&&!z.XPFNetwork._vidPlaying&&z.XPFNetwork._elVid.play(),z.AudioHub._listener&&z.AudioHub._listener.context&&"suspended"===z.AudioHub._listener.context.state&&z.AudioHub._listener.context.resume();for(let e in z.MediaFlow._vStreams){let t=z.MediaFlow._vStreams[e].el;t.playing||t.uid||t.play()}},z.checkAuth=(e,t)=>{$.ajax({type:"GET",url:z.PATH_RESTAPI+"user",xhrFields:{withCredentials:!0},dataType:"json",success:o=>{void 0!==o&&o.username?e(o):t&&t()},error:()=>{t&&t()}})},z._setupBaseListeners=()=>{let e,t,o=z._renderer.domElement;window.addEventListener("resize",z._onResize,!1),window.onorientationchange=z._readDeviceOrientationMode,document.addEventListener("fullscreenchange",(e=>{z._bFS=!!document.fullscreenElement,z.fireEvent("Fullscreen",z._bFS),z._bFS?console.log("Now fullscreen"):console.log("Exit fullscreen")})),void 0!==document.hidden?(e="hidden",t="visibilitychange"):void 0!==document.mozHidden?(e="mozHidden",t="mozvisibilitychange"):void 0!==document.msHidden?(e="msHidden",t="msvisibilitychange"):void 0!==document.webkitHidden&&(e="webkitHidden",t="webkitvisibilitychange"),void 0!==e&&document.addEventListener(t,(()=>{if(document[e]){if(z.XR._bPresenting)return;console.log("Suspend"),z.renderPause()}else{if(z.XR._bPresenting)return;console.log("Resume"),z.renderResume()}}),!1),o.addEventListener("mousemove",z._updateScreenMove,!1),o.addEventListener("mousedown",(e=>{1===e.button&&z.fireEvent("MouseMidButton"),2===e.button&&z.fireEvent("MouseRightButton")})),o.addEventListener("wheel",z._onMouseWheel,!1),z._bPointerDown=!1,Hammer(o).on("doubletap",(e=>{z._bPointerDown=!1,z._onUserInteraction(),z.fireEvent("DoubleTap",e.srcEvent)})),Hammer(o).on("tap",(e=>{if(z._bPointerDown=!1,z._onUserInteraction(),z._updateScreenMove(e.srcEvent),z._handleQueries(),z.fireEvent("Tap",e.srcEvent),void 0===z._hoveredUI)return;let t=z.getUINode(z._hoveredUI);t&&t.onSelect&&t.onSelect()})),z.on("DoubleTap",(e=>{z.defaultDoubleTapFromScreenCoords(e)})),z._kModShift=!1,z._kModCtrl=!1,z._bListenKeyboardEvents=!0,window.addEventListener("keydown",(e=>{z._onUserInteraction(),"Shift"===e.key&&(z._kModShift=!0),"Control"===e.key&&(z._kModCtrl=!0),z._bListenKeyboardEvents&&z.fireEvent("KeyPress",e.key)}),!1),window.addEventListener("keyup",(e=>{"Shift"===e.key&&(z._kModShift=!1),"Control"===e.key&&(z._kModCtrl=!1),z._bListenKeyboardEvents&&z.fireEvent("KeyUp",e.key)}),!1),z.on("KeyPress",(e=>{if("+"===e){let e=z.Nav.getFOV()+1;z.Nav.setFOV(e)}if("-"===e){let e=z.Nav.getFOV()-1;z.Nav.setFOV(e)}}))},z._onResize=()=>{if(z.Nav._camera.aspect=window.innerWidth/window.innerHeight,z.Nav._camera.updateProjectionMatrix(),z._renderer.setSize(window.innerWidth,window.innerHeight),z.FX.composer&&(z.FX.composer.setSize(window.innerWidth,window.innerHeight),z.FX.passes[z.FX.PASS_AA])){let e=z.FX.passes[z.FX.PASS_AA].material.uniforms;e&&e.resolution.value.set(1/window.innerWidth,1/window.innerHeight)}console.log("onResize")},z._onMouseWheel=e=>{e.preventDefault(),z.fireEvent("MouseWheel",e.deltaY)},z.focusOn3DView=()=>{z._renderer.domElement.focus()},z._SUIactivation=()=>{const e=z.getUINode(z._hoveredUI);return void 0!==e&&void 0!==e.onSelect&&(e.onSelect(),!0)},z._stdActivation=()=>{if(z._SUIactivation())return;if(!z.Nav._bControl)return;if(void 0!==z.XPFNetwork._semCurr&&z.fireEvent("SemanticMaskSelect",z.XPFNetwork._semCurr),z.XR._bPresenting){if(m.requestTransitionToLocomotionNodeInSightIfAny(z.XR.STD_TELEP_DURATION))return;return"immersive-vr"===z.XR._sessionType&&z.XR.teleportOnQueriedPoint(),void z.FE.playAudioFromSemanticNode(z._hoveredSemNode)}if(z.Nav.isFirstPerson()||z.Nav.isDevOri()){if(m.requestTransitionToLocomotionNodeInSightIfAny(.5))return;if(z.Nav.currentQueryValidForLocomotion()){let e=z._queryDataScene.p,t=z.Nav._vDir,o=new THREE.Vector3(e.x,e.y+z.userHeight,e.z),i=new THREE.Vector3(o.x+t.x,o.y+t.y,o.z+t.z),r=(new z.POV).setPosition(o).setTarget(i).setFOV(z.Nav._currPOV.fov);z.Nav.requestPOV(r,.5)}return}let e=z.getSemanticNode(z._hoveredSemNode);z._queryDataSem&&e?z.Nav.requestPOVbyNode(e,.5):z._queryDataScene&&z.Nav.requestRetarget(z._queryDataScene.p,void 0,.5)},z.defaultDoubleTapFromScreenCoords=e=>{z._updateScreenMove(e),z._handleQueryScene(),z._stdActivation()},z.isFullscreen=()=>z._bFS,z.toggleFullScreen=()=>{document.fullscreenElement?document.exitFullscreen&&document.exitFullscreen():document.documentElement.requestFullscreen()},z.realize=e=>{console.log("Initialize ATON..."),z.Utils.init(),z.Utils.profileDevice(),z._clock=new THREE.Clock(!0),z.bounds=new THREE.Sphere,z._worldScale=1,z._ws=0,z._bFS=!1,z._renderer=new THREE.WebGLRenderer({antialias:!0,alpha:!0}),z._renderer.setSize(window.innerWidth,window.innerHeight),z.Utils.profileRenderingCapabilities(),z._stdpxd=1,z._fps=60,z._dt=.01,z._dtAccum=0,z._dtCount=0,z._avgFPSaccum=0,z._avgFPS=60,z._dRenderBudgetMinFPS=20,z._dRenderBudgetMaxFPS=55,z._bAdaptiveDensity=!0,z._adMin=.4,z._adMax=1.5,z.device.lowGPU&&(z._adMax=1),z._aniMixers=[],z._stdEncoding=THREE.LinearSRGBColorSpace,z._renderer.outputColorSpace=z._stdEncoding,z._renderer.toneMapping=THREE.LinearToneMapping,z._renderer.toneMappingExposure=1,e||z._renderer.setAnimationLoop(z._onFrame),z._maxAnisotropy=z._renderer.capabilities.getMaxAnisotropy(),z.userHeight=1.7,e||document.body.appendChild(z._renderer.domElement);let t=z._renderer.domElement;t.id="idView3D",t.style.outline="none",t.style.border="none",z.UI.init(),z._vpanoPlaying=!1,z._bUserInts=0,z.EventHub.init(),z.MatHub.init(),z._assetsManager={},z._aLoader=new THREE.GLTFLoader,z._numReqLoad=0,z._collMod=void 0,z._ktx2Loader=new THREE.KTX2Loader,z._ktx2Loader.setTranscoderPath(z.PATH_BASIS_LIB),z._ktx2Loader.detectSupport(z._renderer),z._dracoLoader=new THREE.DRACOLoader,z._dracoLoader.setDecoderPath(z.PATH_DRACO_LIB),z._dracoLoader.setWorkerLimit(2),z._dracoLoader.preload(),z._aLoader.setDRACOLoader(z._dracoLoader),z._aLoader.setKTX2Loader(z._ktx2Loader),THREE.DefaultLoadingManager.addHandler(/\.ktx2$/,z._ktx2Loader),z._updRoutines=[],z._pmremGenerator=void 0,z._lps=[],z._bAutoLP=!1,z._envMapInt=1,z._numLPbounces=2,z._lpbCount=0,z._bShadowsFixedBound=!1,z._shadowsFixedBoundCenter=void 0,z._shadowsNear=z.SHADOWS_NEAR,z._shadowsFar=z.SHADOWS_FAR,z._shadowsSize=z.SHADOWS_SIZE,z._shadowsRes=z.SHADOWS_RES,z.initGraphs(),z.SceneHub.init(),z.MRes.init(),z.CC.init(),z.AudioHub.init(),z.Nav.init(),z.XR.init(),z.SUI.init(),z.Photon.init(),z.VRoadcast=z.Photon,z.MediaFlow.init(),z.SemFactory.init(),z.Phygital.init(),z.XPFNetwork.init(),z.device.lowGPU||z.device.isMobile||z.FX.init(),z.FX.composer||(z._render=()=>{z._renderer.render(z._mainRoot,z.Nav._camera)}),z.setDefaultPixelDensity(1),z._queryDataScene=void 0,z._queryDataSem=void 0,z._queryDataUI=void 0,z._hoveredSemNode=void 0,z._hoveredUI=void 0,z._bq=!0,z._bQuerySemOcclusion=!0,z._bQueryNormals=!0,z._bPauseQuery=!1,z._bCenteredQuery=!1,z._bqScene=!1,z._bqSem=!1,z._qSync=0,z._qSyncInt=1,z._tgiDur=void 0,z._tgiPer=void 0,z._tHover=void 0,z._bMainPanoInfinite=!0,z._matMainPano=void 0,z._mMainPano=void 0,z._screenPointerCoords=new THREE.Vector2(0,0),z._rcScene=new THREE.Raycaster,z._rcScene.layers.set(z.NTYPES.SCENE),z._rcScene.firstHitOnly=!0,z._rcSemantics=new THREE.Raycaster,z._rcSemantics.layers.set(z.NTYPES.SEM),z._rcSemantics.firstHitOnly=!0,z._rcUI=new THREE.Raycaster,z._rcUI.layers.set(z.NTYPES.UI),z._rcUI.firstHitOnly=!0,z._setupBaseListeners(),z.device.isMobile&&z._readDeviceOrientationMode(),z._fLoading=0,z._fRequired=z._fReqList.length,z._loadFlares(),z._gizmo=void 0,z._bGizmo=!1,z.focusOn3DView(),z._bInitialized=!0},z.addFlare=e=>{if(void 0===e)return;let t=Object.keys(z.Flares).length,o=e.getID();o?z.Flares[o]=e:z.Flares["F"+t]=e},z.registerFlare=z.addFlare,z.getFlare=e=>z.Flares[e],z.loadScript=(e,t,o)=>{let i=document.createElement("script");i.src=e,i.async=!1,document.head.appendChild(i),t&&(i.onload=t),o&&(i.onerror=o)},z._loadFlare=e=>{z._fLoading++,$.get(z.PATH_RESTAPI2+"flares/"+e,(t=>{let o=t.files;if(o){let t=o.length;for(let i in o)z.loadScript("/flares/"+e+"/"+o[i],(()=>{t--,t<=0&&z._onFlareLoaded(e)}),(()=>{console.log("Missing flare '"+e+"' dependency: "+o[i]),t--,t<=0&&z._onFlareLoaded(e)}))}})).fail((()=>{console.log("Flare "+e+" not found."),z._onFlareError(e)}))},z._loadFlares=()=>{if(z._fRequired<=0)z.fireEvent("AllFlaresReady");else for(let e in z._fReqList)z._loadFlare(z._fReqList[e])},z._onFlareLoaded=e=>{console.log("All deps loaded for flare '"+e+"'"),z._deployNewFlares(),z._fLoading--,z._fLoading<=0&&z._onAllFlaresLoaded()},z._onFlareError=e=>{z._fLoading--,z._fLoading<=0&&z._onAllFlaresLoaded()},z._onAllFlaresLoaded=()=>{console.log("All Flares ready!"),z.fireEvent("AllFlaresReady")},z._deployFlare=e=>{e._bDeployed||(void 0!==e.setup&&e.setup(),void 0!==e.update&&z.addUpdateRoutine(e.update),e._bDeployed=!0)},z._deployNewFlares=()=>{for(let e in z.Flares)z._deployFlare(z.Flares[e])},z.setCollectionPathModifier=e=>{z._collMod=e},z.setTimedGazeDuration=e=>{z._tgiDur=e},z.getTimedGazeProgress=()=>{if(void 0!==z._tgiDur)return z._tgiPer},z.getElapsedTime=()=>z._clock.elapsedTime,z.renderPause=()=>{z._renderer.setAnimationLoop(void 0)},z.renderResume=()=>{z._renderer.setAnimationLoop(z._onFrame)},z._setupLoadManager=()=>{z._loadManager=new THREE.LoadingManager,z._loadManager.onStart=(e,t,o)=>{console.log("Started loading file: "+e+".\nLoaded "+t+" of "+o+" files."),z.fireEvent("NodeRequestFired",e)},z._loadManager.onLoad=()=>{console.log("Loading complete!"),z.fireEvent("AllNodeRequestsCompleted")},z._loadManager.onProgress=(e,t,o)=>{},z._loadManager.onError=e=>{console.log("There was an error loading "+e)}},z.setDefaultPixelDensity=e=>{z._stdpxd=e,z._renderer.setPixelRatio(e),z.FX.composer&&z.FX.composer.setPixelRatio(e),void 0!==z._renderer.xr&&(z.device.isMobile?z._renderer.xr.setFramebufferScaleFactor(z._stdpxd*z.XR.MOBILE_DENSITY_F):z._renderer.xr.setFramebufferScaleFactor(z._stdpxd))},z.resetPixelDensity=()=>{z._renderer.setPixelRatio(z._stdpxd)},z._readDeviceOrientationMode=()=>{90===Math.abs(window.orientation)?(console.log("Landscape Mode"),z.fireEvent("MobileLandscapeMode")):(console.log("Portrait Mode"),z.fireEvent("MobilePortraitMode")),setTimeout(z._onResize,500)},z.snodes={},z.semnodes={},z.uinodes={},z.createSceneNode=e=>new z.Node(e,z.NTYPES.SCENE),z.getSceneNode=e=>{if(void 0!==e)return z.snodes[e]},z.getOrCreateSceneNode=e=>{let t=z.getSceneNode(e);return void 0!==t?t:z.createSceneNode(e)},z.getRootScene=()=>z._rootVisible,z.createSemanticNode=e=>new z.Node(e,z.NTYPES.SEM),z.getSemanticNode=e=>{if(void 0!==e)return z.semnodes[e]},z.getOrCreateSemanticNode=e=>{let t=z.getSemanticNode(e);return void 0!==t?t:z.createSemanticNode(e)},z.getRootSemantics=()=>z._rootSem,z.createUINode=e=>new z.Node(e,z.NTYPES.UI),z.getUINode=e=>{if(void 0!==e)return z.uinodes[e]},z.getRootUI=()=>z._rootUI,z._unpackScale=e=>0==e?1:e>=0?1.1*e:1/(-1.1*e),z.setUserScaleLevel=e=>{z.setWorldScaleLevel(-e)},z.getUserScale=()=>1/z._worldScale,z.setWorldScaleLevel=e=>{void 0===e&&(e=0),e<-127&&(e=127),e>127&&(e=127),z._ws=e;let t=z._unpackScale(e);z._rootVisible.scale.set(t,t,t),z._rootSem.scale.set(t,t,t),N.gLocNodes.scale.set(t,t,t),N.gMeasures.scale.set(t,t,t),z.Photon.avaGroup&&z.Photon.avaGroup.scale.set(t,t,t),z.recomputeSceneBounds();let o=t/z._worldScale;z.Nav._currPOV.pos.x*=o,z.Nav._currPOV.pos.y*=o,z.Nav._currPOV.pos.z*=o,z.Nav._currPOV.target.x*=o,z.Nav._currPOV.target.y*=o,z.Nav._currPOV.target.z*=o,z.Nav.syncCurrCamera(),z.XR._bPresenting&&z.XR.setRefSpaceLocation(z.Nav._currPOV.pos),z._worldScale=t,console.log("World scale: "+t)},z.getWorldScaleLevel=()=>z._ws,z.getWorldScale=()=>z._worldScale,z._assetReqNew=e=>{z._numReqLoad++,z.fireEvent("NodeRequestFired",e)},z._assetReqComplete=e=>{z.fireEvent("NodeRequestCompleted",e),z._numReqLoad--,z._numReqLoad<=0&&z._onAllReqsCompleted()},z._onAllReqsCompleted=()=>{z.recomputeSceneBounds(),z.getRootScene().assignLightProbesByProximity(),z.fireEvent("AllNodeRequestsCompleted"),z._postAllReqsCompleted(),setTimeout((()=>{z.updateLightProbes(),z._renderer.shadowMap.enabled&&z._bShadowsFixedBound&&0===z._aniMixers.length&&(z._dMainL.shadow.autoUpdate=!1,console.log("Lazy shadows"))}),1e3)},z._postAllReqsCompleted=e=>{void 0===e&&(e=z._rootVisible);for(let t in e.children){let o=e.children[t];o&&o.toggle&&(z._postAllReqsCompleted(o),o.toggle(o.visible))}ThreeMeshUI.update()},z.recomputeSceneBounds=e=>{e?z.bounds.union(e):(z.bounds.center.copy(z._rootVisible.getBound().center),z.bounds.radius=z._rootVisible.getBound().radius),z.bounds.radius<=0||(z._renderer.shadowMap.enabled&&(z._rootVisible.traverse((e=>{e.isMesh&&(e.castShadow=!0,e.receiveShadow=!0)})),z.adjustShadowsParamsFromSceneBounds(),z._bShadowsFixedBound&&z.updateDirShadows()),z._bAutoLP&&(void 0===z._lps[0]?z.addLightProbe((new z.LightProbe).setPosition(z.bounds.center).setNear(z.bounds.radius)):z._lps[0].setPosition(z.bounds.center).setNear(z.bounds.radius),console.log("Auto LP")),z.FX.composer&&z.FX.setDOFaperture(1/(30*z.bounds.radius)),z._mMainPano&&z._mMainPano.position.copy(z.bounds.center))},z.registerNodeResourceHandler=(e,t)=>{z._resHandler||(z._resHandler={}),z._resHandler[e]=t,console.log("Registered resource handler '"+e+"'")},z.removeNodeResourceHanlder=e=>{z._resHandler&&z._resHandler[e]&&(z._resHandler[e]=void 0)},z.initGraphs=()=>{z._mainRoot=new THREE.Scene,z._mainRoot.background=new THREE.Color(.7,.7,.7),z._rootVisibleGlobal=new THREE.Scene,z._mainRoot.add(z._rootVisibleGlobal),z._rootVisible=z.createSceneNode().setAsRoot(),z._rootVisibleGlobal.add(z._rootVisible),z._rootSem=z.createSemanticNode().setAsRoot(),z._mainRoot.add(z._rootSem),z._rootUI=z.createUINode().setAsRoot(),z._mainRoot.add(z._rootUI),z.ambLight=new THREE.AmbientLight(new THREE.Color(1,1,1)),z.ambLight.intensity=3,z._rootVisibleGlobal.add(z.ambLight),z.plight=new THREE.PointLight,z.plight.intensity=0,z.plight.decay=.2,z._rootVisibleGlobal.add(z.plight)},z.enablePointLight=()=>{z.plight.intensity=3},z.disablePointLight=()=>{z.plight.intensity=0},z.setBackgroundColor=e=>{z._mainRoot.background=e},z.setFog=(e,t)=>{void 0!==e&&(void 0===t&&(t=200),z._rootVisibleGlobal.fog=new THREE.Fog(e,1,t),z.setBackgroundColor(e))},z.disableFog=()=>{z._rootVisibleGlobal.fog=null},z.setAutoLP=e=>{z._bAutoLP=e},z.setNeutralAmbientLight=e=>{z.ambLight.color=new THREE.Color(e,e,e)},z.addLightProbe=e=>{void 0!==e&&(z._lps.push(e),z.setNeutralAmbientLight(0),void 0!==z.SUI.gLPIcons&&N.addLPIcon(e))},z.getNumLightProbes=()=>z._lps.length,z._updLP=()=>{for(let e in z._lps)z._lps[e].update();z._rootVisible.traverse((e=>{let t=e.userData.LP;void 0!==t&&t instanceof z.LightProbe&&(e.material.envMap=t.getEnvTex(),e.material.envMapIntensity=z._envMapInt,e.material.needsUpdate=!0)}))},z.setLightProbesNumBounces=e=>{e<1||(z._numLPbounces=e)},z.dirtyLightProbes=e=>{void 0===e&&(e=z._numLPbounces),z._lpbCount=e},z.updateLightProbes=()=>{if(!z.XR._bPresenting&&0!==z._lps.length){for(let e=0;e{let t;if(e=z.Utils.resolveCollectionURL(e),void 0===z._mMainPano&&(z._gMainPano=new THREE.SphereGeometry(1,60,60),z._gMainPano.castShadow=!1,z._gMainPano.receiveShadow=!1,z._mMainPano=new THREE.Mesh(z._gMainPano,z._matMainPano),z._mMainPano.frustumCulled=!1,z._mMainPano.renderOrder=-100,z._mMainPano.layers.disable(z.NTYPES.SCENE),z._mMainPano.layers.disable(z.NTYPES.SEM),z._mMainPano.layers.disable(z.NTYPES.UI),z._mMainPano.raycast=z.Utils.VOID_CAST,z.setMainPanoramaRadius(.8*z.Nav.STD_FAR)),z.Utils.isVideo(e)){if(void 0===z._elPanoVideo){let t="",$(t).appendTo("body"),z._elPanoVideo=document.getElementById("idPanoVideo"),z._elPanoVideo.onplaying=()=>{console.log("VideoPano playing"),z._vpanoPlaying=!0},z._elPanoVideo.onpause=()=>{console.log("VideoPano paused"),z._vpanoPlaying=!1},z._elPanoVideo.addEventListener("touchstart",(function(){z._elPanoVideo.play()})),enableInlineVideo(z._elPanoVideo)}t=new THREE.VideoTexture(z._elPanoVideo),t.colorSpace=z._stdEncoding,z._realizeOrUpdateMainPano(t),z.fireEvent("MainPanoVideo")}else{if(e.endsWith(".hdr"))return void(new THREE.RGBELoader).load(e,(e=>{e.minFilter=THREE.LinearMipmapLinearFilter,e.magFilter=THREE.LinearFilter,e.colorSpace=z._stdEncoding,z._realizeOrUpdateMainPano(e),z.fireEvent("MainPanoHDR")}));if(e.endsWith(".exr"))return void(new THREE.EXRLoader).load(e,(e=>{e.minFilter=THREE.LinearMipmapLinearFilter,e.magFilter=THREE.LinearFilter,e.colorSpace=z._stdEncoding,z._realizeOrUpdateMainPano(e),z.fireEvent("MainPanoHDR")}));z.Utils.textureLoader.load(e,(e=>{e.colorSpace=z._stdEncoding,e.generateMipmaps=!0,z._realizeOrUpdateMainPano(e),z.fireEvent("MainPano")}))}},z.playMainPanorama=()=>{z._elPanoVideo&&(z._vpanoPlaying||z._elPanoVideo.play())},z.pauseMainPanorama=()=>{z._elPanoVideo&&z._vpanoPlaying&&z._elPanoVideo.pause()},z.playOrPauseMainPanorama=()=>{z._elPanoVideo&&(z._vpanoPlaying?z._elPanoVideo.pause():z._elPanoVideo.play())},z.stopAndRemoveMainPanorama=()=>{z._elPanoVideo&&(z._vpanoPlaying&&z._elPanoVideo.pause(),z._elPanoVideo.remove(),z._elPanoVideo=void 0,z._vpanoPlaying=!1)},z._realizeOrUpdateMainPano=e=>{if(void 0!==z._matMainPano)return z._matMainPano.map=e,void z.updateLightProbes();z._matMainPano=new THREE.MeshBasicMaterial({map:e,depthTest:!1,depthWrite:!1}),z._mMainPano.material=z._matMainPano,z._bMainPanoInfinite&&(z._mMainPano.onAfterRender=()=>{"immersive-ar"!==z.XR._sessionType&&z.Nav._currPOV&&z._mMainPano.position.copy(z.Nav._currPOV.pos)}),z._rootVisibleGlobal.add(z._mMainPano),z.updateLightProbes()},z.setMainPanoramaRadius=e=>{void 0!==z._gMainPano&&z._gMainPano.scale(-e,e,e)},z.setMainPanoramaRotation=e=>{void 0!==z._mMainPano&&z._mMainPano.rotation.set(0,e,0)},z.setMainPanoramaInfinite=e=>{z._bMainPanoInfinite=e,void 0!==z._mMainPano&&(z._mMainPano.onAfterRender=e?()=>{z.Nav._currPOV&&z._mMainPano.position.copy(z.Nav._currPOV.pos)}:void 0)},z.setMainPanoramaLocation=e=>{z._bMainPanoInfinite||void 0!==z._mMainPano&&z._mMainPano.position.copy(e)},z.setMainLightDirection=e=>{let t=e.clone();t.normalize(),t.x*=.5*z.SHADOWS_FAR,t.y*=.5*z.SHADOWS_FAR,t.z*=.5*z.SHADOWS_FAR,void 0===z._dMainL&&(z._dMainL=new THREE.DirectionalLight(new THREE.Color(1,1,1),1),z._dMainL.castShadow=!1,z._dMainL.intensity=2,z._dMainLtgt=new THREE.Object3D,z._rootVisibleGlobal.add(z._dMainLtgt),z._dMainL.target=z._dMainLtgt,z._rootVisibleGlobal.add(z._dMainL),z._dMainLpos=new THREE.Vector3),z._dMainLdir=t,z._dMainL.position.set(-t.x,-t.y,-t.z),z._renderer.shadowMap.enabled&&(z._dMainL.shadow.needsUpdate=!0),z.toggleMainLight(!0)},z.getMainLightDirection=()=>{if(void 0===z._dMainLdir)return;let e=z._dMainLdir.clone();return e.normalize(),e},z.toggleMainLight=e=>{if(void 0===z._dMainL)return;z._dMainL.visible=e;let t=z._lps.length;e?(t>0?z.setNeutralAmbientLight(0):z.setNeutralAmbientLight(z.AMB_L),z.updateDirShadows()):t>0?z.setNeutralAmbientLight(0):z.setNeutralAmbientLight(z.AMB_L)},z.isMainLightEnabled=()=>void 0!==z._dMainL&&!!z._dMainL.visible,z.setExposure=e=>{z._renderer.toneMappingExposure=e},z.getExposure=()=>z._renderer.toneMappingExposure,z.adjustShadowsParamsFromSceneBounds=()=>{if(void 0===z._dMainL)return;let e=z._rootVisible.getBound().radius,t=z._rootVisible.getBound().center;e<=0||e>=z.SHADOWS_SIZE?(z._bShadowsFixedBound=!1,z._shadowsSize=z.SHADOWS_SIZE):(z._bShadowsFixedBound=!0,z._shadowsFixedBoundCenter=t,z._shadowsSize=1.5*e),z._dMainL.shadow.map&&(z._dMainL.shadow.map.dispose(),z._dMainL.shadow.map=null),z._dMainL.shadow.camera.left=-z._shadowsSize,z._dMainL.shadow.camera.right=z._shadowsSize,z._dMainL.shadow.camera.bottom=-z._shadowsSize,z._dMainL.shadow.camera.top=z._shadowsSize,z._dMainL.shadow.mapSize.width=z._shadowsRes,z._dMainL.shadow.mapSize.height=z._shadowsRes,z._dMainL.shadow.camera.near=z._shadowsNear,z._dMainL.shadow.camera.far=z._shadowsFar;let o=-2e-4*e;o<-.001&&(o=-.001),z._dMainL.shadow.bias=o},z.toggleShadows=e=>{if(void 0!==z._dMainL)if(e){if(z.XR.isPresenting())return;if(z.device.lowGPU)return;z._dMainL.castShadow=!0,z._renderer.shadowMap.enabled=!0,z.device.isMobile?z._renderer.shadowMap.type=THREE.PCFShadowMap:z._renderer.shadowMap.type=THREE.PCFSoftShadowMap,z._rootVisible.traverse((e=>{e.isMesh&&(e.castShadow=!0,e.receiveShadow=!0)})),z.adjustShadowsParamsFromSceneBounds(),z.updateDirShadows(),z._dMainL.shadow.needsUpdate=!0,console.log("Shadows ON")}else z._dMainL.castShadow=!1,z._renderer.shadowMap.enabled=!1,console.log("Shadows OFF")},z.updateDirShadows=()=>{if(void 0===z._dMainLdir)return;if(void 0===z._dMainLpos)return;let e=z._shadowsFixedBoundCenter;void 0===e?(e=z.Nav.getCurrentEyeLocation(),z._dMainLpos.x=e.x+z.Nav._vDir.x*z._shadowsSize,z._dMainLpos.y=e.y+z.Nav._vDir.y*z._shadowsSize,z._dMainLpos.z=e.z+z.Nav._vDir.z*z._shadowsSize):(z._dMainLpos.x=e.x,z._dMainLpos.y=e.y,z._dMainLpos.z=e.z),z._dMainL.position.set(z._dMainLpos.x-z._dMainLdir.x,z._dMainLpos.y-z._dMainLdir.y,z._dMainLpos.z-z._dMainLdir.z),z._dMainLtgt.position.copy(z._dMainLpos)},z._updateEnvironment=()=>{z._renderer.shadowMap.enabled&&(z._bShadowsFixedBound||z.updateDirShadows())},z.setGlobalAudio=(e,t)=>{void 0!==e&&(void 0===t&&(t=!0),e=z.Utils.resolveCollectionURL(e),void 0===z._auMain||null===z._auMain?z._auMain=new THREE.Audio(z.AudioHub._listener):z._auMain.isPlaying&&z._auMain.stop(),z.AudioHub._loader.load(e,(e=>{z._auMain.setBuffer(e),z._auMain.setLoop(t),z._auMain.play()})))},z._markFPS=()=>{z._numReqLoad>0||z._dt<0||(z._dtCount+=1,z._dtAccum+=z._dt,z._dtAccum<1||(z._fps=1/(z._dtAccum/z._dtCount),z._dtCount=0,z._dtAccum=0,z._handleDynamicRenderProfiles()))},z.toggleAdaptiveDensity=e=>{z._bAdaptiveDensity=e},z.setAdaptiveDensityRange=(e,t)=>{e>=t||(z._adMin=e,z._adMax=t)},z.setDynamicRenderingFPS=(e,t)=>{e>=t||(e&&(z._dRenderBudgetMinFPS=e),t&&(z._dRenderBudgetMaxFPS=t))},z._handleDynamicRenderProfiles=()=>{let e=z._renderer.getPixelRatio();z._fps=z._adMin&&(z._renderer.setPixelRatio(e),z.FX.composer&&z.FX.composer.setPixelRatio(e),console.log("Density: "+e.toPrecision(2)))),z.fireEvent("RequestLowerRender")),z._fps>z._dRenderBudgetMaxFPS&&(z._bAdaptiveDensity&&!z.XR._bPresenting&&(e+=.1,e<=z._adMax&&(z._renderer.setPixelRatio(e),z.FX.composer&&z.FX.composer.setPixelRatio(e),console.log("Density: "+e.toPrecision(2)))),z.fireEvent("RequestHigherRender"))},z._onFrame=()=>{z._dt=z._clock.getDelta(),z._markFPS(),z.XR._bPresenting?z.XR.update():z.Nav._controls.update(z._dt),z._handleQueries(),z.Nav.update(),z.Photon.update(),z.SUI.update(),z.MatHub.update(),z._updateEnvironment(),z._updateAniMixers(),z._updateRoutines(),z.MRes.update(),z.XPFNetwork.update(),z._render()},z._render=()=>{!z.FX.composer||z.XR._bPresenting?z._renderer.render(z._mainRoot,z.Nav._camera):z.FX.composer.render()},z.addUpdateRoutine=e=>{void 0!==e&&z._updRoutines.push(e)},z.deleteAllUpdateRoutines=()=>{z._updRoutines=[]},z._updateRoutines=()=>{let e=z._updRoutines.length;if(!(e<=0))for(let t=0;t{let e=z._aniMixers.length;if(!(e<1))for(let t=0;t{e.preventDefault&&e.preventDefault(),z._bCenteredQuery||(z._screenPointerCoords.x=e.clientX/window.innerWidth*2-1,z._screenPointerCoords.y=-e.clientY/window.innerHeight*2+1)},z.toggleCenteredQuery=e=>{z._bCenteredQuery=e,e&&(z._screenPointerCoords.x=0,z._screenPointerCoords.y=0)},z.toggleQueries=e=>{z._bq=e},z._registerRCS=()=>{z._rcRR=0,z._rcHandlers=[],z._rcHandlers.push(z._handleQueryScene),z._rcHandlers.push(z._handleQuerySemantics),z._rcHandlers.push(z._handleQueryUI)},z._handleQueries=()=>{if(!z._bq)return;if(z._bPauseQuery)return;if(z.Nav._bInteracting)return;if(z._numReqLoad>0)return;if(z.Nav.isTransitioning())return;if(z._handleQueryUI(),z._bqScene&&z._handleQueryScene(),z._bqSem&&z._handleQuerySemantics(),z.Nav._bLocValidator&&z.Nav.locomotionValidator(),void 0===z._tgiDur)return;if(void 0===z._tHover)return;const e=z._clock.elapsedTime-z._tHover;e>=z._tgiDur?(z._stdActivation(),z._tHover=void 0,z._tgiPer=void 0):z._tgiPer=e/z._tgiDur},z._handleQueryScene=()=>{if(z.XR.isPresenting()?z.XR.setupQueryRay(z._rcScene):z._rcScene.setFromCamera(z._screenPointerCoords,z.Nav._camera),z._hitsScene=[],z._rcScene.intersectObjects(z._mainRoot.children,!0,z._hitsScene),z._hitsScene.length<=0)return void(z._queryDataScene=void 0);const e=z._hitsScene[0];z._queryDataScene={},z._queryDataScene.p=e.point,z._queryDataScene.d=e.distance,z._queryDataScene.o=e.object,z._queryDataScene.uv=e.uv,z._bQueryNormals&&e.face&&e.face.normal&&(z._queryDataScene.matrixWorld=(new THREE.Matrix3).getNormalMatrix(e.object.matrixWorld),z._queryDataScene.n=e.face.normal.clone().applyMatrix3(z._queryDataScene.matrixWorld).normalize())},z.getSceneFocalPoint=()=>{if(void 0===z._queryDataScene)return;let e=z._queryDataScene.p,t=new THREE.Vector3;return t.lerpVectors(e,z.Nav._currPOV.pos,.02),t},z.getSceneQueriedPoint=()=>{if(void 0!==z._queryDataScene)return z._queryDataScene.p},z.getSceneQueriedDistance=()=>{if(void 0!==z._queryDataScene)return z._queryDataScene.d},z.getSceneQueriedNormal=()=>{if(void 0!==z._queryDataScene)return z._queryDataScene.n},z.getSceneQueriedObjectName=()=>{if(void 0!==z._queryDataScene&&void 0!==z._queryDataScene.o)return z._queryDataScene.o.name},z.getSceneQueriedUV=()=>{if(void 0!==z._queryDataScene)return z._queryDataScene.uv},z.setQueryRange=(e,t,o)=>{void 0!==o&&o!==z.NTYPES.SCENE||(z._rcScene.near=e,z._rcScene.far=t),void 0!==o&&o!==z.NTYPES.SEM||(z._rcSemantics.near=e,z._rcSemantics.far=t)},z._handleQuerySemantics=()=>{if(z.XR.isPresenting()?z.XR.setupQueryRay(z._rcSemantics):z._rcSemantics.setFromCamera(z._screenPointerCoords,z.Nav._camera),z._hitsSem=[],z._rcSemantics.intersectObjects(z._mainRoot.children,!0,z._hitsSem),z._hitsSem.length<=0){if(z._queryDataSem=void 0,z._hoveredSemNode){z.fireEvent("SemanticNodeLeave",z._hoveredSemNode);let e=z.getSemanticNode(z._hoveredSemNode);e&&e.onLeave&&e.onLeave()}return z._hoveredSemNode=void 0,void(z._tHover=void 0)}const e=z._hitsSem[0];if(z._bQuerySemOcclusion&&z._queryDataScene&&z._queryDataScene.d{if(z.XR.isPresenting()?z.XR.setupQueryRay(z._rcUI):z._rcUI.setFromCamera(z._screenPointerCoords,z.Nav._camera),z._hitsUI=[],z._rcUI.intersectObjects(z._mainRoot.children,!0,z._hitsUI),z._hitsUI.length<=0){if(z._queryDataUI=void 0,z._hoveredUI){z.fireEvent("UINodeLeave",z._hoveredUI);const e=z.getUINode(z._hoveredUI);e&&e.onLeave&&e.onLeave()}return z._hoveredUI=void 0,void(z._tHover=void 0)}const e=z._hitsUI[0];if(z._queryDataScene&&z._queryDataScene.d{if(void 0!==z._hoveredSemNode)return z.getSemanticNode(z._hoveredSemNode)},z.setAPIToken=(e,t)=>{window.sessionStorage.setItem("ATON.tokens."+e,t)},z.getAPIToken=e=>window.sessionStorage.getItem("ATON.tokens."+e),z.clearToken=e=>{window.sessionStorage.removeItem("ATON.tokens."+e)},z.useGizmo=e=>{z._bGizmo=e,z._setupGizmo()},z._setupGizmo=()=>{z._bGizmo?void 0!==z.Nav._camera&&void 0!==z._renderer&&(void 0===z._gizmo?(z._gizmo=new THREE.TransformControls(z.Nav._camera,z._renderer.domElement),z._rootUI.add(z._gizmo),z._gizmo.setMode("rotate"),z._gizmo.addEventListener("dragging-changed",(function(e){let t=e.value;z.Nav.setUserControl(!t),z._bPauseQuery=t,t||(z.recomputeSceneBounds(),z.updateLightProbes(),console.log(z._gizmo.object))}))):(z._gizmo.camera=z.Nav._camera,z._gizmo.detach())):z._gizmo&&z._gizmo.detach()}})(); \ No newline at end of file +(()=>{"use strict";class e extends THREE.Group{constructor(e,t){super(),this.type=t||ATON.NTYPES.SCENE,this.enablePicking(),this.type===ATON.NTYPES.SCENE&&(this._rootG=ATON._rootVisible,this._nodes=ATON.snodes),this.type===ATON.NTYPES.SEM&&(this._rootG=ATON._rootSem,this._nodes=ATON.semnodes),this.type===ATON.NTYPES.UI&&(this._rootG=ATON._rootUI,this._nodes=ATON.uinodes),this.as(e),this.kwords=void 0,this._bCloneOnLoadHit=!0,this._tlist=void 0,this._aniMixers=void 0,this.castShadow=!1,this.receiveShadow=!1,this._bs=new THREE.Sphere,this.autocenter=!1,this.onHover=void 0,this.onLeave=void 0,this.onSelect=void 0}as(e){if(void 0!==e&&e!==ATON.ROOT_NID)return this._nodes[e]=this,this.nid=e,this.name=e,this}setAsRoot(){return this._nodes[ATON.ROOT_NID]=this,this.nid=ATON.ROOT_NID,this}setCloneOnLoadHit(e){return this._bCloneOnLoadHit=e,this}addKeywords(e){let t=e.split(",");void 0===this.kwords&&(this.kwords={});for(let e in t){let o=t[e].trim();o.length>0&&(this.kwords[o]=!0)}for(let t in this.children){let o=this.children[t];void 0!==o.type&&o.addKeywords(e)}return this}hasKeyword(e){if(void 0!==this.kwords)return void 0!==this.kwords[e]}setDescription(e){return this.userData.description=e,this}getDescription(){return this.userData.description}setAudio(e){return this.userData.audio=e,this}getAudio(){return this.userData.audio}hide(){return this.visible=!1,ATON.Utils.setPicking(this,this.type,!1),ATON._renderer.shadowMap.enabled&&(ATON._dMainL.shadow.needsUpdate=!0),this}show(){return this.visible=!0,ATON.Utils.setPicking(this,this.type,this.bPickable),ATON._renderer.shadowMap.enabled&&void 0!==ATON._dMainL&&void 0!==ATON._dMainL.shadow&&(ATON._dMainL.shadow.needsUpdate=!0),this}toggle(e){return void 0===e?this.visible?this.hide():this.show():e?this.show():this.hide()}disablePicking(){return this.bPickable=!1,ATON.Utils.setPicking(this,this.type,this.bPickable),this}enablePicking(){return this.bPickable=!0,ATON.Utils.setPicking(this,this.type,this.bPickable),this}setPickable(e){return e?this.enablePicking():this.disablePicking(),this}setMaterial(e){this.userData.cMat=e,this.traverse((t=>{t.isMesh&&(t.material=e),t.type&&(this.userData.cMat=e)}));for(let t in this.children){let o=this.children[t];o.setMaterial&&o.setMaterial(e)}return this}getMaterial(){return this.userData.cMat}setDefaultAndHighlightMaterials(e,t){return this.userData.matSTD=e,this.userData.matHL=t,this}highlight(){return this.userData.matHL&&this.setMaterial(this.userData.matHL),this}restoreDefaultMaterial(){return this.userData.matSTD&&this.setMaterial(this.userData.matSTD),this}setOpacity(e){return this.traverse((t=>{t.isMesh&&(t.material.opacity=e)})),this}setShadowCast(e){return this.castShadow=e,this.traverse((t=>{t.isMesh&&(t.castShadow=e)})),this}setShadowReceive(e){return this.receiveShadow=e,this.traverse((t=>{t.isMesh&&(t.receiveShadow=e)})),this}setEnvMap(e){return this.traverse((t=>{t.isMesh&&(t.material.envMap=e)})),this}assignLightProbe(e){return this.traverse((t=>{t.isMesh&&t.geometry&&ATON.Utils.assignLightProbeToMesh(e,t)})),this}assignLightProbesByProximity(){return 0===ATON._lps.length||this.traverse((e=>{if(e.isMesh&&e.geometry){let t,o,i=new THREE.Vector3;(new THREE.Box3).setFromObject(e).getCenter(i);for(let e in ATON._lps){let r=ATON._lps[e],a=i.distanceToSquared(r.pos);(void 0===t||a{e.isMesh&&e.geometry&&(ATON.Utils.clearLightProbeFromMesh(e),e.material&&(e.material.envMap.dispose(),e.material.needsUpdate=!0))})),this}updateLightProbes=()=>(this.traverse((e=>{if(e.isMesh&&e.geometry){let t=e.userData.LP;void 0!==t&&(t.update(),e.material.envMap=t.getEnvTex(),e.material.needsUpdate=!0)}})),this);duplicate(){let e=this.clone();return e.traverse((e=>{e.isMesh&&(e.material=e.material.clone())})),e}delete(){let e=this.parent;void 0!==e&&void 0!==e.nid&&e.removeChild(this)}removeChild(e){if(void 0!==e)return e.nid,void 0!==e.nid&&(this._nodes[e.nid]=void 0),e.parent=void 0,e.traverse((e=>{e.geometry&&e.geometry.dispose(),e.material&&e.material.dispose()})),this.remove(e),this}removeChildren(){for(let e=this.children.length-1;e>=0;e--)this.removeChild(this.children[e]);return this}attachTo(e){let t="string"==typeof e?this._nodes[e]:e;return t&&(t.add(this),void 0!==t.userData.cMat&&(this.userData.cMat=t.userData.cMat),void 0!==t.bPickable&&(this.bPickable=t.bPickable)),t}attachToRoot(){return this._rootG.add(this),void 0!==this._rootG.userData.cMat&&(this.userData.cMat=this._rootG.userData.cMat),void 0!==this._rootG.bPickable&&(this.bPickable=this._rootG.bPickable),this._rootG}getBound(){return this.dirtyBound(),this._bs}dirtyBound(){return(new THREE.Box3).setFromObject(this).getBoundingSphere(this._bs),this}autoFit(e,t){if(this.dirtyBound(),e&&(this.position.copy(this._bs.center),this.position.multiplyScalar(-1)),t&&t>0&&this._bs.radius>0){let e=t/this._bs.radius;this.scale.set(e,e,e)}}setPosition(e,t,o){return e instanceof THREE.Vector3?this.position.copy(e):this.position.set(e,t,o),this}setScale(e,t,o){return e instanceof THREE.Vector3?this.scale.copy(e):(void 0===t&&(t=e,o=e),this.scale.set(e,t,o)),this}setRotation(e,t,o){return e instanceof THREE.Vector3?this.rotation.copy(e):this.rotation.set(e,t,o),this}orientToCamera(){return this.quaternion.copy(ATON.Nav._qOri),this}orientToLocation(e,t,o){return e instanceof THREE.Vector3?this.lookAt(e):this.lookAt(e,t,o),this}orientToNode(e){return e?(this.orientToLocation(e.position),this):this}setYup(){return this.rotation.set(-1.57079632679,0,0),this}addTransform(e){let t;return"string"==typeof e&&(t=ATON.Utils.parseTransformString(e)),void 0===t||(void 0===this._tlist&&(this._tlist=[]),this._tlist.push(t)),this}load(e,t){if(void 0===e)return this;let o=this;if(e=ATON.Utils.resolveCollectionURL(e),ATON.Utils.tryLoadFromService(e,o))return t&&t(),o;if("json"===ATON.Utils.getFileExtension(e))return ATON.MRes.loadTileSetFromURL(e,o),t&&t(),o;if(ATON._resHandler)for(let t in ATON._resHandler)if(ATON._resHandler[t](e,o))return o;if(o._bCloneOnLoadHit&&void 0!==ATON._assetsManager[e])return ATON._assetsManager[e].then((e=>{let i=e.clone();if(ATON.Utils.modelVisitor(o,i),void 0!==o._tlist)for(let e in o._tlist)o._tlist[e].add(i.clone()),o.add(o._tlist[e]);else o.add(i);t&&t()})),o;ATON._assetReqNew(e);let i=new Promise(((i,r)=>{ATON._aLoader.load(e,(r=>{let a=r.scene||r.scene[0];if(ATON.Utils.modelVisitor(o,a),void 0!==o._tlist)for(let e in o._tlist)o._tlist[e].add(a.clone()),o.add(o._tlist[e]);else o.add(a);ATON.Utils.registerAniMixers(o,r),ATON.CC.extract(r),i(a),console.log("%cModel loaded","color:green"),ATON._assetReqComplete(e),o.type===ATON.NTYPES.SCENE&&(ATON._bqScene=!0),o.type===ATON.NTYPES.SEM&&(ATON._bqSem=!0),o.bPickable&&o.enablePicking(),o.dirtyBound(),t&&t()}),void 0,(o=>{console.log("%cError loading model "+e,"color:red"),ATON._assetReqComplete(e),t&&t()}))}));return o._bCloneOnLoadHit&&(ATON._assetsManager[e]=i),this}exportAs(e){return ATON.Utils.exportNode(this,e),this}setOnHover(e){return this.onHover=e,this}setOnLeave(e){return this.onLeave=e,this}setOnSelect(e){return this.onSelect=e,this}loadCesiumIONAsset(e){return ATON.MRes.loadCesiumIONAsset(e,this),this}loadSketchfabAsset(e){let t=ATON.getAPIToken("sketchfab"),o=this;return null==t&&(console.log("A valid Sketchfab token is required"),t=prompt("Please enter a valid Sketchfab token:"),null==t||""==t)||fetch("https://api.sketchfab.com/v3/models/"+e+"/download",{method:"GET",headers:{Authorization:"Token "+t},mode:"cors"}).then((function(e){return e.json()})).then((function(e){if(ATON.setAPIToken("sketchfab",t),e.glb){let t=e.glb.url;return o.load(t),o}})),this}}const t=e;let o={init:()=>{o.evLocal={},o.evNetwork={},ATON.on=o.on,ATON.fireEvent=o.fireEvent,ATON.clearEventHandlers=o.clearEventHandlers},clearEventHandlers:e=>{o.evLocal[e]=[],o.evNetwork[e]=[]},executeHandlers:(e,t)=>{if(e)for(let o=0;o{if(void 0!==t){const i=o.evLocal;void 0===i[e]&&(i[e]=[]),i[e].push(t)}void 0!==i&&ATON.Photon.on(e,i)},fireEvent:(e,t,i)=>{const r=o.evLocal[e];o.executeHandlers(r,t),i&&ATON.Photon.fireEvent(e,t)}};const i=o;let r={init:()=>{r.materials={},r.colors={},r._loader=new THREE.MaterialLoader,r._uSem={time:{type:"float",value:0},tint:{type:"vec4",value:new THREE.Vector4(.2,.2,1,.2)}},r.addDefaults()},getDefVertexShader:()=>"\n varying vec3 vPositionW;\n varying vec3 vNormalW;\n varying vec3 vNormalV;\n varying vec2 vUv;\n\n void main(){\n vUv = uv;\n\n vPositionW = ( modelMatrix * vec4( position, 1.0 )).xyz;\n vNormalV = normalize( vec3( normalMatrix * normal ));\n vNormalW = ( modelMatrix * vec4(normal, 0.0 )).xyz;\n\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n }\n ",addDefaults:()=>{r.colors.white=new THREE.Color(1,1,1),r.colors.black=new THREE.Color(0,0,0),r.colors.green=new THREE.Color(0,1,0),r.colors.yellow=new THREE.Color(1,1,0),r.colors.red=new THREE.Color(1,0,0),r.colors.blue=new THREE.Color(0,0,1),r.colors.orange=new THREE.Color(1,.5,0),r.colors.defUI=new THREE.Color(.85,1,.95),r.colors.sem=new THREE.Color(0,1,.5),r.colors.darksem=new THREE.Color(0,0,.1),r.materials.fullyTransparent=new THREE.MeshBasicMaterial({transparent:!0,depthWrite:!1,opacity:0}),r.materials.defUI=new THREE.ShaderMaterial({uniforms:{tint:{type:"vec3",value:r.colors.defUI},opacity:{type:"float",value:0}},vertexShader:r.getDefVertexShader(),fragmentShader:"\n varying vec3 vPositionW;\n\t\t varying vec3 vNormalW;\n varying vec3 vNormalV;\n uniform vec3 tint;\n //uniform vec3 base;\n uniform float opacity;\n\n\t\t void main(){\n\t\t //vec3 viewDirectionW = normalize(cameraPosition - vPositionW);\n\n float f;\n\t\t //f = dot(vNormalV, viewDirectionW);\n f = dot(vNormalV, vec3(0,0,1));\n\t\t f = clamp(1.0-f, 0.0, 1.0);\n f *= f;\n\n f = mix(opacity, 1.0 + opacity, f);\n f = clamp(f, 0.0,1.0);\n\n //vec3 col = mix(base,tint, f);\n\t\t //gl_FragColor = vec4(col, f * opacity);\n\n gl_FragColor = vec4(tint, f);\n\t\t }\n ",transparent:!0,depthWrite:!1}),r.materials.selector=r.materials.defUI.clone(),r.materials.outline=new THREE.MeshBasicMaterial({color:r.colors.black,side:THREE.BackSide,transparent:!0,depthWrite:!1,opacity:.2}),r.materials.controllerRay=r.materials.defUI.clone(),r.materials.controllerRay.uniforms.tint.value=r.colors.white,r.materials.xray=r.materials.defUI.clone(),r.materials.xray.uniforms.tint.value=r.colors.white,r.materials.xray.uniforms.opacity.value=.5,r.materials.teleportLoc=new THREE.MeshBasicMaterial({transparent:!0,opacity:1,depthWrite:!1,side:THREE.DoubleSide}),ATON.Utils.textureLoader.load(ATON.PATH_RES+"grad.png",(e=>{r.materials.teleportLoc.map=e})),r.materials.measurement=new THREE.MeshBasicMaterial({color:r.colors.white,transparent:!0,depthWrite:!1,opacity:.5,depthTest:!1}),r.materials.semanticShape=new THREE.ShaderMaterial({uniforms:r._uSem,vertexShader:r.getDefVertexShader(),fragmentShader:"\n varying vec3 vPositionW;\n\t\t varying vec3 vNormalW;\n varying vec3 vNormalV;\n\n uniform float time;\n uniform vec4 tint;\n\n\t\t void main(){\n\t\t //vec3 viewDirectionW = normalize(cameraPosition - vPositionW);\n\n //float ff = dot(vNormalV, vec3(0,0,1));\n\t\t //ff = clamp(1.0-ff, 0.0, 1.0);\n\n float f = (1.0 * cos(time*2.0)); // - 0.5;\n //f = cos(time + (vPositionW.y*10.0));\n f = clamp(f, 0.0,1.0);\n\n\t\t gl_FragColor = vec4(tint.rgb, tint.a * f);\n //gl_FragColor = vec4(tint.rgb, ff);\n\t\t }\n ",transparent:!0,depthWrite:!1}),r.materials.semanticShapeHL=new THREE.MeshBasicMaterial({color:r.colors.sem,transparent:!0,depthWrite:!1,opacity:.2}),r.materials.semanticShapeEdit=new THREE.MeshBasicMaterial({color:r.colors.orange,transparent:!0,depthWrite:!1,opacity:.5}),r.materials.transWhite=new THREE.MeshBasicMaterial({color:r.colors.white,transparent:!0,depthWrite:!1,side:THREE.DoubleSide,opacity:.2}),r.materials.transBlack=new THREE.MeshBasicMaterial({color:r.colors.black,transparent:!0,depthWrite:!1,side:THREE.DoubleSide,opacity:.2}),r.materials.wireframe=new THREE.MeshBasicMaterial({color:r.colors.black,transparent:!0,depthWrite:!1,opacity:.1,wireframe:!0}),r.materials.normSlope=new THREE.ShaderMaterial({vertexShader:r.getDefVertexShader(),fragmentShader:"\n varying vec3 vPositionW;\n\t\t varying vec3 vNormalW;\n\n\t\t void main(){\n vec4 A = vec4(0,1,0, 1.0);\n vec4 B = vec4(1,0,0, 1.0);\n\n float f;\n f = dot(vNormalW, vec3(0,1,0));\n\n\t\t gl_FragColor = mix(B,A, f);\n\t\t }\n "}),r.materials.gradient=new THREE.ShaderMaterial({uniforms:{range:{type:"vec2",value:new THREE.Vector2(-4,5)}},vertexShader:r.getDefVertexShader(),fragmentShader:"\n varying vec3 vPositionW;\n\n uniform vec2 range;\n\n\t\t void main(){\n vec4 A = vec4(0,0,0, 1.0);\n vec4 B = vec4(0,0.5,1, 1.0);\n\n float t = (vPositionW.y - range.x)/(range.y - range.x);\n t = clamp(t, 0.0,1.0);\n\n\t\t gl_FragColor = mix(A,B, t);\n\t\t }\n "}),r.materials.lp=new THREE.ShaderMaterial({vertexShader:r.getDefVertexShader(),fragmentShader:"\n varying vec3 vPositionW;\n\t\t varying vec3 vNormalW;\n varying vec3 vNormalV;\n\n\t\t void main(){\n\t\t vec3 viewDirectionW = normalize(cameraPosition - vPositionW);\n\n float f;\n\t\t //f = dot(viewDirectionW, vNormalW);\n f = dot(vNormalV, vec3(0,0,1));\n\t\t f = clamp(1.0 - f, 0.0, 1.0);\n\n\t\t gl_FragColor = vec4(1.0,1.0,1.0, f);\n\t\t }\n ",transparent:!0,depthWrite:!1});let e=(new THREE.TextureLoader).load(ATON.PATH_RES+"point-mask.png");e.generateMipmaps=!1,r.materials.point=new THREE.PointsMaterial({vertexColors:!0,alphaMap:e,alphaTest:.5,depthTest:!0,transparent:!1,size:4,sizeAttenuation:!1}),r.materials.chromakey=new THREE.ShaderMaterial({uniforms:{tBase:{type:"t"},keycolor:{type:"vec4",value:new THREE.Vector4(0,1,0,0)},similarity:{type:"float",value:.4},smoothness:{type:"float",value:.08},spill:{type:"float",value:.1}},vertexShader:r.getDefVertexShader(),fragmentShader:"\n uniform sampler2D tBase;\n uniform vec4 keycolor;\n\n uniform float similarity;\n uniform float smoothness;\n uniform float spill;\n\n varying vec2 vUv;\n\n // From https://github.com/libretro/glsl-shaders/blob/master/nnedi3/shaders/rgb-to-yuv.glsl\n vec2 RGBtoUV(vec3 rgb){\n return vec2(\n rgb.r * -0.169 + rgb.g * -0.331 + rgb.b * 0.5 + 0.5,\n rgb.r * 0.5 + rgb.g * -0.419 + rgb.b * -0.081 + 0.5\n );\n }\n\n // From https://godotshaders.com/shader/green-screen-chromakey/\n\t\t void main(){\n\t\t vec4 frag = texture2D(tBase, vUv);\n vec4 orig = frag;\n\n float chromaDist = distance(RGBtoUV(frag.rgb), RGBtoUV(keycolor.rgb));\n\n float baseMask = chromaDist - similarity;\n float fullMask = pow(clamp(baseMask / smoothness, 0.0,1.0), 1.5);\n frag.a = fullMask;\n \n float spillVal = pow(clamp(baseMask / spill, 0.0,1.0), 1.5);\n float desat = clamp(frag.r * 0.2126 + frag.g * 0.7152 + frag.b * 0.0722, 0.0,1.0);\n frag.rgb = mix(vec3(desat, desat, desat), frag.rgb, spillVal);\n\n frag = mix(orig,frag, keycolor.w);\n\n\t\t gl_FragColor = frag;\n\t\t }\n ",transparent:!0,side:THREE.DoubleSide})},addMaterial:(e,t)=>{r.materials[e]?console.log("MatHub: material "+e+" already registered"):r.materials[e]=t},loadMaterial:(e,t)=>{r._loader.load(t,(t=>{r.addMaterial(e,t)}),void 0,(e=>{console.log(e)}))},getMaterial:e=>r.materials[e],update:()=>{r._uSem.time.value+=ATON._dt}};const a=r;let s={TSTRING_SEPARATOR:" ",VOID_CAST:(e,t)=>{},init:()=>{ATON.device={},s.geomUnitSphere=new THREE.SphereGeometry(1,32,32),s.geomUnitCube=new THREE.BoxGeometry,s.exporterGLTF=void 0,s.exporterOBJ=void 0,s.exporterUSDZ=void 0,s._dlink=document.createElement("a"),s._dlink.style.display="none",document.body.appendChild(s._dlink),s.textureLoader=new THREE.TextureLoader,s._bvhBounds=0,s.stats={},s.stats.numVertices=0,s.stats.numTris=0},generateID:e=>(void 0===e&&(e="id"),e+"-"+Math.random().toString(36).substr(2,9)),goToURL:e=>{window.location.href=e},goToScene:(e,t)=>{if(void 0===e)return;if(e.length<2)return;let o=ATON.PATH_FE+e;void 0!==t&&(o+="&vrc="+t),window.location.href=o},isConnectionSecure:()=>window.isSecureContext,isLocalhost:()=>!!window.location.origin.includes("localhost")||!!window.location.origin.includes("127.0.0.1"),showBVHbounds:e=>{e>0&&(s._bvhBounds=e)},_addBVHbounds:(e,t)=>{if(void 0===e)return;let o=new ThreeMeshBVH.MeshBVHHelper(e,t);o.displayParents=!0,o.update(),e.parent.add(o)},profileDevice:()=>{ATON.device.isMobile=!1,ATON.device.isMobile=!(!/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|ipad|iris|kindle|Android|Silk|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(navigator.userAgent)&&!/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(navigator.userAgent.substr(0,4))),ATON.device.xrSupported={},ATON.device.xrSupported["immersive-vr"]=!1,ATON.device.xrSupported["immersive-ar"]=!1,"xr"in navigator&&(navigator.xr.isSessionSupported("immersive-vr").then((e=>{ATON.device.xrSupported["immersive-vr"]=!!e,console.log("WebXR VR session support: "+ATON.device.xrSupported["immersive-vr"]),ATON.fireEvent("XR_support",{type:"immersive-vr",v:ATON.device.xrSupported["immersive-vr"]})})),navigator.xr.isSessionSupported("immersive-ar").then((e=>{ATON.device.xrSupported["immersive-ar"]=!!e,console.log("WebXR AR session support: "+ATON.device.xrSupported["immersive-ar"]),ATON.fireEvent("XR_support",{type:"immersive-ar",v:ATON.device.xrSupported["immersive-ar"]})})))},profileRenderingCapabilities:()=>{if(void 0===ATON._renderer)return;let e=ATON._renderer.capabilities;void 0!==e&&(ATON.device.lowGPU=!1,e.isWebGL2||(ATON.device.lowGPU=!0),e.maxTextureSize<8192&&(ATON.device.lowGPU=!0),e.maxCubemapSize<4096&&(ATON.device.lowGPU=!0),console.log(e))},isMobile:()=>ATON.device.isMobile,isVRsupported:()=>ATON.device.xrSupported["immersive-vr"],isARsupported:()=>ATON.device.xrSupported["immersive-ar"],getFileExtension:e=>e.substr(e.lastIndexOf(".")+1).toLowerCase(),removeFileExtension:e=>e.replace(/\.[^/.]+$/,""),isVideo:e=>{let t=s.getFileExtension(e);return"mp4"===t||"webm"===t||"m3u8"===t},getBaseFolder:e=>{var t=e.lastIndexOf("/");return-1!==t?e.substring(0,t+1):""},getFilename:e=>e.split(/(\\|\/)/g).pop(),isResourceURL:e=>!!e.startsWith("http://")||!!e.startsWith("https://"),URLify:e=>{if("string"!=typeof e)return e;const t=e.match(/(((ftp|https?):\/\/)[\-\w@:%_\+.~#?,&\/\/=]+)/g);return t&&t.forEach((function(t){e=e.replace(t,"")})),e},resolveCollectionURL:e=>e?(ATON._collMod&&(e=ATON._collMod(e)),e.startsWith("http")?e:ATON.PATH_COLLECTION+e):"",tryLoadFromService:(e,t)=>{if(!t)return!1;if(e.startsWith("https://cesium.com/ion/assets/")||e.startsWith("https://ion.cesium.com/assets/")){let o=e.split("/"),i=o[o.length-1];return t.loadCesiumIONAsset(i),!0}if(e.startsWith("https://assets.cesium.com/")){let o=e.split("/"),i=o[o.length-2];return t.loadCesiumIONAsset(i),!0}if(e.startsWith("https://sketchfab.com/3d-models/")){let o=e.split("-"),i=o[o.length-1];return t.loadSketchfabAsset(i),!0}for(let o in ATON._resMappers){let i=ATON._resMappers[o](e);if(void 0!==i)return t.load(i),!0}return!1},postJSON:(e,t,o,i)=>{$.ajax({url:e,type:"POST",xhrFields:{withCredentials:!0},data:JSON.stringify(t),contentType:"application/json; charset=utf-8",dataType:"json",success:e=>{o&&o(e)}}).fail((e=>{console.log(e),i&&i()}))},runAsync:e=>{const t=new Worker(URL.createObjectURL(new Blob([`postMessage((${e})());`]),{type:"application/javascript; charset=utf-8"}));return new Promise(((e,o)=>{t.onmessage=({data:o})=>{e(o),t.terminate()},t.onerror=e=>{o(e),t.terminate()}}))},mergeObject:e=>{e.updateMatrixWorld(!0);const t=[];e.traverse((e=>{if(e.isMesh){const o=e.geometry;o.applyMatrix4(e.matrixWorld),t.push(o.toNonIndexed())}}));const o=THREE.BufferGeometryUtils.mergeGeometries(t,!1),i=THREE.BufferGeometryUtils.mergeVertices(o).center(),r=new THREE.Group,a=new THREE.Mesh(i);return r.add(a),r},setPicking:(e,t,o)=>{void 0===o&&(o=!0),e.traverse((e=>{o?e.layers.enable(t):e.layers.disable(t)}))},graphPostVisitor:e=>{e.visible?console.log(e):s.setPicking(e,e.type,!1)},rotationBetweenDirections:(e,t)=>{const o=new THREE.Quaternion,i=(new THREE.Vector3).crossVectors(e,t);return o.x=i.x,o.y=i.y,o.z=i.z,o.w=1+e.clone().dot(t),o.normalize(),o},clampValue:(e,t,o)=>Math.min(Math.max(e,t),o),loadTexture:(e,t)=>{e.endsWith(".ktx2")?ATON._ktx2Loader.load(e,t):s.textureLoader.load(e,t)},modelVisitor:(e,t)=>{if(void 0===t)return;if(void 0===e)return;let o=e.type;t.traverse((t=>{t.isMesh&&(o===ATON.NTYPES.SCENE&&(t.castShadow=!0,t.receiveShadow=!0,t.geometry&&(t.geometry.computeBoundsTree(),console.log("Computed visible BVH"),s._bvhBounds>0&&s._addBVHbounds(t,s._bvhBounds)),s.processMaterial(t.material)),o===ATON.NTYPES.SEM&&(t.material=ATON.MatHub.materials.semanticShape,t.geometry&&(t.geometry.computeBoundsTree(),console.log("Computed semantic BVH"))),e.userData.cMat&&(t.material=e.userData.cMat))}))},processMaterial:e=>{void 0!==e&&null!==e.map&&void 0!==e.map&&(e.map.generateMipmaps=!0,e.map.anisotropy=ATON.device.isMobile?0:ATON._maxAnisotropy,e.map.minFilter=THREE.LinearMipmapLinearFilter,e.map.magFilter=THREE.LinearFilter,e.map.colorSpace=ATON._stdEncoding)},cleanupVisitor:e=>{e.traverse((e=>{if(e.material)if(e.material.length)for(let t=0;t{let o=t.scene||t.scene[0],i=!1;if(void 0===t.animations)return;let r=new THREE.AnimationMixer(o);t.animations.forEach((e=>{r.clipAction(e).play(),i=!0})),i&&(ATON._aniMixers.push(r),void 0===e._aniMixers&&(e._aniMixers=[]),e._aniMixers.push(r))},parseTransformString:e=>{let t=new THREE.Group,o=e.split(s.TSTRING_SEPARATOR),i=o.length;return i<3||(t.position.set(parseFloat(o[0]),parseFloat(o[1]),parseFloat(o[2])),i<6||(t.rotation.set(parseFloat(o[3]),parseFloat(o[4]),parseFloat(o[5])),i<9||t.scale.set(parseFloat(o[6]),parseFloat(o[7]),parseFloat(o[8])))),t},setVectorPrecision:(e,t)=>(e.x=parseFloat(e.x.toPrecision(t)),e.y=parseFloat(e.y.toPrecision(t)),e.z=parseFloat(e.z.toPrecision(t)),e),parseMD:e=>(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=e.replace(/^\s*\n\*/gm,"
      \n*")).replace(/^(\*.+)\s*\n([^\*])/gm,"$1\n
    \n\n$2")).replace(/^\*(.+)/gm,"
  • $1
  • ")).replace(/^\s*\n\d\./gm,"
      \n1.")).replace(/^(\d\..+)\s*\n([^\d\.])/gm,"$1\n
    \n\n$2")).replace(/^\d\.(.+)/gm,"
  • $1
  • ")).replace(/^\>(.+)/gm,"
    $1
    ")).replace(/[\#]{6}(.+)/g,"
    $1
    ")).replace(/[\#]{5}(.+)/g,"
    $1
    ")).replace(/[\#]{4}(.+)/g,"

    $1

    ")).replace(/[\#]{3}(.+)/g,"

    $1

    ")).replace(/[\#]{2}(.+)/g,"

    $1

    ")).replace(/[\#]{1}(.+)/g,"

    $1

    ")).replace(/^(.+)\n\=+/gm,"

    $1

    ")).replace(/^(.+)\n\-+/gm,"

    $1

    ")).replace(/\!\[([^\]]+)\]\(([^\)]+)\)/g,'$1')).replace(/[\[]{1}([^\]]+)[\]]{1}[\(]{1}([^\)\"]+)(\"(.+)\")?[\)]{1}/g,'$1')).replace(/[\*\_]{2}([^\*\_]+)[\*\_]{2}/g,"$1")).replace(/[\*\_]{1}([^\*\_]+)[\*\_]{1}/g,"$1")).replace(/[\~]{2}([^\~]+)[\~]{2}/g,"$1")).replace(/^\s*\n\`\`\`(([^\s]+))?/gm,'
    ')).replace(/^\`\`\`\s*\n/gm,"
    \n\n")).replace(/[\`]{1}([^\`]+)[\`]{1}/g,"$1")).replace(/^\s*(\n)?(.+)/gm,(function(e){return/\<(\/)?(h\d|ul|ol|li|blockquote|pre|img)/.test(e)?e:"

    "+e+"

    "}))).replace(/(\)\s*\n\(.+)\<\/p\>/gm,"$1$2"),checkAuth:e=>{$.ajax({type:"GET",url:ATON.PATH_RESTAPI+"user",xhrFields:{withCredentials:!0},dataType:"json",success:t=>{e(t)}})},getHumanReadableDistance:e=>{let t=" m";return e<.01?(t=" mm",t=(e*=1e3).toPrecision(3)+t,t):e<1?(t=" cm",t=(e*=100).toPrecision(3)+t,t):e>1e3?(t=" km",t=e.toPrecision(3)+t,t):(t=e.toPrecision(3)+t,t)},stripHTMLtagsFromString:e=>e.replace(/(<([^>]+)>)/gi,""),requestFullscreen:()=>{let e=document.documentElement;return e.requestFullscreen?e.requestFullscreen():e.mozRequestFullScreen?e.mozRequestFullScreen():e.webkitRequestFullscreen?e.webkitRequestFullscreen():e.msRequestFullscreen&&e.msRequestFullscreen(),!0},downloadBlob:(e,t)=>{void 0!==t&&(s._dlink.href=URL.createObjectURL(e),s._dlink.download=t,s._dlink.click())},downloadText:(e,t)=>{s.downloadBlob(new Blob([e],{type:"text/plain"}),t)},downloadJSONobj:(e,t)=>{s.downloadText(JSON.stringify(e),t)},downloadArrayBuffer:(e,t)=>{s.downloadBlob(new Blob([e],{type:"application/octet-stream"}),t)},downloadImageFromCanvas:(e,t)=>{if(!e)return;let o=e.toDataURL();ATON.Utils._dlink.href=o,ATON.Utils._dlink.download=t,ATON.Utils._dlink.click()},exportNode:(e,t)=>{let o=s.getFileExtension(t);if(!(o.length<1)){if("glb"===o||"gltf"===o){let i={binary:"glb"===o};void 0===s.exporterGLTF&&(s.exporterGLTF=new THREE.GLTFExporter),s.exporterGLTF.parse(e,(e=>{e instanceof ArrayBuffer?s.downloadArrayBuffer(e,t):(console.log(e),s.downloadJSONobj(e,t))}),i)}if("obj"===o){void 0===s.exporterOBJ&&(s.exporterOBJ=new THREE.OBJExporter);let o=s.exporterOBJ.parse(e);s.downloadText(o,t)}"usdz"===o&&(void 0===s.exporterUSDZ&&(s.exporterUSDZ=new THREE.USDZExporter),$("#idLoader").show(),s.exporterUSDZ.parse(e).then((e=>{s.downloadArrayBuffer(e,t),$("#idLoader").hide()})))}},takeScreenshot:(e,t)=>{let o=new Image;console.log("Screenshot with size:"+e),ATON.Nav._camera.aspect=1,ATON.Nav._camera.updateProjectionMatrix(),ATON._renderer.setSize(e,e),ATON._renderer.render(ATON._mainRoot,ATON.Nav._camera);let i=ATON._renderer.domElement;if(ATON.FX.composer){if(ATON.FX.composer.setSize(e,e),ATON.FX.passes[ATON.FX.PASS_AA]){let t=ATON.FX.passes[ATON.FX.PASS_AA].material.uniforms;t&&t.resolution.value.set(1/e,1/e)}ATON.FX.composer.render(),i=ATON.FX.composer.renderer.domElement}let r=ATON._renderer.domElement.toDataURL();return o.src=r,t&&(s._dlink.href=r.replace("image/png","image/octet-stream"),s._dlink.download=t,s._dlink.click()),ATON._onResize(),o},assignLightProbeToMesh:(e,t)=>{void 0!==e&&void 0!==t&&(t.noLP||(t.userData.LP=e))},clearLightProbeFromMesh:e=>{void 0!==e&&(e.noLP||(e.userData.LP=null))},vibrate:e=>{void 0===e&&(e=100),window.navigator.vibrate(e)},createATONCube:e=>{let t=new THREE.BoxGeometry(1,1,1),o=new THREE.MeshStandardMaterial;s.textureLoader.load(ATON.PATH_RES+"models/aton-cube.jpg",(e=>{e.colorSpace=ATON._stdEncoding,o.map=e}));let i=ATON.createSceneNode(e);return i.add(new THREE.Mesh(t)),i.setMaterial(o),i.enablePicking(),i},createATONCubePBR:e=>{let t=new THREE.BoxGeometry(1,1,1),o=new THREE.MeshStandardMaterial;o.metalness=1,s.textureLoader.load(ATON.PATH_RES+"models/aton-cube.jpg",(e=>{e.colorSpace=ATON._stdEncoding,o.map=e})),s.textureLoader.load(ATON.PATH_RES+"models/aton-cube-pbr.jpg",(e=>{e.colorSpace=ATON._stdEncoding,o.metalnessMap=e,o.roughnessMap=e})),s.textureLoader.load(ATON.PATH_RES+"models/aton-cube-nrm.png",(e=>{e.colorSpace=ATON._stdEncoding,o.normalMap=e}));let i=ATON.createSceneNode(e);return i.add(new THREE.Mesh(t)),i.setMaterial(o),i.enablePicking(),i},createGround:(e,t,o)=>{void 0===t&&(t=1),void 0===o&&(o=1);let i=new THREE.PlaneGeometry(t,o),r=new THREE.MeshStandardMaterial;void 0!==e&&s.textureLoader.load(e,(e=>{e.colorSpace=ATON._stdEncoding,r.map=e}));let a=ATON.createSceneNode().rotateX(.5*-Math.PI);return a.add(new THREE.Mesh(i,r)),a.enablePicking(),a}};const n=s;let l={MODE_ADD:0,MODE_DEL:1,FLOAT_PREC:5,init:()=>{l.currID=void 0,l.currData=void 0,l._bEdit=!1,l._bLoading=!1,l._title=void 0,l._descr=void 0,l.initBaseParsers()},setEditMode:e=>{l._bEdit=e,console.log("Edit mode:"+e)},load:(e,t,o)=>(l._bLoading=!0,console.log("Loading Scene: "+t),$.getJSON(e,(e=>{l.currData=e,l.currID=t,l._bLoading=!1,l.parseScene(e),o&&o(),ATON.fireEvent("SceneJSONLoaded",t)}))),clearScene:()=>{if(!(ATON._rootVisible.children.length<=0)){ATON._rootVisible.removeChildren();for(let e in ATON.snodes)e!==ATON.ROOT_NID&&delete ATON.snodes[e];ATON.MRes.clear(),ATON.XPFNetwork.clear()}},clearSemantics:()=>{if(!(ATON._rootSem.children.length<=0)){ATON._rootSem.removeChildren();for(let e in ATON.semnodes)e!==ATON.ROOT_NID&&delete ATON.semnodes[e];ATON.SUI.gSemIcons&&ATON.SUI.gSemIcons.removeChildren(),ATON.SemFactory.stopCurrentConvex(),ATON.SemFactory.init()}},clear:()=>{l.clearScene(),l.clearSemantics(),ATON.Nav.clear()},parseScene:e=>{if(void 0!==(e=void 0===e?l.currData:e))for(let t in e)l._jsonParsers[t]&&l._jsonParsers[t](e[t])},getJSONchildren:(e,t)=>{let o;void 0===t&&(t=ATON.NTYPES.SCENE);let i=[];if(t===ATON.NTYPES.SEM&&(o=ATON.getSemanticNode(e)),t===ATON.NTYPES.SCENE&&(o=ATON.getSceneNode(e)),void 0!==o){for(let e in o.children){let t=o.children[e];void 0!==t.nid&&i.push(t.nid)}return i}},getJSONgraphEdges:e=>{void 0===e&&(e=ATON.NTYPES.SCENE);let t=ATON.snodes;e===ATON.NTYPES.SEM&&(t=ATON.semnodes),e===ATON.NTYPES.UI&&(t=ATON.uinodes);let o={};for(let e in t){let i=t[e];i&&i.parent&&i.parent.nid&&(void 0===o[i.parent.nid]&&(o[i.parent.nid]=[]),o[i.parent.nid].push(i.nid))}return o},getJSONsemanticSpheresList:e=>{let t=ATON.getSemanticNode(e);if(void 0===t)return;let o=[];for(let e in t.children){let i=t.children[e];i.type&&o.push([parseFloat(i.position.x.toPrecision(l.FLOAT_PREC)),parseFloat(i.position.y.toPrecision(l.FLOAT_PREC)),parseFloat(i.position.z.toPrecision(l.FLOAT_PREC)),parseFloat(i.scale.x.toPrecision(l.FLOAT_PREC))])}return o},getJSONsemanticConvexShapes:e=>{let t=ATON.getSemanticNode(e);if(void 0===t)return;let o=[];for(let e in t.children){let i=t.children[e];i.userData._convexPoints&&o.push(i.userData._convexPoints)}return o},_applyJSONTransformToNode:(e,t)=>{if(void 0!==e&&void 0!==t){if(e.bUseGeoCoords)return t.bUseGeoCoords=!0,void(e.scale&&t.setScale(e.scale[0],e.scale[1],e.scale[2]));e.autocenter?t.autocenter=!0:e.position&&t.setPosition(e.position[0],e.position[1],e.position[2]),e.rotation&&t.setRotation(e.rotation[0],e.rotation[1],e.rotation[2]),e.scale&&t.setScale(e.scale[0],e.scale[1],e.scale[2]),e.list&&Array.isArray(e.list)}},initBaseParsers:()=>{l._jsonParsers={},l._jsonParsers.title=e=>{void 0!==e&&l.setTitle(e)},l._jsonParsers.description=e=>{void 0!==e&&l.setDescription(e)},l._jsonParsers.fx=e=>{e.ao&&(ATON.FX.togglePass(ATON.FX.PASS_AO,!0),e.ao.i&&ATON.FX.setAOintensity(parseFloat(e.ao.i))),e.bloom&&(ATON.FX.togglePass(ATON.FX.PASS_BLOOM,!0),e.bloom.i&&ATON.FX.setBloomStrength(parseFloat(e.bloom.i)),e.bloom.t&&ATON.FX.setBloomThreshold(parseFloat(e.bloom.t))),e.dof&&(ATON.FX.togglePass(ATON.FX.PASS_DOF,!0),e.dof.f&&ATON.FX.setDOFfocus(parseFloat(e.dof.f)))},l._jsonParsers.environment=e=>{let t=e.mainpano;if(e.mainpano&&(t.url&&ATON.setMainPanorama(t.url),t.rotation&&ATON.setMainPanoramaRotation(t.rotation)),e.bgcolor){let t=new THREE.Color(e.bgcolor[0],e.bgcolor[1],e.bgcolor[2]);ATON.setBackgroundColor(t)}let o=e.mainlight;o?(o.direction&&ATON.setMainLightDirection(new THREE.Vector3(o.direction[0],o.direction[1],o.direction[2])),ATON._dMainL?(o.color&&(ATON._dMainL.color=new THREE.Color(o.color[0],o.color[1],o.color[2])),o.intensity&&(ATON._dMainL.intensity=o.intensity),void 0!==o.shadows?ATON.toggleShadows(o.shadows):ATON.toggleShadows(!1)):ATON.toggleMainLight(!1)):ATON.toggleMainLight(!1);let i=e.lightprobes;if(i&&(void 0!==i.auto&&ATON.setAutoLP(i.auto),i.list))for(let e in i.list){let t=i.list[e],o=new ATON.LightProbe(t.res);t.pos&&o.setPosition(parseFloat(t.pos[0]),parseFloat(t.pos[1]),parseFloat(t.pos[2])),t.near&&o.setNear(parseFloat(t.near)),t.far&&o.setFar(parseFloat(t.far)),ATON.addLightProbe(o),console.log(o)}e.exposure&&ATON.setExposure(e.exposure)},l._jsonParsers.soundscape=e=>{void 0!==e&&e.global&&ATON.setGlobalAudio(e.global.url,e.global.loop)},l._jsonParsers.navmode=e=>{void 0!==e&&ATON.Nav.setNavMode(e)},l._jsonParsers.locomotionGraph=e=>{if(void 0!==e){for(let t in e){let o=e[t];o.pos&&ATON.Nav.addLocomotionNode(parseFloat(o.pos[0]),parseFloat(o.pos[1]),parseFloat(o.pos[2]),!0)}ATON.Nav.setFirstPersonControl(),ATON.Nav.toggleLocomotionValidator(!1)}},l._jsonParsers.measurements=e=>{if(void 0!==e)for(let t in e){let o=e[t];if(o.points&&6===o.points.length){let e=new THREE.Vector3(parseFloat(o.points[0]),parseFloat(o.points[1]),parseFloat(o.points[2])),t=new THREE.Vector3(parseFloat(o.points[3]),parseFloat(o.points[4]),parseFloat(o.points[5]));ATON.SUI.addMeasurementPoint(e),ATON.SUI.addMeasurementPoint(t)}}},l._jsonParsers.viewpoints=e=>{if(void 0!==e)for(let t in e){let o=e[t];"home"===t?ATON.Nav.setHomePOV((new ATON.POV).setPosition(o.position[0],o.position[1],o.position[2]).setTarget(o.target[0],o.target[1],o.target[2]).setFOV(o.fov)):new ATON.POV(t).setPosition(o.position[0],o.position[1],o.position[2]).setTarget(o.target[0],o.target[1],o.target[2]).setFOV(o.fov)}},l._jsonParsers.scenegraph=e=>{if(void 0===e)return;let t=e.nodes,o=e.edges;for(let e in t){let o=t[e],i=ATON.getOrCreateSceneNode(e).removeChildren();l._applyJSONTransformToNode(o.transform,i);let r=o.urls;if(r&&(Array.isArray(r)?r.forEach((e=>{i.load(e)})):i.load(r)),o["cesium.ion"]){let e=o["cesium.ion"];ATON.MRes.loadCesiumIONAsset(e,i)}if(o.stream){let t,r=o.stream;if(r.src.startsWith("#")){let e=parseInt(r.src.substring(1));t=ATON.MediaFlow.getOrCreateVideoStream(e,void 0,!0)}else{let o=ATON.Utils.resolveCollectionURL(r.src);t=ATON.MediaFlow.getOrCreateVideoStream(e,o)}if(r.chromakey){let e=r.chromakey.color;e&&t.matStream.uniforms.keycolor.value.set(parseFloat(e[0]),parseFloat(e[1]),parseFloat(e[2]),parseFloat(e[3])),r.chromakey.smoothness&&(t.matStream.uniforms.smoothness.value=parseFloat(r.chromakey.smoothness)),r.chromakey.spill&&(t.matStream.uniforms.spill.value=parseFloat(r.chromakey.spill)),r.chromakey.similarity&&(t.matStream.uniforms.similarity.value=parseFloat(r.chromakey.similarity))}if(!o.urls){let e=new THREE.PlaneGeometry(1,1),o=new THREE.Mesh(e);o.scale.x=1,o.scale.y=-1,t.el.addEventListener("loadedmetadata",(e=>{let i=t.el.videoWidth/t.el.videoHeight;o.scale.x=i,o.scale.y=-1})),ATON.Utils.modelVisitor(i,o),i.add(o),ATON._bqScene=!0,i.setPickable(!0),i.dirtyBound()}i.setMaterial(t.matStream)}o.shadowcast&&i.setShadowCast(o.shadowcast),o.shadowreceive&&i.setShadowCast(o.shadowreceive),o.toYup&&i.setYup(),o.keywords&&(i.kwords=o.keywords)}for(let e in o){let t=o[e],i=ATON.getSceneNode(e);if(void 0!==i)for(let e in t){let o=t[e],r=ATON.getSceneNode(o);void 0!==r&&r.attachTo(i)}}for(let e in t){let o=t[e],i=ATON.getSceneNode(e);if(void 0!==i&&(void 0!==o.show&&(o.show?(i.show(),console.log("show "+e)):(i.hide(),console.log("hide "+e))),o.material)){let e;"string"==typeof o.material?e=ATON.MatHub.materials[o.material]:o.material.fragmentShader||o.material.vertexShader?(o.material.vertexShader||(o.material.vertexShader=ATON.MatHub.getDefVertexShader()),e=new THREE.ShaderMaterial(o.material)):e=new THREE.MeshStandardMaterial(o.material),e&&i.setMaterial(e)}}},l._jsonParsers.semanticgraph=e=>{if(void 0===e)return;let t=e.nodes,o=e.edges;for(let e in t){let o=t[e],i=ATON.getOrCreateSemanticNode(e).removeChildren(),r=o.urls;r&&(Array.isArray(r)?r.forEach((e=>{i.load(e)})):i.load(r)),o.toYup&&i.setYup(),o.description&&i.setDescription(o.description),o.audio&&i.setAudio(o.audio),o.keywords&&(i.kwords=o.keywords);let a=o.spheres;if(Array.isArray(a))for(let t in a){let o=a[t],i=new THREE.Vector3(parseFloat(o[0]),parseFloat(o[1]),parseFloat(o[2]));ATON.SemFactory.createSphere(e,i,parseFloat(o[3]))}let s=o.convexshapes;if(Array.isArray(s))for(let t in s){let o=s[t],i=[];for(let e=0;e{if(ATON.Nav.setFirstPersonControl(),e.list){let t=e.list,o=t.length;for(let e=0;e{ATON.XPFNetwork.setHomeXPF(0),ATON.XPFNetwork.requestTransitionByIndex(0,0)}))}},addSceneParser:(e,t)=>{l._jsonParsers[e]=t},patch:(e,t,o)=>{if(l._bLoading||!l._bEdit)return;if(void 0===e)return;void 0===t&&(t=l.MODE_ADD);let i=l.currID,r={};r.data=e,r.mode=t===l.MODE_DEL?"DEL":"ADD";let a=JSON.stringify(r);e=null,r=null,$.ajax({url:ATON.PATH_RESTAPI2+"scenes/"+i,type:"PATCH",data:a,contentType:"application/json; charset=utf-8",dataType:"json",success:e=>{e&&(l.currData=e),o&&o()}})}};l.sendEdit=l.patch,l.setVisibility=(e,t)=>{l.currData.visibility=e,l.sendEdit({visibility:e},ATON.SceneHub.MODE_ADD,t)},l.currSceneHasHomeConfig=()=>void 0!==l.currData&&void 0!==l.currData.viewpoints&&void 0!==l.currData.viewpoints.home,l.setTitle=e=>{l._title=e},l.getTitle=()=>l._title,l.setDescription=e=>{l._descr=e},l.getDescription=()=>l._descr;const d=l;let c={init:()=>{c._listener=new THREE.AudioListener,c._loader=new THREE.AudioLoader,c._bGenAuPlaying=!1},playOnceGlobally:(e,t)=>{if(t&&c._bGenAuPlaying)return;e=ATON.Utils.resolveCollectionURL(e);let o=new THREE.Audio(ATON.AudioHub._listener);return c._loader.load(e,(e=>{o.setBuffer(e),o.play(),t&&(c._bGenAuPlaying=!0)})),t&&(o.onEnded=()=>{c._bGenAuPlaying=!1}),o}};const u=c;class _ extends THREE.EventDispatcher{constructor(e){super(),!1===window.isSecureContext&&console.error("DeviceOrientationEvent is only available in secure contexts (https)"),this._zee=new THREE.Vector3(0,0,1),this._euler=new THREE.Euler,this._q0=new THREE.Quaternion,this._q1=new THREE.Quaternion(-Math.sqrt(.5),0,0,Math.sqrt(.5)),this._changeEvent={type:"change"};const t=this,o=new THREE.Quaternion;this.object=e,this.object.rotation.reorder("YXZ"),this.enabled=!0,this.deviceOrientation={},this.screenOrientation=0,this.alphaOffset=0;const i=function(e){t.deviceOrientation=e},r=function(){t.screenOrientation=window.orientation||0};this.connect=function(){r(),void 0!==window.DeviceOrientationEvent&&"function"==typeof window.DeviceOrientationEvent.requestPermission?window.DeviceOrientationEvent.requestPermission().then((function(e){"granted"==e&&(window.addEventListener("orientationchange",r),window.addEventListener("deviceorientation",i))})).catch((function(e){console.error("Unable to use DeviceOrientation API:",e)})):(window.addEventListener("orientationchange",r),window.addEventListener("deviceorientation",i)),t.enabled=!0},this.disconnect=function(){window.removeEventListener("orientationchange",r),window.removeEventListener("deviceorientation",i),t.enabled=!1},this.update=function(){if(!1===t.enabled)return;const e=t.deviceOrientation;if(e){const i=e.alpha?THREE.MathUtils.degToRad(e.alpha)+t.alphaOffset:0,r=e.beta?THREE.MathUtils.degToRad(e.beta):0,a=e.gamma?THREE.MathUtils.degToRad(e.gamma):0,s=t.screenOrientation?THREE.MathUtils.degToRad(t.screenOrientation):0;!function(e,o,i,r,a){t._euler.set(i,o,-r,"YXZ"),e.setFromEuler(t._euler),e.multiply(t._q1),e.multiply(t._q0.setFromAxisAngle(t._zee,-a))}(t.object.quaternion,i,r,a,s),8*(1-o.dot(t.object.quaternion))>1e-6&&(o.copy(t.object.quaternion),t.dispatchEvent(t._changeEvent))}},this.dispose=function(){t.disconnect()},this.connect()}}const p=_;let h={STD_FOV:50,STD_NEAR:.01,STD_FAR:800,FP_EPS:.01,STD_POV_TRANS_DURATION:2,STD_LOCNODE_SIZE:.5,MIN_LOC_VALID_DIST:1.5,MODE_ORBIT:0,MODE_FP:1,MODE_DEVORI:2,LocomotionNode:class{constructor(e){this.pos=new THREE.Vector3(0,0,0),this.id=e,this._iXPF=void 0,this._sui=void 0}setLocation(e,t,o){return e instanceof THREE.Vector3?this.pos.copy(e):this.pos.set(e,t,o),this._sui&&this._sui.position.copy(this.pos),this}getLocation(){return this.pos}realizeSUI(e){return void 0===ATON.SUI.gLocNodes||(this._sui=new THREE.Sprite(ATON.SUI.getOrCreateSpriteWalk()),this._sui.position.copy(this.pos),this._sui.scale.set(ATON.Nav.STD_LOCNODE_SIZE,ATON.Nav.STD_LOCNODE_SIZE,ATON.Nav.STD_LOCNODE_SIZE),ATON.SUI.gLocNodes.add(this._sui)),this}toggleSUI(e){return void 0===this._sui||(this._sui.visible=e),this}},init:()=>{h._mode=void 0,h.POVtransitionDuration=h.STD_POV_TRANS_DURATION,h._rotSpeedOrbit=.4,h._rotSpeedFP=-.2,h._inertia=.08,h._bControl=!0,h._bLocValidator=!0,h._bInteracting=!1,h._prevMode=void 0,h.setOrbitControl(),h._currPOV=(new ATON.POV).setPosition(0,0,0).setTarget(1,0,0).setFOV(ATON.Nav.STD_FOV),h._fromPOV=new ATON.POV,h._reqPOV=new ATON.POV,h.homePOV=void 0,h._tPOVcall=-1,h._tPOVprogress=0,h.povlist={},h._vDir=new THREE.Vector3(1,0,0),h._qOri=new THREE.Quaternion,h._lastPos=new THREE.Vector3(0,0,0),h._lastOri=new THREE.Quaternion,h._dOri=0,h._dPos=0,h._motionAmt=0,h._motionDir=new THREE.Vector3(0,1,0),h._bValidLocomotion=!1,h._locNodes=[],h._prevLN=void 0},getCurrentEyeLocation:()=>h._currPOV.pos,getCurrentDirection:()=>h._vDir,copyCurrentPOV:()=>{let e=new ATON.POV;return e.pos.copy(h._currPOV.pos),e.target.copy(h._currPOV.target),e.fov=h._currPOV.fov,e},addPOV:(e,t)=>{if(void 0!==e)return e.as(t),e},clearPOVs:()=>{for(let e in ATON.Nav.povlist)delete h.povlist[e]},isTransitioning:()=>h._tPOVcall>=0,currentQueryValidForLocomotion:()=>h._bValidLocomotion,locomotionValidator:()=>{if(void 0===ATON._queryDataScene)return void(h._bValidLocomotion=!1);let e=ATON._queryDataScene,t=(e.p,e.n);e.d<=h.MIN_LOC_VALID_DIST?h._bValidLocomotion=!1:t?t.y<=.7?h._bValidLocomotion=!1:h._bValidLocomotion=!0:h._bValidLocomotion=!1},toggleLocomotionValidator:e=>{e?h._bLocValidator=!0:(h._bLocValidator=!1,h._bValidLocomotion=!1)},addLocomotionNode:(e,t,o,i)=>{let r=(new h.LocomotionNode).setLocation(e,t,o);return i&&r.realizeSUI(),h._locNodes.push(r),ATON.fireEvent("LocomotionNodeAdded",r),r},getLocomotionNodeByIndex:e=>h._locNodes[e],clearLocomotionNodes:()=>{h._locNodes=[],h._prevLN=void 0,ATON.SUI.gLocNodes&&ATON.SUI.gLocNodes.removeChildren()},getLocomotionNodeInSight:()=>{let e=h._locNodes.length;if(e<=0)return;if(h.isTransitioning())return;let t,o,i=h._currPOV.pos,r=h._vDir;void 0===h._dirLNode&&(h._dirLNode=new THREE.Vector3);for(let a=0;a.8){let e=i.distanceToSquared(h._posLNode);e>.3&&(void 0===o||e{if(void 0===e)return;if(h._mode===h.MODE_ORBIT)return;let o=ATON.Nav._vDir,i=(new ATON.POV).setPosition(e.pos).setTarget(e.pos.x+o.x,e.pos.y+o.y,e.pos.z+o.z).setFOV(h._currPOV.fov);e.toggleSUI(!1),void 0!==h._prevLN&&h._prevLN.toggleSUI(!0),h.requestPOV(i,t),h._prevLN=e,ATON.fireEvent("LocomotionNodeRequested",e)},requestTransitionToLocomotionNodeInSightIfAny:e=>{let t=ATON.XPFNetwork.getNextXPFindex();if(void 0!==t)return h.requestTransitionToLocomotionNode(ATON.XPFNetwork._list[t]._lnode,e),!0;let o=ATON.Nav.getLocomotionNodeInSight();if(void 0===o)return!1;let i=h._locNodes[o];return h.requestTransitionToLocomotionNode(i,e),!0},requestDeltaRotation:(e,t,o)=>{if(ATON.XR._bPresenting)return;let i=new THREE.Vector3,r=new THREE.Vector3;i.crossVectors(h._vDir,THREE.Object3D.DEFAULT_UP),r.x=h._currPOV.target.x+i.x*e,r.y=h._currPOV.target.y+t,r.z=h._currPOV.target.z+i.z*e;let a=new ATON.POV;a.setTarget(r),a.setPosition(ATON.Nav._currPOV.pos),ATON.Nav.requestPOV(a,o)},setUserControl:e=>{void 0!==e&&e!==h._bControl&&(h._bControl=e,void 0!==h._controls&&(h._controls.enabled=e),h._cOrbit&&(h._cOrbit.enabled=e),h._cFirstPerson&&(h._cFirstPerson.enabled=e),console.log("Nav controls: "+h._bControl))},toggleUserControl:()=>{h.setUserControl(!h._bControl)},isUserControlEnabled:()=>h._bControl,isOrbit:()=>!ATON.XR._bPresenting&&h._mode===h.MODE_ORBIT,isFirstPerson:()=>!ATON.XR._bPresenting&&h._mode===h.MODE_FP,isDevOri:()=>!ATON.XR._bPresenting&&h._mode===h.MODE_DEVORI,setNavMode:e=>{void 0!==e&&(e===h.MODE_ORBIT&&h.setOrbitControl(),e===h.MODE_FP&&h.setFirstPersonControl(),e===h.MODE_DEVORI&&h.setDeviceOrientationControl())},restorePreviousNavMode:()=>{void 0===h._prevMode&&h.setOrbitControl(),h.setNavMode(h._prevMode)},_updCamera:e=>{if(void 0===e&&(e=h._camera),ATON.FX.composer){let t=ATON.FX.composer.passes;if(t)for(let o=0;o{if(!ATON.XR.isPresenting()){if(h._prevMode=h._mode,h._mode=h.MODE_ORBIT,h._bInteracting=!1,ATON.fireEvent("NavInteraction",!1),void 0===h._cOrbit){h._camOrbit=new THREE.PerspectiveCamera(h.STD_FOV,window.innerWidth/window.innerHeight,h.STD_NEAR,h.STD_FAR),h._camOrbit.layers.enableAll(),h._cOrbit=new THREE.OrbitControls(h._camOrbit,ATON._renderer.domElement);let e=h._cOrbit;e.rotateSpeed=h._rotSpeedOrbit,e.enablePan=!0,h._inertia>0&&(e.enableDamping=!0,e.dampingFactor=h._inertia),e.screenSpacePanning=!0,e.enableZoom=!0,e.minDistance=.03,e.maxDistance=300,h._bControl||(e.enabled=!1),e.addEventListener("start",(()=>{h._bInteracting=!0,ATON.fireEvent("NavInteraction",!0)})),e.addEventListener("end",(()=>{h._bInteracting=!1,ATON.fireEvent("NavInteraction",!1)}))}h._controls=h._cOrbit,h._camera=h._camOrbit,ATON.AudioHub._listener&&h._camera.children.length<1&&h._camera.add(ATON.AudioHub._listener),h._updCamera(),h._controls.update(),h._currPOV&&h.syncCurrCamera(),ATON._onResize(),ATON.toggleCenteredQuery(!1),ATON.fireEvent("NavMode",h._mode)}},setFirstPersonControl:()=>{if(!ATON.XR.isPresenting()){if(h._prevMode=h._mode,ATON.SUI.getSelectorRadius()>.1&&ATON.SUI.setSelectorRadius(.1),h._mode=h.MODE_FP,h._bInteracting=!1,ATON.fireEvent("NavInteraction",!1),void 0===h._cFirstPerson){h._camFP=new THREE.PerspectiveCamera(h.STD_FOV,window.innerWidth/window.innerHeight,h.STD_NEAR,h.STD_FAR),h._camFP.layers.enableAll(),h._cFirstPerson=new THREE.OrbitControls(h._camFP,ATON._renderer.domElement);let e=h._cFirstPerson;e.enableZoom=!1,e.enablePan=!1,e.rotateSpeed=h._rotSpeedFP,h._inertia>0&&(e.enableDamping=!0,e.dampingFactor=h._inertia),e.target.copy(h._camera.position),e.minDistance=.01,e.maxDistance=.01,h._bControl||(e.enabled=!1)}h._controls=h._cFirstPerson,h._camera=h._camFP,ATON.AudioHub._listener&&h._camera.children.length<1&&h._camera.add(ATON.AudioHub._listener),h._updCamera(),h._controls.update(),h._currPOV&&h.syncCurrCamera(),ATON._onResize(),ATON.toggleCenteredQuery(!1),ATON.fireEvent("NavMode",h._mode)}},setDeviceOrientationControl:()=>{ATON.Utils.isMobile()&&(h._prevMode=h._mode,h._mode=h.MODE_DEVORI,h._bInteracting=!1,ATON.fireEvent("NavInteraction",!1),ATON._screenPointerCoords.set(0,0),void 0===h._cDevOri&&(h._camDevOri=new THREE.PerspectiveCamera(h.STD_FOV,window.innerWidth/window.innerHeight,h.STD_NEAR,h.STD_FAR),h._camDevOri.layers.enableAll(),h._cDevOri=new p(h._camDevOri,ATON._renderer.domElement),h._cDevOri.alphaOffset=0),h._controls=h._cDevOri,h._camera=h._camDevOri,ATON.AudioHub._listener&&h._camera.children.length<1&&h._camera.add(ATON.AudioHub._listener),h._updCamera(),h._controls.update(),h._currPOV&&h.syncCurrCamera(),ATON._onResize(),ATON.toggleCenteredQuery(!0),ATON.fireEvent("NavMode",h._mode))},useAbsoluteOrientation:e=>{h._cDevOri},setMotionAmount:e=>{h._motionAmt=e},setMotionDirection:e=>{h._motionDir.copy(e)},stop:()=>{h._motionAmt=0},setFOV:e=>{if(ATON.XR.isPresenting())return;h._currPOV.fov=e;let t=h._camera;t.fov=e,t.updateProjectionMatrix()},getFOV:()=>h._currPOV.fov,_deltaMotions:()=>{h._dOri=h._lastOri.angleTo(ATON.Nav._qOri),h._dPos=h._lastPos.distanceToSquared(h._currPOV.pos),h._lastPos.copy(h._currPOV.pos),h._lastOri.copy(ATON.Nav._qOri)},syncCurrPOV:()=>{if(ATON.XR.isPresenting()){const e=ATON._renderer.xr.getCamera().cameras[0];return h._currPOV.pos.copy(e.position),h._qOri.copy(e.quaternion),e.getWorldDirection(h._vDir),h._currPOV.pos.x+=ATON.XR.rig.position.x,h._currPOV.pos.y+=ATON.XR.rig.position.y,h._currPOV.pos.z+=ATON.XR.rig.position.z,void h._deltaMotions()}const e=h._controls,t=h._camera;if(t.getWorldDirection(h._vDir),t.getWorldQuaternion(h._qOri),h._deltaMotions(),h._mode!==h.MODE_DEVORI){if(h._mode===h.MODE_FP)return h._currPOV.pos.copy(e.target),h._currPOV.target.x=h._currPOV.pos.x+h._vDir.x,h._currPOV.target.y=h._currPOV.pos.y+h._vDir.y,void(h._currPOV.target.z=h._currPOV.pos.z+h._vDir.z);h._currPOV.pos.copy(t.position),h._currPOV.target.copy(e.target)}else h._currPOV.pos.copy(t.position)},applyPOVconstraints:e=>{},handlePOV:()=>{ATON.XR.isPresenting()?h.handleXRtransition():h.handlePOVtransition(),h.handleMotion(),h.applyPOVconstraints(h._currPOV)},handleMotion:()=>{if(h.isTransitioning())return;if(0==h._motionAmt)return;ATON.XR.controller0&&ATON.XR.controller0.visible?(ATON.XR.controller0.getWorldDirection(h._motionDir),h._motionDir.negate()):h._motionDir.copy(h._vDir);let e=h._motionAmt*ATON._dt,t=h._motionDir.x*e,o=h._motionDir.y*e,i=h._motionDir.z*e;h._currPOV.pos.x+=t,h._currPOV.pos.y+=o,h._currPOV.pos.z+=i,h._currPOV.target.x+=t,h._currPOV.target.y+=o,h._currPOV.target.z+=i},handlePOVtransition:()=>{if(!(h._tPOVcall<0)){if(h.POVtransitionDuration<=0?h._tPOVprogress=1:h._tPOVprogress=(ATON._clock.elapsedTime-h._tPOVcall)/h.POVtransitionDuration,h._tPOVprogress>=1)return h._tPOVcall=-1,h._currPOV.pos.copy(h._reqPOV.pos),h._currPOV.target.copy(h._reqPOV.target),h._currPOV.fov=h._reqPOV.fov,void ATON.fireEvent("POVTransitionCompleted",h._reqPOV.id);var e;h._tPOVprogress=(e=h._tPOVprogress,(1-Math.cos(e*Math.PI))/2),h._currPOV.pos.lerpVectors(h._fromPOV.pos,h._reqPOV.pos,h._tPOVprogress),h._currPOV.target.lerpVectors(h._fromPOV.target,h._reqPOV.target,h._tPOVprogress),h._fromPOV.fov&&h._reqPOV.fov&&(h._currPOV.fov=THREE.MathUtils.lerp(h._fromPOV.fov,h._reqPOV.fov,h._tPOVprogress),h._camera.fov=h._currPOV.fov,h._camera.updateProjectionMatrix())}},handleXRtransition:()=>{if(!(h._tPOVcall<0)){if(h.POVtransitionDuration<=0?h._tPOVprogress=1:h._tPOVprogress=(ATON._clock.elapsedTime-h._tPOVcall)/h.POVtransitionDuration,h._tPOVprogress>=1)return h._tPOVcall=-1,ATON.XR._currPos.copy(ATON.XR._reqPos),void ATON.fireEvent("POVTransitionCompleted",h._reqPOV.id);ATON.XR._currPos.lerpVectors(ATON.XR._fromPos,ATON.XR._reqPos,h._tPOVprogress)}},syncCurrCamera:()=>{if(ATON.XR.isPresenting())return;let e=h._controls,t=h._camera,o=h._currPOV.pos,i=h._currPOV.target;h._mode!==h.MODE_DEVORI?(h._vDir.subVectors(i,o),h._vDir.normalize(),h._mode===h.MODE_FP?(e.target.copy(o),t.position.x=e.target.x-h._vDir.x*h.FP_EPS,t.position.y=e.target.y-h._vDir.y*h.FP_EPS,t.position.z=e.target.z-h._vDir.z*h.FP_EPS):(t.position.copy(o),e.target.copy(i))):t.position.copy(o)},update:()=>{h.syncCurrPOV(),h.handlePOV(),h.syncCurrCamera()},requestPOV:(e,t,o)=>{ATON._tPOVcall>=0||void 0!==e&&(ATON.XR._bPresenting&&"immersive-ar"===ATON.XR._sessionType||(h.POVtransitionDuration=void 0!==t?t:h.STD_POV_TRANS_DURATION,ATON.XR.isPresenting()?(h._reqPOV.pos.copy(e.pos?e.pos:h._currPOV.pos),h._fromPOV.pos.copy(h._currPOV.pos),ATON.XR._reqPos.copy(e.pos?e.pos:h._currPOV.pos),ATON.XR._fromPos.copy(ATON.XR._currPos)):(h._reqPOV.pos.copy(e.pos?e.pos:h._currPOV.pos),h._reqPOV.target.copy(e.target?e.target:h._currPOV.target),h._reqPOV.fov=e.fov?e.fov:h._currPOV.fov,h._fromPOV.pos.copy(h._currPOV.pos),h._fromPOV.target.copy(h._currPOV.target),h._fromPOV.fov=h._currPOV.fov),o&&(e.pos&&(h._reqPOV.pos.x*=ATON._worldScale,h._reqPOV.pos.y*=ATON._worldScale,h._reqPOV.pos.z*=ATON._worldScale,ATON.XR.isPresenting()&&(ATON.XR._reqPos.x*=ATON._worldScale,ATON.XR._reqPos.y*=ATON._worldScale,ATON.XR._reqPos.z*=ATON._worldScale)),e.target&&(h._reqPOV.target.x*=ATON._worldScale,h._reqPOV.target.y*=ATON._worldScale,h._reqPOV.target.z*=ATON._worldScale)),h._tPOVcall=ATON._clock.elapsedTime,ATON.fireEvent("POVTransitionRequested",e.id)))},requestPOVbyBound:(e,t)=>{if(void 0===e)return;let o=new THREE.Vector3,i=3*e.radius;o.x=e.center.x-i*h._vDir.x,o.y=e.center.y-i*h._vDir.y,o.z=e.center.z-i*h._vDir.z;let r=(new ATON.POV).setPosition(o).setTarget(e.center);h.requestPOV(r,t)},requestPOVbyNode:(e,t)=>{if(void 0===e)return;let o=e.getBound();h.requestPOVbyBound(o,t)},requestPOVbyID:(e,t)=>{if(void 0===e)return;let o=h.povlist[e];void 0!==o&&h.requestPOV(o,t)},requestRetarget:(e,t,o)=>{let i=new THREE.Vector3;if(void 0===t)i.lerpVectors(e,h._currPOV.pos,.8);else{let o=e.distanceTo(h._currPOV.pos);o*=.5,i.x=e.x+t.x*o,i.y=e.y+t.y*o,i.z=e.z+t.z*o}let r=e.distanceTo(i);ATON.FX.setDOFfocus(r);let a=(new ATON.POV).setPosition(i).setTarget(e).setFOV(h._currPOV.fov);h.requestPOV(a,o),console.log(a)},computeDefaultHome:(e,t)=>{void 0===e&&(e=new THREE.Vector3(1,.7,1)),void 0===t&&(t=ATON.getRootScene().getBound());let o=new THREE.Vector3(t.center.x+t.radius*e.x*1.5,t.center.y+t.radius*e.y*1.5,t.center.z+t.radius*e.z*1.5);h.homePOV=(new ATON.POV).setPosition(o).setTarget(t.center)},setHomePOV:e=>{h.homePOV=e},computeAndRequestDefaultHome:(e,t,o)=>{h.computeDefaultHome(t,o),h.requestPOV(h.homePOV,e)},requestHomePOV:e=>{h.requestPOV(h.homePOV,e)}};h.requestHome=h.requestHomePOV,h.setAndRequestHomePOV=(e,t)=>{h.setHomePOV(e),h.requestPOV(e,t)},h.clear=()=>{h.clearPOVs(),h.clearLocomotionNodes()},h.DeviceOrientationControls=function(e){let t=this;this.object=e,this.object.rotation.reorder("YXZ"),this.enabled=!0,this.deviceOrientation={},this.screenOrientation=0,this.alphaOffset=0,this.absolute=!1,this.alphaOffsetDevice=void 0,this.alphaOffsetScreen=void 0;let o=function(e){t.absolute||(t.deviceOrientation=e)},i=function(e){t.deviceOrientation=e,t.absolute=!0},r=function(){t.screenOrientation=window.orientation||0},a=function(){let e=new THREE.Vector3(0,0,1),t=new THREE.Euler,o=new THREE.Quaternion,i=new THREE.Quaternion(-Math.sqrt(.5),0,0,Math.sqrt(.5));return function(r,a,s,n,l){t.set(s,a,-n,"YXZ"),r.setFromEuler(t),r.multiply(i),r.multiply(o.setFromAxisAngle(e,-l))}}();this.connect=function(){r(),window.addEventListener("orientationchange",r,!1),window.addEventListener("deviceorientation",o,!1),window.addEventListener("deviceorientationabsolute",i,!1),t.enabled=!0},this.disconnect=function(){window.removeEventListener("orientationchange",r,!1),window.removeEventListener("deviceorientation",o,!1),window.removeEventListener("deviceorientationabsolute",i,!1),t.enabled=!1},this.update=function(){if(!1===t.enabled)return;let e;if(e=t.deviceOrientation,e){let o=this.getDirection()?THREE.Math.degToRad(this.getDirection())+t.alphaOffset:0,i=e.beta?THREE.Math.degToRad(e.beta):0,r=e.gamma?THREE.Math.degToRad(e.gamma):0,s=t.screenOrientation?THREE.Math.degToRad(t.screenOrientation):0;a(t.object.quaternion,o,i,r,s)}},this.dispose=()=>{t.disconnect()},this.iOSOrientationPermission=()=>{"function"==typeof DeviceOrientationEvent.requestPermission&&DeviceOrientationEvent.requestPermission().then((e=>{console.log(e)})).catch(console.error)},this.getDirection=()=>void 0!==t.deviceOrientation.webkitCompassHeading?t.deviceOrientation.webkitCompassHeading:t.deviceOrientation.alpha,this.getDirectionMap=()=>void 0!==t.deviceOrientation.webkitCompassHeading?360-t.deviceOrientation.webkitCompassHeading:t.deviceOrientation.alpha,this.connect()};const m=h;let v={STD_TELEP_DURATION:.03,HAND_R:0,HAND_L:1,MOBILE_DENSITY_F:.5,MAX_QUERY_DISTANCE:40,init:()=>{ATON._renderer.xr.enabled=!0,ATON._renderer.xr.setReferenceSpaceType("local"),ATON.device.isMobile?ATON._renderer.xr.setFramebufferScaleFactor(ATON._stdpxd*v.MOBILE_DENSITY_F):ATON._renderer.xr.setFramebufferScaleFactor(ATON._stdpxd),v._bPresenting=!1,v.currSession=null,v._sessionType="immersive-vr",v._bReqPresenting=!1,v.rig=new THREE.Group,v.rig.add(ATON.Nav._camera),ATON._rootUI.add(v.rig),v._cam=void 0,v._currPos=v.rig.position,v._fromPos=new THREE.Vector3,v._reqPos=new THREE.Vector3,v.gControllers=void 0,v.controller0=void 0,v.controller1=void 0,v.controller0pos=new THREE.Vector3,v.controller1pos=new THREE.Vector3,v.controller0dir=new THREE.Vector3,v.controller1dir=new THREE.Vector3,v._lastPosR=void 0,v._lastPosL=void 0,v._pointerLineGeom=void 0,v._pointerLineMesh=void 0,v.gpad0=void 0,v.gpad1=void 0,v._urlHand=ATON.PATH_RES+"models/hand/hand.glb",ATON.on("XRselectStart",(e=>{e===v.HAND_R&&ATON._stdActivation()})),ATON.on("XRselectEnd",(e=>{})),ATON.on("XRsqueezeStart",(e=>{e===v.HAND_R&&ATON.Photon.setFocusStreaming(!0)})),ATON.on("XRsqueezeEnd",(e=>{e===v.HAND_R&&ATON.Photon.setFocusStreaming(!1)})),ATON.on("VRC_IDassigned",(e=>{let t=ATON.getUINode("Rhand"),o=ATON.getUINode("Lhand"),i=ATON.MatHub.materials.avatars,r=i[e%i.length];o&&o.setMaterial(r),t&&t.setMaterial(r)}))},setSessionType:e=>{void 0!==e&&("immersive-vr"!==e&&"immersive-ar"!==e||(v._sessionType=e,console.log("Session type: "+e)))},isPresenting:()=>v._bPresenting,teleportOnQueriedPoint:()=>{if(!ATON.Nav.currentQueryValidForLocomotion())return!1;const e=ATON._queryDataScene.p;return ATON.Nav.requestPOV((new ATON.POV).setPosition(e.x,e.y+ATON.userHeight,e.z),v.STD_TELEP_DURATION),!0},setupQueryRay:e=>{void 0!==e&&(v.controller0?e.set(v.controller0pos,v.controller0dir):e.set(ATON.Nav.getCurrentEyeLocation(),ATON.Nav.getCurrentDirection()))},setRefSpaceLocation:e=>{v.rig.position.copy(e)},_setupControllerR:(e,t)=>{v.controller0||(v.controller0=e,console.log("R controller"),e.addEventListener("selectstart",(()=>{ATON.fireEvent("XRselectStart",v.HAND_R)})),e.addEventListener("selectend",(()=>{ATON.fireEvent("XRselectEnd",v.HAND_R)})),e.addEventListener("squeezestart",(()=>{ATON.fireEvent("XRsqueezeStart",v.HAND_R)})),e.addEventListener("squeezeend",(()=>{ATON.fireEvent("XRsqueezeEnd",v.HAND_R)})),v.setupControllerUI(v.HAND_R,t),ATON.fireEvent("XRcontrollerConnected",v.HAND_R))},_setupControllerL:(e,t)=>{v.controller1||(v.controller1=e,console.log("L controller"),e.addEventListener("selectstart",(()=>{ATON.fireEvent("XRselectStart",v.HAND_L)})),e.addEventListener("selectend",(()=>{ATON.fireEvent("XRselectEnd",v.HAND_L)})),e.addEventListener("squeezestart",(()=>{ATON.fireEvent("XRsqueezeStart",v.HAND_L)})),e.addEventListener("squeezeend",(()=>{ATON.fireEvent("XRsqueezeEnd",v.HAND_L)})),v.setupControllerUI(v.HAND_L,t),ATON.fireEvent("XRcontrollerConnected",v.HAND_L))},setupSceneForAR:()=>{if("immersive-ar"!==v._sessionType)return;ATON.recomputeSceneBounds();let e=ATON.bounds.center;ATON._rootVisible.position.x=-e.x,ATON._rootVisible.position.y=-e.y,ATON._rootVisible.position.z=-e.z,ATON._rootSem.position.x=-e.x,ATON._rootSem.position.y=-e.y,ATON._rootSem.position.z=-e.z,ATON.recomputeSceneBounds()},resetSceneOffsets:()=>{ATON._rootVisible.position.set(0,0,0),ATON._rootSem.position.set(0,0,0),ATON.recomputeSceneBounds()},onSessionStarted:e=>{v.currSession||(v._bReqPresenting=!1,e.addEventListener("end",v.onSessionEnded),e.isImmersive=!0,console.log(v._sessionType+" session started."),ATON.MediaFlow.stopAllStreams(),"immersive-ar"===v._sessionType&&ATON._renderer.xr.setReferenceSpaceType("local"),ATON._renderer.xr.setSession(e).then((()=>{if(v.currSession=e,console.log(v.currSession),"immersive-ar"===v._sessionType)ATON._mainRoot.background=null,ATON._mMainPano&&(ATON._mMainPano.visible=!1),ATON._renderer.xr.getController(0)&&ATON.device.isMobile&&(v.controller0=ATON._renderer.xr.getController(0),v.controller0.addEventListener("selectstart",(()=>{ATON.fireEvent("XRselectStart",v.HAND_R),console.log("Head-aligned select")})),v.controller0.addEventListener("selectend",(()=>{ATON.fireEvent("XRselectEnd",v.HAND_R)})),v.gControllers.add(v.controller0));else{for(let e=0;e<2;e++){const t=ATON._renderer.xr.getController(e);void 0===t||t.userData.bXRconfig||(t.visible=!1,t.userData.bXRconfig=!0,t.addEventListener("connected",(e=>{let o=e.data.handedness;t.gm=e.data.gamepad,console.log("Hand "+o),console.log("GamePad "+t.gm),"left"===o?v._setupControllerL(t,!0):"right"===o?v._setupControllerR(t,!0):(t.addEventListener("selectstart",(()=>{ATON.fireEvent("XRselectStart",v.HAND_R),console.log("Head-aligned select")})),t.addEventListener("selectend",(()=>{ATON.fireEvent("XRselectEnd",v.HAND_R)})),ATON.fireEvent("XRcontrollerConnected",v.HAND_R))})))}v.rig.add(ATON.Nav._camera),v.setRefSpaceLocation(ATON.Nav._currPOV.pos)}let t=ATON._renderer.xr.getCamera(ATON.Nav._camera);ATON.Nav._updCamera(t),v._bPresenting=!0,ATON.Nav._bInteracting=!1,console.log("XR now presenting"),ATON.fireEvent("XRmode",!0),ATON.toggleShadows(!1),ATON.SUI.getSelectorRadius()>ATON.FE.STD_SEL_RAD&&ATON.SUI.setSelectorRadius(ATON.FE.STD_SEL_RAD),ATON._qSyncInt=2,ATON.XPFNetwork.getNumXPFs()>0?ATON.setQueryRange(0,100):ATON.setQueryRange(0,v.MAX_QUERY_DISTANCE),ATON.MRes.estimateTSErrorTarget(),setTimeout((()=>{ATON.SUI.getSelectorRadius()>ATON.FE.STD_SEL_RAD&&ATON.SUI.setSelectorRadius(ATON.FE.STD_SEL_RAD)}),2e3)})))},onSessionEnded:()=>{v.currSession.removeEventListener("end",v.onSessionEnded),v.currSession=null,v._bReqPresenting=!1,v._bPresenting=!1,ATON.Nav._bInteracting=!1,"immersive-ar"===v._sessionType&&ATON._mMainPano&&(ATON._mMainPano.visible=!0),v.setRefSpaceLocation(new THREE.Vector3(0,0,0)),ATON.fireEvent("XRmode",!1),ATON._qSyncInt=1,ATON.MediaFlow.stopAllStreams(),ATON.Nav.requestHome(),ATON.Nav._updCamera(),ATON.setQueryRange(0,1/0),ATON.MRes.estimateTSErrorTarget(),console.log("Quit XR")},toggle:e=>{if(v.setSessionType(e),ATON.device.xrSupported[v._sessionType])if(null===v.currSession){let e={optionalFeatures:["high-refresh-rate"]};"immersive-ar"===v._sessionType&&(void 0===e.optionalFeatures&&(e.optionalFeatures=[]),e.optionalFeatures.push("light-estimation")),v._bReqPresenting=!0,navigator.xr.requestSession(v._sessionType,e).then(v.onSessionStarted)}else v.currSession.end()},setupControllerUI:(e,t)=>{let o,i;if(void 0===v.gControllers&&(v.gControllers=ATON.createUINode(),v.gControllers.disablePicking(),v.rig.add(v.gControllers)),e===v.HAND_L?(v.gControllers.add(v.controller1),t&&(i=ATON.createUINode("Lhand").load(v._urlHand).setMaterial(ATON.MatHub.materials.controllerRay).setScale(-1,1,1),v.controller1.add(i))):(v.gControllers.add(v.controller0),t&&(v._pointerLineGeom=new THREE.CylinderGeometry(.003,.003,1,4),v._pointerLineGeom.rotateX(-Math.PI/2),v._pointerLineGeom.translate(0,0,-.5),v._pointerLineMesh=new THREE.Mesh(v._pointerLineGeom,ATON.MatHub.materials.controllerRay),v.controller0.add(v._pointerLineMesh),v._pointerLineMesh.visible=!1,o=ATON.createUINode("Rhand").load(v._urlHand).setMaterial(ATON.MatHub.materials.controllerRay),v.controller0.add(o))),void 0!==ATON.Photon.uid&&t){let t=ATON.MatHub.materials.avatars,r=t[ATON.Photon.uid%t.length];e===v.HAND_L?i.setMaterial(r):o.setMaterial(r)}},switchHands:()=>{let e=v.controller1;v.controller1=v.controller0,v.controller0=e;for(let e in v.controller0.children)v.controller0.remove(v.controller0.children[e]);for(let e in v.controller1.children)v.controller1.remove(v.controller1.children[e]);v.gControllers.removeChildren(),v.setupControllerUI(v.HAND_L),v.setupControllerUI(v.HAND_R),console.log("VR controllers switched")},getControllerSpace:e=>{1===e?v.getControllerGrip(1):v.getControllerGrip(0)},getControllerWorldLocation:e=>1===e?v.controller1pos:v.controller0pos,getControllerWorldDirection:e=>1===e?v.controller1dir:v.controller0dir,_deltaMotionController:e=>{if(e===v.HAND_L&&void 0===v._lastPosL)return;if(e===v.HAND_R&&void 0===v._lastPosR)return;let t=e===v.HAND_L?v.controller1pos:v.controller0pos,o=e===v.HAND_L?v._lastPosL:v._lastPosR;THREE.Vector3(t.x-o.x,t.y-o.y,t.z-o.z).lengthSq(),e===v.HAND_L?v._lastPosL=t:v._lastPosR=t},update:()=>{v.controller0&&v.controller0.visible&&(v.controller0.getWorldPosition(v.controller0pos),v.controller0.getWorldDirection(v.controller0dir),v.controller0dir.negate()),v.controller1&&v.controller1.visible&&(v.controller1.getWorldPosition(v.controller1pos),v.controller1.getWorldDirection(v.controller1dir),v.controller1dir.negate())},getAxisValue:e=>{let t=new THREE.Vector2(0,0),o=e===v.HAND_L?v.controller1:v.controller0;if(void 0===o)return t;if(void 0===o.gm||void 0===o.gm.axes)return t;let i=o.gm.axes[0],r=o.gm.axes[2],a=o.gm.axes[1],s=o.gm.axes[3];return t.x=i>0?-i:r,t.y=a>0?a:-s,t}};const T=v,g=class extends t{constructor(e,t,o){super(e,ATON.NTYPES.UI),this.baseColor=ATON.MatHub.colors.black,this.baseOpacity=.5,this.container=new ThreeMeshUI.Block({width:t||.2,height:o||.05,padding:.001,borderRadius:.01,backgroundColor:this.baseColor,backgroundOpacity:this.baseOpacity,fontFamily:ATON.SUI.PATH_FONT_JSON,fontTexture:ATON.SUI.PATH_FONT_TEX,justifyContent:"center",textAlign:"center"}),this.container.position.z=.03,this.add(this.container),this.uiText=new ThreeMeshUI.Text({content:"Label",fontSize:.03,fontColor:ATON.MatHub.colors.white}),this.container.add(this.uiText),ThreeMeshUI.update()}setBaseColor(e){return this.baseColor=e,this.container.set({backgroundColor:this.baseColor}),ThreeMeshUI.update(),this}setTextColor(e){return this.uiText.set({fontColor:e}),ThreeMeshUI.update(),this}setBackgroundOpacity(e){return this.container.set({backgroundOpacity:e}),this.baseOpacity=e,ThreeMeshUI.update(),this}setText(e){return this.uiText.set({content:e}),ThreeMeshUI.update(),this}};let S={STD_BTN_SIZE:.1,STD_SELECTOR_TICKNESS:1.05};S.Button=class extends t{constructor(e,t=1,o=1){super(e,ATON.NTYPES.UI),this.baseColor=ATON.MatHub.colors.black,this.switchColor=ATON.MatHub.colors.green,this.baseOpacity=.5,this.hoverOpacity=.8,this._bSwitched=!1,this.container=new ThreeMeshUI.Block({width:.1*t,height:.1,padding:.01,borderRadius:.02,backgroundColor:this.baseColor,backgroundOpacity:this.baseOpacity,fontFamily:ATON.SUI.PATH_FONT_JSON,fontTexture:ATON.SUI.PATH_FONT_TEX,justifyContent:"center",textAlign:"center"}),this.add(this.container),this.uiText=new ThreeMeshUI.Text({content:"",fontSize:.02*o,fontColor:ATON.MatHub.colors.white}),this.container.add(this.uiText);let i=.9*ATON.SUI.STD_BTN_SIZE*t,r=.9*ATON.SUI.STD_BTN_SIZE;this._trigger=new THREE.Mesh(new THREE.PlaneGeometry(i,r,2),ATON.MatHub.materials.fullyTransparent),this._trigger.position.set(0,0,.002),this.add(this._trigger),this.onHover=()=>{this.container.set({backgroundOpacity:this.hoverOpacity})},this.onLeave=()=>{this.container.set({backgroundOpacity:this.baseOpacity})},this.enablePicking(),this.traverse((e=>{e.material&&(e.material.depthWrite=!1)})),ThreeMeshUI.update()}setBaseColor(e){return this.baseColor=e,this._bSwitched||this.container.set({backgroundColor:this.baseColor}),ThreeMeshUI.update(),this}setSwitchColor(e){return this.switchColor=e,this._bSwitched&&this.container.set({backgroundColor:this.switchColor}),ThreeMeshUI.update(),this}setBackgroundOpacity(e){return this.container.set({backgroundOpacity:e}),this.baseOpacity=e,ThreeMeshUI.update(),this}setText(e){return this.uiText.set({content:e}),ThreeMeshUI.update(),this}switch(e){return this._bSwitched=e,e?this.container.set({backgroundColor:this.switchColor}):this.container.set({backgroundColor:this.baseColor}),ThreeMeshUI.update(),this}setIcon(e,t){return ATON.Utils.textureLoader.load(e,(e=>{this._trigger.material=new THREE.MeshStandardMaterial({map:e,transparent:!0,depthWrite:!1}),t&&(this.setBackgroundOpacity(0),this.hoverOpacity=0),this.uiText.position.set(0,-.035,0)})),ThreeMeshUI.update(),this}},S.Label=g,S.MediaPanel=class extends t{constructor(e){super(e,ATON.NTYPES.UI),this._resurl=void 0,this._mediamesh=void 0,this._vs=void 0,this._yratio=1,this._titleYoffs=.6,this._color=ATON.MatHub.colors.black;let t=this;this.onSelect=()=>{t._vs&&t._vs.el}}load(e,t){this._yratio=1,this._mediamesh||(this._mediamesh=new THREE.Mesh(new THREE.PlaneGeometry(1,1)),this.add(this._mediamesh)),e=ATON.Utils.resolveCollectionURL(e);let o=this;return ATON.Utils.isVideo(e)?(this._vs=ATON.MediaFlow.getOrCreateVideoStream(this.nid,e,!1),this._mediamesh.material=this._vs.matStream,this._vs.el.addEventListener("loadedmetadata",(i=>{o._yratio=o._vs.el.videoHeight/o._vs.el.videoWidth,o._mediamesh.scale.y=-o._yratio,o._resurl=e,o._onContentLoad(),t&&t()}))):ATON.Utils.loadTexture(e,(i=>{i.image&&(this._yratio=i.image.height/i.image.width),o._mediamesh.scale.y=o._yratio,o._mediamesh.material=ATON.MatHub.materials.chromakey.clone(),o._mediamesh.material.uniforms.tBase.value=i,o._mediamesh.material.needsUpdate=!0,o._resurl=e,o._onContentLoad(),t&&t()})),this.setPickable(!0),this}setColor(e){return this._color=e,this._labelTitle&&this._labelTitle.setBaseColor(e),this._bd&&(this._bd.material.color=e),this}getMaterial(){return this._mediamesh.material}_onContentLoad(){this._labelTitle&&(this._labelTitle.position.y=this._yratio*this._titleYoffs),this._bd&&(this._bd.scale.y=1.05*this._yratio)}setTitle(e){return this._labelTitle||(this._labelTitle=new g(void 0,.5,.07),this._labelTitle.position.z=-.01,this._labelTitle.attachTo(this)),this._labelTitle.setText(e),this._labelTitle.setBaseColor(this._color),this}toggleTitle(e){return this._labelTitle?(this._labelTitle.toggle(e),this):this}setBackdrop(e){return this._bd=new THREE.Mesh(new THREE.PlaneGeometry(1,1)),this._bd.material=new THREE.MeshStandardMaterial({transparent:!0,side:THREE.DoubleSide,color:this._color,opacity:e||.5}),this._bd.scale.x=1.05,this._bd.scale.y=1.05*this._yratio,this._bd.position.z=-.005,this.add(this._bd),this}},S.init=()=>{S.initSelector(),S.fpTeleport=ATON.createUINode();let e=new THREE.CylinderGeometry(.4,.4,.9,32,1,!0),t=new THREE.Mesh(e,ATON.MatHub.getMaterial("teleportLoc"));t.renderOrder=100,S.fpTeleport.add(t),S.fpTeleport.disablePicking(),S.fpTeleport.visible=!1,ATON._rootUI.add(S.fpTeleport),S.PATH_FONT_JSON||(S.PATH_FONT_JSON=ATON.PATH_RES+"fonts/custom-msdf.json"),S.PATH_FONT_TEX||(S.PATH_FONT_TEX=ATON.PATH_RES+"fonts/custom.png"),S.gMeasures=ATON.createUINode(),S._prevMPoint=void 0,S._measLabels=[],ATON._rootUI.add(S.gMeasures);let o=(new THREE.BufferGeometry).setFromPoints([new THREE.Vector3,new THREE.Vector3]);S._measLine=new THREE.Line(o,ATON.MatHub.getMaterial("measurement")),S._measLine.visible=!1,ATON._rootUI.add(S._measLine),S.gPoints=ATON.createUINode(),ATON._rootUI.add(S.gPoints),S.gLocNodes=ATON.createUINode(),ATON._rootUI.add(S.gLocNodes),S.buildInfoNode(),S.bShowInfo=!0,S._labelScale=ATON.Utils.isMobile()?80:90,S._labelScaleVR=2,S.sprites={},S._sync=0},S.getOrCreateSpritePointEdit=()=>(S.sprites.pointEdit||(S.sprites.pointEdit=new THREE.SpriteMaterial({map:(new THREE.TextureLoader).load(ATON.PATH_RES+"sui-point.png"),color:ATON.MatHub.colors.orange,transparent:!0,opacity:1,depthTest:!1})),S.sprites.pointEdit),S.getOrCreateSpriteSemIcon=()=>(S.sprites.semIcon||(S.sprites.semIcon=new THREE.SpriteMaterial({map:(new THREE.TextureLoader).load(ATON.PATH_RES+"sui-sem.png"),transparent:!0,opacity:1,depthWrite:!1,depthTest:!1})),S.sprites.semIcon),S.getOrCreateSpriteLP=()=>(S.sprites.lp||(S.sprites.lp=new THREE.SpriteMaterial({map:(new THREE.TextureLoader).load(ATON.PATH_RES+"sui-lp.png"),transparent:!0,opacity:1,depthWrite:!1}),S.sprites.lp.sizeAttenuation=!1),S.sprites.lp),S.getOrCreateSpriteWalk=()=>(S.sprites.walk||(S.sprites.walk=new THREE.SpriteMaterial({map:(new THREE.TextureLoader).load(ATON.PATH_RES+"sui-walk.png"),transparent:!0,opacity:1,depthWrite:!1})),S.sprites.walk),S.initSelector=()=>{S.mainSelector=ATON.createUINode(),S._mSelectorSphere=new THREE.Mesh(ATON.Utils.geomUnitSphere,ATON.MatHub.getMaterial("selector")),S._mSelectorSphere.renderOrder=100,S.mainSelector.add(S._mSelectorSphere),S.mainSelector.disablePicking(),S.setSelectorRadius(.05),S.mainSelector.visible=!1,ATON._rootUI.add(S.mainSelector),S._selOffset=new THREE.Vector3,S._bShowSelector=!0},S.enableLPIcons=()=>{S.gLPIcons=ATON.createUINode(),S.gLPIcons.disablePicking(),ATON._rootUI.add(S.gLPIcons)},S.enableSemIcons=()=>{S.gSemIcons=ATON.createUINode(),S.gSemIcons.disablePicking(),ATON._rootUI.add(S.gSemIcons)},S.showSelector=e=>{S._bShowSelector=e},S.setSelectorRadius=e=>{S._selectorRad=e,S.mainSelector.scale.set(e,e,e)},S.setSelectorOffset=(e,t,o)=>{void 0!==e&&(S._selOffset.x=e),void 0!==t&&(S._selOffset.y=t),void 0!==o&&(S._selOffset.z=o);let i=ATON.getSceneQueriedPoint();void 0!==i&&(S.mainSelector.position.x=i.x+S._selOffset.x,S.mainSelector.position.y=i.y+S._selOffset.y,S.mainSelector.position.z=i.z+S._selOffset.z)},S.getSelectorRadius=()=>S._selectorRad,S.getSelectorLocation=()=>S.mainSelector.position,S.setSelectorModel=(e,t)=>{void 0!==e&&(S.mainSelector.removeChildren(),S.mainSelector.load(e).disablePicking(),t&&S.mainSelector.setMaterial(ATON.MatHub.getMaterial("selector")))},S.setSelectorColor=(e,t)=>{let o=ATON.MatHub.materials.selector;o.uniforms.tint.value=e,void 0!==t&&(o.uniforms.opacity.value=t)},S.addSemIcon=(e,t)=>{if(void 0===S.gSemIcons)return;let o=(new THREE.Box3).setFromObject(t),i=new THREE.Sphere;o.getBoundingSphere(i);let r=new THREE.Sprite(S.getOrCreateSpriteSemIcon());r.position.copy(i.center),r.scale.set(.8,.8,1),r.name=e,S.gSemIcons.add(r)},S.addLPIcon=e=>{if(void 0===S.gLPIcons)return;let t=e._near,o=new THREE.Sprite(S.getOrCreateSpriteLP());o.position.copy(e.pos),o.scale.set(.1,.1,.1);let i=new THREE.Mesh(ATON.Utils.geomUnitSphere,ATON.MatHub.materials.lp);i.scale.set(t,t,t),i.position.copy(e.pos),S.gLPIcons.add(o),S.gLPIcons.add(i)},S.setSemIconsOpacity=e=>{ATON.MatHub.spriteSemIcon.opacity=void 0===e?1:e},S.buildInfoNode=()=>{S.infoNode=ATON.createUINode(),S.infoNode.attachToRoot(),S.infoContainer=new ThreeMeshUI.Block({width:.2,height:.05,padding:.01,borderRadius:.02,backgroundColor:ATON.MatHub.colors.black,backgroundOpacity:.4,fontFamily:S.PATH_FONT_JSON,fontTexture:S.PATH_FONT_TEX,justifyContent:"center",textAlign:"center"}),S.infoContainer.position.y=.03,S.infoNode.add(S.infoContainer),S.infoNodeText=new ThreeMeshUI.Text({content:"Info",fontSize:.02,fontColor:ATON.MatHub.colors.white}),S.infoContainer.add(S.infoNodeText),ThreeMeshUI.update()},S.getInfoNode=()=>S.infoNode,S.setInfoNodeText=e=>{S.bShowInfo&&(S.infoNodeText.set({content:e}),ThreeMeshUI.update())},S.createToolbar=(e,t,o)=>{let i=ATON.createUINode(),r=e.length,a=.3*S.STD_BTN_SIZE,s=new ThreeMeshUI.Block({width:S.STD_BTN_SIZE*r*1.1+a,height:S.STD_BTN_SIZE+a,padding:.01,borderRadius:.02,backgroundColor:t||ATON.MatHub.colors.black,backgroundOpacity:void 0!==o?o:.3,fontFamily:S.PATH_FONT_JSON,fontTexture:S.PATH_FONT_TEX,justifyContent:"center",textAlign:"center"}),n=.5*r*S.STD_BTN_SIZE*1.1;n-=.5*S.STD_BTN_SIZE;for(let t=0;t{void 0===o&&(o=1),void 0===i&&(i=1);let r=ATON.createUINode(e),a=new THREE.Mesh(new THREE.PlaneGeometry(o,i,2),ATON.MatHub.materials.fullyTransparent);return r.add(a),void 0!==t&&ATON.Utils.textureLoader.load(t,(e=>{a.material=new THREE.MeshStandardMaterial({map:e,transparent:!0,depthWrite:!1,side:THREE.DoubleSide})})),r},S.createLayout=(e,t)=>{let o=e.children.length;for(let i=0;i{if(void 0===e)return;let t=.01,o=.001;if(void 0===S._prevMPoint){S._prevMPoint=e;let t=S._measLine.geometry.attributes.position.array;return t[0]=e.x,t[1]=e.y,void(t[2]=e.z)}S._measLine.visible=!1;let i=S._prevMPoint.distanceTo(e);t*=i,o*=i;let r=new THREE.Mesh(ATON.Utils.geomUnitCube,ATON.MatHub.getMaterial("measurement"));r.position.copy(S._prevMPoint),r.scale.set(t,t,t),S.gMeasures.add(r);let a=new THREE.Mesh(ATON.Utils.geomUnitCube,ATON.MatHub.getMaterial("measurement"));a.position.copy(e),a.scale.set(t,t,t),S.gMeasures.add(a);let s=2*i,n=(new THREE.BufferGeometry).setFromPoints([S._prevMPoint,e]);S.gMeasures.add(new THREE.Line(n,ATON.MatHub.getMaterial("measurement")));let l=new S.Label;l.setBaseColor(ATON.MatHub.colors.white).setTextColor(ATON.MatHub.colors.black),l.userData.vStart=new THREE.Vector3,l.userData.vEnd=new THREE.Vector3,l.userData.vStart.copy(S._prevMPoint),l.userData.vEnd.copy(e),l.userData.vSEdir=new THREE.Vector3,l.userData.vSEdir.x=l.userData.vStart.x-l.userData.vEnd.x,l.userData.vSEdir.y=l.userData.vStart.y-l.userData.vEnd.y,l.userData.vSEdir.z=l.userData.vStart.z-l.userData.vEnd.z,l.userData.vSEdir.normalize(),l.setPosition(.5*(S._prevMPoint.x+e.x),.5*(S._prevMPoint.y+e.y),.5*(S._prevMPoint.z+e.z)),l.setScale(s).setText(ATON.Utils.getHumanReadableDistance(i)),S.gMeasures.add(l),S._measLabels.push(l);let d={};return d.A=l.userData.vStart,d.B=l.userData.vEnd,S._prevMPoint=void 0,d},S.clearMeasurements=()=>{S.gMeasures.removeChildren(),S._measLabels=[]},S._updateMeasurements=()=>{if(!(S._measLabels.length<=0))for(let e in S._measLabels)S._measLabels[e].orientToCamera()},S.update=()=>{if(ATON.Nav.isTransitioning()||ATON._bPauseQuery)S.infoNode.visible=!1;else{if(S._prevMPoint){if(ATON._queryDataScene){let e=S._measLine.geometry.attributes.position.array;e[3]=ATON._queryDataScene.p.x,e[4]=ATON._queryDataScene.p.y,e[5]=ATON._queryDataScene.p.z,S._measLine.geometry.attributes.position.needsUpdate=!0}S._measLine.visible=!0}else S._measLine.visible=!1;if(ATON._queryDataScene&&!ATON.Nav._bInteracting?(S._bShowSelector&&(S.mainSelector.visible=!0),S.mainSelector.position.x=ATON._queryDataScene.p.x+S._selOffset.x,S.mainSelector.position.y=ATON._queryDataScene.p.y+S._selOffset.y,S.mainSelector.position.z=ATON._queryDataScene.p.z+S._selOffset.z):S.mainSelector.visible=!1,S.gSemIcons&&(ATON.Nav._bInteracting?S.gSemIcons.hide():void 0===ATON._hoveredSemNode&&S.gSemIcons.show()),ATON.Nav.isOrbit()&&!ATON.XR._bPresenting||!ATON.Nav.currentQueryValidForLocomotion()?S.fpTeleport.visible=!1:(S.fpTeleport.visible=!0,S.fpTeleport.position.copy(ATON._queryDataScene.p)),ATON.XR._pointerLineMesh){let e=0;ATON._queryDataScene&&(e=ATON._queryDataScene.d),ATON._queryDataUI&&(e<=0||ATON._queryDataUI.d0?(ATON.XR._pointerLineMesh.visible=!0,ATON.XR._pointerLineMesh.scale.set(1,1,e)):ATON.XR._pointerLineMesh.visible=!1}if(S._updateMeasurements(),ATON._queryDataSem)ATON.XR._bPresenting&&(S.bShowInfo&&(S.infoNode.visible=!0),ATON.XR.controller0?(S.infoNode.position.copy(ATON.XR.controller0pos),S.infoNode.position.x-=.1*ATON.XR.controller0dir.x,S.infoNode.position.y-=.1*ATON.XR.controller0dir.y,S.infoNode.position.z-=.1*ATON.XR.controller0dir.z,S.infoNode.setScale(1)):(S.infoNode.position.lerpVectors(ATON._queryDataSem.p,ATON.Nav._currPOV.pos,.1),S.infoNode.setScale(ATON._queryDataSem.d*S._labelScaleVR)),S.infoNode.orientToCamera()),ATON.Photon._bStreamFocus||(S.mainSelector.visible=!1);else if(ATON.XR._bPresenting&&S.bShowInfo&&ATON._queryDataScene&&void 0!==ATON.XPFNetwork._semCurr){S.infoNode.position.lerpVectors(ATON._queryDataScene.p,ATON.Nav._currPOV.pos,.5);const e=ATON._queryDataScene.d*(ATON.Nav._currPOV.fov/S._labelScale);S.infoNode.setScale(e),S.infoNode.orientToCamera(),S.infoNode.visible=!0}else S.infoNode.visible=!1;if(S.mainSelector.visible&&ATON.Photon._bStreamFocus){let e=S._selectorRad*(1+.2*Math.cos(10*ATON._clock.elapsedTime));S.mainSelector.scale.set(e,e,e);let t=ATON.getSceneFocalPoint();void 0!==t&&void 0!==ATON.plight&&(ATON.enablePointLight(),ATON.plight.position.copy(t),ATON.plight.distance=2*S._selectorRad)}}};const N=S;let O={init:()=>{window.bootstrap&&(O.PATH_RES_ICONS=ATON.PATH_RES+"icons/",O._bModal=!1,O._bSidePanel=!1,O._bSemL=!1,O._setupBase())},createElemementFromHTMLString:e=>{const t=document.createElement("div");return t.innerHTML=e,t.firstElementChild},onContextMenu:()=>!1,_setupBase:()=>{document.body.oncontextmenu=O.onContextMenu,document.body.setAttribute("data-bs-theme","dark"),O.elCenteredOverlay=O.createElemementFromHTMLString('\n
    \n
    Loading...
    \n
    \n\t'),document.body.append(O.elCenteredOverlay),O.hideCenteredOverlay(),O.elLabelCon=document.createElement("div"),O.elLabelCon.classList.add("aton-floating-label-container"),O.elLabel=document.createElement("div"),O.elLabel.classList.add("aton-floating-label"),O.elLabelCon.append(O.elLabel),document.body.prepend(O.elLabelCon),O.hideSemLabel(),O.elModal=O.createElemementFromHTMLString('\n \n\t'),O.modal=new bootstrap.Modal(O.elModal),document.body.append(O.elModal),O.elModalContent=document.getElementById("uiModalContent"),O.elSidePanel=O.createElemementFromHTMLString('\n
    \n\t'),O.sidepanel=new bootstrap.Offcanvas(O.elSidePanel),document.body.append(O.elSidePanel)},showCenteredOverlay:e=>{O.elCenteredOverlay.classList.add("d-flex"),O.elCenteredOverlay.classList.remove("d-none")},hideCenteredOverlay:()=>{O.elCenteredOverlay.classList.remove("d-flex"),O.elCenteredOverlay.classList.add("d-none")},showModal:e=>{if(e){if(O.elModalContent.innerHTML="",e.header){let t=document.createElement("div");t.classList.add("modal-header"),t.innerHTML="",O.elModalContent.append(t)}if(e.body){let t=document.createElement("div");t.classList.add("modal-body"),t.append(e.body),O.elModalContent.append(t)}if(e.footer){let t=document.createElement("div");t.classList.add("modal-footer"),t.append(e.footer),O.elModalContent.append(t)}O.modal.show(),O._bModal=!0}},hideModal:()=>{O.modal.hide(),O._bModal=!1},showSidePanel:e=>{if(e){if(O.elSidePanel.innerHTML="",e.header){let t=document.createElement("div");t.classList.add("offcanvas-header"),t.innerHTML="

    "+e.header+"

    ",O.elSidePanel.append(t)}if(e.body){let t=document.createElement("div");t.classList.add("offcanvas-body"),t.append(e.body),O.elSidePanel.append(t)}O.sidepanel.show(),O._bSidePanel=!0}},hideSidePanel:()=>{O.sidepanel.hide(),O._bSidePanel=!1},addBasicEvents:()=>{ATON.on("NodeRequestFired",(()=>{O.showCenteredOverlay()})),ATON.on("AllNodeRequestsCompleted",(()=>{O.hideCenteredOverlay()})),ATON.on("SemanticNodeHover",(e=>{let t=ATON.getSemanticNode(e);void 0!==t&&(O.showSemLabel(e),t.highlight(),$("canvas").css({cursor:"pointer"}),ATON.SUI.gSemIcons&&ATON.SUI.gSemIcons.hide())})),ATON.on("SemanticNodeLeave",(e=>{let t=ATON.getSemanticNode(e);void 0!==t&&(O.hideSemLabel(),t.restoreDefaultMaterial(),$("canvas").css({cursor:"grab"}),ATON.SUI.gSemIcons&&ATON.SUI.gSemIcons.show())})),ATON.on("SemanticMaskHover",(e=>{O.showSemLabel(e),$("canvas").css({cursor:"pointer"})})),ATON.on("SemanticMaskLeave",(e=>{O.hideSemLabel(),$("canvas").css({cursor:"grab"})})),ATON.addUpdateRoutine(O.update)},update:()=>{if(O._bSemL&&!ATON.XR._bPresenting){let e=.5*ATON._screenPointerCoords.x*window.innerWidth,t=.5*(1-ATON._screenPointerCoords.y)*window.innerHeight;t-=35,O.elLabel.style.transform="translate("+e+"px, "+t+"px)"}},showSemLabel:e=>{O.elLabel.innerHTML=e,O.elLabel.style.display="inline-block",O._bSemL=!0},hideSemLabel:()=>{O.elLabel.style.display="none",O._bSemL=!1},loadPartial:(e,t,o,i)=>{$.get(e,(e=>{t?o?$("#"+t).prepend(e):$("#"+t).append(e):o?$("body").prepend(e):$("body").append(e),i&&i()}))},resolveIconURL:e=>e.includes("/")?e:O.PATH_RES_ICONS+e+".png",createButton:e=>{let t=document.createElement("button");return t.classList.add("btn","aton-btn"),t.setAttribute("type","button"),e.variant&&t.classList.add("btn-"+e.variant),e.text&&(t.innerText=e.text),e.icon&&t.prepend(O.createElemementFromHTMLString("")),e.onpress&&(t.onclick=e.onpress),t},createTabsGroup:e=>{let t=ATON.Utils.generateID("tabgroup"),o=document.createElement("div"),i=document.createElement("ul");i.classList.add("nav","nav-justified","nav-tabs"),i.setAttribute("role","tablist");let r=document.createElement("div");r.classList.add("tab-content"),o.append(i),o.append(r);for(let o=0;o");let c,u=t+"-"+s,_=document.createElement("li");_.classList.add("nav-item"),_.setAttribute("role","presentation"),_.innerHTML=0===o?"":"",i.append(_),c=0===o?O.createElemementFromHTMLString("
    "):O.createElemementFromHTMLString("
    "),c.style.padding="10px 0px 10px 0px",c.append(n),r.append(c)}return o}};const A=O;let b={USER_STATE_FREQ:.25,REPLICATED_EVT:"EREP",THRES_STATE_POS:.01,THRES_STATE_ORI:.08};b.Avatar=class extends t{constructor(e){super(void 0,ATON.NTYPES.UI),this.userid=e,this.username=void 0,this.message="...",this.color=ATON.Photon.ucolors[this.userid%ATON.Photon.ucolors.length],this._auTalk=[],this._auTalk.push(new THREE.PositionalAudio(ATON.AudioHub._listener)),this._auTalk.push(new THREE.PositionalAudio(ATON.AudioHub._listener));for(let e=0;e<2;e++)this._auTalk[e].setRefDistance(30),this._auTalk[e].setLoop(!1),this.add(this._auTalk[e]);this._auTalki=0,this.bMuted=!1,this._bPlayingAudio=!1,this._blob=void 0,this._b64=void 0,this._tStateCall=-1,this._tProgress=0,this._tFocCall=-1,this._currFocusPos=new THREE.Vector3,this._tgtFocusPos=new THREE.Vector3,this._currState={position:new THREE.Vector3,quaternion:new THREE.Quaternion,scale:1},this._tgtState={position:new THREE.Vector3,quaternion:new THREE.Quaternion,scale:1},this.userlabelnode=void 0,this.mStream=void 0,this._elVStream=void 0,this.realize()}getColor(){return this.color}setTalkDistance(e){e>0&&this._auTalk.setRefDistance(e)}setMuted(e){this.bMuted=e}getAvatarMaterialByUID(e){let t=ATON.MatHub.materials.avatars;return t[e%t.length]}_buildLabel(){this.userlabelnode=ATON.createUINode(),this.labelcontainer=new ThreeMeshUI.Block({width:.7,height:.25,padding:.03,borderRadius:.05,backgroundColor:ATON.MatHub.colors.black,fontFamily:ATON.SUI.PATH_FONT_JSON,fontTexture:ATON.SUI.PATH_FONT_TEX,justifyContent:"center",textAlign:"center"}),this.userlabelnode.position.y=.4,this.userlabelnode.add(this.labelcontainer),this.usernametext=new ThreeMeshUI.Text({content:"User #"+this.userid,fontSize:.09,fontColor:this.color}),this.usernametext.position.y=0,this.usermessagetext=new ThreeMeshUI.Text({content:"\n...",fontSize:.03,fontColor:ATON.MatHub.colors.white}),this.usermessagetext.position.y=0,this.labelcontainer.add(this.usernametext),this.labelcontainer.add(this.usermessagetext),this.add(this.userlabelnode),ThreeMeshUI.update()}realizeStreamPanel(){let e=ATON.MediaFlow.getOrCreateVideoStream(this.userid,void 0,!0);this._elVStream=e.el;let t=new THREE.PlaneGeometry(1,1);this.mStream=new THREE.Mesh(t,e.matStream),this.mStream.position.y=1;let o=.5625;this.mStream.scale.y=-o,this.mStream.position.y=.8*o,this._elVStream.addEventListener("loadedmetadata",(e=>{o=this._elVStream.videoHeight/this._elVStream.videoWidth,this.mStream.scale.y=-o,this.mStream.position.y=.8*o}))}getStreamPanel(){return this.mStream}toggleStreamPanel(e){void 0!==this.mStream&&(this.mStream.visible=e)}realize(){let e=new THREE.SphereGeometry(.2,16,16);ATON.Photon.customAvatarMaterial?this.usermaterial=ATON.Photon.customAvatarMaterial():this.usermaterial=this.getAvatarMaterialByUID(this.userid);let t=new THREE.Mesh(e,this.usermaterial);this.usermeshnode=ATON.createUINode(),this.usermeshnode.add(t),this.usermeshnode.setMaterial(this.usermaterial),this.usermeshnode.setCloneOnLoadHit(!1),this.add(this.usermeshnode),this.userauinode=new THREE.Sprite(ATON.Photon.uspritemats[this.userid%ATON.Photon.uspritemats.length]),this.userauinode.position.set(0,0,0),this.userauinode.visible=!1,this.add(this.userauinode),this.userfpnode=new THREE.Sprite(ATON.Photon.ufocmats[this.userid%ATON.Photon.ufocmats.length]),this.userfpnode.position.set(0,0,0),this.userfpnode.visible=!1,void 0===ATON.Photon._focNodes[this.userid]&&(ATON.Photon._focNodes[this.userid]=this.userfpnode,ATON.Photon.focGroup.add(this.userfpnode)),this._buildLabel()}loadRepresentation(e){let t=this;return void 0!==t.usermeshnode.children[0]&&t.usermeshnode.remove(t.usermeshnode.children[0]),t.usermeshnode.load(e),this}setUsername(e){return void 0===this.userlabelnode||(this.username=e,this.usernametext.set({content:e}),ThreeMeshUI.update()),this}getUsername(){if(void 0!==this.userid)return void 0===this.username?"User #"+this.userid:this.username}setMessage(e){return void 0===this.userlabelnode||(this.message=e,this.usermessagetext.set({content:"\n"+e}),ThreeMeshUI.update()),this}setTalkVolume(e){if(void 0!==e)if(e>0){this.userauinode.visible=!0;let t=.1+.03*e;this.userauinode.scale.set(t,t,t)}else this.userauinode.visible=!1;else this.userauinode.visible=!1}hideFocalPoint(){this.userfpnode.visible=!1}requestFocus(e){if(void 0===e)return;if(this._tFocCall>=0)return;this._tFocCall=ATON._clock.elapsedTime,this._currFocusPos.copy(this.userfpnode.position);let t=this.scale.x*ATON._worldScale,o=parseFloat(e[0])*t,i=parseFloat(e[1])*t,r=parseFloat(e[2])*t,a=parseFloat(e[3])*t;this._tgtFocusPos.set(o,i,r),this._tgtFocusRad=2*a,this.userfpnode.scale.set(this._tgtFocusRad,this._tgtFocusRad,this._tgtFocusRad),this.userfpnode.visible=!0,ATON.enablePointLight(),ATON.plight.color=this.color,ATON.plight.position.copy(this._tgtFocusPos),ATON.plight.distance=this._tgtFocusRad}handleFocusTransition(){if(this._tFocCall<0)return;let e=ATON.Photon.USER_STATE_FREQ,t=(ATON._clock.elapsedTime-this._tFocCall)/e;if(t>=1)return this._tFocCall=-1,this.userfpnode.position.copy(this._tgtFocusPos),this.userfpnode.scale.set(this._tgtFocusRad,this._tgtFocusRad,this._tgtFocusRad),void(this.userfpnode.visible=!0);this.userfpnode.position.lerpVectors(this._currFocusPos,this._tgtFocusPos,t),ATON.plight.position.copy(this.userfpnode.position),this.userfpnode.visible=!0}requestStateTransition(e){this._tStateCall>=0||void 0!==e&&(this._tStateCall=ATON._clock.elapsedTime,this._currState.position.copy(this.position),this._currState.quaternion.copy(this.quaternion),this._currState.scale=this.scale,this._tgtState.position.copy(e.position),this._tgtState.quaternion.copy(e.quaternion),this._tgtState.scale=1/e.scale)}handleStateTransition(){if(this._tStateCall<0)return;let e=ATON.Photon.USER_STATE_FREQ;this._tProgress=e<=0?1:(ATON._clock.elapsedTime-this._tStateCall)/e;let t=this._currState,o=this._tgtState;if(this._tProgress>=1)return this._tStateCall=-1,this.position.copy(o.position),void this.usermeshnode.quaternion.copy(o.quaternion);this.position.lerpVectors(t.position,o.position,this._tProgress),this.usermeshnode.quaternion.slerp(o.quaternion,this._tProgress)}update(){if(this.handleStateTransition(),this.userfpnode&&this.userfpnode.visible){this.handleFocusTransition();let e=this.userfpnode.scale.x;e>.001?(this.userfpnode.scale.set(.99*e,.99*e,.99*e),ATON.plight.intensity*=.99):(this.userfpnode.visible=!1,ATON.disablePointLight())}let e=ATON.Nav._camera,t=ATON.Nav._currPOV.pos;if(void 0===e||void 0===t)return;this.userlabelnode&&this.userlabelnode.orientToCamera();let o=this.userauinode.scale.x;o*=.99,o>.01?this.userauinode.scale.set(o,o,o):this.userauinode.visible=!1}_handleTalk(){if(this._auTalk.isPlaying)return;if(this._auChunks.length<2)return;let e=this._auChunks[this._iAU];this._auTalk.setBuffer(e),this._auTalk.play(),this.setTalkVolume(5)}_handleTalkOLD(){if(this._bPlayingAudio)return;if(this._auChunks.length<1)return;let e=this._auChunks.shift();this._auTalk.setBuffer(e),this._auTalk.play(),this._bPlayingAudio=!0,this._auTalk.onended=()=>{this._bPlayingAudio=!1,e=null},this.setTalkVolume(5)}},b.init=()=>{b.address=window.location.origin,b.initMaterials(),b.socket=void 0,b._connected=!1,b._reqSSID=void 0,b._username=void 0,b.uid=void 0,b.color=ATON.MatHub.colors.white,b._bStreamFocus=!1,b._numUsers=1,b.avatarList=[],b.avaGroup=ATON.createUINode("avatars"),b.avaGroup.attachToRoot(),b.focGroup=ATON.createUINode("focus"),b.focGroup.attachTo(b.avaGroup),b._focNodes=[],b.bSendState=!0,window.setInterval(b.sendState,1e3*b.USER_STATE_FREQ),b._lastStateSent=void 0,b._bShowAvaG=!0,b._bSpatial=!0,console.log("Photon initialized"),b.enableChatLog(),b._elVStream=void 0,b._decS={quaternion:new THREE.Quaternion,position:new THREE.Vector3},b.customAvatarMaterial=void 0,window.addEventListener("beforeunload",(e=>{b.disconnect()}))},b.setCustomAvatarMaterialRoutine=e=>{b.customAvatarMaterial=e},b.enableChatLog=()=>{b._elChat=$("
    ").text("")},b.getNumUsers=()=>b._numUsers,b.initMaterials=()=>{b.ucolorhex=[],b.ucolorhex.push("#F00"),b.ucolorhex.push("#FF0"),b.ucolorhex.push("#0F0"),b.ucolorhex.push("#0FF"),b.ucolorhex.push("#00F"),b.ucolorhex.push("#F0F"),b.ucolorhex_light=[],b.ucolorhex_light.push("#FAA"),b.ucolorhex_light.push("#FFA"),b.ucolorhex_light.push("#AFA"),b.ucolorhex_light.push("#AFF"),b.ucolorhex_light.push("#AAF"),b.ucolorhex_light.push("#FAF"),b.ucolors=[],b.ucolors.push(new THREE.Color(b.ucolorhex[0])),b.ucolors.push(new THREE.Color(b.ucolorhex[1])),b.ucolors.push(new THREE.Color(b.ucolorhex[2])),b.ucolors.push(new THREE.Color(b.ucolorhex[3])),b.ucolors.push(new THREE.Color(b.ucolorhex[4])),b.ucolors.push(new THREE.Color(b.ucolorhex[5])),b.ucolorsdark=[],b.ucolorsdark.push(new THREE.Color(.2,0,0)),b.ucolorsdark.push(new THREE.Color(.2,.2,0)),b.ucolorsdark.push(new THREE.Color(0,.2,0)),b.ucolorsdark.push(new THREE.Color(0,.2,.2)),b.ucolorsdark.push(new THREE.Color(0,0,.2)),b.ucolorsdark.push(new THREE.Color(.2,0,.2));let e=ATON.MatHub.materials;e.avatars=[];for(let t=0;t{if(!b._connected)return;let o=b.socket;o&&o.emit(b.REPLICATED_EVT,{e,d:t})},b.on=(e,t)=>{if(void 0===t)return;let o=ATON.EventHub.evNetwork;void 0===o[e]&&(o[e]=[]),o[e].push(t)},b.isConnected=()=>void 0!==b.socket&&b._connected,b.hasID=()=>void 0!==b.uid,b.log=e=>{if(!b._connected)return;let t=b.socket;t&&t.emit("UMSG",e)},b.joinSession=e=>{b.socket&&(void 0===e&&(e=ATON.SceneHub.currID),void 0!==e?(console.log("Joining Photon session '"+e+"'..."),b.socket.emit("SENTER",e)):console.log("Photon ERROR: current session ID is undefined"))},b.requestSceneState=()=>{b.socket&&b.socket.emit("SSTATE")},b.setAvatarsVisibility=e=>{b._bShowAvaG=e,e?b.avaGroup.show():b.avaGroup.hide()},b.disableSpatiality=()=>{b._bSpatial=!1},b.enableSpatiality=()=>{b._bSpatial=!0},b.setAddress=e=>{e&&(b.address=e)},b.connect=e=>{if(b._connected)return;b._reqSSID=e;let t={};ATON.Utils.isConnectionSecure()?(t.path="/svrc/socket.io",t.secure=!0,t.rejectUnauthorized=!1):t.path="/vrc/socket.io",b.socket=io.connect(b.address,t),void 0!==b.socket&&(b._connected=b.socket.connected,b._registerSocketHandlers())},b.disconnect=()=>{void 0!==b.socket&&(b._numUsers=1,b.socket.disconnect(),b.color=ATON.MatHub.colors.white,ATON.plight.color=ATON.MatHub.colors.white,b._connected=!1)},b._onConnected=()=>{},b.setUsername=e=>{(e=e.trim()).length<1||(b._username=e,void 0!==b.socket&&void 0!==b.uid&&(b.appendToChatBox("Your username is now: "+e+""),b.socket.emit("UNAME",e)))},b.setMessage=e=>{(e=e.trim()).length<1||e.length>3e3||(b._msg=e,void 0!==b.socket&&void 0!==b.uid&&(b.socket.emit("UMSG",e),b._elChat&&(e=b.chatMessageProcessor(b.uid,e),b.appendToChatBox("
    YOU
    : "+e+""))))},b.appendToChatBox=e=>{b._elChat&&(b._elChat.append("
    "+e+"
    "),b._elChat.scrollTop(b._elChat[0].scrollHeight))},b._registerSocketHandlers=()=>{b.socket.on("connect",(()=>{b._connected=!0,void 0!==b._reqSSID?b.joinSession(b._reqSSID):b.joinSession(ATON.SceneHub.currID),console.log("Connected to Photon service!"),ATON.fireEvent("VRC_Connected"),b._onConnected()})),b.socket.on("disconnect",(()=>{b._connected=!1,b.uid=void 0,b.avaGroup.hide(),b.appendToChatBox("YOU disconnected from the Photon session"),console.log("Disconnected from Photon service!"),ATON.fireEvent("VRC_Disconnected")})),b.socket.on(b.REPLICATED_EVT,(e=>{let t=e.e,o=e.d,i=ATON.EventHub.evNetwork[t];ATON.EventHub.executeHandlers(i,o)})),b.socket.on("ID",(e=>{console.log("Your ID is "+e),b.uid=e,b.color=b.ucolors[b.uid%b.ucolors.length],b._bShowAvaG&&b.avaGroup.show(),b.appendToChatBox("Your ID is #"+e+""),b.requestSceneState(),ATON.fireEvent("VRC_IDassigned",e)})),b.socket.on("SSTATE",(e=>{b._numUsers=e.numUsers,console.log("Num. users: "+b._numUsers),ATON.fireEvent("VRC_SceneState",e)})),b.socket.on("UENTER",(e=>{let t=e;console.log("User #"+t+" entered the session"),b.appendToChatBox("User #"+t+" entered the session"),b.requestSceneState(),ATON.fireEvent("VRC_UserEnter",t)})),b.socket.on("ULEAVE",(e=>{let t=e;if(void 0===t)return;let o=b.avatarList[t];o&&(o.toggleStreamPanel(!1),o.hide()),console.log("User #"+t+" left the session"),b.appendToChatBox("User #"+t+" left the session"),b.requestSceneState(),ATON.fireEvent("VRC_UserLeave",t)})),b.socket.on("USTATE",(e=>{if(!b._bShowAvaG)return;if(!b._bSpatial)return;let t=b.decodeState(e),o=t.userid,i=b.touchAvatar(o);i.requestStateTransition(t);let r=1/t.scale;i.scale.set(r,r,r)})),b.socket.on("UFOCUS",(e=>{if(!b._bSpatial)return;let t=e.uid,o=e.fp;b.touchAvatar(t).requestFocus(o)})),b.socket.on("UNAME",(e=>{let t=e.uid,o=e.name;void 0!==t&&(b.touchAvatar(t).setUsername(o),console.log("User #"+t+" changed username to: "+o),b.appendToChatBox("User #"+t+" changed username to: "+o+""),ATON.fireEvent("VRC_UName",e))})),b.socket.on("UMSG",(e=>{let t=e.uid,o=e.msg;if(void 0===t)return;let i=b.touchAvatar(t);o.length<100&&i.setMessage(o),console.log("User #"+t+": "+o);let r=i.getUsername();o=b.chatMessageProcessor(t,o),b.ucolorhex[t%6];let a=b.ucolorhex_light[t%6];b.appendToChatBox("
    "+r+"
    : "+o+""),ATON.fireEvent("VRC_UMessage",e)})),b.socket.on("UTALK",(e=>{let t=e.uid;if(void 0===t)return;let o=e.audio;if(o){if(b._bSpatial){let e=b.touchAvatar(t);if(e.bMuted)return;ATON.AudioHub._loader.load(o,(t=>{let o=e._auTalk[e._auTalki],i=(e._auTalki+1)%2;o.setBuffer(t),o.isPlaying||o.play(),e.setTalkVolume(5),e._auTalki=i}))}ATON.fireEvent("VRC_UTalk",e),o=null}})),b.socket.on("UTALKSTOP",(e=>{void 0!==e.uid&&ATON.fireEvent("VRC_UTalkStop",e)})),b.socket.on("UVIDEO",(e=>{void 0!==e.uid&&ATON.fireEvent("VRC_UVideo",e)})),b.socket.on("UVIDEOSTOP",(e=>{let t=e.uid;if(void 0===t)return;let o=b.avatarList[t];o&&o.toggleStreamPanel(!1),ATON.fireEvent("VRC_UVideoStop",e)}))},b.chatMessageProcessor=(e,t)=>{const o=(t=String(t)).match(/(((ftp|https?):\/\/)[\-\w@:%_\+.~#?,&\/\/=]+)/g);return o&&o.forEach((e=>{t=t.replace(e,""+e+"")})),t},b.encodeState=e=>{if(!e)return;let t=new Float32Array(5);t[0]=e.position.x,t[1]=e.position.y,t[2]=e.position.z;var o=new Int8Array(t.buffer);return o[12]=128*e.quaternion.x,o[13]=128*e.quaternion.y,o[14]=128*e.quaternion.z,o[15]=128*e.quaternion.w,o[16]=e.userid,o[17]=ATON._ws,o},b.decodeState=e=>{let t=new Int8Array(e);b._decS.userid=t[16];let o=ATON._unpackScale(t[17]);return b._decS.scale=o,b._decS.quaternion.set(parseFloat(t[12])/128,parseFloat(t[13])/128,parseFloat(t[14])/128,parseFloat(t[15])/128),t=new Float32Array(e),b._decS.position.set(parseFloat(t[0])/o,parseFloat(t[1])/o,parseFloat(t[2])/o),b._decS},b.update=()=>{if(b._connected)for(let e=0;e{if(void 0!==e){if(e)return b._bStreamFocus||(ATON.fireEvent("VRC_FocusStreamingStarted"),ATON.enablePointLight(),ATON.plight.color=ATON.Photon.color),void(b._bStreamFocus=!0);{b._bStreamFocus&&(ATON.fireEvent("VRC_FocusStreamingStopped"),ATON.disablePointLight());let e=ATON.SUI._selectorRad;ATON.SUI.mainSelector.scale.set(e,e,e),b._bStreamFocus=!1}}},b.sendState=()=>{if(!b.bSendState||!b._bSpatial)return;if(void 0===b.uid)return;if(!b.socket||!b._connected)return;let e=ATON.Nav._currPOV;if(!e)return;let t=ATON.getSceneFocalPoint();if(b._bStreamFocus&&void 0!==t){let e=t.x.toFixed(3),o=t.y.toFixed(3),i=t.z.toFixed(3),r=ATON.SUI.getSelectorRadius().toFixed(3);b.socket.emit("UFOCUS",[e,o,i,r])}if(!e.pos)return;if(!ATON.Nav._qOri)return;if(void 0!==b._lastStateSent){let t=b._lastStateSent.position,o=b._lastStateSent.quaternion,i=t.distanceToSquared(e.pos),r=o.angleTo(ATON.Nav._qOri);if(ib.avatarList[e],b.touchAvatar=e=>{if(void 0===b.avatarList[e]){let t=new b.Avatar(e);t.attachTo(b.avaGroup),t.loadRepresentation(ATON.PATH_RES+"models/vrc/head.gltf"),b.avatarList[e]=t}let t=b.avatarList[e];return t.visible||ATON.fireEvent("VRC_UserEnter",e),b._bShowAvaG&&t.show(),t},b.destroyAvatar=e=>{let t=b.avatarList[e];void 0!==t&&t.destroy()},b.clearAllAvatars=()=>{for(let e in b.avatarList)b.avatarList[e].hide()};const P=b;let E={FLOAT_PREC:5,init:()=>{E.bConvexBuilding=!1,E.convexPoints=[],E.convexNode=void 0,E.currConvexMesh=void 0,E.currSemNode=ATON.createSemanticNode(),E.currSemNode.disablePicking(),E.currSemNode.attachToRoot(),E.resetMaterial(),E._numShapes=0},resetMaterial:()=>{E.currMaterial=ATON.MatHub.getMaterial("semanticShapeHL")},setMaterial:e=>{void 0!==e&&(E.currMaterial=e)},addConvexPoint:e=>{if(void 0===e)return!1;if(E.convexPoints.length>0){let t=E.convexPoints[E.convexPoints.length-1];if(e.equals(t))return!1}E.convexPoints.push(e);let t=E.convexPoints.length,o=new THREE.Sprite(ATON.SUI.getOrCreateSpritePointEdit()),i=.02*ATON.getSceneQueriedDistance();if(void 0===i&&(i=.02),o.position.copy(e),o.scale.set(i,i,i),ATON.SUI.gPoints.add(o),t<4)return!1;let r=new THREE.ConvexGeometry(E.convexPoints),a=new THREE.Mesh(r,ATON.MatHub.getMaterial("semanticShapeEdit"));if(E.bConvexBuilding){let t=E.currConvexMesh;t.geometry.dispose(),t.geometry=r,ATON.Utils.setVectorPrecision(e,4),t.userData._convexPoints.push(e.x),t.userData._convexPoints.push(e.y),t.userData._convexPoints.push(e.z)}else{E.currSemNode.add(a),a.userData._convexPoints=[];for(let e=0;e{if(0!==E.convexPoints.length&&(E.convexPoints.pop(),E.currConvexMesh)){let e=E.currConvexMesh.userData;e._convexPoints&&e._convexPoints.pop()}},stopCurrentConvex:()=>{E.bConvexBuilding&&(E.convexPoints=[],E.bConvexBuilding=!1,E.currSemNode.removeChildren(),ATON.SUI.gPoints.removeChildren())},getCurrentConvexShape:()=>E.currSemNode,isBuildingShape:()=>E.convexPoints.length>0,completeConvexShape:e=>{if(E.convexPoints=[],E.bConvexBuilding=!1,void 0===E.currSemNode)return;void 0===e&&(e="sem"+E._numShapes);let t=ATON.getSemanticNode(e)||ATON.createSemanticNode(e),o=E.currSemNode.children[0];return ATON.SUI.addSemIcon(e,o),t.add(o),t.setMaterial(ATON.MatHub.materials.semanticShape),t.setDefaultAndHighlightMaterials(ATON.MatHub.materials.semanticShape,E.currMaterial),t.enablePicking(),E.currSemNode.removeChildren(),E._numShapes++,ATON.SUI.gPoints.removeChildren(),ATON._bqSem=!0,t},createConvexShape:(e,t)=>{let o=new THREE.ConvexGeometry(t),i=new THREE.Mesh(o,ATON.MatHub.materials.semanticShape);i.userData._convexPoints=[];for(let e=0;e{if(void 0===ATON._queryDataScene)return!1;void 0===e&&(e=.02);let t=ATON._queryDataScene.p,o=ATON.Nav.getCurrentEyeLocation();return t.lerpVectors(t,o,e),E.addConvexPoint(t),t},createSphere:(e,t,o)=>{if(void 0===t)return;if(void 0===o)return;void 0===e&&(e="sem"+E._numShapes);let i=ATON.getOrCreateSemanticNode(e),r=new THREE.Mesh(ATON.Utils.geomUnitSphere,ATON.MatHub.materials.semanticShape),a=new THREE.Object3D;return a.position.copy(t),a.scale.set(o,o,o),a.add(r),ATON.SUI.addSemIcon(e,a),i.add(a),i.enablePicking(),i.setDefaultAndHighlightMaterials(ATON.MatHub.materials.semanticShape,E.currMaterial),E._numShapes++,ATON._bqSem=!0,i},createSurfaceSphere:e=>{if(!ATON._queryDataScene)return;let t=ATON._queryDataScene.p,o=ATON.SUI.getSelectorRadius();return E.createSphere(e,t,o)},deleteSemanticNode:e=>{let t=ATON.getSemanticNode(e);if(void 0===t)return!1;if(t.removeChildren(),void 0===ATON.SUI.gSemIcons)return!0;for(let t in ATON.SUI.gSemIcons.children){let o=ATON.SUI.gSemIcons.children[t];o&&o.name===e&&ATON.SUI.gSemIcons.removeChild(o)}return!0}};const f=E;let R={SEMSHAPE_SPHERE:0,SEMSHAPE_CONVEX:1,POPUP_DT:500,STD_SEL_RAD:.05,_bRealized:!1,realize:()=>{if(R._bRealized)return;R.PATH_RES_ICONS=ATON.PATH_RES+"icons/",R._bPopup=!1,R._tPopup=void 0,R.popupBlurBG=0,R._userAuth={},R._bControlLight=!1,R._bControlSelScale=!1,R._cLightDir=new THREE.Vector3,R._auSemNode=void 0,R._auSemNodePlaying=!1,R._bReqHome=!1,R._bVRCsetup=!1,R.urlParams=new URLSearchParams(window.location.search),R._uiSetupBase(),R._uiProfiles={},R._uiCurrProfile=void 0,R._selRanges=[.01,50],R._selRefRadius=.5,ATON.realize(),ATON.on("Fullscreen",(e=>{R.uiSwitchButton("fullscreen",e)}));let e=ATON.FE.urlParams.get("d");e&&e>0&&(ATON.setDefaultPixelDensity(e),ATON.toggleAdaptiveDensity(!1));let t=ATON.FE.urlParams.get("dd");t&&t>0&&ATON.toggleAdaptiveDensity(!0),R._canvas=ATON._renderer.domElement,R._bSem=!1,R._bShowSemLabel=!0,R._bRealized=!0,R.loadSceneID=ATON.App.loadScene},_handleHomeReq:()=>{R._bReqHome||ATON.getRootScene().getBound().radius<=0||(R._bReqHome=!0,void 0!==ATON.Nav.homePOV?ATON.Nav.requestHome(1):ATON.Nav.computeAndRequestDefaultHome(.5))},addBasicLoaderEvents:()=>{ATON.on("NodeRequestFired",(()=>{$("#idLoader").show()})),ATON.on("SceneJSONLoaded",(()=>{ATON.SceneHub.getDescription()&&$("#btn-info").show(),void 0!==ATON.Nav.homePOV&&ATON.Nav.requestHome(1),ATON.XPFNetwork._list.length>0&&void 0===ATON.Nav.homePOV&&(ATON.XPFNetwork.setHomeXPF(0),ATON.XPFNetwork.requestTransitionByIndex(0))})),ATON.on("AllNodeRequestsCompleted",(()=>{$("#idLoader").hide(),ATON.CC.anyCopyrightFound()&&$("#btn-cc").show(),R.computeSelectorRanges(),ATON.SUI.setSelectorRadius(Math.min(R.STD_SEL_RAD,R._selRefRadius)),R._handleHomeReq()})),ATON.on("XR_support",(e=>{"immersive-vr"===e.type&&(e.v?$("#btn-vr").show():$("#btn-vr").hide())})),ATON.on("SemanticNodeHover",(e=>{let t=ATON.getSemanticNode(e);void 0!==t&&(R.showSemLabel(e),R._bSem=!0,t.highlight(),$("canvas").css({cursor:"crosshair"}),ATON.SUI.gSemIcons&&ATON.SUI.gSemIcons.hide())})),ATON.on("SemanticNodeLeave",(e=>{let t=ATON.getSemanticNode(e);void 0!==t&&(R.hideSemLabel(),R._bSem=!1,t.restoreDefaultMaterial(),$("canvas").css({cursor:"grab"}),ATON.SUI.gSemIcons&&ATON.SUI.gSemIcons.show())})),ATON.on("SemanticMaskHover",(e=>{R.showSemLabel(e),R._bSem=!0,$("canvas").css({cursor:"crosshair"})})),ATON.on("SemanticMaskLeave",(e=>{R.hideSemLabel(),R._bSem=!1,$("canvas").css({cursor:"grab"})})),ATON.addUpdateRoutine(R._update)},showSemLabel:e=>{R._bShowSemLabel&&($("#idPopupLabel").html(e),$("#idPopupLabel").show(),ATON.SUI.setInfoNodeText(e))},hideSemLabel:()=>{$("#idPopupLabel").hide(),$("#idPopupLabel").html("")},controlLight:e=>{R._bControlLight=e,ATON.Nav.setUserControl(!e)},controlSelectorScale:e=>{R._bControlSelScale=e,ATON._bPauseQuery=e,ATON.Nav.setUserControl(!e)},attachGizmoToNode:e=>{if(void 0===ATON._gizmo)return;let t=ATON.getSceneNode(e);void 0!==t&&ATON._gizmo.attach(t)},useMouseWheelToScaleSelector:e=>{void 0===e&&(e=.9),ATON.on("MouseWheel",(t=>{if(ATON._kModCtrl){let e=ATON.Nav.getFOV();return t>0?e+=1:e-=1,void ATON.Nav.setFOV(e)}if(ATON._kModShift){let o=ATON.SUI.mainSelector.scale.x;return t>0?o*=e:o/=e,oR._selRanges[1]&&(o=R._selRanges[1]),void ATON.SUI.setSelectorRadius(o)}}))},_update:()=>{if(R._bControlLight){const e=ATON._screenPointerCoords.x,t=ATON._screenPointerCoords.y;R._cLightDir.x=-Math.cos(e*Math.PI),R._cLightDir.y=4*-t,R._cLightDir.z=-Math.sin(e*Math.PI),R._cLightDir.normalize(),ATON.setMainLightDirection(R._cLightDir)}if(ATON.XR._bPresenting){let e=ATON.XR.getAxisValue(ATON.XR.HAND_R);if(!ATON.Photon._bStreamFocus){let t=ATON.SUI._selectorRad;t+=.01*e.y,t>.001&&ATON.SUI.setSelectorRadius(t)}}else{if(ATON.Nav.isTransitioning()||ATON.Nav._bInteracting||ATON._bPauseQuery)return void $("#idPopupLabel").hide();if(R._bSem&&R._bShowSemLabel){$("#idPopupLabel").show();let e=.5*ATON._screenPointerCoords.x*window.innerWidth,t=.5*(1-ATON._screenPointerCoords.y)*window.innerHeight;t-=55,$("#idPopupLabel").css("transform","translate("+e+"px, "+t+"px)")}else $("#idPopupLabel").hide()}},uiBasicSetup:()=>{R.uiAddButton("idTopToolbar","fullscreen",ATON.toggleFullScreen),ATON.Utils.isConnectionSecure()&&R.uiAddButton("idTopToolbar","vr",ATON.XR.toggle),R.uiAddButton("idBottomToolbar","home",(()=>{ATON.Nav.requestHome(.1)}))},_uiSetupBase:()=>{$("#idPopup").click(R.popupClose),$("#idLoader").html(""),$("body").prepend("
    "),R.hideSemLabel()},uiAddButton:(e,t,o,i)=>{let r,a;t.endsWith(".png")?(r=t,a=t.slice(0,-4)):(r=R.PATH_RES_ICONS+t+".png",a=t);let s=$("
    ");$("#"+e).append(s),o&&s.click(o),i&&s.attr("title",i)},uiSwitchButton:(e,t)=>{t?$("#btn-"+e).addClass("switchedON"):$("#btn-"+e).removeClass("switchedON")},uiSetButtonHandler:(e,t)=>{$("#"+e).click(t)},uiAddButtonHome:e=>{R.uiAddButton(e,"home",(()=>{ATON.Nav.requestHome(.3)}),"Home viewpoint")},uiAddButtonBack:(e,t)=>{R.uiAddButton(e,"back",(()=>{t&&t.length>1&&t.startsWith("http:")?ATON.Utils.goToURL(t):history.back()}),"Go Back")},uiAddButtonFirstPerson:e=>{R.uiAddButton(e,"fp",(()=>{ATON.Nav.isFirstPerson()?(ATON.Nav.setOrbitControl(),R.uiSwitchButton("fp",!1)):(ATON.Nav.setFirstPersonControl(),R.uiSwitchButton("fp",!0))}),"First-person navigation mode"),ATON.Nav.isFirstPerson()?R.uiSwitchButton("fp",!0):R.uiSwitchButton("fp",!1)},uiAddButtonVR:e=>{ATON.Utils.isConnectionSecure()&&(R.uiAddButton(e,"vr",(()=>{ATON.XR.toggle("immersive-vr")}),"Immersive VR mode"),ATON.Utils.isVRsupported()||$("#btn-vr").hide())},uiAddButtonAR:e=>{ATON.Utils.isConnectionSecure()&&R.uiAddButton(e,"ar",(()=>{ATON.Utils.isARsupported()&&ATON.XR.toggle("immersive-ar")}),"Immersive AR mode")},uiAddButtonDeviceOrientation:e=>{ATON.Utils.isConnectionSecure()&&ATON.Utils.isMobile()&&(R.uiAddButton(e,"devori",(()=>{ATON.Nav.isDevOri()?(ATON.Nav.restorePreviousNavMode(),R.uiSwitchButton("devori",!1)):(ATON.Nav.setDeviceOrientationControl(),R.uiSwitchButton("devori",!0))}),"Device-orientation mode"),ATON.Nav.isDevOri()?R.uiSwitchButton("devori",!0):R.uiSwitchButton("devori",!1))},uiAddButtonNav:e=>{R.uiAddButton(e,"nav",(()=>{R.popupNav()}),"Navigation")},uiAddButtonTalk:e=>{ATON.Utils.isConnectionSecure()&&(R.uiAddButton(e,"talk",(()=>{ATON.MediaFlow.isAudioRecording()?(ATON.MediaFlow.stopAudioStreaming(),$("#btn-talk").removeClass("atonBTN-rec")):(ATON.MediaFlow.startAudioStreaming(),$("#btn-talk").addClass("atonBTN-rec"))}),"Talk ON/OFF"),ATON.MediaFlow.isAudioRecording()?$("#btn-talk").addClass("atonBTN-rec"):$("#btn-talk").removeClass("atonBTN-rec"))},uiAddButtonStreamFocus:e=>{R.uiAddButton(e,"focus",(()=>{ATON.Photon._bStreamFocus?(ATON.Photon.setFocusStreaming(!1),$("#btn-focus").removeClass("atonBTN-rec")):(ATON.Photon.setFocusStreaming(!0),$("#btn-focus").addClass("atonBTN-rec"))}),"Focus streaming ON/OFF"),ATON.Photon._bStreamFocus?$("#btn-focus").addClass("atonBTN-rec"):$("#btn-focus").removeClass("atonBTN-rec")},uiAddButtonMainVideoPanoPlayPause:e=>{R.uiAddButton(e,"playpause",(()=>{ATON._vpanoPlaying?ATON._elPanoVideo&&ATON._elPanoVideo.pause():ATON._elPanoVideo&&ATON._elPanoVideo.play()}),"360 Video play/pause"),ATON._elPanoVideo?$("#btn-playpause").show():$("#btn-playpause").hide()},uiAddButtonQR:e=>{ATON.Utils.isLocalhost()||R.uiAddButton(e,"qr",R.popupQR,"QR-code")},uiAddButtonScreenshot:e=>{R.uiAddButton(e,"sshot",R.popupScreenShot,"Screenshot")},uiAddButtonInfo:e=>{R.uiAddButton(e,"info",ATON.FE.popupSceneInfo,"Scene information"),$("#btn-info").hide()},uiAddButtonFullScreen:e=>{R.uiAddButton(e,"fullscreen",(()=>{ATON.toggleFullScreen()}),"Fullscreen"),R.uiSwitchButton("fullscreen",ATON.isFullscreen())},uiAddKeywordsArea:(e,t,o,i)=>{let r="";r+="Add keyword:

    ",r+="
    ",$("#"+e).html(r),R.uiAttachInputFilterID("idKWordInput"),$.getJSON(ATON.PATH_RESTAPI+"keywords/",(t=>{let o="";for(let e in t)o+="";o+="",$("#"+e).append(o)}));let a={},s=e=>{a[e]||(e=e.toLowerCase().trim(),$("#idKWordInput").val(""),a[e]=1,console.log("Added keyword "+e),o&&o(e),$("#idKWords").append("
    "+e+"
    "),$("#idkw-"+e).click((()=>{$("#idkw-"+e).remove(),a[e]=void 0,console.log("Removed keyword "+e),i&&i(e)})))};if(t)for(let e in t)s(t[e]);$("#idKWordInput").keypress((function(e){if("13"!=(e.keyCode?e.keyCode:e.which))return;let t=$("#idKWordInput").val().toLowerCase().trim();!t||t.length<3||s(t)})),$("#idKWadd").click((()=>{let e=$("#idKWordInput").val().toLowerCase().trim();!e||e.length<3||s(e)}))},uiAttachCollectionItemsToInput:(e,t)=>{let o="";$("#"+e).attr("list",e+"-list"),$("#"+e).attr("name",e+"-list"),$.getJSON(ATON.PATH_RESTAPI+"c/"+t+"/",(t=>{o+="";for(let e in t){let i=t[e];o+=""}o+="",$("#"+e).html(o)}))},getVRCclassFromID:e=>"atonVRCu"+e%6,_setupVRCevents:()=>{R._bVRCsetup||(ATON.on("VRC_IDassigned",(e=>{$("#btn-vrc").addClass(R.getVRCclassFromID(e)),ATON.SUI.setSelectorColor(ATON.Photon.color),ATON.plight.color=ATON.Photon.color,R.checkAuth((e=>{void 0!==e.username&&ATON.Photon.setUsername(e.username)}))})),ATON.on("VRC_SceneState",(e=>{let t=ATON.Photon.getNumUsers();t>1?$("#idVRCnumusers").html(t):$("#idVRCnumusers").html(""),console.log("Users: "+t)})),ATON.on("VRC_Disconnected",(()=>{$("#btn-vrc").attr("class","atonBTN"),ATON.SUI.setSelectorColor(ATON.MatHub.colors.defUI),ATON.MediaFlow.stopAllStreams(),$("#idVRCnumusers").html("")})),R._bVRCsetup=!0)},uiAddButtonPhoton:e=>{R.uiAddButton(e,"vrc",(()=>{ATON.Photon.isConnected()?R.popupVRC():ATON.Photon.connect()}),"Photon (collaborative session)"),$("#btn-vrc").append(""),R._setupVRCevents(),void 0!==ATON.Photon.uid?$("#btn-vrc").addClass(R.getVRCclassFromID(ATON.Photon.uid)):$("#btn-vrc").attr("class","atonBTN")}};R.uiAddButtonVRC=R.uiAddButtonPhoton,R.uiAddButtonUser=e=>{R.uiAddButton(e,"user",(()=>{R.popupUser()}),"User"),R.checkAuth((e=>{void 0!==e.username?$("#btn-user").addClass("switchedON"):$("#btn-user").removeClass("switchedON")}))},R.uiSetEditMode=(e,t)=>{ATON.SceneHub._bEdit=e,R.uiSwitchButton("edit",e),ATON._renderer.domElement,e?$("#"+t).addClass("atonToolbar-bg-edit"):$("#"+t).removeClass("atonToolbar-bg-edit")},R.uiAddButtonEditMode=e=>{R.uiAddButton(e,"edit",(()=>{R.checkAuth((t=>{void 0!==t.username?(ATON.SceneHub._bEdit?R.uiSetEditMode(!1,e):R.uiSetEditMode(!0,e),console.log("Persistent Edit Mode: "+ATON.SceneHub._bEdit)):R.popupUser()}))}),"Persistent Edit Mode"),ATON.SceneHub._bEdit?R.uiSwitchButton("edit",!0):R.uiSwitchButton("edit",!1)},R.uiAddProfile=(e,t)=>{"function"==typeof t&&(R._uiProfiles[e]=t)},R.uiLoadProfile=e=>{let t=R._uiProfiles[e];void 0!==t&&(t(),R._uiCurrProfile=e,console.log("Loaded UI Profile: "+R._uiCurrProfile))},R.getCurrentUIP=()=>R._uiCurrProfile,R.attachHandlerToButton=(e,t)=>{void 0!==t&&$("#"+e).click((()=>{t()}))},R.uiAttachInputFilterID=e=>{$("#"+e).on("keyup change input",(()=>{let t=$("#"+e).val(),o=new RegExp("[^A-Za-z0-9-_]","ig");$("#"+e).val(t.replace(o,""))}))},R.switchNode=(e,t,o)=>{let i;i=o===ATON.NTYPES.SEM?ATON.getSemanticNode(e):ATON.getSceneNode(e),void 0!==i&&(i.toggle(t),ATON.fireEvent("FE_NodeSwitch",{nid:e,t:o,v:t}))},R.uiCreateGraph=e=>{let t=ATON.snodes;e===ATON.NTYPES.SEM&&(t=ATON.semnodes);let o="";for(let i in t){let r=t[i].visible?"checked":"";"."!==i&&(o+="'+i,o+="
    ")}return o},R.setupBasicUISounds=()=>{R.auLib={},R.auLib.switch=new Audio(ATON.PATH_RES+"audio/switch.wav"),R.auLib.switch.loop=!1},R.playAudioFromSemanticNode=e=>{if(void 0===e)return;let t=ATON.getSemanticNode(e);if(void 0===t)return;let o=t.getAudio();void 0!==o&&("string"!=typeof o||o.startsWith("data:audio")||(o=ATON.Utils.resolveCollectionURL(o)),void 0===R._auSemNode||null===R._auSemNode?R._auSemNode=new THREE.Audio(ATON.AudioHub._listener):R._auSemNode.stop(),ATON.AudioHub._loader.load(o,(e=>{R._auSemNode.setBuffer(e),R._auSemNode.setLoop(!1),R._auSemNode.play()})))},R.popupShow=(e,t)=>{if(R._bPopup)return!1;R._tPopup=Date.now();let o="atonPopup ";t&&(o+=t);let i="
    ";return i+=e+"
    ",R._bPopup=!0,ATON._bListenKeyboardEvents=!1,$("#idPopup").html(i),$("#idPopupContent").click((e=>{e.stopPropagation()})),$("#idPopup").show(),R.popupBlurBG>0&&(ATON._renderer.domElement.style.filter="blur("+R.popupBlurBG+"px)"),ATON._bPauseQuery=!0,$("#idTopToolbar").hide(),$("#idBottomToolbar").hide(),$("#idBottomRToolbar").hide(),$("#idPoweredBy").hide(),!0},R.popupClose=e=>{Date.now()-R._tPopup0&&(ATON._renderer.domElement.style.filter="none"),$("#idPopup").hide(),ATON._bPauseQuery=!1,$("#idTopToolbar").show(),$("#idBottomToolbar").show(),$("#idBottomRToolbar").show(),$("#idPoweredBy").show(),ATON.focusOn3DView())},R.subPopup=e=>{ATON.FE.popupClose(),e()},R.popupQR=()=>{let e="
    Share
    ";if(e+="


    ",!ATON.FE.popupShow("
    Share


    "))return;let t=window.location.href;new QRCode(document.getElementById("idQRcode"),t)},R.popupScreenShot=()=>{let e=ATON.Utils.takeScreenshot(256);R.checkAuth((t=>{let o="
    Capture
    ";o+="This is a preview of what your screenshot will look like:

    ",o+="
    ",o+="Resolution: px
    ",o+="
    Screenshot
    ",o+="
    Record video
    ",void 0!==t.username&&(o+="
    Set as Cover
    "),ATON.FE.popupShow(o)&&(ATON.MediaFlow._bScreenRec?$("#btnScreenRec").addClass("atonBTN-rec"):$("#btnScreenRec").removeClass("atonBTN-rec"),$("#btnScreenShot").click((()=>{let e=parseInt($("#isShotSize").val());e<100||(ATON.FE.popupClose(),ATON.Utils.takeScreenshot(e,"shot.png"))})),$("#btnScreenRec").click((()=>{ATON.MediaFlow._bScreenRec||ATON.MediaFlow.startScreenRecording(),ATON.FE.popupClose()})),$("#btnSetCover").click((()=>{ATON.FE.popupClose(),ATON.Utils.postJSON(ATON.PATH_RESTAPI+"cover/scene/",{sid:ATON.SceneHub.currID,img:e.src},(e=>{console.log(e)}))})))}))},R.popupVRC=()=>{let e="",t=ATON.Photon.getNumUsers();e+=t>1?"
    Collaborative Session ("+t+" users)
    ":"
    Collaborative Session
    ",e+="
    ",e+="",e+="",e+="
    LEAVE
    ",e+="
    ",e+="",ATON.FE.popupShow(e,"atonPopupLarge")&&(ATON.checkAuth((e=>{console.log(e),ATON.MediaFlow._bCamStream||ATON.FE.uiAddButton("idCollabTools","screenshare",(()=>{ATON.MediaFlow._bScreenStream?$("#btn-screenshare").addClass("atonBTN-rec"):$("#btn-screenshare").removeClass("atonBTN-rec"),ATON.MediaFlow.startOrStopScreenStreaming(),ATON.FE.popupClose()}),"Share your screen with other participants"),!ATON.MediaFlow._bScreenStream&&ATON.MediaFlow.hasVideoInput()&&ATON.FE.uiAddButton("idCollabTools","camera",(()=>{ATON.MediaFlow._bCamStream?$("#btn-camera").addClass("atonBTN-rec"):$("#btn-camera").removeClass("atonBTN-rec"),ATON.MediaFlow.startOrStopCameraStreaming(),ATON.FE.popupClose()}),"Share your camera with other participants"),ATON.MediaFlow._bScreenStream?$("#btn-screenshare").addClass("atonBTN-rec"):$("#btn-screenshare").removeClass("atonBTN-rec"),ATON.MediaFlow._bCamStream?$("#btn-camera").addClass("atonBTN-rec"):$("#btn-camera").removeClass("atonBTN-rec")})),void 0===ATON.Photon._username?($("#idVRCusername").show(),$("#idVRCusernameBTN").hide()):($("#idVRCusername").val(ATON.Photon._username),$("#idVRCusername").hide(),$("#idVRCusernameBTN").show()),void 0!==ATON.Photon.uid&&$("#idVRCusernameBTN").addClass("atonVRCu"+ATON.Photon.uid%6),$("#idChatBoxPopup").append(ATON.Photon._elChat),$("#idVRCmsg").keypress((e=>{if("13"==(e.keyCode?e.keyCode:e.which)){let e=$("#idVRCmsg").val();ATON.Photon.setMessage(e),$("#idVRCmsg").val("")}})),$("#idVRCusername").keypress((e=>{if("13"==(e.keyCode?e.keyCode:e.which)){let e=$("#idVRCusername").val();ATON.Photon.setUsername(e),$("#idVRCusername").hide(),$("#idVRCusernameBTN").html(ATON.Photon._username),$("#idVRCusernameBTN").show()}})),$("#idVRCusernameBTN").click((()=>{$("#idVRCusername").show(),$("#idVRCusernameBTN").hide()})),$("#idVRCdisconnect").click((()=>{ATON.Photon.disconnect(),ATON.FE.popupClose()})))},R.checkAuth=e=>{ATON.Utils.checkAuth((t=>{R._userAuth=t,void 0!==t.username?($("#btn-user").addClass("switchedON"),void 0===ATON.Photon._username&&ATON.Photon.setUsername(t.username)):$("#btn-user").removeClass("switchedON"),e&&e(t)}))},R.popupUser=()=>{R.checkAuth((e=>{if(void 0!==e.username){let t="
    ";if(t+="'"+e.username+"'

    ",Object.keys(R._uiProfiles).length>0){t+="UI Profile:


    "}if(t+="
    LOGOUT
    ",!ATON.FE.popupShow(t))return;R._uiCurrProfile&&(console.log(R._uiCurrProfile),$("#idUIProfiles").val(R._uiCurrProfile)),$("#idLogoutBTN").click((()=>{$.get(ATON.PATH_RESTAPI+"logout",(e=>{console.log(e),ATON.SceneHub.setEditMode(!1),R.uiSwitchButton("edit",!1),ATON.fireEvent("Logout"),$("#btn-user").removeClass("switchedON")})),ATON.FE.popupClose()})),$("#idSHUscenes").click((()=>{ATON.Utils.goToURL("/shu/scenes/")})),$("#idSHUuser").click((()=>{ATON.Utils.goToURL("/shu/auth/")})),$("#idUIProfiles").on("change",(()=>{let e=$("#idUIProfiles").val();R.uiLoadProfile(e),ATON.FE.popupClose()}))}else{let e="
    ";if(e+="username:
    ",e+="password:
    ",e+="
    LOGIN
    ",!ATON.FE.popupShow(e))return;$("#idLoginBTN").click((()=>{let e=JSON.stringify({username:$("#idUsername").val(),password:$("#idPassword").val()});$.ajax({url:ATON.PATH_RESTAPI+"login",type:"POST",data:e,contentType:"application/json; charset=utf-8",dataType:"json",success:e=>{console.log(e),e&&(ATON.fireEvent("Login",e),$("#btn-user").addClass("switchedON"),ATON.FE.popupClose())}}).fail((e=>{$("#idLoginBTN").html("LOGIN FAILED"),$("#idLoginBTN").attr("class","atonBTN atonBTN-red")}))}))}}))},R.popupSceneInfo=()=>{let e=ATON.SceneHub.getTitle();void 0===e&&(e=ATON.SceneHub.currID);let t=ATON.SceneHub.getDescription(),o="
    "+e+"
    ";t&&(o+="
    "+JSON.parse(t)+"
    "),o+="
    OK
    ",ATON.FE.popupShow(o)&&$("#btnOK").click((()=>{ATON._onUserInteraction(),ATON.FE.popupClose()}))},R.computeSelectorRanges=()=>{let e=ATON.bounds.radius;e<=0||(R._selRanges[0]=.001*e,R._selRefRadius=.01*e,R._selRanges[1]=.5*e)},R.popupSelector=()=>{let e="
    3D Selector
    ",t=ATON.SUI.getSelectorRadius(),o=ATON.Utils.getHumanReadableDistance(t);R.computeSelectorRanges(),e+="Radius ("+o+"):
    ",e+="",ATON.FE.popupShow(e,"atonPopupLarge")&&($("#idSelRad").val(t),$("#idSelRad").on("input change",(()=>{let e=parseFloat($("#idSelRad").val());ATON.SUI.setSelectorRadius(e),$("#idSelRadTxt").html(ATON.Utils.getHumanReadableDistance(e))})))},R.popupNav=()=>{let e="
    Navigation
    ";e+="
    ",e+="
    ",e+="
    Switch between first-person and orbit navigation mode
    ",e+="
    ",ATON.Utils.isConnectionSecure()&&(e+="
    ",e+="
    ",e+="
    Immersive VR mode
    ",e+="
    ",ATON.Utils.isMobile()&&(e+="
    ",e+="
    ",e+="
    Enable or disable device-orientation mode
    ",e+="
    ")),R.popupShow(e)&&(R.uiAddButtonFirstPerson("idNMfp"),R.uiAddButtonDeviceOrientation("idNMdevori"),R.uiAddButtonVR("idNMvr"))},R.popupModalToken=(e,t)=>{if(void 0===t)return;ATON.FE.popupClose();let o="
    Token Required
    ";e&&(o+=e),o+="

    ",o+="
    OK
    ",R.popupShow(o)&&$("#btnTokenOK").click((()=>{let e=$("#idTokStr").val();void 0===e||e.length<2||(ATON.FE.popupClose(),t(e))}))},R.popupNewNode=e=>{void 0===e&&(e=ATON.NTYPES.SCENE);let t="";e===ATON.NTYPES.SCENE&&(t="
    New Scene Node
    "),e===ATON.NTYPES.SEM&&(t="
    New Semantic Node
    "),t+="ID:
    ",t+="
    Add

    ",R.popupShow(t)&&$("#btnNewNID").click((()=>{let t=$("#idNID").val().trim();void 0===t||t.length<3||new ATON.Node(t,e).attachToRoot()}))};const y=R;let w={auType:"audio/wav",auStreamSegmentInterval:200,auStreamNumSegments:2,vidStreamSegmentInterval:300,vidStreamNumSegments:1,auMinVol:1,init:()=>{w._bAudioRecording=!1,w._bAudioStreaming=!1,w._bScreenRec=!1,w._blobOptAudio={type:"audio/wav"},w._blobOptVideo={type:"video/mp4"},w._cAuStream={audio:{channelCount:1,echoCancellation:!0,noiseSuppression:!0}},w._cAuRec={audio:{channelCount:1}},w._cScreenRec={video:{width:1280,height:720,framerate:30}},w._cScreenStream={video:{cursor:"always",width:{max:640},height:{max:360},framerate:15}},w._cCamStream={video:{width:{max:512},height:{max:512}}},w._oStream={audioBitsPerSecond:9e3,videoBitsPerSecond:5e5},w._aurec=void 0,w._sblob=void 0,w._schunks=[],w._bVideoStream=!1,w._vrec=void 0,w._scblob=void 0,w._scchunks=[],w._bCamStream=!1,w._bScreenStream=!1,w._setupFR(),w.detectDevices(),navigator.mediaDevices&&navigator.mediaDevices.addEventListener("devicechange",(e=>{w.detectDevices()})),w._vStreams={}},_setupFR:()=>{w._frAR=new window.FileReader,w._frAR.onloadend=()=>{let e=w._frAR.result;ATON.fireEvent("AudioRecordCompleted",e),w._bAudioRecording=!1},w._frAS=new window.FileReader,w._frAS.onloadend=()=>{if(!w._bAudioStreaming)return;let e=w._frAS.result;ATON.Photon.socket.emit("UTALK",{audio:e,uid:ATON.Photon.uid}),e=null},w._frVS=new window.FileReader,w._frVS.onloadend=()=>{if(!w._bVideoStream)return;let e=w._frVS.result;ATON.Photon.socket.emit("UVIDEO",{video:e,uid:ATON.Photon.uid}),e=null}},detectDevices:()=>{w.audioInputDevices=[],w.videoInputDevices=[],navigator.mediaDevices&&navigator.mediaDevices.enumerateDevices().then((e=>{for(let t in e){let o=e[t];"audioinput"===o.kind&&w.audioInputDevices.push(o),"videoinput"===o.kind&&w.videoInputDevices.push(o)}}))},hasAudioInput:()=>w.audioInputDevices.length>0,hasVideoInput:()=>w.videoInputDevices.length>0,isAudioRecording:()=>w._bAudioRecording,startRecording:()=>{w._bAudioRecording?console.log("Already recording."):navigator.mediaDevices.getUserMedia(w._cAuRec).then((e=>{w._aurec=new MediaRecorder(e),w._aurec.onstart=function(e){console.log("Start recording..."),w._bAudioRecording=!0,w._schunks=[]},w._aurec.ondataavailable=function(e){w._schunks.push(e.data)},w._aurec.onstop=function(e){console.log("Stop recording..."),w._sblob=new Blob(w._schunks,w._blobOptAudio),w._frAR.readAsDataURL(w._sblob)},w._aurec.start()})).catch((e=>{console.log(e)}))},stopRecording:()=>{w._aurec&&w._bAudioRecording&&w._aurec.stop()},startOrStopRecording:()=>{w._bAudioRecording?w.stopRecording():w.startRecording()},startAudioStreaming:()=>{navigator.mediaDevices.getUserMedia(w._cAuStream).then((e=>{w._aurec=new MediaRecorder(e,w._oStream),w._aurec.start(w.auStreamSegmentInterval),console.log("Start audio streaming"),w._aurec.onstart=e=>{w._bAudioStreaming=!0,w._bAudioRecording=!0,w._schunks=[]},w._aurec.ondataavailable=e=>{e.data.size<=0||(w._schunks.push(e.data),w._schunks.length{w._sblob=new Blob(w._schunks,w._blobOptAudio),w._frAS.readAsDataURL(w._sblob),w._bAudioStreaming&&w._aurec.start(w.auStreamSegmentInterval)}})).catch((e=>{console.log(e)}))},stopAudioStreaming:()=>{w._aurec&&w._bAudioStreaming&&("inactive"!==w._aurec.state&&w._aurec.stop(),console.log("Stop audio streaming"),w._bAudioStreaming=!1,w._bAudioRecording=!1,ATON.Photon.socket.emit("UAUDIOSTOP",{uid:ATON.Photon.uid}))},startOrStopAudioStreaming:()=>{w._bAudioRecording?w.stopAudioStreaming():w.startAudioStreaming()},startScreenRecording:()=>{w._bScreenRec||w._bScreenStream||navigator.mediaDevices.getDisplayMedia(w._cScreenRec).then((e=>{w._vrec=new MediaRecorder(e),w._scchunks=[],w._vrec.ondataavailable=e=>{e.data.size>0&&w._scchunks.push(e.data)},w._vrec.onstop=()=>{w._scblob=new Blob(w._scchunks,w._blobOptVideo),console.log(w._scblob.size),ATON.Utils.downloadBlob(w._scblob,"capture.mp4"),w._scchunks=[],w._bScreenRec=!1},w._vrec.start(200),w._bScreenRec=!0})).catch((e=>{console.log(e)}))},stopScreenRecording:()=>{w._bScreenRec&&(w._vrec.stop(),w._bVideoStream=!1,w._bScreenStream=!1,console.log("Stop screen recording"))},startScreenStreaming:()=>{navigator.mediaDevices.getDisplayMedia(w._cScreenStream).then((e=>{w.realizeOrUpdateVStream(e,w.stopScreenStreaming),w._vrec=new MediaRecorder(e,w._oStream),w._vrec.start(w.vidStreamSegmentInterval),console.log("Start screen streaming"),w._vrec.onstart=e=>{w._bVideoStream=!0,w._bScreenStream=!0,w._scchunks=[]},w._vrec.ondataavailable=e=>{e.data.size<1||(w._scchunks.push(e.data),w._scchunks.length{w._scblob=new Blob(w._scchunks,w._blobOptVideo),w._frVS.readAsDataURL(w._scblob),w._bVideoStream&&w._vrec.start(w.vidStreamSegmentInterval)}})).catch((e=>{console.log(e)}))},stopScreenStreaming:()=>{if(w._vrec&&w._bVideoStream&&(w._vrec.stop(),w._bVideoStream=!1,w._bScreenStream=!1,console.log("Stop screen streaming"),void 0!==ATON.Photon.uid)){let e=w.getVideoStream(ATON.Photon.uid);e.el.style.display="none",e.el.pause(),ATON.Photon.socket.emit("UVIDEOSTOP",{uid:ATON.Photon.uid})}},startOrStopScreenStreaming:()=>{w._bVideoStream?w.stopScreenStreaming():w.startScreenStreaming()},startCameraStreaming:()=>{w._bVideoStream||navigator.mediaDevices.getUserMedia(w._cCamStream).then((e=>{w.realizeOrUpdateVStream(e,w.stopCameraStreaming),w._vrec=new MediaRecorder(e,w._oStream),w._vrec.start(w.vidStreamSegmentInterval),console.log("Start camera streaming"),w._vrec.onstart=e=>{w._bVideoStream=!0,w._bCamStream=!0,w._scchunks=[]},w._vrec.ondataavailable=e=>{e.data.size<1||(w._scchunks.push(e.data),w._scchunks.length{w._scblob=new Blob(w._scchunks,w._blobOptVideo),w._frVS.readAsDataURL(w._scblob),w._bVideoStream&&w._vrec.start(w.vidStreamSegmentInterval)}})).catch((e=>{console.log(e)}))},stopCameraStreaming:()=>{if(w._vrec&&w._bVideoStream&&(w._vrec.stop(),w._bVideoStream=!1,w._bCamStream=!1,console.log("Stop camera streaming"),void 0!==ATON.Photon.uid)){let e=w.getVideoStream(ATON.Photon.uid);e.el.style.display="none",e.el.pause(),ATON.Photon.socket.emit("UVIDEOSTOP",{uid:ATON.Photon.uid})}},startOrStopCameraStreaming:()=>{w._bVideoStream?w.stopCameraStreaming():w.startCameraStreaming()},realizeOrUpdateVStream:(e,t)=>{let o=ATON.Photon.uid;if(void 0===o)return;let i=w.getOrCreateVideoStream(o,void 0,!0);i.el.playsinline=!0,i.el.style.display="inline-block",i.el.classList.add("atonVRCvidStream"),i.el.classList.add("atonVRCu"+o%6),t&&(i.el.onclick=t),i.el.srcObject=e},stopAllStreams:()=>{w.stopAudioStreaming(),w.stopCameraStreaming(),w.stopScreenStreaming()},getOrCreateVideoStream:(e,t,o)=>{if(w._vStreams[e])t&&(w._vStreams[e].el.src=t);else{w._vStreams[e]={};let i="vStream-"+e;if(o&&(i="uStream"+e,w._vStreams[e].uid=e),$("").appendTo("body"),w._vStreams[e].el=document.getElementById(i),t)if(t.endsWith("m3u8"))if(Hls.isSupported()){let o=new Hls;o.loadSource(t),o.attachMedia(w._vStreams[e].el)}else w._vStreams[e].el.src=t;else w._vStreams[e].el.src=t;o||(w._vStreams[e].el.loop=!0),w._vStreams[e].texStream=new THREE.VideoTexture(w._vStreams[e].el),w._vStreams[e].texStream.colorSpace=ATON._stdEncoding,w._vStreams[e].texStream.flipY=!1,w._vStreams[e].matStream=ATON.MatHub.materials.chromakey.clone(),w._vStreams[e].matStream.uniforms.tBase.value=w._vStreams[e].texStream}return w._vStreams[e]},getVideoStream:e=>w._vStreams[e],downloadVideoSnapshot:(e,t,o)=>{o||(o=1);let i=e.videoWidth*o,r=e.videoHeight*o,a=document.createElement("canvas");a.width=i,a.height=r,a.getContext("2d").drawImage(e,0,0,i,r),ATON.Utils.downloadImageFromCanvas(a,t)}};const M=w;let L={EARTH_R_KM:6371};L.EARTH_D_KM=2*L.EARTH_R_KM,L.init=()=>{L._bActive=!1,L._wpid=void 0,L._currGeoPos=new THREE.Vector2,L._GeoPOIs=[],L._currGeoPOI=void 0,L._closestGeoPOI=void 0,L._maxGeoError=40},L.enableGeoTracking=()=>{L._bActive||ATON.Utils.isConnectionSecure()&&navigator.geolocation&&(L._wpid=navigator.geolocation.watchPosition(L._onGeoPosition,L._onGeoError,{enableHighAccuracy:!0}),L._bActive=!0)},L.disableGeoTracking=()=>{L._bActive&&(navigator.geolocation.clearWatch(L._wpid),L._bActive=!1)},L.setMaxGeoError=e=>{e>0&&(L._maxGeoError=e)},L._onGeoError=()=>{console.log("Geolocation error")},L._onGeoPosition=e=>{if(!L._bActive)return;if(!e.coords)return;let t=e.coords.accuracy;t&&t>L._maxGeoError||(L._currGeoPos.x=e.coords.latitude,L._currGeoPos.y=e.coords.longitude,ATON.fireEvent("GeoLocation",e),L._handleGeoPOIs())},L._handleGeoPOIs=()=>{let e=L._GeoPOIs.length;if(!(e<=0)){L._closestGeoPOIdist=void 0,L._closestGeoPOI=void 0;for(let t=0;t{if(L._bActive)return L._currGeoPos},L.geolocationFromLatLon=(e,t)=>new THREE.Vector2(e,t),L.geodistance_orig=(e,t)=>{let o=ATON.DEG2RAD*(t.x-e.x),i=ATON.DEG2RAD*(t.y-e.y),r=Math.sin(o/2)*Math.sin(o/2)+Math.cos(ATON.DEG2RAD*e.x)*Math.cos(ATON.DEG2RAD*t.x)*Math.sin(i/2)*Math.sin(i/2),a=2*Math.atan2(Math.sqrt(r),Math.sqrt(1-r));return L.EARTH_R_KM*a*1e3},L.geodistance=(e,t)=>{let o=.5-Math.cos((t.x-e.x)*ATON.DEG2RAD)/2+Math.cos(e.x*ATON.DEG2RAD)*Math.cos(t.x*ATON.DEG2RAD)*(1-Math.cos((t.y-e.y)*ATON.DEG2RAD))/2;return L.EARTH_D_KM*Math.asin(Math.sqrt(o))*1e3},L.addGeoPOI=(e,t)=>{let o={};return o.pos=new THREE.Vector2(e.x,e.y),o.radius=t,L._GeoPOIs.push(o),L._bActive||L.enableTracking(),L._handleGeoPOIs(),L._GeoPOIs.length-1},L.getGeoPOIbyIndex=e=>L._GeoPOIs[e],L.getClosestGeoPOI=()=>L._closestGeoPOI,L.getClosestGeoPOIdistance=()=>L._closestGeoPOIdist;const C=L;let H={};H._id=$("meta[name='aton\\:appid']").attr("content"),H._data={},H.setup=void 0,H.update=void 0,H._bRunning=!1,H._pDeps=[],H._fLoading=0,H._sendDataPatch=(e,t,o)=>new Promise(((i,r)=>{if(void 0===e)return void r("No storage ID specified");if(e.length<3)return void r("Storage ID too short");if(void 0===t)return void r("No storage patch");if(void 0===H._id)return void r("No app-ID");void 0===o&&(o=ATON.PATCH_ADD);let a={};a.wappid=H._id,a.fid=e,a.data=t,a.mode=o===ATON.PATCH_DEL?"DEL":"ADD";let s=JSON.stringify(a);$.ajax({url:ATON.PATH_RESTAPI+"patch/wapp",type:"POST",data:s,contentType:"application/json; charset=utf-8",dataType:"json",success:t=>{void 0!==t?(H._data[e]=t,i(t)):r("Error writing on server")}})})),H.getAppID=()=>H._id,H.addToStorage=(e,t)=>H._sendDataPatch(e,t,ATON.PATCH_ADD),H.deleteFromStorage=(e,t)=>H._sendDataPatch(e,t,ATON.PATCH_DEL),H.getStorage=e=>new Promise(((t,o)=>{void 0!==H._id?void 0!==e?$.getJSON(ATON.PATH_WAPPS+H._id+"/data/"+e+".json",(o=>{console.log(o),H._data[e]=o,t(o)})):o("No storage ID specified"):o()})),H.registerServiceWorker=e=>{if(e)return H.basePath&&(e=H.basePath+e),"serviceWorker"in navigator&&window.addEventListener("load",(()=>{navigator.serviceWorker.register(e).then((e=>console.log("PWA service worker registered"))).catch((e=>console.log("PWA service worker not registered",e)))})),H},H.requireFlares=e=>{if(e)return ATON._fReqList=e,console.log("Required Flares: "+ATON._fReqList),H},H.loadScene=(e,t)=>{void 0!==e&&ATON.SceneHub.load(ATON.PATH_RESTAPI2+"scenes/"+e,e,t)},H.realize=(e,t,o)=>{H.setup=e,H.update=t,H.params=new URLSearchParams(window.location.search),H.basePath=ATON.Utils.getBaseFolder(window.location.href.split("?")[0]),H.registerServiceWorker(o);let i=H.params.get("ff");if(i){let e=String(i).split(",");H.requireFlares(e)}return H},H.realizeAndRun=(e,t,o)=>{H.realize(e,t,o).run()},H.run=()=>!H._bRunning&&(H._bRunning=!0,H.setup?H.setup():(ATON.FE.realize(),console.log("App [Warn]: your App should define a setup() routine")),H.update&&(ATON.addUpdateRoutine(H.update),console.log("App: update routine registered")),ATON._fRequired<=0&&ATON.fireEvent("AllFlaresReady"),!0);const D=H;let x={PASS_BASE:"p_base",PASS_AA:"p_aa",PASS_AO:"p_ao",PASS_SSR:"p_ssr",PASS_BLOOM:"p_bloom",PASS_DOF:"p_dof",PASS_GAMMA:"p_gamma",PASS_SOBEL:"p_sobel",init:()=>{if(void 0===ATON._renderer)return;let e=ATON._renderer.getPixelRatio(),t=ATON._renderer.getSize(new THREE.Vector2);const o=new THREE.WebGLRenderTarget(t.width*e,t.height*e,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat,colorSpace:ATON._stdEncoding});o.texture.name="EffectComposer.rt1",x.composer=new THREE.EffectComposer(ATON._renderer,o),x.passes={},ATON._renderer.autoClear=!1;let i=window.innerWidth*ATON._stdpxd,r=window.innerHeight*ATON._stdpxd;x.passes[x.PASS_BASE]=new THREE.RenderPass(ATON._mainRoot,ATON.Nav._camera),x.composer.addPass(x.passes[x.PASS_BASE]),x.passes[x.PASS_AO]=new THREE.SAOPass(ATON._mainRoot,ATON.Nav._camera,i,r),x.passes[x.PASS_AO].params.saoBias=1,x.passes[x.PASS_AO].params.saoScale=100,x.passes[x.PASS_AO].params.saoIntensity=.2,x.passes[x.PASS_BLOOM]=new THREE.UnrealBloomPass(new THREE.Vector2(i,r),1.5,.4,.85),x.passes[x.PASS_BLOOM].threshold=.9,x.passes[x.PASS_BLOOM].strength=1,x.passes[x.PASS_BLOOM].radius=1.2,x.passes[x.PASS_DOF]=new THREE.BokehPass(ATON._mainRoot,ATON.Nav._camera,{focus:5,aperture:.001,maxblur:.01,width:i,height:r}),x.composer.addPass(x.passes[x.PASS_AO]),x.composer.addPass(x.passes[x.PASS_BLOOM]),x.composer.addPass(x.passes[x.PASS_DOF]),x.togglePass(x.PASS_AO,!1),x.togglePass(x.PASS_BLOOM,!1),x.togglePass(x.PASS_DOF,!1)},togglePass:(e,t)=>{void 0!==x.composer&&(ATON.device.lowGPU||void 0!==x.passes[e]&&(x.passes[e].enabled=void 0===t?!x.passes[e].enabled:t))},isPassEnabled:e=>void 0!==x.composer&&(void 0!==x.passes[e]&&x.passes[e].enabled),setAOintensity:e=>{void 0!==x.composer&&void 0!==x.passes[x.PASS_AO]&&(x.passes[x.PASS_AO].params.saoIntensity=e)},getAOintensity:()=>void 0===x.composer||void 0===x.passes[x.PASS_AO]?0:x.passes[x.PASS_AO].params.saoIntensity,setBloomStrength:e=>{void 0!==x.composer&&void 0!==x.passes[x.PASS_BLOOM]&&(x.passes[x.PASS_BLOOM].strength=e)},getBloomStrength:()=>void 0===x.composer||void 0===x.passes[x.PASS_BLOOM]?0:x.passes[x.PASS_BLOOM].strength,setBloomThreshold:e=>{void 0!==x.composer&&void 0!==x.passes[x.PASS_BLOOM]&&(x.passes[x.PASS_BLOOM].threshold=e)},getBloomThreshold:()=>void 0===x.composer||void 0===x.passes[x.PASS_BLOOM]?0:x.passes[x.PASS_BLOOM].threshold,setDOFfocus:e=>{if(void 0===x.composer)return;if(void 0===x.passes[x.PASS_DOF])return;let t=x.passes[x.PASS_DOF].uniforms;void 0!==t&&(t.focus.value=e)},getDOFfocus:()=>{if(void 0===x.composer)return 0;if(void 0===x.passes[x.PASS_DOF])return 0;let e=x.passes[x.PASS_DOF].uniforms;return void 0===e?0:e.focus.value},setDOFaperture:e=>{if(void 0===x.composer)return;if(void 0===x.passes[x.PASS_DOF])return;let t=x.passes[x.PASS_DOF].uniforms;void 0!==t&&(t.aperture.value=e)}};const F=x;let V={STD_XPF_TRANSITION_DURATION:1,SEM_PREFIX:"XPF",SEMGROUP_PREFIX:"GXPF",init:()=>{V._list=[],V._iCurr=void 0,V._iNext=void 0,V._geom=void 0,V._mesh=void 0,V._mat=void 0,V._size=50,V._gSem=[],V._semIMGMasks={},V._semCanvas=void 0,V._semCTX=void 0,V._semCurr=void 0,V._shColor=new THREE.Color(0,0,1),V._shOpacity=.2,V._txCache={},V._pathMod=void 0,V._realizeBaseMat(),V._elVid=void 0,V._vidPlaying=!1},_realizeBaseMat:()=>{V._uniforms={tBase:{type:"t"},tSem:{type:"t"},tSemHint:{type:"t"},semHL:{type:"vec4",value:new THREE.Vector4(0,1,0,.15)},opacity:{type:"float",value:1},shColor:{type:"vec4",value:new THREE.Vector4(0,0,1,.2)},time:{type:"float",value:0}},V._mat=new THREE.ShaderMaterial({uniforms:V._uniforms,vertexShader:"\n varying vec3 vPositionW;\n varying vec3 vNormalW;\n varying vec3 vNormalV;\n varying vec2 vUv;\n\n void main(){\n vUv = uv;\n\n vPositionW = vec3( vec4( position, 1.0 ) * modelMatrix);\n vNormalW = normalize( vec3( vec4( normal, 0.0 ) * modelMatrix ) );\n vNormalV = normalize( vec3( normalMatrix * normal ));\n\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n }\n ",fragmentShader:"\n varying vec3 vPositionW;\n\t\t varying vec3 vNormalW;\n varying vec3 vNormalV;\n varying vec2 vUv;\n\n uniform float time;\n uniform sampler2D tBase;\n uniform sampler2D tSem;\n uniform sampler2D tSemHint;\n //uniform sampler2D tDepth;\n\n uniform vec4 semHL, shColor;\n uniform float opacity;\n\n\t\t void main(){\n vec4 frag = texture2D(tBase, vUv);\n vec4 sem = texture2D(tSem, vUv);\n vec4 semH = texture2D(tSemHint, vUv);\n float shv = max( max(semH.r,semH.g), semH.b);\n\n float t = (1.0 * cos(time*2.0));\n t = clamp(t, 0.0,1.0);\n\n frag = mix(frag, semHL, (sem.r * semHL.a));\n\n frag = mix(frag, shColor, (t * shv * shColor.a));\n\n frag.a = opacity;\n\n gl_FragColor = frag;\n\t\t }\n ",depthTest:!1,depthWrite:!1}),V.setSemanticHintMapOpacity(.2)},setPathModifier:e=>{if(void 0!==e){V._pathMod=e;for(let t in V.list)V.list[t].setPathModifier(e)}},update:()=>{if(ATON.Nav.isTransitioning())return;if(V._list.length<1)return;let e,t,o,i,r=V._list.length,a=ATON.Nav._currPOV.pos,s=ATON.Nav._vDir;V._uniforms.time.value+=ATON._dt,void 0===V._dirLNode&&(V._dirLNode=new THREE.Vector3);for(let n=0;n.8&&(void 0===o||l{void 0===V._geom&&(V._group=new THREE.Group,ATON._rootVisibleGlobal.add(V._group),V._geom=new THREE.SphereGeometry(1,40,40),V._geom.scale(-V._size,V._size,V._size),V._geom.castShadow=!1,V._geom.receiveShadow=!1,V._mesh=new THREE.Mesh(V._geom,V._mat),V._mesh.frustumCulled=!1,V._mesh.renderOrder=-100,V._mesh.layers.enable(ATON.NTYPES.SCENE),V._group.add(V._mesh),V._mesh.visible=!1)},setBaseGeometry:e=>{},add:e=>{if(void 0===e)return;V.realizeBaseGeometry();let t=V._list.length;V._list.push(e);let o=e.getMesh();o&&V._group.add(o);let i=ATON.getOrCreateSemanticNode(V.SEMGROUP_PREFIX+t);V._gSem.push(i),i.attachToRoot(),t>0||(ATON.Nav.toggleLocomotionValidator(!1),ATON._bqScene=!0)},clear:()=>{V._iCurr=void 0,V._iNext=void 0,V._semCurr=void 0;for(let e=0;eV._list.length,getMainGroup:()=>V._group,getSemanticGroup:e=>V._gSem[e],getCurrentSemanticGroup:()=>{if(void 0!==V._iCurr)return V._gSem[V._iCurr]},_preloadBaseLayer:(e,t)=>{if(void 0!==V._txCache[e])return V._txCache[e];let o=V._list[e]._pathbaselayer;V._pathMod&&(o=V._pathMod(o)),ATON.Utils.textureLoader.load(o,(o=>{o.colorSpace=ATON._stdEncoding,o.generateMipmaps=!0,V._txCache[e]=o,t&&t(o)}))},_clearTexCache:()=>{if(void 0!==V._iCurr)for(let e in V._txCache)V._txCache[e]&&e!==V._iCurr&&(V._txCache[e].dispose(),V._txCache[e]=void 0)},_setBaseLayerTexture:(e,t)=>{V._mat.map=t,V._mat.needsUpdate=!0,V._mesh.position.copy(e.getLocation()),V._mesh.rotation.set(e.getRotation().x,e.getRotation().y,e.getRotation().z)},updateCurrentXPFbaseLayer:e=>{if(void 0===V._iCurr)return;let t=V._list[V._iCurr];if(void 0===t)return;let o=t._pathbaselayer;if(V._pathMod&&(o=V._pathMod(o)),ATON.Utils.isVideo(o)){if(void 0===V._elVid){let e="",$(e).appendTo("body"),V._elVid=document.getElementById("idXPFVideo"),V._elVid.onplaying=()=>{console.log("XPF VideoPano playing"),V._vidPlaying=!0},V._elVid.onpause=()=>{console.log("XPF VideoPano paused"),V._vidPlaying=!1},V._elVid.addEventListener("touchstart",(function(){V._elVid.play()})),enableInlineVideo(V._elVid)}let i=new THREE.VideoTexture(V._elVid);return i.colorSpace=ATON._stdEncoding,V._mat.map=i,V._mat.needsUpdate=!0,V._uniforms.tBase.value=i,V._mesh.position.copy(t.getLocation()),V._mesh.rotation.set(t.getRotation().x,t.getRotation().y,t.getRotation().z),void(e&&e(i))}ATON.Utils.textureLoader.load(o,(o=>{o.colorSpace=ATON._stdEncoding,o.generateMipmaps=!0,V._mat.map=o,V._mat.needsUpdate=!0,V._uniforms.tBase.value=o,V._mesh.position.copy(t.getLocation()),V._mesh.rotation.set(t.getRotation().x,t.getRotation().y,t.getRotation().z),e&&e(o)}))},playOrPauseXPFVideoStream:()=>{void 0!==V._elVid&&(V._vidPlaying?V._elVid.pause():V._elVid.play())},updateCurrentXPFsemLayer:e=>{let t=V._list.indexOf(e);t<0||t===V._iCurr&&V.loadSemanticMasksIfAny(V._iCurr)},setCurrentXPF:(e,t)=>{V.toggleSUI(e,!1),V._iCurr=e,V._iNext=void 0,V._mesh.visible=!0,V._gSem[e].show(),V.updateCurrentXPFbaseLayer(t),ATON.fireEvent("CurrentXPF",e),ATON.fireEvent("NextXPF",void 0),V.loadSemanticMasksIfAny(e)},toggleSUI:(e,t)=>{if(void 0===e)return;let o=V._list[e];void 0!==o&&o._lnode.toggleSUI(t)},loadSemanticMasksIfAny:e=>{let t=V._list[e];if(void 0!==t){V._semIMGMasks={},V._uniforms.tSemHint.value=0,void 0!==t._semHintURL&&(V._uniforms.tSemHint.value=ATON.Utils.textureLoader.load(t._semHintURL));for(let e in t._semMasksURLs){void 0===V._semCanvas&&(V._semCanvas=document.createElement("canvas"),V._semCanvas.width=2048,V._semCanvas.height=2048,V._semCTX=V._semCanvas.getContext("2d",{willReadFrequently:!0}));let o=t._semMasksURLs[e],i=new Image;i.src=o,V._semIMGMasks[e]=i}}},getXPFbyIndex:e=>V._list[e],getCurrentXPFindex:()=>V._iCurr,getCurrentXPF:()=>{if(void 0!==V._iCurr)return V._list[V._iCurr]},getNextXPFindex:()=>V._iNext,getNextXPF:()=>{if(void 0!==V._iNext)return V._list[V._iNext]},getDistanceToXPFindex:e=>{if(void 0===e)return;let t=V._list[e];return void 0!==t?ATON.Nav._currPOV.pos.distanceTo(t.getLocation()):void 0},showSUIonlyForXPF:e=>{let t=V._list.length;if(!(t<1))for(let o=0;o{let o=V._list[e];void 0!==o&&(void 0===t&&(t=V.STD_XPF_TRANSITION_DURATION),ATON.XR._bPresenting&&(t=0),V.setCurrentXPF(e),ATON.Nav.requestTransitionToLocomotionNode(o.getLocomotionNode(),t))},requestTransitionToTarget:(e,t,o)=>{if(void 0===e)return;let i=new ATON.POV;i.setTarget(e),i.setPosition(ATON.Nav._currPOV.pos),t&&i.setFOV(t),ATON.Nav.requestPOV(i,o)},requestTransitionToDirection:(e,t,o)=>{if(void 0===e)return;let i=new THREE.Vector3;i.x=e.x+ATON.Nav._currPOV.pos.x,i.y=e.y+ATON.Nav._currPOV.pos.y,i.z=e.z+ATON.Nav._currPOV.pos.z,V.requestTransitionToTarget(i,t,o)},setHomeXPF:e=>{let t=V._list[e];if(void 0===t)return;let o=t.getLocomotionNode(),i=(new ATON.POV).setPosition(o.pos).setTarget(o.pos.x,o.pos.y,o.pos.z+1);ATON.Nav.setHomePOV(i)},getSemanticMaskURLfromXPFindex:(e,t)=>{let o=V._list[e];if(void 0!==o)return o.getSemanticMaskURL(t)},getSemanticMaskURLfromCurrentXPF:e=>{if(void 0!==V._iCurr)return V.getSemanticMaskURLfromXPFindex(V._iCurr,e)},setSemanticColor:(e,t)=>{void 0===t&&(t=.15),V._uniforms.semHL.value=new THREE.Vector4(e.r,e.g,e.b,t)},setSemanticOpacity:e=>{void 0===e&&(e=.15),V._uniforms.semHL.value.w=e},setSemanticHintMapOpacity:e=>{void 0===e&&(e=.2),V._shOpacity=e,V._uniforms.shColor.value.w=e},setSemanticHintMapColor:(e,t)=>{void 0!==e&&(V._shColor=e,V._uniforms.shColor.value.x=e.r,V._uniforms.shColor.value.y=e.g,V._uniforms.shColor.value.z=e.b,void 0!==t&&V.setSemanticHintMapOpacity(t))},querySemanticMasks:()=>{if(void 0===V._semCTX)return;if(void 0===ATON._queryDataScene)return;if(void 0===ATON._queryDataScene.uv)return;let e,t=V._semCTX,o=ATON._queryDataScene.uv;for(let i in V._semIMGMasks){let r=V._semIMGMasks[i],a=parseInt(r.width*o.x),s=parseInt(r.height*(1-o.y));if(t.drawImage(r,0,0),t.getImageData(a,s,1,1).data[0]>127){e=i;break}}if(void 0===e)return void 0!==V._semCurr&&ATON.fireEvent("SemanticMaskLeave",V._semCurr),V._semCurr=void 0,V._uniforms.tSem.value=0,V._uniforms.shColor.value.w=V._shOpacity,void(V._mat.needsUpdate=!0);V.highlightSemanticMaskInCurrentXPF(e),V._semCurr=e},highlightSemanticMaskInCurrentXPF:e=>{if(void 0===e)return void 0!==V._semCurr&&ATON.fireEvent("SemanticMaskLeave",V._semCurr),V._semCurr=void 0,V._uniforms.tSem.value=0,V._uniforms.shColor.value.w=V._shOpacity,void(V._mat.needsUpdate=!0);if(V._semCurr===e)return;let t=V.getSemanticMaskURLfromCurrentXPF(e);V._uniforms.tSem.value=ATON.Utils.textureLoader.load(t),V._mat.needsUpdate=!0,ATON.fireEvent("SemanticMaskHover",e),V._uniforms.shColor.value.w=0,void 0!==V._semCurr&&ATON.fireEvent("SemanticMaskLeave",V._semCurr)},loadFromPhotoscanFile:(e,t)=>{if(void 0===e)return;e=ATON.Utils.resolveCollectionURL(e);let o=ATON.Utils.getBaseFolder(e),i=0;$.ajax({url:e,dataType:"text",success:function(e){e=e.split(/\r\n|\n/);for(let t in e){let r=e[t];if(!r.startsWith("#")){let e=r.split(/\s{2,}|\t/);if(e.length>10){let t=new ATON.XPF,r=o+e[0],a=parseFloat(e[1]),s=parseFloat(e[2]),n=parseFloat(e[3]),l=ATON.DEG2RAD*parseFloat(e[4]);ATON.DEG2RAD,parseFloat(e[5]),ATON.DEG2RAD,parseFloat(e[6]),t.setLocation(a,n,-s),t.setBaseLayer(r),t.setRotation(0,-l,0),V.add(t),i++}}}console.log("Num panoramas parsed: "+i),t&&t()}})}};const I=V;let U={init:()=>{U.list=[]},anyCopyrightFound:()=>U.list.length>0,extract:e=>{if(void 0===e)return;if(void 0===e.asset)return;let t={};if(e.asset.copyright&&(t.copyright=e.asset.copyright),e.asset.extras)for(let o in e.asset.extras)"string"==typeof e.asset.extras[o]&&(t[o]=e.asset.extras[o]);if(U.extractXMP3DC(e,t),0!==Object.keys(t).length){e.asset.generator&&(t.generator=e.asset.generator);for(let e in U.list){let o=U.list[e];if(U.compare(t,o))return}U.list.push(t),console.log(t)}},compare:(e,t)=>{if(void 0===e||void 0===t)return!1;const o=Object.keys(e),i=Object.keys(t);if(o.length!==i.length)return!1;for(let i of o)if(e[i]!==t[i])return!1;return!0},extractXMP3DC:(e,t)=>{if(void 0===e||void 0===t)return;if(!e.userData)return;let o=e.userData.gltfExtensions;if(!o)return;if(!o.KHR_xmp)return;let i=o.KHR_xmp.packets;if(!i)return;let r=i[0],a="en-us";r["model3d:spdxLicense"]&&(t.license=r["model3d:spdxLicense"]),r["dc:date"]&&(t.date=r["dc:date"]),r["dc:title"]&&(t.title=r["dc:title"][a]),r["dc:description"]&&(t.description=r["dc:description"][a]),r["dc:rights"]&&(t.rights=r["dc:rights"][a]),r["dc:source"]&&(t.source=r["dc:source"]),r["dc:subject"]&&(t.subject=r["dc:subject"]),r["dc:type"]&&(t.type=r["dc:type"]),r["xmpRights:Owner"]&&(t.owner=r["xmpRights:Owner"]),r["xmp:CreatorTool"]&&(t.creatorTool=r["xmp:CreatorTool"])}};const k=U;let B={REST_API_CESIUMION_DEF_TOKEN:"https://api.cesium.com/v2/tokens/default",THRES_ORI:.01,THRES_POS:1e-6,init:()=>{B._tsets=[],B._tsET=20,B._tsB=!1,B._bTileBVH=!0,B._tsTasks=[],B.tsSchedCB=e=>{B._tsTasks.push(e)},B._tseBase=8,B.estimateTSErrorTarget(),B._tsuSync=0,B._bPCs=!1,B._pqLRU=void 0,B._pqDownload=void 0,B._pqParse=void 0,B._numTilesLoaded=0,B._numTSLoaded=0},clear:()=>{for(let e in B._tsets)B._tsets[e]=null;B._tsets=[],B._bPCs=!1},getTSetsErrorTarget:()=>B._tsET,setTSetsErrorTarget:e=>{B._tsET=e;const t=B._tsets.length;if(!(t<=0))for(let o=0;o{B._tsB=e;const t=B._tsets.length;if(!(t<=0))for(let o=0;o{void 0===e&&(e=ATON.Nav._camera);const t=B._tsets.length;if(!(t<=0))for(let o=0;o{B._tseBase=e,console.log(B._tseBase),B.estimateTSErrorTarget()},estimateTSErrorTarget:()=>{let e=B._tseBase;(ATON.device.lowGPU||ATON.device.isMobile)&&(e+=4),ATON.XR._bPresenting&&(e+=3),e<1&&(e=1),e>25&&(e=25),console.log("Estimated TSet error target: "+e),B.setTSetsErrorTarget(e)},loadTileSetFromURL:(e,t,o)=>{if(void 0===t)return;let i=new TILES.TilesRenderer(e);if(!i)return;ATON._assetReqNew(e),i.displayBoxBounds=B._tsB,i.fetchOptions.mode="cors",o&&(i.fetchOptions.headers={},i.fetchOptions.headers.Authorization=`Bearer ${o.accessToken}`,i.preprocessURL=e=>(e=new URL(e),/^http/.test(e.protocol)&&e.searchParams.append("v",o.v),e.toString())),i.errorTarget=B._tsET,i.optimizeRaycast=!1,void 0===B._pqLRU?(i.downloadQueue.schedulingCallback=B.tsSchedCB,i.parseQueue.schedulingCallback=B.tsSchedCB,i.downloadQueue.maxJobs=6,i.parseQueue.maxJobs=1,B._pqLRU=i.lruCache,B._pqDownload=i.downloadQueue,B._pqParse=i.parseQueue):(i.lruCache=B._pqLRU,i.downloadQueue=B._pqDownload,i.parseQueue=B._pqParse),i.setCamera(ATON.Nav._camera),i.setResolutionFromRenderer(ATON.Nav._camera,ATON._renderer),i.manager.addHandler(/\.gltf$/,ATON._aLoader),i.manager.addHandler(/\.ktx2$/,ATON._ktx2Loader),i.manager.addHandler(/\.drc$/,ATON._dracoLoader),t.add(i.group),$.getJSON(e,(e=>{ATON.CC.extract(e)}));let r=new THREE.Box3,a=new THREE.Sphere;new THREE.Matrix4,new THREE.Vector3;let s=!1;i.addEventListener("load-tile-set",(()=>{if(console.log("TileSet loaded"),ATON._assetReqComplete(e),B._numTSLoaded++,o||t.bUseGeoCoords){console.log("TileSet using GeoCoords"),i.getBoundingSphere(a);const e=a.center.clone(),t=e.length(),o=e.normalize(),r=new THREE.Vector3(0,1,0),s=ATON.Utils.rotationBetweenDirections(o,r);i.group.quaternion.x=s.x,i.group.quaternion.y=s.y,i.group.quaternion.z=s.z,i.group.quaternion.w=s.w,i.group.position.y=-t}else i.getBoundingBox(r)?(r.getBoundingSphere(a),t.autocenter?(r.getCenter(i.group.position),i.group.position.multiplyScalar(-1)):void 0===ATON.Nav.homePOV&&ATON.Nav.computeAndRequestDefaultHome(.5,void 0,a)):i.getBoundingSphere(a)&&(t.autocenter?(i.group.position.copy(a.center),i.group.position.multiplyScalar(-1)):void 0===ATON.Nav.homePOV&&ATON.Nav.computeAndRequestDefaultHome(.5,void 0,a))})),i.addEventListener("load-model",(e=>{let o=e.scene;B._numTilesLoaded++,o.traverse((e=>{if(e.layers.enable(t.type),e.isMesh?(e.castShadow=!0,e.receiveShadow=!0,B._bTileBVH&&e.geometry&&(e.geometry.computeVertexNormals(),e.geometry.computeBoundsTree({}),ATON.Utils._bvhBounds>0&&ATON.Utils._addBVHbounds(e,ATON.Utils._bvhBounds)),ATON._bqScene=!0):(s=!0,B._bPCs=!0,e.layers.disable(t.type),e.raycast=ATON.Utils.VOID_CAST,e.material=ATON.MatHub.materials.point),t.userData.cMat&&(e.material=t.userData.cMat),e.material){let t=e.material.map;t&&(t.minFilter=THREE.LinearMipmapLinearFilter,t.magFilter=THREE.LinearFilter,t.colorSpace=ATON._stdEncoding)}})),ATON.fireEvent("TileLoaded",o)})),i.addEventListener("dispose-model",((e,t)=>{ATON.Utils.cleanupVisitor(e.scene),e=null})),s||ATON.Utils.setPicking(t,t.type,!0),B._tsets.push(i)},loadCesiumIONAsset:(e,t)=>{let o=ATON.getAPIToken("cesium.ion");if(null==o&&(console.log("A valid Cesium ION token is required"),o=prompt("Please enter a valid Cesium ION token:"),null==o||""==o))return;let i=new URL(`https://api.cesium.com/v1/assets/${e}/endpoint`);i.searchParams.append("access_token",o),fetch(i,{mode:"cors"}).then((e=>e.ok?e.json():Promise.reject(`${e.status} : ${e.statusText}`))).then((e=>{i=new URL(e.url);const r=i.searchParams.get("v");B.loadTileSetFromURL(i.toString(),t,{accessToken:e.accessToken,v:r}),ATON.setAPIToken("cesium.ion",o)}))},update:()=>{const e=B._tsets.length;if(e<1)return;for(let t=0;t!!ATON.Nav._bControl&&(ATON.Nav._dOri>B.THRES_ORI||ATON.Nav._dPos>B.THRES_POS)};const q=B;let z={};window.ATON=z,z.Node=t,z.POV=class{constructor(e){this.pos=new THREE.Vector3(1,0,0),this.target=new THREE.Vector3(0,0,0),this.up=ATON.STD_UPVECTOR,this.fov=void 0,this.nextPOV=void 0,this.prevPOV=void 0,this.as(e)}as(e){if(void 0!==e)return ATON.Nav.povlist[e]=this,this.id=e,this}setPosition(e,t,o){return e instanceof THREE.Vector3?this.pos.copy(e):this.pos.set(e,t,o),this}setTarget(e,t,o){return e instanceof THREE.Vector3?this.target.copy(e):this.target.set(e,t,o),this}setFOV(e){return this.fov=e,this}addKeywords(e){let t=e.split(",");void 0===this.kwords&&(this.kwords={});for(let e in t){let o=t[e].trim();o.length>0&&(this.kwords[o]=!0)}return this}hasKeyword(e){if(void 0!==this.kwords)return void 0!==this.kwords[e]}setNextPOV(e){if(e)return this.nextPOV=e,this}setPrevPOV(e){if(e)return this.prevPOV=e,this}},z.LightProbe=class{constructor(e,t,o){this.pos=new THREE.Vector3(0,0,0),this._res=void 0!==e?e:128,this._near=void 0!==t?t:1,this._far=void 0!==o?o:ATON.Nav.STD_FAR,this._envtex=void 0,this._CC=void 0,void 0===ATON._pmremGenerator&&(ATON._pmremGenerator=new THREE.PMREMGenerator(ATON._renderer),ATON._pmremGenerator.compileCubemapShader())}setPosition(e,t,o){return e instanceof THREE.Vector3?this.pos.copy(e):this.pos.set(e,t,o),this}setNear(e){return this._near=e,this}setFar(e){return this._far=e,this}_createCCtarget(){this._CCtarget||(this._CCtarget=new THREE.WebGLCubeRenderTarget(this._res,{format:THREE.RGBEFormat,generateMipmaps:!0,minFilter:THREE.LinearMipmapLinearFilter,colorSpace:ATON._stdEncoding}))}update(){return this._envtex&&this._envtex.dispose(),ATON._rootVisibleGlobal.position.set(-this.pos.x,-this.pos.y,-this.pos.z),ATON._render(),this._envtex=ATON._pmremGenerator.fromScene(ATON._mainRoot,0,this._near,this._far).texture,ATON._rootVisibleGlobal.position.set(0,0,0),ATON._renderer.shadowMap.enabled&&ATON._dMainL&&(ATON._dMainL.shadow.needsUpdate=!0),this}getEnvTex(){return this._envtex}assignToNode(e){}},z.XPF=class{constructor(e){this.id=e,this._geom=void 0,this._mesh=void 0,this._pathbaselayer=void 0,this._size=20,this._location=new THREE.Vector3(0,0,0),this._rotation=new THREE.Vector3(0,0,0),this._lnode=ATON.Nav.addLocomotionNode(this._location),this._pathMod=void 0,this._semMasksURLs={},this._semHintURL=void 0}setSize(e){this._size=e}realizeSUI(){return void 0===this._lnode||this._lnode.realizeSUI(),this}realizeGeometry(){return void 0!==this._geom||(this._geom=new THREE.SphereGeometry(1,60,60),this._geom.scale(-this._size,this._size,this._size),this._geom.castShadow=!1,this._geom.receiveShadow=!1,this._mat=new THREE.MeshBasicMaterial({depthTest:!1,depthWrite:!1}),this._mesh=new THREE.Mesh(this._geom,this._mat),this._mesh.frustumCulled=!1,this._mesh.renderOrder=-100),this}getMesh(){return this._mesh}getLocomotionNode(){return this._lnode}setRotation(e,t,o){return e instanceof THREE.Vector3?this._rotation.copy(e):this._rotation.set(e,t,o),void 0===this._mesh||this._mesh.rotation.copy(this._rotation),this}getRotation(){return this._rotation}setLocation(e,t,o){return e instanceof THREE.Vector3?this._location.copy(e):this._location.set(e,t,o),this._lnode&&this._lnode.setLocation(this._location),void 0===this._mesh||this._mesh.position.copy(this._location),this}getLocation(){return this._location}hasGeometry(){return void 0!==this._geom}setPathModifier=e=>(this._pathMod=e,this);updateBaseLayer(){}setBaseLayer(e){if(void 0===e)return this;this._pathbaselayer=ATON.Utils.resolveCollectionURL(e);let t=this;return this._pathMod&&(this._pathbaselayer=this._pathMod(this._pathbaselayer)),this.hasGeometry()?(ATON.Utils.isVideo(this._pathbaselayer)||ATON.Utils.textureLoader.load(t._pathbaselayer,(e=>{e.colorSpace=ATON._stdEncoding,e.generateMipmaps=!0,t._mat.map=e,t._mat.map.needsUpdate=!0,t._mat.needsUpdate=!0,console.log("XPF base layer "+t._pathbaselayer+" loaded")})),this):this}setSemanticMask(e,t){return void 0===e||(this._semMasksURLs[e]=ATON.Utils.resolveCollectionURL(t),ATON.XPFNetwork.updateCurrentXPFsemLayer(this)),this}removeSemanticMask(e){return void 0===e||(this._semMasksURLs[e]=void 0,ATON.XPFNetwork.updateCurrentXPFsemLayer(this)),this}removeAllSemanticMasks(){return this._semMasksURLs={},this}getSemanticMaskURL(e){return this._semMasksURLs[e]}setSemanticHintMap(e){return void 0===e||(this._semHintURL=ATON.Utils.resolveCollectionURL(e),ATON.XPFNetwork.updateCurrentXPFsemLayer(this)),this}removeSemanticHintMap(){return this._semHintURL=void 0,ATON.XPFNetwork.updateCurrentXPFsemLayer(this),this}},z.Flare=class{constructor(e){this._id=void 0,this._bDeployed=!1,e&&this.register(e)}register(e){return e&&(this._id=e),ATON.addFlare(this),this}getID(){return this._id}log(e){return this._id?console.log("[Flare "+this._id+"] "+e):console.log("[Flare]"+e),this}setSetup(e){return this.setup=e,this}setUpdate(e){return this.update=e,this}},z.EventHub=i,z.Utils=n,z.CC=k,z.SceneHub=d,z.MatHub=a,z.Nav=m,z.AudioHub=u,z.XR=T,z.SUI=N,z.UI=A,z.Photon=P,z.SemFactory=f,z.FE=y,z.MediaFlow=M,z.Phygital=C,z.App=D,z.FX=F,z.XPFNetwork=I,z.MRes=q,z.STD_UPVECTOR=new THREE.Vector3(0,1,0),z.ROOT_NID=".",z.RAD2DEG=180/Math.PI,z.DEG2RAD=Math.PI/180,z.PATCH_ADD=0,z.PATCH_DEL=1,z.NTYPES={},z.NTYPES.SCENE=3,z.NTYPES.SEM=4,z.NTYPES.UI=5,z.SHADOWS_NEAR=.1,z.SHADOWS_FAR=50,z.SHADOWS_SIZE=15,z.SHADOWS_RES=1024,z.AMB_L=.2,z.SCALE_DEFAULT=0,z.SCALE_BIG=5,z.SCALE_VERYBIG=10,z.SCALE_SMALL=-5,z.SCALE_VERYSMALL=-10,z.Flares={},z._fReqList=[],z._bInitialized=!1,z._resMappers=[],z.setBaseURL=e=>{z.BASE_URL=e,z.PATH_RESTAPI=`${z.BASE_URL}/api/`,z.PATH_RESTAPI_SCENE=`${z.PATH_RESTAPI}scene/`,z.PATH_RESTAPI2=`${z.BASE_URL}/api/v2/`,z.PATH_WAPPS=`${z.BASE_URL}/a/`,z.PATH_DRACO_LIB=`${z.BASE_URL}/dist/draco/`,z.PATH_BASIS_LIB=`${z.BASE_URL}/dist/basis/`,z.PATH_COLLECTION=`${z.BASE_URL}/collections/`,z.PATH_SCENES=`${z.BASE_URL}/scenes/`,z.PATH_RES=`${z.BASE_URL}/res/`,z.PATH_FE=`${z.BASE_URL}/s/`},z.setBaseURL(window.location.origin),z.setPathCollection=e=>{z.PATH_COLLECTION=e},z.setPathScenes=e=>{z.PATH_SCENES=e},z.setAsStandalone=e=>{e||(e="../"),z.PATH_DRACO_LIB=e+"dist/draco/",z.PATH_BASIS_LIB=e+"dist/basis/",z.PATH_RES=e+"res/"},z.addResourceMapper=e=>{z._resMappers.push(e)},z._onUserInteraction=()=>{z._elPanoVideo&&!z._vpanoPlaying&&z._elPanoVideo.play(),z.XPFNetwork._elVid&&!z.XPFNetwork._vidPlaying&&z.XPFNetwork._elVid.play(),z.AudioHub._listener&&z.AudioHub._listener.context&&"suspended"===z.AudioHub._listener.context.state&&z.AudioHub._listener.context.resume();for(let e in z.MediaFlow._vStreams){let t=z.MediaFlow._vStreams[e].el;t.playing||t.uid||t.play()}},z.checkAuth=(e,t)=>{$.ajax({type:"GET",url:z.PATH_RESTAPI+"user",xhrFields:{withCredentials:!0},dataType:"json",success:o=>{void 0!==o&&o.username?e(o):t&&t()},error:()=>{t&&t()}})},z._setupBaseListeners=()=>{let e,t,o=z._renderer.domElement;window.addEventListener("resize",z._onResize,!1),window.onorientationchange=z._readDeviceOrientationMode,document.addEventListener("fullscreenchange",(e=>{z._bFS=!!document.fullscreenElement,z.fireEvent("Fullscreen",z._bFS),z._bFS?console.log("Now fullscreen"):console.log("Exit fullscreen")})),void 0!==document.hidden?(e="hidden",t="visibilitychange"):void 0!==document.mozHidden?(e="mozHidden",t="mozvisibilitychange"):void 0!==document.msHidden?(e="msHidden",t="msvisibilitychange"):void 0!==document.webkitHidden&&(e="webkitHidden",t="webkitvisibilitychange"),void 0!==e&&document.addEventListener(t,(()=>{if(document[e]){if(z.XR._bPresenting)return;console.log("Suspend"),z.renderPause()}else{if(z.XR._bPresenting)return;console.log("Resume"),z.renderResume()}}),!1),o.addEventListener("mousemove",z._updateScreenMove,!1),o.addEventListener("mousedown",(e=>{1===e.button&&z.fireEvent("MouseMidButton"),2===e.button&&z.fireEvent("MouseRightButton")})),o.addEventListener("wheel",z._onMouseWheel,!1),z._bPointerDown=!1,Hammer(o).on("doubletap",(e=>{z._bPointerDown=!1,z._onUserInteraction(),z.fireEvent("DoubleTap",e.srcEvent)})),Hammer(o).on("tap",(e=>{if(z._bPointerDown=!1,z._onUserInteraction(),z._updateScreenMove(e.srcEvent),z._handleQueries(),z.fireEvent("Tap",e.srcEvent),void 0===z._hoveredUI)return;let t=z.getUINode(z._hoveredUI);t&&t.onSelect&&t.onSelect()})),z.on("DoubleTap",(e=>{z.defaultDoubleTapFromScreenCoords(e)})),z._kModShift=!1,z._kModCtrl=!1,z._bListenKeyboardEvents=!0,window.addEventListener("keydown",(e=>{z._onUserInteraction(),"Shift"===e.key&&(z._kModShift=!0),"Control"===e.key&&(z._kModCtrl=!0),z._bListenKeyboardEvents&&z.fireEvent("KeyPress",e.key)}),!1),window.addEventListener("keyup",(e=>{"Shift"===e.key&&(z._kModShift=!1),"Control"===e.key&&(z._kModCtrl=!1),z._bListenKeyboardEvents&&z.fireEvent("KeyUp",e.key)}),!1),z.on("KeyPress",(e=>{if("+"===e){let e=z.Nav.getFOV()+1;z.Nav.setFOV(e)}if("-"===e){let e=z.Nav.getFOV()-1;z.Nav.setFOV(e)}}))},z._onResize=()=>{if(z.Nav._camera.aspect=window.innerWidth/window.innerHeight,z.Nav._camera.updateProjectionMatrix(),z._renderer.setSize(window.innerWidth,window.innerHeight),z.FX.composer&&(z.FX.composer.setSize(window.innerWidth,window.innerHeight),z.FX.passes[z.FX.PASS_AA])){let e=z.FX.passes[z.FX.PASS_AA].material.uniforms;e&&e.resolution.value.set(1/window.innerWidth,1/window.innerHeight)}console.log("onResize")},z._onMouseWheel=e=>{e.preventDefault(),z.fireEvent("MouseWheel",e.deltaY)},z.focusOn3DView=()=>{z._renderer.domElement.focus()},z._SUIactivation=()=>{const e=z.getUINode(z._hoveredUI);return void 0!==e&&void 0!==e.onSelect&&(e.onSelect(),!0)},z._stdActivation=()=>{if(z._SUIactivation())return;if(!z.Nav._bControl)return;if(void 0!==z.XPFNetwork._semCurr&&z.fireEvent("SemanticMaskSelect",z.XPFNetwork._semCurr),z.XR._bPresenting){if(m.requestTransitionToLocomotionNodeInSightIfAny(z.XR.STD_TELEP_DURATION))return;return"immersive-vr"===z.XR._sessionType&&z.XR.teleportOnQueriedPoint(),void z.FE.playAudioFromSemanticNode(z._hoveredSemNode)}if(z.Nav.isFirstPerson()||z.Nav.isDevOri()){if(m.requestTransitionToLocomotionNodeInSightIfAny(.5))return;if(z.Nav.currentQueryValidForLocomotion()){let e=z._queryDataScene.p,t=z.Nav._vDir,o=new THREE.Vector3(e.x,e.y+z.userHeight,e.z),i=new THREE.Vector3(o.x+t.x,o.y+t.y,o.z+t.z),r=(new z.POV).setPosition(o).setTarget(i).setFOV(z.Nav._currPOV.fov);z.Nav.requestPOV(r,.5)}return}let e=z.getSemanticNode(z._hoveredSemNode);z._queryDataSem&&e?z.Nav.requestPOVbyNode(e,.5):z._queryDataScene&&z.Nav.requestRetarget(z._queryDataScene.p,void 0,.5)},z.defaultDoubleTapFromScreenCoords=e=>{z._updateScreenMove(e),z._handleQueryScene(),z._stdActivation()},z.isFullscreen=()=>z._bFS,z.toggleFullScreen=()=>{document.fullscreenElement?document.exitFullscreen&&document.exitFullscreen():document.documentElement.requestFullscreen()},z.realize=e=>{console.log("Initialize ATON..."),z.Utils.init(),z.Utils.profileDevice(),z._clock=new THREE.Clock(!0),z.bounds=new THREE.Sphere,z._worldScale=1,z._ws=0,z._bFS=!1,z._renderer=new THREE.WebGLRenderer({antialias:!0,alpha:!0}),z._renderer.setSize(window.innerWidth,window.innerHeight),z.Utils.profileRenderingCapabilities(),z._stdpxd=1,z._fps=60,z._dt=.01,z._dtAccum=0,z._dtCount=0,z._avgFPSaccum=0,z._avgFPS=60,z._dRenderBudgetMinFPS=20,z._dRenderBudgetMaxFPS=55,z._bAdaptiveDensity=!0,z._adMin=.4,z._adMax=1.5,z.device.lowGPU&&(z._adMax=1),z._aniMixers=[],z._stdEncoding=THREE.LinearSRGBColorSpace,z._renderer.outputColorSpace=z._stdEncoding,z._renderer.toneMapping=THREE.LinearToneMapping,z._renderer.toneMappingExposure=1,e||z._renderer.setAnimationLoop(z._onFrame),z._maxAnisotropy=z._renderer.capabilities.getMaxAnisotropy(),z.userHeight=1.7,e||document.body.appendChild(z._renderer.domElement);let t=z._renderer.domElement;t.id="idView3D",t.style.outline="none",t.style.border="none",z.UI.init(),z._vpanoPlaying=!1,z._bUserInts=0,z.EventHub.init(),z.MatHub.init(),z._assetsManager={},z._aLoader=new THREE.GLTFLoader,z._numReqLoad=0,z._collMod=void 0,z._ktx2Loader=new THREE.KTX2Loader,z._ktx2Loader.setTranscoderPath(z.PATH_BASIS_LIB),z._ktx2Loader.detectSupport(z._renderer),z._dracoLoader=new THREE.DRACOLoader,z._dracoLoader.setDecoderPath(z.PATH_DRACO_LIB),z._dracoLoader.setWorkerLimit(2),z._dracoLoader.preload(),z._aLoader.setDRACOLoader(z._dracoLoader),z._aLoader.setKTX2Loader(z._ktx2Loader),THREE.DefaultLoadingManager.addHandler(/\.ktx2$/,z._ktx2Loader),z._updRoutines=[],z._pmremGenerator=void 0,z._lps=[],z._bAutoLP=!1,z._envMapInt=1,z._numLPbounces=2,z._lpbCount=0,z._bShadowsFixedBound=!1,z._shadowsFixedBoundCenter=void 0,z._shadowsNear=z.SHADOWS_NEAR,z._shadowsFar=z.SHADOWS_FAR,z._shadowsSize=z.SHADOWS_SIZE,z._shadowsRes=z.SHADOWS_RES,z.initGraphs(),z.SceneHub.init(),z.MRes.init(),z.CC.init(),z.AudioHub.init(),z.Nav.init(),z.XR.init(),z.SUI.init(),z.Photon.init(),z.VRoadcast=z.Photon,z.MediaFlow.init(),z.SemFactory.init(),z.Phygital.init(),z.XPFNetwork.init(),z.device.lowGPU||z.device.isMobile||z.FX.init(),z.FX.composer||(z._render=()=>{z._renderer.render(z._mainRoot,z.Nav._camera)}),z.setDefaultPixelDensity(1),z._queryDataScene=void 0,z._queryDataSem=void 0,z._queryDataUI=void 0,z._hoveredSemNode=void 0,z._hoveredUI=void 0,z._bq=!0,z._bQuerySemOcclusion=!0,z._bQueryNormals=!0,z._bPauseQuery=!1,z._bCenteredQuery=!1,z._bqScene=!1,z._bqSem=!1,z._qSync=0,z._qSyncInt=1,z._tgiDur=void 0,z._tgiPer=void 0,z._tHover=void 0,z._bMainPanoInfinite=!0,z._matMainPano=void 0,z._mMainPano=void 0,z._screenPointerCoords=new THREE.Vector2(0,0),z._rcScene=new THREE.Raycaster,z._rcScene.layers.set(z.NTYPES.SCENE),z._rcScene.firstHitOnly=!0,z._rcSemantics=new THREE.Raycaster,z._rcSemantics.layers.set(z.NTYPES.SEM),z._rcSemantics.firstHitOnly=!0,z._rcUI=new THREE.Raycaster,z._rcUI.layers.set(z.NTYPES.UI),z._rcUI.firstHitOnly=!0,z._setupBaseListeners(),z.device.isMobile&&z._readDeviceOrientationMode(),z._fLoading=0,z._fRequired=z._fReqList.length,z._loadFlares(),z._gizmo=void 0,z._bGizmo=!1,z.focusOn3DView(),z._bInitialized=!0},z.addFlare=e=>{if(void 0===e)return;let t=Object.keys(z.Flares).length,o=e.getID();o?z.Flares[o]=e:z.Flares["F"+t]=e},z.registerFlare=z.addFlare,z.getFlare=e=>z.Flares[e],z.loadScript=(e,t,o)=>{let i=document.createElement("script");i.src=e,i.async=!1,document.head.appendChild(i),t&&(i.onload=t),o&&(i.onerror=o)},z._loadFlare=e=>{z._fLoading++,$.get(z.PATH_RESTAPI2+"flares/"+e,(t=>{let o=t.files;if(o){let t=o.length;for(let i in o)z.loadScript("/flares/"+e+"/"+o[i],(()=>{t--,t<=0&&z._onFlareLoaded(e)}),(()=>{console.log("Missing flare '"+e+"' dependency: "+o[i]),t--,t<=0&&z._onFlareLoaded(e)}))}})).fail((()=>{console.log("Flare "+e+" not found."),z._onFlareError(e)}))},z._loadFlares=()=>{if(z._fRequired<=0)z.fireEvent("AllFlaresReady");else for(let e in z._fReqList)z._loadFlare(z._fReqList[e])},z._onFlareLoaded=e=>{console.log("All deps loaded for flare '"+e+"'"),z._deployNewFlares(),z._fLoading--,z._fLoading<=0&&z._onAllFlaresLoaded()},z._onFlareError=e=>{z._fLoading--,z._fLoading<=0&&z._onAllFlaresLoaded()},z._onAllFlaresLoaded=()=>{console.log("All Flares ready!"),z.fireEvent("AllFlaresReady")},z._deployFlare=e=>{e._bDeployed||(void 0!==e.setup&&e.setup(),void 0!==e.update&&z.addUpdateRoutine(e.update),e._bDeployed=!0)},z._deployNewFlares=()=>{for(let e in z.Flares)z._deployFlare(z.Flares[e])},z.setCollectionPathModifier=e=>{z._collMod=e},z.setTimedGazeDuration=e=>{z._tgiDur=e},z.getTimedGazeProgress=()=>{if(void 0!==z._tgiDur)return z._tgiPer},z.getElapsedTime=()=>z._clock.elapsedTime,z.renderPause=()=>{z._renderer.setAnimationLoop(void 0)},z.renderResume=()=>{z._renderer.setAnimationLoop(z._onFrame)},z._setupLoadManager=()=>{z._loadManager=new THREE.LoadingManager,z._loadManager.onStart=(e,t,o)=>{console.log("Started loading file: "+e+".\nLoaded "+t+" of "+o+" files."),z.fireEvent("NodeRequestFired",e)},z._loadManager.onLoad=()=>{console.log("Loading complete!"),z.fireEvent("AllNodeRequestsCompleted")},z._loadManager.onProgress=(e,t,o)=>{},z._loadManager.onError=e=>{console.log("There was an error loading "+e)}},z.setDefaultPixelDensity=e=>{z._stdpxd=e,z._renderer.setPixelRatio(e),z.FX.composer&&z.FX.composer.setPixelRatio(e),void 0!==z._renderer.xr&&(z.device.isMobile?z._renderer.xr.setFramebufferScaleFactor(z._stdpxd*z.XR.MOBILE_DENSITY_F):z._renderer.xr.setFramebufferScaleFactor(z._stdpxd))},z.resetPixelDensity=()=>{z._renderer.setPixelRatio(z._stdpxd)},z._readDeviceOrientationMode=()=>{90===Math.abs(window.orientation)?(console.log("Landscape Mode"),z.fireEvent("MobileLandscapeMode")):(console.log("Portrait Mode"),z.fireEvent("MobilePortraitMode")),setTimeout(z._onResize,500)},z.snodes={},z.semnodes={},z.uinodes={},z.createSceneNode=e=>new z.Node(e,z.NTYPES.SCENE),z.getSceneNode=e=>{if(void 0!==e)return z.snodes[e]},z.getOrCreateSceneNode=e=>{let t=z.getSceneNode(e);return void 0!==t?t:z.createSceneNode(e)},z.getRootScene=()=>z._rootVisible,z.createSemanticNode=e=>new z.Node(e,z.NTYPES.SEM),z.getSemanticNode=e=>{if(void 0!==e)return z.semnodes[e]},z.getOrCreateSemanticNode=e=>{let t=z.getSemanticNode(e);return void 0!==t?t:z.createSemanticNode(e)},z.getRootSemantics=()=>z._rootSem,z.createUINode=e=>new z.Node(e,z.NTYPES.UI),z.getUINode=e=>{if(void 0!==e)return z.uinodes[e]},z.getRootUI=()=>z._rootUI,z._unpackScale=e=>0==e?1:e>=0?1.1*e:1/(-1.1*e),z.setUserScaleLevel=e=>{z.setWorldScaleLevel(-e)},z.getUserScale=()=>1/z._worldScale,z.setWorldScaleLevel=e=>{void 0===e&&(e=0),e<-127&&(e=127),e>127&&(e=127),z._ws=e;let t=z._unpackScale(e);z._rootVisible.scale.set(t,t,t),z._rootSem.scale.set(t,t,t),N.gLocNodes.scale.set(t,t,t),N.gMeasures.scale.set(t,t,t),z.Photon.avaGroup&&z.Photon.avaGroup.scale.set(t,t,t),z.recomputeSceneBounds();let o=t/z._worldScale;z.Nav._currPOV.pos.x*=o,z.Nav._currPOV.pos.y*=o,z.Nav._currPOV.pos.z*=o,z.Nav._currPOV.target.x*=o,z.Nav._currPOV.target.y*=o,z.Nav._currPOV.target.z*=o,z.Nav.syncCurrCamera(),z.XR._bPresenting&&z.XR.setRefSpaceLocation(z.Nav._currPOV.pos),z._worldScale=t,console.log("World scale: "+t)},z.getWorldScaleLevel=()=>z._ws,z.getWorldScale=()=>z._worldScale,z._assetReqNew=e=>{z._numReqLoad++,z.fireEvent("NodeRequestFired",e)},z._assetReqComplete=e=>{z.fireEvent("NodeRequestCompleted",e),z._numReqLoad--,z._numReqLoad<=0&&z._onAllReqsCompleted()},z._onAllReqsCompleted=()=>{z.recomputeSceneBounds(),z.getRootScene().assignLightProbesByProximity(),z.fireEvent("AllNodeRequestsCompleted"),z._postAllReqsCompleted(),setTimeout((()=>{z.updateLightProbes(),z._renderer.shadowMap.enabled&&z._bShadowsFixedBound&&0===z._aniMixers.length&&(z._dMainL.shadow.autoUpdate=!1,console.log("Lazy shadows"))}),1e3)},z._postAllReqsCompleted=e=>{void 0===e&&(e=z._rootVisible);for(let t in e.children){let o=e.children[t];o&&o.toggle&&(z._postAllReqsCompleted(o),o.toggle(o.visible))}ThreeMeshUI.update()},z.recomputeSceneBounds=e=>{e?z.bounds.union(e):(z.bounds.center.copy(z._rootVisible.getBound().center),z.bounds.radius=z._rootVisible.getBound().radius),z.bounds.radius<=0||(z._renderer.shadowMap.enabled&&(z._rootVisible.traverse((e=>{e.isMesh&&(e.castShadow=!0,e.receiveShadow=!0)})),z.adjustShadowsParamsFromSceneBounds(),z._bShadowsFixedBound&&z.updateDirShadows()),z._bAutoLP&&(void 0===z._lps[0]?z.addLightProbe((new z.LightProbe).setPosition(z.bounds.center).setNear(z.bounds.radius)):z._lps[0].setPosition(z.bounds.center).setNear(z.bounds.radius),console.log("Auto LP")),z.FX.composer&&z.FX.setDOFaperture(1/(30*z.bounds.radius)),z._mMainPano&&z._mMainPano.position.copy(z.bounds.center))},z.registerNodeResourceHandler=(e,t)=>{z._resHandler||(z._resHandler={}),z._resHandler[e]=t,console.log("Registered resource handler '"+e+"'")},z.removeNodeResourceHanlder=e=>{z._resHandler&&z._resHandler[e]&&(z._resHandler[e]=void 0)},z.initGraphs=()=>{z._mainRoot=new THREE.Scene,z._mainRoot.background=new THREE.Color(.7,.7,.7),z._rootVisibleGlobal=new THREE.Scene,z._mainRoot.add(z._rootVisibleGlobal),z._rootVisible=z.createSceneNode().setAsRoot(),z._rootVisibleGlobal.add(z._rootVisible),z._rootSem=z.createSemanticNode().setAsRoot(),z._mainRoot.add(z._rootSem),z._rootUI=z.createUINode().setAsRoot(),z._mainRoot.add(z._rootUI),z.ambLight=new THREE.AmbientLight(new THREE.Color(1,1,1)),z.ambLight.intensity=3,z._rootVisibleGlobal.add(z.ambLight),z.plight=new THREE.PointLight,z.plight.intensity=0,z.plight.decay=.2,z._rootVisibleGlobal.add(z.plight)},z.enablePointLight=()=>{z.plight.intensity=3},z.disablePointLight=()=>{z.plight.intensity=0},z.setBackgroundColor=e=>{z._mainRoot.background=e},z.setFog=(e,t)=>{void 0!==e&&(void 0===t&&(t=200),z._rootVisibleGlobal.fog=new THREE.Fog(e,1,t),z.setBackgroundColor(e))},z.disableFog=()=>{z._rootVisibleGlobal.fog=null},z.setAutoLP=e=>{z._bAutoLP=e},z.setNeutralAmbientLight=e=>{z.ambLight.color=new THREE.Color(e,e,e)},z.addLightProbe=e=>{void 0!==e&&(z._lps.push(e),z.setNeutralAmbientLight(0),void 0!==z.SUI.gLPIcons&&N.addLPIcon(e))},z.getNumLightProbes=()=>z._lps.length,z._updLP=()=>{for(let e in z._lps)z._lps[e].update();z._rootVisible.traverse((e=>{let t=e.userData.LP;void 0!==t&&t instanceof z.LightProbe&&(e.material.envMap=t.getEnvTex(),e.material.envMapIntensity=z._envMapInt,e.material.needsUpdate=!0)}))},z.setLightProbesNumBounces=e=>{e<1||(z._numLPbounces=e)},z.dirtyLightProbes=e=>{void 0===e&&(e=z._numLPbounces),z._lpbCount=e},z.updateLightProbes=()=>{if(!z.XR._bPresenting&&0!==z._lps.length){for(let e=0;e{let t;if(e=z.Utils.resolveCollectionURL(e),void 0===z._mMainPano&&(z._gMainPano=new THREE.SphereGeometry(1,60,60),z._gMainPano.castShadow=!1,z._gMainPano.receiveShadow=!1,z._mMainPano=new THREE.Mesh(z._gMainPano,z._matMainPano),z._mMainPano.frustumCulled=!1,z._mMainPano.renderOrder=-100,z._mMainPano.layers.disable(z.NTYPES.SCENE),z._mMainPano.layers.disable(z.NTYPES.SEM),z._mMainPano.layers.disable(z.NTYPES.UI),z._mMainPano.raycast=z.Utils.VOID_CAST,z.setMainPanoramaRadius(.8*z.Nav.STD_FAR)),z.Utils.isVideo(e)){if(void 0===z._elPanoVideo){let t="",$(t).appendTo("body"),z._elPanoVideo=document.getElementById("idPanoVideo"),z._elPanoVideo.onplaying=()=>{console.log("VideoPano playing"),z._vpanoPlaying=!0},z._elPanoVideo.onpause=()=>{console.log("VideoPano paused"),z._vpanoPlaying=!1},z._elPanoVideo.addEventListener("touchstart",(function(){z._elPanoVideo.play()})),enableInlineVideo(z._elPanoVideo)}t=new THREE.VideoTexture(z._elPanoVideo),t.colorSpace=z._stdEncoding,z._realizeOrUpdateMainPano(t),z.fireEvent("MainPanoVideo")}else{if(e.endsWith(".hdr"))return void(new THREE.RGBELoader).load(e,(e=>{e.minFilter=THREE.LinearMipmapLinearFilter,e.magFilter=THREE.LinearFilter,e.colorSpace=z._stdEncoding,z._realizeOrUpdateMainPano(e),z.fireEvent("MainPanoHDR")}));if(e.endsWith(".exr"))return void(new THREE.EXRLoader).load(e,(e=>{e.minFilter=THREE.LinearMipmapLinearFilter,e.magFilter=THREE.LinearFilter,e.colorSpace=z._stdEncoding,z._realizeOrUpdateMainPano(e),z.fireEvent("MainPanoHDR")}));z.Utils.textureLoader.load(e,(e=>{e.colorSpace=z._stdEncoding,e.generateMipmaps=!0,z._realizeOrUpdateMainPano(e),z.fireEvent("MainPano")}))}},z.playMainPanorama=()=>{z._elPanoVideo&&(z._vpanoPlaying||z._elPanoVideo.play())},z.pauseMainPanorama=()=>{z._elPanoVideo&&z._vpanoPlaying&&z._elPanoVideo.pause()},z.playOrPauseMainPanorama=()=>{z._elPanoVideo&&(z._vpanoPlaying?z._elPanoVideo.pause():z._elPanoVideo.play())},z.stopAndRemoveMainPanorama=()=>{z._elPanoVideo&&(z._vpanoPlaying&&z._elPanoVideo.pause(),z._elPanoVideo.remove(),z._elPanoVideo=void 0,z._vpanoPlaying=!1)},z._realizeOrUpdateMainPano=e=>{if(void 0!==z._matMainPano)return z._matMainPano.map=e,void z.updateLightProbes();z._matMainPano=new THREE.MeshBasicMaterial({map:e,depthTest:!1,depthWrite:!1}),z._mMainPano.material=z._matMainPano,z._bMainPanoInfinite&&(z._mMainPano.onAfterRender=()=>{"immersive-ar"!==z.XR._sessionType&&z.Nav._currPOV&&z._mMainPano.position.copy(z.Nav._currPOV.pos)}),z._rootVisibleGlobal.add(z._mMainPano),z.updateLightProbes()},z.setMainPanoramaRadius=e=>{void 0!==z._gMainPano&&z._gMainPano.scale(-e,e,e)},z.setMainPanoramaRotation=e=>{void 0!==z._mMainPano&&z._mMainPano.rotation.set(0,e,0)},z.setMainPanoramaInfinite=e=>{z._bMainPanoInfinite=e,void 0!==z._mMainPano&&(z._mMainPano.onAfterRender=e?()=>{z.Nav._currPOV&&z._mMainPano.position.copy(z.Nav._currPOV.pos)}:void 0)},z.setMainPanoramaLocation=e=>{z._bMainPanoInfinite||void 0!==z._mMainPano&&z._mMainPano.position.copy(e)},z.setMainLightDirection=e=>{let t=e.clone();t.normalize(),t.x*=.5*z.SHADOWS_FAR,t.y*=.5*z.SHADOWS_FAR,t.z*=.5*z.SHADOWS_FAR,void 0===z._dMainL&&(z._dMainL=new THREE.DirectionalLight(new THREE.Color(1,1,1),1),z._dMainL.castShadow=!1,z._dMainL.intensity=2,z._dMainLtgt=new THREE.Object3D,z._rootVisibleGlobal.add(z._dMainLtgt),z._dMainL.target=z._dMainLtgt,z._rootVisibleGlobal.add(z._dMainL),z._dMainLpos=new THREE.Vector3),z._dMainLdir=t,z._dMainL.position.set(-t.x,-t.y,-t.z),z._renderer.shadowMap.enabled&&(z._dMainL.shadow.needsUpdate=!0),z.toggleMainLight(!0)},z.getMainLightDirection=()=>{if(void 0===z._dMainLdir)return;let e=z._dMainLdir.clone();return e.normalize(),e},z.toggleMainLight=e=>{if(void 0===z._dMainL)return;z._dMainL.visible=e;let t=z._lps.length;e?(t>0?z.setNeutralAmbientLight(0):z.setNeutralAmbientLight(z.AMB_L),z.updateDirShadows()):t>0?z.setNeutralAmbientLight(0):z.setNeutralAmbientLight(z.AMB_L)},z.isMainLightEnabled=()=>void 0!==z._dMainL&&!!z._dMainL.visible,z.setExposure=e=>{z._renderer.toneMappingExposure=e},z.getExposure=()=>z._renderer.toneMappingExposure,z.adjustShadowsParamsFromSceneBounds=()=>{if(void 0===z._dMainL)return;let e=z._rootVisible.getBound().radius,t=z._rootVisible.getBound().center;e<=0||e>=z.SHADOWS_SIZE?(z._bShadowsFixedBound=!1,z._shadowsSize=z.SHADOWS_SIZE):(z._bShadowsFixedBound=!0,z._shadowsFixedBoundCenter=t,z._shadowsSize=1.5*e),z._dMainL.shadow.map&&(z._dMainL.shadow.map.dispose(),z._dMainL.shadow.map=null),z._dMainL.shadow.camera.left=-z._shadowsSize,z._dMainL.shadow.camera.right=z._shadowsSize,z._dMainL.shadow.camera.bottom=-z._shadowsSize,z._dMainL.shadow.camera.top=z._shadowsSize,z._dMainL.shadow.mapSize.width=z._shadowsRes,z._dMainL.shadow.mapSize.height=z._shadowsRes,z._dMainL.shadow.camera.near=z._shadowsNear,z._dMainL.shadow.camera.far=z._shadowsFar;let o=-2e-4*e;o<-.001&&(o=-.001),z._dMainL.shadow.bias=o},z.toggleShadows=e=>{if(void 0!==z._dMainL)if(e){if(z.XR.isPresenting())return;if(z.device.lowGPU)return;z._dMainL.castShadow=!0,z._renderer.shadowMap.enabled=!0,z.device.isMobile?z._renderer.shadowMap.type=THREE.PCFShadowMap:z._renderer.shadowMap.type=THREE.PCFSoftShadowMap,z._rootVisible.traverse((e=>{e.isMesh&&(e.castShadow=!0,e.receiveShadow=!0)})),z.adjustShadowsParamsFromSceneBounds(),z.updateDirShadows(),z._dMainL.shadow.needsUpdate=!0,console.log("Shadows ON")}else z._dMainL.castShadow=!1,z._renderer.shadowMap.enabled=!1,console.log("Shadows OFF")},z.updateDirShadows=()=>{if(void 0===z._dMainLdir)return;if(void 0===z._dMainLpos)return;let e=z._shadowsFixedBoundCenter;void 0===e?(e=z.Nav.getCurrentEyeLocation(),z._dMainLpos.x=e.x+z.Nav._vDir.x*z._shadowsSize,z._dMainLpos.y=e.y+z.Nav._vDir.y*z._shadowsSize,z._dMainLpos.z=e.z+z.Nav._vDir.z*z._shadowsSize):(z._dMainLpos.x=e.x,z._dMainLpos.y=e.y,z._dMainLpos.z=e.z),z._dMainL.position.set(z._dMainLpos.x-z._dMainLdir.x,z._dMainLpos.y-z._dMainLdir.y,z._dMainLpos.z-z._dMainLdir.z),z._dMainLtgt.position.copy(z._dMainLpos)},z._updateEnvironment=()=>{z._renderer.shadowMap.enabled&&(z._bShadowsFixedBound||z.updateDirShadows())},z.setGlobalAudio=(e,t)=>{void 0!==e&&(void 0===t&&(t=!0),e=z.Utils.resolveCollectionURL(e),void 0===z._auMain||null===z._auMain?z._auMain=new THREE.Audio(z.AudioHub._listener):z._auMain.isPlaying&&z._auMain.stop(),z.AudioHub._loader.load(e,(e=>{z._auMain.setBuffer(e),z._auMain.setLoop(t),z._auMain.play()})))},z._markFPS=()=>{z._numReqLoad>0||z._dt<0||(z._dtCount+=1,z._dtAccum+=z._dt,z._dtAccum<1||(z._fps=1/(z._dtAccum/z._dtCount),z._dtCount=0,z._dtAccum=0,z._handleDynamicRenderProfiles()))},z.toggleAdaptiveDensity=e=>{z._bAdaptiveDensity=e},z.setAdaptiveDensityRange=(e,t)=>{e>=t||(z._adMin=e,z._adMax=t)},z.setDynamicRenderingFPS=(e,t)=>{e>=t||(e&&(z._dRenderBudgetMinFPS=e),t&&(z._dRenderBudgetMaxFPS=t))},z._handleDynamicRenderProfiles=()=>{let e=z._renderer.getPixelRatio();z._fps=z._adMin&&(z._renderer.setPixelRatio(e),z.FX.composer&&z.FX.composer.setPixelRatio(e),console.log("Density: "+e.toPrecision(2)))),z.fireEvent("RequestLowerRender")),z._fps>z._dRenderBudgetMaxFPS&&(z._bAdaptiveDensity&&!z.XR._bPresenting&&(e+=.1,e<=z._adMax&&(z._renderer.setPixelRatio(e),z.FX.composer&&z.FX.composer.setPixelRatio(e),console.log("Density: "+e.toPrecision(2)))),z.fireEvent("RequestHigherRender"))},z._onFrame=()=>{z._dt=z._clock.getDelta(),z._markFPS(),z.XR._bPresenting?z.XR.update():z.Nav._controls.update(z._dt),z._handleQueries(),z.Nav.update(),z.Photon.update(),z.SUI.update(),z.MatHub.update(),z._updateEnvironment(),z._updateAniMixers(),z._updateRoutines(),z.MRes.update(),z.XPFNetwork.update(),z._render()},z._render=()=>{!z.FX.composer||z.XR._bPresenting?z._renderer.render(z._mainRoot,z.Nav._camera):z.FX.composer.render()},z.addUpdateRoutine=e=>{void 0!==e&&z._updRoutines.push(e)},z.deleteAllUpdateRoutines=()=>{z._updRoutines=[]},z._updateRoutines=()=>{let e=z._updRoutines.length;if(!(e<=0))for(let t=0;t{let e=z._aniMixers.length;if(!(e<1))for(let t=0;t{e.preventDefault&&e.preventDefault(),z._bCenteredQuery||(z._screenPointerCoords.x=e.clientX/window.innerWidth*2-1,z._screenPointerCoords.y=-e.clientY/window.innerHeight*2+1)},z.toggleCenteredQuery=e=>{z._bCenteredQuery=e,e&&(z._screenPointerCoords.x=0,z._screenPointerCoords.y=0)},z.toggleQueries=e=>{z._bq=e},z._registerRCS=()=>{z._rcRR=0,z._rcHandlers=[],z._rcHandlers.push(z._handleQueryScene),z._rcHandlers.push(z._handleQuerySemantics),z._rcHandlers.push(z._handleQueryUI)},z._handleQueries=()=>{if(!z._bq)return;if(z._bPauseQuery)return;if(z.Nav._bInteracting)return;if(z._numReqLoad>0)return;if(z.Nav.isTransitioning())return;if(z._handleQueryUI(),z._bqScene&&z._handleQueryScene(),z._bqSem&&z._handleQuerySemantics(),z.Nav._bLocValidator&&z.Nav.locomotionValidator(),void 0===z._tgiDur)return;if(void 0===z._tHover)return;const e=z._clock.elapsedTime-z._tHover;e>=z._tgiDur?(z._stdActivation(),z._tHover=void 0,z._tgiPer=void 0):z._tgiPer=e/z._tgiDur},z._handleQueryScene=()=>{if(z.XR.isPresenting()?z.XR.setupQueryRay(z._rcScene):z._rcScene.setFromCamera(z._screenPointerCoords,z.Nav._camera),z._hitsScene=[],z._rcScene.intersectObjects(z._mainRoot.children,!0,z._hitsScene),z._hitsScene.length<=0)return void(z._queryDataScene=void 0);const e=z._hitsScene[0];z._queryDataScene={},z._queryDataScene.p=e.point,z._queryDataScene.d=e.distance,z._queryDataScene.o=e.object,z._queryDataScene.uv=e.uv,z._bQueryNormals&&e.face&&e.face.normal&&(z._queryDataScene.matrixWorld=(new THREE.Matrix3).getNormalMatrix(e.object.matrixWorld),z._queryDataScene.n=e.face.normal.clone().applyMatrix3(z._queryDataScene.matrixWorld).normalize())},z.getSceneFocalPoint=()=>{if(void 0===z._queryDataScene)return;let e=z._queryDataScene.p,t=new THREE.Vector3;return t.lerpVectors(e,z.Nav._currPOV.pos,.02),t},z.getSceneQueriedPoint=()=>{if(void 0!==z._queryDataScene)return z._queryDataScene.p},z.getSceneQueriedDistance=()=>{if(void 0!==z._queryDataScene)return z._queryDataScene.d},z.getSceneQueriedNormal=()=>{if(void 0!==z._queryDataScene)return z._queryDataScene.n},z.getSceneQueriedObjectName=()=>{if(void 0!==z._queryDataScene&&void 0!==z._queryDataScene.o)return z._queryDataScene.o.name},z.getSceneQueriedUV=()=>{if(void 0!==z._queryDataScene)return z._queryDataScene.uv},z.setQueryRange=(e,t,o)=>{void 0!==o&&o!==z.NTYPES.SCENE||(z._rcScene.near=e,z._rcScene.far=t),void 0!==o&&o!==z.NTYPES.SEM||(z._rcSemantics.near=e,z._rcSemantics.far=t)},z._handleQuerySemantics=()=>{if(z.XR.isPresenting()?z.XR.setupQueryRay(z._rcSemantics):z._rcSemantics.setFromCamera(z._screenPointerCoords,z.Nav._camera),z._hitsSem=[],z._rcSemantics.intersectObjects(z._mainRoot.children,!0,z._hitsSem),z._hitsSem.length<=0){if(z._queryDataSem=void 0,z._hoveredSemNode){z.fireEvent("SemanticNodeLeave",z._hoveredSemNode);let e=z.getSemanticNode(z._hoveredSemNode);e&&e.onLeave&&e.onLeave()}return z._hoveredSemNode=void 0,void(z._tHover=void 0)}const e=z._hitsSem[0];if(z._bQuerySemOcclusion&&z._queryDataScene&&z._queryDataScene.d{if(z.XR.isPresenting()?z.XR.setupQueryRay(z._rcUI):z._rcUI.setFromCamera(z._screenPointerCoords,z.Nav._camera),z._hitsUI=[],z._rcUI.intersectObjects(z._mainRoot.children,!0,z._hitsUI),z._hitsUI.length<=0){if(z._queryDataUI=void 0,z._hoveredUI){z.fireEvent("UINodeLeave",z._hoveredUI);const e=z.getUINode(z._hoveredUI);e&&e.onLeave&&e.onLeave()}return z._hoveredUI=void 0,void(z._tHover=void 0)}const e=z._hitsUI[0];if(z._queryDataScene&&z._queryDataScene.d{if(void 0!==z._hoveredSemNode)return z.getSemanticNode(z._hoveredSemNode)},z.setAPIToken=(e,t)=>{window.sessionStorage.setItem("ATON.tokens."+e,t)},z.getAPIToken=e=>window.sessionStorage.getItem("ATON.tokens."+e),z.clearToken=e=>{window.sessionStorage.removeItem("ATON.tokens."+e)},z.useGizmo=e=>{z._bGizmo=e,z._setupGizmo()},z._setupGizmo=()=>{z._bGizmo?void 0!==z.Nav._camera&&void 0!==z._renderer&&(void 0===z._gizmo?(z._gizmo=new THREE.TransformControls(z.Nav._camera,z._renderer.domElement),z._rootUI.add(z._gizmo),z._gizmo.setMode("rotate"),z._gizmo.addEventListener("dragging-changed",(function(e){let t=e.value;z.Nav.setUserControl(!t),z._bPauseQuery=t,t||(z.recomputeSceneBounds(),z.updateLightProbes(),console.log(z._gizmo.object))}))):(z._gizmo.camera=z.Nav._camera,z._gizmo.detach())):z._gizmo&&z._gizmo.detach()}})(); \ No newline at end of file diff --git a/public/examples/ui-basic/index.html b/public/examples/ui-basic/index.html index 6f82876a..ae7cfe54 100644 --- a/public/examples/ui-basic/index.html +++ b/public/examples/ui-basic/index.html @@ -39,10 +39,11 @@ ATON.UI.showModal({ header: "Sample Modal", - body: ATON.UI.createTabGroup({ + body: ATON.UI.createTabsGroup({ items: [ { title: "Tab1", + icon: "settings", content: ATON.UI.createButton({ variant:"primary", text:"click me", @@ -52,13 +53,14 @@ }, { title: "Tab2", - content: "This is a sample text for this second tab" + icon: "layers", + content: "This is a sample text for this second tab. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec congue viverra diam vitae maximus. Pellentesque a placerat lacus, interdum feugiat est. Proin non suscipit elit. Aliquam erat volutpat. Integer lobortis gravida venenatis. Nulla turpis eros, eleifend vel neque in, molestie pulvinar libero. Nunc sapien ex, tincidunt vel malesuada sit amet, elementum sit amet libero.Phasellus nec neque et lectus rhoncus tristique at ullamcorper justo. Maecenas venenatis elementum urna, non dignissim urna bibendum a. Nunc odio tortor, blandit in sodales vel, lacinia in augue. Aliquam quis sagittis turpis. Suspendisse eget mollis ex. Aenean lacinia laoreet viverra. In volutpat nisi sagittis, semper nisi et, fermentum lectus. Nunc vel eros nec diam pulvinar gravida. Sed quis auctor turpis. Suspendisse et nulla ipsum. Fusce non consequat diam. Mauris risus lacus, placerat sit amet dui nec, interdum consectetur turpis. Integer ut lobortis dolor, sed convallis est." } ] }) }); /* - let test = ATON.UI._createElemementFromHTMLString(` + let test = ATON.UI.createElemementFromHTMLString(`
    TEST
    diff --git a/public/res/css/main.css b/public/res/css/main.css index fc7ae0a0..5a7c031b 100644 --- a/public/res/css/main.css +++ b/public/res/css/main.css @@ -170,4 +170,10 @@ canvas:active { width: 32px; height: 32px; margin-right: 5px; +} + +.aton-tab img { + width: 18px; + height: 18px; + margin-right: 5px; } \ No newline at end of file diff --git a/public/src/ATON.ui.js b/public/src/ATON.ui.js index 2639d07a..6a021c7f 100644 --- a/public/src/ATON.ui.js +++ b/public/src/ATON.ui.js @@ -297,6 +297,11 @@ UI.loadPartial = (src, parentid, bPrepend, onComplete)=>{ }); }; +UI.resolveIconURL = (icon)=>{ + if (icon.includes("/")) return icon; + return UI.PATH_RES_ICONS + icon+".png"; +}; + /*=============================== Items ===============================*/ @@ -321,10 +326,7 @@ UI.createButton = (options)=>{ if (options.text) el.innerText = options.text; if (options.icon){ - let iconsrc = UI.PATH_RES_ICONS + options.icon+".png"; - if (options.icon.includes("/")) iconsrc = options.icon; // a path is given - - el.prepend( UI.createElemementFromHTMLString("")); + el.prepend( UI.createElemementFromHTMLString("")); } if (options.onpress) el.onclick = options.onpress; @@ -333,19 +335,19 @@ UI.createButton = (options)=>{ }; /** -Create a tab group. -- options.items: an array of objects (tabs) with "title" (string) and "content" (DOM element) properties. +Create a tabs group. +- options.items: an array of objects (tabs) with "title" (string) and "content" (DOM element) properties. An optional "icon" can also be assigned per tab @param {object} options - UI options object @returns {HTMLElement} */ -UI.createTabGroup = (options)=>{ +UI.createTabsGroup = (options)=>{ let baseid = ATON.Utils.generateID("tabgroup"); let el = document.createElement('div'); let eltabs = document.createElement('ul'); - eltabs.classList.add("nav","nav-tabs","nav-justified"); + eltabs.classList.add("nav","nav-justified","nav-tabs"); // "nav-underline" eltabs.setAttribute("role","tablist"); let eltabcontent = document.createElement('div'); @@ -360,6 +362,10 @@ UI.createTabGroup = (options)=>{ let tabtitle = e.title; let tabcontent = e.content; + let icon = e.icon; + + let icontab = ""; + if (icon) icontab = ""; let tabid = baseid+"-"+tabtitle; @@ -368,9 +374,9 @@ UI.createTabGroup = (options)=>{ eltab.setAttribute("role","presentation"); if (i===0) - eltab.innerHTML = ""; + eltab.innerHTML = ""; else - eltab.innerHTML = ""; + eltab.innerHTML = ""; eltabs.append(eltab);