-
Notifications
You must be signed in to change notification settings - Fork 0
/
oorbitvr-a1.3.1-min16.js
78 lines (65 loc) · 200 KB
/
oorbitvr-a1.3.1-min16.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
AFRAME.registerSystem("oorbit",{schema:{hasCursor:{type:"boolean",default:!0},hasPhysics:{type:"boolean",default:!0},has3DMenu:{type:"boolean",default:!0},hasARMenu:{type:"boolean",default:!1},has2DMenu:{type:"boolean",default:!0},hasIntro:{type:"boolean",default:!1},hasLogos:{type:"boolean",default:!1},cursorColor:{type:"color",default:"white"},loadingColor:{type:"color",default:"green"},menuColor:{type:"color",default:"#2EF9FF"},textColor:{type:"color",default:"black"},buttonColor:{type:"color",default:"#493889"},buttonDetailColor:{type:"color",default:"white"},questionColor:{type:"color",default:"#493889"},controlCollider:{type:"boolean",default:!0},targetClass:{type:"string",default:"mclickable",oneOf:["any","mclickable","aclickable","qclickable"]},targets:{type:"array",default:["[hoverable]","[grabbable]","[clickable]","[stretchable]","[draggable]","[droppable]","[pinchable]","[collidable]","[selectable]","[turnable]"]},hoverTime:{type:"int",default:4e3},showRay:{type:"boolean",default:!0},hasZoom:{type:"boolean",default:!0},cursorZoom:{type:"boolean",default:!0},cursorFly:{type:"boolean",default:!1},turnAxis:{type:"string",default:"x",oneOf:["x","y","z"]},precision:{type:"int",default:3}},init:function(){o=this,this.icons=[],this.stream,this.media=[],this.questions=[],this.dur=[],this.results=[0,0],this.form=[],this.wasPlaying=[],this.timeline={},this.baseline=[],this.environment={},this.physics={},this.delay=0,this.run=0,this.last,this.end,this.replay,this.offset=.005,this.timeout1=0,this.clicking,this.selected=[],this.zoom=[1,0],this.multi,this.econtrol=document.createElement("a-entity"),this.ARwires={all:[]},this.usedPins=[],this.audioCtx,this.triggers=[],this.geo=[],this.iframe={owner:"",source:"",origin:"",firstMsg:!1,newMsg:!1},this.mode=mode||"g10",this.status=0,this.permissions={gyro:!1,vr:!1,ar:!1,mic:!1,vid:!1,micmute:!1,vidmute:!1,gps:!1,fix:!1,msg:!1,mute:!1,sios:!1},this.collisionGroups={any:1,mclickable:2,qclickable:4,aclickable:8},this.sceneEl.setAttribute("vr-mode-ui","enabled",!1),this.sceneEl.setAttribute("loading-screen","enabled",!1),this.sceneEl.setAttribute("device-orientation-permission-ui","enabled",!1),this.sceneEl.setAttribute("keyboard-shortcuts","enterVR",!1),this.corrections(),this.checkMode(this.mode),this.inIframe()&&this.msgSystem(),this.loadLogos(),this.showIntro(),this.loader(),this.oorbitComponents(),this.loadsvgs(),this.mod={},this.loading={},this.crypto(),$("script[src*='physics-system']").length&&AFRAME.components["ammo-body"]||(this.data.hasPhysics=!1),this.data.hasPhysics?this.setupPhysics():this.sceneEl.removeAttribute("physics"),this.setupCursor(),this.clickListener(),this.setupControllers(),this.setupTurnBtn(),this.sceneEl.addEventListener("loaded",function(){for(console.log("scene Loaded"),o.lights=document.querySelectorAll("[light]"),o.camera=document.querySelector("a-camera"),o.canvas=o.sceneEl.querySelector("canvas"),o.cameraRig=document.querySelector("#cameraRig"),o.dim3=document.getElementById("dim3"),o.dim2=document.getElementById("dim2"),o.wires=document.getElementById("wires"),dev&&(this.removeAttribute("inspector"),this.setAttribute("inspector","https://unpkg.com/[email protected]/dist/aframe-inspector.min.js"),THREE.Math=THREE.MathUtils),o.data.hasARMenu&&(o.translator(ARstate),o.loadAR(),o.loadARMenu()),o.setupCamera(),o.zoom[1]=o.camera.components.camera.camera.fov,o.navigation(),o.permissions.fix&&o.camera.setAttribute("look-controls","enabled",!1),null!=questions&&Object.assign(o.questions,questions),o.setupEnvironment(),i;i<$("[ammo-body]").length;i++)$("[ammo-body]")[i].emit("physics");o.multi&&o.setupOnline(),null!=timeline&&Object.assign(o.timeline,timeline),o.registerIniState(),document.addEventListener("visibilitychange",function(){o.menu3DIsOpenOpen||3!=o.status||($("#playmsg").show(),o.sessionHandler("pause"))}),document.addEventListener("keydown",e=>{if("m"==e.key)o.pauseSession(),o.toggleMenu(o.status<=2);else if("n"==e.key){if(!o.sceneEl.components.stats)return;$(".rs-base").hasClass("a-hidden")?o.sceneEl.components.stats.show():o.sceneEl.components.stats.hide()}else e.key}),window.addEventListener("wheel",e=>{o.setZoom(-Math.sign(e.wheelDelta),e.clientX,e.clientY)}),hide&&0!=o.status&&$("#mode2D").click()}),this.sceneEl.addEventListener("stateremoved",function(e){"vr-mode"===e.detail||e.detail,("grabbed"===e.detail||"dragged"===e.detail)&&o.sceneEl.is("2d-mode")&&!o.permissions.fix&&o.camera.setAttribute("look-controls","enabled",!0)}),this.sceneEl.addEventListener("stateadded",function(e){("grabbed"===e.detail||"dragged"===e.detail)&&o.sceneEl.is("2d-mode")&&!AFRAME.utils.device.isMobile()&&o.camera.setAttribute("look-controls","enabled",!1)}),this.sceneEl.addEventListener("arReady",function(){console.log($("video")),console.log("arReady")}),this.sceneEl.addEventListener("arError",function(){console.log("arError")}),this.sceneEl.addEventListener("ended",function(){console.log("ended"),o.sessionHandler(7)},{once:!0}),window.onresize=function(){o.setupTurnBtn(),this.orientation}},update:function(e){if(o.status<1)return;let s=AFRAME.utils.diff(e,this.data);(s.targets||s.showRay)&&this.changeRaycaster()},tick:(new THREE.Vector3,function(e,s){if(null!=o.timeline.pre&&5!=this.status&&(this.timeline.pre(),delete this.timeline.pre),0!=this.run&&jQuery.isEmptyObject(this.timeline)&&!jQuery.isEmptyObject(timeline))return this.sceneEl.emit("ended");5==this.status?this.delay=e:3!=this.status?this.delay+=s:this.run=e-this.delay,0!=this.run&&null!=this.timeline.ini&&(this.timeline.ini(),delete this.timeline.ini);let n=(this.run/1e3).toFixed(1);null==this.timeline[n]||this.last==n||(this.last=n,this.timeline[n]()||delete this.timeline[n]),(document.fullscreenElement||document.webkitFullscreenElement||document.msFullscreenElement)&&"fullscreen_exit"!=$("#fsc").text()?$("#fsc").text("fullscreen_exit"):document.fullscreenElement||document.webkitFullscreenElement||document.msFullscreenElement||"fullscreen"==$("#fsc").text()||$("#fsc").text("fullscreen"),this.menuSphere&&this.menuSphere.object3D.position.copy(this.camera.object3D.position),this.status<3&&1.6!=this.camera.object3D.position.y&&0!=this.camera.object3D.position.y&&!this.dof6height&&(this.cameraRig.object3D.position.y+=1.6-this.camera.object3D.position.y,this.dof6height=!0),AFRAME.utils.device.isIOS()&&o.camera&&1.6!=o.camera.getAttribute("position").y&&o.camera.setAttribute("position","0 1.6 0"),(7==o.status||8==o.status)&&(o.dur[o.dur.length-1]+=s)}),checkMode:function(e){let s=e.charAt(0),n=e.charAt(1),a=e.charAt(2),r=e.slice(-2),l=[];if(AFRAME.utils.device.isIOS()&&(l.push("sios"),this.permissions.mute=!0,this.permissions.sios=!1),this.permissions.mic=medias.audio,medias.video||(this.permissions.vid=!0),this.toggleButtons("2D"),geo&&($("#buttons").css("opacity",0),$("#buttons").css("z-index",-10)),$("#warnings").length&&(AFRAME.utils.device.isMobile()?$("#warnings p").last().show():$("#warnings p").last().hide()),geo&&l.push("gps"),"f"==s&&(this.permissions.fix=!0),0==n)$("#mode2D").html("Iniciar"),("g"==s||"r"==s||"w"==s||"c"==s)&&(l.push("gyro"),this.setIcons(l,"Para efeito 360 os c\xedrculos abaixo precisam estar verdes.")),geo&&(l.push("geo"),this.setIcons(l,"Para iniciar os c\xedrculos abaixo precisam estar verdes."));else if(6==n)switch($("#multi").css("display","flex"),this.multi=!0,a=master?0:"spectator"==userType?1:2){case 0:l.push("mic","video"),this.setIcons(l,"Voc\xea \xe9 o l\xedder do grupo,para usar \xe1udio e v\xeddeo os \xedcones abaixo precisam estar verdes.");break;case 1:l.push("mic","video"),this.setIcons(l,"Voc\xea \xe9 espectador do grupo,para usar \xe1udio e v\xeddeo os \xedcones abaixo precisam estar verdes.");break;default:l.push("vr","gyro","mic"),this.setIcons(l,"Para realidade virtual em grupo os c\xedrculos abaixo precisam estar verdes.")}else if(7==n)switch($("#multi").css("display","flex"),this.multi=!0,a=master?0:"spectator"==userType?1:2){case 0:l.push("mic"),this.setIcons(l,"Voc\xea \xe9 o l\xedder do grupo,para usar \xe1udio o \xedcone abaixo precisa estar verde.");break;case 1:l.push("mic"),this.setIcons(l,"Voc\xea \xe9 espectador do grupo,para usar \xe1udio o \xedcone abaixo precisa estar verde.");break;default:l.push("vr","gyro","mic"),this.setIcons(l,"Para realidade virtual em grupo os c\xedrculos abaixo precisam estar verdes.")}else 8==n?0==a||1==a||5==a||7==a?(l.push("ar"),this.setIcons(l,"Para realidade aumentada o c\xedrculo abaixo precisa estar verde.")):2==a||6==a||8==a?($("#multi").css("display","flex"),this.multi=!0,l.push("ar","mic"),this.setIcons(l,"Para realidade aumentada em grupo os c\xedrculos abaixo precisam estar verdes.")):4==a?($("#multi").css("display","flex"),this.multi=!0,geo?l.push("ar","mic"):l.push("ar","mic","gps"),this.setIcons(l,"Para realidade aumentada com GPS em grupo os c\xedrculos abaixo precisam estar verdes.")):3==a&&(geo?l.push("ar"):l.push("ar","gps"),this.setIcons(l,"Para realidade aumentada com GPS os c\xedrculos abaixo precisam estar verdes.")):(10==r||20==r||30==r||40==r||50==r||90==r)&&(l.push("gyro","vr"),this.setIcons(l,"Para realidade virtual os c\xedrculos abaixo precisam estar verdes."))},toggleButtons:function(e){if("2D"==e){$("#mode2D").is(":hidden")&&($("#mode2D").css("display","inline-block"),$("#buttons").css("align-items","center"),this.buttonClick($("#mode2D"),"2d-mode"));return}"VR"==e?$("#modeVR").is(":hidden")&&($("#modeVR").css("display","inline-block"),this.buttonClick($("#modeVR"),"vr-mode")):"AR"==e&&$("#modeAR").is(":hidden")&&(0==this.mode.charAt(2)&&this.sceneEl.setAttribute("vr-mode-ui",{enabled:!0,enterARButton:"#modeAR"}),$("#modeAR").css("display","inline-block"),$("#modeAR").removeClass("a-hidden"),this.buttonClick($("#modeAR"),"ar-mode")),this.buttonClick($("#buttonError"),"2d-mode"),$("#mode2D").hide(),$("#buttons").css("align-items","baseline"),$("#buttonError").show()},setIcons:function(e,s){for(null!=$("#sub")[0]&&$("#sub").css("display","flex"),this.icons=e,i=0;i<e.length;i++)switch($("#"+e[i]).css("background-color","red"),$("#"+e[i]).css("display","flex"),e[i]){case"sios":o.siosAllow(),$("#"+e[i]).on("click",()=>{o.siosAllow(!0)});break;case"gyro":o.gyroAllow(),$("#"+e[i]).on("click",()=>{o.gyroAllow()});break;case"vr":o.vrAllow("vr"),$("#"+e[i]).on("click",()=>{o.vrAllow("vr")});break;case"ar":o.streamAllow("ar"),$("#"+e[i]).on("click",e=>{o.streamAllow("ar",e)});break;case"mic":this.permissions[e[i]]?o.toggleIcons(e[i],!0):o.streamAllow("mic"),$("#"+e[i]).on("click",e=>{o.streamAllow("mic",e)});break;case"vid":this.permissions[e[i]]?o.toggleIcons(e[i],!0):o.streamAllow("vid"),$("#"+e[i]).on("click",e=>{o.streamAllow("vid",e)});break;case"gps":$("#"+e[i]).on("click",e=>{o.gpsAllow("gps",e)})}null!=$("#hint h4")[0]&&$("#hint h4").html(s)},toggleIcons:function(e,s){if(!$("#"+e)[0]||!$("#advice")[0])return;let n,a,r;switch(e){case"sios":n="Auto falante liberado.",a="volume_up",r="Auto falante bloqueado.";break;case"gyro":n="Seu girosc\xf3pio est\xe1 liberado.",a="mobile_friendly",r="Girosc\xf3pio bloqueado ou inexistente.";break;case"vr":n="\xc9 compat\xedvel com Realidade Virtual.",a="visibility",r="N\xe3o \xe9 compat\xedvel com Realidade Virtual.";break;case"ar":n="\xc9 compat\xedvel com Realidade Aumentada.",a="photo_camera",r="N\xe3o \xe9 compat\xedvel com Realidade Aumentada.";break;case"mic":n="Microfone liberado.",a="mic",r="Microfone bloqueado ou inexistente.";break;case"vid":n="C\xe2mera liberada.",a="videocam",r="C\xe2mera bloqueada ou inexistente.";break;case"gps":n="Seu local est\xe1 liberado.",a="my_location",r="GPS bloqueado ou inexistente."}s?($("#"+e).html(a),$("#"+e).css("background-color","forestgreen"),"vid"==e||"mic"==e||($("#"+e).off("click"),$("#"+e).on("click",()=>{$("#advice").html(n)})),this.permissions[e]=!0,$("#advice").html(n)):($("#"+e).css("background-color","red"),$("#advice").html(r),("vid"==e||"mic"==e)&&$("#"+e).html(a+"_off")),this.permissions.gyro&&this.permissions.vr&&this.toggleButtons("VR"),this.permissions.ar&&this.toggleButtons("AR")},gyroAllow:function(){window.addEventListener("devicemotion",function(e){(e.rotationRate.alpha||e.rotationRate.beta||e.rotationRate.gamma)&&(o.permissions.gyro=!0)}),window.DeviceMotionEvent&&"function"==typeof window.DeviceMotionEvent.requestPermission?DeviceMotionEvent.requestPermission().then(e=>{"granted"==e&&o.toggleIcons("gyro",!0)}).catch(function(e){o.toggleIcons("gyro")}):AFRAME.utils.device.isMobile()?window.DeviceMotionEvent?o.toggleIcons("gyro",!0):o.toggleIcons("gyro"):this.permissions.vr||AFRAME.utils.device.checkHeadsetConnected()?o.vrAllow("gyro"):o.toggleIcons("gyro")},vrAllow:function(e){"xr"in window.navigator?navigator.xr.isSessionSupported?navigator.xr.isSessionSupported("immersive-vr").then(function(s){AFRAME.utils.device.checkHeadsetConnected()?o.toggleIcons(e,!0):o.toggleIcons(e)}).catch(function(s){o.toggleIcons(e)}):navigator.xr.supportsSession&&navigator.xr.supportsSession("immersive-vr").then(function(s){AFRAME.utils.device.checkHeadsetConnected()?o.toggleIcons(e,!0):o.toggleIcons(e)}).catch(function(s){o.toggleIcons(e)}):navigator.getVRDisplays().then(s=>s.length>0?o.toggleIcons(e,!0):o.toggleIcons(e))},siosAllow:function(e){if(!e)return this.toggleIcons("sios");this.permissions.mute?(this.sessionHandler("mute"),this.toggleIcons("sios",!0),this.permissions.sios=!0):this.toggleIcons("sios",!0)},streamAllow:function(e,s){if(console.log(this.permissions,e),this.permissions[e]&&"ar"!=e){this.permissions[e+"mute"]?(o.toggleIcons(e,!0),this.permissions[e+"mute"]=!1):(o.toggleIcons(e),this.permissions[e+"mute"]=!0);return}return navigator.mediaDevices&&navigator.mediaDevices.getUserMedia?s?void o.getMedia(e):o.checkDevicesPermission(e):o.toggleIcons(e)},getMedia(e){let s={};if("ar"==e){if(0==o.mode.charAt(2)&&!AFRAME.utils.device.checkARSupport())return o.toggleIcons(e);s={video:{facingMode:"environment",width:{max:4619},height:{ideal:720,max:1080}}},navigator.mediaDevices.getUserMedia(s).then(s=>{null!=o.stream?o.stream.addTrack(s.getTracks()[0]):o.stream=s,o.toggleIcons(e,!0)}).catch(s=>{o.toggleIcons(e)})}},checkDevicesPermission:async function(e){let s=await navigator.mediaDevices.enumerateDevices();for(i=0;i<s.length;i++){let n="audioinput";if("mic"!=e&&(n="videoinput"),s[i].kind==n){if(!s[i].deviceId||""==s[i].deviceId)return o.toggleIcons(e);o.getMedia(e);return}}},gpsAllow:function(){navigator.geolocation?navigator.geolocation.getCurrentPosition(function(e){0==o.geo.length&&geo&&(o.toggleIcons("gps",!0),$("#buttons").css("opacity",1),$("#buttons").css("z-index",""),o.geo.push(e.coords.latitude),o.geo.push(e.coords.longitude))},function(e){o.toggleIcons("gps")}):o.toggleIcons("gps")},buttonClick(e,s){e[0].addEventListener("click",function(e){if(AFRAME.utils.device.isIOS()&&!o.permissions.sios){e.target.style.color="#F6F5F9",e.target.style.backgroundImage="linear-gradient(to bottom , #493889, #7963ba, #493889)",e.target.removeEventListener("click",function(){}),o.buttonClick([e.target],s);return}if(1==o.status){if(o.multi){$("#loader").empty(),$("#av-pick").attr("mode",s),$("#av-pick").css("display","flex");return}if($("a-scene canvas").hide(),$("#overlay").hide(),o.changeMode(s),hide||o.startMedia(),o.tryKeepScreenAlive(10),o.sessionHandler(2),o.econtrol.getAttribute("econtrol").groundPhysics&&o.data.hasPhysics){let n=o.econtrol.components.econtrol.ground;n.components["ammo-body"].isLoaded?(n.removeAttribute("ammo-shape"),n.setAttribute("ammo-shape","type","mesh")):o.econtrol.addEventListener("body-loaded",function(){n.removeAttribute("ammo-shape"),n.setAttribute("ammo-shape","type","mesh")})}}},{once:!0})},changeMode:function(e){if(3==this.status&&(this.pauseSession(),$("#playmsg").show()),e=e.toLowerCase(),$("#oo").hide(),$("#zoom-btn").hide(),$("ar").hide(),$("#ar_slider").hide(),$("#playmsg").css("top","13px"),o.sceneEl.is("ar-mode")&&(0==o.mode.charAt(2)?o.sceneEl.exitAR():o.loadAR(),o.sceneEl.removeState("ar-mode")),o.sceneEl.is("vr-mode")){this.screenMsg("Retire o seu \xf3culos."),setTimeout(function(){o.fadeTo("#000"),o.sceneEl.exitVR(),o.sceneEl.removeState("vr-mode"),o.deleteSphere(),o.return2D(),o.data.hasARMenu&&!o.data.hasIntro&&$("ar").css("display","flex"),o.logo2d(!1),o.toggleZoom(!0),o.setZoom(null,0,0),o.zoom[1]=o.camera.components.camera.camera.fov},5e3);return}this.fadeTo("#000"),"2d-mode"==e?(this.return2D(),this.data.hasARMenu&&!this.data.hasIntro&&($("ar").css("display","flex"),o.loadAR()),this.logo2d(!0),this.toggleZoom(!0)):"ar-mode"==e?(o.sceneEl.is("ar-mode")||8!=o.mode.charAt(1)||(0==o.mode.charAt(2)?o.sceneEl.enterAR():o.loadAR()),o.menu2DIsOpen&&o.overlayMenu(),this.data.hasARMenu&&!this.data.hasIntro&&$("ar").css("display","flex"),this.logo2d(!0),this.toggleZoom(!0)):"vr-mode"==e&&(o.sceneEl.enterVR(),o.sceneEl.addState("vr-mode"),o.data.hasIntro||o.toggleMenu(o.status<=2),o.menu2DIsOpen&&o.overlayMenu(),this.logo2d(!1),this.toggleZoom(!1)),this.changeRaycaster(),this.setZoom(null,0,0),this.zoom[1]=o.camera.components.camera.camera.fov,o.changeRaycaster()},return2D:function(){this.permissions.gyro&&this.permissions.vr?($("#oo").text("VR"),$("#oo").show(),$("#ar_slider")[0]&&($("#ar_slider p:last-child").text("VR"),$("#ar_slider p")[0].className="active",$("#ar_slider p")[1].className="notactive",$("#ar_slider input")[0].checked=!1,$("#ar_slider").show()),$("#playmsg").css("top","-8px")):this.permissions.ar&&($("#oo").text("AR"),$("#oo").show(),$("#ar_slider")[0]&&($("#ar_slider p:last-child").text("AR"),$("#ar_slider p")[0].className="active",$("#ar_slider p")[1].className="notactive",$("#ar_slider input")[0].checked=!1,$("#ar_slider").show()),$("#playmsg").css("top","-8px")),o.sceneEl.addState("2d-mode"),this.menu3DIsOpen&&o.toggleMenu(o.status<=2),document.fullscreenElement||document.webkitFullscreenElement||document.msFullscreenElement||$("#fsc").text("fullscreen"),this.menu2DIsOpen||this.data.hasIntro||o.overlayMenu()},geolocate:async function(e){},overlayMenu:function(){this.data.has2DMenu&&!this.data.hasARMenu&&(this.menu2DIsOpen?($("#overlay-menu").hide(),$("#overlay-menu i").off("click")):($("#overlay-menu").css("display","flex"),$("#overlay-menu i").on("click",function(e){o.sceneEl.is("2d-mode")&&("oo"==e.target.id?o.changeMode(e.target.innerHTML+"-mode"):"fsc"==e.target.id?document.fullscreenElement||document.webkitFullscreenElement||document.msFullscreenElement?(o.closeFullscreen(),$(this).text("fullscreen")):(o.openFullscreen(),$(this).text("fullscreen_exit")):o.sessionHandler(e.target.id))})),this.menu2DIsOpen=!this.menu2DIsOpen)},toggleMenu:function(e){if(this.data.has3DMenu){if(this.menu3DIsOpen)this.deleteSphere();else{let s=this.initiateSphere();e?(s.appendChild(this.createText(modName,"center",.025,"infinity",this.data.textColor,"0 0.12 -0.5","0 0 0")),s.appendChild(this.createButton(.3,.06,.03,this.data.buttonColor,this.data.buttonDetailColor,"0 0.04 -0.5","mclickable","Iniciar",.025,()=>{this.sessionHandler("play")})),s.appendChild(this.createButton(.3,.06,.03,this.data.buttonColor,this.data.buttonDetailColor,"0 -0.04 -0.5","mclickable","Modo 2D",.025,()=>{this.changeMode("2d-mode")}))):(this.end||s.appendChild(this.createButton(.15,.03,.015,this.data.buttonColor,this.data.buttonDetailColor,"0 0.02 -0.4","mclickable","Continuar",.015,()=>{this.sessionHandler("play")})),s.appendChild(this.createButton(.15,.03,.015,this.data.buttonColor,this.data.buttonDetailColor,"0 -0.02 -0.4","mclickable","Repetir",.015,()=>{this.sessionHandler("replay")})),s.appendChild(this.createButton(.06,.03,.015,this.data.buttonColor,this.data.buttonDetailColor,"-0.045 -0.06 -0.4","mclickable","Sair",.015,()=>{this.sessionHandler("exit")})),s.appendChild(this.createButton(.06,.03,.015,this.data.buttonColor,this.data.buttonDetailColor,"0.045 -0.06 -0.4","mclickable","2D",.015,()=>{this.changeMode("2d-mode")}))),o.cameraRig.appendChild(s)}this.menu3DIsOpen=!this.menu3DIsOpen,this.changeTargetClass()}},initiateSphere:function(e=1){this.menuSphere&&(this.menuSphere.parentNode.removeChild(this.menuSphere),this.menuSphere=null);let s=document.createElement("a-sphere");return s.setAttribute("segments-height",9),s.setAttribute("segments-width",18),s.setAttribute("radius",1),s.setAttribute("radius",1),s.setAttribute("rotation","0 "+o.camera.getAttribute("rotation").y+" 0"),s.setAttribute("hoverable",""),s.setAttribute("material",{color:this.data.menuColor,side:"double",transparent:!0,opacity:e}),s.setAttribute("shader","flat"),1==e&&(Array.prototype.forEach.call(o.lights,function(e){e.object3D.visible=!1}),this.wires.object3D.visible=!1,this.dim3.object3D.visible=!1,this.dim2.object3D.visible=!1,this.econtrol.object3D.visible=!1),this.menuSphere=s,s},deleteSphere:function(){this.menuSphere&&this.menuSphere.parentNode.removeChild(this.menuSphere),Array.prototype.forEach.call(o.lights,function(e){e.object3D.visible=!0}),this.wires.object3D.visible=!0,this.dim3.object3D.visible=!0,this.dim2.object3D.visible=!0,this.econtrol.object3D.visible=!0,this.menuSphere=null},toggleZoom:function(e){!this.data.hasIntro&&this.data.hasZoom&&(e?$("#zoom-btn").css("display","flex"):$("#zoom-btn").hide(),this.data.hasARMenu?($("#zoom-btn").css("right","176px"),$("#zoom-btn").css("flex-direction","column"),$("#zoom-btn").css("justify-content",""),$("#zoom-btn").css("width","36px")):this.data.has2DMenu&&($("#zoom-btn").css("right","calc(50% - 160px/2)"),$("#zoom-btn").css("flex-direction","row"),$("#zoom-btn").css("justify-content","space-around"),$("#zoom-btn").css("width","160px")))},inIframe:function(){try{o.permissions.msg=window.self!==window.top}catch(e){o.permissions.msg=!0}return o.permissions.msg},msgSystem:function(){ARstate&&ARmsg&&(Object.assign(ARmsg.simulation,ARstate.simulation),o.translator(ARstate)),window.addEventListener("message",function(e){modName&&(o.iframe.origin=e.origin,o.iframe.source=e.source,o.iframe.firstMsg?(ARstate=JSON.parse(e.data),o.iframe.newMsg=!0,"stopped"==ARstate.simulation.status&&3==o.status&&o.sessionHandler("pause"),"running"==ARstate.simulation.status&&3==!o.status&&(ARmsg.simulation.status="stopped",ARstate.simulation.status="stopped",o.sendMsg(ARmsg))):(o.iframe.firstMsg=!0,(ARstate=JSON.parse(e.data)).simulation.loading=ARmsg.simulation.loading,ARstate.simulation.error=ARmsg.simulation.error,ARmsg.simulation.type=ARstate.simulation.type,ARmsg.simulation.status=ARstate.simulation.status,o.sendMsg(ARstate),o.translator(ARstate),o.loadARMenu()))})},sendMsg:function(e){console.log("sending msg",JSON.stringify(e)),this.iframe.source&&this.iframe.source.postMessage(JSON.stringify(e),this.iframe.origin)},translator:function(e){this.translated={},o.iterateObj(e,[]),o.iframe.newMsg=!0},iterateObj:function(e,s){Object.keys(e).forEach(function(n){e[n]&&e[n].constructor&&"Object"===e[n].constructor.name?(s.push(n),o.iterateObj(e[n],s)):o.translated[n]=[...s]});let n=s[s.length-1];s.pop(),o.translated[n]=[...s]},getObj:function(e,s){let n=this.translated[s];if(n)switch(n.length){case 1:return e[n[0]][s];case 2:return e[n[0]][n[1]][s];case 3:return e[n[0]][n[1]][n[2]][s];case 4:return e[n[0]][n[1]][n[2]][n[3]][s];case 5:return e[n[0]][n[1]][n[2]][n[3]][n[4]][s];case 6:return e[n[0]][n[1]][n[2]][n[3]][n[4]][n[5]][s];case 7:return e[n[0]][n[1]][n[2]][n[3]][n[4]][n[5]][n[6]][s];default:return e[s]}},setObj:function(e,s,n,a){let r=this.translated[s];if(!r)return;let l=[];if(a)for(i=0;i<a;i++)l.push(r[i]);else l=r;switch(l.length){case 1:res=e[l[0]];break;case 2:res=e[l[0]][l[1]];break;case 3:res=e[l[0]][l[1]][l[2]];break;case 4:res=e[l[0]][l[1]][l[2]][l[3]];break;case 5:res=e[l[0]][l[1]][l[2]][l[3]][l[4]];break;case 6:res=e[l[0]][l[1]][l[2]][l[3]][l[4]][l[5]];break;case 7:res=e[l[0]][l[1]][l[2]][l[3]][l[4]][l[5]][l[6]];break;default:res=e}"object"!=typeof res[s]||Array.isArray(res[s])||null===res[s]?"object"!=typeof n||Array.isArray(n)||null===n?res[s]=n:res[s]=n.value:Object.assign(res[s],n)},setEvt:function(e,s,n){if(!ARstate||!ARmsg)return;o.setObj(e,s,n),console.log(s,n);let a=o.translated[s],r={};Object.assign(r,o.getObj(e,s));let l={name:s,type:a[2]};Array.isArray(r)||null===r||(Object.assign(r,l),l=r),ARmsg[a[0]][a[1]].push(l),this.permissions.msg&&o.sendMsg(ARmsg),ARmsg[a[0]][a[1]]=[]},loader:function(){if(!$("a-assets").length)return o.updateBar(0,1);var e=$("a-assets")[0].querySelectorAll("audio, video, img, a-asset-item");let s=0,n=e.length;if(null==$("script[src*='aframe-environment']")[0]||null==this.sceneEl||jQuery.isEmptyObject(environment)||(n++,this.sceneEl.addEventListener("econtrolloaded",e=>{s=o.updateBar(s,n,e)},{once:!0})),this.updateBar(0,1))for(var a=0;a<e.length;a++)"a-asset-item"==e[a].localName?e[a].addEventListener("loaded",e=>{s=o.updateBar(s,n,e)},{once:!0}):"video"==e[a].localName||"audio"==e[a].localName?(e[a].load(),e[a].addEventListener("canplaythrough",e=>{s=o.updateBar(s,n,e)},{once:!0}),o.media.push(e[a])):"img"==e[a].localName&&e[a].addEventListener("load",e=>{s=o.updateBar(s,n,e)},{once:!0});for(a=0;a<$("[sound]").length;a++)this.media.push($("[sound]")[a]);for(a=0;a<$("a-sound").length;a++)this.media.push($("a-sound")[a])},updateBar:function(e,s,n){if(e+=1/s*100,$("#ebar")[0]){if($("#ebar").css("width",e+"%"),e>=99.9&&($("#ebar").css("width",e+"%"),$("#ebar i").removeClass("rotate90"),$("#circle-loader").hide(),$("#ebar i").html("check_circle_outline"),$("#ebar i").css("color","greenyellow"),$("#loading-msg").html("Tudo Pronto!"),o.sceneEl.hasLoaded&&(o.sessionHandler(1),hide&&$("#mode2D").click()),geo||$("#buttons").css("opacity",1)),this.permissions.msg){if(!sta||!evt)return;let a=sta;this.iframe.firstMsg||(a=evt),e>=99.9&&(e=100),a.simulation.loading=e/100;let r=a.simulation;this.sendMsg({simulation:r}),evt.simulation=a.simulation}return e}},loadsvgs:function(e){this.happy='data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" height="480" width="480"><path fill="forestGreen" d="M31.3 21.35q1.15 0 1.925-.775Q34 19.8 34 18.65t-.775-1.925q-.775-.775-1.925-.775t-1.925.775q-.775.775-.775 1.925t.775 1.925q.775.775 1.925.775Zm-14.6 0q1.15 0 1.925-.775.775-.775.775-1.925t-.775-1.925q-.775-.775-1.925-.775t-1.925.775Q14 17.5 14 18.65t.775 1.925q.775.775 1.925.775Zm7.3 13.6q3.3 0 6.075-1.775Q32.85 31.4 34.1 28.35h-2.6q-1.15 2-3.15 3.075-2 1.075-4.3 1.075-2.35 0-4.375-1.05t-3.125-3.1H13.9q1.3 3.05 4.05 4.825Q20.7 34.95 24 34.95ZM24 44q-4.1 0-7.75-1.575-3.65-1.575-6.375-4.3-2.725-2.725-4.3-6.375Q4 28.1 4 23.95q0-4.1 1.575-7.75 1.575-3.65 4.3-6.35 2.725-2.7 6.375-4.275Q19.9 4 24.05 4q4.1 0 7.75 1.575 3.65 1.575 6.35 4.275 2.7 2.7 4.275 6.35Q44 19.85 44 24q0 4.1-1.575 7.75-1.575 3.65-4.275 6.375t-6.35 4.3Q28.15 44 24 44Zm0-20Zm0 17q7.1 0 12.05-4.975Q41 31.05 41 24q0-7.1-4.95-12.05Q31.1 7 24 7q-7.05 0-12.025 4.95Q7 16.9 7 24q0 7.05 4.975 12.025Q16.95 41 24 41Z"/></svg>',this.sad='data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" height="480" width="480"><path fill="red" d="M31.3 21.35q1.15 0 1.925-.775Q34 19.8 34 18.65t-.775-1.925q-.775-.775-1.925-.775t-1.925.775q-.775.775-.775 1.925t.775 1.925q.775.775 1.925.775Zm-14.6 0q1.15 0 1.925-.775.775-.775.775-1.925t-.775-1.925q-.775-.775-1.925-.775t-1.925.775Q14 17.5 14 18.65t.775 1.925q.775.775 1.925.775Zm7.3 5.8q-3.35 0-6.075 1.875T13.9 34h2.65q1.1-2.1 3.125-3.25t4.375-1.15q2.35 0 4.325 1.15T31.5 34h2.6q-1.25-3.1-4-4.975-2.75-1.875-6.1-1.875ZM24 44q-4.1 0-7.75-1.575-3.65-1.575-6.375-4.3-2.725-2.725-4.3-6.375Q4 28.1 4 23.95q0-4.1 1.575-7.75 1.575-3.65 4.3-6.35 2.725-2.7 6.375-4.275Q19.9 4 24.05 4q4.1 0 7.75 1.575 3.65 1.575 6.35 4.275 2.7 2.7 4.275 6.35Q44 19.85 44 24q0 4.1-1.575 7.75-1.575 3.65-4.275 6.375t-6.35 4.3Q28.15 44 24 44Zm0-20Zm0 17q7.1 0 12.05-4.975Q41 31.05 41 24q0-7.1-4.95-12.05Q31.1 7 24 7q-7.05 0-12.025 4.95Q7 16.9 7 24q0 7.05 4.975 12.025Q16.95 41 24 41Z"/></svg>',this.moon='data:image/svg+xml;utf8,<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 56 56" style="enable-background:new 0 0 56 56;" xml:space="preserve"><path fill="LightYellow" d="M46.369,28.793c-11.852,5.935-26.271,1.138-32.206-10.714c-2.748-5.488-3.191-11.524-1.702-17.016 C1.197,7.236-3.255,21.263,2.544,32.844C8.479,44.696,22.898,49.493,34.75,43.558c6.364-3.187,10.69-8.821,12.417-15.19 C46.903,28.513,46.64,28.658,46.369,28.793z"/></svg>',this.cloud="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAMAAABrrFhUAAADAFBMVEUAAADp7O7j5+nt8PHn6+zk6On////h5efU2t3////////29/j////////////////9/f3W3N74+fn////////19vf+/v7////4+fn6+vv////+/v7////7/Pz////V293z9PX////////w8vPw8vP5+vrV297////9/f3+/v7////4+frw8vPy9PX////////x8vPm6uv////3+Pj8/Pz3+Pnt8PHX3d/3+Pjq7e7+/v7l6erW3N7n6uv9/f37/PzV29729/jq7e7r7u/3+Pn3+Pj+///9/f3w8vPu8PHV29329/jX3N/w8vPX3N/09fbt7/H+/v7f4+br7u/////s7u/+/v7m6uv19vfW297n6uzO1djW3N/X3d/U2t39/f3V297s7u/X3d/3+Pj9/v7l6erj5+j+/v709fbd4uTX3N/i5ujY3eD09fXv8fLe4+Xo6+zm6evo6+ze4+X9/f3b4OP5+vr////W3N7l6Orh5efq7e7i5uju8PHU2tzh5efW3N7s7/DX3d/X3d/9/f77/Pzs7vDZ3uH+/v7m6uva4OLl6evX3N/W3N7y9PTf4+b+///3+PjY3eDd4eTz9fXW297O1djn6uzU2t3V297N1Nf////m6evb4OLi5ufb4OPU2t3g5Ob09vbQ19rj5+j3+Pjn6uzt7/Hs7u/w8vP9/v7////P1djz9fX09fbT2dz5+vrT2dzn6uvy9PXc4ePh5efe4uTx8/P29/j29/fz9PXN1Nfm6uvQ19rl6Onp7O3U2tzY3eDb4OLs7/DR19rg5ObT2dzP1dj5+vrX3N/X3N/k5+nN1Nfg5Obw8vPi5ujW2974+fnu8PHe4+X09vb09vbh5ef19vfb4OLW3N7c4ePS2Nv+///Z3uDf4+X3+PjW297v8fL29/fY3eDz9PXx8/Th5ujz9fXh5efm6evx8/TW3N/19vfb4OLq7e7f4+X29/js7/Dd4uTT2dv5+vrf4+bu8PH////m6ev29/f39/jZ3uDj5ujj5+n19vf5+vqvHALMA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+T0iUR8MQpLD8tRUiJJwQ2bYAWDBp6Dgl0m2dAAaa7arGF7i4exbCDD/kOJ25noqbde6ez+8poUcXWetXNCfRXrjDOc1r0QAAAABJRU5ErkJggg==",this.iconHead='<svg xmlns="http://www.w3.org/2000/svg" width="150" height="150" viewBox="-8 -8 40 40"><circle cx="-13" cy="12" r="16" fill="none" stroke="'+this.colorToRGB(this.data.loadingColor)+'" stroke-width="3" stroke-linecp="round" transition="stroke-dashoffset 1s linear" stroke-dasharray="565.48" transform="scale(-1,-1) translate(0,-24)"',this.iconPath="M18.536 7.555c-1.188-.252-4.606-.904-5.536-1.088v-3.512c0-1.629-1.346-2.955-3-2.955s-3 1.326-3 2.955v7.457c-.554-.336-1.188-.621-1.838-.715-1.822-.262-3.162.94-3.162 2.498 0 .805.363 1.613 1.022 2.271 3.972 3.972 5.688 5.125 6.059 9.534h9.919v-1.748c0-5.154 3-6.031 3-10.029 0-2.448-1.061-4.157-3.464-4.668zm.357 8.022c-.821 1.483-1.838 3.319-1.891 6.423h-6.13c-.726-3.82-3.81-6.318-6.436-8.949-.688-.686-.393-1.37.442-1.373 1.263-.006 3.06 1.884 4.122 3.205v-11.928c0-.517.458-.955 1-.955s1 .438 1 .955v6.948c0 .315.256.571.572.571.314 0 .57-.256.57-.571v-.575c0-.534.49-.938 1.014-.833.398.079.686.428.686.833v1.273c0 .315.256.571.571.571s.571-.256.571-.571v-.83c0-.531.487-.932 1.008-.828.396.078.682.424.682.828v1.533c0 .315.256.571.571.571s.571-.256.571-.571v-.912c0-.523.545-.867 1.018-.646.645.305 1.166.932 1.166 2.477 0 1.355-.465 2.193-1.107 3.354z"},setupPhysics:function(){console.log("physics initiated")},setupCursor:function(){dev&&console.log("Cursor initiated");let e=["lhand","rhand"];for(i=0;i<e.length;i++){let s=document.createElement("a-entity");s.setAttribute("class","ignore-ray"),this.data.hasPhysics&&(s.setAttribute("geometry",{primitive:"box",width:.015,height:.015,depth:.015}),s.setAttribute("material","opacity",0),s.setAttribute("ammo-body",{emitCollisionEvents:!0,collisionFilterGroup:1,collisionFilterMask:2,type:"static",mass:0}),s.setAttribute("ammo-shape",{type:"box"})),s.setAttribute("id",e[i]+"cursor"),this[e[i]+"cursor"]=s,$("a-camera")[0].appendChild(s),s.appendChild(this.createSVGCursor(e[i]+"cursorimg")),s.addEventListener("dynamic",function(e){s.setAttribute("ammo-body","type","kinematic"),s.setAttribute("ammo-body","type","static"),s.setAttribute("ammo-body","type","kinematic")}),s.addEventListener("static",function(e){s.setAttribute("ammo-body","type","static"),s.setAttribute("ammo-body","type","kinematic"),s.setAttribute("ammo-body","type","static")})}AFRAME.components.raycaster.Component.prototype.tock=function(e,s){var n=this.data,a=this.prevCheckTime;if(!n.enabled||a&&e-a<n.interval)return;this.prevCheckTime=e,this.checkIntersections();let r=$("#rhandcursor")[0];"lhand"==this.el.id&&(r=$("#"+this.el.id+"cursor")[0]),this.intersections.length>0?this.el==o.camera?(o.positionCursor(r,this.intersections.find(e=>r!==e.object.el&&!e.object.el.classList.contains("ignore-ray"))),AFRAME.utils.device.isMobile()||o.sceneEl.is("vr-mode")||r.setAttribute("scale","0.01 0.01 0.01"),r.object3D.visible=!0,this.el.setAttribute("raycaster","lineColor","white")):this.intersections[0].object.el.components.hoverable?this.el.setAttribute("raycaster","lineColor","white"):this.el.setAttribute("raycaster","lineColor","blue"):(r.setAttribute("scale","1 1 1"),r.object3D.visible=!1,o.curveRay.removeAttribute("tickline"),this.el.setAttribute("raycaster","lineColor","white"))}},positionCursor:function(e,s){let n=e.querySelectorAll("a-image")[0];if(null!=s){let a=o.cameraRig.components["movement-controls"];o.sceneEl.is("2d-mode")&&!AFRAME.utils.device.isMobile()&&a&&a.velocityCtrl&&o.rhandcursor.grabbedEl&&o.rhandcursor.grabbedEl.length>0&&s.uv&&o.camera.components.cursor.onMouseMove({view:window,bubbles:!0,cancelable:!0,clientX:s.uv.x,clientY:s.uv.y});let r=s.object.el.components.checkpoint;s.object.el!=o.actualCheckpoint&&r&&r.active&&"checkpoint"==o.movementType&&3==o.status?o.createIndication(e):o.curveRay.components.tickline&&o.curveRay.removeAttribute("tickline");var l=s.object.matrixWorld;if(l.setPosition(new THREE.Vector3(0,0,0)),!s.face)return;var c=s.face.normal.clone().applyMatrix4(l).normalize().negate(),h=new THREE.Vector3().addVectors(s.point,c);this.menu3DIsOpen&&"A-SPHERE"==s.object.el.tagName&&(h=new THREE.Vector3().addVectors(s.point,c.multiplyScalar(-.2))),n.object3D.lookAt(h),Math.abs(n.object3D.rotation.x)>=1.56&&(n.object3D.rotation.z=0),Math.abs(n.object3D.rotation.y)>=1.56&&(n.object3D.rotation.x=0,n.object3D.rotation.z=0),o.menu3DIsOpen||7==o.status?n.setAttribute("scale","0.05 0.05 0.05"):2>s.point.distanceTo(o.camera.object3D.position)?n.setAttribute("scale","0.15 0.15 0.15"):n.setAttribute("scale","0.3 0.3 0.3");var u=o.camera.object3D.worldToLocal(new THREE.Vector3().addVectors(s.point,c.multiplyScalar(-this.offset)));o.sceneEl.is("2d-mode")&&!AFRAME.utils.device.isMobile()&&o.rhandcursor.grabbedEl&&o.rhandcursor.grabbedEl[1]&&u.clampLength(.9*o.rhandcursor.grabbedEl[1],1.1*o.rhandcursor.grabbedEl[1]),e.setAttribute("position",u),o.animateCursor(n,n.getAttribute("percentage")),n.object3D.visible=o.data.hasCursor&&(AFRAME.utils.device.isMobile()||o.sceneEl.is("vr-mode"))}else n.object3D.visible=!1,o.curveRay.removeAttribute("tickline")},createSVGCursor:function(e){let s=document.createElement("a-image");s.setAttribute("visible",!0),s.setAttribute("id",e),s.setAttribute("class","ignore-ray"),s.setAttribute("scale","0.3 0.3 0.3"),s.setAttribute("percentage",0);let n=-101;return AFRAME.utils.device.isIOS()&&(n=566),s.setAttribute("src","data:image/svg+xml;utf8,"+this.iconHead+' stroke-dashoffset="'+n+'"></circle><circle cx="12" cy="12" r="3" fill="'+this.colorToRGB(this.data.cursorColor)+'"/></svg>'),s.setAttribute("animation__on",{property:"percentage",startEvents:"on",pauseEvents:"off",easing:"linear",dur:this.data.hoverTime,from:0,to:1}),s.addEventListener("animationcomplete__on",e=>{let s=e.target;s.object3D.scale.multiplyScalar(1.1),setTimeout(()=>{s.object3D.scale.multiplyScalar(.9)},80)}),s.addEventListener("off",e=>{let s=-101;AFRAME.utils.device.isIOS()&&(s=566),e.target.setAttribute("src","data:image/svg+xml;utf8,"+this.iconHead+' stroke-dashoffset="'+s+'"></circle><circle cx="12" cy="12" r="3" fill="'+this.colorToRGB(this.data.cursorColor)+'"/></svg>'),e.target.setAttribute("percentage",0)}),s.setAttribute("material",{alphaTest:.3,side:"double"}),s},animateCursor:function(e,s){if(null!=this.clicking){if(0==s||1==s)return;let n=parseInt(-98+100*s);AFRAME.utils.device.isIOS()&&(n=parseInt(-600*(s/6))),e.setAttribute("src","data:image/svg+xml;utf8,"+this.iconHead+' stroke-dashoffset="'+n+'"></circle><path stroke="grey" stroke-width="1" d="'+this.iconPath+'" fill="'+this.colorToRGB(this.data.cursorColor)+'" transform="scale(1,-1) translate(0,-24)"/></svg>')}},intersectListener:function(e,s,n){let a=o.mode.charAt(0);if(("g"==a||"r"==a||"w"==a)&&AFRAME.utils.device.isMobile()||!AFRAME.utils.device.isMobile()&&o.sceneEl.is("vr-mode")){if(!s[0])return;o.clicking!=s[0]&&n?(clearTimeout(o.timeout1),null!=o.clicking&&(o.clicking.emit("off"),$("#rhandcursorimg")[0].emit("off")),o.clicking=s[0],o.clicking.emit("on"),$("#rhandcursorimg")[0].emit("on"),o.timeout1=setTimeout(function(){console.log("timer click"),o.clicking.emit("grab-start",{hand:$("#rhandcursor")[0]}),o.clicking=null},o.data.hoverTime)):(o.clicking&&(o.clicking.emit("off"),o.clicking=null),s[0].is("grabbed")&&s[0].emit("grab-end",e),$("#rhandcursorimg")[0].emit("off"),clearTimeout(o.timeout1))}},createIndication:function(e){let s=new THREE.Vector3,n=new THREE.Vector3,a=new THREE.Vector3;return function(e){o.camera.object3D.getWorldPosition(s),e.object3D.getWorldPosition(n);let r=o.getPointInBetweenByPerc(s,n,.5);s.y=o.cameraRig.object3D.position.y,r.x*=1.1;let l=new THREE.CatmullRomCurve3([s,r,n]),c="";for(let h=0;h<12;h++){let u=h/12;l.getPoint(u,a),c+=a.x+" "+a.y+" "+a.z,h<11&&(c+=",")}o.curveRay.setAttribute("tickline",{lineWidth:15,path:c+","+n.x+" "+n.y+" "+n.z,color:o.data.menuColor})}}(),setupControllers:function(){console.log("controllers initiated"),this.dof3=["vrbox-controller","oculus-go"],this.dof6=["oculus-touch","hand-tracking"];let e=["left","right"],s='<a-entity id="controllerRig">';for(i=0;i<e.length;i++){for(s+='<a-entity id="'+e[i].charAt(0)+'hand" ',j=0;j<this.dof6.length;j++)s+=this.dof6[j]+'-controls="hand: '+e[i]+'" ';if(1==i)for(j=0;j<this.dof6.length;j++)s+=this.dof3[j]+" ";s+="ccontrol ",s+="></a-entity>"}s+="</a-entity>",$("#cameraRig").append(s),o.rhand=$("#rhand")[0],o.lhand=$("#lhand")[0],AFRAME.registerComponent("vrbox-controller-controls",{init:function(){let e=this;this.controllerPresent=!1,window.addEventListener("gamepadconnected",function(s){console.log("Simple gamepad connected");let n=navigator.getGamepads?navigator.getGamepads():navigator.webkitGetGamepads?navigator.webkitGetGamepads:[];for(i=0;i<n.length;i++)n[i]&&!n[i].pose&&n[i].axes.length>0&&n[i].buttons.length>0&&(e.controllerPresent=n[i])}),window.addEventListener("gamepaddisconnected",function(e){let s=navigator.getGamepads?navigator.getGamepads():navigator.webkitGetGamepads?navigator.webkitGetGamepads:[];for(i=0;i<s.length;i++)null!=o.pads&&s[i]==o.pads&&(o.pads=!1)})},tick:function(){if(null!=o.pads){for(i=0;i<o.pads.buttons.length;i++)o.pads.buttons[i].pressed&&this.action(o.pads.buttons[i]);(0!=o.pads.axes[0]||0!=o.pads.axes[1])&&(-1==gp.axes[0]&&turn1++,1==gp.axes[0]&&turn1--,1==gp.axes[1]&&turn2++,-1==gp.axes[1]&&turn2--,this.cRot(turn1,turn2))}},cRot:function(e,s){e*=1.5,s*=1.5,this.el.object3D.rotation.set(THREE.Math.degToRad(e-90),THREE.Math.degToRad(s),THREE.Math.degToRad(0))},action:function(e){},createModel:function(){}});let n,a,r;AFRAME.registerComponent("ccontrol",{schema:{enabled:{type:"boolean",default:!0},gesture:{type:"string",default:"none"},fingerColliders:{type:"array",default:[!1,!1,!0,!1,!1,!1]},grabGesture:{type:"array",default:["fist","pinch"]},smooth:{default:20}},init:function(){for(this.positions={},this.bones=["wrist","thumb_null","index_null","middle_null","ring_null","pinky_null","middle0"],this.prefix="b_"+this.el.id.charAt(0)+"_",this.gesturesRules={a:[this.prefix+"index_null","greater",.85],b:[this.prefix+"index_null","smaller",.55],c:[this.prefix+"thumb_null","greater",.9],d:[this.prefix+"thumb_null",.9],e:[this.prefix+"middle_null","greater",.85],f:[this.prefix+"middle_null","smaller",.55],g:[this.prefix+"middle_null","greater",.0355,this.prefix+"index_null"],h:[this.prefix+"ring_null","greater",.85],i:[this.prefix+"ring_null","smaller",.55],j:["negative"]},this.gestures={adfgi:"indexPointer",bdfi:"fist",acfgi:"gun",acei:"raycasterOff",adei:"raycasterOn",adegi:"scisor",acegh:"paper",bcfi:"thumbsUp",bcfij:"thumbsDown"},this.controller,this.colliders={},this.codeArray=[],this.oldGesture,i=0;i<this.bones.length;i++)this.bones[i]=this.prefix+this.bones[i]},update:function(e){if(AFRAME.utils.diff(e,this.data).fingerColliders&&"hand-tracking"==this.controller&&this.data.enabled&&this.el.getObject3D("mesh")&&this.el.getObject3D("mesh").visible)for(i=0;i<this.data.fingerColliders.length;i++)this.colliders[this.bones[i]]&&this.remove(this.colliders[this.bones[i]]),this.data.fingerColliders[i]&&this.addFingerCollider(this.bones[i])},remove:function(e){this.hideFingerColliders(e),e.parentElement.removeChild(e)},tick:function(){if(this.el.components["hand-tracking-controls"],this.checkController(),"hand-tracking"==this.controller&&this.data.enabled&&this.el.getObject3D("mesh")&&this.el.getObject3D("mesh").visible){let e=this.el.components["hand-tracking-controls"].mesh.children;for(i=0;i<e.length;i++){let s=this.bones.indexOf(e[i].name);-1!=s&&(!this.colliders[e[i].name]&&(6==s?this.addFingerCollider(e[i].name):this.data.fingerColliders[s]&&this.addFingerCollider(e[i].name)),this.getFingerPosition(e[i]))}this.detectGesture()}else if(!jQuery.isEmptyObject(this.positions)){for(i=0;i<this.bones.length;i++)this.colliders[this.bones[i]]&&this.hideFingerColliders(this.colliders[this.bones[i]]);this.positions={}}},checkController(){let e=o.dof6.concat(o.dof3);for(i=0;i<e.length;i++){let s=this.el.components[e[i]+"-controls"];s&&s.controllerPresent&&this.controller!=e[i]?(this.controller=e[i],dev&&console.log("controle adicionado",e[i]),"hand-tracking"==e[i]&&s.initMeshHandModel(),o.changeRaycaster()):s&&!s.controllerPresent&&this.controller==e[i]&&(this.controller=null,dev&&console.log("controle removido",e[i]),o.changeRaycaster())}},addFingerCollider:function(e){let s=document.createElement("a-entity");s.setAttribute("geometry",{primitive:"sphere",radius:.005}),s.setAttribute("material","opacity",0),s.setAttribute("class","finger-collider"),"b_l_middle0"==e||"b_r_middle0"==e?(s.setAttribute("id",this.el.id+"_anchor"),s.setAttribute("super-hands",{colliderEvent:"collidestart",colliderEventProperty:"targetEl",colliderEndEvent:"collideend",colliderEndEventProperty:"targetEl"})):s.setAttribute("id",e),s.setAttribute("ammo-body",{emitCollisionEvents:!0,collisionFilterGroup:1,collisionFilterMask:2,type:"static",mass:0}),s.setAttribute("ammo-shape",{type:"sphere"}),this.el.appendChild(s),this.colliders[e]=s},getFingerPosition:(n=new THREE.Vector3,function(e){if(e.getWorldPosition(n),(p=this.positions)[e.name]=n,!p[this.prefix+"thumb_null"]||!p[this.prefix+"wrist"]||!p[this.prefix+"index_null"]||!p[this.prefix+"middle_null"]||!p[this.prefix+"ring_null"]||!p[this.prefix+"pinky_null"])return;p.maxthumb=Math.max(p[this.prefix+"thumb_null"].distanceTo(p[this.prefix+"wrist"]),p.maxthumb||0),p.maxindex=Math.max(p[this.prefix+"index_null"].distanceTo(p[this.prefix+"wrist"]),p.maxindex||0),p.maxmiddle=Math.max(p[this.prefix+"middle_null"].distanceTo(p[this.prefix+"wrist"]),p.maxmiddle||0),p.maxring=Math.max(p[this.prefix+"ring_null"].distanceTo(p[this.prefix+"wrist"]),p.maxring||0),p.maxpinky=Math.max(p[this.prefix+"pinky_null"].distanceTo(p[this.prefix+"wrist"]),p.maxpinky||0);let s=this.colliders[e.name];s&&(o.cameraRig.object3D.worldToLocal(n),s.object3D.position.copy(n),s.object3D.visible||this.showFingerColliders(s))}),detectGesture:function(){let e=this.positions;if(!e||jQuery.isEmptyObject(e))return;let s="";for(let n in this.gesturesRules){let a=this.gesturesRules[n];if("negative"==a[0])e[this.prefix+"thumb_null"].sub(e[this.prefix+"wrist"]).y<0&&(s+=n);else{if(!e[a[0]])continue;let r,l;null!=a[3]?(r=e[a[0]].distanceTo(e[a[3]]),l=a[2]):(r=e[a[0]].distanceTo(e[this.prefix+"wrist"]),l=a[2]*e["max"+a[0].split("_")[2]]),"greater"==a[1]?r>l&&(s+=n):r<l&&(s+=n)}}s=o.sortString(s),s=o.smoothingString(this.codeArray,this.data.smooth,s);let c=this.gestures[s.substring(0,6)],h=this.gestures[s.substring(0,5)],u=this.gestures[s.substring(0,4)];if(null!=c||null!=h||null!=u){let d=c||h||u;this.data.gesture!=d&&(this.oldGesture=this.data.gesture,this.data.gesture=d,this.el.emit("gesture",d),this.setRaycaster())}else"none"!=this.data.gesture&&(this.oldGesture=this.data.gesture,this.data.gesture="none",this.setRaycaster())},showFingerColliders:function(e){if(e.object3D.visible=!0,!o.data.hasPhysics)return;e.setAttribute("ammo-body","collisionFilterMask",0);let s=o.collisionGroups[o.data.targetClass];e.setAttribute("ammo-body","collisionFilterMask",s)},hideFingerColliders:function(e){e.object3D.visible=!1,o.data.hasPhysics&&(e.setAttribute("ammo-body","collisionFilterMask",0),e.setAttribute("ammo-body","collisionFilterMask",0))},setRaycaster:function(){"raycasterOff"==this.data.gesture?"raycasterOn"==this.oldGesture?this.el.emit("grab-end"):o.changeRaycaster():"raycasterOn"==this.data.gesture?"raycasterOff"==this.oldGesture?this.el.emit("grab-start"):o.changeRaycaster():("raycasterOn"==this.oldGesture||"raycasterOff"==this.oldGesture)&&o.changeRaycaster()},openMenu:function(){!o.menu3DIsOpen&&o.data.has3DMenu&&o.sessionHandler("pause")},calculateGrabDistance:(a=new THREE.Vector3,r=new THREE.Vector3,function(e){if(e.object3D.getWorldPosition(a),this.el.children.item(2))return this.el.children.item(2).object3D.getWorldPosition(r),a.distanceTo(r)}),grab:function(){let e=new THREE.Quaternion,s=new THREE.Vector3;return new THREE.Vector3(0,0,-1),new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,function(){let n=this.el.components["hand-tracking-controls"].mesh.children;for(i=0;i<n.length;i++)if("b_l_middle0"==n[i].name||"b_r_middle0"==n[i].name){n=n[i];break}!this.grabbedEl||!n||Array.isArray(n)||(n.getWorldQuaternion(e),n.getWorldPosition(s),this.deltaPosition||(this.deltaPosition=new THREE.Vector3,this.deltaPosition.copy(this.grabbedEl.object3D.position),this.deltaPosition.sub(s)),this.grabbedEl.object3D.position.copy(s.add(this.deltaPosition)),this.grabbedEl.object3D.quaternion.copy(e))}}(),events:{controllerconnected:function(){o.changeRaycaster()},controllerdisconnected:function(){o.changeRaycaster()},"raycaster-intersection":function(e){let s=o.emitFiltered(e);e.target.emit("raycaster-intersection-filtered",{els:s}),console.log(e.target,s)},collide2:function(e){let s=o.emitFiltered(e);!(s.length>0&&s[0].is("grabbed"))&&s[0]&&(s[0].components.grabbable,this.collidedEls.includes(s[0])||this.collidedEls.push(s[0]))},thumbstickdown:function(){this.openMenu()},trackpaddown:function(){this.openMenu()},touchpaddown:function(){this.openMenu()},surfacedown:function(){this.openMenu()},thumbstickmoved:function(e){e.detail.y>.95&&console.log("DOWN"),e.detail.y<-.95&&console.log("UP"),e.detail.x<-.95&&console.log("LEFT"),e.detail.x>.95&&console.log("RIGHT")},gesture:function(e){console.log("gesture",e.detail)},pinchstarted:function(){console.log("pinch on");let e=this.el.components["hand-tracking-controls"].mesh.children;for(i=0;i<e.length;i++)if("b_l_middle0"==e[i].name||"b_r_middle0"==e[i].name){e=e[i];break}$("#"+this.el.id+"_anchor")[0].emit("gripdown",{hand:$("#"+this.el.id+"_anchor")[0]})},pinchended:function(){console.log("pinch off"),$("#"+this.el.id+"_anchor")[0].emit("gripup",{hand:$("#"+this.el.id+"_anchor")[0]})}}})},addGesture:function(e,s,n=!1){!(!e||jQuery.isEmptyObject(e))&&(!s||jQuery.isEmptyObject(s)||$("[ccontrol]").each(function(){if("A-MIXIN"!=this.tagName){for(let a in n&&(this.components.ccontrol.gesturesRules=e,this.components.ccontrol.gestures=s),e)this.components.ccontrol.gesturesRules[a]=e[a];for(let r in s)this.components.ccontrol.gestures[r]=s[r]}}))},removeRaycaster:function(e){$("[raycaster]").each(function(){this.removeAttribute("raycaster")}),$("[cursor]").each(function(){this.removeAttribute("cursor")}),$("[super-hands]").each(function(){this.removeAttribute("super-hands")}),$("#lhandcursor")[0].setAttribute("position","0 0 0"),$("#rhandcursor")[0].setAttribute("position","0 0 0")},changeRaycaster:function(){this.removeRaycaster(),hascontroller=!1;let e=[$("#lhand")[0],$("#rhand")[0]];for(i=0;i<e.length;i++){let s=e[i],n=s.components.ccontrol;if("hand-tracking"==n.controller){hascontroller=!0;let a=n.data.gesture;if("raycasterOff"==a||"raycasterOn"==a){if($("#b_"+s.id.charAt(0)+"_index_null").length&&(s=$("#b_"+s.id.charAt(0)+"_index_null")[0]),!s.object3D.visible)return}else{dev&&console.log("hand raycaster");continue}dev&&console.log("laser raycaster"),s.setAttribute("raycaster",{showLine:o.data.showRay,objects:o.data.targets}),this.definingSuperHands(s);continue}if(null!=n.controller){dev&&console.log("controller raycaster"),hascontroller=!0,s.setAttribute("raycaster",{showLine:o.data.showRay,objects:o.data.targets}),this.definingSuperHands(s);continue}}if(!hascontroller){$("#lhandcursor")[0].object3D.visible=!1,$("#lhandcursor")[0].object3D.position.y=-1e3,o.camera.setAttribute("raycaster",{showLine:!1,objects:o.data.targets}),o.camera.removeEventListener("raycaster-intersection",function(e){}),o.camera.removeEventListener("raycaster-intersection-cleared",function(e){}),o.camera.addEventListener("raycaster-intersection",function(e){e.preventDefault(),e.stopImmediatePropagation();let s=o.emitFiltered(e);e.target.emit("raycaster-intersection-filtered",{els:s}),o.intersectListener(e,s,!0)}),o.camera.addEventListener("raycaster-intersection-cleared",function(e){o.intersectListener(e,o.emitFiltered(e))}),this.definingSuperHands(o.camera),!o.sceneEl.is("ar-mode")&&(AFRAME.utils.device.isMobile()||o.sceneEl.is("vr-mode"))?($("#rhandcursor")[0].origin="camera",dev&&console.log("camera raycaster")):(o.camera.setAttribute("cursor","rayOrigin","mouse"),$("#rhandcursor")[0].origin="mouse",$("#lhandcursorimg")[0].object3D.visible=!1,$("#rhandcursorimg")[0].object3D.visible=!1,dev&&console.log("mouse raycaster"));let r=o.mode.charAt(0);!("f"==r||"p"==r||"c"==r)&&AFRAME.utils.device.isMobile()?(this.data.hasCursor=!0,o.changeSuperHands()):o.changeSuperHands("gripup, triggerup, mouseup, touchend","gripdown, triggerdown, mousedown, touchstart");return}o.changeSuperHands()},changeTargetClass:function(){switch(this.status){case 0:case 1:case 2:case 5:this.data.targetClass="mclickable",this.changeCollideMask(2);break;case 7:this.data.targetClass="qclickable",this.changeCollideMask(4);break;case 8:this.data.targetClass="aclickable",this.changeCollideMask(8);break;default:this.data.targetClass="any",this.changeCollideMask(1)}this.menu3DIsOpen&&(this.data.targetClass="mclickable",this.changeCollideMask(2))},changeCollideMask:function(e){o.rhandcursor.setAttribute("ammo-body","collisionFilterMask",0),o.rhandcursor.setAttribute("ammo-body","collisionFilterMask",e),o.lhandcursor.setAttribute("ammo-body","collisionFilterMask",0),o.lhandcursor.setAttribute("ammo-body","collisionFilterMask",e);let s=$(".finger-collider");for(i=0;i<s.length;i++)s[i].setAttribute("ammo-body","collisionFilterMask",0),s[i].setAttribute("ammo-body","collisionFilterMask",e)},definingSuperHands:function(e){e.setAttribute("super-hands",{colliderEvent:"raycaster-intersection-filtered",colliderEventProperty:"els",colliderEndEvent:"raycaster-intersection-cleared",colliderEndEventProperty:"clearedEls"})},changeSuperHands:function(e="gripup, triggerup",s="gripdown, triggerdown"){$("[super-hands]").each(function(){this.setAttribute("super-hands",{grabStartButtons:s,grabEndButtons:e,stretchStartButtons:s,stretchEndButtons:e,dragDropStartButtons:s,dragDropEndButtons:e})})},emitFiltered:function(e){let s=e.detail.clearedEls||e.detail.els||e.detail.intersectedEls;!s&&e.detail.body&&(s=[e.detail.body.el]);let n,a=[];for(i=0;i<s.length;i++){if(n){if(n==s[i])continue}else n=s[i];(s[i].classList.contains(o.data.targetClass)||"any"==o.data.targetClass)&&(!s[i].object3D||s[i].object3D.visible)&&a.push(s[i])}return a},clickListener:function(){document.addEventListener?document.addEventListener("contextmenu",function(e){e.preventDefault()},!1):document.attachEvent("oncontextmenu",function(){window.event.returnValue=!1}),o.sceneEl.addEventListener("grab-end",function(e){e.target.lastClick=e.target.timeout2,clearTimeout(e.target.timeout2)}),o.sceneEl.addEventListener("grab-start",function(e){if(!(e.target.components.clickable||e.target.components.selectable))return;e.detail.buttonEvent&&e.detail.buttonEvent.detail&&(2==e.detail.buttonEvent.detail.button||e.detail.buttonEvent.detail.mouseEvent&&2==e.detail.buttonEvent.detail.mouseEvent.button)&&e.target.emit("leftclick");let s=e.target;e.target.timeout2=setTimeout(function(){s.emit("longclick")},500),e.target.lastClick&&e.target.timeout2-e.target.lastClick<250&&(e.target.emit("dbclick"),clearTimeout(e.target.timeout2))})},loadLogos:function(){this.data.hasLogos&&(null!=logo&&$("a-assets").append('<img id="logocli" src="'+path+"generic/logos/"+logo+'" crossorigin="anonymous">'),$("a-assets").append('<img id="logoorb" src="'+path+"generic/"+orb+'" crossorigin="anonymous">'))},createLogo:function(e,s,n,a,r){let l=document.createElement("a-image");return l.setAttribute("position",r),l.setAttribute("width",n),l.setAttribute("height",a),l.setAttribute("material","alphaTest",.15),(""!=e||null!=e)&&l.setAttribute("id",e),"svg"==s.slice(s.length-3)?l.setAttribute("material","src",s):l.setAttribute("src",s),l},logo2d:function(e){!this.data.hasIntro&&this.data.hasLogos&&(null!=logo&&($("#ar_client").attr("src",path+"generic/logos/"+logo),$("#ar_client").attr("class","white_logo"),e?$("#ar_client").show():$("#ar_client").hide()),null!=orb&&($("#ar_oorbit").attr("src",path+"generic/"+orb),$("#ar_oorbit").attr("class","white_logo"),e?$("#ar_oorbit").show():$("#ar_oorbit").hide()))},showIntro:function(e){if(this.data.hasIntro){if(e){let s=o.initiateSphere();s.appendChild(this.createText("Desenvolvido por:","center",.025,"infinity",this.data.textColor,"0 0 -0.5","0 0 0"));let n=document.createElement("a-entity");n.setAttribute("gltf-model","#introModel"),n.setAttribute("gltf-material","opacity",1),n.id="teste",n.setAttribute("scale","0.16 0.16 0.16"),n.setAttribute("rotation","90 0 0"),n.setAttribute("position","0 -0.08 -0.5"),s.appendChild(n);let a=document.createElement("a-entity");a.setAttribute("position","0 0 -0.4"),a.setAttribute("light",{type:"spot",color:"#FFF",intensity:.7}),s.appendChild(a),s.children[0].setAttribute("animation",{property:"troika-text.fillOpacity",to:0,dur:500,delay:7e3}),n.setAttribute("animation",{property:"gltf-material.opacity",from:1,to:0,dur:500}),this.data.hasLogos&&s.appendChild(this.createLogo("","#logocli",.2,.17,"0 0.14 -0.4")),o.cameraRig.appendChild(s),o.sceneEl.is("2d-mode")&&o.camera.setAttribute("look-controls","enabled",!1),this.permissions.mute||AFRAME.utils.device.isIOS()||(this.permissions.mute=!0,this.sessionHandler("mute")),setTimeout(function(){n.setAttribute("animation-mixer",{timeScale:.55,loop:"once",clampWhenFinished:!0}),n.setAttribute("sound",{src:"#introAudio",autoplay:!0})},1200),setTimeout(function(){o.deleteSphere(),o.data.hasIntro=!1,o.sessionHandler(2),o.permissions.fix||o.camera.setAttribute("look-controls","enabled",!0)},8e3)}else $("a-assets").append('<a-asset-item src="'+path+'generic/logo.js" id="introModel"></a-asset-item>'),$("a-assets").append('<audio id="introAudio" src="'+path+'generic/logo.mp3" crossorigin="anonymous"></audio>')}},setupEnvironment:function(){null==environment||jQuery.isEmptyObject(environment)||(Object.assign(o.environment,environment),null==o.environment.econtrol||jQuery.isEmptyObject(o.environment.econtrol)?(console.warn("Environment n\xe3o funciona corretamente sem econtrol!"),o.econtrol.setAttribute("environment",o.environment),this.sceneEl.appendChild(o.econtrol)):(null!=o.econtrol.getAttribute("econtrol")&&(o.econtrol.parentElement.removeChild(o.econtrol),o.econtrol=document.createElement("a-entity")),o.econtrol.setAttribute("econtrol",o.environment.econtrol),this.sceneEl.appendChild(o.econtrol),delete o.environment.econtrol))},createButton:function(e,s,n,a,r,l,c,h,u,d){let m;for(i=0;i<3;i++){let g=document.createElement("a-entity"),b=a,A;switch(i){case 0:g.setAttribute("position",l),g.setAttribute("clickable",""),g.setAttribute("collidable","group",this.collisionGroups[c]),g.dataset.aabbColliderDynamic=!0,g.classList.add(c),m=g,A=this.drawRound(e,s,n);break;case 1:b=r,A=this.drawRound(.95*e,.9*s,Math.min(.95*e,.9*s)/2),g.setAttribute("position","0 0 0.001"),m.appendChild(g);break;default:b=a,A=this.drawRound(.9*e,.81*s,Math.min(.9*e,.81*s)/2),g.setAttribute("position","0 0 0.002"),m.appendChild(g)}g.setAttribute("material","emissive",b),g.setAttribute("material","emissiveIntensity",.8),g.setObject3D("mesh",new THREE.Mesh(A,new THREE.MeshPhongMaterial({color:new THREE.Color(b),side:THREE.DoubleSide})))}return m.appendChild(this.createText(h,"center",u,"infinity",r,"0 0 "+(this.offset+.001),"0 0 0")),m.addEventListener("on",function(){m.setAttribute("scale","1.03 1.03 1.03"),m.firstChild.setAttribute("color",o.data.loadingColor),m.lastChild.setAttribute("color",o.data.loadingColor),m.firstChild.setAttribute("material","emissive",o.data.loadingColor)}),m.addEventListener("off",function(){m.setAttribute("scale","1 1 1"),m.firstChild.setAttribute("color",r),m.lastChild.setAttribute("color",r),m.firstChild.setAttribute("material","emissive",r)}),m.addEventListener("grab-start",function(){d()}),m.addEventListener("collidestart",function(e){"camera"!=e.detail.targetEl.origin&&"mouse"!=e.detail.targetEl.origin&&d()}),m},createText:function(e,s,n,a,r,l,c,h){let u=document.createElement("a-entity"),d=document.createElement("a-troika-text");if(d.setAttribute("value",e),d.setAttribute("align","justify"),d.setAttribute("anchor",s),d.setAttribute("max-width",a),d.setAttribute("font-size",n),d.setAttribute("color",r),d.setAttribute("rotation",c),d.setAttribute("position",l),null!=$("#"+h)[0]&&this.deleteText(h),null!=h&&d.setAttribute("id",h),!AFRAME.utils.device.isIOS())return d;{let m=document.createElement("a-troika-text");return m.setAttribute("value",""),u.appendChild(d),u.appendChild(m),u}},removeEl:function(e){e&&e.parentElement.removeChild(e)},deleteText:function(e){null!=$("#"+e)&&$("#"+e)[0].parentNode.removeChild($("#"+e)[0])},screenMsg:function(e,s){let n=o.initiateSphere();if(s){n.appendChild(o.createText(e,"center",.02,.45,o.data.textColor,"0 0.15 -0.4","0 0 0"));let a=o.svgImg(s);a.setAttribute("scale","0.15 0.15 0.15"),a.setAttribute("position","0 0 -0.4"),a.setAttribute("material","alphaTest",.15),n.appendChild(a)}else n.appendChild(o.createText(e,"center",.02,.45,o.data.textColor,"0 0 -0.4","0 0 0"));o.cameraRig.appendChild(n)},setupTurnBtn:function(){$("#turn-btn").css("top","10px"),$("#turn-btn").css("left","50%"),this.data.hasARMenu&&($("#turn-btn").css("top","50px"),$("#turn-btn").css("left","calc((100% - 176px)/2)")),$("#turn-btn").on("click",function(e){e.target.style.transform="scale(1.0)",setTimeout(()=>{e.target.style.transform="scale(1.1)"},100),o.selected.forEach(function(e,s,n){console.log(o.data.turnAxis),e.components.turnable&&(o.toKinematic(e),e.object3D.rotation[o.data.turnAxis]+=Math.PI/4,e.object3D.rotation[o.data.turnAxis]>=2*Math.PI&&(e.object3D.rotation[o.data.turnAxis]=0))})}),this.lim_min_y=0,this.lim_max_x=window.innerWidth,this.data.hasARMenu&&($("ar header").length&&(this.lim_min_y=$("ar header").height()),$("ar main").length&&(this.lim_max_x=window.innerWidth-$("ar main").width()))},setZoom:function(e,s,n){if(!(s>=this.lim_max_x)&&(!(n<this.lim_min_y)||0==n)&&this.data.hasZoom){if(this.zoom[0]+=e/10,this.zoom[0]>=1.3)return this.zoom[0]=1.2;if(this.zoom[0]<=.6)return this.zoom[0]=.7;if(e||(this.zoom[0]=1,dim2.object3D.position.y=0,this.data.hasARMenu?dim2.object3D.position.x=-.1:dim2.object3D.position.x=0),o.camera.setAttribute("fov",fov=this.zoom[1]*this.zoom[0]),o.camera.components.camera.camera.updateProjectionMatrix(),this.data.cursorZoom){let a=new THREE.Vector2(s,n),r=new THREE.Vector2(this.lim_max_x/2,(window.innerHeight-this.lim_min_y)/2);a.sub(r).divideScalar(2e3),o.dim2.object3D.position.x+=a.x*Math.sign(e),o.dim2.object3D.position.y-=a.y*Math.sign(e)}}},boxTrigger:function(e,s,n,a,r,l,c,h){let u=document.createElement("a-box");if(e&&u.setAttribute("id",e),u.setAttribute("class","boxTrigger"),u.setAttribute("depth",s),u.setAttribute("height",n),u.setAttribute("width",a),u.setAttribute("visible",!0),u.setAttribute("material","opacity",c),u.setAttribute("position",r),u.setAttribute("lasthit",0),u.setAttribute("clickable",""),u.setAttribute("collidable",""),l){if(u.addEventListener("collidestart",function(e){if(3==o.status){for(i=0;i<l.ids.length;i++)if($("#"+l.ids[i]).length)for(j=0;j<l.meshes.length;j++){let s=l.meshes[j];"#"==s.charAt(1)&&(s=s.charAt(0)+"s"+s.charAt(2));let n={name:l.meshes[j]};for(k=0;k<l.on.length;k+=2)n[l.on[k]]=l.on[k+1];$("#"+l.ids[i])[0].setAttribute("gltf-transform__"+s,""),$("#"+l.ids[i])[0].setAttribute("gltf-transform__"+s,n)}l.boombox&&o.boombox.start(l.boombox[0],l.boombox[1],l.boombox[2],l.boombox[3])}}),l.spring&&u.addEventListener("collideend",function(e){if(3==o.status){for(i=0;i<l.ids.length;i++)if($("#"+l.ids[i]).length)for(j=0;j<l.meshes.length;j++){let s=l.meshes[j];"#"==s.charAt(1)&&(s=s.charAt(0)+"s"+s.charAt(2));let n={name:l.meshes[j]};for(k=0;k<l.off.length;k+=2)n[l.off[k]]=l.off[k+1]||!1;$("#"+l.ids[i])[0].setAttribute("gltf-transform__"+s,n)}l.boombox&&o.boombox.stop(l.boombox[0],l.boombox[1],l.boombox[2])}}),o.triggers.push(u),!h)return u;$(h)[0].appendChild(u)}},createQuestion:function(e,s,n){let a=e;if(this.dur.push(0),e=o.questions[e],8==this.status&&(this.status=7,this.changeTargetClass(),this.status=8),this.sceneEl.is("vr-mode")&&this.camera.setAttribute("look-controls","enabled",!1),!e){if("f"!=this.mode.charAt(0)&&o.camera.setAttribute("look-controls","enabled",!0),!questions)return;"feedback"==s?(this.screenMsg("Obrigado pelo feedback!","happy"),this.fillForm(),setTimeout(function(){o.endQuestion()},3e3)):o.endQuestion();return}if("entry"==e[e.length-1].slice(0,5)&&questions.length!=this.questions.length&&null!=this.results&&7==this.status){let r="Voc\xea acertou "+this.results[1]+" quest\xf5es de "+this.results[0]+"!";1==this.results[1]&&(r="Voc\xea acertou "+this.results[1]+" quest\xe3o de "+this.results[0]+"!"),this.results[1]/this.results[0]>=.6?this.screenMsg(r,"happy"):this.screenMsg(r,"sad"),o.fillResults(),setTimeout(function(){o.createQuestion(0)},3e3);return}let l=this.initiateSphere(n);o.cameraRig.appendChild(l);let c;for(i=0;i<e.length;i++){let h,u=Math.ceil(e[i].length/60),d=document.createElement("a-entity");if(l.appendChild(d),d.setAttribute("material",{emissive:this.data.questionColor,transparent:!0}),"entry"==e[i].slice(0,5)){null!=form&&(o.form[0]=form,o.form.push(e[i]));return}if(0==i)d.setAttribute("position","0 0.15 -0.4"),d.setAttribute("material",{emissiveIntensity:2.5,opacity:1}),d.appendChild(this.createText(e[i],"center",.015,.45,this.data.textColor,"0 0 0.001","0 0 0")),h=this.drawRound(.5,.03+.02*u,.02),d.setAttribute("h",.15-(.03+.02*u)/2);else{d.setAttribute("material",{emissiveIntensity:2,opacity:.7}),d.setAttribute("class","qclickable"),d.setAttribute("clickable",""),"x"==e[i].charAt(0)&&(c=d,e[i]=e[i].substring(1)),d.appendChild(this.createText(e[i],"left",.015,.42,this.data.textColor,"-0.21 0 0.001","0 0 0")),h=this.drawRound(.45,.02+.02*u,.02);let m=d.previousSibling.getAttribute("h")-(.02+.02*u)/2-.015;d.setAttribute("h",m-(.02+.02*u)/2),d.setAttribute("position","0 "+m+" -0.4"),d.addEventListener("hover-start",function(){d.setAttribute("material",{emissiveIntensity:2.5,opacity:1})}),d.addEventListener("hover-end",function(){d.setAttribute("material",{emissiveIntensity:2,opacity:.7})}),d.addEventListener("grab-start",function(){if(!c){o.form.push(this.children[0].getAttribute("value")),setTimeout(function(){o.questions.splice(a,1),7==o.status?o.createQuestion(0,"feedback"):(o.deleteSphere(),o.sceneEl.emit("action"))},3e3),this.setAttribute("material",{emissive:"#008000"}),$(".qclickable").removeClass("qclickable");return}if(o.results[0]++,c.setAttribute("material",{emissive:"#008000"}),this==c){l.appendChild(o.createText("Resposta Certa!","center",.015,.45,"#008000","0 0.22 -0.4","0 0 0"));let e=o.svgImg("happy");e.setAttribute("scale","0.04 0.04 0.04"),e.setAttribute("position","0.09 0.22 -0.4"),l.appendChild(e),o.results[1]++}else{l.appendChild(o.createText("Resposta Errada!","center",.015,.45,"#800000","0 0.22 -0.4","0 0 0")),this.setAttribute("material",{emissive:"#800000"});let s=o.svgImg("sad");s.setAttribute("scale","0.04 0.04 0.04"),s.setAttribute("position","0.09 0.22 -0.4"),l.appendChild(s)}$(".qclickable").removeClass("qclickable"),setTimeout(function(){o.questions.splice(a,1),7==o.status?o.createQuestion(0):(o.deleteSphere(),o.sceneEl.emit("action"))},3e3)},{once:!0})}d.setObject3D("mesh",new THREE.Mesh(h,new THREE.MeshPhongMaterial({color:new THREE.Color(this.data.buttonColor),side:THREE.DoubleSide})))}},endQuestion:function(){o.sceneEl.is("2d-mode")?(o.deleteSphere(),$("#pause").hide(),$("#play").hide(),$("#playmsg").hide(),o.data.has2DMenu&&o.overlayMenu()):o.data.has3DMenu&&o.toggleMenu(),o.status=4,o.changeTargetClass(),o.end=!0},iniState:function(){this.fadeIn("#000"),setTimeout(function(){$("a-scene *").each(function(){if("A-ASSETS"==this.tagName||"A-ASSETS"==this.parentElement.tagName||"DIV"==this.tagName||"CANVAS"==this.tagName||"BUTTON"==this.tagName||"svgCursor"==this.id||this.classList.contains("environment")||this==o.lid)return;let e={},s,n;for(i=0;i<o.baseline.length;i++)if(o.baseline[i].el==this){e=o.baseline[i],s=!0;break}if(!s){this.parentNode.removeChild(this);return}for(let a in this.components){if(!(a in e)){this.removeAttribute(a);continue}if(a.includes("gltf-transform")){var r=this.components[a].original,l=this.getAttribute(a).name,c=this.getObject3D("mesh");if(!c)return;c.traverse(function(e){e.isMesh&&l&&e.name==l&&(e.position.copy(r[0]),e.rotation.copy(r[1]),e.scale.copy(r[2]))});continue}if(a.includes("gltf-material")){this.setAttribute(a,"reset",!0);continue}if(!("gltf-model"==a||"gltf-submodel"==a||a.includes("gltf-transform")||a.includes("gltf-material")||"id"==a||a.includes("event-set"))){if("mixin"==a){n=e[a],this.setAttribute("mixin",e[a]);continue}if("animation-mixer"==a&&"*"==this.getAttribute("animation-mixer").clip){let h="clip:'' "+e[a];this.setAttribute(a,h),this.setAttribute("animation-mixer","clip","*");continue}a.includes("animation")||(""==this.components[a]?""!=e[a]&&this.setAttribute(a,e[a]):this.setAttribute(a,e[a]))}}this.components.body&&this.classList.contains("ignore-ray")}),$("#rhandcursorimg")[0].setAttribute("scale","0.3 0.3 0.3"),$("#lhandcursorimg")[0].setAttribute("scale","0.3 0.3 0.3"),null!=o.econtrol&&o.setupEnvironment(),setTimeout(function(){o.fadeOut(),o.changeRaycaster(),o.startMedia(),o.sessionHandler(2)},200)},300)},registerIniState:function(){$("a-scene *").each(function(){if("A-ASSETS"==this.tagName||"A-ASSETS"==this.parentElement.tagName||"DIV"==this.tagName||"CANVAS"==this.tagName||"BUTTON"==this.tagName||"svgCursor"==this.id||this.classList.contains("environment"))return;let e={el:this};for(i=0;i<this.attributes.length;i++)e[this.attributes[i].nodeName]=this.attributes[i].nodeValue;if("A-CAMERA"==this.tagName){let s=o.camera.object3D.position;null!=s&&(e.position=s.x+" "+s.y+" "+s.z)}o.baseline.push(e)}),$("video").each(function(){this.pause(),this.currentTime=0}),$("audio").each(function(){this.pause(),this.currentTime=0}),$("[sound]").each(function(){this.components.sound.stopSound()})},startMedia:function(){for(i=0;i<this.media.length;i++)null!=this.media[i].components&&null!=this.media[i].components.sound?(o.media[i].components.sound.playSound(),this.media[i].components.sound.pauseSound()):(this.media[i].currentTime=0,o.media[i].play(),this.media[i].pause());this.permissions.mute||(this.permissions.mute=!0,this.sessionHandler("mute"))},sessionHandler:function(e,s){if(3==e&&(e="play"),4==e&&(e="pause"),5==e&&(e="replay"),6==e&&(e="mute"),9==e&&(e="exit"),this.masterControl(e),1==e)o.status=1,null!=o.timeline.pre&&(this.timeline.pre(),delete this.timeline.pre);else if(2==e)this.status=2,null!=o.timeline.pre&&(this.timeline.pre(),delete this.timeline.pre),$("a-scene canvas").show(),this.data.hasIntro?this.showIntro(!0):this.sceneEl.is("2d-mode")?(this.data.hasARMenu?$("ar").css("display","flex"):this.menu2DIsOpen||($("ar").hide(),this.overlayMenu()),this.logo2d(!1),this.toggleZoom(!0)):this.sceneEl.is("vr-mode")?($("ar").hide(),this.logo2d(!1),this.toggleZoom(!1),this.menu3DIsOpen||this.toggleMenu(!0)):this.sceneEl.is("ar-mode")&&(this.logo2d(!0),this.toggleZoom(!0),this.data.hasARMenu&&$("ar").css("display","flex"));else if("play"==e){if(this.data.hasIntro){this.sessionHandler(2);return}if(this.end&&!this.replay||(this.data.has3DMenu&&this.menu3DIsOpen&&this.toggleMenu(),!s&&(7==o.status||8==o.status)))return;o.override(s)&&(hide&&this.status<=2&&this.startMedia(),this.playSession(),this.status=3),this.changeTargetClass()}else if("pause"==e){if(!o.override(s)||(this.status=4,this.pauseSession(),this.sceneEl.is("2d-mode")&&this.data.has2DMenu))return;this.sceneEl.is("vr-mode")&&this.data.has3DMenu&&this.toggleMenu()}else if("replay"==e){if(!o.override(s))return;this.status=5,this.changeTargetClass(),this.replay=!0,this.pauseSession(),this.wasPlaying=[],this.delay+=this.run,this.run=0,null!=timeline&&Object.assign(o.timeline,timeline),$("#playmsg").show(),$("#play").show(),this.iniState()}else if("mute"==e){if(this.permissions.mute)for($("#mute").html("volume_up"),$("#mute").css("color","#D0D0D0"),i=0;i<o.media.length;i++)null!=o.media[i].components&&null!=o.media[i].components.sound?o.media[i].setAttribute("sound","volume",1):(o.media[i].muted=!1,o.media[i].volume=1);else for($("#mute").html("volume_off"),$("#mute").css("color","red"),i=0;i<o.media.length;i++)null!=o.media[i].components&&null!=o.media[i].components.sound?o.media[i].setAttribute("sound","volume",0):(o.media[i].muted=!0,o.media[i].volume=0);this.permissions.mute=!this.permissions.mute}else if(7==e){if(this.status=7,this.changeTargetClass(),this.pauseSession(),this.replay&&this.end)return;this.sceneEl.is("2d-mode")&&this.data.has2DMenu&&this.overlayMenu(),this.createQuestion(0)}else if(8==e){if(8!=this.status)return;this.sceneEl.is("2d-mode")&&this.data.has2DMenu&&this.overlayMenu(),this.sessionHandler("play",!0),this.changeTargetClass(),o.fillResults("action")}else if("exit"==e){if(!o.override(s))return;if(!jQuery.isEmptyObject(this.questions))return this.sessionHandler(7);for(i=0;i<o.media.length;i++)null!=o.media[i].components&&null!=o.media[i].components.sound?o.media[i].components.sound.stopSound():(o.media[i].currentTime=0,o.media[i].pause());this.sceneEl.is("2d-mode")&&this.camera.setAttribute("look-controls","enabled",!1),this.screenMsg("Obrigado por assistir!"),setTimeout(function(){o.sceneEl.is("vr-mode")?(o.screenMsg("Retire o seu \xf3culos."),setTimeout(function(){dev?document.location.reload(!0):window.location.href="../estudar/index.html"},1e4)):dev?document.location.reload(!0):window.location.href="../estudar/index.html"},2500)}},pauseSession:function(e){$("video").each(function(){!this.classList.contains("peervideo")&&this.playing&&(this.pause(),o.wasPlaying.push([this,"video",!0]))}),$("audio").each(function(){!this.classList.contains("peeraudio")&&this.playing&&(this.pause(),o.wasPlaying.push([this,"audio",!0]))}),$("a-scene *").each(function(){"svgCursor"==this.id||this.classList.contains("peer")||null==this.components||Object.keys(this.components).forEach(e=>{"animation-mixer"==e?0!=this.components[e].data.timeScale&&(o.wasPlaying.push([this,e,this.components[e].data.timeScale]),this.setAttribute("animation-mixer",{timeScale:0})):e.includes("animation")&&null!=this.components[e].animation&&this.components[e].animationIsPlaying&&this!=o.lid&&null!=this.getAttribute("pOnP")&&this.getAttribute("pOnP")?(this.components[e].animationIsPlaying=!1,o.wasPlaying.push([this,e,!0])):"sound"==e&&this.components.sound.isPlaying?(this.components.sound.pool.children[0]._progress=o.run/1e3,this.components.sound.pauseSound(),o.wasPlaying.push([this,e,!0])):"buzzer"==e&&this.components.buzzer.oscillator&&(this.components.buzzer.oscillator.disconnect(),o.wasPlaying.push([this,e,!0]))})}),$("#pause").text("play_arrow"),$("#pause").attr("id","play"),o.movementType&&o.cameraRig.setAttribute("movement-controls","enabled",!1)},playSession:function(e){o.wasPlaying.forEach(e=>{switch(e[1]){case"video":case"audio":e[0].play();break;case"animation-mixer":e[0].setAttribute("animation-mixer","timeScale",e[2]);break;case"sound":e[0].components.sound.playSound();break;case"buzzer":e[0].components.buzzer.oscillator.connect(e[0].components.buzzer.gainNode);break;default:e[0].components[e[1]].animationIsPlaying=!0}}),o.wasPlaying=[],$("#play").text("pause"),$("#play").attr("id","pause"),$("#playmsg").hide(),o.movementType&&o.cameraRig.setAttribute("movement-controls","enabled",!0)},userAction:function(e,s,n,a){this.status=8,this.pauseSession(),this.menu2DIsOpen&&this.overlayMenu(),this.menu3DIsOpen&&this.toggleMenu(),"question"==e?(o.createQuestion(s,"",n?1:0),o.sceneEl.addEventListener("action",function(){o.sceneEl.removeEventListener("action",function(){}),a&&a(),o.sessionHandler(8)},{once:!0})):"action"==e?(this.dur.push(0),s.classList.add("aclickable"),this.changeTargetClass(),o.sceneEl.addEventListener("action",function(){s.classList.remove("aclickable"),o.sceneEl.removeEventListener("action",function(){}),a&&a(),n&&s.parentElement.removeChild(s),o.sessionHandler(8)},{once:!0})):(this.dur.push(0),this.changeTargetClass())},rewind:function(e){o.delay+=o.run-1e3*e},setupCamera:function(){let e=document.createElement("a-plane");e.setAttribute("width",5),e.setAttribute("height",5),e.setAttribute("material",{color:this.data.menuColor}),e.setAttribute("opacity",0),e.setAttribute("visible",!1),e.setAttribute("position","0 0 -0.1"),this.camera.appendChild(e),this.lid=e,e.setAttribute("animation__fadein",{property:"material.opacity",startEvents:"fadein",from:0,to:1,dur:150,easing:"linear"}),e.setAttribute("animation__fadeout",{property:"material.opacity",startEvents:"fadeout",from:1,to:0,dur:150,easing:"linear"})},fadeIn:function(e){this.lid.setAttribute("material",{color:e||this.data.menuColor}),this.lid.setAttribute("visible",!0),this.lid.emit("fadein")},fadeOut:function(){this.lid.emit("fadeout"),setTimeout(function(){o.lid.setAttribute("visible",!1)},100)},fadeTo:function(e,s,n,a){this.fadeIn(e),setTimeout(function(){o.lid.setAttribute("visible",!1),null!=a&&a(),s&&(o.cameraRig.setAttribute("position",s),n&&o.cameraRig.setAttribute("rotation",n))},250),setTimeout(function(){o.fadeOut()},500)},navigation:function(){o.camera.setAttribute("wasd-controls","enabled",!1),$("a-assets").append('<a-mixin id="checkpoint" geometry="primitive: cylinder; radius: 0.5;height:0.01" material="color: #39BB82" checkpoint clickable hoverable></a-mixin>'),o.cameraRig.addEventListener("navigation-start",function(e){"teleport"==e.target.getAttribute("checkpoint-controls").mode&&o.fadeIn("black")}),o.cameraRig.addEventListener("navigation-end",function(e){"teleport"==e.target.getAttribute("checkpoint-controls").mode&&o.fadeOut()}),o.curveRay=document.createElement("a-entity"),o.sceneEl.appendChild(o.curveRay);let e=o.mode.charAt(0);"f"==e||"r"==e?this.movementType=!1:"w"==e?(this.movementType="wasd",console.log(this.movementType+" movement"),o.cameraRig.setAttribute("movement-controls",{fly:o.data.cursorFly,controls:"gamepad,trackpad,keyboard,touch",enabled:!1,speed:.2,camera:o.camera})):("p"==e||"g"==e||"c"==e)&&(this.movementType="checkpoint",console.log(this.movementType+" movement"),o.cameraRig.setAttribute("movement-controls",{controls:"checkpoint",enabled:!1}),o.cameraRig.setAttribute("checkpoint-controls","mode","animate")),this.movementType&&$("[nav]").length&&(console.log("navmesh constrained"),o.cameraRig.setAttribute("movement-controls","constrainToNavMesh",!0))},setupOnline:function(){AFRAME.registerComponent("onlinerig",{schema:{},init:function(){createdAudios={},this.v=new THREE.Vector3,("master"==userType||"user0"==userType)&&(o.cameraRig.setAttribute("position",seats[0][0]),o.cameraRig.setAttribute("rotation",seats[0][1]))},tick:function(){if(!peerConnected&&!localCaller)return;!master&&$("#play").is(":visible")&&($("#play").hide(),$("#playmsg").hide(),$("#replay").hide(),$("#exit").hide());let e=[o.cameraRig,o.camera,o.lhand,o.rhand];for(i=0;i<e.length;i++){if(!e[i])return;e[i].getAttribute("online-el")||e[i].setAttribute("online-el",localCaller+"-"+i)}for(let s in o.selfAvatar.defined&&!o.selfAvatar.sent&&(o.selfAvatar.sent=!0,o.cameraRig.components["online-el"].props=o.selfAvatar),peer)remoteQueue[s+"-0"]&&remoteQueue[s+"-0"][1]?createdEls[s]||(createdEls[s]=!0,this.createAvatar(s)):createdEls[s]&&(this.deleteAvatar(s),delete createdEls[s])},createAvatar:function(e){console.log("avatar created",e);let s=remoteQueue[e+"-0"][1],n=document.createElement("a-entity");n.setAttribute("class","peer"),n.setAttribute("visible",!1),n.setAttribute("online-el",e+"-0");let a=document.createElement("a-entity");a.setAttribute("class","body"),a.setAttribute("position","0 1.6 0"),"Homem"==s.type?a.setAttribute("gltf-submodel",{src:"#avatars",part:"m2body"}):"Homem1"==s.type?a.setAttribute("gltf-submodel",{src:"#avatars",part:"m1body"}):"Mulher"==s.type&&a.setAttribute("gltf-submodel",{src:"#avatars",part:"w1body"}),a.setAttribute("gltf-material__hands",{materials:"hands",opacity:0}),a.setAttribute("gltf-material__skin",{materials:"skin",color:s.color}),a.setAttribute("online-el",e+"-1"),n.appendChild(a);let r=o.createText(s.name,"center",.15,"infinity","black","0 0.7 0","0 0 0");r.setAttribute("rotation","0 180 0"),a.appendChild(r);let l=document.createElement("a-entity");l.setAttribute("class","lhand"),l.setAttribute("visible",!1),l.setAttribute("gltf-model","https://cdn.aframe.io/controllers/hands/leftHandLow.glb"),l.setAttribute("gltf-material__skin",{materials:"hands",color:s.color}),l.setAttribute("online-el",e+"-2"),n.appendChild(l);let c=document.createElement("a-entity");c.setAttribute("class","rhand"),c.setAttribute("visible",!1),c.setAttribute("gltf-model","https://cdn.aframe.io/controllers/hands/rightHandLow.glb"),c.setAttribute("gltf-material__skin",{materials:"hands",color:s.color}),c.setAttribute("online-el",e+"-3"),n.appendChild(c),onlineAudio[e+"-0"]&&this.createAudio(n,e+"-0"),o.dim3.appendChild(n)},deleteAvatar:function(e){$(".peer").each(function(){this.components["online-el"].data==e+"-0"&&this.parentElement.removeChild(this)})},createAudio:function(e,s){let n=document.createElement("audio");n.setAttribute("autoplay","autoplay"),n.setAttribute("playsinline","playsinline");let a=Object.keys(onlineAudio).indexOf(s);return n.setAttribute("id","audio"+a),n.setAttribute("class","peeraudio"),n.srcObject=onlineAudio[s],n.muted=!0,n.volume=0,(o.status>2||2==o.status&&!o.data.hasIntro||master)&&(n.muted=!1,n.volume=1),e.appendChild(n),"#audio"+a}}),o.sceneEl.setAttribute("onlinerig",""),o.selfAvatar={type:"Homem",color:"#E8BEAC",name:"Orbinauta",defined:!1,sent:!1},$("#av-type p").on("click",function(e){$("#av-type p").removeClass("av-active"),o.selfAvatar.type=jQuery(this).text(),jQuery(this).addClass("av-active")}),$("#av-color p").on("click",function(e){$("#av-color p").removeClass("av-active"),o.selfAvatar.color=jQuery(this).css("background-color"),hide||$("#overlay").css("background-color",o.selfAvatar.color),jQuery(this).addClass("av-active")}),$("#av-pick button").on("click",function(e){let s=$("#av-pick input").val();if(s){o.selfAvatar.name=s,o.selfAvatar.defined=!0,$("#overlay").hide(),o.changeMode($("#av-pick").attr("mode")),hide||(o.openFullscreen(),o.startMedia()),o.tryKeepScreenAlive(10),o.sessionHandler(2);let n=Object.keys(onlineAudio);for(i=0;i<n.length;i++)$("#audio"+i).length&&($("#audio"+i)[0].muted=!1,$("#audio"+i)[0].volume=1)}else $("#av-pick input").css("border","solid 2px red")})},pingDC:function(e,s,n){e.forEach(function(e,a,r){if("open"!=e.readyState)return;let l={};l[s]=n,e.send(JSON.stringify(l))})},override:function(e){return!(this.multi&&!master&&!e&&peerConnected)},masterControl:function(e){this.multi&&master&&dC2s.forEach(function(s){"open"==s.readyState&&s.send(JSON.stringify([e]))})},muteMedia:function(e){if(!master)return;let s=jQuery(e.parentElement).data("conid"),n=!e.checked,a="audio";if("v"==e.name.slice(-1)&&(a="video"),"audio"==a){let r=Object.keys(onlineAudio).indexOf(s);n?($("#audio"+r)[0].volume=0,$("#audio"+r)[0].muted=!0):($("#audio"+r)[0].volume=1,$("#audio"+r)[0].muted=!1)}dC2s.forEach(function(e){"open"==e.readyState&&e.send(JSON.stringify([s,a,n]))})},muteAllMedia:function(e="audio"){if(!master)return;let s=!el.checked;if("video"==e&&(e="video"),"audio"==e){let n=Object.keys(onlineAudio);for(i=0;i<n.length;i++)s?($("#audio"+index)[0].volume=0,$("#audio"+index)[0].muted=!0):($("#audio"+index)[0].volume=1,$("#audio"+index)[0].muted=!1)}dC2s.forEach(function(n){"open"==n.readyState&&n.send(JSON.stringify([conid,e,s]))})},simulate:function(){if((!this.data.hasIntro||this.data.hasARMenu)&&(this.audioCtx||(this.audioCtx=new(window.AudioContext||window.webkitAudioContext||window.audioContext)),3==this.status?(this.sessionHandler("pause"),$("#playProg p").text("Simular"),$("#playProg i").text("play_arrow")):(this.sessionHandler("play"),$("#playProg p").text("Parar"),$("#playProg i").text("stop")),this.permissions.msg)){let e=this.sta;this.iframe.firstMsg||(e=this.evt),e.simulation.status=3==this.status?"running":"stopped";let s=e.simulation;this.sendMsg({simulation:s}),evt.simulation=e.simulation}},slideMode:function(e){e.disabled=!0,e.checked?(o.changeMode(e.parentElement.children[3].innerHTML+"-mode"),e.previousElementSibling.className="notactive",e.nextElementSibling.nextElementSibling.className="active"):(o.changeMode("2d-mode"),e.previousElementSibling.className="active",e.nextElementSibling.nextElementSibling.className="notactive"),setTimeout(function(){e.disabled=!1},2e3)},getPins:function(e){for(i=0;i<$("[epart]").length;i++){let s=$("[epart]")[i].getAttribute("epart");if(e==s.name[1])return s.cons}return[3,4]},getName:function(e){for(i=0;i<$("[epart]").length;i++){let s=$("[epart]")[i].getAttribute("epart");if(e==s.name[1])return s.name[0]}return""},getMain:function(){for(i=0;i<$("[epart]").length;i++){let e=$("[epart]")[i].getAttribute("epart");if(e.main)return e.name[1]}return""},loadARMenu:function(){$("ar main").empty(),$("ar main").append("<row></row>"),$("ar main").append("<footer></footer>"),loadARMenu(),$("ar main footer").append('<p id="ar_version">'+modName+" <b>"+version+"</b></p>"),o.selectListeners()},addARTitle:function(e,s){let n="notactive";0==$("ar main row p").length&&(n="active"),$("ar main row").append('<p id="'+s+'" onclick="o.openSubMenu(this.id)" class="'+n+'">'+e+"</p>"),$("ar main").append('<div id="'+s+'-sub" class="scroller"></div>')},addARSection:function(e,s){for($("#"+e+"-sub").empty(),i=0;i<s.length;i++)$("#"+e+"-sub").append(s[i])},addARPart:function(e,s,n,a,r){$("#"+a).remove();let l="",c;for(ARstate&&o.sceneEl.is("ar-mode")&&(c=o.getObj(ARstate,s).position),l+='<article class="ar_part"><span><label><input type="checkbox"',c&&(l+=" checked"),l+=' id="'+a+'_check" onclick="o.openPart(this.id)"><div><b>✓</b></div></label><p onclick="o.openPart(this)">'+n+'</p></span><ul id="'+a+'_colap"',c&&(l+=' style="display:block"'),l+=">",i=0;i<r.length;i++)l+="<li>"+r[i]+"</li>";l+="</ul></article>",$("#"+e+"-sub").append(l)},openSubMenu:function(e){o.loadARMenu();"active"!=$("#"+e).attr("class")&&($("#"+e)[0].parentNode.querySelector(".active").className="notactive",$("#"+e)[0].className="active",$(".scroller").hide(),$("#"+e+"-sub").show(),$("ar main footer").empty(),$("ar main footer").append('<p id="ar_version">'+modName+" <b>"+version+"</b></p>"))},btnCreate:function(e){let s="<section><h4>Bot\xf5es</h4><spans>";for(i=0;i<e;i++)s+="<span><span id='button_"+i+"' onmousedown='o.btnClick(this.id,1)' onmouseup='o.btnClick(this.id,0)'><span></span></span><p>B"+i+"</p></span>";return s+"</spans></section>"},subCreate:function(e){return"<section><h4>"+e+"</h4></section>"},infoCreate:function(e,s,n,a){return"<span class='ar_info' id='"+s+"'><p>"+e+"</p><p>"+n+" "+a+"</p></span>"},warnCreate:function(e,s){return"<span class='ar_warn'><p id='"+s+"'>"+e+"</p></span>"},checkCreate:function(e,s){return'<label class="ar_check" id="'+s+'"><input onclick="o.checkClick(this.parentElement)" type="checkbox"><div><b>✓</b></div><p>'+e+"</p></label>"},submitCreate:function(e,s){return"<section class='ar_submit' id='"+s+"'><p>"+e+"</p></section>"},switchCreate:function(e,s){let n="<section style='height:auto'><h4>"+e+"</h4>";return e||(n="<section style='height:auto'>"),s.forEach(function(e){let s="active",a="notactive",r;ARstate&&1==o.getObj(ARstate,e[0])&&(s="notactive",a="active",r=!0),n+='<article class="ar_slider"><p class="'+s+'" onclick="o.switchClick(this.className,this)">'+e[1]+'</p><label><input type="checkbox"',r?n+=' checked data-val="0"':n+=' data-val="1"',n+=' id="'+e[0]+'" onclick="o.switchClick(this.id)"><div class="toggle round"></div></label><p class="'+a+'" onclick="o.switchClick(this.className,this)">'+e[2]+"</p></article>"}),n+"</section>"},sliderCreate:function(e,s){let n=ARparams[e+"val"],a=o.getObj(ARstate,e);"object"!=typeof a||Array.isArray(a)||null===a||(a=a.value),ARstate&&n&&n[0]&&(ARparams[e+"val"][0]=a);let r="<section><p>";return"ldr"==e?r+=s:""!=n[3]?r+=s+" ("+n[3]+")":r+=s,r+="</p><div class='slidecontainer'><input type='range' min='"+n[1]+"' max='"+n[2]+"' value='"+Math.round(o.map(n[0],0,1,n[1],n[2]))+"' class='slider' id='"+e+"_range' oninput='o.sliderClick(this.id)'>",null!=n[4]?r+="<p style='position:absolute;bottom: 14px;left: 0px;'><i class='material-icons-outlined md-16'>"+n[4]+"</i></p>":r+="<p style='position:absolute;bottom: 14px;left: 5px;'>"+n[1]+"</p>",r+="<b class='rangeval'>"+Math.round(o.map(n[0],0,1,n[1],n[2]))+"</b>",null!=n[5]?r+="<p style='position: absolute; bottom: 14px; right:-5px;'><i class='material-icons-outlined md-16'>"+n[5]+"</i></p>":r+="<p style='position: absolute; bottom: 14px; right:-5px;'>"+n[2]+"</p>",r+="</div></section>"},selectCreate:function(e){let s='<span class="material-icons-outlined md-20" style="visibility:hidden">add_box</span>';return s+="<h5>"+e[1]+"</h5>",s+=o.returnOptions(e[2],e[0].slice(-1),e[0].slice(0,-1),e[3],e[2].charAt(0))},selectMultiCreate:function(e,s){let n='<span class="material-icons-outlined md-20"';return s?n+=' onclick="o.removeSelect(this)" data-arr="'+e+'">indeterminate_check_box</span>':n+=' onclick="o.addSelect(this)" data-arr="'+e+'">add_box</span>',n+="<h5>"+e[1]+"</h5>",n+=o.returnOptions(e[2],e[0].slice(-1),e[0].slice(0,-1),e[3],e[2].charAt(0),!0)},addSelect:function(e){let s=e.dataset.arr.split(",");if(3==$("."+s[2]+s[0].substring(s[0].length-1)+"."+s[0].slice(0,-1)).length)return;let n=[s[0],s[1],s[2]],a=[];for(i=3;i<s.length;i++)a.push(s[i]);n[3]=a,$(e.parentElement).after("<li>"+o.selectMultiCreate(n,!0)+"</li>"),o.selectListeners()},removeSelect:function(e){let s=e.parentElement.getElementsByTagName("select")[0];s.value="",$(s).trigger("change"),$(e.parentElement).remove()},returnOptions:function(e,s,n,a,r,l){let c="<select class='"+e+s+" "+n+"'>",h="<option></option>";for(i=0;i<a.length;i++){let u=!1,d=String(a[i]).split(" ");ARparams.multiple||(a[i]=d[0]),null!=o.ARwires[n+s]&&o.ARwires[n+s][r]&&o.ARwires[n+s][r].includes(a[i])&&!l?(c="<select class='"+e+s+" "+n+"' old='"+a[i]+"'>",h+="<option selected='selected'>"):(h+="<option",o.usedPins.includes(a[i])&&(u=!0),$("."+e+s+"."+n).each(function(){$(this).val()==a[i]&&(u=!0)}),u&&(h+=" disabled='true'"),h+=">"),h+=a[i],h+="</option>"}return c+(h+="</select>")},isPart:function(e,s){var n;for(var a in e)if((e=e.parentNode).nodeName==s){n=!0;break}return n},btnClick:function(e,s){1==s?document.getElementById(e).nextElementSibling.className="active":document.getElementById(e).nextElementSibling.className="notactive",o.setEvt(ARstate,e,{value:s})},switchClick:function(e,s){let n=0,a=document.getElementById(e);if(a)a.checked?(a.parentElement.previousElementSibling.className="notactive",a.parentElement.nextElementSibling.className="active",n=1):(a.parentElement.previousElementSibling.className="active",a.parentElement.nextElementSibling.className="notactive");else{if("active"==e)return;a=s.parentElement.querySelector("label input"),s.parentElement.querySelector(".active").className="notactive",s.className="active",s.nextElementSibling?a.checked=!1:(a.checked=!0,n=1),e=a.id}!ARstate||jQuery.isEmptyObject(ARstate)||(o.setEvt(ARstate,e,{value:n}),o.iframe.newMsg=!0)},sliderClick:function(e){var s=e.slice(0,-6),n=document.getElementById(e),a=n.parentElement.querySelector(".rangeval");let r=o.map(n.value,ARparams[s+"val"][1],ARparams[s+"val"][2],0,1);ARparams[s+"val"][0]=r,a.innerHTML=n.value,"ldr"==s&&(o.sceneEl.is("2d-mode")?o.canvas.alpha(Math.max(100-100*r,10)):$("video").css("filter","brightness("+200*r+"%)")),o.setEvt(ARstate,s,{value:r})},checkClick:function(e){if(o.setEvt(ARstate,e.id,{value:e.firstChild.checked?1:0}),"dots_eraser"==e.id){let s=$(".dotX");for(i=0;i<s.length;i++)s[i].object3D.visible=!!e.firstChild.checked}},openPart:function(e,s){let n;"string"!=typeof e?(e=$(e.parentElement)[0].querySelector("label input").id,(n=document.getElementById(e)).checked=!n.checked):n=document.getElementById(e);let a=e.slice(0,-6),r=document.getElementById(a+"Model");if(!o.sceneEl.is("ar-mode")){n.checked?(n.setAttribute("manual",!0),document.getElementById(a+"_colap").style.display="block",r.setAttribute("visible",!0),r.emit("show")):(n.removeAttribute("manual"),document.getElementById(a+"_colap").style.display="none",r.setAttribute("visible",!1),r.emit("hide"));return}if(s){r.setAttribute("visible",!0),n.checked=!0,document.getElementById(a+"_colap").style.display="block";return}n.checked?(r.setAttribute("visible",!0),document.getElementById(a+"_colap").style.display="block"):(r.setAttribute("visible",!1),document.getElementById(a+"_colap").style.display="none",$("#turn-btn").css("display","none"))},selectListeners:function(e){$(".ar_part select").off("change"),$(".ar_part select").on("change",function(e){3==this.status&&$("#playProg").click();let s=$(e.target).attr("old"),n=e.target.classList[0],a=n.substring(0,1),r=$(e.target).val(),l;if(""!=r){if(l=r.split(" ")[1]?r.split(" ")[1]:o.getMain(),s){if(s&&r!=s){var c=o.usedPins.indexOf(s);-1!==c&&o.usedPins.splice(c,1),$(e.target).attr("old",r)}}else $(e.target).attr("old",r)}else{var c=o.usedPins.indexOf(s);-1!==c&&o.usedPins.splice(c,1),$(e.target).removeAttr("old")}let h=n.substring(n.length-1),u=e.target.classList[1],d=u+h;if(l&&!ARparams.multiple&&o.usedPins.push(r),document.querySelectorAll(".ar_part ul select").forEach(e=>{[...e.children].forEach(e=>{""==e.value||e.selected||(o.usedPins.includes(e.value)?e.disabled=!0:e.disabled=!1,$("."+n+"."+u).each(function(){e.parentElement.classList[0]==n&&e.parentElement.classList[1]==u&&$(this).val()==e.value&&(e.disabled=!0)}))})}),o.ARwires[d]&&o.ARwires[d][a]&&s){let m=String(s).split(" ");m[1]||(m[1]=o.getMain());let g=d+"_"+a+"_"+m[1]+"_"+m[0];o.removeWire(g);let b=ARparams.autoPins[m[0]+" "+m[1]];if(b)for(i=0;i<b.length;i+=2){let A=String(b[i+1]).split(" "),v=d+"_"+b[i]+"_"+A[1]+"_"+A[0];o.removeWire(v)}}if(!(""==r||!r)&&(o.ARwires[d][a].push(r),ARparams.autoPins[r])){let y=ARparams.autoPins[r];for(i=0;i<y.length;i+=2)o.ARwires[d][y[i]].push(y[i+1])}let _={};_[n.slice(0,-1)]=r,o.setEvt(ARstate,o.getName(d),_)})},removeWire:function(e){let s=e.split("_"),n=o.ARwires.all.indexOf(e);n>-1&&(o.ARwires.all.splice(n,1),$("#"+e)[0].parentNode.removeChild($("#"+e)[0]));let a=o.ARwires[s[0]][s[1]].indexOf(s[3]+" "+s[2]),r=o.ARwires[s[0]][s[1]].indexOf(s[3]);a>-1?o.ARwires[s[0]][s[1]].splice(a,1):r>-1&&o.ARwires[s[0]][s[1]].splice(r,1)},loadAR:function(){o.canvas.style.backgroundColor=o.data.menuColor,o.dim2.setAttribute("visible",!0),o.dim2.setAttribute("geometry","primitive:plane;width:300; height:200;"),o.cameraRig.setAttribute("position","0 0 1"),o.camera.setAttribute("position","0 0 0"),o.data.targetClass="any",this.data.hasARMenu&&(o.dim2.object3D.position.x=-.1),ARparams&&ARparams.ldrval&&(o.sceneEl.is("2d-mode")?o.canvas.alpha(Math.max(100-100*ARparams.ldrval[0],10)):$("video").css("filter","brightness("+200*ARparams.ldrval[0]+"%)"))},oorbitComponents:function(){var e,s,n,a,r,l,c,h;$('<a-entity id="wires"></a-entity>').insertBefore("#cameraRig"),AFRAME.registerComponent("gltf-material",{multiple:!0,schema:{materials:{default:[null]},opacity:{default:1},emission:{type:"vec4",default:{x:0,y:0,z:0,w:0}},color:{type:"color"},reset:{default:!1}},init:function(){this.m={}},update:function(e){if(this.el.getAttribute("gltf-model")||this.el.getAttribute("gltf-submodel")){var s=this.el.getObject3D("mesh"),n=this.data,a=this;s&&s.traverse(function(s){if(s.isMesh&&!(null!=n.materials[0]&&(!n.materials.includes(s.material.name)||jQuery.isEmptyObject(e)))){if(a.m[s.material.name]||(a.m[s.material.name]={},a.m[s.material.name]={opacity:s.material.opacity,emissive:s.material.emissive.clone(),emissiveIntensity:s.material.emissiveIntensity,color:s.material.color.clone()}),n.reset){let r=a.m[s.material.name];a.el.setAttribute(a.attrName,{opacity:r.opacity,emission:r.emissive.clone().r+" "+r.emissive.clone().g+" "+r.emissive.clone().b+" 0",color:"#"+r.color.clone().getHexString(),reset:!1}),s.material.needsUpdate=!0;return}s.material.opacity=n.opacity,s.material.emissive.r=n.emission.x/255,s.material.emissive.g=n.emission.y/255,s.material.emissive.b=n.emission.z/255,s.material.emissiveIntensity=n.emission.w,n.color&&(s.material.color=new THREE.Color(n.color)),s.material.needsUpdate=!0}})}},events:{"model-loaded":function(){this.update()}}}),AFRAME.registerComponent("gltf-transform",{multiple:!0,schema:{name:{type:"string"},position:{type:"vec3"},rotation:{type:"vec3"},scale:{type:"vec3"},px:{type:"number"},py:{type:"number"},pz:{type:"number"},rx:{type:"number"},ry:{type:"number"},rz:{type:"number"},sx:{type:"number"},sy:{type:"number"},sz:{type:"number"}},init:function(){this.original=[new THREE.Vector3,new THREE.Euler,new THREE.Vector3],this.position=new THREE.Vector3,this.rotation=new THREE.Euler,this.scale=new THREE.Vector3,this.iniData={},Object.assign(this.iniData,this.data)},update:function(e){if(this.el.getAttribute("gltf-model")||this.el.getAttribute("gltf-submodel")){var s=this.el.getObject3D("mesh"),n=this.data,a=this,r=AFRAME.utils.diff(jQuery.isEmptyObject(e)?this.iniData:e,n);s&&s.traverse(function(s){if(s.isMesh&&n.name&&s.name==n.name){if(jQuery.isEmptyObject(e)){a.position.copy(s.position),a.rotation.copy(s.rotation),a.scale.copy(s.scale),a.update(n),a.original[0].copy(s.position),a.original[1].copy(s.rotation),a.original[2].copy(s.scale);return}a.checkVec3("position",s,r),a.checkVec3("rotation",s,r),a.checkVec3("scale",s,r),a.checkNum("position","x",s,r),a.checkNum("position","y",s,r),a.checkNum("position","z",s,r),a.checkNum("rotation","x",s,r),a.checkNum("rotation","y",s,r),a.checkNum("rotation","z",s,r),a.checkNum("scale","x",s,r),a.checkNum("scale","y",s,r),a.checkNum("scale","z",s,r)}})}},checkVec3:function(e,s,n){if(void 0!=n[e]&&(!n[e]||void 0!=n[e].x)&&n[e]){if(isNaN(n[e].x))return s[e].set(this[e].x,this[e].y,this[e].z);if(n[e].x||0==n[e].x)return s[e].set(n[e].x,n[e].y,n[e].z)}},checkNum:function(e,s,n,a){let r=e.charAt(0)+s;if(void 0!=a[r]){if(isNaN(a[r]))return n[e][s]=this[e][s];if(a[r]||0==a[r])return n[e][s]=a[r]}},events:{"model-loaded":function(){this.update()}}}),AFRAME.registerComponent("gltf-submodel",{schema:{buffer:{default:!0},part:{type:"string"},src:{type:"asset"}},init:function(){this.dracoLoader=document.querySelector("a-scene").systems["gltf-model"].getDRACOLoader(),o.LOADING_MODELS={},o.MODELS={}},update:function(){var e=this.el;this.data,(this.data.part||!this.data.src)&&this.getModel(function(s){s&&(e.setObject3D("mesh",s),e.emit("model-loaded",{format:"gltf",part:this.modelPart}))})},getModel:function(e){var s=this;if(o.MODELS[this.data.src]){e(this.selectFromModel(o.MODELS[this.data.src]));return}if(o.LOADING_MODELS[this.data.src])return o.LOADING_MODELS[this.data.src].then(function(n){e(s.selectFromModel(n))});o.LOADING_MODELS[this.data.src]=new Promise(function(n){var a=new THREE.GLTFLoader;s.dracoLoader&&a.setDRACOLoader(s.dracoLoader),a.load(s.data.src,function(a){var r=a.scene||a.scenes[0];o.MODELS[s.data.src]=r,delete o.LOADING_MODELS[s.data.src],e(s.selectFromModel(r)),n(r)},function(e){},function(e){})})},selectFromModel:function(e){var s,n;if(!(n=e.getObjectByName(this.data.part))){console.error("[gltf-part] `"+this.data.part+"` not found in model.");return}if(n.children.length>1){let a=new THREE.Group;for(i=0;i<n.children.length;i++)s=n.children[i].clone(!0),a.add(s);s=a}else{if(s=n.getObjectByProperty("type","Mesh").clone(!0),this.data.buffer)return s.geometry=s.geometry.toNonIndexed(),s;s.geometry=new THREE.Geometry().fromBufferGeometry(s.geometry)}return s}}),AFRAME.registerComponent("econtrol",{schema:{cycleDuration:{defaul:0},hour:{type:"number",default:9},hasMoon:{type:"boolean",default:!0},universe:{type:"boolean",default:!1},ucolor:{type:"color",default:"#493889"},upct:{type:"number",default:.6},hasClouds:{type:"boolean",default:!0},hoverable:{type:"boolean",default:!0},groundPhysics:{type:"boolean",default:!1},pOnP:{type:"boolean",default:!0}},init:function(){_data=this.data,t=this,o.econtrol=this.el,this.groundMeshed,this.el.addEventListener("environmentloaded",function(e){t.setupEnv(),o.sceneEl.emit("econtrolloaded")},{once:!0}),o.replay&&this.setupEnv()},setupEnv:function(){t.el.setAttribute("environment",o.environment),t.el.classList.add("environment"),t.el.setAttribute("animation",{property:"econtrol.hour",from:_data.hour,to:24+_data.hour,loop:!0,easing:"linear",dur:1e3*_data.cycleDuration,enabled:!1}),t.moon=o.svgImg("moon"),t.moon.setAttribute("class","environment"),t.moon.setAttribute("material","fog",!1),t.moon.setAttribute("scale","10 10 10"),t.moon.setAttribute("position","0 -1000 0"),t.moon.setAttribute("rotation","30 30 0"),t.el.appendChild(t.moon),t.sky=t.el.components.environment.sky,t.ground=t.el.components.environment.ground,t.dressing=t.el.components.environment.dressing,t.data.hoverable&&(t.ground.setAttribute("hoverable",""),t.dressing.setAttribute("hoverable","")),t.flyland(t.ground),t.flyland(t.dressing),t.data.hasClouds&&t.el.setAttribute("clouds",""),this.oldShadow=this.el.getAttribute("environment").shadow,this.data.groundPhysics&&o.data.hasPhysics&&"none"!=t.el.getAttribute("environment").ground&&(t.ground.setAttribute("ammo-body","type","static"),t.ground.setAttribute("ammo-shape","type","mesh")),this.hasLoaded=!0,t.update(_data)},tick:function(){AFRAME.components.environment&&(this.el.emit("environmentloaded"),3!=o.status&&_data.pOnP||_data.universe||0==_data.cycleDuration?this.el.getAttribute("animation").enabled&&this.el.setAttribute("animation",{enabled:!1,from:this.data.hour,to:this.data.hour+24}):this.el.getAttribute("animation").enabled||this.el.setAttribute("animation","enabled",!0),_data.universe?t.sky.object3D.visible&&(t.sky2||(t.sky2=document.createElement("a-sphere"),t.sky2.setAttribute("radius",t.sky.getAttribute("radius")),t.sky2.classList.add("environment"),t.sky2.setAttribute("material",{shader:"colormix",side:"back",color1:_data.ucolor,pct:_data.upct}),t.el.appendChild(t.sky2)),t.ground.setAttribute("position","0 -1000 0"),t.dressing.setAttribute("position","0 -1000 0"),t.moon.object3D.visible=!1,t.sky.object3D.visible=!1,this.el.setAttribute("environment","lightPosition",this.cycle(24)),t.el.components.environment.createStars(.5),t.el.components.environment.setStars(1e3,.5)):t.sky.object3D.visible||(t.sky2&&(t.sky2.parentNode.removeChild(t.sky2),t.sky2=null),t.ground.object3D.visible=!0,t.dressing.object3D.visible=!0,t.sky.object3D.visible=!0,this.el.setAttribute("environment","lightPosition",this.cycle(_data.hour)),this.el.setAttribute("animation",{dur:1e3*_data.cycleDuration}),t.moon.object3D.visible=_data.hasMoon))},update:function(e){jQuery.isEmptyObject(e)||(this.el.setAttribute("animation",{dur:1e3*_data.cycleDuration}),t.moon.object3D.visible=_data.hasMoon,_data.hour>17||_data.hour<6?this.el.is("night")?this.el.setAttribute("environment","lightPosition",this.cycle(_data.hour)):(this.el.addState("night"),this.el.setAttribute("environment",{lightPosition:this.cycle(_data.hour),shadow:!1})):this.el.is("day")?this.el.setAttribute("environment","lightPosition",this.cycle(_data.hour)):(this.el.removeState("night"),this.el.setAttribute("environment",{lightPosition:this.cycle(_data.hour),shadow:this.oldShadow})),_data.hasClouds?this.el.setAttribute("clouds","end",!1):this.el.setAttribute("clouds","end",!0),this.el.setAttribute("clouds","pOnP",_data.pOnP),_data.hoverable?(this.ground.setAttribute("hoverable",""),this.dressing.setAttribute("hoverable","")):(this.ground.removeAttribute("hoverable"),this.dressing.removeAttribute("hoverable")))},cycle:function(e){let s=this.el.components.environment.environmentData.lightPosition.z;return _data.hasMoon&&null!=t.moon&&(t.moon.setAttribute("position",-190*Math.cos(2*Math.PI/24*e-Math.PI/2)+" "+-190*Math.sin(2*Math.PI/24*e-Math.PI/2)+" 0.5"),t.moon.setAttribute("rotation",15*(18-e)+" 90 "+(15*(e-18)-30))),new THREE.Vector3(200*Math.cos(2*Math.PI/24*e-Math.PI/2),200*Math.sin(2*Math.PI/24*e-Math.PI/2),s)},flyland:function(e){e.setAttribute("animation__land",{property:"position",startEvents:"land",easing:"linear",dur:1500,to:"0 0 0"}),e.setAttribute("animation__fly",{property:"position",startEvents:"fly",easing:"linear",dur:1500,to:"0 -1000 0"})},flyhandler:function(e){null!=e.detail&&null!=e.detail.duration&&(t.ground.setAttribute("animation__"+e.type.slice(0,-3),"dur",e.detail.duration),t.dressing.setAttribute("animation__"+e.type.slice(0,-3),"dur",e.detail.duration)),t.ground.emit(e.type.slice(0,-3)),t.dressing.emit(e.type.slice(0,-3))},events:{flying:function(e){t.flyhandler(e)},landing:function(e){t.flyhandler(e)},bigbang:function(e){t.bigBang(e)}},bigBang:function(e){_data.universe&&(t.stars.getAttribute("animation__bbpos")||(t.stars.setAttribute("animation__bbpos",{property:"position",startEvents:"bb",easing:"linear",dur:1500,to:"0 0 -190"}),t.stars.setAttribute("animation__bbsca",{property:"scale",startEvents:"bb",easing:"linear",dur:1500,to:"0.001 0.001 0.001"}),t.sky2.setAttribute("animation__color",{property:"material.color1",startEvents:"bb",easing:"linear",dur:1500,to:"#000"})),e.detail&&("implode"==e.detail.type?(t.sky2.setAttribute("animation__color",{to:"#000"}),t.stars.setAttribute("animation__bbpos",{to:"0 0 -190"}),t.stars.setAttribute("animation__bbsca",{to:"0.001 0.001 0.001"})):"explode"==e.detail.type&&(t.sky2.setAttribute("animation__color",{to:_data.ucolor}),t.stars.setAttribute("animation__bbpos",{to:"0 0 0"}),t.stars.setAttribute("animation__bbsca",{to:"1 1 1"})),t.stars.emit("bb"),t.sky2.emit("bb")))}}),AFRAME.registerComponent("rain",{schema:{color1:{type:"string",default:"#000080"},color2:{type:"string",default:"#00FFFF"},size:{type:"number",default:.015},xlength:{type:"number",default:10},ylength:{type:"number",default:10},evap:{type:"boolean",default:!1},height:{type:"number",default:10},count:{type:"number",default:15e3,min:0},hasAudio:{type:"boolean",default:!0},pause:{type:"boolean",default:!1},end:{type:"boolean",default:!1},pOnP:{type:"boolean",default:!0}},init:function(){if(this.rainGeo=new THREE.BufferGeometry,this.vertices=[],this.colors=[],o.rAudio,this.vertexPositions,this.old=1,this.velocity=.05+.05*Math.random(),!o.rAudio&&this.data.hasAudio){let e=document.createElement("audio");e.setAttribute("src",path+"generic/rain.mp3"),e.addEventListener("canplaythrough",s=>{o.rAudio=e,o.media.push(e)})}},update:function(){if(this.data.end)return;let e;this.vertices=[],this.colors=[];for(let s=0;s<this.data.count;s++)rainDrop=new THREE.Vector3(o.randFloatOne()*this.data.xlength/2,Math.random()*this.data.height,o.randFloatOne()*this.data.ylength/2),this.vertices.push(rainDrop.x,rainDrop.y,rainDrop.z),e=new THREE.Color(.4>Math.random()?this.data.color2:this.data.color1),this.colors.push(e.r,e.g,e.b);this.rainGeo.setAttribute("position",new THREE.Float32BufferAttribute(this.vertices,3)),this.rainGeo.setAttribute("color",new THREE.Float32BufferAttribute(this.colors,3)),rainMaterial=new THREE.PointsMaterial({vertexColors:!0,size:this.data.size,transparent:!0}),this.rain=new THREE.Points(this.rainGeo,rainMaterial),this.el.object3D.add(this.rain),this.vertexPositions=this.rain.geometry.attributes.position.array,null==o.rAudio||this.data.hasAudio||(o.rAudio.muted=!0,o.rAudio.volume=0)},tick:function(){!this.data.pause&&this.vertexPositions&&this.rain&&(3==o.status?(null==o.rAudio||o.rAudio.playing||((o.permissions.mute||!this.data.hasAudio)&&(o.rAudio.muted=!0,o.rAudio.volume=0),o.rAudio.play()),this.velocity=.05+.05*Math.random()):3!=o.status&&this.data.pOnP&&(null!=o.rAudio&&o.rAudio.playing&&o.rAudio.pause(),this.velocity=0),this.vertexPositions=this.raining(this.vertexPositions,this.data.height,this.old,this.data.evap,this.data.end),this.old=1,this.rain.geometry.attributes.position.needsUpdate=!0)},raining:function(e,s,n,a,r){for(var l=0;l<=e.length;l++)if(l==n){if(n+=3,a){let c=.05+.05*Math.random();e[l]=e[l]+c,e[l]>=s&&(e[l]=0,r&&(e[l]=-1e3))}else e[l]=e[l]-this.velocity,e[l]<=0&&(e[l]=s,r&&(e[l]=-1e3))}return e}}),AFRAME.registerComponent("clouds",{schema:{count:{type:"number",default:100,min:0},xlength:{type:"number",default:200},ylength:{type:"number",default:200},zlength:{type:"number",default:10},height:{type:"number",default:10},cheight:{type:"number",default:10},cwidth:{type:"number",default:50},speed:{type:"number",default:1},size:{type:"number",default:5},range:{type:"number",default:3},color:{type:"color",default:"white"},spot:{type:"string",default:"none"},pause:{type:"boolean",default:!1},end:{type:"boolean",default:!1},pOnP:{type:"boolean",default:!1}},init:function(){var e=[];this.cloudGeo=new THREE.BufferGeometry,this.positions=new Float32Array(3*this.data.count),this.attr=[],this.xlen=this.data.xlength/2,this.ylen=this.data.ylength/2,this.ang=Math.sin(Math.PI/6);for(var s=0;s<this.positions.length;s+=3){var n=new THREE.Mesh(new THREE.PlaneGeometry(this.data.size,this.data.size));this.positions[s]=o.randFloatOne()*this.xlen,this.positions[s+1]=Math.random()*this.data.zlength+("none"!=this.data.spot?0:this.data.height),this.positions[s+2]=o.randFloatOne()*this.ylen;let a=o.randInt(this.data.range);if(n.geometry.scale(a,.5*a,1),n.geometry=n.geometry.translate(this.positions[s],this.positions[s+1],this.positions[s+2]),"none"==this.data.spot)this.attr.push([a*this.data.size/2,.5*a*this.data.size/2,o.randInt(3)*this.data.speed/50]);else if("horizontal"==this.data.spot){let r=n.geometry.attributes.position.array;r[1]=this.positions[s+1],r[4]=r[1],r[7]=r[1],r[10]=r[1],r[2]=this.positions[s+2]+a*this.data.size/2,r[5]=r[2],r[8]=this.positions[s+2]-.5*a*this.data.size/2,r[11]=r[8]}e.push(n.geometry)}this.cloudGeo=THREE.BufferGeometryUtils.mergeBufferGeometries(e),this.cloudGeo.computeBoundingBox(),this.cloudMesh=new THREE.Mesh(this.cloudGeo,new THREE.MeshBasicMaterial({color:255,depthWrite:!1})),this.el.setObject3D("mesh",this.cloudMesh),this.opacity=1,this.el.setAttribute("material",{src:o.cloud,color:this.data.color,transparent:!0,side:"double",alphaTest:.15,opacity:this.opacity,emissive:this.data.color,emissiveIntensity:.5})},update:function(e){this.el.setAttribute("material",{color:this.data.color,emissive:this.data.color}),this.cloudGeo.setDrawRange(0,6*this.data.count),this.el.setAttribute("material","opacity",this.opacity);let s=this;if(this.data.end){if(this.opacity<=0)return;this.opacity-=.1,setTimeout(function(){s.update()},100)}else{if(this.opacity>=1)return;this.opacity+=.1,setTimeout(function(){s.update()},100)}if("none"==this.data.spot)for(var n=0;n<this.attr.length;n++)this.attr[n][2]=o.randInt(3)*this.data.speed/50},tick:function(e,s){if(null==o.econtrol||this.data.end||(o.econtrol.is("night")?this.el.setAttribute("material",{opacity:.5,emissiveIntensity:.1}):this.el.setAttribute("material",{opacity:1,emissiveIntensity:.5})),"none"!=this.data.spot||(this.data.pause||3!=o.status&&this.data.pOnP)&&e>0)return;let n=this.cloudGeo.attributes.position.array,a=0,r=this.xlen*this.xlen;this.data.inflection;for(var l=0;l<n.length;l+=12){let c=this.attr[a],h=this.positions[3*a],u=this.positions[3*a+1],d=this.positions[3*a+2];if(n[l]>this.xlen)this.positions[3*a]=-this.xlen-c[0],h=this.positions[3*a],n[l+3]=-this.xlen,n[l]=-this.xlen-2*c[0],n[l+6]=n[l],n[l+9]=n[l+3];else{this.positions[3*a]+=c[2],h=this.positions[3*a],n[l]+=c[2],n[l+3]+=c[2],n[l+6]+=c[2],n[l+9]+=c[2];let m=c[0]/2*Math.sign(d*h)*this.ang*Math.abs(n[l]/this.xlen);if(d<this.data.cwidth/2&&d>-this.data.cwidth/2){let g=Math.sqrt((1-h*h/r)*Math.pow(this.data.cheight,2))+u-this.data.height/2;n[l+1]=g+Math.sign(h),n[l+4]=g-Math.sign(h),n[l+7]=g+Math.sign(h),n[l+10]=g-Math.sign(h),n[l+2]=d+c[1],n[l+5]=n[l+2],n[l+8]=d-c[1],n[l+11]=n[l+8]}else n[l+2]=d+m,n[l+5]=d-m,n[l+8]=d+m,n[l+11]=d-m}a++}this.cloudGeo.attributes.position.needsUpdate=!0}}),AFRAME.registerComponent("online-el",{init:function(){this.data||console.warn("Elementos online precisam de ID!"),$("[online-el='"+this.data+"']").length>1&&console.error("Elementos online com ID repetidos!"),this.seat=null,this.oldMatrix=new THREE.Matrix4,this.props={}},tick:(e=new THREE.Matrix4,s=[],function(n){if(this.multi&&(this.data||remoteQueue||master)){if(e.copy(this.el.object3D.matrix),s=Array.from(e.elements),!this.seat&&"-0"==this.data.slice(-2)&&(this.el.object3D.visible=!1,remoteQueue[this.data]&&remoteQueue[this.data][2]&&(this.seat=[...remoteQueue[this.data][2]],this.el.setAttribute("position",this.seat[0]),this.el.setAttribute("rotation",this.seat[1]),this.seat.equals(seats[0])||(this.el.object3D.visible=!0),selfQueue[this.data]||(selfQueue[this.data]=[]),selfQueue[this.data][2]=[...remoteQueue[this.data][2]])),(this.el.classList.contains("lhand")||this.el.classList.contains("rhand"))&&(this.el.object3D.visible=!0),remoteQueue[this.data]&&remoteQueue[this.data][0])e.fromArray(remoteQueue[this.data][0].elements),this.setMatrix(e),this.oldMatrix.fromArray(remoteQueue[this.data][0].elements),master&&(o.pingDC(dC1s,this.data,remoteQueue[this.data]),Object.assign(selfQueue,remoteQueue)),delete remoteQueue[this.data][0];else if(s.equals(this.oldMatrix.elements)||remoteQueue[this.data]&&(!remoteQueue[this.data]||remoteQueue[this.data][0]))jQuery.isEmptyObject(this.props)||(selfQueue[this.data]||(selfQueue[this.data]=[]),selfQueue[this.data][1]={},Object.assign(selfQueue[this.data][1],this.props),o.pingDC(dC1s,this.data,selfQueue[this.data]),master||delete selfQueue[this.data],this.props={});else{if(this.oldMatrix.fromArray(s),selfQueue[this.data]||(selfQueue[this.data]=[]),selfQueue[this.data][0]=this.el.object3D.matrix,peer[this.data.slice(0,-2)])return;o.pingDC(dC1s,this.data,selfQueue[this.data]),master||delete selfQueue[this.data]}}}),setMatrix:function(e){e.decompose(this.el.object3D.position,this.el.object3D.quaternion,this.el.object3D.scale)}}),AFRAME.registerComponent("menu-el",{init:function(){this.el.setAttribute("collidable","")},events:{"grab-start":function(){!o.data.hasIntro&&1!=o.status&&7!=o.status&&8!=o.status&&(o.data.has3DMenu&&o.sceneEl.is("vr-mode")&&($("#playmsg").show(),o.sessionHandler("pause")),o.data.hasARMenu&&o.simulate())}}}),AFRAME.registerComponent("selectable",{init:function(){this.el.getAttribute("grabbable")||this.el.setAttribute("clickable",""),this.el.getAttribute("gltf-model")||this.el.getAttribute("gltf-submodel")||(this.color=this.el.getAttribute("material").color,this.emissive=this.el.getAttribute("material").emissive),this.position=new THREE.Vector3},events:{"grab-start":function(e){this.position.copy(e.detail.hand.object3D.position)},"grab-end":function(e){if(!(e.detail.hand.object3D.position.distanceTo(this.position)>.01)&&!(o.status<=1)){if(this.el.is("selected")){let s=o.selected.indexOf(this.el);s>-1&&o.selected.splice(s,1),this.el.removeState("selected"),this.el.getAttribute("gltf-model")||this.el.getAttribute("gltf-submodel")?this.el.setAttribute("gltf-material__a","reset",!0):this.el.setAttribute("material",{emissive:this.emissive,color:this.color})}else o.selected.push(this.el),this.el.addState("selected"),this.el.getAttribute("gltf-model")||this.el.getAttribute("gltf-submodel")?(this.el.setAttribute("gltf-material__a",""),this.el.setAttribute("gltf-material__a",{emission:"0 182 160 0.2",reset:!1})):this.el.setAttribute("material",{emissive:"rgb(0, 182, 160)"})}}}}),AFRAME.registerComponent("turnable",{init:function(){this.el.setAttribute("selectable","")},events:{stateadded:function(e){"selected"!=e.detail||o.sceneEl.is("vr-mode")||$("#turn-btn").css("display","flex")},stateremoved:function(e){"selected"==e.detail&&0==o.selected.length&&($("#turn-btn").hide(),o.toDynamic(this.el))}}}),AFRAME.registerComponent("collidable",{schema:{group:{type:"int",default:8}},init:function(){console.log(this.el,this.data.group),null==this.el.getAttribute("ammo-body")?this.el.setAttribute("ammo-body",{emitCollisionEvents:!0,collisionFilterGroup:this.data.group,collisionFilterMask:1,type:"static",mass:0}):this.el.setAttribute("ammo-body",{emitCollisionEvents:!0,collisionFilterGroup:this.data.group,collisionFilterMask:1}),null==this.el.getAttribute("ammo-shape")&&this.el.setAttribute("ammo-shape",{type:"box"}),this.allowCollisions=!0},tick:function(){this.allowCollisions&&o.sceneEl.is("2d-mode")&&null!=this.el.getAttribute("clickable")?(this.el.setAttribute("ammo-body","disableCollision",!0),this.allowCollisions=!1):!this.allowCollisions&&o.sceneEl.is("vr-mode")&&null==this.el.getAttribute("clickable")&&(this.el.setAttribute("ammo-body","disableCollision",!1),this.allowCollisions=!0)},events:{collidestart:function(e){console.log("ammo colision start")},collideend:function(e){console.log("ammo colision end")}}}),AFRAME.registerComponent("buzzer",{schema:{frequency:{type:"number",default:0},volume:{type:"number",default:1},buzzerOn:{type:"boolean",default:!1},positional:{type:"boolean",default:!0}},init:function(){this.oscillator,this.gainNode},buzzer:function(e){o.audioCtx&&(this.data.frequency=e,ARparams.buzzer[0]=e,this.oscillator||(this.oscillator=o.audioCtx.createOscillator(),this.gainNode=o.audioCtx.createGain(),this.oscillator.connect(this.gainNode),this.gainNode.connect(o.audioCtx.destination),this.gainNode.gain.value=this.data.volume/10),this.oscillator.frequency.value=e*ARparams.buzzer[2],e<=0?(this.oscillator.stop(),this.oscillator=null,this.data.buzzerOn=!1):this.data.buzzerOn||(this.oscillator.start(),this.data.buzzerOn=!0))},tick:(n=new THREE.Vector3,a=new THREE.Vector3,function(){if(!this.data.positional)return;let e=o.getObj(ARstate,"buzzer");e!=this.data.frequency&&this.buzzer(e),n.setFromMatrixPosition(this.el.object3D.matrixWorld),a.setFromMatrixPosition(o.camera.object3D.matrixWorld);let s=n.distanceTo(a),r=o.map(s+o.zoom[0],.7,2.7,this.data.volume/10,this.data.volume/100);this.gainNode&&this.gainNode.gain.value!=r&&(this.gainNode.gain.value=r)})}),AFRAME.registerComponent("boombox",{schema:{debug:{type:"boolean",default:!1},bitsPerSample:{type:"int",default:16},channels:{type:"int",default:1},sampleRate:{type:"int",default:44100},volume:{type:"int",default:32768}},init:function(){console.log("initiating boombox"),o.boombox=this,this.notes={C:261.63,"C#":277.18,D:293.66,"D#":311.13,E:329.63,F:349.23,"F#":369.99,G:392,"G#":415.3,A:440,"A#":466.16,B:493.88},this.sounds=[],this.wavCache=[],this.mod=[function(e,s,n,a){return Math.sin(2*Math.PI*(e/s)*n+a)}],this.loadModulationFunction(),this.loadSoundProfile({piano:{name:"piano",attack:function(){return .002},dampen:function(e,s,n){return Math.pow(.5*Math.log(s*n/e),2)},wave:function(e,s,n,a){var r=this.modulate[0];return this.modulate[1](e,s,n,Math.pow(r(e,s,n,0),2)+.75*r(e,s,n,.25)+.1*r(e,s,n,.5))}}}.piano)},createInstrument:function(e){if(console.log(2,e),!this.sounds.includes(e))throw Error("Invalid sound or sound ID: "+e);return new AudioSynthInstrument(this,e,0)},loadModulationFunction:function(){let e=[function(e,s,n,a){return 1*Math.sin(2*Math.PI*(e/s*n)+a)},function(e,s,n,a){return 1*Math.sin(4*Math.PI*(e/s*n)+a)},function(e,s,n,a){return 1*Math.sin(8*Math.PI*(e/s*n)+a)},function(e,s,n,a){return 1*Math.sin(.5*Math.PI*(e/s*n)+a)},function(e,s,n,a){return 1*Math.sin(.25*Math.PI*(e/s*n)+a)},function(e,s,n,a){return .5*Math.sin(2*Math.PI*(e/s*n)+a)},function(e,s,n,a){return .5*Math.sin(4*Math.PI*(e/s*n)+a)},function(e,s,n,a){return .5*Math.sin(8*Math.PI*(e/s*n)+a)},function(e,s,n,a){return .5*Math.sin(.5*Math.PI*(e/s*n)+a)},function(e,s,n,a){return .5*Math.sin(.25*Math.PI*(e/s*n)+a)}];for(var s=0;s<e.length;s++){if("function"!=typeof(f=e[s]))throw Error("Invalid modulation function.");this.mod.push(f)}return!0},loadSoundProfile:function(){for(i=0;i<arguments.length;i++)this.sounds.push(arguments[i]);this.resizeCache()},resizeCache:function(){for(;this.wavCache.length<this.sounds.length;){for(var e=[],s=0;s<8;s++){var n={};for(var a in this.notes)n[a]={};e.push(n)}this.wavCache.push(e)}},clearCache:function(){this.wavCache=[],this.resizeCache()},generate:function(e,s,n,a){var r=this.sounds[e];if(!r){for(var l=0;l<this.sounds.length;l++)if(this.sounds[l].name==e){r=this.sounds[l],e=l;break}}if(!r||!this.notes[s]||!window.Blob)throw Error("Invalid sound, note or blob");var c=(new Date).valueOf();this.temp={},n|=0,n=Math.min(8,Math.max(1,n));var h=a?parseFloat(a):2;if(void 0!==this.wavCache[e][n-1][s][h])return this.data.debug&&console.log((new Date).valueOf()-c,"ms to retrieve (cached)"),this.wavCache[e][n-1][s][h];for(var u=this.notes[s]*Math.pow(2,n-4),d=this.data.sampleRate,m=this.data.volume,g=this.data.channels,b=this.data.bitsPerSample,A=r.attack(d,u,m),v=r.dampen(d,u,m),y=r.wave,_={modulate:this.mod,vars:this.temp},w=0,x=new Uint8Array(new ArrayBuffer(Math.ceil(d*h*2))),E=d*A|0,C=d*h|0,l=0;l!==E;l++)w=m*(l/(d*A))*y.call(_,l,d,u,m),x[l<<1]=w,x[(l<<1)+1]=w>>8;for(;l!==C;l++)w=m*Math.pow(1-(l-d*A)/(d*(h-A)),v)*y.call(_,l,d,u,m),x[l<<1]=w,x[(l<<1)+1]=w>>8;var D=["RIFF",this.pack(1,52),"WAVE","fmt ",this.pack(1,16),this.pack(0,1),this.pack(0,g),this.pack(1,d),this.pack(1,d*g*b/8),this.pack(0,g*b/8),this.pack(0,b),"data",this.pack(1,x.length*g*b/8),x],B=new Blob(D,{type:"audio/wav"}),P=URL.createObjectURL(B);return this.wavCache[e][n-1][s][h]=P,this.data.debug&&console.log((new Date).valueOf()-c,"ms to generate"),P},start:function(e,s,n,a){if(!document.getElementById(e+"_"+s+"_"+n)){var r=this.generate(e,s,n,a),l=new Audio(r);return l.id=e+"_"+s+"_"+n,o.sceneEl.appendChild(l),l.play(),!0}},stop:function(e,s,n){let a=document.getElementById(e+"_"+s+"_"+n);if(a)return a.pause(),a.parentElement.removeChild(a),!0},pack:function(e,s){return[new Uint8Array([s,s>>8]),new Uint8Array([s,s>>8,s>>16,s>>24])][e]}}),AFRAME.registerComponent("axes-helper",{schema:{size:{type:"number",default:.5}},init:function(){this.el.setObject3D("axes-helper",new THREE.AxesHelper(this.data.size))}}),AFRAME.registerComponent("lock",{schema:{r:{type:"string",default:"Y"},p:{type:"string",default:"Z"},pmax:{type:"vec3"},pmin:{type:"vec3"}},init:function(){this.position=new THREE.Vector3,this.distance=new THREE.Vector3,this.rotation=new THREE.Euler,this.position.copy(this.el.object3D.position),this.rotation.copy(this.el.object3D.rotation),this.r=this.data.r.split(""),this.p=this.data.p.split("")},tick:function(){let e=new THREE.Euler,s=new THREE.Vector3;return function(){this.locking(this.r,"rotation",e),this.locking(this.p,"position",s)}}(),locking:function(e,s,n){if(e.length>0&&AFRAME.utils.diff(this.el.object3D[s],this[s])){s.charAt(0),n.copy(this.el.object3D[s]);let a=["x","y","x"];for(i=0;i<a.length;i++)if(n[a[i]]!=this[s][a[i]]){if(this.distance[a[i]]>this.data.pmax[a[i]]&&n[a[i]]>this[s][a[i]]&&0!=this.data.pmax[a[i]]||this.distance[a[i]]<-this.data.pmin[a[i]]&&n[a[i]]<this[s][a[i]]&&0!=this.data.pmin[a[i]]){n[a[i]]=this[s][a[i]];continue}e.includes(a[i].toUpperCase())&&(n[a[i]]=this[s][a[i]])}this.distance.x+=n.x-this[s].x,this.distance.y+=n.y-this[s].y,this.distance.z+=n.z-this[s].z,this.el.object3D[s].copy(n),this[s].copy(n)}}}),AFRAME.registerComponent("checkpoint",{schema:{offset:{default:{x:0,y:0,z:0},type:"vec3"}},init:function(){this.active=!1,this.targetEl=null,this.fire=this.fire.bind(this),this.offset=new THREE.Vector3},update:function(){this.offset.copy(this.data.offset)},play:function(){this.el.addEventListener("grab-start",this.fire),this.active=!0},pause:function(){this.el.removeEventListener("grab-end",this.fire),this.active=!1},remove:function(){this.pause()},fire:function(){"checkpoint"==o.movementType&&3==o.status&&o.cameraRig.components["checkpoint-controls"]&&(o.cameraRig.components["checkpoint-controls"].setCheckpoint(this.el),o.actualCheckpoint=this.el)},getOffset:function(){return this.offset.copy(this.data.offset)}}),AFRAME.registerComponent("nav",{schema:{model:{type:"string"},width:{type:"number",default:10,min:0},depth:{type:"number",default:10,min:0},radius:{type:"number",min:0},nodeName:{type:"string"},debug:{type:"boolean",default:!1}},init:function(){this.hasLoadedNavMesh=!1,this.nodeName=this.data.nodeName,this.el.addEventListener("object3dset",this.loadNavMesh.bind(this)),this.data.model&&""!=this.data.model?this.el.setAttribute("gltf-model",this.data.model):this.createNav(),this.el.setAttribute("hoverable",""),this.el.setAttribute("clickable",""),this.el.setAttribute("ammo-body",{emitCollisionEvents:!0,type:"static"}),this.el.setAttribute("ammo-shape","type","mesh"),this.off=[]},update:function(){this.el.object3D.visible=this.data.debug},play:function(){this.hasLoadedNavMesh||this.loadNavMesh()},loadNavMesh:function(){var e=this;let s=this.el.getObject3D("mesh"),n=this.el.sceneEl.object3D;if(!s)return;let a;s.traverse(s=>{s.isMesh&&(!e.nodeName||s.name===e.nodeName)&&(a=s)}),a&&(n.updateMatrixWorld(),this.system.setNavMeshGeometry(a.geometry),this.hasLoadedNavMesh=!0)},createNav:function(){let e=new THREE.MeshBasicMaterial({color:16711680}),s=new THREE.BufferGeometry,n=new THREE.Vector3;return function(){let a=[];if(0!=this.data.radius){let r=[],l=[];l.push(0,0,0);for(let c=0,h=3;c<=16;c++,h+=3){let u=c/16*Math.PI*2;n.x=this.data.radius*Math.cos(u),n.z=this.data.radius*Math.sin(u),l.push(n.x,n.y,n.z)}for(let d=1;d<=16;d++)r.push(d,d+1,0);s.setIndex(r),s.setAttribute("position",new THREE.Float32BufferAttribute(l,3)),this.el.setObject3D("mesh",new THREE.Mesh(s,e)),this.el.object3D.rotation.x=Math.PI}else if(0!=this.data.width&&0!=this.data.depth){let m=Math.abs(this.data.depth/2),g=Math.abs(this.data.width/2);a=[-m,0,g,m,0,g,m,0,-g,m,0,-g,-m,0,-g,-m,0,g];let b=new Float32Array(a);s.setAttribute("position",new THREE.BufferAttribute(b,3)),this.el.setObject3D("mesh",new THREE.Mesh(s,e))}this.el.object3D.position.y+=.001}}(),tick:function(){for(i=0;i<this.off.length;i++)this.off[i].components["nav-block"].stopedX&&(this.off[i].object3D.position.x=this.off[i].components["nav-block"].clampedEnd.x)},events:{collideend:function(e){e.detail.targetEl.components["nav-block"]&&this.off.push(e.detail.targetEl)},collidestart:function(e){if(e.detail.targetEl.components["nav-block"]){let s=this.off.indexOf(e.detail.targetEl);s>-1&&this.off.splice(s,1)}}}}),AFRAME.registerComponent("npc",{schema:{destination:{type:"vec3"},active:{default:!1},speed:{default:2},move:{default:"nav",oneOf:["click","auto","nav"]},loop:{default:!1},fixRotAll:{default:!1},fixRotIni:{default:!1},pOnP:{type:"boolean",default:!0}},init:function(){this.system=this.el.sceneEl.systems.nav,this.system.addAgent(this),this.group=null,this.path=[],this.destinationBkp=new THREE.Vector3,this.destinationBkp.copy(this.data.destination),this.from=new THREE.Vector3,this.from.copy(this.el.object3D.position),this.rot=new THREE.Quaternion,this.rot.copy(this.el.object3D.quaternion),this.isMoving=!1,this.going=!0;let e=o.sceneEl.querySelectorAll("[nav]")[0];e&&(e.addEventListener("grab-start",e=>{if("nav"==this.data.move)for(var s in e.detail)"hand"!=s&&"target"!=s&&this.movement(e.detail[s].detail.intersection.point)}),this.el.setAttribute("hoverable",""),this.el.components.clickable||this.el.components.grabbable||this.el.setAttribute("clickable",""),"auto"==this.data.move&&this.el.setAttribute("npc","active",!0),this.raycaster=new THREE.Raycaster)},remove:function(){this.system.removeAgent(this)},update:function(e){this.path.length=0;var s=AFRAME.utils.diff(e,this.data),n=Object.keys(s),a=n[0];1==n.length&&"destination"==a&&this.destinationBkp.copy(s[a])},updateNavLocation:function(){this.group=null,this.path=[]},movement:function(e){this.el.setAttribute("npc",{active:!0,destination:e}),this.going=!this.going},tick:function(){let e=new THREE.Vector3,s=new THREE.Vector3,n=new THREE.Vector3;return function(a,r){let l=this.el,c=this.data,h=this.raycaster,u=c.speed*r/1e3;if(!c.active||3!=o.status&&c.pOnP)return;if(!this.path.length){let d=this.el.object3D.position;this.group=this.group||this.system.getGroup(d),this.path=this.system.getPath(d,e.copy(c.destination),this.group)||[],l.emit("navigation-start")}if(!this.path.length){console.warn("[nav] Unable to find path to %o.",c.destination),this.el.setAttribute("npc",{active:!1}),l.emit("navigation-end");return}let m=l.object3D.position,g=this.path[0];s.subVectors(g,m);let b=s.length(),A;if(b<u){if(this.path.shift(),!this.path.length){this.el.setAttribute("npc",{active:!1}),l.emit("navigation-end");return}n.copy(m),A=this.path[0]}else n.copy(s.setLength(u)).add(m),A=g;A.y=m.y,c.fixRotAll||l.object3D.lookAt(A),h.ray.origin.copy(n),h.ray.origin.y+=1.5,h.ray.direction={x:0,y:-1,z:0};let v=h.intersectObject(this.system.getNavMesh());v.length?(s.subVectors(v[0].point,m),m.add(s.setLength(u))):m.copy(n)}}(),events:{"navigation-start":function(e){this.isMoving=!0},"navigation-end":function(e){this.data.loop?"auto"==this.data.move?this.going?this.movement(this.from):this.movement(this.destinationBkp):this.from.distanceTo(this.el.object3D.position)>.01?this.movement(this.from):"click"==this.data.move&&this.el.setAttribute("npc","destination",this.destinationBkp):this.from=this.el.object3D.position,this.data.fixRotIni&&this.el.object3D.quaternion.copy(this.rot),this.isMoving=!1},"grab-start":function(e){"click"!=this.data.move||this.isMoving||this.movement(this.data.destination)}}}),AFRAME.registerComponent("nav-block",{init:function(){this.updateNavLocation(),this.nav=this.el.sceneEl.systems.nav,this.nav.addAgent(this),this.clampedEnd=new THREE.Vector3,this.stopedX=!1},updateNavLocation:function(){this.navGroup=null,this.navNode=null},tick:function(){let e=new THREE.Vector3,s=new THREE.Vector3;return function(){e.copy(this.el.object3D.position),this.navGroup=null===this.navGroup?this.nav.getGroup(e):this.navGroup,this.navNode=this.navNode||this.nav.getNode(e,this.navGroup),this.navNode=this.nav.clampStep(e,e,this.navGroup,this.navNode,s),this.stopedX=s.x==this.clampedEnd.x,this.clampedEnd.copy(s)}}()});let u="level";o.pathfinder=new threePathfinding.Pathfinding,AFRAME.registerSystem("nav",{init:function(){this.navMesh=null,this.agents=new Set},setNavMeshGeometry:function(e){this.navMesh=new THREE.Mesh(e),o.pathfinder.setZoneData(u,threePathfinding.Pathfinding.createZone(e)),Array.from(this.agents).forEach(e=>e.updateNavLocation())},getNavMesh:function(){return this.navMesh},addAgent:function(e){this.agents.add(e)},removeAgent:function(e){this.agents.delete(e)},getPath:function(e,s,n){return this.navMesh?o.pathfinder.findPath(e,s,u,n):null},getGroup:function(e){return this.navMesh?o.pathfinder.getGroup(u,e):null},getNode:function(e,s){return this.navMesh?o.pathfinder.getClosestNode(e,u,s,!0):null},clampStep:function(e,s,n,a,r){return this.navMesh?a?o.pathfinder.clampStep(e,s,a,u,n,r):(r.copy(s),this.getNode(s,n)):(r.copy(s),null)}}),AFRAME.registerComponent("lookat",{tick:function(){this.el.object3D.lookAt(o.cameraRig.getAttribute("position"))}}),AFRAME.registerComponent("led",{multiple:!0,schema:{name:{type:"string"},materials:{type:"array"},blur:{type:"boolean",default:!1},emission:{type:"vec4",default:{x:0,y:0,z:0,w:0}},active:{type:"boolean",default:!1}},init:function(){let e=this.data;this.el.setAttribute("gltf-material__"+this.data.name,"materials",this.data.materials),this.el.addEventListener(this.data.name+"on",function(s){s.target.setAttribute("gltf-material__"+e.name,{emission:e.emission,reset:!1})}),this.el.addEventListener(this.data.name+"off",function(s){s.target.setAttribute("gltf-material__"+e.name,"reset",!0)})},tick:function(){let e=o.getObj(ARstate,this.data.name);Array.isArray(e)?0==e[0]&&0==e[1]&&0==e[2]&&this.data.active||4==o.status&&this.data.active?(this.data.active=!1,this.el.setAttribute("gltf-material__"+this.data.name,"reset",!0)):0==e[0]&&0==e[1]&&0==e[2]||this.data.active||3!=o.status||(this.data.active=!0,this.el.setAttribute("gltf-material__"+this.data.name,{emission:255*e[0]+" "+255*e[1]+" "+255*e[2]+" "+this.data.emission.w,reset:!1})):1!=e||this.data.active||3!=o.status?(0==e&&this.data.active||4==o.status&&this.data.active)&&(this.data.active=!1,this.el.setAttribute("gltf-material__"+this.data.name,"reset",!0)):(this.data.active=!0,this.el.setAttribute("gltf-material__"+this.data.name,{emission:this.data.emission,reset:!1}))}}),AFRAME.registerComponent("dot-grid",{schema:{color:{type:"string",default:"#000080"},dotsize:{type:"number",default:.01},xcount:{type:"number",default:20,min:0},ycount:{type:"number",default:20,min:0},gap:{type:"number",default:.1}},init:function(){let e=this.data,s=this;this.positions=[],this.allDots=[],this.posDots=[],this.negDots=[],this.openVertices=[],this.vertices=[],this.lines=[],this.iniDot=new THREE.Vector3,this.drawing=!1,this.w;let n=document.createElement("a-entity");n.setAttribute("id","dglines"),this.el.appendChild(n);for(let a=0;a<e.xcount*e.ycount;a++){let r=e.gap*(e.xcount-1),l=e.gap*(e.ycount-1),c=Math.floor(a/e.xcount),h=parseFloat((-r/2+Math.floor(a%e.xcount)*e.gap).toFixed(3)),u=parseFloat((l/2-c*e.gap).toFixed(3)),d=document.createElement("a-entity");d.setAttribute("clickable",""),d.setAttribute("id","dgel_"+a),d.setAttribute("geometry",{primitive:"plane",width:2*e.gap/4,height:2*e.gap/4}),d.setAttribute("material","opacity",0);let m=document.createElement("a-entity");m.setAttribute("geometry",{primitive:"circle",radius:e.dotsize/2}),m.setAttribute("material",{side:"double",color:e.color}),d.appendChild(m),d.addEventListener("grab-start",function(e){let n=e.target.id.split("_");s.posDots[n[1]]>=2&&s.negDots[n[1]]>=2||(s.iniDot.set(h,u,0),m.setAttribute("material","color","orange"),s.drawing=!0)}),d.addEventListener("grab-end",function(n){m.setAttribute("material","color",e.color),s.drawing=!1;let r=$("#rhandcursor")[0].object3D.position.clone().sub(o.dim2.object3D.position);for(a=0,r.z=0;a<s.positions.length;a++)if(r.distanceTo(s.positions[a])<2*e.gap/4&&s.posDots[a]<2&&s.negDots[a]<2){if(0==s.iniDot.distanceTo(s.positions[a]))break;s.drawline(s.iniDot,s.positions[a],"create"),s.calculateArea();return}s.drawline(s.iniDot,r,"erase")}),d.object3D.position.set(h,u,.002),this.positions.push(new THREE.Vector3(h,u,0)),this.posDots.push(0),this.negDots.push(0),this.el.appendChild(d)}},tick:function(){let e=$("#rhandcursor")[0].object3D.position.clone().sub(o.dim2.object3D.position);this.drawing&&this.drawline(this.iniDot,e)},drawline:function(e,s,n){let a=this;if(o.getObj(ARstate,"dots_eraser"))return;if(this.w&&this.w.parentElement.removeChild(this.w),"erase"==n)return this.w=null;this.w=document.createElement("a-entity");let r=o.getObj(ARstate,"dots_creation")?"#FF0000":"forestgreen";if(this.w.setAttribute("tickline",{lineWidth:1e3*this.data.dotsize,path:e.x+" "+e.y+" 0,"+s.x+" "+s.y+" 0",color:r}),this.w.object3D.position.z=.001,$("#dglines")[0].appendChild(this.w),"create"==n){let l=[];if(s.x==e.x)for(i=0;i<this.positions.length;i++){let c=this.positions[i];o.between(c.y,e.y,s.y)&&s.x==c.x?(l.push(i),this.hideDot(i)):c.x==e.x&&c.y==e.y?(l.push(i),this.halfDot(i)):c.x==s.x&&c.y==s.y&&(l.push(i),this.halfDot(i))}else if(s.y==e.y)for(i=0;i<this.positions.length;i++){let h=this.positions[i];o.between(h.x,e.x,s.x)&&s.y==h.y?(l.push(i),this.hideDot(i)):h.x==e.x&&h.y==e.y?(l.push(i),this.halfDot(i)):h.x==s.x&&h.y==s.y&&(l.push(i),this.halfDot(i))}else{let u=(s.y-e.y)/(s.x-e.x),d=s.y-u*s.x;for(i=0;i<this.positions.length;i++){let m=this.positions[i];1e-4>Math.abs(m.x*u+d-m.y)&&o.between(m.x,e.x,s.x)&&o.between(m.y,e.y,s.y)?(l.push(i),this.hideDot(i)):m.x==e.x&&m.y==e.y?(l.push(i),this.halfDot(i)):m.x==s.x&&m.y==s.y&&(l.push(i),this.halfDot(i))}}this.w.setAttribute("id","dgline_"+this.lines.length),this.w.setAttribute("data-arr",l),this.lines.push("dgline_"+this.lines.length);let g=o.getPointInBetweenByPerc(e,s,.5),b;(b=o.createText("X","center",.05,"infinity","purple",g,"0 0 0")).object3D.visible=!1,b.setAttribute("class","dotX"),b.setAttribute("clickable",""),b.addEventListener("grab-start",function(e){e.preventDefault(),e.stopImmediatePropagation(),e.target.parentElement.setAttribute("scale","0 0 0"),e.target.parentElement.setAttribute("visible",!1),a.showDot(e.target.parentElement.id)}),this.w.appendChild(b),this.w=null,this.allDots.push(...l),l=[]}},halfDot:function(e){let s;if(o.getObj(ARstate,"dots_creation")?(s=this.negDots,this.negDots[e]++):(s=this.posDots,this.posDots[e]++),2==s[e]){s[e]=3,this.vertices.push(this.positions[e]);let n=$("#dgel_"+e)[0];n&&(n.object3D.visible=!1)}else this.openVertices.push(this.positions[e])},hideDot:function(e){o.getObj(ARstate,"dots_creation")?(arr=this.negDots,this.negDots[e]=2):this.posDots[e]=2;let s=$("#dgel_"+e)[0];s&&(s.object3D.visible=!1)},showDot:function(e){let s=$("#"+e).data("arr").split(",");for(i=0;i<s.length;i++){let n=$("#dgel_"+s[i])[0];n&&(n.object3D.visible=!0);let a=parseInt(s[i]);console.log(this.posDots[a],a),this.posDots[a]-=2,this.posDots[a]<0&&(this.posDots[a]=0);let r=this.vertices.indexOf(this.positions[a]);if(r>-1&&this.vertices.splice(r,1),0==this.posDots[a]){let l=this.openVertices.indexOf(this.positions[a]);l>-1&&this.openVertices.splice(l,1)}}},calculateArea:function(){if(this.openVertices.length!=this.vertices.length){$("#dots_warn").text("Pe\xe7a est\xe1 aberta."),$("#dots_mass p:last-child").text("0 g"),$("#dots_rx p:last-child").text("0 #");return}let e=0,s=1e3;for(j=0;j<2;j++){let n=0,a=0,r=0,l=0,c,h;for(i=0,h=0==j?this.posDots:this.negDots;i<h.length;i++)l=Math.floor(i/this.data.xcount),3==h[i]?(r++,0==j?e++:e--,null!=c&&(0==j?e+=i-c-1:e-=i-c-1,c=null)):2==h[i]&&(0==j?e++:e--,0!=r||c?null!=c&&(0==j?e+=i-c-1-r:e-=i-c-1-r,c=null):c=i),n=h[i],a!=l&&(r=0,n=0,c=null),a=l}$("#dots_warn").text("Pe\xe7a fechada."),$("#dots_mass p:last-child").text(e+" g");let u=[],d=[];for(i=0;i<this.allDots.length;i++){let m=Math.floor(this.allDots[i]/this.data.xcount),g=Math.floor(this.allDots[i]%this.data.xcount);u[m]||(u[m]=[]),u[m].push(g),d[g]||(d[g]=[]),d[g].push(m)}for(i=0;i<u.length;i++){if(!u[i])continue;console.log(u[i]);let b=1e3,A=0,v=0;for(j=0;j<u[i].length;j++)2==o.getOccurrence(u[i],u[i][j])&&(console.log(10),v++,b=Math.min(b,u[i][j]),A=Math.max(A,u[i][j]));let y=A-b;-1e3!=y&&(console.log(b,A,y,v),s=Math.min(s,y*v/2),v=0)}$("#dots_rx p:last-child").text(s+" #")}}),AFRAME.registerShader("colormix",{schema:{color1:{type:"color",is:"uniform",default:"#493889"},color2:{type:"color",is:"uniform",default:"#000"},brightness:{type:"number",is:"uniform",default:.1},pct:{type:"number",is:"uniform",default:.5},scale:{type:"number",is:"uniform",default:1},opacity:{type:"number",is:"uniform",default:1},timeMsec:{type:"time",is:"uniform"}},vertexShader:`
varying vec2 vUv;
varying vec3 pos;
void main() {
vUv = uv;
pos = position;
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
}
`,fragmentShader:`
varying vec2 vUv;
varying vec3 pos;
uniform vec3 color1;
uniform vec3 color2;
uniform float pct;
uniform float brightness;
uniform float scale;
uniform float opacity;
uniform float timeMsec; // A-Frame time in milliseconds.
float mod289(float x){return x - floor(x * (1.0 / 289.0)) * 289.0;}
vec4 mod289(vec4 x){return x - floor(x * (1.0 / 289.0)) * 289.0;}
vec4 perm(vec4 x){return mod289(((x * 34.0) + 1.0) * x);}
float noise(vec3 p){
vec3 a = floor(p);
vec3 d = p - a;
d = d * d * (3.0 - 2.0 * d);
vec4 b = a.xxyy + vec4(0.0, 1.0, 0.0, 1.0);
vec4 k1 = perm(b.xyxy);
vec4 k2 = perm(k1.xyxy + b.zzww);
vec4 c = k2 + a.zzzz;
vec4 k3 = perm(c);
vec4 k4 = perm(c + 1.0);
vec4 o1 = fract(k3 * (1.0 / 41.0));
vec4 o2 = fract(k4 * (1.0 / 41.0));
vec4 o3 = o2 * d.z + o1 * (1.0 - d.z);
vec2 o4 = o3.yw * d.x + o3.xz * (1.0 - d.x);
return o4.y * d.y + o4.x * (1.0 - d.y);
}
void main() {
float n = noise(pos/50.0*scale);
vec3 color = vec3(
color1.r*n*(1.0-pct) + color2.r*n*pct + color2.r*(1.0-n),
color1.g*n*(1.0-pct) + color2.g*n*pct + color2.g*(1.0-n),
color1.b*n*(1.0-pct) + color2.b*n*pct + color2.b*(1.0-n)
);
gl_FragColor = vec4(mix(vec3(0),color,1.0 +clamp(brightness,0.0,1.5)),opacity);
}
`}),AFRAME.registerShader("blurpoint",{schema:{color:{type:"color",is:"uniform"},timeMsec:{type:"time",is:"uniform"},opacity:{type:"number",is:"uniform",default:.7}},vertexShader:`
varying vec2 vUv;
void main() {
vUv = uv;
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
}
`,fragmentShader:`
varying vec2 vUv;
uniform vec3 color;
uniform float timeMsec; // A-Frame time in milliseconds.
uniform float opacity;
void main() {
float time = timeMsec / 1000.0; // Convert from A-Frame milliseconds to typical time in seconds.
vec3 col = color;
vec2 pos = vec2(vUv.x - 0.5, vUv.y - 0.5);
float alpha = opacity - smoothstep(0.0, 0.8, length(pos));
gl_FragColor = vec4(col, alpha);
}
`});let d,m;AFRAME.registerComponent("epart",{schema:{main:{type:"boolean",default:!1},name:{type:"array"},pins:{type:"array"},wires:{type:"array"},cons:{type:"array"}},init:function(){this.part=this.data.name[1],this.type=this.part.slice(0,-1),this.num=this.part.substring(this.part.length-1),this.positioned=!1},tick:function(e,s){if(o.status<1)return;if(this.data.main){if(this.el.object3D.visible||3!=o.status||o.simulate(),o.wires&&!o.wires.getAttribute("wiring")&&o.wires.setAttribute("wiring",""),o.iframe.newMsg){for(let n in o.iframe.newMsg=!1,ARparams){let a=o.getObj(ARstate,n);a||(a=o.getObj(ARstate,n.slice(0,-3))),"object"!=typeof a||Array.isArray(a)||null===a||(a=a.value),a&&(a=o.map(a,0,1,ARparams[n][1],ARparams[n][2]),$("#"+n+"_range").length&&$("#"+n+"_range").val()!=a?($("#"+n+"_range").val(a),o.sliderClick(n+"_range")):$("#"+n.slice(0,-3)+"_range").length&&$("#"+n.slice(0,-3)+"_range").val()!=a&&($("#"+n.slice(0,-3)+"_range").val(a),o.sliderClick(n.slice(0,-3)+"_range")))}for(let r in o.translated){let l=o.getObj(ARstate,r);"switch"==r.substring(0,6)&&($("#"+r).is(":checked")&&0==l||!$("#"+r).is(":checked")&&1==l?($("#"+r).click(),this.switches(r,l)):$("#"+r).data("val")!=l&&(this.switches(r,l),$("#"+r).data("val",l)))}}return}let c=this.part,h;if(ARstate&&(h=o.getObj(ARstate,this.data.name[0])),this.el.object3D.visible&&!$("#"+c+"_check").prop("checked")&&($("#"+c+"_check").prop("checked",!0),$("#"+c+"_colap").show(),this.el.emit("show")),!this.positioned&&h&&h.position&&(!o.inIframe()||o.iframe.firstMsg)&&((h.position[0]!=this.el.object3D.position.x||h.position[1]!=this.el.object3D.position.y)&&(this.el.object3D.position.x=h.position[0],this.el.object3D.position.y=h.position[1]),this.positioned=!0,this.el.object3D.visible=!0,$("#"+c+"_check").prop("checked",!0),$("#"+c+"_colap").show()),!(c in o.ARwires)){if(o.ARwires[c]={},this.data.pins.forEach(function(e){o.ARwires[c][e]=[]}),null!=this.data.wires)for(i=0;i<this.data.wires.length;i+=2)o.ARwires[c][this.data.wires[i]].push(this.data.wires[i+1]);if(ARstate){for(let u in h)if("pin"==u.slice(-3)){if(Array.isArray(h[u]))for(i=0;i<h[u].length;i++)this.registerPin(c,u,h[u][i]);else this.registerPin(c,u,h[u])}}}if(!ARstate)return;let d=this.el;if(o.sceneEl.is("ar-mode")&&(d=this.el.querySelectorAll("a-entity")[0]),h&&h.speed){let m=h.direction;m=0==m?"normal":"reverse";let g=255*h.speed;if(g<=0)d.setAttribute("animation","enabled",!1);else{let b=ARparams.speed,A=o.map(g,b[1],b[2],1e3*b[0],100*b[0]);if(3==o.status){let v=d.getAttribute("animation");if(!v)return;if(!v.enabled||v.dur!=A||v.dir!=m){d.setAttribute("animation","enabled",!0);let y="";d.getAttribute("gltf-transform")&&(y=d.getAttribute("gltf-transform").name);var _=d.getObject3D("mesh");if(!_)return;let w=_.getObjectByName(y);if(!w)return;let x=v.to.split(" "),E=v.property.split(".")[1],C="",D="";for(i=0;i<x.length;i++){let B;if(B=1==i?"y":2==i?"z":"x",0!=parseFloat(x[i])){let P=parseFloat(w[E][B]);C+=P+" ",D+=P+6.3+" "}else C+="0 ",D+="0 "}d.setAttribute("animation",{from:C,to:D,dir:m,dur:A})}}else d.setAttribute("animation","enabled",!1)}}else if(h&&h.value){if("ultrasonic"==this.data.name[0]){if(o.sceneEl.is("2d-mode")){let M=-.05*h.value-.02;$("#wall")[0].object3D.position.z!=M&&($("#wall")[0].object3D.position.z=M)}else this.distance()}else if(3==o.status){let I=d.getAttribute("animation");if(!I)return;if(!I.enabled){d.setAttribute("animation","enabled",!0);let Q="";d.getAttribute("gltf-transform")&&(Q=d.getAttribute("gltf-transform").name);var _=d.getObject3D("mesh");if(!_)return;let R=_.getObjectByName(Q);if(!R)return;let O=I.to.split(" "),L=I.property.split(".")[1],z="",S="";if(h.value<=0)return d.setAttribute("animation","enabled",!1);for(i=0;i<O.length;i++){let H;if(H=1==i?"y":2==i?"z":"x",0!=parseFloat(O[i])){let F=o.map(h.value,0,1,0,3.15);z+=parseFloat(R[L][H])+" ",S+=F+" "}else z+="0 ",S+="0 "}d.setAttribute("animation",{from:z,to:S})}}else d.setAttribute("animation",{enabled:!1})}},registerPin:function(e,s,n){if(n==ARparams.none)return;o.ARwires[e][s.charAt(0)].push(n);let a=ARparams.autoPins[n];if(a)for(i=0;i<a.length;i+=2)o.ARwires[e][a[i]]&&o.ARwires[e][a[i]].push(a[i+1]);ARparams.multiple||o.usedPins.push(n)},distance:(r=new THREE.Vector3,l=new THREE.Vector3,d=new THREE.Vector3,m=new THREE.Vector3,function(){var e=this.el.getObject3D("mesh"),s=$("#wall")[0].getObject3D("mesh");if(!e||!s)return;let n=e.getObjectByName("s"),a=s.getObjectByName("s");if(!n||!a)return;e.matrixWorld.decompose(r,new THREE.Quaternion,new THREE.Vector3),s.matrixWorld.decompose(l,new THREE.Quaternion,new THREE.Vector3),n.matrixWorld.decompose(d,new THREE.Quaternion,new THREE.Vector3),a.matrixWorld.decompose(m,new THREE.Quaternion,new THREE.Vector3);let c=new THREE.Vector3(r.x,r.y,0),h=new THREE.Vector3(l.x,l.y,0),u=c.distanceTo(h);if(Number.isNaN(u))return;let g=!1;var b=new THREE.Vector3(d.x-r.x,d.y-r.y,0),A=new THREE.Vector3(m.x-l.x,m.y-l.y,0);b.angleTo(A)>.3&&2.8>b.angleTo(A)&&(g=!1);var v=new THREE.Vector3(c.x-h.x,c.y-h.y-160,0);if(u<300?(this.data.smooth=[],g=!1,u=1):Math.PI-v.angleTo(b)<Math.asin(400/u)?(u=Math.round(2*smoothing(this.data.smooth,30,map(u,300,1800,3,20)))/2,u=map(u,3,20,0,1)):(this.data.smooth=[],g=!1,u=1),ARparams[this.data.name[0]+"val"][0]!=u){ARparams[this.data.name[0]+"val"][0]=u;let y={};y.value=u,o.setEvt(ARstate,this.data.name[0],y)}}),switches:function(e,s){let n=this.el.getAttribute("animation__"+e);if(!n)return;let a=n.from;n.from=n.to,n.to=a,n.enabled=!0,this.el.emit(e)},setpos:function(e){let s={};s.position=[this.el.getAttribute("position").x.toFixed(3),this.el.getAttribute("position").y.toFixed(3)],e&&(s.position=null),this.data.main?(o.setObj(ARstate,this.data.name[0],s),ARmsg[this.data.name[0]].position=s.position,o.permissions.msg&&o.sendMsg(ARmsg),delete ARmsg[this.data.name[0]].position):o.setEvt(ARstate,this.data.name[0],s)},events:{show:function(){this.setpos()},hide:function(){this.setpos(!0)},"grab-end":function(){this.setpos()}}});let g;AFRAME.registerComponent("wiring",{schema:{resolution:{default:12},tickness:{default:6},inflection:{default:1}},tick:(c=new THREE.Vector3,h=new THREE.Vector3,g=new THREE.Vector3,function(e,s){if(!(o.status<1)&&1!=Object.keys(o.ARwires).length)for(var n in o.ARwires){if("all"==n)continue;let a=o.ARwires[n];for(var r in a)if(0!=a[r].length)for(i=0;i<a[r].length;i++){let l=String(a[r][i]).split(" "),u=n+"_"+r+"_"+l[1]+"_"+l[0];this.wire=document.querySelector("#"+u);let d=document.querySelector("#"+l[1]+"Model"),m=document.querySelector("#"+n+"Model");if(!m.object3D.visible||!m.parentElement.object3D.visible||!d.object3D.visible||!d.parentElement.object3D.visible){$("#"+u).length&&($("#"+u)[0].object3D.visible=!1);continue}var b=m.getObject3D("mesh"),A=d.getObject3D("mesh");if(!b||!A)continue;let v=b.getObjectByName(r),y=A.getObjectByName("p"+l[0]);if(!v||!y)continue;b.matrixWorld.decompose(g,new THREE.Quaternion,new THREE.Vector3),v.matrixWorld.decompose(c,new THREE.Quaternion,new THREE.Vector3),y.matrixWorld.decompose(h,new THREE.Quaternion,new THREE.Vector3);var _=h.x+" "+h.y+" "+h.z,w=c.x+" "+c.y+" "+c.z,x=new THREE.Vector3(o.lerp(c.x,h.x,.5),o.lerp(c.y,h.y,.5),o.lerp(c.z,h.z,.5)+this.data.inflection/10);if(this.wire){if(this.wire.getAttribute("stafin")==w+_){this.wire.object3D.visible=!0;continue}}else this.wire=document.createElement("a-entity"),this.wire.setAttribute("id",u),o.ARwires.all.push(u),this.wire.object3D.visible=!0,o.wires.appendChild(this.wire);this.wire.textContent="";let E=[c,x,h];var C=this.data.inflection/10;(this.between(g.x,h.x,c.x)||this.between(g.y,h.y,c.y))&&(E=[c,new THREE.Vector3(c.x,c.y,c.z+C),new THREE.Vector3(x.x,x.y,x.z+C),new THREE.Vector3(h.x,h.y,h.z+C),h]),this.wire.appendChild(this.setSpline(E,w,_,this.setColor(r)))}}}),setSpline:function(e,s,n,a){let r=new THREE.CatmullRomCurve3(e),l=new THREE.Vector3,c="";for(let h=0,u=this.data.resolution;h<u;h++){let d=h/u;r.getPoint(d,l),c+=l.x+" "+l.y+" "+l.z,h<this.data.resolution-1&&(c+=",")}let m=document.createElement("a-entity");return m.setAttribute("tickline",{lineWidth:this.data.tickness,path:c+","+n,color:a}),this.wire.setAttribute("stafin",s+n),m},setColor:function(e){let s="red";return"n"==e?s="black":"s"==e?s="orange":"t"==e?s="green":"e"==e&&(s="brown"),s},between:function(e,s,n){let a=!1,r=Math.max(s,e),l=Math.min(n,e);return Math.max(s,n)==s?l!=e&&r!=e&&(a=!0):l==e&&r==e&&(a=!0),a},remove:function(){}});class b extends THREE.BufferGeometry{constructor(){super(),this.type="MeshLine",this.isMeshLine=!0,this.positions=[],this.previous=[],this.next=[],this.side=[],this.width=[],this.indices_array=[],this.uvs=[],this.counters=[],this._points=[],this._geom=null,this.widthCallback=null,this.matrixWorld=new THREE.Matrix4,Object.defineProperties(this,{geometry:{enumerable:!0,get(){return this}},geom:{enumerable:!0,get(){return this._geom},set(e){this.setGeometry(e,this.widthCallback)}},points:{enumerable:!0,get(){return this._points},set(e){this.setPoints(e,this.widthCallback)}}})}setMatrixWorld(e){this.matrixWorld=e}setGeometry(e,s){this._geometry=e,e instanceof THREE.BufferGeometry?this.setPoints(e.getAttribute("position").array,s):this.setPoints(e,s)}setPoints(e,s){if(!(e instanceof Float32Array)&&!(e instanceof Array)){console.error("ERROR: The BufferArray of points is not instancied correctly.");return}if(this._points=e,this.widthCallback=s,this.positions=[],this.counters=[],e.length&&e[0]instanceof THREE.Vector3)for(var n=0;n<e.length;n++){let a=e[n];var r=n/e.length;this.positions.push(a.x,a.y,a.z),this.positions.push(a.x,a.y,a.z),this.counters.push(r),this.counters.push(r)}else for(var n=0;n<e.length;n+=3){var r=n/e.length;this.positions.push(e[n],e[n+1],e[n+2]),this.positions.push(e[n],e[n+1],e[n+2]),this.counters.push(r),this.counters.push(r)}this.process()}compareV3(e,s){let n=6*e,a=6*s;return this.positions[n]===this.positions[a]&&this.positions[n+1]===this.positions[a+1]&&this.positions[n+2]===this.positions[a+2]}copyV3(e){let s=6*e;return[this.positions[s],this.positions[s+1],this.positions[s+2]]}process(){let e=this.positions.length/6;this.previous=[],this.next=[],this.side=[],this.width=[],this.indices_array=[],this.uvs=[];let s,n;n=this.compareV3(0,e-1)?this.copyV3(e-2):this.copyV3(0),this.previous.push(n[0],n[1],n[2]),this.previous.push(n[0],n[1],n[2]);for(let a=0;a<e;a++){if(this.side.push(1),this.side.push(-1),s=this.widthCallback?this.widthCallback(a/(e-1)):1,this.width.push(s),this.width.push(s),this.uvs.push(a/(e-1),0),this.uvs.push(a/(e-1),1),a<e-1){n=this.copyV3(a),this.previous.push(n[0],n[1],n[2]),this.previous.push(n[0],n[1],n[2]);let r=2*a;this.indices_array.push(r,r+1,r+2),this.indices_array.push(r+2,r+1,r+3)}a>0&&(n=this.copyV3(a),this.next.push(n[0],n[1],n[2]),this.next.push(n[0],n[1],n[2]))}n=this.compareV3(e-1,0)?this.copyV3(1):this.copyV3(e-1),this.next.push(n[0],n[1],n[2]),this.next.push(n[0],n[1],n[2]),this._attributes&&this._attributes.position.count===this.positions.length?(this._attributes.position.copyArray(new Float32Array(this.positions)),this._attributes.position.needsUpdate=!0,this._attributes.previous.copyArray(new Float32Array(this.previous)),this._attributes.previous.needsUpdate=!0,this._attributes.next.copyArray(new Float32Array(this.next)),this._attributes.next.needsUpdate=!0,this._attributes.side.copyArray(new Float32Array(this.side)),this._attributes.side.needsUpdate=!0,this._attributes.width.copyArray(new Float32Array(this.width)),this._attributes.width.needsUpdate=!0,this._attributes.uv.copyArray(new Float32Array(this.uvs)),this._attributes.uv.needsUpdate=!0,this._attributes.index.copyArray(new Uint16Array(this.indices_array)),this._attributes.index.needsUpdate=!0):this._attributes={position:new THREE.BufferAttribute(new Float32Array(this.positions),3),previous:new THREE.BufferAttribute(new Float32Array(this.previous),3),next:new THREE.BufferAttribute(new Float32Array(this.next),3),side:new THREE.BufferAttribute(new Float32Array(this.side),1),width:new THREE.BufferAttribute(new Float32Array(this.width),1),uv:new THREE.BufferAttribute(new Float32Array(this.uvs),2),index:new THREE.BufferAttribute(new Uint16Array(this.indices_array),1),counters:new THREE.BufferAttribute(new Float32Array(this.counters),1)},this.setAttribute("position",this._attributes.position),this.setAttribute("previous",this._attributes.previous),this.setAttribute("next",this._attributes.next),this.setAttribute("side",this._attributes.side),this.setAttribute("width",this._attributes.width),this.setAttribute("uv",this._attributes.uv),this.setAttribute("counters",this._attributes.counters),this.setIndex(this._attributes.index),this.computeBoundingSphere(),this.computeBoundingBox()}advance({x:e,y:s,z:n}){let a=this._attributes.position.array,r=this._attributes.previous.array,l=this._attributes.next.array,c=a.length;v(a,0,r,0,c),v(a,6,a,0,c-6),a[c-6]=e,a[c-5]=s,a[c-4]=n,a[c-3]=e,a[c-2]=s,a[c-1]=n,v(a,6,l,0,c-6),l[c-6]=e,l[c-5]=s,l[c-4]=n,l[c-3]=e,l[c-2]=s,l[c-1]=n,this._attributes.position.needsUpdate=!0,this._attributes.previous.needsUpdate=!0,this._attributes.next.needsUpdate=!0}}THREE.ShaderChunk.meshline_vert=["","#include <common>","",THREE.ShaderChunk.logdepthbuf_pars_vertex,THREE.ShaderChunk.fog_pars_vertex,"","attribute vec3 previous;","attribute vec3 next;","attribute float side;","attribute float width;","attribute float counters;","","uniform vec2 resolution;","uniform float lineWidth;","uniform vec3 color;","uniform float opacity;","uniform float sizeAttenuation;","","varying vec2 vUV;","varying vec4 vColor;","varying float vCounters;","","vec2 fix( vec4 i, float aspect ) {",""," vec2 res = i.xy / i.w;"," res.x *= aspect;"," vCounters = counters;"," return res;","","}","","void main() {",""," float aspect = resolution.x / resolution.y;",""," vColor = vec4( color, opacity );"," vUV = uv;",""," mat4 m = projectionMatrix * modelViewMatrix;"," vec4 finalPosition = m * vec4( position, 1.0 );"," vec4 prevPos = m * vec4( previous, 1.0 );"," vec4 nextPos = m * vec4( next, 1.0 );",""," vec2 currentP = fix( finalPosition, aspect );"," vec2 prevP = fix( prevPos, aspect );"," vec2 nextP = fix( nextPos, aspect );",""," float w = lineWidth * width;",""," vec2 dir;"," if( nextP == currentP ) dir = normalize( currentP - prevP );"," else if( prevP == currentP ) dir = normalize( nextP - currentP );"," else {"," vec2 dir1 = normalize( currentP - prevP );"," vec2 dir2 = normalize( nextP - currentP );"," dir = normalize( dir1 + dir2 );",""," vec2 perp = vec2( -dir1.y, dir1.x );"," vec2 miter = vec2( -dir.y, dir.x );"," //w = clamp( w / dot( miter, perp ), 0., 4. * lineWidth * width );",""," }",""," //vec2 normal = ( cross( vec3( dir, 0. ), vec3( 0., 0., 1. ) ) ).xy;"," vec4 normal = vec4( -dir.y, dir.x, 0., 1. );"," normal.xy *= .5 * w;"," normal *= projectionMatrix;"," if( sizeAttenuation == 0. ) {"," normal.xy *= finalPosition.w;"," normal.xy /= ( vec4( resolution, 0., 1. ) * projectionMatrix ).xy;"," }",""," finalPosition.xy += normal.xy * side;",""," gl_Position = finalPosition;","",THREE.ShaderChunk.logdepthbuf_vertex,THREE.ShaderChunk.fog_vertex&&" vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.fog_vertex,"}"].join("\n"),THREE.ShaderChunk.meshline_frag=["",THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.logdepthbuf_pars_fragment,"","uniform sampler2D map;","uniform sampler2D alphaMap;","uniform float useMap;","uniform float useAlphaMap;","uniform float useDash;","uniform float dashArray;","uniform float dashOffset;","uniform float dashRatio;","uniform float visibility;","uniform float alphaTest;","uniform vec2 repeat;","","varying vec2 vUV;","varying vec4 vColor;","varying float vCounters;","","void main() {","",THREE.ShaderChunk.logdepthbuf_fragment,""," vec4 c = vColor;"," if( useMap == 1. ) c *= texture2D( map, vUV * repeat );"," if( useAlphaMap == 1. ) c.a *= texture2D( alphaMap, vUV * repeat ).a;"," if( c.a < alphaTest ) discard;"," if( useDash == 1. ){"," c.a *= ceil(mod(vCounters + dashOffset, dashArray) - (dashArray * dashRatio));"," }"," gl_FragColor = c;"," gl_FragColor.a *= step(vCounters, visibility);","",THREE.ShaderChunk.fog_fragment,"}"].join("\n");class A extends THREE.ShaderMaterial{constructor(e){super({uniforms:Object.assign({},THREE.UniformsLib.fog,{lineWidth:{value:1},map:{value:null},useMap:{value:0},alphaMap:{value:null},useAlphaMap:{value:0},color:{value:new THREE.Color(16777215)},opacity:{value:1},resolution:{value:new THREE.Vector2(1,1)},sizeAttenuation:{value:1},dashArray:{value:0},dashOffset:{value:0},dashRatio:{value:.5},useDash:{value:0},visibility:{value:1},alphaTest:{value:0},repeat:{value:new THREE.Vector2(1,1)}}),vertexShader:THREE.ShaderChunk.meshline_vert,fragmentShader:THREE.ShaderChunk.meshline_frag}),this.type="MeshLineMaterial",Object.defineProperties(this,{lineWidth:{enumerable:!0,get(){return this.uniforms.lineWidth.value},set(e){this.uniforms.lineWidth.value=e}},map:{enumerable:!0,get(){return this.uniforms.map.value},set(e){this.uniforms.map.value=e}},useMap:{enumerable:!0,get(){return this.uniforms.useMap.value},set(e){this.uniforms.useMap.value=e}},alphaMap:{enumerable:!0,get(){return this.uniforms.alphaMap.value},set(e){this.uniforms.alphaMap.value=e}},useAlphaMap:{enumerable:!0,get(){return this.uniforms.useAlphaMap.value},set(e){this.uniforms.useAlphaMap.value=e}},color:{enumerable:!0,get(){return this.uniforms.color.value},set(e){this.uniforms.color.value=e}},opacity:{enumerable:!0,get(){return this.uniforms.opacity.value},set(e){this.uniforms.opacity.value=e}},resolution:{enumerable:!0,get(){return this.uniforms.resolution.value},set(e){this.uniforms.resolution.value.copy(e)}},sizeAttenuation:{enumerable:!0,get(){return this.uniforms.sizeAttenuation.value},set(e){this.uniforms.sizeAttenuation.value=e}},dashArray:{enumerable:!0,get(){return this.uniforms.dashArray.value},set(e){this.uniforms.dashArray.value=e,this.useDash=0!==e?1:0}},dashOffset:{enumerable:!0,get(){return this.uniforms.dashOffset.value},set(e){this.uniforms.dashOffset.value=e}},dashRatio:{enumerable:!0,get(){return this.uniforms.dashRatio.value},set(e){this.uniforms.dashRatio.value=e}},useDash:{enumerable:!0,get(){return this.uniforms.useDash.value},set(e){this.uniforms.useDash.value=e}},visibility:{enumerable:!0,get(){return this.uniforms.visibility.value},set(e){this.uniforms.visibility.value=e}},alphaTest:{enumerable:!0,get(){return this.uniforms.alphaTest.value},set(e){this.uniforms.alphaTest.value=e}},repeat:{enumerable:!0,get(){return this.uniforms.repeat.value},set(e){this.uniforms.repeat.value.copy(e)}}}),this.setValues(e)}copy(e){return super.copy(e),this.lineWidth=e.lineWidth,this.map=e.map,this.useMap=e.useMap,this.alphaMap=e.alphaMap,this.useAlphaMap=e.useAlphaMap,this.color.copy(e.color),this.opacity=e.opacity,this.resolution.copy(e.resolution),this.sizeAttenuation=e.sizeAttenuation,this.dashArray.copy(e.dashArray),this.dashOffset.copy(e.dashOffset),this.dashRatio.copy(e.dashRatio),this.useDash=e.useDash,this.visibility=e.visibility,this.alphaTest=e.alphaTest,this.repeat.copy(e.repeat),this}}function v(e,s,n,a,r){let l;if(e=e.subarray||e.slice?e:e.buffer,n=n.subarray||n.slice?n:n.buffer,e=s?e.subarray?e.subarray(s,r&&s+r):e.slice(s,r&&s+r):e,n.set)n.set(e,a);else for(l=0;l<e.length;l++)n[l+a]=e[l];return n}THREE.MeshLine=b,THREE.MeshLineMaterial=A,AFRAME.registerComponent("tickline",{schema:{color:{default:"#000"},lineWidth:{default:10},lineWidthStyler:{default:""},sizeAttenuation:{default:0},path:{default:[{x:-.5,y:0,z:0},{x:.5,y:0,z:0}],parse:function(e){return e.split(",").map(AFRAME.utils.coordinates.parse)},stringify:function(e){return e.map(AFRAME.utils.coordinates.stringify).join(",")}}},init:function(){this.resolution=new THREE.Vector2(window.innerWidth,window.innerHeight);var e=this.el.sceneEl;e.addEventListener("render-target-loaded",this.do_update.bind(this)),e.addEventListener("render-target-loaded",this.addlisteners.bind(this))},addlisteners:function(){window.addEventListener("resize",this.do_update.bind(this))},do_update:function(){var e=this.el.sceneEl.canvas;this.resolution.set(e.width,e.height),this.update()},update:function(){var e=new THREE.MeshLineMaterial({color:new THREE.Color(this.data.color),resolution:this.resolution,sizeAttenuation:this.data.sizeAttenuation,lineWidth:this.data.lineWidth}),s=[];this.data.path.forEach(function(e){s.push(e.x||0,e.y||0,e.z||0)});var n="string"==typeof this.data.lineWidthStyler&&this.data.lineWidthStyler.length>0?Function("p","return "+this.data.lineWidthStyler):function(){return 1},a=new THREE.MeshLine;a.setGeometry(new Float32Array(s),n),this.el.setObject3D("mesh",new THREE.Mesh(a.geometry,e))},remove:function(){this.el.removeObject3D("mesh")}}),AFRAME.registerComponent("gltf-animator",{schema:{timeline:{type:"string",default:"tl1"},bones:{type:"array"},to:{type:"array"}},init:function(){this.el.addEventListener("model-loaded",this.update.bind(this)),this.run=1},update:function(){var e=this.el.getObject3D("mesh");if(e)for(i=0;i<this.data.bones.length;i++){var s=this.data.bones[i];let n=e.getObjectByName(s[0]);if(!n||(this.run=this.run+1,!this.data.to))return;n[s[1]].x=this.data.to[3*i],n[s[1]].y=this.data.to[3*i+1],n[s[1]].z=this.data.to[3*i+2]}}})},corrections:function(){Object.defineProperty(HTMLMediaElement.prototype,"playing",{get:function(){return!!(this.currentTime>0&&!this.paused&&!this.ended&&this.readyState>2)}}),Array.prototype.equals=function(e){if(!e||this.length!=e.length)return!1;for(var s=0,n=this.length;s<n;s++)if(this[s]instanceof Array&&e[s]instanceof Array){if(!this[s].equals(e[s]))return!1}else if("string"==typeof this[s]){if(this[s]!=e[s])return!1}else if("string"!=typeof this[s]&&Math.abs(Math.abs(this[s])-Math.abs(e[s]))>Math.pow(10,-(o.data.precision-1)))return!1;return!0},Object.defineProperty(Array.prototype,"equals",{enumerable:!1}),THREE.Matrix4.prototype.getInverse=function e(s){return this.copy(s).invert()},THREE.Quaternion.prototype.inverse=function(){return this.invert()},HTMLElement.prototype.alpha=function(e){current_color=getComputedStyle(this).getPropertyValue("background-color"),match=/rgba?\((\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*\d+[\.\d+]*)*\)/g.exec(current_color),e=e>1?e/100:e,this.style.backgroundColor="rgba("+[match[1],match[2],match[3],e].join(",")+")"},THREE.Material.prototype.setValues=function(e){if(void 0!==e)for(let s in e){let n=e[s];if(void 0===n)continue;if("shading"===s){this.flatShading=n===FlatShading;continue}let a=this[s];void 0!==a&&(a&&a.isColor?a.set(n):a&&a.isVector3&&n&&n.isVector3?a.copy(n):this[s]=n)}},THREE.BufferGeometry.prototype.applyMatrix=function(e){return this.applyMatrix4(e)},THREE.BufferAttribute.prototype.setDynamic=function(e){return this.setUsage(!0===e?THREE.DynamicDrawUsage:THREE.StaticDrawUsage),this},THREE.BufferGeometry.prototype.addAttribute=function(e,s){return s&&s.isBufferAttribute||s&&s.isInterleavedBufferAttribute?"index"===e?(this.setIndex(s),this):this.setAttribute(e,s):this.setAttribute(e,new BufferAttribute(arguments[1],arguments[2]))},AFRAME.components["super-hands"]&&(AFRAME.components.grabbable.Component.prototype.physicsStart=function(e){if(Object.keys(this.el.components).forEach(e=>{if(e.includes("ammo-constraint")){let s=this.el.getAttribute(e).target;s&&s.components["ammo-body"].syncToPhysics()}}),e.detail.hand&&(e.detail.hand.grabbedEl=[this.el],e.detail.hand.grabbedEl.push(e.detail.hand.object3D.position.length())),o.toKinematic(this.el),this.data.usePhysics="never","never"!==this.data.usePhysics&&this.el.body&&e.detail.hand.body&&!this.constraints.has(e.detail.hand)){let s=Math.random().toString(36).substr(2,9);return this.el.setAttribute("ammo-constraint__"+s,{target:e.detail.hand}),this.constraints.set(e.detail.hand,s),!0}return"only"===this.data.usePhysics},AFRAME.components.grabbable.Component.prototype.physicsEnd=function(e){let s=this.constraints.get(e.detail.hand);e.detail.hand&&(e.detail.hand.grabbedEl=[]),o.toDynamic(this.el),this.data.usePhysics="never",s&&(this.el.removeAttribute("ammo-constraint__"+s),this.constraints.delete(e.detail.hand))},AFRAME.components.grabbable.Component.prototype.start=function(e){if(e.defaultPrevented||!this.startButtonOk(e))return;let s=!Number.isFinite(this.data.maxGrabbers)||this.grabbers.length<this.data.maxGrabbers;if(-1===this.grabbers.indexOf(e.detail.hand)&&s){if(!e.detail.hand.object3D){console.warn("grabbable entities must have an object3D");return}this.grabbers.push(e.detail.hand),this.physicsStart(e)||this.grabber||(this.grabber=e.detail.hand,this.resetGrabber()),e.preventDefault&&e.preventDefault(),this.grabbed=!0,this.el.addState(this.GRABBED_STATE)}},AFRAME.components.grabbable.Component.prototype.init=function(){this.GRABBED_STATE="grabbed",this.GRAB_EVENT="grab-start",this.UNGRAB_EVENT="grab-end",this.grabbed=!1,this.grabbers=[],this.constraints=new Map,this.deltaPositionIsValid=!1,this.grabDistance=void 0,this.grabDirection={x:0,y:0,z:-1},this.grabOffset={x:0,y:0,z:0},this.destPosition={x:0,y:0,z:0},this.deltaPosition=new THREE.Vector3,this.targetPosition=new THREE.Vector3,this.physicsInit(),this.el.dataset.aabbColliderDynamic=!0,this.el.addEventListener(this.GRAB_EVENT,e=>{o.sceneEl.is("vr-mode")||(e.detail.hand=$("#rhandcursor")[0]),this.start(e)}),this.el.addEventListener(this.UNGRAB_EVENT,e=>{o.sceneEl.is("vr-mode")||(e.detail.hand=$("#rhandcursor")[0]),this.end(e)}),this.el.addEventListener("mouseout",e=>{let s=o.cameraRig.components["movement-controls"];if(s&&!s.velocityCtrl){if(!o.sceneEl.is("vr-mode")){e.detail.hand=$("#rhandcursor")[0],this.el.emit("grab-end",e);return}this.lostGrabber(e)}})},AFRAME.components.grabbable.Component.prototype.updateSchema=function(e){this.extendSchema({suppressX:{type:"boolean",default:!1},suppressZ:{type:"boolean",default:!1},wasDynamic:{type:"boolean",default:!1}})},AFRAME.components.grabbable.Component.prototype.update=function(){this.physicsUpdate(),this.xFactor=(this.data.invert?-1:1)*!this.data.suppressX,this.zFactor=(this.data.invert?-1:1)*!this.data.suppressZ,this.yFactor=(this.data.invert?-1:1)*!this.data.suppressY},AFRAME.components.grabbable.Component.prototype.tick=function(){let e=new THREE.Quaternion,s=new THREE.Vector3;return function(){let n;if(this.grabber&&"camera"!=this.grabber.origin&&3==o.status){this.grabber.object3D.getWorldPosition(s);let a=this.el.getAttribute("lock")||{p:""};s.x*=!this.xFactor||a.p.includes("X")?0:1,s.y*=!this.yFactor||a.p.includes("Y")?0:1,s.z*=!this.zFactor||a.p.includes("Z")?0:1,this.targetPosition.copy(this.grabDirection),this.targetPosition.applyQuaternion(this.grabber.object3D.getWorldQuaternion(e)).setLength(this.grabDistance).add(s).add(this.grabOffset),this.deltaPositionIsValid?(this.deltaPosition.sub(this.targetPosition),n=this.el.getAttribute("position"),this.destPosition.x=n.x-this.deltaPosition.x*this.xFactor,this.destPosition.y=n.y-this.deltaPosition.y*this.yFactor,this.destPosition.z=n.z-this.deltaPosition.z*this.zFactor,this.el.setAttribute("position",this.destPosition)):this.deltaPositionIsValid=!0,this.deltaPosition.copy(this.targetPosition),this.el.components["ammo-body"]&&this.el.components["ammo-body"].syncToPhysics()}}}(),AFRAME.components.stretchable.Component.prototype.stretchBody=function(e,s){}),AFRAME.systems.physics.prototype.init=async function(){var e=this.data;this.debug=e.debug,this.callbacks={beforeStep:[],step:[],afterStep:[]},this.listeners={},this.driver=new AmmoDriver,await this.driver.init({gravity:e.gravity,debugDrawMode:e.debugDrawMode,solverIterations:e.iterations,maxSubSteps:e.maxSubSteps,fixedTimeStep:e.fixedTimeStep}),this.initialized=!0,this.debug&&this.setDebug(!0)},AFRAME.components["ammo-body"].Component.prototype.syncFromPhysics=function(){let e=new THREE.Vector3,s=new THREE.Quaternion,n=new THREE.Quaternion;return function(){this.motionState.getWorldTransform(this.msTransform);let a=this.msTransform.getOrigin(),r=this.msTransform.getRotation(),l=this.el,c=l.parentEl,h=this.body;h&&c&&(c.isScene?(l.object3D.position.set(a.x(),a.y(),a.z()),l.object3D.quaternion.set(r.x(),r.y(),r.z(),r.w())):(s.set(r.x(),r.y(),r.z(),r.w()),c.object3D.getWorldQuaternion(n),s.multiply(n.invert()),l.object3D.quaternion.copy(s),e.set(a.x(),a.y(),a.z()),c.object3D.worldToLocal(e),l.object3D.position.copy(e)))}}(),AFRAME.components["ammo-body"].Component.prototype.tick=function(){this.system.initialized&&!this.isLoaded&&this.loadedEventFired&&this.initBody()}},colorToRGB:function(e){let s=new THREE.Color(e);return"rgb("+255*s.r+","+255*s.g+","+255*s.b+")"},replaceColorBase64:function(e,s,n){let a=e.replace("data:image/svg+xml;base64,","");return a=(a=window.atob(a)).replace(/#eeeeec/g,"#"+new THREE.Color(n).getHexString()),a="data:image/svg+xml;base64,"+(a=window.btoa(a))},sortString:function(e){return e.split("").sort().join("")},drawRound:function(e,s,n){var a,r,l,c,h,u,d=new THREE.Shape;return a=d,r=-e/2,l=-s/2,c=e,h=s,u=n,a.moveTo(r,l+u),a.lineTo(r,l+h-u),a.quadraticCurveTo(r,l+h,r+u,l+h),a.lineTo(r+c-u,l+h),a.quadraticCurveTo(r+c,l+h,r+c,l+h-u),a.lineTo(r+c,l+u),a.quadraticCurveTo(r+c,l,r+c-u,l),a.lineTo(r+u,l),a.quadraticCurveTo(r,l,r,l+u),new THREE.ShapeBufferGeometry(d)},maxIfGreater:function(e,s){return s>(e||0)?s:e},maxIfBelow:function(e,s,n){return s>(e||0)&&s<n?s:e},smoothingString:function(e,s,n){let a=0;return(e.length==s&&e.shift(),e.push(n),e.forEach(e=>{e===n&&(a+=1)}),a==s)?n:"none"},smoothing:function(e,s,n){var a=0;e.length==s&&e.shift(),e.push(n);for(var r=0;r<s;r++)a+=e[r];return e.length<s&&(s=e.length),a/e.length},radDeg:function(e){return e*(180/Math.PI)},getWorldPos:function(e){var s=new THREE.Vector3;return s.setFromMatrixPosition(e.object3D.matrixWorld),s},addHelper:function(e){let s=new THREE.AxesHelper(.2);e.setObject3D("axes-helper",s)},map:function(e,s,n,a,r){return(e-s)*(Math.max(r-a)/(Math.max(n-s)||1))+a||0},clamp:function(e,s,n){return Math.min(Math.max(e,s),n)},randFloatOne:function(){let e=Math.random();return .5>Math.random()&&(e=-Math.abs(e)),e},randInt:function(e){return Math.floor(Math.random()*e)+1},lerp:function(e,s,n){return(1-n)*e+n*s},between:function(e,s,n){if(e==s||e==n)return!1;let a=!1,r=Math.max(s,e),l=Math.min(n,e);return Math.max(s,n)==s?l!=e&&r!=e&&(a=!0):l==e&&r==e&&(a=!0),a},getOccurrence:function(e,s){var n=0;return e.forEach(e=>e===s&&n++),n},getPointInBetweenByPerc:function(e,s,n){var a=s.clone().sub(e),r=a.length();return a=a.normalize().multiplyScalar(r*n),e.clone().add(a)},openFullscreen:function(){var e=document.documentElement;e.requestFullscreen?e.requestFullscreen():e.mozRequestFullScreen?e.mozRequestFullScreen():e.webkitRequestFullscreen?e.webkitRequestFullscreen():e.msRequestFullscreen?e.msRequestFullscreen():e.webkitEnterFullscreen&&e.webkitEnterFullscreen()},closeFullscreen:function(){document.exitFullscreen?document.exitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitExitFullscreen?document.webkitExitFullscreen():document.msExitFullscreen?document.msExitFullscreen():elem.webkitExitFullscreen&&elem.webkitExitFullscreen()},tryKeepScreenAlive:function(e){!navigator.wakeLock||dev||navigator.wakeLock.request("screen").then(s=>{setTimeout(()=>s.release(),6e4*e)})},svgImg:function(e){let s=document.createElement("a-image");return s.setAttribute("src",this[e]),s},fillForm:function(){var e={};for(i=1;i<=(form.length-1)/2;i++)e[form[i]]=form[(form.length-1)/2+i];$.ajax({url:form[0],type:"GET",mode:"no-cors",crossDomain:!0,dataType:"xml",data:e,success:function(e,s,n){console.log("Enviado com sucesso.")},error:function(e,s,n){}})},fillResults:function(e){"action"==e||(o.results=null)},toKinematic:function(e){e.getAttribute("ammo-body")&&"dynamic"==e.getAttribute("ammo-body").type&&(e.addState("wasDynamic"),e.setAttribute("ammo-body","type","kinematic"),e.setAttribute("ammo-body","type","dynamic"),e.setAttribute("ammo-body","type","kinematic"))},toDynamic:function(e){e.getAttribute("ammo-body")&&e.is("wasDynamic")&&(e.removeState("wasDynamic"),e.setAttribute("ammo-body","type","dynamic"))},crypto:function(){THREE.FileLoader.prototype.load=function(s,n,a,r){s.includes("data:application")||(o.mod[s]=!0,s.includes("draco")||s.includes(".bin")?o.mod[s]=!1:o.mod[s]=!0),void 0===s&&(s=""),void 0!==this.path&&(s=this.path+s),s=this.manager.resolveURL(s);let l=this,c=e.get(s);if(void 0!==c)return l.manager.itemStart(s),setTimeout(function(){n&&n(c),l.manager.itemEnd(s)},0),c;if(void 0!==o.loading[s]){o.loading[s].push({onLoad:n,onProgress:a,onError:r});return}let h=s.match(/^data:(.*?)(;base64)?,(.*)$/),u;if(h){let d=h[1],m=!!h[2],g=h[3];g=decodeURIComponent(g),m&&(g=atob(g));try{let b,A=(this.responseType||"").toLowerCase();switch(A){case"arraybuffer":case"blob":let v=new Uint8Array(g.length);for(let y=0;y<g.length;y++)v[y]=g.charCodeAt(y);b="blob"===A?new Blob([v.buffer],{type:d}):v.buffer;break;case"document":let _=new DOMParser;b=_.parseFromString(g,d);break;case"json":b=JSON.parse(g);break;default:b=g}setTimeout(function(){n&&n(b),l.manager.itemEnd(s)},0)}catch(w){setTimeout(function(){r&&r(w),l.manager.itemError(s),l.manager.itemEnd(s)},0)}}else{for(let x in o.loading[s]=[],o.loading[s].push({onLoad:n,onProgress:a,onError:r}),(u=new XMLHttpRequest).open("GET",s,!0),u.addEventListener("load",function(n){let a=u.response;if(a.byteLength>1&&o.mod[s]&&(u.responseURL.includes("gltf")||u.responseURL.includes("js"))){let r=new TextDecoder("utf-8"),c=new TextEncoder;var h=r.decode(a);try{h=JSON.parse(h)}catch(d){return}let m=h.buffers;if(h.buffers=[],h=JSON.stringify(JSON.stringify(h)),u.responseURL.includes("gltf")){var g=/nodes/g;h=h.replace(g,"blobs");var g=/nsl/g;for(i=0,(h=JSON.parse(JSON.parse(h=h.replace(g,"snl")))).buffers=m;i<h.blobs.length;i++){if(Array.isArray(h.blobs[i].trasnlation))for(j=0;j<h.blobs[i].trasnlation.length;j++)h.blobs[i].trasnlation[j]=parseFloat(h.blobs[i].trasnlation[j].toFixed(o.data.precision));if(Array.isArray(h.blobs[i].rotation))for(j=0;j<h.blobs[i].rotation.length;j++)h.blobs[i].rotation[j]=parseFloat(h.blobs[i].rotation[j].toFixed(o.data.precision))}for(i=0;i<h.accessors.length;i++){if(Array.isArray(h.accessors[i].min))for(j=0;j<h.accessors[i].max.length;j++)h.accessors[i].max[j]=parseFloat(h.accessors[i].max[j].toFixed(o.data.precision));if(Array.isArray(h.accessors[i].min))for(j=0;j<h.accessors[i].min.length;j++)h.accessors[i].min[j]=parseFloat(h.accessors[i].min[j].toFixed(o.data.precision))}h=JSON.stringify(h),dev&&console.log(u.responseURL,h)}else if(u.responseURL.includes("js")){var g=/blobs/g;h=h.replace(g,"nodes");var g=/snl/g;(h=JSON.parse(JSON.parse(h=h.replace(g,"nsl")))).buffers=m,h=JSON.stringify(h);let b=c.encode(h);a=b,o.mod[s]=!1}}let A=o.loading[s];if(delete o.loading[s],200===this.status||0===this.status){0===this.status&&console.warn("THREE.FileLoader: HTTP Status 0 received."),e.add(s,a);for(let v=0,y=A.length;v<y;v++){let _=A[v];_.onLoad&&_.onLoad(a)}l.manager.itemEnd(s)}else{for(let w=0,x=A.length;w<x;w++){let E=A[w];E.onError&&E.onError(n)}l.manager.itemError(s),l.manager.itemEnd(s)}},!1),u.addEventListener("progress",function(e){let n=o.loading[s];for(let a=0,r=n.length;a<r;a++){let l=n[a];l.onProgress&&l.onProgress(e)}},!1),u.addEventListener("error",function(e){let n=o.loading[s];delete o.loading[s];for(let a=0,r=n.length;a<r;a++){let c=n[a];c.onError&&c.onError(e)}l.manager.itemError(s),l.manager.itemEnd(s)},!1),u.addEventListener("abort",function(e){let n=o.loading[s];delete o.loading[s];for(let a=0,r=n.length;a<r;a++){let c=n[a];c.onError&&c.onError(e)}l.manager.itemError(s),l.manager.itemEnd(s)},!1),void 0!==this.responseType&&(u.responseType=this.responseType),void 0!==this.withCredentials&&(u.withCredentials=this.withCredentials),u.overrideMimeType&&u.overrideMimeType(void 0!==this.mimeType?this.mimeType:"text/plain"),this.requestHeader)u.setRequestHeader(x,this.requestHeader[x]);u.send(null)}return l.manager.itemStart(s),u};let e={enabled:!1,files:{},add:function(e,s){!1!==this.enabled&&(this.files[e]=s)},get:function(e){if(!1!==this.enabled)return this.files[e]},remove:function(e){delete this.files[e]},clear:function(){this.files={}}}},ab2str:function(e){return String.fromCharCode.apply(null,new Uint16Array(e))},str2ab:function(e){for(var s=new ArrayBuffer(2*e.length),n=new Uint16Array(s),a=0,r=e.length;a<r;a++)n[a]=e.charCodeAt(a);return s},generator:function(){var e=null;return function(s){var n=new Blob([s],{type:"text/plain"});null!==e&&window.URL.revokeObjectURL(e),e=window.URL.createObjectURL(n),console.log(e)}}()});